Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 #include "vm/handles_impl.h" | 10 #include "vm/handles_impl.h" |
| 11 #include "vm/object.h" | 11 #include "vm/object.h" |
| 12 | 12 |
| 13 namespace dart { | 13 namespace dart { |
| 14 | 14 |
| 15 class LocalVariable; | 15 class LocalVariable; |
| 16 | 16 |
| 17 // Computations and values. | 17 // Computations and values. |
| 18 // | 18 // |
| 19 // <Computation> ::= <Value> | 19 // <Computation> ::= <Value> |
| 20 // | AssertAssignable <Value> <AbstractType> | 20 // | AssertAssignable <Value> <AbstractType> |
| 21 // | InstanceCall <cstring> <Value> ... | 21 // | InstanceCall <cstring> <Value> ... |
| 22 // | StaticCall <Function> <Value> ... | 22 // | StaticCall <Function> <Value> ... |
| 23 // | LoadLocal <LocalVariable> | 23 // | LoadLocal <LocalVariable> |
| 24 // | LoadLiteral <Instance> | |
|
Kevin Millikin (Google)
2012/02/24 10:53:04
Class has LoadLiteral <Value>. The grammar and th
srdjan
2012/02/24 22:16:24
LoadLiteral has been removed
| |
| 24 // | StoreLocal <LocalVariable> <Value> | 25 // | StoreLocal <LocalVariable> <Value> |
| 26 // | StrictCompare <Token::kind> <Value> ... | |
|
Kevin Millikin (Google)
2012/02/24 10:53:04
This one has only two Value subparts, so let's wri
srdjan
2012/02/24 22:16:24
Done.
| |
| 25 // | 27 // |
| 26 // <Value> ::= Temp <int> | 28 // <Value> ::= Temp <int> |
| 27 // | Constant <Instance> | 29 // | Constant <Instance> |
| 28 | 30 |
| 29 class Computation : public ZoneAllocated { | 31 class Computation : public ZoneAllocated { |
| 30 public: | 32 public: |
| 31 Computation() { } | 33 Computation() { } |
| 32 | 34 |
| 33 // Prints a computation without indentation or trailing newlines. | 35 // Prints a computation without indentation or trailing newlines. |
| 34 virtual void Print() const = 0; | 36 virtual void Print() const = 0; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 virtual void Print() const; | 72 virtual void Print() const; |
| 71 | 73 |
| 72 private: | 74 private: |
| 73 const char* name_; | 75 const char* name_; |
| 74 ZoneGrowableArray<Value*>* arguments_; | 76 ZoneGrowableArray<Value*>* arguments_; |
| 75 | 77 |
| 76 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); | 78 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); |
| 77 }; | 79 }; |
| 78 | 80 |
| 79 | 81 |
| 82 class StrictCompareComp : public Computation { | |
| 83 public: | |
| 84 StrictCompareComp(Token::Kind kind, Value* left, Value* right) | |
| 85 : kind_(kind), left_(left), right_(right) { | |
| 86 ASSERT((kind_ == Token::kEQ_STRICT) || (kind_ == Token::kNE_STRICT)); | |
| 87 } | |
| 88 | |
| 89 virtual void Print() const; | |
| 90 | |
| 91 private: | |
| 92 const Token::Kind kind_; | |
| 93 Value* left_; | |
| 94 Value* right_; | |
| 95 | |
| 96 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp); | |
| 97 }; | |
| 98 | |
| 99 | |
| 80 class StaticCallComp : public Computation { | 100 class StaticCallComp : public Computation { |
| 81 public: | 101 public: |
| 82 StaticCallComp(const Function& function, ZoneGrowableArray<Value*>* arguments) | 102 StaticCallComp(const Function& function, ZoneGrowableArray<Value*>* arguments) |
| 83 : function_(function), arguments_(arguments) { | 103 : function_(function), arguments_(arguments) { |
| 84 ASSERT(function.IsZoneHandle()); | 104 ASSERT(function.IsZoneHandle()); |
| 85 } | 105 } |
| 86 | 106 |
| 87 virtual void Print() const; | 107 virtual void Print() const; |
| 88 | 108 |
| 89 private: | 109 private: |
| 90 const Function& function_; | 110 const Function& function_; |
| 91 ZoneGrowableArray<Value*>* arguments_; | 111 ZoneGrowableArray<Value*>* arguments_; |
| 92 | 112 |
| 93 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); | 113 DISALLOW_COPY_AND_ASSIGN(StaticCallComp); |
| 94 }; | 114 }; |
| 95 | 115 |
| 96 | 116 |
| 117 class LoadLiteralComp : public Computation { | |
| 118 public: | |
| 119 explicit LoadLiteralComp(Value* literal) : literal_(literal) {} | |
| 120 | |
| 121 virtual void Print() const; | |
| 122 | |
| 123 private: | |
| 124 const Value* literal_; | |
| 125 | |
| 126 DISALLOW_COPY_AND_ASSIGN(LoadLiteralComp); | |
| 127 }; | |
| 128 | |
| 129 | |
| 97 class LoadLocalComp : public Computation { | 130 class LoadLocalComp : public Computation { |
| 98 public: | 131 public: |
| 99 explicit LoadLocalComp(const LocalVariable& local) : local_(local) { } | 132 explicit LoadLocalComp(const LocalVariable& local) : local_(local) { } |
| 100 | 133 |
| 101 virtual void Print() const; | 134 virtual void Print() const; |
| 102 | 135 |
| 103 private: | 136 private: |
| 104 const LocalVariable& local_; | 137 const LocalVariable& local_; |
| 105 | 138 |
| 106 DISALLOW_COPY_AND_ASSIGN(LoadLocalComp); | 139 DISALLOW_COPY_AND_ASSIGN(LoadLocalComp); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 130 | 163 |
| 131 private: | 164 private: |
| 132 intptr_t index_; | 165 intptr_t index_; |
| 133 | 166 |
| 134 DISALLOW_COPY_AND_ASSIGN(TempValue); | 167 DISALLOW_COPY_AND_ASSIGN(TempValue); |
| 135 }; | 168 }; |
| 136 | 169 |
| 137 | 170 |
| 138 class ConstantValue: public Value { | 171 class ConstantValue: public Value { |
| 139 public: | 172 public: |
| 140 explicit ConstantValue(const Instance& instance) : instance_(instance) { } | 173 explicit ConstantValue(const Instance& instance) : instance_(instance) { |
| 174 ASSERT(instance.IsZoneHandle()); | |
| 175 } | |
| 141 | 176 |
| 142 virtual void Print() const; | 177 virtual void Print() const; |
| 143 | 178 |
| 144 private: | 179 private: |
| 145 const Instance& instance_; | 180 const Instance& instance_; |
| 146 | 181 |
| 147 DISALLOW_COPY_AND_ASSIGN(ConstantValue); | 182 DISALLOW_COPY_AND_ASSIGN(ConstantValue); |
| 148 }; | 183 }; |
| 149 | 184 |
| 150 | 185 |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 400 #undef DECLARE_VISIT | 435 #undef DECLARE_VISIT |
| 401 | 436 |
| 402 private: | 437 private: |
| 403 DISALLOW_COPY_AND_ASSIGN(InstructionVisitor); | 438 DISALLOW_COPY_AND_ASSIGN(InstructionVisitor); |
| 404 }; | 439 }; |
| 405 | 440 |
| 406 | 441 |
| 407 } // namespace dart | 442 } // namespace dart |
| 408 | 443 |
| 409 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 444 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |