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

[compiler] Fix ref construction in SFIRef::scope_info

It was missing an AssumeMemoryFence.

Bug: v8:7790,chromium:1236612
Change-Id: Icd3ed9f9979b0ba287c9dff7f4f8722ac06e859a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3073739
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76110}
parent 51f56648
......@@ -3277,7 +3277,7 @@ int SharedFunctionInfoRef::context_header_size() const {
}
ScopeInfoRef SharedFunctionInfoRef::scope_info() const {
return MakeRef(broker(), object()->scope_info());
return MakeRefAssumeMemoryFence(broker(), object()->scope_info(kAcquireLoad));
}
void JSObjectRef::SerializeObjectCreateMap(NotConcurrentInliningTag tag) {
......
......@@ -164,13 +164,13 @@ void SharedFunctionInfo::SetName(String name) {
}
bool SharedFunctionInfo::is_script() const {
return scope_info().is_script_scope() &&
return scope_info(kAcquireLoad).is_script_scope() &&
Script::cast(script()).compilation_type() ==
Script::COMPILATION_TYPE_HOST;
}
bool SharedFunctionInfo::needs_script_context() const {
return is_script() && scope_info().ContextLocalCount() > 0;
return is_script() && scope_info(kAcquireLoad).ContextLocalCount() > 0;
}
template <typename IsolateT>
......@@ -375,14 +375,18 @@ void SharedFunctionInfo::DontAdaptArguments() {
bool SharedFunctionInfo::IsInterpreted() const { return HasBytecodeArray(); }
ScopeInfo SharedFunctionInfo::scope_info() const {
Object maybe_scope_info = name_or_scope_info(kAcquireLoad);
ScopeInfo SharedFunctionInfo::scope_info(AcquireLoadTag tag) const {
Object maybe_scope_info = name_or_scope_info(tag);
if (maybe_scope_info.IsScopeInfo()) {
return ScopeInfo::cast(maybe_scope_info);
}
return GetReadOnlyRoots().empty_scope_info();
}
ScopeInfo SharedFunctionInfo::scope_info() const {
return scope_info(kAcquireLoad);
}
void SharedFunctionInfo::SetScopeInfo(ScopeInfo scope_info,
WriteBarrierMode mode) {
// Move the existing name onto the ScopeInfo.
......@@ -417,8 +421,9 @@ bool SharedFunctionInfo::HasOuterScopeInfo() const {
if (!outer_scope_info().IsScopeInfo()) return false;
outer_info = ScopeInfo::cast(outer_scope_info());
} else {
if (!scope_info().HasOuterScopeInfo()) return false;
outer_info = scope_info().OuterScopeInfo();
ScopeInfo info = scope_info(kAcquireLoad);
if (!info.HasOuterScopeInfo()) return false;
outer_info = info.OuterScopeInfo();
}
return !outer_info.IsEmpty();
}
......@@ -426,7 +431,7 @@ bool SharedFunctionInfo::HasOuterScopeInfo() const {
ScopeInfo SharedFunctionInfo::GetOuterScopeInfo() const {
DCHECK(HasOuterScopeInfo());
if (!is_compiled()) return ScopeInfo::cast(outer_scope_info());
return scope_info().OuterScopeInfo();
return scope_info(kAcquireLoad).OuterScopeInfo();
}
void SharedFunctionInfo::set_outer_scope_info(HeapObject value,
......@@ -494,7 +499,7 @@ IsCompiledScope::IsCompiledScope(const SharedFunctionInfo shared,
}
bool SharedFunctionInfo::has_simple_parameters() {
return scope_info().HasSimpleParameters();
return scope_info(kAcquireLoad).HasSimpleParameters();
}
bool SharedFunctionInfo::IsApiFunction() const {
......
......@@ -215,6 +215,8 @@ class SharedFunctionInfo
static const int kNotFound = -1;
DECL_ACQUIRE_GETTER(scope_info, ScopeInfo)
// Deprecated, use the ACQUIRE version instead.
DECL_GETTER(scope_info, ScopeInfo)
// Set scope_info without moving the existing name onto the ScopeInfo.
......
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