| 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/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 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(Zone* zone) { | 32 LocationSummary* Instruction::MakeCallSummary(Zone* zone) { |
| 33 LocationSummary* result = | 33 LocationSummary* result = |
| 34 new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); | 34 new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); |
| 35 result->set_out(0, Location::RegisterLocation(R0)); | 35 result->set_out(0, Location::RegisterLocation(R0)); |
| 36 return result; | 36 return result; |
| 37 } | 37 } |
| 38 | 38 |
| 39 | |
| 40 LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone, | 39 LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone, |
| 41 bool opt) const { | 40 bool opt) const { |
| 42 const intptr_t kNumInputs = 1; | 41 const intptr_t kNumInputs = 1; |
| 43 const intptr_t kNumTemps = 0; | 42 const intptr_t kNumTemps = 0; |
| 44 LocationSummary* locs = new (zone) | 43 LocationSummary* locs = new (zone) |
| 45 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 44 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 46 locs->set_in(0, Location::AnyOrConstant(value())); | 45 locs->set_in(0, Location::AnyOrConstant(value())); |
| 47 return locs; | 46 return locs; |
| 48 } | 47 } |
| 49 | 48 |
| 50 | |
| 51 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 49 void PushArgumentInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 52 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode | 50 // In SSA mode, we need an explicit push. Nothing to do in non-SSA mode |
| 53 // where PushArgument is handled by BindInstr::EmitNativeCode. | 51 // where PushArgument is handled by BindInstr::EmitNativeCode. |
| 54 if (compiler->is_optimizing()) { | 52 if (compiler->is_optimizing()) { |
| 55 Location value = locs()->in(0); | 53 Location value = locs()->in(0); |
| 56 if (value.IsRegister()) { | 54 if (value.IsRegister()) { |
| 57 __ Push(value.reg()); | 55 __ Push(value.reg()); |
| 58 } else if (value.IsConstant()) { | 56 } else if (value.IsConstant()) { |
| 59 __ PushObject(value.constant()); | 57 __ PushObject(value.constant()); |
| 60 } else { | 58 } else { |
| 61 ASSERT(value.IsStackSlot()); | 59 ASSERT(value.IsStackSlot()); |
| 62 const intptr_t value_offset = value.ToStackSlotOffset(); | 60 const intptr_t value_offset = value.ToStackSlotOffset(); |
| 63 __ LoadFromOffset(kWord, IP, value.base_reg(), value_offset); | 61 __ LoadFromOffset(kWord, IP, value.base_reg(), value_offset); |
| 64 __ Push(IP); | 62 __ Push(IP); |
| 65 } | 63 } |
| 66 } | 64 } |
| 67 } | 65 } |
| 68 | 66 |
| 69 | |
| 70 LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone, bool opt) const { | 67 LocationSummary* ReturnInstr::MakeLocationSummary(Zone* zone, bool opt) const { |
| 71 const intptr_t kNumInputs = 1; | 68 const intptr_t kNumInputs = 1; |
| 72 const intptr_t kNumTemps = 0; | 69 const intptr_t kNumTemps = 0; |
| 73 LocationSummary* locs = new (zone) | 70 LocationSummary* locs = new (zone) |
| 74 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 71 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 75 locs->set_in(0, Location::RegisterLocation(R0)); | 72 locs->set_in(0, Location::RegisterLocation(R0)); |
| 76 return locs; | 73 return locs; |
| 77 } | 74 } |
| 78 | 75 |
| 79 | |
| 80 // Attempt optimized compilation at return instruction instead of at the entry. | 76 // Attempt optimized compilation at return instruction instead of at the entry. |
| 81 // The entry needs to be patchable, no inlined objects are allowed in the area | 77 // The entry needs to be patchable, no inlined objects are allowed in the area |
| 82 // that will be overwritten by the patch instructions: a branch macro sequence. | 78 // that will be overwritten by the patch instructions: a branch macro sequence. |
| 83 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 79 void ReturnInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 84 const Register result = locs()->in(0).reg(); | 80 const Register result = locs()->in(0).reg(); |
| 85 ASSERT(result == R0); | 81 ASSERT(result == R0); |
| 86 | 82 |
| 87 if (compiler->intrinsic_mode()) { | 83 if (compiler->intrinsic_mode()) { |
| 88 // Intrinsics don't have a frame. | 84 // Intrinsics don't have a frame. |
| 89 __ Ret(); | 85 __ Ret(); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 103 __ Bind(&stack_ok); | 99 __ Bind(&stack_ok); |
| 104 #endif | 100 #endif |
| 105 ASSERT(__ constant_pool_allowed()); | 101 ASSERT(__ constant_pool_allowed()); |
| 106 __ LeaveDartFrame(); // Disallows constant pool use. | 102 __ LeaveDartFrame(); // Disallows constant pool use. |
| 107 __ Ret(); | 103 __ Ret(); |
| 108 // This ReturnInstr may be emitted out of order by the optimizer. The next | 104 // This ReturnInstr may be emitted out of order by the optimizer. The next |
| 109 // block may be a target expecting a properly set constant pool pointer. | 105 // block may be a target expecting a properly set constant pool pointer. |
| 110 __ set_constant_pool_allowed(true); | 106 __ set_constant_pool_allowed(true); |
| 111 } | 107 } |
| 112 | 108 |
| 113 | |
| 114 static Condition NegateCondition(Condition condition) { | 109 static Condition NegateCondition(Condition condition) { |
| 115 switch (condition) { | 110 switch (condition) { |
| 116 case EQ: | 111 case EQ: |
| 117 return NE; | 112 return NE; |
| 118 case NE: | 113 case NE: |
| 119 return EQ; | 114 return EQ; |
| 120 case LT: | 115 case LT: |
| 121 return GE; | 116 return GE; |
| 122 case LE: | 117 case LE: |
| 123 return GT; | 118 return GT; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 136 case VC: | 131 case VC: |
| 137 return VS; | 132 return VS; |
| 138 case VS: | 133 case VS: |
| 139 return VC; | 134 return VC; |
| 140 default: | 135 default: |
| 141 UNREACHABLE(); | 136 UNREACHABLE(); |
| 142 return EQ; | 137 return EQ; |
| 143 } | 138 } |
| 144 } | 139 } |
| 145 | 140 |
| 146 | |
| 147 // Detect pattern when one value is zero and another is a power of 2. | 141 // Detect pattern when one value is zero and another is a power of 2. |
| 148 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { | 142 static bool IsPowerOfTwoKind(intptr_t v1, intptr_t v2) { |
| 149 return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || | 143 return (Utils::IsPowerOfTwo(v1) && (v2 == 0)) || |
| 150 (Utils::IsPowerOfTwo(v2) && (v1 == 0)); | 144 (Utils::IsPowerOfTwo(v2) && (v1 == 0)); |
| 151 } | 145 } |
| 152 | 146 |
| 153 | |
| 154 LocationSummary* IfThenElseInstr::MakeLocationSummary(Zone* zone, | 147 LocationSummary* IfThenElseInstr::MakeLocationSummary(Zone* zone, |
| 155 bool opt) const { | 148 bool opt) const { |
| 156 comparison()->InitializeLocationSummary(zone, opt); | 149 comparison()->InitializeLocationSummary(zone, opt); |
| 157 return comparison()->locs(); | 150 return comparison()->locs(); |
| 158 } | 151 } |
| 159 | 152 |
| 160 | |
| 161 void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 153 void IfThenElseInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 162 const Register result = locs()->out(0).reg(); | 154 const Register result = locs()->out(0).reg(); |
| 163 | 155 |
| 164 Location left = locs()->in(0); | 156 Location left = locs()->in(0); |
| 165 Location right = locs()->in(1); | 157 Location right = locs()->in(1); |
| 166 ASSERT(!left.IsConstant() || !right.IsConstant()); | 158 ASSERT(!left.IsConstant() || !right.IsConstant()); |
| 167 | 159 |
| 168 // Clear out register. | 160 // Clear out register. |
| 169 __ eor(result, result, Operand(result)); | 161 __ eor(result, result, Operand(result)); |
| 170 | 162 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 } else { | 197 } else { |
| 206 __ sub(result, result, Operand(1)); | 198 __ sub(result, result, Operand(1)); |
| 207 const int32_t val = Smi::RawValue(true_value) - Smi::RawValue(false_value); | 199 const int32_t val = Smi::RawValue(true_value) - Smi::RawValue(false_value); |
| 208 __ AndImmediate(result, result, val); | 200 __ AndImmediate(result, result, val); |
| 209 if (false_value != 0) { | 201 if (false_value != 0) { |
| 210 __ AddImmediate(result, Smi::RawValue(false_value)); | 202 __ AddImmediate(result, Smi::RawValue(false_value)); |
| 211 } | 203 } |
| 212 } | 204 } |
| 213 } | 205 } |
| 214 | 206 |
| 215 | |
| 216 LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone, | 207 LocationSummary* ClosureCallInstr::MakeLocationSummary(Zone* zone, |
| 217 bool opt) const { | 208 bool opt) const { |
| 218 const intptr_t kNumInputs = 1; | 209 const intptr_t kNumInputs = 1; |
| 219 const intptr_t kNumTemps = 0; | 210 const intptr_t kNumTemps = 0; |
| 220 LocationSummary* summary = new (zone) | 211 LocationSummary* summary = new (zone) |
| 221 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 212 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 222 summary->set_in(0, Location::RegisterLocation(R0)); // Function. | 213 summary->set_in(0, Location::RegisterLocation(R0)); // Function. |
| 223 summary->set_out(0, Location::RegisterLocation(R0)); | 214 summary->set_out(0, Location::RegisterLocation(R0)); |
| 224 return summary; | 215 return summary; |
| 225 } | 216 } |
| 226 | 217 |
| 227 | |
| 228 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 218 void ClosureCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 229 // Load arguments descriptor in R4. | 219 // Load arguments descriptor in R4. |
| 230 const intptr_t argument_count = ArgumentCount(); // Includes type args. | 220 const intptr_t argument_count = ArgumentCount(); // Includes type args. |
| 231 const Array& arguments_descriptor = | 221 const Array& arguments_descriptor = |
| 232 Array::ZoneHandle(Z, GetArgumentsDescriptor()); | 222 Array::ZoneHandle(Z, GetArgumentsDescriptor()); |
| 233 __ LoadObject(R4, arguments_descriptor); | 223 __ LoadObject(R4, arguments_descriptor); |
| 234 | 224 |
| 235 // R4: Arguments descriptor. | 225 // R4: Arguments descriptor. |
| 236 // R0: Function. | 226 // R0: Function. |
| 237 ASSERT(locs()->in(0).reg() == R0); | 227 ASSERT(locs()->in(0).reg() == R0); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 251 compiler->AddDeoptIndexAtCall(deopt_id_after); | 241 compiler->AddDeoptIndexAtCall(deopt_id_after); |
| 252 } | 242 } |
| 253 // Add deoptimization continuation point after the call and before the | 243 // Add deoptimization continuation point after the call and before the |
| 254 // arguments are removed. | 244 // arguments are removed. |
| 255 // In optimized code this descriptor is needed for exception handling. | 245 // In optimized code this descriptor is needed for exception handling. |
| 256 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, | 246 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, deopt_id_after, |
| 257 token_pos()); | 247 token_pos()); |
| 258 __ Drop(argument_count); | 248 __ Drop(argument_count); |
| 259 } | 249 } |
| 260 | 250 |
| 261 | |
| 262 LocationSummary* LoadLocalInstr::MakeLocationSummary(Zone* zone, | 251 LocationSummary* LoadLocalInstr::MakeLocationSummary(Zone* zone, |
| 263 bool opt) const { | 252 bool opt) const { |
| 264 return LocationSummary::Make(zone, 0, Location::RequiresRegister(), | 253 return LocationSummary::Make(zone, 0, Location::RequiresRegister(), |
| 265 LocationSummary::kNoCall); | 254 LocationSummary::kNoCall); |
| 266 } | 255 } |
| 267 | 256 |
| 268 | |
| 269 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 257 void LoadLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 270 const Register result = locs()->out(0).reg(); | 258 const Register result = locs()->out(0).reg(); |
| 271 __ LoadFromOffset(kWord, result, FP, local().index() * kWordSize); | 259 __ LoadFromOffset(kWord, result, FP, local().index() * kWordSize); |
| 272 } | 260 } |
| 273 | 261 |
| 274 | |
| 275 LocationSummary* StoreLocalInstr::MakeLocationSummary(Zone* zone, | 262 LocationSummary* StoreLocalInstr::MakeLocationSummary(Zone* zone, |
| 276 bool opt) const { | 263 bool opt) const { |
| 277 return LocationSummary::Make(zone, 1, Location::SameAsFirstInput(), | 264 return LocationSummary::Make(zone, 1, Location::SameAsFirstInput(), |
| 278 LocationSummary::kNoCall); | 265 LocationSummary::kNoCall); |
| 279 } | 266 } |
| 280 | 267 |
| 281 | |
| 282 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 268 void StoreLocalInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 283 const Register value = locs()->in(0).reg(); | 269 const Register value = locs()->in(0).reg(); |
| 284 const Register result = locs()->out(0).reg(); | 270 const Register result = locs()->out(0).reg(); |
| 285 ASSERT(result == value); // Assert that register assignment is correct. | 271 ASSERT(result == value); // Assert that register assignment is correct. |
| 286 __ StoreToOffset(kWord, value, FP, local().index() * kWordSize); | 272 __ StoreToOffset(kWord, value, FP, local().index() * kWordSize); |
| 287 } | 273 } |
| 288 | 274 |
| 289 | |
| 290 LocationSummary* ConstantInstr::MakeLocationSummary(Zone* zone, | 275 LocationSummary* ConstantInstr::MakeLocationSummary(Zone* zone, |
| 291 bool opt) const { | 276 bool opt) const { |
| 292 return LocationSummary::Make(zone, 0, Location::RequiresRegister(), | 277 return LocationSummary::Make(zone, 0, Location::RequiresRegister(), |
| 293 LocationSummary::kNoCall); | 278 LocationSummary::kNoCall); |
| 294 } | 279 } |
| 295 | 280 |
| 296 | |
| 297 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 281 void ConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 298 // The register allocator drops constant definitions that have no uses. | 282 // The register allocator drops constant definitions that have no uses. |
| 299 if (!locs()->out(0).IsInvalid()) { | 283 if (!locs()->out(0).IsInvalid()) { |
| 300 const Register result = locs()->out(0).reg(); | 284 const Register result = locs()->out(0).reg(); |
| 301 __ LoadObject(result, value()); | 285 __ LoadObject(result, value()); |
| 302 } | 286 } |
| 303 } | 287 } |
| 304 | 288 |
| 305 | |
| 306 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone, | 289 LocationSummary* UnboxedConstantInstr::MakeLocationSummary(Zone* zone, |
| 307 bool opt) const { | 290 bool opt) const { |
| 308 const intptr_t kNumInputs = 0; | 291 const intptr_t kNumInputs = 0; |
| 309 const intptr_t kNumTemps = (representation_ == kUnboxedInt32) ? 0 : 1; | 292 const intptr_t kNumTemps = (representation_ == kUnboxedInt32) ? 0 : 1; |
| 310 LocationSummary* locs = new (zone) | 293 LocationSummary* locs = new (zone) |
| 311 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 294 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 312 if (representation_ == kUnboxedInt32) { | 295 if (representation_ == kUnboxedInt32) { |
| 313 locs->set_out(0, Location::RequiresRegister()); | 296 locs->set_out(0, Location::RequiresRegister()); |
| 314 } else { | 297 } else { |
| 315 ASSERT(representation_ == kUnboxedDouble); | 298 ASSERT(representation_ == kUnboxedDouble); |
| 316 locs->set_out(0, Location::RequiresFpuRegister()); | 299 locs->set_out(0, Location::RequiresFpuRegister()); |
| 317 } | 300 } |
| 318 if (kNumTemps > 0) { | 301 if (kNumTemps > 0) { |
| 319 locs->set_temp(0, Location::RequiresRegister()); | 302 locs->set_temp(0, Location::RequiresRegister()); |
| 320 } | 303 } |
| 321 return locs; | 304 return locs; |
| 322 } | 305 } |
| 323 | 306 |
| 324 | |
| 325 void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 307 void UnboxedConstantInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 326 // The register allocator drops constant definitions that have no uses. | 308 // The register allocator drops constant definitions that have no uses. |
| 327 if (!locs()->out(0).IsInvalid()) { | 309 if (!locs()->out(0).IsInvalid()) { |
| 328 switch (representation_) { | 310 switch (representation_) { |
| 329 case kUnboxedDouble: | 311 case kUnboxedDouble: |
| 330 if (Utils::DoublesBitEqual(Double::Cast(value()).value(), 0.0) && | 312 if (Utils::DoublesBitEqual(Double::Cast(value()).value(), 0.0) && |
| 331 TargetCPUFeatures::neon_supported()) { | 313 TargetCPUFeatures::neon_supported()) { |
| 332 const QRegister dst = locs()->out(0).fpu_reg(); | 314 const QRegister dst = locs()->out(0).fpu_reg(); |
| 333 __ veorq(dst, dst, dst); | 315 __ veorq(dst, dst, dst); |
| 334 } else { | 316 } else { |
| 335 const DRegister dst = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 317 const DRegister dst = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 336 const Register temp = locs()->temp(0).reg(); | 318 const Register temp = locs()->temp(0).reg(); |
| 337 __ LoadDImmediate(dst, Double::Cast(value()).value(), temp); | 319 __ LoadDImmediate(dst, Double::Cast(value()).value(), temp); |
| 338 } | 320 } |
| 339 break; | 321 break; |
| 340 case kUnboxedInt32: | 322 case kUnboxedInt32: |
| 341 __ LoadImmediate(locs()->out(0).reg(), Smi::Cast(value()).Value()); | 323 __ LoadImmediate(locs()->out(0).reg(), Smi::Cast(value()).Value()); |
| 342 break; | 324 break; |
| 343 default: | 325 default: |
| 344 UNREACHABLE(); | 326 UNREACHABLE(); |
| 345 break; | 327 break; |
| 346 } | 328 } |
| 347 } | 329 } |
| 348 } | 330 } |
| 349 | 331 |
| 350 | |
| 351 LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, | 332 LocationSummary* AssertAssignableInstr::MakeLocationSummary(Zone* zone, |
| 352 bool opt) const { | 333 bool opt) const { |
| 353 const intptr_t kNumInputs = 3; | 334 const intptr_t kNumInputs = 3; |
| 354 const intptr_t kNumTemps = 0; | 335 const intptr_t kNumTemps = 0; |
| 355 LocationSummary* summary = new (zone) | 336 LocationSummary* summary = new (zone) |
| 356 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 337 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 357 summary->set_in(0, Location::RegisterLocation(R0)); // Value. | 338 summary->set_in(0, Location::RegisterLocation(R0)); // Value. |
| 358 summary->set_in(1, Location::RegisterLocation(R2)); // Instant. type args. | 339 summary->set_in(1, Location::RegisterLocation(R2)); // Instant. type args. |
| 359 summary->set_in(2, Location::RegisterLocation(R1)); // Function type args. | 340 summary->set_in(2, Location::RegisterLocation(R1)); // Function type args. |
| 360 summary->set_out(0, Location::RegisterLocation(R0)); | 341 summary->set_out(0, Location::RegisterLocation(R0)); |
| 361 return summary; | 342 return summary; |
| 362 } | 343 } |
| 363 | 344 |
| 364 | |
| 365 LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, | 345 LocationSummary* AssertBooleanInstr::MakeLocationSummary(Zone* zone, |
| 366 bool opt) const { | 346 bool opt) const { |
| 367 const intptr_t kNumInputs = 1; | 347 const intptr_t kNumInputs = 1; |
| 368 const intptr_t kNumTemps = 0; | 348 const intptr_t kNumTemps = 0; |
| 369 LocationSummary* locs = new (zone) | 349 LocationSummary* locs = new (zone) |
| 370 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 350 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 371 locs->set_in(0, Location::RegisterLocation(R0)); | 351 locs->set_in(0, Location::RegisterLocation(R0)); |
| 372 locs->set_out(0, Location::RegisterLocation(R0)); | 352 locs->set_out(0, Location::RegisterLocation(R0)); |
| 373 return locs; | 353 return locs; |
| 374 } | 354 } |
| 375 | 355 |
| 376 | |
| 377 static void EmitAssertBoolean(Register reg, | 356 static void EmitAssertBoolean(Register reg, |
| 378 TokenPosition token_pos, | 357 TokenPosition token_pos, |
| 379 intptr_t deopt_id, | 358 intptr_t deopt_id, |
| 380 LocationSummary* locs, | 359 LocationSummary* locs, |
| 381 FlowGraphCompiler* compiler) { | 360 FlowGraphCompiler* compiler) { |
| 382 // Check that the type of the value is allowed in conditional context. | 361 // Check that the type of the value is allowed in conditional context. |
| 383 // Call the runtime if the object is not bool::true or bool::false. | 362 // Call the runtime if the object is not bool::true or bool::false. |
| 384 ASSERT(locs->always_calls()); | 363 ASSERT(locs->always_calls()); |
| 385 Label done; | 364 Label done; |
| 386 | 365 |
| 387 if (Isolate::Current()->type_checks()) { | 366 if (Isolate::Current()->type_checks()) { |
| 388 __ CompareObject(reg, Bool::True()); | 367 __ CompareObject(reg, Bool::True()); |
| 389 __ b(&done, EQ); | 368 __ b(&done, EQ); |
| 390 __ CompareObject(reg, Bool::False()); | 369 __ CompareObject(reg, Bool::False()); |
| 391 __ b(&done, EQ); | 370 __ b(&done, EQ); |
| 392 } else { | 371 } else { |
| 393 ASSERT(Isolate::Current()->asserts()); | 372 ASSERT(Isolate::Current()->asserts()); |
| 394 __ CompareObject(reg, Object::null_instance()); | 373 __ CompareObject(reg, Object::null_instance()); |
| 395 __ b(&done, NE); | 374 __ b(&done, NE); |
| 396 } | 375 } |
| 397 | 376 |
| 398 __ Push(reg); // Push the source object. | 377 __ Push(reg); // Push the source object. |
| 399 compiler->GenerateRuntimeCall(token_pos, deopt_id, | 378 compiler->GenerateRuntimeCall(token_pos, deopt_id, |
| 400 kNonBoolTypeErrorRuntimeEntry, 1, locs); | 379 kNonBoolTypeErrorRuntimeEntry, 1, locs); |
| 401 // We should never return here. | 380 // We should never return here. |
| 402 __ bkpt(0); | 381 __ bkpt(0); |
| 403 __ Bind(&done); | 382 __ Bind(&done); |
| 404 } | 383 } |
| 405 | 384 |
| 406 | |
| 407 void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 385 void AssertBooleanInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 408 const Register obj = locs()->in(0).reg(); | 386 const Register obj = locs()->in(0).reg(); |
| 409 const Register result = locs()->out(0).reg(); | 387 const Register result = locs()->out(0).reg(); |
| 410 | 388 |
| 411 EmitAssertBoolean(obj, token_pos(), deopt_id(), locs(), compiler); | 389 EmitAssertBoolean(obj, token_pos(), deopt_id(), locs(), compiler); |
| 412 ASSERT(obj == result); | 390 ASSERT(obj == result); |
| 413 } | 391 } |
| 414 | 392 |
| 415 | |
| 416 static Condition TokenKindToSmiCondition(Token::Kind kind) { | 393 static Condition TokenKindToSmiCondition(Token::Kind kind) { |
| 417 switch (kind) { | 394 switch (kind) { |
| 418 case Token::kEQ: | 395 case Token::kEQ: |
| 419 return EQ; | 396 return EQ; |
| 420 case Token::kNE: | 397 case Token::kNE: |
| 421 return NE; | 398 return NE; |
| 422 case Token::kLT: | 399 case Token::kLT: |
| 423 return LT; | 400 return LT; |
| 424 case Token::kGT: | 401 case Token::kGT: |
| 425 return GT; | 402 return GT; |
| 426 case Token::kLTE: | 403 case Token::kLTE: |
| 427 return LE; | 404 return LE; |
| 428 case Token::kGTE: | 405 case Token::kGTE: |
| 429 return GE; | 406 return GE; |
| 430 default: | 407 default: |
| 431 UNREACHABLE(); | 408 UNREACHABLE(); |
| 432 return VS; | 409 return VS; |
| 433 } | 410 } |
| 434 } | 411 } |
| 435 | 412 |
| 436 | |
| 437 LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone, | 413 LocationSummary* EqualityCompareInstr::MakeLocationSummary(Zone* zone, |
| 438 bool opt) const { | 414 bool opt) const { |
| 439 const intptr_t kNumInputs = 2; | 415 const intptr_t kNumInputs = 2; |
| 440 if (operation_cid() == kMintCid) { | 416 if (operation_cid() == kMintCid) { |
| 441 const intptr_t kNumTemps = 0; | 417 const intptr_t kNumTemps = 0; |
| 442 LocationSummary* locs = new (zone) | 418 LocationSummary* locs = new (zone) |
| 443 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 419 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 444 locs->set_in(0, Location::Pair(Location::RequiresRegister(), | 420 locs->set_in(0, Location::Pair(Location::RequiresRegister(), |
| 445 Location::RequiresRegister())); | 421 Location::RequiresRegister())); |
| 446 locs->set_in(1, Location::Pair(Location::RequiresRegister(), | 422 locs->set_in(1, Location::Pair(Location::RequiresRegister(), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 467 locs->set_in(1, locs->in(0).IsConstant() | 443 locs->set_in(1, locs->in(0).IsConstant() |
| 468 ? Location::RequiresRegister() | 444 ? Location::RequiresRegister() |
| 469 : Location::RegisterOrConstant(right())); | 445 : Location::RegisterOrConstant(right())); |
| 470 locs->set_out(0, Location::RequiresRegister()); | 446 locs->set_out(0, Location::RequiresRegister()); |
| 471 return locs; | 447 return locs; |
| 472 } | 448 } |
| 473 UNREACHABLE(); | 449 UNREACHABLE(); |
| 474 return NULL; | 450 return NULL; |
| 475 } | 451 } |
| 476 | 452 |
| 477 | |
| 478 static void LoadValueCid(FlowGraphCompiler* compiler, | 453 static void LoadValueCid(FlowGraphCompiler* compiler, |
| 479 Register value_cid_reg, | 454 Register value_cid_reg, |
| 480 Register value_reg, | 455 Register value_reg, |
| 481 Label* value_is_smi = NULL) { | 456 Label* value_is_smi = NULL) { |
| 482 if (value_is_smi == NULL) { | 457 if (value_is_smi == NULL) { |
| 483 __ mov(value_cid_reg, Operand(kSmiCid)); | 458 __ mov(value_cid_reg, Operand(kSmiCid)); |
| 484 } | 459 } |
| 485 __ tst(value_reg, Operand(kSmiTagMask)); | 460 __ tst(value_reg, Operand(kSmiTagMask)); |
| 486 if (value_is_smi == NULL) { | 461 if (value_is_smi == NULL) { |
| 487 __ LoadClassId(value_cid_reg, value_reg, NE); | 462 __ LoadClassId(value_cid_reg, value_reg, NE); |
| 488 } else { | 463 } else { |
| 489 __ b(value_is_smi, EQ); | 464 __ b(value_is_smi, EQ); |
| 490 __ LoadClassId(value_cid_reg, value_reg); | 465 __ LoadClassId(value_cid_reg, value_reg); |
| 491 } | 466 } |
| 492 } | 467 } |
| 493 | 468 |
| 494 | |
| 495 static Condition FlipCondition(Condition condition) { | 469 static Condition FlipCondition(Condition condition) { |
| 496 switch (condition) { | 470 switch (condition) { |
| 497 case EQ: | 471 case EQ: |
| 498 return EQ; | 472 return EQ; |
| 499 case NE: | 473 case NE: |
| 500 return NE; | 474 return NE; |
| 501 case LT: | 475 case LT: |
| 502 return GT; | 476 return GT; |
| 503 case LE: | 477 case LE: |
| 504 return GE; | 478 return GE; |
| 505 case GT: | 479 case GT: |
| 506 return LT; | 480 return LT; |
| 507 case GE: | 481 case GE: |
| 508 return LE; | 482 return LE; |
| 509 case CC: | 483 case CC: |
| 510 return HI; | 484 return HI; |
| 511 case LS: | 485 case LS: |
| 512 return CS; | 486 return CS; |
| 513 case HI: | 487 case HI: |
| 514 return CC; | 488 return CC; |
| 515 case CS: | 489 case CS: |
| 516 return LS; | 490 return LS; |
| 517 default: | 491 default: |
| 518 UNREACHABLE(); | 492 UNREACHABLE(); |
| 519 return EQ; | 493 return EQ; |
| 520 } | 494 } |
| 521 } | 495 } |
| 522 | 496 |
| 523 | |
| 524 static void EmitBranchOnCondition(FlowGraphCompiler* compiler, | 497 static void EmitBranchOnCondition(FlowGraphCompiler* compiler, |
| 525 Condition true_condition, | 498 Condition true_condition, |
| 526 BranchLabels labels) { | 499 BranchLabels labels) { |
| 527 if (labels.fall_through == labels.false_label) { | 500 if (labels.fall_through == labels.false_label) { |
| 528 // If the next block is the false successor we will fall through to it. | 501 // If the next block is the false successor we will fall through to it. |
| 529 __ b(labels.true_label, true_condition); | 502 __ b(labels.true_label, true_condition); |
| 530 } else { | 503 } else { |
| 531 // If the next block is not the false successor we will branch to it. | 504 // If the next block is not the false successor we will branch to it. |
| 532 Condition false_condition = NegateCondition(true_condition); | 505 Condition false_condition = NegateCondition(true_condition); |
| 533 __ b(labels.false_label, false_condition); | 506 __ b(labels.false_label, false_condition); |
| 534 | 507 |
| 535 // Fall through or jump to the true successor. | 508 // Fall through or jump to the true successor. |
| 536 if (labels.fall_through != labels.true_label) { | 509 if (labels.fall_through != labels.true_label) { |
| 537 __ b(labels.true_label); | 510 __ b(labels.true_label); |
| 538 } | 511 } |
| 539 } | 512 } |
| 540 } | 513 } |
| 541 | 514 |
| 542 | |
| 543 static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler, | 515 static Condition EmitSmiComparisonOp(FlowGraphCompiler* compiler, |
| 544 LocationSummary* locs, | 516 LocationSummary* locs, |
| 545 Token::Kind kind) { | 517 Token::Kind kind) { |
| 546 Location left = locs->in(0); | 518 Location left = locs->in(0); |
| 547 Location right = locs->in(1); | 519 Location right = locs->in(1); |
| 548 ASSERT(!left.IsConstant() || !right.IsConstant()); | 520 ASSERT(!left.IsConstant() || !right.IsConstant()); |
| 549 | 521 |
| 550 Condition true_condition = TokenKindToSmiCondition(kind); | 522 Condition true_condition = TokenKindToSmiCondition(kind); |
| 551 | 523 |
| 552 if (left.IsConstant()) { | 524 if (left.IsConstant()) { |
| 553 __ CompareObject(right.reg(), left.constant()); | 525 __ CompareObject(right.reg(), left.constant()); |
| 554 true_condition = FlipCondition(true_condition); | 526 true_condition = FlipCondition(true_condition); |
| 555 } else if (right.IsConstant()) { | 527 } else if (right.IsConstant()) { |
| 556 __ CompareObject(left.reg(), right.constant()); | 528 __ CompareObject(left.reg(), right.constant()); |
| 557 } else { | 529 } else { |
| 558 __ cmp(left.reg(), Operand(right.reg())); | 530 __ cmp(left.reg(), Operand(right.reg())); |
| 559 } | 531 } |
| 560 return true_condition; | 532 return true_condition; |
| 561 } | 533 } |
| 562 | 534 |
| 563 | |
| 564 static Condition TokenKindToMintCondition(Token::Kind kind) { | 535 static Condition TokenKindToMintCondition(Token::Kind kind) { |
| 565 switch (kind) { | 536 switch (kind) { |
| 566 case Token::kEQ: | 537 case Token::kEQ: |
| 567 return EQ; | 538 return EQ; |
| 568 case Token::kNE: | 539 case Token::kNE: |
| 569 return NE; | 540 return NE; |
| 570 case Token::kLT: | 541 case Token::kLT: |
| 571 return LT; | 542 return LT; |
| 572 case Token::kGT: | 543 case Token::kGT: |
| 573 return GT; | 544 return GT; |
| 574 case Token::kLTE: | 545 case Token::kLTE: |
| 575 return LE; | 546 return LE; |
| 576 case Token::kGTE: | 547 case Token::kGTE: |
| 577 return GE; | 548 return GE; |
| 578 default: | 549 default: |
| 579 UNREACHABLE(); | 550 UNREACHABLE(); |
| 580 return VS; | 551 return VS; |
| 581 } | 552 } |
| 582 } | 553 } |
| 583 | 554 |
| 584 | |
| 585 static Condition EmitUnboxedMintEqualityOp(FlowGraphCompiler* compiler, | 555 static Condition EmitUnboxedMintEqualityOp(FlowGraphCompiler* compiler, |
| 586 LocationSummary* locs, | 556 LocationSummary* locs, |
| 587 Token::Kind kind) { | 557 Token::Kind kind) { |
| 588 ASSERT(Token::IsEqualityOperator(kind)); | 558 ASSERT(Token::IsEqualityOperator(kind)); |
| 589 PairLocation* left_pair = locs->in(0).AsPairLocation(); | 559 PairLocation* left_pair = locs->in(0).AsPairLocation(); |
| 590 Register left_lo = left_pair->At(0).reg(); | 560 Register left_lo = left_pair->At(0).reg(); |
| 591 Register left_hi = left_pair->At(1).reg(); | 561 Register left_hi = left_pair->At(1).reg(); |
| 592 PairLocation* right_pair = locs->in(1).AsPairLocation(); | 562 PairLocation* right_pair = locs->in(1).AsPairLocation(); |
| 593 Register right_lo = right_pair->At(0).reg(); | 563 Register right_lo = right_pair->At(0).reg(); |
| 594 Register right_hi = right_pair->At(1).reg(); | 564 Register right_hi = right_pair->At(1).reg(); |
| 595 | 565 |
| 596 // Compare lower. | 566 // Compare lower. |
| 597 __ cmp(left_lo, Operand(right_lo)); | 567 __ cmp(left_lo, Operand(right_lo)); |
| 598 // Compare upper if lower is equal. | 568 // Compare upper if lower is equal. |
| 599 __ cmp(left_hi, Operand(right_hi), EQ); | 569 __ cmp(left_hi, Operand(right_hi), EQ); |
| 600 return TokenKindToMintCondition(kind); | 570 return TokenKindToMintCondition(kind); |
| 601 } | 571 } |
| 602 | 572 |
| 603 | |
| 604 static Condition EmitUnboxedMintComparisonOp(FlowGraphCompiler* compiler, | 573 static Condition EmitUnboxedMintComparisonOp(FlowGraphCompiler* compiler, |
| 605 LocationSummary* locs, | 574 LocationSummary* locs, |
| 606 Token::Kind kind, | 575 Token::Kind kind, |
| 607 BranchLabels labels) { | 576 BranchLabels labels) { |
| 608 PairLocation* left_pair = locs->in(0).AsPairLocation(); | 577 PairLocation* left_pair = locs->in(0).AsPairLocation(); |
| 609 Register left_lo = left_pair->At(0).reg(); | 578 Register left_lo = left_pair->At(0).reg(); |
| 610 Register left_hi = left_pair->At(1).reg(); | 579 Register left_hi = left_pair->At(1).reg(); |
| 611 PairLocation* right_pair = locs->in(1).AsPairLocation(); | 580 PairLocation* right_pair = locs->in(1).AsPairLocation(); |
| 612 Register right_lo = right_pair->At(0).reg(); | 581 Register right_lo = right_pair->At(0).reg(); |
| 613 Register right_hi = right_pair->At(1).reg(); | 582 Register right_hi = right_pair->At(1).reg(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 638 // Compare upper halves first. | 607 // Compare upper halves first. |
| 639 __ cmp(left_hi, Operand(right_hi)); | 608 __ cmp(left_hi, Operand(right_hi)); |
| 640 __ b(labels.true_label, hi_cond); | 609 __ b(labels.true_label, hi_cond); |
| 641 __ b(labels.false_label, FlipCondition(hi_cond)); | 610 __ b(labels.false_label, FlipCondition(hi_cond)); |
| 642 | 611 |
| 643 // If higher words are equal, compare lower words. | 612 // If higher words are equal, compare lower words. |
| 644 __ cmp(left_lo, Operand(right_lo)); | 613 __ cmp(left_lo, Operand(right_lo)); |
| 645 return lo_cond; | 614 return lo_cond; |
| 646 } | 615 } |
| 647 | 616 |
| 648 | |
| 649 static Condition TokenKindToDoubleCondition(Token::Kind kind) { | 617 static Condition TokenKindToDoubleCondition(Token::Kind kind) { |
| 650 switch (kind) { | 618 switch (kind) { |
| 651 case Token::kEQ: | 619 case Token::kEQ: |
| 652 return EQ; | 620 return EQ; |
| 653 case Token::kNE: | 621 case Token::kNE: |
| 654 return NE; | 622 return NE; |
| 655 case Token::kLT: | 623 case Token::kLT: |
| 656 return LT; | 624 return LT; |
| 657 case Token::kGT: | 625 case Token::kGT: |
| 658 return GT; | 626 return GT; |
| 659 case Token::kLTE: | 627 case Token::kLTE: |
| 660 return LE; | 628 return LE; |
| 661 case Token::kGTE: | 629 case Token::kGTE: |
| 662 return GE; | 630 return GE; |
| 663 default: | 631 default: |
| 664 UNREACHABLE(); | 632 UNREACHABLE(); |
| 665 return VS; | 633 return VS; |
| 666 } | 634 } |
| 667 } | 635 } |
| 668 | 636 |
| 669 | |
| 670 static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, | 637 static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler, |
| 671 LocationSummary* locs, | 638 LocationSummary* locs, |
| 672 BranchLabels labels, | 639 BranchLabels labels, |
| 673 Token::Kind kind) { | 640 Token::Kind kind) { |
| 674 const QRegister left = locs->in(0).fpu_reg(); | 641 const QRegister left = locs->in(0).fpu_reg(); |
| 675 const QRegister right = locs->in(1).fpu_reg(); | 642 const QRegister right = locs->in(1).fpu_reg(); |
| 676 const DRegister dleft = EvenDRegisterOf(left); | 643 const DRegister dleft = EvenDRegisterOf(left); |
| 677 const DRegister dright = EvenDRegisterOf(right); | 644 const DRegister dright = EvenDRegisterOf(right); |
| 678 __ vcmpd(dleft, dright); | 645 __ vcmpd(dleft, dright); |
| 679 __ vmstat(); | 646 __ vmstat(); |
| 680 Condition true_condition = TokenKindToDoubleCondition(kind); | 647 Condition true_condition = TokenKindToDoubleCondition(kind); |
| 681 if (true_condition != NE) { | 648 if (true_condition != NE) { |
| 682 // Special case for NaN comparison. Result is always false unless | 649 // Special case for NaN comparison. Result is always false unless |
| 683 // relational operator is !=. | 650 // relational operator is !=. |
| 684 __ b(labels.false_label, VS); | 651 __ b(labels.false_label, VS); |
| 685 } | 652 } |
| 686 return true_condition; | 653 return true_condition; |
| 687 } | 654 } |
| 688 | 655 |
| 689 | |
| 690 Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, | 656 Condition EqualityCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, |
| 691 BranchLabels labels) { | 657 BranchLabels labels) { |
| 692 if (operation_cid() == kSmiCid) { | 658 if (operation_cid() == kSmiCid) { |
| 693 return EmitSmiComparisonOp(compiler, locs(), kind()); | 659 return EmitSmiComparisonOp(compiler, locs(), kind()); |
| 694 } else if (operation_cid() == kMintCid) { | 660 } else if (operation_cid() == kMintCid) { |
| 695 return EmitUnboxedMintEqualityOp(compiler, locs(), kind()); | 661 return EmitUnboxedMintEqualityOp(compiler, locs(), kind()); |
| 696 } else { | 662 } else { |
| 697 ASSERT(operation_cid() == kDoubleCid); | 663 ASSERT(operation_cid() == kDoubleCid); |
| 698 return EmitDoubleComparisonOp(compiler, locs(), labels, kind()); | 664 return EmitDoubleComparisonOp(compiler, locs(), labels, kind()); |
| 699 } | 665 } |
| 700 } | 666 } |
| 701 | 667 |
| 702 | |
| 703 LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { | 668 LocationSummary* TestSmiInstr::MakeLocationSummary(Zone* zone, bool opt) const { |
| 704 const intptr_t kNumInputs = 2; | 669 const intptr_t kNumInputs = 2; |
| 705 const intptr_t kNumTemps = 0; | 670 const intptr_t kNumTemps = 0; |
| 706 LocationSummary* locs = new (zone) | 671 LocationSummary* locs = new (zone) |
| 707 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 672 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 708 locs->set_in(0, Location::RequiresRegister()); | 673 locs->set_in(0, Location::RequiresRegister()); |
| 709 // Only one input can be a constant operand. The case of two constant | 674 // Only one input can be a constant operand. The case of two constant |
| 710 // operands should be handled by constant propagation. | 675 // operands should be handled by constant propagation. |
| 711 locs->set_in(1, Location::RegisterOrConstant(right())); | 676 locs->set_in(1, Location::RegisterOrConstant(right())); |
| 712 return locs; | 677 return locs; |
| 713 } | 678 } |
| 714 | 679 |
| 715 | |
| 716 Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, | 680 Condition TestSmiInstr::EmitComparisonCode(FlowGraphCompiler* compiler, |
| 717 BranchLabels labels) { | 681 BranchLabels labels) { |
| 718 const Register left = locs()->in(0).reg(); | 682 const Register left = locs()->in(0).reg(); |
| 719 Location right = locs()->in(1); | 683 Location right = locs()->in(1); |
| 720 if (right.IsConstant()) { | 684 if (right.IsConstant()) { |
| 721 ASSERT(right.constant().IsSmi()); | 685 ASSERT(right.constant().IsSmi()); |
| 722 const int32_t imm = reinterpret_cast<int32_t>(right.constant().raw()); | 686 const int32_t imm = reinterpret_cast<int32_t>(right.constant().raw()); |
| 723 __ TestImmediate(left, imm); | 687 __ TestImmediate(left, imm); |
| 724 } else { | 688 } else { |
| 725 __ tst(left, Operand(right.reg())); | 689 __ tst(left, Operand(right.reg())); |
| 726 } | 690 } |
| 727 Condition true_condition = (kind() == Token::kNE) ? NE : EQ; | 691 Condition true_condition = (kind() == Token::kNE) ? NE : EQ; |
| 728 return true_condition; | 692 return true_condition; |
| 729 } | 693 } |
| 730 | 694 |
| 731 | |
| 732 LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone, | 695 LocationSummary* TestCidsInstr::MakeLocationSummary(Zone* zone, |
| 733 bool opt) const { | 696 bool opt) const { |
| 734 const intptr_t kNumInputs = 1; | 697 const intptr_t kNumInputs = 1; |
| 735 const intptr_t kNumTemps = 1; | 698 const intptr_t kNumTemps = 1; |
| 736 LocationSummary* locs = new (zone) | 699 LocationSummary* locs = new (zone) |
| 737 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 700 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 738 locs->set_in(0, Location::RequiresRegister()); | 701 locs->set_in(0, Location::RequiresRegister()); |
| 739 locs->set_temp(0, Location::RequiresRegister()); | 702 locs->set_temp(0, Location::RequiresRegister()); |
| 740 locs->set_out(0, Location::RequiresRegister()); | 703 locs->set_out(0, Location::RequiresRegister()); |
| 741 return locs; | 704 return locs; |
| 742 } | 705 } |
| 743 | 706 |
| 744 | |
| 745 Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, | 707 Condition TestCidsInstr::EmitComparisonCode(FlowGraphCompiler* compiler, |
| 746 BranchLabels labels) { | 708 BranchLabels labels) { |
| 747 ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT)); | 709 ASSERT((kind() == Token::kIS) || (kind() == Token::kISNOT)); |
| 748 const Register val_reg = locs()->in(0).reg(); | 710 const Register val_reg = locs()->in(0).reg(); |
| 749 const Register cid_reg = locs()->temp(0).reg(); | 711 const Register cid_reg = locs()->temp(0).reg(); |
| 750 | 712 |
| 751 Label* deopt = | 713 Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub( |
| 752 CanDeoptimize() | 714 deopt_id(), ICData::kDeoptTestCids, |
| 753 ? compiler->AddDeoptStub(deopt_id(), ICData::kDeoptTestCids, | 715 licm_hoisted_ ? ICData::kHoisted : 0) |
| 754 licm_hoisted_ ? ICData::kHoisted : 0) | 716 : NULL; |
| 755 : NULL; | |
| 756 | 717 |
| 757 const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0; | 718 const intptr_t true_result = (kind() == Token::kIS) ? 1 : 0; |
| 758 const ZoneGrowableArray<intptr_t>& data = cid_results(); | 719 const ZoneGrowableArray<intptr_t>& data = cid_results(); |
| 759 ASSERT(data[0] == kSmiCid); | 720 ASSERT(data[0] == kSmiCid); |
| 760 bool result = data[1] == true_result; | 721 bool result = data[1] == true_result; |
| 761 __ tst(val_reg, Operand(kSmiTagMask)); | 722 __ tst(val_reg, Operand(kSmiTagMask)); |
| 762 __ b(result ? labels.true_label : labels.false_label, EQ); | 723 __ b(result ? labels.true_label : labels.false_label, EQ); |
| 763 __ LoadClassId(cid_reg, val_reg); | 724 __ LoadClassId(cid_reg, val_reg); |
| 764 | 725 |
| 765 for (intptr_t i = 2; i < data.length(); i += 2) { | 726 for (intptr_t i = 2; i < data.length(); i += 2) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 779 __ b(target); | 740 __ b(target); |
| 780 } | 741 } |
| 781 } else { | 742 } else { |
| 782 __ b(deopt); | 743 __ b(deopt); |
| 783 } | 744 } |
| 784 // Dummy result as this method already did the jump, there's no need | 745 // Dummy result as this method already did the jump, there's no need |
| 785 // for the caller to branch on a condition. | 746 // for the caller to branch on a condition. |
| 786 return kInvalidCondition; | 747 return kInvalidCondition; |
| 787 } | 748 } |
| 788 | 749 |
| 789 | |
| 790 LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone, | 750 LocationSummary* RelationalOpInstr::MakeLocationSummary(Zone* zone, |
| 791 bool opt) const { | 751 bool opt) const { |
| 792 const intptr_t kNumInputs = 2; | 752 const intptr_t kNumInputs = 2; |
| 793 const intptr_t kNumTemps = 0; | 753 const intptr_t kNumTemps = 0; |
| 794 if (operation_cid() == kMintCid) { | 754 if (operation_cid() == kMintCid) { |
| 795 const intptr_t kNumTemps = 0; | 755 const intptr_t kNumTemps = 0; |
| 796 LocationSummary* locs = new (zone) | 756 LocationSummary* locs = new (zone) |
| 797 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 757 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 798 locs->set_in(0, Location::Pair(Location::RequiresRegister(), | 758 locs->set_in(0, Location::Pair(Location::RequiresRegister(), |
| 799 Location::RequiresRegister())); | 759 Location::RequiresRegister())); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 816 summary->set_in(0, Location::RegisterOrConstant(left())); | 776 summary->set_in(0, Location::RegisterOrConstant(left())); |
| 817 // Only one input can be a constant operand. The case of two constant | 777 // Only one input can be a constant operand. The case of two constant |
| 818 // operands should be handled by constant propagation. | 778 // operands should be handled by constant propagation. |
| 819 summary->set_in(1, summary->in(0).IsConstant() | 779 summary->set_in(1, summary->in(0).IsConstant() |
| 820 ? Location::RequiresRegister() | 780 ? Location::RequiresRegister() |
| 821 : Location::RegisterOrConstant(right())); | 781 : Location::RegisterOrConstant(right())); |
| 822 summary->set_out(0, Location::RequiresRegister()); | 782 summary->set_out(0, Location::RequiresRegister()); |
| 823 return summary; | 783 return summary; |
| 824 } | 784 } |
| 825 | 785 |
| 826 | |
| 827 Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, | 786 Condition RelationalOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, |
| 828 BranchLabels labels) { | 787 BranchLabels labels) { |
| 829 if (operation_cid() == kSmiCid) { | 788 if (operation_cid() == kSmiCid) { |
| 830 return EmitSmiComparisonOp(compiler, locs(), kind()); | 789 return EmitSmiComparisonOp(compiler, locs(), kind()); |
| 831 } else if (operation_cid() == kMintCid) { | 790 } else if (operation_cid() == kMintCid) { |
| 832 return EmitUnboxedMintComparisonOp(compiler, locs(), kind(), labels); | 791 return EmitUnboxedMintComparisonOp(compiler, locs(), kind(), labels); |
| 833 } else { | 792 } else { |
| 834 ASSERT(operation_cid() == kDoubleCid); | 793 ASSERT(operation_cid() == kDoubleCid); |
| 835 return EmitDoubleComparisonOp(compiler, locs(), labels, kind()); | 794 return EmitDoubleComparisonOp(compiler, locs(), labels, kind()); |
| 836 } | 795 } |
| 837 } | 796 } |
| 838 | 797 |
| 839 | |
| 840 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, | 798 LocationSummary* NativeCallInstr::MakeLocationSummary(Zone* zone, |
| 841 bool opt) const { | 799 bool opt) const { |
| 842 return MakeCallSummary(zone); | 800 return MakeCallSummary(zone); |
| 843 } | 801 } |
| 844 | 802 |
| 845 | |
| 846 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 803 void NativeCallInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 847 SetupNative(); | 804 SetupNative(); |
| 848 const Register result = locs()->out(0).reg(); | 805 const Register result = locs()->out(0).reg(); |
| 849 | 806 |
| 850 // Push the result place holder initialized to NULL. | 807 // Push the result place holder initialized to NULL. |
| 851 __ PushObject(Object::null_object()); | 808 __ PushObject(Object::null_object()); |
| 852 // Pass a pointer to the first argument in R2. | 809 // Pass a pointer to the first argument in R2. |
| 853 if (!function().HasOptionalParameters()) { | 810 if (!function().HasOptionalParameters()) { |
| 854 __ AddImmediate( | 811 __ AddImmediate( |
| 855 R2, FP, (kParamEndSlotFromFp + function().NumParameters()) * kWordSize); | 812 R2, FP, (kParamEndSlotFromFp + function().NumParameters()) * kWordSize); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 if (link_lazily()) { | 848 if (link_lazily()) { |
| 892 compiler->GeneratePatchableCall(token_pos(), *stub_entry, | 849 compiler->GeneratePatchableCall(token_pos(), *stub_entry, |
| 893 RawPcDescriptors::kOther, locs()); | 850 RawPcDescriptors::kOther, locs()); |
| 894 } else { | 851 } else { |
| 895 compiler->GenerateCall(token_pos(), *stub_entry, RawPcDescriptors::kOther, | 852 compiler->GenerateCall(token_pos(), *stub_entry, RawPcDescriptors::kOther, |
| 896 locs()); | 853 locs()); |
| 897 } | 854 } |
| 898 __ Pop(result); | 855 __ Pop(result); |
| 899 } | 856 } |
| 900 | 857 |
| 901 | |
| 902 LocationSummary* OneByteStringFromCharCodeInstr::MakeLocationSummary( | 858 LocationSummary* OneByteStringFromCharCodeInstr::MakeLocationSummary( |
| 903 Zone* zone, | 859 Zone* zone, |
| 904 bool opt) const { | 860 bool opt) const { |
| 905 const intptr_t kNumInputs = 1; | 861 const intptr_t kNumInputs = 1; |
| 906 // TODO(fschneider): Allow immediate operands for the char code. | 862 // TODO(fschneider): Allow immediate operands for the char code. |
| 907 return LocationSummary::Make(zone, kNumInputs, Location::RequiresRegister(), | 863 return LocationSummary::Make(zone, kNumInputs, Location::RequiresRegister(), |
| 908 LocationSummary::kNoCall); | 864 LocationSummary::kNoCall); |
| 909 } | 865 } |
| 910 | 866 |
| 911 | |
| 912 void OneByteStringFromCharCodeInstr::EmitNativeCode( | 867 void OneByteStringFromCharCodeInstr::EmitNativeCode( |
| 913 FlowGraphCompiler* compiler) { | 868 FlowGraphCompiler* compiler) { |
| 914 ASSERT(compiler->is_optimizing()); | 869 ASSERT(compiler->is_optimizing()); |
| 915 const Register char_code = locs()->in(0).reg(); | 870 const Register char_code = locs()->in(0).reg(); |
| 916 const Register result = locs()->out(0).reg(); | 871 const Register result = locs()->out(0).reg(); |
| 917 | 872 |
| 918 __ ldr(result, Address(THR, Thread::predefined_symbols_address_offset())); | 873 __ ldr(result, Address(THR, Thread::predefined_symbols_address_offset())); |
| 919 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); | 874 __ AddImmediate(result, Symbols::kNullCharCodeSymbolOffset * kWordSize); |
| 920 __ ldr(result, Address(result, char_code, LSL, 1)); // Char code is a smi. | 875 __ ldr(result, Address(result, char_code, LSL, 1)); // Char code is a smi. |
| 921 } | 876 } |
| 922 | 877 |
| 923 | |
| 924 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, | 878 LocationSummary* StringToCharCodeInstr::MakeLocationSummary(Zone* zone, |
| 925 bool opt) const { | 879 bool opt) const { |
| 926 const intptr_t kNumInputs = 1; | 880 const intptr_t kNumInputs = 1; |
| 927 return LocationSummary::Make(zone, kNumInputs, Location::RequiresRegister(), | 881 return LocationSummary::Make(zone, kNumInputs, Location::RequiresRegister(), |
| 928 LocationSummary::kNoCall); | 882 LocationSummary::kNoCall); |
| 929 } | 883 } |
| 930 | 884 |
| 931 | |
| 932 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 885 void StringToCharCodeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 933 ASSERT(cid_ == kOneByteStringCid); | 886 ASSERT(cid_ == kOneByteStringCid); |
| 934 const Register str = locs()->in(0).reg(); | 887 const Register str = locs()->in(0).reg(); |
| 935 const Register result = locs()->out(0).reg(); | 888 const Register result = locs()->out(0).reg(); |
| 936 __ ldr(result, FieldAddress(str, String::length_offset())); | 889 __ ldr(result, FieldAddress(str, String::length_offset())); |
| 937 __ cmp(result, Operand(Smi::RawValue(1))); | 890 __ cmp(result, Operand(Smi::RawValue(1))); |
| 938 __ LoadImmediate(result, -1, NE); | 891 __ LoadImmediate(result, -1, NE); |
| 939 __ ldrb(result, FieldAddress(str, OneByteString::data_offset()), EQ); | 892 __ ldrb(result, FieldAddress(str, OneByteString::data_offset()), EQ); |
| 940 __ SmiTag(result); | 893 __ SmiTag(result); |
| 941 } | 894 } |
| 942 | 895 |
| 943 | |
| 944 LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone, | 896 LocationSummary* StringInterpolateInstr::MakeLocationSummary(Zone* zone, |
| 945 bool opt) const { | 897 bool opt) const { |
| 946 const intptr_t kNumInputs = 1; | 898 const intptr_t kNumInputs = 1; |
| 947 const intptr_t kNumTemps = 0; | 899 const intptr_t kNumTemps = 0; |
| 948 LocationSummary* summary = new (zone) | 900 LocationSummary* summary = new (zone) |
| 949 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 901 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 950 summary->set_in(0, Location::RegisterLocation(R0)); | 902 summary->set_in(0, Location::RegisterLocation(R0)); |
| 951 summary->set_out(0, Location::RegisterLocation(R0)); | 903 summary->set_out(0, Location::RegisterLocation(R0)); |
| 952 return summary; | 904 return summary; |
| 953 } | 905 } |
| 954 | 906 |
| 955 | |
| 956 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 907 void StringInterpolateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 957 const Register array = locs()->in(0).reg(); | 908 const Register array = locs()->in(0).reg(); |
| 958 __ Push(array); | 909 __ Push(array); |
| 959 const int kTypeArgsLen = 0; | 910 const int kTypeArgsLen = 0; |
| 960 const int kNumberOfArguments = 1; | 911 const int kNumberOfArguments = 1; |
| 961 const Array& kNoArgumentNames = Object::null_array(); | 912 const Array& kNoArgumentNames = Object::null_array(); |
| 962 ArgumentsInfo args_info(kTypeArgsLen, kNumberOfArguments, kNoArgumentNames); | 913 ArgumentsInfo args_info(kTypeArgsLen, kNumberOfArguments, kNoArgumentNames); |
| 963 compiler->GenerateStaticCall(deopt_id(), token_pos(), CallFunction(), | 914 compiler->GenerateStaticCall(deopt_id(), token_pos(), CallFunction(), |
| 964 args_info, locs(), ICData::Handle()); | 915 args_info, locs(), ICData::Handle()); |
| 965 ASSERT(locs()->out(0).reg() == R0); | 916 ASSERT(locs()->out(0).reg() == R0); |
| 966 } | 917 } |
| 967 | 918 |
| 968 | |
| 969 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, | 919 LocationSummary* LoadUntaggedInstr::MakeLocationSummary(Zone* zone, |
| 970 bool opt) const { | 920 bool opt) const { |
| 971 const intptr_t kNumInputs = 1; | 921 const intptr_t kNumInputs = 1; |
| 972 return LocationSummary::Make(zone, kNumInputs, Location::RequiresRegister(), | 922 return LocationSummary::Make(zone, kNumInputs, Location::RequiresRegister(), |
| 973 LocationSummary::kNoCall); | 923 LocationSummary::kNoCall); |
| 974 } | 924 } |
| 975 | 925 |
| 976 | |
| 977 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 926 void LoadUntaggedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 978 const Register obj = locs()->in(0).reg(); | 927 const Register obj = locs()->in(0).reg(); |
| 979 const Register result = locs()->out(0).reg(); | 928 const Register result = locs()->out(0).reg(); |
| 980 if (object()->definition()->representation() == kUntagged) { | 929 if (object()->definition()->representation() == kUntagged) { |
| 981 __ LoadFromOffset(kWord, result, obj, offset()); | 930 __ LoadFromOffset(kWord, result, obj, offset()); |
| 982 } else { | 931 } else { |
| 983 ASSERT(object()->definition()->representation() == kTagged); | 932 ASSERT(object()->definition()->representation() == kTagged); |
| 984 __ LoadFieldFromOffset(kWord, result, obj, offset()); | 933 __ LoadFieldFromOffset(kWord, result, obj, offset()); |
| 985 } | 934 } |
| 986 } | 935 } |
| 987 | 936 |
| 988 | |
| 989 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone, | 937 LocationSummary* LoadClassIdInstr::MakeLocationSummary(Zone* zone, |
| 990 bool opt) const { | 938 bool opt) const { |
| 991 const intptr_t kNumInputs = 1; | 939 const intptr_t kNumInputs = 1; |
| 992 return LocationSummary::Make(zone, kNumInputs, Location::RequiresRegister(), | 940 return LocationSummary::Make(zone, kNumInputs, Location::RequiresRegister(), |
| 993 LocationSummary::kNoCall); | 941 LocationSummary::kNoCall); |
| 994 } | 942 } |
| 995 | 943 |
| 996 | |
| 997 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 944 void LoadClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 998 const Register object = locs()->in(0).reg(); | 945 const Register object = locs()->in(0).reg(); |
| 999 const Register result = locs()->out(0).reg(); | 946 const Register result = locs()->out(0).reg(); |
| 1000 const AbstractType& value_type = *this->object()->Type()->ToAbstractType(); | 947 const AbstractType& value_type = *this->object()->Type()->ToAbstractType(); |
| 1001 if (CompileType::Smi().IsAssignableTo(value_type) || | 948 if (CompileType::Smi().IsAssignableTo(value_type) || |
| 1002 value_type.IsTypeParameter()) { | 949 value_type.IsTypeParameter()) { |
| 1003 __ LoadTaggedClassIdMayBeSmi(result, object); | 950 __ LoadTaggedClassIdMayBeSmi(result, object); |
| 1004 } else { | 951 } else { |
| 1005 __ LoadClassId(result, object); | 952 __ LoadClassId(result, object); |
| 1006 __ SmiTag(result); | 953 __ SmiTag(result); |
| 1007 } | 954 } |
| 1008 } | 955 } |
| 1009 | 956 |
| 1010 | |
| 1011 CompileType LoadIndexedInstr::ComputeType() const { | 957 CompileType LoadIndexedInstr::ComputeType() const { |
| 1012 switch (class_id_) { | 958 switch (class_id_) { |
| 1013 case kArrayCid: | 959 case kArrayCid: |
| 1014 case kImmutableArrayCid: | 960 case kImmutableArrayCid: |
| 1015 return CompileType::Dynamic(); | 961 return CompileType::Dynamic(); |
| 1016 | 962 |
| 1017 case kTypedDataFloat32ArrayCid: | 963 case kTypedDataFloat32ArrayCid: |
| 1018 case kTypedDataFloat64ArrayCid: | 964 case kTypedDataFloat64ArrayCid: |
| 1019 return CompileType::FromCid(kDoubleCid); | 965 return CompileType::FromCid(kDoubleCid); |
| 1020 case kTypedDataFloat32x4ArrayCid: | 966 case kTypedDataFloat32x4ArrayCid: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 1040 case kTypedDataInt32ArrayCid: | 986 case kTypedDataInt32ArrayCid: |
| 1041 case kTypedDataUint32ArrayCid: | 987 case kTypedDataUint32ArrayCid: |
| 1042 return CompileType::Int(); | 988 return CompileType::Int(); |
| 1043 | 989 |
| 1044 default: | 990 default: |
| 1045 UNREACHABLE(); | 991 UNREACHABLE(); |
| 1046 return CompileType::Dynamic(); | 992 return CompileType::Dynamic(); |
| 1047 } | 993 } |
| 1048 } | 994 } |
| 1049 | 995 |
| 1050 | |
| 1051 Representation LoadIndexedInstr::representation() const { | 996 Representation LoadIndexedInstr::representation() const { |
| 1052 switch (class_id_) { | 997 switch (class_id_) { |
| 1053 case kArrayCid: | 998 case kArrayCid: |
| 1054 case kImmutableArrayCid: | 999 case kImmutableArrayCid: |
| 1055 case kTypedDataInt8ArrayCid: | 1000 case kTypedDataInt8ArrayCid: |
| 1056 case kTypedDataUint8ArrayCid: | 1001 case kTypedDataUint8ArrayCid: |
| 1057 case kTypedDataUint8ClampedArrayCid: | 1002 case kTypedDataUint8ClampedArrayCid: |
| 1058 case kExternalTypedDataUint8ArrayCid: | 1003 case kExternalTypedDataUint8ArrayCid: |
| 1059 case kExternalTypedDataUint8ClampedArrayCid: | 1004 case kExternalTypedDataUint8ClampedArrayCid: |
| 1060 case kTypedDataInt16ArrayCid: | 1005 case kTypedDataInt16ArrayCid: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1076 case kTypedDataFloat32x4ArrayCid: | 1021 case kTypedDataFloat32x4ArrayCid: |
| 1077 return kUnboxedFloat32x4; | 1022 return kUnboxedFloat32x4; |
| 1078 case kTypedDataFloat64x2ArrayCid: | 1023 case kTypedDataFloat64x2ArrayCid: |
| 1079 return kUnboxedFloat64x2; | 1024 return kUnboxedFloat64x2; |
| 1080 default: | 1025 default: |
| 1081 UNREACHABLE(); | 1026 UNREACHABLE(); |
| 1082 return kTagged; | 1027 return kTagged; |
| 1083 } | 1028 } |
| 1084 } | 1029 } |
| 1085 | 1030 |
| 1086 | |
| 1087 static bool CanBeImmediateIndex(Value* value, | 1031 static bool CanBeImmediateIndex(Value* value, |
| 1088 intptr_t cid, | 1032 intptr_t cid, |
| 1089 bool is_external, | 1033 bool is_external, |
| 1090 bool is_load, | 1034 bool is_load, |
| 1091 bool* needs_base) { | 1035 bool* needs_base) { |
| 1092 if ((cid == kTypedDataInt32x4ArrayCid) || | 1036 if ((cid == kTypedDataInt32x4ArrayCid) || |
| 1093 (cid == kTypedDataFloat32x4ArrayCid) || | 1037 (cid == kTypedDataFloat32x4ArrayCid) || |
| 1094 (cid == kTypedDataFloat64x2ArrayCid)) { | 1038 (cid == kTypedDataFloat64x2ArrayCid)) { |
| 1095 // We are using vldmd/vstmd which do not support offset. | 1039 // We are using vldmd/vstmd which do not support offset. |
| 1096 return false; | 1040 return false; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1114 } | 1058 } |
| 1115 | 1059 |
| 1116 if (Address::CanHoldImmediateOffset(is_load, cid, offset - base_offset)) { | 1060 if (Address::CanHoldImmediateOffset(is_load, cid, offset - base_offset)) { |
| 1117 *needs_base = true; | 1061 *needs_base = true; |
| 1118 return true; | 1062 return true; |
| 1119 } | 1063 } |
| 1120 | 1064 |
| 1121 return false; | 1065 return false; |
| 1122 } | 1066 } |
| 1123 | 1067 |
| 1124 | |
| 1125 LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone, | 1068 LocationSummary* LoadIndexedInstr::MakeLocationSummary(Zone* zone, |
| 1126 bool opt) const { | 1069 bool opt) const { |
| 1127 const intptr_t kNumInputs = 2; | 1070 const intptr_t kNumInputs = 2; |
| 1128 intptr_t kNumTemps = 0; | 1071 intptr_t kNumTemps = 0; |
| 1129 if (!aligned()) { | 1072 if (!aligned()) { |
| 1130 kNumTemps += 1; | 1073 kNumTemps += 1; |
| 1131 if (representation() == kUnboxedDouble) { | 1074 if (representation() == kUnboxedDouble) { |
| 1132 kNumTemps += 1; | 1075 kNumTemps += 1; |
| 1133 } | 1076 } |
| 1134 } | 1077 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 } | 1111 } |
| 1169 if (!aligned()) { | 1112 if (!aligned()) { |
| 1170 locs->set_temp(0, Location::RequiresRegister()); | 1113 locs->set_temp(0, Location::RequiresRegister()); |
| 1171 if (representation() == kUnboxedDouble) { | 1114 if (representation() == kUnboxedDouble) { |
| 1172 locs->set_temp(1, Location::RequiresRegister()); | 1115 locs->set_temp(1, Location::RequiresRegister()); |
| 1173 } | 1116 } |
| 1174 } | 1117 } |
| 1175 return locs; | 1118 return locs; |
| 1176 } | 1119 } |
| 1177 | 1120 |
| 1178 | |
| 1179 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1121 void LoadIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1180 // The array register points to the backing store for external arrays. | 1122 // The array register points to the backing store for external arrays. |
| 1181 const Register array = locs()->in(0).reg(); | 1123 const Register array = locs()->in(0).reg(); |
| 1182 const Location index = locs()->in(1); | 1124 const Location index = locs()->in(1); |
| 1183 const Register address = aligned() ? kNoRegister : locs()->temp(0).reg(); | 1125 const Register address = aligned() ? kNoRegister : locs()->temp(0).reg(); |
| 1184 | 1126 |
| 1185 Address element_address(kNoRegister); | 1127 Address element_address(kNoRegister); |
| 1186 if (aligned()) { | 1128 if (aligned()) { |
| 1187 element_address = index.IsRegister() | 1129 element_address = index.IsRegister() |
| 1188 ? __ ElementAddressForRegIndex( | 1130 ? __ ElementAddressForRegIndex( |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1319 } | 1261 } |
| 1320 __ SmiTag(result); | 1262 __ SmiTag(result); |
| 1321 break; | 1263 break; |
| 1322 default: | 1264 default: |
| 1323 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); | 1265 ASSERT((class_id() == kArrayCid) || (class_id() == kImmutableArrayCid)); |
| 1324 __ ldr(result, element_address); | 1266 __ ldr(result, element_address); |
| 1325 break; | 1267 break; |
| 1326 } | 1268 } |
| 1327 } | 1269 } |
| 1328 | 1270 |
| 1329 | |
| 1330 Representation StoreIndexedInstr::RequiredInputRepresentation( | 1271 Representation StoreIndexedInstr::RequiredInputRepresentation( |
| 1331 intptr_t idx) const { | 1272 intptr_t idx) const { |
| 1332 // Array can be a Dart object or a pointer to external data. | 1273 // Array can be a Dart object or a pointer to external data. |
| 1333 if (idx == 0) return kNoRepresentation; // Flexible input representation. | 1274 if (idx == 0) return kNoRepresentation; // Flexible input representation. |
| 1334 if (idx == 1) return kTagged; // Index is a smi. | 1275 if (idx == 1) return kTagged; // Index is a smi. |
| 1335 ASSERT(idx == 2); | 1276 ASSERT(idx == 2); |
| 1336 switch (class_id_) { | 1277 switch (class_id_) { |
| 1337 case kArrayCid: | 1278 case kArrayCid: |
| 1338 case kOneByteStringCid: | 1279 case kOneByteStringCid: |
| 1339 case kTypedDataInt8ArrayCid: | 1280 case kTypedDataInt8ArrayCid: |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1356 case kTypedDataInt32x4ArrayCid: | 1297 case kTypedDataInt32x4ArrayCid: |
| 1357 return kUnboxedInt32x4; | 1298 return kUnboxedInt32x4; |
| 1358 case kTypedDataFloat64x2ArrayCid: | 1299 case kTypedDataFloat64x2ArrayCid: |
| 1359 return kUnboxedFloat64x2; | 1300 return kUnboxedFloat64x2; |
| 1360 default: | 1301 default: |
| 1361 UNREACHABLE(); | 1302 UNREACHABLE(); |
| 1362 return kTagged; | 1303 return kTagged; |
| 1363 } | 1304 } |
| 1364 } | 1305 } |
| 1365 | 1306 |
| 1366 | |
| 1367 LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone, | 1307 LocationSummary* StoreIndexedInstr::MakeLocationSummary(Zone* zone, |
| 1368 bool opt) const { | 1308 bool opt) const { |
| 1369 const intptr_t kNumInputs = 3; | 1309 const intptr_t kNumInputs = 3; |
| 1370 LocationSummary* locs; | 1310 LocationSummary* locs; |
| 1371 | 1311 |
| 1372 bool needs_base = false; | 1312 bool needs_base = false; |
| 1373 intptr_t kNumTemps = 0; | 1313 intptr_t kNumTemps = 0; |
| 1374 if (CanBeImmediateIndex(index(), class_id(), IsExternal(), | 1314 if (CanBeImmediateIndex(index(), class_id(), IsExternal(), |
| 1375 false, // Store. | 1315 false, // Store. |
| 1376 &needs_base)) { | 1316 &needs_base)) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1428 case kTypedDataFloat64x2ArrayCid: | 1368 case kTypedDataFloat64x2ArrayCid: |
| 1429 locs->set_in(2, Location::RequiresFpuRegister()); | 1369 locs->set_in(2, Location::RequiresFpuRegister()); |
| 1430 break; | 1370 break; |
| 1431 default: | 1371 default: |
| 1432 UNREACHABLE(); | 1372 UNREACHABLE(); |
| 1433 return NULL; | 1373 return NULL; |
| 1434 } | 1374 } |
| 1435 return locs; | 1375 return locs; |
| 1436 } | 1376 } |
| 1437 | 1377 |
| 1438 | |
| 1439 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1378 void StoreIndexedInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1440 // The array register points to the backing store for external arrays. | 1379 // The array register points to the backing store for external arrays. |
| 1441 const Register array = locs()->in(0).reg(); | 1380 const Register array = locs()->in(0).reg(); |
| 1442 const Location index = locs()->in(1); | 1381 const Location index = locs()->in(1); |
| 1443 const Register temp = | 1382 const Register temp = |
| 1444 (locs()->temp_count() > 0) ? locs()->temp(0).reg() : kNoRegister; | 1383 (locs()->temp_count() > 0) ? locs()->temp(0).reg() : kNoRegister; |
| 1445 const Register temp2 = | 1384 const Register temp2 = |
| 1446 (locs()->temp_count() > 1) ? locs()->temp(1).reg() : kNoRegister; | 1385 (locs()->temp_count() > 1) ? locs()->temp(1).reg() : kNoRegister; |
| 1447 | 1386 |
| 1448 Address element_address(kNoRegister); | 1387 Address element_address(kNoRegister); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1580 ASSERT(aligned()); | 1519 ASSERT(aligned()); |
| 1581 const DRegister value_reg = EvenDRegisterOf(locs()->in(2).fpu_reg()); | 1520 const DRegister value_reg = EvenDRegisterOf(locs()->in(2).fpu_reg()); |
| 1582 __ vstmd(IA, index.reg(), value_reg, 2); | 1521 __ vstmd(IA, index.reg(), value_reg, 2); |
| 1583 break; | 1522 break; |
| 1584 } | 1523 } |
| 1585 default: | 1524 default: |
| 1586 UNREACHABLE(); | 1525 UNREACHABLE(); |
| 1587 } | 1526 } |
| 1588 } | 1527 } |
| 1589 | 1528 |
| 1590 | |
| 1591 LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone, | 1529 LocationSummary* GuardFieldClassInstr::MakeLocationSummary(Zone* zone, |
| 1592 bool opt) const { | 1530 bool opt) const { |
| 1593 const intptr_t kNumInputs = 1; | 1531 const intptr_t kNumInputs = 1; |
| 1594 | 1532 |
| 1595 const intptr_t value_cid = value()->Type()->ToCid(); | 1533 const intptr_t value_cid = value()->Type()->ToCid(); |
| 1596 const intptr_t field_cid = field().guarded_cid(); | 1534 const intptr_t field_cid = field().guarded_cid(); |
| 1597 | 1535 |
| 1598 const bool emit_full_guard = !opt || (field_cid == kIllegalCid); | 1536 const bool emit_full_guard = !opt || (field_cid == kIllegalCid); |
| 1599 | 1537 |
| 1600 const bool needs_value_cid_temp_reg = | 1538 const bool needs_value_cid_temp_reg = |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1614 LocationSummary(zone, kNumInputs, num_temps, LocationSummary::kNoCall); | 1552 LocationSummary(zone, kNumInputs, num_temps, LocationSummary::kNoCall); |
| 1615 summary->set_in(0, Location::RequiresRegister()); | 1553 summary->set_in(0, Location::RequiresRegister()); |
| 1616 | 1554 |
| 1617 for (intptr_t i = 0; i < num_temps; i++) { | 1555 for (intptr_t i = 0; i < num_temps; i++) { |
| 1618 summary->set_temp(i, Location::RequiresRegister()); | 1556 summary->set_temp(i, Location::RequiresRegister()); |
| 1619 } | 1557 } |
| 1620 | 1558 |
| 1621 return summary; | 1559 return summary; |
| 1622 } | 1560 } |
| 1623 | 1561 |
| 1624 | |
| 1625 void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1562 void GuardFieldClassInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1626 ASSERT(sizeof(classid_t) == kInt16Size); | 1563 ASSERT(sizeof(classid_t) == kInt16Size); |
| 1627 | 1564 |
| 1628 const intptr_t value_cid = value()->Type()->ToCid(); | 1565 const intptr_t value_cid = value()->Type()->ToCid(); |
| 1629 const intptr_t field_cid = field().guarded_cid(); | 1566 const intptr_t field_cid = field().guarded_cid(); |
| 1630 const intptr_t nullability = field().is_nullable() ? kNullCid : kIllegalCid; | 1567 const intptr_t nullability = field().is_nullable() ? kNullCid : kIllegalCid; |
| 1631 | 1568 |
| 1632 if (field_cid == kDynamicCid) { | 1569 if (field_cid == kDynamicCid) { |
| 1633 if (Compiler::IsBackgroundCompilation()) { | 1570 if (Compiler::IsBackgroundCompilation()) { |
| 1634 // Field state changed while compiling. | 1571 // Field state changed while compiling. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 __ b(fail, NE); | 1693 __ b(fail, NE); |
| 1757 } else { | 1694 } else { |
| 1758 // Both value's and field's class id is known. | 1695 // Both value's and field's class id is known. |
| 1759 ASSERT((value_cid != field_cid) && (value_cid != nullability)); | 1696 ASSERT((value_cid != field_cid) && (value_cid != nullability)); |
| 1760 __ b(fail); | 1697 __ b(fail); |
| 1761 } | 1698 } |
| 1762 } | 1699 } |
| 1763 __ Bind(&ok); | 1700 __ Bind(&ok); |
| 1764 } | 1701 } |
| 1765 | 1702 |
| 1766 | |
| 1767 LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone, | 1703 LocationSummary* GuardFieldLengthInstr::MakeLocationSummary(Zone* zone, |
| 1768 bool opt) const { | 1704 bool opt) const { |
| 1769 const intptr_t kNumInputs = 1; | 1705 const intptr_t kNumInputs = 1; |
| 1770 if (!opt || (field().guarded_list_length() == Field::kUnknownFixedLength)) { | 1706 if (!opt || (field().guarded_list_length() == Field::kUnknownFixedLength)) { |
| 1771 const intptr_t kNumTemps = 3; | 1707 const intptr_t kNumTemps = 3; |
| 1772 LocationSummary* summary = new (zone) | 1708 LocationSummary* summary = new (zone) |
| 1773 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1709 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1774 summary->set_in(0, Location::RequiresRegister()); | 1710 summary->set_in(0, Location::RequiresRegister()); |
| 1775 // We need temporaries for field object, length offset and expected length. | 1711 // We need temporaries for field object, length offset and expected length. |
| 1776 summary->set_temp(0, Location::RequiresRegister()); | 1712 summary->set_temp(0, Location::RequiresRegister()); |
| 1777 summary->set_temp(1, Location::RequiresRegister()); | 1713 summary->set_temp(1, Location::RequiresRegister()); |
| 1778 summary->set_temp(2, Location::RequiresRegister()); | 1714 summary->set_temp(2, Location::RequiresRegister()); |
| 1779 return summary; | 1715 return summary; |
| 1780 } else { | 1716 } else { |
| 1781 // TODO(vegorov): can use TMP when length is small enough to fit into | 1717 // TODO(vegorov): can use TMP when length is small enough to fit into |
| 1782 // immediate. | 1718 // immediate. |
| 1783 const intptr_t kNumTemps = 1; | 1719 const intptr_t kNumTemps = 1; |
| 1784 LocationSummary* summary = new (zone) | 1720 LocationSummary* summary = new (zone) |
| 1785 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 1721 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 1786 summary->set_in(0, Location::RequiresRegister()); | 1722 summary->set_in(0, Location::RequiresRegister()); |
| 1787 summary->set_temp(0, Location::RequiresRegister()); | 1723 summary->set_temp(0, Location::RequiresRegister()); |
| 1788 return summary; | 1724 return summary; |
| 1789 } | 1725 } |
| 1790 UNREACHABLE(); | 1726 UNREACHABLE(); |
| 1791 } | 1727 } |
| 1792 | 1728 |
| 1793 | |
| 1794 void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1729 void GuardFieldLengthInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1795 if (field().guarded_list_length() == Field::kNoFixedLength) { | 1730 if (field().guarded_list_length() == Field::kNoFixedLength) { |
| 1796 if (Compiler::IsBackgroundCompilation()) { | 1731 if (Compiler::IsBackgroundCompilation()) { |
| 1797 // Field state changed while compiling. | 1732 // Field state changed while compiling. |
| 1798 Compiler::AbortBackgroundCompilation( | 1733 Compiler::AbortBackgroundCompilation( |
| 1799 deopt_id(), | 1734 deopt_id(), |
| 1800 "GuardFieldLengthInstr: field state changed while compiling"); | 1735 "GuardFieldLengthInstr: field state changed while compiling"); |
| 1801 } | 1736 } |
| 1802 ASSERT(!compiler->is_optimizing()); | 1737 ASSERT(!compiler->is_optimizing()); |
| 1803 return; // Nothing to emit. | 1738 return; // Nothing to emit. |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 | 1794 |
| 1860 __ ldr(length_reg, | 1795 __ ldr(length_reg, |
| 1861 FieldAddress(value_reg, | 1796 FieldAddress(value_reg, |
| 1862 field().guarded_list_length_in_object_offset())); | 1797 field().guarded_list_length_in_object_offset())); |
| 1863 __ CompareImmediate(length_reg, | 1798 __ CompareImmediate(length_reg, |
| 1864 Smi::RawValue(field().guarded_list_length())); | 1799 Smi::RawValue(field().guarded_list_length())); |
| 1865 __ b(deopt, NE); | 1800 __ b(deopt, NE); |
| 1866 } | 1801 } |
| 1867 } | 1802 } |
| 1868 | 1803 |
| 1869 | |
| 1870 class BoxAllocationSlowPath : public SlowPathCode { | 1804 class BoxAllocationSlowPath : public SlowPathCode { |
| 1871 public: | 1805 public: |
| 1872 BoxAllocationSlowPath(Instruction* instruction, | 1806 BoxAllocationSlowPath(Instruction* instruction, |
| 1873 const Class& cls, | 1807 const Class& cls, |
| 1874 Register result) | 1808 Register result) |
| 1875 : instruction_(instruction), cls_(cls), result_(result) {} | 1809 : instruction_(instruction), cls_(cls), result_(result) {} |
| 1876 | 1810 |
| 1877 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 1811 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1878 if (Assembler::EmittingComments()) { | 1812 if (Assembler::EmittingComments()) { |
| 1879 __ Comment("%s slow path allocation of %s", instruction_->DebugName(), | 1813 __ Comment("%s slow path allocation of %s", instruction_->DebugName(), |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1913 __ Bind(slow_path->exit_label()); | 1847 __ Bind(slow_path->exit_label()); |
| 1914 } | 1848 } |
| 1915 } | 1849 } |
| 1916 | 1850 |
| 1917 private: | 1851 private: |
| 1918 Instruction* instruction_; | 1852 Instruction* instruction_; |
| 1919 const Class& cls_; | 1853 const Class& cls_; |
| 1920 const Register result_; | 1854 const Register result_; |
| 1921 }; | 1855 }; |
| 1922 | 1856 |
| 1923 | |
| 1924 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone, | 1857 LocationSummary* LoadCodeUnitsInstr::MakeLocationSummary(Zone* zone, |
| 1925 bool opt) const { | 1858 bool opt) const { |
| 1926 const bool might_box = (representation() == kTagged) && !can_pack_into_smi(); | 1859 const bool might_box = (representation() == kTagged) && !can_pack_into_smi(); |
| 1927 const intptr_t kNumInputs = 2; | 1860 const intptr_t kNumInputs = 2; |
| 1928 const intptr_t kNumTemps = might_box ? 1 : 0; | 1861 const intptr_t kNumTemps = might_box ? 1 : 0; |
| 1929 LocationSummary* summary = new (zone) LocationSummary( | 1862 LocationSummary* summary = new (zone) LocationSummary( |
| 1930 zone, kNumInputs, kNumTemps, | 1863 zone, kNumInputs, kNumTemps, |
| 1931 might_box ? LocationSummary::kCallOnSlowPath : LocationSummary::kNoCall); | 1864 might_box ? LocationSummary::kCallOnSlowPath : LocationSummary::kNoCall); |
| 1932 summary->set_in(0, Location::RequiresRegister()); | 1865 summary->set_in(0, Location::RequiresRegister()); |
| 1933 summary->set_in(1, Location::RequiresRegister()); | 1866 summary->set_in(1, Location::RequiresRegister()); |
| 1934 | 1867 |
| 1935 if (might_box) { | 1868 if (might_box) { |
| 1936 summary->set_temp(0, Location::RequiresRegister()); | 1869 summary->set_temp(0, Location::RequiresRegister()); |
| 1937 } | 1870 } |
| 1938 | 1871 |
| 1939 if (representation() == kUnboxedMint) { | 1872 if (representation() == kUnboxedMint) { |
| 1940 summary->set_out(0, Location::Pair(Location::RequiresRegister(), | 1873 summary->set_out(0, Location::Pair(Location::RequiresRegister(), |
| 1941 Location::RequiresRegister())); | 1874 Location::RequiresRegister())); |
| 1942 } else { | 1875 } else { |
| 1943 ASSERT(representation() == kTagged); | 1876 ASSERT(representation() == kTagged); |
| 1944 summary->set_out(0, Location::RequiresRegister()); | 1877 summary->set_out(0, Location::RequiresRegister()); |
| 1945 } | 1878 } |
| 1946 | 1879 |
| 1947 return summary; | 1880 return summary; |
| 1948 } | 1881 } |
| 1949 | 1882 |
| 1950 | |
| 1951 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 1883 void LoadCodeUnitsInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 1952 // The string register points to the backing store for external strings. | 1884 // The string register points to the backing store for external strings. |
| 1953 const Register str = locs()->in(0).reg(); | 1885 const Register str = locs()->in(0).reg(); |
| 1954 const Location index = locs()->in(1); | 1886 const Location index = locs()->in(1); |
| 1955 | 1887 |
| 1956 Address element_address = __ ElementAddressForRegIndex( | 1888 Address element_address = __ ElementAddressForRegIndex( |
| 1957 true, IsExternal(), class_id(), index_scale(), str, index.reg()); | 1889 true, IsExternal(), class_id(), index_scale(), str, index.reg()); |
| 1958 // Warning: element_address may use register IP as base. | 1890 // Warning: element_address may use register IP as base. |
| 1959 | 1891 |
| 1960 if (representation() == kUnboxedMint) { | 1892 if (representation() == kUnboxedMint) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2037 __ eor(temp, temp, Operand(temp)); | 1969 __ eor(temp, temp, Operand(temp)); |
| 2038 __ StoreToOffset(kWord, value, result, | 1970 __ StoreToOffset(kWord, value, result, |
| 2039 Mint::value_offset() - kHeapObjectTag); | 1971 Mint::value_offset() - kHeapObjectTag); |
| 2040 __ StoreToOffset(kWord, temp, result, | 1972 __ StoreToOffset(kWord, temp, result, |
| 2041 Mint::value_offset() - kHeapObjectTag + kWordSize); | 1973 Mint::value_offset() - kHeapObjectTag + kWordSize); |
| 2042 __ Bind(&done); | 1974 __ Bind(&done); |
| 2043 } | 1975 } |
| 2044 } | 1976 } |
| 2045 } | 1977 } |
| 2046 | 1978 |
| 2047 | |
| 2048 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, | 1979 LocationSummary* StoreInstanceFieldInstr::MakeLocationSummary(Zone* zone, |
| 2049 bool opt) const { | 1980 bool opt) const { |
| 2050 const intptr_t kNumInputs = 2; | 1981 const intptr_t kNumInputs = 2; |
| 2051 const intptr_t kNumTemps = | 1982 const intptr_t kNumTemps = |
| 2052 (IsUnboxedStore() && opt) ? 2 : ((IsPotentialUnboxedStore()) ? 3 : 0); | 1983 (IsUnboxedStore() && opt) ? 2 : ((IsPotentialUnboxedStore()) ? 3 : 0); |
| 2053 LocationSummary* summary = new (zone) | 1984 LocationSummary* summary = new (zone) |
| 2054 LocationSummary(zone, kNumInputs, kNumTemps, | 1985 LocationSummary(zone, kNumInputs, kNumTemps, |
| 2055 ((IsUnboxedStore() && opt && is_initialization()) || | 1986 ((IsUnboxedStore() && opt && is_initialization()) || |
| 2056 IsPotentialUnboxedStore()) | 1987 IsPotentialUnboxedStore()) |
| 2057 ? LocationSummary::kCallOnSlowPath | 1988 ? LocationSummary::kCallOnSlowPath |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2070 summary->set_temp(2, opt ? Location::RequiresFpuRegister() | 2001 summary->set_temp(2, opt ? Location::RequiresFpuRegister() |
| 2071 : Location::FpuRegisterLocation(Q1)); | 2002 : Location::FpuRegisterLocation(Q1)); |
| 2072 } else { | 2003 } else { |
| 2073 summary->set_in(1, ShouldEmitStoreBarrier() | 2004 summary->set_in(1, ShouldEmitStoreBarrier() |
| 2074 ? Location::WritableRegister() | 2005 ? Location::WritableRegister() |
| 2075 : Location::RegisterOrConstant(value())); | 2006 : Location::RegisterOrConstant(value())); |
| 2076 } | 2007 } |
| 2077 return summary; | 2008 return summary; |
| 2078 } | 2009 } |
| 2079 | 2010 |
| 2080 | |
| 2081 static void EnsureMutableBox(FlowGraphCompiler* compiler, | 2011 static void EnsureMutableBox(FlowGraphCompiler* compiler, |
| 2082 StoreInstanceFieldInstr* instruction, | 2012 StoreInstanceFieldInstr* instruction, |
| 2083 Register box_reg, | 2013 Register box_reg, |
| 2084 const Class& cls, | 2014 const Class& cls, |
| 2085 Register instance_reg, | 2015 Register instance_reg, |
| 2086 intptr_t offset, | 2016 intptr_t offset, |
| 2087 Register temp) { | 2017 Register temp) { |
| 2088 Label done; | 2018 Label done; |
| 2089 __ ldr(box_reg, FieldAddress(instance_reg, offset)); | 2019 __ ldr(box_reg, FieldAddress(instance_reg, offset)); |
| 2090 __ CompareObject(box_reg, Object::null_object()); | 2020 __ CompareObject(box_reg, Object::null_object()); |
| 2091 __ b(&done, NE); | 2021 __ b(&done, NE); |
| 2092 | 2022 |
| 2093 BoxAllocationSlowPath::Allocate(compiler, instruction, cls, box_reg, temp); | 2023 BoxAllocationSlowPath::Allocate(compiler, instruction, cls, box_reg, temp); |
| 2094 | 2024 |
| 2095 __ MoveRegister(temp, box_reg); | 2025 __ MoveRegister(temp, box_reg); |
| 2096 __ StoreIntoObjectOffset(instance_reg, offset, temp); | 2026 __ StoreIntoObjectOffset(instance_reg, offset, temp); |
| 2097 __ Bind(&done); | 2027 __ Bind(&done); |
| 2098 } | 2028 } |
| 2099 | 2029 |
| 2100 | |
| 2101 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2030 void StoreInstanceFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2102 ASSERT(sizeof(classid_t) == kInt16Size); | 2031 ASSERT(sizeof(classid_t) == kInt16Size); |
| 2103 | 2032 |
| 2104 Label skip_store; | 2033 Label skip_store; |
| 2105 | 2034 |
| 2106 const Register instance_reg = locs()->in(0).reg(); | 2035 const Register instance_reg = locs()->in(0).reg(); |
| 2107 | 2036 |
| 2108 if (IsUnboxedStore() && compiler->is_optimizing()) { | 2037 if (IsUnboxedStore() && compiler->is_optimizing()) { |
| 2109 const DRegister value = EvenDRegisterOf(locs()->in(1).fpu_reg()); | 2038 const DRegister value = EvenDRegisterOf(locs()->in(1).fpu_reg()); |
| 2110 const Register temp = locs()->temp(0).reg(); | 2039 const Register temp = locs()->temp(0).reg(); |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2239 locs()->in(1).constant()); | 2168 locs()->in(1).constant()); |
| 2240 } else { | 2169 } else { |
| 2241 const Register value_reg = locs()->in(1).reg(); | 2170 const Register value_reg = locs()->in(1).reg(); |
| 2242 __ StoreIntoObjectNoBarrierOffset(instance_reg, offset_in_bytes_, | 2171 __ StoreIntoObjectNoBarrierOffset(instance_reg, offset_in_bytes_, |
| 2243 value_reg); | 2172 value_reg); |
| 2244 } | 2173 } |
| 2245 } | 2174 } |
| 2246 __ Bind(&skip_store); | 2175 __ Bind(&skip_store); |
| 2247 } | 2176 } |
| 2248 | 2177 |
| 2249 | |
| 2250 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, | 2178 LocationSummary* LoadStaticFieldInstr::MakeLocationSummary(Zone* zone, |
| 2251 bool opt) const { | 2179 bool opt) const { |
| 2252 const intptr_t kNumInputs = 1; | 2180 const intptr_t kNumInputs = 1; |
| 2253 const intptr_t kNumTemps = 0; | 2181 const intptr_t kNumTemps = 0; |
| 2254 LocationSummary* summary = new (zone) | 2182 LocationSummary* summary = new (zone) |
| 2255 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 2183 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 2256 summary->set_in(0, Location::RequiresRegister()); | 2184 summary->set_in(0, Location::RequiresRegister()); |
| 2257 summary->set_out(0, Location::RequiresRegister()); | 2185 summary->set_out(0, Location::RequiresRegister()); |
| 2258 return summary; | 2186 return summary; |
| 2259 } | 2187 } |
| 2260 | 2188 |
| 2261 | |
| 2262 // When the parser is building an implicit static getter for optimization, | 2189 // When the parser is building an implicit static getter for optimization, |
| 2263 // it can generate a function body where deoptimization ids do not line up | 2190 // it can generate a function body where deoptimization ids do not line up |
| 2264 // with the unoptimized code. | 2191 // with the unoptimized code. |
| 2265 // | 2192 // |
| 2266 // This is safe only so long as LoadStaticFieldInstr cannot deoptimize. | 2193 // This is safe only so long as LoadStaticFieldInstr cannot deoptimize. |
| 2267 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2194 void LoadStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2268 const Register field = locs()->in(0).reg(); | 2195 const Register field = locs()->in(0).reg(); |
| 2269 const Register result = locs()->out(0).reg(); | 2196 const Register result = locs()->out(0).reg(); |
| 2270 __ LoadFieldFromOffset(kWord, result, field, Field::static_value_offset()); | 2197 __ LoadFieldFromOffset(kWord, result, field, Field::static_value_offset()); |
| 2271 } | 2198 } |
| 2272 | 2199 |
| 2273 | |
| 2274 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, | 2200 LocationSummary* StoreStaticFieldInstr::MakeLocationSummary(Zone* zone, |
| 2275 bool opt) const { | 2201 bool opt) const { |
| 2276 LocationSummary* locs = | 2202 LocationSummary* locs = |
| 2277 new (zone) LocationSummary(zone, 1, 1, LocationSummary::kNoCall); | 2203 new (zone) LocationSummary(zone, 1, 1, LocationSummary::kNoCall); |
| 2278 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister() | 2204 locs->set_in(0, value()->NeedsStoreBuffer() ? Location::WritableRegister() |
| 2279 : Location::RequiresRegister()); | 2205 : Location::RequiresRegister()); |
| 2280 locs->set_temp(0, Location::RequiresRegister()); | 2206 locs->set_temp(0, Location::RequiresRegister()); |
| 2281 return locs; | 2207 return locs; |
| 2282 } | 2208 } |
| 2283 | 2209 |
| 2284 | |
| 2285 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2210 void StoreStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2286 const Register value = locs()->in(0).reg(); | 2211 const Register value = locs()->in(0).reg(); |
| 2287 const Register temp = locs()->temp(0).reg(); | 2212 const Register temp = locs()->temp(0).reg(); |
| 2288 | 2213 |
| 2289 __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); | 2214 __ LoadObject(temp, Field::ZoneHandle(Z, field().Original())); |
| 2290 if (this->value()->NeedsStoreBuffer()) { | 2215 if (this->value()->NeedsStoreBuffer()) { |
| 2291 __ StoreIntoObject(temp, FieldAddress(temp, Field::static_value_offset()), | 2216 __ StoreIntoObject(temp, FieldAddress(temp, Field::static_value_offset()), |
| 2292 value, CanValueBeSmi()); | 2217 value, CanValueBeSmi()); |
| 2293 } else { | 2218 } else { |
| 2294 __ StoreIntoObjectNoBarrier( | 2219 __ StoreIntoObjectNoBarrier( |
| 2295 temp, FieldAddress(temp, Field::static_value_offset()), value); | 2220 temp, FieldAddress(temp, Field::static_value_offset()), value); |
| 2296 } | 2221 } |
| 2297 } | 2222 } |
| 2298 | 2223 |
| 2299 | |
| 2300 LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, | 2224 LocationSummary* InstanceOfInstr::MakeLocationSummary(Zone* zone, |
| 2301 bool opt) const { | 2225 bool opt) const { |
| 2302 const intptr_t kNumInputs = 3; | 2226 const intptr_t kNumInputs = 3; |
| 2303 const intptr_t kNumTemps = 0; | 2227 const intptr_t kNumTemps = 0; |
| 2304 LocationSummary* summary = new (zone) | 2228 LocationSummary* summary = new (zone) |
| 2305 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 2229 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 2306 summary->set_in(0, Location::RegisterLocation(R0)); // Instance. | 2230 summary->set_in(0, Location::RegisterLocation(R0)); // Instance. |
| 2307 summary->set_in(1, Location::RegisterLocation(R2)); // Instant. type args. | 2231 summary->set_in(1, Location::RegisterLocation(R2)); // Instant. type args. |
| 2308 summary->set_in(2, Location::RegisterLocation(R1)); // Function type args. | 2232 summary->set_in(2, Location::RegisterLocation(R1)); // Function type args. |
| 2309 summary->set_out(0, Location::RegisterLocation(R0)); | 2233 summary->set_out(0, Location::RegisterLocation(R0)); |
| 2310 return summary; | 2234 return summary; |
| 2311 } | 2235 } |
| 2312 | 2236 |
| 2313 | |
| 2314 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2237 void InstanceOfInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2315 ASSERT(locs()->in(0).reg() == R0); // Value. | 2238 ASSERT(locs()->in(0).reg() == R0); // Value. |
| 2316 ASSERT(locs()->in(1).reg() == R2); // Instantiator type arguments. | 2239 ASSERT(locs()->in(1).reg() == R2); // Instantiator type arguments. |
| 2317 ASSERT(locs()->in(2).reg() == R1); // Function type arguments. | 2240 ASSERT(locs()->in(2).reg() == R1); // Function type arguments. |
| 2318 | 2241 |
| 2319 compiler->GenerateInstanceOf(token_pos(), deopt_id(), type(), locs()); | 2242 compiler->GenerateInstanceOf(token_pos(), deopt_id(), type(), locs()); |
| 2320 ASSERT(locs()->out(0).reg() == R0); | 2243 ASSERT(locs()->out(0).reg() == R0); |
| 2321 } | 2244 } |
| 2322 | 2245 |
| 2323 | |
| 2324 LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, | 2246 LocationSummary* CreateArrayInstr::MakeLocationSummary(Zone* zone, |
| 2325 bool opt) const { | 2247 bool opt) const { |
| 2326 const intptr_t kNumInputs = 2; | 2248 const intptr_t kNumInputs = 2; |
| 2327 const intptr_t kNumTemps = 0; | 2249 const intptr_t kNumTemps = 0; |
| 2328 LocationSummary* locs = new (zone) | 2250 LocationSummary* locs = new (zone) |
| 2329 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 2251 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 2330 locs->set_in(kElementTypePos, Location::RegisterLocation(R1)); | 2252 locs->set_in(kElementTypePos, Location::RegisterLocation(R1)); |
| 2331 locs->set_in(kLengthPos, Location::RegisterLocation(R2)); | 2253 locs->set_in(kLengthPos, Location::RegisterLocation(R2)); |
| 2332 locs->set_out(0, Location::RegisterLocation(R0)); | 2254 locs->set_out(0, Location::RegisterLocation(R0)); |
| 2333 return locs; | 2255 return locs; |
| 2334 } | 2256 } |
| 2335 | 2257 |
| 2336 | |
| 2337 // Inlines array allocation for known constant values. | 2258 // Inlines array allocation for known constant values. |
| 2338 static void InlineArrayAllocation(FlowGraphCompiler* compiler, | 2259 static void InlineArrayAllocation(FlowGraphCompiler* compiler, |
| 2339 intptr_t num_elements, | 2260 intptr_t num_elements, |
| 2340 Label* slow_path, | 2261 Label* slow_path, |
| 2341 Label* done) { | 2262 Label* done) { |
| 2342 const int kInlineArraySize = 12; // Same as kInlineInstanceSize. | 2263 const int kInlineArraySize = 12; // Same as kInlineInstanceSize. |
| 2343 const Register kLengthReg = R2; | 2264 const Register kLengthReg = R2; |
| 2344 const Register kElemTypeReg = R1; | 2265 const Register kElemTypeReg = R1; |
| 2345 const intptr_t instance_size = Array::InstanceSize(num_elements); | 2266 const intptr_t instance_size = Array::InstanceSize(num_elements); |
| 2346 | 2267 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 if (array_size < (kInlineArraySize * kWordSize)) { | 2301 if (array_size < (kInlineArraySize * kWordSize)) { |
| 2381 __ InitializeFieldsNoBarrierUnrolled(R0, R6, 0, num_elements * kWordSize, | 2302 __ InitializeFieldsNoBarrierUnrolled(R0, R6, 0, num_elements * kWordSize, |
| 2382 R8, R9); | 2303 R8, R9); |
| 2383 } else { | 2304 } else { |
| 2384 __ InitializeFieldsNoBarrier(R0, R6, R3, R8, R9); | 2305 __ InitializeFieldsNoBarrier(R0, R6, R3, R8, R9); |
| 2385 } | 2306 } |
| 2386 } | 2307 } |
| 2387 __ b(done); | 2308 __ b(done); |
| 2388 } | 2309 } |
| 2389 | 2310 |
| 2390 | |
| 2391 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2311 void CreateArrayInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2392 const Register kLengthReg = R2; | 2312 const Register kLengthReg = R2; |
| 2393 const Register kElemTypeReg = R1; | 2313 const Register kElemTypeReg = R1; |
| 2394 const Register kResultReg = R0; | 2314 const Register kResultReg = R0; |
| 2395 | 2315 |
| 2396 ASSERT(locs()->in(kElementTypePos).reg() == kElemTypeReg); | 2316 ASSERT(locs()->in(kElementTypePos).reg() == kElemTypeReg); |
| 2397 ASSERT(locs()->in(kLengthPos).reg() == kLengthReg); | 2317 ASSERT(locs()->in(kLengthPos).reg() == kLengthReg); |
| 2398 | 2318 |
| 2399 if (compiler->is_optimizing() && !FLAG_precompiled_mode && | 2319 if (compiler->is_optimizing() && !FLAG_precompiled_mode && |
| 2400 num_elements()->BindsToConstant() && | 2320 num_elements()->BindsToConstant() && |
| (...skipping 16 matching lines...) Expand all Loading... |
| 2417 } | 2337 } |
| 2418 const Code& stub = Code::ZoneHandle(compiler->zone(), | 2338 const Code& stub = Code::ZoneHandle(compiler->zone(), |
| 2419 StubCode::AllocateArray_entry()->code()); | 2339 StubCode::AllocateArray_entry()->code()); |
| 2420 compiler->AddStubCallTarget(stub); | 2340 compiler->AddStubCallTarget(stub); |
| 2421 compiler->GenerateCallWithDeopt(token_pos(), deopt_id(), | 2341 compiler->GenerateCallWithDeopt(token_pos(), deopt_id(), |
| 2422 *StubCode::AllocateArray_entry(), | 2342 *StubCode::AllocateArray_entry(), |
| 2423 RawPcDescriptors::kOther, locs()); | 2343 RawPcDescriptors::kOther, locs()); |
| 2424 ASSERT(locs()->out(0).reg() == kResultReg); | 2344 ASSERT(locs()->out(0).reg() == kResultReg); |
| 2425 } | 2345 } |
| 2426 | 2346 |
| 2427 | |
| 2428 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, | 2347 LocationSummary* LoadFieldInstr::MakeLocationSummary(Zone* zone, |
| 2429 bool opt) const { | 2348 bool opt) const { |
| 2430 const intptr_t kNumInputs = 1; | 2349 const intptr_t kNumInputs = 1; |
| 2431 const intptr_t kNumTemps = | 2350 const intptr_t kNumTemps = |
| 2432 (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 3 : 0); | 2351 (IsUnboxedLoad() && opt) ? 1 : ((IsPotentialUnboxedLoad()) ? 3 : 0); |
| 2433 | 2352 |
| 2434 LocationSummary* locs = new (zone) LocationSummary( | 2353 LocationSummary* locs = new (zone) LocationSummary( |
| 2435 zone, kNumInputs, kNumTemps, (opt && !IsPotentialUnboxedLoad()) | 2354 zone, kNumInputs, kNumTemps, |
| 2436 ? LocationSummary::kNoCall | 2355 (opt && !IsPotentialUnboxedLoad()) ? LocationSummary::kNoCall |
| 2437 : LocationSummary::kCallOnSlowPath); | 2356 : LocationSummary::kCallOnSlowPath); |
| 2438 | 2357 |
| 2439 locs->set_in(0, Location::RequiresRegister()); | 2358 locs->set_in(0, Location::RequiresRegister()); |
| 2440 | 2359 |
| 2441 if (IsUnboxedLoad() && opt) { | 2360 if (IsUnboxedLoad() && opt) { |
| 2442 locs->set_temp(0, Location::RequiresRegister()); | 2361 locs->set_temp(0, Location::RequiresRegister()); |
| 2443 } else if (IsPotentialUnboxedLoad()) { | 2362 } else if (IsPotentialUnboxedLoad()) { |
| 2444 locs->set_temp(0, opt ? Location::RequiresFpuRegister() | 2363 locs->set_temp(0, opt ? Location::RequiresFpuRegister() |
| 2445 : Location::FpuRegisterLocation(Q1)); | 2364 : Location::FpuRegisterLocation(Q1)); |
| 2446 locs->set_temp(1, Location::RequiresRegister()); | 2365 locs->set_temp(1, Location::RequiresRegister()); |
| 2447 locs->set_temp(2, Location::RequiresRegister()); | 2366 locs->set_temp(2, Location::RequiresRegister()); |
| 2448 } | 2367 } |
| 2449 locs->set_out(0, Location::RequiresRegister()); | 2368 locs->set_out(0, Location::RequiresRegister()); |
| 2450 return locs; | 2369 return locs; |
| 2451 } | 2370 } |
| 2452 | 2371 |
| 2453 | |
| 2454 void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2372 void LoadFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2455 ASSERT(sizeof(classid_t) == kInt16Size); | 2373 ASSERT(sizeof(classid_t) == kInt16Size); |
| 2456 | 2374 |
| 2457 const Register instance_reg = locs()->in(0).reg(); | 2375 const Register instance_reg = locs()->in(0).reg(); |
| 2458 if (IsUnboxedLoad() && compiler->is_optimizing()) { | 2376 if (IsUnboxedLoad() && compiler->is_optimizing()) { |
| 2459 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 2377 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 2460 const Register temp = locs()->temp(0).reg(); | 2378 const Register temp = locs()->temp(0).reg(); |
| 2461 __ LoadFieldFromOffset(kWord, temp, instance_reg, offset_in_bytes()); | 2379 __ LoadFieldFromOffset(kWord, temp, instance_reg, offset_in_bytes()); |
| 2462 const intptr_t cid = field()->UnboxedFieldCid(); | 2380 const intptr_t cid = field()->UnboxedFieldCid(); |
| 2463 switch (cid) { | 2381 switch (cid) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2549 __ CopyFloat64x2Field(result_reg, temp, TMP, temp2, value); | 2467 __ CopyFloat64x2Field(result_reg, temp, TMP, temp2, value); |
| 2550 __ b(&done); | 2468 __ b(&done); |
| 2551 } | 2469 } |
| 2552 | 2470 |
| 2553 __ Bind(&load_pointer); | 2471 __ Bind(&load_pointer); |
| 2554 } | 2472 } |
| 2555 __ LoadFieldFromOffset(kWord, result_reg, instance_reg, offset_in_bytes()); | 2473 __ LoadFieldFromOffset(kWord, result_reg, instance_reg, offset_in_bytes()); |
| 2556 __ Bind(&done); | 2474 __ Bind(&done); |
| 2557 } | 2475 } |
| 2558 | 2476 |
| 2559 | |
| 2560 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, | 2477 LocationSummary* InstantiateTypeInstr::MakeLocationSummary(Zone* zone, |
| 2561 bool opt) const { | 2478 bool opt) const { |
| 2562 const intptr_t kNumInputs = 2; | 2479 const intptr_t kNumInputs = 2; |
| 2563 const intptr_t kNumTemps = 0; | 2480 const intptr_t kNumTemps = 0; |
| 2564 LocationSummary* locs = new (zone) | 2481 LocationSummary* locs = new (zone) |
| 2565 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 2482 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 2566 locs->set_in(0, Location::RegisterLocation(R1)); // Instant. type args. | 2483 locs->set_in(0, Location::RegisterLocation(R1)); // Instant. type args. |
| 2567 locs->set_in(1, Location::RegisterLocation(R0)); // Function type args. | 2484 locs->set_in(1, Location::RegisterLocation(R0)); // Function type args. |
| 2568 locs->set_out(0, Location::RegisterLocation(R0)); | 2485 locs->set_out(0, Location::RegisterLocation(R0)); |
| 2569 return locs; | 2486 return locs; |
| 2570 } | 2487 } |
| 2571 | 2488 |
| 2572 | |
| 2573 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2489 void InstantiateTypeInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2574 const Register instantiator_type_args_reg = locs()->in(0).reg(); | 2490 const Register instantiator_type_args_reg = locs()->in(0).reg(); |
| 2575 const Register function_type_args_reg = locs()->in(1).reg(); | 2491 const Register function_type_args_reg = locs()->in(1).reg(); |
| 2576 const Register result_reg = locs()->out(0).reg(); | 2492 const Register result_reg = locs()->out(0).reg(); |
| 2577 | 2493 |
| 2578 // 'instantiator_type_args_reg' is a TypeArguments object (or null). | 2494 // 'instantiator_type_args_reg' is a TypeArguments object (or null). |
| 2579 // 'function_type_args_reg' is a TypeArguments object (or null). | 2495 // 'function_type_args_reg' is a TypeArguments object (or null). |
| 2580 // A runtime call to instantiate the type is required. | 2496 // A runtime call to instantiate the type is required. |
| 2581 __ PushObject(Object::null_object()); // Make room for the result. | 2497 __ PushObject(Object::null_object()); // Make room for the result. |
| 2582 __ PushObject(type()); | 2498 __ PushObject(type()); |
| 2583 __ PushList((1 << instantiator_type_args_reg) | | 2499 __ PushList((1 << instantiator_type_args_reg) | |
| 2584 (1 << function_type_args_reg)); | 2500 (1 << function_type_args_reg)); |
| 2585 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), | 2501 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), |
| 2586 kInstantiateTypeRuntimeEntry, 3, locs()); | 2502 kInstantiateTypeRuntimeEntry, 3, locs()); |
| 2587 __ Drop(3); // Drop 2 type argument vectors and uninstantiated type. | 2503 __ Drop(3); // Drop 2 type argument vectors and uninstantiated type. |
| 2588 __ Pop(result_reg); // Pop instantiated type. | 2504 __ Pop(result_reg); // Pop instantiated type. |
| 2589 } | 2505 } |
| 2590 | 2506 |
| 2591 | |
| 2592 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( | 2507 LocationSummary* InstantiateTypeArgumentsInstr::MakeLocationSummary( |
| 2593 Zone* zone, | 2508 Zone* zone, |
| 2594 bool opt) const { | 2509 bool opt) const { |
| 2595 const intptr_t kNumInputs = 2; | 2510 const intptr_t kNumInputs = 2; |
| 2596 const intptr_t kNumTemps = 0; | 2511 const intptr_t kNumTemps = 0; |
| 2597 LocationSummary* locs = new (zone) | 2512 LocationSummary* locs = new (zone) |
| 2598 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 2513 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 2599 locs->set_in(0, Location::RegisterLocation(R1)); // Instant. type args. | 2514 locs->set_in(0, Location::RegisterLocation(R1)); // Instant. type args. |
| 2600 locs->set_in(1, Location::RegisterLocation(R0)); // Function type args. | 2515 locs->set_in(1, Location::RegisterLocation(R0)); // Function type args. |
| 2601 locs->set_out(0, Location::RegisterLocation(R0)); | 2516 locs->set_out(0, Location::RegisterLocation(R0)); |
| 2602 return locs; | 2517 return locs; |
| 2603 } | 2518 } |
| 2604 | 2519 |
| 2605 | |
| 2606 void InstantiateTypeArgumentsInstr::EmitNativeCode( | 2520 void InstantiateTypeArgumentsInstr::EmitNativeCode( |
| 2607 FlowGraphCompiler* compiler) { | 2521 FlowGraphCompiler* compiler) { |
| 2608 const Register instantiator_type_args_reg = locs()->in(0).reg(); | 2522 const Register instantiator_type_args_reg = locs()->in(0).reg(); |
| 2609 const Register function_type_args_reg = locs()->in(1).reg(); | 2523 const Register function_type_args_reg = locs()->in(1).reg(); |
| 2610 const Register result_reg = locs()->out(0).reg(); | 2524 const Register result_reg = locs()->out(0).reg(); |
| 2611 ASSERT(instantiator_type_args_reg == R1); | 2525 ASSERT(instantiator_type_args_reg == R1); |
| 2612 ASSERT(function_type_args_reg == R0); | 2526 ASSERT(function_type_args_reg == R0); |
| 2613 | 2527 |
| 2614 // 'instantiator_type_args_reg' is a TypeArguments object (or null). | 2528 // 'instantiator_type_args_reg' is a TypeArguments object (or null). |
| 2615 // 'function_type_args_reg' is a TypeArguments object (or null). | 2529 // 'function_type_args_reg' is a TypeArguments object (or null). |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2662 __ PushList((1 << instantiator_type_args_reg) | | 2576 __ PushList((1 << instantiator_type_args_reg) | |
| 2663 (1 << function_type_args_reg)); | 2577 (1 << function_type_args_reg)); |
| 2664 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), | 2578 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), |
| 2665 kInstantiateTypeArgumentsRuntimeEntry, 3, | 2579 kInstantiateTypeArgumentsRuntimeEntry, 3, |
| 2666 locs()); | 2580 locs()); |
| 2667 __ Drop(3); // Drop 2 type argument vectors and uninstantiated args. | 2581 __ Drop(3); // Drop 2 type argument vectors and uninstantiated args. |
| 2668 __ Pop(result_reg); // Pop instantiated type arguments. | 2582 __ Pop(result_reg); // Pop instantiated type arguments. |
| 2669 __ Bind(&type_arguments_instantiated); | 2583 __ Bind(&type_arguments_instantiated); |
| 2670 } | 2584 } |
| 2671 | 2585 |
| 2672 | |
| 2673 LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( | 2586 LocationSummary* AllocateUninitializedContextInstr::MakeLocationSummary( |
| 2674 Zone* zone, | 2587 Zone* zone, |
| 2675 bool opt) const { | 2588 bool opt) const { |
| 2676 ASSERT(opt); | 2589 ASSERT(opt); |
| 2677 const intptr_t kNumInputs = 0; | 2590 const intptr_t kNumInputs = 0; |
| 2678 const intptr_t kNumTemps = 3; | 2591 const intptr_t kNumTemps = 3; |
| 2679 LocationSummary* locs = new (zone) LocationSummary( | 2592 LocationSummary* locs = new (zone) LocationSummary( |
| 2680 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); | 2593 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); |
| 2681 locs->set_temp(0, Location::RegisterLocation(R1)); | 2594 locs->set_temp(0, Location::RegisterLocation(R1)); |
| 2682 locs->set_temp(1, Location::RegisterLocation(R2)); | 2595 locs->set_temp(1, Location::RegisterLocation(R2)); |
| 2683 locs->set_temp(2, Location::RegisterLocation(R3)); | 2596 locs->set_temp(2, Location::RegisterLocation(R3)); |
| 2684 locs->set_out(0, Location::RegisterLocation(R0)); | 2597 locs->set_out(0, Location::RegisterLocation(R0)); |
| 2685 return locs; | 2598 return locs; |
| 2686 } | 2599 } |
| 2687 | 2600 |
| 2688 | |
| 2689 class AllocateContextSlowPath : public SlowPathCode { | 2601 class AllocateContextSlowPath : public SlowPathCode { |
| 2690 public: | 2602 public: |
| 2691 explicit AllocateContextSlowPath( | 2603 explicit AllocateContextSlowPath( |
| 2692 AllocateUninitializedContextInstr* instruction) | 2604 AllocateUninitializedContextInstr* instruction) |
| 2693 : instruction_(instruction) {} | 2605 : instruction_(instruction) {} |
| 2694 | 2606 |
| 2695 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2607 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2696 __ Comment("AllocateContextSlowPath"); | 2608 __ Comment("AllocateContextSlowPath"); |
| 2697 __ Bind(entry_label()); | 2609 __ Bind(entry_label()); |
| 2698 | 2610 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2710 RawPcDescriptors::kOther, locs); | 2622 RawPcDescriptors::kOther, locs); |
| 2711 ASSERT(instruction_->locs()->out(0).reg() == R0); | 2623 ASSERT(instruction_->locs()->out(0).reg() == R0); |
| 2712 compiler->RestoreLiveRegisters(instruction_->locs()); | 2624 compiler->RestoreLiveRegisters(instruction_->locs()); |
| 2713 __ b(exit_label()); | 2625 __ b(exit_label()); |
| 2714 } | 2626 } |
| 2715 | 2627 |
| 2716 private: | 2628 private: |
| 2717 AllocateUninitializedContextInstr* instruction_; | 2629 AllocateUninitializedContextInstr* instruction_; |
| 2718 }; | 2630 }; |
| 2719 | 2631 |
| 2720 | |
| 2721 void AllocateUninitializedContextInstr::EmitNativeCode( | 2632 void AllocateUninitializedContextInstr::EmitNativeCode( |
| 2722 FlowGraphCompiler* compiler) { | 2633 FlowGraphCompiler* compiler) { |
| 2723 Register temp0 = locs()->temp(0).reg(); | 2634 Register temp0 = locs()->temp(0).reg(); |
| 2724 Register temp1 = locs()->temp(1).reg(); | 2635 Register temp1 = locs()->temp(1).reg(); |
| 2725 Register temp2 = locs()->temp(2).reg(); | 2636 Register temp2 = locs()->temp(2).reg(); |
| 2726 Register result = locs()->out(0).reg(); | 2637 Register result = locs()->out(0).reg(); |
| 2727 // Try allocate the object. | 2638 // Try allocate the object. |
| 2728 AllocateContextSlowPath* slow_path = new AllocateContextSlowPath(this); | 2639 AllocateContextSlowPath* slow_path = new AllocateContextSlowPath(this); |
| 2729 compiler->AddSlowPathCode(slow_path); | 2640 compiler->AddSlowPathCode(slow_path); |
| 2730 intptr_t instance_size = Context::InstanceSize(num_context_variables()); | 2641 intptr_t instance_size = Context::InstanceSize(num_context_variables()); |
| 2731 | 2642 |
| 2732 __ TryAllocateArray(kContextCid, instance_size, slow_path->entry_label(), | 2643 __ TryAllocateArray(kContextCid, instance_size, slow_path->entry_label(), |
| 2733 result, // instance | 2644 result, // instance |
| 2734 temp0, temp1, temp2); | 2645 temp0, temp1, temp2); |
| 2735 | 2646 |
| 2736 // Setup up number of context variables field. | 2647 // Setup up number of context variables field. |
| 2737 __ LoadImmediate(temp0, num_context_variables()); | 2648 __ LoadImmediate(temp0, num_context_variables()); |
| 2738 __ str(temp0, FieldAddress(result, Context::num_variables_offset())); | 2649 __ str(temp0, FieldAddress(result, Context::num_variables_offset())); |
| 2739 | 2650 |
| 2740 __ Bind(slow_path->exit_label()); | 2651 __ Bind(slow_path->exit_label()); |
| 2741 } | 2652 } |
| 2742 | 2653 |
| 2743 | |
| 2744 LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone, | 2654 LocationSummary* AllocateContextInstr::MakeLocationSummary(Zone* zone, |
| 2745 bool opt) const { | 2655 bool opt) const { |
| 2746 const intptr_t kNumInputs = 0; | 2656 const intptr_t kNumInputs = 0; |
| 2747 const intptr_t kNumTemps = 1; | 2657 const intptr_t kNumTemps = 1; |
| 2748 LocationSummary* locs = new (zone) | 2658 LocationSummary* locs = new (zone) |
| 2749 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 2659 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 2750 locs->set_temp(0, Location::RegisterLocation(R1)); | 2660 locs->set_temp(0, Location::RegisterLocation(R1)); |
| 2751 locs->set_out(0, Location::RegisterLocation(R0)); | 2661 locs->set_out(0, Location::RegisterLocation(R0)); |
| 2752 return locs; | 2662 return locs; |
| 2753 } | 2663 } |
| 2754 | 2664 |
| 2755 | |
| 2756 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2665 void AllocateContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2757 ASSERT(locs()->temp(0).reg() == R1); | 2666 ASSERT(locs()->temp(0).reg() == R1); |
| 2758 ASSERT(locs()->out(0).reg() == R0); | 2667 ASSERT(locs()->out(0).reg() == R0); |
| 2759 | 2668 |
| 2760 __ LoadImmediate(R1, num_context_variables()); | 2669 __ LoadImmediate(R1, num_context_variables()); |
| 2761 compiler->GenerateCall(token_pos(), *StubCode::AllocateContext_entry(), | 2670 compiler->GenerateCall(token_pos(), *StubCode::AllocateContext_entry(), |
| 2762 RawPcDescriptors::kOther, locs()); | 2671 RawPcDescriptors::kOther, locs()); |
| 2763 } | 2672 } |
| 2764 | 2673 |
| 2765 | |
| 2766 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, | 2674 LocationSummary* InitStaticFieldInstr::MakeLocationSummary(Zone* zone, |
| 2767 bool opt) const { | 2675 bool opt) const { |
| 2768 const intptr_t kNumInputs = 1; | 2676 const intptr_t kNumInputs = 1; |
| 2769 const intptr_t kNumTemps = 1; | 2677 const intptr_t kNumTemps = 1; |
| 2770 LocationSummary* locs = new (zone) | 2678 LocationSummary* locs = new (zone) |
| 2771 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 2679 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 2772 locs->set_in(0, Location::RegisterLocation(R0)); | 2680 locs->set_in(0, Location::RegisterLocation(R0)); |
| 2773 locs->set_temp(0, Location::RegisterLocation(R1)); | 2681 locs->set_temp(0, Location::RegisterLocation(R1)); |
| 2774 return locs; | 2682 return locs; |
| 2775 } | 2683 } |
| 2776 | 2684 |
| 2777 | |
| 2778 void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2685 void InitStaticFieldInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2779 Register field = locs()->in(0).reg(); | 2686 Register field = locs()->in(0).reg(); |
| 2780 Register temp = locs()->temp(0).reg(); | 2687 Register temp = locs()->temp(0).reg(); |
| 2781 Label call_runtime, no_call; | 2688 Label call_runtime, no_call; |
| 2782 | 2689 |
| 2783 __ ldr(temp, FieldAddress(field, Field::static_value_offset())); | 2690 __ ldr(temp, FieldAddress(field, Field::static_value_offset())); |
| 2784 __ CompareObject(temp, Object::sentinel()); | 2691 __ CompareObject(temp, Object::sentinel()); |
| 2785 __ b(&call_runtime, EQ); | 2692 __ b(&call_runtime, EQ); |
| 2786 | 2693 |
| 2787 __ CompareObject(temp, Object::transition_sentinel()); | 2694 __ CompareObject(temp, Object::transition_sentinel()); |
| 2788 __ b(&no_call, NE); | 2695 __ b(&no_call, NE); |
| 2789 | 2696 |
| 2790 __ Bind(&call_runtime); | 2697 __ Bind(&call_runtime); |
| 2791 __ PushObject(Object::null_object()); // Make room for (unused) result. | 2698 __ PushObject(Object::null_object()); // Make room for (unused) result. |
| 2792 __ Push(field); | 2699 __ Push(field); |
| 2793 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), | 2700 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), |
| 2794 kInitStaticFieldRuntimeEntry, 1, locs()); | 2701 kInitStaticFieldRuntimeEntry, 1, locs()); |
| 2795 __ Drop(2); // Remove argument and result placeholder. | 2702 __ Drop(2); // Remove argument and result placeholder. |
| 2796 __ Bind(&no_call); | 2703 __ Bind(&no_call); |
| 2797 } | 2704 } |
| 2798 | 2705 |
| 2799 | |
| 2800 LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone, | 2706 LocationSummary* CloneContextInstr::MakeLocationSummary(Zone* zone, |
| 2801 bool opt) const { | 2707 bool opt) const { |
| 2802 const intptr_t kNumInputs = 1; | 2708 const intptr_t kNumInputs = 1; |
| 2803 const intptr_t kNumTemps = 0; | 2709 const intptr_t kNumTemps = 0; |
| 2804 LocationSummary* locs = new (zone) | 2710 LocationSummary* locs = new (zone) |
| 2805 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 2711 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 2806 locs->set_in(0, Location::RegisterLocation(R0)); | 2712 locs->set_in(0, Location::RegisterLocation(R0)); |
| 2807 locs->set_out(0, Location::RegisterLocation(R0)); | 2713 locs->set_out(0, Location::RegisterLocation(R0)); |
| 2808 return locs; | 2714 return locs; |
| 2809 } | 2715 } |
| 2810 | 2716 |
| 2811 | |
| 2812 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2717 void CloneContextInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2813 const Register context_value = locs()->in(0).reg(); | 2718 const Register context_value = locs()->in(0).reg(); |
| 2814 const Register result = locs()->out(0).reg(); | 2719 const Register result = locs()->out(0).reg(); |
| 2815 | 2720 |
| 2816 __ PushObject(Object::null_object()); // Make room for the result. | 2721 __ PushObject(Object::null_object()); // Make room for the result. |
| 2817 __ Push(context_value); | 2722 __ Push(context_value); |
| 2818 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), | 2723 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), |
| 2819 kCloneContextRuntimeEntry, 1, locs()); | 2724 kCloneContextRuntimeEntry, 1, locs()); |
| 2820 __ Drop(1); // Remove argument. | 2725 __ Drop(1); // Remove argument. |
| 2821 __ Pop(result); // Get result (cloned context). | 2726 __ Pop(result); // Get result (cloned context). |
| 2822 } | 2727 } |
| 2823 | 2728 |
| 2824 | |
| 2825 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, | 2729 LocationSummary* CatchBlockEntryInstr::MakeLocationSummary(Zone* zone, |
| 2826 bool opt) const { | 2730 bool opt) const { |
| 2827 UNREACHABLE(); | 2731 UNREACHABLE(); |
| 2828 return NULL; | 2732 return NULL; |
| 2829 } | 2733 } |
| 2830 | 2734 |
| 2831 | |
| 2832 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2735 void CatchBlockEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2833 __ Bind(compiler->GetJumpLabel(this)); | 2736 __ Bind(compiler->GetJumpLabel(this)); |
| 2834 compiler->AddExceptionHandler(catch_try_index(), try_index(), | 2737 compiler->AddExceptionHandler(catch_try_index(), try_index(), |
| 2835 compiler->assembler()->CodeSize(), | 2738 compiler->assembler()->CodeSize(), |
| 2836 handler_token_pos(), is_generated(), | 2739 handler_token_pos(), is_generated(), |
| 2837 catch_handler_types_, needs_stacktrace()); | 2740 catch_handler_types_, needs_stacktrace()); |
| 2838 // On lazy deoptimization we patch the optimized code here to enter the | 2741 // On lazy deoptimization we patch the optimized code here to enter the |
| 2839 // deoptimization stub. | 2742 // deoptimization stub. |
| 2840 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId()); | 2743 const intptr_t deopt_id = Thread::ToDeoptAfter(GetDeoptId()); |
| 2841 if (compiler->is_optimizing()) { | 2744 if (compiler->is_optimizing()) { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2883 Context::variable_offset(stacktrace_var().index()), | 2786 Context::variable_offset(stacktrace_var().index()), |
| 2884 kStackTraceObjectReg); | 2787 kStackTraceObjectReg); |
| 2885 } else { | 2788 } else { |
| 2886 __ StoreToOffset(kWord, kExceptionObjectReg, FP, | 2789 __ StoreToOffset(kWord, kExceptionObjectReg, FP, |
| 2887 exception_var().index() * kWordSize); | 2790 exception_var().index() * kWordSize); |
| 2888 __ StoreToOffset(kWord, kStackTraceObjectReg, FP, | 2791 __ StoreToOffset(kWord, kStackTraceObjectReg, FP, |
| 2889 stacktrace_var().index() * kWordSize); | 2792 stacktrace_var().index() * kWordSize); |
| 2890 } | 2793 } |
| 2891 } | 2794 } |
| 2892 | 2795 |
| 2893 | |
| 2894 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, | 2796 LocationSummary* CheckStackOverflowInstr::MakeLocationSummary(Zone* zone, |
| 2895 bool opt) const { | 2797 bool opt) const { |
| 2896 const intptr_t kNumInputs = 0; | 2798 const intptr_t kNumInputs = 0; |
| 2897 const intptr_t kNumTemps = 1; | 2799 const intptr_t kNumTemps = 1; |
| 2898 LocationSummary* summary = new (zone) LocationSummary( | 2800 LocationSummary* summary = new (zone) LocationSummary( |
| 2899 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); | 2801 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); |
| 2900 summary->set_temp(0, Location::RequiresRegister()); | 2802 summary->set_temp(0, Location::RequiresRegister()); |
| 2901 return summary; | 2803 return summary; |
| 2902 } | 2804 } |
| 2903 | 2805 |
| 2904 | |
| 2905 class CheckStackOverflowSlowPath : public SlowPathCode { | 2806 class CheckStackOverflowSlowPath : public SlowPathCode { |
| 2906 public: | 2807 public: |
| 2907 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) | 2808 explicit CheckStackOverflowSlowPath(CheckStackOverflowInstr* instruction) |
| 2908 : instruction_(instruction) {} | 2809 : instruction_(instruction) {} |
| 2909 | 2810 |
| 2910 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2811 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2911 if (compiler->isolate()->use_osr() && osr_entry_label()->IsLinked()) { | 2812 if (compiler->isolate()->use_osr() && osr_entry_label()->IsLinked()) { |
| 2912 const Register value = instruction_->locs()->temp(0).reg(); | 2813 const Register value = instruction_->locs()->temp(0).reg(); |
| 2913 __ Comment("CheckStackOverflowSlowPathOsr"); | 2814 __ Comment("CheckStackOverflowSlowPathOsr"); |
| 2914 __ Bind(osr_entry_label()); | 2815 __ Bind(osr_entry_label()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2942 Label* osr_entry_label() { | 2843 Label* osr_entry_label() { |
| 2943 ASSERT(Isolate::Current()->use_osr()); | 2844 ASSERT(Isolate::Current()->use_osr()); |
| 2944 return &osr_entry_label_; | 2845 return &osr_entry_label_; |
| 2945 } | 2846 } |
| 2946 | 2847 |
| 2947 private: | 2848 private: |
| 2948 CheckStackOverflowInstr* instruction_; | 2849 CheckStackOverflowInstr* instruction_; |
| 2949 Label osr_entry_label_; | 2850 Label osr_entry_label_; |
| 2950 }; | 2851 }; |
| 2951 | 2852 |
| 2952 | |
| 2953 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 2853 void CheckStackOverflowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 2954 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); | 2854 CheckStackOverflowSlowPath* slow_path = new CheckStackOverflowSlowPath(this); |
| 2955 compiler->AddSlowPathCode(slow_path); | 2855 compiler->AddSlowPathCode(slow_path); |
| 2956 | 2856 |
| 2957 __ ldr(IP, Address(THR, Thread::stack_limit_offset())); | 2857 __ ldr(IP, Address(THR, Thread::stack_limit_offset())); |
| 2958 __ cmp(SP, Operand(IP)); | 2858 __ cmp(SP, Operand(IP)); |
| 2959 __ b(slow_path->entry_label(), LS); | 2859 __ b(slow_path->entry_label(), LS); |
| 2960 if (compiler->CanOSRFunction() && in_loop()) { | 2860 if (compiler->CanOSRFunction() && in_loop()) { |
| 2961 const Register temp = locs()->temp(0).reg(); | 2861 const Register temp = locs()->temp(0).reg(); |
| 2962 // In unoptimized code check the usage counter to trigger OSR at loop | 2862 // In unoptimized code check the usage counter to trigger OSR at loop |
| 2963 // stack checks. Use progressively higher thresholds for more deeply | 2863 // stack checks. Use progressively higher thresholds for more deeply |
| 2964 // nested loops to attempt to hit outer loops with OSR when possible. | 2864 // nested loops to attempt to hit outer loops with OSR when possible. |
| 2965 __ LoadObject(temp, compiler->parsed_function().function()); | 2865 __ LoadObject(temp, compiler->parsed_function().function()); |
| 2966 intptr_t threshold = | 2866 intptr_t threshold = |
| 2967 FLAG_optimization_counter_threshold * (loop_depth() + 1); | 2867 FLAG_optimization_counter_threshold * (loop_depth() + 1); |
| 2968 __ ldr(temp, FieldAddress(temp, Function::usage_counter_offset())); | 2868 __ ldr(temp, FieldAddress(temp, Function::usage_counter_offset())); |
| 2969 __ CompareImmediate(temp, threshold); | 2869 __ CompareImmediate(temp, threshold); |
| 2970 __ b(slow_path->osr_entry_label(), GE); | 2870 __ b(slow_path->osr_entry_label(), GE); |
| 2971 } | 2871 } |
| 2972 if (compiler->ForceSlowPathForStackOverflow()) { | 2872 if (compiler->ForceSlowPathForStackOverflow()) { |
| 2973 __ b(slow_path->entry_label()); | 2873 __ b(slow_path->entry_label()); |
| 2974 } | 2874 } |
| 2975 __ Bind(slow_path->exit_label()); | 2875 __ Bind(slow_path->exit_label()); |
| 2976 } | 2876 } |
| 2977 | 2877 |
| 2978 | |
| 2979 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, | 2878 static void EmitSmiShiftLeft(FlowGraphCompiler* compiler, |
| 2980 BinarySmiOpInstr* shift_left) { | 2879 BinarySmiOpInstr* shift_left) { |
| 2981 const LocationSummary& locs = *shift_left->locs(); | 2880 const LocationSummary& locs = *shift_left->locs(); |
| 2982 const Register left = locs.in(0).reg(); | 2881 const Register left = locs.in(0).reg(); |
| 2983 const Register result = locs.out(0).reg(); | 2882 const Register result = locs.out(0).reg(); |
| 2984 Label* deopt = shift_left->CanDeoptimize() | 2883 Label* deopt = shift_left->CanDeoptimize() |
| 2985 ? compiler->AddDeoptStub(shift_left->deopt_id(), | 2884 ? compiler->AddDeoptStub(shift_left->deopt_id(), |
| 2986 ICData::kDeoptBinarySmiOp) | 2885 ICData::kDeoptBinarySmiOp) |
| 2987 : NULL; | 2886 : NULL; |
| 2988 if (locs.in(1).IsConstant()) { | 2887 if (locs.in(1).IsConstant()) { |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3061 // Overflow test (preserve left, right, and IP); | 2960 // Overflow test (preserve left, right, and IP); |
| 3062 const Register temp = locs.temp(0).reg(); | 2961 const Register temp = locs.temp(0).reg(); |
| 3063 __ Lsl(temp, left, IP); | 2962 __ Lsl(temp, left, IP); |
| 3064 __ cmp(left, Operand(temp, ASR, IP)); | 2963 __ cmp(left, Operand(temp, ASR, IP)); |
| 3065 __ b(deopt, NE); // Overflow. | 2964 __ b(deopt, NE); // Overflow. |
| 3066 // Shift for result now we know there is no overflow. | 2965 // Shift for result now we know there is no overflow. |
| 3067 __ Lsl(result, left, IP); | 2966 __ Lsl(result, left, IP); |
| 3068 } | 2967 } |
| 3069 } | 2968 } |
| 3070 | 2969 |
| 3071 | |
| 3072 class CheckedSmiSlowPath : public SlowPathCode { | 2970 class CheckedSmiSlowPath : public SlowPathCode { |
| 3073 public: | 2971 public: |
| 3074 CheckedSmiSlowPath(CheckedSmiOpInstr* instruction, intptr_t try_index) | 2972 CheckedSmiSlowPath(CheckedSmiOpInstr* instruction, intptr_t try_index) |
| 3075 : instruction_(instruction), try_index_(try_index) {} | 2973 : instruction_(instruction), try_index_(try_index) {} |
| 3076 | 2974 |
| 3077 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 2975 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3078 if (Assembler::EmittingComments()) { | 2976 if (Assembler::EmittingComments()) { |
| 3079 __ Comment("slow path smi operation"); | 2977 __ Comment("slow path smi operation"); |
| 3080 } | 2978 } |
| 3081 __ Bind(entry_label()); | 2979 __ Bind(entry_label()); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 3103 compiler->RestoreLiveRegisters(locs); | 3001 compiler->RestoreLiveRegisters(locs); |
| 3104 __ b(exit_label()); | 3002 __ b(exit_label()); |
| 3105 compiler->pending_deoptimization_env_ = NULL; | 3003 compiler->pending_deoptimization_env_ = NULL; |
| 3106 } | 3004 } |
| 3107 | 3005 |
| 3108 private: | 3006 private: |
| 3109 CheckedSmiOpInstr* instruction_; | 3007 CheckedSmiOpInstr* instruction_; |
| 3110 intptr_t try_index_; | 3008 intptr_t try_index_; |
| 3111 }; | 3009 }; |
| 3112 | 3010 |
| 3113 | |
| 3114 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, | 3011 LocationSummary* CheckedSmiOpInstr::MakeLocationSummary(Zone* zone, |
| 3115 bool opt) const { | 3012 bool opt) const { |
| 3116 const intptr_t kNumInputs = 2; | 3013 const intptr_t kNumInputs = 2; |
| 3117 const intptr_t kNumTemps = 0; | 3014 const intptr_t kNumTemps = 0; |
| 3118 LocationSummary* summary = new (zone) LocationSummary( | 3015 LocationSummary* summary = new (zone) LocationSummary( |
| 3119 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); | 3016 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); |
| 3120 summary->set_in(0, Location::RequiresRegister()); | 3017 summary->set_in(0, Location::RequiresRegister()); |
| 3121 summary->set_in(1, Location::RequiresRegister()); | 3018 summary->set_in(1, Location::RequiresRegister()); |
| 3122 summary->set_out(0, Location::RequiresRegister()); | 3019 summary->set_out(0, Location::RequiresRegister()); |
| 3123 return summary; | 3020 return summary; |
| 3124 } | 3021 } |
| 3125 | 3022 |
| 3126 | |
| 3127 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3023 void CheckedSmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3128 CheckedSmiSlowPath* slow_path = | 3024 CheckedSmiSlowPath* slow_path = |
| 3129 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); | 3025 new CheckedSmiSlowPath(this, compiler->CurrentTryIndex()); |
| 3130 compiler->AddSlowPathCode(slow_path); | 3026 compiler->AddSlowPathCode(slow_path); |
| 3131 // Test operands if necessary. | 3027 // Test operands if necessary. |
| 3132 Register left = locs()->in(0).reg(); | 3028 Register left = locs()->in(0).reg(); |
| 3133 Register right = locs()->in(1).reg(); | 3029 Register right = locs()->in(1).reg(); |
| 3134 Register result = locs()->out(0).reg(); | 3030 Register result = locs()->out(0).reg(); |
| 3135 intptr_t left_cid = this->left()->Type()->ToCid(); | 3031 intptr_t left_cid = this->left()->Type()->ToCid(); |
| 3136 intptr_t right_cid = this->right()->Type()->ToCid(); | 3032 intptr_t right_cid = this->right()->Type()->ToCid(); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3198 __ SmiUntag(TMP, left); | 3094 __ SmiUntag(TMP, left); |
| 3199 __ Asr(result, TMP, result); | 3095 __ Asr(result, TMP, result); |
| 3200 __ SmiTag(result); | 3096 __ SmiTag(result); |
| 3201 break; | 3097 break; |
| 3202 default: | 3098 default: |
| 3203 UNREACHABLE(); | 3099 UNREACHABLE(); |
| 3204 } | 3100 } |
| 3205 __ Bind(slow_path->exit_label()); | 3101 __ Bind(slow_path->exit_label()); |
| 3206 } | 3102 } |
| 3207 | 3103 |
| 3208 | |
| 3209 class CheckedSmiComparisonSlowPath : public SlowPathCode { | 3104 class CheckedSmiComparisonSlowPath : public SlowPathCode { |
| 3210 public: | 3105 public: |
| 3211 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction, | 3106 CheckedSmiComparisonSlowPath(CheckedSmiComparisonInstr* instruction, |
| 3212 intptr_t try_index, | 3107 intptr_t try_index, |
| 3213 BranchLabels labels, | 3108 BranchLabels labels, |
| 3214 bool merged) | 3109 bool merged) |
| 3215 : instruction_(instruction), | 3110 : instruction_(instruction), |
| 3216 try_index_(try_index), | 3111 try_index_(try_index), |
| 3217 labels_(labels), | 3112 labels_(labels), |
| 3218 merged_(merged) {} | 3113 merged_(merged) {} |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3257 } | 3152 } |
| 3258 } | 3153 } |
| 3259 | 3154 |
| 3260 private: | 3155 private: |
| 3261 CheckedSmiComparisonInstr* instruction_; | 3156 CheckedSmiComparisonInstr* instruction_; |
| 3262 intptr_t try_index_; | 3157 intptr_t try_index_; |
| 3263 BranchLabels labels_; | 3158 BranchLabels labels_; |
| 3264 bool merged_; | 3159 bool merged_; |
| 3265 }; | 3160 }; |
| 3266 | 3161 |
| 3267 | |
| 3268 LocationSummary* CheckedSmiComparisonInstr::MakeLocationSummary( | 3162 LocationSummary* CheckedSmiComparisonInstr::MakeLocationSummary( |
| 3269 Zone* zone, | 3163 Zone* zone, |
| 3270 bool opt) const { | 3164 bool opt) const { |
| 3271 const intptr_t kNumInputs = 2; | 3165 const intptr_t kNumInputs = 2; |
| 3272 const intptr_t kNumTemps = 1; | 3166 const intptr_t kNumTemps = 1; |
| 3273 LocationSummary* summary = new (zone) LocationSummary( | 3167 LocationSummary* summary = new (zone) LocationSummary( |
| 3274 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); | 3168 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); |
| 3275 summary->set_in(0, Location::RequiresRegister()); | 3169 summary->set_in(0, Location::RequiresRegister()); |
| 3276 summary->set_in(1, Location::RequiresRegister()); | 3170 summary->set_in(1, Location::RequiresRegister()); |
| 3277 summary->set_temp(0, Location::RequiresRegister()); | 3171 summary->set_temp(0, Location::RequiresRegister()); |
| 3278 summary->set_out(0, Location::RequiresRegister()); | 3172 summary->set_out(0, Location::RequiresRegister()); |
| 3279 return summary; | 3173 return summary; |
| 3280 } | 3174 } |
| 3281 | 3175 |
| 3282 | |
| 3283 Condition CheckedSmiComparisonInstr::EmitComparisonCode( | 3176 Condition CheckedSmiComparisonInstr::EmitComparisonCode( |
| 3284 FlowGraphCompiler* compiler, | 3177 FlowGraphCompiler* compiler, |
| 3285 BranchLabels labels) { | 3178 BranchLabels labels) { |
| 3286 return EmitSmiComparisonOp(compiler, locs(), kind()); | 3179 return EmitSmiComparisonOp(compiler, locs(), kind()); |
| 3287 } | 3180 } |
| 3288 | 3181 |
| 3289 | |
| 3290 #define EMIT_SMI_CHECK \ | 3182 #define EMIT_SMI_CHECK \ |
| 3291 Register left = locs()->in(0).reg(); \ | 3183 Register left = locs()->in(0).reg(); \ |
| 3292 Register right = locs()->in(1).reg(); \ | 3184 Register right = locs()->in(1).reg(); \ |
| 3293 Register temp = locs()->temp(0).reg(); \ | 3185 Register temp = locs()->temp(0).reg(); \ |
| 3294 intptr_t left_cid = this->left()->Type()->ToCid(); \ | 3186 intptr_t left_cid = this->left()->Type()->ToCid(); \ |
| 3295 intptr_t right_cid = this->right()->Type()->ToCid(); \ | 3187 intptr_t right_cid = this->right()->Type()->ToCid(); \ |
| 3296 if (this->left()->definition() == this->right()->definition()) { \ | 3188 if (this->left()->definition() == this->right()->definition()) { \ |
| 3297 __ tst(left, Operand(kSmiTagMask)); \ | 3189 __ tst(left, Operand(kSmiTagMask)); \ |
| 3298 } else if (left_cid == kSmiCid) { \ | 3190 } else if (left_cid == kSmiCid) { \ |
| 3299 __ tst(right, Operand(kSmiTagMask)); \ | 3191 __ tst(right, Operand(kSmiTagMask)); \ |
| 3300 } else if (right_cid == kSmiCid) { \ | 3192 } else if (right_cid == kSmiCid) { \ |
| 3301 __ tst(left, Operand(kSmiTagMask)); \ | 3193 __ tst(left, Operand(kSmiTagMask)); \ |
| 3302 } else { \ | 3194 } else { \ |
| 3303 __ orr(temp, left, Operand(right)); \ | 3195 __ orr(temp, left, Operand(right)); \ |
| 3304 __ tst(temp, Operand(kSmiTagMask)); \ | 3196 __ tst(temp, Operand(kSmiTagMask)); \ |
| 3305 } \ | 3197 } \ |
| 3306 __ b(slow_path->entry_label(), NE) | 3198 __ b(slow_path->entry_label(), NE) |
| 3307 | 3199 |
| 3308 | |
| 3309 void CheckedSmiComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, | 3200 void CheckedSmiComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, |
| 3310 BranchInstr* branch) { | 3201 BranchInstr* branch) { |
| 3311 BranchLabels labels = compiler->CreateBranchLabels(branch); | 3202 BranchLabels labels = compiler->CreateBranchLabels(branch); |
| 3312 CheckedSmiComparisonSlowPath* slow_path = new CheckedSmiComparisonSlowPath( | 3203 CheckedSmiComparisonSlowPath* slow_path = new CheckedSmiComparisonSlowPath( |
| 3313 this, compiler->CurrentTryIndex(), labels, | 3204 this, compiler->CurrentTryIndex(), labels, |
| 3314 /* merged = */ true); | 3205 /* merged = */ true); |
| 3315 compiler->AddSlowPathCode(slow_path); | 3206 compiler->AddSlowPathCode(slow_path); |
| 3316 EMIT_SMI_CHECK; | 3207 EMIT_SMI_CHECK; |
| 3317 Condition true_condition = EmitComparisonCode(compiler, labels); | 3208 Condition true_condition = EmitComparisonCode(compiler, labels); |
| 3318 ASSERT(true_condition != kInvalidCondition); | 3209 ASSERT(true_condition != kInvalidCondition); |
| 3319 EmitBranchOnCondition(compiler, true_condition, labels); | 3210 EmitBranchOnCondition(compiler, true_condition, labels); |
| 3320 __ Bind(slow_path->exit_label()); | 3211 __ Bind(slow_path->exit_label()); |
| 3321 } | 3212 } |
| 3322 | 3213 |
| 3323 | |
| 3324 void CheckedSmiComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3214 void CheckedSmiComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3325 BranchLabels labels = {NULL, NULL, NULL}; | 3215 BranchLabels labels = {NULL, NULL, NULL}; |
| 3326 CheckedSmiComparisonSlowPath* slow_path = new CheckedSmiComparisonSlowPath( | 3216 CheckedSmiComparisonSlowPath* slow_path = new CheckedSmiComparisonSlowPath( |
| 3327 this, compiler->CurrentTryIndex(), labels, | 3217 this, compiler->CurrentTryIndex(), labels, |
| 3328 /* merged = */ false); | 3218 /* merged = */ false); |
| 3329 compiler->AddSlowPathCode(slow_path); | 3219 compiler->AddSlowPathCode(slow_path); |
| 3330 EMIT_SMI_CHECK; | 3220 EMIT_SMI_CHECK; |
| 3331 Condition true_condition = EmitComparisonCode(compiler, labels); | 3221 Condition true_condition = EmitComparisonCode(compiler, labels); |
| 3332 ASSERT(true_condition != kInvalidCondition); | 3222 ASSERT(true_condition != kInvalidCondition); |
| 3333 Register result = locs()->out(0).reg(); | 3223 Register result = locs()->out(0).reg(); |
| 3334 __ LoadObject(result, Bool::True(), true_condition); | 3224 __ LoadObject(result, Bool::True(), true_condition); |
| 3335 __ LoadObject(result, Bool::False(), NegateCondition(true_condition)); | 3225 __ LoadObject(result, Bool::False(), NegateCondition(true_condition)); |
| 3336 __ Bind(slow_path->exit_label()); | 3226 __ Bind(slow_path->exit_label()); |
| 3337 } | 3227 } |
| 3338 #undef EMIT_SMI_CHECK | 3228 #undef EMIT_SMI_CHECK |
| 3339 | 3229 |
| 3340 | |
| 3341 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, | 3230 LocationSummary* BinarySmiOpInstr::MakeLocationSummary(Zone* zone, |
| 3342 bool opt) const { | 3231 bool opt) const { |
| 3343 const intptr_t kNumInputs = 2; | 3232 const intptr_t kNumInputs = 2; |
| 3344 // Calculate number of temporaries. | 3233 // Calculate number of temporaries. |
| 3345 intptr_t num_temps = 0; | 3234 intptr_t num_temps = 0; |
| 3346 if (op_kind() == Token::kTRUNCDIV) { | 3235 if (op_kind() == Token::kTRUNCDIV) { |
| 3347 if (RightIsPowerOfTwoConstant()) { | 3236 if (RightIsPowerOfTwoConstant()) { |
| 3348 num_temps = 1; | 3237 num_temps = 1; |
| 3349 } else { | 3238 } else { |
| 3350 num_temps = 2; | 3239 num_temps = 2; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3384 if (((op_kind() == Token::kSHL) && can_overflow()) || | 3273 if (((op_kind() == Token::kSHL) && can_overflow()) || |
| 3385 (op_kind() == Token::kSHR)) { | 3274 (op_kind() == Token::kSHR)) { |
| 3386 summary->set_temp(0, Location::RequiresRegister()); | 3275 summary->set_temp(0, Location::RequiresRegister()); |
| 3387 } | 3276 } |
| 3388 // We make use of 3-operand instructions by not requiring result register | 3277 // We make use of 3-operand instructions by not requiring result register |
| 3389 // to be identical to first input register as on Intel. | 3278 // to be identical to first input register as on Intel. |
| 3390 summary->set_out(0, Location::RequiresRegister()); | 3279 summary->set_out(0, Location::RequiresRegister()); |
| 3391 return summary; | 3280 return summary; |
| 3392 } | 3281 } |
| 3393 | 3282 |
| 3394 | |
| 3395 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3283 void BinarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3396 if (op_kind() == Token::kSHL) { | 3284 if (op_kind() == Token::kSHL) { |
| 3397 EmitSmiShiftLeft(compiler, this); | 3285 EmitSmiShiftLeft(compiler, this); |
| 3398 return; | 3286 return; |
| 3399 } | 3287 } |
| 3400 | 3288 |
| 3401 const Register left = locs()->in(0).reg(); | 3289 const Register left = locs()->in(0).reg(); |
| 3402 const Register result = locs()->out(0).reg(); | 3290 const Register result = locs()->out(0).reg(); |
| 3403 Label* deopt = NULL; | 3291 Label* deopt = NULL; |
| 3404 if (CanDeoptimize()) { | 3292 if (CanDeoptimize()) { |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3645 // behavior (short-circuit evaluation). | 3533 // behavior (short-circuit evaluation). |
| 3646 UNREACHABLE(); | 3534 UNREACHABLE(); |
| 3647 break; | 3535 break; |
| 3648 } | 3536 } |
| 3649 default: | 3537 default: |
| 3650 UNREACHABLE(); | 3538 UNREACHABLE(); |
| 3651 break; | 3539 break; |
| 3652 } | 3540 } |
| 3653 } | 3541 } |
| 3654 | 3542 |
| 3655 | |
| 3656 static void EmitInt32ShiftLeft(FlowGraphCompiler* compiler, | 3543 static void EmitInt32ShiftLeft(FlowGraphCompiler* compiler, |
| 3657 BinaryInt32OpInstr* shift_left) { | 3544 BinaryInt32OpInstr* shift_left) { |
| 3658 const LocationSummary& locs = *shift_left->locs(); | 3545 const LocationSummary& locs = *shift_left->locs(); |
| 3659 const Register left = locs.in(0).reg(); | 3546 const Register left = locs.in(0).reg(); |
| 3660 const Register result = locs.out(0).reg(); | 3547 const Register result = locs.out(0).reg(); |
| 3661 Label* deopt = shift_left->CanDeoptimize() | 3548 Label* deopt = shift_left->CanDeoptimize() |
| 3662 ? compiler->AddDeoptStub(shift_left->deopt_id(), | 3549 ? compiler->AddDeoptStub(shift_left->deopt_id(), |
| 3663 ICData::kDeoptBinarySmiOp) | 3550 ICData::kDeoptBinarySmiOp) |
| 3664 : NULL; | 3551 : NULL; |
| 3665 ASSERT(locs.in(1).IsConstant()); | 3552 ASSERT(locs.in(1).IsConstant()); |
| 3666 const Object& constant = locs.in(1).constant(); | 3553 const Object& constant = locs.in(1).constant(); |
| 3667 ASSERT(constant.IsSmi()); | 3554 ASSERT(constant.IsSmi()); |
| 3668 // Immediate shift operation takes 5 bits for the count. | 3555 // Immediate shift operation takes 5 bits for the count. |
| 3669 const intptr_t kCountLimit = 0x1F; | 3556 const intptr_t kCountLimit = 0x1F; |
| 3670 const intptr_t value = Smi::Cast(constant).Value(); | 3557 const intptr_t value = Smi::Cast(constant).Value(); |
| 3671 ASSERT((0 < value) && (value < kCountLimit)); | 3558 ASSERT((0 < value) && (value < kCountLimit)); |
| 3672 if (shift_left->can_overflow()) { | 3559 if (shift_left->can_overflow()) { |
| 3673 // Check for overflow (preserve left). | 3560 // Check for overflow (preserve left). |
| 3674 __ Lsl(IP, left, Operand(value)); | 3561 __ Lsl(IP, left, Operand(value)); |
| 3675 __ cmp(left, Operand(IP, ASR, value)); | 3562 __ cmp(left, Operand(IP, ASR, value)); |
| 3676 __ b(deopt, NE); // Overflow. | 3563 __ b(deopt, NE); // Overflow. |
| 3677 } | 3564 } |
| 3678 // Shift for result now we know there is no overflow. | 3565 // Shift for result now we know there is no overflow. |
| 3679 __ Lsl(result, left, Operand(value)); | 3566 __ Lsl(result, left, Operand(value)); |
| 3680 } | 3567 } |
| 3681 | 3568 |
| 3682 | |
| 3683 LocationSummary* BinaryInt32OpInstr::MakeLocationSummary(Zone* zone, | 3569 LocationSummary* BinaryInt32OpInstr::MakeLocationSummary(Zone* zone, |
| 3684 bool opt) const { | 3570 bool opt) const { |
| 3685 const intptr_t kNumInputs = 2; | 3571 const intptr_t kNumInputs = 2; |
| 3686 // Calculate number of temporaries. | 3572 // Calculate number of temporaries. |
| 3687 intptr_t num_temps = 0; | 3573 intptr_t num_temps = 0; |
| 3688 if (((op_kind() == Token::kSHL) && can_overflow()) || | 3574 if (((op_kind() == Token::kSHL) && can_overflow()) || |
| 3689 (op_kind() == Token::kSHR)) { | 3575 (op_kind() == Token::kSHR)) { |
| 3690 num_temps = 1; | 3576 num_temps = 1; |
| 3691 } | 3577 } |
| 3692 LocationSummary* summary = new (zone) | 3578 LocationSummary* summary = new (zone) |
| 3693 LocationSummary(zone, kNumInputs, num_temps, LocationSummary::kNoCall); | 3579 LocationSummary(zone, kNumInputs, num_temps, LocationSummary::kNoCall); |
| 3694 summary->set_in(0, Location::RequiresRegister()); | 3580 summary->set_in(0, Location::RequiresRegister()); |
| 3695 summary->set_in(1, Location::RegisterOrSmiConstant(right())); | 3581 summary->set_in(1, Location::RegisterOrSmiConstant(right())); |
| 3696 if (((op_kind() == Token::kSHL) && can_overflow()) || | 3582 if (((op_kind() == Token::kSHL) && can_overflow()) || |
| 3697 (op_kind() == Token::kSHR)) { | 3583 (op_kind() == Token::kSHR)) { |
| 3698 summary->set_temp(0, Location::RequiresRegister()); | 3584 summary->set_temp(0, Location::RequiresRegister()); |
| 3699 } | 3585 } |
| 3700 // We make use of 3-operand instructions by not requiring result register | 3586 // We make use of 3-operand instructions by not requiring result register |
| 3701 // to be identical to first input register as on Intel. | 3587 // to be identical to first input register as on Intel. |
| 3702 summary->set_out(0, Location::RequiresRegister()); | 3588 summary->set_out(0, Location::RequiresRegister()); |
| 3703 return summary; | 3589 return summary; |
| 3704 } | 3590 } |
| 3705 | 3591 |
| 3706 | |
| 3707 void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3592 void BinaryInt32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3708 if (op_kind() == Token::kSHL) { | 3593 if (op_kind() == Token::kSHL) { |
| 3709 EmitInt32ShiftLeft(compiler, this); | 3594 EmitInt32ShiftLeft(compiler, this); |
| 3710 return; | 3595 return; |
| 3711 } | 3596 } |
| 3712 | 3597 |
| 3713 const Register left = locs()->in(0).reg(); | 3598 const Register left = locs()->in(0).reg(); |
| 3714 const Register result = locs()->out(0).reg(); | 3599 const Register result = locs()->out(0).reg(); |
| 3715 Label* deopt = NULL; | 3600 Label* deopt = NULL; |
| 3716 if (CanDeoptimize()) { | 3601 if (CanDeoptimize()) { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3849 // No overflow check. | 3734 // No overflow check. |
| 3850 __ eor(result, left, Operand(right)); | 3735 __ eor(result, left, Operand(right)); |
| 3851 break; | 3736 break; |
| 3852 } | 3737 } |
| 3853 default: | 3738 default: |
| 3854 UNREACHABLE(); | 3739 UNREACHABLE(); |
| 3855 break; | 3740 break; |
| 3856 } | 3741 } |
| 3857 } | 3742 } |
| 3858 | 3743 |
| 3859 | |
| 3860 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone, | 3744 LocationSummary* CheckEitherNonSmiInstr::MakeLocationSummary(Zone* zone, |
| 3861 bool opt) const { | 3745 bool opt) const { |
| 3862 intptr_t left_cid = left()->Type()->ToCid(); | 3746 intptr_t left_cid = left()->Type()->ToCid(); |
| 3863 intptr_t right_cid = right()->Type()->ToCid(); | 3747 intptr_t right_cid = right()->Type()->ToCid(); |
| 3864 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid)); | 3748 ASSERT((left_cid != kDoubleCid) && (right_cid != kDoubleCid)); |
| 3865 const intptr_t kNumInputs = 2; | 3749 const intptr_t kNumInputs = 2; |
| 3866 const intptr_t kNumTemps = 0; | 3750 const intptr_t kNumTemps = 0; |
| 3867 LocationSummary* summary = new (zone) | 3751 LocationSummary* summary = new (zone) |
| 3868 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3752 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3869 summary->set_in(0, Location::RequiresRegister()); | 3753 summary->set_in(0, Location::RequiresRegister()); |
| 3870 summary->set_in(1, Location::RequiresRegister()); | 3754 summary->set_in(1, Location::RequiresRegister()); |
| 3871 return summary; | 3755 return summary; |
| 3872 } | 3756 } |
| 3873 | 3757 |
| 3874 | |
| 3875 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3758 void CheckEitherNonSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3876 Label* deopt = | 3759 Label* deopt = |
| 3877 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryDoubleOp, | 3760 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryDoubleOp, |
| 3878 licm_hoisted_ ? ICData::kHoisted : 0); | 3761 licm_hoisted_ ? ICData::kHoisted : 0); |
| 3879 intptr_t left_cid = left()->Type()->ToCid(); | 3762 intptr_t left_cid = left()->Type()->ToCid(); |
| 3880 intptr_t right_cid = right()->Type()->ToCid(); | 3763 intptr_t right_cid = right()->Type()->ToCid(); |
| 3881 const Register left = locs()->in(0).reg(); | 3764 const Register left = locs()->in(0).reg(); |
| 3882 const Register right = locs()->in(1).reg(); | 3765 const Register right = locs()->in(1).reg(); |
| 3883 if (this->left()->definition() == this->right()->definition()) { | 3766 if (this->left()->definition() == this->right()->definition()) { |
| 3884 __ tst(left, Operand(kSmiTagMask)); | 3767 __ tst(left, Operand(kSmiTagMask)); |
| 3885 } else if (left_cid == kSmiCid) { | 3768 } else if (left_cid == kSmiCid) { |
| 3886 __ tst(right, Operand(kSmiTagMask)); | 3769 __ tst(right, Operand(kSmiTagMask)); |
| 3887 } else if (right_cid == kSmiCid) { | 3770 } else if (right_cid == kSmiCid) { |
| 3888 __ tst(left, Operand(kSmiTagMask)); | 3771 __ tst(left, Operand(kSmiTagMask)); |
| 3889 } else { | 3772 } else { |
| 3890 __ orr(IP, left, Operand(right)); | 3773 __ orr(IP, left, Operand(right)); |
| 3891 __ tst(IP, Operand(kSmiTagMask)); | 3774 __ tst(IP, Operand(kSmiTagMask)); |
| 3892 } | 3775 } |
| 3893 __ b(deopt, EQ); | 3776 __ b(deopt, EQ); |
| 3894 } | 3777 } |
| 3895 | 3778 |
| 3896 | |
| 3897 LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone, bool opt) const { | 3779 LocationSummary* BoxInstr::MakeLocationSummary(Zone* zone, bool opt) const { |
| 3898 const intptr_t kNumInputs = 1; | 3780 const intptr_t kNumInputs = 1; |
| 3899 const intptr_t kNumTemps = 1; | 3781 const intptr_t kNumTemps = 1; |
| 3900 LocationSummary* summary = new (zone) LocationSummary( | 3782 LocationSummary* summary = new (zone) LocationSummary( |
| 3901 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); | 3783 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); |
| 3902 summary->set_in(0, Location::RequiresFpuRegister()); | 3784 summary->set_in(0, Location::RequiresFpuRegister()); |
| 3903 summary->set_temp(0, Location::RequiresRegister()); | 3785 summary->set_temp(0, Location::RequiresRegister()); |
| 3904 summary->set_out(0, Location::RequiresRegister()); | 3786 summary->set_out(0, Location::RequiresRegister()); |
| 3905 return summary; | 3787 return summary; |
| 3906 } | 3788 } |
| 3907 | 3789 |
| 3908 | |
| 3909 void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3790 void BoxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 3910 const Register out_reg = locs()->out(0).reg(); | 3791 const Register out_reg = locs()->out(0).reg(); |
| 3911 const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 3792 const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 3912 | 3793 |
| 3913 BoxAllocationSlowPath::Allocate(compiler, this, | 3794 BoxAllocationSlowPath::Allocate(compiler, this, |
| 3914 compiler->BoxClassFor(from_representation()), | 3795 compiler->BoxClassFor(from_representation()), |
| 3915 out_reg, locs()->temp(0).reg()); | 3796 out_reg, locs()->temp(0).reg()); |
| 3916 | 3797 |
| 3917 switch (from_representation()) { | 3798 switch (from_representation()) { |
| 3918 case kUnboxedDouble: | 3799 case kUnboxedDouble: |
| 3919 __ StoreDToOffset(value, out_reg, ValueOffset() - kHeapObjectTag); | 3800 __ StoreDToOffset(value, out_reg, ValueOffset() - kHeapObjectTag); |
| 3920 break; | 3801 break; |
| 3921 case kUnboxedFloat32x4: | 3802 case kUnboxedFloat32x4: |
| 3922 case kUnboxedFloat64x2: | 3803 case kUnboxedFloat64x2: |
| 3923 case kUnboxedInt32x4: | 3804 case kUnboxedInt32x4: |
| 3924 __ StoreMultipleDToOffset(value, 2, out_reg, | 3805 __ StoreMultipleDToOffset(value, 2, out_reg, |
| 3925 ValueOffset() - kHeapObjectTag); | 3806 ValueOffset() - kHeapObjectTag); |
| 3926 break; | 3807 break; |
| 3927 default: | 3808 default: |
| 3928 UNREACHABLE(); | 3809 UNREACHABLE(); |
| 3929 break; | 3810 break; |
| 3930 } | 3811 } |
| 3931 } | 3812 } |
| 3932 | 3813 |
| 3933 | |
| 3934 LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone, bool opt) const { | 3814 LocationSummary* UnboxInstr::MakeLocationSummary(Zone* zone, bool opt) const { |
| 3935 const bool needs_temp = CanDeoptimize(); | 3815 const bool needs_temp = CanDeoptimize(); |
| 3936 const intptr_t kNumInputs = 1; | 3816 const intptr_t kNumInputs = 1; |
| 3937 const intptr_t kNumTemps = needs_temp ? 1 : 0; | 3817 const intptr_t kNumTemps = needs_temp ? 1 : 0; |
| 3938 LocationSummary* summary = new (zone) | 3818 LocationSummary* summary = new (zone) |
| 3939 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 3819 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 3940 summary->set_in(0, Location::RequiresRegister()); | 3820 summary->set_in(0, Location::RequiresRegister()); |
| 3941 if (needs_temp) { | 3821 if (needs_temp) { |
| 3942 summary->set_temp(0, Location::RequiresRegister()); | 3822 summary->set_temp(0, Location::RequiresRegister()); |
| 3943 } | 3823 } |
| 3944 if (representation() == kUnboxedMint) { | 3824 if (representation() == kUnboxedMint) { |
| 3945 summary->set_out(0, Location::Pair(Location::RequiresRegister(), | 3825 summary->set_out(0, Location::Pair(Location::RequiresRegister(), |
| 3946 Location::RequiresRegister())); | 3826 Location::RequiresRegister())); |
| 3947 } else { | 3827 } else { |
| 3948 summary->set_out(0, Location::RequiresFpuRegister()); | 3828 summary->set_out(0, Location::RequiresFpuRegister()); |
| 3949 } | 3829 } |
| 3950 return summary; | 3830 return summary; |
| 3951 } | 3831 } |
| 3952 | 3832 |
| 3953 | |
| 3954 void UnboxInstr::EmitLoadFromBox(FlowGraphCompiler* compiler) { | 3833 void UnboxInstr::EmitLoadFromBox(FlowGraphCompiler* compiler) { |
| 3955 const Register box = locs()->in(0).reg(); | 3834 const Register box = locs()->in(0).reg(); |
| 3956 | 3835 |
| 3957 switch (representation()) { | 3836 switch (representation()) { |
| 3958 case kUnboxedMint: { | 3837 case kUnboxedMint: { |
| 3959 PairLocation* result = locs()->out(0).AsPairLocation(); | 3838 PairLocation* result = locs()->out(0).AsPairLocation(); |
| 3960 __ LoadFieldFromOffset(kWord, result->At(0).reg(), box, ValueOffset()); | 3839 __ LoadFieldFromOffset(kWord, result->At(0).reg(), box, ValueOffset()); |
| 3961 __ LoadFieldFromOffset(kWord, result->At(1).reg(), box, | 3840 __ LoadFieldFromOffset(kWord, result->At(1).reg(), box, |
| 3962 ValueOffset() + kWordSize); | 3841 ValueOffset() + kWordSize); |
| 3963 break; | 3842 break; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 3977 ValueOffset() - kHeapObjectTag); | 3856 ValueOffset() - kHeapObjectTag); |
| 3978 break; | 3857 break; |
| 3979 } | 3858 } |
| 3980 | 3859 |
| 3981 default: | 3860 default: |
| 3982 UNREACHABLE(); | 3861 UNREACHABLE(); |
| 3983 break; | 3862 break; |
| 3984 } | 3863 } |
| 3985 } | 3864 } |
| 3986 | 3865 |
| 3987 | |
| 3988 void UnboxInstr::EmitSmiConversion(FlowGraphCompiler* compiler) { | 3866 void UnboxInstr::EmitSmiConversion(FlowGraphCompiler* compiler) { |
| 3989 const Register box = locs()->in(0).reg(); | 3867 const Register box = locs()->in(0).reg(); |
| 3990 | 3868 |
| 3991 switch (representation()) { | 3869 switch (representation()) { |
| 3992 case kUnboxedMint: { | 3870 case kUnboxedMint: { |
| 3993 PairLocation* result = locs()->out(0).AsPairLocation(); | 3871 PairLocation* result = locs()->out(0).AsPairLocation(); |
| 3994 __ SmiUntag(result->At(0).reg(), box); | 3872 __ SmiUntag(result->At(0).reg(), box); |
| 3995 __ SignFill(result->At(1).reg(), result->At(0).reg()); | 3873 __ SignFill(result->At(1).reg(), result->At(0).reg()); |
| 3996 break; | 3874 break; |
| 3997 } | 3875 } |
| 3998 | 3876 |
| 3999 case kUnboxedDouble: { | 3877 case kUnboxedDouble: { |
| 4000 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 3878 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 4001 __ SmiUntag(IP, box); | 3879 __ SmiUntag(IP, box); |
| 4002 __ vmovdr(DTMP, 0, IP); | 3880 __ vmovdr(DTMP, 0, IP); |
| 4003 __ vcvtdi(result, STMP); | 3881 __ vcvtdi(result, STMP); |
| 4004 break; | 3882 break; |
| 4005 } | 3883 } |
| 4006 | 3884 |
| 4007 default: | 3885 default: |
| 4008 UNREACHABLE(); | 3886 UNREACHABLE(); |
| 4009 break; | 3887 break; |
| 4010 } | 3888 } |
| 4011 } | 3889 } |
| 4012 | 3890 |
| 4013 | |
| 4014 void UnboxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3891 void UnboxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4015 const intptr_t value_cid = value()->Type()->ToCid(); | 3892 const intptr_t value_cid = value()->Type()->ToCid(); |
| 4016 const intptr_t box_cid = BoxCid(); | 3893 const intptr_t box_cid = BoxCid(); |
| 4017 | 3894 |
| 4018 if (value_cid == box_cid) { | 3895 if (value_cid == box_cid) { |
| 4019 EmitLoadFromBox(compiler); | 3896 EmitLoadFromBox(compiler); |
| 4020 } else if (CanConvertSmi() && (value_cid == kSmiCid)) { | 3897 } else if (CanConvertSmi() && (value_cid == kSmiCid)) { |
| 4021 EmitSmiConversion(compiler); | 3898 EmitSmiConversion(compiler); |
| 4022 } else { | 3899 } else { |
| 4023 const Register box = locs()->in(0).reg(); | 3900 const Register box = locs()->in(0).reg(); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 4042 if (is_smi.IsLinked()) { | 3919 if (is_smi.IsLinked()) { |
| 4043 Label done; | 3920 Label done; |
| 4044 __ b(&done); | 3921 __ b(&done); |
| 4045 __ Bind(&is_smi); | 3922 __ Bind(&is_smi); |
| 4046 EmitSmiConversion(compiler); | 3923 EmitSmiConversion(compiler); |
| 4047 __ Bind(&done); | 3924 __ Bind(&done); |
| 4048 } | 3925 } |
| 4049 } | 3926 } |
| 4050 } | 3927 } |
| 4051 | 3928 |
| 4052 | |
| 4053 LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone, | 3929 LocationSummary* BoxInteger32Instr::MakeLocationSummary(Zone* zone, |
| 4054 bool opt) const { | 3930 bool opt) const { |
| 4055 ASSERT((from_representation() == kUnboxedInt32) || | 3931 ASSERT((from_representation() == kUnboxedInt32) || |
| 4056 (from_representation() == kUnboxedUint32)); | 3932 (from_representation() == kUnboxedUint32)); |
| 4057 const intptr_t kNumInputs = 1; | 3933 const intptr_t kNumInputs = 1; |
| 4058 const intptr_t kNumTemps = ValueFitsSmi() ? 0 : 1; | 3934 const intptr_t kNumTemps = ValueFitsSmi() ? 0 : 1; |
| 4059 LocationSummary* summary = new (zone) | 3935 LocationSummary* summary = new (zone) |
| 4060 LocationSummary(zone, kNumInputs, kNumTemps, | 3936 LocationSummary(zone, kNumInputs, kNumTemps, |
| 4061 ValueFitsSmi() ? LocationSummary::kNoCall | 3937 ValueFitsSmi() ? LocationSummary::kNoCall |
| 4062 : LocationSummary::kCallOnSlowPath); | 3938 : LocationSummary::kCallOnSlowPath); |
| 4063 summary->set_in(0, Location::RequiresRegister()); | 3939 summary->set_in(0, Location::RequiresRegister()); |
| 4064 if (!ValueFitsSmi()) { | 3940 if (!ValueFitsSmi()) { |
| 4065 summary->set_temp(0, Location::RequiresRegister()); | 3941 summary->set_temp(0, Location::RequiresRegister()); |
| 4066 } | 3942 } |
| 4067 summary->set_out(0, Location::RequiresRegister()); | 3943 summary->set_out(0, Location::RequiresRegister()); |
| 4068 return summary; | 3944 return summary; |
| 4069 } | 3945 } |
| 4070 | 3946 |
| 4071 | |
| 4072 void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3947 void BoxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4073 Register value = locs()->in(0).reg(); | 3948 Register value = locs()->in(0).reg(); |
| 4074 Register out = locs()->out(0).reg(); | 3949 Register out = locs()->out(0).reg(); |
| 4075 ASSERT(value != out); | 3950 ASSERT(value != out); |
| 4076 | 3951 |
| 4077 __ SmiTag(out, value); | 3952 __ SmiTag(out, value); |
| 4078 if (!ValueFitsSmi()) { | 3953 if (!ValueFitsSmi()) { |
| 4079 Register temp = locs()->temp(0).reg(); | 3954 Register temp = locs()->temp(0).reg(); |
| 4080 Label done; | 3955 Label done; |
| 4081 if (from_representation() == kUnboxedInt32) { | 3956 if (from_representation() == kUnboxedInt32) { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 4095 ASSERT(from_representation() == kUnboxedUint32); | 3970 ASSERT(from_representation() == kUnboxedUint32); |
| 4096 __ eor(temp, temp, Operand(temp)); | 3971 __ eor(temp, temp, Operand(temp)); |
| 4097 } | 3972 } |
| 4098 __ StoreToOffset(kWord, value, out, Mint::value_offset() - kHeapObjectTag); | 3973 __ StoreToOffset(kWord, value, out, Mint::value_offset() - kHeapObjectTag); |
| 4099 __ StoreToOffset(kWord, temp, out, | 3974 __ StoreToOffset(kWord, temp, out, |
| 4100 Mint::value_offset() - kHeapObjectTag + kWordSize); | 3975 Mint::value_offset() - kHeapObjectTag + kWordSize); |
| 4101 __ Bind(&done); | 3976 __ Bind(&done); |
| 4102 } | 3977 } |
| 4103 } | 3978 } |
| 4104 | 3979 |
| 4105 | |
| 4106 LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone, | 3980 LocationSummary* BoxInt64Instr::MakeLocationSummary(Zone* zone, |
| 4107 bool opt) const { | 3981 bool opt) const { |
| 4108 const intptr_t kNumInputs = 1; | 3982 const intptr_t kNumInputs = 1; |
| 4109 const intptr_t kNumTemps = ValueFitsSmi() ? 0 : 1; | 3983 const intptr_t kNumTemps = ValueFitsSmi() ? 0 : 1; |
| 4110 LocationSummary* summary = new (zone) | 3984 LocationSummary* summary = new (zone) |
| 4111 LocationSummary(zone, kNumInputs, kNumTemps, | 3985 LocationSummary(zone, kNumInputs, kNumTemps, |
| 4112 ValueFitsSmi() ? LocationSummary::kNoCall | 3986 ValueFitsSmi() ? LocationSummary::kNoCall |
| 4113 : LocationSummary::kCallOnSlowPath); | 3987 : LocationSummary::kCallOnSlowPath); |
| 4114 summary->set_in(0, Location::Pair(Location::RequiresRegister(), | 3988 summary->set_in(0, Location::Pair(Location::RequiresRegister(), |
| 4115 Location::RequiresRegister())); | 3989 Location::RequiresRegister())); |
| 4116 if (!ValueFitsSmi()) { | 3990 if (!ValueFitsSmi()) { |
| 4117 summary->set_temp(0, Location::RequiresRegister()); | 3991 summary->set_temp(0, Location::RequiresRegister()); |
| 4118 } | 3992 } |
| 4119 summary->set_out(0, Location::RequiresRegister()); | 3993 summary->set_out(0, Location::RequiresRegister()); |
| 4120 return summary; | 3994 return summary; |
| 4121 } | 3995 } |
| 4122 | 3996 |
| 4123 | |
| 4124 void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 3997 void BoxInt64Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4125 if (ValueFitsSmi()) { | 3998 if (ValueFitsSmi()) { |
| 4126 PairLocation* value_pair = locs()->in(0).AsPairLocation(); | 3999 PairLocation* value_pair = locs()->in(0).AsPairLocation(); |
| 4127 Register value_lo = value_pair->At(0).reg(); | 4000 Register value_lo = value_pair->At(0).reg(); |
| 4128 Register out_reg = locs()->out(0).reg(); | 4001 Register out_reg = locs()->out(0).reg(); |
| 4129 __ SmiTag(out_reg, value_lo); | 4002 __ SmiTag(out_reg, value_lo); |
| 4130 return; | 4003 return; |
| 4131 } | 4004 } |
| 4132 | 4005 |
| 4133 PairLocation* value_pair = locs()->in(0).AsPairLocation(); | 4006 PairLocation* value_pair = locs()->in(0).AsPairLocation(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 4144 | 4017 |
| 4145 BoxAllocationSlowPath::Allocate(compiler, this, compiler->mint_class(), | 4018 BoxAllocationSlowPath::Allocate(compiler, this, compiler->mint_class(), |
| 4146 out_reg, tmp); | 4019 out_reg, tmp); |
| 4147 __ StoreToOffset(kWord, value_lo, out_reg, | 4020 __ StoreToOffset(kWord, value_lo, out_reg, |
| 4148 Mint::value_offset() - kHeapObjectTag); | 4021 Mint::value_offset() - kHeapObjectTag); |
| 4149 __ StoreToOffset(kWord, value_hi, out_reg, | 4022 __ StoreToOffset(kWord, value_hi, out_reg, |
| 4150 Mint::value_offset() - kHeapObjectTag + kWordSize); | 4023 Mint::value_offset() - kHeapObjectTag + kWordSize); |
| 4151 __ Bind(&done); | 4024 __ Bind(&done); |
| 4152 } | 4025 } |
| 4153 | 4026 |
| 4154 | |
| 4155 static void LoadInt32FromMint(FlowGraphCompiler* compiler, | 4027 static void LoadInt32FromMint(FlowGraphCompiler* compiler, |
| 4156 Register mint, | 4028 Register mint, |
| 4157 Register result, | 4029 Register result, |
| 4158 Register temp, | 4030 Register temp, |
| 4159 Label* deopt) { | 4031 Label* deopt) { |
| 4160 __ LoadFieldFromOffset(kWord, result, mint, Mint::value_offset()); | 4032 __ LoadFieldFromOffset(kWord, result, mint, Mint::value_offset()); |
| 4161 if (deopt != NULL) { | 4033 if (deopt != NULL) { |
| 4162 __ LoadFieldFromOffset(kWord, temp, mint, Mint::value_offset() + kWordSize); | 4034 __ LoadFieldFromOffset(kWord, temp, mint, Mint::value_offset() + kWordSize); |
| 4163 __ cmp(temp, Operand(result, ASR, kBitsPerWord - 1)); | 4035 __ cmp(temp, Operand(result, ASR, kBitsPerWord - 1)); |
| 4164 __ b(deopt, NE); | 4036 __ b(deopt, NE); |
| 4165 } | 4037 } |
| 4166 } | 4038 } |
| 4167 | 4039 |
| 4168 | |
| 4169 LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone, | 4040 LocationSummary* UnboxInteger32Instr::MakeLocationSummary(Zone* zone, |
| 4170 bool opt) const { | 4041 bool opt) const { |
| 4171 ASSERT((representation() == kUnboxedInt32) || | 4042 ASSERT((representation() == kUnboxedInt32) || |
| 4172 (representation() == kUnboxedUint32)); | 4043 (representation() == kUnboxedUint32)); |
| 4173 ASSERT((representation() != kUnboxedUint32) || is_truncating()); | 4044 ASSERT((representation() != kUnboxedUint32) || is_truncating()); |
| 4174 const intptr_t kNumInputs = 1; | 4045 const intptr_t kNumInputs = 1; |
| 4175 const intptr_t kNumTemps = CanDeoptimize() ? 1 : 0; | 4046 const intptr_t kNumTemps = CanDeoptimize() ? 1 : 0; |
| 4176 LocationSummary* summary = new (zone) | 4047 LocationSummary* summary = new (zone) |
| 4177 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4048 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4178 summary->set_in(0, Location::RequiresRegister()); | 4049 summary->set_in(0, Location::RequiresRegister()); |
| 4179 if (kNumTemps > 0) { | 4050 if (kNumTemps > 0) { |
| 4180 summary->set_temp(0, Location::RequiresRegister()); | 4051 summary->set_temp(0, Location::RequiresRegister()); |
| 4181 } | 4052 } |
| 4182 summary->set_out(0, Location::RequiresRegister()); | 4053 summary->set_out(0, Location::RequiresRegister()); |
| 4183 return summary; | 4054 return summary; |
| 4184 } | 4055 } |
| 4185 | 4056 |
| 4186 | |
| 4187 void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4057 void UnboxInteger32Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4188 const intptr_t value_cid = value()->Type()->ToCid(); | 4058 const intptr_t value_cid = value()->Type()->ToCid(); |
| 4189 const Register value = locs()->in(0).reg(); | 4059 const Register value = locs()->in(0).reg(); |
| 4190 const Register out = locs()->out(0).reg(); | 4060 const Register out = locs()->out(0).reg(); |
| 4191 const Register temp = CanDeoptimize() ? locs()->temp(0).reg() : kNoRegister; | 4061 const Register temp = CanDeoptimize() ? locs()->temp(0).reg() : kNoRegister; |
| 4192 Label* deopt = | 4062 Label* deopt = CanDeoptimize() ? compiler->AddDeoptStub( |
| 4193 CanDeoptimize() | 4063 GetDeoptId(), ICData::kDeoptUnboxInteger) |
| 4194 ? compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger) | 4064 : NULL; |
| 4195 : NULL; | |
| 4196 Label* out_of_range = !is_truncating() ? deopt : NULL; | 4065 Label* out_of_range = !is_truncating() ? deopt : NULL; |
| 4197 ASSERT(value != out); | 4066 ASSERT(value != out); |
| 4198 | 4067 |
| 4199 if (value_cid == kSmiCid) { | 4068 if (value_cid == kSmiCid) { |
| 4200 __ SmiUntag(out, value); | 4069 __ SmiUntag(out, value); |
| 4201 } else if (value_cid == kMintCid) { | 4070 } else if (value_cid == kMintCid) { |
| 4202 LoadInt32FromMint(compiler, value, out, temp, out_of_range); | 4071 LoadInt32FromMint(compiler, value, out, temp, out_of_range); |
| 4203 } else if (!CanDeoptimize()) { | 4072 } else if (!CanDeoptimize()) { |
| 4204 Label done; | 4073 Label done; |
| 4205 __ SmiUntag(out, value, &done); | 4074 __ SmiUntag(out, value, &done); |
| 4206 LoadInt32FromMint(compiler, value, out, kNoRegister, NULL); | 4075 LoadInt32FromMint(compiler, value, out, kNoRegister, NULL); |
| 4207 __ Bind(&done); | 4076 __ Bind(&done); |
| 4208 } else { | 4077 } else { |
| 4209 Label done; | 4078 Label done; |
| 4210 __ SmiUntag(out, value, &done); | 4079 __ SmiUntag(out, value, &done); |
| 4211 __ CompareClassId(value, kMintCid, temp); | 4080 __ CompareClassId(value, kMintCid, temp); |
| 4212 __ b(deopt, NE); | 4081 __ b(deopt, NE); |
| 4213 LoadInt32FromMint(compiler, value, out, temp, out_of_range); | 4082 LoadInt32FromMint(compiler, value, out, temp, out_of_range); |
| 4214 __ Bind(&done); | 4083 __ Bind(&done); |
| 4215 } | 4084 } |
| 4216 } | 4085 } |
| 4217 | 4086 |
| 4218 | |
| 4219 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone, | 4087 LocationSummary* BinaryDoubleOpInstr::MakeLocationSummary(Zone* zone, |
| 4220 bool opt) const { | 4088 bool opt) const { |
| 4221 const intptr_t kNumInputs = 2; | 4089 const intptr_t kNumInputs = 2; |
| 4222 const intptr_t kNumTemps = 0; | 4090 const intptr_t kNumTemps = 0; |
| 4223 LocationSummary* summary = new (zone) | 4091 LocationSummary* summary = new (zone) |
| 4224 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4092 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4225 summary->set_in(0, Location::RequiresFpuRegister()); | 4093 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4226 summary->set_in(1, Location::RequiresFpuRegister()); | 4094 summary->set_in(1, Location::RequiresFpuRegister()); |
| 4227 summary->set_out(0, Location::RequiresFpuRegister()); | 4095 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4228 return summary; | 4096 return summary; |
| 4229 } | 4097 } |
| 4230 | 4098 |
| 4231 | |
| 4232 void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4099 void BinaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4233 const DRegister left = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 4100 const DRegister left = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 4234 const DRegister right = EvenDRegisterOf(locs()->in(1).fpu_reg()); | 4101 const DRegister right = EvenDRegisterOf(locs()->in(1).fpu_reg()); |
| 4235 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 4102 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 4236 switch (op_kind()) { | 4103 switch (op_kind()) { |
| 4237 case Token::kADD: | 4104 case Token::kADD: |
| 4238 __ vaddd(result, left, right); | 4105 __ vaddd(result, left, right); |
| 4239 break; | 4106 break; |
| 4240 case Token::kSUB: | 4107 case Token::kSUB: |
| 4241 __ vsubd(result, left, right); | 4108 __ vsubd(result, left, right); |
| 4242 break; | 4109 break; |
| 4243 case Token::kMUL: | 4110 case Token::kMUL: |
| 4244 __ vmuld(result, left, right); | 4111 __ vmuld(result, left, right); |
| 4245 break; | 4112 break; |
| 4246 case Token::kDIV: | 4113 case Token::kDIV: |
| 4247 __ vdivd(result, left, right); | 4114 __ vdivd(result, left, right); |
| 4248 break; | 4115 break; |
| 4249 default: | 4116 default: |
| 4250 UNREACHABLE(); | 4117 UNREACHABLE(); |
| 4251 } | 4118 } |
| 4252 } | 4119 } |
| 4253 | 4120 |
| 4254 | |
| 4255 LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, | 4121 LocationSummary* DoubleTestOpInstr::MakeLocationSummary(Zone* zone, |
| 4256 bool opt) const { | 4122 bool opt) const { |
| 4257 const intptr_t kNumInputs = 1; | 4123 const intptr_t kNumInputs = 1; |
| 4258 const intptr_t kNumTemps = | 4124 const intptr_t kNumTemps = |
| 4259 (op_kind() == MethodRecognizer::kDouble_getIsInfinite) ? 1 : 0; | 4125 (op_kind() == MethodRecognizer::kDouble_getIsInfinite) ? 1 : 0; |
| 4260 LocationSummary* summary = new (zone) | 4126 LocationSummary* summary = new (zone) |
| 4261 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4127 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4262 summary->set_in(0, Location::RequiresFpuRegister()); | 4128 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4263 if (op_kind() == MethodRecognizer::kDouble_getIsInfinite) { | 4129 if (op_kind() == MethodRecognizer::kDouble_getIsInfinite) { |
| 4264 summary->set_temp(0, Location::RequiresRegister()); | 4130 summary->set_temp(0, Location::RequiresRegister()); |
| 4265 } | 4131 } |
| 4266 summary->set_out(0, Location::RequiresRegister()); | 4132 summary->set_out(0, Location::RequiresRegister()); |
| 4267 return summary; | 4133 return summary; |
| 4268 } | 4134 } |
| 4269 | 4135 |
| 4270 | |
| 4271 Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, | 4136 Condition DoubleTestOpInstr::EmitComparisonCode(FlowGraphCompiler* compiler, |
| 4272 BranchLabels labels) { | 4137 BranchLabels labels) { |
| 4273 const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 4138 const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 4274 const bool is_negated = kind() != Token::kEQ; | 4139 const bool is_negated = kind() != Token::kEQ; |
| 4275 if (op_kind() == MethodRecognizer::kDouble_getIsNaN) { | 4140 if (op_kind() == MethodRecognizer::kDouble_getIsNaN) { |
| 4276 __ vcmpd(value, value); | 4141 __ vcmpd(value, value); |
| 4277 __ vmstat(); | 4142 __ vmstat(); |
| 4278 return is_negated ? VC : VS; | 4143 return is_negated ? VC : VS; |
| 4279 } else { | 4144 } else { |
| 4280 ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite); | 4145 ASSERT(op_kind() == MethodRecognizer::kDouble_getIsInfinite); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 4298 const intptr_t kNumInputs = 2; | 4163 const intptr_t kNumInputs = 2; |
| 4299 const intptr_t kNumTemps = 0; | 4164 const intptr_t kNumTemps = 0; |
| 4300 LocationSummary* summary = new (zone) | 4165 LocationSummary* summary = new (zone) |
| 4301 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4166 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4302 summary->set_in(0, Location::RequiresFpuRegister()); | 4167 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4303 summary->set_in(1, Location::RequiresFpuRegister()); | 4168 summary->set_in(1, Location::RequiresFpuRegister()); |
| 4304 summary->set_out(0, Location::RequiresFpuRegister()); | 4169 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4305 return summary; | 4170 return summary; |
| 4306 } | 4171 } |
| 4307 | 4172 |
| 4308 | |
| 4309 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4173 void BinaryFloat32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4310 const QRegister left = locs()->in(0).fpu_reg(); | 4174 const QRegister left = locs()->in(0).fpu_reg(); |
| 4311 const QRegister right = locs()->in(1).fpu_reg(); | 4175 const QRegister right = locs()->in(1).fpu_reg(); |
| 4312 const QRegister result = locs()->out(0).fpu_reg(); | 4176 const QRegister result = locs()->out(0).fpu_reg(); |
| 4313 | 4177 |
| 4314 switch (op_kind()) { | 4178 switch (op_kind()) { |
| 4315 case Token::kADD: | 4179 case Token::kADD: |
| 4316 __ vaddqs(result, left, right); | 4180 __ vaddqs(result, left, right); |
| 4317 break; | 4181 break; |
| 4318 case Token::kSUB: | 4182 case Token::kSUB: |
| 4319 __ vsubqs(result, left, right); | 4183 __ vsubqs(result, left, right); |
| 4320 break; | 4184 break; |
| 4321 case Token::kMUL: | 4185 case Token::kMUL: |
| 4322 __ vmulqs(result, left, right); | 4186 __ vmulqs(result, left, right); |
| 4323 break; | 4187 break; |
| 4324 case Token::kDIV: | 4188 case Token::kDIV: |
| 4325 __ Vdivqs(result, left, right); | 4189 __ Vdivqs(result, left, right); |
| 4326 break; | 4190 break; |
| 4327 default: | 4191 default: |
| 4328 UNREACHABLE(); | 4192 UNREACHABLE(); |
| 4329 } | 4193 } |
| 4330 } | 4194 } |
| 4331 | 4195 |
| 4332 | |
| 4333 LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone, | 4196 LocationSummary* BinaryFloat64x2OpInstr::MakeLocationSummary(Zone* zone, |
| 4334 bool opt) const { | 4197 bool opt) const { |
| 4335 const intptr_t kNumInputs = 2; | 4198 const intptr_t kNumInputs = 2; |
| 4336 const intptr_t kNumTemps = 0; | 4199 const intptr_t kNumTemps = 0; |
| 4337 LocationSummary* summary = new (zone) | 4200 LocationSummary* summary = new (zone) |
| 4338 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4201 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4339 summary->set_in(0, Location::RequiresFpuRegister()); | 4202 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4340 summary->set_in(1, Location::RequiresFpuRegister()); | 4203 summary->set_in(1, Location::RequiresFpuRegister()); |
| 4341 summary->set_out(0, Location::RequiresFpuRegister()); | 4204 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4342 return summary; | 4205 return summary; |
| 4343 } | 4206 } |
| 4344 | 4207 |
| 4345 | |
| 4346 void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4208 void BinaryFloat64x2OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4347 const QRegister left = locs()->in(0).fpu_reg(); | 4209 const QRegister left = locs()->in(0).fpu_reg(); |
| 4348 const QRegister right = locs()->in(1).fpu_reg(); | 4210 const QRegister right = locs()->in(1).fpu_reg(); |
| 4349 const QRegister result = locs()->out(0).fpu_reg(); | 4211 const QRegister result = locs()->out(0).fpu_reg(); |
| 4350 | 4212 |
| 4351 const DRegister left0 = EvenDRegisterOf(left); | 4213 const DRegister left0 = EvenDRegisterOf(left); |
| 4352 const DRegister left1 = OddDRegisterOf(left); | 4214 const DRegister left1 = OddDRegisterOf(left); |
| 4353 | 4215 |
| 4354 const DRegister right0 = EvenDRegisterOf(right); | 4216 const DRegister right0 = EvenDRegisterOf(right); |
| 4355 const DRegister right1 = OddDRegisterOf(right); | 4217 const DRegister right1 = OddDRegisterOf(right); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 4372 break; | 4234 break; |
| 4373 case Token::kDIV: | 4235 case Token::kDIV: |
| 4374 __ vdivd(result0, left0, right0); | 4236 __ vdivd(result0, left0, right0); |
| 4375 __ vdivd(result1, left1, right1); | 4237 __ vdivd(result1, left1, right1); |
| 4376 break; | 4238 break; |
| 4377 default: | 4239 default: |
| 4378 UNREACHABLE(); | 4240 UNREACHABLE(); |
| 4379 } | 4241 } |
| 4380 } | 4242 } |
| 4381 | 4243 |
| 4382 | |
| 4383 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone, | 4244 LocationSummary* Simd32x4ShuffleInstr::MakeLocationSummary(Zone* zone, |
| 4384 bool opt) const { | 4245 bool opt) const { |
| 4385 const intptr_t kNumInputs = 1; | 4246 const intptr_t kNumInputs = 1; |
| 4386 const intptr_t kNumTemps = 0; | 4247 const intptr_t kNumTemps = 0; |
| 4387 LocationSummary* summary = new (zone) | 4248 LocationSummary* summary = new (zone) |
| 4388 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4249 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4389 // Low (< Q7) Q registers are needed for the vcvtds and vmovs instructions. | 4250 // Low (< Q7) Q registers are needed for the vcvtds and vmovs instructions. |
| 4390 summary->set_in(0, Location::FpuRegisterLocation(Q5)); | 4251 summary->set_in(0, Location::FpuRegisterLocation(Q5)); |
| 4391 summary->set_out(0, Location::FpuRegisterLocation(Q6)); | 4252 summary->set_out(0, Location::FpuRegisterLocation(Q6)); |
| 4392 return summary; | 4253 return summary; |
| 4393 } | 4254 } |
| 4394 | 4255 |
| 4395 | |
| 4396 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4256 void Simd32x4ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4397 const QRegister value = locs()->in(0).fpu_reg(); | 4257 const QRegister value = locs()->in(0).fpu_reg(); |
| 4398 const QRegister result = locs()->out(0).fpu_reg(); | 4258 const QRegister result = locs()->out(0).fpu_reg(); |
| 4399 const DRegister dresult0 = EvenDRegisterOf(result); | 4259 const DRegister dresult0 = EvenDRegisterOf(result); |
| 4400 const DRegister dresult1 = OddDRegisterOf(result); | 4260 const DRegister dresult1 = OddDRegisterOf(result); |
| 4401 const SRegister sresult0 = EvenSRegisterOf(dresult0); | 4261 const SRegister sresult0 = EvenSRegisterOf(dresult0); |
| 4402 const SRegister sresult1 = OddSRegisterOf(dresult0); | 4262 const SRegister sresult1 = OddSRegisterOf(dresult0); |
| 4403 const SRegister sresult2 = EvenSRegisterOf(dresult1); | 4263 const SRegister sresult2 = EvenSRegisterOf(dresult1); |
| 4404 const SRegister sresult3 = OddSRegisterOf(dresult1); | 4264 const SRegister sresult3 = OddSRegisterOf(dresult1); |
| 4405 | 4265 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4454 __ vmovs(sresult1, svalues[(mask_ >> 2) & 0x3]); | 4314 __ vmovs(sresult1, svalues[(mask_ >> 2) & 0x3]); |
| 4455 __ vmovs(sresult2, svalues[(mask_ >> 4) & 0x3]); | 4315 __ vmovs(sresult2, svalues[(mask_ >> 4) & 0x3]); |
| 4456 __ vmovs(sresult3, svalues[(mask_ >> 6) & 0x3]); | 4316 __ vmovs(sresult3, svalues[(mask_ >> 6) & 0x3]); |
| 4457 } | 4317 } |
| 4458 break; | 4318 break; |
| 4459 default: | 4319 default: |
| 4460 UNREACHABLE(); | 4320 UNREACHABLE(); |
| 4461 } | 4321 } |
| 4462 } | 4322 } |
| 4463 | 4323 |
| 4464 | |
| 4465 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone, | 4324 LocationSummary* Simd32x4ShuffleMixInstr::MakeLocationSummary(Zone* zone, |
| 4466 bool opt) const { | 4325 bool opt) const { |
| 4467 const intptr_t kNumInputs = 2; | 4326 const intptr_t kNumInputs = 2; |
| 4468 const intptr_t kNumTemps = 0; | 4327 const intptr_t kNumTemps = 0; |
| 4469 LocationSummary* summary = new (zone) | 4328 LocationSummary* summary = new (zone) |
| 4470 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4329 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4471 // Low (< Q7) Q registers are needed for the vcvtds and vmovs instructions. | 4330 // Low (< Q7) Q registers are needed for the vcvtds and vmovs instructions. |
| 4472 summary->set_in(0, Location::FpuRegisterLocation(Q4)); | 4331 summary->set_in(0, Location::FpuRegisterLocation(Q4)); |
| 4473 summary->set_in(1, Location::FpuRegisterLocation(Q5)); | 4332 summary->set_in(1, Location::FpuRegisterLocation(Q5)); |
| 4474 summary->set_out(0, Location::FpuRegisterLocation(Q6)); | 4333 summary->set_out(0, Location::FpuRegisterLocation(Q6)); |
| 4475 return summary; | 4334 return summary; |
| 4476 } | 4335 } |
| 4477 | 4336 |
| 4478 | |
| 4479 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4337 void Simd32x4ShuffleMixInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4480 const QRegister left = locs()->in(0).fpu_reg(); | 4338 const QRegister left = locs()->in(0).fpu_reg(); |
| 4481 const QRegister right = locs()->in(1).fpu_reg(); | 4339 const QRegister right = locs()->in(1).fpu_reg(); |
| 4482 const QRegister result = locs()->out(0).fpu_reg(); | 4340 const QRegister result = locs()->out(0).fpu_reg(); |
| 4483 | 4341 |
| 4484 const DRegister dresult0 = EvenDRegisterOf(result); | 4342 const DRegister dresult0 = EvenDRegisterOf(result); |
| 4485 const DRegister dresult1 = OddDRegisterOf(result); | 4343 const DRegister dresult1 = OddDRegisterOf(result); |
| 4486 const SRegister sresult0 = EvenSRegisterOf(dresult0); | 4344 const SRegister sresult0 = EvenSRegisterOf(dresult0); |
| 4487 const SRegister sresult1 = OddSRegisterOf(dresult0); | 4345 const SRegister sresult1 = OddSRegisterOf(dresult0); |
| 4488 const SRegister sresult2 = EvenSRegisterOf(dresult1); | 4346 const SRegister sresult2 = EvenSRegisterOf(dresult1); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 4512 __ vmovs(sresult0, left_svalues[mask_ & 0x3]); | 4370 __ vmovs(sresult0, left_svalues[mask_ & 0x3]); |
| 4513 __ vmovs(sresult1, left_svalues[(mask_ >> 2) & 0x3]); | 4371 __ vmovs(sresult1, left_svalues[(mask_ >> 2) & 0x3]); |
| 4514 __ vmovs(sresult2, right_svalues[(mask_ >> 4) & 0x3]); | 4372 __ vmovs(sresult2, right_svalues[(mask_ >> 4) & 0x3]); |
| 4515 __ vmovs(sresult3, right_svalues[(mask_ >> 6) & 0x3]); | 4373 __ vmovs(sresult3, right_svalues[(mask_ >> 6) & 0x3]); |
| 4516 break; | 4374 break; |
| 4517 default: | 4375 default: |
| 4518 UNREACHABLE(); | 4376 UNREACHABLE(); |
| 4519 } | 4377 } |
| 4520 } | 4378 } |
| 4521 | 4379 |
| 4522 | |
| 4523 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone, | 4380 LocationSummary* Simd32x4GetSignMaskInstr::MakeLocationSummary(Zone* zone, |
| 4524 bool opt) const { | 4381 bool opt) const { |
| 4525 const intptr_t kNumInputs = 1; | 4382 const intptr_t kNumInputs = 1; |
| 4526 const intptr_t kNumTemps = 1; | 4383 const intptr_t kNumTemps = 1; |
| 4527 LocationSummary* summary = new (zone) | 4384 LocationSummary* summary = new (zone) |
| 4528 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4385 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4529 summary->set_in(0, Location::FpuRegisterLocation(Q5)); | 4386 summary->set_in(0, Location::FpuRegisterLocation(Q5)); |
| 4530 summary->set_temp(0, Location::RequiresRegister()); | 4387 summary->set_temp(0, Location::RequiresRegister()); |
| 4531 summary->set_out(0, Location::RequiresRegister()); | 4388 summary->set_out(0, Location::RequiresRegister()); |
| 4532 return summary; | 4389 return summary; |
| 4533 } | 4390 } |
| 4534 | 4391 |
| 4535 | |
| 4536 void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4392 void Simd32x4GetSignMaskInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4537 const QRegister value = locs()->in(0).fpu_reg(); | 4393 const QRegister value = locs()->in(0).fpu_reg(); |
| 4538 const DRegister dvalue0 = EvenDRegisterOf(value); | 4394 const DRegister dvalue0 = EvenDRegisterOf(value); |
| 4539 const DRegister dvalue1 = OddDRegisterOf(value); | 4395 const DRegister dvalue1 = OddDRegisterOf(value); |
| 4540 | 4396 |
| 4541 const Register out = locs()->out(0).reg(); | 4397 const Register out = locs()->out(0).reg(); |
| 4542 const Register temp = locs()->temp(0).reg(); | 4398 const Register temp = locs()->temp(0).reg(); |
| 4543 | 4399 |
| 4544 // X lane. | 4400 // X lane. |
| 4545 __ vmovrs(out, EvenSRegisterOf(dvalue0)); | 4401 __ vmovrs(out, EvenSRegisterOf(dvalue0)); |
| 4546 __ Lsr(out, out, Operand(31)); | 4402 __ Lsr(out, out, Operand(31)); |
| 4547 // Y lane. | 4403 // Y lane. |
| 4548 __ vmovrs(temp, OddSRegisterOf(dvalue0)); | 4404 __ vmovrs(temp, OddSRegisterOf(dvalue0)); |
| 4549 __ Lsr(temp, temp, Operand(31)); | 4405 __ Lsr(temp, temp, Operand(31)); |
| 4550 __ orr(out, out, Operand(temp, LSL, 1)); | 4406 __ orr(out, out, Operand(temp, LSL, 1)); |
| 4551 // Z lane. | 4407 // Z lane. |
| 4552 __ vmovrs(temp, EvenSRegisterOf(dvalue1)); | 4408 __ vmovrs(temp, EvenSRegisterOf(dvalue1)); |
| 4553 __ Lsr(temp, temp, Operand(31)); | 4409 __ Lsr(temp, temp, Operand(31)); |
| 4554 __ orr(out, out, Operand(temp, LSL, 2)); | 4410 __ orr(out, out, Operand(temp, LSL, 2)); |
| 4555 // W lane. | 4411 // W lane. |
| 4556 __ vmovrs(temp, OddSRegisterOf(dvalue1)); | 4412 __ vmovrs(temp, OddSRegisterOf(dvalue1)); |
| 4557 __ Lsr(temp, temp, Operand(31)); | 4413 __ Lsr(temp, temp, Operand(31)); |
| 4558 __ orr(out, out, Operand(temp, LSL, 3)); | 4414 __ orr(out, out, Operand(temp, LSL, 3)); |
| 4559 // Tag. | 4415 // Tag. |
| 4560 __ SmiTag(out); | 4416 __ SmiTag(out); |
| 4561 } | 4417 } |
| 4562 | 4418 |
| 4563 | |
| 4564 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( | 4419 LocationSummary* Float32x4ConstructorInstr::MakeLocationSummary( |
| 4565 Zone* zone, | 4420 Zone* zone, |
| 4566 bool opt) const { | 4421 bool opt) const { |
| 4567 const intptr_t kNumInputs = 4; | 4422 const intptr_t kNumInputs = 4; |
| 4568 const intptr_t kNumTemps = 0; | 4423 const intptr_t kNumTemps = 0; |
| 4569 LocationSummary* summary = new (zone) | 4424 LocationSummary* summary = new (zone) |
| 4570 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4425 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4571 summary->set_in(0, Location::RequiresFpuRegister()); | 4426 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4572 summary->set_in(1, Location::RequiresFpuRegister()); | 4427 summary->set_in(1, Location::RequiresFpuRegister()); |
| 4573 summary->set_in(2, Location::RequiresFpuRegister()); | 4428 summary->set_in(2, Location::RequiresFpuRegister()); |
| 4574 summary->set_in(3, Location::RequiresFpuRegister()); | 4429 summary->set_in(3, Location::RequiresFpuRegister()); |
| 4575 // Low (< 7) Q registers are needed for the vcvtsd instruction. | 4430 // Low (< 7) Q registers are needed for the vcvtsd instruction. |
| 4576 summary->set_out(0, Location::FpuRegisterLocation(Q6)); | 4431 summary->set_out(0, Location::FpuRegisterLocation(Q6)); |
| 4577 return summary; | 4432 return summary; |
| 4578 } | 4433 } |
| 4579 | 4434 |
| 4580 | |
| 4581 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4435 void Float32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4582 const QRegister q0 = locs()->in(0).fpu_reg(); | 4436 const QRegister q0 = locs()->in(0).fpu_reg(); |
| 4583 const QRegister q1 = locs()->in(1).fpu_reg(); | 4437 const QRegister q1 = locs()->in(1).fpu_reg(); |
| 4584 const QRegister q2 = locs()->in(2).fpu_reg(); | 4438 const QRegister q2 = locs()->in(2).fpu_reg(); |
| 4585 const QRegister q3 = locs()->in(3).fpu_reg(); | 4439 const QRegister q3 = locs()->in(3).fpu_reg(); |
| 4586 const QRegister r = locs()->out(0).fpu_reg(); | 4440 const QRegister r = locs()->out(0).fpu_reg(); |
| 4587 | 4441 |
| 4588 const DRegister dr0 = EvenDRegisterOf(r); | 4442 const DRegister dr0 = EvenDRegisterOf(r); |
| 4589 const DRegister dr1 = OddDRegisterOf(r); | 4443 const DRegister dr1 = OddDRegisterOf(r); |
| 4590 | 4444 |
| 4591 __ vcvtsd(EvenSRegisterOf(dr0), EvenDRegisterOf(q0)); | 4445 __ vcvtsd(EvenSRegisterOf(dr0), EvenDRegisterOf(q0)); |
| 4592 __ vcvtsd(OddSRegisterOf(dr0), EvenDRegisterOf(q1)); | 4446 __ vcvtsd(OddSRegisterOf(dr0), EvenDRegisterOf(q1)); |
| 4593 __ vcvtsd(EvenSRegisterOf(dr1), EvenDRegisterOf(q2)); | 4447 __ vcvtsd(EvenSRegisterOf(dr1), EvenDRegisterOf(q2)); |
| 4594 __ vcvtsd(OddSRegisterOf(dr1), EvenDRegisterOf(q3)); | 4448 __ vcvtsd(OddSRegisterOf(dr1), EvenDRegisterOf(q3)); |
| 4595 } | 4449 } |
| 4596 | 4450 |
| 4597 | |
| 4598 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone, | 4451 LocationSummary* Float32x4ZeroInstr::MakeLocationSummary(Zone* zone, |
| 4599 bool opt) const { | 4452 bool opt) const { |
| 4600 const intptr_t kNumInputs = 0; | 4453 const intptr_t kNumInputs = 0; |
| 4601 const intptr_t kNumTemps = 0; | 4454 const intptr_t kNumTemps = 0; |
| 4602 LocationSummary* summary = new (zone) | 4455 LocationSummary* summary = new (zone) |
| 4603 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4456 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4604 summary->set_out(0, Location::RequiresFpuRegister()); | 4457 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4605 return summary; | 4458 return summary; |
| 4606 } | 4459 } |
| 4607 | 4460 |
| 4608 | |
| 4609 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4461 void Float32x4ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4610 const QRegister q = locs()->out(0).fpu_reg(); | 4462 const QRegister q = locs()->out(0).fpu_reg(); |
| 4611 __ veorq(q, q, q); | 4463 __ veorq(q, q, q); |
| 4612 } | 4464 } |
| 4613 | 4465 |
| 4614 | |
| 4615 LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone, | 4466 LocationSummary* Float32x4SplatInstr::MakeLocationSummary(Zone* zone, |
| 4616 bool opt) const { | 4467 bool opt) const { |
| 4617 const intptr_t kNumInputs = 1; | 4468 const intptr_t kNumInputs = 1; |
| 4618 const intptr_t kNumTemps = 0; | 4469 const intptr_t kNumTemps = 0; |
| 4619 LocationSummary* summary = new (zone) | 4470 LocationSummary* summary = new (zone) |
| 4620 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4471 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4621 summary->set_in(0, Location::RequiresFpuRegister()); | 4472 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4622 summary->set_out(0, Location::RequiresFpuRegister()); | 4473 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4623 return summary; | 4474 return summary; |
| 4624 } | 4475 } |
| 4625 | 4476 |
| 4626 | |
| 4627 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4477 void Float32x4SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4628 const QRegister value = locs()->in(0).fpu_reg(); | 4478 const QRegister value = locs()->in(0).fpu_reg(); |
| 4629 const QRegister result = locs()->out(0).fpu_reg(); | 4479 const QRegister result = locs()->out(0).fpu_reg(); |
| 4630 | 4480 |
| 4631 const DRegister dvalue0 = EvenDRegisterOf(value); | 4481 const DRegister dvalue0 = EvenDRegisterOf(value); |
| 4632 | 4482 |
| 4633 // Convert to Float32. | 4483 // Convert to Float32. |
| 4634 __ vcvtsd(STMP, dvalue0); | 4484 __ vcvtsd(STMP, dvalue0); |
| 4635 | 4485 |
| 4636 // Splat across all lanes. | 4486 // Splat across all lanes. |
| 4637 __ vdup(kWord, result, DTMP, 0); | 4487 __ vdup(kWord, result, DTMP, 0); |
| 4638 } | 4488 } |
| 4639 | 4489 |
| 4640 | |
| 4641 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone, | 4490 LocationSummary* Float32x4ComparisonInstr::MakeLocationSummary(Zone* zone, |
| 4642 bool opt) const { | 4491 bool opt) const { |
| 4643 const intptr_t kNumInputs = 2; | 4492 const intptr_t kNumInputs = 2; |
| 4644 const intptr_t kNumTemps = 0; | 4493 const intptr_t kNumTemps = 0; |
| 4645 LocationSummary* summary = new (zone) | 4494 LocationSummary* summary = new (zone) |
| 4646 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4495 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4647 summary->set_in(0, Location::RequiresFpuRegister()); | 4496 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4648 summary->set_in(1, Location::RequiresFpuRegister()); | 4497 summary->set_in(1, Location::RequiresFpuRegister()); |
| 4649 summary->set_out(0, Location::RequiresFpuRegister()); | 4498 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4650 return summary; | 4499 return summary; |
| 4651 } | 4500 } |
| 4652 | 4501 |
| 4653 | |
| 4654 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4502 void Float32x4ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4655 const QRegister left = locs()->in(0).fpu_reg(); | 4503 const QRegister left = locs()->in(0).fpu_reg(); |
| 4656 const QRegister right = locs()->in(1).fpu_reg(); | 4504 const QRegister right = locs()->in(1).fpu_reg(); |
| 4657 const QRegister result = locs()->out(0).fpu_reg(); | 4505 const QRegister result = locs()->out(0).fpu_reg(); |
| 4658 | 4506 |
| 4659 switch (op_kind()) { | 4507 switch (op_kind()) { |
| 4660 case MethodRecognizer::kFloat32x4Equal: | 4508 case MethodRecognizer::kFloat32x4Equal: |
| 4661 __ vceqqs(result, left, right); | 4509 __ vceqqs(result, left, right); |
| 4662 break; | 4510 break; |
| 4663 case MethodRecognizer::kFloat32x4NotEqual: | 4511 case MethodRecognizer::kFloat32x4NotEqual: |
| (...skipping 12 matching lines...) Expand all Loading... |
| 4676 break; | 4524 break; |
| 4677 case MethodRecognizer::kFloat32x4LessThanOrEqual: | 4525 case MethodRecognizer::kFloat32x4LessThanOrEqual: |
| 4678 __ vcgeqs(result, right, left); | 4526 __ vcgeqs(result, right, left); |
| 4679 break; | 4527 break; |
| 4680 | 4528 |
| 4681 default: | 4529 default: |
| 4682 UNREACHABLE(); | 4530 UNREACHABLE(); |
| 4683 } | 4531 } |
| 4684 } | 4532 } |
| 4685 | 4533 |
| 4686 | |
| 4687 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone, | 4534 LocationSummary* Float32x4MinMaxInstr::MakeLocationSummary(Zone* zone, |
| 4688 bool opt) const { | 4535 bool opt) const { |
| 4689 const intptr_t kNumInputs = 2; | 4536 const intptr_t kNumInputs = 2; |
| 4690 const intptr_t kNumTemps = 0; | 4537 const intptr_t kNumTemps = 0; |
| 4691 LocationSummary* summary = new (zone) | 4538 LocationSummary* summary = new (zone) |
| 4692 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4539 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4693 summary->set_in(0, Location::RequiresFpuRegister()); | 4540 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4694 summary->set_in(1, Location::RequiresFpuRegister()); | 4541 summary->set_in(1, Location::RequiresFpuRegister()); |
| 4695 summary->set_out(0, Location::RequiresFpuRegister()); | 4542 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4696 return summary; | 4543 return summary; |
| 4697 } | 4544 } |
| 4698 | 4545 |
| 4699 | |
| 4700 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4546 void Float32x4MinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4701 const QRegister left = locs()->in(0).fpu_reg(); | 4547 const QRegister left = locs()->in(0).fpu_reg(); |
| 4702 const QRegister right = locs()->in(1).fpu_reg(); | 4548 const QRegister right = locs()->in(1).fpu_reg(); |
| 4703 const QRegister result = locs()->out(0).fpu_reg(); | 4549 const QRegister result = locs()->out(0).fpu_reg(); |
| 4704 | 4550 |
| 4705 switch (op_kind()) { | 4551 switch (op_kind()) { |
| 4706 case MethodRecognizer::kFloat32x4Min: | 4552 case MethodRecognizer::kFloat32x4Min: |
| 4707 __ vminqs(result, left, right); | 4553 __ vminqs(result, left, right); |
| 4708 break; | 4554 break; |
| 4709 case MethodRecognizer::kFloat32x4Max: | 4555 case MethodRecognizer::kFloat32x4Max: |
| 4710 __ vmaxqs(result, left, right); | 4556 __ vmaxqs(result, left, right); |
| 4711 break; | 4557 break; |
| 4712 default: | 4558 default: |
| 4713 UNREACHABLE(); | 4559 UNREACHABLE(); |
| 4714 } | 4560 } |
| 4715 } | 4561 } |
| 4716 | 4562 |
| 4717 | |
| 4718 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone, | 4563 LocationSummary* Float32x4SqrtInstr::MakeLocationSummary(Zone* zone, |
| 4719 bool opt) const { | 4564 bool opt) const { |
| 4720 const intptr_t kNumInputs = 1; | 4565 const intptr_t kNumInputs = 1; |
| 4721 const intptr_t kNumTemps = 1; | 4566 const intptr_t kNumTemps = 1; |
| 4722 LocationSummary* summary = new (zone) | 4567 LocationSummary* summary = new (zone) |
| 4723 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4568 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4724 summary->set_in(0, Location::RequiresFpuRegister()); | 4569 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4725 summary->set_out(0, Location::RequiresFpuRegister()); | 4570 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4726 summary->set_temp(0, Location::RequiresFpuRegister()); | 4571 summary->set_temp(0, Location::RequiresFpuRegister()); |
| 4727 return summary; | 4572 return summary; |
| 4728 } | 4573 } |
| 4729 | 4574 |
| 4730 | |
| 4731 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4575 void Float32x4SqrtInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4732 const QRegister left = locs()->in(0).fpu_reg(); | 4576 const QRegister left = locs()->in(0).fpu_reg(); |
| 4733 const QRegister result = locs()->out(0).fpu_reg(); | 4577 const QRegister result = locs()->out(0).fpu_reg(); |
| 4734 const QRegister temp = locs()->temp(0).fpu_reg(); | 4578 const QRegister temp = locs()->temp(0).fpu_reg(); |
| 4735 | 4579 |
| 4736 switch (op_kind()) { | 4580 switch (op_kind()) { |
| 4737 case MethodRecognizer::kFloat32x4Sqrt: | 4581 case MethodRecognizer::kFloat32x4Sqrt: |
| 4738 __ Vsqrtqs(result, left, temp); | 4582 __ Vsqrtqs(result, left, temp); |
| 4739 break; | 4583 break; |
| 4740 case MethodRecognizer::kFloat32x4Reciprocal: | 4584 case MethodRecognizer::kFloat32x4Reciprocal: |
| 4741 __ Vreciprocalqs(result, left); | 4585 __ Vreciprocalqs(result, left); |
| 4742 break; | 4586 break; |
| 4743 case MethodRecognizer::kFloat32x4ReciprocalSqrt: | 4587 case MethodRecognizer::kFloat32x4ReciprocalSqrt: |
| 4744 __ VreciprocalSqrtqs(result, left); | 4588 __ VreciprocalSqrtqs(result, left); |
| 4745 break; | 4589 break; |
| 4746 default: | 4590 default: |
| 4747 UNREACHABLE(); | 4591 UNREACHABLE(); |
| 4748 } | 4592 } |
| 4749 } | 4593 } |
| 4750 | 4594 |
| 4751 | |
| 4752 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone, | 4595 LocationSummary* Float32x4ScaleInstr::MakeLocationSummary(Zone* zone, |
| 4753 bool opt) const { | 4596 bool opt) const { |
| 4754 const intptr_t kNumInputs = 2; | 4597 const intptr_t kNumInputs = 2; |
| 4755 const intptr_t kNumTemps = 0; | 4598 const intptr_t kNumTemps = 0; |
| 4756 LocationSummary* summary = new (zone) | 4599 LocationSummary* summary = new (zone) |
| 4757 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4600 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4758 summary->set_in(0, Location::RequiresFpuRegister()); | 4601 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4759 summary->set_in(1, Location::RequiresFpuRegister()); | 4602 summary->set_in(1, Location::RequiresFpuRegister()); |
| 4760 summary->set_out(0, Location::RequiresFpuRegister()); | 4603 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4761 return summary; | 4604 return summary; |
| 4762 } | 4605 } |
| 4763 | 4606 |
| 4764 | |
| 4765 void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4607 void Float32x4ScaleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4766 const QRegister left = locs()->in(0).fpu_reg(); | 4608 const QRegister left = locs()->in(0).fpu_reg(); |
| 4767 const QRegister right = locs()->in(1).fpu_reg(); | 4609 const QRegister right = locs()->in(1).fpu_reg(); |
| 4768 const QRegister result = locs()->out(0).fpu_reg(); | 4610 const QRegister result = locs()->out(0).fpu_reg(); |
| 4769 | 4611 |
| 4770 switch (op_kind()) { | 4612 switch (op_kind()) { |
| 4771 case MethodRecognizer::kFloat32x4Scale: | 4613 case MethodRecognizer::kFloat32x4Scale: |
| 4772 __ vcvtsd(STMP, EvenDRegisterOf(left)); | 4614 __ vcvtsd(STMP, EvenDRegisterOf(left)); |
| 4773 __ vdup(kWord, result, DTMP, 0); | 4615 __ vdup(kWord, result, DTMP, 0); |
| 4774 __ vmulqs(result, result, right); | 4616 __ vmulqs(result, result, right); |
| 4775 break; | 4617 break; |
| 4776 default: | 4618 default: |
| 4777 UNREACHABLE(); | 4619 UNREACHABLE(); |
| 4778 } | 4620 } |
| 4779 } | 4621 } |
| 4780 | 4622 |
| 4781 | |
| 4782 LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone, | 4623 LocationSummary* Float32x4ZeroArgInstr::MakeLocationSummary(Zone* zone, |
| 4783 bool opt) const { | 4624 bool opt) const { |
| 4784 const intptr_t kNumInputs = 1; | 4625 const intptr_t kNumInputs = 1; |
| 4785 const intptr_t kNumTemps = 0; | 4626 const intptr_t kNumTemps = 0; |
| 4786 LocationSummary* summary = new (zone) | 4627 LocationSummary* summary = new (zone) |
| 4787 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4628 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4788 summary->set_in(0, Location::RequiresFpuRegister()); | 4629 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4789 summary->set_out(0, Location::RequiresFpuRegister()); | 4630 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4790 return summary; | 4631 return summary; |
| 4791 } | 4632 } |
| 4792 | 4633 |
| 4793 | |
| 4794 void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4634 void Float32x4ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4795 const QRegister left = locs()->in(0).fpu_reg(); | 4635 const QRegister left = locs()->in(0).fpu_reg(); |
| 4796 const QRegister result = locs()->out(0).fpu_reg(); | 4636 const QRegister result = locs()->out(0).fpu_reg(); |
| 4797 | 4637 |
| 4798 switch (op_kind()) { | 4638 switch (op_kind()) { |
| 4799 case MethodRecognizer::kFloat32x4Negate: | 4639 case MethodRecognizer::kFloat32x4Negate: |
| 4800 __ vnegqs(result, left); | 4640 __ vnegqs(result, left); |
| 4801 break; | 4641 break; |
| 4802 case MethodRecognizer::kFloat32x4Absolute: | 4642 case MethodRecognizer::kFloat32x4Absolute: |
| 4803 __ vabsqs(result, left); | 4643 __ vabsqs(result, left); |
| 4804 break; | 4644 break; |
| 4805 default: | 4645 default: |
| 4806 UNREACHABLE(); | 4646 UNREACHABLE(); |
| 4807 } | 4647 } |
| 4808 } | 4648 } |
| 4809 | 4649 |
| 4810 | |
| 4811 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone, | 4650 LocationSummary* Float32x4ClampInstr::MakeLocationSummary(Zone* zone, |
| 4812 bool opt) const { | 4651 bool opt) const { |
| 4813 const intptr_t kNumInputs = 3; | 4652 const intptr_t kNumInputs = 3; |
| 4814 const intptr_t kNumTemps = 0; | 4653 const intptr_t kNumTemps = 0; |
| 4815 LocationSummary* summary = new (zone) | 4654 LocationSummary* summary = new (zone) |
| 4816 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4655 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4817 summary->set_in(0, Location::RequiresFpuRegister()); | 4656 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4818 summary->set_in(1, Location::RequiresFpuRegister()); | 4657 summary->set_in(1, Location::RequiresFpuRegister()); |
| 4819 summary->set_in(2, Location::RequiresFpuRegister()); | 4658 summary->set_in(2, Location::RequiresFpuRegister()); |
| 4820 summary->set_out(0, Location::RequiresFpuRegister()); | 4659 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4821 return summary; | 4660 return summary; |
| 4822 } | 4661 } |
| 4823 | 4662 |
| 4824 | |
| 4825 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4663 void Float32x4ClampInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4826 const QRegister left = locs()->in(0).fpu_reg(); | 4664 const QRegister left = locs()->in(0).fpu_reg(); |
| 4827 const QRegister lower = locs()->in(1).fpu_reg(); | 4665 const QRegister lower = locs()->in(1).fpu_reg(); |
| 4828 const QRegister upper = locs()->in(2).fpu_reg(); | 4666 const QRegister upper = locs()->in(2).fpu_reg(); |
| 4829 const QRegister result = locs()->out(0).fpu_reg(); | 4667 const QRegister result = locs()->out(0).fpu_reg(); |
| 4830 __ vminqs(result, left, upper); | 4668 __ vminqs(result, left, upper); |
| 4831 __ vmaxqs(result, result, lower); | 4669 __ vmaxqs(result, result, lower); |
| 4832 } | 4670 } |
| 4833 | 4671 |
| 4834 | |
| 4835 LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone, | 4672 LocationSummary* Float32x4WithInstr::MakeLocationSummary(Zone* zone, |
| 4836 bool opt) const { | 4673 bool opt) const { |
| 4837 const intptr_t kNumInputs = 2; | 4674 const intptr_t kNumInputs = 2; |
| 4838 const intptr_t kNumTemps = 0; | 4675 const intptr_t kNumTemps = 0; |
| 4839 LocationSummary* summary = new (zone) | 4676 LocationSummary* summary = new (zone) |
| 4840 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4677 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4841 summary->set_in(0, Location::RequiresFpuRegister()); | 4678 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4842 summary->set_in(1, Location::RequiresFpuRegister()); | 4679 summary->set_in(1, Location::RequiresFpuRegister()); |
| 4843 // Low (< 7) Q registers are needed for the vmovs instruction. | 4680 // Low (< 7) Q registers are needed for the vmovs instruction. |
| 4844 summary->set_out(0, Location::FpuRegisterLocation(Q6)); | 4681 summary->set_out(0, Location::FpuRegisterLocation(Q6)); |
| 4845 return summary; | 4682 return summary; |
| 4846 } | 4683 } |
| 4847 | 4684 |
| 4848 | |
| 4849 void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4685 void Float32x4WithInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4850 const QRegister replacement = locs()->in(0).fpu_reg(); | 4686 const QRegister replacement = locs()->in(0).fpu_reg(); |
| 4851 const QRegister value = locs()->in(1).fpu_reg(); | 4687 const QRegister value = locs()->in(1).fpu_reg(); |
| 4852 const QRegister result = locs()->out(0).fpu_reg(); | 4688 const QRegister result = locs()->out(0).fpu_reg(); |
| 4853 | 4689 |
| 4854 const DRegister dresult0 = EvenDRegisterOf(result); | 4690 const DRegister dresult0 = EvenDRegisterOf(result); |
| 4855 const DRegister dresult1 = OddDRegisterOf(result); | 4691 const DRegister dresult1 = OddDRegisterOf(result); |
| 4856 const SRegister sresult0 = EvenSRegisterOf(dresult0); | 4692 const SRegister sresult0 = EvenSRegisterOf(dresult0); |
| 4857 const SRegister sresult1 = OddSRegisterOf(dresult0); | 4693 const SRegister sresult1 = OddSRegisterOf(dresult0); |
| 4858 const SRegister sresult2 = EvenSRegisterOf(dresult1); | 4694 const SRegister sresult2 = EvenSRegisterOf(dresult1); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 4874 __ vmovs(sresult2, STMP); | 4710 __ vmovs(sresult2, STMP); |
| 4875 break; | 4711 break; |
| 4876 case MethodRecognizer::kFloat32x4WithW: | 4712 case MethodRecognizer::kFloat32x4WithW: |
| 4877 __ vmovs(sresult3, STMP); | 4713 __ vmovs(sresult3, STMP); |
| 4878 break; | 4714 break; |
| 4879 default: | 4715 default: |
| 4880 UNREACHABLE(); | 4716 UNREACHABLE(); |
| 4881 } | 4717 } |
| 4882 } | 4718 } |
| 4883 | 4719 |
| 4884 | |
| 4885 LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone, | 4720 LocationSummary* Float32x4ToInt32x4Instr::MakeLocationSummary(Zone* zone, |
| 4886 bool opt) const { | 4721 bool opt) const { |
| 4887 const intptr_t kNumInputs = 1; | 4722 const intptr_t kNumInputs = 1; |
| 4888 const intptr_t kNumTemps = 0; | 4723 const intptr_t kNumTemps = 0; |
| 4889 LocationSummary* summary = new (zone) | 4724 LocationSummary* summary = new (zone) |
| 4890 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4725 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4891 summary->set_in(0, Location::RequiresFpuRegister()); | 4726 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4892 summary->set_out(0, Location::RequiresFpuRegister()); | 4727 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4893 return summary; | 4728 return summary; |
| 4894 } | 4729 } |
| 4895 | 4730 |
| 4896 | |
| 4897 void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4731 void Float32x4ToInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4898 const QRegister value = locs()->in(0).fpu_reg(); | 4732 const QRegister value = locs()->in(0).fpu_reg(); |
| 4899 const QRegister result = locs()->out(0).fpu_reg(); | 4733 const QRegister result = locs()->out(0).fpu_reg(); |
| 4900 | 4734 |
| 4901 if (value != result) { | 4735 if (value != result) { |
| 4902 __ vmovq(result, value); | 4736 __ vmovq(result, value); |
| 4903 } | 4737 } |
| 4904 } | 4738 } |
| 4905 | 4739 |
| 4906 | |
| 4907 LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone, | 4740 LocationSummary* Simd64x2ShuffleInstr::MakeLocationSummary(Zone* zone, |
| 4908 bool opt) const { | 4741 bool opt) const { |
| 4909 const intptr_t kNumInputs = 1; | 4742 const intptr_t kNumInputs = 1; |
| 4910 const intptr_t kNumTemps = 0; | 4743 const intptr_t kNumTemps = 0; |
| 4911 LocationSummary* summary = new (zone) | 4744 LocationSummary* summary = new (zone) |
| 4912 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4745 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4913 summary->set_in(0, Location::RequiresFpuRegister()); | 4746 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4914 summary->set_out(0, Location::RequiresFpuRegister()); | 4747 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4915 return summary; | 4748 return summary; |
| 4916 } | 4749 } |
| 4917 | 4750 |
| 4918 | |
| 4919 void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4751 void Simd64x2ShuffleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4920 const QRegister value = locs()->in(0).fpu_reg(); | 4752 const QRegister value = locs()->in(0).fpu_reg(); |
| 4921 | 4753 |
| 4922 const DRegister dvalue0 = EvenDRegisterOf(value); | 4754 const DRegister dvalue0 = EvenDRegisterOf(value); |
| 4923 const DRegister dvalue1 = OddDRegisterOf(value); | 4755 const DRegister dvalue1 = OddDRegisterOf(value); |
| 4924 | 4756 |
| 4925 const QRegister result = locs()->out(0).fpu_reg(); | 4757 const QRegister result = locs()->out(0).fpu_reg(); |
| 4926 | 4758 |
| 4927 const DRegister dresult0 = EvenDRegisterOf(result); | 4759 const DRegister dresult0 = EvenDRegisterOf(result); |
| 4928 | 4760 |
| 4929 switch (op_kind()) { | 4761 switch (op_kind()) { |
| 4930 case MethodRecognizer::kFloat64x2GetX: | 4762 case MethodRecognizer::kFloat64x2GetX: |
| 4931 __ vmovd(dresult0, dvalue0); | 4763 __ vmovd(dresult0, dvalue0); |
| 4932 break; | 4764 break; |
| 4933 case MethodRecognizer::kFloat64x2GetY: | 4765 case MethodRecognizer::kFloat64x2GetY: |
| 4934 __ vmovd(dresult0, dvalue1); | 4766 __ vmovd(dresult0, dvalue1); |
| 4935 break; | 4767 break; |
| 4936 default: | 4768 default: |
| 4937 UNREACHABLE(); | 4769 UNREACHABLE(); |
| 4938 } | 4770 } |
| 4939 } | 4771 } |
| 4940 | 4772 |
| 4941 | |
| 4942 LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone, | 4773 LocationSummary* Float64x2ZeroInstr::MakeLocationSummary(Zone* zone, |
| 4943 bool opt) const { | 4774 bool opt) const { |
| 4944 const intptr_t kNumInputs = 0; | 4775 const intptr_t kNumInputs = 0; |
| 4945 const intptr_t kNumTemps = 0; | 4776 const intptr_t kNumTemps = 0; |
| 4946 LocationSummary* summary = new (zone) | 4777 LocationSummary* summary = new (zone) |
| 4947 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4778 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4948 summary->set_out(0, Location::RequiresFpuRegister()); | 4779 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4949 return summary; | 4780 return summary; |
| 4950 } | 4781 } |
| 4951 | 4782 |
| 4952 | |
| 4953 void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4783 void Float64x2ZeroInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4954 const QRegister q = locs()->out(0).fpu_reg(); | 4784 const QRegister q = locs()->out(0).fpu_reg(); |
| 4955 __ veorq(q, q, q); | 4785 __ veorq(q, q, q); |
| 4956 } | 4786 } |
| 4957 | 4787 |
| 4958 | |
| 4959 LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone, | 4788 LocationSummary* Float64x2SplatInstr::MakeLocationSummary(Zone* zone, |
| 4960 bool opt) const { | 4789 bool opt) const { |
| 4961 const intptr_t kNumInputs = 1; | 4790 const intptr_t kNumInputs = 1; |
| 4962 const intptr_t kNumTemps = 0; | 4791 const intptr_t kNumTemps = 0; |
| 4963 LocationSummary* summary = new (zone) | 4792 LocationSummary* summary = new (zone) |
| 4964 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4793 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4965 summary->set_in(0, Location::RequiresFpuRegister()); | 4794 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4966 summary->set_out(0, Location::RequiresFpuRegister()); | 4795 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4967 return summary; | 4796 return summary; |
| 4968 } | 4797 } |
| 4969 | 4798 |
| 4970 | |
| 4971 void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4799 void Float64x2SplatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 4972 const QRegister value = locs()->in(0).fpu_reg(); | 4800 const QRegister value = locs()->in(0).fpu_reg(); |
| 4973 | 4801 |
| 4974 const DRegister dvalue = EvenDRegisterOf(value); | 4802 const DRegister dvalue = EvenDRegisterOf(value); |
| 4975 | 4803 |
| 4976 const QRegister result = locs()->out(0).fpu_reg(); | 4804 const QRegister result = locs()->out(0).fpu_reg(); |
| 4977 | 4805 |
| 4978 const DRegister dresult0 = EvenDRegisterOf(result); | 4806 const DRegister dresult0 = EvenDRegisterOf(result); |
| 4979 const DRegister dresult1 = OddDRegisterOf(result); | 4807 const DRegister dresult1 = OddDRegisterOf(result); |
| 4980 | 4808 |
| 4981 // Splat across all lanes. | 4809 // Splat across all lanes. |
| 4982 __ vmovd(dresult0, dvalue); | 4810 __ vmovd(dresult0, dvalue); |
| 4983 __ vmovd(dresult1, dvalue); | 4811 __ vmovd(dresult1, dvalue); |
| 4984 } | 4812 } |
| 4985 | 4813 |
| 4986 | |
| 4987 LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( | 4814 LocationSummary* Float64x2ConstructorInstr::MakeLocationSummary( |
| 4988 Zone* zone, | 4815 Zone* zone, |
| 4989 bool opt) const { | 4816 bool opt) const { |
| 4990 const intptr_t kNumInputs = 2; | 4817 const intptr_t kNumInputs = 2; |
| 4991 const intptr_t kNumTemps = 0; | 4818 const intptr_t kNumTemps = 0; |
| 4992 LocationSummary* summary = new (zone) | 4819 LocationSummary* summary = new (zone) |
| 4993 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4820 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 4994 summary->set_in(0, Location::RequiresFpuRegister()); | 4821 summary->set_in(0, Location::RequiresFpuRegister()); |
| 4995 summary->set_in(1, Location::RequiresFpuRegister()); | 4822 summary->set_in(1, Location::RequiresFpuRegister()); |
| 4996 summary->set_out(0, Location::RequiresFpuRegister()); | 4823 summary->set_out(0, Location::RequiresFpuRegister()); |
| 4997 return summary; | 4824 return summary; |
| 4998 } | 4825 } |
| 4999 | 4826 |
| 5000 | |
| 5001 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4827 void Float64x2ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5002 const QRegister q0 = locs()->in(0).fpu_reg(); | 4828 const QRegister q0 = locs()->in(0).fpu_reg(); |
| 5003 const QRegister q1 = locs()->in(1).fpu_reg(); | 4829 const QRegister q1 = locs()->in(1).fpu_reg(); |
| 5004 const QRegister r = locs()->out(0).fpu_reg(); | 4830 const QRegister r = locs()->out(0).fpu_reg(); |
| 5005 | 4831 |
| 5006 const DRegister d0 = EvenDRegisterOf(q0); | 4832 const DRegister d0 = EvenDRegisterOf(q0); |
| 5007 const DRegister d1 = EvenDRegisterOf(q1); | 4833 const DRegister d1 = EvenDRegisterOf(q1); |
| 5008 | 4834 |
| 5009 const DRegister dr0 = EvenDRegisterOf(r); | 4835 const DRegister dr0 = EvenDRegisterOf(r); |
| 5010 const DRegister dr1 = OddDRegisterOf(r); | 4836 const DRegister dr1 = OddDRegisterOf(r); |
| 5011 | 4837 |
| 5012 __ vmovd(dr0, d0); | 4838 __ vmovd(dr0, d0); |
| 5013 __ vmovd(dr1, d1); | 4839 __ vmovd(dr1, d1); |
| 5014 } | 4840 } |
| 5015 | 4841 |
| 5016 | |
| 5017 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( | 4842 LocationSummary* Float64x2ToFloat32x4Instr::MakeLocationSummary( |
| 5018 Zone* zone, | 4843 Zone* zone, |
| 5019 bool opt) const { | 4844 bool opt) const { |
| 5020 const intptr_t kNumInputs = 1; | 4845 const intptr_t kNumInputs = 1; |
| 5021 const intptr_t kNumTemps = 0; | 4846 const intptr_t kNumTemps = 0; |
| 5022 LocationSummary* summary = new (zone) | 4847 LocationSummary* summary = new (zone) |
| 5023 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4848 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5024 summary->set_in(0, Location::RequiresFpuRegister()); | 4849 summary->set_in(0, Location::RequiresFpuRegister()); |
| 5025 // Low (< 7) Q registers are needed for the vcvtsd instruction. | 4850 // Low (< 7) Q registers are needed for the vcvtsd instruction. |
| 5026 summary->set_out(0, Location::FpuRegisterLocation(Q6)); | 4851 summary->set_out(0, Location::FpuRegisterLocation(Q6)); |
| 5027 return summary; | 4852 return summary; |
| 5028 } | 4853 } |
| 5029 | 4854 |
| 5030 | |
| 5031 void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4855 void Float64x2ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5032 const QRegister q = locs()->in(0).fpu_reg(); | 4856 const QRegister q = locs()->in(0).fpu_reg(); |
| 5033 const QRegister r = locs()->out(0).fpu_reg(); | 4857 const QRegister r = locs()->out(0).fpu_reg(); |
| 5034 | 4858 |
| 5035 const DRegister dq0 = EvenDRegisterOf(q); | 4859 const DRegister dq0 = EvenDRegisterOf(q); |
| 5036 const DRegister dq1 = OddDRegisterOf(q); | 4860 const DRegister dq1 = OddDRegisterOf(q); |
| 5037 | 4861 |
| 5038 const DRegister dr0 = EvenDRegisterOf(r); | 4862 const DRegister dr0 = EvenDRegisterOf(r); |
| 5039 | 4863 |
| 5040 // Zero register. | 4864 // Zero register. |
| 5041 __ veorq(r, r, r); | 4865 __ veorq(r, r, r); |
| 5042 // Set X lane. | 4866 // Set X lane. |
| 5043 __ vcvtsd(EvenSRegisterOf(dr0), dq0); | 4867 __ vcvtsd(EvenSRegisterOf(dr0), dq0); |
| 5044 // Set Y lane. | 4868 // Set Y lane. |
| 5045 __ vcvtsd(OddSRegisterOf(dr0), dq1); | 4869 __ vcvtsd(OddSRegisterOf(dr0), dq1); |
| 5046 } | 4870 } |
| 5047 | 4871 |
| 5048 | |
| 5049 LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( | 4872 LocationSummary* Float32x4ToFloat64x2Instr::MakeLocationSummary( |
| 5050 Zone* zone, | 4873 Zone* zone, |
| 5051 bool opt) const { | 4874 bool opt) const { |
| 5052 const intptr_t kNumInputs = 1; | 4875 const intptr_t kNumInputs = 1; |
| 5053 const intptr_t kNumTemps = 0; | 4876 const intptr_t kNumTemps = 0; |
| 5054 LocationSummary* summary = new (zone) | 4877 LocationSummary* summary = new (zone) |
| 5055 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4878 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5056 summary->set_in(0, Location::RequiresFpuRegister()); | 4879 summary->set_in(0, Location::RequiresFpuRegister()); |
| 5057 // Low (< 7) Q registers are needed for the vcvtsd instruction. | 4880 // Low (< 7) Q registers are needed for the vcvtsd instruction. |
| 5058 summary->set_out(0, Location::FpuRegisterLocation(Q6)); | 4881 summary->set_out(0, Location::FpuRegisterLocation(Q6)); |
| 5059 return summary; | 4882 return summary; |
| 5060 } | 4883 } |
| 5061 | 4884 |
| 5062 | |
| 5063 void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4885 void Float32x4ToFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5064 const QRegister q = locs()->in(0).fpu_reg(); | 4886 const QRegister q = locs()->in(0).fpu_reg(); |
| 5065 const QRegister r = locs()->out(0).fpu_reg(); | 4887 const QRegister r = locs()->out(0).fpu_reg(); |
| 5066 | 4888 |
| 5067 const DRegister dq0 = EvenDRegisterOf(q); | 4889 const DRegister dq0 = EvenDRegisterOf(q); |
| 5068 | 4890 |
| 5069 const DRegister dr0 = EvenDRegisterOf(r); | 4891 const DRegister dr0 = EvenDRegisterOf(r); |
| 5070 const DRegister dr1 = OddDRegisterOf(r); | 4892 const DRegister dr1 = OddDRegisterOf(r); |
| 5071 | 4893 |
| 5072 // Set X. | 4894 // Set X. |
| 5073 __ vcvtds(dr0, EvenSRegisterOf(dq0)); | 4895 __ vcvtds(dr0, EvenSRegisterOf(dq0)); |
| 5074 // Set Y. | 4896 // Set Y. |
| 5075 __ vcvtds(dr1, OddSRegisterOf(dq0)); | 4897 __ vcvtds(dr1, OddSRegisterOf(dq0)); |
| 5076 } | 4898 } |
| 5077 | 4899 |
| 5078 | |
| 5079 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone, | 4900 LocationSummary* Float64x2ZeroArgInstr::MakeLocationSummary(Zone* zone, |
| 5080 bool opt) const { | 4901 bool opt) const { |
| 5081 const intptr_t kNumInputs = 1; | 4902 const intptr_t kNumInputs = 1; |
| 5082 const intptr_t kNumTemps = 0; | 4903 const intptr_t kNumTemps = 0; |
| 5083 LocationSummary* summary = new (zone) | 4904 LocationSummary* summary = new (zone) |
| 5084 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4905 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5085 | 4906 |
| 5086 if (representation() == kTagged) { | 4907 if (representation() == kTagged) { |
| 5087 ASSERT(op_kind() == MethodRecognizer::kFloat64x2GetSignMask); | 4908 ASSERT(op_kind() == MethodRecognizer::kFloat64x2GetSignMask); |
| 5088 // Grabbing the S components means we need a low (< 7) Q. | 4909 // Grabbing the S components means we need a low (< 7) Q. |
| 5089 summary->set_in(0, Location::FpuRegisterLocation(Q6)); | 4910 summary->set_in(0, Location::FpuRegisterLocation(Q6)); |
| 5090 summary->set_out(0, Location::RequiresRegister()); | 4911 summary->set_out(0, Location::RequiresRegister()); |
| 5091 } else { | 4912 } else { |
| 5092 summary->set_in(0, Location::RequiresFpuRegister()); | 4913 summary->set_in(0, Location::RequiresFpuRegister()); |
| 5093 summary->set_out(0, Location::RequiresFpuRegister()); | 4914 summary->set_out(0, Location::RequiresFpuRegister()); |
| 5094 } | 4915 } |
| 5095 return summary; | 4916 return summary; |
| 5096 } | 4917 } |
| 5097 | 4918 |
| 5098 | |
| 5099 void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4919 void Float64x2ZeroArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5100 const QRegister q = locs()->in(0).fpu_reg(); | 4920 const QRegister q = locs()->in(0).fpu_reg(); |
| 5101 | 4921 |
| 5102 if ((op_kind() == MethodRecognizer::kFloat64x2GetSignMask)) { | 4922 if ((op_kind() == MethodRecognizer::kFloat64x2GetSignMask)) { |
| 5103 const DRegister dvalue0 = EvenDRegisterOf(q); | 4923 const DRegister dvalue0 = EvenDRegisterOf(q); |
| 5104 const DRegister dvalue1 = OddDRegisterOf(q); | 4924 const DRegister dvalue1 = OddDRegisterOf(q); |
| 5105 | 4925 |
| 5106 const Register out = locs()->out(0).reg(); | 4926 const Register out = locs()->out(0).reg(); |
| 5107 | 4927 |
| 5108 // Upper 32-bits of X lane. | 4928 // Upper 32-bits of X lane. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 5135 break; | 4955 break; |
| 5136 case MethodRecognizer::kFloat64x2Sqrt: | 4956 case MethodRecognizer::kFloat64x2Sqrt: |
| 5137 __ vsqrtd(dresult0, dvalue0); | 4957 __ vsqrtd(dresult0, dvalue0); |
| 5138 __ vsqrtd(dresult1, dvalue1); | 4958 __ vsqrtd(dresult1, dvalue1); |
| 5139 break; | 4959 break; |
| 5140 default: | 4960 default: |
| 5141 UNREACHABLE(); | 4961 UNREACHABLE(); |
| 5142 } | 4962 } |
| 5143 } | 4963 } |
| 5144 | 4964 |
| 5145 | |
| 5146 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone, | 4965 LocationSummary* Float64x2OneArgInstr::MakeLocationSummary(Zone* zone, |
| 5147 bool opt) const { | 4966 bool opt) const { |
| 5148 const intptr_t kNumInputs = 2; | 4967 const intptr_t kNumInputs = 2; |
| 5149 const intptr_t kNumTemps = 0; | 4968 const intptr_t kNumTemps = 0; |
| 5150 LocationSummary* summary = new (zone) | 4969 LocationSummary* summary = new (zone) |
| 5151 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 4970 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5152 summary->set_in(0, Location::RequiresFpuRegister()); | 4971 summary->set_in(0, Location::RequiresFpuRegister()); |
| 5153 summary->set_in(1, Location::RequiresFpuRegister()); | 4972 summary->set_in(1, Location::RequiresFpuRegister()); |
| 5154 summary->set_out(0, Location::SameAsFirstInput()); | 4973 summary->set_out(0, Location::SameAsFirstInput()); |
| 5155 return summary; | 4974 return summary; |
| 5156 } | 4975 } |
| 5157 | 4976 |
| 5158 | |
| 5159 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 4977 void Float64x2OneArgInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5160 const QRegister left = locs()->in(0).fpu_reg(); | 4978 const QRegister left = locs()->in(0).fpu_reg(); |
| 5161 const DRegister left0 = EvenDRegisterOf(left); | 4979 const DRegister left0 = EvenDRegisterOf(left); |
| 5162 const DRegister left1 = OddDRegisterOf(left); | 4980 const DRegister left1 = OddDRegisterOf(left); |
| 5163 const QRegister right = locs()->in(1).fpu_reg(); | 4981 const QRegister right = locs()->in(1).fpu_reg(); |
| 5164 const DRegister right0 = EvenDRegisterOf(right); | 4982 const DRegister right0 = EvenDRegisterOf(right); |
| 5165 const DRegister right1 = OddDRegisterOf(right); | 4983 const DRegister right1 = OddDRegisterOf(right); |
| 5166 const QRegister out = locs()->out(0).fpu_reg(); | 4984 const QRegister out = locs()->out(0).fpu_reg(); |
| 5167 ASSERT(left == out); | 4985 ASSERT(left == out); |
| 5168 | 4986 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5209 __ b(&g1, GT); | 5027 __ b(&g1, GT); |
| 5210 __ vmovd(left1, right1); | 5028 __ vmovd(left1, right1); |
| 5211 __ Bind(&g1); | 5029 __ Bind(&g1); |
| 5212 break; | 5030 break; |
| 5213 } | 5031 } |
| 5214 default: | 5032 default: |
| 5215 UNREACHABLE(); | 5033 UNREACHABLE(); |
| 5216 } | 5034 } |
| 5217 } | 5035 } |
| 5218 | 5036 |
| 5219 | |
| 5220 LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(Zone* zone, | 5037 LocationSummary* Int32x4ConstructorInstr::MakeLocationSummary(Zone* zone, |
| 5221 bool opt) const { | 5038 bool opt) const { |
| 5222 const intptr_t kNumInputs = 4; | 5039 const intptr_t kNumInputs = 4; |
| 5223 const intptr_t kNumTemps = 0; | 5040 const intptr_t kNumTemps = 0; |
| 5224 LocationSummary* summary = new (zone) | 5041 LocationSummary* summary = new (zone) |
| 5225 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5042 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5226 summary->set_in(0, Location::RequiresRegister()); | 5043 summary->set_in(0, Location::RequiresRegister()); |
| 5227 summary->set_in(1, Location::RequiresRegister()); | 5044 summary->set_in(1, Location::RequiresRegister()); |
| 5228 summary->set_in(2, Location::RequiresRegister()); | 5045 summary->set_in(2, Location::RequiresRegister()); |
| 5229 summary->set_in(3, Location::RequiresRegister()); | 5046 summary->set_in(3, Location::RequiresRegister()); |
| 5230 summary->set_out(0, Location::RequiresRegister()); | 5047 summary->set_out(0, Location::RequiresRegister()); |
| 5231 return summary; | 5048 return summary; |
| 5232 } | 5049 } |
| 5233 | 5050 |
| 5234 | |
| 5235 void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5051 void Int32x4ConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5236 const Register v0 = locs()->in(0).reg(); | 5052 const Register v0 = locs()->in(0).reg(); |
| 5237 const Register v1 = locs()->in(1).reg(); | 5053 const Register v1 = locs()->in(1).reg(); |
| 5238 const Register v2 = locs()->in(2).reg(); | 5054 const Register v2 = locs()->in(2).reg(); |
| 5239 const Register v3 = locs()->in(3).reg(); | 5055 const Register v3 = locs()->in(3).reg(); |
| 5240 const QRegister result = locs()->out(0).fpu_reg(); | 5056 const QRegister result = locs()->out(0).fpu_reg(); |
| 5241 const DRegister dresult0 = EvenDRegisterOf(result); | 5057 const DRegister dresult0 = EvenDRegisterOf(result); |
| 5242 const DRegister dresult1 = OddDRegisterOf(result); | 5058 const DRegister dresult1 = OddDRegisterOf(result); |
| 5243 __ veorq(result, result, result); | 5059 __ veorq(result, result, result); |
| 5244 __ vmovdrr(dresult0, v0, v1); | 5060 __ vmovdrr(dresult0, v0, v1); |
| 5245 __ vmovdrr(dresult1, v2, v3); | 5061 __ vmovdrr(dresult1, v2, v3); |
| 5246 } | 5062 } |
| 5247 | 5063 |
| 5248 | |
| 5249 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( | 5064 LocationSummary* Int32x4BoolConstructorInstr::MakeLocationSummary( |
| 5250 Zone* zone, | 5065 Zone* zone, |
| 5251 bool opt) const { | 5066 bool opt) const { |
| 5252 const intptr_t kNumInputs = 4; | 5067 const intptr_t kNumInputs = 4; |
| 5253 const intptr_t kNumTemps = 1; | 5068 const intptr_t kNumTemps = 1; |
| 5254 LocationSummary* summary = new (zone) | 5069 LocationSummary* summary = new (zone) |
| 5255 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5070 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5256 summary->set_in(0, Location::RequiresRegister()); | 5071 summary->set_in(0, Location::RequiresRegister()); |
| 5257 summary->set_in(1, Location::RequiresRegister()); | 5072 summary->set_in(1, Location::RequiresRegister()); |
| 5258 summary->set_in(2, Location::RequiresRegister()); | 5073 summary->set_in(2, Location::RequiresRegister()); |
| 5259 summary->set_in(3, Location::RequiresRegister()); | 5074 summary->set_in(3, Location::RequiresRegister()); |
| 5260 summary->set_temp(0, Location::RequiresRegister()); | 5075 summary->set_temp(0, Location::RequiresRegister()); |
| 5261 summary->set_out(0, Location::RequiresRegister()); | 5076 summary->set_out(0, Location::RequiresRegister()); |
| 5262 return summary; | 5077 return summary; |
| 5263 } | 5078 } |
| 5264 | 5079 |
| 5265 | |
| 5266 void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5080 void Int32x4BoolConstructorInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5267 const Register v0 = locs()->in(0).reg(); | 5081 const Register v0 = locs()->in(0).reg(); |
| 5268 const Register v1 = locs()->in(1).reg(); | 5082 const Register v1 = locs()->in(1).reg(); |
| 5269 const Register v2 = locs()->in(2).reg(); | 5083 const Register v2 = locs()->in(2).reg(); |
| 5270 const Register v3 = locs()->in(3).reg(); | 5084 const Register v3 = locs()->in(3).reg(); |
| 5271 const Register temp = locs()->temp(0).reg(); | 5085 const Register temp = locs()->temp(0).reg(); |
| 5272 const QRegister result = locs()->out(0).fpu_reg(); | 5086 const QRegister result = locs()->out(0).fpu_reg(); |
| 5273 const DRegister dresult0 = EvenDRegisterOf(result); | 5087 const DRegister dresult0 = EvenDRegisterOf(result); |
| 5274 const DRegister dresult1 = OddDRegisterOf(result); | 5088 const DRegister dresult1 = OddDRegisterOf(result); |
| 5275 | 5089 |
| 5276 __ veorq(result, result, result); | 5090 __ veorq(result, result, result); |
| 5277 __ LoadImmediate(temp, 0xffffffff); | 5091 __ LoadImmediate(temp, 0xffffffff); |
| 5278 | 5092 |
| 5279 __ LoadObject(IP, Bool::True()); | 5093 __ LoadObject(IP, Bool::True()); |
| 5280 __ cmp(v0, Operand(IP)); | 5094 __ cmp(v0, Operand(IP)); |
| 5281 __ vmovdr(dresult0, 0, temp, EQ); | 5095 __ vmovdr(dresult0, 0, temp, EQ); |
| 5282 | 5096 |
| 5283 __ cmp(v1, Operand(IP)); | 5097 __ cmp(v1, Operand(IP)); |
| 5284 __ vmovdr(dresult0, 1, temp, EQ); | 5098 __ vmovdr(dresult0, 1, temp, EQ); |
| 5285 | 5099 |
| 5286 __ cmp(v2, Operand(IP)); | 5100 __ cmp(v2, Operand(IP)); |
| 5287 __ vmovdr(dresult1, 0, temp, EQ); | 5101 __ vmovdr(dresult1, 0, temp, EQ); |
| 5288 | 5102 |
| 5289 __ cmp(v3, Operand(IP)); | 5103 __ cmp(v3, Operand(IP)); |
| 5290 __ vmovdr(dresult1, 1, temp, EQ); | 5104 __ vmovdr(dresult1, 1, temp, EQ); |
| 5291 } | 5105 } |
| 5292 | 5106 |
| 5293 | |
| 5294 LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone, | 5107 LocationSummary* Int32x4GetFlagInstr::MakeLocationSummary(Zone* zone, |
| 5295 bool opt) const { | 5108 bool opt) const { |
| 5296 const intptr_t kNumInputs = 1; | 5109 const intptr_t kNumInputs = 1; |
| 5297 const intptr_t kNumTemps = 0; | 5110 const intptr_t kNumTemps = 0; |
| 5298 LocationSummary* summary = new (zone) | 5111 LocationSummary* summary = new (zone) |
| 5299 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5112 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5300 // Low (< 7) Q registers are needed for the vmovrs instruction. | 5113 // Low (< 7) Q registers are needed for the vmovrs instruction. |
| 5301 summary->set_in(0, Location::FpuRegisterLocation(Q6)); | 5114 summary->set_in(0, Location::FpuRegisterLocation(Q6)); |
| 5302 summary->set_out(0, Location::RequiresRegister()); | 5115 summary->set_out(0, Location::RequiresRegister()); |
| 5303 return summary; | 5116 return summary; |
| 5304 } | 5117 } |
| 5305 | 5118 |
| 5306 | |
| 5307 void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5119 void Int32x4GetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5308 const QRegister value = locs()->in(0).fpu_reg(); | 5120 const QRegister value = locs()->in(0).fpu_reg(); |
| 5309 const Register result = locs()->out(0).reg(); | 5121 const Register result = locs()->out(0).reg(); |
| 5310 | 5122 |
| 5311 const DRegister dvalue0 = EvenDRegisterOf(value); | 5123 const DRegister dvalue0 = EvenDRegisterOf(value); |
| 5312 const DRegister dvalue1 = OddDRegisterOf(value); | 5124 const DRegister dvalue1 = OddDRegisterOf(value); |
| 5313 const SRegister svalue0 = EvenSRegisterOf(dvalue0); | 5125 const SRegister svalue0 = EvenSRegisterOf(dvalue0); |
| 5314 const SRegister svalue1 = OddSRegisterOf(dvalue0); | 5126 const SRegister svalue1 = OddSRegisterOf(dvalue0); |
| 5315 const SRegister svalue2 = EvenSRegisterOf(dvalue1); | 5127 const SRegister svalue2 = EvenSRegisterOf(dvalue1); |
| 5316 const SRegister svalue3 = OddSRegisterOf(dvalue1); | 5128 const SRegister svalue3 = OddSRegisterOf(dvalue1); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5330 break; | 5142 break; |
| 5331 default: | 5143 default: |
| 5332 UNREACHABLE(); | 5144 UNREACHABLE(); |
| 5333 } | 5145 } |
| 5334 | 5146 |
| 5335 __ tst(result, Operand(result)); | 5147 __ tst(result, Operand(result)); |
| 5336 __ LoadObject(result, Bool::True(), NE); | 5148 __ LoadObject(result, Bool::True(), NE); |
| 5337 __ LoadObject(result, Bool::False(), EQ); | 5149 __ LoadObject(result, Bool::False(), EQ); |
| 5338 } | 5150 } |
| 5339 | 5151 |
| 5340 | |
| 5341 LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone, | 5152 LocationSummary* Int32x4SelectInstr::MakeLocationSummary(Zone* zone, |
| 5342 bool opt) const { | 5153 bool opt) const { |
| 5343 const intptr_t kNumInputs = 3; | 5154 const intptr_t kNumInputs = 3; |
| 5344 const intptr_t kNumTemps = 1; | 5155 const intptr_t kNumTemps = 1; |
| 5345 LocationSummary* summary = new (zone) | 5156 LocationSummary* summary = new (zone) |
| 5346 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5157 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5347 summary->set_in(0, Location::RequiresFpuRegister()); | 5158 summary->set_in(0, Location::RequiresFpuRegister()); |
| 5348 summary->set_in(1, Location::RequiresFpuRegister()); | 5159 summary->set_in(1, Location::RequiresFpuRegister()); |
| 5349 summary->set_in(2, Location::RequiresFpuRegister()); | 5160 summary->set_in(2, Location::RequiresFpuRegister()); |
| 5350 summary->set_temp(0, Location::RequiresFpuRegister()); | 5161 summary->set_temp(0, Location::RequiresFpuRegister()); |
| 5351 summary->set_out(0, Location::RequiresFpuRegister()); | 5162 summary->set_out(0, Location::RequiresFpuRegister()); |
| 5352 return summary; | 5163 return summary; |
| 5353 } | 5164 } |
| 5354 | 5165 |
| 5355 | |
| 5356 void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5166 void Int32x4SelectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5357 const QRegister mask = locs()->in(0).fpu_reg(); | 5167 const QRegister mask = locs()->in(0).fpu_reg(); |
| 5358 const QRegister trueValue = locs()->in(1).fpu_reg(); | 5168 const QRegister trueValue = locs()->in(1).fpu_reg(); |
| 5359 const QRegister falseValue = locs()->in(2).fpu_reg(); | 5169 const QRegister falseValue = locs()->in(2).fpu_reg(); |
| 5360 const QRegister out = locs()->out(0).fpu_reg(); | 5170 const QRegister out = locs()->out(0).fpu_reg(); |
| 5361 const QRegister temp = locs()->temp(0).fpu_reg(); | 5171 const QRegister temp = locs()->temp(0).fpu_reg(); |
| 5362 | 5172 |
| 5363 // Copy mask. | 5173 // Copy mask. |
| 5364 __ vmovq(temp, mask); | 5174 __ vmovq(temp, mask); |
| 5365 // Invert it. | 5175 // Invert it. |
| 5366 __ vmvnq(temp, temp); | 5176 __ vmvnq(temp, temp); |
| 5367 // mask = mask & trueValue. | 5177 // mask = mask & trueValue. |
| 5368 __ vandq(mask, mask, trueValue); | 5178 __ vandq(mask, mask, trueValue); |
| 5369 // temp = temp & falseValue. | 5179 // temp = temp & falseValue. |
| 5370 __ vandq(temp, temp, falseValue); | 5180 __ vandq(temp, temp, falseValue); |
| 5371 // out = mask | temp. | 5181 // out = mask | temp. |
| 5372 __ vorrq(out, mask, temp); | 5182 __ vorrq(out, mask, temp); |
| 5373 } | 5183 } |
| 5374 | 5184 |
| 5375 | |
| 5376 LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone, | 5185 LocationSummary* Int32x4SetFlagInstr::MakeLocationSummary(Zone* zone, |
| 5377 bool opt) const { | 5186 bool opt) const { |
| 5378 const intptr_t kNumInputs = 2; | 5187 const intptr_t kNumInputs = 2; |
| 5379 const intptr_t kNumTemps = 0; | 5188 const intptr_t kNumTemps = 0; |
| 5380 LocationSummary* summary = new (zone) | 5189 LocationSummary* summary = new (zone) |
| 5381 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5190 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5382 summary->set_in(0, Location::RequiresFpuRegister()); | 5191 summary->set_in(0, Location::RequiresFpuRegister()); |
| 5383 summary->set_in(1, Location::RequiresRegister()); | 5192 summary->set_in(1, Location::RequiresRegister()); |
| 5384 summary->set_out(0, Location::RequiresFpuRegister()); | 5193 summary->set_out(0, Location::RequiresFpuRegister()); |
| 5385 return summary; | 5194 return summary; |
| 5386 } | 5195 } |
| 5387 | 5196 |
| 5388 | |
| 5389 void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5197 void Int32x4SetFlagInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5390 const QRegister mask = locs()->in(0).fpu_reg(); | 5198 const QRegister mask = locs()->in(0).fpu_reg(); |
| 5391 const Register flag = locs()->in(1).reg(); | 5199 const Register flag = locs()->in(1).reg(); |
| 5392 const QRegister result = locs()->out(0).fpu_reg(); | 5200 const QRegister result = locs()->out(0).fpu_reg(); |
| 5393 | 5201 |
| 5394 const DRegister dresult0 = EvenDRegisterOf(result); | 5202 const DRegister dresult0 = EvenDRegisterOf(result); |
| 5395 const DRegister dresult1 = OddDRegisterOf(result); | 5203 const DRegister dresult1 = OddDRegisterOf(result); |
| 5396 | 5204 |
| 5397 if (result != mask) { | 5205 if (result != mask) { |
| 5398 __ vmovq(result, mask); | 5206 __ vmovq(result, mask); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 5412 __ vmovdr(dresult1, 0, TMP); | 5220 __ vmovdr(dresult1, 0, TMP); |
| 5413 break; | 5221 break; |
| 5414 case MethodRecognizer::kInt32x4WithFlagW: | 5222 case MethodRecognizer::kInt32x4WithFlagW: |
| 5415 __ vmovdr(dresult1, 1, TMP); | 5223 __ vmovdr(dresult1, 1, TMP); |
| 5416 break; | 5224 break; |
| 5417 default: | 5225 default: |
| 5418 UNREACHABLE(); | 5226 UNREACHABLE(); |
| 5419 } | 5227 } |
| 5420 } | 5228 } |
| 5421 | 5229 |
| 5422 | |
| 5423 LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone, | 5230 LocationSummary* Int32x4ToFloat32x4Instr::MakeLocationSummary(Zone* zone, |
| 5424 bool opt) const { | 5231 bool opt) const { |
| 5425 const intptr_t kNumInputs = 1; | 5232 const intptr_t kNumInputs = 1; |
| 5426 const intptr_t kNumTemps = 0; | 5233 const intptr_t kNumTemps = 0; |
| 5427 LocationSummary* summary = new (zone) | 5234 LocationSummary* summary = new (zone) |
| 5428 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5235 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5429 summary->set_in(0, Location::RequiresFpuRegister()); | 5236 summary->set_in(0, Location::RequiresFpuRegister()); |
| 5430 summary->set_out(0, Location::RequiresFpuRegister()); | 5237 summary->set_out(0, Location::RequiresFpuRegister()); |
| 5431 return summary; | 5238 return summary; |
| 5432 } | 5239 } |
| 5433 | 5240 |
| 5434 | |
| 5435 void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5241 void Int32x4ToFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5436 const QRegister value = locs()->in(0).fpu_reg(); | 5242 const QRegister value = locs()->in(0).fpu_reg(); |
| 5437 const QRegister result = locs()->out(0).fpu_reg(); | 5243 const QRegister result = locs()->out(0).fpu_reg(); |
| 5438 | 5244 |
| 5439 if (value != result) { | 5245 if (value != result) { |
| 5440 __ vmovq(result, value); | 5246 __ vmovq(result, value); |
| 5441 } | 5247 } |
| 5442 } | 5248 } |
| 5443 | 5249 |
| 5444 | |
| 5445 LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone, | 5250 LocationSummary* BinaryInt32x4OpInstr::MakeLocationSummary(Zone* zone, |
| 5446 bool opt) const { | 5251 bool opt) const { |
| 5447 const intptr_t kNumInputs = 2; | 5252 const intptr_t kNumInputs = 2; |
| 5448 const intptr_t kNumTemps = 0; | 5253 const intptr_t kNumTemps = 0; |
| 5449 LocationSummary* summary = new (zone) | 5254 LocationSummary* summary = new (zone) |
| 5450 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5255 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5451 summary->set_in(0, Location::RequiresFpuRegister()); | 5256 summary->set_in(0, Location::RequiresFpuRegister()); |
| 5452 summary->set_in(1, Location::RequiresFpuRegister()); | 5257 summary->set_in(1, Location::RequiresFpuRegister()); |
| 5453 summary->set_out(0, Location::RequiresFpuRegister()); | 5258 summary->set_out(0, Location::RequiresFpuRegister()); |
| 5454 return summary; | 5259 return summary; |
| 5455 } | 5260 } |
| 5456 | 5261 |
| 5457 | |
| 5458 void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5262 void BinaryInt32x4OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5459 const QRegister left = locs()->in(0).fpu_reg(); | 5263 const QRegister left = locs()->in(0).fpu_reg(); |
| 5460 const QRegister right = locs()->in(1).fpu_reg(); | 5264 const QRegister right = locs()->in(1).fpu_reg(); |
| 5461 const QRegister result = locs()->out(0).fpu_reg(); | 5265 const QRegister result = locs()->out(0).fpu_reg(); |
| 5462 switch (op_kind()) { | 5266 switch (op_kind()) { |
| 5463 case Token::kBIT_AND: | 5267 case Token::kBIT_AND: |
| 5464 __ vandq(result, left, right); | 5268 __ vandq(result, left, right); |
| 5465 break; | 5269 break; |
| 5466 case Token::kBIT_OR: | 5270 case Token::kBIT_OR: |
| 5467 __ vorrq(result, left, right); | 5271 __ vorrq(result, left, right); |
| 5468 break; | 5272 break; |
| 5469 case Token::kBIT_XOR: | 5273 case Token::kBIT_XOR: |
| 5470 __ veorq(result, left, right); | 5274 __ veorq(result, left, right); |
| 5471 break; | 5275 break; |
| 5472 case Token::kADD: | 5276 case Token::kADD: |
| 5473 __ vaddqi(kWord, result, left, right); | 5277 __ vaddqi(kWord, result, left, right); |
| 5474 break; | 5278 break; |
| 5475 case Token::kSUB: | 5279 case Token::kSUB: |
| 5476 __ vsubqi(kWord, result, left, right); | 5280 __ vsubqi(kWord, result, left, right); |
| 5477 break; | 5281 break; |
| 5478 default: | 5282 default: |
| 5479 UNREACHABLE(); | 5283 UNREACHABLE(); |
| 5480 } | 5284 } |
| 5481 } | 5285 } |
| 5482 | 5286 |
| 5483 | |
| 5484 LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, | 5287 LocationSummary* MathUnaryInstr::MakeLocationSummary(Zone* zone, |
| 5485 bool opt) const { | 5288 bool opt) const { |
| 5486 ASSERT((kind() == MathUnaryInstr::kSqrt) || | 5289 ASSERT((kind() == MathUnaryInstr::kSqrt) || |
| 5487 (kind() == MathUnaryInstr::kDoubleSquare)); | 5290 (kind() == MathUnaryInstr::kDoubleSquare)); |
| 5488 const intptr_t kNumInputs = 1; | 5291 const intptr_t kNumInputs = 1; |
| 5489 const intptr_t kNumTemps = 0; | 5292 const intptr_t kNumTemps = 0; |
| 5490 LocationSummary* summary = new (zone) | 5293 LocationSummary* summary = new (zone) |
| 5491 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5294 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5492 summary->set_in(0, Location::RequiresFpuRegister()); | 5295 summary->set_in(0, Location::RequiresFpuRegister()); |
| 5493 summary->set_out(0, Location::RequiresFpuRegister()); | 5296 summary->set_out(0, Location::RequiresFpuRegister()); |
| 5494 return summary; | 5297 return summary; |
| 5495 } | 5298 } |
| 5496 | 5299 |
| 5497 | |
| 5498 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5300 void MathUnaryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5499 if (kind() == MathUnaryInstr::kSqrt) { | 5301 if (kind() == MathUnaryInstr::kSqrt) { |
| 5500 const DRegister val = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 5302 const DRegister val = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 5501 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 5303 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 5502 __ vsqrtd(result, val); | 5304 __ vsqrtd(result, val); |
| 5503 } else if (kind() == MathUnaryInstr::kDoubleSquare) { | 5305 } else if (kind() == MathUnaryInstr::kDoubleSquare) { |
| 5504 const DRegister val = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 5306 const DRegister val = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 5505 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 5307 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 5506 __ vmuld(result, val, val); | 5308 __ vmuld(result, val, val); |
| 5507 } else { | 5309 } else { |
| 5508 UNREACHABLE(); | 5310 UNREACHABLE(); |
| 5509 } | 5311 } |
| 5510 } | 5312 } |
| 5511 | 5313 |
| 5512 | |
| 5513 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( | 5314 LocationSummary* CaseInsensitiveCompareUC16Instr::MakeLocationSummary( |
| 5514 Zone* zone, | 5315 Zone* zone, |
| 5515 bool opt) const { | 5316 bool opt) const { |
| 5516 const intptr_t kNumTemps = 0; | 5317 const intptr_t kNumTemps = 0; |
| 5517 LocationSummary* summary = new (zone) | 5318 LocationSummary* summary = new (zone) |
| 5518 LocationSummary(zone, InputCount(), kNumTemps, LocationSummary::kCall); | 5319 LocationSummary(zone, InputCount(), kNumTemps, LocationSummary::kCall); |
| 5519 summary->set_in(0, Location::RegisterLocation(R0)); | 5320 summary->set_in(0, Location::RegisterLocation(R0)); |
| 5520 summary->set_in(1, Location::RegisterLocation(R1)); | 5321 summary->set_in(1, Location::RegisterLocation(R1)); |
| 5521 summary->set_in(2, Location::RegisterLocation(R2)); | 5322 summary->set_in(2, Location::RegisterLocation(R2)); |
| 5522 summary->set_in(3, Location::RegisterLocation(R3)); | 5323 summary->set_in(3, Location::RegisterLocation(R3)); |
| 5523 summary->set_out(0, Location::RegisterLocation(R0)); | 5324 summary->set_out(0, Location::RegisterLocation(R0)); |
| 5524 return summary; | 5325 return summary; |
| 5525 } | 5326 } |
| 5526 | 5327 |
| 5527 | |
| 5528 void CaseInsensitiveCompareUC16Instr::EmitNativeCode( | 5328 void CaseInsensitiveCompareUC16Instr::EmitNativeCode( |
| 5529 FlowGraphCompiler* compiler) { | 5329 FlowGraphCompiler* compiler) { |
| 5530 // Call the function. | 5330 // Call the function. |
| 5531 __ CallRuntime(TargetFunction(), TargetFunction().argument_count()); | 5331 __ CallRuntime(TargetFunction(), TargetFunction().argument_count()); |
| 5532 } | 5332 } |
| 5533 | 5333 |
| 5534 | |
| 5535 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone, | 5334 LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone, |
| 5536 bool opt) const { | 5335 bool opt) const { |
| 5537 if (result_cid() == kDoubleCid) { | 5336 if (result_cid() == kDoubleCid) { |
| 5538 const intptr_t kNumInputs = 2; | 5337 const intptr_t kNumInputs = 2; |
| 5539 const intptr_t kNumTemps = 1; | 5338 const intptr_t kNumTemps = 1; |
| 5540 LocationSummary* summary = new (zone) | 5339 LocationSummary* summary = new (zone) |
| 5541 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5340 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5542 summary->set_in(0, Location::RequiresFpuRegister()); | 5341 summary->set_in(0, Location::RequiresFpuRegister()); |
| 5543 summary->set_in(1, Location::RequiresFpuRegister()); | 5342 summary->set_in(1, Location::RequiresFpuRegister()); |
| 5544 // Reuse the left register so that code can be made shorter. | 5343 // Reuse the left register so that code can be made shorter. |
| 5545 summary->set_out(0, Location::SameAsFirstInput()); | 5344 summary->set_out(0, Location::SameAsFirstInput()); |
| 5546 summary->set_temp(0, Location::RequiresRegister()); | 5345 summary->set_temp(0, Location::RequiresRegister()); |
| 5547 return summary; | 5346 return summary; |
| 5548 } | 5347 } |
| 5549 ASSERT(result_cid() == kSmiCid); | 5348 ASSERT(result_cid() == kSmiCid); |
| 5550 const intptr_t kNumInputs = 2; | 5349 const intptr_t kNumInputs = 2; |
| 5551 const intptr_t kNumTemps = 0; | 5350 const intptr_t kNumTemps = 0; |
| 5552 LocationSummary* summary = new (zone) | 5351 LocationSummary* summary = new (zone) |
| 5553 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5352 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5554 summary->set_in(0, Location::RequiresRegister()); | 5353 summary->set_in(0, Location::RequiresRegister()); |
| 5555 summary->set_in(1, Location::RequiresRegister()); | 5354 summary->set_in(1, Location::RequiresRegister()); |
| 5556 // Reuse the left register so that code can be made shorter. | 5355 // Reuse the left register so that code can be made shorter. |
| 5557 summary->set_out(0, Location::SameAsFirstInput()); | 5356 summary->set_out(0, Location::SameAsFirstInput()); |
| 5558 return summary; | 5357 return summary; |
| 5559 } | 5358 } |
| 5560 | 5359 |
| 5561 | |
| 5562 void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5360 void MathMinMaxInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5563 ASSERT((op_kind() == MethodRecognizer::kMathMin) || | 5361 ASSERT((op_kind() == MethodRecognizer::kMathMin) || |
| 5564 (op_kind() == MethodRecognizer::kMathMax)); | 5362 (op_kind() == MethodRecognizer::kMathMax)); |
| 5565 const intptr_t is_min = (op_kind() == MethodRecognizer::kMathMin); | 5363 const intptr_t is_min = (op_kind() == MethodRecognizer::kMathMin); |
| 5566 if (result_cid() == kDoubleCid) { | 5364 if (result_cid() == kDoubleCid) { |
| 5567 Label done, returns_nan, are_equal; | 5365 Label done, returns_nan, are_equal; |
| 5568 const DRegister left = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 5366 const DRegister left = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 5569 const DRegister right = EvenDRegisterOf(locs()->in(1).fpu_reg()); | 5367 const DRegister right = EvenDRegisterOf(locs()->in(1).fpu_reg()); |
| 5570 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 5368 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 5571 const Register temp = locs()->temp(0).reg(); | 5369 const Register temp = locs()->temp(0).reg(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5610 const Register result = locs()->out(0).reg(); | 5408 const Register result = locs()->out(0).reg(); |
| 5611 __ cmp(left, Operand(right)); | 5409 __ cmp(left, Operand(right)); |
| 5612 ASSERT(result == left); | 5410 ASSERT(result == left); |
| 5613 if (is_min) { | 5411 if (is_min) { |
| 5614 __ mov(result, Operand(right), GT); | 5412 __ mov(result, Operand(right), GT); |
| 5615 } else { | 5413 } else { |
| 5616 __ mov(result, Operand(right), LT); | 5414 __ mov(result, Operand(right), LT); |
| 5617 } | 5415 } |
| 5618 } | 5416 } |
| 5619 | 5417 |
| 5620 | |
| 5621 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone, | 5418 LocationSummary* UnarySmiOpInstr::MakeLocationSummary(Zone* zone, |
| 5622 bool opt) const { | 5419 bool opt) const { |
| 5623 const intptr_t kNumInputs = 1; | 5420 const intptr_t kNumInputs = 1; |
| 5624 const intptr_t kNumTemps = 0; | 5421 const intptr_t kNumTemps = 0; |
| 5625 LocationSummary* summary = new (zone) | 5422 LocationSummary* summary = new (zone) |
| 5626 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5423 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5627 summary->set_in(0, Location::RequiresRegister()); | 5424 summary->set_in(0, Location::RequiresRegister()); |
| 5628 // We make use of 3-operand instructions by not requiring result register | 5425 // We make use of 3-operand instructions by not requiring result register |
| 5629 // to be identical to first input register as on Intel. | 5426 // to be identical to first input register as on Intel. |
| 5630 summary->set_out(0, Location::RequiresRegister()); | 5427 summary->set_out(0, Location::RequiresRegister()); |
| 5631 return summary; | 5428 return summary; |
| 5632 } | 5429 } |
| 5633 | 5430 |
| 5634 | |
| 5635 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5431 void UnarySmiOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5636 const Register value = locs()->in(0).reg(); | 5432 const Register value = locs()->in(0).reg(); |
| 5637 const Register result = locs()->out(0).reg(); | 5433 const Register result = locs()->out(0).reg(); |
| 5638 switch (op_kind()) { | 5434 switch (op_kind()) { |
| 5639 case Token::kNEGATE: { | 5435 case Token::kNEGATE: { |
| 5640 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptUnaryOp); | 5436 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptUnaryOp); |
| 5641 __ rsbs(result, value, Operand(0)); | 5437 __ rsbs(result, value, Operand(0)); |
| 5642 __ b(deopt, VS); | 5438 __ b(deopt, VS); |
| 5643 break; | 5439 break; |
| 5644 } | 5440 } |
| 5645 case Token::kBIT_NOT: | 5441 case Token::kBIT_NOT: |
| 5646 __ mvn(result, Operand(value)); | 5442 __ mvn(result, Operand(value)); |
| 5647 // Remove inverted smi-tag. | 5443 // Remove inverted smi-tag. |
| 5648 __ bic(result, result, Operand(kSmiTagMask)); | 5444 __ bic(result, result, Operand(kSmiTagMask)); |
| 5649 break; | 5445 break; |
| 5650 default: | 5446 default: |
| 5651 UNREACHABLE(); | 5447 UNREACHABLE(); |
| 5652 } | 5448 } |
| 5653 } | 5449 } |
| 5654 | 5450 |
| 5655 | |
| 5656 LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone, | 5451 LocationSummary* UnaryDoubleOpInstr::MakeLocationSummary(Zone* zone, |
| 5657 bool opt) const { | 5452 bool opt) const { |
| 5658 const intptr_t kNumInputs = 1; | 5453 const intptr_t kNumInputs = 1; |
| 5659 const intptr_t kNumTemps = 0; | 5454 const intptr_t kNumTemps = 0; |
| 5660 LocationSummary* summary = new (zone) | 5455 LocationSummary* summary = new (zone) |
| 5661 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5456 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5662 summary->set_in(0, Location::RequiresFpuRegister()); | 5457 summary->set_in(0, Location::RequiresFpuRegister()); |
| 5663 summary->set_out(0, Location::RequiresFpuRegister()); | 5458 summary->set_out(0, Location::RequiresFpuRegister()); |
| 5664 return summary; | 5459 return summary; |
| 5665 } | 5460 } |
| 5666 | 5461 |
| 5667 | |
| 5668 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5462 void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5669 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 5463 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 5670 const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 5464 const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 5671 __ vnegd(result, value); | 5465 __ vnegd(result, value); |
| 5672 } | 5466 } |
| 5673 | 5467 |
| 5674 | |
| 5675 LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone, | 5468 LocationSummary* Int32ToDoubleInstr::MakeLocationSummary(Zone* zone, |
| 5676 bool opt) const { | 5469 bool opt) const { |
| 5677 const intptr_t kNumInputs = 1; | 5470 const intptr_t kNumInputs = 1; |
| 5678 const intptr_t kNumTemps = 0; | 5471 const intptr_t kNumTemps = 0; |
| 5679 LocationSummary* result = new (zone) | 5472 LocationSummary* result = new (zone) |
| 5680 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5473 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5681 result->set_in(0, Location::RequiresRegister()); | 5474 result->set_in(0, Location::RequiresRegister()); |
| 5682 result->set_out(0, Location::RequiresFpuRegister()); | 5475 result->set_out(0, Location::RequiresFpuRegister()); |
| 5683 return result; | 5476 return result; |
| 5684 } | 5477 } |
| 5685 | 5478 |
| 5686 | |
| 5687 void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5479 void Int32ToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5688 const Register value = locs()->in(0).reg(); | 5480 const Register value = locs()->in(0).reg(); |
| 5689 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 5481 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 5690 __ vmovdr(DTMP, 0, value); | 5482 __ vmovdr(DTMP, 0, value); |
| 5691 __ vcvtdi(result, STMP); | 5483 __ vcvtdi(result, STMP); |
| 5692 } | 5484 } |
| 5693 | 5485 |
| 5694 | |
| 5695 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone, | 5486 LocationSummary* SmiToDoubleInstr::MakeLocationSummary(Zone* zone, |
| 5696 bool opt) const { | 5487 bool opt) const { |
| 5697 const intptr_t kNumInputs = 1; | 5488 const intptr_t kNumInputs = 1; |
| 5698 const intptr_t kNumTemps = 0; | 5489 const intptr_t kNumTemps = 0; |
| 5699 LocationSummary* result = new (zone) | 5490 LocationSummary* result = new (zone) |
| 5700 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5491 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5701 result->set_in(0, Location::RequiresRegister()); | 5492 result->set_in(0, Location::RequiresRegister()); |
| 5702 result->set_out(0, Location::RequiresFpuRegister()); | 5493 result->set_out(0, Location::RequiresFpuRegister()); |
| 5703 return result; | 5494 return result; |
| 5704 } | 5495 } |
| 5705 | 5496 |
| 5706 | |
| 5707 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5497 void SmiToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5708 const Register value = locs()->in(0).reg(); | 5498 const Register value = locs()->in(0).reg(); |
| 5709 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 5499 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 5710 __ SmiUntag(IP, value); | 5500 __ SmiUntag(IP, value); |
| 5711 __ vmovdr(DTMP, 0, IP); | 5501 __ vmovdr(DTMP, 0, IP); |
| 5712 __ vcvtdi(result, STMP); | 5502 __ vcvtdi(result, STMP); |
| 5713 } | 5503 } |
| 5714 | 5504 |
| 5715 | |
| 5716 LocationSummary* MintToDoubleInstr::MakeLocationSummary(Zone* zone, | 5505 LocationSummary* MintToDoubleInstr::MakeLocationSummary(Zone* zone, |
| 5717 bool opt) const { | 5506 bool opt) const { |
| 5718 UNIMPLEMENTED(); | 5507 UNIMPLEMENTED(); |
| 5719 return NULL; | 5508 return NULL; |
| 5720 } | 5509 } |
| 5721 | 5510 |
| 5722 | |
| 5723 void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5511 void MintToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5724 UNIMPLEMENTED(); | 5512 UNIMPLEMENTED(); |
| 5725 } | 5513 } |
| 5726 | 5514 |
| 5727 | |
| 5728 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone, | 5515 LocationSummary* DoubleToIntegerInstr::MakeLocationSummary(Zone* zone, |
| 5729 bool opt) const { | 5516 bool opt) const { |
| 5730 const intptr_t kNumInputs = 1; | 5517 const intptr_t kNumInputs = 1; |
| 5731 const intptr_t kNumTemps = 0; | 5518 const intptr_t kNumTemps = 0; |
| 5732 LocationSummary* result = new (zone) | 5519 LocationSummary* result = new (zone) |
| 5733 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 5520 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 5734 result->set_in(0, Location::RegisterLocation(R1)); | 5521 result->set_in(0, Location::RegisterLocation(R1)); |
| 5735 result->set_out(0, Location::RegisterLocation(R0)); | 5522 result->set_out(0, Location::RegisterLocation(R0)); |
| 5736 return result; | 5523 return result; |
| 5737 } | 5524 } |
| 5738 | 5525 |
| 5739 | |
| 5740 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5526 void DoubleToIntegerInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5741 const Register result = locs()->out(0).reg(); | 5527 const Register result = locs()->out(0).reg(); |
| 5742 const Register value_obj = locs()->in(0).reg(); | 5528 const Register value_obj = locs()->in(0).reg(); |
| 5743 ASSERT(result == R0); | 5529 ASSERT(result == R0); |
| 5744 ASSERT(result != value_obj); | 5530 ASSERT(result != value_obj); |
| 5745 __ LoadDFromOffset(DTMP, value_obj, Double::value_offset() - kHeapObjectTag); | 5531 __ LoadDFromOffset(DTMP, value_obj, Double::value_offset() - kHeapObjectTag); |
| 5746 | 5532 |
| 5747 Label done, do_call; | 5533 Label done, do_call; |
| 5748 // First check for NaN. Checking for minint after the conversion doesn't work | 5534 // First check for NaN. Checking for minint after the conversion doesn't work |
| 5749 // on ARM because vcvtid gives 0 for NaN. | 5535 // on ARM because vcvtid gives 0 for NaN. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 5768 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0)); | 5554 const Function& target = Function::ZoneHandle(ic_data.GetTargetAt(0)); |
| 5769 const int kTypeArgsLen = 0; | 5555 const int kTypeArgsLen = 0; |
| 5770 const int kNumberOfArguments = 1; | 5556 const int kNumberOfArguments = 1; |
| 5771 const Array& kNoArgumentNames = Object::null_array(); | 5557 const Array& kNoArgumentNames = Object::null_array(); |
| 5772 ArgumentsInfo args_info(kTypeArgsLen, kNumberOfArguments, kNoArgumentNames); | 5558 ArgumentsInfo args_info(kTypeArgsLen, kNumberOfArguments, kNoArgumentNames); |
| 5773 compiler->GenerateStaticCall(deopt_id(), instance_call()->token_pos(), target, | 5559 compiler->GenerateStaticCall(deopt_id(), instance_call()->token_pos(), target, |
| 5774 args_info, locs(), ICData::Handle()); | 5560 args_info, locs(), ICData::Handle()); |
| 5775 __ Bind(&done); | 5561 __ Bind(&done); |
| 5776 } | 5562 } |
| 5777 | 5563 |
| 5778 | |
| 5779 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, | 5564 LocationSummary* DoubleToSmiInstr::MakeLocationSummary(Zone* zone, |
| 5780 bool opt) const { | 5565 bool opt) const { |
| 5781 const intptr_t kNumInputs = 1; | 5566 const intptr_t kNumInputs = 1; |
| 5782 const intptr_t kNumTemps = 0; | 5567 const intptr_t kNumTemps = 0; |
| 5783 LocationSummary* result = new (zone) | 5568 LocationSummary* result = new (zone) |
| 5784 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5569 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5785 result->set_in(0, Location::RequiresFpuRegister()); | 5570 result->set_in(0, Location::RequiresFpuRegister()); |
| 5786 result->set_out(0, Location::RequiresRegister()); | 5571 result->set_out(0, Location::RequiresRegister()); |
| 5787 return result; | 5572 return result; |
| 5788 } | 5573 } |
| 5789 | 5574 |
| 5790 | |
| 5791 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5575 void DoubleToSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5792 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); | 5576 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptDoubleToSmi); |
| 5793 const Register result = locs()->out(0).reg(); | 5577 const Register result = locs()->out(0).reg(); |
| 5794 const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 5578 const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 5795 // First check for NaN. Checking for minint after the conversion doesn't work | 5579 // First check for NaN. Checking for minint after the conversion doesn't work |
| 5796 // on ARM because vcvtid gives 0 for NaN. | 5580 // on ARM because vcvtid gives 0 for NaN. |
| 5797 __ vcmpd(value, value); | 5581 __ vcmpd(value, value); |
| 5798 __ vmstat(); | 5582 __ vmstat(); |
| 5799 __ b(deopt, VS); | 5583 __ b(deopt, VS); |
| 5800 | 5584 |
| 5801 __ vcvtid(STMP, value); | 5585 __ vcvtid(STMP, value); |
| 5802 __ vmovrs(result, STMP); | 5586 __ vmovrs(result, STMP); |
| 5803 // Check for overflow and that it fits into Smi. | 5587 // Check for overflow and that it fits into Smi. |
| 5804 __ CompareImmediate(result, 0xC0000000); | 5588 __ CompareImmediate(result, 0xC0000000); |
| 5805 __ b(deopt, MI); | 5589 __ b(deopt, MI); |
| 5806 __ SmiTag(result); | 5590 __ SmiTag(result); |
| 5807 } | 5591 } |
| 5808 | 5592 |
| 5809 | |
| 5810 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone, | 5593 LocationSummary* DoubleToDoubleInstr::MakeLocationSummary(Zone* zone, |
| 5811 bool opt) const { | 5594 bool opt) const { |
| 5812 UNIMPLEMENTED(); | 5595 UNIMPLEMENTED(); |
| 5813 return NULL; | 5596 return NULL; |
| 5814 } | 5597 } |
| 5815 | 5598 |
| 5816 | |
| 5817 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5599 void DoubleToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5818 UNIMPLEMENTED(); | 5600 UNIMPLEMENTED(); |
| 5819 } | 5601 } |
| 5820 | 5602 |
| 5821 | |
| 5822 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone, | 5603 LocationSummary* DoubleToFloatInstr::MakeLocationSummary(Zone* zone, |
| 5823 bool opt) const { | 5604 bool opt) const { |
| 5824 const intptr_t kNumInputs = 1; | 5605 const intptr_t kNumInputs = 1; |
| 5825 const intptr_t kNumTemps = 0; | 5606 const intptr_t kNumTemps = 0; |
| 5826 LocationSummary* result = new (zone) | 5607 LocationSummary* result = new (zone) |
| 5827 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5608 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5828 // Low (<= Q7) Q registers are needed for the conversion instructions. | 5609 // Low (<= Q7) Q registers are needed for the conversion instructions. |
| 5829 result->set_in(0, Location::RequiresFpuRegister()); | 5610 result->set_in(0, Location::RequiresFpuRegister()); |
| 5830 result->set_out(0, Location::FpuRegisterLocation(Q7)); | 5611 result->set_out(0, Location::FpuRegisterLocation(Q7)); |
| 5831 return result; | 5612 return result; |
| 5832 } | 5613 } |
| 5833 | 5614 |
| 5834 | |
| 5835 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5615 void DoubleToFloatInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5836 const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); | 5616 const DRegister value = EvenDRegisterOf(locs()->in(0).fpu_reg()); |
| 5837 const SRegister result = | 5617 const SRegister result = |
| 5838 EvenSRegisterOf(EvenDRegisterOf(locs()->out(0).fpu_reg())); | 5618 EvenSRegisterOf(EvenDRegisterOf(locs()->out(0).fpu_reg())); |
| 5839 __ vcvtsd(result, value); | 5619 __ vcvtsd(result, value); |
| 5840 } | 5620 } |
| 5841 | 5621 |
| 5842 | |
| 5843 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone, | 5622 LocationSummary* FloatToDoubleInstr::MakeLocationSummary(Zone* zone, |
| 5844 bool opt) const { | 5623 bool opt) const { |
| 5845 const intptr_t kNumInputs = 1; | 5624 const intptr_t kNumInputs = 1; |
| 5846 const intptr_t kNumTemps = 0; | 5625 const intptr_t kNumTemps = 0; |
| 5847 LocationSummary* result = new (zone) | 5626 LocationSummary* result = new (zone) |
| 5848 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5627 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 5849 // Low (<= Q7) Q registers are needed for the conversion instructions. | 5628 // Low (<= Q7) Q registers are needed for the conversion instructions. |
| 5850 result->set_in(0, Location::FpuRegisterLocation(Q7)); | 5629 result->set_in(0, Location::FpuRegisterLocation(Q7)); |
| 5851 result->set_out(0, Location::RequiresFpuRegister()); | 5630 result->set_out(0, Location::RequiresFpuRegister()); |
| 5852 return result; | 5631 return result; |
| 5853 } | 5632 } |
| 5854 | 5633 |
| 5855 | |
| 5856 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5634 void FloatToDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 5857 const SRegister value = | 5635 const SRegister value = |
| 5858 EvenSRegisterOf(EvenDRegisterOf(locs()->in(0).fpu_reg())); | 5636 EvenSRegisterOf(EvenDRegisterOf(locs()->in(0).fpu_reg())); |
| 5859 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); | 5637 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); |
| 5860 __ vcvtds(result, value); | 5638 __ vcvtds(result, value); |
| 5861 } | 5639 } |
| 5862 | 5640 |
| 5863 | |
| 5864 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone, | 5641 LocationSummary* InvokeMathCFunctionInstr::MakeLocationSummary(Zone* zone, |
| 5865 bool opt) const { | 5642 bool opt) const { |
| 5866 ASSERT((InputCount() == 1) || (InputCount() == 2)); | 5643 ASSERT((InputCount() == 1) || (InputCount() == 2)); |
| 5867 const intptr_t kNumTemps = | 5644 const intptr_t kNumTemps = |
| 5868 (TargetCPUFeatures::hardfp_supported()) | 5645 (TargetCPUFeatures::hardfp_supported()) |
| 5869 ? ((recognized_kind() == MethodRecognizer::kMathDoublePow) ? 1 : 0) | 5646 ? ((recognized_kind() == MethodRecognizer::kMathDoublePow) ? 1 : 0) |
| 5870 : 4; | 5647 : 4; |
| 5871 LocationSummary* result = new (zone) | 5648 LocationSummary* result = new (zone) |
| 5872 LocationSummary(zone, InputCount(), kNumTemps, LocationSummary::kCall); | 5649 LocationSummary(zone, InputCount(), kNumTemps, LocationSummary::kCall); |
| 5873 result->set_in(0, Location::FpuRegisterLocation(Q0)); | 5650 result->set_in(0, Location::FpuRegisterLocation(Q0)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 5884 } else if (!TargetCPUFeatures::hardfp_supported()) { | 5661 } else if (!TargetCPUFeatures::hardfp_supported()) { |
| 5885 result->set_temp(0, Location::RegisterLocation(R0)); | 5662 result->set_temp(0, Location::RegisterLocation(R0)); |
| 5886 result->set_temp(1, Location::RegisterLocation(R1)); | 5663 result->set_temp(1, Location::RegisterLocation(R1)); |
| 5887 result->set_temp(2, Location::RegisterLocation(R2)); | 5664 result->set_temp(2, Location::RegisterLocation(R2)); |
| 5888 result->set_temp(3, Location::RegisterLocation(R3)); | 5665 result->set_temp(3, Location::RegisterLocation(R3)); |
| 5889 } | 5666 } |
| 5890 result->set_out(0, Location::FpuRegisterLocation(Q0)); | 5667 result->set_out(0, Location::FpuRegisterLocation(Q0)); |
| 5891 return result; | 5668 return result; |
| 5892 } | 5669 } |
| 5893 | 5670 |
| 5894 | |
| 5895 // Pseudo code: | 5671 // Pseudo code: |
| 5896 // if (exponent == 0.0) return 1.0; | 5672 // if (exponent == 0.0) return 1.0; |
| 5897 // // Speed up simple cases. | 5673 // // Speed up simple cases. |
| 5898 // if (exponent == 1.0) return base; | 5674 // if (exponent == 1.0) return base; |
| 5899 // if (exponent == 2.0) return base * base; | 5675 // if (exponent == 2.0) return base * base; |
| 5900 // if (exponent == 3.0) return base * base * base; | 5676 // if (exponent == 3.0) return base * base * base; |
| 5901 // if (base == 1.0) return 1.0; | 5677 // if (base == 1.0) return 1.0; |
| 5902 // if (base.isNaN || exponent.isNaN) { | 5678 // if (base.isNaN || exponent.isNaN) { |
| 5903 // return double.NAN; | 5679 // return double.NAN; |
| 5904 // } | 5680 // } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6020 // registers. | 5796 // registers. |
| 6021 __ vmovrrd(R0, R1, D0); | 5797 __ vmovrrd(R0, R1, D0); |
| 6022 __ vmovrrd(R2, R3, D1); | 5798 __ vmovrrd(R2, R3, D1); |
| 6023 __ CallRuntime(instr->TargetFunction(), kInputCount); | 5799 __ CallRuntime(instr->TargetFunction(), kInputCount); |
| 6024 __ vmovdrr(D0, R0, R1); | 5800 __ vmovdrr(D0, R0, R1); |
| 6025 __ vmovdrr(D1, R2, R3); | 5801 __ vmovdrr(D1, R2, R3); |
| 6026 } | 5802 } |
| 6027 __ Bind(&skip_call); | 5803 __ Bind(&skip_call); |
| 6028 } | 5804 } |
| 6029 | 5805 |
| 6030 | |
| 6031 void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5806 void InvokeMathCFunctionInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6032 if (recognized_kind() == MethodRecognizer::kMathDoublePow) { | 5807 if (recognized_kind() == MethodRecognizer::kMathDoublePow) { |
| 6033 InvokeDoublePow(compiler, this); | 5808 InvokeDoublePow(compiler, this); |
| 6034 return; | 5809 return; |
| 6035 } | 5810 } |
| 6036 | 5811 |
| 6037 if (InputCount() == 2) { | 5812 if (InputCount() == 2) { |
| 6038 // Args must be in D0 and D1, so move arg from Q1(== D3:D2) to D1. | 5813 // Args must be in D0 and D1, so move arg from Q1(== D3:D2) to D1. |
| 6039 __ vmovd(D1, D2); | 5814 __ vmovd(D1, D2); |
| 6040 } | 5815 } |
| 6041 if (TargetCPUFeatures::hardfp_supported()) { | 5816 if (TargetCPUFeatures::hardfp_supported()) { |
| 6042 __ CallRuntime(TargetFunction(), InputCount()); | 5817 __ CallRuntime(TargetFunction(), InputCount()); |
| 6043 } else { | 5818 } else { |
| 6044 // If the ABI is not "hardfp", then we have to move the double arguments | 5819 // If the ABI is not "hardfp", then we have to move the double arguments |
| 6045 // to the integer registers, and take the results from the integer | 5820 // to the integer registers, and take the results from the integer |
| 6046 // registers. | 5821 // registers. |
| 6047 __ vmovrrd(R0, R1, D0); | 5822 __ vmovrrd(R0, R1, D0); |
| 6048 __ vmovrrd(R2, R3, D1); | 5823 __ vmovrrd(R2, R3, D1); |
| 6049 __ CallRuntime(TargetFunction(), InputCount()); | 5824 __ CallRuntime(TargetFunction(), InputCount()); |
| 6050 __ vmovdrr(D0, R0, R1); | 5825 __ vmovdrr(D0, R0, R1); |
| 6051 __ vmovdrr(D1, R2, R3); | 5826 __ vmovdrr(D1, R2, R3); |
| 6052 } | 5827 } |
| 6053 } | 5828 } |
| 6054 | 5829 |
| 6055 | |
| 6056 LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone, | 5830 LocationSummary* ExtractNthOutputInstr::MakeLocationSummary(Zone* zone, |
| 6057 bool opt) const { | 5831 bool opt) const { |
| 6058 // Only use this instruction in optimized code. | 5832 // Only use this instruction in optimized code. |
| 6059 ASSERT(opt); | 5833 ASSERT(opt); |
| 6060 const intptr_t kNumInputs = 1; | 5834 const intptr_t kNumInputs = 1; |
| 6061 LocationSummary* summary = | 5835 LocationSummary* summary = |
| 6062 new (zone) LocationSummary(zone, kNumInputs, 0, LocationSummary::kNoCall); | 5836 new (zone) LocationSummary(zone, kNumInputs, 0, LocationSummary::kNoCall); |
| 6063 if (representation() == kUnboxedDouble) { | 5837 if (representation() == kUnboxedDouble) { |
| 6064 if (index() == 0) { | 5838 if (index() == 0) { |
| 6065 summary->set_in( | 5839 summary->set_in( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 6078 } else { | 5852 } else { |
| 6079 ASSERT(index() == 1); | 5853 ASSERT(index() == 1); |
| 6080 summary->set_in( | 5854 summary->set_in( |
| 6081 0, Location::Pair(Location::Any(), Location::RequiresRegister())); | 5855 0, Location::Pair(Location::Any(), Location::RequiresRegister())); |
| 6082 } | 5856 } |
| 6083 summary->set_out(0, Location::RequiresRegister()); | 5857 summary->set_out(0, Location::RequiresRegister()); |
| 6084 } | 5858 } |
| 6085 return summary; | 5859 return summary; |
| 6086 } | 5860 } |
| 6087 | 5861 |
| 6088 | |
| 6089 void ExtractNthOutputInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5862 void ExtractNthOutputInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6090 ASSERT(locs()->in(0).IsPairLocation()); | 5863 ASSERT(locs()->in(0).IsPairLocation()); |
| 6091 PairLocation* pair = locs()->in(0).AsPairLocation(); | 5864 PairLocation* pair = locs()->in(0).AsPairLocation(); |
| 6092 Location in_loc = pair->At(index()); | 5865 Location in_loc = pair->At(index()); |
| 6093 if (representation() == kUnboxedDouble) { | 5866 if (representation() == kUnboxedDouble) { |
| 6094 const QRegister out = locs()->out(0).fpu_reg(); | 5867 const QRegister out = locs()->out(0).fpu_reg(); |
| 6095 const QRegister in = in_loc.fpu_reg(); | 5868 const QRegister in = in_loc.fpu_reg(); |
| 6096 __ vmovq(out, in); | 5869 __ vmovq(out, in); |
| 6097 } else { | 5870 } else { |
| 6098 ASSERT(representation() == kTagged); | 5871 ASSERT(representation() == kTagged); |
| 6099 const Register out = locs()->out(0).reg(); | 5872 const Register out = locs()->out(0).reg(); |
| 6100 const Register in = in_loc.reg(); | 5873 const Register in = in_loc.reg(); |
| 6101 __ mov(out, Operand(in)); | 5874 __ mov(out, Operand(in)); |
| 6102 } | 5875 } |
| 6103 } | 5876 } |
| 6104 | 5877 |
| 6105 | |
| 6106 LocationSummary* TruncDivModInstr::MakeLocationSummary(Zone* zone, | 5878 LocationSummary* TruncDivModInstr::MakeLocationSummary(Zone* zone, |
| 6107 bool opt) const { | 5879 bool opt) const { |
| 6108 const intptr_t kNumInputs = 2; | 5880 const intptr_t kNumInputs = 2; |
| 6109 const intptr_t kNumTemps = 2; | 5881 const intptr_t kNumTemps = 2; |
| 6110 LocationSummary* summary = new (zone) | 5882 LocationSummary* summary = new (zone) |
| 6111 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5883 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6112 summary->set_in(0, Location::RequiresRegister()); | 5884 summary->set_in(0, Location::RequiresRegister()); |
| 6113 summary->set_in(1, Location::RequiresRegister()); | 5885 summary->set_in(1, Location::RequiresRegister()); |
| 6114 summary->set_temp(0, Location::RequiresRegister()); | 5886 summary->set_temp(0, Location::RequiresRegister()); |
| 6115 summary->set_temp(1, Location::RequiresFpuRegister()); | 5887 summary->set_temp(1, Location::RequiresFpuRegister()); |
| 6116 // Output is a pair of registers. | 5888 // Output is a pair of registers. |
| 6117 summary->set_out(0, Location::Pair(Location::RequiresRegister(), | 5889 summary->set_out(0, Location::Pair(Location::RequiresRegister(), |
| 6118 Location::RequiresRegister())); | 5890 Location::RequiresRegister())); |
| 6119 return summary; | 5891 return summary; |
| 6120 } | 5892 } |
| 6121 | 5893 |
| 6122 | |
| 6123 void TruncDivModInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5894 void TruncDivModInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6124 ASSERT(CanDeoptimize()); | 5895 ASSERT(CanDeoptimize()); |
| 6125 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); | 5896 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinarySmiOp); |
| 6126 | 5897 |
| 6127 ASSERT(TargetCPUFeatures::can_divide()); | 5898 ASSERT(TargetCPUFeatures::can_divide()); |
| 6128 const Register left = locs()->in(0).reg(); | 5899 const Register left = locs()->in(0).reg(); |
| 6129 const Register right = locs()->in(1).reg(); | 5900 const Register right = locs()->in(1).reg(); |
| 6130 ASSERT(locs()->out(0).IsPairLocation()); | 5901 ASSERT(locs()->out(0).IsPairLocation()); |
| 6131 PairLocation* pair = locs()->out(0).AsPairLocation(); | 5902 PairLocation* pair = locs()->out(0).AsPairLocation(); |
| 6132 const Register result_div = pair->At(0).reg(); | 5903 const Register result_div = pair->At(0).reg(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 6163 Label done; | 5934 Label done; |
| 6164 __ cmp(result_mod, Operand(0)); | 5935 __ cmp(result_mod, Operand(0)); |
| 6165 __ b(&done, GE); | 5936 __ b(&done, GE); |
| 6166 // Result is negative, adjust it. | 5937 // Result is negative, adjust it. |
| 6167 __ cmp(right, Operand(0)); | 5938 __ cmp(right, Operand(0)); |
| 6168 __ sub(result_mod, result_mod, Operand(right), LT); | 5939 __ sub(result_mod, result_mod, Operand(right), LT); |
| 6169 __ add(result_mod, result_mod, Operand(right), GE); | 5940 __ add(result_mod, result_mod, Operand(right), GE); |
| 6170 __ Bind(&done); | 5941 __ Bind(&done); |
| 6171 } | 5942 } |
| 6172 | 5943 |
| 6173 | |
| 6174 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( | 5944 LocationSummary* PolymorphicInstanceCallInstr::MakeLocationSummary( |
| 6175 Zone* zone, | 5945 Zone* zone, |
| 6176 bool opt) const { | 5946 bool opt) const { |
| 6177 return MakeCallSummary(zone); | 5947 return MakeCallSummary(zone); |
| 6178 } | 5948 } |
| 6179 | 5949 |
| 6180 | |
| 6181 LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { | 5950 LocationSummary* BranchInstr::MakeLocationSummary(Zone* zone, bool opt) const { |
| 6182 comparison()->InitializeLocationSummary(zone, opt); | 5951 comparison()->InitializeLocationSummary(zone, opt); |
| 6183 // Branches don't produce a result. | 5952 // Branches don't produce a result. |
| 6184 comparison()->locs()->set_out(0, Location::NoLocation()); | 5953 comparison()->locs()->set_out(0, Location::NoLocation()); |
| 6185 return comparison()->locs(); | 5954 return comparison()->locs(); |
| 6186 } | 5955 } |
| 6187 | 5956 |
| 6188 | |
| 6189 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 5957 void BranchInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6190 comparison()->EmitBranchCode(compiler, this); | 5958 comparison()->EmitBranchCode(compiler, this); |
| 6191 } | 5959 } |
| 6192 | 5960 |
| 6193 | |
| 6194 LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone, | 5961 LocationSummary* CheckClassInstr::MakeLocationSummary(Zone* zone, |
| 6195 bool opt) const { | 5962 bool opt) const { |
| 6196 const intptr_t kNumInputs = 1; | 5963 const intptr_t kNumInputs = 1; |
| 6197 const bool need_mask_temp = IsBitTest(); | 5964 const bool need_mask_temp = IsBitTest(); |
| 6198 const intptr_t kNumTemps = !IsNullCheck() ? (need_mask_temp ? 2 : 1) : 0; | 5965 const intptr_t kNumTemps = !IsNullCheck() ? (need_mask_temp ? 2 : 1) : 0; |
| 6199 LocationSummary* summary = new (zone) | 5966 LocationSummary* summary = new (zone) |
| 6200 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 5967 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6201 summary->set_in(0, Location::RequiresRegister()); | 5968 summary->set_in(0, Location::RequiresRegister()); |
| 6202 if (!IsNullCheck()) { | 5969 if (!IsNullCheck()) { |
| 6203 summary->set_temp(0, Location::RequiresRegister()); | 5970 summary->set_temp(0, Location::RequiresRegister()); |
| 6204 if (need_mask_temp) { | 5971 if (need_mask_temp) { |
| 6205 summary->set_temp(1, Location::RequiresRegister()); | 5972 summary->set_temp(1, Location::RequiresRegister()); |
| 6206 } | 5973 } |
| 6207 } | 5974 } |
| 6208 return summary; | 5975 return summary; |
| 6209 } | 5976 } |
| 6210 | 5977 |
| 6211 | |
| 6212 void CheckClassInstr::EmitNullCheck(FlowGraphCompiler* compiler, Label* deopt) { | 5978 void CheckClassInstr::EmitNullCheck(FlowGraphCompiler* compiler, Label* deopt) { |
| 6213 __ CompareObject(locs()->in(0).reg(), Object::null_object()); | 5979 __ CompareObject(locs()->in(0).reg(), Object::null_object()); |
| 6214 ASSERT(IsDeoptIfNull() || IsDeoptIfNotNull()); | 5980 ASSERT(IsDeoptIfNull() || IsDeoptIfNotNull()); |
| 6215 Condition cond = IsDeoptIfNull() ? EQ : NE; | 5981 Condition cond = IsDeoptIfNull() ? EQ : NE; |
| 6216 __ b(deopt, cond); | 5982 __ b(deopt, cond); |
| 6217 } | 5983 } |
| 6218 | 5984 |
| 6219 | |
| 6220 void CheckClassInstr::EmitBitTest(FlowGraphCompiler* compiler, | 5985 void CheckClassInstr::EmitBitTest(FlowGraphCompiler* compiler, |
| 6221 intptr_t min, | 5986 intptr_t min, |
| 6222 intptr_t max, | 5987 intptr_t max, |
| 6223 intptr_t mask, | 5988 intptr_t mask, |
| 6224 Label* deopt) { | 5989 Label* deopt) { |
| 6225 Register biased_cid = locs()->temp(0).reg(); | 5990 Register biased_cid = locs()->temp(0).reg(); |
| 6226 __ AddImmediate(biased_cid, -min); | 5991 __ AddImmediate(biased_cid, -min); |
| 6227 __ CompareImmediate(biased_cid, max - min); | 5992 __ CompareImmediate(biased_cid, max - min); |
| 6228 __ b(deopt, HI); | 5993 __ b(deopt, HI); |
| 6229 | 5994 |
| 6230 Register bit_reg = locs()->temp(1).reg(); | 5995 Register bit_reg = locs()->temp(1).reg(); |
| 6231 __ LoadImmediate(bit_reg, 1); | 5996 __ LoadImmediate(bit_reg, 1); |
| 6232 __ Lsl(bit_reg, bit_reg, biased_cid); | 5997 __ Lsl(bit_reg, bit_reg, biased_cid); |
| 6233 __ TestImmediate(bit_reg, mask); | 5998 __ TestImmediate(bit_reg, mask); |
| 6234 __ b(deopt, EQ); | 5999 __ b(deopt, EQ); |
| 6235 } | 6000 } |
| 6236 | 6001 |
| 6237 | |
| 6238 int CheckClassInstr::EmitCheckCid(FlowGraphCompiler* compiler, | 6002 int CheckClassInstr::EmitCheckCid(FlowGraphCompiler* compiler, |
| 6239 int bias, | 6003 int bias, |
| 6240 intptr_t cid_start, | 6004 intptr_t cid_start, |
| 6241 intptr_t cid_end, | 6005 intptr_t cid_end, |
| 6242 bool is_last, | 6006 bool is_last, |
| 6243 Label* is_ok, | 6007 Label* is_ok, |
| 6244 Label* deopt, | 6008 Label* deopt, |
| 6245 bool use_near_jump) { | 6009 bool use_near_jump) { |
| 6246 Register biased_cid = locs()->temp(0).reg(); | 6010 Register biased_cid = locs()->temp(0).reg(); |
| 6247 Condition no_match, match; | 6011 Condition no_match, match; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 6259 match = LS; // Unsigned lower or same. | 6023 match = LS; // Unsigned lower or same. |
| 6260 } | 6024 } |
| 6261 if (is_last) { | 6025 if (is_last) { |
| 6262 __ b(deopt, no_match); | 6026 __ b(deopt, no_match); |
| 6263 } else { | 6027 } else { |
| 6264 __ b(is_ok, match); | 6028 __ b(is_ok, match); |
| 6265 } | 6029 } |
| 6266 return bias; | 6030 return bias; |
| 6267 } | 6031 } |
| 6268 | 6032 |
| 6269 | |
| 6270 LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, | 6033 LocationSummary* CheckSmiInstr::MakeLocationSummary(Zone* zone, |
| 6271 bool opt) const { | 6034 bool opt) const { |
| 6272 const intptr_t kNumInputs = 1; | 6035 const intptr_t kNumInputs = 1; |
| 6273 const intptr_t kNumTemps = 0; | 6036 const intptr_t kNumTemps = 0; |
| 6274 LocationSummary* summary = new (zone) | 6037 LocationSummary* summary = new (zone) |
| 6275 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6038 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6276 summary->set_in(0, Location::RequiresRegister()); | 6039 summary->set_in(0, Location::RequiresRegister()); |
| 6277 return summary; | 6040 return summary; |
| 6278 } | 6041 } |
| 6279 | 6042 |
| 6280 | |
| 6281 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6043 void CheckSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6282 const Register value = locs()->in(0).reg(); | 6044 const Register value = locs()->in(0).reg(); |
| 6283 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi, | 6045 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckSmi, |
| 6284 licm_hoisted_ ? ICData::kHoisted : 0); | 6046 licm_hoisted_ ? ICData::kHoisted : 0); |
| 6285 __ BranchIfNotSmi(value, deopt); | 6047 __ BranchIfNotSmi(value, deopt); |
| 6286 } | 6048 } |
| 6287 | 6049 |
| 6288 | |
| 6289 LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone, | 6050 LocationSummary* CheckClassIdInstr::MakeLocationSummary(Zone* zone, |
| 6290 bool opt) const { | 6051 bool opt) const { |
| 6291 const intptr_t kNumInputs = 1; | 6052 const intptr_t kNumInputs = 1; |
| 6292 const intptr_t kNumTemps = 0; | 6053 const intptr_t kNumTemps = 0; |
| 6293 LocationSummary* summary = new (zone) | 6054 LocationSummary* summary = new (zone) |
| 6294 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6055 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6295 summary->set_in(0, cids_.IsSingleCid() ? Location::RequiresRegister() | 6056 summary->set_in(0, cids_.IsSingleCid() ? Location::RequiresRegister() |
| 6296 : Location::WritableRegister()); | 6057 : Location::WritableRegister()); |
| 6297 return summary; | 6058 return summary; |
| 6298 } | 6059 } |
| 6299 | 6060 |
| 6300 | |
| 6301 void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6061 void CheckClassIdInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6302 Register value = locs()->in(0).reg(); | 6062 Register value = locs()->in(0).reg(); |
| 6303 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass); | 6063 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckClass); |
| 6304 if (cids_.IsSingleCid()) { | 6064 if (cids_.IsSingleCid()) { |
| 6305 __ CompareImmediate(value, Smi::RawValue(cids_.cid_start)); | 6065 __ CompareImmediate(value, Smi::RawValue(cids_.cid_start)); |
| 6306 __ b(deopt, NE); | 6066 __ b(deopt, NE); |
| 6307 } else { | 6067 } else { |
| 6308 __ AddImmediate(value, -Smi::RawValue(cids_.cid_start)); | 6068 __ AddImmediate(value, -Smi::RawValue(cids_.cid_start)); |
| 6309 __ CompareImmediate(value, Smi::RawValue(cids_.Extent())); | 6069 __ CompareImmediate(value, Smi::RawValue(cids_.Extent())); |
| 6310 __ b(deopt, HI); // Unsigned higher. | 6070 __ b(deopt, HI); // Unsigned higher. |
| 6311 } | 6071 } |
| 6312 } | 6072 } |
| 6313 | 6073 |
| 6314 | |
| 6315 LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone, | 6074 LocationSummary* GenericCheckBoundInstr::MakeLocationSummary(Zone* zone, |
| 6316 bool opt) const { | 6075 bool opt) const { |
| 6317 const intptr_t kNumInputs = 2; | 6076 const intptr_t kNumInputs = 2; |
| 6318 const intptr_t kNumTemps = 0; | 6077 const intptr_t kNumTemps = 0; |
| 6319 LocationSummary* locs = new (zone) LocationSummary( | 6078 LocationSummary* locs = new (zone) LocationSummary( |
| 6320 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); | 6079 zone, kNumInputs, kNumTemps, LocationSummary::kCallOnSlowPath); |
| 6321 locs->set_in(kLengthPos, Location::RequiresRegister()); | 6080 locs->set_in(kLengthPos, Location::RequiresRegister()); |
| 6322 locs->set_in(kIndexPos, Location::RequiresRegister()); | 6081 locs->set_in(kIndexPos, Location::RequiresRegister()); |
| 6323 return locs; | 6082 return locs; |
| 6324 } | 6083 } |
| 6325 | 6084 |
| 6326 | |
| 6327 class RangeErrorSlowPath : public SlowPathCode { | 6085 class RangeErrorSlowPath : public SlowPathCode { |
| 6328 public: | 6086 public: |
| 6329 RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) | 6087 RangeErrorSlowPath(GenericCheckBoundInstr* instruction, intptr_t try_index) |
| 6330 : instruction_(instruction), try_index_(try_index) {} | 6088 : instruction_(instruction), try_index_(try_index) {} |
| 6331 | 6089 |
| 6332 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 6090 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6333 if (Assembler::EmittingComments()) { | 6091 if (Assembler::EmittingComments()) { |
| 6334 __ Comment("slow path check bound operation"); | 6092 __ Comment("slow path check bound operation"); |
| 6335 } | 6093 } |
| 6336 __ Bind(entry_label()); | 6094 __ Bind(entry_label()); |
| 6337 LocationSummary* locs = instruction_->locs(); | 6095 LocationSummary* locs = instruction_->locs(); |
| 6338 compiler->SaveLiveRegisters(locs); | 6096 compiler->SaveLiveRegisters(locs); |
| 6339 __ Push(locs->in(0).reg()); | 6097 __ Push(locs->in(0).reg()); |
| 6340 __ Push(locs->in(1).reg()); | 6098 __ Push(locs->in(1).reg()); |
| 6341 __ CallRuntime(kRangeErrorRuntimeEntry, 2); | 6099 __ CallRuntime(kRangeErrorRuntimeEntry, 2); |
| 6342 compiler->AddDescriptor( | 6100 compiler->AddDescriptor( |
| 6343 RawPcDescriptors::kOther, compiler->assembler()->CodeSize(), | 6101 RawPcDescriptors::kOther, compiler->assembler()->CodeSize(), |
| 6344 instruction_->deopt_id(), instruction_->token_pos(), try_index_); | 6102 instruction_->deopt_id(), instruction_->token_pos(), try_index_); |
| 6345 compiler->RecordSafepoint(locs, 2); | 6103 compiler->RecordSafepoint(locs, 2); |
| 6346 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); | 6104 Environment* env = compiler->SlowPathEnvironmentFor(instruction_); |
| 6347 compiler->EmitCatchEntryState(env, try_index_); | 6105 compiler->EmitCatchEntryState(env, try_index_); |
| 6348 __ bkpt(0); | 6106 __ bkpt(0); |
| 6349 } | 6107 } |
| 6350 | 6108 |
| 6351 private: | 6109 private: |
| 6352 GenericCheckBoundInstr* instruction_; | 6110 GenericCheckBoundInstr* instruction_; |
| 6353 intptr_t try_index_; | 6111 intptr_t try_index_; |
| 6354 }; | 6112 }; |
| 6355 | 6113 |
| 6356 | |
| 6357 void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6114 void GenericCheckBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6358 RangeErrorSlowPath* slow_path = | 6115 RangeErrorSlowPath* slow_path = |
| 6359 new RangeErrorSlowPath(this, compiler->CurrentTryIndex()); | 6116 new RangeErrorSlowPath(this, compiler->CurrentTryIndex()); |
| 6360 compiler->AddSlowPathCode(slow_path); | 6117 compiler->AddSlowPathCode(slow_path); |
| 6361 | 6118 |
| 6362 Location length_loc = locs()->in(kLengthPos); | 6119 Location length_loc = locs()->in(kLengthPos); |
| 6363 Location index_loc = locs()->in(kIndexPos); | 6120 Location index_loc = locs()->in(kIndexPos); |
| 6364 Register length = length_loc.reg(); | 6121 Register length = length_loc.reg(); |
| 6365 Register index = index_loc.reg(); | 6122 Register index = index_loc.reg(); |
| 6366 const intptr_t index_cid = this->index()->Type()->ToCid(); | 6123 const intptr_t index_cid = this->index()->Type()->ToCid(); |
| 6367 if (index_cid != kSmiCid) { | 6124 if (index_cid != kSmiCid) { |
| 6368 __ BranchIfNotSmi(index, slow_path->entry_label()); | 6125 __ BranchIfNotSmi(index, slow_path->entry_label()); |
| 6369 } | 6126 } |
| 6370 __ cmp(index, Operand(length)); | 6127 __ cmp(index, Operand(length)); |
| 6371 __ b(slow_path->entry_label(), CS); | 6128 __ b(slow_path->entry_label(), CS); |
| 6372 } | 6129 } |
| 6373 | 6130 |
| 6374 | |
| 6375 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone, | 6131 LocationSummary* CheckArrayBoundInstr::MakeLocationSummary(Zone* zone, |
| 6376 bool opt) const { | 6132 bool opt) const { |
| 6377 const intptr_t kNumInputs = 2; | 6133 const intptr_t kNumInputs = 2; |
| 6378 const intptr_t kNumTemps = 0; | 6134 const intptr_t kNumTemps = 0; |
| 6379 LocationSummary* locs = new (zone) | 6135 LocationSummary* locs = new (zone) |
| 6380 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6136 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6381 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length())); | 6137 locs->set_in(kLengthPos, Location::RegisterOrSmiConstant(length())); |
| 6382 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index())); | 6138 locs->set_in(kIndexPos, Location::RegisterOrSmiConstant(index())); |
| 6383 return locs; | 6139 return locs; |
| 6384 } | 6140 } |
| 6385 | 6141 |
| 6386 | |
| 6387 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6142 void CheckArrayBoundInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6388 uint32_t flags = generalized_ ? ICData::kGeneralized : 0; | 6143 uint32_t flags = generalized_ ? ICData::kGeneralized : 0; |
| 6389 flags |= licm_hoisted_ ? ICData::kHoisted : 0; | 6144 flags |= licm_hoisted_ ? ICData::kHoisted : 0; |
| 6390 Label* deopt = | 6145 Label* deopt = |
| 6391 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckArrayBound, flags); | 6146 compiler->AddDeoptStub(deopt_id(), ICData::kDeoptCheckArrayBound, flags); |
| 6392 | 6147 |
| 6393 Location length_loc = locs()->in(kLengthPos); | 6148 Location length_loc = locs()->in(kLengthPos); |
| 6394 Location index_loc = locs()->in(kIndexPos); | 6149 Location index_loc = locs()->in(kIndexPos); |
| 6395 | 6150 |
| 6396 if (length_loc.IsConstant() && index_loc.IsConstant()) { | 6151 if (length_loc.IsConstant() && index_loc.IsConstant()) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6426 const Register length = length_loc.reg(); | 6181 const Register length = length_loc.reg(); |
| 6427 const Register index = index_loc.reg(); | 6182 const Register index = index_loc.reg(); |
| 6428 if (index_cid != kSmiCid) { | 6183 if (index_cid != kSmiCid) { |
| 6429 __ BranchIfNotSmi(index, deopt); | 6184 __ BranchIfNotSmi(index, deopt); |
| 6430 } | 6185 } |
| 6431 __ cmp(index, Operand(length)); | 6186 __ cmp(index, Operand(length)); |
| 6432 __ b(deopt, CS); | 6187 __ b(deopt, CS); |
| 6433 } | 6188 } |
| 6434 } | 6189 } |
| 6435 | 6190 |
| 6436 | |
| 6437 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone, | 6191 LocationSummary* BinaryMintOpInstr::MakeLocationSummary(Zone* zone, |
| 6438 bool opt) const { | 6192 bool opt) const { |
| 6439 const intptr_t kNumInputs = 2; | 6193 const intptr_t kNumInputs = 2; |
| 6440 const intptr_t kNumTemps = 0; | 6194 const intptr_t kNumTemps = 0; |
| 6441 LocationSummary* summary = new (zone) | 6195 LocationSummary* summary = new (zone) |
| 6442 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6196 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6443 summary->set_in(0, Location::Pair(Location::RequiresRegister(), | 6197 summary->set_in(0, Location::Pair(Location::RequiresRegister(), |
| 6444 Location::RequiresRegister())); | 6198 Location::RequiresRegister())); |
| 6445 summary->set_in(1, Location::Pair(Location::RequiresRegister(), | 6199 summary->set_in(1, Location::Pair(Location::RequiresRegister(), |
| 6446 Location::RequiresRegister())); | 6200 Location::RequiresRegister())); |
| 6447 summary->set_out(0, Location::Pair(Location::RequiresRegister(), | 6201 summary->set_out(0, Location::Pair(Location::RequiresRegister(), |
| 6448 Location::RequiresRegister())); | 6202 Location::RequiresRegister())); |
| 6449 return summary; | 6203 return summary; |
| 6450 } | 6204 } |
| 6451 | 6205 |
| 6452 | |
| 6453 void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6206 void BinaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6454 PairLocation* left_pair = locs()->in(0).AsPairLocation(); | 6207 PairLocation* left_pair = locs()->in(0).AsPairLocation(); |
| 6455 Register left_lo = left_pair->At(0).reg(); | 6208 Register left_lo = left_pair->At(0).reg(); |
| 6456 Register left_hi = left_pair->At(1).reg(); | 6209 Register left_hi = left_pair->At(1).reg(); |
| 6457 PairLocation* right_pair = locs()->in(1).AsPairLocation(); | 6210 PairLocation* right_pair = locs()->in(1).AsPairLocation(); |
| 6458 Register right_lo = right_pair->At(0).reg(); | 6211 Register right_lo = right_pair->At(0).reg(); |
| 6459 Register right_hi = right_pair->At(1).reg(); | 6212 Register right_hi = right_pair->At(1).reg(); |
| 6460 PairLocation* out_pair = locs()->out(0).AsPairLocation(); | 6213 PairLocation* out_pair = locs()->out(0).AsPairLocation(); |
| 6461 Register out_lo = out_pair->At(0).reg(); | 6214 Register out_lo = out_pair->At(0).reg(); |
| 6462 Register out_hi = out_pair->At(1).reg(); | 6215 Register out_hi = out_pair->At(1).reg(); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6506 __ cmp(right_hi, Operand(right_lo, ASR, 31), EQ); | 6259 __ cmp(right_hi, Operand(right_lo, ASR, 31), EQ); |
| 6507 __ b(deopt, NE); | 6260 __ b(deopt, NE); |
| 6508 __ smull(out_lo, out_hi, left_lo, right_lo); | 6261 __ smull(out_lo, out_hi, left_lo, right_lo); |
| 6509 break; | 6262 break; |
| 6510 } | 6263 } |
| 6511 default: | 6264 default: |
| 6512 UNREACHABLE(); | 6265 UNREACHABLE(); |
| 6513 } | 6266 } |
| 6514 } | 6267 } |
| 6515 | 6268 |
| 6516 | |
| 6517 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone, | 6269 LocationSummary* ShiftMintOpInstr::MakeLocationSummary(Zone* zone, |
| 6518 bool opt) const { | 6270 bool opt) const { |
| 6519 const intptr_t kNumInputs = 2; | 6271 const intptr_t kNumInputs = 2; |
| 6520 const intptr_t kNumTemps = 0; | 6272 const intptr_t kNumTemps = 0; |
| 6521 LocationSummary* summary = new (zone) | 6273 LocationSummary* summary = new (zone) |
| 6522 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6274 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6523 summary->set_in(0, Location::Pair(Location::RequiresRegister(), | 6275 summary->set_in(0, Location::Pair(Location::RequiresRegister(), |
| 6524 Location::RequiresRegister())); | 6276 Location::RequiresRegister())); |
| 6525 summary->set_in(1, Location::WritableRegisterOrSmiConstant(right())); | 6277 summary->set_in(1, Location::WritableRegisterOrSmiConstant(right())); |
| 6526 summary->set_out(0, Location::Pair(Location::RequiresRegister(), | 6278 summary->set_out(0, Location::Pair(Location::RequiresRegister(), |
| 6527 Location::RequiresRegister())); | 6279 Location::RequiresRegister())); |
| 6528 return summary; | 6280 return summary; |
| 6529 } | 6281 } |
| 6530 | 6282 |
| 6531 | |
| 6532 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6283 void ShiftMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6533 PairLocation* left_pair = locs()->in(0).AsPairLocation(); | 6284 PairLocation* left_pair = locs()->in(0).AsPairLocation(); |
| 6534 Register left_lo = left_pair->At(0).reg(); | 6285 Register left_lo = left_pair->At(0).reg(); |
| 6535 Register left_hi = left_pair->At(1).reg(); | 6286 Register left_hi = left_pair->At(1).reg(); |
| 6536 PairLocation* out_pair = locs()->out(0).AsPairLocation(); | 6287 PairLocation* out_pair = locs()->out(0).AsPairLocation(); |
| 6537 Register out_lo = out_pair->At(0).reg(); | 6288 Register out_lo = out_pair->At(0).reg(); |
| 6538 Register out_hi = out_pair->At(1).reg(); | 6289 Register out_hi = out_pair->At(1).reg(); |
| 6539 | 6290 |
| 6540 Label* deopt = NULL; | 6291 Label* deopt = NULL; |
| 6541 if (CanDeoptimize()) { | 6292 if (CanDeoptimize()) { |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6644 __ b(deopt, NE); | 6395 __ b(deopt, NE); |
| 6645 } | 6396 } |
| 6646 break; | 6397 break; |
| 6647 } | 6398 } |
| 6648 default: | 6399 default: |
| 6649 UNREACHABLE(); | 6400 UNREACHABLE(); |
| 6650 } | 6401 } |
| 6651 } | 6402 } |
| 6652 } | 6403 } |
| 6653 | 6404 |
| 6654 | |
| 6655 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone, | 6405 LocationSummary* UnaryMintOpInstr::MakeLocationSummary(Zone* zone, |
| 6656 bool opt) const { | 6406 bool opt) const { |
| 6657 const intptr_t kNumInputs = 1; | 6407 const intptr_t kNumInputs = 1; |
| 6658 const intptr_t kNumTemps = 0; | 6408 const intptr_t kNumTemps = 0; |
| 6659 LocationSummary* summary = new (zone) | 6409 LocationSummary* summary = new (zone) |
| 6660 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6410 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6661 summary->set_in(0, Location::Pair(Location::RequiresRegister(), | 6411 summary->set_in(0, Location::Pair(Location::RequiresRegister(), |
| 6662 Location::RequiresRegister())); | 6412 Location::RequiresRegister())); |
| 6663 summary->set_out(0, Location::Pair(Location::RequiresRegister(), | 6413 summary->set_out(0, Location::Pair(Location::RequiresRegister(), |
| 6664 Location::RequiresRegister())); | 6414 Location::RequiresRegister())); |
| 6665 return summary; | 6415 return summary; |
| 6666 } | 6416 } |
| 6667 | 6417 |
| 6668 | |
| 6669 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6418 void UnaryMintOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6670 ASSERT(op_kind() == Token::kBIT_NOT); | 6419 ASSERT(op_kind() == Token::kBIT_NOT); |
| 6671 PairLocation* left_pair = locs()->in(0).AsPairLocation(); | 6420 PairLocation* left_pair = locs()->in(0).AsPairLocation(); |
| 6672 Register left_lo = left_pair->At(0).reg(); | 6421 Register left_lo = left_pair->At(0).reg(); |
| 6673 Register left_hi = left_pair->At(1).reg(); | 6422 Register left_hi = left_pair->At(1).reg(); |
| 6674 | 6423 |
| 6675 PairLocation* out_pair = locs()->out(0).AsPairLocation(); | 6424 PairLocation* out_pair = locs()->out(0).AsPairLocation(); |
| 6676 Register out_lo = out_pair->At(0).reg(); | 6425 Register out_lo = out_pair->At(0).reg(); |
| 6677 Register out_hi = out_pair->At(1).reg(); | 6426 Register out_hi = out_pair->At(1).reg(); |
| 6678 __ mvn(out_lo, Operand(left_lo)); | 6427 __ mvn(out_lo, Operand(left_lo)); |
| 6679 __ mvn(out_hi, Operand(left_hi)); | 6428 __ mvn(out_hi, Operand(left_hi)); |
| 6680 } | 6429 } |
| 6681 | 6430 |
| 6682 | |
| 6683 CompileType BinaryUint32OpInstr::ComputeType() const { | 6431 CompileType BinaryUint32OpInstr::ComputeType() const { |
| 6684 return CompileType::Int(); | 6432 return CompileType::Int(); |
| 6685 } | 6433 } |
| 6686 | 6434 |
| 6687 | |
| 6688 CompileType ShiftUint32OpInstr::ComputeType() const { | 6435 CompileType ShiftUint32OpInstr::ComputeType() const { |
| 6689 return CompileType::Int(); | 6436 return CompileType::Int(); |
| 6690 } | 6437 } |
| 6691 | 6438 |
| 6692 | |
| 6693 CompileType UnaryUint32OpInstr::ComputeType() const { | 6439 CompileType UnaryUint32OpInstr::ComputeType() const { |
| 6694 return CompileType::Int(); | 6440 return CompileType::Int(); |
| 6695 } | 6441 } |
| 6696 | 6442 |
| 6697 | |
| 6698 LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone, | 6443 LocationSummary* BinaryUint32OpInstr::MakeLocationSummary(Zone* zone, |
| 6699 bool opt) const { | 6444 bool opt) const { |
| 6700 const intptr_t kNumInputs = 2; | 6445 const intptr_t kNumInputs = 2; |
| 6701 const intptr_t kNumTemps = 0; | 6446 const intptr_t kNumTemps = 0; |
| 6702 LocationSummary* summary = new (zone) | 6447 LocationSummary* summary = new (zone) |
| 6703 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6448 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6704 summary->set_in(0, Location::RequiresRegister()); | 6449 summary->set_in(0, Location::RequiresRegister()); |
| 6705 summary->set_in(1, Location::RequiresRegister()); | 6450 summary->set_in(1, Location::RequiresRegister()); |
| 6706 summary->set_out(0, Location::RequiresRegister()); | 6451 summary->set_out(0, Location::RequiresRegister()); |
| 6707 return summary; | 6452 return summary; |
| 6708 } | 6453 } |
| 6709 | 6454 |
| 6710 | |
| 6711 void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6455 void BinaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6712 Register left = locs()->in(0).reg(); | 6456 Register left = locs()->in(0).reg(); |
| 6713 Register right = locs()->in(1).reg(); | 6457 Register right = locs()->in(1).reg(); |
| 6714 Register out = locs()->out(0).reg(); | 6458 Register out = locs()->out(0).reg(); |
| 6715 ASSERT(out != left); | 6459 ASSERT(out != left); |
| 6716 switch (op_kind()) { | 6460 switch (op_kind()) { |
| 6717 case Token::kBIT_AND: | 6461 case Token::kBIT_AND: |
| 6718 __ and_(out, left, Operand(right)); | 6462 __ and_(out, left, Operand(right)); |
| 6719 break; | 6463 break; |
| 6720 case Token::kBIT_OR: | 6464 case Token::kBIT_OR: |
| 6721 __ orr(out, left, Operand(right)); | 6465 __ orr(out, left, Operand(right)); |
| 6722 break; | 6466 break; |
| 6723 case Token::kBIT_XOR: | 6467 case Token::kBIT_XOR: |
| 6724 __ eor(out, left, Operand(right)); | 6468 __ eor(out, left, Operand(right)); |
| 6725 break; | 6469 break; |
| 6726 case Token::kADD: | 6470 case Token::kADD: |
| 6727 __ add(out, left, Operand(right)); | 6471 __ add(out, left, Operand(right)); |
| 6728 break; | 6472 break; |
| 6729 case Token::kSUB: | 6473 case Token::kSUB: |
| 6730 __ sub(out, left, Operand(right)); | 6474 __ sub(out, left, Operand(right)); |
| 6731 break; | 6475 break; |
| 6732 case Token::kMUL: | 6476 case Token::kMUL: |
| 6733 __ mul(out, left, right); | 6477 __ mul(out, left, right); |
| 6734 break; | 6478 break; |
| 6735 default: | 6479 default: |
| 6736 UNREACHABLE(); | 6480 UNREACHABLE(); |
| 6737 } | 6481 } |
| 6738 } | 6482 } |
| 6739 | 6483 |
| 6740 | |
| 6741 LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Zone* zone, | 6484 LocationSummary* ShiftUint32OpInstr::MakeLocationSummary(Zone* zone, |
| 6742 bool opt) const { | 6485 bool opt) const { |
| 6743 const intptr_t kNumInputs = 2; | 6486 const intptr_t kNumInputs = 2; |
| 6744 const intptr_t kNumTemps = 1; | 6487 const intptr_t kNumTemps = 1; |
| 6745 LocationSummary* summary = new (zone) | 6488 LocationSummary* summary = new (zone) |
| 6746 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6489 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6747 summary->set_in(0, Location::RequiresRegister()); | 6490 summary->set_in(0, Location::RequiresRegister()); |
| 6748 summary->set_in(1, Location::RegisterOrSmiConstant(right())); | 6491 summary->set_in(1, Location::RegisterOrSmiConstant(right())); |
| 6749 summary->set_temp(0, Location::RequiresRegister()); | 6492 summary->set_temp(0, Location::RequiresRegister()); |
| 6750 summary->set_out(0, Location::RequiresRegister()); | 6493 summary->set_out(0, Location::RequiresRegister()); |
| 6751 return summary; | 6494 return summary; |
| 6752 } | 6495 } |
| 6753 | 6496 |
| 6754 | |
| 6755 void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6497 void ShiftUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6756 const intptr_t kShifterLimit = 31; | 6498 const intptr_t kShifterLimit = 31; |
| 6757 | 6499 |
| 6758 Register left = locs()->in(0).reg(); | 6500 Register left = locs()->in(0).reg(); |
| 6759 Register out = locs()->out(0).reg(); | 6501 Register out = locs()->out(0).reg(); |
| 6760 Register temp = locs()->temp(0).reg(); | 6502 Register temp = locs()->temp(0).reg(); |
| 6761 | 6503 |
| 6762 ASSERT(left != out); | 6504 ASSERT(left != out); |
| 6763 | 6505 |
| 6764 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryMintOp); | 6506 Label* deopt = compiler->AddDeoptStub(deopt_id(), ICData::kDeoptBinaryMintOp); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6800 __ Lsr(out, left, temp, LS); | 6542 __ Lsr(out, left, temp, LS); |
| 6801 break; | 6543 break; |
| 6802 case Token::kSHL: | 6544 case Token::kSHL: |
| 6803 __ Lsl(out, left, temp, LS); | 6545 __ Lsl(out, left, temp, LS); |
| 6804 break; | 6546 break; |
| 6805 default: | 6547 default: |
| 6806 UNREACHABLE(); | 6548 UNREACHABLE(); |
| 6807 } | 6549 } |
| 6808 } | 6550 } |
| 6809 | 6551 |
| 6810 | |
| 6811 LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Zone* zone, | 6552 LocationSummary* UnaryUint32OpInstr::MakeLocationSummary(Zone* zone, |
| 6812 bool opt) const { | 6553 bool opt) const { |
| 6813 const intptr_t kNumInputs = 1; | 6554 const intptr_t kNumInputs = 1; |
| 6814 const intptr_t kNumTemps = 0; | 6555 const intptr_t kNumTemps = 0; |
| 6815 LocationSummary* summary = new (zone) | 6556 LocationSummary* summary = new (zone) |
| 6816 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6557 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6817 summary->set_in(0, Location::RequiresRegister()); | 6558 summary->set_in(0, Location::RequiresRegister()); |
| 6818 summary->set_out(0, Location::RequiresRegister()); | 6559 summary->set_out(0, Location::RequiresRegister()); |
| 6819 return summary; | 6560 return summary; |
| 6820 } | 6561 } |
| 6821 | 6562 |
| 6822 | |
| 6823 void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6563 void UnaryUint32OpInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6824 Register left = locs()->in(0).reg(); | 6564 Register left = locs()->in(0).reg(); |
| 6825 Register out = locs()->out(0).reg(); | 6565 Register out = locs()->out(0).reg(); |
| 6826 ASSERT(left != out); | 6566 ASSERT(left != out); |
| 6827 | 6567 |
| 6828 ASSERT(op_kind() == Token::kBIT_NOT); | 6568 ASSERT(op_kind() == Token::kBIT_NOT); |
| 6829 | 6569 |
| 6830 __ mvn(out, Operand(left)); | 6570 __ mvn(out, Operand(left)); |
| 6831 } | 6571 } |
| 6832 | 6572 |
| 6833 | |
| 6834 LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone, | 6573 LocationSummary* UnboxedIntConverterInstr::MakeLocationSummary(Zone* zone, |
| 6835 bool opt) const { | 6574 bool opt) const { |
| 6836 const intptr_t kNumInputs = 1; | 6575 const intptr_t kNumInputs = 1; |
| 6837 const intptr_t kNumTemps = 0; | 6576 const intptr_t kNumTemps = 0; |
| 6838 LocationSummary* summary = new (zone) | 6577 LocationSummary* summary = new (zone) |
| 6839 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6578 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6840 if (from() == kUnboxedMint) { | 6579 if (from() == kUnboxedMint) { |
| 6841 ASSERT((to() == kUnboxedUint32) || (to() == kUnboxedInt32)); | 6580 ASSERT((to() == kUnboxedUint32) || (to() == kUnboxedInt32)); |
| 6842 summary->set_in(0, Location::Pair(Location::RequiresRegister(), | 6581 summary->set_in(0, Location::Pair(Location::RequiresRegister(), |
| 6843 Location::RequiresRegister())); | 6582 Location::RequiresRegister())); |
| 6844 summary->set_out(0, Location::RequiresRegister()); | 6583 summary->set_out(0, Location::RequiresRegister()); |
| 6845 } else if (to() == kUnboxedMint) { | 6584 } else if (to() == kUnboxedMint) { |
| 6846 ASSERT((from() == kUnboxedUint32) || (from() == kUnboxedInt32)); | 6585 ASSERT((from() == kUnboxedUint32) || (from() == kUnboxedInt32)); |
| 6847 summary->set_in(0, Location::RequiresRegister()); | 6586 summary->set_in(0, Location::RequiresRegister()); |
| 6848 summary->set_out(0, Location::Pair(Location::RequiresRegister(), | 6587 summary->set_out(0, Location::Pair(Location::RequiresRegister(), |
| 6849 Location::RequiresRegister())); | 6588 Location::RequiresRegister())); |
| 6850 } else { | 6589 } else { |
| 6851 ASSERT((to() == kUnboxedUint32) || (to() == kUnboxedInt32)); | 6590 ASSERT((to() == kUnboxedUint32) || (to() == kUnboxedInt32)); |
| 6852 ASSERT((from() == kUnboxedUint32) || (from() == kUnboxedInt32)); | 6591 ASSERT((from() == kUnboxedUint32) || (from() == kUnboxedInt32)); |
| 6853 summary->set_in(0, Location::RequiresRegister()); | 6592 summary->set_in(0, Location::RequiresRegister()); |
| 6854 summary->set_out(0, Location::SameAsFirstInput()); | 6593 summary->set_out(0, Location::SameAsFirstInput()); |
| 6855 } | 6594 } |
| 6856 return summary; | 6595 return summary; |
| 6857 } | 6596 } |
| 6858 | 6597 |
| 6859 | |
| 6860 void UnboxedIntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6598 void UnboxedIntConverterInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6861 if (from() == kUnboxedInt32 && to() == kUnboxedUint32) { | 6599 if (from() == kUnboxedInt32 && to() == kUnboxedUint32) { |
| 6862 const Register out = locs()->out(0).reg(); | 6600 const Register out = locs()->out(0).reg(); |
| 6863 // Representations are bitwise equivalent. | 6601 // Representations are bitwise equivalent. |
| 6864 ASSERT(out == locs()->in(0).reg()); | 6602 ASSERT(out == locs()->in(0).reg()); |
| 6865 } else if (from() == kUnboxedUint32 && to() == kUnboxedInt32) { | 6603 } else if (from() == kUnboxedUint32 && to() == kUnboxedInt32) { |
| 6866 const Register out = locs()->out(0).reg(); | 6604 const Register out = locs()->out(0).reg(); |
| 6867 // Representations are bitwise equivalent. | 6605 // Representations are bitwise equivalent. |
| 6868 ASSERT(out == locs()->in(0).reg()); | 6606 ASSERT(out == locs()->in(0).reg()); |
| 6869 if (CanDeoptimize()) { | 6607 if (CanDeoptimize()) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 6899 __ eor(out_hi, out_hi, Operand(out_hi)); | 6637 __ eor(out_hi, out_hi, Operand(out_hi)); |
| 6900 } else { | 6638 } else { |
| 6901 ASSERT(from() == kUnboxedInt32); | 6639 ASSERT(from() == kUnboxedInt32); |
| 6902 __ mov(out_hi, Operand(in, ASR, kBitsPerWord - 1)); | 6640 __ mov(out_hi, Operand(in, ASR, kBitsPerWord - 1)); |
| 6903 } | 6641 } |
| 6904 } else { | 6642 } else { |
| 6905 UNREACHABLE(); | 6643 UNREACHABLE(); |
| 6906 } | 6644 } |
| 6907 } | 6645 } |
| 6908 | 6646 |
| 6909 | |
| 6910 LocationSummary* ThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { | 6647 LocationSummary* ThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { |
| 6911 return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); | 6648 return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); |
| 6912 } | 6649 } |
| 6913 | 6650 |
| 6914 | |
| 6915 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6651 void ThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6916 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kThrowRuntimeEntry, 1, | 6652 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kThrowRuntimeEntry, 1, |
| 6917 locs()); | 6653 locs()); |
| 6918 __ bkpt(0); | 6654 __ bkpt(0); |
| 6919 } | 6655 } |
| 6920 | 6656 |
| 6921 | |
| 6922 LocationSummary* ReThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { | 6657 LocationSummary* ReThrowInstr::MakeLocationSummary(Zone* zone, bool opt) const { |
| 6923 return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); | 6658 return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kCall); |
| 6924 } | 6659 } |
| 6925 | 6660 |
| 6926 | |
| 6927 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6661 void ReThrowInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6928 compiler->SetNeedsStackTrace(catch_try_index()); | 6662 compiler->SetNeedsStackTrace(catch_try_index()); |
| 6929 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kReThrowRuntimeEntry, | 6663 compiler->GenerateRuntimeCall(token_pos(), deopt_id(), kReThrowRuntimeEntry, |
| 6930 2, locs()); | 6664 2, locs()); |
| 6931 __ bkpt(0); | 6665 __ bkpt(0); |
| 6932 } | 6666 } |
| 6933 | 6667 |
| 6934 | |
| 6935 LocationSummary* StopInstr::MakeLocationSummary(Zone* zone, bool opt) const { | 6668 LocationSummary* StopInstr::MakeLocationSummary(Zone* zone, bool opt) const { |
| 6936 return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); | 6669 return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); |
| 6937 } | 6670 } |
| 6938 | 6671 |
| 6939 | |
| 6940 void StopInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6672 void StopInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6941 __ Stop(message()); | 6673 __ Stop(message()); |
| 6942 } | 6674 } |
| 6943 | 6675 |
| 6944 | |
| 6945 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6676 void GraphEntryInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6946 if (!compiler->CanFallThroughTo(normal_entry())) { | 6677 if (!compiler->CanFallThroughTo(normal_entry())) { |
| 6947 __ b(compiler->GetJumpLabel(normal_entry())); | 6678 __ b(compiler->GetJumpLabel(normal_entry())); |
| 6948 } | 6679 } |
| 6949 } | 6680 } |
| 6950 | 6681 |
| 6951 | |
| 6952 LocationSummary* GotoInstr::MakeLocationSummary(Zone* zone, bool opt) const { | 6682 LocationSummary* GotoInstr::MakeLocationSummary(Zone* zone, bool opt) const { |
| 6953 return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); | 6683 return new (zone) LocationSummary(zone, 0, 0, LocationSummary::kNoCall); |
| 6954 } | 6684 } |
| 6955 | 6685 |
| 6956 | |
| 6957 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6686 void GotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6958 if (!compiler->is_optimizing()) { | 6687 if (!compiler->is_optimizing()) { |
| 6959 if (FLAG_reorder_basic_blocks) { | 6688 if (FLAG_reorder_basic_blocks) { |
| 6960 compiler->EmitEdgeCounter(block()->preorder_number()); | 6689 compiler->EmitEdgeCounter(block()->preorder_number()); |
| 6961 } | 6690 } |
| 6962 // Add a deoptimization descriptor for deoptimizing instructions that | 6691 // Add a deoptimization descriptor for deoptimizing instructions that |
| 6963 // may be inserted before this instruction. | 6692 // may be inserted before this instruction. |
| 6964 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, GetDeoptId(), | 6693 compiler->AddCurrentDescriptor(RawPcDescriptors::kDeopt, GetDeoptId(), |
| 6965 TokenPosition::kNoSource); | 6694 TokenPosition::kNoSource); |
| 6966 } | 6695 } |
| 6967 if (HasParallelMove()) { | 6696 if (HasParallelMove()) { |
| 6968 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); | 6697 compiler->parallel_move_resolver()->EmitNativeCode(parallel_move()); |
| 6969 } | 6698 } |
| 6970 | 6699 |
| 6971 // We can fall through if the successor is the next block in the list. | 6700 // We can fall through if the successor is the next block in the list. |
| 6972 // Otherwise, we need a jump. | 6701 // Otherwise, we need a jump. |
| 6973 if (!compiler->CanFallThroughTo(successor())) { | 6702 if (!compiler->CanFallThroughTo(successor())) { |
| 6974 __ b(compiler->GetJumpLabel(successor())); | 6703 __ b(compiler->GetJumpLabel(successor())); |
| 6975 } | 6704 } |
| 6976 } | 6705 } |
| 6977 | 6706 |
| 6978 | |
| 6979 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone, | 6707 LocationSummary* IndirectGotoInstr::MakeLocationSummary(Zone* zone, |
| 6980 bool opt) const { | 6708 bool opt) const { |
| 6981 const intptr_t kNumInputs = 1; | 6709 const intptr_t kNumInputs = 1; |
| 6982 const intptr_t kNumTemps = 1; | 6710 const intptr_t kNumTemps = 1; |
| 6983 | 6711 |
| 6984 LocationSummary* summary = new (zone) | 6712 LocationSummary* summary = new (zone) |
| 6985 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); | 6713 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kNoCall); |
| 6986 | 6714 |
| 6987 summary->set_in(0, Location::RequiresRegister()); | 6715 summary->set_in(0, Location::RequiresRegister()); |
| 6988 summary->set_temp(0, Location::RequiresRegister()); | 6716 summary->set_temp(0, Location::RequiresRegister()); |
| 6989 | 6717 |
| 6990 return summary; | 6718 return summary; |
| 6991 } | 6719 } |
| 6992 | 6720 |
| 6993 | |
| 6994 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6721 void IndirectGotoInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 6995 Register target_address_reg = locs()->temp_slot(0)->reg(); | 6722 Register target_address_reg = locs()->temp_slot(0)->reg(); |
| 6996 | 6723 |
| 6997 // Offset is relative to entry pc. | 6724 // Offset is relative to entry pc. |
| 6998 const intptr_t entry_to_pc_offset = __ CodeSize() + Instr::kPCReadOffset; | 6725 const intptr_t entry_to_pc_offset = __ CodeSize() + Instr::kPCReadOffset; |
| 6999 __ mov(target_address_reg, Operand(PC)); | 6726 __ mov(target_address_reg, Operand(PC)); |
| 7000 __ AddImmediate(target_address_reg, -entry_to_pc_offset); | 6727 __ AddImmediate(target_address_reg, -entry_to_pc_offset); |
| 7001 // Add the offset. | 6728 // Add the offset. |
| 7002 Register offset_reg = locs()->in(0).reg(); | 6729 Register offset_reg = locs()->in(0).reg(); |
| 7003 Operand offset_opr = (offset()->definition()->representation() == kTagged) | 6730 Operand offset_opr = (offset()->definition()->representation() == kTagged) |
| 7004 ? Operand(offset_reg, ASR, kSmiTagSize) | 6731 ? Operand(offset_reg, ASR, kSmiTagSize) |
| 7005 : Operand(offset_reg); | 6732 : Operand(offset_reg); |
| 7006 __ add(target_address_reg, target_address_reg, offset_opr); | 6733 __ add(target_address_reg, target_address_reg, offset_opr); |
| 7007 | 6734 |
| 7008 // Jump to the absolute address. | 6735 // Jump to the absolute address. |
| 7009 __ bx(target_address_reg); | 6736 __ bx(target_address_reg); |
| 7010 } | 6737 } |
| 7011 | 6738 |
| 7012 | |
| 7013 LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, | 6739 LocationSummary* StrictCompareInstr::MakeLocationSummary(Zone* zone, |
| 7014 bool opt) const { | 6740 bool opt) const { |
| 7015 const intptr_t kNumInputs = 2; | 6741 const intptr_t kNumInputs = 2; |
| 7016 const intptr_t kNumTemps = 0; | 6742 const intptr_t kNumTemps = 0; |
| 7017 if (needs_number_check()) { | 6743 if (needs_number_check()) { |
| 7018 LocationSummary* locs = new (zone) | 6744 LocationSummary* locs = new (zone) |
| 7019 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); | 6745 LocationSummary(zone, kNumInputs, kNumTemps, LocationSummary::kCall); |
| 7020 locs->set_in(0, Location::RegisterLocation(R0)); | 6746 locs->set_in(0, Location::RegisterLocation(R0)); |
| 7021 locs->set_in(1, Location::RegisterLocation(R1)); | 6747 locs->set_in(1, Location::RegisterLocation(R1)); |
| 7022 locs->set_out(0, Location::RegisterLocation(R0)); | 6748 locs->set_out(0, Location::RegisterLocation(R0)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 7041 // Only one of the inputs can be a constant. Choose register if the first | 6767 // Only one of the inputs can be a constant. Choose register if the first |
| 7042 // one is a constant. | 6768 // one is a constant. |
| 7043 locs->set_in(1, locs->in(0).IsConstant() | 6769 locs->set_in(1, locs->in(0).IsConstant() |
| 7044 ? Location::RequiresRegister() | 6770 ? Location::RequiresRegister() |
| 7045 : Location::RegisterOrConstant(right())); | 6771 : Location::RegisterOrConstant(right())); |
| 7046 } | 6772 } |
| 7047 locs->set_out(0, Location::RequiresRegister()); | 6773 locs->set_out(0, Location::RequiresRegister()); |
| 7048 return locs; | 6774 return locs; |
| 7049 } | 6775 } |
| 7050 | 6776 |
| 7051 | |
| 7052 Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, | 6777 Condition StrictCompareInstr::EmitComparisonCode(FlowGraphCompiler* compiler, |
| 7053 BranchLabels labels) { | 6778 BranchLabels labels) { |
| 7054 Location left = locs()->in(0); | 6779 Location left = locs()->in(0); |
| 7055 Location right = locs()->in(1); | 6780 Location right = locs()->in(1); |
| 7056 ASSERT(!left.IsConstant() || !right.IsConstant()); | 6781 ASSERT(!left.IsConstant() || !right.IsConstant()); |
| 7057 Condition true_condition; | 6782 Condition true_condition; |
| 7058 if (left.IsConstant()) { | 6783 if (left.IsConstant()) { |
| 7059 true_condition = compiler->EmitEqualityRegConstCompare( | 6784 true_condition = compiler->EmitEqualityRegConstCompare( |
| 7060 right.reg(), left.constant(), needs_number_check(), token_pos(), | 6785 right.reg(), left.constant(), needs_number_check(), token_pos(), |
| 7061 deopt_id_); | 6786 deopt_id_); |
| 7062 } else if (right.IsConstant()) { | 6787 } else if (right.IsConstant()) { |
| 7063 true_condition = compiler->EmitEqualityRegConstCompare( | 6788 true_condition = compiler->EmitEqualityRegConstCompare( |
| 7064 left.reg(), right.constant(), needs_number_check(), token_pos(), | 6789 left.reg(), right.constant(), needs_number_check(), token_pos(), |
| 7065 deopt_id_); | 6790 deopt_id_); |
| 7066 } else { | 6791 } else { |
| 7067 true_condition = compiler->EmitEqualityRegRegCompare( | 6792 true_condition = compiler->EmitEqualityRegRegCompare( |
| 7068 left.reg(), right.reg(), needs_number_check(), token_pos(), deopt_id_); | 6793 left.reg(), right.reg(), needs_number_check(), token_pos(), deopt_id_); |
| 7069 } | 6794 } |
| 7070 if (kind() != Token::kEQ_STRICT) { | 6795 if (kind() != Token::kEQ_STRICT) { |
| 7071 ASSERT(kind() == Token::kNE_STRICT); | 6796 ASSERT(kind() == Token::kNE_STRICT); |
| 7072 true_condition = NegateCondition(true_condition); | 6797 true_condition = NegateCondition(true_condition); |
| 7073 } | 6798 } |
| 7074 return true_condition; | 6799 return true_condition; |
| 7075 } | 6800 } |
| 7076 | 6801 |
| 7077 | |
| 7078 void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6802 void ComparisonInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 7079 // The ARM code may not use true- and false-labels here. | 6803 // The ARM code may not use true- and false-labels here. |
| 7080 Label is_true, is_false, done; | 6804 Label is_true, is_false, done; |
| 7081 BranchLabels labels = {&is_true, &is_false, &is_false}; | 6805 BranchLabels labels = {&is_true, &is_false, &is_false}; |
| 7082 Condition true_condition = EmitComparisonCode(compiler, labels); | 6806 Condition true_condition = EmitComparisonCode(compiler, labels); |
| 7083 | 6807 |
| 7084 const Register result = this->locs()->out(0).reg(); | 6808 const Register result = this->locs()->out(0).reg(); |
| 7085 if (is_false.IsLinked() || is_true.IsLinked()) { | 6809 if (is_false.IsLinked() || is_true.IsLinked()) { |
| 7086 if (true_condition != kInvalidCondition) { | 6810 if (true_condition != kInvalidCondition) { |
| 7087 EmitBranchOnCondition(compiler, true_condition, labels); | 6811 EmitBranchOnCondition(compiler, true_condition, labels); |
| 7088 } | 6812 } |
| 7089 __ Bind(&is_false); | 6813 __ Bind(&is_false); |
| 7090 __ LoadObject(result, Bool::False()); | 6814 __ LoadObject(result, Bool::False()); |
| 7091 __ b(&done); | 6815 __ b(&done); |
| 7092 __ Bind(&is_true); | 6816 __ Bind(&is_true); |
| 7093 __ LoadObject(result, Bool::True()); | 6817 __ LoadObject(result, Bool::True()); |
| 7094 __ Bind(&done); | 6818 __ Bind(&done); |
| 7095 } else { | 6819 } else { |
| 7096 // If EmitComparisonCode did not use the labels and just returned | 6820 // If EmitComparisonCode did not use the labels and just returned |
| 7097 // a condition we can avoid the branch and use conditional loads. | 6821 // a condition we can avoid the branch and use conditional loads. |
| 7098 ASSERT(true_condition != kInvalidCondition); | 6822 ASSERT(true_condition != kInvalidCondition); |
| 7099 __ LoadObject(result, Bool::True(), true_condition); | 6823 __ LoadObject(result, Bool::True(), true_condition); |
| 7100 __ LoadObject(result, Bool::False(), NegateCondition(true_condition)); | 6824 __ LoadObject(result, Bool::False(), NegateCondition(true_condition)); |
| 7101 } | 6825 } |
| 7102 } | 6826 } |
| 7103 | 6827 |
| 7104 | |
| 7105 void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, | 6828 void ComparisonInstr::EmitBranchCode(FlowGraphCompiler* compiler, |
| 7106 BranchInstr* branch) { | 6829 BranchInstr* branch) { |
| 7107 BranchLabels labels = compiler->CreateBranchLabels(branch); | 6830 BranchLabels labels = compiler->CreateBranchLabels(branch); |
| 7108 Condition true_condition = EmitComparisonCode(compiler, labels); | 6831 Condition true_condition = EmitComparisonCode(compiler, labels); |
| 7109 if (true_condition != kInvalidCondition) { | 6832 if (true_condition != kInvalidCondition) { |
| 7110 EmitBranchOnCondition(compiler, true_condition, labels); | 6833 EmitBranchOnCondition(compiler, true_condition, labels); |
| 7111 } | 6834 } |
| 7112 } | 6835 } |
| 7113 | 6836 |
| 7114 | |
| 7115 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Zone* zone, | 6837 LocationSummary* BooleanNegateInstr::MakeLocationSummary(Zone* zone, |
| 7116 bool opt) const { | 6838 bool opt) const { |
| 7117 return LocationSummary::Make(zone, 1, Location::RequiresRegister(), | 6839 return LocationSummary::Make(zone, 1, Location::RequiresRegister(), |
| 7118 LocationSummary::kNoCall); | 6840 LocationSummary::kNoCall); |
| 7119 } | 6841 } |
| 7120 | 6842 |
| 7121 | |
| 7122 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6843 void BooleanNegateInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 7123 const Register value = locs()->in(0).reg(); | 6844 const Register value = locs()->in(0).reg(); |
| 7124 const Register result = locs()->out(0).reg(); | 6845 const Register result = locs()->out(0).reg(); |
| 7125 | 6846 |
| 7126 __ LoadObject(result, Bool::True()); | 6847 __ LoadObject(result, Bool::True()); |
| 7127 __ cmp(result, Operand(value)); | 6848 __ cmp(result, Operand(value)); |
| 7128 __ LoadObject(result, Bool::False(), EQ); | 6849 __ LoadObject(result, Bool::False(), EQ); |
| 7129 } | 6850 } |
| 7130 | 6851 |
| 7131 | |
| 7132 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, | 6852 LocationSummary* AllocateObjectInstr::MakeLocationSummary(Zone* zone, |
| 7133 bool opt) const { | 6853 bool opt) const { |
| 7134 return MakeCallSummary(zone); | 6854 return MakeCallSummary(zone); |
| 7135 } | 6855 } |
| 7136 | 6856 |
| 7137 | |
| 7138 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6857 void AllocateObjectInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 7139 const Code& stub = Code::ZoneHandle( | 6858 const Code& stub = Code::ZoneHandle( |
| 7140 compiler->zone(), StubCode::GetAllocationStubForClass(cls())); | 6859 compiler->zone(), StubCode::GetAllocationStubForClass(cls())); |
| 7141 const StubEntry stub_entry(stub); | 6860 const StubEntry stub_entry(stub); |
| 7142 compiler->GenerateCall(token_pos(), stub_entry, RawPcDescriptors::kOther, | 6861 compiler->GenerateCall(token_pos(), stub_entry, RawPcDescriptors::kOther, |
| 7143 locs()); | 6862 locs()); |
| 7144 compiler->AddStubCallTarget(stub); | 6863 compiler->AddStubCallTarget(stub); |
| 7145 __ Drop(ArgumentCount()); // Discard arguments. | 6864 __ Drop(ArgumentCount()); // Discard arguments. |
| 7146 } | 6865 } |
| 7147 | 6866 |
| 7148 | |
| 7149 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { | 6867 void DebugStepCheckInstr::EmitNativeCode(FlowGraphCompiler* compiler) { |
| 7150 ASSERT(!compiler->is_optimizing()); | 6868 ASSERT(!compiler->is_optimizing()); |
| 7151 __ BranchLinkPatchable(*StubCode::DebugStepCheck_entry()); | 6869 __ BranchLinkPatchable(*StubCode::DebugStepCheck_entry()); |
| 7152 compiler->AddCurrentDescriptor(stub_kind_, deopt_id_, token_pos()); | 6870 compiler->AddCurrentDescriptor(stub_kind_, deopt_id_, token_pos()); |
| 7153 compiler->RecordSafepoint(locs()); | 6871 compiler->RecordSafepoint(locs()); |
| 7154 } | 6872 } |
| 7155 | 6873 |
| 7156 | |
| 7157 } // namespace dart | 6874 } // namespace dart |
| 7158 | 6875 |
| 7159 #endif // defined TARGET_ARCH_ARM | 6876 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |