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 4706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4717 } | 4717 } |
4718 } | 4718 } |
4719 CHECK_EQ(N, num_blocked_); | 4719 CHECK_EQ(N, num_blocked_); |
4720 } | 4720 } |
4721 | 4721 |
4722 private: | 4722 private: |
4723 ConditionVariable cv_; | 4723 ConditionVariable cv_; |
4724 Mutex mutex_; | 4724 Mutex mutex_; |
4725 int num_blocked_; | 4725 int num_blocked_; |
4726 | 4726 |
4727 STATIC_CHECK(N > 0); | 4727 STATIC_ASSERT(N > 0); |
4728 | 4728 |
4729 DISALLOW_COPY_AND_ASSIGN(ThreadBarrier); | 4729 DISALLOW_COPY_AND_ASSIGN(ThreadBarrier); |
4730 }; | 4730 }; |
4731 | 4731 |
4732 | 4732 |
4733 // A set containing enough barriers and semaphores for any of the tests. | 4733 // A set containing enough barriers and semaphores for any of the tests. |
4734 class Barriers { | 4734 class Barriers { |
4735 public: | 4735 public: |
4736 Barriers() : semaphore_1(0), semaphore_2(0) {} | 4736 Barriers() : semaphore_1(0), semaphore_2(0) {} |
4737 ThreadBarrier<2> barrier_1; | 4737 ThreadBarrier<2> barrier_1; |
(...skipping 2680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7418 env->Global()->Set(v8_str("add_debug_break"), add_debug_break); | 7418 env->Global()->Set(v8_str("add_debug_break"), add_debug_break); |
7419 | 7419 |
7420 CompileRun("(function loop() {" | 7420 CompileRun("(function loop() {" |
7421 " for (var j = 0; j < 1000; j++) {" | 7421 " for (var j = 0; j < 1000; j++) {" |
7422 " for (var i = 0; i < 1000; i++) {" | 7422 " for (var i = 0; i < 1000; i++) {" |
7423 " if (i == 999) add_debug_break();" | 7423 " if (i == 999) add_debug_break();" |
7424 " }" | 7424 " }" |
7425 " }" | 7425 " }" |
7426 "})()"); | 7426 "})()"); |
7427 } | 7427 } |
OLD | NEW |