Commit d7418d41 authored by Jakob Gruber's avatar Jakob Gruber Committed by V8 LUCI CQ

Remove SharedFunctionInfo::IsInterpreted

This predicate is just confusing - it's a renamed version of
HasBytecodeArray; but HasBytecodeArray also returns true if the SFI
has attached Sparkplug code - and is thus not interpreted.

Simply replace it by HasBytecodeArray.

Bug: v8:7700
Change-Id: Id4be2048a625142ade1096044133d9cd2896b51d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3461935Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/main@{#79115}
parent cc0a8ae4
......@@ -2098,7 +2098,7 @@ void Compiler::CompileOptimized(Isolate* isolate, Handle<JSFunction> function,
// optimizing.
DCHECK(!isolate->has_pending_exception());
DCHECK(function->shared().is_compiled());
DCHECK(function->shared().IsInterpreted());
DCHECK(function->shared().HasBytecodeArray());
code = ContinuationForConcurrentOptimization(isolate, function);
}
......
......@@ -4307,6 +4307,7 @@ CodeTracer* Isolate::GetCodeTracer() {
}
bool Isolate::use_optimizer() {
// TODO(v8:7700): Update this predicate for a world with multiple tiers.
return FLAG_opt && !serializer_enabled_ && CpuFeatures::SupportsOptimizer() &&
!is_precise_count_code_coverage();
}
......
......@@ -255,7 +255,7 @@ void TieringManager::OnInterruptTick(JavaScriptFrame* frame) {
CodeKind code_kind = function.GetActiveTier().value();
DCHECK(function.shared().is_compiled());
DCHECK(function.shared().IsInterpreted());
DCHECK(function.shared().HasBytecodeArray());
DCHECK_IMPLIES(CodeKindIsOptimizedJSFunction(code_kind),
function.has_feedback_vector());
......
......@@ -1880,7 +1880,7 @@ EnumerateCompiledFunctions(Heap* heap) {
obj = iterator.Next()) {
if (obj.IsSharedFunctionInfo()) {
SharedFunctionInfo sfi = SharedFunctionInfo::cast(obj);
if (sfi.is_compiled() && !sfi.IsInterpreted()) {
if (sfi.is_compiled() && !sfi.HasBytecodeArray()) {
compiled_funcs.emplace_back(
handle(sfi, isolate),
handle(AbstractCode::cast(sfi.abstract_code(isolate)), isolate));
......
......@@ -389,7 +389,7 @@ void CompilationCacheTable::Age(Isolate* isolate) {
} else if (key.IsFixedArray()) {
// The ageing mechanism for script and eval caches.
SharedFunctionInfo info = SharedFunctionInfo::cast(get(value_index));
if (info.IsInterpreted() && info.GetBytecodeArray(isolate).IsOld()) {
if (info.HasBytecodeArray() && info.GetBytecodeArray(isolate).IsOld()) {
RemoveEntry(entry_index);
}
}
......
......@@ -7,8 +7,8 @@ type OptimizationMarker extends uint16 constexpr 'OptimizationMarker';
bitfield struct FeedbackVectorFlags extends uint32 {
optimization_marker: OptimizationMarker: 2 bit;
// Whether the maybe_optimized_code field contains a code object. 'maybe',
// because they flag may lag behind the actual state of the world when
// maybe_optimized_code is cleared (it will be updated in time).
// because they flag may lag behind the actual state of the world (it will be
// updated in time).
maybe_has_optimized_code: bool: 1 bit;
all_your_bits_are_belong_to_jgruber: uint32: 29 bit;
}
......
......@@ -88,7 +88,7 @@ void JSFunction::MarkForOptimization(ConcurrencyMode mode) {
DCHECK(!is_compiled() || ActiveTierIsIgnition() || ActiveTierIsBaseline());
DCHECK(!ActiveTierIsTurbofan());
DCHECK(shared().IsInterpreted());
DCHECK(shared().HasBytecodeArray());
DCHECK(shared().allows_lazy_compilation() ||
!shared().optimization_disabled());
......
......@@ -124,7 +124,7 @@ base::Optional<CodeKind> JSFunction::GetActiveTier() const {
(CodeKindIsOptimizedJSFunction(code().kind()) &&
code().marked_for_deoptimization()) ||
(code().builtin_id() == Builtin::kCompileLazy &&
shared().IsInterpreted()));
shared().HasBytecodeArray() && !shared().HasBaselineCode()));
}
#endif // DEBUG
......
......@@ -408,8 +408,6 @@ bool SharedFunctionInfo::IsDontAdaptArguments() const {
kDontAdaptArgumentsSentinel;
}
bool SharedFunctionInfo::IsInterpreted() const { return HasBytecodeArray(); }
DEF_ACQUIRE_GETTER(SharedFunctionInfo, scope_info, ScopeInfo) {
Object maybe_scope_info = name_or_scope_info(cage_base, kAcquireLoad);
if (maybe_scope_info.IsScopeInfo(cage_base)) {
......
......@@ -211,10 +211,6 @@ class SharedFunctionInfo
template <typename IsolateT>
inline AbstractCode abstract_code(IsolateT* isolate);
// Tells whether or not this shared function info has an attached
// BytecodeArray.
inline bool IsInterpreted() const;
// Set up the link between shared function info and the script. The shared
// function info is added to the list on the script.
V8_EXPORT_PRIVATE void SetScript(ReadOnlyRoots roots,
......
......@@ -302,8 +302,12 @@ Object OptimizeFunctionOnNextCall(RuntimeArguments& args, Isolate* isolate,
// This function may not have been lazily compiled yet, even though its shared
// function has.
if (!function->is_compiled()) {
DCHECK(function->shared().IsInterpreted());
function->set_code(*BUILTIN_CODE(isolate, InterpreterEntryTrampoline));
DCHECK(function->shared().HasBytecodeArray());
CodeT codet = *BUILTIN_CODE(isolate, InterpreterEntryTrampoline);
if (function->shared().HasBaselineCode()) {
codet = function->shared().baseline_code(kAcquireLoad);
}
function->set_code(codet);
}
JSFunction::EnsureFeedbackVector(function, &is_compiled_scope);
......
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