Index: src/arm/full-codegen-arm.cc |
diff --git a/src/arm/full-codegen-arm.cc b/src/arm/full-codegen-arm.cc |
index a2f24400a4fc53612d0b5123f618266a89f75bfb..9a01faddc1f42738518b1dcac7b70d6d8f04562b 100644 |
--- a/src/arm/full-codegen-arm.cc |
+++ b/src/arm/full-codegen-arm.cc |
@@ -3104,15 +3104,20 @@ |
void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { |
- // r4: copy of the first argument or undefined if it doesn't exist. |
+ // r5: copy of the first argument or undefined if it doesn't exist. |
if (arg_count > 0) { |
- __ ldr(r4, MemOperand(sp, arg_count * kPointerSize)); |
+ __ ldr(r5, MemOperand(sp, arg_count * kPointerSize)); |
} else { |
- __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); |
- } |
+ __ LoadRoot(r5, Heap::kUndefinedValueRootIndex); |
+ } |
+ |
+ // r4: the receiver of the enclosing function. |
+ __ ldr(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
// r3: the receiver of the enclosing function. |
- __ ldr(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
+ Variable* this_var = scope()->LookupThis(); |
+ DCHECK_NOT_NULL(this_var); |
+ __ ldr(r3, VarOperand(this_var, r3)); |
// r2: language mode. |
__ mov(r2, Operand(Smi::FromInt(language_mode()))); |
@@ -3121,8 +3126,9 @@ |
__ mov(r1, Operand(Smi::FromInt(scope()->start_position()))); |
// Do the runtime call. |
+ __ Push(r5); |
__ Push(r4, r3, r2, r1); |
- __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); |
+ __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); |
} |
@@ -3154,9 +3160,10 @@ |
Call::CallType call_type = expr->GetCallType(isolate()); |
if (call_type == Call::POSSIBLY_EVAL_CALL) { |
- // In a call to eval, we first call |
- // RuntimeHidden_asResolvePossiblyDirectEval to resolve the function we need |
- // to call. Then we call the resolved function using the given arguments. |
+ // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval |
+ // to resolve the function we need to call and the receiver of the |
+ // call. Then we call the resolved function using the given |
+ // arguments. |
ZoneList<Expression*>* args = expr->arguments(); |
int arg_count = args->length(); |
@@ -3176,8 +3183,10 @@ |
__ push(r1); |
EmitResolvePossiblyDirectEval(arg_count); |
- // Touch up the stack with the resolved function. |
+ // The runtime call returns a pair of values in r0 (function) and |
+ // r1 (receiver). Touch up the stack with the right values. |
__ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); |
+ __ str(r1, MemOperand(sp, arg_count * kPointerSize)); |
PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS); |
} |
@@ -4774,10 +4783,9 @@ |
context()->Plug(r0); |
} else if (proxy != NULL) { |
Variable* var = proxy->var(); |
- // Delete of an unqualified identifier is disallowed in strict mode but |
- // "delete this" is allowed. |
- bool is_this = var->HasThisName(isolate()); |
- DCHECK(is_sloppy(language_mode()) || is_this); |
+ // Delete of an unqualified identifier is disallowed in strict mode |
+ // but "delete this" is allowed. |
+ DCHECK(is_sloppy(language_mode()) || var->is_this()); |
if (var->IsUnallocated()) { |
__ ldr(r2, GlobalObjectOperand()); |
__ mov(r1, Operand(var->name())); |
@@ -4788,7 +4796,7 @@ |
} else if (var->IsStackAllocated() || var->IsContextSlot()) { |
// Result of deleting non-global, non-dynamic variables is false. |
// The subexpression does not have side effects. |
- context()->Plug(is_this); |
+ context()->Plug(var->is_this()); |
} else { |
// Non-global variable. Call the runtime to try to delete from the |
// context where the variable was introduced. |