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 708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 } | 719 } |
720 | 720 |
721 virtual LocationSummary* MakeLocationSummary(Isolate* isolate, | 721 virtual LocationSummary* MakeLocationSummary(Isolate* isolate, |
722 bool is_optimizing) const = 0; | 722 bool is_optimizing) const = 0; |
723 | 723 |
724 void InitializeLocationSummary(Isolate* isolate, bool optimizing) { | 724 void InitializeLocationSummary(Isolate* isolate, bool optimizing) { |
725 ASSERT(locs_ == NULL); | 725 ASSERT(locs_ == NULL); |
726 locs_ = MakeLocationSummary(isolate, optimizing); | 726 locs_ = MakeLocationSummary(isolate, optimizing); |
727 } | 727 } |
728 | 728 |
729 static LocationSummary* MakeCallSummary(); | 729 static LocationSummary* MakeCallSummary(Isolate* isolate); |
730 | 730 |
731 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { | 731 virtual void EmitNativeCode(FlowGraphCompiler* compiler) { |
732 UNIMPLEMENTED(); | 732 UNIMPLEMENTED(); |
733 } | 733 } |
734 | 734 |
735 Environment* env() const { return env_; } | 735 Environment* env() const { return env_; } |
736 void SetEnvironment(Environment* deopt_env); | 736 void SetEnvironment(Environment* deopt_env); |
737 void RemoveEnvironment(); | 737 void RemoveEnvironment(); |
738 | 738 |
739 intptr_t lifetime_position() const { return lifetime_position_; } | 739 intptr_t lifetime_position() const { return lifetime_position_; } |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } | 1311 virtual intptr_t PredecessorCount() const { return predecessors_.length(); } |
1312 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { | 1312 virtual BlockEntryInstr* PredecessorAt(intptr_t index) const { |
1313 return predecessors_[index]; | 1313 return predecessors_[index]; |
1314 } | 1314 } |
1315 | 1315 |
1316 // Returns -1 if pred is not in the list. | 1316 // Returns -1 if pred is not in the list. |
1317 intptr_t IndexOfPredecessor(BlockEntryInstr* pred) const; | 1317 intptr_t IndexOfPredecessor(BlockEntryInstr* pred) const; |
1318 | 1318 |
1319 ZoneGrowableArray<PhiInstr*>* phis() const { return phis_; } | 1319 ZoneGrowableArray<PhiInstr*>* phis() const { return phis_; } |
1320 | 1320 |
1321 void InsertPhi(intptr_t var_index, intptr_t var_count); | 1321 void InsertPhi(intptr_t var_index, intptr_t var_count, bool always_live); |
1322 void RemoveDeadPhis(Definition* replacement); | 1322 void RemoveDeadPhis(Definition* replacement); |
1323 | 1323 |
1324 void InsertPhi(PhiInstr* phi); | 1324 void InsertPhi(PhiInstr* phi); |
1325 void RemovePhi(PhiInstr* phi); | 1325 void RemovePhi(PhiInstr* phi); |
1326 | 1326 |
1327 virtual void PrintTo(BufferFormatter* f) const; | 1327 virtual void PrintTo(BufferFormatter* f) const; |
1328 | 1328 |
1329 virtual EffectSet Effects() const { return EffectSet::None(); } | 1329 virtual EffectSet Effects() const { return EffectSet::None(); } |
1330 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 1330 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
1331 | 1331 |
(...skipping 1244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2576 virtual EffectSet Dependencies() const { return EffectSet::None(); } | 2576 virtual EffectSet Dependencies() const { return EffectSet::None(); } |
2577 virtual bool AttributesEqual(Instruction* other) const { return true; } | 2577 virtual bool AttributesEqual(Instruction* other) const { return true; } |
2578 | 2578 |
2579 virtual bool MayThrow() const { return false; } | 2579 virtual bool MayThrow() const { return false; } |
2580 | 2580 |
2581 private: | 2581 private: |
2582 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); | 2582 DISALLOW_COPY_AND_ASSIGN(CurrentContextInstr); |
2583 }; | 2583 }; |
2584 | 2584 |
2585 | 2585 |
2586 class ClosureCallInstr : public TemplateDefinition<1> { | 2586 class ClosureCallInstr : public TemplateDefinition<2> { |
2587 public: | 2587 public: |
| 2588 enum { |
| 2589 kFunctionPos = 0, |
| 2590 kContextPos = 1 |
| 2591 }; |
| 2592 |
2588 ClosureCallInstr(Value* function, | 2593 ClosureCallInstr(Value* function, |
| 2594 Value* context, |
2589 ClosureCallNode* node, | 2595 ClosureCallNode* node, |
2590 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 2596 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
2591 : TemplateDefinition<1>(Isolate::Current()->GetNextDeoptId()), | 2597 : TemplateDefinition<2>(Isolate::Current()->GetNextDeoptId()), |
2592 ast_node_(*node), | 2598 ast_node_(*node), |
2593 arguments_(arguments) { | 2599 arguments_(arguments) { |
2594 SetInputAt(0, function); | 2600 SetInputAt(kFunctionPos, function); |
| 2601 SetInputAt(kContextPos, context); |
2595 } | 2602 } |
2596 | 2603 |
2597 DECLARE_INSTRUCTION(ClosureCall) | 2604 DECLARE_INSTRUCTION(ClosureCall) |
2598 | 2605 |
| 2606 Value* context() const { return InputAt(kContextPos); } |
| 2607 |
2599 const Array& argument_names() const { return ast_node_.arguments()->names(); } | 2608 const Array& argument_names() const { return ast_node_.arguments()->names(); } |
2600 virtual intptr_t token_pos() const { return ast_node_.token_pos(); } | 2609 virtual intptr_t token_pos() const { return ast_node_.token_pos(); } |
2601 | 2610 |
2602 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 2611 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
2603 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 2612 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
2604 return (*arguments_)[index]; | 2613 return (*arguments_)[index]; |
2605 } | 2614 } |
2606 | 2615 |
2607 // TODO(kmillikin): implement exact call counts for closure calls. | 2616 // TODO(kmillikin): implement exact call counts for closure calls. |
2608 virtual intptr_t CallCount() const { return 1; } | 2617 virtual intptr_t CallCount() const { return 1; } |
(...skipping 5708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8317 Isolate* isolate, bool opt) const { \ | 8326 Isolate* isolate, bool opt) const { \ |
8318 UNIMPLEMENTED(); \ | 8327 UNIMPLEMENTED(); \ |
8319 return NULL; \ | 8328 return NULL; \ |
8320 } \ | 8329 } \ |
8321 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } | 8330 void Name::EmitNativeCode(FlowGraphCompiler* compiler) { UNIMPLEMENTED(); } |
8322 | 8331 |
8323 | 8332 |
8324 } // namespace dart | 8333 } // namespace dart |
8325 | 8334 |
8326 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 8335 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |