Index: src/interpreter/interpreter.cc |
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
index 8ff3c159dfeb79b604823d43ccb7d0206509b9ed..d2afe03d41e286c7741bbdfb9d6dafcd4e566f8d 100644 |
--- a/src/interpreter/interpreter.cc |
+++ b/src/interpreter/interpreter.cc |
@@ -1793,6 +1793,33 @@ 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 = __ BytecodeOperandFlag(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); |
rmcilroy
2016/07/25 12:40:24
It looks like OSR nesting level initialized to 0 i
Michael Starzinger
2016/07/25 13:40:48
The {OsrPoll} handler will fall-through (i.e. the
rmcilroy
2016/07/26 09:26:44
You are right, sorry I got the labels on the branc
|
+ __ Branch(condition, &ok, &osr_armed); |
+ |
+ __ Bind(&ok); |
+ __ Dispatch(); |
+ |
+ __ Bind(&osr_armed); |
+ { |
+ Callable callable = CodeFactory::InterpreterOnStackReplacement(isolate_); |
+ Node* target = __ HeapConstant(callable.code()); |
+ Node* context = __ GetContext(); |
+ // TODO(4764): We don't have a CallStub method with zero arguments, add one! |
rmcilroy
2016/07/25 12:40:24
Could you do that with this CL please?
Michael Starzinger
2016/07/25 13:40:48
Done.
|
+ __ CallStub(callable.descriptor(), target, context, context); |
+ __ Dispatch(); |
+ } |
+} |
+ |
// Throw |
// |
// Throws the exception in the accumulator. |