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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 num_inner_functions_(-1) {} |
57 | 57 |
58 void LogFunction(int end, int num_parameters, int function_length, | 58 void LogFunction(int end, int num_parameters, int function_length, |
59 bool has_duplicate_parameters, int literals, int properties, | 59 bool has_duplicate_parameters, int properties, |
60 int num_inner_functions) { | 60 int num_inner_functions) { |
61 end_ = end; | 61 end_ = end; |
62 num_parameters_ = num_parameters; | 62 num_parameters_ = num_parameters; |
63 function_length_ = function_length; | 63 function_length_ = function_length; |
64 has_duplicate_parameters_ = has_duplicate_parameters; | 64 has_duplicate_parameters_ = has_duplicate_parameters; |
65 literals_ = literals; | |
66 properties_ = properties; | 65 properties_ = properties; |
67 num_inner_functions_ = num_inner_functions; | 66 num_inner_functions_ = num_inner_functions; |
68 } | 67 } |
69 | 68 |
70 int end() const { return end_; } | 69 int end() const { return end_; } |
71 int num_parameters() const { | 70 int num_parameters() const { |
72 return num_parameters_; | 71 return num_parameters_; |
73 } | 72 } |
74 int function_length() const { | 73 int function_length() const { |
75 return function_length_; | 74 return function_length_; |
76 } | 75 } |
77 bool has_duplicate_parameters() const { | 76 bool has_duplicate_parameters() const { |
78 return has_duplicate_parameters_; | 77 return has_duplicate_parameters_; |
79 } | 78 } |
80 int literals() const { | |
81 return literals_; | |
82 } | |
83 int properties() const { | 79 int properties() const { |
84 return properties_; | 80 return properties_; |
85 } | 81 } |
86 int num_inner_functions() const { return num_inner_functions_; } | 82 int num_inner_functions() const { return num_inner_functions_; } |
87 | 83 |
88 private: | 84 private: |
89 int end_; | 85 int end_; |
90 // For function entries. | 86 // For function entries. |
91 int num_parameters_; | 87 int num_parameters_; |
92 int function_length_; | 88 int function_length_; |
93 bool has_duplicate_parameters_; | 89 bool has_duplicate_parameters_; |
94 int literals_; | |
95 int properties_; | 90 int properties_; |
96 int num_inner_functions_; | 91 int num_inner_functions_; |
97 }; | 92 }; |
98 | 93 |
99 class ParserLogger final { | 94 class ParserLogger final { |
100 public: | 95 public: |
101 ParserLogger(); | 96 ParserLogger(); |
102 | 97 |
103 void LogFunction(int start, int end, int num_parameters, int function_length, | 98 void LogFunction(int start, int end, int num_parameters, int function_length, |
104 bool has_duplicate_parameters, int literals, int properties, | 99 bool has_duplicate_parameters, int properties, |
105 LanguageMode language_mode, bool uses_super_property, | 100 LanguageMode language_mode, bool uses_super_property, |
106 bool calls_eval, int num_inner_functions); | 101 bool calls_eval, int num_inner_functions); |
107 | 102 |
108 ScriptData* GetScriptData(); | 103 ScriptData* GetScriptData(); |
109 | 104 |
110 private: | 105 private: |
111 Collector<unsigned> function_store_; | 106 Collector<unsigned> function_store_; |
112 unsigned preamble_[PreparseDataConstants::kHeaderSize]; | 107 unsigned preamble_[PreparseDataConstants::kHeaderSize]; |
113 | 108 |
114 #ifdef DEBUG | 109 #ifdef DEBUG |
115 int prev_start_; | 110 int prev_start_; |
116 #endif | 111 #endif |
117 }; | 112 }; |
118 | 113 |
119 | 114 |
120 } // namespace internal | 115 } // namespace internal |
121 } // namespace v8. | 116 } // namespace v8. |
122 | 117 |
123 #endif // V8_PARSING_PREPARSE_DATA_H_ | 118 #endif // V8_PARSING_PREPARSE_DATA_H_ |
OLD | NEW |