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 2866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2877 __ shlp(reg, Immediate(kPointerSizeLog2)); | 2877 __ shlp(reg, Immediate(kPointerSizeLog2)); |
2878 __ addp(rsp, reg); | 2878 __ addp(rsp, reg); |
2879 __ jmp(return_addr_reg); | 2879 __ jmp(return_addr_reg); |
2880 } | 2880 } |
2881 if (no_frame_start != -1) { | 2881 if (no_frame_start != -1) { |
2882 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); | 2882 info_->AddNoFrameRange(no_frame_start, masm_->pc_offset()); |
2883 } | 2883 } |
2884 } | 2884 } |
2885 | 2885 |
2886 | 2886 |
2887 void LCodeGen::DoLoadGlobalCell(LLoadGlobalCell* instr) { | |
2888 Register result = ToRegister(instr->result()); | |
2889 __ LoadGlobalCell(result, instr->hydrogen()->cell().handle()); | |
2890 if (instr->hydrogen()->RequiresHoleCheck()) { | |
2891 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | |
2892 DeoptimizeIf(equal, instr, Deoptimizer::kHole); | |
2893 } | |
2894 } | |
2895 | |
2896 | |
2897 template <class T> | 2887 template <class T> |
2898 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { | 2888 void LCodeGen::EmitVectorLoadICRegisters(T* instr) { |
2899 DCHECK(FLAG_vector_ics); | 2889 DCHECK(FLAG_vector_ics); |
2900 Register vector_register = ToRegister(instr->temp_vector()); | 2890 Register vector_register = ToRegister(instr->temp_vector()); |
2901 Register slot_register = VectorLoadICDescriptor::SlotRegister(); | 2891 Register slot_register = VectorLoadICDescriptor::SlotRegister(); |
2902 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); | 2892 DCHECK(vector_register.is(VectorLoadICDescriptor::VectorRegister())); |
2903 DCHECK(slot_register.is(rax)); | 2893 DCHECK(slot_register.is(rax)); |
2904 | 2894 |
2905 AllowDeferredHandleDereference vector_structure_check; | 2895 AllowDeferredHandleDereference vector_structure_check; |
2906 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); | 2896 Handle<TypeFeedbackVector> vector = instr->hydrogen()->feedback_vector(); |
(...skipping 15 matching lines...) Expand all Loading... |
2922 if (FLAG_vector_ics) { | 2912 if (FLAG_vector_ics) { |
2923 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); | 2913 EmitVectorLoadICRegisters<LLoadGlobalGeneric>(instr); |
2924 } | 2914 } |
2925 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; | 2915 ContextualMode mode = instr->for_typeof() ? NOT_CONTEXTUAL : CONTEXTUAL; |
2926 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, | 2916 Handle<Code> ic = CodeFactory::LoadICInOptimizedCode(isolate(), mode, |
2927 PREMONOMORPHIC).code(); | 2917 PREMONOMORPHIC).code(); |
2928 CallCode(ic, RelocInfo::CODE_TARGET, instr); | 2918 CallCode(ic, RelocInfo::CODE_TARGET, instr); |
2929 } | 2919 } |
2930 | 2920 |
2931 | 2921 |
2932 void LCodeGen::DoStoreGlobalCell(LStoreGlobalCell* instr) { | |
2933 Register value = ToRegister(instr->value()); | |
2934 Handle<Cell> cell_handle = instr->hydrogen()->cell().handle(); | |
2935 | |
2936 // If the cell we are storing to contains the hole it could have | |
2937 // been deleted from the property dictionary. In that case, we need | |
2938 // to update the property details in the property dictionary to mark | |
2939 // it as no longer deleted. We deoptimize in that case. | |
2940 if (instr->hydrogen()->RequiresHoleCheck()) { | |
2941 // We have a temp because CompareRoot might clobber kScratchRegister. | |
2942 Register cell = ToRegister(instr->temp()); | |
2943 DCHECK(!value.is(cell)); | |
2944 __ Move(cell, cell_handle, RelocInfo::CELL); | |
2945 __ CompareRoot(Operand(cell, 0), Heap::kTheHoleValueRootIndex); | |
2946 DeoptimizeIf(equal, instr, Deoptimizer::kHole); | |
2947 // Store the value. | |
2948 __ movp(Operand(cell, 0), value); | |
2949 } else { | |
2950 // Store the value. | |
2951 __ Move(kScratchRegister, cell_handle, RelocInfo::CELL); | |
2952 __ movp(Operand(kScratchRegister, 0), value); | |
2953 } | |
2954 // Cells are always rescanned, so no write barrier here. | |
2955 } | |
2956 | |
2957 | |
2958 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { | 2922 void LCodeGen::DoLoadContextSlot(LLoadContextSlot* instr) { |
2959 Register context = ToRegister(instr->context()); | 2923 Register context = ToRegister(instr->context()); |
2960 Register result = ToRegister(instr->result()); | 2924 Register result = ToRegister(instr->result()); |
2961 __ movp(result, ContextOperand(context, instr->slot_index())); | 2925 __ movp(result, ContextOperand(context, instr->slot_index())); |
2962 if (instr->hydrogen()->RequiresHoleCheck()) { | 2926 if (instr->hydrogen()->RequiresHoleCheck()) { |
2963 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); | 2927 __ CompareRoot(result, Heap::kTheHoleValueRootIndex); |
2964 if (instr->hydrogen()->DeoptimizesOnHole()) { | 2928 if (instr->hydrogen()->DeoptimizesOnHole()) { |
2965 DeoptimizeIf(equal, instr, Deoptimizer::kHole); | 2929 DeoptimizeIf(equal, instr, Deoptimizer::kHole); |
2966 } else { | 2930 } else { |
2967 Label is_not_hole; | 2931 Label is_not_hole; |
(...skipping 2999 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5967 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5931 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5968 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5932 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5969 } | 5933 } |
5970 | 5934 |
5971 | 5935 |
5972 #undef __ | 5936 #undef __ |
5973 | 5937 |
5974 } } // namespace v8::internal | 5938 } } // namespace v8::internal |
5975 | 5939 |
5976 #endif // V8_TARGET_ARCH_X64 | 5940 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |