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

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

Issue 676743002: IR cleanup: pass deopt id as constructor argument instead of doing deopt_id_ assignment. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
6 #if defined(TARGET_ARCH_IA32) 6 #if defined(TARGET_ARCH_IA32)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 3369 matching lines...) Expand 10 before | Expand all | Expand 10 after
3380 const intptr_t value_cid = value_type->ToCid(); 3380 const intptr_t value_cid = value_type->ToCid();
3381 const Register value = locs()->in(0).reg(); 3381 const Register value = locs()->in(0).reg();
3382 const XmmRegister result = locs()->out(0).fpu_reg(); 3382 const XmmRegister result = locs()->out(0).fpu_reg();
3383 3383
3384 if (value_cid == kDoubleCid) { 3384 if (value_cid == kDoubleCid) {
3385 __ movsd(result, FieldAddress(value, Double::value_offset())); 3385 __ movsd(result, FieldAddress(value, Double::value_offset()));
3386 } else if (value_cid == kSmiCid) { 3386 } else if (value_cid == kSmiCid) {
3387 __ SmiUntag(value); // Untag input before conversion. 3387 __ SmiUntag(value); // Untag input before conversion.
3388 __ cvtsi2sd(result, value); 3388 __ cvtsi2sd(result, value);
3389 } else { 3389 } else {
3390 Label* deopt = compiler->AddDeoptStub(deopt_id_, 3390 Label* deopt = compiler->AddDeoptStub(GetDeoptId(),
3391 ICData::kDeoptBinaryDoubleOp); 3391 ICData::kDeoptBinaryDoubleOp);
3392 Register temp = locs()->temp(0).reg(); 3392 Register temp = locs()->temp(0).reg();
3393 if (value_type->is_nullable() && 3393 if (value_type->is_nullable() &&
3394 (value_type->ToNullableCid() == kDoubleCid)) { 3394 (value_type->ToNullableCid() == kDoubleCid)) {
3395 const Immediate& raw_null = 3395 const Immediate& raw_null =
3396 Immediate(reinterpret_cast<intptr_t>(Object::null())); 3396 Immediate(reinterpret_cast<intptr_t>(Object::null()));
3397 __ cmpl(value, raw_null); 3397 __ cmpl(value, raw_null);
3398 __ j(EQUAL, deopt); 3398 __ j(EQUAL, deopt);
3399 // It must be double now. 3399 // It must be double now.
3400 __ movsd(result, FieldAddress(value, Double::value_offset())); 3400 __ movsd(result, FieldAddress(value, Double::value_offset()));
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
3457 } 3457 }
3458 3458
3459 3459
3460 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3460 void UnboxFloat32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3461 const intptr_t value_cid = value()->Type()->ToCid(); 3461 const intptr_t value_cid = value()->Type()->ToCid();
3462 const Register value = locs()->in(0).reg(); 3462 const Register value = locs()->in(0).reg();
3463 const XmmRegister result = locs()->out(0).fpu_reg(); 3463 const XmmRegister result = locs()->out(0).fpu_reg();
3464 3464
3465 if (value_cid != kFloat32x4Cid) { 3465 if (value_cid != kFloat32x4Cid) {
3466 const Register temp = locs()->temp(0).reg(); 3466 const Register temp = locs()->temp(0).reg();
3467 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); 3467 Label* deopt =
3468 compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptCheckClass);
3468 __ testl(value, Immediate(kSmiTagMask)); 3469 __ testl(value, Immediate(kSmiTagMask));
3469 __ j(ZERO, deopt); 3470 __ j(ZERO, deopt);
3470 __ CompareClassId(value, kFloat32x4Cid, temp); 3471 __ CompareClassId(value, kFloat32x4Cid, temp);
3471 __ j(NOT_EQUAL, deopt); 3472 __ j(NOT_EQUAL, deopt);
3472 } 3473 }
3473 __ movups(result, FieldAddress(value, Float32x4::value_offset())); 3474 __ movups(result, FieldAddress(value, Float32x4::value_offset()));
3474 } 3475 }
3475 3476
3476 3477
3477 LocationSummary* BoxFloat64x2Instr::MakeLocationSummary(Isolate* isolate, 3478 LocationSummary* BoxFloat64x2Instr::MakeLocationSummary(Isolate* isolate,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3515 } 3516 }
3516 3517
3517 3518
3518 void UnboxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3519 void UnboxFloat64x2Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3519 const intptr_t value_cid = value()->Type()->ToCid(); 3520 const intptr_t value_cid = value()->Type()->ToCid();
3520 const Register value = locs()->in(0).reg(); 3521 const Register value = locs()->in(0).reg();
3521 const XmmRegister result = locs()->out(0).fpu_reg(); 3522 const XmmRegister result = locs()->out(0).fpu_reg();
3522 3523
3523 if (value_cid != kFloat64x2Cid) { 3524 if (value_cid != kFloat64x2Cid) {
3524 const Register temp = locs()->temp(0).reg(); 3525 const Register temp = locs()->temp(0).reg();
3525 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); 3526 Label* deopt =
3527 compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptCheckClass);
3526 __ testl(value, Immediate(kSmiTagMask)); 3528 __ testl(value, Immediate(kSmiTagMask));
3527 __ j(ZERO, deopt); 3529 __ j(ZERO, deopt);
3528 __ CompareClassId(value, kFloat64x2Cid, temp); 3530 __ CompareClassId(value, kFloat64x2Cid, temp);
3529 __ j(NOT_EQUAL, deopt); 3531 __ j(NOT_EQUAL, deopt);
3530 } 3532 }
3531 __ movups(result, FieldAddress(value, Float64x2::value_offset())); 3533 __ movups(result, FieldAddress(value, Float64x2::value_offset()));
3532 } 3534 }
3533 3535
3534 3536
3535 LocationSummary* BoxInt32x4Instr::MakeLocationSummary(Isolate* isolate, 3537 LocationSummary* BoxInt32x4Instr::MakeLocationSummary(Isolate* isolate,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
3573 } 3575 }
3574 3576
3575 3577
3576 void UnboxInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) { 3578 void UnboxInt32x4Instr::EmitNativeCode(FlowGraphCompiler* compiler) {
3577 const intptr_t value_cid = value()->Type()->ToCid(); 3579 const intptr_t value_cid = value()->Type()->ToCid();
3578 const Register value = locs()->in(0).reg(); 3580 const Register value = locs()->in(0).reg();
3579 const XmmRegister result = locs()->out(0).fpu_reg(); 3581 const XmmRegister result = locs()->out(0).fpu_reg();
3580 3582
3581 if (value_cid != kInt32x4Cid) { 3583 if (value_cid != kInt32x4Cid) {
3582 const Register temp = locs()->temp(0).reg(); 3584 const Register temp = locs()->temp(0).reg();
3583 Label* deopt = compiler->AddDeoptStub(deopt_id_, ICData::kDeoptCheckClass); 3585 Label* deopt =
3586 compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptCheckClass);
3584 __ testl(value, Immediate(kSmiTagMask)); 3587 __ testl(value, Immediate(kSmiTagMask));
3585 __ j(ZERO, deopt); 3588 __ j(ZERO, deopt);
3586 __ CompareClassId(value, kInt32x4Cid, temp); 3589 __ CompareClassId(value, kInt32x4Cid, temp);
3587 __ j(NOT_EQUAL, deopt); 3590 __ j(NOT_EQUAL, deopt);
3588 } 3591 }
3589 __ movups(result, FieldAddress(value, Int32x4::value_offset())); 3592 __ movups(result, FieldAddress(value, Int32x4::value_offset()));
3590 } 3593 }
3591 3594
3592 3595
3593 3596
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after
5671 5674
5672 if (value_cid == kMintCid) { 5675 if (value_cid == kMintCid) {
5673 __ movl(result_lo, FieldAddress(value, Mint::value_offset())); 5676 __ movl(result_lo, FieldAddress(value, Mint::value_offset()));
5674 __ movl(result_hi, FieldAddress(value, Mint::value_offset() + kWordSize)); 5677 __ movl(result_hi, FieldAddress(value, Mint::value_offset() + kWordSize));
5675 } else if (value_cid == kSmiCid) { 5678 } else if (value_cid == kSmiCid) {
5676 __ movl(result_lo, value); 5679 __ movl(result_lo, value);
5677 __ SmiUntag(result_lo); 5680 __ SmiUntag(result_lo);
5678 // Sign extend into result_hi. 5681 // Sign extend into result_hi.
5679 __ cdq(); 5682 __ cdq();
5680 } else { 5683 } else {
5681 Label* deopt = compiler->AddDeoptStub(deopt_id_, 5684 Label* deopt = compiler->AddDeoptStub(GetDeoptId(),
5682 ICData::kDeoptUnboxInteger); 5685 ICData::kDeoptUnboxInteger);
5683 Label is_smi, done; 5686 Label is_smi, done;
5684 __ testl(value, Immediate(kSmiTagMask)); 5687 __ testl(value, Immediate(kSmiTagMask));
5685 __ j(ZERO, &is_smi); 5688 __ j(ZERO, &is_smi);
5686 __ CompareClassId(value, kMintCid, result_lo); 5689 __ CompareClassId(value, kMintCid, result_lo);
5687 __ j(NOT_EQUAL, deopt); 5690 __ j(NOT_EQUAL, deopt);
5688 __ movl(result_lo, FieldAddress(value, Mint::value_offset())); 5691 __ movl(result_lo, FieldAddress(value, Mint::value_offset()));
5689 __ movl(result_hi, FieldAddress(value, Mint::value_offset() + kWordSize)); 5692 __ movl(result_hi, FieldAddress(value, Mint::value_offset() + kWordSize));
5690 __ jmp(&done); 5693 __ jmp(&done);
5691 __ Bind(&is_smi); 5694 __ Bind(&is_smi);
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
6336 } 6339 }
6337 } 6340 }
6338 6341
6339 6342
6340 void UnboxIntNInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 6343 void UnboxIntNInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
6341 const intptr_t value_cid = value()->Type()->ToCid(); 6344 const intptr_t value_cid = value()->Type()->ToCid();
6342 Register value = locs()->in(0).reg(); 6345 Register value = locs()->in(0).reg();
6343 const Register result = locs()->out(0).reg(); 6346 const Register result = locs()->out(0).reg();
6344 const Register temp = CanDeoptimize() ? locs()->temp(0).reg() : kNoRegister; 6347 const Register temp = CanDeoptimize() ? locs()->temp(0).reg() : kNoRegister;
6345 Label* deopt = CanDeoptimize() ? 6348 Label* deopt = CanDeoptimize() ?
6346 compiler->AddDeoptStub(deopt_id_, ICData::kDeoptUnboxInteger) : NULL; 6349 compiler->AddDeoptStub(GetDeoptId(), ICData::kDeoptUnboxInteger) : NULL;
6347 Label* out_of_range = !is_truncating() ? deopt : NULL; 6350 Label* out_of_range = !is_truncating() ? deopt : NULL;
6348 6351
6349 const intptr_t lo_offset = Mint::value_offset(); 6352 const intptr_t lo_offset = Mint::value_offset();
6350 const intptr_t hi_offset = Mint::value_offset() + kWordSize; 6353 const intptr_t hi_offset = Mint::value_offset() + kWordSize;
6351 6354
6352 if (value_cid == kSmiCid) { 6355 if (value_cid == kSmiCid) {
6353 ASSERT(value == result); 6356 ASSERT(value == result);
6354 __ SmiUntag(value); 6357 __ SmiUntag(value);
6355 } else if (value_cid == kMintCid) { 6358 } else if (value_cid == kMintCid) {
6356 ASSERT((value != result) || (out_of_range == NULL)); 6359 ASSERT((value != result) || (out_of_range == NULL));
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
6786 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6789 __ movl(EDX, Immediate(kInvalidObjectPointer));
6787 __ movl(EDX, Immediate(kInvalidObjectPointer)); 6790 __ movl(EDX, Immediate(kInvalidObjectPointer));
6788 #endif 6791 #endif
6789 } 6792 }
6790 6793
6791 } // namespace dart 6794 } // namespace dart
6792 6795
6793 #undef __ 6796 #undef __
6794 6797
6795 #endif // defined TARGET_ARCH_IA32 6798 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_arm64.cc ('k') | runtime/vm/intermediate_language_mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698