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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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 2684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2695 } | 2695 } |
2696 | 2696 |
2697 | 2697 |
2698 class CheckStackOverflowSlowPath : public SlowPathCode { | 2698 class CheckStackOverflowSlowPath : public SlowPathCode { |
2699 public: | 2699 public: |
2700 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) | 2700 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) |
2701 : instruction_(instruction) { } | 2701 : instruction_(instruction) { } |
2702 | 2702 |
2703 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2703 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
2704 if (FLAG_use_osr && osr_entry_label()->IsLinked()) { | 2704 if (FLAG_use_osr && osr_entry_label()->IsLinked()) { |
2705 uword flags_address = Isolate::Current()->stack_overflow_flags_address(); | |
2706 Register value = instruction_->locs()->temp(0).reg(); | 2705 Register value = instruction_->locs()->temp(0).reg(); |
2707 __ Comment("CheckStackOverflowSlowPathOsr"); | 2706 __ Comment("CheckStackOverflowSlowPathOsr"); |
2708 __ Bind(osr_entry_label()); | 2707 __ Bind(osr_entry_label()); |
2709 if (FLAG_allow_absolute_addresses) { | 2708 __ LoadImmediate(value, Thread::kOsrRequest); |
2710 __ LoadImmediate(TMP, flags_address); | 2709 __ sw(value, Address(THR, Thread::stack_overflow_flags_offset())); |
2711 __ LoadImmediate(value, Isolate::kOsrRequest); | |
2712 __ sw(value, Address(TMP)); | |
2713 } else { | |
2714 __ LoadIsolate(TMP); | |
2715 __ LoadImmediate(value, Isolate::kOsrRequest); | |
2716 __ sw(value, Address(TMP, Isolate::stack_overflow_flags_offset())); | |
2717 } | |
2718 } | 2710 } |
2719 __ Comment("CheckStackOverflowSlowPath"); | 2711 __ Comment("CheckStackOverflowSlowPath"); |
2720 __ Bind(entry_label()); | 2712 __ Bind(entry_label()); |
2721 compiler->SaveLiveRegisters(instruction_->locs()); | 2713 compiler->SaveLiveRegisters(instruction_->locs()); |
2722 // pending_deoptimization_env_ is needed to generate a runtime call that | 2714 // pending_deoptimization_env_ is needed to generate a runtime call that |
2723 // may throw an exception. | 2715 // may throw an exception. |
2724 ASSERT(compiler->pending_deoptimization_env_ == NULL); | 2716 ASSERT(compiler->pending_deoptimization_env_ == NULL); |
2725 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); | 2717 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
2726 compiler->pending_deoptimization_env_ = env; | 2718 compiler->pending_deoptimization_env_ = env; |
2727 compiler->GenerateRuntimeCall(instruction_->token_pos(), | 2719 compiler->GenerateRuntimeCall(instruction_->token_pos(), |
(...skipping 22 matching lines...) Expand all Loading... |
2750 CheckStackOverflowInstr* instruction_; | 2742 CheckStackOverflowInstr* instruction_; |
2751 Label osr_entry_label_; | 2743 Label osr_entry_label_; |
2752 }; | 2744 }; |
2753 | 2745 |
2754 | 2746 |
2755 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2747 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2756 __ Comment("CheckStackOverflowInstr"); | 2748 __ Comment("CheckStackOverflowInstr"); |
2757 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); | 2749 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); |
2758 compiler->AddSlowPathCode(slow_path); | 2750 compiler->AddSlowPathCode(slow_path); |
2759 | 2751 |
2760 if (compiler->is_optimizing() && FLAG_allow_absolute_addresses) { | 2752 __ lw(CMPRES1, Address(THR, Thread::stack_limit_offset())); |
2761 __ LoadImmediate(TMP, Isolate::Current()->stack_limit_address()); | |
2762 __ lw(CMPRES1, Address(TMP)); | |
2763 } else { | |
2764 __ LoadIsolate(TMP); | |
2765 __ lw(CMPRES1, Address(TMP, Isolate::stack_limit_offset())); | |
2766 } | |
2767 __ BranchUnsignedLessEqual(SP, CMPRES1, slow_path->entry_label()); | 2753 __ BranchUnsignedLessEqual(SP, CMPRES1, slow_path->entry_label()); |
2768 if (compiler->CanOSRFunction() && in_loop()) { | 2754 if (compiler->CanOSRFunction() && in_loop()) { |
2769 Register temp = locs()->temp(0).reg(); | 2755 Register temp = locs()->temp(0).reg(); |
2770 // In unoptimized code check the usage counter to trigger OSR at loop | 2756 // In unoptimized code check the usage counter to trigger OSR at loop |
2771 // stack checks. Use progressively higher thresholds for more deeply | 2757 // stack checks. Use progressively higher thresholds for more deeply |
2772 // nested loops to attempt to hit outer loops with OSR when possible. | 2758 // nested loops to attempt to hit outer loops with OSR when possible. |
2773 __ LoadObject(temp, compiler->parsed_function().function()); | 2759 __ LoadObject(temp, compiler->parsed_function().function()); |
2774 intptr_t threshold = | 2760 intptr_t threshold = |
2775 FLAG_optimization_counter_threshold * (loop_depth() + 1); | 2761 FLAG_optimization_counter_threshold * (loop_depth() + 1); |
2776 __ lw(temp, FieldAddress(temp, Function::usage_counter_offset())); | 2762 __ lw(temp, FieldAddress(temp, Function::usage_counter_offset())); |
(...skipping 2924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5701 1, | 5687 1, |
5702 locs()); | 5688 locs()); |
5703 __ lw(result, Address(SP, 1 * kWordSize)); | 5689 __ lw(result, Address(SP, 1 * kWordSize)); |
5704 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 5690 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
5705 } | 5691 } |
5706 | 5692 |
5707 | 5693 |
5708 } // namespace dart | 5694 } // namespace dart |
5709 | 5695 |
5710 #endif // defined TARGET_ARCH_MIPS | 5696 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |