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

Unified Diff: src/compiler/graph.cc

Issue 509343002: Better typing and type verification (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 months 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/graph.cc
diff --git a/src/compiler/graph.cc b/src/compiler/graph.cc
index 3f47eace8159e9d7ef97566db8bfe39a1e1acc8c..a0ec171aba77668a53076c7981970267da4786d2 100644
--- a/src/compiler/graph.cc
+++ b/src/compiler/graph.cc
@@ -20,17 +20,26 @@ namespace compiler {
Graph::Graph(Zone* zone)
: GenericGraph<Node>(zone),
- decorators_(DecoratorVector::allocator_type(zone)) {}
+ decorators_(DecoratorVector::allocator_type(zone)),
+ is_typed_(false) {}
+
+
+void Graph::Decorate(Node* node) {
+ for (DecoratorVector::iterator i = decorators_.begin();
+ i != decorators_.end(); ++i) {
+ (*i)->Decorate(node);
+ }
+ // Iff the graph is typed, then there _must_ be a decorator to type new nodes.
+ DCHECK(NodeProperties::IsTyped(node) ==
+ (is_typed_ && OperatorProperties::HasValueOutput(node->op())));
+}
Node* Graph::NewNode(Operator* op, int input_count, Node** inputs) {
DCHECK(op->InputCount() <= input_count);
Node* result = Node::New(this, input_count, inputs);
result->Initialize(op);
- for (DecoratorVector::iterator i = decorators_.begin();
- i != decorators_.end(); ++i) {
- (*i)->Decorate(result);
- }
+ Decorate(result);
return result;
}

Powered by Google App Engine
This is Rietveld 408576698