| 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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
| 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 1796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 | 1807 |
| 1808 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1808 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1809 Generate_OnStackReplacementHelper(masm, false); | 1809 Generate_OnStackReplacementHelper(masm, false); |
| 1810 } | 1810 } |
| 1811 | 1811 |
| 1812 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 1812 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 1813 Generate_OnStackReplacementHelper(masm, true); | 1813 Generate_OnStackReplacementHelper(masm, true); |
| 1814 } | 1814 } |
| 1815 | 1815 |
| 1816 // static | 1816 // static |
| 1817 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
| 1818 int field_index) { | |
| 1819 // ----------- S t a t e ------------- | |
| 1820 // -- a0 : number of arguments | |
| 1821 // -- a1 : function | |
| 1822 // -- cp : context | |
| 1823 // -- sp[0] : receiver | |
| 1824 // ----------------------------------- | |
| 1825 | |
| 1826 // 1. Pop receiver into a0 and check that it's actually a JSDate object. | |
| 1827 Label receiver_not_date; | |
| 1828 { | |
| 1829 __ Pop(a0); | |
| 1830 __ JumpIfSmi(a0, &receiver_not_date); | |
| 1831 __ GetObjectType(a0, t0, t0); | |
| 1832 __ Branch(&receiver_not_date, ne, t0, Operand(JS_DATE_TYPE)); | |
| 1833 } | |
| 1834 | |
| 1835 // 2. Load the specified date field, falling back to the runtime as necessary. | |
| 1836 if (field_index == JSDate::kDateValue) { | |
| 1837 __ Ret(USE_DELAY_SLOT); | |
| 1838 __ ld(v0, FieldMemOperand(a0, JSDate::kValueOffset)); // In delay slot. | |
| 1839 } else { | |
| 1840 if (field_index < JSDate::kFirstUncachedField) { | |
| 1841 Label stamp_mismatch; | |
| 1842 __ li(a1, Operand(ExternalReference::date_cache_stamp(masm->isolate()))); | |
| 1843 __ ld(a1, MemOperand(a1)); | |
| 1844 __ ld(t0, FieldMemOperand(a0, JSDate::kCacheStampOffset)); | |
| 1845 __ Branch(&stamp_mismatch, ne, t0, Operand(a1)); | |
| 1846 __ Ret(USE_DELAY_SLOT); | |
| 1847 __ ld(v0, FieldMemOperand( | |
| 1848 a0, JSDate::kValueOffset + | |
| 1849 field_index * kPointerSize)); // In delay slot. | |
| 1850 __ bind(&stamp_mismatch); | |
| 1851 } | |
| 1852 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 1853 __ PrepareCallCFunction(2, t0); | |
| 1854 __ li(a1, Operand(Smi::FromInt(field_index))); | |
| 1855 __ CallCFunction( | |
| 1856 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
| 1857 } | |
| 1858 __ Ret(); | |
| 1859 | |
| 1860 // 3. Raise a TypeError if the receiver is not a date. | |
| 1861 __ bind(&receiver_not_date); | |
| 1862 { | |
| 1863 FrameScope scope(masm, StackFrame::MANUAL); | |
| 1864 __ Push(a0); | |
| 1865 __ Move(a0, Smi::FromInt(0)); | |
| 1866 __ EnterBuiltinFrame(cp, a1, a0); | |
| 1867 __ CallRuntime(Runtime::kThrowNotDateError); | |
| 1868 | |
| 1869 // It's far from obvious, but this final trailing instruction after the call | |
| 1870 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
| 1871 // why: if call were the final instruction in the code object, then the pc | |
| 1872 // (== return address) would point beyond the code object when the stack is | |
| 1873 // traversed. When we then try to look up the code object through | |
| 1874 // StackFrame::LookupCode, we actually return the next code object that | |
| 1875 // happens to be on the same page in memory. | |
| 1876 // TODO(jgruber): A proper fix for this would be nice. | |
| 1877 __ nop(); | |
| 1878 } | |
| 1879 } | |
| 1880 | |
| 1881 // static | |
| 1882 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1817 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
| 1883 // ----------- S t a t e ------------- | 1818 // ----------- S t a t e ------------- |
| 1884 // -- a0 : argc | 1819 // -- a0 : argc |
| 1885 // -- sp[0] : argArray | 1820 // -- sp[0] : argArray |
| 1886 // -- sp[4] : thisArg | 1821 // -- sp[4] : thisArg |
| 1887 // -- sp[8] : receiver | 1822 // -- sp[8] : receiver |
| 1888 // ----------------------------------- | 1823 // ----------------------------------- |
| 1889 | 1824 |
| 1890 // 1. Load receiver into a1, argArray into a0 (if present), remove all | 1825 // 1. Load receiver into a1, argArray into a0 (if present), remove all |
| 1891 // arguments from the stack (including the receiver), and push thisArg (if | 1826 // arguments from the stack (including the receiver), and push thisArg (if |
| (...skipping 1133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3025 __ break_(0xCC); | 2960 __ break_(0xCC); |
| 3026 } | 2961 } |
| 3027 } | 2962 } |
| 3028 | 2963 |
| 3029 #undef __ | 2964 #undef __ |
| 3030 | 2965 |
| 3031 } // namespace internal | 2966 } // namespace internal |
| 3032 } // namespace v8 | 2967 } // namespace v8 |
| 3033 | 2968 |
| 3034 #endif // V8_TARGET_ARCH_MIPS64 | 2969 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |