| 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 "src/profiler/heap-snapshot-generator.h" | 5 #include "src/profiler/heap-snapshot-generator.h" |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/conversions.h" | 8 #include "src/conversions.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/objects-body-descriptors.h" | 10 #include "src/objects-body-descriptors.h" |
| (...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1576 case kField: { | 1576 case kField: { |
| 1577 Representation r = details.representation(); | 1577 Representation r = details.representation(); |
| 1578 if (r.IsSmi() || r.IsDouble()) break; | 1578 if (r.IsSmi() || r.IsDouble()) break; |
| 1579 | 1579 |
| 1580 Name* k = descs->GetKey(i); | 1580 Name* k = descs->GetKey(i); |
| 1581 FieldIndex field_index = FieldIndex::ForDescriptor(js_obj->map(), i); | 1581 FieldIndex field_index = FieldIndex::ForDescriptor(js_obj->map(), i); |
| 1582 Object* value = js_obj->RawFastPropertyAt(field_index); | 1582 Object* value = js_obj->RawFastPropertyAt(field_index); |
| 1583 int field_offset = | 1583 int field_offset = |
| 1584 field_index.is_inobject() ? field_index.offset() : -1; | 1584 field_index.is_inobject() ? field_index.offset() : -1; |
| 1585 | 1585 |
| 1586 if (k != heap_->hidden_properties_symbol()) { | 1586 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, k, |
| 1587 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, k, | 1587 value, NULL, field_offset); |
| 1588 value, NULL, field_offset); | |
| 1589 } else { | |
| 1590 TagObject(value, "(hidden properties)"); | |
| 1591 SetInternalReference(js_obj, entry, "hidden_properties", value, | |
| 1592 field_offset); | |
| 1593 } | |
| 1594 break; | 1588 break; |
| 1595 } | 1589 } |
| 1596 case kDescriptor: | 1590 case kDescriptor: |
| 1597 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, | 1591 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, |
| 1598 descs->GetKey(i), | 1592 descs->GetKey(i), |
| 1599 descs->GetValue(i)); | 1593 descs->GetValue(i)); |
| 1600 break; | 1594 break; |
| 1601 } | 1595 } |
| 1602 } | 1596 } |
| 1603 } else if (js_obj->IsJSGlobalObject()) { | 1597 } else if (js_obj->IsJSGlobalObject()) { |
| 1604 // We assume that global objects can only have slow properties. | 1598 // We assume that global objects can only have slow properties. |
| 1605 GlobalDictionary* dictionary = js_obj->global_dictionary(); | 1599 GlobalDictionary* dictionary = js_obj->global_dictionary(); |
| 1606 int length = dictionary->Capacity(); | 1600 int length = dictionary->Capacity(); |
| 1607 for (int i = 0; i < length; ++i) { | 1601 for (int i = 0; i < length; ++i) { |
| 1608 Object* k = dictionary->KeyAt(i); | 1602 Object* k = dictionary->KeyAt(i); |
| 1609 if (dictionary->IsKey(k)) { | 1603 if (dictionary->IsKey(k)) { |
| 1610 DCHECK(dictionary->ValueAt(i)->IsPropertyCell()); | 1604 DCHECK(dictionary->ValueAt(i)->IsPropertyCell()); |
| 1611 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(i)); | 1605 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(i)); |
| 1612 Object* value = cell->value(); | 1606 Object* value = cell->value(); |
| 1613 if (k == heap_->hidden_properties_symbol()) { | |
| 1614 TagObject(value, "(hidden properties)"); | |
| 1615 SetInternalReference(js_obj, entry, "hidden_properties", value); | |
| 1616 continue; | |
| 1617 } | |
| 1618 PropertyDetails details = cell->property_details(); | 1607 PropertyDetails details = cell->property_details(); |
| 1619 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, | 1608 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, |
| 1620 Name::cast(k), value); | 1609 Name::cast(k), value); |
| 1621 } | 1610 } |
| 1622 } | 1611 } |
| 1623 } else { | 1612 } else { |
| 1624 NameDictionary* dictionary = js_obj->property_dictionary(); | 1613 NameDictionary* dictionary = js_obj->property_dictionary(); |
| 1625 int length = dictionary->Capacity(); | 1614 int length = dictionary->Capacity(); |
| 1626 for (int i = 0; i < length; ++i) { | 1615 for (int i = 0; i < length; ++i) { |
| 1627 Object* k = dictionary->KeyAt(i); | 1616 Object* k = dictionary->KeyAt(i); |
| 1628 if (dictionary->IsKey(k)) { | 1617 if (dictionary->IsKey(k)) { |
| 1629 Object* value = dictionary->ValueAt(i); | 1618 Object* value = dictionary->ValueAt(i); |
| 1630 if (k == heap_->hidden_properties_symbol()) { | |
| 1631 TagObject(value, "(hidden properties)"); | |
| 1632 SetInternalReference(js_obj, entry, "hidden_properties", value); | |
| 1633 continue; | |
| 1634 } | |
| 1635 PropertyDetails details = dictionary->DetailsAt(i); | 1619 PropertyDetails details = dictionary->DetailsAt(i); |
| 1636 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, | 1620 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, |
| 1637 Name::cast(k), value); | 1621 Name::cast(k), value); |
| 1638 } | 1622 } |
| 1639 } | 1623 } |
| 1640 } | 1624 } |
| 1641 } | 1625 } |
| 1642 | 1626 |
| 1643 | 1627 |
| 1644 void V8HeapExplorer::ExtractAccessorPairProperty(JSObject* js_obj, int entry, | 1628 void V8HeapExplorer::ExtractAccessorPairProperty(JSObject* js_obj, int entry, |
| (...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3139 for (int i = 1; i < sorted_strings.length(); ++i) { | 3123 for (int i = 1; i < sorted_strings.length(); ++i) { |
| 3140 writer_->AddCharacter(','); | 3124 writer_->AddCharacter(','); |
| 3141 SerializeString(sorted_strings[i]); | 3125 SerializeString(sorted_strings[i]); |
| 3142 if (writer_->aborted()) return; | 3126 if (writer_->aborted()) return; |
| 3143 } | 3127 } |
| 3144 } | 3128 } |
| 3145 | 3129 |
| 3146 | 3130 |
| 3147 } // namespace internal | 3131 } // namespace internal |
| 3148 } // namespace v8 | 3132 } // namespace v8 |
| OLD | NEW |