Index: src/interpreter/bytecodes.h |
diff --git a/src/interpreter/bytecodes.h b/src/interpreter/bytecodes.h |
index 8aea91fd577a44f6427c62eaac2ce9dab9d5cdf2..3d61786fb09e16d67b0beaa6286193469eac1663 100644 |
--- a/src/interpreter/bytecodes.h |
+++ b/src/interpreter/bytecodes.h |
@@ -391,14 +391,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. |
@@ -466,14 +458,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. |
@@ -502,7 +492,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 || |
@@ -515,124 +505,124 @@ 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::kJumpIfToBooleanTrue && |
bytecode <= Bytecode::kJumpIfNotHole; |
} |
// 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::kJumpIfNullConstant && |
bytecode <= Bytecode::kJumpIfToBooleanFalseConstant; |
} |
// 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 bytecode >= Bytecode::kJumpIfNullConstant && |
bytecode <= Bytecode::kJumpIfNotHole; |
} |
// Returns true if the bytecode is an unconditional jump. |
- static CONSTEXPR bool IsUnconditionalJump(Bytecode bytecode) { |
+ static constexpr bool IsUnconditionalJump(Bytecode bytecode) { |
return bytecode >= Bytecode::kJumpLoop && |
bytecode <= Bytecode::kJumpConstant; |
} |
// 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 && |
bytecode <= Bytecode::kJumpIfToBooleanFalseConstant; |
} |
// 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::kJumpIfToBooleanTrueConstant && |
bytecode <= Bytecode::kJumpIfToBooleanFalse; |
} |
// 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 bytecode >= Bytecode::kJumpLoop && |
bytecode <= Bytecode::kJumpIfNotHole; |
} |
// 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::kJump && bytecode <= Bytecode::kJumpIfNotHole; |
} |
// 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; |
} |
@@ -817,10 +807,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); |