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 1872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1883 void MacroAssembler::CheckFastSmiOnlyElements(Register map, | 1883 void MacroAssembler::CheckFastSmiOnlyElements(Register map, |
1884 Register scratch, | 1884 Register scratch, |
1885 Label* fail) { | 1885 Label* fail) { |
1886 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); | 1886 STATIC_ASSERT(FAST_SMI_ONLY_ELEMENTS == 0); |
1887 ldrb(scratch, FieldMemOperand(map, Map::kBitField2Offset)); | 1887 ldrb(scratch, FieldMemOperand(map, Map::kBitField2Offset)); |
1888 cmp(scratch, Operand(Map::kMaximumBitField2FastSmiOnlyElementValue)); | 1888 cmp(scratch, Operand(Map::kMaximumBitField2FastSmiOnlyElementValue)); |
1889 b(hi, fail); | 1889 b(hi, fail); |
1890 } | 1890 } |
1891 | 1891 |
1892 | 1892 |
1893 void MacroAssembler::StoreNumberToDoubleElements(Register value_reg, | |
1894 Register key_reg, | |
1895 Register receiver_reg, | |
1896 Register elements_reg, | |
1897 Register scratch1, | |
1898 Register scratch2, | |
1899 Register scratch3, | |
1900 Register scratch4, | |
1901 Label* fail) { | |
1902 Label smi_value, maybe_nan, have_double_value, is_nan, done; | |
1903 Register mantissa_reg = scratch2; | |
1904 Register exponent_reg = scratch3; | |
1905 | |
1906 // Handle smi values specially. | |
1907 JumpIfSmi(value_reg, &smi_value); | |
1908 | |
1909 // Ensure that the object is a heap number | |
1910 CheckMap(value_reg, | |
1911 scratch1, | |
1912 isolate()->factory()->heap_number_map(), | |
1913 fail, | |
1914 DONT_DO_SMI_CHECK); | |
1915 | |
1916 // Check for nan: all NaN values have a value greater (signed) than 0x7ff00000 | |
1917 // in the exponent. | |
1918 mov(scratch1, Operand(kNaNOrInfinityLowerBoundUpper32)); | |
1919 ldr(exponent_reg, FieldMemOperand(value_reg, HeapNumber::kExponentOffset)); | |
1920 cmp(exponent_reg, scratch1); | |
1921 b(ge, &maybe_nan); | |
1922 | |
1923 ldr(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset)); | |
1924 | |
1925 bind(&have_double_value); | |
1926 add(scratch1, elements_reg, | |
1927 Operand(key_reg, LSL, kDoubleSizeLog2 - kSmiTagSize)); | |
1928 str(mantissa_reg, FieldMemOperand(scratch1, FixedDoubleArray::kHeaderSize)); | |
1929 uint32_t offset = FixedDoubleArray::kHeaderSize + sizeof(kHoleNanLower32); | |
1930 str(exponent_reg, FieldMemOperand(scratch1, offset)); | |
1931 jmp(&done); | |
1932 | |
1933 bind(&maybe_nan); | |
1934 // Could be NaN or Infinity. If fraction is not zero, it's NaN, otherwise | |
1935 // it's an Infinity, and the non-NaN code path applies. | |
1936 b(gt, &is_nan); | |
1937 ldr(mantissa_reg, FieldMemOperand(value_reg, HeapNumber::kMantissaOffset)); | |
1938 cmp(mantissa_reg, Operand(0)); | |
1939 b(eq, &have_double_value); | |
1940 bind(&is_nan); | |
1941 // Load canonical NaN for storing into the double array. | |
1942 uint64_t nan_int64 = BitCast<uint64_t>( | |
1943 FixedDoubleArray::canonical_not_the_hole_nan_as_double()); | |
1944 mov(mantissa_reg, Operand(static_cast<uint32_t>(nan_int64))); | |
1945 mov(exponent_reg, Operand(static_cast<uint32_t>(nan_int64 >> 32))); | |
1946 jmp(&have_double_value); | |
1947 | |
1948 bind(&smi_value); | |
1949 add(scratch1, elements_reg, | |
1950 Operand(FixedDoubleArray::kHeaderSize - kHeapObjectTag)); | |
1951 add(scratch1, scratch1, | |
1952 Operand(key_reg, LSL, kDoubleSizeLog2 - kSmiTagSize)); | |
1953 // scratch is now effective address of the double element | |
Rico
2011/10/05 08:39:19
scratch1
| |
1954 | |
1955 FloatingPointHelper::Destination destination; | |
1956 if (CpuFeatures::IsSupported(VFP3)) { | |
1957 destination = FloatingPointHelper::kVFPRegisters; | |
1958 } else { | |
1959 destination = FloatingPointHelper::kCoreRegisters; | |
1960 } | |
1961 | |
1962 Register untagged_value = receiver_reg; | |
1963 SmiUntag(untagged_value, value_reg); | |
1964 FloatingPointHelper::ConvertIntToDouble(this, | |
1965 untagged_value, | |
1966 destination, | |
1967 d0, | |
1968 mantissa_reg, | |
1969 exponent_reg, | |
1970 scratch4, | |
1971 s2); | |
1972 if (destination == FloatingPointHelper::kVFPRegisters) { | |
1973 CpuFeatures::Scope scope(VFP3); | |
1974 vstr(d0, scratch1, 0); | |
1975 } else { | |
1976 str(mantissa_reg, MemOperand(scratch1, 0)); | |
1977 str(exponent_reg, MemOperand(scratch1, Register::kSizeInBytes)); | |
1978 } | |
1979 bind(&done); | |
1980 } | |
1981 | |
1982 | |
1893 void MacroAssembler::CheckMap(Register obj, | 1983 void MacroAssembler::CheckMap(Register obj, |
1894 Register scratch, | 1984 Register scratch, |
1895 Handle<Map> map, | 1985 Handle<Map> map, |
1896 Label* fail, | 1986 Label* fail, |
1897 SmiCheckType smi_check_type) { | 1987 SmiCheckType smi_check_type) { |
1898 if (smi_check_type == DO_SMI_CHECK) { | 1988 if (smi_check_type == DO_SMI_CHECK) { |
1899 JumpIfSmi(obj, fail); | 1989 JumpIfSmi(obj, fail); |
1900 } | 1990 } |
1901 ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); | 1991 ldr(scratch, FieldMemOperand(obj, HeapObject::kMapOffset)); |
1902 mov(ip, Operand(map)); | 1992 mov(ip, Operand(map)); |
(...skipping 1673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3576 void CodePatcher::EmitCondition(Condition cond) { | 3666 void CodePatcher::EmitCondition(Condition cond) { |
3577 Instr instr = Assembler::instr_at(masm_.pc_); | 3667 Instr instr = Assembler::instr_at(masm_.pc_); |
3578 instr = (instr & ~kCondMask) | cond; | 3668 instr = (instr & ~kCondMask) | cond; |
3579 masm_.emit(instr); | 3669 masm_.emit(instr); |
3580 } | 3670 } |
3581 | 3671 |
3582 | 3672 |
3583 } } // namespace v8::internal | 3673 } } // namespace v8::internal |
3584 | 3674 |
3585 #endif // V8_TARGET_ARCH_ARM | 3675 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |