| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 FunctionSig* GetFunctionSignature(uint32_t index) { | 174 FunctionSig* GetFunctionSignature(uint32_t index) { |
| 175 DCHECK(IsValidFunction(index)); | 175 DCHECK(IsValidFunction(index)); |
| 176 return module->functions->at(index).sig; | 176 return module->functions->at(index).sig; |
| 177 } | 177 } |
| 178 FunctionSig* GetSignature(uint32_t index) { | 178 FunctionSig* GetSignature(uint32_t index) { |
| 179 DCHECK(IsValidSignature(index)); | 179 DCHECK(IsValidSignature(index)); |
| 180 return module->signatures->at(index); | 180 return module->signatures->at(index); |
| 181 } | 181 } |
| 182 size_t FunctionTableSize() { | 182 size_t FunctionTableSize() { |
| 183 return module ? module->function_table->size() : 0; | 183 return module && module->function_table ? module->function_table->size() |
| 184 : 0; |
| 184 } | 185 } |
| 185 | 186 |
| 186 Handle<Code> GetFunctionCode(uint32_t index); | 187 Handle<Code> GetFunctionCode(uint32_t index); |
| 187 Handle<FixedArray> GetFunctionTable(); | 188 Handle<FixedArray> GetFunctionTable(); |
| 188 | 189 |
| 189 compiler::CallDescriptor* GetWasmCallDescriptor(Zone* zone, FunctionSig* sig); | 190 compiler::CallDescriptor* GetWasmCallDescriptor(Zone* zone, FunctionSig* sig); |
| 190 compiler::CallDescriptor* GetCallDescriptor(Zone* zone, uint32_t index); | 191 compiler::CallDescriptor* GetCallDescriptor(Zone* zone, uint32_t index); |
| 191 }; | 192 }; |
| 192 | 193 |
| 193 std::ostream& operator<<(std::ostream& os, const WasmModule& module); | 194 std::ostream& operator<<(std::ostream& os, const WasmModule& module); |
| 194 std::ostream& operator<<(std::ostream& os, const WasmFunction& function); | 195 std::ostream& operator<<(std::ostream& os, const WasmFunction& function); |
| 195 | 196 |
| 196 typedef Result<WasmModule*> ModuleResult; | 197 typedef Result<WasmModule*> ModuleResult; |
| 197 typedef Result<WasmFunction*> FunctionResult; | 198 typedef Result<WasmFunction*> FunctionResult; |
| 198 | 199 |
| 199 // For testing. Decode, verify, and run the last exported function in the | 200 // For testing. Decode, verify, and run the last exported function in the |
| 200 // given encoded module. | 201 // given encoded module. |
| 201 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, | 202 int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, |
| 202 const byte* module_end, bool asm_js = false); | 203 const byte* module_end, bool asm_js = false); |
| 203 | 204 |
| 204 // For testing. Decode, verify, and run the last exported function in the | 205 // For testing. Decode, verify, and run the last exported function in the |
| 205 // given decoded module. | 206 // given decoded module. |
| 206 int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module); | 207 int32_t CompileAndRunWasmModule(Isolate* isolate, WasmModule* module); |
| 207 } // namespace wasm | 208 } // namespace wasm |
| 208 } // namespace internal | 209 } // namespace internal |
| 209 } // namespace v8 | 210 } // namespace v8 |
| 210 | 211 |
| 211 #endif // V8_WASM_MODULE_H_ | 212 #endif // V8_WASM_MODULE_H_ |
| OLD | NEW |