| 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_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 1522 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1533 if (wide) { | 1533 if (wide) { |
| 1534 EmitRegisterREX(operand, REX_W); | 1534 EmitRegisterREX(operand, REX_W); |
| 1535 } else { | 1535 } else { |
| 1536 EmitRegisterREX(operand, REX_NONE); | 1536 EmitRegisterREX(operand, REX_NONE); |
| 1537 } | 1537 } |
| 1538 EmitUint8(0xD3); | 1538 EmitUint8(0xD3); |
| 1539 EmitOperand(rm, Operand(operand)); | 1539 EmitOperand(rm, Operand(operand)); |
| 1540 } | 1540 } |
| 1541 | 1541 |
| 1542 | 1542 |
| 1543 void Assembler::LoadClassIndexOfObject(Register result, Register object) { |
| 1544 ASSERT(RawObject::kClassTagBit == 16); |
| 1545 ASSERT(RawObject::kClassTagSize == 16); |
| 1546 const intptr_t class_id_offset = Object::tags_offset() + |
| 1547 RawObject::kClassTagBit / kBitsPerByte; |
| 1548 movzxw(result, FieldAddress(object, class_id_offset)); |
| 1549 } |
| 1550 |
| 1551 |
| 1552 void Assembler::LoadClassByIndex(Register result, Register class_index) { |
| 1553 ASSERT(result != class_index); |
| 1554 movq(result, FieldAddress(CTX, Context::isolate_offset())); |
| 1555 const intptr_t table_offset_in_isolate = |
| 1556 Isolate::class_table_offset() + ClassTable::table_offset(); |
| 1557 movq(result, Address(result, table_offset_in_isolate)); |
| 1558 movq(result, Address(result, class_index, TIMES_8, 0)); |
| 1559 } |
| 1560 |
| 1561 |
| 1562 void Assembler::LoadClassOfObject(Register result, Register object) { |
| 1563 LoadClassIndexOfObject(TMP, object); |
| 1564 LoadClassByIndex(result, TMP); |
| 1565 } |
| 1566 |
| 1567 |
| 1568 void Assembler::CompareClassOfObject(Register object, const Class& clazz) { |
| 1569 LoadClassIndexOfObject(TMP, object); |
| 1570 cmpl(TMP, Immediate(clazz.index())); |
| 1571 } |
| 1572 |
| 1573 |
| 1543 void Assembler::Comment(const char* format, ...) { | 1574 void Assembler::Comment(const char* format, ...) { |
| 1544 if (FLAG_code_comments) { | 1575 if (FLAG_code_comments) { |
| 1545 char buffer[1024]; | 1576 char buffer[1024]; |
| 1546 | 1577 |
| 1547 va_list args; | 1578 va_list args; |
| 1548 va_start(args, format); | 1579 va_start(args, format); |
| 1549 OS::VSNPrint(buffer, sizeof(buffer), format, args); | 1580 OS::VSNPrint(buffer, sizeof(buffer), format, args); |
| 1550 va_end(args); | 1581 va_end(args); |
| 1551 | 1582 |
| 1552 comments_.Add(new CodeComment(buffer_.GetPosition(), | 1583 comments_.Add(new CodeComment(buffer_.GetPosition(), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 1563 comments.SetCommentAt(i, comments_[i]->comment()); | 1594 comments.SetCommentAt(i, comments_[i]->comment()); |
| 1564 } | 1595 } |
| 1565 | 1596 |
| 1566 return comments; | 1597 return comments; |
| 1567 } | 1598 } |
| 1568 | 1599 |
| 1569 | 1600 |
| 1570 } // namespace dart | 1601 } // namespace dart |
| 1571 | 1602 |
| 1572 #endif // defined TARGET_ARCH_X64 | 1603 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |