OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |