| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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_ARM64 | 5 #if V8_TARGET_ARCH_ARM64 |
| 6 | 6 |
| 7 #include "src/arm64/frames-arm64.h" | 7 #include "src/arm64/frames-arm64.h" |
| 8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
| 9 #include "src/debug/debug.h" | 9 #include "src/debug/debug.h" |
| 10 #include "src/deoptimizer.h" | 10 #include "src/deoptimizer.h" |
| (...skipping 1846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1857 | 1857 |
| 1858 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1858 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1859 Generate_OnStackReplacementHelper(masm, false); | 1859 Generate_OnStackReplacementHelper(masm, false); |
| 1860 } | 1860 } |
| 1861 | 1861 |
| 1862 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 1862 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
| 1863 Generate_OnStackReplacementHelper(masm, true); | 1863 Generate_OnStackReplacementHelper(masm, true); |
| 1864 } | 1864 } |
| 1865 | 1865 |
| 1866 // static | 1866 // static |
| 1867 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
| 1868 int field_index) { | |
| 1869 // ----------- S t a t e ------------- | |
| 1870 // -- x0 : number of arguments | |
| 1871 // -- x1 : function | |
| 1872 // -- cp : context | |
| 1873 // -- lr : return address | |
| 1874 // -- jssp[0] : receiver | |
| 1875 // ----------------------------------- | |
| 1876 ASM_LOCATION("Builtins::Generate_DatePrototype_GetField"); | |
| 1877 | |
| 1878 // 1. Pop receiver into x0 and check that it's actually a JSDate object. | |
| 1879 Label receiver_not_date; | |
| 1880 { | |
| 1881 __ Pop(x0); | |
| 1882 __ JumpIfSmi(x0, &receiver_not_date); | |
| 1883 __ JumpIfNotObjectType(x0, x2, x3, JS_DATE_TYPE, &receiver_not_date); | |
| 1884 } | |
| 1885 | |
| 1886 // 2. Load the specified date field, falling back to the runtime as necessary. | |
| 1887 if (field_index == JSDate::kDateValue) { | |
| 1888 __ Ldr(x0, FieldMemOperand(x0, JSDate::kValueOffset)); | |
| 1889 } else { | |
| 1890 if (field_index < JSDate::kFirstUncachedField) { | |
| 1891 Label stamp_mismatch; | |
| 1892 __ Mov(x1, ExternalReference::date_cache_stamp(masm->isolate())); | |
| 1893 __ Ldr(x1, MemOperand(x1)); | |
| 1894 __ Ldr(x2, FieldMemOperand(x0, JSDate::kCacheStampOffset)); | |
| 1895 __ Cmp(x1, x2); | |
| 1896 __ B(ne, &stamp_mismatch); | |
| 1897 __ Ldr(x0, FieldMemOperand( | |
| 1898 x0, JSDate::kValueOffset + field_index * kPointerSize)); | |
| 1899 __ Ret(); | |
| 1900 __ Bind(&stamp_mismatch); | |
| 1901 } | |
| 1902 FrameScope scope(masm, StackFrame::INTERNAL); | |
| 1903 __ Mov(x1, Smi::FromInt(field_index)); | |
| 1904 __ CallCFunction( | |
| 1905 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
| 1906 } | |
| 1907 __ Ret(); | |
| 1908 | |
| 1909 // 3. Raise a TypeError if the receiver is not a date. | |
| 1910 __ Bind(&receiver_not_date); | |
| 1911 { | |
| 1912 FrameScope scope(masm, StackFrame::MANUAL); | |
| 1913 __ Push(x0); | |
| 1914 __ Mov(x0, Smi::FromInt(0)); | |
| 1915 __ EnterBuiltinFrame(cp, x1, x0); | |
| 1916 __ CallRuntime(Runtime::kThrowNotDateError); | |
| 1917 | |
| 1918 // It's far from obvious, but this final trailing instruction after the call | |
| 1919 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
| 1920 // why: if call were the final instruction in the code object, then the pc | |
| 1921 // (== return address) would point beyond the code object when the stack is | |
| 1922 // traversed. When we then try to look up the code object through | |
| 1923 // StackFrame::LookupCode, we actually return the next code object that | |
| 1924 // happens to be on the same page in memory. | |
| 1925 // TODO(jgruber): A proper fix for this would be nice. | |
| 1926 __ nop(); | |
| 1927 } | |
| 1928 } | |
| 1929 | |
| 1930 // static | |
| 1931 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1867 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
| 1932 // ----------- S t a t e ------------- | 1868 // ----------- S t a t e ------------- |
| 1933 // -- x0 : argc | 1869 // -- x0 : argc |
| 1934 // -- jssp[0] : argArray (if argc == 2) | 1870 // -- jssp[0] : argArray (if argc == 2) |
| 1935 // -- jssp[8] : thisArg (if argc >= 1) | 1871 // -- jssp[8] : thisArg (if argc >= 1) |
| 1936 // -- jssp[16] : receiver | 1872 // -- jssp[16] : receiver |
| 1937 // ----------------------------------- | 1873 // ----------------------------------- |
| 1938 ASM_LOCATION("Builtins::Generate_FunctionPrototypeApply"); | 1874 ASM_LOCATION("Builtins::Generate_FunctionPrototypeApply"); |
| 1939 | 1875 |
| 1940 Register argc = x0; | 1876 Register argc = x0; |
| (...skipping 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3071 __ Unreachable(); | 3007 __ Unreachable(); |
| 3072 } | 3008 } |
| 3073 } | 3009 } |
| 3074 | 3010 |
| 3075 #undef __ | 3011 #undef __ |
| 3076 | 3012 |
| 3077 } // namespace internal | 3013 } // namespace internal |
| 3078 } // namespace v8 | 3014 } // namespace v8 |
| 3079 | 3015 |
| 3080 #endif // V8_TARGET_ARCH_ARM | 3016 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |