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

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

Issue 15692005: Fix a bug in optimized ARM code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 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
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "lib/error.h" 10 #include "lib/error.h"
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 // Object.== is same as ===. 520 // Object.== is same as ===.
521 __ cmp(left, ShifterOperand(right)); 521 __ cmp(left, ShifterOperand(right));
522 if (branch != NULL) { 522 if (branch != NULL) {
523 branch->EmitBranchOnCondition(compiler, cond); 523 branch->EmitBranchOnCondition(compiler, cond);
524 } else { 524 } else {
525 Register result = locs->out().reg(); 525 Register result = locs->out().reg();
526 __ LoadObject(result, Bool::True(), cond); 526 __ LoadObject(result, Bool::True(), cond);
527 __ LoadObject(result, Bool::False(), NegateCondition(cond)); 527 __ LoadObject(result, Bool::False(), NegateCondition(cond));
528 } 528 }
529 } else { 529 } else {
530 __ PushList((1 << R0) | (1 << R1));
530 const int kNumberOfArguments = 2; 531 const int kNumberOfArguments = 2;
531 const Array& kNoArgumentNames = Array::Handle(); 532 const Array& kNoArgumentNames = Array::Handle();
532 compiler->GenerateStaticCall(deopt_id, 533 compiler->GenerateStaticCall(deopt_id,
533 token_pos, 534 token_pos,
534 target, 535 target,
535 kNumberOfArguments, 536 kNumberOfArguments,
536 kNoArgumentNames, 537 kNoArgumentNames,
537 locs); 538 locs);
538 if (branch == NULL) { 539 if (branch == NULL) {
539 if (kind == Token::kNE) { 540 if (kind == Token::kNE) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 __ b(&done); 608 __ b(&done);
608 __ Bind(&non_null_compare); // Receiver is not null. 609 __ Bind(&non_null_compare); // Receiver is not null.
609 ASSERT(left == R1); 610 ASSERT(left == R1);
610 ASSERT(right == R0); 611 ASSERT(right == R0);
611 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind, 612 EmitEqualityAsPolymorphicCall(compiler, ic_data, locs, branch, kind,
612 deopt_id, token_pos); 613 deopt_id, token_pos);
613 __ Bind(&done); 614 __ Bind(&done);
614 } 615 }
615 616
616 617
618 static Condition FlipCondition(Condition condition) {
619 switch (condition) {
620 case EQ: return EQ;
621 case NE: return NE;
622 case LT: return GT;
623 case LE: return GE;
624 case GT: return LT;
625 case GE: return LE;
626 case CC: return HI;
627 case LS: return CS;
628 case HI: return CC;
629 case CS: return LS;
630 default:
631 UNIMPLEMENTED();
632 return EQ;
633 }
634 }
635
636
617 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler, 637 static void EmitSmiComparisonOp(FlowGraphCompiler* compiler,
618 const LocationSummary& locs, 638 const LocationSummary& locs,
619 Token::Kind kind, 639 Token::Kind kind,
620 BranchInstr* branch) { 640 BranchInstr* branch) {
621 Location left = locs.in(0); 641 Location left = locs.in(0);
622 Location right = locs.in(1); 642 Location right = locs.in(1);
623 ASSERT(!left.IsConstant() || !right.IsConstant()); 643 ASSERT(!left.IsConstant() || !right.IsConstant());
624 644
625 Condition true_condition = TokenKindToSmiCondition(kind); 645 Condition true_condition = TokenKindToSmiCondition(kind);
626 646
627 if (left.IsConstant()) { 647 if (left.IsConstant()) {
628 __ CompareObject(right.reg(), left.constant()); 648 __ CompareObject(right.reg(), left.constant());
629 true_condition = FlowGraphCompiler::FlipCondition(true_condition); 649 true_condition = FlipCondition(true_condition);
630 } else if (right.IsConstant()) { 650 } else if (right.IsConstant()) {
631 __ CompareObject(left.reg(), right.constant()); 651 __ CompareObject(left.reg(), right.constant());
632 } else { 652 } else {
633 __ cmp(left.reg(), ShifterOperand(right.reg())); 653 __ cmp(left.reg(), ShifterOperand(right.reg()));
634 } 654 }
635 655
636 if (branch != NULL) { 656 if (branch != NULL) {
637 branch->EmitBranchOnCondition(compiler, true_condition); 657 branch->EmitBranchOnCondition(compiler, true_condition);
638 } else { 658 } else {
639 Register result = locs.out().reg(); 659 Register result = locs.out().reg();
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
2523 compiler->GenerateStaticCall(deopt_id(), 2543 compiler->GenerateStaticCall(deopt_id(),
2524 instance_call()->token_pos(), 2544 instance_call()->token_pos(),
2525 target, 2545 target,
2526 instance_call()->ArgumentCount(), 2546 instance_call()->ArgumentCount(),
2527 instance_call()->argument_names(), 2547 instance_call()->argument_names(),
2528 locs()); 2548 locs());
2529 return; 2549 return;
2530 } 2550 }
2531 2551
2532 // Load receiver into R0. 2552 // Load receiver into R0.
2533 __ ldr(R0, Address(SP, (instance_call()->ArgumentCount() - 1) * kWordSize)); 2553 __ LoadFromOffset(kLoadWord, R0, SP,
2554 (instance_call()->ArgumentCount() - 1) * kWordSize);
2534 2555
2535 LoadValueCid(compiler, R2, R0, 2556 LoadValueCid(compiler, R2, R0,
2536 (ic_data().GetReceiverClassIdAt(0) == kSmiCid) ? NULL : deopt); 2557 (ic_data().GetReceiverClassIdAt(0) == kSmiCid) ? NULL : deopt);
2537 2558
2538 compiler->EmitTestAndCall(ic_data(), 2559 compiler->EmitTestAndCall(ic_data(),
2539 R2, // Class id register. 2560 R2, // Class id register.
2540 instance_call()->ArgumentCount(), 2561 instance_call()->ArgumentCount(),
2541 instance_call()->argument_names(), 2562 instance_call()->argument_names(),
2542 deopt, 2563 deopt,
2543 deopt_id(), 2564 deopt_id(),
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
3010 compiler->GenerateCall(token_pos(), 3031 compiler->GenerateCall(token_pos(),
3011 &label, 3032 &label,
3012 PcDescriptors::kOther, 3033 PcDescriptors::kOther,
3013 locs()); 3034 locs());
3014 __ Drop(2); // Discard type arguments and receiver. 3035 __ Drop(2); // Discard type arguments and receiver.
3015 } 3036 }
3016 3037
3017 } // namespace dart 3038 } // namespace dart
3018 3039
3019 #endif // defined TARGET_ARCH_ARM 3040 #endif // defined TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698