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 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1037 __ bind(&false_value); | 1037 __ bind(&false_value); |
1038 __ li(result, Operand(static_cast<int64_t>(0))); | 1038 __ li(result, Operand(static_cast<int64_t>(0))); |
1039 __ bind(&done); | 1039 __ bind(&done); |
1040 } | 1040 } |
1041 | 1041 |
1042 | 1042 |
1043 void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) { | 1043 void CodeGenerator::AssembleArchLookupSwitch(Instruction* instr) { |
1044 MipsOperandConverter i(this, instr); | 1044 MipsOperandConverter i(this, instr); |
1045 Register input = i.InputRegister(0); | 1045 Register input = i.InputRegister(0); |
1046 for (size_t index = 2; index < instr->InputCount(); index += 2) { | 1046 for (size_t index = 2; index < instr->InputCount(); index += 2) { |
1047 __ Branch(GetLabel(i.InputRpo(index + 1)), eq, input, | 1047 __ li(at, Operand(i.InputInt32(index + 0))); |
1048 Operand(i.InputInt32(index + 0))); | 1048 __ beq(input, at, GetLabel(i.InputRpo(index + 1))); |
1049 } | 1049 } |
| 1050 __ nop(); // Branch delay slot of the last beq. |
1050 AssembleArchJump(i.InputRpo(1)); | 1051 AssembleArchJump(i.InputRpo(1)); |
1051 } | 1052 } |
1052 | 1053 |
1053 | 1054 |
1054 void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) { | 1055 void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) { |
1055 MipsOperandConverter i(this, instr); | 1056 MipsOperandConverter i(this, instr); |
1056 Register input = i.InputRegister(0); | 1057 Register input = i.InputRegister(0); |
1057 size_t const case_count = instr->InputCount() - 2; | 1058 size_t const case_count = instr->InputCount() - 2; |
1058 Label here; | 1059 Label here; |
1059 | 1060 |
1060 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); | 1061 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); |
1061 // Ensure that dd-ed labels goes to 8 byte aligned addresses. | 1062 __ BlockTrampolinePoolFor(case_count * 2 + 7); |
1062 if ((masm()->pc_offset() & 7) == 0) { | 1063 // Ensure that dd-ed labels use 8 byte aligned addresses. |
| 1064 if ((masm()->pc_offset() & 7) != 0) { |
1063 __ nop(); | 1065 __ nop(); |
1064 } | 1066 } |
1065 __ bal(&here); | 1067 __ bal(&here); |
1066 __ nop(); // Branch delay slot nop. | 1068 __ dsll(at, input, 3); // Branch delay slot. |
1067 __ bind(&here); | 1069 __ bind(&here); |
1068 __ dsll(at, input, 3); | |
1069 __ daddu(at, at, ra); | 1070 __ daddu(at, at, ra); |
1070 __ ld(at, MemOperand(at, 5 * v8::internal::Assembler::kInstrSize)); | 1071 __ ld(at, MemOperand(at, 4 * v8::internal::Assembler::kInstrSize)); |
1071 __ jr(at); | 1072 __ jr(at); |
1072 __ nop(); // Branch delay slot nop. | 1073 __ nop(); // Branch delay slot nop. |
1073 for (size_t index = 0; index < case_count; ++index) { | 1074 for (size_t index = 0; index < case_count; ++index) { |
1074 __ dd(GetLabel(i.InputRpo(index + 2))); | 1075 __ dd(GetLabel(i.InputRpo(index + 2))); |
1075 } | 1076 } |
1076 } | 1077 } |
1077 | 1078 |
1078 | 1079 |
1079 void CodeGenerator::AssembleDeoptimizerCall(int deoptimization_id) { | 1080 void CodeGenerator::AssembleDeoptimizerCall(int deoptimization_id) { |
1080 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 1081 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1357 } | 1358 } |
1358 } | 1359 } |
1359 MarkLazyDeoptSite(); | 1360 MarkLazyDeoptSite(); |
1360 } | 1361 } |
1361 | 1362 |
1362 #undef __ | 1363 #undef __ |
1363 | 1364 |
1364 } // namespace compiler | 1365 } // namespace compiler |
1365 } // namespace internal | 1366 } // namespace internal |
1366 } // namespace v8 | 1367 } // namespace v8 |
OLD | NEW |