Commit 5bba6b20 authored by titzer@chromium.org's avatar titzer@chromium.org

Make visualizer robust to graphs with NULL inputs.

R=mstarzinger@chromium.org, jarin@chromium.org
BUG=

Review URL: https://codereview.chromium.org/652263002

Cr-Commit-Position: refs/heads/master@{#25084}
git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@25084 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 3d62e24c
......@@ -34,8 +34,8 @@ class GenericGraph : public GenericGraphBase {
explicit GenericGraph(Zone* zone)
: GenericGraphBase(zone), start_(NULL), end_(NULL) {}
V* start() { return start_; }
V* end() { return end_; }
V* start() const { return start_; }
V* end() const { return end_; }
void SetStart(V* start) { start_ = start; }
void SetEnd(V* end) { end_ = end; }
......
This diff is collapsed.
......@@ -60,6 +60,7 @@
'compiler/test-control-reducer.cc',
'compiler/test-gap-resolver.cc',
'compiler/test-graph-reducer.cc',
'compiler/test-graph-visualizer.cc',
'compiler/test-instruction.cc',
'compiler/test-js-context-specialization.cc',
'compiler/test-js-constant-cache.cc',
......
// Copyright 2014 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/v8.h"
#include "test/cctest/cctest.h"
#include "src/compiler/common-operator.h"
#include "src/compiler/generic-node-inl.h"
#include "src/compiler/generic-node.h"
#include "src/compiler/graph.h"
#include "src/compiler/graph-visualizer.h"
#include "src/compiler/js-operator.h"
#include "src/compiler/machine-operator.h"
#include "src/compiler/node.h"
#include "src/compiler/operator.h"
#include "src/compiler/schedule.h"
#include "src/compiler/scheduler.h"
#include "src/compiler/verifier.h"
using namespace v8::internal;
using namespace v8::internal::compiler;
TEST(NodeWithNullInputReachableFromEnd) {
HandleAndZoneScope scope;
Graph graph(scope.main_zone());
CommonOperatorBuilder common(scope.main_zone());
Node* start = graph.NewNode(common.Start(0));
graph.SetStart(start);
Node* k = graph.NewNode(common.Int32Constant(0));
Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start);
phi->ReplaceInput(0, NULL);
graph.SetEnd(phi);
OFStream os(stdout);
os << AsDOT(graph);
os << AsJSON(graph);
}
TEST(NodeWithNullControlReachableFromEnd) {
HandleAndZoneScope scope;
Graph graph(scope.main_zone());
CommonOperatorBuilder common(scope.main_zone());
Node* start = graph.NewNode(common.Start(0));
graph.SetStart(start);
Node* k = graph.NewNode(common.Int32Constant(0));
Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start);
phi->ReplaceInput(1, NULL);
graph.SetEnd(phi);
OFStream os(stdout);
os << AsDOT(graph);
os << AsJSON(graph);
}
TEST(NodeWithNullInputReachableFromStart) {
HandleAndZoneScope scope;
Graph graph(scope.main_zone());
CommonOperatorBuilder common(scope.main_zone());
Node* start = graph.NewNode(common.Start(0));
graph.SetStart(start);
Node* k = graph.NewNode(common.Int32Constant(0));
Node* phi = graph.NewNode(common.Phi(kMachAnyTagged, 1), k, start);
phi->ReplaceInput(0, NULL);
graph.SetEnd(start);
OFStream os(stdout);
os << AsDOT(graph);
os << AsJSON(graph);
}
TEST(NodeWithNullControlReachableFromStart) {
HandleAndZoneScope scope;
Graph graph(scope.main_zone());
CommonOperatorBuilder common(scope.main_zone());
Node* start = graph.NewNode(common.Start(0));
graph.SetStart(start);
Node* merge = graph.NewNode(common.Merge(2), start, start);
merge->ReplaceInput(1, NULL);
graph.SetEnd(merge);
OFStream os(stdout);
os << AsDOT(graph);
os << AsJSON(graph);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment