Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "test/common/wasm/wasm-module-runner.h" | 5 #include "test/common/wasm/wasm-module-runner.h" |
| 6 | 6 |
| 7 #include "src/handles.h" | 7 #include "src/handles.h" |
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
| 9 #include "src/objects.h" | 9 #include "src/objects.h" |
| 10 #include "src/property-descriptor.h" | 10 #include "src/property-descriptor.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 Handle<JSObject> instance; | 74 Handle<JSObject> instance; |
| 75 if (!maybe_instance.ToHandle(&instance)) { | 75 if (!maybe_instance.ToHandle(&instance)) { |
| 76 return Handle<JSObject>::null(); | 76 return Handle<JSObject>::null(); |
| 77 } | 77 } |
| 78 return instance; | 78 return instance; |
| 79 } | 79 } |
| 80 | 80 |
| 81 const Handle<JSObject> CompileInstantiateWasmModuleForTesting( | 81 const Handle<JSObject> CompileInstantiateWasmModuleForTesting( |
| 82 Isolate* isolate, ErrorThrower* thrower, const byte* module_start, | 82 Isolate* isolate, ErrorThrower* thrower, const byte* module_start, |
| 83 const byte* module_end, ModuleOrigin origin) { | 83 const byte* module_end, ModuleOrigin origin) { |
| 84 const WasmModule* module = DecodeWasmModuleForTesting( | 84 std::unique_ptr<const WasmModule> module(DecodeWasmModuleForTesting( |
|
titzer
2016/10/24 13:34:40
This isn't quite right.
This C++ object should be
ahaas
2016/10/24 14:04:29
This is not the WasmModule that is given to the in
| |
| 85 isolate, thrower, module_start, module_end, origin); | 85 isolate, thrower, module_start, module_end, origin)); |
| 86 | 86 |
| 87 if (module == nullptr) { | 87 if (module == nullptr) { |
| 88 thrower->CompileError("Wasm module decoding failed"); | 88 thrower->CompileError("Wasm module decoding failed"); |
| 89 return Handle<JSObject>::null(); | 89 return Handle<JSObject>::null(); |
| 90 } | 90 } |
| 91 return InstantiateModuleForTesting(isolate, thrower, module); | 91 return InstantiateModuleForTesting(isolate, thrower, module.get()); |
| 92 } | 92 } |
| 93 | 93 |
| 94 int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance, | 94 int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance, |
| 95 int argc, Handle<Object> argv[], | 95 int argc, Handle<Object> argv[], |
| 96 ModuleOrigin origin) { | 96 ModuleOrigin origin) { |
| 97 ErrorThrower thrower(isolate, "RunWasmModule"); | 97 ErrorThrower thrower(isolate, "RunWasmModule"); |
| 98 const char* f_name = origin == ModuleOrigin::kAsmJsOrigin ? "caller" : "main"; | 98 const char* f_name = origin == ModuleOrigin::kAsmJsOrigin ? "caller" : "main"; |
| 99 return CallWasmFunctionForTesting(isolate, instance, &thrower, f_name, argc, | 99 return CallWasmFunctionForTesting(isolate, instance, &thrower, f_name, argc, |
| 100 argv, origin); | 100 argv, origin); |
| 101 } | 101 } |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 | 222 |
| 223 void SetupIsolateForWasmModule(Isolate* isolate) { | 223 void SetupIsolateForWasmModule(Isolate* isolate) { |
| 224 WasmJs::InstallWasmMapsIfNeeded(isolate, isolate->native_context()); | 224 WasmJs::InstallWasmMapsIfNeeded(isolate, isolate->native_context()); |
| 225 WasmJs::InstallWasmModuleSymbolIfNeeded(isolate, isolate->global_object(), | 225 WasmJs::InstallWasmModuleSymbolIfNeeded(isolate, isolate->global_object(), |
| 226 isolate->native_context()); | 226 isolate->native_context()); |
| 227 } | 227 } |
| 228 } // namespace testing | 228 } // namespace testing |
| 229 } // namespace wasm | 229 } // namespace wasm |
| 230 } // namespace internal | 230 } // namespace internal |
| 231 } // namespace v8 | 231 } // namespace v8 |
| OLD | NEW |