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

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

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

Powered by Google App Engine
This is Rietveld 408576698