| 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 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 if (!locs()->out(0).IsInvalid()) { | 286 if (!locs()->out(0).IsInvalid()) { |
| 287 const Register result = locs()->out(0).reg(); | 287 const Register result = locs()->out(0).reg(); |
| 288 __ LoadObject(result, value()); | 288 __ LoadObject(result, value()); |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 | 292 |
| 293 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Isolate* isolate, | 293 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Isolate* isolate, |
| 294 bool opt) const { | 294 bool opt) const { |
| 295 const intptr_t kNumInputs = 0; | 295 const intptr_t kNumInputs = 0; |
| 296 const intptr_t kNumTemps = 1; | 296 const intptr_t kNumTemps = (representation_ == kUnboxedInt32) ? 0 : 1; |
| 297 LocationSummary* locs = new(isolate) LocationSummary( | 297 LocationSummary* locs = new(isolate) LocationSummary( |
| 298 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 298 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 299 locs->set_out(0, Location::RequiresFpuRegister()); | 299 locs->set_out(0, Location::RequiresFpuRegister()); |
| 300 locs->set_temp(0, Location::RequiresRegister()); | 300 if (representation_ != kUnboxedInt32) { |
| 301 locs->set_temp(0, Location::RequiresRegister()); |
| 302 } |
| 301 return locs; | 303 return locs; |
| 302 } | 304 } |
| 303 | 305 |
| 304 | 306 |
| 305 void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 307 void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 306 // The register allocator drops constant definitions that have no uses. | 308 // The register allocator drops constant definitions that have no uses. |
| 307 if (!locs()->out(0).IsInvalid()) { | 309 if (!locs()->out(0).IsInvalid()) { |
| 308 switch (representation_) { | 310 switch (representation_) { |
| 309 case kUnboxedDouble: | 311 case kUnboxedDouble: |
| 310 if (Utils::DoublesBitEqual(Double::Cast(value()).value(), 0.0) && | 312 if (Utils::DoublesBitEqual(Double::Cast(value()).value(), 0.0) && |
| (...skipping 6797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7108 if (needs_number_check()) { | 7110 if (needs_number_check()) { |
| 7109 LocationSummary* locs = new(isolate) LocationSummary( | 7111 LocationSummary* locs = new(isolate) LocationSummary( |
| 7110 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); | 7112 isolate, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 7111 locs->set_in(0, Location::RegisterLocation(R0)); | 7113 locs->set_in(0, Location::RegisterLocation(R0)); |
| 7112 locs->set_in(1, Location::RegisterLocation(R1)); | 7114 locs->set_in(1, Location::RegisterLocation(R1)); |
| 7113 locs->set_out(0, Location::RegisterLocation(R0)); | 7115 locs->set_out(0, Location::RegisterLocation(R0)); |
| 7114 return locs; | 7116 return locs; |
| 7115 } | 7117 } |
| 7116 LocationSummary* locs = new(isolate) LocationSummary( | 7118 LocationSummary* locs = new(isolate) LocationSummary( |
| 7117 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 7119 isolate, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 7118 locs->set_in(0, Location::RegisterOrConstant(left())); | 7120 |
| 7119 // Only one of the inputs can be a constant. Choose register if the first one | 7121 // If a constant has more than one use, make sure it is loaded in register |
| 7120 // is a constant. | 7122 // so that multiple immediate loads can be avoided. |
| 7121 locs->set_in(1, locs->in(0).IsConstant() | 7123 ConstantInstr* constant = left()->definition()->AsConstant(); |
| 7122 ? Location::RequiresRegister() | 7124 if ((constant != NULL) && !left()->IsSingleUse()) { |
| 7123 : Location::RegisterOrConstant(right())); | 7125 locs->set_in(0, Location::RequiresRegister()); |
| 7126 } else { |
| 7127 locs->set_in(0, Location::RegisterOrConstant(left())); |
| 7128 } |
| 7129 |
| 7130 constant = right()->definition()->AsConstant(); |
| 7131 if ((constant != NULL) && !right()->IsSingleUse()) { |
| 7132 locs->set_in(1, Location::RequiresRegister()); |
| 7133 } else { |
| 7134 // Only one of the inputs can be a constant. Choose register if the first |
| 7135 // one is a constant. |
| 7136 locs->set_in(1, locs->in(0).IsConstant() |
| 7137 ? Location::RequiresRegister() |
| 7138 : Location::RegisterOrConstant(right())); |
| 7139 } |
| 7124 locs->set_out(0, Location::RequiresRegister()); | 7140 locs->set_out(0, Location::RequiresRegister()); |
| 7125 return locs; | 7141 return locs; |
| 7126 } | 7142 } |
| 7127 | 7143 |
| 7128 | 7144 |
| 7129 Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, | 7145 Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, |
| 7130 BranchLabels labels) { | 7146 BranchLabels labels) { |
| 7131 Location left = locs()->in(0); | 7147 Location left = locs()->in(0); |
| 7132 Location right = locs()->in(1); | 7148 Location right = locs()->in(1); |
| 7133 ASSERT(!left.IsConstant() || !right.IsConstant()); | 7149 ASSERT(!left.IsConstant() || !right.IsConstant()); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7221 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); | 7237 compiler->GenerateCall(token_pos(), &label, stub_kind_, locs()); |
| 7222 #if defined(DEBUG) | 7238 #if defined(DEBUG) |
| 7223 __ LoadImmediate(R4, kInvalidObjectPointer); | 7239 __ LoadImmediate(R4, kInvalidObjectPointer); |
| 7224 __ LoadImmediate(R5, kInvalidObjectPointer); | 7240 __ LoadImmediate(R5, kInvalidObjectPointer); |
| 7225 #endif | 7241 #endif |
| 7226 } | 7242 } |
| 7227 | 7243 |
| 7228 } // namespace dart | 7244 } // namespace dart |
| 7229 | 7245 |
| 7230 #endif // defined TARGET_ARCH_ARM | 7246 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |