| 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 |
| 11 // with the distribution. | 11 // with the distribution. |
| 12 // * Neither the name of Google Inc. nor the names of its | 12 // * Neither the name of Google Inc. nor the names of its |
| 13 // contributors may be used to endorse or promote products derived | 13 // contributors may be used to endorse or promote products derived |
| 14 // from this software without specific prior written permission. | 14 // from this software without specific prior written permission. |
| 15 // | 15 // |
| 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS | 16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT | 17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR | 18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #if defined(V8_TARGET_ARCH_IA32) | 30 #if V8_TARGET_ARCH_IA32 |
| 31 | 31 |
| 32 #include "codegen.h" | 32 #include "codegen.h" |
| 33 #include "ic-inl.h" | 33 #include "ic-inl.h" |
| 34 #include "runtime.h" | 34 #include "runtime.h" |
| 35 #include "stub-cache.h" | 35 #include "stub-cache.h" |
| 36 | 36 |
| 37 namespace v8 { | 37 namespace v8 { |
| 38 namespace internal { | 38 namespace internal { |
| 39 | 39 |
| 40 // ---------------------------------------------------------------------------- | 40 // ---------------------------------------------------------------------------- |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 791 &non_double_value, | 791 &non_double_value, |
| 792 DONT_DO_SMI_CHECK); | 792 DONT_DO_SMI_CHECK); |
| 793 | 793 |
| 794 // Value is a double. Transition FAST_SMI_ELEMENTS -> FAST_DOUBLE_ELEMENTS | 794 // Value is a double. Transition FAST_SMI_ELEMENTS -> FAST_DOUBLE_ELEMENTS |
| 795 // and complete the store. | 795 // and complete the store. |
| 796 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, | 796 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
| 797 FAST_DOUBLE_ELEMENTS, | 797 FAST_DOUBLE_ELEMENTS, |
| 798 ebx, | 798 ebx, |
| 799 edi, | 799 edi, |
| 800 slow); | 800 slow); |
| 801 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_SMI_ELEMENTS, | 801 AllocationSiteMode mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, |
| 802 FAST_DOUBLE_ELEMENTS); | 802 FAST_DOUBLE_ELEMENTS); |
| 803 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, slow); | 803 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, slow); |
| 804 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); | 804 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); |
| 805 __ jmp(&fast_double_without_map_check); | 805 __ jmp(&fast_double_without_map_check); |
| 806 | 806 |
| 807 __ bind(&non_double_value); | 807 __ bind(&non_double_value); |
| 808 // Value is not a double, FAST_SMI_ELEMENTS -> FAST_ELEMENTS | 808 // Value is not a double, FAST_SMI_ELEMENTS -> FAST_ELEMENTS |
| 809 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, | 809 __ LoadTransitionedArrayMapConditional(FAST_SMI_ELEMENTS, |
| 810 FAST_ELEMENTS, | 810 FAST_ELEMENTS, |
| 811 ebx, | 811 ebx, |
| 812 edi, | 812 edi, |
| 813 slow); | 813 slow); |
| 814 mode = AllocationSiteInfo::GetMode(FAST_SMI_ELEMENTS, FAST_ELEMENTS); | 814 mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, FAST_ELEMENTS); |
| 815 ElementsTransitionGenerator::GenerateMapChangeElementsTransition(masm, mode, | 815 ElementsTransitionGenerator::GenerateMapChangeElementsTransition(masm, mode, |
| 816 slow); | 816 slow); |
| 817 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); | 817 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); |
| 818 __ jmp(&finish_object_store); | 818 __ jmp(&finish_object_store); |
| 819 | 819 |
| 820 __ bind(&transition_double_elements); | 820 __ bind(&transition_double_elements); |
| 821 // Elements are FAST_DOUBLE_ELEMENTS, but value is an Object that's not a | 821 // Elements are FAST_DOUBLE_ELEMENTS, but value is an Object that's not a |
| 822 // HeapNumber. Make sure that the receiver is a Array with FAST_ELEMENTS and | 822 // HeapNumber. Make sure that the receiver is a Array with FAST_ELEMENTS and |
| 823 // transition array from FAST_DOUBLE_ELEMENTS to FAST_ELEMENTS | 823 // transition array from FAST_DOUBLE_ELEMENTS to FAST_ELEMENTS |
| 824 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); | 824 __ mov(ebx, FieldOperand(edx, HeapObject::kMapOffset)); |
| 825 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, | 825 __ LoadTransitionedArrayMapConditional(FAST_DOUBLE_ELEMENTS, |
| 826 FAST_ELEMENTS, | 826 FAST_ELEMENTS, |
| 827 ebx, | 827 ebx, |
| 828 edi, | 828 edi, |
| 829 slow); | 829 slow); |
| 830 mode = AllocationSiteInfo::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); | 830 mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, FAST_ELEMENTS); |
| 831 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); | 831 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, slow); |
| 832 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); | 832 __ mov(ebx, FieldOperand(edx, JSObject::kElementsOffset)); |
| 833 __ jmp(&finish_object_store); | 833 __ jmp(&finish_object_store); |
| 834 } | 834 } |
| 835 | 835 |
| 836 | 836 |
| 837 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, | 837 void KeyedStoreIC::GenerateGeneric(MacroAssembler* masm, |
| 838 StrictModeFlag strict_mode) { | 838 StrictModeFlag strict_mode) { |
| 839 // ----------- S t a t e ------------- | 839 // ----------- S t a t e ------------- |
| 840 // -- eax : value | 840 // -- eax : value |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 | 1591 |
| 1592 void KeyedStoreIC::GenerateTransitionElementsSmiToDouble(MacroAssembler* masm) { | 1592 void KeyedStoreIC::GenerateTransitionElementsSmiToDouble(MacroAssembler* masm) { |
| 1593 // ----------- S t a t e ------------- | 1593 // ----------- S t a t e ------------- |
| 1594 // -- ebx : target map | 1594 // -- ebx : target map |
| 1595 // -- edx : receiver | 1595 // -- edx : receiver |
| 1596 // -- esp[0] : return address | 1596 // -- esp[0] : return address |
| 1597 // ----------------------------------- | 1597 // ----------------------------------- |
| 1598 // Must return the modified receiver in eax. | 1598 // Must return the modified receiver in eax. |
| 1599 if (!FLAG_trace_elements_transitions) { | 1599 if (!FLAG_trace_elements_transitions) { |
| 1600 Label fail; | 1600 Label fail; |
| 1601 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_SMI_ELEMENTS, | 1601 AllocationSiteMode mode = AllocationSite::GetMode(FAST_SMI_ELEMENTS, |
| 1602 FAST_DOUBLE_ELEMENTS); | 1602 FAST_DOUBLE_ELEMENTS); |
| 1603 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, &fail); | 1603 ElementsTransitionGenerator::GenerateSmiToDouble(masm, mode, &fail); |
| 1604 __ mov(eax, edx); | 1604 __ mov(eax, edx); |
| 1605 __ Ret(); | 1605 __ Ret(); |
| 1606 __ bind(&fail); | 1606 __ bind(&fail); |
| 1607 } | 1607 } |
| 1608 | 1608 |
| 1609 __ pop(ebx); | 1609 __ pop(ebx); |
| 1610 __ push(edx); | 1610 __ push(edx); |
| 1611 __ push(ebx); // return address | 1611 __ push(ebx); // return address |
| 1612 // Leaving the code managed by the register allocator and return to the | 1612 // Leaving the code managed by the register allocator and return to the |
| 1613 // convention of using esi as context register. | 1613 // convention of using esi as context register. |
| 1614 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); | 1614 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); |
| 1615 __ TailCallRuntime(Runtime::kTransitionElementsSmiToDouble, 1, 1); | 1615 __ TailCallRuntime(Runtime::kTransitionElementsSmiToDouble, 1, 1); |
| 1616 } | 1616 } |
| 1617 | 1617 |
| 1618 | 1618 |
| 1619 void KeyedStoreIC::GenerateTransitionElementsDoubleToObject( | 1619 void KeyedStoreIC::GenerateTransitionElementsDoubleToObject( |
| 1620 MacroAssembler* masm) { | 1620 MacroAssembler* masm) { |
| 1621 // ----------- S t a t e ------------- | 1621 // ----------- S t a t e ------------- |
| 1622 // -- ebx : target map | 1622 // -- ebx : target map |
| 1623 // -- edx : receiver | 1623 // -- edx : receiver |
| 1624 // -- esp[0] : return address | 1624 // -- esp[0] : return address |
| 1625 // ----------------------------------- | 1625 // ----------------------------------- |
| 1626 // Must return the modified receiver in eax. | 1626 // Must return the modified receiver in eax. |
| 1627 if (!FLAG_trace_elements_transitions) { | 1627 if (!FLAG_trace_elements_transitions) { |
| 1628 Label fail; | 1628 Label fail; |
| 1629 AllocationSiteMode mode = AllocationSiteInfo::GetMode(FAST_DOUBLE_ELEMENTS, | 1629 AllocationSiteMode mode = AllocationSite::GetMode(FAST_DOUBLE_ELEMENTS, |
| 1630 FAST_ELEMENTS); | 1630 FAST_ELEMENTS); |
| 1631 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, &fail); | 1631 ElementsTransitionGenerator::GenerateDoubleToObject(masm, mode, &fail); |
| 1632 __ mov(eax, edx); | 1632 __ mov(eax, edx); |
| 1633 __ Ret(); | 1633 __ Ret(); |
| 1634 __ bind(&fail); | 1634 __ bind(&fail); |
| 1635 } | 1635 } |
| 1636 | 1636 |
| 1637 __ pop(ebx); | 1637 __ pop(ebx); |
| 1638 __ push(edx); | 1638 __ push(edx); |
| 1639 __ push(ebx); // return address | 1639 __ push(ebx); // return address |
| 1640 // Leaving the code managed by the register allocator and return to the | 1640 // Leaving the code managed by the register allocator and return to the |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1711 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) | 1711 Condition cc = (check == ENABLE_INLINED_SMI_CHECK) |
| 1712 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) | 1712 ? (*jmp_address == Assembler::kJncShortOpcode ? not_zero : zero) |
| 1713 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); | 1713 : (*jmp_address == Assembler::kJnzShortOpcode ? not_carry : carry); |
| 1714 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); | 1714 *jmp_address = static_cast<byte>(Assembler::kJccShortPrefix | cc); |
| 1715 } | 1715 } |
| 1716 | 1716 |
| 1717 | 1717 |
| 1718 } } // namespace v8::internal | 1718 } } // namespace v8::internal |
| 1719 | 1719 |
| 1720 #endif // V8_TARGET_ARCH_IA32 | 1720 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |