Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 0fd4e29ce61d83fe70056433874e059d5e787f40..d860245815fd8f33d4ba72737468cab351ef3eeb 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -9548,28 +9548,28 @@ RUNTIME_FUNCTION(Runtime_DebugPrint) { |
SealHandleScope shs(isolate); |
ASSERT(args.length() == 1); |
+ OFStream os(stdout); |
#ifdef DEBUG |
if (args[0]->IsString()) { |
// If we have a string, assume it's a code "marker" |
// and print some interesting cpu debugging info. |
JavaScriptFrameIterator it(isolate); |
JavaScriptFrame* frame = it.frame(); |
- PrintF("fp = %p, sp = %p, caller_sp = %p: ", |
- frame->fp(), frame->sp(), frame->caller_sp()); |
+ os << "fp = " << frame->fp() << ", sp = " << frame->sp() |
+ << ", caller_sp = " << frame->caller_sp() << ": "; |
} else { |
- PrintF("DebugPrint: "); |
+ os << "DebugPrint: "; |
} |
- args[0]->Print(); |
+ args[0]->Print(os); |
if (args[0]->IsHeapObject()) { |
- PrintF("\n"); |
- HeapObject::cast(args[0])->map()->Print(); |
+ os << "\n"; |
+ HeapObject::cast(args[0])->map()->Print(os); |
} |
#else |
// ShortPrint is available in release mode. Print is not. |
- args[0]->ShortPrint(); |
+ os << Brief(args[0]); |
#endif |
- PrintF("\n"); |
- Flush(); |
+ os << endl; |
return args[0]; // return TOS |
} |
@@ -12116,22 +12116,23 @@ class ScopeIterator { |
#ifdef DEBUG |
// Debug print of the content of the current scope. |
void DebugPrint() { |
+ OFStream os(stdout); |
ASSERT(!failed_); |
switch (Type()) { |
case ScopeIterator::ScopeTypeGlobal: |
- PrintF("Global:\n"); |
- CurrentContext()->Print(); |
+ os << "Global:\n"; |
+ CurrentContext()->Print(os); |
break; |
case ScopeIterator::ScopeTypeLocal: { |
- PrintF("Local:\n"); |
+ os << "Local:\n"; |
function_->shared()->scope_info()->Print(); |
if (!CurrentContext().is_null()) { |
- CurrentContext()->Print(); |
+ CurrentContext()->Print(os); |
if (CurrentContext()->has_extension()) { |
Handle<Object> extension(CurrentContext()->extension(), isolate_); |
if (extension->IsJSContextExtensionObject()) { |
- extension->Print(); |
+ extension->Print(os); |
} |
} |
} |
@@ -12139,23 +12140,23 @@ class ScopeIterator { |
} |
case ScopeIterator::ScopeTypeWith: |
- PrintF("With:\n"); |
- CurrentContext()->extension()->Print(); |
+ os << "With:\n"; |
+ CurrentContext()->extension()->Print(os); |
break; |
case ScopeIterator::ScopeTypeCatch: |
- PrintF("Catch:\n"); |
- CurrentContext()->extension()->Print(); |
- CurrentContext()->get(Context::THROWN_OBJECT_INDEX)->Print(); |
+ os << "Catch:\n"; |
+ CurrentContext()->extension()->Print(os); |
+ CurrentContext()->get(Context::THROWN_OBJECT_INDEX)->Print(os); |
break; |
case ScopeIterator::ScopeTypeClosure: |
- PrintF("Closure:\n"); |
- CurrentContext()->Print(); |
+ os << "Closure:\n"; |
+ CurrentContext()->Print(os); |
if (CurrentContext()->has_extension()) { |
Handle<Object> extension(CurrentContext()->extension(), isolate_); |
if (extension->IsJSContextExtensionObject()) { |
- extension->Print(); |
+ extension->Print(os); |
} |
} |
break; |
@@ -13264,7 +13265,9 @@ RUNTIME_FUNCTION(Runtime_DebugDisassembleFunction) { |
if (!Compiler::EnsureCompiled(func, KEEP_EXCEPTION)) { |
return isolate->heap()->exception(); |
} |
- func->code()->PrintLn(); |
+ OFStream os(stdout); |
+ func->code()->Print(os); |
+ os << endl; |
#endif // DEBUG |
return isolate->heap()->undefined_value(); |
} |
@@ -13279,7 +13282,9 @@ RUNTIME_FUNCTION(Runtime_DebugDisassembleConstructor) { |
if (!Compiler::EnsureCompiled(func, KEEP_EXCEPTION)) { |
return isolate->heap()->exception(); |
} |
- func->shared()->construct_stub()->PrintLn(); |
+ OFStream os(stdout); |
+ func->shared()->construct_stub()->Print(os); |
+ os << endl; |
#endif // DEBUG |
return isolate->heap()->undefined_value(); |
} |