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

Unified Diff: src/compiler.cc

Issue 2597163002: Revert of [TypeFeedbackVector] Root literal arrays in function literals slots (Closed)
Patch Set: Created 4 years 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/code-stubs.cc ('k') | src/compiler/ast-graph-builder.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 4659ff7e407ca02cdcb8a96b47c995641c846d77..299b1d49fc0ecc8c3ab94b77b39683a268726a28 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -501,13 +501,14 @@
Handle<JSFunction> function, BailoutId osr_ast_id) {
Handle<SharedFunctionInfo> shared(function->shared());
DisallowHeapAllocation no_gc;
- Code* code = shared->SearchOptimizedCodeMap(
+ CodeAndLiterals cached = shared->SearchOptimizedCodeMap(
function->context()->native_context(), osr_ast_id);
- if (code != nullptr) {
+ if (cached.code != nullptr) {
// Caching of optimized code enabled and optimized code found.
- DCHECK(!code->marked_for_deoptimization());
+ if (cached.literals != nullptr) function->set_literals(cached.literals);
+ DCHECK(!cached.code->marked_for_deoptimization());
DCHECK(function->shared()->is_compiled());
- return Handle<Code>(code);
+ return Handle<Code>(cached.code);
}
return MaybeHandle<Code>();
}
@@ -529,9 +530,10 @@
// Cache optimized context-specific code.
Handle<JSFunction> function = info->closure();
Handle<SharedFunctionInfo> shared(function->shared());
+ Handle<LiteralsArray> literals(function->literals());
Handle<Context> native_context(function->context()->native_context());
SharedFunctionInfo::AddToOptimizedCodeMap(shared, native_context, code,
- info->osr_ast_id());
+ literals, info->osr_ast_id());
}
bool Renumber(ParseInfo* parse_info) {
@@ -786,8 +788,10 @@
} else if (job->FinalizeJob() == CompilationJob::SUCCEEDED) {
job->RecordOptimizedCompilationStats();
RecordFunctionCompilation(CodeEventListener::LAZY_COMPILE_TAG, info);
- if (shared->SearchOptimizedCodeMap(info->context()->native_context(),
- info->osr_ast_id()) == nullptr) {
+ if (shared
+ ->SearchOptimizedCodeMap(info->context()->native_context(),
+ info->osr_ast_id())
+ .code == nullptr) {
InsertCodeIntoOptimizedCodeMap(info);
}
if (FLAG_trace_opt) {
@@ -1729,16 +1733,19 @@
function->MarkForOptimization();
}
- Code* code = shared->SearchOptimizedCodeMap(
+ CodeAndLiterals cached = shared->SearchOptimizedCodeMap(
function->context()->native_context(), BailoutId::None());
- if (code != nullptr) {
+ if (cached.code != nullptr) {
// Caching of optimized code enabled and optimized code found.
- DCHECK(!code->marked_for_deoptimization());
+ DCHECK(!cached.code->marked_for_deoptimization());
DCHECK(function->shared()->is_compiled());
- function->ReplaceCode(code);
- }
-
- if (shared->is_compiled()) {
+ function->ReplaceCode(cached.code);
+ }
+
+ if (cached.literals != nullptr) {
+ DCHECK(shared->is_compiled());
+ function->set_literals(cached.literals);
+ } else if (shared->is_compiled()) {
// TODO(mvstanton): pass pretenure flag to EnsureLiterals.
JSFunction::EnsureLiterals(function);
}
« no previous file with comments | « src/code-stubs.cc ('k') | src/compiler/ast-graph-builder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698