@@ -3104,15 +3104,20 @@ void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) {
31043104
31053105
31063106void FullCodeGenerator::EmitResolvePossiblyDirectEval (int arg_count) {
3107- // r4 : copy of the first argument or undefined if it doesn't exist.
3107+ // r5 : copy of the first argument or undefined if it doesn't exist.
31083108 if (arg_count > 0 ) {
3109- __ ldr (r4 , MemOperand (sp, arg_count * kPointerSize ));
3109+ __ ldr (r5 , MemOperand (sp, arg_count * kPointerSize ));
31103110 } else {
3111- __ LoadRoot (r4 , Heap::kUndefinedValueRootIndex );
3111+ __ LoadRoot (r5 , Heap::kUndefinedValueRootIndex );
31123112 }
31133113
3114+ // r4: the receiver of the enclosing function.
3115+ __ ldr (r4, MemOperand (fp, JavaScriptFrameConstants::kFunctionOffset ));
3116+
31143117 // r3: the receiver of the enclosing function.
3115- __ ldr (r3, MemOperand (fp, JavaScriptFrameConstants::kFunctionOffset ));
3118+ Variable* this_var = scope ()->LookupThis ();
3119+ DCHECK_NOT_NULL (this_var);
3120+ __ ldr (r3, VarOperand (this_var, r3));
31163121
31173122 // r2: language mode.
31183123 __ mov (r2, Operand (Smi::FromInt (language_mode ())));
@@ -3121,8 +3126,9 @@ void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) {
31213126 __ mov (r1, Operand (Smi::FromInt (scope ()->start_position ())));
31223127
31233128 // Do the runtime call.
3129+ __ Push (r5);
31243130 __ Push (r4, r3, r2, r1);
3125- __ CallRuntime (Runtime::kResolvePossiblyDirectEval , 5 );
3131+ __ CallRuntime (Runtime::kResolvePossiblyDirectEval , 6 );
31263132}
31273133
31283134
@@ -3154,9 +3160,10 @@ void FullCodeGenerator::VisitCall(Call* expr) {
31543160 Call::CallType call_type = expr->GetCallType (isolate ());
31553161
31563162 if (call_type == Call::POSSIBLY_EVAL_CALL ) {
3157- // In a call to eval, we first call
3158- // RuntimeHidden_asResolvePossiblyDirectEval to resolve the function we need
3159- // to call. Then we call the resolved function using the given arguments.
3163+ // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
3164+ // to resolve the function we need to call and the receiver of the
3165+ // call. Then we call the resolved function using the given
3166+ // arguments.
31603167 ZoneList<Expression*>* args = expr->arguments ();
31613168 int arg_count = args->length ();
31623169
@@ -3176,8 +3183,10 @@ void FullCodeGenerator::VisitCall(Call* expr) {
31763183 __ push (r1);
31773184 EmitResolvePossiblyDirectEval (arg_count);
31783185
3179- // Touch up the stack with the resolved function.
3186+ // The runtime call returns a pair of values in r0 (function) and
3187+ // r1 (receiver). Touch up the stack with the right values.
31803188 __ str (r0, MemOperand (sp, (arg_count + 1 ) * kPointerSize ));
3189+ __ str (r1, MemOperand (sp, arg_count * kPointerSize ));
31813190
31823191 PrepareForBailoutForId (expr->EvalOrLookupId (), NO_REGISTERS );
31833192 }
@@ -4774,10 +4783,9 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
47744783 context ()->Plug (r0);
47754784 } else if (proxy != NULL ) {
47764785 Variable* var = proxy->var ();
4777- // Delete of an unqualified identifier is disallowed in strict mode but
4778- // "delete this" is allowed.
4779- bool is_this = var->HasThisName (isolate ());
4780- DCHECK (is_sloppy (language_mode ()) || is_this);
4786+ // Delete of an unqualified identifier is disallowed in strict mode
4787+ // but "delete this" is allowed.
4788+ DCHECK (is_sloppy (language_mode ()) || var->is_this ());
47814789 if (var->IsUnallocated ()) {
47824790 __ ldr (r2, GlobalObjectOperand ());
47834791 __ mov (r1, Operand (var->name ()));
@@ -4788,7 +4796,7 @@ void FullCodeGenerator::VisitUnaryOperation(UnaryOperation* expr) {
47884796 } else if (var->IsStackAllocated () || var->IsContextSlot ()) {
47894797 // Result of deleting non-global, non-dynamic variables is false.
47904798 // The subexpression does not have side effects.
4791- context ()->Plug (is_this);
4799+ context ()->Plug (var-> is_this () );
47924800 } else {
47934801 // Non-global variable. Call the runtime to try to delete from the
47944802 // context where the variable was introduced.
0 commit comments