It turns out our cleverness trying to make this fast defeated us. Doing the simple thing turns out to be faster on both IE and FF for all reasonable values I can measure.
Review by: bobv (postmortem)
git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@1684 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Array.java b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Array.java
index 1581836..e9c0eb5 100644
--- a/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Array.java
+++ b/dev/core/super/com/google/gwt/dev/jjs/intrinsic/com/google/gwt/lang/Array.java
@@ -32,8 +32,8 @@
static final int ZERO_SEED_TYPE = 1;
/**
- * Stores the prototype for java.lang.Object so that arrays can get their
- * polymorphic methods via expando.
+ * Stores the prototype Array so that arrays can get their polymorphic methods
+ * via expando.
*/
private static Array protoTypeArray;
@@ -155,17 +155,13 @@
* @return the new JSON array
*/
private static native Array createFromSeed(int seedType, int length) /*-{
- var seedArrays = [[null], [0], [false]];
- var blankArray = seedArrays[seedType];
-
- while (blankArray.length < length) {
- // Doubles each iteration.
- blankArray = blankArray.concat(blankArray);
+ var seedArray = [null, 0, false];
+ var value = seedArray[seedType];
+ var array = new Array(length);
+ for (var i = 0; i < length; ++i) {
+ array[i] = value;
}
-
- // Remove the excess.
- blankArray.length = length;
- return blankArray;
+ return array;
}-*/;
private static Array initDims(Class arrayClasses[], int[] typeIdExprs,