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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 // - Smi -> compile time subtype check (only if dst class is not parameterized). | 542 // - Smi -> compile time subtype check (only if dst class is not parameterized). |
543 // - Class equality (only if class is not parameterized). | 543 // - Class equality (only if class is not parameterized). |
544 // Inputs: | 544 // Inputs: |
545 // - R0: object. | 545 // - R0: object. |
546 // - R1: instantiator type arguments or raw_null. | 546 // - R1: instantiator type arguments or raw_null. |
547 // Returns: | 547 // Returns: |
548 // - true or false in R0. | 548 // - true or false in R0. |
549 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, | 549 void FlowGraphCompiler::GenerateInstanceOf(TokenPosition token_pos, |
550 intptr_t deopt_id, | 550 intptr_t deopt_id, |
551 const AbstractType& type, | 551 const AbstractType& type, |
552 bool negate_result, | |
553 LocationSummary* locs) { | 552 LocationSummary* locs) { |
554 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); | 553 ASSERT(type.IsFinalized() && !type.IsMalformed() && !type.IsMalbounded()); |
555 ASSERT(!type.IsObjectType() && !type.IsDynamicType()); | 554 ASSERT(!type.IsObjectType() && !type.IsDynamicType()); |
556 | 555 |
557 // Preserve instantiator type arguments (R1). | 556 // Preserve instantiator type arguments (R1). |
558 __ Push(R1); | 557 __ Push(R1); |
559 | 558 |
560 Label is_instance, is_not_instance; | 559 Label is_instance, is_not_instance; |
561 // If type is instantiated and non-parameterized, we can inline code | 560 // If type is instantiated and non-parameterized, we can inline code |
562 // checking whether the tested instance is a Smi. | 561 // checking whether the tested instance is a Smi. |
(...skipping 23 matching lines...) Expand all Loading... |
586 __ PushObject(Object::null_object()); // Make room for the result. | 585 __ PushObject(Object::null_object()); // Make room for the result. |
587 __ Push(R0); // Push the instance. | 586 __ Push(R0); // Push the instance. |
588 __ PushObject(type); // Push the type. | 587 __ PushObject(type); // Push the type. |
589 __ Push(R1); // Push instantiator type arguments (R1). | 588 __ Push(R1); // Push instantiator type arguments (R1). |
590 __ LoadUniqueObject(R0, test_cache); | 589 __ LoadUniqueObject(R0, test_cache); |
591 __ Push(R0); | 590 __ Push(R0); |
592 GenerateRuntimeCall(token_pos, deopt_id, kInstanceofRuntimeEntry, 4, locs); | 591 GenerateRuntimeCall(token_pos, deopt_id, kInstanceofRuntimeEntry, 4, locs); |
593 // Pop the parameters supplied to the runtime entry. The result of the | 592 // Pop the parameters supplied to the runtime entry. The result of the |
594 // instanceof runtime call will be left as the result of the operation. | 593 // instanceof runtime call will be left as the result of the operation. |
595 __ Drop(4); | 594 __ Drop(4); |
596 if (negate_result) { | 595 __ Pop(R0); |
597 __ Pop(R1); | |
598 __ LoadObject(R0, Bool::True()); | |
599 __ CompareRegisters(R1, R0); | |
600 __ b(&done, NE); | |
601 __ LoadObject(R0, Bool::False()); | |
602 } else { | |
603 __ Pop(R0); | |
604 } | |
605 __ b(&done); | 596 __ b(&done); |
606 } | 597 } |
607 __ Bind(&is_not_instance); | 598 __ Bind(&is_not_instance); |
608 __ LoadObject(R0, Bool::Get(negate_result)); | 599 __ LoadObject(R0, Bool::Get(false)); |
609 __ b(&done); | 600 __ b(&done); |
610 | 601 |
611 __ Bind(&is_instance); | 602 __ Bind(&is_instance); |
612 __ LoadObject(R0, Bool::Get(!negate_result)); | 603 __ LoadObject(R0, Bool::Get(true)); |
613 __ Bind(&done); | 604 __ Bind(&done); |
614 // Remove instantiator type arguments (R1). | 605 // Remove instantiator type arguments (R1). |
615 __ Drop(1); | 606 __ Drop(1); |
616 } | 607 } |
617 | 608 |
618 | 609 |
619 // Optimize assignable type check by adding inlined tests for: | 610 // Optimize assignable type check by adding inlined tests for: |
620 // - NULL -> return NULL. | 611 // - NULL -> return NULL. |
621 // - Smi -> compile time subtype check (only if dst class is not parameterized). | 612 // - Smi -> compile time subtype check (only if dst class is not parameterized). |
622 // - Class equality (only if class is not parameterized). | 613 // - Class equality (only if class is not parameterized). |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1845 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { | 1836 void ParallelMoveResolver::RestoreFpuScratch(FpuRegister reg) { |
1846 __ PopDouble(reg); | 1837 __ PopDouble(reg); |
1847 } | 1838 } |
1848 | 1839 |
1849 | 1840 |
1850 #undef __ | 1841 #undef __ |
1851 | 1842 |
1852 } // namespace dart | 1843 } // namespace dart |
1853 | 1844 |
1854 #endif // defined TARGET_ARCH_ARM64 | 1845 #endif // defined TARGET_ARCH_ARM64 |
OLD | NEW |