Commit b54bd06b authored by Ben L. Titzer's avatar Ben L. Titzer Committed by Commit Bot

[wasm] Use Handle<WasmInstanceObject> in wasm-module-runner.*

R=clemensh@chromium.org

Bug: 
Change-Id: I54e4d02cd5665d3ba3fd2e91da05599a915c0317
Reviewed-on: https://chromium-review.googlesource.com/712654Reviewed-by: 's avatarClemens Hammacher <clemensh@chromium.org>
Commit-Queue: Ben Titzer <titzer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48457}
parent 777ca5eb
...@@ -281,7 +281,7 @@ class WasmSerializationTest { ...@@ -281,7 +281,7 @@ class WasmSerializationTest {
wire_bytes().first, wire_bytes().second), wire_bytes().first, wire_bytes().second),
0); 0);
} }
Handle<JSObject> instance = Handle<WasmInstanceObject> instance =
SyncInstantiate(current_isolate(), &thrower, module_object, SyncInstantiate(current_isolate(), &thrower, module_object,
Handle<JSReceiver>::null(), Handle<JSReceiver>::null(),
MaybeHandle<JSArrayBuffer>()) MaybeHandle<JSArrayBuffer>())
......
...@@ -96,8 +96,9 @@ bool InterpretWasmModuleForTesting(Isolate* isolate, ...@@ -96,8 +96,9 @@ bool InterpretWasmModuleForTesting(Isolate* isolate,
return interpreter_result != WasmInterpreter::PAUSED; return interpreter_result != WasmInterpreter::PAUSED;
} }
int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance, int32_t RunWasmModuleForTesting(Isolate* isolate,
int argc, Handle<Object> argv[]) { Handle<WasmInstanceObject> instance, int argc,
Handle<Object> argv[]) {
ErrorThrower thrower(isolate, "RunWasmModule"); ErrorThrower thrower(isolate, "RunWasmModule");
return CallWasmFunctionForTesting(isolate, instance, &thrower, "main", argc, return CallWasmFunctionForTesting(isolate, instance, &thrower, "main", argc,
argv); argv);
...@@ -165,9 +166,8 @@ int32_t InterpretWasmModule(Isolate* isolate, ...@@ -165,9 +166,8 @@ int32_t InterpretWasmModule(Isolate* isolate,
} }
} }
MaybeHandle<WasmExportedFunction> GetExportedFunction(Isolate* isolate, MaybeHandle<WasmExportedFunction> GetExportedFunction(
Handle<JSObject> instance, Isolate* isolate, Handle<WasmInstanceObject> instance, const char* name) {
const char* name) {
Handle<JSObject> exports_object; Handle<JSObject> exports_object;
Handle<Name> exports = isolate->factory()->InternalizeUtf8String("exports"); Handle<Name> exports = isolate->factory()->InternalizeUtf8String("exports");
exports_object = Handle<JSObject>::cast( exports_object = Handle<JSObject>::cast(
...@@ -183,7 +183,8 @@ MaybeHandle<WasmExportedFunction> GetExportedFunction(Isolate* isolate, ...@@ -183,7 +183,8 @@ MaybeHandle<WasmExportedFunction> GetExportedFunction(Isolate* isolate,
return Handle<WasmExportedFunction>::cast(desc.value()); return Handle<WasmExportedFunction>::cast(desc.value());
} }
int32_t CallWasmFunctionForTesting(Isolate* isolate, Handle<JSObject> instance, int32_t CallWasmFunctionForTesting(Isolate* isolate,
Handle<WasmInstanceObject> instance,
ErrorThrower* thrower, const char* name, ErrorThrower* thrower, const char* name,
int argc, Handle<Object> argv[]) { int argc, Handle<Object> argv[]) {
MaybeHandle<WasmExportedFunction> maybe_export = MaybeHandle<WasmExportedFunction> maybe_export =
......
...@@ -29,14 +29,14 @@ std::unique_ptr<WasmModule> DecodeWasmModuleForTesting( ...@@ -29,14 +29,14 @@ std::unique_ptr<WasmModule> DecodeWasmModuleForTesting(
// Returns a MaybeHandle to the JsToWasm wrapper of the wasm function exported // Returns a MaybeHandle to the JsToWasm wrapper of the wasm function exported
// with the given name by the provided instance. // with the given name by the provided instance.
MaybeHandle<WasmExportedFunction> GetExportedFunction(Isolate* isolate, MaybeHandle<WasmExportedFunction> GetExportedFunction(
Handle<JSObject> instance, Isolate* isolate, Handle<WasmInstanceObject> instance, const char* name);
const char* name);
// Call an exported wasm function by name. Returns -1 if the export does not // Call an exported wasm function by name. Returns -1 if the export does not
// exist or throws an error. Errors are cleared from the isolate before // exist or throws an error. Errors are cleared from the isolate before
// returning. // returning.
int32_t CallWasmFunctionForTesting(Isolate* isolate, Handle<JSObject> instance, int32_t CallWasmFunctionForTesting(Isolate* isolate,
Handle<WasmInstanceObject> instance,
ErrorThrower* thrower, const char* name, ErrorThrower* thrower, const char* name,
int argc, Handle<Object> argv[]); int argc, Handle<Object> argv[]);
...@@ -63,8 +63,9 @@ int32_t InterpretWasmModule(Isolate* isolate, ...@@ -63,8 +63,9 @@ int32_t InterpretWasmModule(Isolate* isolate,
WasmValue* args, bool* possible_nondeterminism); WasmValue* args, bool* possible_nondeterminism);
// Runs the module instance with arguments. // Runs the module instance with arguments.
int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance, int32_t RunWasmModuleForTesting(Isolate* isolate,
int argc, Handle<Object> argv[]); Handle<WasmInstanceObject> instance, int argc,
Handle<Object> argv[]);
// Install function map, module symbol for testing // Install function map, module symbol for testing
void SetupIsolateForWasmModule(Isolate* isolate); void SetupIsolateForWasmModule(Isolate* isolate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment