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

Side by Side Diff: runtime/vm/ast.h

Issue 154393003: Implement eager instantiation and canonicalization of type arguments at run (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 10 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_AST_H_ 5 #ifndef VM_AST_H_
6 #define VM_AST_H_ 6 #define VM_AST_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 292
293 private: 293 private:
294 const AbstractType& type_; 294 const AbstractType& type_;
295 GrowableArray<AstNode*> elements_; 295 GrowableArray<AstNode*> elements_;
296 296
297 void CheckFields() { 297 void CheckFields() {
298 ASSERT(type_.IsZoneHandle()); 298 ASSERT(type_.IsZoneHandle());
299 ASSERT(!type_.IsNull()); 299 ASSERT(!type_.IsNull());
300 ASSERT(type_.IsFinalized()); 300 ASSERT(type_.IsFinalized());
301 // Type may be uninstantiated when creating a generic list literal. 301 // Type may be uninstantiated when creating a generic list literal.
302 ASSERT((type_.arguments() == AbstractTypeArguments::null()) || 302 ASSERT((type_.arguments() == TypeArguments::null()) ||
303 ((AbstractTypeArguments::Handle(type_.arguments()).Length() == 1))); 303 ((TypeArguments::Handle(type_.arguments()).Length() == 1)));
304 } 304 }
305 305
306 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayNode); 306 DISALLOW_IMPLICIT_CONSTRUCTORS(ArrayNode);
307 }; 307 };
308 308
309 309
310 class StringInterpolateNode : public AstNode { 310 class StringInterpolateNode : public AstNode {
311 public: 311 public:
312 StringInterpolateNode(intptr_t token_pos, ArrayNode* value) 312 StringInterpolateNode(intptr_t token_pos, ArrayNode* value)
313 : AstNode(token_pos), value_(value) { } 313 : AstNode(token_pos), value_(value) { }
(...skipping 1230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1544 // the receiver at an offset in the receiver specified by the provided 1544 // the receiver at an offset in the receiver specified by the provided
1545 // instantiator_class. 1545 // instantiator_class.
1546 // 1546 //
1547 // If the caller to the constructor or to the factory is a factory, then the 1547 // If the caller to the constructor or to the factory is a factory, then the
1548 // instantiator is the first parameter of this factory, which is already a 1548 // instantiator is the first parameter of this factory, which is already a
1549 // type argument vector. This case is identified by a null and unneeded 1549 // type argument vector. This case is identified by a null and unneeded
1550 // instantiator_class. 1550 // instantiator_class.
1551 class ConstructorCallNode : public AstNode { 1551 class ConstructorCallNode : public AstNode {
1552 public: 1552 public:
1553 ConstructorCallNode(intptr_t token_pos, 1553 ConstructorCallNode(intptr_t token_pos,
1554 const AbstractTypeArguments& type_arguments, 1554 const TypeArguments& type_arguments,
1555 const Function& constructor, 1555 const Function& constructor,
1556 ArgumentListNode* arguments) 1556 ArgumentListNode* arguments)
1557 : AstNode(token_pos), 1557 : AstNode(token_pos),
1558 type_arguments_(type_arguments), 1558 type_arguments_(type_arguments),
1559 constructor_(constructor), 1559 constructor_(constructor),
1560 arguments_(arguments) { 1560 arguments_(arguments) {
1561 ASSERT(type_arguments_.IsZoneHandle()); 1561 ASSERT(type_arguments_.IsZoneHandle());
1562 ASSERT(constructor_.IsZoneHandle()); 1562 ASSERT(constructor_.IsZoneHandle());
1563 ASSERT(arguments_ != NULL); 1563 ASSERT(arguments_ != NULL);
1564 } 1564 }
1565 1565
1566 const AbstractTypeArguments& type_arguments() const { 1566 const TypeArguments& type_arguments() const {
1567 return type_arguments_; 1567 return type_arguments_;
1568 } 1568 }
1569 const Function& constructor() const { return constructor_; } 1569 const Function& constructor() const { return constructor_; }
1570 ArgumentListNode* arguments() const { return arguments_; } 1570 ArgumentListNode* arguments() const { return arguments_; }
1571 1571
1572 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1572 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1573 arguments()->Visit(visitor); 1573 arguments()->Visit(visitor);
1574 } 1574 }
1575 1575
1576 DECLARE_COMMON_NODE_FUNCTIONS(ConstructorCallNode); 1576 DECLARE_COMMON_NODE_FUNCTIONS(ConstructorCallNode);
1577 1577
1578 private: 1578 private:
1579 const AbstractTypeArguments& type_arguments_; 1579 const TypeArguments& type_arguments_;
1580 const Function& constructor_; 1580 const Function& constructor_;
1581 ArgumentListNode* arguments_; 1581 ArgumentListNode* arguments_;
1582 1582
1583 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode); 1583 DISALLOW_IMPLICIT_CONSTRUCTORS(ConstructorCallNode);
1584 }; 1584 };
1585 1585
1586 1586
1587 // The body of a Dart function marked as 'native' consists of this node. 1587 // The body of a Dart function marked as 'native' consists of this node.
1588 class NativeBodyNode : public AstNode { 1588 class NativeBodyNode : public AstNode {
1589 public: 1589 public:
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
1786 const intptr_t try_index_; 1786 const intptr_t try_index_;
1787 1787
1788 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1788 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1789 }; 1789 };
1790 1790
1791 } // namespace dart 1791 } // namespace dart
1792 1792
1793 #undef DECLARE_COMMON_NODE_FUNCTIONS 1793 #undef DECLARE_COMMON_NODE_FUNCTIONS
1794 1794
1795 #endif // VM_AST_H_ 1795 #endif // VM_AST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698