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

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

Issue 1257223002: Revert of Remove ExternalArray, derived types, and element kinds (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « test/cctest/compiler/test-run-properties.cc ('k') | test/mjsunit/elements-kind.js » ('j') | 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 14131 matching lines...) Expand 10 before | Expand all | Expand 10 after
14142 for (int i = 0; i < kElementCount; i++) { 14142 for (int i = 0; i < kElementCount; i++) {
14143 data[i] = static_cast<ElementType>(i); 14143 data[i] = static_cast<ElementType>(i);
14144 } 14144 }
14145 14145
14146 ObjectWithExternalArrayTestHelper<ExternalArrayClass, ElementType>( 14146 ObjectWithExternalArrayTestHelper<ExternalArrayClass, ElementType>(
14147 env.local(), ta, kElementCount, array_type, low, high); 14147 env.local(), ta, kElementCount, array_type, low, high);
14148 } 14148 }
14149 14149
14150 14150
14151 THREADED_TEST(Uint8Array) { 14151 THREADED_TEST(Uint8Array) {
14152 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array, 14152 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::ExternalUint8Array,
14153 v8::ArrayBuffer>(i::kExternalUint8Array, 0, 0xFF); 14153 v8::ArrayBuffer>(i::kExternalUint8Array, 0, 0xFF);
14154 } 14154 }
14155 14155
14156 14156
14157 THREADED_TEST(Int8Array) { 14157 THREADED_TEST(Int8Array) {
14158 TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array, 14158 TypedArrayTestHelper<int8_t, v8::Int8Array, i::ExternalInt8Array,
14159 v8::ArrayBuffer>(i::kExternalInt8Array, -0x80, 0x7F); 14159 v8::ArrayBuffer>(i::kExternalInt8Array, -0x80, 0x7F);
14160 } 14160 }
14161 14161
14162 14162
14163 THREADED_TEST(Uint16Array) { 14163 THREADED_TEST(Uint16Array) {
14164 TypedArrayTestHelper<uint16_t, v8::Uint16Array, i::FixedUint16Array, 14164 TypedArrayTestHelper<uint16_t, v8::Uint16Array, i::ExternalUint16Array,
14165 v8::ArrayBuffer>(i::kExternalUint16Array, 0, 0xFFFF); 14165 v8::ArrayBuffer>(i::kExternalUint16Array, 0, 0xFFFF);
14166 } 14166 }
14167 14167
14168 14168
14169 THREADED_TEST(Int16Array) { 14169 THREADED_TEST(Int16Array) {
14170 TypedArrayTestHelper<int16_t, v8::Int16Array, i::FixedInt16Array, 14170 TypedArrayTestHelper<int16_t, v8::Int16Array, i::ExternalInt16Array,
14171 v8::ArrayBuffer>(i::kExternalInt16Array, -0x8000, 14171 v8::ArrayBuffer>(i::kExternalInt16Array, -0x8000,
14172 0x7FFF); 14172 0x7FFF);
14173 } 14173 }
14174 14174
14175 14175
14176 THREADED_TEST(Uint32Array) { 14176 THREADED_TEST(Uint32Array) {
14177 TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::FixedUint32Array, 14177 TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::ExternalUint32Array,
14178 v8::ArrayBuffer>(i::kExternalUint32Array, 0, UINT_MAX); 14178 v8::ArrayBuffer>(i::kExternalUint32Array, 0, UINT_MAX);
14179 } 14179 }
14180 14180
14181 14181
14182 THREADED_TEST(Int32Array) { 14182 THREADED_TEST(Int32Array) {
14183 TypedArrayTestHelper<int32_t, v8::Int32Array, i::FixedInt32Array, 14183 TypedArrayTestHelper<int32_t, v8::Int32Array, i::ExternalInt32Array,
14184 v8::ArrayBuffer>(i::kExternalInt32Array, INT_MIN, 14184 v8::ArrayBuffer>(i::kExternalInt32Array, INT_MIN,
14185 INT_MAX); 14185 INT_MAX);
14186 } 14186 }
14187 14187
14188 14188
14189 THREADED_TEST(Float32Array) { 14189 THREADED_TEST(Float32Array) {
14190 TypedArrayTestHelper<float, v8::Float32Array, i::FixedFloat32Array, 14190 TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloat32Array,
14191 v8::ArrayBuffer>(i::kExternalFloat32Array, -500, 500); 14191 v8::ArrayBuffer>(i::kExternalFloat32Array, -500, 500);
14192 } 14192 }
14193 14193
14194 14194
14195 THREADED_TEST(Float64Array) { 14195 THREADED_TEST(Float64Array) {
14196 TypedArrayTestHelper<double, v8::Float64Array, i::FixedFloat64Array, 14196 TypedArrayTestHelper<double, v8::Float64Array, i::ExternalFloat64Array,
14197 v8::ArrayBuffer>(i::kExternalFloat64Array, -500, 500); 14197 v8::ArrayBuffer>(i::kExternalFloat64Array, -500, 500);
14198 } 14198 }
14199 14199
14200 14200
14201 THREADED_TEST(Uint8ClampedArray) { 14201 THREADED_TEST(Uint8ClampedArray) {
14202 TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray, 14202 TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray,
14203 i::FixedUint8ClampedArray, v8::ArrayBuffer>( 14203 i::ExternalUint8ClampedArray, v8::ArrayBuffer>(
14204 i::kExternalUint8ClampedArray, 0, 0xFF); 14204 i::kExternalUint8ClampedArray, 0, 0xFF);
14205 } 14205 }
14206 14206
14207 14207
14208 THREADED_TEST(DataView) { 14208 THREADED_TEST(DataView) {
14209 const int kSize = 50; 14209 const int kSize = 50;
14210 14210
14211 i::ScopedVector<uint8_t> backing_store(kSize+2); 14211 i::ScopedVector<uint8_t> backing_store(kSize+2);
14212 14212
14213 LocalContext env; 14213 LocalContext env;
14214 v8::Isolate* isolate = env->GetIsolate(); 14214 v8::Isolate* isolate = env->GetIsolate();
14215 v8::HandleScope handle_scope(isolate); 14215 v8::HandleScope handle_scope(isolate);
14216 14216
14217 Local<v8::ArrayBuffer> ab = 14217 Local<v8::ArrayBuffer> ab =
14218 v8::ArrayBuffer::New(isolate, backing_store.start(), 2 + kSize); 14218 v8::ArrayBuffer::New(isolate, backing_store.start(), 2 + kSize);
14219 Local<v8::DataView> dv = v8::DataView::New(ab, 2, kSize); 14219 Local<v8::DataView> dv = v8::DataView::New(ab, 2, kSize);
14220 CheckInternalFieldsAreZero<v8::ArrayBufferView>(dv); 14220 CheckInternalFieldsAreZero<v8::ArrayBufferView>(dv);
14221 CHECK_EQ(2u, dv->ByteOffset()); 14221 CHECK_EQ(2u, dv->ByteOffset());
14222 CHECK_EQ(kSize, static_cast<int>(dv->ByteLength())); 14222 CHECK_EQ(kSize, static_cast<int>(dv->ByteLength()));
14223 CHECK(ab->Equals(dv->Buffer())); 14223 CHECK(ab->Equals(dv->Buffer()));
14224 } 14224 }
14225 14225
14226 14226
14227 THREADED_TEST(SharedUint8Array) { 14227 THREADED_TEST(SharedUint8Array) {
14228 i::FLAG_harmony_sharedarraybuffer = true; 14228 i::FLAG_harmony_sharedarraybuffer = true;
14229 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::FixedUint8Array, 14229 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::ExternalUint8Array,
14230 v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF); 14230 v8::SharedArrayBuffer>(i::kExternalUint8Array, 0, 0xFF);
14231 } 14231 }
14232 14232
14233 14233
14234 THREADED_TEST(SharedInt8Array) { 14234 THREADED_TEST(SharedInt8Array) {
14235 i::FLAG_harmony_sharedarraybuffer = true; 14235 i::FLAG_harmony_sharedarraybuffer = true;
14236 TypedArrayTestHelper<int8_t, v8::Int8Array, i::FixedInt8Array, 14236 TypedArrayTestHelper<int8_t, v8::Int8Array, i::ExternalInt8Array,
14237 v8::SharedArrayBuffer>(i::kExternalInt8Array, -0x80, 14237 v8::SharedArrayBuffer>(i::kExternalInt8Array, -0x80,
14238 0x7F); 14238 0x7F);
14239 } 14239 }
14240 14240
14241 14241
14242 THREADED_TEST(SharedUint16Array) { 14242 THREADED_TEST(SharedUint16Array) {
14243 i::FLAG_harmony_sharedarraybuffer = true; 14243 i::FLAG_harmony_sharedarraybuffer = true;
14244 TypedArrayTestHelper<uint16_t, v8::Uint16Array, i::FixedUint16Array, 14244 TypedArrayTestHelper<uint16_t, v8::Uint16Array, i::ExternalUint16Array,
14245 v8::SharedArrayBuffer>(i::kExternalUint16Array, 0, 14245 v8::SharedArrayBuffer>(i::kExternalUint16Array, 0,
14246 0xFFFF); 14246 0xFFFF);
14247 } 14247 }
14248 14248
14249 14249
14250 THREADED_TEST(SharedInt16Array) { 14250 THREADED_TEST(SharedInt16Array) {
14251 i::FLAG_harmony_sharedarraybuffer = true; 14251 i::FLAG_harmony_sharedarraybuffer = true;
14252 TypedArrayTestHelper<int16_t, v8::Int16Array, i::FixedInt16Array, 14252 TypedArrayTestHelper<int16_t, v8::Int16Array, i::ExternalInt16Array,
14253 v8::SharedArrayBuffer>(i::kExternalInt16Array, -0x8000, 14253 v8::SharedArrayBuffer>(i::kExternalInt16Array, -0x8000,
14254 0x7FFF); 14254 0x7FFF);
14255 } 14255 }
14256 14256
14257 14257
14258 THREADED_TEST(SharedUint32Array) { 14258 THREADED_TEST(SharedUint32Array) {
14259 i::FLAG_harmony_sharedarraybuffer = true; 14259 i::FLAG_harmony_sharedarraybuffer = true;
14260 TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::FixedUint32Array, 14260 TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::ExternalUint32Array,
14261 v8::SharedArrayBuffer>(i::kExternalUint32Array, 0, 14261 v8::SharedArrayBuffer>(i::kExternalUint32Array, 0,
14262 UINT_MAX); 14262 UINT_MAX);
14263 } 14263 }
14264 14264
14265 14265
14266 THREADED_TEST(SharedInt32Array) { 14266 THREADED_TEST(SharedInt32Array) {
14267 i::FLAG_harmony_sharedarraybuffer = true; 14267 i::FLAG_harmony_sharedarraybuffer = true;
14268 TypedArrayTestHelper<int32_t, v8::Int32Array, i::FixedInt32Array, 14268 TypedArrayTestHelper<int32_t, v8::Int32Array, i::ExternalInt32Array,
14269 v8::SharedArrayBuffer>(i::kExternalInt32Array, INT_MIN, 14269 v8::SharedArrayBuffer>(i::kExternalInt32Array, INT_MIN,
14270 INT_MAX); 14270 INT_MAX);
14271 } 14271 }
14272 14272
14273 14273
14274 THREADED_TEST(SharedFloat32Array) { 14274 THREADED_TEST(SharedFloat32Array) {
14275 i::FLAG_harmony_sharedarraybuffer = true; 14275 i::FLAG_harmony_sharedarraybuffer = true;
14276 TypedArrayTestHelper<float, v8::Float32Array, i::FixedFloat32Array, 14276 TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloat32Array,
14277 v8::SharedArrayBuffer>(i::kExternalFloat32Array, -500, 14277 v8::SharedArrayBuffer>(i::kExternalFloat32Array, -500,
14278 500); 14278 500);
14279 } 14279 }
14280 14280
14281 14281
14282 THREADED_TEST(SharedFloat64Array) { 14282 THREADED_TEST(SharedFloat64Array) {
14283 i::FLAG_harmony_sharedarraybuffer = true; 14283 i::FLAG_harmony_sharedarraybuffer = true;
14284 TypedArrayTestHelper<double, v8::Float64Array, i::FixedFloat64Array, 14284 TypedArrayTestHelper<double, v8::Float64Array, i::ExternalFloat64Array,
14285 v8::SharedArrayBuffer>(i::kExternalFloat64Array, -500, 14285 v8::SharedArrayBuffer>(i::kExternalFloat64Array, -500,
14286 500); 14286 500);
14287 } 14287 }
14288 14288
14289 14289
14290 THREADED_TEST(SharedUint8ClampedArray) { 14290 THREADED_TEST(SharedUint8ClampedArray) {
14291 i::FLAG_harmony_sharedarraybuffer = true; 14291 i::FLAG_harmony_sharedarraybuffer = true;
14292 TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray, 14292 TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray,
14293 i::FixedUint8ClampedArray, v8::SharedArrayBuffer>( 14293 i::ExternalUint8ClampedArray, v8::SharedArrayBuffer>(
14294 i::kExternalUint8ClampedArray, 0, 0xFF); 14294 i::kExternalUint8ClampedArray, 0, 0xFF);
14295 } 14295 }
14296 14296
14297 14297
14298 THREADED_TEST(SharedDataView) { 14298 THREADED_TEST(SharedDataView) {
14299 i::FLAG_harmony_sharedarraybuffer = true; 14299 i::FLAG_harmony_sharedarraybuffer = true;
14300 const int kSize = 50; 14300 const int kSize = 50;
14301 14301
14302 i::ScopedVector<uint8_t> backing_store(kSize + 2); 14302 i::ScopedVector<uint8_t> backing_store(kSize + 2);
14303 14303
(...skipping 7623 matching lines...) Expand 10 before | Expand all | Expand 10 after
21927 21927
21928 v8::TryCatch try_catch(CcTest::isolate()); 21928 v8::TryCatch try_catch(CcTest::isolate());
21929 timeout_thread.Start(); 21929 timeout_thread.Start();
21930 21930
21931 CompileRun( 21931 CompileRun(
21932 "var ab = new SharedArrayBuffer(4);" 21932 "var ab = new SharedArrayBuffer(4);"
21933 "var i32a = new Int32Array(ab);" 21933 "var i32a = new Int32Array(ab);"
21934 "Atomics.futexWait(i32a, 0, 0);"); 21934 "Atomics.futexWait(i32a, 0, 0);");
21935 CHECK(try_catch.HasTerminated()); 21935 CHECK(try_catch.HasTerminated());
21936 } 21936 }
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-run-properties.cc ('k') | test/mjsunit/elements-kind.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698