Commit d423dea5 authored by lrn@chromium.org's avatar lrn@chromium.org

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


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@1843 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8a15c499
......@@ -254,7 +254,7 @@ template <int> class StaticAssertionHelper { };
#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)
......
......@@ -683,7 +683,7 @@ Object** HeapObject::RawField(HeapObject* obj, int byte_offset) {
int Smi::value() {
return reinterpret_cast<int>(this) >> kSmiTagSize;
return static_cast<int>(reinterpret_cast<intptr_t>(this) >> kSmiTagSize);
}
......@@ -739,7 +739,7 @@ Failure* Failure::OutOfMemoryException() {
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::RetryAfterGC(int requested_bytes) {
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));
}
......
......@@ -795,9 +795,10 @@ class Smi: public Object {
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 @@ class Code: public HeapObject {
// 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;
}
......
......@@ -939,14 +939,14 @@ class SemiSpace : public Space {
// 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 @@ class SemiSpace : public Space {
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 @@ class NewSpace : public Space {
// 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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment