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 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 env_(NULL), | 639 env_(NULL), |
640 expr_id_(kNoExprId) { } | 640 expr_id_(kNoExprId) { } |
641 | 641 |
642 virtual Tag tag() const = 0; | 642 virtual Tag tag() const = 0; |
643 | 643 |
644 intptr_t deopt_id() const { | 644 intptr_t deopt_id() const { |
645 ASSERT(CanDeoptimize() || CanBeDeoptimizationTarget()); | 645 ASSERT(CanDeoptimize() || CanBeDeoptimizationTarget()); |
646 return deopt_id_; | 646 return deopt_id_; |
647 } | 647 } |
648 | 648 |
| 649 ICData* GetICData(const Array& ic_data_array) const; |
| 650 |
649 bool IsBlockEntry() { return (AsBlockEntry() != NULL); } | 651 bool IsBlockEntry() { return (AsBlockEntry() != NULL); } |
650 virtual BlockEntryInstr* AsBlockEntry() { return NULL; } | 652 virtual BlockEntryInstr* AsBlockEntry() { return NULL; } |
651 | 653 |
652 bool IsDefinition() { return (AsDefinition() != NULL); } | 654 bool IsDefinition() { return (AsDefinition() != NULL); } |
653 virtual Definition* AsDefinition() { return NULL; } | 655 virtual Definition* AsDefinition() { return NULL; } |
654 | 656 |
655 bool IsControl() { return (AsControl() != NULL); } | 657 bool IsControl() { return (AsControl() != NULL); } |
656 virtual ControlInstruction* AsControl() { return NULL; } | 658 virtual ControlInstruction* AsControl() { return NULL; } |
657 | 659 |
658 virtual intptr_t InputCount() const = 0; | 660 virtual intptr_t InputCount() const = 0; |
(...skipping 1925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2584 }; | 2586 }; |
2585 | 2587 |
2586 | 2588 |
2587 class InstanceCallInstr : public TemplateDefinition<0> { | 2589 class InstanceCallInstr : public TemplateDefinition<0> { |
2588 public: | 2590 public: |
2589 InstanceCallInstr(intptr_t token_pos, | 2591 InstanceCallInstr(intptr_t token_pos, |
2590 const String& function_name, | 2592 const String& function_name, |
2591 Token::Kind token_kind, | 2593 Token::Kind token_kind, |
2592 ZoneGrowableArray<PushArgumentInstr*>* arguments, | 2594 ZoneGrowableArray<PushArgumentInstr*>* arguments, |
2593 const Array& argument_names, | 2595 const Array& argument_names, |
2594 intptr_t checked_argument_count) | 2596 intptr_t checked_argument_count, |
2595 : ic_data_(Isolate::Current()->GetICDataForDeoptId(deopt_id())), | 2597 const Array& ic_data_array) |
| 2598 : ic_data_(GetICData(ic_data_array)), |
2596 token_pos_(token_pos), | 2599 token_pos_(token_pos), |
2597 function_name_(function_name), | 2600 function_name_(function_name), |
2598 token_kind_(token_kind), | 2601 token_kind_(token_kind), |
2599 arguments_(arguments), | 2602 arguments_(arguments), |
2600 argument_names_(argument_names), | 2603 argument_names_(argument_names), |
2601 checked_argument_count_(checked_argument_count) { | 2604 checked_argument_count_(checked_argument_count) { |
2602 ASSERT(function_name.IsNotTemporaryScopedHandle()); | 2605 ASSERT(function_name.IsNotTemporaryScopedHandle()); |
2603 ASSERT(!arguments->is_empty()); | 2606 ASSERT(!arguments->is_empty()); |
2604 ASSERT(argument_names.IsZoneHandle()); | 2607 ASSERT(argument_names.IsZoneHandle()); |
2605 ASSERT(Token::IsBinaryOperator(token_kind) || | 2608 ASSERT(Token::IsBinaryOperator(token_kind) || |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2826 | 2829 |
2827 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); | 2830 DISALLOW_COPY_AND_ASSIGN(StrictCompareInstr); |
2828 }; | 2831 }; |
2829 | 2832 |
2830 | 2833 |
2831 class EqualityCompareInstr : public ComparisonInstr { | 2834 class EqualityCompareInstr : public ComparisonInstr { |
2832 public: | 2835 public: |
2833 EqualityCompareInstr(intptr_t token_pos, | 2836 EqualityCompareInstr(intptr_t token_pos, |
2834 Token::Kind kind, | 2837 Token::Kind kind, |
2835 Value* left, | 2838 Value* left, |
2836 Value* right) | 2839 Value* right, |
| 2840 const Array& ic_data_array) |
2837 : ComparisonInstr(kind, left, right), | 2841 : ComparisonInstr(kind, left, right), |
| 2842 ic_data_(GetICData(ic_data_array)), |
2838 token_pos_(token_pos), | 2843 token_pos_(token_pos), |
2839 receiver_class_id_(kIllegalCid) { | 2844 receiver_class_id_(kIllegalCid) { |
2840 // deopt_id() checks receiver_class_id_ value. | |
2841 ic_data_ = Isolate::Current()->GetICDataForDeoptId(deopt_id()); | |
2842 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); | 2845 ASSERT((kind == Token::kEQ) || (kind == Token::kNE)); |
2843 } | 2846 } |
2844 | 2847 |
2845 DECLARE_INSTRUCTION(EqualityCompare) | 2848 DECLARE_INSTRUCTION(EqualityCompare) |
2846 virtual CompileType ComputeType() const; | 2849 virtual CompileType ComputeType() const; |
2847 virtual bool RecomputeType(); | 2850 virtual bool RecomputeType(); |
2848 | 2851 |
2849 const ICData* ic_data() const { return ic_data_; } | 2852 const ICData* ic_data() const { return ic_data_; } |
2850 bool HasICData() const { | 2853 bool HasICData() const { |
2851 return (ic_data() != NULL) && !ic_data()->IsNull(); | 2854 return (ic_data() != NULL) && !ic_data()->IsNull(); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2905 | 2908 |
2906 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); | 2909 DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr); |
2907 }; | 2910 }; |
2908 | 2911 |
2909 | 2912 |
2910 class RelationalOpInstr : public ComparisonInstr { | 2913 class RelationalOpInstr : public ComparisonInstr { |
2911 public: | 2914 public: |
2912 RelationalOpInstr(intptr_t token_pos, | 2915 RelationalOpInstr(intptr_t token_pos, |
2913 Token::Kind kind, | 2916 Token::Kind kind, |
2914 Value* left, | 2917 Value* left, |
2915 Value* right) | 2918 Value* right, |
| 2919 const Array& ic_data_array) |
2916 : ComparisonInstr(kind, left, right), | 2920 : ComparisonInstr(kind, left, right), |
| 2921 ic_data_(GetICData(ic_data_array)), |
2917 token_pos_(token_pos), | 2922 token_pos_(token_pos), |
2918 operands_class_id_(kIllegalCid) { | 2923 operands_class_id_(kIllegalCid) { |
2919 // deopt_id() checks operands_class_id_ value. | |
2920 ic_data_ = Isolate::Current()->GetICDataForDeoptId(deopt_id()); | |
2921 ASSERT(Token::IsRelationalOperator(kind)); | 2924 ASSERT(Token::IsRelationalOperator(kind)); |
2922 } | 2925 } |
2923 | 2926 |
2924 DECLARE_INSTRUCTION(RelationalOp) | 2927 DECLARE_INSTRUCTION(RelationalOp) |
2925 virtual CompileType ComputeType() const; | 2928 virtual CompileType ComputeType() const; |
2926 virtual bool RecomputeType(); | 2929 virtual bool RecomputeType(); |
2927 | 2930 |
2928 const ICData* ic_data() const { return ic_data_; } | 2931 const ICData* ic_data() const { return ic_data_; } |
2929 bool HasICData() const { | 2932 bool HasICData() const { |
2930 return (ic_data() != NULL) && !ic_data()->IsNull(); | 2933 return (ic_data() != NULL) && !ic_data()->IsNull(); |
(...skipping 3474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6405 ForwardInstructionIterator* current_iterator_; | 6408 ForwardInstructionIterator* current_iterator_; |
6406 | 6409 |
6407 private: | 6410 private: |
6408 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 6411 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
6409 }; | 6412 }; |
6410 | 6413 |
6411 | 6414 |
6412 } // namespace dart | 6415 } // namespace dart |
6413 | 6416 |
6414 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 6417 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
OLD | NEW |