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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 1849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1860 | 1860 |
1861 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1861 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
1862 Generate_OnStackReplacementHelper(masm, false); | 1862 Generate_OnStackReplacementHelper(masm, false); |
1863 } | 1863 } |
1864 | 1864 |
1865 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 1865 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
1866 Generate_OnStackReplacementHelper(masm, true); | 1866 Generate_OnStackReplacementHelper(masm, true); |
1867 } | 1867 } |
1868 | 1868 |
1869 // static | 1869 // static |
1870 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
1871 int field_index) { | |
1872 // ----------- S t a t e ------------- | |
1873 // -- r0 : number of arguments | |
1874 // -- r1 : function | |
1875 // -- cp : context | |
1876 // -- lr : return address | |
1877 // -- sp[0] : receiver | |
1878 // ----------------------------------- | |
1879 | |
1880 // 1. Pop receiver into r0 and check that it's actually a JSDate object. | |
1881 Label receiver_not_date; | |
1882 { | |
1883 __ Pop(r0); | |
1884 __ JumpIfSmi(r0, &receiver_not_date); | |
1885 __ CompareObjectType(r0, r2, r3, JS_DATE_TYPE); | |
1886 __ b(ne, &receiver_not_date); | |
1887 } | |
1888 | |
1889 // 2. Load the specified date field, falling back to the runtime as necessary. | |
1890 if (field_index == JSDate::kDateValue) { | |
1891 __ ldr(r0, FieldMemOperand(r0, JSDate::kValueOffset)); | |
1892 } else { | |
1893 if (field_index < JSDate::kFirstUncachedField) { | |
1894 Label stamp_mismatch; | |
1895 __ mov(r1, Operand(ExternalReference::date_cache_stamp(masm->isolate()))); | |
1896 __ ldr(r1, MemOperand(r1)); | |
1897 __ ldr(ip, FieldMemOperand(r0, JSDate::kCacheStampOffset)); | |
1898 __ cmp(r1, ip); | |
1899 __ b(ne, &stamp_mismatch); | |
1900 __ ldr(r0, FieldMemOperand( | |
1901 r0, JSDate::kValueOffset + field_index * kPointerSize)); | |
1902 __ Ret(); | |
1903 __ bind(&stamp_mismatch); | |
1904 } | |
1905 FrameScope scope(masm, StackFrame::INTERNAL); | |
1906 __ PrepareCallCFunction(2, r1); | |
1907 __ mov(r1, Operand(Smi::FromInt(field_index))); | |
1908 __ CallCFunction( | |
1909 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
1910 } | |
1911 __ Ret(); | |
1912 | |
1913 // 3. Raise a TypeError if the receiver is not a date. | |
1914 __ bind(&receiver_not_date); | |
1915 { | |
1916 FrameScope scope(masm, StackFrame::MANUAL); | |
1917 __ Push(r0); | |
1918 __ Move(r0, Smi::FromInt(0)); | |
1919 __ EnterBuiltinFrame(cp, r1, r0); | |
1920 __ CallRuntime(Runtime::kThrowNotDateError); | |
1921 | |
1922 // It's far from obvious, but this final trailing instruction after the call | |
1923 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
1924 // why: if call were the final instruction in the code object, then the pc | |
1925 // (== return address) would point beyond the code object when the stack is | |
1926 // traversed. When we then try to look up the code object through | |
1927 // StackFrame::LookupCode, we actually return the next code object that | |
1928 // happens to be on the same page in memory. | |
1929 // TODO(jgruber): A proper fix for this would be nice. | |
1930 __ nop(); | |
1931 } | |
1932 } | |
1933 | |
1934 // static | |
1935 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1870 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
1936 // ----------- S t a t e ------------- | 1871 // ----------- S t a t e ------------- |
1937 // -- r0 : argc | 1872 // -- r0 : argc |
1938 // -- sp[0] : argArray | 1873 // -- sp[0] : argArray |
1939 // -- sp[4] : thisArg | 1874 // -- sp[4] : thisArg |
1940 // -- sp[8] : receiver | 1875 // -- sp[8] : receiver |
1941 // ----------------------------------- | 1876 // ----------------------------------- |
1942 | 1877 |
1943 // 1. Load receiver into r1, argArray into r0 (if present), remove all | 1878 // 1. Load receiver into r1, argArray into r0 (if present), remove all |
1944 // arguments from the stack (including the receiver), and push thisArg (if | 1879 // arguments from the stack (including the receiver), and push thisArg (if |
(...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2969 __ bkpt(0); | 2904 __ bkpt(0); |
2970 } | 2905 } |
2971 } | 2906 } |
2972 | 2907 |
2973 #undef __ | 2908 #undef __ |
2974 | 2909 |
2975 } // namespace internal | 2910 } // namespace internal |
2976 } // namespace v8 | 2911 } // namespace v8 |
2977 | 2912 |
2978 #endif // V8_TARGET_ARCH_ARM | 2913 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |