Added LookupResult::GetValueFromMap.

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

Review URL: https://chromiumcodereview.appspot.com/10702108

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@11996 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 791632cf
...@@ -337,10 +337,8 @@ class LookupResult BASE_EMBEDDED { ...@@ -337,10 +337,8 @@ class LookupResult BASE_EMBEDDED {
} }
int GetLocalFieldIndexFromMap(Map* map) { int GetLocalFieldIndexFromMap(Map* map) {
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
ASSERT(IsField()); ASSERT(IsField());
return Descriptor::IndexFromValue( return Descriptor::IndexFromValue(GetValueFromMap(map)) -
map->instance_descriptors()->GetValue(number_)) -
map->inobject_properties(); map->inobject_properties();
} }
...@@ -355,9 +353,8 @@ class LookupResult BASE_EMBEDDED { ...@@ -355,9 +353,8 @@ class LookupResult BASE_EMBEDDED {
} }
JSFunction* GetConstantFunctionFromMap(Map* map) { JSFunction* GetConstantFunctionFromMap(Map* map) {
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
ASSERT(type() == CONSTANT_FUNCTION); ASSERT(type() == CONSTANT_FUNCTION);
return JSFunction::cast(map->instance_descriptors()->GetValue(number_)); return JSFunction::cast(GetValueFromMap(map));
} }
Object* GetCallbackObject() { Object* GetCallbackObject() {
...@@ -377,14 +374,18 @@ class LookupResult BASE_EMBEDDED { ...@@ -377,14 +374,18 @@ class LookupResult BASE_EMBEDDED {
Object* GetValue() { Object* GetValue() {
if (lookup_type_ == DESCRIPTOR_TYPE) { if (lookup_type_ == DESCRIPTOR_TYPE) {
DescriptorArray* descriptors = holder()->map()->instance_descriptors(); return GetValueFromMap(holder()->map());
return descriptors->GetValue(number_);
} }
// In the dictionary case, the data is held in the value field. // In the dictionary case, the data is held in the value field.
ASSERT(lookup_type_ == DICTIONARY_TYPE); ASSERT(lookup_type_ == DICTIONARY_TYPE);
return holder()->GetNormalizedProperty(this); return holder()->GetNormalizedProperty(this);
} }
Object* GetValueFromMap(Map* map) const {
ASSERT(lookup_type_ == DESCRIPTOR_TYPE);
return map->instance_descriptors()->GetValue(number_);
}
void Iterate(ObjectVisitor* visitor); void Iterate(ObjectVisitor* visitor);
private: private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment