| 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 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 memset(buf, 'a', buf_size); | 589 memset(buf, 'a', buf_size); |
| 590 buf[buf_size - 1] = '\0'; | 590 buf[buf_size - 1] = '\0'; |
| 591 Local<String> large_string = String::New(buf); | 591 Local<String> large_string = String::New(buf); |
| 592 i::DeleteArray(buf); | 592 i::DeleteArray(buf); |
| 593 // Large strings should be immediately accepted. | 593 // Large strings should be immediately accepted. |
| 594 CHECK(large_string->CanMakeExternal()); | 594 CHECK(large_string->CanMakeExternal()); |
| 595 } | 595 } |
| 596 | 596 |
| 597 | 597 |
| 598 THREADED_TEST(UsingExternalString) { | 598 THREADED_TEST(UsingExternalString) { |
| 599 i::Factory* factory = i::Isolate::Current()->factory(); |
| 599 { | 600 { |
| 600 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 601 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 601 uint16_t* two_byte_string = AsciiToTwoByteString("test string"); | 602 uint16_t* two_byte_string = AsciiToTwoByteString("test string"); |
| 602 Local<String> string = | 603 Local<String> string = |
| 603 String::NewExternal(new TestResource(two_byte_string)); | 604 String::NewExternal(new TestResource(two_byte_string)); |
| 604 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); | 605 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); |
| 605 // Trigger GCs so that the newly allocated string moves to old gen. | 606 // Trigger GCs so that the newly allocated string moves to old gen. |
| 606 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now | 607 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now |
| 607 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now | 608 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now |
| 608 i::Handle<i::String> isymbol = | 609 i::Handle<i::String> isymbol = |
| 609 FACTORY->InternalizedStringFromString(istring); | 610 factory->InternalizedStringFromString(istring); |
| 610 CHECK(isymbol->IsInternalizedString()); | 611 CHECK(isymbol->IsInternalizedString()); |
| 611 } | 612 } |
| 612 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 613 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 613 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 614 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 614 } | 615 } |
| 615 | 616 |
| 616 | 617 |
| 617 THREADED_TEST(UsingExternalAsciiString) { | 618 THREADED_TEST(UsingExternalAsciiString) { |
| 619 i::Factory* factory = i::Isolate::Current()->factory(); |
| 618 { | 620 { |
| 619 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 621 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 620 const char* one_byte_string = "test string"; | 622 const char* one_byte_string = "test string"; |
| 621 Local<String> string = String::NewExternal( | 623 Local<String> string = String::NewExternal( |
| 622 new TestAsciiResource(i::StrDup(one_byte_string))); | 624 new TestAsciiResource(i::StrDup(one_byte_string))); |
| 623 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); | 625 i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); |
| 624 // Trigger GCs so that the newly allocated string moves to old gen. | 626 // Trigger GCs so that the newly allocated string moves to old gen. |
| 625 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now | 627 HEAP->CollectGarbage(i::NEW_SPACE); // in survivor space now |
| 626 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now | 628 HEAP->CollectGarbage(i::NEW_SPACE); // in old gen now |
| 627 i::Handle<i::String> isymbol = | 629 i::Handle<i::String> isymbol = |
| 628 FACTORY->InternalizedStringFromString(istring); | 630 factory->InternalizedStringFromString(istring); |
| 629 CHECK(isymbol->IsInternalizedString()); | 631 CHECK(isymbol->IsInternalizedString()); |
| 630 } | 632 } |
| 631 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 633 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 632 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 634 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 633 } | 635 } |
| 634 | 636 |
| 635 | 637 |
| 636 THREADED_TEST(ScavengeExternalString) { | 638 THREADED_TEST(ScavengeExternalString) { |
| 637 i::FLAG_stress_compaction = false; | 639 i::FLAG_stress_compaction = false; |
| 638 i::FLAG_gc_global = false; | 640 i::FLAG_gc_global = false; |
| (...skipping 12863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13502 | 13504 |
| 13503 // Test that we can still flatten a string if the components it is built up | 13505 // Test that we can still flatten a string if the components it is built up |
| 13504 // from have been turned into 16 bit strings in the mean time. | 13506 // from have been turned into 16 bit strings in the mean time. |
| 13505 THREADED_TEST(MorphCompositeStringTest) { | 13507 THREADED_TEST(MorphCompositeStringTest) { |
| 13506 char utf_buffer[129]; | 13508 char utf_buffer[129]; |
| 13507 const char* c_string = "Now is the time for all good men" | 13509 const char* c_string = "Now is the time for all good men" |
| 13508 " to come to the aid of the party"; | 13510 " to come to the aid of the party"; |
| 13509 uint16_t* two_byte_string = AsciiToTwoByteString(c_string); | 13511 uint16_t* two_byte_string = AsciiToTwoByteString(c_string); |
| 13510 { | 13512 { |
| 13511 LocalContext env; | 13513 LocalContext env; |
| 13514 i::Factory* factory = i::Isolate::Current()->factory(); |
| 13512 v8::HandleScope scope(env->GetIsolate()); | 13515 v8::HandleScope scope(env->GetIsolate()); |
| 13513 AsciiVectorResource ascii_resource( | 13516 AsciiVectorResource ascii_resource( |
| 13514 i::Vector<const char>(c_string, i::StrLength(c_string))); | 13517 i::Vector<const char>(c_string, i::StrLength(c_string))); |
| 13515 UC16VectorResource uc16_resource( | 13518 UC16VectorResource uc16_resource( |
| 13516 i::Vector<const uint16_t>(two_byte_string, | 13519 i::Vector<const uint16_t>(two_byte_string, |
| 13517 i::StrLength(c_string))); | 13520 i::StrLength(c_string))); |
| 13518 | 13521 |
| 13519 Local<String> lhs(v8::Utils::ToLocal( | 13522 Local<String> lhs(v8::Utils::ToLocal( |
| 13520 FACTORY->NewExternalStringFromAscii(&ascii_resource))); | 13523 factory->NewExternalStringFromAscii(&ascii_resource))); |
| 13521 Local<String> rhs(v8::Utils::ToLocal( | 13524 Local<String> rhs(v8::Utils::ToLocal( |
| 13522 FACTORY->NewExternalStringFromAscii(&ascii_resource))); | 13525 factory->NewExternalStringFromAscii(&ascii_resource))); |
| 13523 | 13526 |
| 13524 env->Global()->Set(v8_str("lhs"), lhs); | 13527 env->Global()->Set(v8_str("lhs"), lhs); |
| 13525 env->Global()->Set(v8_str("rhs"), rhs); | 13528 env->Global()->Set(v8_str("rhs"), rhs); |
| 13526 | 13529 |
| 13527 CompileRun( | 13530 CompileRun( |
| 13528 "var cons = lhs + rhs;" | 13531 "var cons = lhs + rhs;" |
| 13529 "var slice = lhs.substring(1, lhs.length - 1);" | 13532 "var slice = lhs.substring(1, lhs.length - 1);" |
| 13530 "var slice_on_cons = (lhs + rhs).substring(1, lhs.length *2 - 1);"); | 13533 "var slice_on_cons = (lhs + rhs).substring(1, lhs.length *2 - 1);"); |
| 13531 | 13534 |
| 13532 CHECK(lhs->IsOneByte()); | 13535 CHECK(lhs->IsOneByte()); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13599 class RegExpStringModificationTest { | 13602 class RegExpStringModificationTest { |
| 13600 public: | 13603 public: |
| 13601 RegExpStringModificationTest() | 13604 RegExpStringModificationTest() |
| 13602 : block_(i::OS::CreateSemaphore(0)), | 13605 : block_(i::OS::CreateSemaphore(0)), |
| 13603 morphs_(0), | 13606 morphs_(0), |
| 13604 morphs_during_regexp_(0), | 13607 morphs_during_regexp_(0), |
| 13605 ascii_resource_(i::Vector<const char>("aaaaaaaaaaaaaab", 15)), | 13608 ascii_resource_(i::Vector<const char>("aaaaaaaaaaaaaab", 15)), |
| 13606 uc16_resource_(i::Vector<const uint16_t>(two_byte_content_, 15)) {} | 13609 uc16_resource_(i::Vector<const uint16_t>(two_byte_content_, 15)) {} |
| 13607 ~RegExpStringModificationTest() { delete block_; } | 13610 ~RegExpStringModificationTest() { delete block_; } |
| 13608 void RunTest() { | 13611 void RunTest() { |
| 13612 i::Factory* factory = i::Isolate::Current()->factory(); |
| 13613 |
| 13609 regexp_success_ = false; | 13614 regexp_success_ = false; |
| 13610 morph_success_ = false; | 13615 morph_success_ = false; |
| 13611 | 13616 |
| 13612 // Initialize the contents of two_byte_content_ to be a uc16 representation | 13617 // Initialize the contents of two_byte_content_ to be a uc16 representation |
| 13613 // of "aaaaaaaaaaaaaab". | 13618 // of "aaaaaaaaaaaaaab". |
| 13614 for (int i = 0; i < 14; i++) { | 13619 for (int i = 0; i < 14; i++) { |
| 13615 two_byte_content_[i] = 'a'; | 13620 two_byte_content_[i] = 'a'; |
| 13616 } | 13621 } |
| 13617 two_byte_content_[14] = 'b'; | 13622 two_byte_content_[14] = 'b'; |
| 13618 | 13623 |
| 13619 // Create the input string for the regexp - the one we are going to change | 13624 // Create the input string for the regexp - the one we are going to change |
| 13620 // properties of. | 13625 // properties of. |
| 13621 input_ = FACTORY->NewExternalStringFromAscii(&ascii_resource_); | 13626 input_ = factory->NewExternalStringFromAscii(&ascii_resource_); |
| 13622 | 13627 |
| 13623 // Inject the input as a global variable. | 13628 // Inject the input as a global variable. |
| 13624 i::Handle<i::String> input_name = | 13629 i::Handle<i::String> input_name = |
| 13625 FACTORY->NewStringFromAscii(i::Vector<const char>("input", 5)); | 13630 factory->NewStringFromAscii(i::Vector<const char>("input", 5)); |
| 13626 i::Isolate::Current()->native_context()->global_object()->SetProperty( | 13631 i::Isolate::Current()->native_context()->global_object()->SetProperty( |
| 13627 *input_name, | 13632 *input_name, |
| 13628 *input_, | 13633 *input_, |
| 13629 NONE, | 13634 NONE, |
| 13630 i::kNonStrictMode)->ToObjectChecked(); | 13635 i::kNonStrictMode)->ToObjectChecked(); |
| 13631 | 13636 |
| 13632 MorphThread morph_thread(this); | 13637 MorphThread morph_thread(this); |
| 13633 morph_thread.Start(); | 13638 morph_thread.Start(); |
| 13634 v8::Locker::StartPreemption(1); | 13639 v8::Locker::StartPreemption(1); |
| 13635 LongRunningRegExp(); | 13640 LongRunningRegExp(); |
| (...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14109 // Detach the global object to make 'this' refer directly to the | 14114 // Detach the global object to make 'this' refer directly to the |
| 14110 // global object (not the proxy), and make sure that the dictionary | 14115 // global object (not the proxy), and make sure that the dictionary |
| 14111 // load IC doesn't mess up loading directly from the global object. | 14116 // load IC doesn't mess up loading directly from the global object. |
| 14112 context->DetachGlobal(); | 14117 context->DetachGlobal(); |
| 14113 CHECK_EQ(42, CompileRun("f(this).foo")->Int32Value()); | 14118 CHECK_EQ(42, CompileRun("f(this).foo")->Int32Value()); |
| 14114 } | 14119 } |
| 14115 | 14120 |
| 14116 | 14121 |
| 14117 THREADED_TEST(PixelArray) { | 14122 THREADED_TEST(PixelArray) { |
| 14118 LocalContext context; | 14123 LocalContext context; |
| 14124 i::Factory* factory = i::Isolate::Current()->factory(); |
| 14119 v8::HandleScope scope(context->GetIsolate()); | 14125 v8::HandleScope scope(context->GetIsolate()); |
| 14120 const int kElementCount = 260; | 14126 const int kElementCount = 260; |
| 14121 uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount)); | 14127 uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount)); |
| 14122 i::Handle<i::ExternalPixelArray> pixels = | 14128 i::Handle<i::ExternalPixelArray> pixels = |
| 14123 i::Handle<i::ExternalPixelArray>::cast( | 14129 i::Handle<i::ExternalPixelArray>::cast( |
| 14124 FACTORY->NewExternalArray(kElementCount, | 14130 factory->NewExternalArray(kElementCount, |
| 14125 v8::kExternalPixelArray, | 14131 v8::kExternalPixelArray, |
| 14126 pixel_data)); | 14132 pixel_data)); |
| 14127 // Force GC to trigger verification. | 14133 // Force GC to trigger verification. |
| 14128 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 14134 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 14129 for (int i = 0; i < kElementCount; i++) { | 14135 for (int i = 0; i < kElementCount; i++) { |
| 14130 pixels->set(i, i % 256); | 14136 pixels->set(i, i % 256); |
| 14131 } | 14137 } |
| 14132 // Force GC to trigger verification. | 14138 // Force GC to trigger verification. |
| 14133 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 14139 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 14134 for (int i = 0; i < kElementCount; i++) { | 14140 for (int i = 0; i < kElementCount; i++) { |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14531 uint32_t index, | 14537 uint32_t index, |
| 14532 Local<Value> value, | 14538 Local<Value> value, |
| 14533 const AccessorInfo& info) { | 14539 const AccessorInfo& info) { |
| 14534 ApiTestFuzzer::Fuzz(); | 14540 ApiTestFuzzer::Fuzz(); |
| 14535 return v8::Handle<Value>(); | 14541 return v8::Handle<Value>(); |
| 14536 } | 14542 } |
| 14537 | 14543 |
| 14538 | 14544 |
| 14539 THREADED_TEST(PixelArrayWithInterceptor) { | 14545 THREADED_TEST(PixelArrayWithInterceptor) { |
| 14540 LocalContext context; | 14546 LocalContext context; |
| 14547 i::Factory* factory = i::Isolate::Current()->factory(); |
| 14541 v8::HandleScope scope(context->GetIsolate()); | 14548 v8::HandleScope scope(context->GetIsolate()); |
| 14542 const int kElementCount = 260; | 14549 const int kElementCount = 260; |
| 14543 uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount)); | 14550 uint8_t* pixel_data = reinterpret_cast<uint8_t*>(malloc(kElementCount)); |
| 14544 i::Handle<i::ExternalPixelArray> pixels = | 14551 i::Handle<i::ExternalPixelArray> pixels = |
| 14545 i::Handle<i::ExternalPixelArray>::cast( | 14552 i::Handle<i::ExternalPixelArray>::cast( |
| 14546 FACTORY->NewExternalArray(kElementCount, | 14553 factory->NewExternalArray(kElementCount, |
| 14547 v8::kExternalPixelArray, | 14554 v8::kExternalPixelArray, |
| 14548 pixel_data)); | 14555 pixel_data)); |
| 14549 for (int i = 0; i < kElementCount; i++) { | 14556 for (int i = 0; i < kElementCount; i++) { |
| 14550 pixels->set(i, i % 256); | 14557 pixels->set(i, i % 256); |
| 14551 } | 14558 } |
| 14552 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(); | 14559 v8::Handle<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(); |
| 14553 templ->SetIndexedPropertyHandler(NotHandledIndexedPropertyGetter, | 14560 templ->SetIndexedPropertyHandler(NotHandledIndexedPropertyGetter, |
| 14554 NotHandledIndexedPropertySetter); | 14561 NotHandledIndexedPropertySetter); |
| 14555 v8::Handle<v8::Object> obj = templ->NewInstance(); | 14562 v8::Handle<v8::Object> obj = templ->NewInstance(); |
| 14556 obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount); | 14563 obj->SetIndexedPropertiesToPixelData(pixel_data, kElementCount); |
| (...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14898 result = CompileRun("ext_array[1] = 23;"); | 14905 result = CompileRun("ext_array[1] = 23;"); |
| 14899 CHECK_EQ(23, result->Int32Value()); | 14906 CHECK_EQ(23, result->Int32Value()); |
| 14900 } | 14907 } |
| 14901 | 14908 |
| 14902 | 14909 |
| 14903 template <class ExternalArrayClass, class ElementType> | 14910 template <class ExternalArrayClass, class ElementType> |
| 14904 static void ExternalArrayTestHelper(v8::ExternalArrayType array_type, | 14911 static void ExternalArrayTestHelper(v8::ExternalArrayType array_type, |
| 14905 int64_t low, | 14912 int64_t low, |
| 14906 int64_t high) { | 14913 int64_t high) { |
| 14907 LocalContext context; | 14914 LocalContext context; |
| 14915 i::Factory* factory = i::Isolate::Current()->factory(); |
| 14908 v8::HandleScope scope(context->GetIsolate()); | 14916 v8::HandleScope scope(context->GetIsolate()); |
| 14909 const int kElementCount = 40; | 14917 const int kElementCount = 40; |
| 14910 int element_size = ExternalArrayElementSize(array_type); | 14918 int element_size = ExternalArrayElementSize(array_type); |
| 14911 ElementType* array_data = | 14919 ElementType* array_data = |
| 14912 static_cast<ElementType*>(malloc(kElementCount * element_size)); | 14920 static_cast<ElementType*>(malloc(kElementCount * element_size)); |
| 14913 i::Handle<ExternalArrayClass> array = | 14921 i::Handle<ExternalArrayClass> array = |
| 14914 i::Handle<ExternalArrayClass>::cast( | 14922 i::Handle<ExternalArrayClass>::cast( |
| 14915 FACTORY->NewExternalArray(kElementCount, array_type, array_data)); | 14923 factory->NewExternalArray(kElementCount, array_type, array_data)); |
| 14916 // Force GC to trigger verification. | 14924 // Force GC to trigger verification. |
| 14917 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 14925 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 14918 for (int i = 0; i < kElementCount; i++) { | 14926 for (int i = 0; i < kElementCount; i++) { |
| 14919 array->set(i, static_cast<ElementType>(i)); | 14927 array->set(i, static_cast<ElementType>(i)); |
| 14920 } | 14928 } |
| 14921 // Force GC to trigger verification. | 14929 // Force GC to trigger verification. |
| 14922 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); | 14930 HEAP->CollectAllGarbage(i::Heap::kNoGCFlags); |
| 14923 for (int i = 0; i < kElementCount; i++) { | 14931 for (int i = 0; i < kElementCount; i++) { |
| 14924 CHECK_EQ(static_cast<int64_t>(i), | 14932 CHECK_EQ(static_cast<int64_t>(i), |
| 14925 static_cast<int64_t>(array->get_scalar(i))); | 14933 static_cast<int64_t>(array->get_scalar(i))); |
| (...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15842 "outer()\n%s"; | 15850 "outer()\n%s"; |
| 15843 | 15851 |
| 15844 i::ScopedVector<char> code(1024); | 15852 i::ScopedVector<char> code(1024); |
| 15845 i::OS::SNPrintF(code, source, "//# sourceURL=source_url"); | 15853 i::OS::SNPrintF(code, source, "//# sourceURL=source_url"); |
| 15846 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); | 15854 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); |
| 15847 i::OS::SNPrintF(code, source, "//@ sourceURL=source_url"); | 15855 i::OS::SNPrintF(code, source, "//@ sourceURL=source_url"); |
| 15848 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); | 15856 CHECK(CompileRunWithOrigin(code.start(), "url", 0, 0)->IsUndefined()); |
| 15849 } | 15857 } |
| 15850 | 15858 |
| 15851 static void CreateGarbageInOldSpace() { | 15859 static void CreateGarbageInOldSpace() { |
| 15860 i::Factory* factory = i::Isolate::Current()->factory(); |
| 15852 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 15861 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
| 15853 i::AlwaysAllocateScope always_allocate; | 15862 i::AlwaysAllocateScope always_allocate; |
| 15854 for (int i = 0; i < 1000; i++) { | 15863 for (int i = 0; i < 1000; i++) { |
| 15855 FACTORY->NewFixedArray(1000, i::TENURED); | 15864 factory->NewFixedArray(1000, i::TENURED); |
| 15856 } | 15865 } |
| 15857 } | 15866 } |
| 15858 | 15867 |
| 15859 // Test that idle notification can be handled and eventually returns true. | 15868 // Test that idle notification can be handled and eventually returns true. |
| 15860 TEST(IdleNotification) { | 15869 TEST(IdleNotification) { |
| 15861 const intptr_t MB = 1024 * 1024; | 15870 const intptr_t MB = 1024 * 1024; |
| 15862 LocalContext env; | 15871 LocalContext env; |
| 15863 v8::HandleScope scope(env->GetIsolate()); | 15872 v8::HandleScope scope(env->GetIsolate()); |
| 15864 intptr_t initial_size = HEAP->SizeOfObjects(); | 15873 intptr_t initial_size = HEAP->SizeOfObjects(); |
| 15865 CreateGarbageInOldSpace(); | 15874 CreateGarbageInOldSpace(); |
| (...skipping 2674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18540 | 18549 |
| 18541 static int fatal_error_callback_counter = 0; | 18550 static int fatal_error_callback_counter = 0; |
| 18542 static void CountingErrorCallback(const char* location, const char* message) { | 18551 static void CountingErrorCallback(const char* location, const char* message) { |
| 18543 printf("CountingErrorCallback(\"%s\", \"%s\")\n", location, message); | 18552 printf("CountingErrorCallback(\"%s\", \"%s\")\n", location, message); |
| 18544 fatal_error_callback_counter++; | 18553 fatal_error_callback_counter++; |
| 18545 } | 18554 } |
| 18546 | 18555 |
| 18547 | 18556 |
| 18548 TEST(StaticGetters) { | 18557 TEST(StaticGetters) { |
| 18549 LocalContext context; | 18558 LocalContext context; |
| 18559 i::Factory* factory = i::Isolate::Current()->factory(); |
| 18550 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 18560 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 18551 v8::HandleScope scope(isolate); | 18561 v8::HandleScope scope(isolate); |
| 18552 i::Handle<i::Object> undefined_value = FACTORY->undefined_value(); | 18562 i::Handle<i::Object> undefined_value = factory->undefined_value(); |
| 18553 CHECK(*v8::Utils::OpenHandle(*v8::Undefined()) == *undefined_value); | 18563 CHECK(*v8::Utils::OpenHandle(*v8::Undefined()) == *undefined_value); |
| 18554 CHECK(*v8::Utils::OpenHandle(*v8::Undefined(isolate)) == *undefined_value); | 18564 CHECK(*v8::Utils::OpenHandle(*v8::Undefined(isolate)) == *undefined_value); |
| 18555 i::Handle<i::Object> null_value = FACTORY->null_value(); | 18565 i::Handle<i::Object> null_value = factory->null_value(); |
| 18556 CHECK(*v8::Utils::OpenHandle(*v8::Null()) == *null_value); | 18566 CHECK(*v8::Utils::OpenHandle(*v8::Null()) == *null_value); |
| 18557 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value); | 18567 CHECK(*v8::Utils::OpenHandle(*v8::Null(isolate)) == *null_value); |
| 18558 i::Handle<i::Object> true_value = FACTORY->true_value(); | 18568 i::Handle<i::Object> true_value = factory->true_value(); |
| 18559 CHECK(*v8::Utils::OpenHandle(*v8::True()) == *true_value); | 18569 CHECK(*v8::Utils::OpenHandle(*v8::True()) == *true_value); |
| 18560 CHECK(*v8::Utils::OpenHandle(*v8::True(isolate)) == *true_value); | 18570 CHECK(*v8::Utils::OpenHandle(*v8::True(isolate)) == *true_value); |
| 18561 i::Handle<i::Object> false_value = FACTORY->false_value(); | 18571 i::Handle<i::Object> false_value = factory->false_value(); |
| 18562 CHECK(*v8::Utils::OpenHandle(*v8::False()) == *false_value); | 18572 CHECK(*v8::Utils::OpenHandle(*v8::False()) == *false_value); |
| 18563 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value); | 18573 CHECK(*v8::Utils::OpenHandle(*v8::False(isolate)) == *false_value); |
| 18564 | 18574 |
| 18565 // Test after-death behavior. | 18575 // Test after-death behavior. |
| 18566 CHECK(i::Internals::IsInitialized(isolate)); | 18576 CHECK(i::Internals::IsInitialized(isolate)); |
| 18567 CHECK_EQ(0, fatal_error_callback_counter); | 18577 CHECK_EQ(0, fatal_error_callback_counter); |
| 18568 v8::V8::SetFatalErrorHandler(CountingErrorCallback); | 18578 v8::V8::SetFatalErrorHandler(CountingErrorCallback); |
| 18569 v8::Utils::ReportApiFailure("StaticGetters()", "Kill V8"); | 18579 v8::Utils::ReportApiFailure("StaticGetters()", "Kill V8"); |
| 18570 i::Isolate::Current()->TearDown(); | 18580 i::Isolate::Current()->TearDown(); |
| 18571 CHECK(!i::Internals::IsInitialized(isolate)); | 18581 CHECK(!i::Internals::IsInitialized(isolate)); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 18602 CHECK_EQ(data2, isolate->GetData()); | 18612 CHECK_EQ(data2, isolate->GetData()); |
| 18603 CHECK_EQ(data2, ISOLATE->GetData()); | 18613 CHECK_EQ(data2, ISOLATE->GetData()); |
| 18604 ISOLATE->TearDown(); | 18614 ISOLATE->TearDown(); |
| 18605 CHECK_EQ(data2, isolate->GetData()); | 18615 CHECK_EQ(data2, isolate->GetData()); |
| 18606 CHECK_EQ(data2, ISOLATE->GetData()); | 18616 CHECK_EQ(data2, ISOLATE->GetData()); |
| 18607 } | 18617 } |
| 18608 | 18618 |
| 18609 | 18619 |
| 18610 TEST(StringEmpty) { | 18620 TEST(StringEmpty) { |
| 18611 LocalContext context; | 18621 LocalContext context; |
| 18622 i::Factory* factory = i::Isolate::Current()->factory(); |
| 18612 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 18623 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 18613 v8::HandleScope scope(isolate); | 18624 v8::HandleScope scope(isolate); |
| 18614 i::Handle<i::Object> empty_string = FACTORY->empty_string(); | 18625 i::Handle<i::Object> empty_string = factory->empty_string(); |
| 18615 CHECK(*v8::Utils::OpenHandle(*v8::String::Empty()) == *empty_string); | 18626 CHECK(*v8::Utils::OpenHandle(*v8::String::Empty()) == *empty_string); |
| 18616 CHECK(*v8::Utils::OpenHandle(*v8::String::Empty(isolate)) == *empty_string); | 18627 CHECK(*v8::Utils::OpenHandle(*v8::String::Empty(isolate)) == *empty_string); |
| 18617 | 18628 |
| 18618 // Test after-death behavior. | 18629 // Test after-death behavior. |
| 18619 CHECK(i::Internals::IsInitialized(isolate)); | 18630 CHECK(i::Internals::IsInitialized(isolate)); |
| 18620 CHECK_EQ(0, fatal_error_callback_counter); | 18631 CHECK_EQ(0, fatal_error_callback_counter); |
| 18621 v8::V8::SetFatalErrorHandler(CountingErrorCallback); | 18632 v8::V8::SetFatalErrorHandler(CountingErrorCallback); |
| 18622 v8::Utils::ReportApiFailure("StringEmpty()", "Kill V8"); | 18633 v8::Utils::ReportApiFailure("StringEmpty()", "Kill V8"); |
| 18623 i::Isolate::Current()->TearDown(); | 18634 i::Isolate::Current()->TearDown(); |
| 18624 CHECK(!i::Internals::IsInitialized(isolate)); | 18635 CHECK(!i::Internals::IsInitialized(isolate)); |
| (...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19090 i::Semaphore* sem_; | 19101 i::Semaphore* sem_; |
| 19091 volatile int sem_value_; | 19102 volatile int sem_value_; |
| 19092 }; | 19103 }; |
| 19093 | 19104 |
| 19094 | 19105 |
| 19095 THREADED_TEST(SemaphoreInterruption) { | 19106 THREADED_TEST(SemaphoreInterruption) { |
| 19096 ThreadInterruptTest().RunTest(); | 19107 ThreadInterruptTest().RunTest(); |
| 19097 } | 19108 } |
| 19098 | 19109 |
| 19099 #endif // WIN32 | 19110 #endif // WIN32 |
| OLD | NEW |