OLD | NEW |
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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 DCHECK(var->IsUnallocatedOrGlobalSlot() || | 1331 DCHECK(var->IsUnallocatedOrGlobalSlot() || |
1332 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); | 1332 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); |
1333 if (var->IsGlobalSlot()) { | 1333 if (var->IsGlobalSlot()) { |
1334 DCHECK(var->index() > 0); | 1334 DCHECK(var->index() > 0); |
1335 DCHECK(var->IsStaticGlobalObjectProperty()); | 1335 DCHECK(var->IsStaticGlobalObjectProperty()); |
1336 // Each var occupies two slots in the context: for reads and writes. | 1336 // Each var occupies two slots in the context: for reads and writes. |
1337 int const slot = var->index(); | 1337 int const slot = var->index(); |
1338 int const depth = scope()->ContextChainLength(var->scope()); | 1338 int const depth = scope()->ContextChainLength(var->scope()); |
1339 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 1339 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
1340 __ Move(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | 1340 __ Move(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); |
1341 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), var->name()); | |
1342 LoadGlobalViaContextStub stub(isolate(), depth); | 1341 LoadGlobalViaContextStub stub(isolate(), depth); |
1343 __ CallStub(&stub); | 1342 __ CallStub(&stub); |
1344 } else { | 1343 } else { |
1345 __ Push(Smi::FromInt(slot)); | 1344 __ Push(Smi::FromInt(slot)); |
1346 __ Push(var->name()); | 1345 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
1347 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); | |
1348 } | 1346 } |
1349 | 1347 |
1350 } else { | 1348 } else { |
1351 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1349 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1352 __ mov(LoadDescriptor::NameRegister(), var->name()); | 1350 __ mov(LoadDescriptor::NameRegister(), var->name()); |
1353 __ mov(LoadDescriptor::SlotRegister(), | 1351 __ mov(LoadDescriptor::SlotRegister(), |
1354 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1352 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1355 CallLoadIC(typeof_mode); | 1353 CallLoadIC(typeof_mode); |
1356 } | 1354 } |
1357 } | 1355 } |
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2611 | 2609 |
2612 } else if (var->IsGlobalSlot()) { | 2610 } else if (var->IsGlobalSlot()) { |
2613 // Global var, const, or let. | 2611 // Global var, const, or let. |
2614 DCHECK(var->index() > 0); | 2612 DCHECK(var->index() > 0); |
2615 DCHECK(var->IsStaticGlobalObjectProperty()); | 2613 DCHECK(var->IsStaticGlobalObjectProperty()); |
2616 // Each var occupies two slots in the context: for reads and writes. | 2614 // Each var occupies two slots in the context: for reads and writes. |
2617 int const slot = var->index() + 1; | 2615 int const slot = var->index() + 1; |
2618 int const depth = scope()->ContextChainLength(var->scope()); | 2616 int const depth = scope()->ContextChainLength(var->scope()); |
2619 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 2617 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
2620 __ Move(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | 2618 __ Move(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); |
2621 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), var->name()); | |
2622 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax)); | 2619 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax)); |
2623 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | 2620 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
2624 __ CallStub(&stub); | 2621 __ CallStub(&stub); |
2625 } else { | 2622 } else { |
2626 __ Push(Smi::FromInt(slot)); | 2623 __ Push(Smi::FromInt(slot)); |
2627 __ Push(var->name()); | |
2628 __ Push(eax); | 2624 __ Push(eax); |
2629 __ CallRuntime(is_strict(language_mode()) | 2625 __ CallRuntime(is_strict(language_mode()) |
2630 ? Runtime::kStoreGlobalViaContext_Strict | 2626 ? Runtime::kStoreGlobalViaContext_Strict |
2631 : Runtime::kStoreGlobalViaContext_Sloppy, | 2627 : Runtime::kStoreGlobalViaContext_Sloppy, |
2632 3); | 2628 2); |
2633 } | 2629 } |
2634 | 2630 |
2635 } else if (var->mode() == LET && op != Token::INIT_LET) { | 2631 } else if (var->mode() == LET && op != Token::INIT_LET) { |
2636 // Non-initializing assignment to let variable needs a write barrier. | 2632 // Non-initializing assignment to let variable needs a write barrier. |
2637 DCHECK(!var->IsLookupSlot()); | 2633 DCHECK(!var->IsLookupSlot()); |
2638 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2634 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2639 Label assign; | 2635 Label assign; |
2640 MemOperand location = VarOperand(var, ecx); | 2636 MemOperand location = VarOperand(var, ecx); |
2641 __ mov(edx, location); | 2637 __ mov(edx, location); |
2642 __ cmp(edx, isolate()->factory()->the_hole_value()); | 2638 __ cmp(edx, isolate()->factory()->the_hole_value()); |
(...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5338 Assembler::target_address_at(call_target_address, | 5334 Assembler::target_address_at(call_target_address, |
5339 unoptimized_code)); | 5335 unoptimized_code)); |
5340 return OSR_AFTER_STACK_CHECK; | 5336 return OSR_AFTER_STACK_CHECK; |
5341 } | 5337 } |
5342 | 5338 |
5343 | 5339 |
5344 } // namespace internal | 5340 } // namespace internal |
5345 } // namespace v8 | 5341 } // namespace v8 |
5346 | 5342 |
5347 #endif // V8_TARGET_ARCH_X87 | 5343 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |