OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
828 return reinterpret_cast<Failure*>( | 828 return reinterpret_cast<Failure*>( |
829 (static_cast<intptr_t>(info) << kFailureTagSize) | kFailureTag); | 829 (static_cast<intptr_t>(info) << kFailureTagSize) | kFailureTag); |
830 } | 830 } |
831 | 831 |
832 | 832 |
833 bool Smi::IsValid(intptr_t value) { | 833 bool Smi::IsValid(intptr_t value) { |
834 #ifdef DEBUG | 834 #ifdef DEBUG |
835 bool in_range = (value >= kMinValue) && (value <= kMaxValue); | 835 bool in_range = (value >= kMinValue) && (value <= kMaxValue); |
836 #endif | 836 #endif |
837 | 837 |
838 #ifdef V8_LONG_SMI | 838 #ifdef V8_TARGET_ARCH_X64 |
839 // To be representable as a long smi, the value must be a 32-bit integer. | 839 // To be representable as a long smi, the value must be a 32-bit integer. |
840 bool result = (value == static_cast<int32_t>(value)); | 840 bool result = (value == static_cast<int32_t>(value)); |
841 #else | 841 #else |
842 // To be representable as an tagged small integer, the two | 842 // To be representable as an tagged small integer, the two |
843 // most-significant bits of 'value' must be either 00 or 11 due to | 843 // most-significant bits of 'value' must be either 00 or 11 due to |
844 // sign-extension. To check this we add 01 to the two | 844 // sign-extension. To check this we add 01 to the two |
845 // most-significant bits, and check if the most-significant bit is 0 | 845 // most-significant bits, and check if the most-significant bit is 0 |
846 // | 846 // |
847 // CAUTION: The original code below: | 847 // CAUTION: The original code below: |
848 // bool result = ((value + 0x40000000) & 0x80000000) == 0; | 848 // bool result = ((value + 0x40000000) & 0x80000000) == 0; |
(...skipping 2038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2887 #undef WRITE_INT_FIELD | 2887 #undef WRITE_INT_FIELD |
2888 #undef READ_SHORT_FIELD | 2888 #undef READ_SHORT_FIELD |
2889 #undef WRITE_SHORT_FIELD | 2889 #undef WRITE_SHORT_FIELD |
2890 #undef READ_BYTE_FIELD | 2890 #undef READ_BYTE_FIELD |
2891 #undef WRITE_BYTE_FIELD | 2891 #undef WRITE_BYTE_FIELD |
2892 | 2892 |
2893 | 2893 |
2894 } } // namespace v8::internal | 2894 } } // namespace v8::internal |
2895 | 2895 |
2896 #endif // V8_OBJECTS_INL_H_ | 2896 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |