12018-10-17 Caio Lima <ticaiolima@gmail.com>
2
3 [BigInt] Add support to BigInt into ValueAdd
4 https://bugs.webkit.org/show_bug.cgi?id=186177
5
6 Reviewed by NOBODY (OOPS!).
7
8 We are adding a very primitive specialization case of BigInts into ValueAdd.
9 When compiling a speculated version of this node to BigInt, we are currently
10 calling 'operationAddBigInt', a function that expects only BigInts as
11 parameter and effectly add numbers using JSBigInt::add. To properly
12 speculate BigInt operands, we changed ArithProfile to observe when
13 its result is a BigInt. With this new observation, we are able to identify
14 when ValueAdd results into a String or BigInt.
15
16 Here are some numbers for this specialization running
17 microbenchmarks:
18
19 big-int-simple-add 21.5411+-1.1096 ^ 15.3502+-0.7027 ^ definitely 1.4033x faster
20 big-int-add-prediction-propagation 13.7762+-0.5578 ^ 10.8117+-0.5330 ^ definitely 1.2742x faster
21
22 * bytecode/ArithProfile.cpp:
23 (JSC::ArithProfile::emitObserveResult):
24 (JSC::ArithProfile::shouldEmitSetBigInt const):
25 (JSC::ArithProfile::emitSetBigInt const):
26 (WTF::printInternal):
27 * bytecode/ArithProfile.h:
28 (JSC::ArithProfile::didObserveBigInt const):
29 (JSC::ArithProfile::setObservedBigInt):
30 (JSC::ArithProfile::observeResult):
31 * dfg/DFGAbstractInterpreterInlines.h:
32 (JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
33 * dfg/DFGByteCodeParser.cpp:
34 (JSC::DFG::ByteCodeParser::makeSafe):
35 * dfg/DFGFixupPhase.cpp:
36 (JSC::DFG::FixupPhase::fixupNode):
37 * dfg/DFGNode.h:
38 (JSC::DFG::Node::mayHaveBigIntResult):
39 * dfg/DFGNodeFlags.cpp:
40 (JSC::DFG::dumpNodeFlags):
41 * dfg/DFGNodeFlags.h:
42 * dfg/DFGOperations.cpp:
43 * dfg/DFGOperations.h:
44 * dfg/DFGPredictionPropagationPhase.cpp:
45 * dfg/DFGSpeculativeJIT.cpp:
46 (JSC::DFG::SpeculativeJIT::compileValueAdd):
47 * ftl/FTLLowerDFGToB3.cpp:
48 (JSC::FTL::DFG::LowerDFGToB3::compileValueAdd):
49 * llint/LLIntData.cpp:
50 (JSC::LLInt::Data::performAssertions):
51 * llint/LowLevelInterpreter.asm:
52 * runtime/CommonSlowPaths.cpp:
53 (JSC::updateArithProfileForUnaryArithOp):
54 (JSC::updateArithProfileForBinaryArithOp):
55