Title: [268077] trunk/Source/_javascript_Core
Revision
268077
Author
[email protected]
Date
2020-10-06 15:04:36 -0700 (Tue, 06 Oct 2020)

Log Message

[JSC] More consistent PtrTagging for code types
https://bugs.webkit.org/show_bug.cgi?id=217362

Reviewed by Mark Lam.

1. Avoid tagging JIT code with OperationPtrTag. OperationPtrTag should be used only for operations (C++ code).
2. Avoid mixing JIT and C++ code for the same tagged pointers. For exception trampoline, in JIT mode, we should have
   JIT trampoline thunk which goes to LLInt bytecode handler code.

* bytecode/BytecodeList.rb:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::finishCreation):
(JSC::CodeBlock::finalizeUnconditionally):
* dfg/DFGCapabilities.cpp:
(JSC::DFG::capabilityLevel):
* dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::compileExceptionHandlers):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compileMathIC):
* jit/ICStats.h:
* jit/JIT.cpp:
(JSC::JIT::compileWithoutLinking):
(JSC::JIT::link):
(JSC::JIT::privateCompileExceptionHandlers):
* jit/JIT.h:
(JSC::CallRecord::CallRecord):
* jit/JITCall.cpp:
(JSC::JIT::compileTailCall):
(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):
* jit/JITCall32_64.cpp:
(JSC::JIT::compileOpCall):
(JSC::JIT::compileOpCallSlowCase):
* jit/JITExceptions.cpp:
(JSC::genericUnwind):
* jit/JITInlines.h:
(JSC::JIT::emitNakedNearCall):
(JSC::JIT::emitNakedNearTailCall):
(JSC::JIT::emitNakedCall): Deleted.
(JSC::JIT::emitNakedTailCall): Deleted.
* jit/JITPropertyAccess.cpp:
(JSC::JIT::privateCompilePutByVal):
(JSC::JIT::privateCompilePutPrivateNameWithCachedId):
(JSC::JIT::privateCompilePutByValWithCachedId):
* jit/SlowPathCall.h:
(JSC::JITSlowPathCall::call):
* llint/LLIntData.h:
(JSC::LLInt::getWide16CodeRef):
(JSC::LLInt::getWide32CodeRef):
(JSC::LLInt::getCodeFunctionPtr):
(JSC::LLInt::getWide16CodeFunctionPtr):
(JSC::LLInt::getWide32CodeFunctionPtr):
* llint/LLIntEntrypoint.cpp:
(JSC::LLInt::setFunctionEntrypoint):
(JSC::LLInt::setEvalEntrypoint):
(JSC::LLInt::setProgramEntrypoint):
(JSC::LLInt::setModuleProgramEntrypoint):
* llint/LLIntExceptions.cpp:
(JSC::LLInt::callToThrow):
(JSC::LLInt::handleUncaughtException):
(JSC::LLInt::catcher):
* llint/LLIntExceptions.h:
* llint/LLIntSlowPaths.cpp:
* llint/LLIntThunks.cpp:
(JSC::LLInt::generateThunkWithJumpTo):
(JSC::LLInt::functionForCallEntryThunk):
(JSC::LLInt::functionForConstructEntryThunk):
(JSC::LLInt::functionForCallArityCheckThunk):
(JSC::LLInt::functionForConstructArityCheckThunk):
(JSC::LLInt::evalEntryThunk):
(JSC::LLInt::programEntryThunk):
(JSC::LLInt::moduleProgramEntryThunk):
(JSC::LLInt::wasmFunctionEntryThunk):
(JSC::LLInt::callToThrowThunk):
(JSC::LLInt::handleUncaughtExceptionThunk):
(JSC::LLInt::catcherThunk):
* llint/LLIntThunks.h:
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* runtime/SamplingProfiler.cpp:
(JSC::SamplingProfiler::processUnverifiedStackTraces):
* wasm/WasmOperations.cpp:
(JSC::Wasm::JSC_DEFINE_JIT_OPERATION):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (268076 => 268077)


