OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 4128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4139 fun->shared()->ForbidInlineConstructor(); | 4139 fun->shared()->ForbidInlineConstructor(); |
4140 } else { | 4140 } else { |
4141 DescriptorArray* descriptors; | 4141 DescriptorArray* descriptors; |
4142 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(count); | 4142 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(count); |
4143 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; | 4143 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; |
4144 | 4144 |
4145 DescriptorArray::WhitenessWitness witness(descriptors); | 4145 DescriptorArray::WhitenessWitness witness(descriptors); |
4146 for (int i = 0; i < count; i++) { | 4146 for (int i = 0; i < count; i++) { |
4147 String* name = fun->shared()->GetThisPropertyAssignmentName(i); | 4147 String* name = fun->shared()->GetThisPropertyAssignmentName(i); |
4148 ASSERT(name->IsInternalizedString()); | 4148 ASSERT(name->IsInternalizedString()); |
4149 FieldDescriptor field(name, i, NONE, i + 1); | 4149 // TODO(verwaest): Since we cannot update the boilerplate's map yet, |
| 4150 // initialize to the worst case. |
| 4151 FieldDescriptor field(name, i, NONE, Representation::Tagged(), i + 1); |
4150 descriptors->Set(i, &field, witness); | 4152 descriptors->Set(i, &field, witness); |
4151 } | 4153 } |
4152 descriptors->Sort(); | 4154 descriptors->Sort(); |
4153 | 4155 |
4154 // The descriptors may contain duplicates because the compiler does not | 4156 // The descriptors may contain duplicates because the compiler does not |
4155 // guarantee the uniqueness of property names (it would have required | 4157 // guarantee the uniqueness of property names (it would have required |
4156 // quadratic time). Once the descriptors are sorted we can check for | 4158 // quadratic time). Once the descriptors are sorted we can check for |
4157 // duplicates in linear time. | 4159 // duplicates in linear time. |
4158 if (HasDuplicates(descriptors)) { | 4160 if (HasDuplicates(descriptors)) { |
4159 fun->shared()->ForbidInlineConstructor(); | 4161 fun->shared()->ForbidInlineConstructor(); |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4573 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary; | 4575 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary; |
4574 | 4576 |
4575 // The global object might be created from an object template with accessors. | 4577 // The global object might be created from an object template with accessors. |
4576 // Fill these accessors into the dictionary. | 4578 // Fill these accessors into the dictionary. |
4577 DescriptorArray* descs = map->instance_descriptors(); | 4579 DescriptorArray* descs = map->instance_descriptors(); |
4578 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 4580 for (int i = 0; i < descs->number_of_descriptors(); i++) { |
4579 PropertyDetails details = descs->GetDetails(i); | 4581 PropertyDetails details = descs->GetDetails(i); |
4580 ASSERT(details.type() == CALLBACKS); // Only accessors are expected. | 4582 ASSERT(details.type() == CALLBACKS); // Only accessors are expected. |
4581 PropertyDetails d = PropertyDetails(details.attributes(), | 4583 PropertyDetails d = PropertyDetails(details.attributes(), |
4582 CALLBACKS, | 4584 CALLBACKS, |
| 4585 Representation::None(), |
4583 details.descriptor_index()); | 4586 details.descriptor_index()); |
4584 Object* value = descs->GetCallbacksObject(i); | 4587 Object* value = descs->GetCallbacksObject(i); |
4585 MaybeObject* maybe_value = AllocateJSGlobalPropertyCell(value); | 4588 MaybeObject* maybe_value = AllocateJSGlobalPropertyCell(value); |
4586 if (!maybe_value->ToObject(&value)) return maybe_value; | 4589 if (!maybe_value->ToObject(&value)) return maybe_value; |
4587 | 4590 |
4588 MaybeObject* maybe_added = dictionary->Add(descs->GetKey(i), value, d); | 4591 MaybeObject* maybe_added = dictionary->Add(descs->GetKey(i), value, d); |
4589 if (!maybe_added->To(&dictionary)) return maybe_added; | 4592 if (!maybe_added->To(&dictionary)) return maybe_added; |
4590 } | 4593 } |
4591 | 4594 |
4592 // Allocate the global object and initialize it with the backing store. | 4595 // Allocate the global object and initialize it with the backing store. |
(...skipping 3260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7853 static_cast<int>(object_sizes_last_time_[index])); | 7856 static_cast<int>(object_sizes_last_time_[index])); |
7854 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) | 7857 FIXED_ARRAY_SUB_INSTANCE_TYPE_LIST(ADJUST_LAST_TIME_OBJECT_COUNT) |
7855 #undef ADJUST_LAST_TIME_OBJECT_COUNT | 7858 #undef ADJUST_LAST_TIME_OBJECT_COUNT |
7856 | 7859 |
7857 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); | 7860 OS::MemCopy(object_counts_last_time_, object_counts_, sizeof(object_counts_)); |
7858 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); | 7861 OS::MemCopy(object_sizes_last_time_, object_sizes_, sizeof(object_sizes_)); |
7859 ClearObjectStats(); | 7862 ClearObjectStats(); |
7860 } | 7863 } |
7861 | 7864 |
7862 } } // namespace v8::internal | 7865 } } // namespace v8::internal |
OLD | NEW |