| 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" | 5 #include "vm/globals.h" |
| 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/code_generator.h" | 9 #include "vm/code_generator.h" |
| 10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
| (...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1971 | 1971 |
| 1972 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, | 1972 DECLARE_LEAF_RUNTIME_ENTRY(intptr_t, |
| 1973 BigintCompare, | 1973 BigintCompare, |
| 1974 RawBigint* left, | 1974 RawBigint* left, |
| 1975 RawBigint* right); | 1975 RawBigint* right); |
| 1976 | 1976 |
| 1977 | 1977 |
| 1978 // Does identical check (object references are equal or not equal) with special | 1978 // Does identical check (object references are equal or not equal) with special |
| 1979 // checks for boxed numbers. | 1979 // checks for boxed numbers. |
| 1980 // LR: return address. | 1980 // LR: return address. |
| 1981 // SP + 4: left operand. | |
| 1982 // SP + 0: right operand. | |
| 1983 // Return Zero condition flag set if equal. | 1981 // Return Zero condition flag set if equal. |
| 1984 // Note: A Mint cannot contain a value that would fit in Smi, a Bigint | 1982 // Note: A Mint cannot contain a value that would fit in Smi, a Bigint |
| 1985 // cannot contain a value that fits in Mint or Smi. | 1983 // cannot contain a value that fits in Mint or Smi. |
| 1986 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler) { | 1984 void StubCode::GenerateIdenticalWithNumberCheckStub(Assembler* assembler, |
| 1987 const Register temp = R2; | 1985 const Register left, |
| 1988 const Register left = R1; | 1986 const Register right, |
| 1989 const Register right = R0; | 1987 const Register temp, |
| 1990 // Preserve left, right and temp. | 1988 const Register unused) { |
| 1991 __ PushList((1 << R0) | (1 << R1) | (1 << R2)); | |
| 1992 // TOS + 4: left argument. | |
| 1993 // TOS + 3: right argument. | |
| 1994 // TOS + 2: saved temp | |
| 1995 // TOS + 1: saved left | |
| 1996 // TOS + 0: saved right | |
| 1997 __ ldr(left, Address(SP, 4 * kWordSize)); | |
| 1998 __ ldr(right, Address(SP, 3 * kWordSize)); | |
| 1999 Label reference_compare, done, check_mint, check_bigint; | 1989 Label reference_compare, done, check_mint, check_bigint; |
| 2000 // If any of the arguments is Smi do reference compare. | 1990 // If any of the arguments is Smi do reference compare. |
| 2001 __ tst(left, ShifterOperand(kSmiTagMask)); | 1991 __ tst(left, ShifterOperand(kSmiTagMask)); |
| 2002 __ b(&reference_compare, EQ); | 1992 __ b(&reference_compare, EQ); |
| 2003 __ tst(right, ShifterOperand(kSmiTagMask)); | 1993 __ tst(right, ShifterOperand(kSmiTagMask)); |
| 2004 __ b(&reference_compare, EQ); | 1994 __ b(&reference_compare, EQ); |
| 2005 | 1995 |
| 2006 // Value compare for two doubles. | 1996 // Value compare for two doubles. |
| 2007 __ CompareClassId(left, kDoubleCid, temp); | 1997 __ CompareClassId(left, kDoubleCid, temp); |
| 2008 __ b(&check_mint, NE); | 1998 __ b(&check_mint, NE); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2043 __ stm(IA, SP, (1 << R0) | (1 << R1)); | 2033 __ stm(IA, SP, (1 << R0) | (1 << R1)); |
| 2044 __ CallRuntime(kBigintCompareRuntimeEntry); | 2034 __ CallRuntime(kBigintCompareRuntimeEntry); |
| 2045 // Result in R0, 0 means equal. | 2035 // Result in R0, 0 means equal. |
| 2046 __ LeaveStubFrame(); | 2036 __ LeaveStubFrame(); |
| 2047 __ cmp(R0, ShifterOperand(0)); | 2037 __ cmp(R0, ShifterOperand(0)); |
| 2048 __ b(&done); | 2038 __ b(&done); |
| 2049 | 2039 |
| 2050 __ Bind(&reference_compare); | 2040 __ Bind(&reference_compare); |
| 2051 __ cmp(left, ShifterOperand(right)); | 2041 __ cmp(left, ShifterOperand(right)); |
| 2052 __ Bind(&done); | 2042 __ Bind(&done); |
| 2043 } |
| 2044 |
| 2045 |
| 2046 // Called only from unoptimized code. All relevant registers have been saved. |
| 2047 // LR: return address. |
| 2048 // SP + 4: left operand. |
| 2049 // SP + 0: right operand. |
| 2050 // Return Zero condition flag set if equal. |
| 2051 void StubCode::GenerateUnoptimizedIdenticalWithNumberCheckStub( |
| 2052 Assembler* assembler) { |
| 2053 const Register temp = R2; |
| 2054 const Register left = R1; |
| 2055 const Register right = R0; |
| 2056 __ ldr(left, Address(SP, 1 * kWordSize)); |
| 2057 __ ldr(right, Address(SP, 0 * kWordSize)); |
| 2058 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2059 __ Ret(); |
| 2060 } |
| 2061 |
| 2062 |
| 2063 // Called from otpimzied code only. Must preserve any registers that are |
| 2064 // destroyed. |
| 2065 // LR: return address. |
| 2066 // SP + 4: left operand. |
| 2067 // SP + 0: right operand. |
| 2068 // Return Zero condition flag set if equal. |
| 2069 void StubCode::GenerateOptimizedIdenticalWithNumberCheckStub( |
| 2070 Assembler* assembler) { |
| 2071 const Register temp = R2; |
| 2072 const Register left = R1; |
| 2073 const Register right = R0; |
| 2074 // Preserve left, right and temp. |
| 2075 __ PushList((1 << R0) | (1 << R1) | (1 << R2)); |
| 2076 __ ldr(left, Address(SP, 4 * kWordSize)); |
| 2077 __ ldr(right, Address(SP, 3 * kWordSize)); |
| 2078 GenerateIdenticalWithNumberCheckStub(assembler, left, right, temp); |
| 2053 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); | 2079 __ PopList((1 << R0) | (1 << R1) | (1 << R2)); |
| 2054 __ Ret(); | 2080 __ Ret(); |
| 2055 } | 2081 } |
| 2056 | 2082 |
| 2057 } // namespace dart | 2083 } // namespace dart |
| 2058 | 2084 |
| 2059 #endif // defined TARGET_ARCH_ARM | 2085 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |