Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: runtime/vm/intermediate_language_arm.cc

Issue 264953004: For nullable/double typed fields compare with null for deoptimization, else assume double. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/cpu.h" 10 #include "vm/cpu.h"
(...skipping 3293 matching lines...) Expand 10 before | Expand all | Expand 10 after
3304 summary->set_in(0, needs_writable_input 3304 summary->set_in(0, needs_writable_input
3305 ? Location::WritableRegister() 3305 ? Location::WritableRegister()
3306 : Location::RequiresRegister()); 3306 : Location::RequiresRegister());
3307 if (needs_temp) summary->set_temp(0, Location::RequiresRegister()); 3307 if (needs_temp) summary->set_temp(0, Location::RequiresRegister());
3308 summary->set_out(0, Location::RequiresFpuRegister()); 3308 summary->set_out(0, Location::RequiresFpuRegister());
3309 return summary; 3309 return summary;
3310 } 3310 }
3311 3311
3312 3312
3313 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 3313 void UnboxDoubleInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
3314 const intptr_t value_cid = value()->Type()->ToCid(); 3314 CompileType* value_type = value()->Type();
3315 const intptr_t value_cid = value_type->ToCid();
3315 const Register value = locs()->in(0).reg(); 3316 const Register value = locs()->in(0).reg();
3316 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg()); 3317 const DRegister result = EvenDRegisterOf(locs()->out(0).fpu_reg());
3317 3318
3318 if (value_cid == kDoubleCid) { 3319 if (value_cid == kDoubleCid) {
3319 __ LoadDFromOffset(result, value, Double::value_offset() - kHeapObjectTag); 3320 __ LoadDFromOffset(result, value, Double::value_offset() - kHeapObjectTag);
3320 } else if (value_cid == kSmiCid) { 3321 } else if (value_cid == kSmiCid) {
3321 __ SmiUntag(value); // Untag input before conversion. 3322 __ SmiUntag(value); // Untag input before conversion.
3322 __ vmovsr(STMP, value); 3323 __ vmovsr(STMP, value);
3323 __ vcvtdi(result, STMP); 3324 __ vcvtdi(result, STMP);
3324 } else { 3325 } else {
3325 Label* deopt = compiler->AddDeoptStub(deopt_id_, 3326 Label* deopt = compiler->AddDeoptStub(deopt_id_,
3326 ICData::kDeoptBinaryDoubleOp); 3327 ICData::kDeoptBinaryDoubleOp);
3327 Register temp = locs()->temp(0).reg(); 3328 Register temp = locs()->temp(0).reg();
3328 Label is_smi, done; 3329 if (value_type->is_nullable() && (value_type->cid() == kDoubleCid)) {
3329 __ tst(value, ShifterOperand(kSmiTagMask)); 3330 __ CompareImmediate(value, reinterpret_cast<intptr_t>(Object::null()));
3330 __ b(&is_smi, EQ); 3331 __ b(deopt, EQ);
3331 __ CompareClassId(value, kDoubleCid, temp); 3332 // It must be double now.
3332 __ b(deopt, NE); 3333 __ LoadDFromOffset(result, value,
3333 __ LoadDFromOffset(result, value, Double::value_offset() - kHeapObjectTag); 3334 Double::value_offset() - kHeapObjectTag);
3334 __ b(&done); 3335 } else {
3335 __ Bind(&is_smi); 3336 Label is_smi, done;
3336 // TODO(regis): Why do we preserve value here but not above? 3337 __ tst(value, ShifterOperand(kSmiTagMask));
3337 __ mov(IP, ShifterOperand(value, ASR, 1)); // Copy and untag. 3338 __ b(&is_smi, EQ);
3338 __ vmovsr(STMP, IP); 3339 __ CompareClassId(value, kDoubleCid, temp);
3339 __ vcvtdi(result, STMP); 3340 __ b(deopt, NE);
3340 __ Bind(&done); 3341 __ LoadDFromOffset(result, value,
3342 Double::value_offset() - kHeapObjectTag);
3343 __ b(&done);
3344 __ Bind(&is_smi);
3345 // TODO(regis): Why do we preserve value here but not above?
3346 __ mov(IP, ShifterOperand(value, ASR, 1)); // Copy and untag.
3347 __ vmovsr(STMP, IP);
3348 __ vcvtdi(result, STMP);
3349 __ Bind(&done);
3350 }
3341 } 3351 }
3342 } 3352 }
3343 3353
3344 3354
3345 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const { 3355 LocationSummary* BoxFloat32x4Instr::MakeLocationSummary(bool opt) const {
3346 const intptr_t kNumInputs = 1; 3356 const intptr_t kNumInputs = 1;
3347 const intptr_t kNumTemps = 1; 3357 const intptr_t kNumTemps = 1;
3348 LocationSummary* summary = 3358 LocationSummary* summary =
3349 new LocationSummary(kNumInputs, 3359 new LocationSummary(kNumInputs,
3350 kNumTemps, 3360 kNumTemps,
(...skipping 2715 matching lines...) Expand 10 before | Expand all | Expand 10 after
6066 compiler->GenerateCall(token_pos(), 6076 compiler->GenerateCall(token_pos(),
6067 &label, 6077 &label,
6068 PcDescriptors::kOther, 6078 PcDescriptors::kOther,
6069 locs()); 6079 locs());
6070 __ Drop(ArgumentCount()); // Discard arguments. 6080 __ Drop(ArgumentCount()); // Discard arguments.
6071 } 6081 }
6072 6082
6073 } // namespace dart 6083 } // namespace dart
6074 6084
6075 #endif // defined TARGET_ARCH_ARM 6085 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698