Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(625)

Unified Diff: src/objects.cc

Issue 10538104: Optimization of some packed array cases. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ready to review Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/elements.cc ('K') | « src/elements.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
« src/elements.cc ('K') | « src/elements.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698