[bigint] Flatten string in Runtime_BigIntEqualToString

Bug: v8:6791, v8:6995
Change-Id: I79d04d9e8fbe156570875e3ecc2a1a87c9a794ee
Reviewed-on: https://chromium-review.googlesource.com/740918
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48991}
This commit is contained in:
Jakob Kummerow 2017-10-26 16:31:37 -07:00 committed by Commit Bot
parent 70b1f15e5a
commit 3942370c39
2 changed files with 3 additions and 0 deletions

View File

@ -57,6 +57,7 @@ RUNTIME_FUNCTION(Runtime_BigIntEqualToString) {
DCHECK_EQ(2, args.length()); DCHECK_EQ(2, args.length());
CONVERT_ARG_HANDLE_CHECKED(BigInt, lhs, 0); CONVERT_ARG_HANDLE_CHECKED(BigInt, lhs, 0);
CONVERT_ARG_HANDLE_CHECKED(String, rhs, 1); CONVERT_ARG_HANDLE_CHECKED(String, rhs, 1);
rhs = String::Flatten(rhs);
bool result = BigInt::EqualToString(lhs, rhs); bool result = BigInt::EqualToString(lhs, rhs);
return *isolate->factory()->ToBoolean(result); return *isolate->factory()->ToBoolean(result);
} }

View File

@ -151,6 +151,8 @@ const six = BigInt(6);
assertFalse(one == "a"); assertFalse(one == "a");
assertFalse("a" == one); assertFalse("a" == one);
assertTrue(zero == "00000000000000" + "0");
assertTrue(one == {valueOf() { return true }}); assertTrue(one == {valueOf() { return true }});
assertTrue({valueOf() { return true }} == one); assertTrue({valueOf() { return true }} == one);
assertFalse(two == {valueOf() { return true }}); assertFalse(two == {valueOf() { return true }});