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