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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 } | 47 } |
48 | 48 |
49 const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate, | 49 const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate, |
50 ErrorThrower* thrower, | 50 ErrorThrower* thrower, |
51 const WasmModule* module) { | 51 const WasmModule* module) { |
52 CHECK(module != nullptr); | 52 CHECK(module != nullptr); |
53 | 53 |
54 if (module->import_table.size() > 0) { | 54 if (module->import_table.size() > 0) { |
55 thrower->CompileError("Not supported: module has imports."); | 55 thrower->CompileError("Not supported: module has imports."); |
56 } | 56 } |
57 if (module->export_table.size() == 0) { | 57 |
58 thrower->CompileError("Not supported: module has no exports."); | |
59 } | |
60 if (thrower->error()) return Handle<JSObject>::null(); | 58 if (thrower->error()) return Handle<JSObject>::null(); |
61 | 59 |
62 // Although we decoded the module for some pre-validation, run the bytes | 60 // Although we decoded the module for some pre-validation, run the bytes |
63 // again through the normal pipeline. | 61 // again through the normal pipeline. |
64 // TODO(wasm): Use {module} instead of decoding the module bytes again. | 62 // TODO(wasm): Use {module} instead of decoding the module bytes again. |
65 MaybeHandle<JSObject> module_object = CreateModuleObjectFromBytes( | 63 MaybeHandle<JSObject> module_object = CreateModuleObjectFromBytes( |
66 isolate, module->module_start, module->module_end, thrower, | 64 isolate, module->module_start, module->module_end, thrower, |
67 ModuleOrigin::kWasmOrigin, Handle<Script>::null(), nullptr, nullptr); | 65 ModuleOrigin::kWasmOrigin, Handle<Script>::null(), nullptr, nullptr); |
68 if (module_object.is_null()) { | 66 if (module_object.is_null()) { |
69 thrower->CompileError("Module pre-validation failed."); | 67 thrower->CompileError("Module pre-validation failed."); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 221 |
224 void SetupIsolateForWasmModule(Isolate* isolate) { | 222 void SetupIsolateForWasmModule(Isolate* isolate) { |
225 WasmJs::InstallWasmMapsIfNeeded(isolate, isolate->native_context()); | 223 WasmJs::InstallWasmMapsIfNeeded(isolate, isolate->native_context()); |
226 WasmJs::InstallWasmModuleSymbolIfNeeded(isolate, isolate->global_object(), | 224 WasmJs::InstallWasmModuleSymbolIfNeeded(isolate, isolate->global_object(), |
227 isolate->native_context()); | 225 isolate->native_context()); |
228 } | 226 } |
229 } // namespace testing | 227 } // namespace testing |
230 } // namespace wasm | 228 } // namespace wasm |
231 } // namespace internal | 229 } // namespace internal |
232 } // namespace v8 | 230 } // namespace v8 |
OLD | NEW |