| 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_ARM. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM. |
| 6 #if defined(TARGET_ARCH_ARM) | 6 #if defined(TARGET_ARCH_ARM) |
| 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); | 586 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); |
| 587 test_cache = GenerateInlineInstanceof(token_pos, type, | 587 test_cache = GenerateInlineInstanceof(token_pos, type, |
| 588 &is_instance, &is_not_instance); | 588 &is_instance, &is_not_instance); |
| 589 | 589 |
| 590 // test_cache is null if there is no fall-through. | 590 // test_cache is null if there is no fall-through. |
| 591 Label done; | 591 Label done; |
| 592 if (!test_cache.IsNull()) { | 592 if (!test_cache.IsNull()) { |
| 593 // Generate runtime call. | 593 // Generate runtime call. |
| 594 // Load instantiator (R2) and its type arguments (R1). | 594 // Load instantiator (R2) and its type arguments (R1). |
| 595 __ ldm(IA, SP, (1 << R1) | (1 << R2)); | 595 __ ldm(IA, SP, (1 << R1) | (1 << R2)); |
| 596 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 596 __ PushObject(Object::null_object()); // Make room for the result. |
| 597 __ Push(R0); // Push the instance. | 597 __ Push(R0); // Push the instance. |
| 598 __ PushObject(type); // Push the type. | 598 __ PushObject(type); // Push the type. |
| 599 // Push instantiator (R2) and its type arguments (R1). | 599 // Push instantiator (R2) and its type arguments (R1). |
| 600 __ PushList((1 << R1) | (1 << R2)); | 600 __ PushList((1 << R1) | (1 << R2)); |
| 601 __ LoadObject(R0, test_cache); | 601 __ LoadObject(R0, test_cache); |
| 602 __ Push(R0); | 602 __ Push(R0); |
| 603 GenerateRuntimeCall(token_pos, deopt_id, kInstanceofRuntimeEntry, 5, locs); | 603 GenerateRuntimeCall(token_pos, deopt_id, kInstanceofRuntimeEntry, 5, locs); |
| 604 // Pop the parameters supplied to the runtime entry. The result of the | 604 // Pop the parameters supplied to the runtime entry. The result of the |
| 605 // instanceof runtime call will be left as the result of the operation. | 605 // instanceof runtime call will be left as the result of the operation. |
| 606 __ Drop(5); | 606 __ Drop(5); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); | 652 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); |
| 653 // Preserve instantiator (R2) and its type arguments (R1). | 653 // Preserve instantiator (R2) and its type arguments (R1). |
| 654 __ PushList((1 << R1) | (1 << R2)); | 654 __ PushList((1 << R1) | (1 << R2)); |
| 655 // A null object is always assignable and is returned as result. | 655 // A null object is always assignable and is returned as result. |
| 656 Label is_assignable, runtime_call; | 656 Label is_assignable, runtime_call; |
| 657 __ CompareImmediate(R0, reinterpret_cast<int32_t>(Object::null())); | 657 __ CompareImmediate(R0, reinterpret_cast<int32_t>(Object::null())); |
| 658 __ b(&is_assignable, EQ); | 658 __ b(&is_assignable, EQ); |
| 659 | 659 |
| 660 // Generate throw new TypeError() if the type is malformed or malbounded. | 660 // Generate throw new TypeError() if the type is malformed or malbounded. |
| 661 if (dst_type.IsMalformedOrMalbounded()) { | 661 if (dst_type.IsMalformedOrMalbounded()) { |
| 662 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 662 __ PushObject(Object::null_object()); // Make room for the result. |
| 663 __ Push(R0); // Push the source object. | 663 __ Push(R0); // Push the source object. |
| 664 __ PushObject(dst_name); // Push the name of the destination. | 664 __ PushObject(dst_name); // Push the name of the destination. |
| 665 __ PushObject(dst_type); // Push the type of the destination. | 665 __ PushObject(dst_type); // Push the type of the destination. |
| 666 GenerateRuntimeCall(token_pos, | 666 GenerateRuntimeCall(token_pos, |
| 667 deopt_id, | 667 deopt_id, |
| 668 kBadTypeErrorRuntimeEntry, | 668 kBadTypeErrorRuntimeEntry, |
| 669 3, | 669 3, |
| 670 locs); | 670 locs); |
| 671 // We should never return here. | 671 // We should never return here. |
| 672 __ bkpt(0); | 672 __ bkpt(0); |
| 673 | 673 |
| 674 __ Bind(&is_assignable); // For a null object. | 674 __ Bind(&is_assignable); // For a null object. |
| 675 // Restore instantiator (R2) and its type arguments (R1). | 675 // Restore instantiator (R2) and its type arguments (R1). |
| 676 __ PopList((1 << R1) | (1 << R2)); | 676 __ PopList((1 << R1) | (1 << R2)); |
| 677 return; | 677 return; |
| 678 } | 678 } |
| 679 | 679 |
| 680 // Generate inline type check, linking to runtime call if not assignable. | 680 // Generate inline type check, linking to runtime call if not assignable. |
| 681 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); | 681 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); |
| 682 test_cache = GenerateInlineInstanceof(token_pos, dst_type, | 682 test_cache = GenerateInlineInstanceof(token_pos, dst_type, |
| 683 &is_assignable, &runtime_call); | 683 &is_assignable, &runtime_call); |
| 684 | 684 |
| 685 __ Bind(&runtime_call); | 685 __ Bind(&runtime_call); |
| 686 // Load instantiator (R2) and its type arguments (R1). | 686 // Load instantiator (R2) and its type arguments (R1). |
| 687 __ ldm(IA, SP, (1 << R1) | (1 << R2)); | 687 __ ldm(IA, SP, (1 << R1) | (1 << R2)); |
| 688 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 688 __ PushObject(Object::null_object()); // Make room for the result. |
| 689 __ Push(R0); // Push the source object. | 689 __ Push(R0); // Push the source object. |
| 690 __ PushObject(dst_type); // Push the type of the destination. | 690 __ PushObject(dst_type); // Push the type of the destination. |
| 691 // Push instantiator (R2) and its type arguments (R1). | 691 // Push instantiator (R2) and its type arguments (R1). |
| 692 __ PushList((1 << R1) | (1 << R2)); | 692 __ PushList((1 << R1) | (1 << R2)); |
| 693 __ PushObject(dst_name); // Push the name of the destination. | 693 __ PushObject(dst_name); // Push the name of the destination. |
| 694 __ LoadObject(R0, test_cache); | 694 __ LoadObject(R0, test_cache); |
| 695 __ Push(R0); | 695 __ Push(R0); |
| 696 GenerateRuntimeCall(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs); | 696 GenerateRuntimeCall(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs); |
| 697 // Pop the parameters supplied to the runtime entry. The result of the | 697 // Pop the parameters supplied to the runtime entry. The result of the |
| 698 // type check runtime call is the checked value. | 698 // type check runtime call is the checked value. |
| (...skipping 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1762 DRegister dreg = EvenDRegisterOf(reg); | 1762 DRegister dreg = EvenDRegisterOf(reg); |
| 1763 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1763 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1764 } | 1764 } |
| 1765 | 1765 |
| 1766 | 1766 |
| 1767 #undef __ | 1767 #undef __ |
| 1768 | 1768 |
| 1769 } // namespace dart | 1769 } // namespace dart |
| 1770 | 1770 |
| 1771 #endif // defined TARGET_ARCH_ARM | 1771 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |