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

Side by Side Diff: src/heap-snapshot-generator.cc

Issue 136113007: Mark next_code_link as weak in heap profiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 11 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 | « no previous file | test/cctest/test-heap-profiler.cc » ('j') | test/cctest/test-heap-profiler.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 parent_(parent), 985 parent_(parent),
986 next_index_(0) { 986 next_index_(0) {
987 } 987 }
988 void VisitCodeEntry(Address entry_address) { 988 void VisitCodeEntry(Address entry_address) {
989 Code* code = Code::cast(Code::GetObjectFromEntryAddress(entry_address)); 989 Code* code = Code::cast(Code::GetObjectFromEntryAddress(entry_address));
990 generator_->SetInternalReference(parent_obj_, parent_, "code", code); 990 generator_->SetInternalReference(parent_obj_, parent_, "code", code);
991 generator_->TagCodeObject(code); 991 generator_->TagCodeObject(code);
992 } 992 }
993 void VisitPointers(Object** start, Object** end) { 993 void VisitPointers(Object** start, Object** end) {
994 for (Object** p = start; p < end; p++) { 994 for (Object** p = start; p < end; p++) {
995 ++next_index_;
995 if (CheckVisitedAndUnmark(p)) continue; 996 if (CheckVisitedAndUnmark(p)) continue;
996 generator_->SetHiddenReference(parent_obj_, parent_, next_index_++, *p); 997 generator_->SetHiddenReference(parent_obj_, parent_, next_index_, *p);
997 } 998 }
998 } 999 }
999 static void MarkVisitedField(HeapObject* obj, int offset) { 1000 static void MarkVisitedField(HeapObject* obj, int offset) {
1000 if (offset < 0) return; 1001 if (offset < 0) return;
1001 Address field = obj->address() + offset; 1002 Address field = obj->address() + offset;
1002 ASSERT(!Memory::Object_at(field)->IsFailure()); 1003 ASSERT(!Memory::Object_at(field)->IsFailure());
1003 ASSERT(Memory::Object_at(field)->IsHeapObject()); 1004 ASSERT(Memory::Object_at(field)->IsHeapObject());
1004 *field |= kFailureTag; 1005 *field |= kFailureTag;
1005 } 1006 }
1006 1007
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
1396 SetInternalReference(code, entry, 1397 SetInternalReference(code, entry,
1397 "type_feedback_info", code->type_feedback_info(), 1398 "type_feedback_info", code->type_feedback_info(),
1398 Code::kTypeFeedbackInfoOffset); 1399 Code::kTypeFeedbackInfoOffset);
1399 } 1400 }
1400 SetInternalReference(code, entry, 1401 SetInternalReference(code, entry,
1401 "gc_metadata", code->gc_metadata(), 1402 "gc_metadata", code->gc_metadata(),
1402 Code::kGCMetadataOffset); 1403 Code::kGCMetadataOffset);
1403 SetInternalReference(code, entry, 1404 SetInternalReference(code, entry,
1404 "constant_pool", code->constant_pool(), 1405 "constant_pool", code->constant_pool(),
1405 Code::kConstantPoolOffset); 1406 Code::kConstantPoolOffset);
1407 if (code->kind() == Code::OPTIMIZED_FUNCTION) {
1408 SetWeakReference(code, entry,
1409 "next_code_link", code->next_code_link(),
1410 Code::kNextCodeLinkOffset);
1411 }
1406 } 1412 }
1407 1413
1408 1414
1409 void V8HeapExplorer::ExtractCellReferences(int entry, Cell* cell) { 1415 void V8HeapExplorer::ExtractCellReferences(int entry, Cell* cell) {
1410 SetInternalReference(cell, entry, "value", cell->value(), Cell::kValueOffset); 1416 SetInternalReference(cell, entry, "value", cell->value(), Cell::kValueOffset);
1411 } 1417 }
1412 1418
1413 1419
1414 void V8HeapExplorer::ExtractPropertyCellReferences(int entry, 1420 void V8HeapExplorer::ExtractPropertyCellReferences(int entry,
1415 PropertyCell* cell) { 1421 PropertyCell* cell) {
1416 ExtractCellReferences(entry, cell); 1422 ExtractCellReferences(entry, cell);
1417 SetInternalReference(cell, entry, "type", cell->type(), 1423 SetInternalReference(cell, entry, "type", cell->type(),
1418 PropertyCell::kTypeOffset); 1424 PropertyCell::kTypeOffset);
1419 SetInternalReference(cell, entry, "dependent_code", cell->dependent_code(), 1425 SetInternalReference(cell, entry, "dependent_code", cell->dependent_code(),
1420 PropertyCell::kDependentCodeOffset); 1426 PropertyCell::kDependentCodeOffset);
1421 } 1427 }
1422 1428
1423 1429
1424 void V8HeapExplorer::ExtractAllocationSiteReferences(int entry, 1430 void V8HeapExplorer::ExtractAllocationSiteReferences(int entry,
1425 AllocationSite* site) { 1431 AllocationSite* site) {
1426 SetInternalReference(site, entry, "transition_info", site->transition_info(), 1432 SetInternalReference(site, entry, "transition_info", site->transition_info(),
1427 AllocationSite::kTransitionInfoOffset); 1433 AllocationSite::kTransitionInfoOffset);
1428 SetInternalReference(site, entry, "nested_site", site->nested_site(), 1434 SetInternalReference(site, entry, "nested_site", site->nested_site(),
1429 AllocationSite::kNestedSiteOffset); 1435 AllocationSite::kNestedSiteOffset);
1430 SetInternalReference(site, entry, "pretenure_data",
1431 site->pretenure_data(),
1432 AllocationSite::kPretenureDataOffset);
1433 SetInternalReference(site, entry, "pretenure_create_count",
1434 site->pretenure_create_count(),
1435 AllocationSite::kPretenureCreateCountOffset);
1436 SetInternalReference(site, entry, "dependent_code", site->dependent_code(), 1436 SetInternalReference(site, entry, "dependent_code", site->dependent_code(),
1437 AllocationSite::kDependentCodeOffset); 1437 AllocationSite::kDependentCodeOffset);
1438 // Do not visit weak_next as it is not visited by the StaticVisitor,
1439 // and we're not very interested in weak_next field here.
1440 STATIC_CHECK(AllocationSite::kWeakNextOffset >=
1441 AllocationSite::BodyDescriptor::kEndOffset);
1438 } 1442 }
1439 1443
1440 1444
1441 void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj, int entry) { 1445 void V8HeapExplorer::ExtractClosureReferences(JSObject* js_obj, int entry) {
1442 if (!js_obj->IsJSFunction()) return; 1446 if (!js_obj->IsJSFunction()) return;
1443 1447
1444 JSFunction* func = JSFunction::cast(js_obj); 1448 JSFunction* func = JSFunction::cast(js_obj);
1445 if (func->shared()->bound()) { 1449 if (func->shared()->bound()) {
1446 FixedArray* bindings = func->function_bindings(); 1450 FixedArray* bindings = func->function_bindings();
1447 SetNativeBindReference(js_obj, entry, "bound_this", 1451 SetNativeBindReference(js_obj, entry, "bound_this",
(...skipping 1536 matching lines...) Expand 10 before | Expand all | Expand 10 after
2984 writer_->AddString("\"<dummy>\""); 2988 writer_->AddString("\"<dummy>\"");
2985 for (int i = 1; i < sorted_strings.length(); ++i) { 2989 for (int i = 1; i < sorted_strings.length(); ++i) {
2986 writer_->AddCharacter(','); 2990 writer_->AddCharacter(',');
2987 SerializeString(sorted_strings[i]); 2991 SerializeString(sorted_strings[i]);
2988 if (writer_->aborted()) return; 2992 if (writer_->aborted()) return;
2989 } 2993 }
2990 } 2994 }
2991 2995
2992 2996
2993 } } // namespace v8::internal 2997 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | test/cctest/test-heap-profiler.cc » ('j') | test/cctest/test-heap-profiler.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698