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 2371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 2386 // If the function has only simple this property assignments add |
2387 // field descriptors for these to the initial map as the object | 2387 // field descriptors for these to the initial map as the object |
2388 // cannot be constructed without having these properties. Guard by | 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 | 2389 // the inline_new flag so we only change the map if we generate a |
2390 // specialized construct stub. | 2390 // specialized construct stub. |
2391 ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields); | 2391 ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields); |
2392 if (FLAG_inline_new | 2392 if (fun->shared()->CanGenerateInlineConstructor(prototype)) { |
2393 && fun->shared()->has_only_simple_this_property_assignments() | |
2394 && fun->shared()->this_property_assignments_count() > 0 | |
2395 && !JSObject::cast(prototype)->HasSetter()) { | |
2396 int count = fun->shared()->this_property_assignments_count(); | 2393 int count = fun->shared()->this_property_assignments_count(); |
2397 if (count > in_object_properties) { | 2394 if (count > in_object_properties) { |
2398 count = in_object_properties; | 2395 count = in_object_properties; |
2399 } | 2396 } |
2400 Object* descriptors_obj = DescriptorArray::Allocate(count); | 2397 Object* descriptors_obj = DescriptorArray::Allocate(count); |
2401 if (descriptors_obj->IsFailure()) return descriptors_obj; | 2398 if (descriptors_obj->IsFailure()) return descriptors_obj; |
2402 DescriptorArray* descriptors = DescriptorArray::cast(descriptors_obj); | 2399 DescriptorArray* descriptors = DescriptorArray::cast(descriptors_obj); |
2403 for (int i = 0; i < count; i++) { | 2400 for (int i = 0; i < count; i++) { |
2404 String* name = fun->shared()->GetThisPropertyAssignmentName(i); | 2401 String* name = fun->shared()->GetThisPropertyAssignmentName(i); |
2405 ASSERT(name->IsSymbol()); | 2402 ASSERT(name->IsSymbol()); |
(...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4222 void ExternalStringTable::TearDown() { | 4219 void ExternalStringTable::TearDown() { |
4223 new_space_strings_.Free(); | 4220 new_space_strings_.Free(); |
4224 old_space_strings_.Free(); | 4221 old_space_strings_.Free(); |
4225 } | 4222 } |
4226 | 4223 |
4227 | 4224 |
4228 List<Object*> ExternalStringTable::new_space_strings_; | 4225 List<Object*> ExternalStringTable::new_space_strings_; |
4229 List<Object*> ExternalStringTable::old_space_strings_; | 4226 List<Object*> ExternalStringTable::old_space_strings_; |
4230 | 4227 |
4231 } } // namespace v8::internal | 4228 } } // namespace v8::internal |
OLD | NEW |