Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Unified Diff: src/interpreter/interpreter-assembler.cc

Issue 2641443002: [ignition] Use absolute values for jump offsets (Closed)
Patch Set: Fix unsigned comparison Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
}
« no previous file with comments | « src/interpreter/interpreter-assembler.h ('k') | test/cctest/interpreter/bytecode_expectations/BasicLoops.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698