diff options
Diffstat (limited to 'deps/v8/src/property.cc')
-rw-r--r-- | deps/v8/src/property.cc | 50 |
1 files changed, 43 insertions, 7 deletions
diff --git a/deps/v8/src/property.cc b/deps/v8/src/property.cc index dfa5221bc47..8e56dcf47e4 100644 --- a/deps/v8/src/property.cc +++ b/deps/v8/src/property.cc @@ -7,6 +7,7 @@ #include "src/field-type.h" #include "src/handles-inl.h" #include "src/objects-inl.h" +#include "src/objects/name-inl.h" #include "src/ostreams.h" namespace v8 { @@ -22,12 +23,32 @@ std::ostream& operator<<(std::ostream& os, return os; } -Descriptor Descriptor::DataField(Handle<Name> key, int field_index, - PropertyAttributes attributes, +Descriptor::Descriptor() : details_(Smi::kZero) {} + +Descriptor::Descriptor(Handle<Name> key, MaybeObjectHandle value, + PropertyKind kind, PropertyAttributes attributes, + PropertyLocation location, PropertyConstness constness, + Representation representation, int field_index) + : key_(key), + value_(value), + details_(kind, attributes, location, constness, representation, + field_index) { + DCHECK(key->IsUniqueName()); + DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable()); +} + +Descriptor::Descriptor(Handle<Name> key, MaybeObjectHandle value, + PropertyDetails details) + : key_(key), value_(value), details_(details) { + DCHECK(key->IsUniqueName()); + DCHECK_IMPLIES(key->IsPrivate(), !details_.IsEnumerable()); +} + +Descriptor Descriptor::DataField(Isolate* isolate, Handle<Name> key, + int field_index, PropertyAttributes attributes, Representation representation) { return DataField(key, field_index, attributes, PropertyConstness::kMutable, - representation, - MaybeObjectHandle(FieldType::Any(key->GetIsolate()))); + representation, MaybeObjectHandle(FieldType::Any(isolate))); } Descriptor Descriptor::DataField(Handle<Name> key, int field_index, @@ -41,11 +62,18 @@ Descriptor Descriptor::DataField(Handle<Name> key, int field_index, return Descriptor(key, wrapped_field_type, details); } -Descriptor Descriptor::DataConstant(Handle<Name> key, int field_index, - Handle<Object> value, +Descriptor Descriptor::DataConstant(Handle<Name> key, Handle<Object> value, + PropertyAttributes attributes) { + return Descriptor(key, MaybeObjectHandle(value), kData, attributes, + kDescriptor, PropertyConstness::kConst, + value->OptimalRepresentation(), 0); +} + +Descriptor Descriptor::DataConstant(Isolate* isolate, Handle<Name> key, + int field_index, Handle<Object> value, PropertyAttributes attributes) { if (FLAG_track_constant_fields) { - MaybeObjectHandle any_type(FieldType::Any(), key->GetIsolate()); + MaybeObjectHandle any_type(FieldType::Any(), isolate); return DataField(key, field_index, attributes, PropertyConstness::kConst, Representation::Tagged(), any_type); @@ -56,6 +84,14 @@ Descriptor Descriptor::DataConstant(Handle<Name> key, int field_index, } } +Descriptor Descriptor::AccessorConstant(Handle<Name> key, + Handle<Object> foreign, + PropertyAttributes attributes) { + return Descriptor(key, MaybeObjectHandle(foreign), kAccessor, attributes, + kDescriptor, PropertyConstness::kConst, + Representation::Tagged(), 0); +} + // Outputs PropertyDetails as a dictionary details. void PropertyDetails::PrintAsSlowTo(std::ostream& os) { os << "("; |