OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 void EnableDeoptimizationSupport() { | 161 void EnableDeoptimizationSupport() { |
162 ASSERT(IsOptimizable()); | 162 ASSERT(IsOptimizable()); |
163 flags_ |= SupportsDeoptimization::encode(true); | 163 flags_ |= SupportsDeoptimization::encode(true); |
164 } | 164 } |
165 | 165 |
166 // Determine whether or not we can adaptively optimize. | 166 // Determine whether or not we can adaptively optimize. |
167 bool AllowOptimize() { | 167 bool AllowOptimize() { |
168 return V8::UseCrankshaft() && !closure_.is_null(); | 168 return V8::UseCrankshaft() && !closure_.is_null(); |
169 } | 169 } |
170 | 170 |
| 171 // Determines whether or not to insert a self-optimization header. |
| 172 bool ShouldSelfOptimize(); |
| 173 |
171 // Disable all optimization attempts of this info for the rest of the | 174 // Disable all optimization attempts of this info for the rest of the |
172 // current compilation pipeline. | 175 // current compilation pipeline. |
173 void AbortOptimization(); | 176 void AbortOptimization(); |
174 | 177 |
175 private: | 178 private: |
176 Isolate* isolate_; | 179 Isolate* isolate_; |
177 | 180 |
178 // Compilation mode. | 181 // Compilation mode. |
179 // BASE is generated by the full codegen, optionally prepared for bailouts. | 182 // BASE is generated by the full codegen, optionally prepared for bailouts. |
180 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. | 183 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // real function with a context. | 276 // real function with a context. |
274 | 277 |
275 class Compiler : public AllStatic { | 278 class Compiler : public AllStatic { |
276 public: | 279 public: |
277 // Default maximum number of function optimization attempts before we | 280 // Default maximum number of function optimization attempts before we |
278 // give up. | 281 // give up. |
279 static const int kDefaultMaxOptCount = 10; | 282 static const int kDefaultMaxOptCount = 10; |
280 | 283 |
281 static const int kMaxInliningLevels = 3; | 284 static const int kMaxInliningLevels = 3; |
282 | 285 |
| 286 // Call count before primitive functions trigger their own optimization. |
| 287 static const int kCallsUntilPrimitiveOpt = 200; |
| 288 |
283 // All routines return a SharedFunctionInfo. | 289 // All routines return a SharedFunctionInfo. |
284 // If an error occurs an exception is raised and the return handle | 290 // If an error occurs an exception is raised and the return handle |
285 // contains NULL. | 291 // contains NULL. |
286 | 292 |
287 // Compile a String source within a context. | 293 // Compile a String source within a context. |
288 static Handle<SharedFunctionInfo> Compile(Handle<String> source, | 294 static Handle<SharedFunctionInfo> Compile(Handle<String> source, |
289 Handle<Object> script_name, | 295 Handle<Object> script_name, |
290 int line_offset, | 296 int line_offset, |
291 int column_offset, | 297 int column_offset, |
292 v8::Extension* extension, | 298 v8::Extension* extension, |
(...skipping 29 matching lines...) Expand all Loading... |
322 | 328 |
323 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 329 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
324 CompilationInfo* info, | 330 CompilationInfo* info, |
325 Handle<SharedFunctionInfo> shared); | 331 Handle<SharedFunctionInfo> shared); |
326 }; | 332 }; |
327 | 333 |
328 | 334 |
329 } } // namespace v8::internal | 335 } } // namespace v8::internal |
330 | 336 |
331 #endif // V8_COMPILER_H_ | 337 #endif // V8_COMPILER_H_ |
OLD | NEW |