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 13065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
13076 class RegExpInterruptionThread : public v8::base::Thread { | 13076 class RegExpInterruptionThread : public v8::base::Thread { |
13077 public: | 13077 public: |
13078 explicit RegExpInterruptionThread(v8::Isolate* isolate) | 13078 explicit RegExpInterruptionThread(v8::Isolate* isolate) |
13079 : Thread(Options("TimeoutThread")), isolate_(isolate) {} | 13079 : Thread(Options("TimeoutThread")), isolate_(isolate) {} |
13080 | 13080 |
13081 virtual void Run() { | 13081 virtual void Run() { |
13082 for (v8::base::NoBarrier_Store(®exp_interruption_data.loop_count, 0); | 13082 for (v8::base::NoBarrier_Store(®exp_interruption_data.loop_count, 0); |
13083 v8::base::NoBarrier_Load(®exp_interruption_data.loop_count) < 7; | 13083 v8::base::NoBarrier_Load(®exp_interruption_data.loop_count) < 7; |
13084 v8::base::NoBarrier_AtomicIncrement( | 13084 v8::base::NoBarrier_AtomicIncrement( |
13085 ®exp_interruption_data.loop_count, 1)) { | 13085 ®exp_interruption_data.loop_count, 1)) { |
13086 v8::base::OS::Sleep(50); // Wait a bit before requesting GC. | 13086 // Wait a bit before requesting GC. |
| 13087 v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(50)); |
13087 reinterpret_cast<i::Isolate*>(isolate_)->stack_guard()->RequestGC(); | 13088 reinterpret_cast<i::Isolate*>(isolate_)->stack_guard()->RequestGC(); |
13088 } | 13089 } |
13089 v8::base::OS::Sleep(50); // Wait a bit before terminating. | 13090 // Wait a bit before terminating. |
| 13091 v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(50)); |
13090 v8::V8::TerminateExecution(isolate_); | 13092 v8::V8::TerminateExecution(isolate_); |
13091 } | 13093 } |
13092 | 13094 |
13093 private: | 13095 private: |
13094 v8::Isolate* isolate_; | 13096 v8::Isolate* isolate_; |
13095 }; | 13097 }; |
13096 | 13098 |
13097 | 13099 |
13098 void RunBeforeGC(v8::GCType type, v8::GCCallbackFlags flags) { | 13100 void RunBeforeGC(v8::GCType type, v8::GCCallbackFlags flags) { |
13099 if (v8::base::NoBarrier_Load(®exp_interruption_data.loop_count) != 2) { | 13101 if (v8::base::NoBarrier_Load(®exp_interruption_data.loop_count) != 2) { |
(...skipping 5674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
18774 | 18776 |
18775 class InterruptThread : public v8::base::Thread { | 18777 class InterruptThread : public v8::base::Thread { |
18776 public: | 18778 public: |
18777 explicit InterruptThread(ThreadInterruptTest* test) | 18779 explicit InterruptThread(ThreadInterruptTest* test) |
18778 : Thread(Options("InterruptThread")), test_(test) {} | 18780 : Thread(Options("InterruptThread")), test_(test) {} |
18779 | 18781 |
18780 virtual void Run() { | 18782 virtual void Run() { |
18781 struct sigaction action; | 18783 struct sigaction action; |
18782 | 18784 |
18783 // Ensure that we'll enter waiting condition | 18785 // Ensure that we'll enter waiting condition |
18784 v8::base::OS::Sleep(100); | 18786 v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(100)); |
18785 | 18787 |
18786 // Setup signal handler | 18788 // Setup signal handler |
18787 memset(&action, 0, sizeof(action)); | 18789 memset(&action, 0, sizeof(action)); |
18788 action.sa_handler = SignalHandler; | 18790 action.sa_handler = SignalHandler; |
18789 sigaction(SIGCHLD, &action, NULL); | 18791 sigaction(SIGCHLD, &action, NULL); |
18790 | 18792 |
18791 // Send signal | 18793 // Send signal |
18792 kill(getpid(), SIGCHLD); | 18794 kill(getpid(), SIGCHLD); |
18793 | 18795 |
18794 // Ensure that if wait has returned because of error | 18796 // Ensure that if wait has returned because of error |
18795 v8::base::OS::Sleep(100); | 18797 v8::base::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(100)); |
18796 | 18798 |
18797 // Set value and signal semaphore | 18799 // Set value and signal semaphore |
18798 test_->sem_value_ = 1; | 18800 test_->sem_value_ = 1; |
18799 test_->sem_.Signal(); | 18801 test_->sem_.Signal(); |
18800 } | 18802 } |
18801 | 18803 |
18802 static void SignalHandler(int signal) { | 18804 static void SignalHandler(int signal) { |
18803 } | 18805 } |
18804 | 18806 |
18805 private: | 18807 private: |
(...skipping 2166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
20972 | 20974 |
20973 { | 20975 { |
20974 v8::HandleScope handle_scope(isolate); | 20976 v8::HandleScope handle_scope(isolate); |
20975 | 20977 |
20976 // Should work | 20978 // Should work |
20977 v8::Local<v8::Object> obj = v8::Object::New(isolate); | 20979 v8::Local<v8::Object> obj = v8::Object::New(isolate); |
20978 | 20980 |
20979 USE(obj); | 20981 USE(obj); |
20980 } | 20982 } |
20981 } | 20983 } |
OLD | NEW |