OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/compilation-info.h" | 7 #include "src/compilation-info.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 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 case kArchDebugBreak: | 629 case kArchDebugBreak: |
630 __ int3(); | 630 __ int3(); |
631 break; | 631 break; |
632 case kArchNop: | 632 case kArchNop: |
633 case kArchThrowTerminator: | 633 case kArchThrowTerminator: |
634 // don't emit code for nops. | 634 // don't emit code for nops. |
635 break; | 635 break; |
636 case kArchDeoptimize: { | 636 case kArchDeoptimize: { |
637 int deopt_state_id = | 637 int deopt_state_id = |
638 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 638 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
639 Deoptimizer::BailoutType bailout_type = | 639 CodeGenResult result = |
640 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 640 AssembleDeoptimizerCall(deopt_state_id, current_source_position_); |
641 CodeGenResult result = AssembleDeoptimizerCall( | |
642 deopt_state_id, bailout_type, current_source_position_); | |
643 if (result != kSuccess) return result; | 641 if (result != kSuccess) return result; |
644 break; | 642 break; |
645 } | 643 } |
646 case kArchRet: | 644 case kArchRet: |
647 AssembleReturn(instr->InputAt(0)); | 645 AssembleReturn(instr->InputAt(0)); |
648 break; | 646 break; |
649 case kArchStackPointer: | 647 case kArchStackPointer: |
650 __ mov(i.OutputRegister(), esp); | 648 __ mov(i.OutputRegister(), esp); |
651 break; | 649 break; |
652 case kArchFramePointer: | 650 case kArchFramePointer: |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1800 for (size_t index = 0; index < case_count; ++index) { | 1798 for (size_t index = 0; index < case_count; ++index) { |
1801 cases[index] = GetLabel(i.InputRpo(index + 2)); | 1799 cases[index] = GetLabel(i.InputRpo(index + 2)); |
1802 } | 1800 } |
1803 Label* const table = AddJumpTable(cases, case_count); | 1801 Label* const table = AddJumpTable(cases, case_count); |
1804 __ cmp(input, Immediate(case_count)); | 1802 __ cmp(input, Immediate(case_count)); |
1805 __ j(above_equal, GetLabel(i.InputRpo(1))); | 1803 __ j(above_equal, GetLabel(i.InputRpo(1))); |
1806 __ jmp(Operand::JumpTable(input, times_4, table)); | 1804 __ jmp(Operand::JumpTable(input, times_4, table)); |
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 | 1823 |
1823 // The calling convention for JSFunctions on IA32 passes arguments on the | 1824 // The calling convention for JSFunctions on IA32 passes arguments on the |
1824 // stack and the JSFunction and context in EDI and ESI, respectively, thus | 1825 // stack and the JSFunction and context in EDI and ESI, respectively, thus |
1825 // the steps of the call look as follows: | 1826 // the steps of the call look as follows: |
1826 | 1827 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2301 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2302 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2302 __ Nop(padding_size); | 2303 __ Nop(padding_size); |
2303 } | 2304 } |
2304 } | 2305 } |
2305 | 2306 |
2306 #undef __ | 2307 #undef __ |
2307 | 2308 |
2308 } // namespace compiler | 2309 } // namespace compiler |
2309 } // namespace internal | 2310 } // namespace internal |
2310 } // namespace v8 | 2311 } // namespace v8 |
OLD | NEW |