| 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 1905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1916 Label* done, | 1916 Label* done, |
| 1917 bool* definitely_mismatches, | 1917 bool* definitely_mismatches, |
| 1918 InvokeFlag flag, | 1918 InvokeFlag flag, |
| 1919 Label::Distance done_near, | 1919 Label::Distance done_near, |
| 1920 const CallWrapper& call_wrapper) { | 1920 const CallWrapper& call_wrapper) { |
| 1921 bool definitely_matches = false; | 1921 bool definitely_matches = false; |
| 1922 *definitely_mismatches = false; | 1922 *definitely_mismatches = false; |
| 1923 Label invoke; | 1923 Label invoke; |
| 1924 if (expected.is_immediate()) { | 1924 if (expected.is_immediate()) { |
| 1925 DCHECK(actual.is_immediate()); | 1925 DCHECK(actual.is_immediate()); |
| 1926 mov(eax, actual.immediate()); |
| 1926 if (expected.immediate() == actual.immediate()) { | 1927 if (expected.immediate() == actual.immediate()) { |
| 1927 definitely_matches = true; | 1928 definitely_matches = true; |
| 1928 } else { | 1929 } else { |
| 1929 mov(eax, actual.immediate()); | |
| 1930 const int sentinel = SharedFunctionInfo::kDontAdaptArgumentsSentinel; | 1930 const int sentinel = SharedFunctionInfo::kDontAdaptArgumentsSentinel; |
| 1931 if (expected.immediate() == sentinel) { | 1931 if (expected.immediate() == sentinel) { |
| 1932 // Don't worry about adapting arguments for builtins that | 1932 // Don't worry about adapting arguments for builtins that |
| 1933 // don't want that done. Skip adaption code by making it look | 1933 // don't want that done. Skip adaption code by making it look |
| 1934 // like we have a match between expected and actual number of | 1934 // like we have a match between expected and actual number of |
| 1935 // arguments. | 1935 // arguments. |
| 1936 definitely_matches = true; | 1936 definitely_matches = true; |
| 1937 } else { | 1937 } else { |
| 1938 *definitely_mismatches = true; | 1938 *definitely_mismatches = true; |
| 1939 mov(ebx, expected.immediate()); | 1939 mov(ebx, expected.immediate()); |
| 1940 } | 1940 } |
| 1941 } | 1941 } |
| 1942 } else { | 1942 } else { |
| 1943 if (actual.is_immediate()) { | 1943 if (actual.is_immediate()) { |
| 1944 // Expected is in register, actual is immediate. This is the | 1944 // Expected is in register, actual is immediate. This is the |
| 1945 // case when we invoke function values without going through the | 1945 // case when we invoke function values without going through the |
| 1946 // IC mechanism. | 1946 // IC mechanism. |
| 1947 mov(eax, actual.immediate()); |
| 1947 cmp(expected.reg(), actual.immediate()); | 1948 cmp(expected.reg(), actual.immediate()); |
| 1948 j(equal, &invoke); | 1949 j(equal, &invoke); |
| 1949 DCHECK(expected.reg().is(ebx)); | 1950 DCHECK(expected.reg().is(ebx)); |
| 1950 mov(eax, actual.immediate()); | |
| 1951 } else if (!expected.reg().is(actual.reg())) { | 1951 } else if (!expected.reg().is(actual.reg())) { |
| 1952 // Both expected and actual are in (different) registers. This | 1952 // Both expected and actual are in (different) registers. This |
| 1953 // is the case when we invoke functions using call and apply. | 1953 // is the case when we invoke functions using call and apply. |
| 1954 cmp(expected.reg(), actual.reg()); | 1954 cmp(expected.reg(), actual.reg()); |
| 1955 j(equal, &invoke); | 1955 j(equal, &invoke); |
| 1956 DCHECK(actual.reg().is(eax)); | 1956 DCHECK(actual.reg().is(eax)); |
| 1957 DCHECK(expected.reg().is(ebx)); | 1957 DCHECK(expected.reg().is(ebx)); |
| 1958 } else { |
| 1959 Move(eax, actual.reg()); |
| 1958 } | 1960 } |
| 1959 } | 1961 } |
| 1960 | 1962 |
| 1961 if (!definitely_matches) { | 1963 if (!definitely_matches) { |
| 1962 Handle<Code> adaptor = | 1964 Handle<Code> adaptor = |
| 1963 isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 1965 isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 1964 if (!code_constant.is_null()) { | 1966 if (!code_constant.is_null()) { |
| 1965 mov(edx, Immediate(code_constant)); | 1967 mov(edx, Immediate(code_constant)); |
| 1966 add(edx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | 1968 add(edx, Immediate(Code::kHeaderSize - kHeapObjectTag)); |
| 1967 } else if (!code_operand.is_reg(edx)) { | 1969 } else if (!code_operand.is_reg(edx)) { |
| (...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3187 mov(eax, dividend); | 3189 mov(eax, dividend); |
| 3188 shr(eax, 31); | 3190 shr(eax, 31); |
| 3189 add(edx, eax); | 3191 add(edx, eax); |
| 3190 } | 3192 } |
| 3191 | 3193 |
| 3192 | 3194 |
| 3193 } // namespace internal | 3195 } // namespace internal |
| 3194 } // namespace v8 | 3196 } // namespace v8 |
| 3195 | 3197 |
| 3196 #endif // V8_TARGET_ARCH_IA32 | 3198 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |