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