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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 module->module_start + module->functions[i].code_start_offset, | 140 module->module_start + module->functions[i].code_start_offset, |
141 module->module_start + module->functions[i].code_end_offset}; | 141 module->module_start + module->functions[i].code_end_offset}; |
142 DecodeResult result = VerifyWasmCode(isolate->allocator(), body); | 142 DecodeResult result = VerifyWasmCode(isolate->allocator(), body); |
143 if (result.failed()) { | 143 if (result.failed()) { |
144 thrower->Error("Function did not verify"); | 144 thrower->Error("Function did not verify"); |
145 return -1; | 145 return -1; |
146 } | 146 } |
147 } | 147 } |
148 | 148 |
149 // The code verifies, we create an instance to run it in the interpreter. | 149 // The code verifies, we create an instance to run it in the interpreter. |
150 WasmModuleInstance instance(module); | 150 WasmInstance instance(module); |
151 instance.context = isolate->native_context(); | 151 instance.context = isolate->native_context(); |
152 instance.mem_size = GetMinModuleMemSize(module); | 152 instance.mem_size = GetMinModuleMemSize(module); |
153 // TODO(ahaas): Move memory allocation to wasm-module.cc for better | 153 // TODO(ahaas): Move memory allocation to wasm-module.cc for better |
154 // encapsulation. | 154 // encapsulation. |
155 instance.mem_start = | 155 instance.mem_start = |
156 static_cast<byte*>(calloc(GetMinModuleMemSize(module), 1)); | 156 static_cast<byte*>(calloc(GetMinModuleMemSize(module), 1)); |
157 instance.globals_start = nullptr; | 157 instance.globals_start = nullptr; |
158 module_env.instance = &instance; | 158 module_env.instance = &instance; |
159 | 159 |
160 WasmInterpreter interpreter(&instance, isolate->allocator()); | 160 WasmInterpreter interpreter(&instance, isolate->allocator()); |
(...skipping 61 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 |