OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 } else if (FLAG_debug_code) { | 240 } else if (FLAG_debug_code) { |
241 Label done; | 241 Label done; |
242 __ JumpIfInNewSpace(cp, r3, &done); | 242 __ JumpIfInNewSpace(cp, r3, &done); |
243 __ Abort(kExpectedNewSpaceObject); | 243 __ Abort(kExpectedNewSpaceObject); |
244 __ bind(&done); | 244 __ bind(&done); |
245 } | 245 } |
246 } | 246 } |
247 } | 247 } |
248 } | 248 } |
249 | 249 |
250 Variable* home_object_var = scope()->home_object_var(); | |
251 if (home_object_var != nullptr) { | |
252 __ Push(r4); | |
253 } | |
254 | |
255 ArgumentsAccessStub::HasNewTarget has_new_target = | 250 ArgumentsAccessStub::HasNewTarget has_new_target = |
256 IsSubclassConstructor(info->function()->kind()) | 251 IsSubclassConstructor(info->function()->kind()) |
257 ? ArgumentsAccessStub::HAS_NEW_TARGET | 252 ? ArgumentsAccessStub::HAS_NEW_TARGET |
258 : ArgumentsAccessStub::NO_NEW_TARGET; | 253 : ArgumentsAccessStub::NO_NEW_TARGET; |
259 | 254 |
260 // Possibly allocate RestParameters | 255 // Possibly allocate RestParameters |
261 int rest_index; | 256 int rest_index; |
262 Variable* rest_param = scope()->rest_parameter(&rest_index); | 257 Variable* rest_param = scope()->rest_parameter(&rest_index); |
263 if (rest_param) { | 258 if (rest_param) { |
264 Comment cmnt(masm_, "[ Allocate rest parameter array"); | 259 Comment cmnt(masm_, "[ Allocate rest parameter array"); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; | 305 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; |
311 } else { | 306 } else { |
312 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; | 307 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; |
313 } | 308 } |
314 ArgumentsAccessStub stub(isolate(), type, has_new_target); | 309 ArgumentsAccessStub stub(isolate(), type, has_new_target); |
315 __ CallStub(&stub); | 310 __ CallStub(&stub); |
316 | 311 |
317 SetVar(arguments, r3, r4, r5); | 312 SetVar(arguments, r3, r4, r5); |
318 } | 313 } |
319 | 314 |
320 // Possibly set up a local binding to the [[HomeObject]]. | |
321 if (home_object_var != nullptr) { | |
322 Comment cmnt(masm_, "[ Home object"); | |
323 __ Pop(LoadDescriptor::ReceiverRegister()); | |
324 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | |
325 __ Move(LoadDescriptor::NameRegister(), home_object_symbol); | |
326 __ mov(LoadDescriptor::SlotRegister(), | |
327 Operand(SmiFromSlot(function()->HomeObjectFeedbackSlot()))); | |
328 CallLoadIC(NOT_CONTEXTUAL); | |
329 | |
330 SetVar(home_object_var, r3, r4, r5); | |
331 } | |
332 | |
333 if (FLAG_trace) { | 315 if (FLAG_trace) { |
334 __ CallRuntime(Runtime::kTraceEnter, 0); | 316 __ CallRuntime(Runtime::kTraceEnter, 0); |
335 } | 317 } |
336 | 318 |
337 // Visit the declarations and body unless there is an illegal | 319 // Visit the declarations and body unless there is an illegal |
338 // redeclaration. | 320 // redeclaration. |
339 if (scope()->HasIllegalRedeclaration()) { | 321 if (scope()->HasIllegalRedeclaration()) { |
340 Comment cmnt(masm_, "[ Declarations"); | 322 Comment cmnt(masm_, "[ Declarations"); |
341 scope()->VisitIllegalRedeclaration(this); | 323 scope()->VisitIllegalRedeclaration(this); |
342 | 324 |
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1950 // We need the receiver both on the stack and in the register. | 1932 // We need the receiver both on the stack and in the register. |
1951 VisitForStackValue(property->obj()); | 1933 VisitForStackValue(property->obj()); |
1952 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 1934 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
1953 } else { | 1935 } else { |
1954 VisitForStackValue(property->obj()); | 1936 VisitForStackValue(property->obj()); |
1955 } | 1937 } |
1956 break; | 1938 break; |
1957 case NAMED_SUPER_PROPERTY: | 1939 case NAMED_SUPER_PROPERTY: |
1958 VisitForStackValue(property->obj()->AsSuperReference()->this_var()); | 1940 VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
1959 VisitForAccumulatorValue( | 1941 VisitForAccumulatorValue( |
1960 property->obj()->AsSuperReference()->home_object_var()); | 1942 property->obj()->AsSuperReference()->home_object()); |
1961 __ Push(result_register()); | 1943 __ Push(result_register()); |
1962 if (expr->is_compound()) { | 1944 if (expr->is_compound()) { |
1963 const Register scratch = r4; | 1945 const Register scratch = r4; |
1964 __ LoadP(scratch, MemOperand(sp, kPointerSize)); | 1946 __ LoadP(scratch, MemOperand(sp, kPointerSize)); |
1965 __ Push(scratch, result_register()); | 1947 __ Push(scratch, result_register()); |
1966 } | 1948 } |
1967 break; | 1949 break; |
1968 case KEYED_SUPER_PROPERTY: { | 1950 case KEYED_SUPER_PROPERTY: { |
1969 const Register scratch = r4; | 1951 const Register scratch = r4; |
1970 VisitForStackValue(property->obj()->AsSuperReference()->this_var()); | 1952 VisitForStackValue(property->obj()->AsSuperReference()->this_var()); |
1971 VisitForAccumulatorValue( | 1953 VisitForAccumulatorValue( |
1972 property->obj()->AsSuperReference()->home_object_var()); | 1954 property->obj()->AsSuperReference()->home_object()); |
1973 __ mr(scratch, result_register()); | 1955 __ mr(scratch, result_register()); |
1974 VisitForAccumulatorValue(property->key()); | 1956 VisitForAccumulatorValue(property->key()); |
1975 __ Push(scratch, result_register()); | 1957 __ Push(scratch, result_register()); |
1976 if (expr->is_compound()) { | 1958 if (expr->is_compound()) { |
1977 const Register scratch1 = r5; | 1959 const Register scratch1 = r5; |
1978 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize)); | 1960 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize)); |
1979 __ Push(scratch1, scratch, result_register()); | 1961 __ Push(scratch1, scratch, result_register()); |
1980 } | 1962 } |
1981 break; | 1963 break; |
1982 } | 1964 } |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2642 __ pop(StoreDescriptor::ValueRegister()); // Restore value. | 2624 __ pop(StoreDescriptor::ValueRegister()); // Restore value. |
2643 __ mov(StoreDescriptor::NameRegister(), | 2625 __ mov(StoreDescriptor::NameRegister(), |
2644 Operand(prop->key()->AsLiteral()->value())); | 2626 Operand(prop->key()->AsLiteral()->value())); |
2645 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2627 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2646 CallStoreIC(); | 2628 CallStoreIC(); |
2647 break; | 2629 break; |
2648 } | 2630 } |
2649 case NAMED_SUPER_PROPERTY: { | 2631 case NAMED_SUPER_PROPERTY: { |
2650 __ Push(r3); | 2632 __ Push(r3); |
2651 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | 2633 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
2652 VisitForAccumulatorValue( | 2634 VisitForAccumulatorValue(prop->obj()->AsSuperReference()->home_object()); |
2653 prop->obj()->AsSuperReference()->home_object_var()); | |
2654 // stack: value, this; r3: home_object | 2635 // stack: value, this; r3: home_object |
2655 Register scratch = r5; | 2636 Register scratch = r5; |
2656 Register scratch2 = r6; | 2637 Register scratch2 = r6; |
2657 __ mr(scratch, result_register()); // home_object | 2638 __ mr(scratch, result_register()); // home_object |
2658 __ LoadP(r3, MemOperand(sp, kPointerSize)); // value | 2639 __ LoadP(r3, MemOperand(sp, kPointerSize)); // value |
2659 __ LoadP(scratch2, MemOperand(sp, 0)); // this | 2640 __ LoadP(scratch2, MemOperand(sp, 0)); // this |
2660 __ StoreP(scratch2, MemOperand(sp, kPointerSize)); // this | 2641 __ StoreP(scratch2, MemOperand(sp, kPointerSize)); // this |
2661 __ StoreP(scratch, MemOperand(sp, 0)); // home_object | 2642 __ StoreP(scratch, MemOperand(sp, 0)); // home_object |
2662 // stack: this, home_object; r3: value | 2643 // stack: this, home_object; r3: value |
2663 EmitNamedSuperPropertyStore(prop); | 2644 EmitNamedSuperPropertyStore(prop); |
2664 break; | 2645 break; |
2665 } | 2646 } |
2666 case KEYED_SUPER_PROPERTY: { | 2647 case KEYED_SUPER_PROPERTY: { |
2667 __ Push(r3); | 2648 __ Push(r3); |
2668 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | 2649 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
2669 VisitForStackValue(prop->obj()->AsSuperReference()->home_object_var()); | 2650 VisitForStackValue(prop->obj()->AsSuperReference()->home_object()); |
2670 VisitForAccumulatorValue(prop->key()); | 2651 VisitForAccumulatorValue(prop->key()); |
2671 Register scratch = r5; | 2652 Register scratch = r5; |
2672 Register scratch2 = r6; | 2653 Register scratch2 = r6; |
2673 __ LoadP(scratch2, MemOperand(sp, 2 * kPointerSize)); // value | 2654 __ LoadP(scratch2, MemOperand(sp, 2 * kPointerSize)); // value |
2674 // stack: value, this, home_object; r3: key, r6: value | 2655 // stack: value, this, home_object; r3: key, r6: value |
2675 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // this | 2656 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // this |
2676 __ StoreP(scratch, MemOperand(sp, 2 * kPointerSize)); | 2657 __ StoreP(scratch, MemOperand(sp, 2 * kPointerSize)); |
2677 __ LoadP(scratch, MemOperand(sp, 0)); // home_object | 2658 __ LoadP(scratch, MemOperand(sp, 0)); // home_object |
2678 __ StoreP(scratch, MemOperand(sp, kPointerSize)); | 2659 __ StoreP(scratch, MemOperand(sp, kPointerSize)); |
2679 __ StoreP(r3, MemOperand(sp, 0)); | 2660 __ StoreP(r3, MemOperand(sp, 0)); |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2883 Comment cmnt(masm_, "[ Property"); | 2864 Comment cmnt(masm_, "[ Property"); |
2884 Expression* key = expr->key(); | 2865 Expression* key = expr->key(); |
2885 | 2866 |
2886 if (key->IsPropertyName()) { | 2867 if (key->IsPropertyName()) { |
2887 if (!expr->IsSuperAccess()) { | 2868 if (!expr->IsSuperAccess()) { |
2888 VisitForAccumulatorValue(expr->obj()); | 2869 VisitForAccumulatorValue(expr->obj()); |
2889 __ Move(LoadDescriptor::ReceiverRegister(), r3); | 2870 __ Move(LoadDescriptor::ReceiverRegister(), r3); |
2890 EmitNamedPropertyLoad(expr); | 2871 EmitNamedPropertyLoad(expr); |
2891 } else { | 2872 } else { |
2892 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); | 2873 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
2893 VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); | 2874 VisitForStackValue(expr->obj()->AsSuperReference()->home_object()); |
2894 EmitNamedSuperPropertyLoad(expr); | 2875 EmitNamedSuperPropertyLoad(expr); |
2895 } | 2876 } |
2896 } else { | 2877 } else { |
2897 if (!expr->IsSuperAccess()) { | 2878 if (!expr->IsSuperAccess()) { |
2898 VisitForStackValue(expr->obj()); | 2879 VisitForStackValue(expr->obj()); |
2899 VisitForAccumulatorValue(expr->key()); | 2880 VisitForAccumulatorValue(expr->key()); |
2900 __ Move(LoadDescriptor::NameRegister(), r3); | 2881 __ Move(LoadDescriptor::NameRegister(), r3); |
2901 __ pop(LoadDescriptor::ReceiverRegister()); | 2882 __ pop(LoadDescriptor::ReceiverRegister()); |
2902 EmitKeyedPropertyLoad(expr); | 2883 EmitKeyedPropertyLoad(expr); |
2903 } else { | 2884 } else { |
2904 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); | 2885 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); |
2905 VisitForStackValue(expr->obj()->AsSuperReference()->home_object_var()); | 2886 VisitForStackValue(expr->obj()->AsSuperReference()->home_object()); |
2906 VisitForStackValue(expr->key()); | 2887 VisitForStackValue(expr->key()); |
2907 EmitKeyedSuperPropertyLoad(expr); | 2888 EmitKeyedSuperPropertyLoad(expr); |
2908 } | 2889 } |
2909 } | 2890 } |
2910 PrepareForBailoutForId(expr->LoadId(), TOS_REG); | 2891 PrepareForBailoutForId(expr->LoadId(), TOS_REG); |
2911 context()->Plug(r3); | 2892 context()->Plug(r3); |
2912 } | 2893 } |
2913 | 2894 |
2914 | 2895 |
2915 void FullCodeGenerator::CallIC(Handle<Code> code, TypeFeedbackId ast_id) { | 2896 void FullCodeGenerator::CallIC(Handle<Code> code, TypeFeedbackId ast_id) { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2958 DCHECK(callee->IsProperty()); | 2939 DCHECK(callee->IsProperty()); |
2959 Property* prop = callee->AsProperty(); | 2940 Property* prop = callee->AsProperty(); |
2960 DCHECK(prop->IsSuperAccess()); | 2941 DCHECK(prop->IsSuperAccess()); |
2961 | 2942 |
2962 SetSourcePosition(prop->position()); | 2943 SetSourcePosition(prop->position()); |
2963 Literal* key = prop->key()->AsLiteral(); | 2944 Literal* key = prop->key()->AsLiteral(); |
2964 DCHECK(!key->value()->IsSmi()); | 2945 DCHECK(!key->value()->IsSmi()); |
2965 // Load the function from the receiver. | 2946 // Load the function from the receiver. |
2966 const Register scratch = r4; | 2947 const Register scratch = r4; |
2967 SuperReference* super_ref = prop->obj()->AsSuperReference(); | 2948 SuperReference* super_ref = prop->obj()->AsSuperReference(); |
2968 VisitForAccumulatorValue(super_ref->home_object_var()); | 2949 VisitForAccumulatorValue(super_ref->home_object()); |
2969 __ mr(scratch, r3); | 2950 __ mr(scratch, r3); |
2970 VisitForAccumulatorValue(super_ref->this_var()); | 2951 VisitForAccumulatorValue(super_ref->this_var()); |
2971 __ Push(scratch, r3, r3, scratch); | 2952 __ Push(scratch, r3, r3, scratch); |
2972 __ Push(key->value()); | 2953 __ Push(key->value()); |
2973 | 2954 |
2974 // Stack here: | 2955 // Stack here: |
2975 // - home_object | 2956 // - home_object |
2976 // - this (receiver) | 2957 // - this (receiver) |
2977 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2958 // - this (receiver) <-- LoadFromSuper will pop here and below. |
2978 // - home_object | 2959 // - home_object |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3015 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { | 2996 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { |
3016 Expression* callee = expr->expression(); | 2997 Expression* callee = expr->expression(); |
3017 DCHECK(callee->IsProperty()); | 2998 DCHECK(callee->IsProperty()); |
3018 Property* prop = callee->AsProperty(); | 2999 Property* prop = callee->AsProperty(); |
3019 DCHECK(prop->IsSuperAccess()); | 3000 DCHECK(prop->IsSuperAccess()); |
3020 | 3001 |
3021 SetSourcePosition(prop->position()); | 3002 SetSourcePosition(prop->position()); |
3022 // Load the function from the receiver. | 3003 // Load the function from the receiver. |
3023 const Register scratch = r4; | 3004 const Register scratch = r4; |
3024 SuperReference* super_ref = prop->obj()->AsSuperReference(); | 3005 SuperReference* super_ref = prop->obj()->AsSuperReference(); |
3025 VisitForAccumulatorValue(super_ref->home_object_var()); | 3006 VisitForAccumulatorValue(super_ref->home_object()); |
3026 __ mr(scratch, r3); | 3007 __ mr(scratch, r3); |
3027 VisitForAccumulatorValue(super_ref->this_var()); | 3008 VisitForAccumulatorValue(super_ref->this_var()); |
3028 __ Push(scratch, r3, r3, scratch); | 3009 __ Push(scratch, r3, r3, scratch); |
3029 VisitForStackValue(prop->key()); | 3010 VisitForStackValue(prop->key()); |
3030 | 3011 |
3031 // Stack here: | 3012 // Stack here: |
3032 // - home_object | 3013 // - home_object |
3033 // - this (receiver) | 3014 // - this (receiver) |
3034 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 3015 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
3035 // - home_object | 3016 // - home_object |
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4887 // Put the object both on the stack and in the register. | 4868 // Put the object both on the stack and in the register. |
4888 VisitForStackValue(prop->obj()); | 4869 VisitForStackValue(prop->obj()); |
4889 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); | 4870 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); |
4890 EmitNamedPropertyLoad(prop); | 4871 EmitNamedPropertyLoad(prop); |
4891 break; | 4872 break; |
4892 } | 4873 } |
4893 | 4874 |
4894 case NAMED_SUPER_PROPERTY: { | 4875 case NAMED_SUPER_PROPERTY: { |
4895 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | 4876 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
4896 VisitForAccumulatorValue( | 4877 VisitForAccumulatorValue( |
4897 prop->obj()->AsSuperReference()->home_object_var()); | 4878 prop->obj()->AsSuperReference()->home_object()); |
4898 __ Push(result_register()); | 4879 __ Push(result_register()); |
4899 const Register scratch = r4; | 4880 const Register scratch = r4; |
4900 __ LoadP(scratch, MemOperand(sp, kPointerSize)); | 4881 __ LoadP(scratch, MemOperand(sp, kPointerSize)); |
4901 __ Push(scratch, result_register()); | 4882 __ Push(scratch, result_register()); |
4902 EmitNamedSuperPropertyLoad(prop); | 4883 EmitNamedSuperPropertyLoad(prop); |
4903 break; | 4884 break; |
4904 } | 4885 } |
4905 | 4886 |
4906 case KEYED_SUPER_PROPERTY: { | 4887 case KEYED_SUPER_PROPERTY: { |
4907 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); | 4888 VisitForStackValue(prop->obj()->AsSuperReference()->this_var()); |
4908 VisitForAccumulatorValue( | 4889 VisitForAccumulatorValue( |
4909 prop->obj()->AsSuperReference()->home_object_var()); | 4890 prop->obj()->AsSuperReference()->home_object()); |
4910 const Register scratch = r4; | 4891 const Register scratch = r4; |
4911 const Register scratch1 = r5; | 4892 const Register scratch1 = r5; |
4912 __ mr(scratch, result_register()); | 4893 __ mr(scratch, result_register()); |
4913 VisitForAccumulatorValue(prop->key()); | 4894 VisitForAccumulatorValue(prop->key()); |
4914 __ Push(scratch, result_register()); | 4895 __ Push(scratch, result_register()); |
4915 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize)); | 4896 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize)); |
4916 __ Push(scratch1, scratch, result_register()); | 4897 __ Push(scratch1, scratch, result_register()); |
4917 EmitKeyedSuperPropertyLoad(prop); | 4898 EmitKeyedSuperPropertyLoad(prop); |
4918 break; | 4899 break; |
4919 } | 4900 } |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5516 return ON_STACK_REPLACEMENT; | 5497 return ON_STACK_REPLACEMENT; |
5517 } | 5498 } |
5518 | 5499 |
5519 DCHECK(interrupt_address == | 5500 DCHECK(interrupt_address == |
5520 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5501 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5521 return OSR_AFTER_STACK_CHECK; | 5502 return OSR_AFTER_STACK_CHECK; |
5522 } | 5503 } |
5523 } // namespace internal | 5504 } // namespace internal |
5524 } // namespace v8 | 5505 } // namespace v8 |
5525 #endif // V8_TARGET_ARCH_PPC | 5506 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |