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 <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/compilation-info.h" | 9 #include "src/compilation-info.h" |
10 #include "src/compiler/code-generator-impl.h" | 10 #include "src/compiler/code-generator-impl.h" |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 case kArchDebugBreak: | 923 case kArchDebugBreak: |
924 __ int3(); | 924 __ int3(); |
925 break; | 925 break; |
926 case kArchNop: | 926 case kArchNop: |
927 case kArchThrowTerminator: | 927 case kArchThrowTerminator: |
928 // don't emit code for nops. | 928 // don't emit code for nops. |
929 break; | 929 break; |
930 case kArchDeoptimize: { | 930 case kArchDeoptimize: { |
931 int deopt_state_id = | 931 int deopt_state_id = |
932 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 932 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
933 CodeGenResult result = | 933 Deoptimizer::BailoutType bailout_type = |
934 AssembleDeoptimizerCall(deopt_state_id, current_source_position_); | 934 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
| 935 CodeGenResult result = AssembleDeoptimizerCall( |
| 936 deopt_state_id, bailout_type, current_source_position_); |
935 if (result != kSuccess) return result; | 937 if (result != kSuccess) return result; |
936 break; | 938 break; |
937 } | 939 } |
938 case kArchRet: | 940 case kArchRet: |
939 AssembleReturn(instr->InputAt(0)); | 941 AssembleReturn(instr->InputAt(0)); |
940 break; | 942 break; |
941 case kArchStackPointer: | 943 case kArchStackPointer: |
942 __ movq(i.OutputRegister(), rsp); | 944 __ movq(i.OutputRegister(), rsp); |
943 break; | 945 break; |
944 case kArchFramePointer: | 946 case kArchFramePointer: |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2414 cases[index] = GetLabel(i.InputRpo(index + 2)); | 2416 cases[index] = GetLabel(i.InputRpo(index + 2)); |
2415 } | 2417 } |
2416 Label* const table = AddJumpTable(cases, case_count); | 2418 Label* const table = AddJumpTable(cases, case_count); |
2417 __ cmpl(input, Immediate(case_count)); | 2419 __ cmpl(input, Immediate(case_count)); |
2418 __ j(above_equal, GetLabel(i.InputRpo(1))); | 2420 __ j(above_equal, GetLabel(i.InputRpo(1))); |
2419 __ leaq(kScratchRegister, Operand(table)); | 2421 __ leaq(kScratchRegister, Operand(table)); |
2420 __ jmp(Operand(kScratchRegister, input, times_8, 0)); | 2422 __ jmp(Operand(kScratchRegister, input, times_8, 0)); |
2421 } | 2423 } |
2422 | 2424 |
2423 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2425 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
2424 int deoptimization_id, SourcePosition pos) { | 2426 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
2425 DeoptimizeKind deoptimization_kind = GetDeoptimizationKind(deoptimization_id); | 2427 SourcePosition pos) { |
2426 DeoptimizeReason deoptimization_reason = | |
2427 GetDeoptimizationReason(deoptimization_id); | |
2428 Deoptimizer::BailoutType bailout_type = | |
2429 deoptimization_kind == DeoptimizeKind::kSoft ? Deoptimizer::SOFT | |
2430 : Deoptimizer::EAGER; | |
2431 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2428 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
2432 isolate(), deoptimization_id, bailout_type); | 2429 isolate(), deoptimization_id, bailout_type); |
2433 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2430 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
| 2431 DeoptimizeReason deoptimization_reason = |
| 2432 GetDeoptimizationReason(deoptimization_id); |
2434 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 2433 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); |
2435 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2434 __ call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
2436 return kSuccess; | 2435 return kSuccess; |
2437 } | 2436 } |
2438 | 2437 |
2439 | 2438 |
2440 namespace { | 2439 namespace { |
2441 | 2440 |
2442 static const int kQuadWordSize = 16; | 2441 static const int kQuadWordSize = 16; |
2443 | 2442 |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2855 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; | 2854 int padding_size = last_lazy_deopt_pc_ + space_needed - current_pc; |
2856 __ Nop(padding_size); | 2855 __ Nop(padding_size); |
2857 } | 2856 } |
2858 } | 2857 } |
2859 | 2858 |
2860 #undef __ | 2859 #undef __ |
2861 | 2860 |
2862 } // namespace compiler | 2861 } // namespace compiler |
2863 } // namespace internal | 2862 } // namespace internal |
2864 } // namespace v8 | 2863 } // namespace v8 |
OLD | NEW |