OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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" |
(...skipping 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 protected: | 1601 protected: |
1602 EmbeddedArray<Value*, N> inputs_; | 1602 EmbeddedArray<Value*, N> inputs_; |
1603 | 1603 |
1604 private: | 1604 private: |
1605 friend class BranchInstr; | 1605 friend class BranchInstr; |
1606 | 1606 |
1607 LocationSummary* locs_; | 1607 LocationSummary* locs_; |
1608 }; | 1608 }; |
1609 | 1609 |
1610 | 1610 |
1611 class RangeBoundary : public ValueObject { | 1611 class RangeBoundary { |
1612 public: | 1612 public: |
1613 enum Kind { kUnknown, kSymbol, kConstant }; | 1613 enum Kind { kUnknown, kSymbol, kConstant }; |
1614 | 1614 |
1615 RangeBoundary() : kind_(kUnknown), value_(0), offset_(0) { } | 1615 RangeBoundary() : kind_(kUnknown), value_(0), offset_(0) { } |
1616 | 1616 |
| 1617 RangeBoundary(const RangeBoundary& other) |
| 1618 : kind_(other.kind_), value_(other.value_), offset_(other.offset_) { } |
| 1619 |
| 1620 RangeBoundary& operator=(const RangeBoundary& other) { |
| 1621 kind_ = other.kind_; |
| 1622 value_ = other.value_; |
| 1623 offset_ = other.offset_; |
| 1624 return *this; |
| 1625 } |
| 1626 |
1617 static RangeBoundary FromConstant(intptr_t val) { | 1627 static RangeBoundary FromConstant(intptr_t val) { |
1618 return RangeBoundary(kConstant, val, 0); | 1628 return RangeBoundary(kConstant, val, 0); |
1619 } | 1629 } |
1620 | 1630 |
1621 static RangeBoundary FromDefinition(Definition* defn, intptr_t offs = 0); | 1631 static RangeBoundary FromDefinition(Definition* defn, intptr_t offs = 0); |
1622 | 1632 |
1623 static RangeBoundary MinSmi() { | 1633 static RangeBoundary MinSmi() { |
1624 return FromConstant(Smi::kMinValue); | 1634 return FromConstant(Smi::kMinValue); |
1625 } | 1635 } |
1626 | 1636 |
(...skipping 2558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4185 | 4195 |
4186 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); | 4196 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); |
4187 }; | 4197 }; |
4188 | 4198 |
4189 | 4199 |
4190 #undef DECLARE_INSTRUCTION | 4200 #undef DECLARE_INSTRUCTION |
4191 | 4201 |
4192 class Environment : public ZoneAllocated { | 4202 class Environment : public ZoneAllocated { |
4193 public: | 4203 public: |
4194 // Iterate the non-NULL values in the innermost level of an environment. | 4204 // Iterate the non-NULL values in the innermost level of an environment. |
4195 class ShallowIterator : public ValueObject { | 4205 class ShallowIterator { |
4196 public: | 4206 public: |
4197 explicit ShallowIterator(Environment* environment) | 4207 explicit ShallowIterator(Environment* environment) |
4198 : environment_(environment), index_(0) { } | 4208 : environment_(environment), index_(0) { } |
4199 | 4209 |
| 4210 ShallowIterator(const ShallowIterator& other) |
| 4211 : environment_(other.environment_), index_(other.index_) { } |
| 4212 |
| 4213 ShallowIterator& operator=(const ShallowIterator& other) { |
| 4214 environment_ = other.environment_; |
| 4215 index_ = other.index_; |
| 4216 return *this; |
| 4217 } |
| 4218 |
4200 Environment* environment() const { return environment_; } | 4219 Environment* environment() const { return environment_; } |
4201 | 4220 |
4202 void Advance() { | 4221 void Advance() { |
4203 ASSERT(!Done()); | 4222 ASSERT(!Done()); |
4204 ++index_; | 4223 ++index_; |
4205 } | 4224 } |
4206 | 4225 |
4207 bool Done() const { | 4226 bool Done() const { |
4208 return (environment_ == NULL) || (index_ >= environment_->Length()); | 4227 return (environment_ == NULL) || (index_ >= environment_->Length()); |
4209 } | 4228 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4394 ForwardInstructionIterator* current_iterator_; | 4413 ForwardInstructionIterator* current_iterator_; |
4395 | 4414 |
4396 private: | 4415 private: |
4397 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4416 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
4398 }; | 4417 }; |
4399 | 4418 |
4400 | 4419 |
4401 } // namespace dart | 4420 } // namespace dart |
4402 | 4421 |
4403 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4422 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |