diff options
Diffstat (limited to 'deps/v8/src/objects/name-inl.h')
-rw-r--r-- | deps/v8/src/objects/name-inl.h | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/deps/v8/src/objects/name-inl.h b/deps/v8/src/objects/name-inl.h index 512e47875c..3fda66f2a1 100644 --- a/deps/v8/src/objects/name-inl.h +++ b/deps/v8/src/objects/name-inl.h @@ -8,6 +8,8 @@ #include "src/objects/name.h" #include "src/heap/heap-inl.h" +#include "src/heap/heap-write-barrier.h" +#include "src/objects/map-inl.h" // Has to be the last include (doesn't have include guards): #include "src/objects/object-macros.h" @@ -15,6 +17,9 @@ namespace v8 { namespace internal { +OBJECT_CONSTRUCTORS_IMPL(Name, HeapObject) +OBJECT_CONSTRUCTORS_IMPL(Symbol, Name) + CAST_ACCESSOR(Name) CAST_ACCESSOR(Symbol) @@ -27,17 +32,17 @@ BIT_FIELD_ACCESSORS(Symbol, flags, is_public, Symbol::IsPublicBit) BIT_FIELD_ACCESSORS(Symbol, flags, is_interesting_symbol, Symbol::IsInterestingSymbolBit) -bool Symbol::is_private_field() const { - bool value = Symbol::IsPrivateFieldBit::decode(flags()); +bool Symbol::is_private_name() const { + bool value = Symbol::IsPrivateNameBit::decode(flags()); DCHECK_IMPLIES(value, is_private()); return value; } -void Symbol::set_is_private_field() { +void Symbol::set_is_private_name() { // TODO(gsathya): Re-order the bits to have these next to each other // and just do the bit shifts once. set_flags(Symbol::IsPrivateBit::update(flags(), true)); - set_flags(Symbol::IsPrivateFieldBit::update(flags(), true)); + set_flags(Symbol::IsPrivateNameBit::update(flags(), true)); } bool Name::IsUniqueName() const { @@ -54,13 +59,13 @@ void Name::set_hash_field(uint32_t value) { WRITE_UINT32_FIELD(this, kHashFieldOffset, value); } -bool Name::Equals(Name* other) { - if (other == this) return true; +bool Name::Equals(Name other) { + if (other == *this) return true; if ((this->IsInternalizedString() && other->IsInternalizedString()) || this->IsSymbol() || other->IsSymbol()) { return false; } - return String::cast(this)->SlowEquals(String::cast(other)); + return String::cast(*this)->SlowEquals(String::cast(other)); } bool Name::Equals(Isolate* isolate, Handle<Name> one, Handle<Name> two) { @@ -86,27 +91,27 @@ uint32_t Name::Hash() { // Slow case: compute hash code and set it. Has to be a string. // Also the string must be writable, because read-only strings will have their // hash values precomputed. - return String::cast(this)->ComputeAndSetHash( - Heap::FromWritableHeapObject(this)->isolate()); + return String::cast(*this)->ComputeAndSetHash( + Heap::FromWritableHeapObject(*this)->isolate()); } bool Name::IsInterestingSymbol() const { - return IsSymbol() && Symbol::cast(this)->is_interesting_symbol(); + return IsSymbol() && Symbol::cast(*this)->is_interesting_symbol(); } bool Name::IsPrivate() { - return this->IsSymbol() && Symbol::cast(this)->is_private(); + return this->IsSymbol() && Symbol::cast(*this)->is_private(); } -bool Name::IsPrivateField() { - bool is_private_field = - this->IsSymbol() && Symbol::cast(this)->is_private_field(); - DCHECK_IMPLIES(is_private_field, IsPrivate()); - return is_private_field; +bool Name::IsPrivateName() { + bool is_private_name = + this->IsSymbol() && Symbol::cast(*this)->is_private_name(); + DCHECK_IMPLIES(is_private_name, IsPrivate()); + return is_private_name; } bool Name::AsArrayIndex(uint32_t* index) { - return IsString() && String::cast(this)->AsArrayIndex(index); + return IsString() && String::cast(*this)->AsArrayIndex(index); } // static |