OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 } else if (FLAG_debug_code) { | 235 } else if (FLAG_debug_code) { |
236 Label done; | 236 Label done; |
237 __ JumpIfInNewSpace(cp, r0, &done); | 237 __ JumpIfInNewSpace(cp, r0, &done); |
238 __ Abort(kExpectedNewSpaceObject); | 238 __ Abort(kExpectedNewSpaceObject); |
239 __ bind(&done); | 239 __ bind(&done); |
240 } | 240 } |
241 } | 241 } |
242 } | 242 } |
243 } | 243 } |
244 | 244 |
245 Variable* home_object_var = scope()->home_object_var(); | |
246 if (home_object_var != nullptr) { | |
247 __ Push(r1); | |
248 } | |
249 | |
250 // Possibly set up a local binding to the this function which is used in | 245 // Possibly set up a local binding to the this function which is used in |
251 // derived constructors with super calls. | 246 // derived constructors with super calls. |
252 Variable* this_function_var = scope()->this_function_var(); | 247 Variable* this_function_var = scope()->this_function_var(); |
253 if (this_function_var != nullptr) { | 248 if (this_function_var != nullptr) { |
254 Comment cmnt(masm_, "[ This function"); | 249 Comment cmnt(masm_, "[ This function"); |
255 SetVar(this_function_var, r1, r0, r2); | 250 SetVar(this_function_var, r1, r0, r2); |
256 } | 251 } |
257 | 252 |
258 Variable* new_target_var = scope()->new_target_var(); | 253 Variable* new_target_var = scope()->new_target_var(); |
259 if (new_target_var != nullptr) { | 254 if (new_target_var != nullptr) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 319 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
325 } else { | 320 } else { |
326 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 321 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
327 } | 322 } |
328 ArgumentsAccessStub stub(isolate(), type, has_new_target); | 323 ArgumentsAccessStub stub(isolate(), type, has_new_target); |
329 __ CallStub(&stub); | 324 __ CallStub(&stub); |
330 | 325 |
331 SetVar(arguments, r0, r1, r2); | 326 SetVar(arguments, r0, r1, r2); |
332 } | 327 } |
333 | 328 |
334 // Possibly set up a local binding to the [[HomeObject]]. | |
335 if (home_object_var != nullptr) { | |
336 Comment cmnt(masm_, "[ Home object"); | |
337 __ Pop(LoadDescriptor::ReceiverRegister()); | |
338 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | |
339 __ Move(LoadDescriptor::NameRegister(), home_object_symbol); | |
340 __ Move(LoadDescriptor::SlotRegister(), | |
341 Operand(SmiFromSlot(function()->HomeObjectFeedbackSlot()))); | |
342 CallLoadIC(NOT_CONTEXTUAL); | |
343 | |
344 SetVar(home_object_var, r0, r1, r2); | |
345 } | |
346 | 329 |
347 if (FLAG_trace) { | 330 if (FLAG_trace) { |
348 __ CallRuntime(Runtime::kTraceEnter, 0); | 331 __ CallRuntime(Runtime::kTraceEnter, 0); |
349 } | 332 } |
350 | 333 |
351 // Visit the declarations and body unless there is an illegal | 334 // Visit the declarations and body unless there is an illegal |
352 // redeclaration. | 335 // redeclaration. |
353 if (scope()->HasIllegalRedeclaration()) { | 336 if (scope()->HasIllegalRedeclaration()) { |
354 Comment cmnt(masm_, "[ Declarations"); | 337 Comment cmnt(masm_, "[ Declarations"); |
355 scope()->VisitIllegalRedeclaration(this); | 338 scope()->VisitIllegalRedeclaration(this); |
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2016 VisitForStackValue(property->obj()); | 1999 VisitForStackValue(property->obj()); |
2017 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 2000 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
2018 } else { | 2001 } else { |
2019 VisitForStackValue(property->obj()); | 2002 VisitForStackValue(property->obj()); |
2020 } | 2003 } |
2021 break; | 2004 break; |
2022 case NAMED_SUPER_PROPERTY: | 2005 case NAMED_SUPER_PROPERTY: |
2023 VisitForStackValue( | 2006 VisitForStackValue( |
2024 property->obj()->AsSuperPropertyReference()->this_var()); | 2007 property->obj()->AsSuperPropertyReference()->this_var()); |
2025 VisitForAccumulatorValue( | 2008 VisitForAccumulatorValue( |
2026 property->obj()->AsSuperPropertyReference()->home_object_var()); | 2009 property->obj()->AsSuperPropertyReference()->home_object()); |
2027 __ Push(result_register()); | 2010 __ Push(result_register()); |
2028 if (expr->is_compound()) { | 2011 if (expr->is_compound()) { |
2029 const Register scratch = r1; | 2012 const Register scratch = r1; |
2030 __ ldr(scratch, MemOperand(sp, kPointerSize)); | 2013 __ ldr(scratch, MemOperand(sp, kPointerSize)); |
2031 __ Push(scratch); | 2014 __ Push(scratch); |
2032 __ Push(result_register()); | 2015 __ Push(result_register()); |
2033 } | 2016 } |
2034 break; | 2017 break; |
2035 case KEYED_SUPER_PROPERTY: | 2018 case KEYED_SUPER_PROPERTY: |
2036 VisitForStackValue( | 2019 VisitForStackValue( |
2037 property->obj()->AsSuperPropertyReference()->this_var()); | 2020 property->obj()->AsSuperPropertyReference()->this_var()); |
2038 VisitForStackValue( | 2021 VisitForStackValue( |
2039 property->obj()->AsSuperPropertyReference()->home_object_var()); | 2022 property->obj()->AsSuperPropertyReference()->home_object()); |
2040 VisitForAccumulatorValue(property->key()); | 2023 VisitForAccumulatorValue(property->key()); |
2041 __ Push(result_register()); | 2024 __ Push(result_register()); |
2042 if (expr->is_compound()) { | 2025 if (expr->is_compound()) { |
2043 const Register scratch = r1; | 2026 const Register scratch = r1; |
2044 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); | 2027 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); |
2045 __ Push(scratch); | 2028 __ Push(scratch); |
2046 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); | 2029 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); |
2047 __ Push(scratch); | 2030 __ Push(scratch); |
2048 __ Push(result_register()); | 2031 __ Push(result_register()); |
2049 } | 2032 } |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2673 __ mov(StoreDescriptor::NameRegister(), | 2656 __ mov(StoreDescriptor::NameRegister(), |
2674 Operand(prop->key()->AsLiteral()->value())); | 2657 Operand(prop->key()->AsLiteral()->value())); |
2675 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2658 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2676 CallStoreIC(); | 2659 CallStoreIC(); |
2677 break; | 2660 break; |
2678 } | 2661 } |
2679 case NAMED_SUPER_PROPERTY: { | 2662 case NAMED_SUPER_PROPERTY: { |
2680 __ Push(r0); | 2663 __ Push(r0); |
2681 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 2664 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
2682 VisitForAccumulatorValue( | 2665 VisitForAccumulatorValue( |
2683 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 2666 prop->obj()->AsSuperPropertyReference()->home_object()); |
2684 // stack: value, this; r0: home_object | 2667 // stack: value, this; r0: home_object |
2685 Register scratch = r2; | 2668 Register scratch = r2; |
2686 Register scratch2 = r3; | 2669 Register scratch2 = r3; |
2687 __ mov(scratch, result_register()); // home_object | 2670 __ mov(scratch, result_register()); // home_object |
2688 __ ldr(r0, MemOperand(sp, kPointerSize)); // value | 2671 __ ldr(r0, MemOperand(sp, kPointerSize)); // value |
2689 __ ldr(scratch2, MemOperand(sp, 0)); // this | 2672 __ ldr(scratch2, MemOperand(sp, 0)); // this |
2690 __ str(scratch2, MemOperand(sp, kPointerSize)); // this | 2673 __ str(scratch2, MemOperand(sp, kPointerSize)); // this |
2691 __ str(scratch, MemOperand(sp, 0)); // home_object | 2674 __ str(scratch, MemOperand(sp, 0)); // home_object |
2692 // stack: this, home_object; r0: value | 2675 // stack: this, home_object; r0: value |
2693 EmitNamedSuperPropertyStore(prop); | 2676 EmitNamedSuperPropertyStore(prop); |
2694 break; | 2677 break; |
2695 } | 2678 } |
2696 case KEYED_SUPER_PROPERTY: { | 2679 case KEYED_SUPER_PROPERTY: { |
2697 __ Push(r0); | 2680 __ Push(r0); |
2698 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 2681 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
2699 VisitForStackValue( | 2682 VisitForStackValue( |
2700 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 2683 prop->obj()->AsSuperPropertyReference()->home_object()); |
2701 VisitForAccumulatorValue(prop->key()); | 2684 VisitForAccumulatorValue(prop->key()); |
2702 Register scratch = r2; | 2685 Register scratch = r2; |
2703 Register scratch2 = r3; | 2686 Register scratch2 = r3; |
2704 __ ldr(scratch2, MemOperand(sp, 2 * kPointerSize)); // value | 2687 __ ldr(scratch2, MemOperand(sp, 2 * kPointerSize)); // value |
2705 // stack: value, this, home_object; r0: key, r3: value | 2688 // stack: value, this, home_object; r0: key, r3: value |
2706 __ ldr(scratch, MemOperand(sp, kPointerSize)); // this | 2689 __ ldr(scratch, MemOperand(sp, kPointerSize)); // this |
2707 __ str(scratch, MemOperand(sp, 2 * kPointerSize)); | 2690 __ str(scratch, MemOperand(sp, 2 * kPointerSize)); |
2708 __ ldr(scratch, MemOperand(sp, 0)); // home_object | 2691 __ ldr(scratch, MemOperand(sp, 0)); // home_object |
2709 __ str(scratch, MemOperand(sp, kPointerSize)); | 2692 __ str(scratch, MemOperand(sp, kPointerSize)); |
2710 __ str(r0, MemOperand(sp, 0)); | 2693 __ str(r0, MemOperand(sp, 0)); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2916 Expression* key = expr->key(); | 2899 Expression* key = expr->key(); |
2917 | 2900 |
2918 if (key->IsPropertyName()) { | 2901 if (key->IsPropertyName()) { |
2919 if (!expr->IsSuperAccess()) { | 2902 if (!expr->IsSuperAccess()) { |
2920 VisitForAccumulatorValue(expr->obj()); | 2903 VisitForAccumulatorValue(expr->obj()); |
2921 __ Move(LoadDescriptor::ReceiverRegister(), r0); | 2904 __ Move(LoadDescriptor::ReceiverRegister(), r0); |
2922 EmitNamedPropertyLoad(expr); | 2905 EmitNamedPropertyLoad(expr); |
2923 } else { | 2906 } else { |
2924 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2907 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
2925 VisitForStackValue( | 2908 VisitForStackValue( |
2926 expr->obj()->AsSuperPropertyReference()->home_object_var()); | 2909 expr->obj()->AsSuperPropertyReference()->home_object()); |
2927 EmitNamedSuperPropertyLoad(expr); | 2910 EmitNamedSuperPropertyLoad(expr); |
2928 } | 2911 } |
2929 } else { | 2912 } else { |
2930 if (!expr->IsSuperAccess()) { | 2913 if (!expr->IsSuperAccess()) { |
2931 VisitForStackValue(expr->obj()); | 2914 VisitForStackValue(expr->obj()); |
2932 VisitForAccumulatorValue(expr->key()); | 2915 VisitForAccumulatorValue(expr->key()); |
2933 __ Move(LoadDescriptor::NameRegister(), r0); | 2916 __ Move(LoadDescriptor::NameRegister(), r0); |
2934 __ pop(LoadDescriptor::ReceiverRegister()); | 2917 __ pop(LoadDescriptor::ReceiverRegister()); |
2935 EmitKeyedPropertyLoad(expr); | 2918 EmitKeyedPropertyLoad(expr); |
2936 } else { | 2919 } else { |
2937 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2920 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
2938 VisitForStackValue( | 2921 VisitForStackValue( |
2939 expr->obj()->AsSuperPropertyReference()->home_object_var()); | 2922 expr->obj()->AsSuperPropertyReference()->home_object()); |
2940 VisitForStackValue(expr->key()); | 2923 VisitForStackValue(expr->key()); |
2941 EmitKeyedSuperPropertyLoad(expr); | 2924 EmitKeyedSuperPropertyLoad(expr); |
2942 } | 2925 } |
2943 } | 2926 } |
2944 PrepareForBailoutForId(expr->LoadId(), TOS_REG); | 2927 PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
2945 context()->Plug(r0); | 2928 context()->Plug(r0); |
2946 } | 2929 } |
2947 | 2930 |
2948 | 2931 |
2949 void FullCodeGenerator::CallIC(Handle<Code> code, | 2932 void FullCodeGenerator::CallIC(Handle<Code> code, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2995 DCHECK(callee->IsProperty()); | 2978 DCHECK(callee->IsProperty()); |
2996 Property* prop = callee->AsProperty(); | 2979 Property* prop = callee->AsProperty(); |
2997 DCHECK(prop->IsSuperAccess()); | 2980 DCHECK(prop->IsSuperAccess()); |
2998 | 2981 |
2999 SetSourcePosition(prop->position()); | 2982 SetSourcePosition(prop->position()); |
3000 Literal* key = prop->key()->AsLiteral(); | 2983 Literal* key = prop->key()->AsLiteral(); |
3001 DCHECK(!key->value()->IsSmi()); | 2984 DCHECK(!key->value()->IsSmi()); |
3002 // Load the function from the receiver. | 2985 // Load the function from the receiver. |
3003 const Register scratch = r1; | 2986 const Register scratch = r1; |
3004 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2987 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
3005 VisitForStackValue(super_ref->home_object_var()); | 2988 VisitForStackValue(super_ref->home_object()); |
3006 VisitForAccumulatorValue(super_ref->this_var()); | 2989 VisitForAccumulatorValue(super_ref->this_var()); |
3007 __ Push(r0); | 2990 __ Push(r0); |
3008 __ Push(r0); | 2991 __ Push(r0); |
3009 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); | 2992 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); |
3010 __ Push(scratch); | 2993 __ Push(scratch); |
3011 __ Push(key->value()); | 2994 __ Push(key->value()); |
3012 | 2995 |
3013 // Stack here: | 2996 // Stack here: |
3014 // - home_object | 2997 // - home_object |
3015 // - this (receiver) | 2998 // - this (receiver) |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3055 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 3038 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
3056 Expression* callee = expr->expression(); | 3039 Expression* callee = expr->expression(); |
3057 DCHECK(callee->IsProperty()); | 3040 DCHECK(callee->IsProperty()); |
3058 Property* prop = callee->AsProperty(); | 3041 Property* prop = callee->AsProperty(); |
3059 DCHECK(prop->IsSuperAccess()); | 3042 DCHECK(prop->IsSuperAccess()); |
3060 | 3043 |
3061 SetSourcePosition(prop->position()); | 3044 SetSourcePosition(prop->position()); |
3062 // Load the function from the receiver. | 3045 // Load the function from the receiver. |
3063 const Register scratch = r1; | 3046 const Register scratch = r1; |
3064 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 3047 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
3065 VisitForStackValue(super_ref->home_object_var()); | 3048 VisitForStackValue(super_ref->home_object()); |
3066 VisitForAccumulatorValue(super_ref->this_var()); | 3049 VisitForAccumulatorValue(super_ref->this_var()); |
3067 __ Push(r0); | 3050 __ Push(r0); |
3068 __ Push(r0); | 3051 __ Push(r0); |
3069 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); | 3052 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); |
3070 __ Push(scratch); | 3053 __ Push(scratch); |
3071 VisitForStackValue(prop->key()); | 3054 VisitForStackValue(prop->key()); |
3072 | 3055 |
3073 // Stack here: | 3056 // Stack here: |
3074 // - home_object | 3057 // - home_object |
3075 // - this (receiver) | 3058 // - this (receiver) |
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4916 // Put the object both on the stack and in the register. | 4899 // Put the object both on the stack and in the register. |
4917 VisitForStackValue(prop->obj()); | 4900 VisitForStackValue(prop->obj()); |
4918 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 4901 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
4919 EmitNamedPropertyLoad(prop); | 4902 EmitNamedPropertyLoad(prop); |
4920 break; | 4903 break; |
4921 } | 4904 } |
4922 | 4905 |
4923 case NAMED_SUPER_PROPERTY: { | 4906 case NAMED_SUPER_PROPERTY: { |
4924 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 4907 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
4925 VisitForAccumulatorValue( | 4908 VisitForAccumulatorValue( |
4926 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 4909 prop->obj()->AsSuperPropertyReference()->home_object()); |
4927 __ Push(result_register()); | 4910 __ Push(result_register()); |
4928 const Register scratch = r1; | 4911 const Register scratch = r1; |
4929 __ ldr(scratch, MemOperand(sp, kPointerSize)); | 4912 __ ldr(scratch, MemOperand(sp, kPointerSize)); |
4930 __ Push(scratch); | 4913 __ Push(scratch); |
4931 __ Push(result_register()); | 4914 __ Push(result_register()); |
4932 EmitNamedSuperPropertyLoad(prop); | 4915 EmitNamedSuperPropertyLoad(prop); |
4933 break; | 4916 break; |
4934 } | 4917 } |
4935 | 4918 |
4936 case KEYED_SUPER_PROPERTY: { | 4919 case KEYED_SUPER_PROPERTY: { |
4937 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 4920 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
4938 VisitForStackValue( | 4921 VisitForStackValue( |
4939 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 4922 prop->obj()->AsSuperPropertyReference()->home_object()); |
4940 VisitForAccumulatorValue(prop->key()); | 4923 VisitForAccumulatorValue(prop->key()); |
4941 __ Push(result_register()); | 4924 __ Push(result_register()); |
4942 const Register scratch = r1; | 4925 const Register scratch = r1; |
4943 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); | 4926 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); |
4944 __ Push(scratch); | 4927 __ Push(scratch); |
4945 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); | 4928 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); |
4946 __ Push(scratch); | 4929 __ Push(scratch); |
4947 __ Push(result_register()); | 4930 __ Push(result_register()); |
4948 EmitKeyedSuperPropertyLoad(prop); | 4931 EmitKeyedSuperPropertyLoad(prop); |
4949 break; | 4932 break; |
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5613 DCHECK(interrupt_address == | 5596 DCHECK(interrupt_address == |
5614 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5597 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5615 return OSR_AFTER_STACK_CHECK; | 5598 return OSR_AFTER_STACK_CHECK; |
5616 } | 5599 } |
5617 | 5600 |
5618 | 5601 |
5619 } // namespace internal | 5602 } // namespace internal |
5620 } // namespace v8 | 5603 } // namespace v8 |
5621 | 5604 |
5622 #endif // V8_TARGET_ARCH_ARM | 5605 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |