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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X87 | 7 #if V8_TARGET_ARCH_X87 |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 1494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1505 Label initialize, done, miss, megamorphic, not_array_function; | 1505 Label initialize, done, miss, megamorphic, not_array_function; |
1506 | 1506 |
1507 // Load the cache state into ecx. | 1507 // Load the cache state into ecx. |
1508 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 1508 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
1509 FixedArray::kHeaderSize)); | 1509 FixedArray::kHeaderSize)); |
1510 | 1510 |
1511 // A monomorphic cache hit or an already megamorphic state: invoke the | 1511 // A monomorphic cache hit or an already megamorphic state: invoke the |
1512 // function without changing the state. | 1512 // function without changing the state. |
1513 __ cmp(ecx, edi); | 1513 __ cmp(ecx, edi); |
1514 __ j(equal, &done, Label::kFar); | 1514 __ j(equal, &done, Label::kFar); |
1515 __ cmp(ecx, Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); | 1515 __ cmp(ecx, Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); |
1516 __ j(equal, &done, Label::kFar); | 1516 __ j(equal, &done, Label::kFar); |
1517 | 1517 |
1518 if (!FLAG_pretenuring_call_new) { | 1518 if (!FLAG_pretenuring_call_new) { |
1519 // If we came here, we need to see if we are the array function. | 1519 // If we came here, we need to see if we are the array function. |
1520 // If we didn't have a matching function, and we didn't find the megamorph | 1520 // If we didn't have a matching function, and we didn't find the megamorph |
1521 // sentinel, then we have in the slot either some other function or an | 1521 // sentinel, then we have in the slot either some other function or an |
1522 // AllocationSite. Do a map check on the object in ecx. | 1522 // AllocationSite. Do a map check on the object in ecx. |
1523 Handle<Map> allocation_site_map = isolate->factory()->allocation_site_map(); | 1523 Handle<Map> allocation_site_map = isolate->factory()->allocation_site_map(); |
1524 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); | 1524 __ cmp(FieldOperand(ecx, 0), Immediate(allocation_site_map)); |
1525 __ j(not_equal, &miss); | 1525 __ j(not_equal, &miss); |
1526 | 1526 |
1527 // Make sure the function is the Array() function | 1527 // Make sure the function is the Array() function |
1528 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); | 1528 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
1529 __ cmp(edi, ecx); | 1529 __ cmp(edi, ecx); |
1530 __ j(not_equal, &megamorphic); | 1530 __ j(not_equal, &megamorphic); |
1531 __ jmp(&done, Label::kFar); | 1531 __ jmp(&done, Label::kFar); |
1532 } | 1532 } |
1533 | 1533 |
1534 __ bind(&miss); | 1534 __ bind(&miss); |
1535 | 1535 |
1536 // A monomorphic miss (i.e, here the cache is not uninitialized) goes | 1536 // A monomorphic miss (i.e, here the cache is not uninitialized) goes |
1537 // megamorphic. | 1537 // megamorphic. |
1538 __ cmp(ecx, Immediate(TypeFeedbackInfo::UninitializedSentinel(isolate))); | 1538 __ cmp(ecx, Immediate(TypeFeedbackVector::UninitializedSentinel(isolate))); |
1539 __ j(equal, &initialize); | 1539 __ j(equal, &initialize); |
1540 // MegamorphicSentinel is an immortal immovable object (undefined) so no | 1540 // MegamorphicSentinel is an immortal immovable object (undefined) so no |
1541 // write-barrier is needed. | 1541 // write-barrier is needed. |
1542 __ bind(&megamorphic); | 1542 __ bind(&megamorphic); |
1543 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, | 1543 __ mov( |
1544 FixedArray::kHeaderSize), | 1544 FieldOperand(ebx, edx, times_half_pointer_size, FixedArray::kHeaderSize), |
1545 Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); | 1545 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); |
1546 __ jmp(&done, Label::kFar); | 1546 __ jmp(&done, Label::kFar); |
1547 | 1547 |
1548 // An uninitialized cache is patched with the function or sentinel to | 1548 // An uninitialized cache is patched with the function or sentinel to |
1549 // indicate the ElementsKind if function is the Array constructor. | 1549 // indicate the ElementsKind if function is the Array constructor. |
1550 __ bind(&initialize); | 1550 __ bind(&initialize); |
1551 if (!FLAG_pretenuring_call_new) { | 1551 if (!FLAG_pretenuring_call_new) { |
1552 // Make sure the function is the Array() function | 1552 // Make sure the function is the Array() function |
1553 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); | 1553 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
1554 __ cmp(edi, ecx); | 1554 __ cmp(edi, ecx); |
1555 __ j(not_equal, ¬_array_function); | 1555 __ j(not_equal, ¬_array_function); |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1870 if (CallAsMethod()) { | 1870 if (CallAsMethod()) { |
1871 __ bind(&wrap); | 1871 __ bind(&wrap); |
1872 EmitWrapCase(masm, argc, &cont); | 1872 EmitWrapCase(masm, argc, &cont); |
1873 } | 1873 } |
1874 | 1874 |
1875 __ bind(&extra_checks_or_miss); | 1875 __ bind(&extra_checks_or_miss); |
1876 Label miss; | 1876 Label miss; |
1877 | 1877 |
1878 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 1878 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
1879 FixedArray::kHeaderSize)); | 1879 FixedArray::kHeaderSize)); |
1880 __ cmp(ecx, Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); | 1880 __ cmp(ecx, Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); |
1881 __ j(equal, &slow_start); | 1881 __ j(equal, &slow_start); |
1882 __ cmp(ecx, Immediate(TypeFeedbackInfo::UninitializedSentinel(isolate))); | 1882 __ cmp(ecx, Immediate(TypeFeedbackVector::UninitializedSentinel(isolate))); |
1883 __ j(equal, &miss); | 1883 __ j(equal, &miss); |
1884 | 1884 |
1885 if (!FLAG_trace_ic) { | 1885 if (!FLAG_trace_ic) { |
1886 // We are going megamorphic. If the feedback is a JSFunction, it is fine | 1886 // We are going megamorphic. If the feedback is a JSFunction, it is fine |
1887 // to handle it here. More complex cases are dealt with in the runtime. | 1887 // to handle it here. More complex cases are dealt with in the runtime. |
1888 __ AssertNotSmi(ecx); | 1888 __ AssertNotSmi(ecx); |
1889 __ CmpObjectType(ecx, JS_FUNCTION_TYPE, ecx); | 1889 __ CmpObjectType(ecx, JS_FUNCTION_TYPE, ecx); |
1890 __ j(not_equal, &miss); | 1890 __ j(not_equal, &miss); |
1891 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, | 1891 __ mov(FieldOperand(ebx, edx, times_half_pointer_size, |
1892 FixedArray::kHeaderSize), | 1892 FixedArray::kHeaderSize), |
1893 Immediate(TypeFeedbackInfo::MegamorphicSentinel(isolate))); | 1893 Immediate(TypeFeedbackVector::MegamorphicSentinel(isolate))); |
1894 __ jmp(&slow_start); | 1894 __ jmp(&slow_start); |
1895 } | 1895 } |
1896 | 1896 |
1897 // We are here because tracing is on or we are going monomorphic. | 1897 // We are here because tracing is on or we are going monomorphic. |
1898 __ bind(&miss); | 1898 __ bind(&miss); |
1899 GenerateMiss(masm); | 1899 GenerateMiss(masm); |
1900 | 1900 |
1901 // the slow case | 1901 // the slow case |
1902 __ bind(&slow_start); | 1902 __ bind(&slow_start); |
1903 | 1903 |
(...skipping 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4317 Operand(ebp, 7 * kPointerSize), | 4317 Operand(ebp, 7 * kPointerSize), |
4318 NULL); | 4318 NULL); |
4319 } | 4319 } |
4320 | 4320 |
4321 | 4321 |
4322 #undef __ | 4322 #undef __ |
4323 | 4323 |
4324 } } // namespace v8::internal | 4324 } } // namespace v8::internal |
4325 | 4325 |
4326 #endif // V8_TARGET_ARCH_X87 | 4326 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |