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

Side by Side Diff: src/compiler.cc

Issue 1225683004: [turbofan] Add new JSFrameSpecialization reducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Also specialize Parameters as discussed with Jaro. Created 5 years, 5 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
« no previous file with comments | « src/compiler.h ('k') | src/compiler/js-frame-specialization.h » ('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 8
9 #include "src/ast-numbering.h" 9 #include "src/ast-numbering.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // Use TurboFan for the compilation. 387 // Use TurboFan for the compilation.
388 if (FLAG_trace_opt) { 388 if (FLAG_trace_opt) {
389 OFStream os(stdout); 389 OFStream os(stdout);
390 os << "[compiling method " << Brief(*info()->closure()) 390 os << "[compiling method " << Brief(*info()->closure())
391 << " using TurboFan"; 391 << " using TurboFan";
392 if (info()->is_osr()) os << " OSR"; 392 if (info()->is_osr()) os << " OSR";
393 os << "]" << std::endl; 393 os << "]" << std::endl;
394 } 394 }
395 395
396 if (info()->shared_info()->asm_function()) { 396 if (info()->shared_info()->asm_function()) {
397 if (info()->osr_frame()) info()->MarkAsFrameSpecializing();
397 info()->MarkAsContextSpecializing(); 398 info()->MarkAsContextSpecializing();
398 } else if (FLAG_turbo_type_feedback) { 399 } else if (FLAG_turbo_type_feedback) {
399 info()->MarkAsTypeFeedbackEnabled(); 400 info()->MarkAsTypeFeedbackEnabled();
400 info()->EnsureFeedbackVector(); 401 info()->EnsureFeedbackVector();
401 } 402 }
402 if (!info()->shared_info()->asm_function() || 403 if (!info()->shared_info()->asm_function() ||
403 FLAG_turbo_asm_deoptimization) { 404 FLAG_turbo_asm_deoptimization) {
404 info()->MarkAsDeoptimizationEnabled(); 405 info()->MarkAsDeoptimizationEnabled();
405 } 406 }
406 407
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 } 706 }
706 return MaybeHandle<Code>(); 707 return MaybeHandle<Code>();
707 } 708 }
708 709
709 710
710 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { 711 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) {
711 Handle<Code> code = info->code(); 712 Handle<Code> code = info->code();
712 if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do. 713 if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do.
713 714
714 // Context specialization folds-in the context, so no sharing can occur. 715 // Context specialization folds-in the context, so no sharing can occur.
715 if (code->is_turbofanned() && info->is_context_specializing()) return; 716 if (info->is_context_specializing()) return;
717 // Frame specialization implies context specialization.
718 DCHECK(!info->is_frame_specializing());
716 719
717 // Do not cache bound functions. 720 // Do not cache bound functions.
718 Handle<JSFunction> function = info->closure(); 721 Handle<JSFunction> function = info->closure();
719 if (function->shared()->bound()) return; 722 if (function->shared()->bound()) return;
720 723
721 // Cache optimized context-specific code. 724 // Cache optimized context-specific code.
722 if (FLAG_cache_optimized_code) { 725 if (FLAG_cache_optimized_code) {
723 Handle<SharedFunctionInfo> shared(function->shared()); 726 Handle<SharedFunctionInfo> shared(function->shared());
724 Handle<FixedArray> literals(function->literals()); 727 Handle<FixedArray> literals(function->literals());
725 Handle<Context> native_context(function->context()->native_context()); 728 Handle<Context> native_context(function->context()->native_context());
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
1462 existing->set_scope_info(*scope_info); 1465 existing->set_scope_info(*scope_info);
1463 existing->set_feedback_vector(*info.feedback_vector()); 1466 existing->set_feedback_vector(*info.feedback_vector());
1464 } 1467 }
1465 return existing; 1468 return existing;
1466 } 1469 }
1467 1470
1468 1471
1469 MaybeHandle<Code> Compiler::GetOptimizedCode(Handle<JSFunction> function, 1472 MaybeHandle<Code> Compiler::GetOptimizedCode(Handle<JSFunction> function,
1470 Handle<Code> current_code, 1473 Handle<Code> current_code,
1471 ConcurrencyMode mode, 1474 ConcurrencyMode mode,
1472 BailoutId osr_ast_id) { 1475 BailoutId osr_ast_id,
1476 JavaScriptFrame* osr_frame) {
1473 Handle<Code> cached_code; 1477 Handle<Code> cached_code;
1474 if (GetCodeFromOptimizedCodeMap( 1478 if (GetCodeFromOptimizedCodeMap(
1475 function, osr_ast_id).ToHandle(&cached_code)) { 1479 function, osr_ast_id).ToHandle(&cached_code)) {
1476 if (FLAG_trace_opt) { 1480 if (FLAG_trace_opt) {
1477 PrintF("[found optimized code for "); 1481 PrintF("[found optimized code for ");
1478 function->ShortPrint(); 1482 function->ShortPrint();
1479 if (!osr_ast_id.IsNone()) { 1483 if (!osr_ast_id.IsNone()) {
1480 PrintF(" at OSR AST id %d", osr_ast_id.ToInt()); 1484 PrintF(" at OSR AST id %d", osr_ast_id.ToInt());
1481 } 1485 }
1482 PrintF("]\n"); 1486 PrintF("]\n");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1520 PostponeInterruptsScope postpone(isolate); 1524 PostponeInterruptsScope postpone(isolate);
1521 1525
1522 info->SetOptimizing(osr_ast_id, current_code); 1526 info->SetOptimizing(osr_ast_id, current_code);
1523 1527
1524 if (mode == CONCURRENT) { 1528 if (mode == CONCURRENT) {
1525 if (GetOptimizedCodeLater(info.get())) { 1529 if (GetOptimizedCodeLater(info.get())) {
1526 info.Detach(); // The background recompile job owns this now. 1530 info.Detach(); // The background recompile job owns this now.
1527 return isolate->builtins()->InOptimizationQueue(); 1531 return isolate->builtins()->InOptimizationQueue();
1528 } 1532 }
1529 } else { 1533 } else {
1534 info->set_osr_frame(osr_frame);
1530 if (GetOptimizedCodeNow(info.get())) return info->code(); 1535 if (GetOptimizedCodeNow(info.get())) return info->code();
1531 } 1536 }
1532 1537
1533 if (isolate->has_pending_exception()) isolate->clear_pending_exception(); 1538 if (isolate->has_pending_exception()) isolate->clear_pending_exception();
1534 return MaybeHandle<Code>(); 1539 return MaybeHandle<Code>();
1535 } 1540 }
1536 1541
1537 1542
1538 Handle<Code> Compiler::GetConcurrentlyOptimizedCode(OptimizedCompileJob* job) { 1543 Handle<Code> Compiler::GetConcurrentlyOptimizedCode(OptimizedCompileJob* job) {
1539 // Take ownership of compilation info. Deleting compilation info 1544 // Take ownership of compilation info. Deleting compilation info
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
1626 1631
1627 1632
1628 #if DEBUG 1633 #if DEBUG
1629 void CompilationInfo::PrintAstForTesting() { 1634 void CompilationInfo::PrintAstForTesting() {
1630 PrintF("--- Source from AST ---\n%s\n", 1635 PrintF("--- Source from AST ---\n%s\n",
1631 PrettyPrinter(isolate(), zone()).PrintProgram(function())); 1636 PrettyPrinter(isolate(), zone()).PrintProgram(function()));
1632 } 1637 }
1633 #endif 1638 #endif
1634 } // namespace internal 1639 } // namespace internal
1635 } // namespace v8 1640 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler.h ('k') | src/compiler/js-frame-specialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698