[dict-proto] Rename v8_dict_mode_prototypes flag

The build time flag v8_dict_mode_prototypes is ill-named, because it
does not control whether properties are kept in dictionary mode (this
is done by the v8_dict_property_const_tracking flag), but instead it
controls if SwissNameDictionary or NameDictionary is used as the
property backing store for all dictionary mode objects.

This CL renames the flag and updates its description.

Change-Id: If1337838d1b6d8f089c281a77d9ef7cfd4007220
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2786859
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Reviewed-by: Omer Katz <omerkatz@chromium.org>
Reviewed-by: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: Santiago Aboy Solanes <solanes@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73706}
This commit is contained in:
Frank Emrich 2021-03-26 00:14:31 +01:00 committed by Commit Bot
parent 4e086ac5a0
commit 51140a4409
31 changed files with 97 additions and 94 deletions

View File

@ -287,9 +287,9 @@ declare_args() {
# Requires use_rtti = true
v8_enable_precise_zone_stats = false
# Experimental feature for always keeping prototypes in dict/"slow" mode
# Sets -DV8_DICT_MODE_PROTOTYPES
v8_dict_mode_prototypes = false
# Experimental feature that uses SwissNameDictionary instead of NameDictionary
# as the backing store for all dictionary mode objects.
v8_enable_swiss_name_dictionary = false
# If enabled then macro definitions that are used in externally visible
# header files are placed in a separate header file v8-gn.h.
@ -785,8 +785,8 @@ config("features") {
if (v8_enable_short_builtin_calls) {
defines += [ "V8_SHORT_BUILTIN_CALLS" ]
}
if (v8_dict_mode_prototypes) {
defines += [ "V8_DICT_MODE_PROTOTYPES" ]
if (v8_enable_swiss_name_dictionary) {
defines += [ "V8_ENABLE_SWISS_NAME_DICTIONARY" ]
}
if (v8_enable_system_instrumentation) {
defines += [ "V8_ENABLE_SYSTEM_INSTRUMENTATION" ]

View File

@ -6686,7 +6686,7 @@ Local<v8::Object> v8::Object::New(Isolate* isolate,
// properties, and so we default to creating a properties backing store
// large enough to hold all of them, while we start with no elements
// (see http://bit.ly/v8-fast-object-create-cpp for the motivation).
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
i::Handle<i::SwissNameDictionary> properties =
i_isolate->factory()->NewSwissNameDictionary(static_cast<int>(length));
AddPropertiesAndElementsToObject(i_isolate, properties, elements, names,

View File

@ -465,7 +465,7 @@ const kHeapObjectHeaderSize:
constexpr int32 generates 'HeapObject::kHeaderSize';
const kDictModePrototypes:
constexpr bool generates 'V8_DICT_MODE_PROTOTYPES_BOOL';
constexpr bool generates 'V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL';
type TheHole extends Oddball;
type Null extends Oddball;

View File

@ -327,7 +327,7 @@ TNode<JSObject> ConstructorBuiltinsAssembler::FastNewObject(
}
BIND(&allocate_properties);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
properties =
AllocateSwissNameDictionary(SwissNameDictionary::kInitialCapacity);
} else {
@ -548,7 +548,7 @@ TNode<HeapObject> ConstructorBuiltinsAssembler::CreateShallowObjectLiteral(
BIND(&if_dictionary);
{
Comment("Copy dictionary properties");
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
var_properties =
CopySwissNameDictionary(CAST(LoadSlowProperties(boilerplate)));
} else {

View File

@ -1072,7 +1072,7 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) {
BIND(&null_proto);
{
map = LoadSlowObjectWithNullPrototypeMap(native_context);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
properties =
AllocateSwissNameDictionary(SwissNameDictionary::kInitialCapacity);
} else {
@ -1420,7 +1420,7 @@ TNode<JSObject> ObjectBuiltinsAssembler::FromPropertyDescriptor(
// We want to preallocate the slots for value, writable, get, set,
// enumerable and configurable - a total of 6
TNode<HeapObject> properties =
V8_DICT_MODE_PROTOTYPES_BOOL
V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL
? TNode<HeapObject>(AllocateSwissNameDictionary(6))
: AllocateNameDictionary(6);
TNode<JSObject> js_desc = AllocateJSObjectFromMap(map, properties);

View File

@ -52,7 +52,7 @@ TNode<JSProxy> ProxiesCodeStubAssembler::AllocateProxy(
BIND(&create_proxy);
TNode<HeapObject> proxy = Allocate(JSProxy::kSize);
StoreMapNoWriteBarrier(proxy, map.value());
RootIndex empty_dict = V8_DICT_MODE_PROTOTYPES_BOOL
RootIndex empty_dict = V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL
? RootIndex::kEmptySwissPropertyDictionary
: RootIndex::kEmptyPropertyDictionary;
StoreObjectFieldRoot(proxy, JSProxy::kPropertiesOrHashOffset, empty_dict);

View File

@ -323,7 +323,7 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::ConstructNewResultFromMatchInfo(
TNode<NativeContext> native_context = LoadNativeContext(context);
TNode<Map> map = LoadSlowObjectWithNullPrototypeMap(native_context);
TNode<HeapObject> properties;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
properties = AllocateSwissNameDictionary(num_properties);
} else {
properties =

View File

@ -1723,7 +1723,7 @@ TNode<HeapObject> CodeStubAssembler::LoadSlowProperties(
CSA_SLOW_ASSERT(this, IsDictionaryMap(LoadMap(object)));
TNode<Object> properties = LoadJSReceiverPropertiesOrHash(object);
NodeGenerator<HeapObject> make_empty = [=]() -> TNode<HeapObject> {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
return EmptySwissPropertyDictionaryConstant();
} else {
return EmptyPropertyDictionaryConstant();
@ -1731,7 +1731,7 @@ TNode<HeapObject> CodeStubAssembler::LoadSlowProperties(
};
NodeGenerator<HeapObject> cast_properties = [=] {
TNode<HeapObject> dict = CAST(properties);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
CSA_ASSERT(this, Word32Or(IsSwissNameDictionary(dict),
IsGlobalDictionary(dict)));
} else {
@ -1923,7 +1923,7 @@ TNode<IntPtrT> CodeStubAssembler::LoadJSReceiverIdentityHash(
GotoIf(InstanceTypeEqual(properties_instance_type, PROPERTY_ARRAY_TYPE),
&if_property_array);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
GotoIf(
InstanceTypeEqual(properties_instance_type, SWISS_NAME_DICTIONARY_TYPE),
&if_swiss_property_dictionary);
@ -1950,7 +1950,7 @@ TNode<IntPtrT> CodeStubAssembler::LoadJSReceiverIdentityHash(
var_hash = Signed(DecodeWord<PropertyArray::HashField>(length_and_hash));
Goto(&done);
}
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
BIND(&if_swiss_property_dictionary);
{
var_hash = Signed(
@ -14064,7 +14064,7 @@ TNode<Map> CodeStubAssembler::CheckEnumCache(TNode<JSReceiver> receiver,
TNode<Smi> length;
TNode<HeapObject> properties = LoadSlowProperties(receiver);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
CSA_ASSERT(this, Word32Or(IsSwissNameDictionary(properties),
IsGlobalDictionary(properties)));

View File

@ -113,10 +113,10 @@ STATIC_ASSERT(V8_DEFAULT_STACK_SIZE_KB* KB +
const size_t kShortBuiltinCallsOldSpaceSizeThreshold = size_t{2} * GB;
// Determine whether dict mode prototypes feature is enabled.
#ifdef V8_DICT_MODE_PROTOTYPES
#define V8_DICT_MODE_PROTOTYPES_BOOL true
#ifdef V8_ENABLE_SWISS_NAME_DICTIONARY
#define V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL true
#else
#define V8_DICT_MODE_PROTOTYPES_BOOL false
#define V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL false
#endif
// Determine whether dict property constness tracking feature is enabled.

View File

@ -670,7 +670,7 @@ bool AccessInfoFactory::TryLoadPropertyDetails(
}
Handle<JSObject> holder = maybe_holder.ToHandleChecked();
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
SwissNameDictionary dict = holder->property_dictionary_swiss();
*index_out = dict.FindEntry(isolate(), name);
if (index_out->is_found()) {

View File

@ -202,7 +202,7 @@ class ConstantInDictionaryPrototypeChainDependency final
CHECK(!object.HasFastProperties());
ValidationResult result =
V8_DICT_MODE_PROTOTYPES_BOOL
V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL
? try_load(object.property_dictionary_swiss())
: try_load(object.property_dictionary());

View File

@ -1754,7 +1754,7 @@ void JSObject::IncrementSpillStatistics(Isolate* isolate,
info->number_of_slow_used_properties_ += dict.NumberOfElements();
info->number_of_slow_unused_properties_ +=
dict.Capacity() - dict.NumberOfElements();
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
SwissNameDictionary dict = property_dictionary_swiss();
info->number_of_slow_used_properties_ += dict.NumberOfElements();
info->number_of_slow_unused_properties_ +=

View File

@ -315,7 +315,7 @@ bool JSObject::PrintProperties(std::ostream& os) { // NOLINT
} else if (IsJSGlobalObject()) {
PrintDictionaryContents(
os, JSGlobalObject::cast(*this).global_dictionary(kAcquireLoad));
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
PrintDictionaryContents(os, property_dictionary_swiss());
} else {
PrintDictionaryContents(os, property_dictionary());

View File

@ -1634,7 +1634,7 @@ Handle<JSObject> Factory::CopyJSObjectWithAllocationSite(
}
} else {
Handle<Object> copied_properties;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
copied_properties = SwissNameDictionary::ShallowCopy(
isolate(), handle(source->property_dictionary_swiss(), isolate()));
} else {
@ -2222,7 +2222,7 @@ Handle<JSObject> Factory::NewSlowJSObjectFromMap(
Handle<AllocationSite> allocation_site) {
DCHECK(map->is_dictionary_map());
Handle<HeapObject> object_properties;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
object_properties = NewSwissNameDictionary(capacity, allocation);
} else {
object_properties = NameDictionary::New(isolate(), capacity);
@ -2236,9 +2236,10 @@ Handle<JSObject> Factory::NewSlowJSObjectFromMap(
Handle<JSObject> Factory::NewSlowJSObjectWithPropertiesAndElements(
Handle<HeapObject> prototype, Handle<HeapObject> properties,
Handle<FixedArrayBase> elements) {
DCHECK_IMPLIES(V8_DICT_MODE_PROTOTYPES_BOOL,
DCHECK_IMPLIES(V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL,
properties->IsSwissNameDictionary());
DCHECK_IMPLIES(!V8_DICT_MODE_PROTOTYPES_BOOL, properties->IsNameDictionary());
DCHECK_IMPLIES(!V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL,
properties->IsNameDictionary());
Handle<Map> object_map = isolate()->slow_object_with_object_prototype_map();
if (object_map->prototype() != *prototype) {

View File

@ -5193,7 +5193,7 @@ void Genesis::TransferNamedProperties(Handle<JSObject> from,
JSObject::AddProperty(isolate(), to, key, value, details.attributes());
}
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
// Copy all keys and values in enumeration order.
Handle<SwissNameDictionary> properties = Handle<SwissNameDictionary>(
from->property_dictionary_swiss(), isolate());

View File

@ -18,7 +18,7 @@
namespace v8 {
namespace internal {
#ifdef V8_DICT_MODE_PROTOTYPES
#ifdef V8_ENABLE_SWISS_NAME_DICTIONARY
class SwissNameDictionary;
using PropertyDictionary = SwissNameDictionary;
#else

View File

@ -604,7 +604,7 @@ void JSReceiver::initialize_properties(Isolate* isolate) {
DCHECK(!ObjectInYoungGeneration(roots.empty_property_dictionary()));
DCHECK(!ObjectInYoungGeneration(roots.empty_ordered_property_dictionary()));
if (map(isolate).is_dictionary_map()) {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
WRITE_FIELD(*this, kPropertiesOrHashOffset,
roots.empty_swiss_property_dictionary());
} else {
@ -628,7 +628,7 @@ DEF_GETTER(JSReceiver, HasFastProperties, bool) {
DEF_GETTER(JSReceiver, property_dictionary, NameDictionary) {
DCHECK(!IsJSGlobalObject(isolate));
DCHECK(!HasFastProperties(isolate));
DCHECK(!V8_DICT_MODE_PROTOTYPES_BOOL);
DCHECK(!V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL);
// Can't use ReadOnlyRoots(isolate) as this isolate could be produced by
// i::GetIsolateForPtrCompr(HeapObject).
@ -642,7 +642,7 @@ DEF_GETTER(JSReceiver, property_dictionary, NameDictionary) {
DEF_GETTER(JSReceiver, property_dictionary_swiss, SwissNameDictionary) {
DCHECK(!IsJSGlobalObject(isolate));
DCHECK(!HasFastProperties(isolate));
DCHECK(V8_DICT_MODE_PROTOTYPES_BOOL);
DCHECK(V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL);
// Can't use ReadOnlyRoots(isolate) as this isolate could be produced by
// i::GetIsolateForPtrCompr(HeapObject).

View File

@ -359,7 +359,7 @@ Maybe<bool> JSReceiver::SetOrCopyDataProperties(
source_length = JSGlobalObject::cast(*from)
.global_dictionary(kAcquireLoad)
.NumberOfEnumerableProperties();
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
source_length =
from->property_dictionary_swiss().NumberOfEnumerableProperties();
} else {
@ -662,7 +662,7 @@ Object SetHashAndUpdateProperties(HeapObject properties, int hash) {
return properties;
}
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
DCHECK(properties.IsSwissNameDictionary());
SwissNameDictionary::cast(properties).SetHash(hash);
} else {
@ -682,12 +682,13 @@ int GetIdentityHashHelper(JSReceiver object) {
if (properties.IsPropertyArray()) {
return PropertyArray::cast(properties).Hash();
}
if (V8_DICT_MODE_PROTOTYPES_BOOL && properties.IsSwissNameDictionary()) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL &&
properties.IsSwissNameDictionary()) {
return SwissNameDictionary::cast(properties).Hash();
}
if (properties.IsNameDictionary()) {
DCHECK(!V8_DICT_MODE_PROTOTYPES_BOOL);
DCHECK(!V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL);
return NameDictionary::cast(properties).Hash();
}
@ -786,7 +787,7 @@ void JSReceiver::DeleteNormalizedProperty(Handle<JSReceiver> object,
cell->ClearAndInvalidate(ReadOnlyRoots(isolate));
} else {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
Handle<SwissNameDictionary> dictionary(
object->property_dictionary_swiss(), isolate);
@ -2136,7 +2137,7 @@ MaybeHandle<JSObject> JSObject::New(Handle<JSFunction> constructor,
ASSIGN_RETURN_ON_EXCEPTION(
isolate, initial_map,
JSFunction::GetDerivedMap(isolate, constructor, new_target), JSObject);
int initial_capacity = V8_DICT_MODE_PROTOTYPES_BOOL
int initial_capacity = V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL
? SwissNameDictionary::kInitialCapacity
: NameDictionary::kInitialCapacity;
Handle<JSObject> result = isolate->factory()->NewFastOrSlowJSObjectFromMap(
@ -2468,7 +2469,7 @@ void JSObject::SetNormalizedProperty(Handle<JSObject> object, Handle<Name> name,
DCHECK_EQ(dictionary->CellAt(entry).value(), *value);
}
} else {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
Handle<SwissNameDictionary> dictionary(
object->property_dictionary_swiss(), isolate);
InternalIndex entry = dictionary->FindEntry(isolate, *name);
@ -2968,7 +2969,7 @@ void MigrateFastToSlow(Isolate* isolate, Handle<JSObject> object,
property_count += expected_additional_properties;
} else {
// Make space for two more properties.
int initial_capacity = V8_DICT_MODE_PROTOTYPES_BOOL
int initial_capacity = V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL
? SwissNameDictionary::kInitialCapacity
: NameDictionary::kInitialCapacity;
property_count += initial_capacity;
@ -2976,7 +2977,7 @@ void MigrateFastToSlow(Isolate* isolate, Handle<JSObject> object,
Handle<NameDictionary> dictionary;
Handle<SwissNameDictionary> ord_dictionary;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
ord_dictionary = isolate->factory()->NewSwissNameDictionary(property_count);
} else {
dictionary = isolate->factory()->NewNameDictionary(property_count);
@ -3011,7 +3012,7 @@ void MigrateFastToSlow(Isolate* isolate, Handle<JSObject> object,
: PropertyConstness::kMutable;
PropertyDetails d(details.kind(), details.attributes(), constness);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
ord_dictionary =
SwissNameDictionary::Add(isolate, ord_dictionary, key, value, d);
} else {
@ -3019,7 +3020,7 @@ void MigrateFastToSlow(Isolate* isolate, Handle<JSObject> object,
}
}
if (!V8_DICT_MODE_PROTOTYPES_BOOL) {
if (!V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
// Copy the next enumeration index from instance descriptor.
dictionary->set_next_enumeration_index(real_size + 1);
}
@ -3044,7 +3045,7 @@ void MigrateFastToSlow(Isolate* isolate, Handle<JSObject> object,
// the left-over space to avoid races with the sweeper thread.
object->synchronized_set_map(*new_map);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
object->SetProperties(*ord_dictionary);
} else {
object->SetProperties(*dictionary);
@ -3421,7 +3422,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
Handle<NameDictionary> dictionary;
Handle<SwissNameDictionary> swiss_dictionary;
int number_of_elements;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
swiss_dictionary = handle(object->property_dictionary_swiss(), isolate);
number_of_elements = swiss_dictionary->NumberOfElements();
} else {
@ -3435,7 +3436,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
Handle<FixedArray> iteration_order;
int iteration_length;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
// |iteration_order| remains empty handle, we don't need it.
iteration_length = swiss_dictionary->UsedCapacity();
} else {
@ -3449,7 +3450,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
ReadOnlyRoots roots(isolate);
for (int i = 0; i < iteration_length; i++) {
PropertyKind kind;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
InternalIndex index(swiss_dictionary->EntryForEnumerationIndex(i));
Object key = swiss_dictionary->KeyAt(index);
if (!SwissNameDictionary::IsKey(roots, key)) {
@ -3524,7 +3525,7 @@ void JSObject::MigrateSlowToFast(Handle<JSObject> object,
Object value;
PropertyDetails details = PropertyDetails::Empty();
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
InternalIndex index(swiss_dictionary->EntryForEnumerationIndex(i));
Object key_obj = swiss_dictionary->KeyAt(index);
if (!SwissNameDictionary::IsKey(roots, key_obj)) {
@ -3797,7 +3798,7 @@ bool TestPropertiesIntegrityLevel(JSObject object, PropertyAttributes level) {
return TestFastPropertiesIntegrityLevel(object.map(), level);
}
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
return TestDictionaryPropertiesIntegrityLevel(
object.property_dictionary_swiss(), object.GetReadOnlyRoots(), level);
} else {
@ -4102,7 +4103,7 @@ Maybe<bool> JSObject::PreventExtensionsWithTransition(
isolate);
JSObject::ApplyAttributesToDictionary(isolate, roots, dictionary,
attrs);
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
Handle<SwissNameDictionary> dictionary(
object->property_dictionary_swiss(), isolate);
JSObject::ApplyAttributesToDictionary(isolate, roots, dictionary,
@ -4165,7 +4166,7 @@ Handle<Object> JSObject::DictionaryPropertyAt(Handle<JSObject> object,
InternalIndex dict_index) {
Isolate* isolate = object->GetIsolate();
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
SwissNameDictionary dict = object->property_dictionary_swiss();
return handle(dict.ValueAt(dict_index), isolate);
} else {
@ -4363,7 +4364,7 @@ Object JSObject::SlowReverseLookup(Object value) {
return JSGlobalObject::cast(*this)
.global_dictionary(kAcquireLoad)
.SlowReverseLookup(value);
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
return property_dictionary_swiss().SlowReverseLookup(GetIsolate(), value);
} else {
return property_dictionary().SlowReverseLookup(value);
@ -4464,7 +4465,7 @@ void JSObject::OptimizeAsPrototype(Handle<JSObject> object,
dict.DetailsAtPut(index, details);
}
};
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
make_constant(object->property_dictionary_swiss());
} else {
make_constant(object->property_dictionary());

View File

@ -44,12 +44,12 @@ class JSReceiver : public HeapObject {
// map.
DECL_GETTER(property_array, PropertyArray)
// Gets slow properties for non-global objects (if v8_dict_mode_prototypes is
// not set).
// Gets slow properties for non-global objects (if
// v8_enable_swiss_name_dictionary is not set).
DECL_GETTER(property_dictionary, NameDictionary)
// Gets slow properties for non-global objects (if v8_dict_mode_prototypes is
// set).
// Gets slow properties for non-global objects (if
// v8_enable_swiss_name_dictionary is set).
DECL_GETTER(property_dictionary_swiss, SwissNameDictionary)
// Sets the properties backing store and makes sure any existing hash is moved

View File

@ -65,7 +65,7 @@ Handle<JSRegExpResultIndices> JSRegExpResultIndices::BuildIndices(
Handle<FixedArray> names(Handle<FixedArray>::cast(maybe_names));
int num_names = names->length() >> 1;
Handle<HeapObject> group_names;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
group_names = isolate->factory()->NewSwissNameDictionary(num_names);
} else {
group_names = isolate->factory()->NewNameDictionary(num_names);
@ -81,7 +81,7 @@ Handle<JSRegExpResultIndices> JSRegExpResultIndices::BuildIndices(
if (!capture_indices->IsUndefined(isolate)) {
capture_indices = Handle<JSArray>::cast(capture_indices);
}
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
group_names = SwissNameDictionary::Add(
isolate, Handle<SwissNameDictionary>::cast(group_names), name,
capture_indices, PropertyDetails::Empty());

View File

@ -1003,7 +1003,7 @@ Maybe<bool> KeyAccumulator::CollectOwnPropertyNames(Handle<JSReceiver> receiver,
enum_keys = GetOwnEnumPropertyDictionaryKeys(
isolate_, mode_, this, object,
JSGlobalObject::cast(*object).global_dictionary(kAcquireLoad));
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
enum_keys = GetOwnEnumPropertyDictionaryKeys(
isolate_, mode_, this, object, object->property_dictionary_swiss());
} else {
@ -1042,7 +1042,7 @@ Maybe<bool> KeyAccumulator::CollectOwnPropertyNames(Handle<JSReceiver> receiver,
handle(JSGlobalObject::cast(*object).global_dictionary(kAcquireLoad),
isolate_),
this));
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
RETURN_NOTHING_IF_NOT_SUCCESSFUL(CollectKeysFromDictionary(
handle(object->property_dictionary_swiss(), isolate_), this));
} else {
@ -1067,7 +1067,7 @@ ExceptionStatus KeyAccumulator::CollectPrivateNames(Handle<JSReceiver> receiver,
handle(JSGlobalObject::cast(*object).global_dictionary(kAcquireLoad),
isolate_),
this));
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
RETURN_FAILURE_IF_NOT_SUCCESSFUL(CollectKeysFromDictionary(
handle(object->property_dictionary_swiss(), isolate_), this));
} else {
@ -1152,7 +1152,7 @@ Handle<FixedArray> KeyAccumulator::GetOwnEnumPropertyKeys(
return GetOwnEnumPropertyDictionaryKeys(
isolate, KeyCollectionMode::kOwnOnly, nullptr, object,
JSGlobalObject::cast(*object).global_dictionary(kAcquireLoad));
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
return GetOwnEnumPropertyDictionaryKeys(
isolate, KeyCollectionMode::kOwnOnly, nullptr, object,
object->property_dictionary_swiss());
@ -1186,7 +1186,7 @@ Maybe<bool> KeyAccumulator::CollectOwnJSProxyKeys(Handle<JSReceiver> receiver,
Handle<JSProxy> proxy) {
STACK_CHECK(isolate_, Nothing<bool>());
if (filter_ == PRIVATE_NAMES_ONLY) {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
RETURN_NOTHING_IF_NOT_SUCCESSFUL(CollectKeysFromDictionary(
handle(proxy->property_dictionary_swiss(), isolate_), this));
} else {

View File

@ -404,7 +404,7 @@ class ObjectDescriptor {
void CreateTemplates(LocalIsolate* isolate) {
auto* factory = isolate->factory();
descriptor_array_template_ = factory->empty_descriptor_array();
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
properties_dictionary_template_ =
factory->empty_swiss_property_dictionary();
} else {
@ -414,7 +414,7 @@ class ObjectDescriptor {
if (HasDictionaryProperties()) {
int need_space_for =
property_count_ + computed_count_ + property_slack_;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
properties_dictionary_template_ =
isolate->factory()->NewSwissNameDictionary(need_space_for,
AllocationType::kOld);
@ -449,11 +449,12 @@ class ObjectDescriptor {
DCHECK(!value->IsAccessorPair());
if (HasDictionaryProperties()) {
PropertyKind kind = is_accessor ? i::kAccessor : i::kData;
int enum_order = V8_DICT_MODE_PROTOTYPES_BOOL ? kDummyEnumerationIndex
: next_enumeration_index_++;
int enum_order = V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL
? kDummyEnumerationIndex
: next_enumeration_index_++;
PropertyDetails details(kind, attribs, PropertyCellType::kNoCell,
enum_order);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
properties_dictionary_template_ =
DictionaryAddNoUpdateNextEnumerationIndex(
isolate, properties_ordered_dictionary_template(), name, value,
@ -478,7 +479,7 @@ class ObjectDescriptor {
Smi value = Smi::FromInt(value_index);
if (HasDictionaryProperties()) {
UpdateNextEnumerationIndex(value_index);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
AddToDictionaryTemplate(isolate,
properties_ordered_dictionary_template(), name,
value_index, value_kind, value);
@ -518,7 +519,7 @@ class ObjectDescriptor {
void Finalize(LocalIsolate* isolate) {
if (HasDictionaryProperties()) {
DCHECK_EQ(current_computed_index_, computed_properties_->length());
if (!V8_DICT_MODE_PROTOTYPES_BOOL) {
if (!V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
properties_dictionary_template()->set_next_enumeration_index(
next_enumeration_index_);
}

View File

@ -381,7 +381,7 @@ void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
// that's only for the case that the existing map is a fast mode map.
// Therefore, we need to perform the necessary updates to the property
// details and the prototype validity cell directly.
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
SwissNameDictionary dict = holder->property_dictionary_swiss();
dict.DetailsAtPut(dictionary_entry(), property_details_);
} else {
@ -433,7 +433,7 @@ void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
property_details_ =
property_details_.CopyWithConstness(PropertyConstness::kMutable);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
SwissNameDictionary dict = holder_obj->property_dictionary_swiss();
dict.DetailsAtPut(dictionary_entry(), property_details_);
} else {
@ -507,7 +507,7 @@ void LookupIterator::ReconfigureDataProperty(Handle<Object> value,
DCHECK_EQ(cell->value(), *value);
} else {
PropertyDetails details(kData, attributes, PropertyConstness::kMutable);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
Handle<SwissNameDictionary> dictionary(
holder_obj->property_dictionary_swiss(isolate_), isolate());
dictionary->ValueAtPut(dictionary_entry(), *value);
@ -650,7 +650,7 @@ void LookupIterator::ApplyTransitionToDataProperty(
receiver->IsJSObject(isolate_)) {
JSObject::InvalidatePrototypeChains(receiver->map(isolate_));
}
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
Handle<SwissNameDictionary> dictionary(
receiver->property_dictionary_swiss(isolate_), isolate_);
@ -855,7 +855,7 @@ Handle<Object> LookupIterator::FetchValue(
result = holder->global_dictionary(isolate_, kAcquireLoad)
.ValueAt(isolate_, dictionary_entry());
} else if (!holder_->HasFastProperties(isolate_)) {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
result = holder_->property_dictionary_swiss(isolate_).ValueAt(
dictionary_entry());
} else {
@ -938,7 +938,7 @@ bool LookupIterator::IsConstDictValueEqualTo(Object value) const {
}
Handle<JSReceiver> holder = GetHolder<JSReceiver>();
Object current_value;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
SwissNameDictionary dict = holder->property_dictionary_swiss();
current_value = dict.ValueAt(dictionary_entry());
} else {
@ -1036,7 +1036,7 @@ void LookupIterator::WriteDataValue(Handle<Object> value,
property_details_.constness() == PropertyConstness::kConst,
holder->IsJSProxy(isolate_) || IsConstDictValueEqualTo(*value));
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
SwissNameDictionary dictionary =
holder->property_dictionary_swiss(isolate_);
dictionary.ValueAtPut(dictionary_entry(), *value);
@ -1187,7 +1187,7 @@ LookupIterator::State LookupIterator::LookupInRegularHolder(
property_details_ = descriptors.GetDetails(number_);
} else {
DCHECK_IMPLIES(holder.IsJSProxy(isolate_), name()->IsPrivate(isolate_));
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
SwissNameDictionary dict = holder.property_dictionary_swiss(isolate_);
number_ = dict.FindEntry(isolate(), *name_);
if (number_.is_not_found()) return NotFound(holder);

View File

@ -3576,7 +3576,7 @@ Maybe<bool> JSProxy::SetPrivateSymbol(Isolate* isolate, Handle<JSProxy> proxy,
}
PropertyDetails details(kData, DONT_ENUM, PropertyConstness::kMutable);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
Handle<SwissNameDictionary> dict(proxy->property_dictionary_swiss(),
isolate);
Handle<SwissNameDictionary> result =

View File

@ -344,7 +344,7 @@ PrimitiveHeapObject InferMethodName(Isolate* isolate, JSReceiver receiver,
name = InferMethodNameFromDictionary(
isolate, JSGlobalObject::cast(object).global_dictionary(kAcquireLoad),
fun, name);
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
name = InferMethodNameFromDictionary(
isolate, object.property_dictionary_swiss(), fun, name);
} else {

View File

@ -1377,7 +1377,7 @@ void V8HeapExplorer::ExtractPropertyReferences(JSObject js_obj,
PropertyDetails details = cell.property_details();
SetDataOrAccessorPropertyReference(details.kind(), entry, name, value);
}
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
} else if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
// SwissNameDictionary::IterateEntries creates a Handle, which should not
// leak out of here.
HandleScope scope(isolate);

View File

@ -528,7 +528,7 @@ bool InitClassPrototype(Isolate* isolate,
// Class prototypes do not have a name accessor.
const bool install_name_accessor = false;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
Handle<SwissNameDictionary> properties_dictionary_template =
Handle<SwissNameDictionary>::cast(properties_template);
return AddDescriptorsByTemplate(
@ -589,7 +589,7 @@ bool InitClassConstructor(
// All class constructors have a name accessor.
const bool install_name_accessor = true;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
Handle<SwissNameDictionary> properties_dictionary_template =
Handle<SwissNameDictionary>::cast(properties_template);

View File

@ -132,7 +132,7 @@ MaybeHandle<JSObject> JSObjectWalkVisitor<ContextObject>::StructureWalk(
}
}
} else {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
Handle<SwissNameDictionary> dict(
copy->property_dictionary_swiss(isolate), isolate);
for (InternalIndex i : dict->IterateEntries()) {

View File

@ -401,7 +401,7 @@ RUNTIME_FUNCTION(Runtime_AddDictionaryProperty) {
PropertyDetails property_details(
kData, NONE, PropertyDetails::kConstIfDictConstnessTracking);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
Handle<SwissNameDictionary> dictionary(
receiver->property_dictionary_swiss(), isolate);
dictionary = SwissNameDictionary::Add(isolate, dictionary, name, value,
@ -680,7 +680,7 @@ RUNTIME_FUNCTION(Runtime_GetProperty) {
}
} else if (!holder->HasFastProperties()) {
// Attempt dictionary lookup.
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
SwissNameDictionary dictionary = holder->property_dictionary_swiss();
InternalIndex entry = dictionary.FindEntry(isolate, *key);
if (entry.is_found() &&

View File

@ -1891,7 +1891,7 @@ TEST(AllocateJSObjectFromMap) {
JSObject::NormalizeProperties(isolate, object, KEEP_INOBJECT_PROPERTIES, 0,
"Normalize");
Handle<HeapObject> properties =
V8_DICT_MODE_PROTOTYPES_BOOL
V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL
? Handle<HeapObject>(object->property_dictionary_swiss(), isolate)
: handle(object->property_dictionary(), isolate);
Handle<JSObject> result = Handle<JSObject>::cast(
@ -1899,7 +1899,7 @@ TEST(AllocateJSObjectFromMap) {
handle(object->elements(), isolate))
.ToHandleChecked());
CHECK_EQ(result->map(), object->map());
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
CHECK_EQ(result->property_dictionary_swiss(),
object->property_dictionary_swiss());
} else {

View File

@ -29,7 +29,7 @@ int AddToSetAndGetHash(Isolate* isolate, Handle<JSObject> obj,
}
int GetPropertyDictionaryHash(Handle<JSObject> obj) {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
return obj->property_dictionary_swiss().Hash();
} else {
return obj->property_dictionary().Hash();
@ -37,7 +37,7 @@ int GetPropertyDictionaryHash(Handle<JSObject> obj) {
}
int GetPropertyDictionaryLength(Handle<JSObject> obj) {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
return obj->property_dictionary_swiss().Capacity();
} else {
return obj->property_dictionary().length();
@ -45,7 +45,7 @@ int GetPropertyDictionaryLength(Handle<JSObject> obj) {
}
void CheckIsDictionaryModeObject(Handle<JSObject> obj) {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
if (V8_ENABLE_SWISS_NAME_DICTIONARY_BOOL) {
CHECK(obj->raw_properties_or_hash().IsSwissNameDictionary());
} else {
CHECK(obj->raw_properties_or_hash().IsNameDictionary());