| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 2121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2132 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); | 2132 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); |
| 2133 compiler->AddSlowPathCode(slow_path); | 2133 compiler->AddSlowPathCode(slow_path); |
| 2134 | 2134 |
| 2135 Register temp = locs()->temp(0).reg(); | 2135 Register temp = locs()->temp(0).reg(); |
| 2136 // Generate stack overflow check. | 2136 // Generate stack overflow check. |
| 2137 __ movq(temp, Immediate(Isolate::Current()->stack_limit_address())); | 2137 __ movq(temp, Immediate(Isolate::Current()->stack_limit_address())); |
| 2138 __ cmpq(RSP, Address(temp, 0)); | 2138 __ cmpq(RSP, Address(temp, 0)); |
| 2139 __ j(BELOW_EQUAL, slow_path->entry_label()); | 2139 __ j(BELOW_EQUAL, slow_path->entry_label()); |
| 2140 if (compiler->CanOSRFunction() && in_loop()) { | 2140 if (compiler->CanOSRFunction() && in_loop()) { |
| 2141 // In unoptimized code check the usage counter to trigger OSR at loop | 2141 // In unoptimized code check the usage counter to trigger OSR at loop |
| 2142 // stack checks. | 2142 // stack checks. Use progressively higher thresholds for more deeply |
| 2143 // nested loops to attempt to hit outer loops with OSR when possible. |
| 2143 __ LoadObject(temp, compiler->parsed_function().function()); | 2144 __ LoadObject(temp, compiler->parsed_function().function()); |
| 2145 intptr_t threshold = |
| 2146 FLAG_optimization_counter_threshold * (loop_depth() + 1); |
| 2144 __ cmpq(FieldAddress(temp, Function::usage_counter_offset()), | 2147 __ cmpq(FieldAddress(temp, Function::usage_counter_offset()), |
| 2145 Immediate(2 * FLAG_optimization_counter_threshold)); | 2148 Immediate(threshold)); |
| 2146 __ j(GREATER_EQUAL, slow_path->entry_label()); | 2149 __ j(GREATER_EQUAL, slow_path->entry_label()); |
| 2147 } | 2150 } |
| 2148 __ Bind(slow_path->exit_label()); | 2151 __ Bind(slow_path->exit_label()); |
| 2149 } | 2152 } |
| 2150 | 2153 |
| 2151 | 2154 |
| 2152 static void Emit53BitOverflowCheck(FlowGraphCompiler* compiler, | 2155 static void Emit53BitOverflowCheck(FlowGraphCompiler* compiler, |
| 2153 Label* overflow, | 2156 Label* overflow, |
| 2154 Register result) { | 2157 Register result) { |
| 2155 if (FLAG_throw_on_javascript_int_overflow) { | 2158 if (FLAG_throw_on_javascript_int_overflow) { |
| (...skipping 2278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4434 PcDescriptors::kOther, | 4437 PcDescriptors::kOther, |
| 4435 locs()); | 4438 locs()); |
| 4436 __ Drop(2); // Discard type arguments and receiver. | 4439 __ Drop(2); // Discard type arguments and receiver. |
| 4437 } | 4440 } |
| 4438 | 4441 |
| 4439 } // namespace dart | 4442 } // namespace dart |
| 4440 | 4443 |
| 4441 #undef __ | 4444 #undef __ |
| 4442 | 4445 |
| 4443 #endif // defined TARGET_ARCH_X64 | 4446 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |