| 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 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 ASSERT(value >> kSpaceTagSize == requested); | 757 ASSERT(value >> kSpaceTagSize == requested); |
| 758 ASSERT(Smi::IsValid(value)); | 758 ASSERT(Smi::IsValid(value)); |
| 759 ASSERT(value == ((value << kFailureTypeTagSize) >> kFailureTypeTagSize)); | 759 ASSERT(value == ((value << kFailureTypeTagSize) >> kFailureTypeTagSize)); |
| 760 ASSERT(Smi::IsValid(value << kFailureTypeTagSize)); | 760 ASSERT(Smi::IsValid(value << kFailureTypeTagSize)); |
| 761 return Construct(RETRY_AFTER_GC, value); | 761 return Construct(RETRY_AFTER_GC, value); |
| 762 } | 762 } |
| 763 | 763 |
| 764 | 764 |
| 765 Failure* Failure::Construct(Type type, int value) { | 765 Failure* Failure::Construct(Type type, int value) { |
| 766 int info = (value << kFailureTypeTagSize) | type; | 766 int info = (value << kFailureTypeTagSize) | type; |
| 767 // TODO(X64): Stop using Smi validation for non-smi checks, even if they |
| 768 // happen to be identical at the moment. |
| 767 ASSERT(Smi::IsValid(info)); // Same validation check as in Smi | 769 ASSERT(Smi::IsValid(info)); // Same validation check as in Smi |
| 768 return reinterpret_cast<Failure*>( | 770 return reinterpret_cast<Failure*>( |
| 769 static_cast<intptr_t>((info << kFailureTagSize) | kFailureTag)); | 771 (static_cast<intptr_t>(info) << kFailureTagSize) | kFailureTag); |
| 770 } | 772 } |
| 771 | 773 |
| 772 | 774 |
| 773 bool Smi::IsValid(int value) { | 775 bool Smi::IsValid(int value) { |
| 774 #ifdef DEBUG | 776 #ifdef DEBUG |
| 775 bool in_range = (value >= kMinValue) && (value <= kMaxValue); | 777 bool in_range = (value >= kMinValue) && (value <= kMaxValue); |
| 776 #endif | 778 #endif |
| 777 // To be representable as an tagged small integer, the two | 779 // To be representable as an tagged small integer, the two |
| 778 // most-significant bits of 'value' must be either 00 or 11 due to | 780 // most-significant bits of 'value' must be either 00 or 11 due to |
| 779 // sign-extension. To check this we add 01 to the two | 781 // sign-extension. To check this we add 01 to the two |
| (...skipping 1848 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2628 #undef WRITE_INT_FIELD | 2630 #undef WRITE_INT_FIELD |
| 2629 #undef READ_SHORT_FIELD | 2631 #undef READ_SHORT_FIELD |
| 2630 #undef WRITE_SHORT_FIELD | 2632 #undef WRITE_SHORT_FIELD |
| 2631 #undef READ_BYTE_FIELD | 2633 #undef READ_BYTE_FIELD |
| 2632 #undef WRITE_BYTE_FIELD | 2634 #undef WRITE_BYTE_FIELD |
| 2633 | 2635 |
| 2634 | 2636 |
| 2635 } } // namespace v8::internal | 2637 } } // namespace v8::internal |
| 2636 | 2638 |
| 2637 #endif // V8_OBJECTS_INL_H_ | 2639 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |