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 CodeGenResult result = | 771 Deoptimizer::BailoutType bailout_type = |
772 AssembleDeoptimizerCall(deopt_state_id, current_source_position_); | 772 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
| 773 CodeGenResult result = AssembleDeoptimizerCall( |
| 774 deopt_state_id, bailout_type, current_source_position_); |
773 if (result != kSuccess) return result; | 775 if (result != kSuccess) return result; |
774 break; | 776 break; |
775 } | 777 } |
776 case kArchRet: | 778 case kArchRet: |
777 AssembleReturn(instr->InputAt(0)); | 779 AssembleReturn(instr->InputAt(0)); |
778 break; | 780 break; |
779 case kArchStackPointer: | 781 case kArchStackPointer: |
780 __ mov(i.OutputRegister(), sp); | 782 __ mov(i.OutputRegister(), sp); |
781 break; | 783 break; |
782 case kArchFramePointer: | 784 case kArchFramePointer: |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2322 Register input = i.InputRegister(0); | 2324 Register input = i.InputRegister(0); |
2323 size_t const case_count = instr->InputCount() - 2; | 2325 size_t const case_count = instr->InputCount() - 2; |
2324 | 2326 |
2325 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); | 2327 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); |
2326 __ GenerateSwitchTable(input, case_count, [&i, this](size_t index) { | 2328 __ GenerateSwitchTable(input, case_count, [&i, this](size_t index) { |
2327 return GetLabel(i.InputRpo(index + 2)); | 2329 return GetLabel(i.InputRpo(index + 2)); |
2328 }); | 2330 }); |
2329 } | 2331 } |
2330 | 2332 |
2331 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2333 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
2332 int deoptimization_id, SourcePosition pos) { | 2334 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
2333 DeoptimizeKind deoptimization_kind = GetDeoptimizationKind(deoptimization_id); | 2335 SourcePosition pos) { |
2334 DeoptimizeReason deoptimization_reason = | |
2335 GetDeoptimizationReason(deoptimization_id); | |
2336 Deoptimizer::BailoutType bailout_type = | |
2337 deoptimization_kind == DeoptimizeKind::kSoft ? Deoptimizer::SOFT | |
2338 : Deoptimizer::EAGER; | |
2339 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2336 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
2340 isolate(), deoptimization_id, bailout_type); | 2337 isolate(), deoptimization_id, bailout_type); |
2341 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2338 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
| 2339 DeoptimizeReason deoptimization_reason = |
| 2340 GetDeoptimizationReason(deoptimization_id); |
2342 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 2341 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); |
2343 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2342 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
2344 return kSuccess; | 2343 return kSuccess; |
2345 } | 2344 } |
2346 | 2345 |
2347 void CodeGenerator::FinishFrame(Frame* frame) { | 2346 void CodeGenerator::FinishFrame(Frame* frame) { |
2348 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2347 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
2349 | 2348 |
2350 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); | 2349 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); |
2351 if (saves_fpu != 0) { | 2350 if (saves_fpu != 0) { |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2674 padding_size -= v8::internal::Assembler::kInstrSize; | 2673 padding_size -= v8::internal::Assembler::kInstrSize; |
2675 } | 2674 } |
2676 } | 2675 } |
2677 } | 2676 } |
2678 | 2677 |
2679 #undef __ | 2678 #undef __ |
2680 | 2679 |
2681 } // namespace compiler | 2680 } // namespace compiler |
2682 } // namespace internal | 2681 } // namespace internal |
2683 } // namespace v8 | 2682 } // namespace v8 |
OLD | NEW |