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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 } | 55 } |
56 if (module->export_table.size() == 0) { | 56 if (module->export_table.size() == 0) { |
57 thrower->Error("Not supported: module has no exports."); | 57 thrower->Error("Not supported: module has no exports."); |
58 } | 58 } |
59 if (thrower->error()) return Handle<JSObject>::null(); | 59 if (thrower->error()) return Handle<JSObject>::null(); |
60 | 60 |
61 // Although we decoded the module for some pre-validation, run the bytes | 61 // Although we decoded the module for some pre-validation, run the bytes |
62 // again through the normal pipeline. | 62 // again through the normal pipeline. |
63 MaybeHandle<JSObject> module_object = CreateModuleObjectFromBytes( | 63 MaybeHandle<JSObject> module_object = CreateModuleObjectFromBytes( |
64 isolate, module->module_start, module->module_end, thrower, | 64 isolate, module->module_start, module->module_end, thrower, |
65 ModuleOrigin::kWasmOrigin); | 65 ModuleOrigin::kWasmOrigin, Handle<Script>::null(), nullptr, nullptr); |
66 if (module_object.is_null()) { | 66 if (module_object.is_null()) { |
67 thrower->Error("Module pre-validation failed."); | 67 thrower->Error("Module pre-validation failed."); |
68 return Handle<JSObject>::null(); | 68 return Handle<JSObject>::null(); |
69 } | 69 } |
70 MaybeHandle<JSObject> maybe_instance = WasmModule::Instantiate( | 70 MaybeHandle<JSObject> maybe_instance = WasmModule::Instantiate( |
71 isolate, thrower, module_object.ToHandleChecked(), | 71 isolate, thrower, module_object.ToHandleChecked(), |
72 Handle<JSReceiver>::null(), Handle<JSArrayBuffer>::null()); | 72 Handle<JSReceiver>::null(), Handle<JSArrayBuffer>::null()); |
73 Handle<JSObject> instance; | 73 Handle<JSObject> instance; |
74 if (!maybe_instance.ToHandle(&instance)) { | 74 if (!maybe_instance.ToHandle(&instance)) { |
75 return Handle<JSObject>::null(); | 75 return Handle<JSObject>::null(); |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 void SetupIsolateForWasmModule(Isolate* isolate) { | 222 void SetupIsolateForWasmModule(Isolate* isolate) { |
223 WasmJs::InstallWasmMapsIfNeeded(isolate, isolate->native_context()); | 223 WasmJs::InstallWasmMapsIfNeeded(isolate, isolate->native_context()); |
224 WasmJs::InstallWasmModuleSymbolIfNeeded(isolate, isolate->global_object(), | 224 WasmJs::InstallWasmModuleSymbolIfNeeded(isolate, isolate->global_object(), |
225 isolate->native_context()); | 225 isolate->native_context()); |
226 } | 226 } |
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 |