| Index: src/interpreter/interpreter-assembler.cc
|
| diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc
|
| index 1ccd342f0662470b54d283ea416cc361244ba2ef..3323fda5ff4013eec6811d12bdd94c4ccb8dbd98 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));
|
| @@ -854,7 +858,7 @@ Node* InterpreterAssembler::CallRuntimeN(Node* function_id, Node* context,
|
| arg_count, first_arg, function_entry);
|
| }
|
|
|
| -void InterpreterAssembler::UpdateInterruptBudget(Node* weight) {
|
| +void InterpreterAssembler::UpdateInterruptBudget(Node* weight, bool backwards) {
|
| // TODO(rmcilroy): It might be worthwhile to only update the budget for
|
| // backwards branches. Those are distinguishable by the {JumpLoop} bytecode.
|
|
|
| @@ -866,7 +870,11 @@ 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));
|
| + if (backwards) {
|
| + new_budget.Bind(Int32Sub(old_budget, weight));
|
| + } else {
|
| + new_budget.Bind(Int32Add(old_budget, weight));
|
| + }
|
| Node* condition =
|
| Int32GreaterThanOrEqual(new_budget.value(), Int32Constant(0));
|
| Branch(condition, &ok, &interrupt_check);
|
| @@ -894,20 +902,21 @@ Node* InterpreterAssembler::Advance(int delta) {
|
| return Advance(IntPtrConstant(delta));
|
| }
|
|
|
| -Node* InterpreterAssembler::Advance(Node* delta) {
|
| +Node* InterpreterAssembler::Advance(Node* delta, bool backwards) {
|
| if (FLAG_trace_ignition) {
|
| TraceBytecode(Runtime::kInterpreterTraceBytecodeExit);
|
| }
|
| - Node* next_offset = IntPtrAdd(BytecodeOffset(), delta);
|
| + Node* next_offset = backwards ? 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 backwards) {
|
| DCHECK(!Bytecodes::IsStarLookahead(bytecode_, operand_scale_));
|
|
|
| - UpdateInterruptBudget(TruncateWordToWord32(delta));
|
| - Node* new_bytecode_offset = Advance(delta);
|
| + UpdateInterruptBudget(TruncateWordToWord32(delta), backwards);
|
| + Node* new_bytecode_offset = Advance(delta, backwards);
|
| Node* target_bytecode = LoadBytecode(new_bytecode_offset);
|
| return DispatchToBytecode(target_bytecode, new_bytecode_offset);
|
| }
|
| @@ -1147,7 +1156,7 @@ void InterpreterAssembler::UpdateInterruptBudgetOnReturn() {
|
| Node* profiling_weight =
|
| Int32Sub(Int32Constant(kHeapObjectTag + BytecodeArray::kHeaderSize),
|
| TruncateWordToWord32(BytecodeOffset()));
|
| - UpdateInterruptBudget(profiling_weight);
|
| + UpdateInterruptBudget(profiling_weight, false);
|
| }
|
|
|
| Node* InterpreterAssembler::StackCheckTriggeredInterrupt() {
|
|
|