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 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
729 // of this instruction. | 729 // of this instruction. |
730 if (double_register_param_count > 0) { | 730 if (double_register_param_count > 0) { |
731 x87_layout = (0 << 3) | 1; | 731 x87_layout = (0 << 3) | 1; |
732 } | 732 } |
733 // The layout of x87 register stack is loaded on the top of FPU register | 733 // The layout of x87 register stack is loaded on the top of FPU register |
734 // stack for deoptimization. | 734 // stack for deoptimization. |
735 __ push(Immediate(x87_layout)); | 735 __ push(Immediate(x87_layout)); |
736 __ fild_s(MemOperand(esp, 0)); | 736 __ fild_s(MemOperand(esp, 0)); |
737 __ lea(esp, Operand(esp, kPointerSize)); | 737 __ lea(esp, Operand(esp, kPointerSize)); |
738 | 738 |
739 CodeGenResult result = | 739 Deoptimizer::BailoutType bailout_type = |
740 AssembleDeoptimizerCall(deopt_state_id, current_source_position_); | 740 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
| 741 CodeGenResult result = AssembleDeoptimizerCall( |
| 742 deopt_state_id, bailout_type, current_source_position_); |
741 if (result != kSuccess) return result; | 743 if (result != kSuccess) return result; |
742 break; | 744 break; |
743 } | 745 } |
744 case kArchRet: | 746 case kArchRet: |
745 AssembleReturn(instr->InputAt(0)); | 747 AssembleReturn(instr->InputAt(0)); |
746 break; | 748 break; |
747 case kArchFramePointer: | 749 case kArchFramePointer: |
748 __ mov(i.OutputRegister(), ebp); | 750 __ mov(i.OutputRegister(), ebp); |
749 break; | 751 break; |
750 case kArchStackPointer: | 752 case kArchStackPointer: |
(...skipping 1505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2256 for (size_t index = 0; index < case_count; ++index) { | 2258 for (size_t index = 0; index < case_count; ++index) { |
2257 cases[index] = GetLabel(i.InputRpo(index + 2)); | 2259 cases[index] = GetLabel(i.InputRpo(index + 2)); |
2258 } | 2260 } |
2259 Label* const table = AddJumpTable(cases, case_count); | 2261 Label* const table = AddJumpTable(cases, case_count); |
2260 __ cmp(input, Immediate(case_count)); | 2262 __ cmp(input, Immediate(case_count)); |
2261 __ j(above_equal, GetLabel(i.InputRpo(1))); | 2263 __ j(above_equal, GetLabel(i.InputRpo(1))); |
2262 __ jmp(Operand::JumpTable(input, times_4, table)); | 2264 __ jmp(Operand::JumpTable(input, times_4, table)); |
2263 } | 2265 } |
2264 | 2266 |
2265 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2267 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
2266 int deoptimization_id, SourcePosition pos) { | 2268 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
2267 DeoptimizeKind deoptimization_kind = GetDeoptimizationKind(deoptimization_id); | 2269 SourcePosition pos) { |
2268 DeoptimizeReason deoptimization_reason = | |
2269 GetDeoptimizationReason(deoptimization_id); | |
2270 Deoptimizer::BailoutType bailout_type = | |
2271 deoptimization_kind == DeoptimizeKind::kSoft ? Deoptimizer::SOFT | |
2272 : Deoptimizer::EAGER; | |
2273 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2270 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
2274 isolate(), deoptimization_id, bailout_type); | 2271 isolate(), deoptimization_id, bailout_type); |
2275 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2272 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
| 2273 DeoptimizeReason deoptimization_reason = |
| 2274 GetDeoptimizationReason(deoptimization_id); |
2276 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 2275 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); |
2277 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2276 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
2278 return kSuccess; | 2277 return kSuccess; |
2279 } | 2278 } |
2280 | 2279 |
2281 | 2280 |
2282 // The calling convention for JSFunctions on X87 passes arguments on the | 2281 // The calling convention for JSFunctions on X87 passes arguments on the |
2283 // stack and the JSFunction and context in EDI and ESI, respectively, thus | 2282 // stack and the JSFunction and context in EDI and ESI, respectively, thus |
2284 // the steps of the call look as follows: | 2283 // the steps of the call look as follows: |
2285 | 2284 |
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2762 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2761 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2763 __ Nop(padding_size); | 2762 __ Nop(padding_size); |
2764 } | 2763 } |
2765 } | 2764 } |
2766 | 2765 |
2767 #undef __ | 2766 #undef __ |
2768 | 2767 |
2769 } // namespace compiler | 2768 } // namespace compiler |
2770 } // namespace internal | 2769 } // namespace internal |
2771 } // namespace v8 | 2770 } // namespace v8 |
OLD | NEW |