OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 } else if (FLAG_debug_code) { | 236 } else if (FLAG_debug_code) { |
237 Label done; | 237 Label done; |
238 __ JumpIfInNewSpace(cp, &done); | 238 __ JumpIfInNewSpace(cp, &done); |
239 __ Abort(kExpectedNewSpaceObject); | 239 __ Abort(kExpectedNewSpaceObject); |
240 __ bind(&done); | 240 __ bind(&done); |
241 } | 241 } |
242 } | 242 } |
243 } | 243 } |
244 } | 244 } |
245 | 245 |
| 246 // Possibly set up a local binding to the this function which is used in |
| 247 // derived constructors with super calls. |
| 248 Variable* this_function_var = scope()->this_function_var(); |
| 249 if (this_function_var != nullptr) { |
| 250 Comment cmnt(masm_, "[ This function"); |
| 251 SetVar(this_function_var, x1, x0, x2); |
| 252 } |
| 253 |
| 254 Variable* new_target_var = scope()->new_target_var(); |
| 255 if (new_target_var != nullptr) { |
| 256 Comment cmnt(masm_, "[ new.target"); |
| 257 // new.target is parameter -2. |
| 258 int offset = |
| 259 2 * kXRegSize + (info_->scope()->num_parameters() + 1) * kPointerSize; |
| 260 __ Ldr(x0, MemOperand(fp, offset)); |
| 261 SetVar(new_target_var, x0, x2, x3); |
| 262 } |
| 263 |
246 Variable* home_object_var = scope()->home_object_var(); | 264 Variable* home_object_var = scope()->home_object_var(); |
247 if (home_object_var != nullptr) { | 265 if (home_object_var != nullptr) { |
248 __ Push(x1); | 266 __ Push(x1); |
249 } | 267 } |
250 | 268 |
251 ArgumentsAccessStub::HasNewTarget has_new_target = | 269 ArgumentsAccessStub::HasNewTarget has_new_target = |
252 IsSubclassConstructor(info->function()->kind()) | 270 IsSubclassConstructor(info->function()->kind()) |
253 ? ArgumentsAccessStub::HAS_NEW_TARGET | 271 ? ArgumentsAccessStub::HAS_NEW_TARGET |
254 : ArgumentsAccessStub::NO_NEW_TARGET; | 272 : ArgumentsAccessStub::NO_NEW_TARGET; |
255 | 273 |
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1962 case NAMED_PROPERTY: | 1980 case NAMED_PROPERTY: |
1963 if (expr->is_compound()) { | 1981 if (expr->is_compound()) { |
1964 // We need the receiver both on the stack and in the register. | 1982 // We need the receiver both on the stack and in the register. |
1965 VisitForStackValue(property->obj()); | 1983 VisitForStackValue(property->obj()); |
1966 __ Peek(LoadDescriptor::ReceiverRegister(), 0); | 1984 __ Peek(LoadDescriptor::ReceiverRegister(), 0); |
1967 } else { | 1985 } else { |
1968 VisitForStackValue(property->obj()); | 1986 VisitForStackValue(property->obj()); |
1969 } | 1987 } |
1970 break; | 1988 break; |
1971 case NAMED_SUPER_PROPERTY: | 1989 case NAMED_SUPER_PROPERTY: |
1972 VisitForStackValue(property->obj()->AsSuperReference()->this_var()); | 1990 VisitForStackValue( |
| 1991 property->obj()->AsSuperPropertyReference()->this_var()); |
1973 VisitForAccumulatorValue( | 1992 VisitForAccumulatorValue( |
1974 property->obj()->AsSuperReference()->home_object_var()); | 1993 property->obj()->AsSuperPropertyReference()->home_object_var()); |
1975 __ Push(result_register()); | 1994 __ Push(result_register()); |
1976 if (expr->is_compound()) { | 1995 if (expr->is_compound()) { |
1977 const Register scratch = x10; | 1996 const Register scratch = x10; |
1978 __ Peek(scratch, kPointerSize); | 1997 __ Peek(scratch, kPointerSize); |
1979 __ Push(scratch, result_register()); | 1998 __ Push(scratch, result_register()); |
1980 } | 1999 } |
1981 break; | 2000 break; |
1982 case KEYED_SUPER_PROPERTY: | 2001 case KEYED_SUPER_PROPERTY: |
1983 VisitForStackValue(property->obj()->AsSuperReference()->this_var()); | |
1984 VisitForStackValue( | 2002 VisitForStackValue( |
1985 property->obj()->AsSuperReference()->home_object_var()); | 2003 property->obj()->AsSuperPropertyReference()->this_var()); |
| 2004 VisitForStackValue( |
| 2005 property->obj()->AsSuperPropertyReference()->home_object_var()); |
1986 VisitForAccumulatorValue(property->key()); | 2006 VisitForAccumulatorValue(property->key()); |
1987 __ Push(result_register()); | 2007 __ Push(result_register()); |
1988 if (expr->is_compound()) { | 2008 if (expr->is_compound()) { |
1989 const Register scratch1 = x10; | 2009 const Register scratch1 = x10; |
1990 const Register scratch2 = x11; | 2010 const Register scratch2 = x11; |
1991 __ Peek(scratch1, 2 * kPointerSize); | 2011 __ Peek(scratch1, 2 * kPointerSize); |
1992 __ Peek(scratch2, kPointerSize); | 2012 __ Peek(scratch2, kPointerSize); |
1993 __ Push(scratch1, scratch2, result_register()); | 2013 __ Push(scratch1, scratch2, result_register()); |
1994 } | 2014 } |
1995 break; | 2015 break; |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2332 __ Mov(StoreDescriptor::ReceiverRegister(), x0); | 2352 __ Mov(StoreDescriptor::ReceiverRegister(), x0); |
2333 __ Pop(StoreDescriptor::ValueRegister()); // Restore value. | 2353 __ Pop(StoreDescriptor::ValueRegister()); // Restore value. |
2334 __ Mov(StoreDescriptor::NameRegister(), | 2354 __ Mov(StoreDescriptor::NameRegister(), |
2335 Operand(prop->key()->AsLiteral()->value())); | 2355 Operand(prop->key()->AsLiteral()->value())); |
2336 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2356 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2337 CallStoreIC(); | 2357 CallStoreIC(); |
2338 break; | 2358 break; |
2339 } | 2359 } |
2340 case NAMED_SUPER_PROPERTY: { | 2360 case NAMED_SUPER_PROPERTY: { |
2341 __ Push(x0); | 2361 __ Push(x0); |
2342 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | 2362 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
2343 VisitForAccumulatorValue( | 2363 VisitForAccumulatorValue( |
2344 prop->obj()->AsSuperReference()->home_object_var()); | 2364 prop->obj()->AsSuperPropertyReference()->home_object_var()); |
2345 // stack: value, this; x0: home_object | 2365 // stack: value, this; x0: home_object |
2346 Register scratch = x10; | 2366 Register scratch = x10; |
2347 Register scratch2 = x11; | 2367 Register scratch2 = x11; |
2348 __ mov(scratch, result_register()); // home_object | 2368 __ mov(scratch, result_register()); // home_object |
2349 __ Peek(x0, kPointerSize); // value | 2369 __ Peek(x0, kPointerSize); // value |
2350 __ Peek(scratch2, 0); // this | 2370 __ Peek(scratch2, 0); // this |
2351 __ Poke(scratch2, kPointerSize); // this | 2371 __ Poke(scratch2, kPointerSize); // this |
2352 __ Poke(scratch, 0); // home_object | 2372 __ Poke(scratch, 0); // home_object |
2353 // stack: this, home_object; x0: value | 2373 // stack: this, home_object; x0: value |
2354 EmitNamedSuperPropertyStore(prop); | 2374 EmitNamedSuperPropertyStore(prop); |
2355 break; | 2375 break; |
2356 } | 2376 } |
2357 case KEYED_SUPER_PROPERTY: { | 2377 case KEYED_SUPER_PROPERTY: { |
2358 __ Push(x0); | 2378 __ Push(x0); |
2359 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | 2379 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
2360 VisitForStackValue(prop->obj()->AsSuperReference()->home_object_var()); | 2380 VisitForStackValue( |
| 2381 prop->obj()->AsSuperPropertyReference()->home_object_var()); |
2361 VisitForAccumulatorValue(prop->key()); | 2382 VisitForAccumulatorValue(prop->key()); |
2362 Register scratch = x10; | 2383 Register scratch = x10; |
2363 Register scratch2 = x11; | 2384 Register scratch2 = x11; |
2364 __ Peek(scratch2, 2 * kPointerSize); // value | 2385 __ Peek(scratch2, 2 * kPointerSize); // value |
2365 // stack: value, this, home_object; x0: key, x11: value | 2386 // stack: value, this, home_object; x0: key, x11: value |
2366 __ Peek(scratch, kPointerSize); // this | 2387 __ Peek(scratch, kPointerSize); // this |
2367 __ Poke(scratch, 2 * kPointerSize); | 2388 __ Poke(scratch, 2 * kPointerSize); |
2368 __ Peek(scratch, 0); // home_object | 2389 __ Peek(scratch, 0); // home_object |
2369 __ Poke(scratch, kPointerSize); | 2390 __ Poke(scratch, kPointerSize); |
2370 __ Poke(x0, 0); | 2391 __ Poke(x0, 0); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2576 void FullCodeGenerator::VisitProperty(Property* expr) { | 2597 void FullCodeGenerator::VisitProperty(Property* expr) { |
2577 Comment cmnt(masm_, "[ Property"); | 2598 Comment cmnt(masm_, "[ Property"); |
2578 Expression* key = expr->key(); | 2599 Expression* key = expr->key(); |
2579 | 2600 |
2580 if (key->IsPropertyName()) { | 2601 if (key->IsPropertyName()) { |
2581 if (!expr->IsSuperAccess()) { | 2602 if (!expr->IsSuperAccess()) { |
2582 VisitForAccumulatorValue(expr->obj()); | 2603 VisitForAccumulatorValue(expr->obj()); |
2583 __ Move(LoadDescriptor::ReceiverRegister(), x0); | 2604 __ Move(LoadDescriptor::ReceiverRegister(), x0); |
2584 EmitNamedPropertyLoad(expr); | 2605 EmitNamedPropertyLoad(expr); |
2585 } else { | 2606 } else { |
2586 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); | 2607 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
2587 VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); | 2608 VisitForStackValue( |
| 2609 expr->obj()->AsSuperPropertyReference()->home_object_var()); |
2588 EmitNamedSuperPropertyLoad(expr); | 2610 EmitNamedSuperPropertyLoad(expr); |
2589 } | 2611 } |
2590 } else { | 2612 } else { |
2591 if (!expr->IsSuperAccess()) { | 2613 if (!expr->IsSuperAccess()) { |
2592 VisitForStackValue(expr->obj()); | 2614 VisitForStackValue(expr->obj()); |
2593 VisitForAccumulatorValue(expr->key()); | 2615 VisitForAccumulatorValue(expr->key()); |
2594 __ Move(LoadDescriptor::NameRegister(), x0); | 2616 __ Move(LoadDescriptor::NameRegister(), x0); |
2595 __ Pop(LoadDescriptor::ReceiverRegister()); | 2617 __ Pop(LoadDescriptor::ReceiverRegister()); |
2596 EmitKeyedPropertyLoad(expr); | 2618 EmitKeyedPropertyLoad(expr); |
2597 } else { | 2619 } else { |
2598 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); | 2620 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
2599 VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); | 2621 VisitForStackValue( |
| 2622 expr->obj()->AsSuperPropertyReference()->home_object_var()); |
2600 VisitForStackValue(expr->key()); | 2623 VisitForStackValue(expr->key()); |
2601 EmitKeyedSuperPropertyLoad(expr); | 2624 EmitKeyedSuperPropertyLoad(expr); |
2602 } | 2625 } |
2603 } | 2626 } |
2604 PrepareForBailoutForId(expr->LoadId(), TOS_REG); | 2627 PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
2605 context()->Plug(x0); | 2628 context()->Plug(x0); |
2606 } | 2629 } |
2607 | 2630 |
2608 | 2631 |
2609 void FullCodeGenerator::CallIC(Handle<Code> code, | 2632 void FullCodeGenerator::CallIC(Handle<Code> code, |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2657 DCHECK(callee->IsProperty()); | 2680 DCHECK(callee->IsProperty()); |
2658 Property* prop = callee->AsProperty(); | 2681 Property* prop = callee->AsProperty(); |
2659 DCHECK(prop->IsSuperAccess()); | 2682 DCHECK(prop->IsSuperAccess()); |
2660 | 2683 |
2661 SetSourcePosition(prop->position()); | 2684 SetSourcePosition(prop->position()); |
2662 Literal* key = prop->key()->AsLiteral(); | 2685 Literal* key = prop->key()->AsLiteral(); |
2663 DCHECK(!key->value()->IsSmi()); | 2686 DCHECK(!key->value()->IsSmi()); |
2664 | 2687 |
2665 // Load the function from the receiver. | 2688 // Load the function from the receiver. |
2666 const Register scratch = x10; | 2689 const Register scratch = x10; |
2667 SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference(); | 2690 SuperPropertyReference* super_ref = |
| 2691 callee->AsProperty()->obj()->AsSuperPropertyReference(); |
2668 VisitForStackValue(super_ref->home_object_var()); | 2692 VisitForStackValue(super_ref->home_object_var()); |
2669 VisitForAccumulatorValue(super_ref->this_var()); | 2693 VisitForAccumulatorValue(super_ref->this_var()); |
2670 __ Push(x0); | 2694 __ Push(x0); |
2671 __ Peek(scratch, kPointerSize); | 2695 __ Peek(scratch, kPointerSize); |
2672 __ Push(x0, scratch); | 2696 __ Push(x0, scratch); |
2673 __ Push(key->value()); | 2697 __ Push(key->value()); |
2674 | 2698 |
2675 // Stack here: | 2699 // Stack here: |
2676 // - home_object | 2700 // - home_object |
2677 // - this (receiver) | 2701 // - this (receiver) |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2716 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 2740 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
2717 Expression* callee = expr->expression(); | 2741 Expression* callee = expr->expression(); |
2718 DCHECK(callee->IsProperty()); | 2742 DCHECK(callee->IsProperty()); |
2719 Property* prop = callee->AsProperty(); | 2743 Property* prop = callee->AsProperty(); |
2720 DCHECK(prop->IsSuperAccess()); | 2744 DCHECK(prop->IsSuperAccess()); |
2721 | 2745 |
2722 SetSourcePosition(prop->position()); | 2746 SetSourcePosition(prop->position()); |
2723 | 2747 |
2724 // Load the function from the receiver. | 2748 // Load the function from the receiver. |
2725 const Register scratch = x10; | 2749 const Register scratch = x10; |
2726 SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference(); | 2750 SuperPropertyReference* super_ref = |
| 2751 callee->AsProperty()->obj()->AsSuperPropertyReference(); |
2727 VisitForStackValue(super_ref->home_object_var()); | 2752 VisitForStackValue(super_ref->home_object_var()); |
2728 VisitForAccumulatorValue(super_ref->this_var()); | 2753 VisitForAccumulatorValue(super_ref->this_var()); |
2729 __ Push(x0); | 2754 __ Push(x0); |
2730 __ Peek(scratch, kPointerSize); | 2755 __ Peek(scratch, kPointerSize); |
2731 __ Push(x0, scratch); | 2756 __ Push(x0, scratch); |
2732 VisitForStackValue(prop->key()); | 2757 VisitForStackValue(prop->key()); |
2733 | 2758 |
2734 // Stack here: | 2759 // Stack here: |
2735 // - home_object | 2760 // - home_object |
2736 // - this (receiver) | 2761 // - this (receiver) |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2797 __ Mov(x13, Smi::FromInt(scope()->start_position())); | 2822 __ Mov(x13, Smi::FromInt(scope()->start_position())); |
2798 | 2823 |
2799 // Push. | 2824 // Push. |
2800 __ Push(x9, x10, x11, x12, x13); | 2825 __ Push(x9, x10, x11, x12, x13); |
2801 | 2826 |
2802 // Do the runtime call. | 2827 // Do the runtime call. |
2803 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); | 2828 __ CallRuntime(Runtime::kResolvePossiblyDirectEval, 6); |
2804 } | 2829 } |
2805 | 2830 |
2806 | 2831 |
2807 void FullCodeGenerator::EmitLoadSuperConstructor() { | |
2808 __ ldr(x0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | |
2809 __ Push(x0); | |
2810 __ CallRuntime(Runtime::kGetPrototype, 1); | |
2811 } | |
2812 | |
2813 | |
2814 void FullCodeGenerator::EmitInitializeThisAfterSuper( | 2832 void FullCodeGenerator::EmitInitializeThisAfterSuper( |
2815 SuperReference* super_ref, FeedbackVectorICSlot slot) { | 2833 SuperCallReference* super_ref, FeedbackVectorICSlot slot) { |
2816 Variable* this_var = super_ref->this_var()->var(); | 2834 Variable* this_var = super_ref->this_var()->var(); |
2817 GetVar(x1, this_var); | 2835 GetVar(x1, this_var); |
2818 Label uninitialized_this; | 2836 Label uninitialized_this; |
2819 __ JumpIfRoot(x1, Heap::kTheHoleValueRootIndex, &uninitialized_this); | 2837 __ JumpIfRoot(x1, Heap::kTheHoleValueRootIndex, &uninitialized_this); |
2820 __ Mov(x0, Operand(this_var->name())); | 2838 __ Mov(x0, Operand(this_var->name())); |
2821 __ Push(x0); | 2839 __ Push(x0); |
2822 __ CallRuntime(Runtime::kThrowReferenceError, 1); | 2840 __ CallRuntime(Runtime::kThrowReferenceError, 1); |
2823 __ bind(&uninitialized_this); | 2841 __ bind(&uninitialized_this); |
2824 | 2842 |
2825 EmitVariableAssignment(this_var, Token::INIT_CONST, slot); | 2843 EmitVariableAssignment(this_var, Token::INIT_CONST, slot); |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2965 | 2983 |
2966 void FullCodeGenerator::VisitCallNew(CallNew* expr) { | 2984 void FullCodeGenerator::VisitCallNew(CallNew* expr) { |
2967 Comment cmnt(masm_, "[ CallNew"); | 2985 Comment cmnt(masm_, "[ CallNew"); |
2968 // According to ECMA-262, section 11.2.2, page 44, the function | 2986 // According to ECMA-262, section 11.2.2, page 44, the function |
2969 // expression in new calls must be evaluated before the | 2987 // expression in new calls must be evaluated before the |
2970 // arguments. | 2988 // arguments. |
2971 | 2989 |
2972 // Push constructor on the stack. If it's not a function it's used as | 2990 // Push constructor on the stack. If it's not a function it's used as |
2973 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is | 2991 // receiver for CALL_NON_FUNCTION, otherwise the value on the stack is |
2974 // ignored. | 2992 // ignored. |
2975 DCHECK(!expr->expression()->IsSuperReference()); | 2993 DCHECK(!expr->expression()->IsSuperPropertyReference()); |
2976 VisitForStackValue(expr->expression()); | 2994 VisitForStackValue(expr->expression()); |
2977 | 2995 |
2978 // Push the arguments ("left-to-right") on the stack. | 2996 // Push the arguments ("left-to-right") on the stack. |
2979 ZoneList<Expression*>* args = expr->arguments(); | 2997 ZoneList<Expression*>* args = expr->arguments(); |
2980 int arg_count = args->length(); | 2998 int arg_count = args->length(); |
2981 for (int i = 0; i < arg_count; i++) { | 2999 for (int i = 0; i < arg_count; i++) { |
2982 VisitForStackValue(args->at(i)); | 3000 VisitForStackValue(args->at(i)); |
2983 } | 3001 } |
2984 | 3002 |
2985 // Call the construct call builtin that handles allocation and | 3003 // Call the construct call builtin that handles allocation and |
(...skipping 15 matching lines...) Expand all Loading... |
3001 __ Mov(x3, SmiFromSlot(expr->CallNewFeedbackSlot())); | 3019 __ Mov(x3, SmiFromSlot(expr->CallNewFeedbackSlot())); |
3002 | 3020 |
3003 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); | 3021 CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET); |
3004 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3022 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3005 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); | 3023 PrepareForBailoutForId(expr->ReturnId(), TOS_REG); |
3006 context()->Plug(x0); | 3024 context()->Plug(x0); |
3007 } | 3025 } |
3008 | 3026 |
3009 | 3027 |
3010 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { | 3028 void FullCodeGenerator::EmitSuperConstructorCall(Call* expr) { |
3011 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); | 3029 SuperCallReference* super_call_ref = |
3012 GetVar(result_register(), new_target_var); | 3030 expr->expression()->AsSuperCallReference(); |
3013 __ Push(result_register()); | 3031 DCHECK_NOT_NULL(super_call_ref); |
3014 | 3032 |
3015 EmitLoadSuperConstructor(); | 3033 VariableProxy* new_target_proxy = super_call_ref->new_target_var(); |
| 3034 VisitForStackValue(new_target_proxy); |
| 3035 |
| 3036 EmitLoadSuperConstructor(super_call_ref); |
3016 __ push(result_register()); | 3037 __ push(result_register()); |
3017 | 3038 |
3018 // Push the arguments ("left-to-right") on the stack. | 3039 // Push the arguments ("left-to-right") on the stack. |
3019 ZoneList<Expression*>* args = expr->arguments(); | 3040 ZoneList<Expression*>* args = expr->arguments(); |
3020 int arg_count = args->length(); | 3041 int arg_count = args->length(); |
3021 for (int i = 0; i < arg_count; i++) { | 3042 for (int i = 0; i < arg_count; i++) { |
3022 VisitForStackValue(args->at(i)); | 3043 VisitForStackValue(args->at(i)); |
3023 } | 3044 } |
3024 | 3045 |
3025 // Call the construct call builtin that handles allocation and | 3046 // Call the construct call builtin that handles allocation and |
(...skipping 17 matching lines...) Expand all Loading... |
3043 __ LoadObject(x2, FeedbackVector()); | 3064 __ LoadObject(x2, FeedbackVector()); |
3044 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot())); | 3065 __ Mov(x3, SmiFromSlot(expr->CallFeedbackSlot())); |
3045 | 3066 |
3046 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); | 3067 CallConstructStub stub(isolate(), SUPER_CALL_RECORD_TARGET); |
3047 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); | 3068 __ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL); |
3048 | 3069 |
3049 __ Drop(1); | 3070 __ Drop(1); |
3050 | 3071 |
3051 RecordJSReturnSite(expr); | 3072 RecordJSReturnSite(expr); |
3052 | 3073 |
3053 EmitInitializeThisAfterSuper(expr->expression()->AsSuperReference(), | 3074 EmitInitializeThisAfterSuper(super_call_ref, expr->CallFeedbackICSlot()); |
3054 expr->CallFeedbackICSlot()); | |
3055 context()->Plug(x0); | 3075 context()->Plug(x0); |
3056 } | 3076 } |
3057 | 3077 |
3058 | 3078 |
3059 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { | 3079 void FullCodeGenerator::EmitIsSmi(CallRuntime* expr) { |
3060 ZoneList<Expression*>* args = expr->arguments(); | 3080 ZoneList<Expression*>* args = expr->arguments(); |
3061 DCHECK(args->length() == 1); | 3081 DCHECK(args->length() == 1); |
3062 | 3082 |
3063 VisitForAccumulatorValue(args->at(0)); | 3083 VisitForAccumulatorValue(args->at(0)); |
3064 | 3084 |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3924 __ Bind(&runtime); | 3944 __ Bind(&runtime); |
3925 __ Push(x0); | 3945 __ Push(x0); |
3926 __ CallRuntime(Runtime::kCall, args->length()); | 3946 __ CallRuntime(Runtime::kCall, args->length()); |
3927 __ Bind(&done); | 3947 __ Bind(&done); |
3928 | 3948 |
3929 context()->Plug(x0); | 3949 context()->Plug(x0); |
3930 } | 3950 } |
3931 | 3951 |
3932 | 3952 |
3933 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { | 3953 void FullCodeGenerator::EmitDefaultConstructorCallSuper(CallRuntime* expr) { |
3934 Variable* new_target_var = scope()->DeclarationScope()->new_target_var(); | 3954 ZoneList<Expression*>* args = expr->arguments(); |
3935 GetVar(result_register(), new_target_var); | 3955 DCHECK(args->length() == 2); |
3936 __ Push(result_register()); | |
3937 | 3956 |
3938 EmitLoadSuperConstructor(); | 3957 // new.target |
| 3958 VisitForStackValue(args->at(0)); |
| 3959 |
| 3960 // .this_function |
| 3961 VisitForStackValue(args->at(1)); |
| 3962 __ CallRuntime(Runtime::kGetPrototype, 1); |
3939 __ Push(result_register()); | 3963 __ Push(result_register()); |
3940 | 3964 |
3941 // Check if the calling frame is an arguments adaptor frame. | 3965 // Check if the calling frame is an arguments adaptor frame. |
3942 Label adaptor_frame, args_set_up, runtime; | 3966 Label adaptor_frame, args_set_up, runtime; |
3943 __ Ldr(x11, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 3967 __ Ldr(x11, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
3944 __ Ldr(x12, MemOperand(x11, StandardFrameConstants::kContextOffset)); | 3968 __ Ldr(x12, MemOperand(x11, StandardFrameConstants::kContextOffset)); |
3945 __ Cmp(x12, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); | 3969 __ Cmp(x12, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)); |
3946 __ B(eq, &adaptor_frame); | 3970 __ B(eq, &adaptor_frame); |
3947 // default constructor has no arguments, so no adaptor frame means no args. | 3971 // default constructor has no arguments, so no adaptor frame means no args. |
3948 __ Mov(x0, Operand(0)); | 3972 __ Mov(x0, Operand(0)); |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4305 context()->Plug(x0); | 4329 context()->Plug(x0); |
4306 } | 4330 } |
4307 | 4331 |
4308 | 4332 |
4309 void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) { | 4333 void FullCodeGenerator::EmitCallSuperWithSpread(CallRuntime* expr) { |
4310 // Assert: expr === CallRuntime("ReflectConstruct") | 4334 // Assert: expr === CallRuntime("ReflectConstruct") |
4311 CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime(); | 4335 CallRuntime* call = expr->arguments()->at(0)->AsCallRuntime(); |
4312 ZoneList<Expression*>* args = call->arguments(); | 4336 ZoneList<Expression*>* args = call->arguments(); |
4313 DCHECK_EQ(3, args->length()); | 4337 DCHECK_EQ(3, args->length()); |
4314 | 4338 |
4315 SuperReference* super_reference = args->at(0)->AsSuperReference(); | 4339 SuperCallReference* super_call_ref = args->at(0)->AsSuperCallReference(); |
| 4340 DCHECK_NOT_NULL(super_call_ref); |
4316 | 4341 |
4317 // Load ReflectConstruct function | 4342 // Load ReflectConstruct function |
4318 EmitLoadJSRuntimeFunction(call); | 4343 EmitLoadJSRuntimeFunction(call); |
4319 | 4344 |
4320 // Push the target function under the receiver. | 4345 // Push the target function under the receiver. |
4321 __ Pop(x10); | 4346 __ Pop(x10); |
4322 __ Push(x0, x10); | 4347 __ Push(x0, x10); |
4323 | 4348 |
4324 // Push super | 4349 // Push super constructor |
4325 EmitLoadSuperConstructor(); | 4350 EmitLoadSuperConstructor(super_call_ref); |
4326 __ Push(result_register()); | 4351 __ Push(result_register()); |
4327 | 4352 |
4328 // Push arguments array | 4353 // Push arguments array |
4329 VisitForStackValue(args->at(1)); | 4354 VisitForStackValue(args->at(1)); |
4330 | 4355 |
4331 // Push NewTarget | 4356 // Push NewTarget |
4332 DCHECK(args->at(2)->IsVariableProxy()); | 4357 DCHECK(args->at(2)->IsVariableProxy()); |
4333 VisitForStackValue(args->at(2)); | 4358 VisitForStackValue(args->at(2)); |
4334 | 4359 |
4335 EmitCallJSRuntimeFunction(call); | 4360 EmitCallJSRuntimeFunction(call); |
4336 | 4361 |
4337 // Restore context register. | 4362 // Restore context register. |
4338 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 4363 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
4339 context()->DropAndPlug(1, x0); | 4364 context()->DropAndPlug(1, x0); |
4340 | 4365 |
4341 // TODO(mvstanton): with FLAG_vector_stores this needs a slot id. | 4366 // TODO(mvstanton): with FLAG_vector_stores this needs a slot id. |
4342 EmitInitializeThisAfterSuper(super_reference); | 4367 EmitInitializeThisAfterSuper(super_call_ref); |
4343 } | 4368 } |
4344 | 4369 |
4345 | 4370 |
4346 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4371 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
4347 // Push the builtins object as the receiver. | 4372 // Push the builtins object as the receiver. |
4348 __ Ldr(x10, GlobalObjectMemOperand()); | 4373 __ Ldr(x10, GlobalObjectMemOperand()); |
4349 __ Ldr(LoadDescriptor::ReceiverRegister(), | 4374 __ Ldr(LoadDescriptor::ReceiverRegister(), |
4350 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); | 4375 FieldMemOperand(x10, GlobalObject::kBuiltinsOffset)); |
4351 __ Push(LoadDescriptor::ReceiverRegister()); | 4376 __ Push(LoadDescriptor::ReceiverRegister()); |
4352 | 4377 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4554 switch (assign_type) { | 4579 switch (assign_type) { |
4555 case NAMED_PROPERTY: { | 4580 case NAMED_PROPERTY: { |
4556 // Put the object both on the stack and in the register. | 4581 // Put the object both on the stack and in the register. |
4557 VisitForStackValue(prop->obj()); | 4582 VisitForStackValue(prop->obj()); |
4558 __ Peek(LoadDescriptor::ReceiverRegister(), 0); | 4583 __ Peek(LoadDescriptor::ReceiverRegister(), 0); |
4559 EmitNamedPropertyLoad(prop); | 4584 EmitNamedPropertyLoad(prop); |
4560 break; | 4585 break; |
4561 } | 4586 } |
4562 | 4587 |
4563 case NAMED_SUPER_PROPERTY: { | 4588 case NAMED_SUPER_PROPERTY: { |
4564 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | 4589 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
4565 VisitForAccumulatorValue( | 4590 VisitForAccumulatorValue( |
4566 prop->obj()->AsSuperReference()->home_object_var()); | 4591 prop->obj()->AsSuperPropertyReference()->home_object_var()); |
4567 __ Push(result_register()); | 4592 __ Push(result_register()); |
4568 const Register scratch = x10; | 4593 const Register scratch = x10; |
4569 __ Peek(scratch, kPointerSize); | 4594 __ Peek(scratch, kPointerSize); |
4570 __ Push(scratch, result_register()); | 4595 __ Push(scratch, result_register()); |
4571 EmitNamedSuperPropertyLoad(prop); | 4596 EmitNamedSuperPropertyLoad(prop); |
4572 break; | 4597 break; |
4573 } | 4598 } |
4574 | 4599 |
4575 case KEYED_SUPER_PROPERTY: { | 4600 case KEYED_SUPER_PROPERTY: { |
4576 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | 4601 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
4577 VisitForStackValue(prop->obj()->AsSuperReference()->home_object_var()); | 4602 VisitForStackValue( |
| 4603 prop->obj()->AsSuperPropertyReference()->home_object_var()); |
4578 VisitForAccumulatorValue(prop->key()); | 4604 VisitForAccumulatorValue(prop->key()); |
4579 __ Push(result_register()); | 4605 __ Push(result_register()); |
4580 const Register scratch1 = x10; | 4606 const Register scratch1 = x10; |
4581 const Register scratch2 = x11; | 4607 const Register scratch2 = x11; |
4582 __ Peek(scratch1, 2 * kPointerSize); | 4608 __ Peek(scratch1, 2 * kPointerSize); |
4583 __ Peek(scratch2, kPointerSize); | 4609 __ Peek(scratch2, kPointerSize); |
4584 __ Push(scratch1, scratch2, result_register()); | 4610 __ Push(scratch1, scratch2, result_register()); |
4585 EmitKeyedSuperPropertyLoad(prop); | 4611 EmitKeyedSuperPropertyLoad(prop); |
4586 break; | 4612 break; |
4587 } | 4613 } |
(...skipping 948 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5536 } | 5562 } |
5537 } | 5563 } |
5538 | 5564 |
5539 return INTERRUPT; | 5565 return INTERRUPT; |
5540 } | 5566 } |
5541 | 5567 |
5542 | 5568 |
5543 } } // namespace v8::internal | 5569 } } // namespace v8::internal |
5544 | 5570 |
5545 #endif // V8_TARGET_ARCH_ARM64 | 5571 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |