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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
244 } else if (FLAG_debug_code) { | 244 } else if (FLAG_debug_code) { |
245 Label done; | 245 Label done; |
246 __ JumpIfInNewSpace(cp, a0, &done); | 246 __ JumpIfInNewSpace(cp, a0, &done); |
247 __ Abort(kExpectedNewSpaceObject); | 247 __ Abort(kExpectedNewSpaceObject); |
248 __ bind(&done); | 248 __ bind(&done); |
249 } | 249 } |
250 } | 250 } |
251 } | 251 } |
252 } | 252 } |
253 | 253 |
254 Variable* home_object_var = scope()->home_object_var(); | |
255 if (home_object_var != nullptr) { | |
256 __ Push(a1); | |
257 } | |
258 | |
259 // Possibly set up a local binding to the this function which is used in | 254 // Possibly set up a local binding to the this function which is used in |
260 // derived constructors with super calls. | 255 // derived constructors with super calls. |
261 Variable* this_function_var = scope()->this_function_var(); | 256 Variable* this_function_var = scope()->this_function_var(); |
262 if (this_function_var != nullptr) { | 257 if (this_function_var != nullptr) { |
263 Comment cmnt(masm_, "[ This function"); | 258 Comment cmnt(masm_, "[ This function"); |
264 SetVar(this_function_var, a1, a2, a3); | 259 SetVar(this_function_var, a1, a2, a3); |
265 } | 260 } |
266 | 261 |
267 Variable* new_target_var = scope()->new_target_var(); | 262 Variable* new_target_var = scope()->new_target_var(); |
268 if (new_target_var != nullptr) { | 263 if (new_target_var != nullptr) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 329 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
335 } else { | 330 } else { |
336 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 331 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
337 } | 332 } |
338 ArgumentsAccessStub stub(isolate(), type, has_new_target); | 333 ArgumentsAccessStub stub(isolate(), type, has_new_target); |
339 __ CallStub(&stub); | 334 __ CallStub(&stub); |
340 | 335 |
341 SetVar(arguments, v0, a1, a2); | 336 SetVar(arguments, v0, a1, a2); |
342 } | 337 } |
343 | 338 |
344 // Possibly set up a local binding to the [[HomeObject]]. | |
345 if (home_object_var != nullptr) { | |
346 Comment cmnt(masm_, "[ Home object"); | |
347 __ Pop(LoadDescriptor::ReceiverRegister()); | |
348 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | |
349 __ li(LoadDescriptor::NameRegister(), Operand(home_object_symbol)); | |
350 __ li(LoadDescriptor::SlotRegister(), | |
351 Operand(SmiFromSlot(function()->HomeObjectFeedbackSlot()))); | |
352 CallLoadIC(NOT_CONTEXTUAL); | |
353 | |
354 SetVar(home_object_var, v0, a1, a2); | |
355 } | |
356 | |
357 if (FLAG_trace) { | 339 if (FLAG_trace) { |
358 __ CallRuntime(Runtime::kTraceEnter, 0); | 340 __ CallRuntime(Runtime::kTraceEnter, 0); |
359 } | 341 } |
360 | 342 |
361 // Visit the declarations and body unless there is an illegal | 343 // Visit the declarations and body unless there is an illegal |
362 // redeclaration. | 344 // redeclaration. |
363 if (scope()->HasIllegalRedeclaration()) { | 345 if (scope()->HasIllegalRedeclaration()) { |
364 Comment cmnt(masm_, "[ Declarations"); | 346 Comment cmnt(masm_, "[ Declarations"); |
365 scope()->VisitIllegalRedeclaration(this); | 347 scope()->VisitIllegalRedeclaration(this); |
366 | 348 |
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2002 VisitForStackValue(property->obj()); | 1984 VisitForStackValue(property->obj()); |
2003 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1985 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
2004 } else { | 1986 } else { |
2005 VisitForStackValue(property->obj()); | 1987 VisitForStackValue(property->obj()); |
2006 } | 1988 } |
2007 break; | 1989 break; |
2008 case NAMED_SUPER_PROPERTY: | 1990 case NAMED_SUPER_PROPERTY: |
2009 VisitForStackValue( | 1991 VisitForStackValue( |
2010 property->obj()->AsSuperPropertyReference()->this_var()); | 1992 property->obj()->AsSuperPropertyReference()->this_var()); |
2011 VisitForAccumulatorValue( | 1993 VisitForAccumulatorValue( |
2012 property->obj()->AsSuperPropertyReference()->home_object_var()); | 1994 property->obj()->AsSuperPropertyReference()->home_object()); |
2013 __ Push(result_register()); | 1995 __ Push(result_register()); |
2014 if (expr->is_compound()) { | 1996 if (expr->is_compound()) { |
2015 const Register scratch = a1; | 1997 const Register scratch = a1; |
2016 __ lw(scratch, MemOperand(sp, kPointerSize)); | 1998 __ lw(scratch, MemOperand(sp, kPointerSize)); |
2017 __ Push(scratch, result_register()); | 1999 __ Push(scratch, result_register()); |
2018 } | 2000 } |
2019 break; | 2001 break; |
2020 case KEYED_SUPER_PROPERTY: { | 2002 case KEYED_SUPER_PROPERTY: { |
2021 const Register scratch = a1; | 2003 const Register scratch = a1; |
2022 VisitForStackValue( | 2004 VisitForStackValue( |
2023 property->obj()->AsSuperPropertyReference()->this_var()); | 2005 property->obj()->AsSuperPropertyReference()->this_var()); |
2024 VisitForAccumulatorValue( | 2006 VisitForAccumulatorValue( |
2025 property->obj()->AsSuperPropertyReference()->home_object_var()); | 2007 property->obj()->AsSuperPropertyReference()->home_object()); |
2026 __ Move(scratch, result_register()); | 2008 __ Move(scratch, result_register()); |
2027 VisitForAccumulatorValue(property->key()); | 2009 VisitForAccumulatorValue(property->key()); |
2028 __ Push(scratch, result_register()); | 2010 __ Push(scratch, result_register()); |
2029 if (expr->is_compound()) { | 2011 if (expr->is_compound()) { |
2030 const Register scratch1 = t0; | 2012 const Register scratch1 = t0; |
2031 __ lw(scratch1, MemOperand(sp, 2 * kPointerSize)); | 2013 __ lw(scratch1, MemOperand(sp, 2 * kPointerSize)); |
2032 __ Push(scratch1, scratch, result_register()); | 2014 __ Push(scratch1, scratch, result_register()); |
2033 } | 2015 } |
2034 break; | 2016 break; |
2035 } | 2017 } |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2651 __ li(StoreDescriptor::NameRegister(), | 2633 __ li(StoreDescriptor::NameRegister(), |
2652 Operand(prop->key()->AsLiteral()->value())); | 2634 Operand(prop->key()->AsLiteral()->value())); |
2653 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2635 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2654 CallStoreIC(); | 2636 CallStoreIC(); |
2655 break; | 2637 break; |
2656 } | 2638 } |
2657 case NAMED_SUPER_PROPERTY: { | 2639 case NAMED_SUPER_PROPERTY: { |
2658 __ Push(v0); | 2640 __ Push(v0); |
2659 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 2641 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
2660 VisitForAccumulatorValue( | 2642 VisitForAccumulatorValue( |
2661 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 2643 prop->obj()->AsSuperPropertyReference()->home_object()); |
2662 // stack: value, this; v0: home_object | 2644 // stack: value, this; v0: home_object |
2663 Register scratch = a2; | 2645 Register scratch = a2; |
2664 Register scratch2 = a3; | 2646 Register scratch2 = a3; |
2665 __ mov(scratch, result_register()); // home_object | 2647 __ mov(scratch, result_register()); // home_object |
2666 __ lw(v0, MemOperand(sp, kPointerSize)); // value | 2648 __ lw(v0, MemOperand(sp, kPointerSize)); // value |
2667 __ lw(scratch2, MemOperand(sp, 0)); // this | 2649 __ lw(scratch2, MemOperand(sp, 0)); // this |
2668 __ sw(scratch2, MemOperand(sp, kPointerSize)); // this | 2650 __ sw(scratch2, MemOperand(sp, kPointerSize)); // this |
2669 __ sw(scratch, MemOperand(sp, 0)); // home_object | 2651 __ sw(scratch, MemOperand(sp, 0)); // home_object |
2670 // stack: this, home_object; v0: value | 2652 // stack: this, home_object; v0: value |
2671 EmitNamedSuperPropertyStore(prop); | 2653 EmitNamedSuperPropertyStore(prop); |
2672 break; | 2654 break; |
2673 } | 2655 } |
2674 case KEYED_SUPER_PROPERTY: { | 2656 case KEYED_SUPER_PROPERTY: { |
2675 __ Push(v0); | 2657 __ Push(v0); |
2676 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 2658 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
2677 VisitForStackValue( | 2659 VisitForStackValue( |
2678 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 2660 prop->obj()->AsSuperPropertyReference()->home_object()); |
2679 VisitForAccumulatorValue(prop->key()); | 2661 VisitForAccumulatorValue(prop->key()); |
2680 Register scratch = a2; | 2662 Register scratch = a2; |
2681 Register scratch2 = a3; | 2663 Register scratch2 = a3; |
2682 __ lw(scratch2, MemOperand(sp, 2 * kPointerSize)); // value | 2664 __ lw(scratch2, MemOperand(sp, 2 * kPointerSize)); // value |
2683 // stack: value, this, home_object; v0: key, a3: value | 2665 // stack: value, this, home_object; v0: key, a3: value |
2684 __ lw(scratch, MemOperand(sp, kPointerSize)); // this | 2666 __ lw(scratch, MemOperand(sp, kPointerSize)); // this |
2685 __ sw(scratch, MemOperand(sp, 2 * kPointerSize)); | 2667 __ sw(scratch, MemOperand(sp, 2 * kPointerSize)); |
2686 __ lw(scratch, MemOperand(sp, 0)); // home_object | 2668 __ lw(scratch, MemOperand(sp, 0)); // home_object |
2687 __ sw(scratch, MemOperand(sp, kPointerSize)); | 2669 __ sw(scratch, MemOperand(sp, kPointerSize)); |
2688 __ sw(v0, MemOperand(sp, 0)); | 2670 __ sw(v0, MemOperand(sp, 0)); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2899 Expression* key = expr->key(); | 2881 Expression* key = expr->key(); |
2900 | 2882 |
2901 if (key->IsPropertyName()) { | 2883 if (key->IsPropertyName()) { |
2902 if (!expr->IsSuperAccess()) { | 2884 if (!expr->IsSuperAccess()) { |
2903 VisitForAccumulatorValue(expr->obj()); | 2885 VisitForAccumulatorValue(expr->obj()); |
2904 __ Move(LoadDescriptor::ReceiverRegister(), v0); | 2886 __ Move(LoadDescriptor::ReceiverRegister(), v0); |
2905 EmitNamedPropertyLoad(expr); | 2887 EmitNamedPropertyLoad(expr); |
2906 } else { | 2888 } else { |
2907 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2889 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
2908 VisitForStackValue( | 2890 VisitForStackValue( |
2909 expr->obj()->AsSuperPropertyReference()->home_object_var()); | 2891 expr->obj()->AsSuperPropertyReference()->home_object()); |
2910 EmitNamedSuperPropertyLoad(expr); | 2892 EmitNamedSuperPropertyLoad(expr); |
2911 } | 2893 } |
2912 } else { | 2894 } else { |
2913 if (!expr->IsSuperAccess()) { | 2895 if (!expr->IsSuperAccess()) { |
2914 VisitForStackValue(expr->obj()); | 2896 VisitForStackValue(expr->obj()); |
2915 VisitForAccumulatorValue(expr->key()); | 2897 VisitForAccumulatorValue(expr->key()); |
2916 __ Move(LoadDescriptor::NameRegister(), v0); | 2898 __ Move(LoadDescriptor::NameRegister(), v0); |
2917 __ pop(LoadDescriptor::ReceiverRegister()); | 2899 __ pop(LoadDescriptor::ReceiverRegister()); |
2918 EmitKeyedPropertyLoad(expr); | 2900 EmitKeyedPropertyLoad(expr); |
2919 } else { | 2901 } else { |
2920 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); | 2902 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); |
2921 VisitForStackValue( | 2903 VisitForStackValue( |
2922 expr->obj()->AsSuperPropertyReference()->home_object_var()); | 2904 expr->obj()->AsSuperPropertyReference()->home_object()); |
2923 VisitForStackValue(expr->key()); | 2905 VisitForStackValue(expr->key()); |
2924 EmitKeyedSuperPropertyLoad(expr); | 2906 EmitKeyedSuperPropertyLoad(expr); |
2925 } | 2907 } |
2926 } | 2908 } |
2927 PrepareForBailoutForId(expr->LoadId(), TOS_REG); | 2909 PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
2928 context()->Plug(v0); | 2910 context()->Plug(v0); |
2929 } | 2911 } |
2930 | 2912 |
2931 | 2913 |
2932 void FullCodeGenerator::CallIC(Handle<Code> code, | 2914 void FullCodeGenerator::CallIC(Handle<Code> code, |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2975 DCHECK(callee->IsProperty()); | 2957 DCHECK(callee->IsProperty()); |
2976 Property* prop = callee->AsProperty(); | 2958 Property* prop = callee->AsProperty(); |
2977 DCHECK(prop->IsSuperAccess()); | 2959 DCHECK(prop->IsSuperAccess()); |
2978 | 2960 |
2979 SetSourcePosition(prop->position()); | 2961 SetSourcePosition(prop->position()); |
2980 Literal* key = prop->key()->AsLiteral(); | 2962 Literal* key = prop->key()->AsLiteral(); |
2981 DCHECK(!key->value()->IsSmi()); | 2963 DCHECK(!key->value()->IsSmi()); |
2982 // Load the function from the receiver. | 2964 // Load the function from the receiver. |
2983 const Register scratch = a1; | 2965 const Register scratch = a1; |
2984 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 2966 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
2985 VisitForAccumulatorValue(super_ref->home_object_var()); | 2967 VisitForAccumulatorValue(super_ref->home_object()); |
2986 __ mov(scratch, v0); | 2968 __ mov(scratch, v0); |
2987 VisitForAccumulatorValue(super_ref->this_var()); | 2969 VisitForAccumulatorValue(super_ref->this_var()); |
2988 __ Push(scratch, v0, v0, scratch); | 2970 __ Push(scratch, v0, v0, scratch); |
2989 __ Push(key->value()); | 2971 __ Push(key->value()); |
2990 | 2972 |
2991 // Stack here: | 2973 // Stack here: |
2992 // - home_object | 2974 // - home_object |
2993 // - this (receiver) | 2975 // - this (receiver) |
2994 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2976 // - this (receiver) <-- LoadFromSuper will pop here and below. |
2995 // - home_object | 2977 // - home_object |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3033 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 3015 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
3034 Expression* callee = expr->expression(); | 3016 Expression* callee = expr->expression(); |
3035 DCHECK(callee->IsProperty()); | 3017 DCHECK(callee->IsProperty()); |
3036 Property* prop = callee->AsProperty(); | 3018 Property* prop = callee->AsProperty(); |
3037 DCHECK(prop->IsSuperAccess()); | 3019 DCHECK(prop->IsSuperAccess()); |
3038 | 3020 |
3039 SetSourcePosition(prop->position()); | 3021 SetSourcePosition(prop->position()); |
3040 // Load the function from the receiver. | 3022 // Load the function from the receiver. |
3041 const Register scratch = a1; | 3023 const Register scratch = a1; |
3042 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); | 3024 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); |
3043 VisitForAccumulatorValue(super_ref->home_object_var()); | 3025 VisitForAccumulatorValue(super_ref->home_object()); |
3044 __ Move(scratch, v0); | 3026 __ Move(scratch, v0); |
3045 VisitForAccumulatorValue(super_ref->this_var()); | 3027 VisitForAccumulatorValue(super_ref->this_var()); |
3046 __ Push(scratch, v0, v0, scratch); | 3028 __ Push(scratch, v0, v0, scratch); |
3047 VisitForStackValue(prop->key()); | 3029 VisitForStackValue(prop->key()); |
3048 | 3030 |
3049 // Stack here: | 3031 // Stack here: |
3050 // - home_object | 3032 // - home_object |
3051 // - this (receiver) | 3033 // - this (receiver) |
3052 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 3034 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
3053 // - home_object | 3035 // - home_object |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4924 // Put the object both on the stack and in the register. | 4906 // Put the object both on the stack and in the register. |
4925 VisitForStackValue(prop->obj()); | 4907 VisitForStackValue(prop->obj()); |
4926 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 4908 __ lw(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
4927 EmitNamedPropertyLoad(prop); | 4909 EmitNamedPropertyLoad(prop); |
4928 break; | 4910 break; |
4929 } | 4911 } |
4930 | 4912 |
4931 case NAMED_SUPER_PROPERTY: { | 4913 case NAMED_SUPER_PROPERTY: { |
4932 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 4914 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
4933 VisitForAccumulatorValue( | 4915 VisitForAccumulatorValue( |
4934 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 4916 prop->obj()->AsSuperPropertyReference()->home_object()); |
4935 __ Push(result_register()); | 4917 __ Push(result_register()); |
4936 const Register scratch = a1; | 4918 const Register scratch = a1; |
4937 __ lw(scratch, MemOperand(sp, kPointerSize)); | 4919 __ lw(scratch, MemOperand(sp, kPointerSize)); |
4938 __ Push(scratch, result_register()); | 4920 __ Push(scratch, result_register()); |
4939 EmitNamedSuperPropertyLoad(prop); | 4921 EmitNamedSuperPropertyLoad(prop); |
4940 break; | 4922 break; |
4941 } | 4923 } |
4942 | 4924 |
4943 case KEYED_SUPER_PROPERTY: { | 4925 case KEYED_SUPER_PROPERTY: { |
4944 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); | 4926 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); |
4945 VisitForAccumulatorValue( | 4927 VisitForAccumulatorValue( |
4946 prop->obj()->AsSuperPropertyReference()->home_object_var()); | 4928 prop->obj()->AsSuperPropertyReference()->home_object()); |
4947 const Register scratch = a1; | 4929 const Register scratch = a1; |
4948 const Register scratch1 = t0; | 4930 const Register scratch1 = t0; |
4949 __ Move(scratch, result_register()); | 4931 __ Move(scratch, result_register()); |
4950 VisitForAccumulatorValue(prop->key()); | 4932 VisitForAccumulatorValue(prop->key()); |
4951 __ Push(scratch, result_register()); | 4933 __ Push(scratch, result_register()); |
4952 __ lw(scratch1, MemOperand(sp, 2 * kPointerSize)); | 4934 __ lw(scratch1, MemOperand(sp, 2 * kPointerSize)); |
4953 __ Push(scratch1, scratch, result_register()); | 4935 __ Push(scratch1, scratch, result_register()); |
4954 EmitKeyedSuperPropertyLoad(prop); | 4936 EmitKeyedSuperPropertyLoad(prop); |
4955 break; | 4937 break; |
4956 } | 4938 } |
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5558 reinterpret_cast<uint32_t>( | 5540 reinterpret_cast<uint32_t>( |
5559 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5541 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5560 return OSR_AFTER_STACK_CHECK; | 5542 return OSR_AFTER_STACK_CHECK; |
5561 } | 5543 } |
5562 | 5544 |
5563 | 5545 |
5564 } // namespace internal | 5546 } // namespace internal |
5565 } // namespace v8 | 5547 } // namespace v8 |
5566 | 5548 |
5567 #endif // V8_TARGET_ARCH_MIPS | 5549 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |