OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 HeapEntry* AddEntry(Address address, | 369 HeapEntry* AddEntry(Address address, |
370 HeapEntry::Type type, | 370 HeapEntry::Type type, |
371 const char* name, | 371 const char* name, |
372 size_t size); | 372 size_t size); |
373 | 373 |
374 static String* GetConstructorName(JSObject* object); | 374 static String* GetConstructorName(JSObject* object); |
375 | 375 |
376 static HeapObject* const kInternalRootObject; | 376 static HeapObject* const kInternalRootObject; |
377 | 377 |
378 private: | 378 private: |
| 379 typedef void (V8HeapExplorer::*ExtractReferencesMethod)(HeapObject* object); |
| 380 |
379 HeapEntry* AddEntry(HeapObject* object); | 381 HeapEntry* AddEntry(HeapObject* object); |
380 HeapEntry* AddEntry(HeapObject* object, | 382 HeapEntry* AddEntry(HeapObject* object, |
381 HeapEntry::Type type, | 383 HeapEntry::Type type, |
382 const char* name); | 384 const char* name); |
383 | 385 |
384 const char* GetSystemEntryName(HeapObject* object); | 386 const char* GetSystemEntryName(HeapObject* object); |
385 | 387 |
386 void ExtractReferences(HeapObject* obj); | 388 template<V8HeapExplorer::ExtractReferencesMethod extractor> |
| 389 bool IterateAndExtractSinglePass(); |
| 390 |
| 391 void ExtractReferencesPass1(HeapObject* obj); |
| 392 void ExtractReferencesPass2(HeapObject* obj); |
387 void ExtractJSGlobalProxyReferences(int entry, JSGlobalProxy* proxy); | 393 void ExtractJSGlobalProxyReferences(int entry, JSGlobalProxy* proxy); |
388 void ExtractJSObjectReferences(int entry, JSObject* js_obj); | 394 void ExtractJSObjectReferences(int entry, JSObject* js_obj); |
389 void ExtractStringReferences(int entry, String* obj); | 395 void ExtractStringReferences(int entry, String* obj); |
390 void ExtractContextReferences(int entry, Context* context); | 396 void ExtractContextReferences(int entry, Context* context); |
391 void ExtractMapReferences(int entry, Map* map); | 397 void ExtractMapReferences(int entry, Map* map); |
392 void ExtractSharedFunctionInfoReferences(int entry, | 398 void ExtractSharedFunctionInfoReferences(int entry, |
393 SharedFunctionInfo* shared); | 399 SharedFunctionInfo* shared); |
394 void ExtractScriptReferences(int entry, Script* script); | 400 void ExtractScriptReferences(int entry, Script* script); |
395 void ExtractAccessorPairReferences(int entry, AccessorPair* accessors); | 401 void ExtractAccessorPairReferences(int entry, AccessorPair* accessors); |
396 void ExtractCodeCacheReferences(int entry, CodeCache* code_cache); | 402 void ExtractCodeCacheReferences(int entry, CodeCache* code_cache); |
397 void ExtractCodeReferences(int entry, Code* code); | 403 void ExtractCodeReferences(int entry, Code* code); |
398 void ExtractBoxReferences(int entry, Box* box); | 404 void ExtractBoxReferences(int entry, Box* box); |
399 void ExtractCellReferences(int entry, Cell* cell); | 405 void ExtractCellReferences(int entry, Cell* cell); |
400 void ExtractPropertyCellReferences(int entry, PropertyCell* cell); | 406 void ExtractPropertyCellReferences(int entry, PropertyCell* cell); |
401 void ExtractAllocationSiteReferences(int entry, AllocationSite* site); | 407 void ExtractAllocationSiteReferences(int entry, AllocationSite* site); |
402 void ExtractJSArrayBufferReferences(int entry, JSArrayBuffer* buffer); | 408 void ExtractJSArrayBufferReferences(int entry, JSArrayBuffer* buffer); |
| 409 void ExtractFixedArrayReferences(int entry, FixedArray* array); |
403 void ExtractClosureReferences(JSObject* js_obj, int entry); | 410 void ExtractClosureReferences(JSObject* js_obj, int entry); |
404 void ExtractPropertyReferences(JSObject* js_obj, int entry); | 411 void ExtractPropertyReferences(JSObject* js_obj, int entry); |
405 bool ExtractAccessorPairProperty(JSObject* js_obj, int entry, | 412 bool ExtractAccessorPairProperty(JSObject* js_obj, int entry, |
406 Object* key, Object* callback_obj); | 413 Object* key, Object* callback_obj); |
407 void ExtractElementReferences(JSObject* js_obj, int entry); | 414 void ExtractElementReferences(JSObject* js_obj, int entry); |
408 void ExtractInternalReferences(JSObject* js_obj, int entry); | 415 void ExtractInternalReferences(JSObject* js_obj, int entry); |
| 416 |
409 bool IsEssentialObject(Object* object); | 417 bool IsEssentialObject(Object* object); |
410 void SetContextReference(HeapObject* parent_obj, | 418 void SetContextReference(HeapObject* parent_obj, |
411 int parent, | 419 int parent, |
412 String* reference_name, | 420 String* reference_name, |
413 Object* child, | 421 Object* child, |
414 int field_offset); | 422 int field_offset); |
415 void SetNativeBindReference(HeapObject* parent_obj, | 423 void SetNativeBindReference(HeapObject* parent_obj, |
416 int parent, | 424 int parent, |
417 const char* reference_name, | 425 const char* reference_name, |
418 Object* child); | 426 Object* child); |
(...skipping 13 matching lines...) Expand all Loading... |
432 int field_offset = -1); | 440 int field_offset = -1); |
433 void SetHiddenReference(HeapObject* parent_obj, | 441 void SetHiddenReference(HeapObject* parent_obj, |
434 int parent, | 442 int parent, |
435 int index, | 443 int index, |
436 Object* child); | 444 Object* child); |
437 void SetWeakReference(HeapObject* parent_obj, | 445 void SetWeakReference(HeapObject* parent_obj, |
438 int parent, | 446 int parent, |
439 const char* reference_name, | 447 const char* reference_name, |
440 Object* child_obj, | 448 Object* child_obj, |
441 int field_offset); | 449 int field_offset); |
| 450 void SetWeakReference(HeapObject* parent_obj, |
| 451 int parent, |
| 452 int index, |
| 453 Object* child_obj, |
| 454 int field_offset); |
442 void SetPropertyReference(HeapObject* parent_obj, | 455 void SetPropertyReference(HeapObject* parent_obj, |
443 int parent, | 456 int parent, |
444 Name* reference_name, | 457 Name* reference_name, |
445 Object* child, | 458 Object* child, |
446 const char* name_format_string = NULL, | 459 const char* name_format_string = NULL, |
447 int field_offset = -1); | 460 int field_offset = -1); |
448 void SetUserGlobalReference(Object* user_global); | 461 void SetUserGlobalReference(Object* user_global); |
449 void SetRootGcRootsReference(); | 462 void SetRootGcRootsReference(); |
450 void SetGcRootsReference(VisitorSynchronization::SyncTag tag); | 463 void SetGcRootsReference(VisitorSynchronization::SyncTag tag); |
451 void SetGcSubrootReference( | 464 void SetGcSubrootReference( |
452 VisitorSynchronization::SyncTag tag, bool is_weak, Object* child); | 465 VisitorSynchronization::SyncTag tag, bool is_weak, Object* child); |
453 const char* GetStrongGcSubrootName(Object* object); | 466 const char* GetStrongGcSubrootName(Object* object); |
454 void TagObject(Object* obj, const char* tag); | 467 void TagObject(Object* obj, const char* tag); |
| 468 void MarkAsWeakContainer(Object* object); |
455 | 469 |
456 HeapEntry* GetEntry(Object* obj); | 470 HeapEntry* GetEntry(Object* obj); |
457 | 471 |
458 static inline HeapObject* GetNthGcSubrootObject(int delta); | 472 static inline HeapObject* GetNthGcSubrootObject(int delta); |
459 static inline int GetGcSubrootOrder(HeapObject* subroot); | 473 static inline int GetGcSubrootOrder(HeapObject* subroot); |
460 | 474 |
461 Heap* heap_; | 475 Heap* heap_; |
462 HeapSnapshot* snapshot_; | 476 HeapSnapshot* snapshot_; |
463 StringsStorage* names_; | 477 StringsStorage* names_; |
464 HeapObjectsMap* heap_object_map_; | 478 HeapObjectsMap* heap_object_map_; |
465 SnapshottingProgressReportingInterface* progress_; | 479 SnapshottingProgressReportingInterface* progress_; |
466 SnapshotFiller* filler_; | 480 SnapshotFiller* filler_; |
467 HeapObjectsSet objects_tags_; | 481 HeapObjectsSet objects_tags_; |
468 HeapObjectsSet strong_gc_subroot_names_; | 482 HeapObjectsSet strong_gc_subroot_names_; |
469 HeapObjectsSet user_roots_; | 483 HeapObjectsSet user_roots_; |
| 484 HeapObjectsSet weak_containers_; |
470 v8::HeapProfiler::ObjectNameResolver* global_object_name_resolver_; | 485 v8::HeapProfiler::ObjectNameResolver* global_object_name_resolver_; |
471 | 486 |
472 static HeapObject* const kGcRootsObject; | 487 static HeapObject* const kGcRootsObject; |
473 static HeapObject* const kFirstGcSubrootObject; | 488 static HeapObject* const kFirstGcSubrootObject; |
474 static HeapObject* const kLastGcSubrootObject; | 489 static HeapObject* const kLastGcSubrootObject; |
475 | 490 |
476 friend class IndexedReferencesExtractor; | 491 friend class IndexedReferencesExtractor; |
477 friend class GcSubrootsEnumerator; | 492 friend class GcSubrootsEnumerator; |
478 friend class RootsReferencesExtractor; | 493 friend class RootsReferencesExtractor; |
479 | 494 |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 friend class HeapSnapshotJSONSerializerEnumerator; | 637 friend class HeapSnapshotJSONSerializerEnumerator; |
623 friend class HeapSnapshotJSONSerializerIterator; | 638 friend class HeapSnapshotJSONSerializerIterator; |
624 | 639 |
625 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); | 640 DISALLOW_COPY_AND_ASSIGN(HeapSnapshotJSONSerializer); |
626 }; | 641 }; |
627 | 642 |
628 | 643 |
629 } } // namespace v8::internal | 644 } } // namespace v8::internal |
630 | 645 |
631 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ | 646 #endif // V8_HEAP_SNAPSHOT_GENERATOR_H_ |
OLD | NEW |