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