Chromium Code Reviews| Index: src/interpreter/bytecodes.h |
| diff --git a/src/interpreter/bytecodes.h b/src/interpreter/bytecodes.h |
| index bd8ad811987b47d8c183e56462aa6b1fecc73c00..c78c47000ec1ceb58d17a9f5478e044628dcfc9c 100644 |
| --- a/src/interpreter/bytecodes.h |
| +++ b/src/interpreter/bytecodes.h |
| @@ -16,36 +16,24 @@ namespace internal { |
| namespace interpreter { |
| #define INVALID_OPERAND_TYPE_LIST(V) \ |
| - V(None, OperandSize::kNone) |
| - |
| -#define REGISTER_INPUT_OPERAND_TYPE_LIST(V) \ |
| - /* Byte operands. */ \ |
| - V(MaybeReg8, OperandSize::kByte) \ |
| - V(Reg8, OperandSize::kByte) \ |
| - V(RegPair8, OperandSize::kByte) \ |
| - /* Short operands. */ \ |
| - V(MaybeReg16, OperandSize::kShort) \ |
| - V(Reg16, OperandSize::kShort) \ |
| - V(RegPair16, OperandSize::kShort) |
| - |
| -#define REGISTER_OUTPUT_OPERAND_TYPE_LIST(V) \ |
| - /* Byte operands. */ \ |
| - V(RegOut8, OperandSize::kByte) \ |
| - V(RegOutPair8, OperandSize::kByte) \ |
| - V(RegOutTriple8, OperandSize::kByte) \ |
| - /* Short operands. */ \ |
| - V(RegOut16, OperandSize::kShort) \ |
| - V(RegOutPair16, OperandSize::kShort) \ |
| - V(RegOutTriple16, OperandSize::kShort) |
| - |
| -#define SCALAR_OPERAND_TYPE_LIST(V) \ |
| - /* Byte operands. */ \ |
| - V(Idx8, OperandSize::kByte) \ |
| - V(Imm8, OperandSize::kByte) \ |
| - V(RegCount8, OperandSize::kByte) \ |
| - /* Short operands. */ \ |
| - V(Idx16, OperandSize::kShort) \ |
| - V(RegCount16, OperandSize::kShort) |
| + V(None, OperandSize::kNone, OperandTypeTrait::kFixed) |
| + |
| +#define REGISTER_INPUT_OPERAND_TYPE_LIST(V) \ |
| + V(MaybeReg, OperandSize::kByte, OperandTypeTrait::kScalable) \ |
| + V(Reg, OperandSize::kByte, OperandTypeTrait::kScalable) \ |
| + V(RegPair, OperandSize::kByte, OperandTypeTrait::kScalable) |
|
rmcilroy
2016/03/10 16:45:37
Can we get rid of the OperandSize attribute in the
oth
2016/03/11 16:26:12
Acknowledged. Working on it with the signed variat
oth
2016/03/15 09:58:28
Done.
|
| + |
| +#define REGISTER_OUTPUT_OPERAND_TYPE_LIST(V) \ |
| + V(RegOut, OperandSize::kByte, OperandTypeTrait::kScalable) \ |
| + V(RegOutPair, OperandSize::kByte, OperandTypeTrait::kScalable) \ |
| + V(RegOutTriple, OperandSize::kByte, OperandTypeTrait::kScalable) |
| + |
| +#define SCALAR_OPERAND_TYPE_LIST(V) \ |
| + V(Flag8, OperandSize::kByte, OperandTypeTrait::kFixed) \ |
| + V(Idx, OperandSize::kByte, OperandTypeTrait::kScalable) \ |
| + V(Imm, OperandSize::kByte, OperandTypeTrait::kScalable) \ |
| + V(RegCount, OperandSize::kByte, OperandTypeTrait::kScalable) \ |
| + V(RuntimeId, OperandSize::kShort, OperandTypeTrait::kFixed) |
| #define REGISTER_OPERAND_TYPE_LIST(V) \ |
| REGISTER_INPUT_OPERAND_TYPE_LIST(V) \ |
| @@ -61,225 +49,176 @@ namespace interpreter { |
| REGISTER_OPERAND_TYPE_LIST(V) |
| // Define one debug break bytecode for each operands size. |
| -#define DEBUG_BREAK_BYTECODE_LIST(V) \ |
| - V(DebugBreak0, OperandType::kNone) \ |
| - V(DebugBreak1, OperandType::kReg8) \ |
| - V(DebugBreak2, OperandType::kReg16) \ |
| - V(DebugBreak3, OperandType::kReg16, OperandType::kReg8) \ |
| - V(DebugBreak4, OperandType::kReg16, OperandType::kReg16) \ |
| - V(DebugBreak5, OperandType::kReg16, OperandType::kReg16, OperandType::kReg8) \ |
| - V(DebugBreak6, OperandType::kReg16, OperandType::kReg16, \ |
| - OperandType::kReg16) \ |
| - V(DebugBreak7, OperandType::kReg16, OperandType::kReg16, \ |
| - OperandType::kReg16, OperandType::kReg8) \ |
| - V(DebugBreak8, OperandType::kReg16, OperandType::kReg16, \ |
| - OperandType::kReg16, OperandType::kReg16) |
| +#define DEBUG_BREAK_BYTECODE_LIST(V) \ |
| + V(DebugBreak0, OperandType::kNone) \ |
| + V(DebugBreak1, OperandType::kReg) \ |
| + V(DebugBreak2, OperandType::kReg, OperandType::kReg) \ |
| + V(DebugBreak3, OperandType::kReg, OperandType::kReg, OperandType::kReg) \ |
| + V(DebugBreak4, OperandType::kReg, OperandType::kReg, OperandType::kReg, \ |
| + OperandType::kReg) \ |
| + V(DebugBreak5, OperandType::kRuntimeId, OperandType::kReg, \ |
| + OperandType::kReg) \ |
| + V(DebugBreak6, OperandType::kRuntimeId, OperandType::kReg, \ |
| + OperandType::kReg, OperandType::kReg) \ |
| + V(DebugBreak7, OperandType::kIdx, OperandType::kFlag8) \ |
| + V(DebugBreak8, OperandType::kIdx, OperandType::kIdx, OperandType::kFlag8) |
| // The list of bytecodes which are interpreted by the interpreter. |
| -#define BYTECODE_LIST(V) \ |
| - \ |
| - /* Loading the accumulator */ \ |
| - V(LdaZero, OperandType::kNone) \ |
| - V(LdaSmi8, OperandType::kImm8) \ |
| - V(LdaUndefined, OperandType::kNone) \ |
| - V(LdaNull, OperandType::kNone) \ |
| - V(LdaTheHole, OperandType::kNone) \ |
| - V(LdaTrue, OperandType::kNone) \ |
| - V(LdaFalse, OperandType::kNone) \ |
| - V(LdaConstant, OperandType::kIdx8) \ |
| - V(LdaConstantWide, OperandType::kIdx16) \ |
| - \ |
| - /* Globals */ \ |
| - V(LdaGlobal, OperandType::kIdx8, OperandType::kIdx8) \ |
| - V(LdaGlobalInsideTypeof, OperandType::kIdx8, OperandType::kIdx8) \ |
| - V(LdaGlobalWide, OperandType::kIdx16, OperandType::kIdx16) \ |
| - V(LdaGlobalInsideTypeofWide, OperandType::kIdx16, OperandType::kIdx16) \ |
| - V(StaGlobalSloppy, OperandType::kIdx8, OperandType::kIdx8) \ |
| - V(StaGlobalStrict, OperandType::kIdx8, OperandType::kIdx8) \ |
| - V(StaGlobalSloppyWide, OperandType::kIdx16, OperandType::kIdx16) \ |
| - V(StaGlobalStrictWide, OperandType::kIdx16, OperandType::kIdx16) \ |
| - \ |
| - /* Context operations */ \ |
| - V(PushContext, OperandType::kReg8) \ |
| - V(PopContext, OperandType::kReg8) \ |
| - V(LdaContextSlot, OperandType::kReg8, OperandType::kIdx8) \ |
| - V(StaContextSlot, OperandType::kReg8, OperandType::kIdx8) \ |
| - V(LdaContextSlotWide, OperandType::kReg8, OperandType::kIdx16) \ |
| - V(StaContextSlotWide, OperandType::kReg8, OperandType::kIdx16) \ |
| - \ |
| - /* Load-Store lookup slots */ \ |
| - V(LdaLookupSlot, OperandType::kIdx8) \ |
| - V(LdaLookupSlotInsideTypeof, OperandType::kIdx8) \ |
| - V(LdaLookupSlotWide, OperandType::kIdx16) \ |
| - V(LdaLookupSlotInsideTypeofWide, OperandType::kIdx16) \ |
| - V(StaLookupSlotSloppy, OperandType::kIdx8) \ |
| - V(StaLookupSlotStrict, OperandType::kIdx8) \ |
| - V(StaLookupSlotSloppyWide, OperandType::kIdx16) \ |
| - V(StaLookupSlotStrictWide, OperandType::kIdx16) \ |
| - \ |
| - /* Register-accumulator transfers */ \ |
| - V(Ldar, OperandType::kReg8) \ |
| - V(Star, OperandType::kRegOut8) \ |
| - \ |
| - /* Register-register transfers */ \ |
| - V(Mov, OperandType::kReg8, OperandType::kRegOut8) \ |
| - V(MovWide, OperandType::kReg16, OperandType::kRegOut16) \ |
| - \ |
| - /* LoadIC operations */ \ |
| - V(LoadIC, OperandType::kReg8, OperandType::kIdx8, OperandType::kIdx8) \ |
| - V(KeyedLoadIC, OperandType::kReg8, OperandType::kIdx8) \ |
| - V(LoadICWide, OperandType::kReg8, OperandType::kIdx16, OperandType::kIdx16) \ |
| - V(KeyedLoadICWide, OperandType::kReg8, OperandType::kIdx16) \ |
| - \ |
| - /* StoreIC operations */ \ |
| - V(StoreICSloppy, OperandType::kReg8, OperandType::kIdx8, OperandType::kIdx8) \ |
| - V(StoreICStrict, OperandType::kReg8, OperandType::kIdx8, OperandType::kIdx8) \ |
| - V(KeyedStoreICSloppy, OperandType::kReg8, OperandType::kReg8, \ |
| - OperandType::kIdx8) \ |
| - V(KeyedStoreICStrict, OperandType::kReg8, OperandType::kReg8, \ |
| - OperandType::kIdx8) \ |
| - V(StoreICSloppyWide, OperandType::kReg8, OperandType::kIdx16, \ |
| - OperandType::kIdx16) \ |
| - V(StoreICStrictWide, OperandType::kReg8, OperandType::kIdx16, \ |
| - OperandType::kIdx16) \ |
| - V(KeyedStoreICSloppyWide, OperandType::kReg8, OperandType::kReg8, \ |
| - OperandType::kIdx16) \ |
| - V(KeyedStoreICStrictWide, OperandType::kReg8, OperandType::kReg8, \ |
| - OperandType::kIdx16) \ |
| - \ |
| - /* Binary Operators */ \ |
| - V(Add, OperandType::kReg8) \ |
| - V(Sub, OperandType::kReg8) \ |
| - V(Mul, OperandType::kReg8) \ |
| - V(Div, OperandType::kReg8) \ |
| - V(Mod, OperandType::kReg8) \ |
| - V(BitwiseOr, OperandType::kReg8) \ |
| - V(BitwiseXor, OperandType::kReg8) \ |
| - V(BitwiseAnd, OperandType::kReg8) \ |
| - V(ShiftLeft, OperandType::kReg8) \ |
| - V(ShiftRight, OperandType::kReg8) \ |
| - V(ShiftRightLogical, OperandType::kReg8) \ |
| - \ |
| - /* Unary Operators */ \ |
| - V(Inc, OperandType::kNone) \ |
| - V(Dec, OperandType::kNone) \ |
| - V(LogicalNot, OperandType::kNone) \ |
| - V(TypeOf, OperandType::kNone) \ |
| - V(DeletePropertyStrict, OperandType::kReg8) \ |
| - V(DeletePropertySloppy, OperandType::kReg8) \ |
| - \ |
| - /* Call operations */ \ |
| - V(Call, OperandType::kReg8, OperandType::kReg8, OperandType::kRegCount8, \ |
| - OperandType::kIdx8) \ |
| - V(CallWide, OperandType::kReg16, OperandType::kReg16, \ |
| - OperandType::kRegCount16, OperandType::kIdx16) \ |
| - V(TailCall, OperandType::kReg8, OperandType::kReg8, OperandType::kRegCount8, \ |
| - OperandType::kIdx8) \ |
| - V(TailCallWide, OperandType::kReg16, OperandType::kReg16, \ |
| - OperandType::kRegCount16, OperandType::kIdx16) \ |
| - V(CallRuntime, OperandType::kIdx16, OperandType::kMaybeReg8, \ |
| - OperandType::kRegCount8) \ |
| - V(CallRuntimeWide, OperandType::kIdx16, OperandType::kMaybeReg16, \ |
| - OperandType::kRegCount8) \ |
| - V(CallRuntimeForPair, OperandType::kIdx16, OperandType::kMaybeReg8, \ |
| - OperandType::kRegCount8, OperandType::kRegOutPair8) \ |
| - V(CallRuntimeForPairWide, OperandType::kIdx16, OperandType::kMaybeReg16, \ |
| - OperandType::kRegCount8, OperandType::kRegOutPair16) \ |
| - V(CallJSRuntime, OperandType::kIdx16, OperandType::kReg8, \ |
| - OperandType::kRegCount8) \ |
| - V(CallJSRuntimeWide, OperandType::kIdx16, OperandType::kReg16, \ |
| - OperandType::kRegCount16) \ |
| - \ |
| - /* New operator */ \ |
| - V(New, OperandType::kReg8, OperandType::kMaybeReg8, OperandType::kRegCount8) \ |
| - V(NewWide, OperandType::kReg16, OperandType::kMaybeReg16, \ |
| - OperandType::kRegCount16) \ |
| - \ |
| - /* Test Operators */ \ |
| - V(TestEqual, OperandType::kReg8) \ |
| - V(TestNotEqual, OperandType::kReg8) \ |
| - V(TestEqualStrict, OperandType::kReg8) \ |
| - V(TestLessThan, OperandType::kReg8) \ |
| - V(TestGreaterThan, OperandType::kReg8) \ |
| - V(TestLessThanOrEqual, OperandType::kReg8) \ |
| - V(TestGreaterThanOrEqual, OperandType::kReg8) \ |
| - V(TestInstanceOf, OperandType::kReg8) \ |
| - V(TestIn, OperandType::kReg8) \ |
| - \ |
| - /* Cast operators */ \ |
| - V(ToName, OperandType::kNone) \ |
| - V(ToNumber, OperandType::kNone) \ |
| - V(ToObject, OperandType::kNone) \ |
| - \ |
| - /* Literals */ \ |
| - V(CreateRegExpLiteral, OperandType::kIdx8, OperandType::kIdx8, \ |
| - OperandType::kImm8) \ |
| - V(CreateArrayLiteral, OperandType::kIdx8, OperandType::kIdx8, \ |
| - OperandType::kImm8) \ |
| - V(CreateObjectLiteral, OperandType::kIdx8, OperandType::kIdx8, \ |
| - OperandType::kImm8) \ |
| - V(CreateRegExpLiteralWide, OperandType::kIdx16, OperandType::kIdx16, \ |
| - OperandType::kImm8) \ |
| - V(CreateArrayLiteralWide, OperandType::kIdx16, OperandType::kIdx16, \ |
| - OperandType::kImm8) \ |
| - V(CreateObjectLiteralWide, OperandType::kIdx16, OperandType::kIdx16, \ |
| - OperandType::kImm8) \ |
| - \ |
| - /* Closure allocation */ \ |
| - V(CreateClosure, OperandType::kIdx8, OperandType::kImm8) \ |
| - V(CreateClosureWide, OperandType::kIdx16, OperandType::kImm8) \ |
| - \ |
| - /* Arguments allocation */ \ |
| - V(CreateMappedArguments, OperandType::kNone) \ |
| - V(CreateUnmappedArguments, OperandType::kNone) \ |
| - V(CreateRestParameter, OperandType::kNone) \ |
| - \ |
| - /* Control Flow */ \ |
| - V(Jump, OperandType::kImm8) \ |
| - V(JumpConstant, OperandType::kIdx8) \ |
| - V(JumpConstantWide, OperandType::kIdx16) \ |
| - V(JumpIfTrue, OperandType::kImm8) \ |
| - V(JumpIfTrueConstant, OperandType::kIdx8) \ |
| - V(JumpIfTrueConstantWide, OperandType::kIdx16) \ |
| - V(JumpIfFalse, OperandType::kImm8) \ |
| - V(JumpIfFalseConstant, OperandType::kIdx8) \ |
| - V(JumpIfFalseConstantWide, OperandType::kIdx16) \ |
| - V(JumpIfToBooleanTrue, OperandType::kImm8) \ |
| - V(JumpIfToBooleanTrueConstant, OperandType::kIdx8) \ |
| - V(JumpIfToBooleanTrueConstantWide, OperandType::kIdx16) \ |
| - V(JumpIfToBooleanFalse, OperandType::kImm8) \ |
| - V(JumpIfToBooleanFalseConstant, OperandType::kIdx8) \ |
| - V(JumpIfToBooleanFalseConstantWide, OperandType::kIdx16) \ |
| - V(JumpIfNull, OperandType::kImm8) \ |
| - V(JumpIfNullConstant, OperandType::kIdx8) \ |
| - V(JumpIfNullConstantWide, OperandType::kIdx16) \ |
| - V(JumpIfUndefined, OperandType::kImm8) \ |
| - V(JumpIfUndefinedConstant, OperandType::kIdx8) \ |
| - V(JumpIfUndefinedConstantWide, OperandType::kIdx16) \ |
| - V(JumpIfNotHole, OperandType::kImm8) \ |
| - V(JumpIfNotHoleConstant, OperandType::kIdx8) \ |
| - V(JumpIfNotHoleConstantWide, OperandType::kIdx16) \ |
| - \ |
| - /* Complex flow control For..in */ \ |
| - V(ForInPrepare, OperandType::kRegOutTriple8) \ |
| - V(ForInPrepareWide, OperandType::kRegOutTriple16) \ |
| - V(ForInDone, OperandType::kReg8, OperandType::kReg8) \ |
| - V(ForInNext, OperandType::kReg8, OperandType::kReg8, OperandType::kRegPair8, \ |
| - OperandType::kIdx8) \ |
| - V(ForInNextWide, OperandType::kReg16, OperandType::kReg16, \ |
| - OperandType::kRegPair16, OperandType::kIdx16) \ |
| - V(ForInStep, OperandType::kReg8) \ |
| - \ |
| - /* Perform a stack guard check */ \ |
| - V(StackCheck, OperandType::kNone) \ |
| - \ |
| - /* Non-local flow control */ \ |
| - V(Throw, OperandType::kNone) \ |
| - V(ReThrow, OperandType::kNone) \ |
| - V(Return, OperandType::kNone) \ |
| - \ |
| - /* Debugger */ \ |
| - V(Debugger, OperandType::kNone) \ |
| +#define BYTECODE_LIST(V) \ |
| + /* Extended width operands */ \ |
| + V(Wide, OperandType::kNone) \ |
| + V(ExtraWide, OperandType::kNone) \ |
| + \ |
| + /* Loading the accumulator */ \ |
| + V(LdaZero, OperandType::kNone) \ |
| + V(LdaSmi, OperandType::kImm) \ |
| + V(LdaUndefined, OperandType::kNone) \ |
| + V(LdaNull, OperandType::kNone) \ |
| + V(LdaTheHole, OperandType::kNone) \ |
| + V(LdaTrue, OperandType::kNone) \ |
| + V(LdaFalse, OperandType::kNone) \ |
| + V(LdaConstant, OperandType::kIdx) \ |
| + \ |
| + /* Globals */ \ |
| + V(LdaGlobal, OperandType::kIdx, OperandType::kIdx) \ |
| + V(LdaGlobalInsideTypeof, OperandType::kIdx, OperandType::kIdx) \ |
| + V(StaGlobalSloppy, OperandType::kIdx, OperandType::kIdx) \ |
| + V(StaGlobalStrict, OperandType::kIdx, OperandType::kIdx) \ |
| + \ |
| + /* Context operations */ \ |
| + V(PushContext, OperandType::kReg) \ |
| + V(PopContext, OperandType::kReg) \ |
| + V(LdaContextSlot, OperandType::kReg, OperandType::kIdx) \ |
| + V(StaContextSlot, OperandType::kReg, OperandType::kIdx) \ |
| + \ |
| + /* Load-Store lookup slots */ \ |
| + V(LdaLookupSlot, OperandType::kIdx) \ |
| + V(LdaLookupSlotInsideTypeof, OperandType::kIdx) \ |
| + V(StaLookupSlotSloppy, OperandType::kIdx) \ |
| + V(StaLookupSlotStrict, OperandType::kIdx) \ |
| + \ |
| + /* Register-accumulator transfers */ \ |
| + V(Ldar, OperandType::kReg) \ |
| + V(Star, OperandType::kRegOut) \ |
| + \ |
| + /* Register-register transfers */ \ |
| + V(Mov, OperandType::kReg, OperandType::kRegOut) \ |
| + \ |
| + /* LoadIC operations */ \ |
| + V(LoadIC, OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \ |
| + V(KeyedLoadIC, OperandType::kReg, OperandType::kIdx) \ |
| + \ |
| + /* StoreIC operations */ \ |
| + V(StoreICSloppy, OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \ |
| + V(StoreICStrict, OperandType::kReg, OperandType::kIdx, OperandType::kIdx) \ |
| + V(KeyedStoreICSloppy, OperandType::kReg, OperandType::kReg, \ |
| + OperandType::kIdx) \ |
| + V(KeyedStoreICStrict, OperandType::kReg, OperandType::kReg, \ |
| + OperandType::kIdx) \ |
| + \ |
| + /* Binary Operators */ \ |
| + V(Add, OperandType::kReg) \ |
| + V(Sub, OperandType::kReg) \ |
| + V(Mul, OperandType::kReg) \ |
| + V(Div, OperandType::kReg) \ |
| + V(Mod, OperandType::kReg) \ |
| + V(BitwiseOr, OperandType::kReg) \ |
| + V(BitwiseXor, OperandType::kReg) \ |
| + V(BitwiseAnd, OperandType::kReg) \ |
| + V(ShiftLeft, OperandType::kReg) \ |
| + V(ShiftRight, OperandType::kReg) \ |
| + V(ShiftRightLogical, OperandType::kReg) \ |
| + \ |
| + /* Unary Operators */ \ |
| + V(Inc, OperandType::kNone) \ |
| + V(Dec, OperandType::kNone) \ |
| + V(LogicalNot, OperandType::kNone) \ |
| + V(TypeOf, OperandType::kNone) \ |
| + V(DeletePropertyStrict, OperandType::kReg) \ |
| + V(DeletePropertySloppy, OperandType::kReg) \ |
| + \ |
| + /* Call operations */ \ |
| + V(Call, OperandType::kReg, OperandType::kReg, OperandType::kRegCount, \ |
| + OperandType::kIdx) \ |
| + V(TailCall, OperandType::kReg, OperandType::kReg, OperandType::kRegCount, \ |
| + OperandType::kIdx) \ |
| + V(CallRuntime, OperandType::kRuntimeId, OperandType::kMaybeReg, \ |
| + OperandType::kRegCount) \ |
| + V(CallRuntimeForPair, OperandType::kRuntimeId, OperandType::kMaybeReg, \ |
| + OperandType::kRegCount, OperandType::kRegOutPair) \ |
| + V(CallJSRuntime, OperandType::kIdx, OperandType::kReg, \ |
| + OperandType::kRegCount) \ |
| + \ |
| + /* New operator */ \ |
| + V(New, OperandType::kReg, OperandType::kMaybeReg, OperandType::kRegCount) \ |
| + \ |
| + /* Test Operators */ \ |
| + V(TestEqual, OperandType::kReg) \ |
| + V(TestNotEqual, OperandType::kReg) \ |
| + V(TestEqualStrict, OperandType::kReg) \ |
| + V(TestLessThan, OperandType::kReg) \ |
| + V(TestGreaterThan, OperandType::kReg) \ |
| + V(TestLessThanOrEqual, OperandType::kReg) \ |
| + V(TestGreaterThanOrEqual, OperandType::kReg) \ |
| + V(TestInstanceOf, OperandType::kReg) \ |
| + V(TestIn, OperandType::kReg) \ |
| + \ |
| + /* Cast operators */ \ |
| + V(ToName, OperandType::kNone) \ |
| + V(ToNumber, OperandType::kNone) \ |
| + V(ToObject, OperandType::kNone) \ |
| + \ |
| + /* Literals */ \ |
| + V(CreateRegExpLiteral, OperandType::kIdx, OperandType::kIdx, \ |
| + OperandType::kFlag8) \ |
| + V(CreateArrayLiteral, OperandType::kIdx, OperandType::kIdx, \ |
| + OperandType::kFlag8) \ |
| + V(CreateObjectLiteral, OperandType::kIdx, OperandType::kIdx, \ |
| + OperandType::kFlag8) \ |
| + \ |
| + /* Closure allocation */ \ |
| + V(CreateClosure, OperandType::kIdx, OperandType::kFlag8) \ |
| + \ |
| + /* Arguments allocation */ \ |
| + V(CreateMappedArguments, OperandType::kNone) \ |
| + V(CreateUnmappedArguments, OperandType::kNone) \ |
| + V(CreateRestParameter, OperandType::kNone) \ |
| + \ |
| + /* Control Flow */ \ |
| + V(Jump, OperandType::kImm) \ |
| + V(JumpConstant, OperandType::kIdx) \ |
| + V(JumpIfTrue, OperandType::kImm) \ |
| + V(JumpIfTrueConstant, OperandType::kIdx) \ |
| + V(JumpIfFalse, OperandType::kImm) \ |
| + V(JumpIfFalseConstant, OperandType::kIdx) \ |
| + V(JumpIfToBooleanTrue, OperandType::kImm) \ |
| + V(JumpIfToBooleanTrueConstant, OperandType::kIdx) \ |
| + V(JumpIfToBooleanFalse, OperandType::kImm) \ |
| + V(JumpIfToBooleanFalseConstant, OperandType::kIdx) \ |
| + V(JumpIfNull, OperandType::kImm) \ |
| + V(JumpIfNullConstant, OperandType::kIdx) \ |
| + V(JumpIfUndefined, OperandType::kImm) \ |
| + V(JumpIfUndefinedConstant, OperandType::kIdx) \ |
| + V(JumpIfNotHole, OperandType::kImm) \ |
| + V(JumpIfNotHoleConstant, OperandType::kIdx) \ |
| + \ |
| + /* Complex flow control For..in */ \ |
| + V(ForInPrepare, OperandType::kRegOutTriple) \ |
| + V(ForInDone, OperandType::kReg, OperandType::kReg) \ |
| + V(ForInNext, OperandType::kReg, OperandType::kReg, OperandType::kRegPair, \ |
| + OperandType::kIdx) \ |
| + V(ForInStep, OperandType::kReg) \ |
| + \ |
| + /* Perform a stack guard check */ \ |
| + V(StackCheck, OperandType::kNone) \ |
| + \ |
| + /* Non-local flow control */ \ |
| + V(Throw, OperandType::kNone) \ |
| + V(ReThrow, OperandType::kNone) \ |
| + V(Return, OperandType::kNone) \ |
| + \ |
| + /* Debugger */ \ |
| + V(Debugger, OperandType::kNone) \ |
| DEBUG_BREAK_BYTECODE_LIST(V) |
| // Enumeration of the size classes of operand types used by bytecodes. |
| @@ -287,15 +226,18 @@ enum class OperandSize : uint8_t { |
| kNone = 0, |
| kByte = 1, |
| kShort = 2, |
| + kQuad = 4, |
| + kLast = kQuad |
| }; |
| +enum class OperandTypeTrait : uint8_t { kScalable = 0, kFixed = 1 }; |
| // Enumeration of operand types used by bytecodes. |
| enum class OperandType : uint8_t { |
| -#define DECLARE_OPERAND_TYPE(Name, _) k##Name, |
| +#define DECLARE_OPERAND_TYPE(Name, _, __) k##Name, |
| OPERAND_TYPE_LIST(DECLARE_OPERAND_TYPE) |
| #undef DECLARE_OPERAND_TYPE |
| -#define COUNT_OPERAND_TYPES(x, _) +1 |
| +#define COUNT_OPERAND_TYPES(x, _, __) +1 |
| // The COUNT_OPERAND macro will turn this into kLast = -1 +1 +1... which will |
| // evaluate to the same value as the last operand. |
| kLast = -1 OPERAND_TYPE_LIST(COUNT_OPERAND_TYPES) |
| @@ -417,57 +359,54 @@ class Bytecodes { |
| // Returns the number of register operands expected by |bytecode|. |
| static int NumberOfRegisterOperands(Bytecode bytecode); |
| + // Returns the scaling applied to scalable operands if bytecode is |
| + // is a scaling prefix, returns 1 otherwise.. |
| + static int GetPrefixBytecodeScale(Bytecode bytecode); |
|
rmcilroy
2016/03/10 16:45:37
Could we have this return operand sizes instead (i
oth
2016/03/11 16:26:12
Ack. Leaving this to last piece to try in the CL.
oth
2016/03/15 09:58:28
We have a difference of opinion here. I pushed thi
rmcilroy
2016/03/16 11:55:53
Ok, can we make this an enum then? It doesn't seem
oth
2016/03/17 13:48:38
Done.
|
| + |
| // Returns the i-th operand of |bytecode|. |
| static OperandType GetOperandType(Bytecode bytecode, int i); |
| // Returns the size of the i-th operand of |bytecode|. |
| - static OperandSize GetOperandSize(Bytecode bytecode, int i); |
| + static OperandSize GetOperandSize(Bytecode bytecode, int i, int scale); |
| // Returns the offset of the i-th operand of |bytecode| relative to the start |
| // of the bytecode. |
| - static int GetOperandOffset(Bytecode bytecode, int i); |
| + static int GetOperandOffset(Bytecode bytecode, int i, int scale); |
| // Returns a zero-based bitmap of the register operand positions of |
| // |bytecode|. |
| static int GetRegisterOperandBitmap(Bytecode bytecode); |
| // Returns a debug break bytecode with a matching operand size. |
| - static Bytecode GetDebugBreak(Bytecode bytecode); |
| + static Bytecode GetDebugBreak(Bytecode bytecode, int scale); |
| - // Returns the size of the bytecode including its operands. |
| - static int Size(Bytecode bytecode); |
| + // Returns the size of the bytecode including its operands and |
| + // prefix byte when scaling active. |
| + static int Size(Bytecode bytecode, int operand_scale); |
| // Returns the size of |operand|. |
| - static OperandSize SizeOfOperand(OperandType operand); |
| + static OperandSize SizeOfOperand(OperandType operand, int scale); |
| // Returns true if the bytecode is a conditional jump taking |
| - // an immediate byte operand (OperandType::kImm8). |
| + // an immediate byte operand (OperandType::kImm). |
| static bool IsConditionalJumpImmediate(Bytecode bytecode); |
| // Returns true if the bytecode is a conditional jump taking |
| - // a constant pool entry (OperandType::kIdx8). |
| + // a constant pool entry (OperandType::kIdx). |
| static bool IsConditionalJumpConstant(Bytecode bytecode); |
| // Returns true if the bytecode is a conditional jump taking |
| - // a constant pool entry (OperandType::kIdx16). |
| - static bool IsConditionalJumpConstantWide(Bytecode bytecode); |
| - |
| - // Returns true if the bytecode is a conditional jump taking |
| // any kind of operand. |
| static bool IsConditionalJump(Bytecode bytecode); |
| // Returns true if the bytecode is a jump or a conditional jump taking |
| - // an immediate byte operand (OperandType::kImm8). |
| + // an immediate byte operand (OperandType::kImm). |
| static bool IsJumpImmediate(Bytecode bytecode); |
| // Returns true if the bytecode is a jump or conditional jump taking a |
| - // constant pool entry (OperandType::kIdx8). |
| + // constant pool entry (OperandType::kIdx). |
| static bool IsJumpConstant(Bytecode bytecode); |
| - // Returns true if the bytecode is a jump or conditional jump taking a |
| - // constant pool entry (OperandType::kIdx16). |
| - static bool IsJumpConstantWide(Bytecode bytecode); |
| - |
| // Returns true if the bytecode is a jump or conditional jump taking |
| // any kind of operand. |
| static bool IsJump(Bytecode bytecode); |
| @@ -484,14 +423,20 @@ class Bytecodes { |
| // Returns true if the bytecode is a debug break. |
| static bool IsDebugBreak(Bytecode bytecode); |
| - // Returns true if |operand_type| is a register index operand (kIdx8/kIdx16). |
| + // Returns true if the bytecode has wider operand forms. |
| + static bool IsBytecodeWithScalableOperands(Bytecode bytecode); |
| + |
| + // Returns true if |operand_type| is a register index operand (kFlag8). |
| + static bool IsFlagOperandType(OperandType operand_type); |
| + |
| + // Returns true if |operand_type| is a register index operand (kIdx). |
| static bool IsIndexOperandType(OperandType operand_type); |
| // Returns true if |operand_type| represents an immediate. |
| static bool IsImmediateOperandType(OperandType operand_type); |
| // Returns true if |operand_type| is a register count operand |
| - // (kRegCount8/kRegCount16). |
| + // (kRegCount). |
| static bool IsRegisterCountOperandType(OperandType operand_type); |
| // Returns true if |operand_type| is any type of register operand. |
| @@ -504,9 +449,12 @@ class Bytecodes { |
| static bool IsRegisterOutputOperandType(OperandType operand_type); |
| // Returns true if |operand_type| is a maybe register operand |
| - // (kMaybeReg8/kMaybeReg16). |
| + // (kMaybeReg). |
| static bool IsMaybeRegisterOperandType(OperandType operand_type); |
| + // Returns true if |operand_type| is a runtime-id id operand (kRuntimeId). |
|
rmcilroy
2016/03/10 16:45:37
remove second "id"
oth
2016/03/11 16:26:12
Done.
|
| + static bool IsRuntimeIdOperandType(OperandType operand_type); |
| + |
| // Decode a single bytecode and operands to |os|. |
| static std::ostream& Decode(std::ostream& os, const uint8_t* bytecode_start, |
| int number_of_parameters); |