OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 flags_ |= SupportsDeoptimization::encode(true); | 163 flags_ |= SupportsDeoptimization::encode(true); |
164 } | 164 } |
165 | 165 |
166 // Determines whether or not to insert a self-optimization header. | 166 // Determines whether or not to insert a self-optimization header. |
167 bool ShouldSelfOptimize(); | 167 bool ShouldSelfOptimize(); |
168 | 168 |
169 // Disable all optimization attempts of this info for the rest of the | 169 // Disable all optimization attempts of this info for the rest of the |
170 // current compilation pipeline. | 170 // current compilation pipeline. |
171 void AbortOptimization(); | 171 void AbortOptimization(); |
172 | 172 |
| 173 int number_of_ics() { return number_of_ics_; } |
| 174 void increment_number_of_ics() { number_of_ics_++; } |
| 175 |
173 private: | 176 private: |
174 Isolate* isolate_; | 177 Isolate* isolate_; |
175 | 178 |
176 // Compilation mode. | 179 // Compilation mode. |
177 // BASE is generated by the full codegen, optionally prepared for bailouts. | 180 // BASE is generated by the full codegen, optionally prepared for bailouts. |
178 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. | 181 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. |
179 // NONOPT is generated by the full codegen and is not prepared for | 182 // NONOPT is generated by the full codegen and is not prepared for |
180 // recompilation/bailouts. These functions are never recompiled. | 183 // recompilation/bailouts. These functions are never recompiled. |
181 enum Mode { | 184 enum Mode { |
182 BASE, | 185 BASE, |
183 OPTIMIZE, | 186 OPTIMIZE, |
184 NONOPT | 187 NONOPT |
185 }; | 188 }; |
186 | 189 |
187 CompilationInfo() : function_(NULL) {} | 190 CompilationInfo() : function_(NULL), number_of_ics_(0) {} |
188 | 191 |
189 void Initialize(Mode mode) { | 192 void Initialize(Mode mode) { |
190 mode_ = V8::UseCrankshaft() ? mode : NONOPT; | 193 mode_ = V8::UseCrankshaft() ? mode : NONOPT; |
191 ASSERT(!script_.is_null()); | 194 ASSERT(!script_.is_null()); |
192 if (script_->type()->value() == Script::TYPE_NATIVE) { | 195 if (script_->type()->value() == Script::TYPE_NATIVE) { |
193 MarkAsNative(); | 196 MarkAsNative(); |
194 } | 197 } |
195 if (!shared_info_.is_null()) { | 198 if (!shared_info_.is_null()) { |
196 ASSERT(language_mode() == CLASSIC_MODE); | 199 ASSERT(language_mode() == CLASSIC_MODE); |
197 SetLanguageMode(shared_info_->language_mode()); | 200 SetLanguageMode(shared_info_->language_mode()); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 ScriptDataImpl* pre_parse_data_; | 250 ScriptDataImpl* pre_parse_data_; |
248 | 251 |
249 // The context of the caller is needed for eval code, and will be a null | 252 // The context of the caller is needed for eval code, and will be a null |
250 // handle otherwise. | 253 // handle otherwise. |
251 Handle<Context> calling_context_; | 254 Handle<Context> calling_context_; |
252 | 255 |
253 // Compilation mode flag and whether deoptimization is allowed. | 256 // Compilation mode flag and whether deoptimization is allowed. |
254 Mode mode_; | 257 Mode mode_; |
255 int osr_ast_id_; | 258 int osr_ast_id_; |
256 | 259 |
| 260 int number_of_ics_; |
| 261 |
257 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); | 262 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); |
258 }; | 263 }; |
259 | 264 |
260 | 265 |
261 // The V8 compiler | 266 // The V8 compiler |
262 // | 267 // |
263 // General strategy: Source code is translated into an anonymous function w/o | 268 // General strategy: Source code is translated into an anonymous function w/o |
264 // parameters which then can be executed. If the source code contains other | 269 // parameters which then can be executed. If the source code contains other |
265 // functions, they will be compiled and allocated as part of the compilation | 270 // functions, they will be compiled and allocated as part of the compilation |
266 // of the source code. | 271 // of the source code. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
322 | 327 |
323 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 328 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
324 CompilationInfo* info, | 329 CompilationInfo* info, |
325 Handle<SharedFunctionInfo> shared); | 330 Handle<SharedFunctionInfo> shared); |
326 }; | 331 }; |
327 | 332 |
328 | 333 |
329 } } // namespace v8::internal | 334 } } // namespace v8::internal |
330 | 335 |
331 #endif // V8_COMPILER_H_ | 336 #endif // V8_COMPILER_H_ |
OLD | NEW |