--- trunk/Source/_javascript_Core/ChangeLog	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/ChangeLog	2020-10-06 22:04:36 UTC (rev 268077)
@@ -1,3 +1,89 @@
+2020-10-05  Yusuke Suzuki  <[email protected]>
+
+        [JSC] More consistent PtrTagging for code types
+        https://bugs.webkit.org/show_bug.cgi?id=217362
+
+        Reviewed by Mark Lam.
+
+        1. Avoid tagging JIT code with OperationPtrTag. OperationPtrTag should be used only for operations (C++ code).
+        2. Avoid mixing JIT and C++ code for the same tagged pointers. For exception trampoline, in JIT mode, we should have
+           JIT trampoline thunk which goes to LLInt bytecode handler code.
+
+        * bytecode/BytecodeList.rb:
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::finishCreation):
+        (JSC::CodeBlock::finalizeUnconditionally):
+        * dfg/DFGCapabilities.cpp:
+        (JSC::DFG::capabilityLevel):
+        * dfg/DFGJITCompiler.cpp:
+        (JSC::DFG::JITCompiler::compileExceptionHandlers):
+        * dfg/DFGSpeculativeJIT.cpp:
+        (JSC::DFG::SpeculativeJIT::compileMathIC):
+        * jit/ICStats.h:
+        * jit/JIT.cpp:
+        (JSC::JIT::compileWithoutLinking):
+        (JSC::JIT::link):
+        (JSC::JIT::privateCompileExceptionHandlers):
+        * jit/JIT.h:
+        (JSC::CallRecord::CallRecord):
+        * jit/JITCall.cpp:
+        (JSC::JIT::compileTailCall):
+        (JSC::JIT::compileOpCall):
+        (JSC::JIT::compileOpCallSlowCase):
+        * jit/JITCall32_64.cpp:
+        (JSC::JIT::compileOpCall):
+        (JSC::JIT::compileOpCallSlowCase):
+        * jit/JITExceptions.cpp:
+        (JSC::genericUnwind):
+        * jit/JITInlines.h:
+        (JSC::JIT::emitNakedNearCall):
+        (JSC::JIT::emitNakedNearTailCall):
+        (JSC::JIT::emitNakedCall): Deleted.
+        (JSC::JIT::emitNakedTailCall): Deleted.
+        * jit/JITPropertyAccess.cpp:
+        (JSC::JIT::privateCompilePutByVal):
+        (JSC::JIT::privateCompilePutPrivateNameWithCachedId):
+        (JSC::JIT::privateCompilePutByValWithCachedId):
+        * jit/SlowPathCall.h:
+        (JSC::JITSlowPathCall::call):
+        * llint/LLIntData.h:
+        (JSC::LLInt::getWide16CodeRef):
+        (JSC::LLInt::getWide32CodeRef):
+        (JSC::LLInt::getCodeFunctionPtr):
+        (JSC::LLInt::getWide16CodeFunctionPtr):
+        (JSC::LLInt::getWide32CodeFunctionPtr):
+        * llint/LLIntEntrypoint.cpp:
+        (JSC::LLInt::setFunctionEntrypoint):
+        (JSC::LLInt::setEvalEntrypoint):
+        (JSC::LLInt::setProgramEntrypoint):
+        (JSC::LLInt::setModuleProgramEntrypoint):
+        * llint/LLIntExceptions.cpp:
+        (JSC::LLInt::callToThrow):
+        (JSC::LLInt::handleUncaughtException):
+        (JSC::LLInt::catcher):
+        * llint/LLIntExceptions.h:
+        * llint/LLIntSlowPaths.cpp:
+        * llint/LLIntThunks.cpp:
+        (JSC::LLInt::generateThunkWithJumpTo):
+        (JSC::LLInt::functionForCallEntryThunk):
+        (JSC::LLInt::functionForConstructEntryThunk):
+        (JSC::LLInt::functionForCallArityCheckThunk):
+        (JSC::LLInt::functionForConstructArityCheckThunk):
+        (JSC::LLInt::evalEntryThunk):
+        (JSC::LLInt::programEntryThunk):
+        (JSC::LLInt::moduleProgramEntryThunk):
+        (JSC::LLInt::wasmFunctionEntryThunk):
+        (JSC::LLInt::callToThrowThunk):
+        (JSC::LLInt::handleUncaughtExceptionThunk):
+        (JSC::LLInt::catcherThunk):
+        * llint/LLIntThunks.h:
+        * llint/LowLevelInterpreter32_64.asm:
+        * llint/LowLevelInterpreter64.asm:
+        * runtime/SamplingProfiler.cpp:
+        (JSC::SamplingProfiler::processUnverifiedStackTraces):
+        * wasm/WasmOperations.cpp:
+        (JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
+
 2020-10-05  Ross Kirsling  <[email protected]>
 
         %TypedArray%.from must do mapping and putting in lockstep

Modified: trunk/Source/_javascript_Core/bytecode/BytecodeList.rb (268076 => 268077)


--- trunk/Source/_javascript_Core/bytecode/BytecodeList.rb	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/bytecode/BytecodeList.rb	2020-10-06 22:04:36 UTC (rev 268077)
@@ -1405,7 +1405,7 @@
 op :checkpoint_osr_exit_trampoline
 op :fuzzer_return_early_from_loop_hint
 op :llint_get_host_call_return_value
-op :handleUncaughtException
+op :llint_handle_uncaught_exception
 op :op_call_return_location
 op :op_construct_return_location
 op :op_call_varargs_slow_return_location

Modified: trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/bytecode/CodeBlock.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -64,6 +64,7 @@
 #include "JSTemplateObjectDescriptor.h"
 #include "LLIntData.h"
 #include "LLIntEntrypoint.h"
+#include "LLIntExceptions.h"
 #include "LLIntPrototypeLoadAdaptiveStructureWatchpoint.h"
 #include "MetadataTable.h"
 #include "ModuleProgramCodeBlock.h"
@@ -431,8 +432,7 @@
                 HandlerInfo& handler = m_rareData->m_exceptionHandlers[i];
 #if ENABLE(JIT)
                 auto& instruction = *instructions().at(unlinkedHandler.target).ptr();
-                MacroAssemblerCodePtr<BytecodePtrTag> codePtr = LLInt::getCodePtr<BytecodePtrTag>(instruction);
-                handler.initialize(unlinkedHandler, CodeLocationLabel<ExceptionHandlerPtrTag>(codePtr.retagged<ExceptionHandlerPtrTag>()));
+                handler.initialize(unlinkedHandler, CodeLocationLabel<ExceptionHandlerPtrTag>(LLInt::handleCatch(instruction.width()).code()));
 #else
                 handler.initialize(unlinkedHandler);
 #endif
@@ -1502,8 +1502,7 @@
                         const UnlinkedHandlerInfo& unlinkedHandler = m_unlinkedCode->exceptionHandler(i);
                         HandlerInfo& handler = m_rareData->m_exceptionHandlers[i];
                         auto& instruction = *instructions().at(unlinkedHandler.target).ptr();
-                        MacroAssemblerCodePtr<BytecodePtrTag> codePtr = LLInt::getCodePtr<BytecodePtrTag>(instruction);
-                        handler.initialize(unlinkedHandler, CodeLocationLabel<ExceptionHandlerPtrTag>(codePtr.retagged<ExceptionHandlerPtrTag>()));
+                        handler.initialize(unlinkedHandler, CodeLocationLabel<ExceptionHandlerPtrTag>(LLInt::handleCatch(instruction.width()).code()));
                     }
 
                     unlinkIncomingCalls();

Modified: trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/dfg/DFGCapabilities.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -317,9 +317,9 @@
     case llint_internal_function_call_trampoline:
     case llint_internal_function_construct_trampoline:
     case llint_get_host_call_return_value:
+    case llint_handle_uncaught_exception:
     case checkpoint_osr_exit_from_inlined_call_trampoline:
     case checkpoint_osr_exit_trampoline:
-    case handleUncaughtException:
     case fuzzer_return_early_from_loop_hint:
     case op_iterator_open_return_location:
     case op_iterator_next_return_location:

Modified: trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/dfg/DFGJITCompiler.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -141,7 +141,7 @@
         prepareCallOperation(vm());
         addPtr(TrustedImm32(m_graph.stackPointerOffset() * sizeof(Register)), GPRInfo::callFrameRegister, stackPointerRegister);
 
-        m_calls.append(CallLinkRecord(call(OperationPtrTag), FunctionPtr<OperationPtrTag>(operationLookupExceptionHandlerFromCallerFrame)));
+        appendCall(operationLookupExceptionHandlerFromCallerFrame);
 
         jumpToExceptionHandler(vm());
     }
@@ -155,7 +155,7 @@
         move(TrustedImmPtr(&vm()), GPRInfo::argumentGPR0);
         prepareCallOperation(vm());
 
-        m_calls.append(CallLinkRecord(call(OperationPtrTag), FunctionPtr<OperationPtrTag>(operationLookupExceptionHandler)));
+        appendCall(operationLookupExceptionHandler);
 
         jumpToExceptionHandler(vm());
     }

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -4526,7 +4526,7 @@
             }
 
             if (addICGenerationState->shouldSlowPathRepatch)
-                addICGenerationState->slowPathCall = callOperation(bitwise_cast<J_JITOperation_GJJMic>(repatchingFunction), resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), innerLeftRegs, innerRightRegs, TrustedImmPtr(mathIC));
+                addICGenerationState->slowPathCall = callOperation(repatchingFunction, resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), innerLeftRegs, innerRightRegs, TrustedImmPtr(mathIC));
             else
                 addICGenerationState->slowPathCall = callOperation(nonRepatchingFunction, resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), innerLeftRegs, innerRightRegs);
 
@@ -5144,7 +5144,7 @@
             silentSpill(savePlans);
 
             if (icGenerationState->shouldSlowPathRepatch)
-                icGenerationState->slowPathCall = callOperation(bitwise_cast<J_JITOperation_GJMic>(repatchingFunction), resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), childRegs, TrustedImmPtr(mathIC));
+                icGenerationState->slowPathCall = callOperation(repatchingFunction, resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), childRegs, TrustedImmPtr(mathIC));
             else
                 icGenerationState->slowPathCall = callOperation(nonRepatchingFunction, resultRegs, TrustedImmPtr::weakPointer(m_graph, m_graph.globalObjectFor(node->origin.semantic)), childRegs);
 

Modified: trunk/Source/_javascript_Core/jit/ICStats.h (268076 => 268077)


--- trunk/Source/_javascript_Core/jit/ICStats.h	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/jit/ICStats.h	2020-10-06 22:04:36 UTC (rev 268077)
@@ -53,7 +53,6 @@
     macro(OperationGetByIdWithThisOptimize) \
     macro(OperationGenericIn) \
     macro(OperationInById) \
-    macro(OperationInByIdGeneric) \
     macro(OperationInByIdOptimize) \
     macro(OperationPutByIdStrict) \
     macro(OperationPutByIdNonStrict) \
@@ -65,8 +64,6 @@
     macro(OperationPutByIdDirectNonStrictOptimize) \
     macro(OperationPutByIdStrictBuildList) \
     macro(OperationPutByIdNonStrictBuildList) \
-    macro(OperationPutByIdDirectStrictBuildList) \
-    macro(OperationPutByIdDirectNonStrictBuildList) \
     macro(OperationPutByIdDefinePrivateFieldFieldStrictOptimize) \
     macro(OperationPutByIdPutPrivateFieldFieldStrictOptimize) \
     macro(PutByIdAddAccessCase) \

Modified: trunk/Source/_javascript_Core/jit/JIT.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/jit/JIT.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/jit/JIT.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -802,7 +802,7 @@
             addPtr(TrustedImm32(maxFrameExtentForSlowPathCall), stackPointerRegister);
         branchTest32(Zero, returnValueGPR).linkTo(beginLabel, this);
         move(returnValueGPR, GPRInfo::argumentGPR0);
-        emitNakedCall(m_vm->getCTIStub(arityFixupGenerator).retaggedCode<NoPtrTag>());
+        emitNakedNearCall(m_vm->getCTIStub(arityFixupGenerator).retaggedCode<NoPtrTag>());
 
 #if ASSERT_ENABLED
         m_bytecodeIndex = BytecodeIndex(); // Reset this, in order to guard its use with ASSERTs.
@@ -882,10 +882,15 @@
         handler.nativeCode = patchBuffer.locationOf<ExceptionHandlerPtrTag>(m_labels[handler.target]);
     }
 
-    for (auto& record : m_calls) {
+
+    for (auto& record : m_nearCalls) {
         if (record.callee)
             patchBuffer.link(record.from, record.callee);
     }
+    for (auto& record : m_farCalls) {
+        if (record.callee)
+            patchBuffer.link(record.from, record.callee);
+    }
     
     finalizeInlineCaches(m_getByIds, patchBuffer);
     finalizeInlineCaches(m_getByVals, patchBuffer);
@@ -996,7 +1001,7 @@
         // operationLookupExceptionHandlerFromCallerFrame is passed one argument, the VM*.
         move(TrustedImmPtr(&vm()), GPRInfo::argumentGPR0);
         prepareCallOperation(vm());
-        m_calls.append(CallRecord(call(OperationPtrTag), BytecodeIndex(), FunctionPtr<OperationPtrTag>(operationLookupExceptionHandlerFromCallerFrame)));
+        m_farCalls.append(FarCallRecord(call(OperationPtrTag), BytecodeIndex(), FunctionPtr<OperationPtrTag>(operationLookupExceptionHandlerFromCallerFrame)));
         jumpToExceptionHandler(vm());
     }
 
@@ -1009,7 +1014,7 @@
         // operationLookupExceptionHandler is passed one argument, the VM*.
         move(TrustedImmPtr(&vm()), GPRInfo::argumentGPR0);
         prepareCallOperation(vm());
-        m_calls.append(CallRecord(call(OperationPtrTag), BytecodeIndex(), FunctionPtr<OperationPtrTag>(operationLookupExceptionHandler)));
+        m_farCalls.append(FarCallRecord(call(OperationPtrTag), BytecodeIndex(), FunctionPtr<OperationPtrTag>(operationLookupExceptionHandler)));
         jumpToExceptionHandler(vm());
     }
 }

Modified: trunk/Source/_javascript_Core/jit/JIT.h (268076 => 268077)


--- trunk/Source/_javascript_Core/jit/JIT.h	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/jit/JIT.h	2020-10-06 22:04:36 UTC (rev 268077)
@@ -74,16 +74,17 @@
     struct OpPutPrivateName;
     struct OpPutToScope;
 
+    template<PtrTag tag>
     struct CallRecord {
         MacroAssembler::Call from;
         BytecodeIndex bytecodeIndex;
-        FunctionPtr<OperationPtrTag> callee;
+        FunctionPtr<tag> callee;
 
         CallRecord()
         {
         }
 
-        CallRecord(MacroAssembler::Call from, BytecodeIndex bytecodeIndex, FunctionPtr<OperationPtrTag> callee)
+        CallRecord(MacroAssembler::Call from, BytecodeIndex bytecodeIndex, FunctionPtr<tag> callee)
             : from(from)
             , bytecodeIndex(bytecodeIndex)
             , callee(callee)
@@ -91,6 +92,9 @@
         }
     };
 
+    using FarCallRecord = CallRecord<OperationPtrTag>;
+    using NearCallRecord = CallRecord<JSInternalPtrTag>;
+
     struct JumpTable {
         MacroAssembler::Jump from;
         unsigned toBytecodeOffset;
@@ -286,7 +290,7 @@
         Call appendCall(const FunctionPtr<CFunctionPtrTag> function)
         {
             Call functionCall = call(OperationPtrTag);
-            m_calls.append(CallRecord(functionCall, m_bytecodeIndex, function.retagged<OperationPtrTag>()));
+            m_farCalls.append(FarCallRecord(functionCall, m_bytecodeIndex, function.retagged<OperationPtrTag>()));
             return functionCall;
         }
 
@@ -294,7 +298,7 @@
         Call appendCallWithSlowPathReturnType(const FunctionPtr<CFunctionPtrTag> function)
         {
             Call functionCall = callWithSlowPathReturnType(OperationPtrTag);
-            m_calls.append(CallRecord(functionCall, m_bytecodeIndex, function.retagged<OperationPtrTag>()));
+            m_farCalls.append(FarCallRecord(functionCall, m_bytecodeIndex, function.retagged<OperationPtrTag>()));
             return functionCall;
         }
 #endif
@@ -900,8 +904,8 @@
 
         void updateTopCallFrame();
 
-        Call emitNakedCall(CodePtr<NoPtrTag> function = CodePtr<NoPtrTag>());
-        Call emitNakedTailCall(CodePtr<NoPtrTag> function = CodePtr<NoPtrTag>());
+        Call emitNakedNearCall(CodePtr<NoPtrTag> function = CodePtr<NoPtrTag>());
+        Call emitNakedNearTailCall(CodePtr<NoPtrTag> function = CodePtr<NoPtrTag>());
 
         // Loads the character value of a single character string into dst.
         void emitLoadCharacterString(RegisterID src, RegisterID dst, JumpList& failures);
@@ -961,7 +965,8 @@
 
         Interpreter* m_interpreter;
 
-        Vector<CallRecord> m_calls;
+        Vector<FarCallRecord> m_farCalls;
+        Vector<NearCallRecord> m_nearCalls;
         Vector<Label> m_labels;
         HashMap<BytecodeIndex, Label> m_checkpointLabels;
         Vector<JITGetByIdGenerator> m_getByIds;

Modified: trunk/Source/_javascript_Core/jit/JITCall.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/jit/JITCall.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/jit/JITCall.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -193,7 +193,7 @@
     shuffleData.setupCalleeSaveRegisters(m_codeBlock);
     info->setFrameShuffleData(shuffleData);
     CallFrameShuffler(*this, shuffleData).prepareForTailCall();
-    m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedTailCall();
+    m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedNearTailCall();
     return true;
 }
 
