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

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

Issue 10381045: Improve type checking, remove unused stub (removed also in x64 in preparation of porting the better… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | 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/code_generator.h" 8 #include "vm/code_generator.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/object_store.h" 10 #include "vm/object_store.h"
(...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after
1717 Label ic_cache_one_arg; 1717 Label ic_cache_one_arg;
1718 __ movq(RCX, FieldAddress(RBX, ICData::num_args_tested_offset())); 1718 __ movq(RCX, FieldAddress(RBX, ICData::num_args_tested_offset()));
1719 __ cmpq(RCX, Immediate(1)); 1719 __ cmpq(RCX, Immediate(1));
1720 __ j(EQUAL, &ic_cache_one_arg, Assembler::kNearJump); 1720 __ j(EQUAL, &ic_cache_one_arg, Assembler::kNearJump);
1721 __ jmp(&StubCode::TwoArgsCheckInlineCacheLabel()); 1721 __ jmp(&StubCode::TwoArgsCheckInlineCacheLabel());
1722 __ Bind(&ic_cache_one_arg); 1722 __ Bind(&ic_cache_one_arg);
1723 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); 1723 __ jmp(&StubCode::OneArgCheckInlineCacheLabel());
1724 } 1724 }
1725 1725
1726 1726
1727 // Check if an instance class is a subtype of class/interface using simple
1728 // superchain and interface array traversal. Does not take type parameters into
1729 // account.
1730 // RAX: instance (preserved)
1731 // RCX: class/interface to test against (is class of instance a subtype of it).
1732 // (preserved).
1733 // Result in RBX: 1 is subtype, 0 maybe not.
1734 // Must preserve RDX.
1735 // Destroys RBX, R13, R10.
1736 void StubCode::GenerateIsRawSubTypeStub(Assembler* assembler) {
1737 const Immediate raw_null =
1738 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1739 Label test_class, not_found, found, class_loaded_in_R10, smi_value;
1740 __ EnterFrame(0);
1741 __ testq(RAX, Immediate(kSmiTagMask));
1742 __ j(ZERO, &smi_value, Assembler::kNearJump);
1743 __ movq(R10, FieldAddress(RAX, Object::class_offset()));
1744 __ jmp(&class_loaded_in_R10, Assembler::kNearJump);
1745 __ Bind(&smi_value);
1746 __ movq(R10, FieldAddress(CTX, Context::isolate_offset()));
1747 __ movq(R10, Address(R10, Isolate::object_store_offset()));
1748 __ movq(R10, Address(R10, ObjectStore::smi_class_offset()));
1749 __ Bind(&class_loaded_in_R10);
1750
1751 __ movzxb(RBX, FieldAddress(RCX, Class::is_interface_offset()));
1752 // Check if we are comparing against class or interface.
1753 __ cmpq(RBX, Immediate(0));
1754 __ j(EQUAL, &test_class, Assembler::kNearJump);
1755
1756 // Get interfaces array from instance class.
1757 __ movq(RBX, FieldAddress(R10, Class::interfaces_offset()));
1758 __ cmpq(RBX, raw_null);
1759 __ j(EQUAL, &not_found, Assembler::kNearJump);
1760 __ movq(R13, FieldAddress(RBX, Array::length_offset()));
1761 // R13: array index.
1762 // RBX: interface array.
1763 // RCX: interface searched
1764 Label array_loop;
1765 __ Bind(&array_loop);
1766 __ subq(R13, Immediate(Smi::RawValue(1)));
1767 // __ cmpq(R13, Immediate(0));
1768 __ j(LESS, &not_found, Assembler::kNearJump);
1769 // R13 is Smi therefore TIMES_4 instead of TIMES_8.
1770 // Get type from array.
1771 __ movq(R10, FieldAddress(RBX, R13, TIMES_4, Array::data_offset()));
1772 __ movq(R10, FieldAddress(R10, Type::type_class_offset()));
1773 __ cmpq(R10, RCX);
1774 __ j(EQUAL, &found, Assembler::kNearJump);
1775 __ jmp(&array_loop, Assembler::kNearJump);
1776
1777 __ Bind(&not_found);
1778 __ xorq(RBX, RBX);
1779 __ LeaveFrame();
1780 __ ret();
1781
1782 __ Bind(&found);
1783 __ movq(RBX, Immediate(1));
1784 __ LeaveFrame();
1785 __ ret();
1786
1787 __ Bind(&test_class);
1788 // RCX: test class.
1789 __ cmpq(R10, RCX);
1790 __ j(EQUAL, &found, Assembler::kNearJump);
1791
1792 // Check superclasses using a loop (faster than runtime call).
1793 Label super_loop;
1794 __ Bind(&super_loop);
1795 // R10: class -> super.
1796 __ movq(R10, FieldAddress(R10, Class::super_type_offset()));
1797 // The supertype of Object is a null object.
1798 __ cmpq(R10, raw_null);
1799 __ j(EQUAL, &not_found, Assembler::kNearJump);
1800 __ movq(R10, FieldAddress(R10, Type::type_class_offset()));
1801 __ cmpq(RCX, R10);
1802 __ j(NOT_EQUAL, &super_loop, Assembler::kNearJump);
1803 __ jmp(&found, Assembler::kNearJump);
1804 }
1805
1806
1807 void StubCode::GenerateSubtype1TestCacheStub(Assembler* assembler) { 1727 void StubCode::GenerateSubtype1TestCacheStub(Assembler* assembler) {
1808 __ Unimplemented("Subtype1TestCache Stub"); 1728 __ Unimplemented("Subtype1TestCache Stub");
1809 } 1729 }
1810 1730
1811 void StubCode::GenerateSubtype2TestCacheStub(Assembler* assembler) { 1731 void StubCode::GenerateSubtype2TestCacheStub(Assembler* assembler) {
1812 __ Unimplemented("Subtype2TestCache Stub"); 1732 __ Unimplemented("Subtype2TestCache Stub");
1813 } 1733 }
1814 1734
1815 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) { 1735 void StubCode::GenerateSubtype3TestCacheStub(Assembler* assembler) {
1816 __ Unimplemented("Subtype3TestCache Stub"); 1736 __ Unimplemented("Subtype3TestCache Stub");
1817 } 1737 }
1818 1738
1819 } // namespace dart 1739 } // namespace dart
1820 1740
1821 #endif // defined TARGET_ARCH_X64 1741 #endif // defined TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « runtime/vm/stub_code_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698