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

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

Issue 1154103005: Refactor lexical home object binding (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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 | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | src/ast-value-factory.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
2674 __ mov(StoreDescriptor::NameRegister(), 2657 __ mov(StoreDescriptor::NameRegister(),
2675 Operand(prop->key()->AsLiteral()->value())); 2658 Operand(prop->key()->AsLiteral()->value()));
2676 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2659 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2677 CallStoreIC(); 2660 CallStoreIC();
2678 break; 2661 break;
2679 } 2662 }
2680 case NAMED_SUPER_PROPERTY: { 2663 case NAMED_SUPER_PROPERTY: {
2681 __ Push(r0); 2664 __ Push(r0);
2682 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 2665 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
2683 VisitForAccumulatorValue( 2666 VisitForAccumulatorValue(
2684 prop->obj()->AsSuperPropertyReference()->home_object_var()); 2667 prop->obj()->AsSuperPropertyReference()->home_object());
2685 // stack: value, this; r0: home_object 2668 // stack: value, this; r0: home_object
2686 Register scratch = r2; 2669 Register scratch = r2;
2687 Register scratch2 = r3; 2670 Register scratch2 = r3;
2688 __ mov(scratch, result_register()); // home_object 2671 __ mov(scratch, result_register()); // home_object
2689 __ ldr(r0, MemOperand(sp, kPointerSize)); // value 2672 __ ldr(r0, MemOperand(sp, kPointerSize)); // value
2690 __ ldr(scratch2, MemOperand(sp, 0)); // this 2673 __ ldr(scratch2, MemOperand(sp, 0)); // this
2691 __ str(scratch2, MemOperand(sp, kPointerSize)); // this 2674 __ str(scratch2, MemOperand(sp, kPointerSize)); // this
2692 __ str(scratch, MemOperand(sp, 0)); // home_object 2675 __ str(scratch, MemOperand(sp, 0)); // home_object
2693 // stack: this, home_object; r0: value 2676 // stack: this, home_object; r0: value
2694 EmitNamedSuperPropertyStore(prop); 2677 EmitNamedSuperPropertyStore(prop);
2695 break; 2678 break;
2696 } 2679 }
2697 case KEYED_SUPER_PROPERTY: { 2680 case KEYED_SUPER_PROPERTY: {
2698 __ Push(r0); 2681 __ Push(r0);
2699 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 2682 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
2700 VisitForStackValue( 2683 VisitForStackValue(
2701 prop->obj()->AsSuperPropertyReference()->home_object_var()); 2684 prop->obj()->AsSuperPropertyReference()->home_object());
2702 VisitForAccumulatorValue(prop->key()); 2685 VisitForAccumulatorValue(prop->key());
2703 Register scratch = r2; 2686 Register scratch = r2;
2704 Register scratch2 = r3; 2687 Register scratch2 = r3;
2705 __ ldr(scratch2, MemOperand(sp, 2 * kPointerSize)); // value 2688 __ ldr(scratch2, MemOperand(sp, 2 * kPointerSize)); // value
2706 // stack: value, this, home_object; r0: key, r3: value 2689 // stack: value, this, home_object; r0: key, r3: value
2707 __ ldr(scratch, MemOperand(sp, kPointerSize)); // this 2690 __ ldr(scratch, MemOperand(sp, kPointerSize)); // this
2708 __ str(scratch, MemOperand(sp, 2 * kPointerSize)); 2691 __ str(scratch, MemOperand(sp, 2 * kPointerSize));
2709 __ ldr(scratch, MemOperand(sp, 0)); // home_object 2692 __ ldr(scratch, MemOperand(sp, 0)); // home_object
2710 __ str(scratch, MemOperand(sp, kPointerSize)); 2693 __ str(scratch, MemOperand(sp, kPointerSize));
2711 __ str(r0, MemOperand(sp, 0)); 2694 __ str(r0, MemOperand(sp, 0));
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
2917 Expression* key = expr->key(); 2900 Expression* key = expr->key();
2918 2901
2919 if (key->IsPropertyName()) { 2902 if (key->IsPropertyName()) {
2920 if (!expr->IsSuperAccess()) { 2903 if (!expr->IsSuperAccess()) {
2921 VisitForAccumulatorValue(expr->obj()); 2904 VisitForAccumulatorValue(expr->obj());
2922 __ Move(LoadDescriptor::ReceiverRegister(), r0); 2905 __ Move(LoadDescriptor::ReceiverRegister(), r0);
2923 EmitNamedPropertyLoad(expr); 2906 EmitNamedPropertyLoad(expr);
2924 } else { 2907 } else {
2925 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); 2908 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var());
2926 VisitForStackValue( 2909 VisitForStackValue(
2927 expr->obj()->AsSuperPropertyReference()->home_object_var()); 2910 expr->obj()->AsSuperPropertyReference()->home_object());
2928 EmitNamedSuperPropertyLoad(expr); 2911 EmitNamedSuperPropertyLoad(expr);
2929 } 2912 }
2930 } else { 2913 } else {
2931 if (!expr->IsSuperAccess()) { 2914 if (!expr->IsSuperAccess()) {
2932 VisitForStackValue(expr->obj()); 2915 VisitForStackValue(expr->obj());
2933 VisitForAccumulatorValue(expr->key()); 2916 VisitForAccumulatorValue(expr->key());
2934 __ Move(LoadDescriptor::NameRegister(), r0); 2917 __ Move(LoadDescriptor::NameRegister(), r0);
2935 __ pop(LoadDescriptor::ReceiverRegister()); 2918 __ pop(LoadDescriptor::ReceiverRegister());
2936 EmitKeyedPropertyLoad(expr); 2919 EmitKeyedPropertyLoad(expr);
2937 } else { 2920 } else {
2938 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); 2921 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var());
2939 VisitForStackValue( 2922 VisitForStackValue(
2940 expr->obj()->AsSuperPropertyReference()->home_object_var()); 2923 expr->obj()->AsSuperPropertyReference()->home_object());
2941 VisitForStackValue(expr->key()); 2924 VisitForStackValue(expr->key());
2942 EmitKeyedSuperPropertyLoad(expr); 2925 EmitKeyedSuperPropertyLoad(expr);
2943 } 2926 }
2944 } 2927 }
2945 PrepareForBailoutForId(expr->LoadId(), TOS_REG); 2928 PrepareForBailoutForId(expr->LoadId(), TOS_REG);
2946 context()->Plug(r0); 2929 context()->Plug(r0);
2947 } 2930 }
2948 2931
2949 2932
2950 void FullCodeGenerator::CallIC(Handle<Code> code, 2933 void FullCodeGenerator::CallIC(Handle<Code> code,
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
2996 DCHECK(callee->IsProperty()); 2979 DCHECK(callee->IsProperty());
2997 Property* prop = callee->AsProperty(); 2980 Property* prop = callee->AsProperty();
2998 DCHECK(prop->IsSuperAccess()); 2981 DCHECK(prop->IsSuperAccess());
2999 2982
3000 SetSourcePosition(prop->position()); 2983 SetSourcePosition(prop->position());
3001 Literal* key = prop->key()->AsLiteral(); 2984 Literal* key = prop->key()->AsLiteral();
3002 DCHECK(!key->value()->IsSmi()); 2985 DCHECK(!key->value()->IsSmi());
3003 // Load the function from the receiver. 2986 // Load the function from the receiver.
3004 const Register scratch = r1; 2987 const Register scratch = r1;
3005 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 2988 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
3006 VisitForStackValue(super_ref->home_object_var()); 2989 VisitForStackValue(super_ref->home_object());
3007 VisitForAccumulatorValue(super_ref->this_var()); 2990 VisitForAccumulatorValue(super_ref->this_var());
3008 __ Push(r0); 2991 __ Push(r0);
3009 __ Push(r0); 2992 __ Push(r0);
3010 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); 2993 __ ldr(scratch, MemOperand(sp, kPointerSize * 2));
3011 __ Push(scratch); 2994 __ Push(scratch);
3012 __ Push(key->value()); 2995 __ Push(key->value());
3013 2996
3014 // Stack here: 2997 // Stack here:
3015 // - home_object 2998 // - home_object
3016 // - this (receiver) 2999 // - this (receiver)
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
3056 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) { 3039 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
3057 Expression* callee = expr->expression(); 3040 Expression* callee = expr->expression();
3058 DCHECK(callee->IsProperty()); 3041 DCHECK(callee->IsProperty());
3059 Property* prop = callee->AsProperty(); 3042 Property* prop = callee->AsProperty();
3060 DCHECK(prop->IsSuperAccess()); 3043 DCHECK(prop->IsSuperAccess());
3061 3044
3062 SetSourcePosition(prop->position()); 3045 SetSourcePosition(prop->position());
3063 // Load the function from the receiver. 3046 // Load the function from the receiver.
3064 const Register scratch = r1; 3047 const Register scratch = r1;
3065 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 3048 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
3066 VisitForStackValue(super_ref->home_object_var()); 3049 VisitForStackValue(super_ref->home_object());
3067 VisitForAccumulatorValue(super_ref->this_var()); 3050 VisitForAccumulatorValue(super_ref->this_var());
3068 __ Push(r0); 3051 __ Push(r0);
3069 __ Push(r0); 3052 __ Push(r0);
3070 __ ldr(scratch, MemOperand(sp, kPointerSize * 2)); 3053 __ ldr(scratch, MemOperand(sp, kPointerSize * 2));
3071 __ Push(scratch); 3054 __ Push(scratch);
3072 VisitForStackValue(prop->key()); 3055 VisitForStackValue(prop->key());
3073 3056
3074 // Stack here: 3057 // Stack here:
3075 // - home_object 3058 // - home_object
3076 // - this (receiver) 3059 // - this (receiver)
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after
4917 // Put the object both on the stack and in the register. 4900 // Put the object both on the stack and in the register.
4918 VisitForStackValue(prop->obj()); 4901 VisitForStackValue(prop->obj());
4919 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0)); 4902 __ ldr(LoadDescriptor::ReceiverRegister(), MemOperand(sp, 0));
4920 EmitNamedPropertyLoad(prop); 4903 EmitNamedPropertyLoad(prop);
4921 break; 4904 break;
4922 } 4905 }
4923 4906
4924 case NAMED_SUPER_PROPERTY: { 4907 case NAMED_SUPER_PROPERTY: {
4925 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 4908 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
4926 VisitForAccumulatorValue( 4909 VisitForAccumulatorValue(
4927 prop->obj()->AsSuperPropertyReference()->home_object_var()); 4910 prop->obj()->AsSuperPropertyReference()->home_object());
4928 __ Push(result_register()); 4911 __ Push(result_register());
4929 const Register scratch = r1; 4912 const Register scratch = r1;
4930 __ ldr(scratch, MemOperand(sp, kPointerSize)); 4913 __ ldr(scratch, MemOperand(sp, kPointerSize));
4931 __ Push(scratch); 4914 __ Push(scratch);
4932 __ Push(result_register()); 4915 __ Push(result_register());
4933 EmitNamedSuperPropertyLoad(prop); 4916 EmitNamedSuperPropertyLoad(prop);
4934 break; 4917 break;
4935 } 4918 }
4936 4919
4937 case KEYED_SUPER_PROPERTY: { 4920 case KEYED_SUPER_PROPERTY: {
4938 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 4921 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
4939 VisitForStackValue( 4922 VisitForStackValue(
4940 prop->obj()->AsSuperPropertyReference()->home_object_var()); 4923 prop->obj()->AsSuperPropertyReference()->home_object());
4941 VisitForAccumulatorValue(prop->key()); 4924 VisitForAccumulatorValue(prop->key());
4942 __ Push(result_register()); 4925 __ Push(result_register());
4943 const Register scratch = r1; 4926 const Register scratch = r1;
4944 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); 4927 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize));
4945 __ Push(scratch); 4928 __ Push(scratch);
4946 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize)); 4929 __ ldr(scratch, MemOperand(sp, 2 * kPointerSize));
4947 __ Push(scratch); 4930 __ Push(scratch);
4948 __ Push(result_register()); 4931 __ Push(result_register());
4949 EmitKeyedSuperPropertyLoad(prop); 4932 EmitKeyedSuperPropertyLoad(prop);
4950 break; 4933 break;
(...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
5614 DCHECK(interrupt_address == 5597 DCHECK(interrupt_address ==
5615 isolate->builtins()->OsrAfterStackCheck()->entry()); 5598 isolate->builtins()->OsrAfterStackCheck()->entry());
5616 return OSR_AFTER_STACK_CHECK; 5599 return OSR_AFTER_STACK_CHECK;
5617 } 5600 }
5618 5601
5619 5602
5620 } // namespace internal 5603 } // namespace internal
5621 } // namespace v8 5604 } // namespace v8
5622 5605
5623 #endif // V8_TARGET_ARCH_ARM 5606 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm64/full-codegen-arm64.cc » ('j') | src/ast-value-factory.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698