| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 2614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2625 return summary; | 2625 return summary; |
| 2626 } | 2626 } |
| 2627 | 2627 |
| 2628 | 2628 |
| 2629 class CheckStackOverflowSlowPath : public SlowPathCode { | 2629 class CheckStackOverflowSlowPath : public SlowPathCode { |
| 2630 public: | 2630 public: |
| 2631 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) | 2631 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) |
| 2632 : instruction_(instruction) {} | 2632 : instruction_(instruction) {} |
| 2633 | 2633 |
| 2634 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2634 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2635 if (FLAG_use_osr && osr_entry_label()->IsLinked()) { | 2635 if (compiler->isolate()->use_osr() && osr_entry_label()->IsLinked()) { |
| 2636 __ Comment("CheckStackOverflowSlowPathOsr"); | 2636 __ Comment("CheckStackOverflowSlowPathOsr"); |
| 2637 __ Bind(osr_entry_label()); | 2637 __ Bind(osr_entry_label()); |
| 2638 __ movq(Address(THR, Thread::stack_overflow_flags_offset()), | 2638 __ movq(Address(THR, Thread::stack_overflow_flags_offset()), |
| 2639 Immediate(Thread::kOsrRequest)); | 2639 Immediate(Thread::kOsrRequest)); |
| 2640 } | 2640 } |
| 2641 __ Comment("CheckStackOverflowSlowPath"); | 2641 __ Comment("CheckStackOverflowSlowPath"); |
| 2642 __ Bind(entry_label()); | 2642 __ Bind(entry_label()); |
| 2643 compiler->SaveLiveRegisters(instruction_->locs()); | 2643 compiler->SaveLiveRegisters(instruction_->locs()); |
| 2644 // pending_deoptimization_env_ is needed to generate a runtime call that | 2644 // pending_deoptimization_env_ is needed to generate a runtime call that |
| 2645 // may throw an exception. | 2645 // may throw an exception. |
| 2646 ASSERT(compiler->pending_deoptimization_env_ == NULL); | 2646 ASSERT(compiler->pending_deoptimization_env_ == NULL); |
| 2647 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); | 2647 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 2648 compiler->pending_deoptimization_env_ = env; | 2648 compiler->pending_deoptimization_env_ = env; |
| 2649 compiler->GenerateRuntimeCall( | 2649 compiler->GenerateRuntimeCall( |
| 2650 instruction_->token_pos(), instruction_->deopt_id(), | 2650 instruction_->token_pos(), instruction_->deopt_id(), |
| 2651 kStackOverflowRuntimeEntry, 0, instruction_->locs()); | 2651 kStackOverflowRuntimeEntry, 0, instruction_->locs()); |
| 2652 | 2652 |
| 2653 if (FLAG_use_osr && !compiler->is_optimizing() && instruction_->in_loop()) { | 2653 if (compiler->isolate()->use_osr() && !compiler->is_optimizing() && |
| 2654 instruction_->in_loop()) { |
| 2654 // In unoptimized code, record loop stack checks as possible OSR entries. | 2655 // In unoptimized code, record loop stack checks as possible OSR entries. |
| 2655 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, | 2656 compiler->AddCurrentDescriptor(RawPcDescriptors::kOsrEntry, |
| 2656 instruction_->deopt_id(), | 2657 instruction_->deopt_id(), |
| 2657 TokenPosition::kNoSource); | 2658 TokenPosition::kNoSource); |
| 2658 } | 2659 } |
| 2659 compiler->pending_deoptimization_env_ = NULL; | 2660 compiler->pending_deoptimization_env_ = NULL; |
| 2660 compiler->RestoreLiveRegisters(instruction_->locs()); | 2661 compiler->RestoreLiveRegisters(instruction_->locs()); |
| 2661 __ jmp(exit_label()); | 2662 __ jmp(exit_label()); |
| 2662 } | 2663 } |
| 2663 | 2664 |
| 2664 | 2665 |
| 2665 Label* osr_entry_label() { | 2666 Label* osr_entry_label() { |
| 2666 ASSERT(FLAG_use_osr); | 2667 ASSERT(Isolate::Current()->use_osr()); |
| 2667 return &osr_entry_label_; | 2668 return &osr_entry_label_; |
| 2668 } | 2669 } |
| 2669 | 2670 |
| 2670 private: | 2671 private: |
| 2671 CheckStackOverflowInstr* instruction_; | 2672 CheckStackOverflowInstr* instruction_; |
| 2672 Label osr_entry_label_; | 2673 Label osr_entry_label_; |
| 2673 }; | 2674 }; |
| 2674 | 2675 |
| 2675 | 2676 |
| 2676 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2677 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 4072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6749 __ Drop(1); | 6750 __ Drop(1); |
| 6750 __ popq(result); | 6751 __ popq(result); |
| 6751 } | 6752 } |
| 6752 | 6753 |
| 6753 | 6754 |
| 6754 } // namespace dart | 6755 } // namespace dart |
| 6755 | 6756 |
| 6756 #undef __ | 6757 #undef __ |
| 6757 | 6758 |
| 6758 #endif // defined TARGET_ARCH_X64 | 6759 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |