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

Side by Side Diff: src/compiler.cc

Issue 2453973004: [compiler] Ship Ignition for all TurboFan code. (Closed)
Patch Set: Addressed comment. Created 4 years, 1 month 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
« no previous file with comments | « no previous file | test/cctest/cctest.status » ('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 // 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 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 info->isolate(), info->literal()->feedback_vector_spec()); 297 info->isolate(), info->literal()->feedback_vector_spec());
298 info->shared_info()->set_feedback_metadata(*feedback_metadata); 298 info->shared_info()->set_feedback_metadata(*feedback_metadata);
299 } 299 }
300 300
301 // It's very important that recompiles do not alter the structure of the type 301 // It's very important that recompiles do not alter the structure of the type
302 // feedback vector. Verify that the structure fits the function literal. 302 // feedback vector. Verify that the structure fits the function literal.
303 CHECK(!info->shared_info()->feedback_metadata()->SpecDiffersFrom( 303 CHECK(!info->shared_info()->feedback_metadata()->SpecDiffersFrom(
304 info->literal()->feedback_vector_spec())); 304 info->literal()->feedback_vector_spec()));
305 } 305 }
306 306
307 bool UseTurboFan(Handle<SharedFunctionInfo> shared) {
308 bool optimization_disabled = shared->optimization_disabled();
309 bool dont_crankshaft = shared->dont_crankshaft();
310
311 // Check the enabling conditions for Turbofan.
312 // 1. "use asm" code.
313 bool is_turbofanable_asm =
314 FLAG_turbo_asm && shared->asm_function() && !optimization_disabled;
315
316 // 2. Fallback for features unsupported by Crankshaft.
317 bool is_unsupported_by_crankshaft_but_turbofanable =
318 dont_crankshaft && strcmp(FLAG_turbo_filter, "~~") == 0 &&
319 !optimization_disabled;
320
321 // 3. Explicitly enabled by the command-line filter.
322 bool passes_turbo_filter = shared->PassesFilter(FLAG_turbo_filter);
323
324 return is_turbofanable_asm || is_unsupported_by_crankshaft_but_turbofanable ||
325 passes_turbo_filter;
326 }
327
307 bool ShouldUseIgnition(CompilationInfo* info) { 328 bool ShouldUseIgnition(CompilationInfo* info) {
308 if (!FLAG_ignition) return false; 329 DCHECK(info->has_shared_info());
309 330
310 DCHECK(info->has_shared_info()); 331 // Skip Ignition for asm.js functions.
332 if (info->shared_info()->asm_function()) {
333 return false;
334 }
311 335
312 // When requesting debug code as a replacement for existing code, we provide 336 // When requesting debug code as a replacement for existing code, we provide
313 // the same kind as the existing code (to prevent implicit tier-change). 337 // the same kind as the existing code (to prevent implicit tier-change).
314 if (info->is_debug() && info->shared_info()->is_compiled()) { 338 if (info->is_debug() && info->shared_info()->is_compiled()) {
315 return !info->shared_info()->HasBaselineCode(); 339 return !info->shared_info()->HasBaselineCode();
316 } 340 }
317 341
318 // Since we can't OSR from Ignition, skip Ignition for asm.js functions. 342 // Code destined for TurboFan should be compiled with Ignition first.
319 if (info->shared_info()->asm_function()) { 343 if (UseTurboFan(info->shared_info())) return true;
320 return false; 344
321 } 345 // Only use Ignition for any other function if FLAG_ignition is true.
346 if (!FLAG_ignition) return false;
322 347
323 // Checks whether top level functions should be passed by the filter. 348 // Checks whether top level functions should be passed by the filter.
324 if (info->shared_info()->is_toplevel()) { 349 if (info->shared_info()->is_toplevel()) {
325 Vector<const char> filter = CStrVector(FLAG_ignition_filter); 350 Vector<const char> filter = CStrVector(FLAG_ignition_filter);
326 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*'); 351 return (filter.length() == 0) || (filter.length() == 1 && filter[0] == '*');
327 } 352 }
328 353
329 // Finally respect the filter. 354 // Finally respect the filter.
330 return info->shared_info()->PassesFilter(FLAG_ignition_filter); 355 return info->shared_info()->PassesFilter(FLAG_ignition_filter);
331 } 356 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 if (lit->dont_optimize_reason() != kNoReason) { 518 if (lit->dont_optimize_reason() != kNoReason) {
494 shared_info->DisableOptimization(lit->dont_optimize_reason()); 519 shared_info->DisableOptimization(lit->dont_optimize_reason());
495 } 520 }
496 if (lit->flags() & AstProperties::kDontCrankshaft) { 521 if (lit->flags() & AstProperties::kDontCrankshaft) {
497 shared_info->set_dont_crankshaft(true); 522 shared_info->set_dont_crankshaft(true);
498 } 523 }
499 } 524 }
500 return true; 525 return true;
501 } 526 }
502 527
503 bool UseTurboFan(Handle<SharedFunctionInfo> shared) {
504 bool optimization_disabled = shared->optimization_disabled();
505 bool dont_crankshaft = shared->dont_crankshaft();
506
507 // Check the enabling conditions for Turbofan.
508 // 1. "use asm" code.
509 bool is_turbofanable_asm =
510 FLAG_turbo_asm && shared->asm_function() && !optimization_disabled;
511
512 // 2. Fallback for features unsupported by Crankshaft.
513 bool is_unsupported_by_crankshaft_but_turbofanable =
514 dont_crankshaft && strcmp(FLAG_turbo_filter, "~~") == 0 &&
515 !optimization_disabled;
516
517 // 3. Explicitly enabled by the command-line filter.
518 bool passes_turbo_filter = shared->PassesFilter(FLAG_turbo_filter);
519
520 return is_turbofanable_asm || is_unsupported_by_crankshaft_but_turbofanable ||
521 passes_turbo_filter;
522 }
523
524 bool GetOptimizedCodeNow(CompilationJob* job) { 528 bool GetOptimizedCodeNow(CompilationJob* job) {
525 CompilationInfo* info = job->info(); 529 CompilationInfo* info = job->info();
526 Isolate* isolate = info->isolate(); 530 Isolate* isolate = info->isolate();
527 531
528 // Parsing is not required when optimizing from existing bytecode. 532 // Parsing is not required when optimizing from existing bytecode.
529 if (!info->is_optimizing_from_bytecode()) { 533 if (!info->is_optimizing_from_bytecode()) {
530 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false; 534 if (!Compiler::ParseAndAnalyze(info->parse_info())) return false;
531 EnsureFeedbackMetadata(info); 535 EnsureFeedbackMetadata(info);
532 } 536 }
533 537
(...skipping 1286 matching lines...) Expand 10 before | Expand all | Expand 10 after
1820 DCHECK(shared->is_compiled()); 1824 DCHECK(shared->is_compiled());
1821 function->set_literals(cached.literals); 1825 function->set_literals(cached.literals);
1822 } else if (shared->is_compiled()) { 1826 } else if (shared->is_compiled()) {
1823 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1827 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1824 JSFunction::EnsureLiterals(function); 1828 JSFunction::EnsureLiterals(function);
1825 } 1829 }
1826 } 1830 }
1827 1831
1828 } // namespace internal 1832 } // namespace internal
1829 } // namespace v8 1833 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/cctest/cctest.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698