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 __ addiu(SP, SP, Immediate(-1 * kWordSize)); | |
2072 __ sw(RA, Address(SP, 0 * kWordSize)); | |
zra
2014/12/15 16:01:40
Same comment.
Vyacheslav Egorov (Google)
2014/12/15 17:20:05
Done.
| |
2073 Label miss, done; | |
2074 __ ComputeRange(V0, A0, &miss); | |
2075 __ b(&done); | |
2076 | |
2077 __ Bind(&miss); | |
2078 __ LoadImmediate(V0, -1); | |
2079 | |
2080 __ Bind(&done); | |
2081 __ lw(RA, Address(SP, 0 * kWordSize)); | |
2082 __ addiu(SP, SP, Immediate(1 * kWordSize)); | |
2083 __ Ret(); | |
2084 } | |
2085 | |
2086 | |
2087 ASSEMBLER_TEST_RUN(ComputeRange, test) { | |
2088 typedef intptr_t (*ComputeRange)(intptr_t value) DART_UNUSED; | |
2089 | |
2090 #define RANGE_OF(v) \ | |
2091 (EXECUTE_TEST_CODE_INTPTR_INTPTR( \ | |
2092 ComputeRange, test->entry(), reinterpret_cast<intptr_t>(v))) | |
2093 | |
2094 EXPECT_EQ(0, RANGE_OF(Smi::New(0))); | |
2095 EXPECT_EQ(0, RANGE_OF(Smi::New(1))); | |
2096 EXPECT_EQ(ICData::kSignBit, RANGE_OF(Smi::New(-1))); | |
2097 EXPECT_EQ(0, RANGE_OF(Smi::New(Smi::kMaxValue))); | |
2098 EXPECT_EQ(ICData::kSignBit, RANGE_OF(Smi::New(Smi::kMinValue))); | |
2099 | |
2100 EXPECT_EQ(ICData::kInt32Bit, RANGE_OF(Integer::New(Smi::kMaxValue + 1))); | |
2101 EXPECT_EQ(ICData::kInt32Bit | ICData::kSignBit, | |
2102 RANGE_OF(Integer::New(Smi::kMinValue - 1))); | |
2103 EXPECT_EQ(ICData::kInt32Bit, RANGE_OF(Integer::New(kMaxInt32))); | |
2104 EXPECT_EQ(ICData::kInt32Bit | ICData::kSignBit, | |
2105 RANGE_OF(Integer::New(kMinInt32))); | |
2106 | |
2107 EXPECT_EQ(ICData::kUint32Bit, | |
2108 RANGE_OF(Integer::New(static_cast<int64_t>(kMaxInt32) + 1))); | |
2109 EXPECT_EQ(ICData::kUint32Bit, | |
2110 RANGE_OF(Integer::New(kMaxUint32))); | |
2111 | |
2112 EXPECT_EQ(ICData::kInt64Bit, | |
2113 RANGE_OF(Integer::New(static_cast<int64_t>(kMaxUint32) + 1))); | |
2114 EXPECT_EQ(ICData::kInt64Bit, | |
2115 RANGE_OF(Integer::New(static_cast<int64_t>(kMinInt32) - 1))); | |
2116 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(kMaxInt64))); | |
2117 EXPECT_EQ(ICData::kInt64Bit, RANGE_OF(Integer::New(kMinInt64))); | |
2118 | |
2119 EXPECT_EQ(-1, RANGE_OF(Bool::True().raw())); | |
2120 | |
2121 #undef RANGE_OF | |
2122 } | |
2123 | |
2124 | |
2069 } // namespace dart | 2125 } // namespace dart |
2070 | 2126 |
2071 #endif // defined TARGET_ARCH_MIPS | 2127 #endif // defined TARGET_ARCH_MIPS |
OLD | NEW |