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 <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/api.h" | 10 #include "src/api.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 uint32_t name_offset; // offset in the module bytes of the name, if any. | 109 uint32_t name_offset; // offset in the module bytes of the name, if any. |
110 uint32_t name_length; // length in bytes of the name. | 110 uint32_t name_length; // length in bytes of the name. |
111 uint32_t code_start_offset; // offset in the module bytes of code start. | 111 uint32_t code_start_offset; // offset in the module bytes of code start. |
112 uint32_t code_end_offset; // offset in the module bytes of code end. | 112 uint32_t code_end_offset; // offset in the module bytes of code end. |
113 bool imported; | 113 bool imported; |
114 bool exported; | 114 bool exported; |
115 }; | 115 }; |
116 | 116 |
117 // Static representation of a wasm global variable. | 117 // Static representation of a wasm global variable. |
118 struct WasmGlobal { | 118 struct WasmGlobal { |
119 LocalType type; // type of the global. | 119 ValueType type; // type of the global. |
120 bool mutability; // {true} if mutable. | 120 bool mutability; // {true} if mutable. |
121 WasmInitExpr init; // the initialization expression of the global. | 121 WasmInitExpr init; // the initialization expression of the global. |
122 uint32_t offset; // offset into global memory. | 122 uint32_t offset; // offset into global memory. |
123 bool imported; // true if imported. | 123 bool imported; // true if imported. |
124 bool exported; // true if exported. | 124 bool exported; // true if exported. |
125 }; | 125 }; |
126 | 126 |
127 // Static representation of a wasm data segment. | 127 // Static representation of a wasm data segment. |
128 struct WasmDataSegment { | 128 struct WasmDataSegment { |
129 WasmInitExpr dest_addr; // destination memory address of the data. | 129 WasmInitExpr dest_addr; // destination memory address of the data. |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 } | 313 } |
314 bool IsValidFunction(uint32_t index) const { | 314 bool IsValidFunction(uint32_t index) const { |
315 return module && index < module->functions.size(); | 315 return module && index < module->functions.size(); |
316 } | 316 } |
317 bool IsValidSignature(uint32_t index) const { | 317 bool IsValidSignature(uint32_t index) const { |
318 return module && index < module->signatures.size(); | 318 return module && index < module->signatures.size(); |
319 } | 319 } |
320 bool IsValidTable(uint32_t index) const { | 320 bool IsValidTable(uint32_t index) const { |
321 return module && index < module->function_tables.size(); | 321 return module && index < module->function_tables.size(); |
322 } | 322 } |
323 LocalType GetGlobalType(uint32_t index) { | 323 ValueType GetGlobalType(uint32_t index) { |
324 DCHECK(IsValidGlobal(index)); | 324 DCHECK(IsValidGlobal(index)); |
325 return module->globals[index].type; | 325 return module->globals[index].type; |
326 } | 326 } |
327 FunctionSig* GetFunctionSignature(uint32_t index) { | 327 FunctionSig* GetFunctionSignature(uint32_t index) { |
328 DCHECK(IsValidFunction(index)); | 328 DCHECK(IsValidFunction(index)); |
329 return module->functions[index].sig; | 329 return module->functions[index].sig; |
330 } | 330 } |
331 FunctionSig* GetSignature(uint32_t index) { | 331 FunctionSig* GetSignature(uint32_t index) { |
332 DCHECK(IsValidSignature(index)); | 332 DCHECK(IsValidSignature(index)); |
333 return module->signatures[index]; | 333 return module->signatures[index]; |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); | 439 void ValidateModuleState(Isolate* isolate, Handle<WasmModuleObject> module_obj); |
440 void ValidateOrphanedInstance(Isolate* isolate, | 440 void ValidateOrphanedInstance(Isolate* isolate, |
441 Handle<WasmInstanceObject> instance); | 441 Handle<WasmInstanceObject> instance); |
442 | 442 |
443 } // namespace testing | 443 } // namespace testing |
444 } // namespace wasm | 444 } // namespace wasm |
445 } // namespace internal | 445 } // namespace internal |
446 } // namespace v8 | 446 } // namespace v8 |
447 | 447 |
448 #endif // V8_WASM_MODULE_H_ | 448 #endif // V8_WASM_MODULE_H_ |
OLD | NEW |