OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
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" |
11 #include "vm/flow_graph.h" | 11 #include "vm/flow_graph.h" |
12 #include "vm/flow_graph_compiler.h" | 12 #include "vm/flow_graph_compiler.h" |
13 #include "vm/flow_graph_range_analysis.h" | 13 #include "vm/flow_graph_range_analysis.h" |
14 #include "vm/locations.h" | 14 #include "vm/locations.h" |
15 #include "vm/object_store.h" | 15 #include "vm/object_store.h" |
16 #include "vm/parser.h" | 16 #include "vm/parser.h" |
17 #include "vm/simulator.h" | 17 #include "vm/simulator.h" |
18 #include "vm/stack_frame.h" | 18 #include "vm/stack_frame.h" |
19 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
20 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
21 | 21 |
22 #define __ compiler->assembler()-> | 22 #define __ compiler->assembler()-> |
23 | 23 |
24 namespace dart { | 24 namespace dart { |
25 | 25 |
| 26 DECLARE_FLAG(bool, allow_absolute_addresses); |
26 DECLARE_FLAG(bool, emit_edge_counters); | 27 DECLARE_FLAG(bool, emit_edge_counters); |
27 DECLARE_FLAG(int, optimization_counter_threshold); | 28 DECLARE_FLAG(int, optimization_counter_threshold); |
28 DECLARE_FLAG(bool, use_osr); | 29 DECLARE_FLAG(bool, use_osr); |
29 | 30 |
30 // Generic summary for call instructions that have all arguments pushed | 31 // Generic summary for call instructions that have all arguments pushed |
31 // on the stack and return the result in a fixed register R0. | 32 // on the stack and return the result in a fixed register R0. |
32 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { | 33 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { |
33 LocationSummary* result = new(zone) LocationSummary( | 34 LocationSummary* result = new(zone) LocationSummary( |
34 zone, 0, 0, LocationSummary::kCall); | 35 zone, 0, 0, LocationSummary::kCall); |
35 result->set_out(0, Location::RegisterLocation(R0)); | 36 result->set_out(0, Location::RegisterLocation(R0)); |
(...skipping 2555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2591 public: | 2592 public: |
2592 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) | 2593 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) |
2593 : instruction_(instruction) { } | 2594 : instruction_(instruction) { } |
2594 | 2595 |
2595 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2596 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
2596 if (FLAG_use_osr && osr_entry_label()->IsLinked()) { | 2597 if (FLAG_use_osr && osr_entry_label()->IsLinked()) { |
2597 uword flags_address = Isolate::Current()->stack_overflow_flags_address(); | 2598 uword flags_address = Isolate::Current()->stack_overflow_flags_address(); |
2598 const Register value = instruction_->locs()->temp(0).reg(); | 2599 const Register value = instruction_->locs()->temp(0).reg(); |
2599 __ Comment("CheckStackOverflowSlowPathOsr"); | 2600 __ Comment("CheckStackOverflowSlowPathOsr"); |
2600 __ Bind(osr_entry_label()); | 2601 __ Bind(osr_entry_label()); |
| 2602 ASSERT(FLAG_allow_absolute_addresses); |
2601 __ LoadImmediate(TMP, flags_address); | 2603 __ LoadImmediate(TMP, flags_address); |
2602 __ LoadImmediate(value, Isolate::kOsrRequest); | 2604 __ LoadImmediate(value, Isolate::kOsrRequest); |
2603 __ str(value, Address(TMP)); | 2605 __ str(value, Address(TMP)); |
2604 } | 2606 } |
2605 __ Comment("CheckStackOverflowSlowPath"); | 2607 __ Comment("CheckStackOverflowSlowPath"); |
2606 __ Bind(entry_label()); | 2608 __ Bind(entry_label()); |
2607 compiler->SaveLiveRegisters(instruction_->locs()); | 2609 compiler->SaveLiveRegisters(instruction_->locs()); |
2608 // pending_deoptimization_env_ is needed to generate a runtime call that | 2610 // pending_deoptimization_env_ is needed to generate a runtime call that |
2609 // may throw an exception. | 2611 // may throw an exception. |
2610 ASSERT(compiler->pending_deoptimization_env_ == NULL); | 2612 ASSERT(compiler->pending_deoptimization_env_ == NULL); |
(...skipping 24 matching lines...) Expand all Loading... |
2635 private: | 2637 private: |
2636 CheckStackOverflowInstr* instruction_; | 2638 CheckStackOverflowInstr* instruction_; |
2637 Label osr_entry_label_; | 2639 Label osr_entry_label_; |
2638 }; | 2640 }; |
2639 | 2641 |
2640 | 2642 |
2641 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2643 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
2642 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); | 2644 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); |
2643 compiler->AddSlowPathCode(slow_path); | 2645 compiler->AddSlowPathCode(slow_path); |
2644 | 2646 |
2645 if (compiler->is_optimizing()) { | 2647 if (compiler->is_optimizing() && FLAG_allow_absolute_addresses) { |
2646 __ LoadImmediate(TMP, Isolate::Current()->stack_limit_address()); | 2648 __ LoadImmediate(TMP, Isolate::Current()->stack_limit_address()); |
2647 __ ldr(TMP, Address(TMP)); | 2649 __ ldr(TMP, Address(TMP)); |
2648 } else { | 2650 } else { |
2649 __ LoadIsolate(TMP); | 2651 __ LoadIsolate(TMP); |
2650 __ ldr(TMP, Address(TMP, Isolate::stack_limit_offset())); | 2652 __ ldr(TMP, Address(TMP, Isolate::stack_limit_offset())); |
2651 } | 2653 } |
2652 __ CompareRegisters(SP, TMP); | 2654 __ CompareRegisters(SP, TMP); |
2653 __ b(slow_path->entry_label(), LS); | 2655 __ b(slow_path->entry_label(), LS); |
2654 if (compiler->CanOSRFunction() && in_loop()) { | 2656 if (compiler->CanOSRFunction() && in_loop()) { |
2655 const Register temp = locs()->temp(0).reg(); | 2657 const Register temp = locs()->temp(0).reg(); |
(...skipping 2968 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5624 1, | 5626 1, |
5625 locs()); | 5627 locs()); |
5626 __ Drop(1); | 5628 __ Drop(1); |
5627 __ Pop(result); | 5629 __ Pop(result); |
5628 } | 5630 } |
5629 | 5631 |
5630 | 5632 |
5631 } // namespace dart | 5633 } // namespace dart |
5632 | 5634 |
5633 #endif // defined TARGET_ARCH_ARM64 | 5635 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |