Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: src/codegen.cc

Issue 363323003: More OStreamsUse OStreams more often. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased and polished. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/code-stubs.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
}
« no previous file with comments | « src/code-stubs.cc ('k') | src/deoptimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698