| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 6 | 6 |
| 7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1830 | 1830 |
| 1831 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1831 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1832 Generate_OnStackReplacementHelper(masm, false); | 1832 Generate_OnStackReplacementHelper(masm, false); |
| 1833 } | 1833 } |
| 1834 | 1834 |
| 1835 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 1835 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 1836 Generate_OnStackReplacementHelper(masm, true); | 1836 Generate_OnStackReplacementHelper(masm, true); |
| 1837 } | 1837 } |
| 1838 | 1838 |
| 1839 // static | 1839 // static |
| 1840 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
| 1841 int field_index) { | |
| 1842 // ----------- S t a t e ------------- | |
| 1843 // -- x0 : number of arguments | |
| 1844 // -- x1 : function | |
| 1845 // -- cp : context | |
| 1846 // -- lr : return address | |
| 1847 // -- jssp[0] : receiver | |
| 1848 // ----------------------------------- | |
| 1849 ASM_LOCATION("Builtins::Generate_DatePrototype_GetField"); | |
| 1850 | |
| 1851 // 1. Pop receiver into x0 and check that it's actually a JSDate object. | |
| 1852 Label receiver_not_date; | |
| 1853 { | |
| 1854 __ Pop(x0); | |
| 1855 __ JumpIfSmi(x0, &receiver_not_date); | |
| 1856 __ JumpIfNotObjectType(x0, x2, x3, JS_DATE_TYPE, &receiver_not_date); | |
| 1857 } | |
| 1858 | |
| 1859 // 2. Load the specified date field, falling back to the runtime as necessary. | |
| 1860 if (field_index == JSDate::kDateValue) { | |
| 1861 __ Ldr(x0, FieldMemOperand(x0, JSDate::kValueOffset)); | |
| 1862 } else { | |
| 1863 if (field_index < JSDate::kFirstUncachedField) { | |
| 1864 Label stamp_mismatch; | |
| 1865 __ Mov(x1, ExternalReference::date_cache_stamp(masm->isolate())); | |
| 1866 __ Ldr(x1, MemOperand(x1)); | |
| 1867 __ Ldr(x2, FieldMemOperand(x0, JSDate::kCacheStampOffset)); | |
| 1868 __ Cmp(x1, x2); | |
| 1869 __ B(ne, &stamp_mismatch); | |
| 1870 __ Ldr(x0, FieldMemOperand( | |
| 1871 x0, JSDate::kValueOffset + field_index * kPointerSize)); | |
| 1872 __ Ret(); | |
| 1873 __ Bind(&stamp_mismatch); | |
| 1874 } | |
| 1875 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 1876 __ Mov(x1, Smi::FromInt(field_index)); | |
| 1877 __ CallCFunction( | |
| 1878 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
| 1879 } | |
| 1880 __ Ret(); | |
| 1881 | |
| 1882 // 3. Raise a TypeError if the receiver is not a date. | |
| 1883 __ Bind(&receiver_not_date); | |
| 1884 { | |
| 1885 FrameScope scope(masm, StackFrame::MANUAL); | |
| 1886 __ Push(x0); | |
| 1887 __ Mov(x0, Smi::FromInt(0)); | |
| 1888 __ EnterBuiltinFrame(cp, x1, x0); | |
| 1889 __ CallRuntime(Runtime::kThrowNotDateError); | |
| 1890 | |
| 1891 // It's far from obvious, but this final trailing instruction after the call | |
| 1892 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
| 1893 // why: if call were the final instruction in the code object, then the pc | |
| 1894 // (== return address) would point beyond the code object when the stack is | |
| 1895 // traversed. When we then try to look up the code object through | |
| 1896 // StackFrame::LookupCode, we actually return the next code object that | |
| 1897 // happens to be on the same page in memory. | |
| 1898 // TODO(jgruber): A proper fix for this would be nice. | |
| 1899 __ nop(); | |
| 1900 } | |
| 1901 } | |
| 1902 | |
| 1903 // static | |
| 1904 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1840 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
| 1905 // ----------- S t a t e ------------- | 1841 // ----------- S t a t e ------------- |
| 1906 // -- x0 : argc | 1842 // -- x0 : argc |
| 1907 // -- jssp[0] : argArray (if argc == 2) | 1843 // -- jssp[0] : argArray (if argc == 2) |
| 1908 // -- jssp[8] : thisArg (if argc >= 1) | 1844 // -- jssp[8] : thisArg (if argc >= 1) |
| 1909 // -- jssp[16] : receiver | 1845 // -- jssp[16] : receiver |
| 1910 // ----------------------------------- | 1846 // ----------------------------------- |
| 1911 ASM_LOCATION("Builtins::Generate_FunctionPrototypeApply"); | 1847 ASM_LOCATION("Builtins::Generate_FunctionPrototypeApply"); |
| 1912 | 1848 |
| 1913 Register argc = x0; | 1849 Register argc = x0; |
| (...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3064 __ Unreachable(); | 3000 __ Unreachable(); |
| 3065 } | 3001 } |
| 3066 } | 3002 } |
| 3067 | 3003 |
| 3068 #undef __ | 3004 #undef __ |
| 3069 | 3005 |
| 3070 } // namespace internal | 3006 } // namespace internal |
| 3071 } // namespace v8 | 3007 } // namespace v8 |
| 3072 | 3008 |
| 3073 #endif // V8_TARGET_ARCH_ARM | 3009 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |