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

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: 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') | no next file » | 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_* version because when the
2466 // empty_*_array object itself is being processed all its inline properties
yurys 2012/04/20 13:08:40 The comment needs update.
alexeif 2012/04/20 13:33:50 Done.
2467 // are invalid and the check in empty_*_array() function would fail.
2468 return object->IsHeapObject()
2469 && !object->IsOddball()
2470 && object != heap_->raw_unchecked_empty_byte_array()
2471 && object != heap_->raw_unchecked_empty_fixed_array()
2472 && object != heap_->raw_unchecked_empty_descriptor_array()
2473 && object != heap_->raw_unchecked_fixed_array_map()
2474 && object != heap_->raw_unchecked_global_property_cell_map()
2475 && object != heap_->raw_unchecked_shared_function_info_map();
2476 }
2477
2478
2464 void V8HeapExplorer::SetClosureReference(HeapObject* parent_obj, 2479 void V8HeapExplorer::SetClosureReference(HeapObject* parent_obj,
2465 HeapEntry* parent_entry, 2480 HeapEntry* parent_entry,
2466 String* reference_name, 2481 String* reference_name,
2467 Object* child_obj) { 2482 Object* child_obj) {
2468 HeapEntry* child_entry = GetEntry(child_obj); 2483 HeapEntry* child_entry = GetEntry(child_obj);
2469 if (child_entry != NULL) { 2484 if (child_entry != NULL) {
2470 filler_->SetNamedReference(HeapGraphEdge::kContextVariable, 2485 filler_->SetNamedReference(HeapGraphEdge::kContextVariable,
2471 parent_obj, 2486 parent_obj,
2472 parent_entry, 2487 parent_entry,
2473 collection_->names()->GetName(reference_name), 2488 collection_->names()->GetName(reference_name),
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
2509 } 2524 }
2510 2525
2511 2526
2512 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj, 2527 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj,
2513 HeapEntry* parent_entry, 2528 HeapEntry* parent_entry,
2514 const char* reference_name, 2529 const char* reference_name,
2515 Object* child_obj, 2530 Object* child_obj,
2516 int field_offset) { 2531 int field_offset) {
2517 HeapEntry* child_entry = GetEntry(child_obj); 2532 HeapEntry* child_entry = GetEntry(child_obj);
2518 if (child_entry == NULL) return; 2533 if (child_entry == NULL) return;
2519 // We have to use raw_unchecked_* version because when the 2534 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, 2535 filler_->SetNamedReference(HeapGraphEdge::kInternal,
2524 parent_obj, parent_entry, 2536 parent_obj, parent_entry,
2525 reference_name, 2537 reference_name,
2526 child_obj, child_entry); 2538 child_obj, child_entry);
2527 } 2539 }
2528 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset); 2540 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
2529 } 2541 }
2530 2542
2531 2543
2532 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj, 2544 void V8HeapExplorer::SetInternalReference(HeapObject* parent_obj,
2533 HeapEntry* parent_entry, 2545 HeapEntry* parent_entry,
2534 int index, 2546 int index,
2535 Object* child_obj, 2547 Object* child_obj,
2536 int field_offset) { 2548 int field_offset) {
2537 HeapEntry* child_entry = GetEntry(child_obj); 2549 HeapEntry* child_entry = GetEntry(child_obj);
2538 if (child_entry == NULL) return; 2550 if (child_entry == NULL) return;
2539 // See the comment regarding raw_unchecked_* above. 2551 if (IsEssentialObject(child_obj)) {
2540 if (child_obj != heap_->raw_unchecked_empty_fixed_array()) {
2541 filler_->SetNamedReference(HeapGraphEdge::kInternal, 2552 filler_->SetNamedReference(HeapGraphEdge::kInternal,
2542 parent_obj, parent_entry, 2553 parent_obj, parent_entry,
2543 collection_->names()->GetName(index), 2554 collection_->names()->GetName(index),
2544 child_obj, child_entry); 2555 child_obj, child_entry);
2545 } 2556 }
2546 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset); 2557 IndexedReferencesExtractor::MarkVisitedField(parent_obj, field_offset);
2547 } 2558 }
2548 2559
2549 2560
2550 void V8HeapExplorer::SetHiddenReference(HeapObject* parent_obj, 2561 void V8HeapExplorer::SetHiddenReference(HeapObject* parent_obj,
2551 HeapEntry* parent_entry, 2562 HeapEntry* parent_entry,
2552 int index, 2563 int index,
2553 Object* child_obj) { 2564 Object* child_obj) {
2554 HeapEntry* child_entry = GetEntry(child_obj); 2565 HeapEntry* child_entry = GetEntry(child_obj);
2555 if (child_entry != NULL) { 2566 if (child_entry != NULL && IsEssentialObject(child_obj)) {
2556 filler_->SetIndexedReference(HeapGraphEdge::kHidden, 2567 filler_->SetIndexedReference(HeapGraphEdge::kHidden,
2557 parent_obj, 2568 parent_obj,
2558 parent_entry, 2569 parent_entry,
2559 index, 2570 index,
2560 child_obj, 2571 child_obj,
2561 child_entry); 2572 child_entry);
2562 } 2573 }
2563 } 2574 }
2564 2575
2565 2576
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
2685 SYMBOL_LIST(SYMBOL_NAME) 2696 SYMBOL_LIST(SYMBOL_NAME)
2686 #undef SYMBOL_NAME 2697 #undef SYMBOL_NAME
2687 #undef NAME_ENTRY 2698 #undef NAME_ENTRY
2688 CHECK(!strong_gc_subroot_names_.is_empty()); 2699 CHECK(!strong_gc_subroot_names_.is_empty());
2689 } 2700 }
2690 return strong_gc_subroot_names_.GetTag(object); 2701 return strong_gc_subroot_names_.GetTag(object);
2691 } 2702 }
2692 2703
2693 2704
2694 void V8HeapExplorer::TagObject(Object* obj, const char* tag) { 2705 void V8HeapExplorer::TagObject(Object* obj, const char* tag) {
2695 if (obj->IsHeapObject() && 2706 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); 2707 objects_tags_.SetTag(obj, tag);
2701 } 2708 }
2702 } 2709 }
2703 2710
2704 2711
2705 class GlobalObjectsEnumerator : public ObjectVisitor { 2712 class GlobalObjectsEnumerator : public ObjectVisitor {
2706 public: 2713 public:
2707 virtual void VisitPointers(Object** start, Object** end) { 2714 virtual void VisitPointers(Object** start, Object** end) {
2708 for (Object** p = start; p < end; p++) { 2715 for (Object** p = start; p < end; p++) {
2709 if ((*p)->IsGlobalContext()) { 2716 if ((*p)->IsGlobalContext()) {
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after
3929 3936
3930 3937
3931 void HeapSnapshotJSONSerializer::SortHashMap( 3938 void HeapSnapshotJSONSerializer::SortHashMap(
3932 HashMap* map, List<HashMap::Entry*>* sorted_entries) { 3939 HashMap* map, List<HashMap::Entry*>* sorted_entries) {
3933 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p)) 3940 for (HashMap::Entry* p = map->Start(); p != NULL; p = map->Next(p))
3934 sorted_entries->Add(p); 3941 sorted_entries->Add(p);
3935 sorted_entries->Sort(SortUsingEntryValue); 3942 sorted_entries->Sort(SortUsingEntryValue);
3936 } 3943 }
3937 3944
3938 } } // namespace v8::internal 3945 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/profile-generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698