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

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

Issue 14251023: Merge (x & y) == 0 pattern to emit a single test instruction. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 8 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/intermediate_language.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 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 *ic_data()); 602 *ic_data());
603 if (branch->is_checked()) { 603 if (branch->is_checked()) {
604 EmitAssertBoolean(R0, token_pos(), deopt_id(), locs(), compiler); 604 EmitAssertBoolean(R0, token_pos(), deopt_id(), locs(), compiler);
605 } 605 }
606 Condition branch_condition = (kind() == Token::kNE) ? NE : EQ; 606 Condition branch_condition = (kind() == Token::kNE) ? NE : EQ;
607 __ CompareObject(R0, Bool::True()); 607 __ CompareObject(R0, Bool::True());
608 branch->EmitBranchOnCondition(compiler, branch_condition); 608 branch->EmitBranchOnCondition(compiler, branch_condition);
609 } 609 }
610 610
611 611
612 LocationSummary* TestSmiInstr::MakeLocationSummary() const {
613 const intptr_t kNumInputs = 2;
614 const intptr_t kNumTemps = 0;
615 LocationSummary* locs =
616 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
617 locs->set_in(0, Location::RequiresRegister());
618 // Only one input can be a constant operand. The case of two constant
619 // operands should be handled by constant propagation.
620 locs->set_in(1, Location::RegisterOrConstant(right()));
621 return locs;
622 }
623
624
625 void TestSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
626 // Never emitted outside of the BranchInstr.
627 UNREACHABLE();
628 }
629
630
631 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler,
632 BranchInstr* branch) {
633 Condition branch_condition = (kind() == Token::kNE) ? NE : EQ;
634 Register left = locs()->in(0).reg();
635 Location right = locs()->in(1);
636 if (right.IsConstant()) {
637 ASSERT(right.constant().IsSmi());
638 const int32_t imm =
639 reinterpret_cast<int32_t>(right.constant().raw());
640 ShifterOperand shifter_op;
641 if (ShifterOperand::CanHold(imm, &shifter_op)) {
642 __ tst(left, shifter_op);
643 } else {
644 // TODO(regis): Try to use bic.
645 __ LoadImmediate(IP, imm);
646 __ tst(left, ShifterOperand(IP));
647 }
648 } else {
649 __ tst(left, ShifterOperand(right.reg()));
650 }
651 branch->EmitBranchOnCondition(compiler, branch_condition);
652 }
653
654
612 LocationSummary* RelationalOpInstr::MakeLocationSummary() const { 655 LocationSummary* RelationalOpInstr::MakeLocationSummary() const {
613 const intptr_t kNumInputs = 2; 656 const intptr_t kNumInputs = 2;
614 const intptr_t kNumTemps = 0; 657 const intptr_t kNumTemps = 0;
615 if (operands_class_id() == kMintCid) { 658 if (operands_class_id() == kMintCid) {
616 const intptr_t kNumTemps = 2; 659 const intptr_t kNumTemps = 2;
617 LocationSummary* locs = 660 LocationSummary* locs =
618 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 661 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
619 locs->set_in(0, Location::RequiresFpuRegister()); 662 locs->set_in(0, Location::RequiresFpuRegister());
620 locs->set_in(1, Location::RequiresFpuRegister()); 663 locs->set_in(1, Location::RequiresFpuRegister());
621 locs->set_temp(0, Location::RequiresRegister()); 664 locs->set_temp(0, Location::RequiresRegister());
(...skipping 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1801 1844
1802 1845
1803 void CreateClosureInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1846 void CreateClosureInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1804 UNIMPLEMENTED(); 1847 UNIMPLEMENTED();
1805 } 1848 }
1806 1849
1807 } // namespace dart 1850 } // namespace dart
1808 1851
1809 #endif // defined TARGET_ARCH_ARM 1852 #endif // defined TARGET_ARCH_ARM
1810 1853
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/intermediate_language_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698