Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 kContextVariable = v8::HeapGraphEdge::kContextVariable, | 431 kContextVariable = v8::HeapGraphEdge::kContextVariable, |
| 432 kElement = v8::HeapGraphEdge::kElement, | 432 kElement = v8::HeapGraphEdge::kElement, |
| 433 kProperty = v8::HeapGraphEdge::kProperty, | 433 kProperty = v8::HeapGraphEdge::kProperty, |
| 434 kInternal = v8::HeapGraphEdge::kInternal | 434 kInternal = v8::HeapGraphEdge::kInternal |
| 435 }; | 435 }; |
| 436 | 436 |
| 437 HeapGraphEdge() { } | 437 HeapGraphEdge() { } |
| 438 void Init(int child_index, Type type, const char* name, HeapEntry* to); | 438 void Init(int child_index, Type type, const char* name, HeapEntry* to); |
| 439 void Init(int child_index, int index, HeapEntry* to); | 439 void Init(int child_index, int index, HeapEntry* to); |
| 440 | 440 |
| 441 Type type() { return type_; } | 441 Type type() { return static_cast<Type>(type_); } |
| 442 int index() { | 442 int index() { |
| 443 ASSERT(type_ == kElement); | 443 ASSERT(type_ == kElement); |
| 444 return index_; | 444 return index_; |
| 445 } | 445 } |
| 446 const char* name() { | 446 const char* name() { |
| 447 ASSERT(type_ == kContextVariable | 447 ASSERT(type_ == kContextVariable |
| 448 || type_ == kProperty | 448 || type_ == kProperty |
| 449 || type_ == kInternal); | 449 || type_ == kInternal); |
| 450 return name_; | 450 return name_; |
| 451 } | 451 } |
| 452 HeapEntry* to() { return to_; } | 452 HeapEntry* to() { return to_; } |
| 453 | 453 |
| 454 HeapEntry* From(); | 454 HeapEntry* From(); |
| 455 | 455 |
| 456 private: | 456 private: |
| 457 int child_index_ : 30; | 457 int child_index_ : 30; |
| 458 Type type_ : 2; | 458 unsigned type_ : 2; |
| 459 union { | 459 union { |
| 460 int index_; | 460 int index_; |
| 461 const char* name_; | 461 const char* name_; |
| 462 }; | 462 }; |
| 463 HeapEntry* to_; | 463 HeapEntry* to_; |
| 464 | 464 |
| 465 DISALLOW_COPY_AND_ASSIGN(HeapGraphEdge); | 465 DISALLOW_COPY_AND_ASSIGN(HeapGraphEdge); |
| 466 }; | 466 }; |
| 467 | 467 |
| 468 | 468 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 504 void Init(HeapSnapshot* snapshot, int children_count, int retainers_count); | 504 void Init(HeapSnapshot* snapshot, int children_count, int retainers_count); |
| 505 void Init(HeapSnapshot* snapshot, | 505 void Init(HeapSnapshot* snapshot, |
| 506 Type type, | 506 Type type, |
| 507 const char* name, | 507 const char* name, |
| 508 uint64_t id, | 508 uint64_t id, |
| 509 int self_size, | 509 int self_size, |
| 510 int children_count, | 510 int children_count, |
| 511 int retainers_count); | 511 int retainers_count); |
| 512 | 512 |
| 513 HeapSnapshot* snapshot() { return snapshot_; } | 513 HeapSnapshot* snapshot() { return snapshot_; } |
| 514 Type type() { return type_; } | 514 Type type() { return static_cast<Type>(type_); } |
| 515 const char* name() { return name_; } | 515 const char* name() { return name_; } |
| 516 uint64_t id() { return id_; } | 516 uint64_t id() { return id_; } |
| 517 int self_size() { return self_size_; } | 517 int self_size() { return self_size_; } |
| 518 | 518 |
| 519 Vector<HeapGraphEdge> children() { | 519 Vector<HeapGraphEdge> children() { |
| 520 return Vector<HeapGraphEdge>(children_arr(), children_count_); } | 520 return Vector<HeapGraphEdge>(children_arr(), children_count_); } |
| 521 Vector<HeapGraphEdge*> retainers() { | 521 Vector<HeapGraphEdge*> retainers() { |
| 522 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } | 522 return Vector<HeapGraphEdge*>(retainers_arr(), retainers_count_); } |
| 523 List<HeapGraphPath*>* GetRetainingPaths(); | 523 List<HeapGraphPath*>* GetRetainingPaths(); |
| 524 | 524 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 | 559 |
| 560 private: | 560 private: |
| 561 HeapGraphEdge* children_arr() { | 561 HeapGraphEdge* children_arr() { |
| 562 return reinterpret_cast<HeapGraphEdge*>(this + 1); | 562 return reinterpret_cast<HeapGraphEdge*>(this + 1); |
| 563 } | 563 } |
| 564 HeapGraphEdge** retainers_arr() { | 564 HeapGraphEdge** retainers_arr() { |
| 565 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); | 565 return reinterpret_cast<HeapGraphEdge**>(children_arr() + children_count_); |
| 566 } | 566 } |
| 567 const char* TypeAsString(); | 567 const char* TypeAsString(); |
| 568 | 568 |
| 569 HeapSnapshot* snapshot_; | |
| 570 unsigned painted_: 2; | 569 unsigned painted_: 2; |
| 571 Type type_: 3; | 570 unsigned type_: 3; |
| 572 // The calculated data is stored in HeapSnapshot in HeapEntryCalculatedData | 571 // The calculated data is stored in HeapSnapshot in HeapEntryCalculatedData |
| 573 // entries. See AddCalculatedData and GetCalculatedData. | 572 // entries. See AddCalculatedData and GetCalculatedData. |
| 574 int calculated_data_index_: 27; | 573 int calculated_data_index_: 27; |
| 575 const char* name_; | |
| 576 uint64_t id_; | |
| 577 int self_size_; | 574 int self_size_; |
| 578 int children_count_; | 575 int children_count_; |
| 579 int retainers_count_; | 576 int retainers_count_; |
| 577 HeapSnapshot* snapshot_; | |
| 578 const char* name_; | |
| 579 uint64_t id_; | |
|
Søren Thygesen Gjesse
2010/08/09 14:44:10
Could we have a STATIC_ASSERT on sizeof(HeapEntry)
mnaganov (inactive)
2010/08/09 15:18:37
OK, will do this as a separate commit.
| |
| 580 | 580 |
| 581 static const unsigned kUnpainted = 0; | 581 static const unsigned kUnpainted = 0; |
| 582 static const unsigned kPainted = 1; | 582 static const unsigned kPainted = 1; |
| 583 static const unsigned kPaintedReachableFromOthers = 2; | 583 static const unsigned kPaintedReachableFromOthers = 2; |
| 584 static const int kNoCalculatedData = -1; | 584 static const int kNoCalculatedData = -1; |
| 585 | 585 |
| 586 DISALLOW_COPY_AND_ASSIGN(HeapEntry); | 586 DISALLOW_COPY_AND_ASSIGN(HeapEntry); |
| 587 }; | 587 }; |
| 588 | 588 |
| 589 | 589 |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 946 friend class IndexedReferencesExtractor; | 946 friend class IndexedReferencesExtractor; |
| 947 | 947 |
| 948 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator); | 948 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator); |
| 949 }; | 949 }; |
| 950 | 950 |
| 951 } } // namespace v8::internal | 951 } } // namespace v8::internal |
| 952 | 952 |
| 953 #endif // ENABLE_LOGGING_AND_PROFILING | 953 #endif // ENABLE_LOGGING_AND_PROFILING |
| 954 | 954 |
| 955 #endif // V8_PROFILE_GENERATOR_H_ | 955 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |