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

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

Issue 9726011: Implement StaticGetter and StaticSetter in new compiler. (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"
11 #include "vm/handles_impl.h" 11 #include "vm/handles_impl.h"
12 #include "vm/object.h" 12 #include "vm/object.h"
13 13
14 namespace dart { 14 namespace dart {
15 15
16 class FlowGraphVisitor; 16 class FlowGraphVisitor;
17 class LocalVariable; 17 class LocalVariable;
18 18
19 // Computations and values.
20 //
21 // <Computation> ::=
22 // <Value>
23 // | AssertAssignable <Value> <AbstractType>
24 // | CurrentContext
25 // | ClosureCall <ClosureCallNode> <Value> <Value> ...
26 // | InstanceCall <String> <Value> ...
27 // | StaticCall <StaticCallNode> <Value> ...
28 // | LoadLocal <LocalVariable>
29 // | StoreLocal <LocalVariable> <Value>
30 // | StrictCompare <Token::kind> <Value> <Value>
31 // | NativeCall <NativeBodyNode>
32 // | StoreIndexed <Value> <Value> <Value>
33 // | InstanceSetter <String> <Value> <Value>
34 // | LoadInstanceField <LoadInstanceFieldNode> <Value>
35 // | StoreInstanceField <StoreInstanceFieldNode> <Value> <Value>
36 // | LoadStaticField <Field>
37 // | StoreStaticField <Field> <Value>
38 // | BooleanNegate <Value>
39 // | InstanceOf <Value> <Type>
40 // | CreateArray <ArrayNode> <Value> ...
41 // | CreateClosure <ClosureNode>
42 // | AllocateObject <ConstructorCallNode>
43 // | NativeLoadField <Value> <intptr_t>
44 // | ExtractFactoryTypeArgumentsComp <ConstructorCallNode> <Value>
45 // | ExtractConstructorTypeArgumentsComp <ConstructorCallNode> <Value>
46 // | ExtractConstructorInstantiatorComp <ConstructorCallNode> <Value> <Value>
47 //
48 // <Value> ::=
49 // Temp <int>
50 // | Constant <Instance>
51
52 // M is a two argument macro. It is applied to each concrete value's 19 // M is a two argument macro. It is applied to each concrete value's
53 // typename and classname. 20 // typename and classname.
54 #define FOR_EACH_VALUE(M) \ 21 #define FOR_EACH_VALUE(M) \
55 M(Temp, TempVal) \ 22 M(Temp, TempVal) \
56 M(Constant, ConstantVal) \ 23 M(Constant, ConstantVal) \
57 24
58 25
59 // M is a two argument macro. It is applied to each concrete instruction's 26 // M is a two argument macro. It is applied to each concrete instruction's
60 // (including the values) typename and classname. 27 // (including the values) typename and classname.
61 #define FOR_EACH_COMPUTATION(M) \ 28 #define FOR_EACH_COMPUTATION(M) \
62 FOR_EACH_VALUE(M) \ 29 FOR_EACH_VALUE(M) \
63 M(AssertAssignable, AssertAssignableComp) \ 30 M(AssertAssignable, AssertAssignableComp) \
64 M(CurrentContext, CurrentContextComp) \ 31 M(CurrentContext, CurrentContextComp) \
65 M(ClosureCall, ClosureCallComp) \ 32 M(ClosureCall, ClosureCallComp) \
66 M(InstanceCall, InstanceCallComp) \ 33 M(InstanceCall, InstanceCallComp) \
67 M(StaticCall, StaticCallComp) \ 34 M(StaticCall, StaticCallComp) \
68 M(LoadLocal, LoadLocalComp) \ 35 M(LoadLocal, LoadLocalComp) \
69 M(StoreLocal, StoreLocalComp) \ 36 M(StoreLocal, StoreLocalComp) \
70 M(StrictCompare, StrictCompareComp) \ 37 M(StrictCompare, StrictCompareComp) \
71 M(NativeCall, NativeCallComp) \ 38 M(NativeCall, NativeCallComp) \
72 M(StoreIndexed, StoreIndexedComp) \ 39 M(StoreIndexed, StoreIndexedComp) \
73 M(InstanceSetter, InstanceSetterComp) \ 40 M(InstanceSetter, InstanceSetterComp) \
41 M(StaticSetter, StaticSetterComp) \
74 M(LoadInstanceField, LoadInstanceFieldComp) \ 42 M(LoadInstanceField, LoadInstanceFieldComp) \
75 M(StoreInstanceField, StoreInstanceFieldComp) \ 43 M(StoreInstanceField, StoreInstanceFieldComp) \
76 M(LoadStaticField, LoadStaticFieldComp) \ 44 M(LoadStaticField, LoadStaticFieldComp) \
77 M(StoreStaticField, StoreStaticFieldComp) \ 45 M(StoreStaticField, StoreStaticFieldComp) \
78 M(BooleanNegate, BooleanNegateComp) \ 46 M(BooleanNegate, BooleanNegateComp) \
79 M(InstanceOf, InstanceOfComp) \ 47 M(InstanceOf, InstanceOfComp) \
80 M(CreateArray, CreateArrayComp) \ 48 M(CreateArray, CreateArrayComp) \
81 M(CreateClosure, CreateClosureComp) \ 49 M(CreateClosure, CreateClosureComp) \
82 M(AllocateObject, AllocateObjectComp) \ 50 M(AllocateObject, AllocateObjectComp) \
83 M(NativeLoadField, NativeLoadFieldComp) \ 51 M(NativeLoadField, NativeLoadFieldComp) \
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
528 const intptr_t node_id_; 496 const intptr_t node_id_;
529 const intptr_t token_index_; 497 const intptr_t token_index_;
530 const String& field_name_; 498 const String& field_name_;
531 Value* const receiver_; 499 Value* const receiver_;
532 Value* const value_; 500 Value* const value_;
533 501
534 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp); 502 DISALLOW_COPY_AND_ASSIGN(InstanceSetterComp);
535 }; 503 };
536 504
537 505
506 // Not simply a StaticCall because it has somewhat more complicated
507 // semantics: the value operand is preserved before the call.
508 class StaticSetterComp : public Computation {
509 public:
510 StaticSetterComp(intptr_t token_index,
511 const Function& setter_function,
512 Value* value)
513 : token_index_(token_index),
514 setter_function_(setter_function),
515 value_(value) { }
516
517 DECLARE_COMPUTATION(StaticSetter)
518
519 intptr_t token_index() const { return token_index_; }
520 const Function& setter_function() const { return setter_function_; }
521 Value* value() const { return value_; }
522
523 private:
524 const intptr_t token_index_;
525 const Function& setter_function_;
526 Value* const value_;
527
528 DISALLOW_COPY_AND_ASSIGN(StaticSetterComp);
529 };
530
531
538 // Note overrideable, built-in: value? false : true. 532 // Note overrideable, built-in: value? false : true.
539 class BooleanNegateComp : public Computation { 533 class BooleanNegateComp : public Computation {
540 public: 534 public:
541 explicit BooleanNegateComp(Value* value) : value_(value) {} 535 explicit BooleanNegateComp(Value* value) : value_(value) {}
542 536
543 DECLARE_COMPUTATION(BooleanNegate) 537 DECLARE_COMPUTATION(BooleanNegate)
544 538
545 Value* value() const { return value_; } 539 Value* value() const { return value_; }
546 540
547 private: 541 private:
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1205 const GrowableArray<BlockEntryInstr*>& block_order_; 1199 const GrowableArray<BlockEntryInstr*>& block_order_;
1206 1200
1207 private: 1201 private:
1208 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); 1202 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor);
1209 }; 1203 };
1210 1204
1211 1205
1212 } // namespace dart 1206 } // namespace dart
1213 1207
1214 #endif // VM_INTERMEDIATE_LANGUAGE_H_ 1208 #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