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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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.module_bytes.start(), wire_bytes.module_bytes.end(), |
63 thrower, ModuleOrigin::kWasmOrigin, Handle<Script>::null(), nullptr, | 63 thrower, ModuleOrigin::kWasmOrigin, Handle<Script>::null(), |
64 nullptr); | 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 = WasmModule::Instantiate( |
70 isolate, thrower, module_object.ToHandleChecked(), | 70 isolate, thrower, module_object.ToHandleChecked(), |
71 Handle<JSReceiver>::null(), Handle<JSArrayBuffer>::null()); | 71 Handle<JSReceiver>::null(), Handle<JSArrayBuffer>::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(); |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 | 206 |
207 void SetupIsolateForWasmModule(Isolate* isolate) { | 207 void SetupIsolateForWasmModule(Isolate* isolate) { |
208 WasmJs::InstallWasmMapsIfNeeded(isolate, isolate->native_context()); | 208 WasmJs::InstallWasmMapsIfNeeded(isolate, isolate->native_context()); |
209 WasmJs::InstallWasmModuleSymbolIfNeeded(isolate, isolate->global_object(), | 209 WasmJs::InstallWasmModuleSymbolIfNeeded(isolate, isolate->global_object(), |
210 isolate->native_context()); | 210 isolate->native_context()); |
211 } | 211 } |
212 } // namespace testing | 212 } // namespace testing |
213 } // namespace wasm | 213 } // namespace wasm |
214 } // namespace internal | 214 } // namespace internal |
215 } // namespace v8 | 215 } // namespace v8 |
OLD | NEW |