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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 break; | 639 break; |
640 case kArchNop: | 640 case kArchNop: |
641 case kArchThrowTerminator: | 641 case kArchThrowTerminator: |
642 // don't emit code for nops. | 642 // don't emit code for nops. |
643 break; | 643 break; |
644 case kArchDeoptimize: { | 644 case kArchDeoptimize: { |
645 int deopt_state_id = | 645 int deopt_state_id = |
646 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 646 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
647 Deoptimizer::BailoutType bailout_type = | 647 Deoptimizer::BailoutType bailout_type = |
648 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 648 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
649 CodeGenResult result = | 649 CodeGenResult result = AssembleDeoptimizerCall( |
650 AssembleDeoptimizerCall(deopt_state_id, bailout_type); | 650 deopt_state_id, bailout_type, current_source_position_); |
651 if (result != kSuccess) return result; | 651 if (result != kSuccess) return result; |
652 break; | 652 break; |
653 } | 653 } |
654 case kArchRet: | 654 case kArchRet: |
655 AssembleReturn(); | 655 AssembleReturn(); |
656 break; | 656 break; |
657 case kArchStackPointer: | 657 case kArchStackPointer: |
658 __ mov(i.OutputRegister(), esp); | 658 __ mov(i.OutputRegister(), esp); |
659 break; | 659 break; |
660 case kArchFramePointer: | 660 case kArchFramePointer: |
(...skipping 1115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1776 for (size_t index = 0; index < case_count; ++index) { | 1776 for (size_t index = 0; index < case_count; ++index) { |
1777 cases[index] = GetLabel(i.InputRpo(index + 2)); | 1777 cases[index] = GetLabel(i.InputRpo(index + 2)); |
1778 } | 1778 } |
1779 Label* const table = AddJumpTable(cases, case_count); | 1779 Label* const table = AddJumpTable(cases, case_count); |
1780 __ cmp(input, Immediate(case_count)); | 1780 __ cmp(input, Immediate(case_count)); |
1781 __ j(above_equal, GetLabel(i.InputRpo(1))); | 1781 __ j(above_equal, GetLabel(i.InputRpo(1))); |
1782 __ jmp(Operand::JumpTable(input, times_4, table)); | 1782 __ jmp(Operand::JumpTable(input, times_4, table)); |
1783 } | 1783 } |
1784 | 1784 |
1785 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 1785 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
1786 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { | 1786 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
| 1787 SourcePosition pos) { |
1787 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 1788 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
1788 isolate(), deoptimization_id, bailout_type); | 1789 isolate(), deoptimization_id, bailout_type); |
1789 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 1790 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
1790 DeoptimizeReason deoptimization_reason = | 1791 DeoptimizeReason deoptimization_reason = |
1791 GetDeoptimizationReason(deoptimization_id); | 1792 GetDeoptimizationReason(deoptimization_id); |
1792 __ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id); | 1793 __ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id); |
1793 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 1794 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
1794 return kSuccess; | 1795 return kSuccess; |
1795 } | 1796 } |
1796 | 1797 |
1797 | 1798 |
1798 // The calling convention for JSFunctions on IA32 passes arguments on the | 1799 // The calling convention for JSFunctions on IA32 passes arguments on the |
1799 // stack and the JSFunction and context in EDI and ESI, respectively, thus | 1800 // stack and the JSFunction and context in EDI and ESI, respectively, thus |
1800 // the steps of the call look as follows: | 1801 // the steps of the call look as follows: |
1801 | 1802 |
1802 // --{ before the call instruction }-------------------------------------------- | 1803 // --{ before the call instruction }-------------------------------------------- |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2265 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2266 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2266 __ Nop(padding_size); | 2267 __ Nop(padding_size); |
2267 } | 2268 } |
2268 } | 2269 } |
2269 | 2270 |
2270 #undef __ | 2271 #undef __ |
2271 | 2272 |
2272 } // namespace compiler | 2273 } // namespace compiler |
2273 } // namespace internal | 2274 } // namespace internal |
2274 } // namespace v8 | 2275 } // namespace v8 |
OLD | NEW |