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

Side by Side Diff: src/hydrogen.cc

Issue 9750007: Use correct arguments adaptation environment when inlining function containing arguments. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 5731 matching lines...) Expand 10 before | Expand all | Expand 10 after
5742 return true; 5742 return true;
5743 } else { 5743 } else {
5744 // We are inside inlined function and we know exactly what is inside 5744 // We are inside inlined function and we know exactly what is inside
5745 // arguments object. 5745 // arguments object.
5746 HValue* context = environment()->LookupContext(); 5746 HValue* context = environment()->LookupContext();
5747 5747
5748 HValue* wrapped_receiver = 5748 HValue* wrapped_receiver =
5749 AddInstruction(new(zone()) HWrapReceiver(receiver, function)); 5749 AddInstruction(new(zone()) HWrapReceiver(receiver, function));
5750 PushAndAdd(new(zone()) HPushArgument(wrapped_receiver)); 5750 PushAndAdd(new(zone()) HPushArgument(wrapped_receiver));
5751 5751
5752 int parameter_count = environment()->parameter_count(); 5752 HEnvironment* arguments_env = environment()->arguments_environment();
5753 for (int i = 1; i < environment()->parameter_count(); i++) {
5754 PushAndAdd(new(zone()) HPushArgument(environment()->Lookup(i)));
5755 }
5756 5753
5757 if (environment()->outer()->frame_type() == ARGUMENTS_ADAPTOR) { 5754 int parameter_count = arguments_env->parameter_count();
5758 HEnvironment* adaptor = environment()->outer(); 5755 for (int i = 1; i < arguments_env->parameter_count(); i++) {
5759 parameter_count = adaptor->parameter_count(); 5756 PushAndAdd(new(zone()) HPushArgument(arguments_env->Lookup(i)));
5760
5761 for (int i = environment()->parameter_count();
5762 i < adaptor->parameter_count();
5763 i++) {
5764 PushAndAdd(new(zone()) HPushArgument(adaptor->Lookup(i)));
5765 }
5766 } 5757 }
5767 5758
5768 HInvokeFunction* call = new(zone()) HInvokeFunction( 5759 HInvokeFunction* call = new(zone()) HInvokeFunction(
5769 context, 5760 context,
5770 function, 5761 function,
5771 parameter_count); 5762 parameter_count);
5772 Drop(parameter_count); 5763 Drop(parameter_count);
5773 call->set_position(expr->position()); 5764 call->set_position(expr->position());
5774 ast_context()->ReturnInstruction(call, expr->id()); 5765 ast_context()->ReturnInstruction(call, expr->id());
5775 return true; 5766 return true;
(...skipping 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after
8165 } 8156 }
8166 } 8157 }
8167 8158
8168 #ifdef DEBUG 8159 #ifdef DEBUG
8169 if (graph_ != NULL) graph_->Verify(false); // No full verify. 8160 if (graph_ != NULL) graph_->Verify(false); // No full verify.
8170 if (allocator_ != NULL) allocator_->Verify(); 8161 if (allocator_ != NULL) allocator_->Verify();
8171 #endif 8162 #endif
8172 } 8163 }
8173 8164
8174 } } // namespace v8::internal 8165 } } // namespace v8::internal
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698