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

Unified Diff: src/basic-block-profiler.cc

Issue 618643002: Replace OStream with std::ostream. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 years, 3 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/basic-block-profiler.h ('k') | src/code-stubs.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/basic-block-profiler.cc
diff --git a/src/basic-block-profiler.cc b/src/basic-block-profiler.cc
index 110c505fdbe0959f82e62ed49f9d0da23969363f..deb1a532d01afe09a66e4b123bf9d640e0526edb 100644
--- a/src/basic-block-profiler.cc
+++ b/src/basic-block-profiler.cc
@@ -4,6 +4,8 @@
#include "src/basic-block-profiler.h"
+#include <sstream>
+
namespace v8 {
namespace internal {
@@ -14,22 +16,22 @@ BasicBlockProfiler::Data::Data(size_t n_blocks)
BasicBlockProfiler::Data::~Data() {}
-static void InsertIntoString(OStringStream* os, std::string* string) {
- string->insert(string->begin(), os->c_str(), &os->c_str()[os->size()]);
+static void InsertIntoString(std::ostringstream* os, std::string* string) {
+ string->insert(0, os->str());
}
-void BasicBlockProfiler::Data::SetCode(OStringStream* os) {
+void BasicBlockProfiler::Data::SetCode(std::ostringstream* os) {
InsertIntoString(os, &code_);
}
-void BasicBlockProfiler::Data::SetFunctionName(OStringStream* os) {
+void BasicBlockProfiler::Data::SetFunctionName(std::ostringstream* os) {
InsertIntoString(os, &function_name_);
}
-void BasicBlockProfiler::Data::SetSchedule(OStringStream* os) {
+void BasicBlockProfiler::Data::SetSchedule(std::ostringstream* os) {
InsertIntoString(os, &schedule_);
}
@@ -77,33 +79,33 @@ void BasicBlockProfiler::ResetCounts() {
}
-OStream& operator<<(OStream& os, const BasicBlockProfiler& p) {
- os << "---- Start Profiling Data ----" << endl;
+std::ostream& operator<<(std::ostream& os, const BasicBlockProfiler& p) {
+ os << "---- Start Profiling Data ----" << std::endl;
typedef BasicBlockProfiler::DataList::const_iterator iterator;
for (iterator i = p.data_list_.begin(); i != p.data_list_.end(); ++i) {
os << **i;
}
- os << "---- End Profiling Data ----" << endl;
+ os << "---- End Profiling Data ----" << std::endl;
return os;
}
-OStream& operator<<(OStream& os, const BasicBlockProfiler::Data& d) {
+std::ostream& operator<<(std::ostream& os, const BasicBlockProfiler::Data& d) {
const char* name = "unknown function";
if (!d.function_name_.empty()) {
name = d.function_name_.c_str();
}
if (!d.schedule_.empty()) {
- os << "schedule for " << name << endl;
- os << d.schedule_.c_str() << endl;
+ os << "schedule for " << name << std::endl;
+ os << d.schedule_.c_str() << std::endl;
}
- os << "block counts for " << name << ":" << endl;
+ os << "block counts for " << name << ":" << std::endl;
for (size_t i = 0; i < d.n_blocks_; ++i) {
- os << "block " << d.block_ids_[i] << " : " << d.counts_[i] << endl;
+ os << "block " << d.block_ids_[i] << " : " << d.counts_[i] << std::endl;
}
- os << endl;
+ os << std::endl;
if (!d.code_.empty()) {
- os << d.code_.c_str() << endl;
+ os << d.code_.c_str() << std::endl;
}
return os;
}
« no previous file with comments | « src/basic-block-profiler.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698