Some JSEntryPtrTags should actually be JSInternalPtrTags.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2018 23:30:05 +0000 (23:30 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Apr 2018 23:30:05 +0000 (23:30 +0000)
https://bugs.webkit.org/show_bug.cgi?id=184712
<rdar://problem/39507381>

Reviewed by Michael Saboff.

1. Convert some uses of JSEntryPtrTag into JSInternalPtrTags.
2. Tag all LLInt bytecodes consistently with BytecodePtrTag now and retag them
   only when needed.

* bytecode/AccessCase.cpp:
(JSC::AccessCase::generateImpl):
* bytecode/ByValInfo.h:
(JSC::ByValInfo::ByValInfo):
* bytecode/CallLinkInfo.cpp:
(JSC::CallLinkInfo::callReturnLocation):
(JSC::CallLinkInfo::patchableJump):
(JSC::CallLinkInfo::hotPathBegin):
(JSC::CallLinkInfo::slowPathStart):
* bytecode/CallLinkInfo.h:
(JSC::CallLinkInfo::setCallLocations):
(JSC::CallLinkInfo::hotPathOther):
* bytecode/PolymorphicAccess.cpp:
(JSC::PolymorphicAccess::regenerate):
* bytecode/StructureStubInfo.h:
(JSC::StructureStubInfo::doneLocation):
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::link):
* dfg/DFGOSRExit.cpp:
(JSC::DFG::reifyInlinedCallFrames):
* ftl/FTLLazySlowPath.cpp:
(JSC::FTL::LazySlowPath::initialize):
* ftl/FTLLazySlowPath.h:
(JSC::FTL::LazySlowPath::done const):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct):
(JSC::FTL::DFG::LowerDFGToB3::compileDirectCallOrConstruct):
(JSC::FTL::DFG::LowerDFGToB3::compileTailCall):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
(JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
(JSC::FTL::DFG::LowerDFGToB3::compileIn):
(JSC::FTL::DFG::LowerDFGToB3::lazySlowPath):
* jit/JIT.cpp:
(JSC::JIT::link):
* jit/JITExceptions.cpp:
(JSC::genericUnwind):
* jit/JITMathIC.h:
(JSC::isProfileEmpty):
* llint/LLIntData.cpp:
(JSC::LLInt::initialize):
* llint/LLIntData.h:
(JSC::LLInt::getCodePtr):
(JSC::LLInt::getExecutableAddress): Deleted.
* llint/LLIntExceptions.cpp:
(JSC::LLInt::callToThrow):
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* wasm/js/WasmToJS.cpp:
(JSC::Wasm::wasmToJS):

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

20 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecode/AccessCase.cpp
Source/JavaScriptCore/bytecode/ByValInfo.h
Source/JavaScriptCore/bytecode/CallLinkInfo.cpp
Source/JavaScriptCore/bytecode/CallLinkInfo.h
Source/JavaScriptCore/bytecode/PolymorphicAccess.cpp
Source/JavaScriptCore/bytecode/StructureStubInfo.h
Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
Source/JavaScriptCore/dfg/DFGOSRExit.cpp
Source/JavaScriptCore/ftl/FTLLazySlowPath.cpp
Source/JavaScriptCore/ftl/FTLLazySlowPath.h
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Source/JavaScriptCore/jit/JIT.cpp
Source/JavaScriptCore/jit/JITExceptions.cpp
Source/JavaScriptCore/jit/JITMathIC.h
Source/JavaScriptCore/llint/LLIntData.cpp
Source/JavaScriptCore/llint/LLIntData.h
Source/JavaScriptCore/llint/LLIntExceptions.cpp
Source/JavaScriptCore/llint/LLIntSlowPaths.cpp
Source/JavaScriptCore/wasm/js/WasmToJS.cpp

index 5ba3b66..fde879c 100644 (file)
@@ -1,3 +1,65 @@
+2018-04-20  Mark Lam  <mark.lam@apple.com>
+
+        Some JSEntryPtrTags should actually be JSInternalPtrTags.
+        https://bugs.webkit.org/show_bug.cgi?id=184712
+        <rdar://problem/39507381>
+
+        Reviewed by Michael Saboff.
+
+        1. Convert some uses of JSEntryPtrTag into JSInternalPtrTags.
+        2. Tag all LLInt bytecodes consistently with BytecodePtrTag now and retag them
+           only when needed.
+
+        * bytecode/AccessCase.cpp:
+        (JSC::AccessCase::generateImpl):
+        * bytecode/ByValInfo.h:
+        (JSC::ByValInfo::ByValInfo):
+        * bytecode/CallLinkInfo.cpp:
+        (JSC::CallLinkInfo::callReturnLocation):
+        (JSC::CallLinkInfo::patchableJump):
+        (JSC::CallLinkInfo::hotPathBegin):
+        (JSC::CallLinkInfo::slowPathStart):
+        * bytecode/CallLinkInfo.h:
+        (JSC::CallLinkInfo::setCallLocations):
+        (JSC::CallLinkInfo::hotPathOther):
+        * bytecode/PolymorphicAccess.cpp:
+        (JSC::PolymorphicAccess::regenerate):
+        * bytecode/StructureStubInfo.h:
+        (JSC::StructureStubInfo::doneLocation):
+        * dfg/DFGJITCompiler.cpp:
+        (JSC::DFG::JITCompiler::link):
+        * dfg/DFGOSRExit.cpp:
+        (JSC::DFG::reifyInlinedCallFrames):
+        * ftl/FTLLazySlowPath.cpp:
+        (JSC::FTL::LazySlowPath::initialize):
+        * ftl/FTLLazySlowPath.h:
+        (JSC::FTL::LazySlowPath::done const):
+        * ftl/FTLLowerDFGToB3.cpp:
+        (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstruct):
+        (JSC::FTL::DFG::LowerDFGToB3::compileDirectCallOrConstruct):
+        (JSC::FTL::DFG::LowerDFGToB3::compileTailCall):
+        (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargsSpread):
+        (JSC::FTL::DFG::LowerDFGToB3::compileCallOrConstructVarargs):
+        (JSC::FTL::DFG::LowerDFGToB3::compileIn):
+        (JSC::FTL::DFG::LowerDFGToB3::lazySlowPath):
+        * jit/JIT.cpp:
+        (JSC::JIT::link):
+        * jit/JITExceptions.cpp:
+        (JSC::genericUnwind):
+        * jit/JITMathIC.h:
+        (JSC::isProfileEmpty):
+        * llint/LLIntData.cpp:
+        (JSC::LLInt::initialize):
+        * llint/LLIntData.h:
+        (JSC::LLInt::getCodePtr):
+        (JSC::LLInt::getExecutableAddress): Deleted.
+        * llint/LLIntExceptions.cpp:
+        (JSC::LLInt::callToThrow):
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+        * wasm/js/WasmToJS.cpp:
+        (JSC::Wasm::wasmToJS):
+
 2018-04-18  Jer Noble  <jer.noble@apple.com>
 
         Don't put build products into WK_ALTERNATE_WEBKIT_SDK_PATH for engineering builds
index 9698593..a2f5935 100644 (file)
@@ -818,9 +818,9 @@ void AccessCase::generateImpl(AccessGenerationState& state)
 
             jit.addLinkTask([=, &vm] (LinkBuffer& linkBuffer) {
                 this->as<GetterSetterAccessCase>().callLinkInfo()->setCallLocations(
-                    CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOfNearCall<JSEntryPtrTag>(slowPathCall)),
-                    CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOf<JSEntryPtrTag>(addressOfLinkFunctionCheck)),
-                    linkBuffer.locationOfNearCall<JSEntryPtrTag>(fastPathCall));
+                    CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOfNearCall<JSInternalPtrTag>(slowPathCall)),
+                    CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOf<JSInternalPtrTag>(addressOfLinkFunctionCheck)),
+                    linkBuffer.locationOfNearCall<JSInternalPtrTag>(fastPathCall));
 
                 linkBuffer.link(
                     slowPathCall,
index ac1d44d..ee09908 100644 (file)
@@ -226,7 +226,7 @@ inline JITArrayMode jitArrayModeForStructure(Structure* structure)
 struct ByValInfo {
     ByValInfo() { }
 
-    ByValInfo(unsigned bytecodeIndex, CodeLocationJump<JSEntryPtrTag> notIndexJump, CodeLocationJump<JSEntryPtrTag> badTypeJump, CodeLocationLabel<ExceptionHandlerPtrTag> exceptionHandler, JITArrayMode arrayMode, ArrayProfile* arrayProfile, int16_t badTypeJumpToDone, int16_t badTypeJumpToNextHotPath, int16_t returnAddressToSlowPath)
+    ByValInfo(unsigned bytecodeIndex, CodeLocationJump<JSInternalPtrTag> notIndexJump, CodeLocationJump<JSInternalPtrTag> badTypeJump, CodeLocationLabel<ExceptionHandlerPtrTag> exceptionHandler, JITArrayMode arrayMode, ArrayProfile* arrayProfile, int16_t badTypeJumpToDone, int16_t badTypeJumpToNextHotPath, int16_t returnAddressToSlowPath)
         : bytecodeIndex(bytecodeIndex)
         , notIndexJump(notIndexJump)
         , badTypeJump(badTypeJump)
@@ -244,8 +244,8 @@ struct ByValInfo {
     }
 
     unsigned bytecodeIndex;
-    CodeLocationJump<JSEntryPtrTag> notIndexJump;
-    CodeLocationJump<JSEntryPtrTag> badTypeJump;
+    CodeLocationJump<JSInternalPtrTag> notIndexJump;
+    CodeLocationJump<JSInternalPtrTag> badTypeJump;
     CodeLocationLabel<ExceptionHandlerPtrTag> exceptionHandler;
     JITArrayMode arrayMode; // The array mode that was baked into the inline JIT code.
     ArrayProfile* arrayProfile;
index d5e2ca2..b5eb6f0 100644 (file)
@@ -97,25 +97,25 @@ void CallLinkInfo::unlink(VM& vm)
     RELEASE_ASSERT(!isOnList());
 }
 
-CodeLocationNearCall<JSEntryPtrTag> CallLinkInfo::callReturnLocation()
+CodeLocationNearCall<JSInternalPtrTag> CallLinkInfo::callReturnLocation()
 {
     RELEASE_ASSERT(!isDirect());
-    return CodeLocationNearCall<JSEntryPtrTag>(m_callReturnLocationOrPatchableJump, Regular);
+    return CodeLocationNearCall<JSInternalPtrTag>(m_callReturnLocationOrPatchableJump, Regular);
 }
 
-CodeLocationJump<JSEntryPtrTag> CallLinkInfo::patchableJump()
+CodeLocationJump<JSInternalPtrTag> CallLinkInfo::patchableJump()
 {
     RELEASE_ASSERT(callType() == DirectTailCall);
-    return CodeLocationJump<JSEntryPtrTag>(m_callReturnLocationOrPatchableJump);
+    return CodeLocationJump<JSInternalPtrTag>(m_callReturnLocationOrPatchableJump);
 }
 
-CodeLocationDataLabelPtr<JSEntryPtrTag> CallLinkInfo::hotPathBegin()
+CodeLocationDataLabelPtr<JSInternalPtrTag> CallLinkInfo::hotPathBegin()
 {
     RELEASE_ASSERT(!isDirect());
-    return CodeLocationDataLabelPtr<JSEntryPtrTag>(m_hotPathBeginOrSlowPathStart);
+    return CodeLocationDataLabelPtr<JSInternalPtrTag>(m_hotPathBeginOrSlowPathStart);
 }
 
-CodeLocationLabel<JSEntryPtrTag> CallLinkInfo::slowPathStart()
+CodeLocationLabel<JSInternalPtrTag> CallLinkInfo::slowPathStart()
 {
     RELEASE_ASSERT(isDirect());
     return m_hotPathBeginOrSlowPathStart;
index 2863264..68b97bf 100644 (file)
@@ -165,9 +165,9 @@ public:
     }
 
     void setCallLocations(
-        CodeLocationLabel<JSEntryPtrTag> callReturnLocationOrPatchableJump,
-        CodeLocationLabel<JSEntryPtrTag> hotPathBeginOrSlowPathStart,
-        CodeLocationNearCall<JSEntryPtrTag> hotPathOther)
+        CodeLocationLabel<JSInternalPtrTag> callReturnLocationOrPatchableJump,
+        CodeLocationLabel<JSInternalPtrTag> hotPathBeginOrSlowPathStart,
+        CodeLocationNearCall<JSInternalPtrTag> hotPathOther)
     {
         m_callReturnLocationOrPatchableJump = callReturnLocationOrPatchableJump;
         m_hotPathBeginOrSlowPathStart = hotPathBeginOrSlowPathStart;
@@ -181,12 +181,12 @@ public:
         m_allowStubs = false;
     }
 
-    CodeLocationNearCall<JSEntryPtrTag> callReturnLocation();
-    CodeLocationJump<JSEntryPtrTag> patchableJump();
-    CodeLocationDataLabelPtr<JSEntryPtrTag> hotPathBegin();
-    CodeLocationLabel<JSEntryPtrTag> slowPathStart();
+    CodeLocationNearCall<JSInternalPtrTag> callReturnLocation();
+    CodeLocationJump<JSInternalPtrTag> patchableJump();
+    CodeLocationDataLabelPtr<JSInternalPtrTag> hotPathBegin();
+    CodeLocationLabel<JSInternalPtrTag> slowPathStart();
 
-    CodeLocationNearCall<JSEntryPtrTag> hotPathOther()
+    CodeLocationNearCall<JSInternalPtrTag> hotPathOther()
     {
         return m_hotPathOther;
     }
@@ -327,11 +327,9 @@ public:
     }
 
 private:
-    // FIXME: These should be tagged with JSInternalPtrTag instead of JSEntryTag.
-    // https://bugs.webkit.org/show_bug.cgi?id=184712
-    CodeLocationLabel<JSEntryPtrTag> m_callReturnLocationOrPatchableJump;
-    CodeLocationLabel<JSEntryPtrTag> m_hotPathBeginOrSlowPathStart;
-    CodeLocationNearCall<JSEntryPtrTag> m_hotPathOther;
+    CodeLocationLabel<JSInternalPtrTag> m_callReturnLocationOrPatchableJump;
+    CodeLocationLabel<JSInternalPtrTag> m_hotPathBeginOrSlowPathStart;
+    CodeLocationNearCall<JSInternalPtrTag> m_hotPathOther;
     WriteBarrier<JSCell> m_calleeOrCodeBlock;
     WriteBarrier<JSCell> m_lastSeenCalleeOrExecutable;
     RefPtr<PolymorphicCallStubRoutine> m_stub;
index 305eee4..258fb5e 100644 (file)
@@ -558,7 +558,7 @@ AccessGenerationResult PolymorphicAccess::regenerate(
         return AccessGenerationResult::GaveUp;
     }
 
-    CodeLocationLabel<JSEntryPtrTag> successLabel = stubInfo.doneLocation();
+    CodeLocationLabel<JSInternalPtrTag> successLabel = stubInfo.doneLocation();
 
     linkBuffer.link(state.success, successLabel);
 
index 8c9fc90..e830131 100644 (file)
@@ -186,7 +186,7 @@ public:
     } patch;
 
     CodeLocationCall<JSInternalPtrTag> slowPathCallLocation() { return patch.start.callAtOffset<JSInternalPtrTag>(patch.deltaFromStartToSlowPathCallLocation); }
-    CodeLocationLabel<JSEntryPtrTag> doneLocation() { return patch.start.labelAtOffset<JSEntryPtrTag>(patch.inlineSize); }
+    CodeLocationLabel<JSInternalPtrTag> doneLocation() { return patch.start.labelAtOffset<JSInternalPtrTag>(patch.inlineSize); }
     CodeLocationLabel<JITStubRoutinePtrTag> slowPathStartLocation() { return patch.start.labelAtOffset(patch.deltaFromStartToSlowPathStart); }
     CodeLocationJump<JSInternalPtrTag> patchableJumpForIn()
     { 
index a6f0e23..ed970ff 100644 (file)
@@ -292,26 +292,26 @@ void JITCompiler::link(LinkBuffer& linkBuffer)
         CallLinkInfo& info = *record.info;
         linkBuffer.link(record.slowCall, linkCallThunk);
         info.setCallLocations(
-            CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOfNearCall<JSEntryPtrTag>(record.slowCall)),
-            CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOf<JSEntryPtrTag>(record.targetToCheck)),
-            linkBuffer.locationOfNearCall<JSEntryPtrTag>(record.fastCall));
+            CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOfNearCall<JSInternalPtrTag>(record.slowCall)),
+            CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOf<JSInternalPtrTag>(record.targetToCheck)),
+            linkBuffer.locationOfNearCall<JSInternalPtrTag>(record.fastCall));
     }
     
     for (JSDirectCallRecord& record : m_jsDirectCalls) {
         CallLinkInfo& info = *record.info;
         linkBuffer.link(record.call, linkBuffer.locationOf<NoPtrTag>(record.slowPath));
         info.setCallLocations(
-            CodeLocationLabel<JSEntryPtrTag>(),
-            linkBuffer.locationOf<JSEntryPtrTag>(record.slowPath),
-            linkBuffer.locationOfNearCall<JSEntryPtrTag>(record.call));
+            CodeLocationLabel<JSInternalPtrTag>(),
+            linkBuffer.locationOf<JSInternalPtrTag>(record.slowPath),
+            linkBuffer.locationOfNearCall<JSInternalPtrTag>(record.call));
     }
     
     for (JSDirectTailCallRecord& record : m_jsDirectTailCalls) {
         CallLinkInfo& info = *record.info;
         info.setCallLocations(
-            linkBuffer.locationOf<JSEntryPtrTag>(record.patchableJump),
-            linkBuffer.locationOf<JSEntryPtrTag>(record.slowPath),
-            linkBuffer.locationOfNearCall<JSEntryPtrTag>(record.call));
+            linkBuffer.locationOf<JSInternalPtrTag>(record.patchableJump),
+            linkBuffer.locationOf<JSInternalPtrTag>(record.slowPath),
+            linkBuffer.locationOfNearCall<JSInternalPtrTag>(record.call));
     }
     
     MacroAssemblerCodeRef<JITThunkPtrTag> osrExitThunk = vm()->getCTIStub(osrExitGenerationThunkGenerator);
index 48d8710..92ca22a 100644 (file)
@@ -754,7 +754,7 @@ static void reifyInlinedCallFrames(Context& context, CodeBlock* outermostBaselin
         } else {
             CodeBlock* baselineCodeBlockForCaller = baselineCodeBlockForOriginAndBaselineCodeBlock(*trueCaller, outermostBaselineCodeBlock);
             unsigned callBytecodeIndex = trueCaller->bytecodeIndex;
-            void* jumpTarget = nullptr;
+            MacroAssemblerCodePtr<JSInternalPtrTag> jumpTarget;
 
             switch (trueCallerCallKind) {
             case InlineCallFrame::Call:
@@ -767,7 +767,7 @@ static void reifyInlinedCallFrames(Context& context, CodeBlock* outermostBaselin
                     baselineCodeBlockForCaller->getCallLinkInfoForBytecodeIndex(callBytecodeIndex);
                 RELEASE_ASSERT(callLinkInfo);
 
-                jumpTarget = callLinkInfo->callReturnLocation().executableAddress();
+                jumpTarget = callLinkInfo->callReturnLocation();
                 break;
             }
 
@@ -777,7 +777,7 @@ static void reifyInlinedCallFrames(Context& context, CodeBlock* outermostBaselin
                     baselineCodeBlockForCaller->findStubInfo(CodeOrigin(callBytecodeIndex));
                 RELEASE_ASSERT(stubInfo);
 
-                jumpTarget = stubInfo->doneLocation().executableAddress();
+                jumpTarget = stubInfo->doneLocation();
                 break;
             }
 
@@ -788,11 +788,12 @@ static void reifyInlinedCallFrames(Context& context, CodeBlock* outermostBaselin
             if (trueCaller->inlineCallFrame)
                 callerFrame = cpu.fp<uint8_t*>() + trueCaller->inlineCallFrame->stackOffset * sizeof(EncodedJSValue);
 
+            void* targetAddress = jumpTarget.executableAddress();
 #if USE(POINTER_PROFILING)
             void* newEntrySP = cpu.fp<uint8_t*>() + inlineCallFrame->returnPCOffset() + sizeof(void*);
-            jumpTarget = retagCodePtr(jumpTarget, JSEntryPtrTag, bitwise_cast<PtrTag>(newEntrySP));
+            targetAddress = retagCodePtr(targetAddress, JSInternalPtrTag, bitwise_cast<PtrTag>(newEntrySP));
 #endif
-            frame.set<void*>(inlineCallFrame->returnPCOffset(), jumpTarget);
+            frame.set<void*>(inlineCallFrame->returnPCOffset(), targetAddress);
         }
 
         frame.setOperand<void*>(inlineCallFrame->stackOffset + CallFrameSlot::codeBlock, baselineCodeBlock);
index a5d3d4f..34cc1ea 100644 (file)
@@ -38,7 +38,7 @@ LazySlowPath::~LazySlowPath()
 }
 
 void LazySlowPath::initialize(
-    CodeLocationJump<JSInternalPtrTag> patchableJump, CodeLocationLabel<JSEntryPtrTag> done,
+    CodeLocationJump<JSInternalPtrTag> patchableJump, CodeLocationLabel<JSInternalPtrTag> done,
     CodeLocationLabel<ExceptionHandlerPtrTag> exceptionTarget,
     const RegisterSet& usedRegisters, CallSiteIndex callSiteIndex, RefPtr<Generator> generator
     )
index 767ef12..9a6e601 100644 (file)
@@ -69,13 +69,13 @@ public:
     ~LazySlowPath();
 
     void initialize(
-        CodeLocationJump<JSInternalPtrTag> patchableJump, CodeLocationLabel<JSEntryPtrTag> done,
+        CodeLocationJump<JSInternalPtrTag> patchableJump, CodeLocationLabel<JSInternalPtrTag> done,
         CodeLocationLabel<ExceptionHandlerPtrTag> exceptionTarget, const RegisterSet& usedRegisters,
         CallSiteIndex, RefPtr<Generator>
         );
 
     CodeLocationJump<JSInternalPtrTag> patchableJump() const { return m_patchableJump; }
-    CodeLocationLabel<JSEntryPtrTag> done() const { return m_done; }
+    CodeLocationLabel<JSInternalPtrTag> done() const { return m_done; }
     const RegisterSet& usedRegisters() const { return m_usedRegisters; }
     CallSiteIndex callSiteIndex() const { return m_callSiteIndex; }
 
@@ -85,9 +85,7 @@ public:
 
 private:
     CodeLocationJump<JSInternalPtrTag> m_patchableJump;
-    // FIXME: This should be tagged with JSInternalPtrTag instead of JSEntryTag.
-    // https://bugs.webkit.org/show_bug.cgi?id=184712
-    CodeLocationLabel<JSEntryPtrTag> m_done;
+    CodeLocationLabel<JSInternalPtrTag> m_done;
     CodeLocationLabel<ExceptionHandlerPtrTag> m_exceptionTarget;
     RegisterSet m_usedRegisters;
     CallSiteIndex m_callSiteIndex;
index 6975f7a..12fcaf9 100644 (file)
@@ -7172,9 +7172,9 @@ private:
                         linkBuffer.link(slowCall, FunctionPtr<JITThunkPtrTag>(linkCall));
 
                         callLinkInfo->setCallLocations(
-                            CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOfNearCall<JSEntryPtrTag>(slowCall)),
-                            CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOf<JSEntryPtrTag>(targetToCheck)),
-                            linkBuffer.locationOfNearCall<JSEntryPtrTag>(fastCall));
+                            CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOfNearCall<JSInternalPtrTag>(slowCall)),
+                            CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOf<JSInternalPtrTag>(targetToCheck)),
+                            linkBuffer.locationOfNearCall<JSInternalPtrTag>(fastCall));
                     });
             });
 
@@ -7314,10 +7314,10 @@ private:
                     
                     jit.addLinkTask(
                         [=] (LinkBuffer& linkBuffer) {
-                            CodeLocationLabel<JSEntryPtrTag> patchableJumpLocation = linkBuffer.locationOf<JSEntryPtrTag>(patchableJump);
-                            CodeLocationNearCall<JSEntryPtrTag> callLocation = linkBuffer.locationOfNearCall<JSEntryPtrTag>(call);
-                            CodeLocationLabel<JSEntryPtrTag> slowPathLocation = linkBuffer.locationOf<JSEntryPtrTag>(slowPath);
-                            
+                            CodeLocationLabel<JSInternalPtrTag> patchableJumpLocation = linkBuffer.locationOf<JSInternalPtrTag>(patchableJump);
+                            CodeLocationNearCall<JSInternalPtrTag> callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call);
+                            CodeLocationLabel<JSInternalPtrTag> slowPathLocation = linkBuffer.locationOf<JSInternalPtrTag>(slowPath);
+
                             callLinkInfo->setCallLocations(
                                 patchableJumpLocation,
                                 slowPathLocation,
@@ -7363,13 +7363,13 @@ private:
                         
                         jit.addLinkTask(
                             [=] (LinkBuffer& linkBuffer) {
-                                CodeLocationNearCall<JSEntryPtrTag> callLocation = linkBuffer.locationOfNearCall<JSEntryPtrTag>(call);
-                                CodeLocationLabel<JSEntryPtrTag> slowPathLocation = linkBuffer.locationOf<JSEntryPtrTag>(slowPath);
-                                
+                                CodeLocationNearCall<JSInternalPtrTag> callLocation = linkBuffer.locationOfNearCall<JSInternalPtrTag>(call);
+                                CodeLocationLabel<JSInternalPtrTag> slowPathLocation = linkBuffer.locationOf<JSInternalPtrTag>(slowPath);
+
                                 linkBuffer.link(call, slowPathLocation);
-                                
+
                                 callLinkInfo->setCallLocations(
-                                    CodeLocationLabel<JSEntryPtrTag>(),
+                                    CodeLocationLabel<JSInternalPtrTag>(),
                                     slowPathLocation,
                                     callLocation);
                             });
@@ -7492,9 +7492,9 @@ private:
                         linkBuffer.link(slowCall, FunctionPtr<JITThunkPtrTag>(linkCall));
 
                         callLinkInfo->setCallLocations(
-                            CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOfNearCall<JSEntryPtrTag>(slowCall)),
-                            CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOf<JSEntryPtrTag>(targetToCheck)),
-                            linkBuffer.locationOfNearCall<JSEntryPtrTag>(fastCall));
+                            CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOfNearCall<JSInternalPtrTag>(slowCall)),
+                            CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOf<JSInternalPtrTag>(targetToCheck)),
+                            linkBuffer.locationOfNearCall<JSInternalPtrTag>(fastCall));
                     });
             });
     }
