OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 1144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1155 case kArchDebugBreak: | 1155 case kArchDebugBreak: |
1156 __ stop("kArchDebugBreak"); | 1156 __ stop("kArchDebugBreak"); |
1157 break; | 1157 break; |
1158 case kArchNop: | 1158 case kArchNop: |
1159 case kArchThrowTerminator: | 1159 case kArchThrowTerminator: |
1160 // don't emit code for nops. | 1160 // don't emit code for nops. |
1161 break; | 1161 break; |
1162 case kArchDeoptimize: { | 1162 case kArchDeoptimize: { |
1163 int deopt_state_id = | 1163 int deopt_state_id = |
1164 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 1164 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
1165 CodeGenResult result = | 1165 Deoptimizer::BailoutType bailout_type = |
1166 AssembleDeoptimizerCall(deopt_state_id, current_source_position_); | 1166 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
| 1167 CodeGenResult result = AssembleDeoptimizerCall( |
| 1168 deopt_state_id, bailout_type, current_source_position_); |
1167 if (result != kSuccess) return result; | 1169 if (result != kSuccess) return result; |
1168 break; | 1170 break; |
1169 } | 1171 } |
1170 case kArchRet: | 1172 case kArchRet: |
1171 AssembleReturn(instr->InputAt(0)); | 1173 AssembleReturn(instr->InputAt(0)); |
1172 break; | 1174 break; |
1173 case kArchStackPointer: | 1175 case kArchStackPointer: |
1174 __ LoadRR(i.OutputRegister(), sp); | 1176 __ LoadRR(i.OutputRegister(), sp); |
1175 break; | 1177 break; |
1176 case kArchFramePointer: | 1178 case kArchFramePointer: |
(...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2384 Label* const table = AddJumpTable(cases, case_count); | 2386 Label* const table = AddJumpTable(cases, case_count); |
2385 __ CmpLogicalP(input, Operand(case_count)); | 2387 __ CmpLogicalP(input, Operand(case_count)); |
2386 __ bge(GetLabel(i.InputRpo(1))); | 2388 __ bge(GetLabel(i.InputRpo(1))); |
2387 __ larl(kScratchReg, table); | 2389 __ larl(kScratchReg, table); |
2388 __ ShiftLeftP(r1, input, Operand(kPointerSizeLog2)); | 2390 __ ShiftLeftP(r1, input, Operand(kPointerSizeLog2)); |
2389 __ LoadP(kScratchReg, MemOperand(kScratchReg, r1)); | 2391 __ LoadP(kScratchReg, MemOperand(kScratchReg, r1)); |
2390 __ Jump(kScratchReg); | 2392 __ Jump(kScratchReg); |
2391 } | 2393 } |
2392 | 2394 |
2393 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2395 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
2394 int deoptimization_id, SourcePosition pos) { | 2396 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
2395 DeoptimizeKind deoptimization_kind = GetDeoptimizationKind(deoptimization_id); | 2397 SourcePosition pos) { |
2396 DeoptimizeReason deoptimization_reason = | |
2397 GetDeoptimizationReason(deoptimization_id); | |
2398 Deoptimizer::BailoutType bailout_type = | |
2399 deoptimization_kind == DeoptimizeKind::kSoft ? Deoptimizer::SOFT | |
2400 : Deoptimizer::EAGER; | |
2401 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2398 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
2402 isolate(), deoptimization_id, bailout_type); | 2399 isolate(), deoptimization_id, bailout_type); |
2403 // TODO(turbofan): We should be able to generate better code by sharing the | 2400 // TODO(turbofan): We should be able to generate better code by sharing the |
2404 // actual final call site and just bl'ing to it here, similar to what we do | 2401 // actual final call site and just bl'ing to it here, similar to what we do |
2405 // in the lithium backend. | 2402 // in the lithium backend. |
2406 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2403 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
| 2404 DeoptimizeReason deoptimization_reason = |
| 2405 GetDeoptimizationReason(deoptimization_id); |
2407 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 2406 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); |
2408 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2407 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
2409 return kSuccess; | 2408 return kSuccess; |
2410 } | 2409 } |
2411 | 2410 |
2412 void CodeGenerator::FinishFrame(Frame* frame) { | 2411 void CodeGenerator::FinishFrame(Frame* frame) { |
2413 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2412 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
2414 const RegList double_saves = descriptor->CalleeSavedFPRegisters(); | 2413 const RegList double_saves = descriptor->CalleeSavedFPRegisters(); |
2415 | 2414 |
2416 // Save callee-saved Double registers. | 2415 // Save callee-saved Double registers. |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2758 padding_size -= 2; | 2757 padding_size -= 2; |
2759 } | 2758 } |
2760 } | 2759 } |
2761 } | 2760 } |
2762 | 2761 |
2763 #undef __ | 2762 #undef __ |
2764 | 2763 |
2765 } // namespace compiler | 2764 } // namespace compiler |
2766 } // namespace internal | 2765 } // namespace internal |
2767 } // namespace v8 | 2766 } // namespace v8 |
OLD | NEW |