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

Side by Side Diff: src/profile-generator.cc

Issue 10162005: Eliminate internal and hidden links to oddballs and other non-essential objects in heap snapshot. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressing comments. Created 8 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-heap-profiler.cc » ('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 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 2443 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 if (object->IsJSGlobalObject()) { 2454 if (object->IsJSGlobalObject()) {
2455 const char* tag = objects_tags_.GetTag(object); 2455 const char* tag = objects_tags_.GetTag(object);
2456 if (tag != NULL) { 2456 if (tag != NULL) {
2457 name = collection_->names()->GetFormatted("%s / %s", name, tag); 2457 name = collection_->names()->GetFormatted("%s / %s", name, tag);
2458 } 2458 }
2459 } 2459 }
2460 GetEntry(object)->set_name(name); 2460 GetEntry(object)->set_name(name);
2461 } 2461 }
2462 2462
2463 2463
2464 bool V8HeapExplorer::IsEssentialObject(Object* object) {
2465 // We have to use raw_unchecked_* versions because checked versions
2466 // would fail during iteration over object properties.
2467 return object->IsHeapObject()
2468 && !object->IsOddball()
2469 && object != heap_->raw_unchecked_empty_byte_array()
2470 && object != heap_->raw_unchecked_empty_fixed_array()
2471 && object != heap_->raw_unchecked_empty_descriptor_array()
2472 && object != heap_->raw_unchecked_fixed_array_map()
2473 && object != heap_->raw_unchecked_global_property_cell_map()
2474 && object != heap_->raw_unchecked_shared_function_info_map();
2475 }
2476
2477
2464 void V8HeapExplorer::SetClosureReference(HeapObject* parent_obj, 2478 void V8HeapExplorer::SetClosureReference(HeapObject* parent_obj,
2465 HeapEntry* parent_entry, 2479 HeapEntry* parent_entry,
2466 String* reference_name, 2480 String* reference_name,
2467 Object* child_obj) { 2481 Object* child_obj) {
2468 HeapEntry* child_entry = GetEntry(child_obj); 2482 HeapEntry* child_entry = GetEntry(child_obj);
2469 if (child_entry != NULL) { 2483 if (child_entry != NULL) {
2470 filler_->SetNamedReference(HeapGraphEdge::kContextVariable, 2484 filler_->SetNamedReference(HeapGraphEdge::kContextVariable,
2471 parent_obj, 2485 parent_obj,
2472 parent_entry, 2486 parent_entry,
2473 collection_->names()->GetName(reference_name), 2487 collection_->names()->GetName(reference_name),
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2509 } 2523 }
2510 2524
2511 2525
2512 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj, 2526 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj,
2513 HeapEntry* parent_entry, 2527 HeapEntry* parent_entry,
2514 const char* reference_name, 2528 const char* reference_name,
2515 Object* child_obj, 2529 Object* child_obj,
2516 int field_offset) { 2530 int field_offset) {
2517 HeapEntry* child_entry = GetEntry(child_obj); 2531 HeapEntry* child_entry = GetEntry(child_obj);
2518 if (child_entry == NULL) return; 2532 if (child_entry == NULL) return;
2519 // We have to use raw_unchecked_* version because when the 2533 if (IsEssentialObject(child_obj)) {
2520 // empty_fixed_array itself is being processed all its inline properties
2521 // are invalid and the check in empty_fixed_array() function fails.
2522 if (child_obj != heap_->raw_unchecked_empty_fixed_array()) {
2523 filler_->SetNamedReference(HeapGraphEdge::kInternal, 2534 filler_->SetNamedReference(HeapGraphEdge::kInternal,
2524 parent_obj, parent_entry, 2535 parent_obj, parent_entry,
2525 reference_name, 2536 reference_name,
2526 child_obj, child_entry); 2537 child_obj, child_entry);
2527 } 2538 }
2528 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset); 2539 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
2529 } 2540 }
2530 2541
2531 2542
2532 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj, 2543 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj,
2533 HeapEntry* parent_entry, 2544 HeapEntry* parent_entry,
2534 int index, 2545 int index,
2535 Object* child_obj, 2546 Object* child_obj,
2536 int field_offset) { 2547 int field_offset) {
2537 HeapEntry* child_entry = GetEntry(child_obj); 2548 HeapEntry* child_entry = GetEntry(child_obj);
2538 if (child_entry == NULL) return; 2549 if (child_entry == NULL) return;
2539 // See the comment regarding raw_unchecked_* above. 2550 if (IsEssentialObject(child_obj)) {
2540 if (child_obj != heap_->raw_unchecked_empty_fixed_array()) {
2541 filler_->SetNamedReference(HeapGraphEdge::kInternal, 2551 filler_->SetNamedReference(HeapGraphEdge::kInternal,
2542 parent_obj, parent_entry, 2552 parent_obj, parent_entry,
2543 collection_->names()->GetName(index), 2553 collection_->names()->GetName(index),
2544 child_obj, child_entry); 2554 child_obj, child_entry);
2545 } 2555 }
2546 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset); 2556 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
2547 } 2557 }
2548 2558
2549 2559
2550 void V8HeapExplorer::SetHiddenReference(HeapObject* parent_obj, 2560 void V8HeapExplorer::SetHiddenReference(HeapObject* parent_obj,
2551 HeapEntry* parent_entry, 2561 HeapEntry* parent_entry,
2552 int index, 2562 int index,
2553 Object* child_obj) { 2563 Object* child_obj) {
2554 HeapEntry* child_entry = GetEntry(child_obj); 2564 HeapEntry* child_entry = GetEntry(child_obj);
2555 if (child_entry != NULL) { 2565 if (child_entry != NULL && IsEssentialObject(child_obj)) {
2556 filler_->SetIndexedReference(HeapGraphEdge::kHidden, 2566 filler_->SetIndexedReference(HeapGraphEdge::kHidden,
2557 parent_obj, 2567 parent_obj,
2558 parent_entry, 2568 parent_entry,
2559 index, 2569 index,
2560 child_obj, 2570 child_obj,
2561 child_entry); 2571 child_entry);
2562 } 2572 }
2563 } 2573 }
2564 2574
2565 2575
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 SYMBOL_LIST(SYMBOL_NAME) 2695 SYMBOL_LIST(SYMBOL_NAME)
2686 #undef SYMBOL_NAME 2696 #undef SYMBOL_NAME
2687 #undef NAME_ENTRY 2697 #undef NAME_ENTRY
2688 CHECK(!strong_gc_subroot_names_.is_empty()); 2698 CHECK(!strong_gc_subroot_names_.is_empty());
2689 } 2699 }
2690 return strong_gc_subroot_names_.GetTag(object); 2700 return strong_gc_subroot_names_.GetTag(object);
2691 } 2701 }
2692 2702
2693 2703
2694 void V8HeapExplorer::TagObject(Object* obj, const char* tag) { 2704 void V8HeapExplorer::TagObject(Object* obj, const char* tag) {
2695 if (obj->IsHeapObject() && 2705 if (IsEssentialObject(obj)) {
2696 !obj->IsOddball() &&
2697 obj != heap_->raw_unchecked_empty_byte_array() &&
2698 obj != heap_->raw_unchecked_empty_fixed_array() &&
2699 obj != heap_->raw_unchecked_empty_descriptor_array()) {
2700 objects_tags_.SetTag(obj, tag); 2706 objects_tags_.SetTag(obj, tag);
2701 } 2707 }
2702 } 2708 }
2703 2709
2704 2710
2705 class GlobalObjectsEnumerator : public ObjectVisitor { 2711 class GlobalObjectsEnumerator : public ObjectVisitor {
2706 public: 2712 public:
2707 virtual void VisitPointers(Object** start, Object** end) { 2713 virtual void VisitPointers(Object** start, Object** end) {
2708 for (Object** p = start; p < end; p++) { 2714 for (Object** p = start; p < end; p++) {
2709 if ((*p)->IsGlobalContext()) { 2715 if ((*p)->IsGlobalContext()) {
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
3929 3935
3930 3936
3931 void HeapSnapshotJSONSerializer::SortHashMap( 3937 void HeapSnapshotJSONSerializer::SortHashMap(
3932 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3938 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3933 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3939 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3934 sorted_entries->Add(p); 3940 sorted_entries->Add(p);
3935 sorted_entries->Sort(SortUsingEntryValue); 3941 sorted_entries->Sort(SortUsingEntryValue);
3936 } 3942 }
3937 3943
3938 } } // namespace v8::internal 3944 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | test/cctest/test-heap-profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698