@@ -7790,9 +7790,9 @@ private:
                         linkBuffer.link(slowCall, FunctionPtr<JITThunkPtrTag>(linkCall));
                         
                         callLinkInfo->setCallLocations(
-                            CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOfNearCall<JSEntryPtrTag>(slowCall)),
-                            CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOf<JSEntryPtrTag>(targetToCheck)),
-                            linkBuffer.locationOfNearCall<JSEntryPtrTag>(fastCall));
+                            CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOfNearCall<JSInternalPtrTag>(slowCall)),
+                            CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOf<JSInternalPtrTag>(targetToCheck)),
+                            linkBuffer.locationOfNearCall<JSInternalPtrTag>(fastCall));
                     });
             });
 
@@ -8072,9 +8072,9 @@ private:
                         linkBuffer.link(slowCall, FunctionPtr<JITThunkPtrTag>(linkCall));
                         
                         callLinkInfo->setCallLocations(
-                            CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOfNearCall<JSEntryPtrTag>(slowCall)),
-                            CodeLocationLabel<JSEntryPtrTag>(linkBuffer.locationOf<JSEntryPtrTag>(targetToCheck)),
-                            linkBuffer.locationOfNearCall<JSEntryPtrTag>(fastCall));
+                            CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOfNearCall<JSInternalPtrTag>(slowCall)),
+                            CodeLocationLabel<JSInternalPtrTag>(linkBuffer.locationOf<JSInternalPtrTag>(targetToCheck)),
+                            linkBuffer.locationOfNearCall<JSInternalPtrTag>(fastCall));
                     });
             });
 
@@ -9687,15 +9687,15 @@ private:
                                         CodeLocationLabel<JITStubRoutinePtrTag> start = linkBuffer.locationOf<JITStubRoutinePtrTag>(jump);
                                         stubInfo->patch.start = start;
                                         ptrdiff_t inlineSize = MacroAssembler::differenceBetweenCodePtr(
-                                            start, linkBuffer.locationOf<JSEntryPtrTag>(done));
+                                            start, linkBuffer.locationOf<NoPtrTag>(done));
                                         RELEASE_ASSERT(inlineSize >= 0);
                                         stubInfo->patch.inlineSize = inlineSize;
 
                                         stubInfo->patch.deltaFromStartToSlowPathCallLocation = MacroAssembler::differenceBetweenCodePtr(
-                                            start, linkBuffer.locationOf<JSEntryPtrTag>(slowPathCall));
+                                            start, linkBuffer.locationOf<NoPtrTag>(slowPathCall));
 
                                         stubInfo->patch.deltaFromStartToSlowPathStart = MacroAssembler::differenceBetweenCodePtr(
-                                            start, linkBuffer.locationOf<JSEntryPtrTag>(slowPathBegin));
+                                            start, linkBuffer.locationOf<NoPtrTag>(slowPathBegin));
 
                                     });
                             });
@@ -13984,7 +13984,7 @@ private:
 
                                 auto linkedPatchableJump = CodeLocationJump<JSInternalPtrTag>(linkBuffer.locationOf<JSInternalPtrTag>(patchableJump));
 
-                                CodeLocationLabel<JSEntryPtrTag> linkedDone = linkBuffer.locationOf<JSEntryPtrTag>(done);
+                                CodeLocationLabel<JSInternalPtrTag> linkedDone = linkBuffer.locationOf<JSInternalPtrTag>(done);
 
                                 CallSiteIndex callSiteIndex =
                                     jitCode->common.addUniqueCallSiteIndex(origin);
index b74b92e..07c7705 100644 (file)
@@ -835,10 +835,10 @@ CompilationResult JIT::link()
 
         for (const auto& byValCompilationInfo : m_byValCompilationInfo) {
             PatchableJump patchableNotIndexJump = byValCompilationInfo.notIndexJump;
-            auto notIndexJump = CodeLocationJump<JSEntryPtrTag>();
+            auto notIndexJump = CodeLocationJump<JSInternalPtrTag>();
             if (Jump(patchableNotIndexJump).isSet())
-                notIndexJump = CodeLocationJump<JSEntryPtrTag>(patchBuffer.locationOf<JSEntryPtrTag>(patchableNotIndexJump));
-            auto badTypeJump = CodeLocationJump<JSEntryPtrTag>(patchBuffer.locationOf<JSEntryPtrTag>(byValCompilationInfo.badTypeJump));
+                notIndexJump = CodeLocationJump<JSInternalPtrTag>(patchBuffer.locationOf<JSInternalPtrTag>(patchableNotIndexJump));
+            auto badTypeJump = CodeLocationJump<JSInternalPtrTag>(patchBuffer.locationOf<JSInternalPtrTag>(byValCompilationInfo.badTypeJump));
             CodeLocationLabel<NoPtrTag> doneTarget = patchBuffer.locationOf<NoPtrTag>(byValCompilationInfo.doneTarget);
             CodeLocationLabel<NoPtrTag> nextHotPathTarget = patchBuffer.locationOf<NoPtrTag>(byValCompilationInfo.nextHotPathTarget);
             CodeLocationLabel<NoPtrTag> slowPathTarget = patchBuffer.locationOf<NoPtrTag>(byValCompilationInfo.slowPathTarget);
@@ -860,9 +860,9 @@ CompilationResult JIT::link()
     for (auto& compilationInfo : m_callCompilationInfo) {
         CallLinkInfo& info = *compilationInfo.callLinkInfo;
         info.setCallLocations(
-            CodeLocationLabel<JSEntryPtrTag>(patchBuffer.locationOfNearCall<JSEntryPtrTag>(compilationInfo.callReturnLocation)),
-            CodeLocationLabel<JSEntryPtrTag>(patchBuffer.locationOf<JSEntryPtrTag>(compilationInfo.hotPathBegin)),
-            patchBuffer.locationOfNearCall<JSEntryPtrTag>(compilationInfo.hotPathOther));
+            CodeLocationLabel<JSInternalPtrTag>(patchBuffer.locationOfNearCall<JSInternalPtrTag>(compilationInfo.callReturnLocation)),
+            CodeLocationLabel<JSInternalPtrTag>(patchBuffer.locationOf<JSInternalPtrTag>(compilationInfo.hotPathBegin)),
+            patchBuffer.locationOfNearCall<JSInternalPtrTag>(compilationInfo.hotPathOther));
     }
 
     JITCodeMap jitCodeMap;
index 45c72ce..055945f 100644 (file)
@@ -82,7 +82,7 @@ void genericUnwind(VM* vm, ExecState* callFrame, UnwindStart unwindStart)
         catchRoutine = catchPCForInterpreter->u.pointer;
 #endif
     } else
-        catchRoutine = LLInt::getExecutableAddress(handleUncaughtException);
+        catchRoutine = LLInt::getCodePtr<ExceptionHandlerPtrTag>(handleUncaughtException).executableAddress();
     
     ASSERT(bitwise_cast<uintptr_t>(callFrame) < bitwise_cast<uintptr_t>(vm->topEntryFrame));
 
index 5602437..6005653 100644 (file)
@@ -62,11 +62,9 @@ public:
     {
     }
 
-    // FIXME: These should be tagged with JSInternalPtrTag instead of JSEntryTag.
-    // https://bugs.webkit.org/show_bug.cgi?id=184712
-    CodeLocationLabel<JSEntryPtrTag> doneLocation() { return m_inlineStart.labelAtOffset(m_inlineSize); }
-    CodeLocationLabel<JSEntryPtrTag> slowPathStartLocation() { return m_inlineStart.labelAtOffset(m_deltaFromStartToSlowPathStart); }
-    CodeLocationCall<JSEntryPtrTag> slowPathCallLocation() { return m_inlineStart.callAtOffset(m_deltaFromStartToSlowPathCallLocation); }
+    CodeLocationLabel<JSInternalPtrTag> doneLocation() { return m_inlineStart.labelAtOffset(m_inlineSize); }
+    CodeLocationLabel<JSInternalPtrTag> slowPathStartLocation() { return m_inlineStart.labelAtOffset(m_deltaFromStartToSlowPathStart); }
+    CodeLocationCall<JSInternalPtrTag> slowPathCallLocation() { return m_inlineStart.callAtOffset(m_deltaFromStartToSlowPathCallLocation); }
     
     bool generateInline(CCallHelpers& jit, MathICGenerationState& state, bool shouldEmitProfiling = true)
     {
@@ -223,7 +221,7 @@ public:
 
     void finalizeInlineCode(const MathICGenerationState& state, LinkBuffer& linkBuffer)
     {
-        CodeLocationLabel<JSEntryPtrTag> start = linkBuffer.locationOf<JSEntryPtrTag>(state.fastPathStart);
+        CodeLocationLabel<JSInternalPtrTag> start = linkBuffer.locationOf<JSInternalPtrTag>(state.fastPathStart);
         m_inlineStart = start;
 
         m_inlineSize = MacroAssembler::differenceBetweenCodePtr(
@@ -253,9 +251,7 @@ public:
     ArithProfile* m_arithProfile;
     Instruction* m_instruction;
     MacroAssemblerCodeRef<JITStubRoutinePtrTag> m_code;
-    // FIXME: These should be tagged with JSInternalPtrTag instead of JSEntryTag.
-    // https://bugs.webkit.org/show_bug.cgi?id=184712
-    CodeLocationLabel<JSEntryPtrTag> m_inlineStart;
+    CodeLocationLabel<JSInternalPtrTag> m_inlineStart;
     int32_t m_inlineSize;
     int32_t m_deltaFromStartToSlowPathCallLocation;
     int32_t m_deltaFromStartToSlowPathStart;
index 57f3c2b..c93d15c 100644 (file)
@@ -58,41 +58,12 @@ void initialize()
 #else // ENABLE(JIT)
     llint_entry(&Data::s_opcodeMap);
 
-    for (int i = 0; i < NUMBER_OF_BYTECODE_IDS; ++i)
+    for (int i = 0; i < numOpcodeIDs; ++i)
         Data::s_opcodeMap[i] = tagCodePtr(Data::s_opcodeMap[i], BytecodePtrTag);
 
-    static const PtrTag tagsForOpcode[] = {
-        // FIXME: These should be tagged with JSInternalPtrTag instead of JSEntryTag.
-        // https://bugs.webkit.org/show_bug.cgi?id=184712
-        JSEntryPtrTag, // llint_program_prologue
-        JSEntryPtrTag, // llint_eval_prologue
-        JSEntryPtrTag, // llint_module_program_prologue
-        JSEntryPtrTag, // llint_function_for_call_prologue
-        JSEntryPtrTag, // llint_function_for_construct_prologue
-        JSEntryPtrTag, // llint_function_for_call_arity_check
-        JSEntryPtrTag, // llint_function_for_construct_arity_check
-        JSEntryPtrTag, // llint_generic_return_point
-        BytecodePtrTag, // llint_throw_from_slow_path_trampoline
-        ExceptionHandlerPtrTag, // llint_throw_during_call_trampoline
-        JSEntryPtrTag, // llint_native_call_trampoline
-        JSEntryPtrTag, // llint_native_construct_trampoline
-        JSEntryPtrTag, // llint_internal_function_call_trampoline
-        JSEntryPtrTag, // llint_internal_function_construct_trampoline
-        ExceptionHandlerPtrTag, // handleUncaughtException
-    };
-
-    static_assert(sizeof(tagsForOpcode) / sizeof(tagsForOpcode[0]) == NUMBER_OF_BYTECODE_HELPER_IDS, "");
-    static_assert(static_cast<uintptr_t>(llint_program_prologue) == NUMBER_OF_BYTECODE_IDS, "");
-
-    for (int i = 0; i < NUMBER_OF_BYTECODE_HELPER_IDS; ++i) {
-        int opcodeID = i + NUMBER_OF_BYTECODE_IDS;
-        Data::s_opcodeMap[opcodeID] = tagCodePtr(Data::s_opcodeMap[opcodeID], tagsForOpcode[i]);
-    }
-
-    void* handler = LLInt::getExecutableAddress(llint_throw_from_slow_path_trampoline);
+    void* handler = Data::s_opcodeMap[llint_throw_from_slow_path_trampoline];
     for (int i = 0; i < maxOpcodeLength + 1; ++i)
         Data::s_exceptionInstructions[i].u.pointer = handler;
-
 #endif // ENABLE(JIT)
 }
 
index 8ba7c03..e2db45d 100644 (file)
@@ -80,16 +80,12 @@ inline Opcode getOpcode(OpcodeID id)
 #endif
 }
 
-ALWAYS_INLINE void* getExecutableAddress(OpcodeID opcodeID)
-{
-    ASSERT(opcodeID >= NUMBER_OF_BYTECODE_IDS);
-    return reinterpret_cast<void*>(getOpcode(opcodeID));
-}
-
 template<PtrTag tag>
 ALWAYS_INLINE MacroAssemblerCodePtr<tag> getCodePtr(OpcodeID opcodeID)
 {
-    return MacroAssemblerCodePtr<tag>::createFromExecutableAddress(getOpcode(opcodeID));
+    void* address = getOpcode(opcodeID);
+    address = retagCodePtr<BytecodePtrTag, tag>(address);
+    return MacroAssemblerCodePtr<tag>::createFromExecutableAddress(address);
 }
 
 template<PtrTag tag>
index bc0d5b2..b45484b 100644 (file)
@@ -58,7 +58,7 @@ void* callToThrow(ExecState* exec)
     auto scope = DECLARE_THROW_SCOPE(*vm);
     dataLog("Throwing exception ", JSValue(scope.exception()), " (callToThrow).\n");
 #endif
-    return LLInt::getExecutableAddress(llint_throw_during_call_trampoline);
+    return LLInt::getCodePtr<ExceptionHandlerPtrTag>(llint_throw_during_call_trampoline).executableAddress();
 }
 
 } } // namespace JSC::LLInt
