Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 128902f93afefbc2cea441bbccc487d2538f0743..9ed5310b5c9bd8253446234e270a8d6ea26dd952 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -10023,6 +10023,12 @@ void JSObject::GetElementsCapacityAndUsage(int* capacity, int* used) { |
// Fall through. |
case FAST_SMI_ELEMENTS: |
case FAST_ELEMENTS: |
+ if (FLAG_packed_arrays && IsJSArray()) { |
Jakob Kummerow
2012/06/12 12:50:44
This flag check isn't necessary, as we can't have
danno
2012/06/12 15:38:14
Done.
|
+ *capacity = backing_store_base->length(); |
+ *used = Smi::cast(JSArray::cast(this)->length())->value(); |
+ break; |
+ } |
+ // Fall through if packing is not guaranteed. |
case FAST_HOLEY_SMI_ELEMENTS: |
case FAST_HOLEY_ELEMENTS: |
backing_store = FixedArray::cast(backing_store_base); |
@@ -10039,6 +10045,12 @@ void JSObject::GetElementsCapacityAndUsage(int* capacity, int* used) { |
break; |
} |
case FAST_DOUBLE_ELEMENTS: |
+ if (FLAG_packed_arrays && IsJSArray()) { |
+ *capacity = backing_store_base->length(); |
+ *used = Smi::cast(JSArray::cast(this)->length())->value(); |
+ break; |
+ } |
+ // Fall through if packing is not guaranteed. |
case FAST_HOLEY_DOUBLE_ELEMENTS: { |
FixedDoubleArray* elms = FixedDoubleArray::cast(elements()); |
*capacity = elms->length(); |