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 1723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 // Fill these accessors into the dictionary. | 1734 // Fill these accessors into the dictionary. |
1735 Handle<DescriptorArray> descs(map->instance_descriptors()); | 1735 Handle<DescriptorArray> descs(map->instance_descriptors()); |
1736 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { | 1736 for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) { |
1737 PropertyDetails details = descs->GetDetails(i); | 1737 PropertyDetails details = descs->GetDetails(i); |
1738 // Only accessors are expected. | 1738 // Only accessors are expected. |
1739 DCHECK_EQ(kAccessor, details.kind()); | 1739 DCHECK_EQ(kAccessor, details.kind()); |
1740 PropertyDetails d(kAccessor, details.attributes(), i + 1, | 1740 PropertyDetails d(kAccessor, details.attributes(), i + 1, |
1741 PropertyCellType::kMutable); | 1741 PropertyCellType::kMutable); |
1742 Handle<Name> name(descs->GetKey(i)); | 1742 Handle<Name> name(descs->GetKey(i)); |
1743 Handle<PropertyCell> cell = NewPropertyCell(); | 1743 Handle<PropertyCell> cell = NewPropertyCell(); |
1744 cell->set_value(descs->GetCallbacksObject(i)); | 1744 cell->set_value(descs->GetValue(i)); |
1745 // |dictionary| already contains enough space for all properties. | 1745 // |dictionary| already contains enough space for all properties. |
1746 USE(GlobalDictionary::Add(dictionary, name, cell, d)); | 1746 USE(GlobalDictionary::Add(dictionary, name, cell, d)); |
1747 } | 1747 } |
1748 | 1748 |
1749 // Allocate the global object and initialize it with the backing store. | 1749 // Allocate the global object and initialize it with the backing store. |
1750 Handle<JSGlobalObject> global = New<JSGlobalObject>(map, OLD_SPACE); | 1750 Handle<JSGlobalObject> global = New<JSGlobalObject>(map, OLD_SPACE); |
1751 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); | 1751 isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map); |
1752 | 1752 |
1753 // Create a new map for the global object. | 1753 // Create a new map for the global object. |
1754 Handle<Map> new_map = Map::CopyDropDescriptors(map); | 1754 Handle<Map> new_map = Map::CopyDropDescriptors(map); |
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2804 Handle<AccessorInfo> prototype = | 2804 Handle<AccessorInfo> prototype = |
2805 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); | 2805 Accessors::FunctionPrototypeInfo(isolate(), rw_attribs); |
2806 Descriptor d = Descriptor::AccessorConstant( | 2806 Descriptor d = Descriptor::AccessorConstant( |
2807 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); | 2807 Handle<Name>(Name::cast(prototype->name())), prototype, rw_attribs); |
2808 map->AppendDescriptor(&d); | 2808 map->AppendDescriptor(&d); |
2809 } | 2809 } |
2810 } | 2810 } |
2811 | 2811 |
2812 } // namespace internal | 2812 } // namespace internal |
2813 } // namespace v8 | 2813 } // namespace v8 |
OLD | NEW |