| 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/dart_entry.h" | 10 #include "vm/dart_entry.h" |
| (...skipping 2620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2631 Label osr_entry_label_; | 2631 Label osr_entry_label_; |
| 2632 }; | 2632 }; |
| 2633 | 2633 |
| 2634 | 2634 |
| 2635 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2635 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2636 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); | 2636 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); |
| 2637 compiler->AddSlowPathCode(slow_path); | 2637 compiler->AddSlowPathCode(slow_path); |
| 2638 | 2638 |
| 2639 Register temp = locs()->temp(0).reg(); | 2639 Register temp = locs()->temp(0).reg(); |
| 2640 // Generate stack overflow check. | 2640 // Generate stack overflow check. |
| 2641 __ LoadImmediate( | 2641 if (compiler->is_optimizing()) { |
| 2642 temp, Immediate(Isolate::Current()->stack_limit_address()), PP); | 2642 __ LoadImmediate( |
| 2643 __ cmpq(RSP, Address(temp, 0)); | 2643 temp, Immediate(Isolate::Current()->stack_limit_address()), PP); |
| 2644 __ cmpq(RSP, Address(temp, 0)); |
| 2645 } else { |
| 2646 __ LoadIsolate(temp); |
| 2647 __ cmpq(RSP, Address(temp, Isolate::stack_limit_offset())); |
| 2648 } |
| 2644 __ j(BELOW_EQUAL, slow_path->entry_label()); | 2649 __ j(BELOW_EQUAL, slow_path->entry_label()); |
| 2645 if (compiler->CanOSRFunction() && in_loop()) { | 2650 if (compiler->CanOSRFunction() && in_loop()) { |
| 2646 // In unoptimized code check the usage counter to trigger OSR at loop | 2651 // In unoptimized code check the usage counter to trigger OSR at loop |
| 2647 // stack checks. Use progressively higher thresholds for more deeply | 2652 // stack checks. Use progressively higher thresholds for more deeply |
| 2648 // nested loops to attempt to hit outer loops with OSR when possible. | 2653 // nested loops to attempt to hit outer loops with OSR when possible. |
| 2649 __ LoadObject(temp, compiler->parsed_function().function(), PP); | 2654 __ LoadObject(temp, compiler->parsed_function().function(), PP); |
| 2650 int32_t threshold = | 2655 int32_t threshold = |
| 2651 FLAG_optimization_counter_threshold * (loop_depth() + 1); | 2656 FLAG_optimization_counter_threshold * (loop_depth() + 1); |
| 2652 __ cmpl(FieldAddress(temp, Function::usage_counter_offset()), | 2657 __ cmpl(FieldAddress(temp, Function::usage_counter_offset()), |
| 2653 Immediate(threshold)); | 2658 Immediate(threshold)); |
| (...skipping 3772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6426 __ Drop(1); | 6431 __ Drop(1); |
| 6427 __ popq(result); | 6432 __ popq(result); |
| 6428 } | 6433 } |
| 6429 | 6434 |
| 6430 | 6435 |
| 6431 } // namespace dart | 6436 } // namespace dart |
| 6432 | 6437 |
| 6433 #undef __ | 6438 #undef __ |
| 6434 | 6439 |
| 6435 #endif // defined TARGET_ARCH_X64 | 6440 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |