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

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: Eliminate CoreClass helpers on ia32/x64 and use class ids for array classes. 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
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/code_generator_ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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::LoadClassId(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::LoadClassById(Register result, Register class_id) {
1553 ASSERT(result != class_id);
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_id, TIMES_8, 0));
1559 }
1560
1561
1562 void Assembler::LoadClass(Register result, Register object) {
1563 LoadClassId(TMP, object);
1564 LoadClassById(result, TMP);
1565 }
1566
1567
1568 void Assembler::CompareClassId(Register object, intptr_t class_id) {
1569 LoadClassId(TMP, object);
1570 cmpl(TMP, Immediate(class_id));
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
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
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/code_generator_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698