59a02ebdbe
Up until now we used a special Terminate node to artifically connect non terminating loops to the End node, but this was kind of adhoc and didn't work for the CFG. So without all kinds of weird hacks, the end block in the CFG will not be connected to NTLs, which makes it impossible to compute post dominance / control dependence in the current setting. So instead of Terminate, we add a special Branch to NTLs, whose condition is the special Always node, which corresponds to True, except that it cannot be folded away. This way we don't need any special machinery in the scheduler, since it's just a regular Branch. R=titzer@chromium.org Review URL: https://codereview.chromium.org/875263004 Cr-Commit-Position: refs/heads/master@{#26294}
84 lines
2.1 KiB
C++
84 lines
2.1 KiB
C++
// 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.
|
|
|
|
#ifndef V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_
|
|
#define V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_
|
|
|
|
#include "src/compiler/common-operator.h"
|
|
#include "src/compiler/graph.h"
|
|
#include "src/compiler/typer.h"
|
|
#include "test/unittests/test-utils.h"
|
|
#include "testing/gmock/include/gmock/gmock.h"
|
|
|
|
namespace v8 {
|
|
namespace internal {
|
|
|
|
// Forward declarations.
|
|
template <class T>
|
|
class Handle;
|
|
class HeapObject;
|
|
template <class T>
|
|
class Unique;
|
|
|
|
namespace compiler {
|
|
|
|
using ::testing::Matcher;
|
|
|
|
|
|
class GraphTest : public TestWithContext, public TestWithIsolateAndZone {
|
|
public:
|
|
explicit GraphTest(int num_parameters = 1);
|
|
~GraphTest() OVERRIDE;
|
|
|
|
protected:
|
|
Node* start() { return graph()->start(); }
|
|
Node* Parameter(int32_t index = 0);
|
|
Node* Float32Constant(volatile float value);
|
|
Node* Float64Constant(volatile double value);
|
|
Node* Int32Constant(int32_t value);
|
|
Node* Uint32Constant(uint32_t value) {
|
|
return Int32Constant(bit_cast<int32_t>(value));
|
|
}
|
|
Node* Int64Constant(int64_t value);
|
|
Node* NumberConstant(volatile double value);
|
|
Node* HeapConstant(const Handle<HeapObject>& value);
|
|
Node* HeapConstant(const Unique<HeapObject>& value);
|
|
Node* FalseConstant();
|
|
Node* TrueConstant();
|
|
Node* UndefinedConstant();
|
|
|
|
Matcher<Node*> IsFalseConstant();
|
|
Matcher<Node*> IsTrueConstant();
|
|
Matcher<Node*> IsUndefinedConstant();
|
|
|
|
CommonOperatorBuilder* common() { return &common_; }
|
|
Graph* graph() { return &graph_; }
|
|
|
|
private:
|
|
CommonOperatorBuilder common_;
|
|
Graph graph_;
|
|
};
|
|
|
|
|
|
class TypedGraphTest : public GraphTest {
|
|
public:
|
|
explicit TypedGraphTest(int num_parameters = 1);
|
|
~TypedGraphTest() OVERRIDE;
|
|
|
|
protected:
|
|
Node* Parameter(int32_t index = 0) { return GraphTest::Parameter(index); }
|
|
Node* Parameter(Type* type, int32_t index = 0);
|
|
|
|
Typer* typer() { return &typer_; }
|
|
|
|
private:
|
|
Typer typer_;
|
|
};
|
|
|
|
} // namespace compiler
|
|
} // namespace internal
|
|
} // namespace v8
|
|
|
|
#endif // V8_UNITTESTS_COMPILER_GRAPH_UNITTEST_H_
|