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

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

Issue 8234016: Inline allocation of implicit closures. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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
« no previous file with comments | « no previous file | runtime/vm/ast_printer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/assert.h" 9 #include "vm/assert.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 20 matching lines...) Expand all
31 V(IfNode, "if") \ 31 V(IfNode, "if") \
32 V(SwitchNode, "switch") \ 32 V(SwitchNode, "switch") \
33 V(CaseNode, "case") \ 33 V(CaseNode, "case") \
34 V(WhileNode, "while") \ 34 V(WhileNode, "while") \
35 V(DoWhileNode, "dowhile") \ 35 V(DoWhileNode, "dowhile") \
36 V(ForNode, "for") \ 36 V(ForNode, "for") \
37 V(JumpNode, "jump") \ 37 V(JumpNode, "jump") \
38 V(ArgumentListNode, "args") \ 38 V(ArgumentListNode, "args") \
39 V(ArrayNode, "array") \ 39 V(ArrayNode, "array") \
40 V(ClosureNode, "closure") \ 40 V(ClosureNode, "closure") \
41 V(ImplicitClosureNode, "implicit closure") \ 41 V(ImplicitInstanceClosureNode, "implicit instance closure") \
42 V(StaticImplicitClosureNode, "static implicit closure") \ 42 V(ImplicitStaticClosureNode, "implicit static closure") \
43 V(InstanceCallNode, "instance call") \ 43 V(InstanceCallNode, "instance call") \
44 V(StaticCallNode, "static call") \ 44 V(StaticCallNode, "static call") \
45 V(ClosureCallNode, "closure call") \ 45 V(ClosureCallNode, "closure call") \
46 V(ConstructorCallNode, "constructor call") \ 46 V(ConstructorCallNode, "constructor call") \
47 V(InstanceGetterNode, "instance getter call") \ 47 V(InstanceGetterNode, "instance getter call") \
48 V(InstanceSetterNode, "instance setter call") \ 48 V(InstanceSetterNode, "instance setter call") \
49 V(StaticGetterNode, "static getter") \ 49 V(StaticGetterNode, "static getter") \
50 V(StaticSetterNode, "static setter") \ 50 V(StaticSetterNode, "static setter") \
51 V(NativeBodyNode, "native body") \ 51 V(NativeBodyNode, "native body") \
52 V(PrimaryNode, "primary") \ 52 V(PrimaryNode, "primary") \
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 359
360 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode); 360 DISALLOW_IMPLICIT_CONSTRUCTORS(TypeNode);
361 }; 361 };
362 362
363 363
364 class ClosureNode : public AstNode { 364 class ClosureNode : public AstNode {
365 public: 365 public:
366 ClosureNode(intptr_t token_index, const Function& function, LocalScope* scope) 366 ClosureNode(intptr_t token_index, const Function& function, LocalScope* scope)
367 : AstNode(token_index), function_(function), scope_(scope) { 367 : AstNode(token_index), function_(function), scope_(scope) {
368 ASSERT(function.IsZoneHandle()); 368 ASSERT(function.IsZoneHandle());
369 ASSERT(function.IsNonImplicitClosureFunction());
369 ASSERT(scope_ != NULL); 370 ASSERT(scope_ != NULL);
370 } 371 }
371 372
372 const Function& function() const { return function_; } 373 const Function& function() const { return function_; }
373 LocalScope* scope() const { return scope_; } 374 LocalScope* scope() const { return scope_; }
374 375
375 virtual void VisitChildren(AstNodeVisitor* visitor) const { } 376 virtual void VisitChildren(AstNodeVisitor* visitor) const { }
376 377
377 DECLARE_COMMON_NODE_FUNCTIONS(ClosureNode); 378 DECLARE_COMMON_NODE_FUNCTIONS(ClosureNode);
378 379
379 private: 380 private:
380 const Function& function_; 381 const Function& function_;
381 LocalScope* scope_; 382 LocalScope* scope_;
382 383
383 DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode); 384 DISALLOW_IMPLICIT_CONSTRUCTORS(ClosureNode);
384 }; 385 };
385 386
386 387
387 class StaticImplicitClosureNode : public AstNode { 388 class ImplicitStaticClosureNode : public AstNode {
388 public: 389 public:
389 StaticImplicitClosureNode(intptr_t token_index, const Function& function) 390 ImplicitStaticClosureNode(intptr_t token_index, const Function& function)
390 : AstNode(token_index), function_(function) { 391 : AstNode(token_index), function_(function) {
391 ASSERT(function.IsZoneHandle()); 392 ASSERT(function.IsZoneHandle());
393 ASSERT(function.IsImplicitStaticClosureFunction());
392 } 394 }
393 395
394 const Function& function() const { return function_; } 396 const Function& function() const { return function_; }
395 397
396 virtual void VisitChildren(AstNodeVisitor* visitor) const { } 398 virtual void VisitChildren(AstNodeVisitor* visitor) const { }
397 399
398 DECLARE_COMMON_NODE_FUNCTIONS(StaticImplicitClosureNode); 400 DECLARE_COMMON_NODE_FUNCTIONS(ImplicitStaticClosureNode);
399 401
400 private: 402 private:
401 const Function& function_; 403 const Function& function_;
402 404
403 DISALLOW_IMPLICIT_CONSTRUCTORS(StaticImplicitClosureNode); 405 DISALLOW_IMPLICIT_CONSTRUCTORS(ImplicitStaticClosureNode);
404 }; 406 };
405 407
406 408
407 class ImplicitClosureNode : public AstNode { 409 class ImplicitInstanceClosureNode : public AstNode {
408 public: 410 public:
409 ImplicitClosureNode(intptr_t token_index, 411 ImplicitInstanceClosureNode(intptr_t token_index,
410 const Function& function, 412 const Function& function,
411 AstNode* receiver) 413 AstNode* receiver)
412 : AstNode(token_index), function_(function), receiver_(receiver) { 414 : AstNode(token_index), function_(function), receiver_(receiver) {
413 ASSERT(function.IsZoneHandle()); 415 ASSERT(function.IsZoneHandle());
416 ASSERT(function.IsImplicitInstanceClosureFunction());
414 } 417 }
415 418
416 const Function& function() const { return function_; } 419 const Function& function() const { return function_; }
417 AstNode* receiver() const { return receiver_; } 420 AstNode* receiver() const { return receiver_; }
418 421
419 virtual void VisitChildren(AstNodeVisitor* visitor) const { 422 virtual void VisitChildren(AstNodeVisitor* visitor) const {
420 if (receiver() != NULL) { 423 if (receiver() != NULL) {
421 receiver()->Visit(visitor); 424 receiver()->Visit(visitor);
422 } 425 }
423 } 426 }
424 427
425 DECLARE_COMMON_NODE_FUNCTIONS(ImplicitClosureNode); 428 DECLARE_COMMON_NODE_FUNCTIONS(ImplicitInstanceClosureNode);
426 429
427 private: 430 private:
428 const Function& function_; 431 const Function& function_;
429 AstNode* receiver_; 432 AstNode* receiver_;
430 433
431 DISALLOW_IMPLICIT_CONSTRUCTORS(ImplicitClosureNode); 434 DISALLOW_IMPLICIT_CONSTRUCTORS(ImplicitInstanceClosureNode);
432 }; 435 };
433 436
434 437
435 // Primary nodes hold identifiers or values (library, class or function) 438 // Primary nodes hold identifiers or values (library, class or function)
436 // resolved from an identifier. Primary nodes should not ever make it to the 439 // resolved from an identifier. Primary nodes should not ever make it to the
437 // code generation phase as they will be transformed into the correct call or 440 // code generation phase as they will be transformed into the correct call or
438 // field access nodes. 441 // field access nodes.
439 class PrimaryNode : public AstNode { 442 class PrimaryNode : public AstNode {
440 public: 443 public:
441 PrimaryNode(intptr_t token_index, const Object& primary) 444 PrimaryNode(intptr_t token_index, const Object& primary)
(...skipping 1467 matching lines...) Expand 10 before | Expand all | Expand 10 after
1909 const LocalVariable& context_var_; 1912 const LocalVariable& context_var_;
1910 1913
1911 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 1914 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
1912 }; 1915 };
1913 1916
1914 } // namespace dart 1917 } // namespace dart
1915 1918
1916 #undef DECLARE_COMMON_NODE_FUNCTIONS 1919 #undef DECLARE_COMMON_NODE_FUNCTIONS
1917 1920
1918 #endif // VM_AST_H_ 1921 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast_printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698