@@ -249,11 +249,11 @@
     if (opcodeID == op_tail_call_varargs || opcodeID == op_tail_call_forward_arguments) {
         emitRestoreCalleeSaves();
         prepareForTailCallSlow();
-        m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedTailCall();
+        m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedNearTailCall();
         return;
     }
 
-    m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
+    m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedNearCall();
 
     addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, stackPointerRegister);
     checkStackPointerAlignment();
@@ -278,7 +278,7 @@
     move(TrustedImmPtr(m_callCompilationInfo[callLinkInfoIndex].callLinkInfo), regT2);
 
     m_callCompilationInfo[callLinkInfoIndex].callReturnLocation =
-        emitNakedCall(m_vm->getCTIStub(linkCallThunkGenerator).retaggedCode<NoPtrTag>());
+        emitNakedNearCall(m_vm->getCTIStub(linkCallThunkGenerator).retaggedCode<NoPtrTag>());
 
     if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs) {
         abortWithReason(JITDidReturnFromTailCall);

Modified: trunk/Source/_javascript_Core/jit/JITCall32_64.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/jit/JITCall32_64.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -324,11 +324,11 @@
     checkStackPointerAlignment();
     if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs || opcodeID == op_tail_call_forward_arguments) {
         prepareForTailCallSlow();
-        m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedTailCall();
+        m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedNearTailCall();
         return;
     }
 
-    m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedCall();
+    m_callCompilationInfo[callLinkInfoIndex].hotPathOther = emitNakedNearCall();
 
     addPtr(TrustedImm32(stackPointerOffsetFor(m_codeBlock) * sizeof(Register)), callFrameRegister, stackPointerRegister);
     checkStackPointerAlignment();
@@ -355,7 +355,7 @@
     if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs || opcodeID == op_tail_call_forward_arguments)
         emitRestoreCalleeSaves();
 
-    m_callCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedCall(m_vm->getCTIStub(linkCallThunkGenerator).retaggedCode<NoPtrTag>());
+    m_callCompilationInfo[callLinkInfoIndex].callReturnLocation = emitNakedNearCall(m_vm->getCTIStub(linkCallThunkGenerator).retaggedCode<NoPtrTag>());
 
     if (opcodeID == op_tail_call || opcodeID == op_tail_call_varargs) {
         abortWithReason(JITDidReturnFromTailCall);

Modified: trunk/Source/_javascript_Core/jit/JITExceptions.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/jit/JITExceptions.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/jit/JITExceptions.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -32,6 +32,7 @@
 #include "Interpreter.h"
 #include "JSCJSValueInlines.h"
 #include "LLIntData.h"
+#include "LLIntExceptions.h"
 #include "Opcode.h"
 #include "ShadowChicken.h"
 #include "VMInlines.h"
@@ -77,7 +78,7 @@
             catchRoutine = LLInt::getCodePtr(catchPCForInterpreter->opcodeID());
 #endif
     } else
-        catchRoutine = LLInt::getCodePtr<ExceptionHandlerPtrTag>(handleUncaughtException).executableAddress();
+        catchRoutine = LLInt::handleUncaughtException(vm).code().executableAddress();
 
     ASSERT(bitwise_cast<uintptr_t>(callFrame) < bitwise_cast<uintptr_t>(vm.topEntryFrame));
 

Modified: trunk/Source/_javascript_Core/jit/JITInlines.h (268076 => 268077)


--- trunk/Source/_javascript_Core/jit/JITInlines.h	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/jit/JITInlines.h	2020-10-06 22:04:36 UTC (rev 268077)
@@ -89,19 +89,19 @@
     done.link(this);
 }
 
-ALWAYS_INLINE JIT::Call JIT::emitNakedCall(CodePtr<NoPtrTag> target)
+ALWAYS_INLINE JIT::Call JIT::emitNakedNearCall(CodePtr<NoPtrTag> target)
 {
     ASSERT(m_bytecodeIndex); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
     Call nakedCall = nearCall();
-    m_calls.append(CallRecord(nakedCall, m_bytecodeIndex, FunctionPtr<OperationPtrTag>(target.retagged<OperationPtrTag>())));
+    m_nearCalls.append(NearCallRecord(nakedCall, m_bytecodeIndex, FunctionPtr<JSInternalPtrTag>(target.retagged<JSInternalPtrTag>())));
     return nakedCall;
 }
 
-ALWAYS_INLINE JIT::Call JIT::emitNakedTailCall(CodePtr<NoPtrTag> target)
+ALWAYS_INLINE JIT::Call JIT::emitNakedNearTailCall(CodePtr<NoPtrTag> target)
 {
     ASSERT(m_bytecodeIndex); // This method should only be called during hot/cold path generation, so that m_bytecodeIndex is set.
     Call nakedCall = nearTailCall();
-    m_calls.append(CallRecord(nakedCall, m_bytecodeIndex, FunctionPtr<OperationPtrTag>(target.retagged<OperationPtrTag>())));
+    m_nearCalls.append(NearCallRecord(nakedCall, m_bytecodeIndex, FunctionPtr<JSInternalPtrTag>(target.retagged<JSInternalPtrTag>())));
     return nakedCall;
 }
 

Modified: trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/jit/JITPropertyAccess.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -1491,8 +1491,8 @@
     patchBuffer.link(slowCases, byValInfo->slowPathTarget);
     patchBuffer.link(done, byValInfo->doneTarget);
     if (needsLinkForWriteBarrier) {
-        ASSERT(removeCodePtrTag(m_calls.last().callee.executableAddress()) == removeCodePtrTag(operationWriteBarrierSlowPath));
-        patchBuffer.link(m_calls.last().from, m_calls.last().callee);
+        ASSERT(removeCodePtrTag(m_farCalls.last().callee.executableAddress()) == removeCodePtrTag(operationWriteBarrierSlowPath));
+        patchBuffer.link(m_farCalls.last().from, m_farCalls.last().callee);
     }
     
     bool isDirect = currentInstruction->opcodeID() == op_put_by_val_direct;
@@ -1531,10 +1531,14 @@
     if (!m_exceptionChecks.empty())
         patchBuffer.link(m_exceptionChecks, byValInfo->exceptionHandler);
 
-    for (const auto& callSite : m_calls) {
+    for (const auto& callSite : m_nearCalls) {
         if (callSite.callee)
             patchBuffer.link(callSite.from, callSite.callee);
     }
+    for (const auto& callSite : m_farCalls) {
+        if (callSite.callee)
+            patchBuffer.link(callSite.from, callSite.callee);
+    }
     gen.finalize(patchBuffer, patchBuffer);
 
     byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB(
@@ -1565,10 +1569,14 @@
     if (!m_exceptionChecks.empty())
         patchBuffer.link(m_exceptionChecks, byValInfo->exceptionHandler);
 
-    for (const auto& callSite : m_calls) {
+    for (const auto& callSite : m_nearCalls) {
         if (callSite.callee)
             patchBuffer.link(callSite.from, callSite.callee);
     }
+    for (const auto& callSite : m_farCalls) {
+        if (callSite.callee)
+            patchBuffer.link(callSite.from, callSite.callee);
+    }
     gen.finalize(patchBuffer, patchBuffer);
 
     byValInfo->stubRoutine = FINALIZE_CODE_FOR_STUB(

Modified: trunk/Source/_javascript_Core/jit/SlowPathCall.h (268076 => 268077)


--- trunk/Source/_javascript_Core/jit/SlowPathCall.h	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/jit/SlowPathCall.h	2020-10-06 22:04:36 UTC (rev 268077)
@@ -58,8 +58,7 @@
         m_jit->move(JIT::callFrameRegister, JIT::argumentGPR0);
         m_jit->move(JIT::TrustedImmPtr(m_pc), JIT::argumentGPR1);
 #endif
-        JIT::Call call = m_jit->call(OperationPtrTag);
-        m_jit->m_calls.append(CallRecord(call, m_jit->m_bytecodeIndex, FunctionPtr<OperationPtrTag>(m_slowPathFunction)));
+        JIT::Call call = m_jit->appendCall(m_slowPathFunction);
 
 #if CPU(X86_64) && OS(WINDOWS)
         m_jit->pop(JIT::regT0); // vPC

Modified: trunk/Source/_javascript_Core/llint/LLIntData.h (268076 => 268077)


--- trunk/Source/_javascript_Core/llint/LLIntData.h	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/llint/LLIntData.h	2020-10-06 22:04:36 UTC (rev 268077)
@@ -161,11 +161,22 @@
     return MacroAssemblerCodeRef<tag>::createSelfManagedCodeRef(getCodePtr<tag>(opcodeID));
 }
 
+template<PtrTag tag>
+ALWAYS_INLINE MacroAssemblerCodeRef<tag> getWide16CodeRef(OpcodeID opcodeID)
+{
+    return MacroAssemblerCodeRef<tag>::createSelfManagedCodeRef(getWide16CodePtr<tag>(opcodeID));
+}
+
+template<PtrTag tag>
+ALWAYS_INLINE MacroAssemblerCodeRef<tag> getWide32CodeRef(OpcodeID opcodeID)
+{
+    return MacroAssemblerCodeRef<tag>::createSelfManagedCodeRef(getWide32CodePtr<tag>(opcodeID));
+}
+
 #if ENABLE(JIT)
 template<PtrTag tag>
 ALWAYS_INLINE LLIntCode getCodeFunctionPtr(OpcodeID opcodeID)
 {
-    ASSERT(opcodeID >= NUMBER_OF_BYTECODE_IDS);
 #if COMPILER(MSVC)
     return reinterpret_cast<LLIntCode>(getCodePtr<tag>(opcodeID).executableAddress());
 #else
@@ -173,7 +184,27 @@
 #endif
 }
 
+template<PtrTag tag>
+ALWAYS_INLINE LLIntCode getWide16CodeFunctionPtr(OpcodeID opcodeID)
+{
+#if COMPILER(MSVC)
+    return reinterpret_cast<LLIntCode>(getWide16CodePtr<tag>(opcodeID).executableAddress());
 #else
+    return reinterpret_cast<LLIntCode>(getWide16CodePtr<tag>(opcodeID).template executableAddress());
+#endif
+}
+
+template<PtrTag tag>
+ALWAYS_INLINE LLIntCode getWide32CodeFunctionPtr(OpcodeID opcodeID)
+{
+#if COMPILER(MSVC)
+    return reinterpret_cast<LLIntCode>(getWide32CodePtr<tag>(opcodeID).executableAddress());
+#else
+    return reinterpret_cast<LLIntCode>(getWide32CodePtr<tag>(opcodeID).template executableAddress());
+#endif
+}
+
+#else
 ALWAYS_INLINE void* getCodePtr(OpcodeID id)
 {
     return reinterpret_cast<void*>(getOpcode(id));

Modified: trunk/Source/_javascript_Core/llint/LLIntEntrypoint.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/llint/LLIntEntrypoint.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/llint/LLIntEntrypoint.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -45,9 +45,9 @@
             static DirectJITCode* jitCode;
             static std::once_flag onceKey;
             std::call_once(onceKey, [&] {
-                auto callRef = functionForCallEntryThunk().retagged<JSEntryPtrTag>();
-                auto callArityCheckRef = functionForCallArityCheckThunk().retaggedCode<JSEntryPtrTag>();
-                jitCode = new DirectJITCode(callRef, callArityCheckRef, JITType::InterpreterThunk, JITCode::ShareAttribute::Shared);
+                auto callRef = functionForCallEntryThunk();
+                auto callArityCheckRef = functionForCallArityCheckThunk();
+                jitCode = new DirectJITCode(callRef, callArityCheckRef.code(), JITType::InterpreterThunk, JITCode::ShareAttribute::Shared);
             });
 
             codeBlock->setJITCode(makeRef(*jitCode));
@@ -58,9 +58,9 @@
         static DirectJITCode* jitCode;
         static std::once_flag onceKey;
         std::call_once(onceKey, [&] {
-            auto constructRef = functionForConstructEntryThunk().retagged<JSEntryPtrTag>();
-            auto constructArityCheckRef = functionForConstructArityCheckThunk().retaggedCode<JSEntryPtrTag>();
-            jitCode = new DirectJITCode(constructRef, constructArityCheckRef, JITType::InterpreterThunk, JITCode::ShareAttribute::Shared);
+            auto constructRef = functionForConstructEntryThunk();
+            auto constructArityCheckRef = functionForConstructArityCheckThunk();
+            jitCode = new DirectJITCode(constructRef, constructArityCheckRef.code(), JITType::InterpreterThunk, JITCode::ShareAttribute::Shared);
         });
 
         codeBlock->setJITCode(makeRef(*jitCode));
@@ -92,7 +92,7 @@
         static NativeJITCode* jitCode;
         static std::once_flag onceKey;
         std::call_once(onceKey, [&] {
-            MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = evalEntryThunk().retagged<JSEntryPtrTag>();
+            MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = evalEntryThunk();
             jitCode = new NativeJITCode(codeRef, JITType::InterpreterThunk, Intrinsic::NoIntrinsic, JITCode::ShareAttribute::Shared);
         });
         codeBlock->setJITCode(makeRef(*jitCode));
@@ -115,7 +115,7 @@
         static NativeJITCode* jitCode;
         static std::once_flag onceKey;
         std::call_once(onceKey, [&] {
-            MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = programEntryThunk().retagged<JSEntryPtrTag>();
+            MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = programEntryThunk();
             jitCode = new NativeJITCode(codeRef, JITType::InterpreterThunk, Intrinsic::NoIntrinsic, JITCode::ShareAttribute::Shared);
         });
         codeBlock->setJITCode(makeRef(*jitCode));
@@ -138,7 +138,7 @@
         static NativeJITCode* jitCode;
         static std::once_flag onceKey;
         std::call_once(onceKey, [&] {
-            MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = moduleProgramEntryThunk().retagged<JSEntryPtrTag>();
+            MacroAssemblerCodeRef<JSEntryPtrTag> codeRef = moduleProgramEntryThunk();
             jitCode = new NativeJITCode(codeRef, JITType::InterpreterThunk, Intrinsic::NoIntrinsic, JITCode::ShareAttribute::Shared);
         });
         codeBlock->setJITCode(makeRef(*jitCode));

Modified: trunk/Source/_javascript_Core/llint/LLIntExceptions.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/llint/LLIntExceptions.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/llint/LLIntExceptions.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -48,7 +48,7 @@
     return LLInt::exceptionInstructions();
 }
 
-void* callToThrow(VM& vm)
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> callToThrow(VM& vm)
 {
     UNUSED_PARAM(vm);
 #if LLINT_TRACING
@@ -57,7 +57,38 @@
         dataLog("Throwing exception ", JSValue(scope.exception()), " (callToThrow).\n");
     }
 #endif
-    return LLInt::getCodePtr<ExceptionHandlerPtrTag>(llint_throw_during_call_trampoline).executableAddress();
+#if ENABLE(JIT)
+    if (Options::useJIT())
+        return LLInt::callToThrowThunk();
+#endif
+    return LLInt::getCodeRef<ExceptionHandlerPtrTag>(llint_throw_during_call_trampoline);
 }
 
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleUncaughtException(VM&)
+{
+#if ENABLE(JIT)
+    if (Options::useJIT())
+        return handleUncaughtExceptionThunk();
+#endif
+    return LLInt::getCodeRef<ExceptionHandlerPtrTag>(llint_handle_uncaught_exception);
+}
+
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleCatch(OpcodeSize size)
+{
+#if ENABLE(JIT)
+    if (Options::useJIT())
+        return handleCatchThunk(size);
+#endif
+    switch (size) {
+    case OpcodeSize::Narrow:
+        return LLInt::getCodeRef<ExceptionHandlerPtrTag>(op_catch);
+    case OpcodeSize::Wide16:
+        return LLInt::getWide16CodeRef<ExceptionHandlerPtrTag>(op_catch);
+    case OpcodeSize::Wide32:
+        return LLInt::getWide32CodeRef<ExceptionHandlerPtrTag>(op_catch);
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+    return {};
+}
+
 } } // namespace JSC::LLInt

Modified: trunk/Source/_javascript_Core/llint/LLIntExceptions.h (268076 => 268077)


--- trunk/Source/_javascript_Core/llint/LLIntExceptions.h	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/llint/LLIntExceptions.h	2020-10-06 22:04:36 UTC (rev 268077)
@@ -41,6 +41,9 @@
 Instruction* returnToThrow(VM&);
 
 // Use this when you're throwing to a call thunk.
-void* callToThrow(VM&);
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> callToThrow(VM&);
 
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleUncaughtException(VM&);
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleCatch(OpcodeSize);
+
 } } // namespace JSC::LLInt

Modified: trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/llint/LLIntSlowPaths.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -160,7 +160,7 @@
 #define LLINT_CALL_THROW(globalObject, exceptionToThrow) do {                   \
         JSGlobalObject* __ct_globalObject = (globalObject);                                  \
         throwException(__ct_globalObject, throwScope, exceptionToThrow);        \
-        LLINT_CALL_END_IMPL(nullptr, callToThrow(vm), ExceptionHandlerPtrTag);                 \
+        LLINT_CALL_END_IMPL(nullptr, callToThrow(vm).code().executableAddress(), ExceptionHandlerPtrTag);                 \
     } while (false)
 
 #define LLINT_CALL_CHECK_EXCEPTION(globalObject) do {               \
@@ -167,7 +167,7 @@
         JSGlobalObject* __cce_globalObject = (globalObject);                                 \
         doExceptionFuzzingIfEnabled(__cce_globalObject, throwScope, "LLIntSlowPaths/call", nullptr); \
         if (UNLIKELY(throwScope.exception()))                           \
-            LLINT_CALL_END_IMPL(nullptr, callToThrow(vm), ExceptionHandlerPtrTag); \
+            LLINT_CALL_END_IMPL(nullptr, callToThrow(vm).code().executableAddress(), ExceptionHandlerPtrTag); \
     } while (false)
 
 #define LLINT_CALL_RETURN(globalObject, calleeFrame, callTarget, callTargetTag) do { \

Modified: trunk/Source/_javascript_Core/llint/LLIntThunks.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/llint/LLIntThunks.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/llint/LLIntThunks.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -47,12 +47,11 @@
 // fits on 32-bits, and that's not the case of getCodeRef(llint_function_for_call_prologue)
 // and others LLIntEntrypoints.
 
-static MacroAssemblerCodeRef<JITThunkPtrTag> generateThunkWithJumpTo(OpcodeID opcodeID, const char *thunkKind)
+template<PtrTag tag>
+static MacroAssemblerCodeRef<tag> generateThunkWithJumpTo(LLIntCode target, const char *thunkKind)
 {
     JSInterfaceJIT jit;
 
-    // FIXME: there's probably a better way to do it on X86, but I'm not sure I care.
-    LLIntCode target = LLInt::getCodeFunctionPtr<JSEntryPtrTag>(opcodeID);
     assertIsTaggedWith(target, JSEntryPtrTag);
 
 #if ENABLE(WEBASSEMBLY)
@@ -64,75 +63,81 @@
     jit.farJump(scratch, JSEntryPtrTag);
 
     LinkBuffer patchBuffer(jit, GLOBAL_THUNK_ID);
-    return FINALIZE_CODE(patchBuffer, JITThunkPtrTag, "LLInt %s prologue thunk", thunkKind);
+    return FINALIZE_CODE(patchBuffer, tag, "LLInt %s prologue thunk", thunkKind);
 }
 
-MacroAssemblerCodeRef<JITThunkPtrTag> functionForCallEntryThunk()
+template<PtrTag tag>
+static MacroAssemblerCodeRef<tag> generateThunkWithJumpTo(OpcodeID opcodeID, const char *thunkKind)
 {
-    static LazyNeverDestroyed<MacroAssemblerCodeRef<JITThunkPtrTag>> codeRef;
+    return generateThunkWithJumpTo<tag>(LLInt::getCodeFunctionPtr<JSEntryPtrTag>(opcodeID), thunkKind);
+}
+
+MacroAssemblerCodeRef<JSEntryPtrTag> functionForCallEntryThunk()
+{
+    static LazyNeverDestroyed<MacroAssemblerCodeRef<JSEntryPtrTag>> codeRef;
     static std::once_flag onceKey;
     std::call_once(onceKey, [&] {
-        codeRef.construct(generateThunkWithJumpTo(llint_function_for_call_prologue, "function for call"));
+        codeRef.construct(generateThunkWithJumpTo<JSEntryPtrTag>(llint_function_for_call_prologue, "function for call"));
     });
     return codeRef;
 }
 
-MacroAssemblerCodeRef<JITThunkPtrTag> functionForConstructEntryThunk()
+MacroAssemblerCodeRef<JSEntryPtrTag> functionForConstructEntryThunk()
 {
-    static LazyNeverDestroyed<MacroAssemblerCodeRef<JITThunkPtrTag>> codeRef;
+    static LazyNeverDestroyed<MacroAssemblerCodeRef<JSEntryPtrTag>> codeRef;
     static std::once_flag onceKey;
     std::call_once(onceKey, [&] {
-        codeRef.construct(generateThunkWithJumpTo(llint_function_for_construct_prologue, "function for construct"));
+        codeRef.construct(generateThunkWithJumpTo<JSEntryPtrTag>(llint_function_for_construct_prologue, "function for construct"));
     });
     return codeRef;
 }
 
-MacroAssemblerCodeRef<JITThunkPtrTag> functionForCallArityCheckThunk()
+MacroAssemblerCodeRef<JSEntryPtrTag> functionForCallArityCheckThunk()
 {
-    static LazyNeverDestroyed<MacroAssemblerCodeRef<JITThunkPtrTag>> codeRef;
+    static LazyNeverDestroyed<MacroAssemblerCodeRef<JSEntryPtrTag>> codeRef;
     static std::once_flag onceKey;
     std::call_once(onceKey, [&] {
-        codeRef.construct(generateThunkWithJumpTo(llint_function_for_call_arity_check, "function for call with arity check"));
+        codeRef.construct(generateThunkWithJumpTo<JSEntryPtrTag>(llint_function_for_call_arity_check, "function for call with arity check"));
     });
     return codeRef;
 }
 
-MacroAssemblerCodeRef<JITThunkPtrTag> functionForConstructArityCheckThunk()
+MacroAssemblerCodeRef<JSEntryPtrTag> functionForConstructArityCheckThunk()
 {
-    static LazyNeverDestroyed<MacroAssemblerCodeRef<JITThunkPtrTag>> codeRef;
+    static LazyNeverDestroyed<MacroAssemblerCodeRef<JSEntryPtrTag>> codeRef;
     static std::once_flag onceKey;
     std::call_once(onceKey, [&] {
-        codeRef.construct(generateThunkWithJumpTo(llint_function_for_construct_arity_check, "function for construct with arity check"));
+        codeRef.construct(generateThunkWithJumpTo<JSEntryPtrTag>(llint_function_for_construct_arity_check, "function for construct with arity check"));
     });
     return codeRef;
 }
 
-MacroAssemblerCodeRef<JITThunkPtrTag> evalEntryThunk()
+MacroAssemblerCodeRef<JSEntryPtrTag> evalEntryThunk()
 {
-    static LazyNeverDestroyed<MacroAssemblerCodeRef<JITThunkPtrTag>> codeRef;
+    static LazyNeverDestroyed<MacroAssemblerCodeRef<JSEntryPtrTag>> codeRef;
     static std::once_flag onceKey;
     std::call_once(onceKey, [&] {
-        codeRef.construct(generateThunkWithJumpTo(llint_eval_prologue, "eval"));
+        codeRef.construct(generateThunkWithJumpTo<JSEntryPtrTag>(llint_eval_prologue, "eval"));
     });
     return codeRef;
 }
 
-MacroAssemblerCodeRef<JITThunkPtrTag> programEntryThunk()
+MacroAssemblerCodeRef<JSEntryPtrTag> programEntryThunk()
 {
-    static LazyNeverDestroyed<MacroAssemblerCodeRef<JITThunkPtrTag>> codeRef;
+    static LazyNeverDestroyed<MacroAssemblerCodeRef<JSEntryPtrTag>> codeRef;
     static std::once_flag onceKey;
     std::call_once(onceKey, [&] {
-        codeRef.construct(generateThunkWithJumpTo(llint_program_prologue, "program"));
+        codeRef.construct(generateThunkWithJumpTo<JSEntryPtrTag>(llint_program_prologue, "program"));
     });
     return codeRef;
 }
 
-MacroAssemblerCodeRef<JITThunkPtrTag> moduleProgramEntryThunk()
+MacroAssemblerCodeRef<JSEntryPtrTag> moduleProgramEntryThunk()
 {
-    static LazyNeverDestroyed<MacroAssemblerCodeRef<JITThunkPtrTag>> codeRef;
+    static LazyNeverDestroyed<MacroAssemblerCodeRef<JSEntryPtrTag>> codeRef;
     static std::once_flag onceKey;
     std::call_once(onceKey, [&] {
-        codeRef.construct(generateThunkWithJumpTo(llint_module_program_prologue, "module_program"));
+        codeRef.construct(generateThunkWithJumpTo<JSEntryPtrTag>(llint_module_program_prologue, "module_program"));
     });
     return codeRef;
 }
@@ -144,9 +149,9 @@
     static std::once_flag onceKey;
     std::call_once(onceKey, [&] {
         if (Wasm::Context::useFastTLS())
-            codeRef.construct(generateThunkWithJumpTo(wasm_function_prologue, "function for call"));
+            codeRef.construct(generateThunkWithJumpTo<JITThunkPtrTag>(wasm_function_prologue, "function for call"));
         else
-            codeRef.construct(generateThunkWithJumpTo(wasm_function_prologue_no_tls, "function for call"));
+            codeRef.construct(generateThunkWithJumpTo<JITThunkPtrTag>(wasm_function_prologue_no_tls, "function for call"));
     });
     return codeRef;
 }
