| 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 1589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1600 } | 1600 } |
| 1601 | 1601 |
| 1602 | 1602 |
| 1603 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { | 1603 static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
| 1604 // eax : number of arguments to the construct function | 1604 // eax : number of arguments to the construct function |
| 1605 // ebx : Feedback vector | 1605 // ebx : Feedback vector |
| 1606 // edx : slot in feedback vector (Smi) | 1606 // edx : slot in feedback vector (Smi) |
| 1607 // edi : the function to call | 1607 // edi : the function to call |
| 1608 FrameScope scope(masm, StackFrame::INTERNAL); | 1608 FrameScope scope(masm, StackFrame::INTERNAL); |
| 1609 | 1609 |
| 1610 // Arguments register must be smi-tagged to call out. | 1610 // Number-of-arguments register must be smi-tagged to call out. |
| 1611 __ SmiTag(eax); | 1611 __ SmiTag(eax); |
| 1612 __ push(eax); | 1612 __ push(eax); |
| 1613 __ push(edi); | 1613 __ push(edi); |
| 1614 __ push(edx); | 1614 __ push(edx); |
| 1615 __ push(ebx); | 1615 __ push(ebx); |
| 1616 | 1616 |
| 1617 __ CallStub(stub); | 1617 __ CallStub(stub); |
| 1618 | 1618 |
| 1619 __ pop(ebx); | 1619 __ pop(ebx); |
| 1620 __ pop(edx); | 1620 __ pop(edx); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1634 // edi : the function to call | 1634 // edi : the function to call |
| 1635 Isolate* isolate = masm->isolate(); | 1635 Isolate* isolate = masm->isolate(); |
| 1636 Label initialize, done, miss, megamorphic, not_array_function; | 1636 Label initialize, done, miss, megamorphic, not_array_function; |
| 1637 | 1637 |
| 1638 // Load the cache state into ecx. | 1638 // Load the cache state into ecx. |
| 1639 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, | 1639 __ mov(ecx, FieldOperand(ebx, edx, times_half_pointer_size, |
| 1640 FixedArray::kHeaderSize)); | 1640 FixedArray::kHeaderSize)); |
| 1641 | 1641 |
| 1642 // A monomorphic cache hit or an already megamorphic state: invoke the | 1642 // A monomorphic cache hit or an already megamorphic state: invoke the |
| 1643 // function without changing the state. | 1643 // function without changing the state. |
| 1644 // We don't know if ecx is a WeakCell or a Symbol, but it's harmless to read |
| 1645 // at this position in a symbol (see static asserts in |
| 1646 // type-feedback-vector.h). |
| 1644 Label check_allocation_site; | 1647 Label check_allocation_site; |
| 1645 __ cmp(edi, FieldOperand(ecx, WeakCell::kValueOffset)); | 1648 __ cmp(edi, FieldOperand(ecx, WeakCell::kValueOffset)); |
| 1646 __ j(equal, &done, Label::kFar); | 1649 __ j(equal, &done, Label::kFar); |
| 1647 __ CompareRoot(ecx, Heap::kmegamorphic_symbolRootIndex); | 1650 __ CompareRoot(ecx, Heap::kmegamorphic_symbolRootIndex); |
| 1648 __ j(equal, &done, Label::kFar); | 1651 __ j(equal, &done, Label::kFar); |
| 1649 __ CompareRoot(FieldOperand(ecx, 0), Heap::kWeakCellMapRootIndex); | 1652 __ CompareRoot(FieldOperand(ecx, HeapObject::kMapOffset), |
| 1653 Heap::kWeakCellMapRootIndex); |
| 1650 __ j(not_equal, FLAG_pretenuring_call_new ? &miss : &check_allocation_site); | 1654 __ j(not_equal, FLAG_pretenuring_call_new ? &miss : &check_allocation_site); |
| 1651 | 1655 |
| 1652 // If edi is not equal to the weak cell value, and the weak cell value is | 1656 // If the weak cell is cleared, we have a new chance to become monomorphic. |
| 1653 // cleared, we have a new chance to become monomorphic. | |
| 1654 __ JumpIfSmi(FieldOperand(ecx, WeakCell::kValueOffset), &initialize); | 1657 __ JumpIfSmi(FieldOperand(ecx, WeakCell::kValueOffset), &initialize); |
| 1655 __ jmp(&megamorphic); | 1658 __ jmp(&megamorphic); |
| 1656 | 1659 |
| 1657 if (!FLAG_pretenuring_call_new) { | 1660 if (!FLAG_pretenuring_call_new) { |
| 1658 __ bind(&check_allocation_site); | 1661 __ bind(&check_allocation_site); |
| 1659 // If we came here, we need to see if we are the array function. | 1662 // If we came here, we need to see if we are the array function. |
| 1660 // If we didn't have a matching function, and we didn't find the megamorph | 1663 // If we didn't have a matching function, and we didn't find the megamorph |
| 1661 // sentinel, then we have in the slot either some other function or an | 1664 // sentinel, then we have in the slot either some other function or an |
| 1662 // AllocationSite. Do a map check on the object in ecx. | 1665 // AllocationSite. |
| 1663 __ CompareRoot(FieldOperand(ecx, 0), Heap::kAllocationSiteMapRootIndex); | 1666 __ CompareRoot(FieldOperand(ecx, 0), Heap::kAllocationSiteMapRootIndex); |
| 1664 __ j(not_equal, &miss); | 1667 __ j(not_equal, &miss); |
| 1665 | 1668 |
| 1666 // Make sure the function is the Array() function | 1669 // Make sure the function is the Array() function |
| 1667 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); | 1670 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, ecx); |
| 1668 __ cmp(edi, ecx); | 1671 __ cmp(edi, ecx); |
| 1669 __ j(not_equal, &megamorphic); | 1672 __ j(not_equal, &megamorphic); |
| 1670 __ jmp(&done, Label::kFar); | 1673 __ jmp(&done, Label::kFar); |
| 1671 } | 1674 } |
| 1672 | 1675 |
| (...skipping 3385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5058 ApiParameterOperand(2), kStackSpace, nullptr, | 5061 ApiParameterOperand(2), kStackSpace, nullptr, |
| 5059 Operand(ebp, 7 * kPointerSize), NULL); | 5062 Operand(ebp, 7 * kPointerSize), NULL); |
| 5060 } | 5063 } |
| 5061 | 5064 |
| 5062 | 5065 |
| 5063 #undef __ | 5066 #undef __ |
| 5064 | 5067 |
| 5065 } } // namespace v8::internal | 5068 } } // namespace v8::internal |
| 5066 | 5069 |
| 5067 #endif // V8_TARGET_ARCH_X87 | 5070 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |