OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/compilation-info.h" | 7 #include "src/compilation-info.h" |
8 #include "src/compiler/code-generator-impl.h" | 8 #include "src/compiler/code-generator-impl.h" |
9 #include "src/compiler/gap-resolver.h" | 9 #include "src/compiler/gap-resolver.h" |
10 #include "src/compiler/node-matchers.h" | 10 #include "src/compiler/node-matchers.h" |
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
903 break; | 903 break; |
904 case kArchNop: | 904 case kArchNop: |
905 case kArchThrowTerminator: | 905 case kArchThrowTerminator: |
906 // don't emit code for nops. | 906 // don't emit code for nops. |
907 break; | 907 break; |
908 case kArchDeoptimize: { | 908 case kArchDeoptimize: { |
909 int deopt_state_id = | 909 int deopt_state_id = |
910 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 910 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
911 Deoptimizer::BailoutType bailout_type = | 911 Deoptimizer::BailoutType bailout_type = |
912 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 912 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
913 CodeGenResult result = | 913 CodeGenResult result = AssembleDeoptimizerCall( |
914 AssembleDeoptimizerCall(deopt_state_id, bailout_type); | 914 deopt_state_id, bailout_type, current_source_position_); |
915 if (result != kSuccess) return result; | 915 if (result != kSuccess) return result; |
916 break; | 916 break; |
917 } | 917 } |
918 case kArchRet: | 918 case kArchRet: |
919 AssembleReturn(); | 919 AssembleReturn(); |
920 break; | 920 break; |
921 case kArchStackPointer: | 921 case kArchStackPointer: |
922 __ movq(i.OutputRegister(), rsp); | 922 __ movq(i.OutputRegister(), rsp); |
923 break; | 923 break; |
924 case kArchFramePointer: | 924 case kArchFramePointer: |
(...skipping 1372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2297 cases[index] = GetLabel(i.InputRpo(index + 2)); | 2297 cases[index] = GetLabel(i.InputRpo(index + 2)); |
2298 } | 2298 } |
2299 Label* const table = AddJumpTable(cases, case_count); | 2299 Label* const table = AddJumpTable(cases, case_count); |
2300 __ cmpl(input, Immediate(case_count)); | 2300 __ cmpl(input, Immediate(case_count)); |
2301 __ j(above_equal, GetLabel(i.InputRpo(1))); | 2301 __ j(above_equal, GetLabel(i.InputRpo(1))); |
2302 __ leaq(kScratchRegister, Operand(table)); | 2302 __ leaq(kScratchRegister, Operand(table)); |
2303 __ jmp(Operand(kScratchRegister, input, times_8, 0)); | 2303 __ jmp(Operand(kScratchRegister, input, times_8, 0)); |
2304 } | 2304 } |
2305 | 2305 |
2306 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2306 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
2307 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { | 2307 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
| 2308 SourcePosition pos) { |
2308 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2309 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
2309 isolate(), deoptimization_id, bailout_type); | 2310 isolate(), deoptimization_id, bailout_type); |
2310 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2311 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
2311 DeoptimizeReason deoptimization_reason = | 2312 DeoptimizeReason deoptimization_reason = |
2312 GetDeoptimizationReason(deoptimization_id); | 2313 GetDeoptimizationReason(deoptimization_id); |
2313 __ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id); | 2314 __ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id); |
2314 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2315 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
2315 return kSuccess; | 2316 return kSuccess; |
2316 } | 2317 } |
2317 | 2318 |
2318 | 2319 |
2319 namespace { | 2320 namespace { |
2320 | 2321 |
2321 static const int kQuadWordSize = 16; | 2322 static const int kQuadWordSize = 16; |
2322 | 2323 |
2323 } // namespace | 2324 } // namespace |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2717 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2718 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2718 __ Nop(padding_size); | 2719 __ Nop(padding_size); |
2719 } | 2720 } |
2720 } | 2721 } |
2721 | 2722 |
2722 #undef __ | 2723 #undef __ |
2723 | 2724 |
2724 } // namespace compiler | 2725 } // namespace compiler |
2725 } // namespace internal | 2726 } // namespace internal |
2726 } // namespace v8 | 2727 } // namespace v8 |
OLD | NEW |