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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1879 | 1879 |
1880 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1880 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
1881 Generate_OnStackReplacementHelper(masm, false); | 1881 Generate_OnStackReplacementHelper(masm, false); |
1882 } | 1882 } |
1883 | 1883 |
1884 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { | 1884 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { |
1885 Generate_OnStackReplacementHelper(masm, true); | 1885 Generate_OnStackReplacementHelper(masm, true); |
1886 } | 1886 } |
1887 | 1887 |
1888 // static | 1888 // static |
1889 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm, | |
1890 int field_index) { | |
1891 // ----------- S t a t e ------------- | |
1892 // -- r3 : number of arguments | |
1893 // -- r4 : function | |
1894 // -- cp : context | |
1895 // -- lr : return address | |
1896 // -- sp[0] : receiver | |
1897 // ----------------------------------- | |
1898 | |
1899 // 1. Pop receiver into r3 and check that it's actually a JSDate object. | |
1900 Label receiver_not_date; | |
1901 { | |
1902 __ Pop(r3); | |
1903 __ JumpIfSmi(r3, &receiver_not_date); | |
1904 __ CompareObjectType(r3, r5, r6, JS_DATE_TYPE); | |
1905 __ bne(&receiver_not_date); | |
1906 } | |
1907 | |
1908 // 2. Load the specified date field, falling back to the runtime as necessary. | |
1909 if (field_index == JSDate::kDateValue) { | |
1910 __ LoadP(r3, FieldMemOperand(r3, JSDate::kValueOffset)); | |
1911 } else { | |
1912 if (field_index < JSDate::kFirstUncachedField) { | |
1913 Label stamp_mismatch; | |
1914 __ mov(r4, Operand(ExternalReference::date_cache_stamp(masm->isolate()))); | |
1915 __ LoadP(r4, MemOperand(r4)); | |
1916 __ LoadP(ip, FieldMemOperand(r3, JSDate::kCacheStampOffset)); | |
1917 __ cmp(r4, ip); | |
1918 __ bne(&stamp_mismatch); | |
1919 __ LoadP(r3, FieldMemOperand( | |
1920 r3, JSDate::kValueOffset + field_index * kPointerSize)); | |
1921 __ Ret(); | |
1922 __ bind(&stamp_mismatch); | |
1923 } | |
1924 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); | |
1925 __ PrepareCallCFunction(2, r4); | |
1926 __ LoadSmiLiteral(r4, Smi::FromInt(field_index)); | |
1927 __ CallCFunction( | |
1928 ExternalReference::get_date_field_function(masm->isolate()), 2); | |
1929 } | |
1930 __ Ret(); | |
1931 | |
1932 // 3. Raise a TypeError if the receiver is not a date. | |
1933 __ bind(&receiver_not_date); | |
1934 { | |
1935 FrameScope scope(masm, StackFrame::MANUAL); | |
1936 __ push(r3); | |
1937 __ LoadSmiLiteral(r3, Smi::FromInt(0)); | |
1938 __ EnterBuiltinFrame(cp, r4, r3); | |
1939 __ CallRuntime(Runtime::kThrowNotDateError); | |
1940 | |
1941 // It's far from obvious, but this final trailing instruction after the call | |
1942 // is required for StackFrame::LookupCode to work correctly. To illustrate | |
1943 // why: if call were the final instruction in the code object, then the pc | |
1944 // (== return address) would point beyond the code object when the stack is | |
1945 // traversed. When we then try to look up the code object through | |
1946 // StackFrame::LookupCode, we actually return the next code object that | |
1947 // happens to be on the same page in memory. | |
1948 // TODO(jgruber): A proper fix for this would be nice. | |
1949 __ nop(); | |
1950 } | |
1951 } | |
1952 | |
1953 // static | |
1954 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { | 1889 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { |
1955 // ----------- S t a t e ------------- | 1890 // ----------- S t a t e ------------- |
1956 // -- r3 : argc | 1891 // -- r3 : argc |
1957 // -- sp[0] : argArray | 1892 // -- sp[0] : argArray |
1958 // -- sp[4] : thisArg | 1893 // -- sp[4] : thisArg |
1959 // -- sp[8] : receiver | 1894 // -- sp[8] : receiver |
1960 // ----------------------------------- | 1895 // ----------------------------------- |
1961 | 1896 |
1962 // 1. Load receiver into r4, argArray into r3 (if present), remove all | 1897 // 1. Load receiver into r4, argArray into r3 (if present), remove all |
1963 // arguments from the stack (including the receiver), and push thisArg (if | 1898 // arguments from the stack (including the receiver), and push thisArg (if |
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3045 __ CallRuntime(Runtime::kThrowStackOverflow); | 2980 __ CallRuntime(Runtime::kThrowStackOverflow); |
3046 __ bkpt(0); | 2981 __ bkpt(0); |
3047 } | 2982 } |
3048 } | 2983 } |
3049 | 2984 |
3050 #undef __ | 2985 #undef __ |
3051 } // namespace internal | 2986 } // namespace internal |
3052 } // namespace v8 | 2987 } // namespace v8 |
3053 | 2988 |
3054 #endif // V8_TARGET_ARCH_PPC | 2989 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |