Revision: 10181
Author: [email protected]
Date: Tue Dec 6 09:21:48 2011
Log: Don't track Smi->Double->Object element transitions for small
undefined arrays.
[email protected]
BUG=
TEST=
Review URL: http://codereview.chromium.org/8816009
http://code.google.com/p/v8/source/detail?r=10181
Modified:
/branches/bleeding_edge/src/parser.cc
=======================================
--- /branches/bleeding_edge/src/parser.cc Mon Dec 5 06:43:28 2011
+++ /branches/bleeding_edge/src/parser.cc Tue Dec 6 09:21:48 2011
@@ -3378,6 +3378,7 @@
isolate()->factory()->NewFixedArray(values->length(), TENURED);
Handle<FixedDoubleArray> double_literals;
ElementsKind elements_kind = FAST_SMI_ONLY_ELEMENTS;
+ bool has_only_undefined_values = true;
// Fill in the literals.
bool is_simple = true;
@@ -3401,6 +3402,7 @@
// FAST_DOUBLE_ELEMENTS and FAST_ELEMENTS as necessary. Always
remember
// the tagged value, no matter what the ElementsKind is in case we
// ultimately end up in FAST_ELEMENTS.
+ has_only_undefined_values = false;
object_literals->set(i, *boilerplate_value);
if (elements_kind == FAST_SMI_ONLY_ELEMENTS) {
// Smi only elements. Notice if a transition to
FAST_DOUBLE_ELEMENTS or
@@ -3438,6 +3440,13 @@
}
}
}
+
+ // Very small array literals that don't have a concrete hint about their
type
+ // from a constant value should default to the slow case to avoid lots of
+ // elements transitions on really small objects.
+ if (has_only_undefined_values && values->length() <= 2) {
+ elements_kind = FAST_ELEMENTS;
+ }
// Simple and shallow arrays can be lazily copied, we transform the
// elements array to a copy-on-write array.
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev