Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 1db14733a6e2e8699879ec631e8b0ad6507c40b4..3309567dc021d744e6d55fd9c0a8aa32790235de 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -5459,7 +5459,7 @@ V8_INLINE internal::Object* IntToSmi(int value) { |
template <> struct SmiTagging<4> { |
static const int kSmiShiftSize = 0; |
static const int kSmiValueSize = 31; |
- V8_INLINE static int SmiToInt(internal::Object* value) { |
+ V8_INLINE static int SmiToInt(const internal::Object* value) { |
int shift_bits = kSmiTagSize + kSmiShiftSize; |
// Throw away top 32 bits and shift down (requires >> to be sign extending). |
return static_cast<int>(reinterpret_cast<intptr_t>(value)) >> shift_bits; |
@@ -5487,7 +5487,7 @@ template <> struct SmiTagging<4> { |
template <> struct SmiTagging<8> { |
static const int kSmiShiftSize = 31; |
static const int kSmiValueSize = 32; |
- V8_INLINE static int SmiToInt(internal::Object* value) { |
+ V8_INLINE static int SmiToInt(const internal::Object* value) { |
int shift_bits = kSmiTagSize + kSmiShiftSize; |
// Shift down and throw away top 32 bits. |
return static_cast<int>(reinterpret_cast<intptr_t>(value) >> shift_bits); |
@@ -5575,12 +5575,12 @@ class Internals { |
#endif |
} |
- V8_INLINE static bool HasHeapObjectTag(internal::Object* value) { |
+ V8_INLINE static bool HasHeapObjectTag(const internal::Object* value) { |
return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == |
kHeapObjectTag); |
} |
- V8_INLINE static int SmiValue(internal::Object* value) { |
+ V8_INLINE static int SmiValue(const internal::Object* value) { |
return PlatformSmiTagging::SmiToInt(value); |
} |
@@ -5592,13 +5592,13 @@ class Internals { |
return PlatformSmiTagging::IsValidSmi(value); |
} |
- V8_INLINE static int GetInstanceType(internal::Object* obj) { |
+ V8_INLINE static int GetInstanceType(const internal::Object* obj) { |
typedef internal::Object O; |
O* map = ReadField<O*>(obj, kHeapObjectMapOffset); |
return ReadField<uint8_t>(map, kMapInstanceTypeOffset); |
} |
- V8_INLINE static int GetOddballKind(internal::Object* obj) { |
+ V8_INLINE static int GetOddballKind(const internal::Object* obj) { |
typedef internal::Object O; |
return SmiValue(ReadField<O*>(obj, kOddballKindOffset)); |
} |
@@ -5631,18 +5631,19 @@ class Internals { |
*addr = static_cast<uint8_t>((*addr & ~kNodeStateMask) | value); |
} |
- V8_INLINE static void SetEmbedderData(v8::Isolate *isolate, |
+ V8_INLINE static void SetEmbedderData(v8::Isolate* isolate, |
uint32_t slot, |
- void *data) { |
+ void* data) { |
uint8_t *addr = reinterpret_cast<uint8_t *>(isolate) + |
kIsolateEmbedderDataOffset + slot * kApiPointerSize; |
Michael Starzinger
2014/06/18 13:48:16
nit: There are three different indentation styles
|
*reinterpret_cast<void**>(addr) = data; |
} |
- V8_INLINE static void* GetEmbedderData(v8::Isolate* isolate, uint32_t slot) { |
- uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + |
+ V8_INLINE static void* GetEmbedderData(const v8::Isolate* isolate, |
+ uint32_t slot) { |
+ const uint8_t* addr = reinterpret_cast<const uint8_t*>(isolate) + |
kIsolateEmbedderDataOffset + slot * kApiPointerSize; |
- return *reinterpret_cast<void**>(addr); |
+ return *reinterpret_cast<void* const*>(addr); |
} |
V8_INLINE static internal::Object** GetRoot(v8::Isolate* isolate, |
@@ -5652,16 +5653,17 @@ class Internals { |
} |
template <typename T> |
- V8_INLINE static T ReadField(internal::Object* ptr, int offset) { |
- uint8_t* addr = reinterpret_cast<uint8_t*>(ptr) + offset - kHeapObjectTag; |
- return *reinterpret_cast<T*>(addr); |
+ V8_INLINE static T ReadField(const internal::Object* ptr, int offset) { |
+ const uint8_t* addr = |
+ reinterpret_cast<const uint8_t*>(ptr) + offset - kHeapObjectTag; |
+ return *reinterpret_cast<const T*>(addr); |
} |
template <typename T> |
- V8_INLINE static T ReadEmbedderData(v8::Context* context, int index) { |
+ V8_INLINE static T ReadEmbedderData(const v8::Context* context, int index) { |
typedef internal::Object O; |
typedef internal::Internals I; |
- O* ctx = *reinterpret_cast<O**>(context); |
+ O* ctx = *reinterpret_cast<O* const*>(context); |
int embedder_data_offset = I::kContextHeaderSize + |
(internal::kApiPointerSize * I::kContextEmbedderDataIndex); |
O* embedder_data = I::ReadField<O*>(ctx, embedder_data_offset); |