| 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/heap/spaces.h" | 9 #include "src/heap/spaces.h" |
| 10 #include "src/layout-descriptor.h" | 10 #include "src/layout-descriptor.h" |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 heap, object, HeapObject::RawField( | 310 heap, object, HeapObject::RawField( |
| 311 object, JSFunction::kCodeEntryOffset + kPointerSize), | 311 object, JSFunction::kCodeEntryOffset + kPointerSize), |
| 312 HeapObject::RawField(object, JSFunction::kNonWeakFieldsEndOffset)); | 312 HeapObject::RawField(object, JSFunction::kNonWeakFieldsEndOffset)); |
| 313 return JSFunction::kSize; | 313 return JSFunction::kSize; |
| 314 } | 314 } |
| 315 | 315 |
| 316 INLINE(static int VisitByteArray(Map* map, HeapObject* object)) { | 316 INLINE(static int VisitByteArray(Map* map, HeapObject* object)) { |
| 317 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); | 317 return reinterpret_cast<ByteArray*>(object)->ByteArraySize(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 INLINE(static int VisitBytecodeArray(Map* map, HeapObject* object)) { | |
| 321 return reinterpret_cast<BytecodeArray*>(object)->BytecodeArraySize(); | |
| 322 } | |
| 323 | |
| 324 INLINE(static int VisitFixedDoubleArray(Map* map, HeapObject* object)) { | 320 INLINE(static int VisitFixedDoubleArray(Map* map, HeapObject* object)) { |
| 325 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); | 321 int length = reinterpret_cast<FixedDoubleArray*>(object)->length(); |
| 326 return FixedDoubleArray::SizeFor(length); | 322 return FixedDoubleArray::SizeFor(length); |
| 327 } | 323 } |
| 328 | 324 |
| 329 INLINE(static int VisitFixedTypedArray(Map* map, HeapObject* object)) { | 325 INLINE(static int VisitFixedTypedArray(Map* map, HeapObject* object)) { |
| 330 return reinterpret_cast<FixedTypedArrayBase*>(object)->size(); | 326 return reinterpret_cast<FixedTypedArrayBase*>(object)->size(); |
| 331 } | 327 } |
| 332 | 328 |
| 333 INLINE(static int VisitJSObject(Map* map, HeapObject* object)) { | 329 INLINE(static int VisitJSObject(Map* map, HeapObject* object)) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 344 ->SeqTwoByteStringSize(map->instance_type()); | 340 ->SeqTwoByteStringSize(map->instance_type()); |
| 345 } | 341 } |
| 346 | 342 |
| 347 INLINE(static int VisitFreeSpace(Map* map, HeapObject* object)) { | 343 INLINE(static int VisitFreeSpace(Map* map, HeapObject* object)) { |
| 348 return FreeSpace::cast(object)->Size(); | 344 return FreeSpace::cast(object)->Size(); |
| 349 } | 345 } |
| 350 | 346 |
| 351 INLINE(static int VisitJSArrayBuffer(Map* map, HeapObject* object)); | 347 INLINE(static int VisitJSArrayBuffer(Map* map, HeapObject* object)); |
| 352 INLINE(static int VisitJSTypedArray(Map* map, HeapObject* object)); | 348 INLINE(static int VisitJSTypedArray(Map* map, HeapObject* object)); |
| 353 INLINE(static int VisitJSDataView(Map* map, HeapObject* object)); | 349 INLINE(static int VisitJSDataView(Map* map, HeapObject* object)); |
| 350 INLINE(static int VisitBytecodeArray(Map* map, HeapObject* object)); |
| 354 | 351 |
| 355 class DataObjectVisitor { | 352 class DataObjectVisitor { |
| 356 public: | 353 public: |
| 357 template <int object_size> | 354 template <int object_size> |
| 358 static inline int VisitSpecialized(Map* map, HeapObject* object) { | 355 static inline int VisitSpecialized(Map* map, HeapObject* object) { |
| 359 return object_size; | 356 return object_size; |
| 360 } | 357 } |
| 361 | 358 |
| 362 INLINE(static int Visit(Map* map, HeapObject* object)) { | 359 INLINE(static int Visit(Map* map, HeapObject* object)) { |
| 363 return map->instance_size(); | 360 return map->instance_size(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 INLINE(static void VisitCode(Map* map, HeapObject* object)); | 425 INLINE(static void VisitCode(Map* map, HeapObject* object)); |
| 429 INLINE(static void VisitSharedFunctionInfo(Map* map, HeapObject* object)); | 426 INLINE(static void VisitSharedFunctionInfo(Map* map, HeapObject* object)); |
| 430 INLINE(static void VisitAllocationSite(Map* map, HeapObject* object)); | 427 INLINE(static void VisitAllocationSite(Map* map, HeapObject* object)); |
| 431 INLINE(static void VisitWeakCollection(Map* map, HeapObject* object)); | 428 INLINE(static void VisitWeakCollection(Map* map, HeapObject* object)); |
| 432 INLINE(static void VisitJSFunction(Map* map, HeapObject* object)); | 429 INLINE(static void VisitJSFunction(Map* map, HeapObject* object)); |
| 433 INLINE(static void VisitJSRegExp(Map* map, HeapObject* object)); | 430 INLINE(static void VisitJSRegExp(Map* map, HeapObject* object)); |
| 434 INLINE(static void VisitJSArrayBuffer(Map* map, HeapObject* object)); | 431 INLINE(static void VisitJSArrayBuffer(Map* map, HeapObject* object)); |
| 435 INLINE(static void VisitJSTypedArray(Map* map, HeapObject* object)); | 432 INLINE(static void VisitJSTypedArray(Map* map, HeapObject* object)); |
| 436 INLINE(static void VisitJSDataView(Map* map, HeapObject* object)); | 433 INLINE(static void VisitJSDataView(Map* map, HeapObject* object)); |
| 437 INLINE(static void VisitNativeContext(Map* map, HeapObject* object)); | 434 INLINE(static void VisitNativeContext(Map* map, HeapObject* object)); |
| 435 INLINE(static void VisitBytecodeArray(Map* map, HeapObject* object)); |
| 438 | 436 |
| 439 // Mark pointers in a Map and its TransitionArray together, possibly | 437 // Mark pointers in a Map and its TransitionArray together, possibly |
| 440 // treating transitions or back pointers weak. | 438 // treating transitions or back pointers weak. |
| 441 static void MarkMapContents(Heap* heap, Map* map); | 439 static void MarkMapContents(Heap* heap, Map* map); |
| 442 static void MarkTransitionArray(Heap* heap, TransitionArray* transitions); | 440 static void MarkTransitionArray(Heap* heap, TransitionArray* transitions); |
| 443 | 441 |
| 444 // Mark pointers in the optimized code map that should act as strong | 442 // Mark pointers in the optimized code map that should act as strong |
| 445 // references, possibly treating some entries weak. | 443 // references, possibly treating some entries weak. |
| 446 static void MarkOptimizedCodeMap(Heap* heap, FixedArray* code_map); | 444 static void MarkOptimizedCodeMap(Heap* heap, FixedArray* code_map); |
| 447 | 445 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 491 // the next element. Given the head of the list, this function removes dead | 489 // the next element. Given the head of the list, this function removes dead |
| 492 // elements from the list and if requested records slots for next-element | 490 // elements from the list and if requested records slots for next-element |
| 493 // pointers. The template parameter T is a WeakListVisitor that defines how to | 491 // pointers. The template parameter T is a WeakListVisitor that defines how to |
| 494 // access the next-element pointers. | 492 // access the next-element pointers. |
| 495 template <class T> | 493 template <class T> |
| 496 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); | 494 Object* VisitWeakList(Heap* heap, Object* list, WeakObjectRetainer* retainer); |
| 497 } | 495 } |
| 498 } // namespace v8::internal | 496 } // namespace v8::internal |
| 499 | 497 |
| 500 #endif // V8_OBJECTS_VISITING_H_ | 498 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |