| OLD | NEW |
| 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 Loading... |
| 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_BRANCH_TO(target) \ |
| 176 do { \ | 176 do { \ |
| 177 bool fallthrough = IsNextInAssemblyOrder(i.InputRpo(3)); \ | 177 bool fallthrough = IsNextInAssemblyOrder(target); \ |
| 178 __ asm_instr(i.InputRegister##width(0), i.InputInt6(1), \ | 178 if (!fallthrough) __ B(GetLabel(target)); \ |
| 179 GetLabel(i.InputRpo(2))); \ | |
| 180 if (!fallthrough) __ B(GetLabel(i.InputRpo(3))); \ | |
| 181 } while (0) | 179 } while (0) |
| 182 | 180 |
| 183 | 181 |
| 184 // Assembles an instruction after register allocation, producing machine code. | 182 // Assembles an instruction after register allocation, producing machine code. |
| 185 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { | 183 void CodeGenerator::AssembleArchInstruction(Instruction* instr) { |
| 186 Arm64OperandConverter i(this, instr); | 184 Arm64OperandConverter i(this, instr); |
| 187 InstructionCode opcode = instr->opcode(); | 185 InstructionCode opcode = instr->opcode(); |
| 188 switch (ArchOpcodeField::decode(opcode)) { | 186 switch (ArchOpcodeField::decode(opcode)) { |
| 189 case kArchCallCodeObject: { | 187 case kArchCallCodeObject: { |
| 190 EnsureSpaceForLazyDeopt(); | 188 EnsureSpaceForLazyDeopt(); |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 423 break; | 421 break; |
| 424 case kArm64Ubfx: | 422 case kArm64Ubfx: |
| 425 __ Ubfx(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1), | 423 __ Ubfx(i.OutputRegister(), i.InputRegister(0), i.InputInt8(1), |
| 426 i.InputInt8(2)); | 424 i.InputInt8(2)); |
| 427 break; | 425 break; |
| 428 case kArm64Ubfx32: | 426 case kArm64Ubfx32: |
| 429 __ Ubfx(i.OutputRegister32(), i.InputRegister32(0), i.InputInt8(1), | 427 __ Ubfx(i.OutputRegister32(), i.InputRegister32(0), i.InputInt8(1), |
| 430 i.InputInt8(2)); | 428 i.InputInt8(2)); |
| 431 break; | 429 break; |
| 432 case kArm64Tbz: | 430 case kArm64Tbz: |
| 433 ASSEMBLE_TEST_AND_BRANCH(Tbz, 64); | 431 __ Tbz(i.InputRegister64(0), i.InputInt6(1), GetLabel(i.InputRpo(2))); |
| 432 ASSEMBLE_BRANCH_TO(i.InputRpo(3)); |
| 434 break; | 433 break; |
| 435 case kArm64Tbz32: | 434 case kArm64Tbz32: |
| 436 ASSEMBLE_TEST_AND_BRANCH(Tbz, 32); | 435 __ Tbz(i.InputRegister32(0), i.InputInt5(1), GetLabel(i.InputRpo(2))); |
| 436 ASSEMBLE_BRANCH_TO(i.InputRpo(3)); |
| 437 break; | 437 break; |
| 438 case kArm64Tbnz: | 438 case kArm64Tbnz: |
| 439 ASSEMBLE_TEST_AND_BRANCH(Tbnz, 64); | 439 __ Tbnz(i.InputRegister64(0), i.InputInt6(1), GetLabel(i.InputRpo(2))); |
| 440 ASSEMBLE_BRANCH_TO(i.InputRpo(3)); |
| 440 break; | 441 break; |
| 441 case kArm64Tbnz32: | 442 case kArm64Tbnz32: |
| 442 ASSEMBLE_TEST_AND_BRANCH(Tbnz, 32); | 443 __ Tbnz(i.InputRegister32(0), i.InputInt5(1), GetLabel(i.InputRpo(2))); |
| 444 ASSEMBLE_BRANCH_TO(i.InputRpo(3)); |
| 445 break; |
| 446 case kArm64Cbz32: |
| 447 __ Cbz(i.InputRegister32(0), GetLabel(i.InputRpo(1))); |
| 448 ASSEMBLE_BRANCH_TO(i.InputRpo(2)); |
| 449 break; |
| 450 case kArm64Cbnz32: |
| 451 __ Cbnz(i.InputRegister32(0), GetLabel(i.InputRpo(1))); |
| 452 ASSEMBLE_BRANCH_TO(i.InputRpo(2)); |
| 443 break; | 453 break; |
| 444 case kArm64Claim: { | 454 case kArm64Claim: { |
| 445 int words = MiscField::decode(instr->opcode()); | 455 int words = MiscField::decode(instr->opcode()); |
| 446 __ Claim(words); | 456 __ Claim(words); |
| 447 break; | 457 break; |
| 448 } | 458 } |
| 449 case kArm64Poke: { | 459 case kArm64Poke: { |
| 450 int slot = MiscField::decode(instr->opcode()); | 460 int slot = MiscField::decode(instr->opcode()); |
| 451 Operand operand(slot * kPointerSize); | 461 Operand operand(slot * kPointerSize); |
| 452 __ Poke(i.InputRegister(0), operand); | 462 __ Poke(i.InputRegister(0), operand); |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 } | 1030 } |
| 1021 } | 1031 } |
| 1022 MarkLazyDeoptSite(); | 1032 MarkLazyDeoptSite(); |
| 1023 } | 1033 } |
| 1024 | 1034 |
| 1025 #undef __ | 1035 #undef __ |
| 1026 | 1036 |
| 1027 } // namespace compiler | 1037 } // namespace compiler |
| 1028 } // namespace internal | 1038 } // namespace internal |
| 1029 } // namespace v8 | 1039 } // namespace v8 |
| OLD | NEW |