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

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

Issue 23480005: Change Bool::Get to return a handle instead of a pointer to a raw object. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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_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 "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 503
504 __ Bind(&check_identity); 504 __ Bind(&check_identity);
505 Label equality_done; 505 Label equality_done;
506 if (compiler->is_optimizing()) { 506 if (compiler->is_optimizing()) {
507 // No need to update IC data. 507 // No need to update IC data.
508 Label is_true; 508 Label is_true;
509 __ popq(RAX); 509 __ popq(RAX);
510 __ popq(RDX); 510 __ popq(RDX);
511 __ cmpq(RAX, RDX); 511 __ cmpq(RAX, RDX);
512 __ j(EQUAL, &is_true); 512 __ j(EQUAL, &is_true);
513 __ LoadObject(RAX, (kind == Token::kEQ) ? Bool::False() : Bool::True()); 513 __ LoadObject(RAX, Bool::Get(kind != Token::kEQ));
514 __ jmp(&equality_done); 514 __ jmp(&equality_done);
515 __ Bind(&is_true); 515 __ Bind(&is_true);
516 __ LoadObject(RAX, (kind == Token::kEQ) ? Bool::True() : Bool::False()); 516 __ LoadObject(RAX, Bool::Get(kind == Token::kEQ));
517 if (kind == Token::kNE) { 517 if (kind == Token::kNE) {
518 // Skip not-equal result conversion. 518 // Skip not-equal result conversion.
519 __ jmp(&equality_done); 519 __ jmp(&equality_done);
520 } 520 }
521 } else { 521 } else {
522 // Call stub, load IC data in register. The stub will update ICData if 522 // Call stub, load IC data in register. The stub will update ICData if
523 // necessary. 523 // necessary.
524 Register ic_data_reg = locs->temp(0).reg(); 524 Register ic_data_reg = locs->temp(0).reg();
525 ASSERT(ic_data_reg == RBX); // Stub depends on it. 525 ASSERT(ic_data_reg == RBX); // Stub depends on it.
526 __ LoadObject(ic_data_reg, equality_ic_data); 526 __ LoadObject(ic_data_reg, equality_ic_data);
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
684 __ j(EQUAL, &identity_compare); 684 __ j(EQUAL, &identity_compare);
685 } 685 }
686 } 686 }
687 __ Bind(&identity_compare); 687 __ Bind(&identity_compare);
688 __ cmpq(left, right); 688 __ cmpq(left, right);
689 if (branch == NULL) { 689 if (branch == NULL) {
690 Label done, is_equal; 690 Label done, is_equal;
691 Register result = locs.out().reg(); 691 Register result = locs.out().reg();
692 __ j(EQUAL, &is_equal, Assembler::kNearJump); 692 __ j(EQUAL, &is_equal, Assembler::kNearJump);
693 // Not equal. 693 // Not equal.
694 __ LoadObject(result, (kind == Token::kEQ) ? Bool::False() : Bool::True()); 694 __ LoadObject(result, Bool::Get(kind != Token::kEQ));
695 __ jmp(&done, Assembler::kNearJump); 695 __ jmp(&done, Assembler::kNearJump);
696 __ Bind(&is_equal); 696 __ Bind(&is_equal);
697 __ LoadObject(result, (kind == Token::kEQ) ? Bool::True() : Bool::False()); 697 __ LoadObject(result, Bool::Get(kind == Token::kEQ));
698 __ Bind(&done); 698 __ Bind(&done);
699 } else { 699 } else {
700 Condition cond = TokenKindToSmiCondition(kind); 700 Condition cond = TokenKindToSmiCondition(kind);
701 branch->EmitBranchOnCondition(compiler, cond); 701 branch->EmitBranchOnCondition(compiler, cond);
702 } 702 }
703 } 703 }
704 704
705 705
706 // First test if receiver is NULL, in which case === is applied. 706 // First test if receiver is NULL, in which case === is applied.
707 // If type feedback was provided (lists of <class-id, target>), do a 707 // If type feedback was provided (lists of <class-id, target>), do a
(...skipping 3937 matching lines...) Expand 10 before | Expand all | Expand 10 after
4645 // Special code for numbers (compare values instead of references.) 4645 // Special code for numbers (compare values instead of references.)
4646 void StrictCompareInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4646 void StrictCompareInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4647 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT); 4647 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT);
4648 Location left = locs()->in(0); 4648 Location left = locs()->in(0);
4649 Location right = locs()->in(1); 4649 Location right = locs()->in(1);
4650 if (left.IsConstant() && right.IsConstant()) { 4650 if (left.IsConstant() && right.IsConstant()) {
4651 // TODO(vegorov): should be eliminated earlier by constant propagation. 4651 // TODO(vegorov): should be eliminated earlier by constant propagation.
4652 const bool result = (kind() == Token::kEQ_STRICT) ? 4652 const bool result = (kind() == Token::kEQ_STRICT) ?
4653 left.constant().raw() == right.constant().raw() : 4653 left.constant().raw() == right.constant().raw() :
4654 left.constant().raw() != right.constant().raw(); 4654 left.constant().raw() != right.constant().raw();
4655 __ LoadObject(locs()->out().reg(), result ? Bool::True() : Bool::False()); 4655 __ LoadObject(locs()->out().reg(), Bool::Get(result));
4656 return; 4656 return;
4657 } 4657 }
4658 if (left.IsConstant()) { 4658 if (left.IsConstant()) {
4659 compiler->EmitEqualityRegConstCompare(right.reg(), 4659 compiler->EmitEqualityRegConstCompare(right.reg(),
4660 left.constant(), 4660 left.constant(),
4661 needs_number_check(), 4661 needs_number_check(),
4662 token_pos()); 4662 token_pos());
4663 } else if (right.IsConstant()) { 4663 } else if (right.IsConstant()) {
4664 compiler->EmitEqualityRegConstCompare(left.reg(), 4664 compiler->EmitEqualityRegConstCompare(left.reg(),
4665 right.constant(), 4665 right.constant(),
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
4827 PcDescriptors::kOther, 4827 PcDescriptors::kOther,
4828 locs()); 4828 locs());
4829 __ Drop(2); // Discard type arguments and receiver. 4829 __ Drop(2); // Discard type arguments and receiver.
4830 } 4830 }
4831 4831
4832 } // namespace dart 4832 } // namespace dart
4833 4833
4834 #undef __ 4834 #undef __
4835 4835
4836 #endif // defined TARGET_ARCH_X64 4836 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698