Chromium Code Reviews| 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 2297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2308 "u8_b[1] = 0xCC;" | 2308 "u8_b[1] = 0xCC;" |
| 2309 "u8_b.length"); | 2309 "u8_b.length"); |
| 2310 CHECK_EQ(100, result->Int32Value()); | 2310 CHECK_EQ(100, result->Int32Value()); |
| 2311 CHECK_EQ(0xBB, my_data[0]); | 2311 CHECK_EQ(0xBB, my_data[0]); |
| 2312 CHECK_EQ(0xCC, my_data[1]); | 2312 CHECK_EQ(0xCC, my_data[1]); |
| 2313 my_data[0] = 0xCC; | 2313 my_data[0] = 0xCC; |
| 2314 my_data[1] = 0x11; | 2314 my_data[1] = 0x11; |
| 2315 result = CompileRun("u8_b[0] + u8_b[1]"); | 2315 result = CompileRun("u8_b[0] + u8_b[1]"); |
| 2316 CHECK_EQ(0xDD, result->Int32Value()); | 2316 CHECK_EQ(0xDD, result->Int32Value()); |
| 2317 | 2317 |
| 2318 | |
| 2319 delete[] my_data; | 2318 delete[] my_data; |
| 2320 } | 2319 } |
| 2321 | 2320 |
| 2322 | 2321 |
| 2323 THREADED_TEST(HiddenProperties) { | 2322 THREADED_TEST(HiddenProperties) { |
| 2324 LocalContext env; | 2323 LocalContext env; |
| 2325 v8::HandleScope scope(env->GetIsolate()); | 2324 v8::HandleScope scope(env->GetIsolate()); |
| 2326 | 2325 |
| 2327 v8::Local<v8::Object> obj = v8::Object::New(); | 2326 v8::Local<v8::Object> obj = v8::Object::New(); |
| 2328 v8::Local<v8::String> key = v8_str("api-test::hidden-key"); | 2327 v8::Local<v8::String> key = v8_str("api-test::hidden-key"); |
| (...skipping 9959 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12288 | 12287 |
| 12289 static int64_t cast(intptr_t x) { return static_cast<int64_t>(x); } | 12288 static int64_t cast(intptr_t x) { return static_cast<int64_t>(x); } |
| 12290 | 12289 |
| 12291 | 12290 |
| 12292 THREADED_TEST(ExternalAllocatedMemory) { | 12291 THREADED_TEST(ExternalAllocatedMemory) { |
| 12293 v8::HandleScope outer(v8::Isolate::GetCurrent()); | 12292 v8::HandleScope outer(v8::Isolate::GetCurrent()); |
| 12294 v8::Persistent<Context> env(Context::New()); | 12293 v8::Persistent<Context> env(Context::New()); |
| 12295 CHECK(!env.IsEmpty()); | 12294 CHECK(!env.IsEmpty()); |
| 12296 const intptr_t kSize = 1024*1024; | 12295 const intptr_t kSize = 1024*1024; |
| 12297 v8::Isolate* isolate = env->GetIsolate(); | 12296 v8::Isolate* isolate = env->GetIsolate(); |
| 12298 CHECK_EQ(cast(isolate->AdjustAmountOfExternalAllocatedMemory(kSize)), | 12297 int64_t baseline = cast(isolate->AdjustAmountOfExternalAllocatedMemory(0)); |
| 12299 cast(kSize)); | 12298 CHECK_EQ(baseline + cast(kSize), |
| 12300 CHECK_EQ(cast(isolate->AdjustAmountOfExternalAllocatedMemory(-kSize)), | 12299 cast(isolate->AdjustAmountOfExternalAllocatedMemory(kSize))); |
|
rossberg
2013/04/29 10:50:27
Nit: indentation
Dmitry Lomov (no reviews)
2013/04/29 11:08:53
Done.
| |
| 12301 cast(0)); | 12300 CHECK_EQ(baseline, |
| 12301 cast(isolate->AdjustAmountOfExternalAllocatedMemory(-kSize))); | |
| 12302 } | 12302 } |
| 12303 | 12303 |
| 12304 | 12304 |
| 12305 THREADED_TEST(DisposeEnteredContext) { | 12305 THREADED_TEST(DisposeEnteredContext) { |
| 12306 LocalContext outer; | 12306 LocalContext outer; |
| 12307 v8::HandleScope scope(outer->GetIsolate()); | 12307 v8::HandleScope scope(outer->GetIsolate()); |
| 12308 { v8::Persistent<v8::Context> inner = v8::Context::New(); | 12308 { v8::Persistent<v8::Context> inner = v8::Context::New(); |
| 12309 inner->Enter(); | 12309 inner->Enter(); |
| 12310 inner.Dispose(inner->GetIsolate()); | 12310 inner.Dispose(inner->GetIsolate()); |
| 12311 inner.Clear(); | 12311 inner.Clear(); |
| (...skipping 2116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14428 default: | 14428 default: |
| 14429 UNREACHABLE(); | 14429 UNREACHABLE(); |
| 14430 return -1; | 14430 return -1; |
| 14431 } | 14431 } |
| 14432 UNREACHABLE(); | 14432 UNREACHABLE(); |
| 14433 return -1; | 14433 return -1; |
| 14434 } | 14434 } |
| 14435 | 14435 |
| 14436 | 14436 |
| 14437 template <class ExternalArrayClass, class ElementType> | 14437 template <class ExternalArrayClass, class ElementType> |
| 14438 static void ExternalArrayTestHelper(v8::ExternalArrayType array_type, | 14438 static void ObjectWithExternalArrayTestHelper( |
| 14439 int64_t low, | 14439 Handle<Context> context, |
| 14440 int64_t high) { | 14440 v8::Handle<Object> obj, |
| 14441 LocalContext context; | 14441 int elementCount, |
|
rossberg
2013/04/29 10:50:27
Nit: element_count
Dmitry Lomov (no reviews)
2013/04/29 11:08:53
Done.
| |
| 14442 v8::HandleScope scope(context->GetIsolate()); | 14442 v8::ExternalArrayType array_type, |
| 14443 const int kElementCount = 40; | 14443 int64_t low, int64_t high) { |
| 14444 int element_size = ExternalArrayElementSize(array_type); | |
| 14445 ElementType* array_data = | |
| 14446 static_cast<ElementType*>(malloc(kElementCount * element_size)); | |
| 14447 i::Handle<ExternalArrayClass> array = | |
| 14448 i::Handle<ExternalArrayClass>::cast( | |
| 14449 FACTORY->NewExternalArray(kElementCount, array_type, array_data)); | |
| 14450 // Force GC to trigger verification. | |
| 14451 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | |
| 14452 for (int i = 0; i < kElementCount; i++) { | |
| 14453 array->set(i, static_cast<ElementType>(i)); | |
| 14454 } | |
| 14455 // Force GC to trigger verification. | |
| 14456 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | |
| 14457 for (int i = 0; i < kElementCount; i++) { | |
| 14458 CHECK_EQ(static_cast<int64_t>(i), | |
| 14459 static_cast<int64_t>(array->get_scalar(i))); | |
| 14460 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array_data[i])); | |
| 14461 } | |
| 14462 | |
| 14463 v8::Handle<v8::Object> obj = v8::Object::New(); | |
| 14464 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); | 14444 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); |
| 14465 // Set the elements to be the external array. | |
| 14466 obj->SetIndexedPropertiesToExternalArrayData(array_data, | |
| 14467 array_type, | |
| 14468 kElementCount); | |
| 14469 CHECK_EQ( | |
| 14470 1, static_cast<int>(jsobj->GetElement(1)->ToObjectChecked()->Number())); | |
| 14471 obj->Set(v8_str("field"), v8::Int32::New(1503)); | 14445 obj->Set(v8_str("field"), v8::Int32::New(1503)); |
| 14472 context->Global()->Set(v8_str("ext_array"), obj); | 14446 context->Global()->Set(v8_str("ext_array"), obj); |
| 14473 v8::Handle<v8::Value> result = CompileRun("ext_array.field"); | 14447 v8::Handle<v8::Value> result = CompileRun("ext_array.field"); |
| 14474 CHECK_EQ(1503, result->Int32Value()); | 14448 CHECK_EQ(1503, result->Int32Value()); |
| 14475 result = CompileRun("ext_array[1]"); | 14449 result = CompileRun("ext_array[1]"); |
| 14476 CHECK_EQ(1, result->Int32Value()); | 14450 CHECK_EQ(1, result->Int32Value()); |
| 14477 | 14451 |
| 14478 // Check pass through of assigned smis | 14452 // Check pass through of assigned smis |
| 14479 result = CompileRun("var sum = 0;" | 14453 result = CompileRun("var sum = 0;" |
| 14480 "for (var i = 0; i < 8; i++) {" | 14454 "for (var i = 0; i < 8; i++) {" |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14577 | 14551 |
| 14578 // Make sure out-of-range loads do not throw. | 14552 // Make sure out-of-range loads do not throw. |
| 14579 i::OS::SNPrintF(test_buf, | 14553 i::OS::SNPrintF(test_buf, |
| 14580 "var caught_exception = false;" | 14554 "var caught_exception = false;" |
| 14581 "try {" | 14555 "try {" |
| 14582 " ext_array[%d];" | 14556 " ext_array[%d];" |
| 14583 "} catch (e) {" | 14557 "} catch (e) {" |
| 14584 " caught_exception = true;" | 14558 " caught_exception = true;" |
| 14585 "}" | 14559 "}" |
| 14586 "caught_exception;", | 14560 "caught_exception;", |
| 14587 kElementCount); | 14561 elementCount); |
| 14588 result = CompileRun(test_buf.start()); | 14562 result = CompileRun(test_buf.start()); |
| 14589 CHECK_EQ(false, result->BooleanValue()); | 14563 CHECK_EQ(false, result->BooleanValue()); |
| 14590 | 14564 |
| 14591 // Make sure out-of-range stores do not throw. | 14565 // Make sure out-of-range stores do not throw. |
| 14592 i::OS::SNPrintF(test_buf, | 14566 i::OS::SNPrintF(test_buf, |
| 14593 "var caught_exception = false;" | 14567 "var caught_exception = false;" |
| 14594 "try {" | 14568 "try {" |
| 14595 " ext_array[%d] = 1;" | 14569 " ext_array[%d] = 1;" |
| 14596 "} catch (e) {" | 14570 "} catch (e) {" |
| 14597 " caught_exception = true;" | 14571 " caught_exception = true;" |
| 14598 "}" | 14572 "}" |
| 14599 "caught_exception;", | 14573 "caught_exception;", |
| 14600 kElementCount); | 14574 elementCount); |
| 14601 result = CompileRun(test_buf.start()); | 14575 result = CompileRun(test_buf.start()); |
| 14602 CHECK_EQ(false, result->BooleanValue()); | 14576 CHECK_EQ(false, result->BooleanValue()); |
| 14603 | 14577 |
| 14604 // Check other boundary conditions, values and operations. | 14578 // Check other boundary conditions, values and operations. |
| 14605 result = CompileRun("for (var i = 0; i < 8; i++) {" | 14579 result = CompileRun("for (var i = 0; i < 8; i++) {" |
| 14606 " ext_array[7] = undefined;" | 14580 " ext_array[7] = undefined;" |
| 14607 "}" | 14581 "}" |
| 14608 "ext_array[7];"); | 14582 "ext_array[7];"); |
| 14609 CHECK_EQ(0, result->Int32Value()); | 14583 CHECK_EQ(0, result->Int32Value()); |
| 14610 if (array_type == v8::kExternalDoubleArray || | 14584 if (array_type == v8::kExternalDoubleArray || |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14691 " (ext_array[5] == expected_results[i]);" | 14665 " (ext_array[5] == expected_results[i]);" |
| 14692 "}" | 14666 "}" |
| 14693 "all_passed;", | 14667 "all_passed;", |
| 14694 (is_unsigned ? | 14668 (is_unsigned ? |
| 14695 unsigned_data : | 14669 unsigned_data : |
| 14696 (is_pixel_data ? pixel_data : signed_data))); | 14670 (is_pixel_data ? pixel_data : signed_data))); |
| 14697 result = CompileRun(test_buf.start()); | 14671 result = CompileRun(test_buf.start()); |
| 14698 CHECK_EQ(true, result->BooleanValue()); | 14672 CHECK_EQ(true, result->BooleanValue()); |
| 14699 } | 14673 } |
| 14700 | 14674 |
| 14701 for (int i = 0; i < kElementCount; i++) { | 14675 i::Handle<ExternalArrayClass> array( |
| 14676 ExternalArrayClass::cast(jsobj->elements())); | |
| 14677 for (int i = 0; i < elementCount; i++) { | |
| 14702 array->set(i, static_cast<ElementType>(i)); | 14678 array->set(i, static_cast<ElementType>(i)); |
| 14703 } | 14679 } |
| 14680 | |
| 14704 // Test complex assignments | 14681 // Test complex assignments |
| 14705 result = CompileRun("function ee_op_test_complex_func(sum) {" | 14682 result = CompileRun("function ee_op_test_complex_func(sum) {" |
| 14706 " for (var i = 0; i < 40; ++i) {" | 14683 " for (var i = 0; i < 40; ++i) {" |
| 14707 " sum += (ext_array[i] += 1);" | 14684 " sum += (ext_array[i] += 1);" |
| 14708 " sum += (ext_array[i] -= 1);" | 14685 " sum += (ext_array[i] -= 1);" |
| 14709 " } " | 14686 " } " |
| 14710 " return sum;" | 14687 " return sum;" |
| 14711 "}" | 14688 "}" |
| 14712 "sum=0;" | 14689 "sum=0;" |
| 14713 "for (var i=0;i<10000;++i) {" | 14690 "for (var i=0;i<10000;++i) {" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 14750 | 14727 |
| 14751 result = CompileRun("ext_array[1] = 23;" | 14728 result = CompileRun("ext_array[1] = 23;" |
| 14752 "ext_array.__proto__ = [];" | 14729 "ext_array.__proto__ = [];" |
| 14753 "js_array.__proto__ = ext_array;" | 14730 "js_array.__proto__ = ext_array;" |
| 14754 "js_array.concat(ext_array);"); | 14731 "js_array.concat(ext_array);"); |
| 14755 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value()); | 14732 CHECK_EQ(77, v8::Object::Cast(*result)->Get(v8_str("0"))->Int32Value()); |
| 14756 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value()); | 14733 CHECK_EQ(23, v8::Object::Cast(*result)->Get(v8_str("1"))->Int32Value()); |
| 14757 | 14734 |
| 14758 result = CompileRun("ext_array[1] = 23;"); | 14735 result = CompileRun("ext_array[1] = 23;"); |
| 14759 CHECK_EQ(23, result->Int32Value()); | 14736 CHECK_EQ(23, result->Int32Value()); |
| 14737 } | |
| 14738 | |
| 14739 | |
| 14740 template <class ExternalArrayClass, class ElementType> | |
| 14741 static void ExternalArrayTestHelper(v8::ExternalArrayType array_type, | |
| 14742 int64_t low, | |
| 14743 int64_t high) { | |
| 14744 LocalContext context; | |
| 14745 v8::HandleScope scope(context->GetIsolate()); | |
| 14746 const int kElementCount = 40; | |
| 14747 int element_size = ExternalArrayElementSize(array_type); | |
| 14748 ElementType* array_data = | |
| 14749 static_cast<ElementType*>(malloc(kElementCount * element_size)); | |
| 14750 i::Handle<ExternalArrayClass> array = | |
| 14751 i::Handle<ExternalArrayClass>::cast( | |
| 14752 FACTORY->NewExternalArray(kElementCount, array_type, array_data)); | |
| 14753 // Force GC to trigger verification. | |
| 14754 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | |
| 14755 for (int i = 0; i < kElementCount; i++) { | |
| 14756 array->set(i, static_cast<ElementType>(i)); | |
| 14757 } | |
| 14758 // Force GC to trigger verification. | |
| 14759 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | |
| 14760 for (int i = 0; i < kElementCount; i++) { | |
| 14761 CHECK_EQ(static_cast<int64_t>(i), | |
| 14762 static_cast<int64_t>(array->get_scalar(i))); | |
| 14763 CHECK_EQ(static_cast<int64_t>(i), static_cast<int64_t>(array_data[i])); | |
| 14764 } | |
| 14765 | |
| 14766 v8::Handle<v8::Object> obj = v8::Object::New(); | |
| 14767 i::Handle<i::JSObject> jsobj = v8::Utils::OpenHandle(*obj); | |
| 14768 // Set the elements to be the external array. | |
| 14769 obj->SetIndexedPropertiesToExternalArrayData(array_data, | |
| 14770 array_type, | |
| 14771 kElementCount); | |
| 14772 CHECK_EQ( | |
| 14773 1, static_cast<int>(jsobj->GetElement(1)->ToObjectChecked()->Number())); | |
| 14774 | |
| 14775 ObjectWithExternalArrayTestHelper<ExternalArrayClass, ElementType>( | |
| 14776 context.local(), obj, kElementCount, array_type, low, high); | |
| 14777 | |
| 14778 v8::Handle<v8::Value> result; | |
| 14760 | 14779 |
| 14761 // Test more complex manipulations which cause eax to contain values | 14780 // Test more complex manipulations which cause eax to contain values |
| 14762 // that won't be completely overwritten by loads from the arrays. | 14781 // that won't be completely overwritten by loads from the arrays. |
| 14763 // This catches bugs in the instructions used for the KeyedLoadIC | 14782 // This catches bugs in the instructions used for the KeyedLoadIC |
| 14764 // for byte and word types. | 14783 // for byte and word types. |
| 14765 { | 14784 { |
| 14766 const int kXSize = 300; | 14785 const int kXSize = 300; |
| 14767 const int kYSize = 300; | 14786 const int kYSize = 300; |
| 14768 const int kLargeElementCount = kXSize * kYSize * 4; | 14787 const int kLargeElementCount = kXSize * kYSize * 4; |
| 14769 ElementType* large_array_data = | 14788 ElementType* large_array_data = |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 15067 ExternalArrayLimitTestHelper(v8::kExternalUnsignedIntArray, 0xffffffff); | 15086 ExternalArrayLimitTestHelper(v8::kExternalUnsignedIntArray, 0xffffffff); |
| 15068 ExternalArrayLimitTestHelper(v8::kExternalFloatArray, 0x40000000); | 15087 ExternalArrayLimitTestHelper(v8::kExternalFloatArray, 0x40000000); |
| 15069 ExternalArrayLimitTestHelper(v8::kExternalFloatArray, 0xffffffff); | 15088 ExternalArrayLimitTestHelper(v8::kExternalFloatArray, 0xffffffff); |
| 15070 ExternalArrayLimitTestHelper(v8::kExternalDoubleArray, 0x40000000); | 15089 ExternalArrayLimitTestHelper(v8::kExternalDoubleArray, 0x40000000); |
| 15071 ExternalArrayLimitTestHelper(v8::kExternalDoubleArray, 0xffffffff); | 15090 ExternalArrayLimitTestHelper(v8::kExternalDoubleArray, 0xffffffff); |
| 15072 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0x40000000); | 15091 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0x40000000); |
| 15073 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0xffffffff); | 15092 ExternalArrayLimitTestHelper(v8::kExternalPixelArray, 0xffffffff); |
| 15074 } | 15093 } |
| 15075 | 15094 |
| 15076 | 15095 |
| 15096 template <typename ElementType, class TypedArray, | |
|
rossberg
2013/04/29 10:50:27
Nit: use either 'typename' or 'class' consistently
Dmitry Lomov (no reviews)
2013/04/29 11:08:53
Done.
| |
| 15097 class ExternalArrayClass> | |
| 15098 void TypedArrayTestHelper(v8::ExternalArrayType array_type, | |
| 15099 int64_t low, int64_t high) { | |
| 15100 const int kElementCount = 50; | |
| 15101 i::FLAG_harmony_typed_arrays = true; | |
| 15102 | |
| 15103 LocalContext env; | |
| 15104 v8::Isolate* isolate = env->GetIsolate(); | |
| 15105 v8::HandleScope handle_scope(isolate); | |
| 15106 | |
| 15107 Local<v8::ArrayBuffer> ab = | |
| 15108 v8::ArrayBuffer::New((kElementCount+2)*sizeof(ElementType)); | |
| 15109 Local<TypedArray> ta = | |
| 15110 TypedArray::New(ab, 2*sizeof(ElementType), kElementCount); | |
| 15111 CHECK_EQ(kElementCount, static_cast<int>(ta->Length())); | |
| 15112 CHECK_EQ(2*sizeof(ElementType), static_cast<int>(ta->ByteOffset())); | |
| 15113 CHECK_EQ(kElementCount*sizeof(ElementType), | |
| 15114 static_cast<int>(ta->ByteLength())); | |
| 15115 CHECK_EQ(ab, ta->Buffer()); | |
| 15116 | |
| 15117 ElementType* data = static_cast<ElementType*>(ab->Data()) + 2; | |
| 15118 for (int i = 0; i < kElementCount; i++) { | |
| 15119 data[i] = static_cast<ElementType>(i); | |
| 15120 } | |
| 15121 | |
| 15122 ObjectWithExternalArrayTestHelper<ExternalArrayClass, ElementType>( | |
| 15123 env.local(), ta, kElementCount, array_type, low, high); | |
| 15124 } | |
| 15125 | |
| 15126 | |
| 15127 THREADED_TEST(Uint8Array) { | |
| 15128 TypedArrayTestHelper<uint8_t, v8::Uint8Array, i::ExternalUnsignedByteArray>( | |
| 15129 v8::kExternalUnsignedByteArray, 0, 0xFF); | |
| 15130 } | |
| 15131 | |
| 15132 | |
| 15133 THREADED_TEST(Int8Array) { | |
| 15134 TypedArrayTestHelper<int8_t, v8::Int8Array, i::ExternalByteArray>( | |
| 15135 v8::kExternalByteArray, -0x80, 0x7F); | |
| 15136 } | |
| 15137 | |
| 15138 | |
| 15139 THREADED_TEST(Uint16Array) { | |
| 15140 TypedArrayTestHelper<uint16_t, | |
| 15141 v8::Uint16Array, | |
| 15142 i::ExternalUnsignedShortArray>( | |
| 15143 v8::kExternalUnsignedShortArray, 0, 0xFFFF); | |
| 15144 } | |
| 15145 | |
| 15146 | |
| 15147 THREADED_TEST(Int16Array) { | |
| 15148 TypedArrayTestHelper<int16_t, v8::Int16Array, i::ExternalShortArray>( | |
| 15149 v8::kExternalShortArray, -0x8000, 0x7FFF); | |
| 15150 } | |
| 15151 | |
| 15152 | |
| 15153 THREADED_TEST(Uint32Array) { | |
| 15154 TypedArrayTestHelper<uint32_t, v8::Uint32Array, i::ExternalUnsignedIntArray>( | |
| 15155 v8::kExternalUnsignedIntArray, 0, UINT_MAX); | |
| 15156 } | |
| 15157 | |
| 15158 | |
| 15159 THREADED_TEST(Int32Array) { | |
| 15160 TypedArrayTestHelper<int32_t, v8::Int32Array, i::ExternalIntArray>( | |
| 15161 v8::kExternalIntArray, INT_MIN, INT_MAX); | |
| 15162 } | |
| 15163 | |
| 15164 | |
| 15165 THREADED_TEST(Float32Array) { | |
| 15166 TypedArrayTestHelper<float, v8::Float32Array, i::ExternalFloatArray>( | |
| 15167 v8::kExternalFloatArray, -500, 500); | |
| 15168 } | |
| 15169 | |
| 15170 | |
| 15171 THREADED_TEST(Float64Array) { | |
| 15172 TypedArrayTestHelper<double, v8::Float64Array, i::ExternalDoubleArray>( | |
| 15173 v8::kExternalDoubleArray, -500, 500); | |
| 15174 } | |
| 15175 | |
| 15176 | |
| 15077 THREADED_TEST(ScriptContextDependence) { | 15177 THREADED_TEST(ScriptContextDependence) { |
| 15078 LocalContext c1; | 15178 LocalContext c1; |
| 15079 v8::HandleScope scope(c1->GetIsolate()); | 15179 v8::HandleScope scope(c1->GetIsolate()); |
| 15080 const char *source = "foo"; | 15180 const char *source = "foo"; |
| 15081 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source)); | 15181 v8::Handle<v8::Script> dep = v8::Script::Compile(v8::String::New(source)); |
| 15082 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source)); | 15182 v8::Handle<v8::Script> indep = v8::Script::New(v8::String::New(source)); |
| 15083 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100)); | 15183 c1->Global()->Set(v8::String::New("foo"), v8::Integer::New(100)); |
| 15084 CHECK_EQ(dep->Run()->Int32Value(), 100); | 15184 CHECK_EQ(dep->Run()->Int32Value(), 100); |
| 15085 CHECK_EQ(indep->Run()->Int32Value(), 100); | 15185 CHECK_EQ(indep->Run()->Int32Value(), 100); |
| 15086 LocalContext c2; | 15186 LocalContext c2; |
| (...skipping 3670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 18757 i::Semaphore* sem_; | 18857 i::Semaphore* sem_; |
| 18758 volatile int sem_value_; | 18858 volatile int sem_value_; |
| 18759 }; | 18859 }; |
| 18760 | 18860 |
| 18761 | 18861 |
| 18762 THREADED_TEST(SemaphoreInterruption) { | 18862 THREADED_TEST(SemaphoreInterruption) { |
| 18763 ThreadInterruptTest().RunTest(); | 18863 ThreadInterruptTest().RunTest(); |
| 18764 } | 18864 } |
| 18765 | 18865 |
| 18766 #endif // WIN32 | 18866 #endif // WIN32 |
| OLD | NEW |