Author: [email protected]
Date: Mon May  4 06:11:38 2009
New Revision: 1843

Modified:
    branches/bleeding_edge/src/checks.h
    branches/bleeding_edge/src/objects-inl.h
    branches/bleeding_edge/src/objects.h
    branches/bleeding_edge/src/spaces.h

Log:
Changed some int casts to intptr_t.
Removed a drop in an ocean of compile errors in x64 mode.

Review URL: http://codereview.chromium.org/100337


Modified: branches/bleeding_edge/src/checks.h
==============================================================================
--- branches/bleeding_edge/src/checks.h (original)
+++ branches/bleeding_edge/src/checks.h Mon May  4 06:11:38 2009
@@ -254,7 +254,7 @@


  #define ASSERT_TAG_ALIGNED(address) \
-  ASSERT((reinterpret_cast<int>(address) & kHeapObjectTagMask) == 0)
+  ASSERT((reinterpret_cast<intptr_t>(address) & kHeapObjectTagMask) == 0)

  #define ASSERT_SIZE_TAG_ALIGNED(size) ASSERT((size & kHeapObjectTagMask)  
== 0)


Modified: branches/bleeding_edge/src/objects-inl.h
==============================================================================
--- branches/bleeding_edge/src/objects-inl.h    (original)
+++ branches/bleeding_edge/src/objects-inl.h    Mon May  4 06:11:38 2009
@@ -683,7 +683,7 @@


  int Smi::value() {
-  return reinterpret_cast<int>(this) >> kSmiTagSize;
+  return static_cast<int>(reinterpret_cast<intptr_t>(this) >> kSmiTagSize);
  }


@@ -739,7 +739,7 @@


  int Failure::value() const {
-  return reinterpret_cast<int>(this) >> kFailureTagSize;
+  return static_cast<int>(reinterpret_cast<intptr_t>(this) >>  
kFailureTagSize);
  }


@@ -757,7 +757,8 @@
  Failure* Failure::Construct(Type type, int value) {
    int info = (value << kFailureTypeTagSize) | type;
    ASSERT(Smi::IsValid(info));  // Same validation check as in Smi
-  return reinterpret_cast<Failure*>((info << kFailureTagSize) |  
kFailureTag);
+  return reinterpret_cast<Failure*>(
+      static_cast<intptr_t>((info << kFailureTagSize) | kFailureTag));
  }



Modified: branches/bleeding_edge/src/objects.h
==============================================================================
--- branches/bleeding_edge/src/objects.h        (original)
+++ branches/bleeding_edge/src/objects.h        Mon May  4 06:11:38 2009
@@ -795,9 +795,10 @@
    void SmiVerify();
  #endif

+  static const int kSmiNumBits = 31;
    // Min and max limits for Smi values.
-  static const int kMinValue = -(1 << (kBitsPerPointer - (kSmiTagSize +  
1)));
-  static const int kMaxValue = (1 << (kBitsPerPointer - (kSmiTagSize +  
1))) - 1;
+  static const int kMinValue = -(1 << (kSmiNumBits - 1));
+  static const int kMaxValue = (1 << (kSmiNumBits - 1)) - 1;

   private:
    DISALLOW_IMPLICIT_CONSTRUCTORS(Smi);
@@ -2324,8 +2325,7 @@
    // the layout of the code object into account.
    int ExecutableSize() {
      // Check that the assumptions about the layout of the code object  
holds.
-    ASSERT_EQ(reinterpret_cast<unsigned int>(instruction_start()) -
-              reinterpret_cast<unsigned int>(address()),
+    ASSERT_EQ(instruction_start() - address(),
                Code::kHeaderSize);
      return instruction_size() + Code::kHeaderSize;
    }

Modified: branches/bleeding_edge/src/spaces.h
==============================================================================
--- branches/bleeding_edge/src/spaces.h (original)
+++ branches/bleeding_edge/src/spaces.h Mon May  4 06:11:38 2009
@@ -939,14 +939,14 @@
    // True if the address is in the address range of this semispace (not
    // necessarily below the allocation pointer).
    bool Contains(Address a) {
-    return (reinterpret_cast<uint32_t>(a) & address_mask_)
-           == reinterpret_cast<uint32_t>(start_);
+    return (reinterpret_cast<uintptr_t>(a) & address_mask_)
+           == reinterpret_cast<uintptr_t>(start_);
    }

    // True if the object is a heap object in the address range of this
    // semispace (not necessarily below the allocation pointer).
    bool Contains(Object* o) {
-    return (reinterpret_cast<uint32_t>(o) & object_mask_) ==  
object_expected_;
+    return (reinterpret_cast<uintptr_t>(o) & object_mask_) ==  
object_expected_;
    }

    // The offset of an address from the beginning of the space.
@@ -975,9 +975,9 @@
    Address age_mark_;

    // Masks and comparison values to test for containment in this semispace.
-  uint32_t address_mask_;
-  uint32_t object_mask_;
-  uint32_t object_expected_;
+  uintptr_t address_mask_;
+  uintptr_t object_mask_;
+  uintptr_t object_expected_;

   public:
    TRACK_MEMORY("SemiSpace")
@@ -1063,11 +1063,11 @@
    // True if the address or object lies in the address range of either
    // semispace (not necessarily below the allocation pointer).
    bool Contains(Address a) {
-    return (reinterpret_cast<uint32_t>(a) & address_mask_)
-        == reinterpret_cast<uint32_t>(start_);
+    return (reinterpret_cast<uintptr_t>(a) & address_mask_)
+        == reinterpret_cast<uintptr_t>(start_);
    }
    bool Contains(Object* o) {
-    return (reinterpret_cast<uint32_t>(o) & object_mask_) ==  
object_expected_;
+    return (reinterpret_cast<uintptr_t>(o) & object_mask_) ==  
object_expected_;
    }

    // Return the allocated bytes in the active semispace.

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

Reply via email to