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/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 } | 470 } |
471 return false; | 471 return false; |
472 } | 472 } |
473 | 473 |
474 // static | 474 // static |
475 bool Bytecodes::IsLdarOrStar(Bytecode bytecode) { | 475 bool Bytecodes::IsLdarOrStar(Bytecode bytecode) { |
476 return bytecode == Bytecode::kLdar || bytecode == Bytecode::kStar; | 476 return bytecode == Bytecode::kLdar || bytecode == Bytecode::kStar; |
477 } | 477 } |
478 | 478 |
479 // static | 479 // static |
480 bool Bytecodes::IsLdaSmiOrLdaZero(Bytecode bytecode) { | |
481 return bytecode == Bytecode::kLdaSmi || bytecode == Bytecode::kLdaZero; | |
482 } | |
483 | |
484 // static | |
485 bool Bytecodes::IsBytecodeWithScalableOperands(Bytecode bytecode) { | 480 bool Bytecodes::IsBytecodeWithScalableOperands(Bytecode bytecode) { |
486 switch (bytecode) { | 481 switch (bytecode) { |
487 #define CASE(Name, ...) \ | 482 #define CASE(Name, ...) \ |
488 case Bytecode::k##Name: \ | 483 case Bytecode::k##Name: \ |
489 typedef BytecodeTraits<__VA_ARGS__> Name##Trait; \ | 484 typedef BytecodeTraits<__VA_ARGS__> Name##Trait; \ |
490 return Name##Trait::IsScalable(); | 485 return Name##Trait::IsScalable(); |
491 BYTECODE_LIST(CASE) | 486 BYTECODE_LIST(CASE) |
492 #undef CASE | 487 #undef CASE |
493 } | 488 } |
494 UNREACHABLE(); | 489 UNREACHABLE(); |
495 return false; | 490 return false; |
496 } | 491 } |
497 | 492 |
498 // static | 493 // static |
499 bool Bytecodes::IsPrefixScalingBytecode(Bytecode bytecode) { | 494 bool Bytecodes::IsPrefixScalingBytecode(Bytecode bytecode) { |
500 switch (bytecode) { | 495 switch (bytecode) { |
501 case Bytecode::kExtraWide: | 496 case Bytecode::kExtraWide: |
502 case Bytecode::kDebugBreakExtraWide: | 497 case Bytecode::kDebugBreakExtraWide: |
503 case Bytecode::kWide: | 498 case Bytecode::kWide: |
504 case Bytecode::kDebugBreakWide: | 499 case Bytecode::kDebugBreakWide: |
505 return true; | 500 return true; |
506 default: | 501 default: |
507 return false; | 502 return false; |
508 } | 503 } |
509 } | 504 } |
510 | 505 |
511 // static | 506 // static |
| 507 bool Bytecodes::PutsNameInAccumulator(Bytecode bytecode) { |
| 508 return bytecode == Bytecode::kToName || bytecode == Bytecode::kTypeOf; |
| 509 } |
| 510 |
| 511 // static |
512 bool Bytecodes::IsJumpOrReturn(Bytecode bytecode) { | 512 bool Bytecodes::IsJumpOrReturn(Bytecode bytecode) { |
513 return bytecode == Bytecode::kReturn || IsJump(bytecode); | 513 return bytecode == Bytecode::kReturn || IsJump(bytecode); |
514 } | 514 } |
515 | 515 |
516 // static | 516 // static |
517 bool Bytecodes::IsMaybeRegisterOperandType(OperandType operand_type) { | 517 bool Bytecodes::IsMaybeRegisterOperandType(OperandType operand_type) { |
518 return operand_type == OperandType::kMaybeReg; | 518 return operand_type == OperandType::kMaybeReg; |
519 } | 519 } |
520 | 520 |
521 // static | 521 // static |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
647 return os << Bytecodes::OperandScaleToString(operand_scale); | 647 return os << Bytecodes::OperandScaleToString(operand_scale); |
648 } | 648 } |
649 | 649 |
650 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type) { | 650 std::ostream& operator<<(std::ostream& os, const OperandType& operand_type) { |
651 return os << Bytecodes::OperandTypeToString(operand_type); | 651 return os << Bytecodes::OperandTypeToString(operand_type); |
652 } | 652 } |
653 | 653 |
654 } // namespace interpreter | 654 } // namespace interpreter |
655 } // namespace internal | 655 } // namespace internal |
656 } // namespace v8 | 656 } // namespace v8 |
OLD | NEW |