| Index: runtime/bin/dartutils.h
|
| diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h
|
| index cbe9c953df09509255039f8dda01e63b30c69329..a0f2c9151f8fc5e5a96dc839532819940a1f5c36 100644
|
| --- a/runtime/bin/dartutils.h
|
| +++ b/runtime/bin/dartutils.h
|
| @@ -114,6 +114,8 @@ class CObject {
|
| bool IsBool() { return type() == Dart_CObject::kBool; }
|
| bool IsInt32() { return type() == Dart_CObject::kInt32; }
|
| bool IsInt64() { return type() == Dart_CObject::kInt64; }
|
| + bool IsInt32OrInt64() { return IsInt32() || IsInt64(); }
|
| + bool IsIntptr() { return IsInt32OrInt64(); }
|
| bool IsBigint() { return type() == Dart_CObject::kBigint; }
|
| bool IsDouble() { return type() == Dart_CObject::kDouble; }
|
| bool IsString() { return type() == Dart_CObject::kString; }
|
| @@ -138,12 +140,13 @@ class CObject {
|
| static Dart_CObject* New(Dart_CObject::Type type, int additional_bytes = 0);
|
| static Dart_CObject* NewInt32(int32_t value);
|
| static Dart_CObject* NewInt64(int64_t value);
|
| + static Dart_CObject* NewIntptr(intptr_t value);
|
| // kBigint,
|
| static Dart_CObject* NewDouble(double value);
|
| static Dart_CObject* NewString(int length);
|
| static Dart_CObject* NewString(const char* str);
|
| static Dart_CObject* NewArray(int length);
|
| - // kByteArray,
|
| + static Dart_CObject* NewByteArray(int length);
|
|
|
| Dart_CObject* AsApiCObject() { return cobject_; }
|
|
|
| @@ -197,6 +200,31 @@ class CObjectInt64 : public CObject {
|
| };
|
|
|
|
|
| +class CObjectIntptr : public CObject {
|
| + public:
|
| + explicit CObjectIntptr(Dart_CObject *cobject) : CObject(cobject) {
|
| + ASSERT(type() == Dart_CObject::kInt32 || type() == Dart_CObject::kInt64);
|
| + cobject_ = cobject;
|
| + }
|
| + explicit CObjectIntptr(CObject* cobject) : CObject() {
|
| + ASSERT(cobject != NULL);
|
| + ASSERT(cobject->type() == Dart_CObject::kInt64 ||
|
| + cobject->type() == Dart_CObject::kInt32);
|
| + cobject_ = cobject->AsApiCObject();
|
| + }
|
| +
|
| + intptr_t Value() {
|
| + intptr_t result;
|
| + if (type() == Dart_CObject::kInt32) {
|
| + result = cobject_->value.as_int32;
|
| + } else {
|
| + result = cobject_->value.as_int64;
|
| + }
|
| + return result;
|
| + }
|
| +};
|
| +
|
| +
|
| class CObjectBigint : public CObject {
|
| public:
|
| DECLARE_COBJECT_CONSTRUCTORS(Bigint)
|
| @@ -235,4 +263,13 @@ class CObjectArray : public CObject {
|
| }
|
| };
|
|
|
| +
|
| +class CObjectByteArray : public CObject {
|
| + public:
|
| + DECLARE_COBJECT_CONSTRUCTORS(ByteArray)
|
| +
|
| + int Length() const { return cobject_->value.as_byte_array.length; }
|
| + uint8_t* Buffer() const { return cobject_->value.as_byte_array.values; }
|
| +};
|
| +
|
| #endif // BIN_DARTUTILS_H_
|
|
|