| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef V8_WASM_MODULE_H_ | 5 #ifndef V8_WASM_MODULE_H_ |
| 6 #define V8_WASM_MODULE_H_ | 6 #define V8_WASM_MODULE_H_ |
| 7 | 7 |
| 8 #include "src/wasm/wasm-opcodes.h" | 8 #include "src/wasm/wasm-opcodes.h" |
| 9 #include "src/wasm/wasm-result.h" | 9 #include "src/wasm/wasm-result.h" |
| 10 | 10 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 size_t mem_size; // size of the linear memory. | 229 size_t mem_size; // size of the linear memory. |
| 230 // -- raw globals ----------------------------------------------------------- | 230 // -- raw globals ----------------------------------------------------------- |
| 231 byte* globals_start; // start of the globals area. | 231 byte* globals_start; // start of the globals area. |
| 232 | 232 |
| 233 explicit WasmModuleInstance(const WasmModule* m) | 233 explicit WasmModuleInstance(const WasmModule* m) |
| 234 : module(m), | 234 : module(m), |
| 235 function_code(m->functions.size()), | 235 function_code(m->functions.size()), |
| 236 mem_start(nullptr), | 236 mem_start(nullptr), |
| 237 mem_size(0), | 237 mem_size(0), |
| 238 globals_start(nullptr) {} | 238 globals_start(nullptr) {} |
| 239 void PopulateExportTable(const std::vector<Handle<Code>>& compiled_functions, |
| 240 const std::vector<uint16_t>& functions); |
| 239 }; | 241 }; |
| 240 | 242 |
| 241 // forward declaration. | |
| 242 class WasmLinker; | |
| 243 | |
| 244 // Interface provided to the decoder/graph builder which contains only | 243 // Interface provided to the decoder/graph builder which contains only |
| 245 // minimal information about the globals, functions, and function tables. | 244 // minimal information about the globals, functions, and function tables. |
| 246 struct ModuleEnv { | 245 struct ModuleEnv { |
| 247 const WasmModule* module; | 246 const WasmModule* module; |
| 248 WasmModuleInstance* instance; | 247 WasmModuleInstance* instance; |
| 249 WasmLinker* linker; | |
| 250 ModuleOrigin origin; | 248 ModuleOrigin origin; |
| 251 | 249 |
| 252 bool IsValidGlobal(uint32_t index) { | 250 bool IsValidGlobal(uint32_t index) { |
| 253 return module && index < module->globals.size(); | 251 return module && index < module->globals.size(); |
| 254 } | 252 } |
| 255 bool IsValidFunction(uint32_t index) const { | 253 bool IsValidFunction(uint32_t index) const { |
| 256 return module && index < module->functions.size(); | 254 return module && index < module->functions.size(); |
| 257 } | 255 } |
| 258 bool IsValidSignature(uint32_t index) { | 256 bool IsValidSignature(uint32_t index) { |
| 259 return module && index < module->signatures.size(); | 257 return module && index < module->signatures.size(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 // secure. If it turns out that we need more complete checks, we could add a | 327 // secure. If it turns out that we need more complete checks, we could add a |
| 330 // special marker as internal field, which will definitely never occur anywhere | 328 // special marker as internal field, which will definitely never occur anywhere |
| 331 // else. | 329 // else. |
| 332 bool IsWasmObject(Handle<JSObject> object); | 330 bool IsWasmObject(Handle<JSObject> object); |
| 333 | 331 |
| 334 } // namespace wasm | 332 } // namespace wasm |
| 335 } // namespace internal | 333 } // namespace internal |
| 336 } // namespace v8 | 334 } // namespace v8 |
| 337 | 335 |
| 338 #endif // V8_WASM_MODULE_H_ | 336 #endif // V8_WASM_MODULE_H_ |
| OLD | NEW |