| 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_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 1869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1880 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) { | 1880 void MacroAssembler::JumpToExternalReference(const ExternalReference& ext) { |
| 1881 // Set the entry point and jump to the C entry runtime stub. | 1881 // Set the entry point and jump to the C entry runtime stub. |
| 1882 mov(ebx, Immediate(ext)); | 1882 mov(ebx, Immediate(ext)); |
| 1883 CEntryStub ces(isolate(), 1); | 1883 CEntryStub ces(isolate(), 1); |
| 1884 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); | 1884 jmp(ces.GetCode(), RelocInfo::CODE_TARGET); |
| 1885 } | 1885 } |
| 1886 | 1886 |
| 1887 | 1887 |
| 1888 void MacroAssembler::InvokePrologue(const ParameterCount& expected, | 1888 void MacroAssembler::InvokePrologue(const ParameterCount& expected, |
| 1889 const ParameterCount& actual, | 1889 const ParameterCount& actual, |
| 1890 Handle<Code> code_constant, | |
| 1891 const Operand& code_operand, | |
| 1892 Label* done, | 1890 Label* done, |
| 1893 bool* definitely_mismatches, | 1891 bool* definitely_mismatches, |
| 1894 InvokeFlag flag, | 1892 InvokeFlag flag, |
| 1895 Label::Distance done_near, | 1893 Label::Distance done_near, |
| 1896 const CallWrapper& call_wrapper) { | 1894 const CallWrapper& call_wrapper) { |
| 1897 bool definitely_matches = false; | 1895 bool definitely_matches = false; |
| 1898 *definitely_mismatches = false; | 1896 *definitely_mismatches = false; |
| 1899 Label invoke; | 1897 Label invoke; |
| 1900 if (expected.is_immediate()) { | 1898 if (expected.is_immediate()) { |
| 1901 DCHECK(actual.is_immediate()); | 1899 DCHECK(actual.is_immediate()); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 1932 DCHECK(actual.reg().is(eax)); | 1930 DCHECK(actual.reg().is(eax)); |
| 1933 DCHECK(expected.reg().is(ebx)); | 1931 DCHECK(expected.reg().is(ebx)); |
| 1934 } else { | 1932 } else { |
| 1935 Move(eax, actual.reg()); | 1933 Move(eax, actual.reg()); |
| 1936 } | 1934 } |
| 1937 } | 1935 } |
| 1938 | 1936 |
| 1939 if (!definitely_matches) { | 1937 if (!definitely_matches) { |
| 1940 Handle<Code> adaptor = | 1938 Handle<Code> adaptor = |
| 1941 isolate()->builtins()->ArgumentsAdaptorTrampoline(); | 1939 isolate()->builtins()->ArgumentsAdaptorTrampoline(); |
| 1942 if (!code_constant.is_null()) { | |
| 1943 mov(edx, Immediate(code_constant)); | |
| 1944 add(edx, Immediate(Code::kHeaderSize - kHeapObjectTag)); | |
| 1945 } else if (!code_operand.is_reg(edx)) { | |
| 1946 mov(edx, code_operand); | |
| 1947 } | |
| 1948 | |
| 1949 if (flag == CALL_FUNCTION) { | 1940 if (flag == CALL_FUNCTION) { |
| 1950 call_wrapper.BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET)); | 1941 call_wrapper.BeforeCall(CallSize(adaptor, RelocInfo::CODE_TARGET)); |
| 1951 call(adaptor, RelocInfo::CODE_TARGET); | 1942 call(adaptor, RelocInfo::CODE_TARGET); |
| 1952 call_wrapper.AfterCall(); | 1943 call_wrapper.AfterCall(); |
| 1953 if (!*definitely_mismatches) { | 1944 if (!*definitely_mismatches) { |
| 1954 jmp(done, done_near); | 1945 jmp(done, done_near); |
| 1955 } | 1946 } |
| 1956 } else { | 1947 } else { |
| 1957 jmp(adaptor, RelocInfo::CODE_TARGET); | 1948 jmp(adaptor, RelocInfo::CODE_TARGET); |
| 1958 } | 1949 } |
| 1959 bind(&invoke); | 1950 bind(&invoke); |
| 1960 } | 1951 } |
| 1961 } | 1952 } |
| 1962 | 1953 |
| 1963 | 1954 |
| 1964 void MacroAssembler::InvokeCode(const Operand& code, | 1955 void MacroAssembler::InvokeCode(const Operand& code, |
| 1965 const ParameterCount& expected, | 1956 const ParameterCount& expected, |
| 1966 const ParameterCount& actual, | 1957 const ParameterCount& actual, |
| 1967 InvokeFlag flag, | 1958 InvokeFlag flag, |
| 1968 const CallWrapper& call_wrapper) { | 1959 const CallWrapper& call_wrapper) { |
| 1969 // You can't call a function without a valid frame. | 1960 // You can't call a function without a valid frame. |
| 1970 DCHECK(flag == JUMP_FUNCTION || has_frame()); | 1961 DCHECK(flag == JUMP_FUNCTION || has_frame()); |
| 1971 | 1962 |
| 1972 Label done; | 1963 Label done; |
| 1973 bool definitely_mismatches = false; | 1964 bool definitely_mismatches = false; |
| 1974 InvokePrologue(expected, actual, Handle<Code>::null(), code, | 1965 InvokePrologue(expected, actual, &done, &definitely_mismatches, flag, |
| 1975 &done, &definitely_mismatches, flag, Label::kNear, | 1966 Label::kNear, call_wrapper); |
| 1976 call_wrapper); | |
| 1977 if (!definitely_mismatches) { | 1967 if (!definitely_mismatches) { |
| 1978 if (flag == CALL_FUNCTION) { | 1968 if (flag == CALL_FUNCTION) { |
| 1979 call_wrapper.BeforeCall(CallSize(code)); | 1969 call_wrapper.BeforeCall(CallSize(code)); |
| 1980 call(code); | 1970 call(code); |
| 1981 call_wrapper.AfterCall(); | 1971 call_wrapper.AfterCall(); |
| 1982 } else { | 1972 } else { |
| 1983 DCHECK(flag == JUMP_FUNCTION); | 1973 DCHECK(flag == JUMP_FUNCTION); |
| 1984 jmp(code); | 1974 jmp(code); |
| 1985 } | 1975 } |
| 1986 bind(&done); | 1976 bind(&done); |
| (...skipping 1034 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3021 mov(eax, dividend); | 3011 mov(eax, dividend); |
| 3022 shr(eax, 31); | 3012 shr(eax, 31); |
| 3023 add(edx, eax); | 3013 add(edx, eax); |
| 3024 } | 3014 } |
| 3025 | 3015 |
| 3026 | 3016 |
| 3027 } // namespace internal | 3017 } // namespace internal |
| 3028 } // namespace v8 | 3018 } // namespace v8 |
| 3029 | 3019 |
| 3030 #endif // V8_TARGET_ARCH_X87 | 3020 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |