v8.h | v8.h | |||
---|---|---|---|---|
skipping to change at line 2747 | skipping to change at line 2747 | |||
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 ); | |||
} | } | |||
}; | }; | |||
const int kSmiShiftSize = SmiConstants<sizeof(void*)>::kSmiShiftSize; | const int kSmiShiftSize = SmiConstants<sizeof(void*)>::kSmiShiftSize; | |||
const int kSmiValueSize = SmiConstants<sizeof(void*)>::kSmiValueSize; | const int kSmiValueSize = SmiConstants<sizeof(void*)>::kSmiValueSize; | |||
template <size_t ptr_size> struct InternalConstants; | ||||
// Internal constants for 32-bit systems. | ||||
template <> struct InternalConstants<4> { | ||||
static const int kStringResourceOffset = 3 * sizeof(void*); | ||||
}; | ||||
// Internal constants for 64-bit systems. | ||||
template <> struct InternalConstants<8> { | ||||
static const int kStringResourceOffset = 2 * sizeof(void*); | ||||
}; | ||||
/** | /** | |||
* This class exports constants and functionality from within v8 that | * This class exports constants and functionality from within v8 that | |||
* is necessary to implement inline functions in the v8 api. Don't | * is necessary to implement inline functions in the v8 api. Don't | |||
* depend on functions and constants defined here. | * depend on functions and constants defined here. | |||
*/ | */ | |||
class Internals { | class Internals { | |||
public: | public: | |||
// These values match non-compiler-dependent values defined within | // These values match non-compiler-dependent values defined within | |||
// the implementation of v8. | // the implementation of v8. | |||
static const int kHeapObjectMapOffset = 0; | static const int kHeapObjectMapOffset = 0; | |||
static const int kMapInstanceTypeOffset = sizeof(void*) + sizeof(int); | static const int kMapInstanceTypeOffset = sizeof(void*) + sizeof(int); | |||
static const int kStringResourceOffset = 2 * sizeof(void*); | static const int kStringResourceOffset = | |||
InternalConstants<sizeof(void*)>::kStringResourceOffset; | ||||
static const int kProxyProxyOffset = sizeof(void*); | static const int kProxyProxyOffset = sizeof(void*); | |||
static const int kJSObjectHeaderSize = 3 * sizeof(void*); | static const int kJSObjectHeaderSize = 3 * sizeof(void*); | |||
static const int kFullStringRepresentationMask = 0x07; | static const int kFullStringRepresentationMask = 0x07; | |||
static const int kExternalTwoByteRepresentationTag = 0x03; | static const int kExternalTwoByteRepresentationTag = 0x03; | |||
// These constants are compiler dependent so their values must be | // These constants are compiler dependent so their values must be | |||
// defined within the implementation. | // defined within the implementation. | |||
V8EXPORT static int kJSObjectType; | V8EXPORT static int kJSObjectType; | |||
V8EXPORT static int kFirstNonstringType; | V8EXPORT static int kFirstNonstringType; | |||
V8EXPORT static int kProxyType; | V8EXPORT static int kProxyType; | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 15 lines changed or added | |||