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