| 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 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 CodeGenerator::GenerateBinaryOperatorCall(node->id(), | 1008 CodeGenerator::GenerateBinaryOperatorCall(node->id(), |
| 1009 node->token_index(), | 1009 node->token_index(), |
| 1010 node->Name()); | 1010 node->Name()); |
| 1011 } | 1011 } |
| 1012 __ Bind(&done); | 1012 __ Bind(&done); |
| 1013 HandleResult(node, EAX); | 1013 HandleResult(node, EAX); |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 | 1016 |
| 1017 // Supports some mixed Smi/Mint operations. | 1017 // Supports some mixed Smi/Mint operations. |
| 1018 // For BIT_AND operation with one operand being Smi, we can throw away | 1018 // For BIT_AND operation with right operand being Smi, we can throw away |
| 1019 // any Mint bits above the Smi range. | 1019 // any Mint bits above the Smi range as long as the right operand is positive. |
| 1020 // 'allow_smi' is true if Smi and Mint classes have been encountered. | 1020 // 'allow_smi' is true if Smi and Mint classes have been encountered. |
| 1021 void OptimizingCodeGenerator::GenerateMintBinaryOp(BinaryOpNode* node, | 1021 void OptimizingCodeGenerator::GenerateMintBinaryOp(BinaryOpNode* node, |
| 1022 bool allow_smi) { | 1022 bool allow_smi) { |
| 1023 const char* kOptMessage = "Inline Mint binop."; | 1023 const char* kOptMessage = "Inline Mint binop."; |
| 1024 ObjectStore* object_store = Isolate::Current()->object_store(); | 1024 ObjectStore* object_store = Isolate::Current()->object_store(); |
| 1025 const Token::Kind kind = node->kind(); | 1025 const Token::Kind kind = node->kind(); |
| 1026 if (kind == Token::kBIT_AND) { | 1026 if (kind == Token::kBIT_AND) { |
| 1027 TraceOpt(node, kOptMessage); | 1027 TraceOpt(node, kOptMessage); |
| 1028 Label is_smi, slow_case, done; | 1028 Label is_smi, slow_case, done; |
| 1029 DeoptimizationBlob* deopt_blob = | 1029 DeoptimizationBlob* deopt_blob = |
| 1030 AddDeoptimizationBlob(node, EAX, EDX, kDeoptMintBinaryOp); | 1030 AddDeoptimizationBlob(node, EAX, EDX, kDeoptMintBinaryOp); |
| 1031 VisitLoadTwo(node->left(), node->right(), EAX, EDX); | 1031 VisitLoadTwo(node->left(), node->right(), EAX, EDX); |
| 1032 __ testl(EDX, Immediate(kSmiTagMask)); | 1032 __ testl(EDX, Immediate(kSmiTagMask)); |
| 1033 __ j(NOT_ZERO, &slow_case); // Call operator if right is not Smi. | 1033 __ j(NOT_ZERO, &slow_case); // Call operator if right is not Smi. |
| 1034 __ cmpl(EDX, Immediate(0)); |
| 1035 __ j(LESS, &slow_case); // Result will not be Smi. |
| 1034 | 1036 |
| 1035 // Test left. | 1037 // Test left. |
| 1036 __ testl(EAX, Immediate(kSmiTagMask)); | 1038 __ testl(EAX, Immediate(kSmiTagMask)); |
| 1037 __ j(ZERO, &is_smi); | 1039 __ j(ZERO, &is_smi); |
| 1038 | 1040 |
| 1039 __ movl(EBX, FieldAddress(EAX, Object::class_offset())); | 1041 __ movl(EBX, FieldAddress(EAX, Object::class_offset())); |
| 1040 __ CompareObject(EBX, Class::ZoneHandle(object_store->mint_class())); | 1042 __ CompareObject(EBX, Class::ZoneHandle(object_store->mint_class())); |
| 1041 __ j(NOT_EQUAL, deopt_blob->label()); | 1043 __ j(NOT_EQUAL, deopt_blob->label()); |
| 1042 | 1044 |
| 1043 // Load lower Mint word, convert to Smi. It is OK to loose bits. | 1045 // Load lower Mint word, convert to Smi. It is OK to loose bits. |
| (...skipping 2104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3148 } | 3150 } |
| 3149 } | 3151 } |
| 3150 // TODO(srdjan): Implement unary kSUB (negate) Mint. | 3152 // TODO(srdjan): Implement unary kSUB (negate) Mint. |
| 3151 CodeGenerator::VisitUnaryOpNode(node); | 3153 CodeGenerator::VisitUnaryOpNode(node); |
| 3152 } | 3154 } |
| 3153 | 3155 |
| 3154 | 3156 |
| 3155 } // namespace dart | 3157 } // namespace dart |
| 3156 | 3158 |
| 3157 #endif // defined TARGET_ARCH_IA32 | 3159 #endif // defined TARGET_ARCH_IA32 |
| OLD | NEW |