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" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #define __ compiler->assembler()-> | 22 #define __ compiler->assembler()-> |
23 | 23 |
24 namespace dart { | 24 namespace dart { |
25 | 25 |
26 DECLARE_FLAG(bool, emit_edge_counters); | 26 DECLARE_FLAG(bool, emit_edge_counters); |
27 DECLARE_FLAG(int, optimization_counter_threshold); | 27 DECLARE_FLAG(int, optimization_counter_threshold); |
28 DECLARE_FLAG(bool, use_osr); | 28 DECLARE_FLAG(bool, use_osr); |
29 | 29 |
30 // Generic summary for call instructions that have all arguments pushed | 30 // Generic summary for call instructions that have all arguments pushed |
31 // on the stack and return the result in a fixed register R0. | 31 // on the stack and return the result in a fixed register R0. |
32 LocationSummary* Instruction::MakeCallSummary() { | 32 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) { |
33 Isolate* isolate = Isolate::Current(); | |
34 LocationSummary* result = new(isolate) LocationSummary( | 33 LocationSummary* result = new(isolate) LocationSummary( |
35 isolate, 0, 0, LocationSummary::kCall); | 34 isolate, 0, 0, LocationSummary::kCall); |
36 result->set_out(0, Location::RegisterLocation(R0)); | 35 result->set_out(0, Location::RegisterLocation(R0)); |
37 return result; | 36 return result; |
38 } | 37 } |
39 | 38 |
40 | 39 |
41 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate, | 40 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate, |
42 bool opt) const { | 41 bool opt) const { |
43 const intptr_t kNumInputs = 1; | 42 const intptr_t kNumInputs = 1; |
(...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 // Special case for NaN comparison. Result is always false unless | 758 // Special case for NaN comparison. Result is always false unless |
760 // relational operator is !=. | 759 // relational operator is !=. |
761 __ b(labels.false_label, VS); | 760 __ b(labels.false_label, VS); |
762 } | 761 } |
763 EmitBranchOnCondition(compiler, true_condition, labels); | 762 EmitBranchOnCondition(compiler, true_condition, labels); |
764 } | 763 } |
765 | 764 |
766 | 765 |
767 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate, | 766 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate, |
768 bool opt) const { | 767 bool opt) const { |
769 const intptr_t kNumInputs = 0; | 768 return MakeCallSummary(isolate); |
770 const intptr_t kNumTemps = 3; | |
771 LocationSummary* locs = new(isolate) LocationSummary( | |
772 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | |
773 locs->set_temp(0, Location::RegisterLocation(R1)); | |
774 locs->set_temp(1, Location::RegisterLocation(R2)); | |
775 locs->set_temp(2, Location::RegisterLocation(R5)); | |
776 locs->set_out(0, Location::RegisterLocation(R0)); | |
777 return locs; | |
778 } | 769 } |
779 | 770 |
780 | 771 |
781 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 772 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
782 ASSERT(locs()->temp(0).reg() == R1); | |
783 ASSERT(locs()->temp(1).reg() == R2); | |
784 ASSERT(locs()->temp(2).reg() == R5); | |
785 const Register result = locs()->out(0).reg(); | 773 const Register result = locs()->out(0).reg(); |
786 | 774 |
787 // Push the result place holder initialized to NULL. | 775 // Push the result place holder initialized to NULL. |
788 __ PushObject(Object::null_object(), PP); | 776 __ PushObject(Object::null_object(), PP); |
789 // Pass a pointer to the first argument in R2. | 777 // Pass a pointer to the first argument in R2. |
790 if (!function().HasOptionalParameters()) { | 778 if (!function().HasOptionalParameters()) { |
791 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + | 779 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + |
792 function().NumParameters()) * kWordSize, PP); | 780 function().NumParameters()) * kWordSize, PP); |
793 } else { | 781 } else { |
794 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize, PP); | 782 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize, PP); |
(...skipping 4146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4941 } | 4929 } |
4942 if (kind() == MergedMathInstr::kSinCos) { | 4930 if (kind() == MergedMathInstr::kSinCos) { |
4943 UNIMPLEMENTED(); | 4931 UNIMPLEMENTED(); |
4944 } | 4932 } |
4945 UNIMPLEMENTED(); | 4933 UNIMPLEMENTED(); |
4946 } | 4934 } |
4947 | 4935 |
4948 | 4936 |
4949 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( | 4937 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( |
4950 Isolate* isolate, bool opt) const { | 4938 Isolate* isolate, bool opt) const { |
4951 return MakeCallSummary(); | 4939 return MakeCallSummary(isolate); |
4952 } | 4940 } |
4953 | 4941 |
4954 | 4942 |
4955 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4943 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
4956 ASSERT(ic_data().NumArgsTested() == 1); | 4944 ASSERT(ic_data().NumArgsTested() == 1); |
4957 if (!with_checks()) { | 4945 if (!with_checks()) { |
4958 ASSERT(ic_data().HasOneTarget()); | 4946 ASSERT(ic_data().HasOneTarget()); |
4959 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); | 4947 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); |
4960 compiler->GenerateStaticCall(deopt_id(), | 4948 compiler->GenerateStaticCall(deopt_id(), |
4961 instance_call()->token_pos(), | 4949 instance_call()->token_pos(), |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5572 | 5560 |
5573 __ LoadObject(result, Bool::True(), PP); | 5561 __ LoadObject(result, Bool::True(), PP); |
5574 __ LoadObject(TMP, Bool::False(), PP); | 5562 __ LoadObject(TMP, Bool::False(), PP); |
5575 __ CompareRegisters(result, value); | 5563 __ CompareRegisters(result, value); |
5576 __ csel(result, TMP, result, EQ); | 5564 __ csel(result, TMP, result, EQ); |
5577 } | 5565 } |
5578 | 5566 |
5579 | 5567 |
5580 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, | 5568 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, |
5581 bool opt) const { | 5569 bool opt) const { |
5582 return MakeCallSummary(); | 5570 return MakeCallSummary(isolate); |
5583 } | 5571 } |
5584 | 5572 |
5585 | 5573 |
5586 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5574 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
5587 Isolate* isolate = compiler->isolate(); | 5575 Isolate* isolate = compiler->isolate(); |
5588 StubCode* stub_code = isolate->stub_code(); | 5576 StubCode* stub_code = isolate->stub_code(); |
5589 const Code& stub = Code::Handle(isolate, | 5577 const Code& stub = Code::Handle(isolate, |
5590 stub_code->GetAllocationStubForClass(cls())); | 5578 stub_code->GetAllocationStubForClass(cls())); |
5591 const ExternalLabel label(stub.EntryPoint()); | 5579 const ExternalLabel label(stub.EntryPoint()); |
5592 compiler->GenerateCall(token_pos(), | 5580 compiler->GenerateCall(token_pos(), |
(...skipping 12 matching lines...) Expand all Loading... |
5605 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 5593 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
5606 #if defined(DEBUG) | 5594 #if defined(DEBUG) |
5607 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); | 5595 __ LoadImmediate(R4, kInvalidObjectPointer, kNoPP); |
5608 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); | 5596 __ LoadImmediate(R5, kInvalidObjectPointer, kNoPP); |
5609 #endif | 5597 #endif |
5610 } | 5598 } |
5611 | 5599 |
5612 } // namespace dart | 5600 } // namespace dart |
5613 | 5601 |
5614 #endif // defined TARGET_ARCH_ARM64 | 5602 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |