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

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

Issue 10450014: Request for comments on overall approach. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix scavenger and freelist handling Created 8 years, 7 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_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
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::GetClassOf(Register result, Register object, Register scratch) {
1566 ASSERT(scratch != result);
1567 LoadObjectClassId(scratch, object);
1568
1569 movl(result, FieldAddress(CTX, Context::isolate_offset()));
1570 const intptr_t table_offset_in_isolate =
1571 Isolate::class_table_offset() + ClassTable::table_offset();
1572 movl(result, Address(result, table_offset_in_isolate));
1573 movl(result, Address(result, scratch, TIMES_4, 0));
1574 }
1575
1576
1577 void Assembler::LoadObjectClassId(Register result, Register object) {
1578 ASSERT(RawObject::kClassTagBit == 16);
1579 ASSERT(RawObject::kClassTagSize == 16);
1580 const intptr_t class_id_offset = Object::tags_offset() +
1581 RawObject::kClassTagBit / kBitsPerByte;
1582 movzxw(result, FieldAddress(object, class_id_offset));
1583 }
1584
1585
1586 void Assembler::CompareClassOf(Register object,
1587 const Class& clazz,
1588 Register scratch) {
1589 // TODO(vegorov): find all occurances of comparison pattern.
1590 LoadObjectClassId(scratch, object);
1591 CompareClassId(scratch, clazz);
1592 }
1593
1594
1565 void Assembler::Comment(const char* comment) { 1595 void Assembler::Comment(const char* comment) {
1566 if (FLAG_code_comments) { 1596 if (FLAG_code_comments) {
1567 comments_.Add(new CodeComment(buffer_.GetPosition(), 1597 comments_.Add(new CodeComment(buffer_.GetPosition(),
1568 String::Handle(String::New(comment)))); 1598 String::Handle(String::New(comment))));
1569 } 1599 }
1570 } 1600 }
1571 1601
1572 1602
1573 const Code::Comments& Assembler::GetCodeComments() const { 1603 const Code::Comments& Assembler::GetCodeComments() const {
1574 Code::Comments& comments = Code::Comments::New(comments_.length()); 1604 Code::Comments& comments = Code::Comments::New(comments_.length());
1575 1605
1576 for (intptr_t i = 0; i < comments_.length(); i++) { 1606 for (intptr_t i = 0; i < comments_.length(); i++) {
1577 comments.SetPCOffsetAt(i, comments_[i]->pc_offset()); 1607 comments.SetPCOffsetAt(i, comments_[i]->pc_offset());
1578 comments.SetCommentAt(i, comments_[i]->comment()); 1608 comments.SetCommentAt(i, comments_[i]->comment());
1579 } 1609 }
1580 1610
1581 return comments; 1611 return comments;
1582 } 1612 }
1583 1613
1584 1614
1585 } // namespace dart 1615 } // namespace dart
1586 1616
1587 #endif // defined TARGET_ARCH_IA32 1617 #endif // defined TARGET_ARCH_IA32
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698