Commit 9e3e2ee2 authored by mythria's avatar mythria Committed by Commit bot

[Interpreter] Assign feedback slots for binary operations and use them in ignition.

Assign feedback slots in the type feedback vector for binary operations.
Update bytecode-generator to use these slots and add them as an operand
to binary operations.

BUG=v8:4280
LOG=N

Review-Url: https://codereview.chromium.org/2209633002
Cr-Commit-Position: refs/heads/master@{#38408}
parent 5e685567
......@@ -353,6 +353,7 @@ void AstNumberingVisitor::VisitBinaryOperation(BinaryOperation* node) {
node->set_base_id(ReserveIdRange(BinaryOperation::num_ids()));
Visit(node->left());
Visit(node->right());
ReserveFeedbackSlots(node);
}
......
......@@ -289,6 +289,9 @@ void CountOperation::AssignFeedbackVectorSlots(Isolate* isolate,
FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) {
AssignVectorSlots(expression(), spec, &slot_);
// Assign a slot to collect feedback about binary operations. Used only in
// ignition. Fullcodegen uses AstId to record type feedback.
binary_operation_slot_ = spec->AddGeneralSlot();
}
......@@ -734,6 +737,22 @@ void BinaryOperation::RecordToBooleanTypeFeedback(TypeFeedbackOracle* oracle) {
set_to_boolean_types(oracle->ToBooleanTypes(right()->test_id()));
}
void BinaryOperation::AssignFeedbackVectorSlots(
Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache) {
// Feedback vector slot is only used by interpreter for binary operations.
// Full-codegen uses AstId to record type feedback.
switch (op()) {
// Comma, logical_or and logical_and do not collect type feedback.
case Token::COMMA:
case Token::AND:
case Token::OR:
return;
default:
type_feedback_slot_ = spec->AddGeneralSlot();
return;
}
}
static bool IsTypeof(Expression* expr) {
UnaryOperation* maybe_unary = expr->AsUnaryOperation();
......
......@@ -2123,6 +2123,16 @@ class BinaryOperation final : public Expression {
static int num_ids() { return parent_num_ids() + 2; }
BailoutId RightId() const { return BailoutId(local_id(0)); }
// BinaryOperation will have both a slot in the feedback vector and the
// TypeFeedbackId to record the type information. TypeFeedbackId is used
// by full codegen and the feedback vector slot is used by interpreter.
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache);
FeedbackVectorSlot BinaryOperationFeedbackSlot() const {
return type_feedback_slot_;
}
TypeFeedbackId BinaryOperationFeedbackId() const {
return TypeFeedbackId(local_id(1));
}
......@@ -2160,6 +2170,7 @@ class BinaryOperation final : public Expression {
Expression* left_;
Expression* right_;
Handle<AllocationSite> allocation_site_;
FeedbackVectorSlot type_feedback_slot_;
};
......@@ -2203,6 +2214,11 @@ class CountOperation final : public Expression {
return TypeFeedbackId(local_id(3));
}
// Feedback slot for binary operation is only used by ignition.
FeedbackVectorSlot CountBinaryOpFeedbackSlot() const {
return binary_operation_slot_;
}
void AssignFeedbackVectorSlots(Isolate* isolate, FeedbackVectorSpec* spec,
FeedbackVectorSlotCache* cache);
FeedbackVectorSlot CountSlot() const { return slot_; }
......@@ -2230,6 +2246,7 @@ class CountOperation final : public Expression {
// Expression's trailing 16-bit field.
uint16_t bit_field_;
FeedbackVectorSlot slot_;
FeedbackVectorSlot binary_operation_slot_;
Type* type_;
Expression* expression_;
SmallMapList receiver_types_;
......
......@@ -152,13 +152,16 @@ void BytecodeArrayBuilder::Output(Bytecode bytecode) {
}
BytecodeArrayBuilder& BytecodeArrayBuilder::BinaryOperation(Token::Value op,
Register reg) {
Output(BytecodeForBinaryOperation(op), RegisterOperand(reg));
Register reg,
int feedback_slot) {
Output(BytecodeForBinaryOperation(op), RegisterOperand(reg),
UnsignedOperand(feedback_slot));
return *this;
}
BytecodeArrayBuilder& BytecodeArrayBuilder::CountOperation(Token::Value op) {
Output(BytecodeForCountOperation(op));
BytecodeArrayBuilder& BytecodeArrayBuilder::CountOperation(Token::Value op,
int feedback_slot) {
Output(BytecodeForCountOperation(op), UnsignedOperand(feedback_slot));
return *this;
}
......
......@@ -199,10 +199,13 @@ class BytecodeArrayBuilder final : public ZoneObject {
size_t receiver_args_count);
// Operators (register holds the lhs value, accumulator holds the rhs value).
BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg);
// Type feedback will be recorded in the |feedback_slot|
BytecodeArrayBuilder& BinaryOperation(Token::Value binop, Register reg,
int feedback_slot);
// Count Operators (value stored in accumulator).
BytecodeArrayBuilder& CountOperation(Token::Value op);
// Type feedback will be recorded in the |feedback_slot|
BytecodeArrayBuilder& CountOperation(Token::Value op, int feedback_slot);
// Unary Operators.
BytecodeArrayBuilder& LogicalNot();
......
......@@ -2238,7 +2238,10 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
}
}
VisitForAccumulatorValue(expr->value());
builder()->BinaryOperation(expr->binary_op(), old_value);
FeedbackVectorSlot slot =
expr->binary_operation()->BinaryOperationFeedbackSlot();
builder()->BinaryOperation(expr->binary_op(), old_value,
feedback_index(slot));
} else {
VisitForAccumulatorValue(expr->value());
}
......@@ -2880,7 +2883,8 @@ void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
}
// Perform +1/-1 operation.
builder()->CountOperation(expr->binary_op());
FeedbackVectorSlot slot = expr->CountBinaryOpFeedbackSlot();
builder()->CountOperation(expr->binary_op(), feedback_index(slot));
// Store the value.
builder()->SetExpressionPosition(expr);
......@@ -2951,7 +2955,8 @@ void BytecodeGenerator::VisitArithmeticExpression(BinaryOperation* expr) {
// +x and -x by the parser.
Register lhs = VisitForRegisterValue(expr->left());
VisitForAccumulatorValue(expr->right());
builder()->BinaryOperation(expr->op(), lhs);
FeedbackVectorSlot slot = expr->BinaryOperationFeedbackSlot();
builder()->BinaryOperation(expr->op(), lhs, feedback_index(slot));
execution_result()->SetResultInAccumulator();
}
......
......@@ -146,17 +146,23 @@ namespace interpreter {
OperandType::kReg, OperandType::kIdx) \
\
/* Binary Operators */ \
V(Add, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(Sub, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(Mul, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(Div, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(Mod, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(BitwiseOr, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(BitwiseXor, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(BitwiseAnd, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(ShiftLeft, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(ShiftRight, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(ShiftRightLogical, AccumulatorUse::kReadWrite, OperandType::kReg) \
V(Add, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(Sub, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(Mul, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(Div, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(Mod, AccumulatorUse::kReadWrite, OperandType::kReg, OperandType::kIdx) \
V(BitwiseOr, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(BitwiseXor, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(BitwiseAnd, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(ShiftLeft, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(ShiftRight, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
V(ShiftRightLogical, AccumulatorUse::kReadWrite, OperandType::kReg, \
OperandType::kIdx) \
\
/* Binary operators with immediate operands */ \
V(AddSmi, AccumulatorUse::kWrite, OperandType::kImm, OperandType::kReg) \
......@@ -171,8 +177,8 @@ namespace interpreter {
OperandType::kReg) \
\
/* Unary Operators */ \
V(Inc, AccumulatorUse::kReadWrite) \
V(Dec, AccumulatorUse::kReadWrite) \
V(Inc, AccumulatorUse::kReadWrite, OperandType::kIdx) \
V(Dec, AccumulatorUse::kReadWrite, OperandType::kIdx) \
V(ToBooleanLogicalNot, AccumulatorUse::kReadWrite) \
V(LogicalNot, AccumulatorUse::kReadWrite) \
V(TypeOf, AccumulatorUse::kReadWrite) \
......
......@@ -41,11 +41,11 @@ bytecodes: [
B(LdaZero),
B(Star), R(1),
B(Ldar), R(0),
/* 54 E> */ B(StaKeyedPropertySloppy), R(2), R(1), U8(1),
/* 54 E> */ B(StaKeyedPropertySloppy), R(2), R(1), U8(2),
B(LdaSmi), U8(1),
B(Star), R(1),
/* 57 E> */ B(AddSmi), U8(1), R(0),
B(StaKeyedPropertySloppy), R(2), R(1), U8(1),
B(StaKeyedPropertySloppy), R(2), R(1), U8(2),
B(Ldar), R(2),
/* 66 S> */ B(Return),
]
......@@ -95,7 +95,7 @@ bytecodes: [
B(Ldar), R(0),
/* 56 E> */ B(StaKeyedPropertySloppy), R(4), R(3), U8(1),
B(Ldar), R(4),
B(StaKeyedPropertySloppy), R(2), R(1), U8(5),
B(StaKeyedPropertySloppy), R(2), R(1), U8(6),
B(LdaSmi), U8(1),
B(Star), R(1),
B(CreateArrayLiteral), U8(2), U8(1), U8(3),
......@@ -103,9 +103,9 @@ bytecodes: [
B(LdaZero),
B(Star), R(3),
/* 66 E> */ B(AddSmi), U8(2), R(0),
B(StaKeyedPropertySloppy), R(4), R(3), U8(3),
B(StaKeyedPropertySloppy), R(4), R(3), U8(4),
B(Ldar), R(4),
B(StaKeyedPropertySloppy), R(2), R(1), U8(5),
B(StaKeyedPropertySloppy), R(2), R(1), U8(6),
B(Ldar), R(2),
/* 77 S> */ B(Return),
]
......
......@@ -68,7 +68,7 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 26
bytecode array length: 28
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(55),
......@@ -76,11 +76,11 @@ bytecodes: [
/* 46 S> */ B(LdaSmi), U8(100),
B(Mov), R(0), R(1),
B(Star), R(0),
/* 57 E> */ B(Add), R(1),
/* 57 E> */ B(Add), R(1), U8(1),
B(Star), R(2),
B(LdaSmi), U8(101),
B(Star), R(0),
/* 69 E> */ B(Add), R(2),
/* 69 E> */ B(Add), R(2), U8(2),
B(Star), R(0),
/* 77 S> */ B(Nop),
/* 87 S> */ B(Return),
......@@ -99,20 +99,20 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 26
bytecode array length: 29
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(55),
B(Star), R(0),
/* 46 S> */ B(LdaSmi), U8(56),
B(Star), R(0),
/* 61 E> */ B(Sub), R(0),
/* 61 E> */ B(Sub), R(0), U8(1),
B(Star), R(2),
B(LdaSmi), U8(57),
B(Star), R(0),
/* 68 E> */ B(Add), R(2),
/* 68 E> */ B(Add), R(2), U8(2),
B(Star), R(0),
/* 75 S> */ B(Inc),
/* 75 S> */ B(Inc), U8(3),
B(Star), R(0),
/* 80 S> */ B(Nop),
/* 90 S> */ B(Return),
......@@ -130,7 +130,7 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 34
bytecode array length: 37
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(55),
......@@ -138,15 +138,15 @@ bytecodes: [
/* 76 S> */ B(LdaSmi), U8(1),
B(Mov), R(0), R(2),
B(Star), R(0),
/* 61 E> */ B(Add), R(2),
/* 61 E> */ B(Add), R(2), U8(1),
B(Star), R(3),
B(LdaSmi), U8(2),
B(Star), R(0),
/* 71 E> */ B(Add), R(3),
/* 71 E> */ B(Add), R(3), U8(2),
B(Star), R(2),
B(LdaSmi), U8(3),
B(Star), R(0),
/* 81 E> */ B(Add), R(2),
/* 81 E> */ B(Add), R(2), U8(3),
B(Star), R(1),
/* 87 S> */ B(Nop),
/* 97 S> */ B(Return),
......@@ -164,7 +164,7 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 34
bytecode array length: 37
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(55),
......@@ -172,15 +172,15 @@ bytecodes: [
/* 76 S> */ B(LdaSmi), U8(1),
B(Mov), R(0), R(1),
B(Star), R(0),
/* 61 E> */ B(Add), R(1),
/* 61 E> */ B(Add), R(1), U8(1),
B(Star), R(2),
B(LdaSmi), U8(2),
B(Star), R(0),
/* 71 E> */ B(Add), R(2),
/* 71 E> */ B(Add), R(2), U8(2),
B(Star), R(1),
B(LdaSmi), U8(3),
B(Star), R(0),
/* 81 E> */ B(Add), R(1),
/* 81 E> */ B(Add), R(1), U8(3),
B(Star), R(0),
/* 87 S> */ B(Nop),
/* 97 S> */ B(Return),
......@@ -197,7 +197,7 @@ snippet: "
"
frame size: 5
parameter count: 1
bytecode array length: 64
bytecode array length: 71
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(10),
......@@ -207,29 +207,29 @@ bytecodes: [
/* 54 S> */ B(LdaSmi), U8(1),
B(Mov), R(0), R(2),
B(Star), R(0),
/* 68 E> */ B(Add), R(2),
/* 68 E> */ B(Add), R(2), U8(1),
B(Star), R(3),
/* 76 E> */ B(AddSmi), U8(1), R(0),
B(Star), R(4),
B(LdaSmi), U8(2),
B(Star), R(1),
/* 88 E> */ B(Mul), R(4),
B(Add), R(3),
/* 88 E> */ B(Mul), R(4), U8(3),
B(Add), R(3), U8(4),
B(Star), R(2),
B(LdaSmi), U8(3),
B(Star), R(1),
/* 98 E> */ B(Add), R(2),
/* 98 E> */ B(Add), R(2), U8(5),
B(Star), R(3),
B(LdaSmi), U8(4),
B(Star), R(0),
/* 108 E> */ B(Add), R(3),
/* 108 E> */ B(Add), R(3), U8(6),
B(Star), R(2),
B(LdaSmi), U8(5),
B(Star), R(1),
/* 118 E> */ B(Add), R(2),
/* 118 E> */ B(Add), R(2), U8(7),
B(Star), R(3),
B(Ldar), R(1),
/* 125 E> */ B(Add), R(3),
/* 125 E> */ B(Add), R(3), U8(8),
/* 128 S> */ B(Return),
]
constant pool: [
......@@ -244,7 +244,7 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 36
bytecode array length: 41
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(17),
......@@ -252,19 +252,19 @@ bytecodes: [
/* 46 S> */ B(LdaSmi), U8(1),
B(Star), R(1),
B(Ldar), R(0),
/* 57 E> */ B(Add), R(1),
/* 57 E> */ B(Add), R(1), U8(1),
B(Star), R(2),
B(Ldar), R(0),
B(ToNumber), R(1),
B(Inc),
B(Inc), U8(2),
B(Star), R(0),
B(Ldar), R(1),
/* 63 E> */ B(Add), R(2),
/* 63 E> */ B(Add), R(2), U8(3),
B(Star), R(3),
B(Ldar), R(0),
B(Inc),
B(Inc), U8(4),
B(Star), R(0),
/* 72 E> */ B(Add), R(3),
/* 72 E> */ B(Add), R(3), U8(5),
/* 76 S> */ B(Return),
]
constant pool: [
......
......@@ -65,7 +65,7 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 47
bytecode array length: 48
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
......@@ -74,10 +74,10 @@ bytecodes: [
B(Star), R(1),
/* 65 S> */ B(LdaSmi), U8(10),
/* 65 E> */ B(TestLessThan), R(0),
B(JumpIfFalse), U8(32),
B(JumpIfFalse), U8(33),
/* 56 E> */ B(StackCheck),
/* 75 S> */ B(LdaSmi), U8(12),
B(Mul), R(1),
B(Mul), R(1), U8(1),
B(Star), R(1),
/* 89 S> */ B(AddSmi), U8(1), R(0),
B(Star), R(0),
......@@ -89,7 +89,7 @@ bytecodes: [
/* 132 E> */ B(TestEqual), R(0),
B(JumpIfFalse), U8(4),
/* 138 S> */ B(Jump), U8(4),
B(Jump), U8(-34),
B(Jump), U8(-35),
/* 147 S> */ B(Ldar), R(1),
/* 157 S> */ B(Return),
]
......@@ -206,7 +206,7 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 30
bytecode array length: 31
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(10),
......@@ -214,14 +214,14 @@ bytecodes: [
/* 54 S> */ B(LdaSmi), U8(1),
B(Star), R(1),
/* 64 S> */ B(Ldar), R(0),
B(JumpIfToBooleanFalse), U8(16),
B(JumpIfToBooleanFalse), U8(17),
/* 57 E> */ B(StackCheck),
/* 71 S> */ B(LdaSmi), U8(12),
B(Mul), R(1),
B(Mul), R(1), U8(1),
B(Star), R(1),
/* 85 S> */ B(SubSmi), U8(1), R(0),
B(Star), R(0),
B(Jump), U8(-16),
B(Jump), U8(-17),
/* 98 S> */ B(Ldar), R(1),
/* 108 S> */ B(Return),
]
......@@ -243,7 +243,7 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 45
bytecode array length: 46
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
......@@ -252,7 +252,7 @@ bytecodes: [
B(Star), R(1),
/* 56 E> */ B(StackCheck),
/* 63 S> */ B(LdaSmi), U8(10),
B(Mul), R(1),
B(Mul), R(1), U8(1),
B(Star), R(1),
/* 77 S> */ B(LdaSmi), U8(5),
/* 83 E> */ B(TestEqual), R(0),
......@@ -266,7 +266,7 @@ bytecodes: [
B(Star), R(0),
/* 144 S> */ B(LdaSmi), U8(10),
/* 144 E> */ B(TestLessThan), R(0),
B(JumpIfTrue), U8(-32),
B(JumpIfTrue), U8(-33),
/* 151 S> */ B(Ldar), R(1),
/* 161 S> */ B(Return),
]
......@@ -287,7 +287,7 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 28
bytecode array length: 29
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(10),
......@@ -296,12 +296,12 @@ bytecodes: [
B(Star), R(1),
/* 57 E> */ B(StackCheck),
/* 64 S> */ B(LdaSmi), U8(12),
B(Mul), R(1),
B(Mul), R(1), U8(1),
B(Star), R(1),
/* 78 S> */ B(SubSmi), U8(1), R(0),
B(Star), R(0),
/* 98 S> */ B(Ldar), R(0),
B(JumpIfToBooleanTrue), U8(-14),
B(JumpIfToBooleanTrue), U8(-15),
/* 102 S> */ B(Ldar), R(1),
/* 112 S> */ B(Return),
]
......@@ -323,7 +323,7 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 39
bytecode array length: 40
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
......@@ -332,7 +332,7 @@ bytecodes: [
B(Star), R(1),
/* 56 E> */ B(StackCheck),
/* 63 S> */ B(LdaSmi), U8(10),
B(Mul), R(1),
B(Mul), R(1), U8(1),
B(Star), R(1),
/* 77 S> */ B(LdaSmi), U8(5),
/* 83 E> */ B(TestEqual), R(0),
......@@ -365,7 +365,7 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 41
bytecode array length: 42
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
......@@ -374,7 +374,7 @@ bytecodes: [
B(Star), R(1),
/* 56 E> */ B(StackCheck),
/* 63 S> */ B(LdaSmi), U8(10),
B(Mul), R(1),
B(Mul), R(1), U8(1),
B(Star), R(1),
/* 77 S> */ B(LdaSmi), U8(5),
/* 83 E> */ B(TestEqual), R(0),
......@@ -386,7 +386,7 @@ bytecodes: [
/* 117 E> */ B(TestEqual), R(0),
B(JumpIfFalse), U8(4),
/* 123 S> */ B(Jump), U8(2),
B(Jump), U8(-28),
B(Jump), U8(-29),
/* 149 S> */ B(Ldar), R(1),
/* 159 S> */ B(Return),
]
......@@ -580,7 +580,7 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 30
bytecode array length: 32
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(1),
......@@ -588,15 +588,15 @@ bytecodes: [
/* 58 S> */ B(LdaSmi), U8(10),
B(Star), R(1),
/* 62 S> */ B(Ldar), R(1),
B(JumpIfToBooleanFalse), U8(16),
B(JumpIfToBooleanFalse), U8(18),
/* 45 E> */ B(StackCheck),
/* 74 S> */ B(LdaSmi), U8(12),
B(Mul), R(0),
B(Mul), R(0), U8(2),
B(Star), R(0),
/* 67 S> */ B(Ldar), R(1),
B(Dec),
B(Dec), U8(1),
B(Star), R(1),
B(Jump), U8(-16),
B(Jump), U8(-18),
/* 88 S> */ B(Ldar), R(0),
/* 98 S> */ B(Return),
]
......@@ -641,7 +641,7 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 31
bytecode array length: 32
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
......@@ -654,11 +654,11 @@ bytecodes: [
/* 89 S> */ B(LdaSmi), U8(20),
/* 95 E> */ B(TestEqual), R(0),
B(JumpIfFalse), U8(4),
/* 102 S> */ B(Jump), U8(9),
/* 102 S> */ B(Jump), U8(10),
/* 69 S> */ B(Ldar), R(1),
B(Inc),
B(Inc), U8(1),
B(Star), R(1),
B(Jump), U8(-19),
B(Jump), U8(-20),
/* 112 S> */ B(Ldar), R(0),
/* 122 S> */ B(Return),
]
......@@ -681,13 +681,13 @@ snippet: "
"
frame size: 6
parameter count: 1
bytecode array length: 104
bytecode array length: 105
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
B(Star), R(1),
/* 52 S> */ B(Ldar), R(1),
B(JumpIfToBooleanFalse), U8(96),
B(JumpIfToBooleanFalse), U8(97),
/* 45 E> */ B(StackCheck),
B(LdaConstant), U8(0),
B(Star), R(4),
......@@ -709,13 +709,13 @@ bytecodes: [
B(JumpIfToBooleanFalse), U8(8),
/* 113 S> */ B(PopContext), R(3),
B(PopContext), R(3),
B(Jump), U8(40),
B(Jump), U8(41),
/* 126 S> */ B(LdaContextSlot), R(context), U8(4),
B(JumpIfNotHole), U8(11),
B(LdaConstant), U8(2),
B(Star), R(4),
B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1),
B(Inc),
B(Inc), U8(1),
B(Star), R(4),
/* 127 E> */ B(LdaContextSlot), R(context), U8(4),
B(JumpIfNotHole), U8(11),
......@@ -725,7 +725,7 @@ bytecodes: [
B(Ldar), R(4),
B(StaContextSlot), R(context), U8(4),
B(PopContext), R(3),
B(Jump), U8(-96),
B(Jump), U8(-97),
B(LdaUndefined),
/* 137 S> */ B(Return),
]
......
......@@ -50,7 +50,7 @@ snippet: "
"
frame size: 5
parameter count: 1
bytecode array length: 60
bytecode array length: 64
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaZero),
......@@ -59,32 +59,32 @@ bytecodes: [
B(Star), R(1),
/* 76 S> */ B(LdaSmi), U8(10),
/* 76 E> */ B(TestLessThan), R(1),
B(JumpIfFalse), U8(46),
B(JumpIfFalse), U8(50),
/* 58 E> */ B(StackCheck),
/* 106 S> */ B(LdaZero),
B(Star), R(2),
/* 111 S> */ B(LdaSmi), U8(3),
/* 111 E> */ B(TestLessThan), R(2),
B(JumpIfFalse), U8(29),
B(JumpIfFalse), U8(32),
/* 93 E> */ B(StackCheck),
/* 129 S> */ B(Ldar), R(0),
B(Inc),
B(Inc), U8(3),
B(Star), R(0),
/* 142 S> */ B(Ldar), R(2),
/* 150 E> */ B(Add), R(1),
/* 150 E> */ B(Add), R(1), U8(4),
B(Star), R(4),
B(LdaSmi), U8(12),
/* 152 E> */ B(TestEqual), R(4),
B(JumpIfFalse), U8(4),
/* 161 S> */ B(Jump), U8(16),
/* 161 S> */ B(Jump), U8(18),
/* 118 S> */ B(Ldar), R(2),
B(Inc),
B(Inc), U8(2),
B(Star), R(2),
B(Jump), U8(-31),
B(Jump), U8(-34),
/* 84 S> */ B(Ldar), R(1),
B(Inc),
B(Inc), U8(1),
B(Star), R(1),
B(Jump), U8(-48),
B(Jump), U8(-52),
/* 188 S> */ B(Ldar), R(0),
/* 200 S> */ B(Return),
]
......
......@@ -35,13 +35,13 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 16
bytecode array length: 17
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(1),
B(Star), R(0),
/* 45 S> */ B(LdaSmi), U8(2),
B(Div), R(0),
B(Div), R(0), U8(1),
B(Mov), R(0), R(1),
B(Star), R(0),
B(LdaUndefined),
......@@ -58,7 +58,7 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 24
bytecode array length: 25
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1),
......@@ -66,8 +66,8 @@ bytecodes: [
B(Star), R(0),
/* 54 S> */ B(LdrNamedProperty), R(0), U8(1), U8(1), R(2),
B(LdaSmi), U8(2),
B(Mul), R(2),
/* 61 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(3),
B(Mul), R(2), U8(3),
/* 61 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(4),
B(LdaUndefined),
/* 67 S> */ B(Return),
]
......@@ -84,7 +84,7 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 27
bytecode array length: 28
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1),
......@@ -94,8 +94,8 @@ bytecodes: [
B(Star), R(2),
B(LdrKeyedProperty), R(0), U8(1), R(3),
B(LdaSmi), U8(2),
B(BitwiseXor), R(3),
/* 57 E> */ B(StaKeyedPropertySloppy), R(0), R(2), U8(3),
B(BitwiseXor), R(3), U8(3),
/* 57 E> */ B(StaKeyedPropertySloppy), R(0), R(2), U8(4),
B(LdaUndefined),
/* 63 S> */ B(Return),
]
......
......@@ -13,12 +13,12 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 9
bytecode array length: 10
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(1),
B(Star), R(0),
/* 45 S> */ B(Inc),
/* 45 S> */ B(Inc), U8(1),
B(Star), R(0),
/* 57 S> */ B(Return),
]
......@@ -33,13 +33,13 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 13
bytecode array length: 14
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(1),
B(Star), R(0),
/* 45 S> */ B(ToNumber), R(1),
B(Inc),
B(Inc), U8(1),
B(Star), R(0),
B(Ldar), R(1),
/* 57 S> */ B(Return),
......@@ -55,12 +55,12 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 9
bytecode array length: 10
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(1),
B(Star), R(0),
/* 45 S> */ B(Dec),
/* 45 S> */ B(Dec), U8(1),
B(Star), R(0),
/* 57 S> */ B(Return),
]
......@@ -75,13 +75,13 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 13
bytecode array length: 14
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(1),
B(Star), R(0),
/* 45 S> */ B(ToNumber), R(1),
B(Dec),
B(Dec), U8(1),
B(Star), R(0),
B(Ldar), R(1),
/* 57 S> */ B(Return),
......@@ -97,7 +97,7 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 23
bytecode array length: 24
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1),
......@@ -105,7 +105,7 @@ bytecodes: [
B(Star), R(0),
/* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(1),
B(ToNumber), R(2),
B(Inc),
B(Inc), U8(5),
/* 66 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(3),
B(Ldar), R(2),
/* 70 S> */ B(Return),
......@@ -123,14 +123,14 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 19
bytecode array length: 20
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1),
B(Star), R(1),
B(Star), R(0),
/* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(1),
B(Dec),
B(Dec), U8(5),
/* 65 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(3),
/* 70 S> */ B(Return),
]
......@@ -147,7 +147,7 @@ snippet: "
"
frame size: 5
parameter count: 1
bytecode array length: 28
bytecode array length: 29
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 45 S> */ B(LdaConstant), U8(0),
......@@ -158,7 +158,7 @@ bytecodes: [
/* 72 S> */ B(Ldar), R(0),
/* 81 E> */ B(LdaKeyedProperty), R(1), U8(1),
B(ToNumber), R(4),
B(Dec),
B(Dec), U8(5),
/* 86 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(3),
B(Ldar), R(4),
/* 90 S> */ B(Return),
......@@ -176,7 +176,7 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 24
bytecode array length: 25
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 45 S> */ B(LdaConstant), U8(0),
......@@ -186,7 +186,7 @@ bytecodes: [
B(Star), R(1),
/* 72 S> */ B(Ldar), R(0),
/* 83 E> */ B(LdaKeyedProperty), R(1), U8(1),
B(Inc),
B(Inc), U8(5),
/* 87 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(3),
/* 90 S> */ B(Return),
]
......@@ -203,7 +203,7 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 23
bytecode array length: 24
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
......@@ -213,7 +213,7 @@ bytecodes: [
/* 53 S> */ B(CreateClosure), U8(0), U8(2),
B(Star), R(0),
/* 78 S> */ B(LdaContextSlot), R(context), U8(4),
B(Inc),
B(Inc), U8(1),
/* 87 E> */ B(StaContextSlot), R(context), U8(4),
/* 90 S> */ B(Return),
]
......@@ -229,7 +229,7 @@ snippet: "
"
frame size: 3
parameter count: 1
bytecode array length: 27
bytecode array length: 28
bytecodes: [
B(CreateFunctionContext), U8(1),
B(PushContext), R(1),
......@@ -240,7 +240,7 @@ bytecodes: [
B(Star), R(0),
/* 78 S> */ B(LdaContextSlot), R(context), U8(4),
B(ToNumber), R(2),
B(Dec),
B(Dec), U8(1),
/* 86 E> */ B(StaContextSlot), R(context), U8(4),
B(Ldar), R(2),
/* 90 S> */ B(Return),
......@@ -257,7 +257,7 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 25
bytecode array length: 26
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), U8(1),
......@@ -266,10 +266,10 @@ bytecodes: [
B(Star), R(1),
/* 63 S> */ B(Ldar), R(0),
B(ToNumber), R(3),
B(Inc),
B(Inc), U8(1),
B(Star), R(0),
B(LdaSmi), U8(2),
/* 79 E> */ B(StaKeyedPropertySloppy), R(1), R(3), U8(1),
/* 79 E> */ B(StaKeyedPropertySloppy), R(1), R(3), U8(2),
/* 84 S> */ B(Return),
]
constant pool: [
......
......@@ -82,7 +82,7 @@ snippet: "
"
frame size: 5
parameter count: 2
bytecode array length: 25
bytecode array length: 26
bytecodes: [
B(CreateUnmappedArguments),
B(Star), R(0),
......@@ -96,7 +96,7 @@ bytecodes: [
/* 44 E> */ B(LdrKeyedProperty), R(1), U8(1), R(4),
B(LdaZero),
/* 59 E> */ B(LdaKeyedProperty), R(0), U8(3),
B(Add), R(4),
B(Add), R(4), U8(5),
/* 64 S> */ B(Return),
]
constant pool: [
......
......@@ -54,17 +54,17 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 17
bytecode array length: 18
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 34 E> */ B(StackCheck),
/* 56 S> */ B(LdaSmi), U8(10),
B(Star), R(1),
/* 69 S> */ B(Inc),
/* 69 S> */ B(Inc), U8(1),
B(Star), R(1),
B(Star), R(0),
/* 74 S> */ B(Jump), U8(4),
B(Jump), U8(-12),
B(Jump), U8(-13),
B(LdaUndefined),
/* 94 S> */ B(Return),
]
......
......@@ -104,32 +104,32 @@ snippet: "
"
frame size: 9
parameter count: 1
bytecode array length: 54
bytecode array length: 55
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
B(Star), R(1),
/* 59 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3),
B(JumpIfUndefined), U8(44),
B(JumpIfNull), U8(42),
B(JumpIfUndefined), U8(45),
B(JumpIfNull), U8(43),
B(ToObject), R(3),
B(ForInPrepare), R(3), R(4),
B(LdaZero),
B(Star), R(7),
/* 54 S> */ B(ForInDone), R(7), R(6),
B(JumpIfTrue), U8(29),
B(ForInNext), R(3), R(7), R(4), U8(1),
B(JumpIfUndefined), U8(16),
B(JumpIfTrue), U8(30),
B(ForInNext), R(3), R(7), R(4), U8(2),
B(JumpIfUndefined), U8(17),
B(Star), R(0),
/* 45 E> */ B(StackCheck),
B(Star), R(2),
/* 70 S> */ B(Ldar), R(0),
/* 75 E> */ B(Add), R(1),
/* 75 E> */ B(Add), R(1), U8(1),
B(Mov), R(1), R(8),
B(Star), R(1),
/* 72 E> */ B(ForInStep), R(7),
B(Star), R(7),
B(Jump), U8(-30),
B(Jump), U8(-31),
B(LdaUndefined),
/* 80 S> */ B(Return),
]
......
......@@ -21,7 +21,7 @@ bytecodes: [
/* 26 E> */ B(StackCheck),
/* 31 S> */ B(LdrGlobal), U8(1), R(0),
B(BitwiseAndSmi), U8(1), R(0),
/* 45 E> */ B(StaGlobalSloppy), U8(0), U8(3),
/* 45 E> */ B(StaGlobalSloppy), U8(0), U8(4),
/* 51 S> */ B(Return),
]
constant pool: [
......@@ -43,7 +43,7 @@ bytecodes: [
/* 27 E> */ B(StackCheck),
/* 32 S> */ B(LdrGlobal), U8(1), R(0),
B(AddSmi), U8(1), R(0),
/* 51 E> */ B(StaGlobalSloppy), U8(0), U8(3),
/* 51 E> */ B(StaGlobalSloppy), U8(0), U8(4),
/* 57 S> */ B(Return),
]
constant pool: [
......
......@@ -16,11 +16,11 @@ snippet: "
"
frame size: 0
parameter count: 1
bytecode array length: 8
bytecode array length: 9
bytecodes: [
/* 26 E> */ B(StackCheck),
/* 31 S> */ B(LdaGlobal), U8(1),
B(Inc),
B(Inc), U8(5),
/* 40 E> */ B(StaGlobalSloppy), U8(0), U8(3),
/* 48 S> */ B(Return),
]
......@@ -38,12 +38,12 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 12
bytecode array length: 13
bytecodes: [
/* 26 E> */ B(StackCheck),
/* 31 S> */ B(LdaGlobal), U8(1),
B(ToNumber), R(0),
B(Dec),
B(Dec), U8(5),
/* 44 E> */ B(StaGlobalSloppy), U8(0), U8(3),
B(Ldar), R(0),
/* 48 S> */ B(Return),
......@@ -62,11 +62,11 @@ snippet: "
"
frame size: 0
parameter count: 1
bytecode array length: 8
bytecode array length: 9
bytecodes: [
/* 27 E> */ B(StackCheck),
/* 46 S> */ B(LdaGlobal), U8(1),
B(Dec),
B(Dec), U8(5),
/* 55 E> */ B(StaGlobalStrict), U8(0), U8(3),
/* 68 S> */ B(Return),
]
......@@ -84,12 +84,12 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 12
bytecode array length: 13
bytecodes: [
/* 27 E> */ B(StackCheck),
/* 32 S> */ B(LdaGlobal), U8(1),
B(ToNumber), R(0),
B(Inc),
B(Inc), U8(5),
/* 50 E> */ B(StaGlobalSloppy), U8(0), U8(3),
B(Ldar), R(0),
/* 54 S> */ B(Return),
......
......@@ -329,7 +329,7 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 1407
bytecode array length: 1408
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaConstant), U8(0),
......@@ -960,7 +960,7 @@ bytecodes: [
B(Star), R(1),
/* 4108 S> */ B(LdaSmi), U8(3),
/* 4108 E> */ B(TestLessThan), R(1),
B(Wide), B(JumpIfFalse), U16(35),
B(Wide), B(JumpIfFalse), U16(36),
/* 4090 E> */ B(StackCheck),
/* 4122 S> */ B(LdaSmi), U8(1),
/* 4128 E> */ B(TestEqual), R(1),
......@@ -969,11 +969,11 @@ bytecodes: [
/* 4146 S> */ B(LdaSmi), U8(2),
/* 4152 E> */ B(TestEqual), R(1),
B(Wide), B(JumpIfFalse), U16(7),
/* 4158 S> */ B(Wide), B(Jump), U16(10),
/* 4158 S> */ B(Wide), B(Jump), U16(11),
/* 4114 S> */ B(Ldar), R(1),
B(Inc),
B(Inc), U8(1),
B(Star), R(1),
B(Jump), U8(-38),
B(Jump), U8(-39),
/* 4167 S> */ B(LdaSmi), U8(3),
/* 4177 S> */ B(Return),
]
......
......@@ -84,7 +84,7 @@ bytecodes: [
/* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1),
B(Star), R(1),
/* 67 E> */ B(AddSmi), U8(1), R(0),
B(StaNamedPropertySloppy), R(1), U8(1), U8(1),
B(StaNamedPropertySloppy), R(1), U8(1), U8(2),
B(Ldar), R(1),
/* 76 S> */ B(Return),
]
......
......@@ -22,13 +22,13 @@ snippet: "
"
frame size: 2
parameter count: 1
bytecode array length: 15
bytecode array length: 16
bytecodes: [
/* 97 E> */ B(StackCheck),
/* 102 S> */ B(LdrContextSlot), R(context), U8(1), R(0),
B(LdrContextSlot), R(0), U8(4), R(1),
/* 120 E> */ B(LdaContextSlot), R(context), U8(4),
B(Mul), R(1),
B(Mul), R(1), U8(1),
/* 130 S> */ B(Return),
]
constant pool: [
......
......@@ -70,13 +70,13 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecode array length: 11
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(4),
B(Star), R(0),
/* 45 S> */ B(LdaSmi), U8(3),
B(Mul), R(0),
B(Mul), R(0), U8(1),
/* 59 S> */ B(Return),
]
constant pool: [
......@@ -90,13 +90,13 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecode array length: 11
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(4),
B(Star), R(0),
/* 45 S> */ B(LdaSmi), U8(3),
B(Div), R(0),
B(Div), R(0), U8(1),
/* 59 S> */ B(Return),
]
constant pool: [
......@@ -110,13 +110,13 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecode array length: 11
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(4),
B(Star), R(0),
/* 45 S> */ B(LdaSmi), U8(3),
B(Mod), R(0),
B(Mod), R(0), U8(1),
/* 59 S> */ B(Return),
]
constant pool: [
......@@ -149,13 +149,13 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecode array length: 11
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(1),
B(Star), R(0),
/* 45 S> */ B(LdaSmi), U8(2),
B(BitwiseXor), R(0),
B(BitwiseXor), R(0), U8(1),
/* 59 S> */ B(Return),
]
constant pool: [
......@@ -226,13 +226,13 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecode array length: 11
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(10),
B(Star), R(0),
/* 46 S> */ B(LdaSmi), U8(3),
B(ShiftRightLogical), R(0),
B(ShiftRightLogical), R(0), U8(1),
/* 62 S> */ B(Return),
]
constant pool: [
......
......@@ -61,13 +61,13 @@ snippet: "
"
frame size: 4
parameter count: 3
bytecode array length: 25
bytecode array length: 26
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 19 S> */ B(Nop),
/* 27 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(3), R(0),
B(Ldar), R(arg1),
/* 37 E> */ B(Add), R(arg1),
/* 37 E> */ B(Add), R(arg1), U8(5),
B(Star), R(2),
B(Mov), R(arg0), R(1),
B(Mov), R(arg1), R(3),
......
......@@ -18,20 +18,20 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 25
bytecode array length: 26
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 45 S> */ B(LdaSmi), U8(1),
B(Star), R(0),
/* 48 E> */ B(StackCheck),
/* 64 S> */ B(Ldar), R(0),
/* 78 E> */ B(Add), R(0),
/* 78 E> */ B(Add), R(0), U8(1),
B(Star), R(0),
/* 86 S> */ B(LdaSmi), U8(10),
/* 95 E> */ B(TestGreaterThan), R(0),
B(JumpIfFalse), U8(4),
/* 101 S> */ B(Jump), U8(4),
B(Jump), U8(-15),
B(Jump), U8(-16),
/* 110 S> */ B(Ldar), R(0),
/* 123 S> */ B(Return),
]
......@@ -51,14 +51,14 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 22
bytecode array length: 23
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 45 S> */ B(LdaSmi), U8(1),
B(Star), R(0),
/* 48 E> */ B(StackCheck),
/* 55 S> */ B(Nop),
/* 69 E> */ B(Add), R(0),
/* 69 E> */ B(Add), R(0), U8(1),
B(Star), R(0),
/* 77 S> */ B(LdaSmi), U8(10),
/* 86 E> */ B(TestGreaterThan), R(0),
......@@ -80,13 +80,13 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 12
bytecode array length: 13
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 45 S> */ B(LdaSmi), U8(1),
B(Star), R(0),
/* 50 S> */ B(Nop),
/* 64 E> */ B(Add), R(0),
/* 64 E> */ B(Add), R(0), U8(1),
B(Star), R(0),
/* 72 S> */ B(Nop),
/* 85 S> */ B(Return),
......
......@@ -75,13 +75,13 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 11
bytecode array length: 12
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(101),
B(Star), R(0),
/* 47 S> */ B(LdaSmi), U8(3),
B(Mul), R(0),
B(Mul), R(0), U8(1),
B(LdaUndefined),
/* 67 S> */ B(Return),
]
......@@ -98,13 +98,13 @@ snippet: "
"
frame size: 4
parameter count: 1
bytecode array length: 21
bytecode array length: 22
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(Wide), B(LdaSmi), U16(1234),
B(Star), R(0),
/* 56 S> */ B(Nop),
/* 66 E> */ B(Mul), R(0),
/* 66 E> */ B(Mul), R(0), U8(1),
B(Star), R(3),
B(SubSmi), U8(1), R(3),
B(LdrUndefined), R(1),
......@@ -124,13 +124,13 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecode array length: 11
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(13),
B(Star), R(0),
/* 46 S> */ B(LdaSmi), U8(-1),
B(BitwiseXor), R(0),
B(BitwiseXor), R(0), U8(1),
/* 57 S> */ B(Return),
]
constant pool: [
......@@ -145,13 +145,13 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecode array length: 11
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(13),
B(Star), R(0),
/* 46 S> */ B(LdaConstant), U8(0),
B(Mul), R(0),
B(Mul), R(0), U8(1),
/* 57 S> */ B(Return),
]
constant pool: [
......@@ -167,13 +167,13 @@ snippet: "
"
frame size: 1
parameter count: 1
bytecode array length: 10
bytecode array length: 11
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), U8(13),
B(Star), R(0),
/* 46 S> */ B(LdaSmi), U8(-1),
B(Mul), R(0),
B(Mul), R(0), U8(1),
/* 57 S> */ B(Return),
]
constant pool: [
......
......@@ -893,7 +893,7 @@ snippet: "
"
frame size: 158
parameter count: 1
bytecode array length: 51
bytecode array length: 53
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 1503 S> */ B(LdaZero),
......@@ -904,16 +904,16 @@ bytecodes: [
B(Wide), B(Star), R16(128),
/* 1538 S> */ B(LdaSmi), U8(64),
/* 1538 E> */ B(Wide), B(TestLessThan), R16(128),
B(JumpIfFalse), U8(28),
B(JumpIfFalse), U8(30),
/* 1518 E> */ B(StackCheck),
/* 1555 S> */ B(Wide), B(Ldar), R16(128),
/* 1561 E> */ B(Add), R(1),
/* 1561 E> */ B(Add), R(1), U8(2),
B(Wide), B(Mov), R16(1), R16(157),
B(Star), R(1),
/* 1548 S> */ B(Wide), B(Ldar), R16(128),
B(Inc),
B(Inc), U8(1),
B(Wide), B(Star), R16(128),
B(Jump), U8(-32),
B(Jump), U8(-34),
/* 1567 S> */ B(Wide), B(Ldar), R16(128),
/* 1580 S> */ B(Return),
]
......@@ -1087,7 +1087,7 @@ snippet: "
"
frame size: 163
parameter count: 1
bytecode array length: 83
bytecode array length: 84
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 1503 S> */ B(Wide), B(LdaSmi), U16(1234),
......@@ -1095,25 +1095,25 @@ bytecodes: [
/* 1518 S> */ B(LdaZero),
B(Star), R(1),
/* 1534 S> */ B(Ldar), R(0),
B(JumpIfUndefined), U8(68),
B(JumpIfNull), U8(66),
B(JumpIfUndefined), U8(69),
B(JumpIfNull), U8(67),
B(Wide), B(ToObject), R16(157),
B(Wide), B(ForInPrepare), R16(157), R16(158),
B(LdaZero),
B(Wide), B(Star), R16(161),
/* 1526 S> */ B(Wide), B(ForInDone), R16(161), R16(160),
B(JumpIfTrue), U8(43),
B(Wide), B(ForInNext), R16(157), R16(161), R16(158), U16(1),
B(JumpIfUndefined), U8(21),
B(JumpIfTrue), U8(44),
B(Wide), B(ForInNext), R16(157), R16(161), R16(158), U16(2),
B(JumpIfUndefined), U8(22),
B(Wide), B(Star), R16(128),
/* 1521 E> */ B(StackCheck),
/* 1541 S> */ B(Wide), B(Ldar), R16(128),
/* 1547 E> */ B(Add), R(1),
/* 1547 E> */ B(Add), R(1), U8(1),
B(Wide), B(Mov), R16(1), R16(162),
B(Star), R(1),
/* 1544 E> */ B(Wide), B(ForInStep), R16(161),
B(Wide), B(Star), R16(161),
B(Jump), U8(-47),
B(Jump), U8(-48),
/* 1553 S> */ B(Ldar), R(1),
/* 1564 S> */ B(Return),
]
......
......@@ -267,16 +267,24 @@ TEST(InterpreterShiftOpsSmi) {
for (size_t r = 0; r < arraysize(rhs_inputs); r++) {
for (size_t o = 0; o < arraysize(kShiftOperators); o++) {
HandleAndZoneScope handles;
i::Factory* factory = handles.main_isolate()->factory();
i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory();
i::Zone zone(isolate->allocator());
BytecodeArrayBuilder builder(handles.main_isolate(),
handles.main_zone(), 1, 0, 1);
i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot();
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(isolate, &feedback_spec);
Register reg(0);
int lhs = lhs_inputs[l];
int rhs = rhs_inputs[r];
builder.LoadLiteral(Smi::FromInt(lhs))
.StoreAccumulatorInRegister(reg)
.LoadLiteral(Smi::FromInt(rhs))
.BinaryOperation(kShiftOperators[o], reg)
.BinaryOperation(kShiftOperators[o], reg, vector->GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -299,17 +307,25 @@ TEST(InterpreterBinaryOpsSmi) {
for (size_t r = 0; r < arraysize(rhs_inputs); r++) {
for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) {
HandleAndZoneScope handles;
i::Factory* factory = handles.main_isolate()->factory();
i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory();
i::Zone zone(isolate->allocator());
BytecodeArrayBuilder builder(handles.main_isolate(),
handles.main_zone(), 1, 0, 1);
i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot();
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(isolate, &feedback_spec);
Register reg(0);
int lhs = lhs_inputs[l];
int rhs = rhs_inputs[r];
builder.LoadLiteral(Smi::FromInt(lhs))
.StoreAccumulatorInRegister(reg)
.LoadLiteral(Smi::FromInt(rhs))
.BinaryOperation(kArithmeticOperators[o], reg)
.BinaryOperation(kArithmeticOperators[o], reg,
vector->GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -333,16 +349,25 @@ TEST(InterpreterBinaryOpsHeapNumber) {
for (size_t r = 0; r < arraysize(rhs_inputs); r++) {
for (size_t o = 0; o < arraysize(kArithmeticOperators); o++) {
HandleAndZoneScope handles;
i::Factory* factory = handles.main_isolate()->factory();
i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory();
i::Zone zone(isolate->allocator());
BytecodeArrayBuilder builder(handles.main_isolate(),
handles.main_zone(), 1, 0, 1);
i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot();
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(isolate, &feedback_spec);
Register reg(0);
double lhs = lhs_inputs[l];
double rhs = rhs_inputs[r];
builder.LoadLiteral(factory->NewNumber(lhs))
.StoreAccumulatorInRegister(reg)
.LoadLiteral(factory->NewNumber(rhs))
.BinaryOperation(kArithmeticOperators[o], reg)
.BinaryOperation(kArithmeticOperators[o], reg,
vector->GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -360,7 +385,9 @@ TEST(InterpreterBinaryOpsHeapNumber) {
TEST(InterpreterStringAdd) {
HandleAndZoneScope handles;
i::Factory* factory = handles.main_isolate()->factory();
i::Isolate* isolate = handles.main_isolate();
i::Factory* factory = isolate->factory();
i::Zone zone(isolate->allocator());
struct TestCase {
Handle<Object> lhs;
......@@ -393,12 +420,16 @@ TEST(InterpreterStringAdd) {
for (size_t i = 0; i < arraysize(test_cases); i++) {
BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1,
0, 1);
i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot();
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(isolate, &feedback_spec);
Register reg(0);
builder.LoadLiteral(test_cases[i].lhs)
.StoreAccumulatorInRegister(reg)
.LoadLiteral(test_cases[i].rhs)
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, vector->GetIndex(slot))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -435,17 +466,38 @@ TEST(InterpreterParameter1) {
TEST(InterpreterParameter8) {
HandleAndZoneScope handles;
i::Isolate* isolate = handles.main_isolate();
i::Zone zone(isolate->allocator());
BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 8,
0, 0);
i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot5 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot6 = feedback_spec.AddGeneralSlot();
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(isolate, &feedback_spec);
builder.LoadAccumulatorWithRegister(builder.Parameter(0))
.BinaryOperation(Token::Value::ADD, builder.Parameter(1))
.BinaryOperation(Token::Value::ADD, builder.Parameter(2))
.BinaryOperation(Token::Value::ADD, builder.Parameter(3))
.BinaryOperation(Token::Value::ADD, builder.Parameter(4))
.BinaryOperation(Token::Value::ADD, builder.Parameter(5))
.BinaryOperation(Token::Value::ADD, builder.Parameter(6))
.BinaryOperation(Token::Value::ADD, builder.Parameter(7))
.BinaryOperation(Token::Value::ADD, builder.Parameter(1),
vector->GetIndex(slot))
.BinaryOperation(Token::Value::ADD, builder.Parameter(2),
vector->GetIndex(slot1))
.BinaryOperation(Token::Value::ADD, builder.Parameter(3),
vector->GetIndex(slot2))
.BinaryOperation(Token::Value::ADD, builder.Parameter(4),
vector->GetIndex(slot3))
.BinaryOperation(Token::Value::ADD, builder.Parameter(5),
vector->GetIndex(slot4))
.BinaryOperation(Token::Value::ADD, builder.Parameter(6),
vector->GetIndex(slot5))
.BinaryOperation(Token::Value::ADD, builder.Parameter(7),
vector->GetIndex(slot6))
.Return();
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray();
......@@ -953,13 +1005,13 @@ static BytecodeArrayBuilder& SetRegister(BytecodeArrayBuilder& builder,
.LoadAccumulatorWithRegister(scratch);
}
static BytecodeArrayBuilder& IncrementRegister(BytecodeArrayBuilder& builder,
Register reg, int value,
Register scratch) {
Register scratch,
int slot_index) {
return builder.StoreAccumulatorInRegister(scratch)
.LoadLiteral(Smi::FromInt(value))
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, slot_index)
.StoreAccumulatorInRegister(reg)
.LoadAccumulatorWithRegister(scratch);
}
......@@ -967,9 +1019,19 @@ static BytecodeArrayBuilder& IncrementRegister(BytecodeArrayBuilder& builder,
TEST(InterpreterJumps) {
HandleAndZoneScope handles;
i::Isolate* isolate = handles.main_isolate();
i::Zone zone(isolate->allocator());
BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0,
0, 2);
i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot();
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(isolate, &feedback_spec);
Register reg(0), scratch(1);
BytecodeLabel label[3];
......@@ -977,11 +1039,13 @@ TEST(InterpreterJumps) {
.StoreAccumulatorInRegister(reg)
.Jump(&label[1]);
SetRegister(builder, reg, 1024, scratch).Bind(&label[0]);
IncrementRegister(builder, reg, 1, scratch).Jump(&label[2]);
IncrementRegister(builder, reg, 1, scratch, vector->GetIndex(slot))
.Jump(&label[2]);
SetRegister(builder, reg, 2048, scratch).Bind(&label[1]);
IncrementRegister(builder, reg, 2, scratch).Jump(&label[0]);
IncrementRegister(builder, reg, 2, scratch, vector->GetIndex(slot1))
.Jump(&label[0]);
SetRegister(builder, reg, 4096, scratch).Bind(&label[2]);
IncrementRegister(builder, reg, 4, scratch)
IncrementRegister(builder, reg, 4, scratch, vector->GetIndex(slot2))
.LoadAccumulatorWithRegister(reg)
.Return();
......@@ -995,9 +1059,21 @@ TEST(InterpreterJumps) {
TEST(InterpreterConditionalJumps) {
HandleAndZoneScope handles;
i::Isolate* isolate = handles.main_isolate();
i::Zone zone(isolate->allocator());
BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0,
0, 2);
i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot();
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(isolate, &feedback_spec);
Register reg(0), scratch(1);
BytecodeLabel label[2];
BytecodeLabel done, done1;
......@@ -1006,14 +1082,19 @@ TEST(InterpreterConditionalJumps) {
.StoreAccumulatorInRegister(reg)
.LoadFalse()
.JumpIfFalse(&label[0]);
IncrementRegister(builder, reg, 1024, scratch)
IncrementRegister(builder, reg, 1024, scratch, vector->GetIndex(slot))
.Bind(&label[0])
.LoadTrue()
.JumpIfFalse(&done);
IncrementRegister(builder, reg, 1, scratch).LoadTrue().JumpIfTrue(&label[1]);
IncrementRegister(builder, reg, 2048, scratch).Bind(&label[1]);
IncrementRegister(builder, reg, 2, scratch).LoadFalse().JumpIfTrue(&done1);
IncrementRegister(builder, reg, 4, scratch)
IncrementRegister(builder, reg, 1, scratch, vector->GetIndex(slot1))
.LoadTrue()
.JumpIfTrue(&label[1]);
IncrementRegister(builder, reg, 2048, scratch, vector->GetIndex(slot2))
.Bind(&label[1]);
IncrementRegister(builder, reg, 2, scratch, vector->GetIndex(slot3))
.LoadFalse()
.JumpIfTrue(&done1);
IncrementRegister(builder, reg, 4, scratch, vector->GetIndex(slot4))
.LoadAccumulatorWithRegister(reg)
.Bind(&done)
.Bind(&done1)
......@@ -1029,9 +1110,21 @@ TEST(InterpreterConditionalJumps) {
TEST(InterpreterConditionalJumps2) {
// TODO(oth): Add tests for all conditional jumps near and far.
HandleAndZoneScope handles;
i::Isolate* isolate = handles.main_isolate();
i::Zone zone(isolate->allocator());
BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 0,
0, 2);
i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot();
i::FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot();
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(isolate, &feedback_spec);
Register reg(0), scratch(1);
BytecodeLabel label[2];
BytecodeLabel done, done1;
......@@ -1040,14 +1133,19 @@ TEST(InterpreterConditionalJumps2) {
.StoreAccumulatorInRegister(reg)
.LoadFalse()
.JumpIfFalse(&label[0]);
IncrementRegister(builder, reg, 1024, scratch)
IncrementRegister(builder, reg, 1024, scratch, vector->GetIndex(slot))
.Bind(&label[0])
.LoadTrue()
.JumpIfFalse(&done);
IncrementRegister(builder, reg, 1, scratch).LoadTrue().JumpIfTrue(&label[1]);
IncrementRegister(builder, reg, 2048, scratch).Bind(&label[1]);
IncrementRegister(builder, reg, 2, scratch).LoadFalse().JumpIfTrue(&done1);
IncrementRegister(builder, reg, 4, scratch)
IncrementRegister(builder, reg, 1, scratch, vector->GetIndex(slot1))
.LoadTrue()
.JumpIfTrue(&label[1]);
IncrementRegister(builder, reg, 2048, scratch, vector->GetIndex(slot2))
.Bind(&label[1]);
IncrementRegister(builder, reg, 2, scratch, vector->GetIndex(slot3))
.LoadFalse()
.JumpIfTrue(&done1);
IncrementRegister(builder, reg, 4, scratch, vector->GetIndex(slot4))
.LoadAccumulatorWithRegister(reg)
.Bind(&done)
.Bind(&done1)
......@@ -1065,6 +1163,14 @@ TEST(InterpreterJumpConstantWith16BitOperand) {
BytecodeArrayBuilder builder(handles.main_isolate(), handles.main_zone(), 1,
0, 257);
i::Isolate* isolate = handles.main_isolate();
i::Zone zone(isolate->allocator());
i::FeedbackVectorSpec feedback_spec(&zone);
i::FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot();
Handle<i::TypeFeedbackVector> vector =
i::NewTypeFeedbackVector(isolate, &feedback_spec);
Register reg(0), scratch(256);
BytecodeLabel done, fake;
......@@ -1073,7 +1179,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) {
// Consume all 8-bit operands
for (int i = 1; i <= 256; i++) {
builder.LoadLiteral(handles.main_isolate()->factory()->NewNumber(i));
builder.BinaryOperation(Token::Value::ADD, reg);
builder.BinaryOperation(Token::Value::ADD, reg, vector->GetIndex(slot));
builder.StoreAccumulatorInRegister(reg);
}
builder.Jump(&done);
......@@ -1082,7 +1188,8 @@ TEST(InterpreterJumpConstantWith16BitOperand) {
builder.Bind(&fake);
for (int i = 0; i < 6600; i++) {
builder.LoadLiteral(Smi::FromInt(0)); // 1-byte
builder.BinaryOperation(Token::Value::ADD, scratch); // 4-bytes
builder.BinaryOperation(Token::Value::ADD, scratch,
vector->GetIndex(slot)); // 6-bytes
builder.StoreAccumulatorInRegister(scratch); // 4-bytes
builder.MoveRegister(scratch, reg); // 6-bytes
}
......
......@@ -365,8 +365,8 @@ TEST(VectorLoadICSlotSharing) {
CompileRun(
"o = 10;"
"function f() {"
" var x = o + 10;"
" return o + x + o;"
" var x = o || 10;"
" return o , x , o;"
"}"
"f();");
Handle<JSFunction> f = GetFunction("f");
......@@ -544,13 +544,15 @@ TEST(ReferenceContextAllocatesNoSlots) {
// of x.old and x.young.
Handle<TypeFeedbackVector> feedback_vector(f->feedback_vector());
FeedbackVectorHelper helper(feedback_vector);
CHECK_EQ(6, helper.slot_count());
CHECK_EQ(7, helper.slot_count());
CHECK_SLOT_KIND(helper, 0, FeedbackVectorSlotKind::LOAD_GLOBAL_IC);
CHECK_SLOT_KIND(helper, 1, FeedbackVectorSlotKind::STORE_IC);
CHECK_SLOT_KIND(helper, 2, FeedbackVectorSlotKind::STORE_IC);
CHECK_SLOT_KIND(helper, 3, FeedbackVectorSlotKind::STORE_IC);
CHECK_SLOT_KIND(helper, 4, FeedbackVectorSlotKind::LOAD_IC);
CHECK_SLOT_KIND(helper, 5, FeedbackVectorSlotKind::LOAD_IC);
// Binary operation feedback is a general slot.
CHECK_SLOT_KIND(helper, 6, FeedbackVectorSlotKind::GENERAL);
}
}
......
......@@ -64,7 +64,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Emit Ldar and Star taking care to foil the register optimizer.
builder.StackCheck(0)
.LoadAccumulatorWithRegister(other)
.BinaryOperation(Token::ADD, reg)
.BinaryOperation(Token::ADD, reg, 1)
.StoreAccumulatorInRegister(reg)
.LoadNull();
......@@ -123,38 +123,39 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
.CallJSRuntime(Context::SPREAD_ITERABLE_INDEX, wide, 1);
// Emit binary operator invocations.
builder.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::SUB, reg)
.BinaryOperation(Token::Value::MUL, reg)
.BinaryOperation(Token::Value::DIV, reg)
.BinaryOperation(Token::Value::MOD, reg);
builder.BinaryOperation(Token::Value::ADD, reg, 1)
.BinaryOperation(Token::Value::SUB, reg, 2)
.BinaryOperation(Token::Value::MUL, reg, 3)
.BinaryOperation(Token::Value::DIV, reg, 4)
.BinaryOperation(Token::Value::MOD, reg, 5);
// Emit bitwise operator invocations
builder.BinaryOperation(Token::Value::BIT_OR, reg)
.BinaryOperation(Token::Value::BIT_XOR, reg)
.BinaryOperation(Token::Value::BIT_AND, reg);
builder.BinaryOperation(Token::Value::BIT_OR, reg, 6)
.BinaryOperation(Token::Value::BIT_XOR, reg, 7)
.BinaryOperation(Token::Value::BIT_AND, reg, 8);
// Emit shift operator invocations
builder.BinaryOperation(Token::Value::SHL, reg)
.BinaryOperation(Token::Value::SAR, reg)
.BinaryOperation(Token::Value::SHR, reg);
builder.BinaryOperation(Token::Value::SHL, reg, 9)
.BinaryOperation(Token::Value::SAR, reg, 10)
.BinaryOperation(Token::Value::SHR, reg, 11);
// Emit peephole optimizations of LdaSmi followed by binary operation.
builder.LoadLiteral(Smi::FromInt(1))
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, 1)
.LoadLiteral(Smi::FromInt(2))
.BinaryOperation(Token::Value::SUB, reg)
.BinaryOperation(Token::Value::SUB, reg, 2)
.LoadLiteral(Smi::FromInt(3))
.BinaryOperation(Token::Value::BIT_AND, reg)
.BinaryOperation(Token::Value::BIT_AND, reg, 3)
.LoadLiteral(Smi::FromInt(4))
.BinaryOperation(Token::Value::BIT_OR, reg)
.BinaryOperation(Token::Value::BIT_OR, reg, 4)
.LoadLiteral(Smi::FromInt(5))
.BinaryOperation(Token::Value::SHL, reg)
.BinaryOperation(Token::Value::SHL, reg, 5)
.LoadLiteral(Smi::FromInt(6))
.BinaryOperation(Token::Value::SAR, reg);
.BinaryOperation(Token::Value::SAR, reg, 6);
// Emit count operatior invocations
builder.CountOperation(Token::Value::ADD).CountOperation(Token::Value::SUB);
builder.CountOperation(Token::Value::ADD, 1)
.CountOperation(Token::Value::SUB, 1);
// Emit unary operator invocations.
builder
......@@ -225,9 +226,9 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
.JumpIfFalse(&start);
// Perform an operation that returns a non-boolean operation to
// generate JumpIfToBooleanTrue/False.
builder.BinaryOperation(Token::Value::ADD, reg)
builder.BinaryOperation(Token::Value::ADD, reg, 1)
.JumpIfTrue(&start)
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, 2)
.JumpIfFalse(&start);
// Insert dummy ops to force longer jumps
for (int i = 0; i < 128; i++) {
......@@ -249,9 +250,9 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
.JumpIfFalse(&start);
// Perform an operation that returns a non-boolean operation to
// generate JumpIfToBooleanTrue/False.
builder.BinaryOperation(Token::Value::ADD, reg)
builder.BinaryOperation(Token::Value::ADD, reg, 1)
.JumpIfTrue(&start)
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, 2)
.JumpIfFalse(&start);
}
......@@ -353,9 +354,9 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Perform an operation that returns a non-boolean operation to
// generate JumpIfToBooleanTrue/False.
builder.BinaryOperation(Token::Value::ADD, reg)
builder.BinaryOperation(Token::Value::ADD, reg, 1)
.JumpIfTrue(&start)
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, 2)
.JumpIfFalse(&start);
// Emit generator operations
......@@ -563,9 +564,9 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
.JumpIfTrue(&near1)
.CompareOperation(Token::Value::EQ, reg)
.JumpIfFalse(&near2)
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, 1)
.JumpIfTrue(&near3)
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, 2)
.JumpIfFalse(&near4)
.Bind(&near0)
.Bind(&near1)
......@@ -578,22 +579,22 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
.JumpIfTrue(&far1)
.CompareOperation(Token::Value::EQ, reg)
.JumpIfFalse(&far2)
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, 3)
.JumpIfTrue(&far3)
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, 4)
.JumpIfFalse(&far4);
for (int i = 0; i < kFarJumpDistance - 18; i++) {
for (int i = 0; i < kFarJumpDistance - 20; i++) {
builder.Debugger();
}
builder.Bind(&far0).Bind(&far1).Bind(&far2).Bind(&far3).Bind(&far4);
builder.Return();
Handle<BytecodeArray> array = builder.ToBytecodeArray();
DCHECK_EQ(array->length(), 36 + kFarJumpDistance - 18 + 1);
DCHECK_EQ(array->length(), 40 + kFarJumpDistance - 20 + 1);
BytecodeArrayIterator iterator(array);
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump);
CHECK_EQ(iterator.GetImmediateOperand(0), 18);
CHECK_EQ(iterator.GetImmediateOperand(0), 20);
iterator.Advance();
// Ignore compare operation.
......@@ -601,7 +602,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
CHECK_EQ(iterator.current_bytecode(),
PeepholeToBoolean(Bytecode::kJumpIfToBooleanTrue));
CHECK_EQ(iterator.GetImmediateOperand(0), 14);
CHECK_EQ(iterator.GetImmediateOperand(0), 16);
iterator.Advance();
// Ignore compare operation.
......@@ -609,14 +610,14 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
CHECK_EQ(iterator.current_bytecode(),
PeepholeToBoolean(Bytecode::kJumpIfToBooleanFalse));
CHECK_EQ(iterator.GetImmediateOperand(0), 10);
CHECK_EQ(iterator.GetImmediateOperand(0), 12);
iterator.Advance();
// Ignore add operation.
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanTrue);
CHECK_EQ(iterator.GetImmediateOperand(0), 6);
CHECK_EQ(iterator.GetImmediateOperand(0), 7);
iterator.Advance();
// Ignore add operation.
......@@ -654,7 +655,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanTrueConstant);
CHECK_EQ(*iterator.GetConstantForIndexOperand(0),
Smi::FromInt(kFarJumpDistance - 12));
Smi::FromInt(kFarJumpDistance - 13));
iterator.Advance();
// Ignore add operation.
......@@ -663,7 +664,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
CHECK_EQ(iterator.current_bytecode(),
Bytecode::kJumpIfToBooleanFalseConstant);
CHECK_EQ(*iterator.GetConstantForIndexOperand(0),
Smi::FromInt(kFarJumpDistance - 16));
Smi::FromInt(kFarJumpDistance - 18));
iterator.Advance();
}
......@@ -684,12 +685,12 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) {
.CompareOperation(Token::Value::EQ, reg)
.JumpIfFalse(&label2)
.Bind(&label3)
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, 1)
.JumpIfTrue(&label3)
.Bind(&label4)
.BinaryOperation(Token::Value::ADD, reg)
.BinaryOperation(Token::Value::ADD, reg, 2)
.JumpIfFalse(&label4);
for (int i = 0; i < 63; i++) {
for (int i = 0; i < 62; i++) {
BytecodeLabel after_jump;
builder.Jump(&label4).Bind(&after_jump);
}
......@@ -699,8 +700,8 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) {
builder.Debugger();
}
builder.BinaryOperation(Token::Value::ADD, reg).JumpIfFalse(&label4);
builder.BinaryOperation(Token::Value::ADD, reg).JumpIfTrue(&label3);
builder.BinaryOperation(Token::Value::ADD, reg, 1).JumpIfFalse(&label4);
builder.BinaryOperation(Token::Value::ADD, reg, 2).JumpIfTrue(&label3);
builder.CompareOperation(Token::Value::EQ, reg).JumpIfFalse(&label2);
builder.CompareOperation(Token::Value::EQ, reg).JumpIfTrue(&label1);
builder.Jump(&label0);
......@@ -731,18 +732,19 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) {
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanTrue);
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
CHECK_EQ(iterator.GetImmediateOperand(0), -2);
CHECK_EQ(iterator.GetImmediateOperand(0), -3);
iterator.Advance();
// Ignore binary operation.
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanFalse);
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
CHECK_EQ(iterator.GetImmediateOperand(0), -2);
CHECK_EQ(iterator.GetImmediateOperand(0), -3);
iterator.Advance();
for (int i = 0; i < 63; i++) {
for (int i = 0; i < 62; i++) {
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump);
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
CHECK_EQ(iterator.GetImmediateOperand(0), -i * 2 - 4);
// offset of 5 (3 for binary operation and 2 for jump)
CHECK_EQ(iterator.GetImmediateOperand(0), -i * 2 - 5);
iterator.Advance();
}
// Check padding to force wide backwards jumps.
......@@ -760,25 +762,25 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) {
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanTrue);
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kDouble);
CHECK_EQ(iterator.GetImmediateOperand(0), -399);
CHECK_EQ(iterator.GetImmediateOperand(0), -401);
iterator.Advance();
// Ignore compare operation.
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(),
PeepholeToBoolean(Bytecode::kJumpIfToBooleanFalse));
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kDouble);
CHECK_EQ(iterator.GetImmediateOperand(0), -409);
CHECK_EQ(iterator.GetImmediateOperand(0), -411);
iterator.Advance();
// Ignore compare operation.
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(),
PeepholeToBoolean(Bytecode::kJumpIfToBooleanTrue));
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kDouble);
CHECK_EQ(iterator.GetImmediateOperand(0), -419);
CHECK_EQ(iterator.GetImmediateOperand(0), -421);
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump);
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kDouble);
CHECK_EQ(iterator.GetImmediateOperand(0), -425);
CHECK_EQ(iterator.GetImmediateOperand(0), -427);
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
iterator.Advance();
......
......@@ -49,10 +49,10 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
.StackCheck(1)
.StoreAccumulatorInRegister(reg_1)
.LoadAccumulatorWithRegister(reg_0)
.BinaryOperation(Token::Value::ADD, reg_0)
.BinaryOperation(Token::Value::ADD, reg_0, 2)
.StoreAccumulatorInRegister(reg_1)
.LoadNamedProperty(reg_1, name, feedback_slot)
.BinaryOperation(Token::Value::ADD, reg_0)
.BinaryOperation(Token::Value::ADD, reg_0, 3)
.StoreAccumulatorInRegister(param)
.CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0)
.ForInPrepare(reg_0, reg_0)
......@@ -181,7 +181,7 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
CHECK(!iterator.done());
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
offset += Bytecodes::Size(Bytecode::kAdd, OperandScale::kSingle);
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
......@@ -209,7 +209,7 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index());
CHECK_EQ(iterator.GetRegisterOperandRange(0), 1);
CHECK(!iterator.done());
offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle);
offset += Bytecodes::Size(Bytecode::kAdd, OperandScale::kSingle);
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar);
......
......@@ -50,7 +50,7 @@ class BytecodeDeadCodeOptimizerTest : public BytecodePipelineStage,
};
TEST_F(BytecodeDeadCodeOptimizerTest, LiveCodeKept) {
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
optimizer()->Write(&add);
CHECK_EQ(write_count(), 1);
CHECK_EQ(add, last_written());
......@@ -68,7 +68,7 @@ TEST_F(BytecodeDeadCodeOptimizerTest, DeadCodeAfterReturnEliminated) {
CHECK_EQ(write_count(), 1);
CHECK_EQ(ret, last_written());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
optimizer()->Write(&add);
CHECK_EQ(write_count(), 1);
CHECK_EQ(ret, last_written());
......@@ -80,7 +80,7 @@ TEST_F(BytecodeDeadCodeOptimizerTest, DeadCodeAfterThrowEliminated) {
CHECK_EQ(write_count(), 1);
CHECK_EQ(thrw, last_written());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
optimizer()->Write(&add);
CHECK_EQ(write_count(), 1);
CHECK_EQ(thrw, last_written());
......@@ -92,7 +92,7 @@ TEST_F(BytecodeDeadCodeOptimizerTest, DeadCodeAfterReThrowEliminated) {
CHECK_EQ(write_count(), 1);
CHECK_EQ(rethrow, last_written());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
optimizer()->Write(&add);
CHECK_EQ(write_count(), 1);
CHECK_EQ(rethrow, last_written());
......@@ -105,7 +105,7 @@ TEST_F(BytecodeDeadCodeOptimizerTest, DeadCodeAfterJumpEliminated) {
CHECK_EQ(write_count(), 1);
CHECK_EQ(jump, last_written());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
optimizer()->Write(&add);
CHECK_EQ(write_count(), 1);
CHECK_EQ(jump, last_written());
......@@ -123,7 +123,7 @@ TEST_F(BytecodeDeadCodeOptimizerTest, DeadCodeStillDeadAfterConditinalJump) {
CHECK_EQ(write_count(), 1);
CHECK_EQ(ret, last_written());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
optimizer()->Write(&add);
CHECK_EQ(write_count(), 1);
CHECK_EQ(ret, last_written());
......@@ -138,7 +138,7 @@ TEST_F(BytecodeDeadCodeOptimizerTest, CodeLiveAfterLabelBind) {
BytecodeLabel target;
optimizer()->BindLabel(&target);
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
optimizer()->Write(&add);
CHECK_EQ(write_count(), 2);
CHECK_EQ(add, last_written());
......
......@@ -70,7 +70,7 @@ class BytecodePeepholeOptimizerTest : public BytecodePipelineStage,
TEST_F(BytecodePeepholeOptimizerTest, FlushOnJump) {
CHECK_EQ(write_count(), 0);
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
optimizer()->Write(&add);
CHECK_EQ(write_count(), 0);
......@@ -84,7 +84,7 @@ TEST_F(BytecodePeepholeOptimizerTest, FlushOnJump) {
TEST_F(BytecodePeepholeOptimizerTest, FlushOnBind) {
CHECK_EQ(write_count(), 0);
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
optimizer()->Write(&add);
CHECK_EQ(write_count(), 0);
......@@ -99,7 +99,7 @@ TEST_F(BytecodePeepholeOptimizerTest, FlushOnBind) {
TEST_F(BytecodePeepholeOptimizerTest, ElideEmptyNop) {
BytecodeNode nop(Bytecode::kNop);
optimizer()->Write(&nop);
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
optimizer()->Write(&add);
Flush();
CHECK_EQ(write_count(), 1);
......@@ -110,7 +110,7 @@ TEST_F(BytecodePeepholeOptimizerTest, ElideExpressionNop) {
BytecodeNode nop(Bytecode::kNop);
nop.source_info().MakeExpressionPosition(3);
optimizer()->Write(&nop);
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
optimizer()->Write(&add);
Flush();
CHECK_EQ(write_count(), 1);
......@@ -121,7 +121,7 @@ TEST_F(BytecodePeepholeOptimizerTest, KeepStatementNop) {
BytecodeNode nop(Bytecode::kNop);
nop.source_info().MakeStatementPosition(3);
optimizer()->Write(&nop);
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand());
BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1);
add.source_info().MakeExpressionPosition(3);
optimizer()->Write(&add);
Flush();
......@@ -494,7 +494,7 @@ TEST_F(BytecodePeepholeOptimizerTest, MergeLdaSmiWithBinaryOp) {
BytecodeNode first(Bytecode::kLdaSmi, imm_operand);
first.source_info().Clone({3, true});
uint32_t reg_operand = Register(0).ToOperand();
BytecodeNode second(operator_replacement[0], reg_operand);
BytecodeNode second(operator_replacement[0], reg_operand, 1);
optimizer()->Write(&first);
optimizer()->Write(&second);
Flush();
......@@ -522,7 +522,7 @@ TEST_F(BytecodePeepholeOptimizerTest, NotMergingLdaSmiWithBinaryOp) {
BytecodeNode first(Bytecode::kLdaSmi, imm_operand);
first.source_info().Clone({3, true});
uint32_t reg_operand = Register(0).ToOperand();
BytecodeNode second(operator_replacement[0], reg_operand);
BytecodeNode second(operator_replacement[0], reg_operand, 1);
second.source_info().Clone({4, true});
optimizer()->Write(&first);
optimizer()->Write(&second);
......@@ -545,7 +545,7 @@ TEST_F(BytecodePeepholeOptimizerTest, MergeLdaZeroWithBinaryOp) {
for (auto operator_replacement : operator_replacement_pairs) {
BytecodeNode first(Bytecode::kLdaZero);
uint32_t reg_operand = Register(0).ToOperand();
BytecodeNode second(operator_replacement[0], reg_operand);
BytecodeNode second(operator_replacement[0], reg_operand, 1);
optimizer()->Write(&first);
optimizer()->Write(&second);
Flush();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment