| 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 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 // Generate runtime call. | 596 // Generate runtime call. |
| 597 // Load instantiator (R2) and its type arguments (R1). | 597 // Load instantiator (R2) and its type arguments (R1). |
| 598 __ ldm(IA, SP, (1 << R1) | (1 << R2)); | 598 __ ldm(IA, SP, (1 << R1) | (1 << R2)); |
| 599 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 599 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 600 __ Push(R0); // Push the instance. | 600 __ Push(R0); // Push the instance. |
| 601 __ PushObject(type); // Push the type. | 601 __ PushObject(type); // Push the type. |
| 602 // Push instantiator (R2) and its type arguments (R1). | 602 // Push instantiator (R2) and its type arguments (R1). |
| 603 __ PushList((1 << R1) | (1 << R2)); | 603 __ PushList((1 << R1) | (1 << R2)); |
| 604 __ LoadObject(R0, test_cache); | 604 __ LoadObject(R0, test_cache); |
| 605 __ Push(R0); | 605 __ Push(R0); |
| 606 GenerateCallRuntime(token_pos, deopt_id, kInstanceofRuntimeEntry, locs); | 606 GenerateCallRuntime(token_pos, deopt_id, kInstanceofRuntimeEntry, 5, locs); |
| 607 // Pop the parameters supplied to the runtime entry. The result of the | 607 // Pop the parameters supplied to the runtime entry. The result of the |
| 608 // instanceof runtime call will be left as the result of the operation. | 608 // instanceof runtime call will be left as the result of the operation. |
| 609 __ Drop(5); | 609 __ Drop(5); |
| 610 if (negate_result) { | 610 if (negate_result) { |
| 611 __ Pop(R1); | 611 __ Pop(R1); |
| 612 __ LoadObject(R0, Bool::True()); | 612 __ LoadObject(R0, Bool::True()); |
| 613 __ cmp(R1, ShifterOperand(R0)); | 613 __ cmp(R1, ShifterOperand(R0)); |
| 614 __ b(&done, NE); | 614 __ b(&done, NE); |
| 615 __ LoadObject(R0, Bool::False()); | 615 __ LoadObject(R0, Bool::False()); |
| 616 } else { | 616 } else { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 678 } | 678 } |
| 679 const String& error_message = String::ZoneHandle( | 679 const String& error_message = String::ZoneHandle( |
| 680 Symbols::New(error.ToErrorCString())); | 680 Symbols::New(error.ToErrorCString())); |
| 681 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 681 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 682 __ Push(R0); // Push the source object. | 682 __ Push(R0); // Push the source object. |
| 683 __ PushObject(dst_name); // Push the name of the destination. | 683 __ PushObject(dst_name); // Push the name of the destination. |
| 684 __ PushObject(error_message); | 684 __ PushObject(error_message); |
| 685 GenerateCallRuntime(token_pos, | 685 GenerateCallRuntime(token_pos, |
| 686 deopt_id, | 686 deopt_id, |
| 687 kMalformedTypeErrorRuntimeEntry, | 687 kMalformedTypeErrorRuntimeEntry, |
| 688 3, |
| 688 locs); | 689 locs); |
| 689 // We should never return here. | 690 // We should never return here. |
| 690 __ bkpt(0); | 691 __ bkpt(0); |
| 691 | 692 |
| 692 __ Bind(&is_assignable); // For a null object. | 693 __ Bind(&is_assignable); // For a null object. |
| 693 // Restore instantiator (R2) and its type arguments (R1). | 694 // Restore instantiator (R2) and its type arguments (R1). |
| 694 __ PopList((1 << R1) | (1 << R2)); | 695 __ PopList((1 << R1) | (1 << R2)); |
| 695 return; | 696 return; |
| 696 } | 697 } |
| 697 | 698 |
| 698 // Generate inline type check, linking to runtime call if not assignable. | 699 // Generate inline type check, linking to runtime call if not assignable. |
| 699 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); | 700 SubtypeTestCache& test_cache = SubtypeTestCache::ZoneHandle(); |
| 700 test_cache = GenerateInlineInstanceof(token_pos, dst_type, | 701 test_cache = GenerateInlineInstanceof(token_pos, dst_type, |
| 701 &is_assignable, &runtime_call); | 702 &is_assignable, &runtime_call); |
| 702 | 703 |
| 703 __ Bind(&runtime_call); | 704 __ Bind(&runtime_call); |
| 704 // Load instantiator (R2) and its type arguments (R1). | 705 // Load instantiator (R2) and its type arguments (R1). |
| 705 __ ldm(IA, SP, (1 << R1) | (1 << R2)); | 706 __ ldm(IA, SP, (1 << R1) | (1 << R2)); |
| 706 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 707 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 707 __ Push(R0); // Push the source object. | 708 __ Push(R0); // Push the source object. |
| 708 __ PushObject(dst_type); // Push the type of the destination. | 709 __ PushObject(dst_type); // Push the type of the destination. |
| 709 // Push instantiator (R2) and its type arguments (R1). | 710 // Push instantiator (R2) and its type arguments (R1). |
| 710 __ PushList((1 << R1) | (1 << R2)); | 711 __ PushList((1 << R1) | (1 << R2)); |
| 711 __ PushObject(dst_name); // Push the name of the destination. | 712 __ PushObject(dst_name); // Push the name of the destination. |
| 712 __ LoadObject(R0, test_cache); | 713 __ LoadObject(R0, test_cache); |
| 713 __ Push(R0); | 714 __ Push(R0); |
| 714 GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, locs); | 715 GenerateCallRuntime(token_pos, deopt_id, kTypeCheckRuntimeEntry, 6, locs); |
| 715 // Pop the parameters supplied to the runtime entry. The result of the | 716 // Pop the parameters supplied to the runtime entry. The result of the |
| 716 // type check runtime call is the checked value. | 717 // type check runtime call is the checked value. |
| 717 __ Drop(6); | 718 __ Drop(6); |
| 718 __ Pop(R0); | 719 __ Pop(R0); |
| 719 | 720 |
| 720 __ Bind(&is_assignable); | 721 __ Bind(&is_assignable); |
| 721 // Restore instantiator (R2) and its type arguments (R1). | 722 // Restore instantiator (R2) and its type arguments (R1). |
| 722 __ PopList((1 << R1) | (1 << R2)); | 723 __ PopList((1 << R1) | (1 << R2)); |
| 723 } | 724 } |
| 724 | 725 |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1249 // Add deoptimization continuation point after the call and before the | 1250 // Add deoptimization continuation point after the call and before the |
| 1250 // arguments are removed. | 1251 // arguments are removed. |
| 1251 AddCurrentDescriptor(PcDescriptors::kDeopt, deopt_id_after, token_pos); | 1252 AddCurrentDescriptor(PcDescriptors::kDeopt, deopt_id_after, token_pos); |
| 1252 } | 1253 } |
| 1253 } | 1254 } |
| 1254 | 1255 |
| 1255 | 1256 |
| 1256 void FlowGraphCompiler::GenerateCallRuntime(intptr_t token_pos, | 1257 void FlowGraphCompiler::GenerateCallRuntime(intptr_t token_pos, |
| 1257 intptr_t deopt_id, | 1258 intptr_t deopt_id, |
| 1258 const RuntimeEntry& entry, | 1259 const RuntimeEntry& entry, |
| 1260 intptr_t argument_count, |
| 1259 LocationSummary* locs) { | 1261 LocationSummary* locs) { |
| 1260 __ CallRuntime(entry); | 1262 __ CallRuntime(entry, argument_count); |
| 1261 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos); | 1263 AddCurrentDescriptor(PcDescriptors::kOther, deopt_id, token_pos); |
| 1262 RecordSafepoint(locs); | 1264 RecordSafepoint(locs); |
| 1263 if (deopt_id != Isolate::kNoDeoptId) { | 1265 if (deopt_id != Isolate::kNoDeoptId) { |
| 1264 // Marks either the continuation point in unoptimized code or the | 1266 // Marks either the continuation point in unoptimized code or the |
| 1265 // deoptimization point in optimized code, after call. | 1267 // deoptimization point in optimized code, after call. |
| 1266 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); | 1268 const intptr_t deopt_id_after = Isolate::ToDeoptAfter(deopt_id); |
| 1267 if (is_optimizing()) { | 1269 if (is_optimizing()) { |
| 1268 AddDeoptIndexAtCall(deopt_id_after, token_pos); | 1270 AddDeoptIndexAtCall(deopt_id_after, token_pos); |
| 1269 } else { | 1271 } else { |
| 1270 // Add deoptimization continuation point after the call and before the | 1272 // Add deoptimization continuation point after the call and before the |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1899 DRegister dreg = EvenDRegisterOf(reg); | 1901 DRegister dreg = EvenDRegisterOf(reg); |
| 1900 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1902 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1901 } | 1903 } |
| 1902 | 1904 |
| 1903 | 1905 |
| 1904 #undef __ | 1906 #undef __ |
| 1905 | 1907 |
| 1906 } // namespace dart | 1908 } // namespace dart |
| 1907 | 1909 |
| 1908 #endif // defined TARGET_ARCH_ARM | 1910 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |