OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1891 | 1891 |
1892 push(eax); | 1892 push(eax); |
1893 push(Immediate(p0)); | 1893 push(Immediate(p0)); |
1894 push(Immediate(reinterpret_cast<intptr_t>(Smi::FromInt(p1 - p0)))); | 1894 push(Immediate(reinterpret_cast<intptr_t>(Smi::FromInt(p1 - p0)))); |
1895 CallRuntime(Runtime::kAbort, 2); | 1895 CallRuntime(Runtime::kAbort, 2); |
1896 // will not return here | 1896 // will not return here |
1897 int3(); | 1897 int3(); |
1898 } | 1898 } |
1899 | 1899 |
1900 | 1900 |
1901 void MacroAssembler::JumpIfNotNumber(Register reg, | |
1902 TypeInfo info, | |
1903 Label* on_not_number) { | |
1904 if (emit_debug_code()) AbortIfSmi(reg); | |
1905 if (!info.IsNumber()) { | |
1906 cmp(FieldOperand(reg, HeapObject::kMapOffset), | |
1907 isolate()->factory()->heap_number_map()); | |
1908 j(not_equal, on_not_number); | |
1909 } | |
1910 } | |
1911 | |
1912 | |
1913 void MacroAssembler::ConvertToInt32(Register dst, | |
1914 Register source, | |
1915 Register scratch, | |
1916 TypeInfo info, | |
1917 Label* on_not_int32) { | |
1918 if (emit_debug_code()) { | |
1919 AbortIfSmi(source); | |
1920 AbortIfNotNumber(source); | |
1921 } | |
1922 if (info.IsInteger32()) { | |
1923 cvttsd2si(dst, FieldOperand(source, HeapNumber::kValueOffset)); | |
1924 } else { | |
1925 Label done; | |
1926 bool push_pop = (scratch.is(no_reg) && dst.is(source)); | |
1927 ASSERT(!scratch.is(source)); | |
1928 if (push_pop) { | |
1929 push(dst); | |
1930 scratch = dst; | |
1931 } | |
1932 if (scratch.is(no_reg)) scratch = dst; | |
1933 cvttsd2si(scratch, FieldOperand(source, HeapNumber::kValueOffset)); | |
1934 cmp(scratch, 0x80000000u); | |
1935 if (push_pop) { | |
1936 j(not_equal, &done); | |
1937 pop(dst); | |
1938 jmp(on_not_int32); | |
1939 } else { | |
1940 j(equal, on_not_int32); | |
1941 } | |
1942 | |
1943 bind(&done); | |
1944 if (push_pop) { | |
1945 add(Operand(esp), Immediate(kPointerSize)); // Pop. | |
1946 } | |
1947 if (!scratch.is(dst)) { | |
1948 mov(dst, scratch); | |
1949 } | |
1950 } | |
1951 } | |
1952 | |
1953 | |
1954 void MacroAssembler::LoadPowerOf2(XMMRegister dst, | 1901 void MacroAssembler::LoadPowerOf2(XMMRegister dst, |
1955 Register scratch, | 1902 Register scratch, |
1956 int power) { | 1903 int power) { |
1957 ASSERT(is_uintn(power + HeapNumber::kExponentBias, | 1904 ASSERT(is_uintn(power + HeapNumber::kExponentBias, |
1958 HeapNumber::kExponentBits)); | 1905 HeapNumber::kExponentBits)); |
1959 mov(scratch, Immediate(power + HeapNumber::kExponentBias)); | 1906 mov(scratch, Immediate(power + HeapNumber::kExponentBias)); |
1960 movd(dst, Operand(scratch)); | 1907 movd(dst, Operand(scratch)); |
1961 psllq(dst, HeapNumber::kMantissaBits); | 1908 psllq(dst, HeapNumber::kMantissaBits); |
1962 } | 1909 } |
1963 | 1910 |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2065 | 2012 |
2066 // Check that the code was patched as expected. | 2013 // Check that the code was patched as expected. |
2067 ASSERT(masm_.pc_ == address_ + size_); | 2014 ASSERT(masm_.pc_ == address_ + size_); |
2068 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 2015 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
2069 } | 2016 } |
2070 | 2017 |
2071 | 2018 |
2072 } } // namespace v8::internal | 2019 } } // namespace v8::internal |
2073 | 2020 |
2074 #endif // V8_TARGET_ARCH_IA32 | 2021 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |