| 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 2071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2082 // If the function has only simple this property assignments add field | 2082 // If the function has only simple this property assignments add field |
| 2083 // descriptors for these to the initial map as the object cannot be | 2083 // descriptors for these to the initial map as the object cannot be |
| 2084 // constructed without having these properties. | 2084 // constructed without having these properties. |
| 2085 ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields); | 2085 ASSERT(in_object_properties <= Map::kMaxPreAllocatedPropertyFields); |
| 2086 if (fun->shared()->has_only_this_property_assignments() && | 2086 if (fun->shared()->has_only_this_property_assignments() && |
| 2087 fun->shared()->this_property_assignments_count() > 0) { | 2087 fun->shared()->this_property_assignments_count() > 0) { |
| 2088 int count = fun->shared()->this_property_assignments_count(); | 2088 int count = fun->shared()->this_property_assignments_count(); |
| 2089 if (count > in_object_properties) { | 2089 if (count > in_object_properties) { |
| 2090 count = in_object_properties; | 2090 count = in_object_properties; |
| 2091 } | 2091 } |
| 2092 DescriptorArray* descriptors = *Factory::NewDescriptorArray(count); | 2092 Object* descriptors_obj = DescriptorArray::Allocate(count); |
| 2093 if (descriptors->IsFailure()) return descriptors; | 2093 if (descriptors_obj->IsFailure()) return descriptors_obj; |
| 2094 DescriptorArray* descriptors = DescriptorArray::cast(descriptors_obj); |
| 2094 for (int i = 0; i < count; i++) { | 2095 for (int i = 0; i < count; i++) { |
| 2095 String* name = fun->shared()->GetThisPropertyAssignmentName(i); | 2096 String* name = fun->shared()->GetThisPropertyAssignmentName(i); |
| 2096 ASSERT(name->IsSymbol()); | 2097 ASSERT(name->IsSymbol()); |
| 2097 FieldDescriptor field(name, i, NONE); | 2098 FieldDescriptor field(name, i, NONE); |
| 2098 descriptors->Set(i, &field); | 2099 descriptors->Set(i, &field); |
| 2099 } | 2100 } |
| 2100 descriptors->Sort(); | 2101 descriptors->Sort(); |
| 2101 map->set_instance_descriptors(descriptors); | 2102 map->set_instance_descriptors(descriptors); |
| 2102 map->set_pre_allocated_property_fields(count); | 2103 map->set_pre_allocated_property_fields(count); |
| 2103 map->set_unused_property_fields(in_object_properties - count); | 2104 map->set_unused_property_fields(in_object_properties - count); |
| (...skipping 1813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3917 #ifdef DEBUG | 3918 #ifdef DEBUG |
| 3918 bool Heap::GarbageCollectionGreedyCheck() { | 3919 bool Heap::GarbageCollectionGreedyCheck() { |
| 3919 ASSERT(FLAG_gc_greedy); | 3920 ASSERT(FLAG_gc_greedy); |
| 3920 if (Bootstrapper::IsActive()) return true; | 3921 if (Bootstrapper::IsActive()) return true; |
| 3921 if (disallow_allocation_failure()) return true; | 3922 if (disallow_allocation_failure()) return true; |
| 3922 return CollectGarbage(0, NEW_SPACE); | 3923 return CollectGarbage(0, NEW_SPACE); |
| 3923 } | 3924 } |
| 3924 #endif | 3925 #endif |
| 3925 | 3926 |
| 3926 } } // namespace v8::internal | 3927 } } // namespace v8::internal |
| OLD | NEW |