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

Unified Diff: src/compiler/escape-analysis.cc

Issue 1457683003: [turbofan] Initial support for escape analysis. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 1 month 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
Index: src/compiler/escape-analysis.cc
diff --git a/src/compiler/escape-analysis.cc b/src/compiler/escape-analysis.cc
new file mode 100644
index 0000000000000000000000000000000000000000..200f017c1cccbbe6b2a01c275083e5cad3a224a7
--- /dev/null
+++ b/src/compiler/escape-analysis.cc
@@ -0,0 +1,705 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/compiler/escape-analysis.h"
+
+#include "src/base/flags.h"
+#include "src/bootstrapper.h"
+#include "src/compilation-dependencies.h"
+#include "src/compiler/common-operator.h"
+#include "src/compiler/graph-reducer.h"
+#include "src/compiler/js-operator.h"
+#include "src/compiler/node.h"
+#include "src/compiler/node-matchers.h"
+#include "src/compiler/node-properties.h"
+#include "src/compiler/simplified-operator.h"
+#include "src/objects-inl.h"
+#include "src/type-cache.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+bool VirtualObject::UpdateFrom(const VirtualObject& other) {
+ bool changed = status_ != other.status_;
+ status_ = other.status_;
+ changed = representation_ != other.representation_ || changed;
+ representation_ = other.representation_;
+ if (fields_.size() != other.fields_.size()) {
+ fields_ = other.fields_;
+ return true;
+ }
+ for (size_t i = 0; i < fields_.size(); ++i) {
+ if (fields_[i] != other.fields_[i]) {
+ changed = true;
+ fields_[i] = other.fields_[i];
+ }
+ }
+ return changed;
+}
+
+
+VirtualState::VirtualState(Zone* zone, size_t size)
+ : info_(zone), last_changed_(nullptr) {
+ info_.resize(size);
+}
+
+
+VirtualState::VirtualState(const VirtualState& states)
+ : info_(states.info_.get_allocator().zone()),
+ last_changed_(states.last_changed_) {
+ info_.resize(states.info_.size());
+ for (size_t i = 0; i < states.info_.size(); ++i) {
+ if (states.info_[i] && states.info_[i]->id() == i) {
+ info_[i] = new (states.info_.get_allocator().zone())
+ VirtualObject(*states.info_[i]);
+ }
+ }
+ for (size_t i = 0; i < states.info_.size(); ++i) {
+ if (states.info_[i] && states.info_[i]->id() != i) {
+ info_[i] = info_[states.info_[i]->id()];
+ }
+ }
+}
+
+
+VirtualObject* VirtualState::GetState(size_t id) { return info_[id]; }
+
+
+VirtualObject* VirtualState::GetState(Node* node) {
+ return GetState(node->id());
+}
+
+
+void VirtualState::SetState(NodeId id, VirtualObject* state) {
+ info_[id] = state;
+}
+
+
+bool VirtualState::UpdateFrom(NodeId id, VirtualObject* new_state, Zone* zone) {
+ VirtualObject* state = GetState(id);
+ if (!state) {
+ state = new (zone) VirtualObject(*new_state);
+ SetState(id, state);
+ if (FLAG_trace_turbo_escape) {
+ PrintF(" Taking field for #%d from %p\n", id,
+ static_cast<void*>(new_state));
+ }
+ return true;
+ }
+
+ if (state->UpdateFrom(*new_state)) {
+ if (FLAG_trace_turbo_escape) {
+ PrintF(" Updating field for #%d from %p\n", id,
+ static_cast<void*>(new_state));
+ }
+ return true;
+ }
+
+ return false;
+}
+
+
+// ------------------------------EscapeStatusAnalysis---------------------------
+
+
+EscapeStatusAnalysis::EscapeStatusAnalysis(Graph* graph, Zone* zone)
+ : graph_(graph), zone_(zone), info_(zone), queue_(zone) {
+ info_.resize(graph->NodeCount());
+}
+
+
+EscapeStatusAnalysis::~EscapeStatusAnalysis() {}
+
+
+bool EscapeStatusAnalysis::HasEntry(Node* node) {
+ return info_[node->id()] != kUnknown;
+}
+
+
+bool EscapeStatusAnalysis::IsVirtual(Node* node) {
+ if (node->id() >= info_.size()) {
+ return false;
+ }
+ return info_[node->id()] == kVirtual;
+}
+
+
+bool EscapeStatusAnalysis::IsEscaped(Node* node) {
+ return info_[node->id()] == kEscaped;
+}
+
+
+bool EscapeStatusAnalysis::SetEscaped(Node* node) {
+ bool changed = info_[node->id()] != kEscaped;
+ info_[node->id()] = kEscaped;
+ return changed;
+}
+
+
+void EscapeStatusAnalysis::Run() {
+ ZoneVector<bool> visited(zone());
+ visited.resize(graph()->NodeCount());
+ queue_.push_back(graph()->end());
+ while (!queue_.empty()) {
+ Node* node = queue_.front();
+ queue_.pop_front();
+ Process(node);
+ if (!visited[node->id()]) {
+ RevisitInputs(node);
+ }
+ visited[node->id()] = true;
+ }
+ if (FLAG_trace_turbo_escape) {
+ DebugPrint();
+ }
+}
+
+
+void EscapeStatusAnalysis::RevisitInputs(Node* node) {
+ for (Edge edge : node->input_edges()) {
+ Node* input = edge.to();
+ queue_.push_back(input);
+ }
+}
+
+
+void EscapeStatusAnalysis::RevisitUses(Node* node) {
+ for (Edge edge : node->use_edges()) {
+ Node* use = edge.from();
+ queue_.push_back(use);
+ }
+}
+
+
+void EscapeStatusAnalysis::Process(Node* node) {
+ switch (node->opcode()) {
+ case IrOpcode::kAllocate:
+ ProcessAllocate(node);
+ break;
+ case IrOpcode::kFinishRegion:
+ ProcessFinishRegion(node);
+ break;
+ case IrOpcode::kStoreField:
+ ProcessStoreField(node);
+ break;
+ case IrOpcode::kPhi:
+ if (!HasEntry(node)) {
+ info_[node->id()] = kVirtual;
+ }
+ CheckUsesForEscape(node);
+ default:
+ break;
+ }
+}
+
+
+void EscapeStatusAnalysis::ProcessStoreField(Node* node) {
+ Node* to = NodeProperties::GetValueInput(node, 0);
+ Node* val = NodeProperties::GetValueInput(node, 1);
+ if (IsEscaped(to) && SetEscaped(val)) {
+ RevisitUses(val);
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Setting #%d (%s) to escaped because of store to field of #%d\n",
+ val->id(), val->op()->mnemonic(), to->id());
+ }
+ }
+}
+
+
+void EscapeStatusAnalysis::ProcessAllocate(Node* node) {
+ DCHECK(node->opcode() == IrOpcode::kAllocate);
+ if (!HasEntry(node)) {
+ info_[node->id()] = kVirtual;
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Created status entry for node #%d (%s)\n", node->id(),
+ node->op()->mnemonic());
+ }
+ NumberMatcher size(node->InputAt(0));
+ if (!size.HasValue() && SetEscaped(node)) {
+ RevisitUses(node);
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Setting #%d to escaped because of non-const alloc\n",
+ node->id());
+ }
+ // This node is known to escape, uses do not have to be checked.
+ return;
+ }
+ }
+ if (CheckUsesForEscape(node)) {
+ RevisitUses(node);
+ }
+}
+
+
+bool EscapeStatusAnalysis::CheckUsesForEscape(Node* node) {
+ DCHECK(HasEntry(node));
+
+ for (Edge edge : node->use_edges()) {
+ Node* use = edge.from();
+ if (!NodeProperties::IsValueEdge(edge)) continue;
+ switch (use->opcode()) {
+ case IrOpcode::kStoreField:
+ case IrOpcode::kLoadField:
+ case IrOpcode::kFrameState:
+ case IrOpcode::kStateValues:
+ case IrOpcode::kReferenceEqual:
+ case IrOpcode::kFinishRegion:
+ case IrOpcode::kPhi:
+ if (HasEntry(use) && IsEscaped(use) && SetEscaped(node)) {
+ if (FLAG_trace_turbo_escape) {
+ PrintF(
+ "Setting #%d (%s) to escaped because of use by escaping node "
+ "#%d (%s)\n",
+ node->id(), node->op()->mnemonic(), use->id(),
+ use->op()->mnemonic());
+ }
+ return true;
+ }
+ break;
+ default:
+ if (SetEscaped(node)) {
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Setting #%d (%s) to escaped because of use by #%d (%s)\n",
+ node->id(), node->op()->mnemonic(), use->id(),
+ use->op()->mnemonic());
+ }
+ return true;
+ }
+ if (use->op()->EffectInputCount() == 0 &&
+ node->op()->EffectInputCount() > 0) {
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Encountered unaccounted use by #%d (%s)\n", use->id(),
+ use->op()->mnemonic());
+ }
+ UNREACHABLE();
+ }
+ }
+ }
+ return false;
+}
+
+
+void EscapeStatusAnalysis::ProcessFinishRegion(Node* node) {
+ DCHECK(node->opcode() == IrOpcode::kFinishRegion);
+ if (!HasEntry(node)) {
+ info_[node->id()] = kVirtual;
+ RevisitUses(node);
+ }
+ if (CheckUsesForEscape(node)) {
+ RevisitInputs(node);
+ }
+}
+
+
+void EscapeStatusAnalysis::DebugPrint() {
+ for (NodeId id = 0; id < info_.size(); id++) {
+ if (info_[id] != kUnknown) {
+ PrintF("Node #%d is %s\n", id,
+ info_[id] == kEscaped ? "escaping" : "virtual");
+ }
+ }
+}
+
+
+// -----------------------------EscapeVirtualAnalysis---------------------------
Michael Starzinger 2015/11/30 10:05:39 nit: s/EscapeVirtualAnalysis/EscapeObjectAnalysis/
sigurds 2015/11/30 13:50:23 Done.
+
+
+EscapeObjectAnalysis::EscapeObjectAnalysis(Graph* graph,
+ CommonOperatorBuilder* common,
+ Zone* zone)
+ : graph_(graph), common_(common), zone_(zone), states_(zone) {
+ states_.resize(graph->NodeCount());
+}
+
+
+EscapeObjectAnalysis::~EscapeObjectAnalysis() {}
+
+
+void EscapeObjectAnalysis::Run() {
+ ZoneVector<Node*> queue_(zone());
+ queue_.push_back(graph()->start());
+ while (!queue_.empty()) {
+ Node* node = queue_.back();
+ queue_.pop_back();
+ if (Process(node)) {
+ for (Edge edge : node->use_edges()) {
+ if (NodeProperties::IsEffectEdge(edge)) {
+ Node* use = edge.from();
+ if (use->opcode() != IrOpcode::kLoadField ||
+ !IsDanglingEffectNode(use)) {
+ queue_.push_back(use);
+ }
+ }
+ }
+ // First process loads: dangling loads are a problem otherwise.
+ for (Edge edge : node->use_edges()) {
+ if (NodeProperties::IsEffectEdge(edge)) {
+ Node* use = edge.from();
+ if (use->opcode() == IrOpcode::kLoadField &&
+ IsDanglingEffectNode(use)) {
+ queue_.push_back(use);
+ }
+ }
+ }
+ }
+ }
+ if (FLAG_trace_turbo_escape) {
+ DebugPrint();
+ }
+}
+
+
+bool EscapeObjectAnalysis::IsDanglingEffectNode(Node* node) {
+ if (node->op()->EffectInputCount() == 0) return false;
+ if (node->op()->EffectOutputCount() == 0) return false;
+ for (Edge edge : node->use_edges()) {
+ if (NodeProperties::IsEffectEdge(edge)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
+bool EscapeObjectAnalysis::Process(Node* node) {
+ switch (node->opcode()) {
+ case IrOpcode::kAllocate:
+ ProcessAllocation(node);
+ break;
+ case IrOpcode::kBeginRegion:
+ ForwardObjectState(node);
+ break;
+ case IrOpcode::kFinishRegion:
+ ProcessFinishRegion(node);
+ break;
+ case IrOpcode::kStoreField:
+ ProcessStoreField(node);
+ break;
+ case IrOpcode::kLoadField:
+ ProcessLoadField(node);
+ break;
+ case IrOpcode::kStart:
+ ProcessStart(node);
+ break;
+ case IrOpcode::kEffectPhi:
+ return ProcessEffectPhi(node);
+ break;
+ default:
+ if (node->op()->EffectInputCount() > 0) {
+ ForwardObjectState(node);
+ }
+ break;
+ }
+ return true;
+}
+
+
+bool EscapeObjectAnalysis::IsEffectBranchPoint(Node* node) {
+ int count = 0;
+ for (Edge edge : node->use_edges()) {
+ Node* use = edge.from();
+ if (NodeProperties::IsEffectEdge(edge) &&
+ use->opcode() != IrOpcode::kLoadField) {
+ ++count;
+ }
+ }
+ return count > 1;
+}
+
+
+void EscapeObjectAnalysis::ForwardObjectState(Node* node) {
+ DCHECK(node->op()->EffectInputCount() == 1);
+ if (node->opcode() != IrOpcode::kLoadField && IsDanglingEffectNode(node)) {
+ PrintF("Dangeling effect node: #%d (%s)\n", node->id(),
+ node->op()->mnemonic());
+ DCHECK(false);
+ }
+ Node* effect = NodeProperties::GetEffectInput(node);
+ // Break the cycle for effect phis.
+ if (effect->opcode() == IrOpcode::kEffectPhi) {
+ if (states_[effect->id()] == nullptr) {
+ states_[effect->id()] =
+ new (zone()) VirtualState(zone(), graph()->NodeCount());
+ }
+ }
+ DCHECK_NOT_NULL(states_[effect->id()]);
+ if (IsEffectBranchPoint(effect)) {
+ if (states_[node->id()]) return;
+ states_[node->id()] = new (zone()) VirtualState(*states_[effect->id()]);
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Copying object state %p from #%d (%s) to #%d (%s)\n",
+ static_cast<void*>(states_[effect->id()]), effect->id(),
+ effect->op()->mnemonic(), node->id(), node->op()->mnemonic());
+ }
+ } else {
+ states_[node->id()] = states_[effect->id()];
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Forwarding object state %p from #%d (%s) to #%d (%s)\n",
+ static_cast<void*>(states_[effect->id()]), effect->id(),
+ effect->op()->mnemonic(), node->id(), node->op()->mnemonic());
+ }
+ }
+}
+
+
+void EscapeObjectAnalysis::ProcessStart(Node* node) {
+ states_[node->id()] = new (zone()) VirtualState(zone(), graph()->NodeCount());
+}
+
+
+bool EscapeObjectAnalysis::ProcessEffectPhi(Node* node) {
+ // For now only support binary phis.
+ DCHECK_EQ(node->op()->EffectInputCount(), 2);
+ Node* left = NodeProperties::GetEffectInput(node, 0);
+ Node* right = NodeProperties::GetEffectInput(node, 1);
+ bool changed = false;
+
+ VirtualState* merge = states_[node->id()];
+ if (!merge) {
+ merge = new (zone()) VirtualState(zone(), graph()->NodeCount());
+ states_[node->id()] = merge;
+ changed = true;
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Phi #%d got new states map %p.\n", node->id(),
+ static_cast<void*>(merge));
+ }
+ } else if (merge->GetLastChanged() != node) {
+ changed = true;
+ }
+ VirtualState* l = states_[left->id()];
+ VirtualState* r = states_[right->id()];
+
+ if (FLAG_trace_turbo_escape) {
+ PrintF("At Phi #%d, merging states %p and %p\n", node->id(),
+ static_cast<void*>(l), static_cast<void*>(r));
+ }
+
+ for (NodeId id = 0; id < states_.size(); ++id) {
+ VirtualObject* ls = l ? l->GetState(id) : nullptr;
+ VirtualObject* rs = r ? r->GetState(id) : nullptr;
+ VirtualObject* state = merge->GetState(id);
+
+ if (ls != nullptr && rs != nullptr) {
+ if (FLAG_trace_turbo_escape) {
+ PrintF(" Merging fields of #%d\n", id);
+ }
+ size_t fields = std::max(ls->fields(), rs->fields());
+
+ if (!state) {
+ state = new (zone()) VirtualObject(id, zone(), fields);
+ merge->SetState(id, state);
+ changed = true;
+ }
+ for (size_t i = 0; i < fields; ++i) {
+ if (ls->GetField(i) == rs->GetField(i)) {
+ changed = state->SetField(i, ls->GetField(i)) || changed;
+ if (FLAG_trace_turbo_escape && ls->GetField(i)) {
+ PrintF(" Field %zu agree on rep #%d\n", i,
+ ls->GetField(i)->id());
+ }
+ } else {
+ Node* phi = graph()->NewNode(common()->Phi(kMachAnyTagged, 2),
+ ls->GetField(i), rs->GetField(i),
+ NodeProperties::GetControlInput(node));
+ if (state->SetField(i, phi)) {
+ if (FLAG_trace_turbo_escape) {
+ PrintF(" Creating Phi #%d as merge of #%d and #%d\n",
+ phi->id(), ls->GetField(i)->id(), rs->GetField(i)->id());
+ }
+ changed = true;
+ }
+ }
+ }
+ } else if (ls != nullptr) {
+ changed = merge->UpdateFrom(id, ls, zone()) || changed;
+ } else if (rs != nullptr) {
+ changed = merge->UpdateFrom(id, rs, zone()) || changed;
+ }
+ }
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Merge %s the node.\n", changed ? "changed" : "did not change");
+ }
+ if (changed) {
+ merge->SetLastChanged(node);
+ }
+ return changed;
+}
+
+
+void EscapeObjectAnalysis::ProcessAllocation(Node* node) {
+ ForwardObjectState(node);
+
+ // Check if we have already processed this node.
+ if (states_[node->id()]->GetState(node)) return;
+
+ NumberMatcher size(node->InputAt(0));
+ if (size.HasValue()) {
+ states_[node->id()]->SetState(
+ node->id(),
+ new (zone()) VirtualObject(node->id(), zone(), size.Value()));
+ } else {
+ states_[node->id()]->SetState(
+ node->id(), new (zone()) VirtualObject(node->id(), zone()));
+ }
+ states_[node->id()]->SetLastChanged(node);
+}
+
+
+void EscapeObjectAnalysis::ProcessFinishRegion(Node* node) {
+ ForwardObjectState(node);
+ Node* allocation = NodeProperties::GetValueInput(node, 0);
+ if (allocation->opcode() == IrOpcode::kAllocate) {
+ VirtualState* states = states_[node->id()];
+ DCHECK_NOT_NULL(states->GetState(allocation));
+ if (!states->GetState(node->id())) {
+ states->SetState(node->id(), states->GetState(allocation));
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Linked finish region node #%d to node #%d\n", node->id(),
+ allocation->id());
+ }
+ states->SetLastChanged(node);
+ }
+ }
+}
+
+
+Node* EscapeObjectAnalysis::representation(Node* at, NodeId id) {
+ VirtualState* states = states_[at->id()];
+ if (VirtualObject* state = states->GetState(id)) {
+ return state->GetRepresentation();
+ }
+ return nullptr;
+}
+
+
+void EscapeObjectAnalysis::ProcessLoadField(Node* node) {
+ ForwardObjectState(node);
+ Node* from = NodeProperties::GetValueInput(node, 0);
+ int offset = OpParameter<FieldAccess>(node).offset;
+ VirtualState* states = states_[node->id()];
+ if (VirtualObject* state = states->GetState(from)) {
+ if (!state->IsTracked()) return;
+ Node* value = state->GetField(offset);
+ if (value) {
+ // Record that the load has has this alias.
+ if (!states->GetState(node)) {
+ states->SetState(node->id(),
+ new (zone()) VirtualObject(node->id(), zone()));
+ }
+ if (states->GetState(node)->SetRepresentation(value)) {
+ states->SetLastChanged(node);
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Representation of #%d is #%d (%s)\n", node->id(), value->id(),
+ value->op()->mnemonic());
+ }
+ }
+ } else if (FLAG_trace_turbo_escape) {
+ PrintF("No field %d on record for #%d\n", offset, from->id());
+ }
+ } else {
+ if (from->opcode() == IrOpcode::kPhi) {
+ // Only binary phis are supported for now.
+ DCHECK_EQ(from->op()->ValueInputCount(), 2);
+ if (FLAG_trace_turbo_escape) {
+ PrintF("Load #%d from phi #%d", node->id(), from->id());
+ }
+ Node* left = NodeProperties::GetValueInput(from, 0);
+ Node* right = NodeProperties::GetValueInput(from, 1);
+ VirtualObject* l = states->GetState(left);
+ VirtualObject* r = states->GetState(right);
+ if (l && r) {
+ Node* lv = l->GetField(offset);
+ Node* rv = r->GetField(offset);
+ if (lv && rv) {
+ if (!states->GetState(node)) {
+ states->SetState(node->id(),
+ new (zone()) VirtualObject(node->id(), zone()));
+ }
+ Node* rep = states->GetState(node)->GetRepresentation();
+ if (!rep || rep->opcode() != IrOpcode::kPhi ||
+ NodeProperties::GetValueInput(rep, 0) != lv ||
+ NodeProperties::GetValueInput(rep, 1) != rv) {
+ Node* phi =
+ graph()->NewNode(common()->Phi(kMachAnyTagged, 2), lv, rv,
+ NodeProperties::GetControlInput(from));
+ states->GetState(node)->SetRepresentation(phi);
+ states->SetLastChanged(node);
+ if (FLAG_trace_turbo_escape) {
+ PrintF(" got phi of #%d is #%d created.\n", lv->id(), rv->id());
+ }
+ } else if (FLAG_trace_turbo_escape) {
+ PrintF(" has already the right phi representation.\n");
+ }
+ } else if (FLAG_trace_turbo_escape) {
+ PrintF(" has incomplete field info: %p %p\n", static_cast<void*>(lv),
+ static_cast<void*>(rv));
+ }
+ } else if (FLAG_trace_turbo_escape) {
+ PrintF(" has incomplete state info: %p %p\n", static_cast<void*>(l),
+ static_cast<void*>(r));
+ }
+ }
+ }
+}
+
+
+void EscapeObjectAnalysis::ProcessStoreField(Node* node) {
+ ForwardObjectState(node);
+ Node* to = NodeProperties::GetValueInput(node, 0);
+ Node* val = NodeProperties::GetValueInput(node, 1);
+ int offset = OpParameter<FieldAccess>(node).offset;
+ VirtualState* states = states_[node->id()];
+ if (VirtualObject* state = states->GetState(to)) {
+ if (!state->IsTracked()) return;
+ Node* resolved_value = val;
+ if (states->GetState(val)) {
+ if (Node* rep = states->GetState(val)->GetRepresentation()) {
+ resolved_value = rep;
+ }
+ }
+ if (state->SetField(offset, resolved_value)) {
+ states->SetLastChanged(node);
+ }
+ }
+}
+
+
+void EscapeObjectAnalysis::DebugPrint() {
+ ZoneVector<VirtualState*> object_states(zone());
+ for (NodeId id = 0; id < states_.size(); id++) {
+ if (VirtualState* states = states_[id]) {
+ if (std::find(object_states.begin(), object_states.end(), states) ==
+ object_states.end()) {
+ object_states.push_back(states);
+ }
+ }
+ }
+ for (size_t n = 0; n < object_states.size(); n++) {
+ PrintF("Dumping object state %p\n", static_cast<void*>(object_states[n]));
+ for (size_t id = 0; id < object_states[n]->size(); id++) {
+ if (VirtualObject* obj = object_states[n]->GetState(id)) {
+ if (obj->id() == id) {
+ PrintF(" Object #%zu with %zu fields", id, obj->fields());
+ if (Node* rep = obj->GetRepresentation()) {
+ PrintF(", rep = #%d (%s)", rep->id(), rep->op()->mnemonic());
+ }
+ PrintF("\n");
+ for (size_t i = 0; i < obj->fields(); ++i) {
+ if (Node* f = obj->GetField(i)) {
+ PrintF(" Field %zu = #%d (%s)\n", i, f->id(),
+ f->op()->mnemonic());
+ }
+ }
+ } else {
+ PrintF(" Object #%zu links to object #%d\n", id, obj->id());
+ }
+ }
+ }
+ }
+}
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8

Powered by Google App Engine
This is Rietveld 408576698