src: write ascii strings using WriteOneByte

WriteAscii will be deprecated soon from v8, and performance has
regressed. The v8 team recommended using WriteOneByte instead.
This commit is contained in:
Trevor Norris 2013-03-21 09:26:23 -07:00 committed by Fedor Indutny
parent 40b1c9a66d
commit f150d56915
3 changed files with 10 additions and 7 deletions

View File

@ -1212,7 +1212,10 @@ ssize_t DecodeWrite(char *buf,
} }
if (encoding == ASCII) { if (encoding == ASCII) {
str->WriteAscii(buf, 0, buflen, String::HINT_MANY_WRITES_EXPECTED); str->WriteOneByte(reinterpret_cast<uint8_t*>(buf),
0,
buflen,
String::HINT_MANY_WRITES_EXPECTED);
return buflen; return buflen;
} }

View File

@ -749,7 +749,7 @@ Handle<Value> Buffer::AsciiWrite(const Arguments &args) {
char *p = buffer->data_ + offset; char *p = buffer->data_ + offset;
int written = s->WriteAscii(p, int written = s->WriteOneByte(reinterpret_cast<uint8_t*>(p),
0, 0,
max_length, max_length,
(String::HINT_MANY_WRITES_EXPECTED | (String::HINT_MANY_WRITES_EXPECTED |

View File

@ -392,7 +392,7 @@ Handle<Value> StreamWrap::WriteStringImpl(const Arguments& args) {
size_t data_size; size_t data_size;
switch (encoding) { switch (encoding) {
case kAscii: case kAscii:
data_size = string->WriteAscii(data, 0, -1, data_size = string->WriteOneByte(reinterpret_cast<uint8_t*>(data), 0, -1,
String::NO_NULL_TERMINATION | String::HINT_MANY_WRITES_EXPECTED); String::NO_NULL_TERMINATION | String::HINT_MANY_WRITES_EXPECTED);
break; break;