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

Side by Side Diff: src/heap/object-stats.cc

Issue 2190563002: [heap] ObjectStats: Fixes for recording HashTable overhead (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fixes Created 4 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 | 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/heap/object-stats.h" 5 #include "src/heap/object-stats.h"
6 6
7 #include "src/counters.h" 7 #include "src/counters.h"
8 #include "src/heap/heap-inl.h" 8 #include "src/heap/heap-inl.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "src/macro-assembler.h" 10 #include "src/macro-assembler.h"
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 parent, FixedArray::cast(array->get(i)), subtype); 265 parent, FixedArray::cast(array->get(i)), subtype);
266 } 266 }
267 } 267 }
268 } 268 }
269 } 269 }
270 270
271 template <class HashTable> 271 template <class HashTable>
272 void ObjectStatsCollector::RecordHashTableHelper(HeapObject* parent, 272 void ObjectStatsCollector::RecordHashTableHelper(HeapObject* parent,
273 HashTable* array, 273 HashTable* array,
274 int subtype) { 274 int subtype) {
275 int used = array->NumberOfElements() * HashTable::kEntrySize; 275 int used = array->NumberOfElements() * HashTable::kEntrySize * kPointerSize;
276 CHECK_GE(array->Size(), used); 276 CHECK_GE(array->Size(), used);
277 size_t overhead = array->Size() - used - 277 size_t overhead = array->Size() - used -
278 HashTable::kElementsStartIndex * kPointerSize - 278 HashTable::kElementsStartIndex * kPointerSize -
279 FixedArray::kHeaderSize; 279 FixedArray::kHeaderSize;
280 RecordFixedArrayHelper(parent, array, subtype, overhead); 280 RecordFixedArrayHelper(parent, array, subtype, overhead);
281 } 281 }
282 282
283 void ObjectStatsCollector::RecordJSObjectDetails(JSObject* object) { 283 void ObjectStatsCollector::RecordJSObjectDetails(JSObject* object) {
284 size_t overhead = 0; 284 size_t overhead = 0;
285 FixedArrayBase* elements = object->elements(); 285 FixedArrayBase* elements = object->elements();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 } 404 }
405 405
406 void ObjectStatsCollector::RecordSharedFunctionInfoDetails( 406 void ObjectStatsCollector::RecordSharedFunctionInfoDetails(
407 SharedFunctionInfo* sfi) { 407 SharedFunctionInfo* sfi) {
408 FixedArray* scope_info = sfi->scope_info(); 408 FixedArray* scope_info = sfi->scope_info();
409 RecordFixedArrayHelper(sfi, scope_info, SCOPE_INFO_SUB_TYPE, 0); 409 RecordFixedArrayHelper(sfi, scope_info, SCOPE_INFO_SUB_TYPE, 0);
410 TypeFeedbackMetadata* feedback_metadata = sfi->feedback_metadata(); 410 TypeFeedbackMetadata* feedback_metadata = sfi->feedback_metadata();
411 if (!feedback_metadata->is_empty()) { 411 if (!feedback_metadata->is_empty()) {
412 RecordFixedArrayHelper(sfi, feedback_metadata, 412 RecordFixedArrayHelper(sfi, feedback_metadata,
413 TYPE_FEEDBACK_METADATA_SUB_TYPE, 0); 413 TYPE_FEEDBACK_METADATA_SUB_TYPE, 0);
414 UnseededNumberDictionary* names = UnseededNumberDictionary::cast( 414 Object* names =
415 feedback_metadata->get(TypeFeedbackMetadata::kNamesTableIndex)); 415 feedback_metadata->get(TypeFeedbackMetadata::kNamesTableIndex);
416 RecordHashTableHelper(sfi, names, TYPE_FEEDBACK_METADATA_SUB_TYPE); 416 if (!names->IsSmi()) {
417 UnseededNumberDictionary* names = UnseededNumberDictionary::cast(
418 feedback_metadata->get(TypeFeedbackMetadata::kNamesTableIndex));
419 RecordHashTableHelper(sfi, names, TYPE_FEEDBACK_METADATA_SUB_TYPE);
420 }
417 } 421 }
418 422
419 if (!sfi->OptimizedCodeMapIsCleared()) { 423 if (!sfi->OptimizedCodeMapIsCleared()) {
420 FixedArray* optimized_code_map = sfi->optimized_code_map(); 424 FixedArray* optimized_code_map = sfi->optimized_code_map();
421 RecordFixedArrayHelper(sfi, optimized_code_map, OPTIMIZED_CODE_MAP_SUB_TYPE, 425 RecordFixedArrayHelper(sfi, optimized_code_map, OPTIMIZED_CODE_MAP_SUB_TYPE,
422 0); 426 0);
423 // Optimized code map should be small, so skip accounting. 427 // Optimized code map should be small, so skip accounting.
424 int len = optimized_code_map->length(); 428 int len = optimized_code_map->length();
425 for (int i = SharedFunctionInfo::kEntriesStart; i < len; 429 for (int i = SharedFunctionInfo::kEntriesStart; i < len;
426 i += SharedFunctionInfo::kEntryLength) { 430 i += SharedFunctionInfo::kEntryLength) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 } 465 }
462 if (array->IsNativeContext()) { 466 if (array->IsNativeContext()) {
463 Context* native_ctx = Context::cast(array); 467 Context* native_ctx = Context::cast(array);
464 RecordHashTableHelper(array, native_ctx->template_instantiations_cache(), 468 RecordHashTableHelper(array, native_ctx->template_instantiations_cache(),
465 TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE); 469 TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE);
466 } 470 }
467 } 471 }
468 472
469 } // namespace internal 473 } // namespace internal
470 } // namespace v8 474 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698