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

Side by Side Diff: runtime/vm/intermediate_language_ia32.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_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 "lib/error.h" 10 #include "lib/error.h"
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 __ Bind(&non_null_compare); // Receiver is not null. 492 __ Bind(&non_null_compare); // Receiver is not null.
493 __ pushl(left); 493 __ pushl(left);
494 __ pushl(right); 494 __ pushl(right);
495 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind, 495 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind,
496 deopt_id, token_pos, try_index, 496 deopt_id, token_pos, try_index,
497 locs.stack_bitmap()); 497 locs.stack_bitmap());
498 __ Bind(&done); 498 __ Bind(&done);
499 } 499 }
500 500
501 501
502 static intptr_t GetCid(const Value& v) {
503 // TODO(srdjan): CompileType does not give us correct type for optimizations.
504 // const AbstractType& type = AbstractType::Handle(v.CompileType());
505 // return Class::Handle(type.type_class()).id();
506 return kIllegalCid;
507 }
508
509
510 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler, 502 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler,
511 const LocationSummary& locs, 503 const LocationSummary& locs,
512 Token::Kind kind, 504 Token::Kind kind,
513 BranchInstr* branch, 505 BranchInstr* branch,
514 intptr_t deopt_id, 506 intptr_t deopt_id,
515 intptr_t token_pos, 507 intptr_t token_pos,
516 intptr_t try_index) { 508 intptr_t try_index) {
517 Register left = locs.in(0).reg(); 509 Register left = locs.in(0).reg();
518 Register right = locs.in(1).reg(); 510 Register right = locs.in(1).reg();
519 const bool left_is_smi = (branch == NULL) ? 511 const bool left_is_smi = (branch == NULL) ?
520 false : (GetCid(*branch->left()) == kSmiCid); 512 false : (branch->left()->ResultCid() == kSmiCid);
521 const bool right_is_smi = (branch == NULL) ? 513 const bool right_is_smi = (branch == NULL) ?
522 false : (GetCid(*branch->right()) == kSmiCid); 514 false : (branch->right()->ResultCid() == kSmiCid);
523 if (!left_is_smi || !right_is_smi) { 515 if (!left_is_smi || !right_is_smi) {
524 Register temp = locs.temp(0).reg(); 516 Register temp = locs.temp(0).reg();
525 Label* deopt = compiler->AddDeoptStub(deopt_id, 517 Label* deopt = compiler->AddDeoptStub(deopt_id,
526 try_index, 518 try_index,
527 kDeoptSmiCompareSmi, 519 kDeoptSmiCompareSmi,
528 left, 520 left,
529 right); 521 right);
530 __ movl(temp, left); 522 __ movl(temp, left);
531 __ orl(temp, right); 523 __ orl(temp, right);
532 __ testl(temp, Immediate(kSmiTagMask)); 524 __ testl(temp, Immediate(kSmiTagMask));
(...skipping 910 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 } 1435 }
1444 } 1436 }
1445 1437
1446 1438
1447 static void EmitSmiBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) { 1439 static void EmitSmiBinaryOp(FlowGraphCompiler* compiler, BinaryOpComp* comp) {
1448 Register left = comp->locs()->in(0).reg(); 1440 Register left = comp->locs()->in(0).reg();
1449 Register right = comp->locs()->in(1).reg(); 1441 Register right = comp->locs()->in(1).reg();
1450 Register result = comp->locs()->out().reg(); 1442 Register result = comp->locs()->out().reg();
1451 Register temp = comp->locs()->temp(0).reg(); 1443 Register temp = comp->locs()->temp(0).reg();
1452 ASSERT(left == result); 1444 ASSERT(left == result);
1453 const bool left_is_smi = (GetCid(*comp->left()) == kSmiCid); 1445 const bool left_is_smi = comp->left()->ResultCid() == kSmiCid;
1454 const bool right_is_smi = (GetCid(*comp->right()) == kSmiCid); 1446 const bool right_is_smi = comp->right()->ResultCid() == kSmiCid;
1455 bool can_deopt; 1447 bool can_deopt;
1456 switch (comp->op_kind()) { 1448 switch (comp->op_kind()) {
1457 case Token::kBIT_AND: 1449 case Token::kBIT_AND:
1458 case Token::kBIT_OR: 1450 case Token::kBIT_OR:
1459 case Token::kBIT_XOR: 1451 case Token::kBIT_XOR:
1460 can_deopt = !(right_is_smi && left_is_smi); 1452 can_deopt = !(right_is_smi && left_is_smi);
1461 break; 1453 break;
1462 default: 1454 default:
1463 can_deopt = true; 1455 can_deopt = true;
1464 } 1456 }
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
2135 locs()->stack_bitmap()); 2127 locs()->stack_bitmap());
2136 __ CompareObject(EAX, compiler->bool_true()); 2128 __ CompareObject(EAX, compiler->bool_true());
2137 EmitBranchOnCondition(compiler, branch_condition); 2129 EmitBranchOnCondition(compiler, branch_condition);
2138 } 2130 }
2139 2131
2140 } // namespace dart 2132 } // namespace dart
2141 2133
2142 #undef __ 2134 #undef __
2143 2135
2144 #endif // defined TARGET_ARCH_X64 2136 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698