| 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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
| 6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
| 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 10 matching lines...) Expand all Loading... |
| 21 #include "vm/stub_code.h" | 21 #include "vm/stub_code.h" |
| 22 #include "vm/symbols.h" | 22 #include "vm/symbols.h" |
| 23 | 23 |
| 24 namespace dart { | 24 namespace dart { |
| 25 | 25 |
| 26 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); | 26 DEFINE_FLAG(bool, trap_on_deoptimization, false, "Trap on deoptimization."); |
| 27 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); | 27 DEFINE_FLAG(bool, unbox_mints, true, "Optimize 64-bit integer arithmetic."); |
| 28 DECLARE_FLAG(int, optimization_counter_threshold); | 28 DECLARE_FLAG(int, optimization_counter_threshold); |
| 29 DECLARE_FLAG(int, reoptimization_counter_threshold); | 29 DECLARE_FLAG(int, reoptimization_counter_threshold); |
| 30 DECLARE_FLAG(bool, enable_type_checks); | 30 DECLARE_FLAG(bool, enable_type_checks); |
| 31 DECLARE_FLAG(bool, eliminate_type_checks); | |
| 32 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); | 31 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); |
| 33 DECLARE_FLAG(bool, enable_simd_inline); | 32 DECLARE_FLAG(bool, enable_simd_inline); |
| 34 | 33 |
| 35 | 34 |
| 36 FlowGraphCompiler::~FlowGraphCompiler() { | 35 FlowGraphCompiler::~FlowGraphCompiler() { |
| 37 // BlockInfos are zone-allocated, so their destructors are not called. | 36 // BlockInfos are zone-allocated, so their destructors are not called. |
| 38 // Verify the labels explicitly here. | 37 // Verify the labels explicitly here. |
| 39 for (int i = 0; i < block_info_.length(); ++i) { | 38 for (int i = 0; i < block_info_.length(); ++i) { |
| 40 ASSERT(!block_info_[i]->jump_label()->IsLinked()); | 39 ASSERT(!block_info_[i]->jump_label()->IsLinked()); |
| 41 ASSERT(!block_info_[i]->jump_label()->HasNear()); | 40 ASSERT(!block_info_[i]->jump_label()->HasNear()); |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); | 668 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); |
| 670 __ pushl(ECX); // Store instantiator. | 669 __ pushl(ECX); // Store instantiator. |
| 671 __ pushl(EDX); // Store instantiator type arguments. | 670 __ pushl(EDX); // Store instantiator type arguments. |
| 672 // A null object is always assignable and is returned as result. | 671 // A null object is always assignable and is returned as result. |
| 673 const Immediate& raw_null = | 672 const Immediate& raw_null = |
| 674 Immediate(reinterpret_cast<intptr_t>(Object::null())); | 673 Immediate(reinterpret_cast<intptr_t>(Object::null())); |
| 675 Label is_assignable, runtime_call; | 674 Label is_assignable, runtime_call; |
| 676 __ cmpl(EAX, raw_null); | 675 __ cmpl(EAX, raw_null); |
| 677 __ j(EQUAL, &is_assignable); | 676 __ j(EQUAL, &is_assignable); |
| 678 | 677 |
| 679 if (!FLAG_eliminate_type_checks || dst_type.IsMalformed()) { | |
| 680 // If type checks are not eliminated during the graph building then | |
| 681 // a transition sentinel can be seen here. | |
| 682 const Immediate& raw_transition_sentinel = | |
| 683 Immediate(reinterpret_cast<intptr_t>( | |
| 684 Object::transition_sentinel().raw())); | |
| 685 __ cmpl(EAX, raw_transition_sentinel); | |
| 686 __ j(EQUAL, &is_assignable); | |
| 687 } | |
| 688 | |
| 689 // Generate throw new TypeError() if the type is malformed or malbounded. | 678 // Generate throw new TypeError() if the type is malformed or malbounded. |
| 690 if (dst_type.IsMalformedOrMalbounded()) { | 679 if (dst_type.IsMalformedOrMalbounded()) { |
| 691 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 680 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 692 __ pushl(EAX); // Push the source object. | 681 __ pushl(EAX); // Push the source object. |
| 693 __ PushObject(dst_name); // Push the name of the destination. | 682 __ PushObject(dst_name); // Push the name of the destination. |
| 694 __ PushObject(dst_type); // Push the type of the destination. | 683 __ PushObject(dst_type); // Push the type of the destination. |
| 695 GenerateRuntimeCall(token_pos, | 684 GenerateRuntimeCall(token_pos, |
| 696 deopt_id, | 685 deopt_id, |
| 697 kBadTypeErrorRuntimeEntry, | 686 kBadTypeErrorRuntimeEntry, |
| 698 3, | 687 3, |
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1779 __ movups(reg, Address(ESP, 0)); | 1768 __ movups(reg, Address(ESP, 0)); |
| 1780 __ addl(ESP, Immediate(kFpuRegisterSize)); | 1769 __ addl(ESP, Immediate(kFpuRegisterSize)); |
| 1781 } | 1770 } |
| 1782 | 1771 |
| 1783 | 1772 |
| 1784 #undef __ | 1773 #undef __ |
| 1785 | 1774 |
| 1786 } // namespace dart | 1775 } // namespace dart |
| 1787 | 1776 |
| 1788 #endif // defined TARGET_ARCH_IA32 | 1777 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |