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

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

Issue 9646008: Implementing ConstructorCall. (part I) (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
« no previous file with comments | « runtime/vm/flow_graph_compiler_x64.cc ('k') | no next file » | 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) 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 17 matching lines...) Expand all
28 // | StrictCompare <Token::kind> <Value> <Value> 28 // | StrictCompare <Token::kind> <Value> <Value>
29 // | NativeCall <NativeBodyNode> 29 // | NativeCall <NativeBodyNode>
30 // | StoreIndexed <Value> <Value> <Value> 30 // | StoreIndexed <Value> <Value> <Value>
31 // | InstanceSetter <String> <Value> <Value> 31 // | InstanceSetter <String> <Value> <Value>
32 // | LoadInstanceField <LoadInstanceFieldNode> <Value> 32 // | LoadInstanceField <LoadInstanceFieldNode> <Value>
33 // | StoreInstanceField <StoreInstanceFieldNode> <Value> <Value> 33 // | StoreInstanceField <StoreInstanceFieldNode> <Value> <Value>
34 // | LoadStaticField <Field> 34 // | LoadStaticField <Field>
35 // | StoreStaticField <Field> <Value> 35 // | StoreStaticField <Field> <Value>
36 // | BooleanNegate <Value> 36 // | BooleanNegate <Value>
37 // | InstanceOf <Value> <Type> 37 // | InstanceOf <Value> <Type>
38 // | AllocateObject <ConstructorCallNode>
38 // 39 //
39 // <Value> ::= 40 // <Value> ::=
40 // Temp <int> 41 // Temp <int>
41 // | Constant <Instance> 42 // | Constant <Instance>
42 43
43 // M is a two argument macro. It is applied to each concrete value's 44 // M is a two argument macro. It is applied to each concrete value's
44 // typename and classname. 45 // typename and classname.
45 #define FOR_EACH_VALUE(M) \ 46 #define FOR_EACH_VALUE(M) \
46 M(Temp, TempVal) \ 47 M(Temp, TempVal) \
47 M(Constant, ConstantVal) \ 48 M(Constant, ConstantVal) \
(...skipping 10 matching lines...) Expand all
58 M(StoreLocal, StoreLocalComp) \ 59 M(StoreLocal, StoreLocalComp) \
59 M(StrictCompare, StrictCompareComp) \ 60 M(StrictCompare, StrictCompareComp) \
60 M(NativeCall, NativeCallComp) \ 61 M(NativeCall, NativeCallComp) \
61 M(StoreIndexed, StoreIndexedComp) \ 62 M(StoreIndexed, StoreIndexedComp) \
62 M(InstanceSetter, InstanceSetterComp) \ 63 M(InstanceSetter, InstanceSetterComp) \
63 M(LoadInstanceField, LoadInstanceFieldComp) \ 64 M(LoadInstanceField, LoadInstanceFieldComp) \
64 M(StoreInstanceField, StoreInstanceFieldComp) \ 65 M(StoreInstanceField, StoreInstanceFieldComp) \
65 M(LoadStaticField, LoadStaticFieldComp) \ 66 M(LoadStaticField, LoadStaticFieldComp) \
66 M(StoreStaticField, StoreStaticFieldComp) \ 67 M(StoreStaticField, StoreStaticFieldComp) \
67 M(BooleanNegate, BooleanNegateComp) \ 68 M(BooleanNegate, BooleanNegateComp) \
68 M(InstanceOf, InstanceOfComp) 69 M(InstanceOf, InstanceOfComp) \
70 M(AllocateObject, AllocateObjectComp)
69 71
70 72
71 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName; 73 #define FORWARD_DECLARATION(ShortName, ClassName) class ClassName;
72 FOR_EACH_COMPUTATION(FORWARD_DECLARATION) 74 FOR_EACH_COMPUTATION(FORWARD_DECLARATION)
73 #undef FORWARD_DECLARATION 75 #undef FORWARD_DECLARATION
74 76
75 class Computation : public ZoneAllocated { 77 class Computation : public ZoneAllocated {
76 public: 78 public:
77 Computation() { } 79 Computation() { }
78 80
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 122
121 private: 123 private:
122 const intptr_t index_; 124 const intptr_t index_;
123 125
124 DISALLOW_COPY_AND_ASSIGN(TempVal); 126 DISALLOW_COPY_AND_ASSIGN(TempVal);
125 }; 127 };
126 128
127 129
128 class ConstantVal: public Value { 130 class ConstantVal: public Value {
129 public: 131 public:
130 explicit ConstantVal(const Instance& instance) : instance_(instance) { 132 explicit ConstantVal(const Object& value) : value_(value) {
131 ASSERT(instance.IsZoneHandle()); 133 ASSERT(value.IsZoneHandle());
srdjan 2012/03/09 02:37:47 This is needed in order to pass types as arguments
132 } 134 }
133 135
134 DECLARE_VALUE(Constant) 136 DECLARE_VALUE(Constant)
135 137
136 const Instance& instance() const { return instance_; } 138 const Object& value() const { return value_; }
137 139
138 private: 140 private:
139 const Instance& instance_; 141 const Object& value_;
140 142
141 DISALLOW_COPY_AND_ASSIGN(ConstantVal); 143 DISALLOW_COPY_AND_ASSIGN(ConstantVal);
142 }; 144 };
143 145
144 #undef DECLARE_VALUE 146 #undef DECLARE_VALUE
145 147
146 148
147 class AssertAssignableComp : public Computation { 149 class AssertAssignableComp : public Computation {
148 public: 150 public:
149 AssertAssignableComp(Value* value, const AbstractType& type) 151 AssertAssignableComp(Value* value, const AbstractType& type)
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 const Token::Kind kind_; 222 const Token::Kind kind_;
221 Value* left_; 223 Value* left_;
222 Value* right_; 224 Value* right_;
223 225
224 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp); 226 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp);
225 }; 227 };
226 228
227 229
228 class StaticCallComp : public Computation { 230 class StaticCallComp : public Computation {
229 public: 231 public:
230 StaticCallComp(StaticCallNode* node, ZoneGrowableArray<Value*>* arguments) 232 StaticCallComp(intptr_t token_index,
231 : ast_node_(*node), arguments_(arguments) { } 233 const Function& function,
234 const Array& argument_names,
235 ZoneGrowableArray<Value*>* arguments)
236 : token_index_(token_index),
237 function_(function),
238 argument_names_(argument_names),
239 arguments_(arguments) {
240 ASSERT(function.IsZoneHandle());
241 ASSERT(argument_names.IsZoneHandle());
242 }
232 243
233 DECLARE_COMPUTATION(StaticCall) 244 DECLARE_COMPUTATION(StaticCall)
234 245
235 // Accessors forwarded to the AST node. 246 // Accessors forwarded to the AST node.
236 const Function& function() const { return ast_node_.function(); } 247 const Function& function() const { return function_; }
237 const Array& argument_names() const { return ast_node_.arguments()->names(); } 248 const Array& argument_names() const { return argument_names_; }
238 intptr_t token_index() const { return ast_node_.token_index(); } 249 intptr_t token_index() const { return token_index_; }
239 250
240 int ArgumentCount() const { return arguments_->length(); } 251 int ArgumentCount() const { return arguments_->length(); }
241 Value* ArgumentAt(int index) const { return (*arguments_)[index]; } 252 Value* ArgumentAt(int index) const { return (*arguments_)[index]; }
242 253
243 private: 254 private:
244 const StaticCallNode& ast_node_; 255 const intptr_t token_index_;
256 const Function& function_;
257 const Array& argument_names_;
245 ZoneGrowableArray<Value*>* arguments_; 258 ZoneGrowableArray<Value*>* arguments_;
246 259
247 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); 260 DISALLOW_COPY_AND_ASSIGN(StaticCallComp);
248 }; 261 };
249 262
250 263
251 class LoadLocalComp : public Computation { 264 class LoadLocalComp : public Computation {
252 public: 265 public:
253 explicit LoadLocalComp(const LocalVariable& local) : local_(local) { } 266 explicit LoadLocalComp(const LocalVariable& local) : local_(local) { }
254 267
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 const intptr_t node_id_; 516 const intptr_t node_id_;
504 const intptr_t token_index_; 517 const intptr_t token_index_;
505 Value* value_; 518 Value* value_;
506 const AbstractType& type_; 519 const AbstractType& type_;
507 const bool negate_result_; 520 const bool negate_result_;
508 521
509 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp); 522 DISALLOW_COPY_AND_ASSIGN(InstanceOfComp);
510 }; 523 };
511 524
512 525
526 class AllocateObjectComp : public Computation {
527 public:
528 explicit AllocateObjectComp(ConstructorCallNode* node) : ast_node_(*node) {}
srdjan 2012/03/09 02:37:47 Will add two Values: type arguments and instantiat
srdjan 2012/03/09 22:40:48 Changed opinion: adding an array of values (lebgth
529
530 DECLARE_COMPUTATION(AllocateObjectComp)
531
532 const Function& constructor() const { return ast_node_.constructor(); }
533 intptr_t token_index() const { return ast_node_.token_index(); }
534
535 private:
536 const ConstructorCallNode& ast_node_;
537
538 DISALLOW_COPY_AND_ASSIGN(AllocateObjectComp);
539 };
540
541
513 #undef DECLARE_COMPUTATION 542 #undef DECLARE_COMPUTATION
514 543
515 544
516 // Instructions. 545 // Instructions.
517 // 546 //
518 // <Instruction> ::= JoinEntry <Instruction> 547 // <Instruction> ::= JoinEntry <Instruction>
519 // | TargetEntry <Instruction> 548 // | TargetEntry <Instruction>
520 // | PickTemp <int> <int> <Instruction> 549 // | PickTemp <int> <int> <Instruction>
521 // | TuckTemp <int> <int> <Instruction> 550 // | TuckTemp <int> <int> <Instruction>
522 // | Do <Computation> <Instruction> 551 // | Do <Computation> <Instruction>
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 #undef DECLARE_VISIT_INSTRUCTION 881 #undef DECLARE_VISIT_INSTRUCTION
853 882
854 private: 883 private:
855 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 884 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
856 }; 885 };
857 886
858 887
859 } // namespace dart 888 } // namespace dart
860 889
861 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 890 #endif // VM_INTERMEDIATE_LANGUAGE_H_
OLDNEW
« no previous file with comments | « 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