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_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
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/os.h" | 10 #include "vm/os.h" |
(...skipping 2048 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2059 __ mov(CTX, A0); | 2059 __ mov(CTX, A0); |
2060 __ StoreIntoObject(A2, | 2060 __ StoreIntoObject(A2, |
2061 FieldAddress(A2, GrowableObjectArray::data_offset()), | 2061 FieldAddress(A2, GrowableObjectArray::data_offset()), |
2062 A1); | 2062 A1); |
2063 __ lw(RA, Address(SP, 0 * kWordSize)); | 2063 __ lw(RA, Address(SP, 0 * kWordSize)); |
2064 __ lw(CTX, Address(SP, 1 * kWordSize)); | 2064 __ lw(CTX, Address(SP, 1 * kWordSize)); |
2065 __ addiu(SP, SP, Immediate(2 * kWordSize)); | 2065 __ addiu(SP, SP, Immediate(2 * kWordSize)); |
2066 __ Ret(); | 2066 __ Ret(); |
2067 } | 2067 } |
2068 | 2068 |
| 2069 |
| 2070 ASSEMBLER_TEST_GENERATE(ComputeRange, assembler) { |
| 2071 Label miss, done; |
| 2072 __ ComputeRange(V0, A0, &miss); |
| 2073 __ b(&done); |
| 2074 |
| 2075 __ Bind(&miss); |
| 2076 __ LoadImmediate(V0, -1); |
| 2077 |
| 2078 __ Bind(&done); |
| 2079 __ Ret(); |
| 2080 } |
| 2081 |
| 2082 |
| 2083 ASSEMBLER_TEST_RUN(ComputeRange, test) { |
| 2084 typedef intptr_t (*ComputeRange)(intptr_t value) DART_UNUSED; |
| 2085 |
| 2086 #define RANGE_OF(v) \ |
| 2087 (EXECUTE_TEST_CODE_INTPTR_INTPTR( \ |
| 2088 ComputeRange, test->entry(), reinterpret_cast<intptr_t>(v))) |
| 2089 |
| 2090 EXPECT_EQ(0, RANGE_OF(Smi::New(0))); |
| 2091 EXPECT_EQ(0, RANGE_OF(Smi::New(1))); |
| 2092 EXPECT_EQ(ICData::kSignedRangeBit, RANGE_OF(Smi::New(-1))); |
| 2093 EXPECT_EQ(0, RANGE_OF(Smi::New(Smi::kMaxValue))); |
| 2094 EXPECT_EQ(ICData::kSignedRangeBit, RANGE_OF(Smi::New(Smi::kMinValue))); |
| 2095 |
| 2096 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(Integer::New(Smi::kMaxValue + 1))); |
| 2097 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, |
| 2098 RANGE_OF(Integer::New(Smi::kMinValue - 1))); |
| 2099 EXPECT_EQ(ICData::kInt32RangeBit, RANGE_OF(Integer::New(kMaxInt32))); |
| 2100 EXPECT_EQ(ICData::kInt32RangeBit | ICData::kSignedRangeBit, |
| 2101 RANGE_OF(Integer::New(kMinInt32))); |
| 2102 |
| 2103 EXPECT_EQ(ICData::kUint32RangeBit, |
| 2104 RANGE_OF(Integer::New(static_cast<int64_t>(kMaxInt32) + 1))); |
| 2105 EXPECT_EQ(ICData::kUint32RangeBit, |
| 2106 RANGE_OF(Integer::New(kMaxUint32))); |
| 2107 |
| 2108 EXPECT_EQ(ICData::kInt64RangeBit, |
| 2109 RANGE_OF(Integer::New(static_cast<int64_t>(kMaxUint32) + 1))); |
| 2110 EXPECT_EQ(ICData::kInt64RangeBit, |
| 2111 RANGE_OF(Integer::New(static_cast<int64_t>(kMinInt32) - 1))); |
| 2112 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMaxInt64))); |
| 2113 EXPECT_EQ(ICData::kInt64RangeBit, RANGE_OF(Integer::New(kMinInt64))); |
| 2114 |
| 2115 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); |
| 2116 |
| 2117 #undef RANGE_OF |
| 2118 } |
| 2119 |
| 2120 |
2069 } // namespace dart | 2121 } // namespace dart |
2070 | 2122 |
2071 #endif // defined TARGET_ARCH_MIPS | 2123 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |