OLD | NEW |
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 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 | 422 |
423 void JSModule::JSModulePrint(std::ostream& os) { // NOLINT | 423 void JSModule::JSModulePrint(std::ostream& os) { // NOLINT |
424 JSObjectPrintHeader(os, this, "JSModule"); | 424 JSObjectPrintHeader(os, this, "JSModule"); |
425 os << "\n - context = " << Brief(context()); | 425 os << "\n - context = " << Brief(context()); |
426 os << " - scope_info = " << Brief(scope_info()); | 426 os << " - scope_info = " << Brief(scope_info()); |
427 JSObjectPrintBody(os, this); | 427 JSObjectPrintBody(os, this); |
428 } | 428 } |
429 | 429 |
430 | 430 |
431 static const char* TypeToString(InstanceType type) { | |
432 switch (type) { | |
433 #define TYPE_TO_STRING(TYPE) case TYPE: return #TYPE; | |
434 INSTANCE_TYPE_LIST(TYPE_TO_STRING) | |
435 #undef TYPE_TO_STRING | |
436 } | |
437 UNREACHABLE(); | |
438 return "UNKNOWN"; // Keep the compiler happy. | |
439 } | |
440 | |
441 | |
442 void Symbol::SymbolPrint(std::ostream& os) { // NOLINT | 431 void Symbol::SymbolPrint(std::ostream& os) { // NOLINT |
443 HeapObject::PrintHeader(os, "Symbol"); | 432 HeapObject::PrintHeader(os, "Symbol"); |
444 os << " - hash: " << Hash(); | 433 os << " - hash: " << Hash(); |
445 os << "\n - name: " << Brief(name()); | 434 os << "\n - name: " << Brief(name()); |
446 if (name()->IsUndefined()) { | 435 if (name()->IsUndefined()) { |
447 os << " (" << PrivateSymbolToName() << ")"; | 436 os << " (" << PrivateSymbolToName() << ")"; |
448 } | 437 } |
449 os << "\n - private: " << is_private(); | 438 os << "\n - private: " << is_private(); |
450 os << "\n"; | 439 os << "\n"; |
451 } | 440 } |
452 | 441 |
453 | 442 |
454 void Map::MapPrint(std::ostream& os) { // NOLINT | 443 void Map::MapPrint(std::ostream& os) { // NOLINT |
455 HeapObject::PrintHeader(os, "Map"); | 444 HeapObject::PrintHeader(os, "Map"); |
456 os << " - type: " << TypeToString(instance_type()) << "\n"; | 445 os << " - type: " << instance_type() << "\n"; |
457 os << " - instance size: " << instance_size() << "\n"; | 446 os << " - instance size: " << instance_size() << "\n"; |
458 if (IsJSObjectMap()) { | 447 if (IsJSObjectMap()) { |
459 os << " - inobject properties: " << GetInObjectProperties() << "\n"; | 448 os << " - inobject properties: " << GetInObjectProperties() << "\n"; |
460 } | 449 } |
461 os << " - elements kind: " << ElementsKindToString(elements_kind()) << "\n"; | 450 os << " - elements kind: " << ElementsKindToString(elements_kind()) << "\n"; |
462 os << " - unused property fields: " << unused_property_fields() << "\n"; | 451 os << " - unused property fields: " << unused_property_fields() << "\n"; |
463 if (is_deprecated()) os << " - deprecated_map\n"; | 452 if (is_deprecated()) os << " - deprecated_map\n"; |
464 if (is_stable()) os << " - stable_map\n"; | 453 if (is_stable()) os << " - stable_map\n"; |
465 if (is_dictionary_map()) os << " - dictionary_map\n"; | 454 if (is_dictionary_map()) os << " - dictionary_map\n"; |
466 if (is_hidden_prototype()) os << " - hidden_prototype\n"; | 455 if (is_hidden_prototype()) os << " - hidden_prototype\n"; |
(...skipping 21 matching lines...) Expand all Loading... |
488 int nof_transitions = TransitionArray::NumberOfTransitions(raw_transitions()); | 477 int nof_transitions = TransitionArray::NumberOfTransitions(raw_transitions()); |
489 if (nof_transitions > 0) { | 478 if (nof_transitions > 0) { |
490 os << "\n - transitions #" << nof_transitions << ": " | 479 os << "\n - transitions #" << nof_transitions << ": " |
491 << Brief(raw_transitions()); | 480 << Brief(raw_transitions()); |
492 TransitionArray::PrintTransitions(os, raw_transitions(), false); | 481 TransitionArray::PrintTransitions(os, raw_transitions(), false); |
493 } | 482 } |
494 os << "\n - prototype: " << Brief(prototype()); | 483 os << "\n - prototype: " << Brief(prototype()); |
495 os << "\n - constructor: " << Brief(GetConstructor()); | 484 os << "\n - constructor: " << Brief(GetConstructor()); |
496 os << "\n - code cache: " << Brief(code_cache()); | 485 os << "\n - code cache: " << Brief(code_cache()); |
497 os << "\n - dependent code: " << Brief(dependent_code()); | 486 os << "\n - dependent code: " << Brief(dependent_code()); |
| 487 os << "\n - counter: " << counter(); |
498 os << "\n"; | 488 os << "\n"; |
499 } | 489 } |
500 | 490 |
501 | 491 |
502 void CodeCache::CodeCachePrint(std::ostream& os) { // NOLINT | 492 void CodeCache::CodeCachePrint(std::ostream& os) { // NOLINT |
503 HeapObject::PrintHeader(os, "CodeCache"); | 493 HeapObject::PrintHeader(os, "CodeCache"); |
504 os << "\n - default_cache: " << Brief(default_cache()); | 494 os << "\n - default_cache: " << Brief(default_cache()); |
505 os << "\n - normal_type_cache: " << Brief(normal_type_cache()); | 495 os << "\n - normal_type_cache: " << Brief(normal_type_cache()); |
506 } | 496 } |
507 | 497 |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT | 1318 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT |
1329 Object* transitions = map()->raw_transitions(); | 1319 Object* transitions = map()->raw_transitions(); |
1330 int num_transitions = TransitionArray::NumberOfTransitions(transitions); | 1320 int num_transitions = TransitionArray::NumberOfTransitions(transitions); |
1331 if (num_transitions == 0) return; | 1321 if (num_transitions == 0) return; |
1332 os << "\n - transitions"; | 1322 os << "\n - transitions"; |
1333 TransitionArray::PrintTransitions(os, transitions, false); | 1323 TransitionArray::PrintTransitions(os, transitions, false); |
1334 } | 1324 } |
1335 #endif // defined(DEBUG) || defined(OBJECT_PRINT) | 1325 #endif // defined(DEBUG) || defined(OBJECT_PRINT) |
1336 } // namespace internal | 1326 } // namespace internal |
1337 } // namespace v8 | 1327 } // namespace v8 |
OLD | NEW |