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