Merge V8 5.2.361.47 DO NOT MERGE
https://chromium.googlesource.com/v8/v8/+/5.2.361.47
FPIIM-449
Change-Id: Ibec421b85a9b88cb3a432ada642e469fe7e78346
(cherry picked from commit bcf72ee8e3b26f1d0726869c7ddb3921c68b09a8)
diff --git a/src/parsing/scanner.h b/src/parsing/scanner.h
index 22c504c..0acc7ab 100644
--- a/src/parsing/scanner.h
+++ b/src/parsing/scanner.h
@@ -225,8 +225,14 @@
} else {
is_one_byte_ = other->is_one_byte_;
position_ = other->position_;
- backing_store_.Dispose();
- backing_store_ = other->backing_store_.Clone();
+ if (position_ < backing_store_.length()) {
+ std::copy(other->backing_store_.begin(),
+ other->backing_store_.begin() + position_,
+ backing_store_.begin());
+ } else {
+ backing_store_.Dispose();
+ backing_store_ = other->backing_store_.Clone();
+ }
}
}
@@ -419,6 +425,13 @@
// Returns the location of the last seen octal literal.
Location octal_position() const { return octal_pos_; }
void clear_octal_position() { octal_pos_ = Location::invalid(); }
+ // Returns the location of the last seen decimal literal with a leading zero.
+ Location decimal_with_leading_zero_position() const {
+ return decimal_with_leading_zero_pos_;
+ }
+ void clear_decimal_with_leading_zero_position() {
+ decimal_with_leading_zero_pos_ = Location::invalid();
+ }
// Returns the value of the last smi that was scanned.
int smi_value() const { return current_.smi_value_; }
@@ -436,6 +449,12 @@
has_multiline_comment_before_next_;
}
+ bool HasAnyLineTerminatorAfterNext() {
+ Token::Value ensure_next_next = PeekAhead();
+ USE(ensure_next_next);
+ return has_line_terminator_after_next_;
+ }
+
// Scans the input as a regular expression pattern, previous
// character(s) must be /(=). Returns true if a pattern is scanned.
bool ScanRegExpPattern(bool seen_equal);
@@ -582,7 +601,7 @@
}
void PushBack(uc32 ch) {
- if (ch > static_cast<uc32>(unibrow::Utf16::kMaxNonSurrogateCharCode)) {
+ if (c0_ > static_cast<uc32>(unibrow::Utf16::kMaxNonSurrogateCharCode)) {
source_->PushBack(unibrow::Utf16::TrailSurrogate(c0_));
source_->PushBack(unibrow::Utf16::LeadSurrogate(c0_));
} else {
@@ -766,9 +785,9 @@
// Input stream. Must be initialized to an Utf16CharacterStream.
Utf16CharacterStream* source_;
-
- // Start position of the octal literal last scanned.
+ // Last-seen positions of potentially problematic tokens.
Location octal_pos_;
+ Location decimal_with_leading_zero_pos_;
// One Unicode character look-ahead; c0_ < 0 at the end of the input.
uc32 c0_;
@@ -780,6 +799,7 @@
// Whether there is a multi-line comment that contains a
// line-terminator after the current token, and before the next.
bool has_multiline_comment_before_next_;
+ bool has_line_terminator_after_next_;
// Whether this scanner encountered an HTML comment.
bool found_html_comment_;