[ESNext][BigInt] Implement support for addition operations
authorticaiolima@gmail.com <ticaiolima@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Jun 2018 02:22:45 +0000 (02:22 +0000)
committerticaiolima@gmail.com <ticaiolima@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 3 Jun 2018 02:22:45 +0000 (02:22 +0000)
commit1debac99b4f4d21e5dc8d914f502d871848ed034
tree2cbac0d763de919b56718769e3908b4d91012a05
parent6ae4328d7a9b8c5631c4984be2ca49be42539893
[ESNext][BigInt] Implement support for addition operations
https://bugs.webkit.org/show_bug.cgi?id=179002

Reviewed by Yusuke Suzuki.

JSTests:

* bigIntTests.yaml:
* stress/addition-order-evaluation.js: Added.
* stress/big-int-add-wrapped-value.js: Added.
* stress/big-int-addition-basic.js: Added.
* stress/big-int-addition-jit.js: Added.
* stress/big-int-addition-memory-stress.js: Added.
* stress/big-int-addition-string-coercion.js: Added.
* stress/big-int-addition-to-primitive-precedence.js: Added.
* stress/big-int-addition-to-primitive.js: Added.
* stress/big-int-addition-type-error.js: Added.
* stress/big-int-no-conversion-to-number.js:
* stress/big-int-sub-wrapped-value.js: Added.
* stress/big-int-subtraction-basic.js: Added.
* stress/big-int-subtraction-jit.js: Added.
* stress/big-int-subtraction-type-error.js: Added.
* stress/sub-order-evaluation.js: Added.

Source/JavaScriptCore:

This patch is implementing support to BigInt Operands into binary "+"
and binary "-" operators. Right now, we have limited support to DFG
and FTL JIT layers, but we plan to fix this support in future
patches.

* jit/JITOperations.cpp:
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/JSBigInt.cpp:
(JSC::JSBigInt::parseInt):
(JSC::JSBigInt::stringToBigInt):
(JSC::JSBigInt::toString):
(JSC::JSBigInt::multiply):
(JSC::JSBigInt::divide):
(JSC::JSBigInt::remainder):
(JSC::JSBigInt::add):
(JSC::JSBigInt::sub):
(JSC::JSBigInt::absoluteAdd):
(JSC::JSBigInt::absoluteSub):
(JSC::JSBigInt::toStringGeneric):
(JSC::JSBigInt::allocateFor):
(JSC::JSBigInt::toNumber const):
(JSC::JSBigInt::getPrimitiveNumber const):
* runtime/JSBigInt.h:
* runtime/JSCJSValueInlines.h:
* runtime/Operations.cpp:
(JSC::jsAddSlowCase):
* runtime/Operations.h:
(JSC::jsSub):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232449 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
JSTests/ChangeLog
JSTests/bigIntTests.yaml
JSTests/stress/addition-order-evaluation.js [new file with mode: 0644]
JSTests/stress/big-int-add-wrapped-value.js [new file with mode: 0644]
JSTests/stress/big-int-addition-basic.js [new file with mode: 0644]
JSTests/stress/big-int-addition-jit.js [new file with mode: 0644]
JSTests/stress/big-int-addition-memory-stress.js [new file with mode: 0644]
JSTests/stress/big-int-addition-string-coercion.js [new file with mode: 0644]
JSTests/stress/big-int-addition-to-primitive-precedence.js [new file with mode: 0644]
JSTests/stress/big-int-addition-to-primitive.js [new file with mode: 0644]
JSTests/stress/big-int-addition-type-error.js [new file with mode: 0644]
JSTests/stress/big-int-no-conversion-to-number.js
JSTests/stress/big-int-sub-wrapped-value.js [new file with mode: 0644]
JSTests/stress/big-int-subtraction-basic.js [new file with mode: 0644]
JSTests/stress/big-int-subtraction-jit.js [new file with mode: 0644]
JSTests/stress/big-int-subtraction-type-error.js [new file with mode: 0644]
JSTests/stress/sub-order-evaluation.js [new file with mode: 0644]
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/jit/JITOperations.cpp
Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
Source/JavaScriptCore/runtime/JSBigInt.cpp
Source/JavaScriptCore/runtime/JSBigInt.h
Source/JavaScriptCore/runtime/JSCJSValueInlines.h
Source/JavaScriptCore/runtime/Operations.cpp
Source/JavaScriptCore/runtime/Operations.h