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

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

Issue 2008893002: [printing] show symbols when using %DebugPrint (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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.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 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 "src/disasm.h" 7 #include "src/disasm.h"
8 #include "src/disassembler.h" 8 #include "src/disassembler.h"
9 #include "src/interpreter/bytecodes.h" 9 #include "src/interpreter/bytecodes.h"
10 #include "src/objects-inl.h" 10 #include "src/objects-inl.h"
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array) 373 PRINT_ELEMENTS(INT16_ELEMENTS, FixedInt16Array)
374 PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array) 374 PRINT_ELEMENTS(UINT32_ELEMENTS, FixedUint32Array)
375 PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array) 375 PRINT_ELEMENTS(INT32_ELEMENTS, FixedInt32Array)
376 PRINT_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array) 376 PRINT_ELEMENTS(FLOAT32_ELEMENTS, FixedFloat32Array)
377 PRINT_ELEMENTS(FLOAT64_ELEMENTS, FixedFloat64Array) 377 PRINT_ELEMENTS(FLOAT64_ELEMENTS, FixedFloat64Array)
378 378
379 #undef PRINT_ELEMENTS 379 #undef PRINT_ELEMENTS
380 380
381 case DICTIONARY_ELEMENTS: 381 case DICTIONARY_ELEMENTS:
382 case SLOW_STRING_WRAPPER_ELEMENTS: 382 case SLOW_STRING_WRAPPER_ELEMENTS:
383 os << "\n - elements: ";
384 elements()->Print(os); 383 elements()->Print(os);
385 break; 384 break;
386 case FAST_SLOPPY_ARGUMENTS_ELEMENTS: 385 case FAST_SLOPPY_ARGUMENTS_ELEMENTS:
387 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: { 386 case SLOW_SLOPPY_ARGUMENTS_ELEMENTS: {
388 FixedArray* p = FixedArray::cast(elements()); 387 FixedArray* p = FixedArray::cast(elements());
389 os << "\n parameter map:"; 388 os << "\n parameter map:";
390 for (int i = 2; i < p->length(); i++) { 389 for (int i = 2; i < p->length(); i++) {
391 os << " " << (i - 2) << ":" << Brief(p->get(i)); 390 os << " " << (i - 2) << ":" << Brief(p->get(i));
392 } 391 }
393 os << "\n context: " << Brief(p->get(0)) 392 os << "\n context: " << Brief(p->get(0))
(...skipping 23 matching lines...) Expand all
417 << ElementsKindToString(obj->map()->elements_kind()); 416 << ElementsKindToString(obj->map()->elements_kind());
418 if (obj->elements()->map() == obj->GetHeap()->fixed_cow_array_map()) { 417 if (obj->elements()->map() == obj->GetHeap()->fixed_cow_array_map()) {
419 os << " (COW)"; 418 os << " (COW)";
420 } 419 }
421 os << "]"; 420 os << "]";
422 } 421 }
423 422
424 423
425 static void JSObjectPrintBody(std::ostream& os, JSObject* obj, // NOLINT 424 static void JSObjectPrintBody(std::ostream& os, JSObject* obj, // NOLINT
426 bool print_elements = true) { 425 bool print_elements = true) {
427 os << "\n {"; 426 os << "\n - properties = {";
428 obj->PrintProperties(os); 427 obj->PrintProperties(os);
429 if (print_elements) obj->PrintElements(os);
430 os << "\n }\n"; 428 os << "\n }\n";
429 if (print_elements && obj->elements()->length() > 0) {
430 os << " - elements = {";
431 obj->PrintElements(os);
432 os << "\n }\n";
433 }
431 } 434 }
432 435
433 436
434 void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT 437 void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT
435 JSObjectPrintHeader(os, this, nullptr); 438 JSObjectPrintHeader(os, this, nullptr);
436 JSObjectPrintBody(os, this); 439 JSObjectPrintBody(os, this);
437 } 440 }
438 441
439 void JSArray::JSArrayPrint(std::ostream& os) { // NOLINT 442 void JSArray::JSArrayPrint(std::ostream& os) { // NOLINT
440 JSObjectPrintHeader(os, this, "JSArray"); 443 JSObjectPrintHeader(os, this, "JSArray");
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 os << truncated_epilogue; 712 os << truncated_epilogue;
710 } 713 }
711 714
712 if (!StringShape(this).IsInternalized()) os << "\""; 715 if (!StringShape(this).IsInternalized()) os << "\"";
713 } 716 }
714 717
715 718
716 void Name::NamePrint(std::ostream& os) { // NOLINT 719 void Name::NamePrint(std::ostream& os) { // NOLINT
717 if (IsString()) { 720 if (IsString()) {
718 String::cast(this)->StringPrint(os); 721 String::cast(this)->StringPrint(os);
719 } else if (IsSymbol()) {
720 Symbol::cast(this)->name()->Print(os);
721 } else { 722 } else {
722 os << Brief(this); 723 os << Brief(this);
723 } 724 }
724 } 725 }
725 726
726 727
727 static const char* const weekdays[] = { 728 static const char* const weekdays[] = {
728 "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" 729 "???", "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
729 }; 730 };
730 731
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT 1338 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT
1338 Object* transitions = map()->raw_transitions(); 1339 Object* transitions = map()->raw_transitions();
1339 int num_transitions = TransitionArray::NumberOfTransitions(transitions); 1340 int num_transitions = TransitionArray::NumberOfTransitions(transitions);
1340 if (num_transitions == 0) return; 1341 if (num_transitions == 0) return;
1341 os << "\n - transitions"; 1342 os << "\n - transitions";
1342 TransitionArray::PrintTransitions(os, transitions, false); 1343 TransitionArray::PrintTransitions(os, transitions, false);
1343 } 1344 }
1344 #endif // defined(DEBUG) || defined(OBJECT_PRINT) 1345 #endif // defined(DEBUG) || defined(OBJECT_PRINT)
1345 } // namespace internal 1346 } // namespace internal
1346 } // namespace v8 1347 } // namespace v8
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698