Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(662)

Side by Side Diff: src/profiler/heap-snapshot-generator.cc

Issue 1705713002: [runtime] Replace hidden_string with a 0-hash-code private symbol (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« src/heap/heap.cc ('K') | « src/objects-debug.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1580 matching lines...) Expand 10 before | Expand all | Expand 10 after
1591 case kField: { 1591 case kField: {
1592 Representation r = details.representation(); 1592 Representation r = details.representation();
1593 if (r.IsSmi() || r.IsDouble()) break; 1593 if (r.IsSmi() || r.IsDouble()) break;
1594 1594
1595 Name* k = descs->GetKey(i); 1595 Name* k = descs->GetKey(i);
1596 FieldIndex field_index = FieldIndex::ForDescriptor(js_obj->map(), i); 1596 FieldIndex field_index = FieldIndex::ForDescriptor(js_obj->map(), i);
1597 Object* value = js_obj->RawFastPropertyAt(field_index); 1597 Object* value = js_obj->RawFastPropertyAt(field_index);
1598 int field_offset = 1598 int field_offset =
1599 field_index.is_inobject() ? field_index.offset() : -1; 1599 field_index.is_inobject() ? field_index.offset() : -1;
1600 1600
1601 if (k != heap_->hidden_string()) { 1601 if (k != heap_->hidden_properties_symbol()) {
1602 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, k, 1602 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, k,
1603 value, NULL, field_offset); 1603 value, NULL, field_offset);
1604 } else { 1604 } else {
1605 TagObject(value, "(hidden properties)"); 1605 TagObject(value, "(hidden properties)");
1606 SetInternalReference(js_obj, entry, "hidden_properties", value, 1606 SetInternalReference(js_obj, entry, "hidden_properties", value,
1607 field_offset); 1607 field_offset);
1608 } 1608 }
1609 break; 1609 break;
1610 } 1610 }
1611 case kDescriptor: 1611 case kDescriptor:
1612 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, 1612 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry,
1613 descs->GetKey(i), 1613 descs->GetKey(i),
1614 descs->GetValue(i)); 1614 descs->GetValue(i));
1615 break; 1615 break;
1616 } 1616 }
1617 } 1617 }
1618 } else if (js_obj->IsJSGlobalObject()) { 1618 } else if (js_obj->IsJSGlobalObject()) {
1619 // We assume that global objects can only have slow properties. 1619 // We assume that global objects can only have slow properties.
1620 GlobalDictionary* dictionary = js_obj->global_dictionary(); 1620 GlobalDictionary* dictionary = js_obj->global_dictionary();
1621 int length = dictionary->Capacity(); 1621 int length = dictionary->Capacity();
1622 for (int i = 0; i < length; ++i) { 1622 for (int i = 0; i < length; ++i) {
1623 Object* k = dictionary->KeyAt(i); 1623 Object* k = dictionary->KeyAt(i);
1624 if (dictionary->IsKey(k)) { 1624 if (dictionary->IsKey(k)) {
1625 DCHECK(dictionary->ValueAt(i)->IsPropertyCell()); 1625 DCHECK(dictionary->ValueAt(i)->IsPropertyCell());
1626 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(i)); 1626 PropertyCell* cell = PropertyCell::cast(dictionary->ValueAt(i));
1627 Object* value = cell->value(); 1627 Object* value = cell->value();
1628 if (k == heap_->hidden_string()) { 1628 if (k == heap_->hidden_properties_symbol()) {
1629 TagObject(value, "(hidden properties)"); 1629 TagObject(value, "(hidden properties)");
1630 SetInternalReference(js_obj, entry, "hidden_properties", value); 1630 SetInternalReference(js_obj, entry, "hidden_properties", value);
1631 continue; 1631 continue;
1632 } 1632 }
1633 PropertyDetails details = cell->property_details(); 1633 PropertyDetails details = cell->property_details();
1634 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, 1634 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry,
1635 Name::cast(k), value); 1635 Name::cast(k), value);
1636 } 1636 }
1637 } 1637 }
1638 } else { 1638 } else {
1639 NameDictionary* dictionary = js_obj->property_dictionary(); 1639 NameDictionary* dictionary = js_obj->property_dictionary();
1640 int length = dictionary->Capacity(); 1640 int length = dictionary->Capacity();
1641 for (int i = 0; i < length; ++i) { 1641 for (int i = 0; i < length; ++i) {
1642 Object* k = dictionary->KeyAt(i); 1642 Object* k = dictionary->KeyAt(i);
1643 if (dictionary->IsKey(k)) { 1643 if (dictionary->IsKey(k)) {
1644 Object* value = dictionary->ValueAt(i); 1644 Object* value = dictionary->ValueAt(i);
1645 if (k == heap_->hidden_string()) { 1645 if (k == heap_->hidden_properties_symbol()) {
1646 TagObject(value, "(hidden properties)"); 1646 TagObject(value, "(hidden properties)");
1647 SetInternalReference(js_obj, entry, "hidden_properties", value); 1647 SetInternalReference(js_obj, entry, "hidden_properties", value);
1648 continue; 1648 continue;
1649 } 1649 }
1650 PropertyDetails details = dictionary->DetailsAt(i); 1650 PropertyDetails details = dictionary->DetailsAt(i);
1651 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry, 1651 SetDataOrAccessorPropertyReference(details.kind(), js_obj, entry,
1652 Name::cast(k), value); 1652 Name::cast(k), value);
1653 } 1653 }
1654 } 1654 }
1655 } 1655 }
(...skipping 1498 matching lines...) Expand 10 before | Expand all | Expand 10 after
3154 for (int i = 1; i < sorted_strings.length(); ++i) { 3154 for (int i = 1; i < sorted_strings.length(); ++i) {
3155 writer_->AddCharacter(','); 3155 writer_->AddCharacter(',');
3156 SerializeString(sorted_strings[i]); 3156 SerializeString(sorted_strings[i]);
3157 if (writer_->aborted()) return; 3157 if (writer_->aborted()) return;
3158 } 3158 }
3159 } 3159 }
3160 3160
3161 3161
3162 } // namespace internal 3162 } // namespace internal
3163 } // namespace v8 3163 } // namespace v8
OLDNEW
« src/heap/heap.cc ('K') | « src/objects-debug.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698