Index: src/ppc/lithium-codegen-ppc.cc |
diff --git a/src/ppc/lithium-codegen-ppc.cc b/src/ppc/lithium-codegen-ppc.cc |
index 5b5a58b938c2763f31b78605d20541b85eba8e8c..6676909eae1725f30fd7a5fcb8fed15567d75576 100644 |
--- a/src/ppc/lithium-codegen-ppc.cc |
+++ b/src/ppc/lithium-codegen-ppc.cc |
@@ -118,8 +118,8 @@ bool LCodeGen::GeneratePrologue() { |
// Sloppy mode functions and builtins need to replace the receiver with the |
// global proxy when called as functions (without an explicit receiver |
// object). |
- if (is_sloppy(info_->language_mode()) && info()->MayUseThis() && |
- !info_->is_native()) { |
+ if (is_sloppy(info_->language_mode()) && info_->MayUseThis() && |
+ !info_->is_native() && info_->scope()->has_this_declaration()) { |
Label ok; |
int receiver_offset = info_->scope()->num_parameters() * kPointerSize; |
__ LoadP(r5, MemOperand(sp, receiver_offset)); |
@@ -199,8 +199,9 @@ bool LCodeGen::GeneratePrologue() { |
__ StoreP(r3, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
// Copy any necessary parameters into the context. |
int num_parameters = scope()->num_parameters(); |
- for (int i = 0; i < num_parameters; i++) { |
- Variable* var = scope()->parameter(i); |
+ int first_parameter = scope()->has_this_declaration() ? -1 : 0; |
+ for (int i = first_parameter; i < num_parameters; i++) { |
+ Variable* var = (i == -1) ? scope()->receiver() : scope()->parameter(i); |
if (var->IsContextSlot()) { |
int parameter_offset = StandardFrameConstants::kCallerSPOffset + |
(num_parameters - 1 - i) * kPointerSize; |