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

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

Issue 59613005: Merge (x & y) == 0 pattern to emit a single test instruction. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 return; 593 return;
594 } 594 }
595 if (operation_cid() == kDoubleCid) { 595 if (operation_cid() == kDoubleCid) {
596 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch); 596 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
597 return; 597 return;
598 } 598 }
599 UNREACHABLE(); 599 UNREACHABLE();
600 } 600 }
601 601
602 602
603 LocationSummary* TestSmiInstr::MakeLocationSummary() const {
604 const intptr_t kNumInputs = 2;
605 const intptr_t kNumTemps = 0;
606 LocationSummary* locs =
607 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
608 locs->set_in(0, Location::RequiresRegister());
609 // Only one input can be a constant operand. The case of two constant
610 // operands should be handled by constant propagation.
611 locs->set_in(1, Location::RegisterOrConstant(right()));
612 return locs;
613 }
614
615
616 void TestSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
617 // Never emitted outside of the BranchInstr.
618 UNREACHABLE();
619 }
620
621
622 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler,
623 BranchInstr* branch) {
624 Condition branch_condition = (kind() == Token::kNE) ? NE : EQ;
625 Register left = locs()->in(0).reg();
626 Location right = locs()->in(1);
627 if (right.IsConstant()) {
628 ASSERT(right.constant().IsSmi());
629 const int32_t imm =
630 reinterpret_cast<int32_t>(right.constant().raw());
631 __ TestImmediate(left, imm);
632 } else {
633 __ tst(left, ShifterOperand(right.reg()));
634 }
635 branch->EmitBranchOnCondition(compiler, branch_condition);
636 }
637
638
603 LocationSummary* RelationalOpInstr::MakeLocationSummary() const { 639 LocationSummary* RelationalOpInstr::MakeLocationSummary() const {
604 const intptr_t kNumInputs = 2; 640 const intptr_t kNumInputs = 2;
605 const intptr_t kNumTemps = 0; 641 const intptr_t kNumTemps = 0;
606 if (operation_cid() == kMintCid) { 642 if (operation_cid() == kMintCid) {
607 const intptr_t kNumTemps = 2; 643 const intptr_t kNumTemps = 2;
608 LocationSummary* locs = 644 LocationSummary* locs =
609 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 645 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
610 locs->set_in(0, Location::RequiresFpuRegister()); 646 locs->set_in(0, Location::RequiresFpuRegister());
611 locs->set_in(1, Location::RequiresFpuRegister()); 647 locs->set_in(1, Location::RequiresFpuRegister());
612 locs->set_temp(0, Location::RequiresRegister()); 648 locs->set_temp(0, Location::RequiresRegister());
(...skipping 3929 matching lines...) Expand 10 before | Expand all | Expand 10 after
4542 compiler->GenerateCall(token_pos(), 4578 compiler->GenerateCall(token_pos(),
4543 &label, 4579 &label,
4544 PcDescriptors::kOther, 4580 PcDescriptors::kOther,
4545 locs()); 4581 locs());
4546 __ Drop(2); // Discard type arguments and receiver. 4582 __ Drop(2); // Discard type arguments and receiver.
4547 } 4583 }
4548 4584
4549 } // namespace dart 4585 } // namespace dart
4550 4586
4551 #endif // defined TARGET_ARCH_ARM 4587 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698