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 | |
158 int Bytecodes::NumberOfOperands(Bytecode bytecode) { | 153 int Bytecodes::NumberOfOperands(Bytecode bytecode) { |
159 DCHECK(bytecode <= Bytecode::kLast); | 154 DCHECK(bytecode <= Bytecode::kLast); |
160 switch (bytecode) { | 155 switch (bytecode) { |
161 #define CASE(Name, ...) \ | 156 #define CASE(Name, ...) \ |
162 case Bytecode::k##Name: \ | 157 case Bytecode::k##Name: \ |
163 return BytecodeTraits<__VA_ARGS__>::kOperandCount; | 158 return BytecodeTraits<__VA_ARGS__>::kOperandCount; |
164 BYTECODE_LIST(CASE) | 159 BYTECODE_LIST(CASE) |
165 #undef CASE | 160 #undef CASE |
166 } | 161 } |
167 UNREACHABLE(); | 162 UNREACHABLE(); |
(...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 } else { | 922 } else { |
928 std::ostringstream s; | 923 std::ostringstream s; |
929 s << "r" << index(); | 924 s << "r" << index(); |
930 return s.str(); | 925 return s.str(); |
931 } | 926 } |
932 } | 927 } |
933 | 928 |
934 } // namespace interpreter | 929 } // namespace interpreter |
935 } // namespace internal | 930 } // namespace internal |
936 } // namespace v8 | 931 } // namespace v8 |
OLD | NEW |