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

Side by Side Diff: src/compiler.cc

Issue 1208013002: [turbofan] Implement sharing of context-independent code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_opt-code-map-3
Patch Set: Disable test for GC stress. 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/code-stubs-hydrogen.cc ('k') | src/factory.cc » ('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 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
707 707
708 708
709 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) { 709 static void InsertCodeIntoOptimizedCodeMap(CompilationInfo* info) {
710 Handle<Code> code = info->code(); 710 Handle<Code> code = info->code();
711 if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do. 711 if (code->kind() != Code::OPTIMIZED_FUNCTION) return; // Nothing to do.
712 712
713 // Context specialization folds-in the context, so no sharing can occur. 713 // Context specialization folds-in the context, so no sharing can occur.
714 if (code->is_turbofanned() && info->is_context_specializing()) return; 714 if (code->is_turbofanned() && info->is_context_specializing()) return;
715 715
716 // Do not cache bound functions. 716 // Do not cache bound functions.
717 if (info->closure()->shared()->bound()) return; 717 Handle<JSFunction> function = info->closure();
718 if (function->shared()->bound()) return;
718 719
719 // Cache optimized code. 720 // Cache optimized context-specific code.
720 if (FLAG_cache_optimized_code) { 721 if (FLAG_cache_optimized_code) {
721 Handle<JSFunction> function = info->closure();
722 Handle<SharedFunctionInfo> shared(function->shared()); 722 Handle<SharedFunctionInfo> shared(function->shared());
723 Handle<FixedArray> literals(function->literals()); 723 Handle<FixedArray> literals(function->literals());
724 Handle<Context> native_context(function->context()->native_context()); 724 Handle<Context> native_context(function->context()->native_context());
725 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code, 725 SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
726 literals, info->osr_ast_id()); 726 literals, info->osr_ast_id());
727 } 727 }
728
729 // Do not cache context-independent code compiled for OSR.
730 if (code->is_turbofanned() && info->is_osr()) return;
731
732 // Cache optimized context-independent code.
733 if (FLAG_turbo_cache_shared_code && code->is_turbofanned()) {
734 DCHECK(!info->is_context_specializing());
735 DCHECK(info->osr_ast_id().IsNone());
736 Handle<SharedFunctionInfo> shared(function->shared());
737 SharedFunctionInfo::AddSharedCodeToOptimizedCodeMap(shared, code);
738 }
728 } 739 }
729 740
730 741
731 static bool Renumber(ParseInfo* parse_info) { 742 static bool Renumber(ParseInfo* parse_info) {
732 if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(), 743 if (!AstNumbering::Renumber(parse_info->isolate(), parse_info->zone(),
733 parse_info->function())) { 744 parse_info->function())) {
734 return false; 745 return false;
735 } 746 }
736 Handle<SharedFunctionInfo> shared_info = parse_info->shared_info(); 747 Handle<SharedFunctionInfo> shared_info = parse_info->shared_info();
737 if (!shared_info.is_null()) { 748 if (!shared_info.is_null()) {
(...skipping 868 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 1617
1607 1618
1608 #if DEBUG 1619 #if DEBUG
1609 void CompilationInfo::PrintAstForTesting() { 1620 void CompilationInfo::PrintAstForTesting() {
1610 PrintF("--- Source from AST ---\n%s\n", 1621 PrintF("--- Source from AST ---\n%s\n",
1611 PrettyPrinter(isolate(), zone()).PrintProgram(function())); 1622 PrettyPrinter(isolate(), zone()).PrintProgram(function()));
1612 } 1623 }
1613 #endif 1624 #endif
1614 } // namespace internal 1625 } // namespace internal
1615 } // namespace v8 1626 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs-hydrogen.cc ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698