| OLD | NEW |
| 1 // Copyright 2009 the V8 project authors. All rights reserved. | 1 // Copyright 2009 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 v8::Script::Compile(source)->Run(); | 155 v8::Script::Compile(source)->Run(); |
| 156 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate())); | 156 CHECK(!v8::V8::IsExecutionTerminating(CcTest::isolate())); |
| 157 // Test that we can run the code again after thread termination. | 157 // Test that we can run the code again after thread termination. |
| 158 v8::Script::Compile(source)->Run(); | 158 v8::Script::Compile(source)->Run(); |
| 159 } | 159 } |
| 160 | 160 |
| 161 | 161 |
| 162 class TerminatorThread : public v8::base::Thread { | 162 class TerminatorThread : public v8::base::Thread { |
| 163 public: | 163 public: |
| 164 explicit TerminatorThread(i::Isolate* isolate) | 164 explicit TerminatorThread(i::Isolate* isolate) |
| 165 : Thread("TerminatorThread"), | 165 : Thread(Options("TerminatorThread")), |
| 166 isolate_(reinterpret_cast<v8::Isolate*>(isolate)) { } | 166 isolate_(reinterpret_cast<v8::Isolate*>(isolate)) {} |
| 167 void Run() { | 167 void Run() { |
| 168 semaphore->Wait(); | 168 semaphore->Wait(); |
| 169 CHECK(!v8::V8::IsExecutionTerminating(isolate_)); | 169 CHECK(!v8::V8::IsExecutionTerminating(isolate_)); |
| 170 v8::V8::TerminateExecution(isolate_); | 170 v8::V8::TerminateExecution(isolate_); |
| 171 } | 171 } |
| 172 | 172 |
| 173 private: | 173 private: |
| 174 v8::Isolate* isolate_; | 174 v8::Isolate* isolate_; |
| 175 }; | 175 }; |
| 176 | 176 |
| (...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 CompileRun(terminate_and_loop); | 452 CompileRun(terminate_and_loop); |
| 453 CHECK(!try_catch.HasTerminated()); | 453 CHECK(!try_catch.HasTerminated()); |
| 454 CHECK_EQ(2, callback_counter); | 454 CHECK_EQ(2, callback_counter); |
| 455 } | 455 } |
| 456 | 456 |
| 457 // Now the previously requested terminate execution interrupt should trigger. | 457 // Now the previously requested terminate execution interrupt should trigger. |
| 458 CompileRun("for (var i = 0; i < 10000; i++);"); | 458 CompileRun("for (var i = 0; i < 10000; i++);"); |
| 459 CHECK(try_catch.HasTerminated()); | 459 CHECK(try_catch.HasTerminated()); |
| 460 CHECK_EQ(2, callback_counter); | 460 CHECK_EQ(2, callback_counter); |
| 461 } | 461 } |
| OLD | NEW |