Index: src/interpreter/interpreter-assembler.cc |
diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc |
index 1ccd342f0662470b54d283ea416cc361244ba2ef..5386f37a56646acf7b230d93a88eb85049547497 100644 |
--- a/src/interpreter/interpreter-assembler.cc |
+++ b/src/interpreter/interpreter-assembler.cc |
@@ -395,6 +395,10 @@ Node* InterpreterAssembler::BytecodeOperandUImm(int operand_index) { |
return BytecodeUnsignedOperand(operand_index, operand_size); |
} |
+Node* InterpreterAssembler::BytecodeOperandUImmWord(int operand_index) { |
+ return ChangeUint32ToWord(BytecodeOperandUImm(operand_index)); |
+} |
+ |
Node* InterpreterAssembler::BytecodeOperandImm(int operand_index) { |
DCHECK_EQ(OperandType::kImm, |
Bytecodes::GetOperandType(bytecode_, operand_index)); |
@@ -855,9 +859,6 @@ Node* InterpreterAssembler::CallRuntimeN(Node* function_id, Node* context, |
} |
void InterpreterAssembler::UpdateInterruptBudget(Node* weight) { |
- // TODO(rmcilroy): It might be worthwhile to only update the budget for |
- // backwards branches. Those are distinguishable by the {JumpLoop} bytecode. |
- |
Label ok(this), interrupt_check(this, Label::kDeferred), end(this); |
Node* budget_offset = |
IntPtrConstant(BytecodeArray::kInterruptBudgetOffset - kHeapObjectTag); |
@@ -866,7 +867,7 @@ void InterpreterAssembler::UpdateInterruptBudget(Node* weight) { |
Variable new_budget(this, MachineRepresentation::kWord32); |
Node* old_budget = |
Load(MachineType::Int32(), BytecodeArrayTaggedPointer(), budget_offset); |
- new_budget.Bind(Int32Add(old_budget, weight)); |
+ new_budget.Bind(Int32Sub(old_budget, weight)); |
Node* condition = |
Int32GreaterThanOrEqual(new_budget.value(), Int32Constant(0)); |
Branch(condition, &ok, &interrupt_check); |
@@ -894,20 +895,23 @@ Node* InterpreterAssembler::Advance(int delta) { |
return Advance(IntPtrConstant(delta)); |
} |
-Node* InterpreterAssembler::Advance(Node* delta) { |
+Node* InterpreterAssembler::Advance(Node* delta, bool reverse) { |
if (FLAG_trace_ignition) { |
TraceBytecode(Runtime::kInterpreterTraceBytecodeExit); |
} |
- Node* next_offset = IntPtrAdd(BytecodeOffset(), delta); |
+ Node* next_offset = reverse ? IntPtrSub(BytecodeOffset(), delta) |
+ : IntPtrAdd(BytecodeOffset(), delta); |
bytecode_offset_.Bind(next_offset); |
return next_offset; |
} |
-Node* InterpreterAssembler::Jump(Node* delta) { |
+Node* InterpreterAssembler::Jump(Node* delta, bool reverse) { |
DCHECK(!Bytecodes::IsStarLookahead(bytecode_, operand_scale_)); |
- UpdateInterruptBudget(TruncateWordToWord32(delta)); |
- Node* new_bytecode_offset = Advance(delta); |
+ if (reverse) { |
rmcilroy
2017/01/17 17:58:38
Could this be done separately (or maybe not at all
Leszek Swirski
2017/01/18 17:22:28
Sure, added a "reverse" flag same as for advance.
|
+ UpdateInterruptBudget(TruncateWordToWord32(delta)); |
+ } |
+ Node* new_bytecode_offset = Advance(delta, reverse); |
Node* target_bytecode = LoadBytecode(new_bytecode_offset); |
return DispatchToBytecode(target_bytecode, new_bytecode_offset); |
} |