[heap-stats] Log on- and off-heap script sources
Special case script logging to also log the source of the script, even if that source is off-heap in an external string. Bug: v8:7266 Change-Id: I0d35f94f7b27d0d793d1a1a3fb8d3280960b253d Reviewed-on: https://chromium-review.googlesource.com/899344 Commit-Queue: Leszek Swirski <leszeks@chromium.org> Reviewed-by: Michael Lippautz <mlippautz@chromium.org> Cr-Commit-Position: refs/heads/master@{#51076}
This commit is contained in:
parent
47e272b206
commit
184ccebedb
@ -650,6 +650,27 @@ void ObjectStatsCollectorImpl::RecordVirtualScriptDetails(Script* script) {
|
||||
ObjectStats::SCRIPT_SHARED_FUNCTION_INFOS_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
// Log the size of external source code.
|
||||
Object* source = script->source();
|
||||
if (source->IsExternalString()) {
|
||||
// The contents of external strings aren't on the heap, so we have to record
|
||||
// them manually.
|
||||
ExternalString* external_source_string = ExternalString::cast(source);
|
||||
size_t length_multiplier = external_source_string->IsTwoByteRepresentation()
|
||||
? kShortSize
|
||||
: kCharSize;
|
||||
size_t off_heap_size = external_source_string->length() * length_multiplier;
|
||||
size_t on_heap_size = external_source_string->Size();
|
||||
RecordVirtualObjectStats(script, external_source_string,
|
||||
ObjectStats::SCRIPT_SOURCE_EXTERNAL_TYPE,
|
||||
on_heap_size + off_heap_size,
|
||||
ObjectStats::kNoOverAllocation);
|
||||
} else if (source->IsHeapObject()) {
|
||||
RecordSimpleVirtualObjectStats(
|
||||
script, HeapObject::cast(source),
|
||||
ObjectStats::SCRIPT_SOURCE_NON_EXTERNAL_TYPE);
|
||||
}
|
||||
}
|
||||
|
||||
void ObjectStatsCollectorImpl::RecordVirtualSharedFunctionInfoDetails(
|
||||
|
@ -60,6 +60,8 @@
|
||||
V(SCOPE_INFO_TYPE) \
|
||||
V(SCRIPT_LIST_TYPE) \
|
||||
V(SCRIPT_SHARED_FUNCTION_INFOS_TYPE) \
|
||||
V(SCRIPT_SOURCE_EXTERNAL_TYPE) \
|
||||
V(SCRIPT_SOURCE_NON_EXTERNAL_TYPE) \
|
||||
V(SERIALIZED_OBJECTS_TYPE) \
|
||||
V(SINGLE_CHARACTER_STRING_CACHE_TYPE) \
|
||||
V(STRING_SPLIT_CACHE_TYPE) \
|
||||
|
@ -158,6 +158,8 @@ const CATEGORIES = new Map([
|
||||
'LOAD_HANDLER_TYPE',
|
||||
'NOSCRIPT_SHARED_FUNCTION_INFOS_TYPE',
|
||||
'OPTIMIZED_CODE_LITERALS_TYPE',
|
||||
'SCRIPT_SOURCE_EXTERNAL_TYPE',
|
||||
'SCRIPT_SOURCE_NON_EXTERNAL_TYPE',
|
||||
'SCRIPT_TYPE',
|
||||
'SHARED_FUNCTION_INFO_TYPE',
|
||||
'STORE_HANDLER_TYPE',
|
||||
|
Loading…
Reference in New Issue
Block a user