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 CodeGenResult result = | 639 Deoptimizer::BailoutType bailout_type = |
640 AssembleDeoptimizerCall(deopt_state_id, current_source_position_); | 640 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
| 641 CodeGenResult result = AssembleDeoptimizerCall( |
| 642 deopt_state_id, bailout_type, current_source_position_); |
641 if (result != kSuccess) return result; | 643 if (result != kSuccess) return result; |
642 break; | 644 break; |
643 } | 645 } |
644 case kArchRet: | 646 case kArchRet: |
645 AssembleReturn(instr->InputAt(0)); | 647 AssembleReturn(instr->InputAt(0)); |
646 break; | 648 break; |
647 case kArchStackPointer: | 649 case kArchStackPointer: |
648 __ mov(i.OutputRegister(), esp); | 650 __ mov(i.OutputRegister(), esp); |
649 break; | 651 break; |
650 case kArchFramePointer: | 652 case kArchFramePointer: |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1798 for (size_t index = 0; index < case_count; ++index) { | 1800 for (size_t index = 0; index < case_count; ++index) { |
1799 cases[index] = GetLabel(i.InputRpo(index + 2)); | 1801 cases[index] = GetLabel(i.InputRpo(index + 2)); |
1800 } | 1802 } |
1801 Label* const table = AddJumpTable(cases, case_count); | 1803 Label* const table = AddJumpTable(cases, case_count); |
1802 __ cmp(input, Immediate(case_count)); | 1804 __ cmp(input, Immediate(case_count)); |
1803 __ j(above_equal, GetLabel(i.InputRpo(1))); | 1805 __ j(above_equal, GetLabel(i.InputRpo(1))); |
1804 __ jmp(Operand::JumpTable(input, times_4, table)); | 1806 __ jmp(Operand::JumpTable(input, times_4, table)); |
1805 } | 1807 } |
1806 | 1808 |
1807 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 1809 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
1808 int deoptimization_id, SourcePosition pos) { | 1810 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
1809 DeoptimizeKind deoptimization_kind = GetDeoptimizationKind(deoptimization_id); | 1811 SourcePosition pos) { |
1810 DeoptimizeReason deoptimization_reason = | |
1811 GetDeoptimizationReason(deoptimization_id); | |
1812 Deoptimizer::BailoutType bailout_type = | |
1813 deoptimization_kind == DeoptimizeKind::kSoft ? Deoptimizer::SOFT | |
1814 : Deoptimizer::EAGER; | |
1815 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 1812 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
1816 isolate(), deoptimization_id, bailout_type); | 1813 isolate(), deoptimization_id, bailout_type); |
1817 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 1814 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
| 1815 DeoptimizeReason deoptimization_reason = |
| 1816 GetDeoptimizationReason(deoptimization_id); |
1818 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 1817 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); |
1819 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1818 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
1820 return kSuccess; | 1819 return kSuccess; |
1821 } | 1820 } |
1822 | 1821 |
1823 | 1822 |
1824 // The calling convention for JSFunctions on IA32 passes arguments on the | 1823 // The calling convention for JSFunctions on IA32 passes arguments on the |
1825 // stack and the JSFunction and context in EDI and ESI, respectively, thus | 1824 // stack and the JSFunction and context in EDI and ESI, respectively, thus |
1826 // the steps of the call look as follows: | 1825 // the steps of the call look as follows: |
1827 | 1826 |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2302 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2301 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2303 __ Nop(padding_size); | 2302 __ Nop(padding_size); |
2304 } | 2303 } |
2305 } | 2304 } |
2306 | 2305 |
2307 #undef __ | 2306 #undef __ |
2308 | 2307 |
2309 } // namespace compiler | 2308 } // namespace compiler |
2310 } // namespace internal | 2309 } // namespace internal |
2311 } // namespace v8 | 2310 } // namespace v8 |
OLD | NEW |