Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(254)

Side by Side Diff: src/builtins/ppc/builtins-ppc.cc

Issue 2263533002: [builtins] Migrate DatePrototype_GetField to TurboFan builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Directly call to C++ instead of runtime. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 1824 matching lines...) Expand 10 before | Expand all | Expand 10 after
1835 1835
1836 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { 1836 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) {
1837 Generate_OnStackReplacementHelper(masm, false); 1837 Generate_OnStackReplacementHelper(masm, false);
1838 } 1838 }
1839 1839
1840 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) { 1840 void Builtins::Generate_InterpreterOnStackReplacement(MacroAssembler* masm) {
1841 Generate_OnStackReplacementHelper(masm, true); 1841 Generate_OnStackReplacementHelper(masm, true);
1842 } 1842 }
1843 1843
1844 // static 1844 // static
1845 void Builtins::Generate_DatePrototype_GetField(MacroAssembler* masm,
1846 int field_index) {
1847 // ----------- S t a t e -------------
1848 // -- r3 : number of arguments
1849 // -- r4 : function
1850 // -- cp : context
1851 // -- lr : return address
1852 // -- sp[0] : receiver
1853 // -----------------------------------
1854
1855 // 1. Pop receiver into r3 and check that it's actually a JSDate object.
1856 Label receiver_not_date;
1857 {
1858 __ Pop(r3);
1859 __ JumpIfSmi(r3, &receiver_not_date);
1860 __ CompareObjectType(r3, r5, r6, JS_DATE_TYPE);
1861 __ bne(&receiver_not_date);
1862 }
1863
1864 // 2. Load the specified date field, falling back to the runtime as necessary.
1865 if (field_index == JSDate::kDateValue) {
1866 __ LoadP(r3, FieldMemOperand(r3, JSDate::kValueOffset));
1867 } else {
1868 if (field_index < JSDate::kFirstUncachedField) {
1869 Label stamp_mismatch;
1870 __ mov(r4, Operand(ExternalReference::date_cache_stamp(masm->isolate())));
1871 __ LoadP(r4, MemOperand(r4));
1872 __ LoadP(ip, FieldMemOperand(r3, JSDate::kCacheStampOffset));
1873 __ cmp(r4, ip);
1874 __ bne(&stamp_mismatch);
1875 __ LoadP(r3, FieldMemOperand(
1876 r3, JSDate::kValueOffset + field_index * kPointerSize));
1877 __ Ret();
1878 __ bind(&stamp_mismatch);
1879 }
1880 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1881 __ PrepareCallCFunction(2, r4);
1882 __ LoadSmiLiteral(r4, Smi::FromInt(field_index));
1883 __ CallCFunction(
1884 ExternalReference::get_date_field_function(masm->isolate()), 2);
1885 }
1886 __ Ret();
1887
1888 // 3. Raise a TypeError if the receiver is not a date.
1889 __ bind(&receiver_not_date);
1890 {
1891 FrameScope scope(masm, StackFrame::MANUAL);
1892 __ push(r3);
1893 __ LoadSmiLiteral(r3, Smi::FromInt(0));
1894 __ EnterBuiltinFrame(cp, r4, r3);
1895 __ CallRuntime(Runtime::kThrowNotDateError);
1896
1897 // It's far from obvious, but this final trailing instruction after the call
1898 // is required for StackFrame::LookupCode to work correctly. To illustrate
1899 // why: if call were the final instruction in the code object, then the pc
1900 // (== return address) would point beyond the code object when the stack is
1901 // traversed. When we then try to look up the code object through
1902 // StackFrame::LookupCode, we actually return the next code object that
1903 // happens to be on the same page in memory.
1904 // TODO(jgruber): A proper fix for this would be nice.
1905 __ nop();
1906 }
1907 }
1908
1909 // static
1910 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { 1845 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
1911 // ----------- S t a t e ------------- 1846 // ----------- S t a t e -------------
1912 // -- r3 : argc 1847 // -- r3 : argc
1913 // -- sp[0] : argArray 1848 // -- sp[0] : argArray
1914 // -- sp[4] : thisArg 1849 // -- sp[4] : thisArg
1915 // -- sp[8] : receiver 1850 // -- sp[8] : receiver
1916 // ----------------------------------- 1851 // -----------------------------------
1917 1852
1918 // 1. Load receiver into r4, argArray into r3 (if present), remove all 1853 // 1. Load receiver into r4, argArray into r3 (if present), remove all
1919 // arguments from the stack (including the receiver), and push thisArg (if 1854 // arguments from the stack (including the receiver), and push thisArg (if
(...skipping 1097 matching lines...) Expand 10 before | Expand all | Expand 10 after
3017 __ CallRuntime(Runtime::kThrowStackOverflow); 2952 __ CallRuntime(Runtime::kThrowStackOverflow);
3018 __ bkpt(0); 2953 __ bkpt(0);
3019 } 2954 }
3020 } 2955 }
3021 2956
3022 #undef __ 2957 #undef __
3023 } // namespace internal 2958 } // namespace internal
3024 } // namespace v8 2959 } // namespace v8
3025 2960
3026 #endif // V8_TARGET_ARCH_PPC 2961 #endif // V8_TARGET_ARCH_PPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698