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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
709 } | 709 } |
710 case kArchNop: | 710 case kArchNop: |
711 case kArchThrowTerminator: | 711 case kArchThrowTerminator: |
712 // don't emit code for nops. | 712 // don't emit code for nops. |
713 break; | 713 break; |
714 case kArchDeoptimize: { | 714 case kArchDeoptimize: { |
715 int deopt_state_id = | 715 int deopt_state_id = |
716 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 716 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
717 Deoptimizer::BailoutType bailout_type = | 717 Deoptimizer::BailoutType bailout_type = |
718 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 718 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
719 CodeGenResult result = | 719 CodeGenResult result = AssembleDeoptimizerCall( |
720 AssembleDeoptimizerCall(deopt_state_id, bailout_type); | 720 deopt_state_id, bailout_type, current_source_position_); |
721 if (result != kSuccess) return result; | 721 if (result != kSuccess) return result; |
722 break; | 722 break; |
723 } | 723 } |
724 case kArchRet: | 724 case kArchRet: |
725 AssembleReturn(); | 725 AssembleReturn(); |
726 break; | 726 break; |
727 case kArchStackPointer: | 727 case kArchStackPointer: |
728 __ mov(i.OutputRegister(), sp); | 728 __ mov(i.OutputRegister(), sp); |
729 break; | 729 break; |
730 case kArchFramePointer: | 730 case kArchFramePointer: |
(...skipping 1423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2154 Register input = i.InputRegister(0); | 2154 Register input = i.InputRegister(0); |
2155 size_t const case_count = instr->InputCount() - 2; | 2155 size_t const case_count = instr->InputCount() - 2; |
2156 | 2156 |
2157 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); | 2157 __ Branch(GetLabel(i.InputRpo(1)), hs, input, Operand(case_count)); |
2158 __ GenerateSwitchTable(input, case_count, [&i, this](size_t index) { | 2158 __ GenerateSwitchTable(input, case_count, [&i, this](size_t index) { |
2159 return GetLabel(i.InputRpo(index + 2)); | 2159 return GetLabel(i.InputRpo(index + 2)); |
2160 }); | 2160 }); |
2161 } | 2161 } |
2162 | 2162 |
2163 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2163 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
2164 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { | 2164 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
| 2165 SourcePosition pos) { |
2165 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2166 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
2166 isolate(), deoptimization_id, bailout_type); | 2167 isolate(), deoptimization_id, bailout_type); |
2167 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2168 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
2168 DeoptimizeReason deoptimization_reason = | 2169 DeoptimizeReason deoptimization_reason = |
2169 GetDeoptimizationReason(deoptimization_id); | 2170 GetDeoptimizationReason(deoptimization_id); |
2170 __ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id); | 2171 __ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id); |
2171 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2172 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
2172 return kSuccess; | 2173 return kSuccess; |
2173 } | 2174 } |
2174 | 2175 |
2175 void CodeGenerator::FinishFrame(Frame* frame) { | 2176 void CodeGenerator::FinishFrame(Frame* frame) { |
2176 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2177 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
2177 | 2178 |
2178 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); | 2179 const RegList saves_fpu = descriptor->CalleeSavedFPRegisters(); |
2179 if (saves_fpu != 0) { | 2180 if (saves_fpu != 0) { |
2180 int count = base::bits::CountPopulation32(saves_fpu); | 2181 int count = base::bits::CountPopulation32(saves_fpu); |
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2484 padding_size -= v8::internal::Assembler::kInstrSize; | 2485 padding_size -= v8::internal::Assembler::kInstrSize; |
2485 } | 2486 } |
2486 } | 2487 } |
2487 } | 2488 } |
2488 | 2489 |
2489 #undef __ | 2490 #undef __ |
2490 | 2491 |
2491 } // namespace compiler | 2492 } // namespace compiler |
2492 } // namespace internal | 2493 } // namespace internal |
2493 } // namespace v8 | 2494 } // namespace v8 |
OLD | NEW |