OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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 2566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 } | 2577 } |
2578 | 2578 |
2579 | 2579 |
2580 class CheckStackOverflowSlowPath : public SlowPathCode { | 2580 class CheckStackOverflowSlowPath : public SlowPathCode { |
2581 public: | 2581 public: |
2582 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) | 2582 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) |
2583 : instruction_(instruction) { } | 2583 : instruction_(instruction) { } |
2584 | 2584 |
2585 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2585 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
2586 if (FLAG_use_osr && osr_entry_label()->IsLinked()) { | 2586 if (FLAG_use_osr && osr_entry_label()->IsLinked()) { |
2587 uword flags_address = Isolate::Current()->stack_overflow_flags_address(); | |
2588 const Register value = instruction_->locs()->temp(0).reg(); | 2587 const Register value = instruction_->locs()->temp(0).reg(); |
2589 __ Comment("CheckStackOverflowSlowPathOsr"); | 2588 __ Comment("CheckStackOverflowSlowPathOsr"); |
2590 __ Bind(osr_entry_label()); | 2589 __ Bind(osr_entry_label()); |
2591 if (FLAG_allow_absolute_addresses) { | 2590 __ LoadImmediate(value, Thread::kOsrRequest); |
2592 __ LoadImmediate(TMP, flags_address); | 2591 __ str(value, Address(THR, Thread::stack_overflow_flags_offset())); |
2593 __ LoadImmediate(value, Isolate::kOsrRequest); | |
2594 __ str(value, Address(TMP)); | |
2595 } else { | |
2596 __ LoadIsolate(TMP); | |
2597 __ LoadImmediate(value, Isolate::kOsrRequest); | |
2598 __ str(value, Address(TMP, Isolate::stack_overflow_flags_offset())); | |
2599 } | |
2600 } | 2592 } |
2601 __ Comment("CheckStackOverflowSlowPath"); | 2593 __ Comment("CheckStackOverflowSlowPath"); |
2602 __ Bind(entry_label()); | 2594 __ Bind(entry_label()); |
2603 compiler->SaveLiveRegisters(instruction_->locs()); | 2595 compiler->SaveLiveRegisters(instruction_->locs()); |
2604 // pending_deoptimization_env_ is needed to generate a runtime call that | 2596 // pending_deoptimization_env_ is needed to generate a runtime call that |
2605 // may throw an exception. | 2597 // may throw an exception. |
2606 ASSERT(compiler->pending_deoptimization_env_ == NULL); | 2598 ASSERT(compiler->pending_deoptimization_env_ == NULL); |
2607 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); | 2599 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
2608 compiler->pending_deoptimization_env_ = env; | 2600 compiler->pending_deoptimization_env_ = env; |
2609 compiler->GenerateRuntimeCall(instruction_->token_pos(), | 2601 compiler->GenerateRuntimeCall(instruction_->token_pos(), |
(...skipping 21 matching lines...) Expand all Loading... |
2631 private: | 2623 private: |
2632 CheckStackOverflowInstr* instruction_; | 2624 CheckStackOverflowInstr* instruction_; |
2633 Label osr_entry_label_; | 2625 Label osr_entry_label_; |
2634 }; | 2626 }; |
2635 | 2627 |
2636 | 2628 |
2637 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2629 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2638 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); | 2630 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); |
2639 compiler->AddSlowPathCode(slow_path); | 2631 compiler->AddSlowPathCode(slow_path); |
2640 | 2632 |
2641 if (compiler->is_optimizing() && FLAG_allow_absolute_addresses) { | 2633 __ ldr(TMP, Address(THR, Thread::stack_limit_offset())); |
2642 __ LoadImmediate(TMP, Isolate::Current()->stack_limit_address()); | |
2643 __ ldr(TMP, Address(TMP)); | |
2644 } else { | |
2645 __ LoadIsolate(TMP); | |
2646 __ ldr(TMP, Address(TMP, Isolate::stack_limit_offset())); | |
2647 } | |
2648 __ CompareRegisters(SP, TMP); | 2634 __ CompareRegisters(SP, TMP); |
2649 __ b(slow_path->entry_label(), LS); | 2635 __ b(slow_path->entry_label(), LS); |
2650 if (compiler->CanOSRFunction() && in_loop()) { | 2636 if (compiler->CanOSRFunction() && in_loop()) { |
2651 const Register temp = locs()->temp(0).reg(); | 2637 const Register temp = locs()->temp(0).reg(); |
2652 // In unoptimized code check the usage counter to trigger OSR at loop | 2638 // In unoptimized code check the usage counter to trigger OSR at loop |
2653 // stack checks. Use progressively higher thresholds for more deeply | 2639 // stack checks. Use progressively higher thresholds for more deeply |
2654 // nested loops to attempt to hit outer loops with OSR when possible. | 2640 // nested loops to attempt to hit outer loops with OSR when possible. |
2655 __ LoadObject(temp, compiler->parsed_function().function()); | 2641 __ LoadObject(temp, compiler->parsed_function().function()); |
2656 intptr_t threshold = | 2642 intptr_t threshold = |
2657 FLAG_optimization_counter_threshold * (loop_depth() + 1); | 2643 FLAG_optimization_counter_threshold * (loop_depth() + 1); |
(...skipping 3027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5685 1, | 5671 1, |
5686 locs()); | 5672 locs()); |
5687 __ Drop(1); | 5673 __ Drop(1); |
5688 __ Pop(result); | 5674 __ Pop(result); |
5689 } | 5675 } |
5690 | 5676 |
5691 | 5677 |
5692 } // namespace dart | 5678 } // namespace dart |
5693 | 5679 |
5694 #endif // defined TARGET_ARCH_ARM64 | 5680 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |