| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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/opt_code_generator.h" | 8 #include "vm/opt_code_generator.h" |
| 9 | 9 |
| 10 #include "vm/assembler_macros.h" | 10 #include "vm/assembler_macros.h" |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 853 // No overflow check. | 853 // No overflow check. |
| 854 __ orl(EAX, EDX); | 854 __ orl(EAX, EDX); |
| 855 break; | 855 break; |
| 856 } | 856 } |
| 857 case Token::kBIT_XOR: { | 857 case Token::kBIT_XOR: { |
| 858 // No overflow check. | 858 // No overflow check. |
| 859 __ xorl(EAX, EDX); | 859 __ xorl(EAX, EDX); |
| 860 break; | 860 break; |
| 861 } | 861 } |
| 862 case Token::kTRUNCDIV: { | 862 case Token::kTRUNCDIV: { |
| 863 // Handle Divide by zero in runtime. | 863 // Handle divide by zero in runtime. |
| 864 __ cmpl(EDX, Immediate(0)); | 864 __ cmpl(EDX, Immediate(0)); |
| 865 __ j(EQUAL, overflow_label); | 865 __ j(EQUAL, overflow_label); |
| 866 // Preserve left & right in case of 'overflow'. |
| 867 __ pushl(EDX); |
| 868 __ pushl(ECX); |
| 866 // Move right to ECX, left is in EAX. | 869 // Move right to ECX, left is in EAX. |
| 867 __ movl(ECX, EDX); | 870 __ movl(ECX, EDX); |
| 868 __ SmiUntag(ECX); | 871 __ SmiUntag(ECX); |
| 869 __ SmiUntag(EAX); | 872 __ SmiUntag(EAX); |
| 870 // Sign extend EAX -> EDX:EAX. | 873 // Sign extend EAX -> EDX:EAX. |
| 871 __ cdq(); | 874 __ cdq(); |
| 872 __ idivl(ECX); | 875 __ idivl(ECX); // Result in EAX. |
| 876 __ popl(ECX); |
| 877 __ popl(EDX); |
| 878 // Check the corner case of dividing the 'MIN_SMI' with -1, in which |
| 879 // case we cannot tag the result. |
| 880 __ cmpl(EAX, Immediate(0x40000000)); |
| 881 __ j(EQUAL, overflow_label); |
| 873 __ SmiTag(EAX); | 882 __ SmiTag(EAX); |
| 874 break; | 883 break; |
| 875 } | 884 } |
| 876 default: | 885 default: |
| 877 UNREACHABLE(); | 886 UNREACHABLE(); |
| 878 } | 887 } |
| 879 } else if (kind == Token::kSHL) { | 888 } else if (kind == Token::kSHL) { |
| 880 GenerateSmiShiftBinaryOp(node); | 889 GenerateSmiShiftBinaryOp(node); |
| 881 } else { | 890 } else { |
| 882 TraceNotOpt(node, kOptMessage); | 891 TraceNotOpt(node, kOptMessage); |
| (...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2734 void OptimizingCodeGenerator::VisitTryCatchNode(TryCatchNode* node) { | 2743 void OptimizingCodeGenerator::VisitTryCatchNode(TryCatchNode* node) { |
| 2735 // TODO(srdjan): Set classes for locals. | 2744 // TODO(srdjan): Set classes for locals. |
| 2736 classes_for_locals_->Clear(); | 2745 classes_for_locals_->Clear(); |
| 2737 CodeGenerator::VisitTryCatchNode(node); | 2746 CodeGenerator::VisitTryCatchNode(node); |
| 2738 } | 2747 } |
| 2739 | 2748 |
| 2740 | 2749 |
| 2741 } // namespace dart | 2750 } // namespace dart |
| 2742 | 2751 |
| 2743 #endif // defined TARGET_ARCH_IA32 | 2752 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |