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 4142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4153 DescriptorArray* descriptors; | 4153 DescriptorArray* descriptors; |
4154 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(count); | 4154 MaybeObject* maybe_descriptors = DescriptorArray::Allocate(count); |
4155 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; | 4155 if (!maybe_descriptors->To(&descriptors)) return maybe_descriptors; |
4156 | 4156 |
4157 DescriptorArray::WhitenessWitness witness(descriptors); | 4157 DescriptorArray::WhitenessWitness witness(descriptors); |
4158 for (int i = 0; i < count; i++) { | 4158 for (int i = 0; i < count; i++) { |
4159 String* name = fun->shared()->GetThisPropertyAssignmentName(i); | 4159 String* name = fun->shared()->GetThisPropertyAssignmentName(i); |
4160 ASSERT(name->IsInternalizedString()); | 4160 ASSERT(name->IsInternalizedString()); |
4161 // TODO(verwaest): Since we cannot update the boilerplate's map yet, | 4161 // TODO(verwaest): Since we cannot update the boilerplate's map yet, |
4162 // initialize to the worst case. | 4162 // initialize to the worst case. |
4163 FieldDescriptor field(name, i, NONE, Representation::Tagged(), i + 1); | 4163 FieldDescriptor field(name, i, NONE, Representation::Tagged()); |
4164 descriptors->Set(i, &field, witness); | 4164 descriptors->Set(i, &field, witness); |
4165 } | 4165 } |
4166 descriptors->Sort(); | 4166 descriptors->Sort(); |
4167 | 4167 |
4168 // The descriptors may contain duplicates because the compiler does not | 4168 // The descriptors may contain duplicates because the compiler does not |
4169 // guarantee the uniqueness of property names (it would have required | 4169 // guarantee the uniqueness of property names (it would have required |
4170 // quadratic time). Once the descriptors are sorted we can check for | 4170 // quadratic time). Once the descriptors are sorted we can check for |
4171 // duplicates in linear time. | 4171 // duplicates in linear time. |
4172 if (HasDuplicates(descriptors)) { | 4172 if (HasDuplicates(descriptors)) { |
4173 fun->shared()->ForbidInlineConstructor(); | 4173 fun->shared()->ForbidInlineConstructor(); |
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4582 NameDictionary* dictionary; | 4582 NameDictionary* dictionary; |
4583 MaybeObject* maybe_dictionary = | 4583 MaybeObject* maybe_dictionary = |
4584 NameDictionary::Allocate( | 4584 NameDictionary::Allocate( |
4585 this, | 4585 this, |
4586 map->NumberOfOwnDescriptors() * 2 + initial_size); | 4586 map->NumberOfOwnDescriptors() * 2 + initial_size); |
4587 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary; | 4587 if (!maybe_dictionary->To(&dictionary)) return maybe_dictionary; |
4588 | 4588 |
4589 // The global object might be created from an object template with accessors. | 4589 // The global object might be created from an object template with accessors. |
4590 // Fill these accessors into the dictionary. | 4590 // Fill these accessors into the dictionary. |
4591 DescriptorArray* descs = map->instance_descriptors(); | 4591 DescriptorArray* descs = map->instance_descriptors(); |
4592 for (int i = 0; i < descs->number_of_descriptors(); i++) { | 4592 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
4593 PropertyDetails details = descs->GetDetails(i); | 4593 PropertyDetails details = descs->GetDetails(i); |
4594 ASSERT(details.type() == CALLBACKS); // Only accessors are expected. | 4594 ASSERT(details.type() == CALLBACKS); // Only accessors are expected. |
4595 PropertyDetails d = PropertyDetails(details.attributes(), | 4595 PropertyDetails d = PropertyDetails(details.attributes(), CALLBACKS, i + 1); |
4596 CALLBACKS, | |
4597 Representation::None(), | |
4598 details.descriptor_index()); | |
4599 Object* value = descs->GetCallbacksObject(i); | 4596 Object* value = descs->GetCallbacksObject(i); |
4600 MaybeObject* maybe_value = AllocateJSGlobalPropertyCell(value); | 4597 MaybeObject* maybe_value = AllocateJSGlobalPropertyCell(value); |
4601 if (!maybe_value->ToObject(&value)) return maybe_value; | 4598 if (!maybe_value->ToObject(&value)) return maybe_value; |
4602 | 4599 |
4603 MaybeObject* maybe_added = dictionary->Add(descs->GetKey(i), value, d); | 4600 MaybeObject* maybe_added = dictionary->Add(descs->GetKey(i), value, d); |
4604 if (!maybe_added->To(&dictionary)) return maybe_added; | 4601 if (!maybe_added->To(&dictionary)) return maybe_added; |
4605 } | 4602 } |
4606 | 4603 |
4607 // Allocate the global object and initialize it with the backing store. | 4604 // Allocate the global object and initialize it with the backing store. |
4608 JSObject* global; | 4605 JSObject* global; |
(...skipping 3278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7887 if (FLAG_parallel_recompilation) { | 7884 if (FLAG_parallel_recompilation) { |
7888 heap_->relocation_mutex_->Lock(); | 7885 heap_->relocation_mutex_->Lock(); |
7889 #ifdef DEBUG | 7886 #ifdef DEBUG |
7890 heap_->relocation_mutex_locked_by_optimizer_thread_ = | 7887 heap_->relocation_mutex_locked_by_optimizer_thread_ = |
7891 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); | 7888 heap_->isolate()->optimizing_compiler_thread()->IsOptimizerThread(); |
7892 #endif // DEBUG | 7889 #endif // DEBUG |
7893 } | 7890 } |
7894 } | 7891 } |
7895 | 7892 |
7896 } } // namespace v8::internal | 7893 } } // namespace v8::internal |
OLD | NEW |