Commit 8d62d4be authored by Frank Emrich's avatar Frank Emrich Committed by Commit Bot

[dict-proto] Rollout of SwissNameDictionary in CSA

This CL evokes that when v8_dict_mode_prototypes is enabled,
SwissNameDictionary is used in CSA as the dictionary backing store
for all objects (instead of NameDictionary).

Bug: v8:11330
Change-Id: I2bda0ec60040981f07e0e51aaf772ac1bb8bbc06
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2786856Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73690}
parent e292db5d
......@@ -537,7 +537,7 @@ TNode<HeapObject> ConstructorBuiltinsAssembler::CreateShallowObjectLiteral(
TNode<Map> boilerplate_map = LoadMap(boilerplate);
CSA_ASSERT(this, IsJSObjectMap(boilerplate_map));
TVARIABLE(FixedArray, var_properties);
TVARIABLE(HeapObject, var_properties);
{
TNode<Uint32T> bit_field_3 = LoadMapBitField3(boilerplate_map);
GotoIf(IsSetWord32<Map::Bits3::IsDeprecatedBit>(bit_field_3), call_runtime);
......@@ -547,14 +547,14 @@ TNode<HeapObject> ConstructorBuiltinsAssembler::CreateShallowObjectLiteral(
&if_dictionary, &if_fast);
BIND(&if_dictionary);
{
Comment("Copy dictionary properties");
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), call_runtime);
var_properties =
CopySwissNameDictionary(CAST(LoadSlowProperties(boilerplate)));
} else {
var_properties = CopyNameDictionary(
CAST(LoadSlowProperties(boilerplate)), call_runtime);
}
Comment("Copy dictionary properties");
var_properties = CopyNameDictionary(CAST(LoadSlowProperties(boilerplate)),
call_runtime);
// Slow objects have no in-object properties.
Goto(&done);
}
......
......@@ -521,11 +521,6 @@ TF_BUILTIN(DeleteProperty, DeletePropertyBaseAssembler) {
Label if_index(this, &var_index), if_unique_name(this), if_notunique(this),
if_notfound(this), slow(this), if_proxy(this);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &slow);
}
GotoIf(TaggedIsSmi(receiver), &slow);
TNode<Map> receiver_map = LoadMap(CAST(receiver));
TNode<Uint16T> instance_type = LoadMapInstanceType(receiver_map);
......@@ -556,7 +551,7 @@ TF_BUILTIN(DeleteProperty, DeletePropertyBaseAssembler) {
{
InvalidateValidityCellIfPrototype(receiver_map);
TNode<NameDictionary> properties =
TNode<PropertyDictionary> properties =
CAST(LoadSlowProperties(CAST(receiver)));
DeleteDictionaryProperty(CAST(receiver), properties, var_unique.value(),
context, &dont_delete, &if_notfound);
......@@ -991,11 +986,6 @@ TF_BUILTIN(GetProperty, CodeStubAssembler) {
Label if_notfound(this), if_proxy(this, Label::kDeferred),
if_slow(this, Label::kDeferred);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &if_slow);
}
CodeStubAssembler::LookupPropertyInHolder lookup_property_in_holder =
[=](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
......@@ -1051,11 +1041,6 @@ TF_BUILTIN(GetPropertyWithReceiver, CodeStubAssembler) {
Label if_notfound(this), if_proxy(this, Label::kDeferred),
if_slow(this, Label::kDeferred);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &if_slow);
}
CodeStubAssembler::LookupPropertyInHolder lookup_property_in_holder =
[=](TNode<HeapObject> receiver, TNode<HeapObject> holder,
TNode<Map> holder_map, TNode<Int32T> holder_instance_type,
......
......@@ -1033,11 +1033,6 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) {
Label call_runtime(this, Label::kDeferred), prototype_valid(this),
no_properties(this);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &call_runtime);
}
{
Comment("Argument 1 check: prototype");
GotoIf(IsNull(prototype), &prototype_valid);
......@@ -1284,10 +1279,6 @@ TF_BUILTIN(ObjectGetOwnPropertyDescriptor, ObjectBuiltinsAssembler) {
Label if_keyisindex(this), if_iskeyunique(this),
call_runtime(this, Label::kDeferred),
return_undefined(this, Label::kDeferred), if_notunique_name(this);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &call_runtime);
}
TNode<Map> map = LoadMap(object);
TNode<Uint16T> instance_type = LoadMapInstanceType(map);
......@@ -1371,14 +1362,8 @@ void ObjectBuiltinsAssembler::AddToDictionaryIf(
Label done(this);
GotoIfNot(condition, &done);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
CallRuntime(Runtime::kAddDictionaryProperty, context, object,
HeapConstant(name), value);
} else {
Add<NameDictionary>(CAST(name_dictionary), HeapConstant(name), value,
bailout);
}
Add<PropertyDictionary>(CAST(name_dictionary), HeapConstant(name), value,
bailout);
Goto(&done);
BIND(&done);
......@@ -1479,12 +1464,9 @@ TNode<JSObject> ObjectBuiltinsAssembler::FromPropertyDescriptor(
js_descriptor = js_desc;
Goto(&return_desc);
if (!V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) make unconditional once SwissNameDictionary supported.
BIND(&bailout);
CSA_ASSERT(this, Int32Constant(0));
Unreachable();
}
BIND(&bailout);
CSA_ASSERT(this, Int32Constant(0));
Unreachable();
}
BIND(&return_desc);
......
......@@ -363,28 +363,18 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::ConstructNewResultFromMatchInfo(
// - Receiver is extensible
// - Receiver has no interceptors
Label add_dictionary_property_slow(this, Label::kDeferred);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
CallRuntime(Runtime::kAddDictionaryProperty, context, group_object,
name, capture);
} else {
Add<NameDictionary>(CAST(properties), name, capture,
&add_dictionary_property_slow);
}
Add<PropertyDictionary>(CAST(properties), name, capture,
&add_dictionary_property_slow);
var_i = i_plus_2;
Branch(IntPtrGreaterThanOrEqual(var_i.value(), names_length),
&maybe_build_indices, &loop);
if (!V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) make unconditional once SwissNameDictionary
// supported.
BIND(&add_dictionary_property_slow);
// If the dictionary needs resizing, the above Add call will jump here
// before making any changes. This shouldn't happen because we allocated
// the dictionary with enough space above.
Unreachable();
}
BIND(&add_dictionary_property_slow);
// If the dictionary needs resizing, the above Add call will jump here
// before making any changes. This shouldn't happen because we allocated
// the dictionary with enough space above.
Unreachable();
}
}
......
......@@ -8491,6 +8491,31 @@ void CodeStubAssembler::Add(TNode<Dictionary> dictionary, TNode<Name> key,
enum_index);
}
template <>
void CodeStubAssembler::Add(TNode<SwissNameDictionary> dictionary,
TNode<Name> key, TNode<Object> value,
Label* bailout) {
PropertyDetails d(kData, NONE,
PropertyDetails::kConstIfDictConstnessTracking);
PropertyDetails d_dont_enum(kData, DONT_ENUM,
PropertyDetails::kConstIfDictConstnessTracking);
TNode<Uint8T> details_byte_enum =
UncheckedCast<Uint8T>(Uint32Constant(d.ToByte()));
TNode<Uint8T> details_byte_dont_enum =
UncheckedCast<Uint8T>(Uint32Constant(d_dont_enum.ToByte()));
Label not_private(this);
TVARIABLE(Uint8T, var_details, details_byte_enum);
GotoIfNot(IsPrivateSymbol(key), &not_private);
var_details = details_byte_dont_enum;
Goto(&not_private);
BIND(&not_private);
SwissNameDictionaryAdd(dictionary, key, value, var_details.value(), bailout);
}
template void CodeStubAssembler::Add<NameDictionary>(TNode<NameDictionary>,
TNode<Name>, TNode<Object>,
Label*);
......@@ -8505,9 +8530,10 @@ TNode<Smi> CodeStubAssembler::GetNumberOfElements(
template <>
TNode<Smi> CodeStubAssembler::GetNumberOfElements(
TNode<SwissNameDictionary> dictionary) {
// TOOD(v8:11330) Dummy implementation until real version exists.
return CallRuntime<Smi>(Runtime::kSwissTableElementsCount,
NoContextConstant(), dictionary);
TNode<IntPtrT> capacity =
ChangeInt32ToIntPtr(LoadSwissNameDictionaryCapacity(dictionary));
return SmiFromIntPtr(
LoadSwissNameDictionaryNumberOfElements(dictionary, capacity));
}
template TNode<Smi> CodeStubAssembler::GetNumberOfElements(
......@@ -8824,13 +8850,8 @@ void CodeStubAssembler::ForEachEnumerableOwnProperty(
}
BIND(&if_found_dict);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167, v8:11177) Only here due to SetDataProperties
// workaround.
GotoIf(Int32TrueConstant(), bailout);
}
TNode<NameDictionary> dictionary = CAST(var_meta_storage.value());
TNode<PropertyDictionary> dictionary =
CAST(var_meta_storage.value());
TNode<IntPtrT> entry = var_entry.value();
TNode<Uint32T> details = LoadDetailsByKeyIndex(dictionary, entry);
......@@ -8840,7 +8861,8 @@ void CodeStubAssembler::ForEachEnumerableOwnProperty(
&next_iteration);
var_details = details;
var_value = LoadValueByKeyIndex<NameDictionary>(dictionary, entry);
var_value =
LoadValueByKeyIndex<PropertyDictionary>(dictionary, entry);
Goto(&if_found);
}
......@@ -9029,19 +9051,11 @@ void CodeStubAssembler::TryLookupPropertyInSimpleObject(
}
BIND(&if_isslowmap);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
TNode<SwissNameDictionary> dictionary = CAST(LoadSlowProperties(object));
*var_meta_storage = dictionary;
NameDictionaryLookup<SwissNameDictionary>(
dictionary, unique_name, if_found_dict, var_name_index, if_not_found);
} else {
TNode<NameDictionary> dictionary = CAST(LoadSlowProperties(object));
*var_meta_storage = dictionary;
TNode<PropertyDictionary> dictionary = CAST(LoadSlowProperties(object));
*var_meta_storage = dictionary;
NameDictionaryLookup<NameDictionary>(
dictionary, unique_name, if_found_dict, var_name_index, if_not_found);
}
NameDictionaryLookup<PropertyDictionary>(
dictionary, unique_name, if_found_dict, var_name_index, if_not_found);
}
}
......@@ -9265,8 +9279,9 @@ void CodeStubAssembler::LoadPropertyFromFastObject(
Comment("] LoadPropertyFromFastObject");
}
void CodeStubAssembler::LoadPropertyFromNameDictionary(
TNode<NameDictionary> dictionary, TNode<IntPtrT> name_index,
template <typename Dictionary>
void CodeStubAssembler::LoadPropertyFromDictionary(
TNode<Dictionary> dictionary, TNode<IntPtrT> name_index,
TVariable<Uint32T>* var_details, TVariable<Object>* var_value) {
Comment("LoadPropertyFromNameDictionary");
*var_details = LoadDetailsByKeyIndex(dictionary, name_index);
......@@ -9275,23 +9290,6 @@ void CodeStubAssembler::LoadPropertyFromNameDictionary(
Comment("] LoadPropertyFromNameDictionary");
}
void CodeStubAssembler::LoadPropertyFromSwissNameDictionary(
TNode<SwissNameDictionary> dictionary, TNode<IntPtrT> name_index,
TVariable<Uint32T>* var_details, TVariable<Object>* var_value) {
Comment("[ LoadPropertyFromSwissNameDictionary");
// TOOD(v8:11330) Dummy implementation until real version exists.
TNode<Smi> details =
CallRuntime<Smi>(Runtime::kSwissTableDetailsAt, NoContextConstant(),
dictionary, SmiFromIntPtr(name_index));
*var_details = Unsigned(SmiToInt32(details));
*var_value =
CallRuntime<Object>(Runtime::kSwissTableValueAt, NoContextConstant(),
dictionary, SmiFromIntPtr(name_index));
Comment("] LoadPropertyFromSwissNameDictionary");
}
void CodeStubAssembler::LoadPropertyFromGlobalDictionary(
TNode<GlobalDictionary> dictionary, TNode<IntPtrT> name_index,
TVariable<Uint32T>* var_details, TVariable<Object>* var_value,
......@@ -9313,6 +9311,14 @@ void CodeStubAssembler::LoadPropertyFromGlobalDictionary(
Comment("] LoadPropertyFromGlobalDictionary");
}
template void CodeStubAssembler::LoadPropertyFromDictionary(
TNode<NameDictionary> dictionary, TNode<IntPtrT> name_index,
TVariable<Uint32T>* var_details, TVariable<Object>* var_value);
template void CodeStubAssembler::LoadPropertyFromDictionary(
TNode<SwissNameDictionary> dictionary, TNode<IntPtrT> name_index,
TVariable<Uint32T>* var_details, TVariable<Object>* var_value);
// |value| is the property backing store's contents, which is either a value or
// an accessor pair, as specified by |details|. |holder| is a JSObject or a
// PropertyCell (TODO: use UnionT). Returns either the original value, or the
......@@ -9475,16 +9481,9 @@ void CodeStubAssembler::TryGetOwnProperty(
}
BIND(&if_found_dict);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
TNode<SwissNameDictionary> dictionary = CAST(var_meta_storage.value());
TNode<IntPtrT> entry = var_entry.value();
LoadPropertyFromSwissNameDictionary(dictionary, entry, var_details,
var_value);
} else {
TNode<NameDictionary> dictionary = CAST(var_meta_storage.value());
TNode<IntPtrT> entry = var_entry.value();
LoadPropertyFromNameDictionary(dictionary, entry, var_details, var_value);
}
TNode<PropertyDictionary> dictionary = CAST(var_meta_storage.value());
TNode<IntPtrT> entry = var_entry.value();
LoadPropertyFromDictionary(dictionary, entry, var_details, var_value);
Goto(&if_found);
}
......@@ -12974,11 +12973,6 @@ TNode<Oddball> CodeStubAssembler::HasProperty(TNode<Context> context,
Label call_runtime(this, Label::kDeferred), return_true(this),
return_false(this), end(this), if_proxy(this, Label::kDeferred);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &call_runtime);
}
CodeStubAssembler::LookupPropertyInHolder lookup_property_in_holder =
[this, &return_true](
TNode<HeapObject> receiver, TNode<HeapObject> holder,
......
......@@ -2869,12 +2869,18 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
template <class Dictionary>
void SetNumberOfElements(TNode<Dictionary> dictionary,
TNode<Smi> num_elements_smi) {
// Not supposed to be used for SwissNameDictionary.
STATIC_ASSERT(!(std::is_same<Dictionary, SwissNameDictionary>::value));
StoreFixedArrayElement(dictionary, Dictionary::kNumberOfElementsIndex,
num_elements_smi, SKIP_WRITE_BARRIER);
}
template <class Dictionary>
TNode<Smi> GetNumberOfDeletedElements(TNode<Dictionary> dictionary) {
// Not supposed to be used for SwissNameDictionary.
STATIC_ASSERT(!(std::is_same<Dictionary, SwissNameDictionary>::value));
return CAST(LoadFixedArrayElement(
dictionary, Dictionary::kNumberOfDeletedElementsIndex));
}
......@@ -2882,6 +2888,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
template <class Dictionary>
void SetNumberOfDeletedElements(TNode<Dictionary> dictionary,
TNode<Smi> num_deleted_smi) {
// Not supposed to be used for SwissNameDictionary.
STATIC_ASSERT(!(std::is_same<Dictionary, SwissNameDictionary>::value));
StoreFixedArrayElement(dictionary,
Dictionary::kNumberOfDeletedElementsIndex,
num_deleted_smi, SKIP_WRITE_BARRIER);
......@@ -2889,6 +2898,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
template <class Dictionary>
TNode<Smi> GetCapacity(TNode<Dictionary> dictionary) {
// Not supposed to be used for SwissNameDictionary.
STATIC_ASSERT(!(std::is_same<Dictionary, SwissNameDictionary>::value));
return CAST(
UnsafeLoadFixedArrayElement(dictionary, Dictionary::kCapacityIndex));
}
......@@ -3029,13 +3041,11 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<IntPtrT> name_index, TNode<Uint32T>,
TVariable<Object>* var_value);
void LoadPropertyFromNameDictionary(TNode<NameDictionary> dictionary,
TNode<IntPtrT> name_index,
TVariable<Uint32T>* var_details,
TVariable<Object>* var_value);
void LoadPropertyFromSwissNameDictionary(
TNode<SwissNameDictionary> dictionary, TNode<IntPtrT> name_index,
TVariable<Uint32T>* var_details, TVariable<Object>* var_value);
template <typename Dictionary>
void LoadPropertyFromDictionary(TNode<Dictionary> dictionary,
TNode<IntPtrT> name_index,
TVariable<Uint32T>* var_details,
TVariable<Object>* var_value);
void LoadPropertyFromGlobalDictionary(TNode<GlobalDictionary> dictionary,
TNode<IntPtrT> name_index,
TVariable<Uint32T>* var_details,
......
......@@ -529,17 +529,18 @@ void AccessorAssembler::HandleLoadICSmiHandlerLoadNamedCase(
BIND(&normal);
{
Comment("load_normal");
TNode<NameDictionary> properties = CAST(LoadSlowProperties(CAST(holder)));
TNode<PropertyDictionary> properties =
CAST(LoadSlowProperties(CAST(holder)));
TVARIABLE(IntPtrT, var_name_index);
Label found(this, &var_name_index);
NameDictionaryLookup<NameDictionary>(properties, CAST(p->name()), &found,
&var_name_index, miss);
NameDictionaryLookup<PropertyDictionary>(properties, CAST(p->name()),
&found, &var_name_index, miss);
BIND(&found);
{
TVARIABLE(Uint32T, var_details);
TVARIABLE(Object, var_value);
LoadPropertyFromNameDictionary(properties, var_name_index.value(),
&var_details, &var_value);
LoadPropertyFromDictionary<PropertyDictionary>(
properties, var_name_index.value(), &var_details, &var_value);
TNode<Object> value = CallGetterIfAccessor(
var_value.value(), CAST(holder), var_details.value(), p->context(),
p->receiver(), miss);
......@@ -740,11 +741,12 @@ void AccessorAssembler::HandleLoadICSmiHandlerHasNamedCase(
BIND(&normal);
{
Comment("has_normal");
TNode<NameDictionary> properties = CAST(LoadSlowProperties(CAST(holder)));
TNode<PropertyDictionary> properties =
CAST(LoadSlowProperties(CAST(holder)));
TVARIABLE(IntPtrT, var_name_index);
Label found(this);
NameDictionaryLookup<NameDictionary>(properties, CAST(p->name()), &found,
&var_name_index, miss);
NameDictionaryLookup<PropertyDictionary>(properties, CAST(p->name()),
&found, &var_name_index, miss);
BIND(&found);
exit_point->Return(TrueConstant());
......@@ -859,11 +861,6 @@ TNode<Object> AccessorAssembler::HandleProtoHandler(
BIND(&if_lookup_on_lookup_start_object);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), miss);
}
// Dictionary lookup on lookup start object is not necessary for
// Load/StoreGlobalIC (which is the only case when the
// lookup_start_object can be a JSGlobalObject) because prototype
......@@ -873,12 +870,12 @@ TNode<Object> AccessorAssembler::HandleProtoHandler(
Word32BinaryNot(HasInstanceType(
CAST(p->lookup_start_object()), JS_GLOBAL_OBJECT_TYPE)));
TNode<NameDictionary> properties =
TNode<PropertyDictionary> properties =
CAST(LoadSlowProperties(CAST(p->lookup_start_object())));
TVARIABLE(IntPtrT, var_name_index);
Label found(this, &var_name_index);
NameDictionaryLookup<NameDictionary>(properties, CAST(p->name()),
&found, &var_name_index, &done);
NameDictionaryLookup<PropertyDictionary>(
properties, CAST(p->name()), &found, &var_name_index, &done);
BIND(&found);
{
if (on_found_on_lookup_start_object) {
......@@ -905,14 +902,14 @@ void AccessorAssembler::HandleLoadICProtoHandler(
// Code sub-handlers are not expected in LoadICs, so no |on_code_handler|.
nullptr,
// on_found_on_lookup_start_object
[=](TNode<NameDictionary> properties, TNode<IntPtrT> name_index) {
[=](TNode<PropertyDictionary> properties, TNode<IntPtrT> name_index) {
if (access_mode == LoadAccessMode::kHas) {
exit_point->Return(TrueConstant());
} else {
TVARIABLE(Uint32T, var_details);
TVARIABLE(Object, var_value);
LoadPropertyFromNameDictionary(properties, name_index, &var_details,
&var_value);
LoadPropertyFromDictionary<PropertyDictionary>(
properties, name_index, &var_details, &var_value);
TNode<Object> value = CallGetterIfAccessor(
var_value.value(), CAST(var_holder->value()), var_details.value(),
p->context(), p->receiver(), miss);
......@@ -1051,11 +1048,12 @@ void AccessorAssembler::HandleStoreICHandlerCase(
&if_slow);
CSA_ASSERT(this,
Word32Equal(handler_kind, Int32Constant(StoreHandler::kNormal)));
TNode<NameDictionary> properties = CAST(LoadSlowProperties(CAST(holder)));
TNode<PropertyDictionary> properties =
CAST(LoadSlowProperties(CAST(holder)));
TVARIABLE(IntPtrT, var_name_index);
Label dictionary_found(this, &var_name_index);
NameDictionaryLookup<NameDictionary>(
NameDictionaryLookup<PropertyDictionary>(
properties, CAST(p->name()), &dictionary_found, &var_name_index, miss);
BIND(&dictionary_found);
{
......@@ -1072,8 +1070,8 @@ void AccessorAssembler::HandleStoreICHandlerCase(
GotoIf(IsPropertyDetailsConst(details), &if_constant);
}
StoreValueByKeyIndex<NameDictionary>(properties, var_name_index.value(),
p->value());
StoreValueByKeyIndex<PropertyDictionary>(
properties, var_name_index.value(), p->value());
Return(p->value());
if (V8_DICT_PROPERTY_CONST_TRACKING_BOOL) {
......@@ -1552,7 +1550,7 @@ void AccessorAssembler::HandleStoreICProtoHandler(
TNode<Object> smi_handler = HandleProtoHandler<StoreHandler>(
p, handler, on_code_handler,
// on_found_on_lookup_start_object
[=](TNode<NameDictionary> properties, TNode<IntPtrT> name_index) {
[=](TNode<PropertyDictionary> properties, TNode<IntPtrT> name_index) {
TNode<Uint32T> details = LoadDetailsByKeyIndex(properties, name_index);
// Check that the property is a writable data property (no accessor).
const int kTypeAndReadOnlyMask =
......@@ -1561,8 +1559,8 @@ void AccessorAssembler::HandleStoreICProtoHandler(
STATIC_ASSERT(kData == 0);
GotoIf(IsSetWord32(details, kTypeAndReadOnlyMask), miss);
StoreValueByKeyIndex<NameDictionary>(properties, name_index,
p->value());
StoreValueByKeyIndex<PropertyDictionary>(properties, name_index,
p->value());
Return(p->value());
},
miss, ic_mode);
......@@ -1633,9 +1631,9 @@ void AccessorAssembler::HandleStoreICProtoHandler(
TNode<Map> receiver_map = LoadMap(CAST(p->receiver()));
InvalidateValidityCellIfPrototype(receiver_map);
TNode<NameDictionary> properties =
TNode<PropertyDictionary> properties =
CAST(LoadSlowProperties(CAST(p->receiver())));
Add<NameDictionary>(properties, CAST(p->name()), p->value(), &slow);
Add<PropertyDictionary>(properties, CAST(p->name()), p->value(), &slow);
Return(p->value());
BIND(&slow);
......@@ -2439,26 +2437,21 @@ void AccessorAssembler::GenericPropertyLoad(
BIND(&if_property_dictionary);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), slow);
}
Comment("dictionary property load");
// We checked for LAST_CUSTOM_ELEMENTS_RECEIVER before, which rules out
// seeing global objects here (which would need special handling).
TVARIABLE(IntPtrT, var_name_index);
Label dictionary_found(this, &var_name_index);
TNode<NameDictionary> properties =
TNode<PropertyDictionary> properties =
CAST(LoadSlowProperties(CAST(lookup_start_object)));
NameDictionaryLookup<NameDictionary>(properties, name, &dictionary_found,
&var_name_index,
&lookup_prototype_chain);
NameDictionaryLookup<PropertyDictionary>(properties, name,
&dictionary_found, &var_name_index,
&lookup_prototype_chain);
BIND(&dictionary_found);
{
LoadPropertyFromNameDictionary(properties, var_name_index.value(),
&var_details, &var_value);
LoadPropertyFromDictionary<PropertyDictionary>(
properties, var_name_index.value(), &var_details, &var_value);
Goto(&if_found_on_lookup_start_object);
}
}
......
......@@ -430,7 +430,7 @@ class V8_EXPORT_PRIVATE AccessorAssembler : public CodeStubAssembler {
using OnCodeHandler = std::function<void(TNode<Code> code_handler)>;
using OnFoundOnLookupStartObject = std::function<void(
TNode<NameDictionary> properties, TNode<IntPtrT> name_index)>;
TNode<PropertyDictionary> properties, TNode<IntPtrT> name_index)>;
template <typename ICHandler, typename ICParameters>
TNode<Object> HandleProtoHandler(
......
......@@ -29,8 +29,6 @@ LoadHandler::Kind LoadHandler::GetHandlerKind(Smi smi_handler) {
}
Handle<Smi> LoadHandler::LoadNormal(Isolate* isolate) {
// TODO(v8:11167) remove DCHECK once SwissNameDictionary supported.
DCHECK(!V8_DICT_MODE_PROTOTYPES_BOOL);
int config = KindBits::encode(kNormal);
return handle(Smi::FromInt(config), isolate);
}
......@@ -130,8 +128,6 @@ Handle<Smi> StoreHandler::StoreGlobalProxy(Isolate* isolate) {
}
Handle<Smi> StoreHandler::StoreNormal(Isolate* isolate) {
// TODO(v8:11167) remove DCHECK once SwissNameDictionary supported.
DCHECK(!V8_DICT_MODE_PROTOTYPES_BOOL);
int config = KindBits::encode(kNormal);
return handle(Smi::FromInt(config), isolate);
}
......
......@@ -116,9 +116,6 @@ Handle<Object> LoadHandler::LoadFromPrototype(
Isolate* isolate, Handle<Map> lookup_start_object_map,
Handle<JSReceiver> holder, Handle<Smi> smi_handler,
MaybeObjectHandle maybe_data1, MaybeObjectHandle maybe_data2) {
// TODO(v8:11167) remove DCHECK once SwissNameDictionary supported.
DCHECK_IMPLIES(V8_DICT_MODE_PROTOTYPES_BOOL,
GetHandlerKind(*smi_handler) != Kind::kNormal);
MaybeObjectHandle data1;
if (maybe_data1.is_null()) {
data1 = MaybeObjectHandle::Weak(holder);
......@@ -274,10 +271,6 @@ Handle<Object> StoreHandler::StoreThroughPrototype(
Isolate* isolate, Handle<Map> receiver_map, Handle<JSReceiver> holder,
Handle<Smi> smi_handler, MaybeObjectHandle maybe_data1,
MaybeObjectHandle maybe_data2) {
// TODO(v8:11167) remove DCHECK once SwissNameDictionary supported.
DCHECK_IMPLIES(V8_DICT_MODE_PROTOTYPES_BOOL,
KindBits::decode(smi_handler->value()) != Kind::kNormal);
MaybeObjectHandle data1;
if (maybe_data1.is_null()) {
data1 = MaybeObjectHandle::Weak(holder);
......
......@@ -927,12 +927,7 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
isolate(), map, holder, smi_handler,
MaybeObjectHandle::Weak(lookup->GetPropertyCell()));
} else {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once SwissNameDictionary supported.
smi_handler = LoadHandler::LoadSlow(isolate());
} else {
smi_handler = LoadHandler::LoadNormal(isolate());
}
smi_handler = LoadHandler::LoadNormal(isolate());
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadNormalDH);
if (holder_is_lookup_start_object) return smi_handler;
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadNormalFromPrototypeDH);
......@@ -982,12 +977,7 @@ Handle<Object> LoadIC::ComputeHandler(LookupIterator* lookup) {
isolate(), map, holder, smi_handler,
MaybeObjectHandle::Weak(lookup->GetPropertyCell()));
}
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once OrderedNameDictionary supported.
smi_handler = LoadHandler::LoadSlow(isolate());
} else {
smi_handler = LoadHandler::LoadNormal(isolate());
}
smi_handler = LoadHandler::LoadNormal(isolate());
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadNormalDH);
if (holder_is_lookup_start_object) return smi_handler;
TRACE_HANDLER_STATS(isolate(), LoadIC_LoadNormalFromPrototypeDH);
......@@ -1823,11 +1813,7 @@ MaybeObjectHandle StoreIC::ComputeHandler(LookupIterator* lookup) {
DCHECK_IMPLIES(!V8_DICT_PROPERTY_CONST_TRACKING_BOOL,
lookup->constness() == PropertyConstness::kMutable);
// TODO(v8:11167) don't create slow hanlder once SwissNameDictionary
// supported.
Handle<Smi> handler = V8_DICT_MODE_PROTOTYPES_BOOL
? StoreHandler::StoreSlow(isolate())
: StoreHandler::StoreNormal(isolate());
Handle<Smi> handler = StoreHandler::StoreNormal(isolate());
return MaybeObjectHandle(handler);
}
......
......@@ -638,7 +638,7 @@ void KeyedStoreGenericAssembler::LookupPropertyOnPrototypeChain(
BIND(&found_dict);
{
TNode<NameDictionary> dictionary = CAST(var_meta_storage.value());
TNode<PropertyDictionary> dictionary = CAST(var_meta_storage.value());
TNode<IntPtrT> entry = var_entry.value();
TNode<Uint32T> details = LoadDetailsByKeyIndex(dictionary, entry);
JumpIfDataProperty(details, &ok_to_write, readonly);
......@@ -827,19 +827,15 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore(
BIND(&dictionary_properties);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167, v8:11177) Only here due to SetDataProperties workaround.
GotoIf(Int32TrueConstant(), slow);
}
Comment("dictionary property store");
// We checked for LAST_CUSTOM_ELEMENTS_RECEIVER before, which rules out
// seeing global objects here (which would need special handling).
TVARIABLE(IntPtrT, var_name_index);
Label dictionary_found(this, &var_name_index), not_found(this);
TNode<NameDictionary> properties = CAST(LoadSlowProperties(receiver));
NameDictionaryLookup<NameDictionary>(properties, name, &dictionary_found,
&var_name_index, &not_found);
TNode<PropertyDictionary> properties = CAST(LoadSlowProperties(receiver));
NameDictionaryLookup<PropertyDictionary>(
properties, name, &dictionary_found, &var_name_index, &not_found);
BIND(&dictionary_found);
{
Label check_const(this), overwrite(this), done(this);
......@@ -877,8 +873,8 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore(
BIND(&overwrite);
{
CheckForAssociatedProtector(name, slow);
StoreValueByKeyIndex<NameDictionary>(properties, var_name_index.value(),
p->value());
StoreValueByKeyIndex<PropertyDictionary>(
properties, var_name_index.value(), p->value());
Goto(&done);
}
......@@ -916,8 +912,8 @@ void KeyedStoreGenericAssembler::EmitGenericPropertyStore(
}
Label add_dictionary_property_slow(this);
InvalidateValidityCellIfPrototype(receiver_map, bitfield3);
Add<NameDictionary>(properties, name, p->value(),
&add_dictionary_property_slow);
Add<PropertyDictionary>(properties, name, p->value(),
&add_dictionary_property_slow);
exit_point->Return(p->value());
BIND(&add_dictionary_property_slow);
......
......@@ -18,6 +18,13 @@
namespace v8 {
namespace internal {
#ifdef V8_DICT_MODE_PROTOTYPES
class SwissNameDictionary;
using PropertyDictionary = SwissNameDictionary;
#else
using PropertyDictionary = NameDictionary;
#endif
template <typename T>
class Handle;
......
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