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

Unified 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 side-by-side diff with in-line comments
Download patch
« src/objects.h ('K') | « src/objects.h ('k') | src/serialize.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 58e4f7c666bec9af375ad458fc6d8bd5d08afc58..6cb0f9af7b5eb45c1da88d70086849451e346fbc 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -689,6 +689,14 @@ int Smi::value() {
Smi* Smi::FromInt(int value) {
ASSERT(Smi::IsValid(value));
+ intptr_t tagged_value =
+ (static_cast<intptr_t>(value) << kSmiTagSize) | kSmiTag;
+ return reinterpret_cast<Smi*>(tagged_value);
+}
+
+
+Smi* Smi::FromIntptr(intptr_t value) {
+ ASSERT(Smi::IsValid(value));
return reinterpret_cast<Smi*>((value << kSmiTagSize) | kSmiTag);
}
@@ -784,6 +792,18 @@ bool Smi::IsValid(int value) {
}
+bool Smi::IsPtrValid(intptr_t value) {
+#ifdef DEBUG
+ bool in_range = (value >= kMinValue) && (value <= kMaxValue);
+#endif
+ // See Smi::IsValid(int) for description.
+ bool result =
+ ((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
+ ASSERT(result == in_range);
+ return result;
+}
+
+
MapWord MapWord::FromMap(Map* map) {
return MapWord(reinterpret_cast<uintptr_t>(map));
}
« 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