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