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 | 6 |
7 #include "src/arm/macro-assembler-arm.h" | 7 #include "src/arm/macro-assembler-arm.h" |
8 #include "src/compilation-info.h" | 8 #include "src/compilation-info.h" |
9 #include "src/compiler/code-generator-impl.h" | 9 #include "src/compiler/code-generator-impl.h" |
10 #include "src/compiler/gap-resolver.h" | 10 #include "src/compiler/gap-resolver.h" |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 break; | 730 break; |
731 } | 731 } |
732 case kArchNop: | 732 case kArchNop: |
733 case kArchThrowTerminator: | 733 case kArchThrowTerminator: |
734 // don't emit code for nops. | 734 // don't emit code for nops. |
735 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 735 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
736 break; | 736 break; |
737 case kArchDeoptimize: { | 737 case kArchDeoptimize: { |
738 int deopt_state_id = | 738 int deopt_state_id = |
739 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 739 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
740 CodeGenResult result = | 740 Deoptimizer::BailoutType bailout_type = |
741 AssembleDeoptimizerCall(deopt_state_id, current_source_position_); | 741 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
| 742 CodeGenResult result = AssembleDeoptimizerCall( |
| 743 deopt_state_id, bailout_type, current_source_position_); |
742 if (result != kSuccess) return result; | 744 if (result != kSuccess) return result; |
743 break; | 745 break; |
744 } | 746 } |
745 case kArchRet: | 747 case kArchRet: |
746 AssembleReturn(instr->InputAt(0)); | 748 AssembleReturn(instr->InputAt(0)); |
747 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 749 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
748 break; | 750 break; |
749 case kArchStackPointer: | 751 case kArchStackPointer: |
750 __ mov(i.OutputRegister(), sp); | 752 __ mov(i.OutputRegister(), sp); |
751 DCHECK_EQ(LeaveCC, i.OutputSBit()); | 753 DCHECK_EQ(LeaveCC, i.OutputSBit()); |
(...skipping 1347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2099 __ cmp(input, Operand(case_count)); | 2101 __ cmp(input, Operand(case_count)); |
2100 __ BlockConstPoolFor(case_count + 2); | 2102 __ BlockConstPoolFor(case_count + 2); |
2101 __ add(pc, pc, Operand(input, LSL, 2), LeaveCC, lo); | 2103 __ add(pc, pc, Operand(input, LSL, 2), LeaveCC, lo); |
2102 __ b(GetLabel(i.InputRpo(1))); | 2104 __ b(GetLabel(i.InputRpo(1))); |
2103 for (size_t index = 0; index < case_count; ++index) { | 2105 for (size_t index = 0; index < case_count; ++index) { |
2104 __ b(GetLabel(i.InputRpo(index + 2))); | 2106 __ b(GetLabel(i.InputRpo(index + 2))); |
2105 } | 2107 } |
2106 } | 2108 } |
2107 | 2109 |
2108 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2110 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
2109 int deoptimization_id, SourcePosition pos) { | 2111 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
2110 DeoptimizeKind deoptimization_kind = GetDeoptimizationKind(deoptimization_id); | 2112 SourcePosition pos) { |
2111 DeoptimizeReason deoptimization_reason = | |
2112 GetDeoptimizationReason(deoptimization_id); | |
2113 Deoptimizer::BailoutType bailout_type = | |
2114 deoptimization_kind == DeoptimizeKind::kSoft ? Deoptimizer::SOFT | |
2115 : Deoptimizer::EAGER; | |
2116 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2113 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
2117 isolate(), deoptimization_id, bailout_type); | 2114 isolate(), deoptimization_id, bailout_type); |
2118 // TODO(turbofan): We should be able to generate better code by sharing the | 2115 // TODO(turbofan): We should be able to generate better code by sharing the |
2119 // actual final call site and just bl'ing to it here, similar to what we do | 2116 // actual final call site and just bl'ing to it here, similar to what we do |
2120 // in the lithium backend. | 2117 // in the lithium backend. |
2121 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2118 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
| 2119 DeoptimizeReason deoptimization_reason = |
| 2120 GetDeoptimizationReason(deoptimization_id); |
2122 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 2121 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); |
2123 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2122 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
2124 __ CheckConstPool(false, false); | 2123 __ CheckConstPool(false, false); |
2125 return kSuccess; | 2124 return kSuccess; |
2126 } | 2125 } |
2127 | 2126 |
2128 void CodeGenerator::FinishFrame(Frame* frame) { | 2127 void CodeGenerator::FinishFrame(Frame* frame) { |
2129 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2128 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
2130 | 2129 |
2131 const RegList saves_fp = descriptor->CalleeSavedFPRegisters(); | 2130 const RegList saves_fp = descriptor->CalleeSavedFPRegisters(); |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2577 padding_size -= v8::internal::Assembler::kInstrSize; | 2576 padding_size -= v8::internal::Assembler::kInstrSize; |
2578 } | 2577 } |
2579 } | 2578 } |
2580 } | 2579 } |
2581 | 2580 |
2582 #undef __ | 2581 #undef __ |
2583 | 2582 |
2584 } // namespace compiler | 2583 } // namespace compiler |
2585 } // namespace internal | 2584 } // namespace internal |
2586 } // namespace v8 | 2585 } // namespace v8 |
OLD | NEW |