Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(87)

Side by Side Diff: src/ppc/full-codegen-ppc.cc

Issue 1154103005: Refactor lexical home object binding (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/parser.cc ('k') | src/scopes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Possibly set up a local binding to the this function which is used in 250 // Possibly set up a local binding to the this function which is used in
256 // derived constructors with super calls. 251 // derived constructors with super calls.
257 Variable* this_function_var = scope()->this_function_var(); 252 Variable* this_function_var = scope()->this_function_var();
258 if (this_function_var != nullptr) { 253 if (this_function_var != nullptr) {
259 Comment cmnt(masm_, "[ This function"); 254 Comment cmnt(masm_, "[ This function");
260 SetVar(this_function_var, r4, r3, r5); 255 SetVar(this_function_var, r4, r3, r5);
261 } 256 }
262 257
263 Variable* new_target_var = scope()->new_target_var(); 258 Variable* new_target_var = scope()->new_target_var();
264 if (new_target_var != nullptr) { 259 if (new_target_var != nullptr) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 323 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
329 } else { 324 } else {
330 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 325 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
331 } 326 }
332 ArgumentsAccessStub stub(isolate(), type, has_new_target); 327 ArgumentsAccessStub stub(isolate(), type, has_new_target);
333 __ CallStub(&stub); 328 __ CallStub(&stub);
334 329
335 SetVar(arguments, r3, r4, r5); 330 SetVar(arguments, r3, r4, r5);
336 } 331 }
337 332
338 // Possibly set up a local binding to the [[HomeObject]].
339 if (home_object_var != nullptr) {
340 Comment cmnt(masm_, "[ Home object");
341 __ Pop(LoadDescriptor::ReceiverRegister());
342 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol());
343 __ Move(LoadDescriptor::NameRegister(), home_object_symbol);
344 __ mov(LoadDescriptor::SlotRegister(),
345 Operand(SmiFromSlot(function()->HomeObjectFeedbackSlot())));
346 CallLoadIC(NOT_CONTEXTUAL);
347
348 SetVar(home_object_var, r3, r4, r5);
349 }
350
351 if (FLAG_trace) { 333 if (FLAG_trace) {
352 __ CallRuntime(Runtime::kTraceEnter, 0); 334 __ CallRuntime(Runtime::kTraceEnter, 0);
353 } 335 }
354 336
355 // Visit the declarations and body unless there is an illegal 337 // Visit the declarations and body unless there is an illegal
356 // redeclaration. 338 // redeclaration.
357 if (scope()->HasIllegalRedeclaration()) { 339 if (scope()->HasIllegalRedeclaration()) {
358 Comment cmnt(masm_, "[ Declarations"); 340 Comment cmnt(masm_, "[ Declarations");
359 scope()->VisitIllegalRedeclaration(this); 341 scope()->VisitIllegalRedeclaration(this);
360 342
(...skipping 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after
1974 VisitForStackValue(property->obj()); 1956 VisitForStackValue(property->obj());
1975 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 1957 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
1976 } else { 1958 } else {
1977 VisitForStackValue(property->obj()); 1959 VisitForStackValue(property->obj());
1978 } 1960 }
1979 break; 1961 break;
1980 case NAMED_SUPER_PROPERTY: 1962 case NAMED_SUPER_PROPERTY:
1981 VisitForStackValue( 1963 VisitForStackValue(
1982 property->obj()->AsSuperPropertyReference()->this_var()); 1964 property->obj()->AsSuperPropertyReference()->this_var());
1983 VisitForAccumulatorValue( 1965 VisitForAccumulatorValue(
1984 property->obj()->AsSuperPropertyReference()->home_object_var()); 1966 property->obj()->AsSuperPropertyReference()->home_object());
1985 __ Push(result_register()); 1967 __ Push(result_register());
1986 if (expr->is_compound()) { 1968 if (expr->is_compound()) {
1987 const Register scratch = r4; 1969 const Register scratch = r4;
1988 __ LoadP(scratch, MemOperand(sp, kPointerSize)); 1970 __ LoadP(scratch, MemOperand(sp, kPointerSize));
1989 __ Push(scratch, result_register()); 1971 __ Push(scratch, result_register());
1990 } 1972 }
1991 break; 1973 break;
1992 case KEYED_SUPER_PROPERTY: { 1974 case KEYED_SUPER_PROPERTY: {
1993 const Register scratch = r4; 1975 const Register scratch = r4;
1994 VisitForStackValue( 1976 VisitForStackValue(
1995 property->obj()->AsSuperPropertyReference()->this_var()); 1977 property->obj()->AsSuperPropertyReference()->this_var());
1996 VisitForAccumulatorValue( 1978 VisitForAccumulatorValue(
1997 property->obj()->AsSuperPropertyReference()->home_object_var()); 1979 property->obj()->AsSuperPropertyReference()->home_object());
1998 __ mr(scratch, result_register()); 1980 __ mr(scratch, result_register());
1999 VisitForAccumulatorValue(property->key()); 1981 VisitForAccumulatorValue(property->key());
2000 __ Push(scratch, result_register()); 1982 __ Push(scratch, result_register());
2001 if (expr->is_compound()) { 1983 if (expr->is_compound()) {
2002 const Register scratch1 = r5; 1984 const Register scratch1 = r5;
2003 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize)); 1985 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize));
2004 __ Push(scratch1, scratch, result_register()); 1986 __ Push(scratch1, scratch, result_register());
2005 } 1987 }
2006 break; 1988 break;
2007 } 1989 }
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after
2672 __ mov(StoreDescriptor::NameRegister(), 2654 __ mov(StoreDescriptor::NameRegister(),
2673 Operand(prop->key()->AsLiteral()->value())); 2655 Operand(prop->key()->AsLiteral()->value()));
2674 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2656 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2675 CallStoreIC(); 2657 CallStoreIC();
2676 break; 2658 break;
2677 } 2659 }
2678 case NAMED_SUPER_PROPERTY: { 2660 case NAMED_SUPER_PROPERTY: {
2679 __ Push(r3); 2661 __ Push(r3);
2680 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 2662 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
2681 VisitForAccumulatorValue( 2663 VisitForAccumulatorValue(
2682 prop->obj()->AsSuperPropertyReference()->home_object_var()); 2664 prop->obj()->AsSuperPropertyReference()->home_object());
2683 // stack: value, this; r3: home_object 2665 // stack: value, this; r3: home_object
2684 Register scratch = r5; 2666 Register scratch = r5;
2685 Register scratch2 = r6; 2667 Register scratch2 = r6;
2686 __ mr(scratch, result_register()); // home_object 2668 __ mr(scratch, result_register()); // home_object
2687 __ LoadP(r3, MemOperand(sp, kPointerSize)); // value 2669 __ LoadP(r3, MemOperand(sp, kPointerSize)); // value
2688 __ LoadP(scratch2, MemOperand(sp, 0)); // this 2670 __ LoadP(scratch2, MemOperand(sp, 0)); // this
2689 __ StoreP(scratch2, MemOperand(sp, kPointerSize)); // this 2671 __ StoreP(scratch2, MemOperand(sp, kPointerSize)); // this
2690 __ StoreP(scratch, MemOperand(sp, 0)); // home_object 2672 __ StoreP(scratch, MemOperand(sp, 0)); // home_object
2691 // stack: this, home_object; r3: value 2673 // stack: this, home_object; r3: value
2692 EmitNamedSuperPropertyStore(prop); 2674 EmitNamedSuperPropertyStore(prop);
2693 break; 2675 break;
2694 } 2676 }
2695 case KEYED_SUPER_PROPERTY: { 2677 case KEYED_SUPER_PROPERTY: {
2696 __ Push(r3); 2678 __ Push(r3);
2697 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 2679 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
2698 VisitForStackValue( 2680 VisitForStackValue(
2699 prop->obj()->AsSuperPropertyReference()->home_object_var()); 2681 prop->obj()->AsSuperPropertyReference()->home_object());
2700 VisitForAccumulatorValue(prop->key()); 2682 VisitForAccumulatorValue(prop->key());
2701 Register scratch = r5; 2683 Register scratch = r5;
2702 Register scratch2 = r6; 2684 Register scratch2 = r6;
2703 __ LoadP(scratch2, MemOperand(sp, 2 * kPointerSize)); // value 2685 __ LoadP(scratch2, MemOperand(sp, 2 * kPointerSize)); // value
2704 // stack: value, this, home_object; r3: key, r6: value 2686 // stack: value, this, home_object; r3: key, r6: value
2705 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // this 2687 __ LoadP(scratch, MemOperand(sp, kPointerSize)); // this
2706 __ StoreP(scratch, MemOperand(sp, 2 * kPointerSize)); 2688 __ StoreP(scratch, MemOperand(sp, 2 * kPointerSize));
2707 __ LoadP(scratch, MemOperand(sp, 0)); // home_object 2689 __ LoadP(scratch, MemOperand(sp, 0)); // home_object
2708 __ StoreP(scratch, MemOperand(sp, kPointerSize)); 2690 __ StoreP(scratch, MemOperand(sp, kPointerSize));
2709 __ StoreP(r3, MemOperand(sp, 0)); 2691 __ StoreP(r3, MemOperand(sp, 0));
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2914 Expression* key = expr->key(); 2896 Expression* key = expr->key();
2915 2897
2916 if (key->IsPropertyName()) { 2898 if (key->IsPropertyName()) {
2917 if (!expr->IsSuperAccess()) { 2899 if (!expr->IsSuperAccess()) {
2918 VisitForAccumulatorValue(expr->obj()); 2900 VisitForAccumulatorValue(expr->obj());
2919 __ Move(LoadDescriptor::ReceiverRegister(), r3); 2901 __ Move(LoadDescriptor::ReceiverRegister(), r3);
2920 EmitNamedPropertyLoad(expr); 2902 EmitNamedPropertyLoad(expr);
2921 } else { 2903 } else {
2922 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); 2904 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var());
2923 VisitForStackValue( 2905 VisitForStackValue(
2924 expr->obj()->AsSuperPropertyReference()->home_object_var()); 2906 expr->obj()->AsSuperPropertyReference()->home_object());
2925 EmitNamedSuperPropertyLoad(expr); 2907 EmitNamedSuperPropertyLoad(expr);
2926 } 2908 }
2927 } else { 2909 } else {
2928 if (!expr->IsSuperAccess()) { 2910 if (!expr->IsSuperAccess()) {
2929 VisitForStackValue(expr->obj()); 2911 VisitForStackValue(expr->obj());
2930 VisitForAccumulatorValue(expr->key()); 2912 VisitForAccumulatorValue(expr->key());
2931 __ Move(LoadDescriptor::NameRegister(), r3); 2913 __ Move(LoadDescriptor::NameRegister(), r3);
2932 __ pop(LoadDescriptor::ReceiverRegister()); 2914 __ pop(LoadDescriptor::ReceiverRegister());
2933 EmitKeyedPropertyLoad(expr); 2915 EmitKeyedPropertyLoad(expr);
2934 } else { 2916 } else {
2935 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); 2917 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var());
2936 VisitForStackValue( 2918 VisitForStackValue(
2937 expr->obj()->AsSuperPropertyReference()->home_object_var()); 2919 expr->obj()->AsSuperPropertyReference()->home_object());
2938 VisitForStackValue(expr->key()); 2920 VisitForStackValue(expr->key());
2939 EmitKeyedSuperPropertyLoad(expr); 2921 EmitKeyedSuperPropertyLoad(expr);
2940 } 2922 }
2941 } 2923 }
2942 PrepareForBailoutForId(expr->LoadId(), TOS_REG); 2924 PrepareForBailoutForId(expr->LoadId(), TOS_REG);
2943 context()->Plug(r3); 2925 context()->Plug(r3);
2944 } 2926 }
2945 2927
2946 2928
2947 void FullCodeGenerator::CallIC(Handle<Code> code, TypeFeedbackId ast_id) { 2929 void FullCodeGenerator::CallIC(Handle<Code> code, TypeFeedbackId ast_id) {
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2990 DCHECK(callee->IsProperty()); 2972 DCHECK(callee->IsProperty());
2991 Property* prop = callee->AsProperty(); 2973 Property* prop = callee->AsProperty();
2992 DCHECK(prop->IsSuperAccess()); 2974 DCHECK(prop->IsSuperAccess());
2993 2975
2994 SetSourcePosition(prop->position()); 2976 SetSourcePosition(prop->position());
2995 Literal* key = prop->key()->AsLiteral(); 2977 Literal* key = prop->key()->AsLiteral();
2996 DCHECK(!key->value()->IsSmi()); 2978 DCHECK(!key->value()->IsSmi());
2997 // Load the function from the receiver. 2979 // Load the function from the receiver.
2998 const Register scratch = r4; 2980 const Register scratch = r4;
2999 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 2981 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
3000 VisitForAccumulatorValue(super_ref->home_object_var()); 2982 VisitForAccumulatorValue(super_ref->home_object());
3001 __ mr(scratch, r3); 2983 __ mr(scratch, r3);
3002 VisitForAccumulatorValue(super_ref->this_var()); 2984 VisitForAccumulatorValue(super_ref->this_var());
3003 __ Push(scratch, r3, r3, scratch); 2985 __ Push(scratch, r3, r3, scratch);
3004 __ Push(key->value()); 2986 __ Push(key->value());
3005 2987
3006 // Stack here: 2988 // Stack here:
3007 // - home_object 2989 // - home_object
3008 // - this (receiver) 2990 // - this (receiver)
3009 // - this (receiver) <-- LoadFromSuper will pop here and below. 2991 // - this (receiver) <-- LoadFromSuper will pop here and below.
3010 // - home_object 2992 // - home_object
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
3047 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { 3029 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
3048 Expression* callee = expr->expression(); 3030 Expression* callee = expr->expression();
3049 DCHECK(callee->IsProperty()); 3031 DCHECK(callee->IsProperty());
3050 Property* prop = callee->AsProperty(); 3032 Property* prop = callee->AsProperty();
3051 DCHECK(prop->IsSuperAccess()); 3033 DCHECK(prop->IsSuperAccess());
3052 3034
3053 SetSourcePosition(prop->position()); 3035 SetSourcePosition(prop->position());
3054 // Load the function from the receiver. 3036 // Load the function from the receiver.
3055 const Register scratch = r4; 3037 const Register scratch = r4;
3056 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 3038 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
3057 VisitForAccumulatorValue(super_ref->home_object_var()); 3039 VisitForAccumulatorValue(super_ref->home_object());
3058 __ mr(scratch, r3); 3040 __ mr(scratch, r3);
3059 VisitForAccumulatorValue(super_ref->this_var()); 3041 VisitForAccumulatorValue(super_ref->this_var());
3060 __ Push(scratch, r3, r3, scratch); 3042 __ Push(scratch, r3, r3, scratch);
3061 VisitForStackValue(prop->key()); 3043 VisitForStackValue(prop->key());
3062 3044
3063 // Stack here: 3045 // Stack here:
3064 // - home_object 3046 // - home_object
3065 // - this (receiver) 3047 // - this (receiver)
3066 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. 3048 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
3067 // - home_object 3049 // - home_object
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after
4935 // Put the object both on the stack and in the register. 4917 // Put the object both on the stack and in the register.
4936 VisitForStackValue(prop->obj()); 4918 VisitForStackValue(prop->obj());
4937 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 4919 __ LoadP(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
4938 EmitNamedPropertyLoad(prop); 4920 EmitNamedPropertyLoad(prop);
4939 break; 4921 break;
4940 } 4922 }
4941 4923
4942 case NAMED_SUPER_PROPERTY: { 4924 case NAMED_SUPER_PROPERTY: {
4943 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 4925 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
4944 VisitForAccumulatorValue( 4926 VisitForAccumulatorValue(
4945 prop->obj()->AsSuperPropertyReference()->home_object_var()); 4927 prop->obj()->AsSuperPropertyReference()->home_object());
4946 __ Push(result_register()); 4928 __ Push(result_register());
4947 const Register scratch = r4; 4929 const Register scratch = r4;
4948 __ LoadP(scratch, MemOperand(sp, kPointerSize)); 4930 __ LoadP(scratch, MemOperand(sp, kPointerSize));
4949 __ Push(scratch, result_register()); 4931 __ Push(scratch, result_register());
4950 EmitNamedSuperPropertyLoad(prop); 4932 EmitNamedSuperPropertyLoad(prop);
4951 break; 4933 break;
4952 } 4934 }
4953 4935
4954 case KEYED_SUPER_PROPERTY: { 4936 case KEYED_SUPER_PROPERTY: {
4955 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 4937 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
4956 VisitForAccumulatorValue( 4938 VisitForAccumulatorValue(
4957 prop->obj()->AsSuperPropertyReference()->home_object_var()); 4939 prop->obj()->AsSuperPropertyReference()->home_object());
4958 const Register scratch = r4; 4940 const Register scratch = r4;
4959 const Register scratch1 = r5; 4941 const Register scratch1 = r5;
4960 __ mr(scratch, result_register()); 4942 __ mr(scratch, result_register());
4961 VisitForAccumulatorValue(prop->key()); 4943 VisitForAccumulatorValue(prop->key());
4962 __ Push(scratch, result_register()); 4944 __ Push(scratch, result_register());
4963 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize)); 4945 __ LoadP(scratch1, MemOperand(sp, 2 * kPointerSize));
4964 __ Push(scratch1, scratch, result_register()); 4946 __ Push(scratch1, scratch, result_register());
4965 EmitKeyedSuperPropertyLoad(prop); 4947 EmitKeyedSuperPropertyLoad(prop);
4966 break; 4948 break;
4967 } 4949 }
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
5564 return ON_STACK_REPLACEMENT; 5546 return ON_STACK_REPLACEMENT;
5565 } 5547 }
5566 5548
5567 DCHECK(interrupt_address == 5549 DCHECK(interrupt_address ==
5568 isolate->builtins()->OsrAfterStackCheck()->entry()); 5550 isolate->builtins()->OsrAfterStackCheck()->entry());
5569 return OSR_AFTER_STACK_CHECK; 5551 return OSR_AFTER_STACK_CHECK;
5570 } 5552 }
5571 } // namespace internal 5553 } // namespace internal
5572 } // namespace v8 5554 } // namespace v8
5573 #endif // V8_TARGET_ARCH_PPC 5555 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/scopes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698