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

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

Issue 2263533002: [builtins] Migrate DatePrototype_GetField to TurboFan builtin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix C call return type 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
« no previous file with comments | « src/builtins/ppc/builtins-ppc.cc ('k') | src/builtins/x64/builtins-x64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 1868 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // -- r2 : number of arguments
1893 // -- r3 : function
1894 // -- cp : context
1895
1896 // -- lr : return address
1897 // -- sp[0] : receiver
1898 // -----------------------------------
1899
1900 // 1. Pop receiver into r2 and check that it's actually a JSDate object.
1901 Label receiver_not_date;
1902 {
1903 __ Pop(r2);
1904 __ JumpIfSmi(r2, &receiver_not_date);
1905 __ CompareObjectType(r2, r4, r5, JS_DATE_TYPE);
1906 __ bne(&receiver_not_date);
1907 }
1908
1909 // 2. Load the specified date field, falling back to the runtime as necessary.
1910 if (field_index == JSDate::kDateValue) {
1911 __ LoadP(r2, FieldMemOperand(r2, JSDate::kValueOffset));
1912 } else {
1913 if (field_index < JSDate::kFirstUncachedField) {
1914 Label stamp_mismatch;
1915 __ mov(r3, Operand(ExternalReference::date_cache_stamp(masm->isolate())));
1916 __ LoadP(r3, MemOperand(r3));
1917 __ LoadP(ip, FieldMemOperand(r2, JSDate::kCacheStampOffset));
1918 __ CmpP(r3, ip);
1919 __ bne(&stamp_mismatch);
1920 __ LoadP(r2, FieldMemOperand(
1921 r2, JSDate::kValueOffset + field_index * kPointerSize));
1922 __ Ret();
1923 __ bind(&stamp_mismatch);
1924 }
1925 FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
1926 __ PrepareCallCFunction(2, r3);
1927 __ LoadSmiLiteral(r3, Smi::FromInt(field_index));
1928 __ CallCFunction(
1929 ExternalReference::get_date_field_function(masm->isolate()), 2);
1930 }
1931 __ Ret();
1932
1933 // 3. Raise a TypeError if the receiver is not a date.
1934 __ bind(&receiver_not_date);
1935 {
1936 FrameScope scope(masm, StackFrame::MANUAL);
1937 __ push(r2);
1938 __ LoadSmiLiteral(r2, Smi::FromInt(0));
1939 __ EnterBuiltinFrame(cp, r3, r2);
1940 __ CallRuntime(Runtime::kThrowNotDateError);
1941
1942 // It's far from obvious, but this final trailing instruction after the call
1943 // is required for StackFrame::LookupCode to work correctly. To illustrate
1944 // why: if call were the final instruction in the code object, then the pc
1945 // (== return address) would point beyond the code object when the stack is
1946 // traversed. When we then try to look up the code object through
1947 // StackFrame::LookupCode, we actually return the next code object that
1948 // happens to be on the same page in memory.
1949 // TODO(jgruber): A proper fix for this would be nice.
1950 __ nop();
1951 }
1952 }
1953
1954 // static
1955 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) { 1889 void Builtins::Generate_FunctionPrototypeApply(MacroAssembler* masm) {
1956 // ----------- S t a t e ------------- 1890 // ----------- S t a t e -------------
1957 // -- r2 : argc 1891 // -- r2 : argc
1958 // -- sp[0] : argArray 1892 // -- sp[0] : argArray
1959 // -- sp[4] : thisArg 1893 // -- sp[4] : thisArg
1960 // -- sp[8] : receiver 1894 // -- sp[8] : receiver
1961 // ----------------------------------- 1895 // -----------------------------------
1962 1896
1963 // 1. Load receiver into r3, argArray into r2 (if present), remove all 1897 // 1. Load receiver into r3, argArray into r2 (if present), remove all
1964 // arguments from the stack (including the receiver), and push thisArg (if 1898 // arguments from the stack (including the receiver), and push thisArg (if
(...skipping 1092 matching lines...) Expand 10 before | Expand all | Expand 10 after
3057 __ bkpt(0); 2991 __ bkpt(0);
3058 } 2992 }
3059 } 2993 }
3060 2994
3061 #undef __ 2995 #undef __
3062 2996
3063 } // namespace internal 2997 } // namespace internal
3064 } // namespace v8 2998 } // namespace v8
3065 2999
3066 #endif // V8_TARGET_ARCH_S390 3000 #endif // V8_TARGET_ARCH_S390
OLDNEW
« no previous file with comments | « src/builtins/ppc/builtins-ppc.cc ('k') | src/builtins/x64/builtins-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698