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 1630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1641 } | 1641 } |
1642 break; | 1642 break; |
1643 } | 1643 } |
1644 case kDescriptor: | 1644 case kDescriptor: |
1645 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, | 1645 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, |
1646 descs->GetKey(i), | 1646 descs->GetKey(i), |
1647 descs->GetValue(i)); | 1647 descs->GetValue(i)); |
1648 break; | 1648 break; |
1649 } | 1649 } |
1650 } | 1650 } |
| 1651 } else if (js_obj->IsGlobalObject()) { |
| 1652 // We assume that global objects can only have slow properties. |
| 1653 GlobalDictionary* dictionary = js_obj->global_dictionary(); |
| 1654 int length = dictionary->Capacity(); |
| 1655 for (int i = 0; i < length; ++i) { |
| 1656 Object* k = dictionary->KeyAt(i); |
| 1657 if (dictionary->IsKey(k)) { |
| 1658 Object* target = dictionary->ValueAt(i); |
| 1659 DCHECK(target->IsPropertyCell()); |
| 1660 Object* value = PropertyCell::cast(target)->value(); |
| 1661 if (k == heap_->hidden_string()) { |
| 1662 TagObject(value, "(hidden properties)"); |
| 1663 SetInternalReference(js_obj, entry, "hidden_properties", value); |
| 1664 continue; |
| 1665 } |
| 1666 PropertyDetails details = dictionary->DetailsAt(i); |
| 1667 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, |
| 1668 Name::cast(k), value); |
| 1669 } |
| 1670 } |
1651 } else { | 1671 } else { |
1652 NameDictionary* dictionary = js_obj->property_dictionary(); | 1672 NameDictionary* dictionary = js_obj->property_dictionary(); |
1653 int length = dictionary->Capacity(); | 1673 int length = dictionary->Capacity(); |
1654 for (int i = 0; i < length; ++i) { | 1674 for (int i = 0; i < length; ++i) { |
1655 Object* k = dictionary->KeyAt(i); | 1675 Object* k = dictionary->KeyAt(i); |
1656 if (dictionary->IsKey(k)) { | 1676 if (dictionary->IsKey(k)) { |
1657 Object* target = dictionary->ValueAt(i); | 1677 Object* value = dictionary->ValueAt(i); |
1658 // We assume that global objects can only have slow properties. | |
1659 Object* value = target->IsPropertyCell() | |
1660 ? PropertyCell::cast(target)->value() | |
1661 : target; | |
1662 if (k == heap_->hidden_string()) { | 1678 if (k == heap_->hidden_string()) { |
1663 TagObject(value, "(hidden properties)"); | 1679 TagObject(value, "(hidden properties)"); |
1664 SetInternalReference(js_obj, entry, "hidden_properties", value); | 1680 SetInternalReference(js_obj, entry, "hidden_properties", value); |
1665 continue; | 1681 continue; |
1666 } | 1682 } |
1667 PropertyDetails details = dictionary->DetailsAt(i); | 1683 PropertyDetails details = dictionary->DetailsAt(i); |
1668 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, | 1684 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, |
1669 Name::cast(k), value); | 1685 Name::cast(k), value); |
1670 } | 1686 } |
1671 } | 1687 } |
(...skipping 1488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3160 writer_->AddString("\"<dummy>\""); | 3176 writer_->AddString("\"<dummy>\""); |
3161 for (int i = 1; i < sorted_strings.length(); ++i) { | 3177 for (int i = 1; i < sorted_strings.length(); ++i) { |
3162 writer_->AddCharacter(','); | 3178 writer_->AddCharacter(','); |
3163 SerializeString(sorted_strings[i]); | 3179 SerializeString(sorted_strings[i]); |
3164 if (writer_->aborted()) return; | 3180 if (writer_->aborted()) return; |
3165 } | 3181 } |
3166 } | 3182 } |
3167 | 3183 |
3168 | 3184 |
3169 } } // namespace v8::internal | 3185 } } // namespace v8::internal |
OLD | NEW |