Commit 081e5070 authored by Dan Elphick's avatar Dan Elphick Committed by Commit Bot

[wasm] Use builtin addresses directly for Wasm conversions

Changes calls to conversion builtins in Wasm wrappers to use the builtin
address directly rather than going via the Code object which results in
the trampoline being unnecessarily executed.

Bug: v8:9338
Change-Id: I74593dbda3c8bd308be65bc98ce85213a98f78b5
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1648274Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Dan Elphick <delphick@chromium.org>
Cr-Commit-Position: refs/heads/master@{#62094}
parent 0db46e6a
...@@ -4914,12 +4914,12 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -4914,12 +4914,12 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
Node* BuildAllocateHeapNumberWithValue(Node* value, Node* control) { Node* BuildAllocateHeapNumberWithValue(Node* value, Node* control) {
MachineOperatorBuilder* machine = mcgraph()->machine(); MachineOperatorBuilder* machine = mcgraph()->machine();
CommonOperatorBuilder* common = mcgraph()->common(); CommonOperatorBuilder* common = mcgraph()->common();
Node* target = (stub_mode_ == StubCallMode::kCallWasmRuntimeStub) Node* target =
? mcgraph()->RelocatableIntPtrConstant( (stub_mode_ == StubCallMode::kCallWasmRuntimeStub)
wasm::WasmCode::kWasmAllocateHeapNumber, ? mcgraph()->RelocatableIntPtrConstant(
RelocInfo::WASM_STUB_CALL) wasm::WasmCode::kWasmAllocateHeapNumber,
: jsgraph()->HeapConstant( RelocInfo::WASM_STUB_CALL)
BUILTIN_CODE(isolate_, AllocateHeapNumber)); : BuildLoadBuiltinFromInstance(Builtins::kAllocateHeapNumber);
if (!allocate_heap_number_operator_.is_set()) { if (!allocate_heap_number_operator_.is_set()) {
auto call_descriptor = Linkage::GetStubCallDescriptor( auto call_descriptor = Linkage::GetStubCallDescriptor(
mcgraph()->zone(), AllocateHeapNumberDescriptor(), 0, mcgraph()->zone(), AllocateHeapNumberDescriptor(), 0,
...@@ -5096,7 +5096,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -5096,7 +5096,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
(stub_mode_ == StubCallMode::kCallWasmRuntimeStub) (stub_mode_ == StubCallMode::kCallWasmRuntimeStub)
? mcgraph()->RelocatableIntPtrConstant( ? mcgraph()->RelocatableIntPtrConstant(
wasm::WasmCode::kWasmToNumber, RelocInfo::WASM_STUB_CALL) wasm::WasmCode::kWasmToNumber, RelocInfo::WASM_STUB_CALL)
: jsgraph()->HeapConstant(BUILTIN_CODE(isolate_, ToNumber)); : BuildLoadBuiltinFromInstance(Builtins::kToNumber);
Node* result = SetEffect( Node* result = SetEffect(
graph()->NewNode(mcgraph()->common()->Call(call_descriptor), stub_code, graph()->NewNode(mcgraph()->common()->Call(call_descriptor), stub_code,
...@@ -5196,7 +5196,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -5196,7 +5196,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
(stub_mode_ == StubCallMode::kCallWasmRuntimeStub) (stub_mode_ == StubCallMode::kCallWasmRuntimeStub)
? mcgraph()->RelocatableIntPtrConstant( ? mcgraph()->RelocatableIntPtrConstant(
wasm::WasmCode::kWasmI64ToBigInt, RelocInfo::WASM_STUB_CALL) wasm::WasmCode::kWasmI64ToBigInt, RelocInfo::WASM_STUB_CALL)
: jsgraph()->HeapConstant(BUILTIN_CODE(isolate_, I64ToBigInt)); : BuildLoadBuiltinFromInstance(Builtins::kI64ToBigInt);
return SetEffect( return SetEffect(
SetControl(graph()->NewNode(mcgraph()->common()->Call(call_descriptor), SetControl(graph()->NewNode(mcgraph()->common()->Call(call_descriptor),
...@@ -5218,7 +5218,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { ...@@ -5218,7 +5218,7 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder {
(stub_mode_ == StubCallMode::kCallWasmRuntimeStub) (stub_mode_ == StubCallMode::kCallWasmRuntimeStub)
? mcgraph()->RelocatableIntPtrConstant( ? mcgraph()->RelocatableIntPtrConstant(
wasm::WasmCode::kWasmBigIntToI64, RelocInfo::WASM_STUB_CALL) wasm::WasmCode::kWasmBigIntToI64, RelocInfo::WASM_STUB_CALL)
: jsgraph()->HeapConstant(BUILTIN_CODE(isolate_, BigIntToI64)); : BuildLoadBuiltinFromInstance(Builtins::kBigIntToI64);
return SetEffect(SetControl( return SetEffect(SetControl(
graph()->NewNode(mcgraph()->common()->Call(call_descriptor), target, graph()->NewNode(mcgraph()->common()->Call(call_descriptor), target,
......
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