OLD | NEW |
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 2239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2250 CHECK(obj->Has(sym2)); | 2250 CHECK(obj->Has(sym2)); |
2251 CHECK(obj->Delete(sym2)); | 2251 CHECK(obj->Delete(sym2)); |
2252 CHECK(obj->Has(sym1)); | 2252 CHECK(obj->Has(sym1)); |
2253 CHECK(!obj->Has(sym2)); | 2253 CHECK(!obj->Has(sym2)); |
2254 CHECK_EQ(2002, obj->Get(sym1)->Int32Value()); | 2254 CHECK_EQ(2002, obj->Get(sym1)->Int32Value()); |
2255 CHECK_EQ(1, obj->GetOwnPropertyNames()->Length()); | 2255 CHECK_EQ(1, obj->GetOwnPropertyNames()->Length()); |
2256 } | 2256 } |
2257 | 2257 |
2258 | 2258 |
2259 THREADED_TEST(ArrayBuffer) { | 2259 THREADED_TEST(ArrayBuffer) { |
| 2260 i::FLAG_harmony_array_buffer = true; |
2260 i::FLAG_harmony_typed_arrays = true; | 2261 i::FLAG_harmony_typed_arrays = true; |
2261 | 2262 |
2262 LocalContext env; | 2263 LocalContext env; |
2263 v8::Isolate* isolate = env->GetIsolate(); | 2264 v8::Isolate* isolate = env->GetIsolate(); |
2264 v8::HandleScope handle_scope(isolate); | 2265 v8::HandleScope handle_scope(isolate); |
2265 | 2266 |
2266 Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(1024); | 2267 Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(1024); |
2267 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 2268 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
2268 | 2269 |
2269 CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); | 2270 CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); |
(...skipping 12830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15100 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0x40000000); | 15101 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0x40000000); |
15101 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0xffffffff); | 15102 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0xffffffff); |
15102 } | 15103 } |
15103 | 15104 |
15104 | 15105 |
15105 template <typename ElementType, typename TypedArray, | 15106 template <typename ElementType, typename TypedArray, |
15106 class ExternalArrayClass> | 15107 class ExternalArrayClass> |
15107 void TypedArrayTestHelper(v8::ExternalArrayType array_type, | 15108 void TypedArrayTestHelper(v8::ExternalArrayType array_type, |
15108 int64_t low, int64_t high) { | 15109 int64_t low, int64_t high) { |
15109 const int kElementCount = 50; | 15110 const int kElementCount = 50; |
| 15111 i::FLAG_harmony_array_buffer = true; |
15110 i::FLAG_harmony_typed_arrays = true; | 15112 i::FLAG_harmony_typed_arrays = true; |
15111 | 15113 |
15112 LocalContext env; | 15114 LocalContext env; |
15113 v8::Isolate* isolate = env->GetIsolate(); | 15115 v8::Isolate* isolate = env->GetIsolate(); |
15114 v8::HandleScope handle_scope(isolate); | 15116 v8::HandleScope handle_scope(isolate); |
15115 | 15117 |
15116 Local<v8::ArrayBuffer> ab = | 15118 Local<v8::ArrayBuffer> ab = |
15117 v8::ArrayBuffer::New((kElementCount+2)*sizeof(ElementType)); | 15119 v8::ArrayBuffer::New((kElementCount+2)*sizeof(ElementType)); |
15118 Local<TypedArray> ta = | 15120 Local<TypedArray> ta = |
15119 TypedArray::New(ab, 2*sizeof(ElementType), kElementCount); | 15121 TypedArray::New(ab, 2*sizeof(ElementType), kElementCount); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
15184 | 15186 |
15185 | 15187 |
15186 THREADED_TEST(Uint8ClampedArray) { | 15188 THREADED_TEST(Uint8ClampedArray) { |
15187 TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray, i::ExternalPixelArray>( | 15189 TypedArrayTestHelper<uint8_t, v8::Uint8ClampedArray, i::ExternalPixelArray>( |
15188 v8::kExternalPixelArray, 0, 0xFF); | 15190 v8::kExternalPixelArray, 0, 0xFF); |
15189 } | 15191 } |
15190 | 15192 |
15191 | 15193 |
15192 #define IS_TYPED_ARRAY_TEST(TypedArray) \ | 15194 #define IS_TYPED_ARRAY_TEST(TypedArray) \ |
15193 THREADED_TEST(Is##TypedArray) { \ | 15195 THREADED_TEST(Is##TypedArray) { \ |
| 15196 i::FLAG_harmony_array_buffer = true; \ |
15194 i::FLAG_harmony_typed_arrays = true; \ | 15197 i::FLAG_harmony_typed_arrays = true; \ |
15195 LocalContext env; \ | 15198 LocalContext env; \ |
15196 v8::Isolate* isolate = env->GetIsolate(); \ | 15199 v8::Isolate* isolate = env->GetIsolate(); \ |
15197 v8::HandleScope handle_scope(isolate); \ | 15200 v8::HandleScope handle_scope(isolate); \ |
15198 \ | 15201 \ |
15199 Handle<Value> result = CompileRun( \ | 15202 Handle<Value> result = CompileRun( \ |
15200 "var ab = new ArrayBuffer(128);" \ | 15203 "var ab = new ArrayBuffer(128);" \ |
15201 "new " #TypedArray "(ab)"); \ | 15204 "new " #TypedArray "(ab)"); \ |
15202 CHECK(result->Is##TypedArray()); \ | 15205 CHECK(result->Is##TypedArray()); \ |
15203 } | 15206 } |
(...skipping 3689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18893 i::Semaphore* sem_; | 18896 i::Semaphore* sem_; |
18894 volatile int sem_value_; | 18897 volatile int sem_value_; |
18895 }; | 18898 }; |
18896 | 18899 |
18897 | 18900 |
18898 THREADED_TEST(SemaphoreInterruption) { | 18901 THREADED_TEST(SemaphoreInterruption) { |
18899 ThreadInterruptTest().RunTest(); | 18902 ThreadInterruptTest().RunTest(); |
18900 } | 18903 } |
18901 | 18904 |
18902 #endif // WIN32 | 18905 #endif // WIN32 |
OLD | NEW |