Commit 8de78e69 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[bigint] Adapt CodeStubAssembler::BranchIfSameValue.

R=jkummerow@chromium.org

Bug: v8:6791
Change-Id: Id499a47cbb545c7ba4bffd1c1935846be6025b5e
Reviewed-on: https://chromium-review.googlesource.com/712255
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: 's avatarJakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48487}
parent 126b2bd2
......@@ -9130,14 +9130,16 @@ void CodeStubAssembler::BranchIfSameValue(Node* lhs, Node* rhs, Label* if_true,
BIND(&if_rhsisheapobject);
{
// Now this can only yield true if either both {lhs} and {rhs}
// are HeapNumbers with the same value or both {lhs} and {rhs}
// are Strings with the same character sequence.
Label if_lhsisheapnumber(this), if_lhsisstring(this);
// Now this can only yield true if either both {lhs} and {rhs} are
// HeapNumbers with the same value, or both are Strings with the same
// character sequence, or both are BigInts with the same value.
Label if_lhsisheapnumber(this), if_lhsisstring(this),
if_lhsisbigint(this);
Node* const lhs_map = LoadMap(lhs);
GotoIf(IsHeapNumberMap(lhs_map), &if_lhsisheapnumber);
Node* const lhs_instance_type = LoadMapInstanceType(lhs_map);
Branch(IsStringInstanceType(lhs_instance_type), &if_lhsisstring,
GotoIf(IsStringInstanceType(lhs_instance_type), &if_lhsisstring);
Branch(IsBigIntInstanceType(lhs_instance_type), &if_lhsisbigint,
if_false);
BIND(&if_lhsisheapnumber);
......@@ -9157,6 +9159,14 @@ void CodeStubAssembler::BranchIfSameValue(Node* lhs, Node* rhs, Label* if_true,
CallBuiltin(Builtins::kStringEqual, NoContextConstant(), lhs, rhs);
Branch(IsTrue(result), if_true, if_false);
}
BIND(&if_lhsisbigint);
{
GotoIfNot(IsBigInt(rhs), if_false);
Node* const result =
CallRuntime(Runtime::kBigIntEqual, NoContextConstant(), lhs, rhs);
Branch(IsTrue(result), if_true, if_false);
}
}
}
......
......@@ -280,6 +280,17 @@ const six = BigInt(6);
// SameValue
{
assertTrue(Object.is(zero, zero));
assertTrue(Object.is(zero, another_zero));
assertTrue(Object.is(one, one));
assertTrue(Object.is(one, another_one));
assertFalse(Object.is(zero, +0));
assertFalse(Object.is(zero, -0));
assertFalse(Object.is(+0, zero));
assertFalse(Object.is(-0, zero));
assertFalse(Object.is(zero, one));
assertFalse(Object.is(one, minus_one));
}{
const obj = Object.defineProperty({}, 'foo',
{value: zero, writable: false, configurable: false});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment