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

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

Issue 2641443002: [ignition] Use absolute values for jump offsets (Closed)
Patch Set: Fix build 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..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() {

Powered by Google App Engine
This is Rietveld 408576698