| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 if (has_call_completed_callbacks) { | 165 if (has_call_completed_callbacks) { |
| 166 for (int i = 0; i < call_completed_callbacks_->length(); i++) { | 166 for (int i = 0; i < call_completed_callbacks_->length(); i++) { |
| 167 call_completed_callbacks_->at(i)(); | 167 call_completed_callbacks_->at(i)(); |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 handle_scope_implementer->DecrementCallDepth(); | 170 handle_scope_implementer->DecrementCallDepth(); |
| 171 } | 171 } |
| 172 | 172 |
| 173 | 173 |
| 174 // Use a union type to avoid type-aliasing optimizations in GCC. | |
| 175 typedef union { | |
| 176 double double_value; | |
| 177 uint64_t uint64_t_value; | |
| 178 } double_int_union; | |
| 179 | |
| 180 | |
| 181 Object* V8::FillHeapNumberWithRandom(Object* heap_number, | |
| 182 Context* context) { | |
| 183 double_int_union r; | |
| 184 uint64_t random_bits = Random(context); | |
| 185 // Convert 32 random bits to 0.(32 random bits) in a double | |
| 186 // by computing: | |
| 187 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). | |
| 188 static const double binary_million = 1048576.0; | |
| 189 r.double_value = binary_million; | |
| 190 r.uint64_t_value |= random_bits; | |
| 191 r.double_value -= binary_million; | |
| 192 | |
| 193 HeapNumber::cast(heap_number)->set_value(r.double_value); | |
| 194 return heap_number; | |
| 195 } | |
| 196 | |
| 197 | |
| 198 void V8::InitializeOncePerProcessImpl() { | 174 void V8::InitializeOncePerProcessImpl() { |
| 199 FlagList::EnforceFlagImplications(); | 175 FlagList::EnforceFlagImplications(); |
| 200 if (FLAG_stress_compaction) { | 176 if (FLAG_stress_compaction) { |
| 201 FLAG_force_marking_deque_overflows = true; | 177 FLAG_force_marking_deque_overflows = true; |
| 202 FLAG_gc_global = true; | 178 FLAG_gc_global = true; |
| 203 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; | 179 FLAG_max_new_space_size = (1 << (kPageSizeBits - 10)) * 2; |
| 204 } | 180 } |
| 205 | 181 |
| 206 if (FLAG_concurrent_recompilation && | 182 if (FLAG_concurrent_recompilation && |
| 207 (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs)) { | 183 (FLAG_trace_hydrogen || FLAG_trace_hydrogen_stubs)) { |
| 208 FLAG_concurrent_recompilation = false; | 184 FLAG_concurrent_recompilation = false; |
| 185 FLAG_concurrent_osr = false; |
| 209 PrintF("Concurrent recompilation has been disabled for tracing.\n"); | 186 PrintF("Concurrent recompilation has been disabled for tracing.\n"); |
| 210 } | 187 } |
| 211 | 188 |
| 212 if (FLAG_sweeper_threads <= 0) { | 189 if (FLAG_sweeper_threads <= 0) { |
| 213 if (FLAG_concurrent_sweeping) { | 190 if (FLAG_concurrent_sweeping) { |
| 214 FLAG_sweeper_threads = SystemThreadManager:: | 191 FLAG_sweeper_threads = SystemThreadManager:: |
| 215 NumberOfParallelSystemThreads( | 192 NumberOfParallelSystemThreads( |
| 216 SystemThreadManager::CONCURRENT_SWEEPING); | 193 SystemThreadManager::CONCURRENT_SWEEPING); |
| 217 } else if (FLAG_parallel_sweeping) { | 194 } else if (FLAG_parallel_sweeping) { |
| 218 FLAG_sweeper_threads = SystemThreadManager:: | 195 FLAG_sweeper_threads = SystemThreadManager:: |
| 219 NumberOfParallelSystemThreads( | 196 NumberOfParallelSystemThreads( |
| 220 SystemThreadManager::PARALLEL_SWEEPING); | 197 SystemThreadManager::PARALLEL_SWEEPING); |
| 221 } | 198 } |
| 222 if (FLAG_sweeper_threads == 0) { | 199 if (FLAG_sweeper_threads == 0) { |
| 223 FLAG_concurrent_sweeping = false; | 200 FLAG_concurrent_sweeping = false; |
| 224 FLAG_parallel_sweeping = false; | 201 FLAG_parallel_sweeping = false; |
| 225 } | 202 } |
| 226 } else if (!FLAG_concurrent_sweeping && !FLAG_parallel_sweeping) { | 203 } else if (!FLAG_concurrent_sweeping && !FLAG_parallel_sweeping) { |
| 227 FLAG_sweeper_threads = 0; | 204 FLAG_sweeper_threads = 0; |
| 228 } | 205 } |
| 229 | 206 |
| 230 if (FLAG_concurrent_recompilation && | 207 if (FLAG_concurrent_recompilation && |
| 231 SystemThreadManager::NumberOfParallelSystemThreads( | 208 SystemThreadManager::NumberOfParallelSystemThreads( |
| 232 SystemThreadManager::PARALLEL_RECOMPILATION) == 0) { | 209 SystemThreadManager::CONCURRENT_RECOMPILATION) == 0) { |
| 233 FLAG_concurrent_recompilation = false; | 210 FLAG_concurrent_recompilation = false; |
| 211 FLAG_concurrent_osr = false; |
| 234 } | 212 } |
| 235 | 213 |
| 236 Sampler::SetUp(); | 214 Sampler::SetUp(); |
| 237 CPU::SetUp(); | 215 CPU::SetUp(); |
| 238 OS::PostSetUp(); | 216 OS::PostSetUp(); |
| 239 ElementsAccessor::InitializeOncePerProcess(); | 217 ElementsAccessor::InitializeOncePerProcess(); |
| 240 LOperand::SetUpCaches(); | 218 LOperand::SetUpCaches(); |
| 241 SetUpJSCallerSavedCodeData(); | 219 SetUpJSCallerSavedCodeData(); |
| 242 ExternalReference::SetUp(); | 220 ExternalReference::SetUp(); |
| 243 Bootstrapper::InitializeOncePerProcess(); | 221 Bootstrapper::InitializeOncePerProcess(); |
| 244 } | 222 } |
| 245 | 223 |
| 246 | 224 |
| 247 void V8::InitializeOncePerProcess() { | 225 void V8::InitializeOncePerProcess() { |
| 248 CallOnce(&init_once, &InitializeOncePerProcessImpl); | 226 CallOnce(&init_once, &InitializeOncePerProcessImpl); |
| 249 } | 227 } |
| 250 | 228 |
| 251 } } // namespace v8::internal | 229 } } // namespace v8::internal |
| OLD | NEW |