Reviewers: Mads Ager, Vyacheslav Egorov,

Message:
Mads and Slava,

may you have a look?

Merge applied cleanly.

Description:
Port r6388 to 2.4 branch.

Please review this at http://codereview.chromium.org/6260011/

SVN Base: http://v8.googlecode.com/svn/branches/2.4/

Affected files:
  M     include/v8.h
  M     src/api.cc
  M     src/version.cc
  M     test/cctest/test-api.cc


Index: include/v8.h
===================================================================
--- include/v8.h        (revision 6388)
+++ include/v8.h        (working copy)
@@ -3310,7 +3310,7 @@

   // For 32-bit systems any 2 bytes aligned pointer can be encoded as smi
   // with a plain reinterpret_cast.
-  static const intptr_t kEncodablePointerMask = 0x1;
+  static const uintptr_t kEncodablePointerMask = 0x1;
   static const int kPointerToSmiShift = 0;
 };

@@ -3330,8 +3330,8 @@
// It might be not enough to cover stack allocated objects on some platforms.
   static const int kPointerAlignment = 3;

-  static const intptr_t kEncodablePointerMask =
-      ~(intptr_t(0xffffffff) << kPointerAlignment);
+  static const uintptr_t kEncodablePointerMask =
+      ~(uintptr_t(0xffffffff) << kPointerAlignment);

   static const int kPointerToSmiShift =
       kSmiTagSize + kSmiShiftSize - kPointerAlignment;
@@ -3340,7 +3340,7 @@
 typedef SmiTagging<sizeof(void*)> PlatformSmiTagging;
 const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
 const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
-const intptr_t kEncodablePointerMask =
+const uintptr_t kEncodablePointerMask =
     PlatformSmiTagging::kEncodablePointerMask;
 const int kPointerToSmiShift = PlatformSmiTagging::kPointerToSmiShift;

@@ -3400,7 +3400,7 @@
   }

   static inline void* GetExternalPointerFromSmi(internal::Object* value) {
-    const intptr_t address = reinterpret_cast<intptr_t>(value);
+    const uintptr_t address = reinterpret_cast<uintptr_t>(value);
     return reinterpret_cast<void*>(address >> kPointerToSmiShift);
   }

Index: src/api.cc
===================================================================
--- src/api.cc  (revision 6388)
+++ src/api.cc  (working copy)
@@ -3205,14 +3205,14 @@


 static bool CanBeEncodedAsSmi(void* ptr) {
-  const intptr_t address = reinterpret_cast<intptr_t>(ptr);
+  const uintptr_t address = reinterpret_cast<uintptr_t>(ptr);
   return ((address & i::kEncodablePointerMask) == 0);
 }


 static i::Smi* EncodeAsSmi(void* ptr) {
   ASSERT(CanBeEncodedAsSmi(ptr));
-  const intptr_t address = reinterpret_cast<intptr_t>(ptr);
+  const uintptr_t address = reinterpret_cast<uintptr_t>(ptr);
i::Smi* result = reinterpret_cast<i::Smi*>(address << i::kPointerToSmiShift);
   ASSERT(i::Internals::HasSmiTag(result));
   ASSERT_EQ(result, i::Smi::FromInt(result->value()));
Index: src/version.cc
===================================================================
--- src/version.cc      (revision 6388)
+++ src/version.cc      (working copy)
@@ -35,7 +35,7 @@
 #define MAJOR_VERSION     2
 #define MINOR_VERSION     4
 #define BUILD_NUMBER      9
-#define PATCH_LEVEL       21
+#define PATCH_LEVEL       22
 #define CANDIDATE_VERSION false

 // Define SONAME to have the SCons build the put a specific SONAME into the
Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc     (revision 6388)
+++ test/cctest/test-api.cc     (working copy)
@@ -873,6 +873,10 @@
   TestExternalPointerWrapping();

 #if defined(V8_HOST_ARCH_X64)
+  // Check a value with a leading 1 bit in x64 Smi encoding.
+  expected_ptr = reinterpret_cast<void*>(0x400000000);
+  TestExternalPointerWrapping();
+
   expected_ptr = reinterpret_cast<void*>(0xdeadbeefdeadbeef);
   TestExternalPointerWrapping();



--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to