Chromium Code Reviews| Index: src/property.h |
| diff --git a/src/property.h b/src/property.h |
| index baa5a0f993c7e13be91b281e07d2d20659607eb2..53ce4539e566b35962aba6038f157fefe887a4bd 100644 |
| --- a/src/property.h |
| +++ b/src/property.h |
| @@ -101,9 +101,12 @@ class FieldDescriptor: public Descriptor { |
| FieldDescriptor(Name* key, |
| int field_index, |
| PropertyAttributes attributes, |
| - Representation representation) |
| - : Descriptor(key, Smi::FromInt(0), attributes, |
| - FIELD, representation, field_index) {} |
| + Representation representation); |
| + FieldDescriptor(Name* key, |
| + int field_index, |
| + HeapType* field_type, |
| + PropertyAttributes attributes, |
| + Representation representation); |
| }; |
| @@ -205,11 +208,7 @@ class LookupResult BASE_EMBEDDED { |
| number_ = number; |
| } |
| - bool CanHoldValue(Handle<Object> value) { |
| - if (IsNormal()) return true; |
| - ASSERT(!IsTransition()); |
| - return value->FitsRepresentation(details_.representation()); |
| - } |
| + bool CanHoldValue(Handle<Object> value) const; |
| void TransitionResult(JSObject* holder, Map* target) { |
| lookup_type_ = TRANSITION_TYPE; |
| @@ -454,9 +453,13 @@ class LookupResult BASE_EMBEDDED { |
| } |
| Object* GetValueFromMap(Map* map) const { |
| - ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
| - ASSERT(number_ < map->NumberOfOwnDescriptors()); |
| - return map->instance_descriptors()->GetValue(number_); |
| + if (lookup_type_ == DESCRIPTOR_TYPE) { |
| + ASSERT(number_ < map->NumberOfOwnDescriptors()); |
| + return map->instance_descriptors()->GetValue(number_); |
| + } |
| + ASSERT(lookup_type_ == TRANSITION_TYPE); |
| + return transition_->instance_descriptors()->GetValue( |
| + transition_->LastAdded()); |
| } |
| int GetFieldIndexFromMap(Map* map) const { |
| @@ -465,6 +468,22 @@ class LookupResult BASE_EMBEDDED { |
| return map->instance_descriptors()->GetFieldIndex(number_); |
| } |
| + HeapType* GetFieldType() const { |
| + return GetFieldTypeFromMap(holder()->map()); |
|
Toon Verwaest
2014/03/21 14:33:37
Aarg, this is ugly. We really need to cache holder
Benedikt Meurer
2014/04/11 11:12:00
ACK.
|
| + } |
| + |
| + HeapType* GetFieldTypeFromMap(Map* map) const; |
| + |
| + Map* GetFieldOwner() const { |
| + return GetFieldOwnerFromMap(holder()->map()); |
| + } |
| + |
| + Map* GetFieldOwnerFromMap(Map* map) const { |
| + ASSERT(lookup_type_ == DESCRIPTOR_TYPE); |
| + ASSERT(number_ < map->NumberOfOwnDescriptors()); |
| + return map->FindFieldOwner(number_); |
| + } |
| + |
| void Iterate(ObjectVisitor* visitor); |
| private: |