OLD | NEW |
1 // Copyright 2006-2011 the V8 project authors. All rights reserved. | 1 // Copyright 2006-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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 | 54 |
55 | 55 |
56 double ceiling(double x) { | 56 double ceiling(double x) { |
57 return ceil(x); | 57 return ceil(x); |
58 } | 58 } |
59 | 59 |
60 | 60 |
61 static Mutex* limit_mutex = NULL; | 61 static Mutex* limit_mutex = NULL; |
62 | 62 |
63 | 63 |
64 void OS::Setup() { | 64 void OS::SetUp() { |
65 // Seed the random number generator. | 65 // Seed the random number generator. |
66 // Convert the current time to a 64-bit integer first, before converting it | 66 // Convert the current time to a 64-bit integer first, before converting it |
67 // to an unsigned. Going directly can cause an overflow and the seed to be | 67 // to an unsigned. Going directly can cause an overflow and the seed to be |
68 // set to all ones. The seed will be identical for different instances that | 68 // set to all ones. The seed will be identical for different instances that |
69 // call this setup code within the same millisecond. | 69 // call this setup code within the same millisecond. |
70 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()); | 70 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()); |
71 srandom(static_cast<unsigned int>(seed)); | 71 srandom(static_cast<unsigned int>(seed)); |
72 limit_mutex = CreateMutex(); | 72 limit_mutex = CreateMutex(); |
73 } | 73 } |
74 | 74 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // for a zero-length string because we know that we at least read the | 283 // for a zero-length string because we know that we at least read the |
284 // '/' character. | 284 // '/' character. |
285 lib_name[strlen(lib_name) - 1] = '\0'; | 285 lib_name[strlen(lib_name) - 1] = '\0'; |
286 } else { | 286 } else { |
287 // No library name found, just record the raw address range. | 287 // No library name found, just record the raw address range. |
288 snprintf(lib_name, kLibNameLen, | 288 snprintf(lib_name, kLibNameLen, |
289 "%08" V8PRIxPTR "-%08" V8PRIxPTR, start, end); | 289 "%08" V8PRIxPTR "-%08" V8PRIxPTR, start, end); |
290 } | 290 } |
291 LOG(isolate, SharedLibraryEvent(lib_name, start, end)); | 291 LOG(isolate, SharedLibraryEvent(lib_name, start, end)); |
292 } else { | 292 } else { |
293 // Entry not describing executable data. Skip to end of line to setup | 293 // Entry not describing executable data. Skip to end of line to set up |
294 // reading the next entry. | 294 // reading the next entry. |
295 do { | 295 do { |
296 c = getc(fp); | 296 c = getc(fp); |
297 } while ((c != EOF) && (c != '\n')); | 297 } while ((c != EOF) && (c != '\n')); |
298 if (c == EOF) break; | 298 if (c == EOF) break; |
299 } | 299 } |
300 } | 300 } |
301 free(lib_name); | 301 free(lib_name); |
302 fclose(fp); | 302 fclose(fp); |
303 } | 303 } |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 | 754 |
755 | 755 |
756 void Sampler::Stop() { | 756 void Sampler::Stop() { |
757 ASSERT(IsActive()); | 757 ASSERT(IsActive()); |
758 SamplerThread::RemoveActiveSampler(this); | 758 SamplerThread::RemoveActiveSampler(this); |
759 SetActive(false); | 759 SetActive(false); |
760 } | 760 } |
761 | 761 |
762 | 762 |
763 } } // namespace v8::internal | 763 } } // namespace v8::internal |
OLD | NEW |