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

Side by Side Diff: src/compiler.cc

Issue 2437043002: [compiler] Mark shared functions for optimization (Closed)
Patch Set: Unmark after compiling Created 4 years, 2 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/builtins/x87/builtins-x87.cc ('k') | src/objects.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 #include <memory> 8 #include <memory>
9 9
10 #include "src/asmjs/asm-js.h" 10 #include "src/asmjs/asm-js.h"
(...skipping 959 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 .ToHandle(&cached_code)) { 970 .ToHandle(&cached_code)) {
971 if (FLAG_trace_opt) { 971 if (FLAG_trace_opt) {
972 PrintF("[found optimized code for "); 972 PrintF("[found optimized code for ");
973 function->ShortPrint(); 973 function->ShortPrint();
974 PrintF(" during unoptimized compile]\n"); 974 PrintF(" during unoptimized compile]\n");
975 } 975 }
976 DCHECK(function->shared()->is_compiled()); 976 DCHECK(function->shared()->is_compiled());
977 return cached_code; 977 return cached_code;
978 } 978 }
979 979
980 if (function->shared()->was_marked_for_optimization()) {
981 function->shared()->set_was_marked_for_optimization(false);
982
983 if (FLAG_trace_opt) {
984 PrintF("[optimizing function ");
985 function->PrintName();
986 PrintF(" eagerly because shared function was previously marked]\n");
987 }
988
989 Handle<Code> opt_code;
990 if (GetOptimizedCode(function, Compiler::NOT_CONCURRENT)
991 .ToHandle(&opt_code)) {
992 return opt_code;
993 }
994 }
995
980 if (function->shared()->is_compiled()) { 996 if (function->shared()->is_compiled()) {
981 return Handle<Code>(function->shared()->code()); 997 return Handle<Code>(function->shared()->code());
982 } 998 }
983 999
984 if (function->shared()->HasBytecodeArray()) { 1000 if (function->shared()->HasBytecodeArray()) {
985 Handle<Code> entry = isolate->builtins()->InterpreterEntryTrampoline(); 1001 Handle<Code> entry = isolate->builtins()->InterpreterEntryTrampoline();
986 function->shared()->ReplaceCode(*entry); 1002 function->shared()->ReplaceCode(*entry);
987 return entry; 1003 return entry;
988 } 1004 }
989 1005
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
1812 DCHECK(shared->is_compiled()); 1828 DCHECK(shared->is_compiled());
1813 function->set_literals(cached.literals); 1829 function->set_literals(cached.literals);
1814 } else if (shared->is_compiled()) { 1830 } else if (shared->is_compiled()) {
1815 // TODO(mvstanton): pass pretenure flag to EnsureLiterals. 1831 // TODO(mvstanton): pass pretenure flag to EnsureLiterals.
1816 JSFunction::EnsureLiterals(function); 1832 JSFunction::EnsureLiterals(function);
1817 } 1833 }
1818 } 1834 }
1819 1835
1820 } // namespace internal 1836 } // namespace internal
1821 } // namespace v8 1837 } // namespace v8
OLDNEW
« no previous file with comments | « src/builtins/x87/builtins-x87.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698