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

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

Issue 1709653002: [wasm] Add support for import section. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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
Index: src/compiler/wasm-compiler.cc
diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc
index 115f1962b1b5805b8bc60e0790d9c866b17118c7..bbf9e7808ed93c92a4ed58dbaf04c7891e4fb6e5 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -1503,6 +1503,15 @@ Node* WasmGraphBuilder::CallDirect(uint32_t index, Node** args) {
return BuildWasmCall(sig, args);
}
+Node* WasmGraphBuilder::CallImport(uint32_t index, Node** args) {
+ DCHECK_NULL(args[0]);
+
+ // Add code object as constant.
+ args[0] = Constant(module_->GetImportCode(index));
+ wasm::FunctionSig* sig = module_->GetFunctionSignature(index);
+
+ return BuildWasmCall(sig, args);
+}
Node* WasmGraphBuilder::CallIndirect(uint32_t index, Node** args) {
DCHECK_NOT_NULL(args[0]);
@@ -2016,12 +2025,9 @@ Handle<JSFunction> CompileJSToWasmWrapper(
return function;
}
-
Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
Handle<JSFunction> function,
- uint32_t index) {
- wasm::WasmFunction* func = &module->module->functions->at(index);
-
+ wasm::FunctionSig* sig, const char* name) {
//----------------------------------------------------------------------------
// Create the Graph
//----------------------------------------------------------------------------
@@ -2035,11 +2041,11 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
Node* control = nullptr;
Node* effect = nullptr;
- WasmGraphBuilder builder(&zone, &jsgraph, func->sig);
+ WasmGraphBuilder builder(&zone, &jsgraph, sig);
builder.set_control_ptr(&control);
builder.set_effect_ptr(&effect);
builder.set_module(module);
- builder.BuildWasmToJSWrapper(function, func->sig);
+ builder.BuildWasmToJSWrapper(function, sig);
Handle<Code> code = Handle<Code>::null();
{
@@ -2064,14 +2070,14 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
}
// Schedule and compile to machine code.
- CallDescriptor* incoming = module->GetWasmCallDescriptor(&zone, func->sig);
+ CallDescriptor* incoming = module->GetWasmCallDescriptor(&zone, sig);
// TODO(titzer): this is technically a WASM wrapper, not a wasm function.
Code::Flags flags = Code::ComputeFlags(Code::WASM_FUNCTION);
CompilationInfo info("wasm-to-js", isolate, &zone, flags);
code = Pipeline::GenerateCodeForTesting(&info, incoming, &graph, nullptr);
- RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "wasm-to-js", index,
- module->module->GetName(func->name_offset));
+ RecordFunctionCompilation(Logger::FUNCTION_TAG, &info, "wasm-to-js", 0,
+ name);
}
return code;
}
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/wasm/ast-decoder.h » ('j') | src/wasm/wasm-module.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698