OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
6 // are met: | 6 // are met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 18 matching lines...) Expand all Loading... |
29 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 29 // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 30 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
31 // OF THE POSSIBILITY OF SUCH DAMAGE. | 31 // OF THE POSSIBILITY OF SUCH DAMAGE. |
32 | 32 |
33 // The original source code covered by the above license above has been modified | 33 // The original source code covered by the above license above has been modified |
34 // significantly by Google Inc. | 34 // significantly by Google Inc. |
35 // Copyright 2012 the V8 project authors. All rights reserved. | 35 // Copyright 2012 the V8 project authors. All rights reserved. |
36 | 36 |
37 #include "v8.h" | 37 #include "v8.h" |
38 | 38 |
39 #if V8_TARGET_ARCH_IA32 | 39 #if V8_TARGET_ARCH_X87 |
40 | 40 |
41 #include "disassembler.h" | 41 #include "disassembler.h" |
42 #include "macro-assembler.h" | 42 #include "macro-assembler.h" |
43 #include "serialize.h" | 43 #include "serialize.h" |
44 | 44 |
45 namespace v8 { | 45 namespace v8 { |
46 namespace internal { | 46 namespace internal { |
47 | 47 |
48 // ----------------------------------------------------------------------------- | 48 // ----------------------------------------------------------------------------- |
49 // Implementation of CpuFeatures | 49 // Implementation of CpuFeatures |
50 | 50 |
51 void CpuFeatures::ProbeImpl(bool cross_compile) { | 51 void CpuFeatures::ProbeImpl(bool cross_compile) { |
52 CPU cpu; | 52 CPU cpu; |
53 CHECK(cpu.has_sse2()); // SSE2 support is mandatory. | 53 // SAHF must be available in compat/legacy mode. |
54 CHECK(cpu.has_cmov()); // CMOV support is mandatory. | 54 CHECK(cpu.has_sahf()); |
| 55 supported_ |= 1u << SAHF; |
55 supported_ |= OS::CpuFeaturesImpliedByPlatform(); | 56 supported_ |= OS::CpuFeaturesImpliedByPlatform(); |
56 | 57 |
57 // Only use statically determined features for cross compile (snapshot). | 58 // Only use statically determined features for cross compile (snapshot). |
58 if (cross_compile) return; | 59 if (cross_compile) return; |
59 | |
60 if (cpu.has_sse41() && FLAG_enable_sse4_1) supported_ |= 1u << SSE4_1; | |
61 if (cpu.has_sse3() && FLAG_enable_sse3) supported_ |= 1u << SSE3; | |
62 } | 60 } |
63 | 61 |
64 | 62 |
65 void CpuFeatures::PrintTarget() { } | 63 void CpuFeatures::PrintTarget() { } |
66 void CpuFeatures::PrintFeatures() { } | 64 void CpuFeatures::PrintFeatures() { } |
67 | 65 |
68 | 66 |
69 // ----------------------------------------------------------------------------- | 67 // ----------------------------------------------------------------------------- |
70 // Implementation of Displacement | 68 // Implementation of Displacement |
71 | 69 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 while (*a == 0x66) a++; | 281 while (*a == 0x66) a++; |
284 if (*a == 0x90) return true; | 282 if (*a == 0x90) return true; |
285 if (a[0] == 0xf && a[1] == 0x1f) return true; | 283 if (a[0] == 0xf && a[1] == 0x1f) return true; |
286 return false; | 284 return false; |
287 } | 285 } |
288 | 286 |
289 | 287 |
290 void Assembler::Nop(int bytes) { | 288 void Assembler::Nop(int bytes) { |
291 EnsureSpace ensure_space(this); | 289 EnsureSpace ensure_space(this); |
292 | 290 |
293 // Multi byte nops from http://support.amd.com/us/Processor_TechDocs/40546.pdf | 291 // Older CPUs that do not support SSE2 may not support multibyte NOP |
294 while (bytes > 0) { | 292 // instructions. |
295 switch (bytes) { | 293 for (; bytes > 0; bytes--) { |
296 case 2: | 294 EMIT(0x90); |
297 EMIT(0x66); | |
298 case 1: | |
299 EMIT(0x90); | |
300 return; | |
301 case 3: | |
302 EMIT(0xf); | |
303 EMIT(0x1f); | |
304 EMIT(0); | |
305 return; | |
306 case 4: | |
307 EMIT(0xf); | |
308 EMIT(0x1f); | |
309 EMIT(0x40); | |
310 EMIT(0); | |
311 return; | |
312 case 6: | |
313 EMIT(0x66); | |
314 case 5: | |
315 EMIT(0xf); | |
316 EMIT(0x1f); | |
317 EMIT(0x44); | |
318 EMIT(0); | |
319 EMIT(0); | |
320 return; | |
321 case 7: | |
322 EMIT(0xf); | |
323 EMIT(0x1f); | |
324 EMIT(0x80); | |
325 EMIT(0); | |
326 EMIT(0); | |
327 EMIT(0); | |
328 EMIT(0); | |
329 return; | |
330 default: | |
331 case 11: | |
332 EMIT(0x66); | |
333 bytes--; | |
334 case 10: | |
335 EMIT(0x66); | |
336 bytes--; | |
337 case 9: | |
338 EMIT(0x66); | |
339 bytes--; | |
340 case 8: | |
341 EMIT(0xf); | |
342 EMIT(0x1f); | |
343 EMIT(0x84); | |
344 EMIT(0); | |
345 EMIT(0); | |
346 EMIT(0); | |
347 EMIT(0); | |
348 EMIT(0); | |
349 bytes -= 8; | |
350 } | |
351 } | 295 } |
| 296 return; |
352 } | 297 } |
353 | 298 |
354 | 299 |
355 void Assembler::CodeTargetAlign() { | 300 void Assembler::CodeTargetAlign() { |
356 Align(16); // Preferred alignment of jump targets on ia32. | 301 Align(16); // Preferred alignment of jump targets on ia32. |
357 } | 302 } |
358 | 303 |
359 | 304 |
360 void Assembler::cpuid() { | 305 void Assembler::cpuid() { |
361 EnsureSpace ensure_space(this); | 306 EnsureSpace ensure_space(this); |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
581 | 526 |
582 | 527 |
583 void Assembler::movzx_w(Register dst, const Operand& src) { | 528 void Assembler::movzx_w(Register dst, const Operand& src) { |
584 EnsureSpace ensure_space(this); | 529 EnsureSpace ensure_space(this); |
585 EMIT(0x0F); | 530 EMIT(0x0F); |
586 EMIT(0xB7); | 531 EMIT(0xB7); |
587 emit_operand(dst, src); | 532 emit_operand(dst, src); |
588 } | 533 } |
589 | 534 |
590 | 535 |
591 void Assembler::cmov(Condition cc, Register dst, const Operand& src) { | |
592 EnsureSpace ensure_space(this); | |
593 // Opcode: 0f 40 + cc /r. | |
594 EMIT(0x0F); | |
595 EMIT(0x40 + cc); | |
596 emit_operand(dst, src); | |
597 } | |
598 | |
599 | |
600 void Assembler::cld() { | 536 void Assembler::cld() { |
601 EnsureSpace ensure_space(this); | 537 EnsureSpace ensure_space(this); |
602 EMIT(0xFC); | 538 EMIT(0xFC); |
603 } | 539 } |
604 | 540 |
605 | 541 |
606 void Assembler::rep_movs() { | 542 void Assembler::rep_movs() { |
607 EnsureSpace ensure_space(this); | 543 EnsureSpace ensure_space(this); |
608 EMIT(0xF3); | 544 EMIT(0xF3); |
609 EMIT(0xA5); | 545 EMIT(0xA5); |
(...skipping 1264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1874 | 1810 |
1875 void Assembler::setcc(Condition cc, Register reg) { | 1811 void Assembler::setcc(Condition cc, Register reg) { |
1876 ASSERT(reg.is_byte_register()); | 1812 ASSERT(reg.is_byte_register()); |
1877 EnsureSpace ensure_space(this); | 1813 EnsureSpace ensure_space(this); |
1878 EMIT(0x0F); | 1814 EMIT(0x0F); |
1879 EMIT(0x90 | cc); | 1815 EMIT(0x90 | cc); |
1880 EMIT(0xC0 | reg.code()); | 1816 EMIT(0xC0 | reg.code()); |
1881 } | 1817 } |
1882 | 1818 |
1883 | 1819 |
1884 void Assembler::cvttss2si(Register dst, const Operand& src) { | |
1885 EnsureSpace ensure_space(this); | |
1886 EMIT(0xF3); | |
1887 EMIT(0x0F); | |
1888 EMIT(0x2C); | |
1889 emit_operand(dst, src); | |
1890 } | |
1891 | |
1892 | |
1893 void Assembler::cvttsd2si(Register dst, const Operand& src) { | |
1894 EnsureSpace ensure_space(this); | |
1895 EMIT(0xF2); | |
1896 EMIT(0x0F); | |
1897 EMIT(0x2C); | |
1898 emit_operand(dst, src); | |
1899 } | |
1900 | |
1901 | |
1902 void Assembler::cvtsd2si(Register dst, XMMRegister src) { | |
1903 EnsureSpace ensure_space(this); | |
1904 EMIT(0xF2); | |
1905 EMIT(0x0F); | |
1906 EMIT(0x2D); | |
1907 emit_sse_operand(dst, src); | |
1908 } | |
1909 | |
1910 | |
1911 void Assembler::cvtsi2sd(XMMRegister dst, const Operand& src) { | |
1912 EnsureSpace ensure_space(this); | |
1913 EMIT(0xF2); | |
1914 EMIT(0x0F); | |
1915 EMIT(0x2A); | |
1916 emit_sse_operand(dst, src); | |
1917 } | |
1918 | |
1919 | |
1920 void Assembler::cvtss2sd(XMMRegister dst, XMMRegister src) { | |
1921 EnsureSpace ensure_space(this); | |
1922 EMIT(0xF3); | |
1923 EMIT(0x0F); | |
1924 EMIT(0x5A); | |
1925 emit_sse_operand(dst, src); | |
1926 } | |
1927 | |
1928 | |
1929 void Assembler::cvtsd2ss(XMMRegister dst, XMMRegister src) { | |
1930 EnsureSpace ensure_space(this); | |
1931 EMIT(0xF2); | |
1932 EMIT(0x0F); | |
1933 EMIT(0x5A); | |
1934 emit_sse_operand(dst, src); | |
1935 } | |
1936 | |
1937 | |
1938 void Assembler::addsd(XMMRegister dst, XMMRegister src) { | |
1939 EnsureSpace ensure_space(this); | |
1940 EMIT(0xF2); | |
1941 EMIT(0x0F); | |
1942 EMIT(0x58); | |
1943 emit_sse_operand(dst, src); | |
1944 } | |
1945 | |
1946 | |
1947 void Assembler::addsd(XMMRegister dst, const Operand& src) { | |
1948 EnsureSpace ensure_space(this); | |
1949 EMIT(0xF2); | |
1950 EMIT(0x0F); | |
1951 EMIT(0x58); | |
1952 emit_sse_operand(dst, src); | |
1953 } | |
1954 | |
1955 | |
1956 void Assembler::mulsd(XMMRegister dst, XMMRegister src) { | |
1957 EnsureSpace ensure_space(this); | |
1958 EMIT(0xF2); | |
1959 EMIT(0x0F); | |
1960 EMIT(0x59); | |
1961 emit_sse_operand(dst, src); | |
1962 } | |
1963 | |
1964 | |
1965 void Assembler::mulsd(XMMRegister dst, const Operand& src) { | |
1966 EnsureSpace ensure_space(this); | |
1967 EMIT(0xF2); | |
1968 EMIT(0x0F); | |
1969 EMIT(0x59); | |
1970 emit_sse_operand(dst, src); | |
1971 } | |
1972 | |
1973 | |
1974 void Assembler::subsd(XMMRegister dst, XMMRegister src) { | |
1975 EnsureSpace ensure_space(this); | |
1976 EMIT(0xF2); | |
1977 EMIT(0x0F); | |
1978 EMIT(0x5C); | |
1979 emit_sse_operand(dst, src); | |
1980 } | |
1981 | |
1982 | |
1983 void Assembler::divsd(XMMRegister dst, XMMRegister src) { | |
1984 EnsureSpace ensure_space(this); | |
1985 EMIT(0xF2); | |
1986 EMIT(0x0F); | |
1987 EMIT(0x5E); | |
1988 emit_sse_operand(dst, src); | |
1989 } | |
1990 | |
1991 | |
1992 void Assembler::xorpd(XMMRegister dst, XMMRegister src) { | |
1993 EnsureSpace ensure_space(this); | |
1994 EMIT(0x66); | |
1995 EMIT(0x0F); | |
1996 EMIT(0x57); | |
1997 emit_sse_operand(dst, src); | |
1998 } | |
1999 | |
2000 | |
2001 void Assembler::andps(XMMRegister dst, const Operand& src) { | |
2002 EnsureSpace ensure_space(this); | |
2003 EMIT(0x0F); | |
2004 EMIT(0x54); | |
2005 emit_sse_operand(dst, src); | |
2006 } | |
2007 | |
2008 | |
2009 void Assembler::orps(XMMRegister dst, const Operand& src) { | |
2010 EnsureSpace ensure_space(this); | |
2011 EMIT(0x0F); | |
2012 EMIT(0x56); | |
2013 emit_sse_operand(dst, src); | |
2014 } | |
2015 | |
2016 | |
2017 void Assembler::xorps(XMMRegister dst, const Operand& src) { | |
2018 EnsureSpace ensure_space(this); | |
2019 EMIT(0x0F); | |
2020 EMIT(0x57); | |
2021 emit_sse_operand(dst, src); | |
2022 } | |
2023 | |
2024 | |
2025 void Assembler::addps(XMMRegister dst, const Operand& src) { | |
2026 EnsureSpace ensure_space(this); | |
2027 EMIT(0x0F); | |
2028 EMIT(0x58); | |
2029 emit_sse_operand(dst, src); | |
2030 } | |
2031 | |
2032 | |
2033 void Assembler::subps(XMMRegister dst, const Operand& src) { | |
2034 EnsureSpace ensure_space(this); | |
2035 EMIT(0x0F); | |
2036 EMIT(0x5C); | |
2037 emit_sse_operand(dst, src); | |
2038 } | |
2039 | |
2040 | |
2041 void Assembler::mulps(XMMRegister dst, const Operand& src) { | |
2042 EnsureSpace ensure_space(this); | |
2043 EMIT(0x0F); | |
2044 EMIT(0x59); | |
2045 emit_sse_operand(dst, src); | |
2046 } | |
2047 | |
2048 | |
2049 void Assembler::divps(XMMRegister dst, const Operand& src) { | |
2050 EnsureSpace ensure_space(this); | |
2051 EMIT(0x0F); | |
2052 EMIT(0x5E); | |
2053 emit_sse_operand(dst, src); | |
2054 } | |
2055 | |
2056 | |
2057 void Assembler::sqrtsd(XMMRegister dst, XMMRegister src) { | |
2058 EnsureSpace ensure_space(this); | |
2059 EMIT(0xF2); | |
2060 EMIT(0x0F); | |
2061 EMIT(0x51); | |
2062 emit_sse_operand(dst, src); | |
2063 } | |
2064 | |
2065 | |
2066 void Assembler::andpd(XMMRegister dst, XMMRegister src) { | |
2067 EnsureSpace ensure_space(this); | |
2068 EMIT(0x66); | |
2069 EMIT(0x0F); | |
2070 EMIT(0x54); | |
2071 emit_sse_operand(dst, src); | |
2072 } | |
2073 | |
2074 | |
2075 void Assembler::orpd(XMMRegister dst, XMMRegister src) { | |
2076 EnsureSpace ensure_space(this); | |
2077 EMIT(0x66); | |
2078 EMIT(0x0F); | |
2079 EMIT(0x56); | |
2080 emit_sse_operand(dst, src); | |
2081 } | |
2082 | |
2083 | |
2084 void Assembler::ucomisd(XMMRegister dst, const Operand& src) { | |
2085 EnsureSpace ensure_space(this); | |
2086 EMIT(0x66); | |
2087 EMIT(0x0F); | |
2088 EMIT(0x2E); | |
2089 emit_sse_operand(dst, src); | |
2090 } | |
2091 | |
2092 | |
2093 void Assembler::roundsd(XMMRegister dst, XMMRegister src, RoundingMode mode) { | |
2094 ASSERT(IsEnabled(SSE4_1)); | |
2095 EnsureSpace ensure_space(this); | |
2096 EMIT(0x66); | |
2097 EMIT(0x0F); | |
2098 EMIT(0x3A); | |
2099 EMIT(0x0B); | |
2100 emit_sse_operand(dst, src); | |
2101 // Mask precision exeption. | |
2102 EMIT(static_cast<byte>(mode) | 0x8); | |
2103 } | |
2104 | |
2105 | |
2106 void Assembler::movmskpd(Register dst, XMMRegister src) { | |
2107 EnsureSpace ensure_space(this); | |
2108 EMIT(0x66); | |
2109 EMIT(0x0F); | |
2110 EMIT(0x50); | |
2111 emit_sse_operand(dst, src); | |
2112 } | |
2113 | |
2114 | |
2115 void Assembler::movmskps(Register dst, XMMRegister src) { | |
2116 EnsureSpace ensure_space(this); | |
2117 EMIT(0x0F); | |
2118 EMIT(0x50); | |
2119 emit_sse_operand(dst, src); | |
2120 } | |
2121 | |
2122 | |
2123 void Assembler::pcmpeqd(XMMRegister dst, XMMRegister src) { | |
2124 EnsureSpace ensure_space(this); | |
2125 EMIT(0x66); | |
2126 EMIT(0x0F); | |
2127 EMIT(0x76); | |
2128 emit_sse_operand(dst, src); | |
2129 } | |
2130 | |
2131 | |
2132 void Assembler::cmpltsd(XMMRegister dst, XMMRegister src) { | |
2133 EnsureSpace ensure_space(this); | |
2134 EMIT(0xF2); | |
2135 EMIT(0x0F); | |
2136 EMIT(0xC2); | |
2137 emit_sse_operand(dst, src); | |
2138 EMIT(1); // LT == 1 | |
2139 } | |
2140 | |
2141 | |
2142 void Assembler::movaps(XMMRegister dst, XMMRegister src) { | |
2143 EnsureSpace ensure_space(this); | |
2144 EMIT(0x0F); | |
2145 EMIT(0x28); | |
2146 emit_sse_operand(dst, src); | |
2147 } | |
2148 | |
2149 | |
2150 void Assembler::shufps(XMMRegister dst, XMMRegister src, byte imm8) { | |
2151 ASSERT(is_uint8(imm8)); | |
2152 EnsureSpace ensure_space(this); | |
2153 EMIT(0x0F); | |
2154 EMIT(0xC6); | |
2155 emit_sse_operand(dst, src); | |
2156 EMIT(imm8); | |
2157 } | |
2158 | |
2159 | |
2160 void Assembler::movdqa(const Operand& dst, XMMRegister src) { | |
2161 EnsureSpace ensure_space(this); | |
2162 EMIT(0x66); | |
2163 EMIT(0x0F); | |
2164 EMIT(0x7F); | |
2165 emit_sse_operand(src, dst); | |
2166 } | |
2167 | |
2168 | |
2169 void Assembler::movdqa(XMMRegister dst, const Operand& src) { | |
2170 EnsureSpace ensure_space(this); | |
2171 EMIT(0x66); | |
2172 EMIT(0x0F); | |
2173 EMIT(0x6F); | |
2174 emit_sse_operand(dst, src); | |
2175 } | |
2176 | |
2177 | |
2178 void Assembler::movdqu(const Operand& dst, XMMRegister src ) { | |
2179 EnsureSpace ensure_space(this); | |
2180 EMIT(0xF3); | |
2181 EMIT(0x0F); | |
2182 EMIT(0x7F); | |
2183 emit_sse_operand(src, dst); | |
2184 } | |
2185 | |
2186 | |
2187 void Assembler::movdqu(XMMRegister dst, const Operand& src) { | |
2188 EnsureSpace ensure_space(this); | |
2189 EMIT(0xF3); | |
2190 EMIT(0x0F); | |
2191 EMIT(0x6F); | |
2192 emit_sse_operand(dst, src); | |
2193 } | |
2194 | |
2195 | |
2196 void Assembler::movntdqa(XMMRegister dst, const Operand& src) { | |
2197 ASSERT(IsEnabled(SSE4_1)); | |
2198 EnsureSpace ensure_space(this); | |
2199 EMIT(0x66); | |
2200 EMIT(0x0F); | |
2201 EMIT(0x38); | |
2202 EMIT(0x2A); | |
2203 emit_sse_operand(dst, src); | |
2204 } | |
2205 | |
2206 | |
2207 void Assembler::movntdq(const Operand& dst, XMMRegister src) { | |
2208 EnsureSpace ensure_space(this); | |
2209 EMIT(0x66); | |
2210 EMIT(0x0F); | |
2211 EMIT(0xE7); | |
2212 emit_sse_operand(src, dst); | |
2213 } | |
2214 | |
2215 | |
2216 void Assembler::prefetch(const Operand& src, int level) { | |
2217 ASSERT(is_uint2(level)); | |
2218 EnsureSpace ensure_space(this); | |
2219 EMIT(0x0F); | |
2220 EMIT(0x18); | |
2221 // Emit hint number in Reg position of RegR/M. | |
2222 XMMRegister code = XMMRegister::from_code(level); | |
2223 emit_sse_operand(code, src); | |
2224 } | |
2225 | |
2226 | |
2227 void Assembler::movsd(const Operand& dst, XMMRegister src ) { | |
2228 EnsureSpace ensure_space(this); | |
2229 EMIT(0xF2); // double | |
2230 EMIT(0x0F); | |
2231 EMIT(0x11); // store | |
2232 emit_sse_operand(src, dst); | |
2233 } | |
2234 | |
2235 | |
2236 void Assembler::movsd(XMMRegister dst, const Operand& src) { | |
2237 EnsureSpace ensure_space(this); | |
2238 EMIT(0xF2); // double | |
2239 EMIT(0x0F); | |
2240 EMIT(0x10); // load | |
2241 emit_sse_operand(dst, src); | |
2242 } | |
2243 | |
2244 | |
2245 void Assembler::movss(const Operand& dst, XMMRegister src ) { | |
2246 EnsureSpace ensure_space(this); | |
2247 EMIT(0xF3); // float | |
2248 EMIT(0x0F); | |
2249 EMIT(0x11); // store | |
2250 emit_sse_operand(src, dst); | |
2251 } | |
2252 | |
2253 | |
2254 void Assembler::movss(XMMRegister dst, const Operand& src) { | |
2255 EnsureSpace ensure_space(this); | |
2256 EMIT(0xF3); // float | |
2257 EMIT(0x0F); | |
2258 EMIT(0x10); // load | |
2259 emit_sse_operand(dst, src); | |
2260 } | |
2261 | |
2262 | |
2263 void Assembler::movd(XMMRegister dst, const Operand& src) { | |
2264 EnsureSpace ensure_space(this); | |
2265 EMIT(0x66); | |
2266 EMIT(0x0F); | |
2267 EMIT(0x6E); | |
2268 emit_sse_operand(dst, src); | |
2269 } | |
2270 | |
2271 | |
2272 void Assembler::movd(const Operand& dst, XMMRegister src) { | |
2273 EnsureSpace ensure_space(this); | |
2274 EMIT(0x66); | |
2275 EMIT(0x0F); | |
2276 EMIT(0x7E); | |
2277 emit_sse_operand(src, dst); | |
2278 } | |
2279 | |
2280 | |
2281 void Assembler::extractps(Register dst, XMMRegister src, byte imm8) { | |
2282 ASSERT(IsEnabled(SSE4_1)); | |
2283 ASSERT(is_uint8(imm8)); | |
2284 EnsureSpace ensure_space(this); | |
2285 EMIT(0x66); | |
2286 EMIT(0x0F); | |
2287 EMIT(0x3A); | |
2288 EMIT(0x17); | |
2289 emit_sse_operand(src, dst); | |
2290 EMIT(imm8); | |
2291 } | |
2292 | |
2293 | |
2294 void Assembler::pand(XMMRegister dst, XMMRegister src) { | |
2295 EnsureSpace ensure_space(this); | |
2296 EMIT(0x66); | |
2297 EMIT(0x0F); | |
2298 EMIT(0xDB); | |
2299 emit_sse_operand(dst, src); | |
2300 } | |
2301 | |
2302 | |
2303 void Assembler::pxor(XMMRegister dst, XMMRegister src) { | |
2304 EnsureSpace ensure_space(this); | |
2305 EMIT(0x66); | |
2306 EMIT(0x0F); | |
2307 EMIT(0xEF); | |
2308 emit_sse_operand(dst, src); | |
2309 } | |
2310 | |
2311 | |
2312 void Assembler::por(XMMRegister dst, XMMRegister src) { | |
2313 EnsureSpace ensure_space(this); | |
2314 EMIT(0x66); | |
2315 EMIT(0x0F); | |
2316 EMIT(0xEB); | |
2317 emit_sse_operand(dst, src); | |
2318 } | |
2319 | |
2320 | |
2321 void Assembler::ptest(XMMRegister dst, XMMRegister src) { | |
2322 ASSERT(IsEnabled(SSE4_1)); | |
2323 EnsureSpace ensure_space(this); | |
2324 EMIT(0x66); | |
2325 EMIT(0x0F); | |
2326 EMIT(0x38); | |
2327 EMIT(0x17); | |
2328 emit_sse_operand(dst, src); | |
2329 } | |
2330 | |
2331 | |
2332 void Assembler::psllq(XMMRegister reg, int8_t shift) { | |
2333 EnsureSpace ensure_space(this); | |
2334 EMIT(0x66); | |
2335 EMIT(0x0F); | |
2336 EMIT(0x73); | |
2337 emit_sse_operand(esi, reg); // esi == 6 | |
2338 EMIT(shift); | |
2339 } | |
2340 | |
2341 | |
2342 void Assembler::psllq(XMMRegister dst, XMMRegister src) { | |
2343 EnsureSpace ensure_space(this); | |
2344 EMIT(0x66); | |
2345 EMIT(0x0F); | |
2346 EMIT(0xF3); | |
2347 emit_sse_operand(dst, src); | |
2348 } | |
2349 | |
2350 | |
2351 void Assembler::psrlq(XMMRegister reg, int8_t shift) { | |
2352 EnsureSpace ensure_space(this); | |
2353 EMIT(0x66); | |
2354 EMIT(0x0F); | |
2355 EMIT(0x73); | |
2356 emit_sse_operand(edx, reg); // edx == 2 | |
2357 EMIT(shift); | |
2358 } | |
2359 | |
2360 | |
2361 void Assembler::psrlq(XMMRegister dst, XMMRegister src) { | |
2362 EnsureSpace ensure_space(this); | |
2363 EMIT(0x66); | |
2364 EMIT(0x0F); | |
2365 EMIT(0xD3); | |
2366 emit_sse_operand(dst, src); | |
2367 } | |
2368 | |
2369 | |
2370 void Assembler::pshufd(XMMRegister dst, XMMRegister src, uint8_t shuffle) { | |
2371 EnsureSpace ensure_space(this); | |
2372 EMIT(0x66); | |
2373 EMIT(0x0F); | |
2374 EMIT(0x70); | |
2375 emit_sse_operand(dst, src); | |
2376 EMIT(shuffle); | |
2377 } | |
2378 | |
2379 | |
2380 void Assembler::pextrd(const Operand& dst, XMMRegister src, int8_t offset) { | |
2381 ASSERT(IsEnabled(SSE4_1)); | |
2382 EnsureSpace ensure_space(this); | |
2383 EMIT(0x66); | |
2384 EMIT(0x0F); | |
2385 EMIT(0x3A); | |
2386 EMIT(0x16); | |
2387 emit_sse_operand(src, dst); | |
2388 EMIT(offset); | |
2389 } | |
2390 | |
2391 | |
2392 void Assembler::pinsrd(XMMRegister dst, const Operand& src, int8_t offset) { | |
2393 ASSERT(IsEnabled(SSE4_1)); | |
2394 EnsureSpace ensure_space(this); | |
2395 EMIT(0x66); | |
2396 EMIT(0x0F); | |
2397 EMIT(0x3A); | |
2398 EMIT(0x22); | |
2399 emit_sse_operand(dst, src); | |
2400 EMIT(offset); | |
2401 } | |
2402 | |
2403 | |
2404 void Assembler::emit_sse_operand(XMMRegister reg, const Operand& adr) { | |
2405 Register ireg = { reg.code() }; | |
2406 emit_operand(ireg, adr); | |
2407 } | |
2408 | |
2409 | |
2410 void Assembler::emit_sse_operand(XMMRegister dst, XMMRegister src) { | |
2411 EMIT(0xC0 | dst.code() << 3 | src.code()); | |
2412 } | |
2413 | |
2414 | |
2415 void Assembler::emit_sse_operand(Register dst, XMMRegister src) { | |
2416 EMIT(0xC0 | dst.code() << 3 | src.code()); | |
2417 } | |
2418 | |
2419 | |
2420 void Assembler::emit_sse_operand(XMMRegister dst, Register src) { | |
2421 EMIT(0xC0 | (dst.code() << 3) | src.code()); | |
2422 } | |
2423 | |
2424 | |
2425 void Assembler::Print() { | 1820 void Assembler::Print() { |
2426 Disassembler::Decode(isolate(), stdout, buffer_, pc_); | 1821 Disassembler::Decode(isolate(), stdout, buffer_, pc_); |
2427 } | 1822 } |
2428 | 1823 |
2429 | 1824 |
2430 void Assembler::RecordJSReturn() { | 1825 void Assembler::RecordJSReturn() { |
2431 positions_recorder()->WriteRecordedPositions(); | 1826 positions_recorder()->WriteRecordedPositions(); |
2432 EnsureSpace ensure_space(this); | 1827 EnsureSpace ensure_space(this); |
2433 RecordRelocInfo(RelocInfo::JS_RETURN); | 1828 RecordRelocInfo(RelocInfo::JS_RETURN); |
2434 } | 1829 } |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2579 EnsureSpace ensure_space(this); | 1974 EnsureSpace ensure_space(this); |
2580 emit(data); | 1975 emit(data); |
2581 } | 1976 } |
2582 | 1977 |
2583 | 1978 |
2584 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { | 1979 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { |
2585 ASSERT(!RelocInfo::IsNone(rmode)); | 1980 ASSERT(!RelocInfo::IsNone(rmode)); |
2586 // Don't record external references unless the heap will be serialized. | 1981 // Don't record external references unless the heap will be serialized. |
2587 if (rmode == RelocInfo::EXTERNAL_REFERENCE && | 1982 if (rmode == RelocInfo::EXTERNAL_REFERENCE && |
2588 !serializer_enabled() && !emit_debug_code()) { | 1983 !serializer_enabled() && !emit_debug_code()) { |
2589 return; | 1984 return; |
2590 } | 1985 } |
2591 RelocInfo rinfo(pc_, rmode, data, NULL); | 1986 RelocInfo rinfo(pc_, rmode, data, NULL); |
2592 reloc_info_writer.Write(&rinfo); | 1987 reloc_info_writer.Write(&rinfo); |
2593 } | 1988 } |
2594 | 1989 |
2595 | 1990 |
2596 Handle<ConstantPoolArray> Assembler::NewConstantPool(Isolate* isolate) { | 1991 Handle<ConstantPoolArray> Assembler::NewConstantPool(Isolate* isolate) { |
2597 // No out-of-line constant pool support. | 1992 // No out-of-line constant pool support. |
2598 ASSERT(!FLAG_enable_ool_constant_pool); | 1993 ASSERT(!FLAG_enable_ool_constant_pool); |
2599 return isolate->factory()->empty_constant_pool_array(); | 1994 return isolate->factory()->empty_constant_pool_array(); |
(...skipping 27 matching lines...) Expand all Loading... |
2627 if (coverage_log != NULL) { | 2022 if (coverage_log != NULL) { |
2628 fprintf(coverage_log, "%s\n", file_line); | 2023 fprintf(coverage_log, "%s\n", file_line); |
2629 fflush(coverage_log); | 2024 fflush(coverage_log); |
2630 } | 2025 } |
2631 } | 2026 } |
2632 | 2027 |
2633 #endif | 2028 #endif |
2634 | 2029 |
2635 } } // namespace v8::internal | 2030 } } // namespace v8::internal |
2636 | 2031 |
2637 #endif // V8_TARGET_ARCH_IA32 | 2032 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |