| 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 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1147 if (decimal_pos > 0) result_size++; | 1147 if (decimal_pos > 0) result_size++; |
| 1148 // Allocate result and fill in the parts. | 1148 // Allocate result and fill in the parts. |
| 1149 StringBuilder builder(result_size + 1); | 1149 StringBuilder builder(result_size + 1); |
| 1150 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size); | 1150 builder.AddSubstring(integer_buffer + integer_pos + 1, integer_part_size); |
| 1151 if (decimal_pos > 0) builder.AddCharacter('.'); | 1151 if (decimal_pos > 0) builder.AddCharacter('.'); |
| 1152 builder.AddSubstring(decimal_buffer, decimal_pos); | 1152 builder.AddSubstring(decimal_buffer, decimal_pos); |
| 1153 return builder.Finalize(); | 1153 return builder.Finalize(); |
| 1154 } | 1154 } |
| 1155 | 1155 |
| 1156 | 1156 |
| 1157 static Mutex* dtoa_lock_one = OS::CreateMutex(); |
| 1158 static Mutex* dtoa_lock_zero = OS::CreateMutex(); |
| 1159 |
| 1160 |
| 1157 } } // namespace v8::internal | 1161 } } // namespace v8::internal |
| 1162 |
| 1163 |
| 1164 extern "C" { |
| 1165 void ACQUIRE_DTOA_LOCK(int n) { |
| 1166 ASSERT(n == 0 || n == 1); |
| 1167 (n == 0 ? v8::internal::dtoa_lock_zero : v8::internal::dtoa_lock_one)->Lock(); |
| 1168 } |
| 1169 |
| 1170 |
| 1171 void FREE_DTOA_LOCK(int n) { |
| 1172 ASSERT(n == 0 || n == 1); |
| 1173 (n == 0 ? v8::internal::dtoa_lock_zero : v8::internal::dtoa_lock_one)-> |
| 1174 Unlock(); |
| 1175 } |
| 1176 } |
| OLD | NEW |