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