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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 x87_layout = (0 << 3) | 1; | 736 x87_layout = (0 << 3) | 1; |
737 } | 737 } |
738 // The layout of x87 register stack is loaded on the top of FPU register | 738 // The layout of x87 register stack is loaded on the top of FPU register |
739 // stack for deoptimization. | 739 // stack for deoptimization. |
740 __ push(Immediate(x87_layout)); | 740 __ push(Immediate(x87_layout)); |
741 __ fild_s(MemOperand(esp, 0)); | 741 __ fild_s(MemOperand(esp, 0)); |
742 __ lea(esp, Operand(esp, kPointerSize)); | 742 __ lea(esp, Operand(esp, kPointerSize)); |
743 | 743 |
744 Deoptimizer::BailoutType bailout_type = | 744 Deoptimizer::BailoutType bailout_type = |
745 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 745 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
746 CodeGenResult result = | 746 CodeGenResult result = AssembleDeoptimizerCall( |
747 AssembleDeoptimizerCall(deopt_state_id, bailout_type); | 747 deopt_state_id, bailout_type, current_source_position_); |
748 if (result != kSuccess) return result; | 748 if (result != kSuccess) return result; |
749 break; | 749 break; |
750 } | 750 } |
751 case kArchRet: | 751 case kArchRet: |
752 AssembleReturn(); | 752 AssembleReturn(); |
753 break; | 753 break; |
754 case kArchFramePointer: | 754 case kArchFramePointer: |
755 __ mov(i.OutputRegister(), ebp); | 755 __ mov(i.OutputRegister(), ebp); |
756 break; | 756 break; |
757 case kArchStackPointer: | 757 case kArchStackPointer: |
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2231 for (size_t index = 0; index < case_count; ++index) { | 2231 for (size_t index = 0; index < case_count; ++index) { |
2232 cases[index] = GetLabel(i.InputRpo(index + 2)); | 2232 cases[index] = GetLabel(i.InputRpo(index + 2)); |
2233 } | 2233 } |
2234 Label* const table = AddJumpTable(cases, case_count); | 2234 Label* const table = AddJumpTable(cases, case_count); |
2235 __ cmp(input, Immediate(case_count)); | 2235 __ cmp(input, Immediate(case_count)); |
2236 __ j(above_equal, GetLabel(i.InputRpo(1))); | 2236 __ j(above_equal, GetLabel(i.InputRpo(1))); |
2237 __ jmp(Operand::JumpTable(input, times_4, table)); | 2237 __ jmp(Operand::JumpTable(input, times_4, table)); |
2238 } | 2238 } |
2239 | 2239 |
2240 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2240 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
2241 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { | 2241 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
| 2242 SourcePosition pos) { |
2242 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2243 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
2243 isolate(), deoptimization_id, bailout_type); | 2244 isolate(), deoptimization_id, bailout_type); |
2244 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2245 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
2245 DeoptimizeReason deoptimization_reason = | 2246 DeoptimizeReason deoptimization_reason = |
2246 GetDeoptimizationReason(deoptimization_id); | 2247 GetDeoptimizationReason(deoptimization_id); |
2247 __ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id); | 2248 __ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id); |
2248 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2249 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
2249 return kSuccess; | 2250 return kSuccess; |
2250 } | 2251 } |
2251 | 2252 |
2252 | 2253 |
2253 // The calling convention for JSFunctions on X87 passes arguments on the | 2254 // The calling convention for JSFunctions on X87 passes arguments on the |
2254 // stack and the JSFunction and context in EDI and ESI, respectively, thus | 2255 // stack and the JSFunction and context in EDI and ESI, respectively, thus |
2255 // the steps of the call look as follows: | 2256 // the steps of the call look as follows: |
2256 | 2257 |
2257 // --{ before the call instruction }-------------------------------------------- | 2258 // --{ before the call instruction }-------------------------------------------- |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2724 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2725 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2725 __ Nop(padding_size); | 2726 __ Nop(padding_size); |
2726 } | 2727 } |
2727 } | 2728 } |
2728 | 2729 |
2729 #undef __ | 2730 #undef __ |
2730 | 2731 |
2731 } // namespace compiler | 2732 } // namespace compiler |
2732 } // namespace internal | 2733 } // namespace internal |
2733 } // namespace v8 | 2734 } // namespace v8 |
OLD | NEW |