Commit 7e39467c authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

Revert "[SharedFunctionInfo] Add available_baseline_code flag"

This reverts commit 5e16d853.

Reason for revert: TSAN https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Linux64%20TSAN%20-%20no-concurrent-marking/6432/overview

Original change's description:
> [SharedFunctionInfo] Add available_baseline_code flag
>
> Checks that flags1 are ReadOnly after SFI is finalised.
>
> Bug: v8:12054
> Change-Id: Ia2518b8f136a81aa076fd429bf4fcaf742a314e3
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3263897
> Commit-Queue: Victor Gomes <victorgomes@chromium.org>
> Reviewed-by: Nico Hartmann <nicohartmann@chromium.org>
> Reviewed-by: Leszek Swirski <leszeks@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#77816}

TBR=leszeks@chromium.org,v8-scoped@luci-project-accounts.iam.gserviceaccount.com,victorgomes@chromium.org,nicohartmann@chromium.org

Change-Id: Ifb28601a6f6dbe24b38e2e9ea2a5a7e576c0c511
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:12054
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3270545Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Owners-Override: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77818}
parent 87567584
......@@ -604,10 +604,6 @@ void InstallUnoptimizedCode(UnoptimizedCompilationInfo* compilation_info,
#else
UNREACHABLE();
#endif // V8_ENABLE_WEBASSEMBLY
#ifdef DEBUG
shared_info->set_finalized(true);
#endif
}
}
......
......@@ -361,9 +361,6 @@ Handle<SharedFunctionInfo> FactoryBase<Impl>::NewSharedFunctionInfo(
Handle<SharedFunctionInfo> shared = NewSharedFunctionInfo();
DisallowGarbageCollection no_gc;
SharedFunctionInfo raw = *shared;
#ifdef DEBUG
raw.set_finalized(false);
#endif
// Function names are assumed to be flat elsewhere.
Handle<String> shared_name;
bool has_shared_name = maybe_name.ToHandle(&shared_name);
......
......@@ -2586,7 +2586,7 @@ IGNITION_HANDLER(CreateMappedArguments, InterpreterAssembler) {
TNode<SharedFunctionInfo> shared_info = LoadObjectField<SharedFunctionInfo>(
closure, JSFunction::kSharedFunctionInfoOffset);
TNode<Uint32T> flags =
LoadObjectField<Uint32T>(shared_info, SharedFunctionInfo::kFlags2Offset);
LoadObjectField<Uint32T>(shared_info, SharedFunctionInfo::kFlagsOffset);
TNode<BoolT> has_duplicate_parameters =
IsSetWord32<SharedFunctionInfo::HasDuplicateParametersBit>(flags);
Branch(has_duplicate_parameters, &if_duplicate_parameters,
......
......@@ -144,8 +144,6 @@ int32_t SharedFunctionInfo::relaxed_flags() const {
return flags(kRelaxedLoad);
}
void SharedFunctionInfo::set_relaxed_flags(int32_t flags) {
// These flags should be read only, once SFI is finalized.
DCHECK(!finalized());
return set_flags(flags, kRelaxedStore);
}
......@@ -258,11 +256,10 @@ SharedFunctionInfo::Inlineability SharedFunctionInfo::GetInlineability(
return kIsInlineable;
}
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags,
class_scope_has_private_brand,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags2, class_scope_has_private_brand,
SharedFunctionInfo::ClassScopeHasPrivateBrandBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags2,
has_static_private_methods_or_accessors,
SharedFunctionInfo::HasStaticPrivateMethodsOrAccessorsBit)
......@@ -271,20 +268,21 @@ BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, syntax_kind,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, allows_lazy_compilation,
SharedFunctionInfo::AllowLazyCompilationBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags2, has_duplicate_parameters,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, has_duplicate_parameters,
SharedFunctionInfo::HasDuplicateParametersBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, native,
SharedFunctionInfo::IsNativeBit)
#if V8_ENABLE_WEBASSEMBLY
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags2, is_asm_wasm_broken,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, is_asm_wasm_broken,
SharedFunctionInfo::IsAsmWasmBrokenBit)
#endif // V8_ENABLE_WEBASSEMBLY
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags,
requires_instance_members_initializer,
SharedFunctionInfo::RequiresInstanceMembersInitializerBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags2, name_should_print_as_anonymous,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags,
name_should_print_as_anonymous,
SharedFunctionInfo::NameShouldPrintAsAnonymousBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags,
has_reported_binary_coverage,
......@@ -298,21 +296,12 @@ BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags,
private_name_lookup_skips_outer_class,
SharedFunctionInfo::PrivateNameLookupSkipsOuterClassBit)
bool SharedFunctionInfo::available_baseline_code() const {
return AvailableBaselineCodeBit::decode(flags(kRelaxedLoad));
}
void SharedFunctionInfo::set_available_baseline_code(bool value) {
set_flags(AvailableBaselineCodeBit::update(flags(kRelaxedLoad), value),
kRelaxedStore);
}
bool SharedFunctionInfo::optimization_disabled() const {
return disabled_optimization_reason() != BailoutReason::kNoReason;
}
BailoutReason SharedFunctionInfo::disabled_optimization_reason() const {
return DisabledOptimizationReasonBits::decode(flags2());
return DisabledOptimizationReasonBits::decode(flags(kRelaxedLoad));
}
LanguageMode SharedFunctionInfo::language_mode() const {
......
......@@ -228,9 +228,6 @@ void SharedFunctionInfo::SetScript(ReadOnlyRoots roots,
void SharedFunctionInfo::CopyFrom(SharedFunctionInfo other) {
PtrComprCageBase cage_base = GetPtrComprCageBase(*this);
#ifdef DEBUG
set_finalized(false);
#endif
set_function_data(other.function_data(cage_base, kAcquireLoad),
kReleaseStore);
set_name_or_scope_info(other.name_or_scope_info(cage_base, kAcquireLoad),
......@@ -251,10 +248,6 @@ void SharedFunctionInfo::CopyFrom(SharedFunctionInfo other) {
set_unique_id(other.unique_id());
#endif
#ifdef DEBUG
set_finalized(other.finalized());
#endif
// This should now be byte-for-byte identical to the input.
DCHECK_EQ(memcmp(reinterpret_cast<void*>(address()),
reinterpret_cast<void*>(other.address()),
......@@ -472,7 +465,9 @@ std::ostream& operator<<(std::ostream& os, const SourceCodeOf& v) {
void SharedFunctionInfo::DisableOptimization(BailoutReason reason) {
DCHECK_NE(reason, BailoutReason::kNoReason);
set_flags2(DisabledOptimizationReasonBits::update(flags2(), reason));
set_flags(DisabledOptimizationReasonBits::update(flags(kRelaxedLoad), reason),
kRelaxedStore);
// Code should be the lazy compilation stub or else interpreted.
Isolate* isolate = GetIsolate();
DCHECK(abstract_code(isolate).kind() == CodeKind::INTERPRETED_FUNCTION ||
......
......@@ -399,9 +399,6 @@ class SharedFunctionInfo
using TorqueGeneratedSharedFunctionInfo::set_function_token_offset;
public:
inline bool available_baseline_code() const;
inline void set_available_baseline_code(bool value);
// The position of the 'function' token in the script source. Can return
// kNoSourcePosition if raw_function_token_offset() returns
// kFunctionTokenOutOfRange.
......@@ -410,6 +407,10 @@ class SharedFunctionInfo
// Returns true if the function has shared name.
inline bool HasSharedName() const;
// [flags] Bit field containing various flags about the function.
DECL_RELAXED_INT32_ACCESSORS(flags)
DECL_UINT8_ACCESSORS(flags2)
// True if the outer class scope contains a private brand for
// private instance methdos.
DECL_BOOLEAN_ACCESSORS(class_scope_has_private_brand)
......@@ -669,10 +670,6 @@ class SharedFunctionInfo
inline uint16_t get_property_estimate_from_literal(FunctionLiteral* literal);
// [flags] Bit field containing various flags about the function.
DECL_RELAXED_INT32_ACCESSORS(flags)
DECL_UINT8_ACCESSORS(flags2)
// For ease of use of the BITFIELD macro.
inline int32_t relaxed_flags() const;
inline void set_relaxed_flags(int32_t flags);
......
......@@ -18,9 +18,6 @@ type FunctionKind extends uint8 constexpr 'FunctionKind';
type FunctionSyntaxKind extends uint8 constexpr 'FunctionSyntaxKind';
type BailoutReason extends uint8 constexpr 'BailoutReason';
// These flags are ReadOnly after SFI is fully inialized,
// except available_sparkplug_code which is set by the concurrent
// Sparkplug compiler.
bitfield struct SharedFunctionInfoFlags extends uint32 {
// Have FunctionKind first to make it cheaper to access.
function_kind: FunctionKind: 5 bit;
......@@ -28,24 +25,23 @@ bitfield struct SharedFunctionInfoFlags extends uint32 {
is_strict: bool: 1 bit;
function_syntax_kind: FunctionSyntaxKind: 3 bit;
is_class_constructor: bool: 1 bit;
has_duplicate_parameters: bool: 1 bit;
allow_lazy_compilation: bool: 1 bit;
is_asm_wasm_broken: bool: 1 bit;
function_map_index: uint32: 5 bit;
disabled_optimization_reason: BailoutReason: 4 bit;
requires_instance_members_initializer: bool: 1 bit;
construct_as_builtin: bool: 1 bit;
name_should_print_as_anonymous: bool: 1 bit;
has_reported_binary_coverage: bool: 1 bit;
is_top_level: bool: 1 bit;
properties_are_final: bool: 1 bit;
private_name_lookup_skips_outer_class: bool: 1 bit;
class_scope_has_private_brand: bool: 1 bit;
has_static_private_methods_or_accessors: bool: 1 bit;
available_baseline_code: bool: 1 bit;
}
bitfield struct SharedFunctionInfoFlags2 extends uint8 {
disabled_optimization_reason: BailoutReason: 4 bit;
is_asm_wasm_broken: bool: 1 bit;
name_should_print_as_anonymous: bool: 1 bit;
has_duplicate_parameters: bool: 1 bit;
class_scope_has_private_brand: bool: 1 bit;
has_static_private_methods_or_accessors: bool: 1 bit;
}
@generateBodyDescriptor
......@@ -83,7 +79,6 @@ extern class SharedFunctionInfo extends HeapObject {
// [unique_id] - For --log-maps purposes, an identifier that's persistent
// even if the GC moves this SharedFunctionInfo.
@if(V8_SFI_HAS_UNIQUE_ID) unique_id: int32;
@if(DEBUG) finalized: int8;
}
const kDontAdaptArgumentsSentinel: constexpr int32
......
......@@ -45,7 +45,6 @@ struct EnumEntry {
class BuildFlags : public ContextualClass<BuildFlags> {
public:
BuildFlags() {
build_flags_["DEBUG"] = DEBUG_BOOL;
build_flags_["V8_SFI_HAS_UNIQUE_ID"] = V8_SFI_HAS_UNIQUE_ID;
build_flags_["V8_EXTERNAL_CODE_SPACE"] = V8_EXTERNAL_CODE_SPACE_BOOL;
build_flags_["TAGGED_SIZE_8_BYTES"] = TAGGED_SIZE_8_BYTES;
......
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