OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #include "vm/globals.h" // NOLINT | 5 #include "vm/globals.h" // NOLINT |
6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/cpu.h" | 9 #include "vm/cpu.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 1903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1914 LoadImmediate(result, kSmiCid, EQ); | 1914 LoadImmediate(result, kSmiCid, EQ); |
1915 } | 1915 } |
1916 | 1916 |
1917 | 1917 |
1918 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { | 1918 void Assembler::LoadTaggedClassIdMayBeSmi(Register result, Register object) { |
1919 LoadClassIdMayBeSmi(result, object); | 1919 LoadClassIdMayBeSmi(result, object); |
1920 SmiTag(result); | 1920 SmiTag(result); |
1921 } | 1921 } |
1922 | 1922 |
1923 | 1923 |
1924 void Assembler::ComputeRange(Register result, | |
1925 Register value, | |
1926 Register scratch, | |
1927 Label* not_mint) { | |
1928 const Register hi = TMP; | |
1929 const Register lo = scratch; | |
1930 | |
1931 Label done; | |
1932 mov(result, Operand(value, LSR, kBitsPerWord - 1)); | |
1933 tst(value, Operand(kSmiTagMask)); | |
1934 b(&done, EQ); | |
1935 CompareClassId(value, kMintCid, result); | |
1936 b(not_mint, NE); | |
1937 ldr(hi, FieldAddress(value, Mint::value_offset() + kWordSize)); | |
1938 ldr(lo, FieldAddress(value, Mint::value_offset())); | |
1939 rsb(result, hi, Operand(ICData::kInt32RangeBit)); | |
1940 cmp(hi, Operand(lo, ASR, kBitsPerWord - 1)); | |
1941 b(&done, EQ); | |
1942 LoadImmediate(result, ICData::kUint32RangeBit); // Uint32 | |
1943 tst(hi, Operand(hi)); | |
1944 LoadImmediate(result, ICData::kInt64RangeBit, NE); // Int64 | |
1945 Bind(&done); | |
1946 } | |
1947 | |
1948 | |
1949 void Assembler::UpdateRangeFeedback(Register value, | |
1950 intptr_t index, | |
1951 Register ic_data, | |
1952 Register scratch1, | |
1953 Register scratch2, | |
1954 Label* miss) { | |
1955 ASSERT(ICData::IsValidRangeFeedbackIndex(index)); | |
1956 ComputeRange(scratch1, value, scratch2, miss); | |
1957 ldr(scratch2, FieldAddress(ic_data, ICData::state_bits_offset())); | |
1958 orr(scratch2, | |
1959 scratch2, | |
1960 Operand(scratch1, LSL, ICData::RangeFeedbackShift(index))); | |
1961 str(scratch2, FieldAddress(ic_data, ICData::state_bits_offset())); | |
1962 } | |
1963 | |
1964 | |
1965 static bool CanEncodeBranchOffset(int32_t offset) { | 1924 static bool CanEncodeBranchOffset(int32_t offset) { |
1966 ASSERT(Utils::IsAligned(offset, 4)); | 1925 ASSERT(Utils::IsAligned(offset, 4)); |
1967 return Utils::IsInt(Utils::CountOneBits(kBranchOffsetMask), offset); | 1926 return Utils::IsInt(Utils::CountOneBits(kBranchOffsetMask), offset); |
1968 } | 1927 } |
1969 | 1928 |
1970 | 1929 |
1971 int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t inst) { | 1930 int32_t Assembler::EncodeBranchOffset(int32_t offset, int32_t inst) { |
1972 // The offset is off by 8 due to the way the ARM CPUs read PC. | 1931 // The offset is off by 8 due to the way the ARM CPUs read PC. |
1973 offset -= Instr::kPCReadOffset; | 1932 offset -= Instr::kPCReadOffset; |
1974 | 1933 |
(...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3547 | 3506 |
3548 | 3507 |
3549 const char* Assembler::FpuRegisterName(FpuRegister reg) { | 3508 const char* Assembler::FpuRegisterName(FpuRegister reg) { |
3550 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); | 3509 ASSERT((0 <= reg) && (reg < kNumberOfFpuRegisters)); |
3551 return fpu_reg_names[reg]; | 3510 return fpu_reg_names[reg]; |
3552 } | 3511 } |
3553 | 3512 |
3554 } // namespace dart | 3513 } // namespace dart |
3555 | 3514 |
3556 #endif // defined TARGET_ARCH_ARM | 3515 #endif // defined TARGET_ARCH_ARM |
OLD | NEW |