OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/allocation-site-scopes.h" | 10 #include "src/allocation-site-scopes.h" |
(...skipping 6615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6626 descriptors = DescriptorArray::Allocate(map->GetIsolate(), 0, 1); | 6626 descriptors = DescriptorArray::Allocate(map->GetIsolate(), 0, 1); |
6627 } else { | 6627 } else { |
6628 EnsureDescriptorSlack( | 6628 EnsureDescriptorSlack( |
6629 map, SlackForArraySize(old_size, kMaxNumberOfDescriptors)); | 6629 map, SlackForArraySize(old_size, kMaxNumberOfDescriptors)); |
6630 descriptors = handle(map->instance_descriptors()); | 6630 descriptors = handle(map->instance_descriptors()); |
6631 } | 6631 } |
6632 } | 6632 } |
6633 | 6633 |
6634 Handle<LayoutDescriptor> layout_descriptor = | 6634 Handle<LayoutDescriptor> layout_descriptor = |
6635 FLAG_unbox_double_fields | 6635 FLAG_unbox_double_fields |
6636 ? LayoutDescriptor::Append(map, descriptor->GetDetails()) | 6636 ? LayoutDescriptor::ShareAppend(map, descriptor->GetDetails()) |
6637 : handle(LayoutDescriptor::FastPointerLayout(), map->GetIsolate()); | 6637 : handle(LayoutDescriptor::FastPointerLayout(), map->GetIsolate()); |
6638 | 6638 |
6639 { | 6639 { |
6640 DisallowHeapAllocation no_gc; | 6640 DisallowHeapAllocation no_gc; |
6641 descriptors->Append(descriptor); | 6641 descriptors->Append(descriptor); |
6642 result->InitializeDescriptors(*descriptors, *layout_descriptor); | 6642 result->InitializeDescriptors(*descriptors, *layout_descriptor); |
6643 } | 6643 } |
6644 | 6644 |
6645 DCHECK(result->NumberOfOwnDescriptors() == map->NumberOfOwnDescriptors() + 1); | 6645 DCHECK(result->NumberOfOwnDescriptors() == map->NumberOfOwnDescriptors() + 1); |
6646 ConnectTransition(map, result, name, SIMPLE_PROPERTY_TRANSITION); | 6646 ConnectTransition(map, result, name, SIMPLE_PROPERTY_TRANSITION); |
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7143 | 7143 |
7144 // Ensure the key is unique. | 7144 // Ensure the key is unique. |
7145 descriptor->KeyToUniqueName(); | 7145 descriptor->KeyToUniqueName(); |
7146 | 7146 |
7147 if (flag == INSERT_TRANSITION && | 7147 if (flag == INSERT_TRANSITION && |
7148 map->owns_descriptors() && | 7148 map->owns_descriptors() && |
7149 map->CanHaveMoreTransitions()) { | 7149 map->CanHaveMoreTransitions()) { |
7150 return ShareDescriptor(map, descriptors, descriptor); | 7150 return ShareDescriptor(map, descriptors, descriptor); |
7151 } | 7151 } |
7152 | 7152 |
7153 Handle<DescriptorArray> new_descriptors = DescriptorArray::CopyUpTo( | 7153 int nof = map->NumberOfOwnDescriptors(); |
7154 descriptors, map->NumberOfOwnDescriptors(), 1); | 7154 Handle<DescriptorArray> new_descriptors = |
| 7155 DescriptorArray::CopyUpTo(descriptors, nof, 1); |
7155 new_descriptors->Append(descriptor); | 7156 new_descriptors->Append(descriptor); |
7156 | 7157 |
7157 Handle<LayoutDescriptor> new_layout_descriptor = | 7158 Handle<LayoutDescriptor> new_layout_descriptor = |
7158 FLAG_unbox_double_fields | 7159 FLAG_unbox_double_fields |
7159 ? LayoutDescriptor::Append(map, descriptor->GetDetails()) | 7160 ? LayoutDescriptor::New(map, new_descriptors, nof + 1) |
7160 : handle(LayoutDescriptor::FastPointerLayout(), map->GetIsolate()); | 7161 : handle(LayoutDescriptor::FastPointerLayout(), map->GetIsolate()); |
7161 | 7162 |
7162 return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor, | 7163 return CopyReplaceDescriptors(map, new_descriptors, new_layout_descriptor, |
7163 flag, descriptor->GetKey(), "CopyAddDescriptor", | 7164 flag, descriptor->GetKey(), "CopyAddDescriptor", |
7164 SIMPLE_PROPERTY_TRANSITION); | 7165 SIMPLE_PROPERTY_TRANSITION); |
7165 } | 7166 } |
7166 | 7167 |
7167 | 7168 |
7168 Handle<Map> Map::CopyInsertDescriptor(Handle<Map> map, | 7169 Handle<Map> Map::CopyInsertDescriptor(Handle<Map> map, |
7169 Descriptor* descriptor, | 7170 Descriptor* descriptor, |
(...skipping 9708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
16878 Handle<DependentCode> codes = | 16879 Handle<DependentCode> codes = |
16879 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), | 16880 DependentCode::Insert(handle(cell->dependent_code(), info->isolate()), |
16880 DependentCode::kPropertyCellChangedGroup, | 16881 DependentCode::kPropertyCellChangedGroup, |
16881 info->object_wrapper()); | 16882 info->object_wrapper()); |
16882 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); | 16883 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); |
16883 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( | 16884 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( |
16884 cell, info->zone()); | 16885 cell, info->zone()); |
16885 } | 16886 } |
16886 | 16887 |
16887 } } // namespace v8::internal | 16888 } } // namespace v8::internal |
OLD | NEW |