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/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/api-arguments.h" | 8 #include "src/api-arguments.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 2937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2948 __ movp(rbx, MemOperand(rbp, parameter_count_offset)); | 2948 __ movp(rbx, MemOperand(rbp, parameter_count_offset)); |
2949 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 2949 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
2950 __ PopReturnAddressTo(rcx); | 2950 __ PopReturnAddressTo(rcx); |
2951 int additional_offset = | 2951 int additional_offset = |
2952 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; | 2952 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; |
2953 __ leap(rsp, MemOperand(rsp, rbx, times_pointer_size, additional_offset)); | 2953 __ leap(rsp, MemOperand(rsp, rbx, times_pointer_size, additional_offset)); |
2954 __ jmp(rcx); // Return to IC Miss stub, continuation still on stack. | 2954 __ jmp(rcx); // Return to IC Miss stub, continuation still on stack. |
2955 } | 2955 } |
2956 | 2956 |
2957 | 2957 |
2958 void LoadICTrampolineStub::Generate(MacroAssembler* masm) { | |
2959 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); | |
2960 LoadICStub stub(isolate()); | |
2961 stub.GenerateForTrampoline(masm); | |
2962 } | |
2963 | |
2964 | |
2965 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { | 2958 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { |
2966 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); | 2959 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); |
2967 KeyedLoadICStub stub(isolate()); | 2960 KeyedLoadICStub stub(isolate()); |
2968 stub.GenerateForTrampoline(masm); | 2961 stub.GenerateForTrampoline(masm); |
2969 } | 2962 } |
2970 | 2963 |
2971 | 2964 |
2972 static void HandleArrayCases(MacroAssembler* masm, Register feedback, | 2965 static void HandleArrayCases(MacroAssembler* masm, Register feedback, |
2973 Register receiver_map, Register scratch1, | 2966 Register receiver_map, Register scratch1, |
2974 Register scratch2, Register scratch3, | 2967 Register scratch2, Register scratch3, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3034 __ cmpp(receiver_map, FieldOperand(feedback, WeakCell::kValueOffset)); | 3027 __ cmpp(receiver_map, FieldOperand(feedback, WeakCell::kValueOffset)); |
3035 __ j(not_equal, try_array); | 3028 __ j(not_equal, try_array); |
3036 Register handler = feedback; | 3029 Register handler = feedback; |
3037 __ movp(handler, FieldOperand(vector, integer_slot, times_pointer_size, | 3030 __ movp(handler, FieldOperand(vector, integer_slot, times_pointer_size, |
3038 FixedArray::kHeaderSize + kPointerSize)); | 3031 FixedArray::kHeaderSize + kPointerSize)); |
3039 __ leap(handler, FieldOperand(handler, Code::kHeaderSize)); | 3032 __ leap(handler, FieldOperand(handler, Code::kHeaderSize)); |
3040 __ jmp(handler); | 3033 __ jmp(handler); |
3041 } | 3034 } |
3042 | 3035 |
3043 | 3036 |
3044 void LoadICStub::Generate(MacroAssembler* masm) { GenerateImpl(masm, false); } | |
3045 | |
3046 | |
3047 void LoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | |
3048 GenerateImpl(masm, true); | |
3049 } | |
3050 | |
3051 | |
3052 void LoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | |
3053 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // rdx | |
3054 Register name = LoadWithVectorDescriptor::NameRegister(); // rcx | |
3055 Register vector = LoadWithVectorDescriptor::VectorRegister(); // rbx | |
3056 Register slot = LoadWithVectorDescriptor::SlotRegister(); // rax | |
3057 Register feedback = rdi; | |
3058 Register integer_slot = r8; | |
3059 Register receiver_map = r9; | |
3060 | |
3061 __ SmiToInteger32(integer_slot, slot); | |
3062 __ movp(feedback, FieldOperand(vector, integer_slot, times_pointer_size, | |
3063 FixedArray::kHeaderSize)); | |
3064 | |
3065 // Try to quickly handle the monomorphic case without knowing for sure | |
3066 // if we have a weak cell in feedback. We do know it's safe to look | |
3067 // at WeakCell::kValueOffset. | |
3068 Label try_array, load_smi_map, compare_map; | |
3069 Label not_array, miss; | |
3070 HandleMonomorphicCase(masm, receiver, receiver_map, feedback, vector, | |
3071 integer_slot, &compare_map, &load_smi_map, &try_array); | |
3072 | |
3073 // Is it a fixed array? | |
3074 __ bind(&try_array); | |
3075 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); | |
3076 __ j(not_equal, ¬_array); | |
3077 HandleArrayCases(masm, feedback, receiver_map, integer_slot, r11, r15, true, | |
3078 &miss); | |
3079 | |
3080 __ bind(¬_array); | |
3081 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | |
3082 __ j(not_equal, &miss); | |
3083 masm->isolate()->load_stub_cache()->GenerateProbe(masm, receiver, name, | |
3084 feedback, no_reg); | |
3085 | |
3086 __ bind(&miss); | |
3087 LoadIC::GenerateMiss(masm); | |
3088 | |
3089 __ bind(&load_smi_map); | |
3090 __ LoadRoot(receiver_map, Heap::kHeapNumberMapRootIndex); | |
3091 __ jmp(&compare_map); | |
3092 } | |
3093 | |
3094 | |
3095 void KeyedLoadICStub::Generate(MacroAssembler* masm) { | 3037 void KeyedLoadICStub::Generate(MacroAssembler* masm) { |
3096 GenerateImpl(masm, false); | 3038 GenerateImpl(masm, false); |
3097 } | 3039 } |
3098 | 3040 |
3099 | 3041 |
3100 void KeyedLoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | 3042 void KeyedLoadICStub::GenerateForTrampoline(MacroAssembler* masm) { |
3101 GenerateImpl(masm, true); | 3043 GenerateImpl(masm, true); |
3102 } | 3044 } |
3103 | 3045 |
3104 | 3046 |
(...skipping 1790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4895 kStackUnwindSpace, nullptr, return_value_operand, | 4837 kStackUnwindSpace, nullptr, return_value_operand, |
4896 NULL); | 4838 NULL); |
4897 } | 4839 } |
4898 | 4840 |
4899 #undef __ | 4841 #undef __ |
4900 | 4842 |
4901 } // namespace internal | 4843 } // namespace internal |
4902 } // namespace v8 | 4844 } // namespace v8 |
4903 | 4845 |
4904 #endif // V8_TARGET_ARCH_X64 | 4846 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |