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

Side by Side Diff: runtime/vm/intermediate_language_arm.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_ARM. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM.
6 #if defined(TARGET_ARCH_ARM) 6 #if defined(TARGET_ARCH_ARM)
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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 equality_ic_data); 396 equality_ic_data);
397 Label check_ne; 397 Label check_ne;
398 __ b(&check_ne); 398 __ b(&check_ne);
399 399
400 __ Bind(&check_identity); 400 __ Bind(&check_identity);
401 Label equality_done; 401 Label equality_done;
402 if (compiler->is_optimizing()) { 402 if (compiler->is_optimizing()) {
403 // No need to update IC data. 403 // No need to update IC data.
404 __ PopList((1 << R0) | (1 << R1)); 404 __ PopList((1 << R0) | (1 << R1));
405 __ cmp(R0, ShifterOperand(R1)); 405 __ cmp(R0, ShifterOperand(R1));
406 __ LoadObject(R0, (kind == Token::kEQ) ? Bool::False() : Bool::True(), NE); 406 __ LoadObject(R0, Bool::Get(kind != Token::kEQ), NE);
407 __ LoadObject(R0, (kind == Token::kEQ) ? Bool::True() : Bool::False(), EQ); 407 __ LoadObject(R0, Bool::Get(kind == Token::kEQ), EQ);
408 if (kind == Token::kNE) { 408 if (kind == Token::kNE) {
409 // Skip not-equal result conversion. 409 // Skip not-equal result conversion.
410 __ b(&equality_done); 410 __ b(&equality_done);
411 } 411 }
412 } else { 412 } else {
413 // Call stub, load IC data in register. The stub will update ICData if 413 // Call stub, load IC data in register. The stub will update ICData if
414 // necessary. 414 // necessary.
415 Register ic_data_reg = locs->temp(0).reg(); 415 Register ic_data_reg = locs->temp(0).reg();
416 ASSERT(ic_data_reg == R5); // Stub depends on it. 416 ASSERT(ic_data_reg == R5); // Stub depends on it.
417 __ LoadObject(ic_data_reg, equality_ic_data); 417 __ LoadObject(ic_data_reg, equality_ic_data);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 if (i == (len - 1)) { 581 if (i == (len - 1)) {
582 __ b(deopt, NE); 582 __ b(deopt, NE);
583 } else { 583 } else {
584 __ b(&identity_compare, EQ); 584 __ b(&identity_compare, EQ);
585 } 585 }
586 } 586 }
587 __ Bind(&identity_compare); 587 __ Bind(&identity_compare);
588 __ cmp(left, ShifterOperand(right)); 588 __ cmp(left, ShifterOperand(right));
589 if (branch == NULL) { 589 if (branch == NULL) {
590 Register result = locs.out().reg(); 590 Register result = locs.out().reg();
591 __ LoadObject(result, 591 __ LoadObject(result, Bool::Get(kind == Token::kEQ), EQ);
592 (kind == Token::kEQ) ? Bool::True() : Bool::False(), EQ); 592 __ LoadObject(result, Bool::Get(kind != Token::kEQ), NE);
593 __ LoadObject(result,
594 (kind == Token::kEQ) ? Bool::False() : Bool::True(), NE);
595 } else { 593 } else {
596 Condition cond = TokenKindToSmiCondition(kind); 594 Condition cond = TokenKindToSmiCondition(kind);
597 branch->EmitBranchOnCondition(compiler, cond); 595 branch->EmitBranchOnCondition(compiler, cond);
598 } 596 }
599 } 597 }
600 598
601 599
602 // First test if receiver is NULL, in which case === is applied. 600 // First test if receiver is NULL, in which case === is applied.
603 // If type feedback was provided (lists of <class-id, target>), do a 601 // If type feedback was provided (lists of <class-id, target>), do a
604 // type by type check (either === or static call to the operator. 602 // type by type check (either === or static call to the operator.
(...skipping 3923 matching lines...) Expand 10 before | Expand all | Expand 10 after
4528 // Special code for numbers (compare values instead of references.) 4526 // Special code for numbers (compare values instead of references.)
4529 void StrictCompareInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 4527 void StrictCompareInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
4530 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT); 4528 ASSERT(kind() == Token::kEQ_STRICT || kind() == Token::kNE_STRICT);
4531 Location left = locs()->in(0); 4529 Location left = locs()->in(0);
4532 Location right = locs()->in(1); 4530 Location right = locs()->in(1);
4533 if (left.IsConstant() && right.IsConstant()) { 4531 if (left.IsConstant() && right.IsConstant()) {
4534 // TODO(vegorov): should be eliminated earlier by constant propagation. 4532 // TODO(vegorov): should be eliminated earlier by constant propagation.
4535 const bool result = (kind() == Token::kEQ_STRICT) ? 4533 const bool result = (kind() == Token::kEQ_STRICT) ?
4536 left.constant().raw() == right.constant().raw() : 4534 left.constant().raw() == right.constant().raw() :
4537 left.constant().raw() != right.constant().raw(); 4535 left.constant().raw() != right.constant().raw();
4538 __ LoadObject(locs()->out().reg(), result ? Bool::True() : Bool::False()); 4536 __ LoadObject(locs()->out().reg(), Bool::Get(result));
4539 return; 4537 return;
4540 } 4538 }
4541 if (left.IsConstant()) { 4539 if (left.IsConstant()) {
4542 compiler->EmitEqualityRegConstCompare(right.reg(), 4540 compiler->EmitEqualityRegConstCompare(right.reg(),
4543 left.constant(), 4541 left.constant(),
4544 needs_number_check(), 4542 needs_number_check(),
4545 token_pos()); 4543 token_pos());
4546 } else if (right.IsConstant()) { 4544 } else if (right.IsConstant()) {
4547 compiler->EmitEqualityRegConstCompare(left.reg(), 4545 compiler->EmitEqualityRegConstCompare(left.reg(),
4548 right.constant(), 4546 right.constant(),
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
4670 compiler->GenerateCall(token_pos(), 4668 compiler->GenerateCall(token_pos(),
4671 &label, 4669 &label,
4672 PcDescriptors::kOther, 4670 PcDescriptors::kOther,
4673 locs()); 4671 locs());
4674 __ Drop(2); // Discard type arguments and receiver. 4672 __ Drop(2); // Discard type arguments and receiver.
4675 } 4673 }
4676 4674
4677 } // namespace dart 4675 } // namespace dart
4678 4676
4679 #endif // defined TARGET_ARCH_ARM 4677 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698