Index: src/x87/full-codegen-x87.cc |
diff --git a/src/x87/full-codegen-x87.cc b/src/x87/full-codegen-x87.cc |
index 5c51fe3dc7f8898ac3e20941022abd5490d03347..2ffbc79b4d765b64c2c139fa426bd868052888c1 100644 |
--- a/src/x87/full-codegen-x87.cc |
+++ b/src/x87/full-codegen-x87.cc |
@@ -210,8 +210,9 @@ void FullCodeGenerator::Generate() { |
// Copy parameters into context if necessary. |
int num_parameters = info->scope()->num_parameters(); |
- for (int i = 0; i < num_parameters; i++) { |
- Variable* var = scope()->parameter(i); |
+ int first_parameter = info->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; |
@@ -2951,7 +2952,9 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
// Push the enclosing function. |
__ push(Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
// Push the receiver of the enclosing function. |
- __ push(Operand(ebp, (2 + info_->scope()->num_parameters()) * kPointerSize)); |
+ Variable* this_var = scope()->LookupThis(); |
+ DCHECK_NOT_NULL(this_var); |
+ __ push(VarOperand(this_var, ecx)); |
// Push the language mode. |
__ push(Immediate(Smi::FromInt(language_mode()))); |