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

Unified Diff: src/compiler.cc

Issue 10649008: Fix sharing of literal boilerplates for optimized code. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 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 | « no previous file | 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 f706c7d03bedee9d4e4bb79033396a2f5aeb3615..d35532f04583f2fcf6ba934d87d42cae3c481d4c 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -623,17 +623,15 @@ bool Compiler::CompileLazy(CompilationInfo* info) {
Handle<JSFunction> function = info->closure();
ASSERT(!function.is_null());
Handle<Context> global_context(function->context()->global_context());
- int index = function->shared()->SearchOptimizedCodeMap(*global_context);
+ int index = shared->SearchOptimizedCodeMap(*global_context);
if (index > 0) {
if (FLAG_trace_opt) {
- PrintF(" [Found optimized code for");
+ PrintF("[found optimized code for: ");
function->PrintName();
- PrintF("\n");
+ PrintF(" / %" V8PRIxPTR "]\n", reinterpret_cast<intptr_t>(*function));
}
- Code* code = Code::cast(
- FixedArray::cast(shared->optimized_code_map())->get(index));
- ASSERT(code != NULL);
- function->ReplaceCode(code);
+ // Caching of optimized code enabled and optimized code found.
+ shared->InstallFromOptimizedCodeMap(*function, index);
return true;
}
}
@@ -672,20 +670,8 @@ bool Compiler::CompileLazy(CompilationInfo* info) {
if (FLAG_cache_optimized_code &&
code->kind() == Code::OPTIMIZED_FUNCTION) {
Handle<SharedFunctionInfo> shared(function->shared());
+ Handle<FixedArray> literals(function->literals());
Handle<Context> global_context(function->context()->global_context());
-
- // Create literals array that will be shared for this global context.
- int number_of_literals = shared->num_literals();
- Handle<FixedArray> literals =
- isolate->factory()->NewFixedArray(number_of_literals);
- if (number_of_literals > 0) {
- // Store the object, regexp and array functions in the literals
- // array prefix. These functions will be used when creating
- // object, regexp and array literals in this function.
- literals->set(JSFunction::kLiteralGlobalContextIndex,
- function->context()->global_context());
- }
-
SharedFunctionInfo::AddToOptimizedCodeMap(
shared, global_context, code, literals);
}
« no previous file with comments | « no previous file | src/factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698