Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
|
Jakob Kummerow
2012/02/14 10:08:26
nit: 2012
fschneider
2012/02/14 13:03:11
Done.
| |
| 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 | 156 |
| 157 // Deoptimization support. | 157 // Deoptimization support. |
| 158 bool HasDeoptimizationSupport() const { | 158 bool HasDeoptimizationSupport() const { |
| 159 return SupportsDeoptimization::decode(flags_); | 159 return SupportsDeoptimization::decode(flags_); |
| 160 } | 160 } |
| 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. | |
| 167 bool AllowOptimize() { | |
| 168 return V8::UseCrankshaft() && !closure_.is_null(); | |
| 169 } | |
| 170 | |
| 171 // Determines whether or not to insert a self-optimization header. | 166 // Determines whether or not to insert a self-optimization header. |
| 172 bool ShouldSelfOptimize(); | 167 bool ShouldSelfOptimize(); |
| 173 | 168 |
| 174 // 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 |
| 175 // current compilation pipeline. | 170 // current compilation pipeline. |
| 176 void AbortOptimization(); | 171 void AbortOptimization(); |
| 177 | 172 |
| 178 private: | 173 private: |
| 179 Isolate* isolate_; | 174 Isolate* isolate_; |
| 180 | 175 |
| 181 // Compilation mode. | 176 // Compilation mode. |
| 182 // BASE is generated by the full codegen, optionally prepared for bailouts. | 177 // BASE is generated by the full codegen, optionally prepared for bailouts. |
| 183 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. | 178 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. |
| 184 // NONOPT is generated by the full codegen or the classic backend | 179 // NONOPT is generated by the full codegen and is not prepared for |
| 185 // and is not prepared for recompilation/bailouts. These functions | 180 // recompilation/bailouts. These functions are never recompiled. |
| 186 // are never recompiled. | |
| 187 enum Mode { | 181 enum Mode { |
| 188 BASE, | 182 BASE, |
| 189 OPTIMIZE, | 183 OPTIMIZE, |
| 190 NONOPT | 184 NONOPT |
| 191 }; | 185 }; |
| 192 | 186 |
| 193 CompilationInfo() : function_(NULL) {} | 187 CompilationInfo() : function_(NULL) {} |
| 194 | 188 |
| 195 void Initialize(Mode mode) { | 189 void Initialize(Mode mode) { |
| 196 mode_ = V8::UseCrankshaft() ? mode : NONOPT; | 190 mode_ = V8::UseCrankshaft() ? mode : NONOPT; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 328 | 322 |
| 329 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, | 323 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, |
| 330 CompilationInfo* info, | 324 CompilationInfo* info, |
| 331 Handle<SharedFunctionInfo> shared); | 325 Handle<SharedFunctionInfo> shared); |
| 332 }; | 326 }; |
| 333 | 327 |
| 334 | 328 |
| 335 } } // namespace v8::internal | 329 } } // namespace v8::internal |
| 336 | 330 |
| 337 #endif // V8_COMPILER_H_ | 331 #endif // V8_COMPILER_H_ |
| OLD | NEW |