Index: src/codegen.cc |
diff --git a/src/codegen.cc b/src/codegen.cc |
index 244c227305f7a9801b13243a1933e7ae34fc125d..40b47960c4111e62d5ed333500ffc63ed04bd7f3 100644 |
--- a/src/codegen.cc |
+++ b/src/codegen.cc |
@@ -175,10 +175,11 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { |
code->kind() == Code::FUNCTION; |
CodeTracer::Scope tracing_scope(info->isolate()->GetCodeTracer()); |
+ OFStream os(tracing_scope.file()); |
if (print_source) { |
Handle<Script> script = info->script(); |
if (!script->IsUndefined() && !script->source()->IsUndefined()) { |
- PrintF(tracing_scope.file(), "--- Raw source ---\n"); |
+ os << "--- Raw source ---\n"; |
ConsStringIteratorOp op; |
StringCharacterStream stream(String::cast(script->source()), |
&op, |
@@ -189,37 +190,33 @@ void CodeGenerator::PrintCode(Handle<Code> code, CompilationInfo* info) { |
function->end_position() - function->start_position() + 1; |
for (int i = 0; i < source_len; i++) { |
if (stream.HasMore()) { |
- PrintF(tracing_scope.file(), "%c", stream.GetNext()); |
+ os.put(stream.GetNext()); |
} |
} |
- PrintF(tracing_scope.file(), "\n\n"); |
+ os << "\n\n"; |
} |
} |
if (info->IsOptimizing()) { |
if (FLAG_print_unopt_code) { |
- PrintF(tracing_scope.file(), "--- Unoptimized code ---\n"); |
+ os << "--- Unoptimized code ---\n"; |
info->closure()->shared()->code()->Disassemble( |
- function->debug_name()->ToCString().get(), tracing_scope.file()); |
+ function->debug_name()->ToCString().get(), os); |
} |
- PrintF(tracing_scope.file(), "--- Optimized code ---\n"); |
- PrintF(tracing_scope.file(), |
- "optimization_id = %d\n", info->optimization_id()); |
+ os << "--- Optimized code ---\n" |
+ << "optimization_id = " << info->optimization_id() << "\n"; |
} else { |
- PrintF(tracing_scope.file(), "--- Code ---\n"); |
+ os << "--- Code ---\n"; |
} |
if (print_source) { |
- PrintF(tracing_scope.file(), |
- "source_position = %d\n", function->start_position()); |
+ os << "source_position = " << function->start_position() << "\n"; |
} |
if (info->IsStub()) { |
CodeStub::Major major_key = info->code_stub()->MajorKey(); |
- code->Disassemble(CodeStub::MajorName(major_key, false), |
- tracing_scope.file()); |
+ code->Disassemble(CodeStub::MajorName(major_key, false), os); |
} else { |
- code->Disassemble(function->debug_name()->ToCString().get(), |
- tracing_scope.file()); |
+ code->Disassemble(function->debug_name()->ToCString().get(), os); |
} |
- PrintF(tracing_scope.file(), "--- End code ---\n"); |
+ os << "--- End code ---\n"; |
} |
#endif // ENABLE_DISASSEMBLER |
} |