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 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 | 488 |
489 // Returns true if |bytecode| reads the accumulator. | 489 // Returns true if |bytecode| reads the accumulator. |
490 static bool ReadsAccumulator(Bytecode bytecode); | 490 static bool ReadsAccumulator(Bytecode bytecode); |
491 | 491 |
492 // Returns true if |bytecode| writes the accumulator. | 492 // Returns true if |bytecode| writes the accumulator. |
493 static bool WritesAccumulator(Bytecode bytecode); | 493 static bool WritesAccumulator(Bytecode bytecode); |
494 | 494 |
495 // Return true if |bytecode| writes the accumulator with a boolean value. | 495 // Return true if |bytecode| writes the accumulator with a boolean value. |
496 static bool WritesBooleanToAccumulator(Bytecode bytecode); | 496 static bool WritesBooleanToAccumulator(Bytecode bytecode); |
497 | 497 |
498 // Return true if |bytecode| is an accumulator load bytecode, | 498 // Return true if |bytecode| is an accumulator load without effects, |
499 // e.g. LdaConstant, LdaTrue, Ldar. | 499 // e.g. LdaConstant, LdaTrue, Ldar. |
500 static bool IsAccumulatorLoadWithoutEffects(Bytecode bytecode); | 500 static bool IsAccumulatorLoadWithoutEffects(Bytecode bytecode); |
501 | 501 |
| 502 // Return true if |bytecode| is a jump without effects, |
| 503 // e.g. any jump excluding those that include type coercion like |
| 504 // JumpIfTrueToBoolean. |
| 505 static bool IsJumpWithoutEffects(Bytecode bytecode); |
| 506 |
| 507 // Return true if |bytecode| is a register load without effects, |
| 508 // e.g. Mov, Star, LdrUndefined. |
| 509 static bool IsRegisterLoadWithoutEffects(Bytecode bytecode); |
| 510 |
| 511 // Returns true if |bytecode| has no effects. |
| 512 static bool IsWithoutExternalSideEffects(Bytecode bytecode); |
| 513 |
502 // Returns the i-th operand of |bytecode|. | 514 // Returns the i-th operand of |bytecode|. |
503 static OperandType GetOperandType(Bytecode bytecode, int i); | 515 static OperandType GetOperandType(Bytecode bytecode, int i); |
504 | 516 |
505 // Returns a pointer to an array of operand types terminated in | 517 // Returns a pointer to an array of operand types terminated in |
506 // OperandType::kNone. | 518 // OperandType::kNone. |
507 static const OperandType* GetOperandTypes(Bytecode bytecode); | 519 static const OperandType* GetOperandTypes(Bytecode bytecode); |
508 | 520 |
509 // Returns the size of the i-th operand of |bytecode|. | 521 // Returns the size of the i-th operand of |bytecode|. |
510 static OperandSize GetOperandSize(Bytecode bytecode, int i, | 522 static OperandSize GetOperandSize(Bytecode bytecode, int i, |
511 OperandScale operand_scale); | 523 OperandScale operand_scale); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 593 |
582 // Returns true if the bytecode is Ldar or Star. | 594 // Returns true if the bytecode is Ldar or Star. |
583 static bool IsLdarOrStar(Bytecode bytecode); | 595 static bool IsLdarOrStar(Bytecode bytecode); |
584 | 596 |
585 // Returns true if the bytecode has wider operand forms. | 597 // Returns true if the bytecode has wider operand forms. |
586 static bool IsBytecodeWithScalableOperands(Bytecode bytecode); | 598 static bool IsBytecodeWithScalableOperands(Bytecode bytecode); |
587 | 599 |
588 // Returns true if the bytecode is a scaling prefix bytecode. | 600 // Returns true if the bytecode is a scaling prefix bytecode. |
589 static bool IsPrefixScalingBytecode(Bytecode bytecode); | 601 static bool IsPrefixScalingBytecode(Bytecode bytecode); |
590 | 602 |
591 // Returns true if the bytecode has no effects outside the current | |
592 // interpreter frame. | |
593 static bool IsWithoutExternalSideEffects(Bytecode bytecode); | |
594 | |
595 // Returns true if |operand_type| is any type of register operand. | 603 // Returns true if |operand_type| is any type of register operand. |
596 static bool IsRegisterOperandType(OperandType operand_type); | 604 static bool IsRegisterOperandType(OperandType operand_type); |
597 | 605 |
598 // Returns true if |operand_type| represents a register used as an input. | 606 // Returns true if |operand_type| represents a register used as an input. |
599 static bool IsRegisterInputOperandType(OperandType operand_type); | 607 static bool IsRegisterInputOperandType(OperandType operand_type); |
600 | 608 |
601 // Returns true if |operand_type| represents a register used as an output. | 609 // Returns true if |operand_type| represents a register used as an output. |
602 static bool IsRegisterOutputOperandType(OperandType operand_type); | 610 static bool IsRegisterOutputOperandType(OperandType operand_type); |
603 | 611 |
604 // Returns the number of registers represented by a register operand. For | 612 // Returns the number of registers represented by a register operand. For |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); | 681 std::ostream& operator<<(std::ostream& os, const AccumulatorUse& use); |
674 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); | 682 std::ostream& operator<<(std::ostream& os, const OperandScale& operand_scale); |
675 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); | 683 std::ostream& operator<<(std::ostream& os, const OperandSize& operand_size); |
676 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); | 684 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type); |
677 | 685 |
678 } // namespace interpreter | 686 } // namespace interpreter |
679 } // namespace internal | 687 } // namespace internal |
680 } // namespace v8 | 688 } // namespace v8 |
681 | 689 |
682 #endif // V8_INTERPRETER_BYTECODES_H_ | 690 #endif // V8_INTERPRETER_BYTECODES_H_ |
OLD | NEW |