Commit 416fae86 authored by Frank Emrich's avatar Frank Emrich Committed by Commit Bot

[dict-proto] SwissNameDictionary rollout in runtime code, pt. 3

This CL is part of a series that makes SwissNameDictionary available
as a new property backing store. Previously, the flag
v8_dict_mode_prototypes allows selecting between NameDictionary and
OrderedNameDictionary as the backing store used for all dictionary
mode objects. This series of CLs changes this such that enabling the
flag causes SwissNameDictionary being used instead of
OrderedNameDictionary. The behavior for when the flag is not set
remains unchanged (= use NameDictionary).

This particular CL just collects many small changes, including some
CSA changes where runtime calls are necessary.

Bug: v8:11388
Change-Id: I38fd18098fc641a5d92a986da251a6b3ac09411a
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2739642
Commit-Queue: Frank Emrich <emrich@google.com>
Reviewed-by: 's avatarMarja Hölttä <marja@chromium.org>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73257}
parent d0abf522
......@@ -454,8 +454,8 @@ extern enum PrimitiveType { kString, kBoolean, kSymbol, kNumber }
const kNameDictionaryInitialCapacity:
constexpr int32 generates 'NameDictionary::kInitialCapacity';
const kOrderedNameDictionaryInitialCapacity:
constexpr int32 generates 'OrderedNameDictionary::kInitialCapacity';
const kSwissNameDictionaryInitialCapacity:
constexpr int32 generates 'SwissNameDictionary::kInitialCapacity';
const kSwissNameDictionaryGroupWidth:
constexpr int32 generates 'SwissNameDictionary::kGroupWidth';
......@@ -686,6 +686,8 @@ extern macro CodeStubAssembler::AllocateNameDictionary(constexpr int32):
NameDictionary;
extern macro CodeStubAssembler::AllocateOrderedNameDictionary(constexpr int32):
OrderedNameDictionary;
extern macro CodeStubAssembler::AllocateSwissNameDictionary(constexpr int32):
SwissNameDictionary;
extern builtin ToObject(Context, JSAny): JSReceiver;
extern macro ToObject_Inline(Context, JSAny): JSReceiver;
......
......@@ -328,8 +328,8 @@ TNode<JSObject> ConstructorBuiltinsAssembler::FastNewObject(
BIND(&allocate_properties);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
properties = AllocateOrderedNameDictionary(
OrderedNameDictionary::kInitialCapacity);
properties =
AllocateSwissNameDictionary(SwissNameDictionary::kInitialCapacity);
} else {
properties = AllocateNameDictionary(NameDictionary::kInitialCapacity);
}
......@@ -548,7 +548,7 @@ TNode<HeapObject> ConstructorBuiltinsAssembler::CreateShallowObjectLiteral(
BIND(&if_dictionary);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once OrderedNameDictionary supported.
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), call_runtime);
}
......
......@@ -492,7 +492,7 @@ TF_BUILTIN(DeleteProperty, DeletePropertyBaseAssembler) {
if_notfound(this), slow(this), if_proxy(this);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once OrderedNameDictionary supported.
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &slow);
}
......@@ -961,7 +961,7 @@ TF_BUILTIN(GetProperty, CodeStubAssembler) {
if_slow(this, Label::kDeferred);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once OrderedNameDictionary supported.
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &if_slow);
}
......@@ -1021,7 +1021,7 @@ TF_BUILTIN(GetPropertyWithReceiver, CodeStubAssembler) {
if_slow(this, Label::kDeferred);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once OrderedNameDictionary supported.
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &if_slow);
}
......
......@@ -1034,7 +1034,7 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) {
no_properties(this);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once OrderedNameDictionary supported.
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &call_runtime);
}
......@@ -1078,8 +1078,8 @@ TF_BUILTIN(ObjectCreate, ObjectBuiltinsAssembler) {
{
map = LoadSlowObjectWithNullPrototypeMap(native_context);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
properties = AllocateOrderedNameDictionary(
OrderedNameDictionary::kInitialCapacity);
properties =
AllocateSwissNameDictionary(SwissNameDictionary::kInitialCapacity);
} else {
properties = AllocateNameDictionary(NameDictionary::kInitialCapacity);
}
......@@ -1284,9 +1284,8 @@ 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 OrderedNameDictionary supported.
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &call_runtime);
}
......@@ -1373,7 +1372,7 @@ void ObjectBuiltinsAssembler::AddToDictionaryIf(
GotoIfNot(condition, &done);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once OrderedNameDictionary supported.
// TODO(v8:11167) remove once SwissNameDictionary supported.
CallRuntime(Runtime::kAddDictionaryProperty, context, object,
HeapConstant(name), value);
} else {
......@@ -1437,7 +1436,7 @@ TNode<JSObject> ObjectBuiltinsAssembler::FromPropertyDescriptor(
// enumerable and configurable - a total of 6
TNode<HeapObject> properties =
V8_DICT_MODE_PROTOTYPES_BOOL
? TNode<HeapObject>(AllocateOrderedNameDictionary(6))
? TNode<HeapObject>(AllocateSwissNameDictionary(6))
: AllocateNameDictionary(6);
TNode<JSObject> js_desc = AllocateJSObjectFromMap(map, properties);
......@@ -1481,7 +1480,7 @@ TNode<JSObject> ObjectBuiltinsAssembler::FromPropertyDescriptor(
Goto(&return_desc);
if (!V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) make unconditional once OrderedNameDictionary supported.
// TODO(v8:11167) make unconditional once SwissNameDictionary supported.
BIND(&bailout);
CSA_ASSERT(this, Int32Constant(0));
Unreachable();
......
......@@ -53,7 +53,7 @@ TNode<JSProxy> ProxiesCodeStubAssembler::AllocateProxy(
TNode<HeapObject> proxy = Allocate(JSProxy::kSize);
StoreMapNoWriteBarrier(proxy, map.value());
RootIndex empty_dict = V8_DICT_MODE_PROTOTYPES_BOOL
? RootIndex::kEmptyOrderedPropertyDictionary
? RootIndex::kEmptySwissPropertyDictionary
: RootIndex::kEmptyPropertyDictionary;
StoreObjectFieldRoot(proxy, JSProxy::kPropertiesOrHashOffset, empty_dict);
StoreObjectFieldNoWriteBarrier(proxy, JSProxy::kTargetOffset, target);
......
......@@ -324,8 +324,7 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::ConstructNewResultFromMatchInfo(
TNode<Map> map = LoadSlowObjectWithNullPrototypeMap(native_context);
TNode<HeapObject> properties;
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// AllocateOrderedNameDictionary always uses kAllowLargeObjectAllocation.
properties = AllocateOrderedNameDictionary(num_properties);
properties = AllocateSwissNameDictionary(num_properties);
} else {
properties =
AllocateNameDictionary(num_properties, kAllowLargeObjectAllocation);
......@@ -365,7 +364,7 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::ConstructNewResultFromMatchInfo(
// - Receiver has no interceptors
Label add_dictionary_property_slow(this, Label::kDeferred);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once OrderedNameDictionary supported.
// TODO(v8:11167) remove once SwissNameDictionary supported.
CallRuntime(Runtime::kAddDictionaryProperty, context, group_object,
name, capture);
} else {
......@@ -378,7 +377,7 @@ TNode<JSRegExpResult> RegExpBuiltinsAssembler::ConstructNewResultFromMatchInfo(
&maybe_build_indices, &loop);
if (!V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) make unconditional once OrderedNameDictionary
// 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
......
......@@ -94,14 +94,14 @@ transitioning builtin CreateObjectWithoutProperties(implicit context: Context)(
prototype: JSAny): JSAny {
try {
let map: Map;
let properties: NameDictionary|OrderedNameDictionary|EmptyFixedArray;
let properties: NameDictionary|SwissNameDictionary|EmptyFixedArray;
typeswitch (prototype) {
case (Null): {
map = *NativeContextSlot(
ContextSlot::SLOW_OBJECT_WITH_NULL_PROTOTYPE_MAP);
if (kDictModePrototypes) {
properties = AllocateOrderedNameDictionary(
kOrderedNameDictionaryInitialCapacity);
properties =
AllocateSwissNameDictionary(kSwissNameDictionaryInitialCapacity);
} else {
properties = AllocateNameDictionary(kNameDictionaryInitialCapacity);
}
......
......@@ -1592,7 +1592,7 @@ TNode<HeapObject> CodeStubAssembler::LoadSlowProperties(
TNode<Object> properties = LoadJSReceiverPropertiesOrHash(object);
NodeGenerator<HeapObject> make_empty = [=]() -> TNode<HeapObject> {
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
return EmptyOrderedPropertyDictionaryConstant();
return EmptySwissPropertyDictionaryConstant();
} else {
return EmptyPropertyDictionaryConstant();
}
......@@ -1600,7 +1600,7 @@ TNode<HeapObject> CodeStubAssembler::LoadSlowProperties(
NodeGenerator<HeapObject> cast_properties = [=] {
TNode<HeapObject> dict = CAST(properties);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
CSA_ASSERT(this, Word32Or(IsOrderedNameDictionary(dict),
CSA_ASSERT(this, Word32Or(IsSwissNameDictionary(dict),
IsGlobalDictionary(dict)));
} else {
CSA_ASSERT(this,
......@@ -1779,7 +1779,7 @@ TNode<IntPtrT> CodeStubAssembler::LoadJSReceiverIdentityHash(
TNode<JSReceiver> receiver, Label* if_no_hash) {
TVARIABLE(IntPtrT, var_hash);
Label done(this), if_smi(this), if_property_array(this),
if_ordered_property_dictionary(this), if_property_dictionary(this),
if_swiss_property_dictionary(this), if_property_dictionary(this),
if_fixed_array(this);
TNode<Object> properties_or_hash =
......@@ -1792,9 +1792,9 @@ TNode<IntPtrT> CodeStubAssembler::LoadJSReceiverIdentityHash(
GotoIf(InstanceTypeEqual(properties_instance_type, PROPERTY_ARRAY_TYPE),
&if_property_array);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
GotoIf(InstanceTypeEqual(properties_instance_type,
ORDERED_NAME_DICTIONARY_TYPE),
&if_ordered_property_dictionary);
GotoIf(
InstanceTypeEqual(properties_instance_type, SWISS_NAME_DICTIONARY_TYPE),
&if_swiss_property_dictionary);
}
Branch(InstanceTypeEqual(properties_instance_type, NAME_DICTIONARY_TYPE),
&if_property_dictionary, &if_fixed_array);
......@@ -1819,10 +1819,10 @@ TNode<IntPtrT> CodeStubAssembler::LoadJSReceiverIdentityHash(
Goto(&done);
}
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
BIND(&if_ordered_property_dictionary);
BIND(&if_swiss_property_dictionary);
{
var_hash = SmiUntag(CAST(LoadFixedArrayElement(
CAST(properties), OrderedNameDictionary::HashIndex())));
var_hash = Signed(
ChangeUint32ToWord(LoadSwissNameDictionaryHash(CAST(properties))));
Goto(&done);
}
}
......@@ -3581,7 +3581,7 @@ void CodeStubAssembler::InitializeJSObjectFromMap(
} else {
CSA_ASSERT(this, Word32Or(Word32Or(Word32Or(IsPropertyArray(*properties),
IsNameDictionary(*properties)),
IsOrderedNameDictionary(*properties)),
IsSwissNameDictionary(*properties)),
IsEmptyFixedArray(*properties)));
StoreObjectFieldNoWriteBarrier(object, JSObject::kPropertiesOrHashOffset,
*properties);
......@@ -6397,6 +6397,11 @@ TNode<BoolT> CodeStubAssembler::IsOrderedNameDictionary(
return HasInstanceType(object, ORDERED_NAME_DICTIONARY_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsSwissNameDictionary(
TNode<HeapObject> object) {
return HasInstanceType(object, SWISS_NAME_DICTIONARY_TYPE);
}
TNode<BoolT> CodeStubAssembler::IsGlobalDictionary(TNode<HeapObject> object) {
return HasInstanceType(object, GLOBAL_DICTIONARY_TYPE);
}
......@@ -8005,6 +8010,25 @@ TNode<Word32T> CodeStubAssembler::ComputeSeededHash(TNode<IntPtrT> key) {
std::make_pair(type_int32, TruncateIntPtrToInt32(key))));
}
template <>
void CodeStubAssembler::NameDictionaryLookup(
TNode<SwissNameDictionary> dictionary, TNode<Name> unique_name,
Label* if_found, TVariable<IntPtrT>* var_name_index, Label* if_not_found,
LookupMode mode) {
Label store_found_index(this);
// TOOD(v8:11330) Dummy implementation until real version exists.
TNode<Smi> index =
CallRuntime<Smi>(Runtime::kSwissTableFindEntry, NoContextConstant(),
dictionary, unique_name);
BranchIfSmiEqual(index, SmiConstant(SwissNameDictionary::kNotFoundSentinel),
if_not_found, &store_found_index);
BIND(&store_found_index);
*var_name_index = SmiToIntPtr(index);
Goto(if_found);
}
void CodeStubAssembler::NumberDictionaryLookup(
TNode<NumberDictionary> dictionary, TNode<IntPtrT> intptr_index,
Label* if_found, TVariable<IntPtrT>* var_entry, Label* if_not_found) {
......@@ -8204,9 +8228,10 @@ TNode<Smi> CodeStubAssembler::GetNumberOfElements(
template <>
TNode<Smi> CodeStubAssembler::GetNumberOfElements(
TNode<OrderedNameDictionary> dictionary) {
return CAST(LoadFixedArrayElement(
dictionary, OrderedNameDictionary::NumberOfElementsIndex()));
TNode<SwissNameDictionary> dictionary) {
// TOOD(v8:11330) Dummy implementation until real version exists.
return CallRuntime<Smi>(Runtime::kSwissTableElementsCount,
NoContextConstant(), dictionary);
}
template TNode<Smi> CodeStubAssembler::GetNumberOfElements(
......@@ -8729,15 +8754,18 @@ void CodeStubAssembler::TryLookupPropertyInSimpleObject(
BIND(&if_isslowmap);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167, v8:11177) Only here due to SetDataProperties workaround.
GotoIf(Int32TrueConstant(), bailout);
}
TNode<SwissNameDictionary> dictionary = CAST(LoadSlowProperties(object));
*var_meta_storage = dictionary;
TNode<NameDictionary> 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;
NameDictionaryLookup<NameDictionary>(dictionary, unique_name, if_found_dict,
var_name_index, if_not_found);
NameDictionaryLookup<NameDictionary>(
dictionary, unique_name, if_found_dict, var_name_index, if_not_found);
}
}
}
......@@ -8971,6 +8999,23 @@ 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,
......@@ -9154,9 +9199,17 @@ void CodeStubAssembler::TryGetOwnProperty(
}
BIND(&if_found_dict);
{
TNode<NameDictionary> dictionary = CAST(var_meta_storage.value());
TNode<IntPtrT> entry = var_entry.value();
LoadPropertyFromNameDictionary(dictionary, entry, var_details, var_value);
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);
}
Goto(&if_found);
}
BIND(&if_found_global);
......@@ -12646,7 +12699,7 @@ TNode<Oddball> CodeStubAssembler::HasProperty(TNode<Context> context,
return_false(this), end(this), if_proxy(this, Label::kDeferred);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once OrderedNameDictionary supported.
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), &call_runtime);
}
......@@ -13742,14 +13795,14 @@ TNode<Map> CodeStubAssembler::CheckEnumCache(TNode<JSReceiver> receiver,
TNode<HeapObject> properties = LoadSlowProperties(receiver);
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
CSA_ASSERT(this, Word32Or(IsOrderedNameDictionary(properties),
CSA_ASSERT(this, Word32Or(IsSwissNameDictionary(properties),
IsGlobalDictionary(properties)));
length = Select<Smi>(
IsOrderedNameDictionary(properties),
IsSwissNameDictionary(properties),
[=] {
return GetNumberOfElements(
UncheckedCast<OrderedNameDictionary>(properties));
UncheckedCast<SwissNameDictionary>(properties));
},
[=] {
return GetNumberOfElements(
......@@ -14119,5 +14172,18 @@ void PrototypeCheckAssembler::CheckAndBranch(TNode<HeapObject> prototype,
}
}
TNode<SwissNameDictionary> CodeStubAssembler::AllocateSwissNameDictionary(
TNode<IntPtrT> at_least_space_for) {
// TOOD(v8:11330) Dummy implementation until real version exists.
return CallRuntime<SwissNameDictionary>(Runtime::kSwissTableAllocate,
NoContextConstant(),
SmiFromIntPtr(at_least_space_for));
}
TNode<SwissNameDictionary> CodeStubAssembler::AllocateSwissNameDictionary(
int at_least_space_for) {
return AllocateSwissNameDictionary(IntPtrConstant(at_least_space_for));
}
} // namespace internal
} // namespace v8
......@@ -135,6 +135,8 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol };
EmptyPropertyDictionary) \
V(EmptyOrderedPropertyDictionary, empty_ordered_property_dictionary, \
EmptyOrderedPropertyDictionary) \
V(EmptySwissPropertyDictionary, empty_swiss_property_dictionary, \
EmptySwissPropertyDictionary) \
V(EmptySlowElementDictionary, empty_slow_element_dictionary, \
EmptySlowElementDictionary) \
V(empty_string, empty_string, EmptyString) \
......@@ -2425,6 +2427,7 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
TNode<BoolT> IsStringInstanceType(TNode<Int32T> instance_type);
TNode<BoolT> IsString(TNode<HeapObject> object);
TNode<BoolT> IsSeqOneByteString(TNode<HeapObject> object);
TNode<BoolT> IsSwissNameDictionary(TNode<HeapObject> object);
TNode<BoolT> IsSymbolInstanceType(TNode<Int32T> instance_type);
TNode<BoolT> IsInternalizedStringInstanceType(TNode<Int32T> instance_type);
......@@ -3039,6 +3042,9 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
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);
void LoadPropertyFromGlobalDictionary(TNode<GlobalDictionary> dictionary,
TNode<IntPtrT> name_index,
TVariable<Uint32T>* var_details,
......@@ -3697,6 +3703,11 @@ class V8_EXPORT_PRIVATE CodeStubAssembler
return IntPtrConstant(FeedbackIterator::kHandlerOffset);
}
TNode<SwissNameDictionary> AllocateSwissNameDictionary(
TNode<IntPtrT> at_least_space_for);
TNode<SwissNameDictionary> AllocateSwissNameDictionary(
int at_least_space_for);
private:
friend class CodeStubArguments;
......
......@@ -860,7 +860,7 @@ TNode<Object> AccessorAssembler::HandleProtoHandler(
BIND(&if_lookup_on_lookup_start_object);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once OrderedNameDictionary supported.
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), miss);
}
......@@ -2440,7 +2440,7 @@ void AccessorAssembler::GenericPropertyLoad(
BIND(&if_property_dictionary);
{
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
// TODO(v8:11167) remove once OrderedNameDictionary supported.
// TODO(v8:11167) remove once SwissNameDictionary supported.
GotoIf(Int32TrueConstant(), slow);
}
......
......@@ -639,20 +639,6 @@ DEF_GETTER(JSReceiver, property_dictionary, NameDictionary) {
return NameDictionary::cast(prop);
}
DEF_GETTER(JSReceiver, property_dictionary_ordered, OrderedNameDictionary) {
DCHECK(!IsJSGlobalObject(isolate));
DCHECK(!HasFastProperties(isolate));
DCHECK(V8_DICT_MODE_PROTOTYPES_BOOL);
// Can't use ReadOnlyRoots(isolate) as this isolate could be produced by
// i::GetIsolateForPtrCompr(HeapObject).
Object prop = raw_properties_or_hash(isolate);
if (prop.IsSmi()) {
return GetReadOnlyRoots(isolate).empty_ordered_property_dictionary();
}
return OrderedNameDictionary::cast(prop);
}
DEF_GETTER(JSReceiver, property_dictionary_swiss, SwissNameDictionary) {
DCHECK(!IsJSGlobalObject(isolate));
DCHECK(!HasFastProperties(isolate));
......
......@@ -50,10 +50,6 @@ class JSReceiver : public HeapObject {
// Gets slow properties for non-global objects (if v8_dict_mode_prototypes is
// set).
// TODO(v8:11388) Keeping both versions around while transition to
// SwissNameDictionary is in progress, will then delete
// property_dictionary_ordered.
DECL_GETTER(property_dictionary_ordered, OrderedNameDictionary)
DECL_GETTER(property_dictionary_swiss, SwissNameDictionary)
// Sets the properties backing store and makes sure any existing hash is moved
......
......@@ -6,7 +6,7 @@
@abstract
@highestInstanceTypeWithinParentClassRange
extern class JSReceiver extends HeapObject {
properties_or_hash: FixedArrayBase|PropertyArray|Smi;
properties_or_hash: SwissNameDictionary|FixedArrayBase|PropertyArray|Smi;
}
type Constructor extends JSReceiver;
......@@ -73,12 +73,12 @@ macro GetDerivedMap(implicit context: Context)(
macro AllocateFastOrSlowJSObjectFromMap(implicit context: Context)(map: Map):
JSObject {
let properties: EmptyFixedArray|NameDictionary|OrderedNameDictionary =
let properties: EmptyFixedArray|NameDictionary|SwissNameDictionary =
kEmptyFixedArray;
if (IsDictionaryMap(map)) {
if (kDictModePrototypes) {
properties =
AllocateOrderedNameDictionary(kOrderedNameDictionaryInitialCapacity);
AllocateSwissNameDictionary(kSwissNameDictionaryInitialCapacity);
} else {
properties = AllocateNameDictionary(kNameDictionaryInitialCapacity);
}
......@@ -161,10 +161,9 @@ extern class JSStringIterator extends JSObject {
extern macro AllocateJSObjectFromMap(Map): JSObject;
extern macro AllocateJSObjectFromMap(
Map,
NameDictionary | OrderedNameDictionary | EmptyFixedArray |
NameDictionary | SwissNameDictionary | EmptyFixedArray |
PropertyArray): JSObject;
extern macro AllocateJSObjectFromMap(
Map,
NameDictionary | OrderedNameDictionary | EmptyFixedArray | PropertyArray,
Map, NameDictionary | SwissNameDictionary | EmptyFixedArray | PropertyArray,
FixedArray, constexpr AllocationFlag,
constexpr SlackTrackingMode): JSObject;
......@@ -328,7 +328,7 @@ PrimitiveHeapObject InferMethodName(Isolate* isolate, JSReceiver receiver,
fun, name);
} else if (V8_DICT_MODE_PROTOTYPES_BOOL) {
name = InferMethodNameFromDictionary(
isolate, object.property_dictionary_ordered(), fun, name);
isolate, object.property_dictionary_swiss(), fun, name);
} else {
name = InferMethodNameFromDictionary(
isolate, object.property_dictionary(), fun, name);
......
......@@ -1890,13 +1890,21 @@ TEST(AllocateJSObjectFromMap) {
"object")));
JSObject::NormalizeProperties(isolate, object, KEEP_INOBJECT_PROPERTIES, 0,
"Normalize");
Handle<HeapObject> properties =
V8_DICT_MODE_PROTOTYPES_BOOL
? Handle<HeapObject>(object->property_dictionary_swiss(), isolate)
: handle(object->property_dictionary(), isolate);
Handle<JSObject> result = Handle<JSObject>::cast(
ft.Call(handle(object->map(), isolate),
handle(object->property_dictionary(), isolate),
ft.Call(handle(object->map(), isolate), properties,
handle(object->elements(), isolate))
.ToHandleChecked());
CHECK_EQ(result->map(), object->map());
CHECK_EQ(result->property_dictionary(), object->property_dictionary());
if (V8_DICT_MODE_PROTOTYPES_BOOL) {
CHECK_EQ(result->property_dictionary_swiss(),
object->property_dictionary_swiss());
} else {
CHECK_EQ(result->property_dictionary(), object->property_dictionary());
}
CHECK(!result->HasFastProperties());
#ifdef VERIFY_HEAP
isolate->heap()->Verify();
......
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