| 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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 OS::TearDown(); | 128 OS::TearDown(); |
| 129 } | 129 } |
| 130 | 130 |
| 131 | 131 |
| 132 static void seed_random(uint32_t* state) { | 132 static void seed_random(uint32_t* state) { |
| 133 for (int i = 0; i < 2; ++i) { | 133 for (int i = 0; i < 2; ++i) { |
| 134 if (FLAG_random_seed != 0) { | 134 if (FLAG_random_seed != 0) { |
| 135 state[i] = FLAG_random_seed; | 135 state[i] = FLAG_random_seed; |
| 136 } else if (entropy_source != NULL) { | 136 } else if (entropy_source != NULL) { |
| 137 uint32_t val; | 137 uint32_t val; |
| 138 ScopedLock lock(entropy_mutex.Pointer()); | 138 LockGuard<Mutex> lock_guard(entropy_mutex.Pointer()); |
| 139 entropy_source(reinterpret_cast<unsigned char*>(&val), sizeof(uint32_t)); | 139 entropy_source(reinterpret_cast<unsigned char*>(&val), sizeof(uint32_t)); |
| 140 state[i] = val; | 140 state[i] = val; |
| 141 } else { | 141 } else { |
| 142 state[i] = random(); | 142 state[i] = random(); |
| 143 } | 143 } |
| 144 } | 144 } |
| 145 } | 145 } |
| 146 | 146 |
| 147 | 147 |
| 148 // Random number generator using George Marsaglia's MWC algorithm. | 148 // Random number generator using George Marsaglia's MWC algorithm. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 ExternalReference::SetUp(); | 328 ExternalReference::SetUp(); |
| 329 Bootstrapper::InitializeOncePerProcess(); | 329 Bootstrapper::InitializeOncePerProcess(); |
| 330 } | 330 } |
| 331 | 331 |
| 332 | 332 |
| 333 void V8::InitializeOncePerProcess() { | 333 void V8::InitializeOncePerProcess() { |
| 334 CallOnce(&init_once, &InitializeOncePerProcessImpl); | 334 CallOnce(&init_once, &InitializeOncePerProcessImpl); |
| 335 } | 335 } |
| 336 | 336 |
| 337 } } // namespace v8::internal | 337 } } // namespace v8::internal |
| OLD | NEW |