| 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 1829 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1840 | 1840 |
| 1841 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1841 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1842 Generate_OnStackReplacementHelper(masm, false); | 1842 Generate_OnStackReplacementHelper(masm, false); |
| 1843 } | 1843 } |
| 1844 | 1844 |
| 1845 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 1845 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 1846 Generate_OnStackReplacementHelper(masm, true); | 1846 Generate_OnStackReplacementHelper(masm, true); |
| 1847 } | 1847 } |
| 1848 | 1848 |
| 1849 // static | 1849 // static |
| 1850 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
| 1851 int field_index) { | |
| 1852 // ----------- S t a t e ------------- | |
| 1853 // -- a0 : number of arguments | |
| 1854 // -- a1 : function | |
| 1855 // -- cp : context | |
| 1856 // -- sp[0] : receiver | |
| 1857 // ----------------------------------- | |
| 1858 | |
| 1859 // 1. Pop receiver into a0 and check that it's actually a JSDate object. | |
| 1860 Label receiver_not_date; | |
| 1861 { | |
| 1862 __ Pop(a0); | |
| 1863 __ JumpIfSmi(a0, &receiver_not_date); | |
| 1864 __ GetObjectType(a0, t0, t0); | |
| 1865 __ Branch(&receiver_not_date, ne, t0, Operand(JS_DATE_TYPE)); | |
| 1866 } | |
| 1867 | |
| 1868 // 2. Load the specified date field, falling back to the runtime as necessary. | |
| 1869 if (field_index == JSDate::kDateValue) { | |
| 1870 __ Ret(USE_DELAY_SLOT); | |
| 1871 __ ld(v0, FieldMemOperand(a0, JSDate::kValueOffset)); // In delay slot. | |
| 1872 } else { | |
| 1873 if (field_index < JSDate::kFirstUncachedField) { | |
| 1874 Label stamp_mismatch; | |
| 1875 __ li(a1, Operand(ExternalReference::date_cache_stamp(masm->isolate()))); | |
| 1876 __ ld(a1, MemOperand(a1)); | |
| 1877 __ ld(t0, FieldMemOperand(a0, JSDate::kCacheStampOffset)); | |
| 1878 __ Branch(&stamp_mismatch, ne, t0, Operand(a1)); | |
| 1879 __ Ret(USE_DELAY_SLOT); | |
| 1880 __ ld(v0, FieldMemOperand( | |
| 1881 a0, JSDate::kValueOffset + | |
| 1882 field_index * kPointerSize)); // In delay slot. | |
| 1883 __ bind(&stamp_mismatch); | |
| 1884 } | |
| 1885 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 1886 __ PrepareCallCFunction(2, t0); | |
| 1887 __ li(a1, Operand(Smi::FromInt(field_index))); | |
| 1888 __ CallCFunction( | |
| 1889 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
| 1890 } | |
| 1891 __ Ret(); | |
| 1892 | |
| 1893 // 3. Raise a TypeError if the receiver is not a date. | |
| 1894 __ bind(&receiver_not_date); | |
| 1895 { | |
| 1896 FrameScope scope(masm, StackFrame::MANUAL); | |
| 1897 __ Push(a0); | |
| 1898 __ Move(a0, Smi::FromInt(0)); | |
| 1899 __ EnterBuiltinFrame(cp, a1, a0); | |
| 1900 __ CallRuntime(Runtime::kThrowNotDateError); | |
| 1901 | |
| 1902 // It's far from obvious, but this final trailing instruction after the call | |
| 1903 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
| 1904 // why: if call were the final instruction in the code object, then the pc | |
| 1905 // (== return address) would point beyond the code object when the stack is | |
| 1906 // traversed. When we then try to look up the code object through | |
| 1907 // StackFrame::LookupCode, we actually return the next code object that | |
| 1908 // happens to be on the same page in memory. | |
| 1909 // TODO(jgruber): A proper fix for this would be nice. | |
| 1910 __ nop(); | |
| 1911 } | |
| 1912 } | |
| 1913 | |
| 1914 // static | |
| 1915 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1850 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
| 1916 // ----------- S t a t e ------------- | 1851 // ----------- S t a t e ------------- |
| 1917 // -- a0 : argc | 1852 // -- a0 : argc |
| 1918 // -- sp[0] : argArray | 1853 // -- sp[0] : argArray |
| 1919 // -- sp[4] : thisArg | 1854 // -- sp[4] : thisArg |
| 1920 // -- sp[8] : receiver | 1855 // -- sp[8] : receiver |
| 1921 // ----------------------------------- | 1856 // ----------------------------------- |
| 1922 | 1857 |
| 1923 // 1. Load receiver into a1, argArray into a0 (if present), remove all | 1858 // 1. Load receiver into a1, argArray into a0 (if present), remove all |
| 1924 // arguments from the stack (including the receiver), and push thisArg (if | 1859 // arguments from the stack (including the receiver), and push thisArg (if |
| (...skipping 1111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3036 __ break_(0xCC); | 2971 __ break_(0xCC); |
| 3037 } | 2972 } |
| 3038 } | 2973 } |
| 3039 | 2974 |
| 3040 #undef __ | 2975 #undef __ |
| 3041 | 2976 |
| 3042 } // namespace internal | 2977 } // namespace internal |
| 3043 } // namespace v8 | 2978 } // namespace v8 |
| 3044 | 2979 |
| 3045 #endif // V8_TARGET_ARCH_MIPS64 | 2980 #endif // V8_TARGET_ARCH_MIPS64 |
| OLD | NEW |