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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
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 2856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2867 } | 2867 } |
2868 | 2868 |
2869 | 2869 |
2870 class CheckStackOverflowSlowPath : public SlowPathCode { | 2870 class CheckStackOverflowSlowPath : public SlowPathCode { |
2871 public: | 2871 public: |
2872 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) | 2872 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) |
2873 : instruction_(instruction) { } | 2873 : instruction_(instruction) { } |
2874 | 2874 |
2875 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2875 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
2876 if (FLAG_use_osr && osr_entry_label()->IsLinked()) { | 2876 if (FLAG_use_osr && osr_entry_label()->IsLinked()) { |
2877 uword flags_address = Isolate::Current()->stack_overflow_flags_address(); | |
2878 const Register value = instruction_->locs()->temp(0).reg(); | 2877 const Register value = instruction_->locs()->temp(0).reg(); |
2879 __ Comment("CheckStackOverflowSlowPathOsr"); | 2878 __ Comment("CheckStackOverflowSlowPathOsr"); |
2880 __ Bind(osr_entry_label()); | 2879 __ Bind(osr_entry_label()); |
2881 if (FLAG_allow_absolute_addresses) { | 2880 __ LoadImmediate(value, Thread::kOsrRequest); |
2882 __ LoadImmediate(IP, flags_address); | 2881 __ str(value, Address(THR, Thread::stack_overflow_flags_offset())); |
2883 __ LoadImmediate(value, Isolate::kOsrRequest); | |
2884 __ str(value, Address(IP)); | |
2885 } else { | |
2886 __ LoadIsolate(IP); | |
2887 __ LoadImmediate(value, Isolate::kOsrRequest); | |
2888 __ str(value, Address(IP, Isolate::stack_overflow_flags_offset())); | |
2889 } | |
2890 } | 2882 } |
2891 __ Comment("CheckStackOverflowSlowPath"); | 2883 __ Comment("CheckStackOverflowSlowPath"); |
2892 __ Bind(entry_label()); | 2884 __ Bind(entry_label()); |
2893 compiler->SaveLiveRegisters(instruction_->locs()); | 2885 compiler->SaveLiveRegisters(instruction_->locs()); |
2894 // pending_deoptimization_env_ is needed to generate a runtime call that | 2886 // pending_deoptimization_env_ is needed to generate a runtime call that |
2895 // may throw an exception. | 2887 // may throw an exception. |
2896 ASSERT(compiler->pending_deoptimization_env_ == NULL); | 2888 ASSERT(compiler->pending_deoptimization_env_ == NULL); |
2897 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); | 2889 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
2898 compiler->pending_deoptimization_env_ = env; | 2890 compiler->pending_deoptimization_env_ = env; |
2899 compiler->GenerateRuntimeCall(instruction_->token_pos(), | 2891 compiler->GenerateRuntimeCall(instruction_->token_pos(), |
(...skipping 21 matching lines...) Expand all Loading... | |
2921 private: | 2913 private: |
2922 CheckStackOverflowInstr* instruction_; | 2914 CheckStackOverflowInstr* instruction_; |
2923 Label osr_entry_label_; | 2915 Label osr_entry_label_; |
2924 }; | 2916 }; |
2925 | 2917 |
2926 | 2918 |
2927 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2919 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2928 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); | 2920 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); |
2929 compiler->AddSlowPathCode(slow_path); | 2921 compiler->AddSlowPathCode(slow_path); |
2930 | 2922 |
2931 if (compiler->is_optimizing() && FLAG_allow_absolute_addresses) { | 2923 __ ldr(IP, Address(THR, Thread::stack_limit_offset())); |
rmacnak
2016/03/17 17:08:26
Nice!
| |
2932 __ LoadImmediate(IP, Isolate::Current()->stack_limit_address()); | |
2933 __ ldr(IP, Address(IP)); | |
2934 } else { | |
2935 __ LoadIsolate(IP); | |
2936 __ ldr(IP, Address(IP, Isolate::stack_limit_offset())); | |
2937 } | |
2938 __ cmp(SP, Operand(IP)); | 2924 __ cmp(SP, Operand(IP)); |
2939 __ b(slow_path->entry_label(), LS); | 2925 __ b(slow_path->entry_label(), LS); |
2940 if (compiler->CanOSRFunction() && in_loop()) { | 2926 if (compiler->CanOSRFunction() && in_loop()) { |
2941 const Register temp = locs()->temp(0).reg(); | 2927 const Register temp = locs()->temp(0).reg(); |
2942 // In unoptimized code check the usage counter to trigger OSR at loop | 2928 // In unoptimized code check the usage counter to trigger OSR at loop |
2943 // stack checks. Use progressively higher thresholds for more deeply | 2929 // stack checks. Use progressively higher thresholds for more deeply |
2944 // nested loops to attempt to hit outer loops with OSR when possible. | 2930 // nested loops to attempt to hit outer loops with OSR when possible. |
2945 __ LoadObject(temp, compiler->parsed_function().function()); | 2931 __ LoadObject(temp, compiler->parsed_function().function()); |
2946 intptr_t threshold = | 2932 intptr_t threshold = |
2947 FLAG_optimization_counter_threshold * (loop_depth() + 1); | 2933 FLAG_optimization_counter_threshold * (loop_depth() + 1); |
(...skipping 3979 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6927 1, | 6913 1, |
6928 locs()); | 6914 locs()); |
6929 __ Drop(1); | 6915 __ Drop(1); |
6930 __ Pop(result); | 6916 __ Pop(result); |
6931 } | 6917 } |
6932 | 6918 |
6933 | 6919 |
6934 } // namespace dart | 6920 } // namespace dart |
6935 | 6921 |
6936 #endif // defined TARGET_ARCH_ARM | 6922 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |