Title: [253862] trunk/Source/_javascript_Core
Revision
253862
Author
[email protected]
Date
2019-12-21 01:49:40 -0800 (Sat, 21 Dec 2019)

Log Message

[JSC] Remove m_globalObject field from JSFunction
https://bugs.webkit.org/show_bug.cgi?id=205533

Reviewed by Mark Lam.

JSFunction::m_globalObject is used only when it is using NativeExecutable.
And when using NativeExecutable, JSCallee::m_scope is always pointing JSGlobalObject.
This patch removes JSFunction::m_globalObject field.

* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileNewFunctionCommon):
* ftl/FTLAbstractHeapRepository.h:
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNewFunction):
* jit/ThunkGenerators.cpp:
(JSC::nativeForGenerator):
(JSC::boundThisNoArgsFunctionCallGenerator):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/JSFunction.cpp:
(JSC::JSFunction::JSFunction):
* runtime/JSFunction.h:
(JSC::JSFunction::offsetOfGlobalObject): Deleted.
(JSC::JSFunction::globalObject const): Deleted.
* runtime/JSFunctionInlines.h:
(JSC::JSFunction::JSFunction):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (253861 => 253862)


--- trunk/Source/_javascript_Core/ChangeLog	2019-12-21 07:35:44 UTC (rev 253861)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-12-21 09:49:40 UTC (rev 253862)
@@ -1,3 +1,32 @@
+2019-12-21  Yusuke Suzuki  <[email protected]>
+
+        [JSC] Remove m_globalObject field from JSFunction
+        https://bugs.webkit.org/show_bug.cgi?id=205533
+
+        Reviewed by Mark Lam.
+
+        JSFunction::m_globalObject is used only when it is using NativeExecutable.
+        And when using NativeExecutable, JSCallee::m_scope is always pointing JSGlobalObject.
+        This patch removes JSFunction::m_globalObject field.
+
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compileNewFunctionCommon):
+        * ftl/FTLAbstractHeapRepository.h:
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::compileNewFunction):
+        * jit/ThunkGenerators.cpp:
+        (JSC::nativeForGenerator):
+        (JSC::boundThisNoArgsFunctionCallGenerator):
+        * llint/LowLevelInterpreter32_64.asm:
+        * llint/LowLevelInterpreter64.asm:
+        * runtime/JSFunction.cpp:
+        (JSC::JSFunction::JSFunction):
+        * runtime/JSFunction.h:
+        (JSC::JSFunction::offsetOfGlobalObject): Deleted.
+        (JSC::JSFunction::globalObject const): Deleted.
+        * runtime/JSFunctionInlines.h:
+        (JSC::JSFunction::JSFunction):
+
 2019-12-20  Ross Kirsling  <[email protected]>
 
         [JSC] Memory usage statistics should be attainable without WebCore

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (253861 => 253862)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2019-12-21 07:35:44 UTC (rev 253861)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2019-12-21 09:49:40 UTC (rev 253862)
@@ -7240,7 +7240,6 @@
     m_jit.storePtr(scopeGPR, JITCompiler::Address(resultGPR, JSFunction::offsetOfScopeChain()));
     m_jit.storePtr(TrustedImmPtr::weakPointer(m_jit.graph(), executable), JITCompiler::Address(resultGPR, JSFunction::offsetOfExecutable()));
     m_jit.storePtr(TrustedImmPtr(nullptr), JITCompiler::Address(resultGPR, JSFunction::offsetOfRareData()));
-    m_jit.storePtr(TrustedImmPtr::weakPointer(m_jit.graph(), structure->globalObject()), JITCompiler::Address(resultGPR, JSFunction::offsetOfGlobalObject()));
     m_jit.mutatorFence(vm());
 }
 

Modified: trunk/Source/_javascript_Core/ftl/FTLAbstractHeapRepository.h (253861 => 253862)


--- trunk/Source/_javascript_Core/ftl/FTLAbstractHeapRepository.h	2019-12-21 07:35:44 UTC (rev 253861)
+++ trunk/Source/_javascript_Core/ftl/FTLAbstractHeapRepository.h	2019-12-21 09:49:40 UTC (rev 253862)
@@ -100,7 +100,6 @@
     macro(JSCell_usefulBytes, JSCell::indexingTypeAndMiscOffset()) \
     macro(JSDestructibleObject_classInfo, JSDestructibleObject::classInfoOffset()) \
     macro(JSFunction_executable, JSFunction::offsetOfExecutable()) \
-    macro(JSFunction_globalObject, JSFunction::offsetOfGlobalObject()) \
     macro(JSFunction_scope, JSFunction::offsetOfScopeChain()) \
     macro(JSFunction_rareData, JSFunction::offsetOfRareData()) \
     macro(JSGlobalObject_regExpGlobalData_cachedResult_lastRegExp, JSGlobalObject::regExpGlobalDataOffset() + RegExpGlobalData::offsetOfCachedResult() + RegExpCachedResult::offsetOfLastRegExp()) \

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (253861 => 253862)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2019-12-21 07:35:44 UTC (rev 253861)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2019-12-21 09:49:40 UTC (rev 253862)
@@ -5770,7 +5770,6 @@
         m_out.storePtr(scope, fastObject, m_heaps.JSFunction_scope);
         m_out.storePtr(weakPointer(executable), fastObject, m_heaps.JSFunction_executable);
         m_out.storePtr(m_out.intPtrZero, fastObject, m_heaps.JSFunction_rareData);
-        m_out.storePtr(weakPointer(structure->globalObject()), fastObject, m_heaps.JSFunction_globalObject);
         mutatorFence();
 
         ValueFromBlock fastResult = m_out.anchor(fastObject);

Modified: trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp (253861 => 253862)


--- trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp	2019-12-21 07:35:44 UTC (rev 253861)
+++ trunk/Source/_javascript_Core/jit/ThunkGenerators.cpp	2019-12-21 09:49:40 UTC (rev 253862)
@@ -288,7 +288,7 @@
     jit.emitGetFromCallFrameHeaderPtr(CallFrameSlot::callee, GPRInfo::argumentGPR2);
 
     if (thunkFunctionType == ThunkFunctionType::JSFunction) {
-        jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR2, JSFunction::offsetOfGlobalObject()), GPRInfo::argumentGPR0);
+        jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR2, JSFunction::offsetOfScopeChain()), GPRInfo::argumentGPR0);
         jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR2, JSFunction::offsetOfExecutable()), GPRInfo::argumentGPR2);
         jit.call(CCallHelpers::Address(GPRInfo::argumentGPR2, executableOffsetToFunction), JSEntryPtrTag);
     } else {
@@ -1177,7 +1177,7 @@
 
     // Throw Stack Overflow exception
     jit.copyCalleeSavesToEntryFrameCalleeSavesBuffer(vm.topEntryFrame);
-    jit.loadPtr(CCallHelpers::Address(GPRInfo::regT3, JSBoundFunction::offsetOfGlobalObject()), GPRInfo::regT3);
+    jit.loadPtr(CCallHelpers::Address(GPRInfo::regT3, JSBoundFunction::offsetOfScopeChain()), GPRInfo::regT3);
     jit.setupArguments<decltype(operationThrowStackOverflowErrorFromThunk)>(GPRInfo::regT3);
     jit.prepareCallOperation(vm);
     jit.move(CCallHelpers::TrustedImmPtr(tagCFunctionPtr<OperationPtrTag>(operationThrowStackOverflowErrorFromThunk)), GPRInfo::nonArgGPR0);

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (253861 => 253862)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2019-12-21 07:35:44 UTC (rev 253861)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2019-12-21 09:49:40 UTC (rev 253862)
@@ -2055,7 +2055,7 @@
 
     loadp Callee + PayloadOffset[cfr], a0
     loadp JSFunction::m_executable[a0], a2
-    loadp JSFunction::m_globalObject[a0], a0
+    loadp JSFunction::m_scope[a0], a0
     loadp JSGlobalObject::m_vm[a0], a1
     storep cfr, VM::topCallFrame[a1]
     move cfr, a1
@@ -2068,7 +2068,7 @@
     end
 
     loadp Callee + PayloadOffset[cfr], t3
-    loadp JSFunction::m_globalObject[t3], t3
+    loadp JSFunction::m_scope[t3], t3
     loadp JSGlobalObject::m_vm[t3], t3
 
     if MIPS

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (253861 => 253862)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2019-12-21 07:35:44 UTC (rev 253861)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2019-12-21 09:49:40 UTC (rev 253862)
@@ -2170,7 +2170,7 @@
     storep 0, CodeBlock[cfr]
     loadp Callee[cfr], a0
     loadp JSFunction::m_executable[a0], a2
-    loadp JSFunction::m_globalObject[a0], a0
+    loadp JSFunction::m_scope[a0], a0
     loadp JSGlobalObject::m_vm[a0], a1
     storep cfr, VM::topCallFrame[a1]
     if ARM64 or ARM64E or C_LOOP or C_LOOP_WIN
@@ -2191,7 +2191,7 @@
     end
 
     loadp Callee[cfr], t3
-    loadp JSFunction::m_globalObject[t3], t3
+    loadp JSFunction::m_scope[t3], t3
     loadp JSGlobalObject::m_vm[t3], t3
 
     btpnz VM::m_exception[t3], .handleException

Modified: trunk/Source/_javascript_Core/runtime/JSFunction.cpp (253861 => 253862)


--- trunk/Source/_javascript_Core/runtime/JSFunction.cpp	2019-12-21 07:35:44 UTC (rev 253861)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.cpp	2019-12-21 09:49:40 UTC (rev 253862)
@@ -115,9 +115,9 @@
 JSFunction::JSFunction(VM& vm, JSGlobalObject* globalObject, Structure* structure)
     : Base(vm, globalObject, structure)
     , m_executable()
-    , m_globalObject(vm, this, structure->globalObject())
 {
     assertTypeInfoFlagInvariants();
+    ASSERT(structure->globalObject() == globalObject);
 }
 
 

Modified: trunk/Source/_javascript_Core/runtime/JSFunction.h (253861 => 253862)


--- trunk/Source/_javascript_Core/runtime/JSFunction.h	2019-12-21 07:35:44 UTC (rev 253861)
+++ trunk/Source/_javascript_Core/runtime/JSFunction.h	2019-12-21 09:49:40 UTC (rev 253862)
@@ -124,11 +124,6 @@
         return OBJECT_OFFSETOF(JSFunction, m_rareData);
     }
 
-    static inline ptrdiff_t offsetOfGlobalObject()
-    {
-        return OBJECT_OFFSETOF(JSFunction, m_globalObject);
-    }
-
     FunctionRareData* rareData(VM& vm)
     {
         if (UNLIKELY(!m_rareData))
@@ -149,8 +144,6 @@
         return rareData;
     }
 
-    JSGlobalObject* globalObject() const { return m_globalObject.get(); }
-
     bool isHostOrBuiltinFunction() const;
     bool isBuiltinFunction() const;
     JS_EXPORT_PRIVATE bool isHostFunctionNonInline() const;
@@ -228,7 +221,6 @@
 
     WriteBarrier<ExecutableBase> m_executable;
     WriteBarrier<FunctionRareData> m_rareData;
-    WriteBarrier<JSGlobalObject> m_globalObject;
 };
 
 class JSStrictFunction final : public JSFunction {

Modified: trunk/Source/_javascript_Core/runtime/JSFunctionInlines.h (253861 => 253862)


--- trunk/Source/_javascript_Core/runtime/JSFunctionInlines.h	2019-12-21 07:35:44 UTC (rev 253861)
+++ trunk/Source/_javascript_Core/runtime/JSFunctionInlines.h	2019-12-21 09:49:40 UTC (rev 253862)
@@ -42,7 +42,6 @@
     : Base(vm, scope, structure)
     , m_executable(vm, this, executable)
     , m_rareData()
-    , m_globalObject(vm, this, structure->globalObject())
 {
     assertTypeInfoFlagInvariants();
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to