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

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

Issue 2249973002: [wasm] Serialization test using external APIs and contexts (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Serialization test using external APIs and contexts Created 4 years, 4 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/wasm/wasm-module.h ('k') | test/cctest/wasm/test-run-wasm-module.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/wasm/wasm-module.cc
diff --git a/src/wasm/wasm-module.cc b/src/wasm/wasm-module.cc
index 8b0b54bc04737edd34a90ac3a8c44776d4a0a9d6..4e63648c912be82608df1e418f8c3fdf1fa7a3cf 100644
--- a/src/wasm/wasm-module.cc
+++ b/src/wasm/wasm-module.cc
@@ -1628,10 +1628,16 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
Handle<JSArrayBuffer>::null())
.ToHandleChecked();
+ return CallFunction(isolate, instance, &thrower, "main", 0, nullptr);
+}
+
+int32_t CallFunction(Isolate* isolate, Handle<JSObject> instance,
+ ErrorThrower* thrower, const char* name, int argc,
+ Handle<Object> argv[]) {
Handle<Name> exports = isolate->factory()->InternalizeUtf8String("exports");
Handle<JSObject> exports_object = Handle<JSObject>::cast(
JSObject::GetProperty(instance, exports).ToHandleChecked());
- Handle<Name> main_name = isolate->factory()->NewStringFromStaticChars("main");
+ Handle<Name> main_name = isolate->factory()->NewStringFromAsciiChecked(name);
PropertyDescriptor desc;
Maybe<bool> property_found = JSReceiver::GetOwnPropertyDescriptor(
isolate, exports_object, main_name, &desc);
@@ -1642,11 +1648,11 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
// Call the JS function.
Handle<Object> undefined = isolate->factory()->undefined_value();
MaybeHandle<Object> retval =
- Execution::Call(isolate, main_export, undefined, 0, nullptr);
+ Execution::Call(isolate, main_export, undefined, argc, argv);
// The result should be a number.
if (retval.is_null()) {
- thrower.Error("WASM.compileRun() failed: Invocation was null");
+ thrower->Error("WASM.compileRun() failed: Invocation was null");
return -1;
}
Handle<Object> result = retval.ToHandleChecked();
@@ -1656,7 +1662,7 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start,
if (result->IsHeapNumber()) {
return static_cast<int32_t>(HeapNumber::cast(*result)->value());
}
- thrower.Error("WASM.compileRun() failed: Return value should be number");
+ thrower->Error("WASM.compileRun() failed: Return value should be number");
return -1;
}
« no previous file with comments | « src/wasm/wasm-module.h ('k') | test/cctest/wasm/test-run-wasm-module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698