| 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_AST_DECODER_H_ | 5 #ifndef V8_WASM_AST_DECODER_H_ |
| 6 #define V8_WASM_AST_DECODER_H_ | 6 #define V8_WASM_AST_DECODER_H_ |
| 7 | 7 |
| 8 #include "src/signature.h" | 8 #include "src/signature.h" |
| 9 #include "src/wasm/decoder.h" | 9 #include "src/wasm/decoder.h" |
| 10 #include "src/wasm/wasm-opcodes.h" | 10 #include "src/wasm/wasm-opcodes.h" |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 230 } |
| 231 | 231 |
| 232 struct DecodeStruct { | 232 struct DecodeStruct { |
| 233 int unused; | 233 int unused; |
| 234 }; | 234 }; |
| 235 typedef Result<DecodeStruct*> DecodeResult; | 235 typedef Result<DecodeStruct*> DecodeResult; |
| 236 inline std::ostream& operator<<(std::ostream& os, const DecodeStruct& tree) { | 236 inline std::ostream& operator<<(std::ostream& os, const DecodeStruct& tree) { |
| 237 return os; | 237 return os; |
| 238 } | 238 } |
| 239 | 239 |
| 240 DecodeResult VerifyWasmCode(base::AccountingAllocator* allocator, | 240 DecodeResult VerifyWasmCode(AccountingAllocator* allocator, FunctionBody& body); |
| 241 FunctionBody& body); | 241 DecodeResult BuildTFGraph(AccountingAllocator* allocator, TFBuilder* builder, |
| 242 DecodeResult BuildTFGraph(base::AccountingAllocator* allocator, | 242 FunctionBody& body); |
| 243 TFBuilder* builder, FunctionBody& body); | 243 bool PrintAst(AccountingAllocator* allocator, const FunctionBody& body, |
| 244 bool PrintAst(base::AccountingAllocator* allocator, const FunctionBody& body, | |
| 245 std::ostream& os, | 244 std::ostream& os, |
| 246 std::vector<std::tuple<uint32_t, int, int>>* offset_table); | 245 std::vector<std::tuple<uint32_t, int, int>>* offset_table); |
| 247 | 246 |
| 248 // A simplified form of AST printing, e.g. from a debugger. | 247 // A simplified form of AST printing, e.g. from a debugger. |
| 249 void PrintAstForDebugging(const byte* start, const byte* end); | 248 void PrintAstForDebugging(const byte* start, const byte* end); |
| 250 | 249 |
| 251 inline DecodeResult VerifyWasmCode(base::AccountingAllocator* allocator, | 250 inline DecodeResult VerifyWasmCode(AccountingAllocator* allocator, |
| 252 ModuleEnv* module, FunctionSig* sig, | 251 ModuleEnv* module, FunctionSig* sig, |
| 253 const byte* start, const byte* end) { | 252 const byte* start, const byte* end) { |
| 254 FunctionBody body = {module, sig, nullptr, start, end}; | 253 FunctionBody body = {module, sig, nullptr, start, end}; |
| 255 return VerifyWasmCode(allocator, body); | 254 return VerifyWasmCode(allocator, body); |
| 256 } | 255 } |
| 257 | 256 |
| 258 inline DecodeResult BuildTFGraph(base::AccountingAllocator* allocator, | 257 inline DecodeResult BuildTFGraph(AccountingAllocator* allocator, |
| 259 TFBuilder* builder, ModuleEnv* module, | 258 TFBuilder* builder, ModuleEnv* module, |
| 260 FunctionSig* sig, const byte* start, | 259 FunctionSig* sig, const byte* start, |
| 261 const byte* end) { | 260 const byte* end) { |
| 262 FunctionBody body = {module, sig, nullptr, start, end}; | 261 FunctionBody body = {module, sig, nullptr, start, end}; |
| 263 return BuildTFGraph(allocator, builder, body); | 262 return BuildTFGraph(allocator, builder, body); |
| 264 } | 263 } |
| 265 | 264 |
| 266 struct AstLocalDecls { | 265 struct AstLocalDecls { |
| 267 // The size of the encoded declarations. | 266 // The size of the encoded declarations. |
| 268 uint32_t decls_encoded_size; // size of encoded declarations | 267 uint32_t decls_encoded_size; // size of encoded declarations |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 } | 338 } |
| 340 | 339 |
| 341 bool has_next() { return pc_ < end_; } | 340 bool has_next() { return pc_ < end_; } |
| 342 }; | 341 }; |
| 343 | 342 |
| 344 } // namespace wasm | 343 } // namespace wasm |
| 345 } // namespace internal | 344 } // namespace internal |
| 346 } // namespace v8 | 345 } // namespace v8 |
| 347 | 346 |
| 348 #endif // V8_WASM_AST_DECODER_H_ | 347 #endif // V8_WASM_AST_DECODER_H_ |
| OLD | NEW |