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 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "src/asmjs/asm-js.h" | 10 #include "src/asmjs/asm-js.h" |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 | 319 |
320 // 3. Explicitly enabled by the command-line filter. | 320 // 3. Explicitly enabled by the command-line filter. |
321 bool passes_turbo_filter = shared->PassesFilter(FLAG_turbo_filter); | 321 bool passes_turbo_filter = shared->PassesFilter(FLAG_turbo_filter); |
322 | 322 |
323 return is_turbofanable_asm || is_unsupported_by_crankshaft_but_turbofanable || | 323 return is_turbofanable_asm || is_unsupported_by_crankshaft_but_turbofanable || |
324 passes_turbo_filter; | 324 passes_turbo_filter; |
325 } | 325 } |
326 | 326 |
327 bool ShouldUseIgnition(CompilationInfo* info) { | 327 bool ShouldUseIgnition(CompilationInfo* info) { |
328 DCHECK(info->has_shared_info()); | 328 DCHECK(info->has_shared_info()); |
| 329 Handle<SharedFunctionInfo> shared = info->shared_info(); |
| 330 |
| 331 // Code which can't be supported by the old pipeline should use Ignition. |
| 332 if (shared->dont_crankshaft()) return true; |
329 | 333 |
330 // Skip Ignition for asm.js functions. | 334 // Skip Ignition for asm.js functions. |
331 if (info->shared_info()->asm_function()) { | 335 if (shared->asm_function()) return false; |
332 return false; | |
333 } | |
334 | 336 |
335 // When requesting debug code as a replacement for existing code, we provide | 337 // When requesting debug code as a replacement for existing code, we provide |
336 // the same kind as the existing code (to prevent implicit tier-change). | 338 // the same kind as the existing code (to prevent implicit tier-change). |
337 if (info->is_debug() && info->shared_info()->is_compiled()) { | 339 if (info->is_debug() && shared->is_compiled()) { |
338 return !info->shared_info()->HasBaselineCode(); | 340 return !shared->HasBaselineCode(); |
339 } | 341 } |
340 | 342 |
341 // Code destined for TurboFan should be compiled with Ignition first. | 343 // Code destined for TurboFan should be compiled with Ignition first. |
342 if (UseTurboFan(info->shared_info())) return true; | 344 if (UseTurboFan(shared)) return true; |
343 | 345 |
344 // Only use Ignition for any other function if FLAG_ignition is true. | 346 // Only use Ignition for any other function if FLAG_ignition is true. |
345 if (!FLAG_ignition) return false; | 347 if (!FLAG_ignition) return false; |
346 | 348 |
347 // Checks whether top level functions should be passed by the filter. | 349 // Checks whether top level functions should be passed by the filter. |
348 if (info->shared_info()->is_toplevel()) { | 350 if (shared->is_toplevel()) { |
349 Vector<const char> filter = CStrVector(FLAG_ignition_filter); | 351 Vector<const char> filter = CStrVector(FLAG_ignition_filter); |
350 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); | 352 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); |
351 } | 353 } |
352 | 354 |
353 // Finally respect the filter. | 355 // Finally respect the filter. |
354 return info->shared_info()->PassesFilter(FLAG_ignition_filter); | 356 return shared->PassesFilter(FLAG_ignition_filter); |
355 } | 357 } |
356 | 358 |
357 CompilationJob* GetUnoptimizedCompilationJob(CompilationInfo* info) { | 359 CompilationJob* GetUnoptimizedCompilationJob(CompilationInfo* info) { |
358 // Function should have been parsed and analyzed before creating a compilation | 360 // Function should have been parsed and analyzed before creating a compilation |
359 // job. | 361 // job. |
360 DCHECK_NOT_NULL(info->literal()); | 362 DCHECK_NOT_NULL(info->literal()); |
361 DCHECK_NOT_NULL(info->scope()); | 363 DCHECK_NOT_NULL(info->scope()); |
362 | 364 |
363 EnsureFeedbackMetadata(info); | 365 EnsureFeedbackMetadata(info); |
364 if (ShouldUseIgnition(info)) { | 366 if (ShouldUseIgnition(info)) { |
(...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 DCHECK(shared->is_compiled()); | 1723 DCHECK(shared->is_compiled()); |
1722 function->set_literals(cached.literals); | 1724 function->set_literals(cached.literals); |
1723 } else if (shared->is_compiled()) { | 1725 } else if (shared->is_compiled()) { |
1724 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. | 1726 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. |
1725 JSFunction::EnsureLiterals(function); | 1727 JSFunction::EnsureLiterals(function); |
1726 } | 1728 } |
1727 } | 1729 } |
1728 | 1730 |
1729 } // namespace internal | 1731 } // namespace internal |
1730 } // namespace v8 | 1732 } // namespace v8 |
OLD | NEW |