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 "src/string-stream.h" | 5 #include "src/string-stream.h" |
6 | 6 |
7 #include "src/handles-inl.h" | 7 #include "src/handles-inl.h" |
8 #include "src/prototype.h" | 8 #include "src/prototype.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } | 122 } |
123 case 'i': case 'd': case 'u': case 'x': case 'c': case 'X': { | 123 case 'i': case 'd': case 'u': case 'x': case 'c': case 'X': { |
124 int value = current.data_.u_int_; | 124 int value = current.data_.u_int_; |
125 EmbeddedVector<char, 24> formatted; | 125 EmbeddedVector<char, 24> formatted; |
126 int length = SNPrintF(formatted, temp.start(), value); | 126 int length = SNPrintF(formatted, temp.start(), value); |
127 Add(Vector<const char>(formatted.start(), length)); | 127 Add(Vector<const char>(formatted.start(), length)); |
128 break; | 128 break; |
129 } | 129 } |
130 case 'f': case 'g': case 'G': case 'e': case 'E': { | 130 case 'f': case 'g': case 'G': case 'e': case 'E': { |
131 double value = current.data_.u_double_; | 131 double value = current.data_.u_double_; |
132 EmbeddedVector<char, 28> formatted; | 132 int inf = std::isinf(value); |
133 SNPrintF(formatted, temp.start(), value); | 133 if (inf == -1) { |
134 Add(formatted.start()); | 134 Add("-inf"); |
| 135 } else if (inf == 1) { |
| 136 Add("inf"); |
| 137 } else if (std::isnan(value)) { |
| 138 Add("nan"); |
| 139 } else { |
| 140 EmbeddedVector<char, 28> formatted; |
| 141 SNPrintF(formatted, temp.start(), value); |
| 142 Add(formatted.start()); |
| 143 } |
135 break; | 144 break; |
136 } | 145 } |
137 case 'p': { | 146 case 'p': { |
138 void* value = current.data_.u_pointer_; | 147 void* value = current.data_.u_pointer_; |
139 EmbeddedVector<char, 20> formatted; | 148 EmbeddedVector<char, 20> formatted; |
140 SNPrintF(formatted, temp.start(), value); | 149 SNPrintF(formatted, temp.start(), value); |
141 Add(formatted.start()); | 150 Add(formatted.start()); |
142 break; | 151 break; |
143 } | 152 } |
144 default: | 153 default: |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 } | 552 } |
544 MemCopy(new_space, space_, *bytes); | 553 MemCopy(new_space, space_, *bytes); |
545 *bytes = new_bytes; | 554 *bytes = new_bytes; |
546 DeleteArray(space_); | 555 DeleteArray(space_); |
547 space_ = new_space; | 556 space_ = new_space; |
548 return new_space; | 557 return new_space; |
549 } | 558 } |
550 | 559 |
551 | 560 |
552 } } // namespace v8::internal | 561 } } // namespace v8::internal |
OLD | NEW |