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_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 // Note on Mips implementation: | 9 // Note on Mips implementation: |
10 // | 10 // |
(...skipping 1384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1395 | 1395 |
1396 | 1396 |
1397 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, | 1397 void FullCodeGenerator::EmitGlobalVariableLoad(VariableProxy* proxy, |
1398 TypeofMode typeof_mode) { | 1398 TypeofMode typeof_mode) { |
1399 Variable* var = proxy->var(); | 1399 Variable* var = proxy->var(); |
1400 DCHECK(var->IsUnallocatedOrGlobalSlot() || | 1400 DCHECK(var->IsUnallocatedOrGlobalSlot() || |
1401 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); | 1401 (var->IsLookupSlot() && var->mode() == DYNAMIC_GLOBAL)); |
1402 if (var->IsGlobalSlot()) { | 1402 if (var->IsGlobalSlot()) { |
1403 DCHECK(var->index() > 0); | 1403 DCHECK(var->index() > 0); |
1404 DCHECK(var->IsStaticGlobalObjectProperty()); | 1404 DCHECK(var->IsStaticGlobalObjectProperty()); |
1405 // Each var occupies two slots in the context: for reads and writes. | |
1406 int const slot = var->index(); | 1405 int const slot = var->index(); |
1407 int const depth = scope()->ContextChainLength(var->scope()); | 1406 int const depth = scope()->ContextChainLength(var->scope()); |
1408 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | 1407 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { |
1409 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | 1408 __ li(LoadGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
1410 LoadGlobalViaContextStub stub(isolate(), depth); | 1409 LoadGlobalViaContextStub stub(isolate(), depth); |
1411 __ CallStub(&stub); | 1410 __ CallStub(&stub); |
1412 } else { | 1411 } else { |
1413 __ Push(Smi::FromInt(slot)); | 1412 __ Push(Smi::FromInt(slot)); |
1414 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); | 1413 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); |
1415 } | 1414 } |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2693 __ ld(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 2692 __ ld(StoreDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
2694 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); | 2693 if (FLAG_vector_stores) EmitLoadStoreICSlot(slot); |
2695 CallStoreIC(); | 2694 CallStoreIC(); |
2696 | 2695 |
2697 } else if (var->IsGlobalSlot()) { | 2696 } else if (var->IsGlobalSlot()) { |
2698 // Global var, const, or let. | 2697 // Global var, const, or let. |
2699 DCHECK(var->index() > 0); | 2698 DCHECK(var->index() > 0); |
2700 DCHECK(var->IsStaticGlobalObjectProperty()); | 2699 DCHECK(var->IsStaticGlobalObjectProperty()); |
2701 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(a0)); | 2700 DCHECK(StoreGlobalViaContextDescriptor::ValueRegister().is(a0)); |
2702 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register()); | 2701 __ mov(StoreGlobalViaContextDescriptor::ValueRegister(), result_register()); |
2703 // Each var occupies two slots in the context: for reads and writes. | 2702 int const slot = var->index(); |
2704 int const slot = var->index() + 1; | |
2705 int const depth = scope()->ContextChainLength(var->scope()); | 2703 int const depth = scope()->ContextChainLength(var->scope()); |
2706 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | 2704 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { |
2707 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); | 2705 __ li(StoreGlobalViaContextDescriptor::SlotRegister(), Operand(slot)); |
2708 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); | 2706 StoreGlobalViaContextStub stub(isolate(), depth, language_mode()); |
2709 __ CallStub(&stub); | 2707 __ CallStub(&stub); |
2710 } else { | 2708 } else { |
2711 __ Push(Smi::FromInt(slot)); | 2709 __ Push(Smi::FromInt(slot)); |
2712 __ Push(a0); | 2710 __ Push(a0); |
2713 __ CallRuntime(is_strict(language_mode()) | 2711 __ CallRuntime(is_strict(language_mode()) |
2714 ? Runtime::kStoreGlobalViaContext_Strict | 2712 ? Runtime::kStoreGlobalViaContext_Strict |
(...skipping 2722 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5437 reinterpret_cast<uint64_t>( | 5435 reinterpret_cast<uint64_t>( |
5438 isolate->builtins()->OsrAfterStackCheck()->entry())); | 5436 isolate->builtins()->OsrAfterStackCheck()->entry())); |
5439 return OSR_AFTER_STACK_CHECK; | 5437 return OSR_AFTER_STACK_CHECK; |
5440 } | 5438 } |
5441 | 5439 |
5442 | 5440 |
5443 } // namespace internal | 5441 } // namespace internal |
5444 } // namespace v8 | 5442 } // namespace v8 |
5445 | 5443 |
5446 #endif // V8_TARGET_ARCH_MIPS64 | 5444 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |