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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } else if (FLAG_debug_code) { | 241 } else if (FLAG_debug_code) { |
242 Label done; | 242 Label done; |
243 __ JumpIfInNewSpace(cp, a0, &done); | 243 __ JumpIfInNewSpace(cp, a0, &done); |
244 __ Abort(kExpectedNewSpaceObject); | 244 __ Abort(kExpectedNewSpaceObject); |
245 __ bind(&done); | 245 __ bind(&done); |
246 } | 246 } |
247 } | 247 } |
248 } | 248 } |
249 } | 249 } |
250 | 250 |
251 // Possibly set up a local binding to the this function which is used in | |
252 // derived constructors with super calls. | |
253 Variable* this_function_var = scope()->this_function_var(); | |
254 if (this_function_var != nullptr) { | |
255 Comment cmnt(masm_, "[ This function"); | |
256 SetVar(this_function_var, a1, a2, a3); | |
257 } | |
258 | |
259 Variable* new_target_var = scope()->new_target_var(); | |
260 if (new_target_var != nullptr) { | |
261 Comment cmnt(masm_, "[ new.target"); | |
262 // new.target is parameter -2. | |
263 int offset = 2 * kPointerSize + | |
264 (info_->scope()->num_parameters() + 1) * kPointerSize; | |
265 __ lw(v0, MemOperand(fp, offset)); | |
266 SetVar(new_target_var, v0, a2, a3); | |
267 } | |
268 | |
269 Variable* home_object_var = scope()->home_object_var(); | 251 Variable* home_object_var = scope()->home_object_var(); |
270 if (home_object_var != nullptr) { | 252 if (home_object_var != nullptr) { |
271 __ Push(a1); | 253 __ Push(a1); |
272 } | 254 } |
273 | 255 |
274 ArgumentsAccessStub::HasNewTarget has_new_target = | 256 ArgumentsAccessStub::HasNewTarget has_new_target = |
275 IsSubclassConstructor(info->function()->kind()) | 257 IsSubclassConstructor(info->function()->kind()) |
276 ? ArgumentsAccessStub::HAS_NEW_TARGET | 258 ? ArgumentsAccessStub::HAS_NEW_TARGET |
277 : ArgumentsAccessStub::NO_NEW_TARGET; | 259 : ArgumentsAccessStub::NO_NEW_TARGET; |
278 | 260 |
(...skipping 1719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1998 case NAMED_PROPERTY: | 1980 case NAMED_PROPERTY: |
1999 if (expr->is_compound()) { | 1981 if (expr->is_compound()) { |
2000 // We need the receiver both on the stack and in the register. | 1982 // We need the receiver both on the stack and in the register. |
2001 VisitForStackValue(property->obj()); | 1983 VisitForStackValue(property->obj()); |
2002 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1984 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
2003 } else { | 1985 } else { |
2004 VisitForStackValue(property->obj()); | 1986 VisitForStackValue(property->obj()); |
2005 } | 1987 } |
2006 break; | 1988 break; |
2007 case NAMED_SUPER_PROPERTY: | 1989 case NAMED_SUPER_PROPERTY: |
2008 VisitForStackValue( | 1990 VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
2009 property->obj()->AsSuperPropertyReference()->this_var()); | |
2010 VisitForAccumulatorValue( | 1991 VisitForAccumulatorValue( |
2011 property->obj()->AsSuperPropertyReference()->home_object_var()); | 1992 property->obj()->AsSuperReference()->home_object_var()); |
2012 __ Push(result_register()); | 1993 __ Push(result_register()); |
2013 if (expr->is_compound()) { | 1994 if (expr->is_compound()) { |
2014 const Register scratch = a1; | 1995 const Register scratch = a1; |
2015 __ ld(scratch, MemOperand(sp, kPointerSize)); | 1996 __ ld(scratch, MemOperand(sp, kPointerSize)); |
2016 __ Push(scratch, result_register()); | 1997 __ Push(scratch, result_register()); |
2017 } | 1998 } |
2018 break; | 1999 break; |
2019 case KEYED_SUPER_PROPERTY: { | 2000 case KEYED_SUPER_PROPERTY: { |
2020 const Register scratch = a1; | 2001 const Register scratch = a1; |
2021 VisitForStackValue( | 2002 VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
2022 property->obj()->AsSuperPropertyReference()->this_var()); | |
2023 VisitForAccumulatorValue( | 2003 VisitForAccumulatorValue( |
2024 property->obj()->AsSuperPropertyReference()->home_object_var()); | 2004 property->obj()->AsSuperReference()->home_object_var()); |
2025 __ Move(scratch, result_register()); | 2005 __ Move(scratch, result_register()); |
2026 VisitForAccumulatorValue(property->key()); | 2006 VisitForAccumulatorValue(property->key()); |
2027 __ Push(scratch, result_register()); | 2007 __ Push(scratch, result_register()); |
2028 if (expr->is_compound()) { | 2008 if (expr->is_compound()) { |
2029 const Register scratch1 = a4; | 2009 const Register scratch1 = a4; |
2030 __ ld(scratch1, MemOperand(sp, 2 * kPointerSize)); | 2010 __ ld(scratch1, MemOperand(sp, 2 * kPointerSize)); |
2031 __ Push(scratch1, scratch, result_register()); | 2011 __ Push(scratch1, scratch, result_register()); |
2032 } | 2012 } |
2033 break; | 2013 break; |
2034 } | 2014 } |
(...skipping 613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2648 __ mov(StoreDescriptor::ReceiverRegister(), result_register()); | 2628 __ mov(StoreDescriptor::ReceiverRegister(), result_register()); |
2649 __ pop(StoreDescriptor::ValueRegister()); // Restore value. | 2629 __ pop(StoreDescriptor::ValueRegister()); // Restore value. |
2650 __ li(StoreDescriptor::NameRegister(), | 2630 __ li(StoreDescriptor::NameRegister(), |
2651 Operand(prop->key()->AsLiteral()->value())); | 2631 Operand(prop->key()->AsLiteral()->value())); |
2652 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2632 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2653 CallStoreIC(); | 2633 CallStoreIC(); |
2654 break; | 2634 break; |
2655 } | 2635 } |
2656 case NAMED_SUPER_PROPERTY: { | 2636 case NAMED_SUPER_PROPERTY: { |
2657 __ Push(v0); | 2637 __ Push(v0); |
2658 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 2638 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
2659 VisitForAccumulatorValue( | 2639 VisitForAccumulatorValue( |
2660 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 2640 prop->obj()->AsSuperReference()->home_object_var()); |
2661 // stack: value, this; v0: home_object | 2641 // stack: value, this; v0: home_object |
2662 Register scratch = a2; | 2642 Register scratch = a2; |
2663 Register scratch2 = a3; | 2643 Register scratch2 = a3; |
2664 __ mov(scratch, result_register()); // home_object | 2644 __ mov(scratch, result_register()); // home_object |
2665 __ ld(v0, MemOperand(sp, kPointerSize)); // value | 2645 __ ld(v0, MemOperand(sp, kPointerSize)); // value |
2666 __ ld(scratch2, MemOperand(sp, 0)); // this | 2646 __ ld(scratch2, MemOperand(sp, 0)); // this |
2667 __ sd(scratch2, MemOperand(sp, kPointerSize)); // this | 2647 __ sd(scratch2, MemOperand(sp, kPointerSize)); // this |
2668 __ sd(scratch, MemOperand(sp, 0)); // home_object | 2648 __ sd(scratch, MemOperand(sp, 0)); // home_object |
2669 // stack: this, home_object; v0: value | 2649 // stack: this, home_object; v0: value |
2670 EmitNamedSuperPropertyStore(prop); | 2650 EmitNamedSuperPropertyStore(prop); |
2671 break; | 2651 break; |
2672 } | 2652 } |
2673 case KEYED_SUPER_PROPERTY: { | 2653 case KEYED_SUPER_PROPERTY: { |
2674 __ Push(v0); | 2654 __ Push(v0); |
2675 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 2655 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
2676 VisitForStackValue( | 2656 VisitForStackValue(prop->obj()->AsSuperReference()->home_object_var()); |
2677 prop->obj()->AsSuperPropertyReference()->home_object_var()); | |
2678 VisitForAccumulatorValue(prop->key()); | 2657 VisitForAccumulatorValue(prop->key()); |
2679 Register scratch = a2; | 2658 Register scratch = a2; |
2680 Register scratch2 = a3; | 2659 Register scratch2 = a3; |
2681 __ ld(scratch2, MemOperand(sp, 2 * kPointerSize)); // value | 2660 __ ld(scratch2, MemOperand(sp, 2 * kPointerSize)); // value |
2682 // stack: value, this, home_object; v0: key, a3: value | 2661 // stack: value, this, home_object; v0: key, a3: value |
2683 __ ld(scratch, MemOperand(sp, kPointerSize)); // this | 2662 __ ld(scratch, MemOperand(sp, kPointerSize)); // this |
2684 __ sd(scratch, MemOperand(sp, 2 * kPointerSize)); | 2663 __ sd(scratch, MemOperand(sp, 2 * kPointerSize)); |
2685 __ ld(scratch, MemOperand(sp, 0)); // home_object | 2664 __ ld(scratch, MemOperand(sp, 0)); // home_object |
2686 __ sd(scratch, MemOperand(sp, kPointerSize)); | 2665 __ sd(scratch, MemOperand(sp, kPointerSize)); |
2687 __ sd(v0, MemOperand(sp, 0)); | 2666 __ sd(v0, MemOperand(sp, 0)); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2900 void FullCodeGenerator::VisitProperty(Property* expr) { | 2879 void FullCodeGenerator::VisitProperty(Property* expr) { |
2901 Comment cmnt(masm_, "[ Property"); | 2880 Comment cmnt(masm_, "[ Property"); |
2902 Expression* key = expr->key(); | 2881 Expression* key = expr->key(); |
2903 | 2882 |
2904 if (key->IsPropertyName()) { | 2883 if (key->IsPropertyName()) { |
2905 if (!expr->IsSuperAccess()) { | 2884 if (!expr->IsSuperAccess()) { |
2906 VisitForAccumulatorValue(expr->obj()); | 2885 VisitForAccumulatorValue(expr->obj()); |
2907 __ Move(LoadDescriptor::ReceiverRegister(), v0); | 2886 __ Move(LoadDescriptor::ReceiverRegister(), v0); |
2908 EmitNamedPropertyLoad(expr); | 2887 EmitNamedPropertyLoad(expr); |
2909 } else { | 2888 } else { |
2910 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2889 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
2911 VisitForStackValue( | 2890 VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); |
2912 expr->obj()->AsSuperPropertyReference()->home_object_var()); | |
2913 EmitNamedSuperPropertyLoad(expr); | 2891 EmitNamedSuperPropertyLoad(expr); |
2914 } | 2892 } |
2915 } else { | 2893 } else { |
2916 if (!expr->IsSuperAccess()) { | 2894 if (!expr->IsSuperAccess()) { |
2917 VisitForStackValue(expr->obj()); | 2895 VisitForStackValue(expr->obj()); |
2918 VisitForAccumulatorValue(expr->key()); | 2896 VisitForAccumulatorValue(expr->key()); |
2919 __ Move(LoadDescriptor::NameRegister(), v0); | 2897 __ Move(LoadDescriptor::NameRegister(), v0); |
2920 __ pop(LoadDescriptor::ReceiverRegister()); | 2898 __ pop(LoadDescriptor::ReceiverRegister()); |
2921 EmitKeyedPropertyLoad(expr); | 2899 EmitKeyedPropertyLoad(expr); |
2922 } else { | 2900 } else { |
2923 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2901 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
2924 VisitForStackValue( | 2902 VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); |
2925 expr->obj()->AsSuperPropertyReference()->home_object_var()); | |
2926 VisitForStackValue(expr->key()); | 2903 VisitForStackValue(expr->key()); |
2927 EmitKeyedSuperPropertyLoad(expr); | 2904 EmitKeyedSuperPropertyLoad(expr); |
2928 } | 2905 } |
2929 } | 2906 } |
2930 PrepareForBailoutForId(expr->LoadId(), TOS_REG); | 2907 PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
2931 context()->Plug(v0); | 2908 context()->Plug(v0); |
2932 } | 2909 } |
2933 | 2910 |
2934 | 2911 |
2935 void FullCodeGenerator::CallIC(Handle<Code> code, | 2912 void FullCodeGenerator::CallIC(Handle<Code> code, |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2977 Expression* callee = expr->expression(); | 2954 Expression* callee = expr->expression(); |
2978 DCHECK(callee->IsProperty()); | 2955 DCHECK(callee->IsProperty()); |
2979 Property* prop = callee->AsProperty(); | 2956 Property* prop = callee->AsProperty(); |
2980 DCHECK(prop->IsSuperAccess()); | 2957 DCHECK(prop->IsSuperAccess()); |
2981 | 2958 |
2982 SetSourcePosition(prop->position()); | 2959 SetSourcePosition(prop->position()); |
2983 Literal* key = prop->key()->AsLiteral(); | 2960 Literal* key = prop->key()->AsLiteral(); |
2984 DCHECK(!key->value()->IsSmi()); | 2961 DCHECK(!key->value()->IsSmi()); |
2985 // Load the function from the receiver. | 2962 // Load the function from the receiver. |
2986 const Register scratch = a1; | 2963 const Register scratch = a1; |
2987 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2964 SuperReference* super_ref = prop->obj()->AsSuperReference(); |
2988 VisitForAccumulatorValue(super_ref->home_object_var()); | 2965 VisitForAccumulatorValue(super_ref->home_object_var()); |
2989 __ mov(scratch, v0); | 2966 __ mov(scratch, v0); |
2990 VisitForAccumulatorValue(super_ref->this_var()); | 2967 VisitForAccumulatorValue(super_ref->this_var()); |
2991 __ Push(scratch, v0, v0, scratch); | 2968 __ Push(scratch, v0, v0, scratch); |
2992 __ Push(key->value()); | 2969 __ Push(key->value()); |
2993 | 2970 |
2994 // Stack here: | 2971 // Stack here: |
2995 // - home_object | 2972 // - home_object |
2996 // - this (receiver) | 2973 // - this (receiver) |
2997 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2974 // - this (receiver) <-- LoadFromSuper will pop here and below. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3035 | 3012 |
3036 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 3013 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
3037 Expression* callee = expr->expression(); | 3014 Expression* callee = expr->expression(); |
3038 DCHECK(callee->IsProperty()); | 3015 DCHECK(callee->IsProperty()); |
3039 Property* prop = callee->AsProperty(); | 3016 Property* prop = callee->AsProperty(); |
3040 DCHECK(prop->IsSuperAccess()); | 3017 DCHECK(prop->IsSuperAccess()); |
3041 | 3018 |
3042 SetSourcePosition(prop->position()); | 3019 SetSourcePosition(prop->position()); |
3043 // Load the function from the receiver. | 3020 // Load the function from the receiver. |
3044 const Register scratch = a1; | 3021 const Register scratch = a1; |
3045 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 3022 SuperReference* super_ref = prop->obj()->AsSuperReference(); |
3046 VisitForAccumulatorValue(super_ref->home_object_var()); | 3023 VisitForAccumulatorValue(super_ref->home_object_var()); |
3047 __ Move(scratch, v0); | 3024 __ Move(scratch, v0); |
3048 VisitForAccumulatorValue(super_ref->this_var()); | 3025 VisitForAccumulatorValue(super_ref->this_var()); |
3049 __ Push(scratch, v0, v0, scratch); | 3026 __ Push(scratch, v0, v0, scratch); |
3050 VisitForStackValue(prop->key()); | 3027 VisitForStackValue(prop->key()); |
3051 | 3028 |
3052 // Stack here: | 3029 // Stack here: |
3053 // - home_object | 3030 // - home_object |
3054 // - this (receiver) | 3031 // - this (receiver) |
3055 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 3032 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3114 // a1: the start position of the scope the calls resides in. | 3091 // a1: the start position of the scope the calls resides in. |
3115 __ li(a1, Operand(Smi::FromInt(scope()->start_position()))); | 3092 __ li(a1, Operand(Smi::FromInt(scope()->start_position()))); |
3116 | 3093 |
3117 // Do the runtime call. | 3094 // Do the runtime call. |
3118 __ Push(a7); | 3095 __ Push(a7); |
3119 __ Push(a6, a5, a4, a1); | 3096 __ Push(a6, a5, a4, a1); |
3120 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); | 3097 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); |
3121 } | 3098 } |
3122 | 3099 |
3123 | 3100 |
| 3101 void FullCodeGenerator::EmitLoadSuperConstructor() { |
| 3102 __ ld(a0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 3103 __ Push(a0); |
| 3104 __ CallRuntime(Runtime::kGetPrototype, 1); |
| 3105 } |
| 3106 |
| 3107 |
3124 void FullCodeGenerator::EmitInitializeThisAfterSuper( | 3108 void FullCodeGenerator::EmitInitializeThisAfterSuper( |
3125 SuperCallReference* super_ref, FeedbackVectorICSlot slot) { | 3109 SuperReference* super_ref, FeedbackVectorICSlot slot) { |
3126 Variable* this_var = super_ref->this_var()->var(); | 3110 Variable* this_var = super_ref->this_var()->var(); |
3127 GetVar(a1, this_var); | 3111 GetVar(a1, this_var); |
3128 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); | 3112 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); |
3129 Label uninitialized_this; | 3113 Label uninitialized_this; |
3130 __ Branch(&uninitialized_this, eq, a1, Operand(at)); | 3114 __ Branch(&uninitialized_this, eq, a1, Operand(at)); |
3131 __ li(a0, Operand(this_var->name())); | 3115 __ li(a0, Operand(this_var->name())); |
3132 __ Push(a0); | 3116 __ Push(a0); |
3133 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 3117 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
3134 __ bind(&uninitialized_this); | 3118 __ bind(&uninitialized_this); |
3135 | 3119 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3273 | 3257 |
3274 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 3258 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
3275 Comment cmnt(masm_, "[ CallNew"); | 3259 Comment cmnt(masm_, "[ CallNew"); |
3276 // According to ECMA-262, section 11.2.2, page 44, the function | 3260 // According to ECMA-262, section 11.2.2, page 44, the function |
3277 // expression in new calls must be evaluated before the | 3261 // expression in new calls must be evaluated before the |
3278 // arguments. | 3262 // arguments. |
3279 | 3263 |
3280 // Push constructor on the stack. If it's not a function it's used as | 3264 // Push constructor on the stack. If it's not a function it's used as |
3281 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is | 3265 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is |
3282 // ignored. | 3266 // ignored. |
3283 DCHECK(!expr->expression()->IsSuperPropertyReference()); | 3267 DCHECK(!expr->expression()->IsSuperReference()); |
3284 VisitForStackValue(expr->expression()); | 3268 VisitForStackValue(expr->expression()); |
3285 | 3269 |
3286 // Push the arguments ("left-to-right") on the stack. | 3270 // Push the arguments ("left-to-right") on the stack. |
3287 ZoneList<Expression*>* args = expr->arguments(); | 3271 ZoneList<Expression*>* args = expr->arguments(); |
3288 int arg_count = args->length(); | 3272 int arg_count = args->length(); |
3289 for (int i = 0; i < arg_count; i++) { | 3273 for (int i = 0; i < arg_count; i++) { |
3290 VisitForStackValue(args->at(i)); | 3274 VisitForStackValue(args->at(i)); |
3291 } | 3275 } |
3292 | 3276 |
3293 // Call the construct call builtin that handles allocation and | 3277 // Call the construct call builtin that handles allocation and |
(...skipping 15 matching lines...) Expand all Loading... |
3309 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); | 3293 __ li(a3, Operand(SmiFromSlot(expr->CallNewFeedbackSlot()))); |
3310 | 3294 |
3311 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3295 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
3312 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3296 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3313 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3297 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
3314 context()->Plug(v0); | 3298 context()->Plug(v0); |
3315 } | 3299 } |
3316 | 3300 |
3317 | 3301 |
3318 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 3302 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
3319 SuperCallReference* super_call_ref = | 3303 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); |
3320 expr->expression()->AsSuperCallReference(); | 3304 GetVar(result_register(), new_target_var); |
3321 DCHECK_NOT_NULL(super_call_ref); | 3305 __ Push(result_register()); |
3322 | 3306 |
3323 VariableProxy* new_target_proxy = super_call_ref->new_target_var(); | 3307 EmitLoadSuperConstructor(); |
3324 VisitForStackValue(new_target_proxy); | |
3325 | |
3326 EmitLoadSuperConstructor(super_call_ref); | |
3327 __ push(result_register()); | 3308 __ push(result_register()); |
3328 | 3309 |
3329 // Push the arguments ("left-to-right") on the stack. | 3310 // Push the arguments ("left-to-right") on the stack. |
3330 ZoneList<Expression*>* args = expr->arguments(); | 3311 ZoneList<Expression*>* args = expr->arguments(); |
3331 int arg_count = args->length(); | 3312 int arg_count = args->length(); |
3332 for (int i = 0; i < arg_count; i++) { | 3313 for (int i = 0; i < arg_count; i++) { |
3333 VisitForStackValue(args->at(i)); | 3314 VisitForStackValue(args->at(i)); |
3334 } | 3315 } |
3335 | 3316 |
3336 // Call the construct call builtin that handles allocation and | 3317 // Call the construct call builtin that handles allocation and |
(...skipping 17 matching lines...) Expand all Loading... |
3354 __ li(a2, FeedbackVector()); | 3335 __ li(a2, FeedbackVector()); |
3355 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); | 3336 __ li(a3, Operand(SmiFromSlot(expr->CallFeedbackSlot()))); |
3356 | 3337 |
3357 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); | 3338 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); |
3358 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3339 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3359 | 3340 |
3360 __ Drop(1); | 3341 __ Drop(1); |
3361 | 3342 |
3362 RecordJSReturnSite(expr); | 3343 RecordJSReturnSite(expr); |
3363 | 3344 |
3364 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); | 3345 EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference(), |
| 3346 expr->CallFeedbackICSlot()); |
3365 context()->Plug(v0); | 3347 context()->Plug(v0); |
3366 } | 3348 } |
3367 | 3349 |
3368 | 3350 |
3369 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3351 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
3370 ZoneList<Expression*>* args = expr->arguments(); | 3352 ZoneList<Expression*>* args = expr->arguments(); |
3371 DCHECK(args->length() == 1); | 3353 DCHECK(args->length() == 1); |
3372 | 3354 |
3373 VisitForAccumulatorValue(args->at(0)); | 3355 VisitForAccumulatorValue(args->at(0)); |
3374 | 3356 |
(...skipping 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4242 __ bind(&runtime); | 4224 __ bind(&runtime); |
4243 __ push(v0); | 4225 __ push(v0); |
4244 __ CallRuntime(Runtime::kCall, args->length()); | 4226 __ CallRuntime(Runtime::kCall, args->length()); |
4245 __ bind(&done); | 4227 __ bind(&done); |
4246 | 4228 |
4247 context()->Plug(v0); | 4229 context()->Plug(v0); |
4248 } | 4230 } |
4249 | 4231 |
4250 | 4232 |
4251 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 4233 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
4252 ZoneList<Expression*>* args = expr->arguments(); | 4234 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); |
4253 DCHECK(args->length() == 2); | 4235 GetVar(result_register(), new_target_var); |
| 4236 __ Push(result_register()); |
4254 | 4237 |
4255 // new.target | 4238 EmitLoadSuperConstructor(); |
4256 VisitForStackValue(args->at(0)); | |
4257 | |
4258 // .this_function | |
4259 VisitForStackValue(args->at(1)); | |
4260 __ CallRuntime(Runtime::kGetPrototype, 1); | |
4261 __ Push(result_register()); | 4239 __ Push(result_register()); |
4262 | 4240 |
4263 // Check if the calling frame is an arguments adaptor frame. | 4241 // Check if the calling frame is an arguments adaptor frame. |
4264 Label adaptor_frame, args_set_up, runtime; | 4242 Label adaptor_frame, args_set_up, runtime; |
4265 __ ld(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 4243 __ ld(a2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
4266 __ ld(a3, MemOperand(a2, StandardFrameConstants::kContextOffset)); | 4244 __ ld(a3, MemOperand(a2, StandardFrameConstants::kContextOffset)); |
4267 __ Branch(&adaptor_frame, eq, a3, | 4245 __ Branch(&adaptor_frame, eq, a3, |
4268 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 4246 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
4269 // default constructor has no arguments, so no adaptor frame means no args. | 4247 // default constructor has no arguments, so no adaptor frame means no args. |
4270 __ mov(a0, zero_reg); | 4248 __ mov(a0, zero_reg); |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4652 ExternalReference::debug_is_active_address(isolate()); | 4630 ExternalReference::debug_is_active_address(isolate()); |
4653 __ li(at, Operand(debug_is_active)); | 4631 __ li(at, Operand(debug_is_active)); |
4654 __ lbu(v0, MemOperand(at)); | 4632 __ lbu(v0, MemOperand(at)); |
4655 __ SmiTag(v0); | 4633 __ SmiTag(v0); |
4656 context()->Plug(v0); | 4634 context()->Plug(v0); |
4657 } | 4635 } |
4658 | 4636 |
4659 | 4637 |
4660 void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) { | 4638 void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) { |
4661 // Assert: expr === CallRuntime("ReflectConstruct") | 4639 // Assert: expr === CallRuntime("ReflectConstruct") |
4662 DCHECK_EQ(1, expr->arguments()->length()); | |
4663 CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime(); | 4640 CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime(); |
4664 | |
4665 ZoneList<Expression*>* args = call->arguments(); | 4641 ZoneList<Expression*>* args = call->arguments(); |
4666 DCHECK_EQ(3, args->length()); | 4642 DCHECK_EQ(3, args->length()); |
4667 | 4643 |
4668 SuperCallReference* super_call_ref = args->at(0)->AsSuperCallReference(); | 4644 SuperReference* super_reference = args->at(0)->AsSuperReference(); |
4669 DCHECK_NOT_NULL(super_call_ref); | |
4670 | 4645 |
4671 // Load ReflectConstruct function | 4646 // Load ReflectConstruct function |
4672 EmitLoadJSRuntimeFunction(call); | 4647 EmitLoadJSRuntimeFunction(call); |
4673 | 4648 |
4674 // Push the target function under the receiver. | 4649 // Push the target function under the receiver. |
4675 __ ld(at, MemOperand(sp, 0)); | 4650 __ ld(at, MemOperand(sp, 0)); |
4676 __ push(at); | 4651 __ push(at); |
4677 __ sd(v0, MemOperand(sp, kPointerSize)); | 4652 __ sd(v0, MemOperand(sp, kPointerSize)); |
4678 | 4653 |
4679 // Push super constructor | 4654 // Push super |
4680 EmitLoadSuperConstructor(super_call_ref); | 4655 EmitLoadSuperConstructor(); |
4681 __ Push(result_register()); | 4656 __ Push(result_register()); |
4682 | 4657 |
4683 // Push arguments array | 4658 // Push arguments array |
4684 VisitForStackValue(args->at(1)); | 4659 VisitForStackValue(args->at(1)); |
4685 | 4660 |
4686 // Push NewTarget | 4661 // Push NewTarget |
4687 DCHECK(args->at(2)->IsVariableProxy()); | 4662 DCHECK(args->at(2)->IsVariableProxy()); |
4688 VisitForStackValue(args->at(2)); | 4663 VisitForStackValue(args->at(2)); |
4689 | 4664 |
4690 EmitCallJSRuntimeFunction(call); | 4665 EmitCallJSRuntimeFunction(call); |
4691 | 4666 |
4692 // Restore context register. | 4667 // Restore context register. |
4693 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4668 __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4694 context()->DropAndPlug(1, v0); | 4669 context()->DropAndPlug(1, v0); |
4695 | 4670 |
4696 // TODO(mvstanton): with FLAG_vector_stores this needs a slot id. | 4671 // TODO(mvstanton): with FLAG_vector_stores this needs a slot id. |
4697 EmitInitializeThisAfterSuper(super_call_ref); | 4672 EmitInitializeThisAfterSuper(super_reference); |
4698 } | 4673 } |
4699 | 4674 |
4700 | 4675 |
4701 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4676 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
4702 // Push the builtins object as the receiver. | 4677 // Push the builtins object as the receiver. |
4703 Register receiver = LoadDescriptor::ReceiverRegister(); | 4678 Register receiver = LoadDescriptor::ReceiverRegister(); |
4704 __ ld(receiver, GlobalObjectOperand()); | 4679 __ ld(receiver, GlobalObjectOperand()); |
4705 __ ld(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); | 4680 __ ld(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); |
4706 __ push(receiver); | 4681 __ push(receiver); |
4707 | 4682 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4911 switch (assign_type) { | 4886 switch (assign_type) { |
4912 case NAMED_PROPERTY: { | 4887 case NAMED_PROPERTY: { |
4913 // Put the object both on the stack and in the register. | 4888 // Put the object both on the stack and in the register. |
4914 VisitForStackValue(prop->obj()); | 4889 VisitForStackValue(prop->obj()); |
4915 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 4890 __ ld(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
4916 EmitNamedPropertyLoad(prop); | 4891 EmitNamedPropertyLoad(prop); |
4917 break; | 4892 break; |
4918 } | 4893 } |
4919 | 4894 |
4920 case NAMED_SUPER_PROPERTY: { | 4895 case NAMED_SUPER_PROPERTY: { |
4921 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 4896 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
4922 VisitForAccumulatorValue( | 4897 VisitForAccumulatorValue( |
4923 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 4898 prop->obj()->AsSuperReference()->home_object_var()); |
4924 __ Push(result_register()); | 4899 __ Push(result_register()); |
4925 const Register scratch = a1; | 4900 const Register scratch = a1; |
4926 __ ld(scratch, MemOperand(sp, kPointerSize)); | 4901 __ ld(scratch, MemOperand(sp, kPointerSize)); |
4927 __ Push(scratch, result_register()); | 4902 __ Push(scratch, result_register()); |
4928 EmitNamedSuperPropertyLoad(prop); | 4903 EmitNamedSuperPropertyLoad(prop); |
4929 break; | 4904 break; |
4930 } | 4905 } |
4931 | 4906 |
4932 case KEYED_SUPER_PROPERTY: { | 4907 case KEYED_SUPER_PROPERTY: { |
4933 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 4908 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
4934 VisitForAccumulatorValue( | 4909 VisitForAccumulatorValue( |
4935 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 4910 prop->obj()->AsSuperReference()->home_object_var()); |
4936 const Register scratch = a1; | 4911 const Register scratch = a1; |
4937 const Register scratch1 = a4; | 4912 const Register scratch1 = a4; |
4938 __ Move(scratch, result_register()); | 4913 __ Move(scratch, result_register()); |
4939 VisitForAccumulatorValue(prop->key()); | 4914 VisitForAccumulatorValue(prop->key()); |
4940 __ Push(scratch, result_register()); | 4915 __ Push(scratch, result_register()); |
4941 __ ld(scratch1, MemOperand(sp, 2 * kPointerSize)); | 4916 __ ld(scratch1, MemOperand(sp, 2 * kPointerSize)); |
4942 __ Push(scratch1, scratch, result_register()); | 4917 __ Push(scratch1, scratch, result_register()); |
4943 EmitKeyedSuperPropertyLoad(prop); | 4918 EmitKeyedSuperPropertyLoad(prop); |
4944 break; | 4919 break; |
4945 } | 4920 } |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5550 Assembler::target_address_at(pc_immediate_load_address)) == | 5525 Assembler::target_address_at(pc_immediate_load_address)) == |
5551 reinterpret_cast<uint64_t>( | 5526 reinterpret_cast<uint64_t>( |
5552 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5527 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5553 return OSR_AFTER_STACK_CHECK; | 5528 return OSR_AFTER_STACK_CHECK; |
5554 } | 5529 } |
5555 | 5530 |
5556 | 5531 |
5557 } } // namespace v8::internal | 5532 } } // namespace v8::internal |
5558 | 5533 |
5559 #endif // V8_TARGET_ARCH_MIPS64 | 5534 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |