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

Side by Side Diff: src/arm64/full-codegen-arm64.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/arm/full-codegen-arm.cc ('k') | src/ast.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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_ARM64 7 #if V8_TARGET_ARCH_ARM64
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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 } else if (FLAG_debug_code) { 236 } else if (FLAG_debug_code) {
237 Label done; 237 Label done;
238 __ JumpIfInNewSpace(cp, &done); 238 __ JumpIfInNewSpace(cp, &done);
239 __ Abort(kExpectedNewSpaceObject); 239 __ Abort(kExpectedNewSpaceObject);
240 __ bind(&done); 240 __ bind(&done);
241 } 241 }
242 } 242 }
243 } 243 }
244 } 244 }
245 245
246 Variable* home_object_var = scope()->home_object_var();
247 if (home_object_var != nullptr) {
248 __ Push(x1);
249 }
250
251 // Possibly set up a local binding to the this function which is used in 246 // Possibly set up a local binding to the this function which is used in
252 // derived constructors with super calls. 247 // derived constructors with super calls.
253 Variable* this_function_var = scope()->this_function_var(); 248 Variable* this_function_var = scope()->this_function_var();
254 if (this_function_var != nullptr) { 249 if (this_function_var != nullptr) {
255 Comment cmnt(masm_, "[ This function"); 250 Comment cmnt(masm_, "[ This function");
256 SetVar(this_function_var, x1, x0, x2); 251 SetVar(this_function_var, x1, x0, x2);
257 } 252 }
258 253
259 Variable* new_target_var = scope()->new_target_var(); 254 Variable* new_target_var = scope()->new_target_var();
260 if (new_target_var != nullptr) { 255 if (new_target_var != nullptr) {
(...skipping 63 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, x0, x1, x2); 326 SetVar(arguments, x0, x1, x2);
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 __ Mov(LoadDescriptor::NameRegister(), home_object_symbol);
340 __ Mov(LoadDescriptor::SlotRegister(),
341 SmiFromSlot(function()->HomeObjectFeedbackSlot()));
342 CallLoadIC(NOT_CONTEXTUAL);
343
344 SetVar(home_object_var, x0, x1, x2);
345 }
346
347 if (FLAG_trace) { 329 if (FLAG_trace) {
348 __ CallRuntime(Runtime::kTraceEnter, 0); 330 __ CallRuntime(Runtime::kTraceEnter, 0);
349 } 331 }
350 332
351 // Visit the declarations and body unless there is an illegal 333 // Visit the declarations and body unless there is an illegal
352 // redeclaration. 334 // redeclaration.
353 if (scope()->HasIllegalRedeclaration()) { 335 if (scope()->HasIllegalRedeclaration()) {
354 Comment cmnt(masm_, "[ Declarations"); 336 Comment cmnt(masm_, "[ Declarations");
355 scope()->VisitIllegalRedeclaration(this); 337 scope()->VisitIllegalRedeclaration(this);
356 338
(...skipping 1627 matching lines...) Expand 10 before | Expand all | Expand 10 after
1984 VisitForStackValue(property->obj()); 1966 VisitForStackValue(property->obj());
1985 __ Peek(LoadDescriptor::ReceiverRegister(), 0); 1967 __ Peek(LoadDescriptor::ReceiverRegister(), 0);
1986 } else { 1968 } else {
1987 VisitForStackValue(property->obj()); 1969 VisitForStackValue(property->obj());
1988 } 1970 }
1989 break; 1971 break;
1990 case NAMED_SUPER_PROPERTY: 1972 case NAMED_SUPER_PROPERTY:
1991 VisitForStackValue( 1973 VisitForStackValue(
1992 property->obj()->AsSuperPropertyReference()->this_var()); 1974 property->obj()->AsSuperPropertyReference()->this_var());
1993 VisitForAccumulatorValue( 1975 VisitForAccumulatorValue(
1994 property->obj()->AsSuperPropertyReference()->home_object_var()); 1976 property->obj()->AsSuperPropertyReference()->home_object());
1995 __ Push(result_register()); 1977 __ Push(result_register());
1996 if (expr->is_compound()) { 1978 if (expr->is_compound()) {
1997 const Register scratch = x10; 1979 const Register scratch = x10;
1998 __ Peek(scratch, kPointerSize); 1980 __ Peek(scratch, kPointerSize);
1999 __ Push(scratch, result_register()); 1981 __ Push(scratch, result_register());
2000 } 1982 }
2001 break; 1983 break;
2002 case KEYED_SUPER_PROPERTY: 1984 case KEYED_SUPER_PROPERTY:
2003 VisitForStackValue( 1985 VisitForStackValue(
2004 property->obj()->AsSuperPropertyReference()->this_var()); 1986 property->obj()->AsSuperPropertyReference()->this_var());
2005 VisitForStackValue( 1987 VisitForStackValue(
2006 property->obj()->AsSuperPropertyReference()->home_object_var()); 1988 property->obj()->AsSuperPropertyReference()->home_object());
2007 VisitForAccumulatorValue(property->key()); 1989 VisitForAccumulatorValue(property->key());
2008 __ Push(result_register()); 1990 __ Push(result_register());
2009 if (expr->is_compound()) { 1991 if (expr->is_compound()) {
2010 const Register scratch1 = x10; 1992 const Register scratch1 = x10;
2011 const Register scratch2 = x11; 1993 const Register scratch2 = x11;
2012 __ Peek(scratch1, 2 * kPointerSize); 1994 __ Peek(scratch1, 2 * kPointerSize);
2013 __ Peek(scratch2, kPointerSize); 1995 __ Peek(scratch2, kPointerSize);
2014 __ Push(scratch1, scratch2, result_register()); 1996 __ Push(scratch1, scratch2, result_register());
2015 } 1997 }
2016 break; 1998 break;
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
2355 __ Mov(StoreDescriptor::NameRegister(), 2337 __ Mov(StoreDescriptor::NameRegister(),
2356 Operand(prop->key()->AsLiteral()->value())); 2338 Operand(prop->key()->AsLiteral()->value()));
2357 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2339 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2358 CallStoreIC(); 2340 CallStoreIC();
2359 break; 2341 break;
2360 } 2342 }
2361 case NAMED_SUPER_PROPERTY: { 2343 case NAMED_SUPER_PROPERTY: {
2362 __ Push(x0); 2344 __ Push(x0);
2363 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 2345 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
2364 VisitForAccumulatorValue( 2346 VisitForAccumulatorValue(
2365 prop->obj()->AsSuperPropertyReference()->home_object_var()); 2347 prop->obj()->AsSuperPropertyReference()->home_object());
2366 // stack: value, this; x0: home_object 2348 // stack: value, this; x0: home_object
2367 Register scratch = x10; 2349 Register scratch = x10;
2368 Register scratch2 = x11; 2350 Register scratch2 = x11;
2369 __ mov(scratch, result_register()); // home_object 2351 __ mov(scratch, result_register()); // home_object
2370 __ Peek(x0, kPointerSize); // value 2352 __ Peek(x0, kPointerSize); // value
2371 __ Peek(scratch2, 0); // this 2353 __ Peek(scratch2, 0); // this
2372 __ Poke(scratch2, kPointerSize); // this 2354 __ Poke(scratch2, kPointerSize); // this
2373 __ Poke(scratch, 0); // home_object 2355 __ Poke(scratch, 0); // home_object
2374 // stack: this, home_object; x0: value 2356 // stack: this, home_object; x0: value
2375 EmitNamedSuperPropertyStore(prop); 2357 EmitNamedSuperPropertyStore(prop);
2376 break; 2358 break;
2377 } 2359 }
2378 case KEYED_SUPER_PROPERTY: { 2360 case KEYED_SUPER_PROPERTY: {
2379 __ Push(x0); 2361 __ Push(x0);
2380 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 2362 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
2381 VisitForStackValue( 2363 VisitForStackValue(
2382 prop->obj()->AsSuperPropertyReference()->home_object_var()); 2364 prop->obj()->AsSuperPropertyReference()->home_object());
2383 VisitForAccumulatorValue(prop->key()); 2365 VisitForAccumulatorValue(prop->key());
2384 Register scratch = x10; 2366 Register scratch = x10;
2385 Register scratch2 = x11; 2367 Register scratch2 = x11;
2386 __ Peek(scratch2, 2 * kPointerSize); // value 2368 __ Peek(scratch2, 2 * kPointerSize); // value
2387 // stack: value, this, home_object; x0: key, x11: value 2369 // stack: value, this, home_object; x0: key, x11: value
2388 __ Peek(scratch, kPointerSize); // this 2370 __ Peek(scratch, kPointerSize); // this
2389 __ Poke(scratch, 2 * kPointerSize); 2371 __ Poke(scratch, 2 * kPointerSize);
2390 __ Peek(scratch, 0); // home_object 2372 __ Peek(scratch, 0); // home_object
2391 __ Poke(scratch, kPointerSize); 2373 __ Poke(scratch, kPointerSize);
2392 __ Poke(x0, 0); 2374 __ Poke(x0, 0);
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2600 Expression* key = expr->key(); 2582 Expression* key = expr->key();
2601 2583
2602 if (key->IsPropertyName()) { 2584 if (key->IsPropertyName()) {
2603 if (!expr->IsSuperAccess()) { 2585 if (!expr->IsSuperAccess()) {
2604 VisitForAccumulatorValue(expr->obj()); 2586 VisitForAccumulatorValue(expr->obj());
2605 __ Move(LoadDescriptor::ReceiverRegister(), x0); 2587 __ Move(LoadDescriptor::ReceiverRegister(), x0);
2606 EmitNamedPropertyLoad(expr); 2588 EmitNamedPropertyLoad(expr);
2607 } else { 2589 } else {
2608 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); 2590 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var());
2609 VisitForStackValue( 2591 VisitForStackValue(
2610 expr->obj()->AsSuperPropertyReference()->home_object_var()); 2592 expr->obj()->AsSuperPropertyReference()->home_object());
2611 EmitNamedSuperPropertyLoad(expr); 2593 EmitNamedSuperPropertyLoad(expr);
2612 } 2594 }
2613 } else { 2595 } else {
2614 if (!expr->IsSuperAccess()) { 2596 if (!expr->IsSuperAccess()) {
2615 VisitForStackValue(expr->obj()); 2597 VisitForStackValue(expr->obj());
2616 VisitForAccumulatorValue(expr->key()); 2598 VisitForAccumulatorValue(expr->key());
2617 __ Move(LoadDescriptor::NameRegister(), x0); 2599 __ Move(LoadDescriptor::NameRegister(), x0);
2618 __ Pop(LoadDescriptor::ReceiverRegister()); 2600 __ Pop(LoadDescriptor::ReceiverRegister());
2619 EmitKeyedPropertyLoad(expr); 2601 EmitKeyedPropertyLoad(expr);
2620 } else { 2602 } else {
2621 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var()); 2603 VisitForStackValue(expr->obj()->AsSuperPropertyReference()->this_var());
2622 VisitForStackValue( 2604 VisitForStackValue(
2623 expr->obj()->AsSuperPropertyReference()->home_object_var()); 2605 expr->obj()->AsSuperPropertyReference()->home_object());
2624 VisitForStackValue(expr->key()); 2606 VisitForStackValue(expr->key());
2625 EmitKeyedSuperPropertyLoad(expr); 2607 EmitKeyedSuperPropertyLoad(expr);
2626 } 2608 }
2627 } 2609 }
2628 PrepareForBailoutForId(expr->LoadId(), TOS_REG); 2610 PrepareForBailoutForId(expr->LoadId(), TOS_REG);
2629 context()->Plug(x0); 2611 context()->Plug(x0);
2630 } 2612 }
2631 2613
2632 2614
2633 void FullCodeGenerator::CallIC(Handle<Code> code, 2615 void FullCodeGenerator::CallIC(Handle<Code> code,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2683 DCHECK(prop->IsSuperAccess()); 2665 DCHECK(prop->IsSuperAccess());
2684 2666
2685 SetSourcePosition(prop->position()); 2667 SetSourcePosition(prop->position());
2686 Literal* key = prop->key()->AsLiteral(); 2668 Literal* key = prop->key()->AsLiteral();
2687 DCHECK(!key->value()->IsSmi()); 2669 DCHECK(!key->value()->IsSmi());
2688 2670
2689 // Load the function from the receiver. 2671 // Load the function from the receiver.
2690 const Register scratch = x10; 2672 const Register scratch = x10;
2691 SuperPropertyReference* super_ref = 2673 SuperPropertyReference* super_ref =
2692 callee->AsProperty()->obj()->AsSuperPropertyReference(); 2674 callee->AsProperty()->obj()->AsSuperPropertyReference();
2693 VisitForStackValue(super_ref->home_object_var()); 2675 VisitForStackValue(super_ref->home_object());
2694 VisitForAccumulatorValue(super_ref->this_var()); 2676 VisitForAccumulatorValue(super_ref->this_var());
2695 __ Push(x0); 2677 __ Push(x0);
2696 __ Peek(scratch, kPointerSize); 2678 __ Peek(scratch, kPointerSize);
2697 __ Push(x0, scratch); 2679 __ Push(x0, scratch);
2698 __ Push(key->value()); 2680 __ Push(key->value());
2699 2681
2700 // Stack here: 2682 // Stack here:
2701 // - home_object 2683 // - home_object
2702 // - this (receiver) 2684 // - this (receiver)
2703 // - this (receiver) <-- LoadFromSuper will pop here and below. 2685 // - this (receiver) <-- LoadFromSuper will pop here and below.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
2743 DCHECK(callee->IsProperty()); 2725 DCHECK(callee->IsProperty());
2744 Property* prop = callee->AsProperty(); 2726 Property* prop = callee->AsProperty();
2745 DCHECK(prop->IsSuperAccess()); 2727 DCHECK(prop->IsSuperAccess());
2746 2728
2747 SetSourcePosition(prop->position()); 2729 SetSourcePosition(prop->position());
2748 2730
2749 // Load the function from the receiver. 2731 // Load the function from the receiver.
2750 const Register scratch = x10; 2732 const Register scratch = x10;
2751 SuperPropertyReference* super_ref = 2733 SuperPropertyReference* super_ref =
2752 callee->AsProperty()->obj()->AsSuperPropertyReference(); 2734 callee->AsProperty()->obj()->AsSuperPropertyReference();
2753 VisitForStackValue(super_ref->home_object_var()); 2735 VisitForStackValue(super_ref->home_object());
2754 VisitForAccumulatorValue(super_ref->this_var()); 2736 VisitForAccumulatorValue(super_ref->this_var());
2755 __ Push(x0); 2737 __ Push(x0);
2756 __ Peek(scratch, kPointerSize); 2738 __ Peek(scratch, kPointerSize);
2757 __ Push(x0, scratch); 2739 __ Push(x0, scratch);
2758 VisitForStackValue(prop->key()); 2740 VisitForStackValue(prop->key());
2759 2741
2760 // Stack here: 2742 // Stack here:
2761 // - home_object 2743 // - home_object
2762 // - this (receiver) 2744 // - this (receiver)
2763 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. 2745 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
(...skipping 1833 matching lines...) Expand 10 before | Expand all | Expand 10 after
4597 // Put the object both on the stack and in the register. 4579 // Put the object both on the stack and in the register.
4598 VisitForStackValue(prop->obj()); 4580 VisitForStackValue(prop->obj());
4599 __ Peek(LoadDescriptor::ReceiverRegister(), 0); 4581 __ Peek(LoadDescriptor::ReceiverRegister(), 0);
4600 EmitNamedPropertyLoad(prop); 4582 EmitNamedPropertyLoad(prop);
4601 break; 4583 break;
4602 } 4584 }
4603 4585
4604 case NAMED_SUPER_PROPERTY: { 4586 case NAMED_SUPER_PROPERTY: {
4605 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 4587 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
4606 VisitForAccumulatorValue( 4588 VisitForAccumulatorValue(
4607 prop->obj()->AsSuperPropertyReference()->home_object_var()); 4589 prop->obj()->AsSuperPropertyReference()->home_object());
4608 __ Push(result_register()); 4590 __ Push(result_register());
4609 const Register scratch = x10; 4591 const Register scratch = x10;
4610 __ Peek(scratch, kPointerSize); 4592 __ Peek(scratch, kPointerSize);
4611 __ Push(scratch, result_register()); 4593 __ Push(scratch, result_register());
4612 EmitNamedSuperPropertyLoad(prop); 4594 EmitNamedSuperPropertyLoad(prop);
4613 break; 4595 break;
4614 } 4596 }
4615 4597
4616 case KEYED_SUPER_PROPERTY: { 4598 case KEYED_SUPER_PROPERTY: {
4617 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var()); 4599 VisitForStackValue(prop->obj()->AsSuperPropertyReference()->this_var());
4618 VisitForStackValue( 4600 VisitForStackValue(
4619 prop->obj()->AsSuperPropertyReference()->home_object_var()); 4601 prop->obj()->AsSuperPropertyReference()->home_object());
4620 VisitForAccumulatorValue(prop->key()); 4602 VisitForAccumulatorValue(prop->key());
4621 __ Push(result_register()); 4603 __ Push(result_register());
4622 const Register scratch1 = x10; 4604 const Register scratch1 = x10;
4623 const Register scratch2 = x11; 4605 const Register scratch2 = x11;
4624 __ Peek(scratch1, 2 * kPointerSize); 4606 __ Peek(scratch1, 2 * kPointerSize);
4625 __ Peek(scratch2, kPointerSize); 4607 __ Peek(scratch2, kPointerSize);
4626 __ Push(scratch1, scratch2, result_register()); 4608 __ Push(scratch1, scratch2, result_register());
4627 EmitKeyedSuperPropertyLoad(prop); 4609 EmitKeyedSuperPropertyLoad(prop);
4628 break; 4610 break;
4629 } 4611 }
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
5579 } 5561 }
5580 5562
5581 return INTERRUPT; 5563 return INTERRUPT;
5582 } 5564 }
5583 5565
5584 5566
5585 } // namespace internal 5567 } // namespace internal
5586 } // namespace v8 5568 } // namespace v8
5587 5569
5588 #endif // V8_TARGET_ARCH_ARM64 5570 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/ast.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698