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