Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 692fa87e6b733f9d72c0fdad58ec0797abe68527..8e55700f536f8294e0238dc4246f60717a206406 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -4247,11 +4247,14 @@ bool JSReceiver::IsSimpleEnum() { |
} |
-int Map::NumberOfDescribedProperties() { |
+int Map::NumberOfDescribedProperties(PropertyAttributes filter) { |
int result = 0; |
DescriptorArray* descs = instance_descriptors(); |
for (int i = 0; i < descs->number_of_descriptors(); i++) { |
- if (descs->IsProperty(i)) result++; |
+ PropertyDetails details(descs->GetDetails(i)); |
Jakob Kummerow
2012/02/06 13:18:35
nit: indentation
Sven Panne
2012/02/06 13:37:29
Done.
|
+ if (descs->IsProperty(i) && (details.attributes() & filter) == 0) { |
+ result++; |
+ } |
} |
return result; |
} |
@@ -10355,24 +10358,9 @@ bool JSObject::HasRealNamedCallbackProperty(String* key) { |
int JSObject::NumberOfLocalProperties(PropertyAttributes filter) { |
- if (HasFastProperties()) { |
- DescriptorArray* descs = map()->instance_descriptors(); |
- int result = 0; |
- for (int i = 0; i < descs->number_of_descriptors(); i++) { |
- PropertyDetails details(descs->GetDetails(i)); |
- if (descs->IsProperty(i) && (details.attributes() & filter) == 0) { |
- result++; |
- } |
- } |
- return result; |
- } else { |
- return property_dictionary()->NumberOfElementsFilterAttributes(filter); |
- } |
-} |
- |
- |
-int JSObject::NumberOfEnumProperties() { |
- return NumberOfLocalProperties(static_cast<PropertyAttributes>(DONT_ENUM)); |
+ return HasFastProperties() ? |
+ map()->NumberOfDescribedProperties(filter) : |
+ property_dictionary()->NumberOfElementsFilterAttributes(filter); |
} |
@@ -10493,7 +10481,7 @@ void FixedArray::SortPairs(FixedArray* numbers, uint32_t len) { |
// purpose of this function is to provide reflection information for the object |
// mirrors. |
void JSObject::GetLocalPropertyNames(FixedArray* storage, int index) { |
- ASSERT(storage->length() >= (NumberOfLocalProperties(NONE) - index)); |
+ ASSERT(storage->length() >= (NumberOfLocalProperties() - index)); |
if (HasFastProperties()) { |
DescriptorArray* descs = map()->instance_descriptors(); |
for (int i = 0; i < descs->number_of_descriptors(); i++) { |