| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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 #include "src/compilation-info.h" | 6 #include "src/compilation-info.h" |
| 7 #include "src/compiler/code-generator-impl.h" | 7 #include "src/compiler/code-generator-impl.h" |
| 8 #include "src/compiler/gap-resolver.h" | 8 #include "src/compiler/gap-resolver.h" |
| 9 #include "src/compiler/node-matchers.h" | 9 #include "src/compiler/node-matchers.h" |
| 10 #include "src/compiler/osr.h" | 10 #include "src/compiler/osr.h" |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 __ RecordComment(reinterpret_cast<const char*>(comment_string)); | 761 __ RecordComment(reinterpret_cast<const char*>(comment_string)); |
| 762 break; | 762 break; |
| 763 } | 763 } |
| 764 case kArchNop: | 764 case kArchNop: |
| 765 case kArchThrowTerminator: | 765 case kArchThrowTerminator: |
| 766 // don't emit code for nops. | 766 // don't emit code for nops. |
| 767 break; | 767 break; |
| 768 case kArchDeoptimize: { | 768 case kArchDeoptimize: { |
| 769 int deopt_state_id = | 769 int deopt_state_id = |
| 770 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 770 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
| 771 Deoptimizer::BailoutType bailout_type = | 771 CodeGenResult result = |
| 772 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 772 AssembleDeoptimizerCall(deopt_state_id, current_source_position_); |
| 773 CodeGenResult result = AssembleDeoptimizerCall( | |
| 774 deopt_state_id, bailout_type, current_source_position_); | |
| 775 if (result != kSuccess) return result; | 773 if (result != kSuccess) return result; |
| 776 break; | 774 break; |
| 777 } | 775 } |
| 778 case kArchRet: | 776 case kArchRet: |
| 779 AssembleReturn(instr->InputAt(0)); | 777 AssembleReturn(instr->InputAt(0)); |
| 780 break; | 778 break; |
| 781 case kArchStackPointer: | 779 case kArchStackPointer: |
| 782 __ mov(i.OutputRegister(), sp); | 780 __ mov(i.OutputRegister(), sp); |
| 783 break; | 781 break; |
| 784 case kArchFramePointer: | 782 case kArchFramePointer: |
| (...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2324 Register input = i.InputRegister(0); | 2322 Register input = i.InputRegister(0); |
| 2325 size_t const case_count = instr->InputCount() - 2; | 2323 size_t const case_count = instr->InputCount() - 2; |
| 2326 | 2324 |
| 2327 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); | 2325 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); |
| 2328 __ GenerateSwitchTable(input, case_count, [&i, this](size_t index) { | 2326 __ GenerateSwitchTable(input, case_count, [&i, this](size_t index) { |
| 2329 return GetLabel(i.InputRpo(index + 2)); | 2327 return GetLabel(i.InputRpo(index + 2)); |
| 2330 }); | 2328 }); |
| 2331 } | 2329 } |
| 2332 | 2330 |
| 2333 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2331 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
| 2334 int deoptimization_id, Deoptimizer::BailoutType bailout_type, | 2332 int deoptimization_id, SourcePosition pos) { |
| 2335 SourcePosition pos) { | 2333 DeoptimizeKind deoptimization_kind = GetDeoptimizationKind(deoptimization_id); |
| 2334 DeoptimizeReason deoptimization_reason = |
| 2335 GetDeoptimizationReason(deoptimization_id); |
| 2336 Deoptimizer::BailoutType bailout_type = |
| 2337 deoptimization_kind == DeoptimizeKind::kSoft ? Deoptimizer::SOFT |
| 2338 : Deoptimizer::EAGER; |
| 2336 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2339 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
| 2337 isolate(), deoptimization_id, bailout_type); | 2340 isolate(), deoptimization_id, bailout_type); |
| 2338 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2341 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
| 2339 DeoptimizeReason deoptimization_reason = | |
| 2340 GetDeoptimizationReason(deoptimization_id); | |
| 2341 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 2342 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); |
| 2342 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2343 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
| 2343 return kSuccess; | 2344 return kSuccess; |
| 2344 } | 2345 } |
| 2345 | 2346 |
| 2346 void CodeGenerator::FinishFrame(Frame* frame) { | 2347 void CodeGenerator::FinishFrame(Frame* frame) { |
| 2347 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2348 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
| 2348 | 2349 |
| 2349 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); | 2350 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); |
| 2350 if (saves_fpu != 0) { | 2351 if (saves_fpu != 0) { |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2673 padding_size -= v8::internal::Assembler::kInstrSize; | 2674 padding_size -= v8::internal::Assembler::kInstrSize; |
| 2674 } | 2675 } |
| 2675 } | 2676 } |
| 2676 } | 2677 } |
| 2677 | 2678 |
| 2678 #undef __ | 2679 #undef __ |
| 2679 | 2680 |
| 2680 } // namespace compiler | 2681 } // namespace compiler |
| 2681 } // namespace internal | 2682 } // namespace internal |
| 2682 } // namespace v8 | 2683 } // namespace v8 |
| OLD | NEW |