diff -r 9d17f29fe16a -r 23a804fa1d3e src/BytecodeCompiler.cpp --- a/src/BytecodeCompiler.cpp Sun Sep 16 22:49:54 2012 -0700 +++ b/src/BytecodeCompiler.cpp Sun Sep 16 23:15:13 2012 -0700 @@ -987,10 +987,17 @@ } } } else if (type->isStruct()) { - Local map(zone_, type->newMap()); + Local map(zone_, StructMap::cast(type->newMap())); + + // Because structs can contain arrays, any sort of composition + // triggers non-LIFO allocation. This is just for correctness. + // We could do better by: + // (1) Limiting to structs that just (recursively) contain arrays, + // (2) Swap Stack for Default tenure in Struct::New + // (3) JIT analysis if (var->scope()->kind() == Scope::GLOBAL) __ newstruct(map, Heap::Tenure_Old); - else if (var->needsHeapAllocation()) + else if (var->needsHeapAllocation() || map->composed()) __ newstruct(map, Heap::Tenure_Default); else __ newstruct(map, Heap::Tenure_Stack);