Title: [201225] trunk/Source/_javascript_Core
Revision
201225
Author
[email protected]
Date
2016-05-20 14:17:58 -0700 (Fri, 20 May 2016)

Log Message

reifyAllStaticProperties makes two copies of every string
https://bugs.webkit.org/show_bug.cgi?id=157953

Reviewed by Mark Lam.

Let's not do that.

* runtime/JSObject.cpp:
(JSC::JSObject::reifyAllStaticProperties): Pass our Identifier to
reifyStaticProperty so it doesn't have to make its own.

* runtime/Lookup.h:
(JSC::reifyStaticProperty): No need to null check because callers never
pass null anymore. No need to make an identifier because callers pass
us one.

(JSC::reifyStaticProperties): Honor new interface.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (201224 => 201225)


--- trunk/Source/_javascript_Core/ChangeLog	2016-05-20 21:17:35 UTC (rev 201224)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-05-20 21:17:58 UTC (rev 201225)
@@ -1,5 +1,25 @@
 2016-05-20  Geoffrey Garen  <[email protected]>
 
+        reifyAllStaticProperties makes two copies of every string
+        https://bugs.webkit.org/show_bug.cgi?id=157953
+
+        Reviewed by Mark Lam.
+
+        Let's not do that.
+
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::reifyAllStaticProperties): Pass our Identifier to
+        reifyStaticProperty so it doesn't have to make its own.
+
+        * runtime/Lookup.h:
+        (JSC::reifyStaticProperty): No need to null check because callers never
+        pass null anymore. No need to make an identifier because callers pass
+        us one.
+
+        (JSC::reifyStaticProperties): Honor new interface.
+
+2016-05-20  Geoffrey Garen  <[email protected]>
+
         JSBench regression: CodeBlock linking always copies the symbol table
         https://bugs.webkit.org/show_bug.cgi?id=157951
 

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (201224 => 201225)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2016-05-20 21:17:35 UTC (rev 201224)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2016-05-20 21:17:58 UTC (rev 201225)
@@ -1951,9 +1951,10 @@
 
         for (auto& value : *hashTable) {
             unsigned attributes;
-            PropertyOffset offset = getDirectOffset(vm, Identifier::fromString(&vm, value.m_key), attributes);
+            auto key = Identifier::fromString(&vm, value.m_key);
+            PropertyOffset offset = getDirectOffset(vm, key, attributes);
             if (!isValidOffset(offset))
-                reifyStaticProperty(vm, value, *this);
+                reifyStaticProperty(vm, key, value, *this);
         }
     }
 

Modified: trunk/Source/_javascript_Core/runtime/Lookup.h (201224 => 201225)


--- trunk/Source/_javascript_Core/runtime/Lookup.h	2016-05-20 21:17:35 UTC (rev 201224)
+++ trunk/Source/_javascript_Core/runtime/Lookup.h	2016-05-20 21:17:58 UTC (rev 201225)
@@ -337,12 +337,8 @@
     return true;
 }
 
-inline void reifyStaticProperty(VM& vm, const HashTableValue& value, JSObject& thisObj)
+inline void reifyStaticProperty(VM& vm, const Identifier& propertyName, const HashTableValue& value, JSObject& thisObj)
 {
-    if (!value.m_key)
-        return;
-
-    Identifier propertyName = Identifier::fromString(&vm, reinterpret_cast<const LChar*>(value.m_key), strlen(value.m_key));
     if (value.attributes() & Builtin) {
         if (value.attributes() & Accessor)
             reifyStaticAccessor(vm, value, thisObj, propertyName);
@@ -397,8 +393,12 @@
 inline void reifyStaticProperties(VM& vm, const HashTableValue (&values)[numberOfValues], JSObject& thisObj)
 {
     BatchedTransitionOptimizer transitionOptimizer(vm, &thisObj);
-    for (auto& value : values)
-        reifyStaticProperty(vm, value, thisObj);
+    for (auto& value : values) {
+        if (!value.m_key)
+            continue;
+        auto key = Identifier::fromString(&vm, value.m_key);
+        reifyStaticProperty(vm, key, value, thisObj);
+    }
 }
 
 } // namespace JSC
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to