| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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 12 matching lines...) Expand all Loading... |
| 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, propagate_ic_data); | 28 DECLARE_FLAG(bool, propagate_ic_data); |
| 29 DECLARE_FLAG(bool, use_osr); | 29 DECLARE_FLAG(bool, use_osr); |
| 30 | 30 |
| 31 // Generic summary for call instructions that have all arguments pushed | 31 // Generic summary for call instructions that have all arguments pushed |
| 32 // on the stack and return the result in a fixed register V0. | 32 // on the stack and return the result in a fixed register V0. |
| 33 LocationSummary* Instruction::MakeCallSummary() { | 33 LocationSummary* Instruction::MakeCallSummary(Isolate* isolate) { |
| 34 Isolate* isolate = Isolate::Current(); | |
| 35 LocationSummary* result = new(isolate) LocationSummary( | 34 LocationSummary* result = new(isolate) LocationSummary( |
| 36 isolate, 0, 0, LocationSummary::kCall); | 35 isolate, 0, 0, LocationSummary::kCall); |
| 37 result->set_out(0, Location::RegisterLocation(V0)); | 36 result->set_out(0, Location::RegisterLocation(V0)); |
| 38 return result; | 37 return result; |
| 39 } | 38 } |
| 40 | 39 |
| 41 | 40 |
| 42 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate, | 41 LocationSummary* PushArgumentInstr::MakeLocationSummary(Isolate* isolate, |
| 43 bool opt) const { | 42 bool opt) const { |
| 44 const intptr_t kNumInputs = 1; | 43 const intptr_t kNumInputs = 1; |
| (...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 __ TraceSimMsg("RelationalOpInstr"); | 868 __ TraceSimMsg("RelationalOpInstr"); |
| 870 | 869 |
| 871 BranchLabels labels = compiler->CreateBranchLabels(branch); | 870 BranchLabels labels = compiler->CreateBranchLabels(branch); |
| 872 Condition true_condition = EmitComparisonCode(compiler, labels); | 871 Condition true_condition = EmitComparisonCode(compiler, labels); |
| 873 EmitBranchOnCondition(compiler, true_condition, labels); | 872 EmitBranchOnCondition(compiler, true_condition, labels); |
| 874 } | 873 } |
| 875 | 874 |
| 876 | 875 |
| 877 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate, | 876 LocationSummary* NativeCallInstr::MakeLocationSummary(Isolate* isolate, |
| 878 bool opt) const { | 877 bool opt) const { |
| 879 const intptr_t kNumInputs = 0; | 878 return MakeCallSummary(isolate); |
| 880 const intptr_t kNumTemps = 3; | |
| 881 LocationSummary* locs = new(isolate) LocationSummary( | |
| 882 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | |
| 883 locs->set_temp(0, Location::RegisterLocation(A1)); | |
| 884 locs->set_temp(1, Location::RegisterLocation(A2)); | |
| 885 locs->set_temp(2, Location::RegisterLocation(T5)); | |
| 886 locs->set_out(0, Location::RegisterLocation(V0)); | |
| 887 return locs; | |
| 888 } | 879 } |
| 889 | 880 |
| 890 | 881 |
| 891 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 882 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 892 __ TraceSimMsg("NativeCallInstr"); | 883 __ TraceSimMsg("NativeCallInstr"); |
| 893 ASSERT(locs()->temp(0).reg() == A1); | |
| 894 ASSERT(locs()->temp(1).reg() == A2); | |
| 895 ASSERT(locs()->temp(2).reg() == T5); | |
| 896 Register result = locs()->out(0).reg(); | 884 Register result = locs()->out(0).reg(); |
| 897 | 885 |
| 898 // Push the result place holder initialized to NULL. | 886 // Push the result place holder initialized to NULL. |
| 899 __ PushObject(Object::null_object()); | 887 __ PushObject(Object::null_object()); |
| 900 // Pass a pointer to the first argument in A2. | 888 // Pass a pointer to the first argument in A2. |
| 901 if (!function().HasOptionalParameters()) { | 889 if (!function().HasOptionalParameters()) { |
| 902 __ AddImmediate(A2, FP, (kParamEndSlotFromFp + | 890 __ AddImmediate(A2, FP, (kParamEndSlotFromFp + |
| 903 function().NumParameters()) * kWordSize); | 891 function().NumParameters()) * kWordSize); |
| 904 } else { | 892 } else { |
| 905 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize); | 893 __ AddImmediate(A2, FP, kFirstLocalSlotFromFp * kWordSize); |
| (...skipping 3352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4258 __ SmiTag(result_div); | 4246 __ SmiTag(result_div); |
| 4259 __ SmiTag(result_mod); | 4247 __ SmiTag(result_mod); |
| 4260 return; | 4248 return; |
| 4261 } | 4249 } |
| 4262 UNIMPLEMENTED(); | 4250 UNIMPLEMENTED(); |
| 4263 } | 4251 } |
| 4264 | 4252 |
| 4265 | 4253 |
| 4266 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( | 4254 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( |
| 4267 Isolate* isolate, bool opt) const { | 4255 Isolate* isolate, bool opt) const { |
| 4268 return MakeCallSummary(); | 4256 return MakeCallSummary(isolate); |
| 4269 } | 4257 } |
| 4270 | 4258 |
| 4271 | 4259 |
| 4272 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4260 void PolymorphicInstanceCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4273 __ TraceSimMsg("PolymorphicInstanceCallInstr"); | 4261 __ TraceSimMsg("PolymorphicInstanceCallInstr"); |
| 4274 ASSERT(ic_data().NumArgsTested() == 1); | 4262 ASSERT(ic_data().NumArgsTested() == 1); |
| 4275 if (!with_checks()) { | 4263 if (!with_checks()) { |
| 4276 ASSERT(ic_data().HasOneTarget()); | 4264 ASSERT(ic_data().HasOneTarget()); |
| 4277 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); | 4265 const Function& target = Function::ZoneHandle(ic_data().GetTargetAt(0)); |
| 4278 compiler->GenerateStaticCall(deopt_id(), | 4266 compiler->GenerateStaticCall(deopt_id(), |
| (...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4909 | 4897 |
| 4910 __ LoadObject(result, Bool::True()); | 4898 __ LoadObject(result, Bool::True()); |
| 4911 __ LoadObject(TMP, Bool::False()); | 4899 __ LoadObject(TMP, Bool::False()); |
| 4912 __ subu(CMPRES1, value, result); | 4900 __ subu(CMPRES1, value, result); |
| 4913 __ movz(result, TMP, CMPRES1); // If value is True, move False into result. | 4901 __ movz(result, TMP, CMPRES1); // If value is True, move False into result. |
| 4914 } | 4902 } |
| 4915 | 4903 |
| 4916 | 4904 |
| 4917 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, | 4905 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Isolate* isolate, |
| 4918 bool opt) const { | 4906 bool opt) const { |
| 4919 return MakeCallSummary(); | 4907 return MakeCallSummary(isolate); |
| 4920 } | 4908 } |
| 4921 | 4909 |
| 4922 | 4910 |
| 4923 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4911 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4924 __ TraceSimMsg("AllocateObjectInstr"); | 4912 __ TraceSimMsg("AllocateObjectInstr"); |
| 4925 __ Comment("AllocateObjectInstr"); | 4913 __ Comment("AllocateObjectInstr"); |
| 4926 Isolate* isolate = compiler->isolate(); | 4914 Isolate* isolate = compiler->isolate(); |
| 4927 StubCode* stub_code = isolate->stub_code(); | 4915 StubCode* stub_code = isolate->stub_code(); |
| 4928 const Code& stub = Code::Handle(isolate, | 4916 const Code& stub = Code::Handle(isolate, |
| 4929 stub_code->GetAllocationStubForClass(cls())); | 4917 stub_code->GetAllocationStubForClass(cls())); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 4944 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 4932 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 4945 #if defined(DEBUG) | 4933 #if defined(DEBUG) |
| 4946 __ LoadImmediate(S4, kInvalidObjectPointer); | 4934 __ LoadImmediate(S4, kInvalidObjectPointer); |
| 4947 __ LoadImmediate(S5, kInvalidObjectPointer); | 4935 __ LoadImmediate(S5, kInvalidObjectPointer); |
| 4948 #endif | 4936 #endif |
| 4949 } | 4937 } |
| 4950 | 4938 |
| 4951 } // namespace dart | 4939 } // namespace dart |
| 4952 | 4940 |
| 4953 #endif // defined TARGET_ARCH_MIPS | 4941 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |