Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(869)

Unified Diff: include/v8.h

Issue 6119009: Wrap external pointers more carefully. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 883bfad9458ebc31c511ff3ba93568e2d1eab635..db7e24a4799c5d87e533b2c221e5b75f74ed712a 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -3432,9 +3432,14 @@ class Internals {
return ReadField<uint8_t>(map, kMapInstanceTypeOffset);
}
+ static inline void* GetExternalPointerFromSmi(internal::Object* smi) {
+ return reinterpret_cast<void*>(
+ reinterpret_cast<intptr_t>(smi) >> kSmiShiftSize);
Lasse Reichstein 2011/01/13 08:35:18 I don't think this will work in 64-bit mode (kShif
+ }
+
static inline void* GetExternalPointer(internal::Object* obj) {
if (HasSmiTag(obj)) {
- return obj;
+ return GetExternalPointerFromSmi(obj);
} else if (GetInstanceType(obj) == kProxyType) {
return ReadField<void*>(obj, kProxyProxyOffset);
} else {
« no previous file with comments | « no previous file | src/api.cc » ('j') | src/api.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698