| 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" |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 // optional function type arguments in R2. | 517 // optional function type arguments in R2. |
| 518 // Note that this inlined code must be followed by the runtime_call code, as it | 518 // Note that this inlined code must be followed by the runtime_call code, as it |
| 519 // may fall through to it. Otherwise, this inline code will jump to the label | 519 // may fall through to it. Otherwise, this inline code will jump to the label |
| 520 // is_instance or to the label is_not_instance. | 520 // is_instance or to the label is_not_instance. |
| 521 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( | 521 RawSubtypeTestCache* FlowGraphCompiler::GenerateInlineInstanceof( |
| 522 TokenPosition token_pos, | 522 TokenPosition token_pos, |
| 523 const AbstractType& type, | 523 const AbstractType& type, |
| 524 Label* is_instance_lbl, | 524 Label* is_instance_lbl, |
| 525 Label* is_not_instance_lbl) { | 525 Label* is_not_instance_lbl) { |
| 526 __ Comment("InlineInstanceof"); | 526 __ Comment("InlineInstanceof"); |
| 527 if (type.IsVoidType()) { | |
| 528 // A non-null value is returned from a void function, which will result in a | |
| 529 // type error. A null value is handled prior to executing this inline code. | |
| 530 return SubtypeTestCache::null(); | |
| 531 } | |
| 532 if (type.IsInstantiated()) { | 527 if (type.IsInstantiated()) { |
| 533 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); | 528 const Class& type_class = Class::ZoneHandle(zone(), type.type_class()); |
| 534 // A class equality check is only applicable with a dst type (not a | 529 // A class equality check is only applicable with a dst type (not a |
| 535 // function type) of a non-parameterized class or with a raw dst type of | 530 // function type) of a non-parameterized class or with a raw dst type of |
| 536 // a parameterized class. | 531 // a parameterized class. |
| 537 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { | 532 if (type.IsFunctionType() || (type_class.NumTypeArguments() > 0)) { |
| 538 return GenerateInstantiatedTypeWithArgumentsTest( | 533 return GenerateInstantiatedTypeWithArgumentsTest( |
| 539 token_pos, type, is_instance_lbl, is_not_instance_lbl); | 534 token_pos, type, is_instance_lbl, is_not_instance_lbl); |
| 540 // Fall through to runtime call. | 535 // Fall through to runtime call. |
| 541 } | 536 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 564 // - R0: object. | 559 // - R0: object. |
| 565 // - R1: instantiator type arguments or raw_null. | 560 // - R1: instantiator type arguments or raw_null. |
| 566 // - R2: function type arguments or raw_null. | 561 // - R2: function type arguments or raw_null. |
| 567 // Returns: | 562 // Returns: |
| 568 // - true or false in R0. | 563 // - true or false in R0. |
| 569 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, | 564 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, |
| 570 intptr_t deopt_id, | 565 intptr_t deopt_id, |
| 571 const AbstractType& type, | 566 const AbstractType& type, |
| 572 LocationSummary* locs) { | 567 LocationSummary* locs) { |
| 573 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); | 568 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); |
| 574 ASSERT(!type.IsObjectType() && !type.IsDynamicType()); | 569 ASSERT(!type.IsObjectType() && !type.IsDynamicType() && !type.IsVoidType()); |
| 575 const Register kInstantiatorTypeArgumentsReg = R1; | 570 const Register kInstantiatorTypeArgumentsReg = R1; |
| 576 const Register kFunctionTypeArgumentsReg = R2; | 571 const Register kFunctionTypeArgumentsReg = R2; |
| 577 __ PushPair(kFunctionTypeArgumentsReg, kInstantiatorTypeArgumentsReg); | 572 __ PushPair(kFunctionTypeArgumentsReg, kInstantiatorTypeArgumentsReg); |
| 578 Label is_instance, is_not_instance; | 573 Label is_instance, is_not_instance; |
| 579 // If type is instantiated and non-parameterized, we can inline code | 574 // If type is instantiated and non-parameterized, we can inline code |
| 580 // checking whether the tested instance is a Smi. | 575 // checking whether the tested instance is a Smi. |
| 581 if (type.IsInstantiated()) { | 576 if (type.IsInstantiated()) { |
| 582 // A null object is only an instance of Null, Object, and dynamic. | 577 // A null object is only an instance of Null, Object, and dynamic. |
| 583 // Object and dynamic have already been checked above (if the type is | 578 // Object and dynamic have already been checked above (if the type is |
| 584 // instantiated). So we can return false here if the instance is null, | 579 // instantiated). So we can return false here if the instance is null, |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 643 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, | 638 void FlowGraphCompiler::GenerateAssertAssignable(TokenPosition token_pos, |
| 644 intptr_t deopt_id, | 639 intptr_t deopt_id, |
| 645 const AbstractType& dst_type, | 640 const AbstractType& dst_type, |
| 646 const String& dst_name, | 641 const String& dst_name, |
| 647 LocationSummary* locs) { | 642 LocationSummary* locs) { |
| 648 ASSERT(!TokenPosition(token_pos).IsClassifying()); | 643 ASSERT(!TokenPosition(token_pos).IsClassifying()); |
| 649 ASSERT(!dst_type.IsNull()); | 644 ASSERT(!dst_type.IsNull()); |
| 650 ASSERT(dst_type.IsFinalized()); | 645 ASSERT(dst_type.IsFinalized()); |
| 651 // Assignable check is skipped in FlowGraphBuilder, not here. | 646 // Assignable check is skipped in FlowGraphBuilder, not here. |
| 652 ASSERT(dst_type.IsMalformedOrMalbounded() || | 647 ASSERT(dst_type.IsMalformedOrMalbounded() || |
| 653 (!dst_type.IsDynamicType() && !dst_type.IsObjectType())); | 648 (!dst_type.IsDynamicType() && !dst_type.IsObjectType() && |
| 649 !dst_type.IsVoidType())); |
| 654 const Register kInstantiatorTypeArgumentsReg = R1; | 650 const Register kInstantiatorTypeArgumentsReg = R1; |
| 655 const Register kFunctionTypeArgumentsReg = R2; | 651 const Register kFunctionTypeArgumentsReg = R2; |
| 656 __ PushPair(kFunctionTypeArgumentsReg, kInstantiatorTypeArgumentsReg); | 652 __ PushPair(kFunctionTypeArgumentsReg, kInstantiatorTypeArgumentsReg); |
| 657 // A null object is always assignable and is returned as result. | 653 // A null object is always assignable and is returned as result. |
| 658 Label is_assignable, runtime_call; | 654 Label is_assignable, runtime_call; |
| 659 __ CompareObject(R0, Object::null_object()); | 655 __ CompareObject(R0, Object::null_object()); |
| 660 __ b(&is_assignable, EQ); | 656 __ b(&is_assignable, EQ); |
| 661 | 657 |
| 662 // Generate throw new TypeError() if the type is malformed or malbounded. | 658 // Generate throw new TypeError() if the type is malformed or malbounded. |
| 663 if (dst_type.IsMalformedOrMalbounded()) { | 659 if (dst_type.IsMalformedOrMalbounded()) { |
| (...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1776 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1772 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
| 1777 __ PopDouble(reg); | 1773 __ PopDouble(reg); |
| 1778 } | 1774 } |
| 1779 | 1775 |
| 1780 | 1776 |
| 1781 #undef __ | 1777 #undef __ |
| 1782 | 1778 |
| 1783 } // namespace dart | 1779 } // namespace dart |
| 1784 | 1780 |
| 1785 #endif // defined TARGET_ARCH_ARM64 | 1781 #endif // defined TARGET_ARCH_ARM64 |
| OLD | NEW |