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 | 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 1064 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1075 __ stop("kArchDebugBreak"); | 1075 __ stop("kArchDebugBreak"); |
1076 break; | 1076 break; |
1077 case kArchNop: | 1077 case kArchNop: |
1078 case kArchThrowTerminator: | 1078 case kArchThrowTerminator: |
1079 // don't emit code for nops. | 1079 // don't emit code for nops. |
1080 DCHECK_EQ(LeaveRC, i.OutputRCBit()); | 1080 DCHECK_EQ(LeaveRC, i.OutputRCBit()); |
1081 break; | 1081 break; |
1082 case kArchDeoptimize: { | 1082 case kArchDeoptimize: { |
1083 int deopt_state_id = | 1083 int deopt_state_id = |
1084 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 1084 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
1085 CodeGenResult result = | 1085 Deoptimizer::BailoutType bailout_type = |
1086 AssembleDeoptimizerCall(deopt_state_id, current_source_position_); | 1086 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
| 1087 CodeGenResult result = AssembleDeoptimizerCall( |
| 1088 deopt_state_id, bailout_type, current_source_position_); |
1087 if (result != kSuccess) return result; | 1089 if (result != kSuccess) return result; |
1088 break; | 1090 break; |
1089 } | 1091 } |
1090 case kArchRet: | 1092 case kArchRet: |
1091 AssembleReturn(instr->InputAt(0)); | 1093 AssembleReturn(instr->InputAt(0)); |
1092 DCHECK_EQ(LeaveRC, i.OutputRCBit()); | 1094 DCHECK_EQ(LeaveRC, i.OutputRCBit()); |
1093 break; | 1095 break; |
1094 case kArchStackPointer: | 1096 case kArchStackPointer: |
1095 __ mr(i.OutputRegister(), sp); | 1097 __ mr(i.OutputRegister(), sp); |
1096 DCHECK_EQ(LeaveRC, i.OutputRCBit()); | 1098 DCHECK_EQ(LeaveRC, i.OutputRCBit()); |
(...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 Label* const table = AddJumpTable(cases, case_count); | 2173 Label* const table = AddJumpTable(cases, case_count); |
2172 __ Cmpli(input, Operand(case_count), r0); | 2174 __ Cmpli(input, Operand(case_count), r0); |
2173 __ bge(GetLabel(i.InputRpo(1))); | 2175 __ bge(GetLabel(i.InputRpo(1))); |
2174 __ mov_label_addr(kScratchReg, table); | 2176 __ mov_label_addr(kScratchReg, table); |
2175 __ ShiftLeftImm(r0, input, Operand(kPointerSizeLog2)); | 2177 __ ShiftLeftImm(r0, input, Operand(kPointerSizeLog2)); |
2176 __ LoadPX(kScratchReg, MemOperand(kScratchReg, r0)); | 2178 __ LoadPX(kScratchReg, MemOperand(kScratchReg, r0)); |
2177 __ Jump(kScratchReg); | 2179 __ Jump(kScratchReg); |
2178 } | 2180 } |
2179 | 2181 |
2180 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2182 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
2181 int deoptimization_id, SourcePosition pos) { | 2183 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
2182 DeoptimizeKind deoptimization_kind = GetDeoptimizationKind(deoptimization_id); | 2184 SourcePosition pos) { |
2183 DeoptimizeReason deoptimization_reason = | |
2184 GetDeoptimizationReason(deoptimization_id); | |
2185 Deoptimizer::BailoutType bailout_type = | |
2186 deoptimization_kind == DeoptimizeKind::kSoft ? Deoptimizer::SOFT | |
2187 : Deoptimizer::EAGER; | |
2188 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2185 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
2189 isolate(), deoptimization_id, bailout_type); | 2186 isolate(), deoptimization_id, bailout_type); |
2190 // TODO(turbofan): We should be able to generate better code by sharing the | 2187 // TODO(turbofan): We should be able to generate better code by sharing the |
2191 // actual final call site and just bl'ing to it here, similar to what we do | 2188 // actual final call site and just bl'ing to it here, similar to what we do |
2192 // in the lithium backend. | 2189 // in the lithium backend. |
2193 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2190 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
| 2191 DeoptimizeReason deoptimization_reason = |
| 2192 GetDeoptimizationReason(deoptimization_id); |
2194 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); | 2193 __ RecordDeoptReason(deoptimization_reason, pos, deoptimization_id); |
2195 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2194 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
2196 return kSuccess; | 2195 return kSuccess; |
2197 } | 2196 } |
2198 | 2197 |
2199 void CodeGenerator::FinishFrame(Frame* frame) { | 2198 void CodeGenerator::FinishFrame(Frame* frame) { |
2200 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2199 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
2201 const RegList double_saves = descriptor->CalleeSavedFPRegisters(); | 2200 const RegList double_saves = descriptor->CalleeSavedFPRegisters(); |
2202 | 2201 |
2203 // Save callee-saved Double registers. | 2202 // Save callee-saved Double registers. |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2578 padding_size -= v8::internal::Assembler::kInstrSize; | 2577 padding_size -= v8::internal::Assembler::kInstrSize; |
2579 } | 2578 } |
2580 } | 2579 } |
2581 } | 2580 } |
2582 | 2581 |
2583 #undef __ | 2582 #undef __ |
2584 | 2583 |
2585 } // namespace compiler | 2584 } // namespace compiler |
2586 } // namespace internal | 2585 } // namespace internal |
2587 } // namespace v8 | 2586 } // namespace v8 |
OLD | NEW |