@@ -185,6 +190,58 @@
     return codeRef;
 }
 
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> callToThrowThunk()
+{
+    static LazyNeverDestroyed<MacroAssemblerCodeRef<ExceptionHandlerPtrTag>> codeRef;
+    static std::once_flag onceKey;
+    std::call_once(onceKey, [&] {
+        codeRef.construct(generateThunkWithJumpTo<ExceptionHandlerPtrTag>(llint_throw_during_call_trampoline, "LLInt::callToThrow thunk"));
+    });
+    return codeRef;
+}
+
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleUncaughtExceptionThunk()
+{
+    static LazyNeverDestroyed<MacroAssemblerCodeRef<ExceptionHandlerPtrTag>> codeRef;
+    static std::once_flag onceKey;
+    std::call_once(onceKey, [&] {
+        codeRef.construct(generateThunkWithJumpTo<ExceptionHandlerPtrTag>(llint_handle_uncaught_exception, "handle_uncaught_exception"));
+    });
+    return codeRef;
+}
+
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleCatchThunk(OpcodeSize size)
+{
+    switch (size) {
+    case OpcodeSize::Narrow: {
+        static LazyNeverDestroyed<MacroAssemblerCodeRef<ExceptionHandlerPtrTag>> codeRef;
+        static std::once_flag onceKey;
+        std::call_once(onceKey, [&] {
+            codeRef.construct(generateThunkWithJumpTo<ExceptionHandlerPtrTag>(LLInt::getCodeFunctionPtr<JSEntryPtrTag>(op_catch), "op_catch"));
+        });
+        return codeRef;
+    }
+    case OpcodeSize::Wide16: {
+        static LazyNeverDestroyed<MacroAssemblerCodeRef<ExceptionHandlerPtrTag>> codeRef;
+        static std::once_flag onceKey;
+        std::call_once(onceKey, [&] {
+            codeRef.construct(generateThunkWithJumpTo<ExceptionHandlerPtrTag>(LLInt::getWide16CodeFunctionPtr<JSEntryPtrTag>(op_catch), "op_catch16"));
+        });
+        return codeRef;
+    }
+    case OpcodeSize::Wide32: {
+        static LazyNeverDestroyed<MacroAssemblerCodeRef<ExceptionHandlerPtrTag>> codeRef;
+        static std::once_flag onceKey;
+        std::call_once(onceKey, [&] {
+            codeRef.construct(generateThunkWithJumpTo<ExceptionHandlerPtrTag>(LLInt::getWide32CodeFunctionPtr<JSEntryPtrTag>(op_catch), "op_catch32"));
+        });
+        return codeRef;
+    }
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+    return { };
+}
+
 } // namespace LLInt
 
 #endif // ENABLE(JIT)

Modified: trunk/Source/_javascript_Core/llint/LLIntThunks.h (268076 => 268077)


--- trunk/Source/_javascript_Core/llint/LLIntThunks.h	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/llint/LLIntThunks.h	2020-10-06 22:04:36 UTC (rev 268077)
@@ -50,15 +50,19 @@
 
 namespace LLInt {
 
-MacroAssemblerCodeRef<JITThunkPtrTag> functionForCallEntryThunk();
-MacroAssemblerCodeRef<JITThunkPtrTag> functionForConstructEntryThunk();
-MacroAssemblerCodeRef<JITThunkPtrTag> functionForCallArityCheckThunk();
-MacroAssemblerCodeRef<JITThunkPtrTag> functionForConstructArityCheckThunk();
-MacroAssemblerCodeRef<JITThunkPtrTag> evalEntryThunk();
-MacroAssemblerCodeRef<JITThunkPtrTag> programEntryThunk();
-MacroAssemblerCodeRef<JITThunkPtrTag> moduleProgramEntryThunk();
+MacroAssemblerCodeRef<JSEntryPtrTag> functionForCallEntryThunk();
+MacroAssemblerCodeRef<JSEntryPtrTag> functionForConstructEntryThunk();
+MacroAssemblerCodeRef<JSEntryPtrTag> functionForCallArityCheckThunk();
+MacroAssemblerCodeRef<JSEntryPtrTag> functionForConstructArityCheckThunk();
+MacroAssemblerCodeRef<JSEntryPtrTag> evalEntryThunk();
+MacroAssemblerCodeRef<JSEntryPtrTag> programEntryThunk();
+MacroAssemblerCodeRef<JSEntryPtrTag> moduleProgramEntryThunk();
 MacroAssemblerCodeRef<JSEntryPtrTag> getHostCallReturnValueThunk();
 
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> callToThrowThunk();
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleUncaughtExceptionThunk();
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleCatchThunk(OpcodeSize);
+
 #if ENABLE(WEBASSEMBLY)
 MacroAssemblerCodeRef<JITThunkPtrTag> wasmFunctionEntryThunk();
 #endif // ENABLE(WEBASSEMBLY)

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm (268076 => 268077)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter32_64.asm	2020-10-06 22:04:36 UTC (rev 268077)
@@ -390,7 +390,7 @@
     end
 end
 
-op(handleUncaughtException, macro()
+op(llint_handle_uncaught_exception, macro()
     loadp Callee + PayloadOffset[cfr], t3
     convertCalleeToVM(t3)
     restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer(t3, t0)

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (268076 => 268077)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2020-10-06 22:04:36 UTC (rev 268077)
@@ -331,7 +331,7 @@
     end
 end
 
-op(handleUncaughtException, macro ()
+op(llint_handle_uncaught_exception, macro ()
     loadp Callee[cfr], t3
     convertCalleeToVM(t3)
     restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer(t3, t0)

Modified: trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/runtime/SamplingProfiler.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -590,7 +590,7 @@
                 // This might also be false for various reasons (known and unknown), even though
                 // it's super unlikely. One reason that this can be false is when we throw from a DFG frame,
                 // and we end up having to unwind past an EntryFrame, we will end up executing
-                // inside the LLInt's handleUncaughtException. So we just protect against this
+                // inside the LLInt's llint_handle_ucaught_exception. So we just protect against this
                 // by ignoring it.
                 BytecodeIndex bytecodeIndex = BytecodeIndex(0);
                 if (topCodeBlock->jitType() == JITType::InterpreterThunk || topCodeBlock->jitType() == JITType::BaselineJIT) {

Modified: trunk/Source/_javascript_Core/wasm/WasmOperations.cpp (268076 => 268077)


--- trunk/Source/_javascript_Core/wasm/WasmOperations.cpp	2020-10-06 21:53:08 UTC (rev 268076)
+++ trunk/Source/_javascript_Core/wasm/WasmOperations.cpp	2020-10-06 22:04:36 UTC (rev 268077)
@@ -764,7 +764,7 @@
     ASSERT(!!vm.callFrameForCatch);
     ASSERT(!!vm.targetMachinePCForThrow);
     // FIXME: We could make this better:
-    // This is a total hack, but the llint (both op_catch and handleUncaughtException)
+    // This is a total hack, but the llint (both op_catch and llint_handle_uncaught_exception)
     // require a cell in the callee field to load the VM. (The baseline JIT does not require
     // this since it is compiled with a constant VM pointer.) We could make the calling convention
     // for exceptions first load callFrameForCatch info call frame register before jumping
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to