| 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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // again through the normal pipeline. | 59 // again through the normal pipeline. |
| 60 // TODO(wasm): Use {module} instead of decoding the module bytes again. | 60 // TODO(wasm): Use {module} instead of decoding the module bytes again. |
| 61 MaybeHandle<WasmModuleObject> module_object = CreateModuleObjectFromBytes( | 61 MaybeHandle<WasmModuleObject> module_object = CreateModuleObjectFromBytes( |
| 62 isolate, wire_bytes.module_bytes.start(), wire_bytes.module_bytes.end(), | 62 isolate, wire_bytes.module_bytes.start(), wire_bytes.module_bytes.end(), |
| 63 thrower, ModuleOrigin::kWasmOrigin, Handle<Script>::null(), | 63 thrower, ModuleOrigin::kWasmOrigin, Handle<Script>::null(), |
| 64 Vector<const byte>::empty()); | 64 Vector<const byte>::empty()); |
| 65 if (module_object.is_null()) { | 65 if (module_object.is_null()) { |
| 66 thrower->CompileError("Module pre-validation failed."); | 66 thrower->CompileError("Module pre-validation failed."); |
| 67 return Handle<WasmInstanceObject>::null(); | 67 return Handle<WasmInstanceObject>::null(); |
| 68 } | 68 } |
| 69 MaybeHandle<WasmInstanceObject> maybe_instance = WasmModule::Instantiate( | 69 MaybeHandle<WasmInstanceObject> maybe_instance = |
| 70 isolate, thrower, module_object.ToHandleChecked(), | 70 WasmModule::Instantiate(isolate, thrower, module_object.ToHandleChecked(), |
| 71 Handle<JSReceiver>::null(), Handle<JSArrayBuffer>::null()); | 71 Handle<JSReceiver>::null()); |
| 72 Handle<WasmInstanceObject> instance; | 72 Handle<WasmInstanceObject> instance; |
| 73 if (!maybe_instance.ToHandle(&instance)) { | 73 if (!maybe_instance.ToHandle(&instance)) { |
| 74 return Handle<WasmInstanceObject>::null(); | 74 return Handle<WasmInstanceObject>::null(); |
| 75 } | 75 } |
| 76 return instance; | 76 return instance; |
| 77 } | 77 } |
| 78 | 78 |
| 79 const Handle<WasmInstanceObject> CompileInstantiateWasmModuleForTesting( | 79 const Handle<WasmInstanceObject> CompileInstantiateWasmModuleForTesting( |
| 80 Isolate* isolate, ErrorThrower* thrower, const byte* module_start, | 80 Isolate* isolate, ErrorThrower* thrower, const byte* module_start, |
| 81 const byte* module_end, ModuleOrigin origin) { | 81 const byte* module_end, ModuleOrigin origin) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 return -1; | 204 return -1; |
| 205 } | 205 } |
| 206 | 206 |
| 207 void SetupIsolateForWasmModule(Isolate* isolate) { | 207 void SetupIsolateForWasmModule(Isolate* isolate) { |
| 208 WasmJs::Install(isolate); | 208 WasmJs::Install(isolate); |
| 209 } | 209 } |
| 210 } // namespace testing | 210 } // namespace testing |
| 211 } // namespace wasm | 211 } // namespace wasm |
| 212 } // namespace internal | 212 } // namespace internal |
| 213 } // namespace v8 | 213 } // namespace v8 |
| OLD | NEW |