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

Side by Side Diff: src/x87/macro-assembler-x87.cc

Issue 1559693002: X87: [runtime] TailCallRuntime and CallRuntime should use default argument counts specified in runt… (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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/x87/macro-assembler-x87.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_X87 5 #if V8_TARGET_ARCH_X87
6 6
7 #include "src/base/bits.h" 7 #include "src/base/bits.h"
8 #include "src/base/division-by-constant.h" 8 #include "src/base/division-by-constant.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1847 matching lines...) Expand 10 before | Expand all | Expand 10 after
1858 void MacroAssembler::CallExternalReference(ExternalReference ref, 1858 void MacroAssembler::CallExternalReference(ExternalReference ref,
1859 int num_arguments) { 1859 int num_arguments) {
1860 mov(eax, Immediate(num_arguments)); 1860 mov(eax, Immediate(num_arguments));
1861 mov(ebx, Immediate(ref)); 1861 mov(ebx, Immediate(ref));
1862 1862
1863 CEntryStub stub(isolate(), 1); 1863 CEntryStub stub(isolate(), 1);
1864 CallStub(&stub); 1864 CallStub(&stub);
1865 } 1865 }
1866 1866
1867 1867
1868 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, 1868 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) {
1869 int num_arguments) { 1869 // ----------- S t a t e -------------
1870 // TODO(1236192): Most runtime routines don't need the number of 1870 // -- esp[0] : return address
1871 // arguments passed in because it is constant. At some point we 1871 // -- esp[8] : argument num_arguments - 1
1872 // should remove this need and make the runtime routine entry code 1872 // ...
1873 // smarter. 1873 // -- esp[8 * num_arguments] : argument 0 (receiver)
1874 Move(eax, Immediate(num_arguments)); 1874 //
1875 JumpToExternalReference(ext); 1875 // For runtime functions with variable arguments:
1876 // -- eax : number of arguments
1877 // -----------------------------------
1878
1879 const Runtime::Function* function = Runtime::FunctionForId(fid);
1880 DCHECK_EQ(1, function->result_size);
1881 if (function->nargs >= 0) {
1882 // TODO(1236192): Most runtime routines don't need the number of
1883 // arguments passed in because it is constant. At some point we
1884 // should remove this need and make the runtime routine entry code
1885 // smarter.
1886 mov(eax, Immediate(function->nargs));
1887 }
1888 JumpToExternalReference(ExternalReference(fid, isolate()));
1876 } 1889 }
1877 1890
1878 1891
1879 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid,
1880 int num_arguments) {
1881 TailCallExternalReference(ExternalReference(fid, isolate()), num_arguments);
1882 }
1883
1884
1885 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) { 1892 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) {
1886 // Set the entry point and jump to the C entry runtime stub. 1893 // Set the entry point and jump to the C entry runtime stub.
1887 mov(ebx, Immediate(ext)); 1894 mov(ebx, Immediate(ext));
1888 CEntryStub ces(isolate(), 1); 1895 CEntryStub ces(isolate(), 1);
1889 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); 1896 jmp(ces.GetCode(), RelocInfo::CODE_TARGET);
1890 } 1897 }
1891 1898
1892 1899
1893 void MacroAssembler::InvokePrologue(const ParameterCount& expected, 1900 void MacroAssembler::InvokePrologue(const ParameterCount& expected,
1894 const ParameterCount& actual, 1901 const ParameterCount& actual,
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
2961 mov(eax, dividend); 2968 mov(eax, dividend);
2962 shr(eax, 31); 2969 shr(eax, 31);
2963 add(edx, eax); 2970 add(edx, eax);
2964 } 2971 }
2965 2972
2966 2973
2967 } // namespace internal 2974 } // namespace internal
2968 } // namespace v8 2975 } // namespace v8
2969 2976
2970 #endif // V8_TARGET_ARCH_X87 2977 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/macro-assembler-x87.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698