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

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

Issue 707803002: [turbofan] move label generation to code generator (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 | Annotate | Revision Log
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/code-generator.h » ('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/arm64/macro-assembler-arm64.h" 7 #include "src/arm64/macro-assembler-arm64.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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 if (instr->InputAt(1)->IsRegister()) { \ 165 if (instr->InputAt(1)->IsRegister()) { \
166 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), \ 166 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), \
167 i.InputRegister##width(1)); \ 167 i.InputRegister##width(1)); \
168 } else { \ 168 } else { \
169 int64_t imm = i.InputOperand##width(1).immediate().value(); \ 169 int64_t imm = i.InputOperand##width(1).immediate().value(); \
170 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), imm); \ 170 __ asm_instr(i.OutputRegister##width(), i.InputRegister##width(0), imm); \
171 } \ 171 } \
172 } while (0) 172 } while (0)
173 173
174 174
175 #define ASSEMBLE_TEST_AND_BRANCH(asm_instr, width) \ 175 #define ASSEMBLE_TEST_AND_BRANCH(asm_instr, width) \
176 do { \ 176 do { \
177 bool fallthrough = IsNextInAssemblyOrder(i.InputRpo(3)); \ 177 bool fallthrough = IsNextInAssemblyOrder(i.InputRpo(3)); \
178 __ asm_instr(i.InputRegister##width(0), i.InputInt6(1), \ 178 __ asm_instr(i.InputRegister##width(0), i.InputInt6(1), \
179 code_->GetLabel(i.InputRpo(2))); \ 179 GetLabel(i.InputRpo(2))); \
180 if (!fallthrough) __ B(code_->GetLabel(i.InputRpo(3))); \ 180 if (!fallthrough) __ B(GetLabel(i.InputRpo(3))); \
181 } while (0) 181 } while (0)
182 182
183 183
184 // Assembles an instruction after register allocation, producing machine code. 184 // Assembles an instruction after register allocation, producing machine code.
185 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { 185 void CodeGenerator::AssembleArchInstruction(Instruction* instr) {
186 Arm64OperandConverter i(this, instr); 186 Arm64OperandConverter i(this, instr);
187 InstructionCode opcode = instr->opcode(); 187 InstructionCode opcode = instr->opcode();
188 switch (ArchOpcodeField::decode(opcode)) { 188 switch (ArchOpcodeField::decode(opcode)) {
189 case kArchCallCodeObject: { 189 case kArchCallCodeObject: {
190 EnsureSpaceForLazyDeopt(); 190 EnsureSpaceForLazyDeopt();
(...skipping 18 matching lines...) Expand all
209 __ Ldr(temp, FieldMemOperand(func, JSFunction::kContextOffset)); 209 __ Ldr(temp, FieldMemOperand(func, JSFunction::kContextOffset));
210 __ cmp(cp, temp); 210 __ cmp(cp, temp);
211 __ Assert(eq, kWrongFunctionContext); 211 __ Assert(eq, kWrongFunctionContext);
212 } 212 }
213 __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); 213 __ Ldr(x10, FieldMemOperand(func, JSFunction::kCodeEntryOffset));
214 __ Call(x10); 214 __ Call(x10);
215 AddSafepointAndDeopt(instr); 215 AddSafepointAndDeopt(instr);
216 break; 216 break;
217 } 217 }
218 case kArchJmp: 218 case kArchJmp:
219 __ B(code_->GetLabel(i.InputRpo(0))); 219 __ B(GetLabel(i.InputRpo(0)));
220 break; 220 break;
221 case kArchNop: 221 case kArchNop:
222 // don't emit code for nops. 222 // don't emit code for nops.
223 break; 223 break;
224 case kArchRet: 224 case kArchRet:
225 AssembleReturn(); 225 AssembleReturn();
226 break; 226 break;
227 case kArchStackPointer: 227 case kArchStackPointer:
228 __ mov(i.OutputRegister(), masm()->StackPointer()); 228 __ mov(i.OutputRegister(), masm()->StackPointer());
229 break; 229 break;
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 Arm64OperandConverter i(this, instr); 607 Arm64OperandConverter i(this, instr);
608 Label done; 608 Label done;
609 609
610 // Emit a branch. The true and false targets are always the last two inputs 610 // Emit a branch. The true and false targets are always the last two inputs
611 // to the instruction. 611 // to the instruction.
612 BasicBlock::RpoNumber tblock = 612 BasicBlock::RpoNumber tblock =
613 i.InputRpo(static_cast<int>(instr->InputCount()) - 2); 613 i.InputRpo(static_cast<int>(instr->InputCount()) - 2);
614 BasicBlock::RpoNumber fblock = 614 BasicBlock::RpoNumber fblock =
615 i.InputRpo(static_cast<int>(instr->InputCount()) - 1); 615 i.InputRpo(static_cast<int>(instr->InputCount()) - 1);
616 bool fallthru = IsNextInAssemblyOrder(fblock); 616 bool fallthru = IsNextInAssemblyOrder(fblock);
617 Label* tlabel = code()->GetLabel(tblock); 617 Label* tlabel = GetLabel(tblock);
618 Label* flabel = fallthru ? &done : code()->GetLabel(fblock); 618 Label* flabel = fallthru ? &done : GetLabel(fblock);
619 switch (condition) { 619 switch (condition) {
620 case kUnorderedEqual: 620 case kUnorderedEqual:
621 __ B(vs, flabel); 621 __ B(vs, flabel);
622 // Fall through. 622 // Fall through.
623 case kEqual: 623 case kEqual:
624 __ B(eq, tlabel); 624 __ B(eq, tlabel);
625 break; 625 break;
626 case kUnorderedNotEqual: 626 case kUnorderedNotEqual:
627 __ B(vs, tlabel); 627 __ B(vs, tlabel);
628 // Fall through. 628 // Fall through.
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 } 1020 }
1021 } 1021 }
1022 MarkLazyDeoptSite(); 1022 MarkLazyDeoptSite();
1023 } 1023 }
1024 1024
1025 #undef __ 1025 #undef __
1026 1026
1027 } // namespace compiler 1027 } // namespace compiler
1028 } // namespace internal 1028 } // namespace internal
1029 } // namespace v8 1029 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm/code-generator-arm.cc ('k') | src/compiler/code-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698