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