| 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 14200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14211 public: | 14211 public: |
| 14212 RegExpInterruptTest() : block_(0) {} | 14212 RegExpInterruptTest() : block_(0) {} |
| 14213 ~RegExpInterruptTest() {} | 14213 ~RegExpInterruptTest() {} |
| 14214 void RunTest() { | 14214 void RunTest() { |
| 14215 gc_count_ = 0; | 14215 gc_count_ = 0; |
| 14216 gc_during_regexp_ = 0; | 14216 gc_during_regexp_ = 0; |
| 14217 regexp_success_ = false; | 14217 regexp_success_ = false; |
| 14218 gc_success_ = false; | 14218 gc_success_ = false; |
| 14219 GCThread gc_thread(this); | 14219 GCThread gc_thread(this); |
| 14220 gc_thread.Start(); | 14220 gc_thread.Start(); |
| 14221 v8::Locker::StartPreemption(1); | 14221 v8::Isolate* isolate = CcTest::isolate(); |
| 14222 v8::Locker::StartPreemption(isolate, 1); |
| 14222 | 14223 |
| 14223 LongRunningRegExp(); | 14224 LongRunningRegExp(); |
| 14224 { | 14225 { |
| 14225 v8::Unlocker unlock(CcTest::isolate()); | 14226 v8::Unlocker unlock(isolate); |
| 14226 gc_thread.Join(); | 14227 gc_thread.Join(); |
| 14227 } | 14228 } |
| 14228 v8::Locker::StopPreemption(); | 14229 v8::Locker::StopPreemption(isolate); |
| 14229 CHECK(regexp_success_); | 14230 CHECK(regexp_success_); |
| 14230 CHECK(gc_success_); | 14231 CHECK(gc_success_); |
| 14231 } | 14232 } |
| 14232 | 14233 |
| 14233 private: | 14234 private: |
| 14234 // Number of garbage collections required. | 14235 // Number of garbage collections required. |
| 14235 static const int kRequiredGCs = 5; | 14236 static const int kRequiredGCs = 5; |
| 14236 | 14237 |
| 14237 class GCThread : public i::Thread { | 14238 class GCThread : public i::Thread { |
| 14238 public: | 14239 public: |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14333 public: | 14334 public: |
| 14334 ApplyInterruptTest() : block_(0) {} | 14335 ApplyInterruptTest() : block_(0) {} |
| 14335 ~ApplyInterruptTest() {} | 14336 ~ApplyInterruptTest() {} |
| 14336 void RunTest() { | 14337 void RunTest() { |
| 14337 gc_count_ = 0; | 14338 gc_count_ = 0; |
| 14338 gc_during_apply_ = 0; | 14339 gc_during_apply_ = 0; |
| 14339 apply_success_ = false; | 14340 apply_success_ = false; |
| 14340 gc_success_ = false; | 14341 gc_success_ = false; |
| 14341 GCThread gc_thread(this); | 14342 GCThread gc_thread(this); |
| 14342 gc_thread.Start(); | 14343 gc_thread.Start(); |
| 14343 v8::Locker::StartPreemption(1); | 14344 v8::Isolate* isolate = CcTest::isolate(); |
| 14345 v8::Locker::StartPreemption(isolate, 1); |
| 14344 | 14346 |
| 14345 LongRunningApply(); | 14347 LongRunningApply(); |
| 14346 { | 14348 { |
| 14347 v8::Unlocker unlock(CcTest::isolate()); | 14349 v8::Unlocker unlock(isolate); |
| 14348 gc_thread.Join(); | 14350 gc_thread.Join(); |
| 14349 } | 14351 } |
| 14350 v8::Locker::StopPreemption(); | 14352 v8::Locker::StopPreemption(isolate); |
| 14351 CHECK(apply_success_); | 14353 CHECK(apply_success_); |
| 14352 CHECK(gc_success_); | 14354 CHECK(gc_success_); |
| 14353 } | 14355 } |
| 14354 | 14356 |
| 14355 private: | 14357 private: |
| 14356 // Number of garbage collections required. | 14358 // Number of garbage collections required. |
| 14357 static const int kRequiredGCs = 2; | 14359 static const int kRequiredGCs = 2; |
| 14358 | 14360 |
| 14359 class GCThread : public i::Thread { | 14361 class GCThread : public i::Thread { |
| 14360 public: | 14362 public: |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14620 class RegExpStringModificationTest { | 14622 class RegExpStringModificationTest { |
| 14621 public: | 14623 public: |
| 14622 RegExpStringModificationTest() | 14624 RegExpStringModificationTest() |
| 14623 : block_(0), | 14625 : block_(0), |
| 14624 morphs_(0), | 14626 morphs_(0), |
| 14625 morphs_during_regexp_(0), | 14627 morphs_during_regexp_(0), |
| 14626 ascii_resource_(i::Vector<const char>("aaaaaaaaaaaaaab", 15)), | 14628 ascii_resource_(i::Vector<const char>("aaaaaaaaaaaaaab", 15)), |
| 14627 uc16_resource_(i::Vector<const uint16_t>(two_byte_content_, 15)) {} | 14629 uc16_resource_(i::Vector<const uint16_t>(two_byte_content_, 15)) {} |
| 14628 ~RegExpStringModificationTest() {} | 14630 ~RegExpStringModificationTest() {} |
| 14629 void RunTest() { | 14631 void RunTest() { |
| 14632 v8::Isolate* isolate = CcTest::isolate(); |
| 14630 i::Factory* factory = CcTest::i_isolate()->factory(); | 14633 i::Factory* factory = CcTest::i_isolate()->factory(); |
| 14631 | 14634 |
| 14632 regexp_success_ = false; | 14635 regexp_success_ = false; |
| 14633 morph_success_ = false; | 14636 morph_success_ = false; |
| 14634 | 14637 |
| 14635 // Initialize the contents of two_byte_content_ to be a uc16 representation | 14638 // Initialize the contents of two_byte_content_ to be a uc16 representation |
| 14636 // of "aaaaaaaaaaaaaab". | 14639 // of "aaaaaaaaaaaaaab". |
| 14637 for (int i = 0; i < 14; i++) { | 14640 for (int i = 0; i < 14; i++) { |
| 14638 two_byte_content_[i] = 'a'; | 14641 two_byte_content_[i] = 'a'; |
| 14639 } | 14642 } |
| 14640 two_byte_content_[14] = 'b'; | 14643 two_byte_content_[14] = 'b'; |
| 14641 | 14644 |
| 14642 // Create the input string for the regexp - the one we are going to change | 14645 // Create the input string for the regexp - the one we are going to change |
| 14643 // properties of. | 14646 // properties of. |
| 14644 input_ = factory->NewExternalStringFromAscii(&ascii_resource_); | 14647 input_ = factory->NewExternalStringFromAscii(&ascii_resource_); |
| 14645 | 14648 |
| 14646 // Inject the input as a global variable. | 14649 // Inject the input as a global variable. |
| 14647 i::Handle<i::String> input_name = | 14650 i::Handle<i::String> input_name = |
| 14648 factory->NewStringFromAscii(i::Vector<const char>("input", 5)); | 14651 factory->NewStringFromAscii(i::Vector<const char>("input", 5)); |
| 14649 i::JSReceiver::SetProperty( | 14652 i::JSReceiver::SetProperty( |
| 14650 i::handle(CcTest::i_isolate()->native_context()->global_object()), | 14653 i::handle(CcTest::i_isolate()->native_context()->global_object()), |
| 14651 input_name, | 14654 input_name, |
| 14652 input_, | 14655 input_, |
| 14653 NONE, | 14656 NONE, |
| 14654 i::kNonStrictMode); | 14657 i::kNonStrictMode); |
| 14655 | 14658 |
| 14656 MorphThread morph_thread(this); | 14659 MorphThread morph_thread(this); |
| 14657 morph_thread.Start(); | 14660 morph_thread.Start(); |
| 14658 v8::Locker::StartPreemption(1); | 14661 v8::Locker::StartPreemption(isolate, 1); |
| 14659 LongRunningRegExp(); | 14662 LongRunningRegExp(); |
| 14660 { | 14663 { |
| 14661 v8::Unlocker unlock(CcTest::isolate()); | 14664 v8::Unlocker unlock(isolate); |
| 14662 morph_thread.Join(); | 14665 morph_thread.Join(); |
| 14663 } | 14666 } |
| 14664 v8::Locker::StopPreemption(); | 14667 v8::Locker::StopPreemption(isolate); |
| 14665 CHECK(regexp_success_); | 14668 CHECK(regexp_success_); |
| 14666 CHECK(morph_success_); | 14669 CHECK(morph_success_); |
| 14667 } | 14670 } |
| 14668 | 14671 |
| 14669 private: | 14672 private: |
| 14670 // Number of string modifications required. | 14673 // Number of string modifications required. |
| 14671 static const int kRequiredModifications = 5; | 14674 static const int kRequiredModifications = 5; |
| 14672 static const int kMaxModifications = 100; | 14675 static const int kMaxModifications = 100; |
| 14673 | 14676 |
| 14674 class MorphThread : public i::Thread { | 14677 class MorphThread : public i::Thread { |
| (...skipping 5931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 20606 } | 20609 } |
| 20607 for (int i = 0; i < runs; i++) { | 20610 for (int i = 0; i < runs; i++) { |
| 20608 Local<String> expected; | 20611 Local<String> expected; |
| 20609 if (i != 0) { | 20612 if (i != 0) { |
| 20610 CHECK_EQ(v8_str("escape value"), values[i]); | 20613 CHECK_EQ(v8_str("escape value"), values[i]); |
| 20611 } else { | 20614 } else { |
| 20612 CHECK(values[i].IsEmpty()); | 20615 CHECK(values[i].IsEmpty()); |
| 20613 } | 20616 } |
| 20614 } | 20617 } |
| 20615 } | 20618 } |
| OLD | NEW |