Chromium Code Reviews| Index: src/compiler.cc |
| diff --git a/src/compiler.cc b/src/compiler.cc |
| index 7fbbfb17ff5daf7b809e94144a3b35a3f45ba633..9abeba2cc002da35d65bfa77e4e4f3db58e16f47 100644 |
| --- a/src/compiler.cc |
| +++ b/src/compiler.cc |
| @@ -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,40 @@ 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 += FixedArray::SizeFor(bytecode_array->constant_pool()->length()); |
|
Michael Starzinger
2016/02/01 17:47:19
nit: Please use HeapObject::Size here.
rmcilroy
2016/02/02 16:21:39
Done.
|
| + size += FixedArray::SizeFor(bytecode_array->handler_table()->length()); |
|
Michael Starzinger
2016/02/01 17:47:19
Likewise.
rmcilroy
2016/02/02 16:21:39
Done.
|
| + size += |
| + FixedArray::SizeFor(bytecode_array->source_position_table()->length()); |
|
Michael Starzinger
2016/02/01 17:47:19
Likwise.
rmcilroy
2016/02/02 16:21:39
Done.
|
| + } else { |
| + Handle<Code> code = info->code(); |
| + size += code->CodeSize(); |
| + size += code->relocation_info()->Size(); |
| + size += FixedArray::SizeFor(code->deoptimization_data()->length()); |
|
Michael Starzinger
2016/02/01 17:47:19
Likewise.
rmcilroy
2016/02/02 16:21:39
Done.
|
| + size += FixedArray::SizeFor(code->handler_table()->length()); |
|
Michael Starzinger
2016/02/01 17:47:19
Likewise.
rmcilroy
2016/02/02 16:21:39
Done.
|
| + } |
| + 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; |
| } |