| 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 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3412 | 3420 |
| 3413 private: | 3421 private: |
| 3414 const NativeBodyNode& ast_node_; | 3422 const NativeBodyNode& ast_node_; |
| 3415 | 3423 |
| 3416 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr); | 3424 DISALLOW_COPY_AND_ASSIGN(NativeCallInstr); |
| 3417 }; | 3425 }; |
| 3418 | 3426 |
| 3419 | 3427 |
| 3420 class DebugStepCheckInstr : public TemplateInstruction<0> { | 3428 class DebugStepCheckInstr : public TemplateInstruction<0> { |
| 3421 public: | 3429 public: |
| 3422 explicit DebugStepCheckInstr(intptr_t token_pos) | 3430 DebugStepCheckInstr(intptr_t token_pos, |
| 3423 : token_pos_(token_pos) { | 3431 PcDescriptors::Kind stub_kind) |
| 3432 : token_pos_(token_pos), |
| 3433 stub_kind_(stub_kind) { |
| 3424 } | 3434 } |
| 3425 | 3435 |
| 3426 DECLARE_INSTRUCTION(DebugStepCheck) | 3436 DECLARE_INSTRUCTION(DebugStepCheck) |
| 3427 | 3437 |
| 3428 intptr_t token_pos() const { return token_pos_; } | 3438 intptr_t token_pos() const { return token_pos_; } |
| 3429 virtual bool MayThrow() const { return false; } | 3439 virtual bool MayThrow() const { return false; } |
| 3430 virtual bool CanDeoptimize() const { return false; } | 3440 virtual bool CanDeoptimize() const { return false; } |
| 3431 virtual EffectSet Effects() const { return EffectSet::All(); } | 3441 virtual EffectSet Effects() const { return EffectSet::All(); } |
| 3432 virtual intptr_t ArgumentCount() const { return 0; } | 3442 virtual intptr_t ArgumentCount() const { return 0; } |
| 3433 virtual Instruction* Canonicalize(FlowGraph* flow_graph); | 3443 virtual Instruction* Canonicalize(FlowGraph* flow_graph); |
| 3434 | 3444 |
| 3435 private: | 3445 private: |
| 3436 const intptr_t token_pos_; | 3446 const intptr_t token_pos_; |
| 3447 const PcDescriptors::Kind stub_kind_; |
| 3437 | 3448 |
| 3438 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr); | 3449 DISALLOW_COPY_AND_ASSIGN(DebugStepCheckInstr); |
| 3439 }; | 3450 }; |
| 3440 | 3451 |
| 3441 | 3452 |
| 3442 enum StoreBarrierType { | 3453 enum StoreBarrierType { |
| 3443 kNoStoreBarrier, | 3454 kNoStoreBarrier, |
| 3444 kEmitStoreBarrier | 3455 kEmitStoreBarrier |
| 3445 }; | 3456 }; |
| 3446 | 3457 |
| (...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4298 | 4309 |
| 4299 class StoreVMFieldInstr : public TemplateDefinition<2> { | 4310 class StoreVMFieldInstr : public TemplateDefinition<2> { |
| 4300 public: | 4311 public: |
| 4301 StoreVMFieldInstr(Value* dest, | 4312 StoreVMFieldInstr(Value* dest, |
| 4302 intptr_t offset_in_bytes, | 4313 intptr_t offset_in_bytes, |
| 4303 Value* value, | 4314 Value* value, |
| 4304 const AbstractType& type) | 4315 const AbstractType& type) |
| 4305 : offset_in_bytes_(offset_in_bytes), type_(type) { | 4316 : offset_in_bytes_(offset_in_bytes), type_(type) { |
| 4306 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. | 4317 ASSERT(type.IsZoneHandle()); // May be null if field is not an instance. |
| 4307 SetInputAt(kValuePos, value); | 4318 SetInputAt(kValuePos, value); |
| 4308 SetInputAt(kDestPos, dest); | 4319 SetInputAt(kObjectPos, dest); |
| 4309 } | 4320 } |
| 4310 | 4321 |
| 4311 enum { | 4322 enum { |
| 4312 kValuePos = 0, | 4323 kValuePos = 0, |
| 4313 kDestPos = 1 | 4324 kObjectPos = 1 |
| 4314 }; | 4325 }; |
| 4315 | 4326 |
| 4316 DECLARE_INSTRUCTION(StoreVMField) | 4327 DECLARE_INSTRUCTION(StoreVMField) |
| 4317 virtual CompileType* ComputeInitialType() const; | 4328 virtual CompileType* ComputeInitialType() const; |
| 4318 | 4329 |
| 4319 Value* value() const { return inputs_[kValuePos]; } | 4330 Value* value() const { return inputs_[kValuePos]; } |
| 4320 Value* dest() const { return inputs_[kDestPos]; } | 4331 Value* dest() const { return inputs_[kObjectPos]; } |
| 4321 intptr_t offset_in_bytes() const { return offset_in_bytes_; } | 4332 intptr_t offset_in_bytes() const { return offset_in_bytes_; } |
| 4322 const AbstractType& type() const { return type_; } | 4333 const AbstractType& type() const { return type_; } |
| 4323 | 4334 |
| 4324 virtual void PrintOperandsTo(BufferFormatter* f) const; | 4335 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 4325 | 4336 |
| 4326 virtual bool CanDeoptimize() const { return false; } | 4337 virtual bool CanDeoptimize() const { return false; } |
| 4327 | 4338 |
| 4328 virtual EffectSet Effects() const { return EffectSet::None(); } | 4339 virtual EffectSet Effects() const { return EffectSet::None(); } |
| 4329 | 4340 |
| 4330 virtual bool MayThrow() const { return false; } | 4341 virtual bool MayThrow() const { return false; } |
| (...skipping 2777 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7108 ForwardInstructionIterator* current_iterator_; | 7119 ForwardInstructionIterator* current_iterator_; |
| 7109 | 7120 |
| 7110 private: | 7121 private: |
| 7111 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 7122 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 7112 }; | 7123 }; |
| 7113 | 7124 |
| 7114 | 7125 |
| 7115 } // namespace dart | 7126 } // namespace dart |
| 7116 | 7127 |
| 7117 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 7128 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |