Title: [165090] trunk/Source/_javascript_Core
Revision
165090
Author
[email protected]
Date
2014-03-04 18:35:18 -0800 (Tue, 04 Mar 2014)

Log Message

Streamline JSValue::get().
<https://webkit.org/b/129720>

Fetch each Structure and VM only once when walking the prototype chain
in JSObject::getPropertySlot(), then pass it along to the functions
we call from there, so they don't have to re-fetch it.

Reviewed by Geoff Garen.

* runtime/JSObject.h:
(JSC::JSObject::inlineGetOwnPropertySlot):
(JSC::JSObject::fastGetOwnPropertySlot):
(JSC::JSObject::getPropertySlot):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (165089 => 165090)


--- trunk/Source/_javascript_Core/ChangeLog	2014-03-05 02:14:35 UTC (rev 165089)
+++ trunk/Source/_javascript_Core/ChangeLog	2014-03-05 02:35:18 UTC (rev 165090)
@@ -1,3 +1,19 @@
+2014-03-04  Andreas Kling  <[email protected]>
+
+        Streamline JSValue::get().
+        <https://webkit.org/b/129720>
+
+        Fetch each Structure and VM only once when walking the prototype chain
+        in JSObject::getPropertySlot(), then pass it along to the functions
+        we call from there, so they don't have to re-fetch it.
+
+        Reviewed by Geoff Garen.
+
+        * runtime/JSObject.h:
+        (JSC::JSObject::inlineGetOwnPropertySlot):
+        (JSC::JSObject::fastGetOwnPropertySlot):
+        (JSC::JSObject::getPropertySlot):
+
 2014-03-01  Filip Pizlo  <[email protected]>
 
         DFG and FTL should specialize for and support CompareStrictEq over Misc (i.e. boolean, undefined, or null)

Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (165089 => 165090)


--- trunk/Source/_javascript_Core/runtime/JSObject.h	2014-03-05 02:14:35 UTC (rev 165089)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h	2014-03-05 02:35:18 UTC (rev 165090)
@@ -120,7 +120,7 @@
     JSValue get(ExecState*, PropertyName) const;
     JSValue get(ExecState*, unsigned propertyName) const;
 
-    bool fastGetOwnPropertySlot(ExecState*, PropertyName, PropertySlot&);
+    bool fastGetOwnPropertySlot(ExecState*, VM&, Structure&, PropertyName, PropertySlot&);
     bool getPropertySlot(ExecState*, PropertyName, PropertySlot&);
     bool getPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
 
@@ -949,7 +949,7 @@
     template<PutMode>
     bool putDirectInternal(VM&, PropertyName, JSValue, unsigned attr, PutPropertySlot&, JSCell*);
 
-    bool inlineGetOwnPropertySlot(ExecState*, PropertyName, PropertySlot&);
+    bool inlineGetOwnPropertySlot(ExecState*, VM&, Structure&, PropertyName, PropertySlot&);
     JS_EXPORT_PRIVATE void fillGetterPropertySlot(PropertySlot&, JSValue, unsigned, PropertyOffset);
 
     const HashEntry* findPropertyHashEntry(VM&, PropertyName) const;
@@ -1204,16 +1204,14 @@
     return structure()->storedPrototype();
 }
 
-ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
+ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, VM& vm, Structure& structure, PropertyName propertyName, PropertySlot& slot)
 {
     unsigned attributes;
     JSCell* specific;
-    VM& vm = exec->vm();
-    Structure* structure = this->structure(vm);
-    PropertyOffset offset = structure->get(vm, propertyName, attributes, specific);
+    PropertyOffset offset = structure.get(vm, propertyName, attributes, specific);
     if (LIKELY(isValidOffset(offset))) {
         JSValue value = getDirect(offset);
-        if (structure->hasGetterSetterProperties() && value.isGetterSetter())
+        if (structure.hasGetterSetterProperties() && value.isGetterSetter())
             fillGetterPropertySlot(slot, value, attributes, offset);
         else
             slot.setValue(this, attributes, value, offset);
@@ -1228,26 +1226,29 @@
 // base class call to this.
 ALWAYS_INLINE bool JSObject::getOwnPropertySlot(JSObject* object, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
 {
-    return object->inlineGetOwnPropertySlot(exec, propertyName, slot);
+    VM& vm = exec->vm();
+    Structure& structure = *object->structure(vm);
+    return object->inlineGetOwnPropertySlot(exec, vm, structure, propertyName, slot);
 }
 
-ALWAYS_INLINE bool JSObject::fastGetOwnPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
+ALWAYS_INLINE bool JSObject::fastGetOwnPropertySlot(ExecState* exec, VM& vm, Structure& structure, PropertyName propertyName, PropertySlot& slot)
 {
-    VM& vm = exec->vm();
-    if (!structure(vm)->typeInfo().overridesGetOwnPropertySlot())
-        return asObject(this)->inlineGetOwnPropertySlot(exec, propertyName, slot);
-    return methodTable(vm)->getOwnPropertySlot(this, exec, propertyName, slot);
+    if (!structure.typeInfo().overridesGetOwnPropertySlot())
+        return asObject(this)->inlineGetOwnPropertySlot(exec, vm, structure, propertyName, slot);
+    return structure.classInfo()->methodTable.getOwnPropertySlot(this, exec, propertyName, slot);
 }
 
 // It may seem crazy to inline a function this large but it makes a big difference
 // since this is function very hot in variable lookup
 ALWAYS_INLINE bool JSObject::getPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
 {
+    VM& vm = exec->vm();
     JSObject* object = this;
     while (true) {
-        if (object->fastGetOwnPropertySlot(exec, propertyName, slot))
+        Structure& structure = *object->structure(vm);
+        if (object->fastGetOwnPropertySlot(exec, vm, structure, propertyName, slot))
             return true;
-        JSValue prototype = object->prototype();
+        JSValue prototype = structure.storedPrototype();
         if (!prototype.isObject())
             return false;
         object = asObject(prototype);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to