OLD | NEW |
1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2376 prototype = fun->instance_prototype(); | 2376 prototype = fun->instance_prototype(); |
2377 } else { | 2377 } else { |
2378 prototype = AllocateFunctionPrototype(fun); | 2378 prototype = AllocateFunctionPrototype(fun); |
2379 if (prototype->IsFailure()) return prototype; | 2379 if (prototype->IsFailure()) return prototype; |
2380 } | 2380 } |
2381 Map* map = Map::cast(map_obj); | 2381 Map* map = Map::cast(map_obj); |
2382 map->set_inobject_properties(in_object_properties); | 2382 map->set_inobject_properties(in_object_properties); |
2383 map->set_unused_property_fields(in_object_properties); | 2383 map->set_unused_property_fields(in_object_properties); |
2384 map->set_prototype(prototype); | 2384 map->set_prototype(prototype); |
2385 | 2385 |
2386 // If the function has only simple this property assignments add field | 2386 // If the function has only simple this property assignments add |
2387 // descriptors for these to the initial map as the object cannot be | 2387 // field descriptors for these to the initial map as the object |
2388 // constructed without having these properties. | 2388 // cannot be constructed without having these properties. Guard by |
| 2389 // the inline_new flag so we only change the map if we generate a |
| 2390 // specialized construct stub. |
2389 ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields); | 2391 ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields); |
2390 if (fun->shared()->has_only_simple_this_property_assignments() && | 2392 if (FLAG_inline_new && |
| 2393 fun->shared()->has_only_simple_this_property_assignments() && |
2391 fun->shared()->this_property_assignments_count() > 0) { | 2394 fun->shared()->this_property_assignments_count() > 0) { |
2392 int count = fun->shared()->this_property_assignments_count(); | 2395 int count = fun->shared()->this_property_assignments_count(); |
2393 if (count > in_object_properties) { | 2396 if (count > in_object_properties) { |
2394 count = in_object_properties; | 2397 count = in_object_properties; |
2395 } | 2398 } |
2396 Object* descriptors_obj = DescriptorArray::Allocate(count); | 2399 Object* descriptors_obj = DescriptorArray::Allocate(count); |
2397 if (descriptors_obj->IsFailure()) return descriptors_obj; | 2400 if (descriptors_obj->IsFailure()) return descriptors_obj; |
2398 DescriptorArray* descriptors = DescriptorArray::cast(descriptors_obj); | 2401 DescriptorArray* descriptors = DescriptorArray::cast(descriptors_obj); |
2399 for (int i = 0; i < count; i++) { | 2402 for (int i = 0; i < count; i++) { |
2400 String* name = fun->shared()->GetThisPropertyAssignmentName(i); | 2403 String* name = fun->shared()->GetThisPropertyAssignmentName(i); |
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4218 void ExternalStringTable::TearDown() { | 4221 void ExternalStringTable::TearDown() { |
4219 new_space_strings_.Free(); | 4222 new_space_strings_.Free(); |
4220 old_space_strings_.Free(); | 4223 old_space_strings_.Free(); |
4221 } | 4224 } |
4222 | 4225 |
4223 | 4226 |
4224 List<Object*> ExternalStringTable::new_space_strings_; | 4227 List<Object*> ExternalStringTable::new_space_strings_; |
4225 List<Object*> ExternalStringTable::old_space_strings_; | 4228 List<Object*> ExternalStringTable::old_space_strings_; |
4226 | 4229 |
4227 } } // namespace v8::internal | 4230 } } // namespace v8::internal |
OLD | NEW |