[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:55 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 091be39c81e2b482d9af81424ee96ad9ed38e826
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 19 18:59:28 2002 +0000

    	- fix hash function and key comparison for the other kind of hash table; yields 3%
    
            * kjs/lookup.cpp:
            (keysMatch): Added.
            (Lookup::findEntry): Don't allocate and convert to ASCII just to search.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2758 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index ec8949c..e9f2819 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,13 @@
 2002-11-19  Darin Adler  <darin at apple.com>
 
+	- fix hash function and key comparison for the other kind of hash table; yields 3%
+
+        * kjs/lookup.cpp:
+        (keysMatch): Added.
+        (Lookup::findEntry): Don't allocate and convert to ASCII just to search.
+
+2002-11-19  Darin Adler  <darin at apple.com>
+
 	- another hash table fix; yields a 2% improvement on iBench JavaScript
 
         * kjs/property_map.cpp: A few more places where we use & instead of %.
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index ec8949c..e9f2819 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,5 +1,13 @@
 2002-11-19  Darin Adler  <darin at apple.com>
 
+	- fix hash function and key comparison for the other kind of hash table; yields 3%
+
+        * kjs/lookup.cpp:
+        (keysMatch): Added.
+        (Lookup::findEntry): Don't allocate and convert to ASCII just to search.
+
+2002-11-19  Darin Adler  <darin at apple.com>
+
 	- another hash table fix; yields a 2% improvement on iBench JavaScript
 
         * kjs/property_map.cpp: A few more places where we use & instead of %.
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index ec8949c..e9f2819 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,5 +1,13 @@
 2002-11-19  Darin Adler  <darin at apple.com>
 
+	- fix hash function and key comparison for the other kind of hash table; yields 3%
+
+        * kjs/lookup.cpp:
+        (keysMatch): Added.
+        (Lookup::findEntry): Don't allocate and convert to ASCII just to search.
+
+2002-11-19  Darin Adler  <darin at apple.com>
+
 	- another hash table fix; yields a 2% improvement on iBench JavaScript
 
         * kjs/property_map.cpp: A few more places where we use & instead of %.
diff --git a/JavaScriptCore/kjs/lookup.cpp b/JavaScriptCore/kjs/lookup.cpp
index 4963543..f5567c0 100644
--- a/JavaScriptCore/kjs/lookup.cpp
+++ b/JavaScriptCore/kjs/lookup.cpp
@@ -30,43 +30,39 @@
 
 using namespace KJS;
 
+static bool keysMatch(const UChar *c, unsigned len, const char *s)
+{
+  for (unsigned i = 0; i != len; i++, c++, s++)
+    if (c->unicode() != (unsigned char)*s)
+      return false;
+  return *s == 0;
+}
+
 const HashEntry* Lookup::findEntry( const struct HashTable *table,
                               const UChar *c, unsigned int len )
 {
+#ifndef NDEBUG
   if (table->type != 2) {
     fprintf(stderr, "KJS: Unknown hash table version.\n");
     return 0;
   }
-  char *ascii = new char[len+1];
-  unsigned int i;
-  for(i = 0; i < len; i++, c++) {
-    if (!c->high())
-      ascii[i] = c->low();
-    else
-      break;
-  }
-  ascii[i] = '\0';
+#endif
 
-  int h = hash(ascii) % table->hashSize;
+  int h = hash(c, len) % table->hashSize;
   const HashEntry *e = &table->entries[h];
 
   // empty bucket ?
-  if (!e->s) {
-    delete [] ascii;
+  if (!e->s)
     return 0;
-  }
 
   do {
     // compare strings
-    if (strcmp(ascii, e->s) == 0) {
-      delete [] ascii;
+    if (keysMatch(c, len, e->s))
       return e;
-    }
     // try next bucket
     e = e->next;
   } while (e);
 
-  delete [] ascii;
   return 0;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list