Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(164)

Side by Side Diff: runtime/vm/assembler_x64.cc

Issue 10458031: In generated code for x64 don't load object's class directly from class_ field. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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,
1563 Register object,
1564 Register scratch) {
srdjan 2012/05/30 16:44:00 You do not need to pass scratch, use TMP register
1565 LoadClassIndexOfObject(scratch, object);
1566 LoadClassByIndex(result, scratch);
1567 }
1568
1569
1570 void Assembler::CompareClassOfObject(Register object,
1571 const Class& clazz,
1572 Register scratch) {
srdjan 2012/05/30 16:44:00 ditto
1573 LoadClassIndexOfObject(scratch, object);
1574 cmpl(scratch, Immediate(clazz.index()));
1575 }
1576
1577
1543 void Assembler::Comment(const char* format, ...) { 1578 void Assembler::Comment(const char* format, ...) {
1544 if (FLAG_code_comments) { 1579 if (FLAG_code_comments) {
1545 char buffer[1024]; 1580 char buffer[1024];
1546 1581
1547 va_list args; 1582 va_list args;
1548 va_start(args, format); 1583 va_start(args, format);
1549 OS::VSNPrint(buffer, sizeof(buffer), format, args); 1584 OS::VSNPrint(buffer, sizeof(buffer), format, args);
1550 va_end(args); 1585 va_end(args);
1551 1586
1552 comments_.Add(new CodeComment(buffer_.GetPosition(), 1587 comments_.Add(new CodeComment(buffer_.GetPosition(),
(...skipping 10 matching lines...) Expand all
1563 comments.SetCommentAt(i, comments_[i]->comment()); 1598 comments.SetCommentAt(i, comments_[i]->comment());
1564 } 1599 }
1565 1600
1566 return comments; 1601 return comments;
1567 } 1602 }
1568 1603
1569 1604
1570 } // namespace dart 1605 } // namespace dart
1571 1606
1572 #endif // defined TARGET_ARCH_X64 1607 #endif // defined TARGET_ARCH_X64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698