| 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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 int value = current.data_.u_int_; | 146 int value = current.data_.u_int_; |
| 147 if (0x20 <= value && value <= 0x7F) { | 147 if (0x20 <= value && value <= 0x7F) { |
| 148 Put(value); | 148 Put(value); |
| 149 } else if (value <= 0xff) { | 149 } else if (value <= 0xff) { |
| 150 Add("\\x%02x", value); | 150 Add("\\x%02x", value); |
| 151 } else { | 151 } else { |
| 152 Add("\\u%04x", value); | 152 Add("\\u%04x", value); |
| 153 } | 153 } |
| 154 break; | 154 break; |
| 155 } | 155 } |
| 156 case 'i': case 'd': case 'u': case 'x': case 'c': case 'p': case 'X': { | 156 case 'i': case 'd': case 'u': case 'x': case 'c': case 'X': { |
| 157 int value = current.data_.u_int_; | 157 int value = current.data_.u_int_; |
| 158 EmbeddedVector<char, 24> formatted; | 158 EmbeddedVector<char, 24> formatted; |
| 159 int length = OS::SNPrintF(formatted, temp.start(), value); | 159 int length = OS::SNPrintF(formatted, temp.start(), value); |
| 160 Add(Vector<const char>(formatted.start(), length)); | 160 Add(Vector<const char>(formatted.start(), length)); |
| 161 break; | 161 break; |
| 162 } | 162 } |
| 163 case 'f': case 'g': case 'G': case 'e': case 'E': { | 163 case 'f': case 'g': case 'G': case 'e': case 'E': { |
| 164 double value = current.data_.u_double_; | 164 double value = current.data_.u_double_; |
| 165 EmbeddedVector<char, 28> formatted; | 165 EmbeddedVector<char, 28> formatted; |
| 166 OS::SNPrintF(formatted, temp.start(), value); | 166 OS::SNPrintF(formatted, temp.start(), value); |
| 167 Add(formatted.start()); | 167 Add(formatted.start()); |
| 168 break; | 168 break; |
| 169 } | 169 } |
| 170 case 'p': { |
| 171 void* value = current.data_.u_pointer_; |
| 172 EmbeddedVector<char, 20> formatted; |
| 173 OS::SNPrintF(formatted, temp.start(), value); |
| 174 Add(formatted.start()); |
| 175 break; |
| 176 } |
| 170 default: | 177 default: |
| 171 UNREACHABLE(); | 178 UNREACHABLE(); |
| 172 break; | 179 break; |
| 173 } | 180 } |
| 174 } | 181 } |
| 175 | 182 |
| 176 // Verify that the buffer is 0-terminated | 183 // Verify that the buffer is 0-terminated |
| 177 ASSERT(buffer_[length_] == '\0'); | 184 ASSERT(buffer_[length_] == '\0'); |
| 178 } | 185 } |
| 179 | 186 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 | 575 |
| 569 // Only grow once to the maximum allowable size. | 576 // Only grow once to the maximum allowable size. |
| 570 char* NoAllocationStringAllocator::grow(unsigned* bytes) { | 577 char* NoAllocationStringAllocator::grow(unsigned* bytes) { |
| 571 ASSERT(size_ >= *bytes); | 578 ASSERT(size_ >= *bytes); |
| 572 *bytes = size_; | 579 *bytes = size_; |
| 573 return space_; | 580 return space_; |
| 574 } | 581 } |
| 575 | 582 |
| 576 | 583 |
| 577 } } // namespace v8::internal | 584 } } // namespace v8::internal |
| OLD | NEW |