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_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
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 1882 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1893 void MacroAssembler::CallExternalReference(ExternalReference ref, | 1893 void MacroAssembler::CallExternalReference(ExternalReference ref, |
1894 int num_arguments) { | 1894 int num_arguments) { |
1895 mov(eax, Immediate(num_arguments)); | 1895 mov(eax, Immediate(num_arguments)); |
1896 mov(ebx, Immediate(ref)); | 1896 mov(ebx, Immediate(ref)); |
1897 | 1897 |
1898 CEntryStub stub(isolate(), 1); | 1898 CEntryStub stub(isolate(), 1); |
1899 CallStub(&stub); | 1899 CallStub(&stub); |
1900 } | 1900 } |
1901 | 1901 |
1902 | 1902 |
1903 void MacroAssembler::TailCallExternalReference(const ExternalReference& ext, | 1903 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { |
1904 int num_arguments) { | 1904 // ----------- S t a t e ------------- |
Igor Sheludko
2015/12/30 14:48:17
Probably we don't need this comment here as all th
| |
1905 // TODO(1236192): Most runtime routines don't need the number of | 1905 // -- esp[0] : return address |
1906 // arguments passed in because it is constant. At some point we | 1906 // -- esp[8] : argument num_arguments - 1 |
1907 // should remove this need and make the runtime routine entry code | 1907 // ... |
1908 // smarter. | 1908 // -- esp[8 * num_arguments] : argument 0 (receiver) |
1909 Move(eax, Immediate(num_arguments)); | 1909 // |
1910 JumpToExternalReference(ext); | 1910 // For runtime functions with variable arguments: |
1911 // -- eax : number of arguments | |
1912 // ----------------------------------- | |
1913 | |
1914 const Runtime::Function* function = Runtime::FunctionForId(fid); | |
1915 DCHECK_EQ(1, function->result_size); | |
1916 if (function->nargs >= 0) { | |
1917 // TODO(1236192): Most runtime routines don't need the number of | |
1918 // arguments passed in because it is constant. At some point we | |
1919 // should remove this need and make the runtime routine entry code | |
1920 // smarter. | |
1921 mov(eax, Immediate(function->nargs)); | |
1922 } | |
1923 JumpToExternalReference(ExternalReference(fid, isolate())); | |
1911 } | 1924 } |
1912 | 1925 |
1913 | 1926 |
1914 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid, | |
1915 int num_arguments) { | |
1916 TailCallExternalReference(ExternalReference(fid, isolate()), num_arguments); | |
1917 } | |
1918 | |
1919 | |
1920 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) { | 1927 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) { |
1921 // Set the entry point and jump to the C entry runtime stub. | 1928 // Set the entry point and jump to the C entry runtime stub. |
1922 mov(ebx, Immediate(ext)); | 1929 mov(ebx, Immediate(ext)); |
1923 CEntryStub ces(isolate(), 1); | 1930 CEntryStub ces(isolate(), 1); |
1924 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); | 1931 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); |
1925 } | 1932 } |
1926 | 1933 |
1927 | 1934 |
1928 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 1935 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
1929 const ParameterCount& actual, | 1936 const ParameterCount& actual, |
(...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3089 mov(eax, dividend); | 3096 mov(eax, dividend); |
3090 shr(eax, 31); | 3097 shr(eax, 31); |
3091 add(edx, eax); | 3098 add(edx, eax); |
3092 } | 3099 } |
3093 | 3100 |
3094 | 3101 |
3095 } // namespace internal | 3102 } // namespace internal |
3096 } // namespace v8 | 3103 } // namespace v8 |
3097 | 3104 |
3098 #endif // V8_TARGET_ARCH_IA32 | 3105 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |