[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 06:33:21 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit fe985880bce4e977634317560eb7f09c0b82b014
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 21 05:23:31 2002 +0000

    	Three small changes to things that showed up in the sample.
    
    	5% speed increase on cvs-js-performance test.
    
            * kjs/simple_number.h: Check if double is an integer with d == (double)(int)d
    	instead of remainder(d, 1) == 0, saving a function call each time.
    
            * kjs/ustring.cpp:
            (UString::find): Compare the first character before calling memcmp for the rest.
            (UString::rfind): Ditto.
            (KJS::operator==): Don't do a strlen before starting to compare the characters.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1887 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 146d5d8..5ef8043 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,17 @@
+2002-08-20  Darin Adler  <darin at apple.com>
+
+	Three small changes to things that showed up in the sample.
+
+	5% speed increase on cvs-js-performance test.
+	
+        * kjs/simple_number.h: Check if double is an integer with d == (double)(int)d
+	instead of remainder(d, 1) == 0, saving a function call each time.
+
+        * kjs/ustring.cpp:
+        (UString::find): Compare the first character before calling memcmp for the rest.
+        (UString::rfind): Ditto.
+        (KJS::operator==): Don't do a strlen before starting to compare the characters.
+
 2002-08-20  Maciej Stachowiak  <mjs at apple.com>
 
         * kjs/object.cpp: Don't reference other ValueImps in the
@@ -51,7 +65,7 @@
 	object. This removed another 160,000 of the remaining 580,000
 	garbage collected object allocations.
 
-	6% speed increas on cvs-js-performance test.
+	6% speed increase on cvs-js-performance test.
 	
         * kjs/completion.cpp: Added. New implementation that doesn't
 	require a ValueImp *.
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index 146d5d8..5ef8043 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,3 +1,17 @@
+2002-08-20  Darin Adler  <darin at apple.com>
+
+	Three small changes to things that showed up in the sample.
+
+	5% speed increase on cvs-js-performance test.
+	
+        * kjs/simple_number.h: Check if double is an integer with d == (double)(int)d
+	instead of remainder(d, 1) == 0, saving a function call each time.
+
+        * kjs/ustring.cpp:
+        (UString::find): Compare the first character before calling memcmp for the rest.
+        (UString::rfind): Ditto.
+        (KJS::operator==): Don't do a strlen before starting to compare the characters.
+
 2002-08-20  Maciej Stachowiak  <mjs at apple.com>
 
         * kjs/object.cpp: Don't reference other ValueImps in the
@@ -51,7 +65,7 @@
 	object. This removed another 160,000 of the remaining 580,000
 	garbage collected object allocations.
 
-	6% speed increas on cvs-js-performance test.
+	6% speed increase on cvs-js-performance test.
 	
         * kjs/completion.cpp: Added. New implementation that doesn't
 	require a ValueImp *.
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 146d5d8..5ef8043 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,3 +1,17 @@
+2002-08-20  Darin Adler  <darin at apple.com>
+
+	Three small changes to things that showed up in the sample.
+
+	5% speed increase on cvs-js-performance test.
+	
+        * kjs/simple_number.h: Check if double is an integer with d == (double)(int)d
+	instead of remainder(d, 1) == 0, saving a function call each time.
+
+        * kjs/ustring.cpp:
+        (UString::find): Compare the first character before calling memcmp for the rest.
+        (UString::rfind): Ditto.
+        (KJS::operator==): Don't do a strlen before starting to compare the characters.
+
 2002-08-20  Maciej Stachowiak  <mjs at apple.com>
 
         * kjs/object.cpp: Don't reference other ValueImps in the
@@ -51,7 +65,7 @@
 	object. This removed another 160,000 of the remaining 580,000
 	garbage collected object allocations.
 
-	6% speed increas on cvs-js-performance test.
+	6% speed increase on cvs-js-performance test.
 	
         * kjs/completion.cpp: Added. New implementation that doesn't
 	require a ValueImp *.
diff --git a/JavaScriptCore/kjs/simple_number.h b/JavaScriptCore/kjs/simple_number.h
index 9938940..2dda17b 100644
--- a/JavaScriptCore/kjs/simple_number.h
+++ b/JavaScriptCore/kjs/simple_number.h
@@ -40,7 +40,7 @@ namespace KJS {
 	static inline bool fits(unsigned i) { return i <= (unsigned)max; }
 	static inline bool fits(long i) { return i <= max && i >= min; }
 	static inline bool fits(unsigned long i) { return i <= (unsigned)max; }
-	static inline bool fits(double d) { return d <= max && d >= min && remainder(d, 1) == 0; }
+	static inline bool fits(double d) { return d <= max && d >= min && d == (double)(int)d; }
 	static inline ValueImp *make(int i) { return (ValueImp *)((i << shift) | tag); }
     };
 }
diff --git a/JavaScriptCore/kjs/ustring.cpp b/JavaScriptCore/kjs/ustring.cpp
index d88c06e..24722f7 100644
--- a/JavaScriptCore/kjs/ustring.cpp
+++ b/JavaScriptCore/kjs/ustring.cpp
@@ -487,15 +487,19 @@ unsigned long UString::toULong(bool *ok) const
 
 int UString::find(const UString &f, int pos) const
 {
-  if (size() < f.size())
+  int sz = size();
+  int fsz = f.size();
+  if (sz < fsz)
     return -1;
+  if (fsz == 0)
+    return 0;
   if (pos < 0)
     pos = 0;
-  const UChar *end = data() + size() - f.size();
-  long fsize = f.size() * sizeof(UChar);
-  const void *fdata = f.data();
+  const UChar *end = data() + sz - fsz;
+  long fsizeminusone = (fsz - 1) * sizeof(UChar);
+  const UChar *fdata = f.data();
   for (const UChar *c = data() + pos; c <= end; c++)
-    if (!memcmp(c, fdata, fsize))
+    if (*c == *fdata && !memcmp(c + 1, fdata + 1, fsizeminusone))
       return (c-data());
 
   return -1;
@@ -515,14 +519,18 @@ int UString::find(UChar ch, int pos) const
 
 int UString::rfind(const UString &f, int pos) const
 {
-  if (size() < f.size())
+  int sz = size();
+  int fsz = f.size();
+  if (sz < fsz)
     return -1;
-  if (pos + f.size() >= size())
-    pos = size() - f.size();
-  long fsize = f.size() * sizeof(UChar);
-  const void *fdata = f.data();
+  if (fsz == 0)
+    return 0;
+  if (pos < 0)
+    pos = 0;
+  long fsizeminusone = (fsz - 1) * sizeof(UChar);
+  const UChar *fdata = f.data();
   for (const UChar *c = data() + pos; c >= data(); c--) {
-    if (!memcmp(c, fdata, fsize))
+    if (*c == *fdata && !memcmp(c + 1, fdata + 1, fsizeminusone))
       return (c-data());
   }
 
@@ -602,18 +610,16 @@ bool KJS::operator==(const UString& s1, const char *s2)
     return s1.isEmpty();
   }
 
-  if (s1.size() != (int)strlen(s2))
-    return false;
-
   const UChar *u = s1.data();
-  while (*s2) {
+  const UChar *uend = u + s1.size();
+  while (u != uend && *s2) {
     if (u->uc != (unsigned char)*s2)
       return false;
     s2++;
     u++;
   }
 
-  return true;
+  return u == uend && *s2 == 0;
 }
 
 bool KJS::operator<(const UString& s1, const UString& s2)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list