| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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_ARM64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_ARM64. |
| 6 #if defined(TARGET_ARCH_ARM64) | 6 #if defined(TARGET_ARCH_ARM64) |
| 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 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 579 test_cache = GenerateInlineInstanceof(token_pos, type, | 579 test_cache = GenerateInlineInstanceof(token_pos, type, |
| 580 &is_instance, &is_not_instance); | 580 &is_instance, &is_not_instance); |
| 581 | 581 |
| 582 // test_cache is null if there is no fall-through. | 582 // test_cache is null if there is no fall-through. |
| 583 Label done; | 583 Label done; |
| 584 if (!test_cache.IsNull()) { | 584 if (!test_cache.IsNull()) { |
| 585 // Generate runtime call. | 585 // Generate runtime call. |
| 586 // Load instantiator (R2) and its type arguments (R1). | 586 // Load instantiator (R2) and its type arguments (R1). |
| 587 __ ldr(R1, Address(SP, 0 * kWordSize)); | 587 __ ldr(R1, Address(SP, 0 * kWordSize)); |
| 588 __ ldr(R2, Address(SP, 1 * kWordSize)); | 588 __ ldr(R2, Address(SP, 1 * kWordSize)); |
| 589 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 589 __ PushObject(Object::null_object(), PP); // Make room for the result. |
| 590 __ Push(R0); // Push the instance. | 590 __ Push(R0); // Push the instance. |
| 591 __ PushObject(type, PP); // Push the type. | 591 __ PushObject(type, PP); // Push the type. |
| 592 // Push instantiator (R2) and its type arguments (R1). | 592 // Push instantiator (R2) and its type arguments (R1). |
| 593 __ Push(R2); | 593 __ Push(R2); |
| 594 __ Push(R1); | 594 __ Push(R1); |
| 595 __ LoadObject(R0, test_cache, PP); | 595 __ LoadObject(R0, test_cache, PP); |
| 596 __ Push(R0); | 596 __ Push(R0); |
| 597 GenerateRuntimeCall(token_pos, deopt_id, kInstanceofRuntimeEntry, 5, locs); | 597 GenerateRuntimeCall(token_pos, deopt_id, kInstanceofRuntimeEntry, 5, locs); |
| 598 // Pop the parameters supplied to the runtime entry. The result of the | 598 // Pop the parameters supplied to the runtime entry. The result of the |
| 599 // instanceof runtime call will be left as the result of the operation. | 599 // instanceof runtime call will be left as the result of the operation. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 647 // Preserve instantiator (R2) and its type arguments (R1). | 647 // Preserve instantiator (R2) and its type arguments (R1). |
| 648 __ Push(R2); | 648 __ Push(R2); |
| 649 __ Push(R1); | 649 __ Push(R1); |
| 650 // A null object is always assignable and is returned as result. | 650 // A null object is always assignable and is returned as result. |
| 651 Label is_assignable, runtime_call; | 651 Label is_assignable, runtime_call; |
| 652 __ CompareObject(R0, Object::null_object(), PP); | 652 __ CompareObject(R0, Object::null_object(), PP); |
| 653 __ b(&is_assignable, EQ); | 653 __ b(&is_assignable, EQ); |
| 654 | 654 |
| 655 // Generate throw new TypeError() if the type is malformed or malbounded. | 655 // Generate throw new TypeError() if the type is malformed or malbounded. |
| 656 if (dst_type.IsMalformedOrMalbounded()) { | 656 if (dst_type.IsMalformedOrMalbounded()) { |
| 657 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 657 __ PushObject(Object::null_object(), PP); // Make room for the result. |
| 658 __ Push(R0); // Push the source object. | 658 __ Push(R0); // Push the source object. |
| 659 __ PushObject(dst_name, PP); // Push the name of the destination. | 659 __ PushObject(dst_name, PP); // Push the name of the destination. |
| 660 __ PushObject(dst_type, PP); // Push the type of the destination. | 660 __ PushObject(dst_type, PP); // Push the type of the destination. |
| 661 GenerateRuntimeCall(token_pos, | 661 GenerateRuntimeCall(token_pos, |
| 662 deopt_id, | 662 deopt_id, |
| 663 kBadTypeErrorRuntimeEntry, | 663 kBadTypeErrorRuntimeEntry, |
| 664 3, | 664 3, |
| 665 locs); | 665 locs); |
| 666 // We should never return here. | 666 // We should never return here. |
| 667 __ brk(0); | 667 __ brk(0); |
| 668 | 668 |
| 669 __ Bind(&is_assignable); // For a null object. | 669 __ Bind(&is_assignable); // For a null object. |
| 670 // Restore instantiator (R2) and its type arguments (R1). | 670 // Restore instantiator (R2) and its type arguments (R1). |
| 671 __ Pop(R1); | 671 __ Pop(R1); |
| 672 __ Pop(R2); | 672 __ Pop(R2); |
| 673 return; | 673 return; |
| 674 } | 674 } |
| 675 | 675 |
| 676 // Generate inline type check, linking to runtime call if not assignable. | 676 // Generate inline type check, linking to runtime call if not assignable. |
| 677 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); | 677 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); |
| 678 test_cache = GenerateInlineInstanceof(token_pos, dst_type, | 678 test_cache = GenerateInlineInstanceof(token_pos, dst_type, |
| 679 &is_assignable, &runtime_call); | 679 &is_assignable, &runtime_call); |
| 680 | 680 |
| 681 __ Bind(&runtime_call); | 681 __ Bind(&runtime_call); |
| 682 // Load instantiator (R2) and its type arguments (R1). | 682 // Load instantiator (R2) and its type arguments (R1). |
| 683 __ ldr(R1, Address(SP)); | 683 __ ldr(R1, Address(SP)); |
| 684 __ ldr(R2, Address(SP, 1 * kWordSize)); | 684 __ ldr(R2, Address(SP, 1 * kWordSize)); |
| 685 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 685 __ PushObject(Object::null_object(), PP); // Make room for the result. |
| 686 __ Push(R0); // Push the source object. | 686 __ Push(R0); // Push the source object. |
| 687 __ PushObject(dst_type, PP); // Push the type of the destination. | 687 __ PushObject(dst_type, PP); // Push the type of the destination. |
| 688 // Push instantiator (R2) and its type arguments (R1). | 688 // Push instantiator (R2) and its type arguments (R1). |
| 689 __ Push(R2); | 689 __ Push(R2); |
| 690 __ Push(R1); | 690 __ Push(R1); |
| 691 __ PushObject(dst_name, PP); // Push the name of the destination. | 691 __ PushObject(dst_name, PP); // Push the name of the destination. |
| 692 __ LoadObject(R0, test_cache, PP); | 692 __ LoadObject(R0, test_cache, PP); |
| 693 __ Push(R0); | 693 __ Push(R0); |
| 694 GenerateRuntimeCall(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs); | 694 GenerateRuntimeCall(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs); |
| 695 // Pop the parameters supplied to the runtime entry. The result of the | 695 // Pop the parameters supplied to the runtime entry. The result of the |
| (...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1726 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1727 UNIMPLEMENTED(); | 1727 UNIMPLEMENTED(); |
| 1728 } | 1728 } |
| 1729 | 1729 |
| 1730 | 1730 |
| 1731 #undef __ | 1731 #undef __ |
| 1732 | 1732 |
| 1733 } // namespace dart | 1733 } // namespace dart |
| 1734 | 1734 |
| 1735 #endif // defined TARGET_ARCH_ARM64 | 1735 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |