| 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_X64. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_X64. |
| 6 #if defined(TARGET_ARCH_X64) | 6 #if defined(TARGET_ARCH_X64) |
| 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 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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(RAX, Object::transition_sentinel(), PP); | 667 __ CompareObject(RAX, Object::transition_sentinel(), PP); |
| 668 __ j(EQUAL, &is_assignable); | 668 __ j(EQUAL, &is_assignable); |
| 669 } | 669 } |
| 670 | 670 |
| 671 // Generate throw new TypeError() if the type is malformed or malbounded. | 671 // Generate throw new TypeError() if the type is malformed or malbounded. |
| 672 if (dst_type.IsMalformed() || dst_type.IsMalbounded()) { | 672 if (dst_type.IsMalformed() || dst_type.IsMalbounded()) { |
| 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 } | |
| 680 const String& error_message = String::ZoneHandle( | |
| 681 Symbols::New(error.ToErrorCString())); | |
| 682 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. | 673 __ PushObject(Object::ZoneHandle(), PP); // Make room for the result. |
| 683 __ pushq(RAX); // Push the source object. | 674 __ pushq(RAX); // Push the source object. |
| 684 __ PushObject(dst_name, PP); // Push the name of the destination. | 675 __ PushObject(dst_name, PP); // Push the name of the destination. |
| 685 __ PushObject(error_message, PP); | 676 __ PushObject(dst_type, PP); // Push the type of the destination. |
| 686 GenerateRuntimeCall(token_pos, | 677 GenerateRuntimeCall(token_pos, |
| 687 deopt_id, | 678 deopt_id, |
| 688 kMalformedTypeErrorRuntimeEntry, | 679 kBadTypeErrorRuntimeEntry, |
| 689 3, | 680 3, |
| 690 locs); | 681 locs); |
| 691 // We should never return here. | 682 // We should never return here. |
| 692 __ int3(); | 683 __ int3(); |
| 693 | 684 |
| 694 __ Bind(&is_assignable); // For a null object. | 685 __ Bind(&is_assignable); // For a null object. |
| 695 __ popq(RDX); // Remove pushed instantiator type arguments. | 686 __ popq(RDX); // Remove pushed instantiator type arguments. |
| 696 __ popq(RCX); // Remove pushed instantiator. | 687 __ popq(RCX); // Remove pushed instantiator. |
| 697 return; | 688 return; |
| 698 } | 689 } |
| (...skipping 1248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1947 __ movups(reg, Address(RSP, 0)); | 1938 __ movups(reg, Address(RSP, 0)); |
| 1948 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); | 1939 __ AddImmediate(RSP, Immediate(kFpuRegisterSize), PP); |
| 1949 } | 1940 } |
| 1950 | 1941 |
| 1951 | 1942 |
| 1952 #undef __ | 1943 #undef __ |
| 1953 | 1944 |
| 1954 } // namespace dart | 1945 } // namespace dart |
| 1955 | 1946 |
| 1956 #endif // defined TARGET_ARCH_X64 | 1947 #endif // defined TARGET_ARCH_X64 |
| OLD | NEW |