Revision: 11996
Author:   [email protected]
Date:     Fri Jul  6 01:11:10 2012
Log:      Added LookupResult::GetValueFromMap.

This is needed later for crankshafted accessors and reduces copy-n-paste a bit.

Review URL: https://chromiumcodereview.appspot.com/10702108
http://code.google.com/p/v8/source/detail?r=11996

Modified:
 /branches/bleeding_edge/src/property.h

=======================================
--- /branches/bleeding_edge/src/property.h      Thu Jul  5 06:54:20 2012
+++ /branches/bleeding_edge/src/property.h      Fri Jul  6 01:11:10 2012
@@ -337,10 +337,8 @@
   }

   int GetLocalFieldIndexFromMap(Map* map) {
-    ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
     ASSERT(IsField());
-    return Descriptor::IndexFromValue(
-        map->instance_descriptors()->GetValue(number_)) -
+    return Descriptor::IndexFromValue(GetValueFromMap(map)) -
         map->inobject_properties();
   }

@@ -355,9 +353,8 @@
   }

   JSFunction* GetConstantFunctionFromMap(Map* map) {
-    ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
     ASSERT(type() == CONSTANT_FUNCTION);
- return JSFunction::cast(map->instance_descriptors()->GetValue(number_));
+    return JSFunction::cast(GetValueFromMap(map));
   }

   Object* GetCallbackObject() {
@@ -377,13 +374,17 @@

   Object* GetValue() {
     if (lookup_type_ == DESCRIPTOR_TYPE) {
- DescriptorArray* descriptors = holder()->map()->instance_descriptors();
-      return descriptors->GetValue(number_);
+      return GetValueFromMap(holder()->map());
     }
     // In the dictionary case, the data is held in the value field.
     ASSERT(lookup_type_ == DICTIONARY_TYPE);
     return holder()->GetNormalizedProperty(this);
   }
+
+  Object* GetValueFromMap(Map* map) const {
+    ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
+    return map->instance_descriptors()->GetValue(number_);
+  }

   void Iterate(ObjectVisitor* visitor);

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to