| Index: test/cctest/test-regexp.cc
 | 
| diff --git a/test/cctest/test-regexp.cc b/test/cctest/test-regexp.cc
 | 
| index cc946464b26ab47c1aa78a0e9fe5d2e0837b3ea2..741acbc147700da7a598e9026524dc49c7ca59a3 100644
 | 
| --- a/test/cctest/test-regexp.cc
 | 
| +++ b/test/cctest/test-regexp.cc
 | 
| @@ -1816,3 +1816,36 @@ TEST(Graph) {
 | 
|    V8::Initialize(NULL);
 | 
|    Execute("\\b\\w+\\b", false, true, true);
 | 
|  }
 | 
| +
 | 
| +
 | 
| +class TimeoutThread : public i::Thread {
 | 
| + public:
 | 
| +  explicit TimeoutThread(v8::Isolate* isolate)
 | 
| +      : Thread("TimeoutThread"), isolate_(isolate) {}
 | 
| +
 | 
| +  virtual void Run() {
 | 
| +    OS::Sleep(500);  // Wait a bit before terminating thread.
 | 
| +    v8::V8::TerminateExecution(isolate_);
 | 
| +  }
 | 
| +
 | 
| + private:
 | 
| +  v8::Isolate* isolate_;
 | 
| +};
 | 
| +
 | 
| +
 | 
| +// Test that a regular expression execution can be interrupted and
 | 
| +// survive a garbage collection.
 | 
| +TEST(RegExpInterruption) {
 | 
| +  v8::HandleScope scope(CcTest::isolate());
 | 
| +  LocalContext env;
 | 
| +
 | 
| +  TimeoutThread timeout_thread(CcTest::isolate());
 | 
| +  v8::TryCatch try_catch;
 | 
| +
 | 
| +  timeout_thread.Start();
 | 
| +  // Run a regexp that does not terminate in reasonable time unless forced.
 | 
| +  CompileRun("/((a*)*)*b/.exec('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa')");
 | 
| +  CHECK(try_catch.HasTerminated());
 | 
| +
 | 
| +  timeout_thread.Join();
 | 
| +}
 | 
| 
 |