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_X64 | 7 #if V8_TARGET_ARCH_X64 |
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 2596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2607 // Global var, const, or let. | 2607 // Global var, const, or let. |
2608 __ Move(StoreDescriptor::NameRegister(), var->name()); | 2608 __ Move(StoreDescriptor::NameRegister(), var->name()); |
2609 __ movp(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2609 __ movp(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
2610 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2610 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2611 CallStoreIC(); | 2611 CallStoreIC(); |
2612 | 2612 |
2613 } else if (var->IsGlobalSlot()) { | 2613 } else if (var->IsGlobalSlot()) { |
2614 // Global var, const, or let. | 2614 // Global var, const, or let. |
2615 DCHECK(var->index() > 0); | 2615 DCHECK(var->index() > 0); |
2616 DCHECK(var->IsStaticGlobalObjectProperty()); | 2616 DCHECK(var->IsStaticGlobalObjectProperty()); |
2617 // Each var occupies two slots in the context: for reads and writes. | 2617 int const slot = var->index(); |
2618 int const slot = var->index() + 1; | |
2619 int const depth = scope()->ContextChainLength(var->scope()); | 2618 int const depth = scope()->ContextChainLength(var->scope()); |
2620 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 2619 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
2621 __ Set(StoreGlobalViaContextDescriptor::SlotRegister(), slot); | 2620 __ Set(StoreGlobalViaContextDescriptor::SlotRegister(), slot); |
2622 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(rax)); | 2621 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(rax)); |
2623 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | 2622 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
2624 __ CallStub(&stub); | 2623 __ CallStub(&stub); |
2625 } else { | 2624 } else { |
2626 __ Push(Smi::FromInt(slot)); | 2625 __ Push(Smi::FromInt(slot)); |
2627 __ Push(rax); | 2626 __ Push(rax); |
2628 __ CallRuntime(is_strict(language_mode()) | 2627 __ CallRuntime(is_strict(language_mode()) |
(...skipping 2732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5361 Assembler::target_address_at(call_target_address, | 5360 Assembler::target_address_at(call_target_address, |
5362 unoptimized_code)); | 5361 unoptimized_code)); |
5363 return OSR_AFTER_STACK_CHECK; | 5362 return OSR_AFTER_STACK_CHECK; |
5364 } | 5363 } |
5365 | 5364 |
5366 | 5365 |
5367 } // namespace internal | 5366 } // namespace internal |
5368 } // namespace v8 | 5367 } // namespace v8 |
5369 | 5368 |
5370 #endif // V8_TARGET_ARCH_X64 | 5369 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |