| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PARSING_PREPARSE_DATA_H_ | 5 #ifndef V8_PARSING_PREPARSE_DATA_H_ |
| 6 #define V8_PARSING_PREPARSE_DATA_H_ | 6 #define V8_PARSING_PREPARSE_DATA_H_ |
| 7 | 7 |
| 8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
| 9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
| 10 #include "src/collector.h" | 10 #include "src/collector.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 DISALLOW_COPY_AND_ASSIGN(ScriptData); | 46 DISALLOW_COPY_AND_ASSIGN(ScriptData); |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 class PreParserLogger final { | 49 class PreParserLogger final { |
| 50 public: | 50 public: |
| 51 PreParserLogger() | 51 PreParserLogger() |
| 52 : end_(-1), | 52 : end_(-1), |
| 53 num_parameters_(-1), | 53 num_parameters_(-1), |
| 54 function_length_(-1), | 54 function_length_(-1), |
| 55 has_duplicate_parameters_(false) {} | 55 has_duplicate_parameters_(false), |
| 56 num_inner_functions_(-1) {} |
| 56 | 57 |
| 57 void LogFunction(int end, int num_parameters, int function_length, | 58 void LogFunction(int end, int num_parameters, int function_length, |
| 58 bool has_duplicate_parameters, int literals, | 59 bool has_duplicate_parameters, int literals, int properties, |
| 59 int properties) { | 60 int num_inner_functions) { |
| 60 end_ = end; | 61 end_ = end; |
| 61 num_parameters_ = num_parameters; | 62 num_parameters_ = num_parameters; |
| 62 function_length_ = function_length; | 63 function_length_ = function_length; |
| 63 has_duplicate_parameters_ = has_duplicate_parameters; | 64 has_duplicate_parameters_ = has_duplicate_parameters; |
| 64 literals_ = literals; | 65 literals_ = literals; |
| 65 properties_ = properties; | 66 properties_ = properties; |
| 67 num_inner_functions_ = num_inner_functions; |
| 66 } | 68 } |
| 67 | 69 |
| 68 int end() const { return end_; } | 70 int end() const { return end_; } |
| 69 int num_parameters() const { | 71 int num_parameters() const { |
| 70 return num_parameters_; | 72 return num_parameters_; |
| 71 } | 73 } |
| 72 int function_length() const { | 74 int function_length() const { |
| 73 return function_length_; | 75 return function_length_; |
| 74 } | 76 } |
| 75 bool has_duplicate_parameters() const { | 77 bool has_duplicate_parameters() const { |
| 76 return has_duplicate_parameters_; | 78 return has_duplicate_parameters_; |
| 77 } | 79 } |
| 78 int literals() const { | 80 int literals() const { |
| 79 return literals_; | 81 return literals_; |
| 80 } | 82 } |
| 81 int properties() const { | 83 int properties() const { |
| 82 return properties_; | 84 return properties_; |
| 83 } | 85 } |
| 86 int num_inner_functions() const { return num_inner_functions_; } |
| 84 | 87 |
| 85 private: | 88 private: |
| 86 int end_; | 89 int end_; |
| 87 // For function entries. | 90 // For function entries. |
| 88 int num_parameters_; | 91 int num_parameters_; |
| 89 int function_length_; | 92 int function_length_; |
| 90 bool has_duplicate_parameters_; | 93 bool has_duplicate_parameters_; |
| 91 int literals_; | 94 int literals_; |
| 92 int properties_; | 95 int properties_; |
| 96 int num_inner_functions_; |
| 93 }; | 97 }; |
| 94 | 98 |
| 95 class ParserLogger final { | 99 class ParserLogger final { |
| 96 public: | 100 public: |
| 97 ParserLogger(); | 101 ParserLogger(); |
| 98 | 102 |
| 99 void LogFunction(int start, int end, int num_parameters, int function_length, | 103 void LogFunction(int start, int end, int num_parameters, int function_length, |
| 100 bool has_duplicate_parameters, int literals, int properties, | 104 bool has_duplicate_parameters, int literals, int properties, |
| 101 LanguageMode language_mode, bool uses_super_property, | 105 LanguageMode language_mode, bool uses_super_property, |
| 102 bool calls_eval); | 106 bool calls_eval, int num_inner_functions); |
| 103 | 107 |
| 104 ScriptData* GetScriptData(); | 108 ScriptData* GetScriptData(); |
| 105 | 109 |
| 106 private: | 110 private: |
| 107 Collector<unsigned> function_store_; | 111 Collector<unsigned> function_store_; |
| 108 unsigned preamble_[PreparseDataConstants::kHeaderSize]; | 112 unsigned preamble_[PreparseDataConstants::kHeaderSize]; |
| 109 | 113 |
| 110 #ifdef DEBUG | 114 #ifdef DEBUG |
| 111 int prev_start_; | 115 int prev_start_; |
| 112 #endif | 116 #endif |
| 113 }; | 117 }; |
| 114 | 118 |
| 115 | 119 |
| 116 } // namespace internal | 120 } // namespace internal |
| 117 } // namespace v8. | 121 } // namespace v8. |
| 118 | 122 |
| 119 #endif // V8_PARSING_PREPARSE_DATA_H_ | 123 #endif // V8_PARSING_PREPARSE_DATA_H_ |
| OLD | NEW |