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

Side by Side Diff: test/cctest/test-api.cc

Issue 13977018: Add Value::Is* methods for typed arrays and ArrayBuffer (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 15155 matching lines...) Expand 10 before | Expand all | Expand 10 after
15166 TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloatArray>( 15166 TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloatArray>(
15167 v8::kExternalFloatArray, -500, 500); 15167 v8::kExternalFloatArray, -500, 500);
15168 } 15168 }
15169 15169
15170 15170
15171 THREADED_TEST(Float64Array) { 15171 THREADED_TEST(Float64Array) {
15172 TypedArrayTestHelper<double, v8::Float64Array, i::ExternalDoubleArray>( 15172 TypedArrayTestHelper<double, v8::Float64Array, i::ExternalDoubleArray>(
15173 v8::kExternalDoubleArray, -500, 500); 15173 v8::kExternalDoubleArray, -500, 500);
15174 } 15174 }
15175 15175
15176 #define IS_TYPED_ARRAY_TEST(TypedArray) \
15177 THREADED_TEST(Is##TypedArray) { \
15178 i::FLAG_harmony_typed_arrays = true; \
15179 LocalContext env; \
15180 v8::Isolate* isolate = env->GetIsolate(); \
15181 v8::HandleScope handle_scope(isolate); \
15182 \
15183 Handle<Value> result = CompileRun( \
15184 "var ab = new ArrayBuffer(128);" \
15185 "new " #TypedArray "(ab)"); \
15186 CHECK(result->Is##TypedArray()); \
15187 }
15188
15189 IS_TYPED_ARRAY_TEST(Uint8Array)
15190 IS_TYPED_ARRAY_TEST(Int8Array)
15191 IS_TYPED_ARRAY_TEST(Uint16Array)
15192 IS_TYPED_ARRAY_TEST(Int16Array)
15193 IS_TYPED_ARRAY_TEST(Uint32Array)
15194 IS_TYPED_ARRAY_TEST(Int32Array)
15195 IS_TYPED_ARRAY_TEST(Float32Array)
15196 IS_TYPED_ARRAY_TEST(Float64Array)
15197
15198 #undef IS_TYPED_ARRAY_TEST
15199
15200
15176 15201
15177 THREADED_TEST(ScriptContextDependence) { 15202 THREADED_TEST(ScriptContextDependence) {
15178 LocalContext c1; 15203 LocalContext c1;
15179 v8::HandleScope scope(c1->GetIsolate()); 15204 v8::HandleScope scope(c1->GetIsolate());
15180 const char *source = "foo"; 15205 const char *source = "foo";
15181 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source)); 15206 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source));
15182 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source)); 15207 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source));
15183 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100)); 15208 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100));
15184 CHECK_EQ(dep->Run()->Int32Value(), 100); 15209 CHECK_EQ(dep->Run()->Int32Value(), 100);
15185 CHECK_EQ(indep->Run()->Int32Value(), 100); 15210 CHECK_EQ(indep->Run()->Int32Value(), 100);
(...skipping 3671 matching lines...) Expand 10 before | Expand all | Expand 10 after
18857 i::Semaphore* sem_; 18882 i::Semaphore* sem_;
18858 volatile int sem_value_; 18883 volatile int sem_value_;
18859 }; 18884 };
18860 18885
18861 18886
18862 THREADED_TEST(SemaphoreInterruption) { 18887 THREADED_TEST(SemaphoreInterruption) {
18863 ThreadInterruptTest().RunTest(); 18888 ThreadInterruptTest().RunTest();
18864 } 18889 }
18865 18890
18866 #endif // WIN32 18891 #endif // WIN32
OLDNEW
« src/api.cc ('K') | « src/api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698