| 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_MIPS. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_MIPS. |
| 6 #if defined(TARGET_ARCH_MIPS) | 6 #if defined(TARGET_ARCH_MIPS) |
| 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/dart_entry.h" | 12 #include "vm/dart_entry.h" |
| 13 #include "vm/deopt_instructions.h" | 13 #include "vm/deopt_instructions.h" |
| 14 #include "vm/il_printer.h" | 14 #include "vm/il_printer.h" |
| 15 #include "vm/locations.h" | 15 #include "vm/locations.h" |
| 16 #include "vm/object_store.h" | 16 #include "vm/object_store.h" |
| 17 #include "vm/parser.h" | 17 #include "vm/parser.h" |
| 18 #include "vm/stack_frame.h" | 18 #include "vm/stack_frame.h" |
| 19 #include "vm/stub_code.h" | 19 #include "vm/stub_code.h" |
| 20 #include "vm/symbols.h" | 20 #include "vm/symbols.h" |
| 21 | 21 |
| 22 namespace dart { | 22 namespace dart { |
| 23 | 23 |
| 24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 24 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
| 25 DECLARE_FLAG(int, optimization_counter_threshold); | 25 DECLARE_FLAG(int, optimization_counter_threshold); |
| 26 DECLARE_FLAG(int, reoptimization_counter_threshold); | 26 DECLARE_FLAG(int, reoptimization_counter_threshold); |
| 27 DECLARE_FLAG(bool, enable_type_checks); | 27 DECLARE_FLAG(bool, enable_type_checks); |
| 28 DECLARE_FLAG(bool, eliminate_type_checks); | |
| 29 | 28 |
| 30 | 29 |
| 31 FlowGraphCompiler::~FlowGraphCompiler() { | 30 FlowGraphCompiler::~FlowGraphCompiler() { |
| 32 // BlockInfos are zone-allocated, so their destructors are not called. | 31 // BlockInfos are zone-allocated, so their destructors are not called. |
| 33 // Verify the labels explicitly here. | 32 // Verify the labels explicitly here. |
| 34 for (int i = 0; i < block_info_.length(); ++i) { | 33 for (int i = 0; i < block_info_.length(); ++i) { |
| 35 ASSERT(!block_info_[i]->jump_label()->IsLinked()); | 34 ASSERT(!block_info_[i]->jump_label()->IsLinked()); |
| 36 } | 35 } |
| 37 } | 36 } |
| 38 | 37 |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 // Preserve instantiator and its type arguments. | 654 // Preserve instantiator and its type arguments. |
| 656 __ addiu(SP, SP, Immediate(-2 * kWordSize)); | 655 __ addiu(SP, SP, Immediate(-2 * kWordSize)); |
| 657 __ sw(A2, Address(SP, 1 * kWordSize)); | 656 __ sw(A2, Address(SP, 1 * kWordSize)); |
| 658 | 657 |
| 659 // A null object is always assignable and is returned as result. | 658 // A null object is always assignable and is returned as result. |
| 660 Label is_assignable, runtime_call; | 659 Label is_assignable, runtime_call; |
| 661 | 660 |
| 662 __ BranchEqual(A0, reinterpret_cast<int32_t>(Object::null()), &is_assignable); | 661 __ BranchEqual(A0, reinterpret_cast<int32_t>(Object::null()), &is_assignable); |
| 663 __ delay_slot()->sw(A1, Address(SP, 0 * kWordSize)); | 662 __ delay_slot()->sw(A1, Address(SP, 0 * kWordSize)); |
| 664 | 663 |
| 665 if (!FLAG_eliminate_type_checks || dst_type.IsMalformed()) { | |
| 666 // If type checks are not eliminated during the graph building then | |
| 667 // a transition sentinel can be seen here. | |
| 668 __ BranchEqual(A0, Object::transition_sentinel(), &is_assignable); | |
| 669 } | |
| 670 | |
| 671 // Generate throw new TypeError() if the type is malformed or malbounded. | 664 // Generate throw new TypeError() if the type is malformed or malbounded. |
| 672 if (dst_type.IsMalformedOrMalbounded()) { | 665 if (dst_type.IsMalformedOrMalbounded()) { |
| 673 __ addiu(SP, SP, Immediate(-4 * kWordSize)); | 666 __ addiu(SP, SP, Immediate(-4 * kWordSize)); |
| 674 __ LoadObject(TMP, Object::ZoneHandle()); | 667 __ LoadObject(TMP, Object::ZoneHandle()); |
| 675 __ sw(TMP, Address(SP, 3 * kWordSize)); // Make room for the result. | 668 __ sw(TMP, Address(SP, 3 * kWordSize)); // Make room for the result. |
| 676 __ sw(A0, Address(SP, 2 * kWordSize)); // Push the source object. | 669 __ sw(A0, Address(SP, 2 * kWordSize)); // Push the source object. |
| 677 __ LoadObject(TMP, dst_name); | 670 __ LoadObject(TMP, dst_name); |
| 678 __ sw(TMP, Address(SP, 1 * kWordSize)); // Push the destination name. | 671 __ sw(TMP, Address(SP, 1 * kWordSize)); // Push the destination name. |
| 679 __ LoadObject(TMP, dst_type); | 672 __ LoadObject(TMP, dst_type); |
| 680 __ sw(TMP, Address(SP, 0 * kWordSize)); // Push the destination type. | 673 __ sw(TMP, Address(SP, 0 * kWordSize)); // Push the destination type. |
| (...skipping 1146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1827 __ AddImmediate(SP, kDoubleSize); | 1820 __ AddImmediate(SP, kDoubleSize); |
| 1828 } | 1821 } |
| 1829 | 1822 |
| 1830 | 1823 |
| 1831 #undef __ | 1824 #undef __ |
| 1832 | 1825 |
| 1833 | 1826 |
| 1834 } // namespace dart | 1827 } // namespace dart |
| 1835 | 1828 |
| 1836 #endif // defined TARGET_ARCH_MIPS | 1829 #endif // defined TARGET_ARCH_MIPS |
| OLD | NEW |