index 50a89ee..88bcbc9 100644 (file)
@@ -1636,7 +1636,7 @@ LLINT_SLOW_PATH_DECL(slow_path_call_eval)
     execCallee->setArgumentCountIncludingThis(pc[3].u.operand);
     execCallee->setCallerFrame(exec);
     execCallee->uncheckedR(CallFrameSlot::callee) = calleeAsValue;
-    execCallee->setReturnPC(LLInt::getExecutableAddress(llint_generic_return_point));
+    execCallee->setReturnPC(LLInt::getCodePtr<JSEntryPtrTag>(llint_generic_return_point).executableAddress());
     execCallee->setCodeBlock(0);
     exec->setCurrentVPC(pc);
     
index 3ffec3a..96ca6fe 100644 (file)
@@ -654,9 +654,9 @@ Expected<MacroAssemblerCodeRef<WasmEntryPtrTag>, BindingFailure> wasmToJS(VM* vm
         return makeUnexpected(BindingFailure::OutOfMemory);
 
     patchBuffer.link(slowCall, FunctionPtr<JITThunkPtrTag>(vm->getCTIStub(linkCallThunkGenerator).code()));
-    CodeLocationLabel<JSEntryPtrTag> callReturnLocation(patchBuffer.locationOfNearCall<JSEntryPtrTag>(slowCall));
-    CodeLocationLabel<JSEntryPtrTag> hotPathBegin(patchBuffer.locationOf<JSEntryPtrTag>(targetToCheck));
-    CodeLocationNearCall<JSEntryPtrTag> hotPathOther = patchBuffer.locationOfNearCall<JSEntryPtrTag>(fastCall);
+    CodeLocationLabel<JSInternalPtrTag> callReturnLocation(patchBuffer.locationOfNearCall<JSInternalPtrTag>(slowCall));
+    CodeLocationLabel<JSInternalPtrTag> hotPathBegin(patchBuffer.locationOf<JSInternalPtrTag>(targetToCheck));
+    CodeLocationNearCall<JSInternalPtrTag> hotPathOther = patchBuffer.locationOfNearCall<JSInternalPtrTag>(fastCall);
     callLinkInfo->setCallLocations(callReturnLocation, hotPathBegin, hotPathOther);
 
     return FINALIZE_CODE(patchBuffer, WasmEntryPtrTag, "WebAssembly->JavaScript import[%i] %s", importIndex, signature.toString().ascii().data());