| 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 1656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1667 PrintF("%s", WasmOpcodes::OpcodeName(tree.opcode())); | 1667 PrintF("%s", WasmOpcodes::OpcodeName(tree.opcode())); |
| 1668 if (tree.count > 0) os << "("; | 1668 if (tree.count > 0) os << "("; |
| 1669 for (uint32_t i = 0; i < tree.count; i++) { | 1669 for (uint32_t i = 0; i < tree.count; i++) { |
| 1670 if (i > 0) os << ", "; | 1670 if (i > 0) os << ", "; |
| 1671 os << *tree.children[i]; | 1671 os << *tree.children[i]; |
| 1672 } | 1672 } |
| 1673 if (tree.count > 0) os << ")"; | 1673 if (tree.count > 0) os << ")"; |
| 1674 return os; | 1674 return os; |
| 1675 } | 1675 } |
| 1676 | 1676 |
| 1677 | |
| 1678 ReadUnsignedLEB128ErrorCode ReadUnsignedLEB128Operand(const byte* pc, | |
| 1679 const byte* limit, | |
| 1680 int* length, | |
| 1681 uint32_t* result) { | |
| 1682 Decoder decoder(pc, limit); | |
| 1683 *result = decoder.checked_read_u32v(pc, 0, length); | |
| 1684 if (decoder.ok()) return kNoError; | |
| 1685 return (limit - pc) > 1 ? kInvalidLEB128 : kMissingLEB128; | |
| 1686 } | |
| 1687 | |
| 1688 int OpcodeLength(const byte* pc, const byte* end) { | 1677 int OpcodeLength(const byte* pc, const byte* end) { |
| 1689 WasmDecoder decoder(nullptr, nullptr, pc, end); | 1678 WasmDecoder decoder(nullptr, nullptr, pc, end); |
| 1690 return decoder.OpcodeLength(pc); | 1679 return decoder.OpcodeLength(pc); |
| 1691 } | 1680 } |
| 1692 | 1681 |
| 1693 int OpcodeArity(ModuleEnv* module, FunctionSig* sig, const byte* pc, | 1682 int OpcodeArity(ModuleEnv* module, FunctionSig* sig, const byte* pc, |
| 1694 const byte* end) { | 1683 const byte* end) { |
| 1695 WasmDecoder decoder(module, sig, pc, end); | 1684 WasmDecoder decoder(module, sig, pc, end); |
| 1696 return decoder.OpcodeArity(pc); | 1685 return decoder.OpcodeArity(pc); |
| 1697 } | 1686 } |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1787 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, | 1776 BitVector* AnalyzeLoopAssignmentForTesting(Zone* zone, size_t num_locals, |
| 1788 const byte* start, const byte* end) { | 1777 const byte* start, const byte* end) { |
| 1789 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; | 1778 FunctionBody body = {nullptr, nullptr, nullptr, start, end}; |
| 1790 SR_WasmDecoder decoder(zone, nullptr, body); | 1779 SR_WasmDecoder decoder(zone, nullptr, body); |
| 1791 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); | 1780 return decoder.AnalyzeLoopAssignmentForTesting(start, num_locals); |
| 1792 } | 1781 } |
| 1793 | 1782 |
| 1794 } // namespace wasm | 1783 } // namespace wasm |
| 1795 } // namespace internal | 1784 } // namespace internal |
| 1796 } // namespace v8 | 1785 } // namespace v8 |
| OLD | NEW |