Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Side by Side Diff: src/compiler.h

Issue 10868106: Print reason for disabling optimization. Kill --trace-bailout flag. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/compiler.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 deferred_handles_ = deferred_handles; 177 deferred_handles_ = deferred_handles;
178 } 178 }
179 179
180 void SaveHandles() { 180 void SaveHandles() {
181 SaveHandle(&closure_); 181 SaveHandle(&closure_);
182 SaveHandle(&shared_info_); 182 SaveHandle(&shared_info_);
183 SaveHandle(&calling_context_); 183 SaveHandle(&calling_context_);
184 SaveHandle(&script_); 184 SaveHandle(&script_);
185 } 185 }
186 186
187 const char* bailout_reason() const { return bailout_reason_; }
188 void set_bailout_reason(const char* reason) { bailout_reason_ = reason; }
189
187 private: 190 private:
188 Isolate* isolate_; 191 Isolate* isolate_;
189 192
190 // Compilation mode. 193 // Compilation mode.
191 // BASE is generated by the full codegen, optionally prepared for bailouts. 194 // BASE is generated by the full codegen, optionally prepared for bailouts.
192 // OPTIMIZE is optimized code generated by the Hydrogen-based backend. 195 // OPTIMIZE is optimized code generated by the Hydrogen-based backend.
193 // NONOPT is generated by the full codegen and is not prepared for 196 // NONOPT is generated by the full codegen and is not prepared for
194 // recompilation/bailouts. These functions are never recompiled. 197 // recompilation/bailouts. These functions are never recompiled.
195 enum Mode { 198 enum Mode {
196 BASE, 199 BASE,
197 OPTIMIZE, 200 OPTIMIZE,
198 NONOPT 201 NONOPT
199 }; 202 };
200 203
201 void Initialize(Mode mode) { 204 void Initialize(Mode mode) {
202 mode_ = V8::UseCrankshaft() ? mode : NONOPT; 205 mode_ = V8::UseCrankshaft() ? mode : NONOPT;
203 ASSERT(!script_.is_null()); 206 ASSERT(!script_.is_null());
204 if (script_->type()->value() == Script::TYPE_NATIVE) { 207 if (script_->type()->value() == Script::TYPE_NATIVE) {
205 MarkAsNative(); 208 MarkAsNative();
206 } 209 }
207 if (!shared_info_.is_null()) { 210 if (!shared_info_.is_null()) {
208 ASSERT(language_mode() == CLASSIC_MODE); 211 ASSERT(language_mode() == CLASSIC_MODE);
209 SetLanguageMode(shared_info_->language_mode()); 212 SetLanguageMode(shared_info_->language_mode());
210 } 213 }
214 set_bailout_reason("unknown");
211 } 215 }
212 216
213 void SetMode(Mode mode) { 217 void SetMode(Mode mode) {
214 ASSERT(V8::UseCrankshaft()); 218 ASSERT(V8::UseCrankshaft());
215 mode_ = mode; 219 mode_ = mode;
216 } 220 }
217 221
218 // Flags using template class BitField<type, start, length>. All are 222 // Flags using template class BitField<type, start, length>. All are
219 // false by default. 223 // false by default.
220 // 224 //
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 DeferredHandles* deferred_handles_; 277 DeferredHandles* deferred_handles_;
274 278
275 template<typename T> 279 template<typename T>
276 void SaveHandle(Handle<T> *object) { 280 void SaveHandle(Handle<T> *object) {
277 if (!object->is_null()) { 281 if (!object->is_null()) {
278 Handle<T> handle(*(*object)); 282 Handle<T> handle(*(*object));
279 *object = handle; 283 *object = handle;
280 } 284 }
281 } 285 }
282 286
287 const char* bailout_reason_;
288
283 DISALLOW_COPY_AND_ASSIGN(CompilationInfo); 289 DISALLOW_COPY_AND_ASSIGN(CompilationInfo);
284 }; 290 };
285 291
286 292
287 // Exactly like a CompilationInfo, except also creates and enters a 293 // Exactly like a CompilationInfo, except also creates and enters a
288 // Zone on construction and deallocates it on exit. 294 // Zone on construction and deallocates it on exit.
289 class CompilationInfoWithZone: public CompilationInfo { 295 class CompilationInfoWithZone: public CompilationInfo {
290 public: 296 public:
291 explicit CompilationInfoWithZone(Handle<Script> script) 297 explicit CompilationInfoWithZone(Handle<Script> script)
292 : CompilationInfo(script, &zone_), 298 : CompilationInfo(script, &zone_),
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 359
354 MUST_USE_RESULT Status CreateGraph(); 360 MUST_USE_RESULT Status CreateGraph();
355 MUST_USE_RESULT Status OptimizeGraph(); 361 MUST_USE_RESULT Status OptimizeGraph();
356 MUST_USE_RESULT Status GenerateAndInstallCode(); 362 MUST_USE_RESULT Status GenerateAndInstallCode();
357 363
358 Status last_status() const { return last_status_; } 364 Status last_status() const { return last_status_; }
359 CompilationInfo* info() const { return info_; } 365 CompilationInfo* info() const { return info_; }
360 366
361 MUST_USE_RESULT Status AbortOptimization() { 367 MUST_USE_RESULT Status AbortOptimization() {
362 info_->AbortOptimization(); 368 info_->AbortOptimization();
363 info_->shared_info()->DisableOptimization(); 369 info_->shared_info()->DisableOptimization(info_->bailout_reason());
364 return SetLastStatus(BAILED_OUT); 370 return SetLastStatus(BAILED_OUT);
365 } 371 }
366 372
367 private: 373 private:
368 CompilationInfo* info_; 374 CompilationInfo* info_;
369 TypeFeedbackOracle* oracle_; 375 TypeFeedbackOracle* oracle_;
370 HGraphBuilder* graph_builder_; 376 HGraphBuilder* graph_builder_;
371 HGraph* graph_; 377 HGraph* graph_;
372 LChunk* chunk_; 378 LChunk* chunk_;
373 int64_t time_taken_to_create_graph_; 379 int64_t time_taken_to_create_graph_;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
462 468
463 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag, 469 static void RecordFunctionCompilation(Logger::LogEventsAndTags tag,
464 CompilationInfo* info, 470 CompilationInfo* info,
465 Handle<SharedFunctionInfo> shared); 471 Handle<SharedFunctionInfo> shared);
466 }; 472 };
467 473
468 474
469 } } // namespace v8::internal 475 } } // namespace v8::internal
470 476
471 #endif // V8_COMPILER_H_ 477 #endif // V8_COMPILER_H_
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.cc ('k') | src/compiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698