| 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" |
| 11 #include "vm/compiler.h" | 11 #include "vm/compiler.h" |
| 12 #include "vm/cpu.h" | 12 #include "vm/cpu.h" |
| 13 #include "vm/dart_entry.h" | 13 #include "vm/dart_entry.h" |
| 14 #include "vm/deopt_instructions.h" | 14 #include "vm/deopt_instructions.h" |
| 15 #include "vm/il_printer.h" | 15 #include "vm/il_printer.h" |
| 16 #include "vm/locations.h" | 16 #include "vm/locations.h" |
| 17 #include "vm/object_store.h" | 17 #include "vm/object_store.h" |
| 18 #include "vm/parser.h" | 18 #include "vm/parser.h" |
| 19 #include "vm/stack_frame.h" | 19 #include "vm/stack_frame.h" |
| 20 #include "vm/stub_code.h" | 20 #include "vm/stub_code.h" |
| 21 #include "vm/symbols.h" | 21 #include "vm/symbols.h" |
| 22 | 22 |
| 23 namespace dart { | 23 namespace dart { |
| 24 | 24 |
| 25 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 25 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
| 26 DECLARE_FLAG(int, optimization_counter_threshold); | 26 DECLARE_FLAG(int, optimization_counter_threshold); |
| 27 DECLARE_FLAG(int, reoptimization_counter_threshold); | 27 DECLARE_FLAG(int, reoptimization_counter_threshold); |
| 28 DECLARE_FLAG(bool, eliminate_type_checks); | |
| 29 DECLARE_FLAG(bool, enable_simd_inline); | 28 DECLARE_FLAG(bool, enable_simd_inline); |
| 30 | 29 |
| 31 | 30 |
| 32 FlowGraphCompiler::~FlowGraphCompiler() { | 31 FlowGraphCompiler::~FlowGraphCompiler() { |
| 33 // BlockInfos are zone-allocated, so their destructors are not called. | 32 // BlockInfos are zone-allocated, so their destructors are not called. |
| 34 // Verify the labels explicitly here. | 33 // Verify the labels explicitly here. |
| 35 for (int i = 0; i < block_info_.length(); ++i) { | 34 for (int i = 0; i < block_info_.length(); ++i) { |
| 36 ASSERT(!block_info_[i]->jump_label()->IsLinked()); | 35 ASSERT(!block_info_[i]->jump_label()->IsLinked()); |
| 37 } | 36 } |
| 38 } | 37 } |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 ASSERT(dst_type.IsMalformedOrMalbounded() || | 645 ASSERT(dst_type.IsMalformedOrMalbounded() || |
| 647 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); | 646 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); |
| 648 // Preserve instantiator (R2) and its type arguments (R1). | 647 // Preserve instantiator (R2) and its type arguments (R1). |
| 649 __ Push(R2); | 648 __ Push(R2); |
| 650 __ Push(R1); | 649 __ Push(R1); |
| 651 // A null object is always assignable and is returned as result. | 650 // A null object is always assignable and is returned as result. |
| 652 Label is_assignable, runtime_call; | 651 Label is_assignable, runtime_call; |
| 653 __ CompareObject(R0, Object::null_object(), PP); | 652 __ CompareObject(R0, Object::null_object(), PP); |
| 654 __ b(&is_assignable, EQ); | 653 __ b(&is_assignable, EQ); |
| 655 | 654 |
| 656 if (!FLAG_eliminate_type_checks || dst_type.IsMalformed()) { | |
| 657 // If type checks are not eliminated during the graph building then | |
| 658 // a transition sentinel can be seen here. | |
| 659 __ CompareObject(R0, Object::transition_sentinel(), PP); | |
| 660 __ b(&is_assignable, EQ); | |
| 661 } | |
| 662 | |
| 663 // Generate throw new TypeError() if the type is malformed or malbounded. | 655 // Generate throw new TypeError() if the type is malformed or malbounded. |
| 664 if (dst_type.IsMalformedOrMalbounded()) { | 656 if (dst_type.IsMalformedOrMalbounded()) { |
| 665 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 657 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. |
| 666 __ Push(R0); // Push the source object. | 658 __ Push(R0); // Push the source object. |
| 667 __ PushObject(dst_name, PP); // Push the name of the destination. | 659 __ PushObject(dst_name, PP); // Push the name of the destination. |
| 668 __ PushObject(dst_type, PP); // Push the type of the destination. | 660 __ PushObject(dst_type, PP); // Push the type of the destination. |
| 669 GenerateRuntimeCall(token_pos, | 661 GenerateRuntimeCall(token_pos, |
| 670 deopt_id, | 662 deopt_id, |
| 671 kBadTypeErrorRuntimeEntry, | 663 kBadTypeErrorRuntimeEntry, |
| 672 3, | 664 3, |
| (...skipping 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1747 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1739 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1748 UNIMPLEMENTED(); | 1740 UNIMPLEMENTED(); |
| 1749 } | 1741 } |
| 1750 | 1742 |
| 1751 | 1743 |
| 1752 #undef __ | 1744 #undef __ |
| 1753 | 1745 |
| 1754 } // namespace dart | 1746 } // namespace dart |
| 1755 | 1747 |
| 1756 #endif // defined TARGET_ARCH_ARM64 | 1748 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |