Skip to content

Commit 0438399

Browse files
generatedunixname89002005232357facebook-github-bot
generatedunixname89002005232357
authored andcommitted
Revert D40283500: Multisect successfully blamed D40283500 for test or build failures
Summary: This diff is reverting D40283500 D40283500 has been identified to be causing the following test or build failures: Tests affected: - https://www.internalfb.com/intern/test/844424945068193/ Here's the Multisect link: https://www.internalfb.com/intern/testinfra/multisect/1355177 Here are the tasks that are relevant to this breakage: T134940596: 3 tests started failing for oncall haas in the last 2 weeks We're generating a revert to back out the changes in this diff, please note the backout may land if someone accepts it. Reviewed By: fbmal7 Differential Revision: D40461524 fbshipit-source-id: 863435129d36e6742d60753617fdab1223e16ee7
1 parent 81200a6 commit 0438399

File tree

2 files changed

+3
-22
lines changed

2 files changed

+3
-22
lines changed

include/hermes/Support/UTF16Stream.h

-4
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ class UTF16Stream {
5959
return *this;
6060
}
6161

62-
const char16_t *position() const {
63-
return cur_;
64-
}
65-
6662
private:
6763
/// Tries to convert more data. Returns true if more data was converted.
6864
bool refill();

lib/VM/JSLib/JSONLexer.cpp

+3-18
Original file line numberDiff line numberDiff line change
@@ -127,28 +127,20 @@ ExecutionStatus JSONLexer::scanNumber() {
127127
ExecutionStatus JSONLexer::scanString() {
128128
assert(*curCharPtr_ == '"');
129129
++curCharPtr_;
130-
const char16_t *start = curCharPtr_.position();
131-
bool hasEscape = false;
132-
// Ideally we don't have to use tmpStorage. In the case of a plain string with
133-
// no escapes, we just construct an ArrayRef at the end of scanning that
134-
// points to the beginning and end of the string.
135130
SmallU16String<32> tmpStorage;
136131

137132
while (curCharPtr_.hasChar()) {
138133
if (*curCharPtr_ == '"') {
139134
// End of string.
140-
llvh::ArrayRef<char16_t> strRef = hasEscape
141-
? tmpStorage.arrayRef()
142-
: llvh::makeArrayRef(start, curCharPtr_.position());
143135
++curCharPtr_;
144136
// If the string exists in the identifier table, use that one.
145137
if (auto existing =
146138
runtime_.getIdentifierTable().getExistingStringPrimitiveOrNull(
147-
runtime_, strRef)) {
139+
runtime_, tmpStorage.arrayRef())) {
148140
token_.setString(runtime_.makeHandle<StringPrimitive>(existing));
149141
return ExecutionStatus::RETURNED;
150142
}
151-
auto strRes = StringPrimitive::create(runtime_, strRef);
143+
auto strRes = StringPrimitive::create(runtime_, tmpStorage.arrayRef());
152144
if (LLVM_UNLIKELY(strRes == ExecutionStatus::EXCEPTION)) {
153145
return ExecutionStatus::EXCEPTION;
154146
}
@@ -158,12 +150,6 @@ ExecutionStatus JSONLexer::scanString() {
158150
return error(u"U+0000 thru U+001F is not allowed in string");
159151
}
160152
if (*curCharPtr_ == u'\\') {
161-
if (!hasEscape && curCharPtr_.position() != start) {
162-
// This is the first escape character encountered, so append everything
163-
// we've seen so far to tmpStorage.
164-
tmpStorage.append(start, curCharPtr_.position());
165-
}
166-
hasEscape = true;
167153
++curCharPtr_;
168154
if (!curCharPtr_.hasChar()) {
169155
return error("Unexpected end of input");
@@ -211,8 +197,7 @@ ExecutionStatus JSONLexer::scanString() {
211197
return errorWithChar(u"Invalid escape sequence: ", *curCharPtr_);
212198
}
213199
} else {
214-
if (hasEscape)
215-
tmpStorage.push_back(*curCharPtr_);
200+
tmpStorage.push_back(*curCharPtr_);
216201
++curCharPtr_;
217202
}
218203
}

0 commit comments

Comments
 (0)