| 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 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1809 ExternalReference(Builtins::c_ArrayPush, isolate()), argc + 1, 1); | 1809 ExternalReference(Builtins::c_ArrayPush, isolate()), argc + 1, 1); |
| 1810 } | 1810 } |
| 1811 | 1811 |
| 1812 HandlerFrontendFooter(&miss); | 1812 HandlerFrontendFooter(&miss); |
| 1813 | 1813 |
| 1814 // Return the generated code. | 1814 // Return the generated code. |
| 1815 return GetCode(type, name); | 1815 return GetCode(type, name); |
| 1816 } | 1816 } |
| 1817 | 1817 |
| 1818 | 1818 |
| 1819 Handle<Code> CallStubCompiler::CompileArrayPopCall( | |
| 1820 Handle<Object> object, | |
| 1821 Handle<JSObject> holder, | |
| 1822 Handle<Cell> cell, | |
| 1823 Handle<JSFunction> function, | |
| 1824 Handle<String> name, | |
| 1825 Code::StubType type) { | |
| 1826 // If object is not an array or is observed or sealed, bail out to regular | |
| 1827 // call. | |
| 1828 if (!object->IsJSArray() || | |
| 1829 !cell.is_null() || | |
| 1830 Handle<JSArray>::cast(object)->map()->is_observed() || | |
| 1831 !Handle<JSArray>::cast(object)->map()->is_extensible()) { | |
| 1832 return Handle<Code>::null(); | |
| 1833 } | |
| 1834 | |
| 1835 Label miss, return_undefined, call_builtin; | |
| 1836 Register receiver = r0; | |
| 1837 Register scratch = r1; | |
| 1838 Register elements = r3; | |
| 1839 | |
| 1840 HandlerFrontendHeader(object, holder, name, RECEIVER_MAP_CHECK, &miss); | |
| 1841 | |
| 1842 // Get the elements array of the object. | |
| 1843 __ ldr(elements, FieldMemOperand(receiver, JSArray::kElementsOffset)); | |
| 1844 | |
| 1845 // Check that the elements are in fast mode and writable. | |
| 1846 __ CheckMap(elements, | |
| 1847 scratch, | |
| 1848 Heap::kFixedArrayMapRootIndex, | |
| 1849 &call_builtin, | |
| 1850 DONT_DO_SMI_CHECK); | |
| 1851 | |
| 1852 // Get the array's length into r4 and calculate new length. | |
| 1853 __ ldr(r4, FieldMemOperand(receiver, JSArray::kLengthOffset)); | |
| 1854 __ sub(r4, r4, Operand(Smi::FromInt(1)), SetCC); | |
| 1855 __ b(lt, &return_undefined); | |
| 1856 | |
| 1857 // Get the last element. | |
| 1858 __ LoadRoot(r6, Heap::kTheHoleValueRootIndex); | |
| 1859 // We can't address the last element in one operation. Compute the more | |
| 1860 // expensive shift first, and use an offset later on. | |
| 1861 __ add(elements, elements, Operand::PointerOffsetFromSmiKey(r4)); | |
| 1862 __ ldr(scratch, FieldMemOperand(elements, FixedArray::kHeaderSize)); | |
| 1863 __ cmp(scratch, r6); | |
| 1864 __ b(eq, &call_builtin); | |
| 1865 | |
| 1866 // Set the array's length. | |
| 1867 __ str(r4, FieldMemOperand(receiver, JSArray::kLengthOffset)); | |
| 1868 | |
| 1869 // Fill with the hole. | |
| 1870 __ str(r6, FieldMemOperand(elements, FixedArray::kHeaderSize)); | |
| 1871 const int argc = arguments().immediate(); | |
| 1872 __ Drop(argc + 1); | |
| 1873 __ mov(r0, scratch); | |
| 1874 __ Ret(); | |
| 1875 | |
| 1876 __ bind(&return_undefined); | |
| 1877 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); | |
| 1878 __ Drop(argc + 1); | |
| 1879 __ Ret(); | |
| 1880 | |
| 1881 __ bind(&call_builtin); | |
| 1882 __ TailCallExternalReference( | |
| 1883 ExternalReference(Builtins::c_ArrayPop, isolate()), argc + 1, 1); | |
| 1884 | |
| 1885 HandlerFrontendFooter(&miss); | |
| 1886 | |
| 1887 // Return the generated code. | |
| 1888 return GetCode(type, name); | |
| 1889 } | |
| 1890 | |
| 1891 | |
| 1892 Handle<Code> CallStubCompiler::CompileFastApiCall( | 1819 Handle<Code> CallStubCompiler::CompileFastApiCall( |
| 1893 const CallOptimization& optimization, | 1820 const CallOptimization& optimization, |
| 1894 Handle<Object> object, | 1821 Handle<Object> object, |
| 1895 Handle<JSObject> holder, | 1822 Handle<JSObject> holder, |
| 1896 Handle<Cell> cell, | 1823 Handle<Cell> cell, |
| 1897 Handle<JSFunction> function, | 1824 Handle<JSFunction> function, |
| 1898 Handle<String> name) { | 1825 Handle<String> name) { |
| 1899 Counters* counters = isolate()->counters(); | 1826 Counters* counters = isolate()->counters(); |
| 1900 | 1827 |
| 1901 ASSERT(optimization.is_simple_api_call()); | 1828 ASSERT(optimization.is_simple_api_call()); |
| (...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2503 // ----------------------------------- | 2430 // ----------------------------------- |
| 2504 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); | 2431 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); |
| 2505 } | 2432 } |
| 2506 | 2433 |
| 2507 | 2434 |
| 2508 #undef __ | 2435 #undef __ |
| 2509 | 2436 |
| 2510 } } // namespace v8::internal | 2437 } } // namespace v8::internal |
| 2511 | 2438 |
| 2512 #endif // V8_TARGET_ARCH_ARM | 2439 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |