Commit e5c6b69d authored by Frank Emrich's avatar Frank Emrich Committed by Commit Bot

[dict-proto] getter for ordered property dicts

This adds a getter for ordered property dictionaries of maps

Bug: v8:7569
Change-Id: I7e8668ec707734b97f41f1a85c70b00b3b10c981
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2465824
Commit-Queue: Frank Emrich <emrich@google.com>
Reviewed-by: 's avatarIgor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70617}
parent 36ebdde1
......@@ -5,6 +5,7 @@
#ifndef V8_OBJECTS_JS_OBJECTS_INL_H_
#define V8_OBJECTS_JS_OBJECTS_INL_H_
#include "src/common/globals.h"
#include "src/heap/heap-write-barrier.h"
#include "src/objects/elements.h"
#include "src/objects/embedder-data-slot-inl.h"
......@@ -656,6 +657,8 @@ DEF_GETTER(JSReceiver, HasFastProperties, bool) {
DEF_GETTER(JSReceiver, property_dictionary, NameDictionary) {
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);
......@@ -665,6 +668,20 @@ 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);
}
// TODO(gsathya): Pass isolate directly to this function and access
// the heap from this.
DEF_GETTER(JSReceiver, property_array, PropertyArray) {
......
......@@ -43,9 +43,14 @@ class JSReceiver : public HeapObject {
// map.
DECL_GETTER(property_array, PropertyArray)
// Gets slow properties for non-global objects.
// Gets slow properties for non-global objects (if v8_dict_mode_prototypes is
// not set).
DECL_GETTER(property_dictionary, NameDictionary)
// Gets slow properties for non-global objects (if v8_dict_mode_prototypes is
// set).
DECL_GETTER(property_dictionary_ordered, OrderedNameDictionary)
// Sets the properties backing store and makes sure any existing hash is moved
// to the new properties store. To clear out the properties store, pass in the
// empty_fixed_array(), the hash will be maintained in this case as well.
......
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