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/interpreter/bytecodes.h" | 5 #include "src/interpreter/bytecodes.h" |
6 | 6 |
7 #include <iomanip> | 7 #include <iomanip> |
8 | 8 |
9 #include "src/frames.h" | 9 #include "src/frames.h" |
10 #include "src/interpreter/bytecode-traits.h" | 10 #include "src/interpreter/bytecode-traits.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 OperandSize operand_size = GetOperandSize(bytecode, i, operand_scale); | 143 OperandSize operand_size = GetOperandSize(bytecode, i, operand_scale); |
144 int delta = static_cast<int>(operand_size); | 144 int delta = static_cast<int>(operand_size); |
145 DCHECK(base::bits::IsPowerOfTwo32(static_cast<uint32_t>(delta))); | 145 DCHECK(base::bits::IsPowerOfTwo32(static_cast<uint32_t>(delta))); |
146 size += delta; | 146 size += delta; |
147 } | 147 } |
148 return size; | 148 return size; |
149 } | 149 } |
150 | 150 |
151 | 151 |
152 // static | 152 // static |
| 153 size_t Bytecodes::ReturnCount(Bytecode bytecode) { |
| 154 return bytecode == Bytecode::kReturn ? 1 : 0; |
| 155 } |
| 156 |
| 157 // static |
153 int Bytecodes::NumberOfOperands(Bytecode bytecode) { | 158 int Bytecodes::NumberOfOperands(Bytecode bytecode) { |
154 DCHECK(bytecode <= Bytecode::kLast); | 159 DCHECK(bytecode <= Bytecode::kLast); |
155 switch (bytecode) { | 160 switch (bytecode) { |
156 #define CASE(Name, ...) \ | 161 #define CASE(Name, ...) \ |
157 case Bytecode::k##Name: \ | 162 case Bytecode::k##Name: \ |
158 return BytecodeTraits<__VA_ARGS__>::kOperandCount; | 163 return BytecodeTraits<__VA_ARGS__>::kOperandCount; |
159 BYTECODE_LIST(CASE) | 164 BYTECODE_LIST(CASE) |
160 #undef CASE | 165 #undef CASE |
161 } | 166 } |
162 UNREACHABLE(); | 167 UNREACHABLE(); |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
922 } else { | 927 } else { |
923 std::ostringstream s; | 928 std::ostringstream s; |
924 s << "r" << index(); | 929 s << "r" << index(); |
925 return s.str(); | 930 return s.str(); |
926 } | 931 } |
927 } | 932 } |
928 | 933 |
929 } // namespace interpreter | 934 } // namespace interpreter |
930 } // namespace internal | 935 } // namespace internal |
931 } // namespace v8 | 936 } // namespace v8 |
OLD | NEW |