Log Message
Address post-landing feedback to wasm exceptions https://bugs.webkit.org/show_bug.cgi?id=231973
Reviewed by Saam Barati. Address comments left by Saam in https://bugs.webkit.org/show_bug.cgi?id=229681 after the patch landed. This includes deleting some unused code, and renaming a couple variables and methods, but the biggest change is copying the callee saves to VMEntry in the llint rethrow. * interpreter/Interpreter.cpp: (JSC::CatchInfo::CatchInfo): (JSC::UnwindFunctor::operator() const): * interpreter/Interpreter.h: (JSC::CatchInfo::CatchInfo): Deleted. * jit/JSInterfaceJIT.h: (JSC::JSInterfaceJIT::convertCalleeToVM): Deleted. * llint/WebAssembly.asm: * wasm/WasmB3IRGenerator.cpp: (JSC::Wasm::B3IRGenerator::ControlData::ControlData): (JSC::Wasm::B3IRGenerator::ControlData::tryDepth const): (JSC::Wasm::B3IRGenerator::connectControlAtEntrypoint): (JSC::Wasm::B3IRGenerator::addLoop): (JSC::Wasm::B3IRGenerator::addTry): (JSC::Wasm::B3IRGenerator::preparePatchpointForExceptions): (JSC::Wasm::B3IRGenerator::emitCatchImpl): (JSC::Wasm::B3IRGenerator::addDelegateToUnreachable): (JSC::Wasm::B3IRGenerator::addThrow): (JSC::Wasm::B3IRGenerator::addRethrow): (JSC::Wasm::B3IRGenerator::addEndToUnreachable): (JSC::Wasm::B3IRGenerator::connectControlEntry): Deleted. * wasm/WasmCallee.h: (JSC::Wasm::Callee::llintFunctionCodeBlock const): (JSC::Wasm::Callee::functionCodeBlock const): Deleted. * wasm/WasmLLIntGenerator.cpp: (JSC::Wasm::LLIntGenerator::unifyValuesWithBlock): (JSC::Wasm::LLIntGenerator::addTry): (JSC::Wasm::LLIntGenerator::addThrow): (JSC::Wasm::LLIntGenerator::repatch): Deleted. * wasm/WasmOperations.cpp: (JSC::Wasm::JSC_DEFINE_JIT_OPERATION): * wasm/WasmOperations.h:
Modified Paths
- trunk/Source/_javascript_Core/ChangeLog
- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp
- trunk/Source/_javascript_Core/interpreter/Interpreter.h
- trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h
- trunk/Source/_javascript_Core/llint/WebAssembly.asm
- trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp
- trunk/Source/_javascript_Core/wasm/WasmCallee.h
- trunk/Source/_javascript_Core/wasm/WasmLLIntGenerator.cpp
- trunk/Source/_javascript_Core/wasm/WasmOperations.cpp
- trunk/Source/_javascript_Core/wasm/WasmOperations.h
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (284512 => 284513)
--- trunk/Source/_javascript_Core/ChangeLog 2021-10-20 00:30:31 UTC (rev 284512)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-10-20 00:40:19 UTC (rev 284513)
@@ -1,3 +1,48 @@
+2021-10-19 Tadeu Zagallo <tzaga...@apple.com>
+
+ Address post-landing feedback to wasm exceptions
+ https://bugs.webkit.org/show_bug.cgi?id=231973
+
+ Reviewed by Saam Barati.
+
+ Address comments left by Saam in https://bugs.webkit.org/show_bug.cgi?id=229681
+ after the patch landed. This includes deleting some unused code, and renaming a
+ couple variables and methods, but the biggest change is copying the callee saves
+ to VMEntry in the llint rethrow.
+
+ * interpreter/Interpreter.cpp:
+ (JSC::CatchInfo::CatchInfo):
+ (JSC::UnwindFunctor::operator() const):
+ * interpreter/Interpreter.h:
+ (JSC::CatchInfo::CatchInfo): Deleted.
+ * jit/JSInterfaceJIT.h:
+ (JSC::JSInterfaceJIT::convertCalleeToVM): Deleted.
+ * llint/WebAssembly.asm:
+ * wasm/WasmB3IRGenerator.cpp:
+ (JSC::Wasm::B3IRGenerator::ControlData::ControlData):
+ (JSC::Wasm::B3IRGenerator::ControlData::tryDepth const):
+ (JSC::Wasm::B3IRGenerator::connectControlAtEntrypoint):
+ (JSC::Wasm::B3IRGenerator::addLoop):
+ (JSC::Wasm::B3IRGenerator::addTry):
+ (JSC::Wasm::B3IRGenerator::preparePatchpointForExceptions):
+ (JSC::Wasm::B3IRGenerator::emitCatchImpl):
+ (JSC::Wasm::B3IRGenerator::addDelegateToUnreachable):
+ (JSC::Wasm::B3IRGenerator::addThrow):
+ (JSC::Wasm::B3IRGenerator::addRethrow):
+ (JSC::Wasm::B3IRGenerator::addEndToUnreachable):
+ (JSC::Wasm::B3IRGenerator::connectControlEntry): Deleted.
+ * wasm/WasmCallee.h:
+ (JSC::Wasm::Callee::llintFunctionCodeBlock const):
+ (JSC::Wasm::Callee::functionCodeBlock const): Deleted.
+ * wasm/WasmLLIntGenerator.cpp:
+ (JSC::Wasm::LLIntGenerator::unifyValuesWithBlock):
+ (JSC::Wasm::LLIntGenerator::addTry):
+ (JSC::Wasm::LLIntGenerator::addThrow):
+ (JSC::Wasm::LLIntGenerator::repatch): Deleted.
+ * wasm/WasmOperations.cpp:
+ (JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
+ * wasm/WasmOperations.h:
+
2021-10-19 Alexey Proskuryakov <a...@apple.com>
Eagerly resolve python3 path in Makefiles
Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.cpp (284512 => 284513)
--- trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2021-10-20 00:30:31 UTC (rev 284512)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.cpp 2021-10-20 00:40:19 UTC (rev 284513)
@@ -542,7 +542,7 @@
if (m_valid) {
m_type = HandlerType::Catch;
m_nativeCode = handler->m_nativeCode;
- if (const Wasm::FunctionCodeBlock* codeBlock = callee->functionCodeBlock())
+ if (const Wasm::FunctionCodeBlock* codeBlock = callee->llintFunctionCodeBlock())
m_catchPCForInterpreter = codeBlock->instructions().at(handler->m_target).ptr();
else
m_catchPCForInterpreter = nullptr;
@@ -592,7 +592,6 @@
if (callee.isCell()) {
if (auto* jsToWasmICCallee = jsDynamicCast<JSToWasmICCallee*>(m_vm, callee.asCell()))
m_vm.wasmContext.store(jsToWasmICCallee->function()->previousInstance(m_callFrame), m_vm.softStackLimit());
-
}
if (m_catchableFromWasm && callee.isWasm()) {
Modified: trunk/Source/_javascript_Core/interpreter/Interpreter.h (284512 => 284513)
--- trunk/Source/_javascript_Core/interpreter/Interpreter.h 2021-10-20 00:30:31 UTC (rev 284512)
+++ trunk/Source/_javascript_Core/interpreter/Interpreter.h 2021-10-20 00:40:19 UTC (rev 284513)
@@ -90,9 +90,7 @@
};
struct CatchInfo {
- CatchInfo()
- : m_valid(false)
- { }
+ CatchInfo() = default;
CatchInfo(const HandlerInfo*, CodeBlock*);
#if ENABLE(WEBASSEMBLY)
@@ -99,7 +97,7 @@
CatchInfo(const Wasm::HandlerInfo*, const Wasm::Callee*);
#endif
- bool m_valid;
+ bool m_valid { false };
HandlerType m_type;
#if ENABLE(JIT)
MacroAssemblerCodePtr<ExceptionHandlerPtrTag> m_nativeCode;
Modified: trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h (284512 => 284513)
--- trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h 2021-10-20 00:30:31 UTC (rev 284512)
+++ trunk/Source/_javascript_Core/jit/JSInterfaceJIT.h 2021-10-20 00:40:19 UTC (rev 284513)
@@ -57,7 +57,6 @@
void emitPutToCallFrameHeader(RegisterID from, VirtualRegister entry);
void emitPutToCallFrameHeader(void* value, VirtualRegister entry);
void emitPutCellToCallFrameHeader(RegisterID from, VirtualRegister entry);
- void convertCalleeToVM(RegisterID callee);
VM* vm() const { return m_vm; }
@@ -159,19 +158,6 @@
#endif
}
- ALWAYS_INLINE void JSInterfaceJIT::convertCalleeToVM(RegisterID callee)
- {
- auto preciseAllocationCase = branchTestPtr(CCallHelpers::NonZero, callee, CCallHelpers::TrustedImm32(PreciseAllocation::halfAlignment));
- andPtr(CCallHelpers::TrustedImmPtr(MarkedBlock::blockMask), callee);
- loadPtr(CCallHelpers::Address(callee, MarkedBlock::offsetOfFooter + MarkedBlock::Footer::offsetOfVM()), callee);
- auto loadedCase = jump();
-
- preciseAllocationCase.link(this);
- loadPtr(CCallHelpers::Address(callee, PreciseAllocation::offsetOfWeakSet() + WeakSet::offsetOfVM() - PreciseAllocation::headerSize()), callee);
-
- loadedCase.link(this);
- }
-
} // namespace JSC
#endif // ENABLE(JIT)
Modified: trunk/Source/_javascript_Core/llint/WebAssembly.asm (284512 => 284513)
--- trunk/Source/_javascript_Core/llint/WebAssembly.asm 2021-10-20 00:30:31 UTC (rev 284512)
+++ trunk/Source/_javascript_Core/llint/WebAssembly.asm 2021-10-20 00:40:19 UTC (rev 284513)
@@ -2825,11 +2825,15 @@
end)
wasmOp(rethrow, WasmRethrow, macro(ctx)
+ loadp Wasm::Instance::m_pointerToTopEntryFrame[wasmInstance], t5
+ loadp [t5], t5
+ copyCalleeSavesToEntryFrameCalleeSavesBuffer(t5)
+
callWasmSlowPath(_slow_path_wasm_rethrow)
jumpToException()
end)
-macro catchImpl(ctx, storeWasmInstance)
+macro commonCatchImpl(ctx, storeWasmInstance)
loadp Callee[cfr], t3
convertCalleeToVM(t3)
restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer(t3, t0)
@@ -2854,6 +2858,17 @@
subp PB, PC
callWasmSlowPath(_slow_path_wasm_retrieve_and_clear_exception)
+end
+
+macro catchAllImpl(ctx, storeWasmInstance)
+ commonCatchImpl(ctx, storeWasmInstance)
+ traceExecution()
+ dispatch(ctx)
+end
+
+macro catchImpl(ctx, storeWasmInstance)
+ commonCatchImpl(ctx, storeWasmInstance)
+
move r1, t1
wgetu(ctx, m_startOffset, t2)
@@ -2875,7 +2890,6 @@
.done:
traceExecution()
-
dispatch(ctx)
end
@@ -2887,37 +2901,6 @@
catchImpl(ctx, macro(instance) end)
end)
-macro catchAllImpl(ctx, storeWasmInstance)
- loadp Callee[cfr], t3
- convertCalleeToVM(t3)
- restoreCalleeSavesFromVMEntryFrameCalleeSavesBuffer(t3, t0)
-
- loadp VM::calleeForWasmCatch[t3], ws1
- storep 0, VM::calleeForWasmCatch[t3]
- storep ws1, Callee[cfr]
-
- loadp VM::callFrameForCatch[t3], cfr
- storep 0, VM::callFrameForCatch[t3]
-
- restoreStackPointerAfterCall()
-
- loadp ThisArgumentOffset[cfr], wasmInstance
- loadp JSWebAssemblyInstance::m_instance[wasmInstance], wasmInstance
- storeWasmInstance(wasmInstance)
- reloadMemoryRegistersFromInstance(wasmInstance, ws0, ws1)
-
- loadp CodeBlock[cfr], PB
- loadp Wasm::FunctionCodeBlock::m_instructionsRawPointer[PB], PB
- loadp VM::targetInterpreterPCForThrow[t3], PC
- subp PB, PC
-
- callWasmSlowPath(_slow_path_wasm_retrieve_and_clear_exception)
-
- traceExecution()
-
- dispatch(ctx)
-end
-
commonWasmOp(wasm_catch_all, WasmCatchAll, macro() end, macro(ctx)
catchAllImpl(ctx, storeWasmInstanceToTLS)
end)
Modified: trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp (284512 => 284513)
--- trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp 2021-10-20 00:30:31 UTC (rev 284512)
+++ trunk/Source/_javascript_Core/wasm/WasmB3IRGenerator.cpp 2021-10-20 00:40:19 UTC (rev 284513)
@@ -128,10 +128,8 @@
, continuation(continuation)
, special(nullptr)
, m_tryStart(tryStart)
- , m_tryDepth(tryDepth)
+ , m_tryCatchDepth(tryDepth)
{
- UNUSED_PARAM(proc);
- UNUSED_PARAM(origin);
for (unsigned i = 0; i < signature->returnCount(); ++i)
phis.append(proc.add<Value>(Phi, toB3Type(signature->returnType(i)), origin));
}
@@ -250,7 +248,7 @@
unsigned tryDepth() const
{
ASSERT(controlBlockType == BlockType::Try || controlBlockType == BlockType::Catch);
- return m_tryDepth;
+ return m_tryCatchDepth;
}
CatchKind catchKind() const
@@ -279,7 +277,7 @@
Vector<Value*> phis;
unsigned m_tryStart;
unsigned m_tryEnd;
- unsigned m_tryDepth;
+ unsigned m_tryCatchDepth;
CatchKind m_catchKind;
Variable* m_exception;
};
@@ -463,7 +461,7 @@
void restoreWebAssemblyGlobalState(RestoreCachedStackLimit, const MemoryInformation&, Value* instance, Procedure&, BasicBlock*, bool restoreInstance = true);
Value* loadFromScratchBuffer(unsigned& indexInBuffer, Value* pointer, B3::Type);
- void connectControlEntry(unsigned& indexInBuffer, Value* pointer, ControlData&, Stack& expressionStack, ControlData& currentData, bool fillLoopPhis = false);
+ void connectControlAtEntrypoint(unsigned& indexInBuffer, Value* pointer, ControlData&, Stack& expressionStack, ControlData& currentData, bool fillLoopPhis = false);
Value* emitCatchImpl(CatchKind, ControlType&, unsigned exceptionIndex = 0);
PatchpointExceptionHandle preparePatchpointForExceptions(BasicBlock*, PatchpointValue*);
@@ -570,7 +568,7 @@
uint32_t m_maxNumJSCallArguments { 0 };
unsigned m_numImportFunctions;
- Checked<unsigned> m_tryDepth { 0 };
+ Checked<unsigned> m_tryCatchDepth { 0 };
Checked<unsigned> m_callSiteIndex { 0 };
Checked<unsigned> m_stackSize { 0 };
Checked<unsigned> m_maxStackSize { 0 };
@@ -2452,9 +2450,8 @@
return m_currentBlock->appendNew<MemoryValue>(m_proc, Load, type, origin(), pointer, offset);
}
-void B3IRGenerator::connectControlEntry(unsigned& indexInBuffer, Value* pointer, ControlData& data, Stack& expressionStack, ControlData& currentData, bool fillLoopPhis)
+void B3IRGenerator::connectControlAtEntrypoint(unsigned& indexInBuffer, Value* pointer, ControlData& data, Stack& expressionStack, ControlData& currentData, bool fillLoopPhis)
{
- // For each stack entry enclosed by this loop we need to replace the value with a phi so we can fill it on OSR entry.
for (unsigned i = 0; i < expressionStack.size(); i++) {
TypedExpression value = expressionStack[i];
auto* load = loadFromScratchBuffer(indexInBuffer, pointer, value->type());
@@ -2502,10 +2499,10 @@
for (unsigned controlIndex = 0; controlIndex < m_parser->controlStack().size(); ++controlIndex) {
auto& data = ""
auto& expressionStack = m_parser->controlStack()[controlIndex].enclosedExpressionStack;
- connectControlEntry(indexInBuffer, pointer, data, expressionStack, block);
+ connectControlAtEntrypoint(indexInBuffer, pointer, data, expressionStack, block);
}
- connectControlEntry(indexInBuffer, pointer, block, enclosingStack, block);
- connectControlEntry(indexInBuffer, pointer, block, newStack, block, true);
+ connectControlAtEntrypoint(indexInBuffer, pointer, block, enclosingStack, block);
+ connectControlAtEntrypoint(indexInBuffer, pointer, block, newStack, block, true);
m_osrEntryScratchBufferSize = indexInBuffer;
m_currentBlock->appendNewControlValue(m_proc, Jump, origin(), body);
@@ -2568,11 +2565,11 @@
auto B3IRGenerator::addTry(BlockSignature signature, Stack& enclosingStack, ControlType& result, Stack& newStack) -> PartialResult
{
- ++m_tryDepth;
+ ++m_tryCatchDepth;
BasicBlock* continuation = m_proc.addBlock();
splitStack(signature, enclosingStack, newStack);
- result = ControlData(m_proc, origin(), signature, BlockType::Try, m_stackSize, continuation, ++m_callSiteIndex, m_tryDepth);
+ result = ControlData(m_proc, origin(), signature, BlockType::Try, m_stackSize, continuation, ++m_callSiteIndex, m_tryCatchDepth);
return { };
}
@@ -2586,22 +2583,22 @@
PatchpointExceptionHandle B3IRGenerator::preparePatchpointForExceptions(BasicBlock* block, PatchpointValue* patch)
{
++m_callSiteIndex;
- if (!m_tryDepth)
+ if (!m_tryCatchDepth)
return { };
- Vector<Value*> stackmap;
+ Vector<Value*> liveValues;
Origin origin = this->origin();
for (Variable* local : m_locals) {
Value* result = block->appendNew<VariableValue>(m_proc, B3::Get, origin, local);
- stackmap.append(result);
+ liveValues.append(result);
}
for (unsigned controlIndex = 0; controlIndex < m_parser->controlStack().size(); ++controlIndex) {
ControlData& data = ""
Stack& expressionStack = m_parser->controlStack()[controlIndex].enclosedExpressionStack;
for (Variable* value : expressionStack)
- stackmap.append(get(block, value));
+ liveValues.append(get(block, value));
if (ControlType::isAnyCatch(data))
- stackmap.append(get(block, data.exception()));
+ liveValues.append(get(block, data.exception()));
}
unsigned offset = patch->numChildren();
@@ -2609,7 +2606,7 @@
offset++;
patch->effects.exitsSideways = true;
- patch->appendVectorWithRep(stackmap, ValueRep::LateColdAny);
+ patch->appendVectorWithRep(liveValues, ValueRep::LateColdAny);
return PatchpointExceptionHandle { m_callSiteIndex, offset };
}
@@ -2654,7 +2651,7 @@
}
HandlerType handlerType = kind == CatchKind::Catch ? HandlerType::Catch : HandlerType::CatchAll;
- m_exceptionHandlers.append({ handlerType, data.tryStart(), data.tryEnd(), 0, m_tryDepth, exceptionIndex });
+ m_exceptionHandlers.append({ handlerType, data.tryStart(), data.tryEnd(), 0, m_tryCatchDepth, exceptionIndex });
restoreWebAssemblyGlobalState(RestoreCachedStackLimit::Yes, m_info.memory, instanceValue(), m_proc, m_currentBlock, false);
@@ -2668,7 +2665,7 @@
for (unsigned controlIndex = 0; controlIndex < m_parser->controlStack().size(); ++controlIndex) {
auto& controlData = m_parser->controlStack()[controlIndex].controlData;
auto& expressionStack = m_parser->controlStack()[controlIndex].enclosedExpressionStack;
- connectControlEntry(indexInBuffer, pointer, controlData, expressionStack, data);
+ connectControlAtEntrypoint(indexInBuffer, pointer, controlData, expressionStack, data);
}
PatchpointValue* result = m_currentBlock->appendNew<PatchpointValue>(m_proc, m_proc.addTuple({ pointerType(), pointerType() }), origin());
@@ -2706,7 +2703,7 @@
if (ControlType::isTry(target))
targetDepth = target.tryDepth();
- m_exceptionHandlers.append({ HandlerType::Delegate, data.tryStart(), ++m_callSiteIndex, 0, m_tryDepth, targetDepth });
+ m_exceptionHandlers.append({ HandlerType::Delegate, data.tryStart(), ++m_callSiteIndex, 0, m_tryCatchDepth, targetDepth });
return { };
}
@@ -2718,16 +2715,11 @@
patch->append(framePointer(), ValueRep::reg(GPRInfo::argumentGPR1));
for (unsigned i = 0; i < args.size(); ++i)
patch->append(get(args[i]), ValueRep::stackArgument(i * sizeof(EncodedJSValue)));
- RegisterSet clobber = RegisterSet::macroScratchRegisters();
- clobber.add(GPRInfo::argumentGPR2);
- clobber.add(GPRInfo::argumentGPR3);
- patch->clobber(clobber);
- patch->clobberLate(RegisterSet::volatileRegistersForJSCall());
- patch->numGPScratchRegisters = 1;
+ patch->clobber(RegisterSet::volatileRegistersForJSCall());
PatchpointExceptionHandle handle = preparePatchpointForExceptions(m_currentBlock, patch);
patch->setGenerator([this, exceptionIndex, handle] (CCallHelpers& jit, const B3::StackmapGenerationParams& params) {
AllowMacroScratchRegisterUsage allowScratch(jit);
- GPRReg scratch = params.gpScratch(0);
+ GPRReg scratch = GPRInfo::nonPreservedNonArgumentGPR0;
handle.generate(jit, params, this);
jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0, Instance::offsetOfOwner()), scratch);
@@ -2760,21 +2752,16 @@
auto B3IRGenerator::addRethrow(unsigned, ControlType& data) -> PartialResult
{
PatchpointValue* patch = m_proc.add<PatchpointValue>(B3::Void, origin());
- patch->clobber(RegisterSet::macroScratchRegisters());
- RegisterSet clobberLate;
- clobberLate.add(GPRInfo::argumentGPR0);
- clobberLate.add(GPRInfo::argumentGPR1);
- clobberLate.add(GPRInfo::argumentGPR2);
+ patch->clobber(RegisterSet::volatileRegistersForJSCall());
patch->effects.terminal = true;
patch->append(instanceValue(), ValueRep::reg(GPRInfo::argumentGPR0));
patch->append(framePointer(), ValueRep::reg(GPRInfo::argumentGPR1));
patch->append(get(data.exception()), ValueRep::reg(GPRInfo::argumentGPR2));
- patch->numGPScratchRegisters = 1;
PatchpointExceptionHandle handle = preparePatchpointForExceptions(m_currentBlock, patch);
patch->setGenerator([this, handle] (CCallHelpers& jit, const B3::StackmapGenerationParams& params) {
AllowMacroScratchRegisterUsage allowScratch(jit);
- GPRReg scratch = params.gpScratch(0);
+ GPRReg scratch = GPRInfo::nonPreservedNonArgumentGPR0;
jit.loadPtr(CCallHelpers::Address(GPRInfo::argumentGPR0, Instance::offsetOfOwner()), scratch);
{
auto preciseAllocationCase = jit.branchTestPtr(CCallHelpers::NonZero, scratch, CCallHelpers::TrustedImm32(PreciseAllocation::halfAlignment));
@@ -2890,7 +2877,7 @@
data.special->appendNewControlValue(m_proc, Jump, origin(), m_currentBlock);
m_currentBlock->addPredecessor(data.special);
} else if (data.blockType() == BlockType::Try || data.blockType() == BlockType::Catch)
- --m_tryDepth;
+ --m_tryCatchDepth;
if (data.blockType() != BlockType::Loop) {
for (unsigned i = 0; i < data.signature()->returnCount(); ++i) {
Modified: trunk/Source/_javascript_Core/wasm/WasmCallee.h (284512 => 284513)
--- trunk/Source/_javascript_Core/wasm/WasmCallee.h 2021-10-20 00:30:31 UTC (rev 284512)
+++ trunk/Source/_javascript_Core/wasm/WasmCallee.h 2021-10-20 00:40:19 UTC (rev 284513)
@@ -74,7 +74,7 @@
void dump(PrintStream&) const;
- virtual FunctionCodeBlock* functionCodeBlock() const { return 0; }
+ virtual FunctionCodeBlock* llintFunctionCodeBlock() const { return nullptr; }
protected:
JS_EXPORT_PRIVATE Callee(Wasm::CompilationMode);
@@ -251,7 +251,7 @@
}
LLIntTierUpCounter& tierUpCounter() { return m_codeBlock->tierUpCounter(); }
- FunctionCodeBlock* functionCodeBlock() const final { return m_codeBlock.get(); }
+ FunctionCodeBlock* llintFunctionCodeBlock() const final { return m_codeBlock.get(); }
#endif
private:
Modified: trunk/Source/_javascript_Core/wasm/WasmLLIntGenerator.cpp (284512 => 284513)
--- trunk/Source/_javascript_Core/wasm/WasmLLIntGenerator.cpp 2021-10-20 00:30:31 UTC (rev 284512)
+++ trunk/Source/_javascript_Core/wasm/WasmLLIntGenerator.cpp 2021-10-20 00:40:19 UTC (rev 284513)
@@ -195,9 +195,6 @@
std::unique_ptr<FunctionCodeBlock> finalize();
- template<typename Opcode>
- void repatch(const CatchRewriteInfo&);
-
template<typename ExpressionListA, typename ExpressionListB>
void unifyValuesWithBlock(const ExpressionListA& destinations, const ExpressionListB& values)
{
@@ -206,7 +203,7 @@
for (size_t i = 0; i < destinations.size(); ++i) {
auto& src = "" + i];
auto& dst = destinations[i];
- if ((VirtualRegister)src != (VirtualRegister)dst)
+ if (static_cast<VirtualRegister>(src) != static_cast<VirtualRegister>(dst))
WasmMov::emit(this, dst, src);
}
}
@@ -500,7 +497,6 @@
Checked<unsigned> m_stackSize { 0 };
Checked<unsigned> m_maxStackSize { 0 };
Checked<unsigned> m_tryDepth { 0 };
- Checked<unsigned> m_maxTryDepth { 0 };
bool m_usesExceptions { false };
};
@@ -547,18 +543,6 @@
WasmEnter::emit(this);
}
-template<typename Opcode>
-void LLIntGenerator::repatch(const CatchRewriteInfo& info)
-{
- auto ref = m_writer.ref(info.m_instructionOffset);
- Opcode* instruction = ref->cast<Opcode, WasmOpcodeTraits>();
- VirtualRegister exceptionRegister = virtualRegisterForLocal(m_maxStackSize + info.m_tryDepth - 1);
- instruction->setException(exceptionRegister, []() {
- RELEASE_ASSERT_NOT_REACHED();
- return VirtualRegister();
- });
-}
-
std::unique_ptr<FunctionCodeBlock> LLIntGenerator::finalize()
{
RELEASE_ASSERT(m_codeBlock);
@@ -1061,8 +1045,6 @@
{
m_usesExceptions = true;
++m_tryDepth;
- if (m_maxTryDepth < m_tryDepth)
- m_maxTryDepth = m_tryDepth;
splitStack(signature, enclosingStack, newStack);
Ref<Label> tryLabel = newEmittedLabel();
@@ -1191,6 +1173,10 @@
auto LLIntGenerator::addThrow(unsigned exceptionIndex, Vector<ExpressionType>& args, Stack&) -> PartialResult
{
m_usesExceptions = true;
+ // We have to materialize the arguments here since it might include constants or
+ // delayed moves, but the wasm_throw opcode expects all the arguments to be contiguous
+ // in the stack. The reason we don't call materializeConstantsAndLocals here is that
+ // it expects a stack, not a vector of ExpressionType arguments.
walkExpressionStack(args, [&](VirtualRegister& arg, VirtualRegister slot) {
if (arg == slot)
return;
Modified: trunk/Source/_javascript_Core/wasm/WasmOperations.cpp (284512 => 284513)
--- trunk/Source/_javascript_Core/wasm/WasmOperations.cpp 2021-10-20 00:30:31 UTC (rev 284512)
+++ trunk/Source/_javascript_Core/wasm/WasmOperations.cpp 2021-10-20 00:40:19 UTC (rev 284513)
@@ -910,7 +910,7 @@
instance->dataDrop(dataSegmentIndex);
}
-JSC_DEFINE_JIT_OPERATION(operationWasmThrow, void*, (Instance* instance, CallFrame* callFrame, unsigned exceptionIndex, EncodedJSValue* arguments))
+JSC_DEFINE_JIT_OPERATION(operationWasmThrow, void*, (Instance* instance, CallFrame* callFrame, unsigned exceptionIndex, uint64_t* arguments))
{
instance->storeTopCallFrame(callFrame);
Modified: trunk/Source/_javascript_Core/wasm/WasmOperations.h (284512 => 284513)
--- trunk/Source/_javascript_Core/wasm/WasmOperations.h 2021-10-20 00:30:31 UTC (rev 284512)
+++ trunk/Source/_javascript_Core/wasm/WasmOperations.h 2021-10-20 00:40:19 UTC (rev 284513)
@@ -88,7 +88,7 @@
JSC_DECLARE_JIT_OPERATION(operationWasmMemoryInit, size_t, (Instance*, unsigned dataSegmentIndex, uint32_t dstAddress, uint32_t srcAddress, uint32_t length));
JSC_DECLARE_JIT_OPERATION(operationWasmDataDrop, void, (Instance*, unsigned dataSegmentIndex));
-JSC_DECLARE_JIT_OPERATION(operationWasmThrow, void*, (Instance*, CallFrame*, unsigned exceptionIndex, EncodedJSValue*));
+JSC_DECLARE_JIT_OPERATION(operationWasmThrow, void*, (Instance*, CallFrame*, unsigned exceptionIndex, uint64_t*));
JSC_DECLARE_JIT_OPERATION(operationWasmRethrow, void*, (Instance*, CallFrame*, EncodedJSValue thrownValue));
JSC_DECLARE_JIT_OPERATION(operationWasmToJSException, void*, (CallFrame*, Wasm::ExceptionType, Instance*));
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes