OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1215 __ mov(tos, Operand(tos, LSL, scratch)); // Shift constant. | 1215 __ mov(tos, Operand(tos, LSL, scratch)); // Shift constant. |
1216 deferred->BindExit(); | 1216 deferred->BindExit(); |
1217 TypeInfo result = TypeInfo::Integer32(); | 1217 TypeInfo result = TypeInfo::Integer32(); |
1218 frame_->EmitPush(tos, result); | 1218 frame_->EmitPush(tos, result); |
1219 break; | 1219 break; |
1220 } | 1220 } |
1221 // Fall through! | 1221 // Fall through! |
1222 case Token::SHR: | 1222 case Token::SHR: |
1223 case Token::SAR: { | 1223 case Token::SAR: { |
1224 ASSERT(!reversed); | 1224 ASSERT(!reversed); |
1225 TypeInfo result = | 1225 int shift_amount = int_value & 0x1f; |
1226 (op == Token::SAR) ? TypeInfo::Integer32() : TypeInfo::Number(); | 1226 TypeInfo result = TypeInfo::Number(); |
1227 if (!reversed) { | 1227 |
1228 if (op == Token::SHR) { | 1228 if (op == Token::SHR) { |
1229 if (int_value >= 2) { | 1229 if (shift_amount > 1) { |
1230 result = TypeInfo::Smi(); | 1230 result = TypeInfo::Smi(); |
1231 } else if (int_value >= 1) { | 1231 } else if (shift_amount > 0) { |
1232 result = TypeInfo::Integer32(); | 1232 result = TypeInfo::Integer32(); |
1233 } | 1233 } |
| 1234 } else if (op == Token::SAR) { |
| 1235 if (shift_amount > 0) { |
| 1236 result = TypeInfo::Smi(); |
1234 } else { | 1237 } else { |
1235 if (int_value >= 1) { | 1238 result = TypeInfo::Integer32(); |
1236 result = TypeInfo::Smi(); | |
1237 } | |
1238 } | 1239 } |
| 1240 } else { |
| 1241 ASSERT(op == Token::SHL); |
| 1242 result = TypeInfo::Integer32(); |
1239 } | 1243 } |
| 1244 |
1240 Register scratch = VirtualFrame::scratch0(); | 1245 Register scratch = VirtualFrame::scratch0(); |
1241 Register scratch2 = VirtualFrame::scratch1(); | 1246 Register scratch2 = VirtualFrame::scratch1(); |
1242 int shift_value = int_value & 0x1f; // least significant 5 bits | 1247 int shift_value = int_value & 0x1f; // least significant 5 bits |
1243 DeferredCode* deferred = | 1248 DeferredCode* deferred = |
1244 new DeferredInlineSmiOperation(op, shift_value, false, mode, tos); | 1249 new DeferredInlineSmiOperation(op, shift_value, false, mode, tos); |
1245 uint32_t problematic_mask = kSmiTagMask; | 1250 uint32_t problematic_mask = kSmiTagMask; |
1246 // For unsigned shift by zero all negative smis are problematic. | 1251 // For unsigned shift by zero all negative smis are problematic. |
1247 bool skip_smi_test = both_sides_are_smi; | 1252 bool skip_smi_test = both_sides_are_smi; |
1248 if (shift_value == 0 && op == Token::SHR) { | 1253 if (shift_value == 0 && op == Token::SHR) { |
1249 problematic_mask |= 0x80000000; | 1254 problematic_mask |= 0x80000000; |
(...skipping 10448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11698 __ bind(&string_add_runtime); | 11703 __ bind(&string_add_runtime); |
11699 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); | 11704 __ TailCallRuntime(Runtime::kStringAdd, 2, 1); |
11700 } | 11705 } |
11701 | 11706 |
11702 | 11707 |
11703 #undef __ | 11708 #undef __ |
11704 | 11709 |
11705 } } // namespace v8::internal | 11710 } } // namespace v8::internal |
11706 | 11711 |
11707 #endif // V8_TARGET_ARCH_ARM | 11712 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |