Commit 72d768d1 authored by rmcilroy's avatar rmcilroy Committed by Commit bot

Add counters to trace baseline code size.

BUG=v8:4280
LOG=N

Review URL: https://codereview.chromium.org/1649743002

Cr-Commit-Position: refs/heads/master@{#33688}
parent 44ec23ac
......@@ -727,7 +727,6 @@ static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
}
}
static bool CompileUnoptimizedCode(CompilationInfo* info) {
DCHECK(AllowCompilation::IsAllowed(info->isolate()));
if (!Compiler::Analyze(info->parse_info()) ||
......@@ -756,13 +755,39 @@ static bool UseIgnition(CompilationInfo* info) {
return info->closure()->PassesFilter(FLAG_ignition_filter);
}
static int CodeAndMetadataSize(CompilationInfo* info) {
int size = 0;
if (info->has_bytecode_array()) {
Handle<BytecodeArray> bytecode_array = info->bytecode_array();
size += bytecode_array->BytecodeArraySize();
size += bytecode_array->constant_pool()->Size();
size += bytecode_array->handler_table()->Size();
size += bytecode_array->source_position_table()->Size();
} else {
Handle<Code> code = info->code();
size += code->CodeSize();
size += code->relocation_info()->Size();
size += code->deoptimization_data()->Size();
size += code->handler_table()->Size();
}
return size;
}
static bool GenerateBaselineCode(CompilationInfo* info) {
bool success;
if (FLAG_ignition && UseIgnition(info)) {
return interpreter::Interpreter::MakeBytecode(info);
success = interpreter::Interpreter::MakeBytecode(info);
} else {
return FullCodeGenerator::MakeCode(info);
success = FullCodeGenerator::MakeCode(info);
}
if (success) {
Isolate* isolate = info->isolate();
Counters* counters = isolate->counters();
counters->total_baseline_code_size()->Increment(CodeAndMetadataSize(info));
counters->total_baseline_compile_count()->Increment(1);
}
return success;
}
......
......@@ -576,7 +576,7 @@ double AggregatedMemoryHistogram<Histogram>::Aggregate(double current_ms,
SC(call_premonomorphic_stubs, V8.CallPreMonomorphicStubs) \
SC(call_normal_stubs, V8.CallNormalStubs) \
SC(call_megamorphic_stubs, V8.CallMegamorphicStubs) \
SC(inlined_copied_elements, V8.InlinedCopiedElements) \
SC(inlined_copied_elements, V8.InlinedCopiedElements) \
SC(arguments_adaptors, V8.ArgumentsAdaptors) \
SC(compilation_cache_hits, V8.CompilationCacheHits) \
SC(compilation_cache_misses, V8.CompilationCacheMisses) \
......@@ -718,8 +718,11 @@ double AggregatedMemoryHistogram<Histogram>::Aggregate(double current_ms,
SC(turbo_escape_allocs_replaced, V8.TurboEscapeAllocsReplaced) \
SC(crankshaft_escape_allocs_replaced, V8.CrankshaftEscapeAllocsReplaced) \
SC(turbo_escape_loads_replaced, V8.TurboEscapeLoadsReplaced) \
SC(crankshaft_escape_loads_replaced, V8.CrankshaftEscapeLoadsReplaced)
SC(crankshaft_escape_loads_replaced, V8.CrankshaftEscapeLoadsReplaced) \
/* Total code size (including metadata) of baseline code or bytecode. */ \
SC(total_baseline_code_size, V8.TotalBaselineCodeSize) \
/* Total count of functions compiled using the baseline compiler. */ \
SC(total_baseline_compile_count, V8.TotalBaselineCompileCount)
// This file contains all the v8 counters that are in use.
class Counters {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment