commit | 41b3fb79b44a29872ae0f4de7c160521e1a0e1e9 | [log] [tgz] |
---|---|---|
author | ticaiolima@gmail.com <ticaiolima@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Mon Mar 11 17:21:41 2019 +0000 |
committer | ticaiolima@gmail.com <ticaiolima@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc> | Mon Mar 11 17:21:41 2019 +0000 |
tree | 8eeaf02de161fc1a59b282174651072587dbaef6 | |
parent | bb6dc16d3b338c77a1dc0c6c2ed68311713592e1 [diff] |
[ESNext][BigInt] Implement "~" unary operation https://bugs.webkit.org/show_bug.cgi?id=182216 Reviewed by Keith Miller. JSTests: * stress/big-int-bit-not-general.js: Added. * stress/big-int-bitwise-not-jit.js: Added. * stress/big-int-bitwise-not-wrapped-value.js: Added. * stress/bit-op-with-object-returning-int32.js: * stress/bitwise-not-fixup-rules.js: Added. * stress/value-bit-not-ai-rule.js: Added. PerformanceTests: * BigIntBench/big-int-simple-bit-not.js: Added. Source/JavaScriptCore: This patch is adding support of BigInt into op_bitnot operations. In addition, we are changing ArithBitNot to handle only Number operands, while introducing a new node named ValueBitNot to handle Untyped and BigInt. This node follows the same approach we are doing into other arithimetic operations into DFG. * dfg/DFGAbstractInterpreterInlines.h: (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects): It is possible that fixup and prediction propagation don't convert a ValueBitNot(ConstInt32) into ArithBitNot(ConstInt32) because these analysis are conservative. In such case, we are adding constant folding rules to ValueBitNot AI. * dfg/DFGBackwardsPropagationPhase.cpp: (JSC::DFG::BackwardsPropagationPhase::propagate): ValueBitNot has same rules as ArithBitNot on backwards propagation. * dfg/DFGByteCodeParser.cpp: (JSC::DFG::ByteCodeParser::parseBlock): We can emit ArithBitNot if we know that operand of op_bitnot is a Number or any int. Otherwise we fallback to ValueBitNot and rely on fixup to convert the node to ArithBitNot when it is possible. ValueBitNot uses heap prediction on prediction propagation and we collect its type from op_bitnot's value profiler. * dfg/DFGClobberize.h: (JSC::DFG::clobberize): When we have the case with ValueBitNot(BigInt), we don't clobberize world. * dfg/DFGDoesGC.cpp: (JSC::DFG::doesGC): ValueBitNot can GC on BigIntUse because, right now, all bitNot operation allocates temporary BigInts to perform calculations and it can potentially trigger GC. * dfg/DFGFixupPhase.cpp: (JSC::DFG::FixupPhase::fixupNode): ValueBitNot is responsible do handle BigIntUse and UntypedUse. To all other uses, we fallback to ArithBitNot. * dfg/DFGNode.h: (JSC::DFG::Node::hasHeapPrediction): * dfg/DFGNodeType.h: * dfg/DFGOperations.cpp: (JSC::DFG::bitwiseBinaryOp): This template function is abstracting the new semantics of numeric values operations on bitwise operations. These operations usually folow these steps: 1. rhsNumeric = GetInt32OrBigInt(rhs) 2. lhsNumeric = GetInt32OrBigInt(lhs) 3. trhow error if TypeOf(rhsNumeric) != TypeOf(lhsNumeric) 4. return BigInt::bitwiseOp(bitOp, rhs, lhs) if TypeOf(lhsNumeric) == BigInt 5. return rhs <int32BitOp> lhs Since we have almost the same code for every bitwise op, we use such template to avoid code duplication. The template receives Int32 and BigInt operations as parameter. Error message is received as `const char*` instead of `String&` to avoid String allocation even when there is no error to throw. * dfg/DFGOperations.h: * dfg/DFGPredictionPropagationPhase.cpp: * dfg/DFGSafeToExecute.h: (JSC::DFG::safeToExecute): * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileValueBitNot): ValueBitNot generates speculative code for BigIntUse and this code is a call to `operationBitNotBigInt`. This operation is faster than `operationValueBitNot` because there is no need to check types of operands and execute properly operation. We still need to check exceptions after `operationBitNotBigInt` because it can throw OOM. (JSC::DFG::SpeculativeJIT::compileBitwiseNot): * dfg/DFGSpeculativeJIT.h: * dfg/DFGSpeculativeJIT32_64.cpp: (JSC::DFG::SpeculativeJIT::compile): * dfg/DFGSpeculativeJIT64.cpp: (JSC::DFG::SpeculativeJIT::compile): * ftl/FTLCapabilities.cpp: (JSC::FTL::canCompile): * ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileNode): (JSC::FTL::DFG::LowerDFGToB3::compileValueBitNot): (JSC::FTL::DFG::LowerDFGToB3::compileArithBitNot): * runtime/CommonSlowPaths.cpp: (JSC::SLOW_PATH_DECL): * runtime/JSBigInt.cpp: (JSC::JSBigInt::bitwiseNot): * runtime/JSBigInt.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@242715 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit is a cross-platform web browser engine. On iOS and macOS, it powers Safari, Mail, iBooks, and many other applications.
Visit WebKit Feature Status page to see which Web API has been implemented, in development, or under consideration.
On macOS, download Safari Technology Preview to test the latest version of WebKit. On Linux, download Epiphany Technology Preview. On Windows, you'll have to build it yourself.
Once your bug is filed, you will receive email when it is updated at each stage in the bug life cycle. After the bug is considered fixed, you may be asked to download the latest nightly and confirm that the fix works for you.
On Windows, follow the instructions on our website.
Run the following command to clone WebKit's Git SVN repository:
git clone git://git.webkit.org/WebKit.git WebKit
or
git clone https://git.webkit.org/git/WebKit.git WebKit
If you want to be able to commit changes to the repository, or just want to check out branches that aren’t contained in WebKit.git, you will need track WebKit's Subversion repository. You can run the following command to configure this and other options of the new Git clone for WebKit development.
Tools/Scripts/webkit-patch setup-git-clone
For information about this, and other aspects of using Git with WebKit, read the wiki page.
If you don‘t want to use Git, run the following command to check out WebKit’s Subversion repository:
svn checkout https://svn.webkit.org/repository/webkit/trunk WebKit
Install Xcode and its command line tools if you haven't done so already:
xcode-select --install
Run the following command to build a debug build with debugging symbols and assertions:
Tools/Scripts/build-webkit --debug
For performance testing, and other purposes, use --release
instead.
You can open WebKit.xcworkspace
to build and debug WebKit within Xcode.
If you don't use a custom build location in Xcode preferences, you have to update the workspace settings to use WebKitBuild
directory. In menu bar, choose File > Workspace Settings, then click the Advanced button, select “Custom”, “Relative to Workspace”, and enter WebKitBuild
for both Products and Intermediates.
The first time after you install a new Xcode, you will need to run the following command to enable Xcode to build command line tools for iOS Simulator:
sudo Tools/Scripts/configure-xcode-for-ios-development
Without this step, you will see the error message: “target specifies product type ‘com.apple.product-type.tool’, but there’s no such product type for the ‘iphonesimulator’ platform.
” when building target JSCLLIntOffsetsExtractor
of project JavaScriptCore
.
Run the following command to build a debug build with debugging symbols and assertions for iOS:
Tools/Scripts/build-webkit --debug --ios-simulator
For production builds:
cmake -DPORT=GTK -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/gtk/install-dependencies Tools/Scripts/update-webkitgtk-libs Tools/Scripts/build-webkit --gtk --debug
For more information on building WebKitGTK+, see the wiki page.
For production builds:
cmake -DPORT=WPE -DCMAKE_BUILD_TYPE=RelWithDebInfo -GNinja ninja sudo ninja install
For development builds:
Tools/wpe/install-dependencies Tools/Scripts/update-webkitwpe-libs Tools/Scripts/build-webkit --wpe --debug
For building WebKit on Windows, see the wiki page.
Run the following command to launch Safari with your local build of WebKit:
Tools/Scripts/run-safari --debug
The run-safari
script sets the DYLD_FRAMEWORK_PATH
environment variable to point to your build products, and then launches /Applications/Safari.app
. DYLD_FRAMEWORK_PATH
tells the system loader to prefer your build products over the frameworks installed in /System/Library/Frameworks
.
To run other applications with your local build of WebKit, run the following command:
Tools/Scripts/run-webkit-app <application-path>
Run the following command to launch iOS simulator with your local build of WebKit:
run-safari --debug --ios-simulator
In both cases, if you have built release builds instead, use --release
instead of --debug
.
If you have a development build, you can use the run-minibrowser script, e.g.:
run-minibrowser --debug --wpe
Pass one of --gtk
, --jsc-only
, or --wpe
to indicate the port to use.
Congratulations! You’re up and running. Now you can begin coding in WebKit and contribute your fixes and new features to the project. For details on submitting your code to the project, read Contributing Code.