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

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

Issue 2915793002: [api] Prototype WeakRef implementation
Patch Set: Created 3 years, 6 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/heap/object-stats.h ('k') | src/heap/objects-visiting.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 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/assembler-inl.h" 7 #include "src/assembler-inl.h"
8 #include "src/compilation-cache.h" 8 #include "src/compilation-cache.h"
9 #include "src/counters.h" 9 #include "src/counters.h"
10 #include "src/heap/heap-inl.h" 10 #include "src/heap/heap-inl.h"
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 void ObjectStatsCollector::RecordJSWeakCollectionDetails( 422 void ObjectStatsCollector::RecordJSWeakCollectionDetails(
423 JSWeakCollection* obj) { 423 JSWeakCollection* obj) {
424 if (obj->table()->IsHashTable()) { 424 if (obj->table()->IsHashTable()) {
425 ObjectHashTable* table = ObjectHashTable::cast(obj->table()); 425 ObjectHashTable* table = ObjectHashTable::cast(obj->table());
426 int used = table->NumberOfElements() * ObjectHashTable::kEntrySize; 426 int used = table->NumberOfElements() * ObjectHashTable::kEntrySize;
427 size_t overhead = table->Size() - used; 427 size_t overhead = table->Size() - used;
428 RecordFixedArrayHelper(obj, table, JS_WEAK_COLLECTION_SUB_TYPE, overhead); 428 RecordFixedArrayHelper(obj, table, JS_WEAK_COLLECTION_SUB_TYPE, overhead);
429 } 429 }
430 } 430 }
431 431
432 void ObjectStatsCollector::RecordJSWeakRefDetails(
433 JSWeakRef* obj) {
434 if (obj->executor() != nullptr) {
435 RecordJSFunctionDetails(obj->executor());
436 }
437 if (obj->holdings() != nullptr && obj->holdings()->IsObject()) {
438 // RecordObjectStats(obj->holdings());
439 }
440 WeakCell* cell = obj->target();
441 if (cell->cleared() != true && cell->value()->IsObject()) {
442 RecordJSObjectDetails(static_cast<JSObject*>(cell->value()));
443 }
444 }
445
432 void ObjectStatsCollector::RecordJSCollectionDetails(JSObject* obj) { 446 void ObjectStatsCollector::RecordJSCollectionDetails(JSObject* obj) {
433 // The JS versions use a different HashTable implementation that cannot use 447 // The JS versions use a different HashTable implementation that cannot use
434 // the regular helper. Since overall impact is usually small just record 448 // the regular helper. Since overall impact is usually small just record
435 // without overhead. 449 // without overhead.
436 if (obj->IsJSMap()) { 450 if (obj->IsJSMap()) {
437 RecordFixedArrayHelper(nullptr, FixedArray::cast(JSMap::cast(obj)->table()), 451 RecordFixedArrayHelper(nullptr, FixedArray::cast(JSMap::cast(obj)->table()),
438 JS_COLLECTION_SUB_TYPE, 0); 452 JS_COLLECTION_SUB_TYPE, 0);
439 } 453 }
440 if (obj->IsJSSet()) { 454 if (obj->IsJSSet()) {
441 RecordFixedArrayHelper(nullptr, FixedArray::cast(JSSet::cast(obj)->table()), 455 RecordFixedArrayHelper(nullptr, FixedArray::cast(JSSet::cast(obj)->table()),
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 SLOW_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE); 594 SLOW_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE);
581 FixedArray* fast_cache = native_ctx->fast_template_instantiations_cache(); 595 FixedArray* fast_cache = native_ctx->fast_template_instantiations_cache();
582 stats_->RecordFixedArraySubTypeStats( 596 stats_->RecordFixedArraySubTypeStats(
583 fast_cache, FAST_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE, 597 fast_cache, FAST_TEMPLATE_INSTANTIATIONS_CACHE_SUB_TYPE,
584 fast_cache->Size(), 0); 598 fast_cache->Size(), 0);
585 } 599 }
586 } 600 }
587 601
588 } // namespace internal 602 } // namespace internal
589 } // namespace v8 603 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/object-stats.h ('k') | src/heap/objects-visiting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698