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

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

Issue 10191020: Revert change 6946. (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/object.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 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after
1726 __ j(EQUAL, &ic_cache_one_arg, Assembler::kNearJump); 1726 __ j(EQUAL, &ic_cache_one_arg, Assembler::kNearJump);
1727 __ jmp(&StubCode::TwoArgsCheckInlineCacheLabel()); 1727 __ jmp(&StubCode::TwoArgsCheckInlineCacheLabel());
1728 __ Bind(&ic_cache_one_arg); 1728 __ Bind(&ic_cache_one_arg);
1729 __ jmp(&StubCode::OneArgCheckInlineCacheLabel()); 1729 __ jmp(&StubCode::OneArgCheckInlineCacheLabel());
1730 } 1730 }
1731 1731
1732 1732
1733 // Check if an instance class is a subtype of class/interface using simple 1733 // Check if an instance class is a subtype of class/interface using simple
1734 // superchain and interface array traversal. Does not take type parameters into 1734 // superchain and interface array traversal. Does not take type parameters into
1735 // account. 1735 // account.
1736 // EAX: instance (to be preserved). 1736 // EAX: instance (preserved)
1737 // ECX: class to test.
1738 // EDX: class/interface to test against (is class of instance a subtype of it). 1737 // EDX: class/interface to test against (is class of instance a subtype of it).
1739 // (preserved). 1738 // (preserved).
1740 // Result in EBX: 1 is subtype, 0 maybe not. 1739 // Result in EBX: 1 is subtype, 0 maybe not.
1741 // Destroys EBX, EDI, ECX. 1740 // Destroys EBX, EDI, ECX.
1742 void StubCode::GenerateIsRawSubTypeStub(Assembler* assembler) { 1741 void StubCode::GenerateIsRawSubTypeStub(Assembler* assembler) {
1743 const Immediate raw_null = 1742 const Immediate raw_null =
1744 Immediate(reinterpret_cast<intptr_t>(Object::null())); 1743 Immediate(reinterpret_cast<intptr_t>(Object::null()));
1745 Label test_class, not_found, found; 1744 Label test_class, not_found, found, class_loaded_in_ECX, smi_value;
1745 __ EnterFrame(0);
1746 __ testl(EAX, Immediate(kSmiTagMask));
1747 __ j(ZERO, &smi_value, Assembler::kNearJump);
1748 __ movl(ECX, FieldAddress(EAX, Object::class_offset()));
1749 __ jmp(&class_loaded_in_ECX, Assembler::kNearJump);
1750 __ Bind(&smi_value);
1751 __ movl(ECX, FieldAddress(CTX, Context::isolate_offset()));
1752 __ movl(ECX, Address(ECX, Isolate::object_store_offset()));
1753 __ movl(ECX, Address(ECX, ObjectStore::smi_class_offset()));
1754 __ Bind(&class_loaded_in_ECX);
1746 1755
1747 __ movzxb(EBX, FieldAddress(EDX, Class::is_interface_offset())); 1756 __ movzxb(EBX, FieldAddress(EDX, Class::is_interface_offset()));
1748 // Check if we are comparing against class or interface. 1757 // Check if we are comparing against class or interface.
1749 __ cmpl(EBX, Immediate(0)); 1758 __ cmpl(EBX, Immediate(0));
1750 __ j(EQUAL, &test_class, Assembler::kNearJump); 1759 __ j(EQUAL, &test_class, Assembler::kNearJump);
1751 1760
1752 // Get interfaces array from instance class. 1761 // Get interfaces array from instance class.
1753 __ movl(EBX, FieldAddress(ECX, Class::interfaces_offset())); 1762 __ movl(EBX, FieldAddress(ECX, Class::interfaces_offset()));
1754 __ cmpl(EBX, raw_null); 1763 __ cmpl(EBX, raw_null);
1755 __ j(EQUAL, &not_found, Assembler::kNearJump); 1764 __ j(EQUAL, &not_found, Assembler::kNearJump);
1756 __ movl(EDI, FieldAddress(EBX, Array::length_offset())); 1765 __ movl(EDI, FieldAddress(EBX, Array::length_offset()));
1757 // EDI: array index. 1766 // EDI: array index.
1758 // EBX: interface array. 1767 // EBX: interface array.
1759 // EDX: interface searched 1768 // EDX: interface searched
1760 Label array_loop; 1769 Label array_loop;
1761 __ Bind(&array_loop); 1770 __ Bind(&array_loop);
1762 __ subl(EDI, Immediate(Smi::RawValue(1))); 1771 __ subl(EDI, Immediate(Smi::RawValue(1)));
1772 // __ cmpl(EDI, Immediate(0));
1763 __ j(LESS, &not_found, Assembler::kNearJump); 1773 __ j(LESS, &not_found, Assembler::kNearJump);
1764 // EDI is Smi therefore TIMES_2 instead of TIMES_4. 1774 // EDI is Smi therefore TIMES_2 instead of TIMES_4.
1765 // Get type from array. 1775 // Get type from array.
1766 __ movl(ECX, FieldAddress(EBX, EDI, TIMES_2, Array::data_offset())); 1776 __ movl(ECX, FieldAddress(EBX, EDI, TIMES_2, Array::data_offset()));
1767 __ movl(ECX, FieldAddress(ECX, Type::type_class_offset())); 1777 __ movl(ECX, FieldAddress(ECX, Type::type_class_offset()));
1768 __ cmpl(ECX, EDX); 1778 __ cmpl(ECX, EDX);
1769 __ j(EQUAL, &found, Assembler::kNearJump); 1779 __ j(EQUAL, &found, Assembler::kNearJump);
1770 __ jmp(&array_loop, Assembler::kNearJump); 1780 __ jmp(&array_loop, Assembler::kNearJump);
1771 1781
1772 __ Bind(&not_found); 1782 __ Bind(&not_found);
1773 __ xorl(EBX, EBX); 1783 __ xorl(EBX, EBX);
1784 __ LeaveFrame();
1774 __ ret(); 1785 __ ret();
1775 1786
1776 __ Bind(&found); 1787 __ Bind(&found);
1777 __ movl(EBX, Immediate(1)); 1788 __ movl(EBX, Immediate(1));
1789 __ LeaveFrame();
1778 __ ret(); 1790 __ ret();
1779 1791
1780 __ Bind(&test_class); 1792 __ Bind(&test_class);
1781 // EDX: test class. 1793 // EDX: test class.
1782 __ cmpl(ECX, EDX); 1794 __ cmpl(ECX, EDX);
1783 __ j(EQUAL, &found, Assembler::kNearJump); 1795 __ j(EQUAL, &found, Assembler::kNearJump);
1784 1796
1785 // Check superclasses using a loop (faster than runtime call). 1797 // Check superclasses using a loop (faster than runtime call).
1786 Label super_loop; 1798 Label super_loop;
1787 __ Bind(&super_loop); 1799 __ Bind(&super_loop);
1788 // ECX: class -> super. 1800 // ECX: class -> super.
1789 __ movl(ECX, FieldAddress(ECX, Class::super_type_offset())); 1801 __ movl(ECX, FieldAddress(ECX, Class::super_type_offset()));
1790 // The supertype of Object is a null object. 1802 // The supertype of Object is a null object.
1791 __ cmpl(ECX, raw_null); 1803 __ cmpl(ECX, raw_null);
1792 __ j(EQUAL, &not_found, Assembler::kNearJump); 1804 __ j(EQUAL, &not_found, Assembler::kNearJump);
1793 __ movl(ECX, FieldAddress(ECX, Type::type_class_offset())); 1805 __ movl(ECX, FieldAddress(ECX, Type::type_class_offset()));
1794 __ cmpl(EDX, ECX); 1806 __ cmpl(EDX, ECX);
1795 __ j(NOT_EQUAL, &super_loop, Assembler::kNearJump); 1807 __ j(NOT_EQUAL, &super_loop, Assembler::kNearJump);
1796 __ jmp(&found, Assembler::kNearJump); 1808 __ jmp(&found, Assembler::kNearJump);
1797 } 1809 }
1798 1810
1799 } // namespace dart 1811 } // namespace dart
1800 1812
1801 #endif // defined TARGET_ARCH_IA32 1813 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698