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 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1793 ExternalReference(Builtins::c_ArrayPush, isolate()), argc + 1, 1); | 1793 ExternalReference(Builtins::c_ArrayPush, isolate()), argc + 1, 1); |
1794 } | 1794 } |
1795 | 1795 |
1796 HandlerFrontendFooter(&miss); | 1796 HandlerFrontendFooter(&miss); |
1797 | 1797 |
1798 // Return the generated code. | 1798 // Return the generated code. |
1799 return GetCode(type, name); | 1799 return GetCode(type, name); |
1800 } | 1800 } |
1801 | 1801 |
1802 | 1802 |
1803 Handle<Code> CallStubCompiler::CompileArrayPopCall( | |
1804 Handle<Object> object, | |
1805 Handle<JSObject> holder, | |
1806 Handle<Cell> cell, | |
1807 Handle<JSFunction> function, | |
1808 Handle<String> name, | |
1809 Code::StubType type) { | |
1810 // If object is not an array or is observed or sealed, bail out to regular | |
1811 // call. | |
1812 if (!object->IsJSArray() || | |
1813 !cell.is_null() || | |
1814 Handle<JSArray>::cast(object)->map()->is_observed() || | |
1815 !Handle<JSArray>::cast(object)->map()->is_extensible()) { | |
1816 return Handle<Code>::null(); | |
1817 } | |
1818 | |
1819 Label miss, return_undefined, call_builtin; | |
1820 Register receiver = a0; | |
1821 Register scratch = a1; | |
1822 Register elements = a3; | |
1823 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
1824 | |
1825 // Get the elements array of the object. | |
1826 __ lw(elements, FieldMemOperand(receiver, JSArray::kElementsOffset)); | |
1827 | |
1828 // Check that the elements are in fast mode and writable. | |
1829 __ CheckMap(elements, | |
1830 scratch, | |
1831 Heap::kFixedArrayMapRootIndex, | |
1832 &call_builtin, | |
1833 DONT_DO_SMI_CHECK); | |
1834 | |
1835 // Get the array's length into t0 and calculate new length. | |
1836 __ lw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | |
1837 __ Subu(t0, t0, Operand(Smi::FromInt(1))); | |
1838 __ Branch(&return_undefined, lt, t0, Operand(zero_reg)); | |
1839 | |
1840 // Get the last element. | |
1841 __ LoadRoot(t2, Heap::kTheHoleValueRootIndex); | |
1842 STATIC_ASSERT(kSmiTagSize == 1); | |
1843 STATIC_ASSERT(kSmiTag == 0); | |
1844 // We can't address the last element in one operation. Compute the more | |
1845 // expensive shift first, and use an offset later on. | |
1846 __ sll(t1, t0, kPointerSizeLog2 - kSmiTagSize); | |
1847 __ Addu(elements, elements, t1); | |
1848 __ lw(scratch, FieldMemOperand(elements, FixedArray::kHeaderSize)); | |
1849 __ Branch(&call_builtin, eq, scratch, Operand(t2)); | |
1850 | |
1851 // Set the array's length. | |
1852 __ sw(t0, FieldMemOperand(receiver, JSArray::kLengthOffset)); | |
1853 | |
1854 // Fill with the hole. | |
1855 __ sw(t2, FieldMemOperand(elements, FixedArray::kHeaderSize)); | |
1856 const int argc = arguments().immediate(); | |
1857 __ mov(v0, scratch); | |
1858 __ DropAndRet(argc + 1); | |
1859 | |
1860 __ bind(&return_undefined); | |
1861 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); | |
1862 __ DropAndRet(argc + 1); | |
1863 | |
1864 __ bind(&call_builtin); | |
1865 __ TailCallExternalReference( | |
1866 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); | |
1867 | |
1868 HandlerFrontendFooter(&miss); | |
1869 | |
1870 // Return the generated code. | |
1871 return GetCode(type, name); | |
1872 } | |
1873 | |
1874 | |
1875 Handle<Code> CallStubCompiler::CompileFastApiCall( | 1803 Handle<Code> CallStubCompiler::CompileFastApiCall( |
1876 const CallOptimization& optimization, | 1804 const CallOptimization& optimization, |
1877 Handle<Object> object, | 1805 Handle<Object> object, |
1878 Handle<JSObject> holder, | 1806 Handle<JSObject> holder, |
1879 Handle<Cell> cell, | 1807 Handle<Cell> cell, |
1880 Handle<JSFunction> function, | 1808 Handle<JSFunction> function, |
1881 Handle<String> name) { | 1809 Handle<String> name) { |
1882 | 1810 |
1883 Counters* counters = isolate()->counters(); | 1811 Counters* counters = isolate()->counters(); |
1884 | 1812 |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2484 // ----------------------------------- | 2412 // ----------------------------------- |
2485 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2413 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
2486 } | 2414 } |
2487 | 2415 |
2488 | 2416 |
2489 #undef __ | 2417 #undef __ |
2490 | 2418 |
2491 } } // namespace v8::internal | 2419 } } // namespace v8::internal |
2492 | 2420 |
2493 #endif // V8_TARGET_ARCH_MIPS | 2421 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |