int Smi::value() {
- return reinterpret_cast<int>(this) >> kSmiTagSize;
+ return static_cast<int>(reinterpret_cast<intptr_t>(this) >> kSmiTagSize);
}
int Failure::value() const {
- return reinterpret_cast<int>(this) >> kFailureTagSize;
+ return static_cast<int>(reinterpret_cast<intptr_t>(this) >> kFailureTagSize);
}
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));
}
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);
// 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;
}
// 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.
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")
// 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.