Revision: 23695
Author:   [email protected]
Date:     Thu Sep  4 13:17:04 2014 UTC
Log:      Get rid of special property_encoding flag on the LookupIterator

BUG=
[email protected]

Review URL: https://codereview.chromium.org/539083002
https://code.google.com/p/v8/source/detail?r=23695

Modified:
 /branches/bleeding_edge/src/ic/ic.cc
 /branches/bleeding_edge/src/lookup-inl.h
 /branches/bleeding_edge/src/lookup.cc
 /branches/bleeding_edge/src/lookup.h

=======================================
--- /branches/bleeding_edge/src/ic/ic.cc        Thu Sep  4 12:28:13 2014 UTC
+++ /branches/bleeding_edge/src/ic/ic.cc        Thu Sep  4 13:17:04 2014 UTC
@@ -898,7 +898,7 @@

   Handle<Code> code = PropertyHandlerCompiler::Find(
       lookup->name(), stub_holder_map, kind(), flag,
- lookup->holder_map()->is_dictionary_map() ? Code::NORMAL : Code::FAST);
+      lookup->is_dictionary_holder() ? Code::NORMAL : Code::FAST);
   // Use the cached value if it exists, and if it is different from the
   // handler that just missed.
   if (!code.is_null()) {
@@ -1033,7 +1033,7 @@

   // -------------- Dictionary properties --------------
   DCHECK(lookup->state() == LookupIterator::DATA);
-  if (lookup->property_encoding() == LookupIterator::DICTIONARY) {
+  if (lookup->is_dictionary_holder()) {
     if (kind() != Code::LOAD_IC) return slow_stub();
     if (holder->IsGlobalObject()) {
       NamedLoadHandlerCompiler compiler(isolate(), receiver_type(), holder,
@@ -1057,7 +1057,6 @@
   }

   // -------------- Fields --------------
-  DCHECK(lookup->property_encoding() == LookupIterator::DESCRIPTOR);
   if (lookup->property_details().type() == FIELD) {
     FieldIndex field = lookup->GetFieldIndex();
     if (receiver_is_holder) {
@@ -1455,7 +1454,7 @@

   // -------------- Dictionary properties --------------
   DCHECK(lookup->state() == LookupIterator::DATA);
-  if (lookup->property_encoding() == LookupIterator::DICTIONARY) {
+  if (lookup->is_dictionary_holder()) {
     if (holder->IsGlobalObject()) {
       Handle<PropertyCell> cell = lookup->GetPropertyCell();
       Handle<HeapType> union_type = PropertyCell::UpdatedType(cell, value);
@@ -1472,7 +1471,6 @@
   }

   // -------------- Fields --------------
-  DCHECK(lookup->property_encoding() == LookupIterator::DESCRIPTOR);
   if (lookup->property_details().type() == FIELD) {
     bool use_stub = true;
     if (lookup->representation().IsHeapObject()) {
=======================================
--- /branches/bleeding_edge/src/lookup-inl.h    Thu Sep  4 12:28:13 2014 UTC
+++ /branches/bleeding_edge/src/lookup-inl.h    Thu Sep  4 13:17:04 2014 UTC
@@ -47,7 +47,6 @@
     // Fall through.
     case INTERCEPTOR:
       if (map->is_dictionary_map()) {
-        property_encoding_ = DICTIONARY;
         if (holder == NULL) return UNKNOWN;
NameDictionary* dict = JSObject::cast(holder)->property_dictionary();
         number_ = dict->FindEntry(name_);
@@ -62,7 +61,6 @@
         DescriptorArray* descriptors = map->instance_descriptors();
         number_ = descriptors->SearchWithCache(*name_, map);
         if (number_ == DescriptorArray::kNotFound) return NOT_FOUND;
-        property_encoding_ = DESCRIPTOR;
         property_details_ = descriptors->GetDetails(number_);
       }
       has_property_ = true;
=======================================
--- /branches/bleeding_edge/src/lookup.cc       Thu Sep  4 12:28:13 2014 UTC
+++ /branches/bleeding_edge/src/lookup.cc       Thu Sep  4 13:17:04 2014 UTC
@@ -94,7 +94,7 @@
 void LookupIterator::PrepareForDataProperty(Handle<Object> value) {
   DCHECK(state_ == DATA || state_ == ACCESSOR);
   DCHECK(HolderIsReceiverOrHiddenPrototype());
-  if (property_encoding_ == DICTIONARY) return;
+  if (holder_map_->is_dictionary_map()) return;
   holder_map_ =
       Map::PrepareForDataProperty(holder_map_, descriptor_number(), value);
   JSObject::MigrateToMap(GetHolder<JSObject>(), holder_map_);
@@ -107,16 +107,14 @@
   DCHECK(state_ == DATA || state_ == ACCESSOR);
   DCHECK(HolderIsReceiverOrHiddenPrototype());
   Handle<JSObject> holder = GetHolder<JSObject>();
-  if (property_encoding_ != DICTIONARY) {
+  if (holder_map_->is_dictionary_map()) {
+    PropertyDetails details(attributes, NORMAL, 0);
+    JSObject::SetNormalizedProperty(holder, name(), value, details);
+  } else {
holder_map_ = Map::ReconfigureDataProperty(holder_map_, descriptor_number(),
                                                attributes);
     JSObject::MigrateToMap(holder, holder_map_);
   }
-
-  if (holder_map_->is_dictionary_map()) {
-    PropertyDetails details(attributes, NORMAL, 0);
-    JSObject::SetNormalizedProperty(holder, name(), value, details);
-  }

   ReloadPropertyInformation();
 }
@@ -232,21 +230,17 @@
 Handle<Object> LookupIterator::FetchValue() const {
   Object* result = NULL;
   Handle<JSObject> holder = GetHolder<JSObject>();
-  switch (property_encoding_) {
-    case DICTIONARY:
-      result = holder->property_dictionary()->ValueAt(number_);
-      if (holder->IsGlobalObject()) {
-        result = PropertyCell::cast(result)->value();
-      }
-      break;
-    case DESCRIPTOR:
-      if (property_details_.type() == v8::internal::FIELD) {
-        FieldIndex field_index =
-            FieldIndex::ForDescriptor(*holder_map_, number_);
-        return JSObject::FastPropertyAt(
-            holder, property_details_.representation(), field_index);
-      }
-      result = holder_map_->instance_descriptors()->GetValue(number_);
+  if (holder_map_->is_dictionary_map()) {
+    result = holder->property_dictionary()->ValueAt(number_);
+    if (holder_map_->IsGlobalObjectMap()) {
+      result = PropertyCell::cast(result)->value();
+    }
+  } else if (property_details_.type() == v8::internal::FIELD) {
+ FieldIndex field_index = FieldIndex::ForDescriptor(*holder_map_, number_); + return JSObject::FastPropertyAt(holder, property_details_.representation(),
+                                    field_index);
+  } else {
+    result = holder_map_->instance_descriptors()->GetValue(number_);
   }
   return handle(result, isolate_);
 }
@@ -254,7 +248,7 @@

 int LookupIterator::GetConstantIndex() const {
   DCHECK(has_property_);
-  DCHECK_EQ(DESCRIPTOR, property_encoding_);
+  DCHECK(!holder_map_->is_dictionary_map());
   DCHECK_EQ(v8::internal::CONSTANT, property_details_.type());
   return descriptor_number();
 }
@@ -262,21 +256,21 @@

 FieldIndex LookupIterator::GetFieldIndex() const {
   DCHECK(has_property_);
-  DCHECK_EQ(DESCRIPTOR, property_encoding_);
+  DCHECK(!holder_map_->is_dictionary_map());
   DCHECK_EQ(v8::internal::FIELD, property_details_.type());
   int index =
- holder_map()->instance_descriptors()->GetFieldIndex(descriptor_number()); + holder_map_->instance_descriptors()->GetFieldIndex(descriptor_number());
   bool is_double = representation().IsDouble();
-  return FieldIndex::ForPropertyIndex(*holder_map(), index, is_double);
+  return FieldIndex::ForPropertyIndex(*holder_map_, index, is_double);
 }


 Handle<HeapType> LookupIterator::GetFieldType() const {
   DCHECK(has_property_);
-  DCHECK_EQ(DESCRIPTOR, property_encoding_);
+  DCHECK(!holder_map_->is_dictionary_map());
   DCHECK_EQ(v8::internal::FIELD, property_details_.type());
   return handle(
- holder_map()->instance_descriptors()->GetFieldType(descriptor_number()), + holder_map_->instance_descriptors()->GetFieldType(descriptor_number()),
       isolate_);
 }

@@ -306,7 +300,7 @@
   DCHECK(is_guaranteed_to_have_holder());
   DCHECK_EQ(DATA, state_);
   Handle<JSObject> holder = GetHolder<JSObject>();
-  if (property_encoding_ == DICTIONARY) {
+  if (holder_map_->is_dictionary_map()) {
     NameDictionary* property_dictionary = holder->property_dictionary();
     if (holder->IsGlobalObject()) {
       Handle<PropertyCell> cell(
=======================================
--- /branches/bleeding_edge/src/lookup.h        Thu Sep  4 12:28:13 2014 UTC
+++ /branches/bleeding_edge/src/lookup.h        Thu Sep  4 13:17:04 2014 UTC
@@ -43,16 +43,10 @@
     BEFORE_PROPERTY = INTERCEPTOR
   };

-  enum PropertyEncoding {
-    DICTIONARY,
-    DESCRIPTOR
-  };
-
   LookupIterator(Handle<Object> receiver, Handle<Name> name,
                  Configuration configuration = PROTOTYPE_CHAIN)
       : configuration_(ComputeConfiguration(configuration, name)),
         state_(NOT_FOUND),
-        property_encoding_(DESCRIPTOR),
         property_details_(NONE, NORMAL, Representation::None()),
         isolate_(name->GetIsolate()),
         name_(name),
@@ -69,7 +63,6 @@
                  Configuration configuration = PROTOTYPE_CHAIN)
       : configuration_(ComputeConfiguration(configuration, name)),
         state_(NOT_FOUND),
-        property_encoding_(DESCRIPTOR),
         property_details_(NONE, NORMAL, Representation::None()),
         isolate_(name->GetIsolate()),
         name_(name),
@@ -96,7 +89,7 @@
     return maybe_receiver_.ToHandleChecked();
   }
   Handle<JSObject> GetStoreTarget() const;
-  Handle<Map> holder_map() const { return holder_map_; }
+ bool is_dictionary_holder() const { return holder_map_->is_dictionary_map(); }
   Handle<Map> transition_map() const {
     DCHECK_EQ(TRANSITION, state_);
     return transition_map_;
@@ -132,10 +125,6 @@
   void TransitionToAccessorProperty(AccessorComponent component,
                                     Handle<Object> accessor,
                                     PropertyAttributes attributes);
-  PropertyEncoding property_encoding() const {
-    DCHECK(has_property_);
-    return property_encoding_;
-  }
   PropertyDetails property_details() const {
     DCHECK(has_property_);
     return property_details_;
@@ -181,12 +170,12 @@
   }
   int descriptor_number() const {
     DCHECK(has_property_);
-    DCHECK_EQ(DESCRIPTOR, property_encoding_);
+    DCHECK(!holder_map_->is_dictionary_map());
     return number_;
   }
   int dictionary_entry() const {
     DCHECK(has_property_);
-    DCHECK_EQ(DICTIONARY, property_encoding_);
+    DCHECK(holder_map_->is_dictionary_map());
     return number_;
   }

@@ -204,7 +193,6 @@
   Configuration configuration_;
   State state_;
   bool has_property_;
-  PropertyEncoding property_encoding_;
   PropertyDetails property_details_;
   Isolate* isolate_;
   Handle<Name> name_;

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to