| OLD | NEW |
| 1 // Copyright 2007-2011 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2011 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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 public: | 176 public: |
| 177 explicit IsolateLockingThreadWithLocalContext(v8::Isolate* isolate) | 177 explicit IsolateLockingThreadWithLocalContext(v8::Isolate* isolate) |
| 178 : JoinableThread("IsolateLockingThread"), | 178 : JoinableThread("IsolateLockingThread"), |
| 179 isolate_(isolate) { | 179 isolate_(isolate) { |
| 180 } | 180 } |
| 181 | 181 |
| 182 virtual void Run() { | 182 virtual void Run() { |
| 183 v8::Locker locker(isolate_); | 183 v8::Locker locker(isolate_); |
| 184 v8::Isolate::Scope isolate_scope(isolate_); | 184 v8::Isolate::Scope isolate_scope(isolate_); |
| 185 v8::HandleScope handle_scope(isolate_); | 185 v8::HandleScope handle_scope(isolate_); |
| 186 LocalContext local_context; | 186 LocalContext local_context(isolate_); |
| 187 CHECK_EQ(isolate_, v8::internal::Isolate::Current()); | 187 CHECK_EQ(isolate_, v8::internal::Isolate::Current()); |
| 188 CalcFibAndCheck(); | 188 CalcFibAndCheck(); |
| 189 } | 189 } |
| 190 private: | 190 private: |
| 191 v8::Isolate* isolate_; | 191 v8::Isolate* isolate_; |
| 192 }; | 192 }; |
| 193 | 193 |
| 194 | 194 |
| 195 static void StartJoinAndDeleteThreads(const i::List<JoinableThread*>& threads) { | 195 static void StartJoinAndDeleteThreads(const i::List<JoinableThread*>& threads) { |
| 196 for (int i = 0; i < threads.length(); i++) { | 196 for (int i = 0; i < threads.length(); i++) { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 | 260 |
| 261 class IsolateNestedLockingThread : public JoinableThread { | 261 class IsolateNestedLockingThread : public JoinableThread { |
| 262 public: | 262 public: |
| 263 explicit IsolateNestedLockingThread(v8::Isolate* isolate) | 263 explicit IsolateNestedLockingThread(v8::Isolate* isolate) |
| 264 : JoinableThread("IsolateNestedLocking"), isolate_(isolate) { | 264 : JoinableThread("IsolateNestedLocking"), isolate_(isolate) { |
| 265 } | 265 } |
| 266 virtual void Run() { | 266 virtual void Run() { |
| 267 v8::Locker lock(isolate_); | 267 v8::Locker lock(isolate_); |
| 268 v8::Isolate::Scope isolate_scope(isolate_); | 268 v8::Isolate::Scope isolate_scope(isolate_); |
| 269 v8::HandleScope handle_scope(isolate_); | 269 v8::HandleScope handle_scope(isolate_); |
| 270 LocalContext local_context; | 270 LocalContext local_context(isolate_); |
| 271 { | 271 { |
| 272 v8::Locker another_lock(isolate_); | 272 v8::Locker another_lock(isolate_); |
| 273 CalcFibAndCheck(); | 273 CalcFibAndCheck(); |
| 274 } | 274 } |
| 275 { | 275 { |
| 276 v8::Locker another_lock(isolate_); | 276 v8::Locker another_lock(isolate_); |
| 277 CalcFibAndCheck(); | 277 CalcFibAndCheck(); |
| 278 } | 278 } |
| 279 } | 279 } |
| 280 private: | 280 private: |
| (...skipping 23 matching lines...) Expand all Loading... |
| 304 SeparateIsolatesLocksNonexclusiveThread(v8::Isolate* isolate1, | 304 SeparateIsolatesLocksNonexclusiveThread(v8::Isolate* isolate1, |
| 305 v8::Isolate* isolate2) | 305 v8::Isolate* isolate2) |
| 306 : JoinableThread("SeparateIsolatesLocksNonexclusiveThread"), | 306 : JoinableThread("SeparateIsolatesLocksNonexclusiveThread"), |
| 307 isolate1_(isolate1), isolate2_(isolate2) { | 307 isolate1_(isolate1), isolate2_(isolate2) { |
| 308 } | 308 } |
| 309 | 309 |
| 310 virtual void Run() { | 310 virtual void Run() { |
| 311 v8::Locker lock(isolate1_); | 311 v8::Locker lock(isolate1_); |
| 312 v8::Isolate::Scope isolate_scope(isolate1_); | 312 v8::Isolate::Scope isolate_scope(isolate1_); |
| 313 v8::HandleScope handle_scope(isolate1_); | 313 v8::HandleScope handle_scope(isolate1_); |
| 314 LocalContext local_context; | 314 LocalContext local_context(isolate1_); |
| 315 | 315 |
| 316 IsolateLockingThreadWithLocalContext threadB(isolate2_); | 316 IsolateLockingThreadWithLocalContext threadB(isolate2_); |
| 317 threadB.Start(); | 317 threadB.Start(); |
| 318 CalcFibAndCheck(); | 318 CalcFibAndCheck(); |
| 319 threadB.Join(); | 319 threadB.Join(); |
| 320 } | 320 } |
| 321 private: | 321 private: |
| 322 v8::Isolate* isolate1_; | 322 v8::Isolate* isolate1_; |
| 323 v8::Isolate* isolate2_; | 323 v8::Isolate* isolate2_; |
| 324 }; | 324 }; |
| (...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 kSimpleExtensionSource)); | 731 kSimpleExtensionSource)); |
| 732 const char* extension_names[] = { "test0", "test1", | 732 const char* extension_names[] = { "test0", "test1", |
| 733 "test2", "test3", "test4", | 733 "test2", "test3", "test4", |
| 734 "test5", "test6", "test7" }; | 734 "test5", "test6", "test7" }; |
| 735 i::List<JoinableThread*> threads(kNThreads); | 735 i::List<JoinableThread*> threads(kNThreads); |
| 736 for (int i = 0; i < kNThreads; i++) { | 736 for (int i = 0; i < kNThreads; i++) { |
| 737 threads.Add(new IsolateGenesisThread(8, extension_names)); | 737 threads.Add(new IsolateGenesisThread(8, extension_names)); |
| 738 } | 738 } |
| 739 StartJoinAndDeleteThreads(threads); | 739 StartJoinAndDeleteThreads(threads); |
| 740 } | 740 } |
| OLD | NEW |