| 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 2571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2582 public: | 2582 public: |
| 2583 StaticCallInstr(intptr_t token_pos, | 2583 StaticCallInstr(intptr_t token_pos, |
| 2584 const Function& function, | 2584 const Function& function, |
| 2585 const Array& argument_names, | 2585 const Array& argument_names, |
| 2586 ZoneGrowableArray<PushArgumentInstr*>* arguments) | 2586 ZoneGrowableArray<PushArgumentInstr*>* arguments) |
| 2587 : token_pos_(token_pos), | 2587 : token_pos_(token_pos), |
| 2588 function_(function), | 2588 function_(function), |
| 2589 argument_names_(argument_names), | 2589 argument_names_(argument_names), |
| 2590 arguments_(arguments), | 2590 arguments_(arguments), |
| 2591 result_cid_(kDynamicCid), | 2591 result_cid_(kDynamicCid), |
| 2592 is_known_constructor_(false) { | 2592 is_known_list_constructor_(false) { |
| 2593 ASSERT(function.IsZoneHandle()); | 2593 ASSERT(function.IsZoneHandle()); |
| 2594 ASSERT(argument_names.IsZoneHandle()); | 2594 ASSERT(argument_names.IsZoneHandle()); |
| 2595 } | 2595 } |
| 2596 | 2596 |
| 2597 DECLARE_INSTRUCTION(StaticCall) | 2597 DECLARE_INSTRUCTION(StaticCall) |
| 2598 virtual CompileType ComputeType() const; | 2598 virtual CompileType ComputeType() const; |
| 2599 | 2599 |
| 2600 // Accessors forwarded to the AST node. | 2600 // Accessors forwarded to the AST node. |
| 2601 const Function& function() const { return function_; } | 2601 const Function& function() const { return function_; } |
| 2602 const Array& argument_names() const { return argument_names_; } | 2602 const Array& argument_names() const { return argument_names_; } |
| 2603 intptr_t token_pos() const { return token_pos_; } | 2603 intptr_t token_pos() const { return token_pos_; } |
| 2604 | 2604 |
| 2605 virtual intptr_t ArgumentCount() const { return arguments_->length(); } | 2605 virtual intptr_t ArgumentCount() const { return arguments_->length(); } |
| 2606 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { | 2606 virtual PushArgumentInstr* PushArgumentAt(intptr_t index) const { |
| 2607 return (*arguments_)[index]; | 2607 return (*arguments_)[index]; |
| 2608 } | 2608 } |
| 2609 | 2609 |
| 2610 virtual void PrintOperandsTo(BufferFormatter* f) const; | 2610 virtual void PrintOperandsTo(BufferFormatter* f) const; |
| 2611 | 2611 |
| 2612 virtual bool CanDeoptimize() const { return true; } | 2612 virtual bool CanDeoptimize() const { return true; } |
| 2613 | 2613 |
| 2614 virtual bool HasSideEffect() const { return true; } | 2614 virtual bool HasSideEffect() const { return true; } |
| 2615 | 2615 |
| 2616 void set_result_cid(intptr_t value) { result_cid_ = value; } | 2616 void set_result_cid(intptr_t value) { result_cid_ = value; } |
| 2617 | 2617 |
| 2618 bool is_known_constructor() const { return is_known_constructor_; } | 2618 bool is_known_list_constructor() const { return is_known_list_constructor_; } |
| 2619 void set_is_known_constructor(bool is_known_constructor) { | 2619 void set_is_known_list_constructor(bool value) { |
| 2620 is_known_constructor_ = is_known_constructor; | 2620 is_known_list_constructor_ = value; |
| 2621 } | 2621 } |
| 2622 | 2622 |
| 2623 private: | 2623 private: |
| 2624 const intptr_t token_pos_; | 2624 const intptr_t token_pos_; |
| 2625 const Function& function_; | 2625 const Function& function_; |
| 2626 const Array& argument_names_; | 2626 const Array& argument_names_; |
| 2627 ZoneGrowableArray<PushArgumentInstr*>* arguments_; | 2627 ZoneGrowableArray<PushArgumentInstr*>* arguments_; |
| 2628 intptr_t result_cid_; // For some library functions we know the result. | 2628 intptr_t result_cid_; // For some library functions we know the result. |
| 2629 | 2629 |
| 2630 // Some library constructors have known semantics. | 2630 // 'True' for recognized list constructors. |
| 2631 bool is_known_constructor_; | 2631 bool is_known_list_constructor_; |
| 2632 | 2632 |
| 2633 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); | 2633 DISALLOW_COPY_AND_ASSIGN(StaticCallInstr); |
| 2634 }; | 2634 }; |
| 2635 | 2635 |
| 2636 | 2636 |
| 2637 class LoadLocalInstr : public TemplateDefinition<0> { | 2637 class LoadLocalInstr : public TemplateDefinition<0> { |
| 2638 public: | 2638 public: |
| 2639 LoadLocalInstr(const LocalVariable& local, intptr_t context_level) | 2639 LoadLocalInstr(const LocalVariable& local, intptr_t context_level) |
| 2640 : local_(local), | 2640 : local_(local), |
| 2641 context_level_(context_level) { } | 2641 context_level_(context_level) { } |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3197 MethodRecognizer::Kind recognized_kind() const { | 3197 MethodRecognizer::Kind recognized_kind() const { |
| 3198 return recognized_kind_; | 3198 return recognized_kind_; |
| 3199 } | 3199 } |
| 3200 | 3200 |
| 3201 bool IsImmutableLengthLoad() const; | 3201 bool IsImmutableLengthLoad() const; |
| 3202 | 3202 |
| 3203 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); | 3203 virtual Definition* Canonicalize(FlowGraphOptimizer* optimizer); |
| 3204 | 3204 |
| 3205 static MethodRecognizer::Kind RecognizedKindFromArrayCid(intptr_t cid); | 3205 static MethodRecognizer::Kind RecognizedKindFromArrayCid(intptr_t cid); |
| 3206 | 3206 |
| 3207 static bool IsFixedLengthArrayCid(intptr_t cid); |
| 3208 |
| 3207 private: | 3209 private: |
| 3208 const intptr_t offset_in_bytes_; | 3210 const intptr_t offset_in_bytes_; |
| 3209 const AbstractType& type_; | 3211 const AbstractType& type_; |
| 3210 intptr_t result_cid_; | 3212 intptr_t result_cid_; |
| 3211 const bool immutable_; | 3213 const bool immutable_; |
| 3212 | 3214 |
| 3213 MethodRecognizer::Kind recognized_kind_; | 3215 MethodRecognizer::Kind recognized_kind_; |
| 3214 | 3216 |
| 3215 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); | 3217 DISALLOW_COPY_AND_ASSIGN(LoadFieldInstr); |
| 3216 }; | 3218 }; |
| (...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4497 ForwardInstructionIterator* current_iterator_; | 4499 ForwardInstructionIterator* current_iterator_; |
| 4498 | 4500 |
| 4499 private: | 4501 private: |
| 4500 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); | 4502 DISALLOW_COPY_AND_ASSIGN(FlowGraphVisitor); |
| 4501 }; | 4503 }; |
| 4502 | 4504 |
| 4503 | 4505 |
| 4504 } // namespace dart | 4506 } // namespace dart |
| 4505 | 4507 |
| 4506 #endif // VM_INTERMEDIATE_LANGUAGE_H_ | 4508 #endif // VM_INTERMEDIATE_LANGUAGE_H_ |
| OLD | NEW |