Commit 053b3c44 authored by Francis McCabe's avatar Francis McCabe Committed by Commit Bot

Revert "[turboprop] Enable tierup to TurboFan with FLAG_turboprop"

This reverts commit e38cb757.

Reason for revert: Test failing: https://logs.chromium.org/logs/v8/buildbucket/cr-buildbucket.appspot.com/8858103866497469056/+/steps/Check/0/logs/tier-down-to-liftoff/0

Original change's description:
> [turboprop] Enable tierup to TurboFan with FLAG_turboprop
>
> FLAG_turboprop was used to test the turboprop compiler without any
> further tierup to TurboFan. This cl changes:
> - FLAG_turboprop to also tier up to TurboFan.
> - Introduces FLAG_turboprop_as_toptier to continue running the
>   configuration without tierup.
> - Removes FLAG_turboprop_as_midtier which is same as FLAG_turboprop.
>
> Bug: v8:9684
> Change-Id: I487bda13d226434837770ecc43b3ced7c31ccf19
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2622214
> Commit-Queue: Mythri Alle <mythria@chromium.org>
> Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
> Reviewed-by: Jakob Gruber <jgruber@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#72101}

TBR=rmcilroy@chromium.org,mythria@chromium.org,jgruber@chromium.org

Change-Id: Ic3e87c311fba001460e4f1561a2e5f74391a06a7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:9684
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2630526Reviewed-by: 's avatarFrancis McCabe <fgm@chromium.org>
Commit-Queue: Francis McCabe <fgm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#72102}
parent e38cb757
......@@ -1048,8 +1048,8 @@ Handle<Code> ContinuationForConcurrentOptimization(
// Tiering up to Turbofan and cached optimized code exists. Continue
// execution there until TF optimization has finished.
return cached_code;
} else if (FLAG_turboprop && function->HasAvailableOptimizedCode()) {
DCHECK(!FLAG_turboprop_as_toptier);
} else if (FLAG_turboprop_as_midtier &&
function->HasAvailableOptimizedCode()) {
DCHECK(function->NextTier() == CodeKind::TURBOFAN);
// It is possible that we have marked a closure for TurboFan optimization
// but the marker is processed by another closure that doesn't have
......
......@@ -178,6 +178,7 @@ void RuntimeProfiler::MaybeOptimizeFrame(JSFunction function,
// Note: We currently do not trigger OSR compilation from NCI or TP code.
// TODO(jgruber,v8:8888): But we should.
if (frame->is_interpreted()) {
DCHECK_EQ(code_kind, CodeKind::INTERPRETED_FUNCTION);
if (FLAG_always_osr) {
AttemptOnStackReplacement(InterpretedFrame::cast(frame),
AbstractCode::kMaxLoopNestingMarker);
......@@ -307,11 +308,8 @@ void RuntimeProfiler::MarkCandidatesForOptimization(JavaScriptFrame* frame) {
MarkCandidatesForOptimizationScope scope(this);
JSFunction function = frame->function();
CodeKind code_kind = function.GetActiveTier();
// For recursive functions it could happen that we have some frames
// still executing mid-tier code even after the function had higher tier code.
// In such cases, ignore any interrupts from the mid-tier code.
if (!CodeKindCanTierUp(code_kind)) return;
CodeKind code_kind = frame->is_interpreted() ? CodeKind::INTERPRETED_FUNCTION
: function.code().kind();
DCHECK(function.shared().is_compiled());
DCHECK(function.shared().IsInterpreted());
......
......@@ -554,10 +554,9 @@ DEFINE_BOOL(turboprop, false, "enable experimental turboprop mid-tier compiler")
DEFINE_IMPLICATION(turboprop, turbo_direct_heap_access)
DEFINE_BOOL(turboprop_mid_tier_reg_alloc, true,
"enable mid-tier register allocator for turboprop")
DEFINE_BOOL(
turboprop_as_toptier, false,
"enable experimental turboprop compiler without further tierup to turbofan")
DEFINE_IMPLICATION(turboprop_as_toptier, turboprop)
DEFINE_BOOL(turboprop_as_midtier, false,
"enable experimental turboprop mid-tier compiler")
DEFINE_IMPLICATION(turboprop_as_midtier, turboprop)
DEFINE_VALUE_IMPLICATION(turboprop, interrupt_budget, 15 * KB)
DEFINE_VALUE_IMPLICATION(turboprop, reuse_opt_code_count, 2)
DEFINE_UINT_READONLY(max_minimorphic_map_checks, 4,
......
......@@ -86,7 +86,7 @@ inline constexpr bool CodeKindCanOSR(CodeKind kind) {
inline constexpr bool CodeKindIsOptimizedAndCanTierUp(CodeKind kind) {
return kind == CodeKind::NATIVE_CONTEXT_INDEPENDENT ||
(!FLAG_turboprop_as_toptier && kind == CodeKind::TURBOPROP);
(FLAG_turboprop_as_midtier && kind == CodeKind::TURBOPROP);
}
inline constexpr bool CodeKindCanTierUp(CodeKind kind) {
......@@ -105,8 +105,8 @@ inline constexpr bool CodeKindIsStoredInOptimizedCodeCache(CodeKind kind) {
inline OptimizationTier GetTierForCodeKind(CodeKind kind) {
if (kind == CodeKind::TURBOFAN) return OptimizationTier::kTopTier;
if (kind == CodeKind::TURBOPROP) {
return FLAG_turboprop_as_toptier ? OptimizationTier::kTopTier
: OptimizationTier::kMidTier;
return FLAG_turboprop_as_midtier ? OptimizationTier::kMidTier
: OptimizationTier::kTopTier;
}
if (kind == CodeKind::NATIVE_CONTEXT_INDEPENDENT) {
return FLAG_turbo_nci_as_midtier ? OptimizationTier::kMidTier
......@@ -116,8 +116,12 @@ inline OptimizationTier GetTierForCodeKind(CodeKind kind) {
}
inline CodeKind CodeKindForTopTier() {
if (V8_UNLIKELY(FLAG_turboprop_as_toptier)) {
return CodeKind::TURBOPROP;
// TODO(turboprop, mythria): We should make FLAG_turboprop mean turboprop is
// mid-tier compiler and replace FLAG_turboprop_as_midtier with
// FLAG_turboprop_as_top_tier to tier up to only Turboprop once
// FLAG_turboprop_as_midtier is stable and major regressions are addressed.
if (V8_UNLIKELY(FLAG_turboprop)) {
return FLAG_turboprop_as_midtier ? CodeKind::TURBOFAN : CodeKind::TURBOPROP;
}
return CodeKind::TURBOFAN;
}
......
......@@ -52,12 +52,14 @@ CodeKinds JSFunction::GetAvailableCodeKinds() const {
}
}
// Check the optimized code cache.
if (has_feedback_vector() && feedback_vector().has_optimized_code() &&
!feedback_vector().optimized_code().marked_for_deoptimization()) {
Code code = feedback_vector().optimized_code();
DCHECK(CodeKindIsOptimizedJSFunction(code.kind()));
result |= CodeKindToCodeKindFlag(code.kind());
if ((result & kOptimizedJSFunctionCodeKindsMask) == 0) {
// Check the optimized code cache.
if (has_feedback_vector() && feedback_vector().has_optimized_code() &&
!feedback_vector().optimized_code().marked_for_deoptimization()) {
Code code = feedback_vector().optimized_code();
DCHECK(CodeKindIsOptimizedJSFunction(code.kind()));
result |= CodeKindToCodeKindFlag(code.kind());
}
}
DCHECK_EQ((result & ~kJSFunctionCodeKindsMask), 0);
......@@ -105,8 +107,9 @@ bool HighestTierOf(CodeKinds kinds, CodeKind* highest_tier) {
} // namespace
bool JSFunction::ActiveTierIsIgnition() const {
if (!shared().HasBytecodeArray()) return false;
bool result = (GetActiveTier() == CodeKind::INTERPRETED_FUNCTION);
CodeKind highest_tier;
if (!HighestTierOf(GetAvailableCodeKinds(), &highest_tier)) return false;
bool result = (highest_tier == CodeKind::INTERPRETED_FUNCTION);
DCHECK_IMPLIES(result,
code().is_interpreter_trampoline_builtin() ||
(CodeKindIsOptimizedJSFunction(code().kind()) &&
......@@ -116,37 +119,30 @@ bool JSFunction::ActiveTierIsIgnition() const {
return result;
}
CodeKind JSFunction::GetActiveTier() const {
CodeKind highest_tier;
DCHECK(shared().is_compiled());
HighestTierOf(GetAvailableCodeKinds(), &highest_tier);
DCHECK(highest_tier == CodeKind::TURBOFAN ||
highest_tier == CodeKind::TURBOPROP ||
highest_tier == CodeKind::NATIVE_CONTEXT_INDEPENDENT ||
highest_tier == CodeKind::INTERPRETED_FUNCTION);
return highest_tier;
}
bool JSFunction::ActiveTierIsTurbofan() const {
if (!shared().HasBytecodeArray()) return false;
return GetActiveTier() == CodeKind::TURBOFAN;
CodeKind highest_tier;
if (!HighestTierOf(GetAvailableCodeKinds(), &highest_tier)) return false;
return highest_tier == CodeKind::TURBOFAN;
}
bool JSFunction::ActiveTierIsNCI() const {
if (!shared().HasBytecodeArray()) return false;
return GetActiveTier() == CodeKind::NATIVE_CONTEXT_INDEPENDENT;
CodeKind highest_tier;
if (!HighestTierOf(GetAvailableCodeKinds(), &highest_tier)) return false;
return highest_tier == CodeKind::NATIVE_CONTEXT_INDEPENDENT;
}
bool JSFunction::ActiveTierIsToptierTurboprop() const {
if (!FLAG_turboprop_as_toptier) return false;
if (!shared().HasBytecodeArray()) return false;
return GetActiveTier() == CodeKind::TURBOPROP && FLAG_turboprop_as_toptier;
CodeKind highest_tier;
if (!FLAG_turboprop) return false;
if (!HighestTierOf(GetAvailableCodeKinds(), &highest_tier)) return false;
return highest_tier == CodeKind::TURBOPROP && !FLAG_turboprop_as_midtier;
}
bool JSFunction::ActiveTierIsMidtierTurboprop() const {
if (!FLAG_turboprop) return false;
if (!shared().HasBytecodeArray()) return false;
return GetActiveTier() == CodeKind::TURBOPROP && !FLAG_turboprop_as_toptier;
CodeKind highest_tier;
if (!FLAG_turboprop_as_midtier) return false;
if (!HighestTierOf(GetAvailableCodeKinds(), &highest_tier)) return false;
return highest_tier == CodeKind::TURBOPROP && FLAG_turboprop_as_midtier;
}
CodeKind JSFunction::NextTier() const {
......
......@@ -114,7 +114,6 @@ class JSFunction : public JSFunctionOrBoundFunction {
bool HasAvailableCodeKind(CodeKind kind) const;
CodeKind GetActiveTier() const;
V8_EXPORT_PRIVATE bool ActiveTierIsIgnition() const;
bool ActiveTierIsTurbofan() const;
bool ActiveTierIsNCI() const;
......
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