| 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 #include "src/signature.h" | 5 #include "src/signature.h" |
| 6 | 6 |
| 7 #include "src/bit-vector.h" | 7 #include "src/bit-vector.h" |
| 8 #include "src/flags.h" | 8 #include "src/flags.h" |
| 9 #include "src/handles.h" | 9 #include "src/handles.h" |
| 10 #include "src/zone-containers.h" | 10 #include "src/zone-containers.h" |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 ReturnArityOperand operand(this, pc); | 379 ReturnArityOperand operand(this, pc); |
| 380 return 1 + operand.length; | 380 return 1 + operand.length; |
| 381 } | 381 } |
| 382 | 382 |
| 383 default: | 383 default: |
| 384 return 1; | 384 return 1; |
| 385 } | 385 } |
| 386 } | 386 } |
| 387 }; | 387 }; |
| 388 | 388 |
| 389 | |
| 390 // A shift-reduce-parser strategy for decoding Wasm code that uses an explicit | 389 // A shift-reduce-parser strategy for decoding Wasm code that uses an explicit |
| 391 // shift-reduce strategy with multiple internal stacks. | 390 // shift-reduce strategy with multiple internal stacks. |
| 392 class SR_WasmDecoder : public WasmDecoder { | 391 class SR_WasmDecoder : public WasmDecoder { |
| 393 public: | 392 public: |
| 394 SR_WasmDecoder(Zone* zone, TFBuilder* builder, FunctionBody& body) | 393 SR_WasmDecoder(Zone* zone, TFBuilder* builder, FunctionBody& body) |
| 395 : WasmDecoder(body.module, body.sig, body.start, body.end), | 394 : WasmDecoder(body.module, body.sig, body.start, body.end), |
| 396 zone_(zone), | 395 zone_(zone), |
| 397 builder_(builder), | 396 builder_(builder), |
| 398 base_(body.base), | 397 base_(body.base), |
| 399 local_type_vec_(zone), | 398 local_type_vec_(zone), |
| (...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 } | 1491 } |
| 1493 | 1492 |
| 1494 TreeResult BuildTFGraph(base::AccountingAllocator* allocator, | 1493 TreeResult BuildTFGraph(base::AccountingAllocator* allocator, |
| 1495 TFBuilder* builder, FunctionBody& body) { | 1494 TFBuilder* builder, FunctionBody& body) { |
| 1496 Zone zone(allocator); | 1495 Zone zone(allocator); |
| 1497 SR_WasmDecoder decoder(&zone, builder, body); | 1496 SR_WasmDecoder decoder(&zone, builder, body); |
| 1498 decoder.Decode(); | 1497 decoder.Decode(); |
| 1499 return decoder.toResult<Tree*>(nullptr); | 1498 return decoder.toResult<Tree*>(nullptr); |
| 1500 } | 1499 } |
| 1501 | 1500 |
| 1502 | |
| 1503 std::ostream& operator<<(std::ostream& os, const Tree& tree) { | 1501 std::ostream& operator<<(std::ostream& os, const Tree& tree) { |
| 1504 if (tree.pc == nullptr) { | 1502 if (tree.pc == nullptr) { |
| 1505 os << "null"; | 1503 os << "null"; |
| 1506 return os; | 1504 return os; |
| 1507 } | 1505 } |
| 1508 PrintF("%s", WasmOpcodes::OpcodeName(tree.opcode())); | 1506 PrintF("%s", WasmOpcodes::OpcodeName(tree.opcode())); |
| 1509 if (tree.count > 0) os << "("; | 1507 if (tree.count > 0) os << "("; |
| 1510 for (uint32_t i = 0; i < tree.count; i++) { | 1508 for (uint32_t i = 0; i < tree.count; i++) { |
| 1511 if (i > 0) os << ", "; | 1509 if (i > 0) os << ", "; |
| 1512 os << *tree.children[i]; | 1510 os << *tree.children[i]; |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1648 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 1646 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
| 1649 const byte* start, const byte* end) { | 1647 const byte* start, const byte* end) { |
| 1650 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 1648 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
| 1651 SR_WasmDecoder decoder(zone, nullptr, body); | 1649 SR_WasmDecoder decoder(zone, nullptr, body); |
| 1652 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 1650 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
| 1653 } | 1651 } |
| 1654 | 1652 |
| 1655 } // namespace wasm | 1653 } // namespace wasm |
| 1656 } // namespace internal | 1654 } // namespace internal |
| 1657 } // namespace v8 | 1655 } // namespace v8 |
| OLD | NEW |