| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
| 9 | 9 |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 namespace dart { | 25 namespace dart { |
| 26 | 26 |
| 27 DECLARE_FLAG(bool, emit_edge_counters); | 27 DECLARE_FLAG(bool, emit_edge_counters); |
| 28 DECLARE_FLAG(int, optimization_counter_threshold); | 28 DECLARE_FLAG(int, optimization_counter_threshold); |
| 29 DECLARE_FLAG(bool, propagate_ic_data); | 29 DECLARE_FLAG(bool, propagate_ic_data); |
| 30 DECLARE_FLAG(bool, use_osr); | 30 DECLARE_FLAG(bool, use_osr); |
| 31 | 31 |
| 32 // Generic summary for call instructions that have all arguments pushed | 32 // Generic summary for call instructions that have all arguments pushed |
| 33 // on the stack and return the result in a fixed register R0. | 33 // on the stack and return the result in a fixed register R0. |
| 34 LocationSummary* Instruction::MakeCallSummary() { | 34 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) { |
| 35 Isolate* isolate = Isolate::Current(); | |
| 36 LocationSummary* result = new(isolate) LocationSummary( | 35 LocationSummary* result = new(isolate) LocationSummary( |
| 37 isolate, 0, 0, LocationSummary::kCall); | 36 isolate, 0, 0, LocationSummary::kCall); |
| 38 result->set_out(0, Location::RegisterLocation(R0)); | 37 result->set_out(0, Location::RegisterLocation(R0)); |
| 39 return result; | 38 return result; |
| 40 } | 39 } |
| 41 | 40 |
| 42 | 41 |
| 43 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate, | 42 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate, |
| 44 bool opt) const { | 43 bool opt) const { |
| 45 const intptr_t kNumInputs = 1; | 44 const intptr_t kNumInputs = 1; |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 912 Label* nan_result = (true_condition == NE) ? | 911 Label* nan_result = (true_condition == NE) ? |
| 913 labels.true_label : labels.false_label; | 912 labels.true_label : labels.false_label; |
| 914 __ b(nan_result, VS); | 913 __ b(nan_result, VS); |
| 915 EmitBranchOnCondition(compiler, true_condition, labels); | 914 EmitBranchOnCondition(compiler, true_condition, labels); |
| 916 } | 915 } |
| 917 } | 916 } |
| 918 | 917 |
| 919 | 918 |
| 920 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate, | 919 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate, |
| 921 bool opt) const { | 920 bool opt) const { |
| 922 const intptr_t kNumInputs = 0; | 921 return MakeCallSummary(isolate); |
| 923 const intptr_t kNumTemps = 3; | |
| 924 LocationSummary* locs = new(isolate) LocationSummary( | |
| 925 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | |
| 926 locs->set_temp(0, Location::RegisterLocation(R1)); | |
| 927 locs->set_temp(1, Location::RegisterLocation(R2)); | |
| 928 locs->set_temp(2, Location::RegisterLocation(R5)); | |
| 929 locs->set_out(0, Location::RegisterLocation(R0)); | |
| 930 return locs; | |
| 931 } | 922 } |
| 932 | 923 |
| 933 | 924 |
| 934 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 925 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 935 ASSERT(locs()->temp(0).reg() == R1); | |
| 936 ASSERT(locs()->temp(1).reg() == R2); | |
| 937 ASSERT(locs()->temp(2).reg() == R5); | |
| 938 const Register result = locs()->out(0).reg(); | 926 const Register result = locs()->out(0).reg(); |
| 939 | 927 |
| 940 // Push the result place holder initialized to NULL. | 928 // Push the result place holder initialized to NULL. |
| 941 __ PushObject(Object::null_object()); | 929 __ PushObject(Object::null_object()); |
| 942 // Pass a pointer to the first argument in R2. | 930 // Pass a pointer to the first argument in R2. |
| 943 if (!function().HasOptionalParameters()) { | 931 if (!function().HasOptionalParameters()) { |
| 944 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + | 932 __ AddImmediate(R2, FP, (kParamEndSlotFromFp + |
| 945 function().NumParameters()) * kWordSize); | 933 function().NumParameters()) * kWordSize); |
| 946 } else { | 934 } else { |
| 947 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); | 935 __ AddImmediate(R2, FP, kFirstLocalSlotFromFp * kWordSize); |
| (...skipping 4791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5739 } | 5727 } |
| 5740 if (kind() == MergedMathInstr::kSinCos) { | 5728 if (kind() == MergedMathInstr::kSinCos) { |
| 5741 UNIMPLEMENTED(); | 5729 UNIMPLEMENTED(); |
| 5742 } | 5730 } |
| 5743 UNIMPLEMENTED(); | 5731 UNIMPLEMENTED(); |
| 5744 } | 5732 } |
| 5745 | 5733 |
| 5746 | 5734 |
| 5747 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( | 5735 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( |
| 5748 Isolate* isolate, bool opt) const { | 5736 Isolate* isolate, bool opt) const { |
| 5749 return MakeCallSummary(); | 5737 return MakeCallSummary(isolate); |
| 5750 } | 5738 } |
| 5751 | 5739 |
| 5752 | 5740 |
| 5753 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5741 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5754 ASSERT(ic_data().NumArgsTested() == 1); | 5742 ASSERT(ic_data().NumArgsTested() == 1); |
| 5755 if (!with_checks()) { | 5743 if (!with_checks()) { |
| 5756 ASSERT(ic_data().HasOneTarget()); | 5744 ASSERT(ic_data().HasOneTarget()); |
| 5757 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); | 5745 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); |
| 5758 compiler->GenerateStaticCall(deopt_id(), | 5746 compiler->GenerateStaticCall(deopt_id(), |
| 5759 instance_call()->token_pos(), | 5747 instance_call()->token_pos(), |
| (...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6954 const Register result = locs()->out(0).reg(); | 6942 const Register result = locs()->out(0).reg(); |
| 6955 | 6943 |
| 6956 __ LoadObject(result, Bool::True()); | 6944 __ LoadObject(result, Bool::True()); |
| 6957 __ cmp(result, Operand(value)); | 6945 __ cmp(result, Operand(value)); |
| 6958 __ LoadObject(result, Bool::False(), EQ); | 6946 __ LoadObject(result, Bool::False(), EQ); |
| 6959 } | 6947 } |
| 6960 | 6948 |
| 6961 | 6949 |
| 6962 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, | 6950 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, |
| 6963 bool opt) const { | 6951 bool opt) const { |
| 6964 return MakeCallSummary(); | 6952 return MakeCallSummary(isolate); |
| 6965 } | 6953 } |
| 6966 | 6954 |
| 6967 | 6955 |
| 6968 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6956 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6969 Isolate* isolate = compiler->isolate(); | 6957 Isolate* isolate = compiler->isolate(); |
| 6970 StubCode* stub_code = isolate->stub_code(); | 6958 StubCode* stub_code = isolate->stub_code(); |
| 6971 const Code& stub = Code::Handle(isolate, | 6959 const Code& stub = Code::Handle(isolate, |
| 6972 stub_code->GetAllocationStubForClass(cls())); | 6960 stub_code->GetAllocationStubForClass(cls())); |
| 6973 const ExternalLabel label(stub.EntryPoint()); | 6961 const ExternalLabel label(stub.EntryPoint()); |
| 6974 compiler->GenerateCall(token_pos(), | 6962 compiler->GenerateCall(token_pos(), |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6987 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 6975 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 6988 #if defined(DEBUG) | 6976 #if defined(DEBUG) |
| 6989 __ LoadImmediate(R4, kInvalidObjectPointer); | 6977 __ LoadImmediate(R4, kInvalidObjectPointer); |
| 6990 __ LoadImmediate(R5, kInvalidObjectPointer); | 6978 __ LoadImmediate(R5, kInvalidObjectPointer); |
| 6991 #endif | 6979 #endif |
| 6992 } | 6980 } |
| 6993 | 6981 |
| 6994 } // namespace dart | 6982 } // namespace dart |
| 6995 | 6983 |
| 6996 #endif // defined TARGET_ARCH_ARM | 6984 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |