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

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

Issue 2612643002: [wasm] simplify dependencies between graph builder and function decoder (Closed)
Patch Set: Created 3 years, 12 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') | src/wasm/function-body-decoder.h » ('j') | 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 bd039d3f9504b9b22ad7ea5437540f5c36c8c921..13c6622c6bf5ce65164eaf5ef7eece0874176770 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -341,10 +341,12 @@ class WasmTrapHelper : public ZoneObject {
};
WasmGraphBuilder::WasmGraphBuilder(
- Zone* zone, JSGraph* jsgraph, wasm::FunctionSig* sig,
+ wasm::ModuleEnv* module_env, Zone* zone, JSGraph* jsgraph,
+ wasm::FunctionSig* sig,
compiler::SourcePositionTable* source_position_table)
: zone_(zone),
jsgraph_(jsgraph),
+ module_(module_env),
function_tables_(zone),
function_table_sizes_(zone),
cur_buffer_(def_buffer_),
@@ -3342,10 +3344,9 @@ Handle<Code> CompileJSToWasmWrapper(Isolate* isolate,
Node* effect = nullptr;
wasm::ModuleEnv module_env(module, nullptr);
- WasmGraphBuilder builder(&zone, &jsgraph, func->sig);
+ WasmGraphBuilder builder(&module_env, &zone, &jsgraph, func->sig);
builder.set_control_ptr(&control);
builder.set_effect_ptr(&effect);
- builder.set_module(&module_env);
builder.BuildJSToWasmWrapper(wasm_code, func->sig);
//----------------------------------------------------------------------------
@@ -3422,7 +3423,8 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, Handle<JSReceiver> target,
origin == wasm::kAsmJsOrigin ? new (&zone) SourcePositionTable(&graph)
: nullptr;
- WasmGraphBuilder builder(&zone, &jsgraph, sig, source_position_table);
+ WasmGraphBuilder builder(nullptr, &zone, &jsgraph, sig,
+ source_position_table);
builder.set_control_ptr(&control);
builder.set_effect_ptr(&effect);
builder.BuildWasmToJSWrapper(target, sig);
@@ -3500,10 +3502,10 @@ SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction(
MachineOperatorBuilder* machine = jsgraph_->machine();
SourcePositionTable* source_position_table =
new (jsgraph_->zone()) SourcePositionTable(graph);
- WasmGraphBuilder builder(jsgraph_->zone(), jsgraph_, function_->sig,
- source_position_table);
+ WasmGraphBuilder builder(module_env_, jsgraph_->zone(), jsgraph_,
+ function_->sig, source_position_table);
const byte* module_start = module_env_->module_bytes.start();
- wasm::FunctionBody body = {module_env_, function_->sig, module_start,
+ wasm::FunctionBody body = {function_->sig, module_start,
module_start + function_->code_start_offset,
module_start + function_->code_end_offset};
graph_construction_result_ =
@@ -3531,7 +3533,8 @@ SourcePositionTable* WasmCompilationUnit::BuildGraphForWasmFunction(
if (index >= FLAG_trace_wasm_ast_start && index < FLAG_trace_wasm_ast_end) {
OFStream os(stdout);
- PrintWasmCode(isolate_->allocator(), body, os, nullptr);
+ PrintWasmCode(isolate_->allocator(), body, module_env_->module, os,
+ nullptr);
}
if (index >= FLAG_trace_wasm_text_start && index < FLAG_trace_wasm_text_end) {
OFStream os(stdout);
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/wasm/function-body-decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698