[core] Optimized array.new for literal use case

e.g. [1,2,3]