| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 2554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2565 __ movl(Address(EBP, exception_var().index() * kWordSize), | 2565 __ movl(Address(EBP, exception_var().index() * kWordSize), |
| 2566 kExceptionObjectReg); | 2566 kExceptionObjectReg); |
| 2567 __ movl(Address(EBP, stacktrace_var().index() * kWordSize), | 2567 __ movl(Address(EBP, stacktrace_var().index() * kWordSize), |
| 2568 kStackTraceObjectReg); | 2568 kStackTraceObjectReg); |
| 2569 } | 2569 } |
| 2570 | 2570 |
| 2571 | 2571 |
| 2572 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, | 2572 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, |
| 2573 bool opt) const { | 2573 bool opt) const { |
| 2574 const intptr_t kNumInputs = 0; | 2574 const intptr_t kNumInputs = 0; |
| 2575 const intptr_t kNumTemps = 0; | 2575 const intptr_t kNumTemps = opt ? 0 : 1; |
| 2576 LocationSummary* summary = new(zone) LocationSummary( | 2576 LocationSummary* summary = new(zone) LocationSummary( |
| 2577 zone, kNumInputs, | 2577 zone, kNumInputs, |
| 2578 kNumTemps, | 2578 kNumTemps, |
| 2579 LocationSummary::kCallOnSlowPath); | 2579 LocationSummary::kCallOnSlowPath); |
| 2580 if (!opt) { |
| 2581 summary->set_temp(0, Location::RequiresRegister()); |
| 2582 } |
| 2580 return summary; | 2583 return summary; |
| 2581 } | 2584 } |
| 2582 | 2585 |
| 2583 | 2586 |
| 2584 class CheckStackOverflowSlowPath : public SlowPathCode { | 2587 class CheckStackOverflowSlowPath : public SlowPathCode { |
| 2585 public: | 2588 public: |
| 2586 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) | 2589 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) |
| 2587 : instruction_(instruction) { } | 2590 : instruction_(instruction) { } |
| 2588 | 2591 |
| 2589 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2592 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2627 private: | 2630 private: |
| 2628 CheckStackOverflowInstr* instruction_; | 2631 CheckStackOverflowInstr* instruction_; |
| 2629 Label osr_entry_label_; | 2632 Label osr_entry_label_; |
| 2630 }; | 2633 }; |
| 2631 | 2634 |
| 2632 | 2635 |
| 2633 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2636 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2634 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); | 2637 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); |
| 2635 compiler->AddSlowPathCode(slow_path); | 2638 compiler->AddSlowPathCode(slow_path); |
| 2636 | 2639 |
| 2637 __ cmpl(ESP, | 2640 if (compiler->is_optimizing()) { |
| 2638 Address::Absolute(Isolate::Current()->stack_limit_address())); | 2641 __ cmpl(ESP, Address::Absolute(Isolate::Current()->stack_limit_address())); |
| 2642 } else { |
| 2643 Register tmp = locs()->temp(0).reg(); |
| 2644 __ LoadIsolate(tmp); |
| 2645 __ cmpl(ESP, Address(tmp, Isolate::stack_limit_offset())); |
| 2646 } |
| 2639 __ j(BELOW_EQUAL, slow_path->entry_label()); | 2647 __ j(BELOW_EQUAL, slow_path->entry_label()); |
| 2640 if (compiler->CanOSRFunction() && in_loop()) { | 2648 if (compiler->CanOSRFunction() && in_loop()) { |
| 2641 // In unoptimized code check the usage counter to trigger OSR at loop | 2649 // In unoptimized code check the usage counter to trigger OSR at loop |
| 2642 // stack checks. Use progressively higher thresholds for more deeply | 2650 // stack checks. Use progressively higher thresholds for more deeply |
| 2643 // nested loops to attempt to hit outer loops with OSR when possible. | 2651 // nested loops to attempt to hit outer loops with OSR when possible. |
| 2644 __ LoadObject(EDI, compiler->parsed_function().function()); | 2652 __ LoadObject(EDI, compiler->parsed_function().function()); |
| 2645 intptr_t threshold = | 2653 intptr_t threshold = |
| 2646 FLAG_optimization_counter_threshold * (loop_depth() + 1); | 2654 FLAG_optimization_counter_threshold * (loop_depth() + 1); |
| 2647 __ cmpl(FieldAddress(EDI, Function::usage_counter_offset()), | 2655 __ cmpl(FieldAddress(EDI, Function::usage_counter_offset()), |
| 2648 Immediate(threshold)); | 2656 Immediate(threshold)); |
| (...skipping 4199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6848 __ Drop(1); | 6856 __ Drop(1); |
| 6849 __ popl(result); | 6857 __ popl(result); |
| 6850 } | 6858 } |
| 6851 | 6859 |
| 6852 | 6860 |
| 6853 } // namespace dart | 6861 } // namespace dart |
| 6854 | 6862 |
| 6855 #undef __ | 6863 #undef __ |
| 6856 | 6864 |
| 6857 #endif // defined TARGET_ARCH_IA32 | 6865 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |