| 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/layout-descriptor.h" | 9 #include "src/layout-descriptor.h" |
| 10 | 10 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 | 103 |
| 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( | |
| 115 map->instance_type(), map->instance_size(), | |
| 116 FLAG_unbox_double_fields && !map->HasFastPointerLayout()); | |
| 117 } | |
| 118 | 114 |
| 119 // For visitors that allow specialization by size calculate VisitorId based | 115 // For visitors that allow specialization by size calculate VisitorId based |
| 120 // on size, base visitor id and generic visitor id. | 116 // on size, base visitor id and generic visitor id. |
| 121 static VisitorId GetVisitorIdForSize(VisitorId base, VisitorId generic, | 117 static VisitorId GetVisitorIdForSize(VisitorId base, VisitorId generic, |
| 122 int object_size, | 118 int object_size, |
| 123 bool has_unboxed_fields) { | 119 bool has_unboxed_fields) { |
| 124 DCHECK((base == kVisitDataObject) || (base == kVisitStruct) || | 120 DCHECK((base == kVisitDataObject) || (base == kVisitStruct) || |
| 125 (base == kVisitJSObject)); | 121 (base == kVisitJSObject)); |
| 126 DCHECK(IsAligned(object_size, kPointerSize)); | 122 DCHECK(IsAligned(object_size, kPointerSize)); |
| 127 DCHECK(kMinObjectSizeInWords * kPointerSize <= object_size); | 123 DCHECK(kMinObjectSizeInWords * kPointerSize <= object_size); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 496 // the next element. Given the head of the list, this function removes dead | 492 // the next element. Given the head of the list, this function removes dead |
| 497 // elements from the list and if requested records slots for next-element | 493 // elements from the list and if requested records slots for next-element |
| 498 // pointers. The template parameter T is a WeakListVisitor that defines how to | 494 // pointers. The template parameter T is a WeakListVisitor that defines how to |
| 499 // access the next-element pointers. | 495 // access the next-element pointers. |
| 500 template <class T> | 496 template <class T> |
| 501 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 497 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
| 502 } | 498 } |
| 503 } // namespace v8::internal | 499 } // namespace v8::internal |
| 504 | 500 |
| 505 #endif // V8_OBJECTS_VISITING_H_ | 501 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |