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-inl.h" | 9 #include "src/objects-inl.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 DCHECK_NOT_NULL(module); | 52 DCHECK_NOT_NULL(module); |
53 if (module->import_table.size() > 0) { | 53 if (module->import_table.size() > 0) { |
54 thrower->CompileError("Not supported: module has imports."); | 54 thrower->CompileError("Not supported: module has imports."); |
55 } | 55 } |
56 | 56 |
57 if (thrower->error()) return Handle<WasmInstanceObject>::null(); | 57 if (thrower->error()) return Handle<WasmInstanceObject>::null(); |
58 | 58 |
59 // Although we decoded the module for some pre-validation, run the bytes | 59 // Although we decoded the module for some pre-validation, run the bytes |
60 // again through the normal pipeline. | 60 // again through the normal pipeline. |
61 // TODO(wasm): Use {module} instead of decoding the module bytes again. | 61 // TODO(wasm): Use {module} instead of decoding the module bytes again. |
62 MaybeHandle<WasmModuleObject> module_object = CreateModuleObjectFromBytes( | 62 MaybeHandle<WasmModuleObject> module_object = |
63 isolate, wire_bytes.start(), wire_bytes.end(), thrower, | 63 SyncCompile(isolate, thrower, wire_bytes); |
64 ModuleOrigin::kWasmOrigin, Handle<Script>::null(), | |
65 Vector<const byte>::empty()); | |
66 if (module_object.is_null()) { | 64 if (module_object.is_null()) { |
67 thrower->CompileError("Module pre-validation failed."); | 65 thrower->CompileError("Module pre-validation failed."); |
68 return Handle<WasmInstanceObject>::null(); | 66 return Handle<WasmInstanceObject>::null(); |
69 } | 67 } |
70 MaybeHandle<WasmInstanceObject> maybe_instance = | 68 MaybeHandle<WasmInstanceObject> maybe_instance = |
71 WasmModule::Instantiate(isolate, thrower, module_object.ToHandleChecked(), | 69 SyncInstantiate(isolate, thrower, module_object.ToHandleChecked(), |
72 Handle<JSReceiver>::null()); | 70 Handle<JSReceiver>::null(), MaybeHandle<JSArrayBuffer>()); |
73 Handle<WasmInstanceObject> instance; | 71 Handle<WasmInstanceObject> instance; |
74 if (!maybe_instance.ToHandle(&instance)) { | 72 if (!maybe_instance.ToHandle(&instance)) { |
75 return Handle<WasmInstanceObject>::null(); | 73 return Handle<WasmInstanceObject>::null(); |
76 } | 74 } |
77 return instance; | 75 return instance; |
78 } | 76 } |
79 | 77 |
80 const Handle<WasmInstanceObject> CompileInstantiateWasmModuleForTesting( | 78 const Handle<WasmInstanceObject> CompileInstantiateWasmModuleForTesting( |
81 Isolate* isolate, ErrorThrower* thrower, const byte* module_start, | 79 Isolate* isolate, ErrorThrower* thrower, const byte* module_start, |
82 const byte* module_end, ModuleOrigin origin) { | 80 const byte* module_end, ModuleOrigin origin) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 return -1; | 203 return -1; |
206 } | 204 } |
207 | 205 |
208 void SetupIsolateForWasmModule(Isolate* isolate) { | 206 void SetupIsolateForWasmModule(Isolate* isolate) { |
209 WasmJs::Install(isolate); | 207 WasmJs::Install(isolate); |
210 } | 208 } |
211 } // namespace testing | 209 } // namespace testing |
212 } // namespace wasm | 210 } // namespace wasm |
213 } // namespace internal | 211 } // namespace internal |
214 } // namespace v8 | 212 } // namespace v8 |
OLD | NEW |