| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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_DBC) | 6 #if defined(TARGET_ARCH_DBC) |
| 7 | 7 |
| 8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
| 9 #include "vm/stack_frame.h" | 9 #include "vm/stack_frame.h" |
| 10 #include "vm/unit_test.h" | 10 #include "vm/unit_test.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // FP[-kParamEndSlotFromFp - 2]: value | 140 // FP[-kParamEndSlotFromFp - 2]: value |
| 141 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { | 141 ASSEMBLER_TEST_GENERATE(StoreIntoObject, assembler) { |
| 142 __ Frame(2); | 142 __ Frame(2); |
| 143 __ Move(0, -kParamEndSlotFromFp - 1); | 143 __ Move(0, -kParamEndSlotFromFp - 1); |
| 144 __ Move(1, -kParamEndSlotFromFp - 2); | 144 __ Move(1, -kParamEndSlotFromFp - 2); |
| 145 __ StoreField(0, GrowableObjectArray::data_offset() / kWordSize, 1); | 145 __ StoreField(0, GrowableObjectArray::data_offset() / kWordSize, 1); |
| 146 __ Return(0); | 146 __ Return(0); |
| 147 } | 147 } |
| 148 | 148 |
| 149 | 149 |
| 150 // - OneByteStringFromCharCode rA, rX |
| 151 // |
| 152 // Load the one-character symbol with the char code given by the Smi |
| 153 // in FP[rX] into FP[rA]. |
| 154 ASSEMBLER_TEST_GENERATE(OneByteStringFromCharCode, assembler) { |
| 155 __ Frame(2); |
| 156 __ LoadConstant(0, Smi::ZoneHandle(Smi::New(65))); |
| 157 __ OneByteStringFromCharCode(1, 0); |
| 158 __ Return(1); |
| 159 } |
| 160 |
| 161 |
| 162 ASSEMBLER_TEST_RUN(OneByteStringFromCharCode, test) { |
| 163 EXPECT_EQ(Symbols::New(Thread::Current(), "A"), |
| 164 EXECUTE_TEST_CODE_OBJECT(test->code()).raw()); |
| 165 } |
| 166 |
| 167 |
| 168 // - StringToCharCode rA, rX |
| 169 // |
| 170 // Load and smi-encode the single char code of the string in FP[rX] into |
| 171 // FP[rA]. If the string's length is not 1, load smi -1 instead. |
| 172 // |
| 173 ASSEMBLER_TEST_GENERATE(StringToCharCode, assembler) { |
| 174 __ Frame(2); |
| 175 __ LoadConstant(0, String::ZoneHandle(String::New("A", Heap::kOld))); |
| 176 __ StringToCharCode(1, 0); |
| 177 __ Return(1); |
| 178 } |
| 179 |
| 180 |
| 181 ASSEMBLER_TEST_RUN(StringToCharCode, test) { |
| 182 EXPECT_EQ(65, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 183 } |
| 184 |
| 185 |
| 186 ASSEMBLER_TEST_GENERATE(StringToCharCodeIllegalLength, assembler) { |
| 187 __ Frame(2); |
| 188 __ LoadConstant(0, String::ZoneHandle(String::New("AAA", Heap::kOld))); |
| 189 __ StringToCharCode(1, 0); |
| 190 __ Return(1); |
| 191 } |
| 192 |
| 193 |
| 194 ASSEMBLER_TEST_RUN(StringToCharCodeIllegalLength, test) { |
| 195 EXPECT_EQ(-1, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 196 } |
| 197 |
| 198 |
| 150 // - AddTOS; SubTOS; MulTOS; BitOrTOS; BitAndTOS; EqualTOS; LessThanTOS; | 199 // - AddTOS; SubTOS; MulTOS; BitOrTOS; BitAndTOS; EqualTOS; LessThanTOS; |
| 151 // GreaterThanTOS; | 200 // GreaterThanTOS; |
| 152 // | 201 // |
| 153 // Smi fast-path for a corresponding method. Checks if SP[0] and SP[-1] are | 202 // Smi fast-path for a corresponding method. Checks if SP[0] and SP[-1] are |
| 154 // both smis and result of SP[0] <op> SP[-1] is a smi - if this is true | 203 // both smis and result of SP[0] <op> SP[-1] is a smi - if this is true |
| 155 // then pops operands and pushes result on the stack and skips the next | 204 // then pops operands and pushes result on the stack and skips the next |
| 156 // instruction (which implements a slow path fallback). | 205 // instruction (which implements a slow path fallback). |
| 157 ASSEMBLER_TEST_GENERATE(AddTOS, assembler) { | 206 ASSEMBLER_TEST_GENERATE(AddTOS, assembler) { |
| 158 __ PushConstant(Smi::Handle(Smi::New(-42))); | 207 __ PushConstant(Smi::Handle(Smi::New(-42))); |
| 159 __ PushConstant(Smi::Handle(Smi::New(84))); | 208 __ PushConstant(Smi::Handle(Smi::New(84))); |
| (...skipping 1471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1631 } | 1680 } |
| 1632 | 1681 |
| 1633 | 1682 |
| 1634 ASSEMBLER_TEST_RUN(CheckClassIdFail, test) { | 1683 ASSEMBLER_TEST_RUN(CheckClassIdFail, test) { |
| 1635 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); | 1684 EXPECT_EQ(42, EXECUTE_TEST_CODE_INTPTR(test->code())); |
| 1636 } | 1685 } |
| 1637 | 1686 |
| 1638 } // namespace dart | 1687 } // namespace dart |
| 1639 | 1688 |
| 1640 #endif // defined(TARGET_ARCH_DBC) | 1689 #endif // defined(TARGET_ARCH_DBC) |
| OLD | NEW |