| 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 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 if ((cls0.raw() == classes[0]->raw()) && (cls1.raw() == classes[1]->raw())) { | 689 if ((cls0.raw() == classes[0]->raw()) && (cls1.raw() == classes[1]->raw())) { |
| 690 return true; | 690 return true; |
| 691 } | 691 } |
| 692 return false; | 692 return false; |
| 693 } | 693 } |
| 694 | 694 |
| 695 | 695 |
| 696 // SHL: Implement with slow case so that it works both with Smi and Mint types. | 696 // SHL: Implement with slow case so that it works both with Smi and Mint types. |
| 697 // Result is in EAX. Mangles ECX, EBX, EDX. | 697 // Result is in EAX. Mangles ECX, EBX, EDX. |
| 698 void OptimizingCodeGenerator::GenerateSmiShiftBinaryOp(BinaryOpNode* node) { | 698 void OptimizingCodeGenerator::GenerateSmiShiftBinaryOp(BinaryOpNode* node) { |
| 699 if (node->kind() == Token::kSAR) { | 699 if (node->kind() == Token::kSHR) { |
| 700 // TODO(srdjan): Implement for Mint? | 700 // TODO(srdjan): Implement for Mint? |
| 701 DeoptimizationBlob* deopt_blob = | 701 DeoptimizationBlob* deopt_blob = |
| 702 AddDeoptimizationBlob(node, EAX, ECX, kDeoptSAR); | 702 AddDeoptimizationBlob(node, EAX, ECX, kDeoptSAR); |
| 703 CodeGenInfo left_info(node->left()); | 703 CodeGenInfo left_info(node->left()); |
| 704 CodeGenInfo right_info(node->right()); | 704 CodeGenInfo right_info(node->right()); |
| 705 // EAX: value to shift, ECX: amount to shift. | 705 // EAX: value to shift, ECX: amount to shift. |
| 706 VisitLoadTwo(node->left(), node->right(), EAX, ECX); | 706 VisitLoadTwo(node->left(), node->right(), EAX, ECX); |
| 707 if (!left_info.IsClass(smi_class_) || !right_info.IsClass(smi_class_)) { | 707 if (!left_info.IsClass(smi_class_) || !right_info.IsClass(smi_class_)) { |
| 708 // Check if both Smi. | 708 // Check if both Smi. |
| 709 __ movl(EBX, EAX); | 709 __ movl(EBX, EAX); |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 // Check the corner case of dividing the 'MIN_SMI' with -1, in which | 996 // Check the corner case of dividing the 'MIN_SMI' with -1, in which |
| 997 // case we cannot tag the result. | 997 // case we cannot tag the result. |
| 998 __ cmpl(EAX, Immediate(0x40000000)); | 998 __ cmpl(EAX, Immediate(0x40000000)); |
| 999 __ j(EQUAL, deopt_blob->label()); | 999 __ j(EQUAL, deopt_blob->label()); |
| 1000 __ SmiTag(EAX); | 1000 __ SmiTag(EAX); |
| 1001 break; | 1001 break; |
| 1002 } | 1002 } |
| 1003 default: | 1003 default: |
| 1004 UNREACHABLE(); | 1004 UNREACHABLE(); |
| 1005 } | 1005 } |
| 1006 } else if ((kind == Token::kSHL) || (kind == Token::kSAR)) { | 1006 } else if ((kind == Token::kSHL) || (kind == Token::kSHR)) { |
| 1007 GenerateSmiShiftBinaryOp(node); | 1007 GenerateSmiShiftBinaryOp(node); |
| 1008 } else { | 1008 } else { |
| 1009 // Unhandled node kind. | 1009 // Unhandled node kind. |
| 1010 TraceNotOpt(node, kOptMessage); | 1010 TraceNotOpt(node, kOptMessage); |
| 1011 node->left()->Visit(this); | 1011 node->left()->Visit(this); |
| 1012 node->right()->Visit(this); | 1012 node->right()->Visit(this); |
| 1013 CodeGenerator::GenerateBinaryOperatorCall(node->id(), | 1013 CodeGenerator::GenerateBinaryOperatorCall(node->id(), |
| 1014 node->token_index(), | 1014 node->token_index(), |
| 1015 node->Name()); | 1015 node->Name()); |
| 1016 } | 1016 } |
| (...skipping 2104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3121 } | 3121 } |
| 3122 } | 3122 } |
| 3123 // TODO(srdjan): Implement unary kSUB (negate) Mint. | 3123 // TODO(srdjan): Implement unary kSUB (negate) Mint. |
| 3124 CodeGenerator::VisitUnaryOpNode(node); | 3124 CodeGenerator::VisitUnaryOpNode(node); |
| 3125 } | 3125 } |
| 3126 | 3126 |
| 3127 | 3127 |
| 3128 } // namespace dart | 3128 } // namespace dart |
| 3129 | 3129 |
| 3130 #endif // defined TARGET_ARCH_IA32 | 3130 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |