Skip to content

Commit

Permalink
Easy: remoove _RJS from stringToBigInt_RJS
Browse files Browse the repository at this point in the history
Summary:
It does not invoke the interpreter recursively. Discovered this while
annotation IR instructions for it.

Reviewed By: neildhar

Differential Revision: D42297944

fbshipit-source-id: 296a0811b55adf8652dba20395d7c1adee68c397
  • Loading branch information
Tzvetan Mikov authored and facebook-github-bot committed Jan 10, 2023
1 parent 87e6799 commit 4ab8204
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion include/hermes/VM/Operations.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,7 +456,7 @@ bool isIntegralNumber(double number);
CallResult<HermesValue> toBigInt_RJS(Runtime &runtime, Handle<> value);

// ES2022 7.1.14 StringToBigInt
CallResult<HermesValue> stringToBigInt_RJS(Runtime &runtime, Handle<> value);
CallResult<HermesValue> stringToBigInt(Runtime &runtime, Handle<> value);

// ES2022 21.2.3 Properties of the BigInt Prototype Object - thisBigIntValue
CallResult<HermesValue> thisBigIntValue(Runtime &runtime, Handle<> value);
Expand Down
8 changes: 4 additions & 4 deletions lib/VM/Operations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,7 @@ static CallResult<bool> compareBigIntAndString(
bool (*comparator)(int)) {
assert(rightHandle->isString() && "rhs should be string");

auto bigintRight = stringToBigInt_RJS(runtime, rightHandle);
auto bigintRight = stringToBigInt(runtime, rightHandle);
if (LLVM_UNLIKELY(bigintRight == ExecutionStatus::EXCEPTION)) {
return ExecutionStatus::EXCEPTION;
}
Expand Down Expand Up @@ -1077,7 +1077,7 @@ abstractEqualityTest_RJS(Runtime &runtime, Handle<> xHandle, Handle<> yHandle) {
// 6. If Type(x) is BigInt and Type(y) is String, then
CASE_M_M(BigInt, Str) {
// a. Let n be ! StringToBigInt(y).
auto n = stringToBigInt_RJS(runtime, y);
auto n = stringToBigInt(runtime, y);
if (LLVM_UNLIKELY(n == ExecutionStatus::EXCEPTION)) {
return ExecutionStatus::EXCEPTION;
}
Expand Down Expand Up @@ -2227,7 +2227,7 @@ CallResult<HermesValue> toBigInt_RJS(Runtime &runtime, Handle<> value) {
return *prim;
case HermesValue::ETag::Str1:
case HermesValue::ETag::Str2: {
auto n = stringToBigInt_RJS(runtime, runtime.makeHandle(*prim));
auto n = stringToBigInt(runtime, runtime.makeHandle(*prim));
if (LLVM_UNLIKELY(n == ExecutionStatus::EXCEPTION)) {
return ExecutionStatus::EXCEPTION;
}
Expand All @@ -2243,7 +2243,7 @@ CallResult<HermesValue> toBigInt_RJS(Runtime &runtime, Handle<> value) {
return runtime.raiseTypeError("invalid argument to BigInt()");
}

CallResult<HermesValue> stringToBigInt_RJS(Runtime &runtime, Handle<> value) {
CallResult<HermesValue> stringToBigInt(Runtime &runtime, Handle<> value) {
if (value->isString()) {
auto str = value->getString();

Expand Down

0 comments on commit 4ab8204

Please sign in to comment.