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

Side by Side Diff: runtime/vm/code_generator_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 | « no previous file | runtime/vm/stub_code_ia32.cc » ('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" // Needed here to get TARGET_ARCH_IA32. 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32.
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 9
10 #include "lib/error.h" 10 #include "lib/error.h"
(...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after
1606 __ jmp(&runtime_call, Assembler::kNearJump); 1606 __ jmp(&runtime_call, Assembler::kNearJump);
1607 } 1607 }
1608 // Compare if the classes are equal. 1608 // Compare if the classes are equal.
1609 __ Bind(&compare_classes); 1609 __ Bind(&compare_classes);
1610 // If dst_type is an interface, we can skip the class equality check, 1610 // If dst_type is an interface, we can skip the class equality check,
1611 // because instances cannot be of an interface type. 1611 // because instances cannot be of an interface type.
1612 if (!dst_type_class.is_interface()) { 1612 if (!dst_type_class.is_interface()) {
1613 __ LoadObject(EDX, dst_type_class); 1613 __ LoadObject(EDX, dst_type_class);
1614 __ cmpl(EDX, ECX); 1614 __ cmpl(EDX, ECX);
1615 __ j(EQUAL, &done, Assembler::kNearJump); 1615 __ j(EQUAL, &done, Assembler::kNearJump);
1616 __ pushl(EAX); 1616 // EAX, EDX are preserved in stub, result is in EBX.
1617 __ call(&StubCode::IsRawSubTypeLabel()); 1617 __ call(&StubCode::IsRawSubTypeLabel());
1618 __ movl(EDI, EAX); 1618 // Result in EBX: 1 is raw subtype.
1619 __ popl(EAX); 1619 __ cmpl(EBX, Immediate(1));
1620 __ cmpl(EDI, Immediate(1));
1621 __ j(EQUAL, &done, Assembler::kNearJump); 1620 __ j(EQUAL, &done, Assembler::kNearJump);
1622 // Otherwise fallthrough 1621 // Otherwise fallthrough
1623 } else { 1622 } else {
1624 // However, for specific core library interfaces, we can check for 1623 // However, for specific core library interfaces, we can check for
1625 // specific core library classes. 1624 // specific core library classes.
1626 Error& malformed_error = Error::Handle(); 1625 Error& malformed_error = Error::Handle();
1627 if (dst_type.IsBoolInterface()) { 1626 if (dst_type.IsBoolInterface()) {
1628 __ movl(ECX, FieldAddress(EAX, Object::class_offset())); 1627 __ movl(ECX, FieldAddress(EAX, Object::class_offset()));
1629 const Class& bool_class = Class::ZoneHandle( 1628 const Class& bool_class = Class::ZoneHandle(
1630 Isolate::Current()->object_store()->bool_class()); 1629 Isolate::Current()->object_store()->bool_class());
(...skipping 26 matching lines...) Expand all
1657 const Class& four_byte_string_class = Class::ZoneHandle( 1656 const Class& four_byte_string_class = Class::ZoneHandle(
1658 Isolate::Current()->object_store()->four_byte_string_class()); 1657 Isolate::Current()->object_store()->four_byte_string_class());
1659 TestClassAndJump(four_byte_string_class, &done); 1658 TestClassAndJump(four_byte_string_class, &done);
1660 } else if (dst_type.IsFunctionInterface()) { 1659 } else if (dst_type.IsFunctionInterface()) {
1661 __ movl(ECX, FieldAddress(EAX, Object::class_offset())); 1660 __ movl(ECX, FieldAddress(EAX, Object::class_offset()));
1662 __ movl(ECX, FieldAddress(ECX, Class::signature_function_offset())); 1661 __ movl(ECX, FieldAddress(ECX, Class::signature_function_offset()));
1663 __ cmpl(ECX, raw_null); 1662 __ cmpl(ECX, raw_null);
1664 __ j(NOT_EQUAL, &done, Assembler::kNearJump); 1663 __ j(NOT_EQUAL, &done, Assembler::kNearJump);
1665 } else { 1664 } else {
1666 __ LoadObject(EDX, dst_type_class); 1665 __ LoadObject(EDX, dst_type_class);
1667 // EAX: Instance (preserve). 1666 // EAX: Instance (preserved).
1668 // EDX: test class 1667 // EDX: test class (preserved).
1669 __ pushl(EAX);
1670 __ call(&StubCode::IsRawSubTypeLabel()); 1668 __ call(&StubCode::IsRawSubTypeLabel());
1671 __ movl(EDI, EAX); 1669 // Result in EBX: 1 is raw subtype.
1672 __ popl(EAX); 1670 __ cmpl(EBX, Immediate(1));
1673 __ cmpl(EDI, Immediate(1));
1674 __ j(EQUAL, &done, Assembler::kNearJump); 1671 __ j(EQUAL, &done, Assembler::kNearJump);
1675 // Otherwise fallthrough 1672 // Otherwise fallthrough
1676 } 1673 }
1677 } 1674 }
1678 } 1675 }
1679 } else { 1676 } else {
1680 ASSERT(!dst_type.IsInstantiated()); 1677 ASSERT(!dst_type.IsInstantiated());
1681 // Skip check if destination is a dynamic type. 1678 // Skip check if destination is a dynamic type.
1682 if (dst_type.IsTypeParameter()) { 1679 if (dst_type.IsTypeParameter()) {
1683 // EAX must be preserved! 1680 // EAX must be preserved!
(...skipping 23 matching lines...) Expand all
1707 __ j(EQUAL, &done, Assembler::kNearJump); 1704 __ j(EQUAL, &done, Assembler::kNearJump);
1708 __ CompareObject(EDX, Type::ZoneHandle(Type::NumberInterface())); 1705 __ CompareObject(EDX, Type::ZoneHandle(Type::NumberInterface()));
1709 __ j(EQUAL, &done, Assembler::kNearJump); 1706 __ j(EQUAL, &done, Assembler::kNearJump);
1710 __ Bind(&not_smi); 1707 __ Bind(&not_smi);
1711 __ movl(EDX, FieldAddress(EDX, Type::type_class_offset())); 1708 __ movl(EDX, FieldAddress(EDX, Type::type_class_offset()));
1712 __ movl(ECX, FieldAddress(EDX, Class::type_parameters_offset())); 1709 __ movl(ECX, FieldAddress(EDX, Class::type_parameters_offset()));
1713 // Check that class of dst_type has no type parameters. 1710 // Check that class of dst_type has no type parameters.
1714 __ cmpl(ECX, raw_null); 1711 __ cmpl(ECX, raw_null);
1715 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump); 1712 __ j(NOT_EQUAL, &fall_through, Assembler::kNearJump);
1716 // We have a non-parameterized class in EDX, compare with class of 1713 // We have a non-parameterized class in EDX, compare with class of
1717 // value in EAX. 1714 // value in EAX. EAX, EDX are preserved in stub.
1718 __ pushl(EAX);
1719 __ call(&StubCode::IsRawSubTypeLabel()); 1715 __ call(&StubCode::IsRawSubTypeLabel());
1720 __ movl(EDI, EAX); 1716 // Result in EBX: 1 is raw subtype.
1721 __ popl(EAX); 1717 __ cmpl(EBX, Immediate(1));
1722 __ cmpl(EDI, Immediate(1));
1723 __ j(EQUAL, &done, Assembler::kNearJump); 1718 __ j(EQUAL, &done, Assembler::kNearJump);
1724 __ Bind(&fall_through); 1719 __ Bind(&fall_through);
1725 } 1720 }
1726 } 1721 }
1727 __ Bind(&runtime_call); 1722 __ Bind(&runtime_call);
1728 __ PushObject(Object::ZoneHandle()); // Make room for the result. 1723 __ PushObject(Object::ZoneHandle()); // Make room for the result.
1729 const Immediate location = 1724 const Immediate location =
1730 Immediate(reinterpret_cast<int32_t>(Smi::New(token_index))); 1725 Immediate(reinterpret_cast<int32_t>(Smi::New(token_index)));
1731 __ pushl(location); // Push the source location. 1726 __ pushl(location); // Push the source location.
1732 __ pushl(EAX); // Push the source object. 1727 __ pushl(EAX); // Push the source object.
(...skipping 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after
2837 const Error& error = Error::Handle( 2832 const Error& error = Error::Handle(
2838 Parser::FormatError(script, token_index, "Error", format, args)); 2833 Parser::FormatError(script, token_index, "Error", format, args));
2839 va_end(args); 2834 va_end(args);
2840 Isolate::Current()->long_jump_base()->Jump(1, error); 2835 Isolate::Current()->long_jump_base()->Jump(1, error);
2841 UNREACHABLE(); 2836 UNREACHABLE();
2842 } 2837 }
2843 2838
2844 } // namespace dart 2839 } // namespace dart
2845 2840
2846 #endif // defined TARGET_ARCH_IA32 2841 #endif // defined TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/stub_code_ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698