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

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

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