| 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 "lib/error.h" | 10 #include "lib/error.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // Generic summary for call instructions that have all arguments pushed | 27 // Generic summary for call instructions that have all arguments pushed |
| 28 // on the stack and return the result in a fixed register R0. | 28 // on the stack and return the result in a fixed register R0. |
| 29 LocationSummary* Instruction::MakeCallSummary() { | 29 LocationSummary* Instruction::MakeCallSummary() { |
| 30 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); | 30 LocationSummary* result = new LocationSummary(0, 0, LocationSummary::kCall); |
| 31 result->set_out(Location::RegisterLocation(R0)); | 31 result->set_out(Location::RegisterLocation(R0)); |
| 32 return result; | 32 return result; |
| 33 } | 33 } |
| 34 | 34 |
| 35 | 35 |
| 36 LocationSummary* PushArgumentInstr::MakeLocationSummary() const { | 36 LocationSummary* PushArgumentInstr::MakeLocationSummary() const { |
| 37 UNIMPLEMENTED(); | 37 const intptr_t kNumInputs = 1; |
| 38 return NULL; | 38 const intptr_t kNumTemps= 0; |
| 39 LocationSummary* locs = |
| 40 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 41 locs->set_in(0, Location::AnyOrConstant(value())); |
| 42 return locs; |
| 39 } | 43 } |
| 40 | 44 |
| 41 | 45 |
| 42 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 46 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 43 UNIMPLEMENTED(); | 47 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode |
| 48 // where PushArgument is handled by BindInstr::EmitNativeCode. |
| 49 if (compiler->is_optimizing()) { |
| 50 Location value = locs()->in(0); |
| 51 if (value.IsRegister()) { |
| 52 __ Push(value.reg()); |
| 53 } else if (value.IsConstant()) { |
| 54 __ PushObject(value.constant()); |
| 55 } else { |
| 56 ASSERT(value.IsStackSlot()); |
| 57 __ ldr(IP, value.ToStackSlotAddress()); |
| 58 __ Push(IP); |
| 59 } |
| 60 } |
| 44 } | 61 } |
| 45 | 62 |
| 46 | 63 |
| 47 LocationSummary* ReturnInstr::MakeLocationSummary() const { | 64 LocationSummary* ReturnInstr::MakeLocationSummary() const { |
| 48 const intptr_t kNumInputs = 1; | 65 const intptr_t kNumInputs = 1; |
| 49 const intptr_t kNumTemps = 0; | 66 const intptr_t kNumTemps = 0; |
| 50 LocationSummary* locs = | 67 LocationSummary* locs = |
| 51 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); | 68 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 52 locs->set_in(0, Location::RegisterLocation(R0)); | 69 locs->set_in(0, Location::RegisterLocation(R0)); |
| 53 return locs; | 70 return locs; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 } | 116 } |
| 100 | 117 |
| 101 | 118 |
| 102 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 119 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 103 Register result = locs()->out().reg(); | 120 Register result = locs()->out().reg(); |
| 104 __ LoadFromOffset(kLoadWord, result, FP, local().index() * kWordSize); | 121 __ LoadFromOffset(kLoadWord, result, FP, local().index() * kWordSize); |
| 105 } | 122 } |
| 106 | 123 |
| 107 | 124 |
| 108 LocationSummary* StoreLocalInstr::MakeLocationSummary() const { | 125 LocationSummary* StoreLocalInstr::MakeLocationSummary() const { |
| 109 UNIMPLEMENTED(); | 126 return LocationSummary::Make(1, |
| 110 return NULL; | 127 Location::SameAsFirstInput(), |
| 128 LocationSummary::kNoCall); |
| 111 } | 129 } |
| 112 | 130 |
| 113 | 131 |
| 114 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 132 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 115 UNIMPLEMENTED(); | 133 Register value = locs()->in(0).reg(); |
| 134 Register result = locs()->out().reg(); |
| 135 ASSERT(result == value); // Assert that register assignment is correct. |
| 136 __ str(value, Address(FP, local().index() * kWordSize)); |
| 116 } | 137 } |
| 117 | 138 |
| 118 | 139 |
| 119 LocationSummary* ConstantInstr::MakeLocationSummary() const { | 140 LocationSummary* ConstantInstr::MakeLocationSummary() const { |
| 120 return LocationSummary::Make(0, | 141 return LocationSummary::Make(0, |
| 121 Location::RequiresRegister(), | 142 Location::RequiresRegister(), |
| 122 LocationSummary::kNoCall); | 143 LocationSummary::kNoCall); |
| 123 } | 144 } |
| 124 | 145 |
| 125 | 146 |
| 126 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 147 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 127 // The register allocator drops constant definitions that have no uses. | 148 // The register allocator drops constant definitions that have no uses. |
| 128 if (!locs()->out().IsInvalid()) { | 149 if (!locs()->out().IsInvalid()) { |
| 129 Register result = locs()->out().reg(); | 150 Register result = locs()->out().reg(); |
| 130 __ LoadObject(result, value()); | 151 __ LoadObject(result, value()); |
| 131 } | 152 } |
| 132 } | 153 } |
| 133 | 154 |
| 134 | 155 |
| 135 LocationSummary* AssertAssignableInstr::MakeLocationSummary() const { | 156 LocationSummary* AssertAssignableInstr::MakeLocationSummary() const { |
| 136 UNIMPLEMENTED(); | 157 const intptr_t kNumInputs = 3; |
| 137 return NULL; | 158 const intptr_t kNumTemps = 0; |
| 159 LocationSummary* summary = |
| 160 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kCall); |
| 161 summary->set_in(0, Location::RegisterLocation(R0)); // Value. |
| 162 summary->set_in(1, Location::RegisterLocation(R1)); // Instantiator. |
| 163 summary->set_in(2, Location::RegisterLocation(R2)); // Type arguments. |
| 164 summary->set_out(Location::RegisterLocation(R0)); |
| 165 return summary; |
| 138 } | 166 } |
| 139 | 167 |
| 140 | 168 |
| 141 LocationSummary* AssertBooleanInstr::MakeLocationSummary() const { | 169 LocationSummary* AssertBooleanInstr::MakeLocationSummary() const { |
| 142 UNIMPLEMENTED(); | 170 UNIMPLEMENTED(); |
| 143 return NULL; | 171 return NULL; |
| 144 } | 172 } |
| 145 | 173 |
| 146 | 174 |
| 147 void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 175 void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 | 913 |
| 886 | 914 |
| 887 void CreateClosureInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 915 void CreateClosureInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 888 UNIMPLEMENTED(); | 916 UNIMPLEMENTED(); |
| 889 } | 917 } |
| 890 | 918 |
| 891 } // namespace dart | 919 } // namespace dart |
| 892 | 920 |
| 893 #endif // defined TARGET_ARCH_ARM | 921 #endif // defined TARGET_ARCH_ARM |
| 894 | 922 |
| OLD | NEW |