OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/crankshaft/lithium-codegen.h" | 5 #include "src/crankshaft/lithium-codegen.h" |
6 | 6 |
7 #include <sstream> | 7 #include <sstream> |
8 | 8 |
9 #if V8_TARGET_ARCH_IA32 | 9 #if V8_TARGET_ARCH_IA32 |
10 #include "src/crankshaft/ia32/lithium-ia32.h" // NOLINT | 10 #include "src/crankshaft/ia32/lithium-ia32.h" // NOLINT |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 // issues when the stack allocated buffer goes out of scope. | 151 // issues when the stack allocated buffer goes out of scope. |
152 size_t length = builder.position(); | 152 size_t length = builder.position(); |
153 Vector<char> copy = Vector<char>::New(static_cast<int>(length) + 1); | 153 Vector<char> copy = Vector<char>::New(static_cast<int>(length) + 1); |
154 MemCopy(copy.start(), builder.Finalize(), copy.length()); | 154 MemCopy(copy.start(), builder.Finalize(), copy.length()); |
155 masm()->RecordComment(copy.start()); | 155 masm()->RecordComment(copy.start()); |
156 } | 156 } |
157 | 157 |
158 | 158 |
159 void LCodeGenBase::DeoptComment(const Deoptimizer::DeoptInfo& deopt_info) { | 159 void LCodeGenBase::DeoptComment(const Deoptimizer::DeoptInfo& deopt_info) { |
160 SourcePosition position = deopt_info.position; | 160 SourcePosition position = deopt_info.position; |
| 161 int inlining_id = deopt_info.inlining_id; |
161 int raw_position = position.IsUnknown() ? 0 : position.raw(); | 162 int raw_position = position.IsUnknown() ? 0 : position.raw(); |
162 masm()->RecordDeoptReason(deopt_info.deopt_reason, raw_position); | 163 masm()->RecordDeoptReason(deopt_info.deopt_reason, raw_position, inlining_id); |
163 } | 164 } |
164 | 165 |
165 | 166 |
166 int LCodeGenBase::GetNextEmittedBlock() const { | 167 int LCodeGenBase::GetNextEmittedBlock() const { |
167 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { | 168 for (int i = current_block_ + 1; i < graph()->blocks()->length(); ++i) { |
168 if (!graph()->blocks()->at(i)->IsReachable()) continue; | 169 if (!graph()->blocks()->at(i)->IsReachable()) continue; |
169 if (!chunk_->GetLabel(i)->HasReplacement()) return i; | 170 if (!chunk_->GetLabel(i)->HasReplacement()) return i; |
170 } | 171 } |
171 return -1; | 172 return -1; |
172 } | 173 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 inlined_function_count_ = deoptimization_literals_.length(); | 358 inlined_function_count_ = deoptimization_literals_.length(); |
358 | 359 |
359 // Define deoptimization literals for all unoptimized code objects of inlined | 360 // Define deoptimization literals for all unoptimized code objects of inlined |
360 // functions. This ensures unoptimized code is kept alive by optimized code. | 361 // functions. This ensures unoptimized code is kept alive by optimized code. |
361 AllowDeferredHandleDereference allow_shared_function_info_dereference; | 362 AllowDeferredHandleDereference allow_shared_function_info_dereference; |
362 for (Handle<SharedFunctionInfo> function : chunk()->inlined_functions()) { | 363 for (Handle<SharedFunctionInfo> function : chunk()->inlined_functions()) { |
363 DefineDeoptimizationLiteral(handle(function->code())); | 364 DefineDeoptimizationLiteral(handle(function->code())); |
364 } | 365 } |
365 } | 366 } |
366 | 367 |
367 void LCodeGenBase::LogDeoptCallPosition(int pc_offset, int inlining_id) { | |
368 if (!info()->is_tracking_positions() || info()->IsStub()) return; | |
369 auto& inlined_function_infos = info()->inlined_function_infos(); | |
370 DCHECK_LT(static_cast<size_t>(inlining_id), inlined_function_infos.size()); | |
371 inlined_function_infos.at(inlining_id).deopt_pc_offsets.push_back(pc_offset); | |
372 } | |
373 | |
374 Deoptimizer::DeoptInfo LCodeGenBase::MakeDeoptInfo( | 368 Deoptimizer::DeoptInfo LCodeGenBase::MakeDeoptInfo( |
375 LInstruction* instr, Deoptimizer::DeoptReason deopt_reason) { | 369 LInstruction* instr, Deoptimizer::DeoptReason deopt_reason) { |
| 370 HEnterInlined* enter_inlined = instr->environment()->entry(); |
| 371 int inlining_id = enter_inlined ? enter_inlined->inlining_id() : 0; |
376 Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(), | 372 Deoptimizer::DeoptInfo deopt_info(instr->hydrogen_value()->position(), |
377 deopt_reason); | 373 deopt_reason, inlining_id); |
378 HEnterInlined* enter_inlined = instr->environment()->entry(); | |
379 deopt_info.inlining_id = enter_inlined ? enter_inlined->inlining_id() : 0; | |
380 return deopt_info; | 374 return deopt_info; |
381 } | 375 } |
382 } // namespace internal | 376 } // namespace internal |
383 } // namespace v8 | 377 } // namespace v8 |
OLD | NEW |