Commit ca727047 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[turbofan] Allow deopt reasons without source positions.

This allows to pass deoptimization reasons to the profiler without the
requirement of always providing a source position. The absence of deopt
reasons is now communicated via a sentinel as the deopt id value. The
deoptimization reasons recently added to TurboFan are now passed to the
profiler.

R=bmeurer@chromium.org
TEST=cctest/test-cpu-profiler

Review-Url: https://codereview.chromium.org/2159793002
Cr-Commit-Position: refs/heads/master@{#37852}
parent ee48d322
......@@ -2739,7 +2739,7 @@ DeoptimizedFrameInfo::DeoptimizedFrameInfo(TranslatedState* state,
Deoptimizer::DeoptInfo Deoptimizer::GetDeoptInfo(Code* code, Address pc) {
SourcePosition last_position = SourcePosition::Unknown();
DeoptimizeReason last_reason = DeoptimizeReason::kNoReason;
int last_deopt_id = Deoptimizer::DeoptInfo::kNoDeoptId;
int last_deopt_id = kNoDeoptimizationId;
int mask = RelocInfo::ModeMask(RelocInfo::DEOPT_REASON) |
RelocInfo::ModeMask(RelocInfo::DEOPT_ID) |
RelocInfo::ModeMask(RelocInfo::DEOPT_POSITION);
......
......@@ -296,6 +296,9 @@ inline LanguageMode construct_language_mode(bool strict_bit) {
// This constant is used as an undefined value when passing source positions.
const int kNoSourcePosition = -1;
// This constant is used to indicate missing deoptimization information.
const int kNoDeoptimizationId = -1;
// Mask for the sign bit in a smi.
const intptr_t kSmiSignMask = kIntptrSignBit;
......
......@@ -26,6 +26,7 @@ CodeEntry::CodeEntry(CodeEventListener::LogEventsAndTags tag, const char* name,
bailout_reason_(kEmptyBailoutReason),
deopt_reason_(kNoDeoptReason),
deopt_position_(SourcePosition::Unknown()),
deopt_id_(kNoDeoptimizationId),
line_info_(line_info),
instruction_start_(instruction_start) {}
......
......@@ -179,7 +179,7 @@ CpuProfileDeoptInfo CodeEntry::GetDeoptInfo() {
CpuProfileDeoptInfo info;
info.deopt_reason = deopt_reason_;
DCHECK_NE(Deoptimizer::DeoptInfo::kNoDeoptId, deopt_id_);
DCHECK_NE(kNoDeoptimizationId, deopt_id_);
if (deopt_inlined_frames_.find(deopt_id_) == deopt_inlined_frames_.end()) {
info.stack.push_back(CpuProfileDeoptFrame(
{script_id_, position_ + deopt_position_.position()}));
......
......@@ -73,18 +73,17 @@ class CodeEntry {
void set_deopt_info(const char* deopt_reason, SourcePosition position,
int deopt_id) {
DCHECK(deopt_position_.IsUnknown());
DCHECK(!has_deopt_info());
deopt_reason_ = deopt_reason;
deopt_position_ = position;
deopt_id_ = deopt_id;
}
CpuProfileDeoptInfo GetDeoptInfo();
const char* deopt_reason() const { return deopt_reason_; }
SourcePosition deopt_position() const { return deopt_position_; }
bool has_deopt_info() const { return !deopt_position_.IsUnknown(); }
bool has_deopt_info() const { return deopt_id_ != kNoDeoptimizationId; }
void clear_deopt_info() {
deopt_reason_ = kNoDeoptReason;
deopt_position_ = SourcePosition::Unknown();
deopt_id_ = kNoDeoptimizationId;
}
void FillFunctionInfo(SharedFunctionInfo* shared);
......
......@@ -103,10 +103,8 @@
'test-heap/ObjectsInOptimizedCodeAreWeak': [PASS, NO_VARIANTS],
# TurboFan cpu profiler result is different.
'test-cpu-profiler/CollectDeoptEvents': [PASS, NO_VARIANTS],
'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [PASS, NO_VARIANTS],
'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [PASS, NO_VARIANTS],
'test-cpu-profiler/DeoptUntrackedFunction': [PASS, NO_VARIANTS],
############################################################################
# Slow tests.
......@@ -161,6 +159,10 @@
'test-heap/ResetSharedFunctionInfoCountersDuringIncrementalMarking': [PASS, NO_IGNITION],
'test-heap/ResetSharedFunctionInfoCountersDuringMarkSweep': [PASS, NO_IGNITION],
# BUG(4680): Missing type feedback makes optimistic optimizations fail.
'test-cpu-profiler/CollectDeoptEvents': [PASS, NO_IGNITION],
'test-cpu-profiler/DeoptUntrackedFunction': [PASS, NO_IGNITION],
# BUG(4680): Ignition doesn't support allocation sites currently.
'test-heap/EnsureAllocationSiteDependentCodesProcessed': [PASS, NO_IGNITION],
'test-heap/OptimizedPretenuringAllocationFolding': [PASS, NO_IGNITION],
......@@ -435,6 +437,10 @@
# TODO(mvstanton,4900): CHECK(!g_function->is_compiled());
'test-heap/TestUseOfIncrementalBarrierOnCompileLazy': [FAIL],
# BUG(4680): Missing type feedback makes optimistic optimizations fail.
'test-cpu-profiler/CollectDeoptEvents': [FAIL],
'test-cpu-profiler/DeoptUntrackedFunction': [FAIL],
# BUG(4680): Ignition doesn't support allocation sites currently.
'test-heap/EnsureAllocationSiteDependentCodesProcessed': [FAIL],
'test-heap/OptimizedPretenuringAllocationFolding': [FAIL],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment