1.1 --- a/src/BytecodeCompiler.cpp Fri Sep 14 02:38:14 2012 -0700
1.2 +++ b/src/BytecodeCompiler.cpp Sat Sep 15 13:15:51 2012 -0700
1.3 @@ -777,10 +777,8 @@
1.4 __ note_position(node->pos());
1.5 if (var->scope()->kind() == Scope::GLOBAL)
1.6 __ newarray(map, Heap::Tenure_Old);
1.7 - else if (var->needsHeapAllocation())
1.8 + else
1.9 __ newarray(map, Heap::Tenure_Default);
1.10 - else
1.11 - __ newarray(map, Heap::Tenure_Stack);
1.12
1.13 if (node->initialization()) {
1.14 node->initialization()->accept(this);
1.15 @@ -827,9 +825,8 @@
1.16 // Sniff out natives, which have a specific opcode and are guaranteed to
1.17 // be called via name proxy.
1.18 NamedFunction *native = NULL;
1.19 - if (funType->isNative()) {
1.20 + if (funType->isNative())
1.21 native = node->callee()->toNameProxy()->binding()->toNamedFunction();
1.22 - }
1.23
1.24 Local<Type> given(zone_);
1.25 for (size_t i = node->arguments()->length() - 1; i < node->arguments()->length(); i--) {
1.26 @@ -920,7 +917,13 @@
1.27 // change in the future, we do the same thing and dupe the
1.28 // newly allocated array.
1.29 map = ArrayMap::cast(array->map());
1.30 - __ newarray(map, Heap::Tenure_Stack);
1.31 +
1.32 + // Natives cannot escape array references, so we can allocate
1.33 + // them on the LIFO stack.
1.34 + if (funType->isNative())
1.35 + __ newarray(map, Heap::Tenure_Stack);
1.36 + else
1.37 + __ newarray(map, Heap::Tenure_Default);
1.38 __ dup();
1.39 __ object(array);
1.40 __ copyarray();