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

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

Issue 1272933004: [heap] Avoid inclusion of objects-visiting-inl.h header. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 5 years, 4 months 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
« no previous file with comments | « src/DEPS ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/heap/mark-compact-inl.h" 7 #include "src/heap/mark-compact-inl.h"
8 #include "src/heap/objects-visiting.h" 8 #include "src/heap/objects-visiting.h"
9 #include "src/heap/objects-visiting-inl.h"
9 10
10 namespace v8 { 11 namespace v8 {
11 namespace internal { 12 namespace internal {
12 13
13 14
14 StaticVisitorBase::VisitorId StaticVisitorBase::GetVisitorId( 15 StaticVisitorBase::VisitorId StaticVisitorBase::GetVisitorId(
15 int instance_type, int instance_size, bool has_unboxed_fields) { 16 int instance_type, int instance_size, bool has_unboxed_fields) {
16 if (instance_type < FIRST_NONSTRING_TYPE) { 17 if (instance_type < FIRST_NONSTRING_TYPE) {
17 switch (instance_type & kStringRepresentationMask) { 18 switch (instance_type & kStringRepresentationMask) {
18 case kSeqStringTag: 19 case kSeqStringTag:
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return GetVisitorIdForSize(kVisitStruct, kVisitStructGeneric, 167 return GetVisitorIdForSize(kVisitStruct, kVisitStructGeneric,
167 instance_size, has_unboxed_fields); 168 instance_size, has_unboxed_fields);
168 169
169 default: 170 default:
170 UNREACHABLE(); 171 UNREACHABLE();
171 return kVisitorIdCount; 172 return kVisitorIdCount;
172 } 173 }
173 } 174 }
174 175
175 176
177 void HeapObject::IterateBody(InstanceType type, int object_size,
178 ObjectVisitor* v) {
179 // Avoiding <Type>::cast(this) because it accesses the map pointer field.
180 // During GC, the map pointer field is encoded.
181 if (type < FIRST_NONSTRING_TYPE) {
182 switch (type & kStringRepresentationMask) {
183 case kSeqStringTag:
184 break;
185 case kConsStringTag:
186 ConsString::BodyDescriptor::IterateBody(this, v);
187 break;
188 case kSlicedStringTag:
189 SlicedString::BodyDescriptor::IterateBody(this, v);
190 break;
191 case kExternalStringTag:
192 if ((type & kStringEncodingMask) == kOneByteStringTag) {
193 reinterpret_cast<ExternalOneByteString*>(this)
194 ->ExternalOneByteStringIterateBody(v);
195 } else {
196 reinterpret_cast<ExternalTwoByteString*>(this)
197 ->ExternalTwoByteStringIterateBody(v);
198 }
199 break;
200 }
201 return;
202 }
203
204 switch (type) {
205 case FIXED_ARRAY_TYPE:
206 FixedArray::BodyDescriptor::IterateBody(this, object_size, v);
207 break;
208 case FIXED_DOUBLE_ARRAY_TYPE:
209 break;
210 case JS_OBJECT_TYPE:
211 case JS_CONTEXT_EXTENSION_OBJECT_TYPE:
212 case JS_GENERATOR_OBJECT_TYPE:
213 case JS_MODULE_TYPE:
214 case JS_VALUE_TYPE:
215 case JS_DATE_TYPE:
216 case JS_ARRAY_TYPE:
217 case JS_ARRAY_BUFFER_TYPE:
218 case JS_TYPED_ARRAY_TYPE:
219 case JS_DATA_VIEW_TYPE:
220 case JS_SET_TYPE:
221 case JS_MAP_TYPE:
222 case JS_SET_ITERATOR_TYPE:
223 case JS_MAP_ITERATOR_TYPE:
224 case JS_WEAK_MAP_TYPE:
225 case JS_WEAK_SET_TYPE:
226 case JS_REGEXP_TYPE:
227 case JS_GLOBAL_PROXY_TYPE:
228 case JS_GLOBAL_OBJECT_TYPE:
229 case JS_BUILTINS_OBJECT_TYPE:
230 case JS_MESSAGE_OBJECT_TYPE:
231 JSObject::BodyDescriptor::IterateBody(this, object_size, v);
232 break;
233 case JS_FUNCTION_TYPE:
234 reinterpret_cast<JSFunction*>(this)
235 ->JSFunctionIterateBody(object_size, v);
236 break;
237 case ODDBALL_TYPE:
238 Oddball::BodyDescriptor::IterateBody(this, v);
239 break;
240 case JS_PROXY_TYPE:
241 JSProxy::BodyDescriptor::IterateBody(this, v);
242 break;
243 case JS_FUNCTION_PROXY_TYPE:
244 JSFunctionProxy::BodyDescriptor::IterateBody(this, v);
245 break;
246 case FOREIGN_TYPE:
247 reinterpret_cast<Foreign*>(this)->ForeignIterateBody(v);
248 break;
249 case MAP_TYPE:
250 Map::BodyDescriptor::IterateBody(this, v);
251 break;
252 case CODE_TYPE:
253 reinterpret_cast<Code*>(this)->CodeIterateBody(v);
254 break;
255 case CELL_TYPE:
256 Cell::BodyDescriptor::IterateBody(this, v);
257 break;
258 case PROPERTY_CELL_TYPE:
259 PropertyCell::BodyDescriptor::IterateBody(this, v);
260 break;
261 case WEAK_CELL_TYPE:
262 WeakCell::BodyDescriptor::IterateBody(this, v);
263 break;
264 case SYMBOL_TYPE:
265 Symbol::BodyDescriptor::IterateBody(this, v);
266 break;
267
268 case HEAP_NUMBER_TYPE:
269 case MUTABLE_HEAP_NUMBER_TYPE:
270 case SIMD128_VALUE_TYPE:
271 case FILLER_TYPE:
272 case BYTE_ARRAY_TYPE:
273 case BYTECODE_ARRAY_TYPE:
274 case FREE_SPACE_TYPE:
275 break;
276
277 #define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
278 case FIXED_##TYPE##_ARRAY_TYPE: \
279 reinterpret_cast<FixedTypedArrayBase*>(this) \
280 ->FixedTypedArrayBaseIterateBody(v); \
281 break;
282 TYPED_ARRAYS(TYPED_ARRAY_CASE)
283 #undef TYPED_ARRAY_CASE
284
285 case SHARED_FUNCTION_INFO_TYPE: {
286 SharedFunctionInfo::BodyDescriptor::IterateBody(this, v);
287 break;
288 }
289
290 #define MAKE_STRUCT_CASE(NAME, Name, name) case NAME##_TYPE:
291 STRUCT_LIST(MAKE_STRUCT_CASE)
292 #undef MAKE_STRUCT_CASE
293 if (type == ALLOCATION_SITE_TYPE) {
294 AllocationSite::BodyDescriptor::IterateBody(this, v);
295 } else {
296 StructBodyDescriptor::IterateBody(this, object_size, v);
297 }
298 break;
299 default:
300 PrintF("Unknown type: %d\n", type);
301 UNREACHABLE();
302 }
303 }
304
305
176 // We don't record weak slots during marking or scavenges. Instead we do it 306 // We don't record weak slots during marking or scavenges. Instead we do it
177 // once when we complete mark-compact cycle. Note that write barrier has no 307 // once when we complete mark-compact cycle. Note that write barrier has no
178 // effect if we are already in the middle of compacting mark-sweep cycle and we 308 // effect if we are already in the middle of compacting mark-sweep cycle and we
179 // have to record slots manually. 309 // have to record slots manually.
180 static bool MustRecordSlots(Heap* heap) { 310 static bool MustRecordSlots(Heap* heap) {
181 return heap->gc_state() == Heap::MARK_COMPACT && 311 return heap->gc_state() == Heap::MARK_COMPACT &&
182 heap->mark_compact_collector()->is_compacting(); 312 heap->mark_compact_collector()->is_compacting();
183 } 313 }
184 314
185 315
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 }; 481 };
352 482
353 483
354 template Object* VisitWeakList<Context>(Heap* heap, Object* list, 484 template Object* VisitWeakList<Context>(Heap* heap, Object* list,
355 WeakObjectRetainer* retainer); 485 WeakObjectRetainer* retainer);
356 486
357 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list, 487 template Object* VisitWeakList<AllocationSite>(Heap* heap, Object* list,
358 WeakObjectRetainer* retainer); 488 WeakObjectRetainer* retainer);
359 } // namespace internal 489 } // namespace internal
360 } // namespace v8 490 } // namespace v8
OLDNEW
« no previous file with comments | « src/DEPS ('k') | src/heap/objects-visiting-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698