OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 #include "src/heap/objects-visiting.h" | 5 #include "src/heap/objects-visiting.h" |
6 | 6 |
7 #include "src/heap/heap-inl.h" | 7 #include "src/heap/heap-inl.h" |
8 #include "src/heap/mark-compact-inl.h" | 8 #include "src/heap/mark-compact-inl.h" |
9 #include "src/heap/objects-visiting-inl.h" | 9 #include "src/heap/objects-visiting-inl.h" |
10 | 10 |
(...skipping 22 matching lines...) Expand all Loading... |
33 if (IsShortcutCandidate(instance_type)) { | 33 if (IsShortcutCandidate(instance_type)) { |
34 return kVisitShortcutCandidate; | 34 return kVisitShortcutCandidate; |
35 } else { | 35 } else { |
36 return kVisitConsString; | 36 return kVisitConsString; |
37 } | 37 } |
38 | 38 |
39 case kSlicedStringTag: | 39 case kSlicedStringTag: |
40 return kVisitSlicedString; | 40 return kVisitSlicedString; |
41 | 41 |
42 case kExternalStringTag: | 42 case kExternalStringTag: |
43 return kVisitDataObject; | 43 return GetVisitorIdForSize(kVisitDataObject, kVisitDataObjectGeneric, |
| 44 instance_size, has_unboxed_fields); |
44 | 45 |
45 case kThinStringTag: | 46 case kThinStringTag: |
46 return kVisitThinString; | 47 return kVisitThinString; |
47 } | 48 } |
48 UNREACHABLE(); | 49 UNREACHABLE(); |
49 } | 50 } |
50 | 51 |
51 switch (instance_type) { | 52 switch (instance_type) { |
52 case BYTE_ARRAY_TYPE: | 53 case BYTE_ARRAY_TYPE: |
53 return kVisitByteArray; | 54 return kVisitByteArray; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 case JS_WEAK_SET_TYPE: | 90 case JS_WEAK_SET_TYPE: |
90 return kVisitJSWeakCollection; | 91 return kVisitJSWeakCollection; |
91 | 92 |
92 case JS_REGEXP_TYPE: | 93 case JS_REGEXP_TYPE: |
93 return kVisitJSRegExp; | 94 return kVisitJSRegExp; |
94 | 95 |
95 case SHARED_FUNCTION_INFO_TYPE: | 96 case SHARED_FUNCTION_INFO_TYPE: |
96 return kVisitSharedFunctionInfo; | 97 return kVisitSharedFunctionInfo; |
97 | 98 |
98 case JS_PROXY_TYPE: | 99 case JS_PROXY_TYPE: |
99 return kVisitStruct; | 100 return GetVisitorIdForSize(kVisitStruct, kVisitStructGeneric, |
| 101 instance_size, has_unboxed_fields); |
100 | 102 |
101 case SYMBOL_TYPE: | 103 case SYMBOL_TYPE: |
102 return kVisitSymbol; | 104 return kVisitSymbol; |
103 | 105 |
104 case JS_ARRAY_BUFFER_TYPE: | 106 case JS_ARRAY_BUFFER_TYPE: |
105 return kVisitJSArrayBuffer; | 107 return kVisitJSArrayBuffer; |
106 | 108 |
107 case JS_OBJECT_TYPE: | 109 case JS_OBJECT_TYPE: |
108 case JS_ERROR_TYPE: | 110 case JS_ERROR_TYPE: |
109 case JS_ARGUMENTS_TYPE: | 111 case JS_ARGUMENTS_TYPE: |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 case JS_FAST_HOLEY_SMI_ARRAY_VALUE_ITERATOR_TYPE: | 159 case JS_FAST_HOLEY_SMI_ARRAY_VALUE_ITERATOR_TYPE: |
158 case JS_FAST_ARRAY_VALUE_ITERATOR_TYPE: | 160 case JS_FAST_ARRAY_VALUE_ITERATOR_TYPE: |
159 case JS_FAST_HOLEY_ARRAY_VALUE_ITERATOR_TYPE: | 161 case JS_FAST_HOLEY_ARRAY_VALUE_ITERATOR_TYPE: |
160 case JS_FAST_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: | 162 case JS_FAST_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: |
161 case JS_FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: | 163 case JS_FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: |
162 case JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE: | 164 case JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE: |
163 | 165 |
164 case JS_PROMISE_CAPABILITY_TYPE: | 166 case JS_PROMISE_CAPABILITY_TYPE: |
165 case JS_PROMISE_TYPE: | 167 case JS_PROMISE_TYPE: |
166 case JS_BOUND_FUNCTION_TYPE: | 168 case JS_BOUND_FUNCTION_TYPE: |
167 return has_unboxed_fields ? kVisitJSObject : kVisitJSObjectFast; | 169 return GetVisitorIdForSize(kVisitJSObject, kVisitJSObjectGeneric, |
| 170 instance_size, has_unboxed_fields); |
168 case JS_API_OBJECT_TYPE: | 171 case JS_API_OBJECT_TYPE: |
169 case JS_SPECIAL_API_OBJECT_TYPE: | 172 case JS_SPECIAL_API_OBJECT_TYPE: |
170 return kVisitJSApiObject; | 173 return GetVisitorIdForSize(kVisitJSApiObject, kVisitJSApiObjectGeneric, |
| 174 instance_size, has_unboxed_fields); |
171 | 175 |
172 case JS_FUNCTION_TYPE: | 176 case JS_FUNCTION_TYPE: |
173 return kVisitJSFunction; | 177 return kVisitJSFunction; |
174 | 178 |
175 case FILLER_TYPE: | 179 case FILLER_TYPE: |
| 180 if (instance_size == kPointerSize) return kVisitDataObjectGeneric; |
| 181 // Fall through. |
176 case FOREIGN_TYPE: | 182 case FOREIGN_TYPE: |
177 case HEAP_NUMBER_TYPE: | 183 case HEAP_NUMBER_TYPE: |
178 case MUTABLE_HEAP_NUMBER_TYPE: | 184 case MUTABLE_HEAP_NUMBER_TYPE: |
179 return kVisitDataObject; | 185 return GetVisitorIdForSize(kVisitDataObject, kVisitDataObjectGeneric, |
| 186 instance_size, has_unboxed_fields); |
180 | 187 |
181 case FIXED_UINT8_ARRAY_TYPE: | 188 case FIXED_UINT8_ARRAY_TYPE: |
182 case FIXED_INT8_ARRAY_TYPE: | 189 case FIXED_INT8_ARRAY_TYPE: |
183 case FIXED_UINT16_ARRAY_TYPE: | 190 case FIXED_UINT16_ARRAY_TYPE: |
184 case FIXED_INT16_ARRAY_TYPE: | 191 case FIXED_INT16_ARRAY_TYPE: |
185 case FIXED_UINT32_ARRAY_TYPE: | 192 case FIXED_UINT32_ARRAY_TYPE: |
186 case FIXED_INT32_ARRAY_TYPE: | 193 case FIXED_INT32_ARRAY_TYPE: |
187 case FIXED_FLOAT32_ARRAY_TYPE: | 194 case FIXED_FLOAT32_ARRAY_TYPE: |
188 case FIXED_UINT8_CLAMPED_ARRAY_TYPE: | 195 case FIXED_UINT8_CLAMPED_ARRAY_TYPE: |
189 return kVisitFixedTypedArray; | 196 return kVisitFixedTypedArray; |
190 | 197 |
191 case FIXED_FLOAT64_ARRAY_TYPE: | 198 case FIXED_FLOAT64_ARRAY_TYPE: |
192 return kVisitFixedFloat64Array; | 199 return kVisitFixedFloat64Array; |
193 | 200 |
194 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: | 201 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: |
195 STRUCT_LIST(MAKE_STRUCT_CASE) | 202 STRUCT_LIST(MAKE_STRUCT_CASE) |
196 #undef MAKE_STRUCT_CASE | 203 #undef MAKE_STRUCT_CASE |
197 if (instance_type == ALLOCATION_SITE_TYPE) { | 204 if (instance_type == ALLOCATION_SITE_TYPE) { |
198 return kVisitAllocationSite; | 205 return kVisitAllocationSite; |
199 } | 206 } |
200 | 207 |
201 return kVisitStruct; | 208 return GetVisitorIdForSize(kVisitStruct, kVisitStructGeneric, |
| 209 instance_size, has_unboxed_fields); |
202 | 210 |
203 default: | 211 default: |
204 UNREACHABLE(); | 212 UNREACHABLE(); |
205 return kVisitorIdCount; | 213 return kVisitorIdCount; |
206 } | 214 } |
207 } | 215 } |
208 | 216 |
209 | 217 |
210 // We don't record weak slots during marking or scavenges. Instead we do it | 218 // We don't record weak slots during marking or scavenges. Instead we do it |
211 // once when we complete mark-compact cycle. Note that write barrier has no | 219 // once when we complete mark-compact cycle. Note that write barrier has no |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 }; | 401 }; |
394 | 402 |
395 | 403 |
396 template Object* VisitWeakList<Context>(Heap* heap, Object* list, | 404 template Object* VisitWeakList<Context>(Heap* heap, Object* list, |
397 WeakObjectRetainer* retainer); | 405 WeakObjectRetainer* retainer); |
398 | 406 |
399 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list, | 407 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list, |
400 WeakObjectRetainer* retainer); | 408 WeakObjectRetainer* retainer); |
401 } // namespace internal | 409 } // namespace internal |
402 } // namespace v8 | 410 } // namespace v8 |
OLD | NEW |