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/intermediate_language.h" | 8 #include "vm/intermediate_language.h" |
9 | 9 |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 __ testq(val_reg, Immediate(kSmiTagMask)); | 677 __ testq(val_reg, Immediate(kSmiTagMask)); |
678 __ j(ZERO, result ? labels.true_label : labels.false_label); | 678 __ j(ZERO, result ? labels.true_label : labels.false_label); |
679 __ LoadClassId(cid_reg, val_reg); | 679 __ LoadClassId(cid_reg, val_reg); |
680 for (intptr_t i = 2; i < data.length(); i += 2) { | 680 for (intptr_t i = 2; i < data.length(); i += 2) { |
681 const intptr_t test_cid = data[i]; | 681 const intptr_t test_cid = data[i]; |
682 ASSERT(test_cid != kSmiCid); | 682 ASSERT(test_cid != kSmiCid); |
683 result = data[i + 1] == true_result; | 683 result = data[i + 1] == true_result; |
684 __ cmpq(cid_reg, Immediate(test_cid)); | 684 __ cmpq(cid_reg, Immediate(test_cid)); |
685 __ j(EQUAL, result ? labels.true_label : labels.false_label); | 685 __ j(EQUAL, result ? labels.true_label : labels.false_label); |
686 } | 686 } |
687 // No match found, deoptimize or false. | 687 // No match found, deoptimize or default action. |
688 if (deopt == NULL) { | 688 if (deopt == NULL) { |
| 689 // If the cid is not in the list, jump to the opposite label from the cids |
| 690 // that are in the list. These must be all the same (see asserts in the |
| 691 // constructor). |
689 Label* target = result ? labels.false_label : labels.true_label; | 692 Label* target = result ? labels.false_label : labels.true_label; |
690 if (target != labels.fall_through) { | 693 if (target != labels.fall_through) { |
691 __ jmp(target); | 694 __ jmp(target); |
692 } | 695 } |
693 } else { | 696 } else { |
694 __ jmp(deopt); | 697 __ jmp(deopt); |
695 } | 698 } |
696 // Dummy result as the last instruction is a jump, any conditional | 699 // Dummy result as the last instruction is a jump, any conditional |
697 // branch using the result will therefore be skipped. | 700 // branch using the result will therefore be skipped. |
698 return ZERO; | 701 return ZERO; |
(...skipping 6077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6776 __ Drop(1); | 6779 __ Drop(1); |
6777 __ popq(result); | 6780 __ popq(result); |
6778 } | 6781 } |
6779 | 6782 |
6780 | 6783 |
6781 } // namespace dart | 6784 } // namespace dart |
6782 | 6785 |
6783 #undef __ | 6786 #undef __ |
6784 | 6787 |
6785 #endif // defined TARGET_ARCH_X64 | 6788 #endif // defined TARGET_ARCH_X64 |
OLD | NEW |