OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
7 | 7 |
8 #include "vm/assembler.h" | 8 #include "vm/assembler.h" |
9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
10 #include "vm/memory_region.h" | 10 #include "vm/memory_region.h" |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1571 | 1571 |
1572 void Assembler::LoadClassId(Register result, Register object) { | 1572 void Assembler::LoadClassId(Register result, Register object) { |
1573 ASSERT(RawObject::kClassIdTagBit == 16); | 1573 ASSERT(RawObject::kClassIdTagBit == 16); |
1574 ASSERT(RawObject::kClassIdTagSize == 16); | 1574 ASSERT(RawObject::kClassIdTagSize == 16); |
1575 const intptr_t class_id_offset = Object::tags_offset() + | 1575 const intptr_t class_id_offset = Object::tags_offset() + |
1576 RawObject::kClassIdTagBit / kBitsPerByte; | 1576 RawObject::kClassIdTagBit / kBitsPerByte; |
1577 movzxw(result, FieldAddress(object, class_id_offset)); | 1577 movzxw(result, FieldAddress(object, class_id_offset)); |
1578 } | 1578 } |
1579 | 1579 |
1580 | 1580 |
| 1581 void Assembler::LoadClassById(Register result, Register class_id) { |
| 1582 ASSERT(result != class_id); |
| 1583 movl(result, FieldAddress(CTX, Context::isolate_offset())); |
| 1584 const intptr_t table_offset_in_isolate = |
| 1585 Isolate::class_table_offset() + ClassTable::table_offset(); |
| 1586 movl(result, Address(result, table_offset_in_isolate)); |
| 1587 movl(result, Address(result, class_id, TIMES_4, 0)); |
| 1588 } |
| 1589 |
| 1590 |
1581 void Assembler::LoadClass(Register result, | 1591 void Assembler::LoadClass(Register result, |
1582 Register object, | 1592 Register object, |
1583 Register scratch) { | 1593 Register scratch) { |
1584 ASSERT(scratch != result); | 1594 ASSERT(scratch != result); |
1585 LoadClassId(scratch, object); | 1595 LoadClassId(scratch, object); |
1586 | 1596 |
1587 movl(result, FieldAddress(CTX, Context::isolate_offset())); | 1597 movl(result, FieldAddress(CTX, Context::isolate_offset())); |
1588 const intptr_t table_offset_in_isolate = | 1598 const intptr_t table_offset_in_isolate = |
1589 Isolate::class_table_offset() + ClassTable::table_offset(); | 1599 Isolate::class_table_offset() + ClassTable::table_offset(); |
1590 movl(result, Address(result, table_offset_in_isolate)); | 1600 movl(result, Address(result, table_offset_in_isolate)); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1623 comments.SetCommentAt(i, comments_[i]->comment()); | 1633 comments.SetCommentAt(i, comments_[i]->comment()); |
1624 } | 1634 } |
1625 | 1635 |
1626 return comments; | 1636 return comments; |
1627 } | 1637 } |
1628 | 1638 |
1629 | 1639 |
1630 } // namespace dart | 1640 } // namespace dart |
1631 | 1641 |
1632 #endif // defined TARGET_ARCH_IA32 | 1642 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |