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( ...@@ -1048,8 +1048,8 @@ Handle<Code> ContinuationForConcurrentOptimization(
// Tiering up to Turbofan and cached optimized code exists. Continue // Tiering up to Turbofan and cached optimized code exists. Continue
// execution there until TF optimization has finished. // execution there until TF optimization has finished.
return cached_code; return cached_code;
} else if (FLAG_turboprop && function->HasAvailableOptimizedCode()) { } else if (FLAG_turboprop_as_midtier &&
DCHECK(!FLAG_turboprop_as_toptier); function->HasAvailableOptimizedCode()) {
DCHECK(function->NextTier() == CodeKind::TURBOFAN); DCHECK(function->NextTier() == CodeKind::TURBOFAN);
// It is possible that we have marked a closure for TurboFan optimization // It is possible that we have marked a closure for TurboFan optimization
// but the marker is processed by another closure that doesn't have // but the marker is processed by another closure that doesn't have
......
...@@ -178,6 +178,7 @@ void RuntimeProfiler::MaybeOptimizeFrame(JSFunction function, ...@@ -178,6 +178,7 @@ void RuntimeProfiler::MaybeOptimizeFrame(JSFunction function,
// Note: We currently do not trigger OSR compilation from NCI or TP code. // Note: We currently do not trigger OSR compilation from NCI or TP code.
// TODO(jgruber,v8:8888): But we should. // TODO(jgruber,v8:8888): But we should.
if (frame->is_interpreted()) { if (frame->is_interpreted()) {
DCHECK_EQ(code_kind, CodeKind::INTERPRETED_FUNCTION);
if (FLAG_always_osr) { if (FLAG_always_osr) {
AttemptOnStackReplacement(InterpretedFrame::cast(frame), AttemptOnStackReplacement(InterpretedFrame::cast(frame),
AbstractCode::kMaxLoopNestingMarker); AbstractCode::kMaxLoopNestingMarker);
...@@ -307,11 +308,8 @@ void RuntimeProfiler::MarkCandidatesForOptimization(JavaScriptFrame* frame) { ...@@ -307,11 +308,8 @@ void RuntimeProfiler::MarkCandidatesForOptimization(JavaScriptFrame* frame) {
MarkCandidatesForOptimizationScope scope(this); MarkCandidatesForOptimizationScope scope(this);
JSFunction function = frame->function(); JSFunction function = frame->function();
CodeKind code_kind = function.GetActiveTier(); CodeKind code_kind = frame->is_interpreted() ? CodeKind::INTERPRETED_FUNCTION
// For recursive functions it could happen that we have some frames : function.code().kind();
// 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;
DCHECK(function.shared().is_compiled()); DCHECK(function.shared().is_compiled());
DCHECK(function.shared().IsInterpreted()); DCHECK(function.shared().IsInterpreted());
......
...@@ -554,10 +554,9 @@ DEFINE_BOOL(turboprop, false, "enable experimental turboprop mid-tier compiler") ...@@ -554,10 +554,9 @@ DEFINE_BOOL(turboprop, false, "enable experimental turboprop mid-tier compiler")
DEFINE_IMPLICATION(turboprop, turbo_direct_heap_access) DEFINE_IMPLICATION(turboprop, turbo_direct_heap_access)
DEFINE_BOOL(turboprop_mid_tier_reg_alloc, true, DEFINE_BOOL(turboprop_mid_tier_reg_alloc, true,
"enable mid-tier register allocator for turboprop") "enable mid-tier register allocator for turboprop")
DEFINE_BOOL( DEFINE_BOOL(turboprop_as_midtier, false,
turboprop_as_toptier, false, "enable experimental turboprop mid-tier compiler")
"enable experimental turboprop compiler without further tierup to turbofan") DEFINE_IMPLICATION(turboprop_as_midtier, turboprop)
DEFINE_IMPLICATION(turboprop_as_toptier, turboprop)
DEFINE_VALUE_IMPLICATION(turboprop, interrupt_budget, 15 * KB) DEFINE_VALUE_IMPLICATION(turboprop, interrupt_budget, 15 * KB)
DEFINE_VALUE_IMPLICATION(turboprop, reuse_opt_code_count, 2) DEFINE_VALUE_IMPLICATION(turboprop, reuse_opt_code_count, 2)
DEFINE_UINT_READONLY(max_minimorphic_map_checks, 4, DEFINE_UINT_READONLY(max_minimorphic_map_checks, 4,
......
...@@ -86,7 +86,7 @@ inline constexpr bool CodeKindCanOSR(CodeKind kind) { ...@@ -86,7 +86,7 @@ inline constexpr bool CodeKindCanOSR(CodeKind kind) {
inline constexpr bool CodeKindIsOptimizedAndCanTierUp(CodeKind kind) { inline constexpr bool CodeKindIsOptimizedAndCanTierUp(CodeKind kind) {
return kind == CodeKind::NATIVE_CONTEXT_INDEPENDENT || 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) { inline constexpr bool CodeKindCanTierUp(CodeKind kind) {
...@@ -105,8 +105,8 @@ inline constexpr bool CodeKindIsStoredInOptimizedCodeCache(CodeKind kind) { ...@@ -105,8 +105,8 @@ inline constexpr bool CodeKindIsStoredInOptimizedCodeCache(CodeKind kind) {
inline OptimizationTier GetTierForCodeKind(CodeKind kind) { inline OptimizationTier GetTierForCodeKind(CodeKind kind) {
if (kind == CodeKind::TURBOFAN) return OptimizationTier::kTopTier; if (kind == CodeKind::TURBOFAN) return OptimizationTier::kTopTier;
if (kind == CodeKind::TURBOPROP) { if (kind == CodeKind::TURBOPROP) {
return FLAG_turboprop_as_toptier ? OptimizationTier::kTopTier return FLAG_turboprop_as_midtier ? OptimizationTier::kMidTier
: OptimizationTier::kMidTier; : OptimizationTier::kTopTier;
} }
if (kind == CodeKind::NATIVE_CONTEXT_INDEPENDENT) { if (kind == CodeKind::NATIVE_CONTEXT_INDEPENDENT) {
return FLAG_turbo_nci_as_midtier ? OptimizationTier::kMidTier return FLAG_turbo_nci_as_midtier ? OptimizationTier::kMidTier
...@@ -116,8 +116,12 @@ inline OptimizationTier GetTierForCodeKind(CodeKind kind) { ...@@ -116,8 +116,12 @@ inline OptimizationTier GetTierForCodeKind(CodeKind kind) {
} }
inline CodeKind CodeKindForTopTier() { inline CodeKind CodeKindForTopTier() {
if (V8_UNLIKELY(FLAG_turboprop_as_toptier)) { // TODO(turboprop, mythria): We should make FLAG_turboprop mean turboprop is
return CodeKind::TURBOPROP; // 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; return CodeKind::TURBOFAN;
} }
......
...@@ -52,12 +52,14 @@ CodeKinds JSFunction::GetAvailableCodeKinds() const { ...@@ -52,12 +52,14 @@ CodeKinds JSFunction::GetAvailableCodeKinds() const {
} }
} }
// Check the optimized code cache. if ((result & kOptimizedJSFunctionCodeKindsMask) == 0) {
if (has_feedback_vector() && feedback_vector().has_optimized_code() && // Check the optimized code cache.
!feedback_vector().optimized_code().marked_for_deoptimization()) { if (has_feedback_vector() && feedback_vector().has_optimized_code() &&
Code code = feedback_vector().optimized_code(); !feedback_vector().optimized_code().marked_for_deoptimization()) {
DCHECK(CodeKindIsOptimizedJSFunction(code.kind())); Code code = feedback_vector().optimized_code();
result |= CodeKindToCodeKindFlag(code.kind()); DCHECK(CodeKindIsOptimizedJSFunction(code.kind()));
result |= CodeKindToCodeKindFlag(code.kind());
}
} }
DCHECK_EQ((result & ~kJSFunctionCodeKindsMask), 0); DCHECK_EQ((result & ~kJSFunctionCodeKindsMask), 0);
...@@ -105,8 +107,9 @@ bool HighestTierOf(CodeKinds kinds, CodeKind* highest_tier) { ...@@ -105,8 +107,9 @@ bool HighestTierOf(CodeKinds kinds, CodeKind* highest_tier) {
} // namespace } // namespace
bool JSFunction::ActiveTierIsIgnition() const { bool JSFunction::ActiveTierIsIgnition() const {
if (!shared().HasBytecodeArray()) return false; CodeKind highest_tier;
bool result = (GetActiveTier() == CodeKind::INTERPRETED_FUNCTION); if (!HighestTierOf(GetAvailableCodeKinds(), &highest_tier)) return false;
bool result = (highest_tier == CodeKind::INTERPRETED_FUNCTION);
DCHECK_IMPLIES(result, DCHECK_IMPLIES(result,
code().is_interpreter_trampoline_builtin() || code().is_interpreter_trampoline_builtin() ||
(CodeKindIsOptimizedJSFunction(code().kind()) && (CodeKindIsOptimizedJSFunction(code().kind()) &&
...@@ -116,37 +119,30 @@ bool JSFunction::ActiveTierIsIgnition() const { ...@@ -116,37 +119,30 @@ bool JSFunction::ActiveTierIsIgnition() const {
return result; 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 { bool JSFunction::ActiveTierIsTurbofan() const {
if (!shared().HasBytecodeArray()) return false; CodeKind highest_tier;
return GetActiveTier() == CodeKind::TURBOFAN; if (!HighestTierOf(GetAvailableCodeKinds(), &highest_tier)) return false;
return highest_tier == CodeKind::TURBOFAN;
} }
bool JSFunction::ActiveTierIsNCI() const { bool JSFunction::ActiveTierIsNCI() const {
if (!shared().HasBytecodeArray()) return false; CodeKind highest_tier;
return GetActiveTier() == CodeKind::NATIVE_CONTEXT_INDEPENDENT; if (!HighestTierOf(GetAvailableCodeKinds(), &highest_tier)) return false;
return highest_tier == CodeKind::NATIVE_CONTEXT_INDEPENDENT;
} }
bool JSFunction::ActiveTierIsToptierTurboprop() const { bool JSFunction::ActiveTierIsToptierTurboprop() const {
if (!FLAG_turboprop_as_toptier) return false; CodeKind highest_tier;
if (!shared().HasBytecodeArray()) return false; if (!FLAG_turboprop) return false;
return GetActiveTier() == CodeKind::TURBOPROP && FLAG_turboprop_as_toptier; if (!HighestTierOf(GetAvailableCodeKinds(), &highest_tier)) return false;
return highest_tier == CodeKind::TURBOPROP && !FLAG_turboprop_as_midtier;
} }
bool JSFunction::ActiveTierIsMidtierTurboprop() const { bool JSFunction::ActiveTierIsMidtierTurboprop() const {
if (!FLAG_turboprop) return false; CodeKind highest_tier;
if (!shared().HasBytecodeArray()) return false; if (!FLAG_turboprop_as_midtier) return false;
return GetActiveTier() == CodeKind::TURBOPROP && !FLAG_turboprop_as_toptier; if (!HighestTierOf(GetAvailableCodeKinds(), &highest_tier)) return false;
return highest_tier == CodeKind::TURBOPROP && FLAG_turboprop_as_midtier;
} }
CodeKind JSFunction::NextTier() const { CodeKind JSFunction::NextTier() const {
......
...@@ -114,7 +114,6 @@ class JSFunction : public JSFunctionOrBoundFunction { ...@@ -114,7 +114,6 @@ class JSFunction : public JSFunctionOrBoundFunction {
bool HasAvailableCodeKind(CodeKind kind) const; bool HasAvailableCodeKind(CodeKind kind) const;
CodeKind GetActiveTier() const;
V8_EXPORT_PRIVATE bool ActiveTierIsIgnition() const; V8_EXPORT_PRIVATE bool ActiveTierIsIgnition() const;
bool ActiveTierIsTurbofan() const; bool ActiveTierIsTurbofan() const;
bool ActiveTierIsNCI() 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