Source/JavaScriptCore/ChangeLog

 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
1562018-10-16 Mark Lam <mark.lam@apple.com>
257
358 GetIndexedPropertyStorage can GC.

Source/JavaScriptCore/bytecode/ArithProfile.cpp

@@namespace JSC {
3434#if ENABLE(JIT)
3535void ArithProfile::emitObserveResult(CCallHelpers& jit, JSValueRegs regs, TagRegistersMode mode)
3636{
37  if (!shouldEmitSetDouble() && !shouldEmitSetNonNumber())
 37 if (!shouldEmitSetDouble() && !shouldEmitSetNonNumber() && !shouldEmitSetBigInt())
3838 return;
3939
 40 CCallHelpers::JumpList done;
4041 CCallHelpers::Jump isInt32 = jit.branchIfInt32(regs, mode);
4142 CCallHelpers::Jump notDouble = jit.branchIfNotDoubleKnownNotInt32(regs, mode);
4243 emitSetDouble(jit);
43  CCallHelpers::Jump done = jit.jump();
 44 done.append(jit.jump());
 45
4446 notDouble.link(&jit);
 47 CCallHelpers::Jump notBigInt = jit.branchIfNotBigInt(regs.payloadGPR());
 48 emitSetBigInt(jit);
 49 done.append(jit.jump());
 50
 51 notBigInt.link(&jit);
4552 emitSetNonNumber(jit);
 53
4654 done.link(&jit);
4755 isInt32.link(&jit);
4856}

@@bool ArithProfile::shouldEmitSetNonNumber() const
6573 return (m_bits & mask) != mask;
6674}
6775
 76bool ArithProfile::shouldEmitSetBigInt() const
 77{
 78 uint32_t mask = ArithProfile::BigInt;
 79 return (m_bits & mask) != mask;
 80}
 81
6882void ArithProfile::emitSetNonNumber(CCallHelpers& jit) const
6983{
7084 if (shouldEmitSetNonNumber())
7185 jit.or32(CCallHelpers::TrustedImm32(ArithProfile::NonNumber), CCallHelpers::AbsoluteAddress(addressOfBits()));
7286}
 87
 88void ArithProfile::emitSetBigInt(CCallHelpers& jit) const
 89{
 90 if (shouldEmitSetBigInt())
 91 jit.or32(CCallHelpers::TrustedImm32(ArithProfile::BigInt), CCallHelpers::AbsoluteAddress(addressOfBits()));
 92}
7393#endif // ENABLE(JIT)
7494
7595} // namespace JSC

@@void printInternal(PrintStream& out, const ArithProfile& profile)
107127 out.print(separator, "Int52Overflow");
108128 separator = "|";
109129 }
 130 if (profile.didObserveBigInt()) {
 131 out.print(separator, "BigInt");
 132 separator = "|";
 133 }
110134 }
111135 if (profile.tookSpecialFastPath())
112136 out.print(separator, "Took special fast path.");

Source/JavaScriptCore/bytecode/ArithProfile.h

@@private:
6868
6969struct ArithProfile {
7070private:
71  static const uint32_t numberOfFlagBits = 5;
 71 static const uint32_t numberOfFlagBits = 6;
7272 static const uint32_t rhsResultTypeShift = numberOfFlagBits;
7373 static const uint32_t lhsResultTypeShift = rhsResultTypeShift + ResultType::numBitsNeeded;
7474 static const uint32_t rhsObservedTypeShift = lhsResultTypeShift + ResultType::numBitsNeeded;

@@public:
117117 NonNumber = 1 << 2,
118118 Int32Overflow = 1 << 3,
119119 Int52Overflow = 1 << 4,
 120 BigInt = 1 << 5,
120121 };
121122
122123 ResultType lhsResultType() const { return ResultType((m_bits >> lhsResultTypeShift) & resultTypeMask); }

@@public:
149150 bool didObserveNonNegZeroDouble() const { return hasBits(NonNegZeroDouble); }
150151 bool didObserveNegZeroDouble() const { return hasBits(NegZeroDouble); }
151152 bool didObserveNonNumber() const { return hasBits(NonNumber); }
 153 bool didObserveBigInt() const { return hasBits(BigInt); }
152154 bool didObserveInt32Overflow() const { return hasBits(Int32Overflow); }
153155 bool didObserveInt52Overflow() const { return hasBits(Int52Overflow); }
154156
155157 void setObservedNonNegZeroDouble() { setBit(NonNegZeroDouble); }
156158 void setObservedNegZeroDouble() { setBit(NegZeroDouble); }
157159 void setObservedNonNumber() { setBit(NonNumber); }
 160 void setObservedBigInt() { setBit(BigInt); }
158161 void setObservedInt32Overflow() { setBit(Int32Overflow); }
159162 void setObservedInt52Overflow() { setBit(Int52Overflow); }
160163

@@public:
168171 m_bits |= Int32Overflow | Int52Overflow | NonNegZeroDouble | NegZeroDouble;
169172 return;
170173 }
 174 if (value && value.isBigInt()) {
 175 m_bits |= BigInt;
 176 return;
 177 }
171178 m_bits |= NonNumber;
172179 }
173180

@@public:
220227 // Sets NonNumber.
221228 void emitSetNonNumber(CCallHelpers&) const;
222229 bool shouldEmitSetNonNumber() const;
 230
 231 // Sets BigInt
 232 void emitSetBigInt(CCallHelpers&) const;
 233 bool shouldEmitSetBigInt() const;
223234#endif // ENABLE(JIT)
224235
225236 uint32_t bits() const { return m_bits; }

Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h

@@bool AbstractInterpreter<AbstractStateType>::executeEffects(unsigned clobberLimi
591591 }
592592
593593 case ValueAdd: {
594  ASSERT(node->binaryUseKind() == UntypedUse);
 594 ASSERT(node->binaryUseKind() == UntypedUse || node->binaryUseKind() == BigIntUse);
595595 clobberWorld();
596  setTypeForNode(node, SpecString | SpecBytecodeNumber);
 596 if (node->binaryUseKind() == BigIntUse)
 597 setTypeForNode(node, SpecBigInt);
 598 else
 599 setTypeForNode(node, SpecString | SpecBytecodeNumber | SpecBigInt);
597600 break;
598601 }
599602

Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp

@@private:
922922 node->mergeFlags(NodeMayHaveDoubleResult);
923923 if (arithProfile->didObserveNonNumber())
924924 node->mergeFlags(NodeMayHaveNonNumberResult);
 925 if (arithProfile->didObserveBigInt())
 926 node->mergeFlags(NodeMayHaveBigIntResult);
925927 break;
926928
927929 case ArithMul: {

Source/JavaScriptCore/dfg/DFGFixupPhase.cpp

@@private:
256256 }
257257 }
258258
259  fixEdge<UntypedUse>(child1);
260  fixEdge<UntypedUse>(child2);
 259 if (Node::shouldSpeculateBigInt(child1.node(), child2.node())) {
 260 fixEdge<BigIntUse>(child1);
 261 fixEdge<BigIntUse>(child2);
 262 } else {
 263 fixEdge<UntypedUse>(child1);
 264 fixEdge<UntypedUse>(child2);
 265 }
 266
261267 node->setResult(NodeResultJS);
262268 break;
263269 }

Source/JavaScriptCore/dfg/DFGNode.h

@@public:
11491149 return m_flags & NodeMayHaveNonNumberResult;
11501150 }
11511151
 1152 bool mayHaveBigIntResult()
 1153 {
 1154 return m_flags & NodeMayHaveBigIntResult;
 1155 }
 1156
11521157 bool hasNewArrayBufferData()
11531158 {
11541159 return op() == NewArrayBuffer || op() == PhantomNewArrayBuffer;

Source/JavaScriptCore/dfg/DFGNodeFlags.cpp

@@void dumpNodeFlags(PrintStream& actualOut, NodeFlags flags)
8888 if (flags & NodeMayHaveDoubleResult)
8989 out.print(comma, "MayHaveDoubleResult");
9090
 91 if (flags & NodeMayHaveBigIntResult)
 92 out.print(comma, "MayHaveBigIntResult");
 93
9194 if (flags & NodeMayHaveNonNumberResult)
9295 out.print(comma, "MayHaveNonNumberResult");
9396

Source/JavaScriptCore/dfg/DFGNodeFlags.h

@@namespace JSC { namespace DFG {
7272#define NodeMiscFlag1 0x40000
7373#define NodeMiscFlag2 0x80000
7474
 75#define NodeMayHaveBigIntResult 0x100000
 76
7577typedef uint32_t NodeFlags;
7678
7779static inline bool bytecodeUsesAsNumber(NodeFlags flags)

Source/JavaScriptCore/dfg/DFGOperations.cpp

@@size_t JIT_OPERATION operationRegExpTestGeneric(ExecState* exec, JSGlobalObject*
12871287}
12881288
12891289JSCell* JIT_OPERATION operationBitAndBigInt(ExecState* exec, JSCell* op1, JSCell* op2)
 1290{
 1291 VM* vm = &exec->vm();
 1292 NativeCallFrameTracer tracer(vm, exec);
 1293
 1294 JSBigInt* leftOperand = jsCast<JSBigInt*>(op1);
 1295 JSBigInt* rightOperand = jsCast<JSBigInt*>(op2);
 1296
 1297 return JSBigInt::bitwiseAnd(*vm, leftOperand, rightOperand);
 1298}
 1299
 1300JSCell* JIT_OPERATION operationAddBigInt(ExecState* exec, JSCell* op1, JSCell* op2)
12901301{
12911302 VM* vm = &exec->vm();
12921303 NativeCallFrameTracer tracer(vm, exec);

@@JSCell* JIT_OPERATION operationBitAndBigInt(ExecState* exec, JSCell* op1, JSCell
12941305 JSBigInt* leftOperand = jsCast<JSBigInt*>(op1);
12951306 JSBigInt* rightOperand = jsCast<JSBigInt*>(op2);
12961307
1297  return JSBigInt::bitwiseAnd(*vm, leftOperand, rightOperand);
 1308 return JSBigInt::add(*vm, leftOperand, rightOperand);
12981309}
12991310
13001311JSCell* JIT_OPERATION operationBitOrBigInt(ExecState* exec, JSCell* op1, JSCell* op2)

Source/JavaScriptCore/dfg/DFGOperations.h

@@size_t JIT_OPERATION operationRegExpTestGeneric(ExecState*, JSGlobalObject*, Enc
165165size_t JIT_OPERATION operationCompareStrictEqCell(ExecState*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
166166JSCell* JIT_OPERATION operationBitAndBigInt(ExecState*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
167167JSCell* JIT_OPERATION operationBitOrBigInt(ExecState*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
 168JSCell* JIT_OPERATION operationAddBigInt(ExecState*, JSCell* op1, JSCell* op2) WTF_INTERNAL;
168169size_t JIT_OPERATION operationSameValue(ExecState*, EncodedJSValue, EncodedJSValue) WTF_INTERNAL;
169170JSCell* JIT_OPERATION operationCreateActivationDirect(ExecState*, Structure*, JSScope*, SymbolTable*, EncodedJSValue);
170171JSCell* JIT_OPERATION operationCreateDirectArguments(ExecState*, Structure*, uint32_t length, uint32_t minCapacity);

Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp

@@private:
195195 } else if (isStringOrStringObjectSpeculation(left) || isStringOrStringObjectSpeculation(right)) {
196196 // left or right is definitely something other than a number.
197197 changed |= mergePrediction(SpecString);
198  } else {
 198 } else if (isBigIntSpeculation(left) && isBigIntSpeculation(right))
 199 changed |= mergePrediction(SpecBigInt);
 200 else {
199201 changed |= mergePrediction(SpecInt32Only);
200202 if (node->mayHaveDoubleResult())
201203 changed |= mergePrediction(SpecBytecodeDouble);
 204 if (node->mayHaveBigIntResult())
 205 changed |= mergePrediction(SpecBigInt);
202206 if (node->mayHaveNonNumberResult())
203207 changed |= mergePrediction(SpecString);
204208 }

@@private:
265269 changed |= mergePrediction(speculatedDoubleTypeForPrediction(node->child1()->prediction()));
266270 else {
267271 changed |= mergePrediction(SpecInt32Only);
268  if (node->op() == ValueNegate && node->mayHaveNonNumberResult()) {
 272 if (node->op() == ValueNegate && node->mayHaveBigIntResult()) {
269273 // FIXME: We should add support to BigInt into speculatio
270274 // https://bugs.webkit.org/show_bug.cgi?id=182470
271275 changed |= mergePrediction(SpecBigInt);

Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

@@void SpeculativeJIT::compileValueAdd(Node* node)
38373837 Edge& leftChild = node->child1();
38383838 Edge& rightChild = node->child2();
38393839
 3840 if (node->isBinaryUseKind(BigIntUse)) {
 3841 SpeculateCellOperand left(this, node->child1());
 3842 SpeculateCellOperand right(this, node->child2());
 3843 GPRReg leftGPR = left.gpr();
 3844 GPRReg rightGPR = right.gpr();
 3845
 3846 speculateBigInt(leftChild, leftGPR);
 3847 speculateBigInt(rightChild, rightGPR);
 3848
 3849 flushRegisters();
 3850 GPRFlushedCallResult result(this);
 3851 GPRReg resultGPR = result.gpr();
 3852 callOperation(operationAddBigInt, resultGPR, leftGPR, rightGPR);
 3853 m_jit.exceptionCheck();
 3854
 3855 cellResult(resultGPR, node);
 3856 return;
 3857 }
 3858
38403859 if (isKnownNotNumber(leftChild.node()) || isKnownNotNumber(rightChild.node())) {
38413860 JSValueOperand left(this, leftChild);
38423861 JSValueOperand right(this, rightChild);

Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

@@private:
18571857
18581858 void compileValueAdd()
18591859 {
 1860 if (m_node->isBinaryUseKind(BigIntUse)) {
 1861 LValue left = lowBigInt(m_node->child1());
 1862 LValue right = lowBigInt(m_node->child2());
 1863
 1864 LValue result = vmCall(pointerType(), m_out.operation(operationAddBigInt), m_callFrame, left, right);
 1865 setJSValue(result);
 1866 return;
 1867 }
 1868
18601869 CodeBlock* baselineCodeBlock = m_ftlState.graph.baselineCodeBlockFor(m_node->origin.semantic);
18611870 ArithProfile* arithProfile = baselineCodeBlock->arithProfileForBytecodeOffset(m_node->origin.semantic.bytecodeIndex);
18621871 Instruction* instruction = &baselineCodeBlock->instructions()[m_node->origin.semantic.bytecodeIndex];

Source/JavaScriptCore/llint/LLIntData.cpp

@@void Data::performAssertions(VM& vm)
154154 ASSERT(StringImpl::s_hashFlag8BitBuffer == 8);
155155
156156 {
157  uint32_t bits = 0x480000;
 157 uint32_t bits = 0x900000;
158158 UNUSED_PARAM(bits);
159159 ArithProfile arithProfile;
160160 arithProfile.lhsSawInt32();

@@void Data::performAssertions(VM& vm)
164164 ASSERT(ArithProfile::fromInt(bits).rhsObservedType().isOnlyInt32());
165165 }
166166 {
167  uint32_t bits = 0x880000;
 167 uint32_t bits = 0x1100000;
168168 UNUSED_PARAM(bits);
169169 ArithProfile arithProfile;
170170 arithProfile.lhsSawNumber();

@@void Data::performAssertions(VM& vm)
174174 ASSERT(ArithProfile::fromInt(bits).rhsObservedType().isOnlyInt32());
175175 }
176176 {
177  uint32_t bits = 0x900000;
 177 uint32_t bits = 0x1200000;
178178 UNUSED_PARAM(bits);
179179 ArithProfile arithProfile;
180180 arithProfile.lhsSawNumber();

@@void Data::performAssertions(VM& vm)
184184 ASSERT(ArithProfile::fromInt(bits).rhsObservedType().isOnlyNumber());
185185 }
186186 {
187  uint32_t bits = 0x500000;
 187 uint32_t bits = 0xa00000;
188188 UNUSED_PARAM(bits);
189189 ArithProfile arithProfile;
190190 arithProfile.lhsSawInt32();

Source/JavaScriptCore/llint/LowLevelInterpreter.asm

@@const IsInvalidated = constexpr IsInvalidated
255255const ShadowChickenTailMarker = constexpr ShadowChicken::Packet::tailMarkerValue
256256
257257# ArithProfile data
258 const ArithProfileInt = 0x400000
259 const ArithProfileIntInt = 0x480000
260 const ArithProfileNumber = 0x800000
261 const ArithProfileNumberInt = 0x880000
262 const ArithProfileNumberNumber = 0x900000
263 const ArithProfileIntNumber = 0x500000
 258const ArithProfileInt = 0x800000
 259const ArithProfileIntInt = 0x900000
 260const ArithProfileNumber = 0x1000000
 261const ArithProfileNumberInt = 0x1100000
 262const ArithProfileNumberNumber = 0x1200000
 263const ArithProfileIntNumber = 0xa00000
264264
265265# Pointer Tags
266266const BytecodePtrTag = constexpr BytecodePtrTag

Source/JavaScriptCore/runtime/CommonSlowPaths.cpp

@@static void updateArithProfileForUnaryArithOp(Instruction* pc, JSValue result, J
400400 profile.setObservedInt52Overflow();
401401 }
402402 }
403  } else
 403 } else if (result.isBigInt())
 404 profile.setObservedBigInt();
 405 else
404406 profile.setObservedNonNumber();
405407}
406408#else

@@static void updateArithProfileForBinaryArithOp(ExecState* exec, Instruction* pc,
454456 profile.setObservedInt52Overflow();
455457 }
456458 }
457  } else
 459 } else if (result.isBigInt())
 460 profile.setObservedBigInt();
 461 else
458462 profile.setObservedNonNumber();
459463}
460464#else

Tools/ChangeLog

 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 * Scripts/run-jsc-benchmarks:
 9
1102018-10-16 Sihui Liu <sihui_liu@apple.com>
211
312 Add a switch for Web SQL

Tools/Scripts/run-jsc-benchmarks

@@SUNSPIDER_PATH = PERFORMANCETESTS_PATH + "SunSpider" + "tests" + "sunspider-1.0"
4949LONGSPIDER_PATH = PERFORMANCETESTS_PATH + "LongSpider"
5050V8_PATH = PERFORMANCETESTS_PATH + "SunSpider" + "tests" + "v8-v6"
5151TAILBENCH_PATH = PERFORMANCETESTS_PATH + "TailBench9000"
 52BIGINTBENCH_PATH = PERFORMANCETESTS_PATH + "BigIntBench"
5253MICROBENCHMARKS_PATH = OPENSOURCE_PATH + "JSTests" + "microbenchmarks"
5354OPENSOURCE_OCTANE_PATH = PERFORMANCETESTS_PATH + "Octane"
5455OCTANE_WRAPPER_PATH = OPENSOURCE_OCTANE_PATH + "wrappers"

@@$includeOctane=true
231232$includeCompressionBench = false
232233$includeSixSpeed = false
233234$includeTailBench = true
 235$includeBigIntBench = false
234236$measureGC=false
235237$benchmarkPattern=nil
236238$verbosity=0

@@class TailBenchBenchmark
17451747 end
17461748end
17471749
 1750class BigIntBenchBenchmark
 1751 include Benchmark
 1752
 1753 def initialize(name)
 1754 @name = name
 1755 end
 1756
 1757 def emitRunCode(plan)
 1758 emitBenchRunCode(fullname, plan, SingleFileTimedBenchmarkParameters.new(ensureFile("BigIntBench-#{@name}", "#{BIGINTBENCH_PATH}/#{@name}.js")))
 1759 end
 1760
 1761 def environment
 1762 {"JSC_useBigInt" => "true"}
 1763 end
 1764end
 1765
 1766
17481767class MicrobenchmarksBenchmark
17491768 include Benchmark
17501769

@@begin
28282847 ['--compression-bench', GetoptLong::NO_ARGUMENT],
28292848 ['--six-speed', GetoptLong::NO_ARGUMENT],
28302849 ['--tail-bench', GetoptLong::NO_ARGUMENT],
 2850 ['--big-int-bench', GetoptLong::NO_ARGUMENT],
28312851 ['--benchmarks', GetoptLong::REQUIRED_ARGUMENT],
28322852 ['--measure-gc', GetoptLong::OPTIONAL_ARGUMENT],
28332853 ['--force-vm-kind', GetoptLong::REQUIRED_ARGUMENT],

@@begin
29402960 when '--six-speed'
29412961 resetBenchOptionsIfNecessary
29422962 $includeSixSpeed = true
 2963 when '--big-int-bench'
 2964 resetBenchOptionsIfNecessary
 2965 $includeBigIntBench = true
29432966 when '--benchmarks'
29442967 $benchmarkPattern = Regexp.new(arg)
29452968 when '--measure-gc'

@@begin
31683191 TAILBENCH.add TailBenchBenchmark.new(name);
31693192 }
31703193
 3194 BIGINTBENCH = BenchmarkSuite.new("BigIntBench", :geometricMean, 0)
 3195 Dir.foreach(BIGINTBENCH_PATH) {
 3196 | filename |
 3197 if filename =~ /\.js$/
 3198 name = $~.pre_match
 3199 BIGINTBENCH.add BigIntBenchBenchmark.new(name)
 3200 end
 3201 }
 3202
31713203 MICROBENCHMARKS = BenchmarkSuite.new("Microbenchmarks", :geometricMean, 0)
31723204 Dir.foreach(MICROBENCHMARKS_PATH) {
31733205 | filename |

@@begin
33223354 $suites << MICROBENCHMARKS
33233355 end
33243356
 3357 if $includeBigIntBench and not BIGINTBENCH.empty?
 3358 $suites << BIGINTBENCH
 3359 end
 3360
33253361 if $includeAsmBench and not ASMBENCH.empty?
33263362 if ASMBENCH_PATH
33273363 $suites << ASMBENCH

JSTests/ChangeLog

 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 * stress/value-add-big-int-and-string.js: Added.
 9 * stress/value-add-big-int-prediction-propagation.js: Added.
 10 * stress/value-add-big-int-untyped.js: Added.
 11
1122018-10-16 Dominik Infuehr <dinfuehr@igalia.com>
213
314 [JSC] stress/array-prototype-concat-of-long-spliced-arrays2.js times out on arm and mips

JSTests/stress/value-add-big-int-and-string.js

 1//@ runBigIntEnabled
 2
 3function assert(v, e) {
 4 if (v !== e)
 5 throw new Error("Expected value: " + e + " but got: " + v)
 6}
 7
 8function bigIntOperations(a, b) {
 9 let c = a + b;
 10 return a + c;
 11}
 12noInline(bigIntOperations);
 13
 14for (let i = 0; i < 100000; i++) {
 15 let out = bigIntOperations(0b1111n, "16");
 16 assert(out, "151516");
 17}
 18

JSTests/stress/value-add-big-int-prediction-propagation.js

 1//@ runBigIntEnabled
 2
 3function assert(v, e) {
 4 if (v !== e)
 5 throw new Error("Expected value: " + e + " but got: " + v)
 6}
 7
 8function bigIntPropagation(a, b) {
 9 let c = a + b;
 10 return c + 0n;
 11}
 12noInline(bigIntPropagation);
 13
 14for (let i = 0; i < 100000; i++) {
 15 let out = bigIntPropagation(0xffffffffffffffffffffffffffffffn, 0x1n);
 16 assert(out, 0x1000000000000000000000000000000n)
 17}
 18

JSTests/stress/value-add-big-int-untyped.js

 1//@ runBigIntEnabled
 2
 3function assert(v, e) {
 4 if (v !== e)
 5 throw new Error("Expected value: " + e + " but got: " + v)
 6}
 7
 8function bigIntOperations(a, b) {
 9 let c = a + b;
 10 return a + c;
 11}
 12noInline(bigIntOperations);
 13
 14c = 0;
 15let o = { valueOf: function () {
 16 c++;
 17 return 0b1111n;
 18}};
 19
 20for (let i = 0; i < 100000; i++) {
 21 let out = bigIntOperations(o, 0b1010n);
 22 assert(out, 40n);
 23}
 24
 25assert(c, 200000);
 26

PerformanceTests/BigIntBench/big-int-add-prediction-propagation.js

 1function assert(v, e) {
 2 if (v !== e)
 3 throw new Error("Expected value: " + e + " but got: " + v)
 4}
 5
 6function bigIntOperations(a, b) {
 7 let c = a + b;
 8 return c & 0b111111111n;
 9}
 10noInline(bigIntOperations);
 11
 12for (let i = 0; i < 100000; i++) {
 13 let out = bigIntOperations(0xffffffffffffffffffffffffffffffn, 0x1n);
 14 assert(out, 0n)
 15}
 16
 17for (let i = 0; i < 100000; i++) {
 18 let out = bigIntOperations(0b111111n, 0b1n);
 19 assert(out, 0b1000000n)
 20}
 21

PerformanceTests/BigIntBench/big-int-simple-add.js

 1function bigInt(a, b) {
 2 let c = a + b;
 3 return a + c + b;
 4}
 5noInline(bigInt);
 6
 7for (let i = 0; i < 100000; i++) {
 8 bigInt(0b1111n, 0b1010n);
 9}
 10
 11let out;
 12for (let i = 0; i < 100000; i++) {
 13 out = bigInt(0xffffffffffffffffffn, 0xaaffffffffffffffffffn);
 14}
 15

PerformanceTests/BigIntBench/big-int-simple-sub.js

 1function bigInt(a, b) {
 2 let c = a - b;
 3 return a - c - b;
 4}
 5noInline(bigInt);
 6
 7for (let i = 0; i < 100000; i++) {
 8 bigInt(0b1111n, 0b1010n);
 9}
 10
 11let out;
 12for (let i = 0; i < 100000; i++) {
 13 out = bigInt(0xffffffffffffffffffn, 0xaaffffffffffffffffffn);
 14}
 15
 16print(out);
 17

PerformanceTests/ChangeLog

 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 The idea of BigIntBench is to provide a set of microbenchmarks and
 9 benchmarks to evaluate how fast BigInt computations are happening on
 10 JSC implementation.
 11
 12 Now, we are adding microbenchmarks in this set,
 13 but the plan is to move these tests to "JSTest/microbenchmarks" when
 14 BigInt is enabled by default. After that, the focus of Bigint bench is
 15 to provide a set of tests that represents real use cases of BigInt in
 16 JS programs.
 17
 18 * BigIntBench/big-int-add-prediction-propagation.js: Added.
 19 (assert):
 20 (bigIntOperations):
 21 * BigIntBench/big-int-simple-add.js: Added.
 22 (bigInt):
 23 * BigIntBench/big-int-simple-sub.js: Added.
 24 (bigInt):
 25
1262018-10-02 Chris Dumez <cdumez@apple.com>
227
328 Regression(r236613): Parser/html-parser.html performance test is failing