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 #include "src/compiler/code-generator-impl.h" | 6 #include "src/compiler/code-generator-impl.h" |
7 #include "src/compiler/gap-resolver.h" | 7 #include "src/compiler/gap-resolver.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/mips/macro-assembler-mips.h" | 9 #include "src/mips/macro-assembler-mips.h" |
10 #include "src/scopes.h" | 10 #include "src/scopes.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 } | 421 } |
422 | 422 |
423 __ lw(at, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); | 423 __ lw(at, FieldMemOperand(func, JSFunction::kCodeEntryOffset)); |
424 __ Call(at); | 424 __ Call(at); |
425 AddSafepointAndDeopt(instr); | 425 AddSafepointAndDeopt(instr); |
426 break; | 426 break; |
427 } | 427 } |
428 case kArchJmp: | 428 case kArchJmp: |
429 AssembleArchJump(i.InputRpo(0)); | 429 AssembleArchJump(i.InputRpo(0)); |
430 break; | 430 break; |
| 431 case kArchSwitch: |
| 432 AssembleArchSwitch(instr); |
| 433 break; |
431 case kArchNop: | 434 case kArchNop: |
432 // don't emit code for nops. | 435 // don't emit code for nops. |
433 break; | 436 break; |
434 case kArchRet: | 437 case kArchRet: |
435 AssembleReturn(); | 438 AssembleReturn(); |
436 break; | 439 break; |
437 case kArchStackPointer: | 440 case kArchStackPointer: |
438 __ mov(i.OutputRegister(), sp); | 441 __ mov(i.OutputRegister(), sp); |
439 break; | 442 break; |
440 case kArchTruncateDoubleToI: | 443 case kArchTruncateDoubleToI: |
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 UNIMPLEMENTED(); | 798 UNIMPLEMENTED(); |
796 } | 799 } |
797 } | 800 } |
798 | 801 |
799 | 802 |
800 void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) { | 803 void CodeGenerator::AssembleArchJump(BasicBlock::RpoNumber target) { |
801 if (!IsNextInAssemblyOrder(target)) __ Branch(GetLabel(target)); | 804 if (!IsNextInAssemblyOrder(target)) __ Branch(GetLabel(target)); |
802 } | 805 } |
803 | 806 |
804 | 807 |
| 808 void CodeGenerator::AssembleArchSwitch(Instruction* instr) { |
| 809 MipsOperandConverter i(this, instr); |
| 810 int const kNumLabels = static_cast<int>(instr->InputCount() - 1); |
| 811 v8::internal::Assembler::BlockTrampolinePoolScope block_trampoline_pool( |
| 812 masm()); |
| 813 Label here; |
| 814 |
| 815 __ bal(&here); |
| 816 __ nop(); // Branch delay slot nop. |
| 817 __ bind(&here); |
| 818 __ sll(at, i.InputRegister(0), 2); |
| 819 __ addu(at, at, ra); |
| 820 __ lw(at, MemOperand(at, 5 * v8::internal::Assembler::kInstrSize)); |
| 821 __ jr(at); |
| 822 __ nop(); // Branch delay slot nop. |
| 823 |
| 824 for (int index = 0; index < kNumLabels; ++index) { |
| 825 __ dd(GetLabel(i.InputRpo(index + 1))); |
| 826 } |
| 827 } |
| 828 |
| 829 |
805 // Assembles boolean materializations after an instruction. | 830 // Assembles boolean materializations after an instruction. |
806 void CodeGenerator::AssembleArchBoolean(Instruction* instr, | 831 void CodeGenerator::AssembleArchBoolean(Instruction* instr, |
807 FlagsCondition condition) { | 832 FlagsCondition condition) { |
808 MipsOperandConverter i(this, instr); | 833 MipsOperandConverter i(this, instr); |
809 Label done; | 834 Label done; |
810 | 835 |
811 // Materialize a full 32-bit 1 or 0 value. The result register is always the | 836 // Materialize a full 32-bit 1 or 0 value. The result register is always the |
812 // last output of the instruction. | 837 // last output of the instruction. |
813 Label false_value; | 838 Label false_value; |
814 DCHECK_NE(0u, instr->OutputCount()); | 839 DCHECK_NE(0u, instr->OutputCount()); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 __ lw(temp_0, src1); | 1144 __ lw(temp_0, src1); |
1120 __ sw(temp_0, dst1); | 1145 __ sw(temp_0, dst1); |
1121 __ sdc1(temp_1, src0); | 1146 __ sdc1(temp_1, src0); |
1122 } else { | 1147 } else { |
1123 // No other combinations are possible. | 1148 // No other combinations are possible. |
1124 UNREACHABLE(); | 1149 UNREACHABLE(); |
1125 } | 1150 } |
1126 } | 1151 } |
1127 | 1152 |
1128 | 1153 |
| 1154 void CodeGenerator::AssembleJumpTable(Label** targets, size_t target_count) { |
| 1155 // On 32-bit MIPS we emit the jump tables inline. |
| 1156 UNREACHABLE(); |
| 1157 } |
| 1158 |
| 1159 |
1129 void CodeGenerator::AddNopForSmiCodeInlining() { | 1160 void CodeGenerator::AddNopForSmiCodeInlining() { |
1130 // Unused on 32-bit ARM. Still exists on 64-bit arm. | 1161 // Unused on 32-bit ARM. Still exists on 64-bit arm. |
1131 // TODO(plind): Unclear when this is called now. Understand, fix if needed. | 1162 // TODO(plind): Unclear when this is called now. Understand, fix if needed. |
1132 __ nop(); // Maybe PROPERTY_ACCESS_INLINED? | 1163 __ nop(); // Maybe PROPERTY_ACCESS_INLINED? |
1133 } | 1164 } |
1134 | 1165 |
1135 | 1166 |
1136 void CodeGenerator::EnsureSpaceForLazyDeopt() { | 1167 void CodeGenerator::EnsureSpaceForLazyDeopt() { |
1137 int space_needed = Deoptimizer::patch_size(); | 1168 int space_needed = Deoptimizer::patch_size(); |
1138 if (!info()->IsStub()) { | 1169 if (!info()->IsStub()) { |
(...skipping 13 matching lines...) Expand all Loading... |
1152 } | 1183 } |
1153 } | 1184 } |
1154 MarkLazyDeoptSite(); | 1185 MarkLazyDeoptSite(); |
1155 } | 1186 } |
1156 | 1187 |
1157 #undef __ | 1188 #undef __ |
1158 | 1189 |
1159 } // namespace compiler | 1190 } // namespace compiler |
1160 } // namespace internal | 1191 } // namespace internal |
1161 } // namespace v8 | 1192 } // namespace v8 |
OLD | NEW |