Commit e77ae927 authored by Loo Rong Jie's avatar Loo Rong Jie Committed by Commit Bot

Fix print-bytecode in release build without setting OBJECT_PRINT

Before this, --print-bytecode flag was available in all Release builds
but did not actually print the bytecodes because OBJECT_PRINT is not set.

The output was pretty confusing:

[generating bytecode for function: ]
000002115442ABE9 <BytecodeArray[27]>[generating bytecode for function: main]
000002115442B069 <BytecodeArray[114]>[generating bytecode for function: Primes]
000002115442B729 <BytecodeArray[63]>[generating bytecode for function: Int32Array]
000002115442BB51 <BytecodeArray[175]>[generating bytecode for function: Primes.getPrimeCount]
000002115442BE81 <BytecodeArray[7]>[generating bytecode for function: Primes.isPrimeDivisible]
000002115442BFC9 <BytecodeArray[71]>[generating bytecode for function: Primes.addPrime]
000002115442C1C1 <BytecodeArray[31]>[generating bytecode for function: Primes.getPrime]
000002115442D7B1 <BytecodeArray[14]>

With this CL, --print-bytecode flag will always output bytecode, but
detailed info about constant pool and handler table are still guarded.

Bug:NO

Change-Id: Ie03be74520f45659303d1658da5b2acc02cf1b36
Reviewed-on: https://chromium-review.googlesource.com/497808Reviewed-by: 's avatarRoss McIlroy <rmcilroy@chromium.org>
Commit-Queue: Loo Rong Jie <loorongjie@gmail.com>
Cr-Commit-Position: refs/heads/master@{#45187}
parent f64f9846
......@@ -159,8 +159,7 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::PrepareJobImpl() {
OFStream os(stdout);
std::unique_ptr<char[]> name = info()->GetDebugName();
os << "[generating bytecode for function: " << info()->GetDebugName().get()
<< "]" << std::endl
<< std::flush;
<< "]" << std::endl;
}
return SUCCEEDED;
......@@ -199,7 +198,7 @@ InterpreterCompilationJob::Status InterpreterCompilationJob::FinalizeJobImpl() {
if (print_bytecode_) {
OFStream os(stdout);
bytecodes->Print(os);
bytecodes->Disassemble(os);
os << std::flush;
}
......
......@@ -14954,14 +14954,16 @@ void BytecodeArray::Disassemble(std::ostream& os) {
iterator.Advance();
}
if (constant_pool()->length() > 0) {
os << "Constant pool (size = " << constant_pool()->length() << ")\n";
#ifdef OBJECT_PRINT
if (constant_pool()->length() > 0) {
constant_pool()->Print();
}
#endif
os << "Handler Table (size = " << handler_table()->Size() << ")\n";
#ifdef ENABLE_DISASSEMBLER
if (handler_table()->length() > 0) {
os << "Handler Table (size = " << handler_table()->Size() << ")\n";
HandlerTable::cast(handler_table())->HandlerTableRangePrint(os);
}
#endif
......
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