Upgrade V8 to version 4.9.385.28
https://chromium.googlesource.com/v8/v8/+/4.9.385.28
Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/src/compiler/graph-visualizer.cc b/src/compiler/graph-visualizer.cc
index e018c7a..0785176 100644
--- a/src/compiler/graph-visualizer.cc
+++ b/src/compiler/graph-visualizer.cc
@@ -8,80 +8,55 @@
#include <string>
#include "src/code-stubs.h"
+#include "src/compiler/all-nodes.h"
#include "src/compiler/graph.h"
-#include "src/compiler/graph-inl.h"
#include "src/compiler/node.h"
#include "src/compiler/node-properties.h"
-#include "src/compiler/node-properties-inl.h"
#include "src/compiler/opcodes.h"
#include "src/compiler/operator.h"
+#include "src/compiler/operator-properties.h"
#include "src/compiler/register-allocator.h"
#include "src/compiler/schedule.h"
#include "src/compiler/scheduler.h"
+#include "src/interpreter/bytecodes.h"
#include "src/ostreams.h"
namespace v8 {
namespace internal {
namespace compiler {
-static int SafeId(Node* node) { return node == NULL ? -1 : node->id(); }
+
+FILE* OpenVisualizerLogFile(CompilationInfo* info, const char* phase,
+ const char* suffix, const char* mode) {
+ EmbeddedVector<char, 256> filename(0);
+ base::SmartArrayPointer<char> debug_name = info->GetDebugName();
+ if (strlen(debug_name.get()) > 0) {
+ SNPrintF(filename, "turbo-%s", debug_name.get());
+ } else if (info->has_shared_info()) {
+ SNPrintF(filename, "turbo-%p", static_cast<void*>(info));
+ } else {
+ SNPrintF(filename, "turbo-none-%s", phase);
+ }
+ std::replace(filename.start(), filename.start() + filename.length(), ' ',
+ '_');
+
+ EmbeddedVector<char, 256> full_filename;
+ if (phase == nullptr) {
+ SNPrintF(full_filename, "%s.%s", filename.start(), suffix);
+ } else {
+ SNPrintF(full_filename, "%s-%s.%s", filename.start(), phase, suffix);
+ }
+ return base::OS::FOpen(full_filename.start(), mode);
+}
+
+
+static int SafeId(Node* node) { return node == nullptr ? -1 : node->id(); }
static const char* SafeMnemonic(Node* node) {
- return node == NULL ? "null" : node->op()->mnemonic();
+ return node == nullptr ? "null" : node->op()->mnemonic();
}
#define DEAD_COLOR "#999999"
-class AllNodes {
- public:
- enum State { kDead, kGray, kLive };
-
- AllNodes(Zone* local_zone, const Graph* graph)
- : state(graph->NodeCount(), kDead, local_zone),
- live(local_zone),
- gray(local_zone) {
- Node* end = graph->end();
- state[end->id()] = kLive;
- live.push_back(end);
- // Find all live nodes reachable from end.
- for (size_t i = 0; i < live.size(); i++) {
- for (Node* const input : live[i]->inputs()) {
- if (input == NULL) {
- // TODO(titzer): print a warning.
- continue;
- }
- if (input->id() >= graph->NodeCount()) {
- // TODO(titzer): print a warning.
- continue;
- }
- if (state[input->id()] != kLive) {
- live.push_back(input);
- state[input->id()] = kLive;
- }
- }
- }
-
- // Find all nodes that are not reachable from end that use live nodes.
- for (size_t i = 0; i < live.size(); i++) {
- for (Node* const use : live[i]->uses()) {
- if (state[use->id()] == kDead) {
- gray.push_back(use);
- state[use->id()] = kGray;
- }
- }
- }
- }
-
- bool IsLive(Node* node) {
- return node != NULL && node->id() < static_cast<int>(state.size()) &&
- state[node->id()] == kLive;
- }
-
- ZoneVector<State> state;
- NodeVector live;
- NodeVector gray;
-};
-
-
class Escaped {
public:
explicit Escaped(const std::ostringstream& os,
@@ -111,25 +86,27 @@
class JSONGraphNodeWriter {
public:
- JSONGraphNodeWriter(std::ostream& os, Zone* zone, const Graph* graph)
- : os_(os), all_(zone, graph), first_node_(true) {}
+ JSONGraphNodeWriter(std::ostream& os, Zone* zone, const Graph* graph,
+ const SourcePositionTable* positions)
+ : os_(os), all_(zone, graph), positions_(positions), first_node_(true) {}
void Print() {
for (Node* const node : all_.live) PrintNode(node);
+ os_ << "\n";
}
void PrintNode(Node* node) {
if (first_node_) {
first_node_ = false;
} else {
- os_ << ",";
+ os_ << ",\n";
}
std::ostringstream label;
label << *node->op();
os_ << "{\"id\":" << SafeId(node) << ",\"label\":\"" << Escaped(label, "\"")
<< "\"";
IrOpcode::Value opcode = node->opcode();
- if (opcode == IrOpcode::kPhi || opcode == IrOpcode::kEffectPhi) {
+ if (IrOpcode::IsPhiOpcode(opcode)) {
os_ << ",\"rankInputs\":[0," << NodeProperties::FirstControlIndex(node)
<< "]";
os_ << ",\"rankWithInput\":[" << NodeProperties::FirstControlIndex(node)
@@ -142,15 +119,26 @@
if (opcode == IrOpcode::kBranch) {
os_ << ",\"rankInputs\":[0]";
}
+ SourcePosition position = positions_->GetSourcePosition(node);
+ if (position.IsKnown()) {
+ os_ << ",\"pos\":" << position.raw();
+ }
os_ << ",\"opcode\":\"" << IrOpcode::Mnemonic(node->opcode()) << "\"";
os_ << ",\"control\":" << (NodeProperties::IsControl(node) ? "true"
: "false");
+ if (NodeProperties::IsTyped(node)) {
+ Type* type = NodeProperties::GetType(node);
+ std::ostringstream type_out;
+ type->PrintTo(type_out);
+ os_ << ",\"type\":\"" << Escaped(type_out, "\"") << "\"";
+ }
os_ << "}";
}
private:
std::ostream& os_;
AllNodes all_;
+ const SourcePositionTable* positions_;
bool first_node_;
DISALLOW_COPY_AND_ASSIGN(JSONGraphNodeWriter);
@@ -164,12 +152,13 @@
void Print() {
for (Node* const node : all_.live) PrintEdges(node);
+ os_ << "\n";
}
void PrintEdges(Node* node) {
for (int i = 0; i < node->InputCount(); i++) {
Node* input = node->InputAt(i);
- if (input == NULL) continue;
+ if (input == nullptr) continue;
PrintEdge(node, i, input);
}
}
@@ -178,9 +167,9 @@
if (first_edge_) {
first_edge_ = false;
} else {
- os_ << ",";
+ os_ << ",\n";
}
- const char* edge_type = NULL;
+ const char* edge_type = nullptr;
if (index < NodeProperties::FirstValueIndex(from)) {
edge_type = "unknown";
} else if (index < NodeProperties::FirstContextIndex(from)) {
@@ -208,195 +197,16 @@
std::ostream& operator<<(std::ostream& os, const AsJSON& ad) {
- Zone tmp_zone(ad.graph.zone()->isolate());
- os << "{\"nodes\":[";
- JSONGraphNodeWriter(os, &tmp_zone, &ad.graph).Print();
- os << "],\"edges\":[";
+ Zone tmp_zone;
+ os << "{\n\"nodes\":[";
+ JSONGraphNodeWriter(os, &tmp_zone, &ad.graph, ad.positions).Print();
+ os << "],\n\"edges\":[";
JSONGraphEdgeWriter(os, &tmp_zone, &ad.graph).Print();
os << "]}";
return os;
}
-class GraphVisualizer {
- public:
- GraphVisualizer(std::ostream& os, Zone* zone, const Graph* graph)
- : all_(zone, graph), os_(os) {}
-
- void Print();
-
- void PrintNode(Node* node, bool gray);
-
- private:
- void PrintEdge(Edge edge);
-
- AllNodes all_;
- std::ostream& os_;
-
- DISALLOW_COPY_AND_ASSIGN(GraphVisualizer);
-};
-
-
-static Node* GetControlCluster(Node* node) {
- if (OperatorProperties::IsBasicBlockBegin(node->op())) {
- return node;
- } else if (node->op()->ControlInputCount() == 1) {
- Node* control = NodeProperties::GetControlInput(node, 0);
- return control != NULL &&
- OperatorProperties::IsBasicBlockBegin(control->op())
- ? control
- : NULL;
- } else {
- return NULL;
- }
-}
-
-
-void GraphVisualizer::PrintNode(Node* node, bool gray) {
- Node* control_cluster = GetControlCluster(node);
- if (control_cluster != NULL) {
- os_ << " subgraph cluster_BasicBlock" << control_cluster->id() << " {\n";
- }
- os_ << " ID" << SafeId(node) << " [\n";
-
- os_ << " shape=\"record\"\n";
- switch (node->opcode()) {
- case IrOpcode::kEnd:
- case IrOpcode::kDead:
- case IrOpcode::kStart:
- os_ << " style=\"diagonals\"\n";
- break;
- case IrOpcode::kMerge:
- case IrOpcode::kIfTrue:
- case IrOpcode::kIfFalse:
- case IrOpcode::kLoop:
- os_ << " style=\"rounded\"\n";
- break;
- default:
- break;
- }
-
- if (gray) {
- os_ << " style=\"filled\"\n"
- << " fillcolor=\"" DEAD_COLOR "\"\n";
- }
-
- std::ostringstream label;
- label << *node->op();
- os_ << " label=\"{{#" << SafeId(node) << ":" << Escaped(label);
-
- auto i = node->input_edges().begin();
- for (int j = node->op()->ValueInputCount(); j > 0; ++i, j--) {
- os_ << "|<I" << (*i).index() << ">#" << SafeId((*i).to());
- }
- for (int j = OperatorProperties::GetContextInputCount(node->op()); j > 0;
- ++i, j--) {
- os_ << "|<I" << (*i).index() << ">X #" << SafeId((*i).to());
- }
- for (int j = OperatorProperties::GetFrameStateInputCount(node->op()); j > 0;
- ++i, j--) {
- os_ << "|<I" << (*i).index() << ">F #" << SafeId((*i).to());
- }
- for (int j = node->op()->EffectInputCount(); j > 0; ++i, j--) {
- os_ << "|<I" << (*i).index() << ">E #" << SafeId((*i).to());
- }
-
- if (OperatorProperties::IsBasicBlockBegin(node->op()) ||
- GetControlCluster(node) == NULL) {
- for (int j = node->op()->ControlInputCount(); j > 0; ++i, j--) {
- os_ << "|<I" << (*i).index() << ">C #" << SafeId((*i).to());
- }
- }
- os_ << "}";
-
- if (FLAG_trace_turbo_types && NodeProperties::IsTyped(node)) {
- Bounds bounds = NodeProperties::GetBounds(node);
- std::ostringstream upper;
- bounds.upper->PrintTo(upper);
- std::ostringstream lower;
- bounds.lower->PrintTo(lower);
- os_ << "|" << Escaped(upper) << "|" << Escaped(lower);
- }
- os_ << "}\"\n";
-
- os_ << " ]\n";
- if (control_cluster != NULL) os_ << " }\n";
-}
-
-
-static bool IsLikelyBackEdge(Node* from, int index, Node* to) {
- if (from->opcode() == IrOpcode::kPhi ||
- from->opcode() == IrOpcode::kEffectPhi) {
- Node* control = NodeProperties::GetControlInput(from, 0);
- return control != NULL && control->opcode() != IrOpcode::kMerge &&
- control != to && index != 0;
- } else if (from->opcode() == IrOpcode::kLoop) {
- return index != 0;
- } else {
- return false;
- }
-}
-
-
-void GraphVisualizer::PrintEdge(Edge edge) {
- Node* from = edge.from();
- int index = edge.index();
- Node* to = edge.to();
-
- if (!all_.IsLive(to)) return; // skip inputs that point to dead or NULL.
-
- bool unconstrained = IsLikelyBackEdge(from, index, to);
- os_ << " ID" << SafeId(from);
-
- if (OperatorProperties::IsBasicBlockBegin(from->op()) ||
- GetControlCluster(from) == NULL ||
- (from->op()->ControlInputCount() > 0 &&
- NodeProperties::GetControlInput(from) != to)) {
- os_ << ":I" << index << ":n -> ID" << SafeId(to) << ":s"
- << "[" << (unconstrained ? "constraint=false, " : "")
- << (NodeProperties::IsControlEdge(edge) ? "style=bold, " : "")
- << (NodeProperties::IsEffectEdge(edge) ? "style=dotted, " : "")
- << (NodeProperties::IsContextEdge(edge) ? "style=dashed, " : "") << "]";
- } else {
- os_ << " -> ID" << SafeId(to) << ":s [color=transparent, "
- << (unconstrained ? "constraint=false, " : "")
- << (NodeProperties::IsControlEdge(edge) ? "style=dashed, " : "") << "]";
- }
- os_ << "\n";
-}
-
-
-void GraphVisualizer::Print() {
- os_ << "digraph D {\n"
- << " node [fontsize=8,height=0.25]\n"
- << " rankdir=\"BT\"\n"
- << " ranksep=\"1.2 equally\"\n"
- << " overlap=\"false\"\n"
- << " splines=\"true\"\n"
- << " concentrate=\"true\"\n"
- << " \n";
-
- // Make sure all nodes have been output before writing out the edges.
- for (Node* const node : all_.live) PrintNode(node, false);
- for (Node* const node : all_.gray) PrintNode(node, true);
-
- // With all the nodes written, add the edges.
- for (Node* const node : all_.live) {
- for (Edge edge : node->use_edges()) {
- PrintEdge(edge);
- }
- }
- os_ << "}\n";
-}
-
-
-std::ostream& operator<<(std::ostream& os, const AsDOT& ad) {
- Zone tmp_zone(ad.graph.zone()->isolate());
- GraphVisualizer(os, &tmp_zone, &ad.graph).Print();
- return os;
-}
-
-
class GraphC1Visualizer {
public:
GraphC1Visualizer(std::ostream& os, Zone* zone); // NOLINT
@@ -405,7 +215,7 @@
void PrintSchedule(const char* phase, const Schedule* schedule,
const SourcePositionTable* positions,
const InstructionSequence* instructions);
- void PrintAllocator(const char* phase, const RegisterAllocator* allocator);
+ void PrintLiveRanges(const char* phase, const RegisterAllocationData* data);
Zone* zone() const { return zone_; }
private:
@@ -413,15 +223,18 @@
void PrintStringProperty(const char* name, const char* value);
void PrintLongProperty(const char* name, int64_t value);
void PrintIntProperty(const char* name, int value);
- void PrintBlockProperty(const char* name, BasicBlock::Id block_id);
+ void PrintBlockProperty(const char* name, int rpo_number);
void PrintNodeId(Node* n);
void PrintNode(Node* n);
void PrintInputs(Node* n);
- void PrintInputs(InputIter* i, int count, const char* prefix);
+ template <typename InputIterator>
+ void PrintInputs(InputIterator* i, int count, const char* prefix);
void PrintType(Node* node);
- void PrintLiveRange(LiveRange* range, const char* type);
- class Tag FINAL BASE_EMBEDDED {
+ void PrintLiveRange(LiveRange* range, const char* type, int vreg);
+ void PrintLiveRangeChain(TopLevelLiveRange* range, const char* type);
+
+ class Tag final BASE_EMBEDDED {
public:
Tag(GraphC1Visualizer* visualizer, const char* name) {
name_ = name;
@@ -475,10 +288,9 @@
}
-void GraphC1Visualizer::PrintBlockProperty(const char* name,
- BasicBlock::Id block_id) {
+void GraphC1Visualizer::PrintBlockProperty(const char* name, int rpo_number) {
PrintIndent();
- os_ << name << " \"B" << block_id << "\"\n";
+ os_ << name << " \"B" << rpo_number << "\"\n";
}
@@ -490,15 +302,14 @@
void GraphC1Visualizer::PrintCompilation(const CompilationInfo* info) {
Tag tag(this, "compilation");
+ base::SmartArrayPointer<char> name = info->GetDebugName();
if (info->IsOptimizing()) {
- Handle<String> name = info->function()->debug_name();
- PrintStringProperty("name", name->ToCString().get());
+ PrintStringProperty("name", name.get());
PrintIndent();
- os_ << "method \"" << name->ToCString().get() << ":"
- << info->optimization_id() << "\"\n";
+ os_ << "method \"" << name.get() << ":" << info->optimization_id()
+ << "\"\n";
} else {
- CodeStub::Major major_key = info->code_stub()->MajorKey();
- PrintStringProperty("name", CodeStub::MajorName(major_key, false));
+ PrintStringProperty("name", name.get());
PrintStringProperty("method", "stub");
}
PrintLongProperty("date",
@@ -516,7 +327,8 @@
}
-void GraphC1Visualizer::PrintInputs(InputIter* i, int count,
+template <typename InputIterator>
+void GraphC1Visualizer::PrintInputs(InputIterator* i, int count,
const char* prefix) {
if (count > 0) {
os_ << prefix;
@@ -544,11 +356,9 @@
void GraphC1Visualizer::PrintType(Node* node) {
if (NodeProperties::IsTyped(node)) {
- Bounds bounds = NodeProperties::GetBounds(node);
+ Type* type = NodeProperties::GetType(node);
os_ << " type:";
- bounds.upper->PrintTo(os_);
- os_ << "..";
- bounds.lower->PrintTo(os_);
+ type->PrintTo(os_);
}
}
@@ -563,23 +373,21 @@
for (size_t i = 0; i < rpo->size(); i++) {
BasicBlock* current = (*rpo)[i];
Tag block_tag(this, "block");
- PrintBlockProperty("name", current->id());
+ PrintBlockProperty("name", current->rpo_number());
PrintIntProperty("from_bci", -1);
PrintIntProperty("to_bci", -1);
PrintIndent();
os_ << "predecessors";
- for (BasicBlock::Predecessors::iterator j = current->predecessors_begin();
- j != current->predecessors_end(); ++j) {
- os_ << " \"B" << (*j)->id() << "\"";
+ for (BasicBlock* predecessor : current->predecessors()) {
+ os_ << " \"B" << predecessor->rpo_number() << "\"";
}
os_ << "\n";
PrintIndent();
os_ << "successors";
- for (BasicBlock::Successors::iterator j = current->successors_begin();
- j != current->successors_end(); ++j) {
- os_ << " \"B" << (*j)->id() << "\"";
+ for (BasicBlock* successor : current->successors()) {
+ os_ << " \"B" << successor->rpo_number() << "\"";
}
os_ << "\n";
@@ -589,21 +397,24 @@
PrintIndent();
os_ << "flags\n";
- if (current->dominator() != NULL) {
- PrintBlockProperty("dominator", current->dominator()->id());
+ if (current->dominator() != nullptr) {
+ PrintBlockProperty("dominator", current->dominator()->rpo_number());
}
PrintIntProperty("loop_depth", current->loop_depth());
const InstructionBlock* instruction_block =
- instructions->InstructionBlockAt(current->GetRpoNumber());
+ instructions->InstructionBlockAt(
+ RpoNumber::FromInt(current->rpo_number()));
if (instruction_block->code_start() >= 0) {
int first_index = instruction_block->first_instruction_index();
int last_index = instruction_block->last_instruction_index();
- PrintIntProperty("first_lir_id", LifetimePosition::FromInstructionIndex(
- first_index).Value());
- PrintIntProperty("last_lir_id", LifetimePosition::FromInstructionIndex(
- last_index).Value());
+ PrintIntProperty(
+ "first_lir_id",
+ LifetimePosition::GapFromInstructionIndex(first_index).value());
+ PrintIntProperty("last_lir_id",
+ LifetimePosition::InstructionFromInstructionIndex(
+ last_index).value());
}
{
@@ -644,10 +455,9 @@
os_ << " ";
PrintType(node);
}
- if (positions != NULL) {
+ if (positions != nullptr) {
SourcePosition position = positions->GetSourcePosition(node);
- if (!position.IsUnknown()) {
- DCHECK(!position.IsInvalid());
+ if (position.IsKnown()) {
os_ << " pos:" << position.raw();
}
}
@@ -658,17 +468,16 @@
if (control != BasicBlock::kNone) {
PrintIndent();
os_ << "0 0 ";
- if (current->control_input() != NULL) {
+ if (current->control_input() != nullptr) {
PrintNode(current->control_input());
} else {
- os_ << -1 - current->id().ToInt() << " Goto";
+ os_ << -1 - current->rpo_number() << " Goto";
}
os_ << " ->";
- for (BasicBlock::Successors::iterator j = current->successors_begin();
- j != current->successors_end(); ++j) {
- os_ << " B" << (*j)->id();
+ for (BasicBlock* successor : current->successors()) {
+ os_ << " B" << successor->rpo_number();
}
- if (FLAG_trace_turbo_types && current->control_input() != NULL) {
+ if (FLAG_trace_turbo_types && current->control_input() != nullptr) {
os_ << " ";
PrintType(current->control_input());
}
@@ -676,13 +485,14 @@
}
}
- if (instructions != NULL) {
+ if (instructions != nullptr) {
Tag LIR_tag(this, "LIR");
for (int j = instruction_block->first_instruction_index();
j <= instruction_block->last_instruction_index(); j++) {
PrintIndent();
- PrintableInstruction printable = {RegisterConfiguration::ArchDefault(),
- instructions->InstructionAt(j)};
+ PrintableInstruction printable = {
+ RegisterConfiguration::ArchDefault(RegisterConfiguration::TURBOFAN),
+ instructions->InstructionAt(j)};
os_ << j << " " << printable << " <|@\n";
}
}
@@ -690,77 +500,80 @@
}
-void GraphC1Visualizer::PrintAllocator(const char* phase,
- const RegisterAllocator* allocator) {
+void GraphC1Visualizer::PrintLiveRanges(const char* phase,
+ const RegisterAllocationData* data) {
Tag tag(this, "intervals");
PrintStringProperty("name", phase);
- for (auto range : allocator->fixed_double_live_ranges()) {
- PrintLiveRange(range, "fixed");
+ for (auto range : data->fixed_double_live_ranges()) {
+ PrintLiveRangeChain(range, "fixed");
}
- for (auto range : allocator->fixed_live_ranges()) {
- PrintLiveRange(range, "fixed");
+ for (auto range : data->fixed_live_ranges()) {
+ PrintLiveRangeChain(range, "fixed");
}
- for (auto range : allocator->live_ranges()) {
- PrintLiveRange(range, "object");
+ for (auto range : data->live_ranges()) {
+ PrintLiveRangeChain(range, "object");
}
}
-void GraphC1Visualizer::PrintLiveRange(LiveRange* range, const char* type) {
- if (range != NULL && !range->IsEmpty()) {
+void GraphC1Visualizer::PrintLiveRangeChain(TopLevelLiveRange* range,
+ const char* type) {
+ if (range == nullptr || range->IsEmpty()) return;
+ int vreg = range->vreg();
+ for (LiveRange* child = range; child != nullptr; child = child->next()) {
+ PrintLiveRange(child, type, vreg);
+ }
+}
+
+
+void GraphC1Visualizer::PrintLiveRange(LiveRange* range, const char* type,
+ int vreg) {
+ if (range != nullptr && !range->IsEmpty()) {
PrintIndent();
- os_ << range->id() << " " << type;
+ os_ << vreg << ":" << range->relative_id() << " " << type;
if (range->HasRegisterAssigned()) {
- InstructionOperand* op = range->CreateAssignedOperand(zone());
- int assigned_reg = op->index();
- if (op->IsDoubleRegister()) {
- os_ << " \"" << DoubleRegister::AllocationIndexToString(assigned_reg)
+ AllocatedOperand op = AllocatedOperand::cast(range->GetAssignedOperand());
+ if (op.IsDoubleRegister()) {
+ DoubleRegister assigned_reg = op.GetDoubleRegister();
+ os_ << " \"" << assigned_reg.ToString() << "\"";
+ } else {
+ DCHECK(op.IsRegister());
+ Register assigned_reg = op.GetRegister();
+ os_ << " \"" << assigned_reg.ToString() << "\"";
+ }
+ } else if (range->spilled()) {
+ auto top = range->TopLevel();
+ int index = -1;
+ if (top->HasSpillRange()) {
+ index = kMaxInt; // This hasn't been set yet.
+ } else if (top->GetSpillOperand()->IsConstant()) {
+ os_ << " \"const(nostack):"
+ << ConstantOperand::cast(top->GetSpillOperand())->virtual_register()
<< "\"";
} else {
- DCHECK(op->IsRegister());
- os_ << " \"" << Register::AllocationIndexToString(assigned_reg) << "\"";
- }
- } else if (range->IsSpilled()) {
- int index = -1;
- if (range->TopLevel()->HasSpillRange()) {
- index = kMaxInt; // This hasn't been set yet.
- } else {
- index = range->TopLevel()->GetSpillOperand()->index();
- }
- if (range->TopLevel()->Kind() == DOUBLE_REGISTERS) {
- os_ << " \"double_stack:" << index << "\"";
- } else if (range->TopLevel()->Kind() == GENERAL_REGISTERS) {
- os_ << " \"stack:" << index << "\"";
- } else {
- os_ << " \"const(nostack):" << index << "\"";
+ index = AllocatedOperand::cast(top->GetSpillOperand())->index();
+ if (top->kind() == DOUBLE_REGISTERS) {
+ os_ << " \"double_stack:" << index << "\"";
+ } else if (top->kind() == GENERAL_REGISTERS) {
+ os_ << " \"stack:" << index << "\"";
+ }
}
}
- int parent_index = -1;
- if (range->IsChild()) {
- parent_index = range->parent()->id();
- } else {
- parent_index = range->id();
- }
- InstructionOperand* op = range->FirstHint();
- int hint_index = -1;
- if (op != NULL && op->IsUnallocated()) {
- hint_index = UnallocatedOperand::cast(op)->virtual_register();
- }
- os_ << " " << parent_index << " " << hint_index;
- UseInterval* cur_interval = range->first_interval();
- while (cur_interval != NULL && range->Covers(cur_interval->start())) {
- os_ << " [" << cur_interval->start().Value() << ", "
- << cur_interval->end().Value() << "[";
- cur_interval = cur_interval->next();
+
+ os_ << " " << vreg;
+ for (auto interval = range->first_interval(); interval != nullptr;
+ interval = interval->next()) {
+ os_ << " [" << interval->start().value() << ", "
+ << interval->end().value() << "[";
}
UsePosition* current_pos = range->first_pos();
- while (current_pos != NULL) {
+ while (current_pos != nullptr) {
if (current_pos->RegisterIsBeneficial() || FLAG_trace_all_uses) {
- os_ << " " << current_pos->pos().Value() << " M";
+ os_ << " " << current_pos->pos().value() << " M";
}
current_pos = current_pos->next();
}
@@ -771,23 +584,24 @@
std::ostream& operator<<(std::ostream& os, const AsC1VCompilation& ac) {
- Zone tmp_zone(ac.info_->isolate());
+ Zone tmp_zone;
GraphC1Visualizer(os, &tmp_zone).PrintCompilation(ac.info_);
return os;
}
std::ostream& operator<<(std::ostream& os, const AsC1V& ac) {
- Zone tmp_zone(ac.schedule_->zone()->isolate());
+ Zone tmp_zone;
GraphC1Visualizer(os, &tmp_zone)
.PrintSchedule(ac.phase_, ac.schedule_, ac.positions_, ac.instructions_);
return os;
}
-std::ostream& operator<<(std::ostream& os, const AsC1VAllocator& ac) {
- Zone tmp_zone(ac.allocator_->code()->zone()->isolate());
- GraphC1Visualizer(os, &tmp_zone).PrintAllocator(ac.phase_, ac.allocator_);
+std::ostream& operator<<(std::ostream& os,
+ const AsC1VRegisterAllocationData& ac) {
+ Zone tmp_zone;
+ GraphC1Visualizer(os, &tmp_zone).PrintLiveRanges(ac.phase_, ac.data_);
return os;
}
@@ -796,7 +610,7 @@
const int kVisited = 2;
std::ostream& operator<<(std::ostream& os, const AsRPO& ar) {
- Zone local_zone(ar.graph.zone()->isolate());
+ Zone local_zone;
ZoneVector<byte> state(ar.graph.NodeCount(), kUnvisited, &local_zone);
ZoneStack<Node*> stack(&local_zone);
@@ -816,7 +630,7 @@
if (pop) {
state[n->id()] = kVisited;
stack.pop();
- os << "#" << SafeId(n) << ":" << SafeMnemonic(n) << "(";
+ os << "#" << n->id() << ":" << *n->op() << "(";
int j = 0;
for (Node* const i : n->inputs()) {
if (j++ > 0) os << ", ";
@@ -827,6 +641,6 @@
}
return os;
}
-}
-}
-} // namespace v8::internal::compiler
+} // namespace compiler
+} // namespace internal
+} // namespace v8