diff options
Diffstat (limited to 'deps/v8/src/property.h')
-rw-r--r-- | deps/v8/src/property.h | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/deps/v8/src/property.h b/deps/v8/src/property.h index e7d9fc5345..d5efb7f351 100644 --- a/deps/v8/src/property.h +++ b/deps/v8/src/property.h @@ -1,4 +1,4 @@ -// Copyright 2011 the V8 project authors. All rights reserved. +// Copyright 2012 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -71,6 +71,8 @@ class Descriptor BASE_EMBEDDED { details_ = PropertyDetails(details_.attributes(), details_.type(), index); } + bool ContainsTransition(); + private: String* key_; Object* value_; @@ -115,11 +117,9 @@ class MapTransitionDescriptor: public Descriptor { class ElementsTransitionDescriptor: public Descriptor { public: ElementsTransitionDescriptor(String* key, - Map* map, - ElementsKind elements_kind) - : Descriptor(key, map, PropertyDetails(NONE, - ELEMENTS_TRANSITION, - elements_kind)) { } + Object* map_or_array) + : Descriptor(key, map_or_array, PropertyDetails(NONE, + ELEMENTS_TRANSITION)) { } }; // Marks a field name in a map so that adding the field is guaranteed @@ -166,10 +166,20 @@ class CallbacksDescriptor: public Descriptor { class LookupResult BASE_EMBEDDED { public: - LookupResult() - : lookup_type_(NOT_FOUND), + explicit LookupResult(Isolate* isolate) + : isolate_(isolate), + next_(isolate->top_lookup_result()), + lookup_type_(NOT_FOUND), + holder_(NULL), cacheable_(true), - details_(NONE, NORMAL) {} + details_(NONE, NORMAL) { + isolate->SetTopLookupResult(this); + } + + ~LookupResult() { + ASSERT(isolate_->top_lookup_result() == this); + isolate_->SetTopLookupResult(next_); + } void DescriptorResult(JSObject* holder, PropertyDetails details, int number) { lookup_type_ = DESCRIPTOR_TYPE; @@ -202,9 +212,9 @@ class LookupResult BASE_EMBEDDED { number_ = entry; } - void HandlerResult() { + void HandlerResult(JSProxy* proxy) { lookup_type_ = HANDLER_TYPE; - holder_ = NULL; + holder_ = proxy; details_ = PropertyDetails(NONE, HANDLER); cacheable_ = false; } @@ -217,11 +227,17 @@ class LookupResult BASE_EMBEDDED { void NotFound() { lookup_type_ = NOT_FOUND; + holder_ = NULL; } JSObject* holder() { ASSERT(IsFound()); - return holder_; + return JSObject::cast(holder_); + } + + JSProxy* proxy() { + ASSERT(IsFound()); + return JSProxy::cast(holder_); } PropertyType type() { @@ -248,12 +264,7 @@ class LookupResult BASE_EMBEDDED { // Is the result is a property excluding transitions and the null // descriptor? bool IsProperty() { - return IsFound() && (type() < FIRST_PHANTOM_PROPERTY_TYPE); - } - - // Is the result a property or a transition? - bool IsPropertyOrTransition() { - return IsFound() && (type() != NULL_DESCRIPTOR); + return IsFound() && IsRealProperty(GetPropertyDetails().type()); } bool IsCacheable() { return cacheable_; } @@ -278,10 +289,12 @@ class LookupResult BASE_EMBEDDED { } } + Map* GetTransitionMap() { ASSERT(lookup_type_ == DESCRIPTOR_TYPE); - ASSERT(type() == MAP_TRANSITION || type() == CONSTANT_TRANSITION || - type() == ELEMENTS_TRANSITION); + ASSERT(type() == MAP_TRANSITION || + type() == ELEMENTS_TRANSITION || + type() == CONSTANT_TRANSITION); return Map::cast(GetValue()); } @@ -343,7 +356,12 @@ class LookupResult BASE_EMBEDDED { return holder()->GetNormalizedProperty(this); } + void Iterate(ObjectVisitor* visitor); + private: + Isolate* isolate_; + LookupResult* next_; + // Where did we find the result; enum { NOT_FOUND, @@ -354,7 +372,7 @@ class LookupResult BASE_EMBEDDED { CONSTANT_TYPE } lookup_type_; - JSObject* holder_; + JSReceiver* holder_; int number_; bool cacheable_; PropertyDetails details_; |