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 5822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5833 case Token::BIT_AND: | 5833 case Token::BIT_AND: |
5834 // Result is always a smi. | 5834 // Result is always a smi. |
5835 result_type = TypeInfo::Smi(); | 5835 result_type = TypeInfo::Smi(); |
5836 break; | 5836 break; |
5837 case Token::SAR: | 5837 case Token::SAR: |
5838 case Token::SHL: | 5838 case Token::SHL: |
5839 // Result is always a smi. | 5839 // Result is always a smi. |
5840 result_type = TypeInfo::Smi(); | 5840 result_type = TypeInfo::Smi(); |
5841 break; | 5841 break; |
5842 case Token::SHR: | 5842 case Token::SHR: |
5843 // Result of x >>> y is always a smi if y >= 1, otherwise a number. | 5843 // Result of x >>> y is always a smi if masked y >= 1, otherwise a number. |
5844 result_type = (right.is_constant() && right.handle()->IsSmi() | 5844 result_type = (right.is_constant() && right.handle()->IsSmi() |
5845 && Smi::cast(*right.handle())->value() >= 1) | 5845 && (Smi::cast(*right.handle())->value() & 0x1F) >= 1) |
5846 ? TypeInfo::Smi() | 5846 ? TypeInfo::Smi() |
5847 : TypeInfo::Number(); | 5847 : TypeInfo::Number(); |
5848 break; | 5848 break; |
5849 case Token::ADD: | 5849 case Token::ADD: |
5850 if (operands_type.IsNumber()) { | 5850 if (operands_type.IsNumber()) { |
5851 result_type = TypeInfo::Number(); | 5851 result_type = TypeInfo::Number(); |
5852 } else if (operands_type.IsString()) { | 5852 } else if (operands_type.IsString()) { |
5853 result_type = TypeInfo::String(); | 5853 result_type = TypeInfo::String(); |
5854 } else { | 5854 } else { |
5855 result_type = TypeInfo::Unknown(); | 5855 result_type = TypeInfo::Unknown(); |
(...skipping 4611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10467 // Call the function from C++. | 10467 // Call the function from C++. |
10468 return FUNCTION_CAST<ModuloFunction>(buffer); | 10468 return FUNCTION_CAST<ModuloFunction>(buffer); |
10469 } | 10469 } |
10470 | 10470 |
10471 #endif | 10471 #endif |
10472 | 10472 |
10473 | 10473 |
10474 #undef __ | 10474 #undef __ |
10475 | 10475 |
10476 } } // namespace v8::internal | 10476 } } // namespace v8::internal |
OLD | NEW |