Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: src/objects-inl.h

Issue 113023: X64: Made hash computation in serializer accept 64-bit pointers. (Closed)
Patch Set: Created 11 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 } 682 }
683 683
684 684
685 int Smi::value() { 685 int Smi::value() {
686 return static_cast<int>(reinterpret_cast<intptr_t>(this) >> kSmiTagSize); 686 return static_cast<int>(reinterpret_cast<intptr_t>(this) >> kSmiTagSize);
687 } 687 }
688 688
689 689
690 Smi* Smi::FromInt(int value) { 690 Smi* Smi::FromInt(int value) {
691 ASSERT(Smi::IsValid(value)); 691 ASSERT(Smi::IsValid(value));
692 intptr_t tagged_value =
693 (static_cast<intptr_t>(value) << kSmiTagSize) | kSmiTag;
694 return reinterpret_cast<Smi*>(tagged_value);
695 }
696
697
698 Smi* Smi::FromIntptr(intptr_t value) {
699 ASSERT(Smi::IsValid(value));
692 return reinterpret_cast<Smi*>((value << kSmiTagSize) | kSmiTag); 700 return reinterpret_cast<Smi*>((value << kSmiTagSize) | kSmiTag);
693 } 701 }
694 702
695 703
696 Failure::Type Failure::type() const { 704 Failure::Type Failure::type() const {
697 return static_cast<Type>(value() & kFailureTypeTagMask); 705 return static_cast<Type>(value() & kFailureTypeTagMask);
698 } 706 }
699 707
700 708
701 bool Failure::IsInternalError() const { 709 bool Failure::IsInternalError() const {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 // in fact doesn't work correctly with gcc4.1.1 in some cases: The 785 // in fact doesn't work correctly with gcc4.1.1 in some cases: The
778 // compiler may produce undefined results in case of signed integer 786 // compiler may produce undefined results in case of signed integer
779 // overflow. The computation must be done w/ unsigned ints. 787 // overflow. The computation must be done w/ unsigned ints.
780 bool result = 788 bool result =
781 ((static_cast<unsigned int>(value) + 0x40000000U) & 0x80000000U) == 0; 789 ((static_cast<unsigned int>(value) + 0x40000000U) & 0x80000000U) == 0;
782 ASSERT(result == in_range); 790 ASSERT(result == in_range);
783 return result; 791 return result;
784 } 792 }
785 793
786 794
795 bool Smi::IsPtrValid(intptr_t value) {
796 #ifdef DEBUG
797 bool in_range = (value >= kMinValue) && (value <= kMaxValue);
798 #endif
799 // See Smi::IsValid(int) for description.
800 bool result =
801 ((static_cast<uintptr_t>(value) + 0x40000000U) < 0x80000000U);
William Hesse 2009/05/06 07:42:37 If this is safe, why not change the test in IsVali
Lasse Reichstein 2009/05/12 08:16:38 Only the assumption that the and is slightly faste
802 ASSERT(result == in_range);
803 return result;
804 }
805
806
787 MapWord MapWord::FromMap(Map* map) { 807 MapWord MapWord::FromMap(Map* map) {
788 return MapWord(reinterpret_cast<uintptr_t>(map)); 808 return MapWord(reinterpret_cast<uintptr_t>(map));
789 } 809 }
790 810
791 811
792 Map* MapWord::ToMap() { 812 Map* MapWord::ToMap() {
793 return reinterpret_cast<Map*>(value_); 813 return reinterpret_cast<Map*>(value_);
794 } 814 }
795 815
796 816
(...skipping 1810 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 #undef WRITE_INT_FIELD 2627 #undef WRITE_INT_FIELD
2608 #undef READ_SHORT_FIELD 2628 #undef READ_SHORT_FIELD
2609 #undef WRITE_SHORT_FIELD 2629 #undef WRITE_SHORT_FIELD
2610 #undef READ_BYTE_FIELD 2630 #undef READ_BYTE_FIELD
2611 #undef WRITE_BYTE_FIELD 2631 #undef WRITE_BYTE_FIELD
2612 2632
2613 2633
2614 } } // namespace v8::internal 2634 } } // namespace v8::internal
2615 2635
2616 #endif // V8_OBJECTS_INL_H_ 2636 #endif // V8_OBJECTS_INL_H_
OLDNEW
« src/objects.h ('K') | « src/objects.h ('k') | src/serialize.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698