diff options
Diffstat (limited to 'deps/v8/src/property.h')
-rw-r--r-- | deps/v8/src/property.h | 126 |
1 files changed, 54 insertions, 72 deletions
diff --git a/deps/v8/src/property.h b/deps/v8/src/property.h index 0f78ba478e..baa5a0f993 100644 --- a/deps/v8/src/property.h +++ b/deps/v8/src/property.h @@ -184,14 +184,15 @@ class LookupResult BASE_EMBEDDED { next_(isolate->top_lookup_result()), lookup_type_(NOT_FOUND), holder_(NULL), + transition_(NULL), cacheable_(true), details_(NONE, NONEXISTENT, Representation::None()) { - isolate->SetTopLookupResult(this); + isolate->set_top_lookup_result(this); } ~LookupResult() { ASSERT(isolate()->top_lookup_result() == this); - isolate()->SetTopLookupResult(next_); + isolate()->set_top_lookup_result(next_); } Isolate* isolate() const { return isolate_; } @@ -199,6 +200,7 @@ class LookupResult BASE_EMBEDDED { void DescriptorResult(JSObject* holder, PropertyDetails details, int number) { lookup_type_ = DESCRIPTOR_TYPE; holder_ = holder; + transition_ = NULL; details_ = details; number_ = number; } @@ -209,16 +211,18 @@ class LookupResult BASE_EMBEDDED { return value->FitsRepresentation(details_.representation()); } - void TransitionResult(JSObject* holder, int number) { + void TransitionResult(JSObject* holder, Map* target) { lookup_type_ = TRANSITION_TYPE; details_ = PropertyDetails(NONE, TRANSITION, Representation::None()); holder_ = holder; - number_ = number; + transition_ = target; + number_ = 0xAAAA; } void DictionaryResult(JSObject* holder, int entry) { lookup_type_ = DICTIONARY_TYPE; holder_ = holder; + transition_ = NULL; details_ = holder->property_dictionary()->DetailsAt(entry); number_ = entry; } @@ -226,6 +230,7 @@ class LookupResult BASE_EMBEDDED { void HandlerResult(JSProxy* proxy) { lookup_type_ = HANDLER_TYPE; holder_ = proxy; + transition_ = NULL; details_ = PropertyDetails(NONE, HANDLER, Representation::Tagged()); cacheable_ = false; } @@ -233,6 +238,7 @@ class LookupResult BASE_EMBEDDED { void InterceptorResult(JSObject* holder) { lookup_type_ = INTERCEPTOR_TYPE; holder_ = holder; + transition_ = NULL; details_ = PropertyDetails(NONE, INTERCEPTOR, Representation::Tagged()); } @@ -240,92 +246,93 @@ class LookupResult BASE_EMBEDDED { lookup_type_ = NOT_FOUND; details_ = PropertyDetails(NONE, NONEXISTENT, Representation::None()); holder_ = NULL; + transition_ = NULL; } - JSObject* holder() { + JSObject* holder() const { ASSERT(IsFound()); return JSObject::cast(holder_); } - JSProxy* proxy() { - ASSERT(IsFound()); + JSProxy* proxy() const { + ASSERT(IsHandler()); return JSProxy::cast(holder_); } - PropertyType type() { + PropertyType type() const { ASSERT(IsFound()); return details_.type(); } - Representation representation() { + Representation representation() const { ASSERT(IsFound()); ASSERT(!IsTransition()); ASSERT(details_.type() != NONEXISTENT); return details_.representation(); } - PropertyAttributes GetAttributes() { + PropertyAttributes GetAttributes() const { ASSERT(!IsTransition()); ASSERT(IsFound()); ASSERT(details_.type() != NONEXISTENT); return details_.attributes(); } - PropertyDetails GetPropertyDetails() { + PropertyDetails GetPropertyDetails() const { ASSERT(!IsTransition()); return details_; } - bool IsFastPropertyType() { + bool IsFastPropertyType() const { ASSERT(IsFound()); return IsTransition() || type() != NORMAL; } // Property callbacks does not include transitions to callbacks. - bool IsPropertyCallbacks() { + bool IsPropertyCallbacks() const { ASSERT(!(details_.type() == CALLBACKS && !IsFound())); return details_.type() == CALLBACKS; } - bool IsReadOnly() { + bool IsReadOnly() const { ASSERT(IsFound()); ASSERT(!IsTransition()); ASSERT(details_.type() != NONEXISTENT); return details_.IsReadOnly(); } - bool IsField() { + bool IsField() const { ASSERT(!(details_.type() == FIELD && !IsFound())); return details_.type() == FIELD; } - bool IsNormal() { + bool IsNormal() const { ASSERT(!(details_.type() == NORMAL && !IsFound())); return details_.type() == NORMAL; } - bool IsConstant() { + bool IsConstant() const { ASSERT(!(details_.type() == CONSTANT && !IsFound())); return details_.type() == CONSTANT; } - bool IsConstantFunction() { + bool IsConstantFunction() const { return IsConstant() && GetValue()->IsJSFunction(); } - bool IsDontDelete() { return details_.IsDontDelete(); } - bool IsDontEnum() { return details_.IsDontEnum(); } - bool IsFound() { return lookup_type_ != NOT_FOUND; } - bool IsTransition() { return lookup_type_ == TRANSITION_TYPE; } - bool IsHandler() { return lookup_type_ == HANDLER_TYPE; } - bool IsInterceptor() { return lookup_type_ == INTERCEPTOR_TYPE; } + bool IsDontDelete() const { return details_.IsDontDelete(); } + bool IsDontEnum() const { return details_.IsDontEnum(); } + bool IsFound() const { return lookup_type_ != NOT_FOUND; } + bool IsTransition() const { return lookup_type_ == TRANSITION_TYPE; } + bool IsHandler() const { return lookup_type_ == HANDLER_TYPE; } + bool IsInterceptor() const { return lookup_type_ == INTERCEPTOR_TYPE; } // Is the result is a property excluding transitions and the null descriptor? - bool IsProperty() { + bool IsProperty() const { return IsFound() && !IsTransition(); } - bool IsDataProperty() { + bool IsDataProperty() const { switch (type()) { case FIELD: case NORMAL: @@ -345,10 +352,10 @@ class LookupResult BASE_EMBEDDED { return false; } - bool IsCacheable() { return cacheable_; } + bool IsCacheable() const { return cacheable_; } void DisallowCaching() { cacheable_ = false; } - Object* GetLazyValue() { + Object* GetLazyValue() const { switch (type()) { case FIELD: return holder()->RawFastPropertyAt(GetFieldIndex().field_index()); @@ -373,88 +380,62 @@ class LookupResult BASE_EMBEDDED { return NULL; } - Map* GetTransitionTarget(Map* map) { - ASSERT(IsTransition()); - TransitionArray* transitions = map->transitions(); - return transitions->GetTarget(number_); - } - - Map* GetTransitionTarget() { - return GetTransitionTarget(holder()->map()); + Map* GetTransitionTarget() const { + return transition_; } - PropertyDetails GetTransitionDetails(Map* map) { + PropertyDetails GetTransitionDetails() const { ASSERT(IsTransition()); - TransitionArray* transitions = map->transitions(); - return transitions->GetTargetDetails(number_); - } - - PropertyDetails GetTransitionDetails() { - return GetTransitionDetails(holder()->map()); - } - - bool IsTransitionToField(Map* map) { - return IsTransition() && GetTransitionDetails(map).type() == FIELD; + return transition_->GetLastDescriptorDetails(); } - bool IsTransitionToConstant(Map* map) { - return IsTransition() && GetTransitionDetails(map).type() == CONSTANT; + bool IsTransitionToField() const { + return IsTransition() && GetTransitionDetails().type() == FIELD; } - Map* GetTransitionMap() { - ASSERT(IsTransition()); - return Map::cast(GetValue()); - } - - Map* GetTransitionMapFromMap(Map* map) { - ASSERT(IsTransition()); - return map->transitions()->GetTarget(number_); - } - - int GetTransitionIndex() { - ASSERT(IsTransition()); - return number_; + bool IsTransitionToConstant() const { + return IsTransition() && GetTransitionDetails().type() == CONSTANT; } - int GetDescriptorIndex() { + int GetDescriptorIndex() const { ASSERT(lookup_type_ == DESCRIPTOR_TYPE); return number_; } - PropertyIndex GetFieldIndex() { + PropertyIndex GetFieldIndex() const { ASSERT(lookup_type_ == DESCRIPTOR_TYPE); return PropertyIndex::NewFieldIndex(GetFieldIndexFromMap(holder()->map())); } - int GetLocalFieldIndexFromMap(Map* map) { + int GetLocalFieldIndexFromMap(Map* map) const { return GetFieldIndexFromMap(map) - map->inobject_properties(); } - int GetDictionaryEntry() { + int GetDictionaryEntry() const { ASSERT(lookup_type_ == DICTIONARY_TYPE); return number_; } - JSFunction* GetConstantFunction() { + JSFunction* GetConstantFunction() const { ASSERT(type() == CONSTANT); return JSFunction::cast(GetValue()); } - Object* GetConstantFromMap(Map* map) { + Object* GetConstantFromMap(Map* map) const { ASSERT(type() == CONSTANT); return GetValueFromMap(map); } - JSFunction* GetConstantFunctionFromMap(Map* map) { + JSFunction* GetConstantFunctionFromMap(Map* map) const { return JSFunction::cast(GetConstantFromMap(map)); } - Object* GetConstant() { + Object* GetConstant() const { ASSERT(type() == CONSTANT); return GetValue(); } - Object* GetCallbackObject() { + Object* GetCallbackObject() const { ASSERT(type() == CALLBACKS && !IsTransition()); return GetValue(); } @@ -463,7 +444,7 @@ class LookupResult BASE_EMBEDDED { void Print(FILE* out); #endif - Object* GetValue() { + Object* GetValue() const { if (lookup_type_ == DESCRIPTOR_TYPE) { return GetValueFromMap(holder()->map()); } @@ -501,6 +482,7 @@ class LookupResult BASE_EMBEDDED { } lookup_type_; JSReceiver* holder_; + Map* transition_; int number_; bool cacheable_; PropertyDetails details_; |