Index: runtime/vm/intermediate_language_x64.cc |
diff --git a/runtime/vm/intermediate_language_x64.cc b/runtime/vm/intermediate_language_x64.cc |
index 310a16ac86239ce3f24adf01af96bb30d3cf062b..ff5a95ec8942364a47a5a80f498be8c9ab98306d 100644 |
--- a/runtime/vm/intermediate_language_x64.cc |
+++ b/runtime/vm/intermediate_language_x64.cc |
@@ -2317,6 +2317,14 @@ class CheckStackOverflowSlowPath : public SlowPathCode { |
: instruction_(instruction) { } |
virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
+ if (FLAG_use_osr) { |
+ uword flags_address = Isolate::Current()->stack_overflow_flags_address(); |
+ Register temp = instruction_->locs()->temp(0).reg(); |
+ __ Comment("CheckStackOverflowSlowPathOsr"); |
+ __ Bind(osr_entry_label()); |
+ __ LoadImmediate(temp, Immediate(flags_address), PP); |
+ __ movq(Address(temp, 0), Immediate(Isolate::kOsrRequest)); |
+ } |
__ Comment("CheckStackOverflowSlowPath"); |
__ Bind(entry_label()); |
compiler->SaveLiveRegisters(instruction_->locs()); |
@@ -2342,8 +2350,15 @@ class CheckStackOverflowSlowPath : public SlowPathCode { |
__ jmp(exit_label()); |
} |
+ |
+ Label* osr_entry_label() { |
+ ASSERT(FLAG_use_osr); |
+ return &osr_entry_label_; |
+ } |
+ |
private: |
CheckStackOverflowInstr* instruction_; |
+ Label osr_entry_label_; |
}; |
@@ -2366,7 +2381,10 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
FLAG_optimization_counter_threshold * (loop_depth() + 1); |
__ CompareImmediate(FieldAddress(temp, Function::usage_counter_offset()), |
Immediate(threshold), PP); |
- __ j(GREATER_EQUAL, slow_path->entry_label()); |
+ __ j(GREATER_EQUAL, slow_path->osr_entry_label()); |
+ } |
+ if (compiler->ForceSlowPathForStackOverflow()) { |
+ __ jmp(slow_path->entry_label()); |
} |
__ Bind(slow_path->exit_label()); |
} |