| 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 1322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 | 1333 |
| 1334 | 1334 |
| 1335 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, | 1335 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, |
| 1336 TypeofMode typeof_mode) { | 1336 TypeofMode typeof_mode) { |
| 1337 Variable* var = proxy->var(); | 1337 Variable* var = proxy->var(); |
| 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. | |
| 1344 int const slot = var->index(); | 1343 int const slot = var->index(); |
| 1345 int const depth = scope()->ContextChainLength(var->scope()); | 1344 int const depth = scope()->ContextChainLength(var->scope()); |
| 1346 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 1345 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
| 1347 __ Move(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | 1346 __ Move(LoadGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); |
| 1348 LoadGlobalViaContextStub stub(isolate(), depth); | 1347 LoadGlobalViaContextStub stub(isolate(), depth); |
| 1349 __ CallStub(&stub); | 1348 __ CallStub(&stub); |
| 1350 } else { | 1349 } else { |
| 1351 __ Push(Smi::FromInt(slot)); | 1350 __ Push(Smi::FromInt(slot)); |
| 1352 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); | 1351 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
| 1353 } | 1352 } |
| (...skipping 1259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2613 // Global var, const, or let. | 2612 // Global var, const, or let. |
| 2614 __ mov(StoreDescriptor::NameRegister(), var->name()); | 2613 __ mov(StoreDescriptor::NameRegister(), var->name()); |
| 2615 __ mov(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2614 __ mov(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
| 2616 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2615 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
| 2617 CallStoreIC(); | 2616 CallStoreIC(); |
| 2618 | 2617 |
| 2619 } else if (var->IsGlobalSlot()) { | 2618 } else if (var->IsGlobalSlot()) { |
| 2620 // Global var, const, or let. | 2619 // Global var, const, or let. |
| 2621 DCHECK(var->index() > 0); | 2620 DCHECK(var->index() > 0); |
| 2622 DCHECK(var->IsStaticGlobalObjectProperty()); | 2621 DCHECK(var->IsStaticGlobalObjectProperty()); |
| 2623 // Each var occupies two slots in the context: for reads and writes. | 2622 int const slot = var->index(); |
| 2624 int const slot = var->index() + 1; | |
| 2625 int const depth = scope()->ContextChainLength(var->scope()); | 2623 int const depth = scope()->ContextChainLength(var->scope()); |
| 2626 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 2624 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
| 2627 __ Move(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); | 2625 __ Move(StoreGlobalViaContextDescriptor::SlotRegister(), Immediate(slot)); |
| 2628 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax)); | 2626 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(eax)); |
| 2629 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | 2627 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
| 2630 __ CallStub(&stub); | 2628 __ CallStub(&stub); |
| 2631 } else { | 2629 } else { |
| 2632 __ Push(Smi::FromInt(slot)); | 2630 __ Push(Smi::FromInt(slot)); |
| 2633 __ Push(eax); | 2631 __ Push(eax); |
| 2634 __ CallRuntime(is_strict(language_mode()) | 2632 __ CallRuntime(is_strict(language_mode()) |
| (...skipping 2708 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5343 Assembler::target_address_at(call_target_address, | 5341 Assembler::target_address_at(call_target_address, |
| 5344 unoptimized_code)); | 5342 unoptimized_code)); |
| 5345 return OSR_AFTER_STACK_CHECK; | 5343 return OSR_AFTER_STACK_CHECK; |
| 5346 } | 5344 } |
| 5347 | 5345 |
| 5348 | 5346 |
| 5349 } // namespace internal | 5347 } // namespace internal |
| 5350 } // namespace v8 | 5348 } // namespace v8 |
| 5351 | 5349 |
| 5352 #endif // V8_TARGET_ARCH_IA32 | 5350 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |