| Index: src/interpreter/bytecodes.h
|
| diff --git a/src/interpreter/bytecodes.h b/src/interpreter/bytecodes.h
|
| index 05c0afe8f6bacd2ea33142eeee53d78c38762f6f..9122df45b60fc20e5f0f8433c9c551d5a5b16778 100644
|
| --- a/src/interpreter/bytecodes.h
|
| +++ b/src/interpreter/bytecodes.h
|
| @@ -312,14 +312,6 @@ enum class Bytecode : uint8_t {
|
| #undef COUNT_BYTECODE
|
| };
|
|
|
| -// TODO(rmcilroy): Remove once we switch to MSVC 2015 which supports constexpr.
|
| -// See crbug.com/603131.
|
| -#if V8_CC_MSVC
|
| -#define CONSTEXPR const
|
| -#else
|
| -#define CONSTEXPR constexpr
|
| -#endif
|
| -
|
| class V8_EXPORT_PRIVATE Bytecodes final {
|
| public:
|
| // The maximum number of operands a bytecode may have.
|
| @@ -387,14 +379,12 @@ class V8_EXPORT_PRIVATE Bytecodes final {
|
|
|
| // Returns true if |bytecode| reads the accumulator.
|
| static bool ReadsAccumulator(Bytecode bytecode) {
|
| - return (GetAccumulatorUse(bytecode) & AccumulatorUse::kRead) ==
|
| - AccumulatorUse::kRead;
|
| + return BytecodeOperands::ReadsAccumulator(GetAccumulatorUse(bytecode));
|
| }
|
|
|
| // Returns true if |bytecode| writes the accumulator.
|
| static bool WritesAccumulator(Bytecode bytecode) {
|
| - return (GetAccumulatorUse(bytecode) & AccumulatorUse::kWrite) ==
|
| - AccumulatorUse::kWrite;
|
| + return BytecodeOperands::WritesAccumulator(GetAccumulatorUse(bytecode));
|
| }
|
|
|
| // Return true if |bytecode| writes the accumulator with a boolean value.
|
| @@ -422,7 +412,7 @@ class V8_EXPORT_PRIVATE Bytecodes final {
|
|
|
| // Return true if |bytecode| is an accumulator load without effects,
|
| // e.g. LdaConstant, LdaTrue, Ldar.
|
| - static CONSTEXPR bool IsAccumulatorLoadWithoutEffects(Bytecode bytecode) {
|
| + static constexpr bool IsAccumulatorLoadWithoutEffects(Bytecode bytecode) {
|
| return bytecode == Bytecode::kLdar || bytecode == Bytecode::kLdaZero ||
|
| bytecode == Bytecode::kLdaSmi || bytecode == Bytecode::kLdaNull ||
|
| bytecode == Bytecode::kLdaTrue || bytecode == Bytecode::kLdaFalse ||
|
| @@ -435,14 +425,14 @@ class V8_EXPORT_PRIVATE Bytecodes final {
|
|
|
| // Return true if |bytecode| is a register load without effects,
|
| // e.g. Mov, Star.
|
| - static CONSTEXPR bool IsRegisterLoadWithoutEffects(Bytecode bytecode) {
|
| + static constexpr bool IsRegisterLoadWithoutEffects(Bytecode bytecode) {
|
| return bytecode == Bytecode::kMov || bytecode == Bytecode::kPopContext ||
|
| bytecode == Bytecode::kPushContext || bytecode == Bytecode::kStar;
|
| }
|
|
|
| // Returns true if the bytecode is a conditional jump taking
|
| // an immediate byte operand (OperandType::kImm).
|
| - static CONSTEXPR bool IsConditionalJumpImmediate(Bytecode bytecode) {
|
| + static constexpr bool IsConditionalJumpImmediate(Bytecode bytecode) {
|
| return bytecode == Bytecode::kJumpIfTrue ||
|
| bytecode == Bytecode::kJumpIfFalse ||
|
| bytecode == Bytecode::kJumpIfToBooleanTrue ||
|
| @@ -454,7 +444,7 @@ class V8_EXPORT_PRIVATE Bytecodes final {
|
|
|
| // Returns true if the bytecode is a conditional jump taking
|
| // a constant pool entry (OperandType::kIdx).
|
| - static CONSTEXPR bool IsConditionalJumpConstant(Bytecode bytecode) {
|
| + static constexpr bool IsConditionalJumpConstant(Bytecode bytecode) {
|
| return bytecode == Bytecode::kJumpIfTrueConstant ||
|
| bytecode == Bytecode::kJumpIfFalseConstant ||
|
| bytecode == Bytecode::kJumpIfToBooleanTrueConstant ||
|
| @@ -466,34 +456,34 @@ class V8_EXPORT_PRIVATE Bytecodes final {
|
|
|
| // Returns true if the bytecode is a conditional jump taking
|
| // any kind of operand.
|
| - static CONSTEXPR bool IsConditionalJump(Bytecode bytecode) {
|
| + static constexpr bool IsConditionalJump(Bytecode bytecode) {
|
| return IsConditionalJumpImmediate(bytecode) ||
|
| IsConditionalJumpConstant(bytecode);
|
| }
|
|
|
| // Returns true if the bytecode is an unconditional jump.
|
| - static CONSTEXPR bool IsUnconditionalJump(Bytecode bytecode) {
|
| + static constexpr bool IsUnconditionalJump(Bytecode bytecode) {
|
| return bytecode == Bytecode::kJump || bytecode == Bytecode::kJumpConstant ||
|
| bytecode == Bytecode::kJumpLoop;
|
| }
|
|
|
| // Returns true if the bytecode is a jump or a conditional jump taking
|
| // an immediate byte operand (OperandType::kImm).
|
| - static CONSTEXPR bool IsJumpImmediate(Bytecode bytecode) {
|
| + static constexpr bool IsJumpImmediate(Bytecode bytecode) {
|
| return bytecode == Bytecode::kJump || bytecode == Bytecode::kJumpLoop ||
|
| IsConditionalJumpImmediate(bytecode);
|
| }
|
|
|
| // Returns true if the bytecode is a jump or conditional jump taking a
|
| // constant pool entry (OperandType::kIdx).
|
| - static CONSTEXPR bool IsJumpConstant(Bytecode bytecode) {
|
| + static constexpr bool IsJumpConstant(Bytecode bytecode) {
|
| return bytecode == Bytecode::kJumpConstant ||
|
| IsConditionalJumpConstant(bytecode);
|
| }
|
|
|
| // Returns true if the bytecode is a jump that internally coerces the
|
| // accumulator to a boolean.
|
| - static CONSTEXPR bool IsJumpIfToBoolean(Bytecode bytecode) {
|
| + static constexpr bool IsJumpIfToBoolean(Bytecode bytecode) {
|
| return bytecode == Bytecode::kJumpIfToBooleanTrue ||
|
| bytecode == Bytecode::kJumpIfToBooleanFalse ||
|
| bytecode == Bytecode::kJumpIfToBooleanTrueConstant ||
|
| @@ -502,68 +492,68 @@ class V8_EXPORT_PRIVATE Bytecodes final {
|
|
|
| // Returns true if the bytecode is a jump or conditional jump taking
|
| // any kind of operand.
|
| - static CONSTEXPR bool IsJump(Bytecode bytecode) {
|
| + static constexpr bool IsJump(Bytecode bytecode) {
|
| return IsJumpImmediate(bytecode) || IsJumpConstant(bytecode);
|
| }
|
|
|
| // Returns true if the bytecode is a forward jump or conditional jump taking
|
| // any kind of operand.
|
| - static CONSTEXPR bool IsForwardJump(Bytecode bytecode) {
|
| + static constexpr bool IsForwardJump(Bytecode bytecode) {
|
| return bytecode != Bytecode::kJumpLoop && IsJump(bytecode);
|
| }
|
|
|
| // Returns true if the bytecode is a conditional jump, a jump, or a return.
|
| - static CONSTEXPR bool IsJumpOrReturn(Bytecode bytecode) {
|
| + static constexpr bool IsJumpOrReturn(Bytecode bytecode) {
|
| return bytecode == Bytecode::kReturn || IsJump(bytecode);
|
| }
|
|
|
| // Return true if |bytecode| is a jump without effects,
|
| // e.g. any jump excluding those that include type coercion like
|
| // JumpIfTrueToBoolean.
|
| - static CONSTEXPR bool IsJumpWithoutEffects(Bytecode bytecode) {
|
| + static constexpr bool IsJumpWithoutEffects(Bytecode bytecode) {
|
| return IsJump(bytecode) && !IsJumpIfToBoolean(bytecode);
|
| }
|
|
|
| // Returns true if |bytecode| has no effects. These bytecodes only manipulate
|
| // interpreter frame state and will never throw.
|
| - static CONSTEXPR bool IsWithoutExternalSideEffects(Bytecode bytecode) {
|
| + static constexpr bool IsWithoutExternalSideEffects(Bytecode bytecode) {
|
| return (IsAccumulatorLoadWithoutEffects(bytecode) ||
|
| IsRegisterLoadWithoutEffects(bytecode) ||
|
| bytecode == Bytecode::kNop || IsJumpWithoutEffects(bytecode));
|
| }
|
|
|
| // Returns true if the bytecode is Ldar or Star.
|
| - static CONSTEXPR bool IsLdarOrStar(Bytecode bytecode) {
|
| + static constexpr bool IsLdarOrStar(Bytecode bytecode) {
|
| return bytecode == Bytecode::kLdar || bytecode == Bytecode::kStar;
|
| }
|
|
|
| // Returns true if |bytecode| puts a name in the accumulator.
|
| - static CONSTEXPR bool PutsNameInAccumulator(Bytecode bytecode) {
|
| + static constexpr bool PutsNameInAccumulator(Bytecode bytecode) {
|
| return bytecode == Bytecode::kTypeOf;
|
| }
|
|
|
| // Returns true if the bytecode is a call or a constructor call.
|
| - static CONSTEXPR bool IsCallOrNew(Bytecode bytecode) {
|
| + static constexpr bool IsCallOrNew(Bytecode bytecode) {
|
| return bytecode == Bytecode::kCall || bytecode == Bytecode::kCallProperty ||
|
| bytecode == Bytecode::kTailCall || bytecode == Bytecode::kNew;
|
| }
|
|
|
| // Returns true if the bytecode is a call to the runtime.
|
| - static CONSTEXPR bool IsCallRuntime(Bytecode bytecode) {
|
| + static constexpr bool IsCallRuntime(Bytecode bytecode) {
|
| return bytecode == Bytecode::kCallRuntime ||
|
| bytecode == Bytecode::kCallRuntimeForPair ||
|
| bytecode == Bytecode::kInvokeIntrinsic;
|
| }
|
|
|
| // Returns true if the bytecode is a scaling prefix bytecode.
|
| - static CONSTEXPR bool IsPrefixScalingBytecode(Bytecode bytecode) {
|
| + static constexpr bool IsPrefixScalingBytecode(Bytecode bytecode) {
|
| return bytecode == Bytecode::kExtraWide || bytecode == Bytecode::kWide ||
|
| bytecode == Bytecode::kDebugBreakExtraWide ||
|
| bytecode == Bytecode::kDebugBreakWide;
|
| }
|
|
|
| // Returns the number of values which |bytecode| returns.
|
| - static CONSTEXPR size_t ReturnCount(Bytecode bytecode) {
|
| + static constexpr size_t ReturnCount(Bytecode bytecode) {
|
| return bytecode == Bytecode::kReturn ? 1 : 0;
|
| }
|
|
|
| @@ -748,10 +738,6 @@ class V8_EXPORT_PRIVATE Bytecodes final {
|
| static const OperandSize* const kOperandSizes[][3];
|
| };
|
|
|
| -// TODO(rmcilroy): Remove once we switch to MSVC 2015 which supports constexpr.
|
| -// See crbug.com/603131.
|
| -#undef CONSTEXPR
|
| -
|
| V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream& os,
|
| const Bytecode& bytecode);
|
|
|
|
|