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

Side by Side Diff: src/objects-printer.cc

Issue 2624903003: [runtime] Use PropertyKind/PropertyLocation instead of PropertyType. (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <iomanip> 7 #include <iomanip>
8 #include <memory> 8 #include <memory>
9 9
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 } 328 }
329 329
330 330
331 void JSObject::PrintProperties(std::ostream& os) { // NOLINT 331 void JSObject::PrintProperties(std::ostream& os) { // NOLINT
332 if (HasFastProperties()) { 332 if (HasFastProperties()) {
333 DescriptorArray* descs = map()->instance_descriptors(); 333 DescriptorArray* descs = map()->instance_descriptors();
334 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) { 334 for (int i = 0; i < map()->NumberOfOwnDescriptors(); i++) {
335 os << "\n "; 335 os << "\n ";
336 descs->GetKey(i)->NamePrint(os); 336 descs->GetKey(i)->NamePrint(os);
337 os << ": "; 337 os << ": ";
338 switch (descs->GetType(i)) { 338 PropertyDetails details = descs->GetDetails(i);
339 case DATA: { 339 FieldIndex field_index;
340 FieldIndex index = FieldIndex::ForDescriptor(map(), i); 340 switch (details.location()) {
341 if (IsUnboxedDoubleField(index)) { 341 case kField: {
342 os << "<unboxed double> " << RawFastDoublePropertyAt(index); 342 field_index = FieldIndex::ForDescriptor(map(), i);
343 if (IsUnboxedDoubleField(field_index)) {
344 os << "<unboxed double> " << RawFastDoublePropertyAt(field_index);
343 } else { 345 } else {
344 os << Brief(RawFastPropertyAt(index)); 346 os << Brief(RawFastPropertyAt(field_index));
345 } 347 }
346 os << " (data field at offset " << index.property_index() << ")";
347 break; 348 break;
348 } 349 }
349 case ACCESSOR: { 350 case kDescriptor:
350 FieldIndex index = FieldIndex::ForDescriptor(map(), i); 351 os << Brief(descs->GetValue(i));
351 os << " (accessor field at offset " << index.property_index() << ")"; 352 break;
353 }
354 switch (details.kind()) {
355 case kData:
356 os << " data";
357 break;
358 case kAccessor:
359 os << " accessor";
360 break;
361 }
362 switch (details.location()) {
363 case kField: {
364 os << " field at offset " << field_index.property_index() << ")";
352 break; 365 break;
353 } 366 }
354 case DATA_CONSTANT: 367 case kDescriptor:
355 os << Brief(descs->GetConstant(i)) << " (data constant)"; 368 os << ")";
356 break;
357 case ACCESSOR_CONSTANT:
358 os << Brief(descs->GetCallbacksObject(i)) << " (accessor constant)";
359 break; 369 break;
360 } 370 }
361 } 371 }
362 } else if (IsJSGlobalObject()) { 372 } else if (IsJSGlobalObject()) {
363 global_dictionary()->Print(os); 373 global_dictionary()->Print(os);
364 } else { 374 } else {
365 property_dictionary()->Print(os); 375 property_dictionary()->Print(os);
366 } 376 }
367 } 377 }
368 378
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 << Brief(Smi::FromInt(memento_create_count())); 1428 << Brief(Smi::FromInt(memento_create_count()));
1419 os << "\n - pretenure decision: " 1429 os << "\n - pretenure decision: "
1420 << Brief(Smi::FromInt(pretenure_decision())); 1430 << Brief(Smi::FromInt(pretenure_decision()));
1421 os << "\n - transition_info: "; 1431 os << "\n - transition_info: ";
1422 if (transition_info()->IsSmi()) { 1432 if (transition_info()->IsSmi()) {
1423 ElementsKind kind = GetElementsKind(); 1433 ElementsKind kind = GetElementsKind();
1424 os << "Array allocation with ElementsKind " << ElementsKindToString(kind); 1434 os << "Array allocation with ElementsKind " << ElementsKindToString(kind);
1425 } else if (transition_info()->IsJSArray()) { 1435 } else if (transition_info()->IsJSArray()) {
1426 os << "Array literal " << Brief(transition_info()); 1436 os << "Array literal " << Brief(transition_info());
1427 } else { 1437 } else {
1428 os << "unknown transition_info" << Brief(transition_info()); 1438 os << "unknown transition_info " << Brief(transition_info());
1429 } 1439 }
1430 os << "\n"; 1440 os << "\n";
1431 } 1441 }
1432 1442
1433 1443
1434 void AllocationMemento::AllocationMementoPrint(std::ostream& os) { // NOLINT 1444 void AllocationMemento::AllocationMementoPrint(std::ostream& os) { // NOLINT
1435 HeapObject::PrintHeader(os, "AllocationMemento"); 1445 HeapObject::PrintHeader(os, "AllocationMemento");
1436 os << "\n - allocation site: "; 1446 os << "\n - allocation site: ";
1437 if (IsValid()) { 1447 if (IsValid()) {
1438 GetAllocationSite()->Print(os); 1448 GetAllocationSite()->Print(os);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 PropertyDetails details = GetTargetDetails(key, target); 1646 PropertyDetails details = GetTargetDetails(key, target);
1637 os << "(transition to "; 1647 os << "(transition to ";
1638 if (details.location() == kDescriptor) { 1648 if (details.location() == kDescriptor) {
1639 os << "immutable "; 1649 os << "immutable ";
1640 } 1650 }
1641 os << (details.kind() == kData ? "data" : "accessor"); 1651 os << (details.kind() == kData ? "data" : "accessor");
1642 if (details.location() == kDescriptor) { 1652 if (details.location() == kDescriptor) {
1643 Object* value = 1653 Object* value =
1644 target->instance_descriptors()->GetValue(target->LastAdded()); 1654 target->instance_descriptors()->GetValue(target->LastAdded());
1645 os << " " << Brief(value); 1655 os << " " << Brief(value);
1656 } else {
1657 os << "field";
1646 } 1658 }
1647 os << "), attrs: " << details.attributes(); 1659 os << "), attrs: " << details.attributes();
1648 } 1660 }
1649 os << " -> " << Brief(target); 1661 os << " -> " << Brief(target);
1650 } 1662 }
1651 } 1663 }
1652 1664
1653 1665
1654 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT 1666 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
1655 Object* transitions = map()->raw_transitions(); 1667 Object* transitions = map()->raw_transitions();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 printf("Not a transition array\n"); 1716 printf("Not a transition array\n");
1705 } else { 1717 } else {
1706 reinterpret_cast<i::TransitionArray*>(object)->Print(); 1718 reinterpret_cast<i::TransitionArray*>(object)->Print();
1707 } 1719 }
1708 } 1720 }
1709 1721
1710 extern void _v8_internal_Print_StackTrace() { 1722 extern void _v8_internal_Print_StackTrace() {
1711 i::Isolate* isolate = i::Isolate::Current(); 1723 i::Isolate* isolate = i::Isolate::Current();
1712 isolate->PrintStack(stdout); 1724 isolate->PrintStack(stdout);
1713 } 1725 }
OLDNEW
« src/lookup.cc ('K') | « src/objects-inl.h ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698