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 1146863007: [es6] Super call in arrows and eval (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase 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') | src/ia32/full-codegen-ia32.cc » ('J')
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 } else if (FLAG_debug_code) { 235 } else if (FLAG_debug_code) {
236 Label done; 236 Label done;
237 __ JumpIfInNewSpace(cp, r0, &done); 237 __ JumpIfInNewSpace(cp, r0, &done);
238 __ Abort(kExpectedNewSpaceObject); 238 __ Abort(kExpectedNewSpaceObject);
239 __ bind(&done); 239 __ bind(&done);
240 } 240 }
241 } 241 }
242 } 242 }
243 } 243 }
244 244
245 // Possibly set up a local binding to the this function which is used in
246 // derived constructors with super calls.
247 Variable* this_function_var = scope()->this_function_var();
248 if (this_function_var != nullptr) {
249 Comment cmnt(masm_, "[ This function");
250 SetVar(this_function_var, r1, r0, r2);
251 }
252
253 Variable* new_target_var = scope()->new_target_var();
254 if (new_target_var != nullptr) {
255 Comment cmnt(masm_, "[ new.target");
256 // new.target is parameter -2.
257 int offset = 2 * kPointerSize +
258 (info_->scope()->num_parameters() + 1) * kPointerSize;
259 __ ldr(r0, MemOperand(fp, offset));
260 SetVar(new_target_var, r0, r2, r3);
261 }
262
245 Variable* home_object_var = scope()->home_object_var(); 263 Variable* home_object_var = scope()->home_object_var();
246 if (home_object_var != nullptr) { 264 if (home_object_var != nullptr) {
247 __ Push(r1); 265 __ Push(r1);
248 } 266 }
249 267
250 ArgumentsAccessStub::HasNewTarget has_new_target = 268 ArgumentsAccessStub::HasNewTarget has_new_target =
251 IsSubclassConstructor(info->function()->kind()) 269 IsSubclassConstructor(info->function()->kind())
252 ? ArgumentsAccessStub::HAS_NEW_TARGET 270 ? ArgumentsAccessStub::HAS_NEW_TARGET
253 : ArgumentsAccessStub::NO_NEW_TARGET; 271 : ArgumentsAccessStub::NO_NEW_TARGET;
254 272
(...skipping 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after
1993 case NAMED_PROPERTY: 2011 case NAMED_PROPERTY:
1994 if (expr->is_compound()) { 2012 if (expr->is_compound()) {
1995 // We need the receiver both on the stack and in the register. 2013 // We need the receiver both on the stack and in the register.
1996 VisitForStackValue(property->obj()); 2014 VisitForStackValue(property->obj());
1997 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 2015 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
1998 } else { 2016 } else {
1999 VisitForStackValue(property->obj()); 2017 VisitForStackValue(property->obj());
2000 } 2018 }
2001 break; 2019 break;
2002 case NAMED_SUPER_PROPERTY: 2020 case NAMED_SUPER_PROPERTY:
2003 VisitForStackValue(property->obj()->AsSuperReference()->this_var()); 2021 VisitForStackValue(
2022 property->obj()->AsSuperPropertyReference()->this_var());
2004 VisitForAccumulatorValue( 2023 VisitForAccumulatorValue(
2005 property->obj()->AsSuperReference()->home_object_var()); 2024 property->obj()->AsSuperPropertyReference()->home_object_var());
2006 __ Push(result_register()); 2025 __ Push(result_register());
2007 if (expr->is_compound()) { 2026 if (expr->is_compound()) {
2008 const Register scratch = r1; 2027 const Register scratch = r1;
2009 __ ldr(scratch, MemOperand(sp, kPointerSize)); 2028 __ ldr(scratch, MemOperand(sp, kPointerSize));
2010 __ Push(scratch); 2029 __ Push(scratch);
2011 __ Push(result_register()); 2030 __ Push(result_register());
2012 } 2031 }
2013 break; 2032 break;
2014 case KEYED_SUPER_PROPERTY: 2033 case KEYED_SUPER_PROPERTY:
2015 VisitForStackValue(property->obj()->AsSuperReference()->this_var());
2016 VisitForStackValue( 2034 VisitForStackValue(
2017 property->obj()->AsSuperReference()->home_object_var()); 2035 property->obj()->AsSuperPropertyReference()->this_var());
2036 VisitForStackValue(
2037 property->obj()->AsSuperPropertyReference()->home_object_var());
2018 VisitForAccumulatorValue(property->key()); 2038 VisitForAccumulatorValue(property->key());
2019 __ Push(result_register()); 2039 __ Push(result_register());
2020 if (expr->is_compound()) { 2040 if (expr->is_compound()) {
2021 const Register scratch = r1; 2041 const Register scratch = r1;
2022 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); 2042 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize));
2023 __ Push(scratch); 2043 __ Push(scratch);
2024 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); 2044 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize));
2025 __ Push(scratch); 2045 __ Push(scratch);
2026 __ Push(result_register()); 2046 __ Push(result_register());
2027 } 2047 }
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
2650 __ Move(StoreDescriptor::ReceiverRegister(), r0); 2670 __ Move(StoreDescriptor::ReceiverRegister(), r0);
2651 __ pop(StoreDescriptor::ValueRegister()); // Restore value. 2671 __ pop(StoreDescriptor::ValueRegister()); // Restore value.
2652 __ mov(StoreDescriptor::NameRegister(), 2672 __ mov(StoreDescriptor::NameRegister(),
2653 Operand(prop->key()->AsLiteral()->value())); 2673 Operand(prop->key()->AsLiteral()->value()));
2654 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2674 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2655 CallStoreIC(); 2675 CallStoreIC();
2656 break; 2676 break;
2657 } 2677 }
2658 case NAMED_SUPER_PROPERTY: { 2678 case NAMED_SUPER_PROPERTY: {
2659 __ Push(r0); 2679 __ Push(r0);
2660 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); 2680 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
2661 VisitForAccumulatorValue( 2681 VisitForAccumulatorValue(
2662 prop->obj()->AsSuperReference()->home_object_var()); 2682 prop->obj()->AsSuperPropertyReference()->home_object_var());
2663 // stack: value, this; r0: home_object 2683 // stack: value, this; r0: home_object
2664 Register scratch = r2; 2684 Register scratch = r2;
2665 Register scratch2 = r3; 2685 Register scratch2 = r3;
2666 __ mov(scratch, result_register()); // home_object 2686 __ mov(scratch, result_register()); // home_object
2667 __ ldr(r0, MemOperand(sp, kPointerSize)); // value 2687 __ ldr(r0, MemOperand(sp, kPointerSize)); // value
2668 __ ldr(scratch2, MemOperand(sp, 0)); // this 2688 __ ldr(scratch2, MemOperand(sp, 0)); // this
2669 __ str(scratch2, MemOperand(sp, kPointerSize)); // this 2689 __ str(scratch2, MemOperand(sp, kPointerSize)); // this
2670 __ str(scratch, MemOperand(sp, 0)); // home_object 2690 __ str(scratch, MemOperand(sp, 0)); // home_object
2671 // stack: this, home_object; r0: value 2691 // stack: this, home_object; r0: value
2672 EmitNamedSuperPropertyStore(prop); 2692 EmitNamedSuperPropertyStore(prop);
2673 break; 2693 break;
2674 } 2694 }
2675 case KEYED_SUPER_PROPERTY: { 2695 case KEYED_SUPER_PROPERTY: {
2676 __ Push(r0); 2696 __ Push(r0);
2677 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); 2697 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
2678 VisitForStackValue(prop->obj()->AsSuperReference()->home_object_var()); 2698 VisitForStackValue(
2699 prop->obj()->AsSuperPropertyReference()->home_object_var());
2679 VisitForAccumulatorValue(prop->key()); 2700 VisitForAccumulatorValue(prop->key());
2680 Register scratch = r2; 2701 Register scratch = r2;
2681 Register scratch2 = r3; 2702 Register scratch2 = r3;
2682 __ ldr(scratch2, MemOperand(sp, 2 * kPointerSize)); // value 2703 __ ldr(scratch2, MemOperand(sp, 2 * kPointerSize)); // value
2683 // stack: value, this, home_object; r0: key, r3: value 2704 // stack: value, this, home_object; r0: key, r3: value
2684 __ ldr(scratch, MemOperand(sp, kPointerSize)); // this 2705 __ ldr(scratch, MemOperand(sp, kPointerSize)); // this
2685 __ str(scratch, MemOperand(sp, 2 * kPointerSize)); 2706 __ str(scratch, MemOperand(sp, 2 * kPointerSize));
2686 __ ldr(scratch, MemOperand(sp, 0)); // home_object 2707 __ ldr(scratch, MemOperand(sp, 0)); // home_object
2687 __ str(scratch, MemOperand(sp, kPointerSize)); 2708 __ str(scratch, MemOperand(sp, kPointerSize));
2688 __ str(r0, MemOperand(sp, 0)); 2709 __ str(r0, MemOperand(sp, 0));
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
2892 void FullCodeGenerator::VisitProperty(Property* expr) { 2913 void FullCodeGenerator::VisitProperty(Property* expr) {
2893 Comment cmnt(masm_, "[ Property"); 2914 Comment cmnt(masm_, "[ Property");
2894 Expression* key = expr->key(); 2915 Expression* key = expr->key();
2895 2916
2896 if (key->IsPropertyName()) { 2917 if (key->IsPropertyName()) {
2897 if (!expr->IsSuperAccess()) { 2918 if (!expr->IsSuperAccess()) {
2898 VisitForAccumulatorValue(expr->obj()); 2919 VisitForAccumulatorValue(expr->obj());
2899 __ Move(LoadDescriptor::ReceiverRegister(), r0); 2920 __ Move(LoadDescriptor::ReceiverRegister(), r0);
2900 EmitNamedPropertyLoad(expr); 2921 EmitNamedPropertyLoad(expr);
2901 } else { 2922 } else {
2902 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); 2923 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var());
2903 VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); 2924 VisitForStackValue(
2925 expr->obj()->AsSuperPropertyReference()->home_object_var());
2904 EmitNamedSuperPropertyLoad(expr); 2926 EmitNamedSuperPropertyLoad(expr);
2905 } 2927 }
2906 } else { 2928 } else {
2907 if (!expr->IsSuperAccess()) { 2929 if (!expr->IsSuperAccess()) {
2908 VisitForStackValue(expr->obj()); 2930 VisitForStackValue(expr->obj());
2909 VisitForAccumulatorValue(expr->key()); 2931 VisitForAccumulatorValue(expr->key());
2910 __ Move(LoadDescriptor::NameRegister(), r0); 2932 __ Move(LoadDescriptor::NameRegister(), r0);
2911 __ pop(LoadDescriptor::ReceiverRegister()); 2933 __ pop(LoadDescriptor::ReceiverRegister());
2912 EmitKeyedPropertyLoad(expr); 2934 EmitKeyedPropertyLoad(expr);
2913 } else { 2935 } else {
2914 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); 2936 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var());
2915 VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); 2937 VisitForStackValue(
2938 expr->obj()->AsSuperPropertyReference()->home_object_var());
2916 VisitForStackValue(expr->key()); 2939 VisitForStackValue(expr->key());
2917 EmitKeyedSuperPropertyLoad(expr); 2940 EmitKeyedSuperPropertyLoad(expr);
2918 } 2941 }
2919 } 2942 }
2920 PrepareForBailoutForId(expr->LoadId(), TOS_REG); 2943 PrepareForBailoutForId(expr->LoadId(), TOS_REG);
2921 context()->Plug(r0); 2944 context()->Plug(r0);
2922 } 2945 }
2923 2946
2924 2947
2925 void FullCodeGenerator::CallIC(Handle<Code> code, 2948 void FullCodeGenerator::CallIC(Handle<Code> code,
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
2970 Expression* callee = expr->expression(); 2993 Expression* callee = expr->expression();
2971 DCHECK(callee->IsProperty()); 2994 DCHECK(callee->IsProperty());
2972 Property* prop = callee->AsProperty(); 2995 Property* prop = callee->AsProperty();
2973 DCHECK(prop->IsSuperAccess()); 2996 DCHECK(prop->IsSuperAccess());
2974 2997
2975 SetSourcePosition(prop->position()); 2998 SetSourcePosition(prop->position());
2976 Literal* key = prop->key()->AsLiteral(); 2999 Literal* key = prop->key()->AsLiteral();
2977 DCHECK(!key->value()->IsSmi()); 3000 DCHECK(!key->value()->IsSmi());
2978 // Load the function from the receiver. 3001 // Load the function from the receiver.
2979 const Register scratch = r1; 3002 const Register scratch = r1;
2980 SuperReference* super_ref = prop->obj()->AsSuperReference(); 3003 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
2981 VisitForStackValue(super_ref->home_object_var()); 3004 VisitForStackValue(super_ref->home_object_var());
2982 VisitForAccumulatorValue(super_ref->this_var()); 3005 VisitForAccumulatorValue(super_ref->this_var());
2983 __ Push(r0); 3006 __ Push(r0);
2984 __ Push(r0); 3007 __ Push(r0);
2985 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); 3008 __ ldr(scratch, MemOperand(sp, kPointerSize * 2));
2986 __ Push(scratch); 3009 __ Push(scratch);
2987 __ Push(key->value()); 3010 __ Push(key->value());
2988 3011
2989 // Stack here: 3012 // Stack here:
2990 // - home_object 3013 // - home_object
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3030 3053
3031 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { 3054 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
3032 Expression* callee = expr->expression(); 3055 Expression* callee = expr->expression();
3033 DCHECK(callee->IsProperty()); 3056 DCHECK(callee->IsProperty());
3034 Property* prop = callee->AsProperty(); 3057 Property* prop = callee->AsProperty();
3035 DCHECK(prop->IsSuperAccess()); 3058 DCHECK(prop->IsSuperAccess());
3036 3059
3037 SetSourcePosition(prop->position()); 3060 SetSourcePosition(prop->position());
3038 // Load the function from the receiver. 3061 // Load the function from the receiver.
3039 const Register scratch = r1; 3062 const Register scratch = r1;
3040 SuperReference* super_ref = prop->obj()->AsSuperReference(); 3063 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
3041 VisitForStackValue(super_ref->home_object_var()); 3064 VisitForStackValue(super_ref->home_object_var());
3042 VisitForAccumulatorValue(super_ref->this_var()); 3065 VisitForAccumulatorValue(super_ref->this_var());
3043 __ Push(r0); 3066 __ Push(r0);
3044 __ Push(r0); 3067 __ Push(r0);
3045 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); 3068 __ ldr(scratch, MemOperand(sp, kPointerSize * 2));
3046 __ Push(scratch); 3069 __ Push(scratch);
3047 VisitForStackValue(prop->key()); 3070 VisitForStackValue(prop->key());
3048 3071
3049 // Stack here: 3072 // Stack here:
3050 // - home_object 3073 // - home_object
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
3112 // r1: the start position of the scope the calls resides in. 3135 // r1: the start position of the scope the calls resides in.
3113 __ mov(r1, Operand(Smi::FromInt(scope()->start_position()))); 3136 __ mov(r1, Operand(Smi::FromInt(scope()->start_position())));
3114 3137
3115 // Do the runtime call. 3138 // Do the runtime call.
3116 __ Push(r5); 3139 __ Push(r5);
3117 __ Push(r4, r3, r2, r1); 3140 __ Push(r4, r3, r2, r1);
3118 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); 3141 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
3119 } 3142 }
3120 3143
3121 3144
3122 void FullCodeGenerator::EmitLoadSuperConstructor() {
3123 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3124 __ Push(r0);
3125 __ CallRuntime(Runtime::kGetPrototype, 1);
3126 }
3127
3128
3129 void FullCodeGenerator::EmitInitializeThisAfterSuper( 3145 void FullCodeGenerator::EmitInitializeThisAfterSuper(
3130 SuperReference* super_ref, FeedbackVectorICSlot slot) { 3146 SuperCallReference* super_ref, FeedbackVectorICSlot slot) {
3131 Variable* this_var = super_ref->this_var()->var(); 3147 Variable* this_var = super_ref->this_var()->var();
3132 GetVar(r1, this_var); 3148 GetVar(r1, this_var);
3133 __ CompareRoot(r1, Heap::kTheHoleValueRootIndex); 3149 __ CompareRoot(r1, Heap::kTheHoleValueRootIndex);
3134 Label uninitialized_this; 3150 Label uninitialized_this;
3135 __ b(eq, &uninitialized_this); 3151 __ b(eq, &uninitialized_this);
3136 __ mov(r0, Operand(this_var->name())); 3152 __ mov(r0, Operand(this_var->name()));
3137 __ Push(r0); 3153 __ Push(r0);
3138 __ CallRuntime(Runtime::kThrowReferenceError, 1); 3154 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3139 __ bind(&uninitialized_this); 3155 __ bind(&uninitialized_this);
3140 3156
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
3280 3296
3281 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 3297 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
3282 Comment cmnt(masm_, "[ CallNew"); 3298 Comment cmnt(masm_, "[ CallNew");
3283 // According to ECMA-262, section 11.2.2, page 44, the function 3299 // According to ECMA-262, section 11.2.2, page 44, the function
3284 // expression in new calls must be evaluated before the 3300 // expression in new calls must be evaluated before the
3285 // arguments. 3301 // arguments.
3286 3302
3287 // Push constructor on the stack. If it's not a function it's used as 3303 // Push constructor on the stack. If it's not a function it's used as
3288 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is 3304 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is
3289 // ignored. 3305 // ignored.
3290 DCHECK(!expr->expression()->IsSuperReference()); 3306 DCHECK(!expr->expression()->IsSuperPropertyReference());
3291 VisitForStackValue(expr->expression()); 3307 VisitForStackValue(expr->expression());
3292 3308
3293 // Push the arguments ("left-to-right") on the stack. 3309 // Push the arguments ("left-to-right") on the stack.
3294 ZoneList<Expression*>* args = expr->arguments(); 3310 ZoneList<Expression*>* args = expr->arguments();
3295 int arg_count = args->length(); 3311 int arg_count = args->length();
3296 for (int i = 0; i < arg_count; i++) { 3312 for (int i = 0; i < arg_count; i++) {
3297 VisitForStackValue(args->at(i)); 3313 VisitForStackValue(args->at(i));
3298 } 3314 }
3299 3315
3300 // Call the construct call builtin that handles allocation and 3316 // Call the construct call builtin that handles allocation and
(...skipping 15 matching lines...) Expand all
3316 __ mov(r3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); 3332 __ mov(r3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot())));
3317 3333
3318 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 3334 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3319 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3335 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3320 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3336 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3321 context()->Plug(r0); 3337 context()->Plug(r0);
3322 } 3338 }
3323 3339
3324 3340
3325 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3341 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3326 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); 3342 SuperCallReference* super_call_ref =
3327 GetVar(result_register(), new_target_var); 3343 expr->expression()->AsSuperCallReference();
3328 __ Push(result_register()); 3344 DCHECK_NOT_NULL(super_call_ref);
3329 3345
3330 EmitLoadSuperConstructor(); 3346 VariableProxy* new_target_proxy = super_call_ref->new_target_var();
3347 VisitForStackValue(new_target_proxy);
3348
3349 EmitLoadSuperConstructor(super_call_ref);
3331 __ push(result_register()); 3350 __ push(result_register());
3332 3351
3333 // Push the arguments ("left-to-right") on the stack. 3352 // Push the arguments ("left-to-right") on the stack.
3334 ZoneList<Expression*>* args = expr->arguments(); 3353 ZoneList<Expression*>* args = expr->arguments();
3335 int arg_count = args->length(); 3354 int arg_count = args->length();
3336 for (int i = 0; i < arg_count; i++) { 3355 for (int i = 0; i < arg_count; i++) {
3337 VisitForStackValue(args->at(i)); 3356 VisitForStackValue(args->at(i));
3338 } 3357 }
3339 3358
3340 // Call the construct call builtin that handles allocation and 3359 // Call the construct call builtin that handles allocation and
(...skipping 17 matching lines...) Expand all
3358 __ Move(r2, FeedbackVector()); 3377 __ Move(r2, FeedbackVector());
3359 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); 3378 __ mov(r3, Operand(SmiFromSlot(expr->CallFeedbackSlot())));
3360 3379
3361 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3380 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3362 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3381 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3363 3382
3364 __ Drop(1); 3383 __ Drop(1);
3365 3384
3366 RecordJSReturnSite(expr); 3385 RecordJSReturnSite(expr);
3367 3386
3368 EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference(), 3387 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot());
3369 expr->CallFeedbackICSlot());
3370 context()->Plug(r0); 3388 context()->Plug(r0);
3371 } 3389 }
3372 3390
3373 3391
3374 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3392 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3375 ZoneList<Expression*>* args = expr->arguments(); 3393 ZoneList<Expression*>* args = expr->arguments();
3376 DCHECK(args->length() == 1); 3394 DCHECK(args->length() == 1);
3377 3395
3378 VisitForAccumulatorValue(args->at(0)); 3396 VisitForAccumulatorValue(args->at(0));
3379 3397
(...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after
4220 __ bind(&runtime); 4238 __ bind(&runtime);
4221 __ push(r0); 4239 __ push(r0);
4222 __ CallRuntime(Runtime::kCall, args->length()); 4240 __ CallRuntime(Runtime::kCall, args->length());
4223 __ bind(&done); 4241 __ bind(&done);
4224 4242
4225 context()->Plug(r0); 4243 context()->Plug(r0);
4226 } 4244 }
4227 4245
4228 4246
4229 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { 4247 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
4230 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); 4248 ZoneList<Expression*>* args = expr->arguments();
4231 GetVar(result_register(), new_target_var); 4249 DCHECK(args->length() == 2);
4232 __ Push(result_register());
4233 4250
4234 EmitLoadSuperConstructor(); 4251 // new.target
4252 VisitForStackValue(args->at(0));
4253
4254 // .this_function
4255 VisitForStackValue(args->at(1));
4256 __ CallRuntime(Runtime::kGetPrototype, 1);
4235 __ Push(result_register()); 4257 __ Push(result_register());
4236 4258
4237 // Check if the calling frame is an arguments adaptor frame. 4259 // Check if the calling frame is an arguments adaptor frame.
4238 Label adaptor_frame, args_set_up, runtime; 4260 Label adaptor_frame, args_set_up, runtime;
4239 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 4261 __ ldr(r2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
4240 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset)); 4262 __ ldr(r3, MemOperand(r2, StandardFrameConstants::kContextOffset));
4241 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 4263 __ cmp(r3, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
4242 __ b(eq, &adaptor_frame); 4264 __ b(eq, &adaptor_frame);
4243 // default constructor has no arguments, so no adaptor frame means no args. 4265 // default constructor has no arguments, so no adaptor frame means no args.
4244 __ mov(r0, Operand::Zero()); 4266 __ mov(r0, Operand::Zero());
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
4621 context()->Plug(r0); 4643 context()->Plug(r0);
4622 } 4644 }
4623 4645
4624 4646
4625 void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) { 4647 void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) {
4626 // Assert: expr === CallRuntime("ReflectConstruct") 4648 // Assert: expr === CallRuntime("ReflectConstruct")
4627 CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime(); 4649 CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime();
4628 ZoneList<Expression*>* args = call->arguments(); 4650 ZoneList<Expression*>* args = call->arguments();
4629 DCHECK_EQ(3, args->length()); 4651 DCHECK_EQ(3, args->length());
4630 4652
4631 SuperReference* super_reference = args->at(0)->AsSuperReference(); 4653 SuperCallReference* super_call_ref = args->at(0)->AsSuperCallReference();
4654 DCHECK_NOT_NULL(super_call_ref);
4632 4655
4633 // Load ReflectConstruct function 4656 // Load ReflectConstruct function
4634 EmitLoadJSRuntimeFunction(call); 4657 EmitLoadJSRuntimeFunction(call);
4635 4658
4636 // Push the target function under the receiver. 4659 // Push the target function under the receiver.
4637 __ ldr(ip, MemOperand(sp, 0)); 4660 __ ldr(ip, MemOperand(sp, 0));
4638 __ push(ip); 4661 __ push(ip);
4639 __ str(r0, MemOperand(sp, kPointerSize)); 4662 __ str(r0, MemOperand(sp, kPointerSize));
4640 4663
4641 // Push super 4664 // Push super constructor
4642 EmitLoadSuperConstructor(); 4665 EmitLoadSuperConstructor(super_call_ref);
4643 __ Push(result_register()); 4666 __ Push(result_register());
4644 4667
4645 // Push arguments array 4668 // Push arguments array
4646 VisitForStackValue(args->at(1)); 4669 VisitForStackValue(args->at(1));
4647 4670
4648 // Push NewTarget 4671 // Push NewTarget
4649 DCHECK(args->at(2)->IsVariableProxy()); 4672 DCHECK(args->at(2)->IsVariableProxy());
4650 VisitForStackValue(args->at(2)); 4673 VisitForStackValue(args->at(2));
4651 4674
4652 EmitCallJSRuntimeFunction(call); 4675 EmitCallJSRuntimeFunction(call);
4653 4676
4654 // Restore context register. 4677 // Restore context register.
4655 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 4678 __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4656 context()->DropAndPlug(1, r0); 4679 context()->DropAndPlug(1, r0);
4657 4680
4658 // TODO(mvstanton): with FLAG_vector_stores this needs a slot id. 4681 // TODO(mvstanton): with FLAG_vector_stores this needs a slot id.
4659 EmitInitializeThisAfterSuper(super_reference); 4682 EmitInitializeThisAfterSuper(super_call_ref);
4660 } 4683 }
4661 4684
4662 4685
4663 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 4686 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
4664 // Push the builtins object as the receiver. 4687 // Push the builtins object as the receiver.
4665 Register receiver = LoadDescriptor::ReceiverRegister(); 4688 Register receiver = LoadDescriptor::ReceiverRegister();
4666 __ ldr(receiver, GlobalObjectOperand()); 4689 __ ldr(receiver, GlobalObjectOperand());
4667 __ ldr(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); 4690 __ ldr(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset));
4668 __ push(receiver); 4691 __ push(receiver);
4669 4692
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
4874 switch (assign_type) { 4897 switch (assign_type) {
4875 case NAMED_PROPERTY: { 4898 case NAMED_PROPERTY: {
4876 // Put the object both on the stack and in the register. 4899 // Put the object both on the stack and in the register.
4877 VisitForStackValue(prop->obj()); 4900 VisitForStackValue(prop->obj());
4878 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 4901 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
4879 EmitNamedPropertyLoad(prop); 4902 EmitNamedPropertyLoad(prop);
4880 break; 4903 break;
4881 } 4904 }
4882 4905
4883 case NAMED_SUPER_PROPERTY: { 4906 case NAMED_SUPER_PROPERTY: {
4884 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); 4907 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
4885 VisitForAccumulatorValue( 4908 VisitForAccumulatorValue(
4886 prop->obj()->AsSuperReference()->home_object_var()); 4909 prop->obj()->AsSuperPropertyReference()->home_object_var());
4887 __ Push(result_register()); 4910 __ Push(result_register());
4888 const Register scratch = r1; 4911 const Register scratch = r1;
4889 __ ldr(scratch, MemOperand(sp, kPointerSize)); 4912 __ ldr(scratch, MemOperand(sp, kPointerSize));
4890 __ Push(scratch); 4913 __ Push(scratch);
4891 __ Push(result_register()); 4914 __ Push(result_register());
4892 EmitNamedSuperPropertyLoad(prop); 4915 EmitNamedSuperPropertyLoad(prop);
4893 break; 4916 break;
4894 } 4917 }
4895 4918
4896 case KEYED_SUPER_PROPERTY: { 4919 case KEYED_SUPER_PROPERTY: {
4897 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); 4920 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
4898 VisitForStackValue(prop->obj()->AsSuperReference()->home_object_var()); 4921 VisitForStackValue(
4922 prop->obj()->AsSuperPropertyReference()->home_object_var());
4899 VisitForAccumulatorValue(prop->key()); 4923 VisitForAccumulatorValue(prop->key());
4900 __ Push(result_register()); 4924 __ Push(result_register());
4901 const Register scratch = r1; 4925 const Register scratch = r1;
4902 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); 4926 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize));
4903 __ Push(scratch); 4927 __ Push(scratch);
4904 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); 4928 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize));
4905 __ Push(scratch); 4929 __ Push(scratch);
4906 __ Push(result_register()); 4930 __ Push(result_register());
4907 EmitKeyedSuperPropertyLoad(prop); 4931 EmitKeyedSuperPropertyLoad(prop);
4908 break; 4932 break;
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
5571 5595
5572 DCHECK(interrupt_address == 5596 DCHECK(interrupt_address ==
5573 isolate->builtins()->OsrAfterStackCheck()->entry()); 5597 isolate->builtins()->OsrAfterStackCheck()->entry());
5574 return OSR_AFTER_STACK_CHECK; 5598 return OSR_AFTER_STACK_CHECK;
5575 } 5599 }
5576 5600
5577 5601
5578 } } // namespace v8::internal 5602 } } // namespace v8::internal
5579 5603
5580 #endif // V8_TARGET_ARCH_ARM 5604 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | src/ia32/full-codegen-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698