[compiler] Make relaxed tag explicit for int32 accessors

Bug: v8:7790
Change-Id: I4e25140a83a0ce851195e274a489ac13cacdf676
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3086477
Reviewed-by: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Santiago Aboy Solanes <solanes@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76253}
This commit is contained in:
Santiago Aboy Solanes 2021-08-11 10:01:36 +01:00 committed by V8 LUCI CQ
parent 19996d6de5
commit d861a2b02b
11 changed files with 103 additions and 84 deletions

View File

@ -1658,7 +1658,7 @@ void Code::CodePrint(std::ostream& os) {
void CodeDataContainer::CodeDataContainerPrint(std::ostream& os) {
PrintHeader(os, "CodeDataContainer");
os << "\n - kind_specific_flags: " << kind_specific_flags();
os << "\n - kind_specific_flags: " << kind_specific_flags(kRelaxedLoad);
if (V8_EXTERNAL_CODE_SPACE_BOOL) {
os << "\n - code: " << Brief(code());
os << "\n - code_entry_point: "

View File

@ -100,14 +100,15 @@ MaybeHandle<Code> Factory::CodeBuilder::BuildInternal(
kind_specific_flags_ == 0
? roots.trampoline_trivial_code_data_container_handle()
: roots.trampoline_promise_rejection_code_data_container_handle());
DCHECK_EQ(canonical_code_data_container->kind_specific_flags(),
DCHECK_EQ(canonical_code_data_container->kind_specific_flags(kRelaxedLoad),
kind_specific_flags_);
data_container = canonical_code_data_container;
} else {
data_container = factory->NewCodeDataContainer(
0, read_only_data_container_ ? AllocationType::kReadOnly
: AllocationType::kOld);
data_container->set_kind_specific_flags(kind_specific_flags_);
data_container->set_kind_specific_flags(kind_specific_flags_,
kRelaxedStore);
}
// Basic block profiling data for builtins is stored in the JS heap rather
@ -2178,7 +2179,7 @@ Handle<CodeDataContainer> Factory::NewCodeDataContainer(
CodeDataContainer::cast(New(code_data_container_map(), allocation));
DisallowGarbageCollection no_gc;
data_container.set_next_code_link(*undefined_value(), SKIP_WRITE_BARRIER);
data_container.set_kind_specific_flags(flags);
data_container.set_kind_specific_flags(flags, kRelaxedStore);
if (V8_EXTERNAL_CODE_SPACE_BOOL) {
data_container.AllocateExternalPointerEntries(isolate());
data_container.set_raw_code(Smi::zero(), SKIP_WRITE_BARRIER);
@ -2198,7 +2199,7 @@ Handle<Code> Factory::NewOffHeapTrampolineFor(Handle<Code> code,
Builtins::CodeObjectIsExecutable(code->builtin_id());
Handle<Code> result = Builtins::GenerateOffHeapTrampolineFor(
isolate(), off_heap_entry,
code->code_data_container(kAcquireLoad).kind_specific_flags(),
code->code_data_container(kAcquireLoad).kind_specific_flags(kRelaxedLoad),
generate_jump_to_instruction_stream);
// Trampolines may not contain any metadata since all metadata offsets,
@ -2256,7 +2257,7 @@ Handle<Code> Factory::NewOffHeapTrampolineFor(Handle<Code> code,
Handle<Code> Factory::CopyCode(Handle<Code> code) {
Handle<CodeDataContainer> data_container = NewCodeDataContainer(
code->code_data_container(kAcquireLoad).kind_specific_flags(),
code->code_data_container(kAcquireLoad).kind_specific_flags(kRelaxedLoad),
AllocationType::kOld);
Heap* heap = isolate()->heap();

View File

@ -5,9 +5,9 @@
#ifndef V8_OBJECTS_ALLOCATION_SITE_INL_H_
#define V8_OBJECTS_ALLOCATION_SITE_INL_H_
#include "src/objects/allocation-site.h"
#include "src/common/globals.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/objects/allocation-site.h"
#include "src/objects/js-objects-inl.h"
// Has to be the last include (doesn't have include guards):
@ -30,8 +30,7 @@ ACCESSORS(AllocationSite, transition_info_or_boilerplate, Object,
RELEASE_ACQUIRE_ACCESSORS(AllocationSite, transition_info_or_boilerplate,
Object, kTransitionInfoOrBoilerplateOffset)
ACCESSORS(AllocationSite, nested_site, Object, kNestedSiteOffset)
IMPLICIT_TAG_RELAXED_INT32_ACCESSORS(AllocationSite, pretenure_data,
kPretenureDataOffset)
RELAXED_INT32_ACCESSORS(AllocationSite, pretenure_data, kPretenureDataOffset)
INT32_ACCESSORS(AllocationSite, pretenure_create_count,
kPretenureCreateCountOffset)
ACCESSORS(AllocationSite, dependent_code, DependentCode, kDependentCodeOffset)
@ -73,7 +72,7 @@ void AllocationSite::Initialize() {
set_transition_info_or_boilerplate(Smi::zero());
SetElementsKind(GetInitialFastElementsKind());
set_nested_site(Smi::zero());
set_pretenure_data(0);
set_pretenure_data(0, kRelaxedStore);
set_pretenure_create_count(0);
set_dependent_code(
DependentCode::cast(GetReadOnlyRoots().empty_weak_fixed_array()),
@ -139,36 +138,39 @@ inline bool AllocationSite::CanTrack(InstanceType type) {
}
AllocationSite::PretenureDecision AllocationSite::pretenure_decision() const {
return PretenureDecisionBits::decode(pretenure_data());
return PretenureDecisionBits::decode(pretenure_data(kRelaxedLoad));
}
void AllocationSite::set_pretenure_decision(PretenureDecision decision) {
int32_t value = pretenure_data();
set_pretenure_data(PretenureDecisionBits::update(value, decision));
int32_t value = pretenure_data(kRelaxedLoad);
set_pretenure_data(PretenureDecisionBits::update(value, decision),
kRelaxedStore);
}
bool AllocationSite::deopt_dependent_code() const {
return DeoptDependentCodeBit::decode(pretenure_data());
return DeoptDependentCodeBit::decode(pretenure_data(kRelaxedLoad));
}
void AllocationSite::set_deopt_dependent_code(bool deopt) {
int32_t value = pretenure_data();
set_pretenure_data(DeoptDependentCodeBit::update(value, deopt));
int32_t value = pretenure_data(kRelaxedLoad);
set_pretenure_data(DeoptDependentCodeBit::update(value, deopt),
kRelaxedStore);
}
int AllocationSite::memento_found_count() const {
return MementoFoundCountBits::decode(pretenure_data());
return MementoFoundCountBits::decode(pretenure_data(kRelaxedLoad));
}
inline void AllocationSite::set_memento_found_count(int count) {
int32_t value = pretenure_data();
int32_t value = pretenure_data(kRelaxedLoad);
// Verify that we can count more mementos than we can possibly find in one
// new space collection.
DCHECK((GetHeap()->MaxSemiSpaceSize() /
(Heap::kMinObjectSizeInTaggedWords * kTaggedSize +
AllocationMemento::kSize)) < MementoFoundCountBits::kMax);
DCHECK_LT(count, MementoFoundCountBits::kMax);
set_pretenure_data(MementoFoundCountBits::update(value, count));
set_pretenure_data(MementoFoundCountBits::update(value, count),
kRelaxedStore);
}
int AllocationSite::memento_create_count() const {

View File

@ -51,7 +51,7 @@ class AllocationSite : public Struct {
DECL_ACCESSORS(nested_site, Object)
// Bitfield containing pretenuring information.
DECL_INT32_ACCESSORS(pretenure_data)
DECL_RELAXED_INT32_ACCESSORS(pretenure_data)
DECL_INT32_ACCESSORS(pretenure_create_count)
DECL_ACCESSORS(dependent_code, DependentCode)

View File

@ -9,6 +9,7 @@
#include "src/baseline/bytecode-offset-iterator.h"
#include "src/codegen/code-desc.h"
#include "src/common/assert-scope.h"
#include "src/common/globals.h"
#include "src/execution/isolate.h"
#include "src/heap/heap-inl.h"
#include "src/heap/heap-write-barrier-inl.h"
@ -553,44 +554,47 @@ inline bool Code::is_turbofanned() const {
inline bool Code::can_have_weak_objects() const {
DCHECK(CodeKindIsOptimizedJSFunction(kind()));
int32_t flags = code_data_container(kAcquireLoad).kind_specific_flags();
int32_t flags =
code_data_container(kAcquireLoad).kind_specific_flags(kRelaxedLoad);
return CanHaveWeakObjectsField::decode(flags);
}
inline void Code::set_can_have_weak_objects(bool value) {
DCHECK(CodeKindIsOptimizedJSFunction(kind()));
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t previous = container.kind_specific_flags(kRelaxedLoad);
int32_t updated = CanHaveWeakObjectsField::update(previous, value);
container.set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated, kRelaxedStore);
}
inline bool Code::is_promise_rejection() const {
DCHECK(kind() == CodeKind::BUILTIN);
int32_t flags = code_data_container(kAcquireLoad).kind_specific_flags();
int32_t flags =
code_data_container(kAcquireLoad).kind_specific_flags(kRelaxedLoad);
return IsPromiseRejectionField::decode(flags);
}
inline void Code::set_is_promise_rejection(bool value) {
DCHECK(kind() == CodeKind::BUILTIN);
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t previous = container.kind_specific_flags(kRelaxedLoad);
int32_t updated = IsPromiseRejectionField::update(previous, value);
container.set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated, kRelaxedStore);
}
inline bool Code::is_exception_caught() const {
DCHECK(kind() == CodeKind::BUILTIN);
int32_t flags = code_data_container(kAcquireLoad).kind_specific_flags();
int32_t flags =
code_data_container(kAcquireLoad).kind_specific_flags(kRelaxedLoad);
return IsExceptionCaughtField::decode(flags);
}
inline void Code::set_is_exception_caught(bool value) {
DCHECK(kind() == CodeKind::BUILTIN);
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t previous = container.kind_specific_flags(kRelaxedLoad);
int32_t updated = IsExceptionCaughtField::update(previous, value);
container.set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated, kRelaxedStore);
}
inline bool Code::is_off_heap_trampoline() const {
@ -642,7 +646,8 @@ int Code::stack_slots() const {
bool Code::marked_for_deoptimization() const {
DCHECK(CodeKindCanDeoptimize(kind()));
int32_t flags = code_data_container(kAcquireLoad).kind_specific_flags();
int32_t flags =
code_data_container(kAcquireLoad).kind_specific_flags(kRelaxedLoad);
return MarkedForDeoptimizationField::decode(flags);
}
@ -650,14 +655,15 @@ void Code::set_marked_for_deoptimization(bool flag) {
DCHECK(CodeKindCanDeoptimize(kind()));
DCHECK_IMPLIES(flag, AllowDeoptimization::IsAllowed(GetIsolate()));
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t previous = container.kind_specific_flags(kRelaxedLoad);
int32_t updated = MarkedForDeoptimizationField::update(previous, flag);
container.set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated, kRelaxedStore);
}
int Code::deoptimization_count() const {
DCHECK(CodeKindCanDeoptimize(kind()));
int32_t flags = code_data_container(kAcquireLoad).kind_specific_flags();
int32_t flags =
code_data_container(kAcquireLoad).kind_specific_flags(kRelaxedLoad);
int count = DeoptCountField::decode(flags);
DCHECK_GE(count, 0);
return count;
@ -666,17 +672,18 @@ int Code::deoptimization_count() const {
void Code::increment_deoptimization_count() {
DCHECK(CodeKindCanDeoptimize(kind()));
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t flags = container.kind_specific_flags();
int32_t flags = container.kind_specific_flags(kRelaxedLoad);
int32_t count = DeoptCountField::decode(flags);
DCHECK_GE(count, 0);
CHECK_LE(count + 1, DeoptCountField::kMax);
int32_t updated = DeoptCountField::update(flags, count + 1);
container.set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated, kRelaxedStore);
}
bool Code::embedded_objects_cleared() const {
DCHECK(CodeKindIsOptimizedJSFunction(kind()));
int32_t flags = code_data_container(kAcquireLoad).kind_specific_flags();
int32_t flags =
code_data_container(kAcquireLoad).kind_specific_flags(kRelaxedLoad);
return EmbeddedObjectsClearedField::decode(flags);
}
@ -684,14 +691,15 @@ void Code::set_embedded_objects_cleared(bool flag) {
DCHECK(CodeKindIsOptimizedJSFunction(kind()));
DCHECK_IMPLIES(flag, marked_for_deoptimization());
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t previous = container.kind_specific_flags(kRelaxedLoad);
int32_t updated = EmbeddedObjectsClearedField::update(previous, flag);
container.set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated, kRelaxedStore);
}
bool Code::deopt_already_counted() const {
DCHECK(CodeKindCanDeoptimize(kind()));
int32_t flags = code_data_container(kAcquireLoad).kind_specific_flags();
int32_t flags =
code_data_container(kAcquireLoad).kind_specific_flags(kRelaxedLoad);
return DeoptAlreadyCountedField::decode(flags);
}
@ -699,9 +707,9 @@ void Code::set_deopt_already_counted(bool flag) {
DCHECK(CodeKindCanDeoptimize(kind()));
DCHECK_IMPLIES(flag, AllowDeoptimization::IsAllowed(GetIsolate()));
CodeDataContainer container = code_data_container(kAcquireLoad);
int32_t previous = container.kind_specific_flags();
int32_t previous = container.kind_specific_flags(kRelaxedLoad);
int32_t updated = DeoptAlreadyCountedField::update(previous, flag);
container.set_kind_specific_flags(updated);
container.set_kind_specific_flags(updated, kRelaxedStore);
}
bool Code::is_optimized_code() const {
@ -800,8 +808,8 @@ bool Code::IsExecutable() {
// concurrent marker.
STATIC_ASSERT(FIELD_SIZE(CodeDataContainer::kKindSpecificFlagsOffset) ==
kInt32Size);
IMPLICIT_TAG_RELAXED_INT32_ACCESSORS(CodeDataContainer, kind_specific_flags,
kKindSpecificFlagsOffset)
RELAXED_INT32_ACCESSORS(CodeDataContainer, kind_specific_flags,
kKindSpecificFlagsOffset)
ACCESSORS_CHECKED(CodeDataContainer, raw_code, Object, kCodeOffset,
V8_EXTERNAL_CODE_SPACE_BOOL)
RELAXED_ACCESSORS_CHECKED(CodeDataContainer, raw_code, Object, kCodeOffset,

View File

@ -43,7 +43,7 @@ class CodeDataContainer : public HeapObject {
public:
NEVER_READ_ONLY_SPACE
DECL_ACCESSORS(next_code_link, Object)
DECL_INT_ACCESSORS(kind_specific_flags)
DECL_RELAXED_INT32_ACCESSORS(kind_specific_flags)
// Clear uninitialized padding space. This ensures that the snapshot content
// is deterministic.

View File

@ -40,7 +40,6 @@
#undef CAST_ACCESSOR
#undef INT_ACCESSORS
#undef INT32_ACCESSORS
#undef IMPLICIT_TAG_RELAXED_INT32_ACCESSORS
#undef RELAXED_INT32_ACCESSORS
#undef UINT16_ACCESSORS
#undef UINT8_ACCESSORS

View File

@ -163,15 +163,6 @@
int32_t holder::name() const { return ReadField<int32_t>(offset); } \
void holder::set_##name(int32_t value) { WriteField<int32_t>(offset, value); }
// TODO(solanes): Use the non-implicit one, and change the uses to use the tag.
#define IMPLICIT_TAG_RELAXED_INT32_ACCESSORS(holder, name, offset) \
int32_t holder::name() const { \
return RELAXED_READ_INT32_FIELD(*this, offset); \
} \
void holder::set_##name(int32_t value) { \
RELAXED_WRITE_INT32_FIELD(*this, offset, value); \
}
#define RELAXED_INT32_ACCESSORS(holder, name, offset) \
int32_t holder::name(RelaxedLoadTag) const { \
return RELAXED_READ_INT32_FIELD(*this, offset); \

View File

@ -7,6 +7,7 @@
#include "src/base/macros.h"
#include "src/base/platform/mutex.h"
#include "src/common/globals.h"
#include "src/handles/handles-inl.h"
#include "src/heap/heap-write-barrier-inl.h"
#include "src/objects/debug-objects-inl.h"
@ -128,7 +129,14 @@ RENAME_UINT16_TORQUE_ACCESSORS(SharedFunctionInfo,
RENAME_UINT16_TORQUE_ACCESSORS(SharedFunctionInfo, raw_function_token_offset,
function_token_offset)
IMPLICIT_TAG_RELAXED_INT32_ACCESSORS(SharedFunctionInfo, flags, kFlagsOffset)
RELAXED_INT32_ACCESSORS(SharedFunctionInfo, flags, kFlagsOffset)
int32_t SharedFunctionInfo::relaxed_flags() const {
return flags(kRelaxedLoad);
}
void SharedFunctionInfo::set_relaxed_flags(int32_t flags) {
return set_flags(flags, kRelaxedStore);
}
UINT8_ACCESSORS(SharedFunctionInfo, flags2, kFlags2Offset)
bool SharedFunctionInfo::HasSharedName() const {
@ -245,34 +253,36 @@ BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags2,
has_static_private_methods_or_accessors,
SharedFunctionInfo::HasStaticPrivateMethodsOrAccessorsBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, syntax_kind,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, syntax_kind,
SharedFunctionInfo::FunctionSyntaxKindBits)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, allows_lazy_compilation,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, allows_lazy_compilation,
SharedFunctionInfo::AllowLazyCompilationBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, has_duplicate_parameters,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, has_duplicate_parameters,
SharedFunctionInfo::HasDuplicateParametersBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, native,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, native,
SharedFunctionInfo::IsNativeBit)
#if V8_ENABLE_WEBASSEMBLY
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, is_asm_wasm_broken,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, is_asm_wasm_broken,
SharedFunctionInfo::IsAsmWasmBrokenBit)
#endif // V8_ENABLE_WEBASSEMBLY
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags,
requires_instance_members_initializer,
SharedFunctionInfo::RequiresInstanceMembersInitializerBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, name_should_print_as_anonymous,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags,
name_should_print_as_anonymous,
SharedFunctionInfo::NameShouldPrintAsAnonymousBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, has_reported_binary_coverage,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags,
has_reported_binary_coverage,
SharedFunctionInfo::HasReportedBinaryCoverageBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, is_toplevel,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, is_toplevel,
SharedFunctionInfo::IsTopLevelBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags, properties_are_final,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags, properties_are_final,
SharedFunctionInfo::PropertiesAreFinalBit)
BIT_FIELD_ACCESSORS(SharedFunctionInfo, flags,
BIT_FIELD_ACCESSORS(SharedFunctionInfo, relaxed_flags,
private_name_lookup_skips_outer_class,
SharedFunctionInfo::PrivateNameLookupSkipsOuterClassBit)
@ -281,12 +291,12 @@ bool SharedFunctionInfo::optimization_disabled() const {
}
BailoutReason SharedFunctionInfo::disable_optimization_reason() const {
return DisabledOptimizationReasonBits::decode(flags());
return DisabledOptimizationReasonBits::decode(flags(kRelaxedLoad));
}
LanguageMode SharedFunctionInfo::language_mode() const {
STATIC_ASSERT(LanguageModeSize == 2);
return construct_language_mode(IsStrictBit::decode(flags()));
return construct_language_mode(IsStrictBit::decode(flags(kRelaxedLoad)));
}
void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) {
@ -294,22 +304,22 @@ void SharedFunctionInfo::set_language_mode(LanguageMode language_mode) {
// We only allow language mode transitions that set the same language mode
// again or go up in the chain:
DCHECK(is_sloppy(this->language_mode()) || is_strict(language_mode));
int hints = flags();
int hints = flags(kRelaxedLoad);
hints = IsStrictBit::update(hints, is_strict(language_mode));
set_flags(hints);
set_flags(hints, kRelaxedStore);
UpdateFunctionMapIndex();
}
FunctionKind SharedFunctionInfo::kind() const {
STATIC_ASSERT(FunctionKindBits::kSize == kFunctionKindBitSize);
return FunctionKindBits::decode(flags());
return FunctionKindBits::decode(flags(kRelaxedLoad));
}
void SharedFunctionInfo::set_kind(FunctionKind kind) {
int hints = flags();
int hints = flags(kRelaxedLoad);
hints = FunctionKindBits::update(hints, kind);
hints = IsClassConstructorBit::update(hints, IsClassConstructor(kind));
set_flags(hints);
set_flags(hints, kRelaxedStore);
UpdateFunctionMapIndex();
}
@ -318,7 +328,7 @@ bool SharedFunctionInfo::is_wrapped() const {
}
bool SharedFunctionInfo::construct_as_builtin() const {
return ConstructAsBuiltinBit::decode(flags());
return ConstructAsBuiltinBit::decode(flags(kRelaxedLoad));
}
void SharedFunctionInfo::CalculateConstructAsBuiltin() {
@ -332,15 +342,15 @@ void SharedFunctionInfo::CalculateConstructAsBuiltin() {
uses_builtins_construct_stub = true;
}
int f = flags();
int f = flags(kRelaxedLoad);
f = ConstructAsBuiltinBit::update(f, uses_builtins_construct_stub);
set_flags(f);
set_flags(f, kRelaxedStore);
}
int SharedFunctionInfo::function_map_index() const {
// Note: Must be kept in sync with the FastNewClosure builtin.
int index =
Context::FIRST_FUNCTION_MAP_INDEX + FunctionMapIndexBits::decode(flags());
int index = Context::FIRST_FUNCTION_MAP_INDEX +
FunctionMapIndexBits::decode(flags(kRelaxedLoad));
DCHECK_LE(index, Context::LAST_FUNCTION_MAP_INDEX);
return index;
}
@ -351,7 +361,8 @@ void SharedFunctionInfo::set_function_map_index(int index) {
DCHECK_LE(Context::FIRST_FUNCTION_MAP_INDEX, index);
DCHECK_LE(index, Context::LAST_FUNCTION_MAP_INDEX);
index -= Context::FIRST_FUNCTION_MAP_INDEX;
set_flags(FunctionMapIndexBits::update(flags(), index));
set_flags(FunctionMapIndexBits::update(flags(kRelaxedLoad), index),
kRelaxedStore);
}
void SharedFunctionInfo::clear_padding() {
@ -890,7 +901,7 @@ bool SharedFunctionInfo::CanDiscardCompiled() const {
}
bool SharedFunctionInfo::is_class_constructor() const {
return IsClassConstructorBit::decode(flags());
return IsClassConstructorBit::decode(flags(kRelaxedLoad));
}
void SharedFunctionInfo::set_are_properties_final(bool value) {

View File

@ -8,6 +8,7 @@
#include "src/ast/scopes.h"
#include "src/codegen/compilation-cache.h"
#include "src/codegen/compiler.h"
#include "src/common/globals.h"
#include "src/diagnostics/code-tracer.h"
#include "src/objects/shared-function-info-inl.h"
#include "src/strings/string-builder-inl.h"
@ -58,7 +59,7 @@ void SharedFunctionInfo::Init(ReadOnlyRoots ro_roots, int unique_id) {
// All flags default to false or 0, except ConstructAsBuiltinBit just because
// we're using the kIllegal builtin.
set_flags(ConstructAsBuiltinBit::encode(true));
set_flags(ConstructAsBuiltinBit::encode(true), kRelaxedStore);
set_flags2(0);
UpdateFunctionMapIndex();
@ -435,7 +436,8 @@ std::ostream& operator<<(std::ostream& os, const SourceCodeOf& v) {
void SharedFunctionInfo::DisableOptimization(BailoutReason reason) {
DCHECK_NE(reason, BailoutReason::kNoReason);
set_flags(DisabledOptimizationReasonBits::update(flags(), 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 ||

View File

@ -10,6 +10,7 @@
#include "src/base/bit-field.h"
#include "src/builtins/builtins.h"
#include "src/codegen/bailout-reason.h"
#include "src/common/globals.h"
#include "src/objects/compressed-slots.h"
#include "src/objects/function-kind.h"
#include "src/objects/function-syntax-kind.h"
@ -411,7 +412,7 @@ class SharedFunctionInfo
inline bool HasSharedName() const;
// [flags] Bit field containing various flags about the function.
DECL_INT32_ACCESSORS(flags)
DECL_RELAXED_INT32_ACCESSORS(flags)
DECL_UINT8_ACCESSORS(flags2)
// True if the outer class scope contains a private brand for
@ -670,6 +671,10 @@ class SharedFunctionInfo
inline uint16_t get_property_estimate_from_literal(FunctionLiteral* literal);
// For ease of use of the BITFIELD macro.
inline int32_t relaxed_flags() const;
inline void set_relaxed_flags(int32_t flags);
template <typename Impl>
friend class FactoryBase;
friend class V8HeapExplorer;