OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 | 8 |
9 #include "src/ast-numbering.h" | 9 #include "src/ast-numbering.h" |
10 #include "src/ast-this-access-visitor.h" | 10 #include "src/ast-this-access-visitor.h" |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 MODULE_NODE_LIST(DEF_VISIT) | 337 MODULE_NODE_LIST(DEF_VISIT) |
338 DECLARATION_NODE_LIST(DEF_VISIT) | 338 DECLARATION_NODE_LIST(DEF_VISIT) |
339 #undef DEF_VISIT | 339 #undef DEF_VISIT |
340 }; | 340 }; |
341 | 341 |
342 | 342 |
343 OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { | 343 OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { |
344 DCHECK(info()->IsOptimizing()); | 344 DCHECK(info()->IsOptimizing()); |
345 DCHECK(!info()->IsCompilingForDebugging()); | 345 DCHECK(!info()->IsCompilingForDebugging()); |
346 | 346 |
347 // Optimization could have been disabled by the parser. | 347 // Do not use Crankshaft/TurboFan if we need to be able to set break points. |
348 if (info()->shared_info()->optimization_disabled()) { | |
349 return AbortOptimization( | |
350 info()->shared_info()->disable_optimization_reason()); | |
351 } | |
352 | |
353 // Do not use crankshaft if we need to be able to set break points. | |
354 if (isolate()->DebuggerHasBreakPoints()) { | 348 if (isolate()->DebuggerHasBreakPoints()) { |
355 return RetryOptimization(kDebuggerHasBreakPoints); | 349 return RetryOptimization(kDebuggerHasBreakPoints); |
356 } | 350 } |
357 | 351 |
358 // Limit the number of times we re-compile a functions with | 352 // Limit the number of times we re-compile a functions with |
359 // the optimizing compiler. | 353 // the optimizing compiler. |
360 const int kMaxOptCount = | 354 const int kMaxOptCount = |
361 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; | 355 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
362 if (info()->opt_count() > kMaxOptCount) { | 356 if (info()->opt_count() > kMaxOptCount) { |
363 return AbortOptimization(kOptimizedTooManyTimes); | 357 return AbortOptimization(kOptimizedTooManyTimes); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 << " using Crankshaft]" << std::endl; | 428 << " using Crankshaft]" << std::endl; |
435 } | 429 } |
436 | 430 |
437 if (FLAG_trace_hydrogen) { | 431 if (FLAG_trace_hydrogen) { |
438 isolate()->GetHTracer()->TraceCompilation(info()); | 432 isolate()->GetHTracer()->TraceCompilation(info()); |
439 } | 433 } |
440 | 434 |
441 // Type-check the function. | 435 // Type-check the function. |
442 AstTyper::Run(info()); | 436 AstTyper::Run(info()); |
443 | 437 |
| 438 // Optimization could have been disabled by the parser. Note that this check |
| 439 // is only needed because the Hydrogen graph builder is missing some bailouts. |
| 440 if (info()->shared_info()->optimization_disabled()) { |
| 441 return AbortOptimization( |
| 442 info()->shared_info()->disable_optimization_reason()); |
| 443 } |
| 444 |
444 graph_builder_ = (FLAG_hydrogen_track_positions || FLAG_trace_ic) | 445 graph_builder_ = (FLAG_hydrogen_track_positions || FLAG_trace_ic) |
445 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) | 446 ? new(info()->zone()) HOptimizedGraphBuilderWithPositions(info()) |
446 : new(info()->zone()) HOptimizedGraphBuilder(info()); | 447 : new(info()->zone()) HOptimizedGraphBuilder(info()); |
447 | 448 |
448 Timer t(this, &time_taken_to_create_graph_); | 449 Timer t(this, &time_taken_to_create_graph_); |
449 info()->set_this_has_uses(false); | 450 info()->set_this_has_uses(false); |
450 graph_ = graph_builder_->CreateGraph(); | 451 graph_ = graph_builder_->CreateGraph(); |
451 | 452 |
452 if (isolate()->has_pending_exception()) { | 453 if (isolate()->has_pending_exception()) { |
453 return SetLastStatus(FAILED); | 454 return SetLastStatus(FAILED); |
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 AllowHandleDereference allow_deref; | 1580 AllowHandleDereference allow_deref; |
1580 bool tracing_on = info()->IsStub() | 1581 bool tracing_on = info()->IsStub() |
1581 ? FLAG_trace_hydrogen_stubs | 1582 ? FLAG_trace_hydrogen_stubs |
1582 : (FLAG_trace_hydrogen && | 1583 : (FLAG_trace_hydrogen && |
1583 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); | 1584 info()->closure()->PassesFilter(FLAG_trace_hydrogen_filter)); |
1584 return (tracing_on && | 1585 return (tracing_on && |
1585 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); | 1586 base::OS::StrChr(const_cast<char*>(FLAG_trace_phase), name_[0]) != NULL); |
1586 } | 1587 } |
1587 | 1588 |
1588 } } // namespace v8::internal | 1589 } } // namespace v8::internal |
OLD | NEW |