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

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

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

Powered by Google App Engine
This is Rietveld 408576698