Commit Graph

52 Commits

Author SHA1 Message Date
Jakob Kummerow
207bb03714 [bigint] Allow BigInt(n) for n > MAX_SAFE_INTEGER
Spec change: https://github.com/tc39/proposal-bigint/pull/138

Bug: v8:6791
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I7367273ed1e98971be3b277f6486333a96412185
Reviewed-on: https://chromium-review.googlesource.com/1004120
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52611}
2018-04-16 05:37:04 +00:00
Jakob Kummerow
8cc5a7239a [bigint] Update "bigint < string" semantics
Per the spec change at [1], Abstract Relational Comparison between a
BigInt and a String converts the String to BigInt via StringToBigInt
before performing the comparison. Before this change, the String was
converted to a Number, and a BigInt/Number comparison was performed.

[1] https://github.com/tc39/proposal-bigint/pull/139

Bug: v8:6791
Change-Id: I40b4f4ddc78977adb0d44180eb58e0f9a8a70cb6
Reviewed-on: https://chromium-review.googlesource.com/1004117
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52609}
2018-04-15 00:53:36 +00:00
Jakob Kummerow
0c0847bea4 [bigint] Fix Object::VerifyApiCallResultType
Add BigInt to the list of allowed result types.

Bug: v8:6791, chromium:819871
Change-Id: Ib636859da07b38c462ce7017d720e5370ba618d6
Reviewed-on: https://chromium-review.googlesource.com/957422
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51859}
2018-03-10 02:47:20 +00:00
Jakob Kummerow
66f21389a7 [bigint] Fix Exponentiate for 1 ** multi_digit
Bug: chromium:819026
Change-Id: I2c58d5e2892f683747966e00aa047153085ac121
Reviewed-on: https://chromium-review.googlesource.com/950472
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51776}
2018-03-06 18:58:32 +00:00
Jakob Kummerow
62d1f78245 [bigint] Fix throwing in Exponentiate()
When the multiplication steps fail, they have already thrown an
exception internally, so we should not throw another.
The power-of-two fast path erroneously did not throw at all for
a few input values.

Bug: chromium:818277
Change-Id: If90f6aa3e77fc72e3434daca3b898c77739933ab
Reviewed-on: https://chromium-review.googlesource.com/947254
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51711}
2018-03-03 00:59:42 +00:00
Jakob Kummerow
dcbcf0469d [bigint] Fix tie-to-even case in BigInt::ToNumber
Bug: v8:6791, v8:7506
Change-Id: I8ff41cb5fab03ab2ced8f21016a0744582a3fcee
Reviewed-on: https://chromium-review.googlesource.com/942387
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51666}
2018-03-01 19:46:57 +00:00
Georg Neis
df35adc763 [bigint] Fix bug in exponentiation.
R=jkummerow@chromium.org

Bug: v8:7505, v8:6791
Change-Id: I11b0031dfafa499a813e3e52080ee5542224799a
Reviewed-on: https://chromium-review.googlesource.com/941130
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51639}
2018-02-28 21:16:15 +00:00
Jakob Kummerow
ddc155d89f [bigint] Add CSA support for Big*64Array stores
Bug: v8:6791
Change-Id: I1423321552e50d9ccb40a94b73f393d6d46fa629
Reviewed-on: https://chromium-review.googlesource.com/927789
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51492}
2018-02-23 02:30:04 +00:00
Jakob Kummerow
3ef16185e4 Reland "[bigint] Implement DataView.{get,set}Big*64"
Originally reviewed at https://chromium-review.googlesource.com/929429
and landed as r51486 / d50c7731e8.

Update in reland: whitelisted new builtins as side effect free.

Bug: v8:6791
Change-Id: Iff45700c8a4eca23f3ee6fc9c0cb340dc027cbc6
Reviewed-on: https://chromium-review.googlesource.com/932802
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51491}
2018-02-23 00:57:38 +00:00
Michael Achenbach
56b4c41b6a Revert "[bigint] Implement DataView.{get,set}Big*64"
This reverts commit d50c7731e8.

Reason for revert: Fails on many bots, like:
https://build.chromium.org/p/client.v8/builders/V8%20Linux/builds/23331

Original change's description:
> [bigint] Implement DataView.{get,set}Big*64
> 
> Bug: v8:6791
> Change-Id: I4b5ad3cf68b5c2423d6e055332d7f0dfce7c1e99
> Reviewed-on: https://chromium-review.googlesource.com/929429
> Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
> Reviewed-by: Georg Neis <neis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#51486}

TBR=jkummerow@chromium.org,neis@chromium.org

Change-Id: I95c260134d7d2671cd4cc0f8c07971af04d97546
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6791
Reviewed-on: https://chromium-review.googlesource.com/932801
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51487}
2018-02-22 21:29:12 +00:00
Jakob Kummerow
d50c7731e8 [bigint] Implement DataView.{get,set}Big*64
Bug: v8:6791
Change-Id: I4b5ad3cf68b5c2423d6e055332d7f0dfce7c1e99
Reviewed-on: https://chromium-review.googlesource.com/929429
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51486}
2018-02-22 20:10:10 +00:00
Jakob Kummerow
bd0b32f545 Reland "[bigint] Add BigInt64Array, BigUint64Array"
This is a reland of dda0419ecd.

Originally reviewed-on: https://chromium-review.googlesource.com/914513
and landed as refs/heads/master@{#51342}.

Bug: v8:6791
Change-Id: I3b3a069da7a0e64c38a81b3110dc5ece4887cb19
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/924665
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51352}
2018-02-19 10:23:18 +00:00
Michael Achenbach
cb7a15fede Revert "[bigint] Add BigInt64Array, BigUint64Array"
This reverts commit dda0419ecd.

Reason for revert: msvc unhappy:
https://build.chromium.org/p/client.v8/builders/V8%20Win64%20-%20msvc/builds/1434

Original change's description:
> [bigint] Add BigInt64Array, BigUint64Array
> 
> Bug: v8:6791
> Tbr: hpayer@chromium.org
> Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
> Change-Id: I637e9084d2fe4869ad0be2fb996149ab9940f346
> Reviewed-on: https://chromium-review.googlesource.com/914513
> Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
> Reviewed-by: Georg Neis <neis@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#51342}

TBR=jkummerow@chromium.org,neis@chromium.org,hpayer@chromium.org

Change-Id: I49237fa323f0d3ea70e744d92d5cbdd4d5c4b39f
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:6791
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Reviewed-on: https://chromium-review.googlesource.com/924663
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51344}
2018-02-17 06:01:31 +00:00
Jakob Kummerow
dda0419ecd [bigint] Add BigInt64Array, BigUint64Array
Bug: v8:6791
Tbr: hpayer@chromium.org
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I637e9084d2fe4869ad0be2fb996149ab9940f346
Reviewed-on: https://chromium-review.googlesource.com/914513
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#51342}
2018-02-17 04:52:29 +00:00
Jakob Kummerow
21532b80c3 [bigint] Remove BigInt.parseInt
which was dropped from the proposal:
https://github.com/tc39/proposal-bigint/pull/101

Bug: v8:6791
Cq-Include-Trybots: luci.v8.try:v8_linux_noi18n_rel_ng
Change-Id: I5a3e0024900b34a322a23bcbc4bfdbdffbf8b9d4
Reviewed-on: https://chromium-review.googlesource.com/885510
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50877}
2018-01-26 02:51:58 +00:00
Georg Neis
26e21fa67a [bigint] Increase maximum length.
In a benchmark that I'm looking at, the numbers quickly overflow our
current limit.

This patch increases kMaxLength to the greatest value that's possible
without requiring further code changes.

Bug: v8:6791
Change-Id: I7a0d126dcd566d536375a294fa4dcf10b8823ed7
Reviewed-on: https://chromium-review.googlesource.com/833876
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Hannes Payer <hpayer@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#50240}
2017-12-20 14:49:48 +00:00
Georg Neis
793dbfd9b9 [bigint,compiler] Fix typed-lowering of JSStrictEqual.
R=jarin@chromium.org

Bug: v8:6791
Change-Id: I9d3787f670d44d68cc2c6474621b6c6a25642e5a
Reviewed-on: https://chromium-review.googlesource.com/803434
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49896}
2017-12-06 14:46:25 +00:00
Jakob Kummerow
b4470ea4cf Reland "[bigint] Fix early-return in asIntN"
For "top digit" (of the result) comparison to be applicable, we must
also check that there are no further digits in the source.

The included regression test flushes out another bug in "TruncateToNBits",
so that gets fixed here too (in contrast to the first landing attempt).

This reverts commit cb9e7af4e5.

Bug: v8:7150
Change-Id: Id631b1ae79e60b8e85ed4667e246a64c46765f2b
Reviewed-on: https://chromium-review.googlesource.com/807348
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49877}
2017-12-05 17:31:58 +00:00
Michael Achenbach
cb9e7af4e5 Revert "[bigint] Fix early-return in asIntN"
This reverts commit e110b59cc7.

Reason for revert: Breaks arm debug on chromebook hardware:
https://build.chromium.org/p/client.v8.ports/builders/V8%20Arm%20-%20debug/builds/5335

Original change's description:
> [bigint] Fix early-return in asIntN
> 
> For "top digit" (of the result) comparison to be applicable, we must
> also check that there are no further digits in the source.
> 
> Bug: v8:7150
> Change-Id: I6ad317f6f600e11fef59b9907da1055e5586a3a8
> Reviewed-on: https://chromium-review.googlesource.com/804639
> Reviewed-by: Georg Neis <neis@chromium.org>
> Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#49846}

TBR=jkummerow@chromium.org,neis@chromium.org

Change-Id: I5dae82696d3ecb9602f73a2ff4760ed7bbcef1c5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: v8:7150
Reviewed-on: https://chromium-review.googlesource.com/806838
Reviewed-by: Michael Achenbach <machenbach@chromium.org>
Commit-Queue: Michael Achenbach <machenbach@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49847}
2017-12-04 22:07:17 +00:00
Jakob Kummerow
e110b59cc7 [bigint] Fix early-return in asIntN
For "top digit" (of the result) comparison to be applicable, we must
also check that there are no further digits in the source.

Bug: v8:7150
Change-Id: I6ad317f6f600e11fef59b9907da1055e5586a3a8
Reviewed-on: https://chromium-review.googlesource.com/804639
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49846}
2017-12-04 20:31:19 +00:00
Georg Neis
a68831281a [bigint] Remove --no-opt flag from various mjsunit tests.
These now pass even when forcing optimization.

TBR=jkummerow@chromium.org

Bug: v8:6791
Change-Id: I4d7c7d37b48e6e970d33474fa7fd637e34b0bda0
Reviewed-on: https://chromium-review.googlesource.com/803374
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49781}
2017-12-01 10:27:14 +00:00
Georg Neis
faffab96a2 [bigint,compiler] Add tests for Turbofan.
Bug: v8:6791
Change-Id: I1c57fc697dc143fec8bfd67db16c7bc4f840462d
Reviewed-on: https://chromium-review.googlesource.com/800620
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49777}
2017-12-01 07:48:44 +00:00
Georg Neis
dd54b5b008 [bigint,compiler] Adapt TruncatePointerTaggedToBit.
It reflects the semantics of ToBoolean, so it must be adapted for
bigints.

Bug: v8:6791
Change-Id: I18931df21528463dacf5ad50fa8264b1c968c6b5
Reviewed-on: https://chromium-review.googlesource.com/799831
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49776}
2017-12-01 07:00:54 +00:00
Jakob Kummerow
d84efe121b [bigint] Implement BigInt::Exponentiate
Bug: v8:6791
Change-Id: I976876a4956b5c65f6f3788389f42d394d08dc99
Reviewed-on: https://chromium-review.googlesource.com/788513
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49773}
2017-12-01 00:38:28 +00:00
Georg Neis
ac2394bb97 [bigint,compiler] Remove reduction of Number(x) to ToNumber(x).
In the presence of bigints, this optimization is no longer valid.

Bug: v8:6791
Change-Id: I996ac78f8ae4aef5494dd0089374d04c6db6e72f
Reviewed-on: https://chromium-review.googlesource.com/796070
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49725}
2017-11-29 18:28:03 +00:00
Jakob Kummerow
6dee1ac188 [bigint] Fix asIntN/asUintN for n == kMaxLengthBits
And also ensure that it doesn't allocate when that's avoidable.

Bug: v8:6791
Change-Id: Ied2d2c9c5718aed9839f17739d743353cbadee88
Reviewed-on: https://chromium-review.googlesource.com/786170
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49683}
2017-11-28 17:18:26 +00:00
Jakob Kummerow
b5997de8a9 [bigint] Fix accidental input modification in Divide
"AbsoluteDivSmall" had a shortcut path for abs(divisor) == 1 where
it would simply return the dividend as result. However, its caller
"Divide" was blissfully ignorant of this trick and would therefore
simply set the value's sign as needed, modifying the input.
This CL prevents that, while continuing to avoid the full division
algorithm for abs(divisor) == 1.

Bug: v8:6791
Change-Id: I04cdc93f5ed2a696587c35c754e68f07012dd1a9
Reviewed-on: https://chromium-review.googlesource.com/772332
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49433}
2017-11-17 01:50:50 +00:00
Adam Klein
ead5abac9d [bigint] Correct StringToBigInt radix and junk handling
Fix two more places where StringToBigInt differs from parseInt:
  - Binary and octal radix prefixes are supported
  - Trailing non-whitespace junk is not allowed

This is done with a new Behavior enum in BigIntParseIntHelper,
along with a couple of bool configuration flags in StringToIntHelper.

Bug: v8:6791, v8:7038
Change-Id: Ib91bfc5ccb04ad0dd6c99bc81e19c1239264a469
Reviewed-on: https://chromium-review.googlesource.com/764595
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49335}
2017-11-13 18:55:00 +00:00
Georg Neis
55062ced0b [bigint] Implement BigInt.asIntN.
Bug: v8:6791
Change-Id: I10f8c6c88c534ee1e3c893176b6563af0c9f99d3
Reviewed-on: https://chromium-review.googlesource.com/753904
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49180}
2017-11-07 11:47:50 +00:00
Georg Neis
c961986ec6 [bigint] Fix typeof.
The bytecode generator has special handling for comparing the result of
the typeof operator against a string literal. This needs to be adapted
for bigints.

R=jkummerow@chromium.org, mythrie@chromium.org

Bug: v8:6791
Change-Id: I42d6c9e9225ce05e19393f10e01ae496ecb70c9c
Reviewed-on: https://chromium-review.googlesource.com/753465
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Mythri Alle <mythria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49172}
2017-11-07 10:06:54 +00:00
Georg Neis
7a54652591 [bigint] Implement BigInt constructor.
Actually all it does is throw a TypeError.

R=jkummerow@chromium.org

Bug: v8:6791
Change-Id: I884da4eaa937519c07c3516a1713829f52e28ad8
Reviewed-on: https://chromium-review.googlesource.com/753730
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49171}
2017-11-07 09:27:24 +00:00
Georg Neis
6414e17db0 [bigint] Implement Bigint.asUintN.
R=jkummerow@chromium.org

Bug: v8:6791
Change-Id: I765790d8b163aff6725900f19e95a914c75a0fe9
Reviewed-on: https://chromium-review.googlesource.com/752521
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49132}
2017-11-06 09:53:14 +00:00
Georg Neis
8cf319fec8 [bigint] Make ToBigInt throw the correct error.
We must throw a SyntaxError only when failing to convert a string. In
the other cases we must throw a TypeError.

R=jkummerow@chromium.org

Bug: v8:6791
Change-Id: I802d8b6830b341f87e46e7de198af74ba95b8658
Reviewed-on: https://chromium-review.googlesource.com/752803
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49131}
2017-11-06 09:04:23 +00:00
Adam Klein
61fefb19b7 [bigint] Restrict the length of literals in the scanner
The parser now throws for literals that are too big for the runtime
to support, thus avoiding CHECK-failures further down the line.

Tbr: rmcilroy@chromium.org
Bug: v8:6791
Change-Id: Ie45ddebb8aa9e7a30e8b6b74f99916b700e38e4a
Reviewed-on: https://chromium-review.googlesource.com/747682
Commit-Queue: Adam Klein <adamk@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49059}
2017-10-31 22:14:14 +00:00
Jakob Kummerow
3286cf763b [bigint] Adapt Number() to convert BigInts
Bug: v8:6791
Change-Id: Id85bd701eaa574eea1335cdc916323810616cef9
Reviewed-on: https://chromium-review.googlesource.com/738936
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Benedikt Meurer <bmeurer@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49014}
2017-10-28 01:59:32 +00:00
Georg Neis
03035038b9 [bigint] Implement ToBigInt and NumberToBigInt.
... and use them to complete the BigInt function.

Bug: v8:6791
Change-Id: Ia36db86b92d1a0cfcb783516e04d6c0e3750f194
Reviewed-on: https://chromium-review.googlesource.com/737643
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48993}
2017-10-27 06:43:57 +00:00
Jakob Kummerow
3942370c39 [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}
2017-10-27 05:51:23 +00:00
Georg Neis
401b39b1dd [bigint] Install Symbol.toStringTag and adapt O.p.toString.
Bug: v8:6791
Change-Id: I10bb316284ba3a0e326daad4f9b995f88d76c2a2
Reviewed-on: https://chromium-review.googlesource.com/739501
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48982}
2017-10-26 17:37:26 +00:00
Georg Neis
9dbea83609 [bigint] Add a test for Bigint.prototype.valueOf.
We can already construct wrapper objects using Object().

R=jkummerow@chromium.org

Bug: v8:6791
Change-Id: Ic4079654ef1fcae2be4b588cb12c2645e199f4f7
Reviewed-on: https://chromium-review.googlesource.com/738089
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48955}
2017-10-26 08:40:18 +00:00
Jakob Kummerow
98df94cdd4 [bigint] Fix abstract equality with junk strings
Abstract equality comparison of a BigInt and a String converts the
latter to BigInt. This conversion can fail; since we do not want to
pass a context to the comparison function, we must signal such failure
without throwing an exception.
This CL uses the existing ShouldThrow enum to configure behavior of
String-to-BigInt conversion, moving it out of Object into globals.h.

Bug: v8:6791, v8:6979
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: Ibb98675079b8392cf03bbcbbbd5556108500a32d
Reviewed-on: https://chromium-review.googlesource.com/734172
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48946}
2017-10-25 20:56:09 +00:00
Jakob Kummerow
9daf3e2039 [cleanup] Limit Token usage to Parser, AST, BytecodeGenerator
and use a newly-introduced "enum class Operation" in all
other places that so far passed Token::Values around.
Also delete some related dead code along the way.

Bug: v8:6921
Change-Id: I062f396d304aa62298cfeff202e3132a4a5597c1
Reviewed-on: https://chromium-review.googlesource.com/736851
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Michael Starzinger <mstarzinger@chromium.org>
Reviewed-by: Adam Klein <adamk@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48944}
2017-10-25 18:15:26 +00:00
Jakob Kummerow
6f1c3b785d [bigint] Fix RightShift by 32
Bug: v8:6791
Change-Id: I9c1ebddfab9f3d73642e61e43c3fbfd739efd56c
Reviewed-on: https://chromium-review.googlesource.com/736722
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48942}
2017-10-25 18:03:18 +00:00
Georg Neis
d8fbe426fe [bigint] Adapt JSON.stringify.
Bug: v8:6791
Change-Id: Id34db2021c02b885be3f300648d5941362381d0b
Reviewed-on: https://chromium-review.googlesource.com/735561
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48896}
2017-10-25 07:13:47 +00:00
Georg Neis
dabf6003c9 [bigint] Support <, <=, >, >=.
... mainly by adapting Object::Compare and
CodeStubAssembler::RelationalComparison.

TBR=rmcilroy@chromium.org

Change-Id: I34448d45b4950b9318263c4a667aa9db7d77232d
Bug: v8:6791
Reviewed-on: https://chromium-review.googlesource.com/730730
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48873}
2017-10-24 11:46:38 +00:00
Georg Neis
bb6bee3255 [bigint] Add tests for ToObject.
R=jkummerow@chromium.org

Bug: v8:6791
Change-Id: I2e9876577103d72cd5e2412e958b4bd832373899
Reviewed-on: https://chromium-review.googlesource.com/733132
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48864}
2017-10-24 09:14:56 +00:00
Georg Neis
4d932032ee [bigint] Add tests for ToPropertyKey.
Bug: v8:6791
Change-Id: Ieb53b68e062e94e2d98a65db7b8bc6f61708b05f
Reviewed-on: https://chromium-review.googlesource.com/733098
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48863}
2017-10-24 09:12:16 +00:00
Jakob Kummerow
eff7f32114 [bigint] Add tests for unary/binary ops
The tests are generated randomly, using Python's arbitrary-precision
integers as the source of truth.
The generator script is landed as part of this CL. It also supports
a "stress test" mode for on-demand intensive test coverage.

Bug: v8:6791
Change-Id: Idc7a2e90fd8a0a8176283614b33ecd4c3597b1d1
Reviewed-on: https://chromium-review.googlesource.com/731464
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48844}
2017-10-23 19:11:01 +00:00
Jakob Kummerow
9ffe0670d3 [bigint] Fix StringToBigInt("") to return 0n.
Whitespace-only strings count as empty too.

This behavior is different from BigInt.parseInt(""),
which throws a SyntaxError.

Bug: v8:6791, v8:6957
Change-Id: I6671c803f3ba83e23c3e0cad81d3af29dba61c9f
Reviewed-on: https://chromium-review.googlesource.com/727301
Reviewed-by: Georg Neis <neis@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48797}
2017-10-20 17:00:41 +00:00
Georg Neis
e5dafc0688 [bigint] Adapt abstract equality.
This adds BigInt support to JavaScript's abstract equality (== and !=),
implemented mainly via CodeStubAssembler::Equal and via Object::Equals.

Bug: v8:6791
Change-Id: I53219f2f71baa760b142cc676f18931731b87226
Reviewed-on: https://chromium-review.googlesource.com/725701
Commit-Queue: Georg Neis <neis@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48730}
2017-10-19 09:22:41 +00:00
Jakob Kummerow
6627b0aaf7 [bigint] Call NonNumberToNumeric where applicable
This supports {valueOf() { return BigInt(...) }} objects as
operands in binary and unary operations.

Bug: v8:6791
Change-Id: I30ec9983ff611477742f9ea0bc6d04972fe21d3c
Reviewed-on: https://chromium-review.googlesource.com/716863
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Reviewed-by: Georg Neis <neis@chromium.org>
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Cr-Commit-Position: refs/heads/master@{#48612}
2017-10-16 18:53:19 +00:00