| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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_X87 | 5 #if V8_TARGET_ARCH_X87 |
| 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/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
| (...skipping 2816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2827 StubFailureTrampolineFrameConstants::kArgumentsLengthOffset; | 2827 StubFailureTrampolineFrameConstants::kArgumentsLengthOffset; |
| 2828 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); | 2828 __ mov(ebx, MemOperand(ebp, parameter_count_offset)); |
| 2829 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); | 2829 masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE); |
| 2830 __ pop(ecx); | 2830 __ pop(ecx); |
| 2831 int additional_offset = | 2831 int additional_offset = |
| 2832 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; | 2832 function_mode() == JS_FUNCTION_STUB_MODE ? kPointerSize : 0; |
| 2833 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); | 2833 __ lea(esp, MemOperand(esp, ebx, times_pointer_size, additional_offset)); |
| 2834 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. | 2834 __ jmp(ecx); // Return to IC Miss stub, continuation still on stack. |
| 2835 } | 2835 } |
| 2836 | 2836 |
| 2837 | |
| 2838 void KeyedLoadICTrampolineStub::Generate(MacroAssembler* masm) { | |
| 2839 __ EmitLoadTypeFeedbackVector(LoadWithVectorDescriptor::VectorRegister()); | |
| 2840 KeyedLoadICStub stub(isolate()); | |
| 2841 stub.GenerateForTrampoline(masm); | |
| 2842 } | |
| 2843 | |
| 2844 | |
| 2845 static void HandleArrayCases(MacroAssembler* masm, Register receiver, | 2837 static void HandleArrayCases(MacroAssembler* masm, Register receiver, |
| 2846 Register key, Register vector, Register slot, | 2838 Register key, Register vector, Register slot, |
| 2847 Register feedback, bool is_polymorphic, | 2839 Register feedback, bool is_polymorphic, |
| 2848 Label* miss) { | 2840 Label* miss) { |
| 2849 // feedback initially contains the feedback array | 2841 // feedback initially contains the feedback array |
| 2850 Label next, next_loop, prepare_next; | 2842 Label next, next_loop, prepare_next; |
| 2851 Label load_smi_map, compare_map; | 2843 Label load_smi_map, compare_map; |
| 2852 Label start_polymorphic; | 2844 Label start_polymorphic; |
| 2853 | 2845 |
| 2854 __ push(receiver); | 2846 __ push(receiver); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2946 // the handler is duplicated for a HeapObject receiver and a Smi receiver. | 2938 // the handler is duplicated for a HeapObject receiver and a Smi receiver. |
| 2947 __ bind(&compare_smi_map); | 2939 __ bind(&compare_smi_map); |
| 2948 __ CompareRoot(ic_map, Heap::kHeapNumberMapRootIndex); | 2940 __ CompareRoot(ic_map, Heap::kHeapNumberMapRootIndex); |
| 2949 __ j(not_equal, miss); | 2941 __ j(not_equal, miss); |
| 2950 __ mov(handler, FieldOperand(vector, slot, times_half_pointer_size, | 2942 __ mov(handler, FieldOperand(vector, slot, times_half_pointer_size, |
| 2951 FixedArray::kHeaderSize + kPointerSize)); | 2943 FixedArray::kHeaderSize + kPointerSize)); |
| 2952 __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); | 2944 __ lea(handler, FieldOperand(handler, Code::kHeaderSize)); |
| 2953 __ jmp(handler); | 2945 __ jmp(handler); |
| 2954 } | 2946 } |
| 2955 | 2947 |
| 2956 | |
| 2957 void KeyedLoadICStub::Generate(MacroAssembler* masm) { | |
| 2958 GenerateImpl(masm, false); | |
| 2959 } | |
| 2960 | |
| 2961 | |
| 2962 void KeyedLoadICStub::GenerateForTrampoline(MacroAssembler* masm) { | |
| 2963 GenerateImpl(masm, true); | |
| 2964 } | |
| 2965 | |
| 2966 | |
| 2967 void KeyedLoadICStub::GenerateImpl(MacroAssembler* masm, bool in_frame) { | |
| 2968 Register receiver = LoadWithVectorDescriptor::ReceiverRegister(); // edx | |
| 2969 Register key = LoadWithVectorDescriptor::NameRegister(); // ecx | |
| 2970 Register vector = LoadWithVectorDescriptor::VectorRegister(); // ebx | |
| 2971 Register slot = LoadWithVectorDescriptor::SlotRegister(); // eax | |
| 2972 Register feedback = edi; | |
| 2973 __ mov(feedback, FieldOperand(vector, slot, times_half_pointer_size, | |
| 2974 FixedArray::kHeaderSize)); | |
| 2975 // Is it a weak cell? | |
| 2976 Label try_array; | |
| 2977 Label not_array, smi_key, key_okay, miss; | |
| 2978 __ CompareRoot(FieldOperand(feedback, 0), Heap::kWeakCellMapRootIndex); | |
| 2979 __ j(not_equal, &try_array); | |
| 2980 HandleMonomorphicCase(masm, receiver, key, vector, slot, feedback, &miss); | |
| 2981 | |
| 2982 __ bind(&try_array); | |
| 2983 // Is it a fixed array? | |
| 2984 __ CompareRoot(FieldOperand(feedback, 0), Heap::kFixedArrayMapRootIndex); | |
| 2985 __ j(not_equal, ¬_array); | |
| 2986 | |
| 2987 // We have a polymorphic element handler. | |
| 2988 Label polymorphic, try_poly_name; | |
| 2989 __ bind(&polymorphic); | |
| 2990 HandleArrayCases(masm, receiver, key, vector, slot, feedback, true, &miss); | |
| 2991 | |
| 2992 __ bind(¬_array); | |
| 2993 // Is it generic? | |
| 2994 __ CompareRoot(feedback, Heap::kmegamorphic_symbolRootIndex); | |
| 2995 __ j(not_equal, &try_poly_name); | |
| 2996 Handle<Code> megamorphic_stub = | |
| 2997 KeyedLoadIC::ChooseMegamorphicStub(masm->isolate(), GetExtraICState()); | |
| 2998 __ jmp(megamorphic_stub, RelocInfo::CODE_TARGET); | |
| 2999 | |
| 3000 __ bind(&try_poly_name); | |
| 3001 // We might have a name in feedback, and a fixed array in the next slot. | |
| 3002 __ cmp(key, feedback); | |
| 3003 __ j(not_equal, &miss); | |
| 3004 // If the name comparison succeeded, we know we have a fixed array with | |
| 3005 // at least one map/handler pair. | |
| 3006 __ mov(feedback, FieldOperand(vector, slot, times_half_pointer_size, | |
| 3007 FixedArray::kHeaderSize + kPointerSize)); | |
| 3008 HandleArrayCases(masm, receiver, key, vector, slot, feedback, false, &miss); | |
| 3009 | |
| 3010 __ bind(&miss); | |
| 3011 KeyedLoadIC::GenerateMiss(masm); | |
| 3012 } | |
| 3013 | |
| 3014 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { | 2948 void KeyedStoreICTrampolineStub::Generate(MacroAssembler* masm) { |
| 3015 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); | 2949 __ EmitLoadTypeFeedbackVector(StoreWithVectorDescriptor::VectorRegister()); |
| 3016 KeyedStoreICStub stub(isolate(), state()); | 2950 KeyedStoreICStub stub(isolate(), state()); |
| 3017 stub.GenerateForTrampoline(masm); | 2951 stub.GenerateForTrampoline(masm); |
| 3018 } | 2952 } |
| 3019 | 2953 |
| 3020 // value is on the stack already. | 2954 // value is on the stack already. |
| 3021 static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, | 2955 static void HandlePolymorphicStoreCase(MacroAssembler* masm, Register receiver, |
| 3022 Register key, Register vector, | 2956 Register key, Register vector, |
| 3023 Register slot, Register feedback, | 2957 Register slot, Register feedback, |
| (...skipping 1705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4729 kStackUnwindSpace, nullptr, return_value_operand, | 4663 kStackUnwindSpace, nullptr, return_value_operand, |
| 4730 NULL); | 4664 NULL); |
| 4731 } | 4665 } |
| 4732 | 4666 |
| 4733 #undef __ | 4667 #undef __ |
| 4734 | 4668 |
| 4735 } // namespace internal | 4669 } // namespace internal |
| 4736 } // namespace v8 | 4670 } // namespace v8 |
| 4737 | 4671 |
| 4738 #endif // V8_TARGET_ARCH_X87 | 4672 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |