Index: vm/dart_api_impl.h |
=================================================================== |
--- vm/dart_api_impl.h (revision 6440) |
+++ vm/dart_api_impl.h (working copy) |
@@ -111,6 +111,19 @@ |
// Gets the handle used to designate successful return. |
static Dart_Handle Success(Isolate* isolate); |
+ // Returns true if the handle holds a Smi. |
+ static bool IsSmi(Dart_Handle handle) { |
cshapiro
2012/04/11 23:29:09
Why not call the existing predicate after casing t
turnidge
2012/04/16 20:07:24
Done.
|
+ uword value = *(reinterpret_cast<uword*>(handle)); |
+ return (value & kSmiTagMask) == kSmiTag; |
+ } |
+ |
+ // Returns the value of a Smi. |
+ static intptr_t SmiValue(Dart_Handle handle) { |
+ intptr_t value = *(reinterpret_cast<intptr_t*>(handle)); |
cshapiro
2012/04/11 23:29:09
This may be another opportunity to reuse existing
turnidge
2012/04/16 20:07:24
Done. Had to add friend permission though...
|
+ ASSERT((value & kSmiTagMask) == kSmiTag); |
+ return (value >> kSmiTagShift); |
+ } |
+ |
// Generates a handle used to designate an error return. |
static Dart_Handle NewError(const char* format, ...); |