| Index: runtime/vm/intermediate_language_ia32.cc
|
| diff --git a/runtime/vm/intermediate_language_ia32.cc b/runtime/vm/intermediate_language_ia32.cc
|
| index 500ca7148997a911f68cdfd8bc779c4868520ea0..b322ce0df29bc6d611243fb4c970d0c120b395c5 100644
|
| --- a/runtime/vm/intermediate_language_ia32.cc
|
| +++ b/runtime/vm/intermediate_language_ia32.cc
|
| @@ -23,6 +23,7 @@ namespace dart {
|
|
|
| DECLARE_FLAG(int, optimization_counter_threshold);
|
| DECLARE_FLAG(bool, propagate_ic_data);
|
| +DECLARE_FLAG(bool, use_osr);
|
|
|
| // Generic summary for call instructions that have all arguments pushed
|
| // on the stack and return the result in a fixed register EAX.
|
| @@ -2122,6 +2123,13 @@ class CheckStackOverflowSlowPath : public SlowPathCode {
|
| instruction_->deopt_id(),
|
| kStackOverflowRuntimeEntry,
|
| instruction_->locs());
|
| +
|
| + if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->is_loop()) {
|
| + // In unoptimized code, record loop stack checks as possible OSR entries.
|
| + compiler->AddCurrentDescriptor(PcDescriptors::kOsrEntry,
|
| + instruction_->deopt_id(),
|
| + 0); // No token position.
|
| + }
|
| compiler->pending_deoptimization_env_ = NULL;
|
| compiler->RestoreLiveRegisters(instruction_->locs());
|
| __ jmp(exit_label());
|
| @@ -2139,6 +2147,14 @@ void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
|
| __ cmpl(ESP,
|
| Address::Absolute(Isolate::Current()->stack_limit_address()));
|
| __ j(BELOW_EQUAL, slow_path->entry_label());
|
| + if (FLAG_use_osr && !compiler->is_optimizing() && is_loop()) {
|
| + // In unoptimized code check the usage counter to trigger OSR at loop
|
| + // stack checks.
|
| + __ LoadObject(EDI, compiler->parsed_function().function());
|
| + __ cmpl(FieldAddress(EDI, Function::usage_counter_offset()),
|
| + Immediate(2 * FLAG_optimization_counter_threshold));
|
| + __ j(GREATER_EQUAL, slow_path->entry_label());
|
| + }
|
| __ Bind(slow_path->exit_label());
|
| }
|
|
|
|
|