| 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 #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/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 2830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2841 __ shlp(reg, Immediate(kPointerSizeLog2)); | 2841 __ shlp(reg, Immediate(kPointerSizeLog2)); |
| 2842 __ addp(rsp, reg); | 2842 __ addp(rsp, reg); |
| 2843 __ jmp(return_addr_reg); | 2843 __ jmp(return_addr_reg); |
| 2844 } | 2844 } |
| 2845 if (no_frame_start != -1) { | 2845 if (no_frame_start != -1) { |
| 2846 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 2846 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
| 2847 } | 2847 } |
| 2848 } | 2848 } |
| 2849 | 2849 |
| 2850 | 2850 |
| 2851 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | |
| 2852 Register result = ToRegister(instr->result()); | |
| 2853 __ LoadGlobalCell(result, instr->hydrogen()->cell().handle()); | |
| 2854 if (instr->hydrogen()->RequiresHoleCheck()) { | |
| 2855 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | |
| 2856 DeoptimizeIf(equal, instr, Deoptimizer::kHole); | |
| 2857 } | |
| 2858 } | |
| 2859 | |
| 2860 | |
| 2861 template <class T> | 2851 template <class T> |
| 2862 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { | 2852 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { |
| 2863 DCHECK(FLAG_vector_ics); | 2853 DCHECK(FLAG_vector_ics); |
| 2864 Register vector_register = ToRegister(instr->temp_vector()); | 2854 Register vector_register = ToRegister(instr->temp_vector()); |
| 2865 Register slot_register = VectorLoadICDescriptor::SlotRegister(); | 2855 Register slot_register = VectorLoadICDescriptor::SlotRegister(); |
| 2866 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); | 2856 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); |
| 2867 DCHECK(slot_register.is(rax)); | 2857 DCHECK(slot_register.is(rax)); |
| 2868 | 2858 |
| 2869 AllowDeferredHandleDereference vector_structure_check; | 2859 AllowDeferredHandleDereference vector_structure_check; |
| 2870 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); | 2860 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 2886 if (FLAG_vector_ics) { | 2876 if (FLAG_vector_ics) { |
| 2887 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2877 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
| 2888 } | 2878 } |
| 2889 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 2879 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
| 2890 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, | 2880 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, |
| 2891 PREMONOMORPHIC).code(); | 2881 PREMONOMORPHIC).code(); |
| 2892 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2882 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
| 2893 } | 2883 } |
| 2894 | 2884 |
| 2895 | 2885 |
| 2896 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | |
| 2897 Register value = ToRegister(instr->value()); | |
| 2898 Handle<Cell> cell_handle = instr->hydrogen()->cell().handle(); | |
| 2899 | |
| 2900 // If the cell we are storing to contains the hole it could have | |
| 2901 // been deleted from the property dictionary. In that case, we need | |
| 2902 // to update the property details in the property dictionary to mark | |
| 2903 // it as no longer deleted. We deoptimize in that case. | |
| 2904 if (instr->hydrogen()->RequiresHoleCheck()) { | |
| 2905 // We have a temp because CompareRoot might clobber kScratchRegister. | |
| 2906 Register cell = ToRegister(instr->temp()); | |
| 2907 DCHECK(!value.is(cell)); | |
| 2908 __ Move(cell, cell_handle, RelocInfo::CELL); | |
| 2909 __ CompareRoot(Operand(cell, 0), Heap::kTheHoleValueRootIndex); | |
| 2910 DeoptimizeIf(equal, instr, Deoptimizer::kHole); | |
| 2911 // Store the value. | |
| 2912 __ movp(Operand(cell, 0), value); | |
| 2913 } else { | |
| 2914 // Store the value. | |
| 2915 __ Move(kScratchRegister, cell_handle, RelocInfo::CELL); | |
| 2916 __ movp(Operand(kScratchRegister, 0), value); | |
| 2917 } | |
| 2918 // Cells are always rescanned, so no write barrier here. | |
| 2919 } | |
| 2920 | |
| 2921 | |
| 2922 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2886 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
| 2923 Register context = ToRegister(instr->context()); | 2887 Register context = ToRegister(instr->context()); |
| 2924 Register result = ToRegister(instr->result()); | 2888 Register result = ToRegister(instr->result()); |
| 2925 __ movp(result, ContextOperand(context, instr->slot_index())); | 2889 __ movp(result, ContextOperand(context, instr->slot_index())); |
| 2926 if (instr->hydrogen()->RequiresHoleCheck()) { | 2890 if (instr->hydrogen()->RequiresHoleCheck()) { |
| 2927 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 2891 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
| 2928 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2892 if (instr->hydrogen()->DeoptimizesOnHole()) { |
| 2929 DeoptimizeIf(equal, instr, Deoptimizer::kHole); | 2893 DeoptimizeIf(equal, instr, Deoptimizer::kHole); |
| 2930 } else { | 2894 } else { |
| 2931 Label is_not_hole; | 2895 Label is_not_hole; |
| (...skipping 3007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5939 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5903 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5940 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5904 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5941 } | 5905 } |
| 5942 | 5906 |
| 5943 | 5907 |
| 5944 #undef __ | 5908 #undef __ |
| 5945 | 5909 |
| 5946 } } // namespace v8::internal | 5910 } } // namespace v8::internal |
| 5947 | 5911 |
| 5948 #endif // V8_TARGET_ARCH_X64 | 5912 #endif // V8_TARGET_ARCH_X64 |
| OLD | NEW |