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

Side by Side Diff: src/heap-profiler.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 | « no previous file | src/profile-generator.h » ('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 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 number_and_size.increment_number(1); 104 number_and_size.increment_number(1);
105 number_and_size.increment_bytes(size); 105 number_and_size.increment_bytes(size);
106 loc.set_value(number_and_size); 106 loc.set_value(number_and_size);
107 } 107 }
108 108
109 109
110 int Clusterizer::CalculateNetworkSize(JSObject* obj) { 110 int Clusterizer::CalculateNetworkSize(JSObject* obj) {
111 int size = obj->Size(); 111 int size = obj->Size();
112 // If 'properties' and 'elements' are non-empty (thus, non-shared), 112 // If 'properties' and 'elements' are non-empty (thus, non-shared),
113 // take their size into account. 113 // take their size into account.
114 if (FixedArray::cast(obj->properties())->length() != 0) { 114 if (obj->properties() != Heap::empty_fixed_array()) {
115 size += obj->properties()->Size(); 115 size += obj->properties()->Size();
116 } 116 }
117 if (FixedArray::cast(obj->elements())->length() != 0) { 117 if (obj->elements() != Heap::empty_fixed_array()) {
118 size += obj->elements()->Size(); 118 size += obj->elements()->Size();
119 } 119 }
120 // For functions, also account non-empty context and literals sizes. 120 // For functions, also account non-empty context and literals sizes.
121 if (obj->IsJSFunction()) { 121 if (obj->IsJSFunction()) {
122 JSFunction* f = JSFunction::cast(obj); 122 JSFunction* f = JSFunction::cast(obj);
123 if (f->unchecked_context()->IsContext()) { 123 if (f->unchecked_context()->IsContext()) {
124 size += f->context()->Size(); 124 size += f->context()->Size();
125 } 125 }
126 if (f->literals()->length() != 0) { 126 if (f->literals()->length() != 0) {
127 size += f->literals()->Size(); 127 size += f->literals()->Size();
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
770 GlobalHandles::MakeWeak(handle.location(), 770 GlobalHandles::MakeWeak(handle.location(),
771 static_cast<void*>(stack.start()), 771 static_cast<void*>(stack.start()),
772 StackWeakReferenceCallback); 772 StackWeakReferenceCallback);
773 } 773 }
774 774
775 775
776 #endif // ENABLE_LOGGING_AND_PROFILING 776 #endif // ENABLE_LOGGING_AND_PROFILING
777 777
778 778
779 } } // namespace v8::internal 779 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/profile-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698