[ESNext][BigInt] Implement support for addition operations
authorticaiolima@gmail.com <ticaiolima@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Jun 2018 16:03:51 +0000 (16:03 +0000)
committerticaiolima@gmail.com <ticaiolima@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Jun 2018 16:03:51 +0000 (16:03 +0000)
commit9dc6046da44e594eeeaecbe1b5fc9bb571261373
treeffee5c6fbb0bc4164811eec3030bb9ec9aacc252
parent4cd317613402a5784d5a881734f6a672c5d630d9
[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@232439 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