| 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 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1172 : TypeInfo::Integer32(); | 1172 : TypeInfo::Integer32(); |
| 1173 } | 1173 } |
| 1174 case Token::BIT_XOR: | 1174 case Token::BIT_XOR: |
| 1175 // Result is always a 32 bit integer. Smi property of inputs is preserved. | 1175 // Result is always a 32 bit integer. Smi property of inputs is preserved. |
| 1176 return (operands_type.IsSmi()) | 1176 return (operands_type.IsSmi()) |
| 1177 ? TypeInfo::Smi() | 1177 ? TypeInfo::Smi() |
| 1178 : TypeInfo::Integer32(); | 1178 : TypeInfo::Integer32(); |
| 1179 case Token::SAR: | 1179 case Token::SAR: |
| 1180 if (left.is_smi()) return TypeInfo::Smi(); | 1180 if (left.is_smi()) return TypeInfo::Smi(); |
| 1181 // Result is a smi if we shift by a constant >= 1, otherwise an integer32. | 1181 // Result is a smi if we shift by a constant >= 1, otherwise an integer32. |
| 1182 // Shift amount is masked with 0x1F (ECMA standard 11.7.2). |
| 1182 return (right.is_constant() && right.handle()->IsSmi() | 1183 return (right.is_constant() && right.handle()->IsSmi() |
| 1183 && Smi::cast(*right.handle())->value() >= 1) | 1184 && (Smi::cast(*right.handle())->value() & 0x1F) >= 1) |
| 1184 ? TypeInfo::Smi() | 1185 ? TypeInfo::Smi() |
| 1185 : TypeInfo::Integer32(); | 1186 : TypeInfo::Integer32(); |
| 1186 case Token::SHR: | 1187 case Token::SHR: |
| 1187 // Result is a smi if we shift by a constant >= 2, otherwise an integer32. | 1188 // Result is a smi if we shift by a constant >= 2, an integer32 if |
| 1188 return (right.is_constant() && right.handle()->IsSmi() | 1189 // we shift by 1, and an unsigned 32-bit integer if we shift by 0. |
| 1189 && Smi::cast(*right.handle())->value() >= 2) | 1190 if (right.is_constant() && right.handle()->IsSmi()) { |
| 1190 ? TypeInfo::Smi() | 1191 int shift_amount = Smi::cast(*right.handle())->value() & 0x1F; |
| 1191 : TypeInfo::Integer32(); | 1192 if (shift_amount > 1) { |
| 1193 return TypeInfo::Smi(); |
| 1194 } else if (shift_amount > 0) { |
| 1195 return TypeInfo::Integer32(); |
| 1196 } |
| 1197 } |
| 1198 return TypeInfo::Number(); |
| 1192 case Token::ADD: | 1199 case Token::ADD: |
| 1193 if (operands_type.IsSmi()) { | 1200 if (operands_type.IsSmi()) { |
| 1194 // The Integer32 range is big enough to take the sum of any two Smis. | 1201 // The Integer32 range is big enough to take the sum of any two Smis. |
| 1195 return TypeInfo::Integer32(); | 1202 return TypeInfo::Integer32(); |
| 1196 } else { | 1203 } else { |
| 1197 // Result could be a string or a number. Check types of inputs. | 1204 // Result could be a string or a number. Check types of inputs. |
| 1198 return operands_type.IsNumber() | 1205 return operands_type.IsNumber() |
| 1199 ? TypeInfo::Number() | 1206 ? TypeInfo::Number() |
| 1200 : TypeInfo::Unknown(); | 1207 : TypeInfo::Unknown(); |
| 1201 } | 1208 } |
| (...skipping 11364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12566 | 12573 |
| 12567 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) | 12574 // Call the runtime; it returns -1 (less), 0 (equal), or 1 (greater) |
| 12568 // tagged as a small integer. | 12575 // tagged as a small integer. |
| 12569 __ bind(&runtime); | 12576 __ bind(&runtime); |
| 12570 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); | 12577 __ TailCallRuntime(Runtime::kStringCompare, 2, 1); |
| 12571 } | 12578 } |
| 12572 | 12579 |
| 12573 #undef __ | 12580 #undef __ |
| 12574 | 12581 |
| 12575 } } // namespace v8::internal | 12582 } } // namespace v8::internal |
| OLD | NEW |