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/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 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 __ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); | 329 __ ldr(ip, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
330 __ Call(ip); | 330 __ Call(ip); |
331 AddSafepointAndDeopt(instr); | 331 AddSafepointAndDeopt(instr); |
332 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 332 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
333 break; | 333 break; |
334 } | 334 } |
335 case kArchJmp: | 335 case kArchJmp: |
336 AssembleArchJump(i.InputRpo(0)); | 336 AssembleArchJump(i.InputRpo(0)); |
337 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 337 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
338 break; | 338 break; |
| 339 case kArchSwitch: |
| 340 AssembleArchSwitch(instr); |
| 341 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
| 342 break; |
339 case kArchNop: | 343 case kArchNop: |
340 // don't emit code for nops. | 344 // don't emit code for nops. |
341 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 345 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
342 break; | 346 break; |
343 case kArchRet: | 347 case kArchRet: |
344 AssembleReturn(); | 348 AssembleReturn(); |
345 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 349 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
346 break; | 350 break; |
347 case kArchStackPointer: | 351 case kArchStackPointer: |
348 __ mov(i.OutputRegister(), sp); | 352 __ mov(i.OutputRegister(), sp); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 __ b(cc, tlabel); | 734 __ b(cc, tlabel); |
731 if (!branch->fallthru) __ b(flabel); // no fallthru to flabel. | 735 if (!branch->fallthru) __ b(flabel); // no fallthru to flabel. |
732 } | 736 } |
733 | 737 |
734 | 738 |
735 void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) { | 739 void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) { |
736 if (!IsNextInAssemblyOrder(target)) __ b(GetLabel(target)); | 740 if (!IsNextInAssemblyOrder(target)) __ b(GetLabel(target)); |
737 } | 741 } |
738 | 742 |
739 | 743 |
| 744 void CodeGenerator::AssembleArchSwitch(Instruction* instr) { |
| 745 ArmOperandConverter i(this, instr); |
| 746 int const kNumLabels = static_cast<int>(instr->InputCount() - 1); |
| 747 __ BlockConstPoolFor(kNumLabels + 2); |
| 748 __ ldr(pc, MemOperand(pc, i.InputRegister(0), LSL, 2)); |
| 749 __ nop(); |
| 750 for (int index = 0; index < kNumLabels; ++index) { |
| 751 __ dd(GetLabel(i.InputRpo(index + 1))); |
| 752 } |
| 753 } |
| 754 |
| 755 |
740 // Assembles boolean materializations after an instruction. | 756 // Assembles boolean materializations after an instruction. |
741 void CodeGenerator::AssembleArchBoolean(Instruction* instr, | 757 void CodeGenerator::AssembleArchBoolean(Instruction* instr, |
742 FlagsCondition condition) { | 758 FlagsCondition condition) { |
743 ArmOperandConverter i(this, instr); | 759 ArmOperandConverter i(this, instr); |
744 | 760 |
745 // Materialize a full 32-bit 1 or 0 value. The result register is always the | 761 // Materialize a full 32-bit 1 or 0 value. The result register is always the |
746 // last output of the instruction. | 762 // last output of the instruction. |
747 DCHECK_NE(0u, instr->OutputCount()); | 763 DCHECK_NE(0u, instr->OutputCount()); |
748 Register reg = i.OutputRegister(instr->OutputCount() - 1); | 764 Register reg = i.OutputRegister(instr->OutputCount() - 1); |
749 Condition cc = FlagsConditionToCondition(condition); | 765 Condition cc = FlagsConditionToCondition(condition); |
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 __ ldr(temp_0, src1); | 1018 __ ldr(temp_0, src1); |
1003 __ str(temp_0, dst1); | 1019 __ str(temp_0, dst1); |
1004 __ vstr(temp_1, src0); | 1020 __ vstr(temp_1, src0); |
1005 } else { | 1021 } else { |
1006 // No other combinations are possible. | 1022 // No other combinations are possible. |
1007 UNREACHABLE(); | 1023 UNREACHABLE(); |
1008 } | 1024 } |
1009 } | 1025 } |
1010 | 1026 |
1011 | 1027 |
| 1028 void CodeGenerator::AssembleJumpTable(Label** targets, size_t target_count) { |
| 1029 // On 32-bit ARM we emit the jump tables inline. |
| 1030 UNREACHABLE(); |
| 1031 } |
| 1032 |
| 1033 |
1012 void CodeGenerator::AddNopForSmiCodeInlining() { | 1034 void CodeGenerator::AddNopForSmiCodeInlining() { |
1013 // On 32-bit ARM we do not insert nops for inlined Smi code. | 1035 // On 32-bit ARM we do not insert nops for inlined Smi code. |
1014 } | 1036 } |
1015 | 1037 |
1016 | 1038 |
1017 void CodeGenerator::EnsureSpaceForLazyDeopt() { | 1039 void CodeGenerator::EnsureSpaceForLazyDeopt() { |
1018 int space_needed = Deoptimizer::patch_size(); | 1040 int space_needed = Deoptimizer::patch_size(); |
1019 if (!info()->IsStub()) { | 1041 if (!info()->IsStub()) { |
1020 // Ensure that we have enough space after the previous lazy-bailout | 1042 // Ensure that we have enough space after the previous lazy-bailout |
1021 // instruction for patching the code here. | 1043 // instruction for patching the code here. |
(...skipping 10 matching lines...) Expand all Loading... |
1032 } | 1054 } |
1033 } | 1055 } |
1034 MarkLazyDeoptSite(); | 1056 MarkLazyDeoptSite(); |
1035 } | 1057 } |
1036 | 1058 |
1037 #undef __ | 1059 #undef __ |
1038 | 1060 |
1039 } // namespace compiler | 1061 } // namespace compiler |
1040 } // namespace internal | 1062 } // namespace internal |
1041 } // namespace v8 | 1063 } // namespace v8 |
OLD | NEW |