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

Side by Side Diff: runtime/vm/intermediate_language_mips.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_ia32.cc ('k') | runtime/vm/intermediate_language_x64.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_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 "lib/error.h" 10 #include "lib/error.h"
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 *ic_data()); 613 *ic_data());
614 if (branch->is_checked()) { 614 if (branch->is_checked()) {
615 EmitAssertBoolean(V0, token_pos(), deopt_id(), locs(), compiler); 615 EmitAssertBoolean(V0, token_pos(), deopt_id(), locs(), compiler);
616 } 616 }
617 Condition branch_condition = (kind() == Token::kNE) ? NE : EQ; 617 Condition branch_condition = (kind() == Token::kNE) ? NE : EQ;
618 __ CompareObject(CMPRES, V0, Bool::True()); 618 __ CompareObject(CMPRES, V0, Bool::True());
619 branch->EmitBranchOnCondition(compiler, branch_condition); 619 branch->EmitBranchOnCondition(compiler, branch_condition);
620 } 620 }
621 621
622 622
623 LocationSummary* TestSmiInstr::MakeLocationSummary() const {
624 const intptr_t kNumInputs = 2;
625 const intptr_t kNumTemps = 0;
626 LocationSummary* locs =
627 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
628 locs->set_in(0, Location::RequiresRegister());
629 // Only one input can be a constant operand. The case of two constant
630 // operands should be handled by constant propagation.
631 locs->set_in(1, Location::RegisterOrConstant(right()));
632 return locs;
633 }
634
635
636 void TestSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
637 // Never emitted outside of the BranchInstr.
638 UNREACHABLE();
639 }
640
641
642 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler,
643 BranchInstr* branch) {
644 Condition branch_condition = (kind() == Token::kNE) ? NE : EQ;
645 Register left = locs()->in(0).reg();
646 Location right = locs()->in(1);
647 if (right.IsConstant()) {
648 ASSERT(right.constant().IsSmi());
649 const int32_t imm =
650 reinterpret_cast<int32_t>(right.constant().raw());
651 if (Utils::IsUint(kImmBits, imm)) {
652 __ andi(TMP1, left, Immediate(imm));
653 } else {
654 __ LoadImmediate(TMP1, imm);
655 __ and_(TMP1, left, TMP1);
656 }
657 } else {
658 __ and_(TMP1, left, right.reg());
659 }
660 branch->EmitBranchOnCondition(compiler, branch_condition);
661 }
662
663
623 LocationSummary* RelationalOpInstr::MakeLocationSummary() const { 664 LocationSummary* RelationalOpInstr::MakeLocationSummary() const {
624 const intptr_t kNumInputs = 2; 665 const intptr_t kNumInputs = 2;
625 const intptr_t kNumTemps = 0; 666 const intptr_t kNumTemps = 0;
626 if (operands_class_id() == kMintCid) { 667 if (operands_class_id() == kMintCid) {
627 const intptr_t kNumTemps = 2; 668 const intptr_t kNumTemps = 2;
628 LocationSummary* locs = 669 LocationSummary* locs =
629 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 670 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
630 locs->set_in(0, Location::RequiresFpuRegister()); 671 locs->set_in(0, Location::RequiresFpuRegister());
631 locs->set_in(1, Location::RequiresFpuRegister()); 672 locs->set_in(1, Location::RequiresFpuRegister());
632 locs->set_temp(0, Location::RequiresRegister()); 673 locs->set_temp(0, Location::RequiresRegister());
(...skipping 1202 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 1876
1836 1877
1837 void CreateClosureInstr::EmitNativeCode(FlowGraphCompiler* compiler) { 1878 void CreateClosureInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
1838 UNIMPLEMENTED(); 1879 UNIMPLEMENTED();
1839 } 1880 }
1840 1881
1841 } // namespace dart 1882 } // namespace dart
1842 1883
1843 #endif // defined TARGET_ARCH_MIPS 1884 #endif // defined TARGET_ARCH_MIPS
1844 1885
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language_ia32.cc ('k') | runtime/vm/intermediate_language_x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698