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