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_OBJECTS_VISITING_H_ | 5 #ifndef V8_OBJECTS_VISITING_H_ |
6 #define V8_OBJECTS_VISITING_H_ | 6 #define V8_OBJECTS_VISITING_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
10 #include "src/heap/spaces.h" | 10 #include "src/heap/spaces.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 125 |
126 // For visitors that allow specialization by size calculate VisitorId based | 126 // For visitors that allow specialization by size calculate VisitorId based |
127 // on size, base visitor id and generic visitor id. | 127 // on size, base visitor id and generic visitor id. |
128 static VisitorId GetVisitorIdForSize(VisitorId base, VisitorId generic, | 128 static VisitorId GetVisitorIdForSize(VisitorId base, VisitorId generic, |
129 int object_size, | 129 int object_size, |
130 bool has_unboxed_fields) { | 130 bool has_unboxed_fields) { |
131 DCHECK((base == kVisitDataObject) || (base == kVisitStruct) || | 131 DCHECK((base == kVisitDataObject) || (base == kVisitStruct) || |
132 (base == kVisitJSObject) || (base == kVisitJSApiObject)); | 132 (base == kVisitJSObject) || (base == kVisitJSApiObject)); |
133 DCHECK(IsAligned(object_size, kPointerSize)); | 133 DCHECK(IsAligned(object_size, kPointerSize)); |
134 DCHECK(Heap::kMinObjectSizeInWords * kPointerSize <= object_size); | 134 DCHECK(Heap::kMinObjectSizeInWords * kPointerSize <= object_size); |
135 DCHECK(object_size <= Page::kMaxRegularHeapObjectSize); | 135 DCHECK(object_size <= kMaxRegularHeapObjectSize); |
136 DCHECK(!has_unboxed_fields || (base == kVisitJSObject) || | 136 DCHECK(!has_unboxed_fields || (base == kVisitJSObject) || |
137 (base == kVisitJSApiObject)); | 137 (base == kVisitJSApiObject)); |
138 | 138 |
139 if (has_unboxed_fields) return generic; | 139 if (has_unboxed_fields) return generic; |
140 | 140 |
141 int visitor_id = Min( | 141 int visitor_id = Min( |
142 base + (object_size >> kPointerSizeLog2) - Heap::kMinObjectSizeInWords, | 142 base + (object_size >> kPointerSizeLog2) - Heap::kMinObjectSizeInWords, |
143 static_cast<int>(generic)); | 143 static_cast<int>(generic)); |
144 | 144 |
145 return static_cast<VisitorId>(visitor_id); | 145 return static_cast<VisitorId>(visitor_id); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 // the next element. Given the head of the list, this function removes dead | 452 // the next element. Given the head of the list, this function removes dead |
453 // elements from the list and if requested records slots for next-element | 453 // elements from the list and if requested records slots for next-element |
454 // pointers. The template parameter T is a WeakListVisitor that defines how to | 454 // pointers. The template parameter T is a WeakListVisitor that defines how to |
455 // access the next-element pointers. | 455 // access the next-element pointers. |
456 template <class T> | 456 template <class T> |
457 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 457 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
458 } // namespace internal | 458 } // namespace internal |
459 } // namespace v8 | 459 } // namespace v8 |
460 | 460 |
461 #endif // V8_OBJECTS_VISITING_H_ | 461 #endif // V8_OBJECTS_VISITING_H_ |
OLD | NEW |