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 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 case kArchNop: | 1080 case kArchNop: |
1081 case kArchThrowTerminator: | 1081 case kArchThrowTerminator: |
1082 // don't emit code for nops. | 1082 // don't emit code for nops. |
1083 DCHECK_EQ(LeaveRC, i.OutputRCBit()); | 1083 DCHECK_EQ(LeaveRC, i.OutputRCBit()); |
1084 break; | 1084 break; |
1085 case kArchDeoptimize: { | 1085 case kArchDeoptimize: { |
1086 int deopt_state_id = | 1086 int deopt_state_id = |
1087 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 1087 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
1088 Deoptimizer::BailoutType bailout_type = | 1088 Deoptimizer::BailoutType bailout_type = |
1089 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 1089 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
1090 CodeGenResult result = | 1090 CodeGenResult result = AssembleDeoptimizerCall( |
1091 AssembleDeoptimizerCall(deopt_state_id, bailout_type); | 1091 deopt_state_id, bailout_type, current_source_position_); |
1092 if (result != kSuccess) return result; | 1092 if (result != kSuccess) return result; |
1093 break; | 1093 break; |
1094 } | 1094 } |
1095 case kArchRet: | 1095 case kArchRet: |
1096 AssembleReturn(); | 1096 AssembleReturn(); |
1097 DCHECK_EQ(LeaveRC, i.OutputRCBit()); | 1097 DCHECK_EQ(LeaveRC, i.OutputRCBit()); |
1098 break; | 1098 break; |
1099 case kArchStackPointer: | 1099 case kArchStackPointer: |
1100 __ mr(i.OutputRegister(), sp); | 1100 __ mr(i.OutputRegister(), sp); |
1101 DCHECK_EQ(LeaveRC, i.OutputRCBit()); | 1101 DCHECK_EQ(LeaveRC, i.OutputRCBit()); |
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 Label* const table = AddJumpTable(cases, case_count); | 2061 Label* const table = AddJumpTable(cases, case_count); |
2062 __ Cmpli(input, Operand(case_count), r0); | 2062 __ Cmpli(input, Operand(case_count), r0); |
2063 __ bge(GetLabel(i.InputRpo(1))); | 2063 __ bge(GetLabel(i.InputRpo(1))); |
2064 __ mov_label_addr(kScratchReg, table); | 2064 __ mov_label_addr(kScratchReg, table); |
2065 __ ShiftLeftImm(r0, input, Operand(kPointerSizeLog2)); | 2065 __ ShiftLeftImm(r0, input, Operand(kPointerSizeLog2)); |
2066 __ LoadPX(kScratchReg, MemOperand(kScratchReg, r0)); | 2066 __ LoadPX(kScratchReg, MemOperand(kScratchReg, r0)); |
2067 __ Jump(kScratchReg); | 2067 __ Jump(kScratchReg); |
2068 } | 2068 } |
2069 | 2069 |
2070 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2070 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
2071 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { | 2071 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
| 2072 SourcePosition pos) { |
2072 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2073 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
2073 isolate(), deoptimization_id, bailout_type); | 2074 isolate(), deoptimization_id, bailout_type); |
2074 // TODO(turbofan): We should be able to generate better code by sharing the | 2075 // TODO(turbofan): We should be able to generate better code by sharing the |
2075 // actual final call site and just bl'ing to it here, similar to what we do | 2076 // actual final call site and just bl'ing to it here, similar to what we do |
2076 // in the lithium backend. | 2077 // in the lithium backend. |
2077 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2078 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
2078 DeoptimizeReason deoptimization_reason = | 2079 DeoptimizeReason deoptimization_reason = |
2079 GetDeoptimizationReason(deoptimization_id); | 2080 GetDeoptimizationReason(deoptimization_id); |
2080 __ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id); | 2081 __ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id); |
2081 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2082 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
2082 return kSuccess; | 2083 return kSuccess; |
2083 } | 2084 } |
2084 | 2085 |
2085 void CodeGenerator::FinishFrame(Frame* frame) { | 2086 void CodeGenerator::FinishFrame(Frame* frame) { |
2086 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2087 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
2087 const RegList double_saves = descriptor->CalleeSavedFPRegisters(); | 2088 const RegList double_saves = descriptor->CalleeSavedFPRegisters(); |
2088 | 2089 |
2089 // Save callee-saved Double registers. | 2090 // Save callee-saved Double registers. |
2090 if (double_saves != 0) { | 2091 if (double_saves != 0) { |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2439 padding_size -= v8::internal::Assembler::kInstrSize; | 2440 padding_size -= v8::internal::Assembler::kInstrSize; |
2440 } | 2441 } |
2441 } | 2442 } |
2442 } | 2443 } |
2443 | 2444 |
2444 #undef __ | 2445 #undef __ |
2445 | 2446 |
2446 } // namespace compiler | 2447 } // namespace compiler |
2447 } // namespace internal | 2448 } // namespace internal |
2448 } // namespace v8 | 2449 } // namespace v8 |
OLD | NEW |