| 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 23 matching lines...) Expand all Loading... |
| 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::Handle()), | 39 default_parameter_values_(Array::Handle()), |
| 40 saved_context_var_(NULL), | 40 saved_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 copied_parameter_count_(0), | 44 num_copied_params_(0), |
| 45 stack_local_count_(0) { } | 45 num_stack_locals_(0) { } |
| 46 | 46 |
| 47 const Function& function() const { return function_; } | 47 const Function& function() const { return function_; } |
| 48 | 48 |
| 49 SequenceNode* node_sequence() const { return node_sequence_; } | 49 SequenceNode* node_sequence() const { return node_sequence_; } |
| 50 void SetNodeSequence(SequenceNode* node_sequence); | 50 void SetNodeSequence(SequenceNode* node_sequence); |
| 51 | 51 |
| 52 AstNode* instantiator() const { return instantiator_; } | 52 AstNode* instantiator() const { return instantiator_; } |
| 53 void set_instantiator(AstNode* instantiator) { | 53 void set_instantiator(AstNode* instantiator) { |
| 54 // May be NULL. | 54 // May be NULL. |
| 55 instantiator_ = instantiator; | 55 instantiator_ = instantiator; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 80 ASSERT(!has_expression_temp_var()); | 80 ASSERT(!has_expression_temp_var()); |
| 81 expression_temp_var_ = value; | 81 expression_temp_var_ = value; |
| 82 } | 82 } |
| 83 bool has_expression_temp_var() const { | 83 bool has_expression_temp_var() const { |
| 84 return expression_temp_var_ != NULL; | 84 return expression_temp_var_ != NULL; |
| 85 } | 85 } |
| 86 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos); | 86 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos); |
| 87 | 87 |
| 88 int first_parameter_index() const { return first_parameter_index_; } | 88 int first_parameter_index() const { return first_parameter_index_; } |
| 89 int first_stack_local_index() const { return first_stack_local_index_; } | 89 int first_stack_local_index() const { return first_stack_local_index_; } |
| 90 int copied_parameter_count() const { return copied_parameter_count_; } | 90 int num_copied_params() const { return num_copied_params_; } |
| 91 int stack_local_count() const { return stack_local_count_; } | 91 int num_stack_locals() const { return num_stack_locals_; } |
| 92 | 92 |
| 93 void AllocateVariables(); | 93 void AllocateVariables(); |
| 94 | 94 |
| 95 private: | 95 private: |
| 96 const Function& function_; | 96 const Function& function_; |
| 97 SequenceNode* node_sequence_; | 97 SequenceNode* node_sequence_; |
| 98 AstNode* instantiator_; | 98 AstNode* instantiator_; |
| 99 Array& default_parameter_values_; | 99 Array& default_parameter_values_; |
| 100 LocalVariable* saved_context_var_; | 100 LocalVariable* saved_context_var_; |
| 101 LocalVariable* expression_temp_var_; | 101 LocalVariable* expression_temp_var_; |
| 102 | 102 |
| 103 int first_parameter_index_; | 103 int first_parameter_index_; |
| 104 int first_stack_local_index_; | 104 int first_stack_local_index_; |
| 105 int copied_parameter_count_; | 105 int num_copied_params_; |
| 106 int stack_local_count_; | 106 int num_stack_locals_; |
| 107 | 107 |
| 108 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 108 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 | 111 |
| 112 class Parser : public ValueObject { | 112 class Parser : public ValueObject { |
| 113 public: | 113 public: |
| 114 Parser(const Script& script, const Library& library); | 114 Parser(const Script& script, const Library& library); |
| 115 Parser(const Script& script, const Function& function, intptr_t token_pos); | 115 Parser(const Script& script, const Function& function, intptr_t token_pos); |
| 116 | 116 |
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 606 | 606 |
| 607 // Allocate temporary only once per function. | 607 // Allocate temporary only once per function. |
| 608 LocalVariable* expression_temp_; | 608 LocalVariable* expression_temp_; |
| 609 | 609 |
| 610 DISALLOW_COPY_AND_ASSIGN(Parser); | 610 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 611 }; | 611 }; |
| 612 | 612 |
| 613 } // namespace dart | 613 } // namespace dart |
| 614 | 614 |
| 615 #endif // VM_PARSER_H_ | 615 #endif // VM_PARSER_H_ |
| OLD | NEW |