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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 case JS_FAST_HOLEY_SMI_ARRAY_VALUE_ITERATOR_TYPE: | 158 case JS_FAST_HOLEY_SMI_ARRAY_VALUE_ITERATOR_TYPE: |
161 case JS_FAST_ARRAY_VALUE_ITERATOR_TYPE: | 159 case JS_FAST_ARRAY_VALUE_ITERATOR_TYPE: |
162 case JS_FAST_HOLEY_ARRAY_VALUE_ITERATOR_TYPE: | 160 case JS_FAST_HOLEY_ARRAY_VALUE_ITERATOR_TYPE: |
163 case JS_FAST_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: | 161 case JS_FAST_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: |
164 case JS_FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: | 162 case JS_FAST_HOLEY_DOUBLE_ARRAY_VALUE_ITERATOR_TYPE: |
165 case JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE: | 163 case JS_GENERIC_ARRAY_VALUE_ITERATOR_TYPE: |
166 | 164 |
167 case JS_PROMISE_CAPABILITY_TYPE: | 165 case JS_PROMISE_CAPABILITY_TYPE: |
168 case JS_PROMISE_TYPE: | 166 case JS_PROMISE_TYPE: |
169 case JS_BOUND_FUNCTION_TYPE: | 167 case JS_BOUND_FUNCTION_TYPE: |
170 return GetVisitorIdForSize(kVisitJSObject, kVisitJSObjectGeneric, | 168 return has_unboxed_fields ? kVisitJSObject : kVisitJSObjectFast; |
171 instance_size, has_unboxed_fields); | |
172 case JS_API_OBJECT_TYPE: | 169 case JS_API_OBJECT_TYPE: |
173 case JS_SPECIAL_API_OBJECT_TYPE: | 170 case JS_SPECIAL_API_OBJECT_TYPE: |
174 return GetVisitorIdForSize(kVisitJSApiObject, kVisitJSApiObjectGeneric, | 171 return kVisitJSApiObject; |
175 instance_size, has_unboxed_fields); | |
176 | 172 |
177 case JS_FUNCTION_TYPE: | 173 case JS_FUNCTION_TYPE: |
178 return kVisitJSFunction; | 174 return kVisitJSFunction; |
179 | 175 |
180 case FILLER_TYPE: | 176 case FILLER_TYPE: |
181 if (instance_size == kPointerSize) return kVisitDataObjectGeneric; | |
182 // Fall through. | |
183 case FOREIGN_TYPE: | 177 case FOREIGN_TYPE: |
184 case HEAP_NUMBER_TYPE: | 178 case HEAP_NUMBER_TYPE: |
185 case MUTABLE_HEAP_NUMBER_TYPE: | 179 case MUTABLE_HEAP_NUMBER_TYPE: |
186 return GetVisitorIdForSize(kVisitDataObject, kVisitDataObjectGeneric, | 180 return kVisitDataObject; |
187 instance_size, has_unboxed_fields); | |
188 | 181 |
189 case FIXED_UINT8_ARRAY_TYPE: | 182 case FIXED_UINT8_ARRAY_TYPE: |
190 case FIXED_INT8_ARRAY_TYPE: | 183 case FIXED_INT8_ARRAY_TYPE: |
191 case FIXED_UINT16_ARRAY_TYPE: | 184 case FIXED_UINT16_ARRAY_TYPE: |
192 case FIXED_INT16_ARRAY_TYPE: | 185 case FIXED_INT16_ARRAY_TYPE: |
193 case FIXED_UINT32_ARRAY_TYPE: | 186 case FIXED_UINT32_ARRAY_TYPE: |
194 case FIXED_INT32_ARRAY_TYPE: | 187 case FIXED_INT32_ARRAY_TYPE: |
195 case FIXED_FLOAT32_ARRAY_TYPE: | 188 case FIXED_FLOAT32_ARRAY_TYPE: |
196 case FIXED_UINT8_CLAMPED_ARRAY_TYPE: | 189 case FIXED_UINT8_CLAMPED_ARRAY_TYPE: |
197 return kVisitFixedTypedArray; | 190 return kVisitFixedTypedArray; |
198 | 191 |
199 case FIXED_FLOAT64_ARRAY_TYPE: | 192 case FIXED_FLOAT64_ARRAY_TYPE: |
200 return kVisitFixedFloat64Array; | 193 return kVisitFixedFloat64Array; |
201 | 194 |
202 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: | 195 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE: |
203 STRUCT_LIST(MAKE_STRUCT_CASE) | 196 STRUCT_LIST(MAKE_STRUCT_CASE) |
204 #undef MAKE_STRUCT_CASE | 197 #undef MAKE_STRUCT_CASE |
205 if (instance_type == ALLOCATION_SITE_TYPE) { | 198 if (instance_type == ALLOCATION_SITE_TYPE) { |
206 return kVisitAllocationSite; | 199 return kVisitAllocationSite; |
207 } | 200 } |
208 | 201 |
209 return GetVisitorIdForSize(kVisitStruct, kVisitStructGeneric, | 202 return kVisitStruct; |
210 instance_size, has_unboxed_fields); | |
211 | 203 |
212 default: | 204 default: |
213 UNREACHABLE(); | 205 UNREACHABLE(); |
214 return kVisitorIdCount; | 206 return kVisitorIdCount; |
215 } | 207 } |
216 } | 208 } |
217 | 209 |
218 | 210 |
219 // We don't record weak slots during marking or scavenges. Instead we do it | 211 // We don't record weak slots during marking or scavenges. Instead we do it |
220 // once when we complete mark-compact cycle. Note that write barrier has no | 212 // 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... |
402 }; | 394 }; |
403 | 395 |
404 | 396 |
405 template Object* VisitWeakList<Context>(Heap* heap, Object* list, | 397 template Object* VisitWeakList<Context>(Heap* heap, Object* list, |
406 WeakObjectRetainer* retainer); | 398 WeakObjectRetainer* retainer); |
407 | 399 |
408 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list, | 400 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list, |
409 WeakObjectRetainer* retainer); | 401 WeakObjectRetainer* retainer); |
410 } // namespace internal | 402 } // namespace internal |
411 } // namespace v8 | 403 } // namespace v8 |
OLD | NEW |