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

Side by Side Diff: src/heap/heap.h

Issue 2719013002: [heap] Remove remaining parts of PathTracer. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | src/objects-inl.h » ('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 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 #ifndef V8_HEAP_HEAP_H_ 5 #ifndef V8_HEAP_HEAP_H_
6 #define V8_HEAP_HEAP_H_ 6 #define V8_HEAP_HEAP_H_
7 7
8 #include <cmath> 8 #include <cmath>
9 #include <map> 9 #include <map>
10 10
(...skipping 2545 matching lines...) Expand 10 before | Expand all | Expand 10 after
2556 class WeakObjectRetainer { 2556 class WeakObjectRetainer {
2557 public: 2557 public:
2558 virtual ~WeakObjectRetainer() {} 2558 virtual ~WeakObjectRetainer() {}
2559 2559
2560 // Return whether this object should be retained. If NULL is returned the 2560 // Return whether this object should be retained. If NULL is returned the
2561 // object has no references. Otherwise the address of the retained object 2561 // object has no references. Otherwise the address of the retained object
2562 // should be returned as in some GC situations the object has been moved. 2562 // should be returned as in some GC situations the object has been moved.
2563 virtual Object* RetainAs(Object* object) = 0; 2563 virtual Object* RetainAs(Object* object) = 0;
2564 }; 2564 };
2565 2565
2566
2567 #ifdef DEBUG
2568 // Helper class for tracing paths to a search target Object from all roots.
2569 // The TracePathFrom() method can be used to trace paths from a specific
2570 // object to the search target object.
2571 class PathTracer : public ObjectVisitor {
2572 public:
2573 enum WhatToFind {
2574 FIND_ALL, // Will find all matches.
2575 FIND_FIRST // Will stop the search after first match.
2576 };
2577
2578 // Tags 0, 1, and 3 are used. Use 2 for marking visited HeapObject.
2579 static const int kMarkTag = 2;
2580
2581 // For the WhatToFind arg, if FIND_FIRST is specified, tracing will stop
2582 // after the first match. If FIND_ALL is specified, then tracing will be
2583 // done for all matches.
2584 PathTracer(Object* search_target, WhatToFind what_to_find,
2585 VisitMode visit_mode)
2586 : search_target_(search_target),
2587 found_target_(false),
2588 found_target_in_trace_(false),
2589 what_to_find_(what_to_find),
2590 visit_mode_(visit_mode),
2591 object_stack_(20),
2592 no_allocation() {}
2593
2594 void VisitPointers(Object** start, Object** end) override;
2595
2596 void Reset();
2597 void TracePathFrom(Object** root);
2598
2599 bool found() const { return found_target_; }
2600
2601 static Object* const kAnyGlobalObject;
2602
2603 protected:
2604 class MarkVisitor;
2605 class UnmarkVisitor;
2606
2607 void MarkRecursively(Object** p, MarkVisitor* mark_visitor);
2608 void UnmarkRecursively(Object** p, UnmarkVisitor* unmark_visitor);
2609 virtual void ProcessResults();
2610
2611 Object* search_target_;
2612 bool found_target_;
2613 bool found_target_in_trace_;
2614 WhatToFind what_to_find_;
2615 VisitMode visit_mode_;
2616 List<Object*> object_stack_;
2617
2618 DisallowHeapAllocation no_allocation; // i.e. no gc allowed.
2619
2620 private:
2621 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer);
2622 };
2623 #endif // DEBUG
2624
2625 // ----------------------------------------------------------------------------- 2566 // -----------------------------------------------------------------------------
2626 // Allows observation of allocations. 2567 // Allows observation of allocations.
2627 class AllocationObserver { 2568 class AllocationObserver {
2628 public: 2569 public:
2629 explicit AllocationObserver(intptr_t step_size) 2570 explicit AllocationObserver(intptr_t step_size)
2630 : step_size_(step_size), bytes_to_next_step_(step_size) { 2571 : step_size_(step_size), bytes_to_next_step_(step_size) {
2631 DCHECK(step_size >= kPointerSize); 2572 DCHECK(step_size >= kPointerSize);
2632 } 2573 }
2633 virtual ~AllocationObserver() {} 2574 virtual ~AllocationObserver() {}
2634 2575
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
2673 friend class LargeObjectSpace; 2614 friend class LargeObjectSpace;
2674 friend class NewSpace; 2615 friend class NewSpace;
2675 friend class PagedSpace; 2616 friend class PagedSpace;
2676 DISALLOW_COPY_AND_ASSIGN(AllocationObserver); 2617 DISALLOW_COPY_AND_ASSIGN(AllocationObserver);
2677 }; 2618 };
2678 2619
2679 } // namespace internal 2620 } // namespace internal
2680 } // namespace v8 2621 } // namespace v8
2681 2622
2682 #endif // V8_HEAP_HEAP_H_ 2623 #endif // V8_HEAP_HEAP_H_
OLDNEW
« no previous file with comments | « no previous file | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698