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