Upgrade V8 to version 4.9.385.28
https://chromium.googlesource.com/v8/v8/+/4.9.385.28
FPIIM-449
Change-Id: I4b2e74289d4bf3667f2f3dc8aa2e541f63e26eb4
diff --git a/src/unicode-decoder.cc b/src/unicode-decoder.cc
index 88eff3a..2289e08 100644
--- a/src/unicode-decoder.cc
+++ b/src/unicode-decoder.cc
@@ -10,16 +10,17 @@
namespace unibrow {
-void Utf8DecoderBase::Reset(uint16_t* buffer, unsigned buffer_length,
- const uint8_t* stream, unsigned stream_length) {
+void Utf8DecoderBase::Reset(uint16_t* buffer, size_t buffer_length,
+ const uint8_t* stream, size_t stream_length) {
// Assume everything will fit in the buffer and stream won't be needed.
last_byte_of_buffer_unused_ = false;
unbuffered_start_ = NULL;
+ unbuffered_length_ = 0;
bool writing_to_buffer = true;
// Loop until stream is read, writing to buffer as long as buffer has space.
- unsigned utf16_length = 0;
+ size_t utf16_length = 0;
while (stream_length != 0) {
- unsigned cursor = 0;
+ size_t cursor = 0;
uint32_t character = Utf8::ValueOf(stream, stream_length, &cursor);
DCHECK(cursor > 0 && cursor <= stream_length);
stream += cursor;
@@ -41,6 +42,7 @@
// Just wrote last character of buffer
writing_to_buffer = false;
unbuffered_start_ = stream;
+ unbuffered_length_ = stream_length;
}
continue;
}
@@ -50,19 +52,23 @@
writing_to_buffer = false;
last_byte_of_buffer_unused_ = true;
unbuffered_start_ = stream - cursor;
+ unbuffered_length_ = stream_length + cursor;
}
utf16_length_ = utf16_length;
}
-void Utf8DecoderBase::WriteUtf16Slow(const uint8_t* stream, uint16_t* data,
- unsigned data_length) {
+void Utf8DecoderBase::WriteUtf16Slow(const uint8_t* stream,
+ size_t stream_length, uint16_t* data,
+ size_t data_length) {
while (data_length != 0) {
- unsigned cursor = 0;
- uint32_t character = Utf8::ValueOf(stream, Utf8::kMaxEncodedSize, &cursor);
+ size_t cursor = 0;
+ uint32_t character = Utf8::ValueOf(stream, stream_length, &cursor);
// There's a total lack of bounds checking for stream
// as it was already done in Reset.
stream += cursor;
+ DCHECK(stream_length >= cursor);
+ stream_length -= cursor;
if (character > unibrow::Utf16::kMaxNonSurrogateCharCode) {
*data++ = Utf16::LeadSurrogate(character);
*data++ = Utf16::TrailSurrogate(character);