Changeset 207363 in webkit


Ignore:
Timestamp:
Oct 14, 2016 5:10:31 PM (8 years ago)
Author:
jfbastien@apple.com
Message:

Basic WebAssembly testing

Create a small DSL in JavaScript which can build WebAssembly binary modules based on the JSON description of the format as described in:
https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md

This DSL can then be used to write small text description of valid and invalid WebAssembly binaries, making testing the JSC implementation much easier.

Details and example in README.md.

Basic WebAssembly testing
https://bugs.webkit.org/show_bug.cgi?id=163267

Reviewed by Keith Miller.

JSTests:

  • stress/wasm/wasm.json: Removed.
  • wasm.yaml: Added.
  • wasm/Builder.js: Added.

(const._isValidValue):
(const._BuildWebAssemblyBinary):
(export.default.Builder):
(export.default.Builder.prototype.setChecked):
(export.default.Builder.prototype.setPreamble):
(export.default.Builder.prototype._registerSectionBuilders.switch.case.string_appeared_here.this.section):
(export.default.Builder.prototype._registerSectionBuilders.this.Unknown):
(export.default.Builder.prototype._registerSectionBuilders):
(export.default.Builder.prototype._addSection):
(export.default.Builder.prototype.optimize):
(export.default.Builder.prototype.json):
(export.default.Builder.prototype.AsmJS):
(export.default.Builder.prototype.WebAssembly):

  • wasm/LowLevelBinary.js: Added.

(const._getterRangeCheck):
(const._hexdump):
(export.default.LowLevelBinary):
(export.default.LowLevelBinary.prototype.newPatchable):
(export.default.LowLevelBinary.prototype.hexdump):
(export.default.LowLevelBinary.prototype._maybeGrow):
(export.default.LowLevelBinary.prototype._push8):
(export.default.LowLevelBinary.prototype.uint8):
(export.default.LowLevelBinary.prototype.uint16):
(export.default.LowLevelBinary.prototype.uint32):
(export.default.LowLevelBinary.prototype.varuint):
(export.default.LowLevelBinary.prototype.varint):
(export.default.LowLevelBinary.prototype.varuint7):
(export.default.LowLevelBinary.prototype.string):
(export.default.LowLevelBinary.prototype.getSize):
(export.default.LowLevelBinary.prototype.getUint8):
(export.default.LowLevelBinary.prototype.getUint16):
(export.default.LowLevelBinary.prototype.getUint32):
(export.default.LowLevelBinary.prototype.getVaruint):
(export.default.LowLevelBinary.prototype.getVarint):
(export.default.LowLevelBinary.prototype.getVaruint7):
(export.default.LowLevelBinary.prototype.getString):
(PatchableLowLevelBinary):
(PatchableLowLevelBinary.prototype._push8):
(PatchableLowLevelBinary.prototype.apply):

  • wasm/README.md: Added.
  • wasm/WASM.js: Added.
  • wasm/assert.js: Added.

(export.const.notUndef):
(export.const.eq):
(export.const.ge):
(export.const.throwsError):
(export.const.throwsRangeError):

  • wasm/generate-wasmops-header.js: Renamed from JSTests/stress/wasm/generate-wasmops-header.js.
  • wasm/self-test/test_BuilderJSON.js: Added.

(const.assertOpThrows):
(EmptyModule):
(CustomMagicNumber):
(CustomVersion):
(CustomSection):
(CustomSectionAllBytes):
(CustomSectionInvalidByte):
(TwoCustomSections):
(EmptyCodeSection):
(CodeSectionWithEmptyFunction):
(CodeSectionWithEmptyFunctionWithParameters):
(InvalidFunctionParameters):
(SimpleFunction):
(TwoSimpleFunctions):
(TwoBuildersAtTheSameTime):
(CheckedOpcodeArgumentsTooMany):
(CheckedOpcodeArgumentsNotEnough):
(CallNoArguments):
(CallInvalid):
(I32ConstInvalid):
(F32ConstInvalid):
(F64ConstInvalid):
(CallManyFromStack):
(OpcodeAdd):
(OpcodeUnreachable):
(OpcodeUnreachableCombinations):
(OpcodeSelect):

  • wasm/self-test/test_BuilderWebAssembly.js: Added.

(EmptyModule):
(CustomSection):
(Basic):

  • wasm/self-test/test_LowLevelBinary_encode.js: Added.
  • wasm/self-test/test_LowLevelBinary_string.js: Added.
  • wasm/self-test/test_LowLevelBinary_uint16.js: Added.
  • wasm/self-test/test_LowLevelBinary_uint32.js: Added.
  • wasm/self-test/test_LowLevelBinary_uint8.js: Added.
  • wasm/self-test/test_LowLevelBinary_varint.js: Added.
  • wasm/self-test/test_LowLevelBinary_varuint.js: Added.
  • wasm/self-test/test_LowLevelBinary_varuint7.js: Added.
  • wasm/self-test/test_WASM.js: Added.
  • wasm/test.sh: Added.
  • wasm/utilities.js: Added.

(const._read.filename.switch):
(const._load.filename.switch):
(const._json.filename.switch):

  • wasm/wasm.json: Added.

Tools:

  • Scripts/run-javascriptcore-tests:

(runJSCStressTests): run wasm.yaml tests

  • Scripts/run-jsc-stress-tests: add a WebAssembly-specific runner
Location:
trunk
Files:
22 added
1 deleted
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r207347 r207363  
     12016-10-14  JF Bastien  <jfbastien@apple.com>
     2
     3        Basic WebAssembly testing
     4
     5        Create a small DSL in JavaScript which can build WebAssembly binary modules based on the JSON description of the format as described in:
     6        https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md
     7
     8        This DSL can then be used to write small text description of valid and invalid WebAssembly binaries, making testing the JSC implementation much easier.
     9
     10        Details and example in README.md.
     11
     12        Basic WebAssembly testing
     13        https://bugs.webkit.org/show_bug.cgi?id=163267
     14
     15        Reviewed by Keith Miller.
     16
     17        * stress/wasm/wasm.json: Removed.
     18        * wasm.yaml: Added.
     19        * wasm/Builder.js: Added.
     20        (const._isValidValue):
     21        (const._BuildWebAssemblyBinary):
     22        (export.default.Builder):
     23        (export.default.Builder.prototype.setChecked):
     24        (export.default.Builder.prototype.setPreamble):
     25        (export.default.Builder.prototype._registerSectionBuilders.switch.case.string_appeared_here.this.section):
     26        (export.default.Builder.prototype._registerSectionBuilders.this.Unknown):
     27        (export.default.Builder.prototype._registerSectionBuilders):
     28        (export.default.Builder.prototype._addSection):
     29        (export.default.Builder.prototype.optimize):
     30        (export.default.Builder.prototype.json):
     31        (export.default.Builder.prototype.AsmJS):
     32        (export.default.Builder.prototype.WebAssembly):
     33        * wasm/LowLevelBinary.js: Added.
     34        (const._getterRangeCheck):
     35        (const._hexdump):
     36        (export.default.LowLevelBinary):
     37        (export.default.LowLevelBinary.prototype.newPatchable):
     38        (export.default.LowLevelBinary.prototype.hexdump):
     39        (export.default.LowLevelBinary.prototype._maybeGrow):
     40        (export.default.LowLevelBinary.prototype._push8):
     41        (export.default.LowLevelBinary.prototype.uint8):
     42        (export.default.LowLevelBinary.prototype.uint16):
     43        (export.default.LowLevelBinary.prototype.uint32):
     44        (export.default.LowLevelBinary.prototype.varuint):
     45        (export.default.LowLevelBinary.prototype.varint):
     46        (export.default.LowLevelBinary.prototype.varuint7):
     47        (export.default.LowLevelBinary.prototype.string):
     48        (export.default.LowLevelBinary.prototype.getSize):
     49        (export.default.LowLevelBinary.prototype.getUint8):
     50        (export.default.LowLevelBinary.prototype.getUint16):
     51        (export.default.LowLevelBinary.prototype.getUint32):
     52        (export.default.LowLevelBinary.prototype.getVaruint):
     53        (export.default.LowLevelBinary.prototype.getVarint):
     54        (export.default.LowLevelBinary.prototype.getVaruint7):
     55        (export.default.LowLevelBinary.prototype.getString):
     56        (PatchableLowLevelBinary):
     57        (PatchableLowLevelBinary.prototype._push8):
     58        (PatchableLowLevelBinary.prototype.apply):
     59        * wasm/README.md: Added.
     60        * wasm/WASM.js: Added.
     61        * wasm/assert.js: Added.
     62        (export.const.notUndef):
     63        (export.const.eq):
     64        (export.const.ge):
     65        (export.const.throwsError):
     66        (export.const.throwsRangeError):
     67        * wasm/generate-wasmops-header.js: Renamed from JSTests/stress/wasm/generate-wasmops-header.js.
     68        * wasm/self-test/test_BuilderJSON.js: Added.
     69        (const.assertOpThrows):
     70        (EmptyModule):
     71        (CustomMagicNumber):
     72        (CustomVersion):
     73        (CustomSection):
     74        (CustomSectionAllBytes):
     75        (CustomSectionInvalidByte):
     76        (TwoCustomSections):
     77        (EmptyCodeSection):
     78        (CodeSectionWithEmptyFunction):
     79        (CodeSectionWithEmptyFunctionWithParameters):
     80        (InvalidFunctionParameters):
     81        (SimpleFunction):
     82        (TwoSimpleFunctions):
     83        (TwoBuildersAtTheSameTime):
     84        (CheckedOpcodeArgumentsTooMany):
     85        (CheckedOpcodeArgumentsNotEnough):
     86        (CallNoArguments):
     87        (CallInvalid):
     88        (I32ConstInvalid):
     89        (F32ConstInvalid):
     90        (F64ConstInvalid):
     91        (CallManyFromStack):
     92        (OpcodeAdd):
     93        (OpcodeUnreachable):
     94        (OpcodeUnreachableCombinations):
     95        (OpcodeSelect):
     96        * wasm/self-test/test_BuilderWebAssembly.js: Added.
     97        (EmptyModule):
     98        (CustomSection):
     99        (Basic):
     100        * wasm/self-test/test_LowLevelBinary_encode.js: Added.
     101        * wasm/self-test/test_LowLevelBinary_string.js: Added.
     102        * wasm/self-test/test_LowLevelBinary_uint16.js: Added.
     103        * wasm/self-test/test_LowLevelBinary_uint32.js: Added.
     104        * wasm/self-test/test_LowLevelBinary_uint8.js: Added.
     105        * wasm/self-test/test_LowLevelBinary_varint.js: Added.
     106        * wasm/self-test/test_LowLevelBinary_varuint.js: Added.
     107        * wasm/self-test/test_LowLevelBinary_varuint7.js: Added.
     108        * wasm/self-test/test_WASM.js: Added.
     109        * wasm/test.sh: Added.
     110        * wasm/utilities.js: Added.
     111        (const._read.filename.switch):
     112        (const._load.filename.switch):
     113        (const._json.filename.switch):
     114        * wasm/wasm.json: Added.
     115
    11162016-10-14  Joseph Pecoraro  <pecoraro@apple.com>
    2117
  • trunk/Tools/ChangeLog

    r207350 r207363  
     12016-10-14  JF Bastien  <jfbastien@apple.com>
     2
     3        Basic WebAssembly testing
     4
     5        Create a small DSL in JavaScript which can build WebAssembly binary modules based on the JSON description of the format as described in:
     6        https://github.com/WebAssembly/design/blob/master/BinaryEncoding.md
     7
     8        This DSL can then be used to write small text description of valid and invalid WebAssembly binaries, making testing the JSC implementation much easier.
     9
     10        Details and example in README.md.
     11
     12        Basic WebAssembly testing
     13        https://bugs.webkit.org/show_bug.cgi?id=163267
     14
     15        Reviewed by Keith Miller.
     16
     17        * Scripts/run-javascriptcore-tests:
     18        (runJSCStressTests): run wasm.yaml tests
     19        * Scripts/run-jsc-stress-tests: add a WebAssembly-specific runner
     20
    1212016-10-14  Simon Fraser  <simon.fraser@apple.com>
    222
  • trunk/Tools/Scripts/run-javascriptcore-tests

    r205967 r207363  
    283283            "JSTests/es6.yaml",
    284284            "JSTests/modules.yaml",
    285             "JSTests/ChakraCore.yaml");
     285            "JSTests/ChakraCore.yaml",
     286            "JSTests/wasm.yaml");
    286287    }
    287288
  • trunk/Tools/Scripts/run-jsc-stress-tests

    r206154 r207363  
    4848WEBKIT_PATH = SCRIPTS_PATH.dirname.dirname
    4949LAYOUTTESTS_PATH = WEBKIT_PATH + "LayoutTests"
     50WASMTESTS_PATH = WEBKIT_PATH + "JSTests/wasm"
    5051CHAKRATESTS_PATH = WEBKIT_PATH + "JSTests/ChakraCore/test"
    5152raise unless SCRIPTS_PATH.basename.to_s == "Scripts"
     
    11541155end
    11551156
     1157def runWebAssembly
     1158    return if !$jitTests
     1159    return if !$isFTLPlatform
     1160    modules = Dir[WASMTESTS_PATH + "*.js"].map { |f| File.basename(f) }
     1161    prepareExtraAbsoluteFiles(WASMTESTS_PATH, ["wasm.json"])
     1162    prepareExtraRelativeFiles(modules.map { |f| "../" + f }, $collection)
     1163    run("default-wasm", "-m")
     1164end
     1165
    11561166def runChakra(mode, exception, baselineFile, extraFiles)
    11571167    raise unless $benchmark.to_s =~ /\.js$/
Note: See TracChangeset for help on using the changeset viewer.