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

Unified Diff: src/compiler.cc

Issue 1764023003: [compiler] Move JSFunction post-instantiation tasks. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebased. Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler.h ('k') | src/factory.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index a31e6a71fbbff3b1d00de103af1eb534c0381d28..63b5678c4a8e55f304668a57e7334c47eadfbd57 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -1516,8 +1516,6 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
compilation_cache->PutEval(source, outer_info, context, shared_info,
line_offset);
}
- } else if (shared_info->ic_age() != isolate->heap()->global_ic_age()) {
- shared_info->ResetForNewContext(isolate->heap()->global_ic_age());
}
Handle<JSFunction> result =
@@ -1908,6 +1906,41 @@ MaybeHandle<Code> Compiler::GetConcurrentlyOptimizedCode(
return MaybeHandle<Code>();
}
+void Compiler::PostInstantiation(Handle<JSFunction> function,
+ PretenureFlag pretenure) {
+ Handle<SharedFunctionInfo> shared(function->shared());
+
+ if (FLAG_always_opt && shared->allows_lazy_compilation()) {
+ function->MarkForOptimization();
+ }
+
+ CodeAndLiterals cached = shared->SearchOptimizedCodeMap(
+ function->context()->native_context(), BailoutId::None());
+ if (cached.code != nullptr) {
+ // Caching of optimized code enabled and optimized code found.
+ DCHECK(!cached.code->marked_for_deoptimization());
+ DCHECK(function->shared()->is_compiled());
+ function->ReplaceCode(cached.code);
+ }
+
+ if (cached.literals != nullptr) {
+ function->set_literals(cached.literals);
+ } else {
+ Isolate* isolate = function->GetIsolate();
+ int number_of_literals = shared->num_literals();
+ Handle<LiteralsArray> literals =
+ LiteralsArray::New(isolate, handle(shared->feedback_vector()),
+ number_of_literals, pretenure);
+ function->set_literals(*literals);
+
+ // Cache context-specific literals.
+ MaybeHandle<Code> code;
+ if (cached.code != nullptr) code = handle(cached.code);
+ Handle<Context> native_context(function->context()->native_context());
+ SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
+ literals, BailoutId::None());
+ }
+}
#if DEBUG
void CompilationInfo::PrintAstForTesting() {
« no previous file with comments | « src/compiler.h ('k') | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698