Skip to content

Commit

Permalink
Revert D40283500: Multisect successfully blamed D40283500 for test or…
Browse files Browse the repository at this point in the history
… 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
  • Loading branch information
generatedunixname89002005232357 authored and facebook-github-bot committed Oct 18, 2022
1 parent 81200a6 commit 0438399
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
4 changes: 0 additions & 4 deletions include/hermes/Support/UTF16Stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ class UTF16Stream {
return *this;
}

const char16_t *position() const {
return cur_;
}

private:
/// Tries to convert more data. Returns true if more data was converted.
bool refill();
Expand Down
21 changes: 3 additions & 18 deletions lib/VM/JSLib/JSONLexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,28 +127,20 @@ ExecutionStatus JSONLexer::scanNumber() {
ExecutionStatus JSONLexer::scanString() {
assert(*curCharPtr_ == '"');
++curCharPtr_;
const char16_t *start = curCharPtr_.position();
bool hasEscape = false;
// Ideally we don't have to use tmpStorage. In the case of a plain string with
// no escapes, we just construct an ArrayRef at the end of scanning that
// points to the beginning and end of the string.
SmallU16String<32> tmpStorage;

while (curCharPtr_.hasChar()) {
if (*curCharPtr_ == '"') {
// End of string.
llvh::ArrayRef<char16_t> strRef = hasEscape
? tmpStorage.arrayRef()
: llvh::makeArrayRef(start, curCharPtr_.position());
++curCharPtr_;
// If the string exists in the identifier table, use that one.
if (auto existing =
runtime_.getIdentifierTable().getExistingStringPrimitiveOrNull(
runtime_, strRef)) {
runtime_, tmpStorage.arrayRef())) {
token_.setString(runtime_.makeHandle<StringPrimitive>(existing));
return ExecutionStatus::RETURNED;
}
auto strRes = StringPrimitive::create(runtime_, strRef);
auto strRes = StringPrimitive::create(runtime_, tmpStorage.arrayRef());
if (LLVM_UNLIKELY(strRes == ExecutionStatus::EXCEPTION)) {
return ExecutionStatus::EXCEPTION;
}
Expand All @@ -158,12 +150,6 @@ ExecutionStatus JSONLexer::scanString() {
return error(u"U+0000 thru U+001F is not allowed in string");
}
if (*curCharPtr_ == u'\\') {
if (!hasEscape && curCharPtr_.position() != start) {
// This is the first escape character encountered, so append everything
// we've seen so far to tmpStorage.
tmpStorage.append(start, curCharPtr_.position());
}
hasEscape = true;
++curCharPtr_;
if (!curCharPtr_.hasChar()) {
return error("Unexpected end of input");
Expand Down Expand Up @@ -211,8 +197,7 @@ ExecutionStatus JSONLexer::scanString() {
return errorWithChar(u"Invalid escape sequence: ", *curCharPtr_);
}
} else {
if (hasEscape)
tmpStorage.push_back(*curCharPtr_);
tmpStorage.push_back(*curCharPtr_);
++curCharPtr_;
}
}
Expand Down

0 comments on commit 0438399

Please sign in to comment.