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

Side by Side Diff: runtime/vm/intermediate_language_mips.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_MIPS. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS.
6 #if defined(TARGET_ARCH_MIPS) 6 #if defined(TARGET_ARCH_MIPS)
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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 393
394 __ Bind(&check_identity); 394 __ Bind(&check_identity);
395 Label equality_done; 395 Label equality_done;
396 if (compiler->is_optimizing()) { 396 if (compiler->is_optimizing()) {
397 // No need to update IC data. 397 // No need to update IC data.
398 Label is_true; 398 Label is_true;
399 __ lw(A1, Address(SP, 1 * kWordSize)); 399 __ lw(A1, Address(SP, 1 * kWordSize));
400 __ lw(A0, Address(SP, 0 * kWordSize)); 400 __ lw(A0, Address(SP, 0 * kWordSize));
401 __ addiu(SP, SP, Immediate(2 * kWordSize)); 401 __ addiu(SP, SP, Immediate(2 * kWordSize));
402 __ beq(A1, A0, &is_true); 402 __ beq(A1, A0, &is_true);
403 __ LoadObject(V0, (kind == Token::kEQ) ? Bool::False() : Bool::True()); 403 __ LoadObject(V0, Bool::Get(kind != Token::kEQ));
404 __ b(&equality_done); 404 __ b(&equality_done);
405 __ Bind(&is_true); 405 __ Bind(&is_true);
406 __ LoadObject(V0, (kind == Token::kEQ) ? Bool::True() : Bool::False()); 406 __ LoadObject(V0, Bool::Get(kind == Token::kEQ));
407 if (kind == Token::kNE) { 407 if (kind == Token::kNE) {
408 // Skip not-equal result conversion. 408 // Skip not-equal result conversion.
409 __ b(&equality_done); 409 __ b(&equality_done);
410 } 410 }
411 } else { 411 } else {
412 // Call stub, load IC data in register. The stub will update ICData if 412 // Call stub, load IC data in register. The stub will update ICData if
413 // necessary. 413 // necessary.
414 Register ic_data_reg = locs->temp(0).reg(); 414 Register ic_data_reg = locs->temp(0).reg();
415 ASSERT(ic_data_reg == T0); // Stub depends on it. 415 ASSERT(ic_data_reg == T0); // Stub depends on it.
416 __ LoadObject(ic_data_reg, equality_ic_data); 416 __ LoadObject(ic_data_reg, equality_ic_data);
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 __ BranchEqual(temp, ic_data.GetReceiverClassIdAt(i), &identity_compare); 613 __ BranchEqual(temp, ic_data.GetReceiverClassIdAt(i), &identity_compare);
614 } 614 }
615 } 615 }
616 __ Bind(&identity_compare); 616 __ Bind(&identity_compare);
617 __ subu(CMPRES1, left, right); 617 __ subu(CMPRES1, left, right);
618 if (branch == NULL) { 618 if (branch == NULL) {
619 Label done, is_equal; 619 Label done, is_equal;
620 Register result = locs.out().reg(); 620 Register result = locs.out().reg();
621 __ beq(CMPRES, ZR, &is_equal); 621 __ beq(CMPRES, ZR, &is_equal);
622 // Not equal. 622 // Not equal.
623 __ LoadObject(result, 623 __ LoadObject(result, Bool::Get(kind != Token::kEQ));
624 (kind == Token::kEQ) ? Bool::False() : Bool::True());
625 __ b(&done); 624 __ b(&done);
626 __ Bind(&is_equal); 625 __ Bind(&is_equal);
627 __ LoadObject(result, 626 __ LoadObject(result, Bool::Get(kind == Token::kEQ));
628 (kind == Token::kEQ) ? Bool::True() : Bool::False());
629 __ Bind(&done); 627 __ Bind(&done);
630 628
631 } else { 629 } else {
632 Condition cond = TokenKindToSmiCondition(kind); 630 Condition cond = TokenKindToSmiCondition(kind);
633 __ mov(CMPRES2, ZR); 631 __ mov(CMPRES2, ZR);
634 branch->EmitBranchOnCondition(compiler, cond); 632 branch->EmitBranchOnCondition(compiler, cond);
635 } 633 }
636 } 634 }
637 635
638 636
(...skipping 3308 matching lines...) Expand 10 before | Expand all | Expand 10 after
3947 __ TraceSimMsg("StrictCompareInstr"); 3945 __ TraceSimMsg("StrictCompareInstr");
3948 __ Comment("StrictCompareInstr"); 3946 __ Comment("StrictCompareInstr");
3949 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT); 3947 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT);
3950 Location left = locs()->in(0); 3948 Location left = locs()->in(0);
3951 Location right = locs()->in(1); 3949 Location right = locs()->in(1);
3952 if (left.IsConstant() && right.IsConstant()) { 3950 if (left.IsConstant() && right.IsConstant()) {
3953 // TODO(vegorov): should be eliminated earlier by constant propagation. 3951 // TODO(vegorov): should be eliminated earlier by constant propagation.
3954 const bool result = (kind() == Token::kEQ_STRICT) ? 3952 const bool result = (kind() == Token::kEQ_STRICT) ?
3955 left.constant().raw() == right.constant().raw() : 3953 left.constant().raw() == right.constant().raw() :
3956 left.constant().raw() != right.constant().raw(); 3954 left.constant().raw() != right.constant().raw();
3957 __ LoadObject(locs()->out().reg(), result ? Bool::True() : Bool::False()); 3955 __ LoadObject(locs()->out().reg(), Bool::Get(result));
3958 return; 3956 return;
3959 } 3957 }
3960 if (left.IsConstant()) { 3958 if (left.IsConstant()) {
3961 compiler->EmitEqualityRegConstCompare(right.reg(), 3959 compiler->EmitEqualityRegConstCompare(right.reg(),
3962 left.constant(), 3960 left.constant(),
3963 needs_number_check(), 3961 needs_number_check(),
3964 token_pos()); 3962 token_pos());
3965 } else if (right.IsConstant()) { 3963 } else if (right.IsConstant()) {
3966 compiler->EmitEqualityRegConstCompare(left.reg(), 3964 compiler->EmitEqualityRegConstCompare(left.reg(),
3967 right.constant(), 3965 right.constant(),
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
4103 compiler->GenerateCall(token_pos(), 4101 compiler->GenerateCall(token_pos(),
4104 &label, 4102 &label,
4105 PcDescriptors::kOther, 4103 PcDescriptors::kOther,
4106 locs()); 4104 locs());
4107 __ Drop(2); // Discard type arguments and receiver. 4105 __ Drop(2); // Discard type arguments and receiver.
4108 } 4106 }
4109 4107
4110 } // namespace dart 4108 } // namespace dart
4111 4109
4112 #endif // defined TARGET_ARCH_MIPS 4110 #endif // defined TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698