| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 2547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2558 return summary; | 2558 return summary; |
| 2559 } | 2559 } |
| 2560 | 2560 |
| 2561 | 2561 |
| 2562 class CheckStackOverflowSlowPath : public SlowPathCode { | 2562 class CheckStackOverflowSlowPath : public SlowPathCode { |
| 2563 public: | 2563 public: |
| 2564 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) | 2564 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) |
| 2565 : instruction_(instruction) {} | 2565 : instruction_(instruction) {} |
| 2566 | 2566 |
| 2567 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2567 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2568 if (FLAG_use_osr && osr_entry_label()->IsLinked()) { | 2568 if (compiler->isolate()->use_osr() && osr_entry_label()->IsLinked()) { |
| 2569 __ Comment("CheckStackOverflowSlowPathOsr"); | 2569 __ Comment("CheckStackOverflowSlowPathOsr"); |
| 2570 __ Bind(osr_entry_label()); | 2570 __ Bind(osr_entry_label()); |
| 2571 __ movl(Address(THR, Thread::stack_overflow_flags_offset()), | 2571 __ movl(Address(THR, Thread::stack_overflow_flags_offset()), |
| 2572 Immediate(Thread::kOsrRequest)); | 2572 Immediate(Thread::kOsrRequest)); |
| 2573 } | 2573 } |
| 2574 __ Comment("CheckStackOverflowSlowPath"); | 2574 __ Comment("CheckStackOverflowSlowPath"); |
| 2575 __ Bind(entry_label()); | 2575 __ Bind(entry_label()); |
| 2576 compiler->SaveLiveRegisters(instruction_->locs()); | 2576 compiler->SaveLiveRegisters(instruction_->locs()); |
| 2577 // pending_deoptimization_env_ is needed to generate a runtime call that | 2577 // pending_deoptimization_env_ is needed to generate a runtime call that |
| 2578 // may throw an exception. | 2578 // may throw an exception. |
| 2579 ASSERT(compiler->pending_deoptimization_env_ == NULL); | 2579 ASSERT(compiler->pending_deoptimization_env_ == NULL); |
| 2580 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); | 2580 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 2581 compiler->pending_deoptimization_env_ = env; | 2581 compiler->pending_deoptimization_env_ = env; |
| 2582 compiler->GenerateRuntimeCall( | 2582 compiler->GenerateRuntimeCall( |
| 2583 instruction_->token_pos(), instruction_->deopt_id(), | 2583 instruction_->token_pos(), instruction_->deopt_id(), |
| 2584 kStackOverflowRuntimeEntry, 0, instruction_->locs()); | 2584 kStackOverflowRuntimeEntry, 0, instruction_->locs()); |
| 2585 | 2585 |
| 2586 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { | 2586 if (compiler->isolate()->use_osr() && !compiler->is_optimizing() && |
| 2587 instruction_->in_loop()) { |
| 2587 // In unoptimized code, record loop stack checks as possible OSR entries. | 2588 // In unoptimized code, record loop stack checks as possible OSR entries. |
| 2588 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, | 2589 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, |
| 2589 instruction_->deopt_id(), | 2590 instruction_->deopt_id(), |
| 2590 TokenPosition::kNoSource); | 2591 TokenPosition::kNoSource); |
| 2591 } | 2592 } |
| 2592 compiler->pending_deoptimization_env_ = NULL; | 2593 compiler->pending_deoptimization_env_ = NULL; |
| 2593 compiler->RestoreLiveRegisters(instruction_->locs()); | 2594 compiler->RestoreLiveRegisters(instruction_->locs()); |
| 2594 __ jmp(exit_label()); | 2595 __ jmp(exit_label()); |
| 2595 } | 2596 } |
| 2596 | 2597 |
| 2597 Label* osr_entry_label() { | 2598 Label* osr_entry_label() { |
| 2598 ASSERT(FLAG_use_osr); | 2599 ASSERT(Isolate::Current()->use_osr()); |
| 2599 return &osr_entry_label_; | 2600 return &osr_entry_label_; |
| 2600 } | 2601 } |
| 2601 | 2602 |
| 2602 private: | 2603 private: |
| 2603 CheckStackOverflowInstr* instruction_; | 2604 CheckStackOverflowInstr* instruction_; |
| 2604 Label osr_entry_label_; | 2605 Label osr_entry_label_; |
| 2605 }; | 2606 }; |
| 2606 | 2607 |
| 2607 | 2608 |
| 2608 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2609 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 4262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6871 __ Drop(1); | 6872 __ Drop(1); |
| 6872 __ popl(result); | 6873 __ popl(result); |
| 6873 } | 6874 } |
| 6874 | 6875 |
| 6875 | 6876 |
| 6876 } // namespace dart | 6877 } // namespace dart |
| 6877 | 6878 |
| 6878 #undef __ | 6879 #undef __ |
| 6879 | 6880 |
| 6880 #endif // defined TARGET_ARCH_IA32 | 6881 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |