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_INTERPRETER_BYTECODES_H_ | 5 #ifndef V8_INTERPRETER_BYTECODES_H_ |
6 #define V8_INTERPRETER_BYTECODES_H_ | 6 #define V8_INTERPRETER_BYTECODES_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 | 9 |
10 // Clients of this interface shouldn't depend on lots of interpreter internals. | 10 // Clients of this interface shouldn't depend on lots of interpreter internals. |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 V(CreateClosure, OperandType::kIdx8, OperandType::kImm8) \ | 179 V(CreateClosure, OperandType::kIdx8, OperandType::kImm8) \ |
180 V(CreateClosureWide, OperandType::kIdx16, OperandType::kImm8) \ | 180 V(CreateClosureWide, OperandType::kIdx16, OperandType::kImm8) \ |
181 \ | 181 \ |
182 /* Arguments allocation */ \ | 182 /* Arguments allocation */ \ |
183 V(CreateMappedArguments, OperandType::kNone) \ | 183 V(CreateMappedArguments, OperandType::kNone) \ |
184 V(CreateUnmappedArguments, OperandType::kNone) \ | 184 V(CreateUnmappedArguments, OperandType::kNone) \ |
185 \ | 185 \ |
186 /* Control Flow */ \ | 186 /* Control Flow */ \ |
187 V(Jump, OperandType::kImm8) \ | 187 V(Jump, OperandType::kImm8) \ |
188 V(JumpConstant, OperandType::kIdx8) \ | 188 V(JumpConstant, OperandType::kIdx8) \ |
| 189 V(JumpConstantWide, OperandType::kIdx16) \ |
189 V(JumpIfTrue, OperandType::kImm8) \ | 190 V(JumpIfTrue, OperandType::kImm8) \ |
190 V(JumpIfTrueConstant, OperandType::kIdx8) \ | 191 V(JumpIfTrueConstant, OperandType::kIdx8) \ |
| 192 V(JumpIfTrueConstantWide, OperandType::kIdx16) \ |
191 V(JumpIfFalse, OperandType::kImm8) \ | 193 V(JumpIfFalse, OperandType::kImm8) \ |
192 V(JumpIfFalseConstant, OperandType::kIdx8) \ | 194 V(JumpIfFalseConstant, OperandType::kIdx8) \ |
| 195 V(JumpIfFalseConstantWide, OperandType::kIdx16) \ |
193 V(JumpIfToBooleanTrue, OperandType::kImm8) \ | 196 V(JumpIfToBooleanTrue, OperandType::kImm8) \ |
194 V(JumpIfToBooleanTrueConstant, OperandType::kIdx8) \ | 197 V(JumpIfToBooleanTrueConstant, OperandType::kIdx8) \ |
| 198 V(JumpIfToBooleanTrueConstantWide, OperandType::kIdx16) \ |
195 V(JumpIfToBooleanFalse, OperandType::kImm8) \ | 199 V(JumpIfToBooleanFalse, OperandType::kImm8) \ |
196 V(JumpIfToBooleanFalseConstant, OperandType::kIdx8) \ | 200 V(JumpIfToBooleanFalseConstant, OperandType::kIdx8) \ |
| 201 V(JumpIfToBooleanFalseConstantWide, OperandType::kIdx16) \ |
197 V(JumpIfNull, OperandType::kImm8) \ | 202 V(JumpIfNull, OperandType::kImm8) \ |
198 V(JumpIfNullConstant, OperandType::kIdx8) \ | 203 V(JumpIfNullConstant, OperandType::kIdx8) \ |
| 204 V(JumpIfNullConstantWide, OperandType::kIdx16) \ |
199 V(JumpIfUndefined, OperandType::kImm8) \ | 205 V(JumpIfUndefined, OperandType::kImm8) \ |
200 V(JumpIfUndefinedConstant, OperandType::kIdx8) \ | 206 V(JumpIfUndefinedConstant, OperandType::kIdx8) \ |
| 207 V(JumpIfUndefinedConstantWide, OperandType::kIdx16) \ |
201 \ | 208 \ |
202 /* Complex flow control For..in */ \ | 209 /* Complex flow control For..in */ \ |
203 V(ForInPrepare, OperandType::kReg8, OperandType::kReg8, OperandType::kReg8) \ | 210 V(ForInPrepare, OperandType::kReg8, OperandType::kReg8, OperandType::kReg8) \ |
204 V(ForInDone, OperandType::kReg8, OperandType::kReg8) \ | 211 V(ForInDone, OperandType::kReg8, OperandType::kReg8) \ |
205 V(ForInNext, OperandType::kReg8, OperandType::kReg8, OperandType::kReg8, \ | 212 V(ForInNext, OperandType::kReg8, OperandType::kReg8, OperandType::kReg8, \ |
206 OperandType::kReg8) \ | 213 OperandType::kReg8) \ |
207 V(ForInStep, OperandType::kReg8) \ | 214 V(ForInStep, OperandType::kReg8) \ |
208 \ | 215 \ |
209 /* Non-local flow control */ \ | 216 /* Non-local flow control */ \ |
210 V(Throw, OperandType::kNone) \ | 217 V(Throw, OperandType::kNone) \ |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 static int Size(Bytecode bytecode); | 354 static int Size(Bytecode bytecode); |
348 | 355 |
349 // Returns the size of |operand|. | 356 // Returns the size of |operand|. |
350 static OperandSize SizeOfOperand(OperandType operand); | 357 static OperandSize SizeOfOperand(OperandType operand); |
351 | 358 |
352 // Return true if the bytecode is a conditional jump taking | 359 // Return true if the bytecode is a conditional jump taking |
353 // an immediate byte operand (OperandType::kImm8). | 360 // an immediate byte operand (OperandType::kImm8). |
354 static bool IsConditionalJumpImmediate(Bytecode bytecode); | 361 static bool IsConditionalJumpImmediate(Bytecode bytecode); |
355 | 362 |
356 // Return true if the bytecode is a conditional jump taking | 363 // Return true if the bytecode is a conditional jump taking |
357 // a constant pool entry (OperandType::kIdx). | 364 // a constant pool entry (OperandType::kIdx8). |
358 static bool IsConditionalJumpConstant(Bytecode bytecode); | 365 static bool IsConditionalJumpConstant(Bytecode bytecode); |
359 | 366 |
360 // Return true if the bytecode is a conditional jump taking | 367 // Return true if the bytecode is a conditional jump taking |
| 368 // a constant pool entry (OperandType::kIdx16). |
| 369 static bool IsConditionalJumpConstantWide(Bytecode bytecode); |
| 370 |
| 371 // Return true if the bytecode is a conditional jump taking |
361 // any kind of operand. | 372 // any kind of operand. |
362 static bool IsConditionalJump(Bytecode bytecode); | 373 static bool IsConditionalJump(Bytecode bytecode); |
363 | 374 |
364 // Return true if the bytecode is a jump or a conditional jump taking | 375 // Return true if the bytecode is a jump or a conditional jump taking |
365 // an immediate byte operand (OperandType::kImm8). | 376 // an immediate byte operand (OperandType::kImm8). |
366 static bool IsJumpImmediate(Bytecode bytecode); | 377 static bool IsJumpImmediate(Bytecode bytecode); |
367 | 378 |
368 // Return true if the bytecode is a jump or conditional jump taking a | 379 // Return true if the bytecode is a jump or conditional jump taking a |
369 // constant pool entry (OperandType::kIdx). | 380 // constant pool entry (OperandType::kIdx8). |
370 static bool IsJumpConstant(Bytecode bytecode); | 381 static bool IsJumpConstant(Bytecode bytecode); |
371 | 382 |
| 383 // Return true if the bytecode is a jump or conditional jump taking a |
| 384 // constant pool entry (OperandType::kIdx16). |
| 385 static bool IsJumpConstantWide(Bytecode bytecode); |
| 386 |
372 // Return true if the bytecode is a jump or conditional jump taking | 387 // Return true if the bytecode is a jump or conditional jump taking |
373 // any kind of operand. | 388 // any kind of operand. |
374 static bool IsJump(Bytecode bytecode); | 389 static bool IsJump(Bytecode bytecode); |
375 | 390 |
376 // Return true if the bytecode is a conditional jump, a jump, or a return. | 391 // Return true if the bytecode is a conditional jump, a jump, or a return. |
377 static bool IsJumpOrReturn(Bytecode bytecode); | 392 static bool IsJumpOrReturn(Bytecode bytecode); |
378 | 393 |
379 // Decode a single bytecode and operands to |os|. | 394 // Decode a single bytecode and operands to |os|. |
380 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, | 395 static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, |
381 int number_of_parameters); | 396 int number_of_parameters); |
382 | 397 |
383 private: | 398 private: |
384 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); | 399 DISALLOW_IMPLICIT_CONSTRUCTORS(Bytecodes); |
385 }; | 400 }; |
386 | 401 |
387 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); | 402 std::ostream& operator<<(std::ostream& os, const Bytecode& bytecode); |
388 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 403 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
389 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); | 404 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_type); |
390 | 405 |
391 } // namespace interpreter | 406 } // namespace interpreter |
392 } // namespace internal | 407 } // namespace internal |
393 } // namespace v8 | 408 } // namespace v8 |
394 | 409 |
395 #endif // V8_INTERPRETER_BYTECODES_H_ | 410 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |