| 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 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 // - R0: object. | 559 // - R0: object. |
| 560 // - R1: instantiator type arguments or raw_null. | 560 // - R1: instantiator type arguments or raw_null. |
| 561 // - R2: instantiator or raw_null. | 561 // - R2: instantiator or raw_null. |
| 562 // Returns: | 562 // Returns: |
| 563 // - true or false in R0. | 563 // - true or false in R0. |
| 564 void FlowGraphCompiler::GenerateInstanceOf(intptr_t token_pos, | 564 void FlowGraphCompiler::GenerateInstanceOf(intptr_t token_pos, |
| 565 intptr_t deopt_id, | 565 intptr_t deopt_id, |
| 566 const AbstractType& type, | 566 const AbstractType& type, |
| 567 bool negate_result, | 567 bool negate_result, |
| 568 LocationSummary* locs) { | 568 LocationSummary* locs) { |
| 569 ASSERT(type.IsFinalized() && !type.IsMalformed()); | 569 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); |
| 570 | 570 |
| 571 // Preserve instantiator (R2) and its type arguments (R1). | 571 // Preserve instantiator (R2) and its type arguments (R1). |
| 572 __ PushList((1 << R1) | (1 << R2)); | 572 __ PushList((1 << R1) | (1 << R2)); |
| 573 | 573 |
| 574 Label is_instance, is_not_instance; | 574 Label is_instance, is_not_instance; |
| 575 // If type is instantiated and non-parameterized, we can inline code | 575 // If type is instantiated and non-parameterized, we can inline code |
| 576 // checking whether the tested instance is a Smi. | 576 // checking whether the tested instance is a Smi. |
| 577 if (type.IsInstantiated()) { | 577 if (type.IsInstantiated()) { |
| 578 // A null object is only an instance of Object and dynamic, which has | 578 // A null object is only an instance of Object and dynamic, which has |
| 579 // already been checked above (if the type is instantiated). So we can | 579 // already been checked above (if the type is instantiated). So we can |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 // as they throw an exception. | 645 // as they throw an exception. |
| 646 void FlowGraphCompiler::GenerateAssertAssignable(intptr_t token_pos, | 646 void FlowGraphCompiler::GenerateAssertAssignable(intptr_t token_pos, |
| 647 intptr_t deopt_id, | 647 intptr_t deopt_id, |
| 648 const AbstractType& dst_type, | 648 const AbstractType& dst_type, |
| 649 const String& dst_name, | 649 const String& dst_name, |
| 650 LocationSummary* locs) { | 650 LocationSummary* locs) { |
| 651 ASSERT(token_pos >= 0); | 651 ASSERT(token_pos >= 0); |
| 652 ASSERT(!dst_type.IsNull()); | 652 ASSERT(!dst_type.IsNull()); |
| 653 ASSERT(dst_type.IsFinalized()); | 653 ASSERT(dst_type.IsFinalized()); |
| 654 // Assignable check is skipped in FlowGraphBuilder, not here. | 654 // Assignable check is skipped in FlowGraphBuilder, not here. |
| 655 ASSERT(dst_type.IsMalformed() || | 655 ASSERT(dst_type.IsMalformed() || dst_type.IsMalbounded() || |
| 656 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); | 656 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); |
| 657 // Preserve instantiator (R2) and its type arguments (R1). | 657 // Preserve instantiator (R2) and its type arguments (R1). |
| 658 __ PushList((1 << R1) | (1 << R2)); | 658 __ PushList((1 << R1) | (1 << R2)); |
| 659 // A null object is always assignable and is returned as result. | 659 // A null object is always assignable and is returned as result. |
| 660 Label is_assignable, runtime_call; | 660 Label is_assignable, runtime_call; |
| 661 __ CompareImmediate(R0, reinterpret_cast<int32_t>(Object::null())); | 661 __ CompareImmediate(R0, reinterpret_cast<int32_t>(Object::null())); |
| 662 __ b(&is_assignable, EQ); | 662 __ b(&is_assignable, EQ); |
| 663 | 663 |
| 664 if (!FLAG_eliminate_type_checks || dst_type.IsMalformed()) { | 664 if (!FLAG_eliminate_type_checks || dst_type.IsMalformed()) { |
| 665 // If type checks are not eliminated during the graph building then | 665 // If type checks are not eliminated during the graph building then |
| 666 // a transition sentinel can be seen here. | 666 // a transition sentinel can be seen here. |
| 667 __ CompareObject(R0, Object::transition_sentinel()); | 667 __ CompareObject(R0, Object::transition_sentinel()); |
| 668 __ b(&is_assignable, EQ); | 668 __ b(&is_assignable, EQ); |
| 669 } | 669 } |
| 670 | 670 |
| 671 // Generate throw new TypeError() if the type is malformed. | 671 // Generate throw new TypeError() if the type is malformed or malbounded. |
| 672 if (dst_type.IsMalformed()) { | 672 if (dst_type.IsMalformed() || dst_type.IsMalbounded()) { |
| 673 const Error& error = Error::Handle(dst_type.malformed_error()); | 673 Error& error = Error::Handle(); |
| 674 if (dst_type.IsMalformed()) { |
| 675 error = dst_type.malformed_error(); |
| 676 } else { |
| 677 const bool is_malbounded = dst_type.IsMalboundedWithError(&error); |
| 678 ASSERT(is_malbounded); |
| 679 } |
| 674 const String& error_message = String::ZoneHandle( | 680 const String& error_message = String::ZoneHandle( |
| 675 Symbols::New(error.ToErrorCString())); | 681 Symbols::New(error.ToErrorCString())); |
| 676 __ PushObject(Object::ZoneHandle()); // Make room for the result. | 682 __ PushObject(Object::ZoneHandle()); // Make room for the result. |
| 677 __ Push(R0); // Push the source object. | 683 __ Push(R0); // Push the source object. |
| 678 __ PushObject(dst_name); // Push the name of the destination. | 684 __ PushObject(dst_name); // Push the name of the destination. |
| 679 __ PushObject(error_message); | 685 __ PushObject(error_message); |
| 680 GenerateCallRuntime(token_pos, | 686 GenerateCallRuntime(token_pos, |
| 681 deopt_id, | 687 deopt_id, |
| 682 kMalformedTypeErrorRuntimeEntry, | 688 kMalformedTypeErrorRuntimeEntry, |
| 683 locs); | 689 locs); |
| (...skipping 1216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1900 DRegister dreg = EvenDRegisterOf(reg); | 1906 DRegister dreg = EvenDRegisterOf(reg); |
| 1901 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); | 1907 __ vldrd(dreg, Address(SP, kDoubleSize, Address::PostIndex)); |
| 1902 } | 1908 } |
| 1903 | 1909 |
| 1904 | 1910 |
| 1905 #undef __ | 1911 #undef __ |
| 1906 | 1912 |
| 1907 } // namespace dart | 1913 } // namespace dart |
| 1908 | 1914 |
| 1909 #endif // defined TARGET_ARCH_ARM | 1915 #endif // defined TARGET_ARCH_ARM |
| OLD | NEW |