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

Unified Diff: src/hydrogen.cc

Issue 12255033: Fix f.apply() optimization when declared arguments are mutated. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments by Toon Verwaest. Created 7 years, 10 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 | test/mjsunit/compiler/inline-function-apply.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index e118a1174299f443bea166b1e266fd8c8665cb3e..ed21567e51b1a8f455fbf4bd0c00771808ce2273 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -8004,25 +8004,28 @@ bool HOptimizedGraphBuilder::TryCallApply(Call* expr) {
// TODO(mstarzinger): For now we just ensure arguments are pushed
// right after HEnterInlined, but we could be smarter about this.
EnsureArgumentsArePushedForAccess();
- HEnvironment* arguments_env = environment()->arguments_environment();
- int parameter_count = arguments_env->parameter_count();
+ ASSERT_EQ(environment()->arguments_environment()->parameter_count(),
+ function_state()->entry()->arguments_values()->length());
+ HEnterInlined* entry = function_state()->entry();
+ ZoneList<HValue*>* arguments_values = entry->arguments_values();
+ int arguments_count = arguments_values->length();
PushAndAdd(new(zone()) HWrapReceiver(receiver, function));
- for (int i = 1; i < arguments_env->parameter_count(); i++) {
- Push(arguments_env->Lookup(i));
+ for (int i = 1; i < arguments_count; i++) {
+ Push(arguments_values->at(i));
}
Handle<JSFunction> known_function;
if (function->IsConstant()) {
HConstant* constant_function = HConstant::cast(function);
known_function = Handle<JSFunction>::cast(constant_function->handle());
- int arguments_count = parameter_count - 1; // Excluding receiver.
- if (TryInlineApply(known_function, expr, arguments_count)) return true;
+ int args_count = arguments_count - 1; // Excluding receiver.
+ if (TryInlineApply(known_function, expr, args_count)) return true;
}
- Drop(parameter_count - 1);
+ Drop(arguments_count - 1);
PushAndAdd(new(zone()) HPushArgument(Pop()));
- for (int i = 1; i < arguments_env->parameter_count(); i++) {
- PushAndAdd(new(zone()) HPushArgument(arguments_env->Lookup(i)));
+ for (int i = 1; i < arguments_count; i++) {
+ PushAndAdd(new(zone()) HPushArgument(arguments_values->at(i)));
}
HValue* context = environment()->LookupContext();
@@ -8030,8 +8033,8 @@ bool HOptimizedGraphBuilder::TryCallApply(Call* expr) {
context,
function,
known_function,
- parameter_count);
- Drop(parameter_count);
+ arguments_count);
+ Drop(arguments_count);
call->set_position(expr->position());
ast_context()->ReturnInstruction(call, expr->id());
return true;
« no previous file with comments | « no previous file | test/mjsunit/compiler/inline-function-apply.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698