Commit e0e3049e authored by jgruber's avatar jgruber Committed by Commit Bot

[interpreter] Print handler sizes on --print-builtin-size

Bytecode handlers are technically not builtins, but very similar to CSA
builtins in most respects (CSA-generated code, currently included in the
snapshot and deserialized for every isolate). This prints bytecode
handler sizes (in addition to standard CSA builtin sizes) when
--print-builtin-size is passed.

Bug: 
Change-Id: Ibd78422c5138b77ccf298f97c7c1fc1b73a3a09b
Reviewed-on: https://chromium-review.googlesource.com/581191
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46831}
parent 21e7f083
...@@ -14,6 +14,15 @@ namespace v8 { ...@@ -14,6 +14,15 @@ namespace v8 {
namespace internal { namespace internal {
namespace interpreter { namespace interpreter {
namespace {
void PrintBuiltinSize(Bytecode bytecode, OperandScale operand_scale,
Handle<Code> code) {
PrintF(stdout, "Ignition Handler, %s, %d\n",
Bytecodes::ToString(bytecode, operand_scale).c_str(),
code->instruction_size());
}
} // namespace
// static // static
void SetupInterpreter::InstallBytecodeHandlers(Interpreter* interpreter) { void SetupInterpreter::InstallBytecodeHandlers(Interpreter* interpreter) {
DCHECK(!interpreter->IsDispatchTableInitialized()); DCHECK(!interpreter->IsDispatchTableInitialized());
...@@ -87,6 +96,8 @@ void SetupInterpreter::InstallBytecodeHandler(Isolate* isolate, ...@@ -87,6 +96,8 @@ void SetupInterpreter::InstallBytecodeHandler(Isolate* isolate,
size_t index = Interpreter::GetDispatchTableIndex(bytecode, operand_scale); size_t index = Interpreter::GetDispatchTableIndex(bytecode, operand_scale);
Handle<Code> code = GenerateBytecodeHandler(isolate, bytecode, operand_scale); Handle<Code> code = GenerateBytecodeHandler(isolate, bytecode, operand_scale);
dispatch_table[index] = code->entry(); dispatch_table[index] = code->entry();
if (FLAG_print_builtin_size) PrintBuiltinSize(bytecode, operand_scale, code);
} }
} // namespace interpreter } // namespace interpreter
......
...@@ -2667,9 +2667,10 @@ namespace { ...@@ -2667,9 +2667,10 @@ namespace {
void PrintBuiltinSizes(Isolate* isolate) { void PrintBuiltinSizes(Isolate* isolate) {
Builtins* builtins = isolate->builtins(); Builtins* builtins = isolate->builtins();
for (int i = 0; i < Builtins::builtin_count; i++) { for (int i = 0; i < Builtins::builtin_count; i++) {
if (Builtins::IsCpp(i) || Builtins::IsApi(i)) continue;
const char* name = builtins->name(i); const char* name = builtins->name(i);
Code* code = builtins->builtin(static_cast<Builtins::Name>(i)); Code* code = builtins->builtin(static_cast<Builtins::Name>(i));
PrintF(stdout, "%s: %d\n", name, code->instruction_size()); PrintF(stdout, "Builtin, %s, %d\n", name, code->instruction_size());
} }
} }
} // namespace } // namespace
......
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