OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/factory.h" | 5 #include "src/factory.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/allocation-site-scopes.h" | 8 #include "src/allocation-site-scopes.h" |
9 #include "src/ast/ast.h" | 9 #include "src/ast/ast.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1763 int at_least_space_for = map->NumberOfOwnDescriptors() * 2 + initial_size; | 1763 int at_least_space_for = map->NumberOfOwnDescriptors() * 2 + initial_size; |
1764 Handle<GlobalDictionary> dictionary = | 1764 Handle<GlobalDictionary> dictionary = |
1765 GlobalDictionary::New(isolate(), at_least_space_for); | 1765 GlobalDictionary::New(isolate(), at_least_space_for); |
1766 | 1766 |
1767 // The global object might be created from an object template with accessors. | 1767 // The global object might be created from an object template with accessors. |
1768 // Fill these accessors into the dictionary. | 1768 // Fill these accessors into the dictionary. |
1769 Handle<DescriptorArray> descs(map->instance_descriptors()); | 1769 Handle<DescriptorArray> descs(map->instance_descriptors()); |
1770 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | 1770 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
1771 PropertyDetails details = descs->GetDetails(i); | 1771 PropertyDetails details = descs->GetDetails(i); |
1772 // Only accessors are expected. | 1772 // Only accessors are expected. |
1773 DCHECK_EQ(ACCESSOR_CONSTANT, details.type()); | 1773 DCHECK_EQ(kAccessor, details.kind()); |
1774 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1, | 1774 PropertyDetails d(details.attributes(), ACCESSOR_CONSTANT, i + 1, |
1775 PropertyCellType::kMutable); | 1775 PropertyCellType::kMutable); |
1776 Handle<Name> name(descs->GetKey(i)); | 1776 Handle<Name> name(descs->GetKey(i)); |
1777 Handle<PropertyCell> cell = NewPropertyCell(); | 1777 Handle<PropertyCell> cell = NewPropertyCell(); |
1778 cell->set_value(descs->GetCallbacksObject(i)); | 1778 cell->set_value(descs->GetCallbacksObject(i)); |
1779 // |dictionary| already contains enough space for all properties. | 1779 // |dictionary| already contains enough space for all properties. |
1780 USE(GlobalDictionary::Add(dictionary, name, cell, d)); | 1780 USE(GlobalDictionary::Add(dictionary, name, cell, d)); |
1781 } | 1781 } |
1782 | 1782 |
1783 // Allocate the global object and initialize it with the backing store. | 1783 // Allocate the global object and initialize it with the backing store. |
(...skipping 1048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2832 Handle<AccessorInfo> prototype = | 2832 Handle<AccessorInfo> prototype = |
2833 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); | 2833 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); |
2834 Descriptor d = Descriptor::AccessorConstant( | 2834 Descriptor d = Descriptor::AccessorConstant( |
2835 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); | 2835 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); |
2836 map->AppendDescriptor(&d); | 2836 map->AppendDescriptor(&d); |
2837 } | 2837 } |
2838 } | 2838 } |
2839 | 2839 |
2840 } // namespace internal | 2840 } // namespace internal |
2841 } // namespace v8 | 2841 } // namespace v8 |
OLD | NEW |