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 #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 2411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2422 }; | 2422 }; |
2423 | 2423 |
2424 | 2424 |
2425 // Visitor class to verify interior pointers in spaces that do not contain | 2425 // Visitor class to verify interior pointers in spaces that do not contain |
2426 // or care about intergenerational references. All heap object pointers have to | 2426 // or care about intergenerational references. All heap object pointers have to |
2427 // point into the heap to a location that has a map pointer at its first word. | 2427 // point into the heap to a location that has a map pointer at its first word. |
2428 // Caveat: Heap::Contains is an approximation because it can return true for | 2428 // Caveat: Heap::Contains is an approximation because it can return true for |
2429 // objects in a heap space but above the allocation pointer. | 2429 // objects in a heap space but above the allocation pointer. |
2430 class VerifyPointersVisitor : public ObjectVisitor { | 2430 class VerifyPointersVisitor : public ObjectVisitor { |
2431 public: | 2431 public: |
2432 inline void VisitPointers(Object** start, Object** end); | 2432 inline void VisitPointers(Object** start, Object** end) override; |
2433 }; | 2433 }; |
2434 | 2434 |
2435 | 2435 |
2436 // Verify that all objects are Smis. | 2436 // Verify that all objects are Smis. |
2437 class VerifySmisVisitor : public ObjectVisitor { | 2437 class VerifySmisVisitor : public ObjectVisitor { |
2438 public: | 2438 public: |
2439 inline void VisitPointers(Object** start, Object** end); | 2439 inline void VisitPointers(Object** start, Object** end) override; |
2440 }; | 2440 }; |
2441 | 2441 |
2442 | 2442 |
2443 // Space iterator for iterating over all spaces of the heap. Returns each space | 2443 // Space iterator for iterating over all spaces of the heap. Returns each space |
2444 // in turn, and null when it is done. | 2444 // in turn, and null when it is done. |
2445 class AllSpaces BASE_EMBEDDED { | 2445 class AllSpaces BASE_EMBEDDED { |
2446 public: | 2446 public: |
2447 explicit AllSpaces(Heap* heap) : heap_(heap), counter_(FIRST_SPACE) {} | 2447 explicit AllSpaces(Heap* heap) : heap_(heap), counter_(FIRST_SPACE) {} |
2448 Space* next(); | 2448 Space* next(); |
2449 | 2449 |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2690 PathTracer(Object* search_target, WhatToFind what_to_find, | 2690 PathTracer(Object* search_target, WhatToFind what_to_find, |
2691 VisitMode visit_mode) | 2691 VisitMode visit_mode) |
2692 : search_target_(search_target), | 2692 : search_target_(search_target), |
2693 found_target_(false), | 2693 found_target_(false), |
2694 found_target_in_trace_(false), | 2694 found_target_in_trace_(false), |
2695 what_to_find_(what_to_find), | 2695 what_to_find_(what_to_find), |
2696 visit_mode_(visit_mode), | 2696 visit_mode_(visit_mode), |
2697 object_stack_(20), | 2697 object_stack_(20), |
2698 no_allocation() {} | 2698 no_allocation() {} |
2699 | 2699 |
2700 virtual void VisitPointers(Object** start, Object** end); | 2700 void VisitPointers(Object** start, Object** end) override; |
2701 | 2701 |
2702 void Reset(); | 2702 void Reset(); |
2703 void TracePathFrom(Object** root); | 2703 void TracePathFrom(Object** root); |
2704 | 2704 |
2705 bool found() const { return found_target_; } | 2705 bool found() const { return found_target_; } |
2706 | 2706 |
2707 static Object* const kAnyGlobalObject; | 2707 static Object* const kAnyGlobalObject; |
2708 | 2708 |
2709 protected: | 2709 protected: |
2710 class MarkVisitor; | 2710 class MarkVisitor; |
(...skipping 13 matching lines...) Expand all Loading... |
2724 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. | 2724 DisallowHeapAllocation no_allocation; // i.e. no gc allowed. |
2725 | 2725 |
2726 private: | 2726 private: |
2727 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); | 2727 DISALLOW_IMPLICIT_CONSTRUCTORS(PathTracer); |
2728 }; | 2728 }; |
2729 #endif // DEBUG | 2729 #endif // DEBUG |
2730 } // namespace internal | 2730 } // namespace internal |
2731 } // namespace v8 | 2731 } // namespace v8 |
2732 | 2732 |
2733 #endif // V8_HEAP_HEAP_H_ | 2733 #endif // V8_HEAP_HEAP_H_ |
OLD | NEW |