Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index e4fffadc81b6c29e44d7801eaefc14535bdce35f..7b94a59a29f806ede93ec2b174a5a54825d7016e 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -2816,13 +2816,13 @@ class V8EXPORT Isolate { |
/** |
* Associate embedder-specific data with the isolate |
*/ |
- void SetData(void* data); |
+ inline void SetData(void* data); |
/** |
- * Retrive embedder-specific data from the isolate. |
+ * Retrieve embedder-specific data from the isolate. |
* Returns NULL if SetData has never been called. |
*/ |
- void* GetData(); |
+ inline void* GetData(); |
private: |
Isolate(); |
@@ -3961,6 +3961,18 @@ class Internals { |
return *reinterpret_cast<int*>(addr) == 1; |
} |
+ static inline void SetEmbedderData(v8::Isolate* isolate, void* data) { |
+ uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + |
+ kIsolateEmbedderDataOffset; |
+ *reinterpret_cast<void**>(addr) = data; |
+ } |
+ |
+ static inline void* GetEmbedderData(v8::Isolate* isolate) { |
+ uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + |
+ kIsolateEmbedderDataOffset; |
+ return *reinterpret_cast<void**>(addr); |
+ } |
+ |
static inline internal::Object** GetRoot(v8::Isolate* isolate, int index) { |
uint8_t* addr = reinterpret_cast<uint8_t*>(isolate) + kIsolateRootsOffset; |
return reinterpret_cast<internal::Object**>(addr + index * kApiPointerSize); |
@@ -4424,6 +4436,18 @@ Handle<Boolean> False(Isolate* isolate) { |
} |
+void Isolate::SetData(void* data) { |
+ typedef internal::Internals I; |
+ I::SetEmbedderData(this, data); |
+} |
+ |
+ |
+void* Isolate::GetData() { |
+ typedef internal::Internals I; |
+ return I::GetEmbedderData(this); |
+} |
+ |
+ |
/** |
* \example shell.cc |
* A simple shell that takes a list of expressions on the |