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

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

Issue 9700003: Implement more of allocation code using type arguments. Type argument extraction for non-factories … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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_INTERMEDIATE_LANGUAGE_H_ 5 #ifndef VM_INTERMEDIATE_LANGUAGE_H_
6 #define VM_INTERMEDIATE_LANGUAGE_H_ 6 #define VM_INTERMEDIATE_LANGUAGE_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/ast.h" 9 #include "vm/ast.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 22 matching lines...) Expand all
33 // | InstanceSetter <String> <Value> <Value> 33 // | InstanceSetter <String> <Value> <Value>
34 // | LoadInstanceField <LoadInstanceFieldNode> <Value> 34 // | LoadInstanceField <LoadInstanceFieldNode> <Value>
35 // | StoreInstanceField <StoreInstanceFieldNode> <Value> <Value> 35 // | StoreInstanceField <StoreInstanceFieldNode> <Value> <Value>
36 // | LoadStaticField <Field> 36 // | LoadStaticField <Field>
37 // | StoreStaticField <Field> <Value> 37 // | StoreStaticField <Field> <Value>
38 // | BooleanNegate <Value> 38 // | BooleanNegate <Value>
39 // | InstanceOf <Value> <Type> 39 // | InstanceOf <Value> <Type>
40 // | CreateArray <ArrayNode> <Value> ... 40 // | CreateArray <ArrayNode> <Value> ...
41 // | CreateClosure <ClosureNode> 41 // | CreateClosure <ClosureNode>
42 // | AllocateObject <ConstructorCallNode> 42 // | AllocateObject <ConstructorCallNode>
43 // | NativeLoadField <Value> <intptr_t>
44 // | ExtractTypeArgumentsComp <ConstructorCallNode> <Value>
43 // 45 //
44 // <Value> ::= 46 // <Value> ::=
45 // Temp <int> 47 // Temp <int>
46 // | Constant <Instance> 48 // | Constant <Instance>
47 49
48 // M is a two argument macro. It is applied to each concrete value's 50 // M is a two argument macro. It is applied to each concrete value's
49 // typename and classname. 51 // typename and classname.
50 #define FOR_EACH_VALUE(M) \ 52 #define FOR_EACH_VALUE(M) \
51 M(Temp, TempVal) \ 53 M(Temp, TempVal) \
52 M(Constant, ConstantVal) \ 54 M(Constant, ConstantVal) \
(...skipping 16 matching lines...) Expand all
69 M(InstanceSetter, InstanceSetterComp) \ 71 M(InstanceSetter, InstanceSetterComp) \
70 M(LoadInstanceField, LoadInstanceFieldComp) \ 72 M(LoadInstanceField, LoadInstanceFieldComp) \
71 M(StoreInstanceField, StoreInstanceFieldComp) \ 73 M(StoreInstanceField, StoreInstanceFieldComp) \
72 M(LoadStaticField, LoadStaticFieldComp) \ 74 M(LoadStaticField, LoadStaticFieldComp) \
73 M(StoreStaticField, StoreStaticFieldComp) \ 75 M(StoreStaticField, StoreStaticFieldComp) \
74 M(BooleanNegate, BooleanNegateComp) \ 76 M(BooleanNegate, BooleanNegateComp) \
75 M(InstanceOf, InstanceOfComp) \ 77 M(InstanceOf, InstanceOfComp) \
76 M(CreateArray, CreateArrayComp) \ 78 M(CreateArray, CreateArrayComp) \
77 M(CreateClosure, CreateClosureComp) \ 79 M(CreateClosure, CreateClosureComp) \
78 M(AllocateObject, AllocateObjectComp) \ 80 M(AllocateObject, AllocateObjectComp) \
81 M(NativeLoadField, NativeLoadFieldComp) \
82 M(ExtractTypeArguments, ExtractTypeArgumentsComp) \
79 83
80 84
81 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; 85 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName;
82 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) 86 FOR_EACH_COMPUTATION(FORWARD_DECLARATION)
83 #undef FORWARD_DECLARATION 87 #undef FORWARD_DECLARATION
84 88
85 class Computation : public ZoneAllocated { 89 class Computation : public ZoneAllocated {
86 public: 90 public:
87 Computation() { } 91 Computation() { }
88 92
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
628 intptr_t token_index() const { return ast_node_.token_index(); } 632 intptr_t token_index() const { return ast_node_.token_index(); }
629 const Function& function() const { return ast_node_.function(); } 633 const Function& function() const { return ast_node_.function(); }
630 634
631 private: 635 private:
632 const ClosureNode& ast_node_; 636 const ClosureNode& ast_node_;
633 637
634 DISALLOW_COPY_AND_ASSIGN(CreateClosureComp); 638 DISALLOW_COPY_AND_ASSIGN(CreateClosureComp);
635 }; 639 };
636 640
637 641
642 class NativeLoadFieldComp : public Computation {
643 public:
644 NativeLoadFieldComp(Value* value, intptr_t offset_in_bytes)
645 : value_(value), offset_in_bytes_(offset_in_bytes) {
646 ASSERT(value != NULL);
647 }
648
649 DECLARE_COMPUTATION(NativeLoadFieldComp)
650
651 Value* value() const { return value_; }
652 intptr_t offset_in_bytes() const { return offset_in_bytes_; }
653
654 private:
655 Value* value_;
656 intptr_t offset_in_bytes_;
657
658 DISALLOW_COPY_AND_ASSIGN(NativeLoadFieldComp);
659 };
660
661
662 class ExtractTypeArgumentsComp : public Computation {
663 public:
664 ExtractTypeArgumentsComp(ConstructorCallNode* ast_node, Value* instantiator)
665 : ast_node_(*ast_node), instantiator_(instantiator) {
666 ASSERT(instantiator_ != NULL);
667 }
668
669 DECLARE_COMPUTATION(ExtractTypeArgumentsComp)
670
671 Value* instantiator() const { return instantiator_; }
672 const AbstractTypeArguments& type_arguments() const {
673 return ast_node_.type_arguments();
674 }
675 const Function& constructor() const { return ast_node_.constructor(); }
676 intptr_t node_id() const { return ast_node_.id(); }
677 intptr_t token_index() const { return ast_node_.token_index(); }
678
679 private:
680 const ConstructorCallNode& ast_node_;
681 Value* instantiator_;
682
683 DISALLOW_COPY_AND_ASSIGN(ExtractTypeArgumentsComp);
684 };
685
686
638 #undef DECLARE_COMPUTATION 687 #undef DECLARE_COMPUTATION
639 688
640 689
641 // Instructions. 690 // Instructions.
642 // 691 //
643 // <Instruction> ::= JoinEntry <Instruction> 692 // <Instruction> ::= JoinEntry <Instruction>
644 // | TargetEntry <Instruction> 693 // | TargetEntry <Instruction>
645 // | PickTemp <int> <int> <Instruction> 694 // | PickTemp <int> <int> <Instruction>
646 // | TuckTemp <int> <int> <Instruction> 695 // | TuckTemp <int> <int> <Instruction>
647 // | Do <Computation> <Instruction> 696 // | Do <Computation> <Instruction>
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
977 #undef DECLARE_VISIT_INSTRUCTION 1026 #undef DECLARE_VISIT_INSTRUCTION
978 1027
979 private: 1028 private:
980 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1029 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
981 }; 1030 };
982 1031
983 1032
984 } // namespace dart 1033 } // namespace dart
985 1034
986 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1035 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« runtime/vm/flow_graph_builder.h ('K') | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698