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/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
8 #include "src/arm64/macro-assembler-arm64.h" | 8 #include "src/arm64/macro-assembler-arm64.h" |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 __ RecordComment(reinterpret_cast<const char*>(comment_string)); | 767 __ RecordComment(reinterpret_cast<const char*>(comment_string)); |
768 break; | 768 break; |
769 } | 769 } |
770 case kArchNop: | 770 case kArchNop: |
771 case kArchThrowTerminator: | 771 case kArchThrowTerminator: |
772 // don't emit code for nops. | 772 // don't emit code for nops. |
773 break; | 773 break; |
774 case kArchDeoptimize: { | 774 case kArchDeoptimize: { |
775 int deopt_state_id = | 775 int deopt_state_id = |
776 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 776 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
777 Deoptimizer::BailoutType bailout_type = | 777 CodeGenResult result = |
778 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 778 AssembleDeoptimizerCall(deopt_state_id, current_source_position_); |
779 CodeGenResult result = AssembleDeoptimizerCall( | |
780 deopt_state_id, bailout_type, current_source_position_); | |
781 if (result != kSuccess) return result; | 779 if (result != kSuccess) return result; |
782 break; | 780 break; |
783 } | 781 } |
784 case kArchRet: | 782 case kArchRet: |
785 AssembleReturn(instr->InputAt(0)); | 783 AssembleReturn(instr->InputAt(0)); |
786 break; | 784 break; |
787 case kArchStackPointer: | 785 case kArchStackPointer: |
788 __ mov(i.OutputRegister(), masm()->StackPointer()); | 786 __ mov(i.OutputRegister(), masm()->StackPointer()); |
789 break; | 787 break; |
790 case kArchFramePointer: | 788 case kArchFramePointer: |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1800 __ Br(temp); | 1798 __ Br(temp); |
1801 __ StartBlockPools(); | 1799 __ StartBlockPools(); |
1802 __ Bind(&table); | 1800 __ Bind(&table); |
1803 for (size_t index = 0; index < case_count; ++index) { | 1801 for (size_t index = 0; index < case_count; ++index) { |
1804 __ B(GetLabel(i.InputRpo(index + 2))); | 1802 __ B(GetLabel(i.InputRpo(index + 2))); |
1805 } | 1803 } |
1806 __ EndBlockPools(); | 1804 __ EndBlockPools(); |
1807 } | 1805 } |
1808 | 1806 |
1809 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 1807 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
1810 int deoptimization_id, Deoptimizer::BailoutType bailout_type, | 1808 int deoptimization_id, SourcePosition pos) { |
1811 SourcePosition pos) { | 1809 DeoptimizeKind deoptimization_kind = GetDeoptimizationKind(deoptimization_id); |
| 1810 DeoptimizeReason deoptimization_reason = |
| 1811 GetDeoptimizationReason(deoptimization_id); |
| 1812 Deoptimizer::BailoutType bailout_type = |
| 1813 deoptimization_kind == DeoptimizeKind::kSoft ? Deoptimizer::SOFT |
| 1814 : Deoptimizer::EAGER; |
1812 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 1815 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
1813 isolate(), deoptimization_id, bailout_type); | 1816 isolate(), deoptimization_id, bailout_type); |
1814 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 1817 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
1815 DeoptimizeReason deoptimization_reason = | |
1816 GetDeoptimizationReason(deoptimization_id); | |
1817 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 1818 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); |
1818 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1819 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
1819 return kSuccess; | 1820 return kSuccess; |
1820 } | 1821 } |
1821 | 1822 |
1822 void CodeGenerator::FinishFrame(Frame* frame) { | 1823 void CodeGenerator::FinishFrame(Frame* frame) { |
1823 frame->AlignFrame(16); | 1824 frame->AlignFrame(16); |
1824 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 1825 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
1825 | 1826 |
1826 if (descriptor->UseNativeStack() || descriptor->IsCFunctionCall()) { | 1827 if (descriptor->UseNativeStack() || descriptor->IsCFunctionCall()) { |
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 padding_size -= kInstructionSize; | 2175 padding_size -= kInstructionSize; |
2175 } | 2176 } |
2176 } | 2177 } |
2177 } | 2178 } |
2178 | 2179 |
2179 #undef __ | 2180 #undef __ |
2180 | 2181 |
2181 } // namespace compiler | 2182 } // namespace compiler |
2182 } // namespace internal | 2183 } // namespace internal |
2183 } // namespace v8 | 2184 } // namespace v8 |
OLD | NEW |