OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/crankshaft/x64/lithium-codegen-x64.h" | 7 #include "src/crankshaft/x64/lithium-codegen-x64.h" |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2772 | 2772 |
2773 __ Move(LoadDescriptor::NameRegister(), instr->name()); | 2773 __ Move(LoadDescriptor::NameRegister(), instr->name()); |
2774 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2774 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2775 Handle<Code> ic = | 2775 Handle<Code> ic = |
2776 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), | 2776 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode(), |
2777 SLOPPY, PREMONOMORPHIC).code(); | 2777 SLOPPY, PREMONOMORPHIC).code(); |
2778 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2778 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2779 } | 2779 } |
2780 | 2780 |
2781 | 2781 |
2782 void LCodeGen::DoLoadGlobalViaContext(LLoadGlobalViaContext* instr) { | |
2783 DCHECK(ToRegister(instr->context()).is(rsi)); | |
2784 DCHECK(ToRegister(instr->result()).is(rax)); | |
2785 int const slot = instr->slot_index(); | |
2786 int const depth = instr->depth(); | |
2787 if (depth <= LoadGlobalViaContextStub::kMaximumDepth) { | |
2788 __ Set(LoadGlobalViaContextDescriptor::SlotRegister(), slot); | |
2789 Handle<Code> stub = | |
2790 CodeFactory::LoadGlobalViaContext(isolate(), depth).code(); | |
2791 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
2792 } else { | |
2793 __ Push(Smi::FromInt(slot)); | |
2794 __ CallRuntime(Runtime::kLoadGlobalViaContext, 1); | |
2795 } | |
2796 } | |
2797 | |
2798 | |
2799 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2782 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2800 Register context = ToRegister(instr->context()); | 2783 Register context = ToRegister(instr->context()); |
2801 Register result = ToRegister(instr->result()); | 2784 Register result = ToRegister(instr->result()); |
2802 __ movp(result, ContextOperand(context, instr->slot_index())); | 2785 __ movp(result, ContextOperand(context, instr->slot_index())); |
2803 if (instr->hydrogen()->RequiresHoleCheck()) { | 2786 if (instr->hydrogen()->RequiresHoleCheck()) { |
2804 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 2787 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
2805 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2788 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2806 DeoptimizeIf(equal, instr, Deoptimizer::kHole); | 2789 DeoptimizeIf(equal, instr, Deoptimizer::kHole); |
2807 } else { | 2790 } else { |
2808 Label is_not_hole; | 2791 Label is_not_hole; |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4128 } | 4111 } |
4129 | 4112 |
4130 __ Move(StoreDescriptor::NameRegister(), instr->hydrogen()->name()); | 4113 __ Move(StoreDescriptor::NameRegister(), instr->hydrogen()->name()); |
4131 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( | 4114 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( |
4132 isolate(), instr->language_mode(), | 4115 isolate(), instr->language_mode(), |
4133 instr->hydrogen()->initialization_state()).code(); | 4116 instr->hydrogen()->initialization_state()).code(); |
4134 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4117 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4135 } | 4118 } |
4136 | 4119 |
4137 | 4120 |
4138 void LCodeGen::DoStoreGlobalViaContext(LStoreGlobalViaContext* instr) { | |
4139 DCHECK(ToRegister(instr->context()).is(rsi)); | |
4140 DCHECK(ToRegister(instr->value()) | |
4141 .is(StoreGlobalViaContextDescriptor::ValueRegister())); | |
4142 int const slot = instr->slot_index(); | |
4143 int const depth = instr->depth(); | |
4144 if (depth <= StoreGlobalViaContextStub::kMaximumDepth) { | |
4145 __ Set(StoreGlobalViaContextDescriptor::SlotRegister(), slot); | |
4146 Handle<Code> stub = CodeFactory::StoreGlobalViaContext( | |
4147 isolate(), depth, instr->language_mode()) | |
4148 .code(); | |
4149 CallCode(stub, RelocInfo::CODE_TARGET, instr); | |
4150 } else { | |
4151 __ Push(Smi::FromInt(slot)); | |
4152 __ Push(StoreGlobalViaContextDescriptor::ValueRegister()); | |
4153 __ CallRuntime(is_strict(instr->language_mode()) | |
4154 ? Runtime::kStoreGlobalViaContext_Strict | |
4155 : Runtime::kStoreGlobalViaContext_Sloppy, | |
4156 2); | |
4157 } | |
4158 } | |
4159 | |
4160 | |
4161 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 4121 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
4162 Representation representation = instr->hydrogen()->length()->representation(); | 4122 Representation representation = instr->hydrogen()->length()->representation(); |
4163 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); | 4123 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); |
4164 DCHECK(representation.IsSmiOrInteger32()); | 4124 DCHECK(representation.IsSmiOrInteger32()); |
4165 | 4125 |
4166 Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; | 4126 Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; |
4167 if (instr->length()->IsConstantOperand()) { | 4127 if (instr->length()->IsConstantOperand()) { |
4168 int32_t length = ToInteger32(LConstantOperand::cast(instr->length())); | 4128 int32_t length = ToInteger32(LConstantOperand::cast(instr->length())); |
4169 Register index = ToRegister(instr->index()); | 4129 Register index = ToRegister(instr->index()); |
4170 if (representation.IsSmi()) { | 4130 if (representation.IsSmi()) { |
(...skipping 1733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5904 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5864 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5905 } | 5865 } |
5906 | 5866 |
5907 | 5867 |
5908 #undef __ | 5868 #undef __ |
5909 | 5869 |
5910 } // namespace internal | 5870 } // namespace internal |
5911 } // namespace v8 | 5871 } // namespace v8 |
5912 | 5872 |
5913 #endif // V8_TARGET_ARCH_X64 | 5873 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |