| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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_PARSER_H_ | 5 #ifndef VM_PARSER_H_ |
| 6 #define VM_PARSER_H_ | 6 #define VM_PARSER_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
| 9 | 9 |
| 10 #include "vm/ast.h" | 10 #include "vm/ast.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // The class ParsedFunction holds the result of parsing a function. | 30 // The class ParsedFunction holds the result of parsing a function. |
| 31 class ParsedFunction : public ZoneAllocated { | 31 class ParsedFunction : public ZoneAllocated { |
| 32 public: | 32 public: |
| 33 static const int kFirstLocalSlotIndex = -2; | 33 static const int kFirstLocalSlotIndex = -2; |
| 34 | 34 |
| 35 explicit ParsedFunction(const Function& function) | 35 explicit ParsedFunction(const Function& function) |
| 36 : function_(function), | 36 : function_(function), |
| 37 node_sequence_(NULL), | 37 node_sequence_(NULL), |
| 38 instantiator_(NULL), | 38 instantiator_(NULL), |
| 39 default_parameter_values_(Array::ZoneHandle()), | 39 default_parameter_values_(Array::ZoneHandle()), |
| 40 saved_current_context_var_(NULL), |
| 40 saved_entry_context_var_(NULL), | 41 saved_entry_context_var_(NULL), |
| 41 expression_temp_var_(NULL), | 42 expression_temp_var_(NULL), |
| 42 first_parameter_index_(0), | 43 first_parameter_index_(0), |
| 43 first_stack_local_index_(0), | 44 first_stack_local_index_(0), |
| 44 num_copied_params_(0), | 45 num_copied_params_(0), |
| 45 num_stack_locals_(0) { | 46 num_stack_locals_(0) { |
| 46 ASSERT(function.IsZoneHandle()); | 47 ASSERT(function.IsZoneHandle()); |
| 47 } | 48 } |
| 48 | 49 |
| 49 const Function& function() const { return function_; } | 50 const Function& function() const { return function_; } |
| 50 | 51 |
| 51 SequenceNode* node_sequence() const { return node_sequence_; } | 52 SequenceNode* node_sequence() const { return node_sequence_; } |
| 52 void SetNodeSequence(SequenceNode* node_sequence); | 53 void SetNodeSequence(SequenceNode* node_sequence); |
| 53 | 54 |
| 54 AstNode* instantiator() const { return instantiator_; } | 55 AstNode* instantiator() const { return instantiator_; } |
| 55 void set_instantiator(AstNode* instantiator) { | 56 void set_instantiator(AstNode* instantiator) { |
| 56 // May be NULL. | 57 // May be NULL. |
| 57 instantiator_ = instantiator; | 58 instantiator_ = instantiator; |
| 58 } | 59 } |
| 59 | 60 |
| 60 const Array& default_parameter_values() const { | 61 const Array& default_parameter_values() const { |
| 61 return default_parameter_values_; | 62 return default_parameter_values_; |
| 62 } | 63 } |
| 63 void set_default_parameter_values(const Array& default_parameter_values) { | 64 void set_default_parameter_values(const Array& default_parameter_values) { |
| 64 ASSERT(default_parameter_values.IsZoneHandle()); | 65 ASSERT(default_parameter_values.IsZoneHandle()); |
| 65 default_parameter_values_ = default_parameter_values.raw(); | 66 default_parameter_values_ = default_parameter_values.raw(); |
| 66 } | 67 } |
| 67 | 68 |
| 69 LocalVariable* saved_current_context_var() const { |
| 70 return saved_current_context_var_; |
| 71 } |
| 72 void set_saved_current_context_var(LocalVariable* saved_current_context_var) { |
| 73 ASSERT(saved_current_context_var != NULL); |
| 74 saved_current_context_var_ = saved_current_context_var; |
| 75 } |
| 76 |
| 68 LocalVariable* saved_entry_context_var() const { | 77 LocalVariable* saved_entry_context_var() const { |
| 69 return saved_entry_context_var_; | 78 return saved_entry_context_var_; |
| 70 } | 79 } |
| 71 void set_saved_entry_context_var(LocalVariable* saved_entry_context_var) { | 80 void set_saved_entry_context_var(LocalVariable* saved_entry_context_var) { |
| 72 ASSERT(saved_entry_context_var != NULL); | 81 ASSERT(saved_entry_context_var != NULL); |
| 73 saved_entry_context_var_ = saved_entry_context_var; | 82 saved_entry_context_var_ = saved_entry_context_var; |
| 74 } | 83 } |
| 75 | 84 |
| 76 // Returns NULL if this function does not save the arguments descriptor on | 85 // Returns NULL if this function does not save the arguments descriptor on |
| 77 // entry. | 86 // entry. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 95 int num_copied_params() const { return num_copied_params_; } | 104 int num_copied_params() const { return num_copied_params_; } |
| 96 int num_stack_locals() const { return num_stack_locals_; } | 105 int num_stack_locals() const { return num_stack_locals_; } |
| 97 | 106 |
| 98 void AllocateVariables(); | 107 void AllocateVariables(); |
| 99 | 108 |
| 100 private: | 109 private: |
| 101 const Function& function_; | 110 const Function& function_; |
| 102 SequenceNode* node_sequence_; | 111 SequenceNode* node_sequence_; |
| 103 AstNode* instantiator_; | 112 AstNode* instantiator_; |
| 104 Array& default_parameter_values_; | 113 Array& default_parameter_values_; |
| 114 LocalVariable* saved_current_context_var_; |
| 105 LocalVariable* saved_entry_context_var_; | 115 LocalVariable* saved_entry_context_var_; |
| 106 LocalVariable* expression_temp_var_; | 116 LocalVariable* expression_temp_var_; |
| 107 | 117 |
| 108 int first_parameter_index_; | 118 int first_parameter_index_; |
| 109 int first_stack_local_index_; | 119 int first_stack_local_index_; |
| 110 int num_copied_params_; | 120 int num_copied_params_; |
| 111 int num_stack_locals_; | 121 int num_stack_locals_; |
| 112 | 122 |
| 113 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 123 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); |
| 114 }; | 124 }; |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 642 |
| 633 // Allocate temporary only once per function. | 643 // Allocate temporary only once per function. |
| 634 LocalVariable* expression_temp_; | 644 LocalVariable* expression_temp_; |
| 635 | 645 |
| 636 DISALLOW_COPY_AND_ASSIGN(Parser); | 646 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 637 }; | 647 }; |
| 638 | 648 |
| 639 } // namespace dart | 649 } // namespace dart |
| 640 | 650 |
| 641 #endif // VM_PARSER_H_ | 651 #endif // VM_PARSER_H_ |
| OLD | NEW |