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

Unified Diff: src/ia32/codegen-ia32.cc

Issue 5220007: Force pretenuring of closures that are immediately assigned to... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 1 month 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
Index: src/ia32/codegen-ia32.cc
===================================================================
--- src/ia32/codegen-ia32.cc (revision 5865)
+++ src/ia32/codegen-ia32.cc (working copy)
@@ -4897,7 +4897,8 @@
Result CodeGenerator::InstantiateFunction(
- Handle<SharedFunctionInfo> function_info) {
+ Handle<SharedFunctionInfo> function_info,
+ bool pretenure) {
// The inevitable call will sync frame elements to memory anyway, so
// we do it eagerly to allow us to push the arguments directly into
// place.
@@ -4905,7 +4906,9 @@
// Use the fast case closure allocation code that allocates in new
// space for nested functions that don't need literals cloning.
- if (scope()->is_function_scope() && function_info->num_literals() == 0) {
+ if (scope()->is_function_scope() &&
+ function_info->num_literals() == 0 &&
+ !pretenure) {
FastNewClosureStub stub;
frame()->EmitPush(Immediate(function_info));
return frame()->CallStub(&stub, 1);
@@ -4914,7 +4917,10 @@
// shared function info.
frame()->EmitPush(esi);
frame()->EmitPush(Immediate(function_info));
- return frame()->CallRuntime(Runtime::kNewClosure, 2);
+ frame()->EmitPush(Immediate(pretenure
+ ? Factory::true_value()
+ : Factory::false_value()));
+ return frame()->CallRuntime(Runtime::kNewClosure, 3);
}
}
@@ -4930,7 +4936,7 @@
SetStackOverflow();
return;
}
- Result result = InstantiateFunction(function_info);
+ Result result = InstantiateFunction(function_info, node->pretenure());
frame()->Push(&result);
}
@@ -4939,7 +4945,7 @@
SharedFunctionInfoLiteral* node) {
ASSERT(!in_safe_int32_mode());
Comment cmnt(masm_, "[ SharedFunctionInfoLiteral");
- Result result = InstantiateFunction(node->shared_function_info());
+ Result result = InstantiateFunction(node->shared_function_info(), false);
frame()->Push(&result);
}

Powered by Google App Engine
This is Rietveld 408576698