OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 3721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3732 // A monomorphic cache hit or an already megamorphic state: invoke the | 3732 // A monomorphic cache hit or an already megamorphic state: invoke the |
3733 // function without changing the state. | 3733 // function without changing the state. |
3734 __ cmpq(rcx, rdi); | 3734 __ cmpq(rcx, rdi); |
3735 __ j(equal, &done); | 3735 __ j(equal, &done); |
3736 __ Cmp(rcx, TypeFeedbackCells::MegamorphicSentinel(isolate)); | 3736 __ Cmp(rcx, TypeFeedbackCells::MegamorphicSentinel(isolate)); |
3737 __ j(equal, &done); | 3737 __ j(equal, &done); |
3738 | 3738 |
3739 // Special handling of the Array() function, which caches not only the | 3739 // Special handling of the Array() function, which caches not only the |
3740 // monomorphic Array function but the initial ElementsKind with special | 3740 // monomorphic Array function but the initial ElementsKind with special |
3741 // sentinels | 3741 // sentinels |
3742 Handle<Object> terminal_kind_sentinel = | |
3743 TypeFeedbackCells::MonomorphicArraySentinel(isolate, | |
3744 LAST_FAST_ELEMENTS_KIND); | |
3745 __ JumpIfNotSmi(rcx, &miss); | 3742 __ JumpIfNotSmi(rcx, &miss); |
3746 __ Cmp(rcx, terminal_kind_sentinel); | 3743 if (FLAG_debug_code) { |
3747 __ j(above, &miss); | 3744 Handle<Object> terminal_kind_sentinel = |
| 3745 TypeFeedbackCells::MonomorphicArraySentinel(masm->isolate(), |
| 3746 LAST_FAST_ELEMENTS_KIND); |
| 3747 __ Cmp(rcx, terminal_kind_sentinel); |
| 3748 __ Assert(less_equal, "Array function sentinel is not an ElementsKind"); |
| 3749 } |
| 3750 |
3748 // Make sure the function is the Array() function | 3751 // Make sure the function is the Array() function |
3749 __ LoadArrayFunction(rcx); | 3752 __ LoadArrayFunction(rcx); |
3750 __ cmpq(rdi, rcx); | 3753 __ cmpq(rdi, rcx); |
3751 __ j(not_equal, &megamorphic); | 3754 __ j(not_equal, &megamorphic); |
3752 __ jmp(&done); | 3755 __ jmp(&done); |
3753 | 3756 |
3754 __ bind(&miss); | 3757 __ bind(&miss); |
3755 | 3758 |
3756 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 3759 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
3757 // megamorphic. | 3760 // megamorphic. |
(...skipping 3036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6794 __ movq(rcx, Operand(rsp, kPointerSize)); | 6797 __ movq(rcx, Operand(rsp, kPointerSize)); |
6795 __ testq(rcx, rcx); | 6798 __ testq(rcx, rcx); |
6796 __ j(zero, &normal_sequence); | 6799 __ j(zero, &normal_sequence); |
6797 | 6800 |
6798 // We are going to create a holey array, but our kind is non-holey. | 6801 // We are going to create a holey array, but our kind is non-holey. |
6799 // Fix kind and retry | 6802 // Fix kind and retry |
6800 __ incl(rdx); | 6803 __ incl(rdx); |
6801 __ Cmp(rbx, undefined_sentinel); | 6804 __ Cmp(rbx, undefined_sentinel); |
6802 __ j(equal, &normal_sequence); | 6805 __ j(equal, &normal_sequence); |
6803 | 6806 |
| 6807 // The type cell may have gone megamorphic, don't overwrite if so |
| 6808 __ movq(rcx, FieldOperand(rbx, kPointerSize)); |
| 6809 __ JumpIfNotSmi(rcx, &normal_sequence); |
| 6810 |
6804 // Save the resulting elements kind in type info | 6811 // Save the resulting elements kind in type info |
6805 __ Integer32ToSmi(rdx, rdx); | 6812 __ Integer32ToSmi(rdx, rdx); |
6806 __ movq(FieldOperand(rbx, kPointerSize), rdx); | 6813 __ movq(FieldOperand(rbx, kPointerSize), rdx); |
6807 __ SmiToInteger32(rdx, rdx); | 6814 __ SmiToInteger32(rdx, rdx); |
6808 | 6815 |
6809 __ bind(&normal_sequence); | 6816 __ bind(&normal_sequence); |
6810 int last_index = GetSequenceIndexFromFastElementsKind( | 6817 int last_index = GetSequenceIndexFromFastElementsKind( |
6811 TERMINAL_FAST_ELEMENTS_KIND); | 6818 TERMINAL_FAST_ELEMENTS_KIND); |
6812 for (int i = 0; i <= last_index; ++i) { | 6819 for (int i = 0; i <= last_index; ++i) { |
6813 Label next; | 6820 Label next; |
(...skipping 12 matching lines...) Expand all Loading... |
6826 | 6833 |
6827 template<class T> | 6834 template<class T> |
6828 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { | 6835 static void ArrayConstructorStubAheadOfTimeHelper(Isolate* isolate) { |
6829 int to_index = GetSequenceIndexFromFastElementsKind( | 6836 int to_index = GetSequenceIndexFromFastElementsKind( |
6830 TERMINAL_FAST_ELEMENTS_KIND); | 6837 TERMINAL_FAST_ELEMENTS_KIND); |
6831 for (int i = 0; i <= to_index; ++i) { | 6838 for (int i = 0; i <= to_index; ++i) { |
6832 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); | 6839 ElementsKind kind = GetFastElementsKindFromSequenceIndex(i); |
6833 T stub(kind); | 6840 T stub(kind); |
6834 stub.GetCode(isolate)->set_is_pregenerated(true); | 6841 stub.GetCode(isolate)->set_is_pregenerated(true); |
6835 if (AllocationSiteInfo::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { | 6842 if (AllocationSiteInfo::GetMode(kind) != DONT_TRACK_ALLOCATION_SITE) { |
6836 T stub1(kind, true); | 6843 T stub1(kind, CONTEXT_CHECK_REQUIRED, DISABLE_ALLOCATION_SITES); |
6837 stub1.GetCode(isolate)->set_is_pregenerated(true); | 6844 stub1.GetCode(isolate)->set_is_pregenerated(true); |
6838 } | 6845 } |
6839 } | 6846 } |
6840 } | 6847 } |
6841 | 6848 |
6842 | 6849 |
6843 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { | 6850 void ArrayConstructorStubBase::GenerateStubsAheadOfTime(Isolate* isolate) { |
6844 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( | 6851 ArrayConstructorStubAheadOfTimeHelper<ArrayNoArgumentConstructorStub>( |
6845 isolate); | 6852 isolate); |
6846 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( | 6853 ArrayConstructorStubAheadOfTimeHelper<ArraySingleArgumentConstructorStub>( |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7024 __ bind(&fast_elements_case); | 7031 __ bind(&fast_elements_case); |
7025 GenerateCase(masm, FAST_ELEMENTS); | 7032 GenerateCase(masm, FAST_ELEMENTS); |
7026 } | 7033 } |
7027 | 7034 |
7028 | 7035 |
7029 #undef __ | 7036 #undef __ |
7030 | 7037 |
7031 } } // namespace v8::internal | 7038 } } // namespace v8::internal |
7032 | 7039 |
7033 #endif // V8_TARGET_ARCH_X64 | 7040 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |