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

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

Issue 2624903003: [runtime] Use PropertyKind/PropertyLocation instead of PropertyType. (Closed)
Patch Set: Addressing comments 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
« no previous file with comments | « src/objects-inl.h ('k') | src/property.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 os << " (" << (details.kind() == kData ? "data" : "accessor");
355 switch (details.location()) {
356 case kField: {
357 os << " field at offset " << field_index.property_index();
352 break; 358 break;
353 } 359 }
354 case DATA_CONSTANT: 360 case kDescriptor:
355 os << Brief(descs->GetConstant(i)) << " (data constant)";
356 break;
357 case ACCESSOR_CONSTANT:
358 os << Brief(descs->GetCallbacksObject(i)) << " (accessor constant)";
359 break; 361 break;
360 } 362 }
363 os << ")";
361 } 364 }
362 } else if (IsJSGlobalObject()) { 365 } else if (IsJSGlobalObject()) {
363 global_dictionary()->Print(os); 366 global_dictionary()->Print(os);
364 } else { 367 } else {
365 property_dictionary()->Print(os); 368 property_dictionary()->Print(os);
366 } 369 }
367 } 370 }
368 371
369 namespace { 372 namespace {
370 373
(...skipping 1047 matching lines...) Expand 10 before | Expand all | Expand 10 after
1418 << Brief(Smi::FromInt(memento_create_count())); 1421 << Brief(Smi::FromInt(memento_create_count()));
1419 os << "\n - pretenure decision: " 1422 os << "\n - pretenure decision: "
1420 << Brief(Smi::FromInt(pretenure_decision())); 1423 << Brief(Smi::FromInt(pretenure_decision()));
1421 os << "\n - transition_info: "; 1424 os << "\n - transition_info: ";
1422 if (transition_info()->IsSmi()) { 1425 if (transition_info()->IsSmi()) {
1423 ElementsKind kind = GetElementsKind(); 1426 ElementsKind kind = GetElementsKind();
1424 os << "Array allocation with ElementsKind " << ElementsKindToString(kind); 1427 os << "Array allocation with ElementsKind " << ElementsKindToString(kind);
1425 } else if (transition_info()->IsJSArray()) { 1428 } else if (transition_info()->IsJSArray()) {
1426 os << "Array literal " << Brief(transition_info()); 1429 os << "Array literal " << Brief(transition_info());
1427 } else { 1430 } else {
1428 os << "unknown transition_info" << Brief(transition_info()); 1431 os << "unknown transition_info " << Brief(transition_info());
1429 } 1432 }
1430 os << "\n"; 1433 os << "\n";
1431 } 1434 }
1432 1435
1433 1436
1434 void AllocationMemento::AllocationMementoPrint(std::ostream& os) { // NOLINT 1437 void AllocationMemento::AllocationMementoPrint(std::ostream& os) { // NOLINT
1435 HeapObject::PrintHeader(os, "AllocationMemento"); 1438 HeapObject::PrintHeader(os, "AllocationMemento");
1436 os << "\n - allocation site: "; 1439 os << "\n - allocation site: ";
1437 if (IsValid()) { 1440 if (IsValid()) {
1438 GetAllocationSite()->Print(os); 1441 GetAllocationSite()->Print(os);
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
1636 PropertyDetails details = GetTargetDetails(key, target); 1639 PropertyDetails details = GetTargetDetails(key, target);
1637 os << "(transition to "; 1640 os << "(transition to ";
1638 if (details.location() == kDescriptor) { 1641 if (details.location() == kDescriptor) {
1639 os << "immutable "; 1642 os << "immutable ";
1640 } 1643 }
1641 os << (details.kind() == kData ? "data" : "accessor"); 1644 os << (details.kind() == kData ? "data" : "accessor");
1642 if (details.location() == kDescriptor) { 1645 if (details.location() == kDescriptor) {
1643 Object* value = 1646 Object* value =
1644 target->instance_descriptors()->GetValue(target->LastAdded()); 1647 target->instance_descriptors()->GetValue(target->LastAdded());
1645 os << " " << Brief(value); 1648 os << " " << Brief(value);
1649 } else {
1650 os << " field";
1646 } 1651 }
1647 os << "), attrs: " << details.attributes(); 1652 os << ", attrs: " << details.attributes() << ")";
1648 } 1653 }
1649 os << " -> " << Brief(target); 1654 os << " -> " << Brief(target);
1650 } 1655 }
1651 } 1656 }
1652 1657
1653 1658
1654 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT 1659 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
1655 Object* transitions = map()->raw_transitions(); 1660 Object* transitions = map()->raw_transitions();
1656 int num_transitions = TransitionArray::NumberOfTransitions(transitions); 1661 int num_transitions = TransitionArray::NumberOfTransitions(transitions);
1657 if (num_transitions == 0) return; 1662 if (num_transitions == 0) return;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1704 printf("Not a transition array\n"); 1709 printf("Not a transition array\n");
1705 } else { 1710 } else {
1706 reinterpret_cast<i::TransitionArray*>(object)->Print(); 1711 reinterpret_cast<i::TransitionArray*>(object)->Print();
1707 } 1712 }
1708 } 1713 }
1709 1714
1710 extern void _v8_internal_Print_StackTrace() { 1715 extern void _v8_internal_Print_StackTrace() {
1711 i::Isolate* isolate = i::Isolate::Current(); 1716 i::Isolate* isolate = i::Isolate::Current();
1712 isolate->PrintStack(stdout); 1717 isolate->PrintStack(stdout);
1713 } 1718 }
OLDNEW
« no previous file with comments | « src/objects-inl.h ('k') | src/property.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698