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

Side by Side Diff: src/heap/objects-visiting.h

Issue 751643005: Reland of "Enable inobject double fields unboxing for 64-bit archs." (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes Created 6 years 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
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_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/layout-descriptor.h" 9 #include "src/layout-descriptor.h"
10 10
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // Visitor ID should fit in one byte. 104 // Visitor ID should fit in one byte.
105 STATIC_ASSERT(kVisitorIdCount <= 256); 105 STATIC_ASSERT(kVisitorIdCount <= 256);
106 106
107 // Determine which specialized visitor should be used for given instance type 107 // Determine which specialized visitor should be used for given instance type
108 // and instance type. 108 // and instance type.
109 static VisitorId GetVisitorId(int instance_type, int instance_size, 109 static VisitorId GetVisitorId(int instance_type, int instance_size,
110 bool has_unboxed_fields); 110 bool has_unboxed_fields);
111 111
112 // Determine which specialized visitor should be used for given map. 112 // Determine which specialized visitor should be used for given map.
113 static VisitorId GetVisitorId(Map* map) { 113 static VisitorId GetVisitorId(Map* map) {
114 return GetVisitorId(map->instance_type(), map->instance_size(), 114 return GetVisitorId(
115 FLAG_unbox_double_fields && 115 map->instance_type(), map->instance_size(),
116 !map->layout_descriptor()->IsFastPointerLayout()); 116 FLAG_unbox_double_fields && !map->HasFastPointerLayout());
117 } 117 }
118 118
119 // For visitors that allow specialization by size calculate VisitorId based 119 // For visitors that allow specialization by size calculate VisitorId based
120 // on size, base visitor id and generic visitor id. 120 // on size, base visitor id and generic visitor id.
121 static VisitorId GetVisitorIdForSize(VisitorId base, VisitorId generic, 121 static VisitorId GetVisitorIdForSize(VisitorId base, VisitorId generic,
122 int object_size, 122 int object_size,
123 bool has_unboxed_fields) { 123 bool has_unboxed_fields) {
124 DCHECK((base == kVisitDataObject) || (base == kVisitStruct) || 124 DCHECK((base == kVisitDataObject) || (base == kVisitStruct) ||
125 (base == kVisitJSObject)); 125 (base == kVisitJSObject));
126 DCHECK(IsAligned(object_size, kPointerSize)); 126 DCHECK(IsAligned(object_size, kPointerSize));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 private: 191 private:
192 base::AtomicWord callbacks_[StaticVisitorBase::kVisitorIdCount]; 192 base::AtomicWord callbacks_[StaticVisitorBase::kVisitorIdCount];
193 }; 193 };
194 194
195 195
196 template <typename StaticVisitor> 196 template <typename StaticVisitor>
197 class BodyVisitorBase : public AllStatic { 197 class BodyVisitorBase : public AllStatic {
198 public: 198 public:
199 INLINE(static void IteratePointers(Heap* heap, HeapObject* object, 199 INLINE(static void IteratePointers(Heap* heap, HeapObject* object,
200 int start_offset, int end_offset)) { 200 int start_offset, int end_offset)) {
201 DCHECK(!FLAG_unbox_double_fields || 201 DCHECK(!FLAG_unbox_double_fields || object->map()->HasFastPointerLayout());
202 object->map()->layout_descriptor()->IsFastPointerLayout());
203 IterateRawPointers(heap, object, start_offset, end_offset); 202 IterateRawPointers(heap, object, start_offset, end_offset);
204 } 203 }
205 204
206 INLINE(static void IterateBody(Heap* heap, HeapObject* object, 205 INLINE(static void IterateBody(Heap* heap, HeapObject* object,
207 int start_offset, int end_offset)) { 206 int start_offset, int end_offset)) {
208 if (!FLAG_unbox_double_fields || 207 if (!FLAG_unbox_double_fields || object->map()->HasFastPointerLayout()) {
209 object->map()->layout_descriptor()->IsFastPointerLayout()) {
210 IterateRawPointers(heap, object, start_offset, end_offset); 208 IterateRawPointers(heap, object, start_offset, end_offset);
211 } else { 209 } else {
212 IterateBodyUsingLayoutDescriptor(heap, object, start_offset, end_offset); 210 IterateBodyUsingLayoutDescriptor(heap, object, start_offset, end_offset);
213 } 211 }
214 } 212 }
215 213
216 private: 214 private:
217 INLINE(static void IterateRawPointers(Heap* heap, HeapObject* object, 215 INLINE(static void IterateRawPointers(Heap* heap, HeapObject* object,
218 int start_offset, int end_offset)) { 216 int start_offset, int end_offset)) {
219 StaticVisitor::VisitPointers(heap, 217 StaticVisitor::VisitPointers(heap,
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 // the next element. Given the head of the list, this function removes dead 488 // the next element. Given the head of the list, this function removes dead
491 // elements from the list and if requested records slots for next-element 489 // elements from the list and if requested records slots for next-element
492 // pointers. The template parameter T is a WeakListVisitor that defines how to 490 // pointers. The template parameter T is a WeakListVisitor that defines how to
493 // access the next-element pointers. 491 // access the next-element pointers.
494 template <class T> 492 template <class T>
495 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); 493 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer);
496 } 494 }
497 } // namespace v8::internal 495 } // namespace v8::internal
498 496
499 #endif // V8_OBJECTS_VISITING_H_ 497 #endif // V8_OBJECTS_VISITING_H_
OLDNEW
« no previous file with comments | « src/heap/mark-compact.cc ('k') | src/heap/store-buffer.cc » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698