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

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

Issue 3128004: Fix issue 822: handling of JSObject::elements in CalculateNetworkSize. (Closed)
Patch Set: Created 10 years, 4 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
« 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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 int HeapSnapshot::GetObjectSize(HeapObject* obj) { 1372 int HeapSnapshot::GetObjectSize(HeapObject* obj) {
1373 return obj->IsJSObject() ? 1373 return obj->IsJSObject() ?
1374 CalculateNetworkSize(JSObject::cast(obj)) : obj->Size(); 1374 CalculateNetworkSize(JSObject::cast(obj)) : obj->Size();
1375 } 1375 }
1376 1376
1377 1377
1378 int HeapSnapshot::CalculateNetworkSize(JSObject* obj) { 1378 int HeapSnapshot::CalculateNetworkSize(JSObject* obj) {
1379 int size = obj->Size(); 1379 int size = obj->Size();
1380 // If 'properties' and 'elements' are non-empty (thus, non-shared), 1380 // If 'properties' and 'elements' are non-empty (thus, non-shared),
1381 // take their size into account. 1381 // take their size into account.
1382 if (FixedArray::cast(obj->properties())->length() != 0) { 1382 if (obj->properties() != Heap::empty_fixed_array()) {
1383 size += obj->properties()->Size(); 1383 size += obj->properties()->Size();
1384 } 1384 }
1385 if (FixedArray::cast(obj->elements())->length() != 0) { 1385 if (obj->elements() != Heap::empty_fixed_array()) {
1386 size += obj->elements()->Size(); 1386 size += obj->elements()->Size();
1387 } 1387 }
1388 // For functions, also account non-empty context and literals sizes. 1388 // For functions, also account non-empty context and literals sizes.
1389 if (obj->IsJSFunction()) { 1389 if (obj->IsJSFunction()) {
1390 JSFunction* f = JSFunction::cast(obj); 1390 JSFunction* f = JSFunction::cast(obj);
1391 if (f->unchecked_context()->IsContext()) { 1391 if (f->unchecked_context()->IsContext()) {
1392 size += f->context()->Size(); 1392 size += f->context()->Size();
1393 } 1393 }
1394 if (f->literals()->length() != 0) { 1394 if (f->literals()->length() != 0) {
1395 size += f->literals()->Size(); 1395 size += f->literals()->Size();
(...skipping 735 matching lines...) Expand 10 before | Expand all | Expand 10 after
2131 HeapEntry* entry = added_entries[i]; 2131 HeapEntry* entry = added_entries[i];
2132 if (entry->painted_reachable()) 2132 if (entry->painted_reachable())
2133 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry); 2133 diff->AddAddedEntry(add_child_index++, added_entry_index++, entry);
2134 } 2134 }
2135 return diff; 2135 return diff;
2136 } 2136 }
2137 2137
2138 } } // namespace v8::internal 2138 } } // namespace v8::internal
2139 2139
2140 #endif // ENABLE_LOGGING_AND_PROFILING 2140 #endif // ENABLE_LOGGING_AND_PROFILING
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