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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 if (module->import_table.size() > 0) { | 52 if (module->import_table.size() > 0) { |
53 thrower->CompileError("Not supported: module has imports."); | 53 thrower->CompileError("Not supported: module has imports."); |
54 } | 54 } |
55 | 55 |
56 if (thrower->error()) return Handle<WasmInstanceObject>::null(); | 56 if (thrower->error()) return Handle<WasmInstanceObject>::null(); |
57 | 57 |
58 // Although we decoded the module for some pre-validation, run the bytes | 58 // Although we decoded the module for some pre-validation, run the bytes |
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.start(), wire_bytes.end(), thrower, |
63 thrower, ModuleOrigin::kWasmOrigin, Handle<Script>::null(), | 63 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 = | 69 MaybeHandle<WasmInstanceObject> maybe_instance = |
70 WasmModule::Instantiate(isolate, thrower, module_object.ToHandleChecked(), | 70 WasmModule::Instantiate(isolate, thrower, module_object.ToHandleChecked(), |
71 Handle<JSReceiver>::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)) { |
(...skipping 130 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 |