| 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/heap-snapshot-generator-inl.h" | 7 #include "src/heap-snapshot-generator-inl.h" |
| 8 | 8 |
| 9 #include "src/allocation-tracker.h" | 9 #include "src/allocation-tracker.h" |
| 10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
| (...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1615 } | 1615 } |
| 1616 | 1616 |
| 1617 | 1617 |
| 1618 void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) { | 1618 void V8HeapExplorer::ExtractPropertyReferences(JSObject* js_obj, int entry) { |
| 1619 if (js_obj->HasFastProperties()) { | 1619 if (js_obj->HasFastProperties()) { |
| 1620 DescriptorArray* descs = js_obj->map()->instance_descriptors(); | 1620 DescriptorArray* descs = js_obj->map()->instance_descriptors(); |
| 1621 int real_size = js_obj->map()->NumberOfOwnDescriptors(); | 1621 int real_size = js_obj->map()->NumberOfOwnDescriptors(); |
| 1622 for (int i = 0; i < real_size; i++) { | 1622 for (int i = 0; i < real_size; i++) { |
| 1623 PropertyDetails details = descs->GetDetails(i); | 1623 PropertyDetails details = descs->GetDetails(i); |
| 1624 switch (details.location()) { | 1624 switch (details.location()) { |
| 1625 case IN_OBJECT: { | 1625 case kField: { |
| 1626 Representation r = details.representation(); | 1626 Representation r = details.representation(); |
| 1627 if (r.IsSmi() || r.IsDouble()) break; | 1627 if (r.IsSmi() || r.IsDouble()) break; |
| 1628 | 1628 |
| 1629 Name* k = descs->GetKey(i); | 1629 Name* k = descs->GetKey(i); |
| 1630 FieldIndex field_index = FieldIndex::ForDescriptor(js_obj->map(), i); | 1630 FieldIndex field_index = FieldIndex::ForDescriptor(js_obj->map(), i); |
| 1631 Object* value = js_obj->RawFastPropertyAt(field_index); | 1631 Object* value = js_obj->RawFastPropertyAt(field_index); |
| 1632 int field_offset = | 1632 int field_offset = |
| 1633 field_index.is_inobject() ? field_index.offset() : -1; | 1633 field_index.is_inobject() ? field_index.offset() : -1; |
| 1634 | 1634 |
| 1635 if (k != heap_->hidden_string()) { | 1635 if (k != heap_->hidden_string()) { |
| 1636 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, k, | 1636 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, k, |
| 1637 value, NULL, field_offset); | 1637 value, NULL, field_offset); |
| 1638 } else { | 1638 } else { |
| 1639 TagObject(value, "(hidden properties)"); | 1639 TagObject(value, "(hidden properties)"); |
| 1640 SetInternalReference(js_obj, entry, "hidden_properties", value, | 1640 SetInternalReference(js_obj, entry, "hidden_properties", value, |
| 1641 field_offset); | 1641 field_offset); |
| 1642 } | 1642 } |
| 1643 break; | 1643 break; |
| 1644 } | 1644 } |
| 1645 case IN_DESCRIPTOR: | 1645 case kDescriptor: |
| 1646 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, | 1646 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, |
| 1647 descs->GetKey(i), | 1647 descs->GetKey(i), |
| 1648 descs->GetValue(i)); | 1648 descs->GetValue(i)); |
| 1649 break; | 1649 break; |
| 1650 } | 1650 } |
| 1651 } | 1651 } |
| 1652 } else { | 1652 } else { |
| 1653 NameDictionary* dictionary = js_obj->property_dictionary(); | 1653 NameDictionary* dictionary = js_obj->property_dictionary(); |
| 1654 int length = dictionary->Capacity(); | 1654 int length = dictionary->Capacity(); |
| 1655 for (int i = 0; i < length; ++i) { | 1655 for (int i = 0; i < length; ++i) { |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2024 child_entry); | 2024 child_entry); |
| 2025 } | 2025 } |
| 2026 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset); | 2026 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset); |
| 2027 } | 2027 } |
| 2028 | 2028 |
| 2029 | 2029 |
| 2030 void V8HeapExplorer::SetDataOrAccessorPropertyReference( | 2030 void V8HeapExplorer::SetDataOrAccessorPropertyReference( |
| 2031 PropertyKind kind, JSObject* parent_obj, int parent_entry, | 2031 PropertyKind kind, JSObject* parent_obj, int parent_entry, |
| 2032 Name* reference_name, Object* child_obj, const char* name_format_string, | 2032 Name* reference_name, Object* child_obj, const char* name_format_string, |
| 2033 int field_offset) { | 2033 int field_offset) { |
| 2034 if (kind == ACCESSOR) { | 2034 if (kind == kAccessor) { |
| 2035 ExtractAccessorPairProperty(parent_obj, parent_entry, reference_name, | 2035 ExtractAccessorPairProperty(parent_obj, parent_entry, reference_name, |
| 2036 child_obj, field_offset); | 2036 child_obj, field_offset); |
| 2037 } else { | 2037 } else { |
| 2038 SetPropertyReference(parent_obj, parent_entry, reference_name, child_obj, | 2038 SetPropertyReference(parent_obj, parent_entry, reference_name, child_obj, |
| 2039 name_format_string, field_offset); | 2039 name_format_string, field_offset); |
| 2040 } | 2040 } |
| 2041 } | 2041 } |
| 2042 | 2042 |
| 2043 | 2043 |
| 2044 void V8HeapExplorer::SetPropertyReference(HeapObject* parent_obj, | 2044 void V8HeapExplorer::SetPropertyReference(HeapObject* parent_obj, |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3127 writer_->AddString("\"<dummy>\""); | 3127 writer_->AddString("\"<dummy>\""); |
| 3128 for (int i = 1; i < sorted_strings.length(); ++i) { | 3128 for (int i = 1; i < sorted_strings.length(); ++i) { |
| 3129 writer_->AddCharacter(','); | 3129 writer_->AddCharacter(','); |
| 3130 SerializeString(sorted_strings[i]); | 3130 SerializeString(sorted_strings[i]); |
| 3131 if (writer_->aborted()) return; | 3131 if (writer_->aborted()) return; |
| 3132 } | 3132 } |
| 3133 } | 3133 } |
| 3134 | 3134 |
| 3135 | 3135 |
| 3136 } } // namespace v8::internal | 3136 } } // namespace v8::internal |
| OLD | NEW |