Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013, 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" |
| (...skipping 6470 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6481 | 6481 |
| 6482 virtual bool MayThrow() const { return false; } | 6482 virtual bool MayThrow() const { return false; } |
| 6483 | 6483 |
| 6484 private: | 6484 private: |
| 6485 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); | 6485 DISALLOW_COPY_AND_ASSIGN(CheckSmiInstr); |
| 6486 }; | 6486 }; |
| 6487 | 6487 |
| 6488 | 6488 |
| 6489 class CheckArrayBoundInstr : public TemplateInstruction<2> { | 6489 class CheckArrayBoundInstr : public TemplateInstruction<2> { |
| 6490 public: | 6490 public: |
| 6491 CheckArrayBoundInstr(Value* length, Value* index, intptr_t deopt_id) { | 6491 CheckArrayBoundInstr(const Field* field, Value* length, Value* index, |
| 6492 intptr_t deopt_id) : field_(field) { | |
|
srdjan
2013/08/27 15:50:33
Why store field instead of guarded_list _length or
| |
| 6492 SetInputAt(kLengthPos, length); | 6493 SetInputAt(kLengthPos, length); |
| 6493 SetInputAt(kIndexPos, index); | 6494 SetInputAt(kIndexPos, index); |
| 6494 // Override generated deopt-id. | 6495 // Override generated deopt-id. |
| 6495 deopt_id_ = deopt_id; | 6496 deopt_id_ = deopt_id; |
| 6496 } | 6497 } |
| 6497 | 6498 |
| 6498 Value* length() const { return inputs_[kLengthPos]; } | 6499 Value* length() const { return inputs_[kLengthPos]; } |
| 6499 Value* index() const { return inputs_[kIndexPos]; } | 6500 Value* index() const { return inputs_[kIndexPos]; } |
| 6500 | 6501 |
| 6501 DECLARE_INSTRUCTION(CheckArrayBound) | 6502 DECLARE_INSTRUCTION(CheckArrayBound) |
| 6502 | 6503 |
| 6503 virtual intptr_t ArgumentCount() const { return 0; } | 6504 virtual intptr_t ArgumentCount() const { return 0; } |
| 6504 | 6505 |
| 6505 virtual bool CanDeoptimize() const { return true; } | 6506 virtual bool CanDeoptimize() const { return true; } |
| 6506 | 6507 |
| 6507 bool IsRedundant(RangeBoundary length); | 6508 bool IsRedundant(RangeBoundary length); |
| 6508 | 6509 |
| 6509 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 6510 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 6510 | 6511 |
| 6512 intptr_t GetGuardedArrayLength() const { | |
| 6513 if (field_ == NULL) return Field::kNoFixedLength; | |
|
Florian Schneider
2013/08/27 12:51:34
Style suggestion:
return (field_ == NULL) ? Field
| |
| 6514 return field_->guarded_list_length(); | |
| 6515 } | |
| 6516 | |
| 6511 // Returns the length offset for array and string types. | 6517 // Returns the length offset for array and string types. |
| 6512 static intptr_t LengthOffsetFor(intptr_t class_id); | 6518 static intptr_t LengthOffsetFor(intptr_t class_id); |
| 6513 | 6519 |
| 6514 static bool IsFixedLengthArrayType(intptr_t class_id); | 6520 static bool IsFixedLengthArrayType(intptr_t class_id); |
| 6515 | 6521 |
| 6516 virtual bool AllowsCSE() const { return true; } | 6522 virtual bool AllowsCSE() const { return true; } |
| 6517 virtual EffectSet Effects() const { return EffectSet::None(); } | 6523 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 6518 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 6524 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
| 6519 virtual bool AttributesEqual(Instruction* other) const { return true; } | 6525 virtual bool AttributesEqual(Instruction* other) const { return true; } |
| 6520 | 6526 |
| 6521 virtual bool MayThrow() const { return false; } | 6527 virtual bool MayThrow() const { return false; } |
| 6522 | 6528 |
| 6523 private: | 6529 private: |
| 6524 // Give a name to the location/input indices. | 6530 // Give a name to the location/input indices. |
| 6525 enum { | 6531 enum { |
| 6526 kLengthPos = 0, | 6532 kLengthPos = 0, |
| 6527 kIndexPos = 1 | 6533 kIndexPos = 1 |
| 6528 }; | 6534 }; |
| 6535 const Field* field_; | |
| 6529 | 6536 |
| 6530 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); | 6537 DISALLOW_COPY_AND_ASSIGN(CheckArrayBoundInstr); |
| 6531 }; | 6538 }; |
| 6532 | 6539 |
| 6533 | 6540 |
| 6534 #undef DECLARE_INSTRUCTION | 6541 #undef DECLARE_INSTRUCTION |
| 6535 | 6542 |
| 6536 class Environment : public ZoneAllocated { | 6543 class Environment : public ZoneAllocated { |
| 6537 public: | 6544 public: |
| 6538 // Iterate the non-NULL values in the innermost level of an environment. | 6545 // Iterate the non-NULL values in the innermost level of an environment. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6748 ForwardInstructionIterator* current_iterator_; | 6755 ForwardInstructionIterator* current_iterator_; |
| 6749 | 6756 |
| 6750 private: | 6757 private: |
| 6751 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 6758 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 6752 }; | 6759 }; |
| 6753 | 6760 |
| 6754 | 6761 |
| 6755 } // namespace dart | 6762 } // namespace dart |
| 6756 | 6763 |
| 6757 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 6764 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |