OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <algorithm> | 5 #include <algorithm> |
6 #include <cmath> | 6 #include <cmath> |
7 | 7 |
| 8 #include "src/base/platform/platform.h" // For isinf/isnan with MSVC |
8 #include "src/ostreams.h" | 9 #include "src/ostreams.h" |
9 | 10 |
10 #if V8_OS_WIN | 11 #if V8_OS_WIN |
11 #define snprintf sprintf_s | 12 #define snprintf sprintf_s |
12 #endif | 13 #endif |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 | 17 |
17 // Be lazy and delegate the value=>char conversion to snprintf. | 18 // Be lazy and delegate the value=>char conversion to snprintf. |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 165 |
165 OStream& operator<<(OStream& os, const AsUC16& c) { | 166 OStream& operator<<(OStream& os, const AsUC16& c) { |
166 char buf[10]; | 167 char buf[10]; |
167 const char* format = (0x20 <= c.value && c.value <= 0x7F) | 168 const char* format = (0x20 <= c.value && c.value <= 0x7F) |
168 ? "%c" | 169 ? "%c" |
169 : (c.value <= 0xff) ? "\\x%02x" : "\\u%04x"; | 170 : (c.value <= 0xff) ? "\\x%02x" : "\\u%04x"; |
170 snprintf(buf, sizeof(buf), format, c.value); | 171 snprintf(buf, sizeof(buf), format, c.value); |
171 return os << buf; | 172 return os << buf; |
172 } | 173 } |
173 } } // namespace v8::internal | 174 } } // namespace v8::internal |
OLD | NEW |