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

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

Issue 1335453002: X87: [calls] Consistent call protocol for calls. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/x87/lithium-codegen-x87.cc ('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 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 Label* done, 1863 Label* done,
1864 bool* definitely_mismatches, 1864 bool* definitely_mismatches,
1865 InvokeFlag flag, 1865 InvokeFlag flag,
1866 Label::Distance done_near, 1866 Label::Distance done_near,
1867 const CallWrapper& call_wrapper) { 1867 const CallWrapper& call_wrapper) {
1868 bool definitely_matches = false; 1868 bool definitely_matches = false;
1869 *definitely_mismatches = false; 1869 *definitely_mismatches = false;
1870 Label invoke; 1870 Label invoke;
1871 if (expected.is_immediate()) { 1871 if (expected.is_immediate()) {
1872 DCHECK(actual.is_immediate()); 1872 DCHECK(actual.is_immediate());
1873 mov(eax, actual.immediate());
1873 if (expected.immediate() == actual.immediate()) { 1874 if (expected.immediate() == actual.immediate()) {
1874 definitely_matches = true; 1875 definitely_matches = true;
1875 } else { 1876 } else {
1876 mov(eax, actual.immediate());
1877 const int sentinel = SharedFunctionInfo::kDontAdaptArgumentsSentinel; 1877 const int sentinel = SharedFunctionInfo::kDontAdaptArgumentsSentinel;
1878 if (expected.immediate() == sentinel) { 1878 if (expected.immediate() == sentinel) {
1879 // Don't worry about adapting arguments for builtins that 1879 // Don't worry about adapting arguments for builtins that
1880 // don't want that done. Skip adaption code by making it look 1880 // don't want that done. Skip adaption code by making it look
1881 // like we have a match between expected and actual number of 1881 // like we have a match between expected and actual number of
1882 // arguments. 1882 // arguments.
1883 definitely_matches = true; 1883 definitely_matches = true;
1884 } else { 1884 } else {
1885 *definitely_mismatches = true; 1885 *definitely_mismatches = true;
1886 mov(ebx, expected.immediate()); 1886 mov(ebx, expected.immediate());
1887 } 1887 }
1888 } 1888 }
1889 } else { 1889 } else {
1890 if (actual.is_immediate()) { 1890 if (actual.is_immediate()) {
1891 // Expected is in register, actual is immediate. This is the 1891 // Expected is in register, actual is immediate. This is the
1892 // case when we invoke function values without going through the 1892 // case when we invoke function values without going through the
1893 // IC mechanism. 1893 // IC mechanism.
1894 mov(eax, actual.immediate());
1894 cmp(expected.reg(), actual.immediate()); 1895 cmp(expected.reg(), actual.immediate());
1895 j(equal, &invoke); 1896 j(equal, &invoke);
1896 DCHECK(expected.reg().is(ebx)); 1897 DCHECK(expected.reg().is(ebx));
1897 mov(eax, actual.immediate());
1898 } else if (!expected.reg().is(actual.reg())) { 1898 } else if (!expected.reg().is(actual.reg())) {
1899 // Both expected and actual are in (different) registers. This 1899 // Both expected and actual are in (different) registers. This
1900 // is the case when we invoke functions using call and apply. 1900 // is the case when we invoke functions using call and apply.
1901 cmp(expected.reg(), actual.reg()); 1901 cmp(expected.reg(), actual.reg());
1902 j(equal, &invoke); 1902 j(equal, &invoke);
1903 DCHECK(actual.reg().is(eax)); 1903 DCHECK(actual.reg().is(eax));
1904 DCHECK(expected.reg().is(ebx)); 1904 DCHECK(expected.reg().is(ebx));
1905 } else {
1906 Move(eax, actual.reg());
1905 } 1907 }
1906 } 1908 }
1907 1909
1908 if (!definitely_matches) { 1910 if (!definitely_matches) {
1909 Handle<Code> adaptor = 1911 Handle<Code> adaptor =
1910 isolate()->builtins()->ArgumentsAdaptorTrampoline(); 1912 isolate()->builtins()->ArgumentsAdaptorTrampoline();
1911 if (!code_constant.is_null()) { 1913 if (!code_constant.is_null()) {
1912 mov(edx, Immediate(code_constant)); 1914 mov(edx, Immediate(code_constant));
1913 add(edx, Immediate(Code::kHeaderSize - kHeapObjectTag)); 1915 add(edx, Immediate(Code::kHeaderSize - kHeapObjectTag));
1914 } else if (!code_operand.is_reg(edx)) { 1916 } else if (!code_operand.is_reg(edx)) {
(...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after
3040 mov(eax, dividend); 3042 mov(eax, dividend);
3041 shr(eax, 31); 3043 shr(eax, 31);
3042 add(edx, eax); 3044 add(edx, eax);
3043 } 3045 }
3044 3046
3045 3047
3046 } // namespace internal 3048 } // namespace internal
3047 } // namespace v8 3049 } // namespace v8
3048 3050
3049 #endif // V8_TARGET_ARCH_X87 3051 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/lithium-codegen-x87.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698