Title: [123682] trunk/Source/_javascript_Core
Revision
123682
Author
mhahnenb...@apple.com
Date
2012-07-25 17:12:58 -0700 (Wed, 25 Jul 2012)

Log Message

Remove JSObject::m_inheritorID
https://bugs.webkit.org/show_bug.cgi?id=88378

Reviewed by Filip Pizlo.

This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
Instead use a private named value in the object's property storage.

* dfg/DFGSpeculativeJIT.h:
(JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize!
* jit/JITInlineMethods.h:
(JSC::JIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize!
* llint/LowLevelInterpreter.asm: No need m_inheritorID to initialize!
* runtime/JSGlobalData.h:
(JSGlobalData): Added private name 'm_inheritorIDKey'.
* runtime/JSGlobalThis.cpp:
(JSC::JSGlobalThis::setUnwrappedObject): resetInheritorID is now passed a JSGlobalData&.
* runtime/JSObject.cpp:
(JSC::JSObject::visitChildren): No m_inheritorID to be marked.
(JSC::JSFinalObject::visitChildren): No m_inheritorID to be marked.
(JSC::JSObject::createInheritorID): Store the newly created inheritorID in the property map. Make sure 
it's got the DontEnum attribute!!
* runtime/JSObject.h:
(JSObject):
(JSC::JSObject::resetInheritorID): Remove the inheritorID from property storage.
(JSC):
(JSC::JSObject::inheritorID): Read the inheritorID from property storage.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (123681 => 123682)


--- trunk/Source/_javascript_Core/ChangeLog	2012-07-26 00:05:13 UTC (rev 123681)
+++ trunk/Source/_javascript_Core/ChangeLog	2012-07-26 00:12:58 UTC (rev 123682)
@@ -1,3 +1,34 @@
+2012-07-25  Mark Hahnenberg  <mhahnenb...@apple.com>
+
+        Remove JSObject::m_inheritorID
+        https://bugs.webkit.org/show_bug.cgi?id=88378
+
+        Reviewed by Filip Pizlo.
+
+        This is rarely used, and not performance critical (the commonly accessed copy is cached on JSFunction),
+        and most objects don't need an inheritorID (this value is only used if the object is used as a prototype).
+        Instead use a private named value in the object's property storage.
+
+        * dfg/DFGSpeculativeJIT.h:
+        (JSC::DFG::SpeculativeJIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize!
+        * jit/JITInlineMethods.h:
+        (JSC::JIT::emitAllocateBasicJSObject): No need m_inheritorID to initialize!
+        * llint/LowLevelInterpreter.asm: No need m_inheritorID to initialize!
+        * runtime/JSGlobalData.h:
+        (JSGlobalData): Added private name 'm_inheritorIDKey'.
+        * runtime/JSGlobalThis.cpp:
+        (JSC::JSGlobalThis::setUnwrappedObject): resetInheritorID is now passed a JSGlobalData&.
+        * runtime/JSObject.cpp:
+        (JSC::JSObject::visitChildren): No m_inheritorID to be marked.
+        (JSC::JSFinalObject::visitChildren): No m_inheritorID to be marked.
+        (JSC::JSObject::createInheritorID): Store the newly created inheritorID in the property map. Make sure 
+        it's got the DontEnum attribute!!
+        * runtime/JSObject.h:
+        (JSObject):
+        (JSC::JSObject::resetInheritorID): Remove the inheritorID from property storage.
+        (JSC):
+        (JSC::JSObject::inheritorID): Read the inheritorID from property storage.
+
 2012-07-25  Caio Marcelo de Oliveira Filho  <caio.olive...@openbossa.org>
 
         Create a specialized pair for use in HashMap iterators

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h (123681 => 123682)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2012-07-26 00:05:13 UTC (rev 123681)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2012-07-26 00:12:58 UTC (rev 123682)
@@ -2144,9 +2144,6 @@
         // Initialize the object's classInfo pointer
         m_jit.storePtr(MacroAssembler::TrustedImmPtr(&ClassType::s_info), MacroAssembler::Address(resultGPR, JSCell::classInfoOffset()));
         
-        // Initialize the object's inheritorID.
-        m_jit.storePtr(MacroAssembler::TrustedImmPtr(0), MacroAssembler::Address(resultGPR, JSObject::offsetOfInheritorID()));
-        
         // Initialize the object's property storage pointer.
         m_jit.storePtr(MacroAssembler::TrustedImmPtr(0), MacroAssembler::Address(resultGPR, ClassType::offsetOfOutOfLineStorage()));
     }

Modified: trunk/Source/_javascript_Core/jit/JITInlineMethods.h (123681 => 123682)


--- trunk/Source/_javascript_Core/jit/JITInlineMethods.h	2012-07-26 00:05:13 UTC (rev 123681)
+++ trunk/Source/_javascript_Core/jit/JITInlineMethods.h	2012-07-26 00:12:58 UTC (rev 123682)
@@ -425,9 +425,6 @@
     // initialize the object's classInfo pointer
     storePtr(TrustedImmPtr(&ClassType::s_info), Address(result, JSCell::classInfoOffset()));
 
-    // initialize the inheritor ID
-    storePtr(TrustedImmPtr(0), Address(result, JSObject::offsetOfInheritorID()));
-
     // initialize the object's property storage pointer
     storePtr(TrustedImmPtr(0), Address(result, ClassType::offsetOfOutOfLineStorage()));
 }

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm (123681 => 123682)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2012-07-26 00:05:13 UTC (rev 123681)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2012-07-26 00:12:58 UTC (rev 123682)
@@ -318,7 +318,6 @@
         loadp classInfoOffset[scratch1], scratch2
         storep scratch2, [result]
         storep structure, JSCell::m_structure[result]
-        storep 0, JSObject::m_inheritorID[result]
         storep 0, JSObject::m_outOfLineStorage[result]
     end
 end

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalData.h (123681 => 123682)


--- trunk/Source/_javascript_Core/runtime/JSGlobalData.h	2012-07-26 00:05:13 UTC (rev 123681)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalData.h	2012-07-26 00:12:58 UTC (rev 123682)
@@ -39,6 +39,7 @@
 #include "JSValue.h"
 #include "LLIntData.h"
 #include "NumericStrings.h"
+#include "PrivateName.h"
 #include "SmallStrings.h"
 #include "Strong.h"
 #include "Terminator.h"
@@ -293,6 +294,8 @@
         bool canUseRegExpJIT() { return m_canUseAssembler; }
 #endif
 
+        PrivateName m_inheritorIDKey;
+
         OwnPtr<ParserArena> parserArena;
         OwnPtr<Keywords> keywords;
         Interpreter* interpreter;

Modified: trunk/Source/_javascript_Core/runtime/JSGlobalThis.cpp (123681 => 123682)


--- trunk/Source/_javascript_Core/runtime/JSGlobalThis.cpp	2012-07-26 00:05:13 UTC (rev 123681)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalThis.cpp	2012-07-26 00:12:58 UTC (rev 123682)
@@ -53,7 +53,7 @@
     ASSERT_ARG(globalObject, globalObject);
     m_unwrappedObject.set(globalData, this, globalObject);
     setPrototype(globalData, globalObject->prototype());
-    resetInheritorID();
+    resetInheritorID(globalData);
 }
 
 } // namespace JSC

Modified: trunk/Source/_javascript_Core/runtime/JSObject.cpp (123681 => 123682)


--- trunk/Source/_javascript_Core/runtime/JSObject.cpp	2012-07-26 00:05:13 UTC (rev 123681)
+++ trunk/Source/_javascript_Core/runtime/JSObject.cpp	2012-07-26 00:12:58 UTC (rev 123682)
@@ -107,9 +107,6 @@
         thisObject->m_outOfLineStorage.set(storage, StorageBarrier::Unchecked);
     }
 
-    if (thisObject->m_inheritorID)
-        visitor.append(&thisObject->m_inheritorID);
-
 #if !ASSERT_DISABLED
     visitor.m_isCheckingForDefaultMarkViolation = wasCheckingForDefaultMarkViolation;
 #endif
@@ -137,9 +134,6 @@
         thisObject->m_outOfLineStorage.set(storage, StorageBarrier::Unchecked);
     }
 
-    if (thisObject->m_inheritorID)
-        visitor.append(&thisObject->m_inheritorID);
-
     size_t storageSize = thisObject->structure()->inlineSizeForKnownFinalObject();
     visitor.appendValues(thisObject->inlineStorage(), storageSize);
 
@@ -580,15 +574,21 @@
 
 Structure* JSObject::createInheritorID(JSGlobalData& globalData)
 {
+    ASSERT(!getDirectLocation(globalData, globalData.m_inheritorIDKey));
+
     JSGlobalObject* globalObject;
     if (isGlobalThis())
         globalObject = static_cast<JSGlobalThis*>(this)->unwrappedObject();
     else
         globalObject = structure()->globalObject();
     ASSERT(globalObject);
-    m_inheritorID.set(globalData, this, createEmptyObjectStructure(globalData, globalObject, this));
-    ASSERT(m_inheritorID->isEmpty());
-    return m_inheritorID.get();
+
+    Structure* inheritorID = createEmptyObjectStructure(globalData, globalObject, this);
+    ASSERT(inheritorID->isEmpty());
+
+    PutPropertySlot slot;
+    putDirectInternal<PutModeDefineOwnProperty>(globalData, globalData.m_inheritorIDKey, inheritorID, DontEnum, slot, 0);
+    return inheritorID;
 }
 
 PropertyStorage JSObject::growOutOfLineStorage(JSGlobalData& globalData, size_t oldSize, size_t newSize)

Modified: trunk/Source/_javascript_Core/runtime/JSObject.h (123681 => 123682)


--- trunk/Source/_javascript_Core/runtime/JSObject.h	2012-07-26 00:05:13 UTC (rev 123681)
+++ trunk/Source/_javascript_Core/runtime/JSObject.h	2012-07-26 00:12:58 UTC (rev 123682)
@@ -295,7 +295,6 @@
         
         static size_t offsetOfInlineStorage();
         static size_t offsetOfOutOfLineStorage();
-        static size_t offsetOfInheritorID();
 
         static JS_EXPORTDATA const ClassInfo s_info;
 
@@ -322,9 +321,9 @@
         // To create derived types you likely want JSNonFinalObject, below.
         JSObject(JSGlobalData&, Structure*);
         
-        void resetInheritorID()
+        void resetInheritorID(JSGlobalData& globalData)
         {
-            m_inheritorID.clear();
+            removeDirect(globalData, globalData.m_inheritorIDKey);
         }
 
     private:
@@ -348,7 +347,6 @@
         Structure* createInheritorID(JSGlobalData&);
 
         StorageBarrier m_outOfLineStorage;
-        WriteBarrier<Structure> m_inheritorID;
     };
 
 
@@ -461,11 +459,6 @@
     return OBJECT_OFFSETOF(JSObject, m_outOfLineStorage);
 }
 
-inline size_t JSObject::offsetOfInheritorID()
-{
-    return OBJECT_OFFSETOF(JSObject, m_inheritorID);
-}
-
 inline bool JSObject::isGlobalObject() const
 {
     return structure()->typeInfo().type() == GlobalObjectType;
@@ -564,9 +557,10 @@
 
 inline Structure* JSObject::inheritorID(JSGlobalData& globalData)
 {
-    if (m_inheritorID) {
-        ASSERT(m_inheritorID->isEmpty());
-        return m_inheritorID.get();
+    if (WriteBarrierBase<Unknown>* location = getDirectLocation(globalData, globalData.m_inheritorIDKey)) {
+        Structure* inheritorID = jsCast<Structure*>(location->get());
+        ASSERT(inheritorID->isEmpty());
+        return inheritorID;
     }
     return createInheritorID(globalData);
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to