Commit b029ad42 authored by dslomov@chromium.org's avatar dslomov@chromium.org

Fix typo

R=rossberg@chromium.org

BUG=

Committed: https://code.google.com/p/v8/source/detail?r=14505

Review URL: https://codereview.chromium.org/13993029

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14506 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7bfd5e90
......@@ -1108,6 +1108,67 @@ class V8EXPORT Value : public Data {
*/
bool IsRegExp() const;
/**
* Returns true if this value is an ArrayBuffer.
* This is an experimental feature.
*/
bool IsArrayBuffer() const;
/**
* Returns true if this value is one of TypedArrays.
* This is an experimental feature.
*/
bool IsTypedArray() const;
/**
* Returns true if this value is an Uint8Array.
* This is an experimental feature.
*/
bool IsUint8Array() const;
/**
* Returns true if this value is an Int8Array.
* This is an experimental feature.
*/
bool IsInt8Array() const;
/**
* Returns true if this value is an Uint16Array.
* This is an experimental feature.
*/
bool IsUint16Array() const;
/**
* Returns true if this value is an Int16Array.
* This is an experimental feature.
*/
bool IsInt16Array() const;
/**
* Returns true if this value is an Uint32Array.
* This is an experimental feature.
*/
bool IsUint32Array() const;
/**
* Returns true if this value is an Int32Array.
* This is an experimental feature.
*/
bool IsInt32Array() const;
/**
* Returns true if this value is a Float32Array.
* This is an experimental feature.
*/
bool IsFloat32Array() const;
/**
* Returns true if this value is a Float64Array.
* This is an experimental feature.
*/
bool IsFloat64Array() const;
Local<Boolean> ToBoolean() const;
Local<Number> ToNumber() const;
Local<String> ToString() const;
......
......@@ -2409,6 +2409,45 @@ bool Value::IsArray() const {
}
bool Value::IsArrayBuffer() const {
if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsArrayBuffer()"))
return false;
return Utils::OpenHandle(this)->IsJSArrayBuffer();
}
bool Value::IsTypedArray() const {
if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsArrayBuffer()"))
return false;
return Utils::OpenHandle(this)->IsJSTypedArray();
}
#define TYPED_ARRAY_LIST(F) \
F(Uint8Array, kExternalUnsignedByteArray) \
F(Int8Array, kExternalByteArray) \
F(Uint16Array, kExternalUnsignedShortArray) \
F(Int16Array, kExternalShortArray) \
F(Uint32Array, kExternalUnsignedIntArray) \
F(Int32Array, kExternalIntArray) \
F(Float32Array, kExternalFloatArray) \
F(Float64Array, kExternalDoubleArray)
#define VALUE_IS_TYPED_ARRAY(TypedArray, type_const) \
bool Value::Is##TypedArray() const { \
if (IsDeadCheck(i::Isolate::Current(), "v8::Value::Is" #TypedArray "()")) \
return false; \
i::Handle<i::Object> obj = Utils::OpenHandle(this); \
if (!obj->IsJSTypedArray()) return false; \
return i::JSTypedArray::cast(*obj)->type() == type_const; \
}
TYPED_ARRAY_LIST(VALUE_IS_TYPED_ARRAY)
#undef VALUE_IS_TYPED_ARRAY
bool Value::IsObject() const {
if (IsDeadCheck(i::Isolate::Current(), "v8::Value::IsObject()")) return false;
return Utils::OpenHandle(this)->IsJSObject();
......@@ -2776,14 +2815,7 @@ void v8::TypedArray::CheckCast(Value* that) {
}
CHECK_TYPED_ARRAY_CAST(Uint8Array, kExternalUnsignedByteArray)
CHECK_TYPED_ARRAY_CAST(Int8Array, kExternalByteArray)
CHECK_TYPED_ARRAY_CAST(Uint16Array, kExternalUnsignedShortArray)
CHECK_TYPED_ARRAY_CAST(Int16Array, kExternalShortArray)
CHECK_TYPED_ARRAY_CAST(Uint32Array, kExternalUnsignedIntArray)
CHECK_TYPED_ARRAY_CAST(Int32Array, kExternalIntArray)
CHECK_TYPED_ARRAY_CAST(Float32Array, kExternalFloatArray)
CHECK_TYPED_ARRAY_CAST(Float64Array, kExternalDoubleArray)
TYPED_ARRAY_LIST(CHECK_TYPED_ARRAY_CAST)
#undef CHECK_TYPED_ARRAY_CAST
......
......@@ -15174,6 +15174,31 @@ THREADED_TEST(Float64Array) {
v8::kExternalDoubleArray, -500, 500);
}
#define IS_TYPED_ARRAY_TEST(TypedArray) \
THREADED_TEST(Is##TypedArray) { \
i::FLAG_harmony_typed_arrays = true; \
LocalContext env; \
v8::Isolate* isolate = env->GetIsolate(); \
v8::HandleScope handle_scope(isolate); \
\
Handle<Value> result = CompileRun( \
"var ab = new ArrayBuffer(128);" \
"new " #TypedArray "(ab)"); \
CHECK(result->Is##TypedArray()); \
}
IS_TYPED_ARRAY_TEST(Uint8Array)
IS_TYPED_ARRAY_TEST(Int8Array)
IS_TYPED_ARRAY_TEST(Uint16Array)
IS_TYPED_ARRAY_TEST(Int16Array)
IS_TYPED_ARRAY_TEST(Uint32Array)
IS_TYPED_ARRAY_TEST(Int32Array)
IS_TYPED_ARRAY_TEST(Float32Array)
IS_TYPED_ARRAY_TEST(Float64Array)
#undef IS_TYPED_ARRAY_TEST
THREADED_TEST(ScriptContextDependence) {
LocalContext c1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment