| 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 13077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13088 class RegExpInterruptionThread : public v8::base::Thread { | 13088 class RegExpInterruptionThread : public v8::base::Thread { |
| 13089 public: | 13089 public: |
| 13090 explicit RegExpInterruptionThread(v8::Isolate* isolate) | 13090 explicit RegExpInterruptionThread(v8::Isolate* isolate) |
| 13091 : Thread(Options("TimeoutThread")), isolate_(isolate) {} | 13091 : Thread(Options("TimeoutThread")), isolate_(isolate) {} |
| 13092 | 13092 |
| 13093 virtual void Run() { | 13093 virtual void Run() { |
| 13094 for (v8::base::NoBarrier_Store(®exp_interruption_data.loop_count, 0); | 13094 for (v8::base::NoBarrier_Store(®exp_interruption_data.loop_count, 0); |
| 13095 v8::base::NoBarrier_Load(®exp_interruption_data.loop_count) < 7; | 13095 v8::base::NoBarrier_Load(®exp_interruption_data.loop_count) < 7; |
| 13096 v8::base::NoBarrier_AtomicIncrement( | 13096 v8::base::NoBarrier_AtomicIncrement( |
| 13097 ®exp_interruption_data.loop_count, 1)) { | 13097 ®exp_interruption_data.loop_count, 1)) { |
| 13098 v8::base::OS::Sleep(50); // Wait a bit before requesting GC. | 13098 // Wait a bit before requesting GC. |
| 13099 v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(50)); |
| 13099 reinterpret_cast<i::Isolate*>(isolate_)->stack_guard()->RequestGC(); | 13100 reinterpret_cast<i::Isolate*>(isolate_)->stack_guard()->RequestGC(); |
| 13100 } | 13101 } |
| 13101 v8::base::OS::Sleep(50); // Wait a bit before terminating. | 13102 // Wait a bit before terminating. |
| 13103 v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(50)); |
| 13102 v8::V8::TerminateExecution(isolate_); | 13104 v8::V8::TerminateExecution(isolate_); |
| 13103 } | 13105 } |
| 13104 | 13106 |
| 13105 private: | 13107 private: |
| 13106 v8::Isolate* isolate_; | 13108 v8::Isolate* isolate_; |
| 13107 }; | 13109 }; |
| 13108 | 13110 |
| 13109 | 13111 |
| 13110 void RunBeforeGC(v8::GCType type, v8::GCCallbackFlags flags) { | 13112 void RunBeforeGC(v8::GCType type, v8::GCCallbackFlags flags) { |
| 13111 if (v8::base::NoBarrier_Load(®exp_interruption_data.loop_count) != 2) { | 13113 if (v8::base::NoBarrier_Load(®exp_interruption_data.loop_count) != 2) { |
| (...skipping 5693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 18805 | 18807 |
| 18806 class InterruptThread : public v8::base::Thread { | 18808 class InterruptThread : public v8::base::Thread { |
| 18807 public: | 18809 public: |
| 18808 explicit InterruptThread(ThreadInterruptTest* test) | 18810 explicit InterruptThread(ThreadInterruptTest* test) |
| 18809 : Thread(Options("InterruptThread")), test_(test) {} | 18811 : Thread(Options("InterruptThread")), test_(test) {} |
| 18810 | 18812 |
| 18811 virtual void Run() { | 18813 virtual void Run() { |
| 18812 struct sigaction action; | 18814 struct sigaction action; |
| 18813 | 18815 |
| 18814 // Ensure that we'll enter waiting condition | 18816 // Ensure that we'll enter waiting condition |
| 18815 v8::base::OS::Sleep(100); | 18817 v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(100)); |
| 18816 | 18818 |
| 18817 // Setup signal handler | 18819 // Setup signal handler |
| 18818 memset(&action, 0, sizeof(action)); | 18820 memset(&action, 0, sizeof(action)); |
| 18819 action.sa_handler = SignalHandler; | 18821 action.sa_handler = SignalHandler; |
| 18820 sigaction(SIGCHLD, &action, NULL); | 18822 sigaction(SIGCHLD, &action, NULL); |
| 18821 | 18823 |
| 18822 // Send signal | 18824 // Send signal |
| 18823 kill(getpid(), SIGCHLD); | 18825 kill(getpid(), SIGCHLD); |
| 18824 | 18826 |
| 18825 // Ensure that if wait has returned because of error | 18827 // Ensure that if wait has returned because of error |
| 18826 v8::base::OS::Sleep(100); | 18828 v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(100)); |
| 18827 | 18829 |
| 18828 // Set value and signal semaphore | 18830 // Set value and signal semaphore |
| 18829 test_->sem_value_ = 1; | 18831 test_->sem_value_ = 1; |
| 18830 test_->sem_.Signal(); | 18832 test_->sem_.Signal(); |
| 18831 } | 18833 } |
| 18832 | 18834 |
| 18833 static void SignalHandler(int signal) { | 18835 static void SignalHandler(int signal) { |
| 18834 } | 18836 } |
| 18835 | 18837 |
| 18836 private: | 18838 private: |
| (...skipping 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 21003 | 21005 |
| 21004 { | 21006 { |
| 21005 v8::HandleScope handle_scope(isolate); | 21007 v8::HandleScope handle_scope(isolate); |
| 21006 | 21008 |
| 21007 // Should work | 21009 // Should work |
| 21008 v8::Local<v8::Object> obj = v8::Object::New(isolate); | 21010 v8::Local<v8::Object> obj = v8::Object::New(isolate); |
| 21009 | 21011 |
| 21010 USE(obj); | 21012 USE(obj); |
| 21011 } | 21013 } |
| 21012 } | 21014 } |
| OLD | NEW |