| 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 <sstream> | 5 #include <sstream> |
| 6 | 6 |
| 7 #include "src/v8.h" | 7 #include "src/v8.h" |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/layout-descriptor.h" | 10 #include "src/layout-descriptor.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 } | 39 } |
| 40 | 40 |
| 41 | 41 |
| 42 Handle<LayoutDescriptor> LayoutDescriptor::ShareAppend( | 42 Handle<LayoutDescriptor> LayoutDescriptor::ShareAppend( |
| 43 Handle<Map> map, PropertyDetails details) { | 43 Handle<Map> map, PropertyDetails details) { |
| 44 DCHECK(map->owns_descriptors()); | 44 DCHECK(map->owns_descriptors()); |
| 45 Isolate* isolate = map->GetIsolate(); | 45 Isolate* isolate = map->GetIsolate(); |
| 46 Handle<LayoutDescriptor> layout_descriptor(map->GetLayoutDescriptor(), | 46 Handle<LayoutDescriptor> layout_descriptor(map->GetLayoutDescriptor(), |
| 47 isolate); | 47 isolate); |
| 48 | 48 |
| 49 if (!InobjectUnboxedField(map->inobject_properties(), details)) { | 49 if (!InobjectUnboxedField(map->GetInObjectProperties(), details)) { |
| 50 DCHECK(details.location() != kField || | 50 DCHECK(details.location() != kField || |
| 51 layout_descriptor->IsTagged(details.field_index())); | 51 layout_descriptor->IsTagged(details.field_index())); |
| 52 return layout_descriptor; | 52 return layout_descriptor; |
| 53 } | 53 } |
| 54 int field_index = details.field_index(); | 54 int field_index = details.field_index(); |
| 55 layout_descriptor = LayoutDescriptor::EnsureCapacity( | 55 layout_descriptor = LayoutDescriptor::EnsureCapacity( |
| 56 isolate, layout_descriptor, field_index + details.field_width_in_words()); | 56 isolate, layout_descriptor, field_index + details.field_width_in_words()); |
| 57 | 57 |
| 58 DisallowHeapAllocation no_allocation; | 58 DisallowHeapAllocation no_allocation; |
| 59 LayoutDescriptor* layout_desc = *layout_descriptor; | 59 LayoutDescriptor* layout_desc = *layout_descriptor; |
| 60 layout_desc = layout_desc->SetRawData(field_index); | 60 layout_desc = layout_desc->SetRawData(field_index); |
| 61 if (details.field_width_in_words() > 1) { | 61 if (details.field_width_in_words() > 1) { |
| 62 layout_desc = layout_desc->SetRawData(field_index + 1); | 62 layout_desc = layout_desc->SetRawData(field_index + 1); |
| 63 } | 63 } |
| 64 return handle(layout_desc, isolate); | 64 return handle(layout_desc, isolate); |
| 65 } | 65 } |
| 66 | 66 |
| 67 | 67 |
| 68 Handle<LayoutDescriptor> LayoutDescriptor::AppendIfFastOrUseFull( | 68 Handle<LayoutDescriptor> LayoutDescriptor::AppendIfFastOrUseFull( |
| 69 Handle<Map> map, PropertyDetails details, | 69 Handle<Map> map, PropertyDetails details, |
| 70 Handle<LayoutDescriptor> full_layout_descriptor) { | 70 Handle<LayoutDescriptor> full_layout_descriptor) { |
| 71 DisallowHeapAllocation no_allocation; | 71 DisallowHeapAllocation no_allocation; |
| 72 LayoutDescriptor* layout_descriptor = map->layout_descriptor(); | 72 LayoutDescriptor* layout_descriptor = map->layout_descriptor(); |
| 73 if (layout_descriptor->IsSlowLayout()) { | 73 if (layout_descriptor->IsSlowLayout()) { |
| 74 return full_layout_descriptor; | 74 return full_layout_descriptor; |
| 75 } | 75 } |
| 76 if (!InobjectUnboxedField(map->inobject_properties(), details)) { | 76 if (!InobjectUnboxedField(map->GetInObjectProperties(), details)) { |
| 77 DCHECK(details.location() != kField || | 77 DCHECK(details.location() != kField || |
| 78 layout_descriptor->IsTagged(details.field_index())); | 78 layout_descriptor->IsTagged(details.field_index())); |
| 79 return handle(layout_descriptor, map->GetIsolate()); | 79 return handle(layout_descriptor, map->GetIsolate()); |
| 80 } | 80 } |
| 81 int field_index = details.field_index(); | 81 int field_index = details.field_index(); |
| 82 int new_capacity = field_index + details.field_width_in_words(); | 82 int new_capacity = field_index + details.field_width_in_words(); |
| 83 if (new_capacity > layout_descriptor->capacity()) { | 83 if (new_capacity > layout_descriptor->capacity()) { |
| 84 // Current map's layout descriptor runs out of space, so use the full | 84 // Current map's layout descriptor runs out of space, so use the full |
| 85 // layout descriptor. | 85 // layout descriptor. |
| 86 return full_layout_descriptor; | 86 return full_layout_descriptor; |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 int n = capacity(); | 279 int n = capacity(); |
| 280 for (int i = last_field_index; i < n; i++) { | 280 for (int i = last_field_index; i < n; i++) { |
| 281 DCHECK(IsTagged(i)); | 281 DCHECK(IsTagged(i)); |
| 282 } | 282 } |
| 283 } | 283 } |
| 284 } | 284 } |
| 285 return true; | 285 return true; |
| 286 } | 286 } |
| 287 } // namespace internal | 287 } // namespace internal |
| 288 } // namespace v8 | 288 } // namespace v8 |
| OLD | NEW |