| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 V(Oddball) \ | 88 V(Oddball) \ |
| 89 V(Code) \ | 89 V(Code) \ |
| 90 V(Map) \ | 90 V(Map) \ |
| 91 V(Cell) \ | 91 V(Cell) \ |
| 92 V(PropertyCell) \ | 92 V(PropertyCell) \ |
| 93 V(SharedFunctionInfo) \ | 93 V(SharedFunctionInfo) \ |
| 94 V(JSFunction) \ | 94 V(JSFunction) \ |
| 95 V(JSWeakMap) \ | 95 V(JSWeakMap) \ |
| 96 V(JSArrayBuffer) \ | 96 V(JSArrayBuffer) \ |
| 97 V(JSTypedArray) \ | 97 V(JSTypedArray) \ |
| 98 V(JSDataView) \ |
| 98 V(JSRegExp) | 99 V(JSRegExp) |
| 99 | 100 |
| 100 // For data objects, JS objects and structs along with generic visitor which | 101 // For data objects, JS objects and structs along with generic visitor which |
| 101 // can visit object of any size we provide visitors specialized by | 102 // can visit object of any size we provide visitors specialized by |
| 102 // object size in words. | 103 // object size in words. |
| 103 // Ids of specialized visitors are declared in a linear order (without | 104 // Ids of specialized visitors are declared in a linear order (without |
| 104 // holes) starting from the id of visitor specialized for 2 words objects | 105 // holes) starting from the id of visitor specialized for 2 words objects |
| 105 // (base visitor id) and ending with the id of generic visitor. | 106 // (base visitor id) and ending with the id of generic visitor. |
| 106 // Method GetVisitorIdForSize depends on this ordering to calculate visitor | 107 // Method GetVisitorIdForSize depends on this ordering to calculate visitor |
| 107 // id of specialized visitor from given instance size, base visitor id and | 108 // id of specialized visitor from given instance size, base visitor id and |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 331 return SeqTwoByteString::cast(object)-> | 332 return SeqTwoByteString::cast(object)-> |
| 332 SeqTwoByteStringSize(map->instance_type()); | 333 SeqTwoByteStringSize(map->instance_type()); |
| 333 } | 334 } |
| 334 | 335 |
| 335 INLINE(static int VisitFreeSpace(Map* map, HeapObject* object)) { | 336 INLINE(static int VisitFreeSpace(Map* map, HeapObject* object)) { |
| 336 return FreeSpace::cast(object)->Size(); | 337 return FreeSpace::cast(object)->Size(); |
| 337 } | 338 } |
| 338 | 339 |
| 339 INLINE(static int VisitJSArrayBuffer(Map* map, HeapObject* object)); | 340 INLINE(static int VisitJSArrayBuffer(Map* map, HeapObject* object)); |
| 340 INLINE(static int VisitJSTypedArray(Map* map, HeapObject* object)); | 341 INLINE(static int VisitJSTypedArray(Map* map, HeapObject* object)); |
| 342 INLINE(static int VisitJSDataView(Map* map, HeapObject* object)); |
| 341 | 343 |
| 342 class DataObjectVisitor { | 344 class DataObjectVisitor { |
| 343 public: | 345 public: |
| 344 template<int object_size> | 346 template<int object_size> |
| 345 static inline int VisitSpecialized(Map* map, HeapObject* object) { | 347 static inline int VisitSpecialized(Map* map, HeapObject* object) { |
| 346 return object_size; | 348 return object_size; |
| 347 } | 349 } |
| 348 | 350 |
| 349 INLINE(static int Visit(Map* map, HeapObject* object)) { | 351 INLINE(static int Visit(Map* map, HeapObject* object)) { |
| 350 return map->instance_size(); | 352 return map->instance_size(); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 // This is an example of Curiously recurring template pattern. | 388 // This is an example of Curiously recurring template pattern. |
| 387 template<typename StaticVisitor> | 389 template<typename StaticVisitor> |
| 388 class StaticMarkingVisitor : public StaticVisitorBase { | 390 class StaticMarkingVisitor : public StaticVisitorBase { |
| 389 public: | 391 public: |
| 390 static void Initialize(); | 392 static void Initialize(); |
| 391 | 393 |
| 392 INLINE(static void IterateBody(Map* map, HeapObject* obj)) { | 394 INLINE(static void IterateBody(Map* map, HeapObject* obj)) { |
| 393 table_.GetVisitor(map)(map, obj); | 395 table_.GetVisitor(map)(map, obj); |
| 394 } | 396 } |
| 395 | 397 |
| 398 INLINE(static void VisitPropertyCell(Map* map, HeapObject* object)); |
| 396 INLINE(static void VisitCodeEntry(Heap* heap, Address entry_address)); | 399 INLINE(static void VisitCodeEntry(Heap* heap, Address entry_address)); |
| 397 INLINE(static void VisitEmbeddedPointer(Heap* heap, RelocInfo* rinfo)); | 400 INLINE(static void VisitEmbeddedPointer(Heap* heap, RelocInfo* rinfo)); |
| 398 INLINE(static void VisitCell(Heap* heap, RelocInfo* rinfo)); | 401 INLINE(static void VisitCell(Heap* heap, RelocInfo* rinfo)); |
| 399 INLINE(static void VisitDebugTarget(Heap* heap, RelocInfo* rinfo)); | 402 INLINE(static void VisitDebugTarget(Heap* heap, RelocInfo* rinfo)); |
| 400 INLINE(static void VisitCodeTarget(Heap* heap, RelocInfo* rinfo)); | 403 INLINE(static void VisitCodeTarget(Heap* heap, RelocInfo* rinfo)); |
| 401 INLINE(static void VisitCodeAgeSequence(Heap* heap, RelocInfo* rinfo)); | 404 INLINE(static void VisitCodeAgeSequence(Heap* heap, RelocInfo* rinfo)); |
| 402 INLINE(static void VisitExternalReference(RelocInfo* rinfo)) { } | 405 INLINE(static void VisitExternalReference(RelocInfo* rinfo)) { } |
| 403 INLINE(static void VisitRuntimeEntry(RelocInfo* rinfo)) { } | 406 INLINE(static void VisitRuntimeEntry(RelocInfo* rinfo)) { } |
| 404 | 407 |
| 405 // TODO(mstarzinger): This should be made protected once refactoring is done. | 408 // TODO(mstarzinger): This should be made protected once refactoring is done. |
| 406 // Mark non-optimize code for functions inlined into the given optimized | 409 // Mark non-optimize code for functions inlined into the given optimized |
| 407 // code. This will prevent it from being flushed. | 410 // code. This will prevent it from being flushed. |
| 408 static void MarkInlinedFunctionsCode(Heap* heap, Code* code); | 411 static void MarkInlinedFunctionsCode(Heap* heap, Code* code); |
| 409 | 412 |
| 410 protected: | 413 protected: |
| 411 INLINE(static void VisitMap(Map* map, HeapObject* object)); | 414 INLINE(static void VisitMap(Map* map, HeapObject* object)); |
| 412 INLINE(static void VisitCode(Map* map, HeapObject* object)); | 415 INLINE(static void VisitCode(Map* map, HeapObject* object)); |
| 413 INLINE(static void VisitSharedFunctionInfo(Map* map, HeapObject* object)); | 416 INLINE(static void VisitSharedFunctionInfo(Map* map, HeapObject* object)); |
| 414 INLINE(static void VisitJSFunction(Map* map, HeapObject* object)); | 417 INLINE(static void VisitJSFunction(Map* map, HeapObject* object)); |
| 415 INLINE(static void VisitJSRegExp(Map* map, HeapObject* object)); | 418 INLINE(static void VisitJSRegExp(Map* map, HeapObject* object)); |
| 416 INLINE(static void VisitJSArrayBuffer(Map* map, HeapObject* object)); | 419 INLINE(static void VisitJSArrayBuffer(Map* map, HeapObject* object)); |
| 417 INLINE(static void VisitJSTypedArray(Map* map, HeapObject* object)); | 420 INLINE(static void VisitJSTypedArray(Map* map, HeapObject* object)); |
| 421 INLINE(static void VisitJSDataView(Map* map, HeapObject* object)); |
| 418 INLINE(static void VisitNativeContext(Map* map, HeapObject* object)); | 422 INLINE(static void VisitNativeContext(Map* map, HeapObject* object)); |
| 419 | 423 |
| 420 // Mark pointers in a Map and its TransitionArray together, possibly | 424 // Mark pointers in a Map and its TransitionArray together, possibly |
| 421 // treating transitions or back pointers weak. | 425 // treating transitions or back pointers weak. |
| 422 static void MarkMapContents(Heap* heap, Map* map); | 426 static void MarkMapContents(Heap* heap, Map* map); |
| 423 static void MarkTransitionArray(Heap* heap, TransitionArray* transitions); | 427 static void MarkTransitionArray(Heap* heap, TransitionArray* transitions); |
| 424 | 428 |
| 425 // Code flushing support. | 429 // Code flushing support. |
| 426 INLINE(static bool IsFlushable(Heap* heap, JSFunction* function)); | 430 INLINE(static bool IsFlushable(Heap* heap, JSFunction* function)); |
| 427 INLINE(static bool IsFlushable(Heap* heap, SharedFunctionInfo* shared_info)); | 431 INLINE(static bool IsFlushable(Heap* heap, SharedFunctionInfo* shared_info)); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 466 |
| 463 | 467 |
| 464 template<typename StaticVisitor> | 468 template<typename StaticVisitor> |
| 465 VisitorDispatchTable<typename StaticMarkingVisitor<StaticVisitor>::Callback> | 469 VisitorDispatchTable<typename StaticMarkingVisitor<StaticVisitor>::Callback> |
| 466 StaticMarkingVisitor<StaticVisitor>::table_; | 470 StaticMarkingVisitor<StaticVisitor>::table_; |
| 467 | 471 |
| 468 | 472 |
| 469 } } // namespace v8::internal | 473 } } // namespace v8::internal |
| 470 | 474 |
| 471 #endif // V8_OBJECTS_VISITING_H_ | 475 #endif // V8_OBJECTS_VISITING_H_ |
| OLD | NEW |