| 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 #if V8_TARGET_ARCH_ARM | 5 #if V8_TARGET_ARCH_ARM |
| 6 | 6 |
| 7 #include "src/codegen.h" | 7 #include "src/codegen.h" |
| 8 #include "src/debug/debug.h" | 8 #include "src/debug/debug.h" |
| 9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
| 10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
| (...skipping 1816 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 | 1827 |
| 1828 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1828 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1829 Generate_OnStackReplacementHelper(masm, false); | 1829 Generate_OnStackReplacementHelper(masm, false); |
| 1830 } | 1830 } |
| 1831 | 1831 |
| 1832 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 1832 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 1833 Generate_OnStackReplacementHelper(masm, true); | 1833 Generate_OnStackReplacementHelper(masm, true); |
| 1834 } | 1834 } |
| 1835 | 1835 |
| 1836 // static | 1836 // static |
| 1837 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
| 1838 int field_index) { | |
| 1839 // ----------- S t a t e ------------- | |
| 1840 // -- r0 : number of arguments | |
| 1841 // -- r1 : function | |
| 1842 // -- cp : context | |
| 1843 // -- lr : return address | |
| 1844 // -- sp[0] : receiver | |
| 1845 // ----------------------------------- | |
| 1846 | |
| 1847 // 1. Pop receiver into r0 and check that it's actually a JSDate object. | |
| 1848 Label receiver_not_date; | |
| 1849 { | |
| 1850 __ Pop(r0); | |
| 1851 __ JumpIfSmi(r0, &receiver_not_date); | |
| 1852 __ CompareObjectType(r0, r2, r3, JS_DATE_TYPE); | |
| 1853 __ b(ne, &receiver_not_date); | |
| 1854 } | |
| 1855 | |
| 1856 // 2. Load the specified date field, falling back to the runtime as necessary. | |
| 1857 if (field_index == JSDate::kDateValue) { | |
| 1858 __ ldr(r0, FieldMemOperand(r0, JSDate::kValueOffset)); | |
| 1859 } else { | |
| 1860 if (field_index < JSDate::kFirstUncachedField) { | |
| 1861 Label stamp_mismatch; | |
| 1862 __ mov(r1, Operand(ExternalReference::date_cache_stamp(masm->isolate()))); | |
| 1863 __ ldr(r1, MemOperand(r1)); | |
| 1864 __ ldr(ip, FieldMemOperand(r0, JSDate::kCacheStampOffset)); | |
| 1865 __ cmp(r1, ip); | |
| 1866 __ b(ne, &stamp_mismatch); | |
| 1867 __ ldr(r0, FieldMemOperand( | |
| 1868 r0, JSDate::kValueOffset + field_index * kPointerSize)); | |
| 1869 __ Ret(); | |
| 1870 __ bind(&stamp_mismatch); | |
| 1871 } | |
| 1872 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 1873 __ PrepareCallCFunction(2, r1); | |
| 1874 __ mov(r1, Operand(Smi::FromInt(field_index))); | |
| 1875 __ CallCFunction( | |
| 1876 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
| 1877 } | |
| 1878 __ Ret(); | |
| 1879 | |
| 1880 // 3. Raise a TypeError if the receiver is not a date. | |
| 1881 __ bind(&receiver_not_date); | |
| 1882 { | |
| 1883 FrameScope scope(masm, StackFrame::MANUAL); | |
| 1884 __ Push(r0); | |
| 1885 __ Move(r0, Smi::FromInt(0)); | |
| 1886 __ EnterBuiltinFrame(cp, r1, r0); | |
| 1887 __ CallRuntime(Runtime::kThrowNotDateError); | |
| 1888 | |
| 1889 // It's far from obvious, but this final trailing instruction after the call | |
| 1890 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
| 1891 // why: if call were the final instruction in the code object, then the pc | |
| 1892 // (== return address) would point beyond the code object when the stack is | |
| 1893 // traversed. When we then try to look up the code object through | |
| 1894 // StackFrame::LookupCode, we actually return the next code object that | |
| 1895 // happens to be on the same page in memory. | |
| 1896 // TODO(jgruber): A proper fix for this would be nice. | |
| 1897 __ nop(); | |
| 1898 } | |
| 1899 } | |
| 1900 | |
| 1901 // static | |
| 1902 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1837 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
| 1903 // ----------- S t a t e ------------- | 1838 // ----------- S t a t e ------------- |
| 1904 // -- r0 : argc | 1839 // -- r0 : argc |
| 1905 // -- sp[0] : argArray | 1840 // -- sp[0] : argArray |
| 1906 // -- sp[4] : thisArg | 1841 // -- sp[4] : thisArg |
| 1907 // -- sp[8] : receiver | 1842 // -- sp[8] : receiver |
| 1908 // ----------------------------------- | 1843 // ----------------------------------- |
| 1909 | 1844 |
| 1910 // 1. Load receiver into r1, argArray into r0 (if present), remove all | 1845 // 1. Load receiver into r1, argArray into r0 (if present), remove all |
| 1911 // arguments from the stack (including the receiver), and push thisArg (if | 1846 // arguments from the stack (including the receiver), and push thisArg (if |
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2951 __ bkpt(0); | 2886 __ bkpt(0); |
| 2952 } | 2887 } |
| 2953 } | 2888 } |
| 2954 | 2889 |
| 2955 #undef __ | 2890 #undef __ |
| 2956 | 2891 |
| 2957 } // namespace internal | 2892 } // namespace internal |
| 2958 } // namespace v8 | 2893 } // namespace v8 |
| 2959 | 2894 |
| 2960 #endif // V8_TARGET_ARCH_ARM | 2895 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |