Skip to content
Permalink
Browse files
[JSC] Implement isFinite / isNaN in JS and make DFG ToNumber accept n…
…on number values

https://bugs.webkit.org/show_bug.cgi?id=154022

Reviewed by Filip Pizlo.

Source/JavaScriptCore:

We aim at optimizing @toInteger operation.
While it still has an unoptimized part[1], this patch should be a first step.

We introduce the @tonumber builtin intrinsic operation.
This converts the given value to the JS number by emitting op_to_number bytecode.
Previously @toInteger called C++ @Number constructor for that purpose.

And in DFG, op_to_number is converted to DFG ToNumber node.
During DFG, we attempt to convert this to edge filtering and Identity, but if we fail,
we just fall back to calling the C++ function.

To utilize ToNumber in user-land side, we add a path attempting to convert Number constructor calls
to ToNumber DFG nodes. This conversion is useful because `Number(value)` is used to convert a value to a number in JS.

Before this patch, we emit simple edge filtering (NumberUse) instead of emitting DFG node like ToNumber for op_to_number.
But emitting ToNumber is useful, because in the case of `Number(value)`, considering `value` may not be a number is reasonable.

By leveraging @tonumber operation, we rewrite Number.{isFinite, isNaN}, global.{isFinite, isNaN} and @toInteger.

ToNumber DFG node has a value profiling. This profiling is leveraged to determine the result number type of the ToNumber operation.
This value profiling is provided from either NumberConstructor's call operation or op_to_number.

The results (with the added performance tests) show that, while existing cases are performance neutral, the newly added cases gain the performance benefit.
And ASMBench/n-body.c also shows stable ~2% progression.

[1]: https://bugs.webkit.org/show_bug.cgi?id=153738

* CMakeLists.txt:
* DerivedSources.make:
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/BuiltinNames.h:
* builtins/GlobalObject.js:
(globalPrivate.isFinite):
(globalPrivate.isNaN):
(globalPrivate.toInteger): Deleted.
(globalPrivate.toLength): Deleted.
(globalPrivate.isDictionary): Deleted.
(globalPrivate.speciesGetter): Deleted.
(globalPrivate.speciesConstructor): Deleted.
* builtins/GlobalOperations.js: Copied from Source/JavaScriptCore/builtins/GlobalObject.js.
(globalPrivate.toInteger):
(globalPrivate.toLength):
(globalPrivate.isDictionary):
(globalPrivate.speciesGetter):
(globalPrivate.speciesConstructor):
* builtins/NumberConstructor.js: Added.
(isFinite):
(isNaN):
* bytecode/BytecodeIntrinsicRegistry.cpp:
(JSC::BytecodeIntrinsicRegistry::BytecodeIntrinsicRegistry):
* bytecode/BytecodeIntrinsicRegistry.h:
* bytecode/BytecodeList.json:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::dumpBytecode):
(JSC::CodeBlock::finishCreation):
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::emitUnaryOp):
(JSC::BytecodeGenerator::emitUnaryOpProfiled):
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitToNumber):
* bytecompiler/NodesCodegen.cpp:
(JSC::BytecodeIntrinsicNode::emit_intrinsic_toNumber):
(JSC::UnaryPlusNode::emitBytecode):
* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* dfg/DFGBackwardsPropagationPhase.cpp:
(JSC::DFG::BackwardsPropagationPhase::propagate):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::attemptToInlineCall):
(JSC::DFG::ByteCodeParser::handleConstantInternalFunction):
(JSC::DFG::ByteCodeParser::parseBlock):
We use `getPrediction()` to retrieve the heap prediction from the to_number bytecode.
According to the benchmark results, choosing `getPredictionWithoutOSRExit()` causes performance regression (1.5%) in kraken stanford-crypto-aes.

* dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* dfg/DFGConstantFoldingPhase.cpp:
(JSC::DFG::ConstantFoldingPhase::foldConstants):
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC):
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
(JSC::DFG::FixupPhase::fixupToNumber):
* dfg/DFGNode.h:
(JSC::DFG::Node::hasHeapPrediction):
* dfg/DFGNodeType.h:
* dfg/DFGOperations.cpp:
* dfg/DFGOperations.h:
* dfg/DFGPredictionPropagationPhase.cpp:
Always on the heap prediction.

* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute):
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
As of 64bit version, we carefully manage the register reuse. The largest difference between 32bit and 64bit is
`branchIfNotNumber()` requires the temporary register. We should not use the result registers for that since
it may be reuse the argument registers and it can break the argument registers before using them to call the operation.
Currently, we allocate the additional temporary register for that scratch register.

* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::compile):
Reuse the argument register for the result if possible. And manually decrement the use count in the middle of the node.
This is similar technique used in ToPrimitive. Typically, the child of ToNumber is only used by this ToNumber node since
we would like to perform the type conversion onto this child node here. So this careful register reuse effectively removes
the spills to call the operation. The example of the actually emitted code is the following.

76:<!2:loc11>     ToNumber(Untyped:@68, JS|MustGen|UseAsOther, DoubleimpurenanTopEmpty, R:World, W:Heap, Exits, ClobbersExit, bc#48)  predicting DoubleimpurenanTopEmpty
    0x7f986d5fe693: test %rax, %r14
    0x7f986d5fe696: jz 0x7f986d5fe6a1
    0x7f986d5fe69c: jmp 0x7f986d5fe6d1
    0x7f986d5fe6a1: mov %rax, %rsi
    0x7f986d5fe6a4: mov %rbp, %rdi
    0x7f986d5fe6a7: mov $0x2, 0x24(%rbp)
    0x7f986d5fe6ae: mov $0x7f98711ea5f0, %r11
    0x7f986d5fe6b8: call *%r11
    0x7f986d5fe6bb: mov $0x7f982d3f72d0, %r11
    0x7f986d5fe6c5: mov (%r11), %r11
    0x7f986d5fe6c8: test %r11, %r11
    0x7f986d5fe6cb: jnz 0x7f986d5fe88c

It effectively removes the unnecessary spill to call the operation!

* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::FTL::DFG::LowerDFGToB3::compileToNumber):
(JSC::FTL::DFG::LowerDFGToB3::compileCompareStrictEq):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::branchIfNumber):
(JSC::AssemblyHelpers::branchIfNotNumber):
* jit/JITOpcodes.cpp:
(JSC::JIT::emit_op_to_number):
* jit/JITOpcodes32_64.cpp:
(JSC::JIT::emit_op_to_number):
* llint/LowLevelInterpreter32_64.asm:
* llint/LowLevelInterpreter64.asm:
* parser/Nodes.h:
(JSC::UnaryOpNode::opcodeID):
* runtime/CommonSlowPaths.cpp:
(JSC::SLOW_PATH_DECL):
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncIsNaN): Deleted.
(JSC::globalFuncIsFinite): Deleted.
* runtime/JSGlobalObjectFunctions.h:
* runtime/MathCommon.h:
(JSC::maxSafeInteger):
(JSC::minSafeInteger):
* runtime/NumberConstructor.cpp:
(JSC::NumberConstructor::finishCreation):
(JSC::numberConstructorFuncIsFinite): Deleted.
(JSC::numberConstructorFuncIsNaN): Deleted.
* runtime/NumberConstructor.h:
* tests/stress/Number-isNaN-basics.js: Added.
(numberIsNaNOnInteger):
(testNumberIsNaNOnIntegers):
(verifyNumberIsNaNOnIntegerWithOtherTypes):
(numberIsNaNOnDouble):
(testNumberIsNaNOnDoubles):
(verifyNumberIsNaNOnDoublesWithOtherTypes):
(numberIsNaNNoArguments):
(numberIsNaNTooManyArguments):
(testNumberIsNaNOnConstants):
(numberIsNaNStructTransition):
(Number.isNaN):
* tests/stress/global-is-finite.js: Added.
(shouldBe):
* tests/stress/global-is-nan.js: Added.
(shouldBe):
* tests/stress/global-isNaN-basics.js: Added.
(isNaNOnInteger):
(testIsNaNOnIntegers):
(verifyIsNaNOnIntegerWithOtherTypes):
(isNaNOnDouble):
(testIsNaNOnDoubles):
(verifyIsNaNOnDoublesWithOtherTypes):
(verifyIsNaNOnCoercedTypes):
(isNaNNoArguments):
(isNaNTooManyArguments):
(testIsNaNOnConstants):
(isNaNTypeCoercionSideEffects):
(i.value.isNaNTypeCoercionSideEffects.valueOf):
(isNaNStructTransition):
(isNaN):
* tests/stress/number-is-finite.js: Added.
(shouldBe):
(test2):
(test3):
* tests/stress/number-is-nan.js: Added.
(shouldBe):
(test2):
(test3):
* tests/stress/to-number-basics.js: Added.
(shouldBe):
* tests/stress/to-number-convert-identity-without-execution.js: Added.
(shouldBe):
(object.valueOf):
(valueOf):
* tests/stress/to-number-int52.js: Added.
(shouldBe):
(object.valueOf):
* tests/stress/to-number-intrinsic-convert-to-identity-without-execution.js: Added.
(shouldBe):
(object.valueOf):
(valueOf):
* tests/stress/to-number-intrinsic-int52.js: Added.
(shouldBe):
(object.valueOf):
* tests/stress/to-number-intrinsic-object-without-execution.js: Added.
(shouldBe):
(object.valueOf):
* tests/stress/to-number-intrinsic-value-profiling.js: Added.
(shouldBe):
(object.valueOf):
* tests/stress/to-number-object-without-execution.js: Added.
(shouldBe):
(object.valueOf):
* tests/stress/to-number-object.js: Added.
(shouldBe):
(test12):
(object1.valueOf):
(test2):
(test22):
(object2.valueOf):
(test3):
(test32):
(object3.valueOf):
* tests/stress/to-number-value-profiling.js: Added.
(shouldBe):
(object.valueOf):

LayoutTests:

* js/regress/Number-isNaN-expected.txt: Added.
* js/regress/Number-isNaN.html: Added.
* js/regress/global-isNaN-expected.txt: Added.
* js/regress/global-isNaN.html: Added.
* js/regress/script-tests/Number-isNaN.js: Added.
* js/regress/script-tests/global-isNaN.js: Added.
* js/regress/script-tests/many-foreach-calls.js:
(i.4.forEach):
(i.array.forEach): Deleted.
* js/regress/script-tests/to-number-constructor-number-string-number-string.js: Added.
(test):
* js/regress/script-tests/to-number-constructor-only-number.js: Added.
(test):
* js/regress/script-tests/to-number-constructor-only-string.js: Added.
(test):
* js/regress/script-tests/to-number-constructor-string-number-string-number.js: Added.
(test):
* js/regress/script-tests/to-number-number-string-number-string.js: Added.
(test):
* js/regress/script-tests/to-number-only-number.js: Added.
(test):
* js/regress/script-tests/to-number-only-string.js: Added.
(test):
* js/regress/script-tests/to-number-string-number-string-number.js: Added.
(test):
* js/regress/to-number-constructor-number-string-number-string-expected.txt: Added.
* js/regress/to-number-constructor-number-string-number-string.html: Added.
* js/regress/to-number-constructor-only-number-expected.txt: Added.
* js/regress/to-number-constructor-only-number.html: Added.
* js/regress/to-number-constructor-only-string-expected.txt: Added.
* js/regress/to-number-constructor-only-string.html: Added.
* js/regress/to-number-constructor-string-number-string-number-expected.txt: Added.
* js/regress/to-number-constructor-string-number-string-number.html: Added.
* js/regress/to-number-number-string-number-string-expected.txt: Added.
* js/regress/to-number-number-string-number-string.html: Added.
* js/regress/to-number-only-number-expected.txt: Added.
* js/regress/to-number-only-number.html: Added.
* js/regress/to-number-only-string-expected.txt: Added.
* js/regress/to-number-only-string.html: Added.
* js/regress/to-number-string-number-string-number-expected.txt: Added.
* js/regress/to-number-string-number-string-number.html: Added.

Canonical link: https://commits.webkit.org/177422@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@202680 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Constellation committed Jun 30, 2016
1 parent 6d04938 commit 8613894f59b721ab3ccbe541eb084d62e60727d7
Showing with 2,029 additions and 154 deletions.
  1. +49 −0 LayoutTests/ChangeLog
  2. +10 −0 LayoutTests/js/regress/Number-isNaN-expected.txt
  3. +12 −0 LayoutTests/js/regress/Number-isNaN.html
  4. +10 −0 LayoutTests/js/regress/global-isNaN-expected.txt
  5. +12 −0 LayoutTests/js/regress/global-isNaN.html
  6. +12 −0 LayoutTests/js/regress/script-tests/Number-isNaN.js
  7. +12 −0 LayoutTests/js/regress/script-tests/global-isNaN.js
  8. +3 −4 LayoutTests/js/regress/script-tests/many-foreach-calls.js
  9. +20 −0 LayoutTests/js/regress/script-tests/to-number-constructor-number-string-number-string.js
  10. +10 −0 LayoutTests/js/regress/script-tests/to-number-constructor-only-number.js
  11. +10 −0 LayoutTests/js/regress/script-tests/to-number-constructor-only-string.js
  12. +20 −0 LayoutTests/js/regress/script-tests/to-number-constructor-string-number-string-number.js
  13. +20 −0 LayoutTests/js/regress/script-tests/to-number-number-string-number-string.js
  14. +10 −0 LayoutTests/js/regress/script-tests/to-number-only-number.js
  15. +10 −0 LayoutTests/js/regress/script-tests/to-number-only-string.js
  16. +20 −0 LayoutTests/js/regress/script-tests/to-number-string-number-string-number.js
  17. +10 −0 LayoutTests/js/regress/to-number-constructor-number-string-number-string-expected.txt
  18. +12 −0 LayoutTests/js/regress/to-number-constructor-number-string-number-string.html
  19. +10 −0 LayoutTests/js/regress/to-number-constructor-only-number-expected.txt
  20. +12 −0 LayoutTests/js/regress/to-number-constructor-only-number.html
  21. +10 −0 LayoutTests/js/regress/to-number-constructor-only-string-expected.txt
  22. +12 −0 LayoutTests/js/regress/to-number-constructor-only-string.html
  23. +10 −0 LayoutTests/js/regress/to-number-constructor-string-number-string-number-expected.txt
  24. +12 −0 LayoutTests/js/regress/to-number-constructor-string-number-string-number.html
  25. +10 −0 LayoutTests/js/regress/to-number-number-string-number-string-expected.txt
  26. +12 −0 LayoutTests/js/regress/to-number-number-string-number-string.html
  27. +10 −0 LayoutTests/js/regress/to-number-only-number-expected.txt
  28. +12 −0 LayoutTests/js/regress/to-number-only-number.html
  29. +10 −0 LayoutTests/js/regress/to-number-only-string-expected.txt
  30. +12 −0 LayoutTests/js/regress/to-number-only-string.html
  31. +10 −0 LayoutTests/js/regress/to-number-string-number-string-number-expected.txt
  32. +12 −0 LayoutTests/js/regress/to-number-string-number-string-number.html
  33. +2 −0 Source/JavaScriptCore/CMakeLists.txt
  34. +245 −0 Source/JavaScriptCore/ChangeLog
  35. +2 −0 Source/JavaScriptCore/DerivedSources.make
  36. +4 −0 Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
  37. +0 −2 Source/JavaScriptCore/builtins/BuiltinNames.h
  38. +9 −46 Source/JavaScriptCore/builtins/GlobalObject.js
  39. +82 −0 Source/JavaScriptCore/builtins/GlobalOperations.js
  40. +45 −0 Source/JavaScriptCore/builtins/NumberConstructor.js
  41. +1 −1 Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.cpp
  42. +1 −0 Source/JavaScriptCore/bytecode/BytecodeIntrinsicRegistry.h
  43. +1 −1 Source/JavaScriptCore/bytecode/BytecodeList.json
  44. +3 −1 Source/JavaScriptCore/bytecode/CodeBlock.cpp
  45. +10 −0 Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp
  46. +2 −1 Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
  47. +19 −0 Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp
  48. +20 −5 Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h
  49. +2 −1 Source/JavaScriptCore/dfg/DFGBackwardsPropagationPhase.cpp
  50. +21 −7 Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp
  51. +6 −0 Source/JavaScriptCore/dfg/DFGClobberize.h
  52. +9 −0 Source/JavaScriptCore/dfg/DFGConstantFoldingPhase.cpp
  53. +1 −0 Source/JavaScriptCore/dfg/DFGDoesGC.cpp
  54. +38 −0 Source/JavaScriptCore/dfg/DFGFixupPhase.cpp
  55. +1 −0 Source/JavaScriptCore/dfg/DFGNode.h
  56. +1 −0 Source/JavaScriptCore/dfg/DFGNodeType.h
  57. +8 −0 Source/JavaScriptCore/dfg/DFGOperations.cpp
  58. +1 −0 Source/JavaScriptCore/dfg/DFGOperations.h
  59. +2 −1 Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp
  60. +1 −0 Source/JavaScriptCore/dfg/DFGSafeToExecute.h
  61. +52 −11 Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp
  62. +42 −8 Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp
  63. +4 −1 Source/JavaScriptCore/ftl/FTLCapabilities.cpp
  64. +39 −0 Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
  65. +20 −6 Source/JavaScriptCore/jit/AssemblyHelpers.h
  66. +4 −1 Source/JavaScriptCore/jit/JITOpcodes.cpp
  67. +1 −0 Source/JavaScriptCore/jit/JITOpcodes32_64.cpp
  68. +3 −2 Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm
  69. +3 −2 Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
  70. +3 −2 Source/JavaScriptCore/parser/Nodes.h
  71. +8 −6 Source/JavaScriptCore/runtime/CommonSlowPaths.cpp
  72. +3 −7 Source/JavaScriptCore/runtime/JSGlobalObject.cpp
  73. +0 −11 Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
  74. +0 −2 Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.h
  75. +12 −0 Source/JavaScriptCore/runtime/MathCommon.h
  76. +15 −24 Source/JavaScriptCore/runtime/NumberConstructor.cpp
  77. +1 −1 Source/JavaScriptCore/runtime/NumberConstructor.h
  78. +221 −0 Source/JavaScriptCore/tests/stress/Number-isNaN-basics.js
  79. +18 −0 Source/JavaScriptCore/tests/stress/global-is-finite.js
  80. +19 −0 Source/JavaScriptCore/tests/stress/global-is-nan.js
  81. +260 −0 Source/JavaScriptCore/tests/stress/global-isNaN-basics.js
  82. +37 −0 Source/JavaScriptCore/tests/stress/number-is-finite.js
  83. +38 −0 Source/JavaScriptCore/tests/stress/number-is-nan.js
  84. +22 −0 Source/JavaScriptCore/tests/stress/to-number-basics.js
  85. +26 −0 Source/JavaScriptCore/tests/stress/to-number-convert-identity-without-execution.js
  86. +29 −0 Source/JavaScriptCore/tests/stress/to-number-int52.js
  87. +22 −0 Source/JavaScriptCore/tests/stress/to-number-intrinsic-convert-to-identity-without-execution.js
  88. +29 −0 Source/JavaScriptCore/tests/stress/to-number-intrinsic-int52.js
  89. +18 −0 Source/JavaScriptCore/tests/stress/to-number-intrinsic-object-without-execution.js
  90. +18 −0 Source/JavaScriptCore/tests/stress/to-number-intrinsic-value-profiling.js
  91. +20 −0 Source/JavaScriptCore/tests/stress/to-number-object-without-execution.js
  92. +70 −0 Source/JavaScriptCore/tests/stress/to-number-object.js
  93. +19 −0 Source/JavaScriptCore/tests/stress/to-number-value-profiling.js
@@ -1,3 +1,52 @@
2016-06-30 Joseph Pecoraro <pecoraro@apple.com> and Yusuke Suzuki <utatane.tea@gmail.com>

[JSC] Implement isFinite / isNaN in JS and make DFG ToNumber accept non number values
https://bugs.webkit.org/show_bug.cgi?id=154022

Reviewed by Filip Pizlo.

* js/regress/Number-isNaN-expected.txt: Added.
* js/regress/Number-isNaN.html: Added.
* js/regress/global-isNaN-expected.txt: Added.
* js/regress/global-isNaN.html: Added.
* js/regress/script-tests/Number-isNaN.js: Added.
* js/regress/script-tests/global-isNaN.js: Added.
* js/regress/script-tests/many-foreach-calls.js:
(i.4.forEach):
(i.array.forEach): Deleted.
* js/regress/script-tests/to-number-constructor-number-string-number-string.js: Added.
(test):
* js/regress/script-tests/to-number-constructor-only-number.js: Added.
(test):
* js/regress/script-tests/to-number-constructor-only-string.js: Added.
(test):
* js/regress/script-tests/to-number-constructor-string-number-string-number.js: Added.
(test):
* js/regress/script-tests/to-number-number-string-number-string.js: Added.
(test):
* js/regress/script-tests/to-number-only-number.js: Added.
(test):
* js/regress/script-tests/to-number-only-string.js: Added.
(test):
* js/regress/script-tests/to-number-string-number-string-number.js: Added.
(test):
* js/regress/to-number-constructor-number-string-number-string-expected.txt: Added.
* js/regress/to-number-constructor-number-string-number-string.html: Added.
* js/regress/to-number-constructor-only-number-expected.txt: Added.
* js/regress/to-number-constructor-only-number.html: Added.
* js/regress/to-number-constructor-only-string-expected.txt: Added.
* js/regress/to-number-constructor-only-string.html: Added.
* js/regress/to-number-constructor-string-number-string-number-expected.txt: Added.
* js/regress/to-number-constructor-string-number-string-number.html: Added.
* js/regress/to-number-number-string-number-string-expected.txt: Added.
* js/regress/to-number-number-string-number-string.html: Added.
* js/regress/to-number-only-number-expected.txt: Added.
* js/regress/to-number-only-number.html: Added.
* js/regress/to-number-only-string-expected.txt: Added.
* js/regress/to-number-only-string.html: Added.
* js/regress/to-number-string-number-string-number-expected.txt: Added.
* js/regress/to-number-string-number-string-number.html: Added.

2016-06-30 Antoine Quint <graouts@apple.com>

[iOS] Media controls are too cramped with small video
@@ -0,0 +1,10 @@
JSRegress/Number-isNaN

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS no exception thrown
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script src="../../resources/regress-pre.js"></script>
<script src="script-tests/Number-isNaN.js"></script>
<script src="../../resources/regress-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,10 @@
JSRegress/global-isNaN

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS no exception thrown
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script src="../../resources/regress-pre.js"></script>
<script src="script-tests/global-isNaN.js"></script>
<script src="../../resources/regress-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,12 @@
(function() {
var result = 0;
var values = [0, -1, 123.45, Infinity, NaN];
for (var i = 0; i < 1000000; ++i) {
for (var j = 0; j < values.length; ++j) {
if (Number.isNaN(values[j]))
result++;
}
}
if (result !== 1000000)
throw "Error: bad result: " + result;
})();
@@ -0,0 +1,12 @@
(function() {
var result = 0;
var values = [0, -1, 123.45, Infinity, NaN];
for (var i = 0; i < 1000000; ++i) {
for (var j = 0; j < values.length; ++j) {
if (isNaN(values[j]))
result++;
}
}
if (result !== 1000000)
throw "Error: bad result: " + result;
})();
@@ -1,7 +1,6 @@
var sum = 0;
var array = [1, 2, 3];
for (var i = 0; i < 1e5; ++i) {
array.forEach(function (value) {
for (var i = 0; i < 1e4; ++i) {
var sum = 0;
[1, 2, 3, 4].forEach(function (value) {
sum += value;
});
}
@@ -0,0 +1,20 @@
function test(value)
{
return Number(value);
}

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i);

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i.toString());

var result = 0;
for (var i = 0; i < 4e4; ++i)
result = test(i);

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i.toString());
@@ -0,0 +1,10 @@
function test(value)
{
return Number(value);
}

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i);
if (result !== 9999)
throw new Error(`bad result ${result}`);
@@ -0,0 +1,10 @@
function test(value)
{
return Number(value);
}

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i.toString());
if (result !== 9999)
throw new Error(`bad result ${result}`);
@@ -0,0 +1,20 @@
function test(value)
{
return Number(value);
}

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i.toString());

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i);

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i.toString());

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i);
@@ -0,0 +1,20 @@
function test(value)
{
return +value;
}

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i);

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i.toString());

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i);

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i.toString());
@@ -0,0 +1,10 @@
function test(value)
{
return +value;
}

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i);
if (result !== 9999)
throw new Error(`bad result ${result}`);
@@ -0,0 +1,10 @@
function test(value)
{
return +value;
}

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i.toString());
if (result !== 9999)
throw new Error(`bad result ${result}`);
@@ -0,0 +1,20 @@
function test(value)
{
return +value;
}

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i.toString());

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i);

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i.toString());

var result = 0;
for (var i = 0; i < 1e4; ++i)
result = test(i);
@@ -0,0 +1,10 @@
JSRegress/to-number-constructor-number-string-number-string

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS no exception thrown
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script src="../../resources/regress-pre.js"></script>
<script src="script-tests/to-number-constructor-number-string-number-string.js"></script>
<script src="../../resources/regress-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,10 @@
JSRegress/to-number-constructor-only-number

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS no exception thrown
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script src="../../resources/regress-pre.js"></script>
<script src="script-tests/to-number-constructor-only-number.js"></script>
<script src="../../resources/regress-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,10 @@
JSRegress/to-number-constructor-only-string

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS no exception thrown
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script src="../../resources/regress-pre.js"></script>
<script src="script-tests/to-number-constructor-only-string.js"></script>
<script src="../../resources/regress-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,10 @@
JSRegress/to-number-constructor-string-number-string-number

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS no exception thrown
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script src="../../resources/regress-pre.js"></script>
<script src="script-tests/to-number-constructor-string-number-string-number.js"></script>
<script src="../../resources/regress-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,10 @@
JSRegress/to-number-number-string-number-string

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS no exception thrown
PASS successfullyParsed is true

TEST COMPLETE

@@ -0,0 +1,12 @@
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<script src="../../resources/js-test-pre.js"></script>
</head>
<body>
<script src="../../resources/regress-pre.js"></script>
<script src="script-tests/to-number-number-string-number-string.js"></script>
<script src="../../resources/regress-post.js"></script>
<script src="../../resources/js-test-post.js"></script>
</body>
</html>
@@ -0,0 +1,10 @@
JSRegress/to-number-only-number

On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".


PASS no exception thrown
PASS successfullyParsed is true

TEST COMPLETE

0 comments on commit 8613894

Please sign in to comment.