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

Unified Diff: src/factory.cc

Issue 1205783003: Simplify interface to optimized code map lookup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_opt-code-map-1
Patch Set: Created 5 years, 6 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.cc ('k') | src/objects.h » ('j') | src/objects.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/factory.cc
diff --git a/src/factory.cc b/src/factory.cc
index ba93e6c7ff4753fe4ac111d2cc5426b4f948b455..3f14f0267cf90252a57263dfb18782e233103330 100644
--- a/src/factory.cc
+++ b/src/factory.cc
@@ -1377,24 +1377,22 @@ Handle<JSFunction> Factory::NewFunctionFromSharedFunctionInfo(
result->MarkForOptimization();
}
- int index = info->SearchOptimizedCodeMap(context->native_context(),
- BailoutId::None());
- if (!info->bound() && index < 0) {
+ CodeAndLiterals cached = info->SearchOptimizedCodeMap(
+ context->native_context(), BailoutId::None());
+ if (cached.code != nullptr) {
+ // Caching of optimized code enabled and optimized code found.
+ if (cached.literals != nullptr) result->set_literals(cached.literals);
+ DCHECK(!cached.code->marked_for_deoptimization());
+ DCHECK(result->shared()->is_compiled());
+ result->ReplaceCode(cached.code);
+ }
+
+ if (cached.literals == nullptr && !info->bound()) {
Jarin 2015/06/24 14:01:53 Any reason why not to say something like ... } el
Michael Starzinger 2015/06/24 14:36:42 I would like to get to an interface where the resu
int number_of_literals = info->num_literals();
Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure);
result->set_literals(*literals);
}
- if (index > 0) {
- // Caching of optimized code enabled and optimized code found.
- FixedArray* literals = info->GetLiteralsFromOptimizedCodeMap(index);
- if (literals != NULL) result->set_literals(literals);
- Code* code = info->GetCodeFromOptimizedCodeMap(index);
- DCHECK(!code->marked_for_deoptimization());
- DCHECK(result->shared()->is_compiled());
- result->ReplaceCode(code);
- }
-
return result;
}
« no previous file with comments | « src/compiler.cc ('k') | src/objects.h » ('j') | src/objects.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698