Index: test/common/wasm/wasm-module-runner.cc |
diff --git a/test/common/wasm/wasm-module-runner.cc b/test/common/wasm/wasm-module-runner.cc |
index 15c3ef433f48ff9d1604c058b31a2aa6da0e4d64..9dc304a61f084c5115a68abf4f141fb3ac2c9533 100644 |
--- a/test/common/wasm/wasm-module-runner.cc |
+++ b/test/common/wasm/wasm-module-runner.cc |
@@ -78,17 +78,16 @@ const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate, |
} |
const Handle<JSObject> CompileInstantiateWasmModuleForTesting( |
- Isolate* isolate, Zone* zone, const byte* module_start, |
- const byte* module_end, ModuleOrigin origin) { |
- ErrorThrower thrower(isolate, "CompileInstantiateWasmModule"); |
+ Isolate* isolate, ErrorThrower* thrower, Zone* zone, |
+ const byte* module_start, const byte* module_end, ModuleOrigin origin) { |
std::unique_ptr<const WasmModule> module(DecodeWasmModuleForTesting( |
- isolate, zone, &thrower, module_start, module_end, origin)); |
+ isolate, zone, thrower, module_start, module_end, origin)); |
if (module == nullptr) { |
- thrower.Error("Wasm module decode failed"); |
+ thrower->Error("Wasm module decode failed"); |
return Handle<JSObject>::null(); |
} |
- return InstantiateModuleForTesting(isolate, &thrower, module.get()); |
+ return InstantiateModuleForTesting(isolate, thrower, module.get()); |
} |
int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance, |
@@ -104,9 +103,9 @@ int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
const byte* module_end, ModuleOrigin origin) { |
HandleScope scope(isolate); |
Zone zone(isolate->allocator()); |
- |
+ ErrorThrower thrower(isolate, "CompileAndRunWasmModule"); |
Handle<JSObject> instance = CompileInstantiateWasmModuleForTesting( |
- isolate, &zone, module_start, module_end, origin); |
+ isolate, &thrower, &zone, module_start, module_end, origin); |
if (instance.is_null()) { |
return -1; |
} |
@@ -225,6 +224,13 @@ void SetupIsolateForWasmModule(Isolate* isolate) { |
isolate->native_context()); |
} |
+MaybeHandle<JSArrayBuffer> GetInstanceMemoryForTesting( |
+ Isolate* isolate, Handle<JSObject> instance) { |
+ Object* mem = instance->GetInternalField(kWasmMemArrayBuffer); |
+ DCHECK(IsWasmObject(*instance)); |
+ if (mem->IsUndefined(isolate)) return MaybeHandle<JSArrayBuffer>(); |
+ return Handle<JSArrayBuffer>(JSArrayBuffer::cast(mem)); |
+} |
} // namespace testing |
} // namespace wasm |
} // namespace internal |