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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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 1327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1338 DCHECK(var->IsUnallocatedOrGlobalSlot() || | 1338 DCHECK(var->IsUnallocatedOrGlobalSlot() || |
1339 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); | 1339 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); |
1340 if (var->IsGlobalSlot()) { | 1340 if (var->IsGlobalSlot()) { |
1341 DCHECK(var->index() > 0); | 1341 DCHECK(var->index() > 0); |
1342 DCHECK(var->IsStaticGlobalObjectProperty()); | 1342 DCHECK(var->IsStaticGlobalObjectProperty()); |
1343 // Each var occupies two slots in the context: for reads and writes. | 1343 // Each var occupies two slots in the context: for reads and writes. |
1344 int const slot = var->index(); | 1344 int const slot = var->index(); |
1345 int const depth = scope()->ContextChainLength(var->scope()); | 1345 int const depth = scope()->ContextChainLength(var->scope()); |
1346 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 1346 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
1347 __ Move(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | 1347 __ Move(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); |
1348 __ mov(LoadGlobalViaContextDescriptor::NameRegister(), var->name()); | |
1349 LoadGlobalViaContextStub stub(isolate(), depth); | 1348 LoadGlobalViaContextStub stub(isolate(), depth); |
1350 __ CallStub(&stub); | 1349 __ CallStub(&stub); |
1351 } else { | 1350 } else { |
1352 __ Push(Smi::FromInt(slot)); | 1351 __ Push(Smi::FromInt(slot)); |
1353 __ Push(var->name()); | 1352 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
1354 __ CallRuntime(Runtime::kLoadGlobalViaContext, 2); | |
1355 } | 1353 } |
1356 | 1354 |
1357 } else { | 1355 } else { |
1358 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1356 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1359 __ mov(LoadDescriptor::NameRegister(), var->name()); | 1357 __ mov(LoadDescriptor::NameRegister(), var->name()); |
1360 __ mov(LoadDescriptor::SlotRegister(), | 1358 __ mov(LoadDescriptor::SlotRegister(), |
1361 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1359 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1362 CallLoadIC(typeof_mode); | 1360 CallLoadIC(typeof_mode); |
1363 } | 1361 } |
1364 } | 1362 } |
(...skipping 1255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2620 | 2618 |
2621 } else if (var->IsGlobalSlot()) { | 2619 } else if (var->IsGlobalSlot()) { |
2622 // Global var, const, or let. | 2620 // Global var, const, or let. |
2623 DCHECK(var->index() > 0); | 2621 DCHECK(var->index() > 0); |
2624 DCHECK(var->IsStaticGlobalObjectProperty()); | 2622 DCHECK(var->IsStaticGlobalObjectProperty()); |
2625 // Each var occupies two slots in the context: for reads and writes. | 2623 // Each var occupies two slots in the context: for reads and writes. |
2626 int const slot = var->index() + 1; | 2624 int const slot = var->index() + 1; |
2627 int const depth = scope()->ContextChainLength(var->scope()); | 2625 int const depth = scope()->ContextChainLength(var->scope()); |
2628 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 2626 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
2629 __ Move(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | 2627 __ Move(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); |
2630 __ mov(StoreGlobalViaContextDescriptor::NameRegister(), var->name()); | |
2631 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax)); | 2628 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax)); |
2632 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | 2629 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
2633 __ CallStub(&stub); | 2630 __ CallStub(&stub); |
2634 } else { | 2631 } else { |
2635 __ Push(Smi::FromInt(slot)); | 2632 __ Push(Smi::FromInt(slot)); |
2636 __ Push(var->name()); | |
2637 __ Push(eax); | 2633 __ Push(eax); |
2638 __ CallRuntime(is_strict(language_mode()) | 2634 __ CallRuntime(is_strict(language_mode()) |
2639 ? Runtime::kStoreGlobalViaContext_Strict | 2635 ? Runtime::kStoreGlobalViaContext_Strict |
2640 : Runtime::kStoreGlobalViaContext_Sloppy, | 2636 : Runtime::kStoreGlobalViaContext_Sloppy, |
2641 3); | 2637 2); |
2642 } | 2638 } |
2643 | 2639 |
2644 } else if (var->mode() == LET && op != Token::INIT_LET) { | 2640 } else if (var->mode() == LET && op != Token::INIT_LET) { |
2645 // Non-initializing assignment to let variable needs a write barrier. | 2641 // Non-initializing assignment to let variable needs a write barrier. |
2646 DCHECK(!var->IsLookupSlot()); | 2642 DCHECK(!var->IsLookupSlot()); |
2647 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); | 2643 DCHECK(var->IsStackAllocated() || var->IsContextSlot()); |
2648 Label assign; | 2644 Label assign; |
2649 MemOperand location = VarOperand(var, ecx); | 2645 MemOperand location = VarOperand(var, ecx); |
2650 __ mov(edx, location); | 2646 __ mov(edx, location); |
2651 __ cmp(edx, isolate()->factory()->the_hole_value()); | 2647 __ cmp(edx, isolate()->factory()->the_hole_value()); |
(...skipping 2695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5347 Assembler::target_address_at(call_target_address, | 5343 Assembler::target_address_at(call_target_address, |
5348 unoptimized_code)); | 5344 unoptimized_code)); |
5349 return OSR_AFTER_STACK_CHECK; | 5345 return OSR_AFTER_STACK_CHECK; |
5350 } | 5346 } |
5351 | 5347 |
5352 | 5348 |
5353 } // namespace internal | 5349 } // namespace internal |
5354 } // namespace v8 | 5350 } // namespace v8 |
5355 | 5351 |
5356 #endif // V8_TARGET_ARCH_IA32 | 5352 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |