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

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

Issue 10827387: Reenable elimination of strict equals when right side is true. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_X64. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64.
6 #if defined(TARGET_ARCH_X64) 6 #if defined(TARGET_ARCH_X64)
7 7
8 #include "vm/intermediate_language.h" 8 #include "vm/intermediate_language.h"
9 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 __ Bind(&non_null_compare); // Receiver is not null. 502 __ Bind(&non_null_compare); // Receiver is not null.
503 __ pushq(left); 503 __ pushq(left);
504 __ pushq(right); 504 __ pushq(right);
505 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind, 505 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind,
506 deopt_id, token_pos, try_index, 506 deopt_id, token_pos, try_index,
507 locs.stack_bitmap()); 507 locs.stack_bitmap());
508 __ Bind(&done); 508 __ Bind(&done);
509 } 509 }
510 510
511 511
512 static intptr_t GetCid(const Value& v) {
513 // TODO(srdjan): CompileType does not give us correct type for optimizations.
514 // const AbstractType& type = AbstractType::Handle(v.CompileType());
515 // return Class::Handle(type.type_class()).id();
516 return kIllegalCid;
517 }
518
519
520 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler, 512 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler,
521 const LocationSummary& locs, 513 const LocationSummary& locs,
522 Token::Kind kind, 514 Token::Kind kind,
523 BranchInstr* branch, 515 BranchInstr* branch,
524 intptr_t deopt_id, 516 intptr_t deopt_id,
525 intptr_t token_pos, 517 intptr_t token_pos,
526 intptr_t try_index) { 518 intptr_t try_index) {
527 Register left = locs.in(0).reg(); 519 Register left = locs.in(0).reg();
528 Register right = locs.in(1).reg(); 520 Register right = locs.in(1).reg();
529 const bool left_is_smi = (branch == NULL) ? 521 const bool left_is_smi = (branch == NULL) ?
530 false : (GetCid(*branch->left()) == kSmiCid); 522 false : (branch->left()->ResultCid() == kSmiCid);
531 const bool right_is_smi = (branch == NULL) ? 523 const bool right_is_smi = (branch == NULL) ?
532 false : (GetCid(*branch->right()) == kSmiCid); 524 false : (branch->right()->ResultCid() == kSmiCid);
533 if (!left_is_smi || !right_is_smi) { 525 if (!left_is_smi || !right_is_smi) {
534 Register temp = locs.temp(0).reg(); 526 Register temp = locs.temp(0).reg();
535 Label* deopt = compiler->AddDeoptStub(deopt_id, 527 Label* deopt = compiler->AddDeoptStub(deopt_id,
536 try_index, 528 try_index,
537 kDeoptSmiCompareSmi, 529 kDeoptSmiCompareSmi,
538 left, 530 left,
539 right); 531 right);
540 __ movq(temp, left); 532 __ movq(temp, left);
541 __ orq(temp, right); 533 __ orq(temp, right);
542 __ testq(temp, Immediate(kSmiTagMask)); 534 __ testq(temp, Immediate(kSmiTagMask));
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1458 } 1450 }
1459 } 1451 }
1460 1452
1461 1453
1462 static void EmitSmiBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) { 1454 static void EmitSmiBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
1463 Register left = comp->locs()->in(0).reg(); 1455 Register left = comp->locs()->in(0).reg();
1464 Register right = comp->locs()->in(1).reg(); 1456 Register right = comp->locs()->in(1).reg();
1465 Register result = comp->locs()->out().reg(); 1457 Register result = comp->locs()->out().reg();
1466 Register temp = comp->locs()->temp(0).reg(); 1458 Register temp = comp->locs()->temp(0).reg();
1467 ASSERT(left == result); 1459 ASSERT(left == result);
1468 const bool left_is_smi = (GetCid(*comp->left()) == kSmiCid); 1460 const bool left_is_smi = comp->left()->ResultCid() == kSmiCid;
1469 const bool right_is_smi = (GetCid(*comp->right()) == kSmiCid); 1461 const bool right_is_smi = comp->right()->ResultCid() == kSmiCid;
1470 bool can_deopt; 1462 bool can_deopt;
1471 switch (comp->op_kind()) { 1463 switch (comp->op_kind()) {
1472 case Token::kBIT_AND: 1464 case Token::kBIT_AND:
1473 case Token::kBIT_OR: 1465 case Token::kBIT_OR:
1474 case Token::kBIT_XOR: 1466 case Token::kBIT_XOR:
1475 can_deopt = !(right_is_smi && left_is_smi); 1467 can_deopt = !(right_is_smi && left_is_smi);
1476 break; 1468 break;
1477 default: 1469 default:
1478 can_deopt = true; 1470 can_deopt = true;
1479 } 1471 }
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 locs()->stack_bitmap()); 2140 locs()->stack_bitmap());
2149 __ CompareObject(RAX, compiler->bool_true()); 2141 __ CompareObject(RAX, compiler->bool_true());
2150 EmitBranchOnCondition(compiler, branch_condition); 2142 EmitBranchOnCondition(compiler, branch_condition);
2151 } 2143 }
2152 2144
2153 } // namespace dart 2145 } // namespace dart
2154 2146
2155 #undef __ 2147 #undef __
2156 2148
2157 #endif // defined TARGET_ARCH_X64 2149 #endif // defined TARGET_ARCH_X64
OLDNEW
« runtime/vm/intermediate_language.cc ('K') | « runtime/vm/intermediate_language_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698