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); | |
3747 __ j(above, &miss); | |
3748 // Make sure the function is the Array() function | 3743 // Make sure the function is the Array() function |
3749 __ LoadArrayFunction(rcx); | 3744 __ LoadArrayFunction(rcx); |
3750 __ cmpq(rdi, rcx); | 3745 __ cmpq(rdi, rcx); |
3751 __ j(not_equal, &megamorphic); | 3746 __ j(not_equal, &megamorphic); |
3752 __ jmp(&done); | 3747 __ jmp(&done); |
3753 | 3748 |
3754 __ bind(&miss); | 3749 __ bind(&miss); |
3755 | 3750 |
3756 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 3751 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
3757 // megamorphic. | 3752 // megamorphic. |
(...skipping 3036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6794 __ movq(rcx, Operand(rsp, kPointerSize)); | 6789 __ movq(rcx, Operand(rsp, kPointerSize)); |
6795 __ testq(rcx, rcx); | 6790 __ testq(rcx, rcx); |
6796 __ j(zero, &normal_sequence); | 6791 __ j(zero, &normal_sequence); |
6797 | 6792 |
6798 // We are going to create a holey array, but our kind is non-holey. | 6793 // We are going to create a holey array, but our kind is non-holey. |
6799 // Fix kind and retry | 6794 // Fix kind and retry |
6800 __ incl(rdx); | 6795 __ incl(rdx); |
6801 __ Cmp(rbx, undefined_sentinel); | 6796 __ Cmp(rbx, undefined_sentinel); |
6802 __ j(equal, &normal_sequence); | 6797 __ j(equal, &normal_sequence); |
6803 | 6798 |
| 6799 // The type cell may have gone megamorphic, don't overwrite if so |
| 6800 __ movq(rcx, FieldOperand(rbx, kPointerSize)); |
| 6801 __ JumpIfNotSmi(rcx, &normal_sequence); |
| 6802 |
6804 // Save the resulting elements kind in type info | 6803 // Save the resulting elements kind in type info |
6805 __ Integer32ToSmi(rdx, rdx); | 6804 __ Integer32ToSmi(rdx, rdx); |
6806 __ movq(FieldOperand(rbx, kPointerSize), rdx); | 6805 __ movq(FieldOperand(rbx, kPointerSize), rdx); |
6807 __ SmiToInteger32(rdx, rdx); | 6806 __ SmiToInteger32(rdx, rdx); |
6808 | 6807 |
6809 __ bind(&normal_sequence); | 6808 __ bind(&normal_sequence); |
6810 int last_index = GetSequenceIndexFromFastElementsKind( | 6809 int last_index = GetSequenceIndexFromFastElementsKind( |
6811 TERMINAL_FAST_ELEMENTS_KIND); | 6810 TERMINAL_FAST_ELEMENTS_KIND); |
6812 for (int i = 0; i <= last_index; ++i) { | 6811 for (int i = 0; i <= last_index; ++i) { |
6813 Label next; | 6812 Label next; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7024 __ bind(&fast_elements_case); | 7023 __ bind(&fast_elements_case); |
7025 GenerateCase(masm, FAST_ELEMENTS); | 7024 GenerateCase(masm, FAST_ELEMENTS); |
7026 } | 7025 } |
7027 | 7026 |
7028 | 7027 |
7029 #undef __ | 7028 #undef __ |
7030 | 7029 |
7031 } } // namespace v8::internal | 7030 } } // namespace v8::internal |
7032 | 7031 |
7033 #endif // V8_TARGET_ARCH_X64 | 7032 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |