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 | 8 |
9 namespace v8 { | 9 namespace v8 { |
10 namespace internal { | 10 namespace internal { |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 } else if (value <= 0xff) { | 122 } else if (value <= 0xff) { |
123 Add("\\x%02x", value); | 123 Add("\\x%02x", value); |
124 } else { | 124 } else { |
125 Add("\\u%04x", value); | 125 Add("\\u%04x", value); |
126 } | 126 } |
127 break; | 127 break; |
128 } | 128 } |
129 case 'i': case 'd': case 'u': case 'x': case 'c': case 'X': { | 129 case 'i': case 'd': case 'u': case 'x': case 'c': case 'X': { |
130 int value = current.data_.u_int_; | 130 int value = current.data_.u_int_; |
131 EmbeddedVector<char, 24> formatted; | 131 EmbeddedVector<char, 24> formatted; |
132 int length = OS::SNPrintF(formatted, temp.start(), value); | 132 int length = SNPrintF(formatted, temp.start(), value); |
133 Add(Vector<const char>(formatted.start(), length)); | 133 Add(Vector<const char>(formatted.start(), length)); |
134 break; | 134 break; |
135 } | 135 } |
136 case 'f': case 'g': case 'G': case 'e': case 'E': { | 136 case 'f': case 'g': case 'G': case 'e': case 'E': { |
137 double value = current.data_.u_double_; | 137 double value = current.data_.u_double_; |
138 EmbeddedVector<char, 28> formatted; | 138 EmbeddedVector<char, 28> formatted; |
139 OS::SNPrintF(formatted, temp.start(), value); | 139 SNPrintF(formatted, temp.start(), value); |
140 Add(formatted.start()); | 140 Add(formatted.start()); |
141 break; | 141 break; |
142 } | 142 } |
143 case 'p': { | 143 case 'p': { |
144 void* value = current.data_.u_pointer_; | 144 void* value = current.data_.u_pointer_; |
145 EmbeddedVector<char, 20> formatted; | 145 EmbeddedVector<char, 20> formatted; |
146 OS::SNPrintF(formatted, temp.start(), value); | 146 SNPrintF(formatted, temp.start(), value); |
147 Add(formatted.start()); | 147 Add(formatted.start()); |
148 break; | 148 break; |
149 } | 149 } |
150 default: | 150 default: |
151 UNREACHABLE(); | 151 UNREACHABLE(); |
152 break; | 152 break; |
153 } | 153 } |
154 } | 154 } |
155 | 155 |
156 // Verify that the buffer is 0-terminated | 156 // Verify that the buffer is 0-terminated |
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 | 557 |
558 // Only grow once to the maximum allowable size. | 558 // Only grow once to the maximum allowable size. |
559 char* NoAllocationStringAllocator::grow(unsigned* bytes) { | 559 char* NoAllocationStringAllocator::grow(unsigned* bytes) { |
560 ASSERT(size_ >= *bytes); | 560 ASSERT(size_ >= *bytes); |
561 *bytes = size_; | 561 *bytes = size_; |
562 return space_; | 562 return space_; |
563 } | 563 } |
564 | 564 |
565 | 565 |
566 } } // namespace v8::internal | 566 } } // namespace v8::internal |
OLD | NEW |