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

Side by Side Diff: src/profile-generator.h

Issue 2846012: Heap profiler: add a missing link between a function closure and shared function info. (Closed)
Patch Set: comments addressed Created 10 years, 6 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/checks.h ('k') | src/profile-generator.cc » ('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 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 424
425 class HeapSnapshot; 425 class HeapSnapshot;
426 class HeapEntry; 426 class HeapEntry;
427 427
428 428
429 class HeapGraphEdge { 429 class HeapGraphEdge {
430 public: 430 public:
431 enum Type { 431 enum Type {
432 CONTEXT_VARIABLE = v8::HeapGraphEdge::CONTEXT_VARIABLE, 432 CONTEXT_VARIABLE = v8::HeapGraphEdge::CONTEXT_VARIABLE,
433 ELEMENT = v8::HeapGraphEdge::ELEMENT, 433 ELEMENT = v8::HeapGraphEdge::ELEMENT,
434 PROPERTY = v8::HeapGraphEdge::PROPERTY 434 PROPERTY = v8::HeapGraphEdge::PROPERTY,
435 INTERNAL = v8::HeapGraphEdge::INTERNAL
435 }; 436 };
436 437
437 HeapGraphEdge(Type type, const char* name, HeapEntry* from, HeapEntry* to); 438 HeapGraphEdge(Type type, const char* name, HeapEntry* from, HeapEntry* to);
438 HeapGraphEdge(int index, HeapEntry* from, HeapEntry* to); 439 HeapGraphEdge(int index, HeapEntry* from, HeapEntry* to);
439 440
440 Type type() const { return type_; } 441 Type type() const { return type_; }
441 int index() const { 442 int index() const {
442 ASSERT(type_ == ELEMENT); 443 ASSERT(type_ == ELEMENT);
443 return index_; 444 return index_;
444 } 445 }
445 const char* name() const { 446 const char* name() const {
446 ASSERT(type_ == CONTEXT_VARIABLE || type_ == PROPERTY); 447 ASSERT(type_ == CONTEXT_VARIABLE || type_ == PROPERTY || type_ == INTERNAL);
447 return name_; 448 return name_;
448 } 449 }
449 HeapEntry* from() const { return from_; } 450 HeapEntry* from() const { return from_; }
450 HeapEntry* to() const { return to_; } 451 HeapEntry* to() const { return to_; }
451 452
452 private: 453 private:
453 Type type_; 454 Type type_;
454 union { 455 union {
455 int index_; 456 int index_;
456 const char* name_; 457 const char* name_;
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 void ClearPaint() { painted_ = kUnpainted; } 527 void ClearPaint() { painted_ = kUnpainted; }
527 void CutEdges(); 528 void CutEdges();
528 void MarkAsVisited() { visited_ = true; } 529 void MarkAsVisited() { visited_ = true; }
529 void PaintReachable() { 530 void PaintReachable() {
530 ASSERT(painted_ == kUnpainted); 531 ASSERT(painted_ == kUnpainted);
531 painted_ = kPaintReachable; 532 painted_ = kPaintReachable;
532 } 533 }
533 void PaintReachableFromOthers() { painted_ = kPaintReachableFromOthers; } 534 void PaintReachableFromOthers() { painted_ = kPaintReachableFromOthers; }
534 void SetClosureReference(const char* name, HeapEntry* entry); 535 void SetClosureReference(const char* name, HeapEntry* entry);
535 void SetElementReference(int index, HeapEntry* entry); 536 void SetElementReference(int index, HeapEntry* entry);
537 void SetInternalReference(const char* name, HeapEntry* entry);
536 void SetPropertyReference(const char* name, HeapEntry* entry); 538 void SetPropertyReference(const char* name, HeapEntry* entry);
537 void SetAutoIndexReference(HeapEntry* entry); 539 void SetAutoIndexReference(HeapEntry* entry);
538 540
539 int TotalSize(); 541 int TotalSize();
540 int NonSharedTotalSize(); 542 int NonSharedTotalSize();
541 543
542 void Print(int max_depth, int indent); 544 void Print(int max_depth, int indent);
543 545
544 private: 546 private:
547 void AddEdge(HeapGraphEdge* edge);
545 int CalculateTotalSize(); 548 int CalculateTotalSize();
546 int CalculateNonSharedTotalSize(); 549 int CalculateNonSharedTotalSize();
547 void FindRetainingPaths(HeapEntry* node, CachedHeapGraphPath* prev_path); 550 void FindRetainingPaths(HeapEntry* node, CachedHeapGraphPath* prev_path);
548 void RemoveChild(HeapGraphEdge* edge); 551 void RemoveChild(HeapGraphEdge* edge);
549 void RemoveRetainer(HeapGraphEdge* edge); 552 void RemoveRetainer(HeapGraphEdge* edge);
550 553
551 const char* TypeAsString(); 554 const char* TypeAsString();
552 555
553 HeapSnapshot* snapshot_; 556 HeapSnapshot* snapshot_;
554 bool visited_; 557 bool visited_;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 public: 637 public:
635 HeapSnapshot(HeapSnapshotsCollection* collection, 638 HeapSnapshot(HeapSnapshotsCollection* collection,
636 const char* title, 639 const char* title,
637 unsigned uid); 640 unsigned uid);
638 void ClearPaint(); 641 void ClearPaint();
639 void CutObjectsFromForeignSecurityContexts(); 642 void CutObjectsFromForeignSecurityContexts();
640 HeapEntry* GetEntry(Object* object); 643 HeapEntry* GetEntry(Object* object);
641 void SetClosureReference( 644 void SetClosureReference(
642 HeapEntry* parent, String* reference_name, Object* child); 645 HeapEntry* parent, String* reference_name, Object* child);
643 void SetElementReference(HeapEntry* parent, int index, Object* child); 646 void SetElementReference(HeapEntry* parent, int index, Object* child);
647 void SetInternalReference(
648 HeapEntry* parent, const char* reference_name, Object* child);
644 void SetPropertyReference( 649 void SetPropertyReference(
645 HeapEntry* parent, String* reference_name, Object* child); 650 HeapEntry* parent, String* reference_name, Object* child);
646 651
647 INLINE(const char* title() const) { return title_; } 652 INLINE(const char* title() const) { return title_; }
648 INLINE(unsigned uid() const) { return uid_; } 653 INLINE(unsigned uid() const) { return uid_; }
649 const HeapEntry* const_root() const { return &root_; } 654 const HeapEntry* const_root() const { return &root_; }
650 HeapEntry* root() { return &root_; } 655 HeapEntry* root() { return &root_; }
651 template<class Visitor> 656 template<class Visitor>
652 void IterateEntries(Visitor* visitor) { entries_.Apply(visitor); } 657 void IterateEntries(Visitor* visitor) { entries_.Apply(visitor); }
653 658
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
723 HeapSnapshot* snapshot_; 728 HeapSnapshot* snapshot_;
724 729
725 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator); 730 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotGenerator);
726 }; 731 };
727 732
728 } } // namespace v8::internal 733 } } // namespace v8::internal
729 734
730 #endif // ENABLE_LOGGING_AND_PROFILING 735 #endif // ENABLE_LOGGING_AND_PROFILING
731 736
732 #endif // V8_PROFILE_GENERATOR_H_ 737 #endif // V8_PROFILE_GENERATOR_H_
OLDNEW
« no previous file with comments | « src/checks.h ('k') | src/profile-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698