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

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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 return; 487 return;
488 } 488 }
489 if (operation_cid() == kDoubleCid) { 489 if (operation_cid() == kDoubleCid) {
490 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch); 490 EmitDoubleComparisonOp(compiler, *locs(), kind(), branch);
491 return; 491 return;
492 } 492 }
493 UNREACHABLE(); 493 UNREACHABLE();
494 } 494 }
495 495
496 496
497 LocationSummary* TestSmiInstr::MakeLocationSummary() const {
498 const intptr_t kNumInputs = 2;
499 const intptr_t kNumTemps = 0;
500 LocationSummary* locs =
501 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
502 locs->set_in(0, Location::RequiresRegister());
503 // Only one input can be a constant operand. The case of two constant
504 // operands should be handled by constant propagation.
505 locs->set_in(1, Location::RegisterOrConstant(right()));
506 return locs;
507 }
508
509
510 void TestSmiInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
511 // Never emitted outside of the BranchInstr.
512 UNREACHABLE();
513 }
514
515
516 void TestSmiInstr::EmitBranchCode(FlowGraphCompiler* compiler,
517 BranchInstr* branch) {
518 Condition branch_condition = (kind() == Token::kNE) ? NE : EQ;
519 Register left = locs()->in(0).reg();
520 Location right = locs()->in(1);
521 if (right.IsConstant()) {
522 ASSERT(right.constant().IsSmi());
523 const int32_t imm =
524 reinterpret_cast<int32_t>(right.constant().raw());
525 ShifterOperand shifter_op;
526 if (ShifterOperand::CanHold(imm, &shifter_op)) {
zra 2013/11/05 18:38:03 Maybe add TstImmediate macro to assembler.
Florian Schneider 2013/11/06 12:13:42 Done.
527 __ tst(left, shifter_op);
528 } else {
529 __ LoadImmediate(IP, imm);
530 __ tst(left, ShifterOperand(IP));
531 }
532 } else {
533 __ tst(left, ShifterOperand(right.reg()));
534 }
535 branch->EmitBranchOnCondition(compiler, branch_condition);
536 }
537
538
497 LocationSummary* RelationalOpInstr::MakeLocationSummary() const { 539 LocationSummary* RelationalOpInstr::MakeLocationSummary() const {
498 const intptr_t kNumInputs = 2; 540 const intptr_t kNumInputs = 2;
499 const intptr_t kNumTemps = 0; 541 const intptr_t kNumTemps = 0;
500 if (operation_cid() == kMintCid) { 542 if (operation_cid() == kMintCid) {
501 const intptr_t kNumTemps = 2; 543 const intptr_t kNumTemps = 2;
502 LocationSummary* locs = 544 LocationSummary* locs =
503 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall); 545 new LocationSummary(kNumInputs, kNumTemps, LocationSummary::kNoCall);
504 locs->set_in(0, Location::RequiresFpuRegister()); 546 locs->set_in(0, Location::RequiresFpuRegister());
505 locs->set_in(1, Location::RequiresFpuRegister()); 547 locs->set_in(1, Location::RequiresFpuRegister());
506 locs->set_temp(0, Location::RequiresRegister()); 548 locs->set_temp(0, Location::RequiresRegister());
(...skipping 3929 matching lines...) Expand 10 before | Expand all | Expand 10 after
4436 compiler->GenerateCall(token_pos(), 4478 compiler->GenerateCall(token_pos(),
4437 &label, 4479 &label,
4438 PcDescriptors::kOther, 4480 PcDescriptors::kOther,
4439 locs()); 4481 locs());
4440 __ Drop(2); // Discard type arguments and receiver. 4482 __ Drop(2); // Discard type arguments and receiver.
4441 } 4483 }
4442 4484
4443 } // namespace dart 4485 } // namespace dart
4444 4486
4445 #endif // defined TARGET_ARCH_ARM 4487 #endif // defined TARGET_ARCH_ARM
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698