| 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" // Needed here to get TARGET_ARCH_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 7 | 7 |
| 8 #include "vm/intrinsifier.h" | 8 #include "vm/intrinsifier.h" |
| 9 | 9 |
| 10 #include "vm/assembler.h" | 10 #include "vm/assembler.h" |
| (...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 __ cmp(R0, Operand(R1)); | 1568 __ cmp(R0, Operand(R1)); |
| 1569 __ LoadObject(R0, Bool::False(), NE); | 1569 __ LoadObject(R0, Bool::False(), NE); |
| 1570 __ LoadObject(R0, Bool::True(), EQ); | 1570 __ LoadObject(R0, Bool::True(), EQ); |
| 1571 __ Ret(); | 1571 __ Ret(); |
| 1572 } | 1572 } |
| 1573 | 1573 |
| 1574 | 1574 |
| 1575 // Return type quickly for simple types (not parameterized and not signature). | 1575 // Return type quickly for simple types (not parameterized and not signature). |
| 1576 void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { | 1576 void Intrinsifier::ObjectRuntimeType(Assembler* assembler) { |
| 1577 Label fall_through; | 1577 Label fall_through; |
| 1578 static const intptr_t kSmiCidSource = kSmiCid << RawObject::kClassIdTagPos; | |
| 1579 __ ldr(R0, Address(SP, 0 * kWordSize)); | 1578 __ ldr(R0, Address(SP, 0 * kWordSize)); |
| 1579 __ LoadClassIdMayBeSmi(R1, R0); |
| 1580 __ LoadClassById(R2, R1); |
| 1580 | 1581 |
| 1581 __ LoadImmediate(TMP, reinterpret_cast<int32_t>(&kSmiCidSource) + 1); | |
| 1582 __ tst(R0, Operand(kSmiTagMask)); | |
| 1583 __ mov(TMP, Operand(R0), NE); | |
| 1584 __ LoadClassId(R1, TMP); | |
| 1585 __ LoadClassById(R2, R1); | |
| 1586 // R2: class of instance (R0). | 1582 // R2: class of instance (R0). |
| 1587 __ ldr(R3, FieldAddress(R2, Class::signature_function_offset())); | 1583 __ ldr(R3, FieldAddress(R2, Class::signature_function_offset())); |
| 1588 __ CompareObject(R3, Object::null_object()); | 1584 __ CompareObject(R3, Object::null_object()); |
| 1589 __ b(&fall_through, NE); | 1585 __ b(&fall_through, NE); |
| 1590 | 1586 |
| 1591 __ ldrh(R3, FieldAddress(R2, Class::num_type_arguments_offset())); | 1587 __ ldrh(R3, FieldAddress(R2, Class::num_type_arguments_offset())); |
| 1592 __ CompareImmediate(R3, 0); | 1588 __ CompareImmediate(R3, 0); |
| 1593 __ b(&fall_through, NE); | 1589 __ b(&fall_through, NE); |
| 1594 | 1590 |
| 1595 __ ldr(R0, FieldAddress(R2, Class::canonical_types_offset())); | 1591 __ ldr(R0, FieldAddress(R2, Class::canonical_types_offset())); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 | 1749 |
| 1754 // Allocates one-byte string of length 'end - start'. The content is not | 1750 // Allocates one-byte string of length 'end - start'. The content is not |
| 1755 // initialized. | 1751 // initialized. |
| 1756 // 'length-reg' (R2) contains tagged length. | 1752 // 'length-reg' (R2) contains tagged length. |
| 1757 // Returns new string as tagged pointer in R0. | 1753 // Returns new string as tagged pointer in R0. |
| 1758 static void TryAllocateOnebyteString(Assembler* assembler, | 1754 static void TryAllocateOnebyteString(Assembler* assembler, |
| 1759 Label* ok, | 1755 Label* ok, |
| 1760 Label* failure) { | 1756 Label* failure) { |
| 1761 const Register length_reg = R2; | 1757 const Register length_reg = R2; |
| 1762 Label fail; | 1758 Label fail; |
| 1763 __ MaybeTraceAllocation(kOneByteStringCid, R0, failure); | 1759 __ MaybeTraceAllocation(kOneByteStringCid, R0, failure, |
| 1760 /* inline_isolate = */ false); |
| 1764 __ mov(R6, Operand(length_reg)); // Save the length register. | 1761 __ mov(R6, Operand(length_reg)); // Save the length register. |
| 1765 // TODO(koda): Protect against negative length and overflow here. | 1762 // TODO(koda): Protect against negative length and overflow here. |
| 1766 __ SmiUntag(length_reg); | 1763 __ SmiUntag(length_reg); |
| 1767 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; | 1764 const intptr_t fixed_size = sizeof(RawString) + kObjectAlignment - 1; |
| 1768 __ AddImmediate(length_reg, fixed_size); | 1765 __ AddImmediate(length_reg, fixed_size); |
| 1769 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); | 1766 __ bic(length_reg, length_reg, Operand(kObjectAlignment - 1)); |
| 1770 | 1767 |
| 1771 const intptr_t cid = kOneByteStringCid; | 1768 const intptr_t cid = kOneByteStringCid; |
| 1772 Heap::Space space = Heap::SpaceForAllocation(cid); | 1769 Heap::Space space = Heap::SpaceForAllocation(cid); |
| 1773 __ ldr(R3, Address(THR, Thread::heap_offset())); | 1770 __ ldr(R3, Address(THR, Thread::heap_offset())); |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2045 | 2042 |
| 2046 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { | 2043 void Intrinsifier::Profiler_getCurrentTag(Assembler* assembler) { |
| 2047 __ LoadIsolate(R0); | 2044 __ LoadIsolate(R0); |
| 2048 __ ldr(R0, Address(R0, Isolate::current_tag_offset())); | 2045 __ ldr(R0, Address(R0, Isolate::current_tag_offset())); |
| 2049 __ Ret(); | 2046 __ Ret(); |
| 2050 } | 2047 } |
| 2051 | 2048 |
| 2052 } // namespace dart | 2049 } // namespace dart |
| 2053 | 2050 |
| 2054 #endif // defined TARGET_ARCH_ARM | 2051 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |