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

Unified Diff: src/interpreter/interpreter.cc

Issue 2331033002: [interpreter] Merge {OsrPoll} with {Jump} bytecode. (Closed)
Patch Set: Fix for wide jumps. Created 4 years, 3 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.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 7a38a63e128e025b18a30cc6e6a1cce18835b479..bdc42ab93239b6047b84e257479e620da4b3dd64 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -1847,6 +1847,35 @@ void Interpreter::DoJumpIfNotHoleConstant(InterpreterAssembler* assembler) {
__ JumpIfWordNotEqual(accumulator, the_hole_value, relative_jump);
}
+// JumpLoop <imm> <loop_depth>
+//
+// Jump by number of bytes represented by the immediate operand |imm|. Also
+// performs a loop nesting check and potentially triggers OSR in case the
+// current OSR level matches (or exceeds) the specified |loop_depth|.
+void Interpreter::DoJumpLoop(InterpreterAssembler* assembler) {
+ Node* relative_jump = __ BytecodeOperandImm(0);
+ Node* loop_depth = __ BytecodeOperandImm(1);
+ Node* osr_level = __ LoadOSRNestingLevel();
+
+ // Check if OSR points at the given {loop_depth} are armed by comparing it to
+ // the current {osr_level} loaded from the header of the BytecodeArray.
+ Label ok(assembler), osr_armed(assembler, Label::kDeferred);
+ Node* condition = __ Int32GreaterThanOrEqual(loop_depth, osr_level);
+ __ Branch(condition, &ok, &osr_armed);
+
+ __ Bind(&ok);
+ __ Jump(relative_jump);
+
+ __ Bind(&osr_armed);
+ {
+ Callable callable = CodeFactory::InterpreterOnStackReplacement(isolate_);
+ Node* target = __ HeapConstant(callable.code());
+ Node* context = __ GetContext();
+ __ CallStub(callable.descriptor(), target, context);
+ __ Jump(relative_jump);
+ }
+}
+
// CreateRegExpLiteral <pattern_idx> <literal_idx> <flags>
//
// Creates a regular expression literal for literal index <literal_idx> with
@@ -2117,32 +2146,6 @@ void Interpreter::DoStackCheck(InterpreterAssembler* assembler) {
}
}
-// OsrPoll <loop_depth>
-//
-// Performs a loop nesting check and potentially triggers OSR.
-void Interpreter::DoOsrPoll(InterpreterAssembler* assembler) {
- Node* loop_depth = __ BytecodeOperandImm(0);
- Node* osr_level = __ LoadOSRNestingLevel();
-
- // Check if OSR points at the given {loop_depth} are armed by comparing it to
- // the current {osr_level} loaded from the header of the BytecodeArray.
- Label ok(assembler), osr_armed(assembler, Label::kDeferred);
- Node* condition = __ Int32GreaterThanOrEqual(loop_depth, osr_level);
- __ Branch(condition, &ok, &osr_armed);
-
- __ Bind(&ok);
- __ Dispatch();
-
- __ Bind(&osr_armed);
- {
- Callable callable = CodeFactory::InterpreterOnStackReplacement(isolate_);
- Node* target = __ HeapConstant(callable.code());
- Node* context = __ GetContext();
- __ CallStub(callable.descriptor(), target, context);
- __ Dispatch();
- }
-}
-
// Throw
//
// Throws the exception in the accumulator.

Powered by Google App Engine
This is Rietveld 408576698