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