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/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 #include "src/compiler/code-generator.h" | 6 #include "src/compiler/code-generator.h" |
7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
10 #include "src/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
(...skipping 1773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 MipsOperandConverter i(this, instr); | 1784 MipsOperandConverter i(this, instr); |
1785 Register input = i.InputRegister(0); | 1785 Register input = i.InputRegister(0); |
1786 for (size_t index = 2; index < instr->InputCount(); index += 2) { | 1786 for (size_t index = 2; index < instr->InputCount(); index += 2) { |
1787 __ li(at, Operand(i.InputInt32(index + 0))); | 1787 __ li(at, Operand(i.InputInt32(index + 0))); |
1788 __ beq(input, at, GetLabel(i.InputRpo(index + 1))); | 1788 __ beq(input, at, GetLabel(i.InputRpo(index + 1))); |
1789 } | 1789 } |
1790 __ nop(); // Branch delay slot of the last beq. | 1790 __ nop(); // Branch delay slot of the last beq. |
1791 AssembleArchJump(i.InputRpo(1)); | 1791 AssembleArchJump(i.InputRpo(1)); |
1792 } | 1792 } |
1793 | 1793 |
1794 | |
1795 void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) { | 1794 void CodeGenerator::AssembleArchTableSwitch(Instruction* instr) { |
1796 MipsOperandConverter i(this, instr); | 1795 MipsOperandConverter i(this, instr); |
1797 Register input = i.InputRegister(0); | 1796 Register input = i.InputRegister(0); |
1798 size_t const case_count = instr->InputCount() - 2; | 1797 size_t const case_count = instr->InputCount() - 2; |
1799 Label here; | |
1800 | 1798 |
1801 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); | 1799 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); |
1802 __ BlockTrampolinePoolFor(static_cast<int>(case_count) * 2 + 7); | 1800 __ GenerateSwitchTable(input, case_count, [&i, this](size_t index) { |
1803 // Ensure that dd-ed labels use 8 byte aligned addresses. | 1801 return GetLabel(i.InputRpo(index + 2)); |
1804 __ Align(8); | 1802 }); |
1805 __ bal(&here); | |
1806 __ dsll(at, input, 3); // Branch delay slot. | |
1807 __ bind(&here); | |
1808 __ daddu(at, at, ra); | |
1809 __ ld(at, MemOperand(at, 4 * v8::internal::Assembler::kInstrSize)); | |
1810 __ jr(at); | |
1811 __ nop(); // Branch delay slot nop. | |
1812 for (size_t index = 0; index < case_count; ++index) { | |
1813 __ dd(GetLabel(i.InputRpo(index + 2))); | |
1814 } | |
1815 } | 1803 } |
1816 | 1804 |
1817 | 1805 |
1818 void CodeGenerator::AssembleDeoptimizerCall( | 1806 void CodeGenerator::AssembleDeoptimizerCall( |
1819 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { | 1807 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { |
1820 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 1808 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
1821 isolate(), deoptimization_id, bailout_type); | 1809 isolate(), deoptimization_id, bailout_type); |
1822 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1810 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
1823 } | 1811 } |
1824 | 1812 |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2124 padding_size -= v8::internal::Assembler::kInstrSize; | 2112 padding_size -= v8::internal::Assembler::kInstrSize; |
2125 } | 2113 } |
2126 } | 2114 } |
2127 } | 2115 } |
2128 | 2116 |
2129 #undef __ | 2117 #undef __ |
2130 | 2118 |
2131 } // namespace compiler | 2119 } // namespace compiler |
2132 } // namespace internal | 2120 } // namespace internal |
2133 } // namespace v8 | 2121 } // namespace v8 |
OLD | NEW |