| 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/compiler.h" | 5 #include "src/compiler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "src/ast/ast-numbering.h" | 9 #include "src/ast/ast-numbering.h" |
| 10 #include "src/ast/prettyprinter.h" | 10 #include "src/ast/prettyprinter.h" |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 // Implementation of OptimizedCompileJob | 308 // Implementation of OptimizedCompileJob |
| 309 | 309 |
| 310 OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { | 310 OptimizedCompileJob::Status OptimizedCompileJob::CreateGraph() { |
| 311 DCHECK(info()->IsOptimizing()); | 311 DCHECK(info()->IsOptimizing()); |
| 312 | 312 |
| 313 // Do not use Crankshaft/TurboFan if we need to be able to set break points. | 313 // Do not use Crankshaft/TurboFan if we need to be able to set break points. |
| 314 if (info()->shared_info()->HasDebugInfo()) { | 314 if (info()->shared_info()->HasDebugInfo()) { |
| 315 return AbortOptimization(kFunctionBeingDebugged); | 315 return AbortOptimization(kFunctionBeingDebugged); |
| 316 } | 316 } |
| 317 | 317 |
| 318 // Do not use Crankshaft/TurboFan on a generator function. |
| 319 // TODO(neis): Eventually enable for Turbofan. |
| 320 if (IsGeneratorFunction(info()->shared_info()->kind())) { |
| 321 return AbortOptimization(kGenerator); |
| 322 } |
| 323 |
| 318 // Limit the number of times we try to optimize functions. | 324 // Limit the number of times we try to optimize functions. |
| 319 const int kMaxOptCount = | 325 const int kMaxOptCount = |
| 320 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; | 326 FLAG_deopt_every_n_times == 0 ? FLAG_max_opt_count : 1000; |
| 321 if (info()->shared_info()->opt_count() > kMaxOptCount) { | 327 if (info()->shared_info()->opt_count() > kMaxOptCount) { |
| 322 return AbortOptimization(kOptimizedTooManyTimes); | 328 return AbortOptimization(kOptimizedTooManyTimes); |
| 323 } | 329 } |
| 324 | 330 |
| 325 // Optimization requires a version of fullcode with deoptimization support. | 331 // Optimization requires a version of fullcode with deoptimization support. |
| 326 // Recompile the unoptimized version of the code if the current version | 332 // Recompile the unoptimized version of the code if the current version |
| 327 // doesn't have deoptimization support already. | 333 // doesn't have deoptimization support already. |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 if (!Compiler::Analyze(info->parse_info()) || | 549 if (!Compiler::Analyze(info->parse_info()) || |
| 544 !(EnsureFeedbackVector(info), FullCodeGenerator::MakeCode(info))) { | 550 !(EnsureFeedbackVector(info), FullCodeGenerator::MakeCode(info))) { |
| 545 Isolate* isolate = info->isolate(); | 551 Isolate* isolate = info->isolate(); |
| 546 if (!isolate->has_pending_exception()) isolate->StackOverflow(); | 552 if (!isolate->has_pending_exception()) isolate->StackOverflow(); |
| 547 return false; | 553 return false; |
| 548 } | 554 } |
| 549 return true; | 555 return true; |
| 550 } | 556 } |
| 551 | 557 |
| 552 bool UseIgnition(CompilationInfo* info) { | 558 bool UseIgnition(CompilationInfo* info) { |
| 553 // TODO(4681): Generator functions are not yet supported. | 559 if (info->shared_info()->is_generator() && !FLAG_ignition_generators) { |
| 554 if (info->shared_info()->is_generator()) { | |
| 555 return false; | 560 return false; |
| 556 } | 561 } |
| 557 | 562 |
| 558 // Checks whether top level functions should be passed by the filter. | 563 // Checks whether top level functions should be passed by the filter. |
| 559 if (info->shared_info()->is_toplevel()) { | 564 if (info->shared_info()->is_toplevel()) { |
| 560 Vector<const char> filter = CStrVector(FLAG_ignition_filter); | 565 Vector<const char> filter = CStrVector(FLAG_ignition_filter); |
| 561 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); | 566 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); |
| 562 } | 567 } |
| 563 | 568 |
| 564 // Finally respect the filter. | 569 // Finally respect the filter. |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1698 MaybeHandle<Code> code; | 1703 MaybeHandle<Code> code; |
| 1699 if (cached.code != nullptr) code = handle(cached.code); | 1704 if (cached.code != nullptr) code = handle(cached.code); |
| 1700 Handle<Context> native_context(function->context()->native_context()); | 1705 Handle<Context> native_context(function->context()->native_context()); |
| 1701 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, | 1706 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, |
| 1702 literals, BailoutId::None()); | 1707 literals, BailoutId::None()); |
| 1703 } | 1708 } |
| 1704 } | 1709 } |
| 1705 | 1710 |
| 1706 } // namespace internal | 1711 } // namespace internal |
| 1707 } // namespace v8 | 1712 } // namespace v8 |
| OLD | NEW |