| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/flow_graph_compiler.h" | 8 #include "vm/flow_graph_compiler.h" |
| 9 | 9 |
| 10 #include "vm/ast_printer.h" | 10 #include "vm/ast_printer.h" |
| (...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); | 596 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); |
| 597 test_cache = GenerateInlineInstanceof(token_pos, type, | 597 test_cache = GenerateInlineInstanceof(token_pos, type, |
| 598 &is_instance, &is_not_instance); | 598 &is_instance, &is_not_instance); |
| 599 | 599 |
| 600 // test_cache is null if there is no fall-through. | 600 // test_cache is null if there is no fall-through. |
| 601 Label done; | 601 Label done; |
| 602 if (!test_cache.IsNull()) { | 602 if (!test_cache.IsNull()) { |
| 603 // Generate runtime call. | 603 // Generate runtime call. |
| 604 __ movl(EDX, Address(ESP, 0)); // Get instantiator type arguments. | 604 __ movl(EDX, Address(ESP, 0)); // Get instantiator type arguments. |
| 605 __ movl(ECX, Address(ESP, kWordSize)); // Get instantiator. | 605 __ movl(ECX, Address(ESP, kWordSize)); // Get instantiator. |
| 606 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 606 __ PushObject(Object::null_object()); // Make room for the result. |
| 607 __ pushl(EAX); // Push the instance. | 607 __ pushl(EAX); // Push the instance. |
| 608 __ PushObject(type); // Push the type. | 608 __ PushObject(type); // Push the type. |
| 609 __ pushl(ECX); // Instantiator. | 609 __ pushl(ECX); // Instantiator. |
| 610 __ pushl(EDX); // Instantiator type arguments. | 610 __ pushl(EDX); // Instantiator type arguments. |
| 611 __ LoadObject(EAX, test_cache); | 611 __ LoadObject(EAX, test_cache); |
| 612 __ pushl(EAX); | 612 __ pushl(EAX); |
| 613 GenerateRuntimeCall(token_pos, | 613 GenerateRuntimeCall(token_pos, |
| 614 deopt_id, | 614 deopt_id, |
| 615 kInstanceofRuntimeEntry, | 615 kInstanceofRuntimeEntry, |
| 616 5, | 616 5, |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 __ pushl(EDX); // Store instantiator type arguments. | 668 __ pushl(EDX); // Store instantiator type arguments. |
| 669 // A null object is always assignable and is returned as result. | 669 // A null object is always assignable and is returned as result. |
| 670 const Immediate& raw_null = | 670 const Immediate& raw_null = |
| 671 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 671 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 672 Label is_assignable, runtime_call; | 672 Label is_assignable, runtime_call; |
| 673 __ cmpl(EAX, raw_null); | 673 __ cmpl(EAX, raw_null); |
| 674 __ j(EQUAL, &is_assignable); | 674 __ j(EQUAL, &is_assignable); |
| 675 | 675 |
| 676 // Generate throw new TypeError() if the type is malformed or malbounded. | 676 // Generate throw new TypeError() if the type is malformed or malbounded. |
| 677 if (dst_type.IsMalformedOrMalbounded()) { | 677 if (dst_type.IsMalformedOrMalbounded()) { |
| 678 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 678 __ PushObject(Object::null_object()); // Make room for the result. |
| 679 __ pushl(EAX); // Push the source object. | 679 __ pushl(EAX); // Push the source object. |
| 680 __ PushObject(dst_name); // Push the name of the destination. | 680 __ PushObject(dst_name); // Push the name of the destination. |
| 681 __ PushObject(dst_type); // Push the type of the destination. | 681 __ PushObject(dst_type); // Push the type of the destination. |
| 682 GenerateRuntimeCall(token_pos, | 682 GenerateRuntimeCall(token_pos, |
| 683 deopt_id, | 683 deopt_id, |
| 684 kBadTypeErrorRuntimeEntry, | 684 kBadTypeErrorRuntimeEntry, |
| 685 3, | 685 3, |
| 686 locs); | 686 locs); |
| 687 // We should never return here. | 687 // We should never return here. |
| 688 __ int3(); | 688 __ int3(); |
| 689 | 689 |
| 690 __ Bind(&is_assignable); // For a null object. | 690 __ Bind(&is_assignable); // For a null object. |
| 691 __ popl(EDX); // Remove pushed instantiator type arguments. | 691 __ popl(EDX); // Remove pushed instantiator type arguments. |
| 692 __ popl(ECX); // Remove pushed instantiator. | 692 __ popl(ECX); // Remove pushed instantiator. |
| 693 return; | 693 return; |
| 694 } | 694 } |
| 695 | 695 |
| 696 // Generate inline type check, linking to runtime call if not assignable. | 696 // Generate inline type check, linking to runtime call if not assignable. |
| 697 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); | 697 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); |
| 698 test_cache = GenerateInlineInstanceof(token_pos, dst_type, | 698 test_cache = GenerateInlineInstanceof(token_pos, dst_type, |
| 699 &is_assignable, &runtime_call); | 699 &is_assignable, &runtime_call); |
| 700 | 700 |
| 701 __ Bind(&runtime_call); | 701 __ Bind(&runtime_call); |
| 702 __ movl(EDX, Address(ESP, 0)); // Get instantiator type arguments. | 702 __ movl(EDX, Address(ESP, 0)); // Get instantiator type arguments. |
| 703 __ movl(ECX, Address(ESP, kWordSize)); // Get instantiator. | 703 __ movl(ECX, Address(ESP, kWordSize)); // Get instantiator. |
| 704 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 704 __ PushObject(Object::null_object()); // Make room for the result. |
| 705 __ pushl(EAX); // Push the source object. | 705 __ pushl(EAX); // Push the source object. |
| 706 __ PushObject(dst_type); // Push the type of the destination. | 706 __ PushObject(dst_type); // Push the type of the destination. |
| 707 __ pushl(ECX); // Instantiator. | 707 __ pushl(ECX); // Instantiator. |
| 708 __ pushl(EDX); // Instantiator type arguments. | 708 __ pushl(EDX); // Instantiator type arguments. |
| 709 __ PushObject(dst_name); // Push the name of the destination. | 709 __ PushObject(dst_name); // Push the name of the destination. |
| 710 __ LoadObject(EAX, test_cache); | 710 __ LoadObject(EAX, test_cache); |
| 711 __ pushl(EAX); | 711 __ pushl(EAX); |
| 712 GenerateRuntimeCall(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs); | 712 GenerateRuntimeCall(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs); |
| 713 // Pop the parameters supplied to the runtime entry. The result of the | 713 // Pop the parameters supplied to the runtime entry. The result of the |
| 714 // type check runtime call is the checked value. | 714 // type check runtime call is the checked value. |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1756 __ movups(reg, Address(ESP, 0)); | 1756 __ movups(reg, Address(ESP, 0)); |
| 1757 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1757 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1758 } | 1758 } |
| 1759 | 1759 |
| 1760 | 1760 |
| 1761 #undef __ | 1761 #undef __ |
| 1762 | 1762 |
| 1763 } // namespace dart | 1763 } // namespace dart |
| 1764 | 1764 |
| 1765 #endif // defined TARGET_ARCH_IA32 | 1765 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |