| 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 |
| 480 bool Bytecodes::IsBytecodeWithScalableOperands(Bytecode bytecode) { | 485 bool Bytecodes::IsBytecodeWithScalableOperands(Bytecode bytecode) { |
| 481 switch (bytecode) { | 486 switch (bytecode) { |
| 482 #define CASE(Name, ...) \ | 487 #define CASE(Name, ...) \ |
| 483 case Bytecode::k##Name: \ | 488 case Bytecode::k##Name: \ |
| 484 typedef BytecodeTraits<__VA_ARGS__> Name##Trait; \ | 489 typedef BytecodeTraits<__VA_ARGS__> Name##Trait; \ |
| 485 return Name##Trait::IsScalable(); | 490 return Name##Trait::IsScalable(); |
| 486 BYTECODE_LIST(CASE) | 491 BYTECODE_LIST(CASE) |
| 487 #undef CASE | 492 #undef CASE |
| 488 } | 493 } |
| 489 UNREACHABLE(); | 494 UNREACHABLE(); |
| 490 return false; | 495 return false; |
| 491 } | 496 } |
| 492 | 497 |
| 493 // static | 498 // static |
| 494 bool Bytecodes::IsPrefixScalingBytecode(Bytecode bytecode) { | 499 bool Bytecodes::IsPrefixScalingBytecode(Bytecode bytecode) { |
| 495 switch (bytecode) { | 500 switch (bytecode) { |
| 496 case Bytecode::kExtraWide: | 501 case Bytecode::kExtraWide: |
| 497 case Bytecode::kDebugBreakExtraWide: | 502 case Bytecode::kDebugBreakExtraWide: |
| 498 case Bytecode::kWide: | 503 case Bytecode::kWide: |
| 499 case Bytecode::kDebugBreakWide: | 504 case Bytecode::kDebugBreakWide: |
| 500 return true; | 505 return true; |
| 501 default: | 506 default: |
| 502 return false; | 507 return false; |
| 503 } | 508 } |
| 504 } | 509 } |
| 505 | 510 |
| 506 // static | 511 // 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 |