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_IA32. | 5 #include "vm/globals.h" // Needed here to get TARGET_ARCH_IA32. |
6 #if defined(TARGET_ARCH_IA32) | 6 #if defined(TARGET_ARCH_IA32) |
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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 __ testl(val_reg, Immediate(kSmiTagMask)); | 704 __ testl(val_reg, Immediate(kSmiTagMask)); |
705 __ j(ZERO, result ? labels.true_label : labels.false_label); | 705 __ j(ZERO, result ? labels.true_label : labels.false_label); |
706 __ LoadClassId(cid_reg, val_reg); | 706 __ LoadClassId(cid_reg, val_reg); |
707 for (intptr_t i = 2; i < data.length(); i += 2) { | 707 for (intptr_t i = 2; i < data.length(); i += 2) { |
708 const intptr_t test_cid = data[i]; | 708 const intptr_t test_cid = data[i]; |
709 ASSERT(test_cid != kSmiCid); | 709 ASSERT(test_cid != kSmiCid); |
710 result = data[i + 1] == true_result; | 710 result = data[i + 1] == true_result; |
711 __ cmpl(cid_reg, Immediate(test_cid)); | 711 __ cmpl(cid_reg, Immediate(test_cid)); |
712 __ j(EQUAL, result ? labels.true_label : labels.false_label); | 712 __ j(EQUAL, result ? labels.true_label : labels.false_label); |
713 } | 713 } |
714 // No match found, deoptimize or false. | 714 // No match found, deoptimize or default action. |
715 if (deopt == NULL) { | 715 if (deopt == NULL) { |
| 716 // If the cid is not in the list, jump to the opposite label from the cids |
| 717 // that are in the list. These must be all the same (see asserts in the |
| 718 // constructor). |
716 Label* target = result ? labels.false_label : labels.true_label; | 719 Label* target = result ? labels.false_label : labels.true_label; |
717 if (target != labels.fall_through) { | 720 if (target != labels.fall_through) { |
718 __ jmp(target); | 721 __ jmp(target); |
719 } | 722 } |
720 } else { | 723 } else { |
721 __ jmp(deopt); | 724 __ jmp(deopt); |
722 } | 725 } |
723 // Dummy result as the last instruction is a jump, any conditional | 726 // Dummy result as the last instruction is a jump, any conditional |
724 // branch using the result will therefore be skipped. | 727 // branch using the result will therefore be skipped. |
725 return ZERO; | 728 return ZERO; |
(...skipping 6190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6916 __ Drop(1); | 6919 __ Drop(1); |
6917 __ popl(result); | 6920 __ popl(result); |
6918 } | 6921 } |
6919 | 6922 |
6920 | 6923 |
6921 } // namespace dart | 6924 } // namespace dart |
6922 | 6925 |
6923 #undef __ | 6926 #undef __ |
6924 | 6927 |
6925 #endif // defined TARGET_ARCH_IA32 | 6928 #endif // defined TARGET_ARCH_IA32 |
OLD | NEW |