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 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 break; | 982 break; |
983 case kArchNop: | 983 case kArchNop: |
984 case kArchThrowTerminator: | 984 case kArchThrowTerminator: |
985 // don't emit code for nops. | 985 // don't emit code for nops. |
986 break; | 986 break; |
987 case kArchDeoptimize: { | 987 case kArchDeoptimize: { |
988 int deopt_state_id = | 988 int deopt_state_id = |
989 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); | 989 BuildTranslation(instr, -1, 0, OutputFrameStateCombine::Ignore()); |
990 Deoptimizer::BailoutType bailout_type = | 990 Deoptimizer::BailoutType bailout_type = |
991 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); | 991 Deoptimizer::BailoutType(MiscField::decode(instr->opcode())); |
992 CodeGenResult result = | 992 CodeGenResult result = AssembleDeoptimizerCall( |
993 AssembleDeoptimizerCall(deopt_state_id, bailout_type); | 993 deopt_state_id, bailout_type, current_source_position_); |
994 if (result != kSuccess) return result; | 994 if (result != kSuccess) return result; |
995 break; | 995 break; |
996 } | 996 } |
997 case kArchRet: | 997 case kArchRet: |
998 AssembleReturn(); | 998 AssembleReturn(); |
999 break; | 999 break; |
1000 case kArchStackPointer: | 1000 case kArchStackPointer: |
1001 __ LoadRR(i.OutputRegister(), sp); | 1001 __ LoadRR(i.OutputRegister(), sp); |
1002 break; | 1002 break; |
1003 case kArchFramePointer: | 1003 case kArchFramePointer: |
(...skipping 1181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2185 Label* const table = AddJumpTable(cases, case_count); | 2185 Label* const table = AddJumpTable(cases, case_count); |
2186 __ CmpLogicalP(input, Operand(case_count)); | 2186 __ CmpLogicalP(input, Operand(case_count)); |
2187 __ bge(GetLabel(i.InputRpo(1))); | 2187 __ bge(GetLabel(i.InputRpo(1))); |
2188 __ larl(kScratchReg, table); | 2188 __ larl(kScratchReg, table); |
2189 __ ShiftLeftP(r1, input, Operand(kPointerSizeLog2)); | 2189 __ ShiftLeftP(r1, input, Operand(kPointerSizeLog2)); |
2190 __ LoadP(kScratchReg, MemOperand(kScratchReg, r1)); | 2190 __ LoadP(kScratchReg, MemOperand(kScratchReg, r1)); |
2191 __ Jump(kScratchReg); | 2191 __ Jump(kScratchReg); |
2192 } | 2192 } |
2193 | 2193 |
2194 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( | 2194 CodeGenerator::CodeGenResult CodeGenerator::AssembleDeoptimizerCall( |
2195 int deoptimization_id, Deoptimizer::BailoutType bailout_type) { | 2195 int deoptimization_id, Deoptimizer::BailoutType bailout_type, |
| 2196 SourcePosition pos) { |
2196 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( | 2197 Address deopt_entry = Deoptimizer::GetDeoptimizationEntry( |
2197 isolate(), deoptimization_id, bailout_type); | 2198 isolate(), deoptimization_id, bailout_type); |
2198 // TODO(turbofan): We should be able to generate better code by sharing the | 2199 // TODO(turbofan): We should be able to generate better code by sharing the |
2199 // actual final call site and just bl'ing to it here, similar to what we do | 2200 // actual final call site and just bl'ing to it here, similar to what we do |
2200 // in the lithium backend. | 2201 // in the lithium backend. |
2201 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; | 2202 if (deopt_entry == nullptr) return kTooManyDeoptimizationBailouts; |
2202 DeoptimizeReason deoptimization_reason = | 2203 DeoptimizeReason deoptimization_reason = |
2203 GetDeoptimizationReason(deoptimization_id); | 2204 GetDeoptimizationReason(deoptimization_id); |
2204 __ RecordDeoptReason(deoptimization_reason, 0, deoptimization_id); | 2205 __ RecordDeoptReason(deoptimization_reason, pos.raw(), deoptimization_id); |
2205 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); | 2206 __ Call(deopt_entry, RelocInfo::RUNTIME_ENTRY); |
2206 return kSuccess; | 2207 return kSuccess; |
2207 } | 2208 } |
2208 | 2209 |
2209 void CodeGenerator::FinishFrame(Frame* frame) { | 2210 void CodeGenerator::FinishFrame(Frame* frame) { |
2210 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); | 2211 CallDescriptor* descriptor = linkage()->GetIncomingDescriptor(); |
2211 const RegList double_saves = descriptor->CalleeSavedFPRegisters(); | 2212 const RegList double_saves = descriptor->CalleeSavedFPRegisters(); |
2212 | 2213 |
2213 // Save callee-saved Double registers. | 2214 // Save callee-saved Double registers. |
2214 if (double_saves != 0) { | 2215 if (double_saves != 0) { |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2544 padding_size -= 2; | 2545 padding_size -= 2; |
2545 } | 2546 } |
2546 } | 2547 } |
2547 } | 2548 } |
2548 | 2549 |
2549 #undef __ | 2550 #undef __ |
2550 | 2551 |
2551 } // namespace compiler | 2552 } // namespace compiler |
2552 } // namespace internal | 2553 } // namespace internal |
2553 } // namespace v8 | 2554 } // namespace v8 |
OLD | NEW |