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

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

Issue 1224793002: Loads and stores to global vars are now made via property cell shortcuts installed into parent scri… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressing comments Created 5 years, 5 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/interface-descriptors-arm.cc ('k') | src/arm64/interface-descriptors-arm64.cc » ('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 1454 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 __ B(done); 1465 __ B(done);
1466 } 1466 }
1467 } 1467 }
1468 1468
1469 1469
1470 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, 1470 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy,
1471 TypeofState typeof_state) { 1471 TypeofState typeof_state) {
1472 Variable* var = proxy->var(); 1472 Variable* var = proxy->var();
1473 DCHECK(var->IsUnallocatedOrGlobalSlot() || 1473 DCHECK(var->IsUnallocatedOrGlobalSlot() ||
1474 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); 1474 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL));
1475 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); 1475 if (var->IsGlobalSlot()) {
1476 __ Mov(LoadDescriptor::NameRegister(), Operand(var->name())); 1476 DCHECK(var->index() > 0);
1477 __ Mov(LoadDescriptor::SlotRegister(), 1477 DCHECK(var->IsStaticGlobalObjectProperty());
1478 SmiFromSlot(proxy->VariableFeedbackSlot())); 1478 // Each var occupies two slots in the context: for reads and writes.
1479 // Inside typeof use a regular load, not a contextual load, to avoid 1479 int slot_index = var->index();
1480 // a reference error. 1480 int depth = scope()->ContextChainLength(var->scope());
1481 CallLoadIC(typeof_state == NOT_INSIDE_TYPEOF ? CONTEXTUAL : NOT_CONTEXTUAL); 1481 __ Mov(LoadGlobalViaContextDescriptor::DepthRegister(),
1482 Operand(Smi::FromInt(depth)));
1483 __ Mov(LoadGlobalViaContextDescriptor::SlotRegister(),
1484 Operand(Smi::FromInt(slot_index)));
1485 __ Mov(LoadGlobalViaContextDescriptor::NameRegister(),
1486 Operand(var->name()));
1487 LoadGlobalViaContextStub stub(isolate(), depth);
1488 __ CallStub(&stub);
1489
1490 } else {
1491 __ Ldr(LoadDescriptor::ReceiverRegister(), GlobalObjectMemOperand());
1492 __ Mov(LoadDescriptor::NameRegister(), Operand(var->name()));
1493 __ Mov(LoadDescriptor::SlotRegister(),
1494 SmiFromSlot(proxy->VariableFeedbackSlot()));
1495 // Inside typeof use a regular load, not a contextual load, to avoid
1496 // a reference error.
1497 CallLoadIC(typeof_state == NOT_INSIDE_TYPEOF ? CONTEXTUAL : NOT_CONTEXTUAL);
1498 }
1482 } 1499 }
1483 1500
1484 1501
1485 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy, 1502 void FullCodeGenerator::EmitVariableLoad(VariableProxy* proxy,
1486 TypeofState typeof_state) { 1503 TypeofState typeof_state) {
1487 // Record position before possible IC call. 1504 // Record position before possible IC call.
1488 SetExpressionPosition(proxy); 1505 SetExpressionPosition(proxy);
1489 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); 1506 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS);
1490 Variable* var = proxy->var(); 1507 Variable* var = proxy->var();
1491 1508
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 int offset = Context::SlotOffset(var->index()); 2449 int offset = Context::SlotOffset(var->index());
2433 __ RecordWriteContextSlot( 2450 __ RecordWriteContextSlot(
2434 x1, offset, x10, x11, kLRHasBeenSaved, kDontSaveFPRegs); 2451 x1, offset, x10, x11, kLRHasBeenSaved, kDontSaveFPRegs);
2435 } 2452 }
2436 } 2453 }
2437 2454
2438 2455
2439 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op, 2456 void FullCodeGenerator::EmitVariableAssignment(Variable* var, Token::Value op,
2440 FeedbackVectorICSlot slot) { 2457 FeedbackVectorICSlot slot) {
2441 ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment"); 2458 ASM_LOCATION("FullCodeGenerator::EmitVariableAssignment");
2442 if (var->IsUnallocatedOrGlobalSlot()) { 2459 if (var->IsUnallocated()) {
2443 // Global var, const, or let. 2460 // Global var, const, or let.
2444 __ Mov(StoreDescriptor::NameRegister(), Operand(var->name())); 2461 __ Mov(StoreDescriptor::NameRegister(), Operand(var->name()));
2445 __ Ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectMemOperand()); 2462 __ Ldr(StoreDescriptor::ReceiverRegister(), GlobalObjectMemOperand());
2446 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); 2463 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot);
2447 CallStoreIC(); 2464 CallStoreIC();
2448 2465
2466 } else if (var->IsGlobalSlot()) {
2467 // Global var, const, or let.
2468 DCHECK(var->index() > 0);
2469 DCHECK(var->IsStaticGlobalObjectProperty());
2470 // Each var occupies two slots in the context: for reads and writes.
2471 int slot_index = var->index() + 1;
2472 int depth = scope()->ContextChainLength(var->scope());
2473 __ Mov(StoreGlobalViaContextDescriptor::DepthRegister(),
2474 Operand(Smi::FromInt(depth)));
2475 __ Mov(StoreGlobalViaContextDescriptor::SlotRegister(),
2476 Operand(Smi::FromInt(slot_index)));
2477 __ Mov(StoreGlobalViaContextDescriptor::NameRegister(),
2478 Operand(var->name()));
2479 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(x0));
2480 StoreGlobalViaContextStub stub(isolate(), depth, language_mode());
2481 __ CallStub(&stub);
2482
2449 } else if (var->mode() == LET && op != Token::INIT_LET) { 2483 } else if (var->mode() == LET && op != Token::INIT_LET) {
2450 // Non-initializing assignment to let variable needs a write barrier. 2484 // Non-initializing assignment to let variable needs a write barrier.
2451 DCHECK(!var->IsLookupSlot()); 2485 DCHECK(!var->IsLookupSlot());
2452 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); 2486 DCHECK(var->IsStackAllocated() || var->IsContextSlot());
2453 Label assign; 2487 Label assign;
2454 MemOperand location = VarOperand(var, x1); 2488 MemOperand location = VarOperand(var, x1);
2455 __ Ldr(x10, location); 2489 __ Ldr(x10, location);
2456 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign); 2490 __ JumpIfNotRoot(x10, Heap::kTheHoleValueRootIndex, &assign);
2457 __ Mov(x10, Operand(var->name())); 2491 __ Mov(x10, Operand(var->name()));
2458 __ Push(x10); 2492 __ Push(x10);
(...skipping 3110 matching lines...) Expand 10 before | Expand all | Expand 10 after
5569 } 5603 }
5570 5604
5571 return INTERRUPT; 5605 return INTERRUPT;
5572 } 5606 }
5573 5607
5574 5608
5575 } // namespace internal 5609 } // namespace internal
5576 } // namespace v8 5610 } // namespace v8
5577 5611
5578 #endif // V8_TARGET_ARCH_ARM64 5612 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/interface-descriptors-arm.cc ('k') | src/arm64/interface-descriptors-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698