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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 void set_instruction(Instruction* instruction) { instruction_ = instruction; } | 475 void set_instruction(Instruction* instruction) { instruction_ = instruction; } |
476 | 476 |
477 intptr_t use_index() const { return use_index_; } | 477 intptr_t use_index() const { return use_index_; } |
478 void set_use_index(intptr_t index) { use_index_ = index; } | 478 void set_use_index(intptr_t index) { use_index_ = index; } |
479 | 479 |
480 static void AddToList(Value* value, Value** list); | 480 static void AddToList(Value* value, Value** list); |
481 void RemoveFromUseList(); | 481 void RemoveFromUseList(); |
482 | 482 |
483 // Change the definition after use lists have been computed. | 483 // Change the definition after use lists have been computed. |
484 inline void BindTo(Definition* definition); | 484 inline void BindTo(Definition* definition); |
| 485 inline void BindToEnvironment(Definition* definition); |
485 | 486 |
486 Value* Copy() { return new Value(definition_); } | 487 Value* Copy() { return new Value(definition_); } |
487 | 488 |
488 // This function must only be used when the new Value is dominated by | 489 // This function must only be used when the new Value is dominated by |
489 // the original Value. | 490 // the original Value. |
490 Value* CopyWithType() { | 491 Value* CopyWithType() { |
491 Value* copy = new Value(definition_); | 492 Value* copy = new Value(definition_); |
492 copy->reaching_type_ = reaching_type_; | 493 copy->reaching_type_ = reaching_type_; |
493 return copy; | 494 return copy; |
494 } | 495 } |
(...skipping 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1787 | 1788 |
1788 | 1789 |
1789 // Change a value's definition after use lists have been computed. | 1790 // Change a value's definition after use lists have been computed. |
1790 inline void Value::BindTo(Definition* def) { | 1791 inline void Value::BindTo(Definition* def) { |
1791 RemoveFromUseList(); | 1792 RemoveFromUseList(); |
1792 set_definition(def); | 1793 set_definition(def); |
1793 def->AddInputUse(this); | 1794 def->AddInputUse(this); |
1794 } | 1795 } |
1795 | 1796 |
1796 | 1797 |
| 1798 inline void Value::BindToEnvironment(Definition* def) { |
| 1799 RemoveFromUseList(); |
| 1800 set_definition(def); |
| 1801 def->AddEnvUse(this); |
| 1802 } |
| 1803 |
| 1804 |
1797 class PhiInstr : public Definition { | 1805 class PhiInstr : public Definition { |
1798 public: | 1806 public: |
1799 PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) | 1807 PhiInstr(JoinEntryInstr* block, intptr_t num_inputs) |
1800 : block_(block), | 1808 : block_(block), |
1801 inputs_(num_inputs), | 1809 inputs_(num_inputs), |
1802 is_alive_(false), | 1810 is_alive_(false), |
1803 representation_(kTagged), | 1811 representation_(kTagged), |
1804 reaching_defs_(NULL) { | 1812 reaching_defs_(NULL) { |
1805 for (intptr_t i = 0; i < num_inputs; ++i) { | 1813 for (intptr_t i = 0; i < num_inputs; ++i) { |
1806 inputs_.Add(NULL); | 1814 inputs_.Add(NULL); |
(...skipping 2491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4298 | 4306 |
4299 class StoreVMFieldInstr : public TemplateDefinition<2> { | 4307 class StoreVMFieldInstr : public TemplateDefinition<2> { |
4300 public: | 4308 public: |
4301 StoreVMFieldInstr(Value* dest, | 4309 StoreVMFieldInstr(Value* dest, |
4302 intptr_t offset_in_bytes, | 4310 intptr_t offset_in_bytes, |
4303 Value* value, | 4311 Value* value, |
4304 const AbstractType& type) | 4312 const AbstractType& type) |
4305 : offset_in_bytes_(offset_in_bytes), type_(type) { | 4313 : offset_in_bytes_(offset_in_bytes), type_(type) { |
4306 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. | 4314 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. |
4307 SetInputAt(kValuePos, value); | 4315 SetInputAt(kValuePos, value); |
4308 SetInputAt(kDestPos, dest); | 4316 SetInputAt(kObjectPos, dest); |
4309 } | 4317 } |
4310 | 4318 |
4311 enum { | 4319 enum { |
4312 kValuePos = 0, | 4320 kValuePos = 0, |
4313 kDestPos = 1 | 4321 kObjectPos = 1 |
4314 }; | 4322 }; |
4315 | 4323 |
4316 DECLARE_INSTRUCTION(StoreVMField) | 4324 DECLARE_INSTRUCTION(StoreVMField) |
4317 virtual CompileType* ComputeInitialType() const; | 4325 virtual CompileType* ComputeInitialType() const; |
4318 | 4326 |
4319 Value* value() const { return inputs_[kValuePos]; } | 4327 Value* value() const { return inputs_[kValuePos]; } |
4320 Value* dest() const { return inputs_[kDestPos]; } | 4328 Value* dest() const { return inputs_[kObjectPos]; } |
4321 intptr_t offset_in_bytes() const { return offset_in_bytes_; } | 4329 intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
4322 const AbstractType& type() const { return type_; } | 4330 const AbstractType& type() const { return type_; } |
4323 | 4331 |
4324 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4332 virtual void PrintOperandsTo(BufferFormatter* f) const; |
4325 | 4333 |
4326 virtual bool CanDeoptimize() const { return false; } | 4334 virtual bool CanDeoptimize() const { return false; } |
4327 | 4335 |
4328 virtual EffectSet Effects() const { return EffectSet::None(); } | 4336 virtual EffectSet Effects() const { return EffectSet::None(); } |
4329 | 4337 |
4330 virtual bool MayThrow() const { return false; } | 4338 virtual bool MayThrow() const { return false; } |
(...skipping 2777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7108 ForwardInstructionIterator* current_iterator_; | 7116 ForwardInstructionIterator* current_iterator_; |
7109 | 7117 |
7110 private: | 7118 private: |
7111 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7119 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
7112 }; | 7120 }; |
7113 | 7121 |
7114 | 7122 |
7115 } // namespace dart | 7123 } // namespace dart |
7116 | 7124 |
7117 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7125 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |