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

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

Issue 1146403010: PPC: [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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 7 #if V8_TARGET_ARCH_PPC
8 8
9 #include "src/code-factory.h" 9 #include "src/code-factory.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 245 }
246 } 246 }
247 } 247 }
248 } 248 }
249 249
250 Variable* home_object_var = scope()->home_object_var(); 250 Variable* home_object_var = scope()->home_object_var();
251 if (home_object_var != nullptr) { 251 if (home_object_var != nullptr) {
252 __ Push(r4); 252 __ Push(r4);
253 } 253 }
254 254
255 // Possibly set up a local binding to the this function which is used in
256 // derived constructors with super calls.
257 Variable* this_function_var = scope()->this_function_var();
258 if (this_function_var != nullptr) {
259 Comment cmnt(masm_, "[ This function");
260 SetVar(this_function_var, r4, r3, r5);
261 }
262
263 Variable* new_target_var = scope()->new_target_var();
264 if (new_target_var != nullptr) {
265 Comment cmnt(masm_, "[ new.target");
266 // new.target is parameter -2.
267 int offset = 2 * kPointerSize +
268 (info_->scope()->num_parameters() + 1) * kPointerSize;
269 __ LoadP(r3, MemOperand(fp, offset));
270 SetVar(new_target_var, r3, r5, r6);
271 }
272
255 ArgumentsAccessStub::HasNewTarget has_new_target = 273 ArgumentsAccessStub::HasNewTarget has_new_target =
256 IsSubclassConstructor(info->function()->kind()) 274 IsSubclassConstructor(info->function()->kind())
257 ? ArgumentsAccessStub::HAS_NEW_TARGET 275 ? ArgumentsAccessStub::HAS_NEW_TARGET
258 : ArgumentsAccessStub::NO_NEW_TARGET; 276 : ArgumentsAccessStub::NO_NEW_TARGET;
259 277
260 // Possibly allocate RestParameters 278 // Possibly allocate RestParameters
261 int rest_index; 279 int rest_index;
262 Variable* rest_param = scope()->rest_parameter(&rest_index); 280 Variable* rest_param = scope()->rest_parameter(&rest_index);
263 if (rest_param) { 281 if (rest_param) {
264 Comment cmnt(masm_, "[ Allocate rest parameter array"); 282 Comment cmnt(masm_, "[ Allocate rest parameter array");
(...skipping 1684 matching lines...) Expand 10 before | Expand all | Expand 10 after
1949 case NAMED_PROPERTY: 1967 case NAMED_PROPERTY:
1950 if (expr->is_compound()) { 1968 if (expr->is_compound()) {
1951 // We need the receiver both on the stack and in the register. 1969 // We need the receiver both on the stack and in the register.
1952 VisitForStackValue(property->obj()); 1970 VisitForStackValue(property->obj());
1953 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 1971 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
1954 } else { 1972 } else {
1955 VisitForStackValue(property->obj()); 1973 VisitForStackValue(property->obj());
1956 } 1974 }
1957 break; 1975 break;
1958 case NAMED_SUPER_PROPERTY: 1976 case NAMED_SUPER_PROPERTY:
1959 VisitForStackValue(property->obj()->AsSuperReference()->this_var()); 1977 VisitForStackValue(
1978 property->obj()->AsSuperPropertyReference()->this_var());
1960 VisitForAccumulatorValue( 1979 VisitForAccumulatorValue(
1961 property->obj()->AsSuperReference()->home_object_var()); 1980 property->obj()->AsSuperPropertyReference()->home_object_var());
1962 __ Push(result_register()); 1981 __ Push(result_register());
1963 if (expr->is_compound()) { 1982 if (expr->is_compound()) {
1964 const Register scratch = r4; 1983 const Register scratch = r4;
1965 __ LoadP(scratch, MemOperand(sp, kPointerSize)); 1984 __ LoadP(scratch, MemOperand(sp, kPointerSize));
1966 __ Push(scratch, result_register()); 1985 __ Push(scratch, result_register());
1967 } 1986 }
1968 break; 1987 break;
1969 case KEYED_SUPER_PROPERTY: { 1988 case KEYED_SUPER_PROPERTY: {
1970 const Register scratch = r4; 1989 const Register scratch = r4;
1971 VisitForStackValue(property->obj()->AsSuperReference()->this_var()); 1990 VisitForStackValue(
1991 property->obj()->AsSuperPropertyReference()->this_var());
1972 VisitForAccumulatorValue( 1992 VisitForAccumulatorValue(
1973 property->obj()->AsSuperReference()->home_object_var()); 1993 property->obj()->AsSuperPropertyReference()->home_object_var());
1974 __ mr(scratch, result_register()); 1994 __ mr(scratch, result_register());
1975 VisitForAccumulatorValue(property->key()); 1995 VisitForAccumulatorValue(property->key());
1976 __ Push(scratch, result_register()); 1996 __ Push(scratch, result_register());
1977 if (expr->is_compound()) { 1997 if (expr->is_compound()) {
1978 const Register scratch1 = r5; 1998 const Register scratch1 = r5;
1979 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize)); 1999 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize));
1980 __ Push(scratch1, scratch, result_register()); 2000 __ Push(scratch1, scratch, result_register());
1981 } 2001 }
1982 break; 2002 break;
1983 } 2003 }
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
2646 __ Move(StoreDescriptor::ReceiverRegister(), r3); 2666 __ Move(StoreDescriptor::ReceiverRegister(), r3);
2647 __ pop(StoreDescriptor::ValueRegister()); // Restore value. 2667 __ pop(StoreDescriptor::ValueRegister()); // Restore value.
2648 __ mov(StoreDescriptor::NameRegister(), 2668 __ mov(StoreDescriptor::NameRegister(),
2649 Operand(prop->key()->AsLiteral()->value())); 2669 Operand(prop->key()->AsLiteral()->value()));
2650 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2670 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2651 CallStoreIC(); 2671 CallStoreIC();
2652 break; 2672 break;
2653 } 2673 }
2654 case NAMED_SUPER_PROPERTY: { 2674 case NAMED_SUPER_PROPERTY: {
2655 __ Push(r3); 2675 __ Push(r3);
2656 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); 2676 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
2657 VisitForAccumulatorValue( 2677 VisitForAccumulatorValue(
2658 prop->obj()->AsSuperReference()->home_object_var()); 2678 prop->obj()->AsSuperPropertyReference()->home_object_var());
2659 // stack: value, this; r3: home_object 2679 // stack: value, this; r3: home_object
2660 Register scratch = r5; 2680 Register scratch = r5;
2661 Register scratch2 = r6; 2681 Register scratch2 = r6;
2662 __ mr(scratch, result_register()); // home_object 2682 __ mr(scratch, result_register()); // home_object
2663 __ LoadP(r3, MemOperand(sp, kPointerSize)); // value 2683 __ LoadP(r3, MemOperand(sp, kPointerSize)); // value
2664 __ LoadP(scratch2, MemOperand(sp, 0)); // this 2684 __ LoadP(scratch2, MemOperand(sp, 0)); // this
2665 __ StoreP(scratch2, MemOperand(sp, kPointerSize)); // this 2685 __ StoreP(scratch2, MemOperand(sp, kPointerSize)); // this
2666 __ StoreP(scratch, MemOperand(sp, 0)); // home_object 2686 __ StoreP(scratch, MemOperand(sp, 0)); // home_object
2667 // stack: this, home_object; r3: value 2687 // stack: this, home_object; r3: value
2668 EmitNamedSuperPropertyStore(prop); 2688 EmitNamedSuperPropertyStore(prop);
2669 break; 2689 break;
2670 } 2690 }
2671 case KEYED_SUPER_PROPERTY: { 2691 case KEYED_SUPER_PROPERTY: {
2672 __ Push(r3); 2692 __ Push(r3);
2673 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); 2693 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
2674 VisitForStackValue(prop->obj()->AsSuperReference()->home_object_var()); 2694 VisitForStackValue(
2695 prop->obj()->AsSuperPropertyReference()->home_object_var());
2675 VisitForAccumulatorValue(prop->key()); 2696 VisitForAccumulatorValue(prop->key());
2676 Register scratch = r5; 2697 Register scratch = r5;
2677 Register scratch2 = r6; 2698 Register scratch2 = r6;
2678 __ LoadP(scratch2, MemOperand(sp, 2 * kPointerSize)); // value 2699 __ LoadP(scratch2, MemOperand(sp, 2 * kPointerSize)); // value
2679 // stack: value, this, home_object; r3: key, r6: value 2700 // stack: value, this, home_object; r3: key, r6: value
2680 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // this 2701 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // this
2681 __ StoreP(scratch, MemOperand(sp, 2 * kPointerSize)); 2702 __ StoreP(scratch, MemOperand(sp, 2 * kPointerSize));
2682 __ LoadP(scratch, MemOperand(sp, 0)); // home_object 2703 __ LoadP(scratch, MemOperand(sp, 0)); // home_object
2683 __ StoreP(scratch, MemOperand(sp, kPointerSize)); 2704 __ StoreP(scratch, MemOperand(sp, kPointerSize));
2684 __ StoreP(r3, MemOperand(sp, 0)); 2705 __ StoreP(r3, MemOperand(sp, 0));
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
2887 void FullCodeGenerator::VisitProperty(Property* expr) { 2908 void FullCodeGenerator::VisitProperty(Property* expr) {
2888 Comment cmnt(masm_, "[ Property"); 2909 Comment cmnt(masm_, "[ Property");
2889 Expression* key = expr->key(); 2910 Expression* key = expr->key();
2890 2911
2891 if (key->IsPropertyName()) { 2912 if (key->IsPropertyName()) {
2892 if (!expr->IsSuperAccess()) { 2913 if (!expr->IsSuperAccess()) {
2893 VisitForAccumulatorValue(expr->obj()); 2914 VisitForAccumulatorValue(expr->obj());
2894 __ Move(LoadDescriptor::ReceiverRegister(), r3); 2915 __ Move(LoadDescriptor::ReceiverRegister(), r3);
2895 EmitNamedPropertyLoad(expr); 2916 EmitNamedPropertyLoad(expr);
2896 } else { 2917 } else {
2897 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); 2918 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var());
2898 VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); 2919 VisitForStackValue(
2920 expr->obj()->AsSuperPropertyReference()->home_object_var());
2899 EmitNamedSuperPropertyLoad(expr); 2921 EmitNamedSuperPropertyLoad(expr);
2900 } 2922 }
2901 } else { 2923 } else {
2902 if (!expr->IsSuperAccess()) { 2924 if (!expr->IsSuperAccess()) {
2903 VisitForStackValue(expr->obj()); 2925 VisitForStackValue(expr->obj());
2904 VisitForAccumulatorValue(expr->key()); 2926 VisitForAccumulatorValue(expr->key());
2905 __ Move(LoadDescriptor::NameRegister(), r3); 2927 __ Move(LoadDescriptor::NameRegister(), r3);
2906 __ pop(LoadDescriptor::ReceiverRegister()); 2928 __ pop(LoadDescriptor::ReceiverRegister());
2907 EmitKeyedPropertyLoad(expr); 2929 EmitKeyedPropertyLoad(expr);
2908 } else { 2930 } else {
2909 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); 2931 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var());
2910 VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); 2932 VisitForStackValue(
2933 expr->obj()->AsSuperPropertyReference()->home_object_var());
2911 VisitForStackValue(expr->key()); 2934 VisitForStackValue(expr->key());
2912 EmitKeyedSuperPropertyLoad(expr); 2935 EmitKeyedSuperPropertyLoad(expr);
2913 } 2936 }
2914 } 2937 }
2915 PrepareForBailoutForId(expr->LoadId(), TOS_REG); 2938 PrepareForBailoutForId(expr->LoadId(), TOS_REG);
2916 context()->Plug(r3); 2939 context()->Plug(r3);
2917 } 2940 }
2918 2941
2919 2942
2920 void FullCodeGenerator::CallIC(Handle<Code> code, TypeFeedbackId ast_id) { 2943 void FullCodeGenerator::CallIC(Handle<Code> code, TypeFeedbackId ast_id) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
2962 Expression* callee = expr->expression(); 2985 Expression* callee = expr->expression();
2963 DCHECK(callee->IsProperty()); 2986 DCHECK(callee->IsProperty());
2964 Property* prop = callee->AsProperty(); 2987 Property* prop = callee->AsProperty();
2965 DCHECK(prop->IsSuperAccess()); 2988 DCHECK(prop->IsSuperAccess());
2966 2989
2967 SetSourcePosition(prop->position()); 2990 SetSourcePosition(prop->position());
2968 Literal* key = prop->key()->AsLiteral(); 2991 Literal* key = prop->key()->AsLiteral();
2969 DCHECK(!key->value()->IsSmi()); 2992 DCHECK(!key->value()->IsSmi());
2970 // Load the function from the receiver. 2993 // Load the function from the receiver.
2971 const Register scratch = r4; 2994 const Register scratch = r4;
2972 SuperReference* super_ref = prop->obj()->AsSuperReference(); 2995 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
2973 VisitForAccumulatorValue(super_ref->home_object_var()); 2996 VisitForAccumulatorValue(super_ref->home_object_var());
2974 __ mr(scratch, r3); 2997 __ mr(scratch, r3);
2975 VisitForAccumulatorValue(super_ref->this_var()); 2998 VisitForAccumulatorValue(super_ref->this_var());
2976 __ Push(scratch, r3, r3, scratch); 2999 __ Push(scratch, r3, r3, scratch);
2977 __ Push(key->value()); 3000 __ Push(key->value());
2978 3001
2979 // Stack here: 3002 // Stack here:
2980 // - home_object 3003 // - home_object
2981 // - this (receiver) 3004 // - this (receiver)
2982 // - this (receiver) <-- LoadFromSuper will pop here and below. 3005 // - this (receiver) <-- LoadFromSuper will pop here and below.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3019 3042
3020 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { 3043 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
3021 Expression* callee = expr->expression(); 3044 Expression* callee = expr->expression();
3022 DCHECK(callee->IsProperty()); 3045 DCHECK(callee->IsProperty());
3023 Property* prop = callee->AsProperty(); 3046 Property* prop = callee->AsProperty();
3024 DCHECK(prop->IsSuperAccess()); 3047 DCHECK(prop->IsSuperAccess());
3025 3048
3026 SetSourcePosition(prop->position()); 3049 SetSourcePosition(prop->position());
3027 // Load the function from the receiver. 3050 // Load the function from the receiver.
3028 const Register scratch = r4; 3051 const Register scratch = r4;
3029 SuperReference* super_ref = prop->obj()->AsSuperReference(); 3052 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
3030 VisitForAccumulatorValue(super_ref->home_object_var()); 3053 VisitForAccumulatorValue(super_ref->home_object_var());
3031 __ mr(scratch, r3); 3054 __ mr(scratch, r3);
3032 VisitForAccumulatorValue(super_ref->this_var()); 3055 VisitForAccumulatorValue(super_ref->this_var());
3033 __ Push(scratch, r3, r3, scratch); 3056 __ Push(scratch, r3, r3, scratch);
3034 VisitForStackValue(prop->key()); 3057 VisitForStackValue(prop->key());
3035 3058
3036 // Stack here: 3059 // Stack here:
3037 // - home_object 3060 // - home_object
3038 // - this (receiver) 3061 // - this (receiver)
3039 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. 3062 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
3099 3122
3100 // r4: the start position of the scope the calls resides in. 3123 // r4: the start position of the scope the calls resides in.
3101 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position())); 3124 __ LoadSmiLiteral(r4, Smi::FromInt(scope()->start_position()));
3102 3125
3103 // Do the runtime call. 3126 // Do the runtime call.
3104 __ Push(r8, r7, r6, r5, r4); 3127 __ Push(r8, r7, r6, r5, r4);
3105 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); 3128 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6);
3106 } 3129 }
3107 3130
3108 3131
3109 void FullCodeGenerator::EmitLoadSuperConstructor() {
3110 __ LoadP(r3, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
3111 __ Push(r3);
3112 __ CallRuntime(Runtime::kGetPrototype, 1);
3113 }
3114
3115
3116 void FullCodeGenerator::EmitInitializeThisAfterSuper( 3132 void FullCodeGenerator::EmitInitializeThisAfterSuper(
3117 SuperReference* super_ref, FeedbackVectorICSlot slot) { 3133 SuperCallReference* super_ref, FeedbackVectorICSlot slot) {
3118 Variable* this_var = super_ref->this_var()->var(); 3134 Variable* this_var = super_ref->this_var()->var();
3119 GetVar(r4, this_var); 3135 GetVar(r4, this_var);
3120 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex); 3136 __ CompareRoot(r4, Heap::kTheHoleValueRootIndex);
3121 Label uninitialized_this; 3137 Label uninitialized_this;
3122 __ beq(&uninitialized_this); 3138 __ beq(&uninitialized_this);
3123 __ mov(r4, Operand(this_var->name())); 3139 __ mov(r4, Operand(this_var->name()));
3124 __ push(r4); 3140 __ push(r4);
3125 __ CallRuntime(Runtime::kThrowReferenceError, 1); 3141 __ CallRuntime(Runtime::kThrowReferenceError, 1);
3126 __ bind(&uninitialized_this); 3142 __ bind(&uninitialized_this);
3127 3143
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
3270 3286
3271 void FullCodeGenerator::VisitCallNew(CallNew* expr) { 3287 void FullCodeGenerator::VisitCallNew(CallNew* expr) {
3272 Comment cmnt(masm_, "[ CallNew"); 3288 Comment cmnt(masm_, "[ CallNew");
3273 // According to ECMA-262, section 11.2.2, page 44, the function 3289 // According to ECMA-262, section 11.2.2, page 44, the function
3274 // expression in new calls must be evaluated before the 3290 // expression in new calls must be evaluated before the
3275 // arguments. 3291 // arguments.
3276 3292
3277 // Push constructor on the stack. If it's not a function it's used as 3293 // Push constructor on the stack. If it's not a function it's used as
3278 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is 3294 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is
3279 // ignored. 3295 // ignored.
3280 DCHECK(!expr->expression()->IsSuperReference()); 3296 DCHECK(!expr->expression()->IsSuperPropertyReference());
3281 VisitForStackValue(expr->expression()); 3297 VisitForStackValue(expr->expression());
3282 3298
3283 // Push the arguments ("left-to-right") on the stack. 3299 // Push the arguments ("left-to-right") on the stack.
3284 ZoneList<Expression*>* args = expr->arguments(); 3300 ZoneList<Expression*>* args = expr->arguments();
3285 int arg_count = args->length(); 3301 int arg_count = args->length();
3286 for (int i = 0; i < arg_count; i++) { 3302 for (int i = 0; i < arg_count; i++) {
3287 VisitForStackValue(args->at(i)); 3303 VisitForStackValue(args->at(i));
3288 } 3304 }
3289 3305
3290 // Call the construct call builtin that handles allocation and 3306 // Call the construct call builtin that handles allocation and
(...skipping 15 matching lines...) Expand all
3306 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallNewFeedbackSlot())); 3322 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallNewFeedbackSlot()));
3307 3323
3308 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); 3324 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
3309 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3325 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3310 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); 3326 PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
3311 context()->Plug(r3); 3327 context()->Plug(r3);
3312 } 3328 }
3313 3329
3314 3330
3315 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { 3331 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) {
3316 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); 3332 SuperCallReference* super_call_ref =
3317 GetVar(result_register(), new_target_var); 3333 expr->expression()->AsSuperCallReference();
3318 __ Push(result_register()); 3334 DCHECK_NOT_NULL(super_call_ref);
3319 3335
3320 EmitLoadSuperConstructor(); 3336 VariableProxy* new_target_proxy = super_call_ref->new_target_var();
3337 VisitForStackValue(new_target_proxy);
3338
3339 EmitLoadSuperConstructor(super_call_ref);
3321 __ push(result_register()); 3340 __ push(result_register());
3322 3341
3323 // Push the arguments ("left-to-right") on the stack. 3342 // Push the arguments ("left-to-right") on the stack.
3324 ZoneList<Expression*>* args = expr->arguments(); 3343 ZoneList<Expression*>* args = expr->arguments();
3325 int arg_count = args->length(); 3344 int arg_count = args->length();
3326 for (int i = 0; i < arg_count; i++) { 3345 for (int i = 0; i < arg_count; i++) {
3327 VisitForStackValue(args->at(i)); 3346 VisitForStackValue(args->at(i));
3328 } 3347 }
3329 3348
3330 // Call the construct call builtin that handles allocation and 3349 // Call the construct call builtin that handles allocation and
(...skipping 17 matching lines...) Expand all
3348 __ Move(r5, FeedbackVector()); 3367 __ Move(r5, FeedbackVector());
3349 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackSlot())); 3368 __ LoadSmiLiteral(r6, SmiFromSlot(expr->CallFeedbackSlot()));
3350 3369
3351 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); 3370 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET);
3352 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); 3371 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
3353 3372
3354 __ Drop(1); 3373 __ Drop(1);
3355 3374
3356 RecordJSReturnSite(expr); 3375 RecordJSReturnSite(expr);
3357 3376
3358 EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference(), 3377 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot());
3359 expr->CallFeedbackICSlot());
3360 context()->Plug(r3); 3378 context()->Plug(r3);
3361 } 3379 }
3362 3380
3363 3381
3364 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { 3382 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) {
3365 ZoneList<Expression*>* args = expr->arguments(); 3383 ZoneList<Expression*>* args = expr->arguments();
3366 DCHECK(args->length() == 1); 3384 DCHECK(args->length() == 1);
3367 3385
3368 VisitForAccumulatorValue(args->at(0)); 3386 VisitForAccumulatorValue(args->at(0));
3369 3387
(...skipping 849 matching lines...) Expand 10 before | Expand all | Expand 10 after
4219 __ bind(&runtime); 4237 __ bind(&runtime);
4220 __ push(r3); 4238 __ push(r3);
4221 __ CallRuntime(Runtime::kCall, args->length()); 4239 __ CallRuntime(Runtime::kCall, args->length());
4222 __ bind(&done); 4240 __ bind(&done);
4223 4241
4224 context()->Plug(r3); 4242 context()->Plug(r3);
4225 } 4243 }
4226 4244
4227 4245
4228 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { 4246 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) {
4229 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); 4247 ZoneList<Expression*>* args = expr->arguments();
4230 GetVar(result_register(), new_target_var); 4248 DCHECK(args->length() == 2);
4231 __ Push(result_register());
4232 4249
4233 EmitLoadSuperConstructor(); 4250 // new.target
4251 VisitForStackValue(args->at(0));
4252
4253 // .this_function
4254 VisitForStackValue(args->at(1));
4255 __ CallRuntime(Runtime::kGetPrototype, 1);
4234 __ mr(r4, result_register()); 4256 __ mr(r4, result_register());
4235 __ Push(r4); 4257 __ Push(r4);
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 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); 4261 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
4240 __ LoadP(r6, MemOperand(r5, StandardFrameConstants::kContextOffset)); 4262 __ LoadP(r6, MemOperand(r5, StandardFrameConstants::kContextOffset));
4241 __ CmpSmiLiteral(r6, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); 4263 __ CmpSmiLiteral(r6, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0);
4242 __ beq(&adaptor_frame); 4264 __ beq(&adaptor_frame);
4243 4265
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after
4637 ExternalReference::debug_is_active_address(isolate()); 4659 ExternalReference::debug_is_active_address(isolate());
4638 __ mov(ip, Operand(debug_is_active)); 4660 __ mov(ip, Operand(debug_is_active));
4639 __ lbz(r3, MemOperand(ip)); 4661 __ lbz(r3, MemOperand(ip));
4640 __ SmiTag(r3); 4662 __ SmiTag(r3);
4641 context()->Plug(r3); 4663 context()->Plug(r3);
4642 } 4664 }
4643 4665
4644 4666
4645 void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) { 4667 void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) {
4646 // Assert: expr === CallRuntime("ReflectConstruct") 4668 // Assert: expr === CallRuntime("ReflectConstruct")
4669 DCHECK_EQ(1, expr->arguments()->length());
4647 CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime(); 4670 CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime();
4671
4648 ZoneList<Expression*>* args = call->arguments(); 4672 ZoneList<Expression*>* args = call->arguments();
4649 DCHECK_EQ(3, args->length()); 4673 DCHECK_EQ(3, args->length());
4650 4674
4651 SuperReference* super_reference = args->at(0)->AsSuperReference(); 4675 SuperCallReference* super_call_ref = args->at(0)->AsSuperCallReference();
4676 DCHECK_NOT_NULL(super_call_ref);
4652 4677
4653 // Load ReflectConstruct function 4678 // Load ReflectConstruct function
4654 EmitLoadJSRuntimeFunction(call); 4679 EmitLoadJSRuntimeFunction(call);
4655 4680
4656 // Push the target function under the receiver. 4681 // Push the target function under the receiver.
4657 __ LoadP(r0, MemOperand(sp, 0)); 4682 __ LoadP(r0, MemOperand(sp, 0));
4658 __ push(r0); 4683 __ push(r0);
4659 __ StoreP(r3, MemOperand(sp, kPointerSize)); 4684 __ StoreP(r3, MemOperand(sp, kPointerSize));
4660 4685
4661 // Push super 4686 // Push super constructor
4662 EmitLoadSuperConstructor(); 4687 EmitLoadSuperConstructor(super_call_ref);
4663 __ Push(result_register()); 4688 __ Push(result_register());
4664 4689
4665 // Push arguments array 4690 // Push arguments array
4666 VisitForStackValue(args->at(1)); 4691 VisitForStackValue(args->at(1));
4667 4692
4668 // Push NewTarget 4693 // Push NewTarget
4669 DCHECK(args->at(2)->IsVariableProxy()); 4694 DCHECK(args->at(2)->IsVariableProxy());
4670 VisitForStackValue(args->at(2)); 4695 VisitForStackValue(args->at(2));
4671 4696
4672 EmitCallJSRuntimeFunction(call); 4697 EmitCallJSRuntimeFunction(call);
4673 4698
4674 // Restore context register. 4699 // Restore context register.
4675 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 4700 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
4676 context()->DropAndPlug(1, r3); 4701 context()->DropAndPlug(1, r3);
4677 4702
4678 // TODO(mvstanton): with FLAG_vector_stores this needs a slot id. 4703 // TODO(mvstanton): with FLAG_vector_stores this needs a slot id.
4679 EmitInitializeThisAfterSuper(super_reference); 4704 EmitInitializeThisAfterSuper(super_call_ref);
4680 } 4705 }
4681 4706
4682 4707
4683 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 4708 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
4684 // Push the builtins object as the receiver. 4709 // Push the builtins object as the receiver.
4685 Register receiver = LoadDescriptor::ReceiverRegister(); 4710 Register receiver = LoadDescriptor::ReceiverRegister();
4686 __ LoadP(receiver, GlobalObjectOperand()); 4711 __ LoadP(receiver, GlobalObjectOperand());
4687 __ LoadP(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); 4712 __ LoadP(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset));
4688 __ push(receiver); 4713 __ push(receiver);
4689 4714
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
4890 switch (assign_type) { 4915 switch (assign_type) {
4891 case NAMED_PROPERTY: { 4916 case NAMED_PROPERTY: {
4892 // Put the object both on the stack and in the register. 4917 // Put the object both on the stack and in the register.
4893 VisitForStackValue(prop->obj()); 4918 VisitForStackValue(prop->obj());
4894 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 4919 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
4895 EmitNamedPropertyLoad(prop); 4920 EmitNamedPropertyLoad(prop);
4896 break; 4921 break;
4897 } 4922 }
4898 4923
4899 case NAMED_SUPER_PROPERTY: { 4924 case NAMED_SUPER_PROPERTY: {
4900 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); 4925 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
4901 VisitForAccumulatorValue( 4926 VisitForAccumulatorValue(
4902 prop->obj()->AsSuperReference()->home_object_var()); 4927 prop->obj()->AsSuperPropertyReference()->home_object_var());
4903 __ Push(result_register()); 4928 __ Push(result_register());
4904 const Register scratch = r4; 4929 const Register scratch = r4;
4905 __ LoadP(scratch, MemOperand(sp, kPointerSize)); 4930 __ LoadP(scratch, MemOperand(sp, kPointerSize));
4906 __ Push(scratch, result_register()); 4931 __ Push(scratch, result_register());
4907 EmitNamedSuperPropertyLoad(prop); 4932 EmitNamedSuperPropertyLoad(prop);
4908 break; 4933 break;
4909 } 4934 }
4910 4935
4911 case KEYED_SUPER_PROPERTY: { 4936 case KEYED_SUPER_PROPERTY: {
4912 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); 4937 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
4913 VisitForAccumulatorValue( 4938 VisitForAccumulatorValue(
4914 prop->obj()->AsSuperReference()->home_object_var()); 4939 prop->obj()->AsSuperPropertyReference()->home_object_var());
4915 const Register scratch = r4; 4940 const Register scratch = r4;
4916 const Register scratch1 = r5; 4941 const Register scratch1 = r5;
4917 __ mr(scratch, result_register()); 4942 __ mr(scratch, result_register());
4918 VisitForAccumulatorValue(prop->key()); 4943 VisitForAccumulatorValue(prop->key());
4919 __ Push(scratch, result_register()); 4944 __ Push(scratch, result_register());
4920 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize)); 4945 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize));
4921 __ Push(scratch1, scratch, result_register()); 4946 __ Push(scratch1, scratch, result_register());
4922 EmitKeyedSuperPropertyLoad(prop); 4947 EmitKeyedSuperPropertyLoad(prop);
4923 break; 4948 break;
4924 } 4949 }
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
5521 return ON_STACK_REPLACEMENT; 5546 return ON_STACK_REPLACEMENT;
5522 } 5547 }
5523 5548
5524 DCHECK(interrupt_address == 5549 DCHECK(interrupt_address ==
5525 isolate->builtins()->OsrAfterStackCheck()->entry()); 5550 isolate->builtins()->OsrAfterStackCheck()->entry());
5526 return OSR_AFTER_STACK_CHECK; 5551 return OSR_AFTER_STACK_CHECK;
5527 } 5552 }
5528 } // namespace internal 5553 } // namespace internal
5529 } // namespace v8 5554 } // namespace v8
5530 #endif // V8_TARGET_ARCH_PPC 5555 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698