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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/disasm.h" | 9 #include "src/disasm.h" |
10 #include "src/disassembler.h" | 10 #include "src/disassembler.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 os << "DictionaryProperties"; | 412 os << "DictionaryProperties"; |
413 } | 413 } |
414 PrototypeIterator iter(obj->GetIsolate(), obj); | 414 PrototypeIterator iter(obj->GetIsolate(), obj); |
415 os << "]\n - prototype = " << reinterpret_cast<void*>(iter.GetCurrent()); | 415 os << "]\n - prototype = " << reinterpret_cast<void*>(iter.GetCurrent()); |
416 os << "\n - elements = " << Brief(obj->elements()) << " [" | 416 os << "\n - elements = " << Brief(obj->elements()) << " [" |
417 << ElementsKindToString(obj->map()->elements_kind()); | 417 << ElementsKindToString(obj->map()->elements_kind()); |
418 if (obj->elements()->map() == obj->GetHeap()->fixed_cow_array_map()) { | 418 if (obj->elements()->map() == obj->GetHeap()->fixed_cow_array_map()) { |
419 os << " (COW)"; | 419 os << " (COW)"; |
420 } | 420 } |
421 os << "]"; | 421 os << "]"; |
| 422 if (obj->GetInternalFieldCount() > 0) { |
| 423 os << "\n - internal fields: " << obj->GetInternalFieldCount(); |
| 424 } |
422 } | 425 } |
423 | 426 |
424 | 427 |
425 static void JSObjectPrintBody(std::ostream& os, JSObject* obj, // NOLINT | 428 static void JSObjectPrintBody(std::ostream& os, JSObject* obj, // NOLINT |
426 bool print_elements = true) { | 429 bool print_elements = true) { |
427 os << "\n - properties = {"; | 430 os << "\n - properties = {"; |
428 obj->PrintProperties(os); | 431 obj->PrintProperties(os); |
429 os << "\n }\n"; | 432 os << "\n }\n"; |
430 if (print_elements && obj->elements()->length() > 0) { | 433 if (print_elements && obj->elements()->length() > 0) { |
431 os << " - elements = {"; | 434 os << " - elements = {"; |
432 obj->PrintElements(os); | 435 obj->PrintElements(os); |
433 os << "\n }\n"; | 436 os << "\n }\n"; |
434 } | 437 } |
| 438 int internal_fields = obj->GetInternalFieldCount(); |
| 439 if (internal_fields > 0) { |
| 440 os << " - internal fields = {"; |
| 441 for (int i = 0; i < internal_fields; i++) { |
| 442 os << "\n " << Brief(obj->GetInternalField(i)); |
| 443 } |
| 444 os << "\n }\n"; |
| 445 } |
435 } | 446 } |
436 | 447 |
437 | 448 |
438 void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT | 449 void JSObject::JSObjectPrint(std::ostream& os) { // NOLINT |
439 JSObjectPrintHeader(os, this, nullptr); | 450 JSObjectPrintHeader(os, this, nullptr); |
440 JSObjectPrintBody(os, this); | 451 JSObjectPrintBody(os, this); |
441 } | 452 } |
442 | 453 |
443 void JSArray::JSArrayPrint(std::ostream& os) { // NOLINT | 454 void JSArray::JSArrayPrint(std::ostream& os) { // NOLINT |
444 JSObjectPrintHeader(os, this, "JSArray"); | 455 JSObjectPrintHeader(os, this, "JSArray"); |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1422 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT | 1433 void JSObject::PrintTransitions(std::ostream& os) { // NOLINT |
1423 Object* transitions = map()->raw_transitions(); | 1434 Object* transitions = map()->raw_transitions(); |
1424 int num_transitions = TransitionArray::NumberOfTransitions(transitions); | 1435 int num_transitions = TransitionArray::NumberOfTransitions(transitions); |
1425 if (num_transitions == 0) return; | 1436 if (num_transitions == 0) return; |
1426 os << "\n - transitions"; | 1437 os << "\n - transitions"; |
1427 TransitionArray::PrintTransitions(os, transitions, false); | 1438 TransitionArray::PrintTransitions(os, transitions, false); |
1428 } | 1439 } |
1429 #endif // defined(DEBUG) || defined(OBJECT_PRINT) | 1440 #endif // defined(DEBUG) || defined(OBJECT_PRINT) |
1430 } // namespace internal | 1441 } // namespace internal |
1431 } // namespace v8 | 1442 } // namespace v8 |
OLD | NEW |