[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:03:49 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 451d435e6682837ed51da2cd89ae525362195b17
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 19 08:10:03 2002 +0000

    	- a fix that gives another 1.5% on the iBench JavaScript test
    
            * kjs/ustring.cpp: (UString::from): Stop using sprintf to format integers.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2754 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 14e6c1d..8a8ad5f 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,9 @@
+2002-11-19  Darin Adler  <darin at apple.com>
+
+	- a fix that gives another 1.5% on the iBench JavaScript test
+
+        * kjs/ustring.cpp: (UString::from): Stop using sprintf to format integers.
+
 2002-11-18  Darin Adler  <darin at apple.com>
 
 	- reduced the creation of Value objects and hoisted the property map
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index 14e6c1d..8a8ad5f 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,3 +1,9 @@
+2002-11-19  Darin Adler  <darin at apple.com>
+
+	- a fix that gives another 1.5% on the iBench JavaScript test
+
+        * kjs/ustring.cpp: (UString::from): Stop using sprintf to format integers.
+
 2002-11-18  Darin Adler  <darin at apple.com>
 
 	- reduced the creation of Value objects and hoisted the property map
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 14e6c1d..8a8ad5f 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,9 @@
+2002-11-19  Darin Adler  <darin at apple.com>
+
+	- a fix that gives another 1.5% on the iBench JavaScript test
+
+        * kjs/ustring.cpp: (UString::from): Stop using sprintf to format integers.
+
 2002-11-18  Darin Adler  <darin at apple.com>
 
 	- reduced the creation of Value objects and hoisted the property map
diff --git a/JavaScriptCore/kjs/ustring.cpp b/JavaScriptCore/kjs/ustring.cpp
index 10d4afb..30a9c56 100644
--- a/JavaScriptCore/kjs/ustring.cpp
+++ b/JavaScriptCore/kjs/ustring.cpp
@@ -244,26 +244,53 @@ UString::UString(const UString &a, const UString &b)
 
 UString UString::from(int i)
 {
-  char buf[40];
-  sprintf(buf, "%d", i);
-
-  return UString(buf);
+  return from((long)i);
 }
 
 UString UString::from(unsigned int u)
 {
-  char buf[40];
-  sprintf(buf, "%u", u);
-
-  return UString(buf);
+  UChar buf[20];
+  UChar *p = buf + sizeof(buf);
+  
+  if (u == 0) {
+    *--p = '0';
+  } else {
+    while (u) {
+      *--p = (unsigned short)((u % 10) + '0');
+      u /= 10;
+    }
+  }
+  
+  return UString(p, buf + sizeof(buf) - p);
 }
 
 UString UString::from(long l)
 {
-  char buf[40];
-  sprintf(buf, "%ld", l);
-
-  return UString(buf);
+  UChar buf[20];
+  UChar *p = buf + sizeof(buf);
+  
+  if (l == 0) {
+    *--p = '0';
+  } else if (l == LONG_MIN) {
+    char minBuf[20];
+    sprintf(minBuf, "%ld", LONG_MIN);
+    return UString(minBuf);
+  } else {
+    bool negative = false;
+    if (l < 0) {
+      negative = true;
+      l = -l;
+    }
+    while (l) {
+      *--p = (unsigned short)((l % 10) + '0');
+      l /= 10;
+    }
+    if (negative) {
+      *--p = '-';
+    }
+  }
+  
+  return UString(p, buf + sizeof(buf) - p);
 }
 
 UString UString::from(double d)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list