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

Unified Diff: include/v8.h

Issue 1003663002: Add Cast() for Int32 and Uint32 (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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') | no next file with comments »
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 fc8ff5a3ff3097dc7ccf3ae4fe1d82f4760a5555..db625eeb4242be3d594628fdf8f2f450d0ef894e 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -2465,8 +2465,11 @@ class V8_EXPORT Integer : public Number {
class V8_EXPORT Int32 : public Integer {
public:
int32_t Value() const;
+ V8_INLINE static Int32* Cast(v8::Value* obj);
+
private:
Int32();
+ static void CheckCast(v8::Value* obj);
};
@@ -2476,8 +2479,11 @@ class V8_EXPORT Int32 : public Integer {
class V8_EXPORT Uint32 : public Integer {
public:
uint32_t Value() const;
+ V8_INLINE static Uint32* Cast(v8::Value* obj);
+
private:
Uint32();
+ static void CheckCast(v8::Value* obj);
};
@@ -7364,6 +7370,22 @@ Integer* Integer::Cast(v8::Value* value) {
}
+Int32* Int32::Cast(v8::Value* value) {
+#ifdef V8_ENABLE_CHECKS
+ CheckCast(value);
+#endif
+ return static_cast<Int32*>(value);
+}
+
+
+Uint32* Uint32::Cast(v8::Value* value) {
+#ifdef V8_ENABLE_CHECKS
+ CheckCast(value);
+#endif
+ return static_cast<Uint32*>(value);
+}
+
+
Date* Date::Cast(v8::Value* value) {
#ifdef V8_ENABLE_CHECKS
CheckCast(value);
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698