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 2551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2562 | 2562 |
2563 | 2563 |
2564 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { | 2564 void LCodeGen::DoLoadGlobalGeneric(LLoadGlobalGeneric* instr) { |
2565 DCHECK(ToRegister(instr->context()).is(rsi)); | 2565 DCHECK(ToRegister(instr->context()).is(rsi)); |
2566 DCHECK(ToRegister(instr->global_object()) | 2566 DCHECK(ToRegister(instr->global_object()) |
2567 .is(LoadDescriptor::ReceiverRegister())); | 2567 .is(LoadDescriptor::ReceiverRegister())); |
2568 DCHECK(ToRegister(instr->result()).is(rax)); | 2568 DCHECK(ToRegister(instr->result()).is(rax)); |
2569 | 2569 |
2570 __ Move(LoadDescriptor::NameRegister(), instr->name()); | 2570 __ Move(LoadDescriptor::NameRegister(), instr->name()); |
2571 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2571 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2572 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode( | 2572 Handle<Code> ic = |
2573 isolate(), instr->typeof_mode(), PREMONOMORPHIC) | 2573 CodeFactory::LoadICInOptimizedCode(isolate(), instr->typeof_mode()) |
2574 .code(); | 2574 .code(); |
2575 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2575 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2576 } | 2576 } |
2577 | 2577 |
2578 | 2578 |
2579 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2579 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2580 Register context = ToRegister(instr->context()); | 2580 Register context = ToRegister(instr->context()); |
2581 Register result = ToRegister(instr->result()); | 2581 Register result = ToRegister(instr->result()); |
2582 __ movp(result, ContextOperand(context, instr->slot_index())); | 2582 __ movp(result, ContextOperand(context, instr->slot_index())); |
2583 if (instr->hydrogen()->RequiresHoleCheck()) { | 2583 if (instr->hydrogen()->RequiresHoleCheck()) { |
2584 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 2584 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2679 } | 2679 } |
2680 | 2680 |
2681 | 2681 |
2682 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { | 2682 void LCodeGen::DoLoadNamedGeneric(LLoadNamedGeneric* instr) { |
2683 DCHECK(ToRegister(instr->context()).is(rsi)); | 2683 DCHECK(ToRegister(instr->context()).is(rsi)); |
2684 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 2684 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
2685 DCHECK(ToRegister(instr->result()).is(rax)); | 2685 DCHECK(ToRegister(instr->result()).is(rax)); |
2686 | 2686 |
2687 __ Move(LoadDescriptor::NameRegister(), instr->name()); | 2687 __ Move(LoadDescriptor::NameRegister(), instr->name()); |
2688 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); | 2688 EmitVectorLoadICRegisters<LLoadNamedGeneric>(instr); |
2689 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode( | 2689 Handle<Code> ic = |
2690 isolate(), NOT_INSIDE_TYPEOF, | 2690 CodeFactory::LoadICInOptimizedCode(isolate(), NOT_INSIDE_TYPEOF).code(); |
2691 instr->hydrogen()->initialization_state()) | |
2692 .code(); | |
2693 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2691 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2694 } | 2692 } |
2695 | 2693 |
2696 | 2694 |
2697 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { | 2695 void LCodeGen::DoLoadFunctionPrototype(LLoadFunctionPrototype* instr) { |
2698 Register function = ToRegister(instr->function()); | 2696 Register function = ToRegister(instr->function()); |
2699 Register result = ToRegister(instr->result()); | 2697 Register result = ToRegister(instr->result()); |
2700 | 2698 |
2701 // Get the prototype or initial map from the function. | 2699 // Get the prototype or initial map from the function. |
2702 __ movp(result, | 2700 __ movp(result, |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2966 offset); | 2964 offset); |
2967 } | 2965 } |
2968 } | 2966 } |
2969 | 2967 |
2970 | 2968 |
2971 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { | 2969 void LCodeGen::DoLoadKeyedGeneric(LLoadKeyedGeneric* instr) { |
2972 DCHECK(ToRegister(instr->context()).is(rsi)); | 2970 DCHECK(ToRegister(instr->context()).is(rsi)); |
2973 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); | 2971 DCHECK(ToRegister(instr->object()).is(LoadDescriptor::ReceiverRegister())); |
2974 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); | 2972 DCHECK(ToRegister(instr->key()).is(LoadDescriptor::NameRegister())); |
2975 | 2973 |
2976 if (instr->hydrogen()->HasVectorAndSlot()) { | 2974 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); |
2977 EmitVectorLoadICRegisters<LLoadKeyedGeneric>(instr); | |
2978 } | |
2979 | 2975 |
2980 Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode( | 2976 Handle<Code> ic = CodeFactory::KeyedLoadICInOptimizedCode(isolate()).code(); |
2981 isolate(), instr->hydrogen()->initialization_state()) | |
2982 .code(); | |
2983 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2977 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2984 } | 2978 } |
2985 | 2979 |
2986 | 2980 |
2987 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { | 2981 void LCodeGen::DoArgumentsElements(LArgumentsElements* instr) { |
2988 Register result = ToRegister(instr->result()); | 2982 Register result = ToRegister(instr->result()); |
2989 | 2983 |
2990 if (instr->hydrogen()->from_inlined()) { | 2984 if (instr->hydrogen()->from_inlined()) { |
2991 __ leap(result, Operand(rsp, -kFPOnStackSize + -kPCOnStackSize)); | 2985 __ leap(result, Operand(rsp, -kFPOnStackSize + -kPCOnStackSize)); |
2992 } else if (instr->hydrogen()->arguments_adaptor()) { | 2986 } else if (instr->hydrogen()->arguments_adaptor()) { |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3924 hinstr->PointersToHereCheckForValue()); | 3918 hinstr->PointersToHereCheckForValue()); |
3925 } | 3919 } |
3926 } | 3920 } |
3927 | 3921 |
3928 | 3922 |
3929 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { | 3923 void LCodeGen::DoStoreNamedGeneric(LStoreNamedGeneric* instr) { |
3930 DCHECK(ToRegister(instr->context()).is(rsi)); | 3924 DCHECK(ToRegister(instr->context()).is(rsi)); |
3931 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 3925 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
3932 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 3926 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
3933 | 3927 |
3934 if (instr->hydrogen()->HasVectorAndSlot()) { | 3928 EmitVectorStoreICRegisters<LStoreNamedGeneric>(instr); |
3935 EmitVectorStoreICRegisters<LStoreNamedGeneric>(instr); | |
3936 } | |
3937 | 3929 |
3938 __ Move(StoreDescriptor::NameRegister(), instr->hydrogen()->name()); | 3930 __ Move(StoreDescriptor::NameRegister(), instr->hydrogen()->name()); |
3939 Handle<Code> ic = CodeFactory::StoreICInOptimizedCode( | 3931 Handle<Code> ic = |
3940 isolate(), instr->language_mode(), | 3932 CodeFactory::StoreICInOptimizedCode(isolate(), instr->language_mode()) |
3941 instr->hydrogen()->initialization_state()).code(); | 3933 .code(); |
3942 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 3934 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
3943 } | 3935 } |
3944 | 3936 |
3945 | 3937 |
3946 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { | 3938 void LCodeGen::DoBoundsCheck(LBoundsCheck* instr) { |
3947 Representation representation = instr->hydrogen()->length()->representation(); | 3939 Representation representation = instr->hydrogen()->length()->representation(); |
3948 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); | 3940 DCHECK(representation.Equals(instr->hydrogen()->index()->representation())); |
3949 DCHECK(representation.IsSmiOrInteger32()); | 3941 DCHECK(representation.IsSmiOrInteger32()); |
3950 | 3942 |
3951 Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; | 3943 Condition cc = instr->hydrogen()->allow_equality() ? below : below_equal; |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4183 } | 4175 } |
4184 } | 4176 } |
4185 | 4177 |
4186 | 4178 |
4187 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { | 4179 void LCodeGen::DoStoreKeyedGeneric(LStoreKeyedGeneric* instr) { |
4188 DCHECK(ToRegister(instr->context()).is(rsi)); | 4180 DCHECK(ToRegister(instr->context()).is(rsi)); |
4189 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); | 4181 DCHECK(ToRegister(instr->object()).is(StoreDescriptor::ReceiverRegister())); |
4190 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); | 4182 DCHECK(ToRegister(instr->key()).is(StoreDescriptor::NameRegister())); |
4191 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); | 4183 DCHECK(ToRegister(instr->value()).is(StoreDescriptor::ValueRegister())); |
4192 | 4184 |
4193 if (instr->hydrogen()->HasVectorAndSlot()) { | 4185 EmitVectorStoreICRegisters<LStoreKeyedGeneric>(instr); |
4194 EmitVectorStoreICRegisters<LStoreKeyedGeneric>(instr); | |
4195 } | |
4196 | 4186 |
4197 Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode( | 4187 Handle<Code> ic = CodeFactory::KeyedStoreICInOptimizedCode( |
4198 isolate(), instr->language_mode(), | 4188 isolate(), instr->language_mode()) |
4199 instr->hydrogen()->initialization_state()).code(); | 4189 .code(); |
4200 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 4190 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
4201 } | 4191 } |
4202 | 4192 |
4203 | 4193 |
4204 void LCodeGen::DoMaybeGrowElements(LMaybeGrowElements* instr) { | 4194 void LCodeGen::DoMaybeGrowElements(LMaybeGrowElements* instr) { |
4205 class DeferredMaybeGrowElements final : public LDeferredCode { | 4195 class DeferredMaybeGrowElements final : public LDeferredCode { |
4206 public: | 4196 public: |
4207 DeferredMaybeGrowElements(LCodeGen* codegen, LMaybeGrowElements* instr) | 4197 DeferredMaybeGrowElements(LCodeGen* codegen, LMaybeGrowElements* instr) |
4208 : LDeferredCode(codegen), instr_(instr) {} | 4198 : LDeferredCode(codegen), instr_(instr) {} |
4209 void Generate() override { codegen()->DoDeferredMaybeGrowElements(instr_); } | 4199 void Generate() override { codegen()->DoDeferredMaybeGrowElements(instr_); } |
(...skipping 1414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5624 __ bind(deferred->exit()); | 5614 __ bind(deferred->exit()); |
5625 __ bind(&done); | 5615 __ bind(&done); |
5626 } | 5616 } |
5627 | 5617 |
5628 #undef __ | 5618 #undef __ |
5629 | 5619 |
5630 } // namespace internal | 5620 } // namespace internal |
5631 } // namespace v8 | 5621 } // namespace v8 |
5632 | 5622 |
5633 #endif // V8_TARGET_ARCH_X64 | 5623 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |