Make NodeList.length inline-cacheable by JSC.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Apr 2014 05:59:34 +0000 (05:59 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 12 Apr 2014 05:59:34 +0000 (05:59 +0000)
<https://webkit.org/b/131579>

For objects with custom index or name getters, we have to make sure
that builtin properties take precedence. We do this by scanning the
ancestor chain for a suitable property slot before moving on to
named items.

With this patch, we now mark such builtins as cacheable. This is
safe since the whole point of doing this before processing named
items is to ensure the same slot is returned consistently.

Reviewed by Benjamin Poulain.

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateGetOwnPropertySlotBody):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@167181 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestEventTarget.cpp

index fd67640..14ed55e 100644 (file)
@@ -1,3 +1,22 @@
+2014-04-11  Andreas Kling  <akling@apple.com>
+
+        Make NodeList.length inline-cacheable by JSC.
+        <https://webkit.org/b/131579>
+
+        For objects with custom index or name getters, we have to make sure
+        that builtin properties take precedence. We do this by scanning the
+        ancestor chain for a suitable property slot before moving on to
+        named items.
+
+        With this patch, we now mark such builtins as cacheable. This is
+        safe since the whole point of doing this before processing named
+        items is to ensure the same slot is returned consistently.
+
+        Reviewed by Benjamin Poulain.
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateGetOwnPropertySlotBody):
+
 2014-04-11  Tim Horton  <timothy_horton@apple.com>
 
         Lots of compositing test failures after r167152
index e3ee9a4..cc7fd59 100644 (file)
@@ -406,7 +406,7 @@ sub GenerateGetOwnPropertySlotBody
         if ($requiresManualLookup) {
             push(@getOwnPropertySlotImpl, "    const ${namespaceMaybe}HashTableValue* entry = getStaticValueSlotEntryWithoutCaching<$className>(exec, propertyName);\n");
             push(@getOwnPropertySlotImpl, "    if (entry) {\n");
-            push(@getOwnPropertySlotImpl, "        slot.setCustom(thisObject, entry->attributes(), entry->propertyGetter());\n");
+            push(@getOwnPropertySlotImpl, "        slot.setCacheableCustom(thisObject, entry->attributes(), entry->propertyGetter());\n");
             push(@getOwnPropertySlotImpl, "        return true;\n");
             push(@getOwnPropertySlotImpl, "    }\n");
         }
index fa3bee7..debee97 100644 (file)
@@ -151,7 +151,7 @@ bool JSTestEventTarget::getOwnPropertySlot(JSObject* object, ExecState* exec, Pr
     ASSERT_GC_OBJECT_INHERITS(thisObject, info());
     const HashTableValue* entry = getStaticValueSlotEntryWithoutCaching<JSTestEventTarget>(exec, propertyName);
     if (entry) {
-        slot.setCustom(thisObject, entry->attributes(), entry->propertyGetter());
+        slot.setCacheableCustom(thisObject, entry->attributes(), entry->propertyGetter());
         return true;
     }
     unsigned index = propertyName.asIndex();