| 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 // | StoreLocal <LocalVariable> <Value> | 24 // | StoreLocal <LocalVariable> <Value> |
| 25 // | StrictCompare <Token::kind> <Value> <Value> |
| 25 // | 26 // |
| 26 // <Value> ::= Temp <int> | 27 // <Value> ::= Temp <int> |
| 27 // | Constant <Instance> | 28 // | Constant <Instance> |
| 28 | 29 |
| 29 class Computation : public ZoneAllocated { | 30 class Computation : public ZoneAllocated { |
| 30 public: | 31 public: |
| 31 Computation() { } | 32 Computation() { } |
| 32 | 33 |
| 33 // Prints a computation without indentation or trailing newlines. | 34 // Prints a computation without indentation or trailing newlines. |
| 34 virtual void Print() const = 0; | 35 virtual void Print() const = 0; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 virtual void Print() const; | 71 virtual void Print() const; |
| 71 | 72 |
| 72 private: | 73 private: |
| 73 const char* name_; | 74 const char* name_; |
| 74 ZoneGrowableArray<Value*>* arguments_; | 75 ZoneGrowableArray<Value*>* arguments_; |
| 75 | 76 |
| 76 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); | 77 DISALLOW_COPY_AND_ASSIGN(InstanceCallComp); |
| 77 }; | 78 }; |
| 78 | 79 |
| 79 | 80 |
| 81 class StrictCompareComp : public Computation { |
| 82 public: |
| 83 StrictCompareComp(Token::Kind kind, Value* left, Value* right) |
| 84 : kind_(kind), left_(left), right_(right) { |
| 85 ASSERT((kind_ == Token::kEQ_STRICT) || (kind_ == Token::kNE_STRICT)); |
| 86 } |
| 87 |
| 88 virtual void Print() const; |
| 89 |
| 90 private: |
| 91 const Token::Kind kind_; |
| 92 Value* left_; |
| 93 Value* right_; |
| 94 |
| 95 DISALLOW_COPY_AND_ASSIGN(StrictCompareComp); |
| 96 }; |
| 97 |
| 98 |
| 80 class StaticCallComp : public Computation { | 99 class StaticCallComp : public Computation { |
| 81 public: | 100 public: |
| 82 StaticCallComp(const Function& function, ZoneGrowableArray<Value*>* arguments) | 101 StaticCallComp(const Function& function, ZoneGrowableArray<Value*>* arguments) |
| 83 : function_(function), arguments_(arguments) { | 102 : function_(function), arguments_(arguments) { |
| 84 ASSERT(function.IsZoneHandle()); | 103 ASSERT(function.IsZoneHandle()); |
| 85 } | 104 } |
| 86 | 105 |
| 87 virtual void Print() const; | 106 virtual void Print() const; |
| 88 | 107 |
| 89 private: | 108 private: |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 149 |
| 131 private: | 150 private: |
| 132 intptr_t index_; | 151 intptr_t index_; |
| 133 | 152 |
| 134 DISALLOW_COPY_AND_ASSIGN(TempValue); | 153 DISALLOW_COPY_AND_ASSIGN(TempValue); |
| 135 }; | 154 }; |
| 136 | 155 |
| 137 | 156 |
| 138 class ConstantValue: public Value { | 157 class ConstantValue: public Value { |
| 139 public: | 158 public: |
| 140 explicit ConstantValue(const Instance& instance) : instance_(instance) { } | 159 explicit ConstantValue(const Instance& instance) : instance_(instance) { |
| 160 ASSERT(instance.IsZoneHandle()); |
| 161 } |
| 141 | 162 |
| 142 virtual void Print() const; | 163 virtual void Print() const; |
| 143 | 164 |
| 144 private: | 165 private: |
| 145 const Instance& instance_; | 166 const Instance& instance_; |
| 146 | 167 |
| 147 DISALLOW_COPY_AND_ASSIGN(ConstantValue); | 168 DISALLOW_COPY_AND_ASSIGN(ConstantValue); |
| 148 }; | 169 }; |
| 149 | 170 |
| 150 | 171 |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 #undef DECLARE_VISIT | 409 #undef DECLARE_VISIT |
| 389 | 410 |
| 390 private: | 411 private: |
| 391 DISALLOW_COPY_AND_ASSIGN(InstructionVisitor); | 412 DISALLOW_COPY_AND_ASSIGN(InstructionVisitor); |
| 392 }; | 413 }; |
| 393 | 414 |
| 394 | 415 |
| 395 } // namespace dart | 416 } // namespace dart |
| 396 | 417 |
| 397 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 418 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |