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/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 1676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1687 | 1687 |
1688 // Load the cache state into rcx. | 1688 // Load the cache state into rcx. |
1689 __ SmiToInteger32(rdx, rdx); | 1689 __ SmiToInteger32(rdx, rdx); |
1690 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size, | 1690 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size, |
1691 FixedArray::kHeaderSize)); | 1691 FixedArray::kHeaderSize)); |
1692 | 1692 |
1693 // A monomorphic cache hit or an already megamorphic state: invoke the | 1693 // A monomorphic cache hit or an already megamorphic state: invoke the |
1694 // function without changing the state. | 1694 // function without changing the state. |
1695 __ cmpp(rcx, rdi); | 1695 __ cmpp(rcx, rdi); |
1696 __ j(equal, &done); | 1696 __ j(equal, &done); |
1697 __ Cmp(rcx, TypeFeedbackInfo::MegamorphicSentinel(isolate)); | 1697 __ Cmp(rcx, TypeFeedbackVector::MegamorphicSentinel(isolate)); |
1698 __ j(equal, &done); | 1698 __ j(equal, &done); |
1699 | 1699 |
1700 if (!FLAG_pretenuring_call_new) { | 1700 if (!FLAG_pretenuring_call_new) { |
1701 // If we came here, we need to see if we are the array function. | 1701 // If we came here, we need to see if we are the array function. |
1702 // If we didn't have a matching function, and we didn't find the megamorph | 1702 // If we didn't have a matching function, and we didn't find the megamorph |
1703 // sentinel, then we have in the slot either some other function or an | 1703 // sentinel, then we have in the slot either some other function or an |
1704 // AllocationSite. Do a map check on the object in rcx. | 1704 // AllocationSite. Do a map check on the object in rcx. |
1705 Handle<Map> allocation_site_map = | 1705 Handle<Map> allocation_site_map = |
1706 masm->isolate()->factory()->allocation_site_map(); | 1706 masm->isolate()->factory()->allocation_site_map(); |
1707 __ Cmp(FieldOperand(rcx, 0), allocation_site_map); | 1707 __ Cmp(FieldOperand(rcx, 0), allocation_site_map); |
1708 __ j(not_equal, &miss); | 1708 __ j(not_equal, &miss); |
1709 | 1709 |
1710 // Make sure the function is the Array() function | 1710 // Make sure the function is the Array() function |
1711 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); | 1711 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); |
1712 __ cmpp(rdi, rcx); | 1712 __ cmpp(rdi, rcx); |
1713 __ j(not_equal, &megamorphic); | 1713 __ j(not_equal, &megamorphic); |
1714 __ jmp(&done); | 1714 __ jmp(&done); |
1715 } | 1715 } |
1716 | 1716 |
1717 __ bind(&miss); | 1717 __ bind(&miss); |
1718 | 1718 |
1719 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 1719 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
1720 // megamorphic. | 1720 // megamorphic. |
1721 __ Cmp(rcx, TypeFeedbackInfo::UninitializedSentinel(isolate)); | 1721 __ Cmp(rcx, TypeFeedbackVector::UninitializedSentinel(isolate)); |
1722 __ j(equal, &initialize); | 1722 __ j(equal, &initialize); |
1723 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 1723 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
1724 // write-barrier is needed. | 1724 // write-barrier is needed. |
1725 __ bind(&megamorphic); | 1725 __ bind(&megamorphic); |
1726 __ Move(FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize), | 1726 __ Move(FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize), |
1727 TypeFeedbackInfo::MegamorphicSentinel(isolate)); | 1727 TypeFeedbackVector::MegamorphicSentinel(isolate)); |
1728 __ jmp(&done); | 1728 __ jmp(&done); |
1729 | 1729 |
1730 // An uninitialized cache is patched with the function or sentinel to | 1730 // An uninitialized cache is patched with the function or sentinel to |
1731 // indicate the ElementsKind if function is the Array constructor. | 1731 // indicate the ElementsKind if function is the Array constructor. |
1732 __ bind(&initialize); | 1732 __ bind(&initialize); |
1733 | 1733 |
1734 if (!FLAG_pretenuring_call_new) { | 1734 if (!FLAG_pretenuring_call_new) { |
1735 // Make sure the function is the Array() function | 1735 // Make sure the function is the Array() function |
1736 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); | 1736 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); |
1737 __ cmpp(rdi, rcx); | 1737 __ cmpp(rdi, rcx); |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2064 if (CallAsMethod()) { | 2064 if (CallAsMethod()) { |
2065 __ bind(&wrap); | 2065 __ bind(&wrap); |
2066 EmitWrapCase(masm, &args, &cont); | 2066 EmitWrapCase(masm, &args, &cont); |
2067 } | 2067 } |
2068 | 2068 |
2069 __ bind(&extra_checks_or_miss); | 2069 __ bind(&extra_checks_or_miss); |
2070 Label miss; | 2070 Label miss; |
2071 | 2071 |
2072 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size, | 2072 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size, |
2073 FixedArray::kHeaderSize)); | 2073 FixedArray::kHeaderSize)); |
2074 __ Cmp(rcx, TypeFeedbackInfo::MegamorphicSentinel(isolate)); | 2074 __ Cmp(rcx, TypeFeedbackVector::MegamorphicSentinel(isolate)); |
2075 __ j(equal, &slow_start); | 2075 __ j(equal, &slow_start); |
2076 __ Cmp(rcx, TypeFeedbackInfo::UninitializedSentinel(isolate)); | 2076 __ Cmp(rcx, TypeFeedbackVector::UninitializedSentinel(isolate)); |
2077 __ j(equal, &miss); | 2077 __ j(equal, &miss); |
2078 | 2078 |
2079 if (!FLAG_trace_ic) { | 2079 if (!FLAG_trace_ic) { |
2080 // We are going megamorphic. If the feedback is a JSFunction, it is fine | 2080 // We are going megamorphic. If the feedback is a JSFunction, it is fine |
2081 // to handle it here. More complex cases are dealt with in the runtime. | 2081 // to handle it here. More complex cases are dealt with in the runtime. |
2082 __ AssertNotSmi(rcx); | 2082 __ AssertNotSmi(rcx); |
2083 __ CmpObjectType(rcx, JS_FUNCTION_TYPE, rcx); | 2083 __ CmpObjectType(rcx, JS_FUNCTION_TYPE, rcx); |
2084 __ j(not_equal, &miss); | 2084 __ j(not_equal, &miss); |
2085 __ Move(FieldOperand(rbx, rdx, times_pointer_size, | 2085 __ Move(FieldOperand(rbx, rdx, times_pointer_size, FixedArray::kHeaderSize), |
2086 FixedArray::kHeaderSize), | 2086 TypeFeedbackVector::MegamorphicSentinel(isolate)); |
2087 TypeFeedbackInfo::MegamorphicSentinel(isolate)); | |
2088 __ jmp(&slow_start); | 2087 __ jmp(&slow_start); |
2089 } | 2088 } |
2090 | 2089 |
2091 // We are here because tracing is on or we are going monomorphic. | 2090 // We are here because tracing is on or we are going monomorphic. |
2092 __ bind(&miss); | 2091 __ bind(&miss); |
2093 GenerateMiss(masm); | 2092 GenerateMiss(masm); |
2094 | 2093 |
2095 // the slow case | 2094 // the slow case |
2096 __ bind(&slow_start); | 2095 __ bind(&slow_start); |
2097 // Check that function is not a smi. | 2096 // Check that function is not a smi. |
(...skipping 2538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4636 return_value_operand, | 4635 return_value_operand, |
4637 NULL); | 4636 NULL); |
4638 } | 4637 } |
4639 | 4638 |
4640 | 4639 |
4641 #undef __ | 4640 #undef __ |
4642 | 4641 |
4643 } } // namespace v8::internal | 4642 } } // namespace v8::internal |
4644 | 4643 |
4645 #endif // V8_TARGET_ARCH_X64 | 4644 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |