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

Side by Side Diff: vm/stub_code_x64.cc

Issue 10827209: Unify class ids and snapshot object ids list so that we don't have disparate and sometimes confusin… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 4 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 | « vm/stub_code_ia32.cc ('k') | vm/symbols.h » ('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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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/assembler_macros.h" 9 #include "vm/assembler_macros.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 __ cmpq(RBX, Immediate(RawObject::SizeTag::kMaxSizeTag)); 690 __ cmpq(RBX, Immediate(RawObject::SizeTag::kMaxSizeTag));
691 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump); 691 __ j(ABOVE, &size_tag_overflow, Assembler::kNearJump);
692 __ shlq(RBX, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2)); 692 __ shlq(RBX, Immediate(RawObject::kSizeTagBit - kObjectAlignmentLog2));
693 __ jmp(&done); 693 __ jmp(&done);
694 694
695 __ Bind(&size_tag_overflow); 695 __ Bind(&size_tag_overflow);
696 __ movq(RBX, Immediate(0)); 696 __ movq(RBX, Immediate(0));
697 __ Bind(&done); 697 __ Bind(&done);
698 698
699 // Get the class index and insert it into the tags. 699 // Get the class index and insert it into the tags.
700 __ orq(RBX, Immediate(RawObject::ClassIdTag::encode(kArray))); 700 __ orq(RBX, Immediate(RawObject::ClassIdTag::encode(kArrayCid)));
701 __ movq(FieldAddress(RAX, Array::tags_offset()), RBX); 701 __ movq(FieldAddress(RAX, Array::tags_offset()), RBX);
702 } 702 }
703 703
704 // Initialize all array elements to raw_null. 704 // Initialize all array elements to raw_null.
705 // RAX: new object start as a tagged pointer. 705 // RAX: new object start as a tagged pointer.
706 // R12: new object end address. 706 // R12: new object end address.
707 __ leaq(RBX, FieldAddress(RAX, Array::data_offset())); 707 __ leaq(RBX, FieldAddress(RAX, Array::data_offset()));
708 // RBX: iterator which initially points to the start of the variable 708 // RBX: iterator which initially points to the start of the variable
709 // data area to be initialized. 709 // data area to be initialized.
710 Label done; 710 Label done;
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
1223 // RDI: new object type arguments. 1223 // RDI: new object type arguments.
1224 } 1224 }
1225 1225
1226 // RAX: new object start. 1226 // RAX: new object start.
1227 // RBX: next object start. 1227 // RBX: next object start.
1228 // RDI: new object type arguments (if is_cls_parameterized). 1228 // RDI: new object type arguments (if is_cls_parameterized).
1229 __ LoadObject(RDX, cls); // Load class of object to be allocated. 1229 __ LoadObject(RDX, cls); // Load class of object to be allocated.
1230 // Set the tags. 1230 // Set the tags.
1231 uword tags = 0; 1231 uword tags = 0;
1232 tags = RawObject::SizeTag::update(instance_size, tags); 1232 tags = RawObject::SizeTag::update(instance_size, tags);
1233 ASSERT(cls.id() != kIllegalObjectKind); 1233 ASSERT(cls.id() != kIllegalCid);
1234 tags = RawObject::ClassIdTag::update(cls.id(), tags); 1234 tags = RawObject::ClassIdTag::update(cls.id(), tags);
1235 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags)); 1235 __ movq(Address(RAX, Instance::tags_offset()), Immediate(tags));
1236 1236
1237 // Initialize the remaining words of the object. 1237 // Initialize the remaining words of the object.
1238 const Immediate raw_null = 1238 const Immediate raw_null =
1239 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1239 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1240 1240
1241 // RAX: new object start. 1241 // RAX: new object start.
1242 // RBX: next object start. 1242 // RBX: next object start.
1243 // RDX: class of the object to be allocated. 1243 // RDX: class of the object to be allocated.
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
1613 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1613 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1614 Label loop, found; 1614 Label loop, found;
1615 if (num_args == 1) { 1615 if (num_args == 1) {
1616 __ call(&get_class_id_as_smi); 1616 __ call(&get_class_id_as_smi);
1617 // RAX: receiver's class id as Smi. 1617 // RAX: receiver's class id as Smi.
1618 __ Bind(&loop); 1618 __ Bind(&loop);
1619 __ movq(R13, Address(R12, 0)); // Get class if (Smi) to check. 1619 __ movq(R13, Address(R12, 0)); // Get class if (Smi) to check.
1620 __ cmpq(RAX, R13); // Match? 1620 __ cmpq(RAX, R13); // Match?
1621 __ j(EQUAL, &found, Assembler::kNearJump); 1621 __ j(EQUAL, &found, Assembler::kNearJump);
1622 __ addq(R12, Immediate(kWordSize * 2)); // Next element (class + target). 1622 __ addq(R12, Immediate(kWordSize * 2)); // Next element (class + target).
1623 __ cmpq(R13, Immediate(Smi::RawValue(kIllegalObjectKind))); // Done? 1623 __ cmpq(R13, Immediate(Smi::RawValue(kIllegalCid))); // Done?
1624 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); 1624 __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
1625 } else if (num_args == 2) { 1625 } else if (num_args == 2) {
1626 Label no_match; 1626 Label no_match;
1627 __ Bind(&loop); 1627 __ Bind(&loop);
1628 // Get receiver. 1628 // Get receiver.
1629 __ movq(RAX, FieldAddress(R10, Array::data_offset())); 1629 __ movq(RAX, FieldAddress(R10, Array::data_offset()));
1630 __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi. 1630 __ movq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi.
1631 __ call(&get_class_id_as_smi); 1631 __ call(&get_class_id_as_smi);
1632 __ movq(R13, Address(R12, 0)); // Get class id from IC data to check. 1632 __ movq(R13, Address(R12, 0)); // Get class id from IC data to check.
1633 __ cmpq(RAX, R13); // Class id match? 1633 __ cmpq(RAX, R13); // Class id match?
1634 __ j(NOT_EQUAL, &no_match, Assembler::kNearJump); 1634 __ j(NOT_EQUAL, &no_match, Assembler::kNearJump);
1635 // Check second. 1635 // Check second.
1636 // Get next argument. 1636 // Get next argument.
1637 __ movq(RAX, FieldAddress(R10, Array::data_offset())); 1637 __ movq(RAX, FieldAddress(R10, Array::data_offset()));
1638 __ movq(RAX, Address(RSP, RAX, TIMES_4, -kWordSize)); // RAX is Smi. 1638 __ movq(RAX, Address(RSP, RAX, TIMES_4, -kWordSize)); // RAX is Smi.
1639 __ call(&get_class_id_as_smi); 1639 __ call(&get_class_id_as_smi);
1640 __ movq(R13, Address(R12, kWordSize)); // Get class id from IC data. 1640 __ movq(R13, Address(R12, kWordSize)); // Get class id from IC data.
1641 __ cmpq(RAX, R13); // Class id match? 1641 __ cmpq(RAX, R13); // Class id match?
1642 __ j(EQUAL, &found); 1642 __ j(EQUAL, &found);
1643 __ Bind(&no_match); 1643 __ Bind(&no_match);
1644 __ addq(R12, Immediate(kWordSize * (1 + num_args))); // Next element. 1644 __ addq(R12, Immediate(kWordSize * (1 + num_args))); // Next element.
1645 __ cmpq(R13, Immediate(Smi::RawValue(kIllegalObjectKind))); // Done? 1645 __ cmpq(R13, Immediate(Smi::RawValue(kIllegalCid))); // Done?
1646 __ j(NOT_EQUAL, &loop, Assembler::kNearJump); 1646 __ j(NOT_EQUAL, &loop, Assembler::kNearJump);
1647 } 1647 }
1648 1648
1649 __ Bind(&ic_miss); 1649 __ Bind(&ic_miss);
1650 // Compute address of arguments (first read number of arguments from argument 1650 // Compute address of arguments (first read number of arguments from argument
1651 // descriptor array and then compute address on the stack). 1651 // descriptor array and then compute address on the stack).
1652 __ movq(RAX, FieldAddress(R10, Array::data_offset())); 1652 __ movq(RAX, FieldAddress(R10, Array::data_offset()));
1653 __ leaq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi. 1653 __ leaq(RAX, Address(RSP, RAX, TIMES_4, 0)); // RAX is Smi.
1654 AssemblerMacros::EnterStubFrame(assembler); 1654 AssemblerMacros::EnterStubFrame(assembler);
1655 __ pushq(R10); // Preserve arguments array. 1655 __ pushq(R10); // Preserve arguments array.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1690 __ movq(RAX, FieldAddress(RAX, Function::code_offset())); 1690 __ movq(RAX, FieldAddress(RAX, Function::code_offset()));
1691 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset())); 1691 __ movq(RAX, FieldAddress(RAX, Code::instructions_offset()));
1692 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag)); 1692 __ addq(RAX, Immediate(Instructions::HeaderSize() - kHeapObjectTag));
1693 __ jmp(RAX); 1693 __ jmp(RAX);
1694 1694
1695 __ Bind(&get_class_id_as_smi); 1695 __ Bind(&get_class_id_as_smi);
1696 Label not_smi; 1696 Label not_smi;
1697 // Test if Smi -> load Smi class for comparison. 1697 // Test if Smi -> load Smi class for comparison.
1698 __ testq(RAX, Immediate(kSmiTagMask)); 1698 __ testq(RAX, Immediate(kSmiTagMask));
1699 __ j(NOT_ZERO, &not_smi, Assembler::kNearJump); 1699 __ j(NOT_ZERO, &not_smi, Assembler::kNearJump);
1700 __ movq(RAX, Immediate(Smi::RawValue(kSmi))); 1700 __ movq(RAX, Immediate(Smi::RawValue(kSmiCid)));
1701 __ ret(); 1701 __ ret();
1702 1702
1703 __ Bind(&not_smi); 1703 __ Bind(&not_smi);
1704 __ LoadClassId(RAX, RAX); 1704 __ LoadClassId(RAX, RAX);
1705 __ SmiTag(RAX); 1705 __ SmiTag(RAX);
1706 __ ret(); 1706 __ ret();
1707 } 1707 }
1708 1708
1709 1709
1710 // Use inline cache data array to invoke the target or continue in inline 1710 // Use inline cache data array to invoke the target or continue in inline
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) { 1934 void StubCode::GenerateJumpToErrorHandlerStub(Assembler* assembler) {
1935 __ movq(RAX, RCX); // error object. 1935 __ movq(RAX, RCX); // error object.
1936 __ movq(RBP, RDX); // target frame_pointer. 1936 __ movq(RBP, RDX); // target frame_pointer.
1937 __ movq(RSP, RSI); // target stack_pointer. 1937 __ movq(RSP, RSI); // target stack_pointer.
1938 __ jmp(RDI); // Jump to the exception handler code. 1938 __ jmp(RDI); // Jump to the exception handler code.
1939 } 1939 }
1940 1940
1941 } // namespace dart 1941 } // namespace dart
1942 1942
1943 #endif // defined TARGET_ARCH_X64 1943 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « vm/stub_code_ia32.cc ('k') | vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698