#include "src/compiler/scheduler.h"
+#include <iomanip>
+
#include "src/bit-vector.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/control-equivalence.h"
os << ":\n";
for (BasicBlock* block = order_; block != NULL; block = block->rpo_next()) {
- BasicBlock::Id bid = block->id();
- // TODO(jarin,svenpanne): Add formatting here once we have support for
- // that in streams (we want an equivalent of PrintF("%5d:", x) here).
- os << " " << block->rpo_number() << ":";
+ os << std::setw(5) << block->rpo_number() << ":";
for (size_t i = 0; i < loops_.size(); i++) {
bool range = loops_[i].header->LoopContains(block);
bool membership = loops_[i].header != block && range;
os << (membership ? " |" : " ");
os << (range ? "x" : " ");
}
- os << " B" << bid << ": ";
+ os << " B" << block->id() << ": ";
if (block->loop_end() != NULL) {
os << " range: [" << block->rpo_number() << ", "
<< block->loop_end()->rpo_number() << ")";
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <iomanip>
#include <sstream>
#include "src/v8.h"
os << "\n";
}
for (int i = 0; i < deopt_count; i++) {
- // TODO(svenpanne) Add some basic formatting to our streams.
- Vector<char> buf1 = Vector<char>::New(128);
- SNPrintF(buf1, "%6d %6d %6d %6d", i, AstId(i).ToInt(),
- ArgumentsStackHeight(i)->value(), Pc(i)->value());
- os << buf1.start();
+ os << std::setw(6) << i << " " << std::setw(6) << AstId(i).ToInt() << " "
+ << std::setw(6) << ArgumentsStackHeight(i)->value() << " "
+ << std::setw(6) << Pc(i)->value();
if (!FLAG_print_code_verbose) {
os << "\n";
while (iterator.HasNext() &&
Translation::BEGIN !=
(opcode = static_cast<Translation::Opcode>(iterator.Next()))) {
- Vector<char> buf2 = Vector<char>::New(128);
- SNPrintF(buf2, "%27s %s ", "", Translation::StringFor(opcode));
- os << buf2.start();
+ os << std::setw(31) << " " << Translation::StringFor(opcode) << " ";
switch (opcode) {
case Translation::BEGIN:
os << "ast id pc state\n";
for (int i = 0; i < this->DeoptPoints(); i++) {
int pc_and_state = this->PcAndState(i)->value();
- // TODO(svenpanne) Add some basic formatting to our streams.
- Vector<char> buf = Vector<char>::New(100);
- SNPrintF(buf, "%6d %8d %s\n", this->AstId(i).ToInt(),
- FullCodeGenerator::PcField::decode(pc_and_state),
- FullCodeGenerator::State2String(
- FullCodeGenerator::StateField::decode(pc_and_state)));
- os << buf.start();
+ os << std::setw(6) << this->AstId(i).ToInt() << " " << std::setw(8)
+ << FullCodeGenerator::PcField::decode(pc_and_state) << " "
+ << FullCodeGenerator::State2String(
+ FullCodeGenerator::StateField::decode(pc_and_state)) << "\n";
}
}
for (unsigned i = 0; i < table.length(); i++) {
unsigned pc_offset = table.GetPcOffset(i);
os << static_cast<const void*>(instruction_start() + pc_offset) << " ";
- // TODO(svenpanne) Add some basic formatting to our streams.
- Vector<char> buf1 = Vector<char>::New(30);
- SNPrintF(buf1, "%4d", pc_offset);
- os << buf1.start() << " ";
+ os << std::setw(4) << pc_offset << " ";
table.PrintEntry(i, os);
os << " (sp -> fp) ";
SafepointEntry entry = table.GetEntry(i);
if (entry.deoptimization_index() != Safepoint::kNoDeoptimizationIndex) {
- Vector<char> buf2 = Vector<char>::New(30);
- SNPrintF(buf2, "%6d", entry.deoptimization_index());
- os << buf2.start();
+ os << std::setw(6) << entry.deoptimization_index();
} else {
os << "<none>";
}
os << "ast_id pc_offset loop_depth\n";
for (uint32_t i = 0; i < back_edges.length(); i++) {
- Vector<char> buf = Vector<char>::New(100);
- SNPrintF(buf, "%6d %9u %10u\n", back_edges.ast_id(i).ToInt(),
- back_edges.pc_offset(i), back_edges.loop_depth(i));
- os << buf.start();
+ os << std::setw(6) << back_edges.ast_id(i).ToInt() << " "
+ << std::setw(9) << back_edges.pc_offset(i) << " " << std::setw(10)
+ << back_edges.loop_depth(i) << "\n";
}
os << "\n";
for (int i = 0; i < handler_table()->length(); i += 2) {
int pc_offset = Smi::cast(handler_table()->get(i))->value();
int handler = Smi::cast(handler_table()->get(i + 1))->value();
- os << static_cast<const void*>(instruction_start() + pc_offset) << " ";
- Vector<char> buf = Vector<char>::New(20);
- SNPrintF(buf, "%4d %4d\n", pc_offset, handler);
- os << buf.start();
+ os << static_cast<const void*>(instruction_start() + pc_offset) << " "
+ << std::setw(4) << pc_offset << " " << std::setw(4) << handler << "\n";
}
os << "\n";
}