Closed Bug 742784 Opened 12 years ago Closed 12 years ago

IonMonkey: "new Array(x)" should not allocate space for the elements

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 742829

People

(Reporter: jandem, Unassigned)

References

(Blocks 1 open bug)

Details

ion::NewInitArray calls NewDenseAllocatedArray, but js_Array calls NewDenseUnallocatedArray. To match the interpreter and JM, we should allocate space for array literals but not for "new Array(x)".

Consider also this micro-benchmark:
--
function f() {
    for (var i=0; i<1000000; i++)
        var a = Array(100);
    return a;
}
var t = new Date;
f();
print(new Date - t);
--
JM+TI: 18 ms
Ion:  477 ms
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.