map->set_unused_property_fields(in_object_properties);
map->set_prototype(prototype);
- // If the function has only simple this property assignments add field
- // descriptors for these to the initial map as the object cannot be
- // constructed without having these properties.
+ // If the function has only simple this property assignments add
+ // field descriptors for these to the initial map as the object
+ // cannot be constructed without having these properties. Guard by
+ // the inline_new flag so we only change the map if we generate a
+ // specialized construct stub.
ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields);
- if (fun->shared()->has_only_simple_this_property_assignments() &&
+ if (FLAG_inline_new &&
+ fun->shared()->has_only_simple_this_property_assignments() &&
fun->shared()->this_property_assignments_count() > 0) {
int count = fun->shared()->this_property_assignments_count();
if (count > in_object_properties) {
// Propagate the collected information on this property assignments.
if (top_scope_->is_function_scope()) {
bool only_simple_this_property_assignments =
- this_property_assignment_finder.only_simple_this_property_assignments();
+ this_property_assignment_finder.only_simple_this_property_assignments()
+ && top_scope_->declarations()->length() == 0;
if (only_simple_this_property_assignments) {
temp_scope_->SetThisPropertyAssignmentInfo(
only_simple_this_property_assignments,
static Code* ComputeConstructStub(Handle<SharedFunctionInfo> shared) {
- // TODO(385): Change this to create a construct stub specialized for
- // the given map to make allocation of simple objects - and maybe
- // arrays - much faster.
if (FLAG_inline_new
&& shared->has_only_simple_this_property_assignments()) {
ConstructStubCompiler compiler;