| 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 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1555 void Assembler::EmitGenericShift(int rm, | 1555 void Assembler::EmitGenericShift(int rm, |
| 1556 Register operand, | 1556 Register operand, |
| 1557 Register shifter) { | 1557 Register shifter) { |
| 1558 AssemblerBuffer::EnsureCapacity ensured(&buffer_); | 1558 AssemblerBuffer::EnsureCapacity ensured(&buffer_); |
| 1559 ASSERT(shifter == ECX); | 1559 ASSERT(shifter == ECX); |
| 1560 EmitUint8(0xD3); | 1560 EmitUint8(0xD3); |
| 1561 EmitOperand(rm, Operand(operand)); | 1561 EmitOperand(rm, Operand(operand)); |
| 1562 } | 1562 } |
| 1563 | 1563 |
| 1564 | 1564 |
| 1565 void Assembler::LoadClassOfObject(Register result, |
| 1566 Register object, |
| 1567 Register scratch) { |
| 1568 ASSERT(scratch != result); |
| 1569 LoadClassIndexOfObject(scratch, object); |
| 1570 |
| 1571 movl(result, FieldAddress(CTX, Context::isolate_offset())); |
| 1572 const intptr_t table_offset_in_isolate = |
| 1573 Isolate::class_table_offset() + ClassTable::table_offset(); |
| 1574 movl(result, Address(result, table_offset_in_isolate)); |
| 1575 movl(result, Address(result, scratch, TIMES_4, 0)); |
| 1576 } |
| 1577 |
| 1578 |
| 1579 void Assembler::LoadClassIndexOfObject(Register result, Register object) { |
| 1580 ASSERT(RawObject::kClassTagBit == 16); |
| 1581 ASSERT(RawObject::kClassTagSize == 16); |
| 1582 const intptr_t class_id_offset = Object::tags_offset() + |
| 1583 RawObject::kClassTagBit / kBitsPerByte; |
| 1584 movzxw(result, FieldAddress(object, class_id_offset)); |
| 1585 } |
| 1586 |
| 1587 |
| 1588 void Assembler::CompareClassOfObject(Register object, |
| 1589 const Class& clazz, |
| 1590 Register scratch) { |
| 1591 LoadClassIndexOfObject(scratch, object); |
| 1592 cmpl(scratch, Immediate(clazz.index())); |
| 1593 } |
| 1594 |
| 1595 |
| 1565 void Assembler::Comment(const char* comment) { | 1596 void Assembler::Comment(const char* comment) { |
| 1566 if (FLAG_code_comments) { | 1597 if (FLAG_code_comments) { |
| 1567 comments_.Add(new CodeComment(buffer_.GetPosition(), | 1598 comments_.Add(new CodeComment(buffer_.GetPosition(), |
| 1568 String::Handle(String::New(comment)))); | 1599 String::Handle(String::New(comment)))); |
| 1569 } | 1600 } |
| 1570 } | 1601 } |
| 1571 | 1602 |
| 1572 | 1603 |
| 1573 const Code::Comments& Assembler::GetCodeComments() const { | 1604 const Code::Comments& Assembler::GetCodeComments() const { |
| 1574 Code::Comments& comments = Code::Comments::New(comments_.length()); | 1605 Code::Comments& comments = Code::Comments::New(comments_.length()); |
| 1575 | 1606 |
| 1576 for (intptr_t i = 0; i < comments_.length(); i++) { | 1607 for (intptr_t i = 0; i < comments_.length(); i++) { |
| 1577 comments.SetPCOffsetAt(i, comments_[i]->pc_offset()); | 1608 comments.SetPCOffsetAt(i, comments_[i]->pc_offset()); |
| 1578 comments.SetCommentAt(i, comments_[i]->comment()); | 1609 comments.SetCommentAt(i, comments_[i]->comment()); |
| 1579 } | 1610 } |
| 1580 | 1611 |
| 1581 return comments; | 1612 return comments; |
| 1582 } | 1613 } |
| 1583 | 1614 |
| 1584 | 1615 |
| 1585 } // namespace dart | 1616 } // namespace dart |
| 1586 | 1617 |
| 1587 #endif // defined TARGET_ARCH_IA32 | 1618 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |