| 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_context_var_(NULL), | 40 saved_entry_context_var_(NULL), |
| 41 expression_temp_var_(NULL), | 41 expression_temp_var_(NULL), |
| 42 first_parameter_index_(0), | 42 first_parameter_index_(0), |
| 43 first_stack_local_index_(0), | 43 first_stack_local_index_(0), |
| 44 num_copied_params_(0), | 44 num_copied_params_(0), |
| 45 num_stack_locals_(0) { | 45 num_stack_locals_(0) { |
| 46 ASSERT(function.IsZoneHandle()); | 46 ASSERT(function.IsZoneHandle()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 const Function& function() const { return function_; } | 49 const Function& function() const { return function_; } |
| 50 | 50 |
| 51 SequenceNode* node_sequence() const { return node_sequence_; } | 51 SequenceNode* node_sequence() const { return node_sequence_; } |
| 52 void SetNodeSequence(SequenceNode* node_sequence); | 52 void SetNodeSequence(SequenceNode* node_sequence); |
| 53 | 53 |
| 54 AstNode* instantiator() const { return instantiator_; } | 54 AstNode* instantiator() const { return instantiator_; } |
| 55 void set_instantiator(AstNode* instantiator) { | 55 void set_instantiator(AstNode* instantiator) { |
| 56 // May be NULL. | 56 // May be NULL. |
| 57 instantiator_ = instantiator; | 57 instantiator_ = instantiator; |
| 58 } | 58 } |
| 59 | 59 |
| 60 const Array& default_parameter_values() const { | 60 const Array& default_parameter_values() const { |
| 61 return default_parameter_values_; | 61 return default_parameter_values_; |
| 62 } | 62 } |
| 63 void set_default_parameter_values(const Array& default_parameter_values) { | 63 void set_default_parameter_values(const Array& default_parameter_values) { |
| 64 ASSERT(default_parameter_values.IsZoneHandle()); | 64 ASSERT(default_parameter_values.IsZoneHandle()); |
| 65 default_parameter_values_ = default_parameter_values.raw(); | 65 default_parameter_values_ = default_parameter_values.raw(); |
| 66 } | 66 } |
| 67 | 67 |
| 68 LocalVariable* saved_context_var() const { return saved_context_var_; } | 68 LocalVariable* saved_entry_context_var() const { |
| 69 void set_saved_context_var(LocalVariable* saved_context_var) { | 69 return saved_entry_context_var_; |
| 70 ASSERT(saved_context_var != NULL); | 70 } |
| 71 saved_context_var_ = saved_context_var; | 71 void set_saved_entry_context_var(LocalVariable* saved_entry_context_var) { |
| 72 ASSERT(saved_entry_context_var != NULL); |
| 73 saved_entry_context_var_ = saved_entry_context_var; |
| 72 } | 74 } |
| 73 | 75 |
| 74 // Returns NULL if this function does not save the arguments descriptor on | 76 // Returns NULL if this function does not save the arguments descriptor on |
| 75 // entry. | 77 // entry. |
| 76 LocalVariable* GetSavedArgumentsDescriptorVar() const; | 78 LocalVariable* GetSavedArgumentsDescriptorVar() const; |
| 77 | 79 |
| 78 LocalVariable* expression_temp_var() const { | 80 LocalVariable* expression_temp_var() const { |
| 79 ASSERT(has_expression_temp_var()); | 81 ASSERT(has_expression_temp_var()); |
| 80 return expression_temp_var_; | 82 return expression_temp_var_; |
| 81 } | 83 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 93 int num_copied_params() const { return num_copied_params_; } | 95 int num_copied_params() const { return num_copied_params_; } |
| 94 int num_stack_locals() const { return num_stack_locals_; } | 96 int num_stack_locals() const { return num_stack_locals_; } |
| 95 | 97 |
| 96 void AllocateVariables(); | 98 void AllocateVariables(); |
| 97 | 99 |
| 98 private: | 100 private: |
| 99 const Function& function_; | 101 const Function& function_; |
| 100 SequenceNode* node_sequence_; | 102 SequenceNode* node_sequence_; |
| 101 AstNode* instantiator_; | 103 AstNode* instantiator_; |
| 102 Array& default_parameter_values_; | 104 Array& default_parameter_values_; |
| 103 LocalVariable* saved_context_var_; | 105 LocalVariable* saved_entry_context_var_; |
| 104 LocalVariable* expression_temp_var_; | 106 LocalVariable* expression_temp_var_; |
| 105 | 107 |
| 106 int first_parameter_index_; | 108 int first_parameter_index_; |
| 107 int first_stack_local_index_; | 109 int first_stack_local_index_; |
| 108 int num_copied_params_; | 110 int num_copied_params_; |
| 109 int num_stack_locals_; | 111 int num_stack_locals_; |
| 110 | 112 |
| 111 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 113 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); |
| 112 }; | 114 }; |
| 113 | 115 |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 | 632 |
| 631 // Allocate temporary only once per function. | 633 // Allocate temporary only once per function. |
| 632 LocalVariable* expression_temp_; | 634 LocalVariable* expression_temp_; |
| 633 | 635 |
| 634 DISALLOW_COPY_AND_ASSIGN(Parser); | 636 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 635 }; | 637 }; |
| 636 | 638 |
| 637 } // namespace dart | 639 } // namespace dart |
| 638 | 640 |
| 639 #endif // VM_PARSER_H_ | 641 #endif // VM_PARSER_H_ |
| OLD | NEW |