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

Side by Side Diff: src/arm/full-codegen-arm.cc

Issue 1177903004: Revert of Add script context with context-allocated "const this" (Closed) Base URL: https://chromium.googlesource.com/v8/v8@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 3086 matching lines...) Expand 10 before | Expand all | Expand 10 after
3097 CallIC(ic); 3097 CallIC(ic);
3098 3098
3099 RecordJSReturnSite(expr); 3099 RecordJSReturnSite(expr);
3100 // Restore context register. 3100 // Restore context register.
3101 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 3101 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
3102 context()->DropAndPlug(1, r0); 3102 context()->DropAndPlug(1, r0);
3103 } 3103 }
3104 3104
3105 3105
3106 void FullCodeGenerator::EmitResolvePossiblyDirectEval(int arg_count) { 3106 void 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.
3108 if (arg_count > 0) { 3108 if (arg_count > 0) {
3109 __ ldr(r4, MemOperand(sp, arg_count * kPointerSize)); 3109 __ ldr(r5, MemOperand(sp, arg_count * kPointerSize));
3110 } else { 3110 } else {
3111 __ LoadRoot(r4, Heap::kUndefinedValueRootIndex); 3111 __ LoadRoot(r5, Heap::kUndefinedValueRootIndex);
3112 } 3112 }
3113 3113
3114 // r4: the receiver of the enclosing function.
3115 __ ldr(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3116
3114 // r3: the receiver of the enclosing function. 3117 // 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));
3116 3121
3117 // r2: language mode. 3122 // r2: language mode.
3118 __ mov(r2, Operand(Smi::FromInt(language_mode()))); 3123 __ mov(r2, Operand(Smi::FromInt(language_mode())));
3119 3124
3120 // r1: the start position of the scope the calls resides in. 3125 // r1: the start position of the scope the calls resides in.
3121 __ mov(r1, Operand(Smi::FromInt(scope()->start_position()))); 3126 __ mov(r1, Operand(Smi::FromInt(scope()->start_position())));
3122 3127
3123 // Do the runtime call. 3128 // Do the runtime call.
3129 __ Push(r5);
3124 __ Push(r4, r3, r2, r1); 3130 __ Push(r4, r3, r2, r1);
3125 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 5); 3131 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
3126 } 3132 }
3127 3133
3128 3134
3129 void FullCodeGenerator::EmitInitializeThisAfterSuper( 3135 void FullCodeGenerator::EmitInitializeThisAfterSuper(
3130 SuperCallReference* super_ref, FeedbackVectorICSlot slot) { 3136 SuperCallReference* super_ref, FeedbackVectorICSlot slot) {
3131 Variable* this_var = super_ref->this_var()->var(); 3137 Variable* this_var = super_ref->this_var()->var();
3132 GetVar(r1, this_var); 3138 GetVar(r1, this_var);
3133 __ CompareRoot(r1, Heap::kTheHoleValueRootIndex); 3139 __ CompareRoot(r1, Heap::kTheHoleValueRootIndex);
3134 Label uninitialized_this; 3140 Label uninitialized_this;
3135 __ b(eq, &uninitialized_this); 3141 __ b(eq, &uninitialized_this);
(...skipping 11 matching lines...) Expand all
3147 // We want to verify that RecordJSReturnSite gets called on all paths 3153 // We want to verify that RecordJSReturnSite gets called on all paths
3148 // through this function. Avoid early returns. 3154 // through this function. Avoid early returns.
3149 expr->return_is_recorded_ = false; 3155 expr->return_is_recorded_ = false;
3150 #endif 3156 #endif
3151 3157
3152 Comment cmnt(masm_, "[ Call"); 3158 Comment cmnt(masm_, "[ Call");
3153 Expression* callee = expr->expression(); 3159 Expression* callee = expr->expression();
3154 Call::CallType call_type = expr->GetCallType(isolate()); 3160 Call::CallType call_type = expr->GetCallType(isolate());
3155 3161
3156 if (call_type == Call::POSSIBLY_EVAL_CALL) { 3162 if (call_type == Call::POSSIBLY_EVAL_CALL) {
3157 // In a call to eval, we first call 3163 // In a call to eval, we first call RuntimeHidden_ResolvePossiblyDirectEval
3158 // RuntimeHidden_asResolvePossiblyDirectEval to resolve the function we need 3164 // to resolve the function we need to call and the receiver of the
3159 // to call. Then we call the resolved function using the given arguments. 3165 // call. Then we call the resolved function using the given
3166 // arguments.
3160 ZoneList<Expression*>* args = expr->arguments(); 3167 ZoneList<Expression*>* args = expr->arguments();
3161 int arg_count = args->length(); 3168 int arg_count = args->length();
3162 3169
3163 { PreservePositionScope pos_scope(masm()->positions_recorder()); 3170 { PreservePositionScope pos_scope(masm()->positions_recorder());
3164 VisitForStackValue(callee); 3171 VisitForStackValue(callee);
3165 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); 3172 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex);
3166 __ push(r2); // Reserved receiver slot. 3173 __ push(r2); // Reserved receiver slot.
3167 3174
3168 // Push the arguments. 3175 // Push the arguments.
3169 for (int i = 0; i < arg_count; i++) { 3176 for (int i = 0; i < arg_count; i++) {
3170 VisitForStackValue(args->at(i)); 3177 VisitForStackValue(args->at(i));
3171 } 3178 }
3172 3179
3173 // Push a copy of the function (found below the arguments) and 3180 // Push a copy of the function (found below the arguments) and
3174 // resolve eval. 3181 // resolve eval.
3175 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3182 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3176 __ push(r1); 3183 __ push(r1);
3177 EmitResolvePossiblyDirectEval(arg_count); 3184 EmitResolvePossiblyDirectEval(arg_count);
3178 3185
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.
3180 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3188 __ str(r0, MemOperand(sp, (arg_count + 1) * kPointerSize));
3189 __ str(r1, MemOperand(sp, arg_count * kPointerSize));
3181 3190
3182 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS); 3191 PrepareForBailoutForId(expr->EvalOrLookupId(), NO_REGISTERS);
3183 } 3192 }
3184 3193
3185 // Record source position for debugger. 3194 // Record source position for debugger.
3186 SetSourcePosition(expr->position()); 3195 SetSourcePosition(expr->position());
3187 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); 3196 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
3188 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize)); 3197 __ ldr(r1, MemOperand(sp, (arg_count + 1) * kPointerSize));
3189 __ CallStub(&stub); 3198 __ CallStub(&stub);
3190 RecordJSReturnSite(expr); 3199 RecordJSReturnSite(expr);
(...skipping 1576 matching lines...) Expand 10 before | Expand all | Expand 10 after
4767 4776
4768 if (property != NULL) { 4777 if (property != NULL) {
4769 VisitForStackValue(property->obj()); 4778 VisitForStackValue(property->obj());
4770 VisitForStackValue(property->key()); 4779 VisitForStackValue(property->key());
4771 __ mov(r1, Operand(Smi::FromInt(language_mode()))); 4780 __ mov(r1, Operand(Smi::FromInt(language_mode())));
4772 __ push(r1); 4781 __ push(r1);
4773 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4782 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4774 context()->Plug(r0); 4783 context()->Plug(r0);
4775 } else if (proxy != NULL) { 4784 } else if (proxy != NULL) {
4776 Variable* var = proxy->var(); 4785 Variable* var = proxy->var();
4777 // Delete of an unqualified identifier is disallowed in strict mode but 4786 // Delete of an unqualified identifier is disallowed in strict mode
4778 // "delete this" is allowed. 4787 // but "delete this" is allowed.
4779 bool is_this = var->HasThisName(isolate()); 4788 DCHECK(is_sloppy(language_mode()) || var->is_this());
4780 DCHECK(is_sloppy(language_mode()) || is_this);
4781 if (var->IsUnallocated()) { 4789 if (var->IsUnallocated()) {
4782 __ ldr(r2, GlobalObjectOperand()); 4790 __ ldr(r2, GlobalObjectOperand());
4783 __ mov(r1, Operand(var->name())); 4791 __ mov(r1, Operand(var->name()));
4784 __ mov(r0, Operand(Smi::FromInt(SLOPPY))); 4792 __ mov(r0, Operand(Smi::FromInt(SLOPPY)));
4785 __ Push(r2, r1, r0); 4793 __ Push(r2, r1, r0);
4786 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION); 4794 __ InvokeBuiltin(Builtins::DELETE, CALL_FUNCTION);
4787 context()->Plug(r0); 4795 context()->Plug(r0);
4788 } else if (var->IsStackAllocated() || var->IsContextSlot()) { 4796 } else if (var->IsStackAllocated() || var->IsContextSlot()) {
4789 // Result of deleting non-global, non-dynamic variables is false. 4797 // Result of deleting non-global, non-dynamic variables is false.
4790 // The subexpression does not have side effects. 4798 // The subexpression does not have side effects.
4791 context()->Plug(is_this); 4799 context()->Plug(var->is_this());
4792 } else { 4800 } else {
4793 // Non-global variable. Call the runtime to try to delete from the 4801 // Non-global variable. Call the runtime to try to delete from the
4794 // context where the variable was introduced. 4802 // context where the variable was introduced.
4795 DCHECK(!context_register().is(r2)); 4803 DCHECK(!context_register().is(r2));
4796 __ mov(r2, Operand(var->name())); 4804 __ mov(r2, Operand(var->name()));
4797 __ Push(context_register(), r2); 4805 __ Push(context_register(), r2);
4798 __ CallRuntime(Runtime::kDeleteLookupSlot, 2); 4806 __ CallRuntime(Runtime::kDeleteLookupSlot, 2);
4799 context()->Plug(r0); 4807 context()->Plug(r0);
4800 } 4808 }
4801 } else { 4809 } else {
(...skipping 792 matching lines...) Expand 10 before | Expand all | Expand 10 after
5594 DCHECK(interrupt_address == 5602 DCHECK(interrupt_address ==
5595 isolate->builtins()->OsrAfterStackCheck()->entry()); 5603 isolate->builtins()->OsrAfterStackCheck()->entry());
5596 return OSR_AFTER_STACK_CHECK; 5604 return OSR_AFTER_STACK_CHECK;
5597 } 5605 }
5598 5606
5599 5607
5600 } // namespace internal 5608 } // namespace internal
5601 } // namespace v8 5609 } // namespace v8
5602 5610
5603 #endif // V8_TARGET_ARCH_ARM 5611 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698