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

Side by Side Diff: src/compiler/arm/code-generator-arm.cc

Issue 745633002: [turbofan] Clean up and factor out branch generation logic. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix IA32 fall through. Created 6 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
« no previous file with comments | « no previous file | src/compiler/arm/instruction-selector-arm.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/code-generator.h" 5 #include "src/compiler/code-generator.h"
6 6
7 #include "src/arm/macro-assembler-arm.h" 7 #include "src/arm/macro-assembler-arm.h"
8 #include "src/compiler/code-generator-impl.h" 8 #include "src/compiler/code-generator-impl.h"
9 #include "src/compiler/gap-resolver.h" 9 #include "src/compiler/gap-resolver.h"
10 #include "src/compiler/node-matchers.h" 10 #include "src/compiler/node-matchers.h"
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 __ cmp(cp, kScratchReg); 186 __ cmp(cp, kScratchReg);
187 __ Assert(eq, kWrongFunctionContext); 187 __ Assert(eq, kWrongFunctionContext);
188 } 188 }
189 __ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); 189 __ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
190 __ Call(ip); 190 __ Call(ip);
191 AddSafepointAndDeopt(instr); 191 AddSafepointAndDeopt(instr);
192 DCHECK_EQ(LeaveCC, i.OutputSBit()); 192 DCHECK_EQ(LeaveCC, i.OutputSBit());
193 break; 193 break;
194 } 194 }
195 case kArchJmp: 195 case kArchJmp:
196 __ b(GetLabel(i.InputRpo(0))); 196 AssembleArchJump(i.InputRpo(0));
197 DCHECK_EQ(LeaveCC, i.OutputSBit()); 197 DCHECK_EQ(LeaveCC, i.OutputSBit());
198 break; 198 break;
199 case kArchNop: 199 case kArchNop:
200 // don't emit code for nops. 200 // don't emit code for nops.
201 DCHECK_EQ(LeaveCC, i.OutputSBit()); 201 DCHECK_EQ(LeaveCC, i.OutputSBit());
202 break; 202 break;
203 case kArchRet: 203 case kArchRet:
204 AssembleReturn(); 204 AssembleReturn();
205 DCHECK_EQ(LeaveCC, i.OutputSBit()); 205 DCHECK_EQ(LeaveCC, i.OutputSBit());
206 break; 206 break;
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 LinkRegisterStatus lr_status = kLRHasNotBeenSaved; 532 LinkRegisterStatus lr_status = kLRHasNotBeenSaved;
533 __ RecordWrite(object, index, value, lr_status, mode); 533 __ RecordWrite(object, index, value, lr_status, mode);
534 DCHECK_EQ(LeaveCC, i.OutputSBit()); 534 DCHECK_EQ(LeaveCC, i.OutputSBit());
535 break; 535 break;
536 } 536 }
537 } 537 }
538 } 538 }
539 539
540 540
541 // Assembles branches after an instruction. 541 // Assembles branches after an instruction.
542 void CodeGenerator::AssembleArchBranch(Instruction* instr, 542 void CodeGenerator::AssembleArchBranch(Instruction* instr, BranchInfo* branch) {
543 FlagsCondition condition) {
544 ArmOperandConverter i(this, instr); 543 ArmOperandConverter i(this, instr);
545 Label done; 544 Label* tlabel = branch->true_label;
546 545 Label* flabel = branch->false_label;
547 // Emit a branch. The true and false targets are always the last two inputs 546 switch (branch->condition) {
548 // to the instruction.
549 BasicBlock::RpoNumber tblock =
550 i.InputRpo(static_cast<int>(instr->InputCount()) - 2);
551 BasicBlock::RpoNumber fblock =
552 i.InputRpo(static_cast<int>(instr->InputCount()) - 1);
553 bool fallthru = IsNextInAssemblyOrder(fblock);
554 Label* tlabel = GetLabel(tblock);
555 Label* flabel = fallthru ? &done : GetLabel(fblock);
556 switch (condition) {
557 case kUnorderedEqual: 547 case kUnorderedEqual:
558 __ b(vs, flabel); 548 __ b(vs, flabel);
559 // Fall through. 549 // Fall through.
560 case kEqual: 550 case kEqual:
561 __ b(eq, tlabel); 551 __ b(eq, tlabel);
562 break; 552 break;
563 case kUnorderedNotEqual: 553 case kUnorderedNotEqual:
564 __ b(vs, tlabel); 554 __ b(vs, tlabel);
565 // Fall through. 555 // Fall through.
566 case kNotEqual: 556 case kNotEqual:
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 case kUnsignedGreaterThan: 592 case kUnsignedGreaterThan:
603 __ b(hi, tlabel); 593 __ b(hi, tlabel);
604 break; 594 break;
605 case kOverflow: 595 case kOverflow:
606 __ b(vs, tlabel); 596 __ b(vs, tlabel);
607 break; 597 break;
608 case kNotOverflow: 598 case kNotOverflow:
609 __ b(vc, tlabel); 599 __ b(vc, tlabel);
610 break; 600 break;
611 } 601 }
612 if (!fallthru) __ b(flabel); // no fallthru to flabel. 602 if (!branch->fallthru) __ b(flabel); // no fallthru to flabel.
613 __ bind(&done);
614 } 603 }
615 604
616 605
606 void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) {
607 if (!IsNextInAssemblyOrder(target)) __ b(GetLabel(target));
608 }
609
610
617 // Assembles boolean materializations after an instruction. 611 // Assembles boolean materializations after an instruction.
618 void CodeGenerator::AssembleArchBoolean(Instruction* instr, 612 void CodeGenerator::AssembleArchBoolean(Instruction* instr,
619 FlagsCondition condition) { 613 FlagsCondition condition) {
620 ArmOperandConverter i(this, instr); 614 ArmOperandConverter i(this, instr);
621 Label done; 615 Label done;
622 616
623 // Materialize a full 32-bit 1 or 0 value. The result register is always the 617 // Materialize a full 32-bit 1 or 0 value. The result register is always the
624 // last output of the instruction. 618 // last output of the instruction.
625 Label check; 619 Label check;
626 DCHECK_NE(0, instr->OutputCount()); 620 DCHECK_NE(0, instr->OutputCount());
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 } 958 }
965 } 959 }
966 MarkLazyDeoptSite(); 960 MarkLazyDeoptSite();
967 } 961 }
968 962
969 #undef __ 963 #undef __
970 964
971 } // namespace compiler 965 } // namespace compiler
972 } // namespace internal 966 } // namespace internal
973 } // namespace v8 967 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/arm/instruction-selector-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698