| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 // are not safely published. | 180 // are not safely published. |
| 181 ASSERT(isMainThread()); | 181 ASSERT(isMainThread()); |
| 182 | 182 |
| 183 // Most numbers used are <= 100. Even if they aren't used there's very littl
e cost in using the space. | 183 // Most numbers used are <= 100. Even if they aren't used there's very littl
e cost in using the space. |
| 184 const int kLowNumbers = 100; | 184 const int kLowNumbers = 100; |
| 185 DEFINE_STATIC_LOCAL(Vector<AtomicString>, lowNumbers, (kLowNumbers + 1)); | 185 DEFINE_STATIC_LOCAL(Vector<AtomicString>, lowNumbers, (kLowNumbers + 1)); |
| 186 String webCoreString; | 186 String webCoreString; |
| 187 if (0 <= value && value <= kLowNumbers) { | 187 if (0 <= value && value <= kLowNumbers) { |
| 188 webCoreString = lowNumbers[value]; | 188 webCoreString = lowNumbers[value]; |
| 189 if (!webCoreString) { | 189 if (!webCoreString) { |
| 190 AtomicString valueString = AtomicString(String::number(value)); | 190 AtomicString valueString = AtomicString::number(value); |
| 191 lowNumbers[value] = valueString; | 191 lowNumbers[value] = valueString; |
| 192 webCoreString = valueString; | 192 webCoreString = valueString; |
| 193 } | 193 } |
| 194 } else | 194 } else |
| 195 webCoreString = String::number(value); | 195 webCoreString = String::number(value); |
| 196 return webCoreString; | 196 return webCoreString; |
| 197 } | 197 } |
| 198 | 198 |
| 199 String int32ToWebCoreString(int value) | 199 String int32ToWebCoreString(int value) |
| 200 { | 200 { |
| 201 // If we are on the main thread (this should always true for non-workers), c
all the faster one. | 201 // If we are on the main thread (this should always true for non-workers), c
all the faster one. |
| 202 if (isMainThread()) | 202 if (isMainThread()) |
| 203 return int32ToWebCoreStringFast(value); | 203 return int32ToWebCoreStringFast(value); |
| 204 return String::number(value); | 204 return String::number(value); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace WebCore | 207 } // namespace WebCore |
| OLD | NEW |