| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_S390 | 5 #if V8_TARGET_ARCH_S390 |
| 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 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 | 1837 |
| 1838 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1838 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1839 Generate_OnStackReplacementHelper(masm, false); | 1839 Generate_OnStackReplacementHelper(masm, false); |
| 1840 } | 1840 } |
| 1841 | 1841 |
| 1842 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 1842 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 1843 Generate_OnStackReplacementHelper(masm, true); | 1843 Generate_OnStackReplacementHelper(masm, true); |
| 1844 } | 1844 } |
| 1845 | 1845 |
| 1846 // static | 1846 // static |
| 1847 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
| 1848 int field_index) { | |
| 1849 // ----------- S t a t e ------------- | |
| 1850 // -- r2 : number of arguments | |
| 1851 // -- r3 : function | |
| 1852 // -- cp : context | |
| 1853 | |
| 1854 // -- lr : return address | |
| 1855 // -- sp[0] : receiver | |
| 1856 // ----------------------------------- | |
| 1857 | |
| 1858 // 1. Pop receiver into r2 and check that it's actually a JSDate object. | |
| 1859 Label receiver_not_date; | |
| 1860 { | |
| 1861 __ Pop(r2); | |
| 1862 __ JumpIfSmi(r2, &receiver_not_date); | |
| 1863 __ CompareObjectType(r2, r4, r5, JS_DATE_TYPE); | |
| 1864 __ bne(&receiver_not_date); | |
| 1865 } | |
| 1866 | |
| 1867 // 2. Load the specified date field, falling back to the runtime as necessary. | |
| 1868 if (field_index == JSDate::kDateValue) { | |
| 1869 __ LoadP(r2, FieldMemOperand(r2, JSDate::kValueOffset)); | |
| 1870 } else { | |
| 1871 if (field_index < JSDate::kFirstUncachedField) { | |
| 1872 Label stamp_mismatch; | |
| 1873 __ mov(r3, Operand(ExternalReference::date_cache_stamp(masm->isolate()))); | |
| 1874 __ LoadP(r3, MemOperand(r3)); | |
| 1875 __ LoadP(ip, FieldMemOperand(r2, JSDate::kCacheStampOffset)); | |
| 1876 __ CmpP(r3, ip); | |
| 1877 __ bne(&stamp_mismatch); | |
| 1878 __ LoadP(r2, FieldMemOperand( | |
| 1879 r2, JSDate::kValueOffset + field_index * kPointerSize)); | |
| 1880 __ Ret(); | |
| 1881 __ bind(&stamp_mismatch); | |
| 1882 } | |
| 1883 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | |
| 1884 __ PrepareCallCFunction(2, r3); | |
| 1885 __ LoadSmiLiteral(r3, Smi::FromInt(field_index)); | |
| 1886 __ CallCFunction( | |
| 1887 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
| 1888 } | |
| 1889 __ Ret(); | |
| 1890 | |
| 1891 // 3. Raise a TypeError if the receiver is not a date. | |
| 1892 __ bind(&receiver_not_date); | |
| 1893 { | |
| 1894 FrameScope scope(masm, StackFrame::MANUAL); | |
| 1895 __ push(r2); | |
| 1896 __ LoadSmiLiteral(r2, Smi::FromInt(0)); | |
| 1897 __ EnterBuiltinFrame(cp, r3, r2); | |
| 1898 __ CallRuntime(Runtime::kThrowNotDateError); | |
| 1899 | |
| 1900 // It's far from obvious, but this final trailing instruction after the call | |
| 1901 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
| 1902 // why: if call were the final instruction in the code object, then the pc | |
| 1903 // (== return address) would point beyond the code object when the stack is | |
| 1904 // traversed. When we then try to look up the code object through | |
| 1905 // StackFrame::LookupCode, we actually return the next code object that | |
| 1906 // happens to be on the same page in memory. | |
| 1907 // TODO(jgruber): A proper fix for this would be nice. | |
| 1908 __ nop(); | |
| 1909 } | |
| 1910 } | |
| 1911 | |
| 1912 // static | |
| 1913 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1847 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
| 1914 // ----------- S t a t e ------------- | 1848 // ----------- S t a t e ------------- |
| 1915 // -- r2 : argc | 1849 // -- r2 : argc |
| 1916 // -- sp[0] : argArray | 1850 // -- sp[0] : argArray |
| 1917 // -- sp[4] : thisArg | 1851 // -- sp[4] : thisArg |
| 1918 // -- sp[8] : receiver | 1852 // -- sp[8] : receiver |
| 1919 // ----------------------------------- | 1853 // ----------------------------------- |
| 1920 | 1854 |
| 1921 // 1. Load receiver into r3, argArray into r2 (if present), remove all | 1855 // 1. Load receiver into r3, argArray into r2 (if present), remove all |
| 1922 // arguments from the stack (including the receiver), and push thisArg (if | 1856 // arguments from the stack (including the receiver), and push thisArg (if |
| (...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3031 __ bkpt(0); | 2965 __ bkpt(0); |
| 3032 } | 2966 } |
| 3033 } | 2967 } |
| 3034 | 2968 |
| 3035 #undef __ | 2969 #undef __ |
| 3036 | 2970 |
| 3037 } // namespace internal | 2971 } // namespace internal |
| 3038 } // namespace v8 | 2972 } // namespace v8 |
| 3039 | 2973 |
| 3040 #endif // V8_TARGET_ARCH_S390 | 2974 #endif // V8_TARGET_ARCH_S390 |
| OLD | NEW |