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