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

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

Issue 9963032: Minor cleanup in assembly code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 8 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/code_generator_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) 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/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 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
1752 __ j(EQUAL, &ic_cache_one_arg, Assembler::kNearJump); 1752 __ j(EQUAL, &ic_cache_one_arg, Assembler::kNearJump);
1753 __ jmp(&StubCode::TwoArgsCheckInlineCacheLabel()); 1753 __ jmp(&StubCode::TwoArgsCheckInlineCacheLabel());
1754 __ Bind(&ic_cache_one_arg); 1754 __ Bind(&ic_cache_one_arg);
1755 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); 1755 __ jmp(&StubCode::OneArgCheckInlineCacheLabel());
1756 } 1756 }
1757 1757
1758 1758
1759 // Check if an instance class is a subtype of class/interface using simple 1759 // Check if an instance class is a subtype of class/interface using simple
1760 // superchain and interface array traversal. Does not take type parameters into 1760 // superchain and interface array traversal. Does not take type parameters into
1761 // account. 1761 // account.
1762 // EAX: instance. 1762 // EAX: instance (preserved)
1763 // EDX: class/interface to test against (is class of instance a subtype of it). 1763 // EDX: class/interface to test against (is class of instance a subtype of it).
1764 // Result in EDX: 1 is subtype, 0 maybe not. 1764 // (preserved).
1765 // Result in EBX: 1 is subtype, 0 maybe not.
1765 // Destroys EBX, ECX. 1766 // Destroys EBX, ECX.
1766 void StubCode::GenerateIsRawSubTypeStub(Assembler* assembler) { 1767 void StubCode::GenerateIsRawSubTypeStub(Assembler* assembler) {
1767 const Immediate raw_null = 1768 const Immediate raw_null =
1768 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1769 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1769 Label test_class, not_found, found, class_loaded_in_ECX, smi_value; 1770 Label test_class, not_found, found, class_loaded_in_ECX, smi_value;
1770 __ EnterFrame(0); 1771 __ EnterFrame(0);
1771 __ testl(EAX, Immediate(kSmiTagMask)); 1772 __ testl(EAX, Immediate(kSmiTagMask));
1772 __ j(ZERO, &smi_value, Assembler::kNearJump); 1773 __ j(ZERO, &smi_value, Assembler::kNearJump);
1773 __ movl(ECX, FieldAddress(EAX, Object::class_offset())); 1774 __ movl(ECX, FieldAddress(EAX, Object::class_offset()));
1774 __ jmp(&class_loaded_in_ECX, Assembler::kNearJump); 1775 __ jmp(&class_loaded_in_ECX, Assembler::kNearJump);
(...skipping 23 matching lines...) Expand all
1798 __ j(LESS, &not_found, Assembler::kNearJump); 1799 __ j(LESS, &not_found, Assembler::kNearJump);
1799 // EDI is Smi therefore TIMES_2 instead of TIMES_4. 1800 // EDI is Smi therefore TIMES_2 instead of TIMES_4.
1800 // Get type from array. 1801 // Get type from array.
1801 __ movl(ECX, FieldAddress(EBX, EDI, TIMES_2, Array::data_offset())); 1802 __ movl(ECX, FieldAddress(EBX, EDI, TIMES_2, Array::data_offset()));
1802 __ movl(ECX, FieldAddress(ECX, Type::type_class_offset())); 1803 __ movl(ECX, FieldAddress(ECX, Type::type_class_offset()));
1803 __ cmpl(ECX, EDX); 1804 __ cmpl(ECX, EDX);
1804 __ j(EQUAL, &found, Assembler::kNearJump); 1805 __ j(EQUAL, &found, Assembler::kNearJump);
1805 __ jmp(&array_loop, Assembler::kNearJump); 1806 __ jmp(&array_loop, Assembler::kNearJump);
1806 1807
1807 __ Bind(&not_found); 1808 __ Bind(&not_found);
1808 __ xorl(EAX, EAX); 1809 __ xorl(EBX, EBX);
1809 __ LeaveFrame(); 1810 __ LeaveFrame();
1810 __ ret(); 1811 __ ret();
1811 1812
1812 __ Bind(&found); 1813 __ Bind(&found);
1813 __ movl(EAX, Immediate(1)); 1814 __ movl(EBX, Immediate(1));
1814 __ LeaveFrame(); 1815 __ LeaveFrame();
1815 __ ret(); 1816 __ ret();
1816 1817
1817 __ Bind(&test_class); 1818 __ Bind(&test_class);
1818 // EDX: test class. 1819 // EDX: test class.
1819 __ cmpl(ECX, EDX); 1820 __ cmpl(ECX, EDX);
1820 __ j(EQUAL, &found, Assembler::kNearJump); 1821 __ j(EQUAL, &found, Assembler::kNearJump);
1821 1822
1822 // Check superclasses using a loop (faster than runtime call). 1823 // Check superclasses using a loop (faster than runtime call).
1823 Label super_loop; 1824 Label super_loop;
1824 __ Bind(&super_loop); 1825 __ Bind(&super_loop);
1825 // ECX: class -> super. 1826 // ECX: class -> super.
1826 __ movl(ECX, FieldAddress(ECX, Class::super_type_offset())); 1827 __ movl(ECX, FieldAddress(ECX, Class::super_type_offset()));
1827 // The supertype of Object is a null object. 1828 // The supertype of Object is a null object.
1828 __ cmpl(ECX, raw_null); 1829 __ cmpl(ECX, raw_null);
1829 __ j(EQUAL, &not_found, Assembler::kNearJump); 1830 __ j(EQUAL, &not_found, Assembler::kNearJump);
1830 __ movl(ECX, FieldAddress(ECX, Type::type_class_offset())); 1831 __ movl(ECX, FieldAddress(ECX, Type::type_class_offset()));
1831 __ cmpl(EDX, ECX); 1832 __ cmpl(EDX, ECX);
1832 __ j(NOT_EQUAL, &super_loop, Assembler::kNearJump); 1833 __ j(NOT_EQUAL, &super_loop, Assembler::kNearJump);
1833 __ jmp(&found, Assembler::kNearJump); 1834 __ jmp(&found, Assembler::kNearJump);
1834 } 1835 }
1835 1836
1836 1837
1837 } // namespace dart 1838 } // namespace dart
1838 1839
1839 #endif // defined TARGET_ARCH_IA32 1840 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/code_generator_ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698