Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(900)

Unified Diff: src/compiler/wasm-compiler.cc

Issue 1886173003: [wasm] Remove the use of JSOperatorBuilder.ToNumber to avoid JSGenericLowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index 2e33c05f51101742bbe1cb35894e277b5fbead68..9321ac14a35a6e0203fde598ff88e32a2a082488 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -2100,15 +2100,28 @@ Node* WasmGraphBuilder::ToJS(Node* node, Node* context, wasm::LocalType type) {
}
}
+Node* WasmGraphBuilder::BuildJavaScriptToNumber(Node* node, Node* context,
+ Node* effect, Node* control) {
+ Callable callable = CodeFactory::ToNumber(jsgraph()->isolate());
+ CallDescriptor* desc = Linkage::GetStubCallDescriptor(
+ jsgraph()->isolate(), jsgraph()->zone(), callable.descriptor(), 0,
+ CallDescriptor::kNeedsFrameState, Operator::kNoProperties);
+ Node* stub_code = jsgraph()->HeapConstant(callable.code());
+
+ Node* result =
+ graph()->NewNode(jsgraph()->common()->Call(desc), stub_code, node,
+ context, jsgraph()->EmptyFrameState(), effect, control);
+
+ *control_ = result;
+ *effect_ = result;
+
+ return result;
+}
Node* WasmGraphBuilder::FromJS(Node* node, Node* context,
wasm::LocalType type) {
// Do a JavaScript ToNumber.
- Node* num =
- graph()->NewNode(jsgraph()->javascript()->ToNumber(), node, context,
- jsgraph()->EmptyFrameState(), *effect_, *control_);
- *control_ = num;
- *effect_ = num;
+ Node* num = BuildJavaScriptToNumber(node, context, *effect_, *control_);
// Change representation.
SimplifiedOperatorBuilder simplified(jsgraph()->zone());
@@ -2508,9 +2521,8 @@ Handle<JSFunction> CompileJSToWasmWrapper(
Zone zone(isolate->allocator());
Graph graph(&zone);
CommonOperatorBuilder common(&zone);
- JSOperatorBuilder javascript(&zone);
MachineOperatorBuilder machine(&zone);
- JSGraph jsgraph(isolate, &graph, &common, &javascript, nullptr, &machine);
+ JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine);
Node* control = nullptr;
Node* effect = nullptr;
@@ -2532,11 +2544,9 @@ Handle<JSFunction> CompileJSToWasmWrapper(
typer.Run(roots);
// Run generic and change lowering.
- JSGenericLowering generic(&jsgraph);
ChangeLowering changes(&jsgraph);
GraphReducer graph_reducer(&zone, &graph, jsgraph.Dead());
graph_reducer.AddReducer(&changes);
- graph_reducer.AddReducer(&generic);
graph_reducer.ReduceGraph();
if (FLAG_trace_turbo_graph) { // Simple textual RPO.
@@ -2600,9 +2610,8 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
Zone zone(isolate->allocator());
Graph graph(&zone);
CommonOperatorBuilder common(&zone);
- JSOperatorBuilder javascript(&zone);
MachineOperatorBuilder machine(&zone);
- JSGraph jsgraph(isolate, &graph, &common, &javascript, nullptr, &machine);
+ JSGraph jsgraph(isolate, &graph, &common, nullptr, nullptr, &machine);
Node* control = nullptr;
Node* effect = nullptr;
@@ -2622,11 +2631,9 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
typer.Run(roots);
// Run generic and change lowering.
- JSGenericLowering generic(&jsgraph);
ChangeLowering changes(&jsgraph);
GraphReducer graph_reducer(&zone, &graph, jsgraph.Dead());
graph_reducer.AddReducer(&changes);
- graph_reducer.AddReducer(&generic);
graph_reducer.ReduceGraph();
if (FLAG_trace_turbo_graph) { // Simple textual RPO.
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698