OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()); | 82 uint64_t seed = static_cast<uint64_t>(TimeCurrentMillis()); |
83 srandom(static_cast<unsigned int>(seed)); | 83 srandom(static_cast<unsigned int>(seed)); |
84 } | 84 } |
85 | 85 |
86 | 86 |
87 double OS::nan_value() { | 87 double OS::nan_value() { |
88 return NAN; | 88 return NAN; |
89 } | 89 } |
90 | 90 |
91 | 91 |
| 92 bool OS::fgrep_vfp(const char* file_name, const char* string) { |
| 93 // Simple detection of VFP at runtime for Linux. |
| 94 // It is based on /proc/cpuinfo, which reveals hardware configuration |
| 95 // to user-space applications. According to ARM (mid 2009), no similar |
| 96 // facility is universally available on the ARM architectures, |
| 97 // so it's up to individual OSes to provide such. |
| 98 // |
| 99 // This is written as a straight shot one pass parser |
| 100 // and not using STL string and ifstream because, |
| 101 // on Linux, it's reading from a (non-mmap-able) |
| 102 // character special device. |
| 103 |
| 104 FILE* f = NULL; |
| 105 |
| 106 if (NULL == (f = fopen(file_name, "r"))) |
| 107 return false; |
| 108 |
| 109 const char* what = string; |
| 110 int k; |
| 111 while (EOF != (k = fgetc(f))) { |
| 112 if (k == *what) { |
| 113 ++what; |
| 114 while ((*what != '\0') && (*what == fgetc(f))) { |
| 115 ++what; |
| 116 } |
| 117 if (*what == '\0') { |
| 118 fclose(f); |
| 119 return true; |
| 120 } else { |
| 121 what = string; |
| 122 } |
| 123 } |
| 124 } |
| 125 fclose(f); |
| 126 |
| 127 // Did not find string in the file file_name. |
| 128 return false; |
| 129 } |
| 130 |
| 131 |
92 int OS::ActivationFrameAlignment() { | 132 int OS::ActivationFrameAlignment() { |
93 #ifdef V8_TARGET_ARCH_ARM | 133 #ifdef V8_TARGET_ARCH_ARM |
94 // On EABI ARM targets this is required for fp correctness in the | 134 // On EABI ARM targets this is required for fp correctness in the |
95 // runtime system. | 135 // runtime system. |
96 return 8; | 136 return 8; |
97 #else | 137 #else |
98 // With gcc 4.4 the tree vectorization optimiser can generate code | 138 // With gcc 4.4 the tree vectorization optimiser can generate code |
99 // that requires 16 byte alignment such as movdqa on x86. | 139 // that requires 16 byte alignment such as movdqa on x86. |
100 return 16; | 140 return 16; |
101 #endif | 141 #endif |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
742 | 782 |
743 // This sampler is no longer the active sampler. | 783 // This sampler is no longer the active sampler. |
744 active_sampler_ = NULL; | 784 active_sampler_ = NULL; |
745 active_ = false; | 785 active_ = false; |
746 } | 786 } |
747 | 787 |
748 | 788 |
749 #endif // ENABLE_LOGGING_AND_PROFILING | 789 #endif // ENABLE_LOGGING_AND_PROFILING |
750 | 790 |
751 } } // namespace v8::internal | 791 } } // namespace v8::internal |
OLD | NEW |