| 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;
|
| }
|
|
|