Commit cbc5169d authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Remove obsolete runtime stubs that just tail-call.

Now that all builtins are embedded, it is no longer needed to have a
fallback variant where WebAssembly runtime stubs tail-call existing
(non-embedded) builtins, just call the (embedded) builtin directly.

R=clemensb@chromium.org
BUG=v8:6666,v8:9810

Change-Id: Id8a2b2089cabc77f841f484986d8212ca2918ef4
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1883550
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#64581}
parent 14885d58
...@@ -949,17 +949,14 @@ namespace internal { ...@@ -949,17 +949,14 @@ namespace internal {
\ \
/* Wasm */ \ /* Wasm */ \
ASM(WasmCompileLazy, Dummy) \ ASM(WasmCompileLazy, Dummy) \
TFC(WasmAllocateHeapNumber, AllocateHeapNumber) \
TFC(WasmAtomicNotify, WasmAtomicNotify) \ TFC(WasmAtomicNotify, WasmAtomicNotify) \
TFC(WasmI32AtomicWait, WasmI32AtomicWait) \ TFC(WasmI32AtomicWait, WasmI32AtomicWait) \
TFC(WasmI64AtomicWait, WasmI64AtomicWait) \ TFC(WasmI64AtomicWait, WasmI64AtomicWait) \
TFC(WasmMemoryGrow, WasmMemoryGrow) \ TFC(WasmMemoryGrow, WasmMemoryGrow) \
TFC(WasmTableGet, WasmTableGet) \ TFC(WasmTableGet, WasmTableGet) \
TFC(WasmTableSet, WasmTableSet) \ TFC(WasmTableSet, WasmTableSet) \
TFC(WasmRecordWrite, RecordWrite) \
TFC(WasmStackGuard, NoContext) \ TFC(WasmStackGuard, NoContext) \
TFC(WasmStackOverflow, NoContext) \ TFC(WasmStackOverflow, NoContext) \
TFC(WasmToNumber, TypeConversion) \
TFC(WasmThrow, WasmThrow) \ TFC(WasmThrow, WasmThrow) \
TFC(WasmRethrow, WasmThrow) \ TFC(WasmRethrow, WasmThrow) \
TFS(ThrowWasmTrapUnreachable) \ TFS(ThrowWasmTrapUnreachable) \
...@@ -974,10 +971,6 @@ namespace internal { ...@@ -974,10 +971,6 @@ namespace internal {
TFS(ThrowWasmTrapDataSegmentDropped) \ TFS(ThrowWasmTrapDataSegmentDropped) \
TFS(ThrowWasmTrapElemSegmentDropped) \ TFS(ThrowWasmTrapElemSegmentDropped) \
TFS(ThrowWasmTrapTableOutOfBounds) \ TFS(ThrowWasmTrapTableOutOfBounds) \
TFC(WasmI64ToBigInt, I64ToBigInt) \
TFC(WasmI32PairToBigInt, I32PairToBigInt) \
TFC(WasmBigIntToI64, BigIntToI64) \
TFC(WasmBigIntToI32Pair, BigIntToI32Pair) \
\ \
/* WeakMap */ \ /* WeakMap */ \
TFJ(WeakMapConstructor, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \ TFJ(WeakMapConstructor, SharedFunctionInfo::kDontAdaptArgumentsSentinel) \
...@@ -1270,25 +1263,25 @@ namespace internal { ...@@ -1270,25 +1263,25 @@ namespace internal {
#define WASM_RUNTIME_STUB_LIST(V, VTRAP) \ #define WASM_RUNTIME_STUB_LIST(V, VTRAP) \
FOREACH_WASM_TRAPREASON(VTRAP) \ FOREACH_WASM_TRAPREASON(VTRAP) \
V(WasmCompileLazy) \ V(WasmCompileLazy) \
V(WasmAllocateHeapNumber) \
V(WasmAtomicNotify) \ V(WasmAtomicNotify) \
V(WasmI32AtomicWait) \ V(WasmI32AtomicWait) \
V(WasmI64AtomicWait) \ V(WasmI64AtomicWait) \
V(WasmMemoryGrow) \ V(WasmMemoryGrow) \
V(WasmTableGet) \ V(WasmTableGet) \
V(WasmTableSet) \ V(WasmTableSet) \
V(WasmRecordWrite) \
V(WasmStackGuard) \ V(WasmStackGuard) \
V(WasmStackOverflow) \ V(WasmStackOverflow) \
V(WasmToNumber) \
V(WasmThrow) \ V(WasmThrow) \
V(WasmRethrow) \ V(WasmRethrow) \
V(AllocateHeapNumber) \
V(ArgumentsAdaptorTrampoline) \ V(ArgumentsAdaptorTrampoline) \
V(BigIntToI32Pair) \
V(BigIntToI64) \
V(DoubleToI) \ V(DoubleToI) \
V(WasmI64ToBigInt) \ V(I32PairToBigInt) \
V(WasmI32PairToBigInt) \ V(I64ToBigInt) \
V(WasmBigIntToI64) \ V(RecordWrite) \
V(WasmBigIntToI32Pair) V(ToNumber)
// The exception thrown in the following builtins are caught internally and will // The exception thrown in the following builtins are caught internally and will
// not be propagated further or re-thrown // not be propagated further or re-thrown
......
...@@ -60,28 +60,6 @@ class WasmBuiltinsAssembler : public CodeStubAssembler { ...@@ -60,28 +60,6 @@ class WasmBuiltinsAssembler : public CodeStubAssembler {
} }
}; };
TF_BUILTIN(WasmAllocateHeapNumber, WasmBuiltinsAssembler) {
TNode<Code> target = LoadBuiltinFromFrame(Builtins::kAllocateHeapNumber);
TailCallStub(AllocateHeapNumberDescriptor(), target, NoContextConstant());
}
TF_BUILTIN(WasmRecordWrite, WasmBuiltinsAssembler) {
TNode<Object> object = UncheckedParameter(Descriptor::kObject);
TNode<Object> slot = UncheckedParameter(Descriptor::kSlot);
TNode<Object> remembered = UncheckedParameter(Descriptor::kRememberedSet);
TNode<Object> fp_mode = UncheckedParameter(Descriptor::kFPMode);
TNode<Code> target = LoadBuiltinFromFrame(Builtins::kRecordWrite);
TailCallStub(RecordWriteDescriptor{}, target, NoContextConstant(), object,
slot, remembered, fp_mode);
}
TF_BUILTIN(WasmToNumber, WasmBuiltinsAssembler) {
TNode<Object> context = UncheckedParameter(Descriptor::kContext);
TNode<Object> argument = UncheckedParameter(Descriptor::kArgument);
TNode<Code> target = LoadBuiltinFromFrame(Builtins::kToNumber);
TailCallStub(TypeConversionDescriptor(), target, context, argument);
}
TF_BUILTIN(WasmStackGuard, WasmBuiltinsAssembler) { TF_BUILTIN(WasmStackGuard, WasmBuiltinsAssembler) {
TNode<Object> instance = LoadInstanceFromFrame(); TNode<Object> instance = LoadInstanceFromFrame();
TNode<Code> centry = LoadCEntryFromInstance(instance); TNode<Code> centry = LoadCEntryFromInstance(instance);
...@@ -285,63 +263,6 @@ TF_BUILTIN(WasmTableSet, WasmBuiltinsAssembler) { ...@@ -285,63 +263,6 @@ TF_BUILTIN(WasmTableSet, WasmBuiltinsAssembler) {
SmiConstant(static_cast<int>(message_id))); SmiConstant(static_cast<int>(message_id)));
} }
TF_BUILTIN(WasmI64ToBigInt, WasmBuiltinsAssembler) {
if (!Is64()) {
Unreachable();
return;
}
TNode<Code> target = LoadBuiltinFromFrame(Builtins::kI64ToBigInt);
TNode<IntPtrT> argument =
UncheckedCast<IntPtrT>(Parameter(Descriptor::kArgument));
TailCallStub(I64ToBigIntDescriptor(), target, NoContextConstant(), argument);
}
TF_BUILTIN(WasmI32PairToBigInt, WasmBuiltinsAssembler) {
if (!Is32()) {
Unreachable();
return;
}
TNode<Code> target = LoadBuiltinFromFrame(Builtins::kI32PairToBigInt);
TNode<IntPtrT> low = UncheckedCast<IntPtrT>(Parameter(Descriptor::kLow));
TNode<IntPtrT> high = UncheckedCast<IntPtrT>(Parameter(Descriptor::kHigh));
TailCallStub(I32PairToBigIntDescriptor(), target, NoContextConstant(), low,
high);
}
TF_BUILTIN(WasmBigIntToI64, WasmBuiltinsAssembler) {
if (!Is64()) {
Unreachable();
return;
}
TNode<Object> context =
UncheckedCast<Object>(Parameter(Descriptor::kContext));
TNode<Code> target = LoadBuiltinFromFrame(Builtins::kBigIntToI64);
TNode<IntPtrT> argument =
UncheckedCast<IntPtrT>(Parameter(Descriptor::kArgument));
TailCallStub(BigIntToI64Descriptor(), target, context, argument);
}
TF_BUILTIN(WasmBigIntToI32Pair, WasmBuiltinsAssembler) {
if (!Is32()) {
Unreachable();
return;
}
TNode<Object> context =
UncheckedCast<Object>(Parameter(Descriptor::kContext));
TNode<Code> target = LoadBuiltinFromFrame(Builtins::kBigIntToI32Pair);
TNode<IntPtrT> argument =
UncheckedCast<IntPtrT>(Parameter(Descriptor::kArgument));
TailCallStub(BigIntToI32PairDescriptor(), target, context, argument);
}
#define DECLARE_ENUM(name) \ #define DECLARE_ENUM(name) \
TF_BUILTIN(ThrowWasm##name, WasmBuiltinsAssembler) { \ TF_BUILTIN(ThrowWasm##name, WasmBuiltinsAssembler) { \
TNode<Object> instance = LoadInstanceFromFrame(); \ TNode<Object> instance = LoadInstanceFromFrame(); \
......
...@@ -200,7 +200,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { ...@@ -200,7 +200,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
__ CallEphemeronKeyBarrier(object_, offset_, save_fp_mode); __ CallEphemeronKeyBarrier(object_, offset_, save_fp_mode);
} else if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) { } else if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) {
__ CallRecordWriteStub(object_, offset_, remembered_set_action, __ CallRecordWriteStub(object_, offset_, remembered_set_action,
save_fp_mode, wasm::WasmCode::kWasmRecordWrite); save_fp_mode, wasm::WasmCode::kRecordWrite);
} else { } else {
__ CallRecordWriteStub(object_, offset_, remembered_set_action, __ CallRecordWriteStub(object_, offset_, remembered_set_action,
save_fp_mode); save_fp_mode);
......
...@@ -301,7 +301,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { ...@@ -301,7 +301,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
// Just encode the stub index. This will be patched when the code // Just encode the stub index. This will be patched when the code
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ CallRecordWriteStub(object_, offset_, remembered_set_action, __ CallRecordWriteStub(object_, offset_, remembered_set_action,
save_fp_mode, wasm::WasmCode::kWasmRecordWrite); save_fp_mode, wasm::WasmCode::kRecordWrite);
} else { } else {
__ CallRecordWriteStub(object_, offset_, remembered_set_action, __ CallRecordWriteStub(object_, offset_, remembered_set_action,
save_fp_mode); save_fp_mode);
......
...@@ -321,7 +321,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { ...@@ -321,7 +321,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
// Just encode the stub index. This will be patched when the code // Just encode the stub index. This will be patched when the code
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode, wasm::WasmCode::kWasmRecordWrite); save_fp_mode, wasm::WasmCode::kRecordWrite);
} else { } else {
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode); save_fp_mode);
......
...@@ -179,7 +179,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { ...@@ -179,7 +179,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
// Just encode the stub index. This will be patched when the code // Just encode the stub index. This will be patched when the code
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode, wasm::WasmCode::kWasmRecordWrite); save_fp_mode, wasm::WasmCode::kRecordWrite);
} else { } else {
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode); save_fp_mode);
......
...@@ -180,7 +180,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { ...@@ -180,7 +180,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
// Just encode the stub index. This will be patched when the code // Just encode the stub index. This will be patched when the code
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode, wasm::WasmCode::kWasmRecordWrite); save_fp_mode, wasm::WasmCode::kRecordWrite);
} else { } else {
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode); save_fp_mode);
......
...@@ -185,7 +185,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { ...@@ -185,7 +185,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
__ CallEphemeronKeyBarrier(object_, scratch1_, save_fp_mode); __ CallEphemeronKeyBarrier(object_, scratch1_, save_fp_mode);
} else if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) { } else if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) {
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode, wasm::WasmCode::kWasmRecordWrite); save_fp_mode, wasm::WasmCode::kRecordWrite);
} else { } else {
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode); save_fp_mode);
......
...@@ -222,7 +222,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { ...@@ -222,7 +222,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
__ CallEphemeronKeyBarrier(object_, scratch1_, save_fp_mode); __ CallEphemeronKeyBarrier(object_, scratch1_, save_fp_mode);
} else if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) { } else if (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) {
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode, wasm::WasmCode::kWasmRecordWrite); save_fp_mode, wasm::WasmCode::kRecordWrite);
} else { } else {
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode); save_fp_mode);
......
...@@ -280,7 +280,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode { ...@@ -280,7 +280,7 @@ class OutOfLineRecordWrite final : public OutOfLineCode {
// Just encode the stub index. This will be patched when the code // Just encode the stub index. This will be patched when the code
// is added to the native module and copied into wasm code space. // is added to the native module and copied into wasm code space.
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode, wasm::WasmCode::kWasmRecordWrite); save_fp_mode, wasm::WasmCode::kRecordWrite);
} else { } else {
__ CallRecordWriteStub(object_, scratch1_, remembered_set_action, __ CallRecordWriteStub(object_, scratch1_, remembered_set_action,
save_fp_mode); save_fp_mode);
......
...@@ -5184,7 +5184,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -5184,7 +5184,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
Node* target = Node* target =
(stub_mode_ == StubCallMode::kCallWasmRuntimeStub) (stub_mode_ == StubCallMode::kCallWasmRuntimeStub)
? mcgraph()->RelocatableIntPtrConstant( ? mcgraph()->RelocatableIntPtrConstant(
wasm::WasmCode::kWasmAllocateHeapNumber, wasm::WasmCode::kAllocateHeapNumber,
RelocInfo::WASM_STUB_CALL) RelocInfo::WASM_STUB_CALL)
: BuildLoadBuiltinFromIsolateRoot(Builtins::kAllocateHeapNumber); : BuildLoadBuiltinFromIsolateRoot(Builtins::kAllocateHeapNumber);
if (!allocate_heap_number_operator_.is_set()) { if (!allocate_heap_number_operator_.is_set()) {
...@@ -5388,8 +5388,8 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -5388,8 +5388,8 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
CallDescriptor::kNoFlags, Operator::kNoProperties, stub_mode_); CallDescriptor::kNoFlags, Operator::kNoProperties, stub_mode_);
Node* stub_code = Node* stub_code =
(stub_mode_ == StubCallMode::kCallWasmRuntimeStub) (stub_mode_ == StubCallMode::kCallWasmRuntimeStub)
? mcgraph()->RelocatableIntPtrConstant( ? mcgraph()->RelocatableIntPtrConstant(wasm::WasmCode::kToNumber,
wasm::WasmCode::kWasmToNumber, RelocInfo::WASM_STUB_CALL) RelocInfo::WASM_STUB_CALL)
: BuildLoadBuiltinFromIsolateRoot(Builtins::kToNumber); : BuildLoadBuiltinFromIsolateRoot(Builtins::kToNumber);
Node* result = SetEffect( Node* result = SetEffect(
...@@ -5483,7 +5483,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -5483,7 +5483,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
target = target =
(stub_mode_ == StubCallMode::kCallWasmRuntimeStub) (stub_mode_ == StubCallMode::kCallWasmRuntimeStub)
? mcgraph()->RelocatableIntPtrConstant( ? mcgraph()->RelocatableIntPtrConstant(
wasm::WasmCode::kWasmI64ToBigInt, RelocInfo::WASM_STUB_CALL) wasm::WasmCode::kI64ToBigInt, RelocInfo::WASM_STUB_CALL)
: BuildLoadBuiltinFromIsolateRoot(Builtins::kI64ToBigInt); : BuildLoadBuiltinFromIsolateRoot(Builtins::kI64ToBigInt);
} else { } else {
DCHECK(mcgraph()->machine()->Is32()); DCHECK(mcgraph()->machine()->Is32());
...@@ -5493,8 +5493,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -5493,8 +5493,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
target = target =
(stub_mode_ == StubCallMode::kCallWasmRuntimeStub) (stub_mode_ == StubCallMode::kCallWasmRuntimeStub)
? mcgraph()->RelocatableIntPtrConstant( ? mcgraph()->RelocatableIntPtrConstant(
wasm::WasmCode::kWasmI32PairToBigInt, wasm::WasmCode::kI32PairToBigInt, RelocInfo::WASM_STUB_CALL)
RelocInfo::WASM_STUB_CALL)
: BuildLoadBuiltinFromIsolateRoot(Builtins::kI32PairToBigInt); : BuildLoadBuiltinFromIsolateRoot(Builtins::kI32PairToBigInt);
} }
...@@ -5511,7 +5510,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -5511,7 +5510,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
target = target =
(stub_mode_ == StubCallMode::kCallWasmRuntimeStub) (stub_mode_ == StubCallMode::kCallWasmRuntimeStub)
? mcgraph()->RelocatableIntPtrConstant( ? mcgraph()->RelocatableIntPtrConstant(
wasm::WasmCode::kWasmBigIntToI64, RelocInfo::WASM_STUB_CALL) wasm::WasmCode::kBigIntToI64, RelocInfo::WASM_STUB_CALL)
: BuildLoadBuiltinFromIsolateRoot(Builtins::kBigIntToI64); : BuildLoadBuiltinFromIsolateRoot(Builtins::kBigIntToI64);
} else { } else {
DCHECK(mcgraph()->machine()->Is32()); DCHECK(mcgraph()->machine()->Is32());
...@@ -5521,8 +5520,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -5521,8 +5520,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
target = target =
(stub_mode_ == StubCallMode::kCallWasmRuntimeStub) (stub_mode_ == StubCallMode::kCallWasmRuntimeStub)
? mcgraph()->RelocatableIntPtrConstant( ? mcgraph()->RelocatableIntPtrConstant(
wasm::WasmCode::kWasmBigIntToI32Pair, wasm::WasmCode::kBigIntToI32Pair, RelocInfo::WASM_STUB_CALL)
RelocInfo::WASM_STUB_CALL)
: BuildLoadBuiltinFromIsolateRoot(Builtins::kBigIntToI32Pair); : BuildLoadBuiltinFromIsolateRoot(Builtins::kBigIntToI32Pair);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment