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

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

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