v8.h   v8.h 
skipping to change at line 3293 skipping to change at line 3293
static const int kSmiShiftSize = 0; static const int kSmiShiftSize = 0;
static const int kSmiValueSize = 31; static const int kSmiValueSize = 31;
static inline int SmiToInt(internal::Object* value) { static inline int SmiToInt(internal::Object* value) {
int shift_bits = kSmiTagSize + kSmiShiftSize; int shift_bits = kSmiTagSize + kSmiShiftSize;
// Throw away top 32 bits and shift down (requires >> to be sign extend ing). // Throw away top 32 bits and shift down (requires >> to be sign extend ing).
return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bit s; return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bit s;
} }
// For 32-bit systems any 2 bytes aligned pointer can be encoded as smi // For 32-bit systems any 2 bytes aligned pointer can be encoded as smi
// with a plain reinterpret_cast. // with a plain reinterpret_cast.
static const intptr_t kEncodablePointerMask = 0x1; static const uintptr_t kEncodablePointerMask = 0x1;
static const int kPointerToSmiShift = 0; static const int kPointerToSmiShift = 0;
}; };
// Smi constants for 64-bit systems. // Smi constants for 64-bit systems.
template <> struct SmiTagging<8> { template <> struct SmiTagging<8> {
static const int kSmiShiftSize = 31; static const int kSmiShiftSize = 31;
static const int kSmiValueSize = 32; static const int kSmiValueSize = 32;
static inline int SmiToInt(internal::Object* value) { static inline int SmiToInt(internal::Object* value) {
int shift_bits = kSmiTagSize + kSmiShiftSize; int shift_bits = kSmiTagSize + kSmiShiftSize;
// Shift down and throw away top 32 bits. // Shift down and throw away top 32 bits.
return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits ); return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits );
} }
// To maximize the range of pointers that can be encoded // To maximize the range of pointers that can be encoded
// in the available 32 bits, we require them to be 8 bytes aligned. // in the available 32 bits, we require them to be 8 bytes aligned.
// This gives 2 ^ (32 + 3) = 32G address space covered. // This gives 2 ^ (32 + 3) = 32G address space covered.
// It might be not enough to cover stack allocated objects on some platfo rms. // It might be not enough to cover stack allocated objects on some platfo rms.
static const int kPointerAlignment = 3; static const int kPointerAlignment = 3;
static const intptr_t kEncodablePointerMask = static const uintptr_t kEncodablePointerMask =
~(intptr_t(0xffffffff) << kPointerAlignment); ~(uintptr_t(0xffffffff) << kPointerAlignment);
static const int kPointerToSmiShift = static const int kPointerToSmiShift =
kSmiTagSize + kSmiShiftSize - kPointerAlignment; kSmiTagSize + kSmiShiftSize - kPointerAlignment;
}; };
typedef SmiTagging<kApiPointerSize> PlatformSmiTagging; typedef SmiTagging<kApiPointerSize> PlatformSmiTagging;
const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize; const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize; const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
const intptr_t kEncodablePointerMask = const uintptr_t kEncodablePointerMask =
PlatformSmiTagging::kEncodablePointerMask; PlatformSmiTagging::kEncodablePointerMask;
const int kPointerToSmiShift = PlatformSmiTagging::kPointerToSmiShift; const int kPointerToSmiShift = PlatformSmiTagging::kPointerToSmiShift;
template <size_t ptr_size> struct InternalConstants; template <size_t ptr_size> struct InternalConstants;
// Internal constants for 32-bit systems. // Internal constants for 32-bit systems.
template <> struct InternalConstants<4> { template <> struct InternalConstants<4> {
static const int kStringResourceOffset = 3 * kApiPointerSize; static const int kStringResourceOffset = 3 * kApiPointerSize;
}; };
skipping to change at line 3383 skipping to change at line 3383
return PlatformSmiTagging::SmiToInt(value); return PlatformSmiTagging::SmiToInt(value);
} }
static inline int GetInstanceType(internal::Object* obj) { static inline int GetInstanceType(internal::Object* obj) {
typedef internal::Object O; typedef internal::Object O;
O* map = ReadField<O*>(obj, kHeapObjectMapOffset); O* map = ReadField<O*>(obj, kHeapObjectMapOffset);
return ReadField<uint8_t>(map, kMapInstanceTypeOffset); return ReadField<uint8_t>(map, kMapInstanceTypeOffset);
} }
static inline void* GetExternalPointerFromSmi(internal::Object* value) { 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); return reinterpret_cast<void*>(address >> kPointerToSmiShift);
} }
static inline void* GetExternalPointer(internal::Object* obj) { static inline void* GetExternalPointer(internal::Object* obj) {
if (HasSmiTag(obj)) { if (HasSmiTag(obj)) {
return GetExternalPointerFromSmi(obj); return GetExternalPointerFromSmi(obj);
} else if (GetInstanceType(obj) == kProxyType) { } else if (GetInstanceType(obj) == kProxyType) {
return ReadField<void*>(obj, kProxyProxyOffset); return ReadField<void*>(obj, kProxyProxyOffset);
} else { } else {
return NULL; return NULL;
 End of changes. 4 change blocks. 
5 lines changed or deleted 5 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/