Commit 0930a924 authored by jgruber's avatar jgruber Committed by Commit Bot

[builtins] Add --print-builtin-size flag

Passing --print-builtin-size will print the size of all builtins on
isolate creation.

BUG=v8:5737

Review-Url: https://codereview.chromium.org/2895163002
Cr-Commit-Position: refs/heads/master@{#45605}
parent 32e4bcd9
......@@ -1268,6 +1268,7 @@ DEFINE_BOOL(print_unopt_code, false,
"printing optimized code based on it")
DEFINE_BOOL(print_code_verbose, false, "print more information for code")
DEFINE_BOOL(print_builtin_code, false, "print generated code for builtins")
DEFINE_BOOL(print_builtin_size, false, "print code size for builtins")
#ifdef ENABLE_DISASSEMBLER
DEFINE_BOOL(sodium, false,
......
......@@ -2651,6 +2651,16 @@ void Isolate::InitializeLoggingAndCounters() {
InitializeCounters();
}
namespace {
void PrintBuiltinSizes(Isolate* isolate) {
Builtins* builtins = isolate->builtins();
for (int i = 0; i < Builtins::builtin_count; i++) {
const char* name = builtins->name(i);
Code* code = builtins->builtin(static_cast<Builtins::Name>(i));
PrintF(stdout, "%s: %d\n", name, code->instruction_size());
}
}
} // namespace
bool Isolate::Init(Deserializer* des) {
TRACE_ISOLATE(init);
......@@ -2790,6 +2800,8 @@ bool Isolate::Init(Deserializer* des) {
delete setup_delegate_;
setup_delegate_ = nullptr;
if (FLAG_print_builtin_size) PrintBuiltinSizes(this);
// Finish initialization of ThreadLocal after deserialization is done.
clear_pending_exception();
clear_pending_message();
......
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