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

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: delete the import_code vector 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
« no previous file with comments | « src/compiler/wasm-compiler.h ('k') | src/wasm/ast-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 6742d987fff873f8574c5aeedac492b3bf4454ee..fe1b4a9881ef116779ec77326ac7d6603c46862e 100644
--- a/src/compiler/wasm-compiler.cc
+++ b/src/compiler/wasm-compiler.cc
@@ -1504,6 +1504,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);
binji 2016/02/19 20:30:12 I think this should be GetImportSignature. I'm get
titzer 2016/02/21 09:18:35 Good catch. https://codereview.chromium.org/171799
+
+ return BuildWasmCall(sig, args);
+}
Node* WasmGraphBuilder::CallIndirect(uint32_t index, Node** args) {
DCHECK_NOT_NULL(args[0]);
@@ -2038,12 +2047,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
//----------------------------------------------------------------------------
@@ -2057,11 +2063,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();
{
@@ -2086,7 +2092,7 @@ 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);
bool debugging =
@@ -2110,8 +2116,8 @@ Handle<Code> CompileWasmToJSWrapper(Isolate* isolate, wasm::ModuleEnv* module,
buffer.Dispose();
}
- 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698