summaryrefslogtreecommitdiff
path: root/deps/v8/test
diff options
context:
space:
mode:
authorUjjwal Sharma <usharma1998@gmail.com>2019-03-15 18:35:06 +0530
committerRefael Ackermann <refack@gmail.com>2019-03-28 16:36:18 -0400
commitf579e1194046c50f2e6bb54348d48c8e7d1a53cf (patch)
tree9125787c758358365f74f9fd9673c14f57e67870 /deps/v8/test
parent2c73868b0471fbd4038f500d076df056cbf697fe (diff)
downloadandroid-node-v8-f579e1194046c50f2e6bb54348d48c8e7d1a53cf.tar.gz
android-node-v8-f579e1194046c50f2e6bb54348d48c8e7d1a53cf.tar.bz2
android-node-v8-f579e1194046c50f2e6bb54348d48c8e7d1a53cf.zip
deps: update V8 to 7.4.288.13
PR-URL: https://github.com/nodejs/node/pull/26685 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com>
Diffstat (limited to 'deps/v8/test')
-rw-r--r--deps/v8/test/BUILD.gn21
-rw-r--r--deps/v8/test/OWNERS3
-rw-r--r--deps/v8/test/benchmarks/benchmarks.status10
-rw-r--r--deps/v8/test/benchmarks/testcfg.py22
-rw-r--r--deps/v8/test/cctest/BUILD.gn24
-rw-r--r--deps/v8/test/cctest/OWNERS1
-rw-r--r--deps/v8/test/cctest/assembler-helper-arm.cc6
-rw-r--r--deps/v8/test/cctest/assembler-helper-arm.h4
-rw-r--r--deps/v8/test/cctest/cctest.cc45
-rw-r--r--deps/v8/test/cctest/cctest.h14
-rw-r--r--deps/v8/test/cctest/cctest.status116
-rw-r--r--deps/v8/test/cctest/compiler/codegen-tester.cc136
-rw-r--r--deps/v8/test/cctest/compiler/codegen-tester.h3
-rw-r--r--deps/v8/test/cctest/compiler/function-tester.cc22
-rw-r--r--deps/v8/test/cctest/compiler/serializer-tester.cc219
-rw-r--r--deps/v8/test/cctest/compiler/serializer-tester.h42
-rw-r--r--deps/v8/test/cctest/compiler/test-branch-combine.cc141
-rw-r--r--deps/v8/test/cctest/compiler/test-code-generator.cc33
-rw-r--r--deps/v8/test/cctest/compiler/test-js-constant-cache.cc7
-rw-r--r--deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc139
-rw-r--r--deps/v8/test/cctest/compiler/test-multiple-return.cc2
-rw-r--r--deps/v8/test/cctest/compiler/test-representation-change.cc14
-rw-r--r--deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc4
-rw-r--r--deps/v8/test/cctest/compiler/test-run-load-store.cc126
-rw-r--r--deps/v8/test/cctest/compiler/test-run-machops.cc1446
-rw-r--r--deps/v8/test/cctest/compiler/test-run-native-calls.cc11
-rw-r--r--deps/v8/test/cctest/compiler/value-helper.h11
-rw-r--r--deps/v8/test/cctest/heap/heap-utils.cc17
-rw-r--r--deps/v8/test/cctest/heap/heap-utils.h12
-rw-r--r--deps/v8/test/cctest/heap/test-alloc.cc18
-rw-r--r--deps/v8/test/cctest/heap/test-array-buffer-tracker.cc3
-rw-r--r--deps/v8/test/cctest/heap/test-compaction.cc20
-rw-r--r--deps/v8/test/cctest/heap/test-embedder-tracing.cc348
-rw-r--r--deps/v8/test/cctest/heap/test-external-string-tracker.cc5
-rw-r--r--deps/v8/test/cctest/heap/test-heap.cc405
-rw-r--r--deps/v8/test/cctest/heap/test-incremental-marking.cc6
-rw-r--r--deps/v8/test/cctest/heap/test-invalidated-slots.cc21
-rw-r--r--deps/v8/test/cctest/heap/test-mark-compact.cc15
-rw-r--r--deps/v8/test/cctest/heap/test-page-promotion.cc5
-rw-r--r--deps/v8/test/cctest/heap/test-spaces.cc172
-rw-r--r--deps/v8/test/cctest/heap/test-weak-references.cc35
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc5
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden110
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden8
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden10
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden2
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden24
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden4
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden40
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden14
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden13
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden126
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden8
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden126
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden24
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden30
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden42
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden66
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden20
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden8
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden42
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden42
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden136
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden54
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden4
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden7
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden4506
-rw-r--r--deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc46
-rw-r--r--deps/v8/test/cctest/interpreter/interpreter-tester.cc1
-rw-r--r--deps/v8/test/cctest/interpreter/test-bytecode-generator.cc3
-rw-r--r--deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc1
-rw-r--r--deps/v8/test/cctest/interpreter/test-interpreter.cc157
-rw-r--r--deps/v8/test/cctest/interpreter/test-source-positions.cc1
-rw-r--r--deps/v8/test/cctest/libplatform/test-tracing.cc54
-rw-r--r--deps/v8/test/cctest/libsampler/test-sampler.cc4
-rw-r--r--deps/v8/test/cctest/parsing/test-preparser.cc28
-rw-r--r--deps/v8/test/cctest/parsing/test-scanner-streams.cc18
-rw-r--r--deps/v8/test/cctest/scope-test-helper.h14
-rw-r--r--deps/v8/test/cctest/test-allocation.cc3
-rw-r--r--deps/v8/test/cctest/test-api-interceptors.cc198
-rw-r--r--deps/v8/test/cctest/test-api.cc1252
-rw-r--r--deps/v8/test/cctest/test-assembler-arm.cc88
-rw-r--r--deps/v8/test/cctest/test-assembler-arm64.cc82
-rw-r--r--deps/v8/test/cctest/test-assembler-ia32.cc28
-rw-r--r--deps/v8/test/cctest/test-assembler-mips.cc11
-rw-r--r--deps/v8/test/cctest/test-assembler-mips64.cc12
-rw-r--r--deps/v8/test/cctest/test-assembler-ppc.cc1
-rw-r--r--deps/v8/test/cctest/test-code-layout.cc26
-rw-r--r--deps/v8/test/cctest/test-code-stub-assembler.cc20
-rw-r--r--deps/v8/test/cctest/test-compiler.cc28
-rw-r--r--deps/v8/test/cctest/test-cpu-profiler.cc233
-rw-r--r--deps/v8/test/cctest/test-debug.cc111
-rw-r--r--deps/v8/test/cctest/test-decls.cc55
-rw-r--r--deps/v8/test/cctest/test-dictionary.cc5
-rw-r--r--deps/v8/test/cctest/test-disasm-arm64.cc10
-rw-r--r--deps/v8/test/cctest/test-disasm-x64.cc6
-rw-r--r--deps/v8/test/cctest/test-elements-kind.cc3
-rw-r--r--deps/v8/test/cctest/test-factory.cc1
-rw-r--r--deps/v8/test/cctest/test-feedback-vector.cc64
-rw-r--r--deps/v8/test/cctest/test-field-type-tracking.cc112
-rw-r--r--deps/v8/test/cctest/test-func-name-inference.cc6
-rw-r--r--deps/v8/test/cctest/test-global-handles.cc80
-rw-r--r--deps/v8/test/cctest/test-heap-profiler.cc4
-rw-r--r--deps/v8/test/cctest/test-icache.cc16
-rw-r--r--deps/v8/test/cctest/test-inobject-slack-tracking.cc150
-rw-r--r--deps/v8/test/cctest/test-intl.cc9
-rw-r--r--deps/v8/test/cctest/test-js-weak-refs.cc609
-rw-r--r--deps/v8/test/cctest/test-lockers.cc27
-rw-r--r--deps/v8/test/cctest/test-macro-assembler-arm.cc87
-rw-r--r--deps/v8/test/cctest/test-macro-assembler-x64.cc168
-rw-r--r--deps/v8/test/cctest/test-mementos.cc2
-rw-r--r--deps/v8/test/cctest/test-object.cc159
-rw-r--r--deps/v8/test/cctest/test-parsing.cc133
-rw-r--r--deps/v8/test/cctest/test-profile-generator.cc2
-rw-r--r--deps/v8/test/cctest/test-regexp.cc52
-rw-r--r--deps/v8/test/cctest/test-representation.cc69
-rw-r--r--deps/v8/test/cctest/test-roots.cc7
-rw-r--r--deps/v8/test/cctest/test-serialize.cc127
-rw-r--r--deps/v8/test/cctest/test-strings.cc7
-rw-r--r--deps/v8/test/cctest/test-thread-termination.cc108
-rw-r--r--deps/v8/test/cctest/test-trace-event.cc20
-rw-r--r--deps/v8/test/cctest/test-transitions.cc2
-rw-r--r--deps/v8/test/cctest/test-types.cc2
-rw-r--r--deps/v8/test/cctest/test-unboxed-doubles.cc13
-rw-r--r--deps/v8/test/cctest/test-unscopables-hidden-prototype.cc2
-rw-r--r--deps/v8/test/cctest/test-unwinder.cc1
-rw-r--r--deps/v8/test/cctest/test-weakmaps.cc38
-rw-r--r--deps/v8/test/cctest/test-weaksets.cc5
-rw-r--r--deps/v8/test/cctest/testcfg.py15
-rw-r--r--deps/v8/test/cctest/torque/test-torque.cc32
-rw-r--r--deps/v8/test/cctest/unicode-helpers.cc8
-rw-r--r--deps/v8/test/cctest/wasm/test-c-wasm-entry.cc10
-rw-r--r--deps/v8/test/cctest/wasm/test-jump-table-assembler.cc31
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-64.cc328
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc16
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc78
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc74
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc220
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc126
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-js.cc105
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-module.cc3
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-simd.cc118
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm.cc310
-rw-r--r--deps/v8/test/cctest/wasm/test-streaming-compilation.cc6
-rw-r--r--deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc3
-rw-r--r--deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc16
-rw-r--r--deps/v8/test/cctest/wasm/wasm-run-utils.cc57
-rw-r--r--deps/v8/test/cctest/wasm/wasm-run-utils.h58
-rw-r--r--deps/v8/test/common/assembler-tester.h3
-rw-r--r--deps/v8/test/common/types-fuzz.h (renamed from deps/v8/test/cctest/types-fuzz.h)12
-rw-r--r--deps/v8/test/common/wasm/wasm-macro-gen.h37
-rw-r--r--deps/v8/test/common/wasm/wasm-module-runner.cc5
-rw-r--r--deps/v8/test/debugger/debug/debug-evaluate-dead-function-fails.js35
-rw-r--r--deps/v8/test/debugger/debug/debug-evaluate-modify-catch-block-scope.js2
-rw-r--r--deps/v8/test/debugger/debug/debug-optimize.js2
-rw-r--r--deps/v8/test/debugger/debug/es6/debug-step-destructuring-bind.js106
-rw-r--r--deps/v8/test/debugger/debug/es6/debug-stepin-default-parameters.js2
-rw-r--r--deps/v8/test/debugger/debug/regress-3225.js2
-rw-r--r--deps/v8/test/debugger/debug/regress/regress-1170187.js8
-rw-r--r--deps/v8/test/debugger/debug/regress/regress-crbug-323936.js5
-rw-r--r--deps/v8/test/debugger/debug/wasm/frame-inspection.js1
-rw-r--r--deps/v8/test/debugger/debugger.status19
-rw-r--r--deps/v8/test/debugger/regress/regress-crbug-840288.js1
-rw-r--r--deps/v8/test/debugger/testcfg.py24
-rw-r--r--deps/v8/test/fuzzer/fuzzer.status10
-rw-r--r--deps/v8/test/fuzzer/multi-return.cc2
-rw-r--r--deps/v8/test/fuzzer/testcfg.py39
-rw-r--r--deps/v8/test/fuzzer/wasm-fuzzer-common.cc1
-rw-r--r--deps/v8/test/inspector/BUILD.gn1
-rw-r--r--deps/v8/test/inspector/cpu-profiler/console-profile-wasm-expected.txt4
-rw-r--r--deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js80
-rw-r--r--deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt2
-rw-r--r--deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js5
-rw-r--r--deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt354
-rw-r--r--deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values.js131
-rw-r--r--deps/v8/test/inspector/debugger/get-possible-breakpoints-expected.txt6
-rw-r--r--deps/v8/test/inspector/debugger/get-possible-breakpoints.js2
-rw-r--r--deps/v8/test/inspector/debugger/get-properties-paused-expected.txt89
-rw-r--r--deps/v8/test/inspector/debugger/get-properties-paused.js109
-rw-r--r--deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt36
-rw-r--r--deps/v8/test/inspector/debugger/object-preview-internal-properties.js10
-rw-r--r--deps/v8/test/inspector/debugger/set-async-call-stack-depth-expected.txt40
-rw-r--r--deps/v8/test/inspector/debugger/set-async-call-stack-depth.js53
-rw-r--r--deps/v8/test/inspector/debugger/set-breakpoint-url-regex-expected.txt30
-rw-r--r--deps/v8/test/inspector/debugger/set-breakpoint-url-regex.js57
-rw-r--r--deps/v8/test/inspector/debugger/set-variable-value-expected.txt260
-rw-r--r--deps/v8/test/inspector/debugger/set-variable-value.js90
-rw-r--r--deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js1
-rw-r--r--deps/v8/test/inspector/debugger/step-snapshot-expected.txt6
-rw-r--r--deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js1
-rw-r--r--deps/v8/test/inspector/debugger/wasm-imports.js1
-rw-r--r--deps/v8/test/inspector/debugger/wasm-reset-context-group.js1
-rw-r--r--deps/v8/test/inspector/debugger/wasm-scope-info.js1
-rw-r--r--deps/v8/test/inspector/debugger/wasm-scripts.js1
-rw-r--r--deps/v8/test/inspector/debugger/wasm-set-breakpoint.js1
-rw-r--r--deps/v8/test/inspector/debugger/wasm-source.js1
-rw-r--r--deps/v8/test/inspector/debugger/wasm-stack.js1
-rw-r--r--deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js1
-rw-r--r--deps/v8/test/inspector/debugger/wasm-stepping.js1
-rw-r--r--deps/v8/test/inspector/inspector.status17
-rw-r--r--deps/v8/test/inspector/isolate-data.cc26
-rw-r--r--deps/v8/test/inspector/runtime/exceptionthrown-on-connect-expected.txt46
-rw-r--r--deps/v8/test/inspector/runtime/exceptionthrown-on-connect.js25
-rw-r--r--deps/v8/test/inspector/runtime/release-object-expected.txt157
-rw-r--r--deps/v8/test/inspector/runtime/release-object.js79
-rw-r--r--deps/v8/test/inspector/testcfg.py30
-rw-r--r--deps/v8/test/intl/assert.js63
-rw-r--r--deps/v8/test/intl/bigint/tolocalestring.js61
-rw-r--r--deps/v8/test/intl/break-iterator/subclass.js2
-rw-r--r--deps/v8/test/intl/date-format/check-hc-option.js6
-rw-r--r--deps/v8/test/intl/date-format/constructor-date-style-order.js108
-rw-r--r--deps/v8/test/intl/date-format/constructor-date-time-style-order.js109
-rw-r--r--deps/v8/test/intl/date-format/constructor-date-time-style.js33
-rw-r--r--deps/v8/test/intl/date-format/constructor-no-style-order.js114
-rw-r--r--deps/v8/test/intl/date-format/constructor-time-style-order.js108
-rw-r--r--deps/v8/test/intl/date-format/property-override-date-style.js54
-rw-r--r--deps/v8/test/intl/date-format/property-override-date-time-style.js59
-rw-r--r--deps/v8/test/intl/date-format/property-override-time-style.js54
-rw-r--r--deps/v8/test/intl/intl.status10
-rw-r--r--deps/v8/test/intl/list-format/constructor.js2
-rw-r--r--deps/v8/test/intl/list-format/format-en.js2
-rw-r--r--deps/v8/test/intl/list-format/format-to-parts.js2
-rw-r--r--deps/v8/test/intl/list-format/format.js2
-rw-r--r--deps/v8/test/intl/list-format/formatToParts-zh.js2
-rw-r--r--deps/v8/test/intl/list-format/resolved-options.js2
-rw-r--r--deps/v8/test/intl/list-format/supported-locale.js1
-rw-r--r--deps/v8/test/intl/regress-7770.js8
-rw-r--r--deps/v8/test/intl/regress-8030.js2
-rw-r--r--deps/v8/test/intl/regress-8031.js2
-rw-r--r--deps/v8/test/intl/regress-930304.js5
-rw-r--r--deps/v8/test/intl/relative-time-format/constructor.js2
-rw-r--r--deps/v8/test/intl/relative-time-format/default-locale-fr-CA.js1
-rw-r--r--deps/v8/test/intl/relative-time-format/default-locale-pt-BR.js1
-rw-r--r--deps/v8/test/intl/relative-time-format/format-en.js2
-rw-r--r--deps/v8/test/intl/relative-time-format/format-to-parts-en.js2
-rw-r--r--deps/v8/test/intl/relative-time-format/format-to-parts-plural.js2
-rw-r--r--deps/v8/test/intl/relative-time-format/format-to-parts.js2
-rw-r--r--deps/v8/test/intl/relative-time-format/format.js2
-rw-r--r--deps/v8/test/intl/relative-time-format/resolved-options-nu.js2
-rw-r--r--deps/v8/test/intl/relative-time-format/resolved-options.js2
-rw-r--r--deps/v8/test/intl/relative-time-format/supported-locale.js1
-rw-r--r--deps/v8/test/intl/testcfg.py25
-rw-r--r--deps/v8/test/js-perf-test/ArrayInOperator/run.js245
-rw-r--r--deps/v8/test/js-perf-test/Intl/constructor.js32
-rw-r--r--deps/v8/test/js-perf-test/Intl/run.js19
-rw-r--r--deps/v8/test/js-perf-test/JSTests.json93
-rw-r--r--deps/v8/test/js-perf-test/ObjectFreeze/run.js20
-rw-r--r--deps/v8/test/js-perf-test/ObjectFreeze/tagged-template.js65
-rw-r--r--deps/v8/test/js-perf-test/Proxies/proxies.js9
-rw-r--r--deps/v8/test/js-perf-test/Strings/string-normalize.js38
-rw-r--r--deps/v8/test/js-perf-test/Strings/string-toLocaleCase.js35
-rw-r--r--deps/v8/test/js-perf-test/TypedArrays/filter-nospecies.js55
-rw-r--r--deps/v8/test/message/asm-function-undefined.out2
-rw-r--r--deps/v8/test/message/asm-table-undefined.out2
-rw-r--r--deps/v8/test/message/fail/computed-prop-fni.js9
-rw-r--r--deps/v8/test/message/fail/computed-prop-fni.out6
-rw-r--r--deps/v8/test/message/fail/default-parameter-tdz-arrow.out4
-rw-r--r--deps/v8/test/message/fail/default-parameter-tdz.out4
-rw-r--r--deps/v8/test/message/fail/destructuring-object-private-name.js13
-rw-r--r--deps/v8/test/message/fail/destructuring-object-private-name.out4
-rw-r--r--deps/v8/test/message/fail/json-stringify-circular-ellipsis.js27
-rw-r--r--deps/v8/test/message/fail/json-stringify-circular-ellipsis.out18
-rw-r--r--deps/v8/test/message/fail/json-stringify-circular-max-display-depth.js21
-rw-r--r--deps/v8/test/message/fail/json-stringify-circular-max-display-depth.out16
-rw-r--r--deps/v8/test/message/fail/json-stringify-circular-proxy.js28
-rw-r--r--deps/v8/test/message/fail/json-stringify-circular-proxy.out18
-rw-r--r--deps/v8/test/message/fail/json-stringify-circular-substructure.js9
-rw-r--r--deps/v8/test/message/fail/json-stringify-circular-substructure.out10
-rw-r--r--deps/v8/test/message/fail/json-stringify-circular.js8
-rw-r--r--deps/v8/test/message/fail/json-stringify-circular.out10
-rw-r--r--deps/v8/test/message/fail/list-format-style-narrow.js3
-rw-r--r--deps/v8/test/message/fail/list-format-style-narrow.out4
-rw-r--r--deps/v8/test/message/fail/wasm-function-name.js1
-rw-r--r--deps/v8/test/message/fail/wasm-function-name.out2
-rw-r--r--deps/v8/test/message/fail/wasm-module-and-function-name.js1
-rw-r--r--deps/v8/test/message/fail/wasm-module-and-function-name.out2
-rw-r--r--deps/v8/test/message/fail/wasm-module-name.js1
-rw-r--r--deps/v8/test/message/fail/wasm-module-name.out2
-rw-r--r--deps/v8/test/message/fail/wasm-no-name.js1
-rw-r--r--deps/v8/test/message/fail/wasm-no-name.out2
-rw-r--r--deps/v8/test/message/fail/wasm-trap.js1
-rw-r--r--deps/v8/test/message/fail/wasm-trap.out2
-rw-r--r--deps/v8/test/message/fail/weak-refs-finalizationgroup1.js (renamed from deps/v8/test/message/fail/weak-refs-weakfactory1.js)2
-rw-r--r--deps/v8/test/message/fail/weak-refs-finalizationgroup1.out6
-rw-r--r--deps/v8/test/message/fail/weak-refs-finalizationgroup2.js (renamed from deps/v8/test/message/fail/weak-refs-weakfactory2.js)2
-rw-r--r--deps/v8/test/message/fail/weak-refs-finalizationgroup2.out6
-rw-r--r--deps/v8/test/message/fail/weak-refs-makecell1.out6
-rw-r--r--deps/v8/test/message/fail/weak-refs-makecell2.out6
-rw-r--r--deps/v8/test/message/fail/weak-refs-register1.js (renamed from deps/v8/test/message/fail/weak-refs-makecell1.js)4
-rw-r--r--deps/v8/test/message/fail/weak-refs-register1.out6
-rw-r--r--deps/v8/test/message/fail/weak-refs-register2.js (renamed from deps/v8/test/message/fail/weak-refs-makecell2.js)4
-rw-r--r--deps/v8/test/message/fail/weak-refs-register2.out6
-rw-r--r--deps/v8/test/message/fail/weak-refs-weakfactory1.out6
-rw-r--r--deps/v8/test/message/fail/weak-refs-weakfactory2.out6
-rw-r--r--deps/v8/test/message/message.status10
-rw-r--r--deps/v8/test/message/mjsunit/fail/assert-promise-result-wasm-compile-fail.js30
-rw-r--r--deps/v8/test/message/mjsunit/fail/assert-promise-result-wasm-compile-fail.out9
-rw-r--r--deps/v8/test/message/regress/fail/regress-900383.out2
-rw-r--r--deps/v8/test/message/testcfg.py17
-rw-r--r--deps/v8/test/message/wasm-finish-compilation.js1
-rw-r--r--deps/v8/test/message/wasm-function-name-async.js1
-rw-r--r--deps/v8/test/message/wasm-function-name-async.out2
-rw-r--r--deps/v8/test/message/wasm-function-name-streaming.out2
-rw-r--r--deps/v8/test/message/wasm-module-and-function-name-async.js1
-rw-r--r--deps/v8/test/message/wasm-module-and-function-name-async.out2
-rw-r--r--deps/v8/test/message/wasm-module-and-function-name-streaming.out2
-rw-r--r--deps/v8/test/message/wasm-module-name-async.js1
-rw-r--r--deps/v8/test/message/wasm-module-name-async.out2
-rw-r--r--deps/v8/test/message/wasm-module-name-streaming.out2
-rw-r--r--deps/v8/test/message/wasm-no-name-async.js1
-rw-r--r--deps/v8/test/message/wasm-no-name-async.out2
-rw-r--r--deps/v8/test/message/wasm-no-name-streaming.out2
-rw-r--r--deps/v8/test/message/wasm-trace-memory.js1
-rw-r--r--deps/v8/test/mjsunit/arguments.js11
-rw-r--r--deps/v8/test/mjsunit/array-constructor-feedback.js34
-rw-r--r--deps/v8/test/mjsunit/array-push5.js1
-rw-r--r--deps/v8/test/mjsunit/array-reduce.js7
-rw-r--r--deps/v8/test/mjsunit/code-coverage-ad-hoc.js16
-rw-r--r--deps/v8/test/mjsunit/code-coverage-block-opt.js2
-rw-r--r--deps/v8/test/mjsunit/code-coverage-precise.js13
-rw-r--r--deps/v8/test/mjsunit/compiler/abstract-equal-receiver.js10
-rw-r--r--deps/v8/test/mjsunit/compiler/abstract-equal-symbol.js10
-rw-r--r--deps/v8/test/mjsunit/compiler/abstract-equal-undetectable.js7
-rw-r--r--deps/v8/test/mjsunit/compiler/accessor-exceptions1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/accessor-exceptions2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/alloc-object-huge.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/alloc-object.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/arguments-object.js171
-rw-r--r--deps/v8/test/mjsunit/compiler/array-buffer-is-view.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/array-constructor.js9
-rw-r--r--deps/v8/test/mjsunit/compiler/array-every.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/array-find.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/array-findindex.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/array-is-array.js6
-rw-r--r--deps/v8/test/mjsunit/compiler/array-length.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/array-multiple-receiver-maps.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/array-push-1.js24
-rw-r--r--deps/v8/test/mjsunit/compiler/array-push-2.js6
-rw-r--r--deps/v8/test/mjsunit/compiler/array-push-3.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/array-slice-clone.js35
-rw-r--r--deps/v8/test/mjsunit/compiler/array-some.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/array-species.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/array-subclass.js18
-rw-r--r--deps/v8/test/mjsunit/compiler/assignment-deopt.js11
-rw-r--r--deps/v8/test/mjsunit/compiler/boolean-protototype.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/capture-context.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/compare-map-elim.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/compare-map-elim2.js6
-rw-r--r--deps/v8/test/mjsunit/compiler/compare-objeq-elim.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/concurrent-invalidate-transition-map.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/concurrent-proto-change.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/constant-fold-cow-array.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/constant-fold-tostring.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/constructor-inlining.js6
-rw-r--r--deps/v8/test/mjsunit/compiler/context-sensitivity.js27
-rw-r--r--deps/v8/test/mjsunit/compiler/count-deopt.js12
-rw-r--r--deps/v8/test/mjsunit/compiler/dataview-constant.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/dataview-deopt.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/dataview-get.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/dataview-neutered.js32
-rw-r--r--deps/v8/test/mjsunit/compiler/dataview-nonconstant.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/dataview-set.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/dead-code6.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/dead-loops-neg.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/dead-loops.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/dead-string-add-warm.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-accessors1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-accessors2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-accessors3.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-accessors4.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-accessors5.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-accessors6.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-accessors7.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-args.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-builtins.js16
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-iterator-prototype-next.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-every.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-filter.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-find.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-findindex.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-foreach.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-includes.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-indexof.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-lastindexof.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-map.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-pop.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-reduce.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-slice.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-some.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-push.js43
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-bool.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-bool2.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-closure.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-during-eval-lookup.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-eager-and-lazy.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-eager-var-mutation-ite.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-eager-with-freeze.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-followed-by-gc.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-inlined-from-call.js6
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-lazy-freeze.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-lazy-shape-mutation.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-lazy-var-mutation.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-many-lazy.js10
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-materialize-accumulator.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-now-lazy.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-numberoroddball-binop.js6
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-simple-eager.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-simple-lazy.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-simple-try-catch.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-soft-simple.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-string-outofbounds.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-tonumber-binop.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-tonumber-compare.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-tonumber-shift.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-twice-on-call.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-twice.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/deoptimize-lazy-weak.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/division-by-constant.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/dont-constant-fold-deopting-checks.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/dont-flush-code-marked-for-opt.js15
-rw-r--r--deps/v8/test/mjsunit/compiler/double-array-to-global.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/eager-deopt-simple.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-11.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-12.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-13.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-15.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-16.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-17.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-18.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-3.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-4.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-5.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-6.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-7.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-8.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-9.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-arguments.js19
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-array.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-cycle.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-deopt-1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-deopt-2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-deopt-3.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-deopt-4.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-deopt-5.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-deopt-6.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-framestate-use-at-branchpoint.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-materialize.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-phi-type-2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-phi-type.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-replacement.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-representation.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-rest-parameters.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-type-none-in-object-state.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis-typeguard.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/escape-analysis.js14
-rw-r--r--deps/v8/test/mjsunit/compiler/eval-introduced-closure.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/feedback-after-throw.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/for-in-1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/for-in-2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/for-in-3.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/for-in-4.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/for-in-5.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/function-apply.js10
-rw-r--r--deps/v8/test/mjsunit/compiler/function-bind.js17
-rw-r--r--deps/v8/test/mjsunit/compiler/function-caller.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/global-delete.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/global-var-delete.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/increment-typefeedback.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-accessors1.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-accessors2.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-arguments.js10
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-arity-mismatch.js7
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-closures.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-compare.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-construct.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-context-deopt.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-context-slots.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-exception-1.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-exception-2.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-function-apply.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-global-access.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-literals.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-omit-arguments-deopt.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-omit-arguments-object.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-omit-arguments.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-param.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-surplus-arguments-deopt.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-surplus-arguments-object.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-surplus-arguments.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-throw.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/inline-two.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/inlined-array-pop-getter1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inlined-array-pop-getter2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inlined-array-pop-opt.js6
-rw-r--r--deps/v8/test/mjsunit/compiler/inlined-call-mapcheck.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/inlined-call.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/instance-of-overridden-has-instance.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/instanceof-opt1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/instanceof-opt2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/instanceof-opt3.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/instanceof.js9
-rw-r--r--deps/v8/test/mjsunit/compiler/instanceof2.js14
-rw-r--r--deps/v8/test/mjsunit/compiler/instanceof3.js14
-rw-r--r--deps/v8/test/mjsunit/compiler/int64.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/integral32-add-sub.js6
-rw-r--r--deps/v8/test/mjsunit/compiler/lazy-const-lookup.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/lazy-deopt-async-function-resolve.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/lazy-deopt-in-literal.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/literals-optimized.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/load-elimination-global.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/load-elimination-osr.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/load-elimination-params.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/load-elimination.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/materialize-dictionary-properties.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/materialize-mutable-heap-number.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/math-ceil.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/math-floor-global.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/math-floor-local.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/math-imul.js7
-rw-r--r--deps/v8/test/mjsunit/compiler/math-max.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/math-min.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/math-mul.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/math-round.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/math-sign.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/math-trunc.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/minus-zero.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/mul-div-52bit.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/multiply-add.js6
-rw-r--r--deps/v8/test/mjsunit/compiler/multiply-sub.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/native-context-specialization-hole-check.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/native-context-specialization-string-concat.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/new-cons-string.js6
-rw-r--r--deps/v8/test/mjsunit/compiler/number-abs.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/number-add.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/number-ceil.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/number-comparison-truncations.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/number-constructor-deopt.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/number-divide.js14
-rw-r--r--deps/v8/test/mjsunit/compiler/number-floor.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/number-isfinite-inl.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/number-isfinite.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/number-isinteger-inl.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/number-isinteger.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/number-isnan.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/number-issafeinteger.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/number-max.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/number-min.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/number-modulus.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/number-multiply.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/number-round.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/number-subtract.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/number-toboolean.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/number-trunc.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/object-constructor.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/object-create.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/object-getprototypeof.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/object-is.js13
-rw-r--r--deps/v8/test/mjsunit/compiler/object-isprototypeof.js9
-rw-r--r--deps/v8/test/mjsunit/compiler/opt-next-call-turbo.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/opt-next-call.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/optimize-bitnot.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/optimized-closures.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/optimized-float32array-length.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/optimized-float64array-length.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/optimized-for-in.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/optimized-function-calls.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/optimized-instanceof-1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/optimized-instanceof-2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/optimized-int32array-length.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/optimized-uint32array-length.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/optimized-with.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/osr-sar.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/phi-representations.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/pic.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/polymorphic-symbols.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-capability-default-closures.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-constructor.js9
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-prototype-catch-custom-then-1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-prototype-catch-custom-then-2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-prototype-catch-subclass.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-prototype-catch.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-prototype-finally-custom-then-1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-prototype-finally-custom-then-2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-prototype-finally-subclass.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-prototype-finally.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-prototype-then.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-resolve-stable-maps.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-resolve.js12
-rw-r--r--deps/v8/test/mjsunit/compiler/promise-species.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/property-calls.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/property-refs.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/property-static.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/property-stores.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/proto-chain-constant.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/proto-chain-load.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/receiver-conversion.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/recursive-deopt.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/redundancy-elimination.js10
-rw-r--r--deps/v8/test/mjsunit/compiler/reflect-apply.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/reflect-construct.js9
-rw-r--r--deps/v8/test/mjsunit/compiler/reflect-get.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/reflect-getprototypeof.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/reflect-has.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-106351.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-1085.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-1394.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-177883.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-3218915.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-411262.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-4207.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-4389-1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-4389-2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-4389-3.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-4389-4.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-4389-5.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-4389-6.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-4413-1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-4470-1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-491578.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-5074.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-5100.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-5129.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-5158.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-5278.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-5320.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-5538.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-600593.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-621147.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-621423.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-626986.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-628403.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-633497.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-638132.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-639210.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-644048.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-664117.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-664490.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-665680.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-668760.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-671574.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-675704.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-700883.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-7121.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-713367.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-714483.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-715651.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-726554.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-731495.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-733181.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-736567.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-739902.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-758096.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-758983.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-761892.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-762057.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-772420.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-772872.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-773954.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-780658.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-786521.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-788539.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-793863.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-796041.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-797596.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-799263.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-801097.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-817225.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-8380.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-841117.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-884052.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-888923.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-890620.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-895799.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-905555-2.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-905555.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-910838.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-913232.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-924151.js29
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-932392.js14
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-934175.js29
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-944062-1.js25
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-944062-2.js17
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-arguments.js11
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-closures-with-eval.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-compare-negate.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-const.js13
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-crbug-540593.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-dead-throw-inlining.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-escape-analysis-indirect.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-f64-w32-change.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-funarguments.js19
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-funcaller.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-gvn.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-inline-callfunctionstub.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-intoverflow.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-lazy-deopt.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-lbranch-double.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-loadfield.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-math-sign-nan-type.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-number-is-hole-nan.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-or.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-rep-change.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-shared-deopt.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-shift-left.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-shift-right-logical.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-shift-right.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-stacktrace-methods.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-store-holey-double-array.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-string-to-number-add.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-toint32.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-truncate-number-or-undefined-to-float64.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-v8-5573.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-v8-5756.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-v8-6077.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-v8-6631.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-variable-liveness-let.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-variable-liveness.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/regresss-933331.js21
-rw-r--r--deps/v8/test/mjsunit/compiler/rest-parameters.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/rotate.js34
-rw-r--r--deps/v8/test/mjsunit/compiler/shift-shr.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/simple-deopt.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/simple-inlining.js6
-rw-r--r--deps/v8/test/mjsunit/compiler/smi-stores-opt.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/spread-call.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/store-elimination.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/stress-deopt-count-1.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/stress-deopt-count-2.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/strict-equal-number.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/strict-equal-receiver.js9
-rw-r--r--deps/v8/test/mjsunit/compiler/strict-equal-symbol.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/strict-recompile.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/string-add-try-catch.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/string-comparison-opt.js20
-rw-r--r--deps/v8/test/mjsunit/compiler/string-concat-deopt.js10
-rw-r--r--deps/v8/test/mjsunit/compiler/string-concat-try-catch.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/string-concat-yield.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/string-from-code-point.js5
-rw-r--r--deps/v8/test/mjsunit/compiler/string-length.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/string-slice.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/switch-bailout.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/symbol-protototype.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/try-binop.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/try-catch-deopt.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/try-context.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/try-deopt.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/try-finally-deopt.js12
-rw-r--r--deps/v8/test/mjsunit/compiler/turbo-number-feedback.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/type-speculative-safe-integer-add.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/typed-array-constructor.js11
-rw-r--r--deps/v8/test/mjsunit/compiler/typedarray-prototype-tostringtag.js3
-rw-r--r--deps/v8/test/mjsunit/compiler/uint32.js11
-rw-r--r--deps/v8/test/mjsunit/compiler/uint8-clamped-array.js4
-rw-r--r--deps/v8/test/mjsunit/compiler/unsigned-min-max.js2
-rw-r--r--deps/v8/test/mjsunit/es6/for-each-in-catch.js226
-rw-r--r--deps/v8/test/mjsunit/es6/proxies-ownkeys-clone.js25
-rw-r--r--deps/v8/test/mjsunit/es6/proxies-ownkeys.js12
-rw-r--r--deps/v8/test/mjsunit/es6/string-endswith.js10
-rw-r--r--deps/v8/test/mjsunit/es6/typedarray-sort.js25
-rw-r--r--deps/v8/test/mjsunit/es8/object-entries.js24
-rw-r--r--deps/v8/test/mjsunit/es8/object-get-own-property-descriptors.js16
-rw-r--r--deps/v8/test/mjsunit/es8/object-values.js15
-rw-r--r--deps/v8/test/mjsunit/for-of-in-catch-duplicate-decl.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/array-flat-species.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/array-flat.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/array-flatMap-species.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/array-flatMap.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/bigint/as-int-n.js4
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-8808.js15
-rw-r--r--deps/v8/test/mjsunit/harmony/symbol-description.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/basics.js166
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-holdings.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-cells.js)49
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js8
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js6
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js8
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome-after-unregister.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome-cleared-weakcell.js)22
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome-weakcell.js)23
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/clear-called-twice.js39
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/clear-clears-factory-pointer.js49
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup4.js48
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/finalization-group-keeps-holdings-alive.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/weak-factory-keeps-weak-cells-alive.js)21
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/finalizationgroup-and-weakref.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/weakcell-and-weakref.js)19
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/finalizationgroup-scheduled-for-cleanup-multiple-times.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/factory-scheduled-for-cleanup-multiple-times.js)38
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/iterating-in-cleanup.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/iterating-weak-cells.js)30
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/multiple-dirty-finalization-groups.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/multiple-dirty-weak-factories.js)24
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/undefined-holdings.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup2.js)25
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/unregister-after-cleanup.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/clear-after-cleanup.js)30
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/unregister-before-cleanup.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/clear-before-cleanup.js)19
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/unregister-called-twice.js40
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup1.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup1.js)24
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup2.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup3.js)21
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup3.js42
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup4.js48
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/unregister-many.js50
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/unregister-when-cleanup-already-scheduled.js (renamed from deps/v8/test/mjsunit/harmony/weakrefs/clear-when-cleanup-already-scheduled.js)14
-rw-r--r--deps/v8/test/mjsunit/harmony/weakrefs/weak-cell-basics.js7
-rw-r--r--deps/v8/test/mjsunit/integrity-level-map-update.js166
-rw-r--r--deps/v8/test/mjsunit/keyed-has-ic-module-export.js9
-rw-r--r--deps/v8/test/mjsunit/keyed-has-ic-module-import.js70
-rw-r--r--deps/v8/test/mjsunit/keyed-has-ic.js402
-rw-r--r--deps/v8/test/mjsunit/messages.js7
-rw-r--r--deps/v8/test/mjsunit/mjsunit.js109
-rw-r--r--deps/v8/test/mjsunit/mjsunit.status189
-rw-r--r--deps/v8/test/mjsunit/object-freeze.js109
-rw-r--r--deps/v8/test/mjsunit/object-get-own-property-names.js10
-rw-r--r--deps/v8/test/mjsunit/object-keys.js25
-rw-r--r--deps/v8/test/mjsunit/object-prevent-extensions.js87
-rw-r--r--deps/v8/test/mjsunit/object-seal.js102
-rw-r--r--deps/v8/test/mjsunit/optimized-includes-polymorph.js117
-rw-r--r--deps/v8/test/mjsunit/optimized-reduce.js24
-rw-r--r--deps/v8/test/mjsunit/optimized-reduceright.js24
-rw-r--r--deps/v8/test/mjsunit/parallel-optimize-disabled.js2
-rw-r--r--deps/v8/test/mjsunit/regress-930045.js35
-rw-r--r--deps/v8/test/mjsunit/regress-932101.js11
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3218530.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3255.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-5888.js1
-rw-r--r--deps/v8/test/mjsunit/regress/regress-5911.js1
-rw-r--r--deps/v8/test/mjsunit/regress/regress-687.js7
-rw-r--r--deps/v8/test/mjsunit/regress/regress-7254.js1
-rw-r--r--deps/v8/test/mjsunit/regress/regress-813440.js1
-rw-r--r--deps/v8/test/mjsunit/regress/regress-863810.js1
-rw-r--r--deps/v8/test/mjsunit/regress/regress-8913.js15
-rw-r--r--deps/v8/test/mjsunit/regress/regress-8947.js49
-rw-r--r--deps/v8/test/mjsunit/regress/regress-912162.js23
-rw-r--r--deps/v8/test/mjsunit/regress/regress-917755.js5
-rw-r--r--deps/v8/test/mjsunit/regress/regress-926036.js5
-rw-r--r--deps/v8/test/mjsunit/regress/regress-930486.js10
-rw-r--r--deps/v8/test/mjsunit/regress/regress-932953.js59
-rw-r--r--deps/v8/test/mjsunit/regress/regress-933179.js10
-rw-r--r--deps/v8/test/mjsunit/regress/regress-933776.js6
-rw-r--r--deps/v8/test/mjsunit/regress/regress-936077.js17
-rw-r--r--deps/v8/test/mjsunit/regress/regress-940361.js21
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-715455.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-772056.js1
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-913222.js10
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-926819.js5
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-926856.js18
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-930948-base.js10
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-930948.js25
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-931664.js19
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-932034.js12
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-933214.js13
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-934138.js38
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-934166.js18
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-935932.js90
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-936302.js25
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-937618.js34
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-937649.js17
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-941743.js28
-rw-r--r--deps/v8/test/mjsunit/regress/regress-v8-5848.js17
-rw-r--r--deps/v8/test/mjsunit/regress/regress-v8-8799.js11
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/loop-stack-check.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-02256.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-5531.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-5800.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-5860.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-5884.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-6054.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-6164.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-644682.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-648079.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-651961.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-654377.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-663994.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-667745.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-684858.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-688876.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-689450.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-6931.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-699485.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-702460.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7033.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7035.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7049.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-708714.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-709684.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-710844.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-711203.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-715216b.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-722445.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-724846.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-724851.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-724972.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-727222.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-727560.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-729991.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-734246.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-734345.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7353.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7364.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-736584.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7366.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-737069.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-739768.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7422.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7499.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7508.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-752423.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7565.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-757217.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7579.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7582.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-763439.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-763697.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-766003.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-769637.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-771243.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-772332.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-775366.js2
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7785.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-778917.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-782280.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-784050.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-7914.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-791810.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-793551.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-797846.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-800756.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-801785.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-801850.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-802244.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-803427.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-803788.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-8059.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-808012.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-808848.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-808980.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-8094.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-8095.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-812005.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-817380.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-819869.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-820802.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-824681.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-827806.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-831463.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-834619.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-834624.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-834693.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-836141.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-837417.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-840757.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-842501.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-843563.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-8505.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-8533.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-854011.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-854050.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-864509.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-875556.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-8846.js27
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-8896.js23
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-894307.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-894374.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-905815.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-910824.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-913804.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-916869.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-917412.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-917588.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-917588b.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-918149.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-918284.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-918917.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-919308.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-919533.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-922432.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-922670.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-922933.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-924843.js16
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-924905.js1
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-925671.js12
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-935138.js19
-rw-r--r--deps/v8/test/mjsunit/string-external-cached.js2
-rw-r--r--deps/v8/test/mjsunit/string-externalize.js16
-rw-r--r--deps/v8/test/mjsunit/switch.js10
-rw-r--r--deps/v8/test/mjsunit/testcfg.py29
-rw-r--r--deps/v8/test/mjsunit/tools/compiler-trace-flags.js1
-rw-r--r--deps/v8/test/mjsunit/ubsan-fuzzerbugs.js19
-rw-r--r--deps/v8/test/mjsunit/wasm/adapter-frame.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/add-getters.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/anyfunc.js162
-rw-r--r--deps/v8/test/mjsunit/wasm/anyref-globals.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/anyref.js61
-rw-r--r--deps/v8/test/mjsunit/wasm/async-compile.js22
-rw-r--r--deps/v8/test/mjsunit/wasm/atomics-stress.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/atomics.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/atomics64-stress.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/bigint.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/bounds-check-64bit.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/bulk-memory.js45
-rw-r--r--deps/v8/test/mjsunit/wasm/calls.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/code-space-exhaustion.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/compare-exchange-stress.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/compilation-limits.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/compiled-module-management.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/compiled-module-serialization.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/data-segments.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/disallow-codegen.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/divrem-trap.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/empirical_max_memory.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/errors.js190
-rw-r--r--deps/v8/test/mjsunit/wasm/exceptions-anyref.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/exceptions-export.js6
-rw-r--r--deps/v8/test/mjsunit/wasm/exceptions-import.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/exceptions-rethrow.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/exceptions-shared.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/exceptions-simd.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/exceptions.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/export-global.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/export-mutable-global.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/export-table.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/ffi-error.js30
-rw-r--r--deps/v8/test/mjsunit/wasm/ffi.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/float-constant-folding.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/function-names.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/function-prototype.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/futex.js38
-rw-r--r--deps/v8/test/mjsunit/wasm/gc-buffer.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/gc-frame.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/gc-stress.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/globals.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/graceful_shutdown.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/grow-memory-detaching.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/grow-memory-in-call.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/grow-memory.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/huge-memory.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/import-function.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/import-memory.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/import-mutable-global.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/import-table.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/indirect-calls.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/indirect-tables.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/instance-gc.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/instantiate-module-basic.js8
-rw-r--r--deps/v8/test/mjsunit/wasm/instantiate-run-basic.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/interpreter-mixed.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/interpreter.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/js-api.js371
-rw-r--r--deps/v8/test/mjsunit/wasm/large-offset.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/lazy-compilation.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/liftoff.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/loop-rotation.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/many-parameters.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/memory-external-call.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/memory-instance-validation.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/memory-size.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/memory.js2
-rw-r--r--deps/v8/test/mjsunit/wasm/memory_1gb_oob.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/memory_2gb_oob.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/memory_4gb_oob.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/module-memory.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/multi-value.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/names.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/origin-trial-flags.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/parallel_compilation.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/params.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/print-code.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/receiver.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/serialize-lazy-module.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/shared-memory.js15
-rw-r--r--deps/v8/test/mjsunit/wasm/stack.js25
-rw-r--r--deps/v8/test/mjsunit/wasm/stackwalk.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/start-function.js16
-rw-r--r--deps/v8/test/mjsunit/wasm/streaming-error-position.js14
-rw-r--r--deps/v8/test/mjsunit/wasm/table-copy.js22
-rw-r--r--deps/v8/test/mjsunit/wasm/table-grow.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/table-init.js128
-rw-r--r--deps/v8/test/mjsunit/wasm/table-limits.js42
-rw-r--r--deps/v8/test/mjsunit/wasm/table.js18
-rw-r--r--deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/tier-up-testing-flag.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/trap-handler-fallback.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/trap-location.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/unicode-validation.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/unicode.js7
-rw-r--r--deps/v8/test/mjsunit/wasm/unreachable-validation.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/unreachable.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/user-properties-common.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/wasm-api-overloading.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/wasm-constants.js511
-rw-r--r--deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/wasm-module-builder.js632
-rw-r--r--deps/v8/test/mjsunit/wasm/worker-interpreter.js1
-rw-r--r--deps/v8/test/mjsunit/wasm/worker-module.js1
-rw-r--r--deps/v8/test/mkgrokdump/mkgrokdump.cc4
-rw-r--r--deps/v8/test/mkgrokdump/mkgrokdump.status5
-rw-r--r--deps/v8/test/mkgrokdump/testcfg.py11
-rw-r--r--deps/v8/test/mozilla/mozilla.status5
-rw-r--r--deps/v8/test/mozilla/testcfg.py90
-rw-r--r--deps/v8/test/preparser/preparser.status5
-rw-r--r--deps/v8/test/preparser/testcfg.py24
-rw-r--r--deps/v8/test/test262/local-tests/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js45
-rw-r--r--deps/v8/test/test262/local-tests/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js44
-rw-r--r--deps/v8/test/test262/local-tests/test/intl402/NumberFormat/fraction-digit-options-read-once.js18
-rw-r--r--deps/v8/test/test262/local-tests/test/intl402/NumberFormat/prototype/formatToParts/default-parameter.js30
-rw-r--r--deps/v8/test/test262/test262.status173
-rw-r--r--deps/v8/test/test262/testcfg.py72
-rw-r--r--deps/v8/test/torque/test-torque.tq108
-rw-r--r--deps/v8/test/unittests/BUILD.gn6
-rw-r--r--deps/v8/test/unittests/background-compile-task-unittest.cc1
-rw-r--r--deps/v8/test/unittests/base/functional-unittest.cc3
-rw-r--r--deps/v8/test/unittests/base/template-utils-unittest.cc2
-rw-r--r--deps/v8/test/unittests/base/utils/random-number-generator-unittest.cc6
-rw-r--r--deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc5
-rw-r--r--deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc61
-rw-r--r--deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc107
-rw-r--r--deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.cc2
-rw-r--r--deps/v8/test/unittests/compiler/common-operator-unittest.cc6
-rw-r--r--deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc2
-rw-r--r--deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc14
-rw-r--r--deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc2
-rw-r--r--deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc5
-rw-r--r--deps/v8/test/unittests/compiler/js-operator-unittest.cc5
-rw-r--r--deps/v8/test/unittests/compiler/load-elimination-unittest.cc42
-rw-r--r--deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc98
-rw-r--r--deps/v8/test/unittests/compiler/machine-operator-unittest.cc7
-rw-r--r--deps/v8/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc109
-rw-r--r--deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc95
-rw-r--r--deps/v8/test/unittests/compiler/node-test-utils.cc2
-rw-r--r--deps/v8/test/unittests/compiler/node-test-utils.h52
-rw-r--r--deps/v8/test/unittests/compiler/opcodes-unittest.cc9
-rw-r--r--deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc14
-rw-r--r--deps/v8/test/unittests/compiler/regalloc/register-allocator-unittest.cc2
-rw-r--r--deps/v8/test/unittests/compiler/simplified-operator-unittest.cc12
-rw-r--r--deps/v8/test/unittests/compiler/typed-optimization-unittest.cc2
-rw-r--r--deps/v8/test/unittests/compiler/typer-unittest.cc8
-rw-r--r--deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc27
-rw-r--r--deps/v8/test/unittests/eh-frame-writer-unittest.cc2
-rw-r--r--deps/v8/test/unittests/heap/bitmap-test-utils.h35
-rw-r--r--deps/v8/test/unittests/heap/bitmap-unittest.cc137
-rw-r--r--deps/v8/test/unittests/heap/gc-idle-time-handler-unittest.cc72
-rw-r--r--deps/v8/test/unittests/heap/heap-unittest.cc18
-rw-r--r--deps/v8/test/unittests/heap/item-parallel-job-unittest.cc12
-rw-r--r--deps/v8/test/unittests/heap/marking-unittest.cc63
-rw-r--r--deps/v8/test/unittests/heap/spaces-unittest.cc36
-rw-r--r--deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc162
-rw-r--r--deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc3
-rw-r--r--deps/v8/test/unittests/interpreter/bytecode-array-random-iterator-unittest.cc15
-rw-r--r--deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc20
-rw-r--r--deps/v8/test/unittests/interpreter/bytecode-utils.h2
-rw-r--r--deps/v8/test/unittests/interpreter/bytecodes-unittest.cc2
-rw-r--r--deps/v8/test/unittests/interpreter/constant-array-builder-unittest.cc15
-rw-r--r--deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc32
-rw-r--r--deps/v8/test/unittests/microtask-queue-unittest.cc325
-rw-r--r--deps/v8/test/unittests/parser/ast-value-unittest.cc3
-rw-r--r--deps/v8/test/unittests/testcfg.py25
-rw-r--r--deps/v8/test/unittests/torque/ls-json-unittest.cc103
-rw-r--r--deps/v8/test/unittests/torque/ls-message-unittest.cc117
-rw-r--r--deps/v8/test/unittests/torque/torque-utils-unittest.cc30
-rw-r--r--deps/v8/test/unittests/unicode-unittest.cc6
-rw-r--r--deps/v8/test/unittests/unittests.status11
-rw-r--r--deps/v8/test/unittests/utils-unittest.cc2
-rw-r--r--deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc2615
-rw-r--r--deps/v8/test/unittests/wasm/module-decoder-unittest.cc37
-rw-r--r--deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc69
-rw-r--r--deps/v8/test/unittests/wasm/trap-handler-x64-unittest.cc6
-rw-r--r--deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc18
-rw-r--r--deps/v8/test/unittests/zone/segmentpool-unittest.cc32
-rw-r--r--deps/v8/test/wasm-js/testcfg.py45
-rw-r--r--deps/v8/test/wasm-js/wasm-js.status14
-rw-r--r--deps/v8/test/wasm-spec-tests/testcfg.py19
-rw-r--r--deps/v8/test/wasm-spec-tests/tests.tar.gz.sha12
-rw-r--r--deps/v8/test/wasm-spec-tests/wasm-spec-tests.status9
-rw-r--r--deps/v8/test/webkit/JSON-stringify-replacer-expected.txt16
-rw-r--r--deps/v8/test/webkit/class-syntax-name-expected.txt4
-rw-r--r--deps/v8/test/webkit/run-json-stringify-expected.txt8
-rw-r--r--deps/v8/test/webkit/testcfg.py27
-rw-r--r--deps/v8/test/webkit/webkit.status5
1181 files changed, 22160 insertions, 10535 deletions
diff --git a/deps/v8/test/BUILD.gn b/deps/v8/test/BUILD.gn
index 70c8b51fa3..68916347b3 100644
--- a/deps/v8/test/BUILD.gn
+++ b/deps/v8/test/BUILD.gn
@@ -141,3 +141,24 @@ group("v8_run_num_fuzzer") {
"webkit:v8_webkit",
]
}
+
+v8_header_set("common_test_headers") {
+ testonly = true
+
+ configs = []
+
+ public_deps = [
+ # We can't depend on this here, because if the "cctest" target depends on it
+ # we will get duplicate symbols.
+ #"../:v8_for_testing",
+ "../:v8_libbase",
+ ]
+
+ sources = [
+ "common/assembler-tester.h",
+ "common/types-fuzz.h",
+ "common/wasm/flag-utils.h",
+ "common/wasm/test-signatures.h",
+ "common/wasm/wasm-macro-gen.h",
+ ]
+}
diff --git a/deps/v8/test/OWNERS b/deps/v8/test/OWNERS
new file mode 100644
index 0000000000..85f514c4ab
--- /dev/null
+++ b/deps/v8/test/OWNERS
@@ -0,0 +1,3 @@
+machenbach@chromium.org
+sergiyb@chromium.org
+tmrts@chromium.org \ No newline at end of file
diff --git a/deps/v8/test/benchmarks/benchmarks.status b/deps/v8/test/benchmarks/benchmarks.status
index 53acd19be4..bb87cc6dba 100644
--- a/deps/v8/test/benchmarks/benchmarks.status
+++ b/deps/v8/test/benchmarks/benchmarks.status
@@ -43,10 +43,20 @@
'octane/typescript': [SKIP],
}],
+['variant == jitless', {
+ # Too slow for jitless mode.
+ 'octane/zlib': [SKIP],
+}],
+
['gc_fuzzer', {
# Too slow for gc fuzzing.
'octane/earley-boyer' : [PASS, SLOW, ['mode == debug', SKIP]],
'octane/splay': [SKIP],
'octane/typescript': [SKIP],
}], # 'gc_fuzzer'
+
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
]
diff --git a/deps/v8/test/benchmarks/testcfg.py b/deps/v8/test/benchmarks/testcfg.py
index 8333f49c78..bf24b7a7d5 100644
--- a/deps/v8/test/benchmarks/testcfg.py
+++ b/deps/v8/test/benchmarks/testcfg.py
@@ -34,13 +34,9 @@ from testrunner.local import testsuite
from testrunner.objects import testcase
-class TestSuite(testsuite.TestSuite):
- def __init__(self, *args, **kwargs):
- super(TestSuite, self).__init__(*args, **kwargs)
- self.testroot = os.path.join(self.root, "data")
-
- def ListTests(self):
- tests = map(self._create_test, [
+class TestLoader(testsuite.TestLoader):
+ def _list_test_filenames(self):
+ return [
"kraken/ai-astar",
"kraken/audio-beat-detection",
"kraken/audio-dft",
@@ -98,8 +94,16 @@ class TestSuite(testsuite.TestSuite):
"sunspider/string-tagcloud",
"sunspider/string-unpack-code",
"sunspider/string-validate-input",
- ])
- return tests
+ ]
+
+
+class TestSuite(testsuite.TestSuite):
+ def __init__(self, *args, **kwargs):
+ super(TestSuite, self).__init__(*args, **kwargs)
+ self.testroot = os.path.join(self.root, "data")
+
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/cctest/BUILD.gn b/deps/v8/test/cctest/BUILD.gn
index 9c18ce5806..b61d9edf53 100644
--- a/deps/v8/test/cctest/BUILD.gn
+++ b/deps/v8/test/cctest/BUILD.gn
@@ -43,6 +43,19 @@ v8_executable("cctest") {
}
}
+v8_header_set("cctest_headers") {
+ testonly = true
+
+ configs = [
+ "../..:external_config",
+ "../..:internal_config_base",
+ ]
+
+ sources = [
+ "cctest.h",
+ ]
+}
+
v8_source_set("cctest_sources") {
testonly = true
@@ -55,7 +68,6 @@ v8_source_set("cctest_sources") {
"../common/wasm/test-signatures.h",
"../common/wasm/wasm-macro-gen.h",
"cctest.cc",
- "cctest.h",
"compiler/c-signature.h",
"compiler/call-tester.h",
"compiler/code-assembler-tester.h",
@@ -64,6 +76,8 @@ v8_source_set("cctest_sources") {
"compiler/function-tester.cc",
"compiler/function-tester.h",
"compiler/graph-builder-tester.h",
+ "compiler/serializer-tester.cc",
+ "compiler/serializer-tester.h",
"compiler/test-basic-block-profiler.cc",
"compiler/test-branch-combine.cc",
"compiler/test-code-assembler.cc",
@@ -236,10 +250,8 @@ v8_source_set("cctest_sources") {
"test-version.cc",
"test-weakmaps.cc",
"test-weaksets.cc",
- "torque/test-torque.cc",
"trace-extension.cc",
"trace-extension.h",
- "types-fuzz.h",
"unicode-helpers.cc",
"unicode-helpers.h",
"wasm/test-c-wasm-entry.cc",
@@ -248,6 +260,7 @@ v8_source_set("cctest_sources") {
"wasm/test-run-wasm-asmjs.cc",
"wasm/test-run-wasm-atomics.cc",
"wasm/test-run-wasm-atomics64.cc",
+ "wasm/test-run-wasm-exceptions.cc",
"wasm/test-run-wasm-interpreter.cc",
"wasm/test-run-wasm-js.cc",
"wasm/test-run-wasm-module.cc",
@@ -354,7 +367,9 @@ v8_source_set("cctest_sources") {
]
public_deps = [
+ ":cctest_headers",
":resources",
+ "..:common_test_headers",
"../..:v8_initializers",
"../..:v8_libbase",
"../..:v8_libplatform",
@@ -437,6 +452,8 @@ action("resources") {
}
v8_executable("generate-bytecode-expectations") {
+ testonly = true
+
sources = [
"interpreter/bytecode-expectations-printer.cc",
"interpreter/bytecode-expectations-printer.h",
@@ -449,6 +466,7 @@ v8_executable("generate-bytecode-expectations") {
]
deps = [
+ ":cctest_headers",
"../..:v8",
"../..:v8_libbase",
"../..:v8_libplatform",
diff --git a/deps/v8/test/cctest/OWNERS b/deps/v8/test/cctest/OWNERS
index 30fc172657..43a617e87a 100644
--- a/deps/v8/test/cctest/OWNERS
+++ b/deps/v8/test/cctest/OWNERS
@@ -11,3 +11,4 @@ per-file *-s390*=joransiu@ca.ibm.com
per-file *-s390*=jyan@ca.ibm.com
per-file *-s390*=mbrandy@us.ibm.com
per-file *-s390*=michael_dawson@ca.ibm.com
+per-file *profile*=alph@chromium.org
diff --git a/deps/v8/test/cctest/assembler-helper-arm.cc b/deps/v8/test/cctest/assembler-helper-arm.cc
index bb3ed9eb4c..b3a27f8cd8 100644
--- a/deps/v8/test/cctest/assembler-helper-arm.cc
+++ b/deps/v8/test/cctest/assembler-helper-arm.cc
@@ -4,7 +4,7 @@
#include "test/cctest/assembler-helper-arm.h"
-#include "src/assembler-inl.h"
+#include "src/macro-assembler.h"
#include "src/isolate-inl.h"
#include "src/v8.h"
#include "test/cctest/cctest.h"
@@ -12,9 +12,9 @@
namespace v8 {
namespace internal {
-Handle<Code> AssembleCodeImpl(std::function<void(Assembler&)> assemble) {
+Handle<Code> AssembleCodeImpl(std::function<void(MacroAssembler&)> assemble) {
Isolate* isolate = CcTest::i_isolate();
- Assembler assm(AssemblerOptions{});
+ MacroAssembler assm(AssemblerOptions{});
assemble(assm);
assm.bx(lr);
diff --git a/deps/v8/test/cctest/assembler-helper-arm.h b/deps/v8/test/cctest/assembler-helper-arm.h
index 1f7c0ff9ad..15b821a30d 100644
--- a/deps/v8/test/cctest/assembler-helper-arm.h
+++ b/deps/v8/test/cctest/assembler-helper-arm.h
@@ -21,11 +21,11 @@ using F_ppiii = void*(void* p0, void* p1, int p2, int p3, int p4);
using F_pppii = void*(void* p0, void* p1, void* p2, int p3, int p4);
using F_ippii = void*(int p0, void* p1, void* p2, int p3, int p4);
-Handle<Code> AssembleCodeImpl(std::function<void(Assembler&)> assemble);
+Handle<Code> AssembleCodeImpl(std::function<void(MacroAssembler&)> assemble);
template <typename Signature>
GeneratedCode<Signature> AssembleCode(
- std::function<void(Assembler&)> assemble) {
+ std::function<void(MacroAssembler&)> assemble) {
return GeneratedCode<Signature>::FromCode(*AssembleCodeImpl(assemble));
}
diff --git a/deps/v8/test/cctest/cctest.cc b/deps/v8/test/cctest/cctest.cc
index ee03a66ea3..e4a0bd8a50 100644
--- a/deps/v8/test/cctest/cctest.cc
+++ b/deps/v8/test/cctest/cctest.cc
@@ -29,8 +29,11 @@
#include "test/cctest/cctest.h"
#include "include/libplatform/libplatform.h"
+#include "src/compiler.h"
+#include "src/compiler/pipeline.h"
#include "src/debug/debug.h"
#include "src/objects-inl.h"
+#include "src/optimized-compilation-info.h"
#include "src/trap-handler/trap-handler.h"
#include "test/cctest/print-extension.h"
#include "test/cctest/profiler-extension.h"
@@ -222,6 +225,36 @@ HandleAndZoneScope::HandleAndZoneScope()
HandleAndZoneScope::~HandleAndZoneScope() = default;
+i::Handle<i::JSFunction> Optimize(i::Handle<i::JSFunction> function,
+ i::Zone* zone, i::Isolate* isolate,
+ uint32_t flags,
+ i::compiler::JSHeapBroker** out_broker) {
+ i::Handle<i::SharedFunctionInfo> shared(function->shared(), isolate);
+ i::IsCompiledScope is_compiled_scope(shared->is_compiled_scope());
+ CHECK(is_compiled_scope.is_compiled() ||
+ i::Compiler::Compile(function, i::Compiler::CLEAR_EXCEPTION,
+ &is_compiled_scope));
+
+ CHECK_NOT_NULL(zone);
+
+ i::OptimizedCompilationInfo info(zone, isolate, shared, function);
+
+ if (flags & i::OptimizedCompilationInfo::kInliningEnabled) {
+ info.MarkAsInliningEnabled();
+ }
+
+ CHECK(info.shared_info()->HasBytecodeArray());
+ i::JSFunction::EnsureFeedbackVector(function);
+
+ i::Handle<i::Code> code =
+ i::compiler::Pipeline::GenerateCodeForTesting(&info, isolate, out_broker)
+ .ToHandleChecked();
+ info.native_context()->AddOptimizedCode(*code);
+ function->set_code(*code);
+
+ return function;
+}
+
static void PrintTestList(CcTest* current) {
if (current == nullptr) return;
PrintTestList(current->prev());
@@ -282,12 +315,9 @@ int main(int argc, char* argv[]) {
CcTest::set_array_buffer_allocator(
v8::ArrayBuffer::Allocator::NewDefaultAllocator());
- i::PrintExtension print_extension;
- v8::RegisterExtension(&print_extension);
- i::ProfilerExtension profiler_extension;
- v8::RegisterExtension(&profiler_extension);
- i::TraceExtension trace_extension;
- v8::RegisterExtension(&trace_extension);
+ v8::RegisterExtension(v8::base::make_unique<i::PrintExtension>());
+ v8::RegisterExtension(v8::base::make_unique<i::ProfilerExtension>());
+ v8::RegisterExtension(v8::base::make_unique<i::TraceExtension>());
int tests_run = 0;
bool print_run_count = true;
@@ -337,8 +367,7 @@ int main(int argc, char* argv[]) {
if (print_run_count && tests_run != 1)
printf("Ran %i tests.\n", tests_run);
CcTest::TearDown();
- // TODO(svenpanne) See comment above.
- // if (!disable_automatic_dispose_) v8::V8::Dispose();
+ if (!disable_automatic_dispose_) v8::V8::Dispose();
v8::V8::ShutdownPlatform();
return 0;
}
diff --git a/deps/v8/test/cctest/cctest.h b/deps/v8/test/cctest/cctest.h
index 3c99721760..6e6b920dbd 100644
--- a/deps/v8/test/cctest/cctest.h
+++ b/deps/v8/test/cctest/cctest.h
@@ -56,6 +56,12 @@ const auto GetRegConfig = RegisterConfiguration::Default;
class HandleScope;
class Zone;
+namespace compiler {
+
+class JSHeapBroker;
+
+} // namespace compiler
+
} // namespace internal
} // namespace v8
@@ -487,7 +493,13 @@ static inline v8::Local<v8::Value> CompileRunWithOrigin(
return CompileRunWithOrigin(v8_str(source), origin_url);
}
-
+// Takes a JSFunction and runs it through the test version of the optimizing
+// pipeline, allocating the temporary compilation artifacts in a given Zone.
+// For possible {flags} values, look at OptimizedCompilationInfo::Flag.
+// If passed a non-null pointer for {broker}, outputs the JSHeapBroker to it.
+i::Handle<i::JSFunction> Optimize(
+ i::Handle<i::JSFunction> function, i::Zone* zone, i::Isolate* isolate,
+ uint32_t flags, i::compiler::JSHeapBroker** out_broker = nullptr);
static inline void ExpectString(const char* code, const char* expected) {
v8::Local<v8::Value> result = CompileRun(code);
diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status
index b05848d07e..71dd21db35 100644
--- a/deps/v8/test/cctest/cctest.status
+++ b/deps/v8/test/cctest/cctest.status
@@ -74,23 +74,14 @@
# BUG(5193). The cpu profiler tests are notoriously flaky.
'test-profile-generator/RecordStackTraceAtStartProfiling': [SKIP],
- 'test-cpu-profiler/CollectCpuProfile': [SKIP],
- 'test-cpu-profiler/CollectCpuProfileCallerLineNumbers': [SKIP],
- 'test-cpu-profiler/CollectCpuProfileSamples': [SKIP],
'test-cpu-profiler/CollectDeoptEvents': [SKIP],
- 'test-cpu-profiler/CpuProfileDeepStack': [SKIP],
- 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [SKIP],
- 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [SKIP],
- 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP],
- 'test-cpu-profiler/FunctionApplySample': [SKIP],
- 'test-cpu-profiler/HotDeoptNoFrameEntry': [SKIP],
+ 'test-cpu-profiler/CollectCpuProfile': [SKIP],
'test-cpu-profiler/JsNative1JsNative2JsSample': [SKIP],
'test-cpu-profiler/JsNativeJsRuntimeJsSample': [SKIP],
'test-cpu-profiler/JsNativeJsRuntimeJsSampleMultiple': [SKIP],
'test-cpu-profiler/JsNativeJsSample': [SKIP],
- 'test-cpu-profiler/NativeAccessorUninitializedIC': [SKIP],
+ 'test-cpu-profiler/HotDeoptNoFrameEntry': [SKIP],
'test-cpu-profiler/SampleWhenFrameIsNotSetup': [SKIP],
- 'test-cpu-profiler/TracingCpuProfiler': [SKIP],
'test-sampler/LibSamplerCollectSample': [SKIP],
# BUG(7202). The test is flaky.
@@ -118,6 +109,12 @@
# BUG(v8:8296). Flaky OOM test.
'test-heap/OutOfMemorySmallObjects': [SKIP],
+ # BUG(v8:8739). Wasm interpreter does not create proper stack traces.
+ 'test-wasm-stack/RunWasmInterpreter_CollectDetailedWasmStack_WasmError': [SKIP],
+
+ # https://crbug.com/v8/8919
+ 'test-platform/StackAlignment': [PASS, ['not is_clang', SKIP]],
+
############################################################################
# Slow tests.
'test-debug/CallFunctionInDebugger': [PASS, ['mode == debug', SLOW]],
@@ -184,11 +181,6 @@
}], # variant == nooptimization and (arch == arm or arch == arm64) and simulator_run
##############################################################################
-# TODO(ahaas): Port multiple return values to ARM, MIPS, S390 and PPC
-['arch == s390 or arch == s390x or arch == ppc or arch == ppc64', {
- 'test-multiple-return/*': [SKIP],
-}],
-##############################################################################
['asan == True', {
# Skip tests not suitable for ASAN.
'test-assembler-x64/AssemblerX64XchglOperations': [SKIP],
@@ -219,6 +211,8 @@
# support.
'test-serialize/CustomSnapshotDataBlobWithWarmup': [SKIP],
'test-serialize/SnapshotDataBlobWithWarmup': [SKIP],
+ # Fails the embedded blob <-> Isolate verification step.
+ 'test-serialize/CustomSnapshotDataBlobWithLocker': [SKIP],
# https://crbug.com/v8/7763
'test-lockers/ExtensionsRegistration': [SKIP],
@@ -420,8 +414,16 @@
# TODO(ppc/s390): implement atomic operations
'test-run-wasm-atomics/*': [SKIP],
+ # TODO(ppc/s390): support concurrent patching of jump table
+ 'test-jump-table-assembler/*': [SKIP],
+
}], # 'arch == ppc or arch == ppc64 or arch == s390 or arch == s390x'
+['arch == ppc64', {
+ # https://crbug.com/v8/8766
+ 'test-bytecode-generator/WideRegisters': [SKIP],
+}],
+
##############################################################################
['variant == stress_incremental_marking', {
'test-heap-profiler/SamplingHeapProfiler': [SKIP],
@@ -434,6 +436,12 @@
}], # variant == stress_background_compile
##############################################################################
+['variant == interpreted_regexp', {
+ # Times out: https://crbug.com/v8/8678
+ 'test-api/RegExpInterruption': [SKIP],
+}], # variant == interpreted_regexp
+
+##############################################################################
['variant == no_wasm_traps', {
'test-accessors/*': [SKIP],
'test-api-interceptors/*': [SKIP],
@@ -465,7 +473,7 @@
}],
##############################################################################
-['lite_mode', {
+['lite_mode or variant == jitless', {
# TODO(8394): First execution events don't work in lite_mode. Enable this after
# we fix the lite mode to track the first execution.
@@ -512,6 +520,9 @@
'test-heap/IncrementalMarkingStepMakesBigProgressWithLargeObjects': [SKIP],
# TODO(v8:7777): Re-enable once wasm is supported in jitless mode.
+ 'test-api/WasmI32AtomicWaitCallback': [SKIP],
+ 'test-api/WasmI64AtomicWaitCallback': [SKIP],
+ 'test-api/WasmStreaming*': [SKIP],
'test-c-wasm-entry/*': [SKIP],
'test-jump-table-assembler/*': [SKIP],
'test-run-wasm-64/*': [SKIP],
@@ -519,6 +530,7 @@
'test-run-wasm-atomics64/*': [SKIP],
'test-run-wasm-atomics/*': [SKIP],
'test-run-wasm/*': [SKIP],
+ 'test-run-wasm-exceptions/*': [SKIP],
'test-run-wasm-interpreter/*': [SKIP],
'test-run-wasm-js/*': [SKIP],
'test-run-wasm-module/*': [SKIP],
@@ -537,11 +549,81 @@
# Tests that generate code at runtime.
'codegen-tester/*': [SKIP],
+ 'test-api/RegExpInterruption': [SKIP],
'test-assembler-*': [SKIP],
'test-basic-block-profiler/*': [SKIP],
'test-branch-combine/*': [SKIP],
'test-multiple-return/*': [SKIP],
+ 'test-regexp/MacroAssemblernativeAtStart': [SKIP],
+ 'test-regexp/MacroAssemblerNativeBackReferenceLATIN1': [SKIP],
+ 'test-regexp/MacroAssemblerNativeBackReferenceUC16': [SKIP],
+ 'test-regexp/MacroAssemblerNativeBackRefNoCase': [SKIP],
+ 'test-regexp/MacroAssemblerNativeBacktrack': [SKIP],
+ 'test-regexp/MacroAssemblerNativeLotsOfRegisters': [SKIP],
+ 'test-regexp/MacroAssemblerNativeRegisters': [SKIP],
+ 'test-regexp/MacroAssemblerNativeSimple': [SKIP],
+ 'test-regexp/MacroAssemblerNativeSimpleUC16': [SKIP],
+ 'test-regexp/MacroAssemblerNativeSuccess': [SKIP],
+ 'test-regexp/MacroAssemblerStackOverflow': [SKIP],
'test-run-calls-to-external-references/*': [SKIP],
+
+ # Field representation tracking is disabled in jitless mode.
+ 'test-field-type-tracking/*': [SKIP],
+
+ # Instruction cache flushing is disabled in jitless mode.
+ 'test-icache/*': [SKIP],
+}], # lite_mode or variant == jitless
+
+##############################################################################
+['lite_mode', {
+ # TODO(v8:8510): Tests that currently fail with lazy source positions.
+ 'test-cpu-profiler/TickLinesBaseline': [SKIP],
+ 'test-cpu-profiler/TickLinesOptimized': [SKIP],
+ 'test-cpu-profiler/Inlining2': [SKIP],
}], # lite_mode
+##############################################################################
+['variant == jitless', {
+ # https://crbug.com/v8/7777
+ 'serializer-tester/SerializeCallAnyReceiver': [SKIP],
+ 'serializer-tester/SerializeCallArguments': [SKIP],
+ 'serializer-tester/SerializeCallProperty': [SKIP],
+ 'serializer-tester/SerializeCallProperty2': [SKIP],
+ 'serializer-tester/SerializeCallUndefinedReceiver': [SKIP],
+ 'serializer-tester/SerializeCallUndefinedReceiver2': [SKIP],
+ 'serializer-tester/SerializeCallWithSpread': [SKIP],
+ 'serializer-tester/SerializeConstruct': [SKIP],
+ 'serializer-tester/SerializeConstructWithSpread': [SKIP],
+ 'serializer-tester/SerializeInlinedClosure': [SKIP],
+ 'serializer-tester/SerializeInlinedFunction': [SKIP],
+ 'test-api/TurboAsmDisablesDetach': [SKIP],
+ 'test-cpu-profiler/TickLinesOptimized': [SKIP],
+ 'test-heap/TestOptimizeAfterBytecodeFlushingCandidate': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmInterpreter_TryCatchCallDirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmInterpreter_TryCatchCallExternal': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmInterpreter_TryCatchCallIndirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmInterpreter_TryCatchThrow': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmInterpreter_TryCatchTrapTypeError': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmLiftoff_TryCatchCallDirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmLiftoff_TryCatchCallExternal': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmLiftoff_TryCatchCallIndirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmLiftoff_TryCatchThrow': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmLiftoff_TryCatchTrapTypeError': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchCallDirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchCallExternal': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchCallIndirect': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchThrow': [SKIP],
+ 'test-run-wasm-exceptions/RunWasmTurbofan_TryCatchTrapTypeError': [SKIP],
+
+ # Crashes on native arm.
+ 'test-macro-assembler-arm/ExtractLane': [PASS, ['arch == arm and not simulator_run', SKIP]],
+ 'test-macro-assembler-arm/LoadAndStoreWithRepresentation': [PASS, ['arch == arm and not simulator_run', SKIP]],
+ 'test-macro-assembler-arm/ReplaceLane': [PASS, ['arch == arm and not simulator_run', SKIP]],
+}], # variant == jitless
+
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
+
]
diff --git a/deps/v8/test/cctest/compiler/codegen-tester.cc b/deps/v8/test/cctest/compiler/codegen-tester.cc
index 0aff318211..a06585cbca 100644
--- a/deps/v8/test/cctest/compiler/codegen-tester.cc
+++ b/deps/v8/test/cctest/compiler/codegen-tester.cc
@@ -22,27 +22,19 @@ TEST(CompareWrapper) {
CompareWrapper wUint32LessThan(IrOpcode::kUint32LessThan);
CompareWrapper wUint32LessThanOrEqual(IrOpcode::kUint32LessThanOrEqual);
- {
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t a = *pl;
- int32_t b = *pr;
- CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
- CHECK_EQ(a < b, wInt32LessThan.Int32Compare(a, b));
- CHECK_EQ(a <= b, wInt32LessThanOrEqual.Int32Compare(a, b));
- }
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
+ CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
+ CHECK_EQ(a < b, wInt32LessThan.Int32Compare(a, b));
+ CHECK_EQ(a <= b, wInt32LessThanOrEqual.Int32Compare(a, b));
}
}
- {
- FOR_UINT32_INPUTS(pl) {
- FOR_UINT32_INPUTS(pr) {
- uint32_t a = *pl;
- uint32_t b = *pr;
- CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
- CHECK_EQ(a < b, wUint32LessThan.Int32Compare(a, b));
- CHECK_EQ(a <= b, wUint32LessThanOrEqual.Int32Compare(a, b));
- }
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
+ CHECK_EQ(a == b, wWord32Equal.Int32Compare(a, b));
+ CHECK_EQ(a < b, wUint32LessThan.Int32Compare(a, b));
+ CHECK_EQ(a <= b, wUint32LessThanOrEqual.Int32Compare(a, b));
}
}
@@ -338,8 +330,8 @@ void Int32BinopInputShapeTester::TestAllInputShapes() {
void Int32BinopInputShapeTester::Run(RawMachineAssemblerTester<int32_t>* m) {
FOR_INT32_INPUTS(pl) {
FOR_INT32_INPUTS(pr) {
- input_a = *pl;
- input_b = *pr;
+ input_a = pl;
+ input_b = pr;
int32_t expect = gen->expected(input_a, input_b);
CHECK_EQ(expect, m->Call(input_a, input_b));
}
@@ -350,7 +342,7 @@ void Int32BinopInputShapeTester::Run(RawMachineAssemblerTester<int32_t>* m) {
void Int32BinopInputShapeTester::RunLeft(
RawMachineAssemblerTester<int32_t>* m) {
FOR_UINT32_INPUTS(i) {
- input_a = *i;
+ input_a = i;
int32_t expect = gen->expected(input_a, input_b);
CHECK_EQ(expect, m->Call(input_a, input_b));
}
@@ -360,7 +352,7 @@ void Int32BinopInputShapeTester::RunLeft(
void Int32BinopInputShapeTester::RunRight(
RawMachineAssemblerTester<int32_t>* m) {
FOR_UINT32_INPUTS(i) {
- input_b = *i;
+ input_b = i;
int32_t expect = gen->expected(input_a, input_b);
CHECK_EQ(expect, m->Call(input_a, input_b));
}
@@ -414,8 +406,8 @@ TEST(RunEmpty) {
TEST(RunInt32Constants) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m;
- m.Return(m.Int32Constant(*i));
- CHECK_EQ(*i, m.Call());
+ m.Return(m.Int32Constant(i));
+ CHECK_EQ(i, m.Call());
}
}
@@ -435,17 +427,12 @@ TEST(RunSmiConstants) {
RunSmiConstant(Smi::kMinValue);
RunSmiConstant(Smi::kMinValue + 1);
- FOR_INT32_INPUTS(i) { RunSmiConstant(*i); }
+ FOR_INT32_INPUTS(i) { RunSmiConstant(i); }
}
-
TEST(RunNumberConstants) {
- {
- FOR_FLOAT64_INPUTS(i) { RunNumberConstant(*i); }
- }
- {
- FOR_INT32_INPUTS(i) { RunNumberConstant(*i); }
- }
+ FOR_FLOAT64_INPUTS(i) { RunNumberConstant(i); }
+ FOR_INT32_INPUTS(i) { RunNumberConstant(i); }
for (int32_t i = 1; i < Smi::kMaxValue && i != 0;
i = base::ShlWithWraparound(i, 1)) {
@@ -460,7 +447,6 @@ TEST(RunNumberConstants) {
RunNumberConstant(Smi::kMinValue + 1);
}
-
TEST(RunEmptyString) {
RawMachineAssemblerTester<Object> m;
m.Return(m.StringConstant("empty"));
@@ -490,8 +476,8 @@ TEST(RunParam1) {
m.Return(m.Parameter(0));
FOR_INT32_INPUTS(i) {
- int32_t result = m.Call(*i);
- CHECK_EQ(*i, result);
+ int32_t result = m.Call(i);
+ CHECK_EQ(i, result);
}
}
@@ -505,8 +491,8 @@ TEST(RunParam2_1) {
USE(p1);
FOR_INT32_INPUTS(i) {
- int32_t result = m.Call(*i, -9999);
- CHECK_EQ(*i, result);
+ int32_t result = m.Call(i, -9999);
+ CHECK_EQ(i, result);
}
}
@@ -520,8 +506,8 @@ TEST(RunParam2_2) {
USE(p0);
FOR_INT32_INPUTS(i) {
- int32_t result = m.Call(-7777, *i);
- CHECK_EQ(*i, result);
+ int32_t result = m.Call(-7777, i);
+ CHECK_EQ(i, result);
}
}
@@ -535,9 +521,9 @@ TEST(RunParam3) {
int p[] = {-99, -77, -88};
FOR_INT32_INPUTS(j) {
- p[i] = *j;
+ p[i] = j;
int32_t result = m.Call(p[0], p[1], p[2]);
- CHECK_EQ(*j, result);
+ CHECK_EQ(j, result);
}
}
}
@@ -549,7 +535,7 @@ TEST(RunBinopTester) {
Int32BinopTester bt(&m);
bt.AddReturn(bt.param0);
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, bt.call(*i, 777)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, bt.call(i, 777)); }
}
{
@@ -557,7 +543,7 @@ TEST(RunBinopTester) {
Int32BinopTester bt(&m);
bt.AddReturn(bt.param1);
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, bt.call(666, *i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, bt.call(666, i)); }
}
{
@@ -565,7 +551,7 @@ TEST(RunBinopTester) {
Float64BinopTester bt(&m);
bt.AddReturn(bt.param0);
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, bt.call(*i, 9.0)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, bt.call(i, 9.0)); }
}
{
@@ -573,7 +559,7 @@ TEST(RunBinopTester) {
Float64BinopTester bt(&m);
bt.AddReturn(bt.param1);
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, bt.call(-11.25, *i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, bt.call(-11.25, i)); }
}
}
@@ -603,7 +589,7 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
{
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Parameter(0));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(*i, m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, m.Call(i)); }
}
{
BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Int64(),
@@ -611,8 +597,8 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int64Add(m.Parameter(0), m.Parameter(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(base::AddWithWraparound(*i, *j), m.Call(*i, *j));
- CHECK_EQ(base::AddWithWraparound(*j, *i), m.Call(*j, *i));
+ CHECK_EQ(base::AddWithWraparound(i, j), m.Call(i, j));
+ CHECK_EQ(base::AddWithWraparound(j, i), m.Call(j, i));
}
}
}
@@ -623,9 +609,9 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Int64Add(m.Int64Add(m.Parameter(0), m.Parameter(1)), m.Parameter(2)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(Add3(*i, *i, *j), m.Call(*i, *i, *j));
- CHECK_EQ(Add3(*i, *j, *i), m.Call(*i, *j, *i));
- CHECK_EQ(Add3(*j, *i, *i), m.Call(*j, *i, *i));
+ CHECK_EQ(Add3(i, i, j), m.Call(i, i, j));
+ CHECK_EQ(Add3(i, j, i), m.Call(i, j, i));
+ CHECK_EQ(Add3(j, i, i), m.Call(j, i, i));
}
}
}
@@ -638,10 +624,10 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Parameter(3)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(Add4(*i, *i, *i, *j), m.Call(*i, *i, *i, *j));
- CHECK_EQ(Add4(*i, *i, *j, *i), m.Call(*i, *i, *j, *i));
- CHECK_EQ(Add4(*i, *j, *i, *i), m.Call(*i, *j, *i, *i));
- CHECK_EQ(Add4(*j, *i, *i, *i), m.Call(*j, *i, *i, *i));
+ CHECK_EQ(Add4(i, i, i, j), m.Call(i, i, i, j));
+ CHECK_EQ(Add4(i, i, j, i), m.Call(i, i, j, i));
+ CHECK_EQ(Add4(i, j, i, i), m.Call(i, j, i, i));
+ CHECK_EQ(Add4(j, i, i, i), m.Call(j, i, i, i));
}
}
}
@@ -662,8 +648,8 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.PointerConstant(&result), m.Parameter(0), kNoWriteBarrier);
m.Return(m.Int32Constant(0));
FOR_FLOAT64_INPUTS(i) {
- m.Call(*i);
- CHECK_DOUBLE_EQ(*i, result);
+ m.Call(i);
+ CHECK_DOUBLE_EQ(i, result);
}
}
{
@@ -676,11 +662,11 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int32Constant(0));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- m.Call(*i, *j);
- CHECK_EQ(base::AddWithWraparound(*i, *j), result);
+ m.Call(i, j);
+ CHECK_EQ(base::AddWithWraparound(i, j), result);
- m.Call(*j, *i);
- CHECK_EQ(base::AddWithWraparound(*j, *i), result);
+ m.Call(j, i);
+ CHECK_EQ(base::AddWithWraparound(j, i), result);
}
}
}
@@ -695,14 +681,14 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int32Constant(0));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- m.Call(*i, *i, *j);
- CHECK_EQ(Add3(*i, *i, *j), result);
+ m.Call(i, i, j);
+ CHECK_EQ(Add3(i, i, j), result);
- m.Call(*i, *j, *i);
- CHECK_EQ(Add3(*i, *j, *i), result);
+ m.Call(i, j, i);
+ CHECK_EQ(Add3(i, j, i), result);
- m.Call(*j, *i, *i);
- CHECK_EQ(Add3(*j, *i, *i), result);
+ m.Call(j, i, i);
+ CHECK_EQ(Add3(j, i, i), result);
}
}
}
@@ -720,17 +706,17 @@ TEST(RunBufferedRawMachineAssemblerTesterTester) {
m.Return(m.Int32Constant(0));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- m.Call(*i, *i, *i, *j);
- CHECK_EQ(Add4(*i, *i, *i, *j), result);
+ m.Call(i, i, i, j);
+ CHECK_EQ(Add4(i, i, i, j), result);
- m.Call(*i, *i, *j, *i);
- CHECK_EQ(Add4(*i, *i, *j, *i), result);
+ m.Call(i, i, j, i);
+ CHECK_EQ(Add4(i, i, j, i), result);
- m.Call(*i, *j, *i, *i);
- CHECK_EQ(Add4(*i, *j, *i, *i), result);
+ m.Call(i, j, i, i);
+ CHECK_EQ(Add4(i, j, i, i), result);
- m.Call(*j, *i, *i, *i);
- CHECK_EQ(Add4(*j, *i, *i, *i), result);
+ m.Call(j, i, i, i);
+ CHECK_EQ(Add4(j, i, i, i), result);
}
}
}
diff --git a/deps/v8/test/cctest/compiler/codegen-tester.h b/deps/v8/test/cctest/compiler/codegen-tester.h
index dc35a6b928..93d93e1671 100644
--- a/deps/v8/test/cctest/compiler/codegen-tester.h
+++ b/deps/v8/test/cctest/compiler/codegen-tester.h
@@ -139,7 +139,10 @@ class BufferedRawMachineAssemblerTester
template <typename... Params>
ReturnType Call(Params... p) {
+ uintptr_t zap_data[] = {kZapValue, kZapValue};
ReturnType return_value;
+ STATIC_ASSERT(sizeof(return_value) <= sizeof(zap_data));
+ MemCopy(&return_value, &zap_data, sizeof(return_value));
CSignature::VerifyParams<Params...>(test_graph_signature_);
CallHelper<int32_t>::Call(reinterpret_cast<void*>(&p)...,
reinterpret_cast<void*>(&return_value));
diff --git a/deps/v8/test/cctest/compiler/function-tester.cc b/deps/v8/test/cctest/compiler/function-tester.cc
index bb23d0644a..347f414b56 100644
--- a/deps/v8/test/cctest/compiler/function-tester.cc
+++ b/deps/v8/test/cctest/compiler/function-tester.cc
@@ -6,7 +6,6 @@
#include "src/api-inl.h"
#include "src/assembler.h"
-#include "src/compiler.h"
#include "src/compiler/linkage.h"
#include "src/compiler/pipeline.h"
#include "src/execution.h"
@@ -142,27 +141,8 @@ Handle<JSFunction> FunctionTester::ForMachineGraph(Graph* graph,
}
Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) {
- Handle<SharedFunctionInfo> shared(function->shared(), isolate);
- IsCompiledScope is_compiled_scope(shared->is_compiled_scope());
- CHECK(is_compiled_scope.is_compiled() ||
- Compiler::Compile(function, Compiler::CLEAR_EXCEPTION,
- &is_compiled_scope));
-
Zone zone(isolate->allocator(), ZONE_NAME);
- OptimizedCompilationInfo info(&zone, isolate, shared, function);
-
- if (flags_ & OptimizedCompilationInfo::kInliningEnabled) {
- info.MarkAsInliningEnabled();
- }
-
- CHECK(info.shared_info()->HasBytecodeArray());
- JSFunction::EnsureFeedbackVector(function);
-
- Handle<Code> code =
- Pipeline::GenerateCodeForTesting(&info, isolate).ToHandleChecked();
- info.native_context()->AddOptimizedCode(*code);
- function->set_code(*code);
- return function;
+ return Optimize(function, &zone, isolate, flags_);
}
// Compile the given machine graph instead of the source of the function
diff --git a/deps/v8/test/cctest/compiler/serializer-tester.cc b/deps/v8/test/cctest/compiler/serializer-tester.cc
new file mode 100644
index 0000000000..9b6d328159
--- /dev/null
+++ b/deps/v8/test/cctest/compiler/serializer-tester.cc
@@ -0,0 +1,219 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Serializer tests don't make sense in lite mode, as it doesn't gather
+// IC feedback.
+#ifndef V8_LITE_MODE
+
+#include "test/cctest/compiler/serializer-tester.h"
+
+#include "src/api-inl.h"
+#include "src/compiler/serializer-for-background-compilation.h"
+#include "src/compiler/zone-stats.h"
+#include "src/optimized-compilation-info.h"
+#include "src/zone/zone.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+SerializerTester::SerializerTester(const char* source)
+ : canonical_(main_isolate()) {
+ // The tests only make sense in the context of concurrent compilation.
+ FLAG_concurrent_inlining = true;
+ // The tests don't make sense when optimizations are turned off.
+ FLAG_opt = true;
+ // We need the IC to feed it to the serializer.
+ FLAG_use_ic = true;
+ // We need manual control over when a given function is optimized.
+ FLAG_always_opt = false;
+ // We need allocation of executable memory for the compilation.
+ FLAG_jitless = false;
+
+ std::string function_string = "(function() { ";
+ function_string += source;
+ function_string += " })();";
+ Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(function_string.c_str()))));
+ uint32_t flags = i::OptimizedCompilationInfo::kInliningEnabled |
+ i::OptimizedCompilationInfo::kFunctionContextSpecializing |
+ i::OptimizedCompilationInfo::kAccessorInliningEnabled |
+ i::OptimizedCompilationInfo::kLoopPeelingEnabled |
+ i::OptimizedCompilationInfo::kBailoutOnUninitialized |
+ i::OptimizedCompilationInfo::kAllocationFoldingEnabled |
+ i::OptimizedCompilationInfo::kSplittingEnabled |
+ i::OptimizedCompilationInfo::kAnalyzeEnvironmentLiveness;
+ Optimize(function, main_zone(), main_isolate(), flags, &broker_);
+ function_ = JSFunctionRef(broker_, function);
+}
+
+TEST(SerializeEmptyFunction) {
+ SerializerTester tester("function f() {}; return f;");
+ CHECK(tester.function().IsSerializedForCompilation());
+}
+
+// This helper function allows for testing weather an inlinee candidate
+// was properly serialized. It expects that the top-level function (that is
+// run through the SerializerTester) will return its inlinee candidate.
+void CheckForSerializedInlinee(const char* source, int argc = 0,
+ Handle<Object> argv[] = {}) {
+ SerializerTester tester(source);
+ JSFunctionRef f = tester.function();
+ CHECK(f.IsSerializedForCompilation());
+
+ MaybeHandle<Object> g_obj = Execution::Call(
+ tester.isolate(), tester.function().object(),
+ tester.isolate()->factory()->undefined_value(), argc, argv);
+ Handle<Object> g;
+ CHECK(g_obj.ToHandle(&g));
+
+ Handle<JSFunction> g_func = Handle<JSFunction>::cast(g);
+ SharedFunctionInfoRef g_sfi(tester.broker(),
+ handle(g_func->shared(), tester.isolate()));
+ FeedbackVectorRef g_fv(tester.broker(),
+ handle(g_func->feedback_vector(), tester.isolate()));
+ CHECK(g_sfi.IsSerializedForCompilation(g_fv));
+}
+
+TEST(SerializeInlinedClosure) {
+ CheckForSerializedInlinee(
+ "function f() {"
+ " return (function g(){ return g; })();"
+ "}; f(); return f;");
+}
+
+TEST(SerializeInlinedFunction) {
+ CheckForSerializedInlinee(
+ "function g() {};"
+ "function f() {"
+ " g(); return g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeCallUndefinedReceiver) {
+ CheckForSerializedInlinee(
+ "function g(a,b,c) {};"
+ "function f() {"
+ " g(1,2,3); return g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeCallUndefinedReceiver2) {
+ CheckForSerializedInlinee(
+ "function g(a,b) {};"
+ "function f() {"
+ " g(1,2); return g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeCallProperty) {
+ CheckForSerializedInlinee(
+ "let obj = {"
+ " g: function g(a,b,c) {}"
+ "};"
+ "function f() {"
+ " obj.g(1,2,3); return obj.g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeCallProperty2) {
+ CheckForSerializedInlinee(
+ "let obj = {"
+ " g: function g(a,b) {}"
+ "};"
+ "function f() {"
+ " obj.g(1,2); return obj.g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeCallAnyReceiver) {
+ CheckForSerializedInlinee(
+ "let obj = {"
+ " g: function g() {}"
+ "};"
+ "function f() {"
+ " with(obj) {"
+ " g(); return g;"
+ " };"
+ "};"
+ "f(); return f;");
+}
+
+TEST(SerializeCallWithSpread) {
+ CheckForSerializedInlinee(
+ "function g(args) {};"
+ "const arr = [1,2,3];"
+ "function f() {"
+ " g(...arr); return g;"
+ "}; f(); return f;");
+}
+
+// The following test causes the CallIC of `g` to turn megamorphic,
+// thus allowing us to test if we forward arguments hints (`callee` in this
+// example) and correctly serialize the inlining candidate `j`.
+TEST(SerializeCallArguments) {
+ CheckForSerializedInlinee(
+ "function g(callee) { callee(); };"
+ "function h() {};"
+ "function i() {};"
+ "g(h); g(i);"
+ "function f() {"
+ " function j() {};"
+ " g(j);"
+ " return j;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeConstruct) {
+ CheckForSerializedInlinee(
+ "function g() {};"
+ "function f() {"
+ " new g(); return g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeConstructWithSpread) {
+ CheckForSerializedInlinee(
+ "function g(a, b, c) {};"
+ "const arr = [1, 2];"
+ "function f() {"
+ " new g(0, ...arr); return g;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeConditionalJump) {
+ CheckForSerializedInlinee(
+ "function g(callee) { callee(); };"
+ "function h() {};"
+ "function i() {};"
+ "let a = true;"
+ "g(h); g(i);"
+ "function f() {"
+ " function q() {};"
+ " if (a) g(q);"
+ " return q;"
+ "}; f(); return f;");
+}
+
+TEST(SerializeUnconditionalJump) {
+ CheckForSerializedInlinee(
+ "function g(callee) { callee(); };"
+ "function h() {};"
+ "function i() {};"
+ "let a = false;"
+ "g(h); g(i);"
+ "function f() {"
+ " function p() {};"
+ " function q() {};"
+ " if (a) g(q);"
+ " else g(p);"
+ " return p;"
+ "}; f(); return f;");
+}
+
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif // V8_LITE_MODE
diff --git a/deps/v8/test/cctest/compiler/serializer-tester.h b/deps/v8/test/cctest/compiler/serializer-tester.h
new file mode 100644
index 0000000000..f5a5107841
--- /dev/null
+++ b/deps/v8/test/cctest/compiler/serializer-tester.h
@@ -0,0 +1,42 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_CCTEST_COMPILER_SERIALIZER_TESTER_H_
+#define V8_CCTEST_COMPILER_SERIALIZER_TESTER_H_
+
+#include "src/compiler/js-heap-broker.h"
+#include "test/cctest/cctest.h"
+
+namespace v8 {
+namespace internal {
+namespace compiler {
+
+class ZoneStats;
+
+// The purpose of this class is to provide testing facility for the
+// SerializerForBackgroundCompilation class. On a high-level, it executes the
+// following steps:
+// 1. Wraps the provided source in an IIFE
+// 2. Generates bytecode for the given source
+// 3. Runs the bytecode which *must* return a function
+// 4. Takes the returned function and optimizes it
+// 5. The optimized function is accessible through `function()`
+class SerializerTester : public HandleAndZoneScope {
+ public:
+ explicit SerializerTester(const char* source);
+
+ JSFunctionRef function() const { return function_.value(); }
+ JSHeapBroker* broker() const { return broker_; }
+ Isolate* isolate() { return main_isolate(); }
+
+ private:
+ CanonicalHandleScope canonical_;
+ base::Optional<JSFunctionRef> function_;
+ JSHeapBroker* broker_ = nullptr;
+};
+} // namespace compiler
+} // namespace internal
+} // namespace v8
+
+#endif // V8_CCTEST_COMPILER_SERIALIZER_TESTER_H_
diff --git a/deps/v8/test/cctest/compiler/test-branch-combine.cc b/deps/v8/test/cctest/compiler/test-branch-combine.cc
index 46240aa9b1..b36d61fbc6 100644
--- a/deps/v8/test/cctest/compiler/test-branch-combine.cc
+++ b/deps/v8/test/cctest/compiler/test-branch-combine.cc
@@ -32,8 +32,7 @@ TEST(BranchCombineWord32EqualZero_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- int32_t a = *i;
+ FOR_INT32_INPUTS(a) {
int32_t expect = a == 0 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -59,8 +58,7 @@ TEST(BranchCombineWord32EqualZero_chain) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- int32_t a = *i;
+ FOR_INT32_INPUTS(a) {
int32_t expect = (k & 1) == 1 ? (a == 0 ? eq_constant : ne_constant)
: (a == 0 ? ne_constant : eq_constant);
CHECK_EQ(expect, m.Call(a));
@@ -83,8 +81,7 @@ TEST(BranchCombineInt32LessThanZero_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- int32_t a = *i;
+ FOR_INT32_INPUTS(a) {
int32_t expect = a < 0 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -105,8 +102,7 @@ TEST(BranchCombineUint32LessThan100_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_UINT32_INPUTS(i) {
- uint32_t a = *i;
+ FOR_UINT32_INPUTS(a) {
int32_t expect = a < 100 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -127,8 +123,7 @@ TEST(BranchCombineUint32LessThanOrEqual100_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_UINT32_INPUTS(i) {
- uint32_t a = *i;
+ FOR_UINT32_INPUTS(a) {
int32_t expect = a <= 100 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -149,8 +144,7 @@ TEST(BranchCombineZeroLessThanInt32_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- int32_t a = *i;
+ FOR_INT32_INPUTS(a) {
int32_t expect = 0 < a ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -171,8 +165,7 @@ TEST(BranchCombineInt32GreaterThanZero_1) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- int32_t a = *i;
+ FOR_INT32_INPUTS(a) {
int32_t expect = a > 0 ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a));
}
@@ -195,10 +188,8 @@ TEST(BranchCombineWord32EqualP) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = a == b ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -211,9 +202,8 @@ TEST(BranchCombineWord32EqualI) {
int32_t ne_constant = 925718;
for (int left = 0; left < 2; left++) {
- FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(a) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- int32_t a = *i;
Node* p0 = m.Int32Constant(a);
Node* p1 = m.Parameter(0);
@@ -226,8 +216,7 @@ TEST(BranchCombineWord32EqualI) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(j) {
- int32_t b = *j;
+ FOR_INT32_INPUTS(b) {
int32_t expect = a == b ? eq_constant : ne_constant;
CHECK_EQ(expect, m.Call(b));
}
@@ -254,10 +243,8 @@ TEST(BranchCombineInt32CmpP) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = 0;
if (op == 0) expect = a < b ? eq_constant : ne_constant;
if (op == 1) expect = a <= b ? eq_constant : ne_constant;
@@ -273,9 +260,8 @@ TEST(BranchCombineInt32CmpI) {
int32_t ne_constant = 927711;
for (int op = 0; op < 2; op++) {
- FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(a) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- int32_t a = *i;
Node* p0 = m.Int32Constant(a);
Node* p1 = m.Parameter(0);
@@ -287,8 +273,7 @@ TEST(BranchCombineInt32CmpI) {
m.Bind(&blockb);
m.Return(m.Int32Constant(ne_constant));
- FOR_INT32_INPUTS(j) {
- int32_t b = *j;
+ FOR_INT32_INPUTS(b) {
int32_t expect = 0;
if (op == 0) expect = a < b ? eq_constant : ne_constant;
if (op == 1) expect = a <= b ? eq_constant : ne_constant;
@@ -498,10 +483,8 @@ TEST(BranchCombineInt32AddLessThanZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect =
(base::AddWithWraparound(a, b) < 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
@@ -527,10 +510,8 @@ TEST(BranchCombineInt32AddGreaterThanOrEqualZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect =
(base::AddWithWraparound(a, b) >= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
@@ -556,10 +537,8 @@ TEST(BranchCombineInt32ZeroGreaterThanAdd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect =
(0 > base::AddWithWraparound(a, b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
@@ -585,10 +564,8 @@ TEST(BranchCombineInt32ZeroLessThanOrEqualAdd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect =
(0 <= base::AddWithWraparound(a, b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
@@ -614,10 +591,8 @@ TEST(BranchCombineUint32AddLessThanOrEqualZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (a + b <= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -642,10 +617,8 @@ TEST(BranchCombineUint32AddGreaterThanZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (a + b > 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -670,10 +643,8 @@ TEST(BranchCombineUint32ZeroGreaterThanOrEqualAdd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (0 >= a + b) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -698,10 +669,8 @@ TEST(BranchCombineUint32ZeroLessThanAdd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_UINT32_INPUTS(i) {
- FOR_UINT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (0 < a + b) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -726,10 +695,8 @@ TEST(BranchCombineWord32AndLessThanZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = ((a & b) < 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -754,10 +721,8 @@ TEST(BranchCombineWord32AndGreaterThanOrEqualZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = ((a & b) >= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -782,10 +747,8 @@ TEST(BranchCombineInt32ZeroGreaterThanAnd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = (0 > (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -810,10 +773,8 @@ TEST(BranchCombineInt32ZeroLessThanOrEqualAnd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int32_t a = *i;
- int32_t b = *j;
+ FOR_INT32_INPUTS(a) {
+ FOR_INT32_INPUTS(b) {
int32_t expect = (0 <= (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -838,10 +799,8 @@ TEST(BranchCombineUint32AndLessThanOrEqualZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = ((a & b) <= 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -866,10 +825,8 @@ TEST(BranchCombineUint32AndGreaterThanZero) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = ((a & b) > 0) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -894,10 +851,8 @@ TEST(BranchCombineUint32ZeroGreaterThanOrEqualAnd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (0 >= (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
@@ -922,10 +877,8 @@ TEST(BranchCombineUint32ZeroLessThanAnd) {
m.Bind(&blockb);
m.Return(m.Int32Constant(f_constant));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- uint32_t a = *i;
- uint32_t b = *j;
+ FOR_UINT32_INPUTS(a) {
+ FOR_UINT32_INPUTS(b) {
int32_t expect = (0 < (a & b)) ? t_constant : f_constant;
CHECK_EQ(expect, m.Call(a, b));
}
diff --git a/deps/v8/test/cctest/compiler/test-code-generator.cc b/deps/v8/test/cctest/compiler/test-code-generator.cc
index 6125ef4bdb..ed39225747 100644
--- a/deps/v8/test/cctest/compiler/test-code-generator.cc
+++ b/deps/v8/test/cctest/compiler/test-code-generator.cc
@@ -29,8 +29,10 @@ namespace {
int GetSlotSizeInBytes(MachineRepresentation rep) {
switch (rep) {
case MachineRepresentation::kTagged:
+ // Spill slots for tagged values are always uncompressed.
+ return kSystemPointerSize;
case MachineRepresentation::kFloat32:
- return kPointerSize;
+ return kSystemPointerSize;
case MachineRepresentation::kFloat64:
return kDoubleSize;
case MachineRepresentation::kSimd128:
@@ -382,7 +384,7 @@ class TestEnvironment : public HandleAndZoneScope {
TestEnvironment()
: blocks_(1, NewBlock(main_zone(), RpoNumber::FromInt(0)), main_zone()),
- code_(main_isolate(), main_zone(), &blocks_),
+ instructions_(main_isolate(), main_zone(), &blocks_),
rng_(CcTest::random_number_generator()),
supported_reps_({MachineRepresentation::kTagged,
MachineRepresentation::kFloat32,
@@ -521,7 +523,7 @@ class TestEnvironment : public HandleAndZoneScope {
// Keep a map of (MachineRepresentation . std::vector<int>) with
// allocated slots to pick from for each representation.
int slot = slot_parameter_n;
- slot_parameter_n -= (GetSlotSizeInBytes(rep) / kPointerSize);
+ slot_parameter_n -= (GetSlotSizeInBytes(rep) / kSystemPointerSize);
AddStackSlot(&test_signature, rep, slot);
entry->second--;
}
@@ -535,7 +537,7 @@ class TestEnvironment : public HandleAndZoneScope {
for (int i = 0; i < kSmiConstantCount; i++) {
intptr_t smi_value = static_cast<intptr_t>(
Smi::FromInt(rng_->NextInt(Smi::kMaxValue)).ptr());
- Constant constant = kPointerSize == 8
+ Constant constant = kSystemPointerSize == 8
? Constant(static_cast<int64_t>(smi_value))
: Constant(static_cast<int32_t>(smi_value));
AddConstant(MachineRepresentation::kTagged, AllocateConstant(constant));
@@ -573,8 +575,8 @@ class TestEnvironment : public HandleAndZoneScope {
}
int AllocateConstant(Constant constant) {
- int virtual_register = code_.NextVirtualRegister();
- code_.AddConstant(virtual_register, constant);
+ int virtual_register = instructions_.NextVirtualRegister();
+ instructions_.AddConstant(virtual_register, constant);
return virtual_register;
}
@@ -721,8 +723,8 @@ class TestEnvironment : public HandleAndZoneScope {
OperandToStatePosition(AllocatedOperand::cast(move->destination()));
InstructionOperand from = move->source();
if (from.IsConstant()) {
- Constant constant =
- code_.GetConstant(ConstantOperand::cast(from).virtual_register());
+ Constant constant = instructions_.GetConstant(
+ ConstantOperand::cast(from).virtual_register());
Handle<Object> constant_value;
switch (constant.type()) {
case Constant::kInt32:
@@ -924,13 +926,13 @@ class TestEnvironment : public HandleAndZoneScope {
}
v8::base::RandomNumberGenerator* rng() const { return rng_; }
- InstructionSequence* code() { return &code_; }
+ InstructionSequence* instructions() { return &instructions_; }
CallDescriptor* test_descriptor() { return test_descriptor_; }
int stack_slot_count() const { return stack_slot_count_; }
private:
ZoneVector<InstructionBlock*> blocks_;
- InstructionSequence code_;
+ InstructionSequence instructions_;
v8::base::RandomNumberGenerator* rng_;
// The layout describes the type of each element in the environment, in order.
std::vector<AllocatedOperand> layout_;
@@ -995,9 +997,10 @@ class CodeGeneratorTester {
}
generator_ = new CodeGenerator(
- environment->main_zone(), &frame_, &linkage_, environment->code(),
- &info_, environment->main_isolate(), base::Optional<OsrHelper>(),
- kNoSourcePosition, nullptr, PoisoningMitigationLevel::kDontPoison,
+ environment->main_zone(), &frame_, &linkage_,
+ environment->instructions(), &info_, environment->main_isolate(),
+ base::Optional<OsrHelper>(), kNoSourcePosition, nullptr,
+ PoisoningMitigationLevel::kDontPoison,
AssemblerOptions::Default(environment->main_isolate()),
Builtins::kNoBuiltinId);
@@ -1109,6 +1112,8 @@ class CodeGeneratorTester {
generator_->FinishCode();
generator_->safepoints()->Emit(generator_->tasm(),
frame_.GetTotalFrameSlotCount());
+ generator_->MaybeEmitOutOfLineConstantPool();
+
return generator_->FinalizeCode().ToHandleChecked();
}
@@ -1121,7 +1126,7 @@ class CodeGeneratorTester {
generator_->AssembleMove(&move.second, &move.first);
}
- InstructionSequence* sequence = generator_->code();
+ InstructionSequence* sequence = generator_->instructions();
sequence->StartBlock(RpoNumber::FromInt(0));
// The environment expects this code to tail-call to it's first parameter
diff --git a/deps/v8/test/cctest/compiler/test-js-constant-cache.cc b/deps/v8/test/cctest/compiler/test-js-constant-cache.cc
index a31700ede2..23711bb3e7 100644
--- a/deps/v8/test/cctest/compiler/test-js-constant-cache.cc
+++ b/deps/v8/test/cctest/compiler/test-js-constant-cache.cc
@@ -167,9 +167,9 @@ TEST(CanonicalizingNumbers) {
JSConstantCacheTester T;
FOR_FLOAT64_INPUTS(i) {
- Node* node = T.Constant(*i);
+ Node* node = T.Constant(i);
for (int j = 0; j < 5; j++) {
- CHECK_EQ(node, T.Constant(*i));
+ CHECK_EQ(node, T.Constant(i));
}
}
}
@@ -178,8 +178,7 @@ TEST(CanonicalizingNumbers) {
TEST(HeapNumbers) {
JSConstantCacheTester T;
- FOR_FLOAT64_INPUTS(i) {
- double value = *i;
+ FOR_FLOAT64_INPUTS(value) {
Handle<Object> num = T.factory()->NewNumber(value);
Handle<HeapNumber> heap = T.factory()->NewHeapNumber(value);
Node* node1 = T.Constant(value);
diff --git a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc
index 073891a52b..61736ae2dc 100644
--- a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc
+++ b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc
@@ -256,11 +256,8 @@ TEST(ReduceWord32And) {
ReducerTester R;
R.binop = R.machine.Word32And();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x & y, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x & y, x, y); }
}
R.CheckPutConstantOnRight(33);
@@ -282,11 +279,8 @@ TEST(ReduceWord32Or) {
ReducerTester R;
R.binop = R.machine.Word32Or();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x | y, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x | y, x, y); }
}
R.CheckPutConstantOnRight(36);
@@ -308,11 +302,8 @@ TEST(ReduceWord32Xor) {
ReducerTester R;
R.binop = R.machine.Word32Xor();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x ^ y, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x ^ y, x, y); }
}
R.CheckPutConstantOnRight(39);
@@ -332,10 +323,9 @@ TEST(ReduceWord32Shl) {
R.binop = R.machine.Word32Shl();
// TODO(titzer): out of range shifts
- FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(x) {
for (int y = 0; y < 32; y++) {
- int32_t x = *i;
- R.CheckFoldBinop<int32_t>(x << y, x, y);
+ R.CheckFoldBinop<int32_t>(base::ShlWithWraparound(x, y), x, y);
}
}
@@ -351,10 +341,9 @@ TEST(ReduceWord64Shl) {
ReducerTester R;
R.binop = R.machine.Word64Shl();
- FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(x) {
for (int64_t y = 0; y < 64; y++) {
- int64_t x = *i;
- R.CheckFoldBinop<int64_t>(x << y, x, y);
+ R.CheckFoldBinop<int64_t>(base::ShlWithWraparound(x, y), x, y);
}
}
@@ -371,9 +360,8 @@ TEST(ReduceWord32Shr) {
R.binop = R.machine.Word32Shr();
// TODO(titzer): test out of range shifts
- FOR_UINT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(x) {
for (uint32_t y = 0; y < 32; y++) {
- uint32_t x = *i;
R.CheckFoldBinop<int32_t>(x >> y, x, y);
}
}
@@ -390,9 +378,8 @@ TEST(ReduceWord64Shr) {
ReducerTester R;
R.binop = R.machine.Word64Shr();
- FOR_UINT64_INPUTS(i) {
+ FOR_UINT64_INPUTS(x) {
for (uint64_t y = 0; y < 64; y++) {
- uint64_t x = *i;
R.CheckFoldBinop<int64_t>(x >> y, x, y);
}
}
@@ -410,9 +397,8 @@ TEST(ReduceWord32Sar) {
R.binop = R.machine.Word32Sar();
// TODO(titzer): test out of range shifts
- FOR_INT32_INPUTS(i) {
+ FOR_INT32_INPUTS(x) {
for (int32_t y = 0; y < 32; y++) {
- int32_t x = *i;
R.CheckFoldBinop<int32_t>(x >> y, x, y);
}
}
@@ -429,9 +415,8 @@ TEST(ReduceWord64Sar) {
ReducerTester R;
R.binop = R.machine.Word64Sar();
- FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(x) {
for (int64_t y = 0; y < 64; y++) {
- int64_t x = *i;
R.CheckFoldBinop<int64_t>(x >> y, x, y);
}
}
@@ -477,11 +462,8 @@ TEST(Word32Equal) {
ReducerTester R;
R.binop = R.machine.Word32Equal();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x == y ? 1 : 0, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x == y ? 1 : 0, x, y); }
}
R.CheckPutConstantOnRight(48);
@@ -502,9 +484,8 @@ TEST(ReduceInt32Add) {
ReducerTester R;
R.binop = R.machine.Int32Add();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
R.CheckFoldBinop<int32_t>(base::AddWithWraparound(x, y), x, y);
}
}
@@ -523,9 +504,8 @@ TEST(ReduceInt64Add) {
ReducerTester R;
R.binop = R.machine.Int64Add();
- FOR_INT64_INPUTS(pl) {
- FOR_INT64_INPUTS(pr) {
- int64_t x = *pl, y = *pr;
+ FOR_INT64_INPUTS(x) {
+ FOR_INT64_INPUTS(y) {
R.CheckFoldBinop<int64_t>(base::AddWithWraparound(x, y), x, y);
}
}
@@ -542,9 +522,8 @@ TEST(ReduceInt32Sub) {
ReducerTester R;
R.binop = R.machine.Int32Sub();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
R.CheckFoldBinop<int32_t>(base::SubWithWraparound(x, y), x, y);
}
}
@@ -561,9 +540,8 @@ TEST(ReduceInt64Sub) {
ReducerTester R;
R.binop = R.machine.Int64Sub();
- FOR_INT64_INPUTS(pl) {
- FOR_INT64_INPUTS(pr) {
- int64_t x = *pl, y = *pr;
+ FOR_INT64_INPUTS(x) {
+ FOR_INT64_INPUTS(y) {
R.CheckFoldBinop<int64_t>(base::SubWithWraparound(x, y), x, y);
}
}
@@ -586,9 +564,8 @@ TEST(ReduceInt32Mul) {
ReducerTester R;
R.binop = R.machine.Int32Mul();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
R.CheckFoldBinop<int32_t>(base::MulWithWraparound(x, y), x, y);
}
}
@@ -624,9 +601,8 @@ TEST(ReduceInt32Div) {
ReducerTester R;
R.binop = R.machine.Int32Div();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
if (y == 0) continue; // TODO(titzer): test / 0
int32_t r = y == -1 ? base::NegateWithWraparound(x)
: x / y; // INT_MIN / -1 may explode in C
@@ -653,9 +629,8 @@ TEST(ReduceUint32Div) {
ReducerTester R;
R.binop = R.machine.Uint32Div();
- FOR_UINT32_INPUTS(pl) {
- FOR_UINT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) {
if (y == 0) continue; // TODO(titzer): test / 0
R.CheckFoldBinop<int32_t>(x / y, x, y);
}
@@ -682,9 +657,8 @@ TEST(ReduceInt32Mod) {
ReducerTester R;
R.binop = R.machine.Int32Mod();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) {
if (y == 0) continue; // TODO(titzer): test % 0
int32_t r = y == -1 ? 0 : x % y; // INT_MIN % -1 may explode in C
R.CheckFoldBinop<int32_t>(r, x, y);
@@ -706,9 +680,8 @@ TEST(ReduceUint32Mod) {
ReducerTester R;
R.binop = R.machine.Uint32Mod();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) {
if (y == 0) continue; // TODO(titzer): test x % 0
R.CheckFoldBinop<int32_t>(x % y, x, y);
}
@@ -734,11 +707,8 @@ TEST(ReduceInt32LessThan) {
ReducerTester R;
R.binop = R.machine.Int32LessThan();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y); }
}
R.CheckDontPutConstantOnRight(41399);
@@ -754,14 +724,11 @@ TEST(ReduceInt32LessThanOrEqual) {
ReducerTester R;
R.binop = R.machine.Int32LessThanOrEqual();
- FOR_INT32_INPUTS(pl) {
- FOR_INT32_INPUTS(pr) {
- int32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y);
- }
+ FOR_INT32_INPUTS(x) {
+ FOR_INT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y); }
}
- FOR_INT32_INPUTS(i) { R.CheckDontPutConstantOnRight<int32_t>(*i); }
+ FOR_INT32_INPUTS(i) { R.CheckDontPutConstantOnRight<int32_t>(i); }
Node* x = R.Parameter(0);
@@ -773,11 +740,8 @@ TEST(ReduceUint32LessThan) {
ReducerTester R;
R.binop = R.machine.Uint32LessThan();
- FOR_UINT32_INPUTS(pl) {
- FOR_UINT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y);
- }
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x < y ? 1 : 0, x, y); }
}
R.CheckDontPutConstantOnRight(41399);
@@ -797,11 +761,8 @@ TEST(ReduceUint32LessThanOrEqual) {
ReducerTester R;
R.binop = R.machine.Uint32LessThanOrEqual();
- FOR_UINT32_INPUTS(pl) {
- FOR_UINT32_INPUTS(pr) {
- uint32_t x = *pl, y = *pr;
- R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y);
- }
+ FOR_UINT32_INPUTS(x) {
+ FOR_UINT32_INPUTS(y) { R.CheckFoldBinop<int32_t>(x <= y ? 1 : 0, x, y); }
}
R.CheckDontPutConstantOnRight(41399);
@@ -846,11 +807,8 @@ TEST(ReduceFloat32Sub) {
ReducerTester R;
R.binop = R.machine.Float32Sub();
- FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) {
- float x = *pl, y = *pr;
- R.CheckFoldBinop<float>(x - y, x, y);
- }
+ FOR_FLOAT32_INPUTS(x) {
+ FOR_FLOAT32_INPUTS(y) { R.CheckFoldBinop<float>(x - y, x, y); }
}
Node* x = R.Parameter();
@@ -866,11 +824,8 @@ TEST(ReduceFloat64Sub) {
ReducerTester R;
R.binop = R.machine.Float64Sub();
- FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- double x = *pl, y = *pr;
- R.CheckFoldBinop<double>(x - y, x, y);
- }
+ FOR_FLOAT64_INPUTS(x) {
+ FOR_FLOAT64_INPUTS(y) { R.CheckFoldBinop<double>(x - y, x, y); }
}
Node* x = R.Parameter();
diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc
index bf5e829509..7f35b1b0ee 100644
--- a/deps/v8/test/cctest/compiler/test-multiple-return.cc
+++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc
@@ -125,7 +125,7 @@ std::unique_ptr<wasm::NativeModule> AllocateNativeModule(Isolate* isolate,
// We have to add the code object to a NativeModule, because the
// WasmCallDescriptor assumes that code is on the native heap and not
// within a code object.
- return isolate->wasm_engine()->code_manager()->NewNativeModule(
+ return isolate->wasm_engine()->NewNativeModule(
isolate, wasm::kAllWasmFeatures, code_size, false, std::move(module));
}
diff --git a/deps/v8/test/cctest/compiler/test-representation-change.cc b/deps/v8/test/cctest/compiler/test-representation-change.cc
index f4218467f7..3f1cbaad24 100644
--- a/deps/v8/test/cctest/compiler/test-representation-change.cc
+++ b/deps/v8/test/cctest/compiler/test-representation-change.cc
@@ -261,12 +261,12 @@ TEST(ToInt32_constant) {
RepresentationChangerTester r;
{
FOR_INT32_INPUTS(i) {
- Node* n = r.jsgraph()->Constant(*i);
+ Node* n = r.jsgraph()->Constant(i);
Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
n, MachineRepresentation::kTagged, Type::Signed32(), use,
UseInfo(MachineRepresentation::kWord32, Truncation::None()));
- r.CheckInt32Constant(c, *i);
+ r.CheckInt32Constant(c, i);
}
}
}
@@ -274,24 +274,24 @@ TEST(ToInt32_constant) {
TEST(ToUint32_constant) {
RepresentationChangerTester r;
FOR_UINT32_INPUTS(i) {
- Node* n = r.jsgraph()->Constant(static_cast<double>(*i));
+ Node* n = r.jsgraph()->Constant(static_cast<double>(i));
Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
n, MachineRepresentation::kTagged, Type::Unsigned32(), use,
UseInfo(MachineRepresentation::kWord32, Truncation::None()));
- r.CheckUint32Constant(c, *i);
+ r.CheckUint32Constant(c, i);
}
}
TEST(ToInt64_constant) {
RepresentationChangerTester r;
FOR_INT32_INPUTS(i) {
- Node* n = r.jsgraph()->Constant(*i);
+ Node* n = r.jsgraph()->Constant(i);
Node* use = r.Return(n);
Node* c = r.changer()->GetRepresentationFor(
n, MachineRepresentation::kTagged, TypeCache::Get()->kSafeInteger, use,
UseInfo(MachineRepresentation::kWord64, Truncation::None()));
- r.CheckInt64Constant(c, *i);
+ r.CheckInt64Constant(c, i);
}
}
@@ -692,8 +692,6 @@ TEST(Nops) {
MachineRepresentation::kWord16);
r.CheckNop(MachineRepresentation::kBit, Type::Boolean(),
MachineRepresentation::kWord32);
- r.CheckNop(MachineRepresentation::kBit, Type::Boolean(),
- MachineRepresentation::kWord64);
}
diff --git a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc
index 775ffadfd4..b6043f2a9d 100644
--- a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc
+++ b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc
@@ -2891,7 +2891,7 @@ TEST(BytecodeGraphBuilderIllegalConstDeclaration) {
ExpectedSnippet<0, const char*> illegal_const_decl[] = {
{"const x = x = 10 + 3; return x;",
- {"Uncaught ReferenceError: x is not defined"}},
+ {"Uncaught ReferenceError: Cannot access 'x' before initialization"}},
{"const x = 10; x = 20; return x;",
{"Uncaught TypeError: Assignment to constant variable."}},
{"const x = 10; { x = 20; } return x;",
@@ -2899,7 +2899,7 @@ TEST(BytecodeGraphBuilderIllegalConstDeclaration) {
{"const x = 10; eval('x = 20;'); return x;",
{"Uncaught TypeError: Assignment to constant variable."}},
{"let x = x + 10; return x;",
- {"Uncaught ReferenceError: x is not defined"}},
+ {"Uncaught ReferenceError: Cannot access 'x' before initialization"}},
{"'use strict'; (function f1() { f1 = 123; })() ",
{"Uncaught TypeError: Assignment to constant variable."}},
};
diff --git a/deps/v8/test/cctest/compiler/test-run-load-store.cc b/deps/v8/test/cctest/compiler/test-run-load-store.cc
index ffee5310d2..26d681299d 100644
--- a/deps/v8/test/cctest/compiler/test-run-load-store.cc
+++ b/deps/v8/test/cctest/compiler/test-run-load-store.cc
@@ -52,7 +52,7 @@ void RunLoadInt32(const TestAlignment t) {
}
FOR_INT32_INPUTS(i) {
- p1 = *i;
+ p1 = i;
CHECK_EQ(p1, m.Call());
}
}
@@ -79,7 +79,7 @@ void RunLoadInt32Offset(TestAlignment t) {
}
FOR_INT32_INPUTS(j) {
- p1 = *j;
+ p1 = j;
CHECK_EQ(p1, m.Call());
}
}
@@ -91,9 +91,9 @@ void RunLoadStoreFloat32Offset(TestAlignment t) {
FOR_INT32_INPUTS(i) {
int32_t magic =
- base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(*i, 3));
+ base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(i, 3));
RawMachineAssemblerTester<int32_t> m;
- int32_t offset = *i;
+ int32_t offset = i;
byte* from = reinterpret_cast<byte*>(&p1) - offset;
byte* to = reinterpret_cast<byte*>(&p2) - offset;
// generate load [#base + #index]
@@ -115,8 +115,8 @@ void RunLoadStoreFloat32Offset(TestAlignment t) {
m.Return(m.Int32Constant(magic));
FOR_FLOAT32_INPUTS(j) {
- p1 = *j;
- p2 = *j - 5;
+ p1 = j;
+ p2 = j - 5;
CHECK_EQ(magic, m.Call());
CHECK_DOUBLE_EQ(p1, p2);
}
@@ -129,9 +129,9 @@ void RunLoadStoreFloat64Offset(TestAlignment t) {
FOR_INT32_INPUTS(i) {
int32_t magic =
- base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(*i, 3));
+ base::AddWithWraparound(0x2342AABB, base::MulWithWraparound(i, 3));
RawMachineAssemblerTester<int32_t> m;
- int32_t offset = *i;
+ int32_t offset = i;
byte* from = reinterpret_cast<byte*>(&p1) - offset;
byte* to = reinterpret_cast<byte*>(&p2) - offset;
// generate load [#base + #index]
@@ -152,8 +152,8 @@ void RunLoadStoreFloat64Offset(TestAlignment t) {
m.Return(m.Int32Constant(magic));
FOR_FLOAT64_INPUTS(j) {
- p1 = *j;
- p2 = *j - 5;
+ p1 = j;
+ p2 = j - 5;
CHECK_EQ(magic, m.Call());
CHECK_DOUBLE_EQ(p1, p2);
}
@@ -189,6 +189,36 @@ TEST(RunUnalignedLoadStoreFloat64Offset) {
namespace {
+// Mostly same as CHECK_EQ() but customized for compressed tagged values.
+template <typename CType>
+void CheckEq(CType in_value, CType out_value) {
+ CHECK_EQ(in_value, out_value);
+}
+
+#ifdef V8_COMPRESS_POINTERS
+// Specializations for checking the result of compressing store.
+template <>
+void CheckEq<Object>(Object in_value, Object out_value) {
+ Isolate* isolate = CcTest::InitIsolateOnce();
+ // |out_value| is compressed. Check that it's valid.
+ CHECK_EQ(CompressTagged(in_value->ptr()), out_value->ptr());
+ STATIC_ASSERT(kTaggedSize == kSystemPointerSize);
+ CHECK_EQ(in_value->ptr(),
+ DecompressTaggedAny(isolate->isolate_root(),
+ static_cast<int32_t>(out_value->ptr())));
+}
+
+template <>
+void CheckEq<HeapObject>(HeapObject in_value, HeapObject out_value) {
+ return CheckEq<Object>(in_value, out_value);
+}
+
+template <>
+void CheckEq<Smi>(Smi in_value, Smi out_value) {
+ return CheckEq<Object>(in_value, out_value);
+}
+#endif
+
// Initializes the buffer with some raw data respecting requested representation
// of the values.
template <typename CType>
@@ -239,7 +269,7 @@ void RunLoadImmIndex(MachineType rep, TestAlignment t) {
// When pointer compression is enabled then we need to access only
// the lower 32-bit of the tagged value while the buffer contains
// full 64-bit values.
- base_pointer = LSB(base_pointer, kPointerSize / 2);
+ base_pointer = LSB(base_pointer, kSystemPointerSize / 2);
}
#endif
Node* base = m.PointerConstant(base_pointer);
@@ -252,27 +282,21 @@ void RunLoadImmIndex(MachineType rep, TestAlignment t) {
UNREACHABLE();
}
- CHECK_EQ(buffer[i], m.Call());
+ CheckEq<CType>(buffer[i], m.Call());
}
}
}
template <typename CType>
-CType NullValue() {
- return CType{0};
-}
-
-template <>
-HeapObject NullValue<HeapObject>() {
- return HeapObject();
-}
-
-template <typename CType>
void RunLoadStore(MachineType rep, TestAlignment t) {
const int kNumElems = 16;
CType in_buffer[kNumElems];
CType out_buffer[kNumElems];
+ uintptr_t zap_data[] = {kZapValue, kZapValue};
+ CType zap_value;
+ STATIC_ASSERT(sizeof(CType) <= sizeof(zap_data));
+ MemCopy(&zap_value, &zap_data, sizeof(CType));
InitBuffer(in_buffer, kNumElems, rep);
for (int32_t x = 0; x < kNumElems; x++) {
@@ -294,12 +318,15 @@ void RunLoadStore(MachineType rep, TestAlignment t) {
m.Return(m.Int32Constant(OK));
- memset(out_buffer, 0, sizeof(out_buffer));
+ for (int32_t z = 0; z < kNumElems; z++) {
+ out_buffer[z] = zap_value;
+ }
CHECK_NE(in_buffer[x], out_buffer[y]);
CHECK_EQ(OK, m.Call());
- CHECK_EQ(in_buffer[x], out_buffer[y]);
+ // Mostly same as CHECK_EQ() but customized for compressed tagged values.
+ CheckEq<CType>(in_buffer[x], out_buffer[y]);
for (int32_t z = 0; z < kNumElems; z++) {
- if (z != y) CHECK_EQ(NullValue<CType>(), out_buffer[z]);
+ if (z != y) CHECK_EQ(zap_value, out_buffer[z]);
}
}
}
@@ -335,7 +362,8 @@ void RunUnalignedLoadStoreUnalignedAccess(MachineType rep) {
// Direct read of &out_buffer[y] may cause unaligned access in C++ code
// so we use MemCopy() to handle that.
MemCopy(&out, &out_buffer[y], sizeof(CType));
- CHECK_EQ(in, out);
+ // Mostly same as CHECK_EQ() but customized for compressed tagged values.
+ CheckEq<CType>(in, out);
}
}
}
@@ -458,12 +486,12 @@ void RunLoadStoreSignExtend32(TestAlignment t) {
m.Return(load8);
FOR_INT32_INPUTS(i) {
- buffer[0] = *i;
+ buffer[0] = i;
- CHECK_EQ(static_cast<int8_t>(*i & 0xFF), m.Call());
- CHECK_EQ(static_cast<int8_t>(*i & 0xFF), buffer[1]);
- CHECK_EQ(static_cast<int16_t>(*i & 0xFFFF), buffer[2]);
- CHECK_EQ(*i, buffer[3]);
+ CHECK_EQ(static_cast<int8_t>(i & 0xFF), m.Call());
+ CHECK_EQ(static_cast<int8_t>(i & 0xFF), buffer[1]);
+ CHECK_EQ(static_cast<int16_t>(i & 0xFFFF), buffer[2]);
+ CHECK_EQ(i, buffer[3]);
}
}
@@ -491,12 +519,12 @@ void RunLoadStoreZeroExtend32(TestAlignment t) {
m.Return(load8);
FOR_UINT32_INPUTS(i) {
- buffer[0] = *i;
+ buffer[0] = i;
- CHECK_EQ((*i & 0xFF), m.Call());
- CHECK_EQ((*i & 0xFF), buffer[1]);
- CHECK_EQ((*i & 0xFFFF), buffer[2]);
- CHECK_EQ(*i, buffer[3]);
+ CHECK_EQ((i & 0xFF), m.Call());
+ CHECK_EQ((i & 0xFF), buffer[1]);
+ CHECK_EQ((i & 0xFFFF), buffer[2]);
+ CHECK_EQ(i, buffer[3]);
}
}
} // namespace
@@ -552,18 +580,18 @@ void RunLoadStoreSignExtend64(TestAlignment t) {
m.Return(load8);
FOR_INT64_INPUTS(i) {
- buffer[0] = *i;
+ buffer[0] = i;
- CHECK_EQ(static_cast<int8_t>(*i & 0xFF), m.Call());
- CHECK_EQ(static_cast<int8_t>(*i & 0xFF), buffer[1]);
- CHECK_EQ(static_cast<int16_t>(*i & 0xFFFF), buffer[2]);
- CHECK_EQ(static_cast<int32_t>(*i & 0xFFFFFFFF), buffer[3]);
- CHECK_EQ(*i, buffer[4]);
+ CHECK_EQ(static_cast<int8_t>(i & 0xFF), m.Call());
+ CHECK_EQ(static_cast<int8_t>(i & 0xFF), buffer[1]);
+ CHECK_EQ(static_cast<int16_t>(i & 0xFFFF), buffer[2]);
+ CHECK_EQ(static_cast<int32_t>(i & 0xFFFFFFFF), buffer[3]);
+ CHECK_EQ(i, buffer[4]);
}
}
void RunLoadStoreZeroExtend64(TestAlignment t) {
- if (kPointerSize < 8) return;
+ if (kSystemPointerSize < 8) return;
uint64_t buffer[5];
RawMachineAssemblerTester<uint64_t> m;
Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Uint8());
@@ -595,13 +623,13 @@ void RunLoadStoreZeroExtend64(TestAlignment t) {
m.Return(load8);
FOR_UINT64_INPUTS(i) {
- buffer[0] = *i;
+ buffer[0] = i;
- CHECK_EQ((*i & 0xFF), m.Call());
- CHECK_EQ((*i & 0xFF), buffer[1]);
- CHECK_EQ((*i & 0xFFFF), buffer[2]);
- CHECK_EQ((*i & 0xFFFFFFFF), buffer[3]);
- CHECK_EQ(*i, buffer[4]);
+ CHECK_EQ((i & 0xFF), m.Call());
+ CHECK_EQ((i & 0xFF), buffer[1]);
+ CHECK_EQ((i & 0xFFFF), buffer[2]);
+ CHECK_EQ((i & 0xFFFFFFFF), buffer[3]);
+ CHECK_EQ(i, buffer[4]);
}
}
diff --git a/deps/v8/test/cctest/compiler/test-run-machops.cc b/deps/v8/test/cctest/compiler/test-run-machops.cc
index 782e9b51b8..92e473c840 100644
--- a/deps/v8/test/cctest/compiler/test-run-machops.cc
+++ b/deps/v8/test/cctest/compiler/test-run-machops.cc
@@ -527,8 +527,8 @@ TEST(RunInt64AddWithOverflowP) {
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
int64_t expected_val;
- int expected_ovf = base::bits::SignedAddOverflow64(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, bt.call(*i, *j));
+ int expected_ovf = base::bits::SignedAddOverflow64(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, bt.call(i, j));
CHECK_EQ(expected_val, actual_val);
}
}
@@ -540,41 +540,39 @@ TEST(RunInt64AddWithOverflowImm) {
FOR_INT64_INPUTS(i) {
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
- Node* add = m.Int64AddWithOverflow(m.Int64Constant(*i), m.Parameter(0));
+ Node* add = m.Int64AddWithOverflow(m.Int64Constant(i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
FOR_INT64_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedAddOverflow64(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedAddOverflow64(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
- Node* add = m.Int64AddWithOverflow(m.Parameter(0), m.Int64Constant(*i));
+ Node* add = m.Int64AddWithOverflow(m.Parameter(0), m.Int64Constant(i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
FOR_INT64_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedAddOverflow64(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedAddOverflow64(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
FOR_INT64_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m;
Node* add =
- m.Int64AddWithOverflow(m.Int64Constant(*i), m.Int64Constant(*j));
+ m.Int64AddWithOverflow(m.Int64Constant(i), m.Int64Constant(j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
- int expected_ovf = base::bits::SignedAddOverflow64(*i, *j, &expected_val);
+ int expected_ovf = base::bits::SignedAddOverflow64(i, j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
CHECK_EQ(expected_val, actual_val);
}
@@ -600,10 +598,10 @@ TEST(RunInt64AddWithOverflowInBranchP) {
FOR_INT64_INPUTS(j) {
int32_t expected = constant;
int64_t result;
- if (!base::bits::SignedAddOverflow64(*i, *j, &result)) {
+ if (!base::bits::SignedAddOverflow64(i, j, &result)) {
expected = static_cast<int32_t>(result);
}
- CHECK_EQ(expected, bt.call(*i, *j));
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -621,8 +619,8 @@ TEST(RunInt64SubWithOverflowP) {
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
int64_t expected_val;
- int expected_ovf = base::bits::SignedSubOverflow64(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, bt.call(*i, *j));
+ int expected_ovf = base::bits::SignedSubOverflow64(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, bt.call(i, j));
CHECK_EQ(expected_val, actual_val);
}
}
@@ -634,41 +632,39 @@ TEST(RunInt64SubWithOverflowImm) {
FOR_INT64_INPUTS(i) {
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
- Node* add = m.Int64SubWithOverflow(m.Int64Constant(*i), m.Parameter(0));
+ Node* add = m.Int64SubWithOverflow(m.Int64Constant(i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
FOR_INT64_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedSubOverflow64(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedSubOverflow64(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int64());
- Node* add = m.Int64SubWithOverflow(m.Parameter(0), m.Int64Constant(*i));
+ Node* add = m.Int64SubWithOverflow(m.Parameter(0), m.Int64Constant(i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
FOR_INT64_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedSubOverflow64(*j, *i, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedSubOverflow64(j, i, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
FOR_INT64_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m;
Node* add =
- m.Int64SubWithOverflow(m.Int64Constant(*i), m.Int64Constant(*j));
+ m.Int64SubWithOverflow(m.Int64Constant(i), m.Int64Constant(j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord64, val);
m.Return(ovf);
- int expected_ovf = base::bits::SignedSubOverflow64(*i, *j, &expected_val);
+ int expected_ovf = base::bits::SignedSubOverflow64(i, j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
CHECK_EQ(expected_val, actual_val);
}
@@ -694,10 +690,10 @@ TEST(RunInt64SubWithOverflowInBranchP) {
FOR_INT64_INPUTS(j) {
int32_t expected = constant;
int64_t result;
- if (!base::bits::SignedSubOverflow64(*i, *j, &result)) {
+ if (!base::bits::SignedSubOverflow64(i, j, &result)) {
expected = static_cast<int32_t>(result);
}
- CHECK_EQ(expected, static_cast<int32_t>(bt.call(*i, *j)));
+ CHECK_EQ(expected, static_cast<int32_t>(bt.call(i, j)));
}
}
}
@@ -1249,9 +1245,9 @@ TEST(RunInt32AddP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
// Use uint32_t because signed overflow is UB in C.
- int expected = static_cast<int32_t>(static_cast<uint32_t>(*i) +
- static_cast<uint32_t>(*j));
- CHECK_EQ(expected, bt.call(*i, *j));
+ int expected = static_cast<int32_t>(static_cast<uint32_t>(i) +
+ static_cast<uint32_t>(j));
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1268,8 +1264,8 @@ TEST(RunInt32AddAndWord32EqualP) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>(bit_cast<uint32_t>(*i) + (*j == *k));
- CHECK_EQ(expected, m.Call(*i, *j, *k));
+ bit_cast<int32_t>(bit_cast<uint32_t>(i) + (j == k));
+ CHECK_EQ(expected, m.Call(i, j, k));
}
}
}
@@ -1284,8 +1280,8 @@ TEST(RunInt32AddAndWord32EqualP) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>((*i == *j) + bit_cast<uint32_t>(*k));
- CHECK_EQ(expected, m.Call(*i, *j, *k));
+ bit_cast<int32_t>((i == j) + bit_cast<uint32_t>(k));
+ CHECK_EQ(expected, m.Call(i, j, k));
}
}
}
@@ -1298,30 +1294,30 @@ TEST(RunInt32AddAndWord32EqualImm) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
MachineType::Int32());
- m.Return(m.Int32Add(m.Int32Constant(*i),
- m.Word32Equal(m.Parameter(0), m.Parameter(1))));
- FOR_INT32_INPUTS(j) {
- FOR_INT32_INPUTS(k) {
- // Use uint32_t because signed overflow is UB in C.
- int32_t const expected =
- bit_cast<int32_t>(bit_cast<uint32_t>(*i) + (*j == *k));
- CHECK_EQ(expected, m.Call(*j, *k));
- }
- }
+ m.Return(m.Int32Add(m.Int32Constant(i),
+ m.Word32Equal(m.Parameter(0), m.Parameter(1))));
+ FOR_INT32_INPUTS(j) {
+ FOR_INT32_INPUTS(k) {
+ // Use uint32_t because signed overflow is UB in C.
+ int32_t const expected =
+ bit_cast<int32_t>(bit_cast<uint32_t>(i) + (j == k));
+ CHECK_EQ(expected, m.Call(j, k));
+ }
+ }
}
}
{
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
MachineType::Int32());
- m.Return(m.Int32Add(m.Word32Equal(m.Int32Constant(*i), m.Parameter(0)),
+ m.Return(m.Int32Add(m.Word32Equal(m.Int32Constant(i), m.Parameter(0)),
m.Parameter(1)));
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>((*i == *j) + bit_cast<uint32_t>(*k));
- CHECK_EQ(expected, m.Call(*j, *k));
+ bit_cast<int32_t>((i == j) + bit_cast<uint32_t>(k));
+ CHECK_EQ(expected, m.Call(j, k));
}
}
}
@@ -1340,8 +1336,8 @@ TEST(RunInt32AddAndWord32NotEqualP) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>(bit_cast<uint32_t>(*i) + (*j != *k));
- CHECK_EQ(expected, m.Call(*i, *j, *k));
+ bit_cast<int32_t>(bit_cast<uint32_t>(i) + (j != k));
+ CHECK_EQ(expected, m.Call(i, j, k));
}
}
}
@@ -1356,8 +1352,8 @@ TEST(RunInt32AddAndWord32NotEqualP) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>((*i != *j) + bit_cast<uint32_t>(*k));
- CHECK_EQ(expected, m.Call(*i, *j, *k));
+ bit_cast<int32_t>((i != j) + bit_cast<uint32_t>(k));
+ CHECK_EQ(expected, m.Call(i, j, k));
}
}
}
@@ -1370,30 +1366,30 @@ TEST(RunInt32AddAndWord32NotEqualImm) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
MachineType::Int32());
- m.Return(m.Int32Add(m.Int32Constant(*i),
- m.Word32NotEqual(m.Parameter(0), m.Parameter(1))));
- FOR_INT32_INPUTS(j) {
- FOR_INT32_INPUTS(k) {
- // Use uint32_t because signed overflow is UB in C.
- int32_t const expected =
- bit_cast<int32_t>(bit_cast<uint32_t>(*i) + (*j != *k));
- CHECK_EQ(expected, m.Call(*j, *k));
- }
- }
+ m.Return(m.Int32Add(m.Int32Constant(i),
+ m.Word32NotEqual(m.Parameter(0), m.Parameter(1))));
+ FOR_INT32_INPUTS(j) {
+ FOR_INT32_INPUTS(k) {
+ // Use uint32_t because signed overflow is UB in C.
+ int32_t const expected =
+ bit_cast<int32_t>(bit_cast<uint32_t>(i) + (j != k));
+ CHECK_EQ(expected, m.Call(j, k));
+ }
+ }
}
}
{
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32(),
MachineType::Int32());
- m.Return(m.Int32Add(m.Word32NotEqual(m.Int32Constant(*i), m.Parameter(0)),
+ m.Return(m.Int32Add(m.Word32NotEqual(m.Int32Constant(i), m.Parameter(0)),
m.Parameter(1)));
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
int32_t const expected =
- bit_cast<int32_t>((*i != *j) + bit_cast<uint32_t>(*k));
- CHECK_EQ(expected, m.Call(*j, *k));
+ bit_cast<int32_t>((i != j) + bit_cast<uint32_t>(k));
+ CHECK_EQ(expected, m.Call(j, k));
}
}
}
@@ -1411,8 +1407,8 @@ TEST(RunInt32AddAndWord32SarP) {
FOR_INT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = *i + (*j >> shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = i + (j >> shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1426,8 +1422,8 @@ TEST(RunInt32AddAndWord32SarP) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = (*i >> shift) + *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = (i >> shift) + k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1438,30 +1434,30 @@ TEST(RunInt32AddAndWord32SarP) {
TEST(RunInt32AddAndWord32ShlP) {
{
RawMachineAssemblerTester<int32_t> m(
- MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
+ MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
m.Return(m.Int32Add(m.Parameter(0),
m.Word32Shl(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
+ FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = *i + (*j << shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = i + (j << shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
}
{
RawMachineAssemblerTester<int32_t> m(
- MachineType::Int32(), MachineType::Uint32(), MachineType::Uint32());
+ MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
m.Return(m.Int32Add(m.Word32Shl(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
- FOR_INT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = (*i << shift) + *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = (i << shift) + k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1479,8 +1475,8 @@ TEST(RunInt32AddAndWord32ShrP) {
FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = *i + (*j >> shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = i + (j >> shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1494,8 +1490,8 @@ TEST(RunInt32AddAndWord32ShrP) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = (*i >> shift) + *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = (i >> shift) + k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1518,8 +1514,8 @@ TEST(RunInt32AddInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i + *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i + j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1536,8 +1532,8 @@ TEST(RunInt32AddInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i + *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i + j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1545,7 +1541,7 @@ TEST(RunInt32AddInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32Equal(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32Equal(m.Int32Add(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -1553,8 +1549,8 @@ TEST(RunInt32AddInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i + *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (i + j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -1562,7 +1558,7 @@ TEST(RunInt32AddInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32NotEqual(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32NotEqual(m.Int32Add(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -1570,8 +1566,8 @@ TEST(RunInt32AddInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i + *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (i + j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -1601,17 +1597,17 @@ TEST(RunInt32AddInBranch) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = ((*i + right) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = ((i + right) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1628,8 +1624,8 @@ TEST(RunInt32AddInComparison) {
m.Word32Equal(m.Int32Add(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i + *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i + j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1640,31 +1636,31 @@ TEST(RunInt32AddInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Int32Add(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i + *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i + j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Int32Add(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i + *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Int32Add(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (i + j) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Int32Add(m.Parameter(0), m.Int32Constant(*i)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*j + *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Int32Add(m.Parameter(0), m.Int32Constant(i)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (j + i) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
@@ -1687,17 +1683,17 @@ TEST(RunInt32AddInComparison) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = (*i + right) == 0;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = (i + right) == 0;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1714,8 +1710,8 @@ TEST(RunInt32SubP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i - *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i - j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1724,20 +1720,20 @@ TEST(RunInt32SubImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i - *j;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Int32Sub(m.Int32Constant(i), m.Parameter(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = i - j;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Int32Sub(m.Parameter(0), m.Int32Constant(*i)));
+ m.Return(m.Int32Sub(m.Parameter(0), m.Int32Constant(i)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *j - *i;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = j - i;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -1758,8 +1754,8 @@ TEST(RunInt32SubAndWord32SarP) {
FOR_UINT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- int32_t expected = *i - (*j >> shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = i - (j >> shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1772,8 +1768,8 @@ TEST(RunInt32SubAndWord32SarP) {
FOR_INT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
- int32_t expected = (*i >> shift) - *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = (i >> shift) - k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1784,29 +1780,29 @@ TEST(RunInt32SubAndWord32SarP) {
TEST(RunInt32SubAndWord32ShlP) {
{
RawMachineAssemblerTester<int32_t> m(
- MachineType::Uint32(), MachineType::Int32(), MachineType::Uint32());
+ MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
m.Return(m.Int32Sub(m.Parameter(0),
m.Word32Shl(m.Parameter(1), m.Parameter(2))));
FOR_UINT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
+ FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- int32_t expected = *i - (*j << shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = i - (j << shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
}
{
RawMachineAssemblerTester<int32_t> m(
- MachineType::Int32(), MachineType::Uint32(), MachineType::Uint32());
+ MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32());
m.Return(m.Int32Sub(m.Word32Shl(m.Parameter(0), m.Parameter(1)),
m.Parameter(2)));
- FOR_INT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
- int32_t expected = (*i << shift) - *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = (i << shift) - k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1824,8 +1820,8 @@ TEST(RunInt32SubAndWord32ShrP) {
FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
// Use uint32_t because signed overflow is UB in C.
- uint32_t expected = *i - (*j >> shift);
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ uint32_t expected = i - (j >> shift);
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1839,8 +1835,8 @@ TEST(RunInt32SubAndWord32ShrP) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
// Use uint32_t because signed overflow is UB in C.
- uint32_t expected = (*i >> shift) - *k;
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ uint32_t expected = (i >> shift) - k;
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -1863,8 +1859,8 @@ TEST(RunInt32SubInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i - *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i - j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1881,8 +1877,8 @@ TEST(RunInt32SubInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i - *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i - j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1890,7 +1886,7 @@ TEST(RunInt32SubInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32Equal(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32Equal(m.Int32Sub(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -1898,8 +1894,8 @@ TEST(RunInt32SubInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i - *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (i - j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -1907,7 +1903,7 @@ TEST(RunInt32SubInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32NotEqual(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32NotEqual(m.Int32Sub(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -1915,8 +1911,8 @@ TEST(RunInt32SubInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i - *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = (i - j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -1946,17 +1942,17 @@ TEST(RunInt32SubInBranch) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = ((*i - right) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = ((i - right) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -1973,8 +1969,8 @@ TEST(RunInt32SubInComparison) {
m.Word32Equal(m.Int32Sub(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i - *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i - j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -1985,31 +1981,31 @@ TEST(RunInt32SubInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Int32Sub(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i - *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i - j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Int32Sub(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i - *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Int32Sub(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (i - j) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Int32Sub(m.Parameter(0), m.Int32Constant(*i)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*j - *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Int32Sub(m.Parameter(0), m.Int32Constant(i)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (j - i) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
@@ -2032,17 +2028,17 @@ TEST(RunInt32SubInComparison) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = (*i - right) == 0;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = (i - right) == 0;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -2058,8 +2054,8 @@ TEST(RunInt32MulP) {
bt.AddReturn(m.Int32Mul(bt.param0, bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int expected = base::MulWithWraparound(*i, *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ int expected = base::MulWithWraparound(i, j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2069,8 +2065,8 @@ TEST(RunInt32MulP) {
bt.AddReturn(m.Int32Mul(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i * *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i * j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2084,8 +2080,8 @@ TEST(RunInt32MulHighP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected = static_cast<int32_t>(
- (static_cast<int64_t>(*i) * static_cast<int64_t>(*j)) >> 32);
- CHECK_EQ(expected, bt.call(*i, *j));
+ (static_cast<int64_t>(i) * static_cast<int64_t>(j)) >> 32);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2095,20 +2091,20 @@ TEST(RunInt32MulImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Int32Mul(m.Int32Constant(*i), m.Parameter(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i * *j;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Int32Mul(m.Int32Constant(i), m.Parameter(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = i * j;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Int32Mul(m.Parameter(0), m.Int32Constant(*i)));
+ m.Return(m.Int32Mul(m.Parameter(0), m.Int32Constant(i)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *j * *i;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = j * i;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2119,16 +2115,15 @@ TEST(RunInt32MulAndInt32AddP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- int32_t p0 = *i;
- int32_t p1 = *j;
- m.Return(m.Int32Add(m.Int32Constant(p0),
- m.Int32Mul(m.Parameter(0), m.Int32Constant(p1))));
- FOR_INT32_INPUTS(k) {
- int32_t p2 = *k;
- int expected =
- base::AddWithWraparound(p0, base::MulWithWraparound(p1, p2));
- CHECK_EQ(expected, m.Call(p2));
- }
+ int32_t p0 = i;
+ int32_t p1 = j;
+ m.Return(m.Int32Add(m.Int32Constant(p0),
+ m.Int32Mul(m.Parameter(0), m.Int32Constant(p1))));
+ FOR_INT32_INPUTS(k) {
+ int32_t p2 = k;
+ int expected = base::AddWithWraparound(p0, base::MulWithWraparound(p1, p2));
+ CHECK_EQ(expected, m.Call(p2));
+ }
}
}
}
@@ -2140,9 +2135,9 @@ TEST(RunInt32MulAndInt32AddP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
- int32_t p0 = *i;
- int32_t p1 = *j;
- int32_t p2 = *k;
+ int32_t p0 = i;
+ int32_t p1 = j;
+ int32_t p2 = k;
int expected =
base::AddWithWraparound(p0, base::MulWithWraparound(p1, p2));
CHECK_EQ(expected, m.Call(p0, p1, p2));
@@ -2158,9 +2153,9 @@ TEST(RunInt32MulAndInt32AddP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
- int32_t p0 = *i;
- int32_t p1 = *j;
- int32_t p2 = *k;
+ int32_t p0 = i;
+ int32_t p1 = j;
+ int32_t p2 = k;
int expected =
base::AddWithWraparound(base::MulWithWraparound(p0, p1), p2);
CHECK_EQ(expected, m.Call(p0, p1, p2));
@@ -2173,13 +2168,13 @@ TEST(RunInt32MulAndInt32AddP) {
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
bt.AddReturn(
- m.Int32Add(m.Int32Constant(*i), m.Int32Mul(bt.param0, bt.param1)));
+ m.Int32Add(m.Int32Constant(i), m.Int32Mul(bt.param0, bt.param1)));
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
- int32_t p0 = *j;
- int32_t p1 = *k;
+ int32_t p0 = j;
+ int32_t p1 = k;
int expected =
- base::AddWithWraparound(*i, base::MulWithWraparound(p0, p1));
+ base::AddWithWraparound(i, base::MulWithWraparound(p0, p1));
CHECK_EQ(expected, bt.call(p0, p1));
}
}
@@ -2197,9 +2192,9 @@ TEST(RunInt32MulAndInt32SubP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
- int32_t p0 = *i;
- int32_t p1 = *j;
- int32_t p2 = *k;
+ int32_t p0 = i;
+ int32_t p1 = j;
+ int32_t p2 = k;
int expected =
base::SubWithWraparound(p0, base::MulWithWraparound(p1, p2));
CHECK_EQ(expected, m.Call(p0, p1, p2));
@@ -2212,13 +2207,13 @@ TEST(RunInt32MulAndInt32SubP) {
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
bt.AddReturn(
- m.Int32Sub(m.Int32Constant(*i), m.Int32Mul(bt.param0, bt.param1)));
+ m.Int32Sub(m.Int32Constant(i), m.Int32Mul(bt.param0, bt.param1)));
FOR_INT32_INPUTS(j) {
FOR_INT32_INPUTS(k) {
- int32_t p0 = *j;
- int32_t p1 = *k;
+ int32_t p0 = j;
+ int32_t p1 = k;
int expected =
- base::SubWithWraparound(*i, base::MulWithWraparound(p0, p1));
+ base::SubWithWraparound(i, base::MulWithWraparound(p0, p1));
CHECK_EQ(expected, bt.call(p0, p1));
}
}
@@ -2234,8 +2229,8 @@ TEST(RunUint32MulHighP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
int32_t expected = bit_cast<int32_t>(static_cast<uint32_t>(
- (static_cast<uint64_t>(*i) * static_cast<uint64_t>(*j)) >> 32));
- CHECK_EQ(expected, bt.call(bit_cast<int32_t>(*i), bit_cast<int32_t>(*j)));
+ (static_cast<uint64_t>(i) * static_cast<uint64_t>(j)) >> 32));
+ CHECK_EQ(expected, bt.call(bit_cast<int32_t>(i), bit_cast<int32_t>(j)));
}
}
}
@@ -2248,8 +2243,8 @@ TEST(RunInt32DivP) {
bt.AddReturn(m.Int32Div(bt.param0, bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int p0 = *i;
- int p1 = *j;
+ int p0 = i;
+ int p1 = j;
if (p1 != 0 && (static_cast<uint32_t>(p0) != 0x80000000 || p1 != -1)) {
int expected = static_cast<int32_t>(p0 / p1);
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2263,8 +2258,8 @@ TEST(RunInt32DivP) {
bt.AddReturn(m.Int32Add(bt.param0, m.Int32Div(bt.param0, bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int p0 = *i;
- int p1 = *j;
+ int p0 = i;
+ int p1 = j;
if (p1 != 0 && (static_cast<uint32_t>(p0) != 0x80000000 || p1 != -1)) {
int expected =
static_cast<int32_t>(base::AddWithWraparound(p0, (p0 / p1)));
@@ -2283,8 +2278,8 @@ TEST(RunUint32DivP) {
bt.AddReturn(m.Uint32Div(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t p0 = *i;
- uint32_t p1 = *j;
+ uint32_t p0 = i;
+ uint32_t p1 = j;
if (p1 != 0) {
int32_t expected = bit_cast<int32_t>(p0 / p1);
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2298,8 +2293,8 @@ TEST(RunUint32DivP) {
bt.AddReturn(m.Int32Add(bt.param0, m.Uint32Div(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t p0 = *i;
- uint32_t p1 = *j;
+ uint32_t p0 = i;
+ uint32_t p1 = j;
if (p1 != 0) {
int32_t expected = bit_cast<int32_t>(p0 + (p0 / p1));
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2317,8 +2312,8 @@ TEST(RunInt32ModP) {
bt.AddReturn(m.Int32Mod(bt.param0, bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int p0 = *i;
- int p1 = *j;
+ int p0 = i;
+ int p1 = j;
if (p1 != 0 && (static_cast<uint32_t>(p0) != 0x80000000 || p1 != -1)) {
int expected = static_cast<int32_t>(p0 % p1);
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2332,8 +2327,8 @@ TEST(RunInt32ModP) {
bt.AddReturn(m.Int32Add(bt.param0, m.Int32Mod(bt.param0, bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int p0 = *i;
- int p1 = *j;
+ int p0 = i;
+ int p1 = j;
if (p1 != 0 && (static_cast<uint32_t>(p0) != 0x80000000 || p1 != -1)) {
int expected =
static_cast<int32_t>(base::AddWithWraparound(p0, (p0 % p1)));
@@ -2352,8 +2347,8 @@ TEST(RunUint32ModP) {
bt.AddReturn(m.Uint32Mod(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t p0 = *i;
- uint32_t p1 = *j;
+ uint32_t p0 = i;
+ uint32_t p1 = j;
if (p1 != 0) {
uint32_t expected = static_cast<uint32_t>(p0 % p1);
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2367,8 +2362,8 @@ TEST(RunUint32ModP) {
bt.AddReturn(m.Int32Add(bt.param0, m.Uint32Mod(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t p0 = *i;
- uint32_t p1 = *j;
+ uint32_t p0 = i;
+ uint32_t p1 = j;
if (p1 != 0) {
uint32_t expected = static_cast<uint32_t>(p0 + (p0 % p1));
CHECK_EQ(expected, bt.call(p0, p1));
@@ -2386,8 +2381,8 @@ TEST(RunWord32AndP) {
bt.AddReturn(m.Word32And(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = *i & *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = i & j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2397,8 +2392,8 @@ TEST(RunWord32AndP) {
bt.AddReturn(m.Word32And(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = *i & ~(*j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = i & ~(j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2408,8 +2403,8 @@ TEST(RunWord32AndP) {
bt.AddReturn(m.Word32And(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = ~(*i) & *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = ~(i)&j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2424,8 +2419,8 @@ TEST(RunWord32AndAndWord32ShlP) {
m.Word32Shl(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1F))));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i << (*j & 0x1F);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i << (j & 0x1F);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2436,8 +2431,8 @@ TEST(RunWord32AndAndWord32ShlP) {
m.Word32Shl(bt.param0, m.Word32And(m.Int32Constant(0x1F), bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i << (0x1F & *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i << (0x1F & j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2452,8 +2447,8 @@ TEST(RunWord32AndAndWord32ShrP) {
m.Word32Shr(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1F))));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i >> (*j & 0x1F);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i >> (j & 0x1F);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2464,8 +2459,8 @@ TEST(RunWord32AndAndWord32ShrP) {
m.Word32Shr(bt.param0, m.Word32And(m.Int32Constant(0x1F), bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i >> (0x1F & *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i >> (0x1F & j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2480,8 +2475,8 @@ TEST(RunWord32AndAndWord32SarP) {
m.Word32Sar(bt.param0, m.Word32And(bt.param1, m.Int32Constant(0x1F))));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = *i >> (*j & 0x1F);
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = i >> (j & 0x1F);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2492,8 +2487,8 @@ TEST(RunWord32AndAndWord32SarP) {
m.Word32Sar(bt.param0, m.Word32And(m.Int32Constant(0x1F), bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = *i >> (0x1F & *j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = i >> (0x1F & j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2504,21 +2499,21 @@ TEST(RunWord32AndImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32And(m.Int32Constant(*i), m.Parameter(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i & *j;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32And(m.Int32Constant(i), m.Parameter(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = i & j;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
m.Return(
- m.Word32And(m.Int32Constant(*i), m.Word32BitwiseNot(m.Parameter(0))));
+ m.Word32And(m.Int32Constant(i), m.Word32BitwiseNot(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i & ~(*j);
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = i & ~(j);
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2540,8 +2535,8 @@ TEST(RunWord32AndInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i & *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i & j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2558,8 +2553,8 @@ TEST(RunWord32AndInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i & *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i & j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2567,7 +2562,7 @@ TEST(RunWord32AndInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32Equal(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32Equal(m.Word32And(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -2575,8 +2570,8 @@ TEST(RunWord32AndInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i & *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = (i & j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2584,17 +2579,16 @@ TEST(RunWord32AndInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(
- m.Word32NotEqual(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)),
- &blocka, &blockb);
+ m.Branch(m.Word32NotEqual(m.Word32And(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)),
+ &blocka, &blockb);
m.Bind(&blocka);
m.Return(m.Int32Constant(constant));
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i & *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = (i & j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2624,17 +2618,17 @@ TEST(RunWord32AndInBranch) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = ((*i & right) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = ((i & right) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -2651,8 +2645,8 @@ TEST(RunWord32AndInComparison) {
m.Word32Equal(m.Word32And(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i & *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i & j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2663,30 +2657,30 @@ TEST(RunWord32AndInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32And(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i & *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i & j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Word32And(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i & *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Word32And(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (i & j) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Word32And(m.Parameter(0), m.Int32Constant(*i)),
+ m.Return(m.Word32Equal(m.Word32And(m.Parameter(0), m.Int32Constant(i)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*j & *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (j & i) == 0;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2700,8 +2694,8 @@ TEST(RunWord32OrP) {
bt.AddReturn(m.Word32Or(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i | *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i | j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2711,8 +2705,8 @@ TEST(RunWord32OrP) {
bt.AddReturn(m.Word32Or(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i | ~(*j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i | ~(j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2722,8 +2716,8 @@ TEST(RunWord32OrP) {
bt.AddReturn(m.Word32Or(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = ~(*i) | *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = ~(i) | j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2734,21 +2728,21 @@ TEST(RunWord32OrImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i | *j;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Or(m.Int32Constant(i), m.Parameter(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = i | j;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
m.Return(
- m.Word32Or(m.Int32Constant(*i), m.Word32BitwiseNot(m.Parameter(0))));
+ m.Word32Or(m.Int32Constant(i), m.Word32BitwiseNot(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i | ~(*j);
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = i | ~(j);
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2770,8 +2764,8 @@ TEST(RunWord32OrInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = (*i | *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i | j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2788,8 +2782,8 @@ TEST(RunWord32OrInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = (*i | *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i | j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2797,7 +2791,7 @@ TEST(RunWord32OrInBranch) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32Equal(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32Equal(m.Word32Or(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -2805,8 +2799,8 @@ TEST(RunWord32OrInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_INT32_INPUTS(j) {
- int32_t expected = (*i | *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = (i | j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2814,7 +2808,7 @@ TEST(RunWord32OrInBranch) {
FOR_INT32_INPUTS(i) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32NotEqual(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32NotEqual(m.Word32Or(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -2822,8 +2816,8 @@ TEST(RunWord32OrInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_INT32_INPUTS(j) {
- int32_t expected = (*i | *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = (i | j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2853,17 +2847,17 @@ TEST(RunWord32OrInBranch) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = ((*i | right) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = ((i | right) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -2880,8 +2874,8 @@ TEST(RunWord32OrInComparison) {
m.Word32Equal(m.Word32Or(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i | *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i | j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2892,30 +2886,30 @@ TEST(RunWord32OrInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32Or(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- int32_t expected = (*i | *j) == 0;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = (i | j) == 0;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Word32Or(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i | *j) == 0;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Equal(m.Word32Or(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = (i | j) == 0;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Equal(m.Word32Or(m.Parameter(0), m.Int32Constant(*i)),
+ m.Return(m.Word32Equal(m.Word32Or(m.Parameter(0), m.Int32Constant(i)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*j | *i) == 0;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (j | i) == 0;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2926,11 +2920,11 @@ TEST(RunWord32XorP) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)));
- FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i ^ *j;
- CHECK_EQ(expected, m.Call(*j));
- }
+ m.Return(m.Word32Xor(m.Int32Constant(i), m.Parameter(0)));
+ FOR_UINT32_INPUTS(j) {
+ uint32_t expected = i ^ j;
+ CHECK_EQ(expected, m.Call(j));
+ }
}
}
{
@@ -2939,8 +2933,8 @@ TEST(RunWord32XorP) {
bt.AddReturn(m.Word32Xor(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i ^ *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = i ^ j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2950,8 +2944,8 @@ TEST(RunWord32XorP) {
bt.AddReturn(m.Word32Xor(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = *i ^ ~(*j);
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = i ^ ~(j);
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2961,8 +2955,8 @@ TEST(RunWord32XorP) {
bt.AddReturn(m.Word32Xor(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = ~(*i) ^ *j;
- CHECK_EQ(expected, bt.call(*i, *j));
+ int32_t expected = ~(i) ^ j;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -2970,10 +2964,10 @@ TEST(RunWord32XorP) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
m.Return(
- m.Word32Xor(m.Int32Constant(*i), m.Word32BitwiseNot(m.Parameter(0))));
+ m.Word32Xor(m.Int32Constant(i), m.Word32BitwiseNot(m.Parameter(0))));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *i ^ ~(*j);
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = i ^ ~(j);
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -2995,8 +2989,8 @@ TEST(RunWord32XorInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i ^ j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -3013,8 +3007,8 @@ TEST(RunWord32XorInBranch) {
bt.AddReturn(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ uint32_t expected = (i ^ j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -3022,7 +3016,7 @@ TEST(RunWord32XorInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(m.Word32Equal(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)),
+ m.Branch(m.Word32Equal(m.Word32Xor(m.Int32Constant(i), m.Parameter(0)),
m.Int32Constant(0)),
&blocka, &blockb);
m.Bind(&blocka);
@@ -3030,8 +3024,8 @@ TEST(RunWord32XorInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i ^ *j) == 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (i ^ j) == 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3039,17 +3033,16 @@ TEST(RunWord32XorInBranch) {
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
RawMachineLabel blocka, blockb;
- m.Branch(
- m.Word32NotEqual(m.Word32Xor(m.Int32Constant(*i), m.Parameter(0)),
- m.Int32Constant(0)),
- &blocka, &blockb);
+ m.Branch(m.Word32NotEqual(m.Word32Xor(m.Int32Constant(i), m.Parameter(0)),
+ m.Int32Constant(0)),
+ &blocka, &blockb);
m.Bind(&blocka);
m.Return(m.Int32Constant(constant));
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = (*i ^ *j) != 0 ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = (i ^ j) != 0 ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3079,17 +3072,17 @@ TEST(RunWord32XorInBranch) {
default:
UNREACHABLE();
case IrOpcode::kWord32Sar:
- right = *j >> shift;
+ right = j >> shift;
break;
case IrOpcode::kWord32Shl:
- right = *j << shift;
+ right = static_cast<uint32_t>(j) << shift;
break;
case IrOpcode::kWord32Shr:
- right = static_cast<uint32_t>(*j) >> shift;
+ right = static_cast<uint32_t>(j) >> shift;
break;
}
- int32_t expected = ((*i ^ right) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = ((i ^ right) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -3104,8 +3097,8 @@ TEST(RunWord32ShlP) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
m.Return(m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *j << shift;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = j << shift;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3115,8 +3108,8 @@ TEST(RunWord32ShlP) {
bt.AddReturn(m.Word32Shl(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = *i << shift;
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = i << shift;
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3131,8 +3124,8 @@ TEST(RunWord32ShlInComparison) {
m.Word32Equal(m.Word32Shl(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == (*i << shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == (i << shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3143,8 +3136,8 @@ TEST(RunWord32ShlInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32Shl(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == (*i << shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == (i << shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3155,8 +3148,8 @@ TEST(RunWord32ShlInComparison) {
m.Word32Equal(m.Int32Constant(0),
m.Word32Shl(m.Parameter(0), m.Int32Constant(shift))));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == (*i << shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == (i << shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3167,8 +3160,8 @@ TEST(RunWord32ShlInComparison) {
m.Word32Equal(m.Word32Shl(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == (*i << shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == (i << shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3181,8 +3174,8 @@ TEST(RunWord32ShrP) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
m.Return(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)));
FOR_UINT32_INPUTS(j) {
- uint32_t expected = *j >> shift;
- CHECK_EQ(expected, m.Call(*j));
+ uint32_t expected = j >> shift;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3192,8 +3185,8 @@ TEST(RunWord32ShrP) {
bt.AddReturn(m.Word32Shr(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = *i >> shift;
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = i >> shift;
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
CHECK_EQ(0x00010000u, bt.call(0x80000000, 15));
@@ -3213,8 +3206,8 @@ TEST(RunWordShiftInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = ((*i << shift) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = ((i << shift) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i));
}
}
FOR_UINT32_SHIFTS(shift) {
@@ -3228,8 +3221,8 @@ TEST(RunWordShiftInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = ((*i >> shift) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = ((i >> shift) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i));
}
}
FOR_UINT32_SHIFTS(shift) {
@@ -3243,8 +3236,8 @@ TEST(RunWordShiftInBranch) {
m.Bind(&blockb);
m.Return(m.Int32Constant(0 - constant));
FOR_INT32_INPUTS(i) {
- int32_t expected = ((*i >> shift) == 0) ? constant : 0 - constant;
- CHECK_EQ(expected, m.Call(*i));
+ int32_t expected = ((i >> shift) == 0) ? constant : 0 - constant;
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3257,8 +3250,8 @@ TEST(RunWord32ShrInComparison) {
m.Word32Equal(m.Word32Shr(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3269,8 +3262,8 @@ TEST(RunWord32ShrInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32Shr(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3281,8 +3274,8 @@ TEST(RunWord32ShrInComparison) {
m.Word32Equal(m.Int32Constant(0),
m.Word32Shr(m.Parameter(0), m.Int32Constant(shift))));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3293,8 +3286,8 @@ TEST(RunWord32ShrInComparison) {
m.Word32Equal(m.Word32Shr(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3307,8 +3300,8 @@ TEST(RunWord32SarP) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
m.Return(m.Word32Sar(m.Parameter(0), m.Int32Constant(shift)));
FOR_INT32_INPUTS(j) {
- int32_t expected = *j >> shift;
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = j >> shift;
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3318,8 +3311,8 @@ TEST(RunWord32SarP) {
bt.AddReturn(m.Word32Sar(bt.param0, bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_SHIFTS(shift) {
- int32_t expected = *i >> shift;
- CHECK_EQ(expected, bt.call(*i, shift));
+ int32_t expected = i >> shift;
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
CHECK_EQ(bit_cast<int32_t>(0xFFFF0000), bt.call(0x80000000, 15));
@@ -3335,8 +3328,8 @@ TEST(RunWord32SarInComparison) {
m.Word32Equal(m.Word32Sar(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_INT32_INPUTS(i) {
FOR_INT32_SHIFTS(shift) {
- int32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ int32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3347,8 +3340,8 @@ TEST(RunWord32SarInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32Sar(bt.param0, bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_SHIFTS(shift) {
- int32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ int32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3359,8 +3352,8 @@ TEST(RunWord32SarInComparison) {
m.Word32Equal(m.Int32Constant(0),
m.Word32Sar(m.Parameter(0), m.Int32Constant(shift))));
FOR_INT32_INPUTS(i) {
- int32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, m.Call(*i));
+ int32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3371,8 +3364,8 @@ TEST(RunWord32SarInComparison) {
m.Word32Equal(m.Word32Sar(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_INT32_INPUTS(i) {
- int32_t expected = 0 == (*i >> shift);
- CHECK_EQ(expected, m.Call(*i));
+ int32_t expected = 0 == (i >> shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3385,8 +3378,8 @@ TEST(RunWord32RorP) {
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
m.Return(m.Word32Ror(m.Parameter(0), m.Int32Constant(shift)));
FOR_UINT32_INPUTS(j) {
- int32_t expected = base::bits::RotateRight32(*j, shift);
- CHECK_EQ(expected, m.Call(*j));
+ int32_t expected = base::bits::RotateRight32(j, shift);
+ CHECK_EQ(expected, m.Call(j));
}
}
}
@@ -3396,8 +3389,8 @@ TEST(RunWord32RorP) {
bt.AddReturn(m.Word32Ror(bt.param0, bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = base::bits::RotateRight32(*i, shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = base::bits::RotateRight32(i, shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3412,8 +3405,8 @@ TEST(RunWord32RorInComparison) {
m.Word32Equal(m.Word32Ror(bt.param0, bt.param1), m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == base::bits::RotateRight32(*i, shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == base::bits::RotateRight32(i, shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3424,8 +3417,8 @@ TEST(RunWord32RorInComparison) {
m.Word32Equal(m.Int32Constant(0), m.Word32Ror(bt.param0, bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
- uint32_t expected = 0 == base::bits::RotateRight32(*i, shift);
- CHECK_EQ(expected, bt.call(*i, shift));
+ uint32_t expected = 0 == base::bits::RotateRight32(i, shift);
+ CHECK_EQ(expected, bt.call(i, shift));
}
}
}
@@ -3436,8 +3429,8 @@ TEST(RunWord32RorInComparison) {
m.Word32Equal(m.Int32Constant(0),
m.Word32Ror(m.Parameter(0), m.Int32Constant(shift))));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == base::bits::RotateRight32(*i, shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == base::bits::RotateRight32(i, shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3448,8 +3441,8 @@ TEST(RunWord32RorInComparison) {
m.Word32Equal(m.Word32Ror(m.Parameter(0), m.Int32Constant(shift)),
m.Int32Constant(0)));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = 0 == base::bits::RotateRight32(*i, shift);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = 0 == base::bits::RotateRight32(i, shift);
+ CHECK_EQ(expected, m.Call(i));
}
}
}
@@ -3459,8 +3452,8 @@ TEST(RunWord32BitwiseNotP) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
m.Return(m.Word32BitwiseNot(m.Parameter(0)));
FOR_INT32_INPUTS(i) {
- int expected = ~(*i);
- CHECK_EQ(expected, m.Call(*i));
+ int expected = ~(i);
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -3469,8 +3462,8 @@ TEST(RunInt32NegP) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
m.Return(m.Int32Neg(m.Parameter(0)));
FOR_INT32_INPUTS(i) {
- int expected = base::NegateWithWraparound(*i);
- CHECK_EQ(expected, m.Call(*i));
+ int expected = base::NegateWithWraparound(i);
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -3484,8 +3477,8 @@ TEST(RunWord32EqualAndWord32SarP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- int32_t expected = (*i == (*j >> shift));
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = (i == (j >> shift));
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -3498,8 +3491,8 @@ TEST(RunWord32EqualAndWord32SarP) {
FOR_INT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_INT32_INPUTS(k) {
- int32_t expected = ((*i >> shift) == *k);
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = ((i >> shift) == k);
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -3516,8 +3509,8 @@ TEST(RunWord32EqualAndWord32ShlP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- int32_t expected = (*i == (*j << shift));
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = (i == (j << shift));
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -3530,8 +3523,8 @@ TEST(RunWord32EqualAndWord32ShlP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
- int32_t expected = ((*i << shift) == *k);
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = ((i << shift) == k);
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -3548,8 +3541,8 @@ TEST(RunWord32EqualAndWord32ShrP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
FOR_UINT32_SHIFTS(shift) {
- int32_t expected = (*i == (*j >> shift));
- CHECK_EQ(expected, m.Call(*i, *j, shift));
+ int32_t expected = (i == (j >> shift));
+ CHECK_EQ(expected, m.Call(i, j, shift));
}
}
}
@@ -3562,8 +3555,8 @@ TEST(RunWord32EqualAndWord32ShrP) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_SHIFTS(shift) {
FOR_UINT32_INPUTS(k) {
- int32_t expected = ((*i >> shift) == *k);
- CHECK_EQ(expected, m.Call(*i, shift, *k));
+ int32_t expected = ((i >> shift) == k);
+ CHECK_EQ(expected, m.Call(i, shift, k));
}
}
}
@@ -3644,7 +3637,7 @@ TEST(RunFloat32Add) {
m.Return(m.Float32Add(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i + *j, m.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(i + j, m.Call(i, j)); }
}
}
@@ -3655,14 +3648,14 @@ TEST(RunFloat32Sub) {
m.Return(m.Float32Sub(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, m.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(i - j, m.Call(i, j)); }
}
}
TEST(RunFloat32Neg) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
m.Return(m.AddNode(m.machine()->Float32Neg(), m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(-0.0f - *i, m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(-0.0f - i, m.Call(i)); }
}
TEST(RunFloat32Mul) {
@@ -3671,7 +3664,7 @@ TEST(RunFloat32Mul) {
m.Return(m.Float32Mul(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i * *j, m.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(i * j, m.Call(i, j)); }
}
}
@@ -3682,9 +3675,7 @@ TEST(RunFloat32Div) {
m.Return(m.Float32Div(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) {
- CHECK_FLOAT_EQ(base::Divide(*i, *j), m.Call(*i, *j));
- }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(base::Divide(i, j), m.Call(i, j)); }
}
}
@@ -3695,7 +3686,7 @@ TEST(RunFloat64Add) {
m.Return(m.Float64Add(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(*i + *j, m.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(i + j, m.Call(i, j)); }
}
}
@@ -3706,14 +3697,14 @@ TEST(RunFloat64Sub) {
m.Return(m.Float64Sub(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(*i - *j, m.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(i - j, m.Call(i, j)); }
}
}
TEST(RunFloat64Neg) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.AddNode(m.machine()->Float64Neg(), m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(-0.0 - *i, m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(-0.0 - i, m.Call(i)); }
}
TEST(RunFloat64Mul) {
@@ -3722,7 +3713,7 @@ TEST(RunFloat64Mul) {
m.Return(m.Float64Mul(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(*i * *j, m.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(i * j, m.Call(i, j)); }
}
}
@@ -3733,9 +3724,7 @@ TEST(RunFloat64Div) {
m.Return(m.Float64Div(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) {
- CHECK_DOUBLE_EQ(base::Divide(*i, *j), m.Call(*i, *j));
- }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(base::Divide(i, j), m.Call(i, j)); }
}
}
@@ -3746,7 +3735,7 @@ TEST(RunFloat64Mod) {
m.Return(m.Float64Mod(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(Modulo(*i, *j), m.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(Modulo(i, j), m.Call(i, j)); }
}
}
@@ -3792,7 +3781,7 @@ TEST(RunFloat32AddP) {
bt.AddReturn(m.Float32Add(bt.param0, bt.param1));
FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(*pl + *pr, bt.call(*pl, *pr)); }
+ FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(pl + pr, bt.call(pl, pr)); }
}
}
@@ -3804,7 +3793,7 @@ TEST(RunFloat64AddP) {
bt.AddReturn(m.Float64Add(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(*pl + *pr, bt.call(*pl, *pr)); }
+ FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(pl + pr, bt.call(pl, pr)); }
}
}
@@ -3814,9 +3803,7 @@ TEST(RunFloat64MaxP) {
bt.AddReturn(m.Float64Max(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(JSMax(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(JSMax(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3827,9 +3814,7 @@ TEST(RunFloat64MinP) {
bt.AddReturn(m.Float64Min(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(JSMin(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(JSMin(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3839,9 +3824,7 @@ TEST(RunFloat32Max) {
bt.AddReturn(m.Float32Max(bt.param0, bt.param1));
FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) {
- CHECK_FLOAT_EQ(JSMax(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(JSMax(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3851,9 +3834,7 @@ TEST(RunFloat32Min) {
bt.AddReturn(m.Float32Min(bt.param0, bt.param1));
FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) {
- CHECK_FLOAT_EQ(JSMin(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(JSMin(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3863,9 +3844,7 @@ TEST(RunFloat64Max) {
bt.AddReturn(m.Float64Max(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(JSMax(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(JSMax(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3875,9 +3854,7 @@ TEST(RunFloat64Min) {
bt.AddReturn(m.Float64Min(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(pl) {
- FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(JSMin(*pl, *pr), bt.call(*pl, *pr));
- }
+ FOR_FLOAT64_INPUTS(pr) { CHECK_DOUBLE_EQ(JSMin(pl, pr), bt.call(pl, pr)); }
}
}
@@ -3888,7 +3865,7 @@ TEST(RunFloat32SubP) {
bt.AddReturn(m.Float32Sub(bt.param0, bt.param1));
FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(*pl - *pr, bt.call(*pl, *pr)); }
+ FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(pl - pr, bt.call(pl, pr)); }
}
}
@@ -3896,9 +3873,9 @@ TEST(RunFloat32SubP) {
TEST(RunFloat32SubImm1) {
FOR_FLOAT32_INPUTS(i) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
- m.Return(m.Float32Sub(m.Float32Constant(*i), m.Parameter(0)));
+ m.Return(m.Float32Sub(m.Float32Constant(i), m.Parameter(0)));
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, m.Call(*j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(i - j, m.Call(j)); }
}
}
@@ -3906,9 +3883,9 @@ TEST(RunFloat32SubImm1) {
TEST(RunFloat32SubImm2) {
FOR_FLOAT32_INPUTS(i) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
- m.Return(m.Float32Sub(m.Parameter(0), m.Float32Constant(*i)));
+ m.Return(m.Float32Sub(m.Parameter(0), m.Float32Constant(i)));
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*j - *i, m.Call(*j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(j - i, m.Call(j)); }
}
}
@@ -3916,9 +3893,9 @@ TEST(RunFloat32SubImm2) {
TEST(RunFloat64SubImm1) {
FOR_FLOAT64_INPUTS(i) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
- m.Return(m.Float64Sub(m.Float64Constant(*i), m.Parameter(0)));
+ m.Return(m.Float64Sub(m.Float64Constant(i), m.Parameter(0)));
- FOR_FLOAT64_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, m.Call(*j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(i - j, m.Call(j)); }
}
}
@@ -3926,9 +3903,9 @@ TEST(RunFloat64SubImm1) {
TEST(RunFloat64SubImm2) {
FOR_FLOAT64_INPUTS(i) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
- m.Return(m.Float64Sub(m.Parameter(0), m.Float64Constant(*i)));
+ m.Return(m.Float64Sub(m.Parameter(0), m.Float64Constant(i)));
- FOR_FLOAT64_INPUTS(j) { CHECK_FLOAT_EQ(*j - *i, m.Call(*j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(j - i, m.Call(j)); }
}
}
@@ -3941,8 +3918,8 @@ TEST(RunFloat64SubP) {
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- double expected = *pl - *pr;
- CHECK_DOUBLE_EQ(expected, bt.call(*pl, *pr));
+ double expected = pl - pr;
+ CHECK_DOUBLE_EQ(expected, bt.call(pl, pr));
}
}
}
@@ -3955,7 +3932,7 @@ TEST(RunFloat32MulP) {
bt.AddReturn(m.Float32Mul(bt.param0, bt.param1));
FOR_FLOAT32_INPUTS(pl) {
- FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(*pl * *pr, bt.call(*pl, *pr)); }
+ FOR_FLOAT32_INPUTS(pr) { CHECK_FLOAT_EQ(pl * pr, bt.call(pl, pr)); }
}
}
@@ -3968,8 +3945,8 @@ TEST(RunFloat64MulP) {
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- double expected = *pl * *pr;
- CHECK_DOUBLE_EQ(expected, bt.call(*pl, *pr));
+ double expected = pl * pr;
+ CHECK_DOUBLE_EQ(expected, bt.call(pl, pr));
}
}
}
@@ -3983,9 +3960,7 @@ TEST(RunFloat64MulAndFloat64Add1) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- FOR_FLOAT64_INPUTS(k) {
- CHECK_DOUBLE_EQ((*i * *j) + *k, m.Call(*i, *j, *k));
- }
+ FOR_FLOAT64_INPUTS(k) { CHECK_DOUBLE_EQ((i * j) + k, m.Call(i, j, k)); }
}
}
}
@@ -3999,9 +3974,7 @@ TEST(RunFloat64MulAndFloat64Add2) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- FOR_FLOAT64_INPUTS(k) {
- CHECK_DOUBLE_EQ(*i + (*j * *k), m.Call(*i, *j, *k));
- }
+ FOR_FLOAT64_INPUTS(k) { CHECK_DOUBLE_EQ(i + (j * k), m.Call(i, j, k)); }
}
}
}
@@ -4015,9 +3988,7 @@ TEST(RunFloat64MulAndFloat64Sub1) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- FOR_FLOAT64_INPUTS(k) {
- CHECK_DOUBLE_EQ((*i * *j) - *k, m.Call(*i, *j, *k));
- }
+ FOR_FLOAT64_INPUTS(k) { CHECK_DOUBLE_EQ((i * j) - k, m.Call(i, j, k)); }
}
}
}
@@ -4031,9 +4002,7 @@ TEST(RunFloat64MulAndFloat64Sub2) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- FOR_FLOAT64_INPUTS(k) {
- CHECK_DOUBLE_EQ(*i - (*j * *k), m.Call(*i, *j, *k));
- }
+ FOR_FLOAT64_INPUTS(k) { CHECK_DOUBLE_EQ(i - (j * k), m.Call(i, j, k)); }
}
}
}
@@ -4042,9 +4011,9 @@ TEST(RunFloat64MulAndFloat64Sub2) {
TEST(RunFloat64MulImm1) {
FOR_FLOAT64_INPUTS(i) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
- m.Return(m.Float64Mul(m.Float64Constant(*i), m.Parameter(0)));
+ m.Return(m.Float64Mul(m.Float64Constant(i), m.Parameter(0)));
- FOR_FLOAT64_INPUTS(j) { CHECK_FLOAT_EQ(*i * *j, m.Call(*j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(i * j, m.Call(j)); }
}
}
@@ -4052,9 +4021,9 @@ TEST(RunFloat64MulImm1) {
TEST(RunFloat64MulImm2) {
FOR_FLOAT64_INPUTS(i) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
- m.Return(m.Float64Mul(m.Parameter(0), m.Float64Constant(*i)));
+ m.Return(m.Float64Mul(m.Parameter(0), m.Float64Constant(i)));
- FOR_FLOAT64_INPUTS(j) { CHECK_FLOAT_EQ(*j * *i, m.Call(*j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(j * i, m.Call(j)); }
}
}
@@ -4067,7 +4036,7 @@ TEST(RunFloat32DivP) {
FOR_FLOAT32_INPUTS(pl) {
FOR_FLOAT32_INPUTS(pr) {
- CHECK_FLOAT_EQ(base::Divide(*pl, *pr), bt.call(*pl, *pr));
+ CHECK_FLOAT_EQ(base::Divide(pl, pr), bt.call(pl, pr));
}
}
}
@@ -4081,7 +4050,7 @@ TEST(RunFloat64DivP) {
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- CHECK_DOUBLE_EQ(base::Divide(*pl, *pr), bt.call(*pl, *pr));
+ CHECK_DOUBLE_EQ(base::Divide(pl, pr), bt.call(pl, pr));
}
}
}
@@ -4094,7 +4063,7 @@ TEST(RunFloat64ModP) {
bt.AddReturn(m.Float64Mod(bt.param0, bt.param1));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(Modulo(*i, *j), bt.call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(Modulo(i, j), bt.call(i, j)); }
}
}
@@ -4111,7 +4080,7 @@ TEST(RunChangeInt32ToFloat64_B) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Int32());
m.Return(m.ChangeInt32ToFloat64(m.Parameter(0)));
- FOR_INT32_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), m.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(i), m.Call(i)); }
}
@@ -4119,7 +4088,7 @@ TEST(RunChangeUint32ToFloat64) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Uint32());
m.Return(m.ChangeUint32ToFloat64(m.Parameter(0)));
- FOR_UINT32_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), m.Call(*i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(i), m.Call(i)); }
}
@@ -4134,8 +4103,8 @@ TEST(RunTruncateFloat32ToInt32) {
// is.
float lower_bound = static_cast<float>(INT32_MIN);
FOR_FLOAT32_INPUTS(i) {
- if (*i < upper_bound && *i >= lower_bound) {
- CHECK_FLOAT_EQ(static_cast<int32_t>(*i), m.Call(*i));
+ if (i < upper_bound && i >= lower_bound) {
+ CHECK_FLOAT_EQ(static_cast<int32_t>(i), m.Call(i));
}
}
}
@@ -4150,14 +4119,14 @@ TEST(RunTruncateFloat32ToUint32) {
double upper_bound = 4294967296.0f;
double lower_bound = -1.0f;
FOR_UINT32_INPUTS(i) {
- volatile float input = static_cast<float>(*i);
+ volatile float input = static_cast<float>(i);
if (input < upper_bound) {
CHECK_EQ(static_cast<uint32_t>(input), m.Call(input));
}
}
FOR_FLOAT32_INPUTS(j) {
- if ((*j < upper_bound) && (*j > lower_bound)) {
- CHECK_FLOAT_EQ(static_cast<uint32_t>(*j), m.Call(*j));
+ if ((j < upper_bound) && (j > lower_bound)) {
+ CHECK_FLOAT_EQ(static_cast<uint32_t>(j), m.Call(j));
}
}
}
@@ -4177,7 +4146,7 @@ TEST(RunChangeFloat64ToInt32_B) {
// Note we don't check fractional inputs, or inputs outside the range of
// int32, because these Convert operators really should be Change operators.
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, m.Call(static_cast<double>(*i))); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, m.Call(static_cast<double>(i))); }
for (int32_t n = 1; n < 31; ++n) {
CHECK_EQ(1 << n, m.Call(static_cast<double>(1 << n)));
@@ -4193,7 +4162,7 @@ TEST(RunChangeFloat64ToUint32) {
m.Return(m.ChangeFloat64ToUint32(m.Parameter(0)));
{
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, m.Call(static_cast<double>(*i))); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, m.Call(static_cast<double>(i))); }
}
// Check various powers of 2.
@@ -4212,7 +4181,7 @@ TEST(RunTruncateFloat64ToFloat32) {
m.Return(m.TruncateFloat64ToFloat32(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(DoubleToFloat32(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(DoubleToFloat32(i), m.Call(i)); }
}
uint64_t ToInt64(uint32_t low, uint32_t high) {
@@ -4239,11 +4208,11 @@ TEST(RunInt32PairAdd) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32));
- CHECK_EQ(*i + *j, ToInt64(low, high));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32));
+ CHECK_EQ(i + j, ToInt64(low, high));
}
}
}
@@ -4259,11 +4228,11 @@ TEST(RunInt32PairAddUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
CHECK_EQ(
- static_cast<uint32_t>((*i + *j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32))));
+ static_cast<uint32_t>((i + j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32))));
}
}
}
@@ -4286,8 +4255,8 @@ void TestInt32PairAddWithSharedInput(int a, int b, int c, int d) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- m.Call(*i, *j);
- uint32_t inputs[] = {*i, *j};
+ m.Call(i, j);
+ uint32_t inputs[] = {i, j};
CHECK_EQ(ToInt64(inputs[a], inputs[b]) + ToInt64(inputs[c], inputs[d]),
ToInt64(low, high));
}
@@ -4322,11 +4291,11 @@ TEST(RunInt32PairSub) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32));
- CHECK_EQ(*i - *j, ToInt64(low, high));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32));
+ CHECK_EQ(i - j, ToInt64(low, high));
}
}
}
@@ -4342,11 +4311,11 @@ TEST(RunInt32PairSubUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
CHECK_EQ(
- static_cast<uint32_t>((*i - *j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32))));
+ static_cast<uint32_t>((i - j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32))));
}
}
}
@@ -4369,8 +4338,8 @@ void TestInt32PairSubWithSharedInput(int a, int b, int c, int d) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- m.Call(*i, *j);
- uint32_t inputs[] = {*i, *j};
+ m.Call(i, j);
+ uint32_t inputs[] = {i, j};
CHECK_EQ(ToInt64(inputs[a], inputs[b]) - ToInt64(inputs[c], inputs[d]),
ToInt64(low, high));
}
@@ -4405,11 +4374,11 @@ TEST(RunInt32PairMul) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32));
- CHECK_EQ(*i * *j, ToInt64(low, high));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32));
+ CHECK_EQ(i * j, ToInt64(low, high));
}
}
}
@@ -4425,11 +4394,11 @@ TEST(RunInt32PairMulUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
CHECK_EQ(
- static_cast<uint32_t>((*i * *j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32),
- static_cast<uint32_t>(*j & 0xFFFFFFFF),
- static_cast<uint32_t>(*j >> 32))));
+ static_cast<uint32_t>((i * j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32),
+ static_cast<uint32_t>(j & 0xFFFFFFFF),
+ static_cast<uint32_t>(j >> 32))));
}
}
}
@@ -4452,8 +4421,8 @@ void TestInt32PairMulWithSharedInput(int a, int b, int c, int d) {
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- m.Call(*i, *j);
- uint32_t inputs[] = {*i, *j};
+ m.Call(i, j);
+ uint32_t inputs[] = {i, j};
CHECK_EQ(ToInt64(inputs[a], inputs[b]) * ToInt64(inputs[c], inputs[d]),
ToInt64(low, high));
}
@@ -4488,9 +4457,9 @@ TEST(RunWord32PairShl) {
FOR_UINT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j);
- CHECK_EQ(*i << j, ToInt64(low, high));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j);
+ CHECK_EQ(i << j, ToInt64(low, high));
}
}
}
@@ -4505,9 +4474,9 @@ TEST(RunWord32PairShlUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
CHECK_EQ(
- static_cast<uint32_t>((*i << j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j)));
+ static_cast<uint32_t>((i << j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j)));
}
}
}
@@ -4530,8 +4499,8 @@ void TestWord32PairShlWithSharedInput(int a, int b) {
FOR_UINT32_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
- m.Call(*i, j);
- uint32_t inputs[] = {*i, j};
+ m.Call(i, j);
+ uint32_t inputs[] = {i, j};
CHECK_EQ(ToInt64(inputs[a], inputs[b]) << j, ToInt64(low, high));
}
}
@@ -4562,9 +4531,9 @@ TEST(RunWord32PairShr) {
FOR_UINT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j);
- CHECK_EQ(*i >> j, ToInt64(low, high));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j);
+ CHECK_EQ(i >> j, ToInt64(low, high));
}
}
}
@@ -4579,9 +4548,9 @@ TEST(RunWord32PairShrUseOnlyHighWord) {
FOR_UINT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
CHECK_EQ(
- static_cast<uint32_t>((*i >> j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j)));
+ static_cast<uint32_t>((i >> j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j)));
}
}
}
@@ -4604,9 +4573,9 @@ TEST(RunWord32PairSar) {
FOR_INT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
- m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j);
- CHECK_EQ(*i >> j, static_cast<int64_t>(ToInt64(low, high)));
+ m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j);
+ CHECK_EQ(i >> j, static_cast<int64_t>(ToInt64(low, high)));
}
}
}
@@ -4621,9 +4590,9 @@ TEST(RunWord32PairSarUseOnlyHighWord) {
FOR_INT64_INPUTS(i) {
for (uint32_t j = 0; j < 64; j++) {
CHECK_EQ(
- static_cast<uint32_t>((*i >> j) >> 32),
- static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xFFFFFFFF),
- static_cast<uint32_t>(*i >> 32), j)));
+ static_cast<uint32_t>((i >> j) >> 32),
+ static_cast<uint32_t>(m.Call(static_cast<uint32_t>(i & 0xFFFFFFFF),
+ static_cast<uint32_t>(i >> 32), j)));
}
}
}
@@ -4740,8 +4709,14 @@ TEST(RunRefDiamond) {
m.Goto(&end);
m.Bind(&end);
Node* phi = m.Phi(MachineRepresentation::kTagged, k2, k1);
- m.Store(MachineRepresentation::kTagged, m.PointerConstant(&buffer),
- m.Int32Constant(0), phi, kNoWriteBarrier);
+ if (COMPRESS_POINTERS_BOOL) {
+ // Since |buffer| is located off-heap, use full pointer store.
+ m.Store(MachineType::PointerRepresentation(), m.PointerConstant(&buffer),
+ m.Int32Constant(0), m.BitcastTaggedToWord(phi), kNoWriteBarrier);
+ } else {
+ m.Store(MachineRepresentation::kTagged, m.PointerConstant(&buffer),
+ m.Int32Constant(0), phi, kNoWriteBarrier);
+ }
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -4774,8 +4749,14 @@ TEST(RunDoubleRefDiamond) {
Node* rphi = m.Phi(MachineRepresentation::kTagged, r2, r1);
m.Store(MachineRepresentation::kFloat64, m.PointerConstant(&dbuffer),
m.Int32Constant(0), dphi, kNoWriteBarrier);
- m.Store(MachineRepresentation::kTagged, m.PointerConstant(&rbuffer),
- m.Int32Constant(0), rphi, kNoWriteBarrier);
+ if (COMPRESS_POINTERS_BOOL) {
+ // Since |buffer| is located off-heap, use full pointer store.
+ m.Store(MachineType::PointerRepresentation(), m.PointerConstant(&rbuffer),
+ m.Int32Constant(0), m.BitcastTaggedToWord(rphi), kNoWriteBarrier);
+ } else {
+ m.Store(MachineRepresentation::kTagged, m.PointerConstant(&rbuffer),
+ m.Int32Constant(0), rphi, kNoWriteBarrier);
+ }
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -4819,8 +4800,14 @@ TEST(RunDoubleRefDoubleDiamond) {
m.Store(MachineRepresentation::kFloat64, m.PointerConstant(&dbuffer),
m.Int32Constant(0), dphi2, kNoWriteBarrier);
- m.Store(MachineRepresentation::kTagged, m.PointerConstant(&rbuffer),
- m.Int32Constant(0), rphi2, kNoWriteBarrier);
+ if (COMPRESS_POINTERS_BOOL) {
+ // Since |buffer| is located off-heap, use full pointer store.
+ m.Store(MachineType::PointerRepresentation(), m.PointerConstant(&rbuffer),
+ m.Int32Constant(0), m.BitcastTaggedToWord(rphi2), kNoWriteBarrier);
+ } else {
+ m.Store(MachineRepresentation::kTagged, m.PointerConstant(&rbuffer),
+ m.Int32Constant(0), rphi2, kNoWriteBarrier);
+ }
m.Return(m.Int32Constant(magic));
CHECK_EQ(magic, m.Call());
@@ -5093,7 +5080,7 @@ TEST(RunFloat64UnorderedCompare) {
for (size_t o = 0; o < arraysize(operators); ++o) {
for (int j = 0; j < 2; j++) {
RawMachineAssemblerTester<int32_t> m;
- Node* a = m.Float64Constant(*i);
+ Node* a = m.Float64Constant(i);
Node* b = m.Float64Constant(nan);
if (j == 1) std::swap(a, b);
m.Return(m.AddNode(operators[o], a, b));
@@ -5116,8 +5103,8 @@ TEST(RunFloat64Equal) {
CompareWrapper cmp(IrOpcode::kFloat64Equal);
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- input_a = *pl;
- input_b = *pr;
+ input_a = pl;
+ input_b = pr;
int32_t expected = cmp.Float64Compare(input_a, input_b) ? 1 : 0;
CHECK_EQ(expected, m.Call());
}
@@ -5137,8 +5124,8 @@ TEST(RunFloat64LessThan) {
CompareWrapper cmp(IrOpcode::kFloat64LessThan);
FOR_FLOAT64_INPUTS(pl) {
FOR_FLOAT64_INPUTS(pr) {
- input_a = *pl;
- input_b = *pr;
+ input_a = pl;
+ input_b = pr;
int32_t expected = cmp.Float64Compare(input_a, input_b) ? 1 : 0;
CHECK_EQ(expected, m.Call());
}
@@ -5276,11 +5263,11 @@ TEST(RunSpillConstantsAndParameters) {
m.Return(m.Int32Add(acc, m.Int32Add(m.Parameter(0), m.Parameter(1))));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = base::AddWithWraparound(*i, *j);
+ int32_t expected = base::AddWithWraparound(i, j);
for (int k = 0; k < kInputSize; k++) {
expected = base::AddWithWraparound(expected, kBase + k);
}
- CHECK_EQ(expected, m.Call(*i, *j));
+ CHECK_EQ(expected, m.Call(i, j));
expected = 0;
for (int k = 0; k < kInputSize; k++) {
expected += kBase + k;
@@ -5328,8 +5315,8 @@ TEST(RunInt32AddWithOverflowP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected_val;
- int expected_ovf = base::bits::SignedAddOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, bt.call(*i, *j));
+ int expected_ovf = base::bits::SignedAddOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, bt.call(i, j));
CHECK_EQ(expected_val, actual_val);
}
}
@@ -5341,41 +5328,39 @@ TEST(RunInt32AddWithOverflowImm) {
FOR_INT32_INPUTS(i) {
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32AddWithOverflow(m.Int32Constant(*i), m.Parameter(0));
+ Node* add = m.Int32AddWithOverflow(m.Int32Constant(i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedAddOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedAddOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32AddWithOverflow(m.Parameter(0), m.Int32Constant(*i));
+ Node* add = m.Int32AddWithOverflow(m.Parameter(0), m.Int32Constant(i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedAddOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedAddOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
FOR_INT32_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m;
Node* add =
- m.Int32AddWithOverflow(m.Int32Constant(*i), m.Int32Constant(*j));
+ m.Int32AddWithOverflow(m.Int32Constant(i), m.Int32Constant(j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
- int expected_ovf = base::bits::SignedAddOverflow32(*i, *j, &expected_val);
+ int expected_ovf = base::bits::SignedAddOverflow32(i, j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
CHECK_EQ(expected_val, actual_val);
}
@@ -5399,9 +5384,8 @@ TEST(RunInt32AddWithOverflowInBranchP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected;
- if (base::bits::SignedAddOverflow32(*i, *j, &expected))
- expected = constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ if (base::bits::SignedAddOverflow32(i, j, &expected)) expected = constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -5419,8 +5403,8 @@ TEST(RunInt32SubWithOverflowP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected_val;
- int expected_ovf = base::bits::SignedSubOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, bt.call(*i, *j));
+ int expected_ovf = base::bits::SignedSubOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, bt.call(i, j));
CHECK_EQ(expected_val, actual_val);
}
}
@@ -5432,41 +5416,39 @@ TEST(RunInt32SubWithOverflowImm) {
FOR_INT32_INPUTS(i) {
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32SubWithOverflow(m.Int32Constant(*i), m.Parameter(0));
+ Node* add = m.Int32SubWithOverflow(m.Int32Constant(i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedSubOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedSubOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32SubWithOverflow(m.Parameter(0), m.Int32Constant(*i));
+ Node* add = m.Int32SubWithOverflow(m.Parameter(0), m.Int32Constant(i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedSubOverflow32(*j, *i, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedSubOverflow32(j, i, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
CHECK_EQ(expected_val, actual_val);
}
}
FOR_INT32_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m;
Node* add =
- m.Int32SubWithOverflow(m.Int32Constant(*i), m.Int32Constant(*j));
+ m.Int32SubWithOverflow(m.Int32Constant(i), m.Int32Constant(j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
- int expected_ovf = base::bits::SignedSubOverflow32(*i, *j, &expected_val);
+ int expected_ovf = base::bits::SignedSubOverflow32(i, j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
CHECK_EQ(expected_val, actual_val);
}
@@ -5490,9 +5472,8 @@ TEST(RunInt32SubWithOverflowInBranchP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected;
- if (base::bits::SignedSubOverflow32(*i, *j, &expected))
- expected = constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ if (base::bits::SignedSubOverflow32(i, j, &expected)) expected = constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -5509,8 +5490,8 @@ TEST(RunInt32MulWithOverflowP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected_val;
- int expected_ovf = base::bits::SignedMulOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, bt.call(*i, *j));
+ int expected_ovf = base::bits::SignedMulOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, bt.call(i, j));
if (!expected_ovf) {
CHECK_EQ(expected_val, actual_val);
}
@@ -5523,15 +5504,14 @@ TEST(RunInt32MulWithOverflowImm) {
FOR_INT32_INPUTS(i) {
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32MulWithOverflow(m.Int32Constant(*i), m.Parameter(0));
+ Node* add = m.Int32MulWithOverflow(m.Int32Constant(i), m.Parameter(0));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedMulOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedMulOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
if (!expected_ovf) {
CHECK_EQ(expected_val, actual_val);
}
@@ -5539,15 +5519,14 @@ TEST(RunInt32MulWithOverflowImm) {
}
{
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- Node* add = m.Int32MulWithOverflow(m.Parameter(0), m.Int32Constant(*i));
+ Node* add = m.Int32MulWithOverflow(m.Parameter(0), m.Int32Constant(i));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
FOR_INT32_INPUTS(j) {
- int expected_ovf =
- base::bits::SignedMulOverflow32(*i, *j, &expected_val);
- CHECK_EQ(expected_ovf, m.Call(*j));
+ int expected_ovf = base::bits::SignedMulOverflow32(i, j, &expected_val);
+ CHECK_EQ(expected_ovf, m.Call(j));
if (!expected_ovf) {
CHECK_EQ(expected_val, actual_val);
}
@@ -5556,12 +5535,12 @@ TEST(RunInt32MulWithOverflowImm) {
FOR_INT32_INPUTS(j) {
RawMachineAssemblerTester<int32_t> m;
Node* add =
- m.Int32MulWithOverflow(m.Int32Constant(*i), m.Int32Constant(*j));
+ m.Int32MulWithOverflow(m.Int32Constant(i), m.Int32Constant(j));
Node* val = m.Projection(0, add);
Node* ovf = m.Projection(1, add);
m.StoreToPointer(&actual_val, MachineRepresentation::kWord32, val);
m.Return(ovf);
- int expected_ovf = base::bits::SignedMulOverflow32(*i, *j, &expected_val);
+ int expected_ovf = base::bits::SignedMulOverflow32(i, j, &expected_val);
CHECK_EQ(expected_ovf, m.Call());
if (!expected_ovf) {
CHECK_EQ(expected_val, actual_val);
@@ -5586,9 +5565,8 @@ TEST(RunInt32MulWithOverflowInBranchP) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected;
- if (base::bits::SignedMulOverflow32(*i, *j, &expected))
- expected = constant;
- CHECK_EQ(expected, bt.call(*i, *j));
+ if (base::bits::SignedMulOverflow32(i, j, &expected)) expected = constant;
+ CHECK_EQ(expected, bt.call(i, j));
}
}
}
@@ -5614,44 +5592,44 @@ TEST(RunWord64EqualInBranchP) {
TEST(RunChangeInt32ToInt64P) {
- if (kPointerSize < 8) return;
+ if (kSystemPointerSize < 8) return;
int64_t actual = -1;
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
m.StoreToPointer(&actual, MachineRepresentation::kWord64,
m.ChangeInt32ToInt64(m.Parameter(0)));
m.Return(m.Int32Constant(0));
FOR_INT32_INPUTS(i) {
- int64_t expected = *i;
- CHECK_EQ(0, m.Call(*i));
+ int64_t expected = i;
+ CHECK_EQ(0, m.Call(i));
CHECK_EQ(expected, actual);
}
}
TEST(RunChangeUint32ToUint64P) {
- if (kPointerSize < 8) return;
+ if (kSystemPointerSize < 8) return;
int64_t actual = -1;
RawMachineAssemblerTester<int32_t> m(MachineType::Uint32());
m.StoreToPointer(&actual, MachineRepresentation::kWord64,
m.ChangeUint32ToUint64(m.Parameter(0)));
m.Return(m.Int32Constant(0));
FOR_UINT32_INPUTS(i) {
- int64_t expected = static_cast<uint64_t>(*i);
- CHECK_EQ(0, m.Call(*i));
+ int64_t expected = static_cast<uint64_t>(i);
+ CHECK_EQ(0, m.Call(i));
CHECK_EQ(expected, actual);
}
}
TEST(RunTruncateInt64ToInt32P) {
- if (kPointerSize < 8) return;
+ if (kSystemPointerSize < 8) return;
int64_t expected = -1;
RawMachineAssemblerTester<int32_t> m;
m.Return(m.TruncateInt64ToInt32(
m.LoadFromPointer(&expected, MachineType::Int64())));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- expected = (static_cast<uint64_t>(*j) << 32) | *i;
+ expected = (static_cast<uint64_t>(j) << 32) | i;
CHECK_EQ(static_cast<int32_t>(expected), m.Call());
}
}
@@ -5739,17 +5717,15 @@ TEST(RunChangeFloat32ToFloat64) {
m.Return(m.ChangeFloat32ToFloat64(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) {
- CHECK_DOUBLE_EQ(static_cast<double>(*i), m.Call(*i));
- }
+ FOR_FLOAT32_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(i), m.Call(i)); }
}
TEST(RunFloat32Constant) {
FOR_FLOAT32_INPUTS(i) {
BufferedRawMachineAssemblerTester<float> m;
- m.Return(m.Float32Constant(*i));
- CHECK_FLOAT_EQ(*i, m.Call());
+ m.Return(m.Float32Constant(i));
+ CHECK_FLOAT_EQ(i, m.Call());
}
}
@@ -5758,8 +5734,8 @@ TEST(RunFloat64ExtractLowWord32) {
BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Float64());
m.Return(m.Float64ExtractLowWord32(m.Parameter(0)));
FOR_FLOAT64_INPUTS(i) {
- uint32_t expected = static_cast<uint32_t>(bit_cast<uint64_t>(*i));
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = static_cast<uint32_t>(bit_cast<uint64_t>(i));
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -5768,8 +5744,8 @@ TEST(RunFloat64ExtractHighWord32) {
BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Float64());
m.Return(m.Float64ExtractHighWord32(m.Parameter(0)));
FOR_FLOAT64_INPUTS(i) {
- uint32_t expected = static_cast<uint32_t>(bit_cast<uint64_t>(*i) >> 32);
- CHECK_EQ(expected, m.Call(*i));
+ uint32_t expected = static_cast<uint32_t>(bit_cast<uint64_t>(i) >> 32);
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -5781,9 +5757,9 @@ TEST(RunFloat64InsertLowWord32) {
FOR_FLOAT64_INPUTS(i) {
FOR_INT32_INPUTS(j) {
double expected =
- bit_cast<double>((bit_cast<uint64_t>(*i) & ~(uint64_t{0xFFFFFFFF})) |
- (static_cast<uint64_t>(bit_cast<uint32_t>(*j))));
- CHECK_DOUBLE_EQ(expected, m.Call(*i, *j));
+ bit_cast<double>((bit_cast<uint64_t>(i) & ~(uint64_t{0xFFFFFFFF})) |
+ (static_cast<uint64_t>(bit_cast<uint32_t>(j))));
+ CHECK_DOUBLE_EQ(expected, m.Call(i, j));
}
}
}
@@ -5795,10 +5771,10 @@ TEST(RunFloat64InsertHighWord32) {
m.Return(m.Float64InsertHighWord32(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- uint64_t expected = (bit_cast<uint64_t>(*i) & 0xFFFFFFFF) |
- (static_cast<uint64_t>(*j) << 32);
+ uint64_t expected = (bit_cast<uint64_t>(i) & 0xFFFFFFFF) |
+ (static_cast<uint64_t>(j) << 32);
- CHECK_DOUBLE_EQ(bit_cast<double>(expected), m.Call(*i, *j));
+ CHECK_DOUBLE_EQ(bit_cast<double>(expected), m.Call(i, j));
}
}
}
@@ -5807,46 +5783,38 @@ TEST(RunFloat64InsertHighWord32) {
TEST(RunFloat32Abs) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Float32());
m.Return(m.Float32Abs(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(std::abs(*i), m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(std::abs(i), m.Call(i)); }
}
TEST(RunFloat64Abs) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Float64Abs(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(std::abs(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(std::abs(i), m.Call(i)); }
}
TEST(RunFloat64Acos) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Float64Acos(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::acos(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::acos(i), m.Call(i)); }
}
TEST(RunFloat64Acosh) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Float64Acosh(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::acosh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::acosh(i), m.Call(i)); }
}
TEST(RunFloat64Asin) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Float64Asin(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::asin(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::asin(i), m.Call(i)); }
}
TEST(RunFloat64Asinh) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Float64());
m.Return(m.Float64Asinh(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::asinh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::asinh(i), m.Call(i)); }
}
TEST(RunFloat64Atan) {
@@ -5856,9 +5824,7 @@ TEST(RunFloat64Atan) {
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0));
CHECK_DOUBLE_EQ(0.0, m.Call(0.0));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::atan(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::atan(i), m.Call(i)); }
}
TEST(RunFloat64Atanh) {
@@ -5870,9 +5836,7 @@ TEST(RunFloat64Atanh) {
CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(-1.0));
CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0));
CHECK_DOUBLE_EQ(0.0, m.Call(0.0));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::atanh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::atanh(i), m.Call(i)); }
}
TEST(RunFloat64Atan2) {
@@ -5881,7 +5845,7 @@ TEST(RunFloat64Atan2) {
m.Return(m.Float64Atan2(m.Parameter(0), m.Parameter(1)));
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- CHECK_DOUBLE_EQ(base::ieee754::atan2(*i, *j), m.Call(*i, *j));
+ CHECK_DOUBLE_EQ(base::ieee754::atan2(i, j), m.Call(i, j));
}
}
}
@@ -5891,7 +5855,7 @@ TEST(RunFloat64Cos) {
m.Return(m.Float64Cos(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::cos(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::cos(i), m.Call(i)); }
}
TEST(RunFloat64Cosh) {
@@ -5899,9 +5863,7 @@ TEST(RunFloat64Cosh) {
m.Return(m.Float64Cosh(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::cosh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::cosh(i), m.Call(i)); }
}
TEST(RunFloat64Exp) {
@@ -5914,7 +5876,7 @@ TEST(RunFloat64Exp) {
CHECK_DOUBLE_EQ(1.0, m.Call(0.0));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::exp(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::exp(i), m.Call(i)); }
}
TEST(RunFloat64Expm1) {
@@ -5925,9 +5887,7 @@ TEST(RunFloat64Expm1) {
CHECK_EQ(-1.0, m.Call(-std::numeric_limits<double>::infinity()));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::expm1(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::expm1(i), m.Call(i)); }
}
TEST(RunFloat64Log) {
@@ -5942,7 +5902,7 @@ TEST(RunFloat64Log) {
CHECK_DOUBLE_EQ(0.0, m.Call(1.0));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::log(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::log(i), m.Call(i)); }
}
TEST(RunFloat64Log1p) {
@@ -5956,9 +5916,7 @@ TEST(RunFloat64Log1p) {
CHECK_DOUBLE_EQ(-0.0, m.Call(-0.0));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::log1p(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::log1p(i), m.Call(i)); }
}
TEST(RunFloat64Log2) {
@@ -5973,9 +5931,7 @@ TEST(RunFloat64Log2) {
CHECK_DOUBLE_EQ(0.0, m.Call(1.0));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::log2(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::log2(i), m.Call(i)); }
}
TEST(RunFloat64Log10) {
@@ -5989,9 +5945,7 @@ TEST(RunFloat64Log10) {
CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(), m.Call(0.0));
CHECK_DOUBLE_EQ(std::numeric_limits<double>::infinity(),
m.Call(std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::log10(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::log10(i), m.Call(i)); }
}
TEST(RunFloat64Cbrt) {
@@ -6003,9 +5957,7 @@ TEST(RunFloat64Cbrt) {
m.Call(std::numeric_limits<double>::infinity()));
CHECK_DOUBLE_EQ(-std::numeric_limits<double>::infinity(),
m.Call(-std::numeric_limits<double>::infinity()));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::cbrt(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::cbrt(i), m.Call(i)); }
}
TEST(RunFloat64Sin) {
@@ -6013,7 +5965,7 @@ TEST(RunFloat64Sin) {
m.Return(m.Float64Sin(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::sin(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::sin(i), m.Call(i)); }
}
TEST(RunFloat64Sinh) {
@@ -6021,9 +5973,7 @@ TEST(RunFloat64Sinh) {
m.Return(m.Float64Sinh(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::sinh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::sinh(i), m.Call(i)); }
}
TEST(RunFloat64Tan) {
@@ -6031,7 +5981,7 @@ TEST(RunFloat64Tan) {
m.Return(m.Float64Tan(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::tan(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::tan(i), m.Call(i)); }
}
TEST(RunFloat64Tanh) {
@@ -6039,9 +5989,7 @@ TEST(RunFloat64Tanh) {
m.Return(m.Float64Tanh(m.Parameter(0)));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::quiet_NaN())));
CHECK(std::isnan(m.Call(std::numeric_limits<double>::signaling_NaN())));
- FOR_FLOAT64_INPUTS(i) {
- CHECK_DOUBLE_EQ(base::ieee754::tanh(*i), m.Call(*i));
- }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(base::ieee754::tanh(i), m.Call(i)); }
}
static double two_30 = 1 << 30; // 2^30 is a smi boundary.
@@ -6148,7 +6096,7 @@ TEST(RunFloat32RoundDown) {
m.Return(m.Float32RoundDown(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(*i), m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(i), m.Call(i)); }
}
@@ -6158,7 +6106,7 @@ TEST(RunFloat64RoundDown1) {
m.Return(m.Float64RoundDown(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(i), m.Call(i)); }
}
@@ -6180,7 +6128,7 @@ TEST(RunFloat32RoundUp) {
if (!m.machine()->Float32RoundUp().IsSupported()) return;
m.Return(m.Float32RoundUp(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(*i), m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(i), m.Call(i)); }
}
@@ -6189,7 +6137,7 @@ TEST(RunFloat64RoundUp) {
if (!m.machine()->Float64RoundUp().IsSupported()) return;
m.Return(m.Float64RoundUp(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(i), m.Call(i)); }
}
@@ -6198,7 +6146,7 @@ TEST(RunFloat32RoundTiesEven) {
if (!m.machine()->Float32RoundTiesEven().IsSupported()) return;
m.Return(m.Float32RoundTiesEven(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyint(*i), m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyint(i), m.Call(i)); }
}
@@ -6207,7 +6155,7 @@ TEST(RunFloat64RoundTiesEven) {
if (!m.machine()->Float64RoundTiesEven().IsSupported()) return;
m.Return(m.Float64RoundTiesEven(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(i), m.Call(i)); }
}
@@ -6217,7 +6165,7 @@ TEST(RunFloat32RoundTruncate) {
m.Return(m.Float32RoundTruncate(m.Parameter(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(*i), m.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(i), m.Call(i)); }
}
@@ -6283,7 +6231,7 @@ TEST(RunCallCFunction1) {
m.Return(m.CallCFunction1(MachineType::Int32(), MachineType::Int32(),
function, m.Parameter(0)));
FOR_INT32_INPUTS(i) {
- int32_t const expected = *i;
+ int32_t const expected = i;
CHECK_EQ(expected, m.Call(expected));
}
}
@@ -6298,9 +6246,9 @@ TEST(RunCallCFunction2) {
MachineType::Int32(), function, m.Parameter(0),
m.Parameter(1)));
FOR_INT32_INPUTS(i) {
- int32_t const x = *i;
+ int32_t const x = i;
FOR_INT32_INPUTS(j) {
- int32_t const y = *j;
+ int32_t const y = j;
CHECK_EQ(base::SubWithWraparound(x, y), m.Call(x, y));
}
}
@@ -6318,7 +6266,7 @@ TEST(RunCallCFunction8) {
MachineType::Int32(), MachineType::Int32(), MachineType::Int32(),
function, param, param, param, param, param, param, param, param));
FOR_INT32_INPUTS(i) {
- int32_t const x = *i;
+ int32_t const x = i;
CHECK_EQ(base::MulWithWraparound(x, 8), m.Call(x));
}
}
@@ -6342,7 +6290,7 @@ TEST(RunCallCFunction9) {
m.Int32Add(param, m.Int32Constant(7)),
m.Int32Add(param, m.Int32Constant(8))));
FOR_INT32_INPUTS(i) {
- int32_t const x = *i;
+ int32_t const x = i;
CHECK_EQ(base::AddWithWraparound(base::MulWithWraparound(x, 9), 36),
m.Call(x));
}
@@ -6357,8 +6305,8 @@ TEST(RunChangeFloat64ToInt64) {
m.Return(m.ChangeFloat64ToInt64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
- double input = static_cast<double>(*i);
- if (static_cast<int64_t>(input) == *i) {
+ double input = static_cast<double>(i);
+ if (static_cast<int64_t>(input) == i) {
CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
}
}
@@ -6368,9 +6316,9 @@ TEST(RunChangeInt64ToFloat64) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Int64());
m.Return(m.ChangeInt64ToFloat64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
- double output = static_cast<double>(*i);
- if (static_cast<int64_t>(output) == *i) {
- CHECK_EQ(output, m.Call(*i));
+ double output = static_cast<double>(i);
+ if (static_cast<int64_t>(output) == i) {
+ CHECK_EQ(output, m.Call(i));
}
}
}
@@ -6384,7 +6332,7 @@ TEST(RunBitcastInt64ToFloat64) {
m.BitcastInt64ToFloat64(m.LoadFromPointer(&input, MachineType::Int64())));
m.Return(m.Int32Constant(11));
FOR_INT64_INPUTS(i) {
- input = *i;
+ input = i;
CHECK_EQ(11, m.Call());
Float64 expected = Float64::FromBits(input);
CHECK_EQ(expected.get_bits(), output.get_bits());
@@ -6396,7 +6344,7 @@ TEST(RunBitcastFloat64ToInt64) {
BufferedRawMachineAssemblerTester<int64_t> m(MachineType::Float64());
m.Return(m.BitcastFloat64ToInt64(m.Parameter(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(*i), m.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_EQ(bit_cast<int64_t>(i), m.Call(i)); }
}
@@ -6405,7 +6353,7 @@ TEST(RunTryTruncateFloat32ToInt64WithoutCheck) {
m.Return(m.TryTruncateFloat32ToInt64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
- float input = static_cast<float>(*i);
+ float input = static_cast<float>(i);
if (input < static_cast<float>(INT64_MAX) &&
input >= static_cast<float>(INT64_MIN)) {
CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
@@ -6424,12 +6372,12 @@ TEST(RunTryTruncateFloat32ToInt64WithCheck) {
m.Return(val);
FOR_FLOAT32_INPUTS(i) {
- if (*i < static_cast<float>(INT64_MAX) &&
- *i >= static_cast<float>(INT64_MIN)) {
- CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i));
+ if (i < static_cast<float>(INT64_MAX) &&
+ i >= static_cast<float>(INT64_MIN)) {
+ CHECK_EQ(static_cast<int64_t>(i), m.Call(i));
CHECK_NE(0, success);
} else {
- m.Call(*i);
+ m.Call(i);
CHECK_EQ(0, success);
}
}
@@ -6441,7 +6389,7 @@ TEST(RunTryTruncateFloat64ToInt64WithoutCheck) {
m.Return(m.TryTruncateFloat64ToInt64(m.Parameter(0)));
FOR_INT64_INPUTS(i) {
- double input = static_cast<double>(*i);
+ double input = static_cast<double>(i);
CHECK_EQ(static_cast<int64_t>(input), m.Call(input));
}
}
@@ -6457,13 +6405,13 @@ TEST(RunTryTruncateFloat64ToInt64WithCheck) {
m.Return(val);
FOR_FLOAT64_INPUTS(i) {
- if (*i < static_cast<double>(INT64_MAX) &&
- *i >= static_cast<double>(INT64_MIN)) {
+ if (i < static_cast<double>(INT64_MAX) &&
+ i >= static_cast<double>(INT64_MIN)) {
// Conversions within this range should succeed.
- CHECK_EQ(static_cast<int64_t>(*i), m.Call(*i));
+ CHECK_EQ(static_cast<int64_t>(i), m.Call(i));
CHECK_NE(0, success);
} else {
- m.Call(*i);
+ m.Call(i);
CHECK_EQ(0, success);
}
}
@@ -6475,7 +6423,7 @@ TEST(RunTryTruncateFloat32ToUint64WithoutCheck) {
m.Return(m.TryTruncateFloat32ToUint64(m.Parameter(0)));
FOR_UINT64_INPUTS(i) {
- float input = static_cast<float>(*i);
+ float input = static_cast<float>(i);
// This condition on 'input' is required because
// static_cast<float>(UINT64_MAX) results in a value outside uint64 range.
if (input < static_cast<float>(UINT64_MAX)) {
@@ -6495,12 +6443,12 @@ TEST(RunTryTruncateFloat32ToUint64WithCheck) {
m.Return(val);
FOR_FLOAT32_INPUTS(i) {
- if (*i < static_cast<float>(UINT64_MAX) && *i > -1.0) {
+ if (i < static_cast<float>(UINT64_MAX) && i > -1.0) {
// Conversions within this range should succeed.
- CHECK_EQ(static_cast<uint64_t>(*i), m.Call(*i));
+ CHECK_EQ(static_cast<uint64_t>(i), m.Call(i));
CHECK_NE(0, success);
} else {
- m.Call(*i);
+ m.Call(i);
CHECK_EQ(0, success);
}
}
@@ -6512,7 +6460,7 @@ TEST(RunTryTruncateFloat64ToUint64WithoutCheck) {
m.Return(m.TryTruncateFloat64ToUint64(m.Parameter(0)));
FOR_UINT64_INPUTS(j) {
- double input = static_cast<double>(*j);
+ double input = static_cast<double>(j);
if (input < static_cast<float>(UINT64_MAX)) {
CHECK_EQ(static_cast<uint64_t>(input), m.Call(input));
@@ -6531,12 +6479,12 @@ TEST(RunTryTruncateFloat64ToUint64WithCheck) {
m.Return(val);
FOR_FLOAT64_INPUTS(i) {
- if (*i < 18446744073709551616.0 && *i > -1) {
+ if (i < 18446744073709551616.0 && i > -1) {
// Conversions within this range should succeed.
- CHECK_EQ(static_cast<uint64_t>(*i), static_cast<uint64_t>(m.Call(*i)));
+ CHECK_EQ(static_cast<uint64_t>(i), static_cast<uint64_t>(m.Call(i)));
CHECK_NE(0, success);
} else {
- m.Call(*i);
+ m.Call(i);
CHECK_EQ(0, success);
}
}
@@ -6546,14 +6494,14 @@ TEST(RunTryTruncateFloat64ToUint64WithCheck) {
TEST(RunRoundInt64ToFloat32) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Int64());
m.Return(m.RoundInt64ToFloat32(m.Parameter(0)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(*i), m.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<float>(i), m.Call(i)); }
}
TEST(RunRoundInt64ToFloat64) {
BufferedRawMachineAssemblerTester<double> m(MachineType::Int64());
m.Return(m.RoundInt64ToFloat64(m.Parameter(0)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(*i), m.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(static_cast<double>(i), m.Call(i)); }
}
@@ -6745,7 +6693,7 @@ TEST(RunBitcastFloat32ToInt32) {
m.Return(m.BitcastFloat32ToInt32(
m.LoadFromPointer(&input, MachineType::Float32())));
FOR_FLOAT32_INPUTS(i) {
- input = *i;
+ input = i;
int32_t expected = bit_cast<int32_t>(input);
CHECK_EQ(expected, m.Call());
}
@@ -6756,8 +6704,8 @@ TEST(RunRoundInt32ToFloat32) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Int32());
m.Return(m.RoundInt32ToFloat32(m.Parameter(0)));
FOR_INT32_INPUTS(i) {
- volatile float expected = static_cast<float>(*i);
- CHECK_EQ(expected, m.Call(*i));
+ volatile float expected = static_cast<float>(i);
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -6766,8 +6714,8 @@ TEST(RunRoundUint32ToFloat32) {
BufferedRawMachineAssemblerTester<float> m(MachineType::Uint32());
m.Return(m.RoundUint32ToFloat32(m.Parameter(0)));
FOR_UINT32_INPUTS(i) {
- volatile float expected = static_cast<float>(*i);
- CHECK_EQ(expected, m.Call(*i));
+ volatile float expected = static_cast<float>(i);
+ CHECK_EQ(expected, m.Call(i));
}
}
@@ -6781,7 +6729,7 @@ TEST(RunBitcastInt32ToFloat32) {
m.BitcastInt32ToFloat32(m.LoadFromPointer(&input, MachineType::Int32())));
m.Return(m.Int32Constant(11));
FOR_INT32_INPUTS(i) {
- input = *i;
+ input = i;
CHECK_EQ(11, m.Call());
Float32 expected = Float32::FromBits(input);
CHECK_EQ(expected.get_bits(), output.get_bits());
diff --git a/deps/v8/test/cctest/compiler/test-run-native-calls.cc b/deps/v8/test/cctest/compiler/test-run-native-calls.cc
index 19c6abb8fc..7037bd5f2b 100644
--- a/deps/v8/test/cctest/compiler/test-run-native-calls.cc
+++ b/deps/v8/test/cctest/compiler/test-run-native-calls.cc
@@ -143,7 +143,7 @@ class Allocator {
}
int StackWords(MachineType type) {
int size = 1 << ElementSizeLog2Of(type.representation());
- return size <= kPointerSize ? 1 : size / kPointerSize;
+ return size <= kSystemPointerSize ? 1 : size / kSystemPointerSize;
}
void Reset() {
stack_offset_ = 0;
@@ -542,9 +542,9 @@ static void TestInt32Sub(CallDescriptor* desc) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*i) -
- static_cast<uint32_t>(*j));
- int32_t result = runnable.Call(*i, *j);
+ int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(i) -
+ static_cast<uint32_t>(j));
+ int32_t result = runnable.Call(i, j);
CHECK_EQ(expected, result);
}
}
@@ -831,7 +831,8 @@ TEST_INT32_SELECT(63)
TEST(Int64Select_registers) {
if (GetRegConfig()->num_allocatable_general_registers() < 2) return;
- if (kPointerSize < 8) return; // TODO(titzer): int64 on 32-bit platforms
+ // TODO(titzer): int64 on 32-bit platforms
+ if (kSystemPointerSize < 8) return;
int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)};
ArgsBuffer<int64_t>::Sig sig(2);
diff --git a/deps/v8/test/cctest/compiler/value-helper.h b/deps/v8/test/cctest/compiler/value-helper.h
index 45750e7e28..34079f1032 100644
--- a/deps/v8/test/cctest/compiler/value-helper.h
+++ b/deps/v8/test/cctest/compiler/value-helper.h
@@ -317,14 +317,9 @@ class ValueHelper {
}
};
-// Helper macros that can be used in FOR_INT32_INPUTS(i) { ... *i ... }
-// Watch out, these macros aren't hygenic; they pollute your scope. Thanks STL.
-#define FOR_INPUTS(ctype, itype, var) \
- Vector<const ctype> var##_vec = \
- ::v8::internal::compiler::ValueHelper::itype##_vector(); \
- for (Vector<const ctype>::iterator var = var##_vec.begin(), \
- var##_end = var##_vec.end(); \
- var != var##_end; ++var)
+// Helper macros that can be used in FOR_INT32_INPUTS(i) { ... i ... }
+#define FOR_INPUTS(ctype, itype, var) \
+ for (ctype var : ::v8::internal::compiler::ValueHelper::itype##_vector())
#define FOR_INT32_INPUTS(var) FOR_INPUTS(int32_t, int32, var)
#define FOR_UINT32_INPUTS(var) FOR_INPUTS(uint32_t, uint32, var)
diff --git a/deps/v8/test/cctest/heap/heap-utils.cc b/deps/v8/test/cctest/heap/heap-utils.cc
index 084bf6ef1b..0e437ed9d8 100644
--- a/deps/v8/test/cctest/heap/heap-utils.cc
+++ b/deps/v8/test/cctest/heap/heap-utils.cc
@@ -15,6 +15,10 @@ namespace v8 {
namespace internal {
namespace heap {
+void InvokeScavenge() { CcTest::CollectGarbage(i::NEW_SPACE); }
+
+void InvokeMarkSweep() { CcTest::CollectAllGarbage(); }
+
void SealCurrentObjects(Heap* heap) {
CcTest::CollectAllGarbage();
CcTest::CollectAllGarbage();
@@ -26,7 +30,8 @@ void SealCurrentObjects(Heap* heap) {
}
int FixedArrayLenFromSize(int size) {
- return (size - FixedArray::kHeaderSize) / kTaggedSize;
+ return Min((size - FixedArray::kHeaderSize) / kTaggedSize,
+ FixedArray::kMaxRegularLength);
}
std::vector<Handle<FixedArray>> FillOldSpacePageWithFixedArrays(Heap* heap,
@@ -101,9 +106,10 @@ std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size,
}
}
handles.push_back(isolate->factory()->NewFixedArray(length, tenure));
- CHECK((tenure == NOT_TENURED && Heap::InNewSpace(*handles.back())) ||
+ CHECK((tenure == NOT_TENURED &&
+ heap->new_space()->Contains(*handles.back())) ||
(tenure == TENURED && heap->InOldSpace(*handles.back())));
- free_memory -= allocate_memory;
+ free_memory -= handles.back()->Size();
}
return handles;
}
@@ -148,6 +154,7 @@ void SimulateFullSpace(v8::internal::NewSpace* space,
}
void SimulateIncrementalMarking(i::Heap* heap, bool force_completion) {
+ const double kStepSizeInMs = 100;
CHECK(FLAG_incremental_marking);
i::IncrementalMarking* marking = heap->incremental_marking();
i::MarkCompactCollector* collector = heap->mark_compact_collector();
@@ -166,8 +173,8 @@ void SimulateIncrementalMarking(i::Heap* heap, bool force_completion) {
if (!force_completion) return;
while (!marking->IsComplete()) {
- marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- i::StepOrigin::kV8);
+ marking->V8Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ i::StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
diff --git a/deps/v8/test/cctest/heap/heap-utils.h b/deps/v8/test/cctest/heap/heap-utils.h
index a494f54210..30a18b5895 100644
--- a/deps/v8/test/cctest/heap/heap-utils.h
+++ b/deps/v8/test/cctest/heap/heap-utils.h
@@ -5,6 +5,7 @@
#ifndef HEAP_HEAP_UTILS_H_
#define HEAP_HEAP_UTILS_H_
+#include "src/api-inl.h"
#include "src/heap/heap.h"
namespace v8 {
@@ -52,6 +53,17 @@ void GcAndSweep(Heap* heap, AllocationSpace space);
void ForceEvacuationCandidate(Page* page);
+void InvokeScavenge();
+
+void InvokeMarkSweep();
+
+template <typename GlobalOrPersistent>
+bool InYoungGeneration(v8::Isolate* isolate, const GlobalOrPersistent& global) {
+ v8::HandleScope scope(isolate);
+ auto tmp = global.Get(isolate);
+ return i::Heap::InYoungGeneration(*v8::Utils::OpenHandle(*tmp));
+}
+
} // namespace heap
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/heap/test-alloc.cc b/deps/v8/test/cctest/heap/test-alloc.cc
index 89bb25b56c..cf01d9fe9b 100644
--- a/deps/v8/test/cctest/heap/test-alloc.cc
+++ b/deps/v8/test/cctest/heap/test-alloc.cc
@@ -30,6 +30,7 @@
#include "src/accessors.h"
#include "src/api-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/objects-inl.h"
#include "src/objects/api-callbacks.h"
#include "src/property.h"
@@ -48,15 +49,16 @@ Handle<Object> HeapTester::TestAllocateAfterFailures() {
AlwaysAllocateScope scope(CcTest::i_isolate());
Heap* heap = CcTest::heap();
int size = FixedArray::SizeFor(100);
- // New space.
- HeapObject obj = heap->AllocateRaw(size, NEW_SPACE).ToObjectChecked();
+ // Young generation.
+ HeapObject obj =
+ heap->AllocateRaw(size, AllocationType::kYoung).ToObjectChecked();
// In order to pass heap verification on Isolate teardown, mark the
// allocated area as a filler.
heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo);
- // Old space.
+ // Old generation.
heap::SimulateFullSpace(heap->old_space());
- obj = heap->AllocateRaw(size, OLD_SPACE).ToObjectChecked();
+ obj = heap->AllocateRaw(size, AllocationType::kOld).ToObjectChecked();
heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo);
// Large object space.
@@ -67,24 +69,24 @@ Handle<Object> HeapTester::TestAllocateAfterFailures() {
CHECK_GT(kLargeObjectSpaceFillerSize,
static_cast<size_t>(heap->old_space()->AreaSize()));
while (heap->OldGenerationSpaceAvailable() > kLargeObjectSpaceFillerSize) {
- obj = heap->AllocateRaw(kLargeObjectSpaceFillerSize, OLD_SPACE)
+ obj = heap->AllocateRaw(kLargeObjectSpaceFillerSize, AllocationType::kOld)
.ToObjectChecked();
heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo);
}
- obj = heap->AllocateRaw(kLargeObjectSpaceFillerSize, OLD_SPACE)
+ obj = heap->AllocateRaw(kLargeObjectSpaceFillerSize, AllocationType::kOld)
.ToObjectChecked();
heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo);
// Map space.
heap::SimulateFullSpace(heap->map_space());
- obj = heap->AllocateRaw(Map::kSize, MAP_SPACE).ToObjectChecked();
+ obj = heap->AllocateRaw(Map::kSize, AllocationType::kMap).ToObjectChecked();
heap->CreateFillerObjectAt(obj->address(), Map::kSize,
ClearRecordedSlots::kNo);
// Code space.
heap::SimulateFullSpace(heap->code_space());
size = CcTest::i_isolate()->builtins()->builtin(Builtins::kIllegal)->Size();
- obj = heap->AllocateRaw(size, CODE_SPACE).ToObjectChecked();
+ obj = heap->AllocateRaw(size, AllocationType::kCode).ToObjectChecked();
heap->CreateFillerObjectAt(obj->address(), size, ClearRecordedSlots::kNo);
return CcTest::i_isolate()->factory()->true_value();
}
diff --git a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc
index daeccca777..9cc2d84ec9 100644
--- a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc
+++ b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc
@@ -308,10 +308,11 @@ TEST(ArrayBuffer_SemiSpaceCopyThenPagePromotion) {
UNINITIALIZED_TEST(ArrayBuffer_SemiSpaceCopyMultipleTasks) {
if (FLAG_optimize_for_size) return;
+ ManualGCScope manual_gc_scope;
// Test allocates JSArrayBuffer on different pages before triggering a
// full GC that performs the semispace copy. If parallelized, this test
// ensures proper synchronization in TSAN configurations.
- FLAG_min_semi_space_size = 2 * Page::kPageSize / MB;
+ FLAG_min_semi_space_size = Max(2 * Page::kPageSize / MB, 1);
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
v8::Isolate* isolate = v8::Isolate::New(create_params);
diff --git a/deps/v8/test/cctest/heap/test-compaction.cc b/deps/v8/test/cctest/heap/test-compaction.cc
index 9fb989482c..eea4a6eb43 100644
--- a/deps/v8/test/cctest/heap/test-compaction.cc
+++ b/deps/v8/test/cctest/heap/test-compaction.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/mark-compact.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
@@ -96,8 +97,9 @@ HEAP_TEST(CompactionPartiallyAbortedPage) {
const int objects_per_page = 10;
const int object_size =
- static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
- objects_per_page;
+ Min(kMaxRegularHeapObjectSize,
+ static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
+ objects_per_page);
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
@@ -175,8 +177,9 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) {
const int objects_per_page = 10;
const int object_size =
- static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
- objects_per_page;
+ Min(kMaxRegularHeapObjectSize,
+ static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
+ objects_per_page);
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
@@ -267,8 +270,9 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) {
const int objects_per_page = 10;
const int object_size =
- static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
- objects_per_page;
+ Min(kMaxRegularHeapObjectSize,
+ static_cast<int>(MemoryChunkLayout::AllocatableMemoryInDataPage()) /
+ objects_per_page);
CcTest::InitializeVM();
Isolate* isolate = CcTest::i_isolate();
@@ -302,7 +306,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) {
root_array->set(0, *compaction_page_handles.back());
Handle<FixedArray> new_space_array =
isolate->factory()->NewFixedArray(1, NOT_TENURED);
- CHECK(Heap::InNewSpace(*new_space_array));
+ CHECK(Heap::InYoungGeneration(*new_space_array));
compaction_page_handles.front()->set(1, *new_space_array);
CheckAllObjectsOnPage(compaction_page_handles, to_be_aborted_page);
}
@@ -329,7 +333,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) {
while (current->get(0) != ReadOnlyRoots(heap).undefined_value()) {
current =
Handle<FixedArray>(FixedArray::cast(current->get(0)), isolate);
- CHECK(!Heap::InNewSpace(*current));
+ CHECK(!Heap::InYoungGeneration(*current));
CHECK(current->IsFixedArray());
if (Page::FromHeapObject(*current) != to_be_aborted_page) {
in_place = false;
diff --git a/deps/v8/test/cctest/heap/test-embedder-tracing.cc b/deps/v8/test/cctest/heap/test-embedder-tracing.cc
index 5134392886..ace016dbd0 100644
--- a/deps/v8/test/cctest/heap/test-embedder-tracing.cc
+++ b/deps/v8/test/cctest/heap/test-embedder-tracing.cc
@@ -2,13 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include <unordered_map>
+#include <vector>
+
#include "include/v8.h"
#include "src/api-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/objects-inl.h"
#include "src/objects/module.h"
#include "src/objects/script.h"
#include "src/objects/shared-function-info.h"
#include "test/cctest/cctest.h"
+#include "test/cctest/heap/heap-utils.h"
namespace v8 {
namespace internal {
@@ -35,9 +40,14 @@ v8::Local<v8::Object> ConstructTraceableJSApiObject(
return scope.Escape(instance);
}
+enum class TracePrologueBehavior { kNoop, kCallV8WriteBarrier };
+
class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer {
public:
- explicit TestEmbedderHeapTracer(v8::Isolate* isolate) : isolate_(isolate) {}
+ TestEmbedderHeapTracer() = default;
+ TestEmbedderHeapTracer(TracePrologueBehavior prologue_behavior,
+ v8::Global<v8::Array> array)
+ : prologue_behavior_(prologue_behavior), array_(std::move(array)) {}
void RegisterV8References(
const std::vector<std::pair<void*, void*>>& embedder_fields) final {
@@ -45,13 +55,13 @@ class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer {
embedder_fields.begin(), embedder_fields.end());
}
- void AddReferenceForTracing(v8::Persistent<v8::Object>* persistent) {
- to_register_with_v8_.push_back(persistent);
+ void AddReferenceForTracing(v8::TracedGlobal<v8::Object>* global) {
+ to_register_with_v8_.push_back(global);
}
bool AdvanceTracing(double deadline_in_ms) final {
- for (auto persistent : to_register_with_v8_) {
- persistent->RegisterExternalReference(isolate_);
+ for (auto global : to_register_with_v8_) {
+ RegisterEmbedderReference(global->As<v8::Value>());
}
to_register_with_v8_.clear();
return true;
@@ -59,9 +69,15 @@ class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer {
bool IsTracingDone() final { return to_register_with_v8_.empty(); }
- void TracePrologue() final {}
+ void TracePrologue() final {
+ if (prologue_behavior_ == TracePrologueBehavior::kCallV8WriteBarrier) {
+ auto local = array_.Get(isolate());
+ local->Set(local->CreationContext(), 0, v8::Object::New(isolate()))
+ .Check();
+ }
+ }
+
void TraceEpilogue() final {}
- void AbortTracing() final {}
void EnterFinalPause(EmbedderStackState) final {}
bool IsRegisteredFromV8(void* first_field) const {
@@ -71,10 +87,20 @@ class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer {
return false;
}
+ void ConsiderTracedGlobalAsRoot(bool value) {
+ consider_traced_global_as_root_ = value;
+ }
+
+ bool IsRootForNonTracingGC(const v8::TracedGlobal<v8::Value>& handle) final {
+ return consider_traced_global_as_root_;
+ }
+
private:
- v8::Isolate* const isolate_;
std::vector<std::pair<void*, void*>> registered_from_v8_;
- std::vector<v8::Persistent<v8::Object>*> to_register_with_v8_;
+ std::vector<v8::TracedGlobal<v8::Object>*> to_register_with_v8_;
+ bool consider_traced_global_as_root_ = true;
+ TracePrologueBehavior prologue_behavior_ = TracePrologueBehavior::kNoop;
+ v8::Global<v8::Array> array_;
};
class TemporaryEmbedderHeapTracerScope {
@@ -101,7 +127,7 @@ TEST(V8RegisteringEmbedderReference) {
ManualGCScope manual_gc;
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
@@ -121,19 +147,18 @@ TEST(EmbedderRegisteringV8Reference) {
ManualGCScope manual_gc;
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
v8::Context::Scope context_scope(context);
- v8::Persistent<v8::Object> g;
+ v8::TracedGlobal<v8::Object> g;
{
v8::HandleScope inner_scope(isolate);
v8::Local<v8::Object> o =
v8::Local<v8::Object>::New(isolate, v8::Object::New(isolate));
g.Reset(isolate, o);
- g.SetWeak();
}
tracer.AddReferenceForTracing(&g);
CcTest::CollectGarbage(i::OLD_SPACE);
@@ -155,7 +180,7 @@ TEST(TracingInRevivedSubgraph) {
ManualGCScope manual_gc;
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
@@ -183,7 +208,7 @@ TEST(TracingInEphemerons) {
ManualGCScope manual_gc;
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
v8::HandleScope scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
@@ -214,7 +239,7 @@ TEST(FinalizeTracingIsNoopWhenNotMarking) {
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
Isolate* i_isolate = CcTest::i_isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
// Finalize a potentially running garbage collection.
@@ -233,7 +258,7 @@ TEST(FinalizeTracingWhenMarking) {
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
Isolate* i_isolate = CcTest::i_isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
// Finalize a potentially running garbage collection.
@@ -258,7 +283,7 @@ TEST(GarbageCollectionForTesting) {
CcTest::InitializeVM();
v8::Isolate* isolate = CcTest::isolate();
Isolate* i_isolate = CcTest::i_isolate();
- TestEmbedderHeapTracer tracer(isolate);
+ TestEmbedderHeapTracer tracer;
TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
int saved_gc_counter = i_isolate->heap()->gc_count();
@@ -266,6 +291,293 @@ TEST(GarbageCollectionForTesting) {
CHECK_GT(i_isolate->heap()->gc_count(), saved_gc_counter);
}
+namespace {
+
+void ConstructJSObject(v8::Isolate* isolate, v8::Local<v8::Context> context,
+ v8::TracedGlobal<v8::Object>* global) {
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Object> object(v8::Object::New(isolate));
+ CHECK(!object.IsEmpty());
+ *global = v8::TracedGlobal<v8::Object>(isolate, object);
+ CHECK(!global->IsEmpty());
+}
+
+void ConstructJSApiObject(v8::Isolate* isolate, v8::Local<v8::Context> context,
+ v8::TracedGlobal<v8::Object>* global) {
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Object> object(
+ ConstructTraceableJSApiObject(context, nullptr, nullptr));
+ CHECK(!object.IsEmpty());
+ *global = v8::TracedGlobal<v8::Object>(isolate, object);
+ CHECK(!global->IsEmpty());
+}
+
+enum class SurvivalMode { kSurvives, kDies };
+
+template <typename ModifierFunction, typename ConstructTracedGlobalFunction>
+void TracedGlobalTest(v8::Isolate* isolate,
+ ConstructTracedGlobalFunction construct_function,
+ ModifierFunction modifier_function, void (*gc_function)(),
+ SurvivalMode survives) {
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ v8::Context::Scope context_scope(context);
+
+ v8::TracedGlobal<v8::Object> global;
+ construct_function(isolate, context, &global);
+ CHECK(InYoungGeneration(isolate, global));
+ modifier_function(global);
+ gc_function();
+ CHECK_IMPLIES(survives == SurvivalMode::kSurvives, !global.IsEmpty());
+ CHECK_IMPLIES(survives == SurvivalMode::kDies, global.IsEmpty());
+}
+
+} // namespace
+
+TEST(TracedGlobalReset) {
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+
+ v8::TracedGlobal<v8::Object> traced;
+ ConstructJSObject(isolate, isolate->GetCurrentContext(), &traced);
+ CHECK(!traced.IsEmpty());
+ traced.Reset();
+ CHECK(traced.IsEmpty());
+}
+
+TEST(TracedGlobalInStdVector) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+
+ std::vector<v8::TracedGlobal<v8::Object>> vec;
+ {
+ v8::HandleScope scope(isolate);
+ vec.emplace_back(isolate, v8::Object::New(isolate));
+ }
+ CHECK(!vec[0].IsEmpty());
+ InvokeMarkSweep();
+ CHECK(vec[0].IsEmpty());
+}
+
+TEST(TracedGlobalInStdUnorderedMap) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+
+ std::unordered_map<int, v8::TracedGlobal<v8::Object>> map;
+ {
+ v8::HandleScope scope(isolate);
+ map.emplace(std::piecewise_construct, std::forward_as_tuple(1),
+ std::forward_as_tuple(isolate, v8::Object::New(isolate)));
+ }
+ CHECK(!map[1].IsEmpty());
+ InvokeMarkSweep();
+ CHECK(map[1].IsEmpty());
+}
+
+TEST(TracedGlobalToUnmodifiedJSObjectDiesOnMarkSweep) {
+ CcTest::InitializeVM();
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSObject,
+ [](const TracedGlobal<v8::Object>& global) {}, InvokeMarkSweep,
+ SurvivalMode::kDies);
+}
+
+TEST(TracedGlobalToUnmodifiedJSObjectSurvivesMarkSweepWhenHeldAliveOtherwise) {
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::Global<v8::Object> strong_global;
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSObject,
+ [isolate, &strong_global](const TracedGlobal<v8::Object>& global) {
+ v8::HandleScope scope(isolate);
+ strong_global = v8::Global<v8::Object>(isolate, global.Get(isolate));
+ },
+ InvokeMarkSweep, SurvivalMode::kSurvives);
+}
+
+TEST(TracedGlobalToUnmodifiedJSObjectSurvivesScavenge) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSObject,
+ [](const TracedGlobal<v8::Object>& global) {}, InvokeScavenge,
+ SurvivalMode::kSurvives);
+}
+
+TEST(TracedGlobalToUnmodifiedJSObjectSurvivesScavengeWhenExcludedFromRoots) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+ tracer.ConsiderTracedGlobalAsRoot(false);
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSObject,
+ [](const TracedGlobal<v8::Object>& global) {}, InvokeScavenge,
+ SurvivalMode::kSurvives);
+}
+
+TEST(TracedGlobalToUnmodifiedJSApiObjectSurvivesScavengePerDefault) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+ tracer.ConsiderTracedGlobalAsRoot(true);
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSApiObject,
+ [](const TracedGlobal<v8::Object>& global) {}, InvokeScavenge,
+ SurvivalMode::kSurvives);
+}
+
+TEST(TracedGlobalToUnmodifiedJSApiObjectDiesOnScavengeWhenExcludedFromRoots) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+ tracer.ConsiderTracedGlobalAsRoot(false);
+ TracedGlobalTest(
+ CcTest::isolate(), ConstructJSApiObject,
+ [](const TracedGlobal<v8::Object>& global) {}, InvokeScavenge,
+ SurvivalMode::kDies);
+}
+
+TEST(TracedGlobalWrapperClassId) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+
+ v8::TracedGlobal<v8::Object> traced;
+ ConstructJSObject(isolate, isolate->GetCurrentContext(), &traced);
+ CHECK_EQ(0, traced.WrapperClassId());
+ traced.SetWrapperClassId(17);
+ CHECK_EQ(17, traced.WrapperClassId());
+}
+
+namespace {
+
+class TracedGlobalVisitor final
+ : public v8::EmbedderHeapTracer::TracedGlobalHandleVisitor {
+ public:
+ ~TracedGlobalVisitor() override = default;
+ void VisitTracedGlobalHandle(const TracedGlobal<Value>& value) final {
+ if (value.WrapperClassId() == 57) {
+ count_++;
+ }
+ }
+
+ size_t count() const { return count_; }
+
+ private:
+ size_t count_ = 0;
+};
+
+} // namespace
+
+TEST(TracedGlobalIteration) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+
+ v8::TracedGlobal<v8::Object> traced;
+ ConstructJSObject(isolate, isolate->GetCurrentContext(), &traced);
+ CHECK(!traced.IsEmpty());
+ traced.SetWrapperClassId(57);
+ TracedGlobalVisitor visitor;
+ {
+ v8::HandleScope scope(isolate);
+ tracer.IterateTracedGlobalHandles(&visitor);
+ }
+ CHECK_EQ(1, visitor.count());
+}
+
+namespace {
+
+void FinalizationCallback(const WeakCallbackInfo<void>& data) {
+ v8::TracedGlobal<v8::Object>* traced =
+ reinterpret_cast<v8::TracedGlobal<v8::Object>*>(data.GetParameter());
+ CHECK_EQ(reinterpret_cast<void*>(0x4), data.GetInternalField(0));
+ CHECK_EQ(reinterpret_cast<void*>(0x8), data.GetInternalField(1));
+ traced->Reset();
+}
+
+} // namespace
+
+TEST(TracedGlobalSetFinalizationCallbackScavenge) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ TestEmbedderHeapTracer tracer;
+ tracer.ConsiderTracedGlobalAsRoot(false);
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+
+ v8::TracedGlobal<v8::Object> traced;
+ ConstructJSApiObject(isolate, isolate->GetCurrentContext(), &traced);
+ CHECK(!traced.IsEmpty());
+ {
+ v8::HandleScope scope(isolate);
+ auto local = traced.Get(isolate);
+ local->SetAlignedPointerInInternalField(0, reinterpret_cast<void*>(0x4));
+ local->SetAlignedPointerInInternalField(1, reinterpret_cast<void*>(0x8));
+ }
+ traced.SetFinalizationCallback(&traced, FinalizationCallback);
+ heap::InvokeScavenge();
+ CHECK(traced.IsEmpty());
+}
+
+TEST(TracedGlobalSetFinalizationCallbackMarkSweep) {
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ TestEmbedderHeapTracer tracer;
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+
+ v8::TracedGlobal<v8::Object> traced;
+ ConstructJSApiObject(isolate, isolate->GetCurrentContext(), &traced);
+ CHECK(!traced.IsEmpty());
+ {
+ v8::HandleScope scope(isolate);
+ auto local = traced.Get(isolate);
+ local->SetAlignedPointerInInternalField(0, reinterpret_cast<void*>(0x4));
+ local->SetAlignedPointerInInternalField(1, reinterpret_cast<void*>(0x8));
+ }
+ traced.SetFinalizationCallback(&traced, FinalizationCallback);
+ heap::InvokeMarkSweep();
+ CHECK(traced.IsEmpty());
+}
+
+TEST(TracePrologueCallingIntoV8WriteBarrier) {
+ // Regression test: https://crbug.com/940003
+ ManualGCScope manual_gc;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ v8::Global<v8::Array> global;
+ {
+ v8::HandleScope scope(isolate);
+ auto local = v8::Array::New(isolate, 10);
+ global.Reset(isolate, local);
+ }
+ TestEmbedderHeapTracer tracer(TracePrologueBehavior::kCallV8WriteBarrier,
+ std::move(global));
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+ SimulateIncrementalMarking(CcTest::i_isolate()->heap());
+}
+
} // namespace heap
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/heap/test-external-string-tracker.cc b/deps/v8/test/cctest/heap/test-external-string-tracker.cc
index 36a9391307..bcc00764de 100644
--- a/deps/v8/test/cctest/heap/test-external-string-tracker.cc
+++ b/deps/v8/test/cctest/heap/test-external-string-tracker.cc
@@ -4,6 +4,7 @@
#include "src/api-inl.h"
#include "src/api.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/spaces.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
@@ -193,7 +194,7 @@ TEST(ExternalString_PromotedThinString) {
i::Handle<i::String> isymbol1 = factory->InternalizeString(string1);
CHECK(isymbol1->IsInternalizedString());
CHECK(string1->IsExternalString());
- CHECK(!heap->InNewSpace(*isymbol1));
+ CHECK(!heap->InYoungGeneration(*isymbol1));
// New external string in the young space. This string has the same content
// as the previous one (that was already internalized).
@@ -209,7 +210,7 @@ TEST(ExternalString_PromotedThinString) {
i::Handle<i::String> isymbol2 = factory->InternalizeString(istring);
CHECK(isymbol2->IsInternalizedString());
CHECK(istring->IsThinString());
- CHECK(heap->InNewSpace(*istring));
+ CHECK(heap->InYoungGeneration(*istring));
// Collect thin string. References to the thin string will be updated to
// point to the actual external string in the old space.
diff --git a/deps/v8/test/cctest/heap/test-heap.cc b/deps/v8/test/cctest/heap/test-heap.cc
index c7c1d93f87..f12ba10979 100644
--- a/deps/v8/test/cctest/heap/test-heap.cc
+++ b/deps/v8/test/cctest/heap/test-heap.cc
@@ -37,8 +37,10 @@
#include "src/execution.h"
#include "src/field-type.h"
#include "src/global-handles.h"
+#include "src/hash-seed-inl.h"
#include "src/heap/factory.h"
#include "src/heap/gc-tracer.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/mark-compact.h"
#include "src/heap/memory-reducer.h"
@@ -46,6 +48,7 @@
#include "src/ic/ic.h"
#include "src/macro-assembler-inl.h"
#include "src/objects-inl.h"
+#include "src/objects/frame-array-inl.h"
#include "src/objects/heap-number-inl.h"
#include "src/objects/js-array-inl.h"
#include "src/objects/js-collection-inl.h"
@@ -188,7 +191,7 @@ HEAP_TEST(TestNewSpaceRefsInCopiedCode) {
HandleScope sc(isolate);
Handle<HeapNumber> value = factory->NewHeapNumber(1.000123);
- CHECK(Heap::InNewSpace(*value));
+ CHECK(Heap::InYoungGeneration(*value));
i::byte buffer[i::Assembler::kMinimalBufferSize];
MacroAssembler masm(isolate, v8::internal::CodeObjectRequired::kYes,
@@ -368,16 +371,11 @@ TEST(GarbageCollection) {
HandleScope inner_scope(isolate);
// Allocate a function and keep it in global object's property.
Handle<JSFunction> function = factory->NewFunctionForTest(name);
- Object::SetProperty(isolate, global, name, function, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, global, name, function).Check();
// Allocate an object. Unrooted after leaving the scope.
Handle<JSObject> obj = factory->NewJSObject(function);
- Object::SetProperty(isolate, obj, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_namex, twenty_four,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
+ Object::SetProperty(isolate, obj, prop_namex, twenty_four).Check();
CHECK_EQ(Smi::FromInt(23),
*Object::GetProperty(isolate, obj, prop_name).ToHandleChecked());
@@ -399,11 +397,8 @@ TEST(GarbageCollection) {
HandleScope inner_scope(isolate);
// Allocate another object, make it reachable from global.
Handle<JSObject> obj = factory->NewJSObject(function);
- Object::SetProperty(isolate, global, obj_name, obj, LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, global, obj_name, obj).Check();
+ Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
}
// After gc, it should survive.
@@ -698,7 +693,7 @@ TEST(WeakGlobalHandlesMark) {
// Make sure the objects are promoted.
CcTest::CollectGarbage(OLD_SPACE);
CcTest::CollectGarbage(NEW_SPACE);
- CHECK(!Heap::InNewSpace(*h1) && !Heap::InNewSpace(*h2));
+ CHECK(!Heap::InYoungGeneration(*h1) && !Heap::InYoungGeneration(*h2));
std::pair<Handle<Object>*, int> handle_and_id(&h2, 1234);
GlobalHandles::MakeWeak(
@@ -944,15 +939,11 @@ TEST(FunctionAllocation) {
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
Handle<JSObject> obj = factory->NewJSObject(function);
- Object::SetProperty(isolate, obj, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
CHECK_EQ(Smi::FromInt(23),
*Object::GetProperty(isolate, obj, prop_name).ToHandleChecked());
// Check that we can add properties to function objects.
- Object::SetProperty(isolate, function, prop_name, twenty_four,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, function, prop_name, twenty_four).Check();
CHECK_EQ(
Smi::FromInt(24),
*Object::GetProperty(isolate, function, prop_name).ToHandleChecked());
@@ -983,7 +974,7 @@ TEST(ObjectProperties) {
CHECK(Just(false) == JSReceiver::HasOwnProperty(obj, first));
// add first
- Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
+ Object::SetProperty(isolate, obj, first, one).Check();
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, first));
// delete first
@@ -992,8 +983,8 @@ TEST(ObjectProperties) {
CHECK(Just(false) == JSReceiver::HasOwnProperty(obj, first));
// add first and then second
- Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
- Object::SetProperty(isolate, obj, second, two, LanguageMode::kSloppy).Check();
+ Object::SetProperty(isolate, obj, first, one).Check();
+ Object::SetProperty(isolate, obj, second, two).Check();
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, first));
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, second));
@@ -1007,8 +998,8 @@ TEST(ObjectProperties) {
CHECK(Just(false) == JSReceiver::HasOwnProperty(obj, second));
// add first and then second
- Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
- Object::SetProperty(isolate, obj, second, two, LanguageMode::kSloppy).Check();
+ Object::SetProperty(isolate, obj, first, one).Check();
+ Object::SetProperty(isolate, obj, second, two).Check();
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, first));
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, second));
@@ -1024,15 +1015,14 @@ TEST(ObjectProperties) {
// check string and internalized string match
const char* string1 = "fisk";
Handle<String> s1 = factory->NewStringFromAsciiChecked(string1);
- Object::SetProperty(isolate, obj, s1, one, LanguageMode::kSloppy).Check();
+ Object::SetProperty(isolate, obj, s1, one).Check();
Handle<String> s1_string = factory->InternalizeUtf8String(string1);
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, s1_string));
// check internalized string and string match
const char* string2 = "fugl";
Handle<String> s2_string = factory->InternalizeUtf8String(string2);
- Object::SetProperty(isolate, obj, s2_string, one, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, s2_string, one).Check();
Handle<String> s2 = factory->NewStringFromAsciiChecked(string2);
CHECK(Just(true) == JSReceiver::HasOwnProperty(obj, s2));
}
@@ -1053,9 +1043,7 @@ TEST(JSObjectMaps) {
// Set a propery
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
- Object::SetProperty(isolate, obj, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
CHECK_EQ(Smi::FromInt(23),
*Object::GetProperty(isolate, obj, prop_name).ToHandleChecked());
@@ -1090,7 +1078,7 @@ TEST(JSArray) {
CHECK(array->HasSmiOrObjectElements());
// array[length] = name.
- Object::SetElement(isolate, array, 0, name, LanguageMode::kSloppy).Check();
+ Object::SetElement(isolate, array, 0, name, ShouldThrow::kDontThrow).Check();
CHECK_EQ(Smi::FromInt(1), array->length());
element = i::Object::GetElement(isolate, array, 0).ToHandleChecked();
CHECK_EQ(*element, *name);
@@ -1104,7 +1092,7 @@ TEST(JSArray) {
CHECK(array->HasDictionaryElements()); // Must be in slow mode.
// array[length] = name.
- Object::SetElement(isolate, array, int_length, name, LanguageMode::kSloppy)
+ Object::SetElement(isolate, array, int_length, name, ShouldThrow::kDontThrow)
.Check();
uint32_t new_int_length = 0;
CHECK(array->length()->ToArrayIndex(&new_int_length));
@@ -1136,11 +1124,11 @@ TEST(JSObjectCopy) {
Handle<Smi> one(Smi::FromInt(1), isolate);
Handle<Smi> two(Smi::FromInt(2), isolate);
- Object::SetProperty(isolate, obj, first, one, LanguageMode::kSloppy).Check();
- Object::SetProperty(isolate, obj, second, two, LanguageMode::kSloppy).Check();
+ Object::SetProperty(isolate, obj, first, one).Check();
+ Object::SetProperty(isolate, obj, second, two).Check();
- Object::SetElement(isolate, obj, 0, first, LanguageMode::kSloppy).Check();
- Object::SetElement(isolate, obj, 1, second, LanguageMode::kSloppy).Check();
+ Object::SetElement(isolate, obj, 0, first, ShouldThrow::kDontThrow).Check();
+ Object::SetElement(isolate, obj, 1, second, ShouldThrow::kDontThrow).Check();
// Make the clone.
Handle<Object> value1, value2;
@@ -1162,13 +1150,12 @@ TEST(JSObjectCopy) {
CHECK_EQ(*value1, *value2);
// Flip the values.
- Object::SetProperty(isolate, clone, first, two, LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, clone, second, one, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, clone, first, two).Check();
+ Object::SetProperty(isolate, clone, second, one).Check();
- Object::SetElement(isolate, clone, 0, second, LanguageMode::kSloppy).Check();
- Object::SetElement(isolate, clone, 1, first, LanguageMode::kSloppy).Check();
+ Object::SetElement(isolate, clone, 0, second, ShouldThrow::kDontThrow)
+ .Check();
+ Object::SetElement(isolate, clone, 1, first, ShouldThrow::kDontThrow).Check();
value1 = Object::GetElement(isolate, obj, 1).ToHandleChecked();
value2 = Object::GetElement(isolate, clone, 0).ToHandleChecked();
@@ -1800,8 +1787,9 @@ static HeapObject NewSpaceAllocateAligned(int size,
static Address AlignNewSpace(AllocationAlignment alignment, int offset) {
Address* top_addr = CcTest::heap()->new_space()->allocation_top_address();
int fill = Heap::GetFillToAlign(*top_addr, alignment);
- if (fill) {
- NewSpaceAllocateAligned(fill + offset, kWordAligned);
+ int allocation = fill + offset;
+ if (allocation) {
+ NewSpaceAllocateAligned(allocation, kWordAligned);
}
return *top_addr;
}
@@ -1923,6 +1911,64 @@ TEST(TestAlignedOverAllocation) {
}
}
+TEST(HeapNumberAlignment) {
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
+ Heap* heap = isolate->heap();
+ HandleScope sc(isolate);
+
+ const auto required_alignment =
+ HeapObject::RequiredAlignment(*factory->heap_number_map());
+ const int maximum_misalignment =
+ Heap::GetMaximumFillToAlign(required_alignment);
+
+ for (int offset = 0; offset <= maximum_misalignment; offset += kTaggedSize) {
+ AlignNewSpace(required_alignment, offset);
+ Handle<Object> number_new = factory->NewNumber(1.000123);
+ CHECK(number_new->IsHeapNumber());
+ CHECK(Heap::InYoungGeneration(*number_new));
+ CHECK_EQ(0, Heap::GetFillToAlign(HeapObject::cast(*number_new)->address(),
+ required_alignment));
+
+ AlignOldSpace(required_alignment, offset);
+ Handle<Object> number_old = factory->NewNumber(1.000321, TENURED);
+ CHECK(number_old->IsHeapNumber());
+ CHECK(heap->InOldSpace(*number_old));
+ CHECK_EQ(0, Heap::GetFillToAlign(HeapObject::cast(*number_old)->address(),
+ required_alignment));
+ }
+}
+
+TEST(MutableHeapNumberAlignment) {
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
+ Heap* heap = isolate->heap();
+ HandleScope sc(isolate);
+
+ const auto required_alignment =
+ HeapObject::RequiredAlignment(*factory->mutable_heap_number_map());
+ const int maximum_misalignment =
+ Heap::GetMaximumFillToAlign(required_alignment);
+
+ for (int offset = 0; offset <= maximum_misalignment; offset += kTaggedSize) {
+ AlignNewSpace(required_alignment, offset);
+ Handle<Object> number_new = factory->NewMutableHeapNumber(1.000123);
+ CHECK(number_new->IsMutableHeapNumber());
+ CHECK(Heap::InYoungGeneration(*number_new));
+ CHECK_EQ(0, Heap::GetFillToAlign(HeapObject::cast(*number_new)->address(),
+ required_alignment));
+
+ AlignOldSpace(required_alignment, offset);
+ Handle<Object> number_old =
+ factory->NewMutableHeapNumber(1.000321, TENURED);
+ CHECK(number_old->IsMutableHeapNumber());
+ CHECK(heap->InOldSpace(*number_old));
+ CHECK_EQ(0, Heap::GetFillToAlign(HeapObject::cast(*number_old)->address(),
+ required_alignment));
+ }
+}
TEST(TestSizeOfObjectsVsHeapIteratorPrecision) {
CcTest::InitializeVM();
@@ -1975,6 +2021,8 @@ TEST(GrowAndShrinkNewSpace) {
// Make sure we're in a consistent state to start out.
CcTest::CollectAllGarbage();
+ CcTest::CollectAllGarbage();
+ new_space->Shrink();
// Explicitly growing should double the space capacity.
size_t old_capacity, new_capacity;
@@ -2285,11 +2333,12 @@ TEST(InstanceOfStubWriteBarrier) {
IncrementalMarking::MarkingState* marking_state = marking->marking_state();
+ const double kStepSizeInMs = 100;
while (!marking_state->IsBlack(f->code()) && !marking->IsStopped()) {
// Discard any pending GC requests otherwise we will get GC when we enter
// code below.
- marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ marking->V8Step(kStepSizeInMs, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
}
CHECK(marking->IsMarking());
@@ -2352,7 +2401,7 @@ HEAP_TEST(Regress845060) {
// Preparation: create a string in new space.
Local<Value> str = CompileRun("var str = (new Array(10000)).join('x'); str");
- CHECK(Heap::InNewSpace(*v8::Utils::OpenHandle(*str)));
+ CHECK(Heap::InYoungGeneration(*v8::Utils::OpenHandle(*str)));
// Idle incremental marking sets the "kReduceMemoryFootprint" flag, which
// causes from_space to be unmapped after scavenging.
@@ -2363,7 +2412,7 @@ HEAP_TEST(Regress845060) {
// promoted to old space. Unmapping of from_space causes accesses to any
// stale raw pointers to crash.
CompileRun("while (%InNewSpace(str)) { str.split(''); }");
- CHECK(!Heap::InNewSpace(*v8::Utils::OpenHandle(*str)));
+ CHECK(!Heap::InYoungGeneration(*v8::Utils::OpenHandle(*str)));
}
TEST(IdleNotificationFinishMarking) {
@@ -2380,9 +2429,10 @@ TEST(IdleNotificationFinishMarking) {
CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count);
+ const double kStepSizeInMs = 100;
do {
- marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ marking->V8Step(kStepSizeInMs, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
} while (
!CcTest::heap()->mark_compact_collector()->marking_worklist()->IsEmpty());
@@ -2431,7 +2481,7 @@ TEST(OptimizedAllocationAlwaysInNewSpace) {
i::Handle<JSReceiver> o =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res));
- CHECK(Heap::InNewSpace(*o));
+ CHECK(Heap::InYoungGeneration(*o));
}
@@ -2569,7 +2619,7 @@ TEST(OptimizedPretenuringNestedInObjectProperties) {
// Nested literal sites are only pretenured if the top level
// literal is pretenured
- CHECK(Heap::InNewSpace(*o));
+ CHECK(Heap::InYoungGeneration(*o));
}
TEST(OptimizedPretenuringMixedInObjectProperties) {
@@ -2897,7 +2947,7 @@ TEST(OptimizedAllocationArrayLiterals) {
i::Handle<JSObject> o = Handle<JSObject>::cast(
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(res)));
- CHECK(Heap::InNewSpace(o->elements()));
+ CHECK(Heap::InYoungGeneration(o->elements()));
}
static int CountMapTransitions(i::Isolate* isolate, Map map) {
@@ -2952,6 +3002,13 @@ TEST(Regress1465) {
CHECK_EQ(1, transitions_after);
}
+static i::Handle<JSObject> GetByName(const char* name) {
+ return i::Handle<JSObject>::cast(
+ v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
+ CcTest::global()
+ ->Get(CcTest::isolate()->GetCurrentContext(), v8_str(name))
+ .ToLocalChecked())));
+}
#ifdef DEBUG
static void AddTransitions(int transitions_count) {
@@ -2964,15 +3021,6 @@ static void AddTransitions(int transitions_count) {
}
-static i::Handle<JSObject> GetByName(const char* name) {
- return i::Handle<JSObject>::cast(
- v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(
- CcTest::global()
- ->Get(CcTest::isolate()->GetCurrentContext(), v8_str(name))
- .ToLocalChecked())));
-}
-
-
static void AddPropertyTo(
int gc_count, Handle<JSObject> object, const char* property_name) {
Isolate* isolate = CcTest::i_isolate();
@@ -2983,9 +3031,7 @@ static void AddPropertyTo(
FLAG_gc_global = true;
FLAG_retain_maps_for_n_gc = 0;
CcTest::heap()->set_allocation_timeout(gc_count);
- Object::SetProperty(isolate, object, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, object, prop_name, twenty_three).Check();
}
@@ -3106,6 +3152,9 @@ TEST(ReleaseOverReservedPages) {
Factory* factory = isolate->factory();
Heap* heap = isolate->heap();
v8::HandleScope scope(CcTest::isolate());
+ // Ensure that the young generation is empty.
+ CcTest::CollectGarbage(NEW_SPACE);
+ CcTest::CollectGarbage(NEW_SPACE);
static const int number_of_test_pages = 20;
// Prepare many pages with low live-bytes count.
@@ -3139,7 +3188,7 @@ TEST(ReleaseOverReservedPages) {
// boots, but if the 20 small arrays don't fit on the first page then that's
// an indication that it is too small.
CcTest::CollectAllAvailableGarbage();
- CHECK_EQ(initial_page_count, old_space->CountTotalPages());
+ CHECK_GE(initial_page_count, old_space->CountTotalPages());
}
static int forced_gc_counter = 0;
@@ -3239,7 +3288,7 @@ static void CheckVectorIC(Handle<JSFunction> f, int slot_index,
FeedbackVectorHelper helper(vector);
FeedbackSlot slot = helper.slot(slot_index);
FeedbackNexus nexus(vector, slot);
- CHECK(nexus.StateFromFeedback() == desired_state);
+ CHECK(nexus.ic_state() == desired_state);
}
TEST(IncrementalMarkingPreservesMonomorphicConstructor) {
@@ -3488,6 +3537,119 @@ UNINITIALIZED_TEST(ReleaseStackTraceData) {
isolate->Dispose();
}
+// TODO(mmarchini) also write tests for async/await and Promise.all
+void DetailedErrorStackTraceTest(const char* src,
+ std::function<void(Handle<FrameArray>)> test) {
+ FLAG_detailed_error_stack_trace = true;
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ v8::TryCatch try_catch(CcTest::isolate());
+ CompileRun(src);
+
+ CHECK(try_catch.HasCaught());
+ Handle<Object> exception = v8::Utils::OpenHandle(*try_catch.Exception());
+
+ Isolate* isolate = CcTest::i_isolate();
+ Handle<Name> key = isolate->factory()->stack_trace_symbol();
+
+ Handle<FrameArray> stack_trace(
+ FrameArray::cast(
+ Handle<JSArray>::cast(
+ Object::GetProperty(isolate, exception, key).ToHandleChecked())
+ ->elements()),
+ isolate);
+
+ test(stack_trace);
+}
+
+// * Test interpreted function error
+TEST(DetailedErrorStackTrace) {
+ static const char* source =
+ "function func1(arg1) { "
+ " let err = new Error(); "
+ " throw err; "
+ "} "
+ "function func2(arg1, arg2) { "
+ " func1(42); "
+ "} "
+ "class Foo {}; "
+ "function main(arg1, arg2) { "
+ " func2(arg1, false); "
+ "} "
+ "var foo = new Foo(); "
+ "main(foo); ";
+
+ DetailedErrorStackTraceTest(source, [](Handle<FrameArray> stack_trace) {
+ FixedArray foo_parameters = stack_trace->Parameters(0);
+ CHECK_EQ(foo_parameters->length(), 1);
+ CHECK(foo_parameters->get(0)->IsSmi());
+ CHECK_EQ(Smi::ToInt(foo_parameters->get(0)), 42);
+
+ FixedArray bar_parameters = stack_trace->Parameters(1);
+ CHECK_EQ(bar_parameters->length(), 2);
+ CHECK(bar_parameters->get(0)->IsJSObject());
+ CHECK(bar_parameters->get(1)->IsBoolean());
+ Handle<Object> foo = Handle<Object>::cast(GetByName("foo"));
+ CHECK_EQ(bar_parameters->get(0), *foo);
+ CHECK(!bar_parameters->get(1)->BooleanValue(CcTest::i_isolate()));
+
+ FixedArray main_parameters = stack_trace->Parameters(2);
+ CHECK_EQ(main_parameters->length(), 2);
+ CHECK(main_parameters->get(0)->IsJSObject());
+ CHECK(main_parameters->get(1)->IsUndefined());
+ CHECK_EQ(main_parameters->get(0), *foo);
+ });
+}
+
+// * Test optimized function with inline frame error
+TEST(DetailedErrorStackTraceInline) {
+ FLAG_allow_natives_syntax = true;
+ static const char* source =
+ "function add(x) { "
+ " if (x == 42) "
+ " throw new Error(); "
+ " return x + x; "
+ "} "
+ "add(0); "
+ "add(1); "
+ "function foo(x) { "
+ " return add(x + 1) "
+ "} "
+ "foo(40); "
+ "%OptimizeFunctionOnNextCall(foo); "
+ "foo(41); ";
+
+ DetailedErrorStackTraceTest(source, [](Handle<FrameArray> stack_trace) {
+ FixedArray parameters_add = stack_trace->Parameters(0);
+ CHECK_EQ(parameters_add->length(), 1);
+ CHECK(parameters_add->get(0)->IsSmi());
+ CHECK_EQ(Smi::ToInt(parameters_add->get(0)), 42);
+
+ FixedArray parameters_foo = stack_trace->Parameters(1);
+ CHECK_EQ(parameters_foo->length(), 1);
+ CHECK(parameters_foo->get(0)->IsSmi());
+ CHECK_EQ(Smi::ToInt(parameters_foo->get(0)), 41);
+ });
+}
+
+// * Test builtin exit error
+TEST(DetailedErrorStackTraceBuiltinExit) {
+ static const char* source =
+ "function test(arg1) { "
+ " (new Number()).toFixed(arg1); "
+ "} "
+ "test(9999); ";
+
+ DetailedErrorStackTraceTest(source, [](Handle<FrameArray> stack_trace) {
+ FixedArray parameters = stack_trace->Parameters(0);
+
+ CHECK_EQ(parameters->length(), 2);
+ CHECK(parameters->get(0)->IsSmi());
+ CHECK_EQ(Smi::ToInt(parameters->get(0)), 9999);
+ });
+}
+
TEST(Regress169928) {
FLAG_allow_natives_syntax = true;
#ifndef V8_LITE_MODE
@@ -3595,8 +3757,6 @@ TEST(LargeObjectSlotRecording) {
// Start incremental marking to active write barrier.
heap::SimulateIncrementalMarking(heap, false);
- heap->incremental_marking()->AdvanceIncrementalMarking(
- 10000000, IncrementalMarking::NO_GC_VIA_STACK_GUARD, StepOrigin::kV8);
// Create references from the large object to the object on the evacuation
// candidate.
@@ -3606,6 +3766,8 @@ TEST(LargeObjectSlotRecording) {
CHECK(lo->get(i) == old_location);
}
+ heap::SimulateIncrementalMarking(heap, true);
+
// Move the evaucation candidate object.
CcTest::CollectAllGarbage();
@@ -3659,9 +3821,7 @@ TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) {
CcTest::heap()->StartIncrementalMarking(
i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting);
}
- // This big step should be sufficient to mark the whole array.
- marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ heap::SimulateIncrementalMarking(CcTest::heap());
CHECK(marking->IsComplete() ||
marking->IsReadyToOverApproximateWeakClosure());
}
@@ -4069,10 +4229,10 @@ TEST(NewSpaceObjectsInOptimizedCode) {
->Get(context.local(), v8_str("foo"))
.ToLocalChecked())));
- CHECK(Heap::InNewSpace(*foo));
+ CHECK(Heap::InYoungGeneration(*foo));
CcTest::CollectGarbage(NEW_SPACE);
CcTest::CollectGarbage(NEW_SPACE);
- CHECK(!Heap::InNewSpace(*foo));
+ CHECK(!Heap::InYoungGeneration(*foo));
#ifdef VERIFY_HEAP
CcTest::heap()->Verify();
#endif
@@ -4519,7 +4679,7 @@ void CheckIC(Handle<JSFunction> function, int slot_index,
FeedbackVector vector = function->feedback_vector();
FeedbackSlot slot(slot_index);
FeedbackNexus nexus(vector, slot);
- CHECK_EQ(nexus.StateFromFeedback(), state);
+ CHECK_EQ(nexus.ic_state(), state);
}
TEST(MonomorphicStaysMonomorphicAfterGC) {
@@ -4735,8 +4895,8 @@ TEST(Regress507979) {
Handle<FixedArray> o1 = isolate->factory()->NewFixedArray(kFixedArrayLen);
Handle<FixedArray> o2 = isolate->factory()->NewFixedArray(kFixedArrayLen);
- CHECK(Heap::InNewSpace(*o1));
- CHECK(Heap::InNewSpace(*o2));
+ CHECK(Heap::InYoungGeneration(*o1));
+ CHECK(Heap::InYoungGeneration(*o2));
HeapIterator it(isolate->heap(), i::HeapIterator::kFilterUnreachable);
@@ -4826,12 +4986,7 @@ TEST(Regress3631) {
Handle<JSReceiver> obj =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result));
Handle<JSWeakCollection> weak_map(JSWeakCollection::cast(*obj), isolate);
- HeapObject weak_map_table = HeapObject::cast(weak_map->table());
- IncrementalMarking::MarkingState* marking_state = marking->marking_state();
- while (!marking_state->IsBlack(weak_map_table) && !marking->IsStopped()) {
- marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
- }
+ SimulateIncrementalMarking(heap);
// Stash the backing store in a handle.
Handle<Object> save(weak_map->table(), isolate);
// The following line will update the backing store.
@@ -4855,8 +5010,7 @@ TEST(Regress442710) {
Handle<JSArray> array = factory->NewJSArray(2);
Handle<String> name = factory->InternalizeUtf8String("testArray");
- Object::SetProperty(isolate, global, name, array, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, global, name, array).Check();
CompileRun("testArray[0] = 1; testArray[1] = 2; testArray.shift();");
CcTest::CollectGarbage(OLD_SPACE);
}
@@ -4991,7 +5145,7 @@ void AllocateInSpace(Isolate* isolate, size_t bytes, AllocationSpace space) {
static_cast<int>((bytes - FixedArray::kHeaderSize) / kTaggedSize);
Handle<FixedArray> array = factory->NewFixedArray(
elements, space == NEW_SPACE ? NOT_TENURED : TENURED);
- CHECK((space == NEW_SPACE) == Heap::InNewSpace(*array));
+ CHECK((space == NEW_SPACE) == Heap::InYoungGeneration(*array));
CHECK_EQ(bytes, static_cast<size_t>(array->Size()));
}
@@ -5213,7 +5367,8 @@ AllocationResult HeapTester::AllocateByteArrayForTest(Heap* heap, int length,
AllocationSpace space = heap->SelectSpace(pretenure);
HeapObject result;
{
- AllocationResult allocation = heap->AllocateRaw(size, space);
+ AllocationResult allocation =
+ heap->AllocateRaw(size, Heap::SelectType(space));
if (!allocation.To(&result)) return allocation;
}
@@ -5239,7 +5394,7 @@ HEAP_TEST(Regress587004) {
Handle<FixedArray> array = factory->NewFixedArray(N, TENURED);
CHECK(heap->old_space()->Contains(*array));
Handle<Object> number = factory->NewHeapNumber(1.0);
- CHECK(Heap::InNewSpace(*number));
+ CHECK(Heap::InYoungGeneration(*number));
for (int i = 0; i < N; i++) {
array->set(i, *number);
}
@@ -5349,7 +5504,8 @@ TEST(Regress598319) {
Heap* heap = CcTest::heap();
Isolate* isolate = heap->isolate();
- const int kNumberOfObjects = kMaxRegularHeapObjectSize / kTaggedSize;
+ // The size of the array should be larger than kProgressBarScanningChunk.
+ const int kNumberOfObjects = Max(FixedArray::kMaxRegularLength + 1, 128 * KB);
struct Arr {
Arr(Isolate* isolate, int number_of_objects) {
@@ -5374,7 +5530,7 @@ TEST(Regress598319) {
CHECK_EQ(arr.get()->length(), kNumberOfObjects);
CHECK(heap->lo_space()->Contains(arr.get()));
- LargePage* page = heap->lo_space()->FindPage(arr.get()->address());
+ LargePage* page = LargePage::FromHeapObject(arr.get());
CHECK_NOT_NULL(page);
// GC to cleanup state
@@ -5409,11 +5565,13 @@ TEST(Regress598319) {
// Now we search for a state where we are in incremental marking and have
// only partially marked the large object.
+ const double kSmallStepSizeInMs = 0.1;
while (!marking->IsComplete()) {
- marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
- if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->progress_bar() > 0) {
- CHECK_NE(page->progress_bar(), arr.get()->Size());
+ marking->V8Step(kSmallStepSizeInMs,
+ i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
+ if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->ProgressBar() > 0) {
+ CHECK_NE(page->ProgressBar(), arr.get()->Size());
{
// Shift by 1, effectively moving one white object across the progress
// bar, meaning that we will miss marking it.
@@ -5427,9 +5585,11 @@ TEST(Regress598319) {
}
// Finish marking with bigger steps to speed up test.
+ const double kLargeStepSizeInMs = 1000;
while (!marking->IsComplete()) {
- marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ marking->V8Step(kLargeStepSizeInMs,
+ i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
@@ -5509,9 +5669,10 @@ TEST(Regress615489) {
v8::HandleScope inner(CcTest::isolate());
isolate->factory()->NewFixedArray(500, TENURED)->Size();
}
+ const double kStepSizeInMs = 100;
while (!marking->IsComplete()) {
- marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ marking->V8Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
@@ -5568,10 +5729,11 @@ TEST(Regress631969) {
CcTest::CollectGarbage(NEW_SPACE);
// Finish incremental marking.
+ const double kStepSizeInMs = 100;
IncrementalMarking* marking = heap->incremental_marking();
while (!marking->IsComplete()) {
- marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
+ marking->V8Step(kStepSizeInMs, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+ StepOrigin::kV8);
if (marking->IsReadyToOverApproximateWeakClosure()) {
marking->FinalizeIncrementally();
}
@@ -5657,7 +5819,8 @@ TEST(ContinuousLeftTrimFixedArrayInBlackArea) {
Address start_address = array->address();
Address end_address = start_address + array->Size();
Page* page = Page::FromAddress(start_address);
- IncrementalMarking::MarkingState* marking_state = marking->marking_state();
+ IncrementalMarking::NonAtomicMarkingState* marking_state =
+ marking->non_atomic_marking_state();
CHECK(marking_state->IsBlack(*array));
CHECK(marking_state->bitmap(page)->AllBitsSetInRange(
page->AddressToMarkbitIndex(start_address),
@@ -5724,7 +5887,8 @@ TEST(ContinuousRightTrimFixedArrayInBlackArea) {
Address start_address = array->address();
Address end_address = start_address + array->Size();
Page* page = Page::FromAddress(start_address);
- IncrementalMarking::MarkingState* marking_state = marking->marking_state();
+ IncrementalMarking::NonAtomicMarkingState* marking_state =
+ marking->non_atomic_marking_state();
CHECK(marking_state->IsBlack(*array));
CHECK(marking_state->bitmap(page)->AllBitsSetInRange(
@@ -5786,7 +5950,8 @@ TEST(YoungGenerationLargeObjectAllocationScavenge) {
Handle<FixedArray> array_small = isolate->factory()->NewFixedArray(200000);
MemoryChunk* chunk = MemoryChunk::FromHeapObject(*array_small);
CHECK_EQ(NEW_LO_SPACE, chunk->owner()->identity());
- CHECK(chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE));
+ CHECK(chunk->IsFlagSet(MemoryChunk::LARGE_PAGE));
+ CHECK(chunk->IsFlagSet(MemoryChunk::TO_PAGE));
Handle<Object> number = isolate->factory()->NewHeapNumber(123.456);
array_small->set(0, *number);
@@ -5797,7 +5962,7 @@ TEST(YoungGenerationLargeObjectAllocationScavenge) {
// generation large object space.
chunk = MemoryChunk::FromHeapObject(*array_small);
CHECK_EQ(LO_SPACE, chunk->owner()->identity());
- CHECK(!chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE));
+ CHECK(!chunk->InYoungGeneration());
CcTest::CollectAllAvailableGarbage();
}
@@ -5815,7 +5980,8 @@ TEST(YoungGenerationLargeObjectAllocationMarkCompact) {
Handle<FixedArray> array_small = isolate->factory()->NewFixedArray(200000);
MemoryChunk* chunk = MemoryChunk::FromHeapObject(*array_small);
CHECK_EQ(NEW_LO_SPACE, chunk->owner()->identity());
- CHECK(chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE));
+ CHECK(chunk->IsFlagSet(MemoryChunk::LARGE_PAGE));
+ CHECK(chunk->IsFlagSet(MemoryChunk::TO_PAGE));
Handle<Object> number = isolate->factory()->NewHeapNumber(123.456);
array_small->set(0, *number);
@@ -5826,7 +5992,7 @@ TEST(YoungGenerationLargeObjectAllocationMarkCompact) {
// large object space.
chunk = MemoryChunk::FromHeapObject(*array_small);
CHECK_EQ(LO_SPACE, chunk->owner()->identity());
- CHECK(!chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE));
+ CHECK(!chunk->InYoungGeneration());
CcTest::CollectAllAvailableGarbage();
}
@@ -5846,7 +6012,7 @@ TEST(YoungGenerationLargeObjectAllocationReleaseScavenger) {
Handle<FixedArray> array_small = isolate->factory()->NewFixedArray(20000);
MemoryChunk* chunk = MemoryChunk::FromHeapObject(*array_small);
CHECK_EQ(NEW_LO_SPACE, chunk->owner()->identity());
- CHECK(chunk->IsFlagSet(MemoryChunk::IN_TO_SPACE));
+ CHECK(chunk->IsFlagSet(MemoryChunk::TO_PAGE));
}
}
@@ -5975,7 +6141,7 @@ HEAP_TEST(Regress670675) {
if (marking->IsStopped()) {
marking->Start(i::GarbageCollectionReason::kTesting);
}
- size_t array_length = Page::kPageSize / kTaggedSize + 100;
+ size_t array_length = 128 * KB;
size_t n = heap->OldGenerationSpaceAvailable() / array_length;
for (size_t i = 0; i < n + 40; i++) {
{
@@ -5985,7 +6151,7 @@ HEAP_TEST(Regress670675) {
}
if (marking->IsStopped()) break;
double deadline = heap->MonotonicallyIncreasingTimeInMs() + 1;
- marking->AdvanceIncrementalMarking(
+ marking->AdvanceWithDeadline(
deadline, IncrementalMarking::GC_VIA_STACK_GUARD, StepOrigin::kV8);
}
DCHECK(marking->IsStopped());
@@ -6159,7 +6325,7 @@ UNINITIALIZED_TEST(ReinitializeStringHashSeed) {
{
v8::Isolate::Scope isolate_scope(isolate);
CHECK_EQ(static_cast<uint64_t>(1337 * i),
- reinterpret_cast<i::Isolate*>(isolate)->heap()->HashSeed());
+ HashSeed(reinterpret_cast<i::Isolate*>(isolate)));
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
CHECK(!context.IsEmpty());
@@ -6258,7 +6424,7 @@ HEAP_TEST(Regress779503) {
// The byte array filled with kHeapObjectTag ensures that we cannot read
// from the slot again and interpret it as heap value. Doing so will crash.
Handle<ByteArray> byte_array = isolate->factory()->NewByteArray(kArraySize);
- CHECK(Heap::InNewSpace(*byte_array));
+ CHECK(Heap::InYoungGeneration(*byte_array));
for (int i = 0; i < kArraySize; i++) {
byte_array->set(i, kHeapObjectTag);
}
@@ -6268,7 +6434,7 @@ HEAP_TEST(Regress779503) {
// The FixedArray in old space serves as space for slots.
Handle<FixedArray> fixed_array =
isolate->factory()->NewFixedArray(kArraySize, TENURED);
- CHECK(!Heap::InNewSpace(*fixed_array));
+ CHECK(!Heap::InYoungGeneration(*fixed_array));
for (int i = 0; i < kArraySize; i++) {
fixed_array->set(i, *byte_array);
}
@@ -6277,7 +6443,7 @@ HEAP_TEST(Regress779503) {
// currently scavenging.
heap->delay_sweeper_tasks_for_testing_ = true;
CcTest::CollectGarbage(OLD_SPACE);
- CHECK(Heap::InNewSpace(*byte_array));
+ CHECK(Heap::InYoungGeneration(*byte_array));
}
// Scavenging and sweeping the same page will crash as slots will be
// overridden.
@@ -6291,6 +6457,7 @@ struct OutOfMemoryState {
size_t old_generation_capacity_at_oom;
size_t memory_allocator_size_at_oom;
size_t new_space_capacity_at_oom;
+ size_t new_lo_space_size_at_oom;
size_t current_heap_limit;
size_t initial_heap_limit;
};
@@ -6303,6 +6470,7 @@ size_t NearHeapLimitCallback(void* raw_state, size_t current_heap_limit,
state->old_generation_capacity_at_oom = heap->OldGenerationCapacity();
state->memory_allocator_size_at_oom = heap->memory_allocator()->Size();
state->new_space_capacity_at_oom = heap->new_space()->Capacity();
+ state->new_lo_space_size_at_oom = heap->new_lo_space()->Size();
state->current_heap_limit = current_heap_limit;
state->initial_heap_limit = initial_heap_limit;
return initial_heap_limit + 100 * MB;
@@ -6378,11 +6546,14 @@ UNINITIALIZED_TEST(OutOfMemoryLargeObjects) {
}
CHECK_LE(state.old_generation_capacity_at_oom, kOldGenerationLimit);
CHECK_LE(kOldGenerationLimit, state.old_generation_capacity_at_oom +
+ state.new_space_capacity_at_oom +
+ state.new_lo_space_size_at_oom +
FixedArray::SizeFor(kFixedArrayLength));
CHECK_LE(
state.memory_allocator_size_at_oom,
MemoryAllocatorSizeFromHeapCapacity(state.old_generation_capacity_at_oom +
- 2 * state.new_space_capacity_at_oom));
+ 2 * state.new_space_capacity_at_oom +
+ state.new_lo_space_size_at_oom));
reinterpret_cast<v8::Isolate*>(isolate)->Dispose();
}
@@ -6466,7 +6637,7 @@ TEST(Regress8617) {
Handle<Object> foo =
v8::Utils::OpenHandle(*CompileRun("function foo() { return 42; };"
"foo;"));
- if (heap->InNewSpace(*foo)) {
+ if (heap->InYoungGeneration(*foo)) {
CcTest::CollectGarbage(NEW_SPACE);
CcTest::CollectGarbage(NEW_SPACE);
}
diff --git a/deps/v8/test/cctest/heap/test-incremental-marking.cc b/deps/v8/test/cctest/heap/test-incremental-marking.cc
index 8213ea6080..d90c2c2139 100644
--- a/deps/v8/test/cctest/heap/test-incremental-marking.cc
+++ b/deps/v8/test/cctest/heap/test-incremental-marking.cc
@@ -71,14 +71,14 @@ class MockPlatform : public TestPlatform {
void PostDelayedTask(std::unique_ptr<Task> task,
double delay_in_seconds) override {
- UNREACHABLE();
- };
+ task_ = std::move(task);
+ }
void PostIdleTask(std::unique_ptr<IdleTask> task) override {
UNREACHABLE();
}
- bool IdleTasksEnabled() override { return false; };
+ bool IdleTasksEnabled() override { return false; }
bool PendingTask() { return task_ != nullptr; }
diff --git a/deps/v8/test/cctest/heap/test-invalidated-slots.cc b/deps/v8/test/cctest/heap/test-invalidated-slots.cc
index 897f4d0242..9eeda75cc5 100644
--- a/deps/v8/test/cctest/heap/test-invalidated-slots.cc
+++ b/deps/v8/test/cctest/heap/test-invalidated-slots.cc
@@ -330,25 +330,16 @@ HEAP_TEST(InvalidatedSlotsFastToSlow) {
// Start incremental marking.
heap::SimulateIncrementalMarking(heap);
// Set properties to point to the evacuation candidate.
- Object::SetProperty(isolate, obj, prop_name1, evacuated,
- LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_name2, evacuated,
- LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_name3, evacuated,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name1, evacuated).Check();
+ Object::SetProperty(isolate, obj, prop_name2, evacuated).Check();
+ Object::SetProperty(isolate, obj, prop_name3, evacuated).Check();
{
HandleScope scope(isolate);
Handle<HeapObject> dead = factory->NewFixedArray(1);
- Object::SetProperty(isolate, obj, prop_name1, dead, LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_name2, dead, LanguageMode::kSloppy)
- .Check();
- Object::SetProperty(isolate, obj, prop_name3, dead, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name1, dead).Check();
+ Object::SetProperty(isolate, obj, prop_name2, dead).Check();
+ Object::SetProperty(isolate, obj, prop_name3, dead).Check();
Handle<Map> map(obj->map(), isolate);
Handle<Map> normalized_map =
Map::Normalize(isolate, map, CLEAR_INOBJECT_PROPERTIES, "testing");
diff --git a/deps/v8/test/cctest/heap/test-mark-compact.cc b/deps/v8/test/cctest/heap/test-mark-compact.cc
index 4f141af7a5..e85c73405f 100644
--- a/deps/v8/test/cctest/heap/test-mark-compact.cc
+++ b/deps/v8/test/cctest/heap/test-mark-compact.cc
@@ -101,7 +101,7 @@ HEAP_TEST(NoPromotion) {
AllocationResult HeapTester::AllocateMapForTest(Isolate* isolate) {
Heap* heap = isolate->heap();
HeapObject obj;
- AllocationResult alloc = heap->AllocateRaw(Map::kSize, MAP_SPACE);
+ AllocationResult alloc = heap->AllocateRaw(Map::kSize, AllocationType::kMap);
if (!alloc.To(&obj)) return alloc;
obj->set_map_after_allocation(ReadOnlyRoots(heap).meta_map(),
SKIP_WRITE_BARRIER);
@@ -119,7 +119,7 @@ AllocationResult HeapTester::AllocateFixedArrayForTest(
AllocationSpace space = heap->SelectSpace(pretenure);
HeapObject obj;
{
- AllocationResult result = heap->AllocateRaw(size, space);
+ AllocationResult result = heap->AllocateRaw(size, Heap::SelectType(space));
if (!result.To(&obj)) return result;
}
obj->set_map_after_allocation(ReadOnlyRoots(heap).fixed_array_map(),
@@ -165,9 +165,7 @@ HEAP_TEST(MarkCompactCollector) {
// allocate a garbage
Handle<String> func_name = factory->InternalizeUtf8String("theFunction");
Handle<JSFunction> function = factory->NewFunctionForTest(func_name);
- Object::SetProperty(isolate, global, func_name, function,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, global, func_name, function).Check();
factory->NewJSObject(function);
}
@@ -184,13 +182,10 @@ HEAP_TEST(MarkCompactCollector) {
Handle<JSObject> obj = factory->NewJSObject(function);
Handle<String> obj_name = factory->InternalizeUtf8String("theObject");
- Object::SetProperty(isolate, global, obj_name, obj, LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, global, obj_name, obj).Check();
Handle<String> prop_name = factory->InternalizeUtf8String("theSlot");
Handle<Smi> twenty_three(Smi::FromInt(23), isolate);
- Object::SetProperty(isolate, obj, prop_name, twenty_three,
- LanguageMode::kSloppy)
- .Check();
+ Object::SetProperty(isolate, obj, prop_name, twenty_three).Check();
}
CcTest::CollectGarbage(OLD_SPACE);
diff --git a/deps/v8/test/cctest/heap/test-page-promotion.cc b/deps/v8/test/cctest/heap/test-page-promotion.cc
index 2db538d484..b68484e3c0 100644
--- a/deps/v8/test/cctest/heap/test-page-promotion.cc
+++ b/deps/v8/test/cctest/heap/test-page-promotion.cc
@@ -67,6 +67,11 @@ UNINITIALIZED_TEST(PagePromotion_NewToOld) {
v8::Context::New(isolate)->Enter();
Heap* heap = i_isolate->heap();
+ // Ensure that the new space is empty so that the page to be promoted
+ // does not contain the age mark.
+ heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
+ heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
+
std::vector<Handle<FixedArray>> handles;
heap::SimulateFullSpace(heap->new_space(), &handles);
heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting);
diff --git a/deps/v8/test/cctest/heap/test-spaces.cc b/deps/v8/test/cctest/heap/test-spaces.cc
index 8219c1487d..337447dcea 100644
--- a/deps/v8/test/cctest/heap/test-spaces.cc
+++ b/deps/v8/test/cctest/heap/test-spaces.cc
@@ -45,18 +45,24 @@ namespace heap {
// Temporarily sets a given allocator in an isolate.
class TestMemoryAllocatorScope {
public:
- TestMemoryAllocatorScope(Isolate* isolate, MemoryAllocator* allocator)
- : isolate_(isolate), old_allocator_(isolate->heap()->memory_allocator()) {
- isolate->heap()->memory_allocator_ = allocator;
+ TestMemoryAllocatorScope(Isolate* isolate, size_t max_capacity,
+ size_t code_range_size)
+ : isolate_(isolate),
+ old_allocator_(std::move(isolate->heap()->memory_allocator_)) {
+ isolate->heap()->memory_allocator_.reset(
+ new MemoryAllocator(isolate, max_capacity, code_range_size));
}
+ MemoryAllocator* allocator() { return isolate_->heap()->memory_allocator(); }
+
~TestMemoryAllocatorScope() {
- isolate_->heap()->memory_allocator_ = old_allocator_;
+ isolate_->heap()->memory_allocator()->TearDown();
+ isolate_->heap()->memory_allocator_.swap(old_allocator_);
}
private:
Isolate* isolate_;
- MemoryAllocator* old_allocator_;
+ std::unique_ptr<MemoryAllocator> old_allocator_;
DISALLOW_COPY_AND_ASSIGN(TestMemoryAllocatorScope);
};
@@ -89,41 +95,37 @@ static void VerifyMemoryChunk(Isolate* isolate, Heap* heap,
v8::PageAllocator* code_page_allocator,
size_t reserve_area_size, size_t commit_area_size,
Executability executable, Space* space) {
- MemoryAllocator* memory_allocator =
- new MemoryAllocator(isolate, heap->MaxReserved(), 0);
- {
- TestMemoryAllocatorScope test_allocator_scope(isolate, memory_allocator);
- TestCodePageAllocatorScope test_code_page_allocator_scope(
- isolate, code_page_allocator);
-
- v8::PageAllocator* page_allocator =
- memory_allocator->page_allocator(executable);
-
- size_t allocatable_memory_area_offset =
- MemoryChunkLayout::ObjectStartOffsetInMemoryChunk(space->identity());
- size_t guard_size =
- (executable == EXECUTABLE) ? MemoryChunkLayout::CodePageGuardSize() : 0;
-
- MemoryChunk* memory_chunk = memory_allocator->AllocateChunk(
- reserve_area_size, commit_area_size, executable, space);
- size_t reserved_size =
- ((executable == EXECUTABLE))
- ? allocatable_memory_area_offset +
- RoundUp(reserve_area_size, page_allocator->CommitPageSize()) +
- guard_size
- : RoundUp(allocatable_memory_area_offset + reserve_area_size,
- page_allocator->CommitPageSize());
- CHECK(memory_chunk->size() == reserved_size);
- CHECK(memory_chunk->area_start() <
- memory_chunk->address() + memory_chunk->size());
- CHECK(memory_chunk->area_end() <=
- memory_chunk->address() + memory_chunk->size());
- CHECK(static_cast<size_t>(memory_chunk->area_size()) == commit_area_size);
-
- memory_allocator->Free<MemoryAllocator::kFull>(memory_chunk);
- }
- memory_allocator->TearDown();
- delete memory_allocator;
+ TestMemoryAllocatorScope test_allocator_scope(isolate, heap->MaxReserved(),
+ 0);
+ MemoryAllocator* memory_allocator = test_allocator_scope.allocator();
+ TestCodePageAllocatorScope test_code_page_allocator_scope(
+ isolate, code_page_allocator);
+
+ v8::PageAllocator* page_allocator =
+ memory_allocator->page_allocator(executable);
+
+ size_t allocatable_memory_area_offset =
+ MemoryChunkLayout::ObjectStartOffsetInMemoryChunk(space->identity());
+ size_t guard_size =
+ (executable == EXECUTABLE) ? MemoryChunkLayout::CodePageGuardSize() : 0;
+
+ MemoryChunk* memory_chunk = memory_allocator->AllocateChunk(
+ reserve_area_size, commit_area_size, executable, space);
+ size_t reserved_size =
+ ((executable == EXECUTABLE))
+ ? allocatable_memory_area_offset +
+ RoundUp(reserve_area_size, page_allocator->CommitPageSize()) +
+ guard_size
+ : RoundUp(allocatable_memory_area_offset + reserve_area_size,
+ page_allocator->CommitPageSize());
+ CHECK(memory_chunk->size() == reserved_size);
+ CHECK(memory_chunk->area_start() <
+ memory_chunk->address() + memory_chunk->size());
+ CHECK(memory_chunk->area_end() <=
+ memory_chunk->address() + memory_chunk->size());
+ CHECK(static_cast<size_t>(memory_chunk->area_size()) == commit_area_size);
+
+ memory_allocator->Free<MemoryAllocator::kFull>(memory_chunk);
}
static unsigned int PseudorandomAreaSize() {
@@ -170,48 +172,43 @@ TEST(MemoryAllocator) {
Isolate* isolate = CcTest::i_isolate();
Heap* heap = isolate->heap();
- MemoryAllocator* memory_allocator =
- new MemoryAllocator(isolate, heap->MaxReserved(), 0);
- CHECK_NOT_NULL(memory_allocator);
- TestMemoryAllocatorScope test_scope(isolate, memory_allocator);
+ TestMemoryAllocatorScope test_allocator_scope(isolate, heap->MaxReserved(),
+ 0);
+ MemoryAllocator* memory_allocator = test_allocator_scope.allocator();
- {
- int total_pages = 0;
- OldSpace faked_space(heap);
- CHECK(!faked_space.first_page());
- CHECK(!faked_space.last_page());
- Page* first_page = memory_allocator->AllocatePage(
- faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space),
- NOT_EXECUTABLE);
-
- faked_space.memory_chunk_list().PushBack(first_page);
- CHECK(first_page->next_page() == nullptr);
- total_pages++;
-
- for (Page* p = first_page; p != nullptr; p = p->next_page()) {
- CHECK(p->owner() == &faked_space);
- }
+ int total_pages = 0;
+ OldSpace faked_space(heap);
+ CHECK(!faked_space.first_page());
+ CHECK(!faked_space.last_page());
+ Page* first_page = memory_allocator->AllocatePage(
+ faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space),
+ NOT_EXECUTABLE);
- // Again, we should get n or n - 1 pages.
- Page* other = memory_allocator->AllocatePage(
- faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space),
- NOT_EXECUTABLE);
- total_pages++;
- faked_space.memory_chunk_list().PushBack(other);
- int page_count = 0;
- for (Page* p = first_page; p != nullptr; p = p->next_page()) {
- CHECK(p->owner() == &faked_space);
- page_count++;
- }
- CHECK(total_pages == page_count);
+ faked_space.memory_chunk_list().PushBack(first_page);
+ CHECK(first_page->next_page() == nullptr);
+ total_pages++;
- Page* second_page = first_page->next_page();
- CHECK_NOT_NULL(second_page);
+ for (Page* p = first_page; p != nullptr; p = p->next_page()) {
+ CHECK(p->owner() == &faked_space);
+ }
- // OldSpace's destructor will tear down the space and free up all pages.
+ // Again, we should get n or n - 1 pages.
+ Page* other = memory_allocator->AllocatePage(
+ faked_space.AreaSize(), static_cast<PagedSpace*>(&faked_space),
+ NOT_EXECUTABLE);
+ total_pages++;
+ faked_space.memory_chunk_list().PushBack(other);
+ int page_count = 0;
+ for (Page* p = first_page; p != nullptr; p = p->next_page()) {
+ CHECK(p->owner() == &faked_space);
+ page_count++;
}
- memory_allocator->TearDown();
- delete memory_allocator;
+ CHECK(total_pages == page_count);
+
+ Page* second_page = first_page->next_page();
+ CHECK_NOT_NULL(second_page);
+
+ // OldSpace's destructor will tear down the space and free up all pages.
}
TEST(ComputeDiscardMemoryAreas) {
@@ -256,9 +253,9 @@ TEST(ComputeDiscardMemoryAreas) {
TEST(NewSpace) {
Isolate* isolate = CcTest::i_isolate();
Heap* heap = isolate->heap();
- MemoryAllocator* memory_allocator =
- new MemoryAllocator(isolate, heap->MaxReserved(), 0);
- TestMemoryAllocatorScope test_scope(isolate, memory_allocator);
+ TestMemoryAllocatorScope test_allocator_scope(isolate, heap->MaxReserved(),
+ 0);
+ MemoryAllocator* memory_allocator = test_allocator_scope.allocator();
NewSpace new_space(heap, memory_allocator->data_page_allocator(),
CcTest::heap()->InitialSemiSpaceSize(),
@@ -273,17 +270,14 @@ TEST(NewSpace) {
new_space.TearDown();
memory_allocator->unmapper()->EnsureUnmappingCompleted();
- memory_allocator->TearDown();
- delete memory_allocator;
}
TEST(OldSpace) {
Isolate* isolate = CcTest::i_isolate();
Heap* heap = isolate->heap();
- MemoryAllocator* memory_allocator =
- new MemoryAllocator(isolate, heap->MaxReserved(), 0);
- TestMemoryAllocatorScope test_scope(isolate, memory_allocator);
+ TestMemoryAllocatorScope test_allocator_scope(isolate, heap->MaxReserved(),
+ 0);
OldSpace* s = new OldSpace(heap);
CHECK_NOT_NULL(s);
@@ -293,8 +287,6 @@ TEST(OldSpace) {
}
delete s;
- memory_allocator->TearDown();
- delete memory_allocator;
}
TEST(LargeObjectSpace) {
@@ -315,8 +307,6 @@ TEST(LargeObjectSpace) {
CHECK(lo->Contains(HeapObject::cast(obj)));
- CHECK(lo->FindObject(ho->address()) == obj);
-
CHECK(lo->Contains(ho));
while (true) {
@@ -396,7 +386,7 @@ TEST(SizeOfInitialHeap) {
#endif // DEBUG
static HeapObject AllocateUnaligned(NewSpace* space, int size) {
- AllocationResult allocation = space->AllocateRawUnaligned(size);
+ AllocationResult allocation = space->AllocateRaw(size, kWordAligned);
CHECK(!allocation.IsRetry());
HeapObject filler;
CHECK(allocation.To(&filler));
@@ -406,7 +396,7 @@ static HeapObject AllocateUnaligned(NewSpace* space, int size) {
}
static HeapObject AllocateUnaligned(PagedSpace* space, int size) {
- AllocationResult allocation = space->AllocateRaw(size, kDoubleUnaligned);
+ AllocationResult allocation = space->AllocateRaw(size, kWordAligned);
CHECK(!allocation.IsRetry());
HeapObject filler;
CHECK(allocation.To(&filler));
diff --git a/deps/v8/test/cctest/heap/test-weak-references.cc b/deps/v8/test/cctest/heap/test-weak-references.cc
index 8a2ad3c184..bcf8622d31 100644
--- a/deps/v8/test/cctest/heap/test-weak-references.cc
+++ b/deps/v8/test/cctest/heap/test-weak-references.cc
@@ -5,6 +5,7 @@
#include "src/api-inl.h"
#include "src/assembler-inl.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects/smi.h"
#include "test/cctest/cctest.h"
@@ -41,12 +42,12 @@ TEST(WeakReferencesBasic) {
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
MaybeObject code_object = fv->optimized_code_weak_or_smi();
CHECK(code_object->IsSmi());
CcTest::CollectAllGarbage();
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
CHECK_EQ(code_object, fv->optimized_code_weak_or_smi());
{
@@ -123,7 +124,7 @@ TEST(WeakReferencesOldToNew) {
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array));
+ CHECK(Heap::InYoungGeneration(*fixed_array));
fv->set_optimized_code_weak_or_smi(HeapObjectReference::Weak(*fixed_array));
CcTest::CollectAllGarbage();
@@ -148,7 +149,7 @@ TEST(WeakReferencesOldToNewScavenged) {
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array));
+ CHECK(Heap::InYoungGeneration(*fixed_array));
fv->set_optimized_code_weak_or_smi(HeapObjectReference::Weak(*fixed_array));
CcTest::CollectGarbage(NEW_SPACE);
@@ -192,13 +193,13 @@ TEST(ObjectMovesBeforeClearingWeakField) {
HandleScope outer_scope(isolate);
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
FeedbackVector fv_location = *fv;
{
HandleScope inner_scope(isolate);
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array));
+ CHECK(Heap::InYoungGeneration(*fixed_array));
fv->set_optimized_code_weak_or_smi(HeapObjectReference::Weak(*fixed_array));
// inner_scope will go out of scope, so when marking the next time,
// *fixed_array will stay white.
@@ -233,12 +234,12 @@ TEST(ObjectWithWeakFieldDies) {
HandleScope outer_scope(isolate);
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
{
HandleScope inner_scope(isolate);
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array));
+ CHECK(Heap::InYoungGeneration(*fixed_array));
fv->set_optimized_code_weak_or_smi(
HeapObjectReference::Weak(*fixed_array));
// inner_scope will go out of scope, so when marking the next time,
@@ -266,11 +267,11 @@ TEST(ObjectWithWeakReferencePromoted) {
HandleScope outer_scope(isolate);
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array));
+ CHECK(Heap::InYoungGeneration(*fixed_array));
fv->set_optimized_code_weak_or_smi(HeapObjectReference::Weak(*fixed_array));
CcTest::CollectGarbage(NEW_SPACE);
@@ -292,13 +293,13 @@ TEST(ObjectWithClearedWeakReferencePromoted) {
HandleScope outer_scope(isolate);
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
fv->set_optimized_code_weak_or_smi(
HeapObjectReference::ClearedValue(isolate));
CcTest::CollectGarbage(NEW_SPACE);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
CHECK(fv->optimized_code_weak_or_smi()->IsCleared());
CcTest::CollectGarbage(NEW_SPACE);
@@ -323,21 +324,21 @@ TEST(WeakReferenceWriteBarrier) {
HandleScope outer_scope(isolate);
Handle<FeedbackVector> fv =
CreateFeedbackVectorForTest(CcTest::isolate(), factory);
- CHECK(Heap::InNewSpace(*fv));
+ CHECK(Heap::InYoungGeneration(*fv));
{
HandleScope inner_scope(isolate);
// Create a new FixedArray which the FeedbackVector will point to.
Handle<FixedArray> fixed_array1 = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array1));
+ CHECK(Heap::InYoungGeneration(*fixed_array1));
fv->set_optimized_code_weak_or_smi(
HeapObjectReference::Weak(*fixed_array1));
SimulateIncrementalMarking(heap, true);
Handle<FixedArray> fixed_array2 = factory->NewFixedArray(1);
- CHECK(Heap::InNewSpace(*fixed_array2));
+ CHECK(Heap::InYoungGeneration(*fixed_array2));
// This write will trigger the write barrier.
fv->set_optimized_code_weak_or_smi(
HeapObjectReference::Weak(*fixed_array2));
@@ -374,7 +375,7 @@ TEST(WeakArraysBasic) {
CHECK(array->IsWeakFixedArray());
CHECK(!array->IsFixedArray());
CHECK_EQ(array->length(), length);
- CHECK(Heap::InNewSpace(*array));
+ CHECK(Heap::InYoungGeneration(*array));
for (int i = 0; i < length; ++i) {
HeapObject heap_object;
@@ -481,7 +482,7 @@ TEST(WeakArrayListBasic) {
isolate, array, MaybeObjectHandle(Smi::FromInt(7), isolate));
CHECK_EQ(array->length(), 8);
- CHECK(Heap::InNewSpace(*array));
+ CHECK(Heap::InYoungGeneration(*array));
CHECK_EQ(array->Get(0), HeapObjectReference::Weak(*index0));
CHECK_EQ(array->Get(1).ToSmi().value(), 1);
diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc
index 7e1d6329c8..0a169b766c 100644
--- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc
+++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc
@@ -307,11 +307,10 @@ void BytecodeExpectationsPrinter::PrintConstant(
void BytecodeExpectationsPrinter::PrintFrameSize(
std::ostream& stream, i::Handle<i::BytecodeArray> bytecode_array) const {
- const int kPointerSize = sizeof(void*);
int frame_size = bytecode_array->frame_size();
- DCHECK_EQ(frame_size % kPointerSize, 0);
- stream << "frame size: " << frame_size / kPointerSize
+ DCHECK(IsAligned(frame_size, kSystemPointerSize));
+ stream << "frame size: " << frame_size / kSystemPointerSize
<< "\nparameter count: " << bytecode_array->parameter_count() << '\n';
}
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
index b0d3e93003..231a9050b8 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
@@ -14,7 +14,7 @@ snippet: "
"
frame size: 8
parameter count: 1
-bytecode array length: 190
+bytecode array length: 180
bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(1),
@@ -35,7 +35,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(95),
+ B(Jump), U8(85),
B(LdaUndefined),
B(Star), R(6),
B(Mov), R(0), R(5),
@@ -53,8 +53,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(51),
- B(Jump), U8(36),
+ B(Jump), U8(41),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(4),
B(Star), R(4),
@@ -70,10 +69,6 @@ bytecodes: [
B(Star), R(2),
B(LdaSmi), I8(2),
B(Star), R(1),
- B(Jump), U8(15),
- B(LdaSmi), I8(-1),
- B(Star), R(2),
- B(Star), R(1),
B(Jump), U8(7),
B(Star), R(2),
B(LdaZero),
@@ -111,8 +106,8 @@ constant pool: [
Smi [23],
]
handlers: [
- [20, 136, 144],
- [23, 100, 102],
+ [20, 134, 134],
+ [23, 100, 100],
]
---
@@ -122,7 +117,7 @@ snippet: "
"
frame size: 8
parameter count: 1
-bytecode array length: 235
+bytecode array length: 225
bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(3),
B(Mov), R(closure), R(1),
@@ -143,7 +138,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(140),
+ B(Jump), U8(130),
/* 22 S> */ B(LdaSmi), I8(42),
B(Star), R(6),
B(LdaFalse),
@@ -160,7 +155,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(95),
+ B(Jump), U8(85),
B(LdaUndefined),
B(Star), R(6),
B(Mov), R(0), R(5),
@@ -178,8 +173,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(51),
- B(Jump), U8(36),
+ B(Jump), U8(41),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(7),
B(Star), R(4),
@@ -195,10 +189,6 @@ bytecodes: [
B(Star), R(2),
B(LdaSmi), I8(2),
B(Star), R(1),
- B(Jump), U8(15),
- B(LdaSmi), I8(-1),
- B(Star), R(2),
- B(Star), R(1),
B(Jump), U8(7),
B(Star), R(2),
B(LdaZero),
@@ -239,8 +229,8 @@ constant pool: [
Smi [23],
]
handlers: [
- [20, 181, 189],
- [23, 145, 147],
+ [20, 179, 179],
+ [23, 145, 145],
]
---
@@ -250,21 +240,21 @@ snippet: "
"
frame size: 20
parameter count: 1
-bytecode array length: 416
+bytecode array length: 406
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(3),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(3),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 17 E> */ B(StackCheck),
B(Mov), R(context), R(6),
B(Mov), R(context), R(7),
- B(Ldar), R(2),
- /* 17 E> */ B(SuspendGenerator), R(2), R(0), U8(8), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(8),
+ B(Ldar), R(0),
+ /* 17 E> */ B(SuspendGenerator), R(0), R(0), U8(8), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(8),
B(Star), R(8),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(3), U8(2), I8(0),
B(Ldar), R(8),
/* 17 E> */ B(Throw),
@@ -297,18 +287,18 @@ bytecodes: [
B(Star), R(16),
B(LdaFalse),
B(Star), R(12),
- B(Mov), R(16), R(3),
+ B(Mov), R(16), R(1),
/* 22 E> */ B(StackCheck),
- /* 31 S> */ B(Mov), R(3), R(0),
+ /* 31 S> */ B(Mov), R(1), R(3),
/* 42 S> */ B(LdaFalse),
B(Star), R(19),
- B(Mov), R(2), R(17),
- B(Mov), R(0), R(18),
+ B(Mov), R(0), R(17),
+ B(Mov), R(3), R(18),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorYield), R(17), U8(3),
- /* 42 E> */ B(SuspendGenerator), R(2), R(0), U8(17), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(17),
+ /* 42 E> */ B(SuspendGenerator), R(0), R(0), U8(17), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(17),
B(Star), R(17),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(10), U8(2), I8(0),
B(Ldar), R(17),
/* 42 E> */ B(Throw),
@@ -336,7 +326,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(18),
B(LdaConstant), U8(13),
B(Star), R(19),
@@ -364,15 +354,15 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(4),
B(Mov), R(14), R(5),
- B(Jump), U8(95),
+ B(Jump), U8(85),
B(LdaUndefined),
B(Star), R(9),
- B(Mov), R(2), R(8),
+ B(Mov), R(0), R(8),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorAwaitUncaught), R(8), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(8), U8(2),
- B(ResumeGenerator), R(2), R(0), U8(8),
+ B(SuspendGenerator), R(0), R(0), U8(8), U8(2),
+ B(ResumeGenerator), R(0), R(0), U8(8),
B(Star), R(8),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(9),
B(LdaZero),
B(TestReferenceEqual), R(9),
@@ -382,8 +372,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(4),
B(Mov), R(8), R(5),
- B(Jump), U8(51),
- B(Jump), U8(36),
+ B(Jump), U8(41),
B(Star), R(8),
B(CreateCatchContext), R(8), U8(16),
B(Star), R(7),
@@ -393,16 +382,12 @@ bytecodes: [
B(PushContext), R(8),
B(LdaImmutableCurrentContextSlot), U8(4),
B(Star), R(10),
- B(Mov), R(2), R(9),
+ B(Mov), R(0), R(9),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorReject), R(9), U8(2),
B(PopContext), R(8),
B(Star), R(5),
B(LdaSmi), I8(2),
B(Star), R(4),
- B(Jump), U8(15),
- B(LdaSmi), I8(-1),
- B(Star), R(5),
- B(Star), R(4),
B(Jump), U8(7),
B(Star), R(5),
B(LdaZero),
@@ -410,7 +395,7 @@ bytecodes: [
B(LdaTheHole),
B(SetPendingMessage),
B(Star), R(6),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorClose), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorClose), R(0), U8(1),
B(Ldar), R(6),
B(SetPendingMessage),
B(Ldar), R(4),
@@ -420,7 +405,7 @@ bytecodes: [
B(ReThrow),
B(LdaTrue),
B(Star), R(9),
- B(Mov), R(2), R(7),
+ B(Mov), R(0), R(7),
B(Mov), R(5), R(8),
B(InvokeIntrinsic), U8(Runtime::k_AsyncGeneratorResolve), R(7), U8(3),
/* 50 S> */ B(Return),
@@ -447,14 +432,14 @@ constant pool: [
Smi [6],
Smi [9],
SCOPE_INFO_TYPE,
- Smi [321],
+ Smi [311],
Smi [6],
Smi [9],
Smi [23],
]
handlers: [
- [20, 362, 370],
- [23, 326, 328],
+ [20, 360, 360],
+ [23, 326, 326],
[93, 180, 188],
[234, 247, 249],
]
@@ -467,7 +452,7 @@ snippet: "
"
frame size: 17
parameter count: 1
-bytecode array length: 482
+bytecode array length: 472
bytecodes: [
B(SwitchOnGeneratorState), R(0), U8(0), U8(5),
B(Mov), R(closure), R(1),
@@ -595,7 +580,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(7), R(2),
- B(Jump), U8(95),
+ B(Jump), U8(85),
B(LdaUndefined),
B(Star), R(6),
B(Mov), R(0), R(5),
@@ -613,8 +598,7 @@ bytecodes: [
B(LdaSmi), I8(1),
B(Star), R(1),
B(Mov), R(5), R(2),
- B(Jump), U8(51),
- B(Jump), U8(36),
+ B(Jump), U8(41),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(17),
B(Star), R(4),
@@ -630,10 +614,6 @@ bytecodes: [
B(Star), R(2),
B(LdaSmi), I8(2),
B(Star), R(1),
- B(Jump), U8(15),
- B(LdaSmi), I8(-1),
- B(Star), R(2),
- B(Star), R(1),
B(Jump), U8(7),
B(Star), R(2),
B(LdaZero),
@@ -679,14 +659,14 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
SCOPE_INFO_TYPE,
- Smi [387],
- Smi [287],
+ Smi [377],
+ Smi [277],
Smi [6],
Smi [9],
Smi [23],
]
handlers: [
- [20, 428, 436],
- [23, 392, 394],
+ [20, 426, 426],
+ [23, 392, 392],
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden
index 6bbc4d11ba..e5c7177efc 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden
@@ -696,8 +696,8 @@ bytecode array length: 50
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
- B(Star), R(1),
- /* 52 S> */ B(Ldar), R(1),
+ B(Star), R(0),
+ /* 52 S> */ B(Ldar), R(0),
B(JumpIfToBooleanFalse), U8(42),
/* 45 E> */ B(StackCheck),
B(CreateBlockContext), U8(0),
@@ -705,10 +705,10 @@ bytecodes: [
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
+ B(Star), R(2),
/* 73 S> */ B(LdaSmi), I8(1),
/* 73 E> */ B(StaCurrentContextSlot), U8(4),
- /* 102 S> */ B(Mov), R(0), R(2),
+ /* 102 S> */ B(Mov), R(2), R(1),
/* 106 S> */ B(LdaCurrentContextSlot), U8(4),
B(JumpIfToBooleanFalse), U8(6),
/* 113 S> */ B(PopContext), R(3),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden
index 179ac8071a..b6184f084f 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden
@@ -109,11 +109,11 @@ bytecodes: [
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
+ B(Star), R(1),
/* 53 S> */ B(LdaSmi), I8(10),
/* 53 E> */ B(StaCurrentContextSlot), U8(4),
- /* 85 S> */ B(Mov), R(0), R(1),
- B(Ldar), R(0),
+ /* 85 S> */ B(Mov), R(1), R(0),
+ B(Ldar), R(1),
/* 88 S> */ B(Jump), U8(2),
B(PopContext), R(2),
B(LdaUndefined),
@@ -155,10 +155,10 @@ bytecodes: [
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
B(CreateClosure), U8(2), U8(0), U8(2),
- B(Star), R(0),
+ B(Star), R(1),
/* 76 S> */ B(LdaSmi), I8(2),
/* 76 E> */ B(StaCurrentContextSlot), U8(4),
- /* 113 S> */ B(Mov), R(0), R(1),
+ /* 113 S> */ B(Mov), R(1), R(0),
/* 118 S> */ B(LdaCurrentContextSlot), U8(4),
B(JumpIfToBooleanFalse), U8(6),
/* 125 S> */ B(PopContext), R(3),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden
index 440936ffad..1dd2c099eb 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden
@@ -74,7 +74,7 @@ bytecodes: [
B(LdaSmi), I8(2),
B(Star), R(4),
B(Mov), R(this), R(1),
- /* 138 E> */ B(CallRuntime), U16(Runtime::kStoreToSuper_Strict), R(1), U8(4),
+ /* 138 E> */ B(CallRuntime), U16(Runtime::kStoreToSuper), R(1), U8(4),
/* 143 S> */ B(LdaConstant), U8(0),
/* 150 E> */ B(LdaKeyedProperty), R(closure), U8(2),
B(Star), R(2),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden
index 27911a41c2..f79bb9457a 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden
@@ -30,9 +30,9 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
B(LdaUndefined),
/* 149 S> */ B(Return),
]
@@ -70,9 +70,9 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
B(LdaUndefined),
/* 149 S> */ B(Return),
]
@@ -128,9 +128,9 @@ bytecodes: [
B(Star), R(11),
B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(7),
B(Star), R(5),
- B(Mov), R(4), R(0),
+ B(Mov), R(4), R(1),
B(PopContext), R(3),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
B(LdaUndefined),
/* 129 S> */ B(Return),
]
@@ -174,11 +174,11 @@ bytecodes: [
B(Mov), R(4), R(6),
B(CallRuntime), U16(Runtime::kDefineClass), R(5), U8(3),
B(Star), R(5),
- B(Mov), R(6), R(0),
+ B(Mov), R(6), R(1),
B(PopContext), R(3),
- B(Mov), R(0), R(1),
- /* 87 S> */ B(Ldar), R(1),
- /* 94 E> */ B(Construct), R(1), R(0), U8(0), U8(1),
+ B(Mov), R(1), R(0),
+ /* 87 S> */ B(Ldar), R(0),
+ /* 94 E> */ B(Construct), R(0), R(0), U8(0), U8(1),
/* 102 S> */ B(Return),
]
constant pool: [
@@ -225,9 +225,9 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
B(LdaUndefined),
/* 74 S> */ B(Return),
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden
index 83a267c29f..d9413a1866 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompareNil.golden
@@ -211,7 +211,7 @@ snippet: "
"
frame size: 1
parameter count: 1
-bytecode array length: 14
+bytecode array length: 12
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaZero),
@@ -221,8 +221,6 @@ bytecodes: [
/* 74 S> */ B(Return),
/* 86 S> */ B(LdaSmi), I8(2),
/* 95 S> */ B(Return),
- B(LdaUndefined),
- /* 98 S> */ B(Return),
]
constant pool: [
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden
index 73e7e0d8e0..f35ff24b39 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden
@@ -9,16 +9,14 @@ wrap: yes
snippet: "
const x = 10; function f1() {return x;}
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 21
+bytecode array length: 15
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), I8(10),
/* 44 E> */ B(StaCurrentContextSlot), U8(4),
@@ -27,7 +25,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
@@ -36,16 +33,14 @@ handlers: [
snippet: "
const x = 10; function f1() {return x;} return x;
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 22
+bytecode array length: 16
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), I8(10),
/* 44 E> */ B(StaCurrentContextSlot), U8(4),
@@ -54,7 +49,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
@@ -63,21 +57,19 @@ handlers: [
snippet: "
const x = (x = 20); function f1() {return x;}
"
-frame size: 3
+frame size: 2
parameter count: 1
-bytecode array length: 32
+bytecode array length: 26
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), I8(20),
- B(Star), R(2),
+ B(Star), R(1),
B(LdaCurrentContextSlot), U8(4),
- /* 47 E> */ B(ThrowReferenceErrorIfHole), U8(2),
+ /* 47 E> */ B(ThrowReferenceErrorIfHole), U8(1),
B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
/* 44 E> */ B(StaCurrentContextSlot), U8(4),
B(LdaUndefined),
@@ -85,7 +77,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"],
]
handlers: [
@@ -95,16 +86,14 @@ handlers: [
snippet: "
const x = 10; x = 20; function f1() {return x;}
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 28
+bytecode array length: 22
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 44 S> */ B(LdaSmi), I8(10),
/* 44 E> */ B(StaCurrentContextSlot), U8(4),
@@ -115,7 +104,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden
index 6973d1166a..37daec48ad 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden
@@ -18,7 +18,7 @@ bytecodes: [
B(CreateRestParameter),
B(Star), R(1),
/* 10 E> */ B(StackCheck),
- /* 22 S> */ B(Star), R(0),
+ B(Star), R(0),
/* 42 S> */ B(Return),
]
constant pool: [
@@ -38,8 +38,8 @@ bytecodes: [
B(CreateRestParameter),
B(Star), R(2),
/* 10 E> */ B(StackCheck),
- /* 12 S> */ B(Mov), R(arg0), R(0),
- /* 25 S> */ B(Mov), R(2), R(1),
+ B(Mov), R(arg0), R(0),
+ B(Mov), R(2), R(1),
/* 29 S> */ B(Ldar), R(1),
/* 45 S> */ B(Return),
]
@@ -60,8 +60,8 @@ bytecodes: [
B(CreateRestParameter),
B(Star), R(2),
/* 10 E> */ B(StackCheck),
- /* 12 S> */ B(Mov), R(arg0), R(0),
- /* 25 S> */ B(Mov), R(2), R(1),
+ B(Mov), R(arg0), R(0),
+ B(Mov), R(2), R(1),
/* 29 S> */ B(LdaZero),
/* 44 E> */ B(LdaKeyedProperty), R(1), U8(0),
/* 48 S> */ B(Return),
@@ -85,8 +85,8 @@ bytecodes: [
B(CreateRestParameter),
B(Star), R(2),
/* 10 E> */ B(StackCheck),
- /* 12 S> */ B(Mov), R(arg0), R(0),
- /* 25 S> */ B(Mov), R(2), R(1),
+ B(Mov), R(arg0), R(0),
+ B(Mov), R(2), R(1),
/* 29 S> */ B(LdaZero),
/* 44 E> */ B(LdaKeyedProperty), R(1), U8(1),
B(Star), R(4),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden
index 3a2ea7d5d8..f4a7c340c4 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DestructuringAssignment.golden
@@ -66,7 +66,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(13),
B(LdaConstant), U8(6),
B(Star), R(14),
@@ -115,7 +115,7 @@ snippet: "
"
frame size: 16
parameter count: 1
-bytecode array length: 266
+bytecode array length: 264
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
@@ -185,7 +185,6 @@ bytecodes: [
B(Star), R(14),
B(JumpLoop), U8(33), I8(0),
B(Mov), R(13), R(1),
- B(Ldar), R(1),
B(LdaSmi), I8(-1),
B(Star), R(10),
B(Star), R(9),
@@ -204,7 +203,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(14),
B(LdaConstant), U8(6),
B(Star), R(15),
@@ -242,8 +241,8 @@ constant pool: [
ONE_BYTE_INTERNALIZED_STRING_TYPE [""],
]
handlers: [
- [44, 174, 182],
- [228, 241, 243],
+ [44, 172, 180],
+ [226, 239, 241],
]
---
@@ -328,7 +327,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(15),
B(LdaConstant), U8(7),
B(Star), R(16),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
index 3c89cfed30..6fe59da400 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
@@ -16,13 +16,13 @@ snippet: "
"
frame size: 21
parameter count: 1
-bytecode array length: 329
+bytecode array length: 325
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(4),
/* 43 S> */ B(CreateArrayLiteral), U8(2), U8(0), U8(37),
@@ -49,12 +49,12 @@ bytecodes: [
B(Star), R(9),
/* 38 S> */ B(CallProperty0), R(5), R(6), U8(11),
B(Star), R(15),
- B(Mov), R(2), R(14),
+ B(Mov), R(0), R(14),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(14), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(14), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(14),
+ B(SuspendGenerator), R(0), R(0), U8(14), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(14),
B(Star), R(14),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(15),
B(LdaZero),
B(TestReferenceEqual), R(15),
@@ -71,9 +71,9 @@ bytecodes: [
B(Star), R(13),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(13), R(3),
+ B(Mov), R(13), R(1),
/* 23 E> */ B(StackCheck),
- /* 38 S> */ B(Mov), R(3), R(0),
+ /* 38 S> */ B(Mov), R(1), R(3),
B(Ldar), R(13),
B(JumpLoop), U8(77), I8(0),
B(LdaSmi), I8(-1),
@@ -94,7 +94,7 @@ bytecodes: [
B(JumpIfNull), U8(86),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(17),
B(LdaConstant), U8(9),
B(Star), R(18),
@@ -103,12 +103,12 @@ bytecodes: [
B(Mov), R(context), R(17),
B(CallProperty0), R(16), R(6), U8(19),
B(Star), R(19),
- B(Mov), R(2), R(18),
+ B(Mov), R(0), R(18),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(18), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(18), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(18),
+ B(SuspendGenerator), R(0), R(0), U8(18), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(18),
B(Star), R(18),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(19),
B(LdaZero),
B(TestReferenceEqual), R(19),
@@ -137,10 +137,9 @@ bytecodes: [
B(Star), R(6),
B(LdaTrue),
B(Star), R(7),
- B(Mov), R(2), R(5),
+ B(Mov), R(0), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3),
/* 57 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(10),
B(Star), R(4),
@@ -152,11 +151,9 @@ bytecodes: [
B(Star), R(7),
B(LdaTrue),
B(Star), R(8),
- B(Mov), R(2), R(6),
+ B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3),
/* 57 S> */ B(Return),
- B(LdaUndefined),
- /* 57 S> */ B(Return),
]
constant pool: [
Smi [98],
@@ -172,7 +169,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [20, 297, 299],
+ [20, 297, 297],
[77, 157, 165],
[211, 260, 262],
]
@@ -186,13 +183,13 @@ snippet: "
"
frame size: 21
parameter count: 1
-bytecode array length: 350
+bytecode array length: 346
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(4),
/* 43 S> */ B(CreateArrayLiteral), U8(2), U8(0), U8(37),
@@ -219,12 +216,12 @@ bytecodes: [
B(Star), R(9),
/* 38 S> */ B(CallProperty0), R(5), R(6), U8(11),
B(Star), R(15),
- B(Mov), R(2), R(14),
+ B(Mov), R(0), R(14),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(14), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(14), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(14),
+ B(SuspendGenerator), R(0), R(0), U8(14), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(14),
B(Star), R(14),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(15),
B(LdaZero),
B(TestReferenceEqual), R(15),
@@ -241,9 +238,9 @@ bytecodes: [
B(Star), R(13),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(13), R(3),
+ B(Mov), R(13), R(1),
/* 23 E> */ B(StackCheck),
- /* 38 S> */ B(Mov), R(3), R(0),
+ /* 38 S> */ B(Mov), R(1), R(3),
/* 56 S> */ B(LdaSmi), I8(1),
B(Mov), R(13), R(11),
B(Star), R(10),
@@ -266,7 +263,7 @@ bytecodes: [
B(JumpIfNull), U8(86),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(17),
B(LdaConstant), U8(9),
B(Star), R(18),
@@ -275,12 +272,12 @@ bytecodes: [
B(Mov), R(context), R(17),
B(CallProperty0), R(16), R(6), U8(19),
B(Star), R(19),
- B(Mov), R(2), R(18),
+ B(Mov), R(0), R(18),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(18), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(18), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(18),
+ B(SuspendGenerator), R(0), R(0), U8(18), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(18),
B(Star), R(18),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(19),
B(LdaZero),
B(TestReferenceEqual), R(19),
@@ -307,7 +304,7 @@ bytecodes: [
B(ReThrow),
B(LdaTrue),
B(Star), R(18),
- B(Mov), R(2), R(16),
+ B(Mov), R(0), R(16),
B(Mov), R(11), R(17),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(16), U8(3),
/* 68 S> */ B(Return),
@@ -315,10 +312,9 @@ bytecodes: [
B(Star), R(6),
B(LdaTrue),
B(Star), R(7),
- B(Mov), R(2), R(5),
+ B(Mov), R(0), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3),
/* 68 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(12),
B(Star), R(4),
@@ -330,11 +326,9 @@ bytecodes: [
B(Star), R(7),
B(LdaTrue),
B(Star), R(8),
- B(Mov), R(2), R(6),
+ B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3),
/* 68 S> */ B(Return),
- B(LdaUndefined),
- /* 68 S> */ B(Return),
]
constant pool: [
Smi [98],
@@ -352,7 +346,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [20, 318, 320],
+ [20, 318, 318],
[77, 161, 169],
[215, 264, 266],
]
@@ -369,13 +363,13 @@ snippet: "
"
frame size: 21
parameter count: 1
-bytecode array length: 345
+bytecode array length: 341
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(4),
/* 43 S> */ B(CreateArrayLiteral), U8(2), U8(0), U8(37),
@@ -402,12 +396,12 @@ bytecodes: [
B(Star), R(9),
/* 38 S> */ B(CallProperty0), R(5), R(6), U8(11),
B(Star), R(15),
- B(Mov), R(2), R(14),
+ B(Mov), R(0), R(14),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(14), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(14), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(14),
+ B(SuspendGenerator), R(0), R(0), U8(14), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(14),
B(Star), R(14),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(15),
B(LdaZero),
B(TestReferenceEqual), R(15),
@@ -424,15 +418,15 @@ bytecodes: [
B(Star), R(13),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(13), R(3),
+ B(Mov), R(13), R(1),
/* 23 E> */ B(StackCheck),
- /* 38 S> */ B(Mov), R(3), R(0),
+ /* 38 S> */ B(Mov), R(1), R(3),
/* 63 S> */ B(LdaSmi), I8(10),
- /* 69 E> */ B(TestEqual), R(0), U8(17),
+ /* 69 E> */ B(TestEqual), R(3), U8(17),
B(JumpIfFalse), U8(4),
/* 76 S> */ B(Jump), U8(11),
/* 90 S> */ B(LdaSmi), I8(20),
- /* 96 E> */ B(TestEqual), R(0), U8(18),
+ /* 96 E> */ B(TestEqual), R(3), U8(18),
B(JumpIfFalse), U8(4),
/* 103 S> */ B(Jump), U8(5),
B(JumpLoop), U8(93), I8(0),
@@ -454,7 +448,7 @@ bytecodes: [
B(JumpIfNull), U8(86),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(17),
B(LdaConstant), U8(9),
B(Star), R(18),
@@ -463,12 +457,12 @@ bytecodes: [
B(Mov), R(context), R(17),
B(CallProperty0), R(16), R(6), U8(21),
B(Star), R(19),
- B(Mov), R(2), R(18),
+ B(Mov), R(0), R(18),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(18), U8(2),
- B(SuspendGenerator), R(2), R(0), U8(18), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(18),
+ B(SuspendGenerator), R(0), R(0), U8(18), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(18),
B(Star), R(18),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(19),
B(LdaZero),
B(TestReferenceEqual), R(19),
@@ -497,10 +491,9 @@ bytecodes: [
B(Star), R(6),
B(LdaTrue),
B(Star), R(7),
- B(Mov), R(2), R(5),
+ B(Mov), R(0), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3),
/* 114 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(10),
B(Star), R(4),
@@ -512,11 +505,9 @@ bytecodes: [
B(Star), R(7),
B(LdaTrue),
B(Star), R(8),
- B(Mov), R(2), R(6),
+ B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3),
/* 114 S> */ B(Return),
- B(LdaUndefined),
- /* 114 S> */ B(Return),
]
constant pool: [
Smi [98],
@@ -532,7 +523,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [20, 313, 315],
+ [20, 313, 313],
[77, 173, 181],
[227, 276, 278],
]
@@ -547,7 +538,7 @@ snippet: "
"
frame size: 16
parameter count: 1
-bytecode array length: 265
+bytecode array length: 261
bytecodes: [
B(Mov), R(closure), R(2),
B(Mov), R(this), R(3),
@@ -609,7 +600,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(14),
B(LdaConstant), U8(8),
B(Star), R(15),
@@ -647,7 +638,6 @@ bytecodes: [
B(Mov), R(0), R(3),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(3), U8(3),
/* 96 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(3),
B(CreateCatchContext), R(3), U8(11),
B(Star), R(2),
@@ -662,8 +652,6 @@ bytecodes: [
B(Mov), R(0), R(4),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(4), U8(3),
/* 96 S> */ B(Return),
- B(LdaUndefined),
- /* 96 S> */ B(Return),
]
constant pool: [
OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
@@ -680,7 +668,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [16, 233, 235],
+ [16, 233, 233],
[59, 112, 120],
[166, 179, 181],
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden
index 67f5c389e6..571002d16e 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden
@@ -62,7 +62,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(12),
B(LdaConstant), U8(6),
B(Star), R(13),
@@ -165,7 +165,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(13),
B(LdaConstant), U8(6),
B(Star), R(14),
@@ -278,7 +278,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(12),
B(LdaConstant), U8(6),
B(Star), R(13),
@@ -384,7 +384,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(12),
B(LdaConstant), U8(8),
B(Star), R(13),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
index 33cccfc896..2672e0688e 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
@@ -42,10 +42,10 @@ bytecodes: [
B(Star), R(12),
B(LdaFalse),
B(Star), R(8),
- B(Mov), R(12), R(3),
+ B(Mov), R(12), R(0),
/* 20 E> */ B(StackCheck),
- /* 29 S> */ B(Mov), R(3), R(1),
- /* 49 S> */ B(Mov), R(1), R(0),
+ /* 29 S> */ B(Mov), R(0), R(2),
+ /* 49 S> */ B(Mov), R(2), R(3),
B(Ldar), R(12),
B(JumpLoop), U8(43), I8(0),
B(LdaSmi), I8(-1),
@@ -66,7 +66,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(14),
B(LdaConstant), U8(5),
B(Star), R(15),
@@ -203,7 +203,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(15),
B(LdaConstant), U8(10),
B(Star), R(16),
@@ -286,19 +286,19 @@ bytecodes: [
B(Star), R(10),
B(LdaFalse),
B(Star), R(6),
- B(Mov), R(10), R(1),
+ B(Mov), R(10), R(0),
/* 20 E> */ B(StackCheck),
B(CreateBlockContext), U8(4),
B(PushContext), R(11),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- /* 29 S> */ B(Ldar), R(1),
+ /* 29 S> */ B(Ldar), R(0),
/* 29 E> */ B(StaCurrentContextSlot), U8(4),
/* 41 S> */ B(CreateClosure), U8(5), U8(12), U8(2),
B(Star), R(12),
/* 67 E> */ B(CallUndefinedReceiver0), R(12), U8(13),
B(PopContext), R(11),
- B(Mov), R(1), R(10),
+ B(Mov), R(0), R(10),
B(JumpLoop), U8(60), I8(0),
B(LdaSmi), I8(-1),
B(Star), R(8),
@@ -318,7 +318,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(13),
B(LdaConstant), U8(7),
B(Star), R(14),
@@ -397,7 +397,7 @@ bytecodes: [
B(Star), R(14),
B(LdaFalse),
B(Star), R(10),
- B(Mov), R(14), R(5),
+ B(Mov), R(14), R(0),
/* 20 E> */ B(StackCheck),
/* 36 S> */ B(Ldar), R(14),
B(JumpIfNull), U8(4),
@@ -405,12 +405,12 @@ bytecodes: [
/* 29 E> */ B(CallRuntime), U16(Runtime::kThrowPatternAssignmentNonCoercible), R(0), U8(0),
B(Star), R(15),
/* 31 S> */ B(LdaNamedProperty), R(15), U8(4), U8(12),
- B(Star), R(1),
+ B(Star), R(3),
/* 34 S> */ B(LdaNamedProperty), R(15), U8(5), U8(14),
- B(Star), R(2),
- /* 56 S> */ B(Ldar), R(2),
- /* 58 E> */ B(Add), R(1), U8(16),
- B(Star), R(0),
+ B(Star), R(4),
+ /* 56 S> */ B(Ldar), R(4),
+ /* 58 E> */ B(Add), R(3), U8(16),
+ B(Star), R(5),
B(JumpLoop), U8(67), I8(0),
B(LdaSmi), I8(-1),
B(Star), R(12),
@@ -430,7 +430,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(16),
B(LdaConstant), U8(7),
B(Star), R(17),
@@ -484,16 +484,16 @@ frame size: 17
parameter count: 2
bytecode array length: 214
bytecodes: [
- B(SwitchOnGeneratorState), R(3), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(Mov), R(closure), R(5),
B(Mov), R(this), R(6),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(5), U8(2),
- B(Star), R(3),
+ B(Star), R(0),
/* 11 E> */ B(StackCheck),
- /* 11 E> */ B(SuspendGenerator), R(3), R(0), U8(5), U8(0),
- B(ResumeGenerator), R(3), R(0), U8(5),
+ /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(5), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(5),
B(Star), R(5),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(3), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
B(Ldar), R(5),
/* 11 E> */ B(Throw),
@@ -523,10 +523,10 @@ bytecodes: [
B(Star), R(13),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(13), R(4),
+ B(Mov), R(13), R(1),
/* 21 E> */ B(StackCheck),
- /* 30 S> */ B(Mov), R(4), R(1),
- /* 50 S> */ B(Mov), R(1), R(0),
+ /* 30 S> */ B(Mov), R(1), R(3),
+ /* 50 S> */ B(Mov), R(3), R(4),
B(Ldar), R(13),
B(JumpLoop), U8(43), I8(0),
B(LdaSmi), I8(-1),
@@ -547,7 +547,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(15),
B(LdaConstant), U8(8),
B(Star), R(16),
@@ -602,16 +602,16 @@ frame size: 16
parameter count: 2
bytecode array length: 258
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 11 E> */ B(StackCheck),
- /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(4),
+ /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 11 E> */ B(Throw),
@@ -641,17 +641,17 @@ bytecodes: [
B(Star), R(12),
B(LdaFalse),
B(Star), R(8),
- B(Mov), R(12), R(3),
+ B(Mov), R(12), R(1),
/* 21 E> */ B(StackCheck),
- /* 30 S> */ B(Mov), R(3), R(0),
+ /* 30 S> */ B(Mov), R(1), R(3),
/* 40 S> */ B(LdaFalse),
B(Star), R(14),
- B(Mov), R(0), R(13),
+ B(Mov), R(3), R(13),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(13), U8(2),
- /* 40 E> */ B(SuspendGenerator), R(2), R(0), U8(13), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(13),
+ /* 40 E> */ B(SuspendGenerator), R(0), R(0), U8(13), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(13),
B(Star), R(13),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(8), U8(2), I8(0),
B(Ldar), R(13),
/* 40 E> */ B(Throw),
@@ -679,7 +679,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(14),
B(LdaConstant), U8(11),
B(Star), R(15),
@@ -739,12 +739,12 @@ snippet: "
"
frame size: 18
parameter count: 2
-bytecode array length: 232
+bytecode array length: 228
bytecodes: [
B(Mov), R(closure), R(5),
B(Mov), R(this), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(5), U8(2),
- B(Star), R(3),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(5),
/* 40 S> */ B(LdaNamedProperty), R(arg0), U8(0), U8(0),
@@ -771,10 +771,10 @@ bytecodes: [
B(Star), R(14),
B(LdaFalse),
B(Star), R(10),
- B(Mov), R(14), R(4),
+ B(Mov), R(14), R(1),
/* 26 E> */ B(StackCheck),
- /* 35 S> */ B(Mov), R(4), R(1),
- /* 55 S> */ B(Mov), R(1), R(0),
+ /* 35 S> */ B(Mov), R(1), R(3),
+ /* 55 S> */ B(Mov), R(3), R(4),
B(Ldar), R(14),
B(JumpLoop), U8(43), I8(0),
B(LdaSmi), I8(-1),
@@ -795,7 +795,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(16),
B(LdaConstant), U8(5),
B(Star), R(17),
@@ -824,10 +824,9 @@ bytecodes: [
B(Star), R(7),
B(LdaFalse),
B(Star), R(8),
- B(Mov), R(3), R(6),
+ B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(6), U8(3),
/* 60 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(6),
B(CreateCatchContext), R(6), U8(6),
B(Star), R(5),
@@ -839,11 +838,9 @@ bytecodes: [
B(Star), R(8),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(3), R(7),
+ B(Mov), R(0), R(7),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(7), U8(3),
/* 60 S> */ B(Return),
- B(LdaUndefined),
- /* 60 S> */ B(Return),
]
constant pool: [
SYMBOL_TYPE,
@@ -855,7 +852,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [16, 200, 202],
+ [16, 200, 200],
[50, 96, 104],
[150, 163, 165],
]
@@ -869,13 +866,13 @@ snippet: "
"
frame size: 17
parameter count: 2
-bytecode array length: 268
+bytecode array length: 264
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(4),
/* 40 S> */ B(LdaNamedProperty), R(arg0), U8(1), U8(0),
@@ -902,16 +899,16 @@ bytecodes: [
B(Star), R(13),
B(LdaFalse),
B(Star), R(9),
- B(Mov), R(13), R(3),
+ B(Mov), R(13), R(1),
/* 26 E> */ B(StackCheck),
- /* 35 S> */ B(Mov), R(3), R(0),
- /* 45 S> */ B(Mov), R(2), R(14),
- B(Mov), R(0), R(15),
+ /* 35 S> */ B(Mov), R(1), R(3),
+ /* 45 S> */ B(Mov), R(0), R(14),
+ B(Mov), R(3), R(15),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(14), U8(2),
- /* 45 E> */ B(SuspendGenerator), R(2), R(0), U8(14), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(14),
+ /* 45 E> */ B(SuspendGenerator), R(0), R(0), U8(14), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(14),
B(Star), R(14),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(15),
B(LdaZero),
B(TestReferenceEqual), R(15),
@@ -938,7 +935,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(15),
B(LdaConstant), U8(6),
B(Star), R(16),
@@ -967,10 +964,9 @@ bytecodes: [
B(Star), R(6),
B(LdaTrue),
B(Star), R(7),
- B(Mov), R(2), R(5),
+ B(Mov), R(0), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(5), U8(3),
/* 54 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(5),
B(CreateCatchContext), R(5), U8(7),
B(Star), R(4),
@@ -982,11 +978,9 @@ bytecodes: [
B(Star), R(7),
B(LdaTrue),
B(Star), R(8),
- B(Mov), R(2), R(6),
+ B(Mov), R(0), R(6),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(6), U8(3),
/* 54 S> */ B(Return),
- B(LdaUndefined),
- /* 54 S> */ B(Return),
]
constant pool: [
Smi [107],
@@ -999,7 +993,7 @@ constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [20, 236, 238],
+ [20, 236, 236],
[54, 132, 140],
[186, 199, 201],
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden
index f6520129c1..77b1924c73 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden
@@ -102,16 +102,16 @@ frame size: 16
parameter count: 1
bytecode array length: 261
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 11 E> */ B(StackCheck),
- /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(4),
+ /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 11 E> */ B(Throw),
@@ -142,17 +142,17 @@ bytecodes: [
B(Star), R(12),
B(LdaFalse),
B(Star), R(8),
- B(Mov), R(12), R(3),
+ B(Mov), R(12), R(1),
/* 16 E> */ B(StackCheck),
- /* 25 S> */ B(Mov), R(3), R(0),
+ /* 25 S> */ B(Mov), R(1), R(3),
/* 36 S> */ B(LdaFalse),
B(Star), R(14),
- B(Mov), R(0), R(13),
+ B(Mov), R(3), R(13),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(13), U8(2),
- /* 36 E> */ B(SuspendGenerator), R(2), R(0), U8(13), U8(1),
- B(ResumeGenerator), R(2), R(0), U8(13),
+ /* 36 E> */ B(SuspendGenerator), R(0), R(0), U8(13), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(13),
B(Star), R(13),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(9), U8(2), I8(0),
B(Ldar), R(13),
/* 36 E> */ B(Throw),
@@ -180,7 +180,7 @@ bytecodes: [
B(JumpIfNull), U8(50),
B(TestTypeOf), U8(6),
B(JumpIfTrue), U8(18),
- B(Wide), B(LdaSmi), I16(154),
+ B(Wide), B(LdaSmi), I16(155),
B(Star), R(14),
B(LdaConstant), U8(12),
B(Star), R(15),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden
index e68211a189..46d972af0c 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden
@@ -147,7 +147,7 @@ snippet: "
"
frame size: 0
parameter count: 2
-bytecode array length: 19
+bytecode array length: 17
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 18 S> */ B(LdaZero),
@@ -157,8 +157,6 @@ bytecodes: [
/* 47 S> */ B(Return),
/* 63 S> */ B(Wide), B(LdaSmi), I16(-200),
/* 75 S> */ B(Return),
- B(LdaUndefined),
- /* 80 S> */ B(Return),
]
constant pool: [
]
@@ -171,11 +169,11 @@ snippet: "
"
frame size: 0
parameter count: 3
-bytecode array length: 14
+bytecode array length: 15
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 19 S> */ B(Ldar), R(arg1),
- /* 25 E> */ B(TestIn), R(arg0),
+ /* 25 E> */ B(TestIn), R(arg0), U8(0),
B(JumpIfFalse), U8(7),
/* 33 S> */ B(Wide), B(LdaSmi), I16(200),
/* 44 S> */ B(Return),
@@ -258,7 +256,7 @@ snippet: "
"
frame size: 2
parameter count: 2
-bytecode array length: 29
+bytecode array length: 27
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 24 S> */ B(LdaZero),
@@ -273,8 +271,6 @@ bytecodes: [
/* 1092 S> */ B(Return),
/* 1102 S> */ B(Wide), B(LdaSmi), I16(-200),
/* 1114 S> */ B(Return),
- B(LdaUndefined),
- /* 1117 S> */ B(Return),
]
constant pool: [
HEAP_NUMBER_TYPE [0.01],
@@ -357,7 +353,7 @@ snippet: "
"
frame size: 2
parameter count: 1
-bytecode array length: 26
+bytecode array length: 24
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 25 S> */ B(LdaZero),
@@ -371,8 +367,6 @@ bytecodes: [
/* 1087 S> */ B(Return),
/* 1097 S> */ B(Wide), B(LdaSmi), I16(-200),
/* 1109 S> */ B(Return),
- B(LdaUndefined),
- /* 1112 S> */ B(Return),
]
constant pool: [
]
@@ -396,7 +390,7 @@ snippet: "
"
frame size: 0
parameter count: 3
-bytecode array length: 82
+bytecode array length: 83
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 21 S> */ B(Ldar), R(arg1),
@@ -430,12 +424,12 @@ bytecodes: [
/* 174 S> */ B(LdaSmi), I8(1),
/* 183 S> */ B(Return),
/* 188 S> */ B(Ldar), R(arg1),
- /* 194 E> */ B(TestIn), R(arg0),
+ /* 194 E> */ B(TestIn), R(arg0), U8(6),
B(JumpIfFalse), U8(5),
/* 202 S> */ B(LdaSmi), I8(1),
/* 211 S> */ B(Return),
/* 216 S> */ B(Ldar), R(arg1),
- /* 222 E> */ B(TestInstanceOf), R(arg0), U8(6),
+ /* 222 E> */ B(TestInstanceOf), R(arg0), U8(8),
B(JumpIfFalse), U8(5),
/* 238 S> */ B(LdaSmi), I8(1),
/* 247 S> */ B(Return),
@@ -461,7 +455,7 @@ snippet: "
"
frame size: 1
parameter count: 1
-bytecode array length: 14
+bytecode array length: 12
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 25 S> */ B(LdaZero),
@@ -471,8 +465,6 @@ bytecodes: [
/* 53 S> */ B(Return),
/* 69 S> */ B(LdaSmi), I8(-20),
/* 80 S> */ B(Return),
- B(LdaUndefined),
- /* 85 S> */ B(Return),
]
constant pool: [
]
@@ -494,7 +486,7 @@ snippet: "
"
frame size: 0
parameter count: 3
-bytecode array length: 36
+bytecode array length: 34
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 21 S> */ B(Ldar), R(arg1),
@@ -515,8 +507,6 @@ bytecodes: [
/* 102 S> */ B(Return),
/* 118 S> */ B(LdaSmi), I8(-1),
/* 128 S> */ B(Return),
- B(LdaUndefined),
- /* 133 S> */ B(Return),
]
constant pool: [
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden
index 62d07cef7e..e6bf0f717e 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden
@@ -9,16 +9,14 @@ wrap: yes
snippet: "
let x = 10; function f1() {return x;}
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 21
+bytecode array length: 15
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(10),
/* 42 E> */ B(StaCurrentContextSlot), U8(4),
@@ -27,7 +25,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
@@ -36,16 +33,14 @@ handlers: [
snippet: "
let x = 10; function f1() {return x;} return x;
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 22
+bytecode array length: 16
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(10),
/* 42 E> */ B(StaCurrentContextSlot), U8(4),
@@ -54,7 +49,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
@@ -63,22 +57,20 @@ handlers: [
snippet: "
let x = (x = 20); function f1() {return x;}
"
-frame size: 3
+frame size: 2
parameter count: 1
-bytecode array length: 31
+bytecode array length: 25
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(20),
- B(Star), R(2),
+ B(Star), R(1),
B(LdaCurrentContextSlot), U8(4),
- /* 45 E> */ B(ThrowReferenceErrorIfHole), U8(2),
- B(Ldar), R(2),
+ /* 45 E> */ B(ThrowReferenceErrorIfHole), U8(1),
+ B(Ldar), R(1),
B(StaCurrentContextSlot), U8(4),
/* 42 E> */ B(StaCurrentContextSlot), U8(4),
B(LdaUndefined),
@@ -86,7 +78,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"],
]
handlers: [
@@ -96,16 +87,14 @@ handlers: [
snippet: "
let x = 10; x = 20; function f1() {return x;}
"
-frame size: 2
+frame size: 1
parameter count: 1
-bytecode array length: 25
+bytecode array length: 19
bytecodes: [
B(CreateFunctionContext), U8(0), U8(1),
- B(PushContext), R(1),
+ B(PushContext), R(0),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(CreateClosure), U8(1), U8(0), U8(2),
- B(Star), R(0),
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(10),
/* 42 E> */ B(StaCurrentContextSlot), U8(4),
@@ -116,7 +105,6 @@ bytecodes: [
]
constant pool: [
SCOPE_INFO_TYPE,
- SHARED_FUNCTION_INFO_TYPE,
]
handlers: [
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden
index 629e4f36d1..55a56a88b3 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden
@@ -99,7 +99,7 @@ frame size: 6
parameter count: 2
bytecode array length: 92
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(3),
@@ -108,12 +108,12 @@ bytecodes: [
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
/* 0 E> */ B(StackCheck),
- /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(4),
+ /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
@@ -126,14 +126,14 @@ bytecodes: [
B(Star), R(5),
/* 32 E> */ B(CallUndefinedReceiver1), R(4), R(5), U8(0),
/* 47 S> */ B(LdaUndefined),
- B(Star), R(0),
+ B(Star), R(2),
/* 52 S> */ B(LdaModuleVariable), I8(-1), U8(0),
B(ThrowReferenceErrorIfHole), U8(4),
B(Star), R(4),
B(LdaSmi), I8(42),
B(Star), R(5),
/* 52 E> */ B(CallUndefinedReceiver1), R(4), R(5), U8(2),
- B(Star), R(2),
+ B(Star), R(1),
/* 65 S> */ B(Return),
]
constant pool: [
@@ -156,7 +156,7 @@ frame size: 6
parameter count: 2
bytecode array length: 90
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(3),
@@ -165,12 +165,12 @@ bytecodes: [
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
/* 0 E> */ B(StackCheck),
- /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(4),
+ /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
@@ -182,14 +182,14 @@ bytecodes: [
B(Inc), U8(0),
/* 24 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 34 S> */ B(LdaUndefined),
- B(Star), R(0),
+ B(Star), R(2),
/* 39 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(ToNumeric), U8(1),
B(Star), R(4),
B(Inc), U8(1),
/* 42 E> */ B(StaModuleVariable), I8(1), U8(0),
- B(Mov), R(4), R(2),
- B(Ldar), R(2),
+ B(Mov), R(4), R(1),
+ B(Ldar), R(1),
/* 50 S> */ B(Return),
]
constant pool: [
@@ -211,7 +211,7 @@ frame size: 6
parameter count: 2
bytecode array length: 96
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(3),
@@ -220,15 +220,15 @@ bytecodes: [
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
- B(Ldar), R(1),
- /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(4),
+ B(Ldar), R(0),
+ /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
@@ -240,14 +240,14 @@ bytecodes: [
B(Inc), U8(0),
/* 24 E> */ B(StaModuleVariable), I8(1), U8(0),
/* 34 S> */ B(LdaUndefined),
- B(Star), R(0),
+ B(Star), R(2),
/* 39 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(ToNumeric), U8(1),
B(Star), R(4),
B(Inc), U8(1),
/* 42 E> */ B(StaModuleVariable), I8(1), U8(0),
- B(Mov), R(4), R(2),
- B(Ldar), R(2),
+ B(Mov), R(4), R(1),
+ B(Ldar), R(1),
/* 50 S> */ B(Return),
]
constant pool: [
@@ -269,7 +269,7 @@ frame size: 6
parameter count: 2
bytecode array length: 100
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(LdaConstant), U8(1),
B(Star), R(4),
B(Mov), R(arg0), R(3),
@@ -278,15 +278,15 @@ bytecodes: [
B(Mov), R(closure), R(4),
B(Mov), R(this), R(5),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(4), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
B(LdaTheHole),
B(StaModuleVariable), I8(1), U8(0),
/* 0 E> */ B(StackCheck),
- B(Ldar), R(1),
- /* 0 E> */ B(SuspendGenerator), R(1), R(0), U8(4), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(4),
+ B(Ldar), R(0),
+ /* 0 E> */ B(SuspendGenerator), R(0), R(0), U8(4), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(4),
B(Star), R(4),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(4),
/* 0 E> */ B(Throw),
@@ -298,14 +298,14 @@ bytecodes: [
B(Inc), U8(0),
/* 26 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
/* 36 S> */ B(LdaUndefined),
- B(Star), R(0),
+ B(Star), R(2),
/* 41 S> */ B(LdaModuleVariable), I8(1), U8(0),
B(ToNumeric), U8(1),
B(Star), R(4),
B(Inc), U8(1),
/* 44 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0),
- B(Mov), R(4), R(2),
- B(Ldar), R(2),
+ B(Mov), R(4), R(1),
+ B(Ldar), R(1),
/* 52 S> */ B(Return),
]
constant pool: [
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden
index aa89a500db..18fd7989c5 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewAndSpread.golden
@@ -26,13 +26,13 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
/* 89 S> */ B(CreateArrayLiteral), U8(3), U8(1), U8(37),
B(Star), R(3),
- B(Ldar), R(1),
- /* 89 E> */ B(ConstructWithSpread), R(1), R(3), U8(1), U8(2),
+ B(Ldar), R(0),
+ /* 89 E> */ B(ConstructWithSpread), R(0), R(3), U8(1), U8(2),
B(LdaUndefined),
/* 110 S> */ B(Return),
]
@@ -66,15 +66,15 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
/* 89 S> */ B(LdaZero),
B(Star), R(3),
B(CreateArrayLiteral), U8(3), U8(1), U8(37),
B(Star), R(4),
- B(Ldar), R(1),
- /* 89 E> */ B(ConstructWithSpread), R(1), R(3), U8(2), U8(2),
+ B(Ldar), R(0),
+ /* 89 E> */ B(ConstructWithSpread), R(0), R(3), U8(2), U8(2),
B(LdaUndefined),
/* 113 S> */ B(Return),
]
@@ -108,9 +108,9 @@ bytecodes: [
B(Mov), R(3), R(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(3),
B(Star), R(4),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(1),
B(PopContext), R(2),
- B(Mov), R(0), R(1),
+ B(Mov), R(1), R(0),
/* 89 S> */ B(CreateArrayLiteral), U8(3), U8(1), U8(37),
B(Star), R(4),
B(LdaConstant), U8(4),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden
index 9070a36805..be6ef0138b 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden
@@ -240,9 +240,9 @@ handlers: [
snippet: "
var a = 1; return { 1: a };
"
-frame size: 6
+frame size: 5
parameter count: 1
-bytecode array length: 32
+bytecode array length: 29
bytecodes: [
/* 30 E> */ B(StackCheck),
/* 42 S> */ B(LdaSmi), I8(1),
@@ -251,11 +251,9 @@ bytecodes: [
B(Star), R(1),
B(LdaSmi), I8(1),
B(Star), R(3),
- B(LdaZero),
- B(Star), R(5),
B(Mov), R(1), R(2),
B(Mov), R(0), R(4),
- /* 57 E> */ B(CallRuntime), U16(Runtime::kSetKeyedProperty), R(2), U8(4),
+ /* 57 E> */ B(CallRuntime), U16(Runtime::kSetKeyedProperty), R(2), U8(3),
B(Ldar), R(2),
/* 61 S> */ B(Return),
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden
index 71a7119326..5afcdde7f6 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrivateClassFields.golden
@@ -47,12 +47,12 @@ bytecodes: [
B(Mov), R(5), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3),
B(Star), R(6),
- B(Mov), R(7), R(1),
+ B(Mov), R(7), R(3),
B(CreateClosure), U8(4), U8(1), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(5), U8(2),
B(PopContext), R(4),
- B(Mov), R(1), R(2),
+ B(Mov), R(3), R(0),
/* 38 E> */ B(CreateBlockContext), U8(6),
B(PushContext), R(4),
B(LdaTheHole),
@@ -72,16 +72,16 @@ bytecodes: [
B(Mov), R(5), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(3),
B(Star), R(6),
- B(Mov), R(7), R(0),
+ B(Mov), R(7), R(2),
B(CreateClosure), U8(9), U8(5), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(5), U8(6),
B(PopContext), R(4),
- B(Mov), R(0), R(3),
- /* 136 S> */ B(Ldar), R(1),
- /* 136 E> */ B(Construct), R(1), R(0), U8(0), U8(8),
- /* 145 S> */ B(Ldar), R(0),
- /* 145 E> */ B(Construct), R(0), R(0), U8(0), U8(10),
+ B(Mov), R(2), R(1),
+ /* 136 S> */ B(Ldar), R(3),
+ /* 136 E> */ B(Construct), R(3), R(0), U8(0), U8(8),
+ /* 145 S> */ B(Ldar), R(2),
+ /* 145 E> */ B(Construct), R(2), R(0), U8(0), U8(10),
B(LdaUndefined),
/* 154 S> */ B(Return),
]
@@ -167,12 +167,12 @@ bytecodes: [
B(Mov), R(13), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(3),
B(Star), R(8),
- B(Mov), R(9), R(2),
+ B(Mov), R(9), R(5),
B(CreateClosure), U8(6), U8(2), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(3),
B(PopContext), R(6),
- B(Mov), R(2), R(3),
+ B(Mov), R(5), R(0),
/* 38 E> */ B(CreateBlockContext), U8(8),
B(PushContext), R(6),
B(LdaTheHole),
@@ -212,12 +212,12 @@ bytecodes: [
B(Mov), R(13), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5),
B(Star), R(8),
- B(Mov), R(9), R(1),
+ B(Mov), R(9), R(4),
B(CreateClosure), U8(16), U8(9), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(10),
B(PopContext), R(6),
- B(Mov), R(1), R(4),
+ B(Mov), R(4), R(1),
/* 140 E> */ B(CreateBlockContext), U8(17),
B(PushContext), R(6),
B(LdaTheHole),
@@ -233,21 +233,21 @@ bytecodes: [
B(CallRuntime), U16(Runtime::kCreatePrivateNameSymbol), R(11), U8(1),
B(StaCurrentContextSlot), U8(4),
B(Mov), R(7), R(9),
- B(Mov), R(1), R(10),
+ B(Mov), R(4), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(3),
B(Star), R(8),
- B(Mov), R(9), R(0),
+ B(Mov), R(9), R(3),
B(CreateClosure), U8(20), U8(13), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(14),
B(PopContext), R(6),
- B(Mov), R(0), R(5),
- /* 430 S> */ B(Ldar), R(2),
- /* 430 E> */ B(Construct), R(2), R(0), U8(0), U8(16),
- /* 439 S> */ B(Ldar), R(1),
- /* 439 E> */ B(Construct), R(1), R(0), U8(0), U8(18),
- /* 448 S> */ B(Ldar), R(0),
- /* 448 E> */ B(Construct), R(0), R(0), U8(0), U8(20),
+ B(Mov), R(3), R(2),
+ /* 430 S> */ B(Ldar), R(5),
+ /* 430 E> */ B(Construct), R(5), R(0), U8(0), U8(16),
+ /* 439 S> */ B(Ldar), R(4),
+ /* 439 E> */ B(Construct), R(4), R(0), U8(0), U8(18),
+ /* 448 S> */ B(Ldar), R(3),
+ /* 448 E> */ B(Construct), R(3), R(0), U8(0), U8(20),
B(LdaUndefined),
/* 458 S> */ B(Return),
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden
index cb09c45b1a..23cce9fbab 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PublicClassFields.golden
@@ -43,12 +43,12 @@ bytecodes: [
B(Mov), R(5), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(4),
B(Star), R(6),
- B(Mov), R(7), R(1),
+ B(Mov), R(7), R(3),
B(CreateClosure), U8(4), U8(1), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(5), U8(2),
B(PopContext), R(4),
- B(Mov), R(1), R(2),
+ B(Mov), R(3), R(0),
/* 38 E> */ B(CreateBlockContext), U8(6),
B(PushContext), R(4),
B(LdaTheHole),
@@ -65,16 +65,16 @@ bytecodes: [
B(Mov), R(5), R(7),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(4),
B(Star), R(6),
- B(Mov), R(7), R(0),
+ B(Mov), R(7), R(2),
B(CreateClosure), U8(9), U8(5), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(5), U8(6),
B(PopContext), R(4),
- B(Mov), R(0), R(3),
- /* 120 S> */ B(Ldar), R(1),
- /* 120 E> */ B(Construct), R(1), R(0), U8(0), U8(8),
- /* 129 S> */ B(Ldar), R(0),
- /* 129 E> */ B(Construct), R(0), R(0), U8(0), U8(10),
+ B(Mov), R(2), R(1),
+ /* 120 S> */ B(Ldar), R(3),
+ /* 120 E> */ B(Construct), R(3), R(0), U8(0), U8(8),
+ /* 129 S> */ B(Ldar), R(2),
+ /* 129 E> */ B(Construct), R(2), R(0), U8(0), U8(10),
B(LdaUndefined),
/* 138 S> */ B(Return),
]
@@ -152,12 +152,12 @@ bytecodes: [
B(Mov), R(13), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(4),
B(Star), R(8),
- B(Mov), R(9), R(2),
+ B(Mov), R(9), R(5),
B(CreateClosure), U8(6), U8(2), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(3),
B(PopContext), R(6),
- B(Mov), R(2), R(3),
+ B(Mov), R(5), R(0),
/* 38 E> */ B(CreateBlockContext), U8(8),
B(PushContext), R(6),
B(LdaTheHole),
@@ -184,12 +184,12 @@ bytecodes: [
B(Mov), R(13), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5),
B(Star), R(8),
- B(Mov), R(9), R(1),
+ B(Mov), R(9), R(4),
B(CreateClosure), U8(14), U8(8), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(9),
B(PopContext), R(6),
- B(Mov), R(1), R(4),
+ B(Mov), R(4), R(1),
/* 90 E> */ B(CreateBlockContext), U8(15),
B(PushContext), R(6),
B(LdaTheHole),
@@ -202,21 +202,21 @@ bytecodes: [
B(StaCurrentContextSlot), U8(4),
B(Star), R(11),
B(Mov), R(7), R(9),
- B(Mov), R(1), R(10),
+ B(Mov), R(4), R(10),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(4),
B(Star), R(8),
- B(Mov), R(9), R(0),
+ B(Mov), R(9), R(3),
B(CreateClosure), U8(18), U8(12), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(7), U8(13),
B(PopContext), R(6),
- B(Mov), R(0), R(5),
- /* 329 S> */ B(Ldar), R(2),
- /* 329 E> */ B(Construct), R(2), R(0), U8(0), U8(15),
- /* 338 S> */ B(Ldar), R(1),
- /* 338 E> */ B(Construct), R(1), R(0), U8(0), U8(17),
- /* 347 S> */ B(Ldar), R(0),
- /* 347 E> */ B(Construct), R(0), R(0), U8(0), U8(19),
+ B(Mov), R(3), R(2),
+ /* 329 S> */ B(Ldar), R(5),
+ /* 329 E> */ B(Construct), R(5), R(0), U8(0), U8(15),
+ /* 338 S> */ B(Ldar), R(4),
+ /* 338 E> */ B(Construct), R(4), R(0), U8(0), U8(17),
+ /* 347 S> */ B(Ldar), R(3),
+ /* 347 E> */ B(Construct), R(3), R(0), U8(0), U8(19),
B(LdaUndefined),
/* 356 S> */ B(Return),
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden
index 34e5de5443..d72bb35fee 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden
@@ -19,15 +19,15 @@ bytecode array length: 26
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 30 S> */ B(LdaZero),
- B(Star), R(1),
+ B(Star), R(0),
/* 35 S> */ B(LdaSmi), I8(10),
- /* 35 E> */ B(TestLessThan), R(1), U8(0),
+ /* 35 E> */ B(TestLessThan), R(0), U8(0),
B(JumpIfFalse), U8(15),
/* 17 E> */ B(StackCheck),
- /* 56 S> */ B(Mov), R(1), R(0),
- /* 43 S> */ B(Ldar), R(0),
+ /* 56 S> */ B(Mov), R(0), R(1),
+ /* 43 S> */ B(Ldar), R(1),
B(Inc), U8(1),
- B(Star), R(1),
+ B(Star), R(0),
B(JumpLoop), U8(17), I8(0),
B(LdaUndefined),
/* 61 S> */ B(Return),
@@ -152,28 +152,28 @@ bytecode array length: 106
bytecodes: [
/* 10 E> */ B(StackCheck),
/* 30 S> */ B(LdaZero),
+ B(Star), R(3),
B(Star), R(0),
- B(Star), R(1),
B(LdaSmi), I8(1),
- B(Star), R(2),
+ B(Star), R(1),
/* 78 E> */ B(StackCheck),
B(CreateBlockContext), U8(0),
B(PushContext), R(4),
B(LdaTheHole),
B(StaCurrentContextSlot), U8(4),
- B(Ldar), R(1),
+ B(Ldar), R(0),
B(StaCurrentContextSlot), U8(4),
B(LdaSmi), I8(1),
- B(TestEqual), R(2), U8(0),
+ B(TestEqual), R(1), U8(0),
B(JumpIfFalse), U8(7),
B(LdaZero),
- B(Star), R(2),
+ B(Star), R(1),
B(Jump), U8(8),
/* 43 S> */ B(LdaCurrentContextSlot), U8(4),
B(Inc), U8(1),
/* 43 E> */ B(StaCurrentContextSlot), U8(4),
B(LdaSmi), I8(1),
- B(Star), R(3),
+ B(Star), R(2),
/* 35 S> */ B(LdaCurrentContextSlot), U8(4),
B(Star), R(5),
B(LdaSmi), I8(10),
@@ -183,19 +183,19 @@ bytecodes: [
B(PopContext), R(4),
B(Jump), U8(45),
B(LdaSmi), I8(1),
- B(TestEqual), R(3), U8(3),
+ B(TestEqual), R(2), U8(3),
B(JumpIfFalse), U8(22),
/* 17 E> */ B(StackCheck),
/* 48 S> */ B(CreateClosure), U8(1), U8(4), U8(2),
B(Star), R(5),
/* 74 E> */ B(CallUndefinedReceiver0), R(5), U8(5),
B(LdaZero),
- B(Star), R(3),
+ B(Star), R(2),
B(LdaCurrentContextSlot), U8(4),
- B(Star), R(1),
+ B(Star), R(0),
B(JumpLoop), U8(24), I8(1),
B(LdaSmi), I8(1),
- /* 78 E> */ B(TestEqual), R(3), U8(7),
+ /* 78 E> */ B(TestEqual), R(2), U8(7),
B(JumpIfFalse), U8(6),
B(PopContext), R(4),
B(Jump), U8(7),
@@ -229,19 +229,19 @@ bytecodes: [
/* 26 E> */ B(CallRuntime), U16(Runtime::kThrowPatternAssignmentNonCoercible), R(0), U8(0),
B(Star), R(3),
/* 28 S> */ B(LdaNamedProperty), R(3), U8(1), U8(1),
- B(Star), R(1),
+ B(Star), R(0),
/* 31 S> */ B(LdaNamedProperty), R(3), U8(2), U8(3),
- B(Star), R(2),
+ B(Star), R(1),
/* 55 S> */ B(LdaZero),
- /* 55 E> */ B(TestGreaterThan), R(2), U8(5),
+ /* 55 E> */ B(TestGreaterThan), R(1), U8(5),
B(JumpIfFalse), U8(19),
/* 17 E> */ B(StackCheck),
- /* 75 S> */ B(Ldar), R(2),
- /* 77 E> */ B(Add), R(1), U8(6),
- B(Star), R(0),
- /* 62 S> */ B(Ldar), R(2),
- B(Dec), U8(7),
+ /* 75 S> */ B(Ldar), R(1),
+ /* 77 E> */ B(Add), R(0), U8(6),
B(Star), R(2),
+ /* 62 S> */ B(Ldar), R(1),
+ B(Dec), U8(7),
+ B(Star), R(1),
B(JumpLoop), U8(20), I8(0),
B(LdaUndefined),
/* 84 S> */ B(Return),
@@ -265,16 +265,16 @@ frame size: 5
parameter count: 1
bytecode array length: 67
bytecodes: [
- B(SwitchOnGeneratorState), R(2), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(Mov), R(closure), R(3),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(3), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 11 E> */ B(StackCheck),
- /* 11 E> */ B(SuspendGenerator), R(2), R(0), U8(3), U8(0),
- B(ResumeGenerator), R(2), R(0), U8(3),
+ /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(3),
B(Star), R(3),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(2), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(1), U8(2), I8(0),
B(Ldar), R(3),
/* 11 E> */ B(Throw),
@@ -286,8 +286,8 @@ bytecodes: [
/* 36 E> */ B(TestLessThan), R(1), U8(0),
B(JumpIfFalse), U8(15),
/* 18 E> */ B(StackCheck),
- /* 57 S> */ B(Mov), R(1), R(0),
- /* 44 S> */ B(Ldar), R(0),
+ /* 57 S> */ B(Mov), R(1), R(2),
+ /* 44 S> */ B(Ldar), R(2),
B(Inc), U8(1),
B(Star), R(1),
B(JumpLoop), U8(17), I8(0),
@@ -313,43 +313,43 @@ frame size: 4
parameter count: 1
bytecode array length: 99
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(2),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(2),
B(Mov), R(closure), R(2),
B(Mov), R(this), R(3),
B(InvokeIntrinsic), U8(Runtime::k_CreateJSGeneratorObject), R(2), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
/* 11 E> */ B(StackCheck),
- /* 11 E> */ B(SuspendGenerator), R(1), R(0), U8(2), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(2),
+ /* 11 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(2),
B(Star), R(2),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(2), U8(2), I8(0),
B(Ldar), R(2),
/* 11 E> */ B(Throw),
B(Ldar), R(2),
/* 56 S> */ B(Return),
/* 31 S> */ B(LdaZero),
- B(Star), R(0),
+ B(Star), R(1),
/* 36 S> */ B(LdaSmi), I8(10),
- /* 36 E> */ B(TestLessThan), R(0), U8(0),
+ /* 36 E> */ B(TestLessThan), R(1), U8(0),
B(JumpIfFalse), U8(47),
/* 18 E> */ B(StackCheck),
/* 47 S> */ B(LdaFalse),
B(Star), R(3),
- B(Mov), R(0), R(2),
+ B(Mov), R(1), R(2),
B(InvokeIntrinsic), U8(Runtime::k_CreateIterResultObject), R(2), U8(2),
- /* 47 E> */ B(SuspendGenerator), R(1), R(0), U8(2), U8(1),
- B(ResumeGenerator), R(1), R(0), U8(2),
+ /* 47 E> */ B(SuspendGenerator), R(0), R(0), U8(2), U8(1),
+ B(ResumeGenerator), R(0), R(0), U8(2),
B(Star), R(2),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(SwitchOnSmiNoFeedback), U8(4), U8(2), I8(0),
B(Ldar), R(2),
/* 47 E> */ B(Throw),
B(Ldar), R(2),
/* 56 S> */ B(Return),
- /* 44 S> */ B(Ldar), R(0),
+ /* 44 S> */ B(Ldar), R(1),
B(Inc), U8(1),
- B(Star), R(0),
+ B(Star), R(1),
B(JumpLoop), U8(49), I8(0),
B(LdaUndefined),
/* 56 S> */ B(Return),
@@ -374,12 +374,12 @@ snippet: "
"
frame size: 8
parameter count: 1
-bytecode array length: 85
+bytecode array length: 81
bytecodes: [
B(Mov), R(closure), R(3),
B(Mov), R(this), R(4),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(3), U8(2),
- B(Star), R(2),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(3),
/* 36 S> */ B(LdaZero),
@@ -388,8 +388,8 @@ bytecodes: [
/* 41 E> */ B(TestLessThan), R(1), U8(0),
B(JumpIfFalse), U8(15),
/* 23 E> */ B(StackCheck),
- /* 62 S> */ B(Mov), R(1), R(0),
- /* 49 S> */ B(Ldar), R(0),
+ /* 62 S> */ B(Mov), R(1), R(2),
+ /* 49 S> */ B(Ldar), R(2),
B(Inc), U8(1),
B(Star), R(1),
B(JumpLoop), U8(17), I8(0),
@@ -397,10 +397,9 @@ bytecodes: [
B(Star), R(5),
B(LdaFalse),
B(Star), R(6),
- B(Mov), R(2), R(4),
+ B(Mov), R(0), R(4),
/* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(4), U8(3),
/* 67 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(4),
B(CreateCatchContext), R(4), U8(0),
B(Star), R(3),
@@ -412,17 +411,15 @@ bytecodes: [
B(Star), R(6),
B(LdaFalse),
B(Star), R(7),
- B(Mov), R(2), R(5),
+ B(Mov), R(0), R(5),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(5), U8(3),
/* 67 S> */ B(Return),
- B(LdaUndefined),
- /* 67 S> */ B(Return),
]
constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [16, 53, 55],
+ [16, 53, 53],
]
---
@@ -434,46 +431,45 @@ snippet: "
"
frame size: 7
parameter count: 1
-bytecode array length: 121
+bytecode array length: 117
bytecodes: [
- B(SwitchOnGeneratorState), R(1), U8(0), U8(1),
+ B(SwitchOnGeneratorState), R(0), U8(0), U8(1),
B(Mov), R(closure), R(2),
B(Mov), R(this), R(3),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionEnter), R(2), U8(2),
- B(Star), R(1),
+ B(Star), R(0),
/* 16 E> */ B(StackCheck),
B(Mov), R(context), R(2),
/* 36 S> */ B(LdaZero),
- B(Star), R(0),
+ B(Star), R(1),
/* 41 S> */ B(LdaSmi), I8(10),
- /* 41 E> */ B(TestLessThan), R(0), U8(0),
+ /* 41 E> */ B(TestLessThan), R(1), U8(0),
B(JumpIfFalse), U8(47),
/* 23 E> */ B(StackCheck),
- /* 52 S> */ B(Mov), R(1), R(3),
- B(Mov), R(0), R(4),
+ /* 52 S> */ B(Mov), R(0), R(3),
+ B(Mov), R(1), R(4),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionAwaitUncaught), R(3), U8(2),
- /* 52 E> */ B(SuspendGenerator), R(1), R(0), U8(3), U8(0),
- B(ResumeGenerator), R(1), R(0), U8(3),
+ /* 52 E> */ B(SuspendGenerator), R(0), R(0), U8(3), U8(0),
+ B(ResumeGenerator), R(0), R(0), U8(3),
B(Star), R(3),
- B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(1), U8(1),
+ B(InvokeIntrinsic), U8(Runtime::k_GeneratorGetResumeMode), R(0), U8(1),
B(Star), R(4),
B(LdaZero),
B(TestReferenceEqual), R(4),
B(JumpIfTrue), U8(5),
B(Ldar), R(3),
B(ReThrow),
- /* 49 S> */ B(Ldar), R(0),
+ /* 49 S> */ B(Ldar), R(1),
B(Inc), U8(1),
- B(Star), R(0),
+ B(Star), R(1),
B(JumpLoop), U8(49), I8(0),
B(LdaUndefined),
B(Star), R(4),
B(LdaTrue),
B(Star), R(5),
- B(Mov), R(1), R(3),
+ B(Mov), R(0), R(3),
/* 49 E> */ B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionResolve), R(3), U8(3),
/* 61 S> */ B(Return),
- B(Jump), U8(30),
B(Star), R(3),
B(CreateCatchContext), R(3), U8(1),
B(Star), R(2),
@@ -485,17 +481,15 @@ bytecodes: [
B(Star), R(5),
B(LdaTrue),
B(Star), R(6),
- B(Mov), R(1), R(4),
+ B(Mov), R(0), R(4),
B(InvokeIntrinsic), U8(Runtime::k_AsyncFunctionReject), R(4), U8(3),
/* 61 S> */ B(Return),
- B(LdaUndefined),
- /* 61 S> */ B(Return),
]
constant pool: [
Smi [46],
SCOPE_INFO_TYPE,
]
handlers: [
- [20, 89, 91],
+ [20, 89, 89],
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden
index da5c922456..93ba673a0e 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StaticClassFields.golden
@@ -58,15 +58,15 @@ bytecodes: [
B(StaCurrentContextSlot), U8(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(5),
B(Star), R(6),
- B(Mov), R(5), R(1),
+ B(Mov), R(5), R(3),
B(CreateClosure), U8(6), U8(2), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(7), U8(3),
B(CreateClosure), U8(8), U8(5), U8(2),
B(Star), R(9),
- B(CallProperty0), R(9), R(1), U8(6),
+ B(CallProperty0), R(9), R(3), U8(6),
B(PopContext), R(4),
- B(Mov), R(1), R(2),
+ B(Mov), R(3), R(0),
/* 38 E> */ B(CreateBlockContext), U8(9),
B(PushContext), R(4),
B(LdaTheHole),
@@ -93,19 +93,19 @@ bytecodes: [
B(StaCurrentContextSlot), U8(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(6), U8(5),
B(Star), R(6),
- B(Mov), R(5), R(0),
+ B(Mov), R(5), R(2),
B(CreateClosure), U8(12), U8(9), U8(2),
B(Star), R(7),
B(StaNamedProperty), R(5), U8(7), U8(10),
B(CreateClosure), U8(13), U8(12), U8(2),
B(Star), R(9),
- B(CallProperty0), R(9), R(0), U8(13),
+ B(CallProperty0), R(9), R(2), U8(13),
B(PopContext), R(4),
- B(Mov), R(0), R(3),
- /* 197 S> */ B(Ldar), R(2),
- /* 197 E> */ B(Construct), R(2), R(0), U8(0), U8(15),
- /* 206 S> */ B(Ldar), R(0),
- /* 206 E> */ B(Construct), R(0), R(0), U8(0), U8(17),
+ B(Mov), R(2), R(1),
+ /* 197 S> */ B(Ldar), R(0),
+ /* 197 E> */ B(Construct), R(0), R(0), U8(0), U8(15),
+ /* 206 S> */ B(Ldar), R(2),
+ /* 206 E> */ B(Construct), R(2), R(0), U8(0), U8(17),
B(LdaUndefined),
/* 215 S> */ B(Return),
]
@@ -203,15 +203,15 @@ bytecodes: [
B(StaCurrentContextSlot), U8(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5),
B(Star), R(8),
- B(Mov), R(7), R(2),
+ B(Mov), R(7), R(5),
B(CreateClosure), U8(8), U8(3), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(9), U8(4),
B(CreateClosure), U8(10), U8(6), U8(2),
B(Star), R(11),
- B(CallProperty0), R(11), R(2), U8(7),
+ B(CallProperty0), R(11), R(5), U8(7),
B(PopContext), R(6),
- B(Mov), R(2), R(3),
+ B(Mov), R(5), R(0),
/* 38 E> */ B(CreateBlockContext), U8(11),
B(PushContext), R(6),
B(LdaTheHole),
@@ -248,15 +248,15 @@ bytecodes: [
B(Star), R(13),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(6),
B(Star), R(8),
- B(Mov), R(7), R(1),
+ B(Mov), R(7), R(4),
B(CreateClosure), U8(17), U8(12), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(9), U8(13),
B(CreateClosure), U8(18), U8(15), U8(2),
B(Star), R(11),
- B(CallProperty0), R(11), R(1), U8(16),
+ B(CallProperty0), R(11), R(4), U8(16),
B(PopContext), R(6),
- B(Mov), R(1), R(4),
+ B(Mov), R(4), R(1),
/* 122 E> */ B(CreateBlockContext), U8(19),
B(PushContext), R(6),
B(LdaTheHole),
@@ -274,7 +274,7 @@ bytecodes: [
B(Star), R(12),
B(LdaConstant), U8(7),
B(TestEqualStrict), R(12), U8(2),
- B(Mov), R(1), R(10),
+ B(Mov), R(4), R(10),
B(Mov), R(7), R(9),
B(JumpIfFalse), U8(7),
B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0),
@@ -282,23 +282,23 @@ bytecodes: [
B(StaCurrentContextSlot), U8(5),
B(CallRuntime), U16(Runtime::kDefineClass), R(8), U8(5),
B(Star), R(8),
- B(Mov), R(7), R(0),
+ B(Mov), R(7), R(3),
B(CreateClosure), U8(22), U8(19), U8(2),
B(Star), R(9),
B(StaNamedProperty), R(7), U8(9), U8(20),
B(CreateClosure), U8(23), U8(22), U8(2),
B(Star), R(11),
- B(Ldar), R(0),
+ B(Ldar), R(3),
B(StaNamedProperty), R(11), U8(24), U8(23),
- B(CallProperty0), R(11), R(0), U8(25),
+ B(CallProperty0), R(11), R(3), U8(25),
B(PopContext), R(6),
- B(Mov), R(0), R(5),
- /* 456 S> */ B(Ldar), R(3),
- /* 456 E> */ B(Construct), R(3), R(0), U8(0), U8(27),
- /* 465 S> */ B(Ldar), R(4),
- /* 465 E> */ B(Construct), R(4), R(0), U8(0), U8(29),
- /* 474 S> */ B(Ldar), R(0),
- /* 474 E> */ B(Construct), R(0), R(0), U8(0), U8(31),
+ B(Mov), R(3), R(2),
+ /* 456 S> */ B(Ldar), R(0),
+ /* 456 E> */ B(Construct), R(0), R(0), U8(0), U8(27),
+ /* 465 S> */ B(Ldar), R(1),
+ /* 465 E> */ B(Construct), R(1), R(0), U8(0), U8(29),
+ /* 474 S> */ B(Ldar), R(3),
+ /* 474 E> */ B(Construct), R(3), R(0), U8(0), U8(31),
B(LdaUndefined),
/* 483 S> */ B(Return),
]
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden
index a84807e5fc..74849d1c85 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/SuperCallAndSpread.golden
@@ -57,7 +57,7 @@ bytecodes: [
B(Star), R(3),
B(Mov), R(closure), R(1),
/* 128 E> */ B(StackCheck),
- /* 136 S> */ B(Mov), R(3), R(2),
+ B(Mov), R(3), R(2),
/* 140 S> */ B(Ldar), R(closure),
B(GetSuperConstructor), R(5),
B(LdaSmi), I8(1),
@@ -99,7 +99,7 @@ bytecodes: [
B(Star), R(3),
B(Mov), R(closure), R(1),
/* 128 E> */ B(StackCheck),
- /* 136 S> */ B(Mov), R(3), R(2),
+ B(Mov), R(3), R(2),
/* 140 S> */ B(Ldar), R(closure),
B(GetSuperConstructor), R(5),
B(CreateEmptyArrayLiteral), U8(0),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden
index b078ef048a..ec70270dae 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden
@@ -11,13 +11,12 @@ snippet: "
"
frame size: 2
parameter count: 1
-bytecode array length: 27
+bytecode array length: 23
bytecodes: [
/* 30 E> */ B(StackCheck),
B(Mov), R(context), R(0),
/* 40 S> */ B(LdaSmi), I8(1),
/* 49 S> */ B(Return),
- B(Jump), U8(18),
B(Star), R(1),
B(CreateCatchContext), R(1), U8(0),
B(Star), R(0),
@@ -27,14 +26,12 @@ bytecodes: [
B(PushContext), R(1),
/* 63 S> */ B(LdaSmi), I8(2),
/* 72 S> */ B(Return),
- B(LdaUndefined),
- /* 75 S> */ B(Return),
]
constant pool: [
SCOPE_INFO_TYPE,
]
handlers: [
- [4, 7, 9],
+ [4, 7, 7],
]
---
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden
index 6d7309b732..19a09ba49c 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden
@@ -7,174 +7,488 @@ wrap: yes
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
x0 = x127;
return x0;
"
frame size: 157
parameter count: 1
-bytecode array length: 10
+bytecode array length: 547
bytecodes: [
/* 30 E> */ B(StackCheck),
- /* 1494 S> */ B(Wide), B(Mov), R16(127), R16(0),
- /* 1505 S> */ B(Ldar), R(0),
- /* 1515 S> */ B(Return),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
+ /* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2122 S> */ B(Wide), B(Mov), R16(127), R16(0),
+ /* 2133 S> */ B(Ldar), R(0),
+ /* 2143 S> */ B(Return),
]
constant pool: [
]
@@ -183,174 +497,488 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
x127 = x126;
return x127;
"
frame size: 157
parameter count: 1
-bytecode array length: 12
+bytecode array length: 549
bytecodes: [
/* 30 E> */ B(StackCheck),
- /* 1494 S> */ B(Wide), B(Mov), R16(126), R16(127),
- /* 1507 S> */ B(Wide), B(Ldar), R16(127),
- /* 1519 S> */ B(Return),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
+ /* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2122 S> */ B(Wide), B(Mov), R16(126), R16(127),
+ /* 2135 S> */ B(Wide), B(Ldar), R16(127),
+ /* 2147 S> */ B(Return),
]
constant pool: [
]
@@ -359,178 +987,492 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
if (x2 > 3) { return x129; }
return x128;
"
frame size: 157
parameter count: 1
-bytecode array length: 18
+bytecode array length: 555
bytecodes: [
/* 30 E> */ B(StackCheck),
- /* 1494 S> */ B(LdaSmi), I8(3),
- /* 1501 E> */ B(TestGreaterThan), R(2), U8(0),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
+ /* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2122 S> */ B(LdaSmi), I8(3),
+ /* 2129 E> */ B(TestGreaterThan), R(2), U8(0),
B(JumpIfFalse), U8(7),
- /* 1508 S> */ B(Wide), B(Ldar), R16(129),
- /* 1520 S> */ B(Return),
- /* 1523 S> */ B(Wide), B(Ldar), R16(128),
- /* 1535 S> */ B(Return),
+ /* 2136 S> */ B(Wide), B(Ldar), R16(129),
+ /* 2148 S> */ B(Return),
+ /* 2151 S> */ B(Wide), B(Ldar), R16(128),
+ /* 2163 S> */ B(Return),
]
constant pool: [
]
@@ -539,163 +1481,163 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
var x0 = 0;
if (x129 == 3) { var x129 = x0; }
if (x2 > 3) { return x0; }
@@ -703,23 +1645,337 @@ snippet: "
"
frame size: 157
parameter count: 1
-bytecode array length: 39
+bytecode array length: 576
bytecodes: [
/* 30 E> */ B(StackCheck),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
/* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2131 S> */ B(LdaZero),
B(Star), R(0),
- /* 1506 S> */ B(LdaSmi), I8(3),
- /* 1515 E> */ B(Wide), B(TestEqual), R16(129), U16(0),
+ /* 2134 S> */ B(LdaSmi), I8(3),
+ /* 2143 E> */ B(Wide), B(TestEqual), R16(129), U16(0),
B(JumpIfFalse), U8(12),
- /* 1534 S> */ B(Wide), B(Mov), R16(0), R16(129),
+ /* 2162 S> */ B(Wide), B(Mov), R16(0), R16(129),
B(Wide), B(Ldar), R16(129),
- /* 1540 S> */ B(LdaSmi), I8(3),
- /* 1547 E> */ B(TestGreaterThan), R(2), U8(1),
+ /* 2168 S> */ B(LdaSmi), I8(3),
+ /* 2175 E> */ B(TestGreaterThan), R(2), U8(1),
B(JumpIfFalse), U8(5),
- /* 1554 S> */ B(Ldar), R(0),
- /* 1564 S> */ B(Return),
- /* 1567 S> */ B(Wide), B(Ldar), R16(129),
- /* 1579 S> */ B(Return),
+ /* 2182 S> */ B(Ldar), R(0),
+ /* 2192 S> */ B(Return),
+ /* 2195 S> */ B(Wide), B(Ldar), R16(129),
+ /* 2207 S> */ B(Return),
]
constant pool: [
]
@@ -728,192 +1984,506 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
var x0 = 0;
var x1 = 0;
for (x128 = 0; x128 < 64; x128++) { x1 += x128;}return x128;
"
frame size: 158
parameter count: 1
-bytecode array length: 56
+bytecode array length: 593
bytecodes: [
/* 30 E> */ B(StackCheck),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
/* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2131 S> */ B(LdaZero),
B(Star), R(0),
- /* 1515 S> */ B(LdaZero),
+ /* 2143 S> */ B(LdaZero),
B(Star), R(1),
- /* 1523 S> */ B(LdaZero),
+ /* 2151 S> */ B(LdaZero),
B(Wide), B(Star), R16(128),
- /* 1538 S> */ B(LdaSmi), I8(64),
- /* 1538 E> */ B(Wide), B(TestLessThan), R16(128), U16(0),
+ /* 2166 S> */ B(LdaSmi), I8(64),
+ /* 2166 E> */ B(Wide), B(TestLessThan), R16(128), U16(0),
B(JumpIfFalse), U8(31),
- /* 1518 E> */ B(StackCheck),
- /* 1555 S> */ B(Wide), B(Ldar), R16(128),
- /* 1561 E> */ B(Add), R(1), U8(1),
+ /* 2146 E> */ B(StackCheck),
+ /* 2183 S> */ B(Wide), B(Ldar), R16(128),
+ /* 2189 E> */ B(Add), R(1), U8(1),
B(Wide), B(Mov), R16(1), R16(157),
B(Star), R(1),
- /* 1548 S> */ B(Wide), B(Ldar), R16(128),
+ /* 2176 S> */ B(Wide), B(Ldar), R16(128),
B(Inc), U8(2),
B(Wide), B(Star), R16(128),
B(JumpLoop), U8(36), I8(0),
- /* 1567 S> */ B(Wide), B(Ldar), R16(128),
- /* 1579 S> */ B(Return),
+ /* 2195 S> */ B(Wide), B(Ldar), R16(128),
+ /* 2207 S> */ B(Return),
]
constant pool: [
]
@@ -922,177 +2492,491 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
var x0 = 1234;
var x1 = 0;
for (x128 in x0) { x1 += x128;}return x1;
"
frame size: 163
parameter count: 1
-bytecode array length: 89
+bytecode array length: 626
bytecodes: [
/* 30 E> */ B(StackCheck),
- /* 1503 S> */ B(Wide), B(LdaSmi), I16(1234),
+ /* 43 S> */ B(LdaZero),
B(Star), R(0),
- /* 1518 S> */ B(LdaZero),
+ /* 55 S> */ B(LdaZero),
B(Star), R(1),
- /* 1534 S> */ B(Ldar), R(0),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
+ /* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2131 S> */ B(Wide), B(LdaSmi), I16(1234),
+ B(Star), R(0),
+ /* 2146 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 2162 S> */ B(Ldar), R(0),
B(JumpIfUndefined), U8(74),
B(JumpIfNull), U8(72),
B(Wide), B(ToObject), R16(157),
@@ -1100,21 +2984,21 @@ bytecodes: [
B(Wide), B(ForInPrepare), R16(158), U16(0),
B(LdaZero),
B(Wide), B(Star), R16(161),
- /* 1526 S> */ B(Wide), B(ForInContinue), R16(161), R16(160),
+ /* 2154 S> */ B(Wide), B(ForInContinue), R16(161), R16(160),
B(JumpIfFalse), U8(45),
B(Wide), B(ForInNext), R16(157), R16(161), R16(158), U16(0),
B(JumpIfUndefined), U8(22),
B(Wide), B(Star), R16(128),
- /* 1521 E> */ B(StackCheck),
- /* 1541 S> */ B(Wide), B(Ldar), R16(128),
- /* 1547 E> */ B(Add), R(1), U8(1),
+ /* 2149 E> */ B(StackCheck),
+ /* 2169 S> */ B(Wide), B(Ldar), R16(128),
+ /* 2175 E> */ B(Add), R(1), U8(1),
B(Wide), B(Mov), R16(1), R16(162),
B(Star), R(1),
- /* 1544 E> */ B(Wide), B(ForInStep), R16(161),
+ /* 2172 E> */ B(Wide), B(ForInStep), R16(161),
B(Wide), B(Star), R16(161),
B(JumpLoop), U8(48), I8(0),
- /* 1553 S> */ B(Ldar), R(1),
- /* 1563 S> */ B(Return),
+ /* 2181 S> */ B(Ldar), R(1),
+ /* 2191 S> */ B(Return),
]
constant pool: [
]
@@ -1123,163 +3007,163 @@ handlers: [
---
snippet: "
- var x0;
- var x1;
- var x2;
- var x3;
- var x4;
- var x5;
- var x6;
- var x7;
- var x8;
- var x9;
- var x10;
- var x11;
- var x12;
- var x13;
- var x14;
- var x15;
- var x16;
- var x17;
- var x18;
- var x19;
- var x20;
- var x21;
- var x22;
- var x23;
- var x24;
- var x25;
- var x26;
- var x27;
- var x28;
- var x29;
- var x30;
- var x31;
- var x32;
- var x33;
- var x34;
- var x35;
- var x36;
- var x37;
- var x38;
- var x39;
- var x40;
- var x41;
- var x42;
- var x43;
- var x44;
- var x45;
- var x46;
- var x47;
- var x48;
- var x49;
- var x50;
- var x51;
- var x52;
- var x53;
- var x54;
- var x55;
- var x56;
- var x57;
- var x58;
- var x59;
- var x60;
- var x61;
- var x62;
- var x63;
- var x64;
- var x65;
- var x66;
- var x67;
- var x68;
- var x69;
- var x70;
- var x71;
- var x72;
- var x73;
- var x74;
- var x75;
- var x76;
- var x77;
- var x78;
- var x79;
- var x80;
- var x81;
- var x82;
- var x83;
- var x84;
- var x85;
- var x86;
- var x87;
- var x88;
- var x89;
- var x90;
- var x91;
- var x92;
- var x93;
- var x94;
- var x95;
- var x96;
- var x97;
- var x98;
- var x99;
- var x100;
- var x101;
- var x102;
- var x103;
- var x104;
- var x105;
- var x106;
- var x107;
- var x108;
- var x109;
- var x110;
- var x111;
- var x112;
- var x113;
- var x114;
- var x115;
- var x116;
- var x117;
- var x118;
- var x119;
- var x120;
- var x121;
- var x122;
- var x123;
- var x124;
- var x125;
- var x126;
- var x127;
- var x128;
- var x129;
- var x130;
- var x131;
- var x132;
- var x133;
- var x134;
- var x135;
- var x136;
- var x137;
- var x138;
- var x139;
- var x140;
- var x141;
- var x142;
- var x143;
- var x144;
- var x145;
- var x146;
- var x147;
- var x148;
- var x149;
- var x150;
- var x151;
- var x152;
- var x153;
- var x154;
- var x155;
- var x156;
+ var x0 = 0;
+ var x1 = 0;
+ var x2 = 0;
+ var x3 = 0;
+ var x4 = 0;
+ var x5 = 0;
+ var x6 = 0;
+ var x7 = 0;
+ var x8 = 0;
+ var x9 = 0;
+ var x10 = 0;
+ var x11 = 0;
+ var x12 = 0;
+ var x13 = 0;
+ var x14 = 0;
+ var x15 = 0;
+ var x16 = 0;
+ var x17 = 0;
+ var x18 = 0;
+ var x19 = 0;
+ var x20 = 0;
+ var x21 = 0;
+ var x22 = 0;
+ var x23 = 0;
+ var x24 = 0;
+ var x25 = 0;
+ var x26 = 0;
+ var x27 = 0;
+ var x28 = 0;
+ var x29 = 0;
+ var x30 = 0;
+ var x31 = 0;
+ var x32 = 0;
+ var x33 = 0;
+ var x34 = 0;
+ var x35 = 0;
+ var x36 = 0;
+ var x37 = 0;
+ var x38 = 0;
+ var x39 = 0;
+ var x40 = 0;
+ var x41 = 0;
+ var x42 = 0;
+ var x43 = 0;
+ var x44 = 0;
+ var x45 = 0;
+ var x46 = 0;
+ var x47 = 0;
+ var x48 = 0;
+ var x49 = 0;
+ var x50 = 0;
+ var x51 = 0;
+ var x52 = 0;
+ var x53 = 0;
+ var x54 = 0;
+ var x55 = 0;
+ var x56 = 0;
+ var x57 = 0;
+ var x58 = 0;
+ var x59 = 0;
+ var x60 = 0;
+ var x61 = 0;
+ var x62 = 0;
+ var x63 = 0;
+ var x64 = 0;
+ var x65 = 0;
+ var x66 = 0;
+ var x67 = 0;
+ var x68 = 0;
+ var x69 = 0;
+ var x70 = 0;
+ var x71 = 0;
+ var x72 = 0;
+ var x73 = 0;
+ var x74 = 0;
+ var x75 = 0;
+ var x76 = 0;
+ var x77 = 0;
+ var x78 = 0;
+ var x79 = 0;
+ var x80 = 0;
+ var x81 = 0;
+ var x82 = 0;
+ var x83 = 0;
+ var x84 = 0;
+ var x85 = 0;
+ var x86 = 0;
+ var x87 = 0;
+ var x88 = 0;
+ var x89 = 0;
+ var x90 = 0;
+ var x91 = 0;
+ var x92 = 0;
+ var x93 = 0;
+ var x94 = 0;
+ var x95 = 0;
+ var x96 = 0;
+ var x97 = 0;
+ var x98 = 0;
+ var x99 = 0;
+ var x100 = 0;
+ var x101 = 0;
+ var x102 = 0;
+ var x103 = 0;
+ var x104 = 0;
+ var x105 = 0;
+ var x106 = 0;
+ var x107 = 0;
+ var x108 = 0;
+ var x109 = 0;
+ var x110 = 0;
+ var x111 = 0;
+ var x112 = 0;
+ var x113 = 0;
+ var x114 = 0;
+ var x115 = 0;
+ var x116 = 0;
+ var x117 = 0;
+ var x118 = 0;
+ var x119 = 0;
+ var x120 = 0;
+ var x121 = 0;
+ var x122 = 0;
+ var x123 = 0;
+ var x124 = 0;
+ var x125 = 0;
+ var x126 = 0;
+ var x127 = 0;
+ var x128 = 0;
+ var x129 = 0;
+ var x130 = 0;
+ var x131 = 0;
+ var x132 = 0;
+ var x133 = 0;
+ var x134 = 0;
+ var x135 = 0;
+ var x136 = 0;
+ var x137 = 0;
+ var x138 = 0;
+ var x139 = 0;
+ var x140 = 0;
+ var x141 = 0;
+ var x142 = 0;
+ var x143 = 0;
+ var x144 = 0;
+ var x145 = 0;
+ var x146 = 0;
+ var x147 = 0;
+ var x148 = 0;
+ var x149 = 0;
+ var x150 = 0;
+ var x151 = 0;
+ var x152 = 0;
+ var x153 = 0;
+ var x154 = 0;
+ var x155 = 0;
+ var x156 = 0;
x0 = %Add(x64, x63);
x1 = %Add(x27, x143);
%TheHole();
@@ -1287,20 +3171,334 @@ snippet: "
"
frame size: 159
parameter count: 1
-bytecode array length: 53
+bytecode array length: 590
bytecodes: [
/* 30 E> */ B(StackCheck),
- /* 1494 S> */ B(Wide), B(Mov), R16(64), R16(157),
+ /* 43 S> */ B(LdaZero),
+ B(Star), R(0),
+ /* 55 S> */ B(LdaZero),
+ B(Star), R(1),
+ /* 67 S> */ B(LdaZero),
+ B(Star), R(2),
+ /* 79 S> */ B(LdaZero),
+ B(Star), R(3),
+ /* 91 S> */ B(LdaZero),
+ B(Star), R(4),
+ /* 103 S> */ B(LdaZero),
+ B(Star), R(5),
+ /* 115 S> */ B(LdaZero),
+ B(Star), R(6),
+ /* 127 S> */ B(LdaZero),
+ B(Star), R(7),
+ /* 139 S> */ B(LdaZero),
+ B(Star), R(8),
+ /* 151 S> */ B(LdaZero),
+ B(Star), R(9),
+ /* 164 S> */ B(LdaZero),
+ B(Star), R(10),
+ /* 177 S> */ B(LdaZero),
+ B(Star), R(11),
+ /* 190 S> */ B(LdaZero),
+ B(Star), R(12),
+ /* 203 S> */ B(LdaZero),
+ B(Star), R(13),
+ /* 216 S> */ B(LdaZero),
+ B(Star), R(14),
+ /* 229 S> */ B(LdaZero),
+ B(Star), R(15),
+ /* 242 S> */ B(LdaZero),
+ B(Star), R(16),
+ /* 255 S> */ B(LdaZero),
+ B(Star), R(17),
+ /* 268 S> */ B(LdaZero),
+ B(Star), R(18),
+ /* 281 S> */ B(LdaZero),
+ B(Star), R(19),
+ /* 294 S> */ B(LdaZero),
+ B(Star), R(20),
+ /* 307 S> */ B(LdaZero),
+ B(Star), R(21),
+ /* 320 S> */ B(LdaZero),
+ B(Star), R(22),
+ /* 333 S> */ B(LdaZero),
+ B(Star), R(23),
+ /* 346 S> */ B(LdaZero),
+ B(Star), R(24),
+ /* 359 S> */ B(LdaZero),
+ B(Star), R(25),
+ /* 372 S> */ B(LdaZero),
+ B(Star), R(26),
+ /* 385 S> */ B(LdaZero),
+ B(Star), R(27),
+ /* 398 S> */ B(LdaZero),
+ B(Star), R(28),
+ /* 411 S> */ B(LdaZero),
+ B(Star), R(29),
+ /* 424 S> */ B(LdaZero),
+ B(Star), R(30),
+ /* 437 S> */ B(LdaZero),
+ B(Star), R(31),
+ /* 450 S> */ B(LdaZero),
+ B(Star), R(32),
+ /* 463 S> */ B(LdaZero),
+ B(Star), R(33),
+ /* 476 S> */ B(LdaZero),
+ B(Star), R(34),
+ /* 489 S> */ B(LdaZero),
+ B(Star), R(35),
+ /* 502 S> */ B(LdaZero),
+ B(Star), R(36),
+ /* 515 S> */ B(LdaZero),
+ B(Star), R(37),
+ /* 528 S> */ B(LdaZero),
+ B(Star), R(38),
+ /* 541 S> */ B(LdaZero),
+ B(Star), R(39),
+ /* 554 S> */ B(LdaZero),
+ B(Star), R(40),
+ /* 567 S> */ B(LdaZero),
+ B(Star), R(41),
+ /* 580 S> */ B(LdaZero),
+ B(Star), R(42),
+ /* 593 S> */ B(LdaZero),
+ B(Star), R(43),
+ /* 606 S> */ B(LdaZero),
+ B(Star), R(44),
+ /* 619 S> */ B(LdaZero),
+ B(Star), R(45),
+ /* 632 S> */ B(LdaZero),
+ B(Star), R(46),
+ /* 645 S> */ B(LdaZero),
+ B(Star), R(47),
+ /* 658 S> */ B(LdaZero),
+ B(Star), R(48),
+ /* 671 S> */ B(LdaZero),
+ B(Star), R(49),
+ /* 684 S> */ B(LdaZero),
+ B(Star), R(50),
+ /* 697 S> */ B(LdaZero),
+ B(Star), R(51),
+ /* 710 S> */ B(LdaZero),
+ B(Star), R(52),
+ /* 723 S> */ B(LdaZero),
+ B(Star), R(53),
+ /* 736 S> */ B(LdaZero),
+ B(Star), R(54),
+ /* 749 S> */ B(LdaZero),
+ B(Star), R(55),
+ /* 762 S> */ B(LdaZero),
+ B(Star), R(56),
+ /* 775 S> */ B(LdaZero),
+ B(Star), R(57),
+ /* 788 S> */ B(LdaZero),
+ B(Star), R(58),
+ /* 801 S> */ B(LdaZero),
+ B(Star), R(59),
+ /* 814 S> */ B(LdaZero),
+ B(Star), R(60),
+ /* 827 S> */ B(LdaZero),
+ B(Star), R(61),
+ /* 840 S> */ B(LdaZero),
+ B(Star), R(62),
+ /* 853 S> */ B(LdaZero),
+ B(Star), R(63),
+ /* 866 S> */ B(LdaZero),
+ B(Star), R(64),
+ /* 879 S> */ B(LdaZero),
+ B(Star), R(65),
+ /* 892 S> */ B(LdaZero),
+ B(Star), R(66),
+ /* 905 S> */ B(LdaZero),
+ B(Star), R(67),
+ /* 918 S> */ B(LdaZero),
+ B(Star), R(68),
+ /* 931 S> */ B(LdaZero),
+ B(Star), R(69),
+ /* 944 S> */ B(LdaZero),
+ B(Star), R(70),
+ /* 957 S> */ B(LdaZero),
+ B(Star), R(71),
+ /* 970 S> */ B(LdaZero),
+ B(Star), R(72),
+ /* 983 S> */ B(LdaZero),
+ B(Star), R(73),
+ /* 996 S> */ B(LdaZero),
+ B(Star), R(74),
+ /* 1009 S> */ B(LdaZero),
+ B(Star), R(75),
+ /* 1022 S> */ B(LdaZero),
+ B(Star), R(76),
+ /* 1035 S> */ B(LdaZero),
+ B(Star), R(77),
+ /* 1048 S> */ B(LdaZero),
+ B(Star), R(78),
+ /* 1061 S> */ B(LdaZero),
+ B(Star), R(79),
+ /* 1074 S> */ B(LdaZero),
+ B(Star), R(80),
+ /* 1087 S> */ B(LdaZero),
+ B(Star), R(81),
+ /* 1100 S> */ B(LdaZero),
+ B(Star), R(82),
+ /* 1113 S> */ B(LdaZero),
+ B(Star), R(83),
+ /* 1126 S> */ B(LdaZero),
+ B(Star), R(84),
+ /* 1139 S> */ B(LdaZero),
+ B(Star), R(85),
+ /* 1152 S> */ B(LdaZero),
+ B(Star), R(86),
+ /* 1165 S> */ B(LdaZero),
+ B(Star), R(87),
+ /* 1178 S> */ B(LdaZero),
+ B(Star), R(88),
+ /* 1191 S> */ B(LdaZero),
+ B(Star), R(89),
+ /* 1204 S> */ B(LdaZero),
+ B(Star), R(90),
+ /* 1217 S> */ B(LdaZero),
+ B(Star), R(91),
+ /* 1230 S> */ B(LdaZero),
+ B(Star), R(92),
+ /* 1243 S> */ B(LdaZero),
+ B(Star), R(93),
+ /* 1256 S> */ B(LdaZero),
+ B(Star), R(94),
+ /* 1269 S> */ B(LdaZero),
+ B(Star), R(95),
+ /* 1282 S> */ B(LdaZero),
+ B(Star), R(96),
+ /* 1295 S> */ B(LdaZero),
+ B(Star), R(97),
+ /* 1308 S> */ B(LdaZero),
+ B(Star), R(98),
+ /* 1321 S> */ B(LdaZero),
+ B(Star), R(99),
+ /* 1335 S> */ B(LdaZero),
+ B(Star), R(100),
+ /* 1349 S> */ B(LdaZero),
+ B(Star), R(101),
+ /* 1363 S> */ B(LdaZero),
+ B(Star), R(102),
+ /* 1377 S> */ B(LdaZero),
+ B(Star), R(103),
+ /* 1391 S> */ B(LdaZero),
+ B(Star), R(104),
+ /* 1405 S> */ B(LdaZero),
+ B(Star), R(105),
+ /* 1419 S> */ B(LdaZero),
+ B(Star), R(106),
+ /* 1433 S> */ B(LdaZero),
+ B(Star), R(107),
+ /* 1447 S> */ B(LdaZero),
+ B(Star), R(108),
+ /* 1461 S> */ B(LdaZero),
+ B(Star), R(109),
+ /* 1475 S> */ B(LdaZero),
+ B(Star), R(110),
+ /* 1489 S> */ B(LdaZero),
+ B(Star), R(111),
+ /* 1503 S> */ B(LdaZero),
+ B(Star), R(112),
+ /* 1517 S> */ B(LdaZero),
+ B(Star), R(113),
+ /* 1531 S> */ B(LdaZero),
+ B(Star), R(114),
+ /* 1545 S> */ B(LdaZero),
+ B(Star), R(115),
+ /* 1559 S> */ B(LdaZero),
+ B(Star), R(116),
+ /* 1573 S> */ B(LdaZero),
+ B(Star), R(117),
+ /* 1587 S> */ B(LdaZero),
+ B(Star), R(118),
+ /* 1601 S> */ B(LdaZero),
+ B(Star), R(119),
+ /* 1615 S> */ B(LdaZero),
+ B(Star), R(120),
+ /* 1629 S> */ B(LdaZero),
+ B(Star), R(121),
+ /* 1643 S> */ B(LdaZero),
+ B(Star), R(122),
+ /* 1657 S> */ B(LdaZero),
+ B(Star), R(123),
+ /* 1671 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(124),
+ /* 1685 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(125),
+ /* 1699 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(126),
+ /* 1713 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(127),
+ /* 1727 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(128),
+ /* 1741 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(129),
+ /* 1755 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(130),
+ /* 1769 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(131),
+ /* 1783 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(132),
+ /* 1797 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(133),
+ /* 1811 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(134),
+ /* 1825 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(135),
+ /* 1839 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(136),
+ /* 1853 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(137),
+ /* 1867 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(138),
+ /* 1881 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(139),
+ /* 1895 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(140),
+ /* 1909 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(141),
+ /* 1923 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(142),
+ /* 1937 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(143),
+ /* 1951 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(144),
+ /* 1965 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(145),
+ /* 1979 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(146),
+ /* 1993 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(147),
+ /* 2007 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(148),
+ /* 2021 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(149),
+ /* 2035 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(150),
+ /* 2049 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(151),
+ /* 2063 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(152),
+ /* 2077 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(153),
+ /* 2091 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(154),
+ /* 2105 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(155),
+ /* 2119 S> */ B(LdaZero),
+ B(Wide), B(Star), R16(156),
+ /* 2122 S> */ B(Wide), B(Mov), R16(64), R16(157),
B(Wide), B(Mov), R16(63), R16(158),
- /* 1509 E> */ B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2),
+ /* 2137 E> */ B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2),
B(Star), R(0),
- /* 1515 S> */ B(Wide), B(Mov), R16(27), R16(157),
+ /* 2143 S> */ B(Wide), B(Mov), R16(27), R16(157),
B(Wide), B(Mov), R16(143), R16(158),
- /* 1530 E> */ B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2),
+ /* 2158 E> */ B(Wide), B(CallRuntime), U16(Runtime::kAdd), R16(157), U16(2),
B(Star), R(1),
- /* 1537 S> */ B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0),
- /* 1549 S> */ B(Ldar), R(1),
- /* 1559 S> */ B(Return),
+ /* 2165 S> */ B(CallRuntime), U16(Runtime::kTheHole), R(0), U8(0),
+ /* 2177 S> */ B(Ldar), R(1),
+ /* 2187 S> */ B(Return),
]
constant pool: [
]
diff --git a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc
index 99ab4cd8c0..245d9d9afd 100644
--- a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc
+++ b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc
@@ -25,9 +25,7 @@ using v8::internal::interpreter::BytecodeExpectationsPrinter;
namespace {
-#ifdef V8_OS_POSIX
const char* kGoldenFilesPath = "test/cctest/interpreter/bytecode_expectations/";
-#endif
class ProgramOptions final {
public:
@@ -129,24 +127,23 @@ bool ParseBoolean(const char* string) {
const char* BooleanToString(bool value) { return value ? "yes" : "no"; }
-#ifdef V8_OS_POSIX
-
-bool StrEndsWith(const char* string, const char* suffix) {
- int string_size = i::StrLength(string);
- int suffix_size = i::StrLength(suffix);
- if (string_size < suffix_size) return false;
-
- return strcmp(string + (string_size - suffix_size), suffix) == 0;
-}
-
bool CollectGoldenFiles(std::vector<std::string>* golden_file_list,
const char* directory_path) {
+#ifdef V8_OS_POSIX
DIR* directory = opendir(directory_path);
if (!directory) return false;
+ auto str_ends_with = [](const char* string, const char* suffix) {
+ int string_size = i::StrLength(string);
+ int suffix_size = i::StrLength(suffix);
+ if (string_size < suffix_size) return false;
+
+ return strcmp(string + (string_size - suffix_size), suffix) == 0;
+ };
+
dirent* entry = readdir(directory);
while (entry) {
- if (StrEndsWith(entry->d_name, ".golden")) {
+ if (str_ends_with(entry->d_name, ".golden")) {
std::string golden_filename(kGoldenFilesPath);
golden_filename += entry->d_name;
golden_file_list->push_back(golden_filename);
@@ -155,12 +152,24 @@ bool CollectGoldenFiles(std::vector<std::string>* golden_file_list,
}
closedir(directory);
-
+#elif V8_OS_WIN
+ std::string search_path(directory_path + std::string("/*.golden"));
+ WIN32_FIND_DATAA fd;
+ HANDLE find_handle = FindFirstFileA(search_path.c_str(), &fd);
+ if (find_handle == INVALID_HANDLE_VALUE) return false;
+ do {
+ if (!(fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) {
+ std::string golden_filename(kGoldenFilesPath);
+ std::string temp_filename(fd.cFileName);
+ golden_filename += temp_filename;
+ golden_file_list->push_back(golden_filename);
+ }
+ } while (FindNextFileA(find_handle, &fd));
+ FindClose(find_handle);
+#endif // V8_OS_POSIX
return true;
}
-#endif // V8_OS_POSIX
-
// static
ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) {
ProgramOptions options;
@@ -210,7 +219,7 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) {
}
if (options.rebaseline_ && options.input_filenames_.empty()) {
-#ifdef V8_OS_POSIX
+#if defined(V8_OS_POSIX) || defined(V8_OS_WIN)
if (options.verbose_) {
std::cout << "Looking for golden files in " << kGoldenFilesPath << '\n';
}
@@ -219,7 +228,8 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) {
options.parsing_failed_ = true;
}
#else
- REPORT_ERROR("Golden files autodiscovery requires a POSIX OS, sorry.");
+ REPORT_ERROR(
+ "Golden files autodiscovery requires a POSIX or Window OS, sorry.");
options.parsing_failed_ = true;
#endif
}
diff --git a/deps/v8/test/cctest/interpreter/interpreter-tester.cc b/deps/v8/test/cctest/interpreter/interpreter-tester.cc
index a361a98a52..c66c1a279b 100644
--- a/deps/v8/test/cctest/interpreter/interpreter-tester.cc
+++ b/deps/v8/test/cctest/interpreter/interpreter-tester.cc
@@ -5,6 +5,7 @@
#include "test/cctest/interpreter/interpreter-tester.h"
#include "src/api-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/objects-inl.h"
namespace v8 {
diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
index fb56d5d98a..168dabd8dc 100644
--- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
@@ -91,6 +91,7 @@ class InitializedIgnitionHandleScope : public InitializedHandleScope {
InitializedIgnitionHandleScope() {
i::FLAG_always_opt = false;
i::FLAG_allow_natives_syntax = true;
+ i::FLAG_enable_lazy_source_positions = false;
}
};
@@ -2420,7 +2421,7 @@ TEST(WideRegisters) {
// Prepare prologue that creates frame for lots of registers.
std::ostringstream os;
for (size_t i = 0; i < 157; ++i) {
- os << "var x" << i << ";\n";
+ os << "var x" << i << " = 0;\n";
}
std::string prologue(os.str());
diff --git a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc
index bfc42aa540..becc46ab9c 100644
--- a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc
+++ b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc
@@ -5,6 +5,7 @@
#include "src/v8.h"
#include "src/api-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/interpreter/interpreter-intrinsics.h"
#include "src/objects-inl.h"
#include "test/cctest/interpreter/interpreter-tester.h"
diff --git a/deps/v8/test/cctest/interpreter/test-interpreter.cc b/deps/v8/test/cctest/interpreter/test-interpreter.cc
index 9ec0c99ce1..3483e7967a 100644
--- a/deps/v8/test/cctest/interpreter/test-interpreter.cc
+++ b/deps/v8/test/cctest/interpreter/test-interpreter.cc
@@ -7,8 +7,12 @@
#include "src/v8.h"
#include "src/api-inl.h"
+#include "src/base/overflowing-math.h"
+#include "src/compiler.h"
#include "src/execution.h"
#include "src/handles.h"
+#include "src/hash-seed-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/interpreter/bytecode-array-builder.h"
#include "src/interpreter/bytecode-array-iterator.h"
#include "src/interpreter/bytecode-flags.h"
@@ -160,7 +164,7 @@ TEST(InterpreterLoadLiteral) {
// Heap numbers.
{
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
BytecodeArrayBuilder builder(zone, 1, 0);
@@ -178,7 +182,7 @@ TEST(InterpreterLoadLiteral) {
// Strings.
{
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
BytecodeArrayBuilder builder(zone, 1, 0);
@@ -239,7 +243,7 @@ static double BinaryOpC(Token::Value op, double lhs, double rhs) {
case Token::Value::MUL:
return lhs * rhs;
case Token::Value::DIV:
- return lhs / rhs;
+ return base::Divide(lhs, rhs);
case Token::Value::MOD:
return Modulo(lhs, rhs);
case Token::Value::BIT_OR:
@@ -252,10 +256,7 @@ static double BinaryOpC(Token::Value op, double lhs, double rhs) {
return (v8::internal::DoubleToInt32(lhs) &
v8::internal::DoubleToInt32(rhs));
case Token::Value::SHL: {
- int32_t val = v8::internal::DoubleToInt32(lhs);
- uint32_t count = v8::internal::DoubleToUint32(rhs) & 0x1F;
- int32_t result = val << count;
- return result;
+ return base::ShlWithWraparound(DoubleToInt32(lhs), DoubleToInt32(rhs));
}
case Token::Value::SAR: {
int32_t val = v8::internal::DoubleToInt32(lhs);
@@ -487,7 +488,7 @@ TEST(InterpreterStringAdd) {
Zone* zone = handles.main_zone();
Factory* factory = isolate->factory();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
struct TestCase {
const AstRawString* lhs;
@@ -580,7 +581,7 @@ TEST(InterpreterParameter8) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
BytecodeArrayBuilder builder(zone, 8, 0, &feedback_spec);
@@ -633,7 +634,7 @@ TEST(InterpreterBinaryOpTypeFeedback) {
i::Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
struct BinaryOpExpectation {
Token::Value op;
@@ -767,7 +768,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) {
i::Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
struct BinaryOpExpectation {
Token::Value op;
@@ -1132,7 +1133,7 @@ TEST(InterpreterLoadNamedProperty) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
FeedbackSlot slot = feedback_spec.AddLoadICSlot();
@@ -1184,7 +1185,7 @@ TEST(InterpreterLoadKeyedProperty) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
FeedbackSlot slot = feedback_spec.AddKeyedLoadICSlot();
@@ -1226,7 +1227,7 @@ TEST(InterpreterStoreNamedProperty) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
FeedbackSlot slot = feedback_spec.AddStoreICSlot(LanguageMode::kStrict);
@@ -1289,7 +1290,7 @@ TEST(InterpreterStoreKeyedProperty) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
FeedbackSlot slot = feedback_spec.AddKeyedStoreICSlot(LanguageMode::kSloppy);
@@ -1341,7 +1342,7 @@ TEST(InterpreterCall) {
Zone* zone = handles.main_zone();
Factory* factory = isolate->factory();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
FeedbackSlot slot = feedback_spec.AddLoadICSlot();
@@ -1527,17 +1528,18 @@ TEST(InterpreterJumps) {
NewFeedbackMetadata(isolate, &feedback_spec);
Register reg(0), scratch(1);
- BytecodeLabel label[3];
+ BytecodeLoopHeader loop_header;
+ BytecodeLabel label[2];
builder.LoadLiteral(Smi::zero())
.StoreAccumulatorInRegister(reg)
- .Jump(&label[1]);
- SetRegister(builder, reg, 1024, scratch).Bind(&label[0]);
- IncrementRegister(builder, reg, 1, scratch, GetIndex(slot)).Jump(&label[2]);
- SetRegister(builder, reg, 2048, scratch).Bind(&label[1]);
+ .Jump(&label[0]);
+ SetRegister(builder, reg, 1024, scratch).Bind(&loop_header);
+ IncrementRegister(builder, reg, 1, scratch, GetIndex(slot)).Jump(&label[1]);
+ SetRegister(builder, reg, 2048, scratch).Bind(&label[0]);
IncrementRegister(builder, reg, 2, scratch, GetIndex(slot1))
- .JumpLoop(&label[0], 0);
- SetRegister(builder, reg, 4096, scratch).Bind(&label[2]);
+ .JumpLoop(&loop_header, 0);
+ SetRegister(builder, reg, 4096, scratch).Bind(&label[1]);
IncrementRegister(builder, reg, 4, scratch, GetIndex(slot2))
.LoadAccumulatorWithRegister(reg)
.Return();
@@ -1653,7 +1655,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
BytecodeArrayBuilder builder(zone, 1, 257, &feedback_spec);
@@ -1666,6 +1668,8 @@ TEST(InterpreterJumpConstantWith16BitOperand) {
builder.LoadLiteral(Smi::zero());
builder.StoreAccumulatorInRegister(reg);
+ // Conditional jump to the fake label, to force both basic blocks to be live.
+ builder.JumpIfTrue(ToBooleanMode::kConvertToBoolean, &fake);
// Consume all 8-bit operands
for (int i = 1; i <= 256; i++) {
builder.LoadLiteral(i + 0.5);
@@ -1714,7 +1718,7 @@ TEST(InterpreterJumpWith32BitOperand) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
BytecodeArrayBuilder builder(zone, 1, 1);
Register reg(0);
BytecodeLabel done;
@@ -1853,7 +1857,7 @@ TEST(InterpreterHeapNumberComparisons) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
BytecodeArrayBuilder builder(zone, 1, 1, &feedback_spec);
@@ -1900,7 +1904,7 @@ TEST(InterpreterBigIntComparisons) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
BytecodeArrayBuilder builder(zone, 1, 1, &feedback_spec);
@@ -1945,7 +1949,7 @@ TEST(InterpreterStringComparisons) {
for (size_t i = 0; i < arraysize(inputs); i++) {
for (size_t j = 0; j < arraysize(inputs); j++) {
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
CanonicalHandleScope canonical(isolate);
const char* lhs = inputs[i].c_str();
@@ -2028,7 +2032,7 @@ TEST(InterpreterMixedComparisons) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
FeedbackVectorSpec feedback_spec(zone);
BytecodeArrayBuilder builder(zone, 1, 0, &feedback_spec);
@@ -2266,7 +2270,7 @@ TEST(InterpreterTestIn) {
Zone* zone = handles.main_zone();
Factory* factory = isolate->factory();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
// Allocate an array
Handle<i::JSArray> array =
factory->NewJSArray(0, i::ElementsKind::PACKED_SMI_ELEMENTS);
@@ -2274,21 +2278,26 @@ TEST(InterpreterTestIn) {
const char* properties[] = {"length", "fuzzle", "x", "0"};
for (size_t i = 0; i < arraysize(properties); i++) {
bool expected_value = (i == 0);
- BytecodeArrayBuilder builder(zone, 1, 1);
+ FeedbackVectorSpec feedback_spec(zone);
+ BytecodeArrayBuilder builder(zone, 1, 1, &feedback_spec);
Register r0(0);
builder.LoadLiteral(ast_factory.GetOneByteString(properties[i]))
.StoreAccumulatorInRegister(r0);
+ FeedbackSlot slot = feedback_spec.AddKeyedHasICSlot();
+ Handle<i::FeedbackMetadata> metadata =
+ NewFeedbackMetadata(isolate, &feedback_spec);
+
size_t array_entry = builder.AllocateDeferredConstantPoolEntry();
builder.SetDeferredConstantPoolEntry(array_entry, array);
builder.LoadConstantPoolEntry(array_entry)
- .CompareOperation(Token::Value::IN, r0)
+ .CompareOperation(Token::Value::IN, r0, GetIndex(slot))
.Return();
ast_factory.Internalize(isolate);
Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate);
- InterpreterTester tester(isolate, bytecode_array);
+ InterpreterTester tester(isolate, bytecode_array, metadata);
auto callable = tester.GetCallable<>();
Handle<Object> return_value = callable().ToHandleChecked();
CHECK(return_value->IsBoolean());
@@ -2324,7 +2333,7 @@ TEST(InterpreterUnaryNotNonBoolean) {
Isolate* isolate = handles.main_isolate();
Zone* zone = handles.main_zone();
AstValueFactory ast_factory(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
std::pair<LiteralForTest, bool> object_type_tuples[] = {
std::make_pair(LiteralForTest(LiteralForTest::kUndefined), true),
@@ -4946,7 +4955,7 @@ TEST(InterpreterIllegalConstDeclaration) {
std::pair<const char*, const char*> const_decl[] = {
{"const x = x = 10 + 3; return x;",
- "Uncaught ReferenceError: x is not defined"},
+ "Uncaught ReferenceError: Cannot access 'x' before initialization"},
{"const x = 10; x = 20; return x;",
"Uncaught TypeError: Assignment to constant variable."},
{"const x = 10; { x = 20; } return x;",
@@ -4954,7 +4963,7 @@ TEST(InterpreterIllegalConstDeclaration) {
{"const x = 10; eval('x = 20;'); return x;",
"Uncaught TypeError: Assignment to constant variable."},
{"let x = x + 10; return x;",
- "Uncaught ReferenceError: x is not defined"},
+ "Uncaught ReferenceError: Cannot access 'x' before initialization"},
{"'use strict'; (function f1() { f1 = 123; })() ",
"Uncaught TypeError: Assignment to constant variable."},
};
@@ -5061,6 +5070,82 @@ TEST(InterpreterGetBytecodeHandler) {
CHECK_EQ(add_wide_handler->builtin_index(), Builtins::kAddWideHandler);
}
+TEST(InterpreterCollectSourcePositions) {
+ FLAG_enable_lazy_source_positions = true;
+ HandleAndZoneScope handles;
+ Isolate* isolate = handles.main_isolate();
+
+ const char* source =
+ "(function () {\n"
+ " return 1;\n"
+ "})";
+
+ Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(source))));
+
+ Handle<SharedFunctionInfo> sfi = handle(function->shared(), isolate);
+ Handle<BytecodeArray> bytecode_array =
+ handle(sfi->GetBytecodeArray(), isolate);
+ ByteArray source_position_table = bytecode_array->SourcePositionTable();
+ CHECK_EQ(source_position_table->length(), 0);
+
+ Compiler::CollectSourcePositions(isolate, sfi);
+
+ source_position_table = bytecode_array->SourcePositionTable();
+ CHECK_GT(source_position_table->length(), 0);
+}
+
+namespace {
+
+void CheckStringEqual(const char* expected_ptr, Handle<Object> actual_handle) {
+ v8::String::Utf8Value utf8(
+ v8::Isolate::GetCurrent(),
+ v8::Utils::ToLocal(Handle<String>::cast(actual_handle)));
+ std::string expected(expected_ptr);
+ std::string actual(*utf8);
+ CHECK_EQ(expected, actual);
+}
+
+} // namespace
+
+TEST(InterpreterCollectSourcePositions_GenerateStackTrace) {
+ FLAG_enable_lazy_source_positions = true;
+ HandleAndZoneScope handles;
+ Isolate* isolate = handles.main_isolate();
+
+ const char* source =
+ R"javascript(
+ (function () {
+ try {
+ throw new Error();
+ } catch (e) {
+ return e.stack;
+ }
+ });
+ )javascript";
+
+ Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(source))));
+
+ Handle<SharedFunctionInfo> sfi = handle(function->shared(), isolate);
+ Handle<BytecodeArray> bytecode_array =
+ handle(sfi->GetBytecodeArray(), isolate);
+ ByteArray source_position_table = bytecode_array->SourcePositionTable();
+ CHECK_EQ(source_position_table->length(), 0);
+
+ {
+ Handle<Object> result =
+ Execution::Call(isolate, function,
+ ReadOnlyRoots(isolate).undefined_value_handle(), 0,
+ nullptr)
+ .ToHandleChecked();
+ CheckStringEqual("Error\n at <anonymous>:4:17", result);
+ }
+
+ source_position_table = bytecode_array->SourcePositionTable();
+ CHECK_GT(source_position_table->length(), 0);
+}
+
} // namespace interpreter
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/interpreter/test-source-positions.cc b/deps/v8/test/cctest/interpreter/test-source-positions.cc
index 2a8e354e54..ccdbd53558 100644
--- a/deps/v8/test/cctest/interpreter/test-source-positions.cc
+++ b/deps/v8/test/cctest/interpreter/test-source-positions.cc
@@ -113,6 +113,7 @@ class OptimizedBytecodeSourcePositionTester final {
SaveOptimizationFlags();
saved_flag_always_opt_ = FLAG_always_opt;
FLAG_always_opt = false;
+ FLAG_enable_lazy_source_positions = false;
}
~OptimizedBytecodeSourcePositionTester() {
diff --git a/deps/v8/test/cctest/libplatform/test-tracing.cc b/deps/v8/test/cctest/libplatform/test-tracing.cc
index b949785bcf..3b449f4b09 100644
--- a/deps/v8/test/cctest/libplatform/test-tracing.cc
+++ b/deps/v8/test/cctest/libplatform/test-tracing.cc
@@ -4,6 +4,7 @@
#include <limits>
#include "include/libplatform/v8-tracing.h"
+#include "src/base/platform/platform.h"
#include "src/libplatform/default-platform.h"
#include "src/tracing/trace-event.h"
#include "test/cctest/cctest.h"
@@ -439,6 +440,59 @@ TEST(TracingObservers) {
i::V8::SetPlatformForTesting(old_platform);
}
+class TraceWritingThread : public base::Thread {
+ public:
+ TraceWritingThread(
+ v8::platform::tracing::TracingController* tracing_controller)
+ : base::Thread(base::Thread::Options("TraceWritingThread")),
+ tracing_controller_(tracing_controller) {}
+
+ void Run() override {
+ for (int i = 0; i < 1000; i++) {
+ TRACE_EVENT0("v8", "v8.Test");
+ tracing_controller_->AddTraceEvent('A', nullptr, "v8", "", 1, 1, 0,
+ nullptr, nullptr, nullptr, nullptr, 0);
+ tracing_controller_->AddTraceEventWithTimestamp('A', nullptr, "v8", "", 1,
+ 1, 0, nullptr, nullptr,
+ nullptr, nullptr, 0, 0);
+ base::OS::Sleep(base::TimeDelta::FromMilliseconds(1));
+ }
+ }
+
+ private:
+ v8::platform::tracing::TracingController* tracing_controller_;
+};
+
+TEST(AddTraceEventMultiThreaded) {
+ v8::Platform* old_platform = i::V8::GetCurrentPlatform();
+ std::unique_ptr<v8::Platform> default_platform(
+ v8::platform::NewDefaultPlatform());
+ i::V8::SetPlatformForTesting(default_platform.get());
+
+ auto tracing = base::make_unique<v8::platform::tracing::TracingController>();
+ v8::platform::tracing::TracingController* tracing_controller = tracing.get();
+ static_cast<v8::platform::DefaultPlatform*>(default_platform.get())
+ ->SetTracingController(std::move(tracing));
+
+ MockTraceWriter* writer = new MockTraceWriter();
+ TraceBuffer* ring_buffer =
+ TraceBuffer::CreateTraceBufferRingBuffer(1, writer);
+ tracing_controller->Initialize(ring_buffer);
+ TraceConfig* trace_config = new TraceConfig();
+ trace_config->AddIncludedCategory("v8");
+ tracing_controller->StartTracing(trace_config);
+
+ TraceWritingThread thread(tracing_controller);
+ thread.StartSynchronously();
+
+ base::OS::Sleep(base::TimeDelta::FromMilliseconds(100));
+ tracing_controller->StopTracing();
+
+ thread.Join();
+
+ i::V8::SetPlatformForTesting(old_platform);
+}
+
} // namespace tracing
} // namespace platform
} // namespace v8
diff --git a/deps/v8/test/cctest/libsampler/test-sampler.cc b/deps/v8/test/cctest/libsampler/test-sampler.cc
index e00861ddcf..fdb9bbda89 100644
--- a/deps/v8/test/cctest/libsampler/test-sampler.cc
+++ b/deps/v8/test/cctest/libsampler/test-sampler.cc
@@ -141,6 +141,7 @@ class CountingSampler : public Sampler {
int sample_count() { return sample_count_; }
void set_active(bool active) { SetActive(active); }
+ void set_should_record_sample() { SetShouldRecordSample(); }
private:
int sample_count_ = 0;
@@ -153,6 +154,7 @@ TEST(SamplerManager_AddRemoveSampler) {
SamplerManager* manager = SamplerManager::instance();
CountingSampler sampler1(isolate);
sampler1.set_active(true);
+ sampler1.set_should_record_sample();
CHECK_EQ(0, sampler1.sample_count());
manager->AddSampler(&sampler1);
@@ -162,6 +164,7 @@ TEST(SamplerManager_AddRemoveSampler) {
CHECK_EQ(1, sampler1.sample_count());
sampler1.set_active(true);
+ sampler1.set_should_record_sample();
manager->RemoveSampler(&sampler1);
sampler1.set_active(false);
@@ -177,6 +180,7 @@ TEST(SamplerManager_DoesNotReAdd) {
SamplerManager* manager = SamplerManager::instance();
CountingSampler sampler1(isolate);
sampler1.set_active(true);
+ sampler1.set_should_record_sample();
manager->AddSampler(&sampler1);
manager->AddSampler(&sampler1);
diff --git a/deps/v8/test/cctest/parsing/test-preparser.cc b/deps/v8/test/cctest/parsing/test-preparser.cc
index 4d2aba768c..64dd802c64 100644
--- a/deps/v8/test/cctest/parsing/test-preparser.cc
+++ b/deps/v8/test/cctest/parsing/test-preparser.cc
@@ -804,6 +804,14 @@ TEST(ProducingAndConsumingByteData) {
std::vector<uint8_t> buffer;
i::PreparseDataBuilder::ByteData bytes;
bytes.Start(&buffer);
+
+ bytes.Reserve(32);
+ bytes.Reserve(32);
+ CHECK_EQ(buffer.size(), 32);
+ const int kBufferSize = 64;
+ bytes.Reserve(kBufferSize);
+ CHECK_EQ(buffer.size(), kBufferSize);
+
// Write some data.
#ifdef DEBUG
bytes.WriteUint32(1983); // This will be overwritten.
@@ -818,7 +826,8 @@ TEST(ProducingAndConsumingByteData) {
#ifdef DEBUG
bytes.SaveCurrentSizeAtFirstUint32();
int saved_size = 21;
- CHECK_EQ(buffer.size(), saved_size);
+ CHECK_EQ(buffer.size(), kBufferSize);
+ CHECK_EQ(bytes.length(), saved_size);
#endif
bytes.WriteUint8(100);
// Write quarter bytes between uint8s and uint32s to verify they're stored
@@ -845,11 +854,14 @@ TEST(ProducingAndConsumingByteData) {
// End with a lonely quarter.
bytes.WriteQuarter(2);
+ CHECK_EQ(buffer.size(), 64);
#ifdef DEBUG
- CHECK_EQ(buffer.size(), 42);
+ const int kDataSize = 42;
#else
- CHECK_EQ(buffer.size(), 21);
+ const int kDataSize = 21;
#endif
+ CHECK_EQ(bytes.length(), kDataSize);
+ CHECK_EQ(buffer.size(), kBufferSize);
// Copy buffer for sanity checks later-on.
std::vector<uint8_t> copied_buffer(buffer);
@@ -858,7 +870,7 @@ TEST(ProducingAndConsumingByteData) {
// serialization.
bytes.Finalize(&zone);
CHECK_EQ(buffer.size(), 0);
- CHECK_LT(0, copied_buffer.size());
+ CHECK_EQ(copied_buffer.size(), kBufferSize);
{
// Serialize as a ZoneConsumedPreparseData, and read back data.
@@ -868,7 +880,9 @@ TEST(ProducingAndConsumingByteData) {
i::ZoneConsumedPreparseData::ByteData::ReadingScope reading_scope(
&bytes_for_reading, wrapper);
- for (int i = 0; i < static_cast<int>(copied_buffer.size()); i++) {
+ CHECK_EQ(wrapper.data_length(), kDataSize);
+
+ for (int i = 0; i < kDataSize; i++) {
CHECK_EQ(copied_buffer.at(i), wrapper.get(i));
}
@@ -910,13 +924,13 @@ TEST(ProducingAndConsumingByteData) {
{
// Serialize as an OnHeapConsumedPreparseData, and read back data.
i::Handle<i::PreparseData> data_on_heap = bytes.CopyToHeap(isolate, 0);
- CHECK_EQ(copied_buffer.size(), data_on_heap->data_length());
+ CHECK_EQ(data_on_heap->data_length(), kDataSize);
CHECK_EQ(data_on_heap->children_length(), 0);
i::OnHeapConsumedPreparseData::ByteData bytes_for_reading;
i::OnHeapConsumedPreparseData::ByteData::ReadingScope reading_scope(
&bytes_for_reading, *data_on_heap);
- for (int i = 0; i < static_cast<int>(copied_buffer.size()); i++) {
+ for (int i = 0; i < kDataSize; i++) {
CHECK_EQ(copied_buffer[i], data_on_heap->get(i));
}
diff --git a/deps/v8/test/cctest/parsing/test-scanner-streams.cc b/deps/v8/test/cctest/parsing/test-scanner-streams.cc
index ef3d0f7df8..ec6c2bc10b 100644
--- a/deps/v8/test/cctest/parsing/test-scanner-streams.cc
+++ b/deps/v8/test/cctest/parsing/test-scanner-streams.cc
@@ -47,7 +47,9 @@ class ChunkSource : public v8::ScriptCompiler::ExternalSourceStream {
DCHECK_LT(current_, chunks_.size());
Chunk& next = chunks_[current_++];
uint8_t* chunk = new uint8_t[next.len];
- i::MemMove(chunk, next.ptr, next.len);
+ if (next.len > 0) {
+ i::MemMove(chunk, next.ptr, next.len);
+ }
*src = chunk;
return next.len;
}
@@ -164,6 +166,20 @@ TEST(Utf8StreamAsciiOnly) {
} while (c != v8::internal::Utf16CharacterStream::kEndOfInput);
}
+TEST(Utf8StreamMaxNonSurrogateCharCode) {
+ const char* chunks[] = {"\uffff\uffff", ""};
+ ChunkSource chunk_source(chunks);
+ std::unique_ptr<v8::internal::Utf16CharacterStream> stream(
+ v8::internal::ScannerStream::For(
+ &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8));
+
+ // Read the correct character.
+ uint16_t max = unibrow::Utf16::kMaxNonSurrogateCharCode;
+ CHECK_EQ(max, static_cast<uint32_t>(stream->Advance()));
+ CHECK_EQ(max, static_cast<uint32_t>(stream->Advance()));
+ CHECK_EQ(i::Utf16CharacterStream::kEndOfInput, stream->Advance());
+}
+
TEST(Utf8StreamBOM) {
// Construct test string w/ UTF-8 BOM (byte order mark)
char data[3 + arraysize(unicode_utf8)] = {"\xef\xbb\xbf"};
diff --git a/deps/v8/test/cctest/scope-test-helper.h b/deps/v8/test/cctest/scope-test-helper.h
index a10d8af96f..c733f9dbf5 100644
--- a/deps/v8/test/cctest/scope-test-helper.h
+++ b/deps/v8/test/cctest/scope-test-helper.h
@@ -24,16 +24,14 @@ class ScopeTestHelper {
baseline->AsDeclarationScope()->function_kind() ==
scope->AsDeclarationScope()->function_kind());
- if (!PreparseDataBuilder::ScopeNeedsData(baseline)) {
- return;
- }
+ if (!PreparseDataBuilder::ScopeNeedsData(baseline)) return;
if (scope->is_declaration_scope() &&
scope->AsDeclarationScope()->is_skipped_function()) {
return;
}
- if (baseline->scope_type() == ScopeType::FUNCTION_SCOPE) {
+ if (baseline->is_function_scope()) {
Variable* function = baseline->AsDeclarationScope()->function_var();
if (function != nullptr) {
CompareVariables(function, scope->AsDeclarationScope()->function_var(),
@@ -99,7 +97,7 @@ class ScopeTestHelper {
static void MarkInnerFunctionsAsSkipped(Scope* scope) {
for (Scope* inner = scope->inner_scope(); inner != nullptr;
inner = inner->sibling()) {
- if (inner->scope_type() == ScopeType::FUNCTION_SCOPE &&
+ if (inner->is_function_scope() &&
!inner->AsDeclarationScope()->is_arrow_scope()) {
inner->AsDeclarationScope()->set_is_skipped_function(true);
}
@@ -108,15 +106,13 @@ class ScopeTestHelper {
}
static bool HasSkippedFunctionInside(Scope* scope) {
- if (scope->scope_type() == ScopeType::FUNCTION_SCOPE &&
+ if (scope->is_function_scope() &&
scope->AsDeclarationScope()->is_skipped_function()) {
return true;
}
for (Scope* inner = scope->inner_scope(); inner != nullptr;
inner = inner->sibling()) {
- if (HasSkippedFunctionInside(inner)) {
- return true;
- }
+ if (HasSkippedFunctionInside(inner)) return true;
}
return false;
}
diff --git a/deps/v8/test/cctest/test-allocation.cc b/deps/v8/test/cctest/test-allocation.cc
index d5ba49c537..dd06535a98 100644
--- a/deps/v8/test/cctest/test-allocation.cc
+++ b/deps/v8/test/cctest/test-allocation.cc
@@ -99,7 +99,8 @@ TEST(AccountingAllocatorOOM) {
AllocationPlatform platform;
v8::internal::AccountingAllocator allocator;
CHECK(!platform.oom_callback_called);
- v8::internal::Segment* result = allocator.GetSegment(GetHugeMemoryAmount());
+ v8::internal::Segment* result =
+ allocator.AllocateSegment(GetHugeMemoryAmount());
// On a few systems, allocation somehow succeeds.
CHECK_EQ(result == nullptr, platform.oom_callback_called);
}
diff --git a/deps/v8/test/cctest/test-api-interceptors.cc b/deps/v8/test/cctest/test-api-interceptors.cc
index 2ca473dea7..41678032af 100644
--- a/deps/v8/test/cctest/test-api-interceptors.cc
+++ b/deps/v8/test/cctest/test-api-interceptors.cc
@@ -470,6 +470,9 @@ THREADED_TEST(QueryInterceptor) {
v8_compile("Object.isFrozen('obj.x');")->Run(env.local()).ToLocalChecked();
CHECK_EQ(8, query_counter_int);
+
+ v8_compile("'x' in obj;")->Run(env.local()).ToLocalChecked();
+ CHECK_EQ(9, query_counter_int);
}
namespace {
@@ -874,15 +877,14 @@ THREADED_TEST(InterceptorHasOwnPropertyCausingGC) {
CHECK(!value->BooleanValue(isolate));
}
-
-static void CheckInterceptorLoadIC(
- v8::GenericNamedPropertyGetterCallback getter, const char* source,
- int expected) {
+static void CheckInterceptorIC(v8::GenericNamedPropertyGetterCallback getter,
+ v8::GenericNamedPropertyQueryCallback query,
+ const char* source, int expected) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
v8::Local<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- getter, nullptr, nullptr, nullptr, nullptr, v8_str("data")));
+ getter, nullptr, query, nullptr, nullptr, v8_str("data")));
LocalContext context;
context->Global()
->Set(context.local(), v8_str("o"),
@@ -892,6 +894,11 @@ static void CheckInterceptorLoadIC(
CHECK_EQ(expected, value->Int32Value(context.local()).FromJust());
}
+static void CheckInterceptorLoadIC(
+ v8::GenericNamedPropertyGetterCallback getter, const char* source,
+ int expected) {
+ CheckInterceptorIC(getter, nullptr, source, expected);
+}
static void InterceptorLoadICGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
@@ -1432,6 +1439,92 @@ THREADED_TEST(InterceptorReturningZero) {
0);
}
+namespace {
+
+template <typename TKey, v8::internal::PropertyAttributes attribute>
+void HasICQuery(TKey name, const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ ApiTestFuzzer::Fuzz();
+ v8::Isolate* isolate = CcTest::isolate();
+ CHECK_EQ(isolate, info.GetIsolate());
+ info.GetReturnValue().Set(v8::Integer::New(isolate, attribute));
+}
+
+template <typename TKey>
+void HasICQueryToggle(TKey name,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ ApiTestFuzzer::Fuzz();
+ static bool toggle = false;
+ toggle = !toggle;
+ v8::Isolate* isolate = CcTest::isolate();
+ CHECK_EQ(isolate, info.GetIsolate());
+ info.GetReturnValue().Set(v8::Integer::New(
+ isolate, toggle ? v8::internal::ABSENT : v8::internal::NONE));
+}
+
+int named_query_counter = 0;
+void NamedQueryCallback(Local<Name> name,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ named_query_counter++;
+}
+
+} // namespace
+
+THREADED_TEST(InterceptorHasIC) {
+ named_query_counter = 0;
+ CheckInterceptorIC(nullptr, NamedQueryCallback,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " 'x' in o;"
+ "}",
+ 0);
+ CHECK_EQ(1000, named_query_counter);
+}
+
+THREADED_TEST(InterceptorHasICQueryAbsent) {
+ CheckInterceptorIC(nullptr, HasICQuery<Local<Name>, v8::internal::ABSENT>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if ('x' in o) ++result;"
+ "}",
+ 0);
+}
+
+THREADED_TEST(InterceptorHasICQueryNone) {
+ CheckInterceptorIC(nullptr, HasICQuery<Local<Name>, v8::internal::NONE>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if ('x' in o) ++result;"
+ "}",
+ 1000);
+}
+
+THREADED_TEST(InterceptorHasICGetter) {
+ CheckInterceptorIC(InterceptorLoadICGetter, nullptr,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if ('x' in o) ++result;"
+ "}",
+ 1000);
+}
+
+THREADED_TEST(InterceptorHasICQueryGetter) {
+ CheckInterceptorIC(InterceptorLoadICGetter,
+ HasICQuery<Local<Name>, v8::internal::ABSENT>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if ('x' in o) ++result;"
+ "}",
+ 0);
+}
+
+THREADED_TEST(InterceptorHasICQueryToggle) {
+ CheckInterceptorIC(InterceptorLoadICGetter, HasICQueryToggle<Local<Name>>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if ('x' in o) ++result;"
+ "}",
+ 500);
+}
static void InterceptorStoreICSetter(
Local<Name> key, Local<Value> value,
@@ -3273,6 +3366,101 @@ THREADED_TEST(IndexedInterceptorOnProto) {
ExpectString(code, "PASSED");
}
+namespace {
+
+void CheckIndexedInterceptorHasIC(v8::IndexedPropertyGetterCallback getter,
+ v8::IndexedPropertyQueryCallback query,
+ const char* source, int expected) {
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::ObjectTemplate> templ = ObjectTemplate::New(isolate);
+ templ->SetHandler(v8::IndexedPropertyHandlerConfiguration(
+ getter, nullptr, query, nullptr, nullptr, v8_str("data")));
+ LocalContext context;
+ context->Global()
+ ->Set(context.local(), v8_str("o"),
+ templ->NewInstance(context.local()).ToLocalChecked())
+ .FromJust();
+ v8::Local<Value> value = CompileRun(source);
+ CHECK_EQ(expected, value->Int32Value(context.local()).FromJust());
+}
+
+int indexed_query_counter = 0;
+void IndexedQueryCallback(uint32_t index,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ indexed_query_counter++;
+}
+
+void IndexHasICQueryAbsent(uint32_t index,
+ const v8::PropertyCallbackInfo<v8::Integer>& info) {
+ ApiTestFuzzer::Fuzz();
+ v8::Isolate* isolate = CcTest::isolate();
+ CHECK_EQ(isolate, info.GetIsolate());
+ info.GetReturnValue().Set(v8::Integer::New(isolate, v8::internal::ABSENT));
+}
+
+} // namespace
+
+THREADED_TEST(IndexedInterceptorHasIC) {
+ indexed_query_counter = 0;
+ CheckIndexedInterceptorHasIC(nullptr, IndexedQueryCallback,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " i in o;"
+ "}",
+ 0);
+ CHECK_EQ(1000, indexed_query_counter);
+}
+
+THREADED_TEST(IndexedInterceptorHasICQueryAbsent) {
+ CheckIndexedInterceptorHasIC(nullptr,
+ // HasICQuery<uint32_t, v8::internal::ABSENT>,
+ IndexHasICQueryAbsent,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if (i in o) ++result;"
+ "}",
+ 0);
+}
+
+THREADED_TEST(IndexedInterceptorHasICQueryNone) {
+ CheckIndexedInterceptorHasIC(nullptr,
+ HasICQuery<uint32_t, v8::internal::NONE>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if (i in o) ++result;"
+ "}",
+ 1000);
+}
+
+THREADED_TEST(IndexedInterceptorHasICGetter) {
+ CheckIndexedInterceptorHasIC(IdentityIndexedPropertyGetter, nullptr,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if (i in o) ++result;"
+ "}",
+ 1000);
+}
+
+THREADED_TEST(IndexedInterceptorHasICQueryGetter) {
+ CheckIndexedInterceptorHasIC(IdentityIndexedPropertyGetter,
+ HasICQuery<uint32_t, v8::internal::ABSENT>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if (i in o) ++result;"
+ "}",
+ 0);
+}
+
+THREADED_TEST(IndexedInterceptorHasICQueryToggle) {
+ CheckIndexedInterceptorHasIC(IdentityIndexedPropertyGetter,
+ HasICQueryToggle<uint32_t>,
+ "var result = 0;"
+ "for (var i = 0; i < 1000; i++) {"
+ " if (i in o) ++result;"
+ "}",
+ 500);
+}
static void NoBlockGetterX(Local<Name> name,
const v8::PropertyCallbackInfo<v8::Value>&) {}
diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc
index 6615f1583a..9dfe1155d9 100644
--- a/deps/v8/test/cctest/test-api.cc
+++ b/deps/v8/test/cctest/test-api.cc
@@ -45,8 +45,11 @@
#include "src/compilation-cache.h"
#include "src/debug/debug.h"
#include "src/execution.h"
+#include "src/feedback-vector-inl.h"
+#include "src/feedback-vector.h"
#include "src/futex-emulation.h"
#include "src/global-handles.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/local-allocator.h"
#include "src/lookup.h"
@@ -62,6 +65,8 @@
#include "src/wasm/wasm-js.h"
#include "test/cctest/heap/heap-tester.h"
#include "test/cctest/heap/heap-utils.h"
+#include "test/cctest/wasm/wasm-run-utils.h"
+#include "test/common/wasm/wasm-macro-gen.h"
static const bool kLogThreading = false;
@@ -619,6 +624,13 @@ TEST(MakingExternalStringConditions) {
CcTest::CollectGarbage(i::NEW_SPACE);
uint16_t* two_byte_string = AsciiToTwoByteString("s1");
+ Local<String> tiny_local_string =
+ String::NewFromTwoByte(env->GetIsolate(), two_byte_string,
+ v8::NewStringType::kNormal)
+ .ToLocalChecked();
+ i::DeleteArray(two_byte_string);
+
+ two_byte_string = AsciiToTwoByteString("s1234");
Local<String> local_string =
String::NewFromTwoByte(env->GetIsolate(), two_byte_string,
v8::NewStringType::kNormal)
@@ -632,6 +644,11 @@ TEST(MakingExternalStringConditions) {
CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now
// Old space strings should be accepted.
CHECK(local_string->CanMakeExternal());
+
+ // Tiny strings are not in-place externalizable when pointer compression is
+ // enabled.
+ CHECK_EQ(i::kTaggedSize == i::kSystemPointerSize,
+ tiny_local_string->CanMakeExternal());
}
@@ -643,7 +660,8 @@ TEST(MakingExternalOneByteStringConditions) {
CcTest::CollectGarbage(i::NEW_SPACE);
CcTest::CollectGarbage(i::NEW_SPACE);
- Local<String> local_string = v8_str("s1");
+ Local<String> tiny_local_string = v8_str("s");
+ Local<String> local_string = v8_str("s1234");
// We should refuse to externalize new space strings.
CHECK(!local_string->CanMakeExternal());
// Trigger GCs so that the newly allocated string moves to old gen.
@@ -651,6 +669,11 @@ TEST(MakingExternalOneByteStringConditions) {
CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now
// Old space strings should be accepted.
CHECK(local_string->CanMakeExternal());
+
+ // Tiny strings are not in-place externalizable when pointer compression is
+ // enabled.
+ CHECK_EQ(i::kTaggedSize == i::kSystemPointerSize,
+ tiny_local_string->CanMakeExternal());
}
@@ -786,7 +809,7 @@ TEST(ScavengeExternalString) {
i::FLAG_stress_compaction = false;
i::FLAG_gc_global = false;
int dispose_count = 0;
- bool in_new_space = false;
+ bool in_young_generation = false;
{
v8::HandleScope scope(CcTest::isolate());
uint16_t* two_byte_string = AsciiToTwoByteString("test string");
@@ -797,11 +820,12 @@ TEST(ScavengeExternalString) {
.ToLocalChecked();
i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
CcTest::CollectGarbage(i::NEW_SPACE);
- in_new_space = i::Heap::InNewSpace(*istring);
- CHECK(in_new_space || CcTest::heap()->old_space()->Contains(*istring));
+ in_young_generation = i::Heap::InYoungGeneration(*istring);
+ CHECK_IMPLIES(!in_young_generation,
+ CcTest::heap()->old_space()->Contains(*istring));
CHECK_EQ(0, dispose_count);
}
- CcTest::CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_SPACE);
+ CcTest::CollectGarbage(in_young_generation ? i::NEW_SPACE : i::OLD_SPACE);
CHECK_EQ(1, dispose_count);
}
@@ -810,7 +834,7 @@ TEST(ScavengeExternalOneByteString) {
i::FLAG_stress_compaction = false;
i::FLAG_gc_global = false;
int dispose_count = 0;
- bool in_new_space = false;
+ bool in_young_generation = false;
{
v8::HandleScope scope(CcTest::isolate());
const char* one_byte_string = "test string";
@@ -821,11 +845,12 @@ TEST(ScavengeExternalOneByteString) {
.ToLocalChecked();
i::Handle<i::String> istring = v8::Utils::OpenHandle(*string);
CcTest::CollectGarbage(i::NEW_SPACE);
- in_new_space = i::Heap::InNewSpace(*istring);
- CHECK(in_new_space || CcTest::heap()->old_space()->Contains(*istring));
+ in_young_generation = i::Heap::InYoungGeneration(*istring);
+ CHECK_IMPLIES(!in_young_generation,
+ CcTest::heap()->old_space()->Contains(*istring));
CHECK_EQ(0, dispose_count);
}
- CcTest::CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_SPACE);
+ CcTest::CollectGarbage(in_young_generation ? i::NEW_SPACE : i::OLD_SPACE);
CHECK_EQ(1, dispose_count);
}
@@ -2813,7 +2838,7 @@ TEST(InternalFieldsSubclassing) {
if (in_object_only) {
CHECK_LE(nof_properties, i_value->map()->GetInObjectProperties());
} else {
- CHECK_LE(kMaxNofProperties, i_value->map()->GetInObjectProperties());
+ CHECK_LE(i_value->map()->GetInObjectProperties(), kMaxNofProperties);
}
// Make Sure we get the precise property count.
@@ -2824,7 +2849,7 @@ TEST(InternalFieldsSubclassing) {
if (in_object_only) {
CHECK_EQ(nof_properties, i_value->map()->GetInObjectProperties());
} else {
- CHECK_LE(kMaxNofProperties, i_value->map()->GetInObjectProperties());
+ CHECK_LE(i_value->map()->GetInObjectProperties(), kMaxNofProperties);
}
}
}
@@ -7361,7 +7386,8 @@ static const char* kSimpleExtensionSource =
TEST(SimpleExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(new Extension("simpletest", kSimpleExtensionSource));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("simpletest", kSimpleExtensionSource));
const char* extension_names[] = {"simpletest"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7383,8 +7409,8 @@ static const char* kStackTraceFromExtensionSource =
TEST(StackTraceInExtension) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(
- new Extension("stacktracetest", kStackTraceFromExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ "stacktracetest", kStackTraceFromExtensionSource));
const char* extension_names[] = {"stacktracetest"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7401,7 +7427,7 @@ TEST(StackTraceInExtension) {
TEST(NullExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(new Extension("nulltest", nullptr));
+ v8::RegisterExtension(v8::base::make_unique<Extension>("nulltest", nullptr));
const char* extension_names[] = {"nulltest"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7419,8 +7445,8 @@ static const int kEmbeddedExtensionSourceValidLen = 34;
TEST(ExtensionMissingSourceLength) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(
- new Extension("srclentest_fail", kEmbeddedExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ "srclentest_fail", kEmbeddedExtensionSource));
const char* extension_names[] = {"srclentest_fail"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7434,9 +7460,9 @@ TEST(ExtensionWithSourceLength) {
v8::HandleScope handle_scope(CcTest::isolate());
i::ScopedVector<char> extension_name(32);
i::SNPrintF(extension_name, "ext #%d", source_len);
- v8::RegisterExtension(new Extension(extension_name.start(),
- kEmbeddedExtensionSource, 0, nullptr,
- source_len));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ extension_name.start(), kEmbeddedExtensionSource, 0, nullptr,
+ source_len));
const char* extension_names[1] = {extension_name.start()};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7473,8 +7499,10 @@ static const char* kEvalExtensionSource2 =
TEST(UseEvalFromExtension) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(new Extension("evaltest1", kEvalExtensionSource1));
- v8::RegisterExtension(new Extension("evaltest2", kEvalExtensionSource2));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("evaltest1", kEvalExtensionSource1));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("evaltest2", kEvalExtensionSource2));
const char* extension_names[] = {"evaltest1", "evaltest2"};
v8::ExtensionConfiguration extensions(2, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7507,8 +7535,10 @@ static const char* kWithExtensionSource2 =
TEST(UseWithFromExtension) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(new Extension("withtest1", kWithExtensionSource1));
- v8::RegisterExtension(new Extension("withtest2", kWithExtensionSource2));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("withtest1", kWithExtensionSource1));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("withtest2", kWithExtensionSource2));
const char* extension_names[] = {"withtest1", "withtest2"};
v8::ExtensionConfiguration extensions(2, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7524,9 +7554,10 @@ TEST(UseWithFromExtension) {
TEST(AutoExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- Extension* extension = new Extension("autotest", kSimpleExtensionSource);
+ auto extension =
+ v8::base::make_unique<Extension>("autotest", kSimpleExtensionSource);
extension->set_auto_enable(true);
- v8::RegisterExtension(extension);
+ v8::RegisterExtension(std::move(extension));
v8::Local<Context> context = Context::New(CcTest::isolate());
Context::Scope lock(context);
v8::Local<Value> result = CompileRun("Foo()");
@@ -7542,8 +7573,8 @@ static const char* kSyntaxErrorInExtensionSource = "[";
// error but results in an empty context.
TEST(SyntaxErrorExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(
- new Extension("syntaxerror", kSyntaxErrorInExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ "syntaxerror", kSyntaxErrorInExtensionSource));
const char* extension_names[] = {"syntaxerror"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7558,8 +7589,8 @@ static const char* kExceptionInExtensionSource = "throw 42";
// a fatal error but results in an empty context.
TEST(ExceptionExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(
- new Extension("exception", kExceptionInExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ "exception", kExceptionInExtensionSource));
const char* extension_names[] = {"exception"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7577,8 +7608,8 @@ static const char* kNativeCallTest =
// Test that a native runtime calls are supported in extensions.
TEST(NativeCallInExtensions) {
v8::HandleScope handle_scope(CcTest::isolate());
- v8::RegisterExtension(
- new Extension("nativecall", kNativeCallInExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<Extension>(
+ "nativecall", kNativeCallInExtensionSource));
const char* extension_names[] = {"nativecall"};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7612,8 +7643,8 @@ class NativeFunctionExtension : public Extension {
TEST(NativeFunctionDeclaration) {
v8::HandleScope handle_scope(CcTest::isolate());
const char* name = "nativedecl";
- v8::RegisterExtension(
- new NativeFunctionExtension(name, "native function foo();"));
+ v8::RegisterExtension(v8::base::make_unique<NativeFunctionExtension>(
+ name, "native function foo();"));
const char* extension_names[] = {name};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7628,8 +7659,8 @@ TEST(NativeFunctionDeclarationError) {
v8::HandleScope handle_scope(CcTest::isolate());
const char* name = "nativedeclerr";
// Syntax error in extension code.
- v8::RegisterExtension(
- new NativeFunctionExtension(name, "native\nfunction foo();"));
+ v8::RegisterExtension(v8::base::make_unique<NativeFunctionExtension>(
+ name, "native\nfunction foo();"));
const char* extension_names[] = {name};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7642,8 +7673,8 @@ TEST(NativeFunctionDeclarationErrorEscape) {
const char* name = "nativedeclerresc";
// Syntax error in extension code - escape code in "native" means that
// it's not treated as a keyword.
- v8::RegisterExtension(
- new NativeFunctionExtension(name, "nativ\\u0065 function foo();"));
+ v8::RegisterExtension(v8::base::make_unique<NativeFunctionExtension>(
+ name, "nativ\\u0065 function foo();"));
const char* extension_names[] = {name};
v8::ExtensionConfiguration extensions(1, extension_names);
v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions);
@@ -7673,13 +7704,18 @@ static void CheckDependencies(const char* name, const char* expected) {
*/
THREADED_TEST(ExtensionDependency) {
static const char* kEDeps[] = {"D"};
- v8::RegisterExtension(new Extension("E", "this.loaded += 'E';", 1, kEDeps));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("E", "this.loaded += 'E';", 1, kEDeps));
static const char* kDDeps[] = {"B", "C"};
- v8::RegisterExtension(new Extension("D", "this.loaded += 'D';", 2, kDDeps));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("D", "this.loaded += 'D';", 2, kDDeps));
static const char* kBCDeps[] = {"A"};
- v8::RegisterExtension(new Extension("B", "this.loaded += 'B';", 1, kBCDeps));
- v8::RegisterExtension(new Extension("C", "this.loaded += 'C';", 1, kBCDeps));
- v8::RegisterExtension(new Extension("A", "this.loaded += 'A';"));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("B", "this.loaded += 'B';", 1, kBCDeps));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("C", "this.loaded += 'C';", 1, kBCDeps));
+ v8::RegisterExtension(
+ v8::base::make_unique<Extension>("A", "this.loaded += 'A';"));
CheckDependencies("A", "undefinedA");
CheckDependencies("B", "undefinedAB");
CheckDependencies("C", "undefinedAC");
@@ -7751,7 +7787,7 @@ v8::Local<v8::FunctionTemplate> FunctionExtension::GetNativeFunctionTemplate(
THREADED_TEST(FunctionLookup) {
- v8::RegisterExtension(new FunctionExtension());
+ v8::RegisterExtension(v8::base::make_unique<FunctionExtension>());
v8::HandleScope handle_scope(CcTest::isolate());
static const char* exts[1] = {"functiontest"};
v8::ExtensionConfiguration config(1, exts);
@@ -7770,7 +7806,7 @@ THREADED_TEST(FunctionLookup) {
THREADED_TEST(NativeFunctionConstructCall) {
- v8::RegisterExtension(new FunctionExtension());
+ v8::RegisterExtension(v8::base::make_unique<FunctionExtension>());
v8::HandleScope handle_scope(CcTest::isolate());
static const char* exts[1] = {"functiontest"};
v8::ExtensionConfiguration config(1, exts);
@@ -7807,9 +7843,9 @@ void StoringErrorCallback(const char* location, const char* message) {
TEST(ErrorReporting) {
CcTest::isolate()->SetFatalErrorHandler(StoringErrorCallback);
static const char* aDeps[] = {"B"};
- v8::RegisterExtension(new Extension("A", "", 1, aDeps));
+ v8::RegisterExtension(v8::base::make_unique<Extension>("A", "", 1, aDeps));
static const char* bDeps[] = {"A"};
- v8::RegisterExtension(new Extension("B", "", 1, bDeps));
+ v8::RegisterExtension(v8::base::make_unique<Extension>("B", "", 1, bDeps));
last_location = nullptr;
v8::ExtensionConfiguration config(1, bDeps);
v8::Local<Context> context = Context::New(CcTest::isolate(), &config);
@@ -10940,7 +10976,6 @@ static void ShadowIndexedGet(uint32_t index,
static void ShadowNamedGet(Local<Name> key,
const v8::PropertyCallbackInfo<v8::Value>&) {}
-
THREADED_TEST(ShadowObject) {
shadow_y = shadow_y_setter_call_count = shadow_y_getter_call_count = 0;
v8::Isolate* isolate = CcTest::isolate();
@@ -10991,198 +11026,103 @@ THREADED_TEST(ShadowObject) {
CHECK_EQ(42, value->Int32Value(context.local()).FromJust());
}
-
-THREADED_TEST(HiddenPrototype) {
- LocalContext context;
- v8::Isolate* isolate = context->GetIsolate();
+THREADED_TEST(ShadowObjectAndDataProperty) {
+ // Lite mode doesn't make use of feedback vectors, which is what we
+ // want to ensure has the correct form.
+ if (i::FLAG_lite_mode) return;
+ // This test mimics the kind of shadow property the Chromium embedder
+ // uses for undeclared globals. The IC subsystem has special handling
+ // for this case, using a PREMONOMORPHIC state to delay entering
+ // MONOMORPHIC state until enough information is available to support
+ // efficient access and good feedback for optimization.
+ v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
- Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate);
- t0->InstanceTemplate()->Set(v8_str("x"), v8_num(0));
- Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
- t1->SetHiddenPrototype(true);
- t1->InstanceTemplate()->Set(v8_str("y"), v8_num(1));
- Local<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(isolate);
- t2->SetHiddenPrototype(true);
- t2->InstanceTemplate()->Set(v8_str("z"), v8_num(2));
- Local<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(isolate);
- t3->InstanceTemplate()->Set(v8_str("u"), v8_num(3));
-
- Local<v8::Object> o0 = t0->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::Object> o1 = t1->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::Object> o2 = t2->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::Object> o3 = t3->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
+ Local<ObjectTemplate> global_template = v8::ObjectTemplate::New(isolate);
+ LocalContext context(nullptr, global_template);
- // Setting the prototype on an object skips hidden prototypes.
- CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(o0->Set(context.local(), v8_str("__proto__"), o1).FromJust());
- CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(o0->Set(context.local(), v8_str("__proto__"), o2).FromJust());
- CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(2, o0->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(o0->Set(context.local(), v8_str("__proto__"), o3).FromJust());
- CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(1, o0->Get(context.local(), v8_str("y"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(2, o0->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(3, o0->Get(context.local(), v8_str("u"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
+ Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
+ t->InstanceTemplate()->SetHandler(
+ v8::NamedPropertyHandlerConfiguration(ShadowNamedGet));
- // Getting the prototype of o0 should get the first visible one
- // which is o3. Therefore, z should not be defined on the prototype
- // object.
- Local<Value> proto =
- o0->Get(context.local(), v8_str("__proto__")).ToLocalChecked();
- CHECK(proto->IsObject());
- CHECK(proto.As<v8::Object>()
- ->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->IsUndefined());
-}
+ Local<Value> o = t->GetFunction(context.local())
+ .ToLocalChecked()
+ ->NewInstance(context.local())
+ .ToLocalChecked();
+ CHECK(context->Global()
+ ->Set(context.local(), v8_str("__proto__"), o)
+ .FromJust());
+ CompileRun(
+ "function foo(x) { i = x; }"
+ "foo(0)");
+
+ i::Handle<i::JSFunction> foo(i::Handle<i::JSFunction>::cast(
+ v8::Utils::OpenHandle(*context->Global()
+ ->Get(context.local(), v8_str("foo"))
+ .ToLocalChecked())));
+ CHECK(foo->has_feedback_vector());
+ i::FeedbackSlot slot = i::FeedbackVector::ToSlot(0);
+ i::FeedbackNexus nexus(foo->feedback_vector(), slot);
+ CHECK_EQ(i::FeedbackSlotKind::kStoreGlobalSloppy, nexus.kind());
+ CHECK_EQ(i::PREMONOMORPHIC, nexus.ic_state());
+ CompileRun("foo(1)");
+ CHECK_EQ(i::MONOMORPHIC, nexus.ic_state());
+ // We go a bit further, checking that the form of monomorphism is
+ // a PropertyCell in the vector. This is because we want to make sure
+ // we didn't settle for a "poor man's monomorphism," such as a
+ // slow_stub bailout which would mean a trip to the runtime on all
+ // subsequent stores, and a lack of feedback for the optimizing
+ // compiler downstream.
+ i::HeapObject heap_object;
+ CHECK(nexus.GetFeedback().GetHeapObject(&heap_object));
+ CHECK(heap_object->IsPropertyCell());
+}
+
+THREADED_TEST(ShadowObjectAndDataPropertyTurbo) {
+ // This test is the same as the previous one except that it triggers
+ // optimization of {foo} after its first invocation.
+ i::FLAG_allow_natives_syntax = true;
-THREADED_TEST(HiddenPrototypeSet) {
- LocalContext context;
- v8::Isolate* isolate = context->GetIsolate();
+ if (i::FLAG_lite_mode) return;
+ v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
- Local<v8::FunctionTemplate> ot = v8::FunctionTemplate::New(isolate);
- Local<v8::FunctionTemplate> ht = v8::FunctionTemplate::New(isolate);
- ht->SetHiddenPrototype(true);
- Local<v8::FunctionTemplate> pt = v8::FunctionTemplate::New(isolate);
- ht->InstanceTemplate()->Set(v8_str("x"), v8_num(0));
-
- Local<v8::Object> o = ot->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::Object> h = ht->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::Object> p = pt->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- CHECK(o->Set(context.local(), v8_str("__proto__"), h).FromJust());
- CHECK(h->Set(context.local(), v8_str("__proto__"), p).FromJust());
-
- // Setting a property that exists on the hidden prototype goes there.
- CHECK(o->Set(context.local(), v8_str("x"), v8_num(7)).FromJust());
- CHECK_EQ(7, o->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(7, h->Get(context.local(), v8_str("x"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(p->Get(context.local(), v8_str("x")).ToLocalChecked()->IsUndefined());
-
- // Setting a new property should not be forwarded to the hidden prototype.
- CHECK(o->Set(context.local(), v8_str("y"), v8_num(6)).FromJust());
- CHECK_EQ(6, o->Get(context.local(), v8_str("y"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(h->Get(context.local(), v8_str("y")).ToLocalChecked()->IsUndefined());
- CHECK(p->Get(context.local(), v8_str("y")).ToLocalChecked()->IsUndefined());
-
- // Setting a property that only exists on a prototype of the hidden prototype
- // is treated normally again.
- CHECK(p->Set(context.local(), v8_str("z"), v8_num(8)).FromJust());
- CHECK_EQ(8, o->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(8, h->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(8, p->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK(o->Set(context.local(), v8_str("z"), v8_num(9)).FromJust());
- CHECK_EQ(9, o->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(8, h->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(8, p->Get(context.local(), v8_str("z"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
-}
-
+ Local<ObjectTemplate> global_template = v8::ObjectTemplate::New(isolate);
+ LocalContext context(nullptr, global_template);
-// Regression test for issue 2457.
-THREADED_TEST(HiddenPrototypeIdentityHash) {
- LocalContext context;
- v8::HandleScope handle_scope(context->GetIsolate());
+ Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate);
+ t->InstanceTemplate()->SetHandler(
+ v8::NamedPropertyHandlerConfiguration(ShadowNamedGet));
- Local<FunctionTemplate> t = FunctionTemplate::New(context->GetIsolate());
- t->SetHiddenPrototype(true);
- t->InstanceTemplate()->Set(v8_str("foo"), v8_num(75));
- Local<Object> p = t->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<Object> o = Object::New(context->GetIsolate());
- CHECK(o->SetPrototype(context.local(), p).FromJust());
+ Local<Value> o = t->GetFunction(context.local())
+ .ToLocalChecked()
+ ->NewInstance(context.local())
+ .ToLocalChecked();
+ CHECK(context->Global()
+ ->Set(context.local(), v8_str("__proto__"), o)
+ .FromJust());
- int hash = o->GetIdentityHash();
- USE(hash);
- CHECK(o->Set(context.local(), v8_str("foo"), v8_num(42)).FromJust());
- CHECK_EQ(hash, o->GetIdentityHash());
+ CompileRun(
+ "function foo(x) { i = x; }"
+ "foo(0)");
+
+ i::Handle<i::JSFunction> foo(i::Handle<i::JSFunction>::cast(
+ v8::Utils::OpenHandle(*context->Global()
+ ->Get(context.local(), v8_str("foo"))
+ .ToLocalChecked())));
+ CHECK(foo->has_feedback_vector());
+ i::FeedbackSlot slot = i::FeedbackVector::ToSlot(0);
+ i::FeedbackNexus nexus(foo->feedback_vector(), slot);
+ CHECK_EQ(i::FeedbackSlotKind::kStoreGlobalSloppy, nexus.kind());
+ CHECK_EQ(i::PREMONOMORPHIC, nexus.ic_state());
+ CompileRun("%OptimizeFunctionOnNextCall(foo); foo(1)");
+ CHECK_EQ(i::MONOMORPHIC, nexus.ic_state());
+ i::HeapObject heap_object;
+ CHECK(nexus.GetFeedback().GetHeapObject(&heap_object));
+ CHECK(heap_object->IsPropertyCell());
}
-
THREADED_TEST(SetPrototype) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
@@ -11191,10 +11131,8 @@ THREADED_TEST(SetPrototype) {
Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate);
t0->InstanceTemplate()->Set(v8_str("x"), v8_num(0));
Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
- t1->SetHiddenPrototype(true);
t1->InstanceTemplate()->Set(v8_str("y"), v8_num(1));
Local<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(isolate);
- t2->SetHiddenPrototype(true);
t2->InstanceTemplate()->Set(v8_str("z"), v8_num(2));
Local<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(isolate);
t3->InstanceTemplate()->Set(v8_str("u"), v8_num(3));
@@ -11216,7 +11154,6 @@ THREADED_TEST(SetPrototype) {
->NewInstance(context.local())
.ToLocalChecked();
- // Setting the prototype on an object does not skip hidden prototypes.
CHECK_EQ(0, o0->Get(context.local(), v8_str("x"))
.ToLocalChecked()
->Int32Value(context.local())
@@ -11261,15 +11198,11 @@ THREADED_TEST(SetPrototype) {
->Int32Value(context.local())
.FromJust());
- // Getting the prototype of o0 should get the first visible one
- // which is o3. Therefore, z should not be defined on the prototype
- // object.
Local<Value> proto =
o0->Get(context.local(), v8_str("__proto__")).ToLocalChecked();
CHECK(proto->IsObject());
- CHECK(proto.As<v8::Object>()->Equals(context.local(), o3).FromJust());
+ CHECK(proto.As<v8::Object>()->Equals(context.local(), o1).FromJust());
- // However, Object::GetPrototype ignores hidden prototype.
Local<Value> proto0 = o0->GetPrototype();
CHECK(proto0->IsObject());
CHECK(proto0.As<v8::Object>()->Equals(context.local(), o1).FromJust());
@@ -11294,16 +11227,13 @@ THREADED_TEST(Regress91517) {
v8::HandleScope handle_scope(isolate);
Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
- t1->SetHiddenPrototype(true);
t1->InstanceTemplate()->Set(v8_str("foo"), v8_num(1));
Local<v8::FunctionTemplate> t2 = v8::FunctionTemplate::New(isolate);
- t2->SetHiddenPrototype(true);
t2->InstanceTemplate()->Set(v8_str("fuz1"), v8_num(2));
t2->InstanceTemplate()->Set(v8_str("objects"),
v8::ObjectTemplate::New(isolate));
t2->InstanceTemplate()->Set(v8_str("fuz2"), v8_num(2));
Local<v8::FunctionTemplate> t3 = v8::FunctionTemplate::New(isolate);
- t3->SetHiddenPrototype(true);
t3->InstanceTemplate()->Set(v8_str("boo"), v8_num(3));
Local<v8::FunctionTemplate> t4 = v8::FunctionTemplate::New(isolate);
t4->InstanceTemplate()->Set(v8_str("baz"), v8_num(4));
@@ -11332,7 +11262,6 @@ THREADED_TEST(Regress91517) {
->NewInstance(context.local())
.ToLocalChecked();
- // Create prototype chain of hidden prototypes.
CHECK(o4->SetPrototype(context.local(), o3).FromJust());
CHECK(o3->SetPrototype(context.local(), o2).FromJust());
CHECK(o2->SetPrototype(context.local(), o1).FromJust());
@@ -11343,79 +11272,14 @@ THREADED_TEST(Regress91517) {
// PROPERTY_FILTER_NONE = 0
CompileRun("var names = %GetOwnPropertyKeys(obj, 0);");
- ExpectInt32("names.length", 1006);
+ ExpectInt32("names.length", 1);
ExpectTrue("names.indexOf(\"baz\") >= 0");
- ExpectTrue("names.indexOf(\"boo\") >= 0");
- ExpectTrue("names.indexOf(\"foo\") >= 0");
- ExpectTrue("names.indexOf(\"fuz1\") >= 0");
- ExpectTrue("names.indexOf(\"objects\") >= 0");
- ExpectTrue("names.indexOf(\"fuz2\") >= 0");
- ExpectFalse("names[1005] == undefined");
-}
-
-
-// Getting property names of an object with a hidden and inherited
-// prototype should not duplicate the accessor properties inherited.
-THREADED_TEST(Regress269562) {
- i::FLAG_allow_natives_syntax = true;
- LocalContext context;
- v8::HandleScope handle_scope(context->GetIsolate());
-
- Local<v8::FunctionTemplate> t1 =
- v8::FunctionTemplate::New(context->GetIsolate());
- t1->SetHiddenPrototype(true);
-
- Local<v8::ObjectTemplate> i1 = t1->InstanceTemplate();
- i1->SetAccessor(v8_str("foo"),
- SimpleAccessorGetter, SimpleAccessorSetter);
- i1->SetAccessor(v8_str("bar"),
- SimpleAccessorGetter, SimpleAccessorSetter);
- i1->SetAccessor(v8_str("baz"),
- SimpleAccessorGetter, SimpleAccessorSetter);
- i1->Set(v8_str("n1"), v8_num(1));
- i1->Set(v8_str("n2"), v8_num(2));
-
- Local<v8::Object> o1 = t1->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- Local<v8::FunctionTemplate> t2 =
- v8::FunctionTemplate::New(context->GetIsolate());
- t2->SetHiddenPrototype(true);
-
- // Inherit from t1 and mark prototype as hidden.
- t2->Inherit(t1);
- t2->InstanceTemplate()->Set(v8_str("mine"), v8_num(4));
-
- Local<v8::Object> o2 = t2->GetFunction(context.local())
- .ToLocalChecked()
- ->NewInstance(context.local())
- .ToLocalChecked();
- CHECK(o2->SetPrototype(context.local(), o1).FromJust());
-
- v8::Local<v8::Symbol> sym =
- v8::Symbol::New(context->GetIsolate(), v8_str("s1"));
- CHECK(o1->Set(context.local(), sym, v8_num(3)).FromJust());
- o1->SetPrivate(context.local(),
- v8::Private::New(context->GetIsolate(), v8_str("h1")),
- v8::Integer::New(context->GetIsolate(), 2013))
- .FromJust();
-
- // Call the runtime version of GetOwnPropertyNames() on
- // the natively created object through JavaScript.
- CHECK(context->Global()->Set(context.local(), v8_str("obj"), o2).FromJust());
- CHECK(context->Global()->Set(context.local(), v8_str("sym"), sym).FromJust());
- // PROPERTY_FILTER_NONE = 0
- CompileRun("var names = %GetOwnPropertyKeys(obj, 0);");
-
- ExpectInt32("names.length", 7);
- ExpectTrue("names.indexOf(\"foo\") >= 0");
- ExpectTrue("names.indexOf(\"bar\") >= 0");
- ExpectTrue("names.indexOf(\"baz\") >= 0");
- ExpectTrue("names.indexOf(\"n1\") >= 0");
- ExpectTrue("names.indexOf(\"n2\") >= 0");
- ExpectTrue("names.indexOf(sym) >= 0");
- ExpectTrue("names.indexOf(\"mine\") >= 0");
+ ExpectFalse("names.indexOf(\"boo\") >= 0");
+ ExpectFalse("names.indexOf(\"foo\") >= 0");
+ ExpectFalse("names.indexOf(\"fuz1\") >= 0");
+ ExpectFalse("names.indexOf(\"objects\") >= 0");
+ ExpectFalse("names.indexOf(\"fuz2\") >= 0");
+ ExpectTrue("names[1005] == undefined");
}
@@ -12278,30 +12142,28 @@ THREADED_TEST(CallICFastApi_DirectCall_GCMoveStub) {
.FromJust());
// call the api function multiple times to ensure direct call stub creation.
CompileRun(
- "function f() {"
- " for (var i = 1; i <= 30; i++) {"
- " nativeobject.callback();"
- " }"
- "}"
- "f();");
+ "function f() {"
+ " for (var i = 1; i <= 30; i++) {"
+ " nativeobject.callback();"
+ " }"
+ "}"
+ "f();");
}
-
void ThrowingDirectApiCallback(
const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetIsolate()->ThrowException(v8_str("g"));
}
-
THREADED_TEST(CallICFastApi_DirectCall_Throw) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
v8::Local<v8::ObjectTemplate> nativeobject_templ =
v8::ObjectTemplate::New(isolate);
- nativeobject_templ->Set(isolate, "callback",
- v8::FunctionTemplate::New(isolate,
- ThrowingDirectApiCallback));
+ nativeobject_templ->Set(
+ isolate, "callback",
+ v8::FunctionTemplate::New(isolate, ThrowingDirectApiCallback));
v8::Local<v8::Object> nativeobject_obj =
nativeobject_templ->NewInstance(context.local()).ToLocalChecked();
CHECK(context->Global()
@@ -12319,10 +12181,8 @@ THREADED_TEST(CallICFastApi_DirectCall_Throw) {
CHECK(v8_str("ggggg")->Equals(context.local(), result).FromJust());
}
-
static int p_getter_count_3;
-
static Local<Value> DoDirectGetter() {
if (++p_getter_count_3 % 3 == 0) {
CcTest::CollectAllGarbage();
@@ -12331,16 +12191,13 @@ static Local<Value> DoDirectGetter() {
return v8_str("Direct Getter Result");
}
-
static void DirectGetterCallback(
- Local<String> name,
- const v8::PropertyCallbackInfo<v8::Value>& info) {
+ Local<String> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
CheckReturnValue(info, FUNCTION_ADDR(DirectGetterCallback));
info.GetReturnValue().Set(DoDirectGetter());
}
-
-template<typename Accessor>
+template <typename Accessor>
static void LoadICFastApi_DirectCall_GCMoveStub(Accessor accessor) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
@@ -12364,19 +12221,15 @@ static void LoadICFastApi_DirectCall_GCMoveStub(Accessor accessor) {
CHECK_EQ(31, p_getter_count_3);
}
-
THREADED_PROFILED_TEST(LoadICFastApi_DirectCall_GCMoveStub) {
LoadICFastApi_DirectCall_GCMoveStub(DirectGetterCallback);
}
-
void ThrowingDirectGetterCallback(
- Local<String> name,
- const v8::PropertyCallbackInfo<v8::Value>& info) {
+ Local<String> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
info.GetIsolate()->ThrowException(v8_str("g"));
}
-
THREADED_TEST(LoadICFastApi_DirectCall_Throw) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
@@ -12396,7 +12249,6 @@ THREADED_TEST(LoadICFastApi_DirectCall_Throw) {
CHECK(v8_str("ggggg")->Equals(context.local(), result).FromJust());
}
-
THREADED_PROFILED_TEST(InterceptorCallICFastApi_TrivialSignature) {
int interceptor_call_count = 0;
v8::Isolate* isolate = CcTest::isolate();
@@ -12433,259 +12285,6 @@ THREADED_PROFILED_TEST(InterceptorCallICFastApi_TrivialSignature) {
CHECK_EQ(100, interceptor_call_count);
}
-
-THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature) {
- int interceptor_call_count = 0;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- InterceptorCallICFastApi, nullptr, nullptr, nullptr, nullptr,
- v8::External::New(isolate, &interceptor_call_count)));
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- "}");
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(100, interceptor_call_count);
-}
-
-
-THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss1) {
- int interceptor_call_count = 0;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- InterceptorCallICFastApi, nullptr, nullptr, nullptr, nullptr,
- v8::External::New(isolate, &interceptor_call_count)));
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = {method: function(x) { return x - 1 }};"
- " }"
- "}");
- CHECK_EQ(40, context->Global()
- ->Get(context.local(), v8_str("result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_GE(interceptor_call_count, 50);
-}
-
-
-THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss2) {
- int interceptor_call_count = 0;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- InterceptorCallICFastApi, nullptr, nullptr, nullptr, nullptr,
- v8::External::New(isolate, &interceptor_call_count)));
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " o.method = function(x) { return x - 1 };"
- " }"
- "}");
- CHECK_EQ(40, context->Global()
- ->Get(context.local(), v8_str("result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_GE(interceptor_call_count, 50);
-}
-
-
-THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_Miss3) {
- int interceptor_call_count = 0;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- InterceptorCallICFastApi, nullptr, nullptr, nullptr, nullptr,
- v8::External::New(isolate, &interceptor_call_count)));
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- v8::TryCatch try_catch(isolate);
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = 333;"
- " }"
- "}");
- CHECK(try_catch.HasCaught());
- // TODO(verwaest): Adjust message.
- CHECK(
- v8_str("TypeError: receiver.method is not a function")
- ->Equals(
- context.local(),
- try_catch.Exception()->ToString(context.local()).ToLocalChecked())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_GE(interceptor_call_count, 50);
-}
-
-
-THREADED_PROFILED_TEST(InterceptorCallICFastApi_SimpleSignature_TypeError) {
- int interceptor_call_count = 0;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ = fun_templ->InstanceTemplate();
- templ->SetHandler(v8::NamedPropertyHandlerConfiguration(
- InterceptorCallICFastApi, nullptr, nullptr, nullptr, nullptr,
- v8::External::New(isolate, &interceptor_call_count)));
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- v8::TryCatch try_catch(isolate);
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = {method: receiver.method};"
- " }"
- "}");
- CHECK(try_catch.HasCaught());
- CHECK(
- v8_str("TypeError: Illegal invocation")
- ->Equals(
- context.local(),
- try_catch.Exception()->ToString(context.local()).ToLocalChecked())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_GE(interceptor_call_count, 50);
-}
-
-
THREADED_PROFILED_TEST(CallICFastApi_TrivialSignature) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope scope(isolate);
@@ -12719,193 +12318,6 @@ THREADED_PROFILED_TEST(CallICFastApi_TrivialSignature) {
.FromJust());
}
-
-THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature) {
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
- CHECK(!templ.IsEmpty());
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- "}");
-
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
-}
-
-
-THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss1) {
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
- CHECK(!templ.IsEmpty());
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = {method: function(x) { return x - 1 }};"
- " }"
- "}");
- CHECK_EQ(40, context->Global()
- ->Get(context.local(), v8_str("result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
-}
-
-
-THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_Miss2) {
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
- CHECK(!templ.IsEmpty());
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- v8::TryCatch try_catch(isolate);
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = 333;"
- " }"
- "}");
- CHECK(try_catch.HasCaught());
- // TODO(verwaest): Adjust message.
- CHECK(
- v8_str("TypeError: receiver.method is not a function")
- ->Equals(
- context.local(),
- try_catch.Exception()->ToString(context.local()).ToLocalChecked())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
-}
-
-
-THREADED_PROFILED_TEST(CallICFastApi_SimpleSignature_TypeError) {
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::FunctionTemplate> fun_templ =
- v8::FunctionTemplate::New(isolate);
- v8::Local<v8::FunctionTemplate> method_templ = v8::FunctionTemplate::New(
- isolate, FastApiCallback_SimpleSignature, v8_str("method_data"),
- v8::Signature::New(isolate, fun_templ));
- v8::Local<v8::ObjectTemplate> proto_templ = fun_templ->PrototypeTemplate();
- proto_templ->Set(v8_str("method"), method_templ);
- fun_templ->SetHiddenPrototype(true);
- v8::Local<v8::ObjectTemplate> templ(fun_templ->InstanceTemplate());
- CHECK(!templ.IsEmpty());
- LocalContext context;
- v8::Local<v8::Function> fun =
- fun_templ->GetFunction(context.local()).ToLocalChecked();
- GenerateSomeGarbage();
- CHECK(context->Global()
- ->Set(context.local(), v8_str("o"),
- fun->NewInstance(context.local()).ToLocalChecked())
- .FromJust());
- v8::TryCatch try_catch(isolate);
- CompileRun(
- "o.foo = 17;"
- "var receiver = {};"
- "receiver.__proto__ = o;"
- "var result = 0;"
- "var saved_result = 0;"
- "for (var i = 0; i < 100; i++) {"
- " result = receiver.method(41);"
- " if (i == 50) {"
- " saved_result = result;"
- " receiver = Object.create(receiver);"
- " }"
- "}");
- CHECK(try_catch.HasCaught());
- CHECK(
- v8_str("TypeError: Illegal invocation")
- ->Equals(
- context.local(),
- try_catch.Exception()->ToString(context.local()).ToLocalChecked())
- .FromJust());
- CHECK_EQ(42, context->Global()
- ->Get(context.local(), v8_str("saved_result"))
- .ToLocalChecked()
- ->Int32Value(context.local())
- .FromJust());
-}
-
-
static void ThrowingGetter(Local<String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
ApiTestFuzzer::Fuzz();
@@ -15690,9 +15102,6 @@ TEST(CompileExternalTwoByteSource) {
}
}
-
-#ifndef V8_INTERPRETED_REGEXP
-
struct RegExpInterruptionData {
v8::base::Atomic32 loop_count;
UC16VectorResource* string_resource;
@@ -15768,9 +15177,6 @@ TEST(RegExpInterruption) {
i::DeleteArray(uc16_content);
}
-#endif // V8_INTERPRETED_REGEXP
-
-
// Test that we cannot set a property on the global object if there
// is a read-only property in the prototype chain.
TEST(ReadOnlyPropertyInGlobalProto) {
@@ -19012,16 +18418,9 @@ TEST(GetHeapSpaceStatistics) {
v8::HeapSpaceStatistics space_statistics;
isolate->GetHeapSpaceStatistics(&space_statistics, i);
CHECK_NOT_NULL(space_statistics.space_name());
- if (strcmp(space_statistics.space_name(), "new_large_object_space") == 0 ||
- strcmp(space_statistics.space_name(), "code_large_object_space") == 0) {
- continue;
- }
- CHECK_GT(space_statistics.space_size(), 0u);
total_size += space_statistics.space_size();
- CHECK_GT(space_statistics.space_used_size(), 0u);
total_used_size += space_statistics.space_used_size();
total_available_size += space_statistics.space_available_size();
- CHECK_GT(space_statistics.physical_space_size(), 0u);
total_physical_size += space_statistics.physical_space_size();
}
total_available_size += CcTest::heap()->memory_allocator()->Available();
@@ -21879,92 +21278,6 @@ THREADED_TEST(Regress1516) {
}
-THREADED_TEST(Regress93759) {
- v8::Isolate* isolate = CcTest::isolate();
- HandleScope scope(isolate);
-
- // Template for object with security check.
- Local<ObjectTemplate> no_proto_template = v8::ObjectTemplate::New(isolate);
- no_proto_template->SetAccessCheckCallback(AccessAlwaysBlocked);
-
- // Templates for objects with hidden prototypes and possibly security check.
- Local<FunctionTemplate> hidden_proto_template =
- v8::FunctionTemplate::New(isolate);
- hidden_proto_template->SetHiddenPrototype(true);
-
- Local<FunctionTemplate> protected_hidden_proto_template =
- v8::FunctionTemplate::New(isolate);
- protected_hidden_proto_template->InstanceTemplate()->SetAccessCheckCallback(
- AccessAlwaysBlocked);
- protected_hidden_proto_template->SetHiddenPrototype(true);
-
- // Context for "foreign" objects used in test.
- Local<Context> context = v8::Context::New(isolate);
- context->Enter();
-
- // Plain object, no security check.
- Local<Object> simple_object = Object::New(isolate);
-
- // Object with explicit security check.
- Local<Object> protected_object =
- no_proto_template->NewInstance(context).ToLocalChecked();
-
- // JSGlobalProxy object, always have security check.
- Local<Object> proxy_object = context->Global();
-
- // Global object, the prototype of proxy_object. No security checks.
- Local<Object> global_object =
- proxy_object->GetPrototype()->ToObject(context).ToLocalChecked();
-
- // Hidden prototype without security check.
- Local<Object> hidden_prototype = hidden_proto_template->GetFunction(context)
- .ToLocalChecked()
- ->NewInstance(context)
- .ToLocalChecked();
- Local<Object> object_with_hidden =
- Object::New(isolate);
- object_with_hidden->SetPrototype(context, hidden_prototype).FromJust();
-
- context->Exit();
-
- LocalContext context2;
- v8::Local<v8::Object> global = context2->Global();
-
- // Setup global variables.
- CHECK(global->Set(context2.local(), v8_str("simple"), simple_object)
- .FromJust());
- CHECK(global->Set(context2.local(), v8_str("protected"), protected_object)
- .FromJust());
- CHECK(global->Set(context2.local(), v8_str("global"), global_object)
- .FromJust());
- CHECK(
- global->Set(context2.local(), v8_str("proxy"), proxy_object).FromJust());
- CHECK(global->Set(context2.local(), v8_str("hidden"), object_with_hidden)
- .FromJust());
-
- Local<Value> result1 = CompileRun("Object.getPrototypeOf(simple)");
- CHECK(result1->Equals(context2.local(), simple_object->GetPrototype())
- .FromJust());
-
- Local<Value> result2 = CompileRun("Object.getPrototypeOf(protected)");
- CHECK(result2->IsNull());
-
- Local<Value> result3 = CompileRun("Object.getPrototypeOf(global)");
- CHECK(result3->Equals(context2.local(), global_object->GetPrototype())
- .FromJust());
-
- Local<Value> result4 = CompileRun("Object.getPrototypeOf(proxy)");
- CHECK(result4->IsNull());
-
- Local<Value> result5 = CompileRun("Object.getPrototypeOf(hidden)");
- CHECK(result5->Equals(context2.local(), object_with_hidden->GetPrototype()
- ->ToObject(context2.local())
- .ToLocalChecked()
- ->GetPrototype())
- .FromJust());
-}
-
-
static void TestReceiver(Local<Value> expected_result,
Local<Value> expected_receiver,
const char* code) {
@@ -23511,8 +22824,8 @@ TEST(AccessCheckThrows) {
CheckCorrectThrow("JSON.stringify(other)");
CheckCorrectThrow("has_own_property(other, 'x')");
CheckCorrectThrow("%GetProperty(other, 'x')");
- CheckCorrectThrow("%SetKeyedProperty(other, 'x', 'foo', 0)");
- CheckCorrectThrow("%SetNamedProperty(other, 'y', 'foo', 1)");
+ CheckCorrectThrow("%SetKeyedProperty(other, 'x', 'foo')");
+ CheckCorrectThrow("%SetNamedProperty(other, 'y', 'foo')");
STATIC_ASSERT(static_cast<int>(i::LanguageMode::kSloppy) == 0);
STATIC_ASSERT(static_cast<int>(i::LanguageMode::kStrict) == 1);
CheckCorrectThrow("%DeleteProperty(other, 'x', 0)"); // 0 == SLOPPY
@@ -24178,7 +23491,6 @@ class ApiCallOptimizationChecker {
{
Local<v8::FunctionTemplate> parent_template =
FunctionTemplate::New(isolate);
- parent_template->SetHiddenPrototype(true);
Local<v8::FunctionTemplate> function_template
= FunctionTemplate::New(isolate);
function_template->Inherit(parent_template);
@@ -24207,7 +23519,6 @@ class ApiCallOptimizationChecker {
// Get the holder objects.
Local<Object> inner_global =
Local<Object>::Cast(context->Global()->GetPrototype());
- // Install functions on hidden prototype object if there is one.
data = Object::New(isolate);
Local<FunctionTemplate> function_template = FunctionTemplate::New(
isolate, OptimizationCallback, data, signature);
@@ -24486,47 +23797,6 @@ TEST(ChainSignatureCheck) {
}
-TEST(PrototypeSignatureCheck) {
- LocalContext context;
- auto isolate = context->GetIsolate();
- v8::HandleScope scope(isolate);
- auto global = context->Global();
- auto sig_obj = FunctionTemplate::New(isolate);
- sig_obj->SetHiddenPrototype(true);
- auto sig = v8::Signature::New(isolate, sig_obj);
- auto x = FunctionTemplate::New(isolate, Returns42, Local<Value>(), sig);
- global->Set(context.local(), v8_str("sig_obj"),
- sig_obj->GetFunction(context.local()).ToLocalChecked())
- .FromJust();
- global->Set(context.local(), v8_str("x"),
- x->GetFunction(context.local()).ToLocalChecked())
- .FromJust();
- CompileRun("s = {}; s.__proto__ = new sig_obj();");
- {
- TryCatch try_catch(isolate);
- CompileRun("x()");
- CHECK(try_catch.HasCaught());
- }
- {
- TryCatch try_catch(isolate);
- CompileRun("x.call(1)");
- CHECK(try_catch.HasCaught());
- }
- {
- TryCatch try_catch(isolate);
- auto result = CompileRun("s.x = x; s.x()");
- CHECK(!try_catch.HasCaught());
- CHECK_EQ(42, result->Int32Value(context.local()).FromJust());
- }
- {
- TryCatch try_catch(isolate);
- auto result = CompileRun("x.call(s)");
- CHECK(!try_catch.HasCaught());
- CHECK_EQ(42, result->Int32Value(context.local()).FromJust());
- }
-}
-
-
static const char* last_event_message;
static int last_event_status;
void StoringEventLoggerCallback(const char* message, int status) {
@@ -28308,15 +27578,10 @@ void AtomicsWaitCallbackForTesting(
}
}
-TEST(AtomicsWaitCallback) {
- LocalContext env;
- v8::Isolate* isolate = env->GetIsolate();
- v8::HandleScope scope(isolate);
-
- Local<Value> sab = CompileRun(
- "sab = new SharedArrayBuffer(12);"
- "int32arr = new Int32Array(sab, 4);"
- "sab");
+// Must be called from within HandleScope
+void AtomicsWaitCallbackCommon(v8::Isolate* isolate, Local<Value> sab,
+ size_t initial_offset,
+ size_t offset_multiplier) {
CHECK(sab->IsSharedArrayBuffer());
AtomicsWaitCallbackInfo info;
@@ -28326,52 +27591,52 @@ TEST(AtomicsWaitCallback) {
{
v8::TryCatch try_catch(isolate);
- info.expected_offset = 4;
+ info.expected_offset = initial_offset;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 0;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kTerminatedExecution;
info.action = AtomicsWaitCallbackAction::Interrupt;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 0, 0);");
+ CompileRun("wait(0, 0);");
CHECK_EQ(info.ncalls, 2);
CHECK(try_catch.HasTerminated());
}
{
v8::TryCatch try_catch(isolate);
- info.expected_offset = 8;
+ info.expected_offset = initial_offset + offset_multiplier;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 1;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kNotEqual;
info.action = AtomicsWaitCallbackAction::KeepWaiting;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 1, 1);"); // real value is 0 != 1
+ CompileRun("wait(1, 1);"); // real value is 0 != 1
CHECK_EQ(info.ncalls, 2);
CHECK(!try_catch.HasCaught());
}
{
v8::TryCatch try_catch(isolate);
- info.expected_offset = 8;
+ info.expected_offset = initial_offset + offset_multiplier;
info.expected_timeout = 0.125;
info.expected_value = 0;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kTimedOut;
info.action = AtomicsWaitCallbackAction::KeepWaiting;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 1, 0, 0.125);"); // timeout
+ CompileRun("wait(1, 0, 0.125);"); // timeout
CHECK_EQ(info.ncalls, 2);
CHECK(!try_catch.HasCaught());
}
{
v8::TryCatch try_catch(isolate);
- info.expected_offset = 8;
+ info.expected_offset = initial_offset + offset_multiplier;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 0;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kAPIStopped;
info.action = AtomicsWaitCallbackAction::StopAndThrowInFirstCall;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 1, 0);");
+ CompileRun("wait(1, 0);");
CHECK_EQ(info.ncalls, 1); // Only one extra call
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsInt32());
@@ -28380,13 +27645,13 @@ TEST(AtomicsWaitCallback) {
{
v8::TryCatch try_catch(isolate);
- info.expected_offset = 8;
+ info.expected_offset = initial_offset + offset_multiplier;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 0;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kAPIStopped;
info.action = AtomicsWaitCallbackAction::StopAndThrowInSecondCall;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 1, 0);");
+ CompileRun("wait(1, 0);");
CHECK_EQ(info.ncalls, 2);
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsInt32());
@@ -28396,15 +27661,15 @@ TEST(AtomicsWaitCallback) {
{
// Same test as before, but with a different `expected_value`.
v8::TryCatch try_catch(isolate);
- info.expected_offset = 8;
+ info.expected_offset = initial_offset + offset_multiplier;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 200;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kAPIStopped;
info.action = AtomicsWaitCallbackAction::StopAndThrowInSecondCall;
info.ncalls = 0;
CompileRun(
- "int32arr[1] = 200;"
- "Atomics.wait(int32arr, 1, 200);");
+ "setArrayElemAs(1, 200);"
+ "wait(1, 200);");
CHECK_EQ(info.ncalls, 2);
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsInt32());
@@ -28414,13 +27679,15 @@ TEST(AtomicsWaitCallback) {
{
// Wake the `Atomics.wait()` call from a thread.
v8::TryCatch try_catch(isolate);
- info.expected_offset = 4;
+ info.expected_offset = initial_offset;
info.expected_timeout = std::numeric_limits<double>::infinity();
info.expected_value = 0;
info.expected_event = v8::Isolate::AtomicsWaitEvent::kAPIStopped;
info.action = AtomicsWaitCallbackAction::StopFromThreadAndThrow;
info.ncalls = 0;
- CompileRun("Atomics.wait(int32arr, 0, 0);");
+ CompileRun(
+ "setArrayElemAs(1, 0);"
+ "wait(0, 0);");
CHECK_EQ(info.ncalls, 2);
CHECK(try_catch.HasCaught());
CHECK(try_catch.Exception()->IsInt32());
@@ -28428,6 +27695,105 @@ TEST(AtomicsWaitCallback) {
}
}
+TEST(AtomicsWaitCallback) {
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+ const char* init = R"(
+ let sab = new SharedArrayBuffer(16);
+ let int32arr = new Int32Array(sab, 4);
+ let setArrayElemAs = function(id, val) {
+ int32arr[id] = val;
+ };
+ let wait = function(id, val, timeout) {
+ if(arguments.length == 2) return Atomics.wait(int32arr, id, val);
+ return Atomics.wait(int32arr, id, val, timeout);
+ };
+ sab;)";
+ AtomicsWaitCallbackCommon(isolate, CompileRun(init), 4, 4);
+}
+
+namespace v8 {
+namespace internal {
+namespace wasm {
+TEST(WasmI32AtomicWaitCallback) {
+ FlagScope<bool> wasm_threads_flag(&i::FLAG_experimental_wasm_threads, true);
+ WasmRunner<int32_t, int32_t, int32_t, double> r(ExecutionTier::kOptimized);
+ r.builder().AddMemory(kWasmPageSize, SharedFlag::kShared);
+ r.builder().SetHasSharedMemory();
+ BUILD(r, WASM_ATOMICS_WAIT(kExprI32AtomicWait, WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(1),
+ WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(2)), 4));
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ Handle<JSFunction> func = r.builder().WrapCode(0);
+ CHECK(env->Global()
+ ->Set(env.local(), v8_str("func"), v8::Utils::ToLocal(func))
+ .FromJust());
+ Handle<JSArrayBuffer> memory(
+ r.builder().instance_object()->memory_object()->array_buffer(),
+ i_isolate);
+ CHECK(env->Global()
+ ->Set(env.local(), v8_str("sab"), v8::Utils::ToLocal(memory))
+ .FromJust());
+
+ const char* init = R"(
+ let int32arr = new Int32Array(sab, 4);
+ let setArrayElemAs = function(id, val) {
+ int32arr[id] = val;
+ };
+ let wait = function(id, val, timeout) {
+ if(arguments.length === 2)
+ return func(id << 2, val, -1);
+ return func(id << 2, val, timeout*1000000);
+ };
+ sab;)";
+ AtomicsWaitCallbackCommon(isolate, CompileRun(init), 4, 4);
+}
+
+TEST(WasmI64AtomicWaitCallback) {
+ FlagScope<bool> wasm_threads_flag(&i::FLAG_experimental_wasm_threads, true);
+ WasmRunner<int32_t, int32_t, double, double> r(ExecutionTier::kOptimized);
+ r.builder().AddMemory(kWasmPageSize, SharedFlag::kShared);
+ r.builder().SetHasSharedMemory();
+ BUILD(r, WASM_ATOMICS_WAIT(kExprI64AtomicWait, WASM_GET_LOCAL(0),
+ WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(1)),
+ WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(2)), 8));
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ Handle<JSFunction> func = r.builder().WrapCode(0);
+ CHECK(env->Global()
+ ->Set(env.local(), v8_str("func"), v8::Utils::ToLocal(func))
+ .FromJust());
+ Handle<JSArrayBuffer> memory(
+ r.builder().instance_object()->memory_object()->array_buffer(),
+ i_isolate);
+ CHECK(env->Global()
+ ->Set(env.local(), v8_str("sab"), v8::Utils::ToLocal(memory))
+ .FromJust());
+
+ const char* init = R"(
+ let int64arr = new BigInt64Array(sab, 8);
+ let setArrayElemAs = function(id, val) {
+ int64arr[id] = BigInt(val);
+ };
+ let wait = function(id, val, timeout) {
+ if(arguments.length === 2)
+ return func(id << 3, val, -1);
+ return func(id << 3, val, timeout*1000000);
+ };
+ sab;)";
+ AtomicsWaitCallbackCommon(isolate, CompileRun(init), 8, 8);
+}
+
+} // namespace wasm
+} // namespace internal
+} // namespace v8
+
TEST(BigIntAPI) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
diff --git a/deps/v8/test/cctest/test-assembler-arm.cc b/deps/v8/test/cctest/test-assembler-arm.cc
index d66027b5fd..f93163c985 100644
--- a/deps/v8/test/cctest/test-assembler-arm.cc
+++ b/deps/v8/test/cctest/test-assembler-arm.cc
@@ -167,7 +167,6 @@ TEST(3) {
T t;
Assembler assm(AssemblerOptions{});
- Label L, C;
__ mov(ip, Operand(sp));
__ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit());
@@ -236,7 +235,6 @@ TEST(4) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the doubles and floats.
Assembler assm(AssemblerOptions{});
- Label L, C;
if (CpuFeatures::IsSupported(VFPv3)) {
CpuFeatureScope scope(&assm, VFPv3);
@@ -1029,7 +1027,6 @@ TEST(13) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the doubles and floats.
Assembler assm(AssemblerOptions{});
- Label L, C;
if (CpuFeatures::IsSupported(VFPv3)) {
CpuFeatureScope scope(&assm, VFPv3);
@@ -2935,7 +2932,6 @@ TEST(ARMv8_float32_vrintX) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the floats.
Assembler assm(AssemblerOptions{});
- Label L, C;
if (CpuFeatures::IsSupported(ARMv8)) {
@@ -3037,7 +3033,6 @@ TEST(ARMv8_vrintX) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the doubles and floats.
Assembler assm(AssemblerOptions{});
- Label L, C;
if (CpuFeatures::IsSupported(ARMv8)) {
@@ -4094,18 +4089,18 @@ namespace {
std::vector<Float32> Float32Inputs() {
std::vector<Float32> inputs;
FOR_FLOAT32_INPUTS(f) {
- inputs.push_back(Float32::FromBits(bit_cast<uint32_t>(*f)));
+ inputs.push_back(Float32::FromBits(bit_cast<uint32_t>(f)));
}
- FOR_UINT32_INPUTS(bits) { inputs.push_back(Float32::FromBits(*bits)); }
+ FOR_UINT32_INPUTS(bits) { inputs.push_back(Float32::FromBits(bits)); }
return inputs;
}
std::vector<Float64> Float64Inputs() {
std::vector<Float64> inputs;
FOR_FLOAT64_INPUTS(f) {
- inputs.push_back(Float64::FromBits(bit_cast<uint64_t>(*f)));
+ inputs.push_back(Float64::FromBits(bit_cast<uint64_t>(f)));
}
- FOR_UINT64_INPUTS(bits) { inputs.push_back(Float64::FromBits(*bits)); }
+ FOR_UINT64_INPUTS(bits) { inputs.push_back(Float64::FromBits(bits)); }
return inputs;
}
@@ -4187,6 +4182,81 @@ TEST(vneg_64) {
}
}
+TEST(move_pair) {
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope scope(isolate);
+
+ auto f = AssembleCode<F_piiii>([](MacroAssembler& assm) {
+ RegList used_callee_saved =
+ r4.bit() | r5.bit() | r6.bit() | r7.bit() | r8.bit();
+ __ stm(db_w, sp, used_callee_saved);
+
+ // Save output register bank pointer to r8.
+ __ mov(r8, r0);
+
+ __ mov(r0, Operand(0xabababab));
+ __ mov(r1, Operand(0xbabababa));
+ __ mov(r2, Operand(0x12341234));
+ __ mov(r3, Operand(0x43214321));
+
+ // No overlap:
+ // r4 <- r0
+ // r5 <- r1
+ __ MovePair(r4, r0, r5, r1);
+
+ // Overlap but we can swap moves:
+ // r2 <- r0
+ // r6 <- r2
+ __ MovePair(r2, r0, r6, r2);
+
+ // Overlap but can be done:
+ // r7 <- r3
+ // r3 <- r0
+ __ MovePair(r7, r3, r3, r0);
+
+ // Swap.
+ // r0 <- r1
+ // r1 <- r0
+ __ MovePair(r0, r1, r1, r0);
+
+ // Fill the fake register bank.
+ __ str(r0, MemOperand(r8, 0 * kPointerSize));
+ __ str(r1, MemOperand(r8, 1 * kPointerSize));
+ __ str(r2, MemOperand(r8, 2 * kPointerSize));
+ __ str(r3, MemOperand(r8, 3 * kPointerSize));
+ __ str(r4, MemOperand(r8, 4 * kPointerSize));
+ __ str(r5, MemOperand(r8, 5 * kPointerSize));
+ __ str(r6, MemOperand(r8, 6 * kPointerSize));
+ __ str(r7, MemOperand(r8, 7 * kPointerSize));
+
+ __ ldm(ia_w, sp, used_callee_saved);
+ });
+
+ // Create a fake register bank.
+ uint32_t r[] = {0, 0, 0, 0, 0, 0, 0, 0};
+ f.Call(r, 0, 0, 0, 0);
+
+ // r4 <- r0
+ // r5 <- r1
+ CHECK_EQ(0xabababab, r[4]);
+ CHECK_EQ(0xbabababa, r[5]);
+
+ // r2 <- r0
+ // r6 <- r2
+ CHECK_EQ(0xabababab, r[2]);
+ CHECK_EQ(0x12341234, r[6]);
+
+ // r7 <- r3
+ // r3 <- r0
+ CHECK_EQ(0x43214321, r[7]);
+ CHECK_EQ(0xabababab, r[3]);
+
+ // r0 and r1 should be swapped.
+ CHECK_EQ(0xbabababa, r[0]);
+ CHECK_EQ(0xabababab, r[1]);
+}
+
+
#undef __
} // namespace test_assembler_arm
diff --git a/deps/v8/test/cctest/test-assembler-arm64.cc b/deps/v8/test/cctest/test-assembler-arm64.cc
index a500c9cb51..44a54df80e 100644
--- a/deps/v8/test/cctest/test-assembler-arm64.cc
+++ b/deps/v8/test/cctest/test-assembler-arm64.cc
@@ -162,7 +162,10 @@ static void InitializeVM() {
core.Dump(&masm); \
__ PopCalleeSavedRegisters(); \
__ Ret(); \
- __ GetCode(masm.isolate(), nullptr);
+ { \
+ CodeDesc desc; \
+ __ GetCode(masm.isolate(), &desc); \
+ }
#else // ifdef USE_SIMULATOR.
// Run the test on real hardware or models.
@@ -198,11 +201,14 @@ static void InitializeVM() {
test_function(); \
}
-#define END() \
- core.Dump(&masm); \
- __ PopCalleeSavedRegisters(); \
- __ Ret(); \
- __ GetCode(masm.isolate(), nullptr);
+#define END() \
+ core.Dump(&masm); \
+ __ PopCalleeSavedRegisters(); \
+ __ Ret(); \
+ { \
+ CodeDesc desc; \
+ __ GetCode(masm.isolate(), &desc); \
+ }
#endif // ifdef USE_SIMULATOR.
@@ -405,6 +411,60 @@ TEST(mov) {
CHECK_EQUAL_64(0x000000000001FFE0UL, x27);
}
+TEST(move_pair) {
+ INIT_V8();
+ SETUP();
+
+ START();
+ __ Mov(x0, 0xabababab);
+ __ Mov(x1, 0xbabababa);
+ __ Mov(x2, 0x12341234);
+ __ Mov(x3, 0x43214321);
+
+ // No overlap:
+ // x4 <- x0
+ // x5 <- x1
+ __ MovePair(x4, x0, x5, x1);
+
+ // Overlap but we can swap moves:
+ // x2 <- x0
+ // x6 <- x2
+ __ MovePair(x2, x0, x6, x2);
+
+ // Overlap but can be done:
+ // x7 <- x3
+ // x3 <- x0
+ __ MovePair(x7, x3, x3, x0);
+
+ // Swap.
+ // x0 <- x1
+ // x1 <- x0
+ __ MovePair(x0, x1, x1, x0);
+
+ END();
+
+ RUN();
+
+ // x4 <- x0
+ // x5 <- x1
+ CHECK_EQUAL_64(0xabababab, x4);
+ CHECK_EQUAL_64(0xbabababa, x5);
+
+ // x2 <- x0
+ // x6 <- x2
+ CHECK_EQUAL_64(0xabababab, x2);
+ CHECK_EQUAL_64(0x12341234, x6);
+
+ // x7 <- x3
+ // x3 <- x0
+ CHECK_EQUAL_64(0x43214321, x7);
+ CHECK_EQUAL_64(0xabababab, x3);
+
+ // x0 and x1 should be swapped.
+ CHECK_EQUAL_64(0xbabababa, x0);
+ CHECK_EQUAL_64(0xabababab, x1);
+}
+
TEST(mov_imm_w) {
INIT_V8();
SETUP();
@@ -2160,7 +2220,7 @@ TEST(far_branch_veneer_broken_link_chain) {
START();
- Label skip, fail, done;
+ Label fail, done;
Label test_1, test_2, test_3;
Label far_target;
@@ -14525,7 +14585,7 @@ static void AbsHelperX(int64_t value) {
__ Mov(x1, value);
if (value != kXMinInt) {
- expected = labs(value);
+ expected = std::abs(value);
Label next;
// The result is representable.
@@ -14535,7 +14595,7 @@ static void AbsHelperX(int64_t value) {
__ Bind(&next);
__ Abs(x13, x1, nullptr, &done);
} else {
- // labs is undefined for kXMinInt but our implementation in the
+ // std::abs is undefined for kXMinInt but our implementation in the
// MacroAssembler will return kXMinInt in such a case.
expected = kXMinInt;
@@ -14715,7 +14775,7 @@ TEST(jump_tables_forward) {
Label base;
__ Adr(x10, &base);
- __ Ldr(x11, MemOperand(x10, index, LSL, kPointerSizeLog2));
+ __ Ldr(x11, MemOperand(x10, index, LSL, kSystemPointerSizeLog2));
__ Br(x11);
__ Bind(&base);
for (int i = 0; i < kNumCases; ++i) {
@@ -14783,7 +14843,7 @@ TEST(jump_tables_backward) {
Label base;
__ Adr(x10, &base);
- __ Ldr(x11, MemOperand(x10, index, LSL, kPointerSizeLog2));
+ __ Ldr(x11, MemOperand(x10, index, LSL, kSystemPointerSizeLog2));
__ Br(x11);
__ Bind(&base);
for (int i = 0; i < kNumCases; ++i) {
diff --git a/deps/v8/test/cctest/test-assembler-ia32.cc b/deps/v8/test/cctest/test-assembler-ia32.cc
index 781dbfcc10..a9c0b60485 100644
--- a/deps/v8/test/cctest/test-assembler-ia32.cc
+++ b/deps/v8/test/cctest/test-assembler-ia32.cc
@@ -250,8 +250,8 @@ TEST(AssemblerIa326) {
Assembler assm(AssemblerOptions{},
ExternalAssemblerBuffer(buffer, sizeof buffer));
- __ movsd(xmm0, Operand(esp, 1 * kPointerSize));
- __ movsd(xmm1, Operand(esp, 3 * kPointerSize));
+ __ movsd(xmm0, Operand(esp, 1 * kSystemPointerSize));
+ __ movsd(xmm1, Operand(esp, 3 * kSystemPointerSize));
__ addsd(xmm0, xmm1);
__ mulsd(xmm0, xmm1);
__ subsd(xmm0, xmm1);
@@ -522,8 +522,8 @@ TEST(AssemblerIa32SSE) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes,
ExternalAssemblerBuffer(buffer, sizeof(buffer)));
{
- __ movss(xmm0, Operand(esp, kPointerSize));
- __ movss(xmm1, Operand(esp, 2 * kPointerSize));
+ __ movss(xmm0, Operand(esp, kSystemPointerSize));
+ __ movss(xmm1, Operand(esp, 2 * kSystemPointerSize));
__ shufps(xmm0, xmm0, 0x0);
__ shufps(xmm1, xmm1, 0x0);
__ movaps(xmm2, xmm1);
@@ -559,8 +559,8 @@ TEST(AssemblerIa32SSE3) {
ExternalAssemblerBuffer(buffer, sizeof(buffer)));
{
CpuFeatureScope fscope(&assm, SSE3);
- __ movss(xmm0, Operand(esp, kPointerSize));
- __ movss(xmm1, Operand(esp, 2 * kPointerSize));
+ __ movss(xmm0, Operand(esp, kSystemPointerSize));
+ __ movss(xmm1, Operand(esp, 2 * kSystemPointerSize));
__ shufps(xmm0, xmm0, 0x0);
__ shufps(xmm1, xmm1, 0x0);
__ haddps(xmm1, xmm0);
@@ -594,9 +594,9 @@ TEST(AssemblerX64FMA_sd) {
{
CpuFeatureScope fscope(&assm, FMA3);
Label exit;
- __ movsd(xmm0, Operand(esp, 1 * kPointerSize));
- __ movsd(xmm1, Operand(esp, 3 * kPointerSize));
- __ movsd(xmm2, Operand(esp, 5 * kPointerSize));
+ __ movsd(xmm0, Operand(esp, 1 * kSystemPointerSize));
+ __ movsd(xmm1, Operand(esp, 3 * kSystemPointerSize));
+ __ movsd(xmm2, Operand(esp, 5 * kSystemPointerSize));
// argument in xmm0, xmm1 and xmm2
// xmm0 * xmm1 + xmm2
__ movaps(xmm3, xmm0);
@@ -823,9 +823,9 @@ TEST(AssemblerX64FMA_ss) {
{
CpuFeatureScope fscope(&assm, FMA3);
Label exit;
- __ movss(xmm0, Operand(esp, 1 * kPointerSize));
- __ movss(xmm1, Operand(esp, 2 * kPointerSize));
- __ movss(xmm2, Operand(esp, 3 * kPointerSize));
+ __ movss(xmm0, Operand(esp, 1 * kSystemPointerSize));
+ __ movss(xmm1, Operand(esp, 2 * kSystemPointerSize));
+ __ movss(xmm2, Operand(esp, 3 * kSystemPointerSize));
// arguments in xmm0, xmm1 and xmm2
// xmm0 * xmm1 + xmm2
__ movaps(xmm3, xmm0);
@@ -1403,7 +1403,7 @@ TEST(AssemblerIa32JumpTables1) {
Label done, table;
__ mov(eax, Operand(esp, 4));
- __ jmp(Operand::JumpTable(eax, times_4, &table));
+ __ jmp(Operand::JumpTable(eax, times_system_pointer_size, &table));
__ ud2();
__ bind(&table);
for (int i = 0; i < kNumCases; ++i) {
@@ -1450,7 +1450,7 @@ TEST(AssemblerIa32JumpTables2) {
Label done, table;
__ mov(eax, Operand(esp, 4));
- __ jmp(Operand::JumpTable(eax, times_4, &table));
+ __ jmp(Operand::JumpTable(eax, times_system_pointer_size, &table));
__ ud2();
for (int i = 0; i < kNumCases; ++i) {
diff --git a/deps/v8/test/cctest/test-assembler-mips.cc b/deps/v8/test/cctest/test-assembler-mips.cc
index 2f5b13f725..bf45427532 100644
--- a/deps/v8/test/cctest/test-assembler-mips.cc
+++ b/deps/v8/test/cctest/test-assembler-mips.cc
@@ -273,7 +273,6 @@ TEST(MIPS3) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the doubles t.a ... t.f.
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Double precision floating point instructions.
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
@@ -401,7 +400,6 @@ TEST(MIPS4) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
__ Ldc1(f6, MemOperand(a0, offsetof(T, b)));
@@ -469,7 +467,6 @@ TEST(MIPS5) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Load all structure elements to registers.
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
@@ -537,7 +534,6 @@ TEST(MIPS6) {
T t;
Assembler assm(AssemblerOptions{});
- Label L, C;
// Basic word load/store.
__ lw(t0, MemOperand(a0, offsetof(T, ui)) );
@@ -825,7 +821,6 @@ TEST(MIPS10) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
if (IsMipsArchVariant(kMips32r1) || IsMipsArchVariant(kLoongson)) return;
@@ -4742,7 +4737,7 @@ uint32_t run_jic(int16_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label get_program_counter, stop_execution;
+ Label stop_execution;
__ push(ra);
__ li(v0, 0);
__ li(t1, 0x66);
@@ -5074,7 +5069,7 @@ uint32_t run_jialc(int16_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label main_block, get_program_counter;
+ Label main_block;
__ push(ra);
__ li(v0, 0);
__ beq(v0, v0, &main_block);
@@ -5291,7 +5286,7 @@ int32_t run_balc(int32_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label continue_1, stop_execution;
+ Label continue_1;
__ push(ra);
__ li(v0, 0);
__ li(t8, 0);
diff --git a/deps/v8/test/cctest/test-assembler-mips64.cc b/deps/v8/test/cctest/test-assembler-mips64.cc
index aa82b359f2..ec5e0e283e 100644
--- a/deps/v8/test/cctest/test-assembler-mips64.cc
+++ b/deps/v8/test/cctest/test-assembler-mips64.cc
@@ -283,7 +283,6 @@ TEST(MIPS3) {
// Create a function that accepts &t, and loads, manipulates, and stores
// the doubles t.a ... t.f.
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Double precision floating point instructions.
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
@@ -406,7 +405,6 @@ TEST(MIPS4) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
__ Ldc1(f5, MemOperand(a0, offsetof(T, b)));
@@ -472,7 +470,6 @@ TEST(MIPS5) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Load all structure elements to registers.
__ Ldc1(f4, MemOperand(a0, offsetof(T, a)));
@@ -540,7 +537,6 @@ TEST(MIPS6) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Basic word load/store.
__ Lw(a4, MemOperand(a0, offsetof(T, ui)));
@@ -828,7 +824,6 @@ TEST(MIPS10) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
if (kArchVariant == kMips64r2) {
// Rewritten for FR=1 FPU mode:
@@ -1386,7 +1381,6 @@ TEST(MIPS16) {
T t;
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label L, C;
// Basic 32-bit word load/store, with un-signed data.
__ Lw(a4, MemOperand(a0, offsetof(T, ui)));
@@ -5358,7 +5352,7 @@ uint64_t run_jic(int16_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label get_program_counter, stop_execution;
+ Label stop_execution;
__ push(ra);
__ li(v0, 0l);
__ li(t1, 0x66);
@@ -5690,7 +5684,7 @@ uint64_t run_jialc(int16_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label main_block, get_program_counter;
+ Label main_block;
__ push(ra);
__ li(v0, 0l);
__ beq(v0, v0, &main_block);
@@ -5991,7 +5985,7 @@ int64_t run_balc(int32_t offset) {
MacroAssembler assm(isolate, v8::internal::CodeObjectRequired::kYes);
- Label continue_1, stop_execution;
+ Label continue_1;
__ push(ra);
__ li(v0, 0l);
__ li(t8, 0l);
diff --git a/deps/v8/test/cctest/test-assembler-ppc.cc b/deps/v8/test/cctest/test-assembler-ppc.cc
index 196a3d91df..1f7a9e0eec 100644
--- a/deps/v8/test/cctest/test-assembler-ppc.cc
+++ b/deps/v8/test/cctest/test-assembler-ppc.cc
@@ -169,7 +169,6 @@ TEST(3) {
T t;
Assembler assm(AssemblerOptions{});
- Label L, C;
// build a frame
#if V8_TARGET_ARCH_PPC64
diff --git a/deps/v8/test/cctest/test-code-layout.cc b/deps/v8/test/cctest/test-code-layout.cc
index 5dbe81cb62..fa55e40af6 100644
--- a/deps/v8/test/cctest/test-code-layout.cc
+++ b/deps/v8/test/cctest/test-code-layout.cc
@@ -24,13 +24,20 @@ TEST(CodeLayoutWithoutUnwindingInfo) {
CodeDesc code_desc;
code_desc.buffer = buffer;
code_desc.buffer_size = buffer_size;
- code_desc.constant_pool_size = 0;
code_desc.instr_size = buffer_size;
+ code_desc.safepoint_table_offset = buffer_size;
+ code_desc.safepoint_table_size = 0;
+ code_desc.handler_table_offset = buffer_size;
+ code_desc.handler_table_size = 0;
+ code_desc.constant_pool_offset = buffer_size;
+ code_desc.constant_pool_size = 0;
+ code_desc.code_comments_offset = buffer_size;
+ code_desc.code_comments_size = 0;
+ code_desc.reloc_offset = buffer_size;
code_desc.reloc_size = 0;
- code_desc.origin = nullptr;
code_desc.unwinding_info = nullptr;
code_desc.unwinding_info_size = 0;
- code_desc.code_comments_size = 0;
+ code_desc.origin = nullptr;
Handle<Code> code = CcTest::i_isolate()->factory()->NewCode(
code_desc, Code::STUB, Handle<Object>::null());
@@ -63,13 +70,20 @@ TEST(CodeLayoutWithUnwindingInfo) {
CodeDesc code_desc;
code_desc.buffer = buffer;
code_desc.buffer_size = buffer_size;
- code_desc.constant_pool_size = 0;
code_desc.instr_size = buffer_size;
+ code_desc.safepoint_table_offset = buffer_size;
+ code_desc.safepoint_table_size = 0;
+ code_desc.handler_table_offset = buffer_size;
+ code_desc.handler_table_size = 0;
+ code_desc.constant_pool_offset = buffer_size;
+ code_desc.constant_pool_size = 0;
+ code_desc.code_comments_offset = buffer_size;
+ code_desc.code_comments_size = 0;
+ code_desc.reloc_offset = buffer_size;
code_desc.reloc_size = 0;
- code_desc.origin = nullptr;
code_desc.unwinding_info = unwinding_info;
code_desc.unwinding_info_size = unwinding_info_size;
- code_desc.code_comments_size = 0;
+ code_desc.origin = nullptr;
Handle<Code> code = CcTest::i_isolate()->factory()->NewCode(
code_desc, Code::STUB, Handle<Object>::null());
diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc
index 0c22f4503b..e7f592d1c5 100644
--- a/deps/v8/test/cctest/test-code-stub-assembler.cc
+++ b/deps/v8/test/cctest/test-code-stub-assembler.cc
@@ -14,6 +14,7 @@
#include "src/code-stub-assembler.h"
#include "src/compiler/node.h"
#include "src/debug/debug.h"
+#include "src/hash-seed-inl.h"
#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
@@ -21,9 +22,11 @@
#include "src/objects/heap-number-inl.h"
#include "src/objects/js-array-buffer-inl.h"
#include "src/objects/js-array-inl.h"
+#include "src/objects/ordered-hash-table-inl.h"
#include "src/objects/promise-inl.h"
#include "src/objects/smi.h"
#include "src/objects/struct-inl.h"
+#include "src/transitions-inl.h"
#include "test/cctest/compiler/code-assembler-tester.h"
#include "test/cctest/compiler/function-tester.h"
@@ -348,7 +351,7 @@ TEST(ComputeIntegerHash) {
Handle<Smi> key(Smi::FromInt(k), isolate);
Handle<Object> result = ft.Call(key).ToHandleChecked();
- uint32_t hash = ComputeSeededHash(k, isolate->heap()->HashSeed());
+ uint32_t hash = ComputeSeededHash(k, HashSeed(isolate));
Smi expected = Smi::FromInt(hash);
CHECK_EQ(expected, Smi::cast(*result));
}
@@ -1708,14 +1711,13 @@ TEST(AllocateNameDictionary) {
{
for (int i = 0; i < 256; i = i * 1.1 + 1) {
- Handle<Object> result =
- ft.Call(handle(Smi::FromInt(i), isolate)).ToHandleChecked();
+ Handle<HeapObject> result = Handle<HeapObject>::cast(
+ ft.Call(handle(Smi::FromInt(i), isolate)).ToHandleChecked());
Handle<NameDictionary> dict = NameDictionary::New(isolate, i);
// Both dictionaries should be memory equal.
- int size =
- FixedArrayBase::kHeaderSize + (dict->length() - 1) * kPointerSize;
- CHECK_EQ(0, memcmp(reinterpret_cast<void*>(dict->ptr()),
- reinterpret_cast<void*>(result->ptr()), size));
+ int size = dict->Size();
+ CHECK_EQ(0, memcmp(reinterpret_cast<void*>(dict->address()),
+ reinterpret_cast<void*>(result->address()), size));
}
}
}
@@ -2089,10 +2091,10 @@ class AppendJSArrayCodeStubAssembler : public CodeStubAssembler {
Handle<JSArray> array = isolate->factory()->NewJSArray(
kind_, 2, initial_size, INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE);
Object::SetElement(isolate, array, 0, Handle<Smi>(Smi::FromInt(1), isolate),
- LanguageMode::kSloppy)
+ kDontThrow)
.Check();
Object::SetElement(isolate, array, 1, Handle<Smi>(Smi::FromInt(2), isolate),
- LanguageMode::kSloppy)
+ kDontThrow)
.Check();
CodeStubArguments args(this, IntPtrConstant(kNumParams));
TVariable<IntPtrT> arg_index(this);
diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc
index f05056a2de..17f7a7d851 100644
--- a/deps/v8/test/cctest/test-compiler.cc
+++ b/deps/v8/test/cctest/test-compiler.cc
@@ -35,8 +35,10 @@
#include "src/compiler.h"
#include "src/disasm.h"
#include "src/heap/factory.h"
+#include "src/heap/spaces.h"
#include "src/interpreter/interpreter.h"
#include "src/objects-inl.h"
+#include "src/objects/allocation-site-inl.h"
#include "test/cctest/cctest.h"
namespace v8 {
@@ -55,7 +57,7 @@ static void SetGlobalProperty(const char* name, Object value) {
isolate->factory()->InternalizeUtf8String(name);
Handle<JSObject> global(isolate->context()->global_object(), isolate);
Runtime::SetObjectProperty(isolate, global, internalized_name, object,
- LanguageMode::kSloppy, StoreOrigin::kMaybeKeyed)
+ StoreOrigin::kMaybeKeyed, Just(kDontThrow))
.Check();
}
@@ -791,6 +793,30 @@ TEST(InvocationCount) {
CHECK_EQ(4, foo->feedback_vector()->invocation_count());
}
+TEST(SafeToSkipArgumentsAdaptor) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ CompileRun(
+ "function a() { \"use strict\"; }; a();"
+ "function b() { }; b();"
+ "function c() { \"use strict\"; return arguments; }; c();"
+ "function d(...args) { return args; }; d();"
+ "function e() { \"use strict\"; return eval(\"\"); }; e();"
+ "function f(x, y) { \"use strict\"; return x + y; }; f(1, 2);");
+ Handle<JSFunction> a = Handle<JSFunction>::cast(GetGlobalProperty("a"));
+ CHECK(a->shared()->is_safe_to_skip_arguments_adaptor());
+ Handle<JSFunction> b = Handle<JSFunction>::cast(GetGlobalProperty("b"));
+ CHECK(!b->shared()->is_safe_to_skip_arguments_adaptor());
+ Handle<JSFunction> c = Handle<JSFunction>::cast(GetGlobalProperty("c"));
+ CHECK(!c->shared()->is_safe_to_skip_arguments_adaptor());
+ Handle<JSFunction> d = Handle<JSFunction>::cast(GetGlobalProperty("d"));
+ CHECK(!d->shared()->is_safe_to_skip_arguments_adaptor());
+ Handle<JSFunction> e = Handle<JSFunction>::cast(GetGlobalProperty("e"));
+ CHECK(!e->shared()->is_safe_to_skip_arguments_adaptor());
+ Handle<JSFunction> f = Handle<JSFunction>::cast(GetGlobalProperty("f"));
+ CHECK(f->shared()->is_safe_to_skip_arguments_adaptor());
+}
+
TEST(ShallowEagerCompilation) {
i::FLAG_always_opt = false;
CcTest::InitializeVM();
diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc
index 3a3063ed3c..e26838d0a8 100644
--- a/deps/v8/test/cctest/test-cpu-profiler.cc
+++ b/deps/v8/test/cctest/test-cpu-profiler.cc
@@ -41,6 +41,7 @@
#include "src/objects-inl.h"
#include "src/profiler/cpu-profiler-inl.h"
#include "src/profiler/profiler-listener.h"
+#include "src/profiler/tracing-cpu-profiler.h"
#include "src/source-position-table.h"
#include "src/utils.h"
#include "test/cctest/cctest.h"
@@ -2405,11 +2406,16 @@ class CpuProfileEventChecker : public v8::platform::tracing::TraceWriter {
profile_id_ = trace_event->id();
v8::ConvertableToTraceFormat* arg =
trace_event->arg_convertables()[0].get();
+ result_json_ += result_json_.empty() ? "[" : ",\n";
arg->AppendAsTraceFormat(&result_json_);
}
- void Flush() override {}
+ void Flush() override { result_json_ += "]"; }
- std::string result_json() const { return result_json_; }
+ const std::string& result_json() const { return result_json_; }
+ void Reset() {
+ result_json_.clear();
+ profile_id_ = 0;
+ }
private:
std::string result_json_;
@@ -2419,50 +2425,61 @@ class CpuProfileEventChecker : public v8::platform::tracing::TraceWriter {
} // namespace
TEST(TracingCpuProfiler) {
- v8::Platform* old_platform = i::V8::GetCurrentPlatform();
- std::unique_ptr<v8::Platform> default_platform =
- v8::platform::NewDefaultPlatform();
- i::V8::SetPlatformForTesting(default_platform.get());
-
- auto tracing = base::make_unique<v8::platform::tracing::TracingController>();
- v8::platform::tracing::TracingController* tracing_controller = tracing.get();
- static_cast<v8::platform::DefaultPlatform*>(default_platform.get())
- ->SetTracingController(std::move(tracing));
+ v8::HandleScope scope(CcTest::isolate());
+ v8::Local<v8::Context> env = CcTest::NewContext({PROFILER_EXTENSION_ID});
+ v8::Context::Scope context_scope(env);
CpuProfileEventChecker* event_checker = new CpuProfileEventChecker();
TraceBuffer* ring_buffer =
TraceBuffer::CreateTraceBufferRingBuffer(1, event_checker);
+ auto* tracing_controller =
+ static_cast<v8::platform::tracing::TracingController*>(
+ i::V8::GetCurrentPlatform()->GetTracingController());
tracing_controller->Initialize(ring_buffer);
- TraceConfig* trace_config = new TraceConfig();
- trace_config->AddIncludedCategory(
- TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"));
- LocalContext env;
- v8::HandleScope scope(env->GetIsolate());
- {
+ bool result = false;
+ for (int run_duration = 50; !result; run_duration += 50) {
+ TraceConfig* trace_config = new TraceConfig();
+ trace_config->AddIncludedCategory(
+ TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler"));
+ trace_config->AddIncludedCategory(
+ TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler.hires"));
+
+ std::string test_code = R"(
+ function foo() {
+ let s = 0;
+ const endTime = Date.now() + )" +
+ std::to_string(run_duration) + R"(
+ while (Date.now() < endTime) s += Math.cos(s);
+ return s;
+ }
+ foo();)";
+
tracing_controller->StartTracing(trace_config);
- CompileRun("function foo() { } foo();");
+ CompileRun(test_code.c_str());
tracing_controller->StopTracing();
- CompileRun("function bar() { } bar();");
- }
- const char* profile_checker =
- "function checkProfile(profile) {\n"
- " if (typeof profile['startTime'] !== 'number') return 'startTime';\n"
- " return '';\n"
- "}\n"
- "checkProfile(";
- std::string profile_json = event_checker->result_json();
- CHECK_LT(0u, profile_json.length());
- printf("Profile JSON: %s\n", profile_json.c_str());
- std::string code = profile_checker + profile_json + ")";
- v8::Local<v8::Value> result =
- CompileRunChecked(CcTest::isolate(), code.c_str());
- v8::String::Utf8Value value(CcTest::isolate(), result);
- printf("Check result: %*s\n", value.length(), *value);
- CHECK_EQ(0, value.length());
+ std::string profile_json = event_checker->result_json();
+ event_checker->Reset();
+ CHECK_LT(0u, profile_json.length());
+ printf("Profile JSON: %s\n", profile_json.c_str());
+
+ std::string profile_checker_code = R"(
+ function checkProfile(json) {
+ const profile_header = json[0];
+ if (typeof profile_header['startTime'] !== 'number')
+ return false;
+ return json.some(event => (event.lines || []).some(line => line));
+ }
+ checkProfile()" + profile_json +
+ ")";
+ result = CompileRunChecked(CcTest::isolate(), profile_checker_code.c_str())
+ ->IsTrue();
+ }
- i::V8::SetPlatformForTesting(old_platform);
+ static_cast<v8::platform::tracing::TracingController*>(
+ i::V8::GetCurrentPlatform()->GetTracingController())
+ ->Initialize(nullptr);
}
TEST(Issue763073) {
@@ -2688,6 +2705,54 @@ TEST(MultipleProfilers) {
profiler2->StopProfiling("2");
}
+// Tests that logged CodeCreateEvent calls do not crash a reused CpuProfiler.
+// crbug.com/929928
+TEST(CrashReusedProfiler) {
+ LocalContext env;
+ i::Isolate* isolate = CcTest::i_isolate();
+ i::HandleScope scope(isolate);
+
+ std::unique_ptr<CpuProfiler> profiler(new CpuProfiler(isolate));
+ profiler->StartProfiling("1");
+ profiler->StopProfiling("1");
+
+ profiler->StartProfiling("2");
+ CreateCode(&env);
+ profiler->StopProfiling("2");
+}
+
+// Tests that samples from different profilers on the same isolate do not leak
+// samples to each other. See crbug.com/v8/8835.
+TEST(MultipleProfilersSampleIndependently) {
+ LocalContext env;
+ i::Isolate* isolate = CcTest::i_isolate();
+ i::HandleScope scope(isolate);
+
+ // Create two profilers- one slow ticking one, and one fast ticking one.
+ // Ensure that the slow ticking profiler does not receive samples from the
+ // fast ticking one.
+ std::unique_ptr<CpuProfiler> slow_profiler(
+ new CpuProfiler(CcTest::i_isolate()));
+ slow_profiler->set_sampling_interval(base::TimeDelta::FromSeconds(1));
+ slow_profiler->StartProfiling("1", true);
+
+ CompileRun(R"(
+ function start() {
+ let val = 1;
+ for (let i = 0; i < 10e3; i++) {
+ val = (val * 2) % 3;
+ }
+ return val;
+ }
+ )");
+ v8::Local<v8::Function> function = GetFunction(env.local(), "start");
+ ProfilerHelper helper(env.local());
+ v8::CpuProfile* profile = helper.Run(function, nullptr, 0, 100, 0, true);
+
+ auto slow_profile = slow_profiler->StopProfiling("1");
+ CHECK_GT(profile->GetSamplesCount(), slow_profile->samples_count());
+}
+
void ProfileSomeCode(v8::Isolate* isolate) {
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope scope(isolate);
@@ -2740,19 +2805,45 @@ TEST(MultipleIsolates) {
thread2.Join();
}
-int GetSourcePositionEntryCount(i::Isolate* isolate, const char* source) {
+// Tests that StopProfiling doesn't wait for the next sample tick in order to
+// stop, but rather exits early before a given wait threshold.
+TEST(FastStopProfiling) {
+ static const base::TimeDelta kLongInterval = base::TimeDelta::FromSeconds(10);
+ static const base::TimeDelta kWaitThreshold = base::TimeDelta::FromSeconds(5);
+
+ std::unique_ptr<CpuProfiler> profiler(new CpuProfiler(CcTest::i_isolate()));
+ profiler->set_sampling_interval(kLongInterval);
+ profiler->StartProfiling("", true);
+
+ v8::Platform* platform = v8::internal::V8::GetCurrentPlatform();
+ double start = platform->CurrentClockTimeMillis();
+ profiler->StopProfiling("");
+ double duration = platform->CurrentClockTimeMillis() - start;
+
+ CHECK_LT(duration, kWaitThreshold.InMillisecondsF());
+}
+
+enum class EntryCountMode { kAll, kOnlyInlined };
+
+// Count the number of unique source positions.
+int GetSourcePositionEntryCount(i::Isolate* isolate, const char* source,
+ EntryCountMode mode = EntryCountMode::kAll) {
+ std::unordered_set<int64_t> raw_position_set;
i::Handle<i::JSFunction> function = i::Handle<i::JSFunction>::cast(
v8::Utils::OpenHandle(*CompileRun(source)));
if (function->IsInterpreted()) return -1;
i::Handle<i::Code> code(function->code(), isolate);
i::SourcePositionTableIterator iterator(
ByteArray::cast(code->source_position_table()));
- int count = 0;
+
while (!iterator.done()) {
- count++;
+ if (mode == EntryCountMode::kAll ||
+ iterator.source_position().isInlined()) {
+ raw_position_set.insert(iterator.source_position().raw());
+ }
iterator.Advance();
}
- return count;
+ return static_cast<int>(raw_position_set.size());
}
UNINITIALIZED_TEST(DetailedSourcePositionAPI) {
@@ -2795,6 +2886,68 @@ UNINITIALIZED_TEST(DetailedSourcePositionAPI) {
isolate->Dispose();
}
+UNINITIALIZED_TEST(DetailedSourcePositionAPI_Inlining) {
+ i::FLAG_detailed_line_info = false;
+ i::FLAG_turbo_inlining = true;
+ i::FLAG_stress_inline = true;
+ i::FLAG_always_opt = false;
+ i::FLAG_allow_natives_syntax = true;
+ v8::Isolate::CreateParams create_params;
+ create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+ v8::Isolate* isolate = v8::Isolate::New(create_params);
+
+ const char* source = R"(
+ function foo(x) {
+ return bar(x) + 1;
+ }
+
+ function bar(x) {
+ var y = 1;
+ for (var i = 0; i < x; ++i) {
+ y = y * x;
+ }
+ return x;
+ }
+
+ foo(5);
+ %OptimizeFunctionOnNextCall(foo);
+ foo(5);
+ foo;
+ )";
+
+ {
+ v8::Isolate::Scope isolate_scope(isolate);
+ v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ v8::Context::Scope context_scope(context);
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+
+ CHECK(!i_isolate->NeedsDetailedOptimizedCodeLineInfo());
+
+ int non_detailed_positions =
+ GetSourcePositionEntryCount(i_isolate, source, EntryCountMode::kAll);
+ int non_detailed_inlined_positions = GetSourcePositionEntryCount(
+ i_isolate, source, EntryCountMode::kOnlyInlined);
+
+ v8::CpuProfiler::UseDetailedSourcePositionsForProfiling(isolate);
+ CHECK(i_isolate->NeedsDetailedOptimizedCodeLineInfo());
+
+ int detailed_positions =
+ GetSourcePositionEntryCount(i_isolate, source, EntryCountMode::kAll);
+ int detailed_inlined_positions = GetSourcePositionEntryCount(
+ i_isolate, source, EntryCountMode::kOnlyInlined);
+
+ if (non_detailed_positions == -1) {
+ CHECK_EQ(non_detailed_positions, detailed_positions);
+ } else {
+ CHECK_LT(non_detailed_positions, detailed_positions);
+ CHECK_LT(non_detailed_inlined_positions, detailed_inlined_positions);
+ }
+ }
+
+ isolate->Dispose();
+}
+
} // namespace test_cpu_profiler
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc
index bc9a11a9f1..c6a163f554 100644
--- a/deps/v8/test/cctest/test-debug.cc
+++ b/deps/v8/test/cctest/test-debug.cc
@@ -2949,8 +2949,8 @@ TEST(NoBreakWhenBootstrapping) {
{
// Create a context with an extension to make sure that some JavaScript
// code is executed during bootstrapping.
- v8::RegisterExtension(new v8::Extension("simpletest",
- kSimpleExtensionSource));
+ v8::RegisterExtension(v8::base::make_unique<v8::Extension>(
+ "simpletest", kSimpleExtensionSource));
const char* extension_names[] = { "simpletest" };
v8::ExtensionConfiguration extensions(1, extension_names);
v8::HandleScope handle_scope(isolate);
@@ -4022,7 +4022,7 @@ UNINITIALIZED_TEST(DebugSetOutOfMemoryListener) {
CHECK(!near_heap_limit_callback_called);
// The following allocation fails unless the out-of-memory callback
// increases the heap limit.
- int length = 10 * i::MB / i::kPointerSize;
+ int length = 10 * i::MB / i::kTaggedSize;
i_isolate->factory()->NewFixedArray(length, i::TENURED);
CHECK(near_heap_limit_callback_called);
isolate->RemoveNearHeapLimitCallback(NearHeapLimitCallback, 0);
@@ -4037,7 +4037,8 @@ TEST(DebugCoverage) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
- v8::debug::Coverage::SelectMode(isolate, v8::debug::Coverage::kPreciseCount);
+ v8::debug::Coverage::SelectMode(isolate,
+ v8::debug::CoverageMode::kPreciseCount);
v8::Local<v8::String> source = v8_str(
"function f() {\n"
"}\n"
@@ -4092,7 +4093,8 @@ TEST(DebugCoverageWithCoverageOutOfScope) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
- v8::debug::Coverage::SelectMode(isolate, v8::debug::Coverage::kPreciseCount);
+ v8::debug::Coverage::SelectMode(isolate,
+ v8::debug::CoverageMode::kPreciseCount);
v8::Local<v8::String> source = v8_str(
"function f() {\n"
"}\n"
@@ -4163,7 +4165,8 @@ TEST(DebugCoverageWithScriptDataOutOfScope) {
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
- v8::debug::Coverage::SelectMode(isolate, v8::debug::Coverage::kPreciseCount);
+ v8::debug::Coverage::SelectMode(isolate,
+ v8::debug::CoverageMode::kPreciseCount);
v8::Local<v8::String> source = v8_str(
"function f() {\n"
"}\n"
@@ -4500,3 +4503,99 @@ TEST(Regress517592) {
CHECK_EQ(delegate.break_count(), 1);
v8::debug::SetDebugDelegate(env->GetIsolate(), nullptr);
}
+
+TEST(GetPrivateFields) {
+ LocalContext env;
+ v8::Isolate* v8_isolate = CcTest::isolate();
+ v8::internal::Isolate* isolate = CcTest::i_isolate();
+ v8::HandleScope scope(v8_isolate);
+ v8::Local<v8::Context> context = env.local();
+ v8::internal::FLAG_harmony_class_fields = true;
+ v8::internal::FLAG_harmony_private_fields = true;
+ v8::Local<v8::String> source = v8_str(
+ "var X = class {\n"
+ " #foo = 1;\n"
+ " #bar = function() {};\n"
+ "}\n"
+ "var x = new X()");
+ CompileRun(source);
+ v8::Local<v8::Object> object = v8::Local<v8::Object>::Cast(
+ env->Global()
+ ->Get(context, v8_str(env->GetIsolate(), "x"))
+ .ToLocalChecked());
+ v8::Local<v8::Array> private_names =
+ v8::debug::GetPrivateFields(context, object).ToLocalChecked();
+
+ for (int i = 0; i < 4; i = i + 2) {
+ Handle<v8::internal::JSReceiver> private_name =
+ v8::Utils::OpenHandle(*private_names->Get(context, i)
+ .ToLocalChecked()
+ ->ToObject(context)
+ .ToLocalChecked());
+ Handle<v8::internal::JSValue> private_value =
+ Handle<v8::internal::JSValue>::cast(private_name);
+ Handle<v8::internal::Symbol> priv_symbol(
+ v8::internal::Symbol::cast(private_value->value()), isolate);
+ CHECK(priv_symbol->is_private_name());
+ }
+
+ source = v8_str(
+ "var Y = class {\n"
+ " #baz = 2;\n"
+ "}\n"
+ "var X = class extends Y{\n"
+ " #foo = 1;\n"
+ " #bar = function() {};\n"
+ "}\n"
+ "var x = new X()");
+ CompileRun(source);
+ object = v8::Local<v8::Object>::Cast(
+ env->Global()
+ ->Get(context, v8_str(env->GetIsolate(), "x"))
+ .ToLocalChecked());
+ private_names = v8::debug::GetPrivateFields(context, object).ToLocalChecked();
+
+ for (int i = 0; i < 6; i = i + 2) {
+ Handle<v8::internal::JSReceiver> private_name =
+ v8::Utils::OpenHandle(*private_names->Get(context, i)
+ .ToLocalChecked()
+ ->ToObject(context)
+ .ToLocalChecked());
+ Handle<v8::internal::JSValue> private_value =
+ Handle<v8::internal::JSValue>::cast(private_name);
+ Handle<v8::internal::Symbol> priv_symbol(
+ v8::internal::Symbol::cast(private_value->value()), isolate);
+ CHECK(priv_symbol->is_private_name());
+ }
+
+ source = v8_str(
+ "var Y = class {\n"
+ " constructor() {"
+ " return new Proxy({}, {});"
+ " }"
+ "}\n"
+ "var X = class extends Y{\n"
+ " #foo = 1;\n"
+ " #bar = function() {};\n"
+ "}\n"
+ "var x = new X()");
+ CompileRun(source);
+ object = v8::Local<v8::Object>::Cast(
+ env->Global()
+ ->Get(context, v8_str(env->GetIsolate(), "x"))
+ .ToLocalChecked());
+ private_names = v8::debug::GetPrivateFields(context, object).ToLocalChecked();
+
+ for (int i = 0; i < 4; i = i + 2) {
+ Handle<v8::internal::JSReceiver> private_name =
+ v8::Utils::OpenHandle(*private_names->Get(context, i)
+ .ToLocalChecked()
+ ->ToObject(context)
+ .ToLocalChecked());
+ Handle<v8::internal::JSValue> private_value =
+ Handle<v8::internal::JSValue>::cast(private_name);
+ Handle<v8::internal::Symbol> priv_symbol(
+ v8::internal::Symbol::cast(private_value->value()), isolate);
+ CHECK(priv_symbol->is_private_name());
+ }
+}
diff --git a/deps/v8/test/cctest/test-decls.cc b/deps/v8/test/cctest/test-decls.cc
index cce41a3738..2e9bc90fac 100644
--- a/deps/v8/test/cctest/test-decls.cc
+++ b/deps/v8/test/cctest/test-decls.cc
@@ -427,61 +427,6 @@ TEST(AbsentInPrototype) {
-class ExistsInHiddenPrototypeContext: public DeclarationContext {
- public:
- ExistsInHiddenPrototypeContext() {
- hidden_proto_ = FunctionTemplate::New(CcTest::isolate());
- hidden_proto_->SetHiddenPrototype(true);
- }
-
- protected:
- v8::Local<Integer> Query(Local<Name> key) override {
- // Let it seem that the property exists in the hidden prototype object.
- return Integer::New(isolate(), v8::None);
- }
-
- // Install the hidden prototype after the global object has been created.
- void PostInitializeContext(Local<Context> context) override {
- Local<Object> global_object = context->Global();
- Local<Object> hidden_proto = hidden_proto_->GetFunction(context)
- .ToLocalChecked()
- ->NewInstance(context)
- .ToLocalChecked();
- Local<Object> inner_global =
- Local<Object>::Cast(global_object->GetPrototype());
- inner_global->SetPrototype(context, hidden_proto).FromJust();
- }
-
- // Use the hidden prototype as the holder for the interceptors.
- Local<ObjectTemplate> GetHolder(Local<FunctionTemplate> function) override {
- return hidden_proto_->InstanceTemplate();
- }
-
- private:
- Local<FunctionTemplate> hidden_proto_;
-};
-
-
-TEST(ExistsInHiddenPrototype) {
- HandleScope scope(CcTest::isolate());
-
- { ExistsInHiddenPrototypeContext context;
- context.Check("var x; x", 0, 0, 0, EXPECT_RESULT,
- Undefined(CcTest::isolate()));
- }
-
- { ExistsInHiddenPrototypeContext context;
- context.Check("var x = 0; x", 0, 0, 0, EXPECT_RESULT,
- Number::New(CcTest::isolate(), 0));
- }
-
- { ExistsInHiddenPrototypeContext context;
- context.Check("function x() { }; x", 0, 1, 1, EXPECT_RESULT);
- }
-}
-
-
-
class SimpleContext {
public:
SimpleContext()
diff --git a/deps/v8/test/cctest/test-dictionary.cc b/deps/v8/test/cctest/test-dictionary.cc
index feeaeb4214..a06c18df02 100644
--- a/deps/v8/test/cctest/test-dictionary.cc
+++ b/deps/v8/test/cctest/test-dictionary.cc
@@ -36,6 +36,7 @@
#include "src/heap/spaces.h"
#include "src/objects-inl.h"
#include "src/objects/hash-table-inl.h"
+#include "src/roots.h"
#include "test/cctest/heap/heap-utils.h"
namespace v8 {
@@ -218,7 +219,7 @@ TEST(HashTableRehash) {
for (int i = 0; i < capacity - 1; i++) {
t->insert(i, i * i, i);
}
- t->Rehash(isolate);
+ t->Rehash(ReadOnlyRoots(isolate));
for (int i = 0; i < capacity - 1; i++) {
CHECK_EQ(i, t->lookup(i * i));
}
@@ -231,7 +232,7 @@ TEST(HashTableRehash) {
for (int i = 0; i < capacity / 2; i++) {
t->insert(i, i * i, i);
}
- t->Rehash(isolate);
+ t->Rehash(ReadOnlyRoots(isolate));
for (int i = 0; i < capacity / 2; i++) {
CHECK_EQ(i, t->lookup(i * i));
}
diff --git a/deps/v8/test/cctest/test-disasm-arm64.cc b/deps/v8/test/cctest/test-disasm-arm64.cc
index 20ccf77fd0..a401e031f9 100644
--- a/deps/v8/test/cctest/test-disasm-arm64.cc
+++ b/deps/v8/test/cctest/test-disasm-arm64.cc
@@ -74,7 +74,10 @@ namespace internal {
#define COMPARE(ASM, EXP) \
assm->Reset(); \
assm->ASM; \
- assm->GetCode(isolate, nullptr); \
+ { \
+ CodeDesc desc; \
+ assm->GetCode(isolate, &desc); \
+ } \
decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
encoding = *reinterpret_cast<uint32_t*>(buf); \
if (strcmp(disasm->GetOutput(), EXP) != 0) { \
@@ -86,7 +89,10 @@ namespace internal {
#define COMPARE_PREFIX(ASM, EXP) \
assm->Reset(); \
assm->ASM; \
- assm->GetCode(isolate, nullptr); \
+ { \
+ CodeDesc desc; \
+ assm->GetCode(isolate, &desc); \
+ } \
decoder->Decode(reinterpret_cast<Instruction*>(buf)); \
encoding = *reinterpret_cast<uint32_t*>(buf); \
if (strncmp(disasm->GetOutput(), EXP, strlen(EXP)) != 0) { \
diff --git a/deps/v8/test/cctest/test-disasm-x64.cc b/deps/v8/test/cctest/test-disasm-x64.cc
index 085fd4be7c..15eef72a6b 100644
--- a/deps/v8/test/cctest/test-disasm-x64.cc
+++ b/deps/v8/test/cctest/test-disasm-x64.cc
@@ -205,8 +205,7 @@ TEST(DisasmX64) {
__ incq(Operand(rbx, rcx, times_4, 10000));
__ pushq(Operand(rbx, rcx, times_4, 10000));
__ popq(Operand(rbx, rcx, times_4, 10000));
- // TODO(mstarzinger): The following is protected.
- // __ jmp(Operand(rbx, rcx, times_4, 10000));
+ __ jmp(Operand(rbx, rcx, times_4, 10000));
__ leaq(rdx, Operand(rbx, rcx, times_4, 10000));
__ orq(rdx, Immediate(12345));
@@ -291,8 +290,7 @@ TEST(DisasmX64) {
__ nop();
__ jmp(&L1);
- // TODO(mstarzinger): The following is protected.
- // __ jmp(Operand(rbx, rcx, times_4, 10000));
+ __ jmp(Operand(rbx, rcx, times_4, 10000));
__ jmp(ic, RelocInfo::CODE_TARGET);
__ nop();
diff --git a/deps/v8/test/cctest/test-elements-kind.cc b/deps/v8/test/cctest/test-elements-kind.cc
index ca382a60c1..d7f6ccb852 100644
--- a/deps/v8/test/cctest/test-elements-kind.cc
+++ b/deps/v8/test/cctest/test-elements-kind.cc
@@ -113,7 +113,8 @@ TEST(JSObjectInObjectAddingProperties) {
factory->NewFunctionForTest(factory->empty_string());
int nof_inobject_properties = 10;
// force in object properties by changing the expected_nof_properties
- function->shared()->set_expected_nof_properties(nof_inobject_properties);
+ // (we always reserve 8 inobject properties slack on top).
+ function->shared()->set_expected_nof_properties(nof_inobject_properties - 8);
Handle<Object> value(Smi::FromInt(42), isolate);
Handle<JSObject> object = factory->NewJSObject(function);
diff --git a/deps/v8/test/cctest/test-factory.cc b/deps/v8/test/cctest/test-factory.cc
index a282f4bccd..abb77b5b6b 100644
--- a/deps/v8/test/cctest/test-factory.cc
+++ b/deps/v8/test/cctest/test-factory.cc
@@ -4,6 +4,7 @@
#include "include/v8.h"
+#include "src/code-desc.h"
#include "src/handles-inl.h"
#include "src/isolate.h"
#include "test/cctest/cctest.h"
diff --git a/deps/v8/test/cctest/test-feedback-vector.cc b/deps/v8/test/cctest/test-feedback-vector.cc
index c241ac6b7d..c8ffddbf7b 100644
--- a/deps/v8/test/cctest/test-feedback-vector.cc
+++ b/deps/v8/test/cctest/test-feedback-vector.cc
@@ -176,14 +176,14 @@ TEST(VectorCallICStates) {
Handle<FeedbackVector>(f->feedback_vector(), isolate);
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
CompileRun("f(function() { return 16; })");
- CHECK_EQ(GENERIC, nexus.StateFromFeedback());
+ CHECK_EQ(GENERIC, nexus.ic_state());
// After a collection, state should remain GENERIC.
CcTest::CollectAllGarbage();
- CHECK_EQ(GENERIC, nexus.StateFromFeedback());
+ CHECK_EQ(GENERIC, nexus.ic_state());
}
TEST(VectorCallFeedback) {
@@ -206,14 +206,14 @@ TEST(VectorCallFeedback) {
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
HeapObject heap_object;
CHECK(nexus.GetFeedback()->GetHeapObjectIfWeak(&heap_object));
CHECK_EQ(*foo, heap_object);
CcTest::CollectAllGarbage();
// It should stay monomorphic even after a GC.
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
}
TEST(VectorCallFeedbackForArray) {
@@ -233,14 +233,14 @@ TEST(VectorCallFeedbackForArray) {
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
HeapObject heap_object;
CHECK(nexus.GetFeedback()->GetHeapObjectIfWeak(&heap_object));
CHECK_EQ(*isolate->array_function(), heap_object);
CcTest::CollectAllGarbage();
// It should stay monomorphic even after a GC.
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
}
size_t GetFeedbackVectorLength(Isolate* isolate, const char* src,
@@ -326,15 +326,15 @@ TEST(VectorCallCounts) {
Handle<FeedbackVector>(f->feedback_vector(), isolate);
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
CompileRun("f(foo); f(foo);");
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
CHECK_EQ(3, nexus.GetCallCount());
// Send the IC megamorphic, but we should still have incrementing counts.
CompileRun("f(function() { return 12; });");
- CHECK_EQ(GENERIC, nexus.StateFromFeedback());
+ CHECK_EQ(GENERIC, nexus.ic_state());
CHECK_EQ(4, nexus.GetCallCount());
}
@@ -357,17 +357,17 @@ TEST(VectorConstructCounts) {
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
CHECK(feedback_vector->Get(slot)->IsWeak());
CompileRun("f(Foo); f(Foo);");
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
CHECK_EQ(3, nexus.GetCallCount());
// Send the IC megamorphic, but we should still have incrementing counts.
CompileRun("f(function() {});");
- CHECK_EQ(GENERIC, nexus.StateFromFeedback());
+ CHECK_EQ(GENERIC, nexus.ic_state());
CHECK_EQ(4, nexus.GetCallCount());
}
@@ -424,40 +424,40 @@ TEST(VectorLoadICStates) {
Handle<FeedbackVector>(f->feedback_vector(), isolate);
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(PREMONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(PREMONOMORPHIC, nexus.ic_state());
CompileRun("f(o)");
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
// Verify that the monomorphic map is the one we expect.
v8::MaybeLocal<v8::Value> v8_o =
CcTest::global()->Get(context.local(), v8_str("o"));
Handle<JSObject> o =
Handle<JSObject>::cast(v8::Utils::OpenHandle(*v8_o.ToLocalChecked()));
- CHECK_EQ(o->map(), nexus.FindFirstMap());
+ CHECK_EQ(o->map(), nexus.GetFirstMap());
// Now go polymorphic.
CompileRun("f({ blarg: 3, foo: 2 })");
- CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(POLYMORPHIC, nexus.ic_state());
CompileRun(
"delete o.foo;"
"f(o)");
- CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(POLYMORPHIC, nexus.ic_state());
CompileRun("f({ blarg: 3, torino: 10, foo: 2 })");
- CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(POLYMORPHIC, nexus.ic_state());
MapHandles maps;
nexus.ExtractMaps(&maps);
CHECK_EQ(4, maps.size());
// Finally driven megamorphic.
CompileRun("f({ blarg: 3, gran: 3, torino: 10, foo: 2 })");
- CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback());
- CHECK(nexus.FindFirstMap().is_null());
+ CHECK_EQ(MEGAMORPHIC, nexus.ic_state());
+ CHECK(nexus.GetFirstMap().is_null());
// After a collection, state should not be reset to PREMONOMORPHIC.
CcTest::CollectAllGarbage();
- CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MEGAMORPHIC, nexus.ic_state());
}
TEST(VectorLoadGlobalICSlotSharing) {
@@ -490,10 +490,8 @@ TEST(VectorLoadGlobalICSlotSharing) {
CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kLoadGlobalInsideTypeof);
FeedbackSlot slot1 = helper.slot(0);
FeedbackSlot slot2 = helper.slot(1);
- CHECK_EQ(MONOMORPHIC,
- FeedbackNexus(feedback_vector, slot1).StateFromFeedback());
- CHECK_EQ(MONOMORPHIC,
- FeedbackNexus(feedback_vector, slot2).StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, FeedbackNexus(feedback_vector, slot1).ic_state());
+ CHECK_EQ(MONOMORPHIC, FeedbackNexus(feedback_vector, slot2).ic_state());
}
@@ -517,17 +515,17 @@ TEST(VectorLoadICOnSmi) {
Handle<FeedbackVector>(f->feedback_vector(), isolate);
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(PREMONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(PREMONOMORPHIC, nexus.ic_state());
CompileRun("f(34)");
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
// Verify that the monomorphic map is the one we expect.
Map number_map = ReadOnlyRoots(heap).heap_number_map();
- CHECK_EQ(number_map, nexus.FindFirstMap());
+ CHECK_EQ(number_map, nexus.GetFirstMap());
// Now go polymorphic on o.
CompileRun("f(o)");
- CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(POLYMORPHIC, nexus.ic_state());
MapHandles maps;
nexus.ExtractMaps(&maps);
@@ -550,7 +548,7 @@ TEST(VectorLoadICOnSmi) {
// The degree of polymorphism doesn't change.
CompileRun("f(100)");
- CHECK_EQ(POLYMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(POLYMORPHIC, nexus.ic_state());
MapHandles maps2;
nexus.ExtractMaps(&maps2);
CHECK_EQ(2, maps2.size());
@@ -720,7 +718,7 @@ TEST(VectorStoreICBasic) {
CHECK_EQ(1, helper.slot_count());
FeedbackSlot slot(0);
FeedbackNexus nexus(feedback_vector, slot);
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
}
TEST(StoreOwnIC) {
@@ -746,7 +744,7 @@ TEST(StoreOwnIC) {
CHECK_SLOT_KIND(helper, 0, FeedbackSlotKind::kLiteral);
CHECK_SLOT_KIND(helper, 1, FeedbackSlotKind::kStoreOwnNamed);
FeedbackNexus nexus(feedback_vector, helper.slot(1));
- CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback());
+ CHECK_EQ(MONOMORPHIC, nexus.ic_state());
}
} // namespace
diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc
index dca13242ba..49b0f92011 100644
--- a/deps/v8/test/cctest/test-field-type-tracking.cc
+++ b/deps/v8/test/cctest/test-field-type-tracking.cc
@@ -124,18 +124,10 @@ class Expectations {
kinds_[index] = kind;
locations_[index] = location;
if (kind == kData && location == kField &&
- IsTransitionableFastElementsKind(elements_kind_) &&
- Map::IsInplaceGeneralizableField(constness, representation,
- FieldType::cast(*value))) {
- // Maps with transitionable elements kinds must have non in-place
- // generalizable fields.
- if (FLAG_track_constant_fields && FLAG_modify_map_inplace &&
- constness == PropertyConstness::kConst) {
- constness = PropertyConstness::kMutable;
- }
- if (representation.IsHeapObject() && !FieldType::cast(*value)->IsAny()) {
- value = FieldType::Any(isolate_);
- }
+ IsTransitionableFastElementsKind(elements_kind_)) {
+ // Maps with transitionable elements kinds must have the most general
+ // field type.
+ value = FieldType::Any(isolate_);
}
constnesses_[index] = constness;
attributes_[index] = attributes;
@@ -278,6 +270,7 @@ class Expectations {
if (details.attributes() != expected_attributes) return false;
Representation expected_representation = representations_[descriptor];
+
if (!details.representation().Equals(expected_representation)) return false;
Object expected_value = *values_[descriptor];
@@ -341,6 +334,12 @@ class Expectations {
return map;
}
+ void ChangeAttributesForAllProperties(PropertyAttributes attributes) {
+ for (int i = 0; i < number_of_properties_; i++) {
+ attributes_[i] = attributes;
+ }
+ }
+
Handle<Map> AddDataField(Handle<Map> map, PropertyAttributes attributes,
PropertyConstness constness,
Representation representation,
@@ -665,7 +664,7 @@ static void TestGeneralizeField(int detach_property_at_index,
// Create new maps by generalizing representation of propX field.
CanonicalHandleScope canonical(isolate);
JSHeapBroker broker(isolate, &zone);
- CompilationDependencies dependencies(isolate, &zone);
+ CompilationDependencies dependencies(&broker, &zone);
MapRef map_ref(&broker, map);
map_ref.SerializeOwnDescriptors();
dependencies.DependOnFieldType(map_ref, property_index);
@@ -1042,7 +1041,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeField(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
JSHeapBroker broker(isolate, &zone);
- CompilationDependencies dependencies(isolate, &zone);
+ CompilationDependencies dependencies(&broker, &zone);
MapRef map_ref(&broker, map);
map_ref.SerializeOwnDescriptors();
dependencies.DependOnFieldType(map_ref, kSplitProp);
@@ -1129,10 +1128,11 @@ static void TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
JSHeapBroker broker(isolate, &zone);
- CompilationDependencies dependencies(isolate, &zone);
+ CompilationDependencies dependencies(&broker, &zone);
MapRef map_ref(&broker, map);
map_ref.SerializeOwnDescriptors();
dependencies.DependOnFieldType(map_ref, kSplitProp);
+ dependencies.DependOnFieldConstness(map_ref, kSplitProp);
// Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which
// should generalize representations in |map1|.
@@ -1813,7 +1813,7 @@ static void TestReconfigureElementsKind_GeneralizeField(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
JSHeapBroker broker(isolate, &zone);
- CompilationDependencies dependencies(isolate, &zone);
+ CompilationDependencies dependencies(&broker, &zone);
MapRef map_ref(&broker, map);
map_ref.SerializeOwnDescriptors();
dependencies.DependOnFieldType(map_ref, kDiffProp);
@@ -1911,10 +1911,12 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
JSHeapBroker broker(isolate, &zone);
- CompilationDependencies dependencies(isolate, &zone);
+ CompilationDependencies dependencies(&broker, &zone);
MapRef map_ref(&broker, map);
map_ref.SerializeOwnDescriptors();
+
dependencies.DependOnFieldType(map_ref, kDiffProp);
+ dependencies.DependOnFieldConstness(map_ref, kDiffProp);
// Reconfigure elements kinds of |map2|, which should generalize
// representations in |map|.
@@ -1935,7 +1937,8 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
expected.representation, expected.type);
CHECK(!map->is_deprecated());
CHECK_EQ(*map, *new_map);
- CHECK(dependencies.AreValid());
+ CHECK_EQ(IsGeneralizableTo(to.constness, from.constness),
+ dependencies.AreValid());
CHECK(!new_map->is_deprecated());
CHECK(expectations.Check(*new_map));
@@ -2333,9 +2336,12 @@ static void TestGeneralizeFieldWithSpecialTransition(TestConfig& config,
// If Map::TryUpdate() manages to succeed the result must match the result
// of Map::Update().
CHECK_EQ(*new_map2, *tmp_map);
+ } else {
+ // Equivalent transitions should always find the updated map.
+ CHECK(config.is_non_equivalent_transition());
}
- if (config.is_non_equevalent_transition()) {
+ if (config.is_non_equivalent_transition()) {
// In case of non-equivalent transition currently we generalize all
// representations.
for (int i = 0; i < kPropCount; i++) {
@@ -2344,6 +2350,9 @@ static void TestGeneralizeFieldWithSpecialTransition(TestConfig& config,
CHECK(new_map2->GetBackPointer()->IsUndefined(isolate));
CHECK(expectations2.Check(*new_map2));
} else {
+ expectations2.SetDataField(i, expected.constness, expected.representation,
+ expected.type);
+
CHECK(!new_map2->GetBackPointer()->IsUndefined(isolate));
CHECK(expectations2.Check(*new_map2));
}
@@ -2374,23 +2383,33 @@ TEST(ElementsKindTransitionFromMapOwningDescriptor) {
FieldType::Class(Map::Create(isolate, 0), isolate);
struct TestConfig {
+ TestConfig(PropertyAttributes attributes, Handle<Symbol> symbol)
+ : attributes(attributes), symbol(symbol) {}
+
Handle<Map> Transition(Handle<Map> map, Expectations& expectations) {
- Handle<Symbol> frozen_symbol(map->GetReadOnlyRoots().frozen_symbol(),
- CcTest::i_isolate());
expectations.SetElementsKind(DICTIONARY_ELEMENTS);
- return Map::CopyForPreventExtensions(CcTest::i_isolate(), map, NONE,
- frozen_symbol,
- "CopyForPreventExtensions");
+ expectations.ChangeAttributesForAllProperties(attributes);
+ return Map::CopyForPreventExtensions(CcTest::i_isolate(), map, attributes,
+ symbol, "CopyForPreventExtensions");
}
// TODO(ishell): remove once IS_PROTO_TRANS_ISSUE_FIXED is removed.
bool generalizes_representations() const { return false; }
- bool is_non_equevalent_transition() const { return true; }
+ bool is_non_equivalent_transition() const { return false; }
+
+ PropertyAttributes attributes;
+ Handle<Symbol> symbol;
};
- TestConfig config;
- TestGeneralizeFieldWithSpecialTransition(
- config, {PropertyConstness::kMutable, Representation::Smi(), any_type},
- {PropertyConstness::kMutable, Representation::HeapObject(), value_type},
- {PropertyConstness::kMutable, Representation::Tagged(), any_type});
+ Factory* factory = isolate->factory();
+ TestConfig configs[] = {{FROZEN, factory->frozen_symbol()},
+ {SEALED, factory->sealed_symbol()},
+ {NONE, factory->nonextensible_symbol()}};
+ for (size_t i = 0; i < arraysize(configs); i++) {
+ TestGeneralizeFieldWithSpecialTransition(
+ configs[i],
+ {PropertyConstness::kMutable, Representation::Smi(), any_type},
+ {PropertyConstness::kMutable, Representation::HeapObject(), value_type},
+ {PropertyConstness::kMutable, Representation::Tagged(), any_type});
+ }
}
@@ -2404,6 +2423,9 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) {
FieldType::Class(Map::Create(isolate, 0), isolate);
struct TestConfig {
+ TestConfig(PropertyAttributes attributes, Handle<Symbol> symbol)
+ : attributes(attributes), symbol(symbol) {}
+
Handle<Map> Transition(Handle<Map> map, Expectations& expectations) {
Isolate* isolate = CcTest::i_isolate();
Handle<FieldType> any_type = FieldType::Any(isolate);
@@ -2417,21 +2439,29 @@ TEST(ElementsKindTransitionFromMapNotOwningDescriptor) {
.ToHandleChecked();
CHECK(!map->owns_descriptors());
- Handle<Symbol> frozen_symbol(ReadOnlyRoots(isolate).frozen_symbol(),
- isolate);
expectations.SetElementsKind(DICTIONARY_ELEMENTS);
- return Map::CopyForPreventExtensions(isolate, map, NONE, frozen_symbol,
+ expectations.ChangeAttributesForAllProperties(attributes);
+ return Map::CopyForPreventExtensions(isolate, map, attributes, symbol,
"CopyForPreventExtensions");
}
// TODO(ishell): remove once IS_PROTO_TRANS_ISSUE_FIXED is removed.
bool generalizes_representations() const { return false; }
- bool is_non_equevalent_transition() const { return true; }
+ bool is_non_equivalent_transition() const { return false; }
+
+ PropertyAttributes attributes;
+ Handle<Symbol> symbol;
};
- TestConfig config;
- TestGeneralizeFieldWithSpecialTransition(
- config, {PropertyConstness::kMutable, Representation::Smi(), any_type},
- {PropertyConstness::kMutable, Representation::HeapObject(), value_type},
- {PropertyConstness::kMutable, Representation::Tagged(), any_type});
+ Factory* factory = isolate->factory();
+ TestConfig configs[] = {{FROZEN, factory->frozen_symbol()},
+ {SEALED, factory->sealed_symbol()},
+ {NONE, factory->nonextensible_symbol()}};
+ for (size_t i = 0; i < arraysize(configs); i++) {
+ TestGeneralizeFieldWithSpecialTransition(
+ configs[i],
+ {PropertyConstness::kMutable, Representation::Smi(), any_type},
+ {PropertyConstness::kMutable, Representation::HeapObject(), value_type},
+ {PropertyConstness::kMutable, Representation::Tagged(), any_type});
+ }
}
@@ -2460,7 +2490,7 @@ TEST(PrototypeTransitionFromMapOwningDescriptor) {
bool generalizes_representations() const {
return !IS_PROTO_TRANS_ISSUE_FIXED;
}
- bool is_non_equevalent_transition() const { return true; }
+ bool is_non_equivalent_transition() const { return true; }
};
TestConfig config;
TestGeneralizeFieldWithSpecialTransition(
@@ -2507,7 +2537,7 @@ TEST(PrototypeTransitionFromMapNotOwningDescriptor) {
bool generalizes_representations() const {
return !IS_PROTO_TRANS_ISSUE_FIXED;
}
- bool is_non_equevalent_transition() const { return true; }
+ bool is_non_equivalent_transition() const { return true; }
};
TestConfig config;
TestGeneralizeFieldWithSpecialTransition(
diff --git a/deps/v8/test/cctest/test-func-name-inference.cc b/deps/v8/test/cctest/test-func-name-inference.cc
index 23ac83a953..538be20e71 100644
--- a/deps/v8/test/cctest/test-func-name-inference.cc
+++ b/deps/v8/test/cctest/test-func-name-inference.cc
@@ -453,8 +453,8 @@ TEST(FactoryHashmapVariable) {
" return obj;\n"
"}");
// Can't infer function names statically.
- CheckFunctionName(script, "return 1", "obj.(anonymous function)");
- CheckFunctionName(script, "return 2", "obj.(anonymous function)");
+ CheckFunctionName(script, "return 1", "obj.<computed>");
+ CheckFunctionName(script, "return 2", "obj.<computed>");
}
@@ -470,7 +470,7 @@ TEST(FactoryHashmapConditional) {
" return obj;\n"
"}");
// Can't infer the function name statically.
- CheckFunctionName(script, "return 1", "obj.(anonymous function)");
+ CheckFunctionName(script, "return 1", "obj.<computed>");
}
diff --git a/deps/v8/test/cctest/test-global-handles.cc b/deps/v8/test/cctest/test-global-handles.cc
index 0db56e382a..b81007f40e 100644
--- a/deps/v8/test/cctest/test-global-handles.cc
+++ b/deps/v8/test/cctest/test-global-handles.cc
@@ -28,9 +28,11 @@
#include "src/api-inl.h"
#include "src/global-handles.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "test/cctest/cctest.h"
+#include "test/cctest/heap/heap-utils.h"
namespace v8 {
namespace internal {
@@ -69,6 +71,14 @@ void ConstructJSObject(v8::Isolate* isolate, v8::Local<v8::Context> context,
CHECK(!flag_and_persistent->handle.IsEmpty());
}
+void ConstructJSObject(v8::Isolate* isolate, v8::Global<v8::Object>* global) {
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Object> object(v8::Object::New(isolate));
+ CHECK(!object.IsEmpty());
+ *global = v8::Global<v8::Object>(isolate, object);
+ CHECK(!global->IsEmpty());
+}
+
void ConstructJSApiObject(v8::Isolate* isolate, v8::Local<v8::Context> context,
FlagAndPersistent* flag_and_persistent) {
v8::HandleScope handle_scope(isolate);
@@ -95,12 +105,7 @@ void WeakHandleTest(v8::Isolate* isolate, ConstructFunction construct_function,
FlagAndPersistent fp;
construct_function(isolate, context, &fp);
- {
- v8::HandleScope scope(isolate);
- v8::Local<v8::Object> tmp = v8::Local<v8::Object>::New(isolate, fp.handle);
- CHECK(i::Heap::InNewSpace(*v8::Utils::OpenHandle(*tmp)));
- }
-
+ CHECK(heap::InYoungGeneration(isolate, fp.handle));
fp.handle.SetWeak(&fp, &ResetHandleAndSetFlag,
v8::WeakCallbackType::kParameter);
fp.flag = false;
@@ -340,7 +345,16 @@ TEST(WeakHandleToActiveUnmodifiedJSApiObjectSurvivesScavenge) {
CcTest::InitializeVM();
WeakHandleTest(
CcTest::isolate(), &ConstructJSApiObject,
- [](FlagAndPersistent* fp) { fp->handle.MarkActive(); },
+ [](FlagAndPersistent* fp) {
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+#endif
+ fp->handle.MarkActive();
+#if __clang__
+#pragma clang diagnostic pop
+#endif
+ },
[]() { InvokeScavenge(); }, SurvivalMode::kSurvives);
}
@@ -348,7 +362,16 @@ TEST(WeakHandleToActiveUnmodifiedJSApiObjectDiesOnMarkCompact) {
CcTest::InitializeVM();
WeakHandleTest(
CcTest::isolate(), &ConstructJSApiObject,
- [](FlagAndPersistent* fp) { fp->handle.MarkActive(); },
+ [](FlagAndPersistent* fp) {
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+#endif
+ fp->handle.MarkActive();
+#if __clang__
+#pragma clang diagnostic pop
+#endif
+ },
[]() { InvokeMarkSweep(); }, SurvivalMode::kDies);
}
@@ -357,7 +380,14 @@ TEST(WeakHandleToActiveUnmodifiedJSApiObjectSurvivesMarkCompactWhenInHandle) {
WeakHandleTest(
CcTest::isolate(), &ConstructJSApiObject,
[](FlagAndPersistent* fp) {
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+#endif
fp->handle.MarkActive();
+#if __clang__
+#pragma clang diagnostic pop
+#endif
v8::Local<v8::Object> handle =
v8::Local<v8::Object>::New(CcTest::isolate(), fp->handle);
USE(handle);
@@ -487,12 +517,7 @@ TEST(GCFromWeakCallbacks) {
for (int inner_gc = 0; inner_gc < kNumberOfGCTypes; inner_gc++) {
FlagAndPersistent fp;
ConstructJSApiObject(isolate, context, &fp);
- {
- v8::HandleScope scope(isolate);
- v8::Local<v8::Object> tmp =
- v8::Local<v8::Object>::New(isolate, fp.handle);
- CHECK(i::Heap::InNewSpace(*v8::Utils::OpenHandle(*tmp)));
- }
+ CHECK(heap::InYoungGeneration(isolate, fp.handle));
fp.flag = false;
fp.handle.SetWeak(&fp, gc_forcing_callback[inner_gc],
v8::WeakCallbackType::kParameter);
@@ -532,5 +557,32 @@ TEST(SecondPassPhantomCallbacks) {
CHECK(fp.flag);
}
+TEST(MoveStrongGlobal) {
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+
+ v8::Global<v8::Object>* global = new Global<v8::Object>();
+ ConstructJSObject(isolate, global);
+ InvokeMarkSweep();
+ v8::Global<v8::Object> global2(std::move(*global));
+ delete global;
+ InvokeMarkSweep();
+}
+
+TEST(MoveWeakGlobal) {
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+
+ v8::Global<v8::Object>* global = new Global<v8::Object>();
+ ConstructJSObject(isolate, global);
+ InvokeMarkSweep();
+ global->SetWeak();
+ v8::Global<v8::Object> global2(std::move(*global));
+ delete global;
+ InvokeMarkSweep();
+}
+
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc
index 84ecc78ff3..5e61199e86 100644
--- a/deps/v8/test/cctest/test-heap-profiler.cc
+++ b/deps/v8/test/cctest/test-heap-profiler.cc
@@ -40,6 +40,7 @@
#include "src/base/optional.h"
#include "src/collector.h"
#include "src/debug/debug.h"
+#include "src/heap/heap-inl.h"
#include "src/objects-inl.h"
#include "src/profiler/allocation-tracker.h"
#include "src/profiler/heap-profiler.h"
@@ -2693,6 +2694,9 @@ TEST(TrackHeapAllocationsWithInlining) {
CHECK(node);
// In lite mode, there is feedback and feedback metadata.
unsigned int num_nodes = (i::FLAG_lite_mode) ? 6 : 8;
+ // Without forced source position collection, there is no source position
+ // table.
+ if (i::FLAG_enable_lazy_source_positions) num_nodes -= 1;
CHECK_GE(node->allocation_count(), num_nodes);
CHECK_GE(node->allocation_size(), 4 * node->allocation_count());
heap_profiler->StopTrackingHeapObjects();
diff --git a/deps/v8/test/cctest/test-icache.cc b/deps/v8/test/cctest/test-icache.cc
index c1dde75a93..ac03a6fc59 100644
--- a/deps/v8/test/cctest/test-icache.cc
+++ b/deps/v8/test/cctest/test-icache.cc
@@ -24,7 +24,7 @@ static constexpr int kBufferSize = 8 * KB;
static void FloodWithInc(Isolate* isolate, TestingAssemblerBuffer* buffer) {
MacroAssembler masm(isolate, CodeObjectRequired::kYes, buffer->CreateView());
#if V8_TARGET_ARCH_IA32
- __ mov(eax, Operand(esp, kPointerSize));
+ __ mov(eax, Operand(esp, kSystemPointerSize));
for (int i = 0; i < kNumInstr; ++i) {
__ add(eax, Immediate(1));
}
@@ -70,7 +70,7 @@ static void FloodWithInc(Isolate* isolate, TestingAssemblerBuffer* buffer) {
static void FloodWithNop(Isolate* isolate, TestingAssemblerBuffer* buffer) {
MacroAssembler masm(isolate, CodeObjectRequired::kYes, buffer->CreateView());
#if V8_TARGET_ARCH_IA32
- __ mov(eax, Operand(esp, kPointerSize));
+ __ mov(eax, Operand(esp, kSystemPointerSize));
#elif V8_TARGET_ARCH_X64
__ movl(rax, arg_reg_1);
#elif V8_TARGET_ARCH_MIPS
@@ -101,14 +101,14 @@ TEST(TestFlushICacheOfWritable) {
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadWrite));
FloodWithInc(isolate, buffer.get());
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadExecute));
CHECK_EQ(23 + kNumInstr, f.Call(23)); // Call into generated code.
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadWrite));
FloodWithNop(isolate, buffer.get());
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadExecute));
CHECK_EQ(23, f.Call(23)); // Call into generated code.
@@ -148,14 +148,14 @@ CONDITIONAL_TEST(TestFlushICacheOfExecutable) {
FloodWithInc(isolate, buffer.get());
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadExecute));
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK_EQ(23 + kNumInstr, f.Call(23)); // Call into generated code.
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadWrite));
FloodWithNop(isolate, buffer.get());
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadExecute));
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK_EQ(23, f.Call(23)); // Call into generated code.
}
}
@@ -177,10 +177,10 @@ TEST(TestFlushICacheOfWritableAndExecutable) {
CHECK(SetPermissions(GetPlatformPageAllocator(), buffer->start(),
buffer->size(), v8::PageAllocator::kReadWriteExecute));
FloodWithInc(isolate, buffer.get());
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK_EQ(23 + kNumInstr, f.Call(23)); // Call into generated code.
FloodWithNop(isolate, buffer.get());
- Assembler::FlushICache(buffer->start(), buffer->size());
+ FlushInstructionCache(buffer->start(), buffer->size());
CHECK_EQ(23, f.Call(23)); // Call into generated code.
}
}
diff --git a/deps/v8/test/cctest/test-inobject-slack-tracking.cc b/deps/v8/test/cctest/test-inobject-slack-tracking.cc
index 61984afe23..5646f97a33 100644
--- a/deps/v8/test/cctest/test-inobject-slack-tracking.cc
+++ b/deps/v8/test/cctest/test-inobject-slack-tracking.cc
@@ -47,7 +47,7 @@ Handle<T> GetLexical(const char* name) {
isolate->native_context()->script_context_table(), isolate);
ScriptContextTable::LookupResult lookup_result;
- if (ScriptContextTable::Lookup(isolate, script_contexts, str_name,
+ if (ScriptContextTable::Lookup(isolate, *script_contexts, *str_name,
&lookup_result)) {
Handle<Context> script_context = ScriptContextTable::GetContext(
isolate, script_contexts, lookup_result.context_index);
@@ -1210,6 +1210,154 @@ TEST(SubclassPromiseBuiltinNoInlineNew) {
TestSubclassPromiseBuiltin();
}
+TEST(SubclassTranspiledClassHierarchy) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ CompileRun(
+ "Object.setPrototypeOf(B, A);\n"
+ "function A() {\n"
+ " this.a0 = 0;\n"
+ " this.a1 = 1;\n"
+ " this.a2 = 1;\n"
+ " this.a3 = 1;\n"
+ " this.a4 = 1;\n"
+ " this.a5 = 1;\n"
+ " this.a6 = 1;\n"
+ " this.a7 = 1;\n"
+ " this.a8 = 1;\n"
+ " this.a9 = 1;\n"
+ " this.a10 = 1;\n"
+ " this.a11 = 1;\n"
+ " this.a12 = 1;\n"
+ " this.a13 = 1;\n"
+ " this.a14 = 1;\n"
+ " this.a15 = 1;\n"
+ " this.a16 = 1;\n"
+ " this.a17 = 1;\n"
+ " this.a18 = 1;\n"
+ " this.a19 = 1;\n"
+ "};\n"
+ "function B() {\n"
+ " A.call(this);\n"
+ " this.b = 1;\n"
+ "};\n");
+
+ Handle<JSFunction> func = GetGlobal<JSFunction>("B");
+
+ // Zero instances have been created so far.
+ CHECK(!func->has_initial_map());
+
+ v8::Local<v8::Script> new_script = v8_compile("new B()");
+
+ RunI<JSObject>(new_script);
+
+ CHECK(func->has_initial_map());
+ Handle<Map> initial_map(func->initial_map(), func->GetIsolate());
+
+ CHECK_EQ(JS_OBJECT_TYPE, initial_map->instance_type());
+
+ // One instance of a subclass created.
+ CHECK_EQ(Map::kSlackTrackingCounterStart - 1,
+ initial_map->construction_counter());
+ CHECK(initial_map->IsInobjectSlackTrackingInProgress());
+
+ // Create two instances in order to ensure that |obj|.o is a data field
+ // in case of Function subclassing.
+ Handle<JSObject> obj = RunI<JSObject>(new_script);
+
+ // Two instances of a subclass created.
+ CHECK_EQ(Map::kSlackTrackingCounterStart - 2,
+ initial_map->construction_counter());
+ CHECK(initial_map->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+
+ // Create several subclass instances to complete the tracking.
+ for (int i = 2; i < Map::kGenerousAllocationCount; i++) {
+ CHECK(initial_map->IsInobjectSlackTrackingInProgress());
+ Handle<JSObject> tmp = RunI<JSObject>(new_script);
+ CHECK_EQ(initial_map->IsInobjectSlackTrackingInProgress(),
+ IsObjectShrinkable(*tmp));
+ }
+ CHECK(!initial_map->IsInobjectSlackTrackingInProgress());
+ CHECK(!IsObjectShrinkable(*obj));
+
+ // No slack left.
+ CHECK_EQ(21, obj->map()->GetInObjectProperties());
+ CHECK_EQ(JS_OBJECT_TYPE, obj->map()->instance_type());
+}
+
+TEST(Regress8853_ClassConstructor) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ // For classes without any this.prop assignments in their
+ // constructors we start out with 10 inobject properties.
+ Handle<JSObject> obj = CompileRunI<JSObject>("new (class {});\n");
+ CHECK(obj->map()->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+ CHECK_EQ(10, obj->map()->GetInObjectProperties());
+
+ // For classes with N explicit this.prop assignments in their
+ // constructors we start out with N+8 inobject properties.
+ obj = CompileRunI<JSObject>(
+ "new (class {\n"
+ " constructor() {\n"
+ " this.x = 1;\n"
+ " this.y = 2;\n"
+ " this.z = 3;\n"
+ " }\n"
+ "});\n");
+ CHECK(obj->map()->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+ CHECK_EQ(3 + 8, obj->map()->GetInObjectProperties());
+}
+
+TEST(Regress8853_ClassHierarchy) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ // For class hierarchies without any this.prop assignments in their
+ // constructors we reserve 2 inobject properties per constructor plus
+ // 8 inobject properties slack on top.
+ std::string base = "(class {})";
+ for (int i = 1; i < 10; ++i) {
+ std::string script = "new " + base + ";\n";
+ Handle<JSObject> obj = CompileRunI<JSObject>(script.c_str());
+ CHECK(obj->map()->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+ CHECK_EQ(8 + 2 * i, obj->map()->GetInObjectProperties());
+ base = "(class extends " + base + " {})";
+ }
+}
+
+TEST(Regress8853_FunctionConstructor) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+
+ // For constructor functions without any this.prop assignments in
+ // them we start out with 10 inobject properties.
+ Handle<JSObject> obj = CompileRunI<JSObject>("new (function() {});\n");
+ CHECK(obj->map()->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+ CHECK_EQ(10, obj->map()->GetInObjectProperties());
+
+ // For constructor functions with N explicit this.prop assignments
+ // in them we start out with N+8 inobject properties.
+ obj = CompileRunI<JSObject>(
+ "new (function() {\n"
+ " this.a = 1;\n"
+ " this.b = 2;\n"
+ " this.c = 3;\n"
+ " this.d = 3;\n"
+ " this.c = 3;\n"
+ " this.f = 3;\n"
+ "});\n");
+ CHECK(obj->map()->IsInobjectSlackTrackingInProgress());
+ CHECK(IsObjectShrinkable(*obj));
+ CHECK_EQ(6 + 8, obj->map()->GetInObjectProperties());
+}
+
} // namespace test_inobject_slack_tracking
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-intl.cc b/deps/v8/test/cctest/test-intl.cc
index 0670340227..d916507760 100644
--- a/deps/v8/test/cctest/test-intl.cc
+++ b/deps/v8/test/cctest/test-intl.cc
@@ -132,7 +132,8 @@ TEST(GetStringOption) {
Handle<String> key = isolate->factory()->NewStringFromAsciiChecked("foo");
v8::internal::LookupIterator it(isolate, options, key);
CHECK(Object::SetProperty(&it, Handle<Smi>(Smi::FromInt(42), isolate),
- LanguageMode::kStrict, StoreOrigin::kMaybeKeyed)
+ StoreOrigin::kMaybeKeyed,
+ Just(ShouldThrow::kThrowOnError))
.FromJust());
{
@@ -191,7 +192,8 @@ TEST(GetBoolOption) {
Handle<Object> false_value =
handle(i::ReadOnlyRoots(isolate).false_value(), isolate);
Object::SetProperty(isolate, options, key, false_value,
- LanguageMode::kStrict)
+ StoreOrigin::kMaybeKeyed,
+ Just(ShouldThrow::kThrowOnError))
.Assert();
bool result = false;
Maybe<bool> found =
@@ -205,7 +207,8 @@ TEST(GetBoolOption) {
Handle<Object> true_value =
handle(i::ReadOnlyRoots(isolate).true_value(), isolate);
Object::SetProperty(isolate, options, key, true_value,
- LanguageMode::kStrict)
+ StoreOrigin::kMaybeKeyed,
+ Just(ShouldThrow::kThrowOnError))
.Assert();
bool result = false;
Maybe<bool> found =
diff --git a/deps/v8/test/cctest/test-js-weak-refs.cc b/deps/v8/test/cctest/test-js-weak-refs.cc
index ffa2ba54f0..e529c7cac9 100644
--- a/deps/v8/test/cctest/test-js-weak-refs.cc
+++ b/deps/v8/test/cctest/test-js-weak-refs.cc
@@ -14,26 +14,29 @@
namespace v8 {
namespace internal {
-Handle<JSWeakFactory> ConstructJSWeakFactory(Isolate* isolate) {
+namespace {
+
+Handle<JSFinalizationGroup> ConstructJSFinalizationGroup(Isolate* isolate) {
Factory* factory = isolate->factory();
- Handle<String> weak_factory_name = factory->WeakFactory_string();
+ Handle<String> finalization_group_name =
+ factory->NewStringFromStaticChars("FinalizationGroup");
Handle<Object> global =
handle(isolate->native_context()->global_object(), isolate);
- Handle<JSFunction> weak_factory_fun = Handle<JSFunction>::cast(
- Object::GetProperty(isolate, global, weak_factory_name)
+ Handle<JSFunction> finalization_group_fun = Handle<JSFunction>::cast(
+ Object::GetProperty(isolate, global, finalization_group_name)
.ToHandleChecked());
- auto weak_factory = Handle<JSWeakFactory>::cast(
- JSObject::New(weak_factory_fun, weak_factory_fun,
+ auto finalization_group = Handle<JSFinalizationGroup>::cast(
+ JSObject::New(finalization_group_fun, finalization_group_fun,
Handle<AllocationSite>::null())
.ToHandleChecked());
#ifdef VERIFY_HEAP
- weak_factory->JSWeakFactoryVerify(isolate);
+ finalization_group->JSFinalizationGroupVerify(isolate);
#endif // VERIFY_HEAP
- return weak_factory;
+ return finalization_group;
}
-Handle<JSWeakRef> ConstructJSWeakRef(Isolate* isolate,
- Handle<JSReceiver> target) {
+Handle<JSWeakRef> ConstructJSWeakRef(Handle<JSReceiver> target,
+ Isolate* isolate) {
Factory* factory = isolate->factory();
Handle<String> weak_ref_name = factory->WeakRef_string();
Handle<Object> global =
@@ -50,290 +53,590 @@ Handle<JSWeakRef> ConstructJSWeakRef(Isolate* isolate,
return weak_ref;
}
-Handle<JSWeakCell> MakeCell(Isolate* isolate, Handle<JSObject> js_object,
- Handle<JSWeakFactory> weak_factory) {
- Handle<Map> weak_cell_map(isolate->native_context()->js_weak_cell_map(),
- isolate);
- Handle<JSWeakCell> weak_cell =
- Handle<JSWeakCell>::cast(isolate->factory()->NewJSObjectFromMap(
- weak_cell_map, TENURED, Handle<AllocationSite>::null()));
- weak_cell->set_target(*js_object);
- weak_factory->AddWeakCell(*weak_cell);
+Handle<JSObject> CreateKey(const char* key_prop_value, Isolate* isolate) {
+ Factory* factory = isolate->factory();
+ Handle<String> key_string = factory->NewStringFromStaticChars("key_string");
+ Handle<JSObject> key =
+ isolate->factory()->NewJSObject(isolate->object_function());
+ JSObject::AddProperty(isolate, key, key_string,
+ factory->NewStringFromAsciiChecked(key_prop_value),
+ NONE);
+ return key;
+}
+
+Handle<WeakCell> FinalizationGroupRegister(
+ Handle<JSFinalizationGroup> finalization_group, Handle<JSObject> target,
+ Handle<Object> holdings, Handle<Object> key, Isolate* isolate) {
+ JSFinalizationGroup::Register(finalization_group, target, holdings, key,
+ isolate);
+ CHECK(finalization_group->active_cells()->IsWeakCell());
+ Handle<WeakCell> weak_cell =
+ handle(WeakCell::cast(finalization_group->active_cells()), isolate);
#ifdef VERIFY_HEAP
- weak_cell->JSWeakCellVerify(isolate);
+ weak_cell->WeakCellVerify(isolate);
#endif // VERIFY_HEAP
return weak_cell;
}
-void NullifyWeakCell(Handle<JSWeakCell> weak_cell, Isolate* isolate) {
+Handle<WeakCell> FinalizationGroupRegister(
+ Handle<JSFinalizationGroup> finalization_group, Handle<JSObject> target,
+ Isolate* isolate) {
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
+ return FinalizationGroupRegister(finalization_group, target, undefined,
+ undefined, isolate);
+}
+
+void NullifyWeakCell(Handle<WeakCell> weak_cell, Isolate* isolate) {
auto empty_func = [](HeapObject object, ObjectSlot slot, Object target) {};
weak_cell->Nullify(isolate, empty_func);
#ifdef VERIFY_HEAP
- weak_cell->JSWeakCellVerify(isolate);
+ weak_cell->WeakCellVerify(isolate);
#endif // VERIFY_HEAP
}
-void ClearWeakCell(Handle<JSWeakCell> weak_cell, Isolate* isolate) {
- weak_cell->Clear(isolate);
- CHECK(weak_cell->next()->IsUndefined(isolate));
- CHECK(weak_cell->prev()->IsUndefined(isolate));
-#ifdef VERIFY_HEAP
- weak_cell->JSWeakCellVerify(isolate);
-#endif // VERIFY_HEAP
+// Usage: VerifyWeakCellChain(isolate, list_head, n, cell1, cell2, ..., celln);
+// verifies that list_head == cell1 and cell1, cell2, ..., celln. form a list.
+void VerifyWeakCellChain(Isolate* isolate, Object list_head, int n_args, ...) {
+ CHECK_GE(n_args, 0);
+
+ va_list args;
+ va_start(args, n_args);
+
+ if (n_args == 0) {
+ // Verify empty list
+ CHECK(list_head->IsUndefined(isolate));
+ } else {
+ WeakCell current = WeakCell::cast(Object(va_arg(args, Address)));
+ CHECK_EQ(current, list_head);
+ CHECK(current->prev()->IsUndefined(isolate));
+
+ for (int i = 1; i < n_args; i++) {
+ WeakCell next = WeakCell::cast(Object(va_arg(args, Address)));
+ CHECK_EQ(current->next(), next);
+ CHECK_EQ(next->prev(), current);
+ current = next;
+ }
+ CHECK(current->next()->IsUndefined(isolate));
+ }
+ va_end(args);
+}
+
+// Like VerifyWeakCellChain but verifies the chain created with key_list_prev
+// and key_list_next instead of prev and next.
+void VerifyWeakCellKeyChain(Isolate* isolate, Object list_head, int n_args,
+ ...) {
+ CHECK_GE(n_args, 0);
+
+ va_list args;
+ va_start(args, n_args);
+
+ if (n_args == 0) {
+ // Verify empty list
+ CHECK(list_head->IsTheHole(isolate));
+ } else {
+ WeakCell current = WeakCell::cast(Object(va_arg(args, Address)));
+ CHECK_EQ(current, list_head);
+ CHECK(current->key_list_prev()->IsUndefined(isolate));
+
+ for (int i = 1; i < n_args; i++) {
+ WeakCell next = WeakCell::cast(Object(va_arg(args, Address)));
+ CHECK_EQ(current->key_list_next(), next);
+ CHECK_EQ(next->key_list_prev(), current);
+ current = next;
+ }
+ CHECK(current->key_list_next()->IsUndefined(isolate));
+ }
+ va_end(args);
}
-TEST(TestJSWeakCellCreation) {
+} // namespace
+
+TEST(TestRegister) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- // Create JSWeakCell and verify internal data structures.
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- CHECK(weak_cell1->prev()->IsUndefined(isolate));
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ // Register a weak reference and verify internal data structures.
+ Handle<WeakCell> weak_cell1 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell1);
- CHECK(weak_factory->cleared_cells()->IsUndefined(isolate));
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 1,
+ *weak_cell1);
+ CHECK(weak_cell1->key_list_prev()->IsUndefined(isolate));
+ CHECK(weak_cell1->key_list_next()->IsUndefined(isolate));
- // Create another JSWeakCell and verify internal data structures.
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
- CHECK(weak_cell2->prev()->IsUndefined(isolate));
- CHECK_EQ(weak_cell2->next(), *weak_cell1);
- CHECK_EQ(weak_cell1->prev(), *weak_cell2);
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ CHECK(finalization_group->cleared_cells()->IsUndefined(isolate));
+
+ // No key was used during registration, key-based map stays uninitialized.
+ CHECK(finalization_group->key_map()->IsUndefined(isolate));
+
+ // Register another weak reference and verify internal data structures.
+ Handle<WeakCell> weak_cell2 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 2,
+ *weak_cell2, *weak_cell1);
+ CHECK(weak_cell2->key_list_prev()->IsUndefined(isolate));
+ CHECK(weak_cell2->key_list_next()->IsUndefined(isolate));
+
+ CHECK(finalization_group->cleared_cells()->IsUndefined(isolate));
+ CHECK(finalization_group->key_map()->IsUndefined(isolate));
+}
+
+TEST(TestRegisterWithKey) {
+ FLAG_harmony_weak_refs = true;
+ CcTest::InitializeVM();
+ LocalContext context;
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope outer_scope(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
+ Handle<JSObject> js_object =
+ isolate->factory()->NewJSObject(isolate->object_function());
+
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+ Handle<JSObject> key2 = CreateKey("key2", isolate);
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
+
+ // Register a weak reference with a key and verify internal data structures.
+ Handle<WeakCell> weak_cell1 = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+
+ {
+ CHECK(finalization_group->key_map()->IsObjectHashTable());
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 1, *weak_cell1);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 0);
+ }
+
+ // Register another weak reference with a different key and verify internal
+ // data structures.
+ Handle<WeakCell> weak_cell2 = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key2, isolate);
+
+ {
+ CHECK(finalization_group->key_map()->IsObjectHashTable());
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 1, *weak_cell1);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 1, *weak_cell2);
+ }
- CHECK_EQ(weak_factory->active_cells(), *weak_cell2);
- CHECK(weak_factory->cleared_cells()->IsUndefined(isolate));
+ // Register another weak reference with key1 and verify internal data
+ // structures.
+ Handle<WeakCell> weak_cell3 = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+
+ {
+ CHECK(finalization_group->key_map()->IsObjectHashTable());
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 2, *weak_cell3,
+ *weak_cell1);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 1, *weak_cell2);
+ }
}
-TEST(TestJSWeakCellNullify1) {
+TEST(TestWeakCellNullify1) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
+ Handle<WeakCell> weak_cell1 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
+ Handle<WeakCell> weak_cell2 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
- // Nullify the first JSWeakCell and verify internal data structures.
+ // Nullify the first WeakCell and verify internal data structures.
NullifyWeakCell(weak_cell1, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell2);
+ CHECK_EQ(finalization_group->active_cells(), *weak_cell2);
CHECK(weak_cell2->prev()->IsUndefined(isolate));
CHECK(weak_cell2->next()->IsUndefined(isolate));
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell1);
+ CHECK_EQ(finalization_group->cleared_cells(), *weak_cell1);
CHECK(weak_cell1->prev()->IsUndefined(isolate));
CHECK(weak_cell1->next()->IsUndefined(isolate));
- // Nullify the second JSWeakCell and verify internal data structures.
+ // Nullify the second WeakCell and verify internal data structures.
NullifyWeakCell(weak_cell2, isolate);
- CHECK(weak_factory->active_cells()->IsUndefined(isolate));
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell2);
+ CHECK(finalization_group->active_cells()->IsUndefined(isolate));
+ CHECK_EQ(finalization_group->cleared_cells(), *weak_cell2);
CHECK_EQ(weak_cell2->next(), *weak_cell1);
CHECK(weak_cell2->prev()->IsUndefined(isolate));
CHECK_EQ(weak_cell1->prev(), *weak_cell2);
CHECK(weak_cell1->next()->IsUndefined(isolate));
}
-TEST(TestJSWeakCellNullify2) {
+TEST(TestWeakCellNullify2) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
+ Handle<WeakCell> weak_cell1 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
+ Handle<WeakCell> weak_cell2 =
+ FinalizationGroupRegister(finalization_group, js_object, isolate);
- // Like TestJSWeakCellNullify1 but clear the JSWeakCells in opposite order.
+ // Like TestWeakCellNullify1 but nullify the WeakCells in opposite order.
NullifyWeakCell(weak_cell2, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell1);
+ CHECK_EQ(finalization_group->active_cells(), *weak_cell1);
CHECK(weak_cell1->prev()->IsUndefined(isolate));
CHECK(weak_cell1->next()->IsUndefined(isolate));
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell2);
+ CHECK_EQ(finalization_group->cleared_cells(), *weak_cell2);
CHECK(weak_cell2->prev()->IsUndefined(isolate));
CHECK(weak_cell2->next()->IsUndefined(isolate));
NullifyWeakCell(weak_cell1, isolate);
- CHECK(weak_factory->active_cells()->IsUndefined(isolate));
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell1);
+ CHECK(finalization_group->active_cells()->IsUndefined(isolate));
+ CHECK_EQ(finalization_group->cleared_cells(), *weak_cell1);
CHECK_EQ(weak_cell1->next(), *weak_cell2);
CHECK(weak_cell1->prev()->IsUndefined(isolate));
CHECK_EQ(weak_cell2->prev(), *weak_cell1);
CHECK(weak_cell2->next()->IsUndefined(isolate));
}
-TEST(TestJSWeakFactoryPopClearedCell) {
+TEST(TestJSFinalizationGroupPopClearedCellHoldings1) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
-
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell3 = MakeCell(isolate, js_object, weak_factory);
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
+
+ Handle<Object> holdings1 = factory->NewStringFromAsciiChecked("holdings1");
+ Handle<WeakCell> weak_cell1 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings1, undefined, isolate);
+ Handle<Object> holdings2 = factory->NewStringFromAsciiChecked("holdings2");
+ Handle<WeakCell> weak_cell2 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings2, undefined, isolate);
+ Handle<Object> holdings3 = factory->NewStringFromAsciiChecked("holdings3");
+ Handle<WeakCell> weak_cell3 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings3, undefined, isolate);
NullifyWeakCell(weak_cell2, isolate);
NullifyWeakCell(weak_cell3, isolate);
- CHECK(weak_factory->NeedsCleanup());
- JSWeakCell cleared1 = weak_factory->PopClearedCell(isolate);
- CHECK_EQ(cleared1, *weak_cell3);
+ CHECK(finalization_group->NeedsCleanup());
+ Object cleared1 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared1, *holdings3);
CHECK(weak_cell3->prev()->IsUndefined(isolate));
CHECK(weak_cell3->next()->IsUndefined(isolate));
- CHECK(weak_factory->NeedsCleanup());
- JSWeakCell cleared2 = weak_factory->PopClearedCell(isolate);
- CHECK_EQ(cleared2, *weak_cell2);
+ CHECK(finalization_group->NeedsCleanup());
+ Object cleared2 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared2, *holdings2);
CHECK(weak_cell2->prev()->IsUndefined(isolate));
CHECK(weak_cell2->next()->IsUndefined(isolate));
- CHECK(!weak_factory->NeedsCleanup());
+ CHECK(!finalization_group->NeedsCleanup());
NullifyWeakCell(weak_cell1, isolate);
- CHECK(weak_factory->NeedsCleanup());
- JSWeakCell cleared3 = weak_factory->PopClearedCell(isolate);
- CHECK_EQ(cleared3, *weak_cell1);
+ CHECK(finalization_group->NeedsCleanup());
+ Object cleared3 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared3, *holdings1);
CHECK(weak_cell1->prev()->IsUndefined(isolate));
CHECK(weak_cell1->next()->IsUndefined(isolate));
- CHECK(!weak_factory->NeedsCleanup());
- CHECK(weak_factory->active_cells()->IsUndefined(isolate));
- CHECK(weak_factory->cleared_cells()->IsUndefined(isolate));
+ CHECK(!finalization_group->NeedsCleanup());
+ CHECK(finalization_group->active_cells()->IsUndefined(isolate));
+ CHECK(finalization_group->cleared_cells()->IsUndefined(isolate));
}
-TEST(TestJSWeakCellClearActiveCells) {
+TEST(TestJSFinalizationGroupPopClearedCellHoldings2) {
+ // Test that when all WeakCells for a key are popped, the key is removed from
+ // the key map.
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell3 = MakeCell(isolate, js_object, weak_factory);
+ Handle<Object> holdings1 = factory->NewStringFromAsciiChecked("holdings1");
+ Handle<WeakCell> weak_cell1 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings1, key1, isolate);
+ Handle<Object> holdings2 = factory->NewStringFromAsciiChecked("holdings2");
+ Handle<WeakCell> weak_cell2 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings2, key1, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell3);
- CHECK(weak_cell3->prev()->IsUndefined(isolate));
- CHECK_EQ(weak_cell3->next(), *weak_cell2);
- CHECK_EQ(weak_cell2->prev(), *weak_cell3);
- CHECK_EQ(weak_cell2->next(), *weak_cell1);
- CHECK_EQ(weak_cell1->prev(), *weak_cell2);
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ NullifyWeakCell(weak_cell1, isolate);
+ NullifyWeakCell(weak_cell2, isolate);
- // Clear all JSWeakCells in active_cells and verify the consistency of the
- // active_cells list in all stages.
- ClearWeakCell(weak_cell2, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell3);
- CHECK(weak_cell3->prev()->IsUndefined(isolate));
- CHECK_EQ(weak_cell3->next(), *weak_cell1);
- CHECK_EQ(weak_cell1->prev(), *weak_cell3);
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ // Nullifying doesn't affect the key chains (just moves WeakCells from
+ // active_cells to cleared_cells).
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 2, *weak_cell2,
+ *weak_cell1);
+ }
- ClearWeakCell(weak_cell3, isolate);
- CHECK_EQ(weak_factory->active_cells(), *weak_cell1);
- CHECK(weak_cell1->prev()->IsUndefined(isolate));
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ Object cleared1 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared1, *holdings2);
+
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 1, *weak_cell1);
+ }
+
+ Object cleared2 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared2, *holdings1);
- ClearWeakCell(weak_cell1, isolate);
- CHECK(weak_factory->active_cells()->IsUndefined(isolate));
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ }
}
-TEST(TestJSWeakCellClearClearedCells) {
+TEST(TestUnregisterActiveCells) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell2 = MakeCell(isolate, js_object, weak_factory);
- Handle<JSWeakCell> weak_cell3 = MakeCell(isolate, js_object, weak_factory);
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+ Handle<JSObject> key2 = CreateKey("key2", isolate);
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
- NullifyWeakCell(weak_cell1, isolate);
- NullifyWeakCell(weak_cell2, isolate);
- NullifyWeakCell(weak_cell3, isolate);
+ Handle<WeakCell> weak_cell1a = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+ Handle<WeakCell> weak_cell1b = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell3);
- CHECK(weak_cell3->prev()->IsUndefined(isolate));
- CHECK_EQ(weak_cell3->next(), *weak_cell2);
- CHECK_EQ(weak_cell2->prev(), *weak_cell3);
- CHECK_EQ(weak_cell2->next(), *weak_cell1);
- CHECK_EQ(weak_cell1->prev(), *weak_cell2);
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ Handle<WeakCell> weak_cell2a = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key2, isolate);
+ Handle<WeakCell> weak_cell2b = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key2, isolate);
- // Clear all JSWeakCells in cleared_cells and verify the consistency of the
- // cleared_cells list in all stages.
- ClearWeakCell(weak_cell2, isolate);
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell3);
- CHECK(weak_cell3->prev()->IsUndefined(isolate));
- CHECK_EQ(weak_cell3->next(), *weak_cell1);
- CHECK_EQ(weak_cell1->prev(), *weak_cell3);
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 4,
+ *weak_cell2b, *weak_cell2a, *weak_cell1b, *weak_cell1a);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 2, *weak_cell1b,
+ *weak_cell1a);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 2, *weak_cell2b,
+ *weak_cell2a);
+ }
- ClearWeakCell(weak_cell3, isolate);
- CHECK_EQ(weak_factory->cleared_cells(), *weak_cell1);
- CHECK(weak_cell1->prev()->IsUndefined(isolate));
- CHECK(weak_cell1->next()->IsUndefined(isolate));
+ JSFinalizationGroup::Unregister(finalization_group, key1, isolate);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 2, *weak_cell2b,
+ *weak_cell2a);
+ }
+
+ // Both weak_cell1a and weak_cell1b removed from active_cells.
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 2,
+ *weak_cell2b, *weak_cell2a);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+}
+
+TEST(TestUnregisterActiveAndClearedCells) {
+ FLAG_harmony_weak_refs = true;
+ CcTest::InitializeVM();
+ LocalContext context;
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope outer_scope(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
+ Handle<JSObject> js_object =
+ isolate->factory()->NewJSObject(isolate->object_function());
+
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+ Handle<JSObject> key2 = CreateKey("key2", isolate);
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
+
+ Handle<WeakCell> weak_cell1a = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+ Handle<WeakCell> weak_cell1b = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+
+ Handle<WeakCell> weak_cell2a = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key2, isolate);
+ Handle<WeakCell> weak_cell2b = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key2, isolate);
+
+ NullifyWeakCell(weak_cell2a, isolate);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 3,
+ *weak_cell2b, *weak_cell1b, *weak_cell1a);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 1,
+ *weak_cell2a);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 2, *weak_cell1b,
+ *weak_cell1a);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 2, *weak_cell2b,
+ *weak_cell2a);
+ }
- ClearWeakCell(weak_cell1, isolate);
- CHECK(weak_factory->cleared_cells()->IsUndefined(isolate));
+ JSFinalizationGroup::Unregister(finalization_group, key2, isolate);
+
+ // Both weak_cell2a and weak_cell2b removed.
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 2,
+ *weak_cell1b, *weak_cell1a);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 2, *weak_cell1b,
+ *weak_cell1a);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key2), 0);
+ }
}
-TEST(TestJSWeakCellClearTwice) {
+TEST(TestWeakCellUnregisterTwice) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+ Handle<Object> undefined =
+ handle(ReadOnlyRoots(isolate).undefined_value(), isolate);
+
+ Handle<WeakCell> weak_cell1 = FinalizationGroupRegister(
+ finalization_group, js_object, undefined, key1, isolate);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 1,
+ *weak_cell1);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 1, *weak_cell1);
+ }
+
+ JSFinalizationGroup::Unregister(finalization_group, key1, isolate);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ }
+
+ JSFinalizationGroup::Unregister(finalization_group, key1, isolate);
- ClearWeakCell(weak_cell1, isolate);
- ClearWeakCell(weak_cell1, isolate);
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ }
}
-TEST(TestJSWeakCellClearPopped) {
+TEST(TestWeakCellUnregisterPopped) {
FLAG_harmony_weak_refs = true;
CcTest::InitializeVM();
LocalContext context;
Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
HandleScope outer_scope(isolate);
- Handle<JSWeakFactory> weak_factory = ConstructJSWeakFactory(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+ Handle<Object> holdings1 = factory->NewStringFromAsciiChecked("holdings1");
+ Handle<WeakCell> weak_cell1 = FinalizationGroupRegister(
+ finalization_group, js_object, holdings1, key1, isolate);
- Handle<JSWeakCell> weak_cell1 = MakeCell(isolate, js_object, weak_factory);
NullifyWeakCell(weak_cell1, isolate);
- JSWeakCell cleared1 = weak_factory->PopClearedCell(isolate);
- CHECK_EQ(cleared1, *weak_cell1);
- ClearWeakCell(weak_cell1, isolate);
+ CHECK(finalization_group->NeedsCleanup());
+ Object cleared1 =
+ JSFinalizationGroup::PopClearedCellHoldings(finalization_group, isolate);
+ CHECK_EQ(cleared1, *holdings1);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ }
+
+ JSFinalizationGroup::Unregister(finalization_group, key1, isolate);
+
+ VerifyWeakCellChain(isolate, finalization_group->active_cells(), 0);
+ VerifyWeakCellChain(isolate, finalization_group->cleared_cells(), 0);
+ {
+ Handle<ObjectHashTable> key_map =
+ handle(ObjectHashTable::cast(finalization_group->key_map()), isolate);
+ VerifyWeakCellKeyChain(isolate, key_map->Lookup(key1), 0);
+ }
+}
+
+TEST(TestWeakCellUnregisterNonexistentKey) {
+ FLAG_harmony_weak_refs = true;
+ CcTest::InitializeVM();
+ LocalContext context;
+ Isolate* isolate = CcTest::i_isolate();
+ HandleScope outer_scope(isolate);
+ Handle<JSFinalizationGroup> finalization_group =
+ ConstructJSFinalizationGroup(isolate);
+ Handle<JSObject> key1 = CreateKey("key1", isolate);
+
+ JSFinalizationGroup::Unregister(finalization_group, key1, isolate);
}
TEST(TestJSWeakRef) {
@@ -350,7 +653,7 @@ TEST(TestJSWeakRef) {
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
// This doesn't add the target into the KeepDuringJob set.
- Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(isolate, js_object);
+ Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate);
CcTest::CollectAllGarbage();
CHECK(!inner_weak_ref->target()->IsUndefined(isolate));
@@ -384,7 +687,7 @@ TEST(TestJSWeakRefIncrementalMarking) {
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
// This doesn't add the target into the KeepDuringJob set.
- Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(isolate, js_object);
+ Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate);
heap::SimulateIncrementalMarking(heap, true);
CcTest::CollectAllGarbage();
@@ -415,7 +718,7 @@ TEST(TestJSWeakRefKeepDuringJob) {
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(isolate, js_object);
+ Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate);
heap->AddKeepDuringJobTarget(js_object);
weak_ref = inner_scope.CloseAndEscape(inner_weak_ref);
@@ -452,7 +755,7 @@ TEST(TestJSWeakRefKeepDuringJobIncrementalMarking) {
Handle<JSObject> js_object =
isolate->factory()->NewJSObject(isolate->object_function());
- Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(isolate, js_object);
+ Handle<JSWeakRef> inner_weak_ref = ConstructJSWeakRef(js_object, isolate);
heap->AddKeepDuringJobTarget(js_object);
weak_ref = inner_scope.CloseAndEscape(inner_weak_ref);
diff --git a/deps/v8/test/cctest/test-lockers.cc b/deps/v8/test/cctest/test-lockers.cc
index 5a4dcd588e..d7c13f8d5d 100644
--- a/deps/v8/test/cctest/test-lockers.cc
+++ b/deps/v8/test/cctest/test-lockers.cc
@@ -938,32 +938,17 @@ class IsolateGenesisThread : public JoinableThread {
TEST(ExtensionsRegistration) {
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_MIPS
const int kNThreads = 10;
-#elif V8_TARGET_ARCH_X64 && V8_TARGET_ARCH_32_BIT
- const int kNThreads = 4;
#elif V8_TARGET_ARCH_S390 && V8_TARGET_ARCH_32_BIT
const int kNThreads = 10;
#else
const int kNThreads = 40;
#endif
- v8::RegisterExtension(new v8::Extension("test0",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test1",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test2",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test3",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test4",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test5",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test6",
- kSimpleExtensionSource));
- v8::RegisterExtension(new v8::Extension("test7",
- kSimpleExtensionSource));
- const char* extension_names[] = { "test0", "test1",
- "test2", "test3", "test4",
- "test5", "test6", "test7" };
+ const char* extension_names[] = {"test0", "test1", "test2", "test3",
+ "test4", "test5", "test6", "test7"};
+ for (const char* name : extension_names) {
+ v8::RegisterExtension(
+ v8::base::make_unique<v8::Extension>(name, kSimpleExtensionSource));
+ }
std::vector<JoinableThread*> threads;
threads.reserve(kNThreads);
for (int i = 0; i < kNThreads; i++) {
diff --git a/deps/v8/test/cctest/test-macro-assembler-arm.cc b/deps/v8/test/cctest/test-macro-assembler-arm.cc
index c1789560fa..271c57b92d 100644
--- a/deps/v8/test/cctest/test-macro-assembler-arm.cc
+++ b/deps/v8/test/cctest/test-macro-assembler-arm.cc
@@ -47,93 +47,6 @@ using F = void*(int x, int y, int p2, int p3, int p4);
using F3 = void*(void* p0, int p1, int p2, int p3, int p4);
using F5 = int(void*, void*, void*, void*, void*);
-TEST(LoadAndStoreWithRepresentation) {
- Isolate* isolate = CcTest::i_isolate();
- HandleScope handles(isolate);
-
- auto buffer = AllocateAssemblerBuffer();
- MacroAssembler assembler(isolate, v8::internal::CodeObjectRequired::kYes,
- buffer->CreateView());
- MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
-
- __ sub(sp, sp, Operand(1 * kPointerSize));
- Label exit;
-
- // Test 1.
- __ mov(r0, Operand(1)); // Test number.
- __ mov(r1, Operand(0));
- __ str(r1, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(-1));
- __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::UInteger8());
- __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(255));
- __ cmp(r3, r2);
- __ b(ne, &exit);
- __ mov(r2, Operand(255));
- __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::UInteger8());
- __ cmp(r3, r2);
- __ b(ne, &exit);
-
- // Test 2.
- __ mov(r0, Operand(2)); // Test number.
- __ mov(r1, Operand(0));
- __ str(r1, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(-1));
- __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::Integer8());
- __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(255));
- __ cmp(r3, r2);
- __ b(ne, &exit);
- __ mov(r2, Operand(-1));
- __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::Integer8());
- __ cmp(r3, r2);
- __ b(ne, &exit);
-
- // Test 3.
- __ mov(r0, Operand(3)); // Test number.
- __ mov(r1, Operand(0));
- __ str(r1, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(-1));
- __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::UInteger16());
- __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(65535));
- __ cmp(r3, r2);
- __ b(ne, &exit);
- __ mov(r2, Operand(65535));
- __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::UInteger16());
- __ cmp(r3, r2);
- __ b(ne, &exit);
-
- // Test 4.
- __ mov(r0, Operand(4)); // Test number.
- __ mov(r1, Operand(0));
- __ str(r1, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(-1));
- __ Store(r2, MemOperand(sp, 0 * kPointerSize), Representation::Integer16());
- __ ldr(r3, MemOperand(sp, 0 * kPointerSize));
- __ mov(r2, Operand(65535));
- __ cmp(r3, r2);
- __ b(ne, &exit);
- __ mov(r2, Operand(-1));
- __ Load(r3, MemOperand(sp, 0 * kPointerSize), Representation::Integer16());
- __ cmp(r3, r2);
- __ b(ne, &exit);
-
- __ mov(r0, Operand(0)); // Success.
- __ bind(&exit);
- __ add(sp, sp, Operand(1 * kPointerSize));
- __ bx(lr);
-
- CodeDesc desc;
- masm->GetCode(isolate, &desc);
- Handle<Code> code =
- isolate->factory()->NewCode(desc, Code::STUB, Handle<Code>());
-
- // Call the function from C++.
- auto f = GeneratedCode<F5>::FromCode(*code);
- CHECK(!f.Call(0, 0, 0, 0, 0));
-}
-
TEST(ExtractLane) {
if (!CpuFeatures::IsSupported(NEON)) return;
diff --git a/deps/v8/test/cctest/test-macro-assembler-x64.cc b/deps/v8/test/cctest/test-macro-assembler-x64.cc
index a110ed76aa..7dff5dbe8c 100644
--- a/deps/v8/test/cctest/test-macro-assembler-x64.cc
+++ b/deps/v8/test/cctest/test-macro-assembler-x64.cc
@@ -528,7 +528,8 @@ TEST(OperandOffset) {
__ j(not_equal, &exit);
__ incq(rax);
- Operand sp2c2 = Operand(rsp, rcx, times_pointer_size, 2 * kSystemPointerSize);
+ Operand sp2c2 =
+ Operand(rsp, rcx, times_system_pointer_size, 2 * kSystemPointerSize);
// Test 6.
__ movl(rdx, sp2c2); // Sanity check.
@@ -582,7 +583,7 @@ TEST(OperandOffset) {
__ incq(rax);
Operand bp2c4 =
- Operand(rbp, rcx, times_pointer_size, -4 * kSystemPointerSize);
+ Operand(rbp, rcx, times_system_pointer_size, -4 * kSystemPointerSize);
// Test 14:
__ movl(rdx, bp2c4); // Sanity check.
@@ -638,7 +639,7 @@ TEST(OperandOffset) {
__ incq(rax);
Operand bx2c2 =
- Operand(rbx, rcx, times_pointer_size, -2 * kSystemPointerSize);
+ Operand(rbx, rcx, times_system_pointer_size, -2 * kSystemPointerSize);
// Test 23.
__ movl(rdx, bx2c2); // Sanity check.
@@ -807,167 +808,6 @@ TEST(OperandOffset) {
CHECK_EQ(0, result);
}
-
-TEST(LoadAndStoreWithRepresentation) {
- Isolate* isolate = CcTest::i_isolate();
- HandleScope handles(isolate);
- auto buffer = AllocateAssemblerBuffer();
- MacroAssembler assembler(isolate, v8::internal::CodeObjectRequired::kYes,
- buffer->CreateView());
-
- MacroAssembler* masm = &assembler; // Create a pointer for the __ macro.
- EntryCode(masm);
- __ subq(rsp, Immediate(1 * kSystemPointerSize));
- Label exit;
-
- // Test 1.
- __ movq(rax, Immediate(1)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movq(rcx, Immediate(-1));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::UInteger8());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(255));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::UInteger8());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 2.
- __ movq(rax, Immediate(2)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ Set(rcx, V8_2PART_UINT64_C(0xDEADBEAF, 12345678));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx, Representation::Smi());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ Set(rdx, V8_2PART_UINT64_C(0xDEADBEAF, 12345678));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize), Representation::Smi());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 3.
- __ movq(rax, Immediate(3)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movq(rcx, Immediate(-1));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::Integer32());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(-1));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::Integer32());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 4.
- __ movq(rax, Immediate(4)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movl(rcx, Immediate(0x44332211));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::HeapObject());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(0x44332211));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::HeapObject());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 5.
- __ movq(rax, Immediate(5)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ Set(rcx, V8_2PART_UINT64_C(0x12345678, DEADBEAF));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx, Representation::Tagged());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ Set(rdx, V8_2PART_UINT64_C(0x12345678, DEADBEAF));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize), Representation::Tagged());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 6.
- __ movq(rax, Immediate(6)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ Set(rcx, V8_2PART_UINT64_C(0x11223344, 55667788));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::External());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ Set(rdx, V8_2PART_UINT64_C(0x11223344, 55667788));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::External());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 7.
- __ movq(rax, Immediate(7)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movq(rcx, Immediate(-1));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::Integer8());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(255));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::Integer8());
- __ movq(rcx, Immediate(-1));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 8.
- __ movq(rax, Immediate(8)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movq(rcx, Immediate(-1));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::Integer16());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(65535));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::Integer16());
- __ movq(rcx, Immediate(-1));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- // Test 9.
- __ movq(rax, Immediate(9)); // Test number.
- __ movq(Operand(rsp, 0 * kSystemPointerSize), Immediate(0));
- __ movq(rcx, Immediate(-1));
- __ Store(Operand(rsp, 0 * kSystemPointerSize), rcx,
- Representation::UInteger16());
- __ movq(rcx, Operand(rsp, 0 * kSystemPointerSize));
- __ movl(rdx, Immediate(65535));
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
- __ Load(rdx, Operand(rsp, 0 * kSystemPointerSize),
- Representation::UInteger16());
- __ cmpq(rcx, rdx);
- __ j(not_equal, &exit);
-
- __ xorq(rax, rax); // Success.
- __ bind(&exit);
- __ addq(rsp, Immediate(1 * kSystemPointerSize));
- ExitCode(masm);
- __ ret(0);
-
- CodeDesc desc;
- masm->GetCode(isolate, &desc);
- buffer->MakeExecutable();
- // Call the function from C++.
- auto f = GeneratedCode<F0>::FromBuffer(CcTest::i_isolate(), buffer->start());
- int result = f.Call();
- CHECK_EQ(0, result);
-}
-
void TestFloat32x4Abs(MacroAssembler* masm, Label* exit, float x, float y,
float z, float w) {
__ subq(rsp, Immediate(kSimd128Size));
diff --git a/deps/v8/test/cctest/test-mementos.cc b/deps/v8/test/cctest/test-mementos.cc
index aa2b23c413..78b1e6a981 100644
--- a/deps/v8/test/cctest/test-mementos.cc
+++ b/deps/v8/test/cctest/test-mementos.cc
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "src/heap/factory.h"
-#include "src/heap/heap.h"
+#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "test/cctest/cctest.h"
diff --git a/deps/v8/test/cctest/test-object.cc b/deps/v8/test/cctest/test-object.cc
index 7d76b170d9..61945bc1fe 100644
--- a/deps/v8/test/cctest/test-object.cc
+++ b/deps/v8/test/cctest/test-object.cc
@@ -3,6 +3,8 @@
// found in the LICENSE file.
#include "src/api-inl.h"
+#include "src/function-kind.h"
+#include "src/globals.h"
#include "src/handles-inl.h"
#include "src/heap/factory.h"
#include "src/isolate.h"
@@ -251,5 +253,162 @@ TEST(EnumCache) {
}
}
+#define TEST_FUNCTION_KIND(Name) \
+ TEST(Name) { \
+ for (int i = 0; i < FunctionKind::kLastFunctionKind; i++) { \
+ FunctionKind kind = static_cast<FunctionKind>(i); \
+ CHECK_EQ(FunctionKind##Name(kind), Name(kind)); \
+ } \
+ }
+
+bool FunctionKindIsArrowFunction(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kArrowFunction:
+ case FunctionKind::kAsyncArrowFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsArrowFunction)
+
+bool FunctionKindIsAsyncGeneratorFunction(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kAsyncConciseGeneratorMethod:
+ case FunctionKind::kAsyncGeneratorFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsAsyncGeneratorFunction)
+
+bool FunctionKindIsGeneratorFunction(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kConciseGeneratorMethod:
+ case FunctionKind::kAsyncConciseGeneratorMethod:
+ case FunctionKind::kGeneratorFunction:
+ case FunctionKind::kAsyncGeneratorFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsGeneratorFunction)
+
+bool FunctionKindIsAsyncFunction(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kAsyncFunction:
+ case FunctionKind::kAsyncArrowFunction:
+ case FunctionKind::kAsyncConciseMethod:
+ case FunctionKind::kAsyncConciseGeneratorMethod:
+ case FunctionKind::kAsyncGeneratorFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsAsyncFunction)
+
+bool FunctionKindIsConciseMethod(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kConciseMethod:
+ case FunctionKind::kConciseGeneratorMethod:
+ case FunctionKind::kAsyncConciseMethod:
+ case FunctionKind::kAsyncConciseGeneratorMethod:
+ case FunctionKind::kClassMembersInitializerFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsConciseMethod)
+
+bool FunctionKindIsAccessorFunction(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kGetterFunction:
+ case FunctionKind::kSetterFunction:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsAccessorFunction)
+
+bool FunctionKindIsDefaultConstructor(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kDefaultBaseConstructor:
+ case FunctionKind::kDefaultDerivedConstructor:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsDefaultConstructor)
+
+bool FunctionKindIsBaseConstructor(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kBaseConstructor:
+ case FunctionKind::kDefaultBaseConstructor:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsBaseConstructor)
+
+bool FunctionKindIsDerivedConstructor(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kDefaultDerivedConstructor:
+ case FunctionKind::kDerivedConstructor:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsDerivedConstructor)
+
+bool FunctionKindIsClassConstructor(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kBaseConstructor:
+ case FunctionKind::kDefaultBaseConstructor:
+ case FunctionKind::kDefaultDerivedConstructor:
+ case FunctionKind::kDerivedConstructor:
+ return true;
+ default:
+ return false;
+ }
+}
+TEST_FUNCTION_KIND(IsClassConstructor)
+
+bool FunctionKindIsConstructable(FunctionKind kind) {
+ switch (kind) {
+ case FunctionKind::kGetterFunction:
+ case FunctionKind::kSetterFunction:
+ case FunctionKind::kArrowFunction:
+ case FunctionKind::kAsyncArrowFunction:
+ case FunctionKind::kAsyncFunction:
+ case FunctionKind::kAsyncConciseMethod:
+ case FunctionKind::kAsyncConciseGeneratorMethod:
+ case FunctionKind::kAsyncGeneratorFunction:
+ case FunctionKind::kGeneratorFunction:
+ case FunctionKind::kConciseGeneratorMethod:
+ case FunctionKind::kConciseMethod:
+ case FunctionKind::kClassMembersInitializerFunction:
+ return false;
+ default:
+ return true;
+ }
+}
+TEST_FUNCTION_KIND(IsConstructable)
+
+bool FunctionKindIsStrictFunctionWithoutPrototype(FunctionKind kind) {
+ return IsArrowFunction(kind) || IsConciseMethod(kind) ||
+ IsAccessorFunction(kind);
+}
+TEST_FUNCTION_KIND(IsStrictFunctionWithoutPrototype)
+
+#undef TEST_FUNCTION_KIND
+
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc
index 2634c30ec0..2722e820ed 100644
--- a/deps/v8/test/cctest/test-parsing.cc
+++ b/deps/v8/test/cctest/test-parsing.cc
@@ -50,6 +50,7 @@
#include "src/parsing/rewriter.h"
#include "src/parsing/scanner-character-streams.h"
#include "src/parsing/token.h"
+#include "src/zone/zone-list-inl.h" // crbug.com/v8/8816
#include "test/cctest/cctest.h"
#include "test/cctest/scope-test-helper.h"
@@ -91,6 +92,8 @@ TEST(AutoSemicolonToken) {
bool TokenIsAnyIdentifier(Token::Value token) {
switch (token) {
case Token::IDENTIFIER:
+ case Token::GET:
+ case Token::SET:
case Token::ASYNC:
case Token::AWAIT:
case Token::YIELD:
@@ -115,6 +118,8 @@ bool TokenIsCallable(Token::Value token) {
switch (token) {
case Token::SUPER:
case Token::IDENTIFIER:
+ case Token::GET:
+ case Token::SET:
case Token::ASYNC:
case Token::AWAIT:
case Token::YIELD:
@@ -139,6 +144,8 @@ bool TokenIsValidIdentifier(Token::Value token, LanguageMode language_mode,
bool is_generator, bool disallow_await) {
switch (token) {
case Token::IDENTIFIER:
+ case Token::GET:
+ case Token::SET:
case Token::ASYNC:
return true;
case Token::YIELD:
@@ -613,9 +620,8 @@ TEST(ScanHTMLEndComments) {
i::Scanner scanner(stream.get(), false);
scanner.Initialize();
i::Zone zone(i_isolate->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(&zone,
- i_isolate->ast_string_constants(),
- i_isolate->heap()->HashSeed());
+ i::AstValueFactory ast_value_factory(
+ &zone, i_isolate->ast_string_constants(), HashSeed(i_isolate));
i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
@@ -632,9 +638,8 @@ TEST(ScanHTMLEndComments) {
i::Scanner scanner(stream.get(), false);
scanner.Initialize();
i::Zone zone(i_isolate->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(&zone,
- i_isolate->ast_string_constants(),
- i_isolate->heap()->HashSeed());
+ i::AstValueFactory ast_value_factory(
+ &zone, i_isolate->ast_string_constants(), HashSeed(i_isolate));
i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
@@ -705,9 +710,8 @@ TEST(StandAlonePreParser) {
scanner.Initialize();
i::Zone zone(i_isolate->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(&zone,
- i_isolate->ast_string_constants(),
- i_isolate->heap()->HashSeed());
+ i::AstValueFactory ast_value_factory(
+ &zone, i_isolate->ast_string_constants(), HashSeed(i_isolate));
i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
@@ -725,8 +729,8 @@ TEST(StandAlonePreParserNoNatives) {
v8::V8::Initialize();
i::Isolate* isolate = CcTest::i_isolate();
- CcTest::i_isolate()->stack_guard()->SetStackLimit(
- i::GetCurrentStackPosition() - 128 * 1024);
+ isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() -
+ 128 * 1024);
const char* programs[] = {"%ArgleBargle(glop);", "var x = %_IsSmi(42);",
nullptr};
@@ -738,10 +742,9 @@ TEST(StandAlonePreParserNoNatives) {
scanner.Initialize();
// Preparser defaults to disallowing natives syntax.
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(
- &zone, CcTest::i_isolate()->ast_string_constants(),
- CcTest::i_isolate()->heap()->HashSeed());
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
+ i::AstValueFactory ast_value_factory(&zone, isolate->ast_string_constants(),
+ HashSeed(isolate));
i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
@@ -772,15 +775,14 @@ TEST(RegressChromium62639) {
auto stream = i::ScannerStream::ForTesting(program);
i::Scanner scanner(stream.get(), false);
scanner.Initialize();
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(
- &zone, CcTest::i_isolate()->ast_string_constants(),
- CcTest::i_isolate()->heap()->HashSeed());
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
+ i::AstValueFactory ast_value_factory(&zone, isolate->ast_string_constants(),
+ HashSeed(isolate));
i::PendingCompilationErrorHandler pending_error_handler;
- i::PreParser preparser(
- &zone, &scanner, CcTest::i_isolate()->stack_guard()->real_climit(),
- &ast_value_factory, &pending_error_handler,
- isolate->counters()->runtime_call_stats(), isolate->logger());
+ i::PreParser preparser(&zone, &scanner, isolate->stack_guard()->real_climit(),
+ &ast_value_factory, &pending_error_handler,
+ isolate->counters()->runtime_call_stats(),
+ isolate->logger());
i::PreParser::PreParseResult result = preparser.PreParseProgram();
// Even in the case of a syntax error, kPreParseSuccess is returned.
CHECK_EQ(i::PreParser::kPreParseSuccess, result);
@@ -807,10 +809,9 @@ TEST(PreParseOverflow) {
i::Scanner scanner(stream.get(), false);
scanner.Initialize();
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(
- &zone, CcTest::i_isolate()->ast_string_constants(),
- CcTest::i_isolate()->heap()->HashSeed());
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
+ i::AstValueFactory ast_value_factory(&zone, isolate->ast_string_constants(),
+ HashSeed(isolate));
i::PendingCompilationErrorHandler pending_error_handler;
i::PreParser preparser(
&zone, &scanner, stack_limit, &ast_value_factory, &pending_error_handler,
@@ -845,19 +846,9 @@ TEST(StreamScanner) {
std::unique_ptr<i::Utf16CharacterStream> stream1(
i::ScannerStream::ForTesting(str1));
i::Token::Value expectations1[] = {
- i::Token::LBRACE,
- i::Token::IDENTIFIER,
- i::Token::IDENTIFIER,
- i::Token::FOR,
- i::Token::COLON,
- i::Token::MUL,
- i::Token::DIV,
- i::Token::LT,
- i::Token::SUB,
- i::Token::IDENTIFIER,
- i::Token::EOS,
- i::Token::ILLEGAL
- };
+ i::Token::LBRACE, i::Token::IDENTIFIER, i::Token::GET, i::Token::FOR,
+ i::Token::COLON, i::Token::MUL, i::Token::DIV, i::Token::LT,
+ i::Token::SUB, i::Token::IDENTIFIER, i::Token::EOS, i::Token::ILLEGAL};
TestStreamScanner(stream1.get(), expectations1, 0, 0);
const char* str2 = "case default const {THIS\nPART\nSKIPPED} do";
@@ -911,7 +902,7 @@ void TestScanRegExp(const char* re_source, const char* expected) {
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
i::AstValueFactory ast_value_factory(
&zone, CcTest::i_isolate()->ast_string_constants(),
- CcTest::i_isolate()->heap()->HashSeed());
+ HashSeed(CcTest::i_isolate()));
const i::AstRawString* current_symbol =
scanner.CurrentSymbol(&ast_value_factory);
ast_value_factory.Internalize(CcTest::i_isolate());
@@ -1101,8 +1092,7 @@ TEST(ScopeUsesArgumentsSuperThis) {
if ((source_data[i].expected & THIS) != 0) {
// Currently the is_used() flag is conservative; all variables in a
// script scope are marked as used.
- CHECK(scope->LookupForTesting(info.ast_value_factory()->this_string())
- ->is_used());
+ CHECK(scope->GetReceiverScope()->receiver()->is_used());
}
if (is_sloppy(scope->language_mode())) {
CHECK_EQ((source_data[i].expected & EVAL) != 0,
@@ -1596,10 +1586,9 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
std::unique_ptr<i::Utf16CharacterStream> stream(
i::ScannerStream::For(isolate, source));
i::Scanner scanner(stream.get(), is_module);
- i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- i::AstValueFactory ast_value_factory(
- &zone, CcTest::i_isolate()->ast_string_constants(),
- CcTest::i_isolate()->heap()->HashSeed());
+ i::Zone zone(isolate->allocator(), ZONE_NAME);
+ i::AstValueFactory ast_value_factory(&zone, isolate->ast_string_constants(),
+ HashSeed(isolate));
i::PreParser preparser(&zone, &scanner, stack_limit, &ast_value_factory,
&pending_error_handler,
isolate->counters()->runtime_call_stats(),
@@ -3118,8 +3107,7 @@ TEST(FuncNameInferrerBasic) {
ExpectString("Ctor()", "Ctor.foo5");
ExpectString("%FunctionGetInferredName(obj1.foo6)", "obj1.foo6");
ExpectString("%FunctionGetInferredName(obj2.foo7)", "obj2.foo7");
- ExpectString("%FunctionGetInferredName(obj3[1])",
- "obj3.(anonymous function)");
+ ExpectString("%FunctionGetInferredName(obj3[1])", "obj3.<computed>");
ExpectString("%FunctionGetInferredName(obj4[1])", "");
ExpectString("%FunctionGetInferredName(obj5['foo9'])", "obj5.foo9");
ExpectString("%FunctionGetInferredName(obj6.obj7.foo10)", "obj6.obj7.foo10");
@@ -3236,7 +3224,7 @@ TEST(SerializationOfMaybeAssignmentFlag) {
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Context context = f->context();
i::AstValueFactory avf(&zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
const i::AstRawString* name = avf.GetOneByteString("result");
avf.Internalize(isolate);
i::Handle<i::String> str = name->string();
@@ -3286,7 +3274,7 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) {
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o);
i::Context context = f->context();
i::AstValueFactory avf(&zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
const i::AstRawString* name_x = avf.GetOneByteString("x");
avf.Internalize(isolate);
@@ -3473,7 +3461,6 @@ TEST(InnerAssignment) {
i::Variable* var = scope->LookupForTesting(var_name);
bool expected = outers[i].assigned || inners[j].assigned;
CHECK_NOT_NULL(var);
- CHECK(var->is_used() || !expected);
bool is_maybe_assigned = var->maybe_assigned() == i::kMaybeAssigned;
CHECK(is_maybe_assigned == expected ||
(is_maybe_assigned && inners[j].allow_error_in_inner_function));
@@ -3615,7 +3602,7 @@ static void TestMaybeAssigned(Input input, const char* variable, bool module,
}
CHECK_NOT_NULL(var);
- CHECK(var->is_used());
+ CHECK_IMPLIES(input.assigned, var->is_used());
STATIC_ASSERT(true == i::kMaybeAssigned);
CHECK_EQ(input.assigned, var->maybe_assigned() == i::kMaybeAssigned);
}
@@ -4202,7 +4189,7 @@ namespace {
i::Scope* DeserializeFunctionScope(i::Isolate* isolate, i::Zone* zone,
i::Handle<i::JSObject> m, const char* name) {
i::AstValueFactory avf(zone, isolate->ast_string_constants(),
- isolate->heap()->HashSeed());
+ HashSeed(isolate));
i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(
i::JSReceiver::GetProperty(isolate, m, name).ToHandleChecked());
i::DeclarationScope* script_scope =
@@ -5622,6 +5609,8 @@ TEST(PrivateMembersInNonClassNoErrors) {
{"function() {", "}"},
{"() => {", "}"},
{"class C { test() {", "} }"},
+ {"const {", "} = {}"},
+ {"({", "} = {})"},
{nullptr, nullptr}};
const char* class_body_data[] = {
"#a = 1",
@@ -6086,7 +6075,7 @@ TEST(PrivateStaticClassFieldsErrors) {
TEST(PrivateNameNoErrors) {
// clang-format off
const char* context_data[][2] = {
- {"", ""},
+ {"class X { bar() { ", " } }"},
{"\"use strict\";", ""},
{nullptr, nullptr}
};
@@ -6138,6 +6127,9 @@ TEST(PrivateNameErrors) {
// clang-format off
const char* context_data[][2] = {
{"", ""},
+ {"function t() { ", " }"},
+ {"var t => { ", " }"},
+ {"var t = { [ ", " ] }"},
{"\"use strict\";", ""},
{nullptr, nullptr}
};
@@ -7599,7 +7591,7 @@ TEST(ModuleParsingInternals) {
i::VariableLocation::MODULE);
CHECK(declarations->AtForTest(7)->var()->raw_name()->IsOneByteEqualTo(
- "*default*"));
+ ".default"));
CHECK(declarations->AtForTest(7)->var()->mode() == i::VariableMode::kConst);
CHECK(declarations->AtForTest(7)->var()->binding_needs_init());
CHECK(declarations->AtForTest(7)->var()->location() ==
@@ -7688,7 +7680,7 @@ TEST(ModuleParsingInternals) {
entry = descriptor->regular_exports()
.find(declarations->AtForTest(7)->var()->raw_name())
->second;
- CheckEntry(entry, "default", "*default*", nullptr, -1);
+ CheckEntry(entry, "default", ".default", nullptr, -1);
entry = descriptor->regular_exports()
.find(declarations->AtForTest(12)->var()->raw_name())
->second;
@@ -9385,11 +9377,10 @@ TEST(EscapedKeywords) {
"class C { st\\u0061tic *bar() {} }",
"class C { st\\u0061tic get bar() {} }",
"class C { st\\u0061tic set bar() {} }",
-
- // TODO(adamk): These should not be errors in sloppy mode.
- "(y\\u0069eld);",
- "var y\\u0069eld = 1;",
- "var { y\\u0069eld } = {};",
+ "(async ()=>{\\u0061wait 100})()",
+ "({\\u0067et get(){}})",
+ "({\\u0073et set(){}})",
+ "(async ()=>{var \\u0061wait = 100})()",
nullptr
};
// clang-format on
@@ -9403,6 +9394,9 @@ TEST(EscapedKeywords) {
"var l\\u0065t = 1;",
"l\\u0065t = 1;",
"(l\\u0065t === 1);",
+ "(y\\u0069eld);",
+ "var y\\u0069eld = 1;",
+ "var { y\\u0069eld } = {};",
nullptr
};
// clang-format on
@@ -11297,7 +11291,7 @@ TEST(LexicalLoopVariable) {
}
}
-TEST(PrivateNamesSyntaxError) {
+TEST(PrivateNamesSyntaxErrorWithScopeAnalysis) {
i::Isolate* isolate = CcTest::i_isolate();
i::HandleScope scope(isolate);
LocalContext env;
@@ -11379,23 +11373,10 @@ TEST(PrivateNamesSyntaxError) {
"}",
};
- // TODO(gsathya): The preparser does not track unresolved
- // variables in top level function which fails this test.
- // https://bugs.chromium.org/p/v8/issues/detail?id=7468
- const char* parser_data[] = {
- "function t() {"
- " return this.#foo;"
- "}",
- };
-
for (const char* source : data) {
CHECK(test(source, true));
CHECK(test(source, false));
}
-
- for (const char* source : parser_data) {
- CHECK(test(source, false));
- }
}
TEST(HashbangSyntax) {
diff --git a/deps/v8/test/cctest/test-profile-generator.cc b/deps/v8/test/cctest/test-profile-generator.cc
index c9d7f1da68..27cb4f841b 100644
--- a/deps/v8/test/cctest/test-profile-generator.cc
+++ b/deps/v8/test/cctest/test-profile-generator.cc
@@ -491,7 +491,7 @@ TEST(SampleIds) {
CHECK_EQ(3, profile->samples_count());
unsigned expected_id[] = {3, 5, 7};
for (int i = 0; i < 3; i++) {
- CHECK_EQ(expected_id[i], profile->sample(i)->id());
+ CHECK_EQ(expected_id[i], profile->sample(i).node->id());
}
}
diff --git a/deps/v8/test/cctest/test-regexp.cc b/deps/v8/test/cctest/test-regexp.cc
index 950237a105..49dcc49c3e 100644
--- a/deps/v8/test/cctest/test-regexp.cc
+++ b/deps/v8/test/cctest/test-regexp.cc
@@ -34,8 +34,10 @@
#include "src/assembler-arch.h"
#include "src/ast/ast.h"
#include "src/char-predicates-inl.h"
+#include "src/macro-assembler.h"
#include "src/objects-inl.h"
#include "src/ostreams.h"
+#include "src/regexp/interpreter-irregexp.h"
#include "src/regexp/jsregexp.h"
#include "src/regexp/regexp-macro-assembler-irregexp.h"
#include "src/regexp/regexp-macro-assembler.h"
@@ -44,36 +46,28 @@
#include "src/string-stream.h"
#include "src/unicode-inl.h"
#include "src/v8.h"
+#include "src/zone/zone-list-inl.h"
-#ifdef V8_INTERPRETED_REGEXP
-#include "src/regexp/interpreter-irregexp.h"
-#else // V8_INTERPRETED_REGEXP
-#include "src/macro-assembler.h"
#if V8_TARGET_ARCH_ARM
#include "src/regexp/arm/regexp-macro-assembler-arm.h"
-#endif
-#if V8_TARGET_ARCH_ARM64
+#elif V8_TARGET_ARCH_ARM64
#include "src/regexp/arm64/regexp-macro-assembler-arm64.h"
-#endif
-#if V8_TARGET_ARCH_S390
+#elif V8_TARGET_ARCH_S390
#include "src/regexp/s390/regexp-macro-assembler-s390.h"
-#endif
-#if V8_TARGET_ARCH_PPC
+#elif V8_TARGET_ARCH_PPC
#include "src/regexp/ppc/regexp-macro-assembler-ppc.h"
-#endif
-#if V8_TARGET_ARCH_MIPS
+#elif V8_TARGET_ARCH_MIPS
#include "src/regexp/mips/regexp-macro-assembler-mips.h"
-#endif
-#if V8_TARGET_ARCH_MIPS64
+#elif V8_TARGET_ARCH_MIPS64
#include "src/regexp/mips64/regexp-macro-assembler-mips64.h"
-#endif
-#if V8_TARGET_ARCH_X64
+#elif V8_TARGET_ARCH_X64
#include "src/regexp/x64/regexp-macro-assembler-x64.h"
-#endif
-#if V8_TARGET_ARCH_IA32
+#elif V8_TARGET_ARCH_IA32
#include "src/regexp/ia32/regexp-macro-assembler-ia32.h"
+#else
+#error Unknown architecture.
#endif
-#endif // V8_INTERPRETED_REGEXP
+
#include "test/cctest/cctest.h"
namespace v8 {
@@ -738,9 +732,6 @@ TEST(ParsePossessiveRepetition) {
// Tests of interpreter.
-
-#ifndef V8_INTERPRETED_REGEXP
-
#if V8_TARGET_ARCH_IA32
typedef RegExpMacroAssemblerIA32 ArchRegExpMacroAssembler;
#elif V8_TARGET_ARCH_X64
@@ -781,9 +772,11 @@ static ArchRegExpMacroAssembler::Result Execute(Code code, String input,
Address input_start,
Address input_end,
int* captures) {
- return NativeRegExpMacroAssembler::Execute(
- code, input, start_offset, reinterpret_cast<byte*>(input_start),
- reinterpret_cast<byte*>(input_end), captures, 0, CcTest::i_isolate());
+ return static_cast<NativeRegExpMacroAssembler::Result>(
+ NativeRegExpMacroAssembler::Execute(code, input, start_offset,
+ reinterpret_cast<byte*>(input_start),
+ reinterpret_cast<byte*>(input_end),
+ captures, 0, CcTest::i_isolate()));
}
TEST(MacroAssemblerNativeSuccess) {
@@ -1397,13 +1390,9 @@ TEST(MacroAssemblerNativeLotsOfRegisters) {
isolate->clear_pending_exception();
}
-#else // V8_INTERPRETED_REGEXP
-
TEST(MacroAssembler) {
- byte codes[1024];
Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
- RegExpMacroAssemblerIrregexp m(CcTest::i_isolate(), Vector<byte>(codes, 1024),
- &zone);
+ RegExpMacroAssemblerIrregexp m(CcTest::i_isolate(), &zone);
// ^f(o)o.
Label start, fail, backtrack;
@@ -1462,9 +1451,6 @@ TEST(MacroAssembler) {
CHECK_EQ(42, captures[0]);
}
-#endif // V8_INTERPRETED_REGEXP
-
-
TEST(AddInverseToTable) {
static const int kLimit = 1000;
static const int kRangeCount = 16;
diff --git a/deps/v8/test/cctest/test-representation.cc b/deps/v8/test/cctest/test-representation.cc
index e839f528f3..af0051e0af 100644
--- a/deps/v8/test/cctest/test-representation.cc
+++ b/deps/v8/test/cctest/test-representation.cc
@@ -46,85 +46,16 @@ void TestPairNegative(Representation more_general,
TEST(RepresentationMoreGeneralThan) {
TestPairNegative(Representation::None(), Representation::None());
- TestPairPositive(Representation::Integer8(), Representation::None());
- TestPairPositive(Representation::UInteger8(), Representation::None());
- TestPairPositive(Representation::Integer16(), Representation::None());
- TestPairPositive(Representation::UInteger16(), Representation::None());
TestPairPositive(Representation::Smi(), Representation::None());
- TestPairPositive(Representation::Integer32(), Representation::None());
TestPairPositive(Representation::HeapObject(), Representation::None());
TestPairPositive(Representation::Double(), Representation::None());
TestPairPositive(Representation::Tagged(), Representation::None());
- TestPairNegative(Representation::None(), Representation::Integer8());
- TestPairNegative(Representation::Integer8(), Representation::Integer8());
- TestPairNegative(Representation::UInteger8(), Representation::Integer8());
- TestPairPositive(Representation::Integer16(), Representation::Integer8());
- TestPairPositive(Representation::UInteger16(), Representation::Integer8());
- TestPairPositive(Representation::Smi(), Representation::Integer8());
- TestPairPositive(Representation::Integer32(), Representation::Integer8());
- TestPairNegative(Representation::HeapObject(), Representation::Integer8());
- TestPairPositive(Representation::Double(), Representation::Integer8());
- TestPairPositive(Representation::Tagged(), Representation::Integer8());
-
- TestPairNegative(Representation::None(), Representation::UInteger8());
- TestPairNegative(Representation::Integer8(), Representation::UInteger8());
- TestPairNegative(Representation::UInteger8(), Representation::UInteger8());
- TestPairPositive(Representation::Integer16(), Representation::UInteger8());
- TestPairPositive(Representation::UInteger16(), Representation::UInteger8());
- TestPairPositive(Representation::Smi(), Representation::UInteger8());
- TestPairPositive(Representation::Integer32(), Representation::UInteger8());
- TestPairNegative(Representation::HeapObject(), Representation::UInteger8());
- TestPairPositive(Representation::Double(), Representation::UInteger8());
- TestPairPositive(Representation::Tagged(), Representation::UInteger8());
-
- TestPairNegative(Representation::None(), Representation::Integer16());
- TestPairNegative(Representation::Integer8(), Representation::Integer16());
- TestPairNegative(Representation::UInteger8(), Representation::Integer16());
- TestPairNegative(Representation::Integer16(), Representation::Integer16());
- TestPairNegative(Representation::UInteger16(), Representation::Integer16());
- TestPairPositive(Representation::Smi(), Representation::Integer16());
- TestPairPositive(Representation::Integer32(), Representation::Integer16());
- TestPairNegative(Representation::HeapObject(), Representation::Integer16());
- TestPairPositive(Representation::Double(), Representation::Integer16());
- TestPairPositive(Representation::Tagged(), Representation::Integer16());
-
- TestPairNegative(Representation::None(), Representation::UInteger16());
- TestPairNegative(Representation::Integer8(), Representation::UInteger16());
- TestPairNegative(Representation::UInteger8(), Representation::UInteger16());
- TestPairNegative(Representation::Integer16(), Representation::UInteger16());
- TestPairNegative(Representation::UInteger16(), Representation::UInteger16());
- TestPairPositive(Representation::Smi(), Representation::UInteger16());
- TestPairPositive(Representation::Integer32(), Representation::UInteger16());
- TestPairNegative(Representation::HeapObject(), Representation::UInteger16());
- TestPairPositive(Representation::Double(), Representation::UInteger16());
- TestPairPositive(Representation::Tagged(), Representation::UInteger16());
-
TestPairNegative(Representation::None(), Representation::Smi());
- TestPairNegative(Representation::Integer8(), Representation::Smi());
- TestPairNegative(Representation::UInteger8(), Representation::Smi());
- TestPairNegative(Representation::Integer16(), Representation::Smi());
- TestPairNegative(Representation::UInteger16(), Representation::Smi());
TestPairNegative(Representation::Smi(), Representation::Smi());
- TestPairPositive(Representation::Integer32(), Representation::Smi());
TestPairNegative(Representation::HeapObject(), Representation::Smi());
TestPairPositive(Representation::Double(), Representation::Smi());
TestPairPositive(Representation::Tagged(), Representation::Smi());
-
- TestPairNegative(Representation::None(), Representation::Integer32());
- TestPairNegative(Representation::Integer8(), Representation::Integer32());
- TestPairNegative(Representation::UInteger8(), Representation::Integer32());
- TestPairNegative(Representation::Integer16(), Representation::Integer32());
- TestPairNegative(Representation::UInteger16(), Representation::Integer32());
- TestPairNegative(Representation::Smi(), Representation::Integer32());
- TestPairNegative(Representation::Integer32(), Representation::Integer32());
- TestPairNegative(Representation::HeapObject(), Representation::Integer32());
- TestPairPositive(Representation::Double(), Representation::Integer32());
- TestPairPositive(Representation::Tagged(), Representation::Integer32());
-
- TestPairNegative(Representation::None(), Representation::External());
- TestPairNegative(Representation::External(), Representation::External());
- TestPairPositive(Representation::External(), Representation::None());
}
} // namespace internal
diff --git a/deps/v8/test/cctest/test-roots.cc b/deps/v8/test/cctest/test-roots.cc
index bb4e09d8a4..a0ad1f06c6 100644
--- a/deps/v8/test/cctest/test-roots.cc
+++ b/deps/v8/test/cctest/test-roots.cc
@@ -2,7 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/heap/heap.h"
+#include "src/heap/heap-inl.h"
+#include "src/objects/cell.h"
+#include "src/objects/feedback-cell.h"
+#include "src/objects/script.h"
#include "src/roots-inl.h"
#include "test/cctest/cctest.h"
@@ -42,7 +45,7 @@ bool IsInitiallyMutable(Factory* factory, Address object_address) {
V(builtins_constants_table) \
V(current_microtask) \
V(detached_contexts) \
- V(dirty_js_weak_factories) \
+ V(dirty_js_finalization_groups) \
V(feedback_vectors_for_profiling_tools) \
V(materialized_objects) \
V(noscript_shared_function_infos) \
diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc
index ed1718adde..818505febc 100644
--- a/deps/v8/test/cctest/test-serialize.cc
+++ b/deps/v8/test/cctest/test-serialize.cc
@@ -37,6 +37,8 @@
#include "src/compilation-cache.h"
#include "src/compiler.h"
#include "src/debug/debug.h"
+#include "src/hash-seed-inl.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/spaces.h"
#include "src/interpreter/interpreter.h"
#include "src/macro-assembler-inl.h"
@@ -49,6 +51,7 @@
#include "src/snapshot/natives.h"
#include "src/snapshot/partial-deserializer.h"
#include "src/snapshot/partial-serializer.h"
+#include "src/snapshot/read-only-deserializer.h"
#include "src/snapshot/read-only-serializer.h"
#include "src/snapshot/snapshot.h"
#include "src/snapshot/startup-deserializer.h"
@@ -90,7 +93,7 @@ class TestSerializer {
v8::Isolate* v8_isolate = NewIsolate(kEnableSerializer, kGenerateHeap);
v8::Isolate::Scope isolate_scope(v8_isolate);
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
- isolate->Init(nullptr);
+ isolate->Init(nullptr, nullptr);
isolate->heap()->read_only_space()->ClearStringPaddingIfNeeded();
return v8_isolate;
}
@@ -98,13 +101,14 @@ class TestSerializer {
static v8::Isolate* NewIsolateFromBlob(StartupBlobs& blobs) {
SnapshotData startup_snapshot(blobs.startup);
SnapshotData read_only_snapshot(blobs.read_only);
- StartupDeserializer deserializer(&startup_snapshot, &read_only_snapshot);
+ ReadOnlyDeserializer read_only_deserializer(&read_only_snapshot);
+ StartupDeserializer startup_deserializer(&startup_snapshot);
const bool kEnableSerializer = false;
const bool kGenerateHeap = false;
v8::Isolate* v8_isolate = NewIsolate(kEnableSerializer, kGenerateHeap);
v8::Isolate::Scope isolate_scope(v8_isolate);
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
- isolate->Init(&deserializer);
+ isolate->Init(&read_only_deserializer, &startup_deserializer);
return v8_isolate;
}
@@ -860,7 +864,6 @@ UNINITIALIZED_TEST(CustomSnapshotDataBlobStringNotInternalized) {
FreeCurrentEmbeddedBlob();
}
-#ifndef V8_INTERPRETED_REGEXP
namespace {
void TestCustomSnapshotDataBlobWithIrregexpCode(
@@ -937,7 +940,6 @@ UNINITIALIZED_TEST(CustomSnapshotDataBlobWithIrregexpCodeClearCode) {
TestCustomSnapshotDataBlobWithIrregexpCode(
v8::SnapshotCreator::FunctionCodeHandling::kClear);
}
-#endif // V8_INTERPRETED_REGEXP
UNINITIALIZED_TEST(SnapshotChecksum) {
DisableAlwaysOpt();
@@ -1339,9 +1341,9 @@ UNINITIALIZED_TEST(CustomSnapshotDataBlobOutdatedContextWithOverflow) {
UNINITIALIZED_TEST(CustomSnapshotDataBlobWithLocker) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
- DisableEmbeddedBlobRefcounting();
v8::Isolate* isolate0 = v8::Isolate::New(create_params);
{
v8::Locker locker(isolate0);
@@ -1929,21 +1931,25 @@ TEST(CodeSerializerThreeBigStrings) {
v8::HandleScope scope(CcTest::isolate());
+ const int32_t length_of_a = kMaxRegularHeapObjectSize * 2;
+ const int32_t length_of_b = kMaxRegularHeapObjectSize / 2;
+ const int32_t length_of_c = kMaxRegularHeapObjectSize / 2;
+
Vector<const uint8_t> source_a =
ConstructSource(StaticCharVector("var a = \""), StaticCharVector("a"),
- StaticCharVector("\";"), 700000);
+ StaticCharVector("\";"), length_of_a);
Handle<String> source_a_str =
f->NewStringFromOneByte(source_a).ToHandleChecked();
Vector<const uint8_t> source_b =
ConstructSource(StaticCharVector("var b = \""), StaticCharVector("b"),
- StaticCharVector("\";"), 400000);
+ StaticCharVector("\";"), length_of_b);
Handle<String> source_b_str =
f->NewStringFromOneByte(source_b).ToHandleChecked();
Vector<const uint8_t> source_c =
ConstructSource(StaticCharVector("var c = \""), StaticCharVector("c"),
- StaticCharVector("\";"), 400000);
+ StaticCharVector("\";"), length_of_c);
Handle<String> source_c_str =
f->NewStringFromOneByte(source_c).ToHandleChecked();
@@ -1976,10 +1982,10 @@ TEST(CodeSerializerThreeBigStrings) {
v8::Maybe<int32_t> result =
CompileRun("(a + b).length")
->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext());
- CHECK_EQ(400000 + 700000, result.FromJust());
+ CHECK_EQ(length_of_a + length_of_b, result.FromJust());
result = CompileRun("(b + c).length")
->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext());
- CHECK_EQ(400000 + 400000, result.FromJust());
+ CHECK_EQ(length_of_b + length_of_c, result.FromJust());
Heap* heap = isolate->heap();
v8::Local<v8::String> result_str =
CompileRun("a")
@@ -1989,20 +1995,12 @@ TEST(CodeSerializerThreeBigStrings) {
result_str = CompileRun("b")
->ToString(CcTest::isolate()->GetCurrentContext())
.ToLocalChecked();
-#if V8_HOST_ARCH_PPC
- CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), LO_SPACE));
-#else
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE));
-#endif
result_str = CompileRun("c")
->ToString(CcTest::isolate()->GetCurrentContext())
.ToLocalChecked();
-#if V8_HOST_ARCH_PPC
- CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), LO_SPACE));
-#else
CHECK(heap->InSpace(*v8::Utils::OpenHandle(*result_str), OLD_SPACE));
-#endif
delete cache;
source_a.Dispose();
@@ -2577,8 +2575,9 @@ TEST(Regress503552) {
delete cache_data;
}
-TEST(SnapshotCreatorMultipleContexts) {
+UNINITIALIZED_TEST(SnapshotCreatorMultipleContexts) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
v8::SnapshotCreator creator;
@@ -2637,6 +2636,7 @@ TEST(SnapshotCreatorMultipleContexts) {
isolate->Dispose();
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
static int serialized_static_field = 314;
@@ -2699,8 +2699,9 @@ intptr_t replaced_external_references[] = {
intptr_t short_external_references[] = {
reinterpret_cast<intptr_t>(SerializedCallbackReplacement), 0};
-TEST(SnapshotCreatorExternalReferences) {
+UNINITIALIZED_TEST(SnapshotCreatorExternalReferences) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
v8::SnapshotCreator creator(original_external_references);
@@ -2787,10 +2788,12 @@ TEST(SnapshotCreatorExternalReferences) {
CHECK_EQ(3, serializable_two_byte_resource.dispose_count());
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
-TEST(SnapshotCreatorShortExternalReferences) {
+UNINITIALIZED_TEST(SnapshotCreatorShortExternalReferences) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
v8::SnapshotCreator creator(original_external_references);
@@ -2829,6 +2832,7 @@ TEST(SnapshotCreatorShortExternalReferences) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
v8::StartupData CreateSnapshotWithDefaultAndCustom() {
@@ -2865,8 +2869,9 @@ v8::StartupData CreateSnapshotWithDefaultAndCustom() {
return creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
}
-TEST(SnapshotCreatorNoExternalReferencesDefault) {
+UNINITIALIZED_TEST(SnapshotCreatorNoExternalReferencesDefault) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob = CreateSnapshotWithDefaultAndCustom();
// Deserialize with an incomplete list of external references.
@@ -2887,6 +2892,7 @@ TEST(SnapshotCreatorNoExternalReferencesDefault) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
v8::StartupData CreateCustomSnapshotWithPreparseDataAndNoOuterScope() {
@@ -2912,8 +2918,9 @@ v8::StartupData CreateCustomSnapshotWithPreparseDataAndNoOuterScope() {
return creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
}
-TEST(SnapshotCreatorPreparseDataAndNoOuterScope) {
+UNINITIALIZED_TEST(SnapshotCreatorPreparseDataAndNoOuterScope) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob = CreateCustomSnapshotWithPreparseDataAndNoOuterScope();
// Deserialize with an incomplete list of external references.
@@ -2932,6 +2939,7 @@ TEST(SnapshotCreatorPreparseDataAndNoOuterScope) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
v8::StartupData CreateCustomSnapshotArrayJoinWithKeep() {
@@ -2952,8 +2960,9 @@ v8::StartupData CreateCustomSnapshotArrayJoinWithKeep() {
return creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kKeep);
}
-TEST(SnapshotCreatorArrayJoinWithKeep) {
+UNINITIALIZED_TEST(SnapshotCreatorArrayJoinWithKeep) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob = CreateCustomSnapshotArrayJoinWithKeep();
// Deserialize with an incomplete list of external references.
@@ -2973,6 +2982,7 @@ TEST(SnapshotCreatorArrayJoinWithKeep) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
TEST(SnapshotCreatorNoExternalReferencesCustomFail1) {
@@ -3025,8 +3035,9 @@ TEST(SnapshotCreatorNoExternalReferencesCustomFail2) {
delete[] blob.data;
}
-TEST(SnapshotCreatorUnknownExternalReferences) {
+UNINITIALIZED_TEST(SnapshotCreatorUnknownExternalReferences) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::SnapshotCreator creator;
v8::Isolate* isolate = creator.GetIsolate();
{
@@ -3047,10 +3058,12 @@ TEST(SnapshotCreatorUnknownExternalReferences) {
creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear);
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
-TEST(SnapshotCreatorTemplates) {
+UNINITIALIZED_TEST(SnapshotCreatorTemplates) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
@@ -3214,10 +3227,12 @@ TEST(SnapshotCreatorTemplates) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
-TEST(SnapshotCreatorAddData) {
+UNINITIALIZED_TEST(SnapshotCreatorAddData) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
@@ -3414,6 +3429,7 @@ TEST(SnapshotCreatorAddData) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
TEST(SnapshotCreatorUnknownHandles) {
@@ -3441,8 +3457,9 @@ TEST(SnapshotCreatorUnknownHandles) {
delete[] blob.data;
}
-TEST(SnapshotCreatorIncludeGlobalProxy) {
+UNINITIALIZED_TEST(SnapshotCreatorIncludeGlobalProxy) {
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
v8::StartupData blob;
{
@@ -3537,14 +3554,15 @@ TEST(SnapshotCreatorIncludeGlobalProxy) {
v8::Isolate::Scope isolate_scope(isolate);
// We can introduce new extensions, which could override functions already
// in the snapshot.
- v8::Extension* extension = new v8::Extension("new extension",
- "function i() { return 24; }"
- "function j() { return 25; }"
- "try {"
- " if (o.p == 7) o.p++;"
- "} catch {}");
+ auto extension =
+ base::make_unique<v8::Extension>("new extension",
+ "function i() { return 24; }"
+ "function j() { return 25; }"
+ "try {"
+ " if (o.p == 7) o.p++;"
+ "} catch {}");
extension->set_auto_enable(true);
- v8::RegisterExtension(extension);
+ v8::RegisterExtension(std::move(extension));
{
// Create a new context from default context snapshot. This will
// create a new global object from a new global object template
@@ -3630,6 +3648,7 @@ TEST(SnapshotCreatorIncludeGlobalProxy) {
isolate->Dispose();
}
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
UNINITIALIZED_TEST(ReinitializeHashSeedNotRehashable) {
@@ -3666,7 +3685,7 @@ UNINITIALIZED_TEST(ReinitializeHashSeedNotRehashable) {
{
// Check that no rehashing has been performed.
CHECK_EQ(static_cast<uint64_t>(42),
- reinterpret_cast<i::Isolate*>(isolate)->heap()->HashSeed());
+ HashSeed(reinterpret_cast<i::Isolate*>(isolate)));
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
@@ -3731,7 +3750,7 @@ UNINITIALIZED_TEST(ReinitializeHashSeedRehashable) {
{
// Check that rehashing has been performed.
CHECK_EQ(static_cast<uint64_t>(1337),
- reinterpret_cast<i::Isolate*>(isolate)->heap()->HashSeed());
+ HashSeed(reinterpret_cast<i::Isolate*>(isolate)));
v8::Isolate::Scope isolate_scope(isolate);
v8::HandleScope handle_scope(isolate);
v8::Local<v8::Context> context = v8::Context::New(isolate);
@@ -3751,7 +3770,7 @@ UNINITIALIZED_TEST(ReinitializeHashSeedRehashable) {
FreeCurrentEmbeddedBlob();
}
-TEST(SerializationStats) {
+UNINITIALIZED_TEST(SerializationStats) {
FLAG_profile_deserialization = true;
FLAG_always_opt = false;
v8::StartupData blob = CreateSnapshotDataBlob();
@@ -3766,6 +3785,8 @@ TEST(SerializationStats) {
}
PrintF("Embedded blob is %d bytes\n", embedded_blob_size);
}
+
+ FreeCurrentEmbeddedBlob();
}
void CheckSFIsAreWeak(WeakFixedArray sfis, Isolate* isolate) {
@@ -3784,10 +3805,11 @@ void CheckSFIsAreWeak(WeakFixedArray sfis, Isolate* isolate) {
CHECK_GT(no_of_weak, 0);
}
-TEST(WeakArraySerializizationInSnapshot) {
+UNINITIALIZED_TEST(WeakArraySerializationInSnapshot) {
const char* code = "var my_func = function() { }";
DisableAlwaysOpt();
+ DisableEmbeddedBlobRefcounting();
i::FLAG_allow_natives_syntax = true;
v8::StartupData blob;
{
@@ -3829,10 +3851,11 @@ TEST(WeakArraySerializizationInSnapshot) {
// Verify that the pointers in shared_function_infos are weak.
WeakFixedArray sfis =
Script::cast(function->shared()->script())->shared_function_infos();
- CheckSFIsAreWeak(sfis, CcTest::i_isolate());
+ CheckSFIsAreWeak(sfis, reinterpret_cast<i::Isolate*>(isolate));
}
isolate->Dispose();
delete[] blob.data;
+ FreeCurrentEmbeddedBlob();
}
TEST(WeakArraySerializationInCodeCache) {
@@ -3900,5 +3923,27 @@ TEST(CachedCompileFunctionInContext) {
}
}
+UNINITIALIZED_TEST(SnapshotCreatorAnonClassWithKeep) {
+ DisableAlwaysOpt();
+ v8::SnapshotCreator creator;
+ v8::Isolate* isolate = creator.GetIsolate();
+ {
+ v8::HandleScope handle_scope(isolate);
+ {
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ v8::Context::Scope context_scope(context);
+ CompileRun(
+ "function Foo() { return class {}; } \n"
+ "class Bar extends Foo() {}\n"
+ "Foo()\n");
+ creator.SetDefaultContext(context);
+ }
+ }
+ v8::StartupData blob =
+ creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kKeep);
+
+ delete[] blob.data;
+}
+
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-strings.cc b/deps/v8/test/cctest/test-strings.cc
index 9afde32287..0871992ec6 100644
--- a/deps/v8/test/cctest/test-strings.cc
+++ b/deps/v8/test/cctest/test-strings.cc
@@ -37,6 +37,7 @@
#include "src/api-inl.h"
#include "src/base/platform/elapsed-timer.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/messages.h"
#include "src/objects-inl.h"
#include "src/unicode-decoder.h"
@@ -1425,7 +1426,7 @@ TEST(InternalizeExternal) {
Handle<String> string = v8::Utils::OpenHandle(*ext_string);
CHECK(string->IsExternalString());
CHECK(!string->IsInternalizedString());
- CHECK(!i::Heap::InNewSpace(*string));
+ CHECK(!i::Heap::InYoungGeneration(*string));
CHECK_EQ(
isolate->factory()->string_table()->LookupStringIfExists_NoAllocate(
isolate, string->ptr()),
@@ -1433,7 +1434,7 @@ TEST(InternalizeExternal) {
factory->InternalizeName(string);
CHECK(string->IsExternalString());
CHECK(string->IsInternalizedString());
- CHECK(!i::Heap::InNewSpace(*string));
+ CHECK(!i::Heap::InYoungGeneration(*string));
}
CcTest::CollectGarbage(i::OLD_SPACE);
CcTest::CollectGarbage(i::OLD_SPACE);
@@ -1817,7 +1818,7 @@ TEST(ExternalStringIndexOf) {
->NewStringFromOneByte(Vector<const uint8_t>( \
reinterpret_cast<const uint8_t*>(buf), len)) \
.ToHandleChecked(); \
- CHECK(Heap::InNewSpace(*main_string)); \
+ CHECK(Heap::InYoungGeneration(*main_string)); \
/* Next allocation will cause GC. */ \
heap::SimulateFullSpace(CcTest::i_isolate()->heap()->new_space()); \
/* Offset by two to check substring-ing. */ \
diff --git a/deps/v8/test/cctest/test-thread-termination.cc b/deps/v8/test/cctest/test-thread-termination.cc
index 72d01c2b7b..074e516220 100644
--- a/deps/v8/test/cctest/test-thread-termination.cc
+++ b/deps/v8/test/cctest/test-thread-termination.cc
@@ -176,10 +176,7 @@ class TerminatorThread : public v8::base::Thread {
v8::Isolate* isolate_;
};
-
-// Test that a single thread of JavaScript execution can be terminated
-// from the side by another thread.
-TEST(TerminateOnlyV8ThreadFromOtherThread) {
+void TestTerminatingSlowOperation(const char* source) {
semaphore = new v8::base::Semaphore(0);
TerminatorThread thread(CcTest::i_isolate());
thread.Start();
@@ -191,40 +188,55 @@ TEST(TerminateOnlyV8ThreadFromOtherThread) {
v8::Context::New(CcTest::isolate(), nullptr, global);
v8::Context::Scope context_scope(context);
CHECK(!CcTest::isolate()->IsExecutionTerminating());
- // Run a loop that will be infinite if thread termination does not work.
v8::MaybeLocal<v8::Value> result =
- CompileRun(CcTest::isolate()->GetCurrentContext(),
- "try { loop(); fail(); } catch(e) { fail(); }");
+ CompileRun(CcTest::isolate()->GetCurrentContext(), source);
CHECK(result.IsEmpty());
thread.Join();
delete semaphore;
semaphore = nullptr;
}
+// Test that a single thread of JavaScript execution can be terminated
+// from the side by another thread.
+TEST(TerminateOnlyV8ThreadFromOtherThread) {
+ // Run a loop that will be infinite if thread termination does not work.
+ TestTerminatingSlowOperation("try { loop(); fail(); } catch(e) { fail(); }");
+}
+
// Test that execution can be terminated from within JSON.stringify.
TEST(TerminateJsonStringify) {
- semaphore = new v8::base::Semaphore(0);
- TerminatorThread thread(CcTest::i_isolate());
- thread.Start();
+ TestTerminatingSlowOperation(
+ "var x = [];"
+ "x[2**31]=1;"
+ "terminate();"
+ "JSON.stringify(x);"
+ "fail();");
+}
- v8::HandleScope scope(CcTest::isolate());
- v8::Local<v8::ObjectTemplate> global =
- CreateGlobalTemplate(CcTest::isolate(), Signal, DoLoop);
- v8::Local<v8::Context> context =
- v8::Context::New(CcTest::isolate(), nullptr, global);
- v8::Context::Scope context_scope(context);
- CHECK(!CcTest::isolate()->IsExecutionTerminating());
- v8::MaybeLocal<v8::Value> result =
- CompileRun(CcTest::isolate()->GetCurrentContext(),
- "var x = [];"
- "x[2**31]=1;"
- "terminate();"
- "JSON.stringify(x);"
- "fail();");
- CHECK(result.IsEmpty());
- thread.Join();
- delete semaphore;
- semaphore = nullptr;
+TEST(TerminateBigIntMultiplication) {
+ TestTerminatingSlowOperation(
+ "terminate();"
+ "var a = 5n ** 555555n;"
+ "var b = 3n ** 3333333n;"
+ "a * b;"
+ "fail();");
+}
+
+TEST(TerminateBigIntDivision) {
+ TestTerminatingSlowOperation(
+ "var a = 2n ** 2222222n;"
+ "var b = 3n ** 333333n;"
+ "terminate();"
+ "a / b;"
+ "fail();");
+}
+
+TEST(TerminateBigIntToString) {
+ TestTerminatingSlowOperation(
+ "var a = 2n ** 2222222n;"
+ "terminate();"
+ "a.toString();"
+ "fail();");
}
int call_count = 0;
@@ -854,26 +866,26 @@ class TerminatorSleeperThread : public v8::base::Thread {
};
TEST(TerminateRegExp) {
-// regexp interpreter does not support preemption.
-#ifndef V8_INTERPRETED_REGEXP
- i::FLAG_allow_natives_syntax = true;
- v8::Isolate* isolate = CcTest::isolate();
- v8::HandleScope scope(isolate);
- v8::Local<v8::ObjectTemplate> global = CreateGlobalTemplate(
- isolate, TerminateCurrentThread, DoLoopCancelTerminate);
- v8::Local<v8::Context> context = v8::Context::New(isolate, nullptr, global);
- v8::Context::Scope context_scope(context);
- CHECK(!isolate->IsExecutionTerminating());
- v8::TryCatch try_catch(isolate);
- CHECK(!isolate->IsExecutionTerminating());
- CHECK(!CompileRun("var re = /(x+)+y$/; re.test('x');").IsEmpty());
- TerminatorSleeperThread terminator(isolate, 100);
- terminator.Start();
- CHECK(CompileRun("re.test('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); fail();")
- .IsEmpty());
- CHECK(try_catch.HasCaught());
- CHECK(isolate->IsExecutionTerminating());
-#endif // V8_INTERPRETED_REGEXP
+ // The regexp interpreter does not support preemption.
+ if (!i::FLAG_regexp_interpret_all) {
+ i::FLAG_allow_natives_syntax = true;
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::ObjectTemplate> global = CreateGlobalTemplate(
+ isolate, TerminateCurrentThread, DoLoopCancelTerminate);
+ v8::Local<v8::Context> context = v8::Context::New(isolate, nullptr, global);
+ v8::Context::Scope context_scope(context);
+ CHECK(!isolate->IsExecutionTerminating());
+ v8::TryCatch try_catch(isolate);
+ CHECK(!isolate->IsExecutionTerminating());
+ CHECK(!CompileRun("var re = /(x+)+y$/; re.test('x');").IsEmpty());
+ TerminatorSleeperThread terminator(isolate, 100);
+ terminator.Start();
+ CHECK(CompileRun("re.test('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); fail();")
+ .IsEmpty());
+ CHECK(try_catch.HasCaught());
+ CHECK(isolate->IsExecutionTerminating());
+ }
}
TEST(TerminateInMicrotask) {
diff --git a/deps/v8/test/cctest/test-trace-event.cc b/deps/v8/test/cctest/test-trace-event.cc
index f73641d9cf..ed04a247ab 100644
--- a/deps/v8/test/cctest/test-trace-event.cc
+++ b/deps/v8/test/cctest/test-trace-event.cc
@@ -234,26 +234,6 @@ TEST(TestEventWithId) {
CHECK_EQ(event_id, GET_TRACE_OBJECT(1)->id);
}
-TEST(TestEventInContext) {
- MockTracingPlatform platform;
-
- static uint64_t isolate_id = 0x20151021;
- {
- TRACE_EVENT_SCOPED_CONTEXT("v8-cat", "Isolate", isolate_id);
- TRACE_EVENT0("v8-cat", "e");
- }
-
- CHECK_EQ(3, GET_TRACE_OBJECTS_LIST->size());
- CHECK_EQ(TRACE_EVENT_PHASE_ENTER_CONTEXT, GET_TRACE_OBJECT(0)->phase);
- CHECK_EQ("Isolate", GET_TRACE_OBJECT(0)->name);
- CHECK_EQ(isolate_id, GET_TRACE_OBJECT(0)->id);
- CHECK_EQ(TRACE_EVENT_PHASE_COMPLETE, GET_TRACE_OBJECT(1)->phase);
- CHECK_EQ("e", GET_TRACE_OBJECT(1)->name);
- CHECK_EQ(TRACE_EVENT_PHASE_LEAVE_CONTEXT, GET_TRACE_OBJECT(2)->phase);
- CHECK_EQ("Isolate", GET_TRACE_OBJECT(2)->name);
- CHECK_EQ(isolate_id, GET_TRACE_OBJECT(2)->id);
-}
-
TEST(TestEventWithTimestamp) {
MockTracingPlatform platform;
diff --git a/deps/v8/test/cctest/test-transitions.cc b/deps/v8/test/cctest/test-transitions.cc
index c4b7451147..c43d7ba9b7 100644
--- a/deps/v8/test/cctest/test-transitions.cc
+++ b/deps/v8/test/cctest/test-transitions.cc
@@ -13,7 +13,7 @@
#include "src/global-handles.h"
#include "src/heap/factory.h"
#include "src/objects-inl.h"
-#include "src/transitions.h"
+#include "src/transitions-inl.h"
#include "test/cctest/cctest.h"
#include "test/cctest/test-transitions.h"
diff --git a/deps/v8/test/cctest/test-types.cc b/deps/v8/test/cctest/test-types.cc
index c8d5e37fa2..73257cc057 100644
--- a/deps/v8/test/cctest/test-types.cc
+++ b/deps/v8/test/cctest/test-types.cc
@@ -10,7 +10,7 @@
#include "src/isolate.h"
#include "src/objects.h"
#include "test/cctest/cctest.h"
-#include "test/cctest/types-fuzz.h"
+#include "test/common/types-fuzz.h"
namespace v8 {
namespace internal {
diff --git a/deps/v8/test/cctest/test-unboxed-doubles.cc b/deps/v8/test/cctest/test-unboxed-doubles.cc
index 0d1ebe6759..c202140f42 100644
--- a/deps/v8/test/cctest/test-unboxed-doubles.cc
+++ b/deps/v8/test/cctest/test-unboxed-doubles.cc
@@ -15,6 +15,7 @@
#include "src/field-type.h"
#include "src/global-handles.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/incremental-marking.h"
#include "src/heap/spaces.h"
#include "src/ic/ic.h"
@@ -1114,7 +1115,7 @@ TEST(DoScavenge) {
// Construct a double value that looks like a pointer to the new space object
// and store it into the obj.
- Address fake_object = temp->ptr() + kPointerSize;
+ Address fake_object = temp->ptr() + kSystemPointerSize;
double boom_value = bit_cast<double>(fake_object);
FieldIndex field_index = FieldIndex::ForDescriptor(obj->map(), 0);
@@ -1261,11 +1262,11 @@ static void TestLayoutDescriptorHelper(Isolate* isolate,
CHECK_EQ(expected_tagged, helper.IsTagged(index.offset(), instance_size,
&end_of_region_offset));
CHECK_GT(end_of_region_offset, 0);
- CHECK_EQ(end_of_region_offset % kPointerSize, 0);
+ CHECK_EQ(end_of_region_offset % kTaggedSize, 0);
CHECK(end_of_region_offset <= instance_size);
for (int offset = index.offset(); offset < end_of_region_offset;
- offset += kPointerSize) {
+ offset += kTaggedSize) {
CHECK_EQ(expected_tagged, helper.IsTagged(index.offset()));
}
if (end_of_region_offset < instance_size) {
@@ -1275,7 +1276,7 @@ static void TestLayoutDescriptorHelper(Isolate* isolate,
}
}
- for (int offset = 0; offset < JSObject::kHeaderSize; offset += kPointerSize) {
+ for (int offset = 0; offset < JSObject::kHeaderSize; offset += kTaggedSize) {
// Header queries
CHECK(helper.IsTagged(offset));
int end_of_region_offset;
@@ -1454,7 +1455,7 @@ static void TestWriteBarrier(Handle<Map> map, Handle<Map> new_map,
obj_value = factory->NewHeapNumber(0.);
}
- CHECK(Heap::InNewSpace(*obj_value));
+ CHECK(Heap::InYoungGeneration(*obj_value));
{
FieldIndex index = FieldIndex::ForDescriptor(*map, tagged_descriptor);
@@ -1468,7 +1469,7 @@ static void TestWriteBarrier(Handle<Map> map, Handle<Map> new_map,
// |boom_value| to the slot that was earlier recorded by write barrier.
JSObject::MigrateToMap(obj, new_map);
- Address fake_object = obj_value->ptr() + kPointerSize;
+ Address fake_object = obj_value->ptr() + kTaggedSize;
uint64_t boom_value = bit_cast<uint64_t>(fake_object);
FieldIndex double_field_index =
diff --git a/deps/v8/test/cctest/test-unscopables-hidden-prototype.cc b/deps/v8/test/cctest/test-unscopables-hidden-prototype.cc
index de0976825d..d98e2739d5 100644
--- a/deps/v8/test/cctest/test-unscopables-hidden-prototype.cc
+++ b/deps/v8/test/cctest/test-unscopables-hidden-prototype.cc
@@ -28,8 +28,6 @@ TEST(Unscopables) {
v8::Local<v8::FunctionTemplate> t0 = v8::FunctionTemplate::New(isolate);
v8::Local<v8::FunctionTemplate> t1 = v8::FunctionTemplate::New(isolate);
- t1->SetHiddenPrototype(true);
-
v8::Local<v8::Object> object = t0->GetFunction(current_context)
.ToLocalChecked()
->NewInstance(current_context)
diff --git a/deps/v8/test/cctest/test-unwinder.cc b/deps/v8/test/cctest/test-unwinder.cc
index 26b7c99b2f..63ce17d57c 100644
--- a/deps/v8/test/cctest/test-unwinder.cc
+++ b/deps/v8/test/cctest/test-unwinder.cc
@@ -6,6 +6,7 @@
#include "src/api-inl.h"
#include "src/builtins/builtins.h"
+#include "src/heap/spaces.h"
#include "src/isolate.h"
#include "src/objects/code-inl.h"
#include "test/cctest/cctest.h"
diff --git a/deps/v8/test/cctest/test-weakmaps.cc b/deps/v8/test/cctest/test-weakmaps.cc
index b6fe4e7597..4ef3766473 100644
--- a/deps/v8/test/cctest/test-weakmaps.cc
+++ b/deps/v8/test/cctest/test-weakmaps.cc
@@ -29,6 +29,7 @@
#include "src/global-handles.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/objects/hash-table-inl.h"
@@ -173,7 +174,7 @@ TEST(Regress2060a) {
HandleScope scope(isolate);
for (int i = 0; i < 32; i++) {
Handle<JSObject> object = factory->NewJSObject(function, TENURED);
- CHECK(!Heap::InNewSpace(*object));
+ CHECK(!Heap::InYoungGeneration(*object));
CHECK(!first_page->Contains(object->address()));
int32_t hash = key->GetOrCreateHash(isolate)->value();
JSWeakCollection::Set(weakmap, key, object, hash);
@@ -211,7 +212,7 @@ TEST(Regress2060b) {
Handle<JSObject> keys[32];
for (int i = 0; i < 32; i++) {
keys[i] = factory->NewJSObject(function, TENURED);
- CHECK(!Heap::InNewSpace(*keys[i]));
+ CHECK(!Heap::InYoungGeneration(*keys[i]));
CHECK(!first_page->Contains(keys[i]->address()));
}
Handle<JSWeakMap> weakmap = isolate->factory()->NewJSWeakMap();
@@ -247,6 +248,39 @@ TEST(Regress399527) {
CcTest::CollectAllGarbage();
}
+TEST(WeakMapsWithChainedEntries) {
+ ManualGCScope manual_gc_scope;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ i::Isolate* i_isolate = CcTest::i_isolate();
+ v8::HandleScope scope(isolate);
+
+ const int initial_gc_count = i_isolate->heap()->gc_count();
+ Handle<JSWeakMap> weakmap1 = i_isolate->factory()->NewJSWeakMap();
+ Handle<JSWeakMap> weakmap2 = i_isolate->factory()->NewJSWeakMap();
+ v8::Global<v8::Object> g1;
+ v8::Global<v8::Object> g2;
+ {
+ v8::HandleScope scope(isolate);
+ v8::Local<v8::Object> o1 = v8::Object::New(isolate);
+ g1.Reset(isolate, o1);
+ g1.SetWeak();
+ v8::Local<v8::Object> o2 = v8::Object::New(isolate);
+ g2.Reset(isolate, o2);
+ g2.SetWeak();
+ Handle<Object> i_o1 = v8::Utils::OpenHandle(*o1);
+ Handle<Object> i_o2 = v8::Utils::OpenHandle(*o2);
+ int32_t hash1 = i_o1->GetOrCreateHash(i_isolate)->value();
+ int32_t hash2 = i_o2->GetOrCreateHash(i_isolate)->value();
+ JSWeakCollection::Set(weakmap1, i_o1, i_o2, hash1);
+ JSWeakCollection::Set(weakmap2, i_o2, i_o1, hash2);
+ }
+ CcTest::CollectGarbage(OLD_SPACE);
+ CHECK(g1.IsEmpty());
+ CHECK(g2.IsEmpty());
+ CHECK_EQ(1, i_isolate->heap()->gc_count() - initial_gc_count);
+}
+
} // namespace test_weakmaps
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-weaksets.cc b/deps/v8/test/cctest/test-weaksets.cc
index 763a809f87..36c9e339b8 100644
--- a/deps/v8/test/cctest/test-weaksets.cc
+++ b/deps/v8/test/cctest/test-weaksets.cc
@@ -29,6 +29,7 @@
#include "src/global-handles.h"
#include "src/heap/factory.h"
+#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/objects/hash-table-inl.h"
@@ -184,7 +185,7 @@ TEST(WeakSet_Regress2060a) {
HandleScope scope(isolate);
for (int i = 0; i < 32; i++) {
Handle<JSObject> object = factory->NewJSObject(function, TENURED);
- CHECK(!Heap::InNewSpace(*object));
+ CHECK(!Heap::InYoungGeneration(*object));
CHECK(!first_page->Contains(object->address()));
int32_t hash = key->GetOrCreateHash(isolate)->value();
JSWeakCollection::Set(weakset, key, object, hash);
@@ -222,7 +223,7 @@ TEST(WeakSet_Regress2060b) {
Handle<JSObject> keys[32];
for (int i = 0; i < 32; i++) {
keys[i] = factory->NewJSObject(function, TENURED);
- CHECK(!Heap::InNewSpace(*keys[i]));
+ CHECK(!Heap::InYoungGeneration(*keys[i]));
CHECK(!first_page->Contains(keys[i]->address()));
}
Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate);
diff --git a/deps/v8/test/cctest/testcfg.py b/deps/v8/test/cctest/testcfg.py
index 562f44098a..5c09dedbd2 100644
--- a/deps/v8/test/cctest/testcfg.py
+++ b/deps/v8/test/cctest/testcfg.py
@@ -36,8 +36,8 @@ from testrunner.objects import testcase
SHELL = 'cctest'
-class TestSuite(testsuite.TestSuite):
- def ListTests(self):
+class TestLoader(testsuite.TestLoader):
+ def _list_test_filenames(self):
shell = os.path.abspath(os.path.join(self.test_config.shell_dir, SHELL))
if utils.IsWindows():
shell += ".exe"
@@ -46,14 +46,19 @@ class TestSuite(testsuite.TestSuite):
shell=shell,
args=["--list"] + self.test_config.extra_flags)
output = cmd.execute()
+ # TODO make errors visible (see duplicated code in 'unittests')
if output.exit_code != 0:
print cmd
print output.stdout
print output.stderr
return []
- tests = map(self._create_test, output.stdout.strip().split())
- tests.sort(key=lambda t: t.path)
- return tests
+
+ return sorted(output.stdout.strip().split())
+
+
+class TestSuite(testsuite.TestSuite):
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/cctest/torque/test-torque.cc b/deps/v8/test/cctest/torque/test-torque.cc
index 0941795bd6..067bccea02 100644
--- a/deps/v8/test/cctest/torque/test-torque.cc
+++ b/deps/v8/test/cctest/torque/test-torque.cc
@@ -275,6 +275,22 @@ TEST(TestGenericOverload) {
ft.Call();
}
+TEST(TestEquality) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate, 0);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ m.TestEquality(m.UncheckedCast<Context>(m.HeapConstant(context)));
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
TEST(TestLogicalOperators) {
Isolate* isolate(CcTest::InitIsolateOnce());
CodeAssemblerTester asm_tester(isolate, 0);
@@ -423,6 +439,22 @@ TEST(TestStructConstructor) {
ft.Call();
}
+TEST(TestInternalClass) {
+ CcTest::InitializeVM();
+ Isolate* isolate(CcTest::i_isolate());
+ i::HandleScope scope(isolate);
+ Handle<Context> context =
+ Utils::OpenHandle(*v8::Isolate::GetCurrent()->GetCurrentContext());
+ CodeAssemblerTester asm_tester(isolate);
+ TestTorqueAssembler m(asm_tester.state());
+ {
+ m.TestInternalClass(m.UncheckedCast<Context>(m.HeapConstant(context)));
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/unicode-helpers.cc b/deps/v8/test/cctest/unicode-helpers.cc
index 524e5936fc..1a74e0ca94 100644
--- a/deps/v8/test/cctest/unicode-helpers.cc
+++ b/deps/v8/test/cctest/unicode-helpers.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "test/cctest/unicode-helpers.h"
+#include "src/unicode-inl.h"
int Ucs2CharLength(unibrow::uchar c) {
if (c == unibrow::Utf8::kIncomplete || c == unibrow::Utf8::kBufferEmpty) {
@@ -19,10 +20,9 @@ int Utf8LengthHelper(const char* s) {
unibrow::Utf8::State state = unibrow::Utf8::State::kAccept;
int length = 0;
- size_t i = 0;
- while (s[i] != '\0') {
- unibrow::uchar tmp =
- unibrow::Utf8::ValueOfIncremental(s[i], &i, &state, &buffer);
+ const uint8_t* c = reinterpret_cast<const uint8_t*>(s);
+ while (*c != '\0') {
+ unibrow::uchar tmp = unibrow::Utf8::ValueOfIncremental(&c, &state, &buffer);
length += Ucs2CharLength(tmp);
}
unibrow::uchar tmp = unibrow::Utf8::ValueOfIncrementalFinish(&state);
diff --git a/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc b/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc
index 6c246bc48c..fc711aa7a7 100644
--- a/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc
+++ b/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc
@@ -109,7 +109,7 @@ TEST(TestCWasmEntryArgPassing_int32) {
return base::AddWithWraparound(base::MulWithWraparound(2, a), 1);
});
- FOR_INT32_INPUTS(v) { tester.CheckCall(*v); }
+ FOR_INT32_INPUTS(v) { tester.CheckCall(v); }
}
// Pass int64_t, return double.
@@ -119,7 +119,7 @@ TEST(TestCWasmEntryArgPassing_double_int64) {
WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0))},
[](int64_t a) { return static_cast<double>(a); });
- FOR_INT64_INPUTS(v) { tester.CheckCall(*v); }
+ FOR_INT64_INPUTS(v) { tester.CheckCall(v); }
}
// Pass double, return int64_t.
@@ -129,7 +129,7 @@ TEST(TestCWasmEntryArgPassing_int64_double) {
WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0))},
[](double d) { return static_cast<int64_t>(d); });
- FOR_INT64_INPUTS(i) { tester.CheckCall(*i); }
+ FOR_INT64_INPUTS(i) { tester.CheckCall(i); }
}
// Pass float, return double.
@@ -141,7 +141,7 @@ TEST(TestCWasmEntryArgPassing_float_double) {
WASM_F64(1))},
[](float f) { return 2. * static_cast<double>(f) + 1.; });
- FOR_FLOAT32_INPUTS(f) { tester.CheckCall(*f); }
+ FOR_FLOAT32_INPUTS(f) { tester.CheckCall(f); }
}
// Pass two doubles, return double.
@@ -152,7 +152,7 @@ TEST(TestCWasmEntryArgPassing_double_double) {
[](double a, double b) { return a + b; });
FOR_FLOAT64_INPUTS(d1) {
- FOR_FLOAT64_INPUTS(d2) { tester.CheckCall(*d1, *d2); }
+ FOR_FLOAT64_INPUTS(d2) { tester.CheckCall(d1, d2); }
}
}
diff --git a/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc b/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc
index d8d9e0412e..1472196504 100644
--- a/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc
+++ b/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc
@@ -24,10 +24,6 @@ namespace wasm {
#define __ masm.
-// TODO(v8:7424,v8:8018): Extend this test to all architectures.
-#if V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM || \
- V8_TARGET_ARCH_ARM64
-
namespace {
static volatile int global_stop_bit = 0;
@@ -109,6 +105,30 @@ Address GenerateJumpTableThunk(
__ Tbnz(scratch, 0, &exit);
__ Mov(scratch, Immediate(jump_target, RelocInfo::NONE));
__ Br(scratch);
+#elif V8_TARGET_ARCH_PPC64
+ __ mov(scratch, Operand(stop_bit_address, RelocInfo::NONE));
+ __ LoadP(scratch, MemOperand(scratch));
+ __ cmpi(scratch, Operand::Zero());
+ __ bne(&exit);
+ __ mov(scratch, Operand(jump_target, RelocInfo::NONE));
+ __ Jump(scratch);
+#elif V8_TARGET_ARCH_S390X
+ __ mov(scratch, Operand(stop_bit_address, RelocInfo::NONE));
+ __ LoadP(scratch, MemOperand(scratch));
+ __ CmpP(scratch, Operand(0));
+ __ bne(&exit);
+ __ mov(scratch, Operand(jump_target, RelocInfo::NONE));
+ __ Jump(scratch);
+#elif V8_TARGET_ARCH_MIPS64
+ __ li(scratch, Operand(stop_bit_address, RelocInfo::NONE));
+ __ Lw(scratch, MemOperand(scratch, 0));
+ __ Branch(&exit, ne, scratch, Operand(zero_reg));
+ __ Jump(jump_target, RelocInfo::NONE);
+#elif V8_TARGET_ARCH_MIPS
+ __ li(scratch, Operand(stop_bit_address, RelocInfo::NONE));
+ __ lw(scratch, MemOperand(scratch, 0));
+ __ Branch(&exit, ne, scratch, Operand(zero_reg));
+ __ Jump(jump_target, RelocInfo::NONE);
#else
#error Unsupported architecture
#endif
@@ -236,9 +256,6 @@ TEST(JumpTablePatchingStress) {
}
}
-#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM ||
- // V8_TARGET_ARCH_ARM64
-
#undef __
#undef TRACE
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc
index cca0c1b061..dfce94b20c 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc
@@ -32,9 +32,9 @@ WASM_EXEC_TEST(I64Const) {
WASM_EXEC_TEST(I64Const_many) {
int cntr = 0;
- FOR_INT32_INPUTS(i) {
+ FOR_UINT32_INPUTS(i) {
WasmRunner<int64_t> r(execution_tier);
- const int64_t kExpectedValue = (static_cast<int64_t>(*i) << 32) | cntr;
+ const int64_t kExpectedValue = (static_cast<uint64_t>(i) << 32) | cntr;
// return(kExpectedValue)
BUILD(r, WASM_I64V(kExpectedValue));
CHECK_EQ(kExpectedValue, r.Call());
@@ -47,7 +47,7 @@ WASM_EXEC_TEST(Return_I64) {
BUILD(r, WASM_RETURN1(WASM_GET_LOCAL(0)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(I64Add) {
@@ -55,7 +55,7 @@ WASM_EXEC_TEST(I64Add) {
BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(base::AddWithWraparound(*i, *j), r.Call(*i, *j));
+ CHECK_EQ(base::AddWithWraparound(i, j), r.Call(i, j));
}
}
}
@@ -79,7 +79,7 @@ WASM_EXEC_TEST(I64Sub) {
BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(base::SubWithWraparound(*i, *j), r.Call(*i, *j));
+ CHECK_EQ(base::SubWithWraparound(i, j), r.Call(i, j));
}
}
}
@@ -99,8 +99,8 @@ WASM_EXEC_TEST(I64AddUseOnlyLowWord) {
WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(static_cast<int32_t>(base::AddWithWraparound(*i, *j)),
- r.Call(*i, *j));
+ CHECK_EQ(static_cast<int32_t>(base::AddWithWraparound(i, j)),
+ r.Call(i, j));
}
}
}
@@ -111,8 +111,8 @@ WASM_EXEC_TEST(I64SubUseOnlyLowWord) {
WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(static_cast<int32_t>(base::SubWithWraparound(*i, *j)),
- r.Call(*i, *j));
+ CHECK_EQ(static_cast<int32_t>(base::SubWithWraparound(i, j)),
+ r.Call(i, j));
}
}
}
@@ -123,8 +123,8 @@ WASM_EXEC_TEST(I64MulUseOnlyLowWord) {
WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- CHECK_EQ(static_cast<int32_t>(base::MulWithWraparound(*i, *j)),
- r.Call(*i, *j));
+ CHECK_EQ(static_cast<int32_t>(base::MulWithWraparound(i, j)),
+ r.Call(i, j));
}
}
}
@@ -135,8 +135,8 @@ WASM_EXEC_TEST(I64ShlUseOnlyLowWord) {
WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(base::ShlWithWraparound(*i, *j));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>(base::ShlWithWraparound(i, j));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -147,8 +147,8 @@ WASM_EXEC_TEST(I64ShrUseOnlyLowWord) {
WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3F));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>((i) >> (j & 0x3F));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -159,8 +159,8 @@ WASM_EXEC_TEST(I64SarUseOnlyLowWord) {
WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3F));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>((i) >> (j & 0x3F));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -170,12 +170,12 @@ WASM_EXEC_TEST(I64DivS) {
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- if (*j == 0) {
- CHECK_TRAP64(r.Call(*i, *j));
- } else if (*j == -1 && *i == std::numeric_limits<int64_t>::min()) {
- CHECK_TRAP64(r.Call(*i, *j));
+ if (j == 0) {
+ CHECK_TRAP64(r.Call(i, j));
+ } else if (j == -1 && i == std::numeric_limits<int64_t>::min()) {
+ CHECK_TRAP64(r.Call(i, j));
} else {
- CHECK_EQ(*i / *j, r.Call(*i, *j));
+ CHECK_EQ(i / j, r.Call(i, j));
}
}
}
@@ -210,10 +210,10 @@ WASM_EXEC_TEST(I64DivU) {
BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- if (*j == 0) {
- CHECK_TRAP64(r.Call(*i, *j));
+ if (j == 0) {
+ CHECK_TRAP64(r.Call(i, j));
} else {
- CHECK_EQ(*i / *j, r.Call(*i, *j));
+ CHECK_EQ(i / j, r.Call(i, j));
}
}
}
@@ -248,10 +248,10 @@ WASM_EXEC_TEST(I64RemS) {
BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- if (*j == 0) {
- CHECK_TRAP64(r.Call(*i, *j));
+ if (j == 0) {
+ CHECK_TRAP64(r.Call(i, j));
} else {
- CHECK_EQ(*i % *j, r.Call(*i, *j));
+ CHECK_EQ(i % j, r.Call(i, j));
}
}
}
@@ -272,10 +272,10 @@ WASM_EXEC_TEST(I64RemU) {
BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- if (*j == 0) {
- CHECK_TRAP64(r.Call(*i, *j));
+ if (j == 0) {
+ CHECK_TRAP64(r.Call(i, j));
} else {
- CHECK_EQ(*i % *j, r.Call(*i, *j));
+ CHECK_EQ(i % j, r.Call(i, j));
}
}
}
@@ -294,7 +294,7 @@ WASM_EXEC_TEST(I64And) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ((*i) & (*j), r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ((i) & (j), r.Call(i, j)); }
}
}
@@ -302,7 +302,7 @@ WASM_EXEC_TEST(I64Ior) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ((*i) | (*j), r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ((i) | (j), r.Call(i, j)); }
}
}
@@ -310,7 +310,7 @@ WASM_EXEC_TEST(I64Xor) {
WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ((*i) ^ (*j), r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ((i) ^ (j), r.Call(i, j)); }
}
}
@@ -321,30 +321,30 @@ WASM_EXEC_TEST(I64Shl) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- uint64_t expected = (*i) << (*j & 0x3F);
- CHECK_EQ(expected, r.Call(*i, *j));
+ uint64_t expected = (i) << (j & 0x3F);
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 0, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i << 0, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 32, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i << 32, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i << 20, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i << 40, r.Call(i)); }
}
}
@@ -355,30 +355,30 @@ WASM_EXEC_TEST(I64ShrU) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- uint64_t expected = (*i) >> (*j & 0x3F);
- CHECK_EQ(expected, r.Call(*i, *j));
+ uint64_t expected = (i) >> (j & 0x3F);
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i >> 0, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i >> 32, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i >> 20, r.Call(i)); }
}
{
WasmRunner<uint64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
- FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); }
+ FOR_UINT64_INPUTS(i) { CHECK_EQ(i >> 40, r.Call(i)); }
}
}
@@ -389,30 +389,30 @@ WASM_EXEC_TEST(I64ShrS) {
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
- int64_t expected = (*i) >> (*j & 0x3F);
- CHECK_EQ(expected, r.Call(*i, *j));
+ int64_t expected = (i) >> (j & 0x3F);
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
{
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(0)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i >> 0, r.Call(i)); }
}
{
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(32)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i >> 32, r.Call(i)); }
}
{
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i >> 20, r.Call(i)); }
}
{
WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(40)));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i >> 40, r.Call(i)); }
}
}
@@ -420,7 +420,7 @@ WASM_EXEC_TEST(I64Eq) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i == *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i == j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -428,7 +428,7 @@ WASM_EXEC_TEST(I64Ne) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i != *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i != j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -436,7 +436,7 @@ WASM_EXEC_TEST(I64LtS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i < j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -444,7 +444,7 @@ WASM_EXEC_TEST(I64LeS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i <= j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -452,7 +452,7 @@ WASM_EXEC_TEST(I64LtU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
- FOR_UINT64_INPUTS(j) { CHECK_EQ(*i < *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_UINT64_INPUTS(j) { CHECK_EQ(i < j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -460,7 +460,7 @@ WASM_EXEC_TEST(I64LeU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
- FOR_UINT64_INPUTS(j) { CHECK_EQ(*i <= *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_UINT64_INPUTS(j) { CHECK_EQ(i <= j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -468,7 +468,7 @@ WASM_EXEC_TEST(I64GtS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i > j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -476,7 +476,7 @@ WASM_EXEC_TEST(I64GeS) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i >= j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -484,7 +484,7 @@ WASM_EXEC_TEST(I64GtU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
- FOR_UINT64_INPUTS(j) { CHECK_EQ(*i > *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_UINT64_INPUTS(j) { CHECK_EQ(i > j ? 1 : 0, r.Call(i, j)); }
}
}
@@ -492,28 +492,28 @@ WASM_EXEC_TEST(I64GeU) {
WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
- FOR_UINT64_INPUTS(j) { CHECK_EQ(*i >= *j ? 1 : 0, r.Call(*i, *j)); }
+ FOR_UINT64_INPUTS(j) { CHECK_EQ(i >= j ? 1 : 0, r.Call(i, j)); }
}
}
WASM_EXEC_TEST(I32ConvertI64) {
FOR_INT64_INPUTS(i) {
WasmRunner<int32_t> r(execution_tier);
- BUILD(r, WASM_I32_CONVERT_I64(WASM_I64V(*i)));
- CHECK_EQ(static_cast<int32_t>(*i), r.Call());
+ BUILD(r, WASM_I32_CONVERT_I64(WASM_I64V(i)));
+ CHECK_EQ(static_cast<int32_t>(i), r.Call());
}
}
WASM_EXEC_TEST(I64SConvertI32) {
WasmRunner<int64_t, int32_t> r(execution_tier);
BUILD(r, WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(i), r.Call(i)); }
}
WASM_EXEC_TEST(I64UConvertI32) {
WasmRunner<int64_t, uint32_t> r(execution_tier);
BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0)));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(i), r.Call(i)); }
}
WASM_EXEC_TEST(I64Popcnt) {
@@ -536,7 +536,7 @@ WASM_EXEC_TEST(I64Popcnt) {
WASM_EXEC_TEST(F32SConvertI64) {
WasmRunner<float, int64_t> r(execution_tier);
BUILD(r, WASM_F32_SCONVERT_I64(WASM_GET_LOCAL(0)));
- FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(*i), r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_FLOAT_EQ(static_cast<float>(i), r.Call(i)); }
}
WASM_EXEC_TEST(F32UConvertI64) {
@@ -629,7 +629,7 @@ WASM_EXEC_TEST(F32UConvertI64) {
WASM_EXEC_TEST(F64SConvertI64) {
WasmRunner<double, int64_t> r(execution_tier);
BUILD(r, WASM_F64_SCONVERT_I64(WASM_GET_LOCAL(0)));
- FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(*i), r.Call(*i)); }
+ FOR_INT64_INPUTS(i) { CHECK_DOUBLE_EQ(static_cast<double>(i), r.Call(i)); }
}
WASM_EXEC_TEST(F64UConvertI64) {
@@ -723,11 +723,11 @@ WASM_EXEC_TEST(I64SConvertF32) {
BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- if (*i < static_cast<float>(std::numeric_limits<int64_t>::max()) &&
- *i >= static_cast<float>(std::numeric_limits<int64_t>::min())) {
- CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i));
+ if (i < static_cast<float>(std::numeric_limits<int64_t>::max()) &&
+ i >= static_cast<float>(std::numeric_limits<int64_t>::min())) {
+ CHECK_EQ(static_cast<int64_t>(i), r.Call(i));
} else {
- CHECK_TRAP64(r.Call(*i));
+ CHECK_TRAP64(r.Call(i));
}
}
}
@@ -738,17 +738,17 @@ WASM_EXEC_TEST(I64SConvertSatF32) {
BUILD(r, WASM_I64_SCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
int64_t expected;
- if (*i < static_cast<float>(std::numeric_limits<int64_t>::max()) &&
- *i >= static_cast<float>(std::numeric_limits<int64_t>::min())) {
- expected = static_cast<int64_t>(*i);
- } else if (std::isnan(*i)) {
+ if (i < static_cast<float>(std::numeric_limits<int64_t>::max()) &&
+ i >= static_cast<float>(std::numeric_limits<int64_t>::min())) {
+ expected = static_cast<int64_t>(i);
+ } else if (std::isnan(i)) {
expected = static_cast<int64_t>(0);
- } else if (*i < 0.0) {
+ } else if (i < 0.0) {
expected = std::numeric_limits<int64_t>::min();
} else {
expected = std::numeric_limits<int64_t>::max();
}
- int64_t found = r.Call(*i);
+ int64_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -758,11 +758,11 @@ WASM_EXEC_TEST(I64SConvertF64) {
BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- if (*i < static_cast<double>(std::numeric_limits<int64_t>::max()) &&
- *i >= static_cast<double>(std::numeric_limits<int64_t>::min())) {
- CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i));
+ if (i < static_cast<double>(std::numeric_limits<int64_t>::max()) &&
+ i >= static_cast<double>(std::numeric_limits<int64_t>::min())) {
+ CHECK_EQ(static_cast<int64_t>(i), r.Call(i));
} else {
- CHECK_TRAP64(r.Call(*i));
+ CHECK_TRAP64(r.Call(i));
}
}
}
@@ -773,17 +773,17 @@ WASM_EXEC_TEST(I64SConvertSatF64) {
BUILD(r, WASM_I64_SCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int64_t expected;
- if (*i < static_cast<double>(std::numeric_limits<int64_t>::max()) &&
- *i >= static_cast<double>(std::numeric_limits<int64_t>::min())) {
- expected = static_cast<int64_t>(*i);
- } else if (std::isnan(*i)) {
+ if (i < static_cast<double>(std::numeric_limits<int64_t>::max()) &&
+ i >= static_cast<double>(std::numeric_limits<int64_t>::min())) {
+ expected = static_cast<int64_t>(i);
+ } else if (std::isnan(i)) {
expected = static_cast<int64_t>(0);
- } else if (*i < 0.0) {
+ } else if (i < 0.0) {
expected = std::numeric_limits<int64_t>::min();
} else {
expected = std::numeric_limits<int64_t>::max();
}
- int64_t found = r.Call(*i);
+ int64_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -793,11 +793,11 @@ WASM_EXEC_TEST(I64UConvertF32) {
BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
- *i > -1) {
- CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i));
+ if (i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
+ i > -1) {
+ CHECK_EQ(static_cast<uint64_t>(i), r.Call(i));
} else {
- CHECK_TRAP64(r.Call(*i));
+ CHECK_TRAP64(r.Call(i));
}
}
}
@@ -808,17 +808,17 @@ WASM_EXEC_TEST(I64UConvertSatF32) {
BUILD(r, WASM_I64_UCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
uint64_t expected;
- if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
- *i > -1) {
- expected = static_cast<uint64_t>(*i);
- } else if (std::isnan(*i)) {
+ if (i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
+ i > -1) {
+ expected = static_cast<uint64_t>(i);
+ } else if (std::isnan(i)) {
expected = static_cast<uint64_t>(0);
- } else if (*i < 0.0) {
+ } else if (i < 0.0) {
expected = std::numeric_limits<uint64_t>::min();
} else {
expected = std::numeric_limits<uint64_t>::max();
}
- uint64_t found = r.Call(*i);
+ uint64_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -828,11 +828,11 @@ WASM_EXEC_TEST(I64UConvertF64) {
BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
- *i > -1) {
- CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i));
+ if (i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
+ i > -1) {
+ CHECK_EQ(static_cast<uint64_t>(i), r.Call(i));
} else {
- CHECK_TRAP64(r.Call(*i));
+ CHECK_TRAP64(r.Call(i));
}
}
}
@@ -843,17 +843,17 @@ WASM_EXEC_TEST(I64UConvertSatF64) {
BUILD(r, WASM_I64_UCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int64_t expected;
- if (*i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
- *i > -1) {
- expected = static_cast<uint64_t>(*i);
- } else if (std::isnan(*i)) {
+ if (i < static_cast<float>(std::numeric_limits<uint64_t>::max()) &&
+ i > -1) {
+ expected = static_cast<uint64_t>(i);
+ } else if (std::isnan(i)) {
expected = static_cast<uint64_t>(0);
- } else if (*i < 0.0) {
+ } else if (i < 0.0) {
expected = std::numeric_limits<uint64_t>::min();
} else {
expected = std::numeric_limits<uint64_t>::max();
}
- int64_t found = r.Call(*i);
+ int64_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -1115,50 +1115,50 @@ WASM_EXEC_TEST(I64Popcnt2) {
// Test the WasmRunner with an Int64 return value and different numbers of
// Int64 parameters.
WASM_EXEC_TEST(I64WasmRunner) {
- {FOR_INT64_INPUTS(i){WasmRunner<int64_t> r(execution_tier);
- BUILD(r, WASM_I64V(*i));
- CHECK_EQ(*i, r.Call());
-}
-}
-{
- WasmRunner<int64_t, int64_t> r(execution_tier);
- BUILD(r, WASM_GET_LOCAL(0));
- FOR_INT64_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
-}
-{
- WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
- BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) { CHECK_EQ(*i ^ *j, r.Call(*i, *j)); }
+ WasmRunner<int64_t> r(execution_tier);
+ BUILD(r, WASM_I64V(i));
+ CHECK_EQ(i, r.Call());
}
-}
-{
- WasmRunner<int64_t, int64_t, int64_t, int64_t> r(execution_tier);
- BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
- WASM_I64_XOR(WASM_GET_LOCAL(1), WASM_GET_LOCAL(2))));
- FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) {
- CHECK_EQ(*i ^ *j ^ *j, r.Call(*i, *j, *j));
- CHECK_EQ(*j ^ *i ^ *j, r.Call(*j, *i, *j));
- CHECK_EQ(*j ^ *j ^ *i, r.Call(*j, *j, *i));
+ {
+ WasmRunner<int64_t, int64_t> r(execution_tier);
+ BUILD(r, WASM_GET_LOCAL(0));
+ FOR_INT64_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
+ }
+ {
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
+ BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) { CHECK_EQ(i ^ j, r.Call(i, j)); }
}
}
-}
-{
- WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_tier);
- BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
- WASM_I64_XOR(WASM_GET_LOCAL(1),
- WASM_I64_XOR(WASM_GET_LOCAL(2),
- WASM_GET_LOCAL(3)))));
- FOR_INT64_INPUTS(i) {
- FOR_INT64_INPUTS(j) {
- CHECK_EQ(*i ^ *j ^ *j ^ *j, r.Call(*i, *j, *j, *j));
- CHECK_EQ(*j ^ *i ^ *j ^ *j, r.Call(*j, *i, *j, *j));
- CHECK_EQ(*j ^ *j ^ *i ^ *j, r.Call(*j, *j, *i, *j));
- CHECK_EQ(*j ^ *j ^ *j ^ *i, r.Call(*j, *j, *j, *i));
+ {
+ WasmRunner<int64_t, int64_t, int64_t, int64_t> r(execution_tier);
+ BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
+ WASM_I64_XOR(WASM_GET_LOCAL(1), WASM_GET_LOCAL(2))));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ CHECK_EQ(i ^ j ^ j, r.Call(i, j, j));
+ CHECK_EQ(j ^ i ^ j, r.Call(j, i, j));
+ CHECK_EQ(j ^ j ^ i, r.Call(j, j, i));
+ }
+ }
+ }
+ {
+ WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_tier);
+ BUILD(r, WASM_I64_XOR(WASM_GET_LOCAL(0),
+ WASM_I64_XOR(WASM_GET_LOCAL(1),
+ WASM_I64_XOR(WASM_GET_LOCAL(2),
+ WASM_GET_LOCAL(3)))));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ CHECK_EQ(i ^ j ^ j ^ j, r.Call(i, j, j, j));
+ CHECK_EQ(j ^ i ^ j ^ j, r.Call(j, i, j, j));
+ CHECK_EQ(j ^ j ^ i ^ j, r.Call(j, j, i, j));
+ CHECK_EQ(j ^ j ^ j ^ i, r.Call(j, j, j, i));
+ }
}
}
-}
}
WASM_EXEC_TEST(Call_Int64Sub) {
@@ -1172,16 +1172,9 @@ WASM_EXEC_TEST(Call_Int64Sub) {
BUILD(r, WASM_CALL_FUNCTION(t.function_index(), WASM_GET_LOCAL(0),
WASM_GET_LOCAL(1)));
- FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) {
- int64_t a = static_cast<int64_t>(*i) << 32 |
- (static_cast<int64_t>(*j) | 0xFFFFFFFF);
- int64_t b = static_cast<int64_t>(*j) << 32 |
- (static_cast<int64_t>(*i) | 0xFFFFFFFF);
-
- int64_t expected = static_cast<int64_t>(static_cast<uint64_t>(a) -
- static_cast<uint64_t>(b));
- CHECK_EQ(expected, r.Call(a, b));
+ FOR_INT64_INPUTS(i) {
+ FOR_INT64_INPUTS(j) {
+ CHECK_EQ(base::SubWithWraparound(i, j), r.Call(i, j));
}
}
}
@@ -1217,7 +1210,8 @@ WASM_EXEC_TEST(LoadStoreI64_sx) {
r.builder().BlankMemory();
memory[size - 1] = static_cast<byte>(i); // set the high order byte.
- int64_t expected = static_cast<int64_t>(i) << ((size - 1) * 8);
+ int64_t expected = static_cast<uint64_t>(static_cast<int64_t>(i))
+ << ((size - 1) * 8);
CHECK_EQ(expected, r.Call());
CHECK_EQ(static_cast<byte>(i), memory[8 + size - 1]);
@@ -1238,8 +1232,8 @@ WASM_EXEC_TEST(I64ReinterpretF64) {
WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)));
FOR_INT32_INPUTS(i) {
- int64_t expected = base::MulWithWraparound(static_cast<int64_t>(*i),
- int64_t{0x300010001L});
+ int64_t expected =
+ base::MulWithWraparound(static_cast<int64_t>(i), int64_t{0x300010001L});
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -1264,8 +1258,8 @@ WASM_EXEC_TEST(F64ReinterpretI64) {
WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) {
- int64_t expected = base::MulWithWraparound(static_cast<int64_t>(*i),
- int64_t{0x300010001L});
+ int64_t expected =
+ base::MulWithWraparound(static_cast<int64_t>(i), int64_t{0x300010001L});
CHECK_EQ(expected, r.Call(expected));
CHECK_EQ(expected, r.builder().ReadMemory<int64_t>(&memory[0]));
}
@@ -1380,8 +1374,8 @@ WASM_EXEC_TEST(I64Eqz) {
BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0)));
FOR_INT64_INPUTS(i) {
- int32_t result = *i == 0 ? 1 : 0;
- CHECK_EQ(result, r.Call(*i));
+ int32_t result = i == 0 ? 1 : 0;
+ CHECK_EQ(result, r.Call(i));
}
}
@@ -1391,8 +1385,8 @@ WASM_EXEC_TEST(I64Ror) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- int64_t expected = base::bits::RotateRight64(*i, *j & 0x3F);
- CHECK_EQ(expected, r.Call(*i, *j));
+ int64_t expected = base::bits::RotateRight64(i, j & 0x3F);
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -1403,8 +1397,8 @@ WASM_EXEC_TEST(I64Rol) {
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
- int64_t expected = base::bits::RotateLeft64(*i, *j & 0x3F);
- CHECK_EQ(expected, r.Call(*i, *j));
+ int64_t expected = base::bits::RotateLeft64(i, j & 0x3F);
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc b/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc
index fc9e395d44..ea45762a7c 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc
@@ -73,8 +73,8 @@ WASM_EXEC_TEST(I32AsmjsSConvertF32) {
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- int32_t expected = DoubleToInt32(*i);
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = DoubleToInt32(i);
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -84,8 +84,8 @@ WASM_EXEC_TEST(I32AsmjsSConvertF64) {
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- int32_t expected = DoubleToInt32(*i);
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = DoubleToInt32(i);
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -95,8 +95,8 @@ WASM_EXEC_TEST(I32AsmjsUConvertF32) {
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- uint32_t expected = DoubleToUint32(*i);
- CHECK_EQ(expected, r.Call(*i));
+ uint32_t expected = DoubleToUint32(i);
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -106,8 +106,8 @@ WASM_EXEC_TEST(I32AsmjsUConvertF64) {
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- uint32_t expected = DoubleToUint32(*i);
- CHECK_EQ(expected, r.Call(*i));
+ uint32_t expected = DoubleToUint32(i);
+ CHECK_EQ(expected, r.Call(i));
}
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc b/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc
index 8eddaa0224..7895b192f8 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc
@@ -22,11 +22,11 @@ void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t initial = *i;
+ uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint32_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint32_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -51,11 +51,11 @@ void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op,
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t initial = *i;
+ uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint16_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint16_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -79,11 +79,11 @@ void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t initial = *i;
+ uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint8_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint8_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -107,11 +107,11 @@ WASM_EXEC_TEST(I32AtomicCompareExchange) {
WASM_GET_LOCAL(1), MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t initial = *i;
+ uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint32_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint32_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -129,11 +129,11 @@ WASM_EXEC_TEST(I32AtomicCompareExchange16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t initial = *i;
+ uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint16_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint16_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -150,16 +150,38 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t initial = *i;
+ uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint8_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint8_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
}
+WASM_EXEC_TEST(I32AtomicCompareExchange_fail) {
+ EXPERIMENTAL_FLAG_SCOPE(threads);
+ WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
+ r.builder().SetHasSharedMemory();
+ uint32_t* memory =
+ r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
+ BUILD(r, WASM_ATOMICS_TERNARY_OP(
+ kExprI32AtomicCompareExchange, WASM_I32V_1(0), WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(1), MachineRepresentation::kWord32));
+
+ // The original value at the memory location.
+ uint32_t old_val = 4;
+ // The value we use as the expected value for the compare-exchange so that it
+ // fails.
+ uint32_t expected = 6;
+ // The new value for the compare-exchange.
+ uint32_t new_val = 5;
+
+ r.builder().WriteMemory(&memory[0], old_val);
+ CHECK_EQ(old_val, r.Call(expected, new_val));
+}
+
WASM_EXEC_TEST(I32AtomicLoad) {
EXPERIMENTAL_FLAG_SCOPE(threads);
WasmRunner<uint32_t> r(execution_tier);
@@ -170,7 +192,7 @@ WASM_EXEC_TEST(I32AtomicLoad) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = *i;
+ uint32_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -186,7 +208,7 @@ WASM_EXEC_TEST(I32AtomicLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t expected = *i;
+ uint16_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -201,7 +223,7 @@ WASM_EXEC_TEST(I32AtomicLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t expected = *i;
+ uint8_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -221,8 +243,8 @@ WASM_EXEC_TEST(I32AtomicStoreLoad) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
+ uint32_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -242,8 +264,8 @@ WASM_EXEC_TEST(I32AtomicStoreLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
+ uint16_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -261,9 +283,9 @@ WASM_EXEC_TEST(I32AtomicStoreLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
- CHECK_EQ(*i, r.builder().ReadMemory(&memory[0]));
+ uint8_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
+ CHECK_EQ(i, r.builder().ReadMemory(&memory[0]));
}
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc b/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc
index 624982a117..bbeafc9151 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc
@@ -22,11 +22,11 @@ void RunU64BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
- uint64_t initial = *i;
+ uint64_t initial = i;
FOR_UINT64_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint64_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint64_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -51,11 +51,11 @@ void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t initial = *i;
+ uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint32_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint32_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -80,11 +80,11 @@ void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op,
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t initial = *i;
+ uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint16_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint16_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -108,11 +108,11 @@ void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t initial = *i;
+ uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*j));
- uint8_t expected = expected_op(*i, *j);
+ CHECK_EQ(initial, r.Call(j));
+ uint8_t expected = expected_op(i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -136,11 +136,11 @@ WASM_EXEC_TEST(I64AtomicCompareExchange) {
WASM_GET_LOCAL(1), MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
- uint64_t initial = *i;
+ uint64_t initial = i;
FOR_UINT64_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint64_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint64_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -158,11 +158,11 @@ WASM_EXEC_TEST(I64AtomicCompareExchange32U) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t initial = *i;
+ uint32_t initial = i;
FOR_UINT32_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint32_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint32_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -180,11 +180,11 @@ WASM_EXEC_TEST(I64AtomicCompareExchange16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t initial = *i;
+ uint16_t initial = i;
FOR_UINT16_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint16_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint16_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -200,11 +200,11 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t initial = *i;
+ uint8_t initial = i;
FOR_UINT8_INPUTS(j) {
r.builder().WriteMemory(&memory[0], initial);
- CHECK_EQ(initial, r.Call(*i, *j));
- uint8_t expected = CompareExchange(initial, *i, *j);
+ CHECK_EQ(initial, r.Call(i, j));
+ uint8_t expected = CompareExchange(initial, i, j);
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -220,7 +220,7 @@ WASM_EXEC_TEST(I64AtomicLoad) {
MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
- uint64_t expected = *i;
+ uint64_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -236,7 +236,7 @@ WASM_EXEC_TEST(I64AtomicLoad32U) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = *i;
+ uint32_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -252,7 +252,7 @@ WASM_EXEC_TEST(I64AtomicLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t expected = *i;
+ uint16_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -267,7 +267,7 @@ WASM_EXEC_TEST(I64AtomicLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t expected = *i;
+ uint8_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -287,8 +287,8 @@ WASM_EXEC_TEST(I64AtomicStoreLoad) {
MachineRepresentation::kWord64));
FOR_UINT64_INPUTS(i) {
- uint64_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
+ uint64_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -308,8 +308,8 @@ WASM_EXEC_TEST(I64AtomicStoreLoad32U) {
MachineRepresentation::kWord32));
FOR_UINT32_INPUTS(i) {
- uint32_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
+ uint32_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -329,8 +329,8 @@ WASM_EXEC_TEST(I64AtomicStoreLoad16U) {
MachineRepresentation::kWord16));
FOR_UINT16_INPUTS(i) {
- uint16_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
+ uint16_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
}
@@ -348,9 +348,9 @@ WASM_EXEC_TEST(I64AtomicStoreLoad8U) {
MachineRepresentation::kWord8));
FOR_UINT8_INPUTS(i) {
- uint8_t expected = *i;
- CHECK_EQ(expected, r.Call(*i));
- CHECK_EQ(*i, r.builder().ReadMemory(&memory[0]));
+ uint8_t expected = i;
+ CHECK_EQ(expected, r.Call(i));
+ CHECK_EQ(i, r.builder().ReadMemory(&memory[0]));
}
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc b/deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc
new file mode 100644
index 0000000000..eefaa678d1
--- /dev/null
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-exceptions.cc
@@ -0,0 +1,220 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/api-inl.h"
+#include "test/cctest/wasm/wasm-atomics-utils.h"
+#include "test/common/wasm/test-signatures.h"
+#include "test/common/wasm/wasm-macro-gen.h"
+
+namespace v8 {
+namespace internal {
+namespace wasm {
+namespace test_run_wasm_exceptions {
+
+WASM_EXEC_TEST(TryCatchThrow) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
+ uint32_t except = r.builder().AddException(sigs.v_v());
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(kWasmI32,
+ WASM_STMTS(WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_THROW(except))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+WASM_EXEC_TEST(TryCatchCallDirect) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
+ uint32_t except = r.builder().AddException(sigs.v_v());
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+
+ // Build a throwing helper function.
+ WasmFunctionCompiler& throw_func = r.NewFunction(sigs.i_ii());
+ BUILD(throw_func, WASM_THROW(except));
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(
+ kWasmI32,
+ WASM_STMTS(WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_STMTS(WASM_CALL_FUNCTION(
+ throw_func.function_index(),
+ WASM_I32V(7), WASM_I32V(9)),
+ WASM_DROP))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+WASM_EXEC_TEST(TryCatchCallIndirect) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
+ uint32_t except = r.builder().AddException(sigs.v_v());
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+
+ // Build a throwing helper function.
+ WasmFunctionCompiler& throw_func = r.NewFunction(sigs.i_ii());
+ BUILD(throw_func, WASM_THROW(except));
+ r.builder().AddSignature(sigs.i_ii());
+ throw_func.SetSigIndex(0);
+
+ // Add an indirect function table.
+ uint16_t indirect_function_table[] = {
+ static_cast<uint16_t>(throw_func.function_index())};
+ r.builder().AddIndirectFunctionTable(indirect_function_table,
+ arraysize(indirect_function_table));
+ r.builder().PopulateIndirectFunctionTable();
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(
+ kWasmI32,
+ WASM_STMTS(WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_STMTS(WASM_CALL_INDIRECT2(
+ 0, WASM_GET_LOCAL(0),
+ WASM_I32V(7), WASM_I32V(9)),
+ WASM_DROP))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+WASM_EXEC_TEST(TryCatchCallExternal) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ HandleScope scope(CcTest::InitIsolateOnce());
+ const char* source = "(function() { throw 'ball'; })";
+ Handle<JSFunction> js_function =
+ Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(source))));
+ ManuallyImportedJSFunction import = {sigs.i_ii(), js_function};
+ WasmRunner<uint32_t, uint32_t> r(execution_tier, &import);
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+ constexpr uint32_t kJSFunc = 0;
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(
+ kWasmI32,
+ WASM_STMTS(
+ WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_STMTS(WASM_CALL_FUNCTION(kJSFunc, WASM_I32V(7),
+ WASM_I32V(9)),
+ WASM_DROP))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+WASM_EXEC_TEST(TryCatchTrapTypeError) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ HandleScope scope(CcTest::InitIsolateOnce());
+ const char* source = "(function() { return 0; })";
+ Handle<JSFunction> js_function =
+ Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(source))));
+ // Make sure to use a signature incompatible with JS below.
+ ManuallyImportedJSFunction import = {sigs.i_ll(), js_function};
+ WasmRunner<uint32_t, uint32_t> r(execution_tier, &import);
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+ constexpr uint32_t kJSFunc = 0;
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(
+ kWasmI32,
+ WASM_STMTS(
+ WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_STMTS(WASM_CALL_FUNCTION(kJSFunc, WASM_I64V(7),
+ WASM_I64V(9)),
+ WASM_DROP))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+namespace {
+
+// TODO(8729): The semantics of this are not yet specified and might change,
+// this test aims at keeping semantics of various execution tiers consistent.
+void TestTryCatchTrap(byte* code, size_t code_size,
+ ExecutionTier execution_tier) {
+ TestSignatures sigs;
+ EXPERIMENTAL_FLAG_SCOPE(eh);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier, nullptr, "main",
+ kRuntimeExceptionSupport);
+ r.builder().AddMemory(kWasmPageSize);
+ constexpr uint32_t kResult0 = 23;
+ constexpr uint32_t kResult1 = 42;
+
+ // Build a trapping helper function.
+ WasmFunctionCompiler& trap_func = r.NewFunction(sigs.i_ii());
+ trap_func.Build(code, code + code_size);
+
+ // Build the main test function.
+ BUILD(r, WASM_TRY_CATCH_T(
+ kWasmI32,
+ WASM_STMTS(WASM_I32V(kResult1),
+ WASM_IF(WASM_I32_EQZ(WASM_GET_LOCAL(0)),
+ WASM_STMTS(WASM_CALL_FUNCTION(
+ trap_func.function_index(),
+ WASM_I32V(7), WASM_I32V(9)),
+ WASM_DROP))),
+ WASM_STMTS(WASM_DROP, WASM_I32V(kResult0))));
+
+ // Need to call through JS to allow for creation of stack traces.
+ r.CheckCallViaJS(kResult0, 0);
+ r.CheckCallViaJS(kResult1, 1);
+}
+
+} // namespace
+
+WASM_EXEC_TEST(TryCatchTrapUnreachable) {
+ byte code[] = {WASM_UNREACHABLE};
+ TestTryCatchTrap(code, arraysize(code), execution_tier);
+}
+
+WASM_EXEC_TEST(TryCatchTrapMemOutOfBounds) {
+ byte code[] = {WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V_1(-1))};
+ TestTryCatchTrap(code, arraysize(code), execution_tier);
+}
+
+WASM_EXEC_TEST(TryCatchTrapDivByZero) {
+ byte code[] = {WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(0))};
+ TestTryCatchTrap(code, arraysize(code), execution_tier);
+}
+
+WASM_EXEC_TEST(TryCatchTrapRemByZero) {
+ byte code[] = {WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(0))};
+ TestTryCatchTrap(code, arraysize(code), execution_tier);
+}
+
+} // namespace test_run_wasm_exceptions
+} // namespace wasm
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc
index c5d0d84e63..1a8c15be31 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc
@@ -143,6 +143,109 @@ TEST(Run_Wasm_nested_ifs_i) {
CHECK_EQ(14, r.Call(0, 0));
}
+// Repeated from test-run-wasm.cc to avoid poluting header files.
+template <typename T>
+static T factorial(T v) {
+ T expected = 1;
+ for (T i = v; i > 1; i--) {
+ expected *= i;
+ }
+ return expected;
+}
+
+// Basic test of return call in interpreter. Good old factorial.
+TEST(Run_Wasm_returnCallFactorial) {
+ EXPERIMENTAL_FLAG_SCOPE(return_call);
+ // Run in bounded amount of stack - 8kb.
+ FlagScope<int32_t> stack_size(&v8::internal::FLAG_stack_size, 8);
+
+ WasmRunner<uint32_t, int32_t> r(ExecutionTier::kInterpreter);
+
+ WasmFunctionCompiler& fact_aux_fn =
+ r.NewFunction<int32_t, int32_t, int32_t>("fact_aux");
+
+ BUILD(r, WASM_RETURN_CALL_FUNCTION(fact_aux_fn.function_index(),
+ WASM_GET_LOCAL(0), WASM_I32V(1)));
+
+ BUILD(fact_aux_fn,
+ WASM_IF_ELSE_I(
+ WASM_I32_EQ(WASM_I32V(1), WASM_GET_LOCAL(0)), WASM_GET_LOCAL(1),
+ WASM_RETURN_CALL_FUNCTION(
+ fact_aux_fn.function_index(),
+ WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V(1)),
+ WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))));
+
+ // Runs out of stack space without using return call.
+ uint32_t test_values[] = {1, 2, 5, 10, 20, 20000};
+
+ for (uint32_t v : test_values) {
+ uint32_t found = r.Call(v);
+ CHECK_EQ(factorial(v), found);
+ }
+}
+
+TEST(Run_Wasm_returnCallFactorial64) {
+ EXPERIMENTAL_FLAG_SCOPE(return_call);
+
+ int32_t test_values[] = {1, 2, 5, 10, 20};
+ WasmRunner<int64_t, int32_t> r(ExecutionTier::kInterpreter);
+
+ WasmFunctionCompiler& fact_aux_fn =
+ r.NewFunction<int64_t, int32_t, int64_t>("fact_aux");
+
+ BUILD(r, WASM_RETURN_CALL_FUNCTION(fact_aux_fn.function_index(),
+ WASM_GET_LOCAL(0), WASM_I64V(1)));
+
+ BUILD(fact_aux_fn,
+ WASM_IF_ELSE_L(
+ WASM_I32_EQ(WASM_I32V(1), WASM_GET_LOCAL(0)), WASM_GET_LOCAL(1),
+ WASM_RETURN_CALL_FUNCTION(
+ fact_aux_fn.function_index(),
+ WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V(1)),
+ WASM_I64_MUL(WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)),
+ WASM_GET_LOCAL(1)))));
+
+ for (int32_t v : test_values) {
+ CHECK_EQ(factorial<int64_t>(v), r.Call(v));
+ }
+}
+
+TEST(Run_Wasm_returnCallIndirectFactorial) {
+ EXPERIMENTAL_FLAG_SCOPE(return_call);
+
+ TestSignatures sigs;
+
+ WasmRunner<uint32_t, uint32_t> r(ExecutionTier::kInterpreter);
+
+ WasmFunctionCompiler& fact_aux_fn = r.NewFunction(sigs.i_ii(), "fact_aux");
+ fact_aux_fn.SetSigIndex(0);
+
+ r.builder().AddSignature(sigs.i_ii());
+
+ // Function table.
+ uint16_t indirect_function_table[] = {
+ static_cast<uint16_t>(fact_aux_fn.function_index())};
+
+ r.builder().AddIndirectFunctionTable(indirect_function_table,
+ arraysize(indirect_function_table));
+ r.builder().PopulateIndirectFunctionTable();
+
+ BUILD(r, WASM_RETURN_CALL_INDIRECT(0, WASM_I32V(0), WASM_GET_LOCAL(0),
+ WASM_I32V(1)));
+
+ BUILD(fact_aux_fn,
+ WASM_IF_ELSE_I(
+ WASM_I32_EQ(WASM_I32V(1), WASM_GET_LOCAL(0)), WASM_GET_LOCAL(1),
+ WASM_RETURN_CALL_INDIRECT(
+ 0, WASM_I32V(0), WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V(1)),
+ WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))));
+
+ uint32_t test_values[] = {1, 2, 5, 10, 20};
+
+ for (uint32_t v : test_values) {
+ CHECK_EQ(factorial(v), r.Call(v));
+ }
+}
// Make tests more robust by not hard-coding offsets of various operations.
// The {Find} method finds the offsets for the given bytecodes, returning
// the offsets in an array.
@@ -192,7 +295,7 @@ TEST(Breakpoint_I32Add) {
FOR_UINT32_INPUTS(a) {
for (uint32_t b = 11; b < 3000000000u; b += 1000000000u) {
thread->Reset();
- WasmValue args[] = {WasmValue(*a), WasmValue(b)};
+ WasmValue args[] = {WasmValue(a), WasmValue(b)};
thread->InitFrame(r.function(), args);
for (int i = 0; i < kNumBreakpoints; i++) {
@@ -207,7 +310,7 @@ TEST(Breakpoint_I32Add) {
// Check the thread finished with the right value.
CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
- uint32_t expected = (*a) + (b);
+ uint32_t expected = (a) + (b);
CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
@@ -227,7 +330,7 @@ TEST(Step_I32Mul) {
FOR_UINT32_INPUTS(a) {
for (uint32_t b = 33; b < 3000000000u; b += 1000000000u) {
thread->Reset();
- WasmValue args[] = {WasmValue(*a), WasmValue(b)};
+ WasmValue args[] = {WasmValue(a), WasmValue(b)};
thread->InitFrame(r.function(), args);
// Run instructions one by one.
@@ -242,7 +345,7 @@ TEST(Step_I32Mul) {
// Check the thread finished with the right value.
CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
- uint32_t expected = (*a) * (b);
+ uint32_t expected = (a) * (b);
CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
@@ -269,7 +372,7 @@ TEST(Breakpoint_I32And_disable) {
interpreter->SetBreakpoint(r.function(), kLocalsDeclSize + offsets[0],
do_break);
thread->Reset();
- WasmValue args[] = {WasmValue(*a), WasmValue(b)};
+ WasmValue args[] = {WasmValue(a), WasmValue(b)};
thread->InitFrame(r.function(), args);
if (do_break) {
@@ -284,7 +387,7 @@ TEST(Breakpoint_I32And_disable) {
// Check the thread finished with the right value.
CHECK_EQ(WasmInterpreter::FINISHED, thread->state());
- uint32_t expected = (*a) & (b);
+ uint32_t expected = (a) & (b);
CHECK_EQ(expected, thread->GetReturnValue().to<uint32_t>());
}
}
@@ -438,7 +541,7 @@ TEST(TestPossibleNondeterminism) {
TEST(WasmInterpreterActivations) {
WasmRunner<void> r(ExecutionTier::kInterpreter);
Isolate* isolate = r.main_isolate();
- BUILD(r, WASM_NOP);
+ BUILD(r, WASM_UNREACHABLE);
WasmInterpreter* interpreter = r.interpreter();
WasmInterpreter::Thread* thread = interpreter->GetThread(0);
@@ -451,17 +554,20 @@ TEST(WasmInterpreterActivations) {
thread->InitFrame(r.function(), nullptr);
CHECK_EQ(2, thread->NumActivations());
CHECK_EQ(2, thread->GetFrameCount());
- isolate->set_pending_exception(Smi::kZero);
- thread->HandleException(isolate);
+ CHECK_EQ(WasmInterpreter::TRAPPED, thread->Run());
+ thread->RaiseException(isolate, handle(Smi::kZero, isolate));
CHECK_EQ(1, thread->GetFrameCount());
CHECK_EQ(2, thread->NumActivations());
thread->FinishActivation(act1);
+ isolate->clear_pending_exception();
CHECK_EQ(1, thread->GetFrameCount());
CHECK_EQ(1, thread->NumActivations());
- thread->HandleException(isolate);
+ CHECK_EQ(WasmInterpreter::TRAPPED, thread->Run());
+ thread->RaiseException(isolate, handle(Smi::kZero, isolate));
CHECK_EQ(0, thread->GetFrameCount());
CHECK_EQ(1, thread->NumActivations());
thread->FinishActivation(act0);
+ isolate->clear_pending_exception();
CHECK_EQ(0, thread->NumActivations());
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-js.cc b/deps/v8/test/cctest/wasm/test-run-wasm-js.cc
index 499942464e..47ed644673 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-js.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-js.cc
@@ -69,68 +69,39 @@ ManuallyImportedJSFunction CreateJSSelector(FunctionSig* sig, int which) {
return import;
}
-
-void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc,
- Handle<Object>* buffer, int count) {
- Isolate* isolate = jsfunc->GetIsolate();
- Handle<Object> global(isolate->context()->global_object(), isolate);
- MaybeHandle<Object> retval =
- Execution::Call(isolate, jsfunc, global, count, buffer);
-
- CHECK(!retval.is_null());
- Handle<Object> result = retval.ToHandleChecked();
- if (result->IsSmi()) {
- CHECK_EQ(expected, Smi::ToInt(*result));
- } else {
- CHECK(result->IsHeapNumber());
- CHECK_FLOAT_EQ(expected, HeapNumber::cast(*result)->value());
- }
-}
-
-void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, double a,
- double b) {
- Isolate* isolate = jsfunc->GetIsolate();
- Handle<Object> buffer[] = {isolate->factory()->NewNumber(a),
- isolate->factory()->NewNumber(b)};
- EXPECT_CALL(expected, jsfunc, buffer, 2);
-}
} // namespace
WASM_EXEC_TEST(Run_Int32Sub_jswrapped) {
WasmRunner<int, int, int> r(execution_tier);
BUILD(r, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
- EXPECT_CALL(33, jsfunc, 44, 11);
- EXPECT_CALL(-8723487, jsfunc, -8000000, 723487);
+ r.CheckCallViaJS(33, 44, 11);
+ r.CheckCallViaJS(-8723487, -8000000, 723487);
}
WASM_EXEC_TEST(Run_Float32Div_jswrapped) {
WasmRunner<float, float, float> r(execution_tier);
BUILD(r, WASM_F32_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
- EXPECT_CALL(92, jsfunc, 46, 0.5);
- EXPECT_CALL(64, jsfunc, -16, -0.25);
+ r.CheckCallViaJS(92, 46, 0.5);
+ r.CheckCallViaJS(64, -16, -0.25);
}
WASM_EXEC_TEST(Run_Float64Add_jswrapped) {
WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
- EXPECT_CALL(3, jsfunc, 2, 1);
- EXPECT_CALL(-5.5, jsfunc, -5.25, -0.25);
+ r.CheckCallViaJS(3, 2, 1);
+ r.CheckCallViaJS(-5.5, -5.25, -0.25);
}
WASM_EXEC_TEST(Run_I32Popcount_jswrapped) {
WasmRunner<int, int> r(execution_tier);
BUILD(r, WASM_I32_POPCNT(WASM_GET_LOCAL(0)));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(r.function()->func_index);
- EXPECT_CALL(2, jsfunc, 9, 0);
- EXPECT_CALL(3, jsfunc, 11, 0);
- EXPECT_CALL(6, jsfunc, 0x3F, 0);
+ r.CheckCallViaJS(2, 9);
+ r.CheckCallViaJS(3, 11);
+ r.CheckCallViaJS(6, 0x3F);
}
WASM_EXEC_TEST(Run_CallJS_Add_jswrapped) {
@@ -143,15 +114,48 @@ WASM_EXEC_TEST(Run_CallJS_Add_jswrapped) {
ManuallyImportedJSFunction import = {sigs.i_i(), js_function};
WasmRunner<int, int> r(execution_tier, &import);
uint32_t js_index = 0;
+ BUILD(r, WASM_CALL_FUNCTION(js_index, WASM_GET_LOCAL(0)));
- WasmFunctionCompiler& t = r.NewFunction(sigs.i_i());
- BUILD(t, WASM_CALL_FUNCTION(js_index, WASM_GET_LOCAL(0)));
+ r.CheckCallViaJS(101, 2);
+ r.CheckCallViaJS(199, 100);
+ r.CheckCallViaJS(-666666801, -666666900);
+}
- Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
+WASM_EXEC_TEST(Run_IndirectCallJSFunction) {
+ Isolate* isolate = CcTest::InitIsolateOnce();
+ HandleScope scope(isolate);
+ TestSignatures sigs;
- EXPECT_CALL(101, jsfunc, 2, -8);
- EXPECT_CALL(199, jsfunc, 100, -1);
- EXPECT_CALL(-666666801, jsfunc, -666666900, -1);
+ const char* source = "(function(a, b, c) { if(c) return a; return b; })";
+ Handle<JSFunction> js_function =
+ Handle<JSFunction>::cast(v8::Utils::OpenHandle(
+ *v8::Local<v8::Function>::Cast(CompileRun(source))));
+
+ ManuallyImportedJSFunction import = {sigs.i_iii(), js_function};
+
+ WasmRunner<int32_t, int32_t> r(execution_tier, &import);
+
+ const uint32_t js_index = 0;
+ const int32_t left = -2;
+ const int32_t right = 3;
+
+ WasmFunctionCompiler& rc_fn = r.NewFunction(sigs.i_i(), "rc");
+
+ r.builder().AddSignature(sigs.i_iii());
+ uint16_t indirect_function_table[] = {static_cast<uint16_t>(js_index)};
+
+ r.builder().AddIndirectFunctionTable(indirect_function_table,
+ arraysize(indirect_function_table));
+ r.builder().PopulateIndirectFunctionTable();
+
+ BUILD(rc_fn, WASM_CALL_INDIRECT3(0, WASM_I32V(js_index), WASM_I32V(left),
+ WASM_I32V(right), WASM_GET_LOCAL(0)));
+
+ Handle<Object> args_left[] = {isolate->factory()->NewNumber(1)};
+ r.CheckCallViaJS(left, rc_fn.function_index(), args_left, 1);
+
+ Handle<Object> args_right[] = {isolate->factory()->NewNumber(0)};
+ r.CheckCallViaJS(right, rc_fn.function_index(), args_right, 1);
}
void RunJSSelectTest(ExecutionTier tier, int which) {
@@ -184,9 +188,8 @@ void RunJSSelectTest(ExecutionTier tier, int which) {
t.Build(&code[0], &code[end]);
}
- Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
double expected = inputs.arg_d(which);
- EXPECT_CALL(expected, jsfunc, 0.0, 0.0);
+ r.CheckCallViaJS(expected, t.function_index(), nullptr, 0);
}
}
@@ -243,7 +246,6 @@ void RunWASMSelectTest(ExecutionTier tier, int which) {
WasmRunner<void> r(tier);
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(which));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
Handle<Object> args[] = {
isolate->factory()->NewNumber(inputs.arg_d(0)),
@@ -257,7 +259,7 @@ void RunWASMSelectTest(ExecutionTier tier, int which) {
};
double expected = inputs.arg_d(which);
- EXPECT_CALL(expected, jsfunc, args, kMaxParams);
+ r.CheckCallViaJS(expected, t.function_index(), args, kMaxParams);
}
}
@@ -315,7 +317,6 @@ void RunWASMSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
WasmRunner<void> r(tier);
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(which));
- Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
Handle<Object> args[] = {isolate->factory()->NewNumber(inputs.arg_d(0)),
isolate->factory()->NewNumber(inputs.arg_d(1)),
@@ -330,7 +331,7 @@ void RunWASMSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
double nan = std::numeric_limits<double>::quiet_NaN();
double expected = which < num_args ? inputs.arg_d(which) : nan;
- EXPECT_CALL(expected, jsfunc, args, num_args);
+ r.CheckCallViaJS(expected, t.function_index(), args, num_args);
}
}
@@ -430,8 +431,6 @@ void RunJSSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
WasmFunctionCompiler& t = r.NewFunction(&sig);
t.Build(&code[0], &code[end]);
- Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
-
Handle<Object> args[] = {
factory->NewNumber(inputs.arg_d(0)),
factory->NewNumber(inputs.arg_d(1)),
@@ -447,7 +446,7 @@ void RunJSSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
double nan = std::numeric_limits<double>::quiet_NaN();
double expected = which < num_args ? inputs.arg_d(which) : nan;
- EXPECT_CALL(expected, jsfunc, args, num_args);
+ r.CheckCallViaJS(expected, t.function_index(), args, num_args);
}
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc
index 2503ec57fd..d23bdc133f 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc
@@ -854,8 +854,7 @@ TEST(Run_WasmModule_Reclaim_Memory) {
Handle<JSArrayBuffer> buffer;
for (int i = 0; i < 256; ++i) {
HandleScope scope(isolate);
- CHECK(NewArrayBuffer(isolate, kWasmPageSize, SharedFlag::kNotShared)
- .ToHandle(&buffer));
+ CHECK(NewArrayBuffer(isolate, kWasmPageSize).ToHandle(&buffer));
}
}
#endif
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc
index ed8bdf7281..fa27e983af 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc
@@ -158,7 +158,8 @@ int UnsignedGreaterEqual(T a, T b) {
template <typename T>
T LogicalShiftLeft(T a, int shift) {
- return a << shift;
+ using UnsignedT = typename std::make_unsigned<T>::type;
+ return static_cast<UnsignedT>(a) << shift;
}
template <typename T>
@@ -407,8 +408,8 @@ WASM_SIMD_TEST(F32x4Splat) {
WASM_SIMD_CHECK_SPLAT_F32x4(simd, lane_val), WASM_RETURN1(WASM_ONE));
FOR_FLOAT32_INPUTS(i) {
- if (SkipFPExpectedValue(*i)) continue;
- CHECK_EQ(1, r.Call(*i));
+ if (SkipFPExpectedValue(i)) continue;
+ CHECK_EQ(1, r.Call(i));
}
}
@@ -485,8 +486,8 @@ WASM_SIMD_COMPILED_TEST(F32x4ConvertI32x4) {
WASM_RETURN1(WASM_ONE));
FOR_INT32_INPUTS(i) {
- CHECK_EQ(1, r.Call(*i, static_cast<float>(*i),
- static_cast<float>(static_cast<uint32_t>(*i))));
+ CHECK_EQ(1, r.Call(i, static_cast<float>(i),
+ static_cast<float>(static_cast<uint32_t>(i))));
}
}
@@ -504,11 +505,11 @@ void RunF32x4UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_RETURN1(WASM_ONE));
FOR_FLOAT32_INPUTS(i) {
- if (SkipFPValue(*i)) continue;
- float expected = expected_op(*i);
+ if (SkipFPValue(i)) continue;
+ float expected = expected_op(i);
if (SkipFPExpectedValue(expected)) continue;
float abs_error = std::abs(expected) * error;
- CHECK_EQ(1, r.Call(*i, expected - abs_error, expected + abs_error));
+ CHECK_EQ(1, r.Call(i, expected - abs_error, expected + abs_error));
}
}
@@ -546,12 +547,12 @@ void RunF32x4BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT_F32x4(simd1, expected), WASM_RETURN1(WASM_ONE));
FOR_FLOAT32_INPUTS(i) {
- if (SkipFPValue(*i)) continue;
+ if (SkipFPValue(i)) continue;
FOR_FLOAT32_INPUTS(j) {
- if (SkipFPValue(*j)) continue;
- float expected = expected_op(*i, *j);
+ if (SkipFPValue(j)) continue;
+ float expected = expected_op(i, j);
if (SkipFPExpectedValue(expected)) continue;
- CHECK_EQ(1, r.Call(*i, *j, expected));
+ CHECK_EQ(1, r.Call(i, j, expected));
}
}
}
@@ -587,12 +588,12 @@ void RunF32x4CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE);
FOR_FLOAT32_INPUTS(i) {
- if (SkipFPValue(*i)) continue;
+ if (SkipFPValue(i)) continue;
FOR_FLOAT32_INPUTS(j) {
- if (SkipFPValue(*j)) continue;
- float diff = *i - *j;
+ if (SkipFPValue(j)) continue;
+ float diff = i - j;
if (SkipFPExpectedValue(diff)) continue;
- CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j)));
+ CHECK_EQ(1, r.Call(i, j, expected_op(i, j)));
}
}
}
@@ -639,7 +640,7 @@ WASM_SIMD_TEST(I32x4Splat) {
WASM_SET_LOCAL(simd, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(lane_val))),
WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, lane_val), WASM_ONE);
- FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(i)); }
}
WASM_SIMD_TEST(I32x4ReplaceLane) {
@@ -676,7 +677,7 @@ WASM_SIMD_TEST(I16x8Splat) {
WASM_SET_LOCAL(simd, WASM_SIMD_I16x8_SPLAT(WASM_GET_LOCAL(lane_val))),
WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, lane_val), WASM_ONE);
- FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
+ FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(i)); }
}
WASM_SIMD_TEST(I16x8ReplaceLane) {
@@ -736,7 +737,7 @@ WASM_SIMD_TEST(I8x16Splat) {
WASM_SET_LOCAL(simd, WASM_SIMD_I8x16_SPLAT(WASM_GET_LOCAL(lane_val))),
WASM_SIMD_CHECK_SPLAT8(I8x16, simd, I32, lane_val), WASM_ONE);
- FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); }
+ FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(i)); }
}
WASM_SIMD_TEST(I8x16ReplaceLane) {
@@ -874,10 +875,10 @@ WASM_SIMD_TEST(I32x4ConvertF32x4) {
WASM_SIMD_CHECK_SPLAT4(I32x4, simd2, I32, expected_unsigned), WASM_ONE);
FOR_FLOAT32_INPUTS(i) {
- if (SkipFPValue(*i)) continue;
- int32_t signed_value = ConvertToInt(*i, false);
- int32_t unsigned_value = ConvertToInt(*i, true);
- CHECK_EQ(1, r.Call(*i, signed_value, unsigned_value));
+ if (SkipFPValue(i)) continue;
+ int32_t signed_value = ConvertToInt(i, false);
+ int32_t unsigned_value = ConvertToInt(i, true);
+ CHECK_EQ(1, r.Call(i, signed_value, unsigned_value));
}
}
@@ -915,10 +916,9 @@ WASM_SIMD_TEST(I32x4ConvertI16x8) {
WASM_ONE);
FOR_INT16_INPUTS(i) {
- int32_t unpacked_signed = static_cast<int32_t>(Widen<int16_t>(*i));
- int32_t unpacked_unsigned =
- static_cast<int32_t>(UnsignedWiden<int16_t>(*i));
- CHECK_EQ(1, r.Call(*i, unpacked_signed, unpacked_unsigned, 0));
+ int32_t unpacked_signed = static_cast<int32_t>(Widen<int16_t>(i));
+ int32_t unpacked_unsigned = static_cast<int32_t>(UnsignedWiden<int16_t>(i));
+ CHECK_EQ(1, r.Call(i, unpacked_signed, unpacked_unsigned, 0));
}
}
@@ -932,7 +932,7 @@ void RunI32x4UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, expected), WASM_ONE);
- FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i))); }
}
WASM_SIMD_TEST(I32x4Neg) {
@@ -959,7 +959,7 @@ void RunI32x4BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE);
FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1023,7 +1023,7 @@ void RunI32x4CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT4(I32x4, simd1, I32, expected), WASM_ONE);
FOR_INT32_INPUTS(i) {
- FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT32_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1084,7 +1084,7 @@ void RunI32x4ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT4(I32x4, simd, I32, expected), WASM_ONE);
- FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i, shift))); }
}
}
@@ -1140,9 +1140,9 @@ WASM_SIMD_TEST(I16x8ConvertI8x16) {
WASM_ONE);
FOR_INT8_INPUTS(i) {
- int32_t unpacked_signed = static_cast<int32_t>(Widen<int8_t>(*i));
- int32_t unpacked_unsigned = static_cast<int32_t>(UnsignedWiden<int8_t>(*i));
- CHECK_EQ(1, r.Call(*i, unpacked_signed, unpacked_unsigned, 0));
+ int32_t unpacked_signed = static_cast<int32_t>(Widen<int8_t>(i));
+ int32_t unpacked_unsigned = static_cast<int32_t>(UnsignedWiden<int8_t>(i));
+ CHECK_EQ(1, r.Call(i, unpacked_signed, unpacked_unsigned, 0));
}
}
@@ -1156,7 +1156,7 @@ void RunI16x8UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, expected), WASM_ONE);
- FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); }
+ FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i))); }
}
WASM_SIMD_TEST(I16x8Neg) {
@@ -1196,15 +1196,15 @@ WASM_SIMD_TEST(I16x8ConvertI32x4) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
// packed signed values
- int32_t ps_a = Narrow<int16_t>(*i);
- int32_t ps_b = Narrow<int16_t>(*j);
+ int32_t ps_a = Narrow<int16_t>(i);
+ int32_t ps_b = Narrow<int16_t>(j);
// packed unsigned values
- int32_t pu_a = UnsignedNarrow<int16_t>(*i);
- int32_t pu_b = UnsignedNarrow<int16_t>(*j);
+ int32_t pu_a = UnsignedNarrow<int16_t>(i);
+ int32_t pu_b = UnsignedNarrow<int16_t>(j);
// Sign-extend here, since ExtractLane sign extends.
if (pu_a & 0x8000) pu_a |= 0xFFFF0000;
if (pu_b & 0x8000) pu_b |= 0xFFFF0000;
- CHECK_EQ(1, r.Call(*i, *j, ps_a, ps_b, pu_a, pu_b));
+ CHECK_EQ(1, r.Call(i, j, ps_a, ps_b, pu_a, pu_b));
}
}
}
@@ -1224,7 +1224,7 @@ void RunI16x8BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT8(I16x8, simd1, I32, expected), WASM_ONE);
FOR_INT16_INPUTS(i) {
- FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1296,7 +1296,7 @@ void RunI16x8CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT8(I16x8, simd1, I32, expected), WASM_ONE);
FOR_INT16_INPUTS(i) {
- FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT16_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1357,7 +1357,7 @@ void RunI16x8ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT8(I16x8, simd, I32, expected), WASM_ONE);
- FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); }
+ FOR_INT16_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i, shift))); }
}
}
@@ -1386,7 +1386,7 @@ void RunI8x16UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SET_LOCAL(simd, WASM_SIMD_UNOP(simd_op, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE);
- FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i))); }
+ FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i))); }
}
WASM_SIMD_TEST(I8x16Neg) {
@@ -1428,15 +1428,15 @@ WASM_SIMD_TEST(I8x16ConvertI16x8) {
FOR_INT16_INPUTS(i) {
FOR_INT16_INPUTS(j) {
// packed signed values
- int32_t ps_a = Narrow<int8_t>(*i);
- int32_t ps_b = Narrow<int8_t>(*j);
+ int32_t ps_a = Narrow<int8_t>(i);
+ int32_t ps_b = Narrow<int8_t>(j);
// packed unsigned values
- int32_t pu_a = UnsignedNarrow<int8_t>(*i);
- int32_t pu_b = UnsignedNarrow<int8_t>(*j);
+ int32_t pu_a = UnsignedNarrow<int8_t>(i);
+ int32_t pu_b = UnsignedNarrow<int8_t>(j);
// Sign-extend here, since ExtractLane sign extends.
if (pu_a & 0x80) pu_a |= 0xFFFFFF00;
if (pu_b & 0x80) pu_b |= 0xFFFFFF00;
- CHECK_EQ(1, r.Call(*i, *j, ps_a, ps_b, pu_a, pu_b));
+ CHECK_EQ(1, r.Call(i, j, ps_a, ps_b, pu_a, pu_b));
}
}
}
@@ -1456,7 +1456,7 @@ void RunI8x16BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT16(I8x16, simd1, I32, expected), WASM_ONE);
FOR_INT8_INPUTS(i) {
- FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1523,7 +1523,7 @@ void RunI8x16CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WASM_SIMD_CHECK_SPLAT16(I8x16, simd1, I32, expected), WASM_ONE);
FOR_INT8_INPUTS(i) {
- FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(*i, *j, expected_op(*i, *j))); }
+ FOR_INT8_INPUTS(j) { CHECK_EQ(1, r.Call(i, j, expected_op(i, j))); }
}
}
@@ -1589,7 +1589,7 @@ void RunI8x16ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
simd, WASM_SIMD_SHIFT_OP(simd_op, shift, WASM_GET_LOCAL(simd))),
WASM_SIMD_CHECK_SPLAT16(I8x16, simd, I32, expected), WASM_ONE);
- FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(*i, expected_op(*i, shift))); }
+ FOR_INT8_INPUTS(i) { CHECK_EQ(1, r.Call(i, expected_op(i, shift))); }
}
}
@@ -2334,7 +2334,7 @@ WASM_SIMD_COMPILED_TEST(SimdLoadStoreLoad) {
WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_LOAD_MEM(WASM_I32V(4))));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i;
+ int32_t expected = i;
r.builder().WriteMemory(&memory[1], expected);
CHECK_EQ(expected, r.Call());
}
@@ -2356,9 +2356,9 @@ WASM_SIMD_COMPILED_TEST(SimdLoadStoreLoad) {
DCHECK_EQ(1, r.Call(5)); \
DCHECK_EQ(0, r.Call(0)); \
}
-WASM_SIMD_ANYTRUE_TEST(32x4, 4, 0xffffffff);
-WASM_SIMD_ANYTRUE_TEST(16x8, 8, 0xffff);
-WASM_SIMD_ANYTRUE_TEST(8x16, 16, 0xff);
+WASM_SIMD_ANYTRUE_TEST(32x4, 4, 0xffffffff)
+WASM_SIMD_ANYTRUE_TEST(16x8, 8, 0xffff)
+WASM_SIMD_ANYTRUE_TEST(8x16, 16, 0xff)
#define WASM_SIMD_ALLTRUE_TEST(format, lanes, max) \
WASM_SIMD_TEST_TURBOFAN(S##format##AllTrue) { \
@@ -2372,9 +2372,9 @@ WASM_SIMD_ANYTRUE_TEST(8x16, 16, 0xff);
DCHECK_EQ(0, r.Call(21)); \
DCHECK_EQ(0, r.Call(0)); \
}
-WASM_SIMD_ALLTRUE_TEST(32x4, 4, 0xffffffff);
-WASM_SIMD_ALLTRUE_TEST(16x8, 8, 0xffff);
-WASM_SIMD_ALLTRUE_TEST(8x16, 16, 0xff);
+WASM_SIMD_ALLTRUE_TEST(32x4, 4, 0xffffffff)
+WASM_SIMD_ALLTRUE_TEST(16x8, 8, 0xffff)
+WASM_SIMD_ALLTRUE_TEST(8x16, 16, 0xff)
#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST_TURBOFAN(BitSelect) {
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm.cc b/deps/v8/test/cctest/wasm/test-run-wasm.cc
index 7e6ba47448..ef481bc929 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm.cc
@@ -38,7 +38,7 @@ WASM_EXEC_TEST(Int32Const) {
WASM_EXEC_TEST(Int32Const_many) {
FOR_INT32_INPUTS(i) {
WasmRunner<int32_t> r(execution_tier);
- const int32_t kExpectedValue = *i;
+ const int32_t kExpectedValue = i;
// return(kExpectedValue)
BUILD(r, WASM_I32V(kExpectedValue));
CHECK_EQ(kExpectedValue, r.Call());
@@ -57,21 +57,21 @@ WASM_EXEC_TEST(Int32Param0) {
WasmRunner<int32_t, int32_t> r(execution_tier);
// return(local[0])
BUILD(r, WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Int32Param0_fallthru) {
WasmRunner<int32_t, int32_t> r(execution_tier);
// local[0]
BUILD(r, WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Int32Param1) {
WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
// local[1]
BUILD(r, WASM_GET_LOCAL(1));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(-111, *i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(-111, i)); }
}
WASM_EXEC_TEST(Int32Add) {
@@ -85,14 +85,14 @@ WASM_EXEC_TEST(Int32Add_P) {
WasmRunner<int32_t, int32_t> r(execution_tier);
// p0 + 13
BUILD(r, WASM_I32_ADD(WASM_I32V_1(13), WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(base::AddWithWraparound(*i, 13), r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(base::AddWithWraparound(i, 13), r.Call(i)); }
}
WASM_EXEC_TEST(Int32Add_P_fallthru) {
WasmRunner<int32_t, int32_t> r(execution_tier);
// p0 + 13
BUILD(r, WASM_I32_ADD(WASM_I32V_1(13), WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(base::AddWithWraparound(*i, 13), r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(base::AddWithWraparound(i, 13), r.Call(i)); }
}
static void RunInt32AddTest(ExecutionTier execution_tier, const byte* code,
@@ -104,9 +104,9 @@ static void RunInt32AddTest(ExecutionTier execution_tier, const byte* code,
r.Build(code, code + size);
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*i) +
- static_cast<uint32_t>(*j));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(i) +
+ static_cast<uint32_t>(j));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -168,8 +168,8 @@ static void TestInt32Binop(ExecutionTier execution_tier, WasmOpcode opcode,
FOR_INT32_INPUTS(j) {
WasmRunner<ctype> r(execution_tier);
// Apply {opcode} on two constants.
- BUILD(r, WASM_BINOP(opcode, WASM_I32V(*i), WASM_I32V(*j)));
- CHECK_EQ(expected(*i, *j), r.Call());
+ BUILD(r, WASM_BINOP(opcode, WASM_I32V(i), WASM_I32V(j)));
+ CHECK_EQ(expected(i, j), r.Call());
}
}
{
@@ -178,7 +178,7 @@ static void TestInt32Binop(ExecutionTier execution_tier, WasmOpcode opcode,
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- CHECK_EQ(expected(*i, *j), r.Call(*i, *j));
+ CHECK_EQ(expected(i, j), r.Call(i, j));
}
}
}
@@ -204,7 +204,7 @@ WASM_I32_BINOP_TEST(RemU, uint32_t, b == 0 ? 0xDEADBEEF : a % b)
WASM_I32_BINOP_TEST(And, int32_t, a& b)
WASM_I32_BINOP_TEST(Ior, int32_t, a | b)
WASM_I32_BINOP_TEST(Xor, int32_t, a ^ b)
-WASM_I32_BINOP_TEST(Shl, int32_t, a << (b & 0x1F))
+WASM_I32_BINOP_TEST(Shl, int32_t, base::ShlWithWraparound(a, b))
WASM_I32_BINOP_TEST(ShrU, uint32_t, a >> (b & 0x1F))
WASM_I32_BINOP_TEST(ShrS, int32_t, a >> (b & 0x1F))
WASM_I32_BINOP_TEST(Ror, uint32_t, (a >> (b & 0x1F)) | (a << ((32 - b) & 0x1F)))
@@ -392,11 +392,11 @@ WASM_EXEC_TEST(Int32AsmjsDivS_byzero_const) {
BUILD(r, WASM_I32_ASMJS_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
FOR_INT32_INPUTS(i) {
if (denom == 0) {
- CHECK_EQ(0, r.Call(*i));
- } else if (denom == -1 && *i == std::numeric_limits<int32_t>::min()) {
- CHECK_EQ(std::numeric_limits<int32_t>::min(), r.Call(*i));
+ CHECK_EQ(0, r.Call(i));
+ } else if (denom == -1 && i == std::numeric_limits<int32_t>::min()) {
+ CHECK_EQ(std::numeric_limits<int32_t>::min(), r.Call(i));
} else {
- CHECK_EQ(*i / denom, r.Call(*i));
+ CHECK_EQ(i / denom, r.Call(i));
}
}
}
@@ -409,11 +409,11 @@ WASM_EXEC_TEST(Int32AsmjsRemS_byzero_const) {
BUILD(r, WASM_I32_ASMJS_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
FOR_INT32_INPUTS(i) {
if (denom == 0) {
- CHECK_EQ(0, r.Call(*i));
- } else if (denom == -1 && *i == std::numeric_limits<int32_t>::min()) {
- CHECK_EQ(0, r.Call(*i));
+ CHECK_EQ(0, r.Call(i));
+ } else if (denom == -1 && i == std::numeric_limits<int32_t>::min()) {
+ CHECK_EQ(0, r.Call(i));
} else {
- CHECK_EQ(*i % denom, r.Call(*i));
+ CHECK_EQ(i % denom, r.Call(i));
}
}
}
@@ -605,8 +605,7 @@ WASM_EXEC_TEST(Float32Neg) {
BUILD(r, WASM_F32_NEG(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- CHECK_EQ(0x80000000,
- bit_cast<uint32_t>(*i) ^ bit_cast<uint32_t>(r.Call(*i)));
+ CHECK_EQ(0x80000000, bit_cast<uint32_t>(i) ^ bit_cast<uint32_t>(r.Call(i)));
}
}
@@ -616,7 +615,7 @@ WASM_EXEC_TEST(Float64Neg) {
FOR_FLOAT64_INPUTS(i) {
CHECK_EQ(0x8000000000000000,
- bit_cast<uint64_t>(*i) ^ bit_cast<uint64_t>(r.Call(*i)));
+ bit_cast<uint64_t>(i) ^ bit_cast<uint64_t>(r.Call(i)));
}
}
@@ -627,36 +626,36 @@ WASM_EXEC_TEST(IfElse_P) {
WASM_I32V_1(11), // --
WASM_I32V_1(22))); // --
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 11 : 22;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 11 : 22;
+ CHECK_EQ(expected, r.Call(i));
}
}
WASM_EXEC_TEST(If_empty1) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprEnd, WASM_GET_LOCAL(1));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 9, *i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i - 9, i)); }
}
WASM_EXEC_TEST(IfElse_empty1) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprElse, kExprEnd,
WASM_GET_LOCAL(1));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 8, *i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i - 8, i)); }
}
WASM_EXEC_TEST(IfElse_empty2) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, WASM_NOP, kExprElse,
kExprEnd, WASM_GET_LOCAL(1));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 7, *i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i - 7, i)); }
}
WASM_EXEC_TEST(IfElse_empty3) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_GET_LOCAL(0), kExprIf, kLocalVoid, kExprElse, WASM_NOP,
kExprEnd, WASM_GET_LOCAL(1));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i - 6, *i)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i - 6, i)); }
}
WASM_EXEC_TEST(If_chain1) {
@@ -664,7 +663,7 @@ WASM_EXEC_TEST(If_chain1) {
// if (p0) 13; if (p0) 14; 15
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_NOP),
WASM_IF(WASM_GET_LOCAL(0), WASM_NOP), WASM_I32V_1(15));
- FOR_INT32_INPUTS(i) { CHECK_EQ(15, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(15, r.Call(i)); }
}
WASM_EXEC_TEST(If_chain_set) {
@@ -674,8 +673,8 @@ WASM_EXEC_TEST(If_chain_set) {
WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I32V_2(74))),
WASM_GET_LOCAL(1));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 74 : *i;
- CHECK_EQ(expected, r.Call(*i, *i));
+ int32_t expected = i ? 74 : i;
+ CHECK_EQ(expected, r.Call(i, i));
}
}
@@ -716,7 +715,7 @@ WASM_EXEC_TEST(Return_I32) {
BUILD(r, RET(WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Return_F32) {
@@ -725,7 +724,7 @@ WASM_EXEC_TEST(Return_F32) {
BUILD(r, RET(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- float expect = *i;
+ float expect = i;
float result = r.Call(expect);
if (std::isnan(expect)) {
CHECK(std::isnan(result));
@@ -741,7 +740,7 @@ WASM_EXEC_TEST(Return_F64) {
BUILD(r, RET(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- double expect = *i;
+ double expect = i;
double result = r.Call(expect);
if (std::isnan(expect)) {
CHECK(std::isnan(result));
@@ -764,8 +763,8 @@ WASM_EXEC_TEST(Select) {
// return select(11, 22, a);
BUILD(r, WASM_SELECT(WASM_I32V_1(11), WASM_I32V_1(22), WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 11 : 22;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 11 : 22;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -776,7 +775,7 @@ WASM_EXEC_TEST(Select_strict1) {
WASM_TEE_LOCAL(0, WASM_I32V_1(1)),
WASM_TEE_LOCAL(0, WASM_I32V_1(2))),
WASM_DROP, WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(2, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(2, r.Call(i)); }
}
WASM_EXEC_TEST(Select_strict2) {
@@ -787,8 +786,8 @@ WASM_EXEC_TEST(Select_strict2) {
BUILD(r, WASM_SELECT(WASM_TEE_LOCAL(1, WASM_I32V_1(5)),
WASM_TEE_LOCAL(2, WASM_I32V_1(6)), WASM_GET_LOCAL(0)));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 5 : 6;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 5 : 6;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -802,7 +801,7 @@ WASM_EXEC_TEST(Select_strict3) {
WASM_TEE_LOCAL(0, WASM_GET_LOCAL(1))));
FOR_INT32_INPUTS(i) {
int32_t expected = 5;
- CHECK_EQ(expected, r.Call(*i));
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -811,7 +810,7 @@ WASM_EXEC_TEST(BrIf_strict) {
BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_GET_LOCAL(0),
WASM_TEE_LOCAL(0, WASM_I32V_2(99)))));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Br_height) {
@@ -839,7 +838,7 @@ WASM_EXEC_TEST(BrTable0a) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0)))),
WASM_I32V_2(91));
- FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(i)); }
}
WASM_EXEC_TEST(BrTable0b) {
@@ -847,7 +846,7 @@ WASM_EXEC_TEST(BrTable0b) {
BUILD(r,
B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(0)))),
WASM_I32V_2(92));
- FOR_INT32_INPUTS(i) { CHECK_EQ(92, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(92, r.Call(i)); }
}
WASM_EXEC_TEST(BrTable0c) {
@@ -858,15 +857,15 @@ WASM_EXEC_TEST(BrTable0c) {
RET_I8(76))),
WASM_I32V_2(77));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i == 0 ? 76 : 77;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i == 0 ? 76 : 77;
+ CHECK_EQ(expected, r.Call(i));
}
}
WASM_EXEC_TEST(BrTable1) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0))), RET_I8(93));
- FOR_INT32_INPUTS(i) { CHECK_EQ(93, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(93, r.Call(i)); }
}
WASM_EXEC_TEST(BrTable_loop) {
@@ -1021,7 +1020,7 @@ WASM_EXEC_TEST(F32ReinterpretI32) {
WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i;
+ int32_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -1037,7 +1036,7 @@ WASM_EXEC_TEST(I32ReinterpretF32) {
WASM_I32V_2(107));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i;
+ int32_t expected = i;
CHECK_EQ(107, r.Call(expected));
CHECK_EQ(expected, r.builder().ReadMemory(&memory[0]));
}
@@ -1079,7 +1078,7 @@ WASM_EXEC_TEST(LoadStoreLoad) {
WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i;
+ int32_t expected = i;
r.builder().WriteMemory(&memory[0], expected);
CHECK_EQ(expected, r.Call());
}
@@ -1170,61 +1169,61 @@ WASM_EXEC_TEST(VoidReturn2) {
WASM_EXEC_TEST(BrEmpty) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BRV(0, WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(BrIfEmpty) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BRV_IF(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_empty) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, kExprBlock, kLocalVoid, kExprEnd, WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_empty_br1) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_BR(0)), WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_empty_brif1) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_ZERO)), WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_empty_brif2) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i, i + 1)); }
}
WASM_EXEC_TEST(Block_i) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_f) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_BLOCK_F(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_d) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_BLOCK_D(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Block_br2) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0))));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, static_cast<uint32_t>(r.Call(*i))); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, static_cast<uint32_t>(r.Call(i))); }
}
WASM_EXEC_TEST(Block_If_P) {
@@ -1235,51 +1234,51 @@ WASM_EXEC_TEST(Block_If_P) {
WASM_BRV(1, WASM_I32V_1(51))), // --
WASM_I32V_1(52))); // --
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 51 : 52;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 51 : 52;
+ CHECK_EQ(expected, r.Call(i));
}
}
WASM_EXEC_TEST(Loop_empty) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, kExprLoop, kLocalVoid, kExprEnd, WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_i) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_LOOP_I(WASM_GET_LOCAL(0)));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_f) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_LOOP_F(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_d) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_LOOP_D(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_FLOAT_EQ(*i, r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_empty_br1) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_LOOP(WASM_BR(1))), WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_empty_brif1) {
WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_LOOP(WASM_BR_IF(1, WASM_ZERO))), WASM_GET_LOCAL(0));
- FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); }
+ FOR_INT32_INPUTS(i) { CHECK_EQ(i, r.Call(i)); }
}
WASM_EXEC_TEST(Loop_empty_brif2) {
WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_LOOP_I(WASM_BRV_IF(1, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
- FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); }
+ FOR_UINT32_INPUTS(i) { CHECK_EQ(i, r.Call(i, i + 1)); }
}
WASM_EXEC_TEST(Loop_empty_brif3) {
@@ -1288,8 +1287,8 @@ WASM_EXEC_TEST(Loop_empty_brif3) {
WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
- CHECK_EQ(*i, r.Call(0, *i, *j));
- CHECK_EQ(*j, r.Call(1, *i, *j));
+ CHECK_EQ(i, r.Call(0, i, j));
+ CHECK_EQ(j, r.Call(1, i, j));
}
}
}
@@ -1299,8 +1298,8 @@ WASM_EXEC_TEST(Block_BrIf_P) {
BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I32V_1(51), WASM_GET_LOCAL(0)),
WASM_I32V_1(52)));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 51 : 52;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 51 : 52;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -1313,8 +1312,8 @@ WASM_EXEC_TEST(Block_IfElse_P_assign) {
WASM_SET_LOCAL(0, WASM_I32V_2(72))), // --
WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 71 : 72;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 71 : 72;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -1327,8 +1326,8 @@ WASM_EXEC_TEST(Block_IfElse_P_return) {
RET_I8(82)), // --
WASM_ZERO); // --
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 81 : 82;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 81 : 82;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -1338,8 +1337,8 @@ WASM_EXEC_TEST(Block_If_P_assign) {
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I32V_1(61))),
WASM_GET_LOCAL(0));
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 61 : *i;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 61 : i;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -1357,8 +1356,8 @@ WASM_EXEC_TEST(ExprIf_P) {
WASM_I32V_1(11), // --
WASM_I32V_1(22))); // --
FOR_INT32_INPUTS(i) {
- int32_t expected = *i ? 11 : 22;
- CHECK_EQ(expected, r.Call(*i));
+ int32_t expected = i ? 11 : 22;
+ CHECK_EQ(expected, r.Call(i));
}
}
@@ -2039,7 +2038,7 @@ WASM_EXEC_TEST(Int32LoadInt16_signext) {
BUILD(r, WASM_LOAD_MEM(MachineType::Int16(), WASM_GET_LOCAL(0)));
for (int i = 0; i < kNumBytes; i += 2) {
- int32_t expected = memory[i] | (static_cast<int8_t>(memory[i + 1]) << 8);
+ int32_t expected = static_cast<int16_t>(memory[i] | (memory[i + 1] << 8));
CHECK_EQ(expected, r.Call(i));
}
}
@@ -2275,9 +2274,9 @@ WASM_EXEC_TEST(Call_Int32Add) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*i) +
- static_cast<uint32_t>(*j));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(i) +
+ static_cast<uint32_t>(j));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -2294,7 +2293,7 @@ WASM_EXEC_TEST(Call_Float32Sub) {
WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, r.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(i - j, r.Call(i, j)); }
}
}
@@ -2312,9 +2311,9 @@ WASM_EXEC_TEST(Call_Float64Sub) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- r.builder().WriteMemory(&memory[0], *i);
- r.builder().WriteMemory(&memory[1], *j);
- double expected = *i - *j;
+ r.builder().WriteMemory(&memory[0], i);
+ r.builder().WriteMemory(&memory[1], j);
+ double expected = i - j;
CHECK_EQ(107, r.Call());
if (expected != expected) {
@@ -2445,9 +2444,9 @@ WASM_EXEC_TEST(MultiReturnSub) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*j) -
- static_cast<uint32_t>(*i));
- CHECK_EQ(expected, r.Call(*i, *j));
+ int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(j) -
+ static_cast<uint32_t>(i));
+ CHECK_EQ(expected, r.Call(i, j));
}
}
}
@@ -2779,56 +2778,56 @@ WASM_EXEC_TEST(F32Floor) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_FLOOR(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(*i), r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(floorf(i), r.Call(i)); }
}
WASM_EXEC_TEST(F32Ceil) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_CEIL(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(*i), r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(ceilf(i), r.Call(i)); }
}
WASM_EXEC_TEST(F32Trunc) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_TRUNC(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(*i), r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(truncf(i), r.Call(i)); }
}
WASM_EXEC_TEST(F32NearestInt) {
WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_NEARESTINT(WASM_GET_LOCAL(0)));
- FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyintf(*i), r.Call(*i)); }
+ FOR_FLOAT32_INPUTS(i) { CHECK_FLOAT_EQ(nearbyintf(i), r.Call(i)); }
}
WASM_EXEC_TEST(F64Floor) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_FLOOR(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(*i), r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(floor(i), r.Call(i)); }
}
WASM_EXEC_TEST(F64Ceil) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_CEIL(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(*i), r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(ceil(i), r.Call(i)); }
}
WASM_EXEC_TEST(F64Trunc) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_TRUNC(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(trunc(*i), r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(trunc(i), r.Call(i)); }
}
WASM_EXEC_TEST(F64NearestInt) {
WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_NEARESTINT(WASM_GET_LOCAL(0)));
- FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(*i), r.Call(*i)); }
+ FOR_FLOAT64_INPUTS(i) { CHECK_DOUBLE_EQ(nearbyint(i), r.Call(i)); }
}
WASM_EXEC_TEST(F32Min) {
@@ -2836,7 +2835,7 @@ WASM_EXEC_TEST(F32Min) {
BUILD(r, WASM_F32_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_DOUBLE_EQ(JSMin(*i, *j), r.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_DOUBLE_EQ(JSMin(i, j), r.Call(i, j)); }
}
}
@@ -2852,7 +2851,7 @@ WASM_EXEC_TEST(F64Min) {
BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(JSMin(*i, *j), r.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(JSMin(i, j), r.Call(i, j)); }
}
}
@@ -2868,7 +2867,7 @@ WASM_EXEC_TEST(F32Max) {
BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(JSMax(*i, *j), r.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(JSMax(i, j), r.Call(i, j)); }
}
}
@@ -2885,8 +2884,8 @@ WASM_EXEC_TEST(F64Max) {
FOR_FLOAT64_INPUTS(i) {
FOR_FLOAT64_INPUTS(j) {
- double result = r.Call(*i, *j);
- CHECK_DOUBLE_EQ(JSMax(*i, *j), result);
+ double result = r.Call(i, j);
+ CHECK_DOUBLE_EQ(JSMax(i, j), result);
}
}
}
@@ -2903,10 +2902,10 @@ WASM_EXEC_TEST(I32SConvertF32) {
BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- if (is_inbounds<int32_t>(*i)) {
- CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i));
+ if (is_inbounds<int32_t>(i)) {
+ CHECK_EQ(static_cast<int32_t>(i), r.Call(i));
} else {
- CHECK_TRAP32(r.Call(*i));
+ CHECK_TRAP32(r.Call(i));
}
}
}
@@ -2918,12 +2917,12 @@ WASM_EXEC_TEST(I32SConvertSatF32) {
FOR_FLOAT32_INPUTS(i) {
int32_t expected =
- is_inbounds<int32_t>(*i)
- ? static_cast<int32_t>(*i)
- : std::isnan(*i) ? 0
- : *i < 0.0 ? std::numeric_limits<int32_t>::min()
- : std::numeric_limits<int32_t>::max();
- int32_t found = r.Call(*i);
+ is_inbounds<int32_t>(i)
+ ? static_cast<int32_t>(i)
+ : std::isnan(i) ? 0
+ : i < 0.0 ? std::numeric_limits<int32_t>::min()
+ : std::numeric_limits<int32_t>::max();
+ int32_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -2933,10 +2932,10 @@ WASM_EXEC_TEST(I32SConvertF64) {
BUILD(r, WASM_I32_SCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- if (is_inbounds<int32_t>(*i)) {
- CHECK_EQ(static_cast<int32_t>(*i), r.Call(*i));
+ if (is_inbounds<int32_t>(i)) {
+ CHECK_EQ(static_cast<int32_t>(i), r.Call(i));
} else {
- CHECK_TRAP32(r.Call(*i));
+ CHECK_TRAP32(r.Call(i));
}
}
}
@@ -2947,12 +2946,12 @@ WASM_EXEC_TEST(I32SConvertSatF64) {
BUILD(r, WASM_I32_SCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int32_t expected =
- is_inbounds<int32_t>(*i)
- ? static_cast<int32_t>(*i)
- : std::isnan(*i) ? 0
- : *i < 0.0 ? std::numeric_limits<int32_t>::min()
- : std::numeric_limits<int32_t>::max();
- int32_t found = r.Call(*i);
+ is_inbounds<int32_t>(i)
+ ? static_cast<int32_t>(i)
+ : std::isnan(i) ? 0
+ : i < 0.0 ? std::numeric_limits<int32_t>::min()
+ : std::numeric_limits<int32_t>::max();
+ int32_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -2961,10 +2960,10 @@ WASM_EXEC_TEST(I32UConvertF32) {
WasmRunner<uint32_t, float> r(execution_tier);
BUILD(r, WASM_I32_UCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
- if (is_inbounds<uint32_t>(*i)) {
- CHECK_EQ(static_cast<uint32_t>(*i), r.Call(*i));
+ if (is_inbounds<uint32_t>(i)) {
+ CHECK_EQ(static_cast<uint32_t>(i), r.Call(i));
} else {
- CHECK_TRAP32(r.Call(*i));
+ CHECK_TRAP32(r.Call(i));
}
}
}
@@ -2975,12 +2974,12 @@ WASM_EXEC_TEST(I32UConvertSatF32) {
BUILD(r, WASM_I32_UCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
int32_t expected =
- is_inbounds<uint32_t>(*i)
- ? static_cast<uint32_t>(*i)
- : std::isnan(*i) ? 0
- : *i < 0.0 ? std::numeric_limits<uint32_t>::min()
- : std::numeric_limits<uint32_t>::max();
- int32_t found = r.Call(*i);
+ is_inbounds<uint32_t>(i)
+ ? static_cast<uint32_t>(i)
+ : std::isnan(i) ? 0
+ : i < 0.0 ? std::numeric_limits<uint32_t>::min()
+ : std::numeric_limits<uint32_t>::max();
+ int32_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -2989,10 +2988,10 @@ WASM_EXEC_TEST(I32UConvertF64) {
WasmRunner<uint32_t, double> r(execution_tier);
BUILD(r, WASM_I32_UCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
- if (is_inbounds<uint32_t>(*i)) {
- CHECK_EQ(static_cast<uint32_t>(*i), r.Call(*i));
+ if (is_inbounds<uint32_t>(i)) {
+ CHECK_EQ(static_cast<uint32_t>(i), r.Call(i));
} else {
- CHECK_TRAP32(r.Call(*i));
+ CHECK_TRAP32(r.Call(i));
}
}
}
@@ -3003,12 +3002,12 @@ WASM_EXEC_TEST(I32UConvertSatF64) {
BUILD(r, WASM_I32_UCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int32_t expected =
- is_inbounds<uint32_t>(*i)
- ? static_cast<uint32_t>(*i)
- : std::isnan(*i) ? 0
- : *i < 0.0 ? std::numeric_limits<uint32_t>::min()
- : std::numeric_limits<uint32_t>::max();
- int32_t found = r.Call(*i);
+ is_inbounds<uint32_t>(i)
+ ? static_cast<uint32_t>(i)
+ : std::isnan(i) ? 0
+ : i < 0.0 ? std::numeric_limits<uint32_t>::min()
+ : std::numeric_limits<uint32_t>::max();
+ int32_t found = r.Call(i);
CHECK_EQ(expected, found);
}
}
@@ -3018,7 +3017,7 @@ WASM_EXEC_TEST(F64CopySign) {
BUILD(r, WASM_F64_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT64_INPUTS(i) {
- FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(copysign(*i, *j), r.Call(*i, *j)); }
+ FOR_FLOAT64_INPUTS(j) { CHECK_DOUBLE_EQ(copysign(i, j), r.Call(i, j)); }
}
}
@@ -3027,7 +3026,7 @@ WASM_EXEC_TEST(F32CopySign) {
BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
- FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(copysignf(*i, *j), r.Call(*i, *j)); }
+ FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(copysignf(i, j), r.Call(i, j)); }
}
}
@@ -3307,9 +3306,11 @@ WASM_EXEC_TEST(I32MulOnDifferentRegisters) {
}
WASM_EXEC_TEST(I32ShlOnDifferentRegisters) {
- BinOpOnDifferentRegisters<int32_t>(
- execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Shl,
- [](int32_t lhs, int32_t rhs, bool* trap) { return lhs << (rhs & 31); });
+ BinOpOnDifferentRegisters<int32_t>(execution_tier, kWasmI32,
+ ArrayVector(kSome32BitInputs), kExprI32Shl,
+ [](int32_t lhs, int32_t rhs, bool* trap) {
+ return base::ShlWithWraparound(lhs, rhs);
+ });
}
WASM_EXEC_TEST(I32ShrSOnDifferentRegisters) {
@@ -3383,9 +3384,11 @@ WASM_EXEC_TEST(I64MulOnDifferentRegisters) {
}
WASM_EXEC_TEST(I64ShlOnDifferentRegisters) {
- BinOpOnDifferentRegisters<int64_t>(
- execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Shl,
- [](int64_t lhs, int64_t rhs, bool* trap) { return lhs << (rhs & 63); });
+ BinOpOnDifferentRegisters<int64_t>(execution_tier, kWasmI64,
+ ArrayVector(kSome64BitInputs), kExprI64Shl,
+ [](int64_t lhs, int64_t rhs, bool* trap) {
+ return base::ShlWithWraparound(lhs, rhs);
+ });
}
WASM_EXEC_TEST(I64ShrSOnDifferentRegisters) {
@@ -3470,10 +3473,9 @@ TEST(Liftoff_tier_up) {
memcpy(buffer.get(), sub_code->instructions().start(), sub_size);
desc.buffer = buffer.get();
desc.instr_size = static_cast<int>(sub_size);
- WasmCode* code = native_module->AddCode(
- add.function_index(), desc, 0, 0, 0, {}, OwnedVector<byte>(),
- WasmCode::kFunction, WasmCode::kOther);
- native_module->PublishCode(code);
+ native_module->AddCode(add.function_index(), desc, 0, 0, {},
+ OwnedVector<byte>(), WasmCode::kFunction,
+ WasmCode::kOther);
// Second run should now execute {sub}.
CHECK_EQ(4, r.Call(11, 7));
diff --git a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc
index 43ba7dfea1..3ef62d869f 100644
--- a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc
+++ b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc
@@ -59,14 +59,14 @@ class MockPlatform final : public TestPlatform {
void PostDelayedTask(std::unique_ptr<Task> task,
double delay_in_seconds) override {
- UNREACHABLE();
- };
+ tasks_.push(std::move(task));
+ }
void PostIdleTask(std::unique_ptr<IdleTask> task) override {
UNREACHABLE();
}
- bool IdleTasksEnabled() override { return false; };
+ bool IdleTasksEnabled() override { return false; }
void ExecuteTasks() {
while (!tasks_.empty()) {
diff --git a/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc b/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc
index ba189a57ca..68366dc2df 100644
--- a/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc
+++ b/deps/v8/test/cctest/wasm/test-wasm-import-wrapper-cache.cc
@@ -18,11 +18,10 @@ namespace wasm {
namespace test_wasm_import_wrapper_cache {
std::unique_ptr<NativeModule> NewModule(Isolate* isolate) {
- WasmCodeManager* manager = isolate->wasm_engine()->code_manager();
std::shared_ptr<WasmModule> module(new WasmModule);
bool can_request_more = false;
size_t size = 16384;
- auto native_module = manager->NewNativeModule(
+ auto native_module = isolate->wasm_engine()->NewNativeModule(
isolate, kAllWasmFeatures, size, can_request_more, std::move(module));
native_module->SetRuntimeStubs(isolate);
return native_module;
diff --git a/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc b/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc
index 1349ce2d17..211a79978e 100644
--- a/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc
+++ b/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc
@@ -48,7 +48,7 @@ class ArgPassingHelper {
runner.Build(outer_code.data(), outer_code.data() + outer_code.size());
int funcs_to_redict[] = {static_cast<int>(inner_compiler.function_index())};
- runner.builder().Link();
+ runner.builder().SetExecutable();
WasmDebugInfo::RedirectToInterpreter(debug_info_,
ArrayVector(funcs_to_redict));
main_fun_wrapper_ = runner.builder().WrapCode(runner.function_index());
@@ -105,7 +105,7 @@ TEST(TestArgumentPassing_int32) {
return base::AddWithWraparound(base::MulWithWraparound(2, a), 1);
});
- FOR_INT32_INPUTS(v) { helper.CheckCall(*v); }
+ FOR_INT32_INPUTS(v) { helper.CheckCall(v); }
}
// Pass int64_t, return double.
@@ -124,17 +124,17 @@ TEST(TestArgumentPassing_double_int64) {
WASM_CALL_FUNCTION0(f2.function_index())},
[](int32_t a, int32_t b) {
int64_t a64 = static_cast<int64_t>(a) & 0xFFFFFFFF;
- int64_t b64 = static_cast<int64_t>(b) << 32;
+ int64_t b64 = static_cast<uint64_t>(static_cast<int64_t>(b)) << 32;
return static_cast<double>(a64 | b64);
});
FOR_INT32_INPUTS(v1) {
- FOR_INT32_INPUTS(v2) { helper.CheckCall(*v1, *v2); }
+ FOR_INT32_INPUTS(v2) { helper.CheckCall(v1, v2); }
}
FOR_INT64_INPUTS(v) {
- int32_t v1 = static_cast<int32_t>(*v);
- int32_t v2 = static_cast<int32_t>(*v >> 32);
+ int32_t v1 = static_cast<int32_t>(v);
+ int32_t v2 = static_cast<int32_t>(v >> 32);
helper.CheckCall(v1, v2);
helper.CheckCall(v2, v1);
}
@@ -175,7 +175,7 @@ TEST(TestArgumentPassing_float_double) {
WASM_GET_LOCAL(0), WASM_CALL_FUNCTION0(f2.function_index())},
[](float f) { return 2. * static_cast<double>(f) + 1.; });
- FOR_FLOAT32_INPUTS(f) { helper.CheckCall(*f); }
+ FOR_FLOAT32_INPUTS(f) { helper.CheckCall(f); }
}
// Pass two doubles, return double.
@@ -192,7 +192,7 @@ TEST(TestArgumentPassing_double_double) {
[](double a, double b) { return a + b; });
FOR_FLOAT64_INPUTS(d1) {
- FOR_FLOAT64_INPUTS(d2) { helper.CheckCall(*d1, *d2); }
+ FOR_FLOAT64_INPUTS(d2) { helper.CheckCall(d1, d2); }
}
}
diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.cc b/deps/v8/test/cctest/wasm/wasm-run-utils.cc
index f95760569f..ad57b458c6 100644
--- a/deps/v8/test/cctest/wasm/wasm-run-utils.cc
+++ b/deps/v8/test/cctest/wasm/wasm-run-utils.cc
@@ -6,6 +6,7 @@
#include "src/assembler-inl.h"
#include "src/code-tracer.h"
+#include "src/heap/heap-inl.h"
#include "src/wasm/graph-builder-interface.h"
#include "src/wasm/wasm-import-wrapper-cache-inl.h"
#include "src/wasm/wasm-memory.h"
@@ -57,7 +58,7 @@ TestingModuleBuilder::TestingModuleBuilder(
}
}
-byte* TestingModuleBuilder::AddMemory(uint32_t size) {
+byte* TestingModuleBuilder::AddMemory(uint32_t size, SharedFlag shared) {
CHECK(!test_module_->has_memory);
CHECK_NULL(mem_start_);
CHECK_EQ(0, mem_size_);
@@ -65,9 +66,16 @@ byte* TestingModuleBuilder::AddMemory(uint32_t size) {
DCHECK_IMPLIES(test_module_->origin == kWasmOrigin,
size % kWasmPageSize == 0);
test_module_->has_memory = true;
+ uint32_t max_size =
+ (test_module_->maximum_pages != 0) ? test_module_->maximum_pages : size;
uint32_t alloc_size = RoundUp(size, kWasmPageSize);
Handle<JSArrayBuffer> new_buffer;
- CHECK(NewArrayBuffer(isolate_, alloc_size).ToHandle(&new_buffer));
+ if (shared == SharedFlag::kShared) {
+ CHECK(NewSharedArrayBuffer(isolate_, alloc_size, max_size)
+ .ToHandle(&new_buffer));
+ } else {
+ CHECK(NewArrayBuffer(isolate_, alloc_size).ToHandle(&new_buffer));
+ }
CHECK(!new_buffer.is_null());
mem_start_ = reinterpret_cast<byte*>(new_buffer->backing_store());
mem_size_ = size;
@@ -75,9 +83,8 @@ byte* TestingModuleBuilder::AddMemory(uint32_t size) {
memset(mem_start_, 0, size);
// Create the WasmMemoryObject.
- Handle<WasmMemoryObject> memory_object = WasmMemoryObject::New(
- isolate_, new_buffer,
- (test_module_->maximum_pages != 0) ? test_module_->maximum_pages : -1);
+ Handle<WasmMemoryObject> memory_object =
+ WasmMemoryObject::New(isolate_, new_buffer, max_size);
instance_object_->set_memory_object(*memory_object);
WasmMemoryObject::AddInstance(isolate_, memory_object, instance_object_);
// TODO(wasm): Delete the following two lines when test-run-wasm will use a
@@ -119,8 +126,7 @@ uint32_t TestingModuleBuilder::AddFunction(FunctionSig* sig, const char* name,
}
Handle<JSFunction> TestingModuleBuilder::WrapCode(uint32_t index) {
- // Wrap the code so it can be called as a JS function.
- Link();
+ SetExecutable();
FunctionSig* sig = test_module_->functions[index].sig;
MaybeHandle<Code> maybe_ret_code =
compiler::CompileJSToWasmWrapper(isolate_, sig, false);
@@ -140,6 +146,14 @@ Handle<JSFunction> TestingModuleBuilder::WrapCode(uint32_t index) {
new_arr->set(old_arr->length(), *ret_code);
module_object->set_export_wrappers(*new_arr);
+ if (interpreter_) {
+ // Patch the jump table to call the interpreter for this function. This is
+ // only needed for functions with a wrapper. Other functions never get
+ // called through the jump table.
+ wasm::WasmCode* wasm_new_code = compiler::CompileWasmInterpreterEntry(
+ isolate_->wasm_engine(), native_module_, index, sig);
+ native_module_->PublishInterpreterEntry(wasm_new_code, index);
+ }
return ret;
}
@@ -181,12 +195,26 @@ uint32_t TestingModuleBuilder::AddBytes(Vector<const byte> bytes) {
uint32_t bytes_offset = old_size ? old_size : 1;
size_t new_size = bytes_offset + bytes.size();
OwnedVector<uint8_t> new_bytes = OwnedVector<uint8_t>::New(new_size);
- memcpy(new_bytes.start(), old_bytes.start(), old_size);
+ if (old_size > 0) {
+ memcpy(new_bytes.start(), old_bytes.start(), old_size);
+ }
memcpy(new_bytes.start() + bytes_offset, bytes.start(), bytes.length());
native_module_->SetWireBytes(std::move(new_bytes));
return bytes_offset;
}
+uint32_t TestingModuleBuilder::AddException(FunctionSig* sig) {
+ DCHECK_EQ(0, sig->return_count());
+ uint32_t index = static_cast<uint32_t>(test_module_->exceptions.size());
+ test_module_->exceptions.push_back(WasmException{sig});
+ Handle<WasmExceptionTag> tag = WasmExceptionTag::New(isolate_, index);
+ Handle<FixedArray> table(instance_object_->exceptions_table(), isolate_);
+ table = isolate_->factory()->CopyFixedArrayAndGrow(table, 1);
+ instance_object_->set_exceptions_table(*table);
+ table->set(index, *tag);
+ return index;
+}
+
CompilationEnv TestingModuleBuilder::CreateCompilationEnv() {
return {
test_module_ptr_,
@@ -219,6 +247,7 @@ Handle<WasmInstanceObject> TestingModuleBuilder::InitInstanceObject() {
native_module_->ReserveCodeTableForTesting(kMaxFunctions);
auto instance = WasmInstanceObject::New(isolate_, module_object);
+ instance->set_exceptions_table(*isolate_->factory()->empty_fixed_array());
instance->set_globals_start(globals_data_);
return instance;
}
@@ -393,15 +422,9 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
static_cast<uint32_t>(len)};
if (interpreter_) {
- // Add the code to the interpreter.
+ // Add the code to the interpreter; do not generate compiled code.
interpreter_->SetFunctionCodeForTesting(function_, start, end);
- }
-
- // TODO(wasm): tests that go through JS depend on having a compiled version
- // of each function, even if the execution tier is the interpreter. Fix.
- auto tier = builder_->execution_tier();
- if (tier == ExecutionTier::kInterpreter) {
- tier = ExecutionTier::kOptimized;
+ return;
}
Vector<const uint8_t> wire_bytes = builder_->instance_object()
@@ -419,7 +442,7 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
NativeModule* native_module =
builder_->instance_object()->module_object()->native_module();
WasmCompilationUnit unit(isolate()->wasm_engine(), function_->func_index,
- tier);
+ builder_->execution_tier());
WasmFeatures unused_detected_features;
WasmCompilationResult result = unit.ExecuteCompilation(
&env, native_module->compilation_state()->GetWireBytesStorage(),
diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.h b/deps/v8/test/cctest/wasm/wasm-run-utils.h
index af575fff77..d52d7bac76 100644
--- a/deps/v8/test/cctest/wasm/wasm-run-utils.h
+++ b/deps/v8/test/cctest/wasm/wasm-run-utils.h
@@ -39,6 +39,7 @@
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/call-tester.h"
#include "test/cctest/compiler/graph-builder-tester.h"
+#include "test/cctest/compiler/value-helper.h"
#include "test/common/wasm/flag-utils.h"
namespace v8 {
@@ -87,7 +88,7 @@ class TestingModuleBuilder {
void ChangeOriginToAsmjs() { test_module_->origin = kAsmJsOrigin; }
- byte* AddMemory(uint32_t size);
+ byte* AddMemory(uint32_t size, SharedFlag shared = SharedFlag::kNotShared);
size_t CodeTableLength() const { return native_module_->num_functions(); }
@@ -175,6 +176,7 @@ class TestingModuleBuilder {
enum FunctionType { kImport, kWasm };
uint32_t AddFunction(FunctionSig* sig, const char* name, FunctionType type);
+ // Wrap the code so it can be called as a JS function.
Handle<JSFunction> WrapCode(uint32_t index);
void AddIndirectFunctionTable(const uint16_t* function_indexes,
@@ -184,6 +186,8 @@ class TestingModuleBuilder {
uint32_t AddBytes(Vector<const byte> bytes);
+ uint32_t AddException(FunctionSig* sig);
+
WasmFunction* GetFunctionAt(int index) {
return &test_module_->functions[index];
}
@@ -201,11 +205,8 @@ class TestingModuleBuilder {
Address globals_start() const {
return reinterpret_cast<Address>(globals_data_);
}
- void Link() {
- if (linked_) return;
- linked_ = true;
- native_module_->SetExecutable(true);
- }
+
+ void SetExecutable() { native_module_->SetExecutable(true); }
CompilationEnv CreateCompilationEnv();
@@ -228,7 +229,6 @@ class TestingModuleBuilder {
ExecutionTier execution_tier_;
Handle<WasmInstanceObject> instance_object_;
NativeModule* native_module_ = nullptr;
- bool linked_ = false;
RuntimeExceptionSupport runtime_exception_support_;
LowerSimd lower_simd_;
@@ -450,7 +450,7 @@ class WasmRunner : public WasmRunnerBase {
wrapper_.SetInnerCode(builder_.GetFunctionCode(0));
wrapper_.SetInstance(builder_.instance_object());
- builder_.Link();
+ builder_.SetExecutable();
Handle<Code> wrapper_code = wrapper_.GetWrapperCode();
compiler::CodeRunner<int32_t> runner(CcTest::InitIsolateOnce(),
wrapper_code, wrapper_.signature());
@@ -474,7 +474,9 @@ class WasmRunner : public WasmRunnerBase {
thread->Reset();
std::array<WasmValue, sizeof...(p)> args{{WasmValue(p)...}};
thread->InitFrame(function(), args.data());
- if (thread->Run() == WasmInterpreter::FINISHED) {
+ thread->Run();
+ CHECK_GT(thread->NumInterpretedCalls(), 0);
+ if (thread->state() == WasmInterpreter::FINISHED) {
WasmValue val = thread->GetReturnValue();
possible_nondeterminism_ |= thread->PossibleNondeterminism();
return val.to<ReturnType>();
@@ -488,7 +490,45 @@ class WasmRunner : public WasmRunnerBase {
}
}
+ void CheckCallViaJS(double expected, uint32_t function_index,
+ Handle<Object>* buffer, int count) {
+ Isolate* isolate = builder_.isolate();
+ if (jsfuncs_.size() <= function_index) {
+ jsfuncs_.resize(function_index + 1);
+ }
+ if (jsfuncs_[function_index].is_null()) {
+ jsfuncs_[function_index] = builder_.WrapCode(function_index);
+ }
+ Handle<JSFunction> jsfunc = jsfuncs_[function_index];
+ Handle<Object> global(isolate->context()->global_object(), isolate);
+ MaybeHandle<Object> retval =
+ Execution::Call(isolate, jsfunc, global, count, buffer);
+
+ CHECK(!retval.is_null());
+ Handle<Object> result = retval.ToHandleChecked();
+ if (result->IsSmi()) {
+ CHECK_EQ(expected, Smi::ToInt(*result));
+ } else {
+ CHECK(result->IsHeapNumber());
+ CHECK_DOUBLE_EQ(expected, HeapNumber::cast(*result)->value());
+ }
+
+ if (builder_.interpret()) {
+ CHECK_GT(builder_.interpreter()->GetThread(0)->NumInterpretedCalls(), 0);
+ }
+ }
+
+ void CheckCallViaJS(double expected, ParamTypes... p) {
+ Isolate* isolate = builder_.isolate();
+ uint32_t function_index = function()->func_index;
+ Handle<Object> buffer[] = {isolate->factory()->NewNumber(p)...};
+ CheckCallViaJS(expected, function_index, buffer, sizeof...(p));
+ }
+
Handle<Code> GetWrapperCode() { return wrapper_.GetWrapperCode(); }
+
+ private:
+ std::vector<Handle<JSFunction>> jsfuncs_;
};
// A macro to define tests that run in different engine configurations.
diff --git a/deps/v8/test/common/assembler-tester.h b/deps/v8/test/common/assembler-tester.h
index 5861acd71e..4b3499b149 100644
--- a/deps/v8/test/common/assembler-tester.h
+++ b/deps/v8/test/common/assembler-tester.h
@@ -6,6 +6,7 @@
#define V8_TEST_COMMON_ASSEMBLER_TESTER_H_
#include "src/assembler.h"
+#include "src/code-desc.h"
namespace v8 {
namespace internal {
@@ -45,7 +46,7 @@ class TestingAssemblerBuffer : public AssemblerBuffer {
// some older ARM kernels there is a bug which causes an access error on
// cache flush instructions to trigger access error on non-writable memory.
// See https://bugs.chromium.org/p/v8/issues/detail?id=8157
- Assembler::FlushICache(buffer_, size_);
+ FlushInstructionCache(buffer_, size_);
bool result = SetPermissions(GetPlatformPageAllocator(), buffer_, size_,
v8::PageAllocator::kReadExecute);
diff --git a/deps/v8/test/cctest/types-fuzz.h b/deps/v8/test/common/types-fuzz.h
index b6b5bf2dc5..f539ed9701 100644
--- a/deps/v8/test/cctest/types-fuzz.h
+++ b/deps/v8/test/common/types-fuzz.h
@@ -45,13 +45,13 @@ class Types {
name = Type::name(); \
types.push_back(name);
PROPER_BITSET_TYPE_LIST(DECLARE_TYPE)
- #undef DECLARE_TYPE
+#undef DECLARE_TYPE
SignedSmall = Type::SignedSmall();
UnsignedSmall = Type::UnsignedSmall();
- object_map = isolate->factory()->NewMap(
- JS_OBJECT_TYPE, JSObject::kHeaderSize);
+ object_map =
+ isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize);
smi = handle(Smi::FromInt(666), isolate);
boxed_smi = isolate->factory()->NewHeapNumber(666);
@@ -161,9 +161,9 @@ class Types {
Type Fuzz(int depth = 4) {
switch (rng_->NextInt(depth == 0 ? 3 : 20)) {
case 0: { // bitset
- #define COUNT_BITSET_TYPES(type, value) + 1
+#define COUNT_BITSET_TYPES(type, value) +1
int n = 0 PROPER_BITSET_TYPE_LIST(COUNT_BITSET_TYPES);
- #undef COUNT_BITSET_TYPES
+#undef COUNT_BITSET_TYPES
// Pick a bunch of named bitsets and return their intersection.
Type result = Type::Any();
for (int i = 0, m = 1 + rng_->NextInt(3); i < m; ++i) {
@@ -179,7 +179,7 @@ class Types {
} \
}
PROPER_BITSET_TYPE_LIST(PICK_BITSET_TYPE)
- #undef PICK_BITSET_TYPE
+#undef PICK_BITSET_TYPE
}
return result;
}
diff --git a/deps/v8/test/common/wasm/wasm-macro-gen.h b/deps/v8/test/common/wasm/wasm-macro-gen.h
index 17045ac325..8b0aab79a9 100644
--- a/deps/v8/test/common/wasm/wasm-macro-gen.h
+++ b/deps/v8/test/common/wasm/wasm-macro-gen.h
@@ -135,6 +135,10 @@
#define WASM_IF_ELSE_X(index, cond, tstmt, fstmt) \
cond, kExprIf, static_cast<byte>(index), tstmt, kExprElse, fstmt, kExprEnd
+#define WASM_TRY_CATCH_T(t, trystmt, catchstmt) \
+ kExprTry, static_cast<byte>(ValueTypes::ValueTypeCodeFor(t)), trystmt, \
+ kExprCatch, catchstmt, kExprEnd
+
#define WASM_SELECT(tval, fval, cond) tval, fval, cond, kExprSelect
#define WASM_RETURN0 kExprReturn
@@ -154,10 +158,12 @@
#define WASM_CASE(x) static_cast<byte>(x), static_cast<byte>(x >> 8)
#define WASM_CASE_BR(x) static_cast<byte>(x), static_cast<byte>(0x80 | (x) >> 8)
+#define WASM_THROW(index) kExprThrow, static_cast<byte>(index)
+
//------------------------------------------------------------------------------
// Misc expressions.
//------------------------------------------------------------------------------
-#define WASM_ID(...) __VA_ARGS__
+#define WASM_STMTS(...) __VA_ARGS__
#define WASM_ZERO kExprI32Const, 0
#define WASM_ONE kExprI32Const, 1
@@ -348,6 +354,10 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
#define WASM_GET_GLOBAL(index) kExprGetGlobal, static_cast<byte>(index)
#define WASM_SET_GLOBAL(index, val) \
val, kExprSetGlobal, static_cast<byte>(index)
+#define WASM_GET_TABLE(table_index, index) \
+ index, kExprGetTable, static_cast<byte>(table_index)
+#define WASM_SET_TABLE(table_index, index, val) \
+ index, val, kExprSetTable, static_cast<byte>(table_index)
#define WASM_LOAD_MEM(type, index) \
index, \
static_cast<byte>(v8::internal::wasm::LoadStoreOpcodeOf(type, false)), \
@@ -377,6 +387,11 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
#define WASM_CALL_FUNCTION(index, ...) \
__VA_ARGS__, kExprCallFunction, static_cast<byte>(index)
+#define WASM_RETURN_CALL_FUNCTION0(index) \
+ kExprReturnCall, static_cast<byte>(index)
+#define WASM_RETURN_CALL_FUNCTION(index, ...) \
+ __VA_ARGS__, kExprReturnCall, static_cast<byte>(index)
+
#define TABLE_ZERO 0
// TODO(titzer): change usages of these macros to put func last.
@@ -395,6 +410,12 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
#define WASM_CALL_INDIRECTN(arity, index, func, ...) \
__VA_ARGS__, func, kExprCallIndirect, static_cast<byte>(index), TABLE_ZERO
+#define WASM_RETURN_CALL_INDIRECT0(index, func) \
+ func, kExprReturnCallIndirect, static_cast<byte>(index), TABLE_ZERO
+#define WASM_RETURN_CALL_INDIRECT(index, func, ...) \
+ __VA_ARGS__, func, kExprReturnCallIndirect, static_cast<byte>(index), \
+ TABLE_ZERO
+
#define WASM_NOT(x) x, kExprI32Eqz
#define WASM_SEQ(...) __VA_ARGS__
@@ -585,17 +606,17 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
#define MEMORY_ZERO 0
#define WASM_MEMORY_INIT(seg, dst, src, size) \
- dst, src, size, WASM_NUMERIC_OP(kExprMemoryInit), MEMORY_ZERO, U32V_1(seg)
-#define WASM_MEMORY_DROP(seg) WASM_NUMERIC_OP(kExprMemoryDrop), U32V_1(seg)
+ dst, src, size, WASM_NUMERIC_OP(kExprMemoryInit), U32V_1(seg), MEMORY_ZERO
+#define WASM_DATA_DROP(seg) WASM_NUMERIC_OP(kExprDataDrop), U32V_1(seg)
#define WASM_MEMORY_COPY(dst, src, size) \
- dst, src, size, WASM_NUMERIC_OP(kExprMemoryCopy), MEMORY_ZERO
+ dst, src, size, WASM_NUMERIC_OP(kExprMemoryCopy), MEMORY_ZERO, MEMORY_ZERO
#define WASM_MEMORY_FILL(dst, val, size) \
dst, val, size, WASM_NUMERIC_OP(kExprMemoryFill), MEMORY_ZERO
#define WASM_TABLE_INIT(seg, dst, src, size) \
- dst, src, size, WASM_NUMERIC_OP(kExprTableInit), TABLE_ZERO, U32V_1(seg)
-#define WASM_TABLE_DROP(seg) WASM_NUMERIC_OP(kExprTableDrop), U32V_1(seg)
+ dst, src, size, WASM_NUMERIC_OP(kExprTableInit), U32V_1(seg), TABLE_ZERO
+#define WASM_ELEM_DROP(seg) WASM_NUMERIC_OP(kExprElemDrop), U32V_1(seg)
#define WASM_TABLE_COPY(dst, src, size) \
- dst, src, size, WASM_NUMERIC_OP(kExprTableCopy), TABLE_ZERO
+ dst, src, size, WASM_NUMERIC_OP(kExprTableCopy), TABLE_ZERO, TABLE_ZERO
//------------------------------------------------------------------------------
// Memory Operations.
@@ -649,6 +670,8 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
#define WASM_ATOMICS_STORE_OP(op, x, y, representation) \
x, y, WASM_ATOMICS_OP(op), \
static_cast<byte>(ElementSizeLog2Of(representation)), ZERO_OFFSET
+#define WASM_ATOMICS_WAIT(op, index, value, timeout, offset) \
+ index, value, timeout, WASM_ATOMICS_OP(op), ZERO_ALIGNMENT, offset
//------------------------------------------------------------------------------
// Sign Externsion Operations.
diff --git a/deps/v8/test/common/wasm/wasm-module-runner.cc b/deps/v8/test/common/wasm/wasm-module-runner.cc
index 15e71b017d..45428cbc75 100644
--- a/deps/v8/test/common/wasm/wasm-module-runner.cc
+++ b/deps/v8/test/common/wasm/wasm-module-runner.cc
@@ -72,7 +72,10 @@ bool InterpretWasmModuleForTesting(Isolate* isolate,
size_t param_count = signature->parameter_count();
std::unique_ptr<WasmValue[]> arguments(new WasmValue[param_count]);
- memcpy(arguments.get(), args, std::min(param_count, argc));
+ size_t arg_count = std::min(param_count, argc);
+ if (arg_count > 0) {
+ memcpy(arguments.get(), args, arg_count);
+ }
// Fill the parameters up with default values.
for (size_t i = argc; i < param_count; ++i) {
diff --git a/deps/v8/test/debugger/debug/debug-evaluate-dead-function-fails.js b/deps/v8/test/debugger/debug/debug-evaluate-dead-function-fails.js
new file mode 100644
index 0000000000..ffa2916511
--- /dev/null
+++ b/deps/v8/test/debugger/debug/debug-evaluate-dead-function-fails.js
@@ -0,0 +1,35 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --no-always-opt --no-stress-opt
+
+Debug = debug.Debug
+
+var exception = null;
+function listener(event, exec_state, event_data, data) {
+ if (event != Debug.DebugEvent.Break) return;
+ try {
+ // Evaluating the live function should succeed.
+ assertEquals(exec_state.frame(0).evaluate("live()").value(), 1);
+ // Evaluating the dead function should fail.
+ assertThrows(()=>exec_state.frame(0).evaluate("dead()"), ReferenceError);
+ } catch (e) {
+ exception = e;
+ print(e + e.stack);
+ }
+}
+
+Debug.setListener(listener);
+
+(function() {
+ "use strict";
+ function live() { return 1; }
+ function dead() { return 2; }
+ // Use 'foo' to make it non-dead.
+ live;
+ debugger;
+})();
+
+Debug.setListener(null);
+assertNull(exception);
diff --git a/deps/v8/test/debugger/debug/debug-evaluate-modify-catch-block-scope.js b/deps/v8/test/debugger/debug/debug-evaluate-modify-catch-block-scope.js
index 656399b0ae..deb0d42a33 100644
--- a/deps/v8/test/debugger/debug/debug-evaluate-modify-catch-block-scope.js
+++ b/deps/v8/test/debugger/debug/debug-evaluate-modify-catch-block-scope.js
@@ -33,6 +33,8 @@ Debug.setListener(listener);
a *= 2;
e *= 2;
}
+ // Make sure bar is 'used' so that it is visible to the debugger.
+ bar;
debugger;
assertEquals(5, a);
assertEquals(7, e);
diff --git a/deps/v8/test/debugger/debug/debug-optimize.js b/deps/v8/test/debugger/debug/debug-optimize.js
index f296816aa2..7ee65e29f6 100644
--- a/deps/v8/test/debugger/debug/debug-optimize.js
+++ b/deps/v8/test/debugger/debug/debug-optimize.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --opt --no-always-opt
+// Flags: --opt --no-always-opt --turbo-inlining
var Debug = debug.Debug;
diff --git a/deps/v8/test/debugger/debug/es6/debug-step-destructuring-bind.js b/deps/v8/test/debugger/debug/es6/debug-step-destructuring-bind.js
index 8a5eaea8d2..1ada64d64e 100644
--- a/deps/v8/test/debugger/debug/es6/debug-step-destructuring-bind.js
+++ b/deps/v8/test/debugger/debug/es6/debug-step-destructuring-bind.js
@@ -26,84 +26,84 @@ function listener(event, exec_state, event_data, data) {
Debug.setListener(listener);
-var id = x => x; // B11 B12 B42 B43
+var id = x => x; // B9 B10 B36 B37
function test() {
debugger; // B0
function fx1([
- a, // B3
- b // B4
- ]) { // B2
- assertEquals([1, 2], [a, b]); // B5
- } // B6
+ a, // B2
+ b // B3
+ ]) {
+ assertEquals([1, 2], [a, b]); // B4
+ } // B5
fx1([1, 2, 3]); // B1
function f2([
- a, // B9
- b = id(3) // B10
- ]) { // B8
- assertEquals([4, 3], [a, b]); // B13
- } // B14
- f2([4]); // B7
+ a, // B7
+ b = id(3) // B8
+ ]) {
+ assertEquals([4, 3], [a, b]); // B11
+ } // B12
+ f2([4]); // B6
function f3({
- x: a, // B17
- y: b // B18
- }) { // B16
- assertEquals([5, 6], [a, b]); // B19
- } // B20
- f3({y: 6, x: 5}); // B15
+ x: a, // B14
+ y: b // B15
+ }) {
+ assertEquals([5, 6], [a, b]); // B16
+ } // B17
+ f3({y: 6, x: 5}); // B13
function f4([
- a, // B23
+ a, // B19
{
- b, // B24
- c, // B25
+ b, // B20
+ c, // B21
}
- ]) { // B22
- assertEquals([2, 4, 6], [a, b, c]); // B26
- } // B27
- f4([2, {c: 6, b: 4}]); // B21
+ ]) { // B19
+ assertEquals([2, 4, 6], [a, b, c]); // B22
+ } // B23
+ f4([2, {c: 6, b: 4}]); // B18
function f5([
{
- a, // B30
- b = 7 // B31
+ a, // B25
+ b = 7 // B26
},
- c = 3 // B32
- ] = [{a:1}]) { // B29
- assertEquals([1, 7, 3], [a, b, c]); // B33
- } // B34
- f5(); // B28
+ c = 3 // B27
+ ] = [{a:1}]) {
+ assertEquals([1, 7, 3], [a, b, c]); // B28
+ } // B29
+ f5(); // B24
- var name = "x"; // B35
+ var name = "x"; // B30
function f6({
- [id(name)]: a, // B40 B41
- b = a // B44
- }) { // B39
- assertEquals([9, 9], [a, b]); // B45
- } // B46
- var o6 = {}; // B36
- o6[name] = 9; // B37
- f6(o6); // B38
+ [id(name)]: a, // B34 B35
+ b = a // B38
+ }) {
+ assertEquals([9, 9], [a, b]); // B39
+ } // B40
+ var o6 = {}; // B31
+ o6[name] = 9; // B32
+ f6(o6); // B33
try {
- throw [3, 4]; // B47
+ throw [3, 4]; // B41
} catch ([
- a, // B49
- b, // B50
- c = 6 // B51
- ]) { // B48
- assertEquals([3, 4, 6], [a, b, c]); // B52
+ a, // B42
+ b, // B43
+ c = 6 // B44
+ ]) {
+ assertEquals([3, 4, 6], [a, b, c]); // B45
}
var {
- x: a, // B54
- y: b = 9 // B55
- } = { x: 4 }; // B53
- assertEquals([4, 9], [a, b]); // B56
-} // B57
+ x: a, // B47
+ y: b = 9 // B48
+ } = { x: 4 }; // B46
+ assertEquals([4, 9], [a, b]); // B49
+} // B50
test();
-Debug.setListener(null); // B58
+Debug.setListener(null); // B51
assertNull(exception);
diff --git a/deps/v8/test/debugger/debug/es6/debug-stepin-default-parameters.js b/deps/v8/test/debugger/debug/es6/debug-stepin-default-parameters.js
index cfc2f77e17..9f8eda5a68 100644
--- a/deps/v8/test/debugger/debug/es6/debug-stepin-default-parameters.js
+++ b/deps/v8/test/debugger/debug/es6/debug-stepin-default-parameters.js
@@ -41,5 +41,5 @@ Debug.setListener(null); // c
assertNull(exception);
assertEquals("default", result);
-assertEquals(["a0","b13","f31b13","f18b13","d2f18b13","d19f18b13","g14b13","c0"],
+assertEquals(["a0","b13","f18b13","d2f18b13","d19f18b13","g14b13","c0"],
log);
diff --git a/deps/v8/test/debugger/debug/regress-3225.js b/deps/v8/test/debugger/debug/regress-3225.js
index 454ff6e7a4..4ba6777207 100644
--- a/deps/v8/test/debugger/debug/regress-3225.js
+++ b/deps/v8/test/debugger/debug/regress-3225.js
@@ -32,6 +32,8 @@ Debug.setListener(listener);
function* generator(a, b) {
function set_a_to_5() { a = 5 }
+ // Make sure set_a_to_5 is 'used' so that it is visible to the debugger.
+ set_a_to_5;
var b = 3; // Shadows a parameter.
debugger;
yield a;
diff --git a/deps/v8/test/debugger/debug/regress/regress-1170187.js b/deps/v8/test/debugger/debug/regress/regress-1170187.js
index 832b9b753e..e41cc7ebad 100644
--- a/deps/v8/test/debugger/debug/regress/regress-1170187.js
+++ b/deps/v8/test/debugger/debug/regress/regress-1170187.js
@@ -73,7 +73,13 @@ Debug.setListener(listener);
// Call a function with local variables passing a different number parameters
// that the number of arguments.
-(function(x,y){var a,b,c; debugger; return 3})()
+(function(x,y){
+ var a,b,c;
+ // Make sure a, b, and c are used.
+ a,b,c;
+ debugger;
+ return 3
+})()
// Make sure that the debug event listener vas invoked (again).
assertTrue(listenerCalled);
diff --git a/deps/v8/test/debugger/debug/regress/regress-crbug-323936.js b/deps/v8/test/debugger/debug/regress/regress-crbug-323936.js
index 391b095a2b..17ffce1cc5 100644
--- a/deps/v8/test/debugger/debug/regress/regress-crbug-323936.js
+++ b/deps/v8/test/debugger/debug/regress/regress-crbug-323936.js
@@ -37,11 +37,16 @@ function f(e, x) {
// and 'e' binds to the exception.
function write_0(v) { e = v }
function write_1(v) { x = v }
+ // Make sure write_0 and write_1 are 'used' so that they are visible to the
+ // debugger.
+ write_0, write_1;
debugger;
assertEquals("foo", e); // overwritten by the debugger
}
assertEquals("argument", e); // debugger did not overwrite
function write_2(v) { e = v }
+ // Make sure write_2 is 'used' so that it is visible to the debugger.
+ write_2;
debugger;
assertEquals("bar", e);
assertEquals("modified", x);
diff --git a/deps/v8/test/debugger/debug/wasm/frame-inspection.js b/deps/v8/test/debugger/debug/wasm/frame-inspection.js
index b91a466a10..882b7e38b0 100644
--- a/deps/v8/test/debugger/debug/wasm/frame-inspection.js
+++ b/deps/v8/test/debugger/debug/wasm/frame-inspection.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
Debug = debug.Debug
diff --git a/deps/v8/test/debugger/debugger.status b/deps/v8/test/debugger/debugger.status
index 4f86b05769..668928137b 100644
--- a/deps/v8/test/debugger/debugger.status
+++ b/deps/v8/test/debugger/debugger.status
@@ -124,10 +124,25 @@
}], # 'arch == s390 or arch == s390x'
##############################################################################
-['lite_mode', {
+['lite_mode or variant == jitless', {
# TODO(v8:7777): Re-enable once wasm is supported in jitless mode.
'debug/wasm/*': [SKIP],
+ 'regress/regress-crbug-840288': [SKIP],
'wasm-*': [SKIP],
-}], # lite_mode
+}], # lite_mode or variant == jitless
+
+##############################################################################
+['variant == jitless', {
+ # https://crbug.com/v8/7777
+ 'debug/debug-compile-optimized': [SKIP],
+ 'debug/debug-optimize': [SKIP],
+ 'debug/lazy-deopt-then-flush-bytecode': [SKIP],
+ 'debug/regress/regress-crbug-633999': [SKIP],
+}], # variant == jitless
+
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
]
diff --git a/deps/v8/test/debugger/regress/regress-crbug-840288.js b/deps/v8/test/debugger/regress/regress-crbug-840288.js
index 013fec9f05..ff08fd90d0 100644
--- a/deps/v8/test/debugger/regress/regress-crbug-840288.js
+++ b/deps/v8/test/debugger/regress/regress-crbug-840288.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
Debug = debug.Debug
diff --git a/deps/v8/test/debugger/testcfg.py b/deps/v8/test/debugger/testcfg.py
index 61893e9bbd..eebb578fb7 100644
--- a/deps/v8/test/debugger/testcfg.py
+++ b/deps/v8/test/debugger/testcfg.py
@@ -11,22 +11,16 @@ from testrunner.objects import testcase
FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE)
+
+class TestLoader(testsuite.JSTestLoader):
+ @property
+ def excluded_files(self):
+ return {"test-api.js"}
+
+
class TestSuite(testsuite.TestSuite):
- def ListTests(self):
- tests = []
- for dirname, dirs, files in os.walk(self.root):
- for dotted in [x for x in dirs if x.startswith('.')]:
- dirs.remove(dotted)
- dirs.sort()
- files.sort()
- for filename in files:
- if (filename.endswith(".js") and filename != "test-api.js"):
- fullpath = os.path.join(dirname, filename)
- relpath = fullpath[len(self.root) + 1 : -3]
- testname = relpath.replace(os.path.sep, "/")
- test = self._create_test(testname)
- tests.append(test)
- return tests
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/fuzzer/fuzzer.status b/deps/v8/test/fuzzer/fuzzer.status
index 30bf257088..5a79a0171f 100644
--- a/deps/v8/test/fuzzer/fuzzer.status
+++ b/deps/v8/test/fuzzer/fuzzer.status
@@ -5,11 +5,17 @@
[
##############################################################################
-['lite_mode', {
+['lite_mode or variant == jitless', {
# TODO(v8:7777): Re-enable once wasm is supported in jitless mode.
'multi_return/*': [SKIP],
'wasm_async/*': [SKIP],
+ 'wasm_code/*': [SKIP],
'wasm_compile/*': [SKIP],
-}], # lite_mode
+}], # lite_mode or variant == jitless
+
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
]
diff --git a/deps/v8/test/fuzzer/multi-return.cc b/deps/v8/test/fuzzer/multi-return.cc
index 30b0020425..5db11f2168 100644
--- a/deps/v8/test/fuzzer/multi-return.cc
+++ b/deps/v8/test/fuzzer/multi-return.cc
@@ -142,7 +142,7 @@ std::unique_ptr<wasm::NativeModule> AllocateNativeModule(i::Isolate* isolate,
// We have to add the code object to a NativeModule, because the
// WasmCallDescriptor assumes that code is on the native heap and not
// within a code object.
- return isolate->wasm_engine()->code_manager()->NewNativeModule(
+ return isolate->wasm_engine()->NewNativeModule(
isolate, i::wasm::kAllWasmFeatures, code_size, false, std::move(module));
}
diff --git a/deps/v8/test/fuzzer/testcfg.py b/deps/v8/test/fuzzer/testcfg.py
index 95085885d5..f30ee07499 100644
--- a/deps/v8/test/fuzzer/testcfg.py
+++ b/deps/v8/test/fuzzer/testcfg.py
@@ -7,26 +7,35 @@ import os
from testrunner.local import testsuite
from testrunner.objects import testcase
+SUB_TESTS = [
+ 'json',
+ 'parser',
+ 'regexp_builtins',
+ 'regexp',
+ 'multi_return',
+ 'wasm',
+ 'wasm_async',
+ 'wasm_code',
+ 'wasm_compile',
+]
class VariantsGenerator(testsuite.VariantsGenerator):
def _get_variants(self, test):
return self._standard_variant
+class TestLoader(testsuite.GenericTestLoader):
+ @property
+ def test_dirs(self):
+ return SUB_TESTS
+
+ def _to_relpath(self, abspath, _):
+ return os.path.relpath(abspath, self.suite.root)
+
+
class TestSuite(testsuite.TestSuite):
- SUB_TESTS = ( 'json', 'parser', 'regexp_builtins', 'regexp', 'multi_return', 'wasm',
- 'wasm_async', 'wasm_code', 'wasm_compile')
-
- def ListTests(self):
- tests = []
- for subtest in TestSuite.SUB_TESTS:
- for fname in os.listdir(os.path.join(self.root, subtest)):
- if not os.path.isfile(os.path.join(self.root, subtest, fname)):
- continue
- test = self._create_test('%s/%s' % (subtest, fname))
- tests.append(test)
- tests.sort()
- return tests
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
@@ -37,7 +46,7 @@ class TestSuite(testsuite.TestSuite):
class TestCase(testcase.TestCase):
def _get_files_params(self):
- suite, name = self.path.split('/')
+ suite, name = self.path.split(os.path.sep)
return [os.path.join(self.suite.root, suite, name)]
def _get_variant_flags(self):
@@ -50,7 +59,7 @@ class TestCase(testcase.TestCase):
return []
def get_shell(self):
- group, _ = self.path.split('/', 1)
+ group, _ = self.path.split(os.path.sep, 1)
return 'v8_simple_%s_fuzzer' % group
diff --git a/deps/v8/test/fuzzer/wasm-fuzzer-common.cc b/deps/v8/test/fuzzer/wasm-fuzzer-common.cc
index 48c94be426..034ef731d8 100644
--- a/deps/v8/test/fuzzer/wasm-fuzzer-common.cc
+++ b/deps/v8/test/fuzzer/wasm-fuzzer-common.cc
@@ -139,7 +139,6 @@ void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes,
"can be\n"
"// found in the LICENSE file.\n"
"\n"
- "load('test/mjsunit/wasm/wasm-constants.js');\n"
"load('test/mjsunit/wasm/wasm-module-builder.js');\n"
"\n"
"(function() {\n"
diff --git a/deps/v8/test/inspector/BUILD.gn b/deps/v8/test/inspector/BUILD.gn
index f83c7d044d..f0ca9fd693 100644
--- a/deps/v8/test/inspector/BUILD.gn
+++ b/deps/v8/test/inspector/BUILD.gn
@@ -24,6 +24,7 @@ v8_executable("inspector-test") {
"../..:v8",
"../..:v8_libbase",
"../..:v8_libplatform",
+ "../../src/inspector:inspector_test_headers",
"//build/win:default_exe_manifest",
]
diff --git a/deps/v8/test/inspector/cpu-profiler/console-profile-wasm-expected.txt b/deps/v8/test/inspector/cpu-profiler/console-profile-wasm-expected.txt
new file mode 100644
index 0000000000..ad1d9db168
--- /dev/null
+++ b/deps/v8/test/inspector/cpu-profiler/console-profile-wasm-expected.txt
@@ -0,0 +1,4 @@
+Test that console profiles contain wasm function names.
+Compiling wasm.
+Running fib with increasing input until it shows up in the profile.
+Found fib in profile.
diff --git a/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js b/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js
new file mode 100644
index 0000000000..dc96406d4a
--- /dev/null
+++ b/deps/v8/test/inspector/cpu-profiler/console-profile-wasm.js
@@ -0,0 +1,80 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let {session, contextGroup, Protocol} = InspectorTest.start(
+ 'Test that console profiles contain wasm function names.');
+
+utils.load('test/mjsunit/wasm/wasm-module-builder.js');
+
+// Add fibonacci function.
+var builder = new WasmModuleBuilder();
+builder.addFunction('fib', kSig_i_i)
+ .addBody([
+ kExprGetLocal, 0,
+ kExprGetLocal, 0,
+ kExprI32Const, 2,
+ kExprI32LeS, // i < 2 ?
+ kExprBrIf, 0, // --> return i
+ kExprI32Const, 1, kExprI32Sub, // i - 1
+ kExprCallFunction, 0, // fib(i - 1)
+ kExprGetLocal, 0, kExprI32Const, 2, kExprI32Sub, // i - 2
+ kExprCallFunction, 0, // fib(i - 2)
+ kExprI32Add
+ ])
+ .exportFunc();
+let module_bytes = builder.toArray();
+
+function compile(bytes) {
+ let buffer = new ArrayBuffer(bytes.length);
+ let view = new Uint8Array(buffer);
+ for (var i = 0; i < bytes.length; i++) {
+ view[i] = bytes[i] | 0;
+ }
+ let module = new WebAssembly.Module(buffer);
+ let instance = new WebAssembly.Instance(module);
+ return instance;
+}
+
+function checkError(message)
+{
+ if (message.error) {
+ InspectorTest.log("Error: ");
+ InspectorTest.logMessage(message);
+ InspectorTest.completeTest();
+ }
+}
+
+(async function test() {
+ Protocol.Profiler.enable();
+ checkError(await Protocol.Profiler.start());
+ let found_fib_in_profile = false;
+ let finished_profiles = 0;
+ Protocol.Profiler.onConsoleProfileFinished(e => {
+ ++finished_profiles;
+ if (e.params.profile.nodes.some(n => n.callFrame.functionName === 'fib'))
+ found_fib_in_profile = true;
+ });
+ InspectorTest.log('Compiling wasm.');
+ checkError(await Protocol.Runtime.evaluate({
+ expression: 'const instance = (' + compile + ')(' +
+ JSON.stringify(module_bytes) + ');'
+ }));
+ InspectorTest.log(
+ 'Running fib with increasing input until it shows up in the profile.');
+ for (let i = 1; !found_fib_in_profile; ++i) {
+ checkError(await Protocol.Runtime.evaluate(
+ {expression: 'console.profile(\'profile\');'}));
+ checkError(await Protocol.Runtime.evaluate(
+ {expression: 'instance.exports.fib(' + i + ');'}));
+ checkError(await Protocol.Runtime.evaluate(
+ {expression: 'console.profileEnd(\'profile\');'}));
+ if (finished_profiles != i) {
+ InspectorTest.log(
+ 'Missing consoleProfileFinished message (expected ' + i + ', got ' +
+ finished_profiles + ')');
+ }
+ }
+ InspectorTest.log('Found fib in profile.');
+ InspectorTest.completeTest();
+})().catch(e => InspectorTest.log('caught: ' + e));
diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt
index 863220ca6a..78f2adb412 100644
--- a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt
+++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module-expected.txt
@@ -2,7 +2,7 @@ Tests evaluateOnCallFrame in module.
Running test: testTotal
foo1 (module1:7:2)
-foo2 (module2:6:9)
+foo2 (module2:7:9)
(anonymous) (module3:4:0)
local:foo1
[
diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js
index e656646cda..3547e9f75d 100644
--- a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js
+++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-in-module.js
@@ -14,11 +14,14 @@ export function foo1() {
let g1 = 2;
debugger;
return a1 + b1 + c1 + g1;
-}`;
+};
+export default 42;
+`;
var module2 = `
import { foo1 } from 'module1';
let a2 = 20;
+export * as mod1 from 'module1';
export let b2 = 21;
export function foo2() {
let c2 = 22;
diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt
new file mode 100644
index 0000000000..dfca60e0c2
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values-expected.txt
@@ -0,0 +1,354 @@
+Tests that exercise various result types from Debugger.evaluateOnCallFrame
+
+Running test: testCreateFunction
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : string
+ value : SUCCESS
+ }
+ }
+}
+
+Running test: testNumericValue
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : -578.28
+ type : number
+ value : -578.28
+ }
+ }
+}
+
+Running test: testUnserializableValues
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : NaN
+ type : number
+ unserializableValue : NaN
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : Infinity
+ type : number
+ unserializableValue : Infinity
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : -Infinity
+ type : number
+ unserializableValue : -Infinity
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : -0
+ type : number
+ unserializableValue : -0
+ }
+ }
+}
+
+Running test: testBooleanValue
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : boolean
+ value : true
+ }
+ }
+}
+
+Running test: testObject
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+
+Running test: testConsoleLog
+{
+ method : Runtime.consoleAPICalled
+ params : {
+ args : [
+ [0] : {
+ description : 42
+ type : number
+ value : 42
+ }
+ ]
+ executionContextId : <executionContextId>
+ stackTrace : {
+ callFrames : [
+ [0] : {
+ columnNumber : 8
+ functionName :
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ [1] : {
+ columnNumber : 0
+ functionName :
+ lineNumber : 0
+ scriptId : <scriptId>
+ url :
+ }
+ ]
+ }
+ timestamp : <timestamp>
+ type : log
+ }
+}
+
+Running test: testSymbol
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : Symbol(foo)
+ objectId : <objectId>
+ type : symbol
+ }
+ }
+}
+
+Running test: testSymbolReturnByValueError
+{
+ error : {
+ code : -32000
+ message : Object couldn't be returned by value
+ }
+ id : <messageId>
+}
+
+Running test: testPromiseResolveReturnByVal
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : object
+ value : {
+ }
+ }
+ }
+}
+
+Running test: testPromiseResolve
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Promise
+ description : Promise
+ objectId : <objectId>
+ subtype : promise
+ type : object
+ }
+ }
+}
+
+Running test: testReleaseObject
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+
+Running test: testReleaseObjectInvalid
+ReleaseObject with invalid params.
+{
+ error : {
+ code : -32602
+ data : objectId: string value expected
+ message : Invalid parameters
+ }
+ id : <messageId>
+}
+
+Running test: testObjectGroups
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+
+Running test: testReleaseObjectGroupInvalid
+ReleaseObjectGroup with invalid params
+{
+ error : {
+ code : -32602
+ data : objectGroup: string value expected
+ message : Invalid parameters
+ }
+ id : <messageId>
+}
+
+Running test: testEvaluateSyntaxError
+{
+ className : SyntaxError
+ description : SyntaxError: Unexpected token ] at <anonymous>:1:1
+ objectId : <objectId>
+ subtype : error
+ type : object
+}
+
+Running test: testEvaluateReferenceError
+{
+ className : ReferenceError
+ description : ReferenceError: totalRandomNotRealVariable789 is not defined at eval (eval at <anonymous> (:1:1), <anonymous>:1:1) at <anonymous>:1:1
+ objectId : <objectId>
+ subtype : error
+ type : object
+}
+
+Running test: testCallFrameIdTypeError
+{
+ error : {
+ code : -32602
+ data : callFrameId: string value expected
+ message : Invalid parameters
+ }
+ id : <messageId>
+}
+
+Running test: testCallFrameIdInvalidInput
+Testing evaluateOnCallFrame with non-existent callFrameId
+{
+ error : {
+ code : -32000
+ message : Invalid call frame id
+ }
+ id : <messageId>
+}
+
+Running test: testNullExpression
+{
+ error : {
+ code : -32602
+ data : expression: string value expected
+ message : Invalid parameters
+ }
+ id : <messageId>
+} \ No newline at end of file
diff --git a/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values.js b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values.js
new file mode 100644
index 0000000000..e0cc5344b7
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/evaluate-on-call-frame-return-values.js
@@ -0,0 +1,131 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+const {Protocol} = InspectorTest.start(
+ `Tests that exercise various result types from Debugger.evaluateOnCallFrame`);
+
+(async function test(){
+ await Protocol.Debugger.enable();
+ await Protocol.Runtime.enable();
+ Protocol.Runtime.evaluate({expression: "debugger;"});
+ const {params:{callFrames:[{callFrameId}]}} = await Protocol.Debugger.oncePaused();
+ InspectorTest.runAsyncTestSuite([
+ async function testCreateFunction() {
+ await evalAndLog('function testFunc() {return "SUCCESS";}; testFunc();', callFrameId, /*returnByValue*/ true );
+ },
+ async function testNumericValue() {
+ await evalAndLog('-578.28', callFrameId);
+ },
+ async function testUnserializableValues() {
+ const unserializableExpressions = ['NaN', 'Infinity', '-Infinity', '-0'];
+ for (const expression of unserializableExpressions)
+ await evalAndLog(expression, callFrameId);
+ },
+ async function testBooleanValue() {
+ await evalAndLog('Infinity > 0', callFrameId);
+ },
+ async function testObject() {
+ await evalAndLog('({ })', callFrameId);
+ },
+ async function testConsoleLog() {
+ Protocol.Debugger.evaluateOnCallFrame({ expression: `console.log(42)`, callFrameId });
+ const result = await Protocol.Runtime.onceConsoleAPICalled();
+ InspectorTest.logMessage(result);
+ },
+ async function testSymbol() {
+ await evalAndLog(`const symbolTest = Symbol('foo'); symbolTest;`, callFrameId);
+ },
+ async function testSymbolReturnByValueError() {
+ await evalAndLog(`const symbolTest = Symbol('foo'); symbolTest;`, callFrameId, /*returnByValue*/ true);
+ },
+ async function testPromiseResolveReturnByVal() {
+ await evalAndLog('Promise.resolve(239)', callFrameId, /*returnByValue*/ true);
+ },
+ async function testPromiseResolve() {
+ await evalAndLog('Promise.resolve(239)', callFrameId);
+ },
+ async function testReleaseObject() {
+ await Protocol.Runtime.evaluate({ expression: 'var a = {x:3};', callFrameId });
+ await Protocol.Runtime.evaluate({ expression: 'var b = {x:4};', callFrameId });
+ const ids = [];
+ let result = await Protocol.Runtime.evaluate({ expression: 'a', callFrameId });
+ const id1 = result.result.result.objectId;
+ ids.push(id1);
+ result = await Protocol.Runtime.evaluate({ expression: 'b', callFrameId });
+ const id2 = result.result.result.objectId;
+ ids.push(id2);
+
+ // Call Function on both objects and log:
+ await objectGroupHelper(ids);
+ Protocol.Runtime.releaseObject({ objectId: id1 });
+ await objectGroupHelper(ids);
+ Protocol.Runtime.releaseObject({ objectId: id2 });
+ await objectGroupHelper(ids);
+ },
+ async function testReleaseObjectInvalid() {
+ const releaseObjectResult = await Protocol.Runtime.releaseObject({});
+ InspectorTest.log('ReleaseObject with invalid params.');
+ InspectorTest.logMessage(releaseObjectResult);
+ },
+ async function testObjectGroups() {
+ await Protocol.Runtime.evaluate({ expression: 'var a = {x:3};', callFrameId });
+ await Protocol.Runtime.evaluate({ expression: 'var b = {x:4};', callFrameId });
+ const ids = [];
+ let result = await Protocol.Runtime.evaluate({ expression: 'a', objectGroup: 'a', callFrameId });
+ const id1 = result.result.result.objectId;
+ ids.push(id1);
+ result = await Protocol.Runtime.evaluate({ expression: 'b', objectGroup: 'b', callFrameId });
+ const id2 = result.result.result.objectId;
+ ids.push(id2);
+
+ // Call Function on both objects and log:
+ await objectGroupHelper(ids);
+ Protocol.Runtime.releaseObjectGroup({ objectGroup: 'a' });
+ await objectGroupHelper(ids);
+ Protocol.Runtime.releaseObjectGroup({ objectGroup: 'b' });
+ await objectGroupHelper(ids);
+ },
+ async function testReleaseObjectGroupInvalid() {
+ const releaseObjectGroupResult = await Protocol.Runtime.releaseObjectGroup({});
+ InspectorTest.log('ReleaseObjectGroup with invalid params');
+ InspectorTest.logMessage(releaseObjectGroupResult);
+ },
+ async function testEvaluateSyntaxError() {
+ const result = await Protocol.Debugger.evaluateOnCallFrame({ expression: `[]]`, callFrameId });
+ InspectorTest.logMessage(result.result.exceptionDetails.exception);
+ },
+ async function testEvaluateReferenceError() {
+ const result = await Protocol.Debugger.evaluateOnCallFrame({ expression: `totalRandomNotRealVariable789`, callFrameId });
+ InspectorTest.logMessage(result.result.exceptionDetails.exception);
+ },
+ async function testCallFrameIdTypeError() {
+ const result = await Protocol.Debugger.evaluateOnCallFrame({ expression: `console.log(42)`, callFrameId: {} });
+ InspectorTest.logMessage(result);
+ },
+ async function testCallFrameIdInvalidInput() {
+ InspectorTest.log('Testing evaluateOnCallFrame with non-existent callFrameId');
+ const result = await Protocol.Debugger.evaluateOnCallFrame({ expression: `console.log(42)`, callFrameId: '1234' });
+ InspectorTest.logMessage(result);
+ },
+ async function testNullExpression() {
+ await evalAndLog(null, callFrameId, /*returnByValue*/ true);
+ }
+ ]);
+
+ async function evalAndLog(expression, callFrameId, returnByValue) {
+ const result = await Protocol.Debugger.evaluateOnCallFrame({ expression, callFrameId, returnByValue });
+ InspectorTest.logMessage(result);
+ }
+
+ // Helper function that calls a function on all objects with ids in objectIds, then returns
+ async function objectGroupHelper(objectIds) {
+ return new Promise(async resolve => {
+ for (let objectId of objectIds) {
+ const result = await Protocol.Runtime.callFunctionOn({ objectId, functionDeclaration: 'function(){ return this;}' });
+ InspectorTest.logMessage(result);
+ }
+ resolve();
+ });
+ }
+})();
diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints-expected.txt b/deps/v8/test/inspector/debugger/get-possible-breakpoints-expected.txt
index b8dfd1ce3d..5ce24aa768 100644
--- a/deps/v8/test/inspector/debugger/get-possible-breakpoints-expected.txt
+++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints-expected.txt
@@ -267,7 +267,11 @@ function foo6() { Promise.resolve().then(() => 42^) }
Running test: arrowFunctionReturn
#() => #239#
#
-function foo() { function boo() { #return 239# } #}
+function foo() { function boo() { return 239 } #}
+#
+function foo() { function boo() { #return 239# }; #boo #}
+#
+function foo() { let boo = #function() { #return 239# }; #}
#
#() => { #239 #}
#
diff --git a/deps/v8/test/inspector/debugger/get-possible-breakpoints.js b/deps/v8/test/inspector/debugger/get-possible-breakpoints.js
index c3659a0240..5f52be7d5b 100644
--- a/deps/v8/test/inspector/debugger/get-possible-breakpoints.js
+++ b/deps/v8/test/inspector/debugger/get-possible-breakpoints.js
@@ -135,6 +135,8 @@ function foo6() { Promise.resolve().then(() => 42) }
checkSource('() => 239\n', { lineNumber: 0, columnNumber: 0 })
.then(() => checkSource('function foo() { function boo() { return 239 } }\n', { lineNumber: 0, columnNumber: 0 }))
+ .then(() => checkSource('function foo() { function boo() { return 239 }; boo }\n', { lineNumber: 0, columnNumber: 0 }))
+ .then(() => checkSource('function foo() { let boo = function() { return 239 }; }\n', { lineNumber: 0, columnNumber: 0 }))
.then(() => checkSource('() => { 239 }\n', { lineNumber: 0, columnNumber: 0 }))
.then(() => checkSource('function foo() { 239 }\n', { lineNumber: 0, columnNumber: 0 }))
// TODO(kozyatinskiy): lineNumber for return position should be only 9, not 8.
diff --git a/deps/v8/test/inspector/debugger/get-properties-paused-expected.txt b/deps/v8/test/inspector/debugger/get-properties-paused-expected.txt
new file mode 100644
index 0000000000..ad655f5dba
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/get-properties-paused-expected.txt
@@ -0,0 +1,89 @@
+Checks Runtime.getProperties method while debugger is paused.
+
+Running test: testObject5
+ __proto__ own object undefined
+ foo own string cat
+Internal properties
+ [[PrimitiveValue]] number 5
+
+Running test: testNotOwn
+ __defineGetter__ inherited function undefined
+ __defineSetter__ inherited function undefined
+ __lookupGetter__ inherited function undefined
+ __lookupSetter__ inherited function undefined
+ __proto__ inherited no value, getter, setter
+ a own number 2
+ b own no value, getter, setter
+ c inherited number 4
+ constructor inherited function undefined
+ d inherited no value, getter
+ hasOwnProperty inherited function undefined
+ isPrototypeOf inherited function undefined
+ propertyIsEnumerable inherited function undefined
+ toLocaleString inherited function undefined
+ toString inherited function undefined
+ valueOf inherited function undefined
+
+Running test: testAccessorsOnly
+ b own no value, getter, setter
+ d own no value, setter
+
+Running test: testArray
+ 0 own string red
+ 1 own string green
+ 2 own string blue
+ __proto__ own object undefined
+ length own number 3
+
+Running test: testBound
+ __proto__ own function undefined
+ length own number 0
+ name own string bound Number
+Internal properties
+ [[BoundArgs]] object undefined
+ [[BoundThis]] object undefined
+ [[TargetFunction]] function undefined
+
+Running test: testObjectThrowsLength
+ __proto__ own object undefined
+ length own no value, getter
+
+Running test: testTypedArrayWithoutLength
+ __proto__ own object undefined
+
+Running test: testArrayBuffer
+[[Int8Array]]
+ 0 own number 1
+ 1 own number 1
+ 2 own number 1
+ 3 own number 1
+ 4 own number 1
+ 5 own number 1
+ 6 own number 1
+ 7 own number 1
+ __proto__ own object undefined
+[[Uint8Array]]
+ 0 own number 1
+ 1 own number 1
+ 2 own number 1
+ 3 own number 1
+ 4 own number 1
+ 5 own number 1
+ 6 own number 1
+ 7 own number 1
+ __proto__ own object undefined
+[[Int16Array]]
+ 0 own number 257
+ 1 own number 257
+ 2 own number 257
+ 3 own number 257
+ __proto__ own object undefined
+[[Int32Array]]
+ 0 own number 16843009
+ 1 own number 16843009
+ __proto__ own object undefined
+
+Running test: testArrayBufferWithBrokenUintCtor
+ [[Int8Array]] own object undefined
+ [[Uint8Array]] own object undefined
+ __proto__ own object undefined
diff --git a/deps/v8/test/inspector/debugger/get-properties-paused.js b/deps/v8/test/inspector/debugger/get-properties-paused.js
new file mode 100644
index 0000000000..4c1e7b9429
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/get-properties-paused.js
@@ -0,0 +1,109 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let { Protocol } = InspectorTest.start('Checks Runtime.getProperties method while debugger is paused.');
+
+(async function test() {
+ await Protocol.Debugger.enable();
+ Protocol.Runtime.evaluate({ expression: 'debugger;' });
+ const callFrameId = (await Protocol.Debugger.oncePaused()).params.callFrames[0].callFrameId;
+
+ InspectorTest.runAsyncTestSuite([
+ function testObject5() {
+ return logExpressionProperties(`(function(){var r = Object(5); r.foo = 'cat';return r;})()`);
+ },
+
+ function testNotOwn() {
+ return logExpressionProperties(`({ a: 2, set b(_) {}, get b() {return 5;}, __proto__: { a: 3, c: 4, get d() {return 6;} }})`, { ownProperties: false });
+ },
+
+ function testAccessorsOnly() {
+ return logExpressionProperties(`({ a: 2, set b(_) {}, get b() {return 5;}, c: 'c', set d(_){} })`, { ownProperties: true, accessorPropertiesOnly: true });
+ },
+
+ function testArray() {
+ return logExpressionProperties(`['red', 'green', 'blue']`);
+ },
+
+ function testBound() {
+ return logExpressionProperties('Number.bind({}, 5)');
+ },
+
+ function testObjectThrowsLength() {
+ return logExpressionProperties(`({get length() { throw 'Length called'; }})`);
+ },
+
+ function testTypedArrayWithoutLength() {
+ return logExpressionProperties('({__proto__: Uint8Array.prototype})');
+ },
+
+ async function testArrayBuffer() {
+ let objectId = await evaluateToObjectId('new Uint8Array([1, 1, 1, 1, 1, 1, 1, 1]).buffer');
+ let props = await Protocol.Runtime.getProperties({ objectId, ownProperties: true });
+ for (let prop of props.result.result) {
+ if (prop.name === '__proto__')
+ continue;
+ InspectorTest.log(prop.name);
+ await logGetPropertiesResult(prop.value.objectId);
+ }
+ },
+
+ async function testArrayBufferWithBrokenUintCtor() {
+ await evaluateToObjectId(`(function() {
+ this.uint8array_old = this.Uint8Array;
+ this.Uint8Array = 42;
+ })()`);
+ await logExpressionProperties('new Int8Array([1, 1, 1, 1, 1, 1, 1]).buffer');
+ await evaluateToObjectId(`(function() {
+ this.Uint8Array = this.uint8array_old;
+ delete this.uint8array_old;
+ })()`);
+ }
+ ]);
+
+ async function logExpressionProperties(expression, flags) {
+ const objectId = await evaluateToObjectId(expression);
+ return await logGetPropertiesResult(objectId, flags);
+ }
+
+ async function evaluateToObjectId(expression) {
+ return (await Protocol.Debugger.evaluateOnCallFrame({ expression, callFrameId })).result.result.objectId;
+ }
+
+ async function logGetPropertiesResult(objectId, flags = { ownProperties: true }) {
+ function hasGetterSetter(property, fieldName) {
+ var v = property[fieldName];
+ if (!v) return false;
+ return v.type !== "undefined"
+ }
+
+ flags.objectId = objectId;
+ let props = await Protocol.Runtime.getProperties(flags);
+ var propertyArray = props.result.result;
+ propertyArray.sort(NamedThingComparator);
+ for (var i = 0; i < propertyArray.length; i++) {
+ var p = propertyArray[i];
+ var v = p.value;
+ var own = p.isOwn ? "own" : "inherited";
+ if (v)
+ InspectorTest.log(` ${p.name} ${own} ${v.type} ${v.value}`);
+ else
+ InspectorTest.log(` ${p.name} ${own} no value${(hasGetterSetter(p, "get") ? ", getter" : "")}${(hasGetterSetter(p, "set") ? ", setter" : "")}`);
+ }
+ var internalPropertyArray = props.result.internalProperties;
+ if (internalPropertyArray) {
+ InspectorTest.log('Internal properties');
+ internalPropertyArray.sort(NamedThingComparator);
+ for (var i = 0; i < internalPropertyArray.length; i++) {
+ var p = internalPropertyArray[i];
+ var v = p.value;
+ InspectorTest.log(` ${p.name} ${v.type} ${v.value}`);
+ }
+ }
+
+ function NamedThingComparator(o1, o2) {
+ return o1.name === o2.name ? 0 : (o1.name < o2.name ? -1 : 1);
+ }
+ }
+})();
diff --git a/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt b/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt
index 8f62c754f3..2334213124 100644
--- a/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt
+++ b/deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt
@@ -259,3 +259,39 @@ expression: Promise.resolve(42)
value : 42
}
+Running test: privateNames
+expression: new class { #foo = 1; #bar = 2; baz = 3;}
+{
+ name : #foo
+ type : number
+ value : 1
+}
+{
+ name : #bar
+ type : number
+ value : 2
+}
+{
+ name : baz
+ type : number
+ value : 3
+}
+
+expression: new class extends class { #baz = 3; } { #foo = 1; #bar = 2; }
+{
+ name : #baz
+ type : number
+ value : 3
+}
+{
+ name : #foo
+ type : number
+ value : 1
+}
+{
+ name : #bar
+ type : number
+ value : 2
+}
+
+expression: new class extends class { constructor() { return new Proxy({}, {}); } } { #foo = 1; #bar = 2; }
diff --git a/deps/v8/test/inspector/debugger/object-preview-internal-properties.js b/deps/v8/test/inspector/debugger/object-preview-internal-properties.js
index 5b1cc3b8a2..cfbdba816b 100644
--- a/deps/v8/test/inspector/debugger/object-preview-internal-properties.js
+++ b/deps/v8/test/inspector/debugger/object-preview-internal-properties.js
@@ -1,6 +1,8 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+//
+// Flags: --harmony-class-fields
let {session, contextGroup, Protocol} = InspectorTest.start("Check internal properties reported in object preview.");
@@ -72,6 +74,14 @@ InspectorTest.runTestSuite([
Protocol.Runtime.evaluate({ expression: "Array.prototype.__defineGetter__(\"0\",() => { throw new Error() }) "})
.then(() => checkExpression("Promise.resolve(42)"))
.then(next);
+ },
+
+ function privateNames(next)
+ {
+ checkExpression("new class { #foo = 1; #bar = 2; baz = 3;}")
+ .then(() => checkExpression("new class extends class { #baz = 3; } { #foo = 1; #bar = 2; }"))
+ .then(() => checkExpression("new class extends class { constructor() { return new Proxy({}, {}); } } { #foo = 1; #bar = 2; }"))
+ .then(next);
}
]);
diff --git a/deps/v8/test/inspector/debugger/set-async-call-stack-depth-expected.txt b/deps/v8/test/inspector/debugger/set-async-call-stack-depth-expected.txt
index 98fccebe68..1b92806a9d 100644
--- a/deps/v8/test/inspector/debugger/set-async-call-stack-depth-expected.txt
+++ b/deps/v8/test/inspector/debugger/set-async-call-stack-depth-expected.txt
@@ -1,37 +1,37 @@
Checks that we report not more then maxDepth call chains.
Running test: testPaused
-Actual call chain length: 8
-setAsyncCallStackDepth(maxDepth): 16
-reported: 1
-
-Actual call chain length: 8
+Actual call chain length: 4
setAsyncCallStackDepth(maxDepth): 8
-reported: 1
+reported: 4
+
+Actual call chain length: 4
+setAsyncCallStackDepth(maxDepth): 4
+reported: 4
-Actual call chain length: 8
-setAsyncCallStackDepth(maxDepth): 7
-reported: 1
+Actual call chain length: 4
+setAsyncCallStackDepth(maxDepth): 3
+reported: 3
-Actual call chain length: 8
+Actual call chain length: 4
setAsyncCallStackDepth(maxDepth): 0
reported: 0
Running test: testConsoleTrace
-Actual call chain length: 8
-setAsyncCallStackDepth(maxDepth): 16
-reported: 1
-
-Actual call chain length: 8
+Actual call chain length: 4
setAsyncCallStackDepth(maxDepth): 8
-reported: 1
+reported: 4
+
+Actual call chain length: 4
+setAsyncCallStackDepth(maxDepth): 4
+reported: 4
-Actual call chain length: 8
-setAsyncCallStackDepth(maxDepth): 7
-reported: 1
+Actual call chain length: 4
+setAsyncCallStackDepth(maxDepth): 3
+reported: 3
-Actual call chain length: 8
+Actual call chain length: 4
setAsyncCallStackDepth(maxDepth): 0
reported: 0
diff --git a/deps/v8/test/inspector/debugger/set-async-call-stack-depth.js b/deps/v8/test/inspector/debugger/set-async-call-stack-depth.js
index 0c7567f499..32d86879ac 100644
--- a/deps/v8/test/inspector/debugger/set-async-call-stack-depth.js
+++ b/deps/v8/test/inspector/debugger/set-async-call-stack-depth.js
@@ -2,57 +2,70 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// TODO(kozyatinskiy): fix or remove it later with new stack traces it's almost
-// imposible to hit limit.
let {session, contextGroup, Protocol} = InspectorTest.start('Checks that we report not more then maxDepth call chains.');
contextGroup.addScript(`
-function promisesChain(num) {
- var p = Promise.resolve();
- for (var i = 0; i < num - 1; ++i) {
- p = p.then(() => 42);
+function asyncChain(breakAtEnd) {
+ function asyncOpNested() {
+ setTimeout(asyncOpNested1, 0);
}
- return p;
+ function asyncOpNested1() {
+ setTimeout(asyncOpNested2, 0);
+ }
+ function asyncOpNested2() {
+ setTimeout(asyncOpNested3, 0);
+ }
+ function asyncOpNested3() {
+ setTimeout(asyncOpNested4, 0);
+ }
+ function asyncOpNested4() {
+ if (breakAtEnd) {
+ debugger;
+ } else {
+ console.trace(42);
+ }
+ }
+ asyncOpNested();
}
`);
Protocol.Debugger.enable();
InspectorTest.runAsyncTestSuite([
async function testPaused() {
- let callback = '() => { debugger; }';
- startTest({ generated: 8, limit: 16, callback});
+ const breakAtEnd = true;
+ startTest({ limit: 8, breakAtEnd });
dumpCaptured((await Protocol.Debugger.oncePaused()).params.asyncStackTrace);
await Protocol.Debugger.resume();
- startTest({ generated: 8, limit: 8, callback});
+ startTest({ limit: 4, breakAtEnd });
dumpCaptured((await Protocol.Debugger.oncePaused()).params.asyncStackTrace);
await Protocol.Debugger.resume();
- startTest({ generated: 8, limit: 7, callback});
+ startTest({ limit: 3, breakAtEnd });
dumpCaptured((await Protocol.Debugger.oncePaused()).params.asyncStackTrace);
await Protocol.Debugger.resume();
- startTest({ generated: 8, limit: 0, callback});
+ startTest({ limit: 0, breakAtEnd });
dumpCaptured((await Protocol.Debugger.oncePaused()).params.asyncStackTrace);
await Protocol.Debugger.resume();
},
async function testConsoleTrace() {
await Protocol.Runtime.enable();
- let callback = '() => { console.trace(42); }';
- startTest({ generated: 8, limit: 16, callback});
+ const breakAtEnd = false;
+ startTest({ limit: 8, breakAtEnd});
let msg = await Protocol.Runtime.onceConsoleAPICalled();
dumpCaptured(msg.params.stackTrace.parent);
- startTest({ generated: 8, limit: 8, callback});
+ startTest({ limit: 4, breakAtEnd});
msg = await Protocol.Runtime.onceConsoleAPICalled();
dumpCaptured(msg.params.stackTrace.parent);
- startTest({ generated: 8, limit: 7, callback});
+ startTest({ limit: 3, breakAtEnd});
msg = await Protocol.Runtime.onceConsoleAPICalled();
dumpCaptured(msg.params.stackTrace.parent);
- startTest({ generated: 8, limit: 0, callback});
+ startTest({ limit: 0, breakAtEnd});
msg = await Protocol.Runtime.onceConsoleAPICalled();
dumpCaptured(msg.params.stackTrace.parent);
@@ -61,12 +74,12 @@ InspectorTest.runAsyncTestSuite([
]);
function startTest(params) {
- InspectorTest.log('Actual call chain length: ' + params.generated);
- InspectorTest.log('setAsyncCallStackDepth(maxDepth): ' + params.limit);
+ InspectorTest.log('Actual call chain length: 4');
+ InspectorTest.log(`setAsyncCallStackDepth(maxDepth): ${params.limit}`);
Protocol.Debugger.setAsyncCallStackDepth({maxDepth: params.limit});
Protocol.Runtime.evaluate({expression:
- `promisesChain(${params.generated}).then(${params.callback})`});
+ `asyncChain(${params.breakAtEnd})`});
}
function dumpCaptured(stack) {
diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-url-regex-expected.txt b/deps/v8/test/inspector/debugger/set-breakpoint-url-regex-expected.txt
new file mode 100644
index 0000000000..0696b5bd42
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/set-breakpoint-url-regex-expected.txt
@@ -0,0 +1,30 @@
+Tests for calling setBreakpoint with urlRegex
+
+Running test: testSetBreakpointByUrlRegex
+[
+ [0] : {
+ columnNumber : 2
+ lineNumber : 2
+ scriptId : <scriptId>
+ }
+]
+Successfully paused during eval of: 'test()'
+Successfully completed eval of: 'test()'
+
+Running test: testSetBreakpointByUrlWithConditions
+[
+ [0] : {
+ columnNumber : 2
+ lineNumber : 2
+ scriptId : <scriptId>
+ }
+]
+Successfully completed eval of: 'test()'
+[
+ [0] : {
+ columnNumber : 2
+ lineNumber : 2
+ scriptId : <scriptId>
+ }
+]
+Successfully paused during eval of: 'test()' \ No newline at end of file
diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-url-regex.js b/deps/v8/test/inspector/debugger/set-breakpoint-url-regex.js
new file mode 100644
index 0000000000..046f047a2f
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/set-breakpoint-url-regex.js
@@ -0,0 +1,57 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+const { contextGroup, Protocol } = InspectorTest.start(
+ `Tests for calling setBreakpoint with urlRegex`);
+
+(async function test(){
+ await Protocol.Debugger.enable();
+ Protocol.Runtime.evaluate({expression: `
+function test() {
+ return 42;
+}
+//# sourceURL=some-kind-of-test.js`});
+ await Protocol.Debugger.onceScriptParsed();
+
+ InspectorTest.runAsyncTestSuite([
+ async function testSetBreakpointByUrlRegex() {
+ const result = await Protocol.Debugger.setBreakpointByUrl({ lineNumber: 2, urlRegex: '.*of-test.js' });
+ InspectorTest.logMessage(result.result.locations);
+ await expectBreakInEval('test()');
+ await Protocol.Debugger.removeBreakpoint({ breakpointId: result.result.breakpointId });
+ await expectNoBreakInEval('test()');
+ },
+ async function testSetBreakpointByUrlWithConditions() {
+ // Test Condition false
+ let result = await Protocol.Debugger.setBreakpointByUrl({ lineNumber: 2, urlRegex: '.*of-test.js', condition: 'false' });
+ InspectorTest.logMessage(result.result.locations);
+ await expectNoBreakInEval('test()');
+ await Protocol.Debugger.removeBreakpoint({ breakpointId: result.result.breakpointId });
+
+ // Test condition true
+ result = await Protocol.Debugger.setBreakpointByUrl({ lineNumber: 2, urlRegex: '.*of-test.js', condition: 'true' });
+ InspectorTest.logMessage(result.result.locations);
+ await expectBreakInEval('test()');
+ await Protocol.Debugger.removeBreakpoint({ breakpointId: result.result.breakpointId });
+ },
+ ]);
+
+ // Function that will evaluate an expression and return once completed.
+ // Used to validate that breakpoint is not hit within the evaluated expression.
+ async function expectNoBreakInEval(expression) {
+ await Protocol.Runtime.evaluate({expression});
+ InspectorTest.log(`Successfully completed eval of: '${expression}'`);
+ }
+
+ // Function that will evaluate an expression and return once a paused event is received
+ // and the debugger is resumed.
+ // Used to validate that breakpoint is hit within the evaluated expression.
+ async function expectBreakInEval(expression) {
+ Protocol.Runtime.evaluate({expression});
+ await Protocol.Debugger.oncePaused();
+ InspectorTest.log(`Successfully paused during eval of: '${expression}'`);
+ await Protocol.Debugger.resume();
+ }
+
+})();
diff --git a/deps/v8/test/inspector/debugger/set-variable-value-expected.txt b/deps/v8/test/inspector/debugger/set-variable-value-expected.txt
new file mode 100644
index 0000000000..33bdfd1706
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/set-variable-value-expected.txt
@@ -0,0 +1,260 @@
+Tests that exercise Debugger.setVariableValue
+
+Running test: testSetVariableValueMain
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 5
+ type : number
+ value : 5
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : 10
+ type : number
+ value : 10
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ description : NaN
+ type : number
+ unserializableValue : NaN
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ type : boolean
+ value : true
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ configurable : true
+ enumerable : true
+ isOwn : true
+ name : a
+ value : {
+ description : 3
+ type : number
+ value : 3
+ }
+ writable : true
+ }
+ [1] : {
+ configurable : true
+ enumerable : false
+ isOwn : true
+ name : __proto__
+ value : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ writable : true
+ }
+ ]
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Array
+ description : Array(3)
+ objectId : <objectId>
+ subtype : array
+ type : object
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ configurable : true
+ enumerable : true
+ isOwn : true
+ name : 0
+ value : {
+ type : string
+ value : 1
+ }
+ writable : true
+ }
+ [1] : {
+ configurable : true
+ enumerable : true
+ isOwn : true
+ name : 1
+ value : {
+ type : string
+ value : 2
+ }
+ writable : true
+ }
+ [2] : {
+ configurable : true
+ enumerable : true
+ isOwn : true
+ name : 2
+ value : {
+ type : string
+ value : 3
+ }
+ writable : true
+ }
+ [3] : {
+ configurable : false
+ enumerable : false
+ isOwn : true
+ name : length
+ value : {
+ description : 3
+ type : number
+ value : 3
+ }
+ writable : true
+ }
+ [4] : {
+ configurable : true
+ enumerable : false
+ isOwn : true
+ name : __proto__
+ value : {
+ className : Array
+ description : Array(0)
+ objectId : <objectId>
+ subtype : array
+ type : object
+ }
+ writable : true
+ }
+ ]
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+{
+ id : <messageId>
+ result : {
+ result : [
+ [0] : {
+ configurable : true
+ enumerable : true
+ isOwn : true
+ name : b
+ value : {
+ description : 4
+ type : number
+ value : 4
+ }
+ writable : true
+ }
+ [1] : {
+ configurable : true
+ enumerable : false
+ isOwn : true
+ name : __proto__
+ value : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ writable : true
+ }
+ ]
+ }
+}
+
+Running test: testInvalidFrame
+setVariableValue with invalid callFrameId
+{
+ error : {
+ code : -32000
+ message : Invalid call frame id
+ }
+ id : <messageId>
+}
+setVariableValue with invalid scopeNumber
+{
+ error : {
+ code : -32602
+ data : scopeNumber: integer value expected
+ message : Invalid parameters
+ }
+ id : <messageId>
+}
+setVariableValue with invalid scopeNumber
+{
+ error : {
+ code : -32000
+ message : Could not find scope with given number
+ }
+ id : <messageId>
+}
+setVariableValue with invalid variableName
+{
+ error : {
+ code : -32603
+ message : Internal error
+ }
+ id : <messageId>
+}
+
+Running test: testNewValueErrors
+setVariableValue with invalid unserializableValue
+{
+ error : {
+ code : -32000
+ message : Couldn't parse value object in call argument
+ }
+ id : <messageId>
+}
+setVariableValue with invalid objectId
+{
+ error : {
+ code : -32602
+ data : newValue.objectId: string value expected
+ message : Invalid parameters
+ }
+ id : <messageId>
+} \ No newline at end of file
diff --git a/deps/v8/test/inspector/debugger/set-variable-value.js b/deps/v8/test/inspector/debugger/set-variable-value.js
new file mode 100644
index 0000000000..48bde89fbf
--- /dev/null
+++ b/deps/v8/test/inspector/debugger/set-variable-value.js
@@ -0,0 +1,90 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --no-always-opt
+
+const { contextGroup, Protocol } = InspectorTest.start(
+ `Tests that exercise Debugger.setVariableValue`);
+
+(async function test(){
+ await Protocol.Debugger.enable();
+ await Protocol.Runtime.enable();
+ contextGroup.addInlineScript(`
+ function test() {
+ let num = 5;
+ let obj = {b: 4};
+ let bool = true;
+ let set_breakpoint_here = true;
+ debugger;
+ }
+ `, 'test.js');
+ Protocol.Runtime.evaluate({expression: "test();"});
+ const {params:{callFrames:[{callFrameId}]}} = await Protocol.Debugger.oncePaused();
+ InspectorTest.runAsyncTestSuite([
+ async function testSetVariableValueMain() {
+ // Set value to a Number
+ let result = await Protocol.Debugger.evaluateOnCallFrame({ expression: 'num', callFrameId });
+ InspectorTest.logMessage(result);
+ await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { value: 10 }, callFrameId });
+ result = await Protocol.Debugger.evaluateOnCallFrame({ expression: 'num', callFrameId });
+ InspectorTest.logMessage(result);
+
+ // Set Value to NaN
+ await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { unserializableValue: 'NaN' }, callFrameId });
+ result = await Protocol.Debugger.evaluateOnCallFrame({ expression: 'num', callFrameId });
+ InspectorTest.logMessage(result);
+
+ // Set Value to boolean:true
+ await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { value: true }, callFrameId });
+ result = await Protocol.Debugger.evaluateOnCallFrame({ expression: 'num', callFrameId });
+ InspectorTest.logMessage(result);
+
+ // Set Value to a new object
+ await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { value: { a: 3 } }, callFrameId });
+ result = await Protocol.Debugger.evaluateOnCallFrame({ expression: 'num', callFrameId });
+ InspectorTest.logMessage(result);
+ let props = await Protocol.Runtime.getProperties({ objectId: result.result.result.objectId, ownProperties: true });
+ InspectorTest.logMessage(props);
+
+ // Set Value to new Array
+ await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { value: ['1', '2', '3'] }, callFrameId });
+ result = await Protocol.Debugger.evaluateOnCallFrame({ expression: 'num', callFrameId });
+ InspectorTest.logMessage(result);
+ props = await Protocol.Runtime.getProperties({ objectId: result.result.result.objectId, ownProperties: true });
+ InspectorTest.logMessage(props);
+
+ // Set Value to existing object with objectId
+ result = await Protocol.Debugger.evaluateOnCallFrame({ expression: 'obj', callFrameId: callFrameId });
+ let objectId = result.result.result.objectId;
+ await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { objectId: objectId }, callFrameId: callFrameId });
+ result = await Protocol.Debugger.evaluateOnCallFrame({ expression: 'num', callFrameId: callFrameId });
+ InspectorTest.logMessage(result);
+ props = await Protocol.Runtime.getProperties({ objectId: result.result.result.objectId, ownProperties: true });
+ InspectorTest.logMessage(props);
+ },
+ async function testInvalidFrame() {
+ let result = await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { unserializableValue: 'NaN' }, callFrameId: 'fakeCallFrame' });
+ InspectorTest.log('setVariableValue with invalid callFrameId');
+ InspectorTest.logMessage(result);
+ result = await Protocol.Debugger.setVariableValue({ scopeNumber: 'invalidScopeType', variableName: 'num', newValue: { unserializableValue: 'NaN' }, callFrameId });
+ InspectorTest.log('setVariableValue with invalid scopeNumber')
+ InspectorTest.logMessage(result);
+ result = await Protocol.Debugger.setVariableValue({ scopeNumber: 1000, variableName: 'num', newValue: { unserializableValue: 'NaN' }, callFrameId });
+ InspectorTest.log('setVariableValue with invalid scopeNumber');
+ InspectorTest.logMessage(result);
+ result = await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'FakeObjectName', newValue: { unserializableValue: 'NaN' }, callFrameId });
+ InspectorTest.log('setVariableValue with invalid variableName');
+ InspectorTest.logMessage(result);
+ },
+ async function testNewValueErrors() {
+ let result = await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { unserializableValue: 'not unserializable value' }, callFrameId });
+ InspectorTest.log('setVariableValue with invalid unserializableValue');
+ InspectorTest.logMessage(result);
+ result = await Protocol.Debugger.setVariableValue({ scopeNumber: 0, variableName: 'num', newValue: { objectId: 2000 }, callFrameId });
+ InspectorTest.log('setVariableValue with invalid objectId');
+ InspectorTest.logMessage(result);
+ }
+ ]);
+
+})();
diff --git a/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js b/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js
index 4e7d9e9815..a070334980 100644
--- a/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js
+++ b/deps/v8/test/inspector/debugger/side-effect-free-debug-evaluate.js
@@ -10,6 +10,7 @@ function testFunction()
var o = 0;
function f() { return 1; }
function g() { o = 2; return o; }
+ f,g;
debugger;
}
//# sourceURL=foo.js`);
diff --git a/deps/v8/test/inspector/debugger/step-snapshot-expected.txt b/deps/v8/test/inspector/debugger/step-snapshot-expected.txt
index 0d8d039538..f75a184252 100644
--- a/deps/v8/test/inspector/debugger/step-snapshot-expected.txt
+++ b/deps/v8/test/inspector/debugger/step-snapshot-expected.txt
@@ -11,12 +11,6 @@ paused
}
paused
-function c(f#, ...args) { return f(...args); }
-
-paused
-function c(f, ...args#) { return f(...args); }
-
-paused
function c(f, ...args) { #return f(...args); }
paused
diff --git a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js
index ea2a116be5..f0c20b3955 100644
--- a/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js
+++ b/deps/v8/test/inspector/debugger/wasm-get-breakable-locations.js
@@ -6,7 +6,6 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Tests breakable locations in wasm');
-utils.load('test/mjsunit/wasm/wasm-constants.js');
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/inspector/debugger/wasm-imports.js b/deps/v8/test/inspector/debugger/wasm-imports.js
index dbe96ce671..0d83917fa9 100644
--- a/deps/v8/test/inspector/debugger/wasm-imports.js
+++ b/deps/v8/test/inspector/debugger/wasm-imports.js
@@ -4,7 +4,6 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Tests imports in wasm');
-utils.load('test/mjsunit/wasm/wasm-constants.js');
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
// Build two modules A and B. A defines function func, which contains a
diff --git a/deps/v8/test/inspector/debugger/wasm-reset-context-group.js b/deps/v8/test/inspector/debugger/wasm-reset-context-group.js
index be347c0736..c1353da86b 100644
--- a/deps/v8/test/inspector/debugger/wasm-reset-context-group.js
+++ b/deps/v8/test/inspector/debugger/wasm-reset-context-group.js
@@ -4,7 +4,6 @@
InspectorTest.log('Checks resetting context group with wasm.');
-utils.load('test/mjsunit/wasm/wasm-constants.js');
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/inspector/debugger/wasm-scope-info.js b/deps/v8/test/inspector/debugger/wasm-scope-info.js
index 290bd58412..f7a0df497f 100644
--- a/deps/v8/test/inspector/debugger/wasm-scope-info.js
+++ b/deps/v8/test/inspector/debugger/wasm-scope-info.js
@@ -30,7 +30,6 @@ async function printPauseLocationsAndContinue() {
}
async function instantiateWasm() {
- utils.load('test/mjsunit/wasm/wasm-constants.js');
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/inspector/debugger/wasm-scripts.js b/deps/v8/test/inspector/debugger/wasm-scripts.js
index 0993f11b53..04e5ec88c1 100644
--- a/deps/v8/test/inspector/debugger/wasm-scripts.js
+++ b/deps/v8/test/inspector/debugger/wasm-scripts.js
@@ -6,7 +6,6 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Tests how wasm scripts are reported');
-utils.load('test/mjsunit/wasm/wasm-constants.js');
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
// Add two empty functions. Both should be registered as individual scripts at
diff --git a/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js b/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js
index 76a831392f..a9b676f8a7 100644
--- a/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js
+++ b/deps/v8/test/inspector/debugger/wasm-set-breakpoint.js
@@ -5,7 +5,6 @@
const {session, contextGroup, Protocol} =
InspectorTest.start('Tests stepping through wasm scripts.');
-utils.load('test/mjsunit/wasm/wasm-constants.js');
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/inspector/debugger/wasm-source.js b/deps/v8/test/inspector/debugger/wasm-source.js
index bf7bab735c..6c5b14c4be 100644
--- a/deps/v8/test/inspector/debugger/wasm-source.js
+++ b/deps/v8/test/inspector/debugger/wasm-source.js
@@ -6,7 +6,6 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Tests how wasm scrips report the source');
-utils.load('test/mjsunit/wasm/wasm-constants.js');
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/inspector/debugger/wasm-stack.js b/deps/v8/test/inspector/debugger/wasm-stack.js
index 0234dabe79..0e2ff0fa8e 100644
--- a/deps/v8/test/inspector/debugger/wasm-stack.js
+++ b/deps/v8/test/inspector/debugger/wasm-stack.js
@@ -6,7 +6,6 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Tests call stack in wasm scripts');
-utils.load('test/mjsunit/wasm/wasm-constants.js');
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js
index 7732e1396e..1c9ec95577 100644
--- a/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js
+++ b/deps/v8/test/inspector/debugger/wasm-stepping-with-source-map.js
@@ -5,7 +5,6 @@
let {session, contextGroup, Protocol} =
InspectorTest.start('Tests stepping through wasm scripts with source maps');
-utils.load('test/mjsunit/wasm/wasm-constants.js');
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/inspector/debugger/wasm-stepping.js b/deps/v8/test/inspector/debugger/wasm-stepping.js
index d3a2c64048..0fda6b73be 100644
--- a/deps/v8/test/inspector/debugger/wasm-stepping.js
+++ b/deps/v8/test/inspector/debugger/wasm-stepping.js
@@ -4,7 +4,6 @@
let {session, contextGroup, Protocol} = InspectorTest.start('Tests stepping through wasm scripts');
-utils.load('test/mjsunit/wasm/wasm-constants.js');
utils.load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/inspector/inspector.status b/deps/v8/test/inspector/inspector.status
index b4f04ce7b0..4b7c312785 100644
--- a/deps/v8/test/inspector/inspector.status
+++ b/deps/v8/test/inspector/inspector.status
@@ -35,7 +35,7 @@
}], # variant != default
##############################################################################
-['lite_mode', {
+['lite_mode or variant == jitless', {
# Lite mode does not allocate feedback vector.
'type-profiler/type-profile-start-stop': [SKIP],
'type-profiler/type-profile': [SKIP],
@@ -48,7 +48,15 @@
'debugger/asm-js-breakpoint-before-exec': [SKIP],
'debugger/asm-js-breakpoint-during-exec': [SKIP],
'debugger/wasm-*': [SKIP],
-}], # 'lite_mode'
+ 'cpu-profiler/console-profile-wasm': [SKIP],
+}], # 'lite_mode or variant == jitless'
+
+##############################################################################
+['variant == jitless', {
+ # https://crbug.com/v8/7777
+ 'cpu-profiler/coverage': [SKIP],
+ 'cpu-profiler/coverage-block': [SKIP],
+}], # variant == jitless
##############################################################################
['(arch == arm or arch == arm64) and simulator_run', {
@@ -73,4 +81,9 @@
'debugger/pause-on-oom': [SKIP],
}],
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
+
]
diff --git a/deps/v8/test/inspector/isolate-data.cc b/deps/v8/test/inspector/isolate-data.cc
index 2a5f8e1c84..3cdd1f968c 100644
--- a/deps/v8/test/inspector/isolate-data.cc
+++ b/deps/v8/test/inspector/isolate-data.cc
@@ -111,6 +111,7 @@ v8::Local<v8::Context> IsolateData::GetContext(int context_group_id) {
}
void IsolateData::ResetContextGroup(int context_group_id) {
+ v8::SealHandleScope seal_handle_scope(isolate());
inspector_->resetContextGroup(context_group_id);
}
@@ -149,6 +150,7 @@ v8::MaybeLocal<v8::Module> IsolateData::ModuleResolveCallback(
int IsolateData::ConnectSession(int context_group_id,
const v8_inspector::StringView& state,
v8_inspector::V8Inspector::Channel* channel) {
+ v8::SealHandleScope seal_handle_scope(isolate());
int session_id = ++last_session_id_;
sessions_[session_id] = inspector_->connect(context_group_id, channel, state);
context_group_by_session_[sessions_[session_id].get()] = context_group_id;
@@ -157,6 +159,7 @@ int IsolateData::ConnectSession(int context_group_id,
std::unique_ptr<v8_inspector::StringBuffer> IsolateData::DisconnectSession(
int session_id) {
+ v8::SealHandleScope seal_handle_scope(isolate());
auto it = sessions_.find(session_id);
CHECK(it != sessions_.end());
context_group_by_session_.erase(it->second.get());
@@ -167,6 +170,7 @@ std::unique_ptr<v8_inspector::StringBuffer> IsolateData::DisconnectSession(
void IsolateData::SendMessage(int session_id,
const v8_inspector::StringView& message) {
+ v8::SealHandleScope seal_handle_scope(isolate());
auto it = sessions_.find(session_id);
if (it != sessions_.end()) it->second->dispatchProtocolMessage(message);
}
@@ -174,6 +178,7 @@ void IsolateData::SendMessage(int session_id,
void IsolateData::BreakProgram(int context_group_id,
const v8_inspector::StringView& reason,
const v8_inspector::StringView& details) {
+ v8::SealHandleScope seal_handle_scope(isolate());
for (int session_id : GetSessionIds(context_group_id)) {
auto it = sessions_.find(session_id);
if (it != sessions_.end()) it->second->breakProgram(reason, details);
@@ -183,6 +188,7 @@ void IsolateData::BreakProgram(int context_group_id,
void IsolateData::SchedulePauseOnNextStatement(
int context_group_id, const v8_inspector::StringView& reason,
const v8_inspector::StringView& details) {
+ v8::SealHandleScope seal_handle_scope(isolate());
for (int session_id : GetSessionIds(context_group_id)) {
auto it = sessions_.find(session_id);
if (it != sessions_.end())
@@ -191,6 +197,7 @@ void IsolateData::SchedulePauseOnNextStatement(
}
void IsolateData::CancelPauseOnNextStatement(int context_group_id) {
+ v8::SealHandleScope seal_handle_scope(isolate());
for (int session_id : GetSessionIds(context_group_id)) {
auto it = sessions_.find(session_id);
if (it != sessions_.end()) it->second->cancelPauseOnNextStatement();
@@ -199,34 +206,41 @@ void IsolateData::CancelPauseOnNextStatement(int context_group_id) {
void IsolateData::AsyncTaskScheduled(const v8_inspector::StringView& name,
void* task, bool recurring) {
+ v8::SealHandleScope seal_handle_scope(isolate());
inspector_->asyncTaskScheduled(name, task, recurring);
}
void IsolateData::AsyncTaskStarted(void* task) {
+ v8::SealHandleScope seal_handle_scope(isolate());
inspector_->asyncTaskStarted(task);
}
void IsolateData::AsyncTaskFinished(void* task) {
+ v8::SealHandleScope seal_handle_scope(isolate());
inspector_->asyncTaskFinished(task);
}
v8_inspector::V8StackTraceId IsolateData::StoreCurrentStackTrace(
const v8_inspector::StringView& description) {
+ v8::SealHandleScope seal_handle_scope(isolate());
return inspector_->storeCurrentStackTrace(description);
}
void IsolateData::ExternalAsyncTaskStarted(
const v8_inspector::V8StackTraceId& parent) {
+ v8::SealHandleScope seal_handle_scope(isolate());
inspector_->externalAsyncTaskStarted(parent);
}
void IsolateData::ExternalAsyncTaskFinished(
const v8_inspector::V8StackTraceId& parent) {
+ v8::SealHandleScope seal_handle_scope(isolate());
inspector_->externalAsyncTaskFinished(parent);
}
void IsolateData::AddInspectedObject(int session_id,
v8::Local<v8::Value> object) {
+ v8::SealHandleScope seal_handle_scope(isolate());
auto it = sessions_.find(session_id);
if (it == sessions_.end()) return;
std::unique_ptr<Inspectable> inspectable(
@@ -235,10 +249,12 @@ void IsolateData::AddInspectedObject(int session_id,
}
void IsolateData::SetMaxAsyncTaskStacksForTest(int limit) {
+ v8::SealHandleScope seal_handle_scope(isolate());
v8_inspector::SetMaxAsyncTaskStacksForTest(inspector_.get(), limit);
}
void IsolateData::DumpAsyncTaskStacksStateForTest() {
+ v8::SealHandleScope seal_handle_scope(isolate());
v8_inspector::DumpAsyncTaskStacksStateForTest(inspector_.get());
}
@@ -275,6 +291,7 @@ int IsolateData::HandleMessage(v8::Local<v8::Message> message,
}
v8_inspector::StringView url(url_string.start(), url_string.length());
+ v8::SealHandleScope seal_handle_scope(isolate);
return inspector->exceptionThrown(
context, message_text, exception, detailed_message, url, line_number,
column_number, inspector->createStackTrace(stack), script_id);
@@ -303,6 +320,7 @@ void IsolateData::PromiseRejectHandler(v8::PromiseRejectMessage data) {
if (!id->IsInt32()) return;
v8_inspector::V8Inspector* inspector =
IsolateData::FromContext(context)->inspector_.get();
+ v8::SealHandleScope seal_handle_scope(isolate);
const char* reason_str = "Handler added to rejected promise";
inspector->exceptionRevoked(
context, id.As<v8::Int32>()->Value(),
@@ -327,10 +345,12 @@ void IsolateData::FireContextCreated(v8::Local<v8::Context> context,
v8_inspector::V8ContextInfo info(context, context_group_id,
v8_inspector::StringView());
info.hasMemoryOnConsole = true;
+ v8::SealHandleScope seal_handle_scope(isolate());
inspector_->contextCreated(info);
}
void IsolateData::FireContextDestroyed(v8::Local<v8::Context> context) {
+ v8::SealHandleScope seal_handle_scope(isolate());
inspector_->contextDestroyed(context);
}
@@ -406,10 +426,14 @@ v8::MaybeLocal<v8::Value> IsolateData::memoryInfo(v8::Isolate* isolate,
}
void IsolateData::runMessageLoopOnPause(int) {
+ v8::SealHandleScope seal_handle_scope(isolate());
task_runner_->RunMessageLoop(true);
}
-void IsolateData::quitMessageLoopOnPause() { task_runner_->QuitMessageLoop(); }
+void IsolateData::quitMessageLoopOnPause() {
+ v8::SealHandleScope seal_handle_scope(isolate());
+ task_runner_->QuitMessageLoop();
+}
void IsolateData::consoleAPIMessage(int contextGroupId,
v8::Isolate::MessageErrorLevel level,
diff --git a/deps/v8/test/inspector/runtime/exceptionthrown-on-connect-expected.txt b/deps/v8/test/inspector/runtime/exceptionthrown-on-connect-expected.txt
new file mode 100644
index 0000000000..4bcde813fc
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/exceptionthrown-on-connect-expected.txt
@@ -0,0 +1,46 @@
+Tests that Runtime throws exceptions after enabling domain on scripts with errors.
+Enabling Runtime Domain.
+{
+ method : Runtime.exceptionThrown
+ params : {
+ exceptionDetails : {
+ columnNumber : 12
+ exception : {
+ className : SyntaxError
+ description : SyntaxError: Unexpected token ;
+ objectId : <objectId>
+ subtype : error
+ type : object
+ }
+ exceptionId : <exceptionId>
+ executionContextId : <executionContextId>
+ lineNumber : 1
+ scriptId : <scriptId>
+ text : Uncaught SyntaxError: Unexpected token ;
+ url : syntaxError.js
+ }
+ timestamp : <timestamp>
+ }
+}
+{
+ method : Runtime.exceptionThrown
+ params : {
+ exceptionDetails : {
+ columnNumber : 12
+ exception : {
+ className : ReferenceError
+ description : ReferenceError: y is not defined at referenceError.js:2:13
+ objectId : <objectId>
+ subtype : error
+ type : object
+ }
+ exceptionId : <exceptionId>
+ executionContextId : <executionContextId>
+ lineNumber : 1
+ scriptId : <scriptId>
+ text : Uncaught ReferenceError: y is not defined
+ url : referenceError.js
+ }
+ timestamp : <timestamp>
+ }
+}
diff --git a/deps/v8/test/inspector/runtime/exceptionthrown-on-connect.js b/deps/v8/test/inspector/runtime/exceptionthrown-on-connect.js
new file mode 100644
index 0000000000..583459c312
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/exceptionthrown-on-connect.js
@@ -0,0 +1,25 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+const {Protocol, contextGroup} = InspectorTest.start(
+ `Tests that Runtime throws exceptions after enabling domain on scripts with errors.`);
+
+(async function test(){
+ // Log all exceptions thrown
+ Protocol.Runtime.onExceptionThrown(exception => {
+ InspectorTest.logMessage(exception);
+ });
+ // Add scripts with syntax and reference errors
+ contextGroup.addScript(
+ `
+ var x = ;
+ //# sourceURL=syntaxError.js`);
+ contextGroup.addScript(
+ `
+ var x = y;
+ //# sourceURL=referenceError.js`);
+ InspectorTest.log('Enabling Runtime Domain.');
+ await Protocol.Runtime.enable();
+ InspectorTest.completeTest();
+})();
diff --git a/deps/v8/test/inspector/runtime/release-object-expected.txt b/deps/v8/test/inspector/runtime/release-object-expected.txt
new file mode 100644
index 0000000000..4c479c7558
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/release-object-expected.txt
@@ -0,0 +1,157 @@
+Tests that Runtime can properly release objects and object groups.
+
+Running test: testReleaseObject
+Evaluating 'var a = {x:3};'
+Evaluating 'var b = {x:4};'
+Evaluate 'this' for object a
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+Evaluate 'this' for object b
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+Release "a"
+Evaluate 'this' for object a
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+Evaluate 'this' for object b
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+Release "b"
+Evaluate 'this' for object a
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+Evaluate 'this' for object b
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+
+Running test: testReleaseObjectInvalid
+ReleaseObject with invalid params.
+{
+ error : {
+ code : -32602
+ data : objectId: string value expected
+ message : Invalid parameters
+ }
+ id : <messageId>
+}
+
+Running test: testObjectGroups
+Evaluating 'var a = {x:3};'
+Evaluating 'var b = {x:4};'
+Evaluate "a" in objectGroup "x"
+Evaluate "b" in objectGroup "y"
+Evaluate 'this' for object a
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+Evaluate 'this' for object b
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+Release objectGroup "x"
+Evaluate 'this' for object a
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+Evaluate 'this' for object b
+{
+ id : <messageId>
+ result : {
+ result : {
+ className : Object
+ description : Object
+ objectId : <objectId>
+ type : object
+ }
+ }
+}
+Release objectGroup "y"
+Evaluate 'this' for object a
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+Evaluate 'this' for object b
+{
+ error : {
+ code : -32000
+ message : Could not find object with given id
+ }
+ id : <messageId>
+}
+
+Running test: testReleaseObjectGroupInvalid
+ReleaseObjectGroup with invalid params
+{
+ error : {
+ code : -32602
+ data : objectGroup: string value expected
+ message : Invalid parameters
+ }
+ id : <messageId>
+} \ No newline at end of file
diff --git a/deps/v8/test/inspector/runtime/release-object.js b/deps/v8/test/inspector/runtime/release-object.js
new file mode 100644
index 0000000000..ae388ff9c4
--- /dev/null
+++ b/deps/v8/test/inspector/runtime/release-object.js
@@ -0,0 +1,79 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+const {Protocol} = InspectorTest.start(
+ `Tests that Runtime can properly release objects and object groups.`);
+
+(async function test(){
+ await Protocol.Runtime.enable();
+ InspectorTest.runAsyncTestSuite([
+ async function testReleaseObject() {
+ await logAndEvaluate('var a = {x:3};');
+ await logAndEvaluate('var b = {x:4};');
+ const ids = [];
+ let result = await Protocol.Runtime.evaluate({ expression: 'a' });
+ const id1 = result.result.result.objectId;
+ ids.push({id: id1, name: 'a'});
+ result = await Protocol.Runtime.evaluate({ expression: 'b' });
+ const id2 = result.result.result.objectId;
+ ids.push({id: id2, name: 'b'});
+
+ // Call Function on both objects and log:
+ await objectGroupHelper(ids);
+ InspectorTest.log('Release "a"');
+ Protocol.Runtime.releaseObject({ objectId: id1 });
+ await objectGroupHelper(ids);
+ InspectorTest.log('Release "b"');
+ Protocol.Runtime.releaseObject({ objectId: id2 });
+ await objectGroupHelper(ids);
+ },
+ async function testReleaseObjectInvalid() {
+ const releaseObjectResult = await Protocol.Runtime.releaseObject({});
+ InspectorTest.log('ReleaseObject with invalid params.');
+ InspectorTest.logMessage(releaseObjectResult);
+ },
+ async function testObjectGroups() {
+ await logAndEvaluate('var a = {x:3};');
+ await logAndEvaluate('var b = {x:4};');
+ const ids = [];
+ InspectorTest.log('Evaluate "a" in objectGroup "x"');
+ let result = await Protocol.Runtime.evaluate({ expression: 'a', objectGroup: 'x' });
+ const id1 = result.result.result.objectId;
+ ids.push({id: id1, name: 'a'});
+ InspectorTest.log('Evaluate "b" in objectGroup "y"');
+ result = await Protocol.Runtime.evaluate({ expression: 'b', objectGroup: 'y' });
+ const id2 = result.result.result.objectId;
+ ids.push({id: id2, name: 'b'});
+
+ // Call Function on both objects and log:
+ await objectGroupHelper(ids);
+ InspectorTest.log('Release objectGroup "x"');
+ Protocol.Runtime.releaseObjectGroup({ objectGroup: 'x' });
+ await objectGroupHelper(ids);
+ InspectorTest.log('Release objectGroup "y"');
+ Protocol.Runtime.releaseObjectGroup({ objectGroup: 'y' });
+ await objectGroupHelper(ids);
+ },
+ async function testReleaseObjectGroupInvalid() {
+ const releaseObjectGroupResult = await Protocol.Runtime.releaseObjectGroup({});
+ InspectorTest.log('ReleaseObjectGroup with invalid params');
+ InspectorTest.logMessage(releaseObjectGroupResult);
+ }
+ ]);
+
+ // Helper to log and evaluate an expression
+ async function logAndEvaluate(expression) {
+ InspectorTest.logMessage(`Evaluating '${expression}'`);
+ await Protocol.Runtime.evaluate({ expression });
+ }
+
+ // Helper function that calls a function on all objects with ids in objectIds, then returns
+ async function objectGroupHelper(objectIds) {
+ for (const {id , name } of objectIds) {
+ InspectorTest.log(`Evaluate 'this' for object ${name}`);
+ const result = await Protocol.Runtime.callFunctionOn({ objectId: id, functionDeclaration: 'function(){ return this;}' });
+ InspectorTest.logMessage(result);
+ }
+ }
+})();
diff --git a/deps/v8/test/inspector/testcfg.py b/deps/v8/test/inspector/testcfg.py
index 9660147624..e07aa9e616 100644
--- a/deps/v8/test/inspector/testcfg.py
+++ b/deps/v8/test/inspector/testcfg.py
@@ -13,25 +13,19 @@ PROTOCOL_TEST_JS = "protocol-test.js"
EXPECTED_SUFFIX = "-expected.txt"
RESOURCES_FOLDER = "resources"
+class TestLoader(testsuite.JSTestLoader):
+ @property
+ def excluded_files(self):
+ return {PROTOCOL_TEST_JS}
+
+ @property
+ def excluded_dirs(self):
+ return {RESOURCES_FOLDER}
+
+
class TestSuite(testsuite.TestSuite):
- def ListTests(self):
- tests = []
- for dirname, dirs, files in os.walk(
- os.path.join(self.root), followlinks=True):
- for dotted in [x for x in dirs if x.startswith('.')]:
- dirs.remove(dotted)
- if dirname.endswith(os.path.sep + RESOURCES_FOLDER):
- continue
- dirs.sort()
- files.sort()
- for filename in files:
- if filename.endswith(".js") and filename != PROTOCOL_TEST_JS:
- fullpath = os.path.join(dirname, filename)
- relpath = fullpath[len(self.root) + 1 : -3]
- testname = relpath.replace(os.path.sep, "/")
- test = self._create_test(testname)
- tests.append(test)
- return tests
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/intl/assert.js b/deps/v8/test/intl/assert.js
index c11e7c0bbf..a6367a8cf2 100644
--- a/deps/v8/test/intl/assert.js
+++ b/deps/v8/test/intl/assert.js
@@ -200,15 +200,68 @@ function assertInstanceof(obj, type) {
}
}
-
/**
* Split a BCP 47 language tag into locale and extension.
*/
function splitLanguageTag(tag) {
- var extRe = /(-[0-9A-Za-z](-[0-9A-Za-z]{2,8})+)+$/;
- var match = %regexp_internal_match(extRe, tag);
- if (match) {
- return { locale: tag.slice(0, match.index), extension: match[0] };
+ // Search for the beginning of one or more extension tags, each of which
+ // contains a singleton tag followed by one or more subtags. The equivalent
+ // regexp is: /(-[0-9A-Za-z](-[0-9A-Za-z]{2,8})+)+$/. For example, in
+ // 'de-DE-u-co-phonebk' the matched extension tags are '-u-co-phonebk'.
+ //
+ // The below is a mini-parser that reads backwards from the end of the string.
+
+ function charCode(char) { return char.charCodeAt(0); }
+ function isAlphaNumeric(code) {
+ return (charCode("0") <= code && code <= charCode("9")) ||
+ (charCode("A") <= code && code <= charCode("Z")) ||
+ (charCode("a") <= code && code <= charCode("z"));
+ }
+
+ const MATCH_SUBTAG = 0;
+ const MATCH_SINGLETON_OR_SUBTAG = 1;
+ let state = MATCH_SUBTAG;
+
+ const MINIMUM_TAG_LENGTH = 2;
+ const MAXIMUM_TAG_LENGTH = 8;
+ let currentTagLength = 0;
+
+ // -1 signifies failure, a non-negative integer is the start index of the
+ // extension tag.
+ let extensionTagStartIndex = -1;
+
+ for (let i = tag.length - 1; i >= 0; i--) {
+ const currentCharCode = tag.charCodeAt(i);
+ if (currentCharCode == charCode("-")) {
+ if (state == MATCH_SINGLETON_OR_SUBTAG && currentTagLength == 1) {
+ // Found the singleton tag, the match succeeded.
+ // Save the matched index, and reset the state. After this point, we
+ // definitely have a match, but we may still find another extension tag
+ // sequence.
+ extensionTagStartIndex = i;
+ state = MATCH_SUBTAG;
+ currentTagLength = 0;
+ } else if (MINIMUM_TAG_LENGTH <= currentTagLength &&
+ currentTagLength <= MAXIMUM_TAG_LENGTH) {
+ // Found a valid subtag.
+ state = MATCH_SINGLETON_OR_SUBTAG;
+ currentTagLength = 0;
+ } else {
+ // Invalid subtag (too short or too long).
+ break;
+ }
+ } else if (isAlphaNumeric(currentCharCode)) {
+ // An alphanumeric character is potentially part of a tag.
+ currentTagLength++;
+ } else {
+ // Any other character is invalid.
+ break;
+ }
+ }
+
+ if (extensionTagStartIndex != -1) {
+ return { locale: tag.substring(0, extensionTagStartIndex),
+ extension: tag.substring(extensionTagStartIndex) };
}
return { locale: tag, extension: '' };
diff --git a/deps/v8/test/intl/bigint/tolocalestring.js b/deps/v8/test/intl/bigint/tolocalestring.js
new file mode 100644
index 0000000000..d0b6792ea8
--- /dev/null
+++ b/deps/v8/test/intl/bigint/tolocalestring.js
@@ -0,0 +1,61 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-intl-bigint
+
+var locales = [
+ "en", // "1,234,567,890,123,456"
+ "de", // "1.234.567.890.123.456"
+ "fr", // "1ā€Æ234ā€Æ567ā€Æ890ā€Æ123ā€Æ456"
+ "hi", // "1,23,45,67,89,01,23,456"
+ "fa", // "Ū±Ł¬Ū²Ū³Ū“Ł¬ŪµŪ¶Ū·Ł¬ŪøŪ¹Ū°Ł¬Ū±Ū²Ū³Ł¬Ū“ŪµŪ¶"
+ "th-u-nu-thai", // "ą¹‘,ą¹’ą¹“ą¹”,ą¹•ą¹–ą¹—,ą¹˜ą¹™ą¹,ą¹‘ą¹’ą¹“,ą¹”ą¹•ą¹–"
+];
+
+var data = [
+ Number.MAX_SAFE_INTEGER,
+ -Number.MAX_SAFE_INTEGER,
+ Math.floor(Number.MAX_SAFE_INTEGER / 2),
+ 0,
+ /// -0, // this case is broken now.
+];
+
+for (var locale of locales) {
+ let nf = new Intl.NumberFormat(locale);
+
+ let percentOption = {style: "percent"};
+ let nfPercent = new Intl.NumberFormat(locale, percentOption);
+ for (var n of data) {
+ let bigint = BigInt(n);
+ // Test NumberFormat w/ number output the same as
+ // BigInt.prototype.toLocaleString()
+ assertEquals(nf.format(n), bigint.toLocaleString(locale));
+
+ // Test NumberFormat output the same regardless pass in as number or BigInt
+ assertEquals(nf.format(n), nf.format(bigint));
+
+ // Test formatToParts
+ assertEquals(nf.formatToParts(n), nf.formatToParts(bigint));
+
+ // Test output with option
+ // Test NumberFormat w/ number output the same as
+ // BigInt.prototype.toLocaleString()
+ assertEquals(nfPercent.format(n),
+ bigint.toLocaleString(locale, percentOption));
+
+ // Test NumberFormat output the same regardless pass in as number or BigInt
+ assertEquals(nfPercent.format(n), nfPercent.format(bigint));
+ assertEquals(nfPercent.formatToParts(n), nfPercent.formatToParts(bigint));
+ }
+
+ // Test very big BigInt
+ let veryBigInt = BigInt(Number.MAX_SAFE_INTEGER) *
+ BigInt(Number.MAX_SAFE_INTEGER) *
+ BigInt(Number.MAX_SAFE_INTEGER);
+ assertEquals(nf.format(veryBigInt), veryBigInt.toLocaleString(locale));
+ // It should output different than toString
+ assertFalse(veryBigInt.toLocaleString(locale) == veryBigInt.toString());
+ assertTrue(veryBigInt.toLocaleString(locale).length >
+ veryBigInt.toString().length);
+}
diff --git a/deps/v8/test/intl/break-iterator/subclass.js b/deps/v8/test/intl/break-iterator/subclass.js
index b5ffe61a48..4358721027 100644
--- a/deps/v8/test/intl/break-iterator/subclass.js
+++ b/deps/v8/test/intl/break-iterator/subclass.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-list-format
-
var locales = ["tlh", "id", "en"];
var input = "foo and bar";
var refBreakIterator = new Intl.v8BreakIterator(locales);
diff --git a/deps/v8/test/intl/date-format/check-hc-option.js b/deps/v8/test/intl/date-format/check-hc-option.js
index 276bfe6a23..7a1e917816 100644
--- a/deps/v8/test/intl/date-format/check-hc-option.js
+++ b/deps/v8/test/intl/date-format/check-hc-option.js
@@ -26,7 +26,8 @@ let locales = [
];
invalid_hc.forEach(function(hc) {
- let df = new Intl.DateTimeFormat(["en-u-hc-" + hc + "-fo-obar"]);
+ let df = new Intl.DateTimeFormat(
+ ["en-u-hc-" + hc + "-fo-obar"], {hour: "2-digit"});
assertEquals("en", df.resolvedOptions().locale);
}
);
@@ -34,7 +35,8 @@ invalid_hc.forEach(function(hc) {
valid_hc.forEach(function(hc) {
locales.forEach(function(base) {
let l = base + "-u-hc-" + hc;
- let df = new Intl.DateTimeFormat([l + "-fo-obar"]);
+ let df = new Intl.DateTimeFormat(
+ [l + "-fo-obar"], {hour: "2-digit"});
assertEquals(l, df.resolvedOptions().locale);
});
}
diff --git a/deps/v8/test/intl/date-format/constructor-date-style-order.js b/deps/v8/test/intl/date-format/constructor-date-style-order.js
new file mode 100644
index 0000000000..8e601b48d3
--- /dev/null
+++ b/deps/v8/test/intl/date-format/constructor-date-style-order.js
@@ -0,0 +1,108 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-intl-datetime-style
+
+// Throws only once during construction.
+// Check for all getters to prevent regression.
+// Preserve the order of getter initialization.
+let getCount = 0;
+let weekday = new Array();
+let year = new Array();
+let month = new Array();
+let day = new Array();
+let hour = new Array();
+let minute = new Array();
+let second = new Array();
+let localeMatcher = new Array();
+let hour12 = new Array();
+let hourCycle = new Array();
+let dateStyle = new Array();
+let timeStyle = new Array();
+let timeZone = new Array();
+let era = new Array();
+let timeZoneName = new Array();
+let formatMatcher = new Array();
+
+new Intl.DateTimeFormat(['en-US'], {
+ get weekday() {
+ weekday.push(++getCount);
+ },
+ get year() {
+ year.push(++getCount);
+ },
+ get month() {
+ month.push(++getCount);
+ },
+ get day() {
+ day.push(++getCount);
+ },
+ get hour() {
+ hour.push(++getCount);
+ },
+ get minute() {
+ minute.push(++getCount);
+ },
+ get second() {
+ second.push(++getCount);
+ },
+ get localeMatcher() {
+ localeMatcher.push(++getCount);
+ },
+ get hour12() {
+ hour12.push(++getCount);
+ },
+ get hourCycle() {
+ hourCycle.push(++getCount);
+ },
+ get timeZone() {
+ timeZone.push(++getCount);
+ },
+ get dateStyle() {
+ dateStyle.push(++getCount);
+ return "full";
+ },
+ get timeStyle() {
+ timeStyle.push(++getCount);
+ },
+ get era() {
+ era.push(++getCount);
+ },
+ get timeZoneName() {
+ timeZoneName.push(++getCount);
+ },
+ get formatMatcher() {
+ formatMatcher.push(++getCount);
+ }
+});
+
+assertEquals(1, weekday.length);
+assertEquals(1, weekday[0]);
+assertEquals(1, year.length);
+assertEquals(2, year[0]);
+assertEquals(1, month.length);
+assertEquals(3, month[0]);
+assertEquals(1, day.length);
+assertEquals(4, day[0]);
+assertEquals(1, hour.length);
+assertEquals(5, hour[0]);
+assertEquals(1, minute.length);
+assertEquals(6, minute[0]);
+assertEquals(1, second.length);
+assertEquals(7, second[0]);
+assertEquals(1, localeMatcher.length);
+assertEquals(8, localeMatcher[0]);
+assertEquals(1, hour12.length);
+assertEquals(9, hour12[0]);
+assertEquals(1, hourCycle.length);
+assertEquals(10, hourCycle[0]);
+assertEquals(1, timeZone.length);
+assertEquals(11, timeZone[0]);
+assertEquals(1, dateStyle.length);
+assertEquals(12, dateStyle[0]);
+assertEquals(1, timeStyle.length);
+assertEquals(13, timeStyle[0]);
+assertEquals(0, era.length);
+assertEquals(0, timeZoneName.length);
+assertEquals(0, formatMatcher.length);
diff --git a/deps/v8/test/intl/date-format/constructor-date-time-style-order.js b/deps/v8/test/intl/date-format/constructor-date-time-style-order.js
new file mode 100644
index 0000000000..d4d114662f
--- /dev/null
+++ b/deps/v8/test/intl/date-format/constructor-date-time-style-order.js
@@ -0,0 +1,109 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-intl-datetime-style
+
+// Throws only once during construction.
+// Check for all getters to prevent regression.
+// Preserve the order of getter initialization.
+let getCount = 0;
+let weekday = new Array();
+let year = new Array();
+let month = new Array();
+let day = new Array();
+let hour = new Array();
+let minute = new Array();
+let second = new Array();
+let localeMatcher = new Array();
+let hour12 = new Array();
+let hourCycle = new Array();
+let dateStyle = new Array();
+let timeStyle = new Array();
+let timeZone = new Array();
+let era = new Array();
+let timeZoneName = new Array();
+let formatMatcher = new Array();
+
+new Intl.DateTimeFormat(['en-US'], {
+ get weekday() {
+ weekday.push(++getCount);
+ },
+ get year() {
+ year.push(++getCount);
+ },
+ get month() {
+ month.push(++getCount);
+ },
+ get day() {
+ day.push(++getCount);
+ },
+ get hour() {
+ hour.push(++getCount);
+ },
+ get minute() {
+ minute.push(++getCount);
+ },
+ get second() {
+ second.push(++getCount);
+ },
+ get localeMatcher() {
+ localeMatcher.push(++getCount);
+ },
+ get hour12() {
+ hour12.push(++getCount);
+ },
+ get hourCycle() {
+ hourCycle.push(++getCount);
+ },
+ get timeZone() {
+ timeZone.push(++getCount);
+ },
+ get dateStyle() {
+ dateStyle.push(++getCount);
+ return "full";
+ },
+ get timeStyle() {
+ timeStyle.push(++getCount);
+ return "full";
+ },
+ get era() {
+ era.push(++getCount);
+ },
+ get timeZoneName() {
+ timeZoneName.push(++getCount);
+ },
+ get formatMatcher() {
+ formatMatcher.push(++getCount);
+ }
+});
+
+assertEquals(1, weekday.length);
+assertEquals(1, weekday[0]);
+assertEquals(1, year.length);
+assertEquals(2, year[0]);
+assertEquals(1, month.length);
+assertEquals(3, month[0]);
+assertEquals(1, day.length);
+assertEquals(4, day[0]);
+assertEquals(1, hour.length);
+assertEquals(5, hour[0]);
+assertEquals(1, minute.length);
+assertEquals(6, minute[0]);
+assertEquals(1, second.length);
+assertEquals(7, second[0]);
+assertEquals(1, localeMatcher.length);
+assertEquals(8, localeMatcher[0]);
+assertEquals(1, hour12.length);
+assertEquals(9, hour12[0]);
+assertEquals(1, hourCycle.length);
+assertEquals(10, hourCycle[0]);
+assertEquals(1, timeZone.length);
+assertEquals(11, timeZone[0]);
+assertEquals(1, dateStyle.length);
+assertEquals(12, dateStyle[0]);
+assertEquals(1, timeStyle.length);
+assertEquals(13, timeStyle[0]);
+assertEquals(0, era.length);
+assertEquals(0, timeZoneName.length);
+assertEquals(0, formatMatcher.length);
diff --git a/deps/v8/test/intl/date-format/constructor-date-time-style.js b/deps/v8/test/intl/date-format/constructor-date-time-style.js
new file mode 100644
index 0000000000..f4bc40b396
--- /dev/null
+++ b/deps/v8/test/intl/date-format/constructor-date-time-style.js
@@ -0,0 +1,33 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-intl-datetime-style
+
+var validStyle = ["full", "long", "medium", "short", undefined];
+var invalidStyle = ["narrow", "numeric"];
+
+validStyle.forEach(function(dateStyle) {
+ validStyle.forEach(function(timeStyle) {
+ assertDoesNotThrow(() =>
+ new Intl.DateTimeFormat("en", {dateStyle, timeStyle}));
+ });
+
+ invalidStyle.forEach(function(timeStyle) {
+ assertThrows(() =>
+ new Intl.DateTimeFormat("en", {dateStyle, timeStyle}), RangeError);
+ });
+}
+);
+
+invalidStyle.forEach(function(dateStyle) {
+ validStyle.forEach(function(timeStyle) {
+ assertThrows(() =>
+ new Intl.DateTimeFormat("en", {dateStyle, timeStyle}), RangeError);
+ });
+ invalidStyle.forEach(function(timeStyle) {
+ assertThrows(() =>
+ new Intl.DateTimeFormat("en", {dateStyle, timeStyle}), RangeError);
+ });
+}
+);
diff --git a/deps/v8/test/intl/date-format/constructor-no-style-order.js b/deps/v8/test/intl/date-format/constructor-no-style-order.js
new file mode 100644
index 0000000000..bd4bc4cc37
--- /dev/null
+++ b/deps/v8/test/intl/date-format/constructor-no-style-order.js
@@ -0,0 +1,114 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-intl-datetime-style
+
+// Throws only once during construction.
+// Check for all getters to prevent regression.
+// Preserve the order of getter initialization.
+let getCount = 0;
+let weekday = new Array();
+let year = new Array();
+let month = new Array();
+let day = new Array();
+let hour = new Array();
+let minute = new Array();
+let second = new Array();
+let localeMatcher = new Array();
+let hour12 = new Array();
+let hourCycle = new Array();
+let dateStyle = new Array();
+let timeStyle = new Array();
+let timeZone = new Array();
+let era = new Array();
+let timeZoneName = new Array();
+let formatMatcher = new Array();
+
+new Intl.DateTimeFormat(['en-US'], {
+ get weekday() {
+ weekday.push(++getCount);
+ },
+ get year() {
+ year.push(++getCount);
+ },
+ get month() {
+ month.push(++getCount);
+ },
+ get day() {
+ day.push(++getCount);
+ },
+ get hour() {
+ hour.push(++getCount);
+ },
+ get minute() {
+ minute.push(++getCount);
+ },
+ get second() {
+ second.push(++getCount);
+ },
+ get localeMatcher() {
+ localeMatcher.push(++getCount);
+ },
+ get hour12() {
+ hour12.push(++getCount);
+ },
+ get hourCycle() {
+ hourCycle.push(++getCount);
+ },
+ get timeZone() {
+ timeZone.push(++getCount);
+ },
+ get dateStyle() {
+ dateStyle.push(++getCount);
+ },
+ get timeStyle() {
+ timeStyle.push(++getCount);
+ },
+ get era() {
+ era.push(++getCount);
+ },
+ get timeZoneName() {
+ timeZoneName.push(++getCount);
+ },
+ get formatMatcher() {
+ formatMatcher.push(++getCount);
+ }
+});
+
+assertEquals(2, weekday.length);
+assertEquals(1, weekday[0]);
+assertEquals(1, year.length);
+assertEquals(2, year[0]);
+assertEquals(1, month.length);
+assertEquals(3, month[0]);
+assertEquals(1, day.length);
+assertEquals(4, day[0]);
+assertEquals(2, hour.length);
+assertEquals(5, hour[0]);
+assertEquals(2, minute.length);
+assertEquals(6, minute[0]);
+assertEquals(2, second.length);
+assertEquals(7, second[0]);
+assertEquals(1, localeMatcher.length);
+assertEquals(8, localeMatcher[0]);
+assertEquals(1, hour12.length);
+assertEquals(9, hour12[0]);
+assertEquals(1, hourCycle.length);
+assertEquals(10, hourCycle[0]);
+assertEquals(1, timeZone.length);
+assertEquals(11, timeZone[0]);
+assertEquals(1, dateStyle.length);
+assertEquals(12, dateStyle[0]);
+assertEquals(1, timeStyle.length);
+assertEquals(13, timeStyle[0]);
+assertEquals(14, weekday[1]);
+assertEquals(1, era.length);
+assertEquals(15, era[0]);
+assertEquals(16, hour[1]);
+assertEquals(17, minute[1]);
+assertEquals(18, second[1]);
+assertEquals(1, timeZoneName.length);
+assertEquals(19, timeZoneName[0]);
+assertEquals(1, formatMatcher.length);
+assertEquals(20, formatMatcher[0]);
diff --git a/deps/v8/test/intl/date-format/constructor-time-style-order.js b/deps/v8/test/intl/date-format/constructor-time-style-order.js
new file mode 100644
index 0000000000..d35f21a196
--- /dev/null
+++ b/deps/v8/test/intl/date-format/constructor-time-style-order.js
@@ -0,0 +1,108 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-intl-datetime-style
+
+// Throws only once during construction.
+// Check for all getters to prevent regression.
+// Preserve the order of getter initialization.
+let getCount = 0;
+let weekday = new Array();
+let year = new Array();
+let month = new Array();
+let day = new Array();
+let hour = new Array();
+let minute = new Array();
+let second = new Array();
+let localeMatcher = new Array();
+let hour12 = new Array();
+let hourCycle = new Array();
+let dateStyle = new Array();
+let timeStyle = new Array();
+let timeZone = new Array();
+let era = new Array();
+let timeZoneName = new Array();
+let formatMatcher = new Array();
+
+new Intl.DateTimeFormat(['en-US'], {
+ get weekday() {
+ weekday.push(++getCount);
+ },
+ get year() {
+ year.push(++getCount);
+ },
+ get month() {
+ month.push(++getCount);
+ },
+ get day() {
+ day.push(++getCount);
+ },
+ get hour() {
+ hour.push(++getCount);
+ },
+ get minute() {
+ minute.push(++getCount);
+ },
+ get second() {
+ second.push(++getCount);
+ },
+ get localeMatcher() {
+ localeMatcher.push(++getCount);
+ },
+ get hour12() {
+ hour12.push(++getCount);
+ },
+ get hourCycle() {
+ hourCycle.push(++getCount);
+ },
+ get timeZone() {
+ timeZone.push(++getCount);
+ },
+ get dateStyle() {
+ dateStyle.push(++getCount);
+ },
+ get timeStyle() {
+ timeStyle.push(++getCount);
+ return "full";
+ },
+ get era() {
+ era.push(++getCount);
+ },
+ get timeZoneName() {
+ timeZoneName.push(++getCount);
+ },
+ get formatMatcher() {
+ formatMatcher.push(++getCount);
+ }
+});
+
+assertEquals(1, weekday.length);
+assertEquals(1, weekday[0]);
+assertEquals(1, year.length);
+assertEquals(2, year[0]);
+assertEquals(1, month.length);
+assertEquals(3, month[0]);
+assertEquals(1, day.length);
+assertEquals(4, day[0]);
+assertEquals(1, hour.length);
+assertEquals(5, hour[0]);
+assertEquals(1, minute.length);
+assertEquals(6, minute[0]);
+assertEquals(1, second.length);
+assertEquals(7, second[0]);
+assertEquals(1, localeMatcher.length);
+assertEquals(8, localeMatcher[0]);
+assertEquals(1, hour12.length);
+assertEquals(9, hour12[0]);
+assertEquals(1, hourCycle.length);
+assertEquals(10, hourCycle[0]);
+assertEquals(1, timeZone.length);
+assertEquals(11, timeZone[0]);
+assertEquals(1, dateStyle.length);
+assertEquals(12, dateStyle[0]);
+assertEquals(1, timeStyle.length);
+assertEquals(13, timeStyle[0]);
+assertEquals(0, era.length);
+assertEquals(0, timeZoneName.length);
+assertEquals(0, formatMatcher.length);
diff --git a/deps/v8/test/intl/date-format/property-override-date-style.js b/deps/v8/test/intl/date-format/property-override-date-style.js
new file mode 100644
index 0000000000..67d9bc5361
--- /dev/null
+++ b/deps/v8/test/intl/date-format/property-override-date-style.js
@@ -0,0 +1,54 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-intl-datetime-style
+
+// Checks for security holes introduced by Object.property overrides.
+// For example:
+// Object.defineProperty(Array.prototype, 'locale', {
+// set: function(value) {
+// throw new Error('blah');
+// },
+// configurable: true,
+// enumerable: false
+// });
+//
+// would throw in case of (JS) x.locale = 'us' or (C++) x->Set('locale', 'us').
+//
+// First get supported properties.
+// Some of the properties are optional, so we request them.
+var properties = [];
+var options = Intl.DateTimeFormat(
+ 'en-US', {dateStyle: 'full'}).resolvedOptions();
+for (var prop in options) {
+ if (options.hasOwnProperty(prop)) {
+ properties.push(prop);
+ }
+}
+
+// In the order of Table 6 of
+// ecma402 #sec-intl.datetimeformat.prototype.resolvedoptions
+var expectedProperties = [
+ 'locale',
+ 'calendar',
+ 'numberingSystem',
+ 'timeZone',
+ 'hourCycle',
+ 'hour12',
+ 'weekday',
+ 'year',
+ 'month',
+ 'day',
+ 'dateStyle',
+];
+
+assertEquals(expectedProperties.length, properties.length);
+
+properties.forEach(function(prop) {
+ assertFalse(expectedProperties.indexOf(prop) === -1);
+});
+
+taintProperties(properties);
+
+var locale = Intl.DateTimeFormat().resolvedOptions().locale;
diff --git a/deps/v8/test/intl/date-format/property-override-date-time-style.js b/deps/v8/test/intl/date-format/property-override-date-time-style.js
new file mode 100644
index 0000000000..f51d6f31a6
--- /dev/null
+++ b/deps/v8/test/intl/date-format/property-override-date-time-style.js
@@ -0,0 +1,59 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-intl-datetime-style
+
+// Checks for security holes introduced by Object.property overrides.
+// For example:
+// Object.defineProperty(Array.prototype, 'locale', {
+// set: function(value) {
+// throw new Error('blah');
+// },
+// configurable: true,
+// enumerable: false
+// });
+//
+// would throw in case of (JS) x.locale = 'us' or (C++) x->Set('locale', 'us').
+
+// First get supported properties.
+// Some of the properties are optional, so we request them.
+var properties = [];
+var options = Intl.DateTimeFormat(
+ 'en-US', {dateStyle: 'full', timeStyle: 'full'}).resolvedOptions();
+for (var prop in options) {
+ if (options.hasOwnProperty(prop)) {
+ properties.push(prop);
+ }
+}
+
+// In the order of Table 6 of
+// ecma402 #sec-intl.datetimeformat.prototype.resolvedoptions
+var expectedProperties = [
+ 'locale',
+ 'calendar',
+ 'numberingSystem',
+ 'timeZone',
+ 'hourCycle',
+ 'hour12',
+ 'weekday',
+ 'year',
+ 'month',
+ 'day',
+ 'hour',
+ 'minute',
+ 'second',
+ 'timeZoneName',
+ 'dateStyle',
+ 'timeStyle',
+];
+
+assertEquals(expectedProperties.length, properties.length);
+
+properties.forEach(function(prop) {
+ assertFalse(expectedProperties.indexOf(prop) === -1);
+});
+
+taintProperties(properties);
+
+var locale = Intl.DateTimeFormat().resolvedOptions().locale;
diff --git a/deps/v8/test/intl/date-format/property-override-time-style.js b/deps/v8/test/intl/date-format/property-override-time-style.js
new file mode 100644
index 0000000000..1b93ac633f
--- /dev/null
+++ b/deps/v8/test/intl/date-format/property-override-time-style.js
@@ -0,0 +1,54 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-intl-datetime-style
+
+// Checks for security holes introduced by Object.property overrides.
+// For example:
+// Object.defineProperty(Array.prototype, 'locale', {
+// set: function(value) {
+// throw new Error('blah');
+// },
+// configurable: true,
+// enumerable: false
+// });
+//
+// would throw in case of (JS) x.locale = 'us' or (C++) x->Set('locale', 'us').
+
+// First get supported properties.
+// Some of the properties are optional, so we request them.
+var properties = [];
+var options = Intl.DateTimeFormat(
+ 'en-US', {timeStyle: 'full'}).resolvedOptions();
+for (var prop in options) {
+ if (options.hasOwnProperty(prop)) {
+ properties.push(prop);
+ }
+}
+
+// In the order of Table 6 of
+// ecma402 #sec-intl.datetimeformat.prototype.resolvedoptions
+var expectedProperties = [
+ 'locale',
+ 'calendar',
+ 'numberingSystem',
+ 'timeZone',
+ 'hourCycle',
+ 'hour12',
+ 'hour',
+ 'minute',
+ 'second',
+ 'timeZoneName',
+ 'timeStyle',
+];
+
+assertEquals(expectedProperties.length, properties.length);
+
+properties.forEach(function(prop) {
+ assertFalse(expectedProperties.indexOf(prop) === -1);
+});
+
+taintProperties(properties);
+
+var locale = Intl.DateTimeFormat().resolvedOptions().locale;
diff --git a/deps/v8/test/intl/intl.status b/deps/v8/test/intl/intl.status
index 83e546db76..53f42e4b66 100644
--- a/deps/v8/test/intl/intl.status
+++ b/deps/v8/test/intl/intl.status
@@ -46,6 +46,9 @@
# Unable to change locale on Windows:
'default_locale': [SKIP],
+
+ # Unable to change locale and TZ on Windows:
+ 'regress-7770': [SKIP],
}], # system == windows'
['system == android', {
@@ -56,5 +59,12 @@
'relative-time-format/default-locale-fr-CA': [SKIP],
'relative-time-format/default-locale-pt-BR': [SKIP],
'default_locale': [SKIP],
+ # Unable to change locale and TZ on Android:
+ 'regress-7770': [SKIP],
}], # 'system == android'
+
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
]
diff --git a/deps/v8/test/intl/list-format/constructor.js b/deps/v8/test/intl/list-format/constructor.js
index d730516c9c..05ddf932a9 100644
--- a/deps/v8/test/intl/list-format/constructor.js
+++ b/deps/v8/test/intl/list-format/constructor.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-list-format
-
// ListFormat constructor can't be called as function.
assertThrows(() => Intl.ListFormat(['sr']), TypeError);
diff --git a/deps/v8/test/intl/list-format/format-en.js b/deps/v8/test/intl/list-format/format-en.js
index d628537990..5aa16d2933 100644
--- a/deps/v8/test/intl/list-format/format-en.js
+++ b/deps/v8/test/intl/list-format/format-en.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-list-format
-
// The following test are not part of the comformance. Just some output in
// English to verify the format does return something reasonable for English.
// It may be changed when we update the CLDR data.
diff --git a/deps/v8/test/intl/list-format/format-to-parts.js b/deps/v8/test/intl/list-format/format-to-parts.js
index 64eac823ba..038fb761ea 100644
--- a/deps/v8/test/intl/list-format/format-to-parts.js
+++ b/deps/v8/test/intl/list-format/format-to-parts.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-list-format
-
function assertListFormat(listFormat, input) {
var result;
try {
diff --git a/deps/v8/test/intl/list-format/format.js b/deps/v8/test/intl/list-format/format.js
index fef05c38e0..a10e9a092e 100644
--- a/deps/v8/test/intl/list-format/format.js
+++ b/deps/v8/test/intl/list-format/format.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-list-format
-
function assertListFormat(listFormat, input) {
try {
let result = listFormat.format(input);
diff --git a/deps/v8/test/intl/list-format/formatToParts-zh.js b/deps/v8/test/intl/list-format/formatToParts-zh.js
index a7204b0b29..1279c86204 100644
--- a/deps/v8/test/intl/list-format/formatToParts-zh.js
+++ b/deps/v8/test/intl/list-format/formatToParts-zh.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-list-format
-
// The following test are not part of the comformance. Just some output in
// Chinese to verify the format does return something reasonable for Chinese.
// It may be changed when we update the CLDR data.
diff --git a/deps/v8/test/intl/list-format/resolved-options.js b/deps/v8/test/intl/list-format/resolved-options.js
index b5662718e5..42687990f9 100644
--- a/deps/v8/test/intl/list-format/resolved-options.js
+++ b/deps/v8/test/intl/list-format/resolved-options.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-list-format
-
let listFormat = new Intl.ListFormat();
// The default style is 'long'
assertEquals('long', listFormat.resolvedOptions().style);
diff --git a/deps/v8/test/intl/list-format/supported-locale.js b/deps/v8/test/intl/list-format/supported-locale.js
index 1eac25d618..0aebeb86a1 100644
--- a/deps/v8/test/intl/list-format/supported-locale.js
+++ b/deps/v8/test/intl/list-format/supported-locale.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-list-format
assertEquals(typeof Intl.ListFormat.supportedLocalesOf, "function",
"Intl.ListFormat.supportedLocalesOf should be a function");
diff --git a/deps/v8/test/intl/regress-7770.js b/deps/v8/test/intl/regress-7770.js
new file mode 100644
index 0000000000..2e7c2ce22d
--- /dev/null
+++ b/deps/v8/test/intl/regress-7770.js
@@ -0,0 +1,8 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Environment Variables: TZ=Indian/Kerguelen LANG=uk
+assertEquals(
+ "Fri Feb 01 2019 00:00:00 GMT+0500 (Š·Š° чŠ°ŃŠ¾Š¼ Š½Š° Š¤Ń€Š°Š½Ń†ŃƒŠ·ŃŒŠŗŠøх ŠŸŃ–Š²Š“ŠµŠ½Š½Šøх і ŠŠ½Ń‚Š°Ń€ŠŗтŠøчŠ½Šøх тŠµŃ€ŠøтŠ¾Ń€Ń–ŃŃ…)",
+ new Date(2019, 1,1).toString());
diff --git a/deps/v8/test/intl/regress-8030.js b/deps/v8/test/intl/regress-8030.js
index eac6b84f81..cf0e1aa2a9 100644
--- a/deps/v8/test/intl/regress-8030.js
+++ b/deps/v8/test/intl/regress-8030.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format
-
var locales = ["tlh", "id", "en"];
var referenceRelativeTimeFormat = new Intl.RelativeTimeFormat(locales);
var referenceFormatted = referenceRelativeTimeFormat.format(3, "day");
diff --git a/deps/v8/test/intl/regress-8031.js b/deps/v8/test/intl/regress-8031.js
index 0898026d99..513ef025fe 100644
--- a/deps/v8/test/intl/regress-8031.js
+++ b/deps/v8/test/intl/regress-8031.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-list-format
-
var locales = ["tlh", "id", "en"];
var input = ["a", "b", "c"];
var referenceListFormat = new Intl.ListFormat(locales);
diff --git a/deps/v8/test/intl/regress-930304.js b/deps/v8/test/intl/regress-930304.js
new file mode 100644
index 0000000000..85bcfea76e
--- /dev/null
+++ b/deps/v8/test/intl/regress-930304.js
@@ -0,0 +1,5 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+assertDoesNotThrow(() => Intl.DateTimeFormat('en-u-nu-ethi'));
diff --git a/deps/v8/test/intl/relative-time-format/constructor.js b/deps/v8/test/intl/relative-time-format/constructor.js
index ba03e1dd70..f1a4057426 100644
--- a/deps/v8/test/intl/relative-time-format/constructor.js
+++ b/deps/v8/test/intl/relative-time-format/constructor.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format
-
// RelativeTimeFormat constructor can't be called as function.
assertThrows(() => Intl.RelativeTimeFormat('sr'), TypeError);
diff --git a/deps/v8/test/intl/relative-time-format/default-locale-fr-CA.js b/deps/v8/test/intl/relative-time-format/default-locale-fr-CA.js
index 32f64ee02d..9f24329b50 100644
--- a/deps/v8/test/intl/relative-time-format/default-locale-fr-CA.js
+++ b/deps/v8/test/intl/relative-time-format/default-locale-fr-CA.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format --harmony-locale
// Environment Variables: LC_ALL=fr_CA
assertEquals(
'fr-CA',
diff --git a/deps/v8/test/intl/relative-time-format/default-locale-pt-BR.js b/deps/v8/test/intl/relative-time-format/default-locale-pt-BR.js
index 89f7aa14f0..ea66b6a0e5 100644
--- a/deps/v8/test/intl/relative-time-format/default-locale-pt-BR.js
+++ b/deps/v8/test/intl/relative-time-format/default-locale-pt-BR.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format --harmony-locale
// Environment Variables: LC_ALL=pt_BR
assertEquals(
'pt-BR',
diff --git a/deps/v8/test/intl/relative-time-format/format-en.js b/deps/v8/test/intl/relative-time-format/format-en.js
index 2af755dcbf..a365749f0a 100644
--- a/deps/v8/test/intl/relative-time-format/format-en.js
+++ b/deps/v8/test/intl/relative-time-format/format-en.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format
-
// The following test are not part of the comformance. Just some output in
// English to verify the format does return something reasonable for English.
// It may be changed when we update the CLDR data.
diff --git a/deps/v8/test/intl/relative-time-format/format-to-parts-en.js b/deps/v8/test/intl/relative-time-format/format-to-parts-en.js
index 689059f4cd..7c2076b312 100644
--- a/deps/v8/test/intl/relative-time-format/format-to-parts-en.js
+++ b/deps/v8/test/intl/relative-time-format/format-to-parts-en.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format
-
// The following test are not part of the comformance. Just some output in
// English to verify the format does return something reasonable for English.
// It may be changed when we update the CLDR data.
diff --git a/deps/v8/test/intl/relative-time-format/format-to-parts-plural.js b/deps/v8/test/intl/relative-time-format/format-to-parts-plural.js
index 7e5e1b79a6..bd70f75421 100644
--- a/deps/v8/test/intl/relative-time-format/format-to-parts-plural.js
+++ b/deps/v8/test/intl/relative-time-format/format-to-parts-plural.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format
-
// Check plural w/ formatToParts
// http://tc39.github.io/proposal-intl-relative-time/
diff --git a/deps/v8/test/intl/relative-time-format/format-to-parts.js b/deps/v8/test/intl/relative-time-format/format-to-parts.js
index 071c4468c0..ccc9170225 100644
--- a/deps/v8/test/intl/relative-time-format/format-to-parts.js
+++ b/deps/v8/test/intl/relative-time-format/format-to-parts.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format
-
// Make sure that RelativeTimeFormat exposes all required properties. Those not specified
// should have undefined value.
// http://tc39.github.io/proposal-intl-relative-time/
diff --git a/deps/v8/test/intl/relative-time-format/format.js b/deps/v8/test/intl/relative-time-format/format.js
index 769358423d..e458ad728d 100644
--- a/deps/v8/test/intl/relative-time-format/format.js
+++ b/deps/v8/test/intl/relative-time-format/format.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format
-
// Make sure that RelativeTimeFormat exposes all required properties. Those not specified
// should have undefined value.
// http://tc39.github.io/proposal-intl-relative-time/
diff --git a/deps/v8/test/intl/relative-time-format/resolved-options-nu.js b/deps/v8/test/intl/relative-time-format/resolved-options-nu.js
index fb1fa72a93..a01cb5d9c4 100644
--- a/deps/v8/test/intl/relative-time-format/resolved-options-nu.js
+++ b/deps/v8/test/intl/relative-time-format/resolved-options-nu.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format
-
// For locale default the numberingSystem to 'latn'
assertEquals(
"latn",
diff --git a/deps/v8/test/intl/relative-time-format/resolved-options.js b/deps/v8/test/intl/relative-time-format/resolved-options.js
index 391b83ae0a..1caa4f86c9 100644
--- a/deps/v8/test/intl/relative-time-format/resolved-options.js
+++ b/deps/v8/test/intl/relative-time-format/resolved-options.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format
-
let rtf = new Intl.RelativeTimeFormat();
// Test 1.4.5 Intl.RelativeTimeFormat.prototype.resolvedOptions ()
// The default style is 'long'
diff --git a/deps/v8/test/intl/relative-time-format/supported-locale.js b/deps/v8/test/intl/relative-time-format/supported-locale.js
index b24cfb27af..5c177b4777 100644
--- a/deps/v8/test/intl/relative-time-format/supported-locale.js
+++ b/deps/v8/test/intl/relative-time-format/supported-locale.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-intl-relative-time-format
assertEquals(typeof Intl.RelativeTimeFormat.supportedLocalesOf, "function",
"Intl.RelativeTimeFormat.supportedLocalesOf should be a function");
diff --git a/deps/v8/test/intl/testcfg.py b/deps/v8/test/intl/testcfg.py
index 8cf26f1a61..66da4c77b5 100644
--- a/deps/v8/test/intl/testcfg.py
+++ b/deps/v8/test/intl/testcfg.py
@@ -33,23 +33,16 @@ from testrunner.objects import testcase
ENV_PATTERN = re.compile(r"//\s+Environment Variables:(.*)")
+
+class TestLoader(testsuite.JSTestLoader):
+ @property
+ def excluded_files(self):
+ return {"assert.js", "utils.js"}
+
+
class TestSuite(testsuite.TestSuite):
- def ListTests(self):
- tests = []
- for dirname, dirs, files in os.walk(self.root):
- for dotted in [x for x in dirs if x.startswith('.')]:
- dirs.remove(dotted)
- dirs.sort()
- files.sort()
- for filename in files:
- if (filename.endswith(".js") and filename != "assert.js" and
- filename != "utils.js"):
- fullpath = os.path.join(dirname, filename)
- relpath = fullpath[len(self.root) + 1 : -3]
- testname = relpath.replace(os.path.sep, "/")
- test = self._create_test(testname)
- tests.append(test)
- return tests
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/js-perf-test/ArrayInOperator/run.js b/deps/v8/test/js-perf-test/ArrayInOperator/run.js
new file mode 100644
index 0000000000..db63584499
--- /dev/null
+++ b/deps/v8/test/js-perf-test/ArrayInOperator/run.js
@@ -0,0 +1,245 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Compare `in` operator on different types of arrays.
+
+const size = 1e5;
+let packed_smi = [];
+let packed_double = [];
+let packed_elements = [];
+let holey_smi = new Array(size);
+let holey_double = new Array(size);
+let holey_elements = new Array(size);
+let sparse_smi = new Array(size);
+let sparse_double = new Array(size);
+let sparse_elements = new Array(size);
+let typed_uint8 = new Uint8Array(size);
+let typed_int32 = new Int32Array(size);
+let typed_float = new Float64Array(size);
+
+for (let i = 0; i < size; ++i) {
+ packed_smi[i] = i;
+ packed_double[i] = i + 0.1;
+ packed_elements[i] = "" + i;
+ holey_smi[i] = i;
+ holey_double[i] = i + 0.1;
+ holey_elements[i] = "" + i;
+ typed_uint8[i] = i % 0x100;
+ typed_int32[i] = i;
+ typed_float[i] = i + 0.1;
+}
+
+let sparse = 0;
+for (let i = 0; i < size; i += 100) {
+ ++sparse;
+ sparse_smi[i] = i;
+ sparse_double[i] = i + 0.1;
+ sparse_elements[i] = "" + i;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Packed SMI
+// ----------------------------------------------------------------------------
+
+function PackedSMI() {
+ let cnt = 0;
+ let ary = packed_smi;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Packed Double
+// ----------------------------------------------------------------------------
+
+function PackedDouble() {
+ let cnt = 0;
+ let ary = packed_double;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Packed Elements
+// ----------------------------------------------------------------------------
+
+function PackedElements() {
+ let cnt = 0;
+ let ary = packed_elements;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Holey SMI
+// ----------------------------------------------------------------------------
+
+function HoleySMI() {
+ let cnt = 0;
+ let ary = holey_smi;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Holey Double
+// ----------------------------------------------------------------------------
+
+function HoleyDouble() {
+ let cnt = 0;
+ let ary = holey_double;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Holey Elements
+// ----------------------------------------------------------------------------
+
+function HoleyElements() {
+ let cnt = 0;
+ let ary = holey_elements;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Sparse SMI
+// ----------------------------------------------------------------------------
+
+function SparseSMI() {
+ let cnt = 0;
+ let ary = sparse_smi;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != sparse) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Sparse Double
+// ----------------------------------------------------------------------------
+
+function SparseDouble() {
+ let cnt = 0;
+ let ary = sparse_double;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != sparse) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Sparse Elements
+// ----------------------------------------------------------------------------
+
+function SparseElements() {
+ let cnt = 0;
+ let ary = sparse_elements;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != sparse) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Typed Uint8
+// ----------------------------------------------------------------------------
+
+function TypedUint8() {
+ let cnt = 0;
+ let ary = typed_uint8;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Typed Int32
+// ----------------------------------------------------------------------------
+
+function TypedInt32() {
+ let cnt = 0;
+ let ary = typed_int32;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Typed Float64
+// ----------------------------------------------------------------------------
+
+function TypedFloat64() {
+ let cnt = 0;
+ let ary = typed_float;
+ for (let i = 0; i < ary.length; ++i) {
+ if (i in ary) ++cnt;
+ }
+
+ if (cnt != size) throw 666;
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayInOperator(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 5, f) ]);
+}
+
+CreateBenchmark('PackedSMI', PackedSMI);
+CreateBenchmark('PackedDouble', PackedDouble);
+CreateBenchmark('PackedElements', PackedElements);
+CreateBenchmark('HoleySMI', HoleySMI);
+CreateBenchmark('HoleyDouble', HoleyDouble);
+CreateBenchmark('HoleyElements', HoleyElements);
+CreateBenchmark('SparseSMI', SparseSMI);
+CreateBenchmark('SparseDouble', SparseDouble);
+CreateBenchmark('SparseElements', SparseElements);
+CreateBenchmark('TypedUint8', TypedUint8);
+CreateBenchmark('TypedInt32', TypedInt32);
+CreateBenchmark('TypedFloat64', TypedFloat64);
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = true;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/deps/v8/test/js-perf-test/Intl/constructor.js b/deps/v8/test/js-perf-test/Intl/constructor.js
new file mode 100644
index 0000000000..e5b3a86694
--- /dev/null
+++ b/deps/v8/test/js-perf-test/Intl/constructor.js
@@ -0,0 +1,32 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+function NewIntlCollator() {
+ let obj = new Intl.Collator();
+}
+createSuite('NewIntlCollator', 100, NewIntlCollator, ()=>{});
+
+function NewIntlDateTimeFormat() {
+ let obj = new Intl.DateTimeFormat();
+}
+createSuite('NewIntlDateTimeFormat', 100, NewIntlDateTimeFormat, ()=>{});
+
+function NewIntlNumberFormat() {
+ let obj = new Intl.NumberFormat();
+}
+createSuite('NewIntlNumberFormat', 100, NewIntlNumberFormat, ()=>{});
+
+function NewIntlPluralRules() {
+ let obj = new Intl.PluralRules();
+}
+createSuite('NewIntlPluralRules', 100, NewIntlPluralRules, ()=>{});
+
+function NewIntlListFormat() {
+ let obj = new Intl.ListFormat();
+}
+createSuite('NewIntlListFormat', 100, NewIntlListFormat, ()=>{});
+
+function NewIntlRelativeTimeFormat() {
+ let obj = new Intl.RelativeTimeFormat();
+}
+createSuite('NewIntlRelativeTimeFormat', 100, NewIntlRelativeTimeFormat, ()=>{});
diff --git a/deps/v8/test/js-perf-test/Intl/run.js b/deps/v8/test/js-perf-test/Intl/run.js
new file mode 100644
index 0000000000..61ac92a267
--- /dev/null
+++ b/deps/v8/test/js-perf-test/Intl/run.js
@@ -0,0 +1,19 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+load('../base.js');
+load('constructor.js');
+
+function PrintResult(name, result) {
+ console.log(name + '-Intl(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+}
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError });
diff --git a/deps/v8/test/js-perf-test/JSTests.json b/deps/v8/test/js-perf-test/JSTests.json
index 88f39b9fa8..84f5a9304b 100644
--- a/deps/v8/test/js-perf-test/JSTests.json
+++ b/deps/v8/test/js-perf-test/JSTests.json
@@ -483,6 +483,20 @@
]
},
{
+ "name": "StringNormalize",
+ "main": "run.js",
+ "resources": [ "string-normalize.js" ],
+ "test_flags": [ "string-normalize" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "StringNormalize"},
+ {"name": "StringNormalizeNFD"},
+ {"name": "StringNormalizeNFKC"},
+ {"name": "StringNormalizeNFKD"}
+ ]
+ },
+ {
"name": "StringLocaleCompare",
"main": "run.js",
"resources": [ "string-localeCompare.js" ],
@@ -494,6 +508,20 @@
]
},
{
+ "name": "StringToLocaleCase",
+ "main": "run.js",
+ "resources": [ "string-toLocaleCase.js" ],
+ "test_flags": [ "string-toLocaleCase" ],
+ "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$",
+ "run_count": 1,
+ "tests": [
+ {"name": "StringToLocaleLowerCase"},
+ {"name": "StringToLocaleUpperCase"},
+ {"name": "StringToLocaleLowerCaseTR"},
+ {"name": "StringToLocaleUpperCaseTR"}
+ ]
+ },
+ {
"name": "StringMatchAll",
"main": "run.js",
"resources": [ "string-matchall.js" ],
@@ -760,6 +788,20 @@
"test_flags": ["construct-all-typedarrays"]
},
{
+ "name": "FilterNoSpecies",
+ "main": "run.js",
+ "resources": ["filter-nospecies.js"],
+ "test_flags": ["filter-nospecies"],
+ "results_regexp": "^TypedArrays\\-%s\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Uint8Array"},
+ {"name": "Uint16Array"},
+ {"name": "Uint32Array"},
+ {"name": "Float32Array"},
+ {"name": "Float64Array"}
+ ]
+ },
+ {
"name": "JoinBigIntTypes",
"main": "run.js",
"resources": ["base.js", "join.js", "join-bigint.js"],
@@ -994,6 +1036,27 @@
]
},
{
+ "name": "ArrayInOperator",
+ "path": ["ArrayInOperator"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayInOperator\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "PackedSMI"},
+ {"name": "PackedDouble"},
+ {"name": "PackedElements"},
+ {"name": "HoleySMI"},
+ {"name": "HoleyDouble"},
+ {"name": "HoleyElements"},
+ {"name": "SparseSMI"},
+ {"name": "SparseDouble"},
+ {"name": "SparseElements"},
+ {"name": "TypedUint8"},
+ {"name": "TypedInt32"},
+ {"name": "TypedFloat64"}
+ ]
+ },
+ {
"name": "ArraySort",
"path": ["ArraySort"],
"main": "run.js",
@@ -1305,6 +1368,22 @@
]
},
{
+ "name": "Intl",
+ "path": ["Intl"],
+ "main": "run.js",
+ "resources": [ "constructor.js" ],
+ "flags": [],
+ "results_regexp": "^%s\\-Intl\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "NewIntlCollator"},
+ {"name": "NewIntlDateTimeFormat"},
+ {"name": "NewIntlNumberFormat"},
+ {"name": "NewIntlPluralRules"},
+ {"name": "NewIntlListFormat"},
+ {"name": "NewIntlRelativeTimeFormat"}
+ ]
+ },
+ {
"name": "Inspector",
"path": ["Inspector"],
"main": "run.js",
@@ -1358,6 +1437,20 @@
]
},
{
+ "name": "ObjectFreeze",
+ "path": ["ObjectFreeze"],
+ "main": "run.js",
+ "flags": [],
+ "resources": [
+ "tagged-template.js"
+ ],
+ "results_regexp": "^%s\\-Numbers\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "TaggedTemplate"},
+ {"name": "TaggedTemplateLoose"}
+ ]
+ },
+ {
"name": "TurboFan",
"path": ["TurboFan"],
"main": "run.js",
diff --git a/deps/v8/test/js-perf-test/ObjectFreeze/run.js b/deps/v8/test/js-perf-test/ObjectFreeze/run.js
new file mode 100644
index 0000000000..63eb1d69ec
--- /dev/null
+++ b/deps/v8/test/js-perf-test/ObjectFreeze/run.js
@@ -0,0 +1,20 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+load('../base.js');
+load('tagged-template.js');
+
+function PrintResult(name, result) {
+ console.log(name);
+ console.log(name + '-Numbers(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+}
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError });
diff --git a/deps/v8/test/js-perf-test/ObjectFreeze/tagged-template.js b/deps/v8/test/js-perf-test/ObjectFreeze/tagged-template.js
new file mode 100644
index 0000000000..83fbb8aa47
--- /dev/null
+++ b/deps/v8/test/js-perf-test/ObjectFreeze/tagged-template.js
@@ -0,0 +1,65 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function tag(strings, ...values) {
+ let a = 0;
+ for (let i = 0; i < strings.length; ++i) a += strings[i].length;
+ return a;
+}
+
+function driver(n) {
+ let result = 0;
+ for (let i = 0; i < n; ++i) {
+ result += tag`${"Hello"} ${"cruel"} ${"slow"} ${"world"}!\n`;
+ result += tag`${"Why"} ${"is"} ${"this"} ${"so"} ${"damn"} ${"slow"}?!\n`;
+ }
+ return result;
+}
+
+function TaggedTemplate() {
+ driver(1e4);
+}
+
+function TaggedTemplateWarmUp() {
+ driver(1e1);
+ driver(1e2);
+ driver(1e3);
+}
+
+createSuite('TaggedTemplate', 10, TaggedTemplate, TaggedTemplateWarmUp);
+
+var _templateObject = _taggedTemplateLiteralLoose(
+ ["", " ", " ", " ", "!\n"],
+ ["", " ", " ", " ", "!\\n"]
+),
+_templateObject2 = _taggedTemplateLiteralLoose(
+ ["", " ", " ", " ", " ", " ", "?!\n"],
+ ["", " ", " ", " ", " ", " ", "?!\\n"]
+);
+
+function _taggedTemplateLiteralLoose(strings, raw) {
+ strings.raw = raw;
+ return strings;
+}
+
+function driverLoose(n) {
+ var result = 0;
+ for (var i = 0; i < n; ++i) {
+ result += tag(_templateObject, "Hello", "cruel", "slow", "world");
+ result += tag(_templateObject2, "Why", "is", "this", "so", "damn", "slow");
+ }
+ return result;
+}
+
+function TaggedTemplateLoose() {
+ driverLoose(1e4);
+}
+
+function TaggedTemplateLooseWarmUp() {
+ driverLoose(1e1);
+ driverLoose(1e2);
+ driverLoose(1e3);
+}
+
+createSuite('TaggedTemplateLoose', 10, TaggedTemplateLoose, TaggedTemplateLooseWarmUp);
diff --git a/deps/v8/test/js-perf-test/Proxies/proxies.js b/deps/v8/test/js-perf-test/Proxies/proxies.js
index 79d064e931..6d5e808449 100644
--- a/deps/v8/test/js-perf-test/Proxies/proxies.js
+++ b/deps/v8/test/js-perf-test/Proxies/proxies.js
@@ -373,7 +373,8 @@ newBenchmark("SetStringWithTrap", {
setup() {
p = new Proxy(obj, {
set: function(target, propertyKey, value, receiver) {
- target[propertyKey] = SOME_OTHER_NUMBER
+ target[propertyKey] = SOME_OTHER_NUMBER;
+ return true;
}
});
},
@@ -412,7 +413,8 @@ newBenchmark("SetIndexWithTrap", {
setup() {
p = new Proxy(obj, {
set: function(target, propertyKey, value, receiver) {
- target[propertyKey] = SOME_OTHER_NUMBER
+ target[propertyKey] = SOME_OTHER_NUMBER;
+ return true;
}
});
},
@@ -450,7 +452,8 @@ newBenchmark("SetSymbolWithTrap", {
setup() {
p = new Proxy(obj, {
set: function(target, propertyKey, value, receiver) {
- target[propertyKey] = SOME_OTHER_NUMBER
+ target[propertyKey] = SOME_OTHER_NUMBER;
+ return true;
}
});
},
diff --git a/deps/v8/test/js-perf-test/Strings/string-normalize.js b/deps/v8/test/js-perf-test/Strings/string-normalize.js
new file mode 100644
index 0000000000..21a8a590c9
--- /dev/null
+++ b/deps/v8/test/js-perf-test/Strings/string-normalize.js
@@ -0,0 +1,38 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+new BenchmarkSuite('StringNormalize', [5], [
+ new Benchmark('StringNormalize', false, false, 0,
+ StringNormalize),
+]);
+new BenchmarkSuite('StringNormalizeNFD', [5], [
+ new Benchmark('StringNormalizeNFD', false, false, 0,
+ StringNormalizeNFD),
+]);
+new BenchmarkSuite('StringNormalizeNFKC', [5], [
+ new Benchmark('StringNormalizeNFKC', false, false, 0,
+ StringNormalizeNFKC),
+]);
+new BenchmarkSuite('StringNormalizeNFKD', [5], [
+ new Benchmark('StringNormalizeNFKD', false, false, 0,
+ StringNormalizeNFKD),
+]);
+
+const shortString = "Ć ĆØĆ¬Ć²Ć¹Ć”Ć©Ć­Ć³ĆŗƤƫĆÆĆ¶Ć¼ĆæĆ¢ĆŖĆ®Ć“Ć»Ć£ĆµĆ±";
+
+function StringNormalize() {
+ return shortString.normalize();
+}
+
+function StringNormalizeNFD() {
+ return shortString.normalize("NFD");
+}
+
+function StringNormalizeNFKC() {
+ return shortString.normalize("NFKC");
+}
+
+function StringNormalizeNFKD() {
+ return shortString.normalize("NFKD");
+}
diff --git a/deps/v8/test/js-perf-test/Strings/string-toLocaleCase.js b/deps/v8/test/js-perf-test/Strings/string-toLocaleCase.js
new file mode 100644
index 0000000000..67919fda06
--- /dev/null
+++ b/deps/v8/test/js-perf-test/Strings/string-toLocaleCase.js
@@ -0,0 +1,35 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+new BenchmarkSuite('StringToLocaleUpperCaseTR', [5], [
+ new Benchmark('StringToLocaleUpperCaseTR', false, false, 0,
+ StringToLocaleUpperCaseTR)
+]);
+new BenchmarkSuite('StringToLocaleLowerCaseTR', [5], [
+ new Benchmark('StringToLocaleLowerCaseTR', false, false, 0,
+ StringToLocaleLowerCaseTR),
+]);
+new BenchmarkSuite('StringToLocaleUpperCase', [5], [
+ new Benchmark('StringToLocaleUpperCase', false, false, 0,
+ StringToLocaleUpperCase)
+]);
+new BenchmarkSuite('StringToLocaleLowerCase', [5], [
+ new Benchmark('StringToLocaleLowerCase', false, false, 0,
+ StringToLocaleLowerCase),
+]);
+
+var shortString = "ĆŽĆ±Å£Ć©rĆ±Ć„Å£Ć®Ć¶Ć±Ć„Ä¼Ć®Å¾Ć„Å£Ć®Ć¶Ć± Ä»Ć¶Ć§Ć„Ä¼Ć®Å¾Ć„Å£Ć®Ć¶Ć± החןןם שםוןמ Ī“ĻĪµĪµĪŗ Ī¹Ļƒ Ļ†ĪøĪ½ äø€äŗŒäø‰";
+
+function StringToLocaleUpperCase() {
+ return shortString.toLocaleUpperCase();
+}
+function StringToLocaleLowerCase() {
+ return shortString.toLocaleLowerCase();
+}
+function StringToLocaleUpperCaseTR() {
+ return shortString.toLocaleUpperCase(["tr"]);
+}
+function StringToLocaleLowerCaseTR() {
+ return shortString.toLocaleLowerCase(["tr"]);
+}
diff --git a/deps/v8/test/js-perf-test/TypedArrays/filter-nospecies.js b/deps/v8/test/js-perf-test/TypedArrays/filter-nospecies.js
new file mode 100644
index 0000000000..180fe5b2ad
--- /dev/null
+++ b/deps/v8/test/js-perf-test/TypedArrays/filter-nospecies.js
@@ -0,0 +1,55 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+const SIZE = 1024;
+let input;
+let output;
+
+function CreateSetup(TAConstructor) {
+ return () => {
+ // Create an Typed Array with a sequence of number 0 to SIZE.
+ const values = Array.from({ length: SIZE }).map((_, i) =>
+ TAConstructor === BigUint64Array ? BigInt(i) : i
+ );
+ input = new TAConstructor(values);
+ };
+}
+
+// Creates a run function that is unpolluted by IC feedback.
+function CreateRun() {
+ // Filters out every other (odd indexed) elements.
+ return new Function(`
+ output = input.filter((el, i) => el < SIZE && (i % 2) === 0);
+ `);
+}
+
+function isOutputInvalid() {
+ if (output.length !== input.length / 2) return true;
+
+ // Verfies every other (odd indexed) element has been filtered out.
+ for (let i = 0; i < SIZE / 2; i++) {
+ if (output[i] !== input[i * 2]) return true;
+ }
+}
+
+function TearDown() {
+ if (isOutputInvalid()) throw new TypeError(`Unexpected result!\n${output}`);
+
+ input = void 0;
+ output = void 0;
+}
+
+createSuite(
+ 'Uint8Array', 1000, CreateRun(), CreateSetup(Uint8Array), TearDown);
+createSuite(
+ 'Uint16Array', 1000, CreateRun(), CreateSetup(Uint16Array), TearDown);
+createSuite(
+ 'Uint32Array', 1000, CreateRun(), CreateSetup(Uint32Array), TearDown);
+createSuite(
+ 'Float32Array', 1000, CreateRun(), CreateSetup(Float32Array), TearDown);
+createSuite(
+ 'Float64Array', 1000, CreateRun(), CreateSetup(Float64Array), TearDown);
+createSuite(
+ 'BigUint64Array', 1000, CreateRun(), CreateSetup(BigUint64Array),
+ TearDown);
diff --git a/deps/v8/test/message/asm-function-undefined.out b/deps/v8/test/message/asm-function-undefined.out
index ad11ee66fe..f2f47f8d31 100644
--- a/deps/v8/test/message/asm-function-undefined.out
+++ b/deps/v8/test/message/asm-function-undefined.out
@@ -2,4 +2,4 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-*%(basename)s:12: Invalid asm.js: Undefined function
+*%(basename)s:13: Invalid asm.js: Undefined function
diff --git a/deps/v8/test/message/asm-table-undefined.out b/deps/v8/test/message/asm-table-undefined.out
index 447968535c..c94f45d2a3 100644
--- a/deps/v8/test/message/asm-table-undefined.out
+++ b/deps/v8/test/message/asm-table-undefined.out
@@ -2,4 +2,4 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
-*%(basename)s:13: Invalid asm.js: Undefined function table
+*%(basename)s:14: Invalid asm.js: Undefined function table
diff --git a/deps/v8/test/message/fail/computed-prop-fni.js b/deps/v8/test/message/fail/computed-prop-fni.js
new file mode 100644
index 0000000000..a331f56850
--- /dev/null
+++ b/deps/v8/test/message/fail/computed-prop-fni.js
@@ -0,0 +1,9 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+let a = { b: {} };
+let foo = "b";
+a[foo].c = () => { throw Error(); };
+let fn = a.b.c;
+fn();
diff --git a/deps/v8/test/message/fail/computed-prop-fni.out b/deps/v8/test/message/fail/computed-prop-fni.out
new file mode 100644
index 0000000000..da637c09fb
--- /dev/null
+++ b/deps/v8/test/message/fail/computed-prop-fni.out
@@ -0,0 +1,6 @@
+*%(basename)s:7: Error
+a[foo].c = () => { throw Error(); };
+ ^
+Error
+ at a.<computed>.c (*%(basename)s:7:26)
+ at *%(basename)s:9:1
diff --git a/deps/v8/test/message/fail/default-parameter-tdz-arrow.out b/deps/v8/test/message/fail/default-parameter-tdz-arrow.out
index 7d5f894ef5..a17bcaa05f 100644
--- a/deps/v8/test/message/fail/default-parameter-tdz-arrow.out
+++ b/deps/v8/test/message/fail/default-parameter-tdz-arrow.out
@@ -1,6 +1,6 @@
-*%(basename)s:7: ReferenceError: a is not defined
+*%(basename)s:7: ReferenceError: Cannot access 'a' before initialization
((a=-a) => { })();
^
-ReferenceError: a is not defined
+ReferenceError: Cannot access 'a' before initialization
at *%(basename)s:7:6
at *%(basename)s:7:16
diff --git a/deps/v8/test/message/fail/default-parameter-tdz.out b/deps/v8/test/message/fail/default-parameter-tdz.out
index 8a6d56abae..08d606d63a 100644
--- a/deps/v8/test/message/fail/default-parameter-tdz.out
+++ b/deps/v8/test/message/fail/default-parameter-tdz.out
@@ -1,6 +1,6 @@
-*%(basename)s:7: ReferenceError: a is not defined
+*%(basename)s:7: ReferenceError: Cannot access 'a' before initialization
(function(a=+a) { })();
^
-ReferenceError: a is not defined
+ReferenceError: Cannot access 'a' before initialization
at *%(basename)s:7:14
at *%(basename)s:7:21
diff --git a/deps/v8/test/message/fail/destructuring-object-private-name.js b/deps/v8/test/message/fail/destructuring-object-private-name.js
new file mode 100644
index 0000000000..3e30bd2321
--- /dev/null
+++ b/deps/v8/test/message/fail/destructuring-object-private-name.js
@@ -0,0 +1,13 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-class-fields
+
+class Foo {
+ #x = 1;
+ destructureX() {
+ const { #x: x } = this;
+ return x;
+ }
+}
diff --git a/deps/v8/test/message/fail/destructuring-object-private-name.out b/deps/v8/test/message/fail/destructuring-object-private-name.out
new file mode 100644
index 0000000000..83b6b8eb80
--- /dev/null
+++ b/deps/v8/test/message/fail/destructuring-object-private-name.out
@@ -0,0 +1,4 @@
+*%(basename)s:10: SyntaxError: Unexpected identifier
+ const { #x: x } = this;
+ ^^
+SyntaxError: Unexpected identifier
diff --git a/deps/v8/test/message/fail/json-stringify-circular-ellipsis.js b/deps/v8/test/message/fail/json-stringify-circular-ellipsis.js
new file mode 100644
index 0000000000..30f3e6e9e8
--- /dev/null
+++ b/deps/v8/test/message/fail/json-stringify-circular-ellipsis.js
@@ -0,0 +1,27 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+class Outer {
+ constructor(o) { this.x = o; }
+}
+
+class Inner {
+ constructor(o) { this.y = o; }
+}
+
+class ArrayHolder {
+ constructor(o) {
+ this.array = [];
+ this.array[1] = o;
+ }
+}
+
+const root = {};
+root.first = new Outer(
+ new ArrayHolder(
+ new Inner(root)
+ )
+);
+
+JSON.stringify(root);
diff --git a/deps/v8/test/message/fail/json-stringify-circular-ellipsis.out b/deps/v8/test/message/fail/json-stringify-circular-ellipsis.out
new file mode 100644
index 0000000000..c288ee95ea
--- /dev/null
+++ b/deps/v8/test/message/fail/json-stringify-circular-ellipsis.out
@@ -0,0 +1,18 @@
+*%(basename)s:27: TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ | property 'first' -> object with constructor 'Outer'
+ | property 'x' -> object with constructor 'ArrayHolder'
+ | ...
+ | index 1 -> object with constructor 'Inner'
+ --- property 'y' closes the circle
+JSON.stringify(root);
+ ^
+TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ | property 'first' -> object with constructor 'Outer'
+ | property 'x' -> object with constructor 'ArrayHolder'
+ | ...
+ | index 1 -> object with constructor 'Inner'
+ --- property 'y' closes the circle
+ at JSON.stringify (<anonymous>)
+ at *%(basename)s:27:6
diff --git a/deps/v8/test/message/fail/json-stringify-circular-max-display-depth.js b/deps/v8/test/message/fail/json-stringify-circular-max-display-depth.js
new file mode 100644
index 0000000000..762b5916da
--- /dev/null
+++ b/deps/v8/test/message/fail/json-stringify-circular-max-display-depth.js
@@ -0,0 +1,21 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+class Outer {
+ constructor(o) { this.x = o; }
+}
+
+class ArrayHolder {
+ constructor(o) {
+ this.array = [];
+ this.array[1] = o;
+ }
+}
+
+const root = {};
+root.first = new Outer(
+ new ArrayHolder(root)
+);
+
+JSON.stringify(root);
diff --git a/deps/v8/test/message/fail/json-stringify-circular-max-display-depth.out b/deps/v8/test/message/fail/json-stringify-circular-max-display-depth.out
new file mode 100644
index 0000000000..bf81266dd5
--- /dev/null
+++ b/deps/v8/test/message/fail/json-stringify-circular-max-display-depth.out
@@ -0,0 +1,16 @@
+*%(basename)s:21: TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ | property 'first' -> object with constructor 'Outer'
+ | property 'x' -> object with constructor 'ArrayHolder'
+ | property 'array' -> object with constructor 'Array'
+ --- index 1 closes the circle
+JSON.stringify(root);
+ ^
+TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ | property 'first' -> object with constructor 'Outer'
+ | property 'x' -> object with constructor 'ArrayHolder'
+ | property 'array' -> object with constructor 'Array'
+ --- index 1 closes the circle
+ at JSON.stringify (<anonymous>)
+ at *%(basename)s:21:6
diff --git a/deps/v8/test/message/fail/json-stringify-circular-proxy.js b/deps/v8/test/message/fail/json-stringify-circular-proxy.js
new file mode 100644
index 0000000000..b3488155d6
--- /dev/null
+++ b/deps/v8/test/message/fail/json-stringify-circular-proxy.js
@@ -0,0 +1,28 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+class Outer {
+ constructor(o) { this.x = o; }
+}
+
+class Inner {
+ constructor(o) { this.y = o; }
+}
+
+class ArrayHolder {
+ constructor(o) {
+ this.array = [];
+ this.array[1] = o;
+ }
+}
+
+const root = {};
+const outer = new Outer(
+ new ArrayHolder(
+ new Inner(root)
+ )
+);
+root.first = new Proxy(outer, outer);
+
+JSON.stringify(root);
diff --git a/deps/v8/test/message/fail/json-stringify-circular-proxy.out b/deps/v8/test/message/fail/json-stringify-circular-proxy.out
new file mode 100644
index 0000000000..6004cfb42d
--- /dev/null
+++ b/deps/v8/test/message/fail/json-stringify-circular-proxy.out
@@ -0,0 +1,18 @@
+*%(basename)s:28: TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ | property 'first' -> object with constructor 'Object'
+ | property 'x' -> object with constructor 'ArrayHolder'
+ | ...
+ | index 1 -> object with constructor 'Inner'
+ --- property 'y' closes the circle
+JSON.stringify(root);
+ ^
+TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ | property 'first' -> object with constructor 'Object'
+ | property 'x' -> object with constructor 'ArrayHolder'
+ | ...
+ | index 1 -> object with constructor 'Inner'
+ --- property 'y' closes the circle
+ at JSON.stringify (<anonymous>)
+ at *%(basename)s:28:6
diff --git a/deps/v8/test/message/fail/json-stringify-circular-substructure.js b/deps/v8/test/message/fail/json-stringify-circular-substructure.js
new file mode 100644
index 0000000000..af512fdb94
--- /dev/null
+++ b/deps/v8/test/message/fail/json-stringify-circular-substructure.js
@@ -0,0 +1,9 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+const object = {};
+object.substructure = {};
+object.substructure.key = object.substructure;
+
+JSON.stringify(object);
diff --git a/deps/v8/test/message/fail/json-stringify-circular-substructure.out b/deps/v8/test/message/fail/json-stringify-circular-substructure.out
new file mode 100644
index 0000000000..7633ea24e8
--- /dev/null
+++ b/deps/v8/test/message/fail/json-stringify-circular-substructure.out
@@ -0,0 +1,10 @@
+*%(basename)s:9: TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ --- property 'key' closes the circle
+JSON.stringify(object);
+ ^
+TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ --- property 'key' closes the circle
+ at JSON.stringify (<anonymous>)
+ at *%(basename)s:9:6
diff --git a/deps/v8/test/message/fail/json-stringify-circular.js b/deps/v8/test/message/fail/json-stringify-circular.js
new file mode 100644
index 0000000000..88efbb68d0
--- /dev/null
+++ b/deps/v8/test/message/fail/json-stringify-circular.js
@@ -0,0 +1,8 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+const object = {};
+object.key = object;
+
+JSON.stringify(object);
diff --git a/deps/v8/test/message/fail/json-stringify-circular.out b/deps/v8/test/message/fail/json-stringify-circular.out
new file mode 100644
index 0000000000..bfea54ef00
--- /dev/null
+++ b/deps/v8/test/message/fail/json-stringify-circular.out
@@ -0,0 +1,10 @@
+*%(basename)s:8: TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ --- property 'key' closes the circle
+JSON.stringify(object);
+ ^
+TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ --- property 'key' closes the circle
+ at JSON.stringify (<anonymous>)
+ at *%(basename)s:8:6
diff --git a/deps/v8/test/message/fail/list-format-style-narrow.js b/deps/v8/test/message/fail/list-format-style-narrow.js
index f9af8ff4a7..9b731441ed 100644
--- a/deps/v8/test/message/fail/list-format-style-narrow.js
+++ b/deps/v8/test/message/fail/list-format-style-narrow.js
@@ -1,7 +1,4 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
-// Flags: --harmony-intl-list-format
-
new Intl.ListFormat("en", {style: 'narrow'})
diff --git a/deps/v8/test/message/fail/list-format-style-narrow.out b/deps/v8/test/message/fail/list-format-style-narrow.out
index b762f8d664..90047338c0 100644
--- a/deps/v8/test/message/fail/list-format-style-narrow.out
+++ b/deps/v8/test/message/fail/list-format-style-narrow.out
@@ -1,8 +1,8 @@
-*%(basename)s:7: RangeError: When style is 'narrow', 'unit' is the only allowed value for the type option.
+*%(basename)s:4: RangeError: When style is 'narrow', 'unit' is the only allowed value for the type option.
new Intl.ListFormat("en", {style: 'narrow'})
^
RangeError: When style is 'narrow', 'unit' is the only allowed value for the type option.
at new ListFormat (<anonymous>)
- at *%(basename)s:7:1
+ at *%(basename)s:4:1
diff --git a/deps/v8/test/message/fail/wasm-function-name.js b/deps/v8/test/message/fail/wasm-function-name.js
index 0573db02e4..f946358c27 100644
--- a/deps/v8/test/message/fail/wasm-function-name.js
+++ b/deps/v8/test/message/fail/wasm-function-name.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/message/fail/wasm-function-name.out b/deps/v8/test/message/fail/wasm-function-name.out
index 00626c01f3..ff9b04eaab 100644
--- a/deps/v8/test/message/fail/wasm-function-name.out
+++ b/deps/v8/test/message/fail/wasm-function-name.out
@@ -1,5 +1,5 @@
wasm-function[0]:1: RuntimeError: unreachable
RuntimeError: unreachable
at main (wasm-function[0]:1)
- at *%(basename)s:12:31
+ at *%(basename)s:{NUMBER}:31
diff --git a/deps/v8/test/message/fail/wasm-module-and-function-name.js b/deps/v8/test/message/fail/wasm-module-and-function-name.js
index cab3252427..b1832eb925 100644
--- a/deps/v8/test/message/fail/wasm-module-and-function-name.js
+++ b/deps/v8/test/message/fail/wasm-module-and-function-name.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/message/fail/wasm-module-and-function-name.out b/deps/v8/test/message/fail/wasm-module-and-function-name.out
index 42ba7b077c..0bff25cfd0 100644
--- a/deps/v8/test/message/fail/wasm-module-and-function-name.out
+++ b/deps/v8/test/message/fail/wasm-module-and-function-name.out
@@ -1,4 +1,4 @@
wasm-function[0]:1: RuntimeError: unreachable
RuntimeError: unreachable
at test-module.main (wasm-function[0]:1)
- at *%(basename)s:13:31
+ at *%(basename)s:{NUMBER}:31
diff --git a/deps/v8/test/message/fail/wasm-module-name.js b/deps/v8/test/message/fail/wasm-module-name.js
index 1e32a5d437..c872c32cb8 100644
--- a/deps/v8/test/message/fail/wasm-module-name.js
+++ b/deps/v8/test/message/fail/wasm-module-name.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/message/fail/wasm-module-name.out b/deps/v8/test/message/fail/wasm-module-name.out
index bc3a6c01a5..9163088efe 100644
--- a/deps/v8/test/message/fail/wasm-module-name.out
+++ b/deps/v8/test/message/fail/wasm-module-name.out
@@ -1,5 +1,5 @@
wasm-function[0]:1: RuntimeError: unreachable
RuntimeError: unreachable
at test-module (wasm-function[0]:1)
- at *%(basename)s:15:31
+ at *%(basename)s:{NUMBER}:31
diff --git a/deps/v8/test/message/fail/wasm-no-name.js b/deps/v8/test/message/fail/wasm-no-name.js
index 121a7cbfe4..83ab942c84 100644
--- a/deps/v8/test/message/fail/wasm-no-name.js
+++ b/deps/v8/test/message/fail/wasm-no-name.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/message/fail/wasm-no-name.out b/deps/v8/test/message/fail/wasm-no-name.out
index f6b9f8d032..90d068d557 100644
--- a/deps/v8/test/message/fail/wasm-no-name.out
+++ b/deps/v8/test/message/fail/wasm-no-name.out
@@ -1,5 +1,5 @@
wasm-function[0]:1: RuntimeError: unreachable
RuntimeError: unreachable
at wasm-function[0]:1
- at *%(basename)s:14:31
+ at *%(basename)s:{NUMBER}:31
diff --git a/deps/v8/test/message/fail/wasm-trap.js b/deps/v8/test/message/fail/wasm-trap.js
index 53013a7d22..6fdb582dd0 100644
--- a/deps/v8/test/message/fail/wasm-trap.js
+++ b/deps/v8/test/message/fail/wasm-trap.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/message/fail/wasm-trap.out b/deps/v8/test/message/fail/wasm-trap.out
index 33d6309d13..41c017f100 100644
--- a/deps/v8/test/message/fail/wasm-trap.out
+++ b/deps/v8/test/message/fail/wasm-trap.out
@@ -1,5 +1,5 @@
wasm-function[0]:5: RuntimeError: divide by zero
RuntimeError: divide by zero
at main (wasm-function[0]:5)
- at *%(basename)s:15:16
+ at *%(basename)s:{NUMBER}:16
diff --git a/deps/v8/test/message/fail/weak-refs-weakfactory1.js b/deps/v8/test/message/fail/weak-refs-finalizationgroup1.js
index 5359aee736..a97abb3f8b 100644
--- a/deps/v8/test/message/fail/weak-refs-weakfactory1.js
+++ b/deps/v8/test/message/fail/weak-refs-finalizationgroup1.js
@@ -4,4 +4,4 @@
// Flags: --harmony-weak-refs
-let wf = new WeakFactory();
+let fg = new FinalizationGroup();
diff --git a/deps/v8/test/message/fail/weak-refs-finalizationgroup1.out b/deps/v8/test/message/fail/weak-refs-finalizationgroup1.out
new file mode 100644
index 0000000000..ddaa32328f
--- /dev/null
+++ b/deps/v8/test/message/fail/weak-refs-finalizationgroup1.out
@@ -0,0 +1,6 @@
+*%(basename)s:7: TypeError: FinalizationGroup: cleanup must be callable
+let fg = new FinalizationGroup();
+ ^
+TypeError: FinalizationGroup: cleanup must be callable
+ at new FinalizationGroup (<anonymous>)
+ at *%(basename)s:7:10
diff --git a/deps/v8/test/message/fail/weak-refs-weakfactory2.js b/deps/v8/test/message/fail/weak-refs-finalizationgroup2.js
index fabb7f1e41..87a6183de9 100644
--- a/deps/v8/test/message/fail/weak-refs-weakfactory2.js
+++ b/deps/v8/test/message/fail/weak-refs-finalizationgroup2.js
@@ -4,4 +4,4 @@
// Flags: --harmony-weak-refs
-let wf = new WeakFactory({});
+let fg = new FinalizationGroup({});
diff --git a/deps/v8/test/message/fail/weak-refs-finalizationgroup2.out b/deps/v8/test/message/fail/weak-refs-finalizationgroup2.out
new file mode 100644
index 0000000000..799199aff8
--- /dev/null
+++ b/deps/v8/test/message/fail/weak-refs-finalizationgroup2.out
@@ -0,0 +1,6 @@
+*%(basename)s:7: TypeError: FinalizationGroup: cleanup must be callable
+let fg = new FinalizationGroup({});
+ ^
+TypeError: FinalizationGroup: cleanup must be callable
+ at new FinalizationGroup (<anonymous>)
+ at *%(basename)s:7:10
diff --git a/deps/v8/test/message/fail/weak-refs-makecell1.out b/deps/v8/test/message/fail/weak-refs-makecell1.out
deleted file mode 100644
index 5c74c1f7fa..0000000000
--- a/deps/v8/test/message/fail/weak-refs-makecell1.out
+++ /dev/null
@@ -1,6 +0,0 @@
-*%(basename)s:8: TypeError: WeakFactory.prototype.makeCell: target must be an object
-wf.makeCell(1);
- ^
-TypeError: WeakFactory.prototype.makeCell: target must be an object
- at WeakFactory.makeCell (<anonymous>)
- at *%(basename)s:8:4
diff --git a/deps/v8/test/message/fail/weak-refs-makecell2.out b/deps/v8/test/message/fail/weak-refs-makecell2.out
deleted file mode 100644
index 2ea8033183..0000000000
--- a/deps/v8/test/message/fail/weak-refs-makecell2.out
+++ /dev/null
@@ -1,6 +0,0 @@
-*%(basename)s:9: TypeError: WeakFactory.prototype.makeCell: target and holdings must not be same
-wf.makeCell(o, o);
- ^
-TypeError: WeakFactory.prototype.makeCell: target and holdings must not be same
- at WeakFactory.makeCell (<anonymous>)
- at *%(basename)s:9:4
diff --git a/deps/v8/test/message/fail/weak-refs-makecell1.js b/deps/v8/test/message/fail/weak-refs-register1.js
index 416fcca255..a90e4aa47c 100644
--- a/deps/v8/test/message/fail/weak-refs-makecell1.js
+++ b/deps/v8/test/message/fail/weak-refs-register1.js
@@ -4,5 +4,5 @@
// Flags: --harmony-weak-refs
-let wf = new WeakFactory(() => {});
-wf.makeCell(1);
+let fg = new FinalizationGroup(() => {});
+fg.register(1);
diff --git a/deps/v8/test/message/fail/weak-refs-register1.out b/deps/v8/test/message/fail/weak-refs-register1.out
new file mode 100644
index 0000000000..96983664c2
--- /dev/null
+++ b/deps/v8/test/message/fail/weak-refs-register1.out
@@ -0,0 +1,6 @@
+*%(basename)s:8: TypeError: FinalizationGroup.prototype.register: target must be an object
+fg.register(1);
+ ^
+TypeError: FinalizationGroup.prototype.register: target must be an object
+ at FinalizationGroup.register (<anonymous>)
+ at *%(basename)s:8:4
diff --git a/deps/v8/test/message/fail/weak-refs-makecell2.js b/deps/v8/test/message/fail/weak-refs-register2.js
index df0352554f..8934a46511 100644
--- a/deps/v8/test/message/fail/weak-refs-makecell2.js
+++ b/deps/v8/test/message/fail/weak-refs-register2.js
@@ -4,6 +4,6 @@
// Flags: --harmony-weak-refs
-let wf = new WeakFactory(() => {});
+let fg = new FinalizationGroup(() => {});
let o = {};
-wf.makeCell(o, o);
+fg.register(o, o);
diff --git a/deps/v8/test/message/fail/weak-refs-register2.out b/deps/v8/test/message/fail/weak-refs-register2.out
new file mode 100644
index 0000000000..c7b9e10909
--- /dev/null
+++ b/deps/v8/test/message/fail/weak-refs-register2.out
@@ -0,0 +1,6 @@
+*%(basename)s:9: TypeError: FinalizationGroup.prototype.register: target and holdings must not be same
+fg.register(o, o);
+ ^
+TypeError: FinalizationGroup.prototype.register: target and holdings must not be same
+ at FinalizationGroup.register (<anonymous>)
+ at *%(basename)s:9:4
diff --git a/deps/v8/test/message/fail/weak-refs-weakfactory1.out b/deps/v8/test/message/fail/weak-refs-weakfactory1.out
deleted file mode 100644
index e865df3053..0000000000
--- a/deps/v8/test/message/fail/weak-refs-weakfactory1.out
+++ /dev/null
@@ -1,6 +0,0 @@
-*%(basename)s:7: TypeError: WeakFactory: cleanup must be callable
-let wf = new WeakFactory();
- ^
-TypeError: WeakFactory: cleanup must be callable
- at new WeakFactory (<anonymous>)
- at *%(basename)s:7:10
diff --git a/deps/v8/test/message/fail/weak-refs-weakfactory2.out b/deps/v8/test/message/fail/weak-refs-weakfactory2.out
deleted file mode 100644
index 7a6ee459b3..0000000000
--- a/deps/v8/test/message/fail/weak-refs-weakfactory2.out
+++ /dev/null
@@ -1,6 +0,0 @@
-*%(basename)s:7: TypeError: WeakFactory: cleanup must be callable
-let wf = new WeakFactory({});
- ^
-TypeError: WeakFactory: cleanup must be callable
- at new WeakFactory (<anonymous>)
- at *%(basename)s:7:10
diff --git a/deps/v8/test/message/message.status b/deps/v8/test/message/message.status
index cc604a5a3b..25c87b5e5c 100644
--- a/deps/v8/test/message/message.status
+++ b/deps/v8/test/message/message.status
@@ -54,13 +54,19 @@
}], # no_i18n == True
##############################################################################
-['lite_mode', {
+['lite_mode or variant == jitless', {
# TODO(v8:7777): Re-enable once wasm is supported in jitless mode.
+ 'mjsunit/fail/assert-promise-result-wasm-compile-fail': [SKIP],
'fail/wasm-*': [SKIP],
'wasm-*': [SKIP],
# Test output requires --validate-asm, which is disabled in jitless mode.
'asm-*': [SKIP],
-}], # lite_mode
+}], # lite_mode or variant == jitless
+
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
]
diff --git a/deps/v8/test/message/mjsunit/fail/assert-promise-result-wasm-compile-fail.js b/deps/v8/test/message/mjsunit/fail/assert-promise-result-wasm-compile-fail.js
new file mode 100644
index 0000000000..ebfa83d042
--- /dev/null
+++ b/deps/v8/test/message/mjsunit/fail/assert-promise-result-wasm-compile-fail.js
@@ -0,0 +1,30 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Test wasm compilation explicitly, since this creates a promise which is only
+// resolved later, i.e. the message queue gets empty in-between.
+// The important part here is that d8 exits with a non-zero exit code.
+
+load('test/mjsunit/mjsunit.js');
+load('test/mjsunit/wasm/wasm-module-builder.js');
+
+assertPromiseResult((async function test() {
+ let ok_buffer = (() => {
+ let builder = new WasmModuleBuilder();
+ builder.addFunction(undefined, kSig_i_v).addBody([kExprI32Const, 42]);
+ return builder.toBuffer();
+ })();
+ let bad_buffer = new ArrayBuffer(0);
+ let kNumCompiles = 3;
+
+ // Three compilations of the OK module should succeed.
+ for (var i = 0; i < kNumCompiles; ++i) {
+ await WebAssembly.compile(ok_buffer);
+ }
+
+ // Three compilations of the bad module should fail.
+ for (var i = 0; i < kNumCompiles; ++i) {
+ await WebAssembly.compile(bad_buffer);
+ }
+})());
diff --git a/deps/v8/test/message/mjsunit/fail/assert-promise-result-wasm-compile-fail.out b/deps/v8/test/message/mjsunit/fail/assert-promise-result-wasm-compile-fail.out
new file mode 100644
index 0000000000..ecee922cbc
--- /dev/null
+++ b/deps/v8/test/message/mjsunit/fail/assert-promise-result-wasm-compile-fail.out
@@ -0,0 +1,9 @@
+test/mjsunit/mjsunit.js:{NUMBER}: CompileError: WebAssembly.compile(): BufferSource argument is empty
+ throw concatenateErrors(stack, e);
+ ^
+Error
+ at assertPromiseResult (test/mjsunit/mjsunit.js:{NUMBER}:{NUMBER})
+ at *%(basename)s:{NUMBER}:1
+
+CompileError: WebAssembly.compile(): BufferSource argument is empty
+ at test (*%(basename)s:{NUMBER}:23)
diff --git a/deps/v8/test/message/regress/fail/regress-900383.out b/deps/v8/test/message/regress/fail/regress-900383.out
index 490ca03a80..f718b4f46d 100644
--- a/deps/v8/test/message/regress/fail/regress-900383.out
+++ b/deps/v8/test/message/regress/fail/regress-900383.out
@@ -1,4 +1,4 @@
*%(basename)s:8: SyntaxError: Identifier '*default*' has already been declared
export default x = 1;
- ^
+ ^^^^^^^^^^^^^
SyntaxError: Identifier '*default*' has already been declared
diff --git a/deps/v8/test/message/testcfg.py b/deps/v8/test/message/testcfg.py
index e27a3ed2a2..74c26b8525 100644
--- a/deps/v8/test/message/testcfg.py
+++ b/deps/v8/test/message/testcfg.py
@@ -39,21 +39,8 @@ MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE)
class TestSuite(testsuite.TestSuite):
- def ListTests(self):
- tests = []
- for dirname, dirs, files in os.walk(self.root):
- for dotted in [x for x in dirs if x.startswith('.')]:
- dirs.remove(dotted)
- dirs.sort()
- files.sort()
- for filename in files:
- if filename.endswith(".js"):
- fullpath = os.path.join(dirname, filename)
- relpath = fullpath[len(self.root) + 1 : -3]
- testname = relpath.replace(os.path.sep, "/")
- test = self._create_test(testname)
- tests.append(test)
- return tests
+ def _test_loader_class(self):
+ return testsuite.JSTestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/message/wasm-finish-compilation.js b/deps/v8/test/message/wasm-finish-compilation.js
index ca0f952bc1..0144b2c786 100644
--- a/deps/v8/test/message/wasm-finish-compilation.js
+++ b/deps/v8/test/message/wasm-finish-compilation.js
@@ -4,7 +4,6 @@
// Flags: --no-stress-opt
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// Test that d8 does not terminate until wasm compilation has finished and the
diff --git a/deps/v8/test/message/wasm-function-name-async.js b/deps/v8/test/message/wasm-function-name-async.js
index ddff21ee21..3b80a4d27d 100644
--- a/deps/v8/test/message/wasm-function-name-async.js
+++ b/deps/v8/test/message/wasm-function-name-async.js
@@ -5,7 +5,6 @@
// Flags: --expose-wasm --no-stress-opt
load('test/mjsunit/mjsunit.js');
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/message/wasm-function-name-async.out b/deps/v8/test/message/wasm-function-name-async.out
index 4627c7fcf3..b025f650c6 100644
--- a/deps/v8/test/message/wasm-function-name-async.out
+++ b/deps/v8/test/message/wasm-function-name-async.out
@@ -1,4 +1,4 @@
RuntimeError: unreachable
at main (wasm-function[0]:1)
- at *%(basename)s:16:27
+ at *%(basename)s:{NUMBER}:27
at test/mjsunit/mjsunit.js:*
diff --git a/deps/v8/test/message/wasm-function-name-streaming.out b/deps/v8/test/message/wasm-function-name-streaming.out
index 2e33b0808b..f5dde3dd87 100644
--- a/deps/v8/test/message/wasm-function-name-streaming.out
+++ b/deps/v8/test/message/wasm-function-name-streaming.out
@@ -1,4 +1,4 @@
RuntimeError: unreachable
at main (wasm-function[0]:1)
- at test/message/wasm-function-name-async.js:16:27
+ at test/message/wasm-function-name-async.js:{NUMBER}:27
at test/mjsunit/mjsunit.js:*
diff --git a/deps/v8/test/message/wasm-module-and-function-name-async.js b/deps/v8/test/message/wasm-module-and-function-name-async.js
index fa29cab216..d84d67da6e 100644
--- a/deps/v8/test/message/wasm-module-and-function-name-async.js
+++ b/deps/v8/test/message/wasm-module-and-function-name-async.js
@@ -5,7 +5,6 @@
// Flags: --expose-wasm --no-stress-opt
load('test/mjsunit/mjsunit.js');
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/message/wasm-module-and-function-name-async.out b/deps/v8/test/message/wasm-module-and-function-name-async.out
index d1d62dd5be..e1ca097e64 100644
--- a/deps/v8/test/message/wasm-module-and-function-name-async.out
+++ b/deps/v8/test/message/wasm-module-and-function-name-async.out
@@ -1,4 +1,4 @@
RuntimeError: unreachable
at test-module.main (wasm-function[0]:1)
- at *%(basename)s:17:27
+ at *%(basename)s:{NUMBER}:27
at test/mjsunit/mjsunit.js:*
diff --git a/deps/v8/test/message/wasm-module-and-function-name-streaming.out b/deps/v8/test/message/wasm-module-and-function-name-streaming.out
index fc7360383a..4afaa66bbe 100644
--- a/deps/v8/test/message/wasm-module-and-function-name-streaming.out
+++ b/deps/v8/test/message/wasm-module-and-function-name-streaming.out
@@ -1,4 +1,4 @@
RuntimeError: unreachable
at test-module.main (wasm-function[0]:1)
- at test/message/wasm-module-and-function-name-async.js:17:27
+ at test/message/wasm-module-and-function-name-async.js:{NUMBER}:27
at test/mjsunit/mjsunit.js:*
diff --git a/deps/v8/test/message/wasm-module-name-async.js b/deps/v8/test/message/wasm-module-name-async.js
index d24357965b..a0d501fc25 100644
--- a/deps/v8/test/message/wasm-module-name-async.js
+++ b/deps/v8/test/message/wasm-module-name-async.js
@@ -5,7 +5,6 @@
// Flags: --expose-wasm --no-stress-opt
load('test/mjsunit/mjsunit.js');
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/message/wasm-module-name-async.out b/deps/v8/test/message/wasm-module-name-async.out
index 6301dba480..9163b31277 100644
--- a/deps/v8/test/message/wasm-module-name-async.out
+++ b/deps/v8/test/message/wasm-module-name-async.out
@@ -1,4 +1,4 @@
RuntimeError: unreachable
at test-module (wasm-function[0]:1)
- at *%(basename)s:19:27
+ at *%(basename)s:{NUMBER}:27
at test/mjsunit/mjsunit.js:*
diff --git a/deps/v8/test/message/wasm-module-name-streaming.out b/deps/v8/test/message/wasm-module-name-streaming.out
index e16c7ad373..98fba539db 100644
--- a/deps/v8/test/message/wasm-module-name-streaming.out
+++ b/deps/v8/test/message/wasm-module-name-streaming.out
@@ -1,4 +1,4 @@
RuntimeError: unreachable
at test-module (wasm-function[0]:1)
- at test/message/wasm-module-name-async.js:19:27
+ at test/message/wasm-module-name-async.js:{NUMBER}:27
at test/mjsunit/mjsunit.js:*
diff --git a/deps/v8/test/message/wasm-no-name-async.js b/deps/v8/test/message/wasm-no-name-async.js
index f60ba35133..0078fbd46e 100644
--- a/deps/v8/test/message/wasm-no-name-async.js
+++ b/deps/v8/test/message/wasm-no-name-async.js
@@ -5,7 +5,6 @@
// Flags: --expose-wasm --no-stress-opt
load('test/mjsunit/mjsunit.js');
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/message/wasm-no-name-async.out b/deps/v8/test/message/wasm-no-name-async.out
index 0a299aaaed..4c622a7583 100644
--- a/deps/v8/test/message/wasm-no-name-async.out
+++ b/deps/v8/test/message/wasm-no-name-async.out
@@ -1,4 +1,4 @@
RuntimeError: unreachable
at wasm-function[0]:1
- at *%(basename)s:18:27
+ at *%(basename)s:{NUMBER}:27
at test/mjsunit/mjsunit.js:*
diff --git a/deps/v8/test/message/wasm-no-name-streaming.out b/deps/v8/test/message/wasm-no-name-streaming.out
index e4bcb2f48e..59e070b0b8 100644
--- a/deps/v8/test/message/wasm-no-name-streaming.out
+++ b/deps/v8/test/message/wasm-no-name-streaming.out
@@ -1,4 +1,4 @@
RuntimeError: unreachable
at wasm-function[0]:1
- at test/message/wasm-no-name-async.js:18:27
+ at test/message/wasm-no-name-async.js:{NUMBER}:27
at test/mjsunit/mjsunit.js:*
diff --git a/deps/v8/test/message/wasm-trace-memory.js b/deps/v8/test/message/wasm-trace-memory.js
index 53c46073ec..23425f4ddb 100644
--- a/deps/v8/test/message/wasm-trace-memory.js
+++ b/deps/v8/test/message/wasm-trace-memory.js
@@ -5,7 +5,6 @@
// Flags: --no-stress-opt --trace-wasm-memory --no-liftoff --no-future
// Flags: --no-wasm-tier-up
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/arguments.js b/deps/v8/test/mjsunit/arguments.js
index ad12540c6d..6f04115c8b 100644
--- a/deps/v8/test/mjsunit/arguments.js
+++ b/deps/v8/test/mjsunit/arguments.js
@@ -366,3 +366,14 @@ assertEquals(117, arg_set(0xFFFFFFFF));
f7(1,2,3,4,5,6,7);
f7(1,2,3,4,5,6,7,8);
})();
+
+(function testArgumentsHole() {
+ function f(a) {
+ arguments[3] = 1;
+ return arguments[2];
+ };
+
+ assertEquals(undefined, f(1));
+ assertEquals(undefined, f(1));
+ assertEquals(undefined, f(1));
+})();
diff --git a/deps/v8/test/mjsunit/array-constructor-feedback.js b/deps/v8/test/mjsunit/array-constructor-feedback.js
index 44d132820c..aa6fbbed54 100644
--- a/deps/v8/test/mjsunit/array-constructor-feedback.js
+++ b/deps/v8/test/mjsunit/array-constructor-feedback.js
@@ -92,40 +92,6 @@ function assertKind(expected, obj, name_opt) {
})();
-// Test: Ensure that inlined array calls in crankshaft learn from deopts
-// based on the move to a dictionary for the array.
-(function() {
- function bar(len) {
- return new Array(len);
- }
- a = bar(10);
- a[0] = "a string";
- a = bar(10);
- assertKind(elements_kind.fast, a);
- %OptimizeFunctionOnNextCall(bar);
- a = bar(10);
- assertKind(elements_kind.fast, a);
- assertOptimized(bar);
- bar(10000);
- assertOptimized(bar);
-
- function barn(one, two, three) {
- return new Array(one, two, three);
- }
-
- a = barn(1, 2, 3);
- a[1] = "a string";
- a = barn(1, 2, 3);
- assertKind(elements_kind.fast, a);
- %OptimizeFunctionOnNextCall(barn);
- a = barn(1, 2, 3);
- assertKind(elements_kind.fast, a);
- assertOptimized(barn);
- a = barn(1, "oops", 3);
- assertOptimized(barn);
-})();
-
-
// Test: When a method with array constructor is crankshafted, the type
// feedback for elements kind is baked in. Verify that transitions don't
// change it anymore
diff --git a/deps/v8/test/mjsunit/array-push5.js b/deps/v8/test/mjsunit/array-push5.js
index 9961ff98c3..88ebd3a4a2 100644
--- a/deps/v8/test/mjsunit/array-push5.js
+++ b/deps/v8/test/mjsunit/array-push5.js
@@ -14,6 +14,7 @@ my_array_proto.__proto__ = [].__proto__;
function push_wrapper_2(array, value) {
array.push(value);
}
+%PrepareFunctionForOptimization(push_wrapper_2);
array = [];
array.__proto__ = my_array_proto;
push_wrapper_2(array, 66);
diff --git a/deps/v8/test/mjsunit/array-reduce.js b/deps/v8/test/mjsunit/array-reduce.js
index dd7c378847..f9e8aeee22 100644
--- a/deps/v8/test/mjsunit/array-reduce.js
+++ b/deps/v8/test/mjsunit/array-reduce.js
@@ -509,6 +509,13 @@ testReduce("reduce", "ArrayManipulationShort", 3,
[1, 2, 1, [1, 2], 3],
], arr, manipulator, 0);
+var arr = [1, 2, 3, 4];
+testReduce("reduceRight", "RightArrayManipulationShort", 7,
+ [[0, 4, 3, [1, 2, 3, 4], 4],
+ [4, 2, 1, [1, 2], 6],
+ [6, 1, 0, [1], 7],
+ ], arr, manipulator, 0);
+
var arr = [1, 2, 3, 4, 5];
testReduce("reduce", "ArrayManipulationLonger", 10,
[[0, 1, 0, [1, 2, 3, 4, 5], 1],
diff --git a/deps/v8/test/mjsunit/code-coverage-ad-hoc.js b/deps/v8/test/mjsunit/code-coverage-ad-hoc.js
index 184c7d52b7..b6ae4620ea 100644
--- a/deps/v8/test/mjsunit/code-coverage-ad-hoc.js
+++ b/deps/v8/test/mjsunit/code-coverage-ad-hoc.js
@@ -57,3 +57,19 @@ fib(5);
[{"start":0,"end":80,"count":1},
{"start":0,"end":72,"count":1}]
);
+
+TestCoverageNoGC(
+"https://crbug.com/927464",
+`
+!function f() { // 0000
+ function unused() { nop(); } // 0100
+ nop(); // 0150
+}(); // 0200
+`,
+[{"start":0,"end":199,"count":1},
+ {"start":1,"end":151,"count":1}
+ // The unused function is unfortunately not marked as unused in best-effort
+ // code coverage, as the information about its source range is discarded
+ // entirely.
+]
+);
diff --git a/deps/v8/test/mjsunit/code-coverage-block-opt.js b/deps/v8/test/mjsunit/code-coverage-block-opt.js
index ee21ff6a80..99f0a55e74 100644
--- a/deps/v8/test/mjsunit/code-coverage-block-opt.js
+++ b/deps/v8/test/mjsunit/code-coverage-block-opt.js
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Flags: --allow-natives-syntax --no-always-opt --opt
-// Flags: --no-stress-flush-bytecode
+// Flags: --no-stress-flush-bytecode --turbo-inlining
// Files: test/mjsunit/code-coverage-utils.js
if (isNeverOptimizeLiteMode()) {
diff --git a/deps/v8/test/mjsunit/code-coverage-precise.js b/deps/v8/test/mjsunit/code-coverage-precise.js
index 2593ed64a0..3c70408174 100644
--- a/deps/v8/test/mjsunit/code-coverage-precise.js
+++ b/deps/v8/test/mjsunit/code-coverage-precise.js
@@ -50,4 +50,17 @@ for (var i = 0; i < 10; i++) {
[{"start":0,"end":63,"count":1},{"start":41,"end":48,"count":5}]
);
+TestCoverage(
+"https://crbug.com/927464",
+`
+!function f() { // 0000
+ function unused() { nop(); } // 0100
+ nop(); // 0150
+}(); // 0200
+`,
+[{"start":0,"end":199,"count":1},
+ {"start":1,"end":151,"count":1},
+ {"start":52,"end":80,"count":0}]
+);
+
%DebugTogglePreciseCoverage(false);
diff --git a/deps/v8/test/mjsunit/compiler/abstract-equal-receiver.js b/deps/v8/test/mjsunit/compiler/abstract-equal-receiver.js
index 1026b68342..1388de7c10 100644
--- a/deps/v8/test/mjsunit/compiler/abstract-equal-receiver.js
+++ b/deps/v8/test/mjsunit/compiler/abstract-equal-receiver.js
@@ -11,6 +11,7 @@
function foo() { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -24,6 +25,7 @@
function foo() { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -37,6 +39,7 @@
function foo() { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -50,6 +53,7 @@
function foo() { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -63,6 +67,7 @@
function foo() { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -76,6 +81,7 @@
function foo(a) { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(b));
@@ -96,6 +102,7 @@
function foo(a) { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(b));
@@ -116,6 +123,7 @@
function foo(a) { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(b));
@@ -136,6 +144,7 @@
function foo(a) { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(b));
@@ -159,6 +168,7 @@
function foo(a) { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(b));
diff --git a/deps/v8/test/mjsunit/compiler/abstract-equal-symbol.js b/deps/v8/test/mjsunit/compiler/abstract-equal-symbol.js
index c1057e1d1b..2a7c9643ec 100644
--- a/deps/v8/test/mjsunit/compiler/abstract-equal-symbol.js
+++ b/deps/v8/test/mjsunit/compiler/abstract-equal-symbol.js
@@ -11,6 +11,7 @@
function foo() { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -24,6 +25,7 @@
function foo() { return a != b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -38,6 +40,7 @@
function foo(a) { return a == b; }
// Warmup
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(b));
@@ -52,6 +55,7 @@
assertUnoptimized(foo);
// Make sure TurboFan learns the new feedback
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo("a"));
assertOptimized(foo);
@@ -65,6 +69,7 @@
function foo(a) { return a != b; }
// Warmup
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(b));
assertTrue(foo(a));
assertFalse(foo(b));
@@ -78,6 +83,7 @@
assertUnoptimized(foo);
// Make sure TurboFan learns the new feedback
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(foo("a"));
assertOptimized(foo);
@@ -91,6 +97,7 @@
function foo(a, b) { return a == b; }
// Warmup
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b, b));
assertFalse(foo(a, b));
assertTrue(foo(a, a));
@@ -104,6 +111,7 @@
assertUnoptimized(foo);
// Make sure TurboFan learns the new feedback
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo("a", b));
assertOptimized(foo);
@@ -116,6 +124,7 @@
function foo(a, b) { return a != b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(b, b));
assertTrue(foo(a, b));
assertFalse(foo(a, a));
@@ -129,6 +138,7 @@
assertUnoptimized(foo);
// Make sure TurboFan learns the new feedback
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(foo("a", b));
assertOptimized(foo);
diff --git a/deps/v8/test/mjsunit/compiler/abstract-equal-undetectable.js b/deps/v8/test/mjsunit/compiler/abstract-equal-undetectable.js
index 1e1bb6ba2d..ad866aa7be 100644
--- a/deps/v8/test/mjsunit/compiler/abstract-equal-undetectable.js
+++ b/deps/v8/test/mjsunit/compiler/abstract-equal-undetectable.js
@@ -13,6 +13,7 @@ const undetectable = %GetUndetectable();
function foo() { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -26,6 +27,7 @@ const undetectable = %GetUndetectable();
function foo() { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -39,6 +41,7 @@ const undetectable = %GetUndetectable();
function foo() { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -52,6 +55,7 @@ const undetectable = %GetUndetectable();
function foo() { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -65,6 +69,7 @@ const undetectable = %GetUndetectable();
function foo() { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -78,6 +83,7 @@ const undetectable = %GetUndetectable();
function foo(a) { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(b));
@@ -98,6 +104,7 @@ const undetectable = %GetUndetectable();
function foo(a, b) { return a == b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b, b));
assertFalse(foo(a, b));
assertTrue(foo(a, a));
diff --git a/deps/v8/test/mjsunit/compiler/accessor-exceptions1.js b/deps/v8/test/mjsunit/compiler/accessor-exceptions1.js
index 716d229aba..42b2f11cb3 100644
--- a/deps/v8/test/mjsunit/compiler/accessor-exceptions1.js
+++ b/deps/v8/test/mjsunit/compiler/accessor-exceptions1.js
@@ -15,6 +15,7 @@ function foo(o) {
return x;
}
+%PrepareFunctionForOptimization(foo);
assertEquals(7, foo(o));
assertEquals(7, foo(o));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/accessor-exceptions2.js b/deps/v8/test/mjsunit/compiler/accessor-exceptions2.js
index ed6e3e21c0..2d784e63e5 100644
--- a/deps/v8/test/mjsunit/compiler/accessor-exceptions2.js
+++ b/deps/v8/test/mjsunit/compiler/accessor-exceptions2.js
@@ -15,6 +15,7 @@ function foo(o) {
return x;
}
+%PrepareFunctionForOptimization(foo);
assertEquals(7, foo(o));
assertEquals(7, foo(o));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/alloc-object-huge.js b/deps/v8/test/mjsunit/compiler/alloc-object-huge.js
index 74b600cc7d..1333b64145 100644
--- a/deps/v8/test/mjsunit/compiler/alloc-object-huge.js
+++ b/deps/v8/test/mjsunit/compiler/alloc-object-huge.js
@@ -36,6 +36,7 @@
function test() {
return new huge();
}
+%PrepareFunctionForOptimization(test);
test();
test();
%OptimizeFunctionOnNextCall(test);
diff --git a/deps/v8/test/mjsunit/compiler/alloc-object.js b/deps/v8/test/mjsunit/compiler/alloc-object.js
index 8d19816536..78e9c51398 100644
--- a/deps/v8/test/mjsunit/compiler/alloc-object.js
+++ b/deps/v8/test/mjsunit/compiler/alloc-object.js
@@ -37,6 +37,7 @@ function test_helper(construct, a, b) {
function test(construct) {
%DeoptimizeFunction(test);
+ %PrepareFunctionForOptimization(test_helper);
test_helper(construct, 0, 0);
test_helper(construct, 0, 0);
%OptimizeFunctionOnNextCall(test_helper);
diff --git a/deps/v8/test/mjsunit/compiler/arguments-object.js b/deps/v8/test/mjsunit/compiler/arguments-object.js
new file mode 100644
index 0000000000..4562c08826
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/arguments-object.js
@@ -0,0 +1,171 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --noturbo-inlining
+
+// Ensure that arguments in sloppy mode function works
+// properly when called directly from optimized code.
+(function() {
+ function g() { return arguments; }
+ function f() { return g(1, 2, 3); }
+
+ %PrepareFunctionForOptimization(f);
+ assertEquals(g(1, 2, 3), f());
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(g(1, 2, 3), f());
+ %PrepareFunctionForOptimization(g);
+ %OptimizeFunctionOnNextCall(g);
+ assertEquals(g(1, 2, 3), f());
+})();
+
+// Ensure that arguments in strict mode function works
+// properly when called directly from optimized code.
+(function() {
+ "use strict";
+ function g() { return arguments; }
+ function f() { return g(1, 2, 3); }
+
+ %PrepareFunctionForOptimization(f);
+ assertEquals(g(1, 2, 3), f());
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(g(1, 2, 3), f());
+ %PrepareFunctionForOptimization(g);
+ %OptimizeFunctionOnNextCall(g);
+ assertEquals(g(1, 2, 3), f());
+})();
+
+// Ensure that arguments in sloppy mode function works
+// properly when called directly from optimized code,
+// and the access to "arguments" is hidden inside eval().
+(function() {
+ function g() { return eval("arguments"); }
+ function f() { return g(1, 2, 3); }
+
+ %PrepareFunctionForOptimization(f);
+ assertEquals(g(1, 2, 3), f());
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(g(1, 2, 3), f());
+ %PrepareFunctionForOptimization(g);
+ %OptimizeFunctionOnNextCall(g);
+ assertEquals(g(1, 2, 3), f());
+})();
+
+// Ensure that arguments in strict mode function works
+// properly when called directly from optimized code,
+// and the access to "arguments" is hidden inside eval().
+(function() {
+ "use strict";
+ function g() { return eval("arguments"); }
+ function f() { return g(1, 2, 3); }
+
+ %PrepareFunctionForOptimization(f);
+ assertEquals(g(1, 2, 3), f());
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(g(1, 2, 3), f());
+ %PrepareFunctionForOptimization(g);
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(g);
+ assertEquals(g(1, 2, 3), f());
+})();
+
+// Ensure that `Function.arguments` accessor does the
+// right thing in sloppy mode functions called directly
+// from optimized code.
+(function() {
+ function h() { return g.arguments; }
+ function g() { return h(); }
+ function f() { return g(1, 2, 3); }
+
+ %PrepareFunctionForOptimization(f);
+ assertEquals(g(1, 2, 3), f());
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(g(1, 2, 3), f());
+ %PrepareFunctionForOptimization(g);
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(g);
+ assertEquals(g(1, 2, 3), f());
+})();
+(function() {
+ function h() { return g.arguments; }
+ function g() { return h(); }
+ function f() { "use strict"; return g(1, 2, 3); }
+
+ %PrepareFunctionForOptimization(f);
+ assertEquals(g(1, 2, 3), f());
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(g(1, 2, 3), f());
+ %PrepareFunctionForOptimization(g);
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(g);
+ assertEquals(g(1, 2, 3), f());
+})();
+(function() {
+ function h() { "use strict"; return g.arguments; }
+ function g() { return h(); }
+ function f() { return g(1, 2, 3); }
+
+ %PrepareFunctionForOptimization(f);
+ assertEquals(g(1, 2, 3), f());
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(g(1, 2, 3), f());
+ %PrepareFunctionForOptimization(g);
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(g);
+ assertEquals(g(1, 2, 3), f());
+})();
+(function() {
+ function h() { "use strict"; return g.arguments; }
+ function g() { return h(); }
+ function f() { "use strict"; return g(1, 2, 3); }
+
+ %PrepareFunctionForOptimization(f);
+ assertEquals(g(1, 2, 3), f());
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(g(1, 2, 3), f());
+ %PrepareFunctionForOptimization(g);
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(g);
+ assertEquals(g(1, 2, 3), f());
+})();
+
+// Ensure that `Function.arguments` works properly in
+// combination with the `Function.caller` proper.
+(function() {
+ function h() { return h.caller.arguments; }
+ function g() { return h(); }
+ function f() { return g(1, 2, 3); }
+
+ %PrepareFunctionForOptimization(f);
+ assertEquals(g(1, 2, 3), f());
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(g(1, 2, 3), f());
+ %PrepareFunctionForOptimization(g);
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(g);
+ assertEquals(g(1, 2, 3), f());
+})();
+(function() {
+ function h() { return h.caller.arguments; }
+ function g() { return h(); }
+ function f() { "use strict"; return g(1, 2, 3); }
+
+ %PrepareFunctionForOptimization(f);
+ assertEquals(g(1, 2, 3), f());
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(f);
+ assertEquals(g(1, 2, 3), f());
+ %PrepareFunctionForOptimization(g);
+ assertEquals(g(1, 2, 3), f());
+ %OptimizeFunctionOnNextCall(g);
+ assertEquals(g(1, 2, 3), f());
+})();
diff --git a/deps/v8/test/mjsunit/compiler/array-buffer-is-view.js b/deps/v8/test/mjsunit/compiler/array-buffer-is-view.js
index b56763b5b2..f2e5c30101 100644
--- a/deps/v8/test/mjsunit/compiler/array-buffer-is-view.js
+++ b/deps/v8/test/mjsunit/compiler/array-buffer-is-view.js
@@ -15,6 +15,7 @@
return ArrayBuffer.isView({x}.x);
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(Symbol()));
assertFalse(foo("some string"));
assertFalse(foo(new Object()));
@@ -41,6 +42,7 @@
return ArrayBuffer.isView(x);
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(1));
assertFalse(foo(1.1));
assertFalse(foo(Symbol()));
diff --git a/deps/v8/test/mjsunit/compiler/array-constructor.js b/deps/v8/test/mjsunit/compiler/array-constructor.js
index eef242714b..b45f5c4965 100644
--- a/deps/v8/test/mjsunit/compiler/array-constructor.js
+++ b/deps/v8/test/mjsunit/compiler/array-constructor.js
@@ -8,6 +8,7 @@
(() => {
function foo(x) { return Array(!!x); }
+ %PrepareFunctionForOptimization(foo);
assertEquals([true], foo(true));
assertEquals([false], foo(false));
%OptimizeFunctionOnNextCall(foo);
@@ -19,6 +20,7 @@
(() => {
function foo(x) { return new Array(!!x); }
+ %PrepareFunctionForOptimization(foo);
assertEquals([true], foo(true));
assertEquals([false], foo(false));
%OptimizeFunctionOnNextCall(foo);
@@ -30,6 +32,7 @@
(() => {
function foo(x) { return Array("" + x); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(["a"], foo("a"));
assertEquals(["b"], foo("b"));
%OptimizeFunctionOnNextCall(foo);
@@ -41,6 +44,7 @@
(() => {
function foo(x) { return new Array("" + x); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(["a"], foo("a"));
assertEquals(["b"], foo("b"));
%OptimizeFunctionOnNextCall(foo);
@@ -52,6 +56,7 @@
(() => {
function foo() { return Array(2); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo().length);
assertEquals(2, foo().length);
%OptimizeFunctionOnNextCall(foo);
@@ -62,6 +67,7 @@
(() => {
function foo() { return new Array(2); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo().length);
assertEquals(2, foo().length);
%OptimizeFunctionOnNextCall(foo);
@@ -72,6 +78,7 @@
(() => {
function foo(x, y, z) { return Array(x, y, z); }
+ %PrepareFunctionForOptimization(foo);
assertEquals([1, 2, 3], foo(1, 2, 3));
assertEquals([1, 2, 3], foo(1, 2, 3));
%OptimizeFunctionOnNextCall(foo);
@@ -82,6 +89,7 @@
(() => {
function foo(x, y, z) { return new Array(x, y, z); }
+ %PrepareFunctionForOptimization(foo);
assertEquals([1, 2, 3], foo(1, 2, 3));
assertEquals([1, 2, 3], foo(1, 2, 3));
%OptimizeFunctionOnNextCall(foo);
@@ -92,6 +100,7 @@
(() => {
function foo(x) { try { return new Array(x) } catch (e) { return e } }
+ %PrepareFunctionForOptimization(foo);
assertEquals([], foo(0));
assertEquals([], foo(0));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/array-every.js b/deps/v8/test/mjsunit/compiler/array-every.js
index 5064bd557d..a3f609e4df 100644
--- a/deps/v8/test/mjsunit/compiler/array-every.js
+++ b/deps/v8/test/mjsunit/compiler/array-every.js
@@ -10,6 +10,7 @@
return a.every(x => x === o.x);
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo([3, 3, 3], {x:3}));
assertFalse(foo([3, 3, 2], {x:3}));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/array-find.js b/deps/v8/test/mjsunit/compiler/array-find.js
index 419a758ac7..94fb2cb5df 100644
--- a/deps/v8/test/mjsunit/compiler/array-find.js
+++ b/deps/v8/test/mjsunit/compiler/array-find.js
@@ -10,6 +10,7 @@
return a.find(x => x === o.x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(3, foo([1, 2, 3], {x:3}));
assertEquals(undefined, foo([0, 1, 2], {x:3}));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/array-findindex.js b/deps/v8/test/mjsunit/compiler/array-findindex.js
index 583f553ce4..881078f24b 100644
--- a/deps/v8/test/mjsunit/compiler/array-findindex.js
+++ b/deps/v8/test/mjsunit/compiler/array-findindex.js
@@ -10,6 +10,7 @@
return a.findIndex(x => x === o.x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo([1, 2, 3], {x:3}));
assertEquals(-1, foo([0, 1, 2], {x:3}));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/array-is-array.js b/deps/v8/test/mjsunit/compiler/array-is-array.js
index 37c916ddac..f41120b029 100644
--- a/deps/v8/test/mjsunit/compiler/array-is-array.js
+++ b/deps/v8/test/mjsunit/compiler/array-is-array.js
@@ -11,6 +11,7 @@
return Array.isArray([]);
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -24,6 +25,7 @@
return Array.isArray(new Proxy([], {}));
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -37,6 +39,7 @@
return Array.isArray({});
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -50,6 +53,7 @@
return Array.isArray(new Proxy({}, {}));
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -63,6 +67,7 @@
return Array.isArray(x);
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo({}));
assertFalse(foo(new Proxy({}, {})));
assertTrue(foo([]));
@@ -97,6 +102,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo([]), TypeError);
assertInstanceof(foo({}), TypeError);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/array-length.js b/deps/v8/test/mjsunit/compiler/array-length.js
index 462a1e7739..10be42a439 100644
--- a/deps/v8/test/mjsunit/compiler/array-length.js
+++ b/deps/v8/test/mjsunit/compiler/array-length.js
@@ -38,11 +38,15 @@ function Test(a0, a2, a5) {
var a0 = [];
var a2 = [1,2];
var a5 = [1,2,3,4,5];
+%PrepareFunctionForOptimization(ArrayLength);
for (var i = 0; i < 5; i++) Test(a0, a2, a5);
%OptimizeFunctionOnNextCall(ArrayLength);
+Test(a0, a2, a5);
+%PrepareFunctionForOptimization(Test);
%OptimizeFunctionOnNextCall(Test);
Test(a0, a2, a5);
assertEquals("undefined", typeof(ArrayLength(0)));
+%PrepareFunctionForOptimization(Test);
for (var i = 0; i < 5; i++) Test(a0, a2, a5);
%OptimizeFunctionOnNextCall(Test);
Test(a0, a2, a5);
diff --git a/deps/v8/test/mjsunit/compiler/array-multiple-receiver-maps.js b/deps/v8/test/mjsunit/compiler/array-multiple-receiver-maps.js
index c26aeda7dc..8f386d06ef 100644
--- a/deps/v8/test/mjsunit/compiler/array-multiple-receiver-maps.js
+++ b/deps/v8/test/mjsunit/compiler/array-multiple-receiver-maps.js
@@ -20,6 +20,7 @@ function runTest(f, message, mkICTraining, deoptArg) {
let t2 = t();
let t3 = t();
+ %PrepareFunctionForOptimization(f);
for (let a of t1) {
f(a.arr, () => a.el);
}
@@ -45,6 +46,7 @@ function runTest(f, message, mkICTraining, deoptArg) {
message_optimized = message + " should have been unoptimized"
f(a1.arr, () => a1.el);
assertUnoptimized(f, undefined, message_unoptimized);
+ %PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
// No speculation should protect against further deopts.
f(a2.arr, () => a2.el);
diff --git a/deps/v8/test/mjsunit/compiler/array-push-1.js b/deps/v8/test/mjsunit/compiler/array-push-1.js
index 58afd6ffe6..3851745e6f 100644
--- a/deps/v8/test/mjsunit/compiler/array-push-1.js
+++ b/deps/v8/test/mjsunit/compiler/array-push-1.js
@@ -10,6 +10,7 @@
return a.push();
}
+ %PrepareFunctionForOptimization(push0);
assertEquals(0, push0([]));
assertEquals(1, push0([1]));
%OptimizeFunctionOnNextCall(push0);
@@ -19,6 +20,7 @@
return a.push(1);
}
+ %PrepareFunctionForOptimization(push1);
assertEquals(1, push1([]));
assertEquals(2, push1([1]));
%OptimizeFunctionOnNextCall(push1);
@@ -28,6 +30,7 @@
return a.push(1, 2);
}
+ %PrepareFunctionForOptimization(push2);
assertEquals(2, push2([]));
assertEquals(3, push2([1]));
%OptimizeFunctionOnNextCall(push2);
@@ -37,6 +40,7 @@
return a.push(1, 2, 3);
}
+ %PrepareFunctionForOptimization(push3);
assertEquals(3, push3([]));
assertEquals(4, push3([1]));
%OptimizeFunctionOnNextCall(push3);
@@ -49,6 +53,7 @@
return a.push();
}
+ %PrepareFunctionForOptimization(push0);
assertEquals(1, push0(new Array(1)));
assertEquals(2, push0(new Array(2)));
%OptimizeFunctionOnNextCall(push0);
@@ -58,6 +63,7 @@
return a.push(1);
}
+ %PrepareFunctionForOptimization(push1);
assertEquals(2, push1(new Array(1)));
assertEquals(3, push1(new Array(2)));
%OptimizeFunctionOnNextCall(push1);
@@ -67,6 +73,7 @@
return a.push(1, 2);
}
+ %PrepareFunctionForOptimization(push2);
assertEquals(3, push2(new Array(1)));
assertEquals(4, push2(new Array(2)));
%OptimizeFunctionOnNextCall(push2);
@@ -76,6 +83,7 @@
return a.push(1, 2, 3);
}
+ %PrepareFunctionForOptimization(push3);
assertEquals(4, push3(new Array(1)));
assertEquals(5, push3(new Array(2)));
%OptimizeFunctionOnNextCall(push3);
@@ -88,6 +96,7 @@
return a.push();
}
+ %PrepareFunctionForOptimization(push0);
assertEquals(1, push0([1.1]));
assertEquals(2, push0([1.1, 2.2]));
%OptimizeFunctionOnNextCall(push0);
@@ -97,6 +106,7 @@
return a.push(1.1);
}
+ %PrepareFunctionForOptimization(push1);
assertEquals(2, push1([1.1]));
assertEquals(3, push1([1.1, 2.2]));
%OptimizeFunctionOnNextCall(push1);
@@ -106,6 +116,7 @@
return a.push(1.1, 2.2);
}
+ %PrepareFunctionForOptimization(push2);
assertEquals(3, push2([1.1]));
assertEquals(4, push2([1.1, 2.2]));
%OptimizeFunctionOnNextCall(push2);
@@ -115,6 +126,7 @@
return a.push(1.1, 2.2, 3.3);
}
+ %PrepareFunctionForOptimization(push3);
assertEquals(4, push3([1.1]));
assertEquals(5, push3([1.1, 2.2]));
%OptimizeFunctionOnNextCall(push3);
@@ -127,6 +139,7 @@
return a.push();
}
+ %PrepareFunctionForOptimization(push0);
assertEquals(2, push0([, 1.1]));
assertEquals(3, push0([, 1.1, 2.2]));
%OptimizeFunctionOnNextCall(push0);
@@ -136,6 +149,7 @@
return a.push(1.1);
}
+ %PrepareFunctionForOptimization(push1);
assertEquals(3, push1([, 1.1]));
assertEquals(4, push1([, 1.1, 2.2]));
%OptimizeFunctionOnNextCall(push1);
@@ -145,6 +159,7 @@
return a.push(1.1, 2.2);
}
+ %PrepareFunctionForOptimization(push2);
assertEquals(4, push2([, 1.1]));
assertEquals(5, push2([, 1.1, 2.2]));
%OptimizeFunctionOnNextCall(push2);
@@ -154,6 +169,7 @@
return a.push(1.1, 2.2, 3.3);
}
+ %PrepareFunctionForOptimization(push3);
assertEquals(5, push3([, 1.1]));
assertEquals(6, push3([, 1.1, 2.2]));
%OptimizeFunctionOnNextCall(push3);
@@ -166,6 +182,7 @@
return a.push();
}
+ %PrepareFunctionForOptimization(push0);
assertEquals(1, push0(['1']));
assertEquals(2, push0(['1', '2']));
%OptimizeFunctionOnNextCall(push0);
@@ -175,6 +192,7 @@
return a.push('1');
}
+ %PrepareFunctionForOptimization(push1);
assertEquals(2, push1(['1']));
assertEquals(3, push1(['1', '2']));
%OptimizeFunctionOnNextCall(push1);
@@ -184,6 +202,7 @@
return a.push('1', '2');
}
+ %PrepareFunctionForOptimization(push2);
assertEquals(3, push2(['1']));
assertEquals(4, push2(['1', '2']));
%OptimizeFunctionOnNextCall(push2);
@@ -193,6 +212,7 @@
return a.push('1', '2', '3');
}
+ %PrepareFunctionForOptimization(push3);
assertEquals(4, push3(['1']));
assertEquals(5, push3(['1', '2']));
%OptimizeFunctionOnNextCall(push3);
@@ -205,6 +225,7 @@
return a.push();
}
+ %PrepareFunctionForOptimization(push0);
assertEquals(2, push0([, '1']));
assertEquals(3, push0([, '1', '2']));
%OptimizeFunctionOnNextCall(push0);
@@ -214,6 +235,7 @@
return a.push('1');
}
+ %PrepareFunctionForOptimization(push1);
assertEquals(3, push1([, '1']));
assertEquals(4, push1([, '1', '2']));
%OptimizeFunctionOnNextCall(push1);
@@ -223,6 +245,7 @@
return a.push('1', '2');
}
+ %PrepareFunctionForOptimization(push2);
assertEquals(4, push2([, '1']));
assertEquals(5, push2([, '1', '2']));
%OptimizeFunctionOnNextCall(push2);
@@ -232,6 +255,7 @@
return a.push('1', '2', '3');
}
+ %PrepareFunctionForOptimization(push3);
assertEquals(5, push3([, '1']));
assertEquals(6, push3([, '1', '2']));
%OptimizeFunctionOnNextCall(push3);
diff --git a/deps/v8/test/mjsunit/compiler/array-push-2.js b/deps/v8/test/mjsunit/compiler/array-push-2.js
index cb18d71d63..a99e1d065e 100644
--- a/deps/v8/test/mjsunit/compiler/array-push-2.js
+++ b/deps/v8/test/mjsunit/compiler/array-push-2.js
@@ -8,6 +8,7 @@
(function() {
const a = [];
const foo = (x, y) => a.push(x, y);
+ %PrepareFunctionForOptimization(foo);
foo(1, 2);
foo(3, 4);
%OptimizeFunctionOnNextCall(foo);
@@ -17,6 +18,7 @@
(function() {
const a = [];
const foo = (x, y) => a.push(x, y);
+ %PrepareFunctionForOptimization(foo);
foo(1, 2);
foo(3, 4);
%OptimizeFunctionOnNextCall(foo);
@@ -28,6 +30,7 @@
(function() {
const a = [];
const foo = (x, y) => a.push(x, y);
+ %PrepareFunctionForOptimization(foo);
foo(1, 2);
foo(3, 4);
%OptimizeFunctionOnNextCall(foo);
@@ -37,6 +40,7 @@
(function() {
const a = [];
const foo = (x, y) => a.push(x, y);
+ %PrepareFunctionForOptimization(foo);
foo(1, 2);
foo(3, 4);
%OptimizeFunctionOnNextCall(foo);
@@ -48,6 +52,7 @@
(function() {
const a = [0.5];
const foo = (x, y) => a.push(x, y);
+ %PrepareFunctionForOptimization(foo);
foo(1, 2);
foo(3, 4);
%OptimizeFunctionOnNextCall(foo);
@@ -57,6 +62,7 @@
(function() {
const a = [0.5];
const foo = (x, y) => a.push(x, y);
+ %PrepareFunctionForOptimization(foo);
foo(1, 2);
foo(3, 4);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/array-push-3.js b/deps/v8/test/mjsunit/compiler/array-push-3.js
index f648eb9ed9..3fa59d11ff 100644
--- a/deps/v8/test/mjsunit/compiler/array-push-3.js
+++ b/deps/v8/test/mjsunit/compiler/array-push-3.js
@@ -9,6 +9,7 @@
const a = [];
const bar = x => { a.push(x); return x; };
const foo = x => a.push(bar(x), bar(x));
+ %PrepareFunctionForOptimization(foo);
foo(1);
foo(2);
%OptimizeFunctionOnNextCall(foo);
@@ -22,6 +23,7 @@
const a = [];
const bar = x => { a.push(y); return x; }
const foo = x => a.push(bar(x), bar(x));
+ %PrepareFunctionForOptimization(foo);
foo(1);
y = 2;
foo(2);
@@ -38,6 +40,7 @@
const a = [0.5];
const bar = x => { a.push(y); return x; }
const foo = x => a.push(bar(x), bar(x));
+ %PrepareFunctionForOptimization(foo);
foo(1);
y = 2;
foo(2);
diff --git a/deps/v8/test/mjsunit/compiler/array-slice-clone.js b/deps/v8/test/mjsunit/compiler/array-slice-clone.js
index 610fa17c1a..de5d29f541 100644
--- a/deps/v8/test/mjsunit/compiler/array-slice-clone.js
+++ b/deps/v8/test/mjsunit/compiler/array-slice-clone.js
@@ -20,12 +20,16 @@
return arr.slice(0);
}
+ %PrepareFunctionForOptimization(slice0);
+
assertEquals(arr, slice());
assertFalse(arr === slice());
assertEquals(slice(), slice0());
assertEquals(slice0(), slice());
%OptimizeFunctionOnNextCall(slice0);
+ assertEquals(slice(), slice0());
+ %PrepareFunctionForOptimization(slice);
%OptimizeFunctionOnNextCall(slice);
assertEquals(slice(), slice0());
@@ -41,6 +45,8 @@
return arr.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
assertEquals(arr, slice());
assertEquals(slice(), arr);
@@ -60,6 +66,8 @@
return arr.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
assertEquals(arr, slice());
assertEquals(slice(), arr);
@@ -71,6 +79,7 @@
arr.push(7.2);
slice();
+ %PrepareFunctionForOptimization(slice);
%OptimizeFunctionOnNextCall(slice);
// Trigger opt again
slice();
@@ -92,6 +101,8 @@
class MyArray extends Array {};
array.constructor = MyArray;
+ %PrepareFunctionForOptimization(slice);
+
slice(); slice();
%OptimizeFunctionOnNextCall(slice);
@@ -106,6 +117,8 @@
return array.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
slice(); slice();
%OptimizeFunctionOnNextCall(slice);
@@ -128,6 +141,8 @@
return arr.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
slice(); slice();
arr.foo = 6.2;
@@ -155,6 +170,8 @@
return arr.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
slice(iarr); slice(darr);
slice(iarr); slice(darr);
@@ -182,6 +199,8 @@
return array.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
assertEquals(slice(),array);
slice();
@@ -205,6 +224,8 @@
return x.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
slice(); slice();
%OptimizeFunctionOnNextCall(slice);
@@ -221,6 +242,8 @@
return array.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
assertEquals(slice(),array);
slice();
@@ -238,6 +261,8 @@
return array.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
assertEquals(slice(),array);
slice();
@@ -259,6 +284,8 @@
return arr.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
// make array's map is_prototype_map()
var x = {__proto__ : array};
@@ -284,6 +311,8 @@
return array.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
assertEquals(slice(),array);
slice();
@@ -305,6 +334,8 @@
return array.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
assertEquals(slice(),array);
slice();
@@ -328,6 +359,8 @@
return array.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
assertEquals(slice(),array);
slice();
@@ -348,6 +381,8 @@
return array.slice();
}
+ %PrepareFunctionForOptimization(slice);
+
assertEquals(slice(),array);
slice();
diff --git a/deps/v8/test/mjsunit/compiler/array-some.js b/deps/v8/test/mjsunit/compiler/array-some.js
index 411a5881de..c667211490 100644
--- a/deps/v8/test/mjsunit/compiler/array-some.js
+++ b/deps/v8/test/mjsunit/compiler/array-some.js
@@ -10,6 +10,7 @@
return a.some(x => x === o.x);
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo([1, 2, 3], {x:3}));
assertFalse(foo([0, 1, 2], {x:3}));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/array-species.js b/deps/v8/test/mjsunit/compiler/array-species.js
index d1e8a1d180..37c14b588a 100644
--- a/deps/v8/test/mjsunit/compiler/array-species.js
+++ b/deps/v8/test/mjsunit/compiler/array-species.js
@@ -12,6 +12,8 @@ function f() {
let y;
+%PrepareFunctionForOptimization(f);
+
y = f();
assertFalse(y instanceof Foo);
assertInstanceof(y, Array);
diff --git a/deps/v8/test/mjsunit/compiler/array-subclass.js b/deps/v8/test/mjsunit/compiler/array-subclass.js
index d20b669661..b85551c362 100644
--- a/deps/v8/test/mjsunit/compiler/array-subclass.js
+++ b/deps/v8/test/mjsunit/compiler/array-subclass.js
@@ -10,6 +10,7 @@
function foo() { return new A; }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(0, foo().length);
assertInstanceof(foo(), A);
@@ -26,6 +27,7 @@
function foo() { return new A(L); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(L, foo().length);
assertInstanceof(foo(), A);
@@ -42,6 +44,7 @@
function foo() { return new A(L); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(L, foo().length);
assertInstanceof(foo(), A);
@@ -57,6 +60,7 @@
function foo() { return new A(true); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(1, foo().length);
assertEquals(true, foo()[0]);
@@ -75,6 +79,7 @@
function foo() { return new A(""); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(1, foo().length);
assertEquals("", foo()[0]);
@@ -94,6 +99,7 @@
function foo() { return new A(O); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(1, foo().length);
assertSame(O, foo()[0]);
@@ -112,6 +118,7 @@
function foo() { return new A(1, 2, 3); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(3, foo().length);
assertEquals(1, foo()[0]);
@@ -131,6 +138,7 @@
function foo() { return new A(1.1, 2.2, 3.3); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(3, foo().length);
assertEquals(1.1, foo()[0]);
@@ -150,6 +158,7 @@
function foo() { return new A("a", "b", "c", "d"); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(4, foo().length);
assertEquals("a", foo()[0]);
@@ -176,6 +185,7 @@
function foo() { return new A; }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(0, foo().length);
assertEquals(1, foo().bar);
@@ -200,6 +210,7 @@
function foo() { return new A(L); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(L, foo().length);
assertEquals(1, foo().bar);
@@ -224,6 +235,7 @@
function foo() { return new A(L); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(L, foo().length);
assertEquals(1, foo().bar);
@@ -247,6 +259,7 @@
function foo() { return new A(true); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(1, foo().length);
assertEquals(true, foo()[0]);
@@ -273,6 +286,7 @@
function foo() { return new A(""); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(1, foo().length);
assertEquals("", foo()[0]);
@@ -300,6 +314,7 @@
function foo() { return new A(O); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(1, foo().length);
assertSame(O, foo()[0]);
@@ -326,6 +341,7 @@
function foo() { return new A(1, 2, 3); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(3, foo().length);
assertEquals(1, foo()[0]);
@@ -352,6 +368,7 @@
function foo() { return new A(1.1, 2.2, 3.3); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(3, foo().length);
assertEquals(1.1, foo()[0]);
@@ -378,6 +395,7 @@
function foo() { return new A("a", "b", "c", "d"); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertEquals(4, foo().length);
assertEquals("a", foo()[0]);
diff --git a/deps/v8/test/mjsunit/compiler/assignment-deopt.js b/deps/v8/test/mjsunit/compiler/assignment-deopt.js
index 2b00625417..175a344f99 100644
--- a/deps/v8/test/mjsunit/compiler/assignment-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/assignment-deopt.js
@@ -42,6 +42,8 @@ assertEquals(2.1, o.x);
// Test deopt with count operation on named property.
function assign2(p) { p.x += 1 }
+%PrepareFunctionForOptimization(assign2);
+
o.x = "42";
assign2(o);
assertEquals("421", o.x);
@@ -60,6 +62,8 @@ assertEquals(max_smi + 10, o.x);
// Test deopt with count operation on keyed property.
function assign3(a, b) { a[b] += 1; }
+%PrepareFunctionForOptimization(assign3);
+
o = ["42"];
assign3(o, 0);
assertEquals("421", o[0]);
@@ -83,12 +87,14 @@ o[0] = 0;
for(var i = 0; i < 5; i++) {
assign3(o, 0);
}
+%PrepareFunctionForOptimization(assign3);
%OptimizeFunctionOnNextCall(assign3);
assign3(o, 0);
assign3(o, 1);
// Test bailout with count operation in a value context.
function assign5(x,y) { return (x += 1) + y; }
+%PrepareFunctionForOptimization(assign5);
for (var i = 0; i < 5; ++i) assertEquals(4, assign5(2, 1));
%OptimizeFunctionOnNextCall(assign5);
assertEquals(4, assign5(2, 1));
@@ -97,6 +103,7 @@ assertEquals(4.1, assign5(2, 1.1));
assertEquals(4.1, assign5(2.1, 1));
function assign7(o,y) { return (o.x += 1) + y; }
+%PrepareFunctionForOptimization(assign7);
o = {x:0};
for (var i = 0; i < 5; ++i) {
o.x = 42;
@@ -112,6 +119,7 @@ o.x = 42.1;
assertEquals(44.1, assign7(o, 1));
function assign9(o,y) { return (o[0] += 1) + y; }
+%PrepareFunctionForOptimization(assign9);
q = [0];
for (var i = 0; i < 5; ++i) {
q[0] = 42;
@@ -128,6 +136,7 @@ assertEquals(44.1, assign9(q, 1));
// Test deopt because of a failed map check on the load.
function assign10(p) { return p.x += 1 }
+%PrepareFunctionForOptimization(assign10);
var g1 = {x:0};
var g2 = {y:0, x:42};
for (var i = 0; i < 5; ++i) {
@@ -148,6 +157,7 @@ assertEquals(43, g2.x);
o = {x:0};
var g3 = { valueOf: function() { o.y = "bar"; return 42; }};
function assign11(p) { return p.x += 1; }
+%PrepareFunctionForOptimization(assign11);
for (var i = 0; i < 5; i++) {
o.x = "a";
@@ -165,6 +175,7 @@ assertEquals("bar", o.y);
o = [0];
var g4 = { valueOf: function() { o.y = "bar"; return 42; }};
function assign12(p) { return p[0] += 1; }
+%PrepareFunctionForOptimization(assign12);
for (var i = 0; i < 5; i++) {
o[0] = "a";
diff --git a/deps/v8/test/mjsunit/compiler/boolean-protototype.js b/deps/v8/test/mjsunit/compiler/boolean-protototype.js
index 5e940d75ae..cc84eb89ea 100644
--- a/deps/v8/test/mjsunit/compiler/boolean-protototype.js
+++ b/deps/v8/test/mjsunit/compiler/boolean-protototype.js
@@ -7,6 +7,7 @@
function test1(s) {
return s.toString;
}
+%PrepareFunctionForOptimization(test1);
assertSame(test1(false), Boolean.prototype.toString);
assertSame(test1(true), Boolean.prototype.toString);
%OptimizeFunctionOnNextCall(test1);
@@ -16,6 +17,7 @@ assertSame(test1(true), Boolean.prototype.toString);
function test2(s) {
return s.valueOf;
}
+%PrepareFunctionForOptimization(test2);
assertSame(test2(false), Boolean.prototype.valueOf);
assertSame(test2(true), Boolean.prototype.valueOf);
%OptimizeFunctionOnNextCall(test2);
@@ -26,6 +28,7 @@ Boolean.prototype.foo = 42;
function test3(s) {
return s["foo"];
}
+%PrepareFunctionForOptimization(test3);
assertEquals(test3(false), 42);
assertEquals(test3(true), 42);
%OptimizeFunctionOnNextCall(test3);
@@ -36,6 +39,7 @@ Boolean.prototype.bar = function bar() { "use strict"; return this; }
function test4(s) {
return s.bar();
}
+%PrepareFunctionForOptimization(test4);
assertEquals(test4(false), false);
assertEquals(test4(true), true);
%OptimizeFunctionOnNextCall(test4);
diff --git a/deps/v8/test/mjsunit/compiler/capture-context.js b/deps/v8/test/mjsunit/compiler/capture-context.js
index dae6c42f32..615f12efb3 100644
--- a/deps/v8/test/mjsunit/compiler/capture-context.js
+++ b/deps/v8/test/mjsunit/compiler/capture-context.js
@@ -12,5 +12,6 @@ var foo = (function() {
var baz = (function (s) { return foo(s) });
+%PrepareFunctionForOptimization(baz);
%OptimizeFunctionOnNextCall(baz);
assertEquals(42 + 12, baz(12));
diff --git a/deps/v8/test/mjsunit/compiler/compare-map-elim.js b/deps/v8/test/mjsunit/compiler/compare-map-elim.js
index 288d4811a6..89d9cd8926 100644
--- a/deps/v8/test/mjsunit/compiler/compare-map-elim.js
+++ b/deps/v8/test/mjsunit/compiler/compare-map-elim.js
@@ -38,6 +38,8 @@ function x(z) {
return z.f();
}
+%PrepareFunctionForOptimization(x);
+
x(a);
x(b);
x(a);
diff --git a/deps/v8/test/mjsunit/compiler/compare-map-elim2.js b/deps/v8/test/mjsunit/compiler/compare-map-elim2.js
index 0c0540ccab..cbe841b987 100644
--- a/deps/v8/test/mjsunit/compiler/compare-map-elim2.js
+++ b/deps/v8/test/mjsunit/compiler/compare-map-elim2.js
@@ -33,6 +33,8 @@ function test_empty() {
return { value: o.value };
}
+ %PrepareFunctionForOptimization(foo);
+
function Base() {
this.v_ = 5;
}
@@ -63,6 +65,8 @@ function test_narrow1() {
return { value: o.value };
}
+ %PrepareFunctionForOptimization(foo);
+
function Base() {
this.v_ = 5;
}
@@ -97,6 +101,8 @@ function test_narrow2() {
return { value: o.value(flag) };
}
+ %PrepareFunctionForOptimization(foo);
+
function Base() {
this.v_ = 5;
}
diff --git a/deps/v8/test/mjsunit/compiler/compare-objeq-elim.js b/deps/v8/test/mjsunit/compiler/compare-objeq-elim.js
index 4492df45c3..faace8307a 100644
--- a/deps/v8/test/mjsunit/compiler/compare-objeq-elim.js
+++ b/deps/v8/test/mjsunit/compiler/compare-objeq-elim.js
@@ -62,6 +62,8 @@ function F4(a, b) {
%NeverOptimizeFunction(test);
function test(f, a, b) {
+ %PrepareFunctionForOptimization(f);
+
f(a, a);
f(a, b);
f(b, a);
diff --git a/deps/v8/test/mjsunit/compiler/concurrent-invalidate-transition-map.js b/deps/v8/test/mjsunit/compiler/concurrent-invalidate-transition-map.js
index 5d3c73b4e6..eca898c966 100644
--- a/deps/v8/test/mjsunit/compiler/concurrent-invalidate-transition-map.js
+++ b/deps/v8/test/mjsunit/compiler/concurrent-invalidate-transition-map.js
@@ -47,6 +47,7 @@ function add_field(obj) {
obj.c = 0;
obj.c = 3;
}
+%PrepareFunctionForOptimization(add_field);
var obj1 = new_object();
var obj2 = new_object();
add_field(obj1);
diff --git a/deps/v8/test/mjsunit/compiler/concurrent-proto-change.js b/deps/v8/test/mjsunit/compiler/concurrent-proto-change.js
index 0a016ac3ca..df8d629f32 100644
--- a/deps/v8/test/mjsunit/compiler/concurrent-proto-change.js
+++ b/deps/v8/test/mjsunit/compiler/concurrent-proto-change.js
@@ -36,6 +36,8 @@ if (!%IsConcurrentRecompilationSupported()) {
function f(foo) { return foo.bar(); }
+%PrepareFunctionForOptimization(f);
+
var o = {};
o.__proto__ = { __proto__: { bar: function() { return 1; } } };
diff --git a/deps/v8/test/mjsunit/compiler/constant-fold-cow-array.js b/deps/v8/test/mjsunit/compiler/constant-fold-cow-array.js
index 1ab022611c..9db0374c6d 100644
--- a/deps/v8/test/mjsunit/compiler/constant-fold-cow-array.js
+++ b/deps/v8/test/mjsunit/compiler/constant-fold-cow-array.js
@@ -9,6 +9,7 @@
(function() {
const a = [1, 2, 3];
const foo = () => a[0];
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -24,6 +25,7 @@
(function() {
const a = [1, 2, 3];
const foo = () => a[0];
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/constant-fold-tostring.js b/deps/v8/test/mjsunit/compiler/constant-fold-tostring.js
index e9c6d916ce..e1a66a6694 100644
--- a/deps/v8/test/mjsunit/compiler/constant-fold-tostring.js
+++ b/deps/v8/test/mjsunit/compiler/constant-fold-tostring.js
@@ -7,6 +7,7 @@
// Check that constant-folding of ToString operations works properly for NaN.
(function() {
const foo = () => `${NaN}`;
+ %PrepareFunctionForOptimization(foo);
assertEquals("NaN", foo());
assertEquals("NaN", foo());
%OptimizeFunctionOnNextCall(foo);
@@ -16,6 +17,7 @@
// Check that constant-folding of ToString operations works properly for 0/-0.
(function() {
const foo = x => `${x ? 0 : -0}`;
+ %PrepareFunctionForOptimization(foo);
assertEquals("0", foo(true));
assertEquals("0", foo(false));
assertEquals("0", foo(true));
diff --git a/deps/v8/test/mjsunit/compiler/constructor-inlining.js b/deps/v8/test/mjsunit/compiler/constructor-inlining.js
index 05b5762a53..1064997a8b 100644
--- a/deps/v8/test/mjsunit/compiler/constructor-inlining.js
+++ b/deps/v8/test/mjsunit/compiler/constructor-inlining.js
@@ -77,17 +77,22 @@ function testConstructorInlining(){
}
assertEquals(a, new Derived(true, 5, a));
+ %PrepareFunctionForOptimization(Derived);
%OptimizeFunctionOnNextCall(Derived);
assertEquals(b, new DerivedDeoptCreate(true, a, b));
+ %PrepareFunctionForOptimization(Derived);
%OptimizeFunctionOnNextCall(Derived);
assertEquals(a, new DerivedDeoptCreate(true, a, undefined));
+ %PrepareFunctionForOptimization(Derived);
%OptimizeFunctionOnNextCall(Derived);
assertEquals(5, new DerivedDeoptCreate(false, 5, 7).x);
+ %PrepareFunctionForOptimization(Derived);
%OptimizeFunctionOnNextCall(Derived);
assertEquals(7, new DerivedDeoptCreate(false, 5, 7).y);
}
testConstructorInlining();
+%PrepareFunctionForOptimization(testConstructorInlining);
%OptimizeFunctionOnNextCall(testConstructorInlining);
testConstructorInlining();
@@ -95,6 +100,7 @@ var last = undefined;
for(var i = 0; deopt_at < 0; ++i) {
deopt_at = i;
counter = 0;
+ %PrepareFunctionForOptimization(testConstructorInlining);
%OptimizeFunctionOnNextCall(testConstructorInlining);
testConstructorInlining();
if (last !== undefined) {
diff --git a/deps/v8/test/mjsunit/compiler/context-sensitivity.js b/deps/v8/test/mjsunit/compiler/context-sensitivity.js
index 1f0f1f274a..e404628482 100644
--- a/deps/v8/test/mjsunit/compiler/context-sensitivity.js
+++ b/deps/v8/test/mjsunit/compiler/context-sensitivity.js
@@ -17,6 +17,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y + x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(0));
assertEquals(2, foo(object1));
assertThrows(() => foo(thrower));
@@ -36,6 +37,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y - x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(0));
assertEquals(0, foo(object1));
assertThrows(() => foo(thrower));
@@ -55,6 +57,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y * x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(1));
assertEquals(1, foo(object1));
assertThrows(() => foo(thrower));
@@ -74,6 +77,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y / x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(1));
assertEquals(1, foo(object1));
assertThrows(() => foo(thrower));
@@ -93,6 +97,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y % x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(1));
assertEquals(0, foo(object1));
assertThrows(() => foo(thrower));
@@ -112,6 +117,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y ** x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(1));
assertEquals(1, foo(object1));
assertThrows(() => foo(thrower));
@@ -131,6 +137,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y | x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(1));
assertEquals(1, foo(object1));
assertThrows(() => foo(thrower));
@@ -150,6 +157,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y & x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(1));
assertEquals(1, foo(object1));
assertThrows(() => foo(thrower));
@@ -169,6 +177,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y ^ x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(1));
assertEquals(0, foo(object1));
assertThrows(() => foo(thrower));
@@ -188,6 +197,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y << x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(1));
assertEquals(2, foo(object1));
assertThrows(() => foo(thrower));
@@ -207,6 +217,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y >> x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(1));
assertEquals(0, foo(object1));
assertThrows(() => foo(thrower));
@@ -226,6 +237,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y >>> x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(1));
assertEquals(0, foo(object1));
assertThrows(() => foo(thrower));
@@ -245,6 +257,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y == x);
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(0));
assertTrue(foo(object1));
assertThrows(() => foo(thrower));
@@ -264,6 +277,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y < x);
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(0));
assertFalse(foo(object1));
assertThrows(() => foo(thrower));
@@ -283,6 +297,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => x > y);
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(0));
assertFalse(foo(object1));
assertThrows(() => foo(thrower));
@@ -302,6 +317,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => y <= x);
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(0));
assertTrue(foo(object1));
assertThrows(() => foo(thrower));
@@ -321,6 +337,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(y => x >= y);
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(0));
assertTrue(foo(object1));
assertThrows(() => foo(thrower));
@@ -340,6 +357,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(o => o instanceof c);
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(Object));
assertFalse(foo(Array));
assertThrows(() => foo({[Symbol.hasInstance]() { throw new Error(); }}));
@@ -359,6 +377,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(() => ~x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(-1));
assertEquals(~1, foo(object1));
assertThrows(() => foo(thrower));
@@ -378,6 +397,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(() => -x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(-1));
assertEquals(-1, foo(object1));
assertThrows(() => foo(thrower));
@@ -397,6 +417,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(() => ++x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(0));
assertEquals(2, foo(object1));
assertThrows(() => foo(thrower));
@@ -416,6 +437,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(() => --x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(2));
assertEquals(0, foo(object1));
assertThrows(() => foo(thrower));
@@ -436,6 +458,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(() => arguments)[0];
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0, 1));
assertEquals(1, foo(1, 2));
assertEquals(undefined, foo());
@@ -455,6 +478,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
return bar(() => args)[0];
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0, 1));
assertEquals(1, foo(1, 2));
assertEquals(undefined, foo());
@@ -491,6 +515,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
});
}
+ %PrepareFunctionForOptimization(foo);
assertEquals('Some value', foo('Another value'));
assertEquals('Another value', actualValue);
assertEquals('Another value', foo('Some value'));
@@ -516,6 +541,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
});
}
+ %PrepareFunctionForOptimization(foo);
assertEquals('abc', foo({a: 1, b: 2, c: 3}));
assertEquals('ab', foo(Object.create({a: 1, b: 2})));
%OptimizeFunctionOnNextCall(foo);
@@ -542,6 +568,7 @@ const thrower = {[Symbol.toPrimitive]() { throw new Error(); }};
});
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(6, foo(1, 2, 3));
assertEquals("abc", foo("a", "b", "c"));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/count-deopt.js b/deps/v8/test/mjsunit/compiler/count-deopt.js
index 415dadc0cf..c0977caefa 100644
--- a/deps/v8/test/mjsunit/compiler/count-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/count-deopt.js
@@ -42,6 +42,8 @@ assertEquals(2.1, o.x);
// Test deopt with count operation on named property.
function inc2(p) { p.x++ }
+%PrepareFunctionForOptimization(inc2);
+
o.x = "42";
inc2(o);
assertEquals(43, o.x);
@@ -60,6 +62,8 @@ assertEquals(max_smi + 10, o.x);
// Test deopt with count operation on keyed property.
function inc3(a, b) { a[b]++; }
+%PrepareFunctionForOptimization(inc3);
+
o = ["42"];
inc3(o, 0);
assertEquals(43, o[0]);
@@ -83,18 +87,21 @@ o[0] = 0;
for(var i = 0; i < 5; i++) {
inc3(o, 0);
}
+%PrepareFunctionForOptimization(inc3);
%OptimizeFunctionOnNextCall(inc3);
inc3(o, 0);
inc3(o, 1);
// Test bailout with count operation in a value context.
function inc4(x,y) { return (x++) + y; }
+%PrepareFunctionForOptimization(inc4);
for (var i = 0; i < 5; ++i) assertEquals(3, inc4(2, 1));
%OptimizeFunctionOnNextCall(inc4);
inc4(2, 1);
assertEquals(3.1, inc4(2, 1.1));
function inc5(x,y) { return (++x) + y; }
+%PrepareFunctionForOptimization(inc5);
for (var i = 0; i < 5; ++i) assertEquals(4, inc5(2, 1));
%OptimizeFunctionOnNextCall(inc5);
assertEquals(4, inc5(2, 1));
@@ -102,6 +109,7 @@ assertEquals(4.1, inc5(2, 1.1));
assertEquals(4.1, inc5(2.1, 1));
function inc6(o,y) { return (o.x++) + y; }
+%PrepareFunctionForOptimization(inc6);
o = {x:0};
for (var i = 0; i < 5; ++i) {
o.x = 42;
@@ -116,6 +124,7 @@ o.x = 42.1;
assertEquals(43.1, inc6(o, 1));
function inc7(o,y) { return (++o.x) + y; }
+%PrepareFunctionForOptimization(inc7);
o = {x:0};
for (var i = 0; i < 5; ++i) {
o.x = 42;
@@ -130,6 +139,7 @@ o.x = 42.1;
assertEquals(44.1, inc7(o, 1));
function inc8(o,y) { return (o[0]++) + y; }
+%PrepareFunctionForOptimization(inc8);
var q = [0];
for (var i = 0; i < 5; ++i) {
q[0] = 42;
@@ -144,6 +154,7 @@ q[0] = 42.1;
assertEquals(43.1, inc8(q, 1));
function inc9(o,y) { return (++o[0]) + y; }
+%PrepareFunctionForOptimization(inc9);
q = [0];
for (var i = 0; i < 5; ++i) {
q[0] = 42;
@@ -159,6 +170,7 @@ assertEquals(44.1, inc9(q, 1));
// Test deopt because of a failed map check.
function inc10(p) { return p.x++ }
+%PrepareFunctionForOptimization(inc10);
var g1 = {x:0};
var g2 = {y:0, x:42}
for (var i = 0; i < 5; ++i) {
diff --git a/deps/v8/test/mjsunit/compiler/dataview-constant.js b/deps/v8/test/mjsunit/compiler/dataview-constant.js
index f5f0b5e955..5a93ca8560 100644
--- a/deps/v8/test/mjsunit/compiler/dataview-constant.js
+++ b/deps/v8/test/mjsunit/compiler/dataview-constant.js
@@ -16,6 +16,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(0));
assertEquals(24, foo(1));
assertEquals(43, foo(0));
@@ -37,6 +38,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(0));
assertEquals(24, foo(1));
assertEquals(43, foo(0));
@@ -58,6 +60,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(0));
assertEquals(24, foo(2));
assertEquals(43, foo(0));
@@ -79,6 +82,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(0));
assertEquals(24, foo(2));
assertEquals(43, foo(0));
@@ -100,6 +104,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(0));
assertEquals(24, foo(4));
assertEquals(43, foo(0));
@@ -121,6 +126,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(0));
assertEquals(24, foo(4));
assertEquals(43, foo(0));
@@ -142,6 +148,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(0));
assertEquals(24, foo(4));
assertEquals(43, foo(0));
@@ -163,6 +170,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(0));
assertEquals(24, foo(8));
assertEquals(43, foo(0));
diff --git a/deps/v8/test/mjsunit/compiler/dataview-deopt.js b/deps/v8/test/mjsunit/compiler/dataview-deopt.js
index b19de30e5d..cf8132d3ee 100644
--- a/deps/v8/test/mjsunit/compiler/dataview-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/dataview-deopt.js
@@ -16,6 +16,7 @@ function readUint8(offset) {
}
function warmupRead(f) {
+ %PrepareFunctionForOptimization(f);
f(0);
f(1);
%OptimizeFunctionOnNextCall(f);
@@ -40,6 +41,7 @@ function writeUint8(offset, value) {
}
function warmupWrite(f) {
+ %PrepareFunctionForOptimization(f);
f(0, 0);
f(0, 1);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/dataview-get.js b/deps/v8/test/mjsunit/compiler/dataview-get.js
index 09094399df..6bfad2d832 100644
--- a/deps/v8/test/mjsunit/compiler/dataview-get.js
+++ b/deps/v8/test/mjsunit/compiler/dataview-get.js
@@ -54,6 +54,7 @@ function readFloat64(offset, little_endian) {
}
function warmup(f) {
+ %PrepareFunctionForOptimization(f);
f(0);
f(1);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/dataview-neutered.js b/deps/v8/test/mjsunit/compiler/dataview-neutered.js
index ef485c69db..b5fe3102c2 100644
--- a/deps/v8/test/mjsunit/compiler/dataview-neutered.js
+++ b/deps/v8/test/mjsunit/compiler/dataview-neutered.js
@@ -16,6 +16,7 @@
return dv.getInt8(0);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(dv));
assertEquals(0, foo(dv));
%OptimizeFunctionOnNextCall(foo);
@@ -24,6 +25,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv), TypeError);
assertOptimized(foo);
@@ -38,6 +40,7 @@
return dv.getUint8(0);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(dv));
assertEquals(0, foo(dv));
%OptimizeFunctionOnNextCall(foo);
@@ -46,6 +49,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv), TypeError);
assertOptimized(foo);
@@ -60,6 +64,7 @@
return dv.getInt16(0, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(dv));
assertEquals(0, foo(dv));
%OptimizeFunctionOnNextCall(foo);
@@ -68,6 +73,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv), TypeError);
assertOptimized(foo);
@@ -82,6 +88,7 @@
return dv.getUint16(0, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(dv));
assertEquals(0, foo(dv));
%OptimizeFunctionOnNextCall(foo);
@@ -90,6 +97,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv), TypeError);
assertOptimized(foo);
@@ -104,6 +112,7 @@
return dv.getInt32(0, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(dv));
assertEquals(0, foo(dv));
%OptimizeFunctionOnNextCall(foo);
@@ -112,6 +121,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv), TypeError);
assertOptimized(foo);
@@ -126,6 +136,7 @@
return dv.getUint32(0, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(dv));
assertEquals(0, foo(dv));
%OptimizeFunctionOnNextCall(foo);
@@ -134,6 +145,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv), TypeError);
assertOptimized(foo);
@@ -148,6 +160,7 @@
return dv.getFloat32(0, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(dv));
assertEquals(0, foo(dv));
%OptimizeFunctionOnNextCall(foo);
@@ -156,6 +169,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv), TypeError);
assertOptimized(foo);
@@ -170,6 +184,7 @@
return dv.getFloat64(0, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(dv));
assertEquals(0, foo(dv));
%OptimizeFunctionOnNextCall(foo);
@@ -178,6 +193,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv), TypeError);
assertOptimized(foo);
@@ -192,6 +208,7 @@
return dv.setInt8(0, x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(dv, 1));
assertEquals(1, dv.getInt8(0));
assertEquals(undefined, foo(dv, 2));
@@ -202,6 +219,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv, 4), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv, 5), TypeError);
assertOptimized(foo);
@@ -216,6 +234,7 @@
return dv.setUint8(0, x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(dv, 1));
assertEquals(1, dv.getUint8(0));
assertEquals(undefined, foo(dv, 2));
@@ -226,6 +245,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv, 4), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv, 5), TypeError);
assertOptimized(foo);
@@ -240,6 +260,7 @@
return dv.setInt16(0, x, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(dv, 1));
assertEquals(1, dv.getInt16(0, true));
assertEquals(undefined, foo(dv, 2));
@@ -250,6 +271,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv, 4), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv, 5), TypeError);
assertOptimized(foo);
@@ -264,6 +286,7 @@
return dv.setUint16(0, x, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(dv, 1));
assertEquals(1, dv.getUint16(0, true));
assertEquals(undefined, foo(dv, 2));
@@ -274,6 +297,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv, 4), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv, 5), TypeError);
assertOptimized(foo);
@@ -288,6 +312,7 @@
return dv.setInt32(0, x, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(dv, 1));
assertEquals(1, dv.getInt32(0, true));
assertEquals(undefined, foo(dv, 2));
@@ -298,6 +323,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv, 4), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv, 5), TypeError);
assertOptimized(foo);
@@ -312,6 +338,7 @@
return dv.setUint32(0, x, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(dv, 1));
assertEquals(1, dv.getUint32(0, true));
assertEquals(undefined, foo(dv, 2));
@@ -322,6 +349,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv, 4), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv, 5), TypeError);
assertOptimized(foo);
@@ -336,6 +364,7 @@
return dv.setFloat32(0, x, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(dv, 1));
assertEquals(1, dv.getFloat32(0, true));
assertEquals(undefined, foo(dv, 2));
@@ -346,6 +375,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv, 4), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv, 5), TypeError);
assertOptimized(foo);
@@ -360,6 +390,7 @@
return dv.setFloat64(0, x, true);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(dv, 1));
assertEquals(1, dv.getFloat64(0, true));
assertEquals(undefined, foo(dv, 2));
@@ -370,6 +401,7 @@
%ArrayBufferDetach(ab);
assertThrows(() => foo(dv, 4), TypeError);
assertUnoptimized(foo);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(() => foo(dv, 5), TypeError);
assertOptimized(foo);
diff --git a/deps/v8/test/mjsunit/compiler/dataview-nonconstant.js b/deps/v8/test/mjsunit/compiler/dataview-nonconstant.js
index 0420660c83..7d05ea4ed8 100644
--- a/deps/v8/test/mjsunit/compiler/dataview-nonconstant.js
+++ b/deps/v8/test/mjsunit/compiler/dataview-nonconstant.js
@@ -16,6 +16,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(dv, 0));
assertEquals(24, foo(dv, 1));
assertEquals(43, foo(dv, 0));
@@ -37,6 +38,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(dv, 0));
assertEquals(24, foo(dv, 1));
assertEquals(43, foo(dv, 0));
@@ -58,6 +60,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(dv, 0));
assertEquals(24, foo(dv, 2));
assertEquals(43, foo(dv, 0));
@@ -79,6 +82,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(dv, 0));
assertEquals(24, foo(dv, 2));
assertEquals(43, foo(dv, 0));
@@ -100,6 +104,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(dv, 0));
assertEquals(24, foo(dv, 4));
assertEquals(43, foo(dv, 0));
@@ -121,6 +126,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(dv, 0));
assertEquals(24, foo(dv, 4));
assertEquals(43, foo(dv, 0));
@@ -142,6 +148,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(dv, 0));
assertEquals(24, foo(dv, 4));
assertEquals(43, foo(dv, 0));
@@ -163,6 +170,7 @@
return x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo(dv, 0));
assertEquals(24, foo(dv, 8));
assertEquals(43, foo(dv, 0));
diff --git a/deps/v8/test/mjsunit/compiler/dataview-set.js b/deps/v8/test/mjsunit/compiler/dataview-set.js
index 4759597881..8cd3bf12eb 100644
--- a/deps/v8/test/mjsunit/compiler/dataview-set.js
+++ b/deps/v8/test/mjsunit/compiler/dataview-set.js
@@ -44,6 +44,7 @@ function writeFloat64(offset, value, little_endian) {
}
function warmup(f) {
+ %PrepareFunctionForOptimization(f);
f(0, 0);
f(0, 1);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/dead-code6.js b/deps/v8/test/mjsunit/compiler/dead-code6.js
index ec9b8433dd..d36818fac0 100644
--- a/deps/v8/test/mjsunit/compiler/dead-code6.js
+++ b/deps/v8/test/mjsunit/compiler/dead-code6.js
@@ -57,16 +57,19 @@ function dead3(a, b) {
return a;
}
+%PrepareFunctionForOptimization(dead1);
assertTrue(dead1(33, 32) == 33);
assertTrue(dead1(33, 32) == 33);
%OptimizeFunctionOnNextCall(dead1);
assertTrue(dead1(33, 32) == 33);
+%PrepareFunctionForOptimization(dead2);
assertTrue(dead2(34, 11) == 34);
assertTrue(dead2(34, 11) == 34);
%OptimizeFunctionOnNextCall(dead2);
assertTrue(dead2(34, 11) == 34);
+%PrepareFunctionForOptimization(dead3);
assertTrue(dead3(35, 12) == 35);
assertTrue(dead3(35, 12) == 35);
%OptimizeFunctionOnNextCall(dead3);
diff --git a/deps/v8/test/mjsunit/compiler/dead-loops-neg.js b/deps/v8/test/mjsunit/compiler/dead-loops-neg.js
index dbf500b48e..67acd90fa8 100644
--- a/deps/v8/test/mjsunit/compiler/dead-loops-neg.js
+++ b/deps/v8/test/mjsunit/compiler/dead-loops-neg.js
@@ -83,6 +83,7 @@ var params_loops = [loop6, loop7, loop8];
for (var i = 0; i < no_params_loops.length; i++) {
var f = no_params_loops[i];
+ %PrepareFunctionForOptimization(f);
f();
f();
f();
@@ -92,6 +93,7 @@ for (var i = 0; i < no_params_loops.length; i++) {
for (var i = 0; i < params_loops.length; i++) {
var f = params_loops[i];
+ %PrepareFunctionForOptimization(f);
f(3);
f(7);
f(11);
diff --git a/deps/v8/test/mjsunit/compiler/dead-loops.js b/deps/v8/test/mjsunit/compiler/dead-loops.js
index 2301b129dd..878f90841a 100644
--- a/deps/v8/test/mjsunit/compiler/dead-loops.js
+++ b/deps/v8/test/mjsunit/compiler/dead-loops.js
@@ -80,6 +80,7 @@ var loops = [loop1, loop2, loop3, loop4, loop5, loop6, loop7, loop8];
for (var i = 0; i < loops.length; i++) {
var f = loops[i];
+ %PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/dead-string-add-warm.js b/deps/v8/test/mjsunit/compiler/dead-string-add-warm.js
index c211ebddc5..4abe641b90 100644
--- a/deps/v8/test/mjsunit/compiler/dead-string-add-warm.js
+++ b/deps/v8/test/mjsunit/compiler/dead-string-add-warm.js
@@ -68,9 +68,14 @@ function run() {
assertEquals("1", dead3("true", 0));
}
+%PrepareFunctionForOptimization(dead1);
run();
run();
%OptimizeFunctionOnNextCall(dead1);
+run();
+%PrepareFunctionForOptimization(dead2);
%OptimizeFunctionOnNextCall(dead2);
+run();
+%PrepareFunctionForOptimization(dead3);
%OptimizeFunctionOnNextCall(dead3);
run();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-accessors1.js b/deps/v8/test/mjsunit/compiler/deopt-accessors1.js
index 3589258656..a1cbb88210 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-accessors1.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-accessors1.js
@@ -21,6 +21,7 @@ function foo(o) {
return o.x++;
}
+%PrepareFunctionForOptimization(foo);
assertEquals(1, foo(o));
assertEquals(2, foo(o));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-accessors2.js b/deps/v8/test/mjsunit/compiler/deopt-accessors2.js
index 74d41397bf..580d2872bb 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-accessors2.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-accessors2.js
@@ -21,6 +21,7 @@ function foo(o) {
return ++o.x;
}
+%PrepareFunctionForOptimization(foo);
assertEquals(2, foo(o));
assertEquals(3, foo(o));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-accessors3.js b/deps/v8/test/mjsunit/compiler/deopt-accessors3.js
index 035cf2b359..33f7607400 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-accessors3.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-accessors3.js
@@ -22,6 +22,7 @@ function foo(o) {
return o[x]++;
}
+%PrepareFunctionForOptimization(foo);
assertEquals(1, foo(o));
assertEquals(2, foo(o));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-accessors4.js b/deps/v8/test/mjsunit/compiler/deopt-accessors4.js
index 5a8453f237..2c2b98af4b 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-accessors4.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-accessors4.js
@@ -22,6 +22,7 @@ function foo(o) {
return ++o[x];
}
+%PrepareFunctionForOptimization(foo);
assertEquals(2, foo(o));
assertEquals(3, foo(o));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-accessors5.js b/deps/v8/test/mjsunit/compiler/deopt-accessors5.js
index bf71585e25..2334c9bdc0 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-accessors5.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-accessors5.js
@@ -17,6 +17,7 @@ function test() {
assertEquals(1, o.q = 1);
}
+%PrepareFunctionForOptimization(test);
test();
test();
%OptimizeFunctionOnNextCall(test);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-accessors6.js b/deps/v8/test/mjsunit/compiler/deopt-accessors6.js
index 784123ae6c..059402e8ed 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-accessors6.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-accessors6.js
@@ -18,6 +18,7 @@ function test() {
assertEquals(1, o[q] = 1);
}
+%PrepareFunctionForOptimization(test);
test();
test();
%OptimizeFunctionOnNextCall(test);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-accessors7.js b/deps/v8/test/mjsunit/compiler/deopt-accessors7.js
index 8c7d7a1e3c..a40c9a5156 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-accessors7.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-accessors7.js
@@ -21,6 +21,7 @@ function foo(o, x) {
return bar(1, (o[x], 2), 3);
}
+%PrepareFunctionForOptimization(foo);
assertEquals(4, foo(o, "v"));
assertEquals(4, foo(o, "v"));
assertEquals(4, foo(o, "x"));
diff --git a/deps/v8/test/mjsunit/compiler/deopt-args.js b/deps/v8/test/mjsunit/compiler/deopt-args.js
index 17c397c152..867346515e 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-args.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-args.js
@@ -35,6 +35,7 @@ function f(a,b,c) {
return 42;
}
+%PrepareFunctionForOptimization(g);
var object = { };
object.f = f;
for (var i = 0; i < 5; i++) {
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-builtins.js b/deps/v8/test/mjsunit/compiler/deopt-array-builtins.js
index b737b17ed0..68158e05e3 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-builtins.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-builtins.js
@@ -13,10 +13,12 @@
function g() {
[1,2,3].forEach(f);
}
+ %PrepareFunctionForOptimization(g);
g();
g();
%OptimizeFunctionOnNextCall(g);
g();
+ %PrepareFunctionForOptimization(g);
%OptimizeFunctionOnNextCall(g);
g();
assertOptimized(g);
@@ -31,10 +33,12 @@
function g() {
[1,2,3].find(f);
}
+ %PrepareFunctionForOptimization(g);
g();
g();
%OptimizeFunctionOnNextCall(g);
g();
+ %PrepareFunctionForOptimization(g);
%OptimizeFunctionOnNextCall(g);
g();
assertOptimized(g);
@@ -48,10 +52,12 @@
function g() {
[1,2,3].map(f);
}
+ %PrepareFunctionForOptimization(g);
g();
g();
%OptimizeFunctionOnNextCall(g);
g();
+ %PrepareFunctionForOptimization(g);
%OptimizeFunctionOnNextCall(g);
g();
assertOptimized(g);
@@ -65,10 +71,12 @@
function g() {
[1,2,3].filter(f);
}
+ %PrepareFunctionForOptimization(g);
g();
g();
%OptimizeFunctionOnNextCall(g);
g();
+ %PrepareFunctionForOptimization(g);
%OptimizeFunctionOnNextCall(g);
g();
assertOptimized(g);
@@ -84,10 +92,12 @@
function g() {
[1,2,3].forEach(f);
}
+ %PrepareFunctionForOptimization(g);
g();
g();
%OptimizeFunctionOnNextCall(g);
g();
+ %PrepareFunctionForOptimization(g);
%OptimizeFunctionOnNextCall(g);
g();
assertOptimized(g);
@@ -102,10 +112,12 @@
function g() {
[1,2,3].find(f);
}
+ %PrepareFunctionForOptimization(g);
g();
g();
%OptimizeFunctionOnNextCall(g);
g();
+ %PrepareFunctionForOptimization(g);
%OptimizeFunctionOnNextCall(g);
g();
assertOptimized(g);
@@ -119,10 +131,12 @@
function g() {
[1,2,3].map(f);
}
+ %PrepareFunctionForOptimization(g);
g();
g();
%OptimizeFunctionOnNextCall(g);
g();
+ %PrepareFunctionForOptimization(g);
%OptimizeFunctionOnNextCall(g);
g();
assertOptimized(g);
@@ -136,11 +150,13 @@
function g() {
[1,2,3].filter(f);
}
+ %PrepareFunctionForOptimization(g);
g();
g();
%OptimizeFunctionOnNextCall(g);
g();
g();
+ %PrepareFunctionForOptimization(g);
%OptimizeFunctionOnNextCall(g);
g();
g();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-iterator-prototype-next.js b/deps/v8/test/mjsunit/compiler/deopt-array-iterator-prototype-next.js
index b75f3185ac..430bb80dba 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-iterator-prototype-next.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-iterator-prototype-next.js
@@ -13,6 +13,7 @@
return array[Symbol.iterator]().next();
}
+ %PrepareFunctionForOptimization(next);
assertEquals(next().value, undefined);
assertEquals(next().value, undefined);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-every.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-every.js
index 0ebf126fa6..693d75d220 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-every.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-every.js
@@ -15,6 +15,7 @@
return array.every(v => v > 0);
}
+ %PrepareFunctionForOptimization(every);
every(); every();
%OptimizeFunctionOnNextCall(every);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-filter.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-filter.js
index fcae939eb8..232a3c2bf2 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-filter.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-filter.js
@@ -15,6 +15,7 @@
return array.filter(v => v > 0);
}
+ %PrepareFunctionForOptimization(filter);
filter(); filter();
%OptimizeFunctionOnNextCall(filter);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-find.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-find.js
index e8b5b9bd1b..c12b977027 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-find.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-find.js
@@ -15,6 +15,7 @@
return array.find(v => v > 0);
}
+ %PrepareFunctionForOptimization(find);
find(); find();
%OptimizeFunctionOnNextCall(find);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-findindex.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-findindex.js
index 37866a4506..893774f1ee 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-findindex.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-findindex.js
@@ -15,6 +15,7 @@
return array.findIndex(v => v > 0);
}
+ %PrepareFunctionForOptimization(findIndex);
findIndex(); findIndex();
%OptimizeFunctionOnNextCall(findIndex);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-foreach.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-foreach.js
index 6db9078e1b..1d0a808243 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-foreach.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-foreach.js
@@ -15,6 +15,7 @@
function forEach() {
array.forEach(increment);
}
+ %PrepareFunctionForOptimization(forEach);
forEach(); forEach();
%OptimizeFunctionOnNextCall(forEach);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-includes.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-includes.js
index 77aedfe1e6..5931840a82 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-includes.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-includes.js
@@ -16,6 +16,7 @@
return arr.includes(val);
}
+ %PrepareFunctionForOptimization(includes);
assertTrue(includes(iarr, 0)); assertTrue(includes(darr, 0));
assertTrue(includes(iarr, 2)); assertTrue(includes(darr, 2));
@@ -33,6 +34,7 @@
return arr.includes(val);
}
+ %PrepareFunctionForOptimization(includes);
assertTrue(includes(iarr, 0));
assertTrue(includes(iarr, 2));
@@ -55,6 +57,7 @@
iarr.__proto__ = [2];
// get feedback
+ %PrepareFunctionForOptimization(includes);
assertFalse(includes(iarr, 0));
assertTrue(includes(iarr, 2));
@@ -72,6 +75,7 @@
return arr.includes(val);
}
+ %PrepareFunctionForOptimization(includes);
assertFalse(includes(iarr, 2));
assertTrue(includes(iarr, 3));
@@ -92,6 +96,7 @@
return array.includes(val);
}
+ %PrepareFunctionForOptimization(includes);
includes(6); includes(6);
%OptimizeFunctionOnNextCall(includes);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-indexof.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-indexof.js
index 78cf60507c..e5e2752048 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-indexof.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-indexof.js
@@ -16,6 +16,7 @@
return arr.indexOf(val);
}
+ %PrepareFunctionForOptimization(indexOf);
assertEquals(0, indexOf(iarr, 0));
assertEquals(0, indexOf(darr, 0));
assertEquals(2, indexOf(iarr, 2));
@@ -36,6 +37,7 @@
return arr.indexOf(val);
}
+ %PrepareFunctionForOptimization(indexOf);
assertEquals(0, indexOf(iarr, 0));
assertEquals(2, indexOf(iarr, 2));
@@ -55,6 +57,7 @@
return arr.indexOf(val);
}
+ %PrepareFunctionForOptimization(indexOf);
iarr.__proto__ = [2];
assertEquals(-1, indexOf(iarr, 0));
assertEquals(0, indexOf(iarr, 2));
@@ -73,6 +76,7 @@
return arr.indexOf(val);
}
+ %PrepareFunctionForOptimization(indexOf);
assertEquals(-1, indexOf(iarr, 2));
assertEquals(1, indexOf(iarr, 3));
@@ -93,6 +97,7 @@
return array.indexOf(val);
}
+ %PrepareFunctionForOptimization(indexOf);
indexOf(6); indexOf(6);
%OptimizeFunctionOnNextCall(indexOf);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-lastindexof.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-lastindexof.js
index d47926cd3d..0def5efb1e 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-lastindexof.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-lastindexof.js
@@ -15,6 +15,7 @@
return array.lastIndexOf(val);
}
+ %PrepareFunctionForOptimization(lastIndexOf);
lastIndexOf(6); lastIndexOf(6);
%OptimizeFunctionOnNextCall(lastIndexOf);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-map.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-map.js
index 29c7d32174..836df344f4 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-map.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-map.js
@@ -15,6 +15,7 @@
return array.map(x => x + 1);
}
+ %PrepareFunctionForOptimization(map);
map(); map();
%OptimizeFunctionOnNextCall(map);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-pop.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-pop.js
index 6d0fe068e4..aa578a09c8 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-pop.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-pop.js
@@ -15,6 +15,8 @@
return array.pop();
}
+ %PrepareFunctionForOptimization(pop);
+
assertEquals(pop(), undefined);
assertEquals(pop(), undefined);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-reduce.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-reduce.js
index d2ba0db0f8..44a83ec728 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-reduce.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-reduce.js
@@ -16,6 +16,7 @@
array.reduce(accumulate);
}
+ %PrepareFunctionForOptimization(reduce);
reduce(); reduce();
%OptimizeFunctionOnNextCall(reduce);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-slice.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-slice.js
index 6b2d5fa22d..0e75f74f08 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-slice.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-slice.js
@@ -15,6 +15,7 @@
return array.slice();
}
+ %PrepareFunctionForOptimization(slice);
slice(); slice();
%OptimizeFunctionOnNextCall(slice);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-some.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-some.js
index d9604d0c76..9636e94edd 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-some.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-some.js
@@ -15,6 +15,7 @@
return array.some(v => v > 0);
}
+ %PrepareFunctionForOptimization(some);
some(); some();
%OptimizeFunctionOnNextCall(some);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-push.js b/deps/v8/test/mjsunit/compiler/deopt-array-push.js
index e34d99a325..d13538c532 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-array-push.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-push.js
@@ -7,10 +7,12 @@
(function test() {
function foo(a) { a.push(a.length = 2); }
+ %PrepareFunctionForOptimization(foo);
foo([1]);
foo([1]);
%OptimizeFunctionOnNextCall(foo);
foo([1]);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo([1]);
assertOptimized(foo);
@@ -19,10 +21,12 @@
(function testElementTypeCheckSmi() {
function foo(a) { a.push('a'); }
+ %PrepareFunctionForOptimization(foo);
foo([1]);
foo([1]);
%OptimizeFunctionOnNextCall(foo);
foo([1]);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo([1]);
assertOptimized(foo);
@@ -31,10 +35,12 @@
(function testElementTypeCheckDouble() {
function foo(a) { a.push('a'); }
+ %PrepareFunctionForOptimization(foo);
foo([0.3413312]);
foo([0.3413312]);
%OptimizeFunctionOnNextCall(foo);
foo([0.3413312]);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo([0.3413312]);
assertOptimized(foo);
@@ -44,10 +50,12 @@
%NeverOptimizeFunction(bar);
function foo(a) { a.push(bar(a)); }
+ %PrepareFunctionForOptimization(foo);
foo(["1"]);
foo(["1"]);
%OptimizeFunctionOnNextCall(foo);
foo(["1"]);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo(["1"]);
assertOptimized(foo);
@@ -56,10 +64,12 @@
(function test() {
function foo(a) { a.push(a.length = 2); }
+ %PrepareFunctionForOptimization(foo);
foo([0.34234]);
foo([0.34234]);
%OptimizeFunctionOnNextCall(foo);
foo([0.34234]);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo([0.34234]);
assertOptimized(foo);
@@ -70,28 +80,47 @@
function foo(a) { a.push(1); }
+ %PrepareFunctionForOptimization(foo);
foo(new Array(N));
foo(new Array(N));
%OptimizeFunctionOnNextCall(foo);
foo(new Array(N));
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo(new Array(N));
assertOptimized(foo);
})();
(function test() {
- function mkArray() {
- const N = 128 * 1024;
+ // Conservative arrays lengths in slow and fast mode.
+ const kFastModeLength = 1024;
+ const kSlowModeLength = 512 * 1024;
+ function mkArray(length) {
let a = [0.1];
- a.length = N;
+ a.length = length;
return a;
}
function foo(a) { a.push(0.23441233123); }
- foo(mkArray());
- foo(mkArray());
+
+
+ // 1. Optimize foo to handle fast mode arrays.
+ %PrepareFunctionForOptimization(foo);
+ foo(mkArray(kFastModeLength));
+ foo(mkArray(kFastModeLength));
%OptimizeFunctionOnNextCall(foo);
- foo(mkArray());
+ foo(mkArray(kFastModeLength));
+ assertOptimized(foo);
+
+ // Prepare foo to be re-optimized, ensuring it's bytecode / feedback vector
+ // doesn't get flushed after deoptimization.
+ %PrepareFunctionForOptimization(foo);
+
+ // 2. Given a slow mode array, foo will deopt.
+ foo(mkArray(kSlowModeLength));
+
+ // 3. Optimize foo again.
%OptimizeFunctionOnNextCall(foo);
- foo(mkArray());
+ foo(mkArray(kSlowModeLength));
+ // 4. It should stay optimized.
assertOptimized(foo);
})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-bool.js b/deps/v8/test/mjsunit/compiler/deopt-bool.js
index 13a4a97034..2bd4d3e39c 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-bool.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-bool.js
@@ -15,6 +15,8 @@ function foo(a, b) {
return passed;
}
+%PrepareFunctionForOptimization(foo);
+
assertTrue(foo(3, 4));
assertTrue(foo(3, 4));
assertFalse(foo(3.1, 4));
diff --git a/deps/v8/test/mjsunit/compiler/deopt-bool2.js b/deps/v8/test/mjsunit/compiler/deopt-bool2.js
index 4d1c41e323..0967112360 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-bool2.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-bool2.js
@@ -20,6 +20,8 @@ function foo(expected, x) {
return passed;
}
+%PrepareFunctionForOptimization(foo);
+
assertTrue(foo([0,1], [0,1]));
assertTrue(foo([0,2], [0,2]));
assertFalse(foo([0,2.25], [0,2.75]));
diff --git a/deps/v8/test/mjsunit/compiler/deopt-closure.js b/deps/v8/test/mjsunit/compiler/deopt-closure.js
index 2ce531faf0..ef2b500a66 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-closure.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-closure.js
@@ -12,6 +12,7 @@
}
return g();
}
+ %PrepareFunctionForOptimization(f);
assertEquals(24, f(23));
assertEquals(43, f(42));
%OptimizeFunctionOnNextCall(f);
@@ -26,6 +27,7 @@
}
return g();
}
+ %PrepareFunctionForOptimization(f);
assertEquals(24, f(23));
assertEquals(43, f(42));
%OptimizeFunctionOnNextCall(f);
@@ -40,6 +42,7 @@
}
return new g();
}
+ %PrepareFunctionForOptimization(f);
assertEquals({ val: 24 }, f(23));
assertEquals({ val: 43 }, f(42));
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-during-eval-lookup.js b/deps/v8/test/mjsunit/compiler/deopt-during-eval-lookup.js
index 1df04bbad8..786a460fe4 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-during-eval-lookup.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-during-eval-lookup.js
@@ -43,5 +43,6 @@ function f() {
return eval("200");
}
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
assertEquals(100, f());
diff --git a/deps/v8/test/mjsunit/compiler/deopt-eager-and-lazy.js b/deps/v8/test/mjsunit/compiler/deopt-eager-and-lazy.js
index daea40a950..cab060d31d 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-eager-and-lazy.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-eager-and-lazy.js
@@ -19,9 +19,12 @@ function h(o) {
return o.x;
}
+%PrepareFunctionForOptimization(g);
g({x : 1});
g({x : 2});
%OptimizeFunctionOnNextCall(g);
-%OptimizeFunctionOnNextCall(h);
g({x : 3});
+%PrepareFunctionForOptimization(h);
+%OptimizeFunctionOnNextCall(h);
+g({x : 4});
g({y : 1, x : 3});
diff --git a/deps/v8/test/mjsunit/compiler/deopt-eager-var-mutation-ite.js b/deps/v8/test/mjsunit/compiler/deopt-eager-var-mutation-ite.js
index 17ce86ff4a..3b1698eb5e 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-eager-var-mutation-ite.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-eager-var-mutation-ite.js
@@ -22,6 +22,7 @@ function g(b) {
} // It should trigger an eager deoptimization when b=true.
}
+%PrepareFunctionForOptimization(f);
f(false); f(false);
%OptimizeFunctionOnNextCall(f);
f(false);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-eager-with-freeze.js b/deps/v8/test/mjsunit/compiler/deopt-eager-with-freeze.js
index 538176d2e8..6596c85185 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-eager-with-freeze.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-eager-with-freeze.js
@@ -12,6 +12,7 @@ function useObject(obj) {
return obj.f;
}
+%PrepareFunctionForOptimization(useObject);
var o = {f: 1, g: 2}
assertEquals(useObject(o), 2);
assertEquals(useObject(o), 4);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-followed-by-gc.js b/deps/v8/test/mjsunit/compiler/deopt-followed-by-gc.js
index a5ea622dfc..fb4922191b 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-followed-by-gc.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-followed-by-gc.js
@@ -17,6 +17,7 @@ function deopt() {
}
%NeverOptimizeFunction(deopt);
+%PrepareFunctionForOptimization(opt_me);
opt_me();
opt_me();
%OptimizeFunctionOnNextCall(opt_me);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-inlined-from-call.js b/deps/v8/test/mjsunit/compiler/deopt-inlined-from-call.js
index 8fa8af5a9b..deff3e71a7 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-inlined-from-call.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-inlined-from-call.js
@@ -44,6 +44,7 @@ Array.prototype.f = function() {
return g([].f.call({}), deopt + 1, called);
}
+ %PrepareFunctionForOptimization(f);
called = f(0, called);
called = f(0, called);
%OptimizeFunctionOnNextCall(f);
@@ -65,6 +66,7 @@ Array.prototype.f = function() {
return [].pop.call(a1) + b.value;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(7, f(obj));
assertEquals(6, f(obj));
%OptimizeFunctionOnNextCall(f);
@@ -84,6 +86,7 @@ Array.prototype.f = function() {
return [].shift.call(a2) + b.value;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(4, f(obj));
assertEquals(5, f(obj));
%OptimizeFunctionOnNextCall(f);
@@ -102,6 +105,7 @@ Array.prototype.f = function() {
return [].push.call(a3, b.value);
}
+ %PrepareFunctionForOptimization(f);
assertEquals(5, f(obj));
assertEquals(6, f(obj));
%OptimizeFunctionOnNextCall(f);
@@ -121,6 +125,7 @@ Array.prototype.f = function() {
return [].indexOf.call(a4, b.value);
}
+ %PrepareFunctionForOptimization(f);
f(obj);
f(obj);
%OptimizeFunctionOnNextCall(f);
@@ -141,6 +146,7 @@ Array.prototype.f = function() {
return [].lastIndexOf.call(a5, b.value);
}
+ %PrepareFunctionForOptimization(f);
f(obj);
f(obj);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-lazy-freeze.js b/deps/v8/test/mjsunit/compiler/deopt-lazy-freeze.js
index 592fca8ad2..b7cdd37f7e 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-lazy-freeze.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-lazy-freeze.js
@@ -21,6 +21,7 @@ function setAndUseObject() {
return obj.f;
}
+%PrepareFunctionForOptimization(setAndUseObject);
assertEquals(setAndUseObject(), 2);
assertEquals(setAndUseObject(), 4);
%OptimizeFunctionOnNextCall(setAndUseObject);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-lazy-shape-mutation.js b/deps/v8/test/mjsunit/compiler/deopt-lazy-shape-mutation.js
index df4878e9cf..d9dc6d995a 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-lazy-shape-mutation.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-lazy-shape-mutation.js
@@ -17,6 +17,7 @@ function f() {
return o.x;
}
+%PrepareFunctionForOptimization(f);
f(); f();
%OptimizeFunctionOnNextCall(f);
b = true;
diff --git a/deps/v8/test/mjsunit/compiler/deopt-lazy-var-mutation.js b/deps/v8/test/mjsunit/compiler/deopt-lazy-var-mutation.js
index 93886f2ad7..17f3c392e4 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-lazy-var-mutation.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-lazy-var-mutation.js
@@ -19,6 +19,7 @@ function foo(a) {
}
var o = 1;
+%PrepareFunctionForOptimization(foo);
assertEquals(foo(o), 2);
assertEquals(foo(o), 2);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-many-lazy.js b/deps/v8/test/mjsunit/compiler/deopt-many-lazy.js
index e8a0b04419..1b24bfc767 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-many-lazy.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-many-lazy.js
@@ -23,11 +23,19 @@ function b() {
%DeoptimizeFunction(a);
}
+%PrepareFunctionForOptimization(f);
f(); f();
+%OptimizeFunctionOnNextCall(f);
+f();
+%PrepareFunctionForOptimization(a);
a(); a();
+%OptimizeFunctionOnNextCall(a);
+a();
for(var i = 0; i < 5; i++) {
+ %PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
- %OptimizeFunctionOnNextCall(a);
f();
+ %PrepareFunctionForOptimization(a);
+ %OptimizeFunctionOnNextCall(a);
a();
}
diff --git a/deps/v8/test/mjsunit/compiler/deopt-materialize-accumulator.js b/deps/v8/test/mjsunit/compiler/deopt-materialize-accumulator.js
index 0b19df8a1c..493bd8ec23 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-materialize-accumulator.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-materialize-accumulator.js
@@ -36,6 +36,7 @@ function f(a) {
// accumulator holding an unboxed double which needs materialized.
global = Math.sqrt(a);
}
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
f(0.25);
assertEquals(0.5, global);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-now-lazy.js b/deps/v8/test/mjsunit/compiler/deopt-now-lazy.js
index 6a86bcaf4d..b5d11acbec 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-now-lazy.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-now-lazy.js
@@ -8,5 +8,6 @@ function f() {
%DeoptimizeNow();
}
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
f();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-numberoroddball-binop.js b/deps/v8/test/mjsunit/compiler/deopt-numberoroddball-binop.js
index 6f19d45bb8..7634474f84 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-numberoroddball-binop.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-numberoroddball-binop.js
@@ -7,6 +7,7 @@
(function() {
function foo(x, y) { return x << y; }
+ %PrepareFunctionForOptimization(foo);
foo(1.1, 0.1);
foo(0.1, 1.1);
foo(true, false);
@@ -32,6 +33,7 @@
(function() {
function foo(x, y) { return x >> y; }
+ %PrepareFunctionForOptimization(foo);
foo(1.1, 0.1);
foo(0.1, 1.1);
foo(true, false);
@@ -57,6 +59,7 @@
(function() {
function foo(x, y) { return x >>> y; }
+ %PrepareFunctionForOptimization(foo);
foo(1.1, 0.1);
foo(0.1, 1.1);
foo(true, false);
@@ -82,6 +85,7 @@
(function() {
function foo(x, y) { return x ^ y; }
+ %PrepareFunctionForOptimization(foo);
foo(1.1, 0.1);
foo(0.1, 1.1);
foo(true, false);
@@ -107,6 +111,7 @@
(function() {
function foo(x, y) { return x | y; }
+ %PrepareFunctionForOptimization(foo);
foo(1.1, 0.1);
foo(0.1, 1.1);
foo(true, false);
@@ -132,6 +137,7 @@
(function() {
function foo(x, y) { return x & y; }
+ %PrepareFunctionForOptimization(foo);
foo(1.1, 0.1);
foo(0.1, 1.1);
foo(true, false);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-simple-eager.js b/deps/v8/test/mjsunit/compiler/deopt-simple-eager.js
index 9928647c8a..9944b72019 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-simple-eager.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-simple-eager.js
@@ -10,6 +10,7 @@ function f(o) {
return o.x;
}
+%PrepareFunctionForOptimization(f);
assertEquals(f({x : 2}), 2);
assertEquals(f({x : 2}), 2);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-simple-lazy.js b/deps/v8/test/mjsunit/compiler/deopt-simple-lazy.js
index e3721a3159..e32fc2af48 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-simple-lazy.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-simple-lazy.js
@@ -14,6 +14,7 @@ function g() {
%DeoptimizeFunction(f);
}
+%PrepareFunctionForOptimization(f);
f(); f();
%OptimizeFunctionOnNextCall(f);
f();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-simple-try-catch.js b/deps/v8/test/mjsunit/compiler/deopt-simple-try-catch.js
index b0e382e38c..6a1ca40c37 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-simple-try-catch.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-simple-try-catch.js
@@ -22,6 +22,7 @@ function f() {
}
}
+%PrepareFunctionForOptimization(f);
assertEquals(f(), 43);
assertEquals(f(), 43);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-soft-simple.js b/deps/v8/test/mjsunit/compiler/deopt-soft-simple.js
index eaa1e3c695..a32f6104ae 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-soft-simple.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-soft-simple.js
@@ -17,5 +17,6 @@ function f() {
return o.x;
}
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
f();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-string-outofbounds.js b/deps/v8/test/mjsunit/compiler/deopt-string-outofbounds.js
index e5ec075aa9..a7edbbc27d 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-string-outofbounds.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-string-outofbounds.js
@@ -9,10 +9,12 @@ var s = "12345";
(function() {
function foo() { return s[5]; }
+ %PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
foo();
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
assertOptimized(foo);
@@ -21,10 +23,12 @@ var s = "12345";
(function() {
function foo(i) { return s[i]; }
+ %PrepareFunctionForOptimization(foo);
foo(0);
foo(1);
%OptimizeFunctionOnNextCall(foo);
foo(5);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo(5);
assertOptimized(foo);
@@ -33,10 +37,12 @@ var s = "12345";
(function() {
function foo(s) { return s[5]; }
+ %PrepareFunctionForOptimization(foo);
foo(s);
foo(s);
%OptimizeFunctionOnNextCall(foo);
foo(s);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo(s);
assertOptimized(foo);
@@ -45,10 +51,12 @@ var s = "12345";
(function() {
function foo(s, i) { return s[i]; }
+ %PrepareFunctionForOptimization(foo);
foo(s, 0);
foo(s, 1);
%OptimizeFunctionOnNextCall(foo);
foo(s, 5);
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo(s, 5);
assertOptimized(foo);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-tonumber-binop.js b/deps/v8/test/mjsunit/compiler/deopt-tonumber-binop.js
index c93ef9dfd5..3af7078cbc 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-tonumber-binop.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-tonumber-binop.js
@@ -25,6 +25,7 @@ var o = { toString : function() {
return "1";
} };
+%PrepareFunctionForOptimization(f);
counter = 0;
assertEquals(1, f(deopt, o));
assertEquals(2, counter);
@@ -34,6 +35,7 @@ counter = 0;
assertEquals(-1, f(o, deopt));
assertEquals(2, counter);
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
counter = 0;
assertEquals(0, f(deopt, deopt));
diff --git a/deps/v8/test/mjsunit/compiler/deopt-tonumber-compare.js b/deps/v8/test/mjsunit/compiler/deopt-tonumber-compare.js
index 9a7e992ada..64b2f74f34 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-tonumber-compare.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-tonumber-compare.js
@@ -29,14 +29,16 @@ function deopt(f) {
};
}
+%PrepareFunctionForOptimization(f);
assertEquals(false, f(deopt(f)));
assertEquals(1, counter);
-assertEquals(true, g(deopt(g)));
-assertEquals(2, counter);
-
%OptimizeFunctionOnNextCall(f);
assertEquals(false, f(deopt(f)));
+assertEquals(2, counter);
+
+%PrepareFunctionForOptimization(g);
+assertEquals(true, g(deopt(g)));
assertEquals(3, counter);
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/deopt-tonumber-shift.js b/deps/v8/test/mjsunit/compiler/deopt-tonumber-shift.js
index bb4d1d5c1c..a4483e9598 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-tonumber-shift.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-tonumber-shift.js
@@ -25,6 +25,7 @@ var o = { toString : function() {
return "1";
} };
+%PrepareFunctionForOptimization(f);
counter = 0;
assertEquals(4, f(deopt, o));
assertEquals(2, counter);
@@ -34,6 +35,7 @@ counter = 0;
assertEquals(4, f(o, deopt));
assertEquals(2, counter);
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
counter = 0;
assertEquals(8, f(deopt, deopt));
diff --git a/deps/v8/test/mjsunit/compiler/deopt-twice-on-call.js b/deps/v8/test/mjsunit/compiler/deopt-twice-on-call.js
index f30b7d0aff..d591d9c9cf 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-twice-on-call.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-twice-on-call.js
@@ -17,6 +17,7 @@ function h() {
%DeoptimizeFunction(f);
}
+%PrepareFunctionForOptimization(f);
f(); f();
%OptimizeFunctionOnNextCall(f);
f();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-twice.js b/deps/v8/test/mjsunit/compiler/deopt-twice.js
index 1ec9c9fab8..929cca65ca 100644
--- a/deps/v8/test/mjsunit/compiler/deopt-twice.js
+++ b/deps/v8/test/mjsunit/compiler/deopt-twice.js
@@ -13,6 +13,7 @@ function g() {
%DeoptimizeFunction(f);
}
+%PrepareFunctionForOptimization(f);
f(); f();
%OptimizeFunctionOnNextCall(f);
f();
diff --git a/deps/v8/test/mjsunit/compiler/deoptimize-lazy-weak.js b/deps/v8/test/mjsunit/compiler/deoptimize-lazy-weak.js
index c774089098..e698654778 100644
--- a/deps/v8/test/mjsunit/compiler/deoptimize-lazy-weak.js
+++ b/deps/v8/test/mjsunit/compiler/deoptimize-lazy-weak.js
@@ -38,10 +38,14 @@ function f() {
}
shouldDeopt = false;
+%PrepareFunctionForOptimization(dummy_opt);
f();
f();
-
-%OptimizeFunctionOnNextCall(f);
%OptimizeFunctionOnNextCall(dummy_opt);
+f();
+%PrepareFunctionForOptimization(f);
+f();
+%OptimizeFunctionOnNextCall(f);
+
shouldDeopt = true;
assertEquals(2, f());
diff --git a/deps/v8/test/mjsunit/compiler/division-by-constant.js b/deps/v8/test/mjsunit/compiler/division-by-constant.js
index 212bdb24b9..b37d9f9975 100644
--- a/deps/v8/test/mjsunit/compiler/division-by-constant.js
+++ b/deps/v8/test/mjsunit/compiler/division-by-constant.js
@@ -107,6 +107,7 @@ function TestDivisionLike(ref, construct, values, divisor) {
var OptFun = new Function("dividend", construct(divisor));
// Warm up type feedback.
+ %PrepareFunctionForOptimization(OptFun);
OptFun(7);
OptFun(11);
%OptimizeFunctionOnNextCall(OptFun);
diff --git a/deps/v8/test/mjsunit/compiler/dont-constant-fold-deopting-checks.js b/deps/v8/test/mjsunit/compiler/dont-constant-fold-deopting-checks.js
index 02bd8d9a25..e211f7fd8f 100644
--- a/deps/v8/test/mjsunit/compiler/dont-constant-fold-deopting-checks.js
+++ b/deps/v8/test/mjsunit/compiler/dont-constant-fold-deopting-checks.js
@@ -6,5 +6,6 @@
function bar(a) { a[0](true); }
function foo(a) { return bar(1); }
+%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertThrows(function() {bar([foo])}, TypeError);
diff --git a/deps/v8/test/mjsunit/compiler/dont-flush-code-marked-for-opt.js b/deps/v8/test/mjsunit/compiler/dont-flush-code-marked-for-opt.js
new file mode 100644
index 0000000000..582f5940b5
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/dont-flush-code-marked-for-opt.js
@@ -0,0 +1,15 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --opt --allow-natives-syntax --expose-gc --stress-flush-bytecode
+
+function foo(a) {}
+
+%PrepareFunctionForOptimization(foo);
+foo();
+foo();
+%OptimizeFunctionOnNextCall(foo);
+gc();
+foo();
+assertOptimized(foo);
diff --git a/deps/v8/test/mjsunit/compiler/double-array-to-global.js b/deps/v8/test/mjsunit/compiler/double-array-to-global.js
index e221d90358..4dc1c9b7bf 100644
--- a/deps/v8/test/mjsunit/compiler/double-array-to-global.js
+++ b/deps/v8/test/mjsunit/compiler/double-array-to-global.js
@@ -11,6 +11,7 @@ function foo(a) {
b = a[i];
}
}
+%PrepareFunctionForOptimization(foo);
foo(a);
foo(a);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/eager-deopt-simple.js b/deps/v8/test/mjsunit/compiler/eager-deopt-simple.js
index 067400cfc6..c7a39cbedf 100644
--- a/deps/v8/test/mjsunit/compiler/eager-deopt-simple.js
+++ b/deps/v8/test/mjsunit/compiler/eager-deopt-simple.js
@@ -12,6 +12,7 @@ function f() {
return g(1, (%_DeoptimizeNow(), 2), 3);
}
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-1.js b/deps/v8/test/mjsunit/compiler/escape-analysis-1.js
index f05040bd02..f1b53a5cad 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-1.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-1.js
@@ -36,6 +36,7 @@ function g() {
return f(1,2,3);
}
+%PrepareFunctionForOptimization(g);
assertEquals(3, g());
assertEquals(3, g());
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-11.js b/deps/v8/test/mjsunit/compiler/escape-analysis-11.js
index e922fc15c8..5a136ee24e 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-11.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-11.js
@@ -13,6 +13,7 @@ function f() {
g();
}
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-12.js b/deps/v8/test/mjsunit/compiler/escape-analysis-12.js
index 16029a0ad3..d253d0d948 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-12.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-12.js
@@ -11,6 +11,7 @@ function f() {
x.b = 1;
0 <= y.b;
}
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-13.js b/deps/v8/test/mjsunit/compiler/escape-analysis-13.js
index 5f281aaaa4..b3de53a502 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-13.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-13.js
@@ -11,6 +11,7 @@ function f() {
assertEquals("a", x.a);
assertEquals("b", x.b);
}
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-15.js b/deps/v8/test/mjsunit/compiler/escape-analysis-15.js
index 1960d74892..510caa0782 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-15.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-15.js
@@ -12,6 +12,7 @@ function f(i) {
o2.a = o1;
if (i == 4) return o3;
}
+%PrepareFunctionForOptimization(f);
for (var i = 0; i < 100; ++i){
f(i%5)
}
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-16.js b/deps/v8/test/mjsunit/compiler/escape-analysis-16.js
index 4cd9ae43fd..bda6f82844 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-16.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-16.js
@@ -12,6 +12,7 @@ function foo(){
}
}
+%PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo)
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-17.js b/deps/v8/test/mjsunit/compiler/escape-analysis-17.js
index 5709d47129..aca0d32735 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-17.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-17.js
@@ -21,6 +21,7 @@ function foo() {
}
return x;
}
+%PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-18.js b/deps/v8/test/mjsunit/compiler/escape-analysis-18.js
index f2ff08299f..49719480f6 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-18.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-18.js
@@ -16,6 +16,7 @@ function foo(array) {
return bar(array);
}
+%PrepareFunctionForOptimization(foo);
let array = [,.5,];
foo(array);
foo(array);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-2.js b/deps/v8/test/mjsunit/compiler/escape-analysis-2.js
index 49f440e856..b62d7e278c 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-2.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-2.js
@@ -38,6 +38,7 @@ function g(a) {
return f(a,1,2,3);
}
+%PrepareFunctionForOptimization(g);
assertEquals(4, g());
assertEquals(4, g());
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-3.js b/deps/v8/test/mjsunit/compiler/escape-analysis-3.js
index b92d1c3876..193bf7cacb 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-3.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-3.js
@@ -37,6 +37,7 @@ function g() {
return arguments[f(1,2)];
}
+%PrepareFunctionForOptimization(g);
assertEquals(6, g(4,5,6));
assertEquals(6, g(4,5,6));
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-4.js b/deps/v8/test/mjsunit/compiler/escape-analysis-4.js
index ef9f95fd36..576f299e4f 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-4.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-4.js
@@ -41,6 +41,7 @@ function g() {
return "" + f(1,2,3) + " " + h(4,5,6);
}
+%PrepareFunctionForOptimization(g);
assertEquals("3 [object Arguments]", g());
assertEquals("3 [object Arguments]", g());
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-5.js b/deps/v8/test/mjsunit/compiler/escape-analysis-5.js
index 54b5e82958..69d0fdf575 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-5.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-5.js
@@ -41,6 +41,7 @@ function h(x) {
assertEquals("[object Arguments]", ""+x)
}
+%PrepareFunctionForOptimization(g);
assertEquals(4, g(h));
assertEquals(4, g(h));
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-6.js b/deps/v8/test/mjsunit/compiler/escape-analysis-6.js
index c36e7d956e..9d7ae92c65 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-6.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-6.js
@@ -41,6 +41,7 @@ function g() {
return x.length;
}
+%PrepareFunctionForOptimization(g);
assertEquals(5, g());
assertEquals(5, g());
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-7.js b/deps/v8/test/mjsunit/compiler/escape-analysis-7.js
index cfa30cbeb4..581bdf2c34 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-7.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-7.js
@@ -43,6 +43,7 @@ function g(a) {
return o.x;
}
+%PrepareFunctionForOptimization(g);
assertEquals(5, g(true));
assertEquals(7, g(false));
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-8.js b/deps/v8/test/mjsunit/compiler/escape-analysis-8.js
index d9c6d254ef..77d0492318 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-8.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-8.js
@@ -42,6 +42,7 @@ function g() {
return o.x;
}
+%PrepareFunctionForOptimization(g);
assertEquals(5, g());
assertEquals(5, g());
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-9.js b/deps/v8/test/mjsunit/compiler/escape-analysis-9.js
index 0b8f75c576..4e0c487008 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-9.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-9.js
@@ -43,6 +43,7 @@ function g(a) {
return o[0];
}
+%PrepareFunctionForOptimization(g);
assertEquals(7, g());
assertEquals(7, g());
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-arguments.js b/deps/v8/test/mjsunit/compiler/escape-analysis-arguments.js
index 65e736c706..4659a39597 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-arguments.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-arguments.js
@@ -52,6 +52,7 @@
assertEquals(5, r.y.z);
}
+ %PrepareFunctionForOptimization(f);
f(); f(); f();
%OptimizeFunctionOnNextCall(f);
f();
@@ -81,6 +82,7 @@
assertEquals(3, r.i.y.z);
}
+ %PrepareFunctionForOptimization(f);
f(); f(); f();
%OptimizeFunctionOnNextCall(f);
f();
@@ -113,9 +115,12 @@
assertEquals(3, l.y.z)
}
+ %PrepareFunctionForOptimization(f);
f(); f(); f();
%OptimizeFunctionOnNextCall(f);
- f(); f();
+ f();
+ %PrepareFunctionForOptimization(f);
+ f();
%OptimizeFunctionOnNextCall(f);
f(); f();
})();
@@ -147,10 +152,13 @@
assertEquals(3, l.y.z)
}
+ %PrepareFunctionForOptimization(f);
%NeverOptimizeFunction(i);
f(); f(); f();
%OptimizeFunctionOnNextCall(f);
- f(); f();
+ f();
+ %PrepareFunctionForOptimization(f);
+ f();
%OptimizeFunctionOnNextCall(f);
f(); f();
})();
@@ -179,9 +187,12 @@
assertEquals(7, k.t.u)
}
+ %PrepareFunctionForOptimization(f);
f(); f(); f();
%OptimizeFunctionOnNextCall(f);
- f(); f();
+ f();
+ %PrepareFunctionForOptimization(f);
+ f();
%OptimizeFunctionOnNextCall(f);
f(); f();
})();
@@ -206,6 +217,7 @@
return a + b + c;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(4, f(1, 2));
assertEquals(5, f(2, 1));
%OptimizeFunctionOnNextCall(f);
@@ -232,6 +244,7 @@
return a + b + c;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(4, f(1, 2));
assertEquals(5, f(2, 1));
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-array.js b/deps/v8/test/mjsunit/compiler/escape-analysis-array.js
index 2c44fa8c9b..3696c7cfc3 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-array.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-array.js
@@ -11,6 +11,7 @@
return a[i];
}
+ %PrepareFunctionForOptimization(f);
assertEquals("first", f(0));
assertEquals("first", f(0));
%OptimizeFunctionOnNextCall(f);
@@ -24,6 +25,7 @@
return a[i];
}
+ %PrepareFunctionForOptimization(f);
assertEquals("first", f(0));
assertEquals("second", f(1));
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-cycle.js b/deps/v8/test/mjsunit/compiler/escape-analysis-cycle.js
index ee3a4a721c..8a233c3af5 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-cycle.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-cycle.js
@@ -16,6 +16,7 @@ function f() {
return o.c.a.c.a.c.a.c.b;
}
+%PrepareFunctionForOptimization(f);
assertEquals(42, f());
assertEquals(42, f());
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-1.js b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-1.js
index 7337264b85..2570414cab 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-1.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-1.js
@@ -40,6 +40,7 @@
assertEquals(2, o1[1]);
assertEquals(3, o1[2]);
}
+ %PrepareFunctionForOptimization(func);
func(false);
func(false);
%OptimizeFunctionOnNextCall(func);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-2.js b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-2.js
index 306f3e7410..5c0ac97436 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-2.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-2.js
@@ -43,6 +43,7 @@
assertEquals(4, o2[0]);
assertEquals(o1, o2[1]);
}
+ %PrepareFunctionForOptimization(func);
func();
func();
%OptimizeFunctionOnNextCall(func);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-3.js b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-3.js
index 9999e53178..e560f16301 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-3.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-3.js
@@ -44,6 +44,7 @@
assertEquals(4, o2[0]);
assertEquals(o1, o2[1]);
}
+ %PrepareFunctionForOptimization(func);
func();
func();
%OptimizeFunctionOnNextCall(func);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-4.js b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-4.js
index c80765706c..99e4e5c205 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-4.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-4.js
@@ -50,6 +50,7 @@
assertEquals(o1, o2.a);
assertEquals(4, o2.b);
}
+ %PrepareFunctionForOptimization(func);
func();
func();
%OptimizeFunctionOnNextCall(func);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-5.js b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-5.js
index e70f0b1221..dde500f299 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-5.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-5.js
@@ -35,6 +35,7 @@ function f() {
return x[0];
}
+%PrepareFunctionForOptimization(f);
assertEquals(f(), 23.1234);
assertEquals(f(), 23.1234);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-6.js b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-6.js
index 6a776286db..da8aa376f2 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-6.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-deopt-6.js
@@ -10,6 +10,7 @@ function f(x) {
return a.length;
}
+%PrepareFunctionForOptimization(f);
assertEquals(3, f());
assertEquals(3, f());
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-framestate-use-at-branchpoint.js b/deps/v8/test/mjsunit/compiler/escape-analysis-framestate-use-at-branchpoint.js
index c86674e52e..cd6bfb0d3a 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-framestate-use-at-branchpoint.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-framestate-use-at-branchpoint.js
@@ -13,6 +13,7 @@ function foo() {
function bar() {i};
return o.x;
}
+%PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-materialize.js b/deps/v8/test/mjsunit/compiler/escape-analysis-materialize.js
index 6ad3a53218..b0dd2d655a 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-materialize.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-materialize.js
@@ -10,6 +10,7 @@
%_DeoptimizeNow();
return a.length;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(3, f());
assertEquals(3, f());
%OptimizeFunctionOnNextCall(f);
@@ -22,6 +23,7 @@
%_DeoptimizeNow();
return fun.length;
}
+ %PrepareFunctionForOptimization(g);
assertEquals(2, g());
assertEquals(2, g());
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type-2.js b/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type-2.js
index 2c2135b6da..a2d0936ffa 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type-2.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type-2.js
@@ -29,6 +29,7 @@ function f(x) {
return o.a + 1;
}
+%PrepareFunctionForOptimization(f);
f(0,0);
f(1,0);
f(2,0);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type.js b/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type.js
index 9d033b9640..90adbe8e7a 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-phi-type.js
@@ -16,6 +16,7 @@ function f(x) {
return res;
}
+%PrepareFunctionForOptimization(f);
f(0);
f(1);
f(0);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-replacement.js b/deps/v8/test/mjsunit/compiler/escape-analysis-replacement.js
index ffe95e30aa..caa77a148e 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-replacement.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-replacement.js
@@ -33,6 +33,7 @@ function foo(x){
return c.c;
}
+%PrepareFunctionForOptimization(foo);
foo(true);
foo(false);
foo(true);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-representation.js b/deps/v8/test/mjsunit/compiler/escape-analysis-representation.js
index e6cc9f1ed2..7a7d1225c0 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-representation.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-representation.js
@@ -50,6 +50,7 @@ function test(value_track, value_break) {
var deopt = { deopt:false };
// Warm-up field tracking to a certain representation.
+ %PrepareFunctionForOptimization(access);
access(value_track, value_track(), deopt);
access(value_track, value_track(), deopt);
%OptimizeFunctionOnNextCall(access);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-rest-parameters.js b/deps/v8/test/mjsunit/compiler/escape-analysis-rest-parameters.js
index 2ac1253a18..320465db82 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-rest-parameters.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-rest-parameters.js
@@ -23,6 +23,7 @@
return a + b + c;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(4, f(1, 2));
assertEquals(5, f(2, 1));
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-type-none-in-object-state.js b/deps/v8/test/mjsunit/compiler/escape-analysis-type-none-in-object-state.js
index aee6485eed..1692e4a56c 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-type-none-in-object-state.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-type-none-in-object-state.js
@@ -18,6 +18,7 @@ function g(x) {
f(""+x);
}
+%PrepareFunctionForOptimization(g);
g("x"); g("x");
%OptimizeFunctionOnNextCall(g);
g("x");
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-typeguard.js b/deps/v8/test/mjsunit/compiler/escape-analysis-typeguard.js
index 8746a81f9e..6d6cff1137 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis-typeguard.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis-typeguard.js
@@ -15,6 +15,7 @@ function foo(){
assertEquals(7, z.a);
}
+%PrepareFunctionForOptimization(foo);
foo();
foo();
foo();
diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis.js b/deps/v8/test/mjsunit/compiler/escape-analysis.js
index 111ed634fd..6b4fc96ddf 100644
--- a/deps/v8/test/mjsunit/compiler/escape-analysis.js
+++ b/deps/v8/test/mjsunit/compiler/escape-analysis.js
@@ -42,6 +42,7 @@
}
assertEquals(expected, object.a);
}
+ %PrepareFunctionForOptimization(join);
join(true, 1); join(true, 1);
join(false, 2); join(false, 2);
%OptimizeFunctionOnNextCall(join);
@@ -65,6 +66,7 @@
assertEquals(45, object.a);
assertEquals(23, object.b);
}
+ %PrepareFunctionForOptimization(loop);
loop(); loop();
%OptimizeFunctionOnNextCall(loop);
loop(); loop();
@@ -99,6 +101,7 @@
assertEquals(54, object.b);
assertEquals(23, object.c);
}
+ %PrepareFunctionForOptimization(nested);
nested(); nested();
%OptimizeFunctionOnNextCall(nested);
nested(); nested();
@@ -126,6 +129,7 @@
assertEquals(3.0, o2.d.c);
assertEquals(4.5, o2.e);
}
+ %PrepareFunctionForOptimization(func);
func(); func();
%OptimizeFunctionOnNextCall(func);
func(); func();
@@ -167,6 +171,7 @@
assertEquals(5.9, o.e);
assertEquals(6.7, o.g);
}
+ %PrepareFunctionForOptimization(func);
func(); func();
%OptimizeFunctionOnNextCall(func);
func(); func();
@@ -193,6 +198,7 @@
x: { get:getter, set:setter },
y: { get:getter, set:setter }
});
+ %PrepareFunctionForOptimization(check);
check(23, 42); check(23, 42);
%OptimizeFunctionOnNextCall(check);
check(23, 42); check(23, 42);
@@ -261,6 +267,7 @@
return o.z;
}
}
+ %PrepareFunctionForOptimization(oob);
assertEquals(3, oob(cons1, false));
assertEquals(3, oob(cons1, false));
assertEquals(7, oob(cons2, true));
@@ -295,6 +302,7 @@
assertEquals(99, o1.x);
assertEquals(99, o2.b.x);
}
+ %PrepareFunctionForOptimization(deep);
deep(); deep();
%OptimizeFunctionOnNextCall(deep);
deep(); deep();
@@ -333,6 +341,7 @@
o3.b.x = 1;
assertEquals(1, o1.x);
}
+ %PrepareFunctionForOptimization(deep);
deep(false); deep(false);
%OptimizeFunctionOnNextCall(deep);
deep(false); deep(false);
@@ -358,6 +367,7 @@
assertEquals(3, r.x.y);
}
+ %PrepareFunctionForOptimization(f);
f(); f(); f();
%OptimizeFunctionOnNextCall(f);
f();
@@ -374,6 +384,7 @@
assertEquals(111, l2.x.y);
}
+ %PrepareFunctionForOptimization(f);
f(); f(); f();
%OptimizeFunctionOnNextCall(f);
f();
@@ -392,6 +403,7 @@
assertEquals(0, dummy.d);
}
+ %PrepareFunctionForOptimization(f);
f(); f(); f();
%OptimizeFunctionOnNextCall(f);
f();
@@ -410,6 +422,7 @@
deopt.deopt
assertEquals(x, o.x);
}
+ %PrepareFunctionForOptimization(field);
field(1); field(2);
%OptimizeFunctionOnNextCall(field);
field(3); field(4);
@@ -430,6 +443,7 @@
deopt.deopt
assertEquals(x, o.x);
}
+ %PrepareFunctionForOptimization(field);
field({}); field({});
%OptimizeFunctionOnNextCall(field);
field({}); field({});
diff --git a/deps/v8/test/mjsunit/compiler/eval-introduced-closure.js b/deps/v8/test/mjsunit/compiler/eval-introduced-closure.js
index 550c7c30ee..9b2d89685d 100644
--- a/deps/v8/test/mjsunit/compiler/eval-introduced-closure.js
+++ b/deps/v8/test/mjsunit/compiler/eval-introduced-closure.js
@@ -42,6 +42,7 @@ function do_eval(str) {
}
var eval_f = do_eval('(' + f + ')');
+%PrepareFunctionForOptimization(eval_f);
for (var i = 0; i < 5; i++) assertEquals(27, eval_f());
%OptimizeFunctionOnNextCall(eval_f);
assertEquals(27, eval_f());
@@ -53,6 +54,7 @@ function do_eval_local(str) {
}
eval_f = do_eval_local('(' + f + ')');
+%PrepareFunctionForOptimization(eval_f);
for (var i = 0; i < 5; i++) assertEquals(42, eval_f());
%OptimizeFunctionOnNextCall(eval_f);
assertEquals(42, eval_f());
@@ -65,6 +67,7 @@ function do_eval_with_other_eval_call(str) {
}
eval_f = do_eval_with_other_eval_call('(' + f + ')');
+%PrepareFunctionForOptimization(eval_f);
for (var i = 0; i < 5; i++) assertEquals(27, eval_f());
%OptimizeFunctionOnNextCall(eval_f);
assertEquals(27, eval_f());
@@ -72,6 +75,7 @@ assertEquals(27, eval_f());
function test_non_strict_outer_eval() {
function strict_eval(str) { "use strict"; return eval(str); }
var eval_f = strict_eval('(' + f + ')');
+ %PrepareFunctionForOptimization(eval_f);
for (var i = 0; i < 5; i++) assertEquals(27, eval_f());
%OptimizeFunctionOnNextCall(eval_f);
assertEquals(27, eval_f());
@@ -85,6 +89,7 @@ function test_strict_outer_eval() {
"use strict";
function strict_eval(str) { "use strict"; return eval(str); }
var eval_f = strict_eval('(' + f + ')');
+ %PrepareFunctionForOptimization(eval_f);
for (var i = 0; i < 5; i++) assertEquals(27, eval_f());
%OptimizeFunctionOnNextCall(eval_f);
assertEquals(27, eval_f());
diff --git a/deps/v8/test/mjsunit/compiler/feedback-after-throw.js b/deps/v8/test/mjsunit/compiler/feedback-after-throw.js
index 891e315c5c..595d4c17cf 100644
--- a/deps/v8/test/mjsunit/compiler/feedback-after-throw.js
+++ b/deps/v8/test/mjsunit/compiler/feedback-after-throw.js
@@ -32,6 +32,7 @@ function foo() {
return 1 > 5;
};
+%PrepareFunctionForOptimization(foo);
try { foo() } catch(e) {}
try { foo() } catch(e) {}
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/for-in-1.js b/deps/v8/test/mjsunit/compiler/for-in-1.js
index 80add89609..f7cfa409a6 100644
--- a/deps/v8/test/mjsunit/compiler/for-in-1.js
+++ b/deps/v8/test/mjsunit/compiler/for-in-1.js
@@ -12,6 +12,7 @@ function foo(o) {
}
var a = [];
+%PrepareFunctionForOptimization(foo);
assertEquals("", foo(a));
assertEquals("", foo(a));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/for-in-2.js b/deps/v8/test/mjsunit/compiler/for-in-2.js
index a586aff94e..d4b0397a50 100644
--- a/deps/v8/test/mjsunit/compiler/for-in-2.js
+++ b/deps/v8/test/mjsunit/compiler/for-in-2.js
@@ -12,6 +12,7 @@ function foo(o) {
}
var a = [];
+%PrepareFunctionForOptimization(foo);
assertEquals("", foo(a));
assertEquals("", foo(a));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/for-in-3.js b/deps/v8/test/mjsunit/compiler/for-in-3.js
index 80f3fa50c9..0f43a7569e 100644
--- a/deps/v8/test/mjsunit/compiler/for-in-3.js
+++ b/deps/v8/test/mjsunit/compiler/for-in-3.js
@@ -12,6 +12,7 @@ function foo(o) {
}
var o = {};
+%PrepareFunctionForOptimization(foo);
assertEquals("", foo(o));
assertEquals("", foo(o));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/for-in-4.js b/deps/v8/test/mjsunit/compiler/for-in-4.js
index d15c3484dd..af5c0c8400 100644
--- a/deps/v8/test/mjsunit/compiler/for-in-4.js
+++ b/deps/v8/test/mjsunit/compiler/for-in-4.js
@@ -12,6 +12,7 @@ function foo(o) {
}
var a = [];
+%PrepareFunctionForOptimization(foo);
assertEquals("", foo(a));
assertEquals("", foo(a));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/for-in-5.js b/deps/v8/test/mjsunit/compiler/for-in-5.js
index 8f469ab1b3..71c5d8822a 100644
--- a/deps/v8/test/mjsunit/compiler/for-in-5.js
+++ b/deps/v8/test/mjsunit/compiler/for-in-5.js
@@ -11,6 +11,7 @@ function foo(o) {
return s;
}
var o = {a:1, b:2, c:3};
+%PrepareFunctionForOptimization(foo);
assertEquals("abc", foo(o));
assertEquals("abc", foo(o));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/function-apply.js b/deps/v8/test/mjsunit/compiler/function-apply.js
index f9440dede1..70309ce2df 100644
--- a/deps/v8/test/mjsunit/compiler/function-apply.js
+++ b/deps/v8/test/mjsunit/compiler/function-apply.js
@@ -10,6 +10,7 @@
function bar() { return this; }
function foo() { return bar.apply(this, null); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo.call(42));
assertEquals(42, foo.call(42));
%OptimizeFunctionOnNextCall(foo);
@@ -20,6 +21,7 @@
function bar() { return this; }
function foo() { return bar.apply(this, undefined); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo.call(42));
assertEquals(42, foo.call(42));
%OptimizeFunctionOnNextCall(foo);
@@ -37,6 +39,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -52,6 +55,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -64,6 +68,7 @@
function bar() { return this; }
function foo() { return bar.apply(); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo());
assertEquals(undefined, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -74,6 +79,7 @@
function bar() { return this; }
function foo() { return bar.apply(this); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo.call(42));
assertEquals(42, foo.call(42));
%OptimizeFunctionOnNextCall(foo);
@@ -84,6 +90,7 @@
function bar() { return this; }
function foo() { return bar.apply(this, arguments, this); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo.call(42));
assertEquals(42, foo.call(42));
%OptimizeFunctionOnNextCall(foo);
@@ -100,6 +107,7 @@
return Function.prototype.apply.call(undefined, this, dummy);
}
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
@@ -114,6 +122,7 @@
return Function.prototype.apply.call(null, this, dummy);
}
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
@@ -128,6 +137,7 @@
return Function.prototype.apply.call(null, this, dummy);
}
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/function-bind.js b/deps/v8/test/mjsunit/compiler/function-bind.js
index cc9451e0d5..c760507a17 100644
--- a/deps/v8/test/mjsunit/compiler/function-bind.js
+++ b/deps/v8/test/mjsunit/compiler/function-bind.js
@@ -12,6 +12,7 @@
return bar.bind(x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0)());
assertEquals(1, foo(1)());
%OptimizeFunctionOnNextCall(foo);
@@ -26,6 +27,7 @@
return bar.bind(undefined, x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0)());
assertEquals(1, foo(1)());
%OptimizeFunctionOnNextCall(foo);
@@ -39,6 +41,7 @@
return bar.bind(undefined, x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0)());
assertEquals(1, foo(1)());
%OptimizeFunctionOnNextCall(foo);
@@ -53,6 +56,7 @@
return bar.bind(undefined, x, y);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0, 0)());
assertEquals(2, foo(1, 1)());
%OptimizeFunctionOnNextCall(foo);
@@ -68,6 +72,7 @@
return bar.bind(undefined, x, y);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0, 0)());
assertEquals(2, foo(1, 1)());
%OptimizeFunctionOnNextCall(foo);
@@ -81,6 +86,7 @@
function foo(g) { return bar(g.bind(null, 2)); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(3, foo((x, y) => x + y));
assertEquals(1, foo((x, y) => x - y));
%OptimizeFunctionOnNextCall(foo);
@@ -93,6 +99,7 @@
function foo(a) { return a.map(add.bind(null, 1)); }
+ %PrepareFunctionForOptimization(foo);
assertEquals([1, 2, 3], foo([0, 1, 2]));
assertEquals([2, 3, 4], foo([1, 2, 3]));
%OptimizeFunctionOnNextCall(foo);
@@ -106,6 +113,7 @@
function foo(inc) { return inc(1); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(inc));
assertEquals(2, foo(inc));
%OptimizeFunctionOnNextCall(foo);
@@ -118,6 +126,7 @@
function foo() { return new B; }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertInstanceof(foo(), B);
%OptimizeFunctionOnNextCall(foo);
@@ -137,6 +146,7 @@
function foo(z) { return new B(z); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(3).x);
assertEquals(2, foo(3).y);
assertEquals(3, foo(3).z);
@@ -154,6 +164,7 @@
return new B;
}
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertInstanceof(foo(), A);
%OptimizeFunctionOnNextCall(foo);
@@ -174,6 +185,7 @@
return new B(z);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(3).x);
assertEquals(2, foo(3).y);
assertEquals(3, foo(3).z);
@@ -191,6 +203,7 @@
return new B;
}
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(B), A);
assertInstanceof(foo(B), A);
%OptimizeFunctionOnNextCall(foo);
@@ -211,6 +224,7 @@
return new B(z);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(B, 3).x);
assertEquals(2, foo(B, 3).y);
assertEquals(3, foo(B, 3).z);
@@ -231,6 +245,7 @@
};
const B = C.__proto__ = A.bind(null, 1);
+ %PrepareFunctionForOptimization(C);
assertInstanceof(new C(), A);
assertInstanceof(new C(), B);
assertInstanceof(new C(), C);
@@ -253,6 +268,7 @@
return bar(B)
}
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(B), A);
assertInstanceof(foo(B), A);
%OptimizeFunctionOnNextCall(foo);
@@ -276,6 +292,7 @@
return bar(B, z);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(B, 3).x);
assertEquals(2, foo(B, 3).y);
assertEquals(3, foo(B, 3).z);
diff --git a/deps/v8/test/mjsunit/compiler/function-caller.js b/deps/v8/test/mjsunit/compiler/function-caller.js
index 1192e680cb..931e31f2fe 100644
--- a/deps/v8/test/mjsunit/compiler/function-caller.js
+++ b/deps/v8/test/mjsunit/compiler/function-caller.js
@@ -18,6 +18,7 @@
(function caller() { g() })();
}
+ %PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/global-delete.js b/deps/v8/test/mjsunit/compiler/global-delete.js
index c32fda6dfa..d87a5970a0 100644
--- a/deps/v8/test/mjsunit/compiler/global-delete.js
+++ b/deps/v8/test/mjsunit/compiler/global-delete.js
@@ -5,6 +5,7 @@
// Flags: --allow-natives-syntax
function test(expected, f) {
+ %PrepareFunctionForOptimization(f);
assertEquals(expected, f());
assertEquals(expected, f());
%OptimizeFunctionOnNextCall(f);
@@ -13,6 +14,7 @@ function test(expected, f) {
}
function testThrows(f) {
+ %PrepareFunctionForOptimization(f);
assertThrows(f);
assertThrows(f);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/global-var-delete.js b/deps/v8/test/mjsunit/compiler/global-var-delete.js
index a7ea9ea4b1..bd9cf58d62 100644
--- a/deps/v8/test/mjsunit/compiler/global-var-delete.js
+++ b/deps/v8/test/mjsunit/compiler/global-var-delete.js
@@ -5,6 +5,7 @@
// Flags: --allow-natives-syntax
function test(expected, f) {
+ %PrepareFunctionForOptimization(f);
assertEquals(expected, f());
assertEquals(expected, f());
%OptimizeFunctionOnNextCall(f);
@@ -13,6 +14,7 @@ function test(expected, f) {
}
function testThrows(f) {
+ %PrepareFunctionForOptimization(f);
assertThrows(f);
assertThrows(f);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/increment-typefeedback.js b/deps/v8/test/mjsunit/compiler/increment-typefeedback.js
index 53e5ed678f..eeab4257ae 100644
--- a/deps/v8/test/mjsunit/compiler/increment-typefeedback.js
+++ b/deps/v8/test/mjsunit/compiler/increment-typefeedback.js
@@ -32,6 +32,7 @@ function f(x) {
return x;
}
+%PrepareFunctionForOptimization(f);
f(0.5);
f(0.5);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/inline-accessors1.js b/deps/v8/test/mjsunit/compiler/inline-accessors1.js
index daa01ec022..3cfbab5dc9 100644
--- a/deps/v8/test/mjsunit/compiler/inline-accessors1.js
+++ b/deps/v8/test/mjsunit/compiler/inline-accessors1.js
@@ -20,6 +20,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(o));
assertEquals(1, foo(o));
%OptimizeFunctionOnNextCall(foo);
@@ -43,6 +44,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(o));
assertEquals(1, foo(o));
%OptimizeFunctionOnNextCall(foo);
@@ -70,6 +72,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(o));
assertEquals(0, foo(o));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/inline-accessors2.js b/deps/v8/test/mjsunit/compiler/inline-accessors2.js
index b3985bf9dc..c13cf83e5d 100644
--- a/deps/v8/test/mjsunit/compiler/inline-accessors2.js
+++ b/deps/v8/test/mjsunit/compiler/inline-accessors2.js
@@ -36,6 +36,7 @@ function TestInlinedGetter(context, obj, expected) {
forceDeopt = { deopt: 0 };
accessorCallCount = 0;
+ %PrepareFunctionForOptimization(context);
assertEquals(expected, context(obj));
assertEquals(1, accessorCallCount);
@@ -194,6 +195,7 @@ function TestInlinedSetter(context, obj, value, expected) {
accessorCallCount = 0;
setterArgument = value;
+ %PrepareFunctionForOptimization(context);
assertEquals(expected, context(obj, value));
assertEquals(value, setterValue);
assertEquals(1, accessorCallCount);
diff --git a/deps/v8/test/mjsunit/compiler/inline-arguments.js b/deps/v8/test/mjsunit/compiler/inline-arguments.js
index 13f4a33e7b..4ee823f651 100644
--- a/deps/v8/test/mjsunit/compiler/inline-arguments.js
+++ b/deps/v8/test/mjsunit/compiler/inline-arguments.js
@@ -46,6 +46,7 @@ A.prototype.Z = function () {
};
var a = new A();
+%PrepareFunctionForOptimization(a.Z);
a.Z(4,5,6);
a.Z(4,5,6);
%OptimizeFunctionOnNextCall(a.Z);
@@ -75,6 +76,7 @@ function F4() {
return F31(1);
}
+%PrepareFunctionForOptimization(F4);
F4(1);
F4(1);
F4(1);
@@ -108,6 +110,7 @@ F4(1);
adapt4to2(1, 2, 3, 4);
}
+ %PrepareFunctionForOptimization(test_adaptation);
test_adaptation();
test_adaptation();
%OptimizeFunctionOnNextCall(test_adaptation);
@@ -146,6 +149,7 @@ function toarr2(marker, a, b, c) {
function test_toarr(toarr) {
var marker = { x: 0 };
+ %PrepareFunctionForOptimization(toarr);
assertArrayEquals([3, 2, 1], toarr(marker, 2, 4, 6));
assertArrayEquals([3, 2, 1], toarr(marker, 2, 4, 6));
%OptimizeFunctionOnNextCall(toarr);
@@ -175,7 +179,10 @@ test_toarr(toarr2);
return inner(x, y);
}
+ %PrepareFunctionForOptimization(outer);
%OptimizeFunctionOnNextCall(outer);
+ assertEquals(2, outer(1, 2));
+ %PrepareFunctionForOptimization(inner);
%OptimizeFunctionOnNextCall(inner);
assertEquals(2, outer(1, 2));
})();
@@ -197,6 +204,7 @@ test_toarr(toarr2);
return inner(x, y);
}
+ %PrepareFunctionForOptimization(outer);
assertEquals(2, outer(1, 2));
assertEquals(2, outer(1, 2));
assertEquals(2, outer(1, 2));
@@ -242,6 +250,7 @@ test_toarr(toarr2);
}
}
+ %PrepareFunctionForOptimization(outer);
for (var step = 0; step < 4; step++) {
if (outerCount == 1) outer(10);
if (outerCount == 2) outer(10, 11);
@@ -302,6 +311,7 @@ test_toarr(toarr2);
);
}
+ %PrepareFunctionForOptimization(outer);
outer();
outer();
%OptimizeFunctionOnNextCall(outer);
diff --git a/deps/v8/test/mjsunit/compiler/inline-arity-mismatch.js b/deps/v8/test/mjsunit/compiler/inline-arity-mismatch.js
index 4a61fa3a62..1a942d9903 100644
--- a/deps/v8/test/mjsunit/compiler/inline-arity-mismatch.js
+++ b/deps/v8/test/mjsunit/compiler/inline-arity-mismatch.js
@@ -48,13 +48,16 @@ function h2(a, b) {
var o = {x: 2};
+%PrepareFunctionForOptimization(h1);
assertEquals(4, h1(o, o));
assertEquals(4, h1(o, o));
+%OptimizeFunctionOnNextCall(h1);
+assertEquals(4, h1(o, o));
+
+%PrepareFunctionForOptimization(h2);
assertEquals(4, h2(o, o));
assertEquals(4, h2(o, o));
-%OptimizeFunctionOnNextCall(h1);
%OptimizeFunctionOnNextCall(h2);
-assertEquals(4, h1(o, o));
assertEquals(4, h2(o, o));
var u = {y:0, x:1};
diff --git a/deps/v8/test/mjsunit/compiler/inline-closures.js b/deps/v8/test/mjsunit/compiler/inline-closures.js
index 69161e505e..3ee75842fa 100644
--- a/deps/v8/test/mjsunit/compiler/inline-closures.js
+++ b/deps/v8/test/mjsunit/compiler/inline-closures.js
@@ -42,6 +42,7 @@ object.f = mkClosure('g');
object.g = mkClosure('h');
object.h = mkClosure('x');
+%PrepareFunctionForOptimization(object.f);
assertSame(1, object.f({value:1}));
assertSame(2, object.f({value:2}));
%OptimizeFunctionOnNextCall(object.f);
diff --git a/deps/v8/test/mjsunit/compiler/inline-compare.js b/deps/v8/test/mjsunit/compiler/inline-compare.js
index d97dce2e96..2d9c7a2e4c 100644
--- a/deps/v8/test/mjsunit/compiler/inline-compare.js
+++ b/deps/v8/test/mjsunit/compiler/inline-compare.js
@@ -42,6 +42,7 @@ function TestInlineCompare(o) {
}
}
+%PrepareFunctionForOptimization(TestInlineCompare);
var o = {};
o.f = function() { return 0 === 1; };
for (var i = 0; i < 5; i++) TestInlineCompare(o);
diff --git a/deps/v8/test/mjsunit/compiler/inline-construct.js b/deps/v8/test/mjsunit/compiler/inline-construct.js
index 111c0f32ad..4c5c9978d2 100644
--- a/deps/v8/test/mjsunit/compiler/inline-construct.js
+++ b/deps/v8/test/mjsunit/compiler/inline-construct.js
@@ -35,6 +35,7 @@ function TestInlinedConstructor(constructor, closure) {
var noDeopt = { deopt:0 };
var forceDeopt = { /*empty*/ };
+ %PrepareFunctionForOptimization(closure);
result = closure(constructor, 11, noDeopt, counter);
assertEquals(11, result);
assertEquals(1, counter.value);
@@ -119,6 +120,7 @@ function f_too_many(a, b, c) {
var obj = new c_too_many(a, b, c);
return obj.x;
}
+%PrepareFunctionForOptimization(f_too_many);
assertEquals(23, f_too_many(11, 12, 1));
assertEquals(42, f_too_many(23, 19, 1));
%OptimizeFunctionOnNextCall(f_too_many);
@@ -135,6 +137,7 @@ function f_too_few(a) {
var obj = new c_too_few(a);
return obj.x;
}
+%PrepareFunctionForOptimization(f_too_few);
assertEquals(12, f_too_few(11));
assertEquals(24, f_too_few(23));
%OptimizeFunctionOnNextCall(f_too_few);
diff --git a/deps/v8/test/mjsunit/compiler/inline-context-deopt.js b/deps/v8/test/mjsunit/compiler/inline-context-deopt.js
index ef134ad970..4b20719341 100644
--- a/deps/v8/test/mjsunit/compiler/inline-context-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/inline-context-deopt.js
@@ -14,5 +14,6 @@ function bar(s, t) {
return foo(s);
}
+%PrepareFunctionForOptimization(bar);
%OptimizeFunctionOnNextCall(bar);
assertEquals(13, bar(1, 2));
diff --git a/deps/v8/test/mjsunit/compiler/inline-context-slots.js b/deps/v8/test/mjsunit/compiler/inline-context-slots.js
index d0e907b1e5..a78d28e07b 100644
--- a/deps/v8/test/mjsunit/compiler/inline-context-slots.js
+++ b/deps/v8/test/mjsunit/compiler/inline-context-slots.js
@@ -43,6 +43,7 @@
return this.max();
}
var f = new F();
+ %PrepareFunctionForOptimization(f.run);
for (var i=0; i<5; i++) f.run();
%OptimizeFunctionOnNextCall(f.run);
assertEquals(10, f.run());
diff --git a/deps/v8/test/mjsunit/compiler/inline-exception-1.js b/deps/v8/test/mjsunit/compiler/inline-exception-1.js
index 8da6845c3b..b8b650bb38 100644
--- a/deps/v8/test/mjsunit/compiler/inline-exception-1.js
+++ b/deps/v8/test/mjsunit/compiler/inline-exception-1.js
@@ -30,6 +30,7 @@ function warmUp(f) {
}
function resetOptAndAssertResultEquals(expected, f) {
+ %PrepareFunctionForOptimization(f);
warmUp(f);
resetState();
// %DebugPrint(f);
@@ -39,6 +40,7 @@ function resetOptAndAssertResultEquals(expected, f) {
}
function resetOptAndAssertThrowsWith(expected, f) {
+ %PrepareFunctionForOptimization(f);
warmUp(f);
resetState();
// %DebugPrint(f);
diff --git a/deps/v8/test/mjsunit/compiler/inline-exception-2.js b/deps/v8/test/mjsunit/compiler/inline-exception-2.js
index 6dbc7a478b..945be2de88 100644
--- a/deps/v8/test/mjsunit/compiler/inline-exception-2.js
+++ b/deps/v8/test/mjsunit/compiler/inline-exception-2.js
@@ -30,6 +30,7 @@ function warmUp(f) {
}
function resetOptAndAssertResultEquals(expected, f) {
+ %PrepareFunctionForOptimization(f);
warmUp(f);
resetState();
// %DebugPrint(f);
@@ -39,6 +40,7 @@ function resetOptAndAssertResultEquals(expected, f) {
}
function resetOptAndAssertThrowsWith(expected, f) {
+ %PrepareFunctionForOptimization(f);
warmUp(f);
resetState();
// %DebugPrint(f);
diff --git a/deps/v8/test/mjsunit/compiler/inline-function-apply.js b/deps/v8/test/mjsunit/compiler/inline-function-apply.js
index 12238e1c53..8ccb8165a7 100644
--- a/deps/v8/test/mjsunit/compiler/inline-function-apply.js
+++ b/deps/v8/test/mjsunit/compiler/inline-function-apply.js
@@ -68,6 +68,7 @@
return r;
}
+ %PrepareFunctionForOptimization(A);
assertEquals("ABC", A(1,2));
assertEquals("ABC", A(1,2));
%OptimizeFunctionOnNextCall(A);
diff --git a/deps/v8/test/mjsunit/compiler/inline-global-access.js b/deps/v8/test/mjsunit/compiler/inline-global-access.js
index b52652a764..da6b25e75e 100644
--- a/deps/v8/test/mjsunit/compiler/inline-global-access.js
+++ b/deps/v8/test/mjsunit/compiler/inline-global-access.js
@@ -45,6 +45,7 @@ function TestInlineGlobalLoad(o) {
}
}
+%PrepareFunctionForOptimization(TestInlineGlobalLoad);
var o = {};
o.f = function() { return GLOBAL; };
for (var i = 0; i < 5; i++) TestInlineGlobalLoad(o);
diff --git a/deps/v8/test/mjsunit/compiler/inline-literals.js b/deps/v8/test/mjsunit/compiler/inline-literals.js
index 448799669e..7718ae0112 100644
--- a/deps/v8/test/mjsunit/compiler/inline-literals.js
+++ b/deps/v8/test/mjsunit/compiler/inline-literals.js
@@ -43,6 +43,7 @@ function TestArrayLiteral(a, b, c) {
assertEquals(expected, result, "TestArrayLiteral");
}
+%PrepareFunctionForOptimization(TestArrayLiteral);
TestArrayLiteral(1, 2, 3);
TestArrayLiteral(1, 2, 3);
%OptimizeFunctionOnNextCall(TestArrayLiteral);
@@ -63,6 +64,7 @@ function TestObjectLiteral(a, b, c) {
assertEquals(expected, result, "TestObjectLiteral");
}
+%PrepareFunctionForOptimization(TestObjectLiteral);
TestObjectLiteral(1, 2, 3);
TestObjectLiteral(1, 2, 3);
%OptimizeFunctionOnNextCall(TestObjectLiteral);
@@ -82,6 +84,7 @@ function TestRegExpLiteral(s, x, y, expected) {
assertEquals(expected, result, "TestRegExpLiteral");
}
+%PrepareFunctionForOptimization(TestRegExpLiteral);
TestRegExpLiteral("a-", "reg", "exp", "regexp-");
TestRegExpLiteral("-b", "reg", "exp", "-expreg");
%OptimizeFunctionOnNextCall(TestRegExpLiteral);
@@ -103,6 +106,7 @@ function TestFunctionLiteral(a, b, c, expected) {
assertEquals(expected, result, "TestFunctionLiteral");
}
+%PrepareFunctionForOptimization(TestFunctionLiteral);
TestFunctionLiteral(1, 2, 3, 6);
TestFunctionLiteral(4, 5, 6, 15);
%OptimizeFunctionOnNextCall(TestFunctionLiteral);
diff --git a/deps/v8/test/mjsunit/compiler/inline-omit-arguments-deopt.js b/deps/v8/test/mjsunit/compiler/inline-omit-arguments-deopt.js
index 65bfce715d..8e909bff16 100644
--- a/deps/v8/test/mjsunit/compiler/inline-omit-arguments-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/inline-omit-arguments-deopt.js
@@ -15,5 +15,6 @@ function baz() {
return foo.arguments.length == 1 && foo.arguments[0] == 11;
}
+%PrepareFunctionForOptimization(bar);
%OptimizeFunctionOnNextCall(bar);
assertEquals(true, bar(12, 14));
diff --git a/deps/v8/test/mjsunit/compiler/inline-omit-arguments-object.js b/deps/v8/test/mjsunit/compiler/inline-omit-arguments-object.js
index 342b78cac7..2154a1ba69 100644
--- a/deps/v8/test/mjsunit/compiler/inline-omit-arguments-object.js
+++ b/deps/v8/test/mjsunit/compiler/inline-omit-arguments-object.js
@@ -10,5 +10,6 @@ function foo(s, t) {
return args.length == 1 && args[0] == 11;
}
+%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(true, foo(11));
diff --git a/deps/v8/test/mjsunit/compiler/inline-omit-arguments.js b/deps/v8/test/mjsunit/compiler/inline-omit-arguments.js
index d72e45303b..9b14993064 100644
--- a/deps/v8/test/mjsunit/compiler/inline-omit-arguments.js
+++ b/deps/v8/test/mjsunit/compiler/inline-omit-arguments.js
@@ -8,5 +8,6 @@ var x = 42;
function bar(s, t, u, v) { return x + s; }
function foo(s, t) { return bar(s); }
+%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(42 + 12, foo(12));
diff --git a/deps/v8/test/mjsunit/compiler/inline-param.js b/deps/v8/test/mjsunit/compiler/inline-param.js
index 8fa80088fe..6c46161189 100644
--- a/deps/v8/test/mjsunit/compiler/inline-param.js
+++ b/deps/v8/test/mjsunit/compiler/inline-param.js
@@ -41,6 +41,7 @@ function TestInlineOneParam(o, p) {
}
}
+%PrepareFunctionForOptimization(TestInlineOneParam);
var obj = {x:42};
var o1 = {};
o1.f = function(o) { return o.x; };
@@ -78,6 +79,7 @@ function TestInlineTwoParams(o, p) {
}
}
+%PrepareFunctionForOptimization(TestInlineTwoParams);
var o2 = {};
o2.h = function(i, j) { return i < j; };
for (var i = 0; i < 5; i++) TestInlineTwoParams(o2, 42);
diff --git a/deps/v8/test/mjsunit/compiler/inline-surplus-arguments-deopt.js b/deps/v8/test/mjsunit/compiler/inline-surplus-arguments-deopt.js
index dfbdd8d06b..190c686813 100644
--- a/deps/v8/test/mjsunit/compiler/inline-surplus-arguments-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/inline-surplus-arguments-deopt.js
@@ -16,5 +16,6 @@ function baz() {
foo.arguments[2] == 15;
}
+%PrepareFunctionForOptimization(bar);
%OptimizeFunctionOnNextCall(bar);
assertEquals(true, bar(12, 14));
diff --git a/deps/v8/test/mjsunit/compiler/inline-surplus-arguments-object.js b/deps/v8/test/mjsunit/compiler/inline-surplus-arguments-object.js
index fec77af0c0..83bfbf5dd6 100644
--- a/deps/v8/test/mjsunit/compiler/inline-surplus-arguments-object.js
+++ b/deps/v8/test/mjsunit/compiler/inline-surplus-arguments-object.js
@@ -13,5 +13,6 @@ function bar(s, t) {
args[2] == 13;
}
+%PrepareFunctionForOptimization(bar);
%OptimizeFunctionOnNextCall(bar);
assertEquals(true, bar(11, 12));
diff --git a/deps/v8/test/mjsunit/compiler/inline-surplus-arguments.js b/deps/v8/test/mjsunit/compiler/inline-surplus-arguments.js
index c912acaa3f..b75c5df61d 100644
--- a/deps/v8/test/mjsunit/compiler/inline-surplus-arguments.js
+++ b/deps/v8/test/mjsunit/compiler/inline-surplus-arguments.js
@@ -8,5 +8,6 @@ var x = 42;
function foo(s) { return x + s; }
function bar(s, t) { return foo(s, t, 13); }
+%PrepareFunctionForOptimization(bar);
%OptimizeFunctionOnNextCall(bar);
assertEquals(42 + 12, bar(12));
diff --git a/deps/v8/test/mjsunit/compiler/inline-throw.js b/deps/v8/test/mjsunit/compiler/inline-throw.js
index 099b9d3351..a3e31abdc9 100644
--- a/deps/v8/test/mjsunit/compiler/inline-throw.js
+++ b/deps/v8/test/mjsunit/compiler/inline-throw.js
@@ -42,6 +42,7 @@ function g(x) {
return f(x);
}
+%PrepareFunctionForOptimization(g);
for (var i = 0; i < 5; i++) g(0);
%OptimizeFunctionOnNextCall(g);
assertEquals(true, g(0));
@@ -57,6 +58,7 @@ function h(x) {
return f(x) ? "yes" : "no";
}
+%PrepareFunctionForOptimization(h);
for (var i = 0; i < 5; i++) h(0);
%OptimizeFunctionOnNextCall(h);
assertEquals("yes", h(0));
diff --git a/deps/v8/test/mjsunit/compiler/inline-two.js b/deps/v8/test/mjsunit/compiler/inline-two.js
index 68372a979e..21571091dc 100644
--- a/deps/v8/test/mjsunit/compiler/inline-two.js
+++ b/deps/v8/test/mjsunit/compiler/inline-two.js
@@ -41,6 +41,7 @@ function TestInlineX(o) {
}
}
+%PrepareFunctionForOptimization(TestInlineX);
var o2 = {};
o2.size = function() { return 42; }
o2.g = function() { return this.size(); };
@@ -64,6 +65,7 @@ function TestInlineX2(o) {
}
}
+%PrepareFunctionForOptimization(TestInlineX2);
var obj = {}
obj.foo = function() { return 42; }
var o3 = {};
@@ -89,6 +91,7 @@ function TestInlineFG(o) {
}
}
+%PrepareFunctionForOptimization(TestInlineFG);
var obj = {}
obj.g = function() { return 42; }
var o3 = {};
diff --git a/deps/v8/test/mjsunit/compiler/inlined-array-pop-getter1.js b/deps/v8/test/mjsunit/compiler/inlined-array-pop-getter1.js
index 8eb1c308a3..3dfcf03222 100644
--- a/deps/v8/test/mjsunit/compiler/inlined-array-pop-getter1.js
+++ b/deps/v8/test/mjsunit/compiler/inlined-array-pop-getter1.js
@@ -10,6 +10,7 @@ function foo(a) {
var a = new Array(4);
+%PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(a));
assertEquals(undefined, foo(a));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/inlined-array-pop-getter2.js b/deps/v8/test/mjsunit/compiler/inlined-array-pop-getter2.js
index 8ae642619e..78e2b53eee 100644
--- a/deps/v8/test/mjsunit/compiler/inlined-array-pop-getter2.js
+++ b/deps/v8/test/mjsunit/compiler/inlined-array-pop-getter2.js
@@ -15,6 +15,7 @@ var a = new Array(4);
var o = {}
o.__defineGetter__(0, function() { return 1; });
+%PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(a));
assertEquals(undefined, foo(a));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/inlined-array-pop-opt.js b/deps/v8/test/mjsunit/compiler/inlined-array-pop-opt.js
index 08cbdbef8c..7fe6cd5535 100644
--- a/deps/v8/test/mjsunit/compiler/inlined-array-pop-opt.js
+++ b/deps/v8/test/mjsunit/compiler/inlined-array-pop-opt.js
@@ -10,6 +10,7 @@
var x = {};
var a = [x,x,];
+ %PrepareFunctionForOptimization(foo);
assertEquals(x, foo(a));
assertEquals(x, foo(a));
%OptimizeFunctionOnNextCall(foo);
@@ -23,6 +24,7 @@
var x = 0;
var a = [x,x,];
+ %PrepareFunctionForOptimization(foo);
assertEquals(x, foo(a));
assertEquals(x, foo(a));
%OptimizeFunctionOnNextCall(foo);
@@ -36,6 +38,7 @@
var x = 0;
var a = [x,x,x];
+ %PrepareFunctionForOptimization(foo);
assertEquals(x, foo(a));
assertEquals(x, foo(a));
%OptimizeFunctionOnNextCall(foo);
@@ -49,6 +52,7 @@
var x = {};
var a = [x,x,x];
+ %PrepareFunctionForOptimization(foo);
assertEquals(x, foo(a));
assertEquals(x, foo(a));
%OptimizeFunctionOnNextCall(foo);
@@ -61,6 +65,7 @@
var a = [,,];
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(a));
assertEquals(undefined, foo(a));
%OptimizeFunctionOnNextCall(foo);
@@ -75,6 +80,7 @@
var a = [1, 2, 3];
+ %PrepareFunctionForOptimization(foo);
assertEquals(3, foo(a));
assertEquals(2, foo(a));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/inlined-call-mapcheck.js b/deps/v8/test/mjsunit/compiler/inlined-call-mapcheck.js
index 1f7b2dad87..3a02e701da 100644
--- a/deps/v8/test/mjsunit/compiler/inlined-call-mapcheck.js
+++ b/deps/v8/test/mjsunit/compiler/inlined-call-mapcheck.js
@@ -36,6 +36,7 @@
function g() {}
+ %PrepareFunctionForOptimization(f);
f(g);
f(g);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/inlined-call.js b/deps/v8/test/mjsunit/compiler/inlined-call.js
index 772dcbee8b..0c8134aa1e 100644
--- a/deps/v8/test/mjsunit/compiler/inlined-call.js
+++ b/deps/v8/test/mjsunit/compiler/inlined-call.js
@@ -69,6 +69,7 @@ function unshiftsArray(num) {
[].unshift.call(array, num);
}
+%PrepareFunctionForOptimization(unshiftsArray);
unshiftsArray(50);
unshiftsArray(60);
%OptimizeFunctionOnNextCall(unshiftsArray);
@@ -93,6 +94,7 @@ function callNoArgs() {
[].fun.call();
}
+%PrepareFunctionForOptimization(callNoArgs);
callNoArgs();
callNoArgs();
assertEquals(this, funRecv);
@@ -109,6 +111,7 @@ function callStrictNoArgs() {
[].funStrict.call();
}
+%PrepareFunctionForOptimization(callStrictNoArgs);
callStrictNoArgs();
callStrictNoArgs();
assertEquals(undefined, funStrictRecv);
@@ -125,6 +128,7 @@ function callManyArgs() {
[].manyArgs.call(0, 1, 2, 3, 4, 5);
}
+%PrepareFunctionForOptimization(callManyArgs);
callManyArgs();
callManyArgs();
%OptimizeFunctionOnNextCall(callManyArgs);
@@ -139,6 +143,7 @@ function callManyArgsSloppy() {
[].manyArgsSloppy.call(null, 1, 2, 3, 4, 5);
}
+%PrepareFunctionForOptimization(callManyArgsSloppy);
callManyArgsSloppy();
callManyArgsSloppy();
%OptimizeFunctionOnNextCall(callManyArgsSloppy);
@@ -154,6 +159,7 @@ function callBuiltinIndirectly() {
return "".charCodeAt.call(str, 3);
}
+%PrepareFunctionForOptimization(callBuiltinIndirectly);
callBuiltinIndirectly();
callBuiltinIndirectly();
%OptimizeFunctionOnNextCall(callBuiltinIndirectly);
@@ -174,12 +180,14 @@ function callInlined(num) {
return callInlineableBuiltinIndirectlyWhileInlined(num);
}
+%PrepareFunctionForOptimization(callInlineableBuiltinIndirectlyWhileInlined);
callInlineableBuiltinIndirectlyWhileInlined(1);
callInlineableBuiltinIndirectlyWhileInlined(2);
%OptimizeFunctionOnNextCall(callInlineableBuiltinIndirectlyWhileInlined);
callInlineableBuiltinIndirectlyWhileInlined(3);
assertOptimized(callInlineableBuiltinIndirectlyWhileInlined);
+%PrepareFunctionForOptimization(callInlined);
callInlined(1);
callInlined(2);
%OptimizeFunctionOnNextCall(callInlined);
diff --git a/deps/v8/test/mjsunit/compiler/instance-of-overridden-has-instance.js b/deps/v8/test/mjsunit/compiler/instance-of-overridden-has-instance.js
index 49c8899e69..c82fedf280 100644
--- a/deps/v8/test/mjsunit/compiler/instance-of-overridden-has-instance.js
+++ b/deps/v8/test/mjsunit/compiler/instance-of-overridden-has-instance.js
@@ -13,6 +13,7 @@
return {} instanceof C;
}
+ %PrepareFunctionForOptimization(f);
assertTrue(f());
assertTrue(f());
%OptimizeFunctionOnNextCall(f);
@@ -35,6 +36,7 @@
return f(b, C);
}
+ %PrepareFunctionForOptimization(g);
assertFalse(f(true, Number));
assertFalse(f(true, Number));
assertFalse(g(false));
@@ -57,6 +59,7 @@
return f(b, C);
}
+ %PrepareFunctionForOptimization(g);
assertFalse(f(true, Number));
assertFalse(f(true, Number));
assertFalse(g(false));
@@ -76,6 +79,7 @@
return {} instanceof C;
}
+ %PrepareFunctionForOptimization(f);
assertTrue(f());
assertTrue(f());
%OptimizeFunctionOnNextCall(f);
@@ -97,6 +101,7 @@
return {} instanceof C;
}
+ %PrepareFunctionForOptimization(f);
assertFalse(f());
assertFalse(f());
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/instanceof-opt1.js b/deps/v8/test/mjsunit/compiler/instanceof-opt1.js
index 6ffdfc0ab1..0549222565 100644
--- a/deps/v8/test/mjsunit/compiler/instanceof-opt1.js
+++ b/deps/v8/test/mjsunit/compiler/instanceof-opt1.js
@@ -12,6 +12,7 @@ var Foo = {
// OrdinaryHasInstance call inside Function.prototype[@@hasInstance].
function foo() { return 1 instanceof Foo; }
+%PrepareFunctionForOptimization(foo);
assertEquals(false, foo());
assertEquals(false, foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/instanceof-opt2.js b/deps/v8/test/mjsunit/compiler/instanceof-opt2.js
index 6f57faf1fc..bddff35535 100644
--- a/deps/v8/test/mjsunit/compiler/instanceof-opt2.js
+++ b/deps/v8/test/mjsunit/compiler/instanceof-opt2.js
@@ -10,6 +10,7 @@ function Foo() {}
// OrdinaryHasInstance call inside Function.prototype[@@hasInstance].
function foo() { return 1 instanceof Foo; }
+%PrepareFunctionForOptimization(foo);
assertEquals(false, foo());
assertEquals(false, foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/instanceof-opt3.js b/deps/v8/test/mjsunit/compiler/instanceof-opt3.js
index 3317d8acf4..439f39b02c 100644
--- a/deps/v8/test/mjsunit/compiler/instanceof-opt3.js
+++ b/deps/v8/test/mjsunit/compiler/instanceof-opt3.js
@@ -11,6 +11,7 @@ var Foo = Bar.bind(null);
// OrdinaryHasInstance call inside Function.prototype[@@hasInstance].
function foo() { return 1 instanceof Foo; }
+%PrepareFunctionForOptimization(foo);
assertEquals(false, foo());
assertEquals(false, foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/instanceof.js b/deps/v8/test/mjsunit/compiler/instanceof.js
index 67127cf88e..ad0d2c1786 100644
--- a/deps/v8/test/mjsunit/compiler/instanceof.js
+++ b/deps/v8/test/mjsunit/compiler/instanceof.js
@@ -42,6 +42,7 @@ F.__proto__ = null;
(function() {
function foo(o) { return o instanceof A; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(a));
assertTrue(foo(a));
assertTrue(foo(new A()));
@@ -59,6 +60,7 @@ F.__proto__ = null;
}
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(a));
assertTrue(foo(a));
assertTrue(foo(new A()));
@@ -72,6 +74,7 @@ F.__proto__ = null;
(function() {
function foo(o) { return o instanceof B; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(a));
assertFalse(foo(a));
assertFalse(foo(new A()));
@@ -83,6 +86,7 @@ F.__proto__ = null;
(function() {
function foo(o) { return o instanceof C; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(a));
assertTrue(foo(a));
assertTrue(foo(new A()));
@@ -94,6 +98,7 @@ F.__proto__ = null;
(function() {
function foo(o) { return o instanceof D; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(a));
assertTrue(foo(a));
assertFalse(foo(new A()));
@@ -111,6 +116,7 @@ F.__proto__ = null;
}
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(a));
assertTrue(foo(new A()));
%OptimizeFunctionOnNextCall(foo);
@@ -123,6 +129,7 @@ F.__proto__ = null;
return o instanceof F;
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(a));
assertFalse(foo(new A()));
assertTrue(foo(new F()));
@@ -138,6 +145,7 @@ F.__proto__ = null;
return a instanceof A;
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -155,6 +163,7 @@ F.__proto__ = null;
makeFoo();
const foo = makeFoo();
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(new B));
assertFalse(foo(new A));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/instanceof2.js b/deps/v8/test/mjsunit/compiler/instanceof2.js
index ca006e3046..3d5b904243 100644
--- a/deps/v8/test/mjsunit/compiler/instanceof2.js
+++ b/deps/v8/test/mjsunit/compiler/instanceof2.js
@@ -15,6 +15,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -30,6 +31,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertTrue(IsGoo(goo));
assertTrue(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -45,6 +47,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertThrows(_ => IsGoo(goo), TypeError);
assertThrows(_ => IsGoo(goo), TypeError);
%OptimizeFunctionOnNextCall(IsGoo);
@@ -59,6 +62,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -75,6 +79,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -94,6 +99,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertTrue(IsGoo(goo));
assertTrue(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -109,6 +115,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -124,6 +131,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertThrows(_ => IsGoo(goo), TypeError);
assertThrows(_ => IsGoo(goo), TypeError);
%OptimizeFunctionOnNextCall(IsGoo);
@@ -138,6 +146,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertTrue(IsGoo(goo));
assertTrue(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -154,6 +163,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertTrue(IsGoo(goo));
assertTrue(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -171,6 +181,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertThrows(_ => IsGoo(goo), TypeError);
assertThrows(_ => IsGoo(goo), TypeError);
%OptimizeFunctionOnNextCall(IsGoo);
@@ -189,6 +200,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -207,6 +219,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertThrows(_ => IsGoo(goo), TypeError);
assertThrows(_ => IsGoo(goo), TypeError);
%OptimizeFunctionOnNextCall(IsGoo);
@@ -225,6 +238,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
diff --git a/deps/v8/test/mjsunit/compiler/instanceof3.js b/deps/v8/test/mjsunit/compiler/instanceof3.js
index e390c42092..085ad61387 100644
--- a/deps/v8/test/mjsunit/compiler/instanceof3.js
+++ b/deps/v8/test/mjsunit/compiler/instanceof3.js
@@ -15,6 +15,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -30,6 +31,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertTrue(IsGoo(goo));
assertTrue(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -45,6 +47,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertThrows(_ => IsGoo(goo), TypeError);
assertThrows(_ => IsGoo(goo), TypeError);
%OptimizeFunctionOnNextCall(IsGoo);
@@ -59,6 +62,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -75,6 +79,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -94,6 +99,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertTrue(IsGoo(goo));
assertTrue(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -109,6 +115,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -124,6 +131,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertThrows(_ => IsGoo(goo), TypeError);
assertThrows(_ => IsGoo(goo), TypeError);
%OptimizeFunctionOnNextCall(IsGoo);
@@ -138,6 +146,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertTrue(IsGoo(goo));
assertTrue(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -154,6 +163,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertTrue(IsGoo(goo));
assertTrue(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -171,6 +181,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertThrows(_ => IsGoo(goo), TypeError);
assertThrows(_ => IsGoo(goo), TypeError);
%OptimizeFunctionOnNextCall(IsGoo);
@@ -189,6 +200,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
@@ -207,6 +219,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertThrows(_ => IsGoo(goo), TypeError);
assertThrows(_ => IsGoo(goo), TypeError);
%OptimizeFunctionOnNextCall(IsGoo);
@@ -225,6 +238,7 @@
return x instanceof Goo;
}
+ %PrepareFunctionForOptimization(IsGoo);
assertFalse(IsGoo(goo));
assertFalse(IsGoo(goo));
%OptimizeFunctionOnNextCall(IsGoo);
diff --git a/deps/v8/test/mjsunit/compiler/int64.js b/deps/v8/test/mjsunit/compiler/int64.js
index b2c53913da..a69df8dc5d 100644
--- a/deps/v8/test/mjsunit/compiler/int64.js
+++ b/deps/v8/test/mjsunit/compiler/int64.js
@@ -11,6 +11,7 @@
return i + 1;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0x000000001, foo(false));
assertEquals(0x000000001, foo(false));
assertEquals(0x100000000, foo(true));
@@ -27,6 +28,7 @@
return i + 1;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0x000000000, foo(false));
assertEquals(0x000000000, foo(false));
assertEquals(0x100000000, foo(true));
@@ -45,6 +47,7 @@
return a[0];
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0x0FFFFFFFF, foo({x:0}));
assertEquals(0x100000000, foo({x:1}));
%OptimizeFunctionOnNextCall(foo);
@@ -57,6 +60,7 @@
return {x: Math.floor((o.x + 11123456789) + -11123456788)}.x;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo({x:0}));
assertEquals(2, foo({x:1}));
%OptimizeFunctionOnNextCall(foo);
@@ -70,6 +74,7 @@
return a[i];
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo([1], 0xFFFFFFFF));
assertEquals(2, foo([2], 0xFFFFFFFF));
%OptimizeFunctionOnNextCall(foo);
@@ -84,6 +89,7 @@
return i;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0xFFFFFFFF));
assertEquals(0, foo(0xFFFFFFFF));
%OptimizeFunctionOnNextCall(foo);
@@ -97,6 +103,7 @@
return dv.getInt8(i, true);
}
+ %PrepareFunctionForOptimization(foo);
const dv = new DataView(new ArrayBuffer(10));
dv.setFloat32(0, 8, true);
dv.setFloat32(4, 9, true);
@@ -117,6 +124,7 @@
return dv.getInt8(i, true);
}
+ %PrepareFunctionForOptimization(foo);
const dv = new DataView(new ArrayBuffer(18));
dv.setFloat64(0, 16, true);
dv.setFloat64(8, 17, true);
diff --git a/deps/v8/test/mjsunit/compiler/integral32-add-sub.js b/deps/v8/test/mjsunit/compiler/integral32-add-sub.js
index 16515d3990..4704ba7da8 100644
--- a/deps/v8/test/mjsunit/compiler/integral32-add-sub.js
+++ b/deps/v8/test/mjsunit/compiler/integral32-add-sub.js
@@ -11,6 +11,7 @@
return x + y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(-2147483648, foo(0));
assertEquals(0, foo(2147483648));
assertEquals(2147483647, foo(4294967295));
@@ -31,6 +32,7 @@
return x - y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(-2147483648, foo(0));
assertEquals(0, foo(2147483648));
assertEquals(2147483647, foo(4294967295));
@@ -51,6 +53,7 @@
return x + y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2147483648, foo(0));
assertEquals(0, foo(-2147483648));
assertEquals(4294967295, foo(2147483647));
@@ -71,6 +74,7 @@
return x - y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2147483648, foo(0));
assertEquals(0, foo(-2147483648));
assertEquals(4294967295, foo(2147483647));
@@ -91,6 +95,7 @@
return x + y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2147483647, foo(2147483647));
assertEquals(-2147483648, foo(-2147483648));
assertEquals(0, foo(0));
@@ -111,6 +116,7 @@
return y - z;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2147483647, foo(-1));
assertEquals(2147483648, foo(0));
assertEquals(2147483649, foo(1));
diff --git a/deps/v8/test/mjsunit/compiler/lazy-const-lookup.js b/deps/v8/test/mjsunit/compiler/lazy-const-lookup.js
index ff4558e7ef..ce147d72ac 100644
--- a/deps/v8/test/mjsunit/compiler/lazy-const-lookup.js
+++ b/deps/v8/test/mjsunit/compiler/lazy-const-lookup.js
@@ -32,6 +32,7 @@ function outer() {
function inner() {
return x;
}
+ %PrepareFunctionForOptimization(inner);
inner();
%OptimizeFunctionOnNextCall(inner);
inner();
diff --git a/deps/v8/test/mjsunit/compiler/lazy-deopt-async-function-resolve.js b/deps/v8/test/mjsunit/compiler/lazy-deopt-async-function-resolve.js
index faa5e63239..9b37c5c266 100644
--- a/deps/v8/test/mjsunit/compiler/lazy-deopt-async-function-resolve.js
+++ b/deps/v8/test/mjsunit/compiler/lazy-deopt-async-function-resolve.js
@@ -13,6 +13,7 @@
}
assertPromiseResult((async () => {
+ %PrepareFunctionForOptimization(foo);
await foo(1);
await foo(2);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/lazy-deopt-in-literal.js b/deps/v8/test/mjsunit/compiler/lazy-deopt-in-literal.js
index 0a1481c571..16ed234fcc 100644
--- a/deps/v8/test/mjsunit/compiler/lazy-deopt-in-literal.js
+++ b/deps/v8/test/mjsunit/compiler/lazy-deopt-in-literal.js
@@ -13,6 +13,7 @@ function fun3() {
return r[113];
}
+%PrepareFunctionForOptimization(fun3);
fun3();
fun3();
%OptimizeFunctionOnNextCall(fun3);
diff --git a/deps/v8/test/mjsunit/compiler/literals-optimized.js b/deps/v8/test/mjsunit/compiler/literals-optimized.js
index 049e21a3a5..4e086e8e24 100644
--- a/deps/v8/test/mjsunit/compiler/literals-optimized.js
+++ b/deps/v8/test/mjsunit/compiler/literals-optimized.js
@@ -30,6 +30,7 @@
// Test optimized versions of array and object literals.
function TestOptimizedLiteral(create, verify) {
+ %PrepareFunctionForOptimization(create);
verify(create(1, 2, 3), 1, 2, 3);
verify(create(3, 5, 7), 3, 5, 7);
%OptimizeFunctionOnNextCall(create);
diff --git a/deps/v8/test/mjsunit/compiler/load-elimination-global.js b/deps/v8/test/mjsunit/compiler/load-elimination-global.js
index 9caaa9f718..ed3cd70908 100644
--- a/deps/v8/test/mjsunit/compiler/load-elimination-global.js
+++ b/deps/v8/test/mjsunit/compiler/load-elimination-global.js
@@ -171,6 +171,7 @@ function test_store_store() {
}
function test(x, f) {
+ %PrepareFunctionForOptimization(f);
X = true;
assertEquals(x, f());
assertEquals(x, f());
diff --git a/deps/v8/test/mjsunit/compiler/load-elimination-osr.js b/deps/v8/test/mjsunit/compiler/load-elimination-osr.js
index a57fe173ee..159c647c6c 100644
--- a/deps/v8/test/mjsunit/compiler/load-elimination-osr.js
+++ b/deps/v8/test/mjsunit/compiler/load-elimination-osr.js
@@ -58,6 +58,7 @@ function foo_hot(x, limit) {
return o.y;
}
+%PrepareFunctionForOptimization(foo_hot);
assertEquals(22, foo_hot(11, 1));
assertEquals(24, foo_hot(12, 1));
%OptimizeFunctionOnNextCall(foo_hot);
diff --git a/deps/v8/test/mjsunit/compiler/load-elimination-params.js b/deps/v8/test/mjsunit/compiler/load-elimination-params.js
index 13a4a8596d..cdf55b1158 100644
--- a/deps/v8/test/mjsunit/compiler/load-elimination-params.js
+++ b/deps/v8/test/mjsunit/compiler/load-elimination-params.js
@@ -43,6 +43,8 @@ function test_params1(a, b) {
return i + j + k + l;
}
+%PrepareFunctionForOptimization(test_params1);
+
assertEquals(14, test_params1(new B(3, 4), new B(4, 5)));
assertEquals(110, test_params1(new B(11, 7), new B(44, 8)));
@@ -63,6 +65,8 @@ function test_params2(a, b) {
return i + j + k + l;
}
+%PrepareFunctionForOptimization(test_params2);
+
assertEquals(14, test_params2(3, 4));
assertEquals(110, test_params2(11, 44));
diff --git a/deps/v8/test/mjsunit/compiler/load-elimination.js b/deps/v8/test/mjsunit/compiler/load-elimination.js
index 9bf8564308..b4b8a187da 100644
--- a/deps/v8/test/mjsunit/compiler/load-elimination.js
+++ b/deps/v8/test/mjsunit/compiler/load-elimination.js
@@ -141,6 +141,7 @@ function test_store_store() {
}
function test(x, f) {
+ %PrepareFunctionForOptimization(f);
assertEquals(x, f());
assertEquals(x, f());
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/materialize-dictionary-properties.js b/deps/v8/test/mjsunit/compiler/materialize-dictionary-properties.js
index 5838a83979..bf2a0922ab 100644
--- a/deps/v8/test/mjsunit/compiler/materialize-dictionary-properties.js
+++ b/deps/v8/test/mjsunit/compiler/materialize-dictionary-properties.js
@@ -12,6 +12,7 @@ function f() {
return o ? 1 : 0;
}
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/materialize-mutable-heap-number.js b/deps/v8/test/mjsunit/compiler/materialize-mutable-heap-number.js
index b6b99afcf4..c8f85aa0ad 100644
--- a/deps/v8/test/mjsunit/compiler/materialize-mutable-heap-number.js
+++ b/deps/v8/test/mjsunit/compiler/materialize-mutable-heap-number.js
@@ -16,6 +16,7 @@ function f() {
return o.x + 0.25;
}
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/math-ceil.js b/deps/v8/test/mjsunit/compiler/math-ceil.js
index f91348b4d2..8caa184e45 100644
--- a/deps/v8/test/mjsunit/compiler/math-ceil.js
+++ b/deps/v8/test/mjsunit/compiler/math-ceil.js
@@ -14,6 +14,7 @@
return Object.is(-0, Math.ceil(x));
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(1.5));
assertTrue(foo(0.5));
%OptimizeFunctionOnNextCall(foo);
@@ -31,6 +32,7 @@
return Object.is(NaN, Math.ceil(x));
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(1.5));
assertTrue(foo(NaN));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/math-floor-global.js b/deps/v8/test/mjsunit/compiler/math-floor-global.js
index 9ee649cb2d..e5761e33e6 100644
--- a/deps/v8/test/mjsunit/compiler/math-floor-global.js
+++ b/deps/v8/test/mjsunit/compiler/math-floor-global.js
@@ -34,6 +34,7 @@ var test_id = 0;
function testFloor(expect, input) {
var test = new Function('n',
'"' + (test_id++) + '";return flo(n)');
+ %PrepareFunctionForOptimization(test);
assertEquals(expect, test(input));
assertEquals(expect, test(input));
assertEquals(expect, test(input));
@@ -59,6 +60,7 @@ function test() {
function ifloor(x) {
return 1 / Math.floor(x);
}
+ %PrepareFunctionForOptimization(ifloor);
assertEquals(-Infinity, ifloor(-0));
assertEquals(-Infinity, ifloor(-0));
assertEquals(-Infinity, ifloor(-0));
@@ -155,6 +157,7 @@ function floorsum(i, n) {
}
return ret;
}
+%PrepareFunctionForOptimization(floorsum);
assertEquals(-0, floorsum(1, -0));
%OptimizeFunctionOnNextCall(floorsum);
// The optimized function will deopt. Run it with enough iterations to try
diff --git a/deps/v8/test/mjsunit/compiler/math-floor-local.js b/deps/v8/test/mjsunit/compiler/math-floor-local.js
index 5ebe90b705..7444363d5f 100644
--- a/deps/v8/test/mjsunit/compiler/math-floor-local.js
+++ b/deps/v8/test/mjsunit/compiler/math-floor-local.js
@@ -34,6 +34,7 @@ function testFloor(expect, input) {
var test = new Function('n',
'"' + (test_id++) +
'";var f = Math.floor; return f(n)');
+ %PrepareFunctionForOptimization(test);
assertEquals(expect, test(input));
assertEquals(expect, test(input));
assertEquals(expect, test(input));
@@ -59,6 +60,7 @@ function test() {
function ifloor(x) {
return 1 / Math.floor(x);
}
+ %PrepareFunctionForOptimization(ifloor);
assertEquals(-Infinity, ifloor(-0));
assertEquals(-Infinity, ifloor(-0));
assertEquals(-Infinity, ifloor(-0));
@@ -155,6 +157,7 @@ function floorsum(i, n) {
}
return ret;
}
+%PrepareFunctionForOptimization(floorsum);
assertEquals(-0, floorsum(1, -0));
%OptimizeFunctionOnNextCall(floorsum);
// The optimized function will deopt. Run it with enough iterations to try
diff --git a/deps/v8/test/mjsunit/compiler/math-imul.js b/deps/v8/test/mjsunit/compiler/math-imul.js
index 1de18a6a2d..bb3d61a9d7 100644
--- a/deps/v8/test/mjsunit/compiler/math-imul.js
+++ b/deps/v8/test/mjsunit/compiler/math-imul.js
@@ -8,6 +8,7 @@
(function() {
function foo() { return Math.imul(); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo());
assertEquals(0, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -18,6 +19,7 @@
(function() {
function foo(x) { return Math.imul(x); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(1));
assertEquals(0, foo(2));
%OptimizeFunctionOnNextCall(foo);
@@ -28,11 +30,13 @@
(function() {
function foo(x, y) { return Math.imul(x, y); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(null, 1));
assertEquals(0, foo(2, undefined));
%OptimizeFunctionOnNextCall(foo);
assertEquals(0, foo(null, 1));
assertEquals(0, foo(2, undefined));
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(0, foo(null, 1));
assertEquals(0, foo(2, undefined));
@@ -43,6 +47,7 @@
(function() {
function foo(x, y) { return Math.imul(x|0, y|0); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(1, 1));
assertEquals(2, foo(2, 1));
%OptimizeFunctionOnNextCall(foo);
@@ -55,6 +60,7 @@
(function() {
function foo(x, y) { return Math.imul(x>>>0, y>>>0); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(1, 1));
assertEquals(2, foo(2, 1));
%OptimizeFunctionOnNextCall(foo);
@@ -67,6 +73,7 @@
(function() {
function foo(x, y) { return Math.imul(x, y); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(1.1, 1.1));
assertEquals(2, foo(2.1, 1.1));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/math-max.js b/deps/v8/test/mjsunit/compiler/math-max.js
index 350bdfba88..ce3d43dde2 100644
--- a/deps/v8/test/mjsunit/compiler/math-max.js
+++ b/deps/v8/test/mjsunit/compiler/math-max.js
@@ -14,6 +14,7 @@
return Object.is(-0, Math.max(1, x))
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(-0));
assertFalse(foo(-1));
%OptimizeFunctionOnNextCall(foo);
@@ -30,6 +31,7 @@
return Object.is(-0, Math.max(0, x))
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(-0));
assertFalse(foo(-1));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/math-min.js b/deps/v8/test/mjsunit/compiler/math-min.js
index 882103984d..0fedb493a6 100644
--- a/deps/v8/test/mjsunit/compiler/math-min.js
+++ b/deps/v8/test/mjsunit/compiler/math-min.js
@@ -14,6 +14,7 @@
return Object.is(-0, Math.min(-1, x))
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(-0));
assertFalse(foo(-1));
%OptimizeFunctionOnNextCall(foo);
@@ -30,6 +31,7 @@
return Object.is(+0, Math.min(-0, x))
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(-0));
assertFalse(foo(-1));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/math-mul.js b/deps/v8/test/mjsunit/compiler/math-mul.js
index a391b445fe..0ac620d82c 100644
--- a/deps/v8/test/mjsunit/compiler/math-mul.js
+++ b/deps/v8/test/mjsunit/compiler/math-mul.js
@@ -7,12 +7,14 @@
// For TurboFan, make sure we can eliminate the -0 return value check
// by recognizing a constant value.
function gotaconstant(y) { return 15 * y; }
+%PrepareFunctionForOptimization(gotaconstant);
assertEquals(45, gotaconstant(3));
gotaconstant(3);
%OptimizeFunctionOnNextCall(gotaconstant);
gotaconstant(3);
function gotaconstant_truncated(x, y) { return x * y | 0; }
+%PrepareFunctionForOptimization(gotaconstant_truncated);
assertEquals(45, gotaconstant_truncated(3, 15));
gotaconstant_truncated(3, 15);
%OptimizeFunctionOnNextCall(gotaconstant_truncated);
@@ -20,6 +22,7 @@ gotaconstant_truncated(3, 15);
function test(x, y) { return x * y; }
+%PrepareFunctionForOptimization(test);
assertEquals(12, test(3, 4));
assertEquals(16, test(4, 4));
@@ -39,6 +42,7 @@ assertEquals(SMI_MAX + SMI_MAX + SMI_MAX, test(SMI_MAX, 3));
// Verify that strength reduction will reduce the -0 check quite a bit
// if we have a negative integer constant.
function negtest(y) { return -3 * y; }
+%PrepareFunctionForOptimization(negtest);
assertEquals(-12, negtest(4));
assertEquals(-12, negtest(4));
%OptimizeFunctionOnNextCall(negtest);
diff --git a/deps/v8/test/mjsunit/compiler/math-round.js b/deps/v8/test/mjsunit/compiler/math-round.js
index c42bf8f2a0..c0715c977b 100644
--- a/deps/v8/test/mjsunit/compiler/math-round.js
+++ b/deps/v8/test/mjsunit/compiler/math-round.js
@@ -14,6 +14,7 @@
return Object.is(-0, Math.round(x));
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(1.5));
assertTrue(foo(0.5));
%OptimizeFunctionOnNextCall(foo);
@@ -31,6 +32,7 @@
return Object.is(NaN, Math.round(x));
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(1.5));
assertTrue(foo(NaN));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/math-sign.js b/deps/v8/test/mjsunit/compiler/math-sign.js
index 0fff0982df..8923f8ddf2 100644
--- a/deps/v8/test/mjsunit/compiler/math-sign.js
+++ b/deps/v8/test/mjsunit/compiler/math-sign.js
@@ -9,6 +9,7 @@ function signInt32(i) {
return Math.sign(i);
}
+%PrepareFunctionForOptimization(signInt32);
signInt32(0);
signInt32(2);
%OptimizeFunctionOnNextCall(signInt32);
@@ -27,6 +28,7 @@ function signFloat64(i) {
return Math.sign(+i);
}
+%PrepareFunctionForOptimization(signFloat64);
signFloat64(0.1);
signFloat64(-0.1);
%OptimizeFunctionOnNextCall(signFloat64);
diff --git a/deps/v8/test/mjsunit/compiler/math-trunc.js b/deps/v8/test/mjsunit/compiler/math-trunc.js
index e5cc523bc0..955bd5fa2c 100644
--- a/deps/v8/test/mjsunit/compiler/math-trunc.js
+++ b/deps/v8/test/mjsunit/compiler/math-trunc.js
@@ -14,6 +14,7 @@
return Object.is(-0, Math.trunc(x));
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(1.5));
assertTrue(foo(0.5));
%OptimizeFunctionOnNextCall(foo);
@@ -31,6 +32,7 @@
return Object.is(NaN, Math.trunc(x));
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(1.5));
assertTrue(foo(NaN));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/minus-zero.js b/deps/v8/test/mjsunit/compiler/minus-zero.js
index 23639dfcc3..b984bb4dfc 100644
--- a/deps/v8/test/mjsunit/compiler/minus-zero.js
+++ b/deps/v8/test/mjsunit/compiler/minus-zero.js
@@ -31,6 +31,7 @@ function add(x, y) {
return x + y;
}
+%PrepareFunctionForOptimization(add);
assertEquals(0, add(0, 0));
assertEquals(0, add(0, 0));
%OptimizeFunctionOnNextCall(add);
@@ -41,6 +42,7 @@ function testsin() {
assertEquals(-0, Math.sin(-0));
}
+%PrepareFunctionForOptimization(testsin);
testsin();
testsin();
%OptimizeFunctionOnNextCall(testsin);
@@ -51,6 +53,7 @@ function testfloor() {
assertEquals(-0, Math.floor(-0));
}
+%PrepareFunctionForOptimization(testfloor);
testfloor();
testfloor();
%OptimizeFunctionOnNextCall(testfloor);
@@ -63,6 +66,7 @@ function add(a, b) {
return a + b;
}
+%PrepareFunctionForOptimization(add);
assertEquals(1, 1/add(double_one, 0));
assertEquals(1, 1/add(0, double_one));
%OptimizeFunctionOnNextCall(add);
diff --git a/deps/v8/test/mjsunit/compiler/mul-div-52bit.js b/deps/v8/test/mjsunit/compiler/mul-div-52bit.js
index 46a5d05a9f..c74be69978 100644
--- a/deps/v8/test/mjsunit/compiler/mul-div-52bit.js
+++ b/deps/v8/test/mjsunit/compiler/mul-div-52bit.js
@@ -46,6 +46,7 @@ function nonPowerOfTwoDiv(a, b) {
}
function test(fn, a, b, sets) {
+ %PrepareFunctionForOptimization(fn);
const expected = fn(a, b);
fn(1, 2);
fn(0, 0);
diff --git a/deps/v8/test/mjsunit/compiler/multiply-add.js b/deps/v8/test/mjsunit/compiler/multiply-add.js
index 2b4304e845..faac9455c1 100644
--- a/deps/v8/test/mjsunit/compiler/multiply-add.js
+++ b/deps/v8/test/mjsunit/compiler/multiply-add.js
@@ -40,6 +40,7 @@ function h(a, b, c, d) {
return a * b + c * d;
}
+%PrepareFunctionForOptimization(f);
assertEquals(5, f(1, 2, 3));
assertEquals(5, f(1, 2, 3));
%OptimizeFunctionOnNextCall(f);
@@ -47,23 +48,28 @@ assertEquals(5, f(1, 2, 3));
assertEquals("2foo", f(1, 2, "foo"));
assertEquals(5.41, f(1.1, 2.1, 3.1));
assertEquals(5.41, f(1.1, 2.1, 3.1));
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
assertEquals(5.41, f(1.1, 2.1, 3.1));
+%PrepareFunctionForOptimization(g);
assertEquals(7, g(1, 2, 3));
assertEquals(7, g(1, 2, 3));
%OptimizeFunctionOnNextCall(g);
assertEquals(7, g(1, 2, 3));
assertEquals(8.36, g(1.1, 2.2, 3.3));
assertEquals(8.36, g(1.1, 2.2, 3.3));
+%PrepareFunctionForOptimization(g);
%OptimizeFunctionOnNextCall(g);
assertEquals(8.36, g(1.1, 2.2, 3.3));
+%PrepareFunctionForOptimization(h);
assertEquals(14, h(1, 2, 3, 4));
assertEquals(14, h(1, 2, 3, 4));
%OptimizeFunctionOnNextCall(h);
assertEquals(14, h(1, 2, 3, 4));
assertEquals(15.02, h(1.1, 2.1, 3.1, 4.1));
assertEquals(15.02, h(1.1, 2.1, 3.1, 4.1));
+%PrepareFunctionForOptimization(h);
%OptimizeFunctionOnNextCall(h);
assertEquals(15.02, h(1.1, 2.1, 3.1, 4.1));
diff --git a/deps/v8/test/mjsunit/compiler/multiply-sub.js b/deps/v8/test/mjsunit/compiler/multiply-sub.js
index 4793181d47..c9a803e951 100644
--- a/deps/v8/test/mjsunit/compiler/multiply-sub.js
+++ b/deps/v8/test/mjsunit/compiler/multiply-sub.js
@@ -40,16 +40,19 @@ function h(a, b, c, d) {
return a * b - c * d;
}
+%PrepareFunctionForOptimization(f);
assertEquals(-5.41, f(1.1, 2.1, 3.1));
assertEquals(-5.41, f(1.1, 2.1, 3.1));
%OptimizeFunctionOnNextCall(f);
assertEquals(-5.41, f(1.1, 2.1, 3.1));
+%PrepareFunctionForOptimization(g);
assertEquals(8.36, g(2.2, 3.3, -1.1));
assertEquals(8.36, g(2.2, 3.3, -1.1));
%OptimizeFunctionOnNextCall(g);
assertEquals(8.36, g(2.2, 3.3, -1.1));
+%PrepareFunctionForOptimization(h);
assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
assertEquals(-1.5, h(1.5, 3.0, 12, 0.5));
%OptimizeFunctionOnNextCall(h);
diff --git a/deps/v8/test/mjsunit/compiler/native-context-specialization-hole-check.js b/deps/v8/test/mjsunit/compiler/native-context-specialization-hole-check.js
index 7f4db56483..4d7505a968 100644
--- a/deps/v8/test/mjsunit/compiler/native-context-specialization-hole-check.js
+++ b/deps/v8/test/mjsunit/compiler/native-context-specialization-hole-check.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax --opt --no-always-opt
+// Flags: --allow-natives-syntax --opt --no-always-opt --turbo-inlining
if (isNeverOptimizeLiteMode()) {
print("Warning: skipping test that requires optimization in Lite mode.");
@@ -42,6 +42,7 @@ function f() {
function g() {
f();
}
+%PrepareFunctionForOptimization(g);
g();
g();
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/native-context-specialization-string-concat.js b/deps/v8/test/mjsunit/compiler/native-context-specialization-string-concat.js
index 24fe4b1753..0df3835c5b 100644
--- a/deps/v8/test/mjsunit/compiler/native-context-specialization-string-concat.js
+++ b/deps/v8/test/mjsunit/compiler/native-context-specialization-string-concat.js
@@ -27,6 +27,7 @@ function test(arg) {
d = '"' + foo + arg + bar + '"';
}
+%PrepareFunctionForOptimization(test);
test('boo');
%OptimizeFunctionOnNextCall(test);
test('baa');
diff --git a/deps/v8/test/mjsunit/compiler/new-cons-string.js b/deps/v8/test/mjsunit/compiler/new-cons-string.js
index 7f6da7262a..0d5470ddac 100644
--- a/deps/v8/test/mjsunit/compiler/new-cons-string.js
+++ b/deps/v8/test/mjsunit/compiler/new-cons-string.js
@@ -9,6 +9,7 @@
return "abcdefghijklm" + s;
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(isOneByteString(foo("0")));
assertTrue(isOneByteString(foo("0")));
%OptimizeFunctionOnNextCall(foo);
@@ -20,6 +21,7 @@
return s + "abcdefghijklm";
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(isOneByteString(foo("0")));
assertTrue(isOneByteString(foo("0")));
%OptimizeFunctionOnNextCall(foo);
@@ -31,6 +33,7 @@
return "abcdefghijklm" + s;
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(isOneByteString(foo("\u1234")));
assertFalse(isOneByteString(foo("\u1234")));
%OptimizeFunctionOnNextCall(foo);
@@ -42,6 +45,7 @@
return s + "abcdefghijklm";
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(isOneByteString(foo("\u1234")));
assertFalse(isOneByteString(foo("\u1234")));
%OptimizeFunctionOnNextCall(foo);
@@ -53,6 +57,7 @@
return "abcdefghijkl\u1234" + s;
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(isOneByteString(foo("0")));
assertFalse(isOneByteString(foo("0")));
%OptimizeFunctionOnNextCall(foo);
@@ -64,6 +69,7 @@
return s + "abcdefghijkl\u1234";
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(isOneByteString(foo("0")));
assertFalse(isOneByteString(foo("0")));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-abs.js b/deps/v8/test/mjsunit/compiler/number-abs.js
index 9eb8ab5bb5..8e976132cf 100644
--- a/deps/v8/test/mjsunit/compiler/number-abs.js
+++ b/deps/v8/test/mjsunit/compiler/number-abs.js
@@ -13,6 +13,7 @@
return 1 / Math.abs(x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(Infinity, foo(-0));
assertEquals(Infinity, foo(-0));
%OptimizeFunctionOnNextCall(foo);
@@ -26,6 +27,7 @@
return Math.abs(x * -2);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(-1));
assertEquals(4, foo(-2));
%OptimizeFunctionOnNextCall(foo);
@@ -45,6 +47,7 @@
return Math.abs(Math.max(x * -2, 0));
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(-1));
assertEquals(4, foo(-2));
%OptimizeFunctionOnNextCall(foo);
@@ -64,6 +67,7 @@
return Math.abs(Math.min(x * -2, 2 ** 32));
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(-1));
assertEquals(4, foo(-2));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-add.js b/deps/v8/test/mjsunit/compiler/number-add.js
index 61e6495c52..ba5ab172e0 100644
--- a/deps/v8/test/mjsunit/compiler/number-add.js
+++ b/deps/v8/test/mjsunit/compiler/number-add.js
@@ -26,6 +26,7 @@
return foo(x, -1);
}
+ %PrepareFunctionForOptimization(bar);
assertEquals(0, bar(1));
assertEquals(1, bar(2));
%OptimizeFunctionOnNextCall(bar);
@@ -55,6 +56,7 @@
return baz(1) | 0;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo());
assertEquals(2, foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-ceil.js b/deps/v8/test/mjsunit/compiler/number-ceil.js
index ce87cd0fc0..a82dd4cf34 100644
--- a/deps/v8/test/mjsunit/compiler/number-ceil.js
+++ b/deps/v8/test/mjsunit/compiler/number-ceil.js
@@ -10,6 +10,7 @@
return Math.abs(Math.ceil(x * -2));
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(1));
assertEquals(4, foo(2));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-comparison-truncations.js b/deps/v8/test/mjsunit/compiler/number-comparison-truncations.js
index 33abf6b913..8ca710a5ef 100644
--- a/deps/v8/test/mjsunit/compiler/number-comparison-truncations.js
+++ b/deps/v8/test/mjsunit/compiler/number-comparison-truncations.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --allow-natives-syntax --opt
+// Flags: --allow-natives-syntax --opt --turbo-inlining
// Test that SpeculativeNumberEqual[SignedSmall] properly passes the
// kIdentifyZeros truncation.
@@ -12,6 +12,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0, 1));
assertEquals(1, foo(1, 1));
assertEquals(1, foo(1, 2));
@@ -39,6 +40,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0, 1));
assertEquals(1, foo(1, 1));
assertEquals(1, foo(1, 2));
@@ -61,6 +63,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(1, -1));
assertEquals(1, foo(1, 1));
assertEquals(1, foo(1, 2));
@@ -88,6 +91,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(1, -1));
assertEquals(1, foo(1, 1));
assertEquals(1, foo(1, 2));
@@ -110,6 +114,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0, 1));
assertEquals(1, foo(1, 1));
assertEquals(1, foo(1, 2));
@@ -137,6 +142,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0, 1));
assertEquals(1, foo(1, 1));
assertEquals(1, foo(1, 2));
diff --git a/deps/v8/test/mjsunit/compiler/number-constructor-deopt.js b/deps/v8/test/mjsunit/compiler/number-constructor-deopt.js
index edffc9ec53..33a13bd5bc 100644
--- a/deps/v8/test/mjsunit/compiler/number-constructor-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/number-constructor-deopt.js
@@ -25,6 +25,7 @@ function f() {
}
}
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/number-divide.js b/deps/v8/test/mjsunit/compiler/number-divide.js
index c4cc8fa881..1c7710c1f8 100644
--- a/deps/v8/test/mjsunit/compiler/number-divide.js
+++ b/deps/v8/test/mjsunit/compiler/number-divide.js
@@ -21,6 +21,7 @@
return bar(x) | 0;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(1));
assertEquals(1, foo(2));
assertEquals(2, foo(3));
@@ -50,6 +51,7 @@
return bar(x) | 0;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(1));
assertEquals(1, foo(2));
assertEquals(2, foo(3));
@@ -68,6 +70,7 @@
function foo(x) { return (x | 0) / 2; }
// Warmup with proper int32 divisions.
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(2));
assertEquals(2, foo(4));
%OptimizeFunctionOnNextCall(foo);
@@ -79,6 +82,7 @@
assertUnoptimized(foo);
// Try again with the new feedback, and now it should stay optimized.
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(4, foo(8));
assertOptimized(foo);
@@ -92,6 +96,7 @@
function foo(x, y) { return x / y; }
// Warmup with proper int32 divisions.
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(4, 2));
assertEquals(2, foo(8, 4));
%OptimizeFunctionOnNextCall(foo);
@@ -103,6 +108,7 @@
assertUnoptimized(foo);
// Try again with the new feedback, and now it should stay optimized.
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(2, foo(2, 1));
assertOptimized(foo);
@@ -116,6 +122,7 @@
function foo(x, y) { return x / y; }
// Warmup with proper int32 divisions.
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(4, 2));
assertEquals(2, foo(8, 4));
%OptimizeFunctionOnNextCall(foo);
@@ -127,6 +134,7 @@
assertUnoptimized(foo);
// Try again with the new feedback, and now it should stay optimized.
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(2, foo(2, 1));
assertOptimized(foo);
@@ -140,6 +148,7 @@
function foo(x, y) { return x / y; }
// Warmup with proper int32 divisions.
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(4, 2));
assertEquals(2, foo(8, 4));
%OptimizeFunctionOnNextCall(foo);
@@ -151,6 +160,7 @@
assertUnoptimized(foo);
// Try again with the new feedback, and now it should stay optimized.
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(2, foo(2, 1));
assertOptimized(foo);
@@ -164,6 +174,7 @@
function foo(s) { return s.length / 2; }
// Warmup with proper uint32 divisions.
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo("ab".repeat(1)));
assertEquals(2, foo("ab".repeat(2)));
%OptimizeFunctionOnNextCall(foo);
@@ -175,6 +186,7 @@
assertUnoptimized(foo);
// Try again with the new feedback, and now it should stay optimized.
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(4, foo("ab".repeat(4)));
assertOptimized(foo);
@@ -188,6 +200,7 @@
function foo(x, y) { return (x >>> 0) / (y >>> 0); }
// Warmup with proper uint32 divisions.
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(4, 2));
assertEquals(2, foo(8, 4));
%OptimizeFunctionOnNextCall(foo);
@@ -199,6 +212,7 @@
assertUnoptimized(foo);
// Try again with the new feedback, and now it should stay optimized.
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals(2, foo(2, 1));
assertOptimized(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-floor.js b/deps/v8/test/mjsunit/compiler/number-floor.js
index 180b89e559..ede0730ada 100644
--- a/deps/v8/test/mjsunit/compiler/number-floor.js
+++ b/deps/v8/test/mjsunit/compiler/number-floor.js
@@ -10,6 +10,7 @@
return Math.abs(Math.floor(x * -2));
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(1));
assertEquals(4, foo(2));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-isfinite-inl.js b/deps/v8/test/mjsunit/compiler/number-isfinite-inl.js
index 2948fe0953..54e6b2c0f8 100644
--- a/deps/v8/test/mjsunit/compiler/number-isfinite-inl.js
+++ b/deps/v8/test/mjsunit/compiler/number-isfinite-inl.js
@@ -22,6 +22,7 @@ function test(f) {
assertFalse(Number.isFinite(-1 / 0));
}
+%PrepareFunctionForOptimization(test);
test();
test();
%OptimizeFunctionOnNextCall(test);
@@ -48,6 +49,7 @@ function test2(f) {
assertFalse(Number.isFinite(-1 / 0));
}
+%PrepareFunctionForOptimization(test2);
test2();
test2();
%OptimizeFunctionOnNextCall(test2);
diff --git a/deps/v8/test/mjsunit/compiler/number-isfinite.js b/deps/v8/test/mjsunit/compiler/number-isfinite.js
index 03493ce69e..b28be7a3d7 100644
--- a/deps/v8/test/mjsunit/compiler/number-isfinite.js
+++ b/deps/v8/test/mjsunit/compiler/number-isfinite.js
@@ -26,6 +26,7 @@ function f(x) {
return Number.isFinite(+x);
}
+%PrepareFunctionForOptimization(f);
test(f);
test(f);
%OptimizeFunctionOnNextCall(f);
@@ -56,6 +57,7 @@ function f2(x) {
return Number.isFinite(x);
}
+%PrepareFunctionForOptimization(f2);
test2(f2);
test2(f2);
%OptimizeFunctionOnNextCall(f2);
diff --git a/deps/v8/test/mjsunit/compiler/number-isinteger-inl.js b/deps/v8/test/mjsunit/compiler/number-isinteger-inl.js
index 8379fb8147..6f3bbd6e87 100644
--- a/deps/v8/test/mjsunit/compiler/number-isinteger-inl.js
+++ b/deps/v8/test/mjsunit/compiler/number-isinteger-inl.js
@@ -23,6 +23,7 @@ function test() {
assertFalse(Number.isInteger(Number.EPSILON));
}
+%PrepareFunctionForOptimization(test);
test();
test();
%OptimizeFunctionOnNextCall(test);
@@ -48,6 +49,7 @@ function test2() {
assertFalse(Number.isInteger(Number.EPSILON));
}
+%PrepareFunctionForOptimization(test2);
test2();
test2();
%OptimizeFunctionOnNextCall(test2);
diff --git a/deps/v8/test/mjsunit/compiler/number-isinteger.js b/deps/v8/test/mjsunit/compiler/number-isinteger.js
index aae172ea06..b3a45d9094 100644
--- a/deps/v8/test/mjsunit/compiler/number-isinteger.js
+++ b/deps/v8/test/mjsunit/compiler/number-isinteger.js
@@ -27,6 +27,7 @@ function f(x) {
return Number.isInteger(+x);
}
+%PrepareFunctionForOptimization(f);
test(f);
test(f);
%OptimizeFunctionOnNextCall(f);
@@ -56,6 +57,7 @@ function f2(x) {
return Number.isInteger(x);
}
+%PrepareFunctionForOptimization(f2);
test2(f2);
test2(f2);
%OptimizeFunctionOnNextCall(f2);
diff --git a/deps/v8/test/mjsunit/compiler/number-isnan.js b/deps/v8/test/mjsunit/compiler/number-isnan.js
index fb6bb6d741..aaa9acb909 100644
--- a/deps/v8/test/mjsunit/compiler/number-isnan.js
+++ b/deps/v8/test/mjsunit/compiler/number-isnan.js
@@ -22,6 +22,7 @@ function f(x) {
return Number.isNaN(+x);
}
+%PrepareFunctionForOptimization(f);
test(f);
test(f);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/number-issafeinteger.js b/deps/v8/test/mjsunit/compiler/number-issafeinteger.js
index b705e95ed5..26ac38ea04 100644
--- a/deps/v8/test/mjsunit/compiler/number-issafeinteger.js
+++ b/deps/v8/test/mjsunit/compiler/number-issafeinteger.js
@@ -43,6 +43,7 @@ function test(f) {
// Check that the NumberIsSafeInteger simplified operator in
// TurboFan does the right thing.
function NumberIsSafeInteger(x) { return Number.isSafeInteger(+x); }
+%PrepareFunctionForOptimization(NumberIsSafeInteger);
test(NumberIsSafeInteger);
test(NumberIsSafeInteger);
%OptimizeFunctionOnNextCall(NumberIsSafeInteger);
@@ -52,6 +53,7 @@ test(NumberIsSafeInteger);
// TurboFan does the right thing as well (i.e. when TurboFan
// is not able to tell statically that the inputs are numbers).
function ObjectIsSafeInteger(x) { return Number.isSafeInteger(x); }
+%PrepareFunctionForOptimization(ObjectIsSafeInteger);
test(ObjectIsSafeInteger);
test(ObjectIsSafeInteger);
%OptimizeFunctionOnNextCall(ObjectIsSafeInteger);
diff --git a/deps/v8/test/mjsunit/compiler/number-max.js b/deps/v8/test/mjsunit/compiler/number-max.js
index 0e9b84fb39..35a29faccf 100644
--- a/deps/v8/test/mjsunit/compiler/number-max.js
+++ b/deps/v8/test/mjsunit/compiler/number-max.js
@@ -11,6 +11,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(2));
assertEquals(1, foo(-1));
%OptimizeFunctionOnNextCall(foo);
@@ -29,6 +30,7 @@
return Math.max(x - 1, x + 1);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(-Math.pow(2, 31) + 1, foo(-Math.pow(2, 31)));
assertEquals(Math.pow(2, 31), foo(Math.pow(2, 31) - 1));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-min.js b/deps/v8/test/mjsunit/compiler/number-min.js
index 6c7c62d773..da66026df7 100644
--- a/deps/v8/test/mjsunit/compiler/number-min.js
+++ b/deps/v8/test/mjsunit/compiler/number-min.js
@@ -11,6 +11,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(1));
assertEquals(1, foo(2));
%OptimizeFunctionOnNextCall(foo);
@@ -29,6 +30,7 @@
return Math.min(x - 1, x + 1);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(-Math.pow(2, 31) - 1, foo(-Math.pow(2, 31)));
assertEquals(Math.pow(2, 31) - 2, foo(Math.pow(2, 31) - 1));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-modulus.js b/deps/v8/test/mjsunit/compiler/number-modulus.js
index 0925aa0da3..e8f86e7fda 100644
--- a/deps/v8/test/mjsunit/compiler/number-modulus.js
+++ b/deps/v8/test/mjsunit/compiler/number-modulus.js
@@ -13,6 +13,7 @@
return (x * -2) % (2 ** 32) === 0;
}
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(2));
assertFalse(foo(1));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-multiply.js b/deps/v8/test/mjsunit/compiler/number-multiply.js
index 5b644974ec..07e1f846ad 100644
--- a/deps/v8/test/mjsunit/compiler/number-multiply.js
+++ b/deps/v8/test/mjsunit/compiler/number-multiply.js
@@ -15,6 +15,7 @@
return Object.is(-0, bar(-1e-308));
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -27,6 +28,7 @@
return 0 * Math.round(x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(0.1));
assertEquals(-0, foo(-0.1));
assertEquals(NaN, foo(NaN));
@@ -49,6 +51,7 @@
return Math.min(x * y, 0);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo(1, 0));
assertEquals(-0, foo(1, -0));
assertEquals(NaN, foo(NaN, -0));
diff --git a/deps/v8/test/mjsunit/compiler/number-round.js b/deps/v8/test/mjsunit/compiler/number-round.js
index 9aec7f7a12..4a9eb9acbf 100644
--- a/deps/v8/test/mjsunit/compiler/number-round.js
+++ b/deps/v8/test/mjsunit/compiler/number-round.js
@@ -10,6 +10,7 @@
return Math.abs(Math.round(x * -2));
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(1));
assertEquals(4, foo(2));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-subtract.js b/deps/v8/test/mjsunit/compiler/number-subtract.js
index cb3e1c7e70..56f028c1a3 100644
--- a/deps/v8/test/mjsunit/compiler/number-subtract.js
+++ b/deps/v8/test/mjsunit/compiler/number-subtract.js
@@ -27,6 +27,7 @@
return baz(42) | 0;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(0, foo());
assertEquals(0, foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-toboolean.js b/deps/v8/test/mjsunit/compiler/number-toboolean.js
index 02b30b3ed6..372031cdd0 100644
--- a/deps/v8/test/mjsunit/compiler/number-toboolean.js
+++ b/deps/v8/test/mjsunit/compiler/number-toboolean.js
@@ -12,6 +12,7 @@
return 0;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(1));
assertEquals(1, foo(2));
%OptimizeFunctionOnNextCall(foo);
@@ -33,6 +34,7 @@
return 0;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(-1));
assertEquals(1, foo(-2));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/number-trunc.js b/deps/v8/test/mjsunit/compiler/number-trunc.js
index aa7d02c20f..1cc005d558 100644
--- a/deps/v8/test/mjsunit/compiler/number-trunc.js
+++ b/deps/v8/test/mjsunit/compiler/number-trunc.js
@@ -10,6 +10,7 @@
return Math.abs(Math.trunc(x * -2));
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(2, foo(1));
assertEquals(4, foo(2));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/object-constructor.js b/deps/v8/test/mjsunit/compiler/object-constructor.js
index 162416fd57..71e51ee2ab 100644
--- a/deps/v8/test/mjsunit/compiler/object-constructor.js
+++ b/deps/v8/test/mjsunit/compiler/object-constructor.js
@@ -14,6 +14,7 @@
function foo(a) {
return Object(a.bar)();
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(new A));
assertEquals(undefined, foo(new A));
%OptimizeFunctionOnNextCall(foo);
@@ -25,6 +26,7 @@
function foo() {
return Object("a");
}
+ %PrepareFunctionForOptimization(foo);
assertEquals('object', typeof foo());
assertEquals('object', typeof foo());
%OptimizeFunctionOnNextCall(foo);
@@ -41,6 +43,7 @@
function foo() {
return new A(1, 2, 3);
}
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertInstanceof(foo(), Object);
assertInstanceof(foo(), A);
diff --git a/deps/v8/test/mjsunit/compiler/object-create.js b/deps/v8/test/mjsunit/compiler/object-create.js
index bd366fe0b0..253024a675 100644
--- a/deps/v8/test/mjsunit/compiler/object-create.js
+++ b/deps/v8/test/mjsunit/compiler/object-create.js
@@ -6,6 +6,7 @@
(function TestWithNullPrototype() {
function f() { return Object.create(null); }
+ %PrepareFunctionForOptimization(f);
f();
%OptimizeFunctionOnNextCall(f);
assertEquals(undefined, f().foo);
@@ -14,6 +15,7 @@
(function TestWithCustomPrototype() {
const x = {foo: 42}; // This must be defined here for context specialization.
function f() { return Object.create(x); }
+ %PrepareFunctionForOptimization(f);
f();
%OptimizeFunctionOnNextCall(f);
assertEquals(42, f().foo);
@@ -21,6 +23,7 @@
(function TestWithObjectPrototype() {
function f() { return Object.create(Object.prototype); }
+ %PrepareFunctionForOptimization(f);
f();
%OptimizeFunctionOnNextCall(f);
assertEquals("[object Object]", f().toString());
diff --git a/deps/v8/test/mjsunit/compiler/object-getprototypeof.js b/deps/v8/test/mjsunit/compiler/object-getprototypeof.js
index ac172dbeb2..8360a8df91 100644
--- a/deps/v8/test/mjsunit/compiler/object-getprototypeof.js
+++ b/deps/v8/test/mjsunit/compiler/object-getprototypeof.js
@@ -9,6 +9,7 @@ var object = Object.create(prototype);
function foo() { return Object.getPrototypeOf(object); }
+%PrepareFunctionForOptimization(foo);
assertSame(prototype, foo());
assertSame(prototype, foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/object-is.js b/deps/v8/test/mjsunit/compiler/object-is.js
index f89b73e9d8..1d7e927894 100644
--- a/deps/v8/test/mjsunit/compiler/object-is.js
+++ b/deps/v8/test/mjsunit/compiler/object-is.js
@@ -6,6 +6,7 @@
(function() {
function foo(o) { return Object.is(o, -0); }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(-0));
assertFalse(foo(0));
assertFalse(foo(NaN));
@@ -23,6 +24,7 @@
(function() {
function foo(o) { return Object.is(-0, o); }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(-0));
assertFalse(foo(0));
assertFalse(foo(NaN));
@@ -40,6 +42,7 @@
(function() {
function foo(o) { return Object.is(+o, -0); }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(-0));
assertFalse(foo(0));
assertFalse(foo(NaN));
@@ -51,6 +54,7 @@
(function() {
function foo(o) { return Object.is(-0, +o); }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(-0));
assertFalse(foo(0));
assertFalse(foo(NaN));
@@ -62,6 +66,7 @@
(function() {
function foo(o) { return Object.is(o, NaN); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(-0));
assertFalse(foo(0));
assertTrue(foo(NaN));
@@ -79,6 +84,7 @@
(function() {
function foo(o) { return Object.is(NaN, o); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(-0));
assertFalse(foo(0));
assertTrue(foo(NaN));
@@ -96,6 +102,7 @@
(function() {
function foo(o) { return Object.is(+o, NaN); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(-0));
assertFalse(foo(0));
assertTrue(foo(NaN));
@@ -107,6 +114,7 @@
(function() {
function foo(o) { return Object.is(NaN, +o); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(-0));
assertFalse(foo(0));
assertTrue(foo(NaN));
@@ -118,6 +126,7 @@
(function() {
function foo(o) { return Object.is(`${o}`, "foo"); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo("bar"));
assertTrue(foo("foo"));
%OptimizeFunctionOnNextCall(foo);
@@ -127,6 +136,7 @@
(function() {
function foo(o) { return Object.is(String(o), "foo"); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo("bar"));
assertTrue(foo("foo"));
%OptimizeFunctionOnNextCall(foo);
@@ -136,6 +146,7 @@
(function() {
function foo(o) { return Object.is(o, o); }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(-0));
assertTrue(foo(0));
assertTrue(foo(NaN));
@@ -153,6 +164,7 @@
(function() {
function foo(o) { return Object.is(o|0, 0); }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(0));
assertTrue(foo(-0));
assertTrue(foo(NaN));
@@ -167,6 +179,7 @@
(function() {
const s = Symbol();
function foo() { return Object.is(s, Symbol()); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/object-isprototypeof.js b/deps/v8/test/mjsunit/compiler/object-isprototypeof.js
index 284a4387d6..d8e3c3e796 100644
--- a/deps/v8/test/mjsunit/compiler/object-isprototypeof.js
+++ b/deps/v8/test/mjsunit/compiler/object-isprototypeof.js
@@ -8,6 +8,7 @@
(function() {
function foo(x, y) { return Object.prototype.isPrototypeOf.call(x, y); }
+ %PrepareFunctionForOptimization(foo);
assertThrows(() => foo(null, {}));
assertThrows(() => foo(undefined, {}));
assertThrows(() => foo(null, []));
@@ -43,6 +44,7 @@
function foo(x) { return A.prototype.isPrototypeOf(x); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo(0));
assertFalse(foo(""));
assertFalse(foo(null));
@@ -74,6 +76,7 @@
function foo() { return A.prototype.isPrototypeOf(0); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -86,6 +89,7 @@
function foo() { return A.prototype.isPrototypeOf(null); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -98,6 +102,7 @@
function foo() { return A.prototype.isPrototypeOf(undefined); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -112,6 +117,7 @@
function foo() { return A.prototype.isPrototypeOf(a); }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -124,6 +130,7 @@
function foo() { return A.prototype.isPrototypeOf(a); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -136,6 +143,7 @@
function foo() { return Array.prototype.isPrototypeOf(a); }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -146,6 +154,7 @@
function foo() { return Object.prototype.isPrototypeOf(a); }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo());
assertTrue(foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/opt-next-call-turbo.js b/deps/v8/test/mjsunit/compiler/opt-next-call-turbo.js
index eb8df4b50c..843b19775a 100644
--- a/deps/v8/test/mjsunit/compiler/opt-next-call-turbo.js
+++ b/deps/v8/test/mjsunit/compiler/opt-next-call-turbo.js
@@ -8,6 +8,7 @@ function foo() {
with ({ value:"fooed" }) { return value; }
}
+%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals("fooed", foo());
assertOptimized(foo);
@@ -16,6 +17,7 @@ function bar() {
with ({ value:"bared" }) { return value; }
}
+%PrepareFunctionForOptimization(bar);
assertEquals("bared", bar());
%OptimizeFunctionOnNextCall(bar);
assertEquals("bared", bar());
diff --git a/deps/v8/test/mjsunit/compiler/opt-next-call.js b/deps/v8/test/mjsunit/compiler/opt-next-call.js
index 2878efefe9..2e92dba26d 100644
--- a/deps/v8/test/mjsunit/compiler/opt-next-call.js
+++ b/deps/v8/test/mjsunit/compiler/opt-next-call.js
@@ -8,6 +8,7 @@ function foo() {
return "fooed";
}
+%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertEquals("fooed", foo());
assertOptimized(foo);
@@ -16,6 +17,7 @@ function bar() {
return "bared";
}
+%PrepareFunctionForOptimization(bar);
assertEquals("bared", bar());
%OptimizeFunctionOnNextCall(bar);
assertEquals("bared", bar());
diff --git a/deps/v8/test/mjsunit/compiler/optimize-bitnot.js b/deps/v8/test/mjsunit/compiler/optimize-bitnot.js
index 28315a4fe2..e129f8c069 100644
--- a/deps/v8/test/mjsunit/compiler/optimize-bitnot.js
+++ b/deps/v8/test/mjsunit/compiler/optimize-bitnot.js
@@ -31,6 +31,7 @@ function f(x) {
return ~~x;
}
+%PrepareFunctionForOptimization(f);
f(42);
f(42);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/optimized-closures.js b/deps/v8/test/mjsunit/compiler/optimized-closures.js
index 499e4d5e24..48d7816bcf 100644
--- a/deps/v8/test/mjsunit/compiler/optimized-closures.js
+++ b/deps/v8/test/mjsunit/compiler/optimized-closures.js
@@ -40,7 +40,8 @@ function f() {
return 42;
}
return x + y + h(y);
- }
+ };
+ %PrepareFunctionForOptimization(g);
g(0);
%OptimizeFunctionOnNextCall(g);
a[i] = g(i);
diff --git a/deps/v8/test/mjsunit/compiler/optimized-float32array-length.js b/deps/v8/test/mjsunit/compiler/optimized-float32array-length.js
index 6e08e4a57f..5144e68768 100644
--- a/deps/v8/test/mjsunit/compiler/optimized-float32array-length.js
+++ b/deps/v8/test/mjsunit/compiler/optimized-float32array-length.js
@@ -6,6 +6,7 @@
var a = new Float32Array(1);
function len(a) { return a.length; }
+%PrepareFunctionForOptimization(len);
assertEquals(1, len(a));
assertEquals(1, len(a));
%OptimizeFunctionOnNextCall(len);
diff --git a/deps/v8/test/mjsunit/compiler/optimized-float64array-length.js b/deps/v8/test/mjsunit/compiler/optimized-float64array-length.js
index 7d48d09c68..116a6246de 100644
--- a/deps/v8/test/mjsunit/compiler/optimized-float64array-length.js
+++ b/deps/v8/test/mjsunit/compiler/optimized-float64array-length.js
@@ -6,6 +6,7 @@
var a = new Float64Array(1);
function len(a) { return a.length; }
+%PrepareFunctionForOptimization(len);
assertEquals(1, len(a));
assertEquals(1, len(a));
%OptimizeFunctionOnNextCall(len);
diff --git a/deps/v8/test/mjsunit/compiler/optimized-for-in.js b/deps/v8/test/mjsunit/compiler/optimized-for-in.js
index ca17ee6a75..5af7caaef2 100644
--- a/deps/v8/test/mjsunit/compiler/optimized-for-in.js
+++ b/deps/v8/test/mjsunit/compiler/optimized-for-in.js
@@ -174,6 +174,7 @@ function m(t, deopt) {
function tryFunction(result, mkT, f) {
+ %PrepareFunctionForOptimization(f);
var d = {deopt: false};
assertEquals(result, f(mkT(), d));
assertEquals(result, f(mkT(), d));
diff --git a/deps/v8/test/mjsunit/compiler/optimized-function-calls.js b/deps/v8/test/mjsunit/compiler/optimized-function-calls.js
index c3e69d71f5..8f04538c53 100644
--- a/deps/v8/test/mjsunit/compiler/optimized-function-calls.js
+++ b/deps/v8/test/mjsunit/compiler/optimized-function-calls.js
@@ -48,6 +48,7 @@ delete object.x;
function call_f(o) {
return o.f();
}
+%PrepareFunctionForOptimization(call_f);
for (var i = 0; i < 5; i++) call_f(object);
%OptimizeFunctionOnNextCall(call_f);
call_f(object);
diff --git a/deps/v8/test/mjsunit/compiler/optimized-instanceof-1.js b/deps/v8/test/mjsunit/compiler/optimized-instanceof-1.js
index 242b4be772..76e7c86ad9 100644
--- a/deps/v8/test/mjsunit/compiler/optimized-instanceof-1.js
+++ b/deps/v8/test/mjsunit/compiler/optimized-instanceof-1.js
@@ -13,5 +13,6 @@ F[Symbol.hasInstance] = function(v) { return true };
Object.setPrototypeOf(F, proto);
function foo(x) { return x instanceof F };
+%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(foo(1));
diff --git a/deps/v8/test/mjsunit/compiler/optimized-instanceof-2.js b/deps/v8/test/mjsunit/compiler/optimized-instanceof-2.js
index 38a35b73f1..603f2d5200 100644
--- a/deps/v8/test/mjsunit/compiler/optimized-instanceof-2.js
+++ b/deps/v8/test/mjsunit/compiler/optimized-instanceof-2.js
@@ -8,6 +8,7 @@ function F() {}
var f = new F
function foo(x) { return x instanceof F };
+%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo(1));
diff --git a/deps/v8/test/mjsunit/compiler/optimized-int32array-length.js b/deps/v8/test/mjsunit/compiler/optimized-int32array-length.js
index 00bf8d12a4..ba27f1d387 100644
--- a/deps/v8/test/mjsunit/compiler/optimized-int32array-length.js
+++ b/deps/v8/test/mjsunit/compiler/optimized-int32array-length.js
@@ -6,6 +6,7 @@
var a = new Int32Array(1);
function len(a) { return a.length; }
+%PrepareFunctionForOptimization(len);
assertEquals(1, len(a));
assertEquals(1, len(a));
%OptimizeFunctionOnNextCall(len);
diff --git a/deps/v8/test/mjsunit/compiler/optimized-uint32array-length.js b/deps/v8/test/mjsunit/compiler/optimized-uint32array-length.js
index 3a88ed7d25..3d2f43292b 100644
--- a/deps/v8/test/mjsunit/compiler/optimized-uint32array-length.js
+++ b/deps/v8/test/mjsunit/compiler/optimized-uint32array-length.js
@@ -6,6 +6,7 @@
var a = new Uint32Array(1);
function len(a) { return a.length; }
+%PrepareFunctionForOptimization(len);
assertEquals(1, len(a));
assertEquals(1, len(a));
%OptimizeFunctionOnNextCall(len);
diff --git a/deps/v8/test/mjsunit/compiler/optimized-with.js b/deps/v8/test/mjsunit/compiler/optimized-with.js
index 9bc8713722..dc0351908b 100644
--- a/deps/v8/test/mjsunit/compiler/optimized-with.js
+++ b/deps/v8/test/mjsunit/compiler/optimized-with.js
@@ -13,6 +13,7 @@
return e
}
}
+ %PrepareFunctionForOptimization(f);
assertEquals(23, f({ x:23 }));
assertEquals(42, f({ x:42 }));
assertInstanceof(f(null), TypeError);
diff --git a/deps/v8/test/mjsunit/compiler/osr-sar.js b/deps/v8/test/mjsunit/compiler/osr-sar.js
index 02684f088c..66e8809307 100644
--- a/deps/v8/test/mjsunit/compiler/osr-sar.js
+++ b/deps/v8/test/mjsunit/compiler/osr-sar.js
@@ -39,6 +39,7 @@ function test() {
}
var K3 = 0x80000000;
+ %PrepareFunctionForOptimization(SarShr);
assertEquals(-2, SarShr(K3 | 0));
assertEquals(-2, SarShr(K3 | 0));
%OptimizeFunctionOnNextCall(SarShr);
diff --git a/deps/v8/test/mjsunit/compiler/phi-representations.js b/deps/v8/test/mjsunit/compiler/phi-representations.js
index 6d11bb0d8e..5598d7caf8 100644
--- a/deps/v8/test/mjsunit/compiler/phi-representations.js
+++ b/deps/v8/test/mjsunit/compiler/phi-representations.js
@@ -36,6 +36,7 @@ function ar() {
return (r - r);
}
+%PrepareFunctionForOptimization(ar);
assertEquals(0, ar());
assertEquals(0, ar());
%OptimizeFunctionOnNextCall(ar);
@@ -50,6 +51,7 @@ function ar2() {
return (r - r);
}
+%PrepareFunctionForOptimization(ar2);
assertEquals(0, ar2());
assertEquals(0, ar2());
%OptimizeFunctionOnNextCall(ar2);
diff --git a/deps/v8/test/mjsunit/compiler/pic.js b/deps/v8/test/mjsunit/compiler/pic.js
index f5b136ce91..e85e6ef273 100644
--- a/deps/v8/test/mjsunit/compiler/pic.js
+++ b/deps/v8/test/mjsunit/compiler/pic.js
@@ -47,6 +47,8 @@ function Test(o) {
assertEquals(99, CallF(o));
}
+%PrepareFunctionForOptimization(Test);
+
// Create a bunch of objects with different layouts.
var o1 = { x: 0, y: 1 };
var o2 = { y: 1, x: 0 };
diff --git a/deps/v8/test/mjsunit/compiler/polymorphic-symbols.js b/deps/v8/test/mjsunit/compiler/polymorphic-symbols.js
index e954d50fa8..72d42c318b 100644
--- a/deps/v8/test/mjsunit/compiler/polymorphic-symbols.js
+++ b/deps/v8/test/mjsunit/compiler/polymorphic-symbols.js
@@ -13,6 +13,7 @@
{[symbol]: 3, d: 4}
];
function foo(o) { return o[symbol]; }
+ %PrepareFunctionForOptimization(foo);
for (let i = 0; i < OBJS.length; ++i) {
assertEquals(i, foo(OBJS[i]));
assertEquals(i, foo(OBJS[i]));
@@ -33,6 +34,7 @@
{[symbol]: 3, d: 4}
];
function foo(o) { o[symbol] = o; }
+ %PrepareFunctionForOptimization(foo);
for (let i = 0; i < OBJS.length; ++i) {
foo(OBJS[i]);
foo(OBJS[i]);
diff --git a/deps/v8/test/mjsunit/compiler/promise-capability-default-closures.js b/deps/v8/test/mjsunit/compiler/promise-capability-default-closures.js
index f4d8cd4e5d..3208e54d5b 100644
--- a/deps/v8/test/mjsunit/compiler/promise-capability-default-closures.js
+++ b/deps/v8/test/mjsunit/compiler/promise-capability-default-closures.js
@@ -8,6 +8,7 @@
var resolve, value;
(new Promise(r => resolve = r)).then(v => value = v);
function foo() { resolve(1); }
+ %PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
@@ -19,6 +20,7 @@
var reject, value;
(new Promise((_, r) => reject = r)).catch(v => value = v);
function foo() { reject(1); }
+ %PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
@@ -29,6 +31,7 @@
(function() {
var value;
function foo(x) { return new Promise((resolve, reject) => resolve(x)); }
+ %PrepareFunctionForOptimization(foo);
foo(1);
foo(1);
%OptimizeFunctionOnNextCall(foo);
@@ -39,6 +42,7 @@
(function() {
var value;
function foo(x) { return new Promise((resolve, reject) => reject(x)); }
+ %PrepareFunctionForOptimization(foo);
foo(1);
foo(1);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-constructor.js b/deps/v8/test/mjsunit/compiler/promise-constructor.js
index ee069fbca2..7cbae22705 100644
--- a/deps/v8/test/mjsunit/compiler/promise-constructor.js
+++ b/deps/v8/test/mjsunit/compiler/promise-constructor.js
@@ -17,6 +17,7 @@ failWithMessage = (msg) => %AbortJS(msg);
return {resolve, reject, promise};
}
+ %PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
@@ -29,6 +30,7 @@ failWithMessage = (msg) => %AbortJS(msg);
return new Promise(1);
}
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
@@ -42,6 +44,7 @@ failWithMessage = (msg) => %AbortJS(msg);
return new Promise(1);
}
+ %PrepareFunctionForOptimization(foo);
let threw;
try {
threw = false;
@@ -105,6 +108,7 @@ failWithMessage = (msg) => %AbortJS(msg);
assertInstanceof(p, Promise);
}
+ %PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
@@ -129,6 +133,7 @@ failWithMessage = (msg) => %AbortJS(msg);
assertInstanceof(p, Promise);
}
+ %PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
@@ -154,6 +159,7 @@ failWithMessage = (msg) => %AbortJS(msg);
assertInstanceof(p, Promise);
}
+ %PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
@@ -183,6 +189,7 @@ failWithMessage = (msg) => %AbortJS(msg);
}
%NeverOptimizeFunction(bar);
+ %PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
@@ -199,6 +206,7 @@ failWithMessage = (msg) => %AbortJS(msg);
function foo() {
promise = new Promise(bar);
}
+ %PrepareFunctionForOptimization(foo);
foo();
foo();
%NeverOptimizeFunction(bar);
@@ -218,6 +226,7 @@ failWithMessage = (msg) => %AbortJS(msg);
function foo() {
promise = new Promise(bar);
}
+ %PrepareFunctionForOptimization(foo);
foo();
foo();
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-prototype-catch-custom-then-1.js b/deps/v8/test/mjsunit/compiler/promise-prototype-catch-custom-then-1.js
index d3bd0b8543..5dcacc4cd9 100644
--- a/deps/v8/test/mjsunit/compiler/promise-prototype-catch-custom-then-1.js
+++ b/deps/v8/test/mjsunit/compiler/promise-prototype-catch-custom-then-1.js
@@ -8,6 +8,7 @@ function foo(p) { return p.catch(x => x); }
const a = Promise.resolve(1);
+%PrepareFunctionForOptimization(foo);
foo(a);
foo(a);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-prototype-catch-custom-then-2.js b/deps/v8/test/mjsunit/compiler/promise-prototype-catch-custom-then-2.js
index 0d3f34db28..3281c69519 100644
--- a/deps/v8/test/mjsunit/compiler/promise-prototype-catch-custom-then-2.js
+++ b/deps/v8/test/mjsunit/compiler/promise-prototype-catch-custom-then-2.js
@@ -8,6 +8,7 @@ function foo(p) { return p.catch(x => x); }
const a = Promise.resolve(1);
+%PrepareFunctionForOptimization(foo);
foo(a);
foo(a);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-prototype-catch-subclass.js b/deps/v8/test/mjsunit/compiler/promise-prototype-catch-subclass.js
index 5aadaada81..2d37f2b225 100644
--- a/deps/v8/test/mjsunit/compiler/promise-prototype-catch-subclass.js
+++ b/deps/v8/test/mjsunit/compiler/promise-prototype-catch-subclass.js
@@ -21,6 +21,7 @@ class MyPromise extends Promise {
const a = MyPromise.resolve(1);
+%PrepareFunctionForOptimization(foo);
assertTrue(foo(a));
assertTrue(foo(a));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-prototype-catch.js b/deps/v8/test/mjsunit/compiler/promise-prototype-catch.js
index eae343fd2e..5d8080b9d3 100644
--- a/deps/v8/test/mjsunit/compiler/promise-prototype-catch.js
+++ b/deps/v8/test/mjsunit/compiler/promise-prototype-catch.js
@@ -6,6 +6,7 @@
(function() {
function foo(p) { return p.catch(); }
+ %PrepareFunctionForOptimization(foo);
foo(Promise.resolve(1));
foo(Promise.resolve(1));
%OptimizeFunctionOnNextCall(foo);
@@ -14,6 +15,7 @@
(function() {
function foo(p) { return p.catch(foo); }
+ %PrepareFunctionForOptimization(foo);
foo(Promise.resolve(1));
foo(Promise.resolve(1));
%OptimizeFunctionOnNextCall(foo);
@@ -22,6 +24,7 @@
(function() {
function foo(p) { return p.catch(foo, undefined); }
+ %PrepareFunctionForOptimization(foo);
foo(Promise.resolve(1));
foo(Promise.resolve(1));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-prototype-finally-custom-then-1.js b/deps/v8/test/mjsunit/compiler/promise-prototype-finally-custom-then-1.js
index a6987d446f..ff469d4c89 100644
--- a/deps/v8/test/mjsunit/compiler/promise-prototype-finally-custom-then-1.js
+++ b/deps/v8/test/mjsunit/compiler/promise-prototype-finally-custom-then-1.js
@@ -8,6 +8,7 @@ function foo(p) { return p.finally(x => x); }
const a = Promise.resolve(1);
+%PrepareFunctionForOptimization(foo);
foo(a);
foo(a);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-prototype-finally-custom-then-2.js b/deps/v8/test/mjsunit/compiler/promise-prototype-finally-custom-then-2.js
index 5bad54a61d..493539ee01 100644
--- a/deps/v8/test/mjsunit/compiler/promise-prototype-finally-custom-then-2.js
+++ b/deps/v8/test/mjsunit/compiler/promise-prototype-finally-custom-then-2.js
@@ -8,6 +8,7 @@ function foo(p) { return p.finally(x => x); }
const a = Promise.resolve(1);
+%PrepareFunctionForOptimization(foo);
foo(a);
foo(a);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-prototype-finally-subclass.js b/deps/v8/test/mjsunit/compiler/promise-prototype-finally-subclass.js
index ff5657f6cb..7a1fd9c508 100644
--- a/deps/v8/test/mjsunit/compiler/promise-prototype-finally-subclass.js
+++ b/deps/v8/test/mjsunit/compiler/promise-prototype-finally-subclass.js
@@ -21,6 +21,7 @@ class MyPromise extends Promise {
const a = MyPromise.resolve(1);
+%PrepareFunctionForOptimization(foo);
assertTrue(foo(a));
assertTrue(foo(a));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-prototype-finally.js b/deps/v8/test/mjsunit/compiler/promise-prototype-finally.js
index 6060f7b857..64af086e18 100644
--- a/deps/v8/test/mjsunit/compiler/promise-prototype-finally.js
+++ b/deps/v8/test/mjsunit/compiler/promise-prototype-finally.js
@@ -7,6 +7,7 @@
(function() {
const p = Promise.resolve(1);
function foo(p) { return p.finally(); }
+ %PrepareFunctionForOptimization(foo);
foo(p);
foo(p);
%OptimizeFunctionOnNextCall(foo);
@@ -16,6 +17,7 @@
(function() {
const p = Promise.resolve(1);
function foo(p) { return p.finally(x => x); }
+ %PrepareFunctionForOptimization(foo);
foo(p);
foo(p);
%OptimizeFunctionOnNextCall(foo);
@@ -25,6 +27,7 @@
(function() {
const p = Promise.resolve(1);
function foo(p, f) { return p.finally(f); }
+ %PrepareFunctionForOptimization(foo);
foo(p, x => x);
foo(p, x => x);
%OptimizeFunctionOnNextCall(foo);
@@ -34,6 +37,7 @@
(function() {
const p = Promise.resolve(1);
function foo(p, f) { return p.finally(f).finally(f); }
+ %PrepareFunctionForOptimization(foo);
foo(p, x => x);
foo(p, x => x);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-prototype-then.js b/deps/v8/test/mjsunit/compiler/promise-prototype-then.js
index caf77708b6..3df23531b1 100644
--- a/deps/v8/test/mjsunit/compiler/promise-prototype-then.js
+++ b/deps/v8/test/mjsunit/compiler/promise-prototype-then.js
@@ -7,6 +7,7 @@
(function() {
const p = Promise.resolve(1);
function foo(p) { return p.then(); }
+ %PrepareFunctionForOptimization(foo);
foo(p);
foo(p);
%OptimizeFunctionOnNextCall(foo);
@@ -16,6 +17,7 @@
(function() {
const p = Promise.resolve(1);
function foo(p) { return p.then(x => x); }
+ %PrepareFunctionForOptimization(foo);
foo(p);
foo(p);
%OptimizeFunctionOnNextCall(foo);
@@ -25,6 +27,7 @@
(function() {
const p = Promise.resolve(1);
function foo(p) { return p.then(x => x, y => y); }
+ %PrepareFunctionForOptimization(foo);
foo(p);
foo(p);
%OptimizeFunctionOnNextCall(foo);
@@ -34,6 +37,7 @@
(function() {
const p = Promise.resolve(1);
function foo(p, f) { return p.then(f, f); }
+ %PrepareFunctionForOptimization(foo);
foo(p, x => x);
foo(p, x => x);
%OptimizeFunctionOnNextCall(foo);
@@ -43,6 +47,7 @@
(function() {
const p = Promise.resolve(1);
function foo(p, f) { return p.then(f, f).then(f, f); }
+ %PrepareFunctionForOptimization(foo);
foo(p, x => x);
foo(p, x => x);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-resolve-stable-maps.js b/deps/v8/test/mjsunit/compiler/promise-resolve-stable-maps.js
index 7acd891b9b..f01dcaffcd 100644
--- a/deps/v8/test/mjsunit/compiler/promise-resolve-stable-maps.js
+++ b/deps/v8/test/mjsunit/compiler/promise-resolve-stable-maps.js
@@ -18,6 +18,7 @@
return Promise.resolve(a);
}
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), Promise);
assertInstanceof(foo(), Promise);
%OptimizeFunctionOnNextCall(foo);
@@ -46,6 +47,7 @@
return a;
}
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), Promise);
assertInstanceof(foo(), Promise);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-resolve.js b/deps/v8/test/mjsunit/compiler/promise-resolve.js
index 13cb0fa0a3..5ac84db0e1 100644
--- a/deps/v8/test/mjsunit/compiler/promise-resolve.js
+++ b/deps/v8/test/mjsunit/compiler/promise-resolve.js
@@ -10,6 +10,7 @@ function assertFulfilledWith(expected, thenable) {
(function() {
function foo() { return Promise.resolve(); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith(undefined, foo());
assertFulfilledWith(undefined, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -18,6 +19,7 @@ function assertFulfilledWith(expected, thenable) {
(function() {
function foo(x) { return Promise.resolve(x); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith(3, foo(3));
assertFulfilledWith(3, foo(3));
%OptimizeFunctionOnNextCall(foo);
@@ -26,6 +28,7 @@ function assertFulfilledWith(expected, thenable) {
(function() {
function foo(x, y) { return Promise.resolve(x, y); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith(1, foo(1, 0));
assertFulfilledWith(2, foo(2, 1));
%OptimizeFunctionOnNextCall(foo);
@@ -34,6 +37,7 @@ function assertFulfilledWith(expected, thenable) {
(function() {
function foo(x) { return Promise.resolve({x}); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith({x:1}, foo(1));
assertFulfilledWith({x:2}, foo(2));
%OptimizeFunctionOnNextCall(foo);
@@ -42,6 +46,7 @@ function assertFulfilledWith(expected, thenable) {
(function() {
function foo(x) { return Promise.resolve(Promise.resolve(x)); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith(null, foo(null));
assertFulfilledWith('a', foo('a'));
%OptimizeFunctionOnNextCall(foo);
@@ -55,6 +60,7 @@ function assertFulfilledWith(expected, thenable) {
}
};
function foo() { return Promise.resolve(thenable); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith(1, foo());
assertFulfilledWith(1, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -66,6 +72,7 @@ function assertFulfilledWith(expected, thenable) {
(function() {
function foo() { return MyPromise.resolve(); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith(undefined, foo());
assertFulfilledWith(undefined, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -74,6 +81,7 @@ function assertFulfilledWith(expected, thenable) {
(function() {
function foo(x) { return MyPromise.resolve(x); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith(3, foo(3));
assertFulfilledWith(3, foo(3));
%OptimizeFunctionOnNextCall(foo);
@@ -82,6 +90,7 @@ function assertFulfilledWith(expected, thenable) {
(function() {
function foo(x, y) { return MyPromise.resolve(x, y); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith(1, foo(1, 0));
assertFulfilledWith(2, foo(2, 1));
%OptimizeFunctionOnNextCall(foo);
@@ -90,6 +99,7 @@ function assertFulfilledWith(expected, thenable) {
(function() {
function foo(x) { return MyPromise.resolve({x}); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith({x:1}, foo(1));
assertFulfilledWith({x:2}, foo(2));
%OptimizeFunctionOnNextCall(foo);
@@ -98,6 +108,7 @@ function assertFulfilledWith(expected, thenable) {
(function() {
function foo(x) { return MyPromise.resolve(Promise.resolve(x)); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith(null, foo(null));
assertFulfilledWith('a', foo('a'));
%OptimizeFunctionOnNextCall(foo);
@@ -111,6 +122,7 @@ function assertFulfilledWith(expected, thenable) {
}
};
function foo() { return MyPromise.resolve(thenable); }
+ %PrepareFunctionForOptimization(foo);
assertFulfilledWith(1, foo());
assertFulfilledWith(1, foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/promise-species.js b/deps/v8/test/mjsunit/compiler/promise-species.js
index f029e3aad5..17497a30e1 100644
--- a/deps/v8/test/mjsunit/compiler/promise-species.js
+++ b/deps/v8/test/mjsunit/compiler/promise-species.js
@@ -10,6 +10,8 @@ function f() {
return new Promise(r => 88).then(x => 88);
}
+%PrepareFunctionForOptimization(f);
+
let y;
y = f();
diff --git a/deps/v8/test/mjsunit/compiler/property-calls.js b/deps/v8/test/mjsunit/compiler/property-calls.js
index ad5ca81bfd..508cf37016 100644
--- a/deps/v8/test/mjsunit/compiler/property-calls.js
+++ b/deps/v8/test/mjsunit/compiler/property-calls.js
@@ -30,6 +30,7 @@
function f(o) { return o.g(); }
function g() { return 42; }
+%PrepareFunctionForOptimization(f);
var object = { };
object.g = g;
for (var i = 0; i < 5; i++) f(object);
diff --git a/deps/v8/test/mjsunit/compiler/property-refs.js b/deps/v8/test/mjsunit/compiler/property-refs.js
index 6f1f19f0a6..09fdca3407 100644
--- a/deps/v8/test/mjsunit/compiler/property-refs.js
+++ b/deps/v8/test/mjsunit/compiler/property-refs.js
@@ -47,6 +47,7 @@ function LoadXY(x, y) {
return Load(object);
}
+%PrepareFunctionForOptimization(LoadXY);
for (var i = 0; i < 5; i++) LoadXY(i, i);
%OptimizeFunctionOnNextCall(LoadXY);
LoadXY(6, 6);
diff --git a/deps/v8/test/mjsunit/compiler/property-static.js b/deps/v8/test/mjsunit/compiler/property-static.js
index 07021340cd..51990af2b7 100644
--- a/deps/v8/test/mjsunit/compiler/property-static.js
+++ b/deps/v8/test/mjsunit/compiler/property-static.js
@@ -46,6 +46,7 @@ Object.prototype.load.call({ A:0, B:0, C:0, D:0, E:0, F:0, property:15 });
return object.load();
}
+ %PrepareFunctionForOptimization(f);
assertSame(1, f(1));
assertSame(2, f(2));
%OptimizeFunctionOnNextCall(f);
@@ -62,6 +63,7 @@ Object.prototype.load.call({ A:0, B:0, C:0, D:0, E:0, F:0, property:15 });
return object.load();
}
+ %PrepareFunctionForOptimization(f);
assertSame(1, f(1));
assertSame(2, f(2));
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/property-stores.js b/deps/v8/test/mjsunit/compiler/property-stores.js
index 4ffac07ad0..e593676a61 100644
--- a/deps/v8/test/mjsunit/compiler/property-stores.js
+++ b/deps/v8/test/mjsunit/compiler/property-stores.js
@@ -35,16 +35,19 @@ var obj = {x: 0,
h: function() { this.x = a; }};
var i;
+%PrepareFunctionForOptimization(obj.f);
for (i = 0; i < 5; i++) { obj.f(); }
%OptimizeFunctionOnNextCall(obj.f);
obj.f();
assertEquals(7, obj.x);
+%PrepareFunctionForOptimization(obj.g);
for (i = 0; i < 5; i++) { obj.g(); }
%OptimizeFunctionOnNextCall(obj.g);
obj.g();
assertEquals(43, obj.x);
+%PrepareFunctionForOptimization(obj.h);
for (i = 0; i < 5; i++) { obj.h(); }
%OptimizeFunctionOnNextCall(obj.h);
obj.h();
diff --git a/deps/v8/test/mjsunit/compiler/proto-chain-constant.js b/deps/v8/test/mjsunit/compiler/proto-chain-constant.js
index 0d9e3b0e1e..4eedd4ced9 100644
--- a/deps/v8/test/mjsunit/compiler/proto-chain-constant.js
+++ b/deps/v8/test/mjsunit/compiler/proto-chain-constant.js
@@ -38,6 +38,7 @@ var obj0 = c(obj1, { f0: { value: function() { return 0; }, writable: true }});
function get4(obj) { return obj.f4; }
+%PrepareFunctionForOptimization(get4);
assertEquals(4, get4(obj0)());
assertEquals(4, get4(obj0)());
%OptimizeFunctionOnNextCall(get4);
@@ -47,6 +48,7 @@ assertEquals(5, get4(obj0)());
function get3(obj) { return obj.f3; }
+%PrepareFunctionForOptimization(get3);
assertEquals(3, get3(obj0)());
assertEquals(3, get3(obj0)());
%OptimizeFunctionOnNextCall(get3);
diff --git a/deps/v8/test/mjsunit/compiler/proto-chain-load.js b/deps/v8/test/mjsunit/compiler/proto-chain-load.js
index 60c6431d2b..3454033d26 100644
--- a/deps/v8/test/mjsunit/compiler/proto-chain-load.js
+++ b/deps/v8/test/mjsunit/compiler/proto-chain-load.js
@@ -37,6 +37,7 @@ var obj0 = Object.create(obj1, { f0: {value: 0} });
function get4(obj) { return obj.f4; }
+%PrepareFunctionForOptimization(get4);
assertEquals(4, get4(obj0));
assertEquals(4, get4(obj0));
%OptimizeFunctionOnNextCall(get4);
diff --git a/deps/v8/test/mjsunit/compiler/receiver-conversion.js b/deps/v8/test/mjsunit/compiler/receiver-conversion.js
index c3f807a422..c4f8bf9c4a 100644
--- a/deps/v8/test/mjsunit/compiler/receiver-conversion.js
+++ b/deps/v8/test/mjsunit/compiler/receiver-conversion.js
@@ -10,6 +10,7 @@
var global = this;
function test(outer, inner, check) {
+ %PrepareFunctionForOptimization(outer);
check(outer());
check(outer());
%OptimizeFunctionOnNextCall(outer);
diff --git a/deps/v8/test/mjsunit/compiler/recursive-deopt.js b/deps/v8/test/mjsunit/compiler/recursive-deopt.js
index c921ade65a..6942a1d3a8 100644
--- a/deps/v8/test/mjsunit/compiler/recursive-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/recursive-deopt.js
@@ -35,6 +35,7 @@ function f(n) {
return f(n - 1) << one;
}
+%PrepareFunctionForOptimization(f);
var one = 1;
for (var i = 0; i < 5; i++) assertEquals(1 << 5, f(4));
diff --git a/deps/v8/test/mjsunit/compiler/redundancy-elimination.js b/deps/v8/test/mjsunit/compiler/redundancy-elimination.js
index 1e5185adb7..dc01fb4a05 100644
--- a/deps/v8/test/mjsunit/compiler/redundancy-elimination.js
+++ b/deps/v8/test/mjsunit/compiler/redundancy-elimination.js
@@ -19,6 +19,7 @@
return x + y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(3, foo([1, 2], 0));
assertEquals(3, foo([1, 2], 0));
%OptimizeFunctionOnNextCall(foo);
@@ -40,6 +41,7 @@
return x + y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(3, foo([1, 2], 0));
assertEquals(3, foo([1, 2], 0));
%OptimizeFunctionOnNextCall(foo);
@@ -61,6 +63,7 @@
return x + y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(3, foo([1, 2], 1));
assertEquals(3, foo([1, 2], 1));
%OptimizeFunctionOnNextCall(foo);
@@ -82,6 +85,7 @@
return x + y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(3, foo([1, 2], 1));
assertEquals(3, foo([1, 2], 1));
%OptimizeFunctionOnNextCall(foo);
@@ -97,6 +101,7 @@
return x + y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo([1, 2], 0));
assertEquals(1, foo([1, 2], 0));
%OptimizeFunctionOnNextCall(foo);
@@ -112,6 +117,7 @@
return x + y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(3, foo([1, 2], 0));
assertEquals(3, foo([1, 2], 0));
%OptimizeFunctionOnNextCall(foo);
@@ -127,6 +133,7 @@
return x + y;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(3, foo([1, 2], 1));
assertEquals(3, foo([1, 2], 1));
%OptimizeFunctionOnNextCall(foo);
@@ -142,6 +149,7 @@
return i;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo([1, 2], 0));
assertEquals(1, foo([1, 2], 1));
%OptimizeFunctionOnNextCall(foo);
@@ -162,6 +170,7 @@
return i;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo([1, 2], 0));
assertEquals(1, foo([1, 2], 1));
%OptimizeFunctionOnNextCall(foo);
@@ -182,6 +191,7 @@
return i;
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo([1, 2], 0));
assertEquals(1, foo([1, 2], 1));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/reflect-apply.js b/deps/v8/test/mjsunit/compiler/reflect-apply.js
index fb8f201a72..4f431f3b28 100644
--- a/deps/v8/test/mjsunit/compiler/reflect-apply.js
+++ b/deps/v8/test/mjsunit/compiler/reflect-apply.js
@@ -10,6 +10,7 @@
function bar() { return this; }
function foo() { return Reflect.apply(bar); }
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo);
assertThrows(foo);
%OptimizeFunctionOnNextCall(foo);
@@ -20,6 +21,7 @@
function bar() { return this; }
function foo() { return Reflect.apply(bar, this); }
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo);
assertThrows(foo);
%OptimizeFunctionOnNextCall(foo);
@@ -30,6 +32,7 @@
function bar() { return this; }
function foo() { return Reflect.apply(bar, this, arguments, this); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(42, foo.call(42));
assertEquals(42, foo.call(42));
%OptimizeFunctionOnNextCall(foo);
@@ -47,6 +50,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -62,6 +66,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -78,6 +83,7 @@
return Reflect.apply(undefined, this, dummy);
}
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
@@ -92,6 +98,7 @@
return Reflect.apply(null, this, dummy);
}
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
@@ -106,6 +113,7 @@
return Reflect.apply(null, this, dummy);
}
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/reflect-construct.js b/deps/v8/test/mjsunit/compiler/reflect-construct.js
index fb70ff4412..cf52856ebc 100644
--- a/deps/v8/test/mjsunit/compiler/reflect-construct.js
+++ b/deps/v8/test/mjsunit/compiler/reflect-construct.js
@@ -10,6 +10,7 @@
function A() {}
function foo() { return Reflect.construct(A); }
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo);
assertThrows(foo);
%OptimizeFunctionOnNextCall(foo);
@@ -20,6 +21,7 @@
function A(x) { this.x = x; }
function foo() { return Reflect.construct(A, arguments); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertInstanceof(foo(), A);
assertEquals(1, foo(1).x);
@@ -32,6 +34,7 @@
function A(x) { this.x = x; }
function foo() { return Reflect.construct(A, arguments, A, A); }
+ %PrepareFunctionForOptimization(foo);
assertInstanceof(foo(), A);
assertInstanceof(foo(), A);
assertEquals(1, foo(1).x);
@@ -51,6 +54,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -66,6 +70,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -81,6 +86,7 @@
return Reflect.construct(undefined, dummy, undefined);
}
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
@@ -95,6 +101,7 @@
return Reflect.construct(undefined, dummy);
}
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
@@ -109,6 +116,7 @@
return Reflect.construct(null, dummy, null);
}
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
@@ -122,6 +130,7 @@
return Reflect.construct(null, dummy);
}
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/reflect-get.js b/deps/v8/test/mjsunit/compiler/reflect-get.js
index 0c329e497e..b414ccb2bc 100644
--- a/deps/v8/test/mjsunit/compiler/reflect-get.js
+++ b/deps/v8/test/mjsunit/compiler/reflect-get.js
@@ -9,6 +9,7 @@
"use strict";
function foo() { return Reflect.get(); }
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo);
assertThrows(foo);
%OptimizeFunctionOnNextCall(foo);
@@ -18,6 +19,7 @@
"use strict";
function foo(o) { return Reflect.get(o); }
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo({}));
assertEquals(undefined, foo({}));
%OptimizeFunctionOnNextCall(foo);
@@ -27,6 +29,7 @@
"use strict";
function foo(o) { return Reflect.get(o); }
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo.bind(undefined, 1));
assertThrows(foo.bind(undefined, undefined));
%OptimizeFunctionOnNextCall(foo);
@@ -45,6 +48,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(10, foo());
assertEquals(10, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -61,6 +65,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo({[Symbol.toPrimitive]() { throw new Error(); }}));
assertEquals(1, foo({[Symbol.toPrimitive]() { throw new Error(); }}));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/reflect-getprototypeof.js b/deps/v8/test/mjsunit/compiler/reflect-getprototypeof.js
index a5ea89140e..5001158bee 100644
--- a/deps/v8/test/mjsunit/compiler/reflect-getprototypeof.js
+++ b/deps/v8/test/mjsunit/compiler/reflect-getprototypeof.js
@@ -9,6 +9,7 @@ var object = Object.create(prototype);
function foo() { return Reflect.getPrototypeOf(object); }
+%PrepareFunctionForOptimization(foo);
assertSame(prototype, foo());
assertSame(prototype, foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/reflect-has.js b/deps/v8/test/mjsunit/compiler/reflect-has.js
index 2f9ee1b66a..955ff26980 100644
--- a/deps/v8/test/mjsunit/compiler/reflect-has.js
+++ b/deps/v8/test/mjsunit/compiler/reflect-has.js
@@ -9,6 +9,7 @@
"use strict";
function foo() { return Reflect.has(); }
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo);
assertThrows(foo);
%OptimizeFunctionOnNextCall(foo);
@@ -18,6 +19,7 @@
"use strict";
function foo(o) { return Reflect.has(o); }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo({}));
assertFalse(foo({}));
%OptimizeFunctionOnNextCall(foo);
@@ -27,6 +29,7 @@
"use strict";
function foo(o) { return Reflect.has(o); }
+ %PrepareFunctionForOptimization(foo);
assertThrows(foo.bind(undefined, 1));
assertThrows(foo.bind(undefined, undefined));
%OptimizeFunctionOnNextCall(foo);
@@ -44,6 +47,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
@@ -60,6 +64,7 @@
}
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo({[Symbol.toPrimitive]() { throw new Error(); }}));
assertEquals(1, foo({[Symbol.toPrimitive]() { throw new Error(); }}));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-106351.js b/deps/v8/test/mjsunit/compiler/regress-106351.js
index 2a67a055d3..025802962e 100644
--- a/deps/v8/test/mjsunit/compiler/regress-106351.js
+++ b/deps/v8/test/mjsunit/compiler/regress-106351.js
@@ -33,6 +33,7 @@ function test(x) {
assertEquals(0.5, v);
}
+%PrepareFunctionForOptimization(test);
for (var i = 0; i < 5; ++i) test(0.5);
%OptimizeFunctionOnNextCall(test);
test(0.5);
diff --git a/deps/v8/test/mjsunit/compiler/regress-1085.js b/deps/v8/test/mjsunit/compiler/regress-1085.js
index 533cf59c9c..c969ddf644 100644
--- a/deps/v8/test/mjsunit/compiler/regress-1085.js
+++ b/deps/v8/test/mjsunit/compiler/regress-1085.js
@@ -31,6 +31,7 @@
// This test relies on specific type feedback for Math.min.
function f(x) { return 1 / Math.min(1, x); }
+%PrepareFunctionForOptimization(f);
for (var i = 0; i < 5; ++i) f(1);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-1394.js b/deps/v8/test/mjsunit/compiler/regress-1394.js
index fbf435731f..94bff2745c 100644
--- a/deps/v8/test/mjsunit/compiler/regress-1394.js
+++ b/deps/v8/test/mjsunit/compiler/regress-1394.js
@@ -50,6 +50,8 @@ function f(x) {
return ret;
};
+%PrepareFunctionForOptimization(f);
+
for (var i = 0; i < 3; i++) assertEquals(i, f(i));
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-177883.js b/deps/v8/test/mjsunit/compiler/regress-177883.js
index d5af584951..6636efa2e8 100644
--- a/deps/v8/test/mjsunit/compiler/regress-177883.js
+++ b/deps/v8/test/mjsunit/compiler/regress-177883.js
@@ -171,6 +171,7 @@
HEAPF32[i] = 1.0;
}
+ %PrepareFunctionForOptimization(__ZNK4Math7frustum10clipstatusERKNS_4bboxE);
__ZNK4Math7frustum10clipstatusERKNS_4bboxE(0, 0);
__ZNK4Math7frustum10clipstatusERKNS_4bboxE(0, 0);
__ZNK4Math7frustum10clipstatusERKNS_4bboxE(0, 0);
diff --git a/deps/v8/test/mjsunit/compiler/regress-3218915.js b/deps/v8/test/mjsunit/compiler/regress-3218915.js
index dfce815afb..abb47dc157 100644
--- a/deps/v8/test/mjsunit/compiler/regress-3218915.js
+++ b/deps/v8/test/mjsunit/compiler/regress-3218915.js
@@ -42,6 +42,7 @@ function observe(x, y) { try {} finally {} return x; }
function test(x) { return observe(this, ((0, side_effect()), x + 1)); }
// Run test enough times to get it optimized.
+%PrepareFunctionForOptimization(test);
for (var i = 0; i < 5; ++i) test(0);
%OptimizeFunctionOnNextCall(test);
test(0);
diff --git a/deps/v8/test/mjsunit/compiler/regress-411262.js b/deps/v8/test/mjsunit/compiler/regress-411262.js
index ffbfe2e823..320e3b7f36 100644
--- a/deps/v8/test/mjsunit/compiler/regress-411262.js
+++ b/deps/v8/test/mjsunit/compiler/regress-411262.js
@@ -33,5 +33,6 @@ function f() {
b.apply(this, arguments);
}
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
f();
diff --git a/deps/v8/test/mjsunit/compiler/regress-4207.js b/deps/v8/test/mjsunit/compiler/regress-4207.js
index c4ab5a7837..48f26a884b 100644
--- a/deps/v8/test/mjsunit/compiler/regress-4207.js
+++ b/deps/v8/test/mjsunit/compiler/regress-4207.js
@@ -5,11 +5,13 @@
// Flags: --allow-natives-syntax
function bar() { return 0/0 && 1; }
+%PrepareFunctionForOptimization(bar);
assertEquals(NaN, bar());
%OptimizeFunctionOnNextCall(bar);
assertEquals(NaN, bar());
function foo() { return 0/0 || 1; }
+%PrepareFunctionForOptimization(foo);
assertEquals(1, foo());
%OptimizeFunctionOnNextCall(foo);
assertEquals(1, foo());
diff --git a/deps/v8/test/mjsunit/compiler/regress-4389-1.js b/deps/v8/test/mjsunit/compiler/regress-4389-1.js
index adb37165db..5f77d54bb7 100644
--- a/deps/v8/test/mjsunit/compiler/regress-4389-1.js
+++ b/deps/v8/test/mjsunit/compiler/regress-4389-1.js
@@ -5,6 +5,7 @@
// Flags: --allow-natives-syntax
function foo(x) { Math.fround(x); }
+%PrepareFunctionForOptimization(foo);
foo(1);
foo(2);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-4389-2.js b/deps/v8/test/mjsunit/compiler/regress-4389-2.js
index edfcf7a8f5..2bfc6e64e0 100644
--- a/deps/v8/test/mjsunit/compiler/regress-4389-2.js
+++ b/deps/v8/test/mjsunit/compiler/regress-4389-2.js
@@ -5,6 +5,7 @@
// Flags: --allow-natives-syntax
function foo(x) { Math.sqrt(x); }
+%PrepareFunctionForOptimization(foo);
foo(1);
foo(2);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-4389-3.js b/deps/v8/test/mjsunit/compiler/regress-4389-3.js
index f4dbc48670..a4eb335140 100644
--- a/deps/v8/test/mjsunit/compiler/regress-4389-3.js
+++ b/deps/v8/test/mjsunit/compiler/regress-4389-3.js
@@ -5,6 +5,7 @@
// Flags: --allow-natives-syntax
function foo(x) { Math.floor(x); }
+%PrepareFunctionForOptimization(foo);
foo(1);
foo(2);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-4389-4.js b/deps/v8/test/mjsunit/compiler/regress-4389-4.js
index 2b9b1493eb..600cfa8c04 100644
--- a/deps/v8/test/mjsunit/compiler/regress-4389-4.js
+++ b/deps/v8/test/mjsunit/compiler/regress-4389-4.js
@@ -5,6 +5,7 @@
// Flags: --allow-natives-syntax
function foo(x) { Math.round(x); }
+%PrepareFunctionForOptimization(foo);
foo(1);
foo(2);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-4389-5.js b/deps/v8/test/mjsunit/compiler/regress-4389-5.js
index e72a3c38ea..ab373b6a0c 100644
--- a/deps/v8/test/mjsunit/compiler/regress-4389-5.js
+++ b/deps/v8/test/mjsunit/compiler/regress-4389-5.js
@@ -5,6 +5,7 @@
// Flags: --allow-natives-syntax
function foo(x) { Math.abs(x); }
+%PrepareFunctionForOptimization(foo);
foo(1);
foo(2);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-4389-6.js b/deps/v8/test/mjsunit/compiler/regress-4389-6.js
index 72a8856525..c51ae9fea3 100644
--- a/deps/v8/test/mjsunit/compiler/regress-4389-6.js
+++ b/deps/v8/test/mjsunit/compiler/regress-4389-6.js
@@ -5,6 +5,7 @@
// Flags: --allow-natives-syntax
function foo(x) { Math.log(x); }
+%PrepareFunctionForOptimization(foo);
foo(1);
foo(2);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-4413-1.js b/deps/v8/test/mjsunit/compiler/regress-4413-1.js
index 569823530f..10ef1f0114 100644
--- a/deps/v8/test/mjsunit/compiler/regress-4413-1.js
+++ b/deps/v8/test/mjsunit/compiler/regress-4413-1.js
@@ -11,5 +11,6 @@ var foo = (function(stdlib) {
return foo;
})(this);
+%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
diff --git a/deps/v8/test/mjsunit/compiler/regress-4470-1.js b/deps/v8/test/mjsunit/compiler/regress-4470-1.js
index 91d26b7212..f737a3992a 100644
--- a/deps/v8/test/mjsunit/compiler/regress-4470-1.js
+++ b/deps/v8/test/mjsunit/compiler/regress-4470-1.js
@@ -9,6 +9,7 @@ Foo.prototype.x = 0;
function foo(f) {
f.x = 1;
}
+%PrepareFunctionForOptimization(foo);
foo(new Foo);
foo(new Foo);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-491578.js b/deps/v8/test/mjsunit/compiler/regress-491578.js
index c27570456c..9f915caa48 100644
--- a/deps/v8/test/mjsunit/compiler/regress-491578.js
+++ b/deps/v8/test/mjsunit/compiler/regress-491578.js
@@ -11,5 +11,6 @@ function foo(x) {
f();
}
}
+%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo();
diff --git a/deps/v8/test/mjsunit/compiler/regress-5074.js b/deps/v8/test/mjsunit/compiler/regress-5074.js
index 903b54ad98..25d69ef0de 100644
--- a/deps/v8/test/mjsunit/compiler/regress-5074.js
+++ b/deps/v8/test/mjsunit/compiler/regress-5074.js
@@ -12,6 +12,7 @@ function foo(a, b) {
return x + b;
}
+%PrepareFunctionForOptimization(foo);
assertEquals(2.1, foo(1, 2));
assertEquals(2.1, foo(1, 2));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-5100.js b/deps/v8/test/mjsunit/compiler/regress-5100.js
index 694cd8a75b..07fffd0c2b 100644
--- a/deps/v8/test/mjsunit/compiler/regress-5100.js
+++ b/deps/v8/test/mjsunit/compiler/regress-5100.js
@@ -14,6 +14,7 @@ a["undefined"] = "undefined";
(function() {
function f(x) { return a[x]; }
+ %PrepareFunctionForOptimization(f);
assertEquals(0, f(0));
assertEquals(0, f(0));
%OptimizeFunctionOnNextCall(f);
@@ -24,6 +25,7 @@ a["undefined"] = "undefined";
(function() {
function f( x) { return a[x]; }
+ %PrepareFunctionForOptimization(f);
assertEquals(0, f(0));
assertEquals(0, f(0));
%OptimizeFunctionOnNextCall(f);
@@ -34,6 +36,7 @@ a["undefined"] = "undefined";
(function() {
function f( x) { return a[x]; }
+ %PrepareFunctionForOptimization(f);
assertEquals(0, f(0));
assertEquals(0, f(0));
%OptimizeFunctionOnNextCall(f);
@@ -44,6 +47,7 @@ a["undefined"] = "undefined";
(function() {
function f( x) { return a[x]; }
+ %PrepareFunctionForOptimization(f);
assertEquals(0, f(0));
assertEquals(0, f(0));
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-5129.js b/deps/v8/test/mjsunit/compiler/regress-5129.js
index 1d100ab34c..001d7fe61d 100644
--- a/deps/v8/test/mjsunit/compiler/regress-5129.js
+++ b/deps/v8/test/mjsunit/compiler/regress-5129.js
@@ -11,5 +11,6 @@ function foo($a,$b) {
return ($sub|0) < 0;
}
+%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
assertTrue(foo(0x7fffffff,-1));
diff --git a/deps/v8/test/mjsunit/compiler/regress-5158.js b/deps/v8/test/mjsunit/compiler/regress-5158.js
index ead5f4ed9d..9387807cf8 100644
--- a/deps/v8/test/mjsunit/compiler/regress-5158.js
+++ b/deps/v8/test/mjsunit/compiler/regress-5158.js
@@ -9,6 +9,7 @@ function foo(x) {
return (x > 0) ? x : 0 - x;
}
+%PrepareFunctionForOptimization(foo);
foo(1);
foo(-1);
foo(0);
diff --git a/deps/v8/test/mjsunit/compiler/regress-5278.js b/deps/v8/test/mjsunit/compiler/regress-5278.js
index 25b1fb03d5..ea657565a9 100644
--- a/deps/v8/test/mjsunit/compiler/regress-5278.js
+++ b/deps/v8/test/mjsunit/compiler/regress-5278.js
@@ -7,6 +7,7 @@
function foo(a, b) {
return a % b;
}
+%PrepareFunctionForOptimization(foo);
foo(2, 1);
foo(2, 1);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-5320.js b/deps/v8/test/mjsunit/compiler/regress-5320.js
index e2fa65de31..add57fd5be 100644
--- a/deps/v8/test/mjsunit/compiler/regress-5320.js
+++ b/deps/v8/test/mjsunit/compiler/regress-5320.js
@@ -28,6 +28,7 @@
// Flags: --allow-natives-syntax --opt
function OptimizeTruncatingBinaryOp(func) {
+ %PrepareFunctionForOptimization(func);
func(42, -2);
func(31, undefined);
%OptimizeFunctionOnNextCall(func);
diff --git a/deps/v8/test/mjsunit/compiler/regress-5538.js b/deps/v8/test/mjsunit/compiler/regress-5538.js
index 7e4c25d3bc..2878b40b21 100644
--- a/deps/v8/test/mjsunit/compiler/regress-5538.js
+++ b/deps/v8/test/mjsunit/compiler/regress-5538.js
@@ -10,6 +10,7 @@
return Number.parseInt(x + 1);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(0));
assertEquals(2, foo(1));
%OptimizeFunctionOnNextCall(foo);
@@ -22,6 +23,7 @@
return Number.parseInt(x + 1, 0);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(0));
assertEquals(2, foo(1));
%OptimizeFunctionOnNextCall(foo);
@@ -34,6 +36,7 @@
return Number.parseInt(x + 1, 10);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(0));
assertEquals(2, foo(1));
%OptimizeFunctionOnNextCall(foo);
@@ -46,6 +49,7 @@
return Number.parseInt(x + 1, undefined);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(1, foo(0));
assertEquals(2, foo(1));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-600593.js b/deps/v8/test/mjsunit/compiler/regress-600593.js
index c93f2ab800..463f5bab47 100644
--- a/deps/v8/test/mjsunit/compiler/regress-600593.js
+++ b/deps/v8/test/mjsunit/compiler/regress-600593.js
@@ -15,6 +15,7 @@ function Error() {
return arguments.length;
}
+%PrepareFunctionForOptimization(f);
assertThrows(function() { f(true); });
assertThrows(function() { f(false); });
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-621147.js b/deps/v8/test/mjsunit/compiler/regress-621147.js
index 0a5a221c40..4c25b0c1b6 100644
--- a/deps/v8/test/mjsunit/compiler/regress-621147.js
+++ b/deps/v8/test/mjsunit/compiler/regress-621147.js
@@ -16,6 +16,8 @@ function test3(a) {
a[0] = 1;
}
+%PrepareFunctionForOptimization(test2);
+
test(0);
var smi_array = [1,2];
diff --git a/deps/v8/test/mjsunit/compiler/regress-621423.js b/deps/v8/test/mjsunit/compiler/regress-621423.js
index 962176ffbf..8bc32310ab 100644
--- a/deps/v8/test/mjsunit/compiler/regress-621423.js
+++ b/deps/v8/test/mjsunit/compiler/regress-621423.js
@@ -16,6 +16,7 @@ function f() {
g(a);
}
+%PrepareFunctionForOptimization(f);
f();
%OptimizeFunctionOnNextCall(f);
f();
diff --git a/deps/v8/test/mjsunit/compiler/regress-626986.js b/deps/v8/test/mjsunit/compiler/regress-626986.js
index 5e02918423..7ca1d964d9 100644
--- a/deps/v8/test/mjsunit/compiler/regress-626986.js
+++ b/deps/v8/test/mjsunit/compiler/regress-626986.js
@@ -14,6 +14,8 @@ function f(o, x) {
o.f = x;
}
+%PrepareFunctionForOptimization(f);
+
f(o, g);
f(o, g);
f(o, g);
diff --git a/deps/v8/test/mjsunit/compiler/regress-628403.js b/deps/v8/test/mjsunit/compiler/regress-628403.js
index 4096ac32ae..7086d8b51b 100644
--- a/deps/v8/test/mjsunit/compiler/regress-628403.js
+++ b/deps/v8/test/mjsunit/compiler/regress-628403.js
@@ -20,6 +20,7 @@ function f(a) {
}
%NeverOptimizeFunction(g);
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-633497.js b/deps/v8/test/mjsunit/compiler/regress-633497.js
index 8bf358af00..0e3288e02a 100644
--- a/deps/v8/test/mjsunit/compiler/regress-633497.js
+++ b/deps/v8/test/mjsunit/compiler/regress-633497.js
@@ -23,6 +23,7 @@ function f(a) {
return +x;
}
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-638132.js b/deps/v8/test/mjsunit/compiler/regress-638132.js
index 1b94feb125..b4524926f6 100644
--- a/deps/v8/test/mjsunit/compiler/regress-638132.js
+++ b/deps/v8/test/mjsunit/compiler/regress-638132.js
@@ -19,6 +19,7 @@ function f(b) {
g(1, 2);
g(1, 2);
+%PrepareFunctionForOptimization(f);
f(0);
f(0);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-639210.js b/deps/v8/test/mjsunit/compiler/regress-639210.js
index 50303fb9d6..a852a07a44 100644
--- a/deps/v8/test/mjsunit/compiler/regress-639210.js
+++ b/deps/v8/test/mjsunit/compiler/regress-639210.js
@@ -31,8 +31,10 @@ var m = (function m() {
m.init();
+%PrepareFunctionForOptimization(m.load);
%OptimizeFunctionOnNextCall(m.load);
assertEquals(2, m.load());
+%PrepareFunctionForOptimization(m.store);
%OptimizeFunctionOnNextCall(m.store);
assertEquals(0.1, m.store(1));
diff --git a/deps/v8/test/mjsunit/compiler/regress-644048.js b/deps/v8/test/mjsunit/compiler/regress-644048.js
index ee2dd6edef..3aeb0e3b5f 100644
--- a/deps/v8/test/mjsunit/compiler/regress-644048.js
+++ b/deps/v8/test/mjsunit/compiler/regress-644048.js
@@ -10,6 +10,7 @@ function foo(x) {
: x) | 0
}
+%PrepareFunctionForOptimization(foo);
foo(1);
foo(2);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-664117.js b/deps/v8/test/mjsunit/compiler/regress-664117.js
index cf00591340..3346db4dc8 100644
--- a/deps/v8/test/mjsunit/compiler/regress-664117.js
+++ b/deps/v8/test/mjsunit/compiler/regress-664117.js
@@ -8,6 +8,7 @@ function foo() {
return v.length + 1;
}
+%PrepareFunctionForOptimization(foo);
var v = [];
foo();
v.length = 0xFFFFFFFF;
diff --git a/deps/v8/test/mjsunit/compiler/regress-664490.js b/deps/v8/test/mjsunit/compiler/regress-664490.js
index 94094c7362..69a8bd4af1 100644
--- a/deps/v8/test/mjsunit/compiler/regress-664490.js
+++ b/deps/v8/test/mjsunit/compiler/regress-664490.js
@@ -14,5 +14,6 @@ function f() {
foo(undefined == 0);
}
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
f();
diff --git a/deps/v8/test/mjsunit/compiler/regress-665680.js b/deps/v8/test/mjsunit/compiler/regress-665680.js
index b014bee9ac..12713da670 100644
--- a/deps/v8/test/mjsunit/compiler/regress-665680.js
+++ b/deps/v8/test/mjsunit/compiler/regress-665680.js
@@ -13,6 +13,7 @@ var invalidAsmFunction = (function() {
}
})();
+%PrepareFunctionForOptimization(invalidAsmFunction);
invalidAsmFunction();
%OptimizeFunctionOnNextCall(invalidAsmFunction);
invalidAsmFunction();
diff --git a/deps/v8/test/mjsunit/compiler/regress-668760.js b/deps/v8/test/mjsunit/compiler/regress-668760.js
index 58294becae..6cb0133088 100644
--- a/deps/v8/test/mjsunit/compiler/regress-668760.js
+++ b/deps/v8/test/mjsunit/compiler/regress-668760.js
@@ -22,6 +22,7 @@ function deopt() {
this.__defineGetter__("o", deopt );
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-671574.js b/deps/v8/test/mjsunit/compiler/regress-671574.js
index fad03f0a28..b9a6861320 100644
--- a/deps/v8/test/mjsunit/compiler/regress-671574.js
+++ b/deps/v8/test/mjsunit/compiler/regress-671574.js
@@ -17,5 +17,6 @@ function f() {
} catch(e) {"Caught: " + e; }
}
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
f();
diff --git a/deps/v8/test/mjsunit/compiler/regress-675704.js b/deps/v8/test/mjsunit/compiler/regress-675704.js
index 788f92e530..f3c30e33ac 100644
--- a/deps/v8/test/mjsunit/compiler/regress-675704.js
+++ b/deps/v8/test/mjsunit/compiler/regress-675704.js
@@ -20,6 +20,7 @@ function g(x) {
}
}
+%PrepareFunctionForOptimization(g);
g(false);
g(false);
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/regress-700883.js b/deps/v8/test/mjsunit/compiler/regress-700883.js
index 41440f3a3f..d9722a26d3 100644
--- a/deps/v8/test/mjsunit/compiler/regress-700883.js
+++ b/deps/v8/test/mjsunit/compiler/regress-700883.js
@@ -18,6 +18,7 @@ function foo(x) {
return min(y, x);
}
+%PrepareFunctionForOptimization(foo);
foo();
%OptimizeFunctionOnNextCall(foo);
foo();
diff --git a/deps/v8/test/mjsunit/compiler/regress-7121.js b/deps/v8/test/mjsunit/compiler/regress-7121.js
index bdf3133bb8..0cf0dd3a51 100644
--- a/deps/v8/test/mjsunit/compiler/regress-7121.js
+++ b/deps/v8/test/mjsunit/compiler/regress-7121.js
@@ -5,6 +5,7 @@
// Flags: --allow-natives-syntax
function foo() { %_ToLength(42n) }
+%PrepareFunctionForOptimization(foo);
assertThrows(foo, TypeError);
%OptimizeFunctionOnNextCall(foo);
assertThrows(foo, TypeError);
diff --git a/deps/v8/test/mjsunit/compiler/regress-713367.js b/deps/v8/test/mjsunit/compiler/regress-713367.js
index 1bf0a04493..b4a61499d3 100644
--- a/deps/v8/test/mjsunit/compiler/regress-713367.js
+++ b/deps/v8/test/mjsunit/compiler/regress-713367.js
@@ -27,4 +27,5 @@ function f() {
}
}
+%PrepareFunctionForOptimization(f);
assertThrowsEquals(f, 42);
diff --git a/deps/v8/test/mjsunit/compiler/regress-714483.js b/deps/v8/test/mjsunit/compiler/regress-714483.js
index 7fc8868706..748c28f1bc 100644
--- a/deps/v8/test/mjsunit/compiler/regress-714483.js
+++ b/deps/v8/test/mjsunit/compiler/regress-714483.js
@@ -17,6 +17,7 @@ function foo(o) {
return o.f();
}
+%PrepareFunctionForOptimization(foo);
foo(o1);
try { foo(o2); } catch(e) {}
foo(o1);
diff --git a/deps/v8/test/mjsunit/compiler/regress-715651.js b/deps/v8/test/mjsunit/compiler/regress-715651.js
index a75adc8ae7..32ab1da93d 100644
--- a/deps/v8/test/mjsunit/compiler/regress-715651.js
+++ b/deps/v8/test/mjsunit/compiler/regress-715651.js
@@ -32,6 +32,7 @@ function g(o) {
return o.y;
}
+%PrepareFunctionForOptimization(g);
g(h());
g(h());
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/regress-726554.js b/deps/v8/test/mjsunit/compiler/regress-726554.js
index afd81936a5..f5338aa8ac 100644
--- a/deps/v8/test/mjsunit/compiler/regress-726554.js
+++ b/deps/v8/test/mjsunit/compiler/regress-726554.js
@@ -21,6 +21,7 @@ b[1] = 3.5;
h(b, [1073741823, 2147483648, -12]);
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-731495.js b/deps/v8/test/mjsunit/compiler/regress-731495.js
index 7e0d850efb..d6fbfebaff 100644
--- a/deps/v8/test/mjsunit/compiler/regress-731495.js
+++ b/deps/v8/test/mjsunit/compiler/regress-731495.js
@@ -10,6 +10,7 @@ function foo() {
return global;
};
+%PrepareFunctionForOptimization(foo);
assertEquals(foo(), "bar");
%OptimizeFunctionOnNextCall(foo);
assertEquals(foo(), "bar");
diff --git a/deps/v8/test/mjsunit/compiler/regress-733181.js b/deps/v8/test/mjsunit/compiler/regress-733181.js
index 0a76ab70ea..fad95ce3dc 100644
--- a/deps/v8/test/mjsunit/compiler/regress-733181.js
+++ b/deps/v8/test/mjsunit/compiler/regress-733181.js
@@ -8,6 +8,7 @@ function l(s) {
return ("xxxxxxxxxxxxxxxxxxxxxxx" + s).toLowerCase();
}
+%PrepareFunctionForOptimization(l);
l("abcd");
l("abcd");
%OptimizeFunctionOnNextCall(l);
@@ -17,6 +18,7 @@ function u(s) {
return ("xxxxxxxxxxxxxxxxxxxxxxx" + s).toUpperCase();
}
+%PrepareFunctionForOptimization(u);
u("abcd");
u("abcd");
%OptimizeFunctionOnNextCall(u);
diff --git a/deps/v8/test/mjsunit/compiler/regress-736567.js b/deps/v8/test/mjsunit/compiler/regress-736567.js
index 84c6dce1ff..c42b569d94 100644
--- a/deps/v8/test/mjsunit/compiler/regress-736567.js
+++ b/deps/v8/test/mjsunit/compiler/regress-736567.js
@@ -15,6 +15,7 @@ function g() {
f(0, "s");
}
+%PrepareFunctionForOptimization(g);
assertThrows(g);
%OptimizeFunctionOnNextCall(g);
assertThrows(g);
diff --git a/deps/v8/test/mjsunit/compiler/regress-739902.js b/deps/v8/test/mjsunit/compiler/regress-739902.js
index 8f94995840..cf8c306207 100644
--- a/deps/v8/test/mjsunit/compiler/regress-739902.js
+++ b/deps/v8/test/mjsunit/compiler/regress-739902.js
@@ -11,6 +11,7 @@
var e = 0x41000001;
+ %PrepareFunctionForOptimization(f);
f(e);
%OptimizeFunctionOnNextCall(f);
assertEquals("A", f(e));
@@ -21,6 +22,7 @@
return (x >>> 24) & 0xffff;
};
+ %PrepareFunctionForOptimization(f);
f(1);
%OptimizeFunctionOnNextCall(f);
assertEquals(0, f(1));
diff --git a/deps/v8/test/mjsunit/compiler/regress-758096.js b/deps/v8/test/mjsunit/compiler/regress-758096.js
index 1ed32c0263..88178cac21 100644
--- a/deps/v8/test/mjsunit/compiler/regress-758096.js
+++ b/deps/v8/test/mjsunit/compiler/regress-758096.js
@@ -16,6 +16,7 @@
return obj.f();
}
+ %PrepareFunctionForOptimization(f);
f(x);
f(y);
f(x);
@@ -45,6 +46,7 @@
return fg() + a;
}
+ %PrepareFunctionForOptimization(h);
h(0);
h(0);
h(1);
diff --git a/deps/v8/test/mjsunit/compiler/regress-758983.js b/deps/v8/test/mjsunit/compiler/regress-758983.js
index 45899c110b..93627e3dfd 100644
--- a/deps/v8/test/mjsunit/compiler/regress-758983.js
+++ b/deps/v8/test/mjsunit/compiler/regress-758983.js
@@ -13,6 +13,7 @@ function f(b) {
return r < 0;
}
+%PrepareFunctionForOptimization(f);
f(true);
f(true);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-761892.js b/deps/v8/test/mjsunit/compiler/regress-761892.js
index 5423c59c04..d4ce1223bb 100644
--- a/deps/v8/test/mjsunit/compiler/regress-761892.js
+++ b/deps/v8/test/mjsunit/compiler/regress-761892.js
@@ -9,6 +9,7 @@ function f(x) {
1.1!=(x||x0)
}
+%PrepareFunctionForOptimization(f);
f(1.1);
f(1.1);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-762057.js b/deps/v8/test/mjsunit/compiler/regress-762057.js
index 4b5cab6ef5..41942f9616 100644
--- a/deps/v8/test/mjsunit/compiler/regress-762057.js
+++ b/deps/v8/test/mjsunit/compiler/regress-762057.js
@@ -14,6 +14,7 @@ function* foo() {
}
}
+%PrepareFunctionForOptimization(foo);
let gaga = foo();
gaga.next();
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-772420.js b/deps/v8/test/mjsunit/compiler/regress-772420.js
index 4b58b10909..53ca7fbe65 100644
--- a/deps/v8/test/mjsunit/compiler/regress-772420.js
+++ b/deps/v8/test/mjsunit/compiler/regress-772420.js
@@ -22,6 +22,7 @@ function foo(arg) {
return value * undefined;
}
+%PrepareFunctionForOptimization(foo);
foo(3);
foo(3);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-772872.js b/deps/v8/test/mjsunit/compiler/regress-772872.js
index 345ace82bd..1e8d824ffd 100644
--- a/deps/v8/test/mjsunit/compiler/regress-772872.js
+++ b/deps/v8/test/mjsunit/compiler/regress-772872.js
@@ -7,6 +7,7 @@
function f() {
for (var x = 10; x > 5; x -= 16) {}
}
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-773954.js b/deps/v8/test/mjsunit/compiler/regress-773954.js
index b78a499d37..ad1d667d5d 100644
--- a/deps/v8/test/mjsunit/compiler/regress-773954.js
+++ b/deps/v8/test/mjsunit/compiler/regress-773954.js
@@ -13,6 +13,7 @@ function f(o) {
return 5 + o.x++;
}
+%PrepareFunctionForOptimization(f);
try {
f(a);
f(b);
diff --git a/deps/v8/test/mjsunit/compiler/regress-780658.js b/deps/v8/test/mjsunit/compiler/regress-780658.js
index 57fdbbabed..8eade77e83 100644
--- a/deps/v8/test/mjsunit/compiler/regress-780658.js
+++ b/deps/v8/test/mjsunit/compiler/regress-780658.js
@@ -19,6 +19,7 @@ function with_tagged(x) {
return get1(l);
}
+%PrepareFunctionForOptimization(with_double);
with_double(.5);
with_tagged({});
with_double(.6);
diff --git a/deps/v8/test/mjsunit/compiler/regress-786521.js b/deps/v8/test/mjsunit/compiler/regress-786521.js
index 2b161270ed..ae354e364b 100644
--- a/deps/v8/test/mjsunit/compiler/regress-786521.js
+++ b/deps/v8/test/mjsunit/compiler/regress-786521.js
@@ -17,6 +17,7 @@ inlined(true, 1);
inlined(true, 2);
inlined(false, 1);
+%PrepareFunctionForOptimization(foo);
function foo(b) { inlined(b, "") }
foo(false); foo(false);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-788539.js b/deps/v8/test/mjsunit/compiler/regress-788539.js
index 889090cdd9..b0caa2f827 100644
--- a/deps/v8/test/mjsunit/compiler/regress-788539.js
+++ b/deps/v8/test/mjsunit/compiler/regress-788539.js
@@ -31,6 +31,7 @@ function f3(a) {
f2(new C().bar.call(), Object(), String);
}
+%PrepareFunctionForOptimization(f3);
f3(new Array(1));
f3(new Array(1));
%OptimizeFunctionOnNextCall(f3);
diff --git a/deps/v8/test/mjsunit/compiler/regress-793863.js b/deps/v8/test/mjsunit/compiler/regress-793863.js
index 883805dff6..a27888ec80 100644
--- a/deps/v8/test/mjsunit/compiler/regress-793863.js
+++ b/deps/v8/test/mjsunit/compiler/regress-793863.js
@@ -8,5 +8,6 @@ function f(a) {
return arguments[0];
}
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
assertEquals(undefined, f());
diff --git a/deps/v8/test/mjsunit/compiler/regress-796041.js b/deps/v8/test/mjsunit/compiler/regress-796041.js
index e2c2e11c0b..ac1d428b7c 100644
--- a/deps/v8/test/mjsunit/compiler/regress-796041.js
+++ b/deps/v8/test/mjsunit/compiler/regress-796041.js
@@ -29,6 +29,7 @@ function g(abort, a, b) {
return f(abort, "abc", a, b);
}
+%PrepareFunctionForOptimization(g);
g(true); g(true); g(true); g(true);
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/regress-797596.js b/deps/v8/test/mjsunit/compiler/regress-797596.js
index 4e3594bdb1..54ac741d0b 100644
--- a/deps/v8/test/mjsunit/compiler/regress-797596.js
+++ b/deps/v8/test/mjsunit/compiler/regress-797596.js
@@ -8,6 +8,7 @@ function inferReceiverMapsInDeadCode() {
var obj = { func() {} };
gc();
function wrappedCode() { try { code(); } catch (e) {} }
+ %PrepareFunctionForOptimization(wrappedCode);
function code() {
obj.a;
try {
diff --git a/deps/v8/test/mjsunit/compiler/regress-799263.js b/deps/v8/test/mjsunit/compiler/regress-799263.js
index b6b1165329..a3c94a7e0a 100644
--- a/deps/v8/test/mjsunit/compiler/regress-799263.js
+++ b/deps/v8/test/mjsunit/compiler/regress-799263.js
@@ -16,6 +16,8 @@ function opt(a, b) {
b[0] = 9.431092e-317;
}
+%PrepareFunctionForOptimization(opt);
+
let arr1 = new Array(1);
arr1[0] = 'a';
opt(arr1, [0]);
diff --git a/deps/v8/test/mjsunit/compiler/regress-801097.js b/deps/v8/test/mjsunit/compiler/regress-801097.js
index d488ce4deb..655393a961 100644
--- a/deps/v8/test/mjsunit/compiler/regress-801097.js
+++ b/deps/v8/test/mjsunit/compiler/regress-801097.js
@@ -14,6 +14,7 @@ function GetFunction() {
}
var func = GetFunction();
+%PrepareFunctionForOptimization(func);
assertThrows("func();");
%OptimizeFunctionOnNextCall(func);
assertThrows("func()");
diff --git a/deps/v8/test/mjsunit/compiler/regress-817225.js b/deps/v8/test/mjsunit/compiler/regress-817225.js
index 22f0375605..9a2d67ef7b 100644
--- a/deps/v8/test/mjsunit/compiler/regress-817225.js
+++ b/deps/v8/test/mjsunit/compiler/regress-817225.js
@@ -22,6 +22,7 @@ inlined();
function optimized(abort, a, b) {
return inlined(abort, "abc", a, b);
}
+%PrepareFunctionForOptimization(optimized);
optimized(true);
%OptimizeFunctionOnNextCall(optimized);
optimized();
diff --git a/deps/v8/test/mjsunit/compiler/regress-8380.js b/deps/v8/test/mjsunit/compiler/regress-8380.js
index d0bf28571e..f82518532d 100644
--- a/deps/v8/test/mjsunit/compiler/regress-8380.js
+++ b/deps/v8/test/mjsunit/compiler/regress-8380.js
@@ -13,6 +13,7 @@ function reduceLHS() {
}
}
+%PrepareFunctionForOptimization(reduceLHS);
reduceLHS();
%OptimizeFunctionOnNextCall(reduceLHS);
reduceLHS();
@@ -27,6 +28,7 @@ function reduceRHS() {
}
}
+%PrepareFunctionForOptimization(reduceRHS);
reduceRHS();
%OptimizeFunctionOnNextCall(reduceRHS);
reduceRHS();
diff --git a/deps/v8/test/mjsunit/compiler/regress-841117.js b/deps/v8/test/mjsunit/compiler/regress-841117.js
index a059922a6e..313bd3983c 100644
--- a/deps/v8/test/mjsunit/compiler/regress-841117.js
+++ b/deps/v8/test/mjsunit/compiler/regress-841117.js
@@ -6,6 +6,7 @@
var v = 1e9;
function f() { return Math.floor(v / 10); }
+%PrepareFunctionForOptimization(f);
assertEquals(1e8, f());
%OptimizeFunctionOnNextCall(f);
assertEquals(1e8, f());
diff --git a/deps/v8/test/mjsunit/compiler/regress-884052.js b/deps/v8/test/mjsunit/compiler/regress-884052.js
index babfcc3cea..937f97649a 100644
--- a/deps/v8/test/mjsunit/compiler/regress-884052.js
+++ b/deps/v8/test/mjsunit/compiler/regress-884052.js
@@ -11,6 +11,7 @@ function foo() {
}
}
+%PrepareFunctionForOptimization(foo);
foo();
%OptimizeFunctionOnNextCall(foo);
foo();
diff --git a/deps/v8/test/mjsunit/compiler/regress-888923.js b/deps/v8/test/mjsunit/compiler/regress-888923.js
index e352673b7d..5d3074d5a6 100644
--- a/deps/v8/test/mjsunit/compiler/regress-888923.js
+++ b/deps/v8/test/mjsunit/compiler/regress-888923.js
@@ -11,6 +11,7 @@
return o.y.a;
}
+ %PrepareFunctionForOptimization(f);
f({ x : 0, y : { a : 1 } });
f({ x : 0, y : { a : 2 } });
%OptimizeFunctionOnNextCall(f);
@@ -24,6 +25,7 @@
return o.x + a;
}
+ %PrepareFunctionForOptimization(f);
f({ x : 42, y : 21 });
f({ x : 42, y : 21 });
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-890620.js b/deps/v8/test/mjsunit/compiler/regress-890620.js
index f5fc7f4f65..77237774c3 100644
--- a/deps/v8/test/mjsunit/compiler/regress-890620.js
+++ b/deps/v8/test/mjsunit/compiler/regress-890620.js
@@ -19,6 +19,7 @@ function f() {
g();
}
+%PrepareFunctionForOptimization(f);
f();
%OptimizeFunctionOnNextCall(f);
f();
diff --git a/deps/v8/test/mjsunit/compiler/regress-895799.js b/deps/v8/test/mjsunit/compiler/regress-895799.js
index 4305b7427b..c45a85f77d 100644
--- a/deps/v8/test/mjsunit/compiler/regress-895799.js
+++ b/deps/v8/test/mjsunit/compiler/regress-895799.js
@@ -19,6 +19,8 @@ class A extends C {
}
}
+%PrepareFunctionForOptimization(A);
+
var D = new Proxy(A, { get() { %DeoptimizeFunction(A); } });
try { Reflect.construct(A, [], D); } catch(e) {}
diff --git a/deps/v8/test/mjsunit/compiler/regress-905555-2.js b/deps/v8/test/mjsunit/compiler/regress-905555-2.js
index 5852c6dd43..f7e2a728c2 100644
--- a/deps/v8/test/mjsunit/compiler/regress-905555-2.js
+++ b/deps/v8/test/mjsunit/compiler/regress-905555-2.js
@@ -10,6 +10,7 @@ function boom(value) {
return global;
}
+%PrepareFunctionForOptimization(boom);
assertEquals(1, boom());
assertEquals(1, boom());
%OptimizeFunctionOnNextCall(boom, "concurrent");
diff --git a/deps/v8/test/mjsunit/compiler/regress-905555.js b/deps/v8/test/mjsunit/compiler/regress-905555.js
index bc7ba7428e..72ccf9aa1d 100644
--- a/deps/v8/test/mjsunit/compiler/regress-905555.js
+++ b/deps/v8/test/mjsunit/compiler/regress-905555.js
@@ -10,6 +10,7 @@ function boom(value) {
return global;
}
+%PrepareFunctionForOptimization(boom);
assertEquals(1, boom());
assertEquals(1, boom());
%OptimizeFunctionOnNextCall(boom, "concurrent");
diff --git a/deps/v8/test/mjsunit/compiler/regress-910838.js b/deps/v8/test/mjsunit/compiler/regress-910838.js
index 6e62a453e0..e67126735d 100644
--- a/deps/v8/test/mjsunit/compiler/regress-910838.js
+++ b/deps/v8/test/mjsunit/compiler/regress-910838.js
@@ -14,6 +14,7 @@ function g(b, x) {
return f(b, 'abc', x);
}
+%PrepareFunctionForOptimization(g);
f(false, 0, 0);
g(true, 0);
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/regress-913232.js b/deps/v8/test/mjsunit/compiler/regress-913232.js
index efd7fb8e5f..46acd817b3 100644
--- a/deps/v8/test/mjsunit/compiler/regress-913232.js
+++ b/deps/v8/test/mjsunit/compiler/regress-913232.js
@@ -10,5 +10,6 @@ function* E(b) {
}
}
+%PrepareFunctionForOptimization(E);
%OptimizeFunctionOnNextCall(E);
E();
diff --git a/deps/v8/test/mjsunit/compiler/regress-924151.js b/deps/v8/test/mjsunit/compiler/regress-924151.js
new file mode 100644
index 0000000000..6454a71032
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/regress-924151.js
@@ -0,0 +1,29 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function g(code) {
+ try {
+ if (typeof code === 'function') {
+ +Symbol();
+ } else {
+ eval();
+ }
+ } catch (e) {
+ return;
+ }
+ dummy();
+}
+
+function f() {
+ g(g);
+}
+
+try { g(); } catch(e) {; }
+
+%PrepareFunctionForOptimization(f);
+f();
+%OptimizeFunctionOnNextCall(f);
+f();
diff --git a/deps/v8/test/mjsunit/compiler/regress-932392.js b/deps/v8/test/mjsunit/compiler/regress-932392.js
new file mode 100644
index 0000000000..c98686fca4
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/regress-932392.js
@@ -0,0 +1,14 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function opt(flag){
+ ((flag||(Math.max(-0,0)))==0)
+}
+
+%PrepareFunctionForOptimization(opt);
+try{opt(false)}catch{}
+%OptimizeFunctionOnNextCall(opt)
+try{opt(false)}catch{}
diff --git a/deps/v8/test/mjsunit/compiler/regress-934175.js b/deps/v8/test/mjsunit/compiler/regress-934175.js
new file mode 100644
index 0000000000..af115862c1
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/regress-934175.js
@@ -0,0 +1,29 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+(function ShortcutEmptyStringAddRight() {
+ let ar = new Float32Array(1);
+ function opt(i){
+ return ar[i] + (NaN ? 0 : '');
+ }
+ %PrepareFunctionForOptimization(opt);
+ ar[0] = 42;
+ opt(1);
+ %OptimizeFunctionOnNextCall(opt);
+ assertEquals("42", opt(0));
+})();
+
+(function ShortcutiEmptyStringAddLeft() {
+ let ar = new Float32Array(1);
+ function opt(i){
+ return (NaN ? 0 : '') + ar[i];
+ }
+ %PrepareFunctionForOptimization(opt);
+ ar[0] = 42;
+ opt(1);
+ %OptimizeFunctionOnNextCall(opt);
+ assertEquals("42", opt(0));
+})();
diff --git a/deps/v8/test/mjsunit/compiler/regress-944062-1.js b/deps/v8/test/mjsunit/compiler/regress-944062-1.js
new file mode 100644
index 0000000000..268999c881
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/regress-944062-1.js
@@ -0,0 +1,25 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+const array = [42, 2.1]; // non-stable map (PACKED_DOUBLE)
+let b = false;
+
+function f() {
+ if (b) array[100000] = 4.2; // go to dictionary mode
+ return 42
+};
+%NeverOptimizeFunction(f);
+
+function includes() {
+ return array.includes(f());
+}
+
+assertTrue(includes());
+assertTrue(includes());
+%OptimizeFunctionOnNextCall(includes);
+assertTrue(includes());
+b = true;
+assertTrue(includes());
diff --git a/deps/v8/test/mjsunit/compiler/regress-944062-2.js b/deps/v8/test/mjsunit/compiler/regress-944062-2.js
new file mode 100644
index 0000000000..89f06b5452
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/regress-944062-2.js
@@ -0,0 +1,17 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function includes(key, array) {
+ // Transition to dictionary mode in the final invocation.
+ array.__defineSetter__(key, () => {});
+ // Will then read OOB.
+ return array.includes(1234);
+}
+includes("", []);
+includes("", []);
+%OptimizeFunctionOnNextCall(includes);
+includes("", []);
+includes("1235", []);
diff --git a/deps/v8/test/mjsunit/compiler/regress-arguments.js b/deps/v8/test/mjsunit/compiler/regress-arguments.js
index d32b435ff3..70ce05f628 100644
--- a/deps/v8/test/mjsunit/compiler/regress-arguments.js
+++ b/deps/v8/test/mjsunit/compiler/regress-arguments.js
@@ -37,14 +37,19 @@ function h() { return f.apply(void 0, arguments); }
var foo = 42;
+%PrepareFunctionForOptimization(f);
+f();
+%OptimizeFunctionOnNextCall(f);
+f();
+
+%PrepareFunctionForOptimization(g);
for (var i = 0; i < 3; i++) assertEquals(42, g());
%OptimizeFunctionOnNextCall(g);
-%OptimizeFunctionOnNextCall(f);
assertEquals(42, g());
+%PrepareFunctionForOptimization(h);
for (var i = 0; i < 3; i++) assertEquals(42, h());
%OptimizeFunctionOnNextCall(h);
-%OptimizeFunctionOnNextCall(f);
assertEquals(42, h());
var G1 = 21;
@@ -58,7 +63,7 @@ function u() {
Number.prototype.foo = 42;
delete Number.prototype.foo;
+%PrepareFunctionForOptimization(u);
for (var i = 0; i < 3; i++) assertEquals(void 0, u());
%OptimizeFunctionOnNextCall(u);
-%OptimizeFunctionOnNextCall(f);
assertEquals(void 0, u());
diff --git a/deps/v8/test/mjsunit/compiler/regress-closures-with-eval.js b/deps/v8/test/mjsunit/compiler/regress-closures-with-eval.js
index d95d128a9d..2fdbbc3bce 100644
--- a/deps/v8/test/mjsunit/compiler/regress-closures-with-eval.js
+++ b/deps/v8/test/mjsunit/compiler/regress-closures-with-eval.js
@@ -47,8 +47,9 @@ function makeTagInfoJSON(n) {
return a;
}
-var expr = '([' + makeTagInfoJSON(128).join(', ') + '])'
+var expr = '([' + makeTagInfoJSON(128).join(', ') + '])';
+%PrepareFunctionForOptimization(withEval);
for (var n = 0; n < 5; n++) {
withEval(expr, function(a) { return a; });
}
diff --git a/deps/v8/test/mjsunit/compiler/regress-compare-negate.js b/deps/v8/test/mjsunit/compiler/regress-compare-negate.js
index e18d6a0f0e..ac420c9514 100644
--- a/deps/v8/test/mjsunit/compiler/regress-compare-negate.js
+++ b/deps/v8/test/mjsunit/compiler/regress-compare-negate.js
@@ -11,6 +11,7 @@ function CompareNegate(a,b) {
return a < (sub|0);
}
+%PrepareFunctionForOptimization(CompareNegate);
var x = CompareNegate(1,0x80000000);
%OptimizeFunctionOnNextCall(CompareNegate);
CompareNegate(1,0x80000000);
diff --git a/deps/v8/test/mjsunit/compiler/regress-const.js b/deps/v8/test/mjsunit/compiler/regress-const.js
index 5099c2f629..1c89368e6f 100644
--- a/deps/v8/test/mjsunit/compiler/regress-const.js
+++ b/deps/v8/test/mjsunit/compiler/regress-const.js
@@ -41,15 +41,20 @@ function g() {
return x;
}
+%PrepareFunctionForOptimization(f);
for (var i = 0; i < 5; i++) {
f();
- g();
}
-
%OptimizeFunctionOnNextCall(f);
-%OptimizeFunctionOnNextCall(g);
assertEquals(1, f());
+
+%PrepareFunctionForOptimization(g);
+for (var i = 0; i < 5; i++) {
+ g();
+}
+%OptimizeFunctionOnNextCall(g);
+
assertEquals(42, g());
@@ -59,6 +64,8 @@ function h(a, b) {
return r + X;
}
+%PrepareFunctionForOptimization(h);
+
for (var i = 0; i < 5; i++) h(1,2);
%OptimizeFunctionOnNextCall(h);
diff --git a/deps/v8/test/mjsunit/compiler/regress-crbug-540593.js b/deps/v8/test/mjsunit/compiler/regress-crbug-540593.js
index ec68e85771..46c40cfa32 100644
--- a/deps/v8/test/mjsunit/compiler/regress-crbug-540593.js
+++ b/deps/v8/test/mjsunit/compiler/regress-crbug-540593.js
@@ -10,5 +10,6 @@ var __f_2 = (function(stdlib) {
function __f_2() { return __v_3(); }
return __f_2;
})(this);
+%PrepareFunctionForOptimization(__f_2);
%OptimizeFunctionOnNextCall(__f_2);
__f_2();
diff --git a/deps/v8/test/mjsunit/compiler/regress-dead-throw-inlining.js b/deps/v8/test/mjsunit/compiler/regress-dead-throw-inlining.js
index 097a20bc41..df5b61195a 100644
--- a/deps/v8/test/mjsunit/compiler/regress-dead-throw-inlining.js
+++ b/deps/v8/test/mjsunit/compiler/regress-dead-throw-inlining.js
@@ -7,6 +7,7 @@
function g() { if (false) throw 0; }
function f() { g(); }
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-escape-analysis-indirect.js b/deps/v8/test/mjsunit/compiler/regress-escape-analysis-indirect.js
index 01f3e13466..255a70a2a1 100644
--- a/deps/v8/test/mjsunit/compiler/regress-escape-analysis-indirect.js
+++ b/deps/v8/test/mjsunit/compiler/regress-escape-analysis-indirect.js
@@ -9,6 +9,7 @@ function f(apply) {
apply(function bogeyman() { value = 42 });
return value;
}
+%PrepareFunctionForOptimization(f);
function apply(fun) { fun() }
assertEquals(42, f(apply));
assertEquals(42, f(apply));
diff --git a/deps/v8/test/mjsunit/compiler/regress-f64-w32-change.js b/deps/v8/test/mjsunit/compiler/regress-f64-w32-change.js
index 834da290e0..71badcb362 100644
--- a/deps/v8/test/mjsunit/compiler/regress-f64-w32-change.js
+++ b/deps/v8/test/mjsunit/compiler/regress-f64-w32-change.js
@@ -19,5 +19,6 @@ var f = (function () {
return f;
})();
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
assertEquals(0, f(0, -1));
diff --git a/deps/v8/test/mjsunit/compiler/regress-funarguments.js b/deps/v8/test/mjsunit/compiler/regress-funarguments.js
index c913bd9521..98c45aa916 100644
--- a/deps/v8/test/mjsunit/compiler/regress-funarguments.js
+++ b/deps/v8/test/mjsunit/compiler/regress-funarguments.js
@@ -62,16 +62,26 @@ function hej(x) {
return o.g(x, "z");
}
-function opt() {
+function opt_g() {
+ %PrepareFunctionForOptimization(o.g);
for (var k=0; k<2; k++) {
for (var i=0; i<5; i++) o.g(i, "g");
- for (var j=0; j<5; j++) hej(j);
}
%OptimizeFunctionOnNextCall(o.g);
+ o.g(0, "g");
+}
+
+function opt_hej() {
+ %PrepareFunctionForOptimization(hej);
+ for (var k=0; k<2; k++) {
+ for (var j=0; j<5; j++) hej(j);
+ }
%OptimizeFunctionOnNextCall(hej);
+ hej(0)
}
-opt();
+opt_g();
+opt_hej();
assertArrayEquals([0, "g"], o.g(0, "g"));
assertArrayEquals([1, "f"], o.g(1, "g"));
assertArrayEquals([0, "h"], hej(0));
@@ -79,7 +89,8 @@ assertArrayEquals([1, "f"], hej(1));
o = new B();
-opt();
+opt_g();
+opt_hej();
assertArrayEquals([0, "f"], o.g(0, "g"));
assertArrayEquals([1, "g"], o.g(1, "g"));
assertArrayEquals([0, "f"], hej(0));
diff --git a/deps/v8/test/mjsunit/compiler/regress-funcaller.js b/deps/v8/test/mjsunit/compiler/regress-funcaller.js
index 5c2a59720b..1cb7f962af 100644
--- a/deps/v8/test/mjsunit/compiler/regress-funcaller.js
+++ b/deps/v8/test/mjsunit/compiler/regress-funcaller.js
@@ -42,6 +42,7 @@ A.prototype.g = gee;
var o = new A();
+%PrepareFunctionForOptimization(o.g);
for (var i=0; i<5; i++) {
o.g(i);
}
@@ -56,6 +57,7 @@ function hej(x) {
return o.g(x);
}
+%PrepareFunctionForOptimization(hej);
for (var j=0; j<5; j++) {
hej(j);
}
@@ -70,6 +72,7 @@ function from_eval(x) {
return o.g(x);
}
+%PrepareFunctionForOptimization(from_eval);
for (var j=0; j<5; j++) {
from_eval(j);
}
diff --git a/deps/v8/test/mjsunit/compiler/regress-gvn.js b/deps/v8/test/mjsunit/compiler/regress-gvn.js
index 7055e34924..cafb778d38 100644
--- a/deps/v8/test/mjsunit/compiler/regress-gvn.js
+++ b/deps/v8/test/mjsunit/compiler/regress-gvn.js
@@ -37,6 +37,8 @@ function test(a) {
return a[0];
}
+%PrepareFunctionForOptimization(test);
+
var a = new Array();
var n = 100;
diff --git a/deps/v8/test/mjsunit/compiler/regress-inline-callfunctionstub.js b/deps/v8/test/mjsunit/compiler/regress-inline-callfunctionstub.js
index 33655346a8..1c391bb3ab 100644
--- a/deps/v8/test/mjsunit/compiler/regress-inline-callfunctionstub.js
+++ b/deps/v8/test/mjsunit/compiler/regress-inline-callfunctionstub.js
@@ -38,6 +38,7 @@ function main(func) {
}
}
+%PrepareFunctionForOptimization(main);
main(o.g);
main(o.g);
main(o.g);
diff --git a/deps/v8/test/mjsunit/compiler/regress-intoverflow.js b/deps/v8/test/mjsunit/compiler/regress-intoverflow.js
index 063a376148..6c0388be07 100644
--- a/deps/v8/test/mjsunit/compiler/regress-intoverflow.js
+++ b/deps/v8/test/mjsunit/compiler/regress-intoverflow.js
@@ -36,6 +36,7 @@ function testMul(a, b) {
}
}
+%PrepareFunctionForOptimization(testMul);
for (var i=0; i<5; i++) testMul(0,0);
%OptimizeFunctionOnNextCall(testMul);
assertEquals(4611686018427388000, testMul(-0x40000000, -0x40000000));
@@ -48,6 +49,7 @@ function testAdd(a, b) {
}
}
+%PrepareFunctionForOptimization(testAdd);
for (var i=0; i<5; i++) testAdd(0,0);
%OptimizeFunctionOnNextCall(testAdd);
assertEquals(-4294967296, testAdd(-0x40000000, -0x40000000));
@@ -62,6 +64,7 @@ function testSub(a, b) {
}
}
+%PrepareFunctionForOptimization(testSub);
for (var i=0; i<5; i++) testSub(0,0);
%OptimizeFunctionOnNextCall(testSub);
assertEquals(-2147483650, testSub(-0x40000000, 1));
diff --git a/deps/v8/test/mjsunit/compiler/regress-lazy-deopt.js b/deps/v8/test/mjsunit/compiler/regress-lazy-deopt.js
index 766220763b..a0d777fb34 100644
--- a/deps/v8/test/mjsunit/compiler/regress-lazy-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/regress-lazy-deopt.js
@@ -41,6 +41,7 @@ function f(x, y) {
return x >> a[0];
}
+%PrepareFunctionForOptimization(f);
f(42);
f(42);
assertEquals(42, f(42));
diff --git a/deps/v8/test/mjsunit/compiler/regress-lbranch-double.js b/deps/v8/test/mjsunit/compiler/regress-lbranch-double.js
index dca6d5bace..304e9a95d8 100644
--- a/deps/v8/test/mjsunit/compiler/regress-lbranch-double.js
+++ b/deps/v8/test/mjsunit/compiler/regress-lbranch-double.js
@@ -34,6 +34,7 @@ function foo() {
return Math.sqrt(2.6415) ? 88 : 99;
}
+%PrepareFunctionForOptimization(foo);
assertEquals(88, foo());
assertEquals(88, foo());
%OptimizeFunctionOnNextCall(foo)
diff --git a/deps/v8/test/mjsunit/compiler/regress-loadfield.js b/deps/v8/test/mjsunit/compiler/regress-loadfield.js
index a3da156e3b..f8a9891da8 100644
--- a/deps/v8/test/mjsunit/compiler/regress-loadfield.js
+++ b/deps/v8/test/mjsunit/compiler/regress-loadfield.js
@@ -46,6 +46,8 @@ function test(a) {
}
}
+%PrepareFunctionForOptimization(test);
+
// Create an object with fast backing store properties.
var a = {};
a.p1 = "";
diff --git a/deps/v8/test/mjsunit/compiler/regress-math-sign-nan-type.js b/deps/v8/test/mjsunit/compiler/regress-math-sign-nan-type.js
index e16eba8c5a..43f06bd0c6 100644
--- a/deps/v8/test/mjsunit/compiler/regress-math-sign-nan-type.js
+++ b/deps/v8/test/mjsunit/compiler/regress-math-sign-nan-type.js
@@ -8,6 +8,7 @@ function f(a) {
return Math.sign(+a) < 2;
}
+%PrepareFunctionForOptimization(f);
f(NaN);
f(NaN);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-number-is-hole-nan.js b/deps/v8/test/mjsunit/compiler/regress-number-is-hole-nan.js
index 368c837163..0b618a1003 100644
--- a/deps/v8/test/mjsunit/compiler/regress-number-is-hole-nan.js
+++ b/deps/v8/test/mjsunit/compiler/regress-number-is-hole-nan.js
@@ -8,6 +8,7 @@ var a = [, 2.121736758e-314];
function foo() { return a[1]; }
+%PrepareFunctionForOptimization(foo);
assertEquals(2.121736758e-314, foo());
assertEquals(2.121736758e-314, foo());
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-or.js b/deps/v8/test/mjsunit/compiler/regress-or.js
index 939f2c3ffa..e65a5546d9 100644
--- a/deps/v8/test/mjsunit/compiler/regress-or.js
+++ b/deps/v8/test/mjsunit/compiler/regress-or.js
@@ -38,6 +38,7 @@ function f1(x) {
function g1() { try { return 1; } finally {} }
+%PrepareFunctionForOptimization(f1);
for (var i = 0; i < 5; i++) f1(42);
%OptimizeFunctionOnNextCall(f1);
@@ -55,6 +56,7 @@ function f2(x) {
function g2() { try { return 0; } finally {} }
+%PrepareFunctionForOptimization(f2);
for (var i = 0; i < 5; i++) f2(42);
%OptimizeFunctionOnNextCall(f2);
diff --git a/deps/v8/test/mjsunit/compiler/regress-rep-change.js b/deps/v8/test/mjsunit/compiler/regress-rep-change.js
index c8a0983c44..a0a0add1b9 100644
--- a/deps/v8/test/mjsunit/compiler/regress-rep-change.js
+++ b/deps/v8/test/mjsunit/compiler/regress-rep-change.js
@@ -37,6 +37,8 @@ function test(start) {
for (var i = start; i < 10; i++) { }
}
+%PrepareFunctionForOptimization(test);
+
var n = 3;
for (var i = 0; i < n; ++i) {
diff --git a/deps/v8/test/mjsunit/compiler/regress-shared-deopt.js b/deps/v8/test/mjsunit/compiler/regress-shared-deopt.js
index 669e0e2f1d..f1479bac9e 100644
--- a/deps/v8/test/mjsunit/compiler/regress-shared-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/regress-shared-deopt.js
@@ -47,11 +47,13 @@ function test() {
}
}
+ %PrepareFunctionForOptimization(f4);
f4(9);
f4(11);
%OptimizeFunctionOnNextCall(f4);
f4(12);
+ %PrepareFunctionForOptimization(f5);
f5(9);
f5(11);
%OptimizeFunctionOnNextCall(f5);
diff --git a/deps/v8/test/mjsunit/compiler/regress-shift-left.js b/deps/v8/test/mjsunit/compiler/regress-shift-left.js
index 110e899729..ce9dde4e91 100644
--- a/deps/v8/test/mjsunit/compiler/regress-shift-left.js
+++ b/deps/v8/test/mjsunit/compiler/regress-shift-left.js
@@ -14,6 +14,7 @@
return 1 << tmp1;
}
+ %PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
assertEquals(512, f());
})();
@@ -36,6 +37,7 @@
return f;
})();
+ %PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
assertEquals(512, f());
})();
diff --git a/deps/v8/test/mjsunit/compiler/regress-shift-right-logical.js b/deps/v8/test/mjsunit/compiler/regress-shift-right-logical.js
index f2be2ad52f..41ea33ae33 100644
--- a/deps/v8/test/mjsunit/compiler/regress-shift-right-logical.js
+++ b/deps/v8/test/mjsunit/compiler/regress-shift-right-logical.js
@@ -14,6 +14,7 @@
return 1 >>> tmp1;
}
+ %PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
assertEquals(0, f());
})();
@@ -36,6 +37,7 @@
return f;
})();
+ %PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
assertEquals(0, f());
})();
diff --git a/deps/v8/test/mjsunit/compiler/regress-shift-right.js b/deps/v8/test/mjsunit/compiler/regress-shift-right.js
index 71bcb21f0e..45ee9ef77c 100644
--- a/deps/v8/test/mjsunit/compiler/regress-shift-right.js
+++ b/deps/v8/test/mjsunit/compiler/regress-shift-right.js
@@ -14,6 +14,7 @@
return 1 >> tmp1;
}
+ %PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
assertEquals(0, f());
})();
@@ -36,6 +37,7 @@
return f;
})();
+ %PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
assertEquals(0, f());
})();
diff --git a/deps/v8/test/mjsunit/compiler/regress-stacktrace-methods.js b/deps/v8/test/mjsunit/compiler/regress-stacktrace-methods.js
index 4d2872793d..ff3fac7f7e 100644
--- a/deps/v8/test/mjsunit/compiler/regress-stacktrace-methods.js
+++ b/deps/v8/test/mjsunit/compiler/regress-stacktrace-methods.js
@@ -41,10 +41,16 @@ var o = new Hest();
var s = new Svin();
var v = 0;
+%PrepareFunctionForOptimization(Hest.prototype.one);
for (var i = 0; i < 5; i++) {
o.one(s);
}
%OptimizeFunctionOnNextCall(Hest.prototype.one);
+o.one(s);
+%PrepareFunctionForOptimization(Hest.prototype.three);
+for (var i = 0; i < 5; i++) {
+ o.one(s);
+}
%OptimizeFunctionOnNextCall(Hest.prototype.three);
o.one(s);
@@ -65,5 +71,5 @@ try {
assertTrue(stack.indexOf("38:56") != -1);
assertTrue(stack.indexOf("34:51") != -1);
assertTrue(stack.indexOf("36:38") != -1);
- assertTrue(stack.indexOf("54:5") != -1);
+ assertTrue(stack.indexOf("60:5") != -1);
}
diff --git a/deps/v8/test/mjsunit/compiler/regress-store-holey-double-array.js b/deps/v8/test/mjsunit/compiler/regress-store-holey-double-array.js
index 81231984e0..2daca73bbf 100644
--- a/deps/v8/test/mjsunit/compiler/regress-store-holey-double-array.js
+++ b/deps/v8/test/mjsunit/compiler/regress-store-holey-double-array.js
@@ -19,6 +19,7 @@
var a = [,0.1];
+ %PrepareFunctionForOptimization(g);
g(f64, a, 1);
g(f64, a, 1);
%OptimizeFunctionOnNextCall(g);
@@ -35,6 +36,8 @@
}
var a=[,0.1];
+
+ %PrepareFunctionForOptimization(g);
g(a, 1);
g(a, 1);
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/regress-string-to-number-add.js b/deps/v8/test/mjsunit/compiler/regress-string-to-number-add.js
index 0d524d20fd..4ba83a2774 100644
--- a/deps/v8/test/mjsunit/compiler/regress-string-to-number-add.js
+++ b/deps/v8/test/mjsunit/compiler/regress-string-to-number-add.js
@@ -9,6 +9,7 @@ function f(x) {
return 1 + Number(s);
}
+%PrepareFunctionForOptimization(f);
f(0);
f(0);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-toint32.js b/deps/v8/test/mjsunit/compiler/regress-toint32.js
index 75892d4775..9840a33036 100644
--- a/deps/v8/test/mjsunit/compiler/regress-toint32.js
+++ b/deps/v8/test/mjsunit/compiler/regress-toint32.js
@@ -38,6 +38,7 @@ function f(x) {
return v;
}
+%PrepareFunctionForOptimization(f);
assertEquals(G, f(G));
assertEquals(G, f(G));
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-truncate-number-or-undefined-to-float64.js b/deps/v8/test/mjsunit/compiler/regress-truncate-number-or-undefined-to-float64.js
index 1dc3042ea7..7cae7bcaef 100644
--- a/deps/v8/test/mjsunit/compiler/regress-truncate-number-or-undefined-to-float64.js
+++ b/deps/v8/test/mjsunit/compiler/regress-truncate-number-or-undefined-to-float64.js
@@ -13,6 +13,7 @@ function g(a, b) {
return +a;
}
+%PrepareFunctionForOptimization(g);
g(0);
g(0);
%OptimizeFunctionOnNextCall(g);
diff --git a/deps/v8/test/mjsunit/compiler/regress-v8-5573.js b/deps/v8/test/mjsunit/compiler/regress-v8-5573.js
index 216b791a71..2ac503dbf4 100644
--- a/deps/v8/test/mjsunit/compiler/regress-v8-5573.js
+++ b/deps/v8/test/mjsunit/compiler/regress-v8-5573.js
@@ -11,5 +11,6 @@ function f() {
return !global;
}
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
assertTrue(f());
diff --git a/deps/v8/test/mjsunit/compiler/regress-v8-5756.js b/deps/v8/test/mjsunit/compiler/regress-v8-5756.js
index b7bfcda52b..f84b6f0179 100644
--- a/deps/v8/test/mjsunit/compiler/regress-v8-5756.js
+++ b/deps/v8/test/mjsunit/compiler/regress-v8-5756.js
@@ -22,6 +22,7 @@ function k() {
}
function f1() {
+ %PrepareFunctionForOptimization(k);
z.toString = k;
z.toString();
z.toString();
diff --git a/deps/v8/test/mjsunit/compiler/regress-v8-6077.js b/deps/v8/test/mjsunit/compiler/regress-v8-6077.js
index 0e469882cf..f46b2dba7b 100644
--- a/deps/v8/test/mjsunit/compiler/regress-v8-6077.js
+++ b/deps/v8/test/mjsunit/compiler/regress-v8-6077.js
@@ -63,6 +63,7 @@ for (var i = 0; i < f32.length; i++) {
s += i;
}
+%PrepareFunctionForOptimization(foo);
foo(f32, 0);
foo(f32, 0);
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/regress-v8-6631.js b/deps/v8/test/mjsunit/compiler/regress-v8-6631.js
index 58fe360f05..a28594a1ba 100644
--- a/deps/v8/test/mjsunit/compiler/regress-v8-6631.js
+++ b/deps/v8/test/mjsunit/compiler/regress-v8-6631.js
@@ -16,6 +16,7 @@ function f() {
return g(h({}))
};
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-variable-liveness-let.js b/deps/v8/test/mjsunit/compiler/regress-variable-liveness-let.js
index 4c6b6936e5..81b55f7a2f 100644
--- a/deps/v8/test/mjsunit/compiler/regress-variable-liveness-let.js
+++ b/deps/v8/test/mjsunit/compiler/regress-variable-liveness-let.js
@@ -11,5 +11,6 @@ function f() {
let x = 23;
}
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
f();
diff --git a/deps/v8/test/mjsunit/compiler/regress-variable-liveness.js b/deps/v8/test/mjsunit/compiler/regress-variable-liveness.js
index e18741d96e..086275c2f5 100644
--- a/deps/v8/test/mjsunit/compiler/regress-variable-liveness.js
+++ b/deps/v8/test/mjsunit/compiler/regress-variable-liveness.js
@@ -17,6 +17,7 @@ function run() {
}
}
+%PrepareFunctionForOptimization(run);
assertEquals(void 0, run());
%OptimizeFunctionOnNextCall(run);
assertEquals(void 0, run());
diff --git a/deps/v8/test/mjsunit/compiler/regresss-933331.js b/deps/v8/test/mjsunit/compiler/regresss-933331.js
new file mode 100644
index 0000000000..a4af3a08f9
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/regresss-933331.js
@@ -0,0 +1,21 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function opt(r, flag){
+ var x;
+ for(let i = 0; i < 2; i++){
+ r[2] = 0;
+ x = r[0] << (flag ? r[0] : flag)
+ }
+ return x;
+}
+
+ar = [3.1];
+%PrepareFunctionForOptimization(opt);
+opt(ar,1);
+opt(ar,1);
+%OptimizeFunctionOnNextCall(opt);
+assertEquals(24, opt(ar,1));
diff --git a/deps/v8/test/mjsunit/compiler/rest-parameters.js b/deps/v8/test/mjsunit/compiler/rest-parameters.js
index 45b8cb34df..425dc1e13a 100644
--- a/deps/v8/test/mjsunit/compiler/rest-parameters.js
+++ b/deps/v8/test/mjsunit/compiler/rest-parameters.js
@@ -14,6 +14,8 @@ function test(...rest) {
return [rest, f.apply(null, rest)];
}
+%PrepareFunctionForOptimization(test);
+
assertEquals(test(), [[], NaN]);
assertEquals(test(1), [[1], NaN])
assertEquals(test(1, 2), [[1,2], 3]);
@@ -37,6 +39,8 @@ function test(a, ...rest) {
return [rest, a, f.apply(null, rest)];
}
+%PrepareFunctionForOptimization(test);
+
assertEquals(test(), [[], undefined, NaN]);
assertEquals(test(1), [[], 1, NaN]);
assertEquals(test(1, 2), [[2], 1, NaN]);
diff --git a/deps/v8/test/mjsunit/compiler/rotate.js b/deps/v8/test/mjsunit/compiler/rotate.js
index 1c81e496ea..b49f4f9751 100644
--- a/deps/v8/test/mjsunit/compiler/rotate.js
+++ b/deps/v8/test/mjsunit/compiler/rotate.js
@@ -64,27 +64,32 @@ function ROR4(x, sa) {
return (x << (sa)) | (x >>> (32 - sa));
}
+%PrepareFunctionForOptimization(ROR);
assertEquals(1 << ((2 % 32)), ROR(1, 30));
assertEquals(1 << ((2 % 32)), ROR(1, 30));
%OptimizeFunctionOnNextCall(ROR);
assertEquals(1 << ((2 % 32)), ROR(1, 30));
+%PrepareFunctionForOptimization(ROR1);
assertEquals(0xF0000FFF | 0, ROR1(0x0000FFFF, 4));
assertEquals(0xF0000FFF | 0, ROR1(0x0000FFFF, 4));
%OptimizeFunctionOnNextCall(ROR1);
assertEquals(0xF0000FFF | 0, ROR1(0x0000FFFF, 4));
+%PrepareFunctionForOptimization(ROR1);
assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, 20));
assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, 20));
%OptimizeFunctionOnNextCall(ROR1);
assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, 20));
+%PrepareFunctionForOptimization(ROR1);
assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, Twenty()));
assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, Twenty()));
%OptimizeFunctionOnNextCall(ROR1);
assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, Twenty()));
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR1);
assertEquals(0xFFFFFFFF | 0, ROR1(0xFFFFFFFF, i));
assertEquals(0xFFFFFFFF | 0, ROR1(0xFFFFFFFF, i));
%OptimizeFunctionOnNextCall(ROR1);
@@ -92,6 +97,7 @@ for (var i = 0; i <= 100; i++) {
}
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR1);
assertEquals(-1, ROR1(-1, i));
assertEquals(-1, ROR1(-1, i));
%OptimizeFunctionOnNextCall(ROR1);
@@ -99,6 +105,7 @@ for (var i = 0; i <= 100; i++) {
}
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR1);
assertEquals(1 << (32 - (i % 32)), ROR1(1, i));
assertEquals(1 << (32 - (i % 32)), ROR1(1, i));
%OptimizeFunctionOnNextCall(ROR1);
@@ -106,6 +113,7 @@ for (var i = 0; i <= 100; i++) {
}
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR1);
assertEquals(1 << (32 - (i % 32)), ROR1(1.4, i));
assertEquals(1 << (32 - (i % 32)), ROR1(1.4, i));
%OptimizeFunctionOnNextCall(ROR1);
@@ -114,22 +122,26 @@ for (var i = 0; i <= 100; i++) {
+%PrepareFunctionForOptimization(ROR2);
assertEquals(0xF0000FFF | 0, ROR2(0x0000FFFF, 28));
assertEquals(0xF0000FFF | 0, ROR2(0x0000FFFF, 28));
%OptimizeFunctionOnNextCall(ROR2);
assertEquals(0xF0000FFF | 0, ROR2(0x0000FFFF, 28));
+%PrepareFunctionForOptimization(ROR2);
assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, 12));
assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, 12));
%OptimizeFunctionOnNextCall(ROR2);
assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, 12));
+%PrepareFunctionForOptimization(ROR2);
assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, Twelve()));
assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, Twelve()));
%OptimizeFunctionOnNextCall(ROR2);
assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, Twelve()));
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR2);
assertEquals(0xFFFFFFFF | 0, ROR2(0xFFFFFFFF, i));
assertEquals(0xFFFFFFFF | 0, ROR2(0xFFFFFFFF, i));
%OptimizeFunctionOnNextCall(ROR2);
@@ -137,6 +149,7 @@ for (var i = 0; i <= 100; i++) {
}
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR2);
assertEquals(-1, ROR2(-1, i));
assertEquals(-1, ROR2(-1, i));
%OptimizeFunctionOnNextCall(ROR2);
@@ -144,28 +157,33 @@ for (var i = 0; i <= 100; i++) {
}
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR2);
assertEquals(1 << ((i % 32)), ROR2(1, i));
assertEquals(1 << ((i % 32)), ROR2(1, i));
%OptimizeFunctionOnNextCall(ROR2);
assertEquals(1 << ((i % 32)), ROR2(1, i));
}
+%PrepareFunctionForOptimization(ROR3);
assertEquals(0xF0000FFF | 0, ROR3(0x0000FFFF, 4));
assertEquals(0xF0000FFF | 0, ROR3(0x0000FFFF, 4));
%OptimizeFunctionOnNextCall(ROR3);
assertEquals(0xF0000FFF | 0, ROR3(0x0000FFFF, 4));
+%PrepareFunctionForOptimization(ROR3);
assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, 20));
assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, 20));
%OptimizeFunctionOnNextCall(ROR3);
assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, 20));
+%PrepareFunctionForOptimization(ROR3);
assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, Twenty()));
assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, Twenty()));
%OptimizeFunctionOnNextCall(ROR3);
assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, Twenty()));
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR3);
assertEquals(0xFFFFFFFF | 0, ROR3(0xFFFFFFFF, i));
assertEquals(0xFFFFFFFF | 0, ROR3(0xFFFFFFFF, i));
%OptimizeFunctionOnNextCall(ROR3);
@@ -173,6 +191,7 @@ for (var i = 0; i <= 100; i++) {
}
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR3);
assertEquals(-1, ROR3(-1, i));
assertEquals(-1, ROR3(-1, i));
%OptimizeFunctionOnNextCall(ROR3);
@@ -180,28 +199,33 @@ for (var i = 0; i <= 100; i++) {
}
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR3);
assertEquals(1 << (32 - (i % 32)), ROR3(1, i));
assertEquals(1 << (32 - (i % 32)), ROR3(1, i));
%OptimizeFunctionOnNextCall(ROR3);
assertEquals(1 << (32 - (i % 32)), ROR3(1, i));
}
+%PrepareFunctionForOptimization(ROR4);
assertEquals(0xF0000FFF | 0, ROR4(0x0000FFFF, 28));
assertEquals(0xF0000FFF | 0, ROR4(0x0000FFFF, 28));
%OptimizeFunctionOnNextCall(ROR4);
assertEquals(0xF0000FFF | 0, ROR4(0x0000FFFF, 28));
+%PrepareFunctionForOptimization(ROR4);
assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, 12));
assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, 12));
%OptimizeFunctionOnNextCall(ROR4);
assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, 12));
+%PrepareFunctionForOptimization(ROR4);
assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, Twelve()));
assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, Twelve()));
%OptimizeFunctionOnNextCall(ROR4);
assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, Twelve()));
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR4);
assertEquals(0xFFFFFFFF | 0, ROR4(0xFFFFFFFF, i));
assertEquals(0xFFFFFFFF | 0, ROR4(0xFFFFFFFF, i));
%OptimizeFunctionOnNextCall(ROR4);
@@ -209,6 +233,7 @@ for (var i = 0; i <= 100; i++) {
}
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR4);
assertEquals(-1, ROR4(-1, i));
assertEquals(-1, ROR4(-1, i));
%OptimizeFunctionOnNextCall(ROR4);
@@ -216,6 +241,7 @@ for (var i = 0; i <= 100; i++) {
}
for (var i = 0; i <= 100; i++) {
+ %PrepareFunctionForOptimization(ROR4);
assertEquals(1 << ((i % 32)), ROR4(1, i));
assertEquals(1 << ((i % 32)), ROR4(1, i));
%OptimizeFunctionOnNextCall(ROR4);
@@ -260,48 +286,56 @@ function ROR4_sa40(x) {
}
// ROR1_sa20
+%PrepareFunctionForOptimization(ROR1_sa20);
assertEquals(ROR1(0x0000FFFF, 20), ROR1_sa20(0x0000FFFF));
assertEquals(ROR1(0x0000FFFF, 20), ROR1_sa20(0x0000FFFF));
%OptimizeFunctionOnNextCall(ROR1_sa20);
assertEquals(ROR1(0x0000FFFF, 20), ROR1_sa20(0x0000FFFF));
// ROR1_sa40
+%PrepareFunctionForOptimization(ROR1_sa40);
assertEquals(ROR1(0x0000FFFF, 40), ROR1_sa40(0x0000FFFF));
assertEquals(ROR1(0x0000FFFF, 40), ROR1_sa40(0x0000FFFF));
%OptimizeFunctionOnNextCall(ROR1_sa40);
assertEquals(ROR1(0x0000FFFF, 40), ROR1_sa40(0x0000FFFF));
// ROR2_sa20
+%PrepareFunctionForOptimization(ROR2_sa20);
assertEquals(ROR2(0xFFFFFFFF, 20), ROR2_sa20(0xFFFFFFFF));
assertEquals(ROR2(0xFFFFFFFF, 20), ROR2_sa20(0xFFFFFFFF));
%OptimizeFunctionOnNextCall(ROR2_sa20);
assertEquals(ROR2(0xFFFFFFFF, 20), ROR2_sa20(0xFFFFFFFF));
// ROR2_sa40
+%PrepareFunctionForOptimization(ROR2_sa40);
assertEquals(ROR2(0x0000FFFF, 40), ROR2_sa40(0x0000FFFF));
assertEquals(ROR2(0x0000FFFF, 40), ROR2_sa40(0x0000FFFF));
%OptimizeFunctionOnNextCall(ROR2_sa40);
assertEquals(ROR2(0x0000FFFF, 40), ROR2_sa40(0x0000FFFF));
// ROR3_sa20
+%PrepareFunctionForOptimization(ROR3_sa20);
assertEquals(ROR3(0x0000FFFF, 20), ROR3_sa20(0x0000FFFF));
assertEquals(ROR3(0x0000FFFF, 20), ROR3_sa20(0x0000FFFF));
%OptimizeFunctionOnNextCall(ROR3_sa20);
assertEquals(ROR3(0x0000FFFF, 20), ROR3_sa20(0x0000FFFF));
// ROR3_sa40
+%PrepareFunctionForOptimization(ROR3_sa40);
assertEquals(ROR3(0x0000FFFF, 40), ROR3_sa40(0x0000FFFF));
assertEquals(ROR3(0x0000FFFF, 40), ROR3_sa40(0x0000FFFF));
%OptimizeFunctionOnNextCall(ROR3_sa40);
assertEquals(ROR3(0x0000FFFF, 40), ROR3_sa40(0x0000FFFF));
// ROR4_sa20
+%PrepareFunctionForOptimization(ROR4_sa20);
assertEquals(ROR4(0x0000FFFF, 20), ROR4_sa20(0x0000FFFF));
assertEquals(ROR4(0x0000FFFF, 20), ROR4_sa20(0x0000FFFF));
%OptimizeFunctionOnNextCall(ROR4_sa20);
assertEquals(ROR4(0x0000FFFF, 20), ROR4_sa20(0x0000FFFF));
// ROR4_sa40
+%PrepareFunctionForOptimization(ROR4_sa40);
assertEquals(ROR4(0xFFFFFFFF, 40), ROR4_sa40(0xFFFFFFFF));
assertEquals(ROR4(0xFFFFFFFF, 40), ROR4_sa40(0xFFFFFFFF));
%OptimizeFunctionOnNextCall(ROR4_sa40);
diff --git a/deps/v8/test/mjsunit/compiler/shift-shr.js b/deps/v8/test/mjsunit/compiler/shift-shr.js
index c52ad43ac5..e2bf7abe52 100644
--- a/deps/v8/test/mjsunit/compiler/shift-shr.js
+++ b/deps/v8/test/mjsunit/compiler/shift-shr.js
@@ -19,6 +19,7 @@ function test_shr(left) {
return errors;
}
+%PrepareFunctionForOptimization(test_shr);
assertEquals(0, test_shr(1));
%OptimizeFunctionOnNextCall(test_shr);
for (var i = 5; i >= -5; i--) {
@@ -34,6 +35,7 @@ for (var i = 5; i >= -5; i--) {
return array[y];
}
+ %PrepareFunctionForOptimization(foo);
foo(111, true, new Array(42));
foo(111, true, new Array(42));
%OptimizeFunctionOnNextCall(foo);
@@ -48,6 +50,7 @@ for (var i = 5; i >= -5; i--) {
return array[y];
}
+ %PrepareFunctionForOptimization(foo);
foo(111, true, new Array(42));
foo(111, true, new Array(42));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/simple-deopt.js b/deps/v8/test/mjsunit/compiler/simple-deopt.js
index 7f985acc76..99b7ef3653 100644
--- a/deps/v8/test/mjsunit/compiler/simple-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/simple-deopt.js
@@ -61,6 +61,7 @@ obj.g = g;
function k(o) {
return o.g();
}
+%PrepareFunctionForOptimization(k);
for (var i = 0; i < 5; i++) k(obj);
%OptimizeFunctionOnNextCall(k);
k(obj);
@@ -92,6 +93,7 @@ assertEquals('lit[42]', LiteralToStack(42));
var str = "abc";
var r;
function CallCharAt(n) { return str.charAt(n); }
+%PrepareFunctionForOptimization(CallCharAt);
for (var i = 0; i < 5; i++) {
r = CallCharAt(0);
}
diff --git a/deps/v8/test/mjsunit/compiler/simple-inlining.js b/deps/v8/test/mjsunit/compiler/simple-inlining.js
index 8bd37eae20..3899cf0fc9 100644
--- a/deps/v8/test/mjsunit/compiler/simple-inlining.js
+++ b/deps/v8/test/mjsunit/compiler/simple-inlining.js
@@ -43,6 +43,7 @@ function TestInlineConstant(o) {
var o1 = {};
o1.f = function() { return 42; };
+%PrepareFunctionForOptimization(TestInlineConstant);
for (var i = 0; i < 5; i++) TestInlineConstant(o1);
%OptimizeFunctionOnNextCall(TestInlineConstant);
TestInlineConstant(o1);
@@ -65,6 +66,7 @@ function TestInlineThis(o) {
var o2 = {};
o2.g = function() { return this; };
+%PrepareFunctionForOptimization(TestInlineThis);
for (var i = 0; i < 5; i++) TestInlineThis(o2);
%OptimizeFunctionOnNextCall(TestInlineThis);
TestInlineThis(o2);
@@ -87,6 +89,7 @@ function TestInlineThisX(o) {
var o3 = {y:0,x:42};
o3.h = function() { return this.x; };
+%PrepareFunctionForOptimization(TestInlineThisX);
for (var i = 0; i < 5; i++) TestInlineThisX(o3);
%OptimizeFunctionOnNextCall(TestInlineThisX);
TestInlineThisX(o3);
@@ -109,6 +112,7 @@ function TestInlineThisXLength(o) {
var o4 = {x:[1,2,3]};
o4.h = function() { return this.x.length; };
+%PrepareFunctionForOptimization(TestInlineThisXLength);
for (var i = 0; i < 5; i++) TestInlineThisXLength(o4);
%OptimizeFunctionOnNextCall(TestInlineThisXLength);
TestInlineThisXLength(o4);
@@ -132,6 +136,7 @@ function TestInlineThisXY(o) {
var o6 = {y:42}
var o5 = {e:o6};
o5.h = function() { return this.e.y; };
+%PrepareFunctionForOptimization(TestInlineThisXY);
for (var i = 0; i < 5; i++) TestInlineThisXY(o5);
%OptimizeFunctionOnNextCall(TestInlineThisXY);
TestInlineThisXY(o5);
@@ -154,6 +159,7 @@ function TestInlineThisX0(o) {
var o7 = {x:[42,43,44]};
o7.foo = function() { return this.x[0]; };
+%PrepareFunctionForOptimization(TestInlineThisX0);
for (var i = 0; i < 5; i++) TestInlineThisX0(o7);
%OptimizeFunctionOnNextCall(TestInlineThisX0);
TestInlineThisX0(o7);
diff --git a/deps/v8/test/mjsunit/compiler/smi-stores-opt.js b/deps/v8/test/mjsunit/compiler/smi-stores-opt.js
index ca0923abc9..0ee7175396 100644
--- a/deps/v8/test/mjsunit/compiler/smi-stores-opt.js
+++ b/deps/v8/test/mjsunit/compiler/smi-stores-opt.js
@@ -43,6 +43,7 @@ function f() {
return [result, literal];
}
+%PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/spread-call.js b/deps/v8/test/mjsunit/compiler/spread-call.js
index 1b7ae6f301..0a8527ed76 100644
--- a/deps/v8/test/mjsunit/compiler/spread-call.js
+++ b/deps/v8/test/mjsunit/compiler/spread-call.js
@@ -27,6 +27,7 @@ function tests() {
assertEquals(0, countArgs(...arguments));
}
+%PrepareFunctionForOptimization(tests);
tests();
tests();
%OptimizeFunctionOnNextCall(tests);
@@ -38,6 +39,7 @@ function testRest(...args) {
assertEquals(4, countArgs(1, ...args));
assertEquals(5, countArgs(1, 2, ...args));
}
+%PrepareFunctionForOptimization(testRest);
testRest(1, 2, 3);
testRest(1, 2, 3);
%OptimizeFunctionOnNextCall(testRest);
@@ -51,6 +53,7 @@ function testRestAndArgs(a, b, ...args) {
assertEquals(4, countArgs(1, a, b, ...args));
assertEquals(5, countArgs(1, 2, a, b, ...args));
}
+%PrepareFunctionForOptimization(testRestAndArgs);
testRestAndArgs(1, 2, 3);
testRestAndArgs(1, 2, 3);
%OptimizeFunctionOnNextCall(testRestAndArgs);
@@ -63,6 +66,7 @@ function testArgumentsStrict() {
assertEquals(4, countArgs(1, ...arguments));
assertEquals(5, countArgs(1, 2, ...arguments));
}
+%PrepareFunctionForOptimization(testArgumentsStrict);
testArgumentsStrict(1, 2, 3);
testArgumentsStrict(1, 2, 3);
%OptimizeFunctionOnNextCall(testArgumentsStrict);
@@ -74,6 +78,7 @@ function testArgumentsSloppy() {
assertEquals(4, countArgs(1, ...arguments));
assertEquals(5, countArgs(1, 2, ...arguments));
}
+%PrepareFunctionForOptimization(testArgumentsSloppy);
testArgumentsSloppy(1, 2, 3);
testArgumentsSloppy(1, 2, 3);
%OptimizeFunctionOnNextCall(testArgumentsSloppy);
diff --git a/deps/v8/test/mjsunit/compiler/store-elimination.js b/deps/v8/test/mjsunit/compiler/store-elimination.js
index 1806ed963f..7defdd0060 100644
--- a/deps/v8/test/mjsunit/compiler/store-elimination.js
+++ b/deps/v8/test/mjsunit/compiler/store-elimination.js
@@ -81,6 +81,7 @@ function killall() {
%NeverOptimizeFunction(killall);
function test(x, f) {
+ %PrepareFunctionForOptimization(f);
assertEquals(x, f());
assertEquals(x, f());
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/stress-deopt-count-1.js b/deps/v8/test/mjsunit/compiler/stress-deopt-count-1.js
index 834a873e75..5c0e7b7a44 100644
--- a/deps/v8/test/mjsunit/compiler/stress-deopt-count-1.js
+++ b/deps/v8/test/mjsunit/compiler/stress-deopt-count-1.js
@@ -10,6 +10,7 @@ function f(x) {
return x + 1;
}
+%PrepareFunctionForOptimization(f);
f(0);
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/stress-deopt-count-2.js b/deps/v8/test/mjsunit/compiler/stress-deopt-count-2.js
index 641a9e8180..d91086a865 100644
--- a/deps/v8/test/mjsunit/compiler/stress-deopt-count-2.js
+++ b/deps/v8/test/mjsunit/compiler/stress-deopt-count-2.js
@@ -11,6 +11,7 @@ function f(x) {
return x + 1;
}
+%PrepareFunctionForOptimization(f);
f(1);
%OptimizeFunctionOnNextCall(f);
@@ -32,6 +33,7 @@ assertUnoptimized(f, undefined, undefined, false);
// stress_deopt_count == 6
+%PrepareFunctionForOptimization(f);
%OptimizeFunctionOnNextCall(f);
f(1);
assertOptimized(f, undefined, undefined, false);
diff --git a/deps/v8/test/mjsunit/compiler/strict-equal-number.js b/deps/v8/test/mjsunit/compiler/strict-equal-number.js
index 18cd52aa01..de98b8fe63 100644
--- a/deps/v8/test/mjsunit/compiler/strict-equal-number.js
+++ b/deps/v8/test/mjsunit/compiler/strict-equal-number.js
@@ -9,6 +9,7 @@
(function() {
function foo(x, y) { return x === y; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(0.1, 0.1));
assertTrue(foo(undefined, undefined));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/strict-equal-receiver.js b/deps/v8/test/mjsunit/compiler/strict-equal-receiver.js
index 1f38d79dfa..016e077cfb 100644
--- a/deps/v8/test/mjsunit/compiler/strict-equal-receiver.js
+++ b/deps/v8/test/mjsunit/compiler/strict-equal-receiver.js
@@ -11,6 +11,7 @@
function foo() { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -24,6 +25,7 @@
function foo() { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -37,6 +39,7 @@
function foo() { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -50,6 +53,7 @@
function foo(a) { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(b));
@@ -66,6 +70,7 @@
function foo(a) { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(b));
@@ -82,6 +87,7 @@
function foo(a) { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(b));
@@ -98,6 +104,7 @@
function foo(a, b) { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b, b));
assertFalse(foo(a, b));
assertTrue(foo(a, a));
@@ -118,6 +125,7 @@
function foo(a, b) { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b, b));
assertFalse(foo(a, b));
assertTrue(foo(a, a));
@@ -138,6 +146,7 @@
function foo(a, b) { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b, b));
assertFalse(foo(a, b));
assertTrue(foo(a, a));
diff --git a/deps/v8/test/mjsunit/compiler/strict-equal-symbol.js b/deps/v8/test/mjsunit/compiler/strict-equal-symbol.js
index aee1ecfa60..2cbb8d2407 100644
--- a/deps/v8/test/mjsunit/compiler/strict-equal-symbol.js
+++ b/deps/v8/test/mjsunit/compiler/strict-equal-symbol.js
@@ -11,6 +11,7 @@
function foo() { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
@@ -24,6 +25,7 @@
function foo(a) { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b));
assertFalse(foo(a));
assertTrue(foo(b));
@@ -40,6 +42,7 @@
function foo(a, b) { return a === b; }
+ %PrepareFunctionForOptimization(foo);
assertTrue(foo(b, b));
assertFalse(foo(a, b));
assertTrue(foo(a, a));
diff --git a/deps/v8/test/mjsunit/compiler/strict-recompile.js b/deps/v8/test/mjsunit/compiler/strict-recompile.js
index 96e8bcab78..acd3fb2d7b 100644
--- a/deps/v8/test/mjsunit/compiler/strict-recompile.js
+++ b/deps/v8/test/mjsunit/compiler/strict-recompile.js
@@ -46,6 +46,7 @@ function do_eval(str) {
}
var eval_foo = do_eval('(' + foo + ')');
+%PrepareFunctionForOptimization(eval_foo);
for (var i = 0; i < 5; i++) assertTrue(eval_foo());
%OptimizeFunctionOnNextCall(eval_foo);
assertTrue(eval_foo());
diff --git a/deps/v8/test/mjsunit/compiler/string-add-try-catch.js b/deps/v8/test/mjsunit/compiler/string-add-try-catch.js
index 5ae5b00d18..45eef993c6 100644
--- a/deps/v8/test/mjsunit/compiler/string-add-try-catch.js
+++ b/deps/v8/test/mjsunit/compiler/string-add-try-catch.js
@@ -18,6 +18,7 @@ var a = "a".repeat(%StringMaxLength());
}
}
+ %PrepareFunctionForOptimization(foo);
foo("a");
foo("a");
%OptimizeFunctionOnNextCall(foo);
@@ -34,6 +35,7 @@ var a = "a".repeat(%StringMaxLength());
}
}
+ %PrepareFunctionForOptimization(foo);
foo("a");
foo("a");
%OptimizeFunctionOnNextCall(foo);
@@ -50,6 +52,7 @@ var a = "a".repeat(%StringMaxLength());
}
}
+ %PrepareFunctionForOptimization(foo);
foo("a");
foo("a");
%OptimizeFunctionOnNextCall(foo);
@@ -72,6 +75,7 @@ var obj = {
}
}
+ %PrepareFunctionForOptimization(foo);
foo("a");
foo("a");
%OptimizeFunctionOnNextCall(foo);
@@ -88,6 +92,7 @@ var obj = {
}
}
+ %PrepareFunctionForOptimization(foo);
foo("a");
foo("a");
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/string-comparison-opt.js b/deps/v8/test/mjsunit/compiler/string-comparison-opt.js
index 6c884e13e6..3aa68e0a3e 100644
--- a/deps/v8/test/mjsunit/compiler/string-comparison-opt.js
+++ b/deps/v8/test/mjsunit/compiler/string-comparison-opt.js
@@ -8,6 +8,7 @@
function f(a) {
return a.charAt(1) == "";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aaa"));
%OptimizeFunctionOnNextCall(f);
assertEquals(false, f("aaa"));
@@ -17,6 +18,7 @@
function f(a) {
return a.charAt(1) < "";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aaa"));
%OptimizeFunctionOnNextCall(f);
assertEquals(false, f("aaa"));
@@ -26,6 +28,7 @@
function f(a) {
return a.charAt(1) <= "";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aaa"));
%OptimizeFunctionOnNextCall(f);
assertEquals(false, f("aaa"));
@@ -35,6 +38,7 @@
function f(a) {
return a.charAt(1) > "";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(true, f("aaa"));
%OptimizeFunctionOnNextCall(f);
assertEquals(true, f("aaa"));
@@ -44,6 +48,7 @@
function f(a) {
return a.charAt(1) >= "";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(true, f("aaa"));
%OptimizeFunctionOnNextCall(f);
assertEquals(true, f("aaa"));
@@ -54,6 +59,7 @@
function f(a) {
return a.charAt(1) == a.charAt(2);
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aab"));
assertEquals(true, f("aaa"));
assertEquals(false, f("acb"));
@@ -67,6 +73,7 @@
function f(a) {
return a.charAt(1) < a.charAt(2);
}
+ %PrepareFunctionForOptimization(f);
assertEquals(true, f("aab"));
assertEquals(false, f("aaa"));
assertEquals(false, f("acb"));
@@ -80,6 +87,7 @@
function f(a) {
return a.charAt(1) <= a.charAt(2);
}
+ %PrepareFunctionForOptimization(f);
assertEquals(true, f("aab"));
assertEquals(true, f("aaa"));
assertEquals(false, f("acb"));
@@ -93,6 +101,7 @@
function f(a) {
return a.charAt(1) > a.charAt(2);
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aab"));
assertEquals(false, f("aaa"));
assertEquals(true, f("acb"));
@@ -106,6 +115,7 @@
function f(a) {
return a.charAt(1) >= a.charAt(2);
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aab"));
assertEquals(true, f("aaa"));
assertEquals(true, f("acb"));
@@ -120,6 +130,7 @@
function f(a) {
return a.charAt(1) == "b";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aaa"));
assertEquals(true, f("bbb"));
assertEquals(false, f("ccc"));
@@ -133,6 +144,7 @@
function f(a) {
return a.charAt(1) == "bb";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aaa"));
%OptimizeFunctionOnNextCall(f);
assertEquals(false, f("aaa"));
@@ -143,6 +155,7 @@
function f(a) {
return a.charAt(1) < "b";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(true, f("aaa"));
assertEquals(false, f("bbb"));
assertEquals(false, f("ccc"));
@@ -156,6 +169,7 @@
function f(a) {
return a.charAt(1) < "bb";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(true, f("aaa"));
assertEquals(true, f("bbb"));
assertEquals(false, f("ccc"));
@@ -170,6 +184,7 @@
function f(a) {
return a.charAt(1) <= "b";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(true, f("aaa"));
assertEquals(true, f("bbb"));
assertEquals(false, f("ccc"));
@@ -183,6 +198,7 @@
function f(a) {
return a.charAt(1) <= "bb";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(true, f("aaa"));
assertEquals(true, f("bbb"));
assertEquals(false, f("ccc"));
@@ -197,6 +213,7 @@
function f(a) {
return a.charAt(1) > "b";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aaa"));
assertEquals(false, f("bbb"));
assertEquals(true, f("ccc"));
@@ -210,6 +227,7 @@
function f(a) {
return a.charAt(1) > "bb";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aaa"));
assertEquals(false, f("bbb"));
assertEquals(true, f("ccc"));
@@ -224,6 +242,7 @@
function f(a) {
return a.charAt(1) >= "b";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aaa"));
assertEquals(true, f("bbb"));
assertEquals(true, f("ccc"));
@@ -237,6 +256,7 @@
function f(a) {
return a.charAt(1) >= "bb";
}
+ %PrepareFunctionForOptimization(f);
assertEquals(false, f("aaa"));
assertEquals(false, f("bbb"));
assertEquals(true, f("ccc"));
diff --git a/deps/v8/test/mjsunit/compiler/string-concat-deopt.js b/deps/v8/test/mjsunit/compiler/string-concat-deopt.js
index 9043b00488..d2c522dbca 100644
--- a/deps/v8/test/mjsunit/compiler/string-concat-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/string-concat-deopt.js
@@ -9,6 +9,7 @@
return "abc".concat();
}
+ %PrepareFunctionForOptimization(f);
assertEquals("abc", f());
assertEquals("abc", f());
%OptimizeFunctionOnNextCall(f);
@@ -20,6 +21,7 @@
return "abc".concat(a);
}
+ %PrepareFunctionForOptimization(f);
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
@@ -30,6 +32,8 @@
function f(a) {
return "abc".concat(a);
}
+
+ %PrepareFunctionForOptimization(f);
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
@@ -41,6 +45,7 @@
return "abc".concat(a);
}
+ %PrepareFunctionForOptimization(f);
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
@@ -54,6 +59,7 @@
return "ab".concat("c");
}
+ %PrepareFunctionForOptimization(f);
assertEquals("abc", f());
assertEquals("abc", f());
%OptimizeFunctionOnNextCall(f);
@@ -65,6 +71,7 @@
return "ab".concat("c", a);
}
+ %PrepareFunctionForOptimization(f);
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
@@ -75,6 +82,8 @@
function f(a) {
return "ab".concat("c", a);
}
+
+ %PrepareFunctionForOptimization(f);
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
@@ -86,6 +95,7 @@
return "ab".concat("c", a);
}
+ %PrepareFunctionForOptimization(f);
assertEquals("abcde", f("de"));
assertEquals("abcde", f("de"));
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/string-concat-try-catch.js b/deps/v8/test/mjsunit/compiler/string-concat-try-catch.js
index d85a891934..382ae30b85 100644
--- a/deps/v8/test/mjsunit/compiler/string-concat-try-catch.js
+++ b/deps/v8/test/mjsunit/compiler/string-concat-try-catch.js
@@ -15,6 +15,7 @@ var a = "a".repeat(%StringMaxLength());
}
}
+ %PrepareFunctionForOptimization(foo);
foo("a");
foo("a");
// Optimize with string length protector check.
@@ -22,6 +23,7 @@ var a = "a".repeat(%StringMaxLength());
foo("a");
assertInstanceof(foo(a), RangeError);
// Optimize without string length protector check.
+ %PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
foo("a");
assertInstanceof(foo(a), RangeError);
diff --git a/deps/v8/test/mjsunit/compiler/string-concat-yield.js b/deps/v8/test/mjsunit/compiler/string-concat-yield.js
index d6611d2d36..5b73fea94a 100644
--- a/deps/v8/test/mjsunit/compiler/string-concat-yield.js
+++ b/deps/v8/test/mjsunit/compiler/string-concat-yield.js
@@ -9,6 +9,7 @@ function* foo() {
return f;
}
+%PrepareFunctionForOptimization(foo);
%OptimizeFunctionOnNextCall(foo);
var gen = foo();
assertEquals('yielded', gen.next('unused').value);
diff --git a/deps/v8/test/mjsunit/compiler/string-from-code-point.js b/deps/v8/test/mjsunit/compiler/string-from-code-point.js
index 165ea0c234..2d4686a0bf 100644
--- a/deps/v8/test/mjsunit/compiler/string-from-code-point.js
+++ b/deps/v8/test/mjsunit/compiler/string-from-code-point.js
@@ -10,6 +10,7 @@
return String.fromCodePoint(x);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals("\u0000", foo(0));
assertEquals("\u0000", foo(-0));
%OptimizeFunctionOnNextCall(foo);
@@ -17,6 +18,10 @@
assertEquals("\u0000", foo(-0));
assertOptimized(foo);
+ // Prepare foo to be re-optimized, ensuring it's bytecode / feedback vector
+ // doesn't get flushed after deoptimization.
+ %PrepareFunctionForOptimization(foo);
+
// Now passing anything outside the valid code point
// range should invalidate the optimized code.
assertThrows(_ => foo(-1));
diff --git a/deps/v8/test/mjsunit/compiler/string-length.js b/deps/v8/test/mjsunit/compiler/string-length.js
index 855a1a6b71..718bcfb4da 100644
--- a/deps/v8/test/mjsunit/compiler/string-length.js
+++ b/deps/v8/test/mjsunit/compiler/string-length.js
@@ -13,6 +13,7 @@ function id(x) { return x; }
function f1(x) {
return x.length;
}
+%PrepareFunctionForOptimization(f1);
assertEquals(0, f1(""));
assertEquals(1, f1("a"));
%OptimizeFunctionOnNextCall(f1);
@@ -23,6 +24,7 @@ function f2(x, y, z) {
x = x ? "" + y : "" + z;
return x.length;
}
+%PrepareFunctionForOptimization(f2);
assertEquals(0, f2(true, "", "a"));
assertEquals(1, f2(false, "", "a"));
%OptimizeFunctionOnNextCall(f2);
diff --git a/deps/v8/test/mjsunit/compiler/string-slice.js b/deps/v8/test/mjsunit/compiler/string-slice.js
index 6c3274753e..5d5defbee0 100644
--- a/deps/v8/test/mjsunit/compiler/string-slice.js
+++ b/deps/v8/test/mjsunit/compiler/string-slice.js
@@ -7,6 +7,7 @@
(function() {
function foo(s) { return s.slice(-1); }
+ %PrepareFunctionForOptimization(foo);
assertEquals('', foo(''));
assertEquals('a', foo('a'));
assertEquals('b', foo('ab'));
@@ -21,6 +22,7 @@
(function() {
function foo(s) { return s.slice(-1, undefined); }
+ %PrepareFunctionForOptimization(foo);
assertEquals('', foo(''));
assertEquals('a', foo('a'));
assertEquals('b', foo('ab'));
diff --git a/deps/v8/test/mjsunit/compiler/switch-bailout.js b/deps/v8/test/mjsunit/compiler/switch-bailout.js
index 084074e0b0..71aa946b14 100644
--- a/deps/v8/test/mjsunit/compiler/switch-bailout.js
+++ b/deps/v8/test/mjsunit/compiler/switch-bailout.js
@@ -37,6 +37,7 @@ function f(x) {
return 99;
}
+%PrepareFunctionForOptimization(f);
for (var i = 0; i < 5; i++) f("foo");
%OptimizeFunctionOnNextCall(f);
f("foo");
diff --git a/deps/v8/test/mjsunit/compiler/symbol-protototype.js b/deps/v8/test/mjsunit/compiler/symbol-protototype.js
index 9a707e8a08..b1b2ac6527 100644
--- a/deps/v8/test/mjsunit/compiler/symbol-protototype.js
+++ b/deps/v8/test/mjsunit/compiler/symbol-protototype.js
@@ -7,6 +7,7 @@
function test1(s) {
return s.toString;
}
+%PrepareFunctionForOptimization(test1);
assertSame(test1(Symbol()), Symbol.prototype.toString);
assertSame(test1(Symbol()), Symbol.prototype.toString);
%OptimizeFunctionOnNextCall(test1);
@@ -15,6 +16,7 @@ assertSame(test1(Symbol()), Symbol.prototype.toString);
function test2(s) {
return s.valueOf;
}
+%PrepareFunctionForOptimization(test2);
assertSame(test2(Symbol()), Symbol.prototype.valueOf);
assertSame(test2(Symbol()), Symbol.prototype.valueOf);
%OptimizeFunctionOnNextCall(test2);
@@ -24,6 +26,7 @@ Symbol.prototype.foo = 1;
function test3(s) {
return s["foo"];
}
+%PrepareFunctionForOptimization(test3);
assertEquals(test3(Symbol()), 1);
assertEquals(test3(Symbol()), 1);
%OptimizeFunctionOnNextCall(test3);
@@ -33,6 +36,7 @@ Symbol.prototype.bar = function() { "use strict"; return this; }
function test4(s) {
return s.bar();
}
+%PrepareFunctionForOptimization(test4);
var s = Symbol("foo");
assertEquals(test4(s), s);
assertEquals(test4(s), s);
diff --git a/deps/v8/test/mjsunit/compiler/try-binop.js b/deps/v8/test/mjsunit/compiler/try-binop.js
index 2132ad2c00..f762eedf8f 100644
--- a/deps/v8/test/mjsunit/compiler/try-binop.js
+++ b/deps/v8/test/mjsunit/compiler/try-binop.js
@@ -14,6 +14,7 @@ function mult_left_plain(x) {
}
}
+%PrepareFunctionForOptimization(mult_left_plain);
%OptimizeFunctionOnNextCall(mult_left_plain);
assertEquals("boom", mult_left_plain(boom));
assertEquals(46, mult_left_plain(23));
@@ -26,6 +27,7 @@ function mult_right_plain(x) {
}
}
+%PrepareFunctionForOptimization(mult_right_plain);
%OptimizeFunctionOnNextCall(mult_right_plain);
assertEquals("boom", mult_right_plain(boom));
assertEquals(69, mult_right_plain(23));
@@ -38,6 +40,7 @@ function mult_none_plain(x,y) {
}
}
+%PrepareFunctionForOptimization(mult_none_plain);
%OptimizeFunctionOnNextCall(mult_none_plain);
assertEquals("boom", mult_none_plain(boom, boom));
assertEquals("boom", mult_none_plain(boom, 2));
diff --git a/deps/v8/test/mjsunit/compiler/try-catch-deopt.js b/deps/v8/test/mjsunit/compiler/try-catch-deopt.js
index 2b6372cf28..fb685c0a76 100644
--- a/deps/v8/test/mjsunit/compiler/try-catch-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/try-catch-deopt.js
@@ -20,6 +20,7 @@
}
}
+ %PrepareFunctionForOptimization(f);
assertEquals(43, f());
assertEquals(43, f());
%NeverOptimizeFunction(g);
@@ -50,6 +51,7 @@
return b;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(43, f());
assertEquals(43, f());
%NeverOptimizeFunction(g);
@@ -80,6 +82,7 @@
return h() + 1;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(44, f());
assertEquals(44, f());
%NeverOptimizeFunction(g);
@@ -109,6 +112,7 @@
return a;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(43, f());
assertEquals(43, f());
%NeverOptimizeFunction(g);
@@ -135,6 +139,7 @@
}
return x;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(23, f(0));
assertEquals(24, f(1));
%OptimizeFunctionOnNextCall(f);
@@ -161,6 +166,7 @@
}
return x;
}
+ %PrepareFunctionForOptimization(f);
assertThrows(function() { f(0) });
assertThrows(function() { f(1) });
%OptimizeFunctionOnNextCall(f);
@@ -190,6 +196,7 @@
}
return x;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(23, f(0));
assertEquals(24, f(1));
%OptimizeFunctionOnNextCall(f);
@@ -217,6 +224,7 @@
}
return x;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(23, f(0));
assertEquals(24, f(1));
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/try-context.js b/deps/v8/test/mjsunit/compiler/try-context.js
index 4e6d9b028c..50dd923187 100644
--- a/deps/v8/test/mjsunit/compiler/try-context.js
+++ b/deps/v8/test/mjsunit/compiler/try-context.js
@@ -17,6 +17,7 @@
}
return x;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(23, f(0));
assertEquals(24, f(1));
%OptimizeFunctionOnNextCall(f);
@@ -37,6 +38,7 @@
}
return x;
}
+ %PrepareFunctionForOptimization(f);
assertThrows(function() { f(0) });
assertThrows(function() { f(1) });
%OptimizeFunctionOnNextCall(f);
@@ -60,6 +62,7 @@
}
return x;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(23, f(0));
assertEquals(24, f(1));
%OptimizeFunctionOnNextCall(f);
@@ -81,6 +84,7 @@
}
return x;
}
+ %PrepareFunctionForOptimization(f);
assertEquals(23, f(0));
assertEquals(24, f(1));
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/try-deopt.js b/deps/v8/test/mjsunit/compiler/try-deopt.js
index a4a6eb0304..3ca341c5a1 100644
--- a/deps/v8/test/mjsunit/compiler/try-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/try-deopt.js
@@ -13,6 +13,7 @@ function DeoptFromTry(x) {
}
return x + 2;
}
+%PrepareFunctionForOptimization(DeoptFromTry);
%OptimizeFunctionOnNextCall(DeoptFromTry);
assertEquals(24, DeoptFromTry(23));
@@ -26,6 +27,7 @@ function DeoptFromCatch(x) {
}
return x + 2;
}
+%PrepareFunctionForOptimization(DeoptFromCatch);
%OptimizeFunctionOnNextCall(DeoptFromCatch);
assertEquals(24, DeoptFromCatch(23));
@@ -39,6 +41,7 @@ function DeoptFromFinally_Return(x) {
}
return x + 2;
}
+%PrepareFunctionForOptimization(DeoptFromFinally_Return);
%OptimizeFunctionOnNextCall(DeoptFromFinally_Return);
assertEquals(24, DeoptFromFinally_Return(23));
@@ -51,5 +54,6 @@ function DeoptFromFinally_ReThrow(x) {
}
return x + 2;
}
+%PrepareFunctionForOptimization(DeoptFromFinally_ReThrow);
%OptimizeFunctionOnNextCall(DeoptFromFinally_ReThrow);
assertThrows("DeoptFromFinally_ReThrow(new Error)", Error);
diff --git a/deps/v8/test/mjsunit/compiler/try-finally-deopt.js b/deps/v8/test/mjsunit/compiler/try-finally-deopt.js
index 455bf3477f..ee8da2eca0 100644
--- a/deps/v8/test/mjsunit/compiler/try-finally-deopt.js
+++ b/deps/v8/test/mjsunit/compiler/try-finally-deopt.js
@@ -17,6 +17,7 @@
return global + a;
}
+ %PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
@@ -36,6 +37,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
@@ -59,6 +61,8 @@
return 1;
}
+
+ %PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
@@ -83,6 +87,8 @@
return 1;
}
+
+ %PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
@@ -106,6 +112,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(f);
try { f(); } catch(e) {}
try { f(); } catch(e) {}
%OptimizeFunctionOnNextCall(f);
@@ -133,6 +140,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(f);
try { f(); } catch(e) {}
try { f(); } catch(e) {}
%OptimizeFunctionOnNextCall(f);
@@ -157,6 +165,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
@@ -186,6 +195,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
@@ -211,6 +221,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
@@ -241,6 +252,7 @@
return 1;
}
+ %PrepareFunctionForOptimization(f);
f();
f();
%OptimizeFunctionOnNextCall(f);
diff --git a/deps/v8/test/mjsunit/compiler/turbo-number-feedback.js b/deps/v8/test/mjsunit/compiler/turbo-number-feedback.js
index 8875b8c0c3..52c836a84f 100644
--- a/deps/v8/test/mjsunit/compiler/turbo-number-feedback.js
+++ b/deps/v8/test/mjsunit/compiler/turbo-number-feedback.js
@@ -9,6 +9,7 @@
return a + b - c;
}
+ %PrepareFunctionForOptimization(f0);
assertEquals(4, f0(3, 2, 1));
assertEquals(4, f0(3, 2, 1));
%OptimizeFunctionOnNextCall(f0);
@@ -20,6 +21,7 @@
return a + b - c;
}
+ %PrepareFunctionForOptimization(f1);
assertEquals(4.5, f1(3.5, 2.5, 1.5));
assertEquals(4.5, f1(3.5, 2.5, 1.5));
%OptimizeFunctionOnNextCall(f1);
@@ -34,6 +36,7 @@
return (a >>> 0) + 1;
}
+ %PrepareFunctionForOptimization(f2);
assertEquals(1, f2(0));
assertEquals(1, f2(0));
%OptimizeFunctionOnNextCall(f2);
@@ -50,6 +53,7 @@
return x + b;
}
+ %PrepareFunctionForOptimization(f3);
assertEquals(1, f3(0, 1));
assertEquals(1, f3(0, 1));
%OptimizeFunctionOnNextCall(f3);
@@ -62,6 +66,7 @@
return a << b;
}
+ %PrepareFunctionForOptimization(f4);
assertEquals(24, f4(3, 3));
assertEquals(40, f4(5, 3));
%OptimizeFunctionOnNextCall(f4);
@@ -73,6 +78,7 @@
return a << b;
}
+ %PrepareFunctionForOptimization(f5);
assertEquals(24, f5(3.3, 3.4));
assertEquals(40, f5(5.1, 3.9));
%OptimizeFunctionOnNextCall(f5);
@@ -84,6 +90,7 @@
return a >> b;
}
+ %PrepareFunctionForOptimization(f6);
assertEquals(1, f6(8.3, 3.4));
assertEquals(-2, f6(-16.1, 3.9));
%OptimizeFunctionOnNextCall(f6);
@@ -95,6 +102,7 @@
return a >>> b;
}
+ %PrepareFunctionForOptimization(f7);
assertEquals(1, f7(8.3, 3.4));
assertEquals(536870910, f7(-16.1, 3.9));
%OptimizeFunctionOnNextCall(f7);
diff --git a/deps/v8/test/mjsunit/compiler/type-speculative-safe-integer-add.js b/deps/v8/test/mjsunit/compiler/type-speculative-safe-integer-add.js
index 459e2b4202..a45561b8c8 100644
--- a/deps/v8/test/mjsunit/compiler/type-speculative-safe-integer-add.js
+++ b/deps/v8/test/mjsunit/compiler/type-speculative-safe-integer-add.js
@@ -19,6 +19,7 @@
return y;
}
+ %PrepareFunctionForOptimization(forgetAboutMinus0);
forgetAboutMinus0(1);
assertEquals(Infinity, forgetAboutMinus0(1));
%OptimizeFunctionOnNextCall(forgetAboutMinus0);
@@ -43,6 +44,7 @@
return NumberAdd(f(x), 0);
}
+ %PrepareFunctionForOptimization(forgetAboutNaN);
forgetAboutNaN(false);
assertEquals(2, forgetAboutNaN(false));
%OptimizeFunctionOnNextCall(forgetAboutNaN);
diff --git a/deps/v8/test/mjsunit/compiler/typed-array-constructor.js b/deps/v8/test/mjsunit/compiler/typed-array-constructor.js
index 07d6a7ca4e..fac56632f3 100644
--- a/deps/v8/test/mjsunit/compiler/typed-array-constructor.js
+++ b/deps/v8/test/mjsunit/compiler/typed-array-constructor.js
@@ -11,6 +11,7 @@ const limit = %MaxSmi() + 1;
try { new Int8Array(limit); } catch (e) { return e.stack; }
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(/new Int8Array/.test(foo()));
assertTrue(/new Int8Array/.test(foo()));
%OptimizeFunctionOnNextCall(foo);
@@ -22,6 +23,7 @@ const limit = %MaxSmi() + 1;
try { new Uint8Array(limit); } catch (e) { return e.stack; }
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(/new Uint8Array/.test(foo()));
assertTrue(/new Uint8Array/.test(foo()));
%OptimizeFunctionOnNextCall(foo);
@@ -33,6 +35,7 @@ const limit = %MaxSmi() + 1;
try { new Uint8ClampedArray(limit); } catch (e) { return e.stack; }
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(/new Uint8ClampedArray/.test(foo()));
assertTrue(/new Uint8ClampedArray/.test(foo()));
%OptimizeFunctionOnNextCall(foo);
@@ -44,6 +47,7 @@ const limit = %MaxSmi() + 1;
try { new Int16Array(limit); } catch (e) { return e.stack; }
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(/new Int16Array/.test(foo()));
assertTrue(/new Int16Array/.test(foo()));
%OptimizeFunctionOnNextCall(foo);
@@ -55,6 +59,7 @@ const limit = %MaxSmi() + 1;
try { new Uint16Array(limit); } catch (e) { return e.stack; }
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(/new Uint16Array/.test(foo()));
assertTrue(/new Uint16Array/.test(foo()));
%OptimizeFunctionOnNextCall(foo);
@@ -66,6 +71,7 @@ const limit = %MaxSmi() + 1;
try { new Int32Array(limit); } catch (e) { return e.stack; }
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(/new Int32Array/.test(foo()));
assertTrue(/new Int32Array/.test(foo()));
%OptimizeFunctionOnNextCall(foo);
@@ -77,6 +83,7 @@ const limit = %MaxSmi() + 1;
try { new Uint32Array(limit); } catch (e) { return e.stack; }
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(/new Uint32Array/.test(foo()));
assertTrue(/new Uint32Array/.test(foo()));
%OptimizeFunctionOnNextCall(foo);
@@ -88,6 +95,7 @@ const limit = %MaxSmi() + 1;
try { new Float32Array(limit); } catch (e) { return e.stack; }
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(/new Float32Array/.test(foo()));
assertTrue(/new Float32Array/.test(foo()));
%OptimizeFunctionOnNextCall(foo);
@@ -100,6 +108,7 @@ const limit = %MaxSmi() + 1;
try { new Float64Array(limit); } catch (e) { return e.stack; }
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(/new Float64Array/.test(foo()));
assertTrue(/new Float64Array/.test(foo()));
%OptimizeFunctionOnNextCall(foo);
@@ -111,6 +120,7 @@ const limit = %MaxSmi() + 1;
try { new BigInt64Array(limit); } catch (e) { return e.stack; }
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(/new BigInt64Array/.test(foo()));
assertTrue(/new BigInt64Array/.test(foo()));
%OptimizeFunctionOnNextCall(foo);
@@ -122,6 +132,7 @@ const limit = %MaxSmi() + 1;
try { new BigUint64Array(limit); } catch (e) { return e.stack; }
}
+ %PrepareFunctionForOptimization(foo);
assertTrue(/new BigUint64Array/.test(foo()));
assertTrue(/new BigUint64Array/.test(foo()));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/compiler/typedarray-prototype-tostringtag.js b/deps/v8/test/mjsunit/compiler/typedarray-prototype-tostringtag.js
index de4b302017..36575c7f59 100644
--- a/deps/v8/test/mjsunit/compiler/typedarray-prototype-tostringtag.js
+++ b/deps/v8/test/mjsunit/compiler/typedarray-prototype-tostringtag.js
@@ -24,6 +24,7 @@ const TypedArrayPrototype_toStringTag =
function foo(o) {
return TypedArrayPrototype_toStringTag.call(o);
}
+ %PrepareFunctionForOptimization(foo);
assertEquals(undefined, foo(1));
assertEquals(undefined, foo({}));
assertEquals(undefined, foo([]));
@@ -46,6 +47,7 @@ const TypedArrayPrototype_toStringTag =
return TypedArrayProto_toStringTag(value) !== undefined;
}
+ %PrepareFunctionForOptimization(isTypedArray);
assertFalse(isTypedArray(1));
assertFalse(isTypedArray({}));
assertFalse(isTypedArray([]));
@@ -70,6 +72,7 @@ const TypedArrayPrototype_toStringTag =
return TypedArrayProto_toStringTag(value) === 'Uint8Array';
}
+ %PrepareFunctionForOptimization(isUint8Array);
assertFalse(isUint8Array(1));
assertFalse(isUint8Array({}));
assertFalse(isUint8Array([]));
diff --git a/deps/v8/test/mjsunit/compiler/uint32.js b/deps/v8/test/mjsunit/compiler/uint32.js
index 3568e27f03..a39d405258 100644
--- a/deps/v8/test/mjsunit/compiler/uint32.js
+++ b/deps/v8/test/mjsunit/compiler/uint32.js
@@ -40,6 +40,7 @@ function ChangeI2T(arr, i) {
return uint32_array[i];
}
+%PrepareFunctionForOptimization(ChangeI2T);
assertEquals(K1, ChangeI2T(uint32_array, 0));
assertEquals(K2, ChangeI2T(uint32_array, 1));
%OptimizeFunctionOnNextCall(ChangeI2T);
@@ -60,6 +61,7 @@ function Deopt(obj, arr, i) {
return x;
}
+%PrepareFunctionForOptimization(Deopt);
assertEquals(K1, Deopt({x: 0}, uint32_array, 0));
assertEquals(K2, Deopt({x: 0}, uint32_array, 1));
%OptimizeFunctionOnNextCall(Deopt);
@@ -71,6 +73,7 @@ function ChangeI2D(arr) {
return arr[0] + arr[1];
}
+%PrepareFunctionForOptimization(ChangeI2D);
assertEquals(K1 + K2, ChangeI2D(uint32_array));
assertEquals(K1 + K2, ChangeI2D(uint32_array));
%OptimizeFunctionOnNextCall(ChangeI2D);
@@ -80,6 +83,7 @@ function ShrShr(val) {
return (val >>> 0) >>> 1;
}
+%PrepareFunctionForOptimization(ShrShr);
assertEquals(K1, ShrShr(K2 | 0));
assertEquals(K1, ShrShr(K2 | 0));
%OptimizeFunctionOnNextCall(ShrShr);
@@ -89,6 +93,7 @@ function SarShr(val) {
return val >> (-2 >>> 0);
}
+%PrepareFunctionForOptimization(SarShr);
var K3 = 0x80000000;
assertEquals(-2, SarShr(K3 | 0));
assertEquals(-2, SarShr(K3 | 0));
@@ -100,6 +105,7 @@ function Uint32Phi(a, b, c) {
return (i | 0);
}
+%PrepareFunctionForOptimization(Uint32Phi);
var K4 = 0x80000001;
assertEquals(K3 | 0, Uint32Phi(true, K3, K4));
assertEquals(K4 | 0, Uint32Phi(false, K3, K4));
@@ -114,6 +120,7 @@ function NonUint32Phi(a, b, c) {
return (i | 0);
}
+%PrepareFunctionForOptimization(NonUint32Phi);
assertEquals(K3 | 0, NonUint32Phi(true, K3, K4));
assertEquals(K4 | 0, NonUint32Phi(false, K3, K4));
assertEquals(K3 | 0, NonUint32Phi(true, K3, K4));
@@ -132,6 +139,7 @@ function PhiOfPhi(x) {
return (a | 0);
}
+%PrepareFunctionForOptimization(PhiOfPhi);
assertEquals(1, PhiOfPhi(1));
assertEquals(1, PhiOfPhi(1));
%OptimizeFunctionOnNextCall(PhiOfPhi);
@@ -147,6 +155,7 @@ function PhiOfPhiUnsafe(x) {
return a + a;
}
+%PrepareFunctionForOptimization(PhiOfPhiUnsafe);
assertEquals(2, PhiOfPhiUnsafe(1));
assertEquals(2, PhiOfPhiUnsafe(1));
%OptimizeFunctionOnNextCall(PhiOfPhiUnsafe);
@@ -166,6 +175,7 @@ function FillOldArrayWithHeapNumbers(N) {
}
}
+%PrepareFunctionForOptimization(FillOldArrayWithHeapNumbers);
FillOldArrayWithHeapNumbers(1);
FillOldArrayWithHeapNumbers(1);
%OptimizeFunctionOnNextCall(FillOldArrayWithHeapNumbers);
@@ -191,6 +201,7 @@ function Outer(v, f) {
return InnerWithArguments(v >>> 0, f);
}
+%PrepareFunctionForOptimization(Outer);
assertArrayEquals([0x0100, 0x01], Outer(0x0100, Pack));
assertArrayEquals([0x0100, 0x01], Outer(0x0100, Pack));
assertArrayEquals([0x0100, 0x01], Outer(0x0100, Pack));
diff --git a/deps/v8/test/mjsunit/compiler/uint8-clamped-array.js b/deps/v8/test/mjsunit/compiler/uint8-clamped-array.js
index 21cc5bbc36..63b74eaedb 100644
--- a/deps/v8/test/mjsunit/compiler/uint8-clamped-array.js
+++ b/deps/v8/test/mjsunit/compiler/uint8-clamped-array.js
@@ -9,6 +9,7 @@
a[0] = v & 0xff;
}
+ %PrepareFunctionForOptimization(foo);
var a = new Uint8ClampedArray(4);
foo(a, 1);
foo(a, 2);
@@ -23,6 +24,7 @@
a[0] = v >>> 0;
}
+ %PrepareFunctionForOptimization(foo);
var a = new Uint8ClampedArray(4);
foo(a, 1);
foo(a, 2);
@@ -37,6 +39,7 @@
a[0] = v | 0;
}
+ %PrepareFunctionForOptimization(foo);
var a = new Uint8ClampedArray(4);
foo(a, 1);
foo(a, 2);
@@ -54,6 +57,7 @@
a[0] = v;
}
+ %PrepareFunctionForOptimization(foo);
var a = new Uint8ClampedArray(4);
foo(a, 1);
foo(a, 2);
diff --git a/deps/v8/test/mjsunit/compiler/unsigned-min-max.js b/deps/v8/test/mjsunit/compiler/unsigned-min-max.js
index db91188628..e5e33aae1c 100644
--- a/deps/v8/test/mjsunit/compiler/unsigned-min-max.js
+++ b/deps/v8/test/mjsunit/compiler/unsigned-min-max.js
@@ -10,6 +10,7 @@ function umin(a, b) {
return Math.min(a, b);
}
+%PrepareFunctionForOptimization(umin);
umin(1, 1);
umin(2, 2);
%OptimizeFunctionOnNextCall(umin);
@@ -26,6 +27,7 @@ function umax(a, b) {
return Math.max(a, b);
}
+%PrepareFunctionForOptimization(umax);
umax(1, 1);
umax(2, 2);
%OptimizeFunctionOnNextCall(umax);
diff --git a/deps/v8/test/mjsunit/es6/for-each-in-catch.js b/deps/v8/test/mjsunit/es6/for-each-in-catch.js
index 674cddd047..b38013eeb3 100644
--- a/deps/v8/test/mjsunit/es6/for-each-in-catch.js
+++ b/deps/v8/test/mjsunit/es6/for-each-in-catch.js
@@ -5,25 +5,25 @@
function checkIsRedeclarationError(code) {
try {
eval(`
-checkIsRedeclarationError : {
- break checkIsRedeclarationError;
-${code}
-}
-`);
+ checkIsRedeclarationError: {
+ break checkIsRedeclarationError;
+ ${code}
+ }
+ `);
assertUnreachable();
- } catch(e) {
- assertInstanceof(e, SyntaxError );
- assertTrue( e.toString().indexOf("has already been declared") >= 0 );
+ } catch (e) {
+ assertInstanceof(e, SyntaxError);
+ assertTrue(e.toString().includes("has already been declared"));
}
}
function checkIsNotRedeclarationError(code) {
- assertDoesNotThrow(()=>eval(`
-checkIsNotRedeclarationError_label : {
- break checkIsNotRedeclarationError_label;
-${code}
-}
-`));
+ assertDoesNotThrow(() => eval(`
+ checkIsNotRedeclarationError_label: {
+ break checkIsNotRedeclarationError_label;
+ ${code}
+ }
+ `));
}
@@ -52,143 +52,145 @@ let not_var_e = [
'const {f:e}'
];
-// Check that `for (var ... of ...)` cannot redeclare a simple catch variable
-// but `for (var ... in ...)` can.
+// Check that both `for (var ... of ...)` and `for (var ... in ...)`
+// can redeclare a simple catch variable.
for (let binding of var_e) {
- checkIsRedeclarationError(`
-try {
- throw 0;
-} catch(e) {
- for (${binding} of []);
-}
-`);
+ checkIsNotRedeclarationError(`
+ try {
+ throw 0;
+ } catch (e) {
+ for (${binding} of []);
+ }
+ `);
checkIsNotRedeclarationError(`
-try {
- throw 0;
-} catch(e) {
- for (${binding} in []);
-}
-`);
+ try {
+ throw 0;
+ } catch (e) {
+ for (${binding} in []);
+ }
+ `);
}
-// Check that the above error occurs even for nested catches.
+// Check that the above applies even for nested catches.
for (let binding of var_e) {
- checkIsRedeclarationError(`
-try {
- throw 0;
-} catch(e) {
- try {
- throw 1;
- } catch(f) {
+ checkIsNotRedeclarationError(`
try {
- throw 2;
- } catch({}) {
- for (${binding} of []);
+ throw 0;
+ } catch (e) {
+ try {
+ throw 1;
+ } catch (f) {
+ try {
+ throw 2;
+ } catch ({}) {
+ for (${binding} of []);
+ }
+ }
}
- }
-}
-`);
+ `);
checkIsNotRedeclarationError(`
-try {
- throw 0;
-} catch(e) {
- try {
- throw 1;
- } catch(f) {
try {
- throw 2;
- } catch({}) {
- for (${binding} in []);
+ throw 0;
+ } catch (e) {
+ try {
+ throw 1;
+ } catch (f) {
+ try {
+ throw 2;
+ } catch ({}) {
+ for (${binding} in []);
+ }
+ }
}
- }
-}
-`);
+ `);
}
-// Check that the above error does not occur if a declaration scope is between
-// the catch and the loop.
+// Check that the above applies if a declaration scope is between the
+// catch and the loop.
for (let binding of var_e) {
checkIsNotRedeclarationError(`
-try {
- throw 0;
-} catch(e) {
- (()=>{for (${binding} of []);})();
-}
-`);
+ try {
+ throw 0;
+ } catch (e) {
+ (()=>{for (${binding} of []);})();
+ }
+ `);
checkIsNotRedeclarationError(`
-try {
- throw 0;
-} catch(e) {
- (function(){for (${binding} of []);})();
-}
-`);
+ try {
+ throw 0;
+ } catch (e) {
+ (function() {
+ for (${binding} of []);
+ })();
+ }
+ `);
}
// Check that there is no error when not declaring a var named e.
for (let binding of not_var_e) {
checkIsNotRedeclarationError(`
-try {
- throw 0;
-} catch(e) {
- for (${binding} of []);
-}
-`);
+ try {
+ throw 0;
+ } catch (e) {
+ for (${binding} of []);
+ }
+ `);
}
// Check that there is an error for both for-in and for-of when redeclaring
-// a non-simple catch parameter
+// a non-simple catch parameter.
for (let binding of var_e) {
checkIsRedeclarationError(`
-try {
- throw 0;
-} catch({e}) {
- for (${binding} of []);
-}
-`);
+ try {
+ throw 0;
+ } catch ({e}) {
+ for (${binding} of []);
+ }
+ `);
checkIsRedeclarationError(`
-try {
- throw 0;
-} catch({e}) {
- for (${binding} in []);
-}
-`);
+ try {
+ throw 0;
+ } catch ({e}) {
+ for (${binding} in []);
+ }
+ `);
}
// Check that the above error occurs even for nested catches.
for (let binding of var_e) {
checkIsRedeclarationError(`
-try {
- throw 0;
-} catch({e}) {
- try {
- throw 1;
- } catch(f) {
try {
- throw 2;
- } catch({}) {
- for (${binding} of []);
+ throw 0;
+ } catch ({e}) {
+ try {
+ throw 1;
+ } catch (f) {
+ try {
+ throw 2;
+ } catch ({}) {
+ for (${binding} of []);
+ }
+ }
}
- }
-}
-`);
+ `);
checkIsRedeclarationError(`
-try {
- throw 0;
-} catch({e}) {
- try {
- throw 1;
- } catch(f) {
try {
- throw 2;
- } catch({}) {
- for (${binding} in []);
+ throw 0;
+ } catch ({e}) {
+ try {
+ throw 1;
+ } catch (f) {
+ try {
+ throw 2;
+ } catch ({}) {
+ for (${binding} in []);
+ }
+ }
}
- }
-}
-`);
+ `);
}
diff --git a/deps/v8/test/mjsunit/es6/proxies-ownkeys-clone.js b/deps/v8/test/mjsunit/es6/proxies-ownkeys-clone.js
new file mode 100644
index 0000000000..8fe9598fdb
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/proxies-ownkeys-clone.js
@@ -0,0 +1,25 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var p = new Proxy({a: 1, b: 2}, {
+ ownKeys() { return ['a', 'b']; }
+});
+
+// clone and return a
+function f(a) {
+ var y = {...a}
+ return y;
+}
+
+// Call with different maps to force it into megamorphic state
+f({a: 1, b: 2});
+f({a1: 1, b1: 3});
+f({a2: 1, b2: 3});
+f({a3: 1, b3: 4});
+f({a4: 1, b4: 5});
+
+// Test that y was initialized correctly in the slow path
+var clone = f(p);
+assertEquals(clone.a, 1);
+assertEquals(clone.b, 2);
diff --git a/deps/v8/test/mjsunit/es6/proxies-ownkeys.js b/deps/v8/test/mjsunit/es6/proxies-ownkeys.js
index 7cc0a87b68..3b9011acdc 100644
--- a/deps/v8/test/mjsunit/es6/proxies-ownkeys.js
+++ b/deps/v8/test/mjsunit/es6/proxies-ownkeys.js
@@ -54,9 +54,9 @@ assertEquals(["a", "b", "c"], Reflect.ownKeys(proxy));
keys.length = Math.pow(2, 33);
assertThrows("Reflect.ownKeys(proxy)", RangeError);
-// Check that we allow duplicated keys.
+// Check that we don't allow duplicated keys.
keys = ['a', 'a', 'a']
-assertEquals(keys, Reflect.ownKeys(proxy));
+assertThrows("Reflect.ownKeys(proxy)", TypeError);
// Non-Name results throw.
keys = [1];
@@ -75,9 +75,9 @@ assertThrows("Reflect.ownKeys(proxy)", TypeError);
keys = ["nonconf"];
assertEquals(keys, Reflect.ownKeys(proxy));
-// Check that we allow duplicated keys.
+// Check that we don't allow duplicated keys.
keys = ['nonconf', 'nonconf', 'nonconf']
-assertEquals(keys, Reflect.ownKeys(proxy));
+assertThrows("Reflect.ownKeys(proxy)", TypeError);
// Step 19a: The trap result must all keys of a non-extensible target.
Object.preventExtensions(target);
@@ -89,6 +89,6 @@ assertEquals(keys, Reflect.ownKeys(proxy));
keys = ["nonconf", "target_one", "fantasy"];
assertThrows("Reflect.ownKeys(proxy)", TypeError);
-// Check that we allow duplicated keys.
+// Check that we don't allow duplicated keys.
keys = ['nonconf', 'target_one', 'nonconf', 'nonconf', 'target_one',]
-assertEquals(keys, Reflect.ownKeys(proxy));
+assertThrows("Reflect.ownKeys(proxy)", TypeError);
diff --git a/deps/v8/test/mjsunit/es6/string-endswith.js b/deps/v8/test/mjsunit/es6/string-endswith.js
index b776ccc4ba..c9d5634393 100644
--- a/deps/v8/test/mjsunit/es6/string-endswith.js
+++ b/deps/v8/test/mjsunit/es6/string-endswith.js
@@ -417,3 +417,13 @@ assertThrows(function() {
}, TypeError);
re[Symbol.match] = false;
assertEquals(false, "".startsWith(re));
+
+let didThrow = false;
+try {
+ "".endsWith(/./);
+} catch (err) {
+ didThrow = true;
+ assertEquals(err.name, "TypeError");
+ assertEquals(err.message, "First argument to String.prototype.endsWith must not be a regular expression");
+}
+assertTrue(didThrow);
diff --git a/deps/v8/test/mjsunit/es6/typedarray-sort.js b/deps/v8/test/mjsunit/es6/typedarray-sort.js
index c5c4ff079a..7cd08b1258 100644
--- a/deps/v8/test/mjsunit/es6/typedarray-sort.js
+++ b/deps/v8/test/mjsunit/es6/typedarray-sort.js
@@ -69,6 +69,31 @@ for (var constructor of typedArrayConstructors) {
assertThrows(() => array.sort(), TypeError);
}
+// Check that TypedArray.p.sort is stable.
+for (let constructor of typedArrayConstructors) {
+ // Sort an array [0..kSize-1] modulo 4. If the sort is stable, the array
+ // will be partitioned into 4 parts, where each part has only increasing
+ // elements.
+ const kSize = 128;
+ const kModulo = 4;
+ const kRunSize = kSize / kModulo;
+
+ const template = Array.from({ length: kSize }, (_, i) => i);
+ const array = new constructor(template);
+
+ const compare = (a, b) => (b % kModulo) - (a % kModulo);
+ array.sort(compare);
+
+ function assertIncreasing(from) {
+ for (let i = from + 1; i < from + kRunSize; ++i) {
+ assertTrue(array[i - 1] < array[i]);
+ assertEquals(array[i - 1] % kModulo, array[i] % kModulo);
+ }
+ }
+
+ for (let i = 0; i < kModulo; ++i) assertIncreasing(i * kRunSize);
+}
+
// The following creates a test for each typed element kind, where the array
// to sort consists of some max/min/zero elements.
//
diff --git a/deps/v8/test/mjsunit/es8/object-entries.js b/deps/v8/test/mjsunit/es8/object-entries.js
index 51ce4692e4..f119cfc113 100644
--- a/deps/v8/test/mjsunit/es8/object-entries.js
+++ b/deps/v8/test/mjsunit/es8/object-entries.js
@@ -144,29 +144,11 @@ function TestOrderWithDuplicates(withWarmup) {
});
if (withWarmup) {
- for (const key in P) {}
+ for (const key in O) {};
+ try { for (const key in P) {} } catch {};
}
- log = [];
- assertEquals([
- ["a", 1],
- ["a", 1],
- ["456", 123],
- ["456", 123]
- ], Object.entries(P));
- assertEquals([
- "[[OwnPropertyKeys]]",
- "[[GetOwnProperty]](\"a\")",
- "[[Get]](\"a\")",
- "[[GetOwnProperty]](\"a\")",
- "[[Get]](\"a\")",
- "[[GetOwnProperty]](\"456\")",
- "[[Get]](\"456\")",
- "[[GetOwnProperty]](\"HIDDEN\")",
- "[[GetOwnProperty]](\"HIDDEN\")",
- "[[GetOwnProperty]](\"456\")",
- "[[Get]](\"456\")"
- ], log);
+ assertThrows(() => Object.entries(P), TypeError);
}
TestOrderWithDuplicates();
TestOrderWithDuplicates(true);
diff --git a/deps/v8/test/mjsunit/es8/object-get-own-property-descriptors.js b/deps/v8/test/mjsunit/es8/object-get-own-property-descriptors.js
index f88840dba4..0bd84bd6fe 100644
--- a/deps/v8/test/mjsunit/es8/object-get-own-property-descriptors.js
+++ b/deps/v8/test/mjsunit/es8/object-get-own-property-descriptors.js
@@ -193,21 +193,7 @@ function TestDuplicateKeys() {
defineProperty(target, name, desc) { assertUnreachable(); }
});
- var result = Object.getOwnPropertyDescriptors(P);
- assertEquals({
- "A": {
- "value": "VALUE",
- "writable": false,
- "enumerable": false,
- "configurable": true
- }
- }, result);
- assertTrue(result.hasOwnProperty("A"));
- assertEquals([
- "ownKeys()",
- "getOwnPropertyDescriptor(A)",
- "getOwnPropertyDescriptor(A)"
- ], log);
+ assertThrows(() => Object.getOwnPropertyDescriptors(P), TypeError);
}
TestDuplicateKeys();
diff --git a/deps/v8/test/mjsunit/es8/object-values.js b/deps/v8/test/mjsunit/es8/object-values.js
index 23fcaed1bc..b66e4af7d3 100644
--- a/deps/v8/test/mjsunit/es8/object-values.js
+++ b/deps/v8/test/mjsunit/es8/object-values.js
@@ -121,20 +121,7 @@ function TestOrderWithDuplicates() {
}
});
- assertEquals([1, 1, 123, 123], Object.values(P));
- assertEquals([
- "[[OwnPropertyKeys]]",
- "[[GetOwnProperty]](\"a\")",
- "[[Get]](\"a\")",
- "[[GetOwnProperty]](\"a\")",
- "[[Get]](\"a\")",
- "[[GetOwnProperty]](\"456\")",
- "[[Get]](\"456\")",
- "[[GetOwnProperty]](\"HIDDEN\")",
- "[[GetOwnProperty]](\"HIDDEN\")",
- "[[GetOwnProperty]](\"456\")",
- "[[Get]](\"456\")",
- ], log);
+ assertThrows(() => Object.values(P), TypeError);
}
TestOrderWithDuplicates();
diff --git a/deps/v8/test/mjsunit/for-of-in-catch-duplicate-decl.js b/deps/v8/test/mjsunit/for-of-in-catch-duplicate-decl.js
index ee0cda66d8..e1fdd43c94 100644
--- a/deps/v8/test/mjsunit/for-of-in-catch-duplicate-decl.js
+++ b/deps/v8/test/mjsunit/for-of-in-catch-duplicate-decl.js
@@ -2,4 +2,4 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-assertThrows("try { } catch (e) { var e; for (var e of []) {} }")
+assertDoesNotThrow("try { } catch (e) { var e; for (var e of []) {} }")
diff --git a/deps/v8/test/mjsunit/harmony/array-flat-species.js b/deps/v8/test/mjsunit/harmony/array-flat-species.js
index d04f8a0875..7181c10bea 100644
--- a/deps/v8/test/mjsunit/harmony/array-flat-species.js
+++ b/deps/v8/test/mjsunit/harmony/array-flat-species.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-array-flat
-
{
class MyArray extends Array {
static get [Symbol.species]() {
diff --git a/deps/v8/test/mjsunit/harmony/array-flat.js b/deps/v8/test/mjsunit/harmony/array-flat.js
index 86571e8dce..9a291dc3b0 100644
--- a/deps/v8/test/mjsunit/harmony/array-flat.js
+++ b/deps/v8/test/mjsunit/harmony/array-flat.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-array-flat
-
assertEquals(Array.prototype.flat.length, 0);
assertEquals(Array.prototype.flat.name, 'flat');
diff --git a/deps/v8/test/mjsunit/harmony/array-flatMap-species.js b/deps/v8/test/mjsunit/harmony/array-flatMap-species.js
index d4159b4801..48f9bea2d0 100644
--- a/deps/v8/test/mjsunit/harmony/array-flatMap-species.js
+++ b/deps/v8/test/mjsunit/harmony/array-flatMap-species.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-array-flat
-
{
class MyArray extends Array {
static get [Symbol.species]() {
diff --git a/deps/v8/test/mjsunit/harmony/array-flatMap.js b/deps/v8/test/mjsunit/harmony/array-flatMap.js
index 9f0426fe7f..65a4025603 100644
--- a/deps/v8/test/mjsunit/harmony/array-flatMap.js
+++ b/deps/v8/test/mjsunit/harmony/array-flatMap.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-array-flat --allow-natives-syntax
+// Flags: --allow-natives-syntax
assertEquals(Array.prototype.flatMap.length, 1);
assertEquals(Array.prototype.flatMap.name, 'flatMap');
diff --git a/deps/v8/test/mjsunit/harmony/bigint/as-int-n.js b/deps/v8/test/mjsunit/harmony/bigint/as-int-n.js
index ef48cadcc6..ccb7c79f93 100644
--- a/deps/v8/test/mjsunit/harmony/bigint/as-int-n.js
+++ b/deps/v8/test/mjsunit/harmony/bigint/as-int-n.js
@@ -297,4 +297,8 @@
}{
assertThrows(() => BigInt.asUintN(3, 12), TypeError);
assertEquals(4n, BigInt.asUintN(3, "12"));
+}{
+ // crbug.com/936506
+ assertEquals(1n, BigInt.asUintN(15, 0x100000001n));
+ assertEquals(1n, BigInt.asUintN(15, 0x10000000000000001n));
}
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-8808.js b/deps/v8/test/mjsunit/harmony/regress/regress-8808.js
new file mode 100644
index 0000000000..8c63936382
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-8808.js
@@ -0,0 +1,15 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-class-fields
+
+assertThrows(() => eval(`
+ class Foo {
+ #x = 1;
+ destructureX() {
+ const { #x: x } = this;
+ return x;
+ }
+ }
+`), SyntaxError);
diff --git a/deps/v8/test/mjsunit/harmony/symbol-description.js b/deps/v8/test/mjsunit/harmony/symbol-description.js
index ccba44c978..39de1b065d 100644
--- a/deps/v8/test/mjsunit/harmony/symbol-description.js
+++ b/deps/v8/test/mjsunit/harmony/symbol-description.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-symbol-description
-
{
let desc = Object.getOwnPropertyDescriptor(Symbol.prototype, 'description');
assertEquals(desc.set, undefined);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/basics.js b/deps/v8/test/mjsunit/harmony/weakrefs/basics.js
index 88fb020101..c1ec4070f4 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/basics.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/basics.js
@@ -4,151 +4,88 @@
// Flags: --harmony-weak-refs
-(function TestConstructWeakFactory() {
- let wf = new WeakFactory(() => {});
- assertEquals(wf.toString(), "[object WeakFactory]");
- assertNotSame(wf.__proto__, Object.prototype);
- assertSame(wf.__proto__.__proto__, Object.prototype);
+(function TestConstructFinalizationGroup() {
+ let fg = new FinalizationGroup(() => {});
+ assertEquals(fg.toString(), "[object FinalizationGroup]");
+ assertNotSame(fg.__proto__, Object.prototype);
+ assertSame(fg.__proto__.__proto__, Object.prototype);
})();
-(function TestWeakFactoryConstructorCallAsFunction() {
+(function TestFinalizationGroupConstructorCallAsFunction() {
let caught = false;
let message = "";
try {
- let f = WeakFactory(() => {});
+ let f = FinalizationGroup(() => {});
} catch (e) {
message = e.message;
caught = true;
} finally {
assertTrue(caught);
- assertEquals(message, "Constructor WeakFactory requires 'new'");
+ assertEquals(message, "Constructor FinalizationGroup requires 'new'");
}
})();
-(function TestConstructWeakFactoryCleanupNotCallable() {
- let message = "WeakFactory: cleanup must be callable";
- assertThrows(() => { let wf = new WeakFactory(); }, TypeError, message);
- assertThrows(() => { let wf = new WeakFactory(1); }, TypeError, message);
- assertThrows(() => { let wf = new WeakFactory(null); }, TypeError, message);
+(function TestConstructFinalizationGroupCleanupNotCallable() {
+ let message = "FinalizationGroup: cleanup must be callable";
+ assertThrows(() => { let fg = new FinalizationGroup(); }, TypeError, message);
+ assertThrows(() => { let fg = new FinalizationGroup(1); }, TypeError, message);
+ assertThrows(() => { let fg = new FinalizationGroup(null); }, TypeError, message);
})();
-(function TestConstructWeakFactoryWithCallableProxyAsCleanup() {
+(function TestConstructFinalizationGroupWithCallableProxyAsCleanup() {
let handler = {};
let obj = () => {};
let proxy = new Proxy(obj, handler);
- let wf = new WeakFactory(proxy);
+ let fg = new FinalizationGroup(proxy);
})();
-(function TestConstructWeakFactoryWithNonCallableProxyAsCleanup() {
- let message = "WeakFactory: cleanup must be callable";
+(function TestConstructFinalizationGroupWithNonCallableProxyAsCleanup() {
+ let message = "FinalizationGroup: cleanup must be callable";
let handler = {};
let obj = {};
let proxy = new Proxy(obj, handler);
- assertThrows(() => { let wf = new WeakFactory(proxy); }, TypeError, message);
+ assertThrows(() => { let fg = new FinalizationGroup(proxy); }, TypeError, message);
})();
-(function TestMakeCell() {
- let wf = new WeakFactory(() => {});
- let wc = wf.makeCell({});
- assertEquals(wc.toString(), "[object WeakCell]");
- assertNotSame(wc.__proto__, Object.prototype);
- assertSame(wc.__proto__.__proto__, Object.prototype);
- assertEquals(wc.holdings, undefined);
-
- let holdings_desc = Object.getOwnPropertyDescriptor(wc.__proto__, "holdings");
- assertEquals(true, holdings_desc.configurable);
- assertEquals(false, holdings_desc.enumerable);
- assertEquals("function", typeof holdings_desc.get);
- assertEquals(undefined, holdings_desc.set);
-
- let clear_desc = Object.getOwnPropertyDescriptor(wc.__proto__, "clear");
- assertEquals(true, clear_desc.configurable);
- assertEquals(false, clear_desc.enumerable);
- assertEquals("function", typeof clear_desc.value);
+(function TestRegisterWithNonObjectTarget() {
+ let fg = new FinalizationGroup(() => {});
+ let message = "FinalizationGroup.prototype.register: target must be an object";
+ assertThrows(() => fg.register(1, "holdings"), TypeError, message);
+ assertThrows(() => fg.register(false, "holdings"), TypeError, message);
+ assertThrows(() => fg.register("foo", "holdings"), TypeError, message);
+ assertThrows(() => fg.register(Symbol(), "holdings"), TypeError, message);
+ assertThrows(() => fg.register(null, "holdings"), TypeError, message);
+ assertThrows(() => fg.register(undefined, "holdings"), TypeError, message);
})();
-(function TestMakeCellWithHoldings() {
- let wf = new WeakFactory(() => {});
- let obj = {a: 1};
- let holdings = {b: 2};
- let wc = wf.makeCell(obj, holdings);
- assertSame(wc.holdings, holdings);
-})();
-
-(function TestMakeCellWithHoldingsSetHoldings() {
- let wf = new WeakFactory(() => {});
- let obj = {a: 1};
- let holdings = {b: 2};
- let wc = wf.makeCell(obj, holdings);
- assertSame(wc.holdings, holdings);
- wc.holdings = 5;
- assertSame(wc.holdings, holdings);
-})();
-
-(function TestMakeCellWithHoldingsSetHoldingsStrict() {
- "use strict";
- let wf = new WeakFactory(() => {});
- let obj = {a: 1};
- let holdings = {b: 2};
- let wc = wf.makeCell(obj, holdings);
- assertSame(wc.holdings, holdings);
- assertThrows(() => { wc.holdings = 5; }, TypeError);
- assertSame(wc.holdings, holdings);
-})();
-
-(function TestMakeCellWithNonObject() {
- let wf = new WeakFactory(() => {});
- let message = "WeakFactory.prototype.makeCell: target must be an object";
- assertThrows(() => wf.makeCell(), TypeError, message);
- assertThrows(() => wf.makeCell(1), TypeError, message);
- assertThrows(() => wf.makeCell(false), TypeError, message);
- assertThrows(() => wf.makeCell("foo"), TypeError, message);
- assertThrows(() => wf.makeCell(Symbol()), TypeError, message);
- assertThrows(() => wf.makeCell(null), TypeError, message);
- assertThrows(() => wf.makeCell(undefined), TypeError, message);
-})();
-
-(function TestMakeCellWithProxy() {
+(function TestRegisterWithProxy() {
let handler = {};
let obj = {};
let proxy = new Proxy(obj, handler);
- let wf = new WeakFactory(() => {});
- let wc = wf.makeCell(proxy);
+ let fg = new FinalizationGroup(() => {});
+ fg.register(proxy);
})();
-(function TestMakeCellTargetAndHoldingsSameValue() {
- let wf = new WeakFactory(() => {});
+(function TestRegisterTargetAndHoldingsSameValue() {
+ let fg = new FinalizationGroup(() => {});
let obj = {a: 1};
// SameValue(target, holdings) not ok
- assertThrows(() => wf.makeCell(obj, obj), TypeError,
- "WeakFactory.prototype.makeCell: target and holdings must not be same");
+ assertThrows(() => fg.register(obj, obj), TypeError,
+ "FinalizationGroup.prototype.register: target and holdings must not be same");
let holdings = {a: 1};
- let wc = wf.makeCell(obj, holdings);
+ fg.register(obj, holdings);
})();
-(function TestMakeCellWithoutWeakFactory() {
- assertThrows(() => WeakFactory.prototype.makeCell.call({}, {}), TypeError);
+(function TestRegisterWithoutFinalizationGroup() {
+ assertThrows(() => FinalizationGroup.prototype.register.call({}, {}, "holdings"), TypeError);
// Does not throw:
- let wf = new WeakFactory(() => {});
- WeakFactory.prototype.makeCell.call(wf, {});
+ let fg = new FinalizationGroup(() => {});
+ FinalizationGroup.prototype.register.call(fg, {}, "holdings");
})();
-(function TestHoldingsWithoutWeakCell() {
- let wf = new WeakFactory(() => {});
- let wc = wf.makeCell({});
- let holdings_getter = Object.getOwnPropertyDescriptor(wc.__proto__, "holdings").get;
- assertThrows(() => holdings_getter.call({}), TypeError);
- // Does not throw:
- holdings_getter.call(wc);
-})();
-
-(function TestClearWithoutWeakCell() {
- let wf = new WeakFactory(() => {});
- let wc = wf.makeCell({});
- let clear = Object.getOwnPropertyDescriptor(wc.__proto__, "clear").value;
- assertThrows(() => clear.call({}), TypeError);
- // Does not throw:
- clear.call(wc);
+(function TestUnregisterWithNonExistentKey() {
+ let fg = new FinalizationGroup(() => {});
+ fg.unregister({"k": "whatever"});
})();
(function TestWeakRefConstructor() {
@@ -194,21 +131,10 @@
let wr = new WeakRef(proxy);
})();
-(function TestCleanupSomeWithoutWeakFactory() {
- assertThrows(() => WeakFactory.prototype.cleanupSome.call({}), TypeError);
+(function TestCleanupSomeWithoutFinalizationGroup() {
+ assertThrows(() => FinalizationGroup.prototype.cleanupSome.call({}), TypeError);
// Does not throw:
- let wf = new WeakFactory(() => {});
- let rv = WeakFactory.prototype.cleanupSome.call(wf);
+ let fg = new FinalizationGroup(() => {});
+ let rv = FinalizationGroup.prototype.cleanupSome.call(fg);
assertEquals(undefined, rv);
})();
-
-(function TestDerefWithoutWeakRef() {
- let wf = new WeakFactory(() => {});
- let wc = wf.makeCell({});
- let wr = new WeakRef({});
- let deref = Object.getOwnPropertyDescriptor(wr.__proto__, "deref").value;
- assertThrows(() => deref.call({}), TypeError);
- assertThrows(() => deref.call(wc), TypeError);
- // Does not throw:
- deref.call(wr);
-})();
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-cells.js b/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-holdings.js
index f8e44c355c..20726284bb 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-cells.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-doesnt-iterate-all-holdings.js
@@ -7,48 +7,47 @@
let cleanup_call_count = 0;
let cleanup = function(iter) {
if (cleanup_call_count == 0) {
- // First call: iterate 2 of the 3 cells
- let cells = [];
- for (wc of iter) {
- cells.push(wc);
- // Don't iterate the rest of the cells
- if (cells.length == 2) {
+ // First call: iterate 2 of the 3 holdings
+ let holdings_list = [];
+ for (holdings of iter) {
+ holdings_list.push(holdings);
+ // Don't iterate the rest of the holdings
+ if (holdings_list.length == 2) {
break;
}
}
- assertEquals(cells.length, 2);
- assertTrue(cells[0].holdings < 3);
- assertTrue(cells[1].holdings < 3);
+ assertEquals(holdings_list.length, 2);
+ assertTrue(holdings_list[0] < 3);
+ assertTrue(holdings_list[1] < 3);
// Update call count only after the asserts; this ensures that the test
// fails even if the exceptions inside the cleanup function are swallowed.
cleanup_call_count++;
} else {
- // Second call: iterate one leftover cell and one new cell.
+ // Second call: iterate one leftover holdings and one holdings.
assertEquals(1, cleanup_call_count);
- let cells = [];
- for (wc of iter) {
- cells.push(wc);
+ let holdings_list = [];
+ for (holdings of iter) {
+ holdings_list.push(holdings);
}
- assertEquals(cells.length, 2);
- assertTrue((cells[0].holdings < 3 && cells[1].holdings == 100) ||
- (cells[1].holdings < 3 && cells[0].holdings == 100));
+ assertEquals(holdings_list.length, 2);
+ assertTrue((holdings_list[0] < 3 && holdings_list[1] == 100) ||
+ (holdings_list[1] < 3 && holdings_list[0] == 100));
// Update call count only after the asserts; this ensures that the test
// fails even if the exceptions inside the cleanup function are swallowed.
cleanup_call_count++;
}
}
-let wf = new WeakFactory(cleanup);
-// Create 3 objects and WeakCells pointing to them. The objects need to be
-// inside a closure so that we can reliably kill them!
-let weak_cells = [];
+let fg = new FinalizationGroup(cleanup);
+// Create 3 objects and register them in the FinalizationGroup. The objects need
+// to be inside a closure so that we can reliably kill them!
(function() {
let objects = [];
for (let i = 0; i < 3; ++i) {
objects[i] = {a: i};
- weak_cells[i] = wf.makeCell(objects[i], i);
+ fg.register(objects[i], i);
}
gc();
@@ -58,14 +57,14 @@ let weak_cells = [];
objects = [];
})();
-// This GC will discover dirty WeakCells.
+// This GC will reclaim the targets.
gc();
assertEquals(0, cleanup_call_count);
let timeout_func_1 = function() {
assertEquals(1, cleanup_call_count);
- // Assert that the cleanup function won't be called unless new WeakCells appear.
+ // Assert that the cleanup function won't be called unless new targets appear.
setTimeout(timeout_func_2, 0);
}
@@ -74,9 +73,9 @@ setTimeout(timeout_func_1, 0);
let timeout_func_2 = function() {
assertEquals(1, cleanup_call_count);
- // Create a new WeakCells to be cleaned up.
+ // Create a new object and register it.
let obj = {};
- let wc = wf.makeCell(obj, 100);
+ let wc = fg.register(obj, 100);
obj = null;
gc();
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js b/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js
index 02f05ac8e2..97ab1dbd80 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-from-different-realm.js
@@ -9,15 +9,15 @@ let r = Realm.create();
let cleanup = Realm.eval(r, "var stored_global; function cleanup() { stored_global = globalThis; } cleanup");
let realm_global_this = Realm.eval(r, "globalThis");
-let wf = new WeakFactory(cleanup);
+let fg = new FinalizationGroup(cleanup);
-// Create an object and a WeakCell pointing to it. The object needs to be inside
-// a closure so that we can reliably kill them!
+// Create an object and a register it in the FinalizationGroup. The object needs
+// to be inside a closure so that we can reliably kill them!
let weak_cell;
(function() {
let object = {};
- weak_cell = wf.makeCell(object);
+ fg.register(object, {});
// object goes out of scope.
})();
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js b/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js
index 6a5bcfa821..c6b834e8fb 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-is-a-microtask.js
@@ -19,17 +19,17 @@ let log = [];
let cleanup = (iter) => {
log.push("cleanup");
- for (wc of iter) { }
+ for (holdings of iter) { }
}
-let wf = new WeakFactory(cleanup);
+let fg = new FinalizationGroup(cleanup);
let o = null;
(function() {
// Use a closure here to avoid other references to o which might keep it alive
// (e.g., stack frames pointing to it).
o = {};
- wf.makeCell(o);
+ fg.register(o, {});
})();
let microtask_after_cleanup = () => {
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js b/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js
index 2e46830093..1d275a19aa 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/cleanup-proxy-from-different-realm.js
@@ -9,15 +9,15 @@ let r = Realm.create();
let cleanup = Realm.eval(r, "var stored_global; let cleanup = new Proxy(function() { stored_global = globalThis;}, {}); cleanup");
let realm_global_this = Realm.eval(r, "globalThis");
-let wf = new WeakFactory(cleanup);
+let fg = new FinalizationGroup(cleanup);
-// Create an object and a WeakCell pointing to it. The object needs to be inside
-// a closure so that we can reliably kill them!
+// Create an object and register it in the FinalizationGroup. The object needs
+// to be inside a closure so that we can reliably kill them!
let weak_cell;
(function() {
let object = {};
- weak_cell = wf.makeCell(object);
+ fg.register(object, "holdings");
// object goes out of scope.
})();
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome-cleared-weakcell.js b/deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome-after-unregister.js
index 631f43c012..0cef0a1af5 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome-cleared-weakcell.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome-after-unregister.js
@@ -5,31 +5,31 @@
// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
let cleanup_count = 0;
-let cleanup_cells = [];
+let cleanup_holdings = [];
let cleanup = function(iter) {
- for (wc of iter) {
- cleanup_cells.push(wc);
+ for (holdings of iter) {
+ cleanup_holdings.push(holdings);
}
++cleanup_count;
}
-let wf = new WeakFactory(cleanup);
-let weak_cell;
+let fg = new FinalizationGroup(cleanup);
+let key = {"k": "this is the key"};
(function() {
let o = {};
- weak_cell = wf.makeCell(o);
+ weak_cell = fg.register(o, "holdings", key);
- // cleanupSome won't do anything since there are no dirty WeakCells.
- wf.cleanupSome();
+ // cleanupSome won't do anything since there are no reclaimed targets.
+ fg.cleanupSome();
assertEquals(0, cleanup_count);
})();
// GC will detect the WeakCell as dirty.
gc();
-// Clear the WeakCell just before we would've called cleanupSome.
-weak_cell.clear();
+// Unregister the tracked object just before calling cleanupSome.
+fg.unregister(key);
-wf.cleanupSome();
+fg.cleanupSome();
assertEquals(0, cleanup_count);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome-weakcell.js b/deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome.js
index 84a946d390..1d3ceda3f2 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome-weakcell.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/cleanupsome.js
@@ -5,29 +5,28 @@
// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
let cleanup_count = 0;
-let cleanup_cells = [];
+let cleanup_holdings = [];
let cleanup = function(iter) {
- for (wc of iter) {
- cleanup_cells.push(wc);
+ for (holdings of iter) {
+ cleanup_holdings.push(holdings);
}
++cleanup_count;
}
-let wf = new WeakFactory(cleanup);
-let weak_cell;
+let fg = new FinalizationGroup(cleanup);
(function() {
let o = {};
- weak_cell = wf.makeCell(o);
+ fg.register(o, "holdings");
- // cleanupSome won't do anything since there are no dirty WeakCells.
- wf.cleanupSome();
+ // cleanupSome won't do anything since there are no reclaimed targets.
+ fg.cleanupSome();
assertEquals(0, cleanup_count);
})();
-// GC will detect the WeakCell as dirty.
+// GC will detect o as dead.
gc();
-wf.cleanupSome();
+fg.cleanupSome();
assertEquals(1, cleanup_count);
-assertEquals(1, cleanup_cells.length);
-assertEquals(weak_cell, cleanup_cells[0]);
+assertEquals(1, cleanup_holdings.length);
+assertEquals("holdings", cleanup_holdings[0]);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/clear-called-twice.js b/deps/v8/test/mjsunit/harmony/weakrefs/clear-called-twice.js
deleted file mode 100644
index a5aa537ff2..0000000000
--- a/deps/v8/test/mjsunit/harmony/weakrefs/clear-called-twice.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// Copyright 2018 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
-
-let cleanup_call_count = 0;
-let cleanup = function(iter) {
- ++cleanup_call_count;
-}
-
-let wf = new WeakFactory(cleanup);
-// Create an object and a WeakCell pointing to it. The object needs to be inside
-// a closure so that we can reliably kill them!
-let weak_cell;
-
-(function() {
- let object = {};
- weak_cell = wf.makeCell(object);
-
- // Clear the WeakCell before the GC has a chance to discover it.
- weak_cell.clear();
-
- // Call clear again (just to assert we handle this gracefully).
- weak_cell.clear();
-
- // object goes out of scope.
-})();
-
-// This GC will discover dirty WeakCells.
-gc();
-assertEquals(0, cleanup_call_count);
-
-// Assert that the cleanup function won't be called, since the WeakCell was cleared.
-let timeout_func = function() {
- assertEquals(0, cleanup_call_count);
-}
-
-setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/clear-clears-factory-pointer.js b/deps/v8/test/mjsunit/harmony/weakrefs/clear-clears-factory-pointer.js
deleted file mode 100644
index 98410d5d0e..0000000000
--- a/deps/v8/test/mjsunit/harmony/weakrefs/clear-clears-factory-pointer.js
+++ /dev/null
@@ -1,49 +0,0 @@
-// Copyright 2018 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
-
-// Test that WeakCell.prototype.clear() also clears the WeakFactory pointer of
-// WeakCell. The only way to observe this is to assert that the WeakCell no
-// longer keeps its WeakFactory alive after clear() has been called.
-
-let weak_cell;
-let weak_cell_pointing_to_factory;
-
-let cleanup1_call_count = 0;
-let cleanup2_call_count = 0;
-
-let cleanup1 = function() {
- ++cleanup1_call_count;
-}
-
-let cleanup2 = function() {
- ++cleanup2_call_count;
-}
-
-let wf1 = new WeakFactory(cleanup1);
-
-(function(){
- let wf2 = new WeakFactory(cleanup2);
-
- (function() {
- let object = {};
- weak_cell = wf2.makeCell(object);
- // object goes out of scope.
- })();
-
- weak_cell_pointing_to_factory = wf1.makeCell(wf2);
- // wf goes out of scope
-})();
-
-weak_cell.clear();
-gc();
-
-// Assert that weak_cell_pointing_to_factory now got cleared.
-let timeout_func = function() {
- assertEquals(1, cleanup1_call_count);
- assertEquals(0, cleanup2_call_count);
-}
-
-setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup4.js b/deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup4.js
deleted file mode 100644
index 794f356119..0000000000
--- a/deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup4.js
+++ /dev/null
@@ -1,48 +0,0 @@
-// Copyright 2018 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
-
-let cleanup_call_count = 0;
-let cleanup_weak_cell_count = 0;
-let cleanup = function(iter) {
- for (wc of iter) {
- // See which WeakCell we're iterating over and clear the other one.
- if (wc == weak_cell1) {
- weak_cell2.clear();
- } else {
- assertSame(wc, weak_cell2);
- weak_cell1.clear();
- }
- ++cleanup_weak_cell_count;
- }
- ++cleanup_call_count;
-}
-
-let wf = new WeakFactory(cleanup);
-// Create an object and a WeakCell pointing to it. The object needs to be inside
-// a closure so that we can reliably kill them!
-let weak_cell1;
-let weak_cell2;
-
-(function() {
- let object1 = {};
- weak_cell1 = wf.makeCell(object1);
- let object2 = {};
- weak_cell2 = wf.makeCell(object2);
-
- // object1 and object2 go out of scope.
-})();
-
-// This GC will discover dirty WeakCells and schedule cleanup.
-gc();
-assertEquals(0, cleanup_call_count);
-
-// Assert that the cleanup function was called and iterated one WeakCell (but not the other one).
-let timeout_func = function() {
- assertEquals(1, cleanup_call_count);
- assertEquals(1, cleanup_weak_cell_count);
-}
-
-setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/weak-factory-keeps-weak-cells-alive.js b/deps/v8/test/mjsunit/harmony/weakrefs/finalization-group-keeps-holdings-alive.js
index 367cd9a9c0..ea35a2e63f 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/weak-factory-keeps-weak-cells-alive.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/finalization-group-keeps-holdings-alive.js
@@ -7,18 +7,19 @@
let cleanup_called = false;
let cleanup = function(iter) {
assertFalse(cleanup_called);
- let cells = [];
- for (wc of iter) {
- cells.push(wc);
+ let holdings_list = [];
+ for (holdings of iter) {
+ holdings_list.push(holdings);
}
- assertEquals(cells.length, 1);
- assertEquals(cells[0].holdings, "this is my cell");
+ assertEquals(holdings_list.length, 1);
+ assertEquals(holdings_list[0].a, "this is the holdings object");
cleanup_called = true;
}
-let wf = new WeakFactory(cleanup);
+let fg = new FinalizationGroup(cleanup);
let o1 = {};
-let wc1 = wf.makeCell(o1, "this is my cell");
+let holdings = {'a': 'this is the holdings object'};
+fg.register(o1, holdings);
gc();
assertFalse(cleanup_called);
@@ -26,9 +27,9 @@ assertFalse(cleanup_called);
// Drop the last references to o1.
o1 = null;
-// Drop the last reference to the WeakCell. The WeakFactory keeps it alive, so
-// the cleanup function will be called as normal.
-wc1 = null;
+// Drop the last reference to the holdings. The FinalizationGroup keeps it
+// alive, so the cleanup function will be called as normal.
+holdings = null;
gc();
assertFalse(cleanup_called);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/weakcell-and-weakref.js b/deps/v8/test/mjsunit/harmony/weakrefs/finalizationgroup-and-weakref.js
index f6627be19e..bd66f1ce1d 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/weakcell-and-weakref.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/finalizationgroup-and-weakref.js
@@ -7,27 +7,26 @@
let cleanup_called = false;
let cleanup = function(iter) {
assertFalse(cleanup_called);
- let cells = [];
- for (wc of iter) {
- cells.push(wc);
+ let holdings_list = [];
+ for (holdings of iter) {
+ holdings_list.push(holdings);
}
- assertEquals(1, cells.length);
- assertEquals(weak_cell, cells[0]);
+ assertEquals(1, holdings_list.length);
+ assertEquals("holdings", holdings_list[0]);
cleanup_called = true;
}
-let wf = new WeakFactory(cleanup);
+let fg = new FinalizationGroup(cleanup);
let weak_ref;
-let weak_cell;
(function() {
let o = {};
weak_ref = new WeakRef(o);
- weak_cell = wf.makeCell(o);
+ fg.register(o, "holdings");
})();
// Since the WeakRef was created during this turn, it is not cleared by GC. The
-// WeakCell is not cleared either, since the WeakRef keeps the target object
-// alive.
+// pointer inside the FinalizationGroup is not cleared either, since the WeakRef
+// keeps the target object alive.
gc();
(function() {
assertNotEquals(undefined, weak_ref.deref());
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/factory-scheduled-for-cleanup-multiple-times.js b/deps/v8/test/mjsunit/harmony/weakrefs/finalizationgroup-scheduled-for-cleanup-multiple-times.js
index 2f3915478e..a1cff3aaa0 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/factory-scheduled-for-cleanup-multiple-times.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/finalizationgroup-scheduled-for-cleanup-multiple-times.js
@@ -6,66 +6,66 @@
// Flags: --no-stress-flush-bytecode
let cleanup0_call_count = 0;
-let cleanup0_weak_cell_count = 0;
+let cleanup0_holdings_count = 0;
let cleanup1_call_count = 0;
-let cleanup1_weak_cell_count = 0;
+let cleanup1_holdings_count = 0;
let cleanup0 = function(iter) {
- for (wc of iter) {
- ++cleanup0_weak_cell_count;
+ for (holdings of iter) {
+ ++cleanup0_holdings_count;
}
++cleanup0_call_count;
}
let cleanup1 = function(iter) {
- for (wc of iter) {
- ++cleanup1_weak_cell_count;
+ for (holdings of iter) {
+ ++cleanup1_holdings_count;
}
++cleanup1_call_count;
}
-let wf0 = new WeakFactory(cleanup0);
-let wf1 = new WeakFactory(cleanup1);
+let fg0 = new FinalizationGroup(cleanup0);
+let fg1 = new FinalizationGroup(cleanup1);
-// Create 1 WeakCell for each WeakFactory and kill the objects they point to.
+// Register 1 weak reference for each FinalizationGroup and kill the objects they point to.
(function() {
// The objects need to be inside a closure so that we can reliably kill them.
let objects = [];
objects[0] = {};
objects[1] = {};
- wf0.makeCell(objects[0]);
- wf1.makeCell(objects[1]);
+ fg0.register(objects[0], "holdings0-0");
+ fg1.register(objects[1], "holdings1-0");
// Drop the references to the objects.
objects = [];
- // Will schedule both wf0 and wf1 for cleanup.
+ // Will schedule both fg0 and fg1 for cleanup.
gc();
})();
// Before the cleanup task has a chance to run, do the same thing again, so both
-// factories are (again) scheduled for cleanup. This has to be a IIFE function
+// FinalizationGroups are (again) scheduled for cleanup. This has to be a IIFE function
// (so that we can reliably kill the objects) so we cannot use the same function
// as before.
(function() {
let objects = [];
objects[0] = {};
objects[1] = {};
- wf0.makeCell(objects[0]);
- wf1.makeCell(objects[1]);
+ fg0.register(objects[0], "holdings0-1");
+ fg1.register(objects[1], "holdings1-1");
objects = [];
gc();
})();
let timeout_func = function() {
assertEquals(1, cleanup0_call_count);
- assertEquals(2, cleanup0_weak_cell_count);
+ assertEquals(2, cleanup0_holdings_count);
assertEquals(1, cleanup1_call_count);
- assertEquals(2, cleanup1_weak_cell_count);
+ assertEquals(2, cleanup1_holdings_count);
}
-// Give the cleanup task a chance to run. All WeakCells to cleanup will be
-// available during the same invocation of the cleanup function.
+// Give the cleanup task a chance to run. All holdings will be iterated during
+// the same invocation of the cleanup function.
setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/iterating-weak-cells.js b/deps/v8/test/mjsunit/harmony/weakrefs/iterating-in-cleanup.js
index 9fef051122..73aac76378 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/iterating-weak-cells.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/iterating-in-cleanup.js
@@ -7,29 +7,25 @@
let cleanup_called = false;
let cleanup = function(iter) {
assertFalse(cleanup_called);
- let cells = [];
- for (wc of iter) {
- cells.push(wc);
+ let holdings_list = [];
+ for (holdings of iter) {
+ holdings_list.push(holdings);
}
- assertEquals(cells.length, 2);
- if (cells[0] == wc1) {
- assertEquals(cells[0].holdings, 1);
- assertEquals(cells[1], wc2);
- assertEquals(cells[1].holdings, 2);
+ assertEquals(holdings_list.length, 2);
+ if (holdings_list[0] == 1) {
+ assertEquals(holdings_list[1], 2);
} else {
- assertEquals(cells[0], wc2);
- assertEquals(cells[0].holdings, 2);
- assertEquals(cells[1], wc1);
- assertEquals(cells[1].holdings, 1);
+ assertEquals(holdings_list[0], 2);
+ assertEquals(holdings_list[1], 1);
}
cleanup_called = true;
}
-let wf = new WeakFactory(cleanup);
+let fg = new FinalizationGroup(cleanup);
let o1 = {};
let o2 = {};
-let wc1 = wf.makeCell(o1, 1);
-let wc2 = wf.makeCell(o2, 2);
+fg.register(o1, 1);
+fg.register(o2, 2);
gc();
assertFalse(cleanup_called);
@@ -37,8 +33,8 @@ assertFalse(cleanup_called);
// Drop the last references to o1 and o2.
o1 = null;
o2 = null;
-// GC will clear the WeakCells; the cleanup function will be called the next time
-// we enter the event loop.
+// GC will reclaim the target objects; the cleanup function will be called the
+// next time we enter the event loop.
gc();
assertFalse(cleanup_called);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/multiple-dirty-weak-factories.js b/deps/v8/test/mjsunit/harmony/weakrefs/multiple-dirty-finalization-groups.js
index 98a33df240..51e721401a 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/multiple-dirty-weak-factories.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/multiple-dirty-finalization-groups.js
@@ -5,28 +5,26 @@
// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
let cleanup_call_count = 0;
-let cleanup_weak_cell_count = 0;
+let cleanup_holdings_count = 0;
let cleanup = function(iter) {
- for (wc of iter) {
- ++cleanup_weak_cell_count;
+ for (holdings of iter) {
+ ++cleanup_holdings_count;
}
++cleanup_call_count;
}
-let wf1 = new WeakFactory(cleanup);
-let wf2 = new WeakFactory(cleanup);
+let fg1 = new FinalizationGroup(cleanup);
+let fg2 = new FinalizationGroup(cleanup);
-// Create two objects and WeakCells pointing to them. The objects need to be inside
-// a closure so that we can reliably kill them!
-let weak_cell1;
-let weak_cell2;
+// Create two objects and register them in FinalizationGroups. The objects need
+// to be inside a closure so that we can reliably kill them!
(function() {
let object1 = {};
- weak_cell1 = wf1.makeCell(object1);
+ fg1.register(object1, "holdings1");
let object2 = {};
- weak_cell2 = wf2.makeCell(object2);
+ fg2.register(object2, "holdings2");
// object1 and object2 go out of scope.
})();
@@ -35,10 +33,10 @@ let weak_cell2;
gc();
assertEquals(0, cleanup_call_count);
-// Assert that the cleanup function was called and iterated the WeakCells.
+// Assert that the cleanup function was called and iterated the holdings.
let timeout_func = function() {
assertEquals(2, cleanup_call_count);
- assertEquals(2, cleanup_weak_cell_count);
+ assertEquals(2, cleanup_holdings_count);
}
setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup2.js b/deps/v8/test/mjsunit/harmony/weakrefs/undefined-holdings.js
index 0aab366f97..ac3dc6041a 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup2.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/undefined-holdings.js
@@ -1,40 +1,39 @@
-// Copyright 2018 the V8 project authors. All rights reserved.
+// Copyright 2019 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
let cleanup_call_count = 0;
-let cleanup_weak_cell_count = 0;
+let cleanup_holdings_count = 0;
let cleanup = function(iter) {
- for (wc of iter) {
- assertSame(wc, weak_cell);
- wc.clear();
- ++cleanup_weak_cell_count;
+ for (holdings of iter) {
+ assertEquals(holdings, undefined);
+ ++cleanup_holdings_count;
}
++cleanup_call_count;
}
-let wf = new WeakFactory(cleanup);
-// Create an object and a WeakCell pointing to it. The object needs to be inside
+let fg = new FinalizationGroup(cleanup);
+
+// Create an object and register it in the FinalizationGroup. The object needs to be inside
// a closure so that we can reliably kill them!
-let weak_cell;
(function() {
let object = {};
- weak_cell = wf.makeCell(object);
+ fg.register(object);
// object goes out of scope.
})();
-// This GC will discover dirty WeakCells and schedule cleanup.
+// This GC will reclaim the target object and schedule cleanup.
gc();
assertEquals(0, cleanup_call_count);
-// Assert that the cleanup function was called and iterated the WeakCell.
+// Assert that the cleanup function was called and iterated the holdings.
let timeout_func = function() {
assertEquals(1, cleanup_call_count);
- assertEquals(1, cleanup_weak_cell_count);
+ assertEquals(1, cleanup_holdings_count);
}
setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/clear-after-cleanup.js b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-after-cleanup.js
index 3392d7fbb9..f6480f86b6 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/clear-after-cleanup.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-after-cleanup.js
@@ -5,42 +5,42 @@
// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
let cleanup_call_count = 0;
-let cleanup_weak_cell_count = 0;
+let cleanup_holdings_count = 0;
let cleanup = function(iter) {
- for (wc of iter) {
- assertSame(wc, weak_cell);
- ++cleanup_weak_cell_count;
+ for (holdings of iter) {
+ assertEquals("holdings", holdings);
+ ++cleanup_holdings_count;
}
++cleanup_call_count;
}
-let wf = new WeakFactory(cleanup);
-// Create an object and a WeakCell pointing to it. The object needs to be inside
-// a closure so that we can reliably kill them!
-let weak_cell;
+let fg = new FinalizationGroup(cleanup);
+let key = {"k": "this is the key"};
+// Create an object and register it in the FinalizationGroup. The object needs
+// to be inside a closure so that we can reliably kill them!
(function() {
let object = {};
- weak_cell = wf.makeCell(object);
+ fg.register(object, "holdings", key);
// object goes out of scope.
})();
-// This GC will discover dirty WeakCells and schedule cleanup.
+// This GC will reclaim the target object and schedule cleanup.
gc();
assertEquals(0, cleanup_call_count);
-// Assert that the cleanup function was called and iterated the WeakCell.
+// Assert that the cleanup function was called and iterated the holdings.
let timeout_func = function() {
assertEquals(1, cleanup_call_count);
- assertEquals(1, cleanup_weak_cell_count);
+ assertEquals(1, cleanup_holdings_count);
- // Clear an already iterated over WeakCell.
- weak_cell.clear();
+ // Unregister an already iterated over weak reference.
+ fg.unregister(key);
// Assert that it didn't do anything.
setTimeout(() => { assertEquals(1, cleanup_call_count); }, 0);
- setTimeout(() => { assertEquals(1, cleanup_weak_cell_count); }, 0);
+ setTimeout(() => { assertEquals(1, cleanup_holdings_count); }, 0);
}
setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/clear-before-cleanup.js b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-before-cleanup.js
index 1fd0fbf3b0..10b8bc67ff 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/clear-before-cleanup.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-before-cleanup.js
@@ -9,30 +9,27 @@ let cleanup = function(iter) {
++cleanup_call_count;
}
-let wf = new WeakFactory(cleanup);
-// Create an object and a WeakCell pointing to it. The object needs to be inside
-// a closure so that we can reliably kill them!
-let weak_cell;
+let fg = new FinalizationGroup(cleanup);
+let key = {"k": "this is the key"};
+// Create an object and register it in the FinalizationGroup. The object needs
+// to be inside a closure so that we can reliably kill them!
(function() {
let object = {};
- weak_cell = wf.makeCell(object, "my holdings");
+ fg.register(object, "my holdings", key);
// Clear the WeakCell before the GC has a chance to discover it.
- let return_value = weak_cell.clear();
+ let return_value = fg.unregister(key);
assertEquals(undefined, return_value);
- // Assert holdings got cleared too.
- assertEquals(undefined, weak_cell.holdings);
-
// object goes out of scope.
})();
-// This GC will discover dirty WeakCells.
+// This GC will reclaim the target object.
gc();
assertEquals(0, cleanup_call_count);
-// Assert that the cleanup function won't be called, since the WeakCell was cleared.
+// Assert that the cleanup function won't be called, since we called unregister.
let timeout_func = function() {
assertEquals(0, cleanup_call_count);
}
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/unregister-called-twice.js b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-called-twice.js
new file mode 100644
index 0000000000..e6ea150027
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-called-twice.js
@@ -0,0 +1,40 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
+
+let cleanup_call_count = 0;
+let cleanup = function(iter) {
+ ++cleanup_call_count;
+}
+
+let fg = new FinalizationGroup(cleanup);
+let key = {"k": "this is the key"};
+// Create an object and register it in the FinalizationGroup. The object needs
+// to be inside a closure so that we can reliably kill them!
+
+(function() {
+ let object = {};
+ fg.register(object, "holdings", key);
+
+ // Unregister before the GC has a chance to discover the object.
+ fg.unregister(key);
+
+ // Call unregister again (just to assert we handle this gracefully).
+ fg.unregister(key);
+
+ // object goes out of scope.
+})();
+
+// This GC will reclaim the target object.
+gc();
+assertEquals(0, cleanup_call_count);
+
+// Assert that the cleanup function won't be called, since the weak reference
+// was unregistered.
+let timeout_func = function() {
+ assertEquals(0, cleanup_call_count);
+}
+
+setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup1.js b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup1.js
index 6c06d7af74..aa9eab20ff 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup1.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup1.js
@@ -5,37 +5,37 @@
// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
let cleanup_call_count = 0;
-let cleanup_weak_cell_count = 0;
+let cleanup_holdings_count = 0;
let cleanup = function(iter) {
- // Clear the WeakCell before we've iterated through it.
- weak_cell.clear();
+ // Unregister before we've iterated through the holdings.
+ fg.unregister(key);
for (wc of iter) {
- ++cleanup_weak_cell_count;
+ ++cleanup_holdings_count;
}
++cleanup_call_count;
}
-let wf = new WeakFactory(cleanup);
-// Create an object and a WeakCell pointing to it. The object needs to be inside
-// a closure so that we can reliably kill them!
-let weak_cell;
+let fg = new FinalizationGroup(cleanup);
+let key = {"k": "the key"};
+// Create an object and register it in the FinalizationGroup. The object needs
+// to be inside a closure so that we can reliably kill them!
(function() {
let object = {};
- weak_cell = wf.makeCell(object);
+ fg.register(object, "holdings", key);
// object goes out of scope.
})();
-// This GC will discover dirty WeakCells and schedule cleanup.
+// This GC will discover unretained targets and schedule cleanup.
gc();
assertEquals(0, cleanup_call_count);
-// Assert that the cleanup function was called, but didn't iterate any weak cells.
+// Assert that the cleanup function was called, but didn't iterate any holdings.
let timeout_func = function() {
assertEquals(1, cleanup_call_count);
- assertEquals(0, cleanup_weak_cell_count);
+ assertEquals(0, cleanup_holdings_count);
}
setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup3.js b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup2.js
index 9dcea5ded5..84ec3aaef8 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/clear-inside-cleanup3.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup2.js
@@ -5,25 +5,24 @@
// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
let cleanup_call_count = 0;
-let cleanup_weak_cell_count = 0;
+let cleanup_holdings_count = 0;
let cleanup = function(iter) {
- for (wc of iter) {
- assertSame(wc, weak_cell);
- ++cleanup_weak_cell_count;
+ for (holdings of iter) {
+ assertEquals(holdings, "holdings");
+ fg.unregister(key);
+ ++cleanup_holdings_count;
}
- // Clear an already iterated over WeakCell.
- weak_cell.clear();
++cleanup_call_count;
}
-let wf = new WeakFactory(cleanup);
-// Create an object and a WeakCell pointing to it. The object needs to be inside
+let fg = new FinalizationGroup(cleanup);
+// Create an object and register it in the FinalizationGroup. The object needs to be inside
// a closure so that we can reliably kill them!
-let weak_cell;
+let key = {"k": "this is the key"};
(function() {
let object = {};
- weak_cell = wf.makeCell(object);
+ fg.register(object, "holdings", key);
// object goes out of scope.
})();
@@ -35,7 +34,7 @@ assertEquals(0, cleanup_call_count);
// Assert that the cleanup function was called and iterated the WeakCell.
let timeout_func = function() {
assertEquals(1, cleanup_call_count);
- assertEquals(1, cleanup_weak_cell_count);
+ assertEquals(1, cleanup_holdings_count);
}
setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup3.js b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup3.js
new file mode 100644
index 0000000000..39706a7b9b
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup3.js
@@ -0,0 +1,42 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
+
+let cleanup_call_count = 0;
+let cleanup_holdings_count = 0;
+let cleanup = function(iter) {
+ for (holdings of iter) {
+ assertEquals(holdings, "holdings");
+ ++cleanup_holdings_count;
+ }
+ // Unregister an already iterated over weak reference.
+ fg.unregister(key);
+ ++cleanup_call_count;
+}
+
+let fg = new FinalizationGroup(cleanup);
+let key = {"k": "this is the key"};
+
+// Create an object and register it in the FinalizationGroup. The object needs to be inside
+// a closure so that we can reliably kill them!
+
+(function() {
+ let object = {};
+ fg.register(object, "holdings", key);
+
+ // object goes out of scope.
+})();
+
+// This GC will reclaim the target object and schedule cleanup.
+gc();
+assertEquals(0, cleanup_call_count);
+
+// Assert that the cleanup function was called and iterated the holdings.
+let timeout_func = function() {
+ assertEquals(1, cleanup_call_count);
+ assertEquals(1, cleanup_holdings_count);
+}
+
+setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup4.js b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup4.js
new file mode 100644
index 0000000000..67ed227502
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-inside-cleanup4.js
@@ -0,0 +1,48 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
+
+let cleanup_call_count = 0;
+let cleanup_holdings_count = 0;
+let cleanup = function(iter) {
+ for (holdings of iter) {
+ // See which target we're iterating over and unregister the other one.
+ if (holdings == 1) {
+ fg.unregister(key2);
+ } else {
+ assertSame(holdings, 2);
+ fg.unregister(key1);
+ }
+ ++cleanup_holdings_count;
+ }
+ ++cleanup_call_count;
+}
+
+let fg = new FinalizationGroup(cleanup);
+let key1 = {"k": "first key"};
+let key2 = {"k": "second key"};
+// Create two objects and register them in the FinalizationGroup. The objects
+// need to be inside a closure so that we can reliably kill them!
+
+(function() {
+ let object1 = {};
+ fg.register(object1, 1, key1);
+ let object2 = {};
+ fg.register(object2, 2, key2);
+
+ // object1 and object2 go out of scope.
+})();
+
+// This GC will reclaim target objects and schedule cleanup.
+gc();
+assertEquals(0, cleanup_call_count);
+
+// Assert that the cleanup function was called and iterated one holdings (but not the other one).
+let timeout_func = function() {
+ assertEquals(1, cleanup_call_count);
+ assertEquals(1, cleanup_holdings_count);
+}
+
+setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/unregister-many.js b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-many.js
new file mode 100644
index 0000000000..748b7065c6
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-many.js
@@ -0,0 +1,50 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-weak-refs --expose-gc --noincremental-marking
+
+let cleanup_call_count = 0;
+let cleanup_holdings_count = 0;
+let cleanup = function(iter) {
+ for (holdings of iter) {
+ assertEquals("holdings2", holdings);
+ ++cleanup_holdings_count;
+ }
+ ++cleanup_call_count;
+}
+
+let fg = new FinalizationGroup(cleanup);
+let key1 = {"k": "key1"};
+let key2 = {"k": "key2"};
+// Create three objects and register them in the FinalizationGroup. The objects
+// need to be inside a closure so that we can reliably kill them!
+
+(function() {
+ let object1a = {};
+ fg.register(object1a, "holdings1a", key1);
+
+ let object1b = {};
+ fg.register(object1b, "holdings1b", key1);
+
+ let object2 = {};
+ fg.register(object2, "holdings2", key2);
+
+ // Unregister before the GC has a chance to discover the objects.
+ fg.unregister(key1);
+
+ // objects go out of scope.
+})();
+
+// This GC will reclaim the target objects.
+gc();
+assertEquals(0, cleanup_call_count);
+
+// Assert that the cleanup function will be called only for the reference which
+// was not unregistered.
+let timeout_func = function() {
+ assertEquals(1, cleanup_call_count);
+ assertEquals(1, cleanup_holdings_count);
+}
+
+setTimeout(timeout_func, 0);
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/clear-when-cleanup-already-scheduled.js b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-when-cleanup-already-scheduled.js
index 159fb0b140..2466568397 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/clear-when-cleanup-already-scheduled.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/unregister-when-cleanup-already-scheduled.js
@@ -9,14 +9,14 @@ let cleanup = function(iter) {
++cleanup_call_count;
}
-let wf = new WeakFactory(cleanup);
-// Create an object and a WeakCell pointing to it. The object needs to be inside
+let key = {"k": "this is my key"};
+let fg = new FinalizationGroup(cleanup);
+// Create an object and register it in the FinalizationGroup. The object needs to be inside
// a closure so that we can reliably kill them!
-let weak_cell;
(function() {
let object = {};
- weak_cell = wf.makeCell(object);
+ fg.register(object, {}, key);
// object goes out of scope.
})();
@@ -25,10 +25,10 @@ let weak_cell;
gc();
assertEquals(0, cleanup_call_count);
-// Clear the WeakCell before cleanup has ran.
-weak_cell.clear();
+// Unregister the object from the FinalizationGroup before cleanup has ran.
+fg.unregister(key);
-// Assert that the cleanup function won't be called, since the WeakCell was cleared.
+// Assert that the cleanup function won't be called.
let timeout_func = function() {
assertEquals(0, cleanup_call_count);
}
diff --git a/deps/v8/test/mjsunit/harmony/weakrefs/weak-cell-basics.js b/deps/v8/test/mjsunit/harmony/weakrefs/weak-cell-basics.js
index eb365986d7..170a52df10 100644
--- a/deps/v8/test/mjsunit/harmony/weakrefs/weak-cell-basics.js
+++ b/deps/v8/test/mjsunit/harmony/weakrefs/weak-cell-basics.js
@@ -8,16 +8,17 @@ let cleanup_called = false;
let cleanup = function(iter) {
assertFalse(cleanup_called);
let result = iter.next();
- assertEquals(result.value, wc);
+ assertEquals(result.value, holdings);
assertFalse(result.done);
result = iter.next();
assertTrue(result.done);
cleanup_called = true;
}
-let wf = new WeakFactory(cleanup);
+let fg = new FinalizationGroup(cleanup);
let o = {};
-let wc = wf.makeCell(o);
+let holdings = {'h': 55};
+fg.register(o, holdings);
gc();
assertFalse(cleanup_called);
diff --git a/deps/v8/test/mjsunit/integrity-level-map-update.js b/deps/v8/test/mjsunit/integrity-level-map-update.js
new file mode 100644
index 0000000000..b4e066f7de
--- /dev/null
+++ b/deps/v8/test/mjsunit/integrity-level-map-update.js
@@ -0,0 +1,166 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+(function SealAndReconfigure() {
+ function C() { this.x = 1; this.y = 1; Object.seal(this); }
+
+ let c1 = new C();
+
+ c1.x = 0.1;
+
+ let c2 = new C();
+ let c3 = new C();
+ let c4 = new C();
+
+ // The objects c2, c3 and c4 should follow the same transition
+ // path that we reconfigured c1 to.
+ assertTrue(%HaveSameMap(c1, c2));
+ assertTrue(%HaveSameMap(c1, c3));
+ assertTrue(%HaveSameMap(c1, c4));
+
+ c2.x = 0.1;
+ c3.x = 0.1;
+ c4.x = 0.1;
+
+ assertTrue(%HaveSameMap(c1, c2));
+ assertTrue(%HaveSameMap(c1, c3));
+ assertTrue(%HaveSameMap(c1, c4));
+})();
+
+(function SealAndReconfigureWithIC() {
+ function C() { this.x = 1; this.y = 1; Object.seal(this); }
+
+ let c1 = new C();
+
+ function g(o) {
+ o.x = 0.1;
+ }
+
+ g(c1);
+
+ let c2 = new C();
+ let c3 = new C();
+ let c4 = new C();
+
+ // The objects c2, c3 and c4 should follow the same transition
+ // path that we reconfigured c1 to.
+ assertTrue(%HaveSameMap(c1, c2));
+ assertTrue(%HaveSameMap(c1, c3));
+ assertTrue(%HaveSameMap(c1, c4));
+
+ g(c2);
+ g(c3);
+ g(c4);
+
+ assertTrue(%HaveSameMap(c1, c2));
+ assertTrue(%HaveSameMap(c1, c3));
+ assertTrue(%HaveSameMap(c1, c4));
+})();
+
+(function SealReconfigureAndMigrateWithIC() {
+ function C() { this.x = 1; this.y = 1; Object.seal(this); }
+
+ let c1 = new C();
+ let c2 = new C();
+ let c3 = new C();
+ let c4 = new C();
+
+ function g(o) {
+ o.x = 0.1;
+ }
+
+ g(c1);
+
+ // Now c2, c3 and c4 have deprecated maps.
+ assertFalse(%HaveSameMap(c1, c2));
+ assertFalse(%HaveSameMap(c1, c3));
+ assertFalse(%HaveSameMap(c1, c4));
+
+ g(c2);
+ g(c3);
+ g(c4);
+
+ assertTrue(%HaveSameMap(c1, c2));
+ assertTrue(%HaveSameMap(c1, c3));
+ assertTrue(%HaveSameMap(c1, c4));
+})();
+
+(function SealReconfigureAndMigrateWithOptCode() {
+ function C() { this.x = 1; this.y = 1; Object.seal(this); }
+
+ let c1 = new C();
+ let c2 = new C();
+ let c3 = new C();
+ let c4 = new C();
+
+ function g(o) {
+ o.x = 0.1;
+ }
+
+ g(c1);
+ g(c2);
+ g(c3);
+ %OptimizeFunctionOnNextCall(g);
+ g(c4);
+
+ assertTrue(%HaveSameMap(c1, c2));
+ assertTrue(%HaveSameMap(c1, c3));
+ assertTrue(%HaveSameMap(c1, c4));
+})();
+
+(function PreventExtensionsAndReconfigure() {
+ function C() { this.x = 1; this.y = 1; Object.preventExtensions(this); }
+
+ let c1 = new C();
+
+ function g(o) {
+ o.x = 0.1;
+ }
+
+ g(c1);
+
+ let c2 = new C();
+ let c3 = new C();
+ let c4 = new C();
+
+ c2.x = 0.1;
+ c3.x = 0.1;
+ c4.x = 0.1;
+
+ assertTrue(%HaveSameMap(c1, c2));
+ assertTrue(%HaveSameMap(c1, c3));
+ assertTrue(%HaveSameMap(c1, c4));
+})();
+
+(function PreventExtensionsSealAndReconfigure() {
+ function C() {
+ this.x = 1;
+ this.y = 1;
+ Object.preventExtensions(this);
+ Object.seal(this);
+ }
+
+ let c1 = new C();
+
+ function g(o) {
+ o.x = 0.1;
+ }
+
+ g(c1);
+
+ let c2 = new C();
+ let c3 = new C();
+ let c4 = new C();
+
+ c2.x = 0.1;
+ c3.x = 0.1;
+ c4.x = 0.1;
+
+ // Ideally, all the objects would have the same map, but at the moment
+ // we shortcut the unnecessary integrity level transitions.
+ assertTrue(%HaveSameMap(c2, c3));
+ assertTrue(%HaveSameMap(c2, c4));
+})();
diff --git a/deps/v8/test/mjsunit/keyed-has-ic-module-export.js b/deps/v8/test/mjsunit/keyed-has-ic-module-export.js
new file mode 100644
index 0000000000..5183157ac4
--- /dev/null
+++ b/deps/v8/test/mjsunit/keyed-has-ic-module-export.js
@@ -0,0 +1,9 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// MODULE
+
+export var a = "A";
+export var b = "B";
+export var c = "C";
diff --git a/deps/v8/test/mjsunit/keyed-has-ic-module-import.js b/deps/v8/test/mjsunit/keyed-has-ic-module-import.js
new file mode 100644
index 0000000000..77a42925f4
--- /dev/null
+++ b/deps/v8/test/mjsunit/keyed-has-ic-module-import.js
@@ -0,0 +1,70 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+// MODULE
+
+import * as mod from "keyed-has-ic-module-export.js";
+
+function testIn(obj, key) {
+ return key in obj;
+}
+
+function expectTrue(obj, key) {
+ assertTrue(testIn(obj, key));
+}
+
+function expectFalse(obj, key) {
+ assertFalse(testIn(obj, key));
+}
+
+var tests = {
+ monomporphicTrue: function() {
+ expectTrue(mod, "a");
+ expectTrue(mod, "a");
+ expectTrue(mod, "a");
+ },
+
+ polymprohicKeyTrue: function() {
+ expectTrue(mod, "a");
+ expectTrue(mod, "b");
+ expectTrue(mod, "c");
+ },
+
+ monomorphicFalse: function() {
+ expectFalse(mod, "d");
+ expectFalse(mod, "d");
+ expectFalse(mod, "d");
+ },
+
+ polymorphicKeyFalse: function() {
+ expectFalse(mod, "d");
+ expectFalse(mod, "e");
+ expectFalse(mod, "f");
+ },
+
+ polymorphicTrue: function() {
+ var o = {a: "A"};
+ expectTrue(mod, "a");
+ expectTrue(o, "a");
+ expectTrue(mod, "a");
+ expectTrue(o, "a");
+ },
+
+ polymorphicFalse: function() {
+ var o = {a: "A"};
+ expectFalse(mod, "d");
+ expectFalse(o, "d");
+ expectFalse(mod, "d");
+ expectFalse(o, "d");
+ }
+};
+
+for (let test in tests) {
+ %DeoptimizeFunction(testIn);
+ %ClearFunctionFeedback(testIn);
+ tests[test]();
+ %OptimizeFunctionOnNextCall(testIn);
+ tests[test]();
+}
diff --git a/deps/v8/test/mjsunit/keyed-has-ic.js b/deps/v8/test/mjsunit/keyed-has-ic.js
new file mode 100644
index 0000000000..9e6fe25cc8
--- /dev/null
+++ b/deps/v8/test/mjsunit/keyed-has-ic.js
@@ -0,0 +1,402 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function testIn(obj, key) {
+ return key in obj;
+}
+
+function expectTrue(obj, key) {
+ assertTrue(testIn(obj, key));
+}
+
+function expectFalse(obj, key) {
+ assertFalse(testIn(obj, key));
+}
+
+var tests = {
+ TestMonomorphicPackedSMIArray: function() {
+ var a = [0, 1, 2];
+ expectTrue(a, 0);
+ expectTrue(a, 1);
+ expectTrue(a, 2);
+ expectFalse(a, 3);
+ },
+
+ TestMonomorphicPackedArrayPrototypeProperty: function()
+ {
+ var a = [0, 1, 2];
+
+ expectTrue(a, 0);
+ expectTrue(a, 1);
+ expectFalse(a, 3);
+ Array.prototype[3] = 3;
+ expectTrue(a, 3);
+
+ // ensure the prototype change doesn't affect later tests
+ delete Array.prototype[3];
+ assertFalse((3 in Array.prototype));
+ expectFalse(a, 3);
+ },
+
+ TestMonomorphicPackedDoubleArray: function() {
+ var a = [0.0, 1.1, 2.2];
+ expectTrue(a, 0);
+ expectTrue(a, 1);
+ expectTrue(a, 2);
+ expectFalse(a, 3);
+ },
+
+ TestMonomorphicPackedArray: function() {
+ var a = ["A", "B", {}];
+ expectTrue(a, 0);
+ expectTrue(a, 1);
+ expectTrue(a, 2);
+ expectFalse(a, 3);
+ },
+
+ TestMonomorphicHoleyArray: function() {
+ var a = [0, 1, 2];
+ a[4] = 4;
+
+ expectTrue(a, 0);
+ expectTrue(a, 1);
+ expectTrue(a, 2);
+ expectFalse(a, 3);
+ expectTrue(a, 4);
+ },
+
+ TestMonomorphicTypedArray: function() {
+ var a = new Int32Array(3);
+ expectTrue(a, 0);
+ expectTrue(a, 1);
+ expectTrue(a, 2);
+ expectFalse(a, 3);
+ expectFalse(a, 4);
+ },
+
+ TestPolymorphicPackedArrays: function() {
+ var a = [0, 1, 2];
+ var b = [0.0, 1.1, 2.2];
+ var c = ["A", "B", {}];
+ expectTrue(c, 0);
+ expectTrue(b, 1);
+ expectTrue(a, 2);
+ expectTrue(c, 1);
+ expectTrue(b, 2);
+ expectTrue(a, 0);
+ expectFalse(c, 3);
+ expectFalse(b, 4);
+ expectFalse(a, 5);
+ },
+
+ TestPolymorphicMixedArrays: function() {
+ var a = new Array(3); // holey SMI
+ var b = [0.0,1.1,2.2]; // packed double
+ var c = new Int8Array(3); // typed array
+
+ expectFalse(a, 0);
+ expectTrue(b, 1);
+ expectTrue(c, 2);
+ expectFalse(a, 1);
+ expectTrue(b, 2);
+ expectTrue(c, 0);
+ expectFalse(a, 3);
+ expectFalse(b, 4);
+ expectFalse(c, 5);
+ },
+
+ TestMegamorphicArrays: function() {
+ var a = [0,1,2,3] // packed SMI
+ var b = new Array(3); // holey SMI
+ var c = [0.0,1.1,2.2]; // packed double
+ var d = ['a', 'b', 'c'] // packed
+ var e = new Int8Array(3); // typed array
+ var f = new Uint8Array(3); // typed array
+ var g = new Int32Array(3); // typed array
+
+ expectTrue(a, 0);
+ expectFalse(b, 1);
+ expectTrue(c, 2);
+ expectFalse(d, 3);
+ expectFalse(e, 4);
+ expectFalse(f, 5);
+ expectFalse(g, 6);
+ expectFalse(a, 5);
+ expectFalse(b, 4);
+ expectFalse(c, 3);
+ expectTrue(d, 2);
+ expectTrue(e, 1);
+ expectTrue(f, 0);
+ expectTrue(g, 0);
+ },
+
+ TestMonomorphicObject: function() {
+ var a = { a: "A", b: "B" };
+
+ expectTrue(a, 'a');
+ expectTrue(a, 'a');
+ expectTrue(a, 'a');
+ },
+
+ TestMonomorphicProxyHasPropertyNoTrap: function() {
+ var a = new Proxy({a: 'A'}, {});
+
+ expectTrue(a, 'a');
+ expectTrue(a, 'a');
+ expectTrue(a, 'a');
+ },
+
+ TestMonomorphicProxyNoPropertyNoTrap: function() {
+ var a = new Proxy({}, {});
+
+ expectFalse(a, 'a');
+ expectFalse(a, 'a');
+ expectFalse(a, 'a');
+ },
+
+ TestMonomorphicProxyHasPropertyHasTrap: function() {
+ var a = new Proxy({a: 'A'}, { has: function() {return false;}});
+
+ expectFalse(a, 'a');
+ expectFalse(a, 'a');
+ expectFalse(a, 'a');
+ },
+
+ TestMonomorphicProxyNoPropertyHasTrap: function() {
+ var a = new Proxy({}, { has: function() { return true; }});
+
+ expectTrue(a, 'a');
+ expectTrue(a, 'a');
+ expectTrue(a, 'a');
+ },
+
+ TestMonomorphicObjectPrototype: function() {
+ var a = { b: "B" };
+
+ expectFalse(a, 'a');
+ expectFalse(a, 'a');
+ expectFalse(a, 'a');
+ Object.prototype.a = 'A';
+ expectTrue(a, 'a');
+ delete Object.prototype.a;
+ assertFalse((a in Object.prototype));
+ expectFalse(a, 'a');
+ },
+
+ TestPolymorphicObject: function() {
+ var a = { a: "A" };
+ var b = { a: "A", b: "B" };
+ var c = { b: "B", c: "C" };
+
+ expectTrue(a, 'a');
+ expectTrue(a, 'a');
+ expectTrue(b, 'a');
+ expectFalse(c, 'a');
+ expectTrue(a, 'a');
+ expectTrue(b, 'a');
+ expectFalse(c, 'a');
+ },
+
+ TestMegamorphicObject: function() {
+ var a = { a: "A" };
+ var b = { a: "A", b: "B" };
+ var c = { b: "B", c: "C" };
+ var d = { b: "A", a: "B" };
+ var e = { e: "E", a: "A" };
+ var f = { f: "F", b: "B", c: "C" };
+
+ expectTrue(a, 'a');
+ expectTrue(a, 'a');
+ expectTrue(b, 'a');
+ expectFalse(c, 'a');
+ expectTrue(d, 'a');
+ expectTrue(e, 'a');
+ expectFalse(f, 'a');
+ expectTrue(a, 'a');
+ expectTrue(b, 'a');
+ expectFalse(c, 'a');
+ expectTrue(d, 'a');
+ expectTrue(e, 'a');
+ expectFalse(f, 'a');
+ },
+
+ TestPolymorphicKeys: function() {
+ var a = { a: "A", b: "B" };
+
+ expectTrue(a, 'a');
+ expectTrue(a, 'b');
+ expectFalse(a, 'c');
+ expectTrue(a, 'a');
+ expectTrue(a, 'b');
+ expectFalse(a, 'c');
+ expectTrue(a, 'a');
+ expectTrue(a, 'b');
+ expectFalse(a, 'c');
+ },
+
+ TestPolymorphicMixed: function() {
+ var a = { a: "A" };
+ var b = new Proxy({}, {});
+ var c = new Int32Array(3);
+
+ expectTrue(a, 'a');
+ expectTrue(a, 'a');
+ expectFalse(b, 'a');
+ expectFalse(c, 'a');
+ expectTrue(a, 'a');
+ expectFalse(b, 'a');
+ expectFalse(c, 'a');
+ },
+};
+
+for (test in tests) {
+ %DeoptimizeFunction(testIn);
+ %ClearFunctionFeedback(testIn);
+ tests[test]();
+ %OptimizeFunctionOnNextCall(testIn);
+ tests[test]();
+}
+
+// test function prototypes.
+(function() {
+ var o = function() {};
+
+ var proto = function() {
+ assertTrue("prototype" in o);
+ o.prototype;
+ }
+
+ proto();
+ proto();
+ proto();
+})();
+
+// `in` is not allowed on string
+(function() {
+ function test() {
+ 0 in "string"
+ };
+
+ assertThrows(test, TypeError);
+})();
+
+// `in` is allowed on `this` even when `this` is a string
+(function() {
+ function test() {
+ assertTrue("length" in this);
+ };
+
+ test.call("");
+ test.call("");
+ test.call("");
+})();
+
+(function() {
+ var index = 0;
+ function test(i) {
+ return index in arguments;
+ };
+
+ assertFalse(test())
+ assertFalse(test())
+ assertTrue(test(0));
+ assertTrue(test(0,1));
+
+ index = 2;
+ assertFalse(test())
+ assertFalse(test(0));
+ assertFalse(test(0,1));
+ assertTrue(test(0,1,2));
+})();
+
+(function() {
+ function test(a) {
+ arguments[3] = 1;
+ return 2 in arguments;
+ };
+
+ assertFalse(test(1));
+ assertFalse(test(1));
+ assertFalse(test(1));
+})();
+
+(function() {
+ function test(o, k) {
+ try {
+ k in o;
+ } catch (e) {
+ return false;
+ }
+ return true;
+ }
+
+ var str = "string";
+ // this will place slow_stub in the IC for strings.
+ assertFalse(test(str, "length"));
+ assertFalse(test(str, "length"));
+
+ // this turns the cache polymorphic, and causes generats LoadElement
+ // handlers for everything in the cache. This test ensures that
+ // KeyedLoadIC::LoadElementHandler can handle seeing string maps.
+ var ary = [0,1,2,3];
+ assertTrue(test(ary, 1));
+ assertTrue(test(ary, 1));
+
+ assertFalse(test(str, 0));
+ assertFalse(test(str, 0));
+})();
+
+(function() {
+ function test(o, k) {
+ try {
+ k in o;
+ } catch (e) {
+ return false;
+ }
+ return true;
+ }
+
+ var str = "string";
+ assertFalse(test(str, "length"));
+ assertFalse(test(str, "length"));
+ assertFalse(test(str, "length"));
+})();
+
+(function() {
+ function test(o, k) {
+ try {
+ k in o;
+ } catch (e) {
+ return false;
+ }
+ return true;
+ }
+
+ var str = "string";
+ assertFalse(test(str, 0));
+ assertFalse(test(str, 0));
+ assertFalse(test(str, 0));
+})();
+
+(function() {
+ function test(o, k) {
+ try {
+ k in o;
+ } catch (e) {
+ return false;
+ }
+ return true;
+ }
+
+ var ary = [0,1,2,3];
+ assertTrue(test(ary, 1));
+ assertTrue(test(ary, 1));
+
+ var str = "string";
+ assertFalse(test(str, 0));
+ assertFalse(test(str, 0));
+ assertFalse(test(str, 0));
+})();
diff --git a/deps/v8/test/mjsunit/messages.js b/deps/v8/test/mjsunit/messages.js
index d5c796228c..916a7d554f 100644
--- a/deps/v8/test/mjsunit/messages.js
+++ b/deps/v8/test/mjsunit/messages.js
@@ -126,13 +126,6 @@ test(function() {
[].join(o);
}, "Cannot convert object to primitive value", TypeError);
-// kCircularStructure
-test(function() {
- var o = {};
- o.o = o;
- JSON.stringify(o);
-}, "Converting circular structure to JSON", TypeError);
-
// kConstructorNotFunction
test(function() {
Map();
diff --git a/deps/v8/test/mjsunit/mjsunit.js b/deps/v8/test/mjsunit/mjsunit.js
index 41f2caee7a..cedb51b64e 100644
--- a/deps/v8/test/mjsunit/mjsunit.js
+++ b/deps/v8/test/mjsunit/mjsunit.js
@@ -107,14 +107,21 @@ var assertNotNull;
// Assert that the passed function or eval code throws an exception.
// The optional second argument is an exception constructor that the
// thrown exception is checked against with "instanceof".
-// The optional third argument is a message type string that is compared
-// to the type property on the thrown exception.
+// The optional third argument is a message type string or RegExp object that is
+// compared to the message of the thrown exception.
var assertThrows;
// Assert that the passed function throws an exception.
// The exception is checked against the second argument using assertEquals.
var assertThrowsEquals;
+// Assert that the passed promise does not resolve, but eventually throws an
+// exception. The optional second argument is an exception constructor that the
+// thrown exception is checked against with "instanceof".
+// The optional third argument is a message type string or RegExp object that is
+// compared to the message of the thrown exception.
+var assertThrowsAsync;
+
// Assert that the passed function or eval code does not throw an exception.
var assertDoesNotThrow;
@@ -213,7 +220,7 @@ var prettyPrinted;
// TODO(neis): Remove try-catch once BigInts are enabled by default.
try {
BigIntPrototypeValueOf = BigInt.prototype.valueOf;
- } catch(e) {}
+ } catch (e) {}
function classOf(object) {
// Argument must not be null or undefined.
@@ -480,45 +487,68 @@ var prettyPrinted;
}
};
+ function executeCode(code) {
+ if (typeof code === 'function') return code();
+ if (typeof code === 'string') return eval(code);
+ failWithMessage(
+ 'Given code is neither function nor string, but ' + (typeof code) +
+ ': <' + prettyPrinted(code) + '>');
+ }
+
+ function checkException(e, type_opt, cause_opt) {
+ if (type_opt !== undefined) {
+ assertEquals('function', typeof type_opt);
+ assertInstanceof(e, type_opt);
+ }
+ if (RegExp !== undefined && cause_opt instanceof RegExp) {
+ assertMatches(cause_opt, e.message, 'Error message');
+ } else if (cause_opt !== undefined) {
+ assertEquals(cause_opt, e.message, 'Error message');
+ }
+ }
assertThrows = function assertThrows(code, type_opt, cause_opt) {
+ if (type_opt !== undefined && typeof type_opt !== 'function') {
+ failWithMessage(
+ 'invalid use of assertThrows, maybe you want assertThrowsEquals');
+ }
try {
- if (typeof code === 'function') {
- code();
- } else {
- eval(code);
- }
+ executeCode(code);
} catch (e) {
- if (typeof type_opt === 'function') {
- assertInstanceof(e, type_opt);
- } else if (type_opt !== void 0) {
- failWithMessage(
- 'invalid use of assertThrows, maybe you want assertThrowsEquals');
- }
- if (arguments.length >= 3) {
- if (cause_opt instanceof RegExp) {
- assertMatches(cause_opt, e.message, "Error message");
- } else {
- assertEquals(cause_opt, e.message, "Error message");
- }
- }
- // Success.
+ checkException(e, type_opt, cause_opt);
return;
}
- failWithMessage("Did not throw exception");
+ let msg = 'Did not throw exception';
+ if (type_opt !== undefined && type_opt.name !== undefined)
+ msg += ', expected ' + type_opt.name;
+ failWithMessage(msg);
};
-
assertThrowsEquals = function assertThrowsEquals(fun, val) {
try {
fun();
- } catch(e) {
+ } catch (e) {
assertSame(val, e);
return;
}
- failWithMessage("Did not throw exception");
+ failWithMessage('Did not throw exception, expected ' + prettyPrinted(val));
};
+ assertThrowsAsync = function assertThrowsAsync(promise, type_opt, cause_opt) {
+ if (type_opt !== undefined && typeof type_opt !== 'function') {
+ failWithMessage(
+ 'invalid use of assertThrows, maybe you want assertThrowsEquals');
+ }
+ let msg = 'Promise did not throw exception';
+ if (type_opt !== undefined && type_opt.name !== undefined)
+ msg += ', expected ' + type_opt.name;
+ return assertPromiseResult(
+ promise,
+ // Use setTimeout to throw the error again to get out of the promise
+ // chain.
+ res => setTimeout(_ => fail('<throw>', res, msg), 0),
+ e => checkException(e, type_opt, cause_opt));
+ };
assertInstanceof = function assertInstanceof(obj, type) {
if (!(obj instanceof type)) {
@@ -533,15 +563,11 @@ var prettyPrinted;
}
};
-
- assertDoesNotThrow = function assertDoesNotThrow(code, name_opt) {
+ assertDoesNotThrow = function assertDoesNotThrow(code, name_opt) {
try {
- if (typeof code === 'function') {
- return code();
- } else {
- return eval(code);
- }
+ executeCode(code);
} catch (e) {
+ if (e instanceof MjsUnitAssertionError) throw e;
failWithMessage("threw an exception: " + (e.message || e));
}
};
@@ -584,13 +610,16 @@ var prettyPrinted;
}
assertPromiseResult = function(promise, success, fail) {
+ if (success !== undefined) assertEquals('function', typeof success);
+ if (fail !== undefined) assertEquals('function', typeof fail);
+ assertInstanceof(promise, Promise);
const stack = (new Error()).stack;
var test_promise = promise.then(
result => {
try {
if (--promiseTestCount == 0) testRunner.notifyDone();
- if (success) success(result);
+ if (success !== undefined) success(result);
} catch (e) {
// Use setTimeout to throw the error again to get out of the promise
// chain.
@@ -602,7 +631,7 @@ var prettyPrinted;
result => {
try {
if (--promiseTestCount == 0) testRunner.notifyDone();
- if (!fail) throw result;
+ if (fail === undefined) throw result;
fail(result);
} catch (e) {
// Use setTimeout to throw the error again to get out of the promise
@@ -667,7 +696,9 @@ var prettyPrinted;
// option is provided. Such tests must add --opt to flags comment.
assertFalse((opt_status & V8OptimizationStatus.kNeverOptimize) !== 0,
"test does not make sense with --no-opt");
- assertTrue((opt_status & V8OptimizationStatus.kIsFunction) !== 0, name_opt);
+ assertTrue(
+ (opt_status & V8OptimizationStatus.kIsFunction) !== 0,
+ 'should be a function: ' + name_opt);
if (skip_if_maybe_deopted &&
(opt_status & V8OptimizationStatus.kMaybeDeopted) !== 0) {
// When --deopt-every-n-times flag is specified it's no longer guaranteed
@@ -675,7 +706,9 @@ var prettyPrinted;
// to stress test the deoptimizer.
return;
}
- assertTrue((opt_status & V8OptimizationStatus.kOptimized) !== 0, name_opt);
+ assertTrue(
+ (opt_status & V8OptimizationStatus.kOptimized) !== 0,
+ 'should be optimized: ' + name_opt);
}
isNeverOptimizeLiteMode = function isNeverOptimizeLiteMode() {
@@ -772,7 +805,7 @@ var prettyPrinted;
return frame;
});
return "" + error.message + "\n" + ArrayPrototypeJoin.call(stack, "\n");
- } catch(e) {};
+ } catch (e) {};
return error.stack;
}
})();
diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status
index 884c7cca92..da5f4d14f6 100644
--- a/deps/v8/test/mjsunit/mjsunit.status
+++ b/deps/v8/test/mjsunit/mjsunit.status
@@ -33,7 +33,6 @@
'harmony/modules-skip*': [SKIP],
'regress/modules-skip*': [SKIP],
'wasm/exceptions-utils': [SKIP],
- 'wasm/wasm-constants': [SKIP],
'wasm/wasm-module-builder': [SKIP],
# All tests in the bug directory are expected to fail.
@@ -78,6 +77,9 @@
# Too slow in debug mode and under turbofan.
'regress/regress-4595': [PASS, NO_VARIANTS, ['mode == debug', SKIP]],
+ # Too slow in debug mode, due to large allocations.
+ 'regress/regress-crbug-941743': [PASS, ['mode == debug', SKIP], ['(arch == arm or arch == arm64) and simulator_run == True', SKIP]],
+
##############################################################################
# Only RegExp stuff tested, no need for extensive optimizing compiler tests.
'regexp-global': [PASS, NO_VARIANTS],
@@ -323,7 +325,7 @@
}], # 'gc_stress == True'
##############################################################################
-['lite_mode', {
+['lite_mode or variant == jitless', {
# Skip tests not suitable for lite_mode.
# TODO(8596): We cache the templates in the feedback vector. In lite mode
@@ -343,15 +345,16 @@
'regress/regress-trap-allocation-memento': [SKIP],
'regress/regress-4121': [SKIP],
- # Slow tests without feedback vectors
- # TODO(mythria): Investigate why they are slow and either fix if
- # possible are update the reason why they are slow.
- 'spread-large-string': [SKIP],
- 'spread-large-array': [SKIP],
-
# TODO(v8:7777): Re-enable once wasm is supported in jitless mode.
+ 'regress/regress-5888': [SKIP],
+ 'regress/regress-5911': [SKIP],
+ 'regress/regress-813440': [SKIP],
+ 'regress/regress-crbug-746835': [SKIP],
+ 'regress/regress-crbug-772056': [SKIP],
+ 'regress/regress-crbug-816961': [SKIP],
'regress/wasm/*': [SKIP],
'tools/compiler-trace-flags': [SKIP],
+ 'regress/regress-8947': [SKIP],
'wasm/*': [SKIP],
# Other tests that use asm / wasm / optimized code.
@@ -367,6 +370,7 @@
'regress/regress-6700': [SKIP],
'regress/regress-6838-2': [SKIP],
'regress/regress-6838-3': [SKIP],
+ 'regress/regress-crbug-934138': [SKIP],
# Timeouts in lite / jitless mode.
'asm/embenchen/*': [SKIP],
@@ -380,7 +384,157 @@
'regress/regress-crbug-721835': [SKIP],
'regress/regress-crbug-759327': [SKIP],
'regress/regress-crbug-898974': [SKIP],
-}], # 'lite_mode'
+}], # 'lite_mode or variant == jitless'
+
+##############################################################################
+['lite_mode', {
+ # TODO(v8:8510): Tests that currently fail with lazy source positions.
+ 'stack-traces-overflow': [SKIP],
+}], # lite_mode
+
+##############################################################################
+['variant == jitless', {
+ # https://crbug.com/v8/7777
+ 'array-literal-transitions': [SKIP],
+ 'array-push5': [SKIP],
+ 'array-shift4': [SKIP],
+ 'array-store-and-grow': [SKIP],
+ 'code-coverage-block-opt': [SKIP],
+ 'compiler/abstract-equal-receiver': [SKIP],
+ 'compiler/abstract-equal-symbol': [SKIP],
+ 'compiler/abstract-equal-undetectable': [SKIP],
+ 'compiler/array-buffer-is-view': [SKIP],
+ 'compiler/array-multiple-receiver-maps': [SKIP],
+ 'compiler/array-push-3': [SKIP],
+ 'compiler/array-slice-clone': [SKIP],
+ 'compiler/constant-fold-cow-array': [SKIP],
+ 'compiler/dataview-deopt': [SKIP],
+ 'compiler/dataview-get': [SKIP],
+ 'compiler/dataview-neutered': [SKIP],
+ 'compiler/dataview-set': [SKIP],
+ 'compiler/deopt-array-builtins': [SKIP],
+ 'compiler/deopt-array-push': [SKIP],
+ 'compiler/deopt-inlined-from-call': [SKIP],
+ 'compiler/deopt-numberoroddball-binop': [SKIP],
+ 'compiler/deopt-string-outofbounds': [SKIP],
+ 'compiler/dont-flush-code-marked-for-opt': [SKIP],
+ 'compiler/increment-typefeedback': [SKIP],
+ 'compiler/inlined-array-pop-opt': [SKIP],
+ 'compiler/inlined-call': [SKIP],
+ 'compiler/integral32-add-sub': [SKIP],
+ 'compiler/manual-concurrent-recompile': [SKIP],
+ 'compiler/math-imul': [SKIP],
+ 'compiler/native-context-specialization-hole-check': [SKIP],
+ 'compiler/number-abs': [SKIP],
+ 'compiler/number-ceil': [SKIP],
+ 'compiler/number-comparison-truncations': [SKIP],
+ 'compiler/number-divide': [SKIP],
+ 'compiler/number-floor': [SKIP],
+ 'compiler/number-max': [SKIP],
+ 'compiler/number-min': [SKIP],
+ 'compiler/number-modulus': [SKIP],
+ 'compiler/number-round': [SKIP],
+ 'compiler/number-toboolean': [SKIP],
+ 'compiler/number-trunc': [SKIP],
+ 'compiler/optimized-float32array-length': [SKIP],
+ 'compiler/optimized-float64array-length': [SKIP],
+ 'compiler/optimized-int32array-length': [SKIP],
+ 'compiler/optimized-uint32array-length': [SKIP],
+ 'compiler/opt-next-call': [SKIP],
+ 'compiler/opt-next-call-turbo': [SKIP],
+ 'compiler/promise-resolve-stable-maps': [SKIP],
+ 'compiler/redundancy-elimination': [SKIP],
+ 'compiler/regress-5320': [SKIP],
+ 'compiler/regress-compare-negate': [SKIP],
+ 'compiler/stress-deopt-count-1': [SKIP],
+ 'compiler/stress-deopt-count-2': [SKIP],
+ 'compiler/string-from-code-point': [SKIP],
+ 'compiler/uint8-clamped-array': [SKIP],
+ 'constant-folding-2': [SKIP],
+ 'default-nospec': [SKIP],
+ 'deopt-minus-zero': [SKIP],
+ 'deopt-recursive-eager-once': [SKIP],
+ 'deopt-recursive-lazy-once': [SKIP],
+ 'deopt-recursive-soft-once': [SKIP],
+ 'deopt-unlinked': [SKIP],
+ 'deopt-with-fp-regs': [SKIP],
+ 'deserialize-optimize-inner': [SKIP],
+ 'div-mul-minus-one': [SKIP],
+ 'elements-transition-hoisting': [SKIP],
+ 'ensure-growing-store-learns': [SKIP],
+ 'es6/array-iterator-turbo': [SKIP],
+ 'es6/block-let-crankshaft': [SKIP],
+ 'es6/block-let-crankshaft-sloppy': [SKIP],
+ 'es6/block-scoping': [SKIP],
+ 'es6/block-scoping-sloppy': [SKIP],
+ 'es6/collections-constructor-custom-iterator': [SKIP],
+ 'es6/collections-constructor-iterator-side-effect': [SKIP],
+ 'es6/collections-constructor-with-modified-array-prototype': [SKIP],
+ 'es6/collections-constructor-with-modified-protoype': [SKIP],
+ 'es6/map-constructor-entry-side-effect': [SKIP],
+ 'es6/map-constructor-entry-side-effect2': [SKIP],
+ 'es6/map-constructor-entry-side-effect3': [SKIP],
+ 'es6/map-constructor-entry-side-effect4': [SKIP],
+ 'field-type-tracking': [SKIP],
+ 'getters-on-elements': [SKIP],
+ 'ignition/throw-if-hole': [SKIP],
+ 'ignition/throw-if-not-hole': [SKIP],
+ 'ignition/throw-super-not-called': [SKIP],
+ 'keyed-load-hole-to-undefined': [SKIP],
+ 'keyed-load-with-string-key': [SKIP],
+ 'keyed-load-with-symbol-key': [SKIP],
+ 'math-deopt': [SKIP],
+ 'math-floor-of-div-minus-zero': [SKIP],
+ 'modules-turbo1': [SKIP],
+ 'never-optimize': [SKIP],
+ 'object-seal': [SKIP],
+ 'optimized-map': [SKIP],
+ 'regress/regress-2132': [SKIP],
+ 'regress/regress-2250': [SKIP],
+ 'regress/regress-2315': [SKIP],
+ 'regress/regress-2339': [SKIP],
+ 'regress/regress-2451': [SKIP],
+ 'regress/regress-252797': [SKIP],
+ 'regress/regress-2618': [SKIP],
+ 'regress/regress-3176': [SKIP],
+ 'regress/regress-3650-3': [SKIP],
+ 'regress/regress-3709': [SKIP],
+ 'regress/regress-385565': [SKIP],
+ 'regress/regress-4380': [SKIP],
+ 'regress/regress-5404': [SKIP],
+ 'regress/regress-5790': [SKIP],
+ 'regress/regress-5802': [SKIP],
+ 'regress/regress-6607-1': [SKIP],
+ 'regress/regress-6607-2': [SKIP],
+ 'regress/regress-6941': [SKIP],
+ 'regress/regress-6948': [SKIP],
+ 'regress/regress-6989': [SKIP],
+ 'regress/regress-6991': [SKIP],
+ 'regress/regress-7014-1': [SKIP],
+ 'regress/regress-7014-2': [SKIP],
+ 'regress/regress-7135': [SKIP],
+ 'regress/regress-7254': [SKIP],
+ 'regress/regress-7510': [SKIP],
+ 'regress/regress-794825': [SKIP],
+ 'regress/regress-8913': [SKIP],
+ 'regress/regress-crbug-554831': [SKIP],
+ 'regress/regress-crbug-587068': [SKIP],
+ 'regress/regress-crbug-594183': [SKIP],
+ 'regress/regress-crbug-882233-2': [SKIP],
+ 'regress/regress-embedded-cons-string': [SKIP],
+ 'regress/regress-map-invalidation-2': [SKIP],
+ 'regress/regress-param-local-type': [SKIP],
+ 'regress/regress-store-uncacheable': [SKIP],
+ 'regress/regress-v8-5697': [SKIP],
+ 'shared-function-tier-up-turbo': [SKIP],
+ 'shift-for-integer-div': [SKIP],
+ 'sin-cos': [SKIP],
+ 'smi-mul': [SKIP],
+ 'smi-mul-const': [SKIP],
+ 'string-deopt': [SKIP],
+ 'strong-rooted-literals': [SKIP],
+ 'unary-minus-deopt': [SKIP],
+}], # variant == jitless
##############################################################################
['byteorder == big', {
@@ -425,6 +579,9 @@
# BUG(v8:4016)
'regress/regress-crbug-467047': [SKIP],
+ # OOMing tests
+ 'regress/regress-500980': [SKIP],
+
# Slow tests.
'array-concat': [PASS, SLOW],
'array-indexing': [PASS, SLOW],
@@ -718,13 +875,13 @@
##############################################################################
['system == android', {
# Tests consistently failing on Android.
- # Unable to change locale on Android:
- 'icu-date-to-string': [FAIL],
- 'regress/regress-6288': [FAIL],
+ # Setting the locale with environment variables unavailable
+ 'icu-date-to-string': [SKIP],
+ 'icu-date-lord-howe': [SKIP],
+ 'regress/regress-6288': [SKIP],
# OOM:
'regress/regress-748069': [FAIL],
'regress/regress-752764': [FAIL],
- 'regress/regress-779407': [FAIL],
# Flaky OOM:
'regress/regress-852258': [SKIP],
}], # 'system == android'
@@ -792,7 +949,6 @@
'compiler/native-context-specialization-hole-check': [PASS, FAIL],
'elements-transition-hoisting': [PASS, FAIL],
'es6/collections-constructor-custom-iterator': [PASS, FAIL],
- 'harmony/weakrefs/clear-clears-factory-pointer': [PASS, FAIL],
'ignition/throw-if-not-hole': [PASS, FAIL],
'keyed-load-with-symbol-key': [PASS, FAIL],
'object-seal': [PASS, FAIL],
@@ -1003,4 +1159,9 @@
'regress/regress-913844': [SKIP],
}],
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
+
]
diff --git a/deps/v8/test/mjsunit/object-freeze.js b/deps/v8/test/mjsunit/object-freeze.js
index 23f5af0f0c..8ff63b4fc0 100644
--- a/deps/v8/test/mjsunit/object-freeze.js
+++ b/deps/v8/test/mjsunit/object-freeze.js
@@ -396,3 +396,112 @@ assertTrue(Object.isFrozen(obj));
assertFalse(Object.getOwnPropertyDescriptor(args, "length").writable);
assertFalse(Object.getOwnPropertyDescriptor(args, "callee").writable);
})();
+
+// Test packed element array built-in functions with freeze.
+function testPackedFrozenArray1(obj) {
+ assertTrue(Object.isSealed(obj));
+ // Verify that the value can't be written
+ obj1 = new Array(...obj);
+ var length = obj.length;
+ for (var i = 0; i < length-1; i++) {
+ obj[i] = 'new';
+ assertEquals(obj1[i], obj[i]);
+ }
+ // for symbol we cannot compare directly
+ assertTrue(typeof obj[length-1] == 'symbol');
+
+ // Verify that the length can't be written by builtins.
+ assertTrue(Array.isArray(obj));
+ assertThrows(function() { obj.pop(); }, TypeError);
+ assertThrows(function() { obj.push(); }, TypeError);
+ assertThrows(function() { obj.unshift(); }, TypeError);
+ assertThrows(function() { obj.copyWithin(0,0); }, TypeError);
+ assertThrows(function() { obj.fill(0); }, TypeError);
+ assertThrows(function() { obj.reverse(); }, TypeError);
+ assertThrows(function() { obj.sort(); }, TypeError);
+ assertThrows(function() { obj.splice(0); }, TypeError);
+ assertTrue(Object.isFrozen(obj));
+
+ // Verify search, filter, iterator
+ assertEquals(obj.lastIndexOf(1), 2);
+ assertEquals(obj.indexOf('a'), 4);
+ assertFalse(obj.includes(Symbol("test")));
+ assertEquals(obj.find(x => x==0), undefined);
+ assertEquals(obj.findIndex(x => x=='a'), 4);
+ assertTrue(obj.some(x => typeof x == 'symbol'));
+ assertFalse(obj.every(x => x == -1));
+ var filteredArray = obj.filter(e => typeof e == "symbol");
+ assertEquals(filteredArray.length, 1);
+ assertEquals(obj.map(x => x), obj);
+ var countPositiveNumber = 0;
+ obj.forEach(function(item, index) {
+ if (item === 1) {
+ countPositiveNumber++;
+ assertEquals(index, 2);
+ }
+ });
+ assertEquals(countPositiveNumber, 1);
+ assertEquals(obj.length, obj.concat([]).length);
+ var iterator = obj.values();
+ assertEquals(iterator.next().value, undefined);
+ assertEquals(iterator.next().value, null);
+ var iterator = obj.keys();
+ assertEquals(iterator.next().value, 0);
+ assertEquals(iterator.next().value, 1);
+ var iterator = obj.entries();
+ assertEquals(iterator.next().value, [0, undefined]);
+ assertEquals(iterator.next().value, [1, null]);
+}
+
+obj = new Array(undefined, null, 1, -1, 'a', Symbol("test"));
+assertTrue(%HasPackedElements(obj));
+Object.freeze(obj);
+testPackedFrozenArray1(obj);
+
+// Verify change from sealed to frozen
+obj = new Array(undefined, null, 1, -1, 'a', Symbol("test"));
+assertTrue(%HasPackedElements(obj));
+Object.seal(obj);
+Object.freeze(obj);
+assertTrue(Object.isSealed(obj));
+testPackedFrozenArray1(obj);
+
+// Verify change from non-extensible to frozen
+obj = new Array(undefined, null, 1, -1, 'a', Symbol("test"));
+assertTrue(%HasPackedElements(obj));
+Object.preventExtensions(obj);
+Object.freeze(obj);
+assertTrue(Object.isSealed(obj));
+testPackedFrozenArray1(obj);
+
+// Verify flat, map, slice, flatMap, join, reduce, reduceRight for frozen packed array
+function testPackedFrozenArray2(arr) {
+ assertTrue(Object.isFrozen(arr));
+ assertTrue(Array.isArray(arr));
+ assertEquals(arr.map(x => [x]), [['a'], ['b'], ['c']]);
+ assertEquals(arr.flatMap(x => [x]), arr);
+ assertEquals(arr.flat(), arr);
+ assertEquals(arr.join('-'), "a-b-c");
+ const reducer = (accumulator, currentValue) => accumulator + currentValue;
+ assertEquals(arr.reduce(reducer), "abc");
+ assertEquals(arr.reduceRight(reducer), "cba");
+ assertEquals(arr.slice(0, 1), ['a']);
+}
+var arr1 = new Array('a', 'b', 'c');
+assertTrue(%HasPackedElements(arr1));
+Object.freeze(arr1);
+testPackedFrozenArray2(arr1);
+
+// Verify change from sealed to frozen
+var arr2 = new Array('a', 'b', 'c');
+assertTrue(%HasPackedElements(arr2));
+Object.seal(arr2);
+Object.freeze(arr2);
+testPackedFrozenArray2(arr2);
+
+// Verify change from non-extensible to frozen
+var arr2 = new Array('a', 'b', 'c');
+assertTrue(%HasPackedElements(arr2));
+Object.preventExtensions(arr2);
+Object.freeze(arr2);
+testPackedFrozenArray2(arr2);
diff --git a/deps/v8/test/mjsunit/object-get-own-property-names.js b/deps/v8/test/mjsunit/object-get-own-property-names.js
index aee6585680..7ce24fe5ce 100644
--- a/deps/v8/test/mjsunit/object-get-own-property-names.js
+++ b/deps/v8/test/mjsunit/object-get-own-property-names.js
@@ -28,6 +28,9 @@
// Test ES5 section 15.2.3.4 Object.getOwnPropertyNames.
// Check simple cases.
+var obj = {};
+assertEquals(0, Object.getOwnPropertyNames(obj).length);
+
var obj = { a: 1, b: 2};
var propertyNames = Object.getOwnPropertyNames(obj);
propertyNames.sort();
@@ -52,6 +55,13 @@ assertEquals("a", propertyNames[0]);
assertEquals("c", propertyNames[1]);
// Check that non-enumerable properties are being returned.
+var obj = {};
+Object.defineProperty(obj, 'x', {
+ value: 1,
+ enumerable: false
+});
+assertEquals(1, Object.getOwnPropertyNames(obj).length);
+
var propertyNames = Object.getOwnPropertyNames([1, 2]);
propertyNames.sort();
assertEquals(3, propertyNames.length);
diff --git a/deps/v8/test/mjsunit/object-keys.js b/deps/v8/test/mjsunit/object-keys.js
index d20556c905..847a673730 100644
--- a/deps/v8/test/mjsunit/object-keys.js
+++ b/deps/v8/test/mjsunit/object-keys.js
@@ -4,6 +4,31 @@
// Flags: --allow-natives-syntax
+// Ensure empty keys are handled properly
+(function() {
+ const a = {};
+ let k = Object.keys(a);
+ %HeapObjectVerify(k);
+ assertEquals(0, k.length);
+})();
+
+// Ensure non-enumerable keys are handled properly
+(function() {
+ const a = {};
+ Object.defineProperty(a, 'x', {
+ value: 1,
+ enumerable: false
+ });
+ let k = Object.keys(a);
+ %HeapObjectVerify(k);
+ assertEquals(0, k.length);
+
+ a.y = 2;
+ k = Object.keys(a);
+ %HeapObjectVerify(k);
+ assertEquals(1, k.length);
+})();
+
// Ensure that mutation of the Object.keys result doesn't affect the
// enumeration cache for fast-mode objects.
(function() {
diff --git a/deps/v8/test/mjsunit/object-prevent-extensions.js b/deps/v8/test/mjsunit/object-prevent-extensions.js
index 9f3091ebb4..9e8cd03a7a 100644
--- a/deps/v8/test/mjsunit/object-prevent-extensions.js
+++ b/deps/v8/test/mjsunit/object-prevent-extensions.js
@@ -160,3 +160,90 @@ assertFalse(Object.isExtensible(obj2));
assertFalse(Object.isSealed(obj));
assertFalse(Object.isSealed(obj2));
assertTrue(%HaveSameMap(obj, obj2));
+
+// Test packed element array built-in functions with preventExtensions.
+obj = new Array(undefined, null, 1, -1, 'a', Symbol("test"));
+assertTrue(%HasPackedElements(obj));
+Object.preventExtensions(obj);
+assertFalse(Object.isSealed(obj));
+assertFalse(Object.isFrozen(obj));
+assertFalse(Object.isExtensible(obj));
+assertTrue(Array.isArray(obj));
+
+// Verify that the length can't be written by builtins.
+assertThrows(function() { obj.push(1); }, TypeError);
+assertThrows(function() { obj.unshift(1); }, TypeError);
+assertThrows(function() { obj.splice(0, 0, 1); }, TypeError);
+
+// Verify search, filter, iterator
+obj = new Array(undefined, null, 1, -1, 'a', Symbol("test"));
+assertTrue(%HasPackedElements(obj));
+Object.preventExtensions(obj);
+assertFalse(Object.isSealed(obj));
+assertFalse(Object.isFrozen(obj));
+assertFalse(Object.isExtensible(obj));
+assertTrue(Array.isArray(obj));
+assertEquals(obj.lastIndexOf(1), 2);
+assertEquals(obj.indexOf('a'), 4);
+assertFalse(obj.includes(Symbol("test")));
+assertEquals(obj.find(x => x==0), undefined);
+assertEquals(obj.findIndex(x => x=='a'), 4);
+assertTrue(obj.some(x => typeof x == 'symbol'));
+assertFalse(obj.every(x => x == -1));
+var filteredArray = obj.filter(e => typeof e == "symbol");
+assertEquals(filteredArray.length, 1);
+assertEquals(obj.map(x => x), obj);
+var countPositiveNumber = 0;
+obj.forEach(function(item, index) {
+ if (item === 1) {
+ countPositiveNumber++;
+ assertEquals(index, 2);
+ }
+});
+assertEquals(countPositiveNumber, 1);
+assertEquals(obj.length, obj.concat([]).length);
+var iterator = obj.values();
+assertEquals(iterator.next().value, undefined);
+assertEquals(iterator.next().value, null);
+var iterator = obj.keys();
+assertEquals(iterator.next().value, 0);
+assertEquals(iterator.next().value, 1);
+var iterator = obj.entries();
+assertEquals(iterator.next().value, [0, undefined]);
+assertEquals(iterator.next().value, [1, null]);
+
+// Verify that the value can be written
+var length = obj.length;
+for (var i = 0; i < length-1; i++) {
+ obj[i] = 'new';
+ assertEquals(obj[i], 'new');
+}
+
+// Verify flat, map, flatMap, join, reduce, reduceRight for sealed packed array
+var arr = ['a', 'b', 'c'];
+assertTrue(%HasPackedElements(arr));
+Object.preventExtensions(arr);
+assertFalse(Object.isSealed(obj));
+assertFalse(Object.isFrozen(obj));
+assertFalse(Object.isExtensible(obj));
+assertTrue(Array.isArray(obj));
+assertEquals(arr.map(x => [x]), [['a'], ['b'], ['c']]);
+assertEquals(arr.flatMap(x => [x]), arr);
+assertEquals(arr.flat(), arr);
+assertEquals(arr.join('-'), "a-b-c");
+const reducer = (accumulator, currentValue) => accumulator + currentValue;
+assertEquals(arr.reduce(reducer), "abc");
+assertEquals(arr.reduceRight(reducer), "cba");
+assertEquals(arr.slice(0, 1), ['a']);
+
+// Verify change content of sealed packed array
+arr.sort();
+assertEquals(arr.join(''), "abc");
+arr.reverse();
+assertEquals(arr.join(''), "cba");
+arr.copyWithin(0, 1, 2);
+assertEquals(arr.join(''),"bba");
+arr.fill('d');
+assertEquals(arr.join(''), "ddd");
+arr.pop();
+assertEquals(arr.join(''), "dd");
diff --git a/deps/v8/test/mjsunit/object-seal.js b/deps/v8/test/mjsunit/object-seal.js
index 265e50abc3..51459908ca 100644
--- a/deps/v8/test/mjsunit/object-seal.js
+++ b/deps/v8/test/mjsunit/object-seal.js
@@ -153,7 +153,6 @@ arr[0] = 'foo';
// We should be able to overwrite the existing value.
assertEquals('foo', arr[0]);
-
// Test that isSealed returns the correct value even if configurable
// has been set to false on all properties manually and the extensible
// flag has also been set to false manually.
@@ -393,3 +392,104 @@ assertTrue((new Sealed()).prototypeExists);
obj = new Int32Array(10)
Object.seal(obj);
assertTrue(Object.isSealed(obj));
+
+// Test packed element array built-in functions with seal.
+function testPackedSealedArray1(obj) {
+ assertTrue(Object.isSealed(obj));
+ assertFalse(Object.isFrozen(obj));
+ assertTrue(Array.isArray(obj));
+
+ // Verify that the length can't be written by builtins.
+ assertThrows(function() { obj.pop(); }, TypeError);
+ assertThrows(function() { obj.push(1); }, TypeError);
+ assertThrows(function() { obj.unshift(1); }, TypeError);
+ assertThrows(function() { obj.splice(0); }, TypeError);
+
+ // Verify search, filter, iterator
+ obj = new Array(undefined, null, 1, -1, 'a', Symbol("test"));
+ assertTrue(%HasPackedElements(obj));
+ Object.seal(obj);
+ assertTrue(Object.isSealed(obj));
+ assertFalse(Object.isFrozen(obj));
+ assertTrue(Array.isArray(obj));
+ assertEquals(obj.lastIndexOf(1), 2);
+ assertEquals(obj.indexOf('a'), 4);
+ assertFalse(obj.includes(Symbol("test")));
+ assertEquals(obj.find(x => x==0), undefined);
+ assertEquals(obj.findIndex(x => x=='a'), 4);
+ assertTrue(obj.some(x => typeof x == 'symbol'));
+ assertFalse(obj.every(x => x == -1));
+ var filteredArray = obj.filter(e => typeof e == "symbol");
+ assertEquals(filteredArray.length, 1);
+ assertEquals(obj.map(x => x), obj);
+ var countPositiveNumber = 0;
+ obj.forEach(function(item, index) {
+ if (item === 1) {
+ countPositiveNumber++;
+ assertEquals(index, 2);
+ }
+ });
+ assertEquals(countPositiveNumber, 1);
+ assertEquals(obj.length, obj.concat([]).length);
+ var iterator = obj.values();
+ assertEquals(iterator.next().value, undefined);
+ assertEquals(iterator.next().value, null);
+ var iterator = obj.keys();
+ assertEquals(iterator.next().value, 0);
+ assertEquals(iterator.next().value, 1);
+ var iterator = obj.entries();
+ assertEquals(iterator.next().value, [0, undefined]);
+ assertEquals(iterator.next().value, [1, null]);
+
+ // Verify that the value can be written
+ var length = obj.length;
+ for (var i = 0; i < length-1; i++) {
+ obj[i] = 'new';
+ assertEquals(obj[i], 'new');
+ }
+};
+obj = new Array(undefined, null, 1, -1, 'a', Symbol("test"));
+assertTrue(%HasPackedElements(obj));
+Object.seal(obj);
+testPackedSealedArray1(obj);
+
+// Verify after transition from preventExtensions
+obj = new Array(undefined, null, 1, -1, 'a', Symbol("test"));
+assertTrue(%HasPackedElements(obj));
+Object.preventExtensions(obj);
+Object.seal(obj);
+testPackedSealedArray1(obj);
+
+// Verify flat, map, slice, flatMap, join, reduce, reduceRight for sealed packed array
+function testPackedSealedArray2(arr) {
+ assertTrue(Object.isSealed(arr));
+ assertFalse(Object.isFrozen(arr));
+ assertEquals(arr.map(x => [x]), [['a'], ['b'], ['c']]);
+ assertEquals(arr.flatMap(x => [x]), arr);
+ assertEquals(arr.flat(), arr);
+ assertEquals(arr.join('-'), "a-b-c");
+ const reducer = (accumulator, currentValue) => accumulator + currentValue;
+ assertEquals(arr.reduce(reducer), "abc");
+ assertEquals(arr.reduceRight(reducer), "cba");
+ assertEquals(arr.slice(0, 1), ['a']);
+ // Verify change content of sealed packed array
+ arr.sort();
+ assertEquals(arr.join(''), "abc");
+ arr.reverse();
+ assertEquals(arr.join(''), "cba");
+ arr.copyWithin(0, 1, 2);
+ assertEquals(arr.join(''),"bba");
+ arr.fill('d');
+ assertEquals(arr.join(''), "ddd");
+}
+
+var arr1 = new Array('a', 'b', 'c');
+assertTrue(%HasPackedElements(arr1));
+Object.seal(arr1);
+testPackedSealedArray2(arr1);
+
+var arr2 = new Array('a', 'b', 'c');
+assertTrue(%HasPackedElements(arr2));
+Object.preventExtensions(arr2);
+Object.seal(arr2);
+testPackedSealedArray2(arr2);
diff --git a/deps/v8/test/mjsunit/optimized-includes-polymorph.js b/deps/v8/test/mjsunit/optimized-includes-polymorph.js
new file mode 100644
index 0000000000..55dc22978b
--- /dev/null
+++ b/deps/v8/test/mjsunit/optimized-includes-polymorph.js
@@ -0,0 +1,117 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+var o1 = {};
+var o2 = {};
+var a = [0, 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,0,0];
+var b = [,,,,,2,3,4];
+var c = [o1, o2];
+var d = [,,, o2, o1];
+var e = [0.5,3,4];
+var f = [,,,,0.5,3,4];
+
+function checkIncludes(ary, value) {
+ return ary.includes(value)
+}
+
+function checkIndexOf(ary, value, expected) {
+ return ary.indexOf(value) == expected;
+}
+
+function expectIncludes(ary, value) {
+ assertTrue(checkIncludes(ary, value));
+}
+
+function expectNotIncludes(ary, value) {
+ assertFalse(checkIncludes(ary, value));
+}
+
+function expectIndexOf(ary, value, expected) {
+ assertTrue(checkIndexOf(ary, value, expected));
+}
+
+var testIncludes = {
+ polymorphic: function() {
+ expectIncludes(a, 21);
+ expectIncludes(b, 4);
+ expectIncludes(c, o2);
+ expectIncludes(d, o1);
+ expectNotIncludes(a, o1);
+ expectNotIncludes(b, o2);
+ expectNotIncludes(c, 3);
+ expectNotIncludes(d, 4);
+ },
+
+ polymorphicDouble: function() {
+ expectIncludes(e, 3);
+ expectIncludes(f, 0.5);
+ expectNotIncludes(e, 10);
+ expectNotIncludes(f, 0.25);
+ },
+
+ polymorphicMixed: function() {
+ expectIncludes(a, 21);
+ expectIncludes(b, 4);
+ expectIncludes(c, o2);
+ expectIncludes(d, o1);
+ expectIncludes(e, 3);
+ expectIncludes(f, 0.5);
+ expectNotIncludes(a, o1);
+ expectNotIncludes(b, o2);
+ expectNotIncludes(c, 3);
+ expectNotIncludes(d, 4);
+ expectNotIncludes(e, 10);
+ expectNotIncludes(f, 0.25);
+ },
+};
+
+var testIndexOf = {
+ polymorphic: function() {
+ expectIndexOf(a, 21, 21);
+ expectIndexOf(b, 4, 7);
+ expectIndexOf(c, o2, 1);
+ expectIndexOf(d, o1, 4);
+ expectIndexOf(a, o1, -1);
+ expectIndexOf(b, o2, -1);
+ expectIndexOf(c, 3, -1);
+ expectIndexOf(d, 4, -1);
+ },
+
+ polymorphicDouble: function() {
+ expectIndexOf(e, 3, 1);
+ expectIndexOf(f, 0.5, 4);
+ expectIndexOf(e, 10, -1);
+ expectIndexOf(f, 0.25, -1);
+ },
+
+ polymorphicMixed: function() {
+ expectIndexOf(a, 21, 21);
+ expectIndexOf(b, 4, 7);
+ expectIndexOf(c, o2, 1);
+ expectIndexOf(d, o1, 4);
+ expectIndexOf(e, 3, 1);
+ expectIndexOf(f, 0.5, 4);
+ expectIndexOf(a, o1, -1);
+ expectIndexOf(b, o2, -1);
+ expectIndexOf(c, 3, -1);
+ expectIndexOf(d, 4, -1);
+ expectIndexOf(e, 10, -1);
+ expectIndexOf(f, 0.25, -1);
+ },
+};
+
+function runTests(tests, func) {
+ for (test in tests) {
+ %DeoptimizeFunction(func);
+ %ClearFunctionFeedback(func);
+ tests[test]();
+ %OptimizeFunctionOnNextCall(func);
+ tests[test]();
+ }
+}
+
+runTests(testIncludes, checkIncludes)
+runTests(testIndexOf, checkIndexOf)
diff --git a/deps/v8/test/mjsunit/optimized-reduce.js b/deps/v8/test/mjsunit/optimized-reduce.js
index efcb7ccd1c..345f731947 100644
--- a/deps/v8/test/mjsunit/optimized-reduce.js
+++ b/deps/v8/test/mjsunit/optimized-reduce.js
@@ -5,6 +5,30 @@
// Flags: --allow-natives-syntax --expose-gc --turbo-inline-array-builtins
// Flags: --opt --no-always-opt
+// Unknown field access leads to eager-deopt unrelated to reduce, should still
+// lead to correct result.
+(() => {
+ const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+ // For this particular eager deopt point to work, we need to dodge
+ // TurboFan's soft-deopts through a non-inlined and non-optimized function
+ // call to foo().
+ function foo(o, deopt) { if (deopt) { o.abc = 3; }}
+ %NeverOptimizeFunction(foo);
+ function eagerDeoptInCalled(deopt) {
+ return a.reduce((r, v, i, o) => {
+ if (i === 7) {
+ foo(a, deopt);
+ }
+ return r + "S";
+ }, "H");
+ }
+ eagerDeoptInCalled();
+ eagerDeoptInCalled();
+ %OptimizeFunctionOnNextCall(eagerDeoptInCalled);
+ eagerDeoptInCalled();
+ assertEquals("HSSSSSSSSSS", eagerDeoptInCalled(true));
+})();
+
// Make sure we gracefully handle the case of an empty array in
// optimized code.
(function() {
diff --git a/deps/v8/test/mjsunit/optimized-reduceright.js b/deps/v8/test/mjsunit/optimized-reduceright.js
index 2689a39de5..f0b20e09a6 100644
--- a/deps/v8/test/mjsunit/optimized-reduceright.js
+++ b/deps/v8/test/mjsunit/optimized-reduceright.js
@@ -5,6 +5,30 @@
// Flags: --allow-natives-syntax --expose-gc --turbo-inline-array-builtins
// Flags: --opt --no-always-opt
+// Unknown field access leads to eager-deopt unrelated to reduceright, should
+// still lead to correct result.
+(() => {
+ const a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
+ // For this particular eager deopt point to work, we need to dodge
+ // TurboFan's soft-deopts through a non-inlined and non-optimized function
+ // call to foo().
+ function foo(o, deopt) { if (deopt) { o.abc = 3; }}
+ %NeverOptimizeFunction(foo);
+ function eagerDeoptInCalled(deopt) {
+ return a.reduceRight((r, v, i, o) => {
+ if (i === 7) {
+ foo(a, deopt);
+ }
+ return r + "S";
+ }, "H");
+ }
+ eagerDeoptInCalled();
+ eagerDeoptInCalled();
+ %OptimizeFunctionOnNextCall(eagerDeoptInCalled);
+ eagerDeoptInCalled();
+ assertEquals("HSSSSSSSSSS", eagerDeoptInCalled(true));
+})();
+
// Make sure we gracefully handle the case of an empty array in
// optimized code.
(function() {
diff --git a/deps/v8/test/mjsunit/parallel-optimize-disabled.js b/deps/v8/test/mjsunit/parallel-optimize-disabled.js
index bcd7110263..83970ae096 100644
--- a/deps/v8/test/mjsunit/parallel-optimize-disabled.js
+++ b/deps/v8/test/mjsunit/parallel-optimize-disabled.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --concurrent-recompilation
+// Flags: --concurrent-recompilation --turbo-inlining
// Flags: --allow-natives-syntax --no-always-opt
if (!%IsConcurrentRecompilationSupported()) {
diff --git a/deps/v8/test/mjsunit/regress-930045.js b/deps/v8/test/mjsunit/regress-930045.js
new file mode 100644
index 0000000000..8983c2014a
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress-930045.js
@@ -0,0 +1,35 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-private-fields
+
+(function CaptureStackTracePrivateSymbol() {
+ var o = {};
+ Object.preventExtensions(o);
+
+ try { Error.captureStackTrace(o); } catch (e) {}
+ try { Error.captureStackTrace(o); } catch (e) {}
+})();
+
+(function PrivateFieldAfterPreventExtensions() {
+ class C {
+ constructor() {
+ this.x = 1;
+ Object.preventExtensions(this);
+ }
+ }
+
+ class D extends C {
+ #i = 42;
+
+ set(i) { this.#i = i; }
+ get(i) { return this.#i; }
+ }
+
+ let d = new D();
+ d.x = 0.1;
+ assertEquals(42, d.get());
+ d.set(43);
+ assertEquals(43, d.get());
+})();
diff --git a/deps/v8/test/mjsunit/regress-932101.js b/deps/v8/test/mjsunit/regress-932101.js
new file mode 100644
index 0000000000..720ee11fef
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress-932101.js
@@ -0,0 +1,11 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+o = Object("A");
+o.x = 1;
+Object.seal(o);
+o.x = 0.1
+
+o[1] = "b";
+assertEquals(undefined, o[1]);
diff --git a/deps/v8/test/mjsunit/regress/regress-3218530.js b/deps/v8/test/mjsunit/regress/regress-3218530.js
index 247f3dfe67..54c66dfded 100644
--- a/deps/v8/test/mjsunit/regress/regress-3218530.js
+++ b/deps/v8/test/mjsunit/regress/regress-3218530.js
@@ -33,7 +33,7 @@ var p = "floor";
function test() {
var bignumber = 31363200000;
- assertDoesNotThrow(assertEquals(m[p](Math.round(bignumber/864E5)/7)+1, 52));
+ assertEquals(m[p](Math.round(bignumber/864E5)/7)+1, 52);
}
test();
diff --git a/deps/v8/test/mjsunit/regress/regress-3255.js b/deps/v8/test/mjsunit/regress/regress-3255.js
index 0c5ee4ff00..3526d600c9 100644
--- a/deps/v8/test/mjsunit/regress/regress-3255.js
+++ b/deps/v8/test/mjsunit/regress/regress-3255.js
@@ -16,4 +16,4 @@ f(str, 0);
f(str, 0);
// This is just to trigger elements validation, object already broken.
-%SetKeyedProperty(str, 1, 'y', 0);
+%SetKeyedProperty(str, 1, 'y');
diff --git a/deps/v8/test/mjsunit/regress/regress-5888.js b/deps/v8/test/mjsunit/regress/regress-5888.js
index 0725ac4285..6481c79338 100644
--- a/deps/v8/test/mjsunit/regress/regress-5888.js
+++ b/deps/v8/test/mjsunit/regress/regress-5888.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/regress-5911.js b/deps/v8/test/mjsunit/regress/regress-5911.js
index 0175fd3e2c..9d6d4ae5b8 100644
--- a/deps/v8/test/mjsunit/regress/regress-5911.js
+++ b/deps/v8/test/mjsunit/regress/regress-5911.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/regress-687.js b/deps/v8/test/mjsunit/regress/regress-687.js
index a917a447f2..9dffcc1a9e 100644
--- a/deps/v8/test/mjsunit/regress/regress-687.js
+++ b/deps/v8/test/mjsunit/regress/regress-687.js
@@ -29,9 +29,8 @@
// update a accessor property to a data property using Object.defineProperty.
var obj = { get value() {}, set value (v) { throw "Error";} };
-assertDoesNotThrow(
- Object.defineProperty(obj, "value",
- { value: 5, writable:true, configurable: true }));
+Object.defineProperty(obj, "value",
+ { value: 5, writable:true, configurable: true });
var desc = Object.getOwnPropertyDescriptor(obj, "value");
assertEquals(obj.value, 5);
assertTrue(desc.configurable);
@@ -49,7 +48,7 @@ var proto = {
var create = Object.create(proto);
assertEquals(create.value, undefined);
-assertDoesNotThrow(create.value = 4);
+create.value = 4;
assertEquals(create.value, 4);
// These tests where provided in bug 959, but are all related to the this issue.
diff --git a/deps/v8/test/mjsunit/regress/regress-7254.js b/deps/v8/test/mjsunit/regress/regress-7254.js
index 8231a8fd74..3c514c4a0b 100644
--- a/deps/v8/test/mjsunit/regress/regress-7254.js
+++ b/deps/v8/test/mjsunit/regress/regress-7254.js
@@ -9,6 +9,7 @@ function foo(a) {
a[1] = "";
}
+%PrepareFunctionForOptimization(foo);
foo([0,0].map(x => x));
foo([0,0].map(x => x));
%OptimizeFunctionOnNextCall(foo);
diff --git a/deps/v8/test/mjsunit/regress/regress-813440.js b/deps/v8/test/mjsunit/regress/regress-813440.js
index 8fcb695f5a..f4df95daae 100644
--- a/deps/v8/test/mjsunit/regress/regress-813440.js
+++ b/deps/v8/test/mjsunit/regress/regress-813440.js
@@ -4,7 +4,6 @@
// Flags: --invoke-weak-callbacks --omit-quit --expose-wasm --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/regress-863810.js b/deps/v8/test/mjsunit/regress/regress-863810.js
index 0ee1330310..3bec6f5ae9 100644
--- a/deps/v8/test/mjsunit/regress/regress-863810.js
+++ b/deps/v8/test/mjsunit/regress/regress-863810.js
@@ -4,7 +4,6 @@
// Flags: --no-liftoff --no-wasm-tier-up --no-future --debug-code
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/regress-8913.js b/deps/v8/test/mjsunit/regress/regress-8913.js
new file mode 100644
index 0000000000..9403334d72
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-8913.js
@@ -0,0 +1,15 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --opt
+
+function foo(t) { return 'a'.concat(t); }
+
+foo(1);
+foo(1);
+%OptimizeFunctionOnNextCall(foo);
+foo(1);
+%OptimizeFunctionOnNextCall(foo);
+foo(1);
+assertOptimized(foo);
diff --git a/deps/v8/test/mjsunit/regress/regress-8947.js b/deps/v8/test/mjsunit/regress/regress-8947.js
new file mode 100644
index 0000000000..17507b1002
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-8947.js
@@ -0,0 +1,49 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-wasm
+
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+(function testCallReexportedJSFunc() {
+ print(arguments.callee.name);
+
+ function dothrow() {
+ throw "exception";
+ }
+
+ var builder = new WasmModuleBuilder();
+ const imp_index = builder.addImport("w", "m", kSig_i_v);
+ builder.addExport("exp", imp_index);
+ var exp = builder.instantiate({w: {m: dothrow}}).exports.exp;
+
+ builder.addImport("w", "m", kSig_i_v);
+ builder.addFunction("main", kSig_i_v)
+ .addBody([
+ kExprCallFunction, 0, // --
+ ]) // --
+ .exportFunc();
+
+ var main = builder.instantiate({w: {m: exp}}).exports.main;
+ assertThrowsEquals(main, "exception");
+})();
+
+(function testCallReexportedAPIFunc() {
+ print(arguments.callee.name);
+
+ var builder = new WasmModuleBuilder();
+ const imp_index = builder.addImport("w", "m", kSig_i_v);
+ builder.addExport("exp", imp_index);
+ var exp = builder.instantiate({w: {m: WebAssembly.Module}}).exports.exp;
+
+ builder.addImport("w", "m", kSig_i_v);
+ builder.addFunction("main", kSig_i_v)
+ .addBody([
+ kExprCallFunction, 0, // --
+ ]) // --
+ .exportFunc();
+
+ var main = builder.instantiate({w: {m: exp}}).exports.main;
+ assertThrows(main, TypeError);
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-912162.js b/deps/v8/test/mjsunit/regress/regress-912162.js
new file mode 100644
index 0000000000..b661725bb7
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-912162.js
@@ -0,0 +1,23 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+var a = new Array();
+a.prototype = a;
+
+function f() {
+ a.length = 0x2000001;
+ a.push();
+}
+
+({}).__proto__ = a;
+
+f()
+f()
+
+a.length = 1;
+a.fill(-255);
+
+%HeapObjectVerify(a);
diff --git a/deps/v8/test/mjsunit/regress/regress-917755.js b/deps/v8/test/mjsunit/regress/regress-917755.js
index 49803ae2d3..6cd4a24d37 100644
--- a/deps/v8/test/mjsunit/regress/regress-917755.js
+++ b/deps/v8/test/mjsunit/regress/regress-917755.js
@@ -2,11 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+assertThrows(`
{
function a() {}
}
{
+ // Duplicate lexical declarations are only allowed if they are both sloppy
+ // block functions (see bug 4693). In this case the sloppy block function
+ // conflicts with the lexical variable declaration, causing a syntax error.
let a;
function a() {};
}
+`, SyntaxError)
diff --git a/deps/v8/test/mjsunit/regress/regress-926036.js b/deps/v8/test/mjsunit/regress/regress-926036.js
new file mode 100644
index 0000000000..3c8f49c956
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-926036.js
@@ -0,0 +1,5 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+assertThrows("async() => { for await (var a ;;) {} }", SyntaxError);
diff --git a/deps/v8/test/mjsunit/regress/regress-930486.js b/deps/v8/test/mjsunit/regress/regress-930486.js
new file mode 100644
index 0000000000..8b4aafae81
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-930486.js
@@ -0,0 +1,10 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var __v_49026 = function () {};
+
+__v_49026.prototype = undefined;
+__v_49026.x = 23;
+__v_49026.prototype = new ArrayBuffer();
+__v_49026.x = 2147483649;
diff --git a/deps/v8/test/mjsunit/regress/regress-932953.js b/deps/v8/test/mjsunit/regress/regress-932953.js
new file mode 100644
index 0000000000..5e211c79d1
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-932953.js
@@ -0,0 +1,59 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+(function NonExtensibleBetweenSetterAndGetter() {
+ o = {};
+ o.x = 42;
+ o.__defineGetter__("y", function() { });
+ Object.preventExtensions(o);
+ o.__defineSetter__("y", function() { });
+ o.x = 0.1;
+})();
+
+(function InterleavedIntegrityLevel() {
+ o = {};
+ o.x = 42;
+ o.__defineSetter__("y", function() { });
+ Object.preventExtensions(o);
+ o.__defineGetter__("y", function() { return 44; });
+ Object.seal(o);
+ o.x = 0.1;
+ assertEquals(44, o.y);
+})();
+
+(function TryUpdateRepeatedIntegrityLevel() {
+ function C() {
+ this.x = 0;
+ this.x = 1;
+ Object.preventExtensions(this);
+ Object.seal(this);
+ }
+
+ const o1 = new C();
+ const o2 = new C();
+ const o3 = new C();
+
+ function f(o) {
+ return o.x;
+ }
+
+ // Warm up the IC.
+ f(o1);
+ f(o1);
+ f(o1);
+
+ // Reconfigure to double field.
+ o3.x = 0.1;
+
+ // Migrate o2 to the new shape.
+ f(o2);
+
+ %OptimizeFunctionOnNextCall(f);
+ f(o1);
+
+ assertTrue(%HaveSameMap(o1, o2));
+ assertTrue(%HaveSameMap(o1, o3));
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-933179.js b/deps/v8/test/mjsunit/regress/regress-933179.js
new file mode 100644
index 0000000000..a9e7f07bee
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-933179.js
@@ -0,0 +1,10 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+var o = { ...{ length : 1 } };
+
+o.x = 1;
+delete o.x;
+
+o.length = 2;
diff --git a/deps/v8/test/mjsunit/regress/regress-933776.js b/deps/v8/test/mjsunit/regress/regress-933776.js
new file mode 100644
index 0000000000..6736348106
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-933776.js
@@ -0,0 +1,6 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+__v_51351 = /[^]$/gm;
+"a\nb\rc\n\rd\r\ne".replace(__v_51351, "*$1");
diff --git a/deps/v8/test/mjsunit/regress/regress-936077.js b/deps/v8/test/mjsunit/regress/regress-936077.js
new file mode 100644
index 0000000000..fcd5254bd2
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-936077.js
@@ -0,0 +1,17 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-gc --allow-natives-syntax
+// Flags: --concurrent-inlining --function-context-specialization
+
+function main() {
+ var obj = {};
+ function foo() { return obj[0]; };
+ gc();
+ obj.x = 10;
+ %OptimizeFunctionOnNextCall(foo);
+ foo();
+}
+main();
+main();
diff --git a/deps/v8/test/mjsunit/regress/regress-940361.js b/deps/v8/test/mjsunit/regress/regress-940361.js
new file mode 100644
index 0000000000..28b21ad145
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-940361.js
@@ -0,0 +1,21 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+const re = /abc/;
+
+// Move the test method one prototype up.
+re.__proto__.__proto__.test = re.__proto__.test;
+delete re.__proto__.test;
+
+function foo(s) {
+ return re.test(s);
+}
+
+assertTrue(foo('abc'));
+assertTrue(foo('abc'));
+%OptimizeFunctionOnNextCall(foo);
+assertTrue(foo('abc'));
+assertFalse(foo('ab'));
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-715455.js b/deps/v8/test/mjsunit/regress/regress-crbug-715455.js
index 21ec165683..87b240227d 100644
--- a/deps/v8/test/mjsunit/regress/regress-crbug-715455.js
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-715455.js
@@ -20,6 +20,6 @@ for (var i = 0; i < test_set.length; ++i) {
src = src.replace(/MODULE/g, "Module" + i);
src = src.replace(/LIMIT/g, test_set[i]);
var module = eval("(" + src + ")");
- assertDoesNotThrow(module(this).f());
+ module(this).f();
assertFalse(%IsAsmWasmCode(module));
}
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-772056.js b/deps/v8/test/mjsunit/regress/regress-crbug-772056.js
index 380f968560..d9fb4d51d2 100644
--- a/deps/v8/test/mjsunit/regress/regress-crbug-772056.js
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-772056.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-913222.js b/deps/v8/test/mjsunit/regress/regress-crbug-913222.js
new file mode 100644
index 0000000000..6410c54645
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-913222.js
@@ -0,0 +1,10 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --stack-size=100
+__v_0 = '(function() {\n';
+for (var __v_1 = 0; __v_1 < 10000; __v_1++) {
+ __v_0 += ' return function() {\n';
+}
+assertThrows(()=>eval(__v_0), RangeError);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-926819.js b/deps/v8/test/mjsunit/regress/regress-crbug-926819.js
new file mode 100644
index 0000000000..060c72f60e
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-926819.js
@@ -0,0 +1,5 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+assertThrows("a(function(){{let f;function f}})", SyntaxError);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-926856.js b/deps/v8/test/mjsunit/regress/regress-crbug-926856.js
new file mode 100644
index 0000000000..a3fa934483
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-926856.js
@@ -0,0 +1,18 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Need a fast array with enough elements to surpass
+// kMaxRegularHeapObjectSize.
+var size = 63392;
+var a = [];
+function build() {
+ for (let i = 0; i < size; i++) {
+ a.push(i);
+ }
+}
+
+build();
+
+function c(v) { return v + 0.5; }
+a.map(c);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-930948-base.js b/deps/v8/test/mjsunit/regress/regress-crbug-930948-base.js
new file mode 100644
index 0000000000..740f42a288
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-930948-base.js
@@ -0,0 +1,10 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --verify-heap --allow-natives-syntax
+
+function foo() {
+ return [undefined].map(Math.asin);
+}
+foo();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-930948.js b/deps/v8/test/mjsunit/regress/regress-crbug-930948.js
new file mode 100644
index 0000000000..06dcf40646
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-930948.js
@@ -0,0 +1,25 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --verify-heap --allow-natives-syntax
+
+// This checks that TransitionAndStoreNumberElement silences NaNs.
+function foo() {
+ return [undefined].map(Math.asin);
+}
+foo();
+foo();
+%OptimizeFunctionOnNextCall(foo);
+foo();
+
+// This checks that TransitionAndStoreElement silences NaNs.
+function bar(b) {
+ return [undefined].map(x => b ? Math.asin(x) : "string");
+}
+bar(true);
+bar(false);
+bar(true);
+bar(false);
+%OptimizeFunctionOnNextCall(bar);
+bar(true);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-931664.js b/deps/v8/test/mjsunit/regress/regress-crbug-931664.js
new file mode 100644
index 0000000000..b4fc85367e
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-931664.js
@@ -0,0 +1,19 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function opt(){
+ for(l in('a')){
+ try{
+ for(a in('')) {
+ for(let arg2 in(+(arg2)));
+ }
+ }
+ finally{}
+ }
+}
+opt();
+%OptimizeFunctionOnNextCall(opt);
+opt();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-932034.js b/deps/v8/test/mjsunit/regress/regress-crbug-932034.js
new file mode 100644
index 0000000000..56758b4f74
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-932034.js
@@ -0,0 +1,12 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --mock-arraybuffer-allocator
+
+// Verify on 32-bit architectures, a byte length overflow is handled gracefully.
+try {
+ new BigInt64Array(%MaxSmi());
+} catch(e) {
+ assertInstanceof(e, RangeError);
+}
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-933214.js b/deps/v8/test/mjsunit/regress/regress-crbug-933214.js
new file mode 100644
index 0000000000..56b96ac86f
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-933214.js
@@ -0,0 +1,13 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+assertThrows(`
+ function __v_0() {
+ function __v_2() {
+ try {
+ function* __v_0() {}
+ function __v_0() {}
+ }
+ }
+ }`, SyntaxError);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-934138.js b/deps/v8/test/mjsunit/regress/regress-crbug-934138.js
new file mode 100644
index 0000000000..2d23486717
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-934138.js
@@ -0,0 +1,38 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+(function TestTrailingJunkAfterExport() {
+ function Module() {
+ "use asm";
+ function f() {}
+ return {f: f}
+ %kaboom;
+ }
+ assertThrows(() => Module(), ReferenceError);
+ assertFalse(%IsAsmWasmCode(Module));
+})();
+
+(function TestExportWithSemicolon() {
+ function Module() {
+ "use asm";
+ function f() {}
+ return {f: f};
+ // appreciate the semicolon
+ }
+ assertDoesNotThrow(() => Module());
+ assertTrue(%IsAsmWasmCode(Module));
+})();
+
+(function TestExportWithoutSemicolon() {
+ function Module() {
+ "use asm";
+ function f() {}
+ return {f: f}
+ // appreciate the nothingness
+ }
+ assertDoesNotThrow(() => Module());
+ assertTrue(%IsAsmWasmCode(Module));
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-934166.js b/deps/v8/test/mjsunit/regress/regress-crbug-934166.js
new file mode 100644
index 0000000000..d6fae7136b
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-934166.js
@@ -0,0 +1,18 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+{
+ for(let i = 0; i < 10; ++i){
+ try{
+ // Carefully constructed by a fuzzer to use a new register for s(), whose
+ // write is dead due to the unconditional throw after s()=N, but which is
+ // read in the ({...g}) call, which therefore must also be marked dead and
+ // elided.
+ with(f&&g&&(s()=N)({...g})){}
+ } catch {}
+ %OptimizeOsr();
+ }
+}
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-935932.js b/deps/v8/test/mjsunit/regress/regress-crbug-935932.js
new file mode 100644
index 0000000000..a34b7743e0
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-935932.js
@@ -0,0 +1,90 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+function test(func, expect) {
+ assertTrue(func() == expect);
+ %OptimizeFunctionOnNextCall(func);
+ assertTrue(func() == expect);
+}
+
+// Check loading a constant off the global.
+var v0 = 10;
+function check_v0() { return "v0" in this; }
+test(check_v0, true);
+
+// make it non-constant.
+v0 = 0;
+test(check_v0, true);
+
+// test a missing value.
+function check_v1() { return "v1" in this; }
+test(check_v1, false);
+this.v1 = 3;
+test(check_v1, true);
+delete this.v1;
+test(check_v1, false);
+
+// test undefined.
+var v2;
+function check_v2() { return "v2" in this; }
+test(check_v2, true);
+
+// test a constant object.
+var v3 = {};
+function check_v3() { return "v3" in this; }
+test(check_v3, true);
+// make the object non-constant.
+v3 = [];
+test(check_v3, true);
+
+// test non-configurable
+Object.defineProperty(this, "v4", { value: {}, configurable: false});
+function check_v4() { return "v4" in this; }
+test(check_v4, true);
+
+// Test loading from arrays with different prototypes.
+(function() {
+ function testIn(index, array) {
+ return index in array;
+ }
+
+ let a = [];
+ a.__proto__ = [0,1,2];
+ a[1] = 3;
+
+ // First load will set IC to Load handle with allow hole to undefined conversion false.
+ assertTrue(testIn(0, a));
+ // Second load will hit ICMiss when hole is loaded. Seeing the same map twice, the IC will be set megamorphic.
+ assertTrue(testIn(0, a));
+ %OptimizeFunctionOnNextCall(testIn);
+ // Test JIT to ensure proper handling.
+ assertTrue(testIn(0, a));
+
+ %ClearFunctionFeedback(testIn);
+ %DeoptimizeFunction(testIn);
+
+ // First load will set IC to Load handle with allow hole to undefined conversion false.
+ assertTrue(testIn(0, a));
+ %OptimizeFunctionOnNextCall(testIn);
+ // Test JIT to ensure proper handling if hole is loaded.
+ assertTrue(testIn(0, a));
+
+ // Repeat the same testing for access out-of-bounds of the array, but in bounds of it's prototype.
+ %ClearFunctionFeedback(testIn);
+ %DeoptimizeFunction(testIn);
+
+ assertTrue(testIn(2, a));
+ assertTrue(testIn(2, a));
+ %OptimizeFunctionOnNextCall(testIn);
+ assertTrue(testIn(2, a));
+
+ %ClearFunctionFeedback(testIn);
+ %DeoptimizeFunction(testIn);
+
+ assertTrue(testIn(2, a));
+ %OptimizeFunctionOnNextCall(testIn);
+ assertTrue(testIn(2, a));
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-936302.js b/deps/v8/test/mjsunit/regress/regress-crbug-936302.js
new file mode 100644
index 0000000000..c8d3c136a1
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-936302.js
@@ -0,0 +1,25 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --opt
+
+(function() {
+ 'use strict';
+
+ function baz() {
+ 'use asm';
+ function f() {}
+ return {f: f};
+ }
+
+ function foo(x) {
+ baz(x);
+ %DeoptimizeFunction(foo);
+ }
+
+ foo();
+ foo();
+ %OptimizeFunctionOnNextCall(foo);
+ foo();
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-937618.js b/deps/v8/test/mjsunit/regress/regress-crbug-937618.js
new file mode 100644
index 0000000000..71ea8a8507
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-937618.js
@@ -0,0 +1,34 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax
+
+let target = {0:42, a:42};
+
+let proxy = new Proxy(target, {
+ has: function() { return false; },
+});
+
+Object.preventExtensions(target);
+
+function testLookupElementInProxy() {
+ 0 in proxy;
+}
+
+// 9.5.7 [[HasProperty]] 9. states that if the trap returns false, and the
+// target hasOwnProperty, and the target is non-extensible, throw a type error.
+
+assertThrows(testLookupElementInProxy, TypeError);
+assertThrows(testLookupElementInProxy, TypeError);
+%OptimizeFunctionOnNextCall(testLookupElementInProxy);
+assertThrows(testLookupElementInProxy, TypeError);
+
+function testLookupPropertyInProxy(){
+ "a" in proxy;
+}
+
+assertThrows(testLookupPropertyInProxy, TypeError);
+assertThrows(testLookupPropertyInProxy, TypeError);
+%OptimizeFunctionOnNextCall(testLookupPropertyInProxy);
+assertThrows(testLookupPropertyInProxy, TypeError);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-937649.js b/deps/v8/test/mjsunit/regress/regress-crbug-937649.js
new file mode 100644
index 0000000000..5cc5a3db9a
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-937649.js
@@ -0,0 +1,17 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+// Flags: --allow-natives-syntax
+
+(function() {
+ function foo(x) {
+ const i = x > 0;
+ const dv = new DataView(ab);
+ return dv.getUint16(i);
+ }
+ const ab = new ArrayBuffer(2);
+ foo(0);
+ foo(0);
+ %OptimizeFunctionOnNextCall(foo);
+ foo(0);
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-941743.js b/deps/v8/test/mjsunit/regress/regress-crbug-941743.js
new file mode 100644
index 0000000000..8fc4ad4322
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-941743.js
@@ -0,0 +1,28 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --allow-natives-syntax --noenable-slow-asserts
+
+// This call ensures that TurboFan won't inline array constructors.
+Array(2**30);
+
+// Set up a fast holey smi array, and generate optimized code.
+let a = [1, 2, ,,, 3];
+function mapping(a) {
+ return a.map(v => v);
+}
+mapping(a);
+mapping(a);
+%OptimizeFunctionOnNextCall(mapping);
+mapping(a);
+
+// Now lengthen the array, but ensure that it points to a non-dictionary
+// backing store.
+a.length = (32 * 1024 * 1024)-1;
+a.fill(1,0);
+a.push(2);
+a.length += 500;
+// Now, the non-inlined array constructor should produce an array with
+// dictionary elements: causing a crash.
+mapping(a);
diff --git a/deps/v8/test/mjsunit/regress/regress-v8-5848.js b/deps/v8/test/mjsunit/regress/regress-v8-5848.js
new file mode 100644
index 0000000000..9db3666cc5
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-v8-5848.js
@@ -0,0 +1,17 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+const inlineFromParser = 50 ** 50;
+
+const i = 50;
+const fromRuntimePowOp = i ** i;
+const fromRuntimeMath = Math.pow(i, i);
+
+// inlineFromParser === fromRuntimeOp === fromRuntimeMath
+
+assertEquals(inlineFromParser, fromRuntimePowOp);
+assertEquals(inlineFromParser - fromRuntimePowOp, 0);
+
+assertEquals(inlineFromParser, fromRuntimeMath);
+assertEquals(inlineFromParser - fromRuntimeMath, 0);
diff --git a/deps/v8/test/mjsunit/regress/regress-v8-8799.js b/deps/v8/test/mjsunit/regress/regress-v8-8799.js
new file mode 100644
index 0000000000..a6710904ce
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-v8-8799.js
@@ -0,0 +1,11 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-gc --stress-flush-bytecode
+
+// Ensure tagged template objects are cached even after bytecode flushing.
+var f = (x) => eval`a${x}b`;
+var a = f();
+gc();
+assertSame(a, f());
diff --git a/deps/v8/test/mjsunit/regress/wasm/loop-stack-check.js b/deps/v8/test/mjsunit/regress/wasm/loop-stack-check.js
index a76ad017d9..b1e92fa4ec 100644
--- a/deps/v8/test/mjsunit/regress/wasm/loop-stack-check.js
+++ b/deps/v8/test/mjsunit/regress/wasm/loop-stack-check.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-02256.js b/deps/v8/test/mjsunit/regress/wasm/regress-02256.js
index d1dae276d3..791d2a1d2d 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-02256.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-02256.js
@@ -264,7 +264,6 @@ var __v_11 = this;
var __v_12 = {};
var __v_13 = {};
try {
- load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-__v_1.js");
__v_2 = 0x10000;
} catch (e) {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-5531.js b/deps/v8/test/mjsunit/regress/wasm/regress-5531.js
index 1363f96264..cea547d09c 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-5531.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-5531.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-5800.js b/deps/v8/test/mjsunit/regress/wasm/regress-5800.js
index 2e56da853d..77c436119c 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-5800.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-5800.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function AddTest() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-5860.js b/deps/v8/test/mjsunit/regress/wasm/regress-5860.js
index b193323dd1..961e52d2dc 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-5860.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-5860.js
@@ -4,7 +4,6 @@
//
// Flags: --expose-wasm
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let module1 = (() => {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-5884.js b/deps/v8/test/mjsunit/regress/wasm/regress-5884.js
index 8677f105ee..c6013d3f86 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-5884.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-5884.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-6054.js b/deps/v8/test/mjsunit/regress/wasm/regress-6054.js
index 7b309b6f82..3afb371131 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-6054.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-6054.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-6164.js b/deps/v8/test/mjsunit/regress/wasm/regress-6164.js
index 3035ea5249..ed728f5acc 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-6164.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-6164.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-644682.js b/deps/v8/test/mjsunit/regress/wasm/regress-644682.js
index b58c0d9b10..a48e5aeef0 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-644682.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-644682.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-648079.js b/deps/v8/test/mjsunit/regress/wasm/regress-648079.js
index acc6146ef5..fbb5414480 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-648079.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-648079.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Non-standard opcodes.
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-651961.js b/deps/v8/test/mjsunit/regress/wasm/regress-651961.js
index bf08200d30..f42f431703 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-651961.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-651961.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-654377.js b/deps/v8/test/mjsunit/regress/wasm/regress-654377.js
index 871da72114..455139f0bb 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-654377.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-654377.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-663994.js b/deps/v8/test/mjsunit/regress/wasm/regress-663994.js
index da3d7c7771..9643a86acb 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-663994.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-663994.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-667745.js b/deps/v8/test/mjsunit/regress/wasm/regress-667745.js
index 68c880303b..cae5122ca5 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-667745.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-667745.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-684858.js b/deps/v8/test/mjsunit/regress/wasm/regress-684858.js
index bfef7fcc8e..1ac3cc6f2a 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-684858.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-684858.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var name = 'regression_684858';
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-688876.js b/deps/v8/test/mjsunit/regress/wasm/regress-688876.js
index 02932b4812..5e142b3417 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-688876.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-688876.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-689450.js b/deps/v8/test/mjsunit/regress/wasm/regress-689450.js
index 9a4989c633..bcd25387b4 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-689450.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-689450.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-6931.js b/deps/v8/test/mjsunit/regress/wasm/regress-6931.js
index 364e95a680..5edf25761f 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-6931.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-6931.js
@@ -3,7 +3,6 @@
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-699485.js b/deps/v8/test/mjsunit/regress/wasm/regress-699485.js
index a44b14b031..8a70afa591 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-699485.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-699485.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-702460.js b/deps/v8/test/mjsunit/regress/wasm/regress-702460.js
index 44e60330b4..21a84bcf28 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-702460.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-702460.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Non-standard opcodes.
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7033.js b/deps/v8/test/mjsunit/regress/wasm/regress-7033.js
index 17d79c896f..58dff5e2f9 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7033.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7033.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7035.js b/deps/v8/test/mjsunit/regress/wasm/regress-7035.js
index cd69c7d1b4..73485494b3 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7035.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7035.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7049.js b/deps/v8/test/mjsunit/regress/wasm/regress-7049.js
index b9ad1a0be4..6d2cd351fb 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7049.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7049.js
@@ -4,7 +4,6 @@
// Flags: --allow-natives-syntax --expose-gc
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// Build two instances, instance 2 is interpreted, and calls instance 1 (via
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-708714.js b/deps/v8/test/mjsunit/regress/wasm/regress-708714.js
index 10cd67ad8d..dc90a0aba3 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-708714.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-708714.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-709684.js b/deps/v8/test/mjsunit/regress/wasm/regress-709684.js
index 1ca0cb63fd..a6e03e0a0b 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-709684.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-709684.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --allow-natives-syntax
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let importingModuleBinary1 = (() => {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-710844.js b/deps/v8/test/mjsunit/regress/wasm/regress-710844.js
index 20c8154e4a..3bafe41c0f 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-710844.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-710844.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-711203.js b/deps/v8/test/mjsunit/regress/wasm/regress-711203.js
index 46f274a8b0..beca86d378 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-711203.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-711203.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-715216b.js b/deps/v8/test/mjsunit/regress/wasm/regress-715216b.js
index 0954f807dd..85e93e07c9 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-715216b.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-715216b.js
@@ -4,7 +4,6 @@
// Flags: --wasm-interpret-all --wasm-lazy-compilation
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-722445.js b/deps/v8/test/mjsunit/regress/wasm/regress-722445.js
index f6a96dc60d..5868d76190 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-722445.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-722445.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-724846.js b/deps/v8/test/mjsunit/regress/wasm/regress-724846.js
index 628d58f294..b215b6021a 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-724846.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-724846.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// Flags: --wasm-max-mem-pages=49152
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-724851.js b/deps/v8/test/mjsunit/regress/wasm/regress-724851.js
index 18834795d2..5c4c421a1c 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-724851.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-724851.js
@@ -4,7 +4,6 @@
// Flags: --wasm-lazy-compilation
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-724972.js b/deps/v8/test/mjsunit/regress/wasm/regress-724972.js
index 2af403ce20..cbe5d35d54 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-724972.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-724972.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-727222.js b/deps/v8/test/mjsunit/regress/wasm/regress-727222.js
index 6b3f2faf5f..3096334096 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-727222.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-727222.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-727560.js b/deps/v8/test/mjsunit/regress/wasm/regress-727560.js
index f92d879a2e..e9ed441860 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-727560.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-727560.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
{
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-729991.js b/deps/v8/test/mjsunit/regress/wasm/regress-729991.js
index 85a9ae7231..8cabd515b3 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-729991.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-729991.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-734246.js b/deps/v8/test/mjsunit/regress/wasm/regress-734246.js
index 57f98949f8..b861141db7 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-734246.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-734246.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-734345.js b/deps/v8/test/mjsunit/regress/wasm/regress-734345.js
index f55a06288e..d7486d2d1e 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-734345.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-734345.js
@@ -4,7 +4,6 @@
// Flags: --expose-gc
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
builder1 = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7353.js b/deps/v8/test/mjsunit/regress/wasm/regress-7353.js
index 748c74139f..81f45fe6a5 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7353.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7353.js
@@ -4,7 +4,6 @@
// Flags: --wasm-lazy-compilation
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7364.js b/deps/v8/test/mjsunit/regress/wasm/regress-7364.js
index 8e66295b70..f508585ebb 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7364.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7364.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const exportingModuleBinary = (() => {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-736584.js b/deps/v8/test/mjsunit/regress/wasm/regress-736584.js
index 033732f368..0e027f3a57 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-736584.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-736584.js
@@ -4,7 +4,6 @@
// Flags: --wasm-lazy-compilation
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let mem = new WebAssembly.Memory({initial: 0});
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7366.js b/deps/v8/test/mjsunit/regress/wasm/regress-7366.js
index 41f758efb1..b5cae8daa4 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7366.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7366.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-737069.js b/deps/v8/test/mjsunit/regress/wasm/regress-737069.js
index c68d10f06d..e4c4fae895 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-737069.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-737069.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
let binary = new Binary;
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-739768.js b/deps/v8/test/mjsunit/regress/wasm/regress-739768.js
index 52985c3297..a191c828d6 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-739768.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-739768.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// Flags: --wasm-lazy-compilation
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7422.js b/deps/v8/test/mjsunit/regress/wasm/regress-7422.js
index 87896b4c35..71e1eb89bd 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7422.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7422.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7499.js b/deps/v8/test/mjsunit/regress/wasm/regress-7499.js
index 71f246decf..74e4d53a17 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7499.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7499.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7508.js b/deps/v8/test/mjsunit/regress/wasm/regress-7508.js
index 7c07d2d7e3..10ce500a44 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7508.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7508.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-752423.js b/deps/v8/test/mjsunit/regress/wasm/regress-752423.js
index 15ee9a6c34..938ecbf252 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-752423.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-752423.js
@@ -6,7 +6,6 @@
'use strict';
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7565.js b/deps/v8/test/mjsunit/regress/wasm/regress-7565.js
index 055bfc0c59..c9d4e2ca88 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7565.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7565.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-757217.js b/deps/v8/test/mjsunit/regress/wasm/regress-757217.js
index 218b090c45..28e554b87a 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-757217.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-757217.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7579.js b/deps/v8/test/mjsunit/regress/wasm/regress-7579.js
index 40cf12317f..876a76cad9 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7579.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7579.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7582.js b/deps/v8/test/mjsunit/regress/wasm/regress-7582.js
index 476a0e18e8..d8b5e9d7fc 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7582.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7582.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-763439.js b/deps/v8/test/mjsunit/regress/wasm/regress-763439.js
index 1f90e0a017..ef84b97859 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-763439.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-763439.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-763697.js b/deps/v8/test/mjsunit/regress/wasm/regress-763697.js
index faf74e1cff..c831a55fba 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-763697.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-763697.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --no-experimental-wasm-simd
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-766003.js b/deps/v8/test/mjsunit/regress/wasm/regress-766003.js
index d8a1ea1ebf..3aaff40636 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-766003.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-766003.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --wasm-interpret-all
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
__v_6 = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-769637.js b/deps/v8/test/mjsunit/regress/wasm/regress-769637.js
index c2e783014a..71aaa45bfd 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-769637.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-769637.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-771243.js b/deps/v8/test/mjsunit/regress/wasm/regress-771243.js
index e1581fcdd8..81b9e8f2a9 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-771243.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-771243.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --wasm-interpret-all
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
assertThrows(() => {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-772332.js b/deps/v8/test/mjsunit/regress/wasm/regress-772332.js
index 56e6f2ceb8..e8547c8175 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-772332.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-772332.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --wasm-interpret-all
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
assertThrows(() => {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-775366.js b/deps/v8/test/mjsunit/regress/wasm/regress-775366.js
index e8db923896..69a1f68dc0 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-775366.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-775366.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
+load("test/mjsunit/wasm/wasm-module-builder.js");
(function BadTypeSection() {
var data = bytes(
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7785.js b/deps/v8/test/mjsunit/regress/wasm/regress-7785.js
index 12d7e6b5da..72638b1685 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7785.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7785.js
@@ -4,7 +4,6 @@
// Flags: --allow-natives-syntax --experimental-wasm-anyref
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function testAnyRefNull() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-778917.js b/deps/v8/test/mjsunit/regress/wasm/regress-778917.js
index 083f1d12e3..c7eb033d95 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-778917.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-778917.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --wasm-interpret-all
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-782280.js b/deps/v8/test/mjsunit/regress/wasm/regress-782280.js
index a94f061c2b..008ab16159 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-782280.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-782280.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-784050.js b/deps/v8/test/mjsunit/regress/wasm/regress-784050.js
index 8f1a79002c..acf4539aee 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-784050.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-784050.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-7914.js b/deps/v8/test/mjsunit/regress/wasm/regress-7914.js
index ede4668d08..48f8b902f0 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-7914.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-7914.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-791810.js b/deps/v8/test/mjsunit/regress/wasm/regress-791810.js
index cd6c4e2728..73b47bdd78 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-791810.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-791810.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-793551.js b/deps/v8/test/mjsunit/regress/wasm/regress-793551.js
index 8aa0241923..657b2c0013 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-793551.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-793551.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-797846.js b/deps/v8/test/mjsunit/regress/wasm/regress-797846.js
index 6a4fd5c5f7..1470de4fc6 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-797846.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-797846.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// We need a module with one valid function.
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-800756.js b/deps/v8/test/mjsunit/regress/wasm/regress-800756.js
index 2d29997cef..76afc88d8f 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-800756.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-800756.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-801785.js b/deps/v8/test/mjsunit/regress/wasm/regress-801785.js
index 1870d7e8f1..105fd4bc38 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-801785.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-801785.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// Flags: --print-wasm-code
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-801850.js b/deps/v8/test/mjsunit/regress/wasm/regress-801850.js
index b56af694a9..0e0f5c249c 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-801850.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-801850.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-802244.js b/deps/v8/test/mjsunit/regress/wasm/regress-802244.js
index 0b8decb637..aeaf850365 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-802244.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-802244.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-803427.js b/deps/v8/test/mjsunit/regress/wasm/regress-803427.js
index d3ab31b4c9..26b1413c3b 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-803427.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-803427.js
@@ -4,7 +4,6 @@
// Flags: --wasm-lazy-compilation
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-803788.js b/deps/v8/test/mjsunit/regress/wasm/regress-803788.js
index e7fa3aaa8f..17325538f1 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-803788.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-803788.js
@@ -4,7 +4,6 @@
// Flags: --wasm-lazy-compilation
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8059.js b/deps/v8/test/mjsunit/regress/wasm/regress-8059.js
index c30ed152f8..78ee6bd1d2 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-8059.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-8059.js
@@ -4,7 +4,6 @@
// Flags: --no-wasm-disable-structured-cloning
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestPostModule() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-808012.js b/deps/v8/test/mjsunit/regress/wasm/regress-808012.js
index ae613ceb54..a54b88a5e1 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-808012.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-808012.js
@@ -4,7 +4,6 @@
// Flags: --wasm-lazy-compilation
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-808848.js b/deps/v8/test/mjsunit/regress/wasm/regress-808848.js
index bcf8469a14..57920de09d 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-808848.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-808848.js
@@ -4,7 +4,6 @@
// Flags: --allow-natives-syntax
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// The number of locals must be greater than the constant defined here:
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-808980.js b/deps/v8/test/mjsunit/regress/wasm/regress-808980.js
index ecf6476c37..d78c07f36c 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-808980.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-808980.js
@@ -4,7 +4,6 @@
// Flags: --allow-natives-syntax --throws
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let kTableSize = 3;
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8094.js b/deps/v8/test/mjsunit/regress/wasm/regress-8094.js
index a35d583a4a..dc78366ed8 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-8094.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-8094.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --experimental-wasm-eh
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Instantiate a throwing module.
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8095.js b/deps/v8/test/mjsunit/regress/wasm/regress-8095.js
index 66ffc0d4b7..7d21932ec4 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-8095.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-8095.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --experimental-wasm-eh
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Prepare a special error object to throw.
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-812005.js b/deps/v8/test/mjsunit/regress/wasm/regress-812005.js
index 979b769bbc..ba49987de5 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-812005.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-812005.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-817380.js b/deps/v8/test/mjsunit/regress/wasm/regress-817380.js
index 2cf50892fc..5b3281a150 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-817380.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-817380.js
@@ -4,7 +4,6 @@
// Flags: --wasm-lazy-compilation
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder1 = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-819869.js b/deps/v8/test/mjsunit/regress/wasm/regress-819869.js
index f2606fb610..a32928ab0c 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-819869.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-819869.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-820802.js b/deps/v8/test/mjsunit/regress/wasm/regress-820802.js
index 224a2260f5..214e71819f 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-820802.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-820802.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-824681.js b/deps/v8/test/mjsunit/regress/wasm/regress-824681.js
index 18ca3d0b5d..9d712e6ddb 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-824681.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-824681.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let chain = Promise.resolve();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-827806.js b/deps/v8/test/mjsunit/regress/wasm/regress-827806.js
index c06e0fae96..8576de2e79 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-827806.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-827806.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
try {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-831463.js b/deps/v8/test/mjsunit/regress/wasm/regress-831463.js
index 65d1213dd0..2818ad350b 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-831463.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-831463.js
@@ -4,7 +4,6 @@
// Flags: --wasm-interpret-all
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-834619.js b/deps/v8/test/mjsunit/regress/wasm/regress-834619.js
index 378e38e03c..145f415221 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-834619.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-834619.js
@@ -4,7 +4,6 @@
// Flags: --wasm-lazy-compilation
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function ExportedFunctionsImportedOrder() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-834624.js b/deps/v8/test/mjsunit/regress/wasm/regress-834624.js
index 9161f098e0..45af23cde2 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-834624.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-834624.js
@@ -4,7 +4,6 @@
// Flags: --wasm-interpret-all
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
let instance;
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-834693.js b/deps/v8/test/mjsunit/regress/wasm/regress-834693.js
index dac0e8578d..ad51b2a400 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-834693.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-834693.js
@@ -4,7 +4,6 @@
// flags: --wasm-lazy-compilation
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var module = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-836141.js b/deps/v8/test/mjsunit/regress/wasm/regress-836141.js
index b37dbea628..5ac58042e4 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-836141.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-836141.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-837417.js b/deps/v8/test/mjsunit/regress/wasm/regress-837417.js
index 9dcc299ecf..ef1d3cfaf6 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-837417.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-837417.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-840757.js b/deps/v8/test/mjsunit/regress/wasm/regress-840757.js
index 0887401336..ad1cf9f64f 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-840757.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-840757.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// Also enable predictable mode. Otherwise, concurrent recompilation will be
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-842501.js b/deps/v8/test/mjsunit/regress/wasm/regress-842501.js
index 83f5c9d4b8..d54507cc59 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-842501.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-842501.js
@@ -4,7 +4,6 @@
// Flags: --no-wasm-trap-handler
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-843563.js b/deps/v8/test/mjsunit/regress/wasm/regress-843563.js
index 8c18cfa7a9..ca22299254 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-843563.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-843563.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8505.js b/deps/v8/test/mjsunit/regress/wasm/regress-8505.js
index ebc97a95b4..0488723e4f 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-8505.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-8505.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --wasm-math-intrinsics --validate-asm --allow-natives-syntax
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
function verbose(args) {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8533.js b/deps/v8/test/mjsunit/regress/wasm/regress-8533.js
index 5d782b747c..da5f44925a 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-8533.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-8533.js
@@ -4,7 +4,6 @@
// Flags: --wasm-shared-engine --no-wasm-disable-structured-cloning --allow-natives-syntax --experimental-wasm-threads
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-854011.js b/deps/v8/test/mjsunit/regress/wasm/regress-854011.js
index 11863368f3..b0356a873f 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-854011.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-854011.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-854050.js b/deps/v8/test/mjsunit/regress/wasm/regress-854050.js
index e2146ca365..d6c4829acd 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-854050.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-854050.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-864509.js b/deps/v8/test/mjsunit/regress/wasm/regress-864509.js
index 822c06750a..19e3bfcfb8 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-864509.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-864509.js
@@ -4,7 +4,6 @@
// Flags: --liftoff --no-wasm-tier-up --no-future --wasm-tier-mask-for-testing=2
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-875556.js b/deps/v8/test/mjsunit/regress/wasm/regress-875556.js
index e1ea426f87..cc8bc5cc3e 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-875556.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-875556.js
@@ -3,7 +3,6 @@
// found in the LICENSE file.
// Flags: --expose-wasm --experimental-wasm-mv
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8846.js b/deps/v8/test/mjsunit/regress/wasm/regress-8846.js
new file mode 100644
index 0000000000..e508572ecd
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-8846.js
@@ -0,0 +1,27 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --experimental-wasm-eh --wasm-test-streaming
+
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+(function TestAsyncCompileExceptionSection() {
+ print(arguments.callee.name);
+ let builder = new WasmModuleBuilder();
+ let except = builder.addException(kSig_v_v);
+ builder.addFunction("thrw", kSig_v_v)
+ .addBody([
+ kExprThrow, except,
+ ]).exportFunc();
+ function step1(buffer) {
+ assertPromiseResult(WebAssembly.compile(buffer), module => step2(module));
+ }
+ function step2(module) {
+ assertPromiseResult(WebAssembly.instantiate(module), inst => step3(inst));
+ }
+ function step3(instance) {
+ assertThrows(() => instance.exports.thrw(), WebAssembly.RuntimeError);
+ }
+ step1(builder.toBuffer());
+})();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8896.js b/deps/v8/test/mjsunit/regress/wasm/regress-8896.js
new file mode 100644
index 0000000000..51f1b27188
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-8896.js
@@ -0,0 +1,23 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --experimental-wasm-eh --allow-natives-syntax
+
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+(function TestSerializeDeserializeRuntimeCall() {
+ var builder = new WasmModuleBuilder();
+ var except = builder.addException(kSig_v_v);
+ builder.addFunction("f", kSig_v_v)
+ .addBody([
+ kExprThrow, except,
+ ]).exportFunc();
+ var wire_bytes = builder.toBuffer();
+ var module = new WebAssembly.Module(wire_bytes);
+ var instance1 = new WebAssembly.Instance(module);
+ var serialized = %SerializeWasmModule(module);
+ module = %DeserializeWasmModule(serialized, wire_bytes);
+ var instance2 = new WebAssembly.Instance(module);
+ assertThrows(() => instance2.exports.f(), WebAssembly.RuntimeError);
+})();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-894307.js b/deps/v8/test/mjsunit/regress/wasm/regress-894307.js
index 5aef9eba86..f40388fcb4 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-894307.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-894307.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-894374.js b/deps/v8/test/mjsunit/regress/wasm/regress-894374.js
index fb9cb3b4fe..02be0088cf 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-894374.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-894374.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-905815.js b/deps/v8/test/mjsunit/regress/wasm/regress-905815.js
index 7967d99756..b49881f472 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-905815.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-905815.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-910824.js b/deps/v8/test/mjsunit/regress/wasm/regress-910824.js
index 7c8f154496..b795425b1f 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-910824.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-910824.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-913804.js b/deps/v8/test/mjsunit/regress/wasm/regress-913804.js
index c12013c9f8..e9d4026308 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-913804.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-913804.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-916869.js b/deps/v8/test/mjsunit/regress/wasm/regress-916869.js
index 6acd5d68d7..30bb011364 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-916869.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-916869.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-917412.js b/deps/v8/test/mjsunit/regress/wasm/regress-917412.js
index fd7ab99020..b74572ac8a 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-917412.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-917412.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-917588.js b/deps/v8/test/mjsunit/regress/wasm/regress-917588.js
index cb07bb5280..b07814415e 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-917588.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-917588.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-917588b.js b/deps/v8/test/mjsunit/regress/wasm/regress-917588b.js
index 9d461cfd84..1e5c1a4488 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-917588b.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-917588b.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-918149.js b/deps/v8/test/mjsunit/regress/wasm/regress-918149.js
index f19a26d2a3..cc790301d8 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-918149.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-918149.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-918284.js b/deps/v8/test/mjsunit/regress/wasm/regress-918284.js
index 05614edf3c..dadbf3f7ea 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-918284.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-918284.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-918917.js b/deps/v8/test/mjsunit/regress/wasm/regress-918917.js
index 725287ae74..f007957c6f 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-918917.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-918917.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-919308.js b/deps/v8/test/mjsunit/regress/wasm/regress-919308.js
index cb10662290..8c454413e8 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-919308.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-919308.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-919533.js b/deps/v8/test/mjsunit/regress/wasm/regress-919533.js
index 58273f666b..706d3cc7f4 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-919533.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-919533.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-922432.js b/deps/v8/test/mjsunit/regress/wasm/regress-922432.js
index 8f1ad11ebc..f6175b3a63 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-922432.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-922432.js
@@ -4,7 +4,6 @@
// Flags: --experimental-wasm-eh
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestTruncatedBrOnExnInLoop() {
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-922670.js b/deps/v8/test/mjsunit/regress/wasm/regress-922670.js
index d5617df238..2988eddf30 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-922670.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-922670.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-922933.js b/deps/v8/test/mjsunit/regress/wasm/regress-922933.js
index 3af0e86e1e..4d44509598 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-922933.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-922933.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-924843.js b/deps/v8/test/mjsunit/regress/wasm/regress-924843.js
new file mode 100644
index 0000000000..0549a769fb
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-924843.js
@@ -0,0 +1,16 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+load('test/mjsunit/wasm/wasm-module-builder.js');
+
+const builder = new WasmModuleBuilder();
+const sig = builder.addType(makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]));
+builder.addFunction(undefined, sig)
+ .addBody([
+ kExprGetLocal, 2,
+ kExprIf, kWasmStmt,
+ kExprBlock, kWasmStmt
+ ]);
+builder.addExport('main', 0);
+assertThrows(() => builder.instantiate(), WebAssembly.CompileError);
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-924905.js b/deps/v8/test/mjsunit/regress/wasm/regress-924905.js
index 5db3583e4c..9dbdf7e299 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-924905.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-924905.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-925671.js b/deps/v8/test/mjsunit/regress/wasm/regress-925671.js
new file mode 100644
index 0000000000..c6113c272e
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-925671.js
@@ -0,0 +1,12 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --wasm-tier-mask-for-testing=1
+
+load('test/mjsunit/wasm/wasm-module-builder.js');
+
+var builder = new WasmModuleBuilder();
+builder.addFunction('f0', kSig_v_v).addBody([]);
+builder.addFunction('f1', kSig_v_v).addBody([]);
+builder.instantiate();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-935138.js b/deps/v8/test/mjsunit/regress/wasm/regress-935138.js
new file mode 100644
index 0000000000..e0fe535e27
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-935138.js
@@ -0,0 +1,19 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --wasm-test-streaming
+
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+(function TestAsyncCompileMultipleCodeSections() {
+ let binary = new Binary();
+ binary.emit_header();
+ binary.push(kTypeSectionCode, 4, 1, kWasmFunctionTypeForm, 0, 0);
+ binary.push(kFunctionSectionCode, 2, 1, 0);
+ binary.push(kCodeSectionCode, 6, 1, 4, 0, kExprGetLocal, 0, kExprEnd);
+ binary.push(kCodeSectionCode, 6, 1, 4, 0, kExprGetLocal, 0, kExprEnd);
+ let buffer = Uint8Array.from(binary).buffer;
+ assertPromiseResult(WebAssembly.compile(buffer), assertUnreachable,
+ e => assertInstanceof(e, WebAssembly.CompileError));
+})();
diff --git a/deps/v8/test/mjsunit/string-external-cached.js b/deps/v8/test/mjsunit/string-external-cached.js
index cd368f660a..dd8a99382b 100644
--- a/deps/v8/test/mjsunit/string-external-cached.js
+++ b/deps/v8/test/mjsunit/string-external-cached.js
@@ -53,7 +53,7 @@ function test() {
assertEquals('B', charat_str[i].charAt(3*16 + 11));
}
- charat_short = "012";
+ charat_short = "01234";
try { // String can only be externalized once
externalizeString(charat_short, true);
} catch (ex) { }
diff --git a/deps/v8/test/mjsunit/string-externalize.js b/deps/v8/test/mjsunit/string-externalize.js
index dd861e8816..22840c264a 100644
--- a/deps/v8/test/mjsunit/string-externalize.js
+++ b/deps/v8/test/mjsunit/string-externalize.js
@@ -45,7 +45,7 @@ function test() {
assertTrue(isOneByteString(str));
var twoByteExternalWithOneByteData =
- "AA" + dont_inline();
+ "AAAA" + dont_inline();
externalizeString(twoByteExternalWithOneByteData, true /* force two-byte */);
assertFalse(isOneByteString(twoByteExternalWithOneByteData));
@@ -54,12 +54,10 @@ function test() {
externalizeString(realTwoByteExternalString);
assertFalse(isOneByteString(realTwoByteExternalString));
- assertTrue(isOneByteString(["a", twoByteExternalWithOneByteData].join("")));
+ assertFalse(isOneByteString(["a", twoByteExternalWithOneByteData].join("")));
- // Appending a two-byte string that contains only ascii chars should
- // still produce an ascii cons.
var str1 = str + twoByteExternalWithOneByteData;
- assertTrue(isOneByteString(str1));
+ assertFalse(isOneByteString(str1));
// Force flattening of the string.
var old_length = str1.length - twoByteExternalWithOneByteData.length;
@@ -70,11 +68,11 @@ function test() {
assertEquals("A", str1[i]);
}
- // Flattened string should still be ascii.
- assertTrue(isOneByteString(str1));
+ // Flattened string should still be two-byte.
+ assertFalse(isOneByteString(str1));
- // Lower-casing an ascii string should produce ascii.
- assertTrue(isOneByteString(str1.toLowerCase()));
+ // Lower-casing an ascii string should produce two-byte.
+ assertFalse(isOneByteString(str1.toLowerCase()));
assertFalse(isOneByteString(["a", realTwoByteExternalString].join("")));
diff --git a/deps/v8/test/mjsunit/switch.js b/deps/v8/test/mjsunit/switch.js
index 4722e9e5d8..4b27789ad9 100644
--- a/deps/v8/test/mjsunit/switch.js
+++ b/deps/v8/test/mjsunit/switch.js
@@ -515,3 +515,13 @@ test_switches(true);
}
assertEquals(1, i);
})();
+
+assertThrows(function() {
+ function f(){}
+ // The f()-- unconditionally throws a ReferenceError.
+ switch(f()--) {
+ // This label is dead.
+ default:
+ break;
+ }
+}, ReferenceError);
diff --git a/deps/v8/test/mjsunit/testcfg.py b/deps/v8/test/mjsunit/testcfg.py
index 901d8e90a4..f95c33e7da 100644
--- a/deps/v8/test/mjsunit/testcfg.py
+++ b/deps/v8/test/mjsunit/testcfg.py
@@ -56,24 +56,19 @@ COMBINE_TESTS_FLAGS_BLACKLIST = [
'--wasm-lazy-compilation',
]
+
+class TestLoader(testsuite.JSTestLoader):
+ @property
+ def excluded_files(self):
+ return {
+ "mjsunit.js",
+ "mjsunit_suppressions.js",
+ }
+
+
class TestSuite(testsuite.TestSuite):
- def ListTests(self):
- tests = []
- for dirname, dirs, files in os.walk(self.root, followlinks=True):
- for dotted in [x for x in dirs if x.startswith('.')]:
- dirs.remove(dotted)
- dirs.sort()
- files.sort()
- for filename in files:
- if (filename.endswith(".js") and
- filename != "mjsunit.js" and
- filename != "mjsunit_suppressions.js"):
- fullpath = os.path.join(dirname, filename)
- relpath = fullpath[len(self.root) + 1 : -3]
- testname = relpath.replace(os.path.sep, "/")
- test = self._create_test(testname)
- tests.append(test)
- return tests
+ def _test_loader_class(self):
+ return TestLoader
def _test_combiner_class(self):
return TestCombiner
diff --git a/deps/v8/test/mjsunit/tools/compiler-trace-flags.js b/deps/v8/test/mjsunit/tools/compiler-trace-flags.js
index 491aad8c1e..ea6f816f5d 100644
--- a/deps/v8/test/mjsunit/tools/compiler-trace-flags.js
+++ b/deps/v8/test/mjsunit/tools/compiler-trace-flags.js
@@ -6,7 +6,6 @@
// Flags: --trace-turbo-cfg-file=test/mjsunit/tools/turbo.cfg
// Flags: --trace-turbo-path=test/mjsunit/tools
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// The idea behind this test is to make sure we do not crash when using the
diff --git a/deps/v8/test/mjsunit/ubsan-fuzzerbugs.js b/deps/v8/test/mjsunit/ubsan-fuzzerbugs.js
new file mode 100644
index 0000000000..d2a21288ab
--- /dev/null
+++ b/deps/v8/test/mjsunit/ubsan-fuzzerbugs.js
@@ -0,0 +1,19 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// crbug.com/923466
+__v_5 = [ -1073741825, -2147483648];
+__v_5.sort();
+
+// crbug.com/923642
+new RegExp("(abcd){2148473648,}", "");
+
+// crbug.com/923626
+new Date(2146399200000).toString();
+new Date(2146940400000).toString();
+new Date(2147481600000).toString();
+new Date(2148022800000).toString();
+
+// crbug.com/927212
+assertThrows(() => (2n).toString(-2147483657), RangeError);
diff --git a/deps/v8/test/mjsunit/wasm/adapter-frame.js b/deps/v8/test/mjsunit/wasm/adapter-frame.js
index 284adb993f..55634163c6 100644
--- a/deps/v8/test/mjsunit/wasm/adapter-frame.js
+++ b/deps/v8/test/mjsunit/wasm/adapter-frame.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const JS = false; // for testing the tests.
diff --git a/deps/v8/test/mjsunit/wasm/add-getters.js b/deps/v8/test/mjsunit/wasm/add-getters.js
index ca5783a7f9..fc5c5d2ff2 100644
--- a/deps/v8/test/mjsunit/wasm/add-getters.js
+++ b/deps/v8/test/mjsunit/wasm/add-getters.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function testAddGetter(object, name, val) {
diff --git a/deps/v8/test/mjsunit/wasm/anyfunc.js b/deps/v8/test/mjsunit/wasm/anyfunc.js
index 30faef12a7..19415fe2b8 100644
--- a/deps/v8/test/mjsunit/wasm/anyfunc.js
+++ b/deps/v8/test/mjsunit/wasm/anyfunc.js
@@ -4,10 +4,9 @@
// Flags: --expose-wasm --experimental-wasm-anyref --expose-gc
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
-(function testAnyRefIdentityFunction() {
+(function testAnyFuncIdentityFunction() {
print(arguments.callee.name);
const builder = new WasmModuleBuilder();
builder.addFunction('main', kSig_a_a)
@@ -23,7 +22,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
instance.exports.main, instance.exports.main(instance.exports.main));
})();
-(function testPassAnyRefToImportedFunction() {
+(function testPassAnyFuncToImportedFunction() {
print(arguments.callee.name);
const builder = new WasmModuleBuilder();
const sig_index = builder.addType(kSig_v_a);
@@ -41,3 +40,160 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
main(main);
})();
+
+(function testPassAnyFuncWithGCWithLocals() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ const ref_sig = builder.addType(kSig_v_a);
+ const void_sig = builder.addType(kSig_v_v);
+ const imp_index = builder.addImport("q", "func", ref_sig);
+ const gc_index = builder.addImport("q", "gc", void_sig);
+ // First call the gc, then check if the object still exists.
+ builder.addFunction('main', ref_sig)
+ .addLocals({anyfunc_count: 10})
+ .addBody([
+ kExprGetLocal, 0, kExprSetLocal, 1, // Set local
+ kExprGetLocal, 0, kExprSetLocal, 2, // Set local
+ kExprGetLocal, 0, kExprSetLocal, 3, // Set local
+ kExprGetLocal, 0, kExprSetLocal, 4, // Set local
+ kExprGetLocal, 0, kExprSetLocal, 5, // Set local
+ kExprGetLocal, 0, kExprSetLocal, 6, // Set local
+ kExprGetLocal, 0, kExprSetLocal, 7, // Set local
+ kExprGetLocal, 0, kExprSetLocal, 8, // Set local
+ kExprGetLocal, 0, kExprSetLocal, 9, // Set local
+ kExprGetLocal, 0, kExprSetLocal, 10, // Set local
+ kExprCallFunction, gc_index, // call gc
+ kExprGetLocal, 9, kExprCallFunction, imp_index // call import
+ ])
+ .exportFunc();
+
+ const main =
+ builder.instantiate({q: {func: checkFunction, gc: gc}}).exports.main;
+
+ function checkFunction(value) {
+ assertSame(main, value);
+ }
+
+ main(main);
+})();
+
+(function testPassAnyFuncWithGC() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ const ref_sig = builder.addType(kSig_v_a);
+ const void_sig = builder.addType(kSig_v_v);
+ const imp_index = builder.addImport("q", "func", ref_sig);
+ const gc_index = builder.addImport("q", "gc", void_sig);
+ // First call the gc, then check if the object still exists.
+ builder.addFunction('main', ref_sig)
+ .addBody([
+ kExprCallFunction, gc_index, // call gc
+ kExprGetLocal, 0, kExprCallFunction, imp_index // call import
+ ])
+ .exportFunc();
+
+ function checkFunction(value) {
+ assertSame(main, value);
+ }
+
+ const main = builder.instantiate({q: {func: checkFunction, gc: gc}}).exports.main;
+
+ main(main);
+})();
+
+(function testPassAnyFuncWithGCInWrapper() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ const kSig_a_iai = makeSig([kWasmI32, kWasmAnyFunc, kWasmI32], [kWasmAnyFunc]);
+ const sig_index = builder.addType(kSig_a_iai);
+ builder.addFunction('main', sig_index)
+ .addBody([kExprGetLocal, 1])
+ .exportFunc();
+
+ const main = builder.instantiate().exports.main;
+
+ const triggerGCParam = {
+ valueOf: () => {
+ gc();
+ return 17;
+ }
+ };
+
+ const result = main(triggerGCParam, main, triggerGCParam);
+ assertSame(main, result);
+})();
+
+(function testAnyFuncDefaultValue() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ const sig_index = builder.addType(kSig_a_v);
+ builder.addFunction('main', sig_index)
+ .addLocals({anyfunc_count: 1})
+ .addBody([kExprGetLocal, 0])
+ .exportFunc();
+
+ const main = builder.instantiate().exports.main;
+ assertEquals(null, main());
+})();
+
+(function testAssignNullRefToAnyFuncLocal() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ const sig_index = builder.addType(kSig_a_a);
+ builder.addFunction('main', sig_index)
+ .addBody([kExprRefNull, kExprSetLocal, 0, kExprGetLocal, 0])
+ .exportFunc();
+
+ const main = builder.instantiate().exports.main;
+ assertEquals(null, main(main));
+})();
+
+(function testImplicitReturnNullRefAsAnyFunc() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ const sig_index = builder.addType(kSig_a_v);
+ builder.addFunction('main', sig_index)
+ .addBody([kExprRefNull])
+ .exportFunc();
+
+ const main = builder.instantiate().exports.main;
+ assertEquals(null, main());
+})();
+
+(function testExplicitReturnNullRefAsAnyFunc() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ const sig_index = builder.addType(kSig_a_v);
+ builder.addFunction('main', sig_index)
+ .addBody([kExprRefNull, kExprReturn])
+ .exportFunc();
+
+ const main = builder.instantiate().exports.main;
+ assertEquals(null, main());
+})();
+
+(function testImplicitReturnAnyFuncAsAnyRef() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ const sig_index = builder.addType(kSig_r_v);
+ builder.addFunction('main', sig_index)
+ .addLocals({anyfunc_count: 1})
+ .addBody([kExprGetLocal, 0])
+ .exportFunc();
+
+ const main = builder.instantiate().exports.main;
+ assertEquals(null, main());
+})();
+
+(function testExplicitReturnAnyFuncAsAnyRef() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ const sig_index = builder.addType(kSig_r_v);
+ builder.addFunction('main', sig_index)
+ .addLocals({anyfunc_count: 1})
+ .addBody([kExprGetLocal, 0, kExprReturn])
+ .exportFunc();
+
+ const main = builder.instantiate().exports.main;
+ assertEquals(null, main());
+})();
diff --git a/deps/v8/test/mjsunit/wasm/anyref-globals.js b/deps/v8/test/mjsunit/wasm/anyref-globals.js
index 64f56366e0..f1facefb28 100644
--- a/deps/v8/test/mjsunit/wasm/anyref-globals.js
+++ b/deps/v8/test/mjsunit/wasm/anyref-globals.js
@@ -4,7 +4,6 @@
// Flags: --experimental-wasm-anyref --expose-gc
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestDefaultValue() {
diff --git a/deps/v8/test/mjsunit/wasm/anyref.js b/deps/v8/test/mjsunit/wasm/anyref.js
index 2c045712f1..141d25d1e3 100644
--- a/deps/v8/test/mjsunit/wasm/anyref.js
+++ b/deps/v8/test/mjsunit/wasm/anyref.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --experimental-wasm-anyref --expose-gc
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function testAnyRefIdentityFunction() {
@@ -104,6 +103,42 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
instance.exports.main({hello: 'world'});
})();
+(function testPassAnyRefWithGCWithStackParameters() {
+ print(arguments.callee.name);
+ const num_params = 15;
+ for (let index = 0; index < num_params; index++) {
+ const builder = new WasmModuleBuilder();
+ // Make a signature with {num_params} many anyref parameters.
+ const mysig = makeSig(Array(num_params).fill(kWasmAnyRef), []);
+ const main_sig = builder.addType(mysig);
+ const ref_sig = builder.addType(kSig_v_r);
+ const void_sig = builder.addType(kSig_v_v);
+ const imp_index = builder.addImport('q', 'func', ref_sig);
+ const gc_index = builder.addImport('q', 'gc', void_sig);
+ // First call the gc, then check if the object still exists.
+ builder.addFunction('main', main_sig)
+ .addBody([
+ kExprCallFunction, gc_index, // call gc
+ kExprGetLocal, index, kExprCallFunction, imp_index // call import
+ ])
+ .exportFunc();
+
+ function checkFunction(value) {
+ assertEquals(index, value.hello);
+ }
+
+ const instance = builder.instantiate({q: {func: checkFunction, gc: gc}});
+
+ // Pass {num_params} many parameters to main. Note that it is important
+ // that no other references to these objects exist. They are kept alive
+ // only through references stored in the parameters slots of a stack frame.
+ instance.exports.main(
+ {hello: 0}, {hello: 1}, {hello: 2}, {hello: 3}, {hello: 4}, {hello: 5},
+ {hello: 6}, {hello: 7}, {hello: 8}, {hello: 9}, {hello: 10},
+ {hello: 11}, {hello: 12}, {hello: 13}, {hello: 14});
+ }
+})();
+
(function testPassAnyRefWithGCInWrapper() {
print(arguments.callee.name);
const builder = new WasmModuleBuilder();
@@ -181,3 +216,27 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
assertEquals(null, instance.exports.main());
})();
+
+(function testImplicitReturnNullRefAsAnyRef() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ const sig_index = builder.addType(kSig_r_v);
+ builder.addFunction('main', sig_index)
+ .addBody([kExprRefNull])
+ .exportFunc();
+
+ const main = builder.instantiate().exports.main;
+ assertEquals(null, main());
+})();
+
+(function testExplicitReturnNullRefAsAnyRef() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ const sig_index = builder.addType(kSig_r_v);
+ builder.addFunction('main', sig_index)
+ .addBody([kExprRefNull, kExprReturn])
+ .exportFunc();
+
+ const main = builder.instantiate().exports.main;
+ assertEquals(null, main());
+})();
diff --git a/deps/v8/test/mjsunit/wasm/async-compile.js b/deps/v8/test/mjsunit/wasm/async-compile.js
index 122eccbe96..a5e7c499bd 100644
--- a/deps/v8/test/mjsunit/wasm/async-compile.js
+++ b/deps/v8/test/mjsunit/wasm/async-compile.js
@@ -2,9 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --expose-wasm --allow-natives-syntax
-
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
async function assertCompiles(buffer) {
@@ -12,13 +9,11 @@ async function assertCompiles(buffer) {
assertInstanceof(module, WebAssembly.Module);
}
-async function assertCompileError(buffer) {
- try {
- await WebAssembly.compile(buffer);
- assertUnreachable();
- } catch (e) {
- if (!(e instanceof WebAssembly.CompileError)) throw e;
- }
+function assertCompileError(buffer, msg) {
+ assertEquals('string', typeof msg);
+ return assertThrowsAsync(
+ WebAssembly.compile(buffer), WebAssembly.CompileError,
+ 'WebAssembly.compile(): ' + msg);
}
assertPromiseResult(async function basicCompile() {
@@ -50,7 +45,7 @@ assertPromiseResult(async function basicCompile() {
// Three compilations of the bad module should fail.
for (var i = 0; i < kNumCompiles; i++) {
- await assertCompileError(bad_buffer);
+ await assertCompileError(bad_buffer, 'BufferSource argument is empty');
}
}());
@@ -69,7 +64,10 @@ assertPromiseResult(async function badFunctionInTheMiddle() {
builder.addFunction('b' + i, sig).addBody([kExprI32Const, 42]);
}
let buffer = builder.toBuffer();
- await assertCompileError(buffer);
+ await assertCompileError(
+ buffer,
+ 'Compiling wasm function \"bad\" failed: ' +
+ 'expected 1 elements on the stack for fallthru to @1, found 0 @+94');
}());
assertPromiseResult(async function importWithoutCode() {
diff --git a/deps/v8/test/mjsunit/wasm/atomics-stress.js b/deps/v8/test/mjsunit/wasm/atomics-stress.js
index b832fad8fe..3d360373f0 100644
--- a/deps/v8/test/mjsunit/wasm/atomics-stress.js
+++ b/deps/v8/test/mjsunit/wasm/atomics-stress.js
@@ -9,7 +9,6 @@
// Note that results of this test are flaky by design. While the test is
// deterministic with a fixed seed, bugs may introduce non-determinism.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const kDebug = false;
diff --git a/deps/v8/test/mjsunit/wasm/atomics.js b/deps/v8/test/mjsunit/wasm/atomics.js
index 371839ae24..08714bbc01 100644
--- a/deps/v8/test/mjsunit/wasm/atomics.js
+++ b/deps/v8/test/mjsunit/wasm/atomics.js
@@ -4,7 +4,6 @@
// Flags: --experimental-wasm-threads
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const kMemtypeSize32 = 4;
diff --git a/deps/v8/test/mjsunit/wasm/atomics64-stress.js b/deps/v8/test/mjsunit/wasm/atomics64-stress.js
index e0ce2324ea..f85c19a970 100644
--- a/deps/v8/test/mjsunit/wasm/atomics64-stress.js
+++ b/deps/v8/test/mjsunit/wasm/atomics64-stress.js
@@ -9,7 +9,6 @@
// Note that results of this test are flaky by design. While the test is
// deterministic with a fixed seed, bugs may introduce non-determinism.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const kDebug = false;
diff --git a/deps/v8/test/mjsunit/wasm/bigint.js b/deps/v8/test/mjsunit/wasm/bigint.js
index cb761acab1..49a1ead6b8 100644
--- a/deps/v8/test/mjsunit/wasm/bigint.js
+++ b/deps/v8/test/mjsunit/wasm/bigint.js
@@ -4,7 +4,6 @@
// Flags: --experimental-wasm-bigint
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestWasmI64ToJSBigInt() {
diff --git a/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js b/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js
index d909bcc542..43ff8570c6 100644
--- a/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js
+++ b/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js b/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js
index 7e260eab08..d972e7830d 100644
--- a/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js
+++ b/deps/v8/test/mjsunit/wasm/bounds-check-turbofan.js
@@ -4,7 +4,6 @@
// Flags: --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/wasm/bulk-memory.js b/deps/v8/test/mjsunit/wasm/bulk-memory.js
index c9aefb774c..0e59965085 100644
--- a/deps/v8/test/mjsunit/wasm/bulk-memory.js
+++ b/deps/v8/test/mjsunit/wasm/bulk-memory.js
@@ -4,7 +4,6 @@
// Flags: --experimental-wasm-bulk-memory
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestPassiveDataSegment() {
@@ -47,8 +46,8 @@ function getMemoryInit(mem, segment_data) {
kExprGetLocal, 1, // Source.
kExprGetLocal, 2, // Size in bytes.
kNumericPrefix, kExprMemoryInit,
- 0, // Memory index.
0, // Data segment index.
+ 0, // Memory index.
])
.exportAs('init');
return builder.instantiate({'': {mem}}).exports.init;
@@ -116,8 +115,8 @@ function getMemoryInit(mem, segment_data) {
kExprI32Const, 0, // Source.
kExprI32Const, 0, // Size in bytes.
kNumericPrefix, kExprMemoryInit,
- 0, // Memory index.
1, // Data segment index.
+ 0, // Memory index.
])
.exportAs('init');
@@ -138,13 +137,13 @@ function getMemoryInit(mem, segment_data) {
kExprI32Const, 0, // Source.
kExprI32Const, 0, // Size in bytes.
kNumericPrefix, kExprMemoryInit,
- 0, // Memory index.
0, // Data segment index.
+ 0, // Memory index.
])
.exportAs('init');
builder.addFunction('drop', kSig_v_v)
.addBody([
- kNumericPrefix, kExprMemoryDrop,
+ kNumericPrefix, kExprDataDrop,
0, // Data segment index.
])
.exportAs('drop');
@@ -163,14 +162,14 @@ function getMemoryInit(mem, segment_data) {
assertTraps(kTrapDataSegmentDropped, () => instance.exports.drop());
})();
-(function TestMemoryDropOnActiveSegment() {
+(function TestDataDropOnActiveSegment() {
const builder = new WasmModuleBuilder();
builder.addMemory(1);
builder.addPassiveDataSegment([1, 2, 3]);
builder.addDataSegment(0, [4, 5, 6]);
builder.addFunction('drop', kSig_v_v)
.addBody([
- kNumericPrefix, kExprMemoryDrop,
+ kNumericPrefix, kExprDataDrop,
1, // Data segment index.
])
.exportAs('drop');
@@ -186,7 +185,7 @@ function getMemoryCopy(mem) {
kExprGetLocal, 0, // Dest.
kExprGetLocal, 1, // Source.
kExprGetLocal, 2, // Size in bytes.
- kNumericPrefix, kExprMemoryCopy, 0,
+ kNumericPrefix, kExprMemoryCopy, 0, 0,
]).exportAs("copy");
return builder.instantiate({'': {mem}}).exports.copy;
}
@@ -321,35 +320,13 @@ function getMemoryFill(mem) {
kTrapMemOutOfBounds, () => memoryFill(kPageSize + 1, v, kPageSize));
})();
-(function TestTableInit0() {
- let builder = new WasmModuleBuilder();
- let sig_v_iii = builder.addType(kSig_v_iii);
-
- builder.setTableBounds(5, 5);
- builder.addElementSegment(0, false, []);
- builder.addElementSegment(0, false, []);
-
- builder.addFunction("init0", sig_v_iii)
- .addBody([
- kExprGetLocal, 0,
- kExprGetLocal, 1,
- kExprGetLocal, 2,
- kNumericPrefix, kExprTableInit, kTableZero, kSegmentZero])
- .exportAs("init0");
-
- let instance = builder.instantiate();
- let init = instance.exports.init0;
- // TODO(titzer): we only check that a function containing TableInit can be compiled.
- // init(1, 2, 3);
-})();
-
-(function TestTableDropActive() {
+(function TestElemDropActive() {
const builder = new WasmModuleBuilder();
builder.setTableBounds(5, 5);
builder.addElementSegment(0, false, [0, 0, 0]);
builder.addFunction('drop', kSig_v_v)
.addBody([
- kNumericPrefix, kExprTableDrop,
+ kNumericPrefix, kExprElemDrop,
0, // Element segment index.
])
.exportAs('drop');
@@ -358,13 +335,13 @@ function getMemoryFill(mem) {
assertTraps(kTrapElemSegmentDropped, () => instance.exports.drop());
})();
-(function TestTableDropTwice() {
+(function TestElemDropTwice() {
const builder = new WasmModuleBuilder();
builder.setTableBounds(5, 5);
builder.addPassiveElementSegment([0, 0, 0]);
builder.addFunction('drop', kSig_v_v)
.addBody([
- kNumericPrefix, kExprTableDrop,
+ kNumericPrefix, kExprElemDrop,
0, // Element segment index.
])
.exportAs('drop');
diff --git a/deps/v8/test/mjsunit/wasm/calls.js b/deps/v8/test/mjsunit/wasm/calls.js
index b0feda8c80..97188964d1 100644
--- a/deps/v8/test/mjsunit/wasm/calls.js
+++ b/deps/v8/test/mjsunit/wasm/calls.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function assertModule(module, memsize) {
diff --git a/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js b/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js
index 7e8bcde6af..6f4698c0d0 100644
--- a/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js
+++ b/deps/v8/test/mjsunit/wasm/code-space-exhaustion.js
@@ -4,7 +4,6 @@
// Flags: --wasm-max-code-space=1
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// We only have 1 MB code space. This is enough for the code below, but for all
diff --git a/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js b/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js
index d308919088..5102216933 100644
--- a/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js
+++ b/deps/v8/test/mjsunit/wasm/compare-exchange-stress.js
@@ -4,7 +4,6 @@
// Flags: --experimental-wasm-threads
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const kSequenceLength = 8192;
diff --git a/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js b/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js
index 89cc7ecb34..bd1c5c95a5 100644
--- a/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js
+++ b/deps/v8/test/mjsunit/wasm/compare-exchange64-stress.js
@@ -4,7 +4,6 @@
// Flags: --experimental-wasm-threads
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const kSequenceLength = 8192;
diff --git a/deps/v8/test/mjsunit/wasm/compilation-limits.js b/deps/v8/test/mjsunit/wasm/compilation-limits.js
index 2b79de008f..2fe2d32b71 100644
--- a/deps/v8/test/mjsunit/wasm/compilation-limits.js
+++ b/deps/v8/test/mjsunit/wasm/compilation-limits.js
@@ -4,7 +4,6 @@
// Flags: --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
%SetWasmCompileControls(100000, true);
diff --git a/deps/v8/test/mjsunit/wasm/compiled-module-management.js b/deps/v8/test/mjsunit/wasm/compiled-module-management.js
index 19446403ab..a2b102f083 100644
--- a/deps/v8/test/mjsunit/wasm/compiled-module-management.js
+++ b/deps/v8/test/mjsunit/wasm/compiled-module-management.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --expose-gc --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Use global variables for all values where the test wants to maintain strict
diff --git a/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js b/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js
index 8a9a0cbd10..9c28a7746d 100644
--- a/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js
+++ b/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --allow-natives-syntax --expose-gc
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function SerializeAndDeserializeModule() {
diff --git a/deps/v8/test/mjsunit/wasm/data-segments.js b/deps/v8/test/mjsunit/wasm/data-segments.js
index e73e3fb3a7..91b6525537 100644
--- a/deps/v8/test/mjsunit/wasm/data-segments.js
+++ b/deps/v8/test/mjsunit/wasm/data-segments.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var debug = false;
diff --git a/deps/v8/test/mjsunit/wasm/disallow-codegen.js b/deps/v8/test/mjsunit/wasm/disallow-codegen.js
index f1303e845f..c1dfb8a6e3 100644
--- a/deps/v8/test/mjsunit/wasm/disallow-codegen.js
+++ b/deps/v8/test/mjsunit/wasm/disallow-codegen.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
let kReturnValue = 19;
diff --git a/deps/v8/test/mjsunit/wasm/divrem-trap.js b/deps/v8/test/mjsunit/wasm/divrem-trap.js
index d78e170901..d9a23693f0 100644
--- a/deps/v8/test/mjsunit/wasm/divrem-trap.js
+++ b/deps/v8/test/mjsunit/wasm/divrem-trap.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --expose-gc --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var assertTraps = function(messageId, code) {
diff --git a/deps/v8/test/mjsunit/wasm/empirical_max_memory.js b/deps/v8/test/mjsunit/wasm/empirical_max_memory.js
index 262dfe10ef..e2ff7ca517 100644
--- a/deps/v8/test/mjsunit/wasm/empirical_max_memory.js
+++ b/deps/v8/test/mjsunit/wasm/empirical_max_memory.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let k1MiB = 1 * 1024 * 1024;
diff --git a/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js b/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js
index 26bdf8ece8..9f7a7f71d2 100644
--- a/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js
+++ b/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js
@@ -10,7 +10,6 @@
(function print_incrementer() {
if (true) return; // remove to regenerate the module
- load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var module = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/wasm/errors.js b/deps/v8/test/mjsunit/wasm/errors.js
index 744ba9bbdb..9e3f683490 100644
--- a/deps/v8/test/mjsunit/wasm/errors.js
+++ b/deps/v8/test/mjsunit/wasm/errors.js
@@ -4,162 +4,159 @@
// Flags: --expose-wasm --allow-natives-syntax
-'use strict';
-
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
-function module(bytes) {
- let buffer = bytes;
- if (typeof buffer === 'string') {
- buffer = new ArrayBuffer(bytes.length);
- let view = new Uint8Array(buffer);
- for (let i = 0; i < bytes.length; ++i) {
- view[i] = bytes.charCodeAt(i);
- }
- }
- return new WebAssembly.Module(buffer);
-}
-
-function instance(bytes, imports = {}) {
- return new WebAssembly.Instance(module(bytes), imports);
-}
-
-// instantiate should succeed but run should fail.
-function instantiateAndFailAtRuntime(bytes, imports = {}) {
- var instance =
- assertDoesNotThrow(new WebAssembly.Instance(module(bytes), imports));
- instance.exports.run();
-}
-
function builder() {
return new WasmModuleBuilder;
}
function assertCompileError(bytes, msg) {
- assertThrows(() => module(bytes), WebAssembly.CompileError, msg);
+ assertThrows(
+ () => new WebAssembly.Module(bytes), WebAssembly.CompileError,
+ 'WebAssembly.Module(): ' + msg);
+ assertThrowsAsync(
+ WebAssembly.compile(bytes), WebAssembly.CompileError,
+ 'WebAssembly.compile(): ' + msg);
+}
+
+function assertInstantiateError(error, bytes, imports = {}, msg) {
+ assertThrows(
+ () => new WebAssembly.Instance(new WebAssembly.Module(bytes), imports),
+ error, 'WebAssembly.Instance(): ' + msg);
+ assertThrowsAsync(
+ WebAssembly.instantiate(bytes, imports), error,
+ 'WebAssembly.instantiate(): ' + msg);
}
// default imports to {} so we get LinkError by default, thus allowing us to
// distinguish the TypeError we want to catch
function assertTypeError(bytes, imports = {}, msg) {
- assertThrows(() => instance(bytes, imports), TypeError, msg);
+ assertInstantiateError(TypeError, bytes, imports, msg);
}
function assertLinkError(bytes, imports, msg) {
- assertThrows(() => instance(bytes, imports), WebAssembly.LinkError, msg);
-}
-
-function assertRuntimeError(bytes, imports, msg) {
- assertThrows(
- () => instantiateAndFailAtRuntime(bytes, imports),
- WebAssembly.RuntimeError, msg);
+ assertInstantiateError(WebAssembly.LinkError, bytes, imports, msg);
}
function assertConversionError(bytes, imports, msg) {
- assertThrows(
- () => instantiateAndFailAtRuntime(bytes, imports), TypeError, msg);
+ let instance =
+ new WebAssembly.Instance(new WebAssembly.Module(bytes), imports);
+ assertThrows(() => instance.exports.run(), TypeError, msg);
}
(function TestDecodingError() {
- assertCompileError("", /is empty/);
- assertCompileError("X", /expected 4 bytes, fell off end @\+0/);
+ print(arguments.callee.name);
+ assertCompileError(bytes(), 'BufferSource argument is empty');
+ assertCompileError(bytes('X'), 'expected 4 bytes, fell off end @+0');
assertCompileError(
- "\0x00asm", /expected magic word 00 61 73 6d, found 00 78 30 30 @\+0/);
+ bytes('\0x00asm'),
+ 'expected magic word 00 61 73 6d, found 00 78 30 30 @+0');
})();
(function TestValidationError() {
+ print(arguments.callee.name);
+ let f_error = msg => 'Compiling wasm function "f" failed: ' + msg;
assertCompileError(
- builder().addFunction("f", kSig_i_v).end().toBuffer(),
- /function body must end with "end" opcode @/);
+ builder().addFunction('f', kSig_i_v).end().toBuffer(),
+ f_error('function body must end with "end" opcode @+24'));
assertCompileError(
builder().addFunction('f', kSig_i_v).addBody([kExprReturn])
.end().toBuffer(),
- /expected 1 elements on the stack for return, found 0 @/);
- assertCompileError(builder().addFunction("f", kSig_v_v).addBody([
+ f_error('expected 1 elements on the stack for return, found 0 @+24'));
+ assertCompileError(builder().addFunction('f', kSig_v_v).addBody([
kExprGetLocal, 0
- ]).end().toBuffer(), /invalid local index: 0 @/);
+ ]).end().toBuffer(), f_error('invalid local index: 0 @+24'));
assertCompileError(
- builder().addStart(0).toBuffer(), /function index 0 out of bounds/);
+ builder().addStart(0).toBuffer(),
+ 'start function index 0 out of bounds (0 entries) @+10');
})();
+function import_error(index, module, func, msg) {
+ let full_msg = 'Import #' + index + ' module=\"' + module + '\"';
+ if (func !== undefined) full_msg += ' function=\"' + func + '\"';
+ return full_msg + ' error: ' + msg;
+}
+
(function TestTypeError() {
- let b;
- b = builder();
- b.addImport("foo", "bar", kSig_v_v);
- assertTypeError(b.toBuffer(), {}, /module is not an object or function/);
+ print(arguments.callee.name);
+ let b = builder();
+ b.addImport('foo', 'bar', kSig_v_v);
+ let msg =
+ import_error(0, 'foo', undefined, 'module is not an object or function');
+ assertTypeError(b.toBuffer(), {}, msg);
b = builder();
- b.addImportedGlobal("foo", "bar", kWasmI32);
- assertTypeError(b.toBuffer(), {}, /module is not an object or function/);
+ b.addImportedGlobal('foo', 'bar', kWasmI32);
+ assertTypeError(b.toBuffer(), {}, msg);
b = builder();
- b.addImportedMemory("foo", "bar");
- assertTypeError(b.toBuffer(), {}, /module is not an object or function/);
+ b.addImportedMemory('foo', 'bar');
+ assertTypeError(b.toBuffer(), {}, msg);
})();
(function TestLinkingError() {
+ print(arguments.callee.name);
let b;
+ let msg;
b = builder();
- b.addImport("foo", "bar", kSig_v_v);
- assertLinkError(
- b.toBuffer(), {foo: {}}, /function import requires a callable/);
+ msg = import_error(0, 'foo', 'bar', 'function import requires a callable');
+ b.addImport('foo', 'bar', kSig_v_v);
+ assertLinkError(b.toBuffer(), {foo: {}}, msg);
b = builder();
- b.addImport("foo", "bar", kSig_v_v);
- assertLinkError(
- b.toBuffer(), {foo: {bar: 9}}, /function import requires a callable/);
+ b.addImport('foo', 'bar', kSig_v_v);
+ assertLinkError(b.toBuffer(), {foo: {bar: 9}}, msg);
b = builder();
- b.addImportedGlobal("foo", "bar", kWasmI32);
- assertLinkError(b.toBuffer(), {foo: {}}, /global import must be a number/);
+ msg = import_error(
+ 0, 'foo', 'bar',
+ 'global import must be a number or WebAssembly.Global object');
+ b.addImportedGlobal('foo', 'bar', kWasmI32);
+ assertLinkError(b.toBuffer(), {foo: {}}, msg);
b = builder();
- b.addImportedGlobal("foo", "bar", kWasmI32);
- assertLinkError(
- b.toBuffer(), {foo: {bar: ""}}, /global import must be a number/);
+ b.addImportedGlobal('foo', 'bar', kWasmI32);
+ assertLinkError(b.toBuffer(), {foo: {bar: ''}}, msg);
b = builder();
- b.addImportedGlobal("foo", "bar", kWasmI32);
- assertLinkError(
- b.toBuffer(), {foo: {bar: () => 9}}, /global import must be a number/);
+ b.addImportedGlobal('foo', 'bar', kWasmI32);
+ assertLinkError(b.toBuffer(), {foo: {bar: () => 9}}, msg);
b = builder();
- b.addImportedMemory("foo", "bar");
- assertLinkError(
- b.toBuffer(), {foo: {}},
- /memory import must be a WebAssembly\.Memory object/);
+ msg = import_error(
+ 0, 'foo', 'bar', 'memory import must be a WebAssembly.Memory object');
+ b.addImportedMemory('foo', 'bar');
+ assertLinkError(b.toBuffer(), {foo: {}}, msg);
b = builder();
- b.addImportedMemory("foo", "bar", 1);
+ b.addImportedMemory('foo', 'bar', 1);
assertLinkError(
b.toBuffer(), {foo: {bar: () => new WebAssembly.Memory({initial: 0})}},
- /memory import must be a WebAssembly\.Memory object/);
+ msg);
+})();
- b = builder();
- b.addFunction("startup", kSig_v_v).addBody([
- kExprUnreachable,
- ]).end().addStart(0);
- assertRuntimeError(b.toBuffer(), {}, "unreachable");
+(function TestTrapUnreachable() {
+ print(arguments.callee.name);
+ let instance = builder().addFunction('run', kSig_v_v)
+ .addBody([kExprUnreachable]).exportFunc().end().instantiate();
+ assertTraps(kTrapUnreachable, instance.exports.run);
})();
-(function TestTrapError() {
- assertRuntimeError(builder().addFunction("run", kSig_v_v).addBody([
- kExprUnreachable
- ]).exportFunc().end().toBuffer(), {}, "unreachable");
-
- assertRuntimeError(builder().addFunction("run", kSig_v_v).addBody([
- kExprI32Const, 1,
- kExprI32Const, 0,
- kExprI32DivS,
- kExprDrop
- ]).exportFunc().end().toBuffer(), {}, "divide by zero");
-
- assertRuntimeError(builder().
- addFunction("run", kSig_v_v).addBody([]).exportFunc().end().
- addFunction("start", kSig_v_v).addBody([kExprUnreachable]).end().
- addStart(1).toBuffer(),
- {}, "unreachable");
+(function TestTrapDivByZero() {
+ print(arguments.callee.name);
+ let instance = builder().addFunction('run', kSig_v_v).addBody(
+ [kExprI32Const, 1, kExprI32Const, 0, kExprI32DivS, kExprDrop])
+ .exportFunc().end().instantiate();
+ assertTraps(kTrapDivByZero, instance.exports.run);
+})();
+
+(function TestUnreachableInStart() {
+ print(arguments.callee.name);
+
+ let b = builder().addFunction("start", kSig_v_v).addBody(
+ [kExprUnreachable]).end().addStart(0);
+ assertTraps(kTrapUnreachable, () => b.instantiate());
})();
(function TestConversionError() {
+ print(arguments.callee.name);
let b = builder();
b.addImport('foo', 'bar', kSig_v_l);
let buffer = b.addFunction('run', kSig_v_v)
@@ -181,6 +178,7 @@ function assertConversionError(bytes, imports, msg) {
(function InternalDebugTrace() {
+ print(arguments.callee.name);
var builder = new WasmModuleBuilder();
var sig = builder.addType(kSig_i_dd);
builder.addImport("mod", "func", sig);
diff --git a/deps/v8/test/mjsunit/wasm/exceptions-anyref.js b/deps/v8/test/mjsunit/wasm/exceptions-anyref.js
index 8d43610ff8..48e3c85127 100644
--- a/deps/v8/test/mjsunit/wasm/exceptions-anyref.js
+++ b/deps/v8/test/mjsunit/wasm/exceptions-anyref.js
@@ -4,7 +4,6 @@
// Flags: --experimental-wasm-eh --experimental-wasm-anyref --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
load("test/mjsunit/wasm/exceptions-utils.js");
diff --git a/deps/v8/test/mjsunit/wasm/exceptions-export.js b/deps/v8/test/mjsunit/wasm/exceptions-export.js
index 72ec02dec3..b698cce756 100644
--- a/deps/v8/test/mjsunit/wasm/exceptions-export.js
+++ b/deps/v8/test/mjsunit/wasm/exceptions-export.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --experimental-wasm-eh
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestExportSimple() {
@@ -44,7 +43,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
builder.addExportOfKind("ex_oob", kExternalException, except + 1);
assertThrows(
() => builder.instantiate(), WebAssembly.CompileError,
- /Wasm decoding failed: exception index 1 out of bounds/);
+ 'WebAssembly.Module(): exception index 1 out of bounds (1 entry) @+30');
})();
(function TestExportSameNameTwice() {
@@ -55,7 +54,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
builder.addExportOfKind("ex", kExternalException, except);
assertThrows(
() => builder.instantiate(), WebAssembly.CompileError,
- /Duplicate export name 'ex' for exception 0 and exception 0/);
+ 'WebAssembly.Module(): Duplicate export name \'ex\' ' +
+ 'for exception 0 and exception 0 @+28');
})();
(function TestExportModuleGetExports() {
diff --git a/deps/v8/test/mjsunit/wasm/exceptions-import.js b/deps/v8/test/mjsunit/wasm/exceptions-import.js
index b5276727ba..bf6d5ee6ab 100644
--- a/deps/v8/test/mjsunit/wasm/exceptions-import.js
+++ b/deps/v8/test/mjsunit/wasm/exceptions-import.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --experimental-wasm-eh
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Helper function to return a new exported exception with the {kSig_v_v} type
diff --git a/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js b/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js
index 43041ca9e2..3b3fa365d5 100644
--- a/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js
+++ b/deps/v8/test/mjsunit/wasm/exceptions-rethrow.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --experimental-wasm-eh --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
load("test/mjsunit/wasm/exceptions-utils.js");
diff --git a/deps/v8/test/mjsunit/wasm/exceptions-shared.js b/deps/v8/test/mjsunit/wasm/exceptions-shared.js
index adfbded0c7..48835901f9 100644
--- a/deps/v8/test/mjsunit/wasm/exceptions-shared.js
+++ b/deps/v8/test/mjsunit/wasm/exceptions-shared.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --experimental-wasm-eh
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Helper function to return a new exported exception with the {kSig_v_v} type
diff --git a/deps/v8/test/mjsunit/wasm/exceptions-simd.js b/deps/v8/test/mjsunit/wasm/exceptions-simd.js
index fc21156b18..ed16a7f2cc 100644
--- a/deps/v8/test/mjsunit/wasm/exceptions-simd.js
+++ b/deps/v8/test/mjsunit/wasm/exceptions-simd.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --experimental-wasm-eh --experimental-wasm-simd --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
load("test/mjsunit/wasm/exceptions-utils.js");
diff --git a/deps/v8/test/mjsunit/wasm/exceptions.js b/deps/v8/test/mjsunit/wasm/exceptions.js
index 6aafd0c087..d8a25c3503 100644
--- a/deps/v8/test/mjsunit/wasm/exceptions.js
+++ b/deps/v8/test/mjsunit/wasm/exceptions.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --experimental-wasm-eh --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
load("test/mjsunit/wasm/exceptions-utils.js");
diff --git a/deps/v8/test/mjsunit/wasm/export-global.js b/deps/v8/test/mjsunit/wasm/export-global.js
index 1bce050c2f..89ca5b5f83 100644
--- a/deps/v8/test/mjsunit/wasm/export-global.js
+++ b/deps/v8/test/mjsunit/wasm/export-global.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function duplicateGlobalExportName() {
diff --git a/deps/v8/test/mjsunit/wasm/export-mutable-global.js b/deps/v8/test/mjsunit/wasm/export-mutable-global.js
index 8e7d34a8b5..1ce918c6cc 100644
--- a/deps/v8/test/mjsunit/wasm/export-mutable-global.js
+++ b/deps/v8/test/mjsunit/wasm/export-mutable-global.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function exportImmutableGlobal() {
diff --git a/deps/v8/test/mjsunit/wasm/export-table.js b/deps/v8/test/mjsunit/wasm/export-table.js
index cb9d565a7e..3d523f251a 100644
--- a/deps/v8/test/mjsunit/wasm/export-table.js
+++ b/deps/v8/test/mjsunit/wasm/export-table.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function testExportedMain() {
diff --git a/deps/v8/test/mjsunit/wasm/ffi-error.js b/deps/v8/test/mjsunit/wasm/ffi-error.js
index 2b4cb9a4eb..5f777ef1cf 100644
--- a/deps/v8/test/mjsunit/wasm/ffi-error.js
+++ b/deps/v8/test/mjsunit/wasm/ffi-error.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
function CreateDefaultBuilder() {
@@ -31,15 +30,17 @@ function checkSuccessfulInstantiation(builder, ffi, handler) {
assertPromiseResult(builder.asyncInstantiate(ffi), handler);
}
-function checkFailingInstantiation(builder, ffi, error, message) {
+function checkFailingInstantiation(
+ builder, ffi, error, message, prepend_context = true) {
// Test synchronous instantiation.
- assertThrows(_ => builder.instantiate(ffi), error, message);
+ assertThrows(
+ _ => builder.instantiate(ffi), error,
+ (prepend_context ? 'WebAssembly.Instance(): ' : '') + message);
// Test asynchronous instantiation.
- assertPromiseResult(builder.asyncInstantiate(ffi), assertUnreachable, e => {
- assertInstanceof(e, error);
- assertEquals(message, e.message);
- });
+ assertThrowsAsync(
+ builder.asyncInstantiate(ffi), error,
+ (prepend_context ? 'WebAssembly.instantiate(): ' : '') + message);
}
(function testValidFFI() {
@@ -52,19 +53,19 @@ function checkFailingInstantiation(builder, ffi, error, message) {
print(arguments.callee.name);
checkFailingInstantiation(
CreateDefaultBuilder(), 17, TypeError,
- 'WebAssembly Instantiation: Argument 1 must be an object');
+ 'Argument 1 must be an object');
checkFailingInstantiation(
CreateDefaultBuilder(), {}, TypeError,
- 'WebAssembly Instantiation: Import #0 module="mod" error: module is not an object or function');
+ 'Import #0 module="mod" error: module is not an object or function');
checkFailingInstantiation(
CreateDefaultBuilder(), {mod: {}}, WebAssembly.LinkError,
- 'WebAssembly Instantiation: Import #0 module="mod" function="fun" error: function import requires a callable');
+ 'Import #0 module="mod" function="fun" error: function import requires a callable');
checkFailingInstantiation(
CreateDefaultBuilder(), {mod: {fun: {}}}, WebAssembly.LinkError,
- 'WebAssembly Instantiation: Import #0 module="mod" function="fun" error: function import requires a callable');
+ 'Import #0 module="mod" function="fun" error: function import requires a callable');
checkFailingInstantiation(
CreateDefaultBuilder(), {mod: {fun: 0}}, WebAssembly.LinkError,
- 'WebAssembly Instantiation: Import #0 module="mod" function="fun" error: function import requires a callable');
+ 'Import #0 module="mod" function="fun" error: function import requires a callable');
})();
(function testImportWithInvalidSignature() {
@@ -83,7 +84,7 @@ function checkFailingInstantiation(builder, ffi, error, message) {
let exported = builder.instantiate().exports.exp;
checkFailingInstantiation(
CreateDefaultBuilder(), {mod: {fun: exported}}, WebAssembly.LinkError,
- 'WebAssembly Instantiation: Import #0 module="mod" function="fun" error: imported function does not match the expected type');
+ 'Import #0 module="mod" function="fun" error: imported function does not match the expected type');
})();
(function regression870646() {
@@ -95,7 +96,8 @@ function checkFailingInstantiation(builder, ffi, error, message) {
}
});
- checkFailingInstantiation(CreateDefaultBuilder(), ffi, Error, 'my_exception');
+ checkFailingInstantiation(
+ CreateDefaultBuilder(), ffi, Error, 'my_exception', false);
})();
// "fun" matches signature "i_dd"
diff --git a/deps/v8/test/mjsunit/wasm/ffi.js b/deps/v8/test/mjsunit/wasm/ffi.js
index ce96184766..72cc57f598 100644
--- a/deps/v8/test/mjsunit/wasm/ffi.js
+++ b/deps/v8/test/mjsunit/wasm/ffi.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function testCallFFI(func, check) {
diff --git a/deps/v8/test/mjsunit/wasm/float-constant-folding.js b/deps/v8/test/mjsunit/wasm/float-constant-folding.js
index b08aee3d0e..6205da7cfc 100644
--- a/deps/v8/test/mjsunit/wasm/float-constant-folding.js
+++ b/deps/v8/test/mjsunit/wasm/float-constant-folding.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function() {
diff --git a/deps/v8/test/mjsunit/wasm/function-names.js b/deps/v8/test/mjsunit/wasm/function-names.js
index fe7c401177..4bb8e31998 100644
--- a/deps/v8/test/mjsunit/wasm/function-names.js
+++ b/deps/v8/test/mjsunit/wasm/function-names.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var builder = new WasmModuleBuilder();
diff --git a/deps/v8/test/mjsunit/wasm/function-prototype.js b/deps/v8/test/mjsunit/wasm/function-prototype.js
index c2f1edd5c4..f3a99716a0 100644
--- a/deps/v8/test/mjsunit/wasm/function-prototype.js
+++ b/deps/v8/test/mjsunit/wasm/function-prototype.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestFunctionPrototype() {
diff --git a/deps/v8/test/mjsunit/wasm/futex.js b/deps/v8/test/mjsunit/wasm/futex.js
index 1ebb3f65ce..640334bbc6 100644
--- a/deps/v8/test/mjsunit/wasm/futex.js
+++ b/deps/v8/test/mjsunit/wasm/futex.js
@@ -7,7 +7,6 @@
'use strict';
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function WasmAtomicWake(memory, offset, index, num) {
@@ -114,6 +113,42 @@ function WasmI64AtomicWait(memory, offset, index, val_low,
});
})();
+(function TestInvalidAlignment() {
+ let memory = new WebAssembly.Memory({initial: 1, maximum: 1, shared: true});
+
+ // Wait and wake must be 4 byte aligned.
+ [1, 2, 3].forEach(function(invalid) {
+ assertThrows(function() {
+ WasmAtomicWake(memory, invalid, 0, -1)
+ }, Error);
+ assertThrows(function() {
+ WasmAtomicWake(memory, 0, invalid, -1)
+ }, Error);
+ assertThrows(function() {
+ WasmI32AtomicWait(memory, invalid, 0, 0, -1)
+ }, Error);
+ assertThrows(function() {
+ WasmI32AtomicWait(memory, 0, invalid, 0, -1)
+ }, Error);
+ assertThrows(function() {
+ WasmI64AtomicWait(memory, invalid, 0, 0, 0, -1)
+ }, Error);
+ assertThrows(function() {
+ WasmI64AtomicWait(memory, 0, invalid, 0, 0, -1)
+ }, Error);
+ });
+
+ //WasmI64AtomicWait must be 8 byte aligned.
+ [4, 5, 6, 7].forEach(function(invalid) {
+ assertThrows(function() {
+ WasmI64AtomicWait(memory, 0, invalid, 0, 0, -1)
+ }, Error);
+ assertThrows(function() {
+ WasmI64AtomicWait(memory, invalid, 0, 0, 0, -1)
+ }, Error);
+ });
+})();
+
(function TestI32WaitTimeout() {
let memory = new WebAssembly.Memory({initial: 1, maximum: 1, shared: true});
var waitMs = 100;
@@ -181,7 +216,6 @@ if (this.Worker) {
const numWorkers = 4;
let workerScript = `onmessage = function(msg) {
- load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
${WasmI32AtomicWait.toString()}
${WasmI64AtomicWait.toString()}
diff --git a/deps/v8/test/mjsunit/wasm/gc-buffer.js b/deps/v8/test/mjsunit/wasm/gc-buffer.js
index 42cf6ae5ff..d8aa9a86d8 100644
--- a/deps/v8/test/mjsunit/wasm/gc-buffer.js
+++ b/deps/v8/test/mjsunit/wasm/gc-buffer.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --gc-interval=500 --stress-compaction --expose-gc
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function run(f) {
diff --git a/deps/v8/test/mjsunit/wasm/gc-frame.js b/deps/v8/test/mjsunit/wasm/gc-frame.js
index c5ff0ff53e..de8bdab51e 100644
--- a/deps/v8/test/mjsunit/wasm/gc-frame.js
+++ b/deps/v8/test/mjsunit/wasm/gc-frame.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --expose-gc
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function makeFFI(func, t) {
diff --git a/deps/v8/test/mjsunit/wasm/gc-stress.js b/deps/v8/test/mjsunit/wasm/gc-stress.js
index db425ea81d..8daff420da 100644
--- a/deps/v8/test/mjsunit/wasm/gc-stress.js
+++ b/deps/v8/test/mjsunit/wasm/gc-stress.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --gc-interval=500 --stress-compaction
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function run(f) {
diff --git a/deps/v8/test/mjsunit/wasm/globals.js b/deps/v8/test/mjsunit/wasm/globals.js
index 7b2ffee7ef..b29993a8fc 100644
--- a/deps/v8/test/mjsunit/wasm/globals.js
+++ b/deps/v8/test/mjsunit/wasm/globals.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestMultipleInstances() {
diff --git a/deps/v8/test/mjsunit/wasm/graceful_shutdown.js b/deps/v8/test/mjsunit/wasm/graceful_shutdown.js
index 1bc90fd417..aa50e6cf77 100644
--- a/deps/v8/test/mjsunit/wasm/graceful_shutdown.js
+++ b/deps/v8/test/mjsunit/wasm/graceful_shutdown.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --no-wait-for-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function CompileFunctionsTest() {
diff --git a/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js b/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js
index c40bf2f11d..17c6803784 100644
--- a/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js
+++ b/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js
@@ -4,7 +4,6 @@
// Flags: --no-wait-for-wasm --wasm-tier-up
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function ShutdownDuringTierUp() {
diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js b/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js
index 3581f47202..9ab2334a63 100644
--- a/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js
+++ b/deps/v8/test/mjsunit/wasm/grow-memory-detaching.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
let module = (() => {
diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js b/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js
index c73f0762ec..93bb56d83d 100644
--- a/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js
+++ b/deps/v8/test/mjsunit/wasm/grow-memory-in-branch.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --stress-compaction
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var initialMemoryPages = 1;
diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js b/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js
index a87e123501..1790f9760f 100644
--- a/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js
+++ b/deps/v8/test/mjsunit/wasm/grow-memory-in-call.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --stress-compaction
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var initialMemoryPages = 1;
diff --git a/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js b/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js
index 908f966017..ed04e23c63 100644
--- a/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js
+++ b/deps/v8/test/mjsunit/wasm/grow-memory-in-loop.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --stress-compaction
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let initialPages = 1;
diff --git a/deps/v8/test/mjsunit/wasm/grow-memory.js b/deps/v8/test/mjsunit/wasm/grow-memory.js
index 3ecdb9aa1e..0e5618a2b1 100644
--- a/deps/v8/test/mjsunit/wasm/grow-memory.js
+++ b/deps/v8/test/mjsunit/wasm/grow-memory.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --stress-compaction
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
diff --git a/deps/v8/test/mjsunit/wasm/huge-memory.js b/deps/v8/test/mjsunit/wasm/huge-memory.js
index 188805bb5f..bf037b0c92 100644
--- a/deps/v8/test/mjsunit/wasm/huge-memory.js
+++ b/deps/v8/test/mjsunit/wasm/huge-memory.js
@@ -5,7 +5,6 @@
// Flags: --wasm-max-mem-pages=49152
// This test makes sure things don't break once we support >2GB wasm memories.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function testHugeMemory() {
diff --git a/deps/v8/test/mjsunit/wasm/import-function.js b/deps/v8/test/mjsunit/wasm/import-function.js
index 9ed234b768..ec187aff4a 100644
--- a/deps/v8/test/mjsunit/wasm/import-function.js
+++ b/deps/v8/test/mjsunit/wasm/import-function.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function testCallImport(func, check) {
diff --git a/deps/v8/test/mjsunit/wasm/import-memory.js b/deps/v8/test/mjsunit/wasm/import-memory.js
index f099af56b4..fc688dc7ce 100644
--- a/deps/v8/test/mjsunit/wasm/import-memory.js
+++ b/deps/v8/test/mjsunit/wasm/import-memory.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// V8 internal memory size limit.
diff --git a/deps/v8/test/mjsunit/wasm/import-mutable-global.js b/deps/v8/test/mjsunit/wasm/import-mutable-global.js
index a1133ee3f7..715549a41f 100644
--- a/deps/v8/test/mjsunit/wasm/import-mutable-global.js
+++ b/deps/v8/test/mjsunit/wasm/import-mutable-global.js
@@ -4,7 +4,6 @@
// Flags: --expose-gc
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestBasic() {
diff --git a/deps/v8/test/mjsunit/wasm/import-table.js b/deps/v8/test/mjsunit/wasm/import-table.js
index 881f0b3b2c..b5a756aa4b 100644
--- a/deps/v8/test/mjsunit/wasm/import-table.js
+++ b/deps/v8/test/mjsunit/wasm/import-table.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function addConstFunc(builder, val) {
diff --git a/deps/v8/test/mjsunit/wasm/indirect-calls.js b/deps/v8/test/mjsunit/wasm/indirect-calls.js
index 5abb346879..067d6884d7 100644
--- a/deps/v8/test/mjsunit/wasm/indirect-calls.js
+++ b/deps/v8/test/mjsunit/wasm/indirect-calls.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function Test1() {
diff --git a/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js b/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js
index 5e6e7169a1..9e8ddac1c5 100644
--- a/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js
+++ b/deps/v8/test/mjsunit/wasm/indirect-sig-mismatch.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const kTableSize = 3;
diff --git a/deps/v8/test/mjsunit/wasm/indirect-tables.js b/deps/v8/test/mjsunit/wasm/indirect-tables.js
index 642bd953bf..c4edd71f14 100644
--- a/deps/v8/test/mjsunit/wasm/indirect-tables.js
+++ b/deps/v8/test/mjsunit/wasm/indirect-tables.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --expose-gc
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function AddFunctions(builder) {
diff --git a/deps/v8/test/mjsunit/wasm/instance-gc.js b/deps/v8/test/mjsunit/wasm/instance-gc.js
index e5dd4edaf9..aed9589e51 100644
--- a/deps/v8/test/mjsunit/wasm/instance-gc.js
+++ b/deps/v8/test/mjsunit/wasm/instance-gc.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --expose-gc
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
let nogc = () => {};
diff --git a/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js b/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js
index dc1ca24a85..29b65bc9b8 100644
--- a/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js
+++ b/deps/v8/test/mjsunit/wasm/instance-memory-gc-stress.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --expose-gc
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// This test verifies that when instances are exported, Gc'ed, the other
diff --git a/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js b/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js
index d2489f3e89..1c5f10a832 100644
--- a/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js
+++ b/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --allow-natives-syntax
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let kReturnValue = 17;
@@ -97,11 +96,8 @@ assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88)));
print('InvalidBinaryAsyncCompilation...');
let builder = new WasmModuleBuilder();
builder.addFunction('f', kSig_i_i).addBody([kExprCallFunction, 0]);
- let promise = WebAssembly.compile(builder.toBuffer());
- assertPromiseResult(
- promise, compiled => assertUnreachable(
- 'should not be able to compile invalid blob.'),
- e => assertInstanceof(e, WebAssembly.CompileError));
+ assertThrowsAsync(
+ WebAssembly.compile(builder.toBuffer()), WebAssembly.CompileError);
})();
// Multiple instances tests.
diff --git a/deps/v8/test/mjsunit/wasm/instantiate-run-basic.js b/deps/v8/test/mjsunit/wasm/instantiate-run-basic.js
index b0016ec9aa..ead01df352 100644
--- a/deps/v8/test/mjsunit/wasm/instantiate-run-basic.js
+++ b/deps/v8/test/mjsunit/wasm/instantiate-run-basic.js
@@ -4,7 +4,6 @@
// Flags: --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const kReturnValue = 15;
diff --git a/deps/v8/test/mjsunit/wasm/interpreter-mixed.js b/deps/v8/test/mjsunit/wasm/interpreter-mixed.js
index 4a84e13414..b5665d1654 100644
--- a/deps/v8/test/mjsunit/wasm/interpreter-mixed.js
+++ b/deps/v8/test/mjsunit/wasm/interpreter-mixed.js
@@ -4,7 +4,6 @@
// Flags: --allow-natives-syntax
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// =============================================================================
diff --git a/deps/v8/test/mjsunit/wasm/interpreter.js b/deps/v8/test/mjsunit/wasm/interpreter.js
index d9a1751408..c11e593115 100644
--- a/deps/v8/test/mjsunit/wasm/interpreter.js
+++ b/deps/v8/test/mjsunit/wasm/interpreter.js
@@ -4,7 +4,6 @@
// Flags: --wasm-interpret-all --allow-natives-syntax --expose-gc
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
// The stack trace contains file path, only keep "interpreter.js".
diff --git a/deps/v8/test/mjsunit/wasm/js-api.js b/deps/v8/test/mjsunit/wasm/js-api.js
index 5054fd73be..efc0150992 100644
--- a/deps/v8/test/mjsunit/wasm/js-api.js
+++ b/deps/v8/test/mjsunit/wasm/js-api.js
@@ -2,19 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --expose-wasm --allow-natives-syntax
+// Flags: --expose-wasm
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
-function unexpectedSuccess() {
- %AbortJS('unexpected success');
-}
-
-function unexpectedFail(error) {
- %AbortJS('unexpected fail: ' + error);
-}
-
function assertEq(val, expected) {
assertSame(expected, val);
}
@@ -26,13 +17,6 @@ function assertArrayBuffer(val, expected) {
assertEq(expected[i], input[i]);
}
}
-function wasmIsSupported() {
- return (typeof WebAssembly.Module) == 'function';
-}
-function assertErrorMessage(func, type, msg) {
- // TODO assertThrows(func, type, msg);
- assertThrows(func, type);
-}
let emptyModuleBinary = (() => {
var builder = new WasmModuleBuilder();
@@ -147,25 +131,25 @@ let Module = WebAssembly.Module;
assertEq(Module, moduleDesc.value);
assertEq(Module.length, 1);
assertEq(Module.name, 'Module');
-assertErrorMessage(
- () => Module(), TypeError, /constructor without new is forbidden/);
-assertErrorMessage(
- () => new Module(), TypeError, /requires more than 0 arguments/);
-assertErrorMessage(
+assertThrows(
+ () => Module(), TypeError, /must be invoked with 'new'/);
+assertThrows(
+ () => new Module(), TypeError, /Argument 0 must be a buffer source/);
+assertThrows(
() => new Module(undefined), TypeError,
- 'first argument must be an ArrayBuffer or typed array object');
-assertErrorMessage(
+ 'WebAssembly.Module(): Argument 0 must be a buffer source');
+assertThrows(
() => new Module(1), TypeError,
- 'first argument must be an ArrayBuffer or typed array object');
-assertErrorMessage(
+ 'WebAssembly.Module(): Argument 0 must be a buffer source');
+assertThrows(
() => new Module({}), TypeError,
- 'first argument must be an ArrayBuffer or typed array object');
-assertErrorMessage(
+ 'WebAssembly.Module(): Argument 0 must be a buffer source');
+assertThrows(
() => new Module(new Uint8Array()), CompileError,
- /failed to match magic number/);
-assertErrorMessage(
+ /BufferSource argument is empty/);
+assertThrows(
() => new Module(new ArrayBuffer()), CompileError,
- /failed to match magic number/);
+ /BufferSource argument is empty/);
assertTrue(new Module(emptyModuleBinary) instanceof Module);
assertTrue(new Module(emptyModuleBinary.buffer) instanceof Module);
@@ -200,14 +184,14 @@ assertTrue(moduleImportsDesc.configurable);
// 'WebAssembly.Module.imports' method
let moduleImports = moduleImportsDesc.value;
assertEq(moduleImports.length, 1);
-assertErrorMessage(
- () => moduleImports(), TypeError, /requires more than 0 arguments/);
-assertErrorMessage(
+assertThrows(
+ () => moduleImports(), TypeError, /Argument 0 must be a WebAssembly.Module/);
+assertThrows(
() => moduleImports(undefined), TypeError,
- /first argument must be a WebAssembly.Module/);
-assertErrorMessage(
+ /Argument 0 must be a WebAssembly.Module/);
+assertThrows(
() => moduleImports({}), TypeError,
- /first argument must be a WebAssembly.Module/);
+ /Argument 0 must be a WebAssembly.Module/);
var arr = moduleImports(new Module(emptyModuleBinary));
assertTrue(arr instanceof Array);
assertEq(arr.length, 0);
@@ -247,14 +231,14 @@ assertTrue(moduleExportsDesc.configurable);
// 'WebAssembly.Module.exports' method
let moduleExports = moduleExportsDesc.value;
assertEq(moduleExports.length, 1);
-assertErrorMessage(
- () => moduleExports(), TypeError, /requires more than 0 arguments/);
-assertErrorMessage(
+assertThrows(
+ () => moduleExports(), TypeError, /Argument 0 must be a WebAssembly.Module/);
+assertThrows(
() => moduleExports(undefined), TypeError,
- /first argument must be a WebAssembly.Module/);
-assertErrorMessage(
+ /Argument 0 must be a WebAssembly.Module/);
+assertThrows(
() => moduleExports({}), TypeError,
- /first argument must be a WebAssembly.Module/);
+ /Argument 0 must be a WebAssembly.Module/);
var arr = moduleExports(emptyModule);
assertTrue(arr instanceof Array);
assertEq(arr.length, 0);
@@ -292,21 +276,21 @@ assertTrue(moduleCustomSectionsDesc.configurable);
let moduleCustomSections = moduleCustomSectionsDesc.value;
assertEq(moduleCustomSections.length, 2);
-assertErrorMessage(
- () => moduleCustomSections(), TypeError, /requires more than 0 arguments/);
-assertErrorMessage(
+assertThrows(
+ () => moduleCustomSections(), TypeError, /Argument 0 must be a WebAssembly.Module/);
+assertThrows(
() => moduleCustomSections(undefined), TypeError,
- /first argument must be a WebAssembly.Module/);
-assertErrorMessage(
+ /Argument 0 must be a WebAssembly.Module/);
+assertThrows(
() => moduleCustomSections({}), TypeError,
- /first argument must be a WebAssembly.Module/);
+ /Argument 0 must be a WebAssembly.Module/);
var arr = moduleCustomSections(emptyModule, 'x');
assertEq(arr instanceof Array, true);
assertEq(arr.length, 0);
-assertErrorMessage(
+assertThrows(
() => moduleCustomSections(1), TypeError,
- 'first argument must be a WebAssembly.Module');
+ 'WebAssembly.Module.customSections(): Argument 0 must be a WebAssembly.Module');
let customSectionModuleBinary2 = (() => {
let builder = new WasmModuleBuilder();
@@ -351,24 +335,24 @@ assertEq(Instance, instanceDesc.value);
assertEq(Instance.length, 1);
assertEq(Instance.name, 'Instance');
-assertErrorMessage(
- () => Instance(), TypeError, /constructor without new is forbidden/);
-assertErrorMessage(
+assertThrows(
+ () => Instance(), TypeError, /must be invoked with 'new'/);
+assertThrows(
() => new Instance(1), TypeError,
- 'first argument must be a WebAssembly.Module');
-assertErrorMessage(
+ 'WebAssembly.Instance(): Argument 0 must be a WebAssembly.Module');
+assertThrows(
() => new Instance({}), TypeError,
- 'first argument must be a WebAssembly.Module');
-assertErrorMessage(
+ 'WebAssembly.Instance(): Argument 0 must be a WebAssembly.Module');
+assertThrows(
() => new Instance(emptyModule, null), TypeError,
- 'second argument must be an object');
-assertErrorMessage(() => new Instance(importingModule, null), TypeError, '');
-assertErrorMessage(
- () => new Instance(importingModule, undefined), TypeError, '');
-assertErrorMessage(
- () => new Instance(importingModule, {'': {g: () => {}}}), LinkError, '');
-assertErrorMessage(
- () => new Instance(importingModule, {t: {f: () => {}}}), TypeError, '');
+ 'WebAssembly.Instance(): Argument 1 must be an object');
+assertThrows(() => new Instance(importingModule, null), TypeError);
+assertThrows(
+ () => new Instance(importingModule, undefined), TypeError);
+assertThrows(
+ () => new Instance(importingModule, {'': {g: () => {}}}), LinkError);
+assertThrows(
+ () => new Instance(importingModule, {t: {f: () => {}}}), TypeError);
assertTrue(new Instance(emptyModule) instanceof Instance);
assertTrue(new Instance(emptyModule, {}) instanceof Instance);
@@ -412,7 +396,7 @@ assertTrue(f instanceof Function);
assertEq(f.length, 0);
assertTrue('name' in f);
assertEq(Function.prototype.call.call(f), 42);
-assertErrorMessage(() => new f(), TypeError, /is not a constructor/);
+assertThrows(() => new f(), TypeError, /is not a constructor/);
// 'WebAssembly.Memory' data property
let memoryDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Memory');
@@ -426,27 +410,27 @@ let Memory = WebAssembly.Memory;
assertEq(Memory, memoryDesc.value);
assertEq(Memory.length, 1);
assertEq(Memory.name, 'Memory');
-assertErrorMessage(
- () => Memory(), TypeError, /constructor without new is forbidden/);
-assertErrorMessage(
+assertThrows(
+ () => Memory(), TypeError, /must be invoked with 'new'/);
+assertThrows(
() => new Memory(1), TypeError,
- 'first argument must be a memory descriptor');
-assertErrorMessage(
+ 'WebAssembly.Memory(): Argument 0 must be a memory descriptor');
+assertThrows(
() => new Memory({initial: {valueOf() { throw new Error('here') }}}), Error,
'here');
-assertErrorMessage(
- () => new Memory({initial: -1}), TypeError, /bad Memory initial size/);
-assertErrorMessage(
+assertThrows(
+ () => new Memory({initial: -1}), TypeError, /must be non-negative/);
+assertThrows(
() => new Memory({initial: Math.pow(2, 32)}), TypeError,
- /bad Memory initial size/);
-assertErrorMessage(
+ /must be in the unsigned long range/);
+assertThrows(
() => new Memory({initial: 1, maximum: Math.pow(2, 32) / Math.pow(2, 14)}),
- RangeError, /bad Memory maximum size/);
-assertErrorMessage(
+ RangeError, /is above the upper bound/);
+assertThrows(
() => new Memory({initial: 2, maximum: 1}), RangeError,
- /bad Memory maximum size/);
-assertErrorMessage(
- () => new Memory({maximum: -1}), TypeError, /bad Memory maximum size/);
+ /is below the lower bound/);
+assertThrows(
+ () => new Memory({maximum: -1}), TypeError, /'initial' is required/);
assertTrue(new Memory({initial: 1}) instanceof Memory);
assertEq(new Memory({initial: 1.5}).buffer.byteLength, kPageSize);
@@ -478,10 +462,10 @@ assertTrue(bufferDesc.configurable);
// 'WebAssembly.Memory.prototype.buffer' getter
let bufferGetter = bufferDesc.get;
-assertErrorMessage(
- () => bufferGetter.call(), TypeError, /called on incompatible undefined/);
-assertErrorMessage(
- () => bufferGetter.call({}), TypeError, /called on incompatible Object/);
+assertThrows(
+ () => bufferGetter.call(), TypeError, /Receiver is not a WebAssembly.Memory/);
+assertThrows(
+ () => bufferGetter.call({}), TypeError, /Receiver is not a WebAssembly.Memory/);
assertTrue(bufferGetter.call(mem1) instanceof ArrayBuffer);
assertEq(bufferGetter.call(mem1).byteLength, kPageSize);
@@ -495,13 +479,13 @@ assertTrue(memGrowDesc.configurable);
let memGrow = memGrowDesc.value;
assertEq(memGrow.length, 1);
-assertErrorMessage(
- () => memGrow.call(), TypeError, /called on incompatible undefined/);
-assertErrorMessage(
- () => memGrow.call({}), TypeError, /called on incompatible Object/);
-assertErrorMessage(
+assertThrows(
+ () => memGrow.call(), TypeError, /Receiver is not a WebAssembly.Memory/);
+assertThrows(
+ () => memGrow.call({}), TypeError, /Receiver is not a WebAssembly.Memory/);
+assertThrows(
() => memGrow.call(mem1, -1), TypeError, /must be non-negative/);
-assertErrorMessage(
+assertThrows(
() => memGrow.call(mem1, Math.pow(2, 32)), TypeError,
/must be in the unsigned long range/);
var mem = new Memory({initial: 1, maximum: 2});
@@ -522,16 +506,16 @@ assertTrue(buf !== mem.buffer);
assertEq(buf.byteLength, 0);
buf = mem.buffer;
assertEq(buf.byteLength, 2 * kPageSize);
-assertErrorMessage(() => mem.grow(1), Error, /failed to grow memory/);
-assertErrorMessage(() => mem.grow(Infinity), Error, /failed to grow memory/);
-assertErrorMessage(() => mem.grow(-Infinity), Error, /failed to grow memory/);
+assertThrows(() => mem.grow(1), Error, /Maximum memory size exceeded/);
+assertThrows(() => mem.grow(Infinity), Error, /must be convertible to a valid number/);
+assertThrows(() => mem.grow(-Infinity), Error, /must be convertible to a valid number/);
assertEq(buf, mem.buffer);
let throwOnValueOf = {
valueOf: function() {
throw Error('throwOnValueOf')
}
};
-assertErrorMessage(() => mem.grow(throwOnValueOf), Error, /throwOnValueOf/);
+assertThrows(() => mem.grow(throwOnValueOf), Error, /throwOnValueOf/);
assertEq(buf, mem.buffer);
let zero_wrapper = {
valueOf: function() {
@@ -566,41 +550,41 @@ let Table = WebAssembly.Table;
assertEq(Table, tableDesc.value);
assertEq(Table.length, 1);
assertEq(Table.name, 'Table');
-assertErrorMessage(
- () => Table(), TypeError, /constructor without new is forbidden/);
-assertErrorMessage(
- () => new Table(1), TypeError, 'first argument must be a table descriptor');
-assertErrorMessage(
- () => new Table({initial: 1, element: 1}), TypeError, /must be "anyfunc"/);
-assertErrorMessage(
+assertThrows(
+ () => Table(), TypeError, /must be invoked with 'new'/);
+assertThrows(
+ () => new Table(1), TypeError, 'WebAssembly.Module(): Argument 0 must be a table descriptor');
+assertThrows(
+ () => new Table({initial: 1, element: 1}), TypeError, /must be 'anyfunc'/);
+assertThrows(
() => new Table({initial: 1, element: 'any'}), TypeError,
- /must be "anyfunc"/);
-assertErrorMessage(
+ /must be 'anyfunc'/);
+assertThrows(
() => new Table({initial: 1, element: {valueOf() { return 'anyfunc' }}}),
- TypeError, /must be "anyfunc"/);
-assertErrorMessage(
+ TypeError, /must be 'anyfunc'/);
+assertThrows(
() => new Table(
{initial: {valueOf() { throw new Error('here') }}, element: 'anyfunc'}),
Error, 'here');
-assertErrorMessage(
+assertThrows(
() => new Table({initial: -1, element: 'anyfunc'}), TypeError,
- /bad Table initial size/);
-assertErrorMessage(
+ /must be non-negative/);
+assertThrows(
() => new Table({initial: Math.pow(2, 32), element: 'anyfunc'}), TypeError,
- /bad Table initial size/);
-assertErrorMessage(
+ /must be in the unsigned long range/);
+assertThrows(
() => new Table({initial: 2, maximum: 1, element: 'anyfunc'}), RangeError,
- /bad Table maximum size/);
-assertErrorMessage(
+ /is below the lower bound/);
+assertThrows(
() => new Table({initial: 2, maximum: Math.pow(2, 32), element: 'anyfunc'}),
- TypeError, /bad Table maximum size/);
+ TypeError, /must be in the unsigned long range/);
assertTrue(new Table({initial: 1, element: 'anyfunc'}) instanceof Table);
assertTrue(new Table({initial: 1.5, element: 'anyfunc'}) instanceof Table);
assertTrue(
new Table({initial: 1, maximum: 1.5, element: 'anyfunc'}) instanceof Table);
-assertTrue(
- new Table({initial: 1, maximum: Math.pow(2, 32) - 1, element: 'anyfunc'})
- instanceof Table);
+assertThrows(
+ () => new Table({initial: 1, maximum: Math.pow(2, 32) - 1, element: 'anyfunc'}),
+ RangeError, /above the upper bound/);
// 'WebAssembly.Table.prototype' data property
let tableProtoDesc = Object.getOwnPropertyDescriptor(Table, 'prototype');
@@ -631,10 +615,10 @@ assertTrue(lengthDesc.configurable);
// 'WebAssembly.Table.prototype.length' getter
let lengthGetter = lengthDesc.get;
assertEq(lengthGetter.length, 0);
-assertErrorMessage(
- () => lengthGetter.call(), TypeError, /called on incompatible undefined/);
-assertErrorMessage(
- () => lengthGetter.call({}), TypeError, /called on incompatible Object/);
+assertThrows(
+ () => lengthGetter.call(), TypeError, /Receiver is not a WebAssembly.Table/);
+assertThrows(
+ () => lengthGetter.call({}), TypeError, /Receiver is not a WebAssembly.Table/);
assertEq(typeof lengthGetter.call(tbl1), 'number');
assertEq(lengthGetter.call(tbl1), 2);
@@ -647,23 +631,24 @@ assertTrue(getDesc.configurable);
// 'WebAssembly.Table.prototype.get' method
let get = getDesc.value;
assertEq(get.length, 1);
-assertErrorMessage(
- () => get.call(), TypeError, /called on incompatible undefined/);
-assertErrorMessage(
- () => get.call({}), TypeError, /called on incompatible Object/);
-assertErrorMessage(
+assertThrows(
+ () => get.call(), TypeError, /Receiver is not a WebAssembly.Table/);
+assertThrows(
+ () => get.call({}), TypeError, /Receiver is not a WebAssembly.Table/);
+assertThrows(
() => get.call(tbl1), TypeError, /must be convertible to a valid number/);
assertEq(get.call(tbl1, 0), null);
assertEq(get.call(tbl1, 0, Infinity), null);
assertEq(get.call(tbl1, 1), null);
assertEq(get.call(tbl1, 1.5), null);
-assertErrorMessage(() => get.call(tbl1, 2), RangeError, /bad Table get index/);
-assertErrorMessage(
- () => get.call(tbl1, 2.5), RangeError, /bad Table get index/);
-assertErrorMessage(() => get.call(tbl1, -1), TypeError, /bad Table get index/);
-assertErrorMessage(
- () => get.call(tbl1, Math.pow(2, 33)), TypeError, /bad Table get index/);
-assertErrorMessage(
+assertThrows(() => get.call(tbl1, 2), RangeError, /Index out of bounds/);
+assertThrows(
+ () => get.call(tbl1, 2.5), RangeError, /Index out of bounds/);
+assertThrows(() => get.call(tbl1, -1), TypeError, /must be non-negative/);
+assertThrows(
+ () => get.call(tbl1, Math.pow(2, 33)), TypeError,
+ /must be in the unsigned long range/);
+assertThrows(
() => get.call(tbl1, {valueOf() { throw new Error('hi') }}), Error, 'hi');
// 'WebAssembly.Table.prototype.set' data property
@@ -675,46 +660,48 @@ assertTrue(setDesc.configurable);
// 'WebAssembly.Table.prototype.set' method
let set = setDesc.value;
assertEq(set.length, 2);
-assertErrorMessage(
- () => set.call(), TypeError, /called on incompatible undefined/);
-assertErrorMessage(
- () => set.call({}), TypeError, /called on incompatible Object/);
-assertErrorMessage(
- () => set.call(tbl1, 0), TypeError, /requires more than 1 argument/);
-assertErrorMessage(
+assertThrows(
+ () => set.call(), TypeError, /Receiver is not a WebAssembly.Table/);
+assertThrows(
+ () => set.call({}), TypeError, /Receiver is not a WebAssembly.Table/);
+assertThrows(
+ () => set.call(tbl1, 0), TypeError, /must be null or a WebAssembly function/);
+assertThrows(
() => set.call(tbl1, undefined), TypeError,
- /requires more than 1 argument/);
-assertErrorMessage(
- () => set.call(tbl1, 2, null), RangeError, /bad Table set index/);
-assertErrorMessage(
- () => set.call(tbl1, -1, null), TypeError, /bad Table set index/);
-assertErrorMessage(
+ /must be convertible to a valid number/);
+assertThrows(
+ () => set.call(tbl1, 2, null), RangeError, /index out of bounds/);
+assertThrows(
+ () => set.call(tbl1, -1, null), TypeError, /must be non-negative/);
+assertThrows(
() => set.call(tbl1, Math.pow(2, 33), null), TypeError,
- /bad Table set index/);
-assertErrorMessage(
- () => set.call(tbl1, Infinity, null), TypeError, /bad Table set index/);
-assertErrorMessage(
- () => set.call(tbl1, -Infinity, null), TypeError, /bad Table set index/);
-assertErrorMessage(
+ /must be in the unsigned long range/);
+assertThrows(
+ () => set.call(tbl1, Infinity, null), TypeError,
+ /must be convertible to a valid number/);
+assertThrows(
+ () => set.call(tbl1, -Infinity, null), TypeError,
+ /must be convertible to a valid number/);
+assertThrows(
() => set.call(tbl1, 0, undefined), TypeError,
- /can only assign WebAssembly exported functions to Table/);
-assertErrorMessage(
+ /must be null or a WebAssembly function/);
+assertThrows(
() => set.call(tbl1, undefined, undefined), TypeError,
- /can only assign WebAssembly exported functions to Table/);
-assertErrorMessage(
+ /must be convertible to a valid number/);
+assertThrows(
() => set.call(tbl1, 0, {}), TypeError,
- /can only assign WebAssembly exported functions to Table/);
-assertErrorMessage(() => set.call(tbl1, 0, function() {
-}), TypeError, /can only assign WebAssembly exported functions to Table/);
-assertErrorMessage(
+ /must be null or a WebAssembly function/);
+assertThrows(() => set.call(tbl1, 0, function() {
+}), TypeError, /must be null or a WebAssembly function/);
+assertThrows(
() => set.call(tbl1, 0, Math.sin), TypeError,
- /can only assign WebAssembly exported functions to Table/);
-assertErrorMessage(
+ /must be null or a WebAssembly function/);
+assertThrows(
() => set.call(tbl1, {valueOf() { throw Error('hai') }}, null), Error,
'hai');
assertEq(set.call(tbl1, 0, null), undefined);
assertEq(set.call(tbl1, 1, null), undefined);
-assertErrorMessage(
+assertThrows(
() => set.call(tbl1, undefined, null), TypeError,
/must be convertible to a valid number/);
@@ -727,35 +714,35 @@ assertTrue(tblGrowDesc.configurable);
// 'WebAssembly.Table.prototype.grow' method
let tblGrow = tblGrowDesc.value;
assertEq(tblGrow.length, 1);
-assertErrorMessage(
- () => tblGrow.call(), TypeError, /called on incompatible undefined/);
-assertErrorMessage(
- () => tblGrow.call({}), TypeError, /called on incompatible Object/);
-assertErrorMessage(
- () => tblGrow.call(tbl1, -1), TypeError, /bad Table grow delta/);
-assertErrorMessage(
+assertThrows(
+ () => tblGrow.call(), TypeError, /Receiver is not a WebAssembly.Table/);
+assertThrows(
+ () => tblGrow.call({}), TypeError, /Receiver is not a WebAssembly.Table/);
+assertThrows(
+ () => tblGrow.call(tbl1, -1), TypeError, /must be non-negative/);
+assertThrows(
() => tblGrow.call(tbl1, Math.pow(2, 32)), TypeError,
- /bad Table grow delta/);
+ /must be in the unsigned long range/);
var tbl = new Table({element: 'anyfunc', initial: 1, maximum: 2});
assertEq(tbl.length, 1);
-assertErrorMessage(
- () => tbl.grow(Infinity), TypeError, /failed to grow table/);
-assertErrorMessage(
- () => tbl.grow(-Infinity), TypeError, /failed to grow table/);
+assertThrows(
+ () => tbl.grow(Infinity), TypeError, /must be convertible to a valid number/);
+assertThrows(
+ () => tbl.grow(-Infinity), TypeError, /must be convertible to a valid number/);
assertEq(tbl.grow(0), 1);
assertEq(tbl.length, 1);
assertEq(tbl.grow(1, 4), 1);
assertEq(tbl.length, 2);
assertEq(tbl.length, 2);
-assertErrorMessage(() => tbl.grow(1), Error, /failed to grow table/);
-assertErrorMessage(
- () => tbl.grow(Infinity), TypeError, /failed to grow table/);
-assertErrorMessage(
- () => tbl.grow(-Infinity), TypeError, /failed to grow table/);
+assertThrows(() => tbl.grow(1), Error, /maximum table size exceeded/);
+assertThrows(
+ () => tbl.grow(Infinity), TypeError, /must be convertible to a valid number/);
+assertThrows(
+ () => tbl.grow(-Infinity), TypeError, /must be convertible to a valid number/);
// 'WebAssembly.validate' function
-assertErrorMessage(() => WebAssembly.validate(), TypeError);
-assertErrorMessage(() => WebAssembly.validate('hi'), TypeError);
+assertThrows(() => WebAssembly.validate(), TypeError);
+assertThrows(() => WebAssembly.validate('hi'), TypeError);
assertTrue(WebAssembly.validate(emptyModuleBinary));
// TODO: other ways for validate to return false.
assertFalse(WebAssembly.validate(moduleBinaryImporting2Memories));
@@ -774,22 +761,18 @@ assertEq(compile, compileDesc.value);
assertEq(compile.length, 1);
assertEq(compile.name, 'compile');
function assertCompileError(args, err, msg) {
- var error = null;
- assertPromiseResult(compile(...args), unexpectedSuccess, error => {
- assertTrue(error instanceof err);
- // TODO assertTrue(Boolean(error.message.match(msg)));
- });
+ assertThrowsAsync(compile(...args), err /* TODO , msg */);
}
assertCompileError([], TypeError, /requires more than 0 arguments/);
assertCompileError(
[undefined], TypeError,
- /first argument must be an ArrayBuffer or typed array object/);
+ /Argument 0 must be a buffer source/);
assertCompileError(
[1], TypeError,
- /first argument must be an ArrayBuffer or typed array object/);
+ /Argument 0 must be a buffer source/);
assertCompileError(
[{}], TypeError,
- /first argument must be an ArrayBuffer or typed array object/);
+ /Argument 0 must be a buffer source/);
assertCompileError(
[new Uint8Array()], CompileError, /BufferSource argument is empty/);
assertCompileError(
@@ -820,11 +803,7 @@ assertEq(instantiate, instantiateDesc.value);
assertEq(instantiate.length, 1);
assertEq(instantiate.name, 'instantiate');
function assertInstantiateError(args, err, msg) {
- var error = null;
- assertPromiseResult(instantiate(...args), unexpectedSuccess, error => {
- assertTrue(error instanceof err);
- // TODO assertTrue(Boolean(error.message.match(msg)));
- });
+ assertThrowsAsync(instantiate(...args), err /* TODO , msg */);
}
var scratch_memory = new WebAssembly.Memory({ initial: 0 });
assertInstantiateError([], TypeError, /requires more than 0 arguments/);
diff --git a/deps/v8/test/mjsunit/wasm/large-offset.js b/deps/v8/test/mjsunit/wasm/large-offset.js
index 653194c159..919891ab99 100644
--- a/deps/v8/test/mjsunit/wasm/large-offset.js
+++ b/deps/v8/test/mjsunit/wasm/large-offset.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function testMemoryGrowOutOfBoundsOffset() {
diff --git a/deps/v8/test/mjsunit/wasm/lazy-compilation.js b/deps/v8/test/mjsunit/wasm/lazy-compilation.js
index fc41fbd622..c7cd40d05d 100644
--- a/deps/v8/test/mjsunit/wasm/lazy-compilation.js
+++ b/deps/v8/test/mjsunit/wasm/lazy-compilation.js
@@ -4,7 +4,6 @@
// Flags: --wasm-lazy-compilation --allow-natives-syntax
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function importFromOtherInstance() {
diff --git a/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js b/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js
index d24b5a3b22..3ce74816ea 100644
--- a/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js
+++ b/deps/v8/test/mjsunit/wasm/liftoff-trap-handler.js
@@ -7,7 +7,6 @@
// A simple test to make sure Liftoff can compile memory operations with trap
// handlers enabled.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function testCompileLoadStore() {
diff --git a/deps/v8/test/mjsunit/wasm/liftoff.js b/deps/v8/test/mjsunit/wasm/liftoff.js
index 66fa5b70ef..51b30878d3 100644
--- a/deps/v8/test/mjsunit/wasm/liftoff.js
+++ b/deps/v8/test/mjsunit/wasm/liftoff.js
@@ -4,7 +4,6 @@
// Flags: --allow-natives-syntax --liftoff --no-future --no-wasm-tier-up
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function testLiftoffFlag() {
diff --git a/deps/v8/test/mjsunit/wasm/loop-rotation.js b/deps/v8/test/mjsunit/wasm/loop-rotation.js
index da7a45c4d0..92ad1f31c7 100644
--- a/deps/v8/test/mjsunit/wasm/loop-rotation.js
+++ b/deps/v8/test/mjsunit/wasm/loop-rotation.js
@@ -4,7 +4,6 @@
// Flags: --turbo-loop-rotation --noliftoff --nowasm-tier-up
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestTrivialLoop1() {
diff --git a/deps/v8/test/mjsunit/wasm/many-parameters.js b/deps/v8/test/mjsunit/wasm/many-parameters.js
index a56619a6ad..46b231943d 100644
--- a/deps/v8/test/mjsunit/wasm/many-parameters.js
+++ b/deps/v8/test/mjsunit/wasm/many-parameters.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let types = [kWasmI32, kWasmF32, kWasmF64];
diff --git a/deps/v8/test/mjsunit/wasm/memory-external-call.js b/deps/v8/test/mjsunit/wasm/memory-external-call.js
index 2af5888daa..853cdf616a 100644
--- a/deps/v8/test/mjsunit/wasm/memory-external-call.js
+++ b/deps/v8/test/mjsunit/wasm/memory-external-call.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
let initialMemoryPages = 1;
diff --git a/deps/v8/test/mjsunit/wasm/memory-instance-validation.js b/deps/v8/test/mjsunit/wasm/memory-instance-validation.js
index c7aa32e4d5..ef65840532 100644
--- a/deps/v8/test/mjsunit/wasm/memory-instance-validation.js
+++ b/deps/v8/test/mjsunit/wasm/memory-instance-validation.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --expose-gc
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// This test verifies that when instances are exported, Gc'ed, the other
diff --git a/deps/v8/test/mjsunit/wasm/memory-size.js b/deps/v8/test/mjsunit/wasm/memory-size.js
index f803df2e3d..b83a424285 100644
--- a/deps/v8/test/mjsunit/wasm/memory-size.js
+++ b/deps/v8/test/mjsunit/wasm/memory-size.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var kV8MaxWasmMemoryPages = 32767; // ~ 2 GiB
diff --git a/deps/v8/test/mjsunit/wasm/memory.js b/deps/v8/test/mjsunit/wasm/memory.js
index 3bfb052808..f266dd4a85 100644
--- a/deps/v8/test/mjsunit/wasm/memory.js
+++ b/deps/v8/test/mjsunit/wasm/memory.js
@@ -4,7 +4,7 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
+load("test/mjsunit/wasm/wasm-module-builder.js");
// Basic tests.
diff --git a/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js
index f9593e84f7..f2b22d97ab 100644
--- a/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js
+++ b/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js
@@ -4,7 +4,6 @@
// Flags: --wasm-max-mem-pages=16384
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const k1MiB = 1 * 1024 * 1024;
diff --git a/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js
index db344f30f3..6baf0f3c7e 100644
--- a/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js
+++ b/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js
@@ -4,7 +4,6 @@
// Flags: --wasm-max-mem-pages=32768
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const k1MiB = 1 * 1024 * 1024;
diff --git a/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js
index d5cb006a79..39b9f95d9c 100644
--- a/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js
+++ b/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const k1MiB = 1 * 1024 * 1024;
diff --git a/deps/v8/test/mjsunit/wasm/module-memory.js b/deps/v8/test/mjsunit/wasm/module-memory.js
index 2ca5d9a725..8bc96f7ea0 100644
--- a/deps/v8/test/mjsunit/wasm/module-memory.js
+++ b/deps/v8/test/mjsunit/wasm/module-memory.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --expose-gc --stress-compaction --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var kMemSize = 65536;
diff --git a/deps/v8/test/mjsunit/wasm/multi-value.js b/deps/v8/test/mjsunit/wasm/multi-value.js
index d6eff16293..1948801958 100644
--- a/deps/v8/test/mjsunit/wasm/multi-value.js
+++ b/deps/v8/test/mjsunit/wasm/multi-value.js
@@ -4,7 +4,6 @@
// Flags: --experimental-wasm-mv
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function MultiBlockResultTest() {
diff --git a/deps/v8/test/mjsunit/wasm/names.js b/deps/v8/test/mjsunit/wasm/names.js
index 8b635e6771..4904d67fb5 100644
--- a/deps/v8/test/mjsunit/wasm/names.js
+++ b/deps/v8/test/mjsunit/wasm/names.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
function toBytes(string) {
diff --git a/deps/v8/test/mjsunit/wasm/origin-trial-flags.js b/deps/v8/test/mjsunit/wasm/origin-trial-flags.js
index d41f581e13..b9ce6f7f94 100644
--- a/deps/v8/test/mjsunit/wasm/origin-trial-flags.js
+++ b/deps/v8/test/mjsunit/wasm/origin-trial-flags.js
@@ -4,7 +4,6 @@
// Flags: --noexperimental-wasm-threads --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function instantiateModuleWithThreads() {
diff --git a/deps/v8/test/mjsunit/wasm/parallel_compilation.js b/deps/v8/test/mjsunit/wasm/parallel_compilation.js
index 208232cfd4..6eca124bc4 100644
--- a/deps/v8/test/mjsunit/wasm/parallel_compilation.js
+++ b/deps/v8/test/mjsunit/wasm/parallel_compilation.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --wasm-num-compilation-tasks=10
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function assertModule(module, memsize) {
diff --git a/deps/v8/test/mjsunit/wasm/params.js b/deps/v8/test/mjsunit/wasm/params.js
index e964cee686..33858429c4 100644
--- a/deps/v8/test/mjsunit/wasm/params.js
+++ b/deps/v8/test/mjsunit/wasm/params.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function runSelect2(select, which, a, b) {
diff --git a/deps/v8/test/mjsunit/wasm/print-code.js b/deps/v8/test/mjsunit/wasm/print-code.js
index 2d35a27559..c604ca75f0 100644
--- a/deps/v8/test/mjsunit/wasm/print-code.js
+++ b/deps/v8/test/mjsunit/wasm/print-code.js
@@ -7,7 +7,6 @@
// Just test that printing the code of the following wasm modules does not
// crash.
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function print_deserialized_code() {
diff --git a/deps/v8/test/mjsunit/wasm/receiver.js b/deps/v8/test/mjsunit/wasm/receiver.js
index b3373c11ec..10e8855927 100644
--- a/deps/v8/test/mjsunit/wasm/receiver.js
+++ b/deps/v8/test/mjsunit/wasm/receiver.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function testCallImport(func, expected, a, b) {
diff --git a/deps/v8/test/mjsunit/wasm/serialize-lazy-module.js b/deps/v8/test/mjsunit/wasm/serialize-lazy-module.js
index 98998c6f43..86b6855fc1 100644
--- a/deps/v8/test/mjsunit/wasm/serialize-lazy-module.js
+++ b/deps/v8/test/mjsunit/wasm/serialize-lazy-module.js
@@ -4,7 +4,6 @@
// Flags: --wasm-lazy-compilation --allow-natives-syntax --expose-gc
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
(function SerializeUncompiledModule() {
diff --git a/deps/v8/test/mjsunit/wasm/shared-memory.js b/deps/v8/test/mjsunit/wasm/shared-memory.js
index bbe89a3fe5..80e894b28f 100644
--- a/deps/v8/test/mjsunit/wasm/shared-memory.js
+++ b/deps/v8/test/mjsunit/wasm/shared-memory.js
@@ -4,7 +4,6 @@
// Flags: --experimental-wasm-threads
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function assertMemoryIsValid(memory, shared) {
@@ -130,3 +129,17 @@ function assertMemoryIsValid(memory, shared) {
assertEquals(0, instance.exports.main(0, 0x11111111));
assertEquals(0x11111111, instance.exports.main(0, 0x11111111));
})();
+
+(function TestMemoryConstructorShouldNotCallHasProperty() {
+ print(arguments.callee.name);
+ // from test/wasm-js/data/test/js-api/memory/constructor.any.js
+ const proxy = new Proxy({}, {
+ has(o, x) {
+ throw new Error(`Should not call [[HasProperty]] with ${x}`);
+ },
+ get(o, x) {
+ return 0;
+ },
+ });
+ new WebAssembly.Memory(proxy);
+})();
diff --git a/deps/v8/test/mjsunit/wasm/stack.js b/deps/v8/test/mjsunit/wasm/stack.js
index f49dca3585..484cee0acd 100644
--- a/deps/v8/test/mjsunit/wasm/stack.js
+++ b/deps/v8/test/mjsunit/wasm/stack.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// The stack trace contains file path, only keep "stack.js".
@@ -70,10 +69,10 @@ var module = builder.instantiate({mod: {func: STACK}});
(function testSimpleStack() {
var expected_string = 'Error\n' +
// The line numbers below will change as this test gains / loses lines..
- ' at STACK (stack.js:39:11)\n' + // --
+ ' at STACK (stack.js:38:11)\n' + // --
' at main (wasm-function[1]:1)\n' + // --
- ' at testSimpleStack (stack.js:78:18)\n' + // --
- ' at stack.js:80:3'; // --
+ ' at testSimpleStack (stack.js:77:18)\n' + // --
+ ' at stack.js:79:3'; // --
module.exports.main();
assertEquals(expected_string, stripPath(stack));
@@ -90,10 +89,10 @@ Error.prepareStackTrace = function(error, frames) {
verifyStack(stack, [
// isWasm function line pos file
- [ false, "STACK", 39, 0, "stack.js"],
+ [ false, "STACK", 38, 0, "stack.js"],
[ true, "main", 1, 1, null],
- [ false, "testStackFrames", 89, 0, "stack.js"],
- [ false, null, 98, 0, "stack.js"]
+ [ false, "testStackFrames", 88, 0, "stack.js"],
+ [ false, null, 97, 0, "stack.js"]
]);
})();
@@ -106,8 +105,8 @@ Error.prepareStackTrace = function(error, frames) {
verifyStack(e.stack, [
// isWasm function line pos file
[ true, "exec_unreachable", 2, 1, null],
- [ false, "testWasmUnreachable", 102, 0, "stack.js"],
- [ false, null, 113, 0, "stack.js"]
+ [ false, "testWasmUnreachable", 101, 0, "stack.js"],
+ [ false, null, 112, 0, "stack.js"]
]);
}
})();
@@ -122,8 +121,8 @@ Error.prepareStackTrace = function(error, frames) {
// isWasm function line pos file
[ true, null, 3, 3, null],
[ true, "call_mem_out_of_bounds", 4, 1, null],
- [ false, "testWasmMemOutOfBounds", 117, 0, "stack.js"],
- [ false, null, 129, 0, "stack.js"]
+ [ false, "testWasmMemOutOfBounds", 116, 0, "stack.js"],
+ [ false, null, 128, 0, "stack.js"]
]);
}
})();
@@ -177,8 +176,8 @@ Error.prepareStackTrace = function(error, frames) {
verifyStack(e.stack, [
// isWasm, function, line, pos, file
[true, 'main', 0, unreachable_pos + 1, null], // -
- [false, 'testBigOffset', 173, 0, 'stack.js'], //-
- [false, null, 184, 0, 'stack.js']
+ [false, 'testBigOffset', 172, 0, 'stack.js'], //-
+ [false, null, 183, 0, 'stack.js']
]);
}
})();
diff --git a/deps/v8/test/mjsunit/wasm/stackwalk.js b/deps/v8/test/mjsunit/wasm/stackwalk.js
index d2810fce45..91951ff4c3 100644
--- a/deps/v8/test/mjsunit/wasm/stackwalk.js
+++ b/deps/v8/test/mjsunit/wasm/stackwalk.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --expose-gc --allow-natives-syntax
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function makeFFI(func) {
diff --git a/deps/v8/test/mjsunit/wasm/start-function.js b/deps/v8/test/mjsunit/wasm/start-function.js
index b47dac5767..e17c8f1785 100644
--- a/deps/v8/test/mjsunit/wasm/start-function.js
+++ b/deps/v8/test/mjsunit/wasm/start-function.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function instantiate(sig, body) {
@@ -46,8 +45,8 @@ assertThrows(() => {instantiate(kSig_i_v, [kExprI32Const, 0]);});
assertThrows(
() => builder.instantiate(), WebAssembly.CompileError,
- 'WebAssembly.Module(): Wasm decoding failed: ' +
- 'function index 1 out of bounds (1 entry) @+20');
+ 'WebAssembly.Module(): ' +
+ 'start function index 1 out of bounds (1 entry) @+20');
})();
@@ -63,8 +62,7 @@ assertThrows(() => {instantiate(kSig_i_v, [kExprI32Const, 0]);});
assertThrows(
() => builder.instantiate(), WebAssembly.CompileError,
- 'WebAssembly.Module(): Wasm decoding failed: ' +
- 'unexpected section: Start @+27');
+ 'WebAssembly.Module(): unexpected section <Start> @+27');
})();
@@ -153,9 +151,7 @@ assertThrows(() => {instantiate(kSig_i_v, [kExprI32Const, 0]);});
assertThrows(
() => builder.instantiate(), WebAssembly.RuntimeError, /unreachable/);
- assertPromiseResult(builder.asyncInstantiate(), assertUnreachable,
- e => assertInstanceof(e, WebAssembly.RuntimeError));
- assertPromiseResult(WebAssembly.instantiate(builder.toModule()),
- assertUnreachable,
- e => assertInstanceof(e, WebAssembly.RuntimeError));
+ assertThrowsAsync(builder.asyncInstantiate(), WebAssembly.RuntimeError);
+ assertThrowsAsync(
+ WebAssembly.instantiate(builder.toModule()), WebAssembly.RuntimeError);
})();
diff --git a/deps/v8/test/mjsunit/wasm/streaming-error-position.js b/deps/v8/test/mjsunit/wasm/streaming-error-position.js
index fe9f9a1410..266c134966 100644
--- a/deps/v8/test/mjsunit/wasm/streaming-error-position.js
+++ b/deps/v8/test/mjsunit/wasm/streaming-error-position.js
@@ -2,11 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --wasm-test-streaming --expose-wasm --allow-natives-syntax
+// Flags: --wasm-test-streaming --expose-wasm
'use strict';
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
function module(bytes) {
@@ -33,14 +32,9 @@ function toBuffer(binary) {
}
function testErrorPosition(bytes, pos, test_name) {
- assertPromiseResult(
- WebAssembly.compile(toBuffer(bytes)), assertUnreachable, e => {
- print(test_name);
- assertInstanceof(e, WebAssembly.CompileError);
- let regex = new RegExp('@\\+' + pos);
- print(e.message);
- assertMatches(regex, e.message, 'Error Position');
- });
+ assertThrowsAsync(
+ WebAssembly.compile(toBuffer(bytes)), WebAssembly.CompileError,
+ new RegExp('@\\+' + pos));
}
(function testInvalidMagic() {
diff --git a/deps/v8/test/mjsunit/wasm/table-copy.js b/deps/v8/test/mjsunit/wasm/table-copy.js
index 89572fa41e..7c5c49669f 100644
--- a/deps/v8/test/mjsunit/wasm/table-copy.js
+++ b/deps/v8/test/mjsunit/wasm/table-copy.js
@@ -4,7 +4,6 @@
// Flags: --experimental-wasm-bulk-memory
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestTableCopyInbounds() {
@@ -20,7 +19,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
kExprGetLocal, 0,
kExprGetLocal, 1,
kExprGetLocal, 2,
- kNumericPrefix, kExprTableCopy, kTableZero])
+ kNumericPrefix, kExprTableCopy, kTableZero, kTableZero])
.exportAs("copy");
let instance = builder.instantiate();
@@ -30,9 +29,6 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
copy(0, i, kTableSize - i);
copy(i, 0, kTableSize - i);
}
- let big = 1000000;
- copy(big, 0, 0); // nop
- copy(0, big, 0); // nop
})();
function addFunction(builder, k) {
@@ -75,7 +71,7 @@ function assertTable(obj, ...elems) {
kExprGetLocal, 0,
kExprGetLocal, 1,
kExprGetLocal, 2,
- kNumericPrefix, kExprTableCopy, kTableZero])
+ kNumericPrefix, kExprTableCopy, kTableZero, kTableZero])
.exportAs("copy");
builder.addExportOfKind("table", kExternalTable, 0);
@@ -129,7 +125,7 @@ function assertCall(call, ...elems) {
kExprGetLocal, 0,
kExprGetLocal, 1,
kExprGetLocal, 2,
- kNumericPrefix, kExprTableCopy, kTableZero])
+ kNumericPrefix, kExprTableCopy, kTableZero, kTableZero])
.exportAs("copy");
builder.addFunction("call", sig_i_i)
@@ -165,7 +161,7 @@ function assertCall(call, ...elems) {
kExprGetLocal, 0,
kExprGetLocal, 1,
kExprGetLocal, 2,
- kNumericPrefix, kExprTableCopy, kTableZero])
+ kNumericPrefix, kExprTableCopy, kTableZero, kTableZero])
.exportAs("copy");
let instance = builder.instantiate();
@@ -176,6 +172,13 @@ function assertCall(call, ...elems) {
assertThrows(() => copy(1, 0, kTableSize));
assertThrows(() => copy(0, 1, kTableSize));
+ {
+ let big = 1000000;
+ assertThrows(() => copy(big, 0, 0));
+ assertThrows(() => copy(0, big, 0));
+ }
+
+
for (let big = 4294967295; big > 1000; big >>>= 1) {
assertThrows(() => copy(big, 0, 1));
assertThrows(() => copy(0, big, 1));
@@ -187,6 +190,7 @@ function assertCall(call, ...elems) {
assertThrows(() => copy(0, big, 1));
assertThrows(() => copy(0, 0, big));
}
+
})();
(function TestTableCopyShared() {
@@ -221,7 +225,7 @@ function assertCall(call, ...elems) {
kExprGetLocal, 0,
kExprGetLocal, 1,
kExprGetLocal, 2,
- kNumericPrefix, kExprTableCopy, kTableZero])
+ kNumericPrefix, kExprTableCopy, kTableZero, kTableZero])
.exportAs("copy");
builder.addFunction("call", sig_i_i)
diff --git a/deps/v8/test/mjsunit/wasm/table-grow.js b/deps/v8/test/mjsunit/wasm/table-grow.js
index 8d3c717522..fd895dedc3 100644
--- a/deps/v8/test/mjsunit/wasm/table-grow.js
+++ b/deps/v8/test/mjsunit/wasm/table-grow.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
let kMaxTableSize = 10000000;
diff --git a/deps/v8/test/mjsunit/wasm/table-init.js b/deps/v8/test/mjsunit/wasm/table-init.js
new file mode 100644
index 0000000000..c95e072c64
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/table-init.js
@@ -0,0 +1,128 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --experimental-wasm-bulk-memory
+
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+function addFunction(builder, k) {
+ let m = builder.addFunction("", kSig_i_v)
+ .addBody([...wasmI32Const(k)]);
+ return m;
+}
+
+function addFunctions(builder, count, exportf = false) {
+ let o = {};
+ for (var i = 0; i < count; i++) {
+ let name = `f${i}`;
+ o[name] = addFunction(builder, i);
+ if (exportf) o[name].exportAs(name);
+ }
+ return o;
+}
+
+function assertTable(obj, ...elems) {
+ for (var i = 0; i < elems.length; i++) {
+ assertEquals(elems[i], obj.get(i));
+ }
+}
+
+(function TestTableInitInBounds() {
+ print(arguments.callee.name);
+ let builder = new WasmModuleBuilder();
+ let sig_v_iii = builder.addType(kSig_v_iii);
+ let kTableSize = 5;
+
+ builder.setTableBounds(kTableSize, kTableSize);
+ {
+ let o = addFunctions(builder, kTableSize, true);
+ builder.addPassiveElementSegment(
+ [o.f0.index, o.f1.index, o.f2.index, o.f3.index, o.f4.index, null]);
+ }
+
+ builder.addFunction("init0", sig_v_iii)
+ .addBody([
+ kExprGetLocal, 0,
+ kExprGetLocal, 1,
+ kExprGetLocal, 2,
+ kNumericPrefix, kExprTableInit, kSegmentZero, kTableZero])
+ .exportAs("init0");
+
+ builder.addExportOfKind("table", kExternalTable, 0);
+
+ let instance = builder.instantiate();
+ let x = instance.exports;
+
+ assertTable(x.table, null, null, null, null, null);
+
+ // test actual writes.
+ x.init0(0, 0, 1);
+ assertTable(x.table, x.f0, null, null, null, null);
+ x.init0(0, 0, 2);
+ assertTable(x.table, x.f0, x.f1, null, null, null);
+ x.init0(0, 0, 3);
+ assertTable(x.table, x.f0, x.f1, x.f2, null, null);
+ x.init0(3, 0, 2);
+ assertTable(x.table, x.f0, x.f1, x.f2, x.f0, x.f1);
+ x.init0(3, 1, 2);
+ assertTable(x.table, x.f0, x.f1, x.f2, x.f1, x.f2);
+ x.init0(3, 2, 2);
+ assertTable(x.table, x.f0, x.f1, x.f2, x.f2, x.f3);
+ x.init0(3, 3, 2);
+ assertTable(x.table, x.f0, x.f1, x.f2, x.f3, x.f4);
+
+ // test writing null
+ x.init0(0, 5, 1);
+ assertTable(x.table, null, x.f1, x.f2, x.f3, x.f4);
+})();
+
+(function TestTableInitOob() {
+ print(arguments.callee.name);
+ let builder = new WasmModuleBuilder();
+ let sig_v_iii = builder.addType(kSig_v_iii);
+ let kTableSize = 5;
+
+ builder.setTableBounds(kTableSize, kTableSize);
+ {
+ let o = addFunctions(builder, kTableSize);
+ builder.addPassiveElementSegment(
+ [o.f0.index, o.f1.index, o.f2.index, o.f3.index, o.f4.index]);
+ }
+
+ builder.addFunction("init0", sig_v_iii)
+ .addBody([
+ kExprGetLocal, 0,
+ kExprGetLocal, 1,
+ kExprGetLocal, 2,
+ kNumericPrefix, kExprTableInit, kSegmentZero, kTableZero])
+ .exportAs("init0");
+
+ builder.addExportOfKind("table", kExternalTable, 0);
+
+ let instance = builder.instantiate();
+ let x = instance.exports;
+
+ assertTable(x.table, null, null, null, null, null);
+
+ // 0-count is oob.
+ assertThrows(() => x.init0(kTableSize+1, 0, 0));
+ assertThrows(() => x.init0(0, kTableSize+1, 0));
+
+ assertThrows(() => x.init0(0, 0, 6));
+ assertThrows(() => x.init0(0, 1, 5));
+ assertThrows(() => x.init0(0, 2, 4));
+ assertThrows(() => x.init0(0, 3, 3));
+ assertThrows(() => x.init0(0, 4, 2));
+ assertThrows(() => x.init0(0, 5, 1));
+
+ assertThrows(() => x.init0(0, 0, 6));
+ assertThrows(() => x.init0(1, 0, 5));
+ assertThrows(() => x.init0(2, 0, 4));
+ assertThrows(() => x.init0(3, 0, 3));
+ assertThrows(() => x.init0(4, 0, 2));
+ assertThrows(() => x.init0(5, 0, 1));
+
+ assertThrows(() => x.init0(10, 0, 1));
+ assertThrows(() => x.init0(0, 10, 1));
+})();
diff --git a/deps/v8/test/mjsunit/wasm/table-limits.js b/deps/v8/test/mjsunit/wasm/table-limits.js
new file mode 100644
index 0000000000..7e31bf1f5b
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/table-limits.js
@@ -0,0 +1,42 @@
+// Copyright 2018 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --wasm-max-table-size=10
+
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+// With the flags we set the maximum table size to 10, so 11 is out-of-bounds.
+const oob = 11;
+
+(function TestJSTableInitialAboveTheLimit() {
+ print(arguments.callee.name);
+ assertThrows(
+ () => new WebAssembly.Table({ initial: oob, element: "anyfunc" }),
+ RangeError, /above the upper bound/);
+})();
+
+(function TestJSTableMaximumAboveTheLimit() {
+ print(arguments.callee.name);
+ assertThrows(
+ () => new WebAssembly.Table({ initial: 1, maximum: oob, element: "anyfunc" }),
+ RangeError, /above the upper bound/);
+})();
+
+(function TestDecodeTableInitialAboveTheLimit() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ builder.setTableBounds(oob);
+ assertThrows(
+ () => builder.instantiate(),
+ WebAssembly.CompileError, /is larger than implementation limit/);
+})();
+
+(function TestDecodeTableMaximumAboveTheLimit() {
+ print(arguments.callee.name);
+ const builder = new WasmModuleBuilder();
+ builder.setTableBounds(1, oob);
+ assertThrows(
+ () => builder.instantiate(),
+ WebAssembly.CompileError, /is larger than implementation limit/);
+})();
diff --git a/deps/v8/test/mjsunit/wasm/table.js b/deps/v8/test/mjsunit/wasm/table.js
index 0f4a63396e..3ee33be688 100644
--- a/deps/v8/test/mjsunit/wasm/table.js
+++ b/deps/v8/test/mjsunit/wasm/table.js
@@ -6,16 +6,12 @@
'use strict';
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Basic tests.
-var outOfUint32RangeValue = 1e12;
-var int32ButOob = 1073741824;
-var kMaxUint32 = (4 * 1024 * 1024 * 1024) - 1;
-var kMaxUint31 = (2 * 1024 * 1024 * 1024) - 1;
-var kV8MaxWasmTableSize = 10000000;
+const outOfUint32RangeValue = 1e12;
+const kV8MaxWasmTableSize = 10000000;
function assertTableIsValid(table, length) {
assertSame(WebAssembly.Table.prototype, table.__proto__);
@@ -87,14 +83,16 @@ function assertTableIsValid(table, length) {
table = new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: undefined});
assertTableIsValid(table, 0);
- table = new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: kMaxUint31});
+ table = new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: 1000000});
assertTableIsValid(table, 0);
- table = new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: kMaxUint32});
+ table = new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: kV8MaxWasmTableSize});
assertTableIsValid(table, 0);
- table = new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: kV8MaxWasmTableSize + 1});
- assertTableIsValid(table, 0);
+ assertThrows(
+ () => new WebAssembly.Table(
+ {element: "anyfunc", initial: 0, maximum: kV8MaxWasmTableSize + 1}),
+ RangeError, /above the upper bound/);
})();
(function TestMaximumIsReadOnce() {
diff --git a/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js b/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js
index 02f28ff515..eb0a95384c 100644
--- a/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js
+++ b/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
var debug = true;
diff --git a/deps/v8/test/mjsunit/wasm/tier-up-testing-flag.js b/deps/v8/test/mjsunit/wasm/tier-up-testing-flag.js
index 1b2a11e0ca..20aa30930c 100644
--- a/deps/v8/test/mjsunit/wasm/tier-up-testing-flag.js
+++ b/deps/v8/test/mjsunit/wasm/tier-up-testing-flag.js
@@ -6,7 +6,6 @@
// Compile functions 0 and 2 with Turbofan, the rest with Liftoff:
// Flags: --wasm-tier-mask-for-testing=5
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
const num_functions = 5;
diff --git a/deps/v8/test/mjsunit/wasm/trap-handler-fallback.js b/deps/v8/test/mjsunit/wasm/trap-handler-fallback.js
index 465ca449cc..6b1cdf96e2 100644
--- a/deps/v8/test/mjsunit/wasm/trap-handler-fallback.js
+++ b/deps/v8/test/mjsunit/wasm/trap-handler-fallback.js
@@ -4,7 +4,6 @@
// Flags: --allow-natives-syntax --wasm-trap-handler-fallback
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Make sure we can get at least one guard region if the trap handler is enabled.
diff --git a/deps/v8/test/mjsunit/wasm/trap-location.js b/deps/v8/test/mjsunit/wasm/trap-location.js
index c4a0f4d787..d893f97d62 100644
--- a/deps/v8/test/mjsunit/wasm/trap-location.js
+++ b/deps/v8/test/mjsunit/wasm/trap-location.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Collect the Callsite objects instead of just a string:
diff --git a/deps/v8/test/mjsunit/wasm/unicode-validation.js b/deps/v8/test/mjsunit/wasm/unicode-validation.js
index 8932c32653..e331c00a6a 100644
--- a/deps/v8/test/mjsunit/wasm/unicode-validation.js
+++ b/deps/v8/test/mjsunit/wasm/unicode-validation.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function toByteArray(s) {
diff --git a/deps/v8/test/mjsunit/wasm/unicode.js b/deps/v8/test/mjsunit/wasm/unicode.js
index 7e29c00f33..379a513d42 100644
--- a/deps/v8/test/mjsunit/wasm/unicode.js
+++ b/deps/v8/test/mjsunit/wasm/unicode.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
function checkImport(
@@ -60,7 +59,7 @@ checkExports('ā˜ŗā˜ŗmulā˜ŗā˜ŗ', 'ā˜ŗā˜ŗmulā˜ŗā˜ŗ', 'ā˜ŗā˜ŗaddā˜ŗā˜ŗ', 'ā˜ŗā˜ŗadd
builder.addImport('three snowmen: ā˜ƒā˜ƒā˜ƒ', 'foo', kSig_i_v);
assertThrows(
() => builder.instantiate({}), TypeError,
- /WebAssembly Instantiation: Import #0 module="three snowmen: ā˜ƒā˜ƒā˜ƒ" error: /);
+ /WebAssembly.Instance\(\): Import #0 module="three snowmen: ā˜ƒā˜ƒā˜ƒ" error: /);
})();
(function errorMessageUnicodeInImportElemName() {
@@ -68,7 +67,7 @@ checkExports('ā˜ŗā˜ŗmulā˜ŗā˜ŗ', 'ā˜ŗā˜ŗmulā˜ŗā˜ŗ', 'ā˜ŗā˜ŗaddā˜ŗā˜ŗ', 'ā˜ŗā˜ŗadd
builder.addImport('mod', 'three snowmen: ā˜ƒā˜ƒā˜ƒ', kSig_i_v);
assertThrows(
() => builder.instantiate({mod: {}}), WebAssembly.LinkError,
- 'WebAssembly Instantiation: Import #0 module="mod" function="three ' +
+ 'WebAssembly.Instance\(\): Import #0 module="mod" function="three ' +
'snowmen: ā˜ƒā˜ƒā˜ƒ" error: function import requires a callable');
})();
@@ -79,7 +78,7 @@ checkExports('ā˜ŗā˜ŗmulā˜ŗā˜ŗ', 'ā˜ŗā˜ŗmulā˜ŗā˜ŗ', 'ā˜ŗā˜ŗaddā˜ŗā˜ŗ', 'ā˜ŗā˜ŗadd
builder.addImport(mod_name, func_name, kSig_i_v);
assertThrows(
() => builder.instantiate({[mod_name]: {}}), WebAssembly.LinkError,
- 'WebAssembly Instantiation: Import #0 module="' + mod_name +
+ 'WebAssembly.Instance(): Import #0 module="' + mod_name +
'" function="' + func_name +
'" error: function import requires a callable');
})();
diff --git a/deps/v8/test/mjsunit/wasm/unreachable-validation.js b/deps/v8/test/mjsunit/wasm/unreachable-validation.js
index 5b98b1713b..70768ff7d4 100644
--- a/deps/v8/test/mjsunit/wasm/unreachable-validation.js
+++ b/deps/v8/test/mjsunit/wasm/unreachable-validation.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
// Set unittest to false to run this test and just print results, without failing.
diff --git a/deps/v8/test/mjsunit/wasm/unreachable.js b/deps/v8/test/mjsunit/wasm/unreachable.js
index d77b53ea53..38be72952f 100644
--- a/deps/v8/test/mjsunit/wasm/unreachable.js
+++ b/deps/v8/test/mjsunit/wasm/unreachable.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
var main = (function () {
diff --git a/deps/v8/test/mjsunit/wasm/user-properties-common.js b/deps/v8/test/mjsunit/wasm/user-properties-common.js
index ab6b2bc979..f736593169 100644
--- a/deps/v8/test/mjsunit/wasm/user-properties-common.js
+++ b/deps/v8/test/mjsunit/wasm/user-properties-common.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --expose-gc --verify-heap
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
const verifyHeap = gc;
diff --git a/deps/v8/test/mjsunit/wasm/wasm-api-overloading.js b/deps/v8/test/mjsunit/wasm/wasm-api-overloading.js
index 6a39510208..0ae9db5d3a 100644
--- a/deps/v8/test/mjsunit/wasm/wasm-api-overloading.js
+++ b/deps/v8/test/mjsunit/wasm/wasm-api-overloading.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
let buffer = (() => {
diff --git a/deps/v8/test/mjsunit/wasm/wasm-constants.js b/deps/v8/test/mjsunit/wasm/wasm-constants.js
deleted file mode 100644
index 7583d39a9b..0000000000
--- a/deps/v8/test/mjsunit/wasm/wasm-constants.js
+++ /dev/null
@@ -1,511 +0,0 @@
-// Copyright 2015 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// Flags: --expose-wasm
-
-function bytes() {
- var buffer = new ArrayBuffer(arguments.length);
- var view = new Uint8Array(buffer);
- for (var i = 0; i < arguments.length; i++) {
- var val = arguments[i];
- if ((typeof val) == "string") val = val.charCodeAt(0);
- view[i] = val | 0;
- }
- return buffer;
-}
-
-// Header declaration constants
-var kWasmH0 = 0;
-var kWasmH1 = 0x61;
-var kWasmH2 = 0x73;
-var kWasmH3 = 0x6d;
-
-var kWasmV0 = 0x1;
-var kWasmV1 = 0;
-var kWasmV2 = 0;
-var kWasmV3 = 0;
-
-var kHeaderSize = 8;
-var kPageSize = 65536;
-var kSpecMaxPages = 65535;
-
-function bytesWithHeader() {
- var buffer = new ArrayBuffer(kHeaderSize + arguments.length);
- var view = new Uint8Array(buffer);
- view[0] = kWasmH0;
- view[1] = kWasmH1;
- view[2] = kWasmH2;
- view[3] = kWasmH3;
- view[4] = kWasmV0;
- view[5] = kWasmV1;
- view[6] = kWasmV2;
- view[7] = kWasmV3;
- for (var i = 0; i < arguments.length; i++) {
- var val = arguments[i];
- if ((typeof val) == "string") val = val.charCodeAt(0);
- view[kHeaderSize + i] = val | 0;
- }
- return buffer;
-}
-
-let kDeclNoLocals = 0;
-
-// Section declaration constants
-let kUnknownSectionCode = 0;
-let kTypeSectionCode = 1; // Function signature declarations
-let kImportSectionCode = 2; // Import declarations
-let kFunctionSectionCode = 3; // Function declarations
-let kTableSectionCode = 4; // Indirect function table and other tables
-let kMemorySectionCode = 5; // Memory attributes
-let kGlobalSectionCode = 6; // Global declarations
-let kExportSectionCode = 7; // Exports
-let kStartSectionCode = 8; // Start function declaration
-let kElementSectionCode = 9; // Elements section
-let kCodeSectionCode = 10; // Function code
-let kDataSectionCode = 11; // Data segments
-let kExceptionSectionCode = 12; // Exception section (between Global & Export)
-let kDataCountSectionCode = 13; // Data segments
-
-// Name section types
-let kModuleNameCode = 0;
-let kFunctionNamesCode = 1;
-let kLocalNamesCode = 2;
-
-let kWasmFunctionTypeForm = 0x60;
-let kWasmAnyFunctionTypeForm = 0x70;
-
-let kHasMaximumFlag = 1;
-
-// Segment flags
-let kActiveNoIndex = 0;
-let kPassive = 1;
-let kActiveWithIndex = 2;
-
-// Function declaration flags
-let kDeclFunctionName = 0x01;
-let kDeclFunctionImport = 0x02;
-let kDeclFunctionLocals = 0x04;
-let kDeclFunctionExport = 0x08;
-
-// Local types
-let kWasmStmt = 0x40;
-let kWasmI32 = 0x7f;
-let kWasmI64 = 0x7e;
-let kWasmF32 = 0x7d;
-let kWasmF64 = 0x7c;
-let kWasmS128 = 0x7b;
-let kWasmAnyRef = 0x6f;
-let kWasmAnyFunc = 0x70;
-let kWasmExceptRef = 0x68;
-
-let kExternalFunction = 0;
-let kExternalTable = 1;
-let kExternalMemory = 2;
-let kExternalGlobal = 3;
-let kExternalException = 4;
-
-let kTableZero = 0;
-let kMemoryZero = 0;
-let kSegmentZero = 0;
-
-let kExceptionAttribute = 0;
-
-// Useful signatures
-let kSig_i_i = makeSig([kWasmI32], [kWasmI32]);
-let kSig_l_l = makeSig([kWasmI64], [kWasmI64]);
-let kSig_i_l = makeSig([kWasmI64], [kWasmI32]);
-let kSig_i_ii = makeSig([kWasmI32, kWasmI32], [kWasmI32]);
-let kSig_i_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]);
-let kSig_v_iiii = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32], []);
-let kSig_f_ff = makeSig([kWasmF32, kWasmF32], [kWasmF32]);
-let kSig_d_dd = makeSig([kWasmF64, kWasmF64], [kWasmF64]);
-let kSig_l_ll = makeSig([kWasmI64, kWasmI64], [kWasmI64]);
-let kSig_i_dd = makeSig([kWasmF64, kWasmF64], [kWasmI32]);
-let kSig_v_v = makeSig([], []);
-let kSig_i_v = makeSig([], [kWasmI32]);
-let kSig_l_v = makeSig([], [kWasmI64]);
-let kSig_f_v = makeSig([], [kWasmF32]);
-let kSig_d_v = makeSig([], [kWasmF64]);
-let kSig_v_i = makeSig([kWasmI32], []);
-let kSig_v_ii = makeSig([kWasmI32, kWasmI32], []);
-let kSig_v_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], []);
-let kSig_v_l = makeSig([kWasmI64], []);
-let kSig_v_d = makeSig([kWasmF64], []);
-let kSig_v_dd = makeSig([kWasmF64, kWasmF64], []);
-let kSig_v_ddi = makeSig([kWasmF64, kWasmF64, kWasmI32], []);
-let kSig_ii_v = makeSig([], [kWasmI32, kWasmI32]);
-let kSig_iii_v = makeSig([], [kWasmI32, kWasmI32, kWasmI32]);
-let kSig_ii_i = makeSig([kWasmI32], [kWasmI32, kWasmI32]);
-let kSig_iii_i = makeSig([kWasmI32], [kWasmI32, kWasmI32, kWasmI32]);
-let kSig_ii_ii = makeSig([kWasmI32, kWasmI32], [kWasmI32, kWasmI32]);
-let kSig_iii_ii = makeSig([kWasmI32, kWasmI32], [kWasmI32, kWasmI32, kWasmI32]);
-
-let kSig_v_f = makeSig([kWasmF32], []);
-let kSig_f_f = makeSig([kWasmF32], [kWasmF32]);
-let kSig_f_d = makeSig([kWasmF64], [kWasmF32]);
-let kSig_d_d = makeSig([kWasmF64], [kWasmF64]);
-let kSig_r_r = makeSig([kWasmAnyRef], [kWasmAnyRef]);
-let kSig_a_a = makeSig([kWasmAnyFunc], [kWasmAnyFunc]);
-let kSig_i_r = makeSig([kWasmAnyRef], [kWasmI32]);
-let kSig_v_r = makeSig([kWasmAnyRef], []);
-let kSig_v_a = makeSig([kWasmAnyFunc], []);
-let kSig_v_rr = makeSig([kWasmAnyRef, kWasmAnyRef], []);
-let kSig_r_v = makeSig([], [kWasmAnyRef]);
-
-function makeSig(params, results) {
- return {params: params, results: results};
-}
-
-function makeSig_v_x(x) {
- return makeSig([x], []);
-}
-
-function makeSig_v_xx(x) {
- return makeSig([x, x], []);
-}
-
-function makeSig_r_v(r) {
- return makeSig([], [r]);
-}
-
-function makeSig_r_x(r, x) {
- return makeSig([x], [r]);
-}
-
-function makeSig_r_xx(r, x) {
- return makeSig([x, x], [r]);
-}
-
-// Opcodes
-let kExprUnreachable = 0x00;
-let kExprNop = 0x01;
-let kExprBlock = 0x02;
-let kExprLoop = 0x03;
-let kExprIf = 0x04;
-let kExprElse = 0x05;
-let kExprTry = 0x06;
-let kExprCatch = 0x07;
-let kExprThrow = 0x08;
-let kExprRethrow = 0x09;
-let kExprBrOnExn = 0x0a;
-let kExprEnd = 0x0b;
-let kExprBr = 0x0c;
-let kExprBrIf = 0x0d;
-let kExprBrTable = 0x0e;
-let kExprReturn = 0x0f;
-let kExprCallFunction = 0x10;
-let kExprCallIndirect = 0x11;
-let kExprDrop = 0x1a;
-let kExprSelect = 0x1b;
-let kExprGetLocal = 0x20;
-let kExprSetLocal = 0x21;
-let kExprTeeLocal = 0x22;
-let kExprGetGlobal = 0x23;
-let kExprSetGlobal = 0x24;
-let kExprI32Const = 0x41;
-let kExprI64Const = 0x42;
-let kExprF32Const = 0x43;
-let kExprF64Const = 0x44;
-let kExprRefNull = 0xd0;
-let kExprI32LoadMem = 0x28;
-let kExprI64LoadMem = 0x29;
-let kExprF32LoadMem = 0x2a;
-let kExprF64LoadMem = 0x2b;
-let kExprI32LoadMem8S = 0x2c;
-let kExprI32LoadMem8U = 0x2d;
-let kExprI32LoadMem16S = 0x2e;
-let kExprI32LoadMem16U = 0x2f;
-let kExprI64LoadMem8S = 0x30;
-let kExprI64LoadMem8U = 0x31;
-let kExprI64LoadMem16S = 0x32;
-let kExprI64LoadMem16U = 0x33;
-let kExprI64LoadMem32S = 0x34;
-let kExprI64LoadMem32U = 0x35;
-let kExprI32StoreMem = 0x36;
-let kExprI64StoreMem = 0x37;
-let kExprF32StoreMem = 0x38;
-let kExprF64StoreMem = 0x39;
-let kExprI32StoreMem8 = 0x3a;
-let kExprI32StoreMem16 = 0x3b;
-let kExprI64StoreMem8 = 0x3c;
-let kExprI64StoreMem16 = 0x3d;
-let kExprI64StoreMem32 = 0x3e;
-let kExprMemorySize = 0x3f;
-let kExprMemoryGrow = 0x40;
-let kExprI32Eqz = 0x45;
-let kExprI32Eq = 0x46;
-let kExprI32Ne = 0x47;
-let kExprI32LtS = 0x48;
-let kExprI32LtU = 0x49;
-let kExprI32GtS = 0x4a;
-let kExprI32GtU = 0x4b;
-let kExprI32LeS = 0x4c;
-let kExprI32LeU = 0x4d;
-let kExprI32GeS = 0x4e;
-let kExprI32GeU = 0x4f;
-let kExprI64Eqz = 0x50;
-let kExprI64Eq = 0x51;
-let kExprI64Ne = 0x52;
-let kExprI64LtS = 0x53;
-let kExprI64LtU = 0x54;
-let kExprI64GtS = 0x55;
-let kExprI64GtU = 0x56;
-let kExprI64LeS = 0x57;
-let kExprI64LeU = 0x58;
-let kExprI64GeS = 0x59;
-let kExprI64GeU = 0x5a;
-let kExprF32Eq = 0x5b;
-let kExprF32Ne = 0x5c;
-let kExprF32Lt = 0x5d;
-let kExprF32Gt = 0x5e;
-let kExprF32Le = 0x5f;
-let kExprF32Ge = 0x60;
-let kExprF64Eq = 0x61;
-let kExprF64Ne = 0x62;
-let kExprF64Lt = 0x63;
-let kExprF64Gt = 0x64;
-let kExprF64Le = 0x65;
-let kExprF64Ge = 0x66;
-let kExprRefIsNull = 0xd1;
-let kExprI32Clz = 0x67;
-let kExprI32Ctz = 0x68;
-let kExprI32Popcnt = 0x69;
-let kExprI32Add = 0x6a;
-let kExprI32Sub = 0x6b;
-let kExprI32Mul = 0x6c;
-let kExprI32DivS = 0x6d;
-let kExprI32DivU = 0x6e;
-let kExprI32RemS = 0x6f;
-let kExprI32RemU = 0x70;
-let kExprI32And = 0x71;
-let kExprI32Ior = 0x72;
-let kExprI32Xor = 0x73;
-let kExprI32Shl = 0x74;
-let kExprI32ShrS = 0x75;
-let kExprI32ShrU = 0x76;
-let kExprI32Rol = 0x77;
-let kExprI32Ror = 0x78;
-let kExprI64Clz = 0x79;
-let kExprI64Ctz = 0x7a;
-let kExprI64Popcnt = 0x7b;
-let kExprI64Add = 0x7c;
-let kExprI64Sub = 0x7d;
-let kExprI64Mul = 0x7e;
-let kExprI64DivS = 0x7f;
-let kExprI64DivU = 0x80;
-let kExprI64RemS = 0x81;
-let kExprI64RemU = 0x82;
-let kExprI64And = 0x83;
-let kExprI64Ior = 0x84;
-let kExprI64Xor = 0x85;
-let kExprI64Shl = 0x86;
-let kExprI64ShrS = 0x87;
-let kExprI64ShrU = 0x88;
-let kExprI64Rol = 0x89;
-let kExprI64Ror = 0x8a;
-let kExprF32Abs = 0x8b;
-let kExprF32Neg = 0x8c;
-let kExprF32Ceil = 0x8d;
-let kExprF32Floor = 0x8e;
-let kExprF32Trunc = 0x8f;
-let kExprF32NearestInt = 0x90;
-let kExprF32Sqrt = 0x91;
-let kExprF32Add = 0x92;
-let kExprF32Sub = 0x93;
-let kExprF32Mul = 0x94;
-let kExprF32Div = 0x95;
-let kExprF32Min = 0x96;
-let kExprF32Max = 0x97;
-let kExprF32CopySign = 0x98;
-let kExprF64Abs = 0x99;
-let kExprF64Neg = 0x9a;
-let kExprF64Ceil = 0x9b;
-let kExprF64Floor = 0x9c;
-let kExprF64Trunc = 0x9d;
-let kExprF64NearestInt = 0x9e;
-let kExprF64Sqrt = 0x9f;
-let kExprF64Add = 0xa0;
-let kExprF64Sub = 0xa1;
-let kExprF64Mul = 0xa2;
-let kExprF64Div = 0xa3;
-let kExprF64Min = 0xa4;
-let kExprF64Max = 0xa5;
-let kExprF64CopySign = 0xa6;
-let kExprI32ConvertI64 = 0xa7;
-let kExprI32SConvertF32 = 0xa8;
-let kExprI32UConvertF32 = 0xa9;
-let kExprI32SConvertF64 = 0xaa;
-let kExprI32UConvertF64 = 0xab;
-let kExprI64SConvertI32 = 0xac;
-let kExprI64UConvertI32 = 0xad;
-let kExprI64SConvertF32 = 0xae;
-let kExprI64UConvertF32 = 0xaf;
-let kExprI64SConvertF64 = 0xb0;
-let kExprI64UConvertF64 = 0xb1;
-let kExprF32SConvertI32 = 0xb2;
-let kExprF32UConvertI32 = 0xb3;
-let kExprF32SConvertI64 = 0xb4;
-let kExprF32UConvertI64 = 0xb5;
-let kExprF32ConvertF64 = 0xb6;
-let kExprF64SConvertI32 = 0xb7;
-let kExprF64UConvertI32 = 0xb8;
-let kExprF64SConvertI64 = 0xb9;
-let kExprF64UConvertI64 = 0xba;
-let kExprF64ConvertF32 = 0xbb;
-let kExprI32ReinterpretF32 = 0xbc;
-let kExprI64ReinterpretF64 = 0xbd;
-let kExprF32ReinterpretI32 = 0xbe;
-let kExprF64ReinterpretI64 = 0xbf;
-let kExprI32SExtendI8 = 0xc0;
-let kExprI32SExtendI16 = 0xc1;
-let kExprI64SExtendI8 = 0xc2;
-let kExprI64SExtendI16 = 0xc3;
-let kExprI64SExtendI32 = 0xc4;
-
-// Prefix opcodes
-let kNumericPrefix = 0xfc;
-let kSimdPrefix = 0xfd;
-let kAtomicPrefix = 0xfe;
-
-// Numeric opcodes.
-let kExprMemoryInit = 0x08;
-let kExprMemoryDrop = 0x09;
-let kExprMemoryCopy = 0x0a;
-let kExprMemoryFill = 0x0b;
-let kExprTableInit = 0x0c;
-let kExprTableDrop = 0x0d;
-let kExprTableCopy = 0x0e;
-
-// Atomic opcodes.
-let kExprAtomicWake = 0x00;
-let kExprI32AtomicWait = 0x01;
-let kExprI64AtomicWait = 0x02;
-let kExprI32AtomicLoad = 0x10;
-let kExprI32AtomicLoad8U = 0x12;
-let kExprI32AtomicLoad16U = 0x13;
-let kExprI32AtomicStore = 0x17;
-let kExprI32AtomicStore8U = 0x19;
-let kExprI32AtomicStore16U = 0x1a;
-let kExprI32AtomicAdd = 0x1e;
-let kExprI32AtomicAdd8U = 0x20;
-let kExprI32AtomicAdd16U = 0x21;
-let kExprI32AtomicSub = 0x25;
-let kExprI32AtomicSub8U = 0x27;
-let kExprI32AtomicSub16U = 0x28;
-let kExprI32AtomicAnd = 0x2c;
-let kExprI32AtomicAnd8U = 0x2e;
-let kExprI32AtomicAnd16U = 0x2f;
-let kExprI32AtomicOr = 0x33;
-let kExprI32AtomicOr8U = 0x35;
-let kExprI32AtomicOr16U = 0x36;
-let kExprI32AtomicXor = 0x3a;
-let kExprI32AtomicXor8U = 0x3c;
-let kExprI32AtomicXor16U = 0x3d;
-let kExprI32AtomicExchange = 0x41;
-let kExprI32AtomicExchange8U = 0x43;
-let kExprI32AtomicExchange16U = 0x44;
-let kExprI32AtomicCompareExchange = 0x48;
-let kExprI32AtomicCompareExchange8U = 0x4a;
-let kExprI32AtomicCompareExchange16U = 0x4b;
-
-let kExprI64AtomicLoad = 0x11;
-let kExprI64AtomicLoad8U = 0x14;
-let kExprI64AtomicLoad16U = 0x15;
-let kExprI64AtomicLoad32U = 0x16;
-let kExprI64AtomicStore = 0x18;
-let kExprI64AtomicStore8U = 0x1b;
-let kExprI64AtomicStore16U = 0x1c;
-let kExprI64AtomicStore32U = 0x1d;
-let kExprI64AtomicAdd = 0x1f;
-let kExprI64AtomicAdd8U = 0x22;
-let kExprI64AtomicAdd16U = 0x23;
-let kExprI64AtomicAdd32U = 0x24;
-let kExprI64AtomicSub = 0x26;
-let kExprI64AtomicSub8U = 0x29;
-let kExprI64AtomicSub16U = 0x2a;
-let kExprI64AtomicSub32U = 0x2b;
-let kExprI64AtomicAnd = 0x2d;
-let kExprI64AtomicAnd8U = 0x30;
-let kExprI64AtomicAnd16U = 0x31;
-let kExprI64AtomicAnd32U = 0x32;
-let kExprI64AtomicOr = 0x34;
-let kExprI64AtomicOr8U = 0x37;
-let kExprI64AtomicOr16U = 0x38;
-let kExprI64AtomicOr32U = 0x39;
-let kExprI64AtomicXor = 0x3b;
-let kExprI64AtomicXor8U = 0x3e;
-let kExprI64AtomicXor16U = 0x3f;
-let kExprI64AtomicXor32U = 0x40;
-let kExprI64AtomicExchange = 0x42;
-let kExprI64AtomicExchange8U = 0x45;
-let kExprI64AtomicExchange16U = 0x46;
-let kExprI64AtomicExchange32U = 0x47;
-let kExprI64AtomicCompareExchange = 0x49
-let kExprI64AtomicCompareExchange8U = 0x4c;
-let kExprI64AtomicCompareExchange16U = 0x4d;
-let kExprI64AtomicCompareExchange32U = 0x4e;
-
-// Simd opcodes.
-let kExprF32x4Min = 0x9e;
-
-let kTrapUnreachable = 0;
-let kTrapMemOutOfBounds = 1;
-let kTrapDivByZero = 2;
-let kTrapDivUnrepresentable = 3;
-let kTrapRemByZero = 4;
-let kTrapFloatUnrepresentable = 5;
-let kTrapFuncInvalid = 6;
-let kTrapFuncSigMismatch = 7;
-let kTrapTypeError = 8;
-let kTrapUnalignedAccess = 9;
-let kTrapDataSegmentDropped = 10;
-let kTrapElemSegmentDropped = 11;
-
-let kTrapMsgs = [
- "unreachable",
- "memory access out of bounds",
- "divide by zero",
- "divide result unrepresentable",
- "remainder by zero",
- "float unrepresentable in integer range",
- "invalid index into function table",
- "function signature mismatch",
- "wasm function signature contains illegal type",
- "operation does not support unaligned accesses",
- "data segment has been dropped",
- "element segment has been dropped"
-];
-
-function assertTraps(trap, code) {
- try {
- if (typeof code === 'function') {
- code();
- } else {
- eval(code);
- }
- } catch (e) {
- assertEquals('object', typeof e);
- assertEquals(kTrapMsgs[trap], e.message);
- // Success.
- return;
- }
- throw new MjsUnitAssertionError('Did not trap, expected: ' + kTrapMsgs[trap]);
-}
-
-function wasmI32Const(val) {
- let bytes = [kExprI32Const];
- for (let i = 0; i < 4; ++i) {
- bytes.push(0x80 | ((val >> (7 * i)) & 0x7f));
- }
- bytes.push((val >> (7 * 4)) & 0x7f);
- return bytes;
-}
-
-function wasmF32Const(f) {
- return [kExprF32Const].concat(Array.from(new Uint8Array((new Float32Array([f])).buffer)));
-}
-
-function wasmF64Const(f) {
- return [kExprF64Const].concat(Array.from(new Uint8Array((new Float64Array([f])).buffer)));
-}
diff --git a/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js b/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js
index 44bfedbfdb..3b1a333c7f 100644
--- a/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js
+++ b/deps/v8/test/mjsunit/wasm/wasm-math-intrinsic.js
@@ -4,7 +4,6 @@
// Flags: --expose-wasm --wasm-math-intrinsics
-load('test/mjsunit/wasm/wasm-constants.js');
load('test/mjsunit/wasm/wasm-module-builder.js');
function verbose(args) {
diff --git a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js
index b6959be23e..077ac51baa 100644
--- a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js
+++ b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js
@@ -4,10 +4,498 @@
// Used for encoding f32 and double constants to bits.
let __buffer = new ArrayBuffer(8);
-let byte_view = new Int8Array(__buffer);
+let byte_view = new Uint8Array(__buffer);
let f32_view = new Float32Array(__buffer);
let f64_view = new Float64Array(__buffer);
+// The bytes function receives one of
+// - several arguments, each of which is either a number or a string of length
+// 1; if it's a string, the charcode of the contained character is used.
+// - a single array argument containing the actual arguments
+// - a single string; the returned buffer will contain the char codes of all
+// contained characters.
+function bytes(...input) {
+ if (input.length == 1 && typeof input[0] == 'array') input = input[0];
+ if (input.length == 1 && typeof input[0] == 'string') {
+ let len = input[0].length;
+ let view = new Uint8Array(len);
+ for (let i = 0; i < len; i++) view[i] = input[0].charCodeAt(i);
+ return view.buffer;
+ }
+ let view = new Uint8Array(input.length);
+ for (let i = 0; i < input.length; i++) {
+ let val = input[i];
+ if (typeof val == 'string') {
+ assertEquals(1, val.length, 'string inputs must have length 1');
+ val = val.charCodeAt(0);
+ }
+ view[i] = val | 0;
+ }
+ return view.buffer;
+}
+
+// Header declaration constants
+var kWasmH0 = 0;
+var kWasmH1 = 0x61;
+var kWasmH2 = 0x73;
+var kWasmH3 = 0x6d;
+
+var kWasmV0 = 0x1;
+var kWasmV1 = 0;
+var kWasmV2 = 0;
+var kWasmV3 = 0;
+
+var kHeaderSize = 8;
+var kPageSize = 65536;
+var kSpecMaxPages = 65535;
+
+function bytesWithHeader(...input) {
+ const header =
+ [kWasmH0, kWasmH1, kWasmH2, kWasmH3, kWasmV0, kWasmV1, kWasmV2, kWasmV3];
+ return bytes(header + input);
+}
+
+let kDeclNoLocals = 0;
+
+// Section declaration constants
+let kUnknownSectionCode = 0;
+let kTypeSectionCode = 1; // Function signature declarations
+let kImportSectionCode = 2; // Import declarations
+let kFunctionSectionCode = 3; // Function declarations
+let kTableSectionCode = 4; // Indirect function table and other tables
+let kMemorySectionCode = 5; // Memory attributes
+let kGlobalSectionCode = 6; // Global declarations
+let kExportSectionCode = 7; // Exports
+let kStartSectionCode = 8; // Start function declaration
+let kElementSectionCode = 9; // Elements section
+let kCodeSectionCode = 10; // Function code
+let kDataSectionCode = 11; // Data segments
+let kDataCountSectionCode = 12; // Data segment count (between Element & Code)
+let kExceptionSectionCode = 13; // Exception section (between Global & Export)
+
+// Name section types
+let kModuleNameCode = 0;
+let kFunctionNamesCode = 1;
+let kLocalNamesCode = 2;
+
+let kWasmFunctionTypeForm = 0x60;
+let kWasmAnyFunctionTypeForm = 0x70;
+
+let kHasMaximumFlag = 1;
+let kSharedHasMaximumFlag = 3;
+
+// Segment flags
+let kActiveNoIndex = 0;
+let kPassive = 1;
+let kActiveWithIndex = 2;
+
+// Function declaration flags
+let kDeclFunctionName = 0x01;
+let kDeclFunctionImport = 0x02;
+let kDeclFunctionLocals = 0x04;
+let kDeclFunctionExport = 0x08;
+
+// Local types
+let kWasmStmt = 0x40;
+let kWasmI32 = 0x7f;
+let kWasmI64 = 0x7e;
+let kWasmF32 = 0x7d;
+let kWasmF64 = 0x7c;
+let kWasmS128 = 0x7b;
+let kWasmAnyRef = 0x6f;
+let kWasmAnyFunc = 0x70;
+let kWasmExceptRef = 0x68;
+
+let kExternalFunction = 0;
+let kExternalTable = 1;
+let kExternalMemory = 2;
+let kExternalGlobal = 3;
+let kExternalException = 4;
+
+let kTableZero = 0;
+let kMemoryZero = 0;
+let kSegmentZero = 0;
+
+let kExceptionAttribute = 0;
+
+// Useful signatures
+let kSig_i_i = makeSig([kWasmI32], [kWasmI32]);
+let kSig_l_l = makeSig([kWasmI64], [kWasmI64]);
+let kSig_i_l = makeSig([kWasmI64], [kWasmI32]);
+let kSig_i_ii = makeSig([kWasmI32, kWasmI32], [kWasmI32]);
+let kSig_i_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]);
+let kSig_v_iiii = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32], []);
+let kSig_f_ff = makeSig([kWasmF32, kWasmF32], [kWasmF32]);
+let kSig_d_dd = makeSig([kWasmF64, kWasmF64], [kWasmF64]);
+let kSig_l_ll = makeSig([kWasmI64, kWasmI64], [kWasmI64]);
+let kSig_i_dd = makeSig([kWasmF64, kWasmF64], [kWasmI32]);
+let kSig_v_v = makeSig([], []);
+let kSig_i_v = makeSig([], [kWasmI32]);
+let kSig_l_v = makeSig([], [kWasmI64]);
+let kSig_f_v = makeSig([], [kWasmF32]);
+let kSig_d_v = makeSig([], [kWasmF64]);
+let kSig_v_i = makeSig([kWasmI32], []);
+let kSig_v_ii = makeSig([kWasmI32, kWasmI32], []);
+let kSig_v_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], []);
+let kSig_v_l = makeSig([kWasmI64], []);
+let kSig_v_d = makeSig([kWasmF64], []);
+let kSig_v_dd = makeSig([kWasmF64, kWasmF64], []);
+let kSig_v_ddi = makeSig([kWasmF64, kWasmF64, kWasmI32], []);
+let kSig_ii_v = makeSig([], [kWasmI32, kWasmI32]);
+let kSig_iii_v = makeSig([], [kWasmI32, kWasmI32, kWasmI32]);
+let kSig_ii_i = makeSig([kWasmI32], [kWasmI32, kWasmI32]);
+let kSig_iii_i = makeSig([kWasmI32], [kWasmI32, kWasmI32, kWasmI32]);
+let kSig_ii_ii = makeSig([kWasmI32, kWasmI32], [kWasmI32, kWasmI32]);
+let kSig_iii_ii = makeSig([kWasmI32, kWasmI32], [kWasmI32, kWasmI32, kWasmI32]);
+
+let kSig_v_f = makeSig([kWasmF32], []);
+let kSig_f_f = makeSig([kWasmF32], [kWasmF32]);
+let kSig_f_d = makeSig([kWasmF64], [kWasmF32]);
+let kSig_d_d = makeSig([kWasmF64], [kWasmF64]);
+let kSig_r_r = makeSig([kWasmAnyRef], [kWasmAnyRef]);
+let kSig_a_a = makeSig([kWasmAnyFunc], [kWasmAnyFunc]);
+let kSig_i_r = makeSig([kWasmAnyRef], [kWasmI32]);
+let kSig_v_r = makeSig([kWasmAnyRef], []);
+let kSig_v_a = makeSig([kWasmAnyFunc], []);
+let kSig_v_rr = makeSig([kWasmAnyRef, kWasmAnyRef], []);
+let kSig_r_v = makeSig([], [kWasmAnyRef]);
+let kSig_a_v = makeSig([], [kWasmAnyFunc]);
+
+function makeSig(params, results) {
+ return {params: params, results: results};
+}
+
+function makeSig_v_x(x) {
+ return makeSig([x], []);
+}
+
+function makeSig_v_xx(x) {
+ return makeSig([x, x], []);
+}
+
+function makeSig_r_v(r) {
+ return makeSig([], [r]);
+}
+
+function makeSig_r_x(r, x) {
+ return makeSig([x], [r]);
+}
+
+function makeSig_r_xx(r, x) {
+ return makeSig([x, x], [r]);
+}
+
+// Opcodes
+let kExprUnreachable = 0x00;
+let kExprNop = 0x01;
+let kExprBlock = 0x02;
+let kExprLoop = 0x03;
+let kExprIf = 0x04;
+let kExprElse = 0x05;
+let kExprTry = 0x06;
+let kExprCatch = 0x07;
+let kExprThrow = 0x08;
+let kExprRethrow = 0x09;
+let kExprBrOnExn = 0x0a;
+let kExprEnd = 0x0b;
+let kExprBr = 0x0c;
+let kExprBrIf = 0x0d;
+let kExprBrTable = 0x0e;
+let kExprReturn = 0x0f;
+let kExprCallFunction = 0x10;
+let kExprCallIndirect = 0x11;
+let kExprReturnCall = 0x12;
+let kExprReturnCallIndirect = 0x13;
+let kExprDrop = 0x1a;
+let kExprSelect = 0x1b;
+let kExprGetLocal = 0x20;
+let kExprSetLocal = 0x21;
+let kExprTeeLocal = 0x22;
+let kExprGetGlobal = 0x23;
+let kExprSetGlobal = 0x24;
+let kExprGetTable = 0x25;
+let kExprSetTable = 0x26;
+let kExprI32LoadMem = 0x28;
+let kExprI64LoadMem = 0x29;
+let kExprF32LoadMem = 0x2a;
+let kExprF64LoadMem = 0x2b;
+let kExprI32LoadMem8S = 0x2c;
+let kExprI32LoadMem8U = 0x2d;
+let kExprI32LoadMem16S = 0x2e;
+let kExprI32LoadMem16U = 0x2f;
+let kExprI64LoadMem8S = 0x30;
+let kExprI64LoadMem8U = 0x31;
+let kExprI64LoadMem16S = 0x32;
+let kExprI64LoadMem16U = 0x33;
+let kExprI64LoadMem32S = 0x34;
+let kExprI64LoadMem32U = 0x35;
+let kExprI32StoreMem = 0x36;
+let kExprI64StoreMem = 0x37;
+let kExprF32StoreMem = 0x38;
+let kExprF64StoreMem = 0x39;
+let kExprI32StoreMem8 = 0x3a;
+let kExprI32StoreMem16 = 0x3b;
+let kExprI64StoreMem8 = 0x3c;
+let kExprI64StoreMem16 = 0x3d;
+let kExprI64StoreMem32 = 0x3e;
+let kExprMemorySize = 0x3f;
+let kExprMemoryGrow = 0x40;
+let kExprI32Const = 0x41;
+let kExprI64Const = 0x42;
+let kExprF32Const = 0x43;
+let kExprF64Const = 0x44;
+let kExprI32Eqz = 0x45;
+let kExprI32Eq = 0x46;
+let kExprI32Ne = 0x47;
+let kExprI32LtS = 0x48;
+let kExprI32LtU = 0x49;
+let kExprI32GtS = 0x4a;
+let kExprI32GtU = 0x4b;
+let kExprI32LeS = 0x4c;
+let kExprI32LeU = 0x4d;
+let kExprI32GeS = 0x4e;
+let kExprI32GeU = 0x4f;
+let kExprI64Eqz = 0x50;
+let kExprI64Eq = 0x51;
+let kExprI64Ne = 0x52;
+let kExprI64LtS = 0x53;
+let kExprI64LtU = 0x54;
+let kExprI64GtS = 0x55;
+let kExprI64GtU = 0x56;
+let kExprI64LeS = 0x57;
+let kExprI64LeU = 0x58;
+let kExprI64GeS = 0x59;
+let kExprI64GeU = 0x5a;
+let kExprF32Eq = 0x5b;
+let kExprF32Ne = 0x5c;
+let kExprF32Lt = 0x5d;
+let kExprF32Gt = 0x5e;
+let kExprF32Le = 0x5f;
+let kExprF32Ge = 0x60;
+let kExprF64Eq = 0x61;
+let kExprF64Ne = 0x62;
+let kExprF64Lt = 0x63;
+let kExprF64Gt = 0x64;
+let kExprF64Le = 0x65;
+let kExprF64Ge = 0x66;
+let kExprI32Clz = 0x67;
+let kExprI32Ctz = 0x68;
+let kExprI32Popcnt = 0x69;
+let kExprI32Add = 0x6a;
+let kExprI32Sub = 0x6b;
+let kExprI32Mul = 0x6c;
+let kExprI32DivS = 0x6d;
+let kExprI32DivU = 0x6e;
+let kExprI32RemS = 0x6f;
+let kExprI32RemU = 0x70;
+let kExprI32And = 0x71;
+let kExprI32Ior = 0x72;
+let kExprI32Xor = 0x73;
+let kExprI32Shl = 0x74;
+let kExprI32ShrS = 0x75;
+let kExprI32ShrU = 0x76;
+let kExprI32Rol = 0x77;
+let kExprI32Ror = 0x78;
+let kExprI64Clz = 0x79;
+let kExprI64Ctz = 0x7a;
+let kExprI64Popcnt = 0x7b;
+let kExprI64Add = 0x7c;
+let kExprI64Sub = 0x7d;
+let kExprI64Mul = 0x7e;
+let kExprI64DivS = 0x7f;
+let kExprI64DivU = 0x80;
+let kExprI64RemS = 0x81;
+let kExprI64RemU = 0x82;
+let kExprI64And = 0x83;
+let kExprI64Ior = 0x84;
+let kExprI64Xor = 0x85;
+let kExprI64Shl = 0x86;
+let kExprI64ShrS = 0x87;
+let kExprI64ShrU = 0x88;
+let kExprI64Rol = 0x89;
+let kExprI64Ror = 0x8a;
+let kExprF32Abs = 0x8b;
+let kExprF32Neg = 0x8c;
+let kExprF32Ceil = 0x8d;
+let kExprF32Floor = 0x8e;
+let kExprF32Trunc = 0x8f;
+let kExprF32NearestInt = 0x90;
+let kExprF32Sqrt = 0x91;
+let kExprF32Add = 0x92;
+let kExprF32Sub = 0x93;
+let kExprF32Mul = 0x94;
+let kExprF32Div = 0x95;
+let kExprF32Min = 0x96;
+let kExprF32Max = 0x97;
+let kExprF32CopySign = 0x98;
+let kExprF64Abs = 0x99;
+let kExprF64Neg = 0x9a;
+let kExprF64Ceil = 0x9b;
+let kExprF64Floor = 0x9c;
+let kExprF64Trunc = 0x9d;
+let kExprF64NearestInt = 0x9e;
+let kExprF64Sqrt = 0x9f;
+let kExprF64Add = 0xa0;
+let kExprF64Sub = 0xa1;
+let kExprF64Mul = 0xa2;
+let kExprF64Div = 0xa3;
+let kExprF64Min = 0xa4;
+let kExprF64Max = 0xa5;
+let kExprF64CopySign = 0xa6;
+let kExprI32ConvertI64 = 0xa7;
+let kExprI32SConvertF32 = 0xa8;
+let kExprI32UConvertF32 = 0xa9;
+let kExprI32SConvertF64 = 0xaa;
+let kExprI32UConvertF64 = 0xab;
+let kExprI64SConvertI32 = 0xac;
+let kExprI64UConvertI32 = 0xad;
+let kExprI64SConvertF32 = 0xae;
+let kExprI64UConvertF32 = 0xaf;
+let kExprI64SConvertF64 = 0xb0;
+let kExprI64UConvertF64 = 0xb1;
+let kExprF32SConvertI32 = 0xb2;
+let kExprF32UConvertI32 = 0xb3;
+let kExprF32SConvertI64 = 0xb4;
+let kExprF32UConvertI64 = 0xb5;
+let kExprF32ConvertF64 = 0xb6;
+let kExprF64SConvertI32 = 0xb7;
+let kExprF64UConvertI32 = 0xb8;
+let kExprF64SConvertI64 = 0xb9;
+let kExprF64UConvertI64 = 0xba;
+let kExprF64ConvertF32 = 0xbb;
+let kExprI32ReinterpretF32 = 0xbc;
+let kExprI64ReinterpretF64 = 0xbd;
+let kExprF32ReinterpretI32 = 0xbe;
+let kExprF64ReinterpretI64 = 0xbf;
+let kExprI32SExtendI8 = 0xc0;
+let kExprI32SExtendI16 = 0xc1;
+let kExprI64SExtendI8 = 0xc2;
+let kExprI64SExtendI16 = 0xc3;
+let kExprI64SExtendI32 = 0xc4;
+let kExprRefNull = 0xd0;
+let kExprRefIsNull = 0xd1;
+let kExprRefFunc = 0xd2;
+
+// Prefix opcodes
+let kNumericPrefix = 0xfc;
+let kSimdPrefix = 0xfd;
+let kAtomicPrefix = 0xfe;
+
+// Numeric opcodes.
+let kExprMemoryInit = 0x08;
+let kExprDataDrop = 0x09;
+let kExprMemoryCopy = 0x0a;
+let kExprMemoryFill = 0x0b;
+let kExprTableInit = 0x0c;
+let kExprElemDrop = 0x0d;
+let kExprTableCopy = 0x0e;
+
+// Atomic opcodes.
+let kExprAtomicWake = 0x00;
+let kExprI32AtomicWait = 0x01;
+let kExprI64AtomicWait = 0x02;
+let kExprI32AtomicLoad = 0x10;
+let kExprI32AtomicLoad8U = 0x12;
+let kExprI32AtomicLoad16U = 0x13;
+let kExprI32AtomicStore = 0x17;
+let kExprI32AtomicStore8U = 0x19;
+let kExprI32AtomicStore16U = 0x1a;
+let kExprI32AtomicAdd = 0x1e;
+let kExprI32AtomicAdd8U = 0x20;
+let kExprI32AtomicAdd16U = 0x21;
+let kExprI32AtomicSub = 0x25;
+let kExprI32AtomicSub8U = 0x27;
+let kExprI32AtomicSub16U = 0x28;
+let kExprI32AtomicAnd = 0x2c;
+let kExprI32AtomicAnd8U = 0x2e;
+let kExprI32AtomicAnd16U = 0x2f;
+let kExprI32AtomicOr = 0x33;
+let kExprI32AtomicOr8U = 0x35;
+let kExprI32AtomicOr16U = 0x36;
+let kExprI32AtomicXor = 0x3a;
+let kExprI32AtomicXor8U = 0x3c;
+let kExprI32AtomicXor16U = 0x3d;
+let kExprI32AtomicExchange = 0x41;
+let kExprI32AtomicExchange8U = 0x43;
+let kExprI32AtomicExchange16U = 0x44;
+let kExprI32AtomicCompareExchange = 0x48;
+let kExprI32AtomicCompareExchange8U = 0x4a;
+let kExprI32AtomicCompareExchange16U = 0x4b;
+
+let kExprI64AtomicLoad = 0x11;
+let kExprI64AtomicLoad8U = 0x14;
+let kExprI64AtomicLoad16U = 0x15;
+let kExprI64AtomicLoad32U = 0x16;
+let kExprI64AtomicStore = 0x18;
+let kExprI64AtomicStore8U = 0x1b;
+let kExprI64AtomicStore16U = 0x1c;
+let kExprI64AtomicStore32U = 0x1d;
+let kExprI64AtomicAdd = 0x1f;
+let kExprI64AtomicAdd8U = 0x22;
+let kExprI64AtomicAdd16U = 0x23;
+let kExprI64AtomicAdd32U = 0x24;
+let kExprI64AtomicSub = 0x26;
+let kExprI64AtomicSub8U = 0x29;
+let kExprI64AtomicSub16U = 0x2a;
+let kExprI64AtomicSub32U = 0x2b;
+let kExprI64AtomicAnd = 0x2d;
+let kExprI64AtomicAnd8U = 0x30;
+let kExprI64AtomicAnd16U = 0x31;
+let kExprI64AtomicAnd32U = 0x32;
+let kExprI64AtomicOr = 0x34;
+let kExprI64AtomicOr8U = 0x37;
+let kExprI64AtomicOr16U = 0x38;
+let kExprI64AtomicOr32U = 0x39;
+let kExprI64AtomicXor = 0x3b;
+let kExprI64AtomicXor8U = 0x3e;
+let kExprI64AtomicXor16U = 0x3f;
+let kExprI64AtomicXor32U = 0x40;
+let kExprI64AtomicExchange = 0x42;
+let kExprI64AtomicExchange8U = 0x45;
+let kExprI64AtomicExchange16U = 0x46;
+let kExprI64AtomicExchange32U = 0x47;
+let kExprI64AtomicCompareExchange = 0x49
+let kExprI64AtomicCompareExchange8U = 0x4c;
+let kExprI64AtomicCompareExchange16U = 0x4d;
+let kExprI64AtomicCompareExchange32U = 0x4e;
+
+// Simd opcodes.
+let kExprF32x4Min = 0x9e;
+
+let kTrapUnreachable = 0;
+let kTrapMemOutOfBounds = 1;
+let kTrapDivByZero = 2;
+let kTrapDivUnrepresentable = 3;
+let kTrapRemByZero = 4;
+let kTrapFloatUnrepresentable = 5;
+let kTrapFuncInvalid = 6;
+let kTrapFuncSigMismatch = 7;
+let kTrapTypeError = 8;
+let kTrapUnalignedAccess = 9;
+let kTrapDataSegmentDropped = 10;
+let kTrapElemSegmentDropped = 11;
+let kTrapTableOutOfBounds = 12;
+
+let kTrapMsgs = [
+ "unreachable",
+ "memory access out of bounds",
+ "divide by zero",
+ "divide result unrepresentable",
+ "remainder by zero",
+ "float unrepresentable in integer range",
+ "invalid index into function table",
+ "function signature mismatch",
+ "wasm function signature contains illegal type",
+ "operation does not support unaligned accesses",
+ "data segment has been dropped",
+ "element segment has been dropped",
+ "table access out of bounds"
+];
+
+function assertTraps(trap, code) {
+ assertThrows(code, WebAssembly.RuntimeError, kTrapMsgs[trap]);
+}
+
class Binary extends Array {
emit_u8(val) {
this.push(val);
@@ -37,6 +525,18 @@ class Binary extends Array {
}
}
+ emit_u64v(val) {
+ while (true) {
+ let v = val & 0xff;
+ val = val >>> 7;
+ if (val == 0) {
+ this.push(v);
+ break;
+ }
+ this.push(v | 0x80);
+ }
+ }
+
emit_bytes(data) {
for (let i = 0; i < data.length; i++) {
this.push(data[i] & 0xff);
@@ -163,21 +663,37 @@ class WasmGlobalBuilder {
}
}
+class WasmTableBuilder {
+ constructor(module, type, initial_size, max_size) {
+ this.module = module;
+ this.type = type;
+ this.initial_size = initial_size;
+ this.has_max = max_size != undefined;
+ this.max_size = max_size;
+ }
+
+ exportAs(name) {
+ this.module.exports.push({name: name, kind: kExternalTable,
+ index: this.index});
+ return this;
+ }
+}
+
class WasmModuleBuilder {
constructor() {
this.types = [];
this.imports = [];
this.exports = [];
this.globals = [];
+ this.tables = [];
this.exceptions = [];
this.functions = [];
- this.table_length_min = 0;
- this.table_length_max = undefined;
this.element_segments = [];
this.data_segments = [];
this.explicit = [];
this.num_imported_funcs = 0;
this.num_imported_globals = 0;
+ this.num_imported_tables = 0;
this.num_imported_exceptions = 0;
return this;
}
@@ -230,6 +746,16 @@ class WasmModuleBuilder {
return glob;
}
+ addTable(type, initial_size, max_size = undefined) {
+ if (type != kWasmAnyRef && type != kWasmAnyFunc) {
+ throw new Error('Tables must be of type kWasmAnyRef or kWasmAnyFunc');
+ }
+ let table = new WasmTableBuilder(this, type, initial_size, max_size);
+ table.index = this.tables.length + this.num_imported_tables;
+ this.tables.push(table);
+ return table;
+ }
+
addException(type) {
let type_index = (typeof type) == "number" ? type : this.addType(type);
let except_index = this.exceptions.length + this.num_imported_exceptions;
@@ -273,9 +799,13 @@ class WasmModuleBuilder {
}
addImportedTable(module, name, initial, maximum) {
+ if (this.tables.length != 0) {
+ throw new Error('Imported tables must be declared before local ones');
+ }
let o = {module: module, name: name, kind: kExternalTable, initial: initial,
maximum: maximum};
this.imports.push(o);
+ return this.num_imported_tables++;
}
addImportedException(module, name, type) {
@@ -314,15 +844,19 @@ class WasmModuleBuilder {
}
addElementSegment(base, is_global, array, is_import = false) {
+ if (this.tables.length + this.num_imported_tables == 0) {
+ this.addTable(kWasmAnyFunc, 0);
+ }
this.element_segments.push({base: base, is_global: is_global,
array: array, is_active: true});
if (!is_global) {
var length = base + array.length;
- if (length > this.table_length_min && !is_import) {
- this.table_length_min = length;
+ if (!is_import && length > this.tables[0].initial_size) {
+ this.tables[0].initial_size = length;
}
- if (length > this.table_length_max && !is_import) {
- this.table_length_max = length;
+ if (!is_import && this.tables[0].has_max &&
+ length > this.tables[0].max_size) {
+ this.tables[0].max_size = length;
}
}
return this;
@@ -338,12 +872,17 @@ class WasmModuleBuilder {
if (typeof n != 'number')
throw new Error('invalid table (entries have to be numbers): ' + array);
}
- return this.addElementSegment(this.table_length_min, false, array);
+ if (this.tables.length == 0) {
+ this.addTable(kWasmAnyFunc, 0);
+ }
+ return this.addElementSegment(this.tables[0].initial_size, false, array);
}
setTableBounds(min, max = undefined) {
- this.table_length_min = min;
- this.table_length_max = max;
+ if (this.tables.length != 0) {
+ throw new Error("The table bounds of table '0' have already been set.");
+ }
+ this.addTable(kWasmAnyFunc, min, max);
return this;
}
@@ -430,16 +969,16 @@ class WasmModuleBuilder {
}
// Add table section
- if (wasm.table_length_min > 0) {
- if (debug) print("emitting table @ " + binary.length);
+ if (wasm.tables.length > 0) {
+ if (debug) print ("emitting tables @ " + binary.length);
binary.emit_section(kTableSectionCode, section => {
- section.emit_u8(1); // one table entry
- section.emit_u8(kWasmAnyFunctionTypeForm);
- const max = wasm.table_length_max;
- const has_max = max !== undefined;
- section.emit_u8(has_max ? kHasMaximumFlag : 0);
- section.emit_u32v(wasm.table_length_min);
- if (has_max) section.emit_u32v(max);
+ section.emit_u32v(wasm.tables.length);
+ for (let table of wasm.tables) {
+ section.emit_u8(table.type);
+ section.emit_u8(table.has_max);
+ section.emit_u32v(table.initial_size);
+ if (table.has_max) section.emit_u32v(table.max_size);
+ }
});
}
@@ -452,9 +991,9 @@ class WasmModuleBuilder {
const is_shared = wasm.memory.shared !== undefined;
// Emit flags (bit 0: reszeable max, bit 1: shared memory)
if (is_shared) {
- section.emit_u8(has_max ? 3 : 2);
+ section.emit_u8(has_max ? kSharedHasMaximumFlag : 2);
} else {
- section.emit_u8(has_max ? 1 : 0);
+ section.emit_u8(has_max ? kHasMaximumFlag : 0);
}
section.emit_u32v(wasm.memory.min);
if (has_max) section.emit_u32v(wasm.memory.max);
@@ -478,7 +1017,7 @@ class WasmModuleBuilder {
break;
case kWasmI64:
section.emit_u8(kExprI64Const);
- section.emit_u32v(global.init);
+ section.emit_u64v(global.init);
break;
case kWasmF32:
section.emit_u8(kExprF32Const);
@@ -563,6 +1102,7 @@ class WasmModuleBuilder {
for (let init of inits) {
if (init.is_active) {
+ // Active segment.
section.emit_u8(0); // table index / flags
if (init.is_global) {
section.emit_u8(kExprGetGlobal);
@@ -571,12 +1111,25 @@ class WasmModuleBuilder {
}
section.emit_u32v(init.base);
section.emit_u8(kExprEnd);
+ section.emit_u32v(init.array.length);
+ for (let index of init.array) {
+ section.emit_u32v(index);
+ }
} else {
+ // Passive segment.
section.emit_u8(kPassive); // flags
- }
- section.emit_u32v(init.array.length);
- for (let index of init.array) {
- section.emit_u32v(index);
+ section.emit_u8(kWasmAnyFunc);
+ section.emit_u32v(init.array.length);
+ for (let index of init.array) {
+ if (index === null) {
+ section.emit_u8(kExprRefNull);
+ section.emit_u8(kExprEnd);
+ } else {
+ section.emit_u8(kExprRefFunc);
+ section.emit_u32v(index);
+ section.emit_u8(kExprEnd);
+ }
+ }
}
}
});
@@ -617,6 +1170,9 @@ class WasmModuleBuilder {
if (l.anyref_count > 0) {
local_decls.push({count: l.anyref_count, type: kWasmAnyRef});
}
+ if (l.anyfunc_count > 0) {
+ local_decls.push({count: l.anyfunc_count, type: kWasmAnyFunc});
+ }
if (l.except_count > 0) {
local_decls.push({count: l.except_count, type: kWasmExceptRef});
}
@@ -732,6 +1288,10 @@ class WasmModuleBuilder {
return buffer;
}
+ toUint8Array(debug = false) {
+ return new Uint8Array(this.toBuffer(debug));
+ }
+
instantiate(ffi) {
let module = new WebAssembly.Module(this.toBuffer());
let instance = new WebAssembly.Instance(module, ffi);
@@ -747,3 +1307,23 @@ class WasmModuleBuilder {
return new WebAssembly.Module(this.toBuffer(debug));
}
}
+
+function wasmI32Const(val) {
+ let bytes = [kExprI32Const];
+ for (let i = 0; i < 4; ++i) {
+ bytes.push(0x80 | ((val >> (7 * i)) & 0x7f));
+ }
+ bytes.push((val >> (7 * 4)) & 0x7f);
+ return bytes;
+}
+
+function wasmF32Const(f) {
+ f32_view[0] = f;
+ return [kExprF32Const, byte_view[0], byte_view[1], byte_view[2], byte_view[3]];
+}
+
+function wasmF64Const(f) {
+ f64_view[0] = f;
+ return [kExprF64Const, byte_view[0], byte_view[1], byte_view[2], byte_view[3],
+ byte_view[4], byte_view[5], byte_view[6], byte_view[7]];
+}
diff --git a/deps/v8/test/mjsunit/wasm/worker-interpreter.js b/deps/v8/test/mjsunit/wasm/worker-interpreter.js
index 9bc1e1e11c..ccf6d279a0 100644
--- a/deps/v8/test/mjsunit/wasm/worker-interpreter.js
+++ b/deps/v8/test/mjsunit/wasm/worker-interpreter.js
@@ -4,7 +4,6 @@
// Flags: --allow-natives-syntax --no-wasm-disable-structured-cloning
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestPostInterpretedModule() {
diff --git a/deps/v8/test/mjsunit/wasm/worker-module.js b/deps/v8/test/mjsunit/wasm/worker-module.js
index b60b19571b..f626263b25 100644
--- a/deps/v8/test/mjsunit/wasm/worker-module.js
+++ b/deps/v8/test/mjsunit/wasm/worker-module.js
@@ -4,7 +4,6 @@
// Flags: --wasm-shared-engine --no-wasm-disable-structured-cloning
-load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
(function TestPostModule() {
diff --git a/deps/v8/test/mkgrokdump/mkgrokdump.cc b/deps/v8/test/mkgrokdump/mkgrokdump.cc
index 5582fd2b75..8c30c653cd 100644
--- a/deps/v8/test/mkgrokdump/mkgrokdump.cc
+++ b/deps/v8/test/mkgrokdump/mkgrokdump.cc
@@ -8,7 +8,7 @@
#include "include/v8.h"
#include "src/frames.h"
-#include "src/heap/heap.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/spaces.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
@@ -16,7 +16,7 @@
namespace v8 {
static const char* kHeader =
- "# Copyright 2018 the V8 project authors. All rights reserved.\n"
+ "# Copyright 2019 the V8 project authors. All rights reserved.\n"
"# Use of this source code is governed by a BSD-style license that can\n"
"# be found in the LICENSE file.\n"
"\n"
diff --git a/deps/v8/test/mkgrokdump/mkgrokdump.status b/deps/v8/test/mkgrokdump/mkgrokdump.status
index 110cf6d15e..62453ad979 100644
--- a/deps/v8/test/mkgrokdump/mkgrokdump.status
+++ b/deps/v8/test/mkgrokdump/mkgrokdump.status
@@ -9,4 +9,9 @@
'*': [SKIP],
}], # variant != default or arch != x64 or lite_mode
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
+
]
diff --git a/deps/v8/test/mkgrokdump/testcfg.py b/deps/v8/test/mkgrokdump/testcfg.py
index d8f0380e75..0a20dc9839 100644
--- a/deps/v8/test/mkgrokdump/testcfg.py
+++ b/deps/v8/test/mkgrokdump/testcfg.py
@@ -11,6 +11,12 @@ from testrunner.outproc import mkgrokdump
SHELL = 'mkgrokdump'
+
+class TestLoader(testsuite.TestLoader):
+ def _list_test_filenames(self):
+ yield SHELL
+
+#TODO(tmrts): refactor the test creation logic to migrate to TestLoader
class TestSuite(testsuite.TestSuite):
def __init__(self, *args, **kwargs):
super(TestSuite, self).__init__(*args, **kwargs)
@@ -18,9 +24,8 @@ class TestSuite(testsuite.TestSuite):
v8_path = os.path.dirname(os.path.dirname(os.path.abspath(self.root)))
self.expected_path = os.path.join(v8_path, 'tools', 'v8heapconst.py')
- def ListTests(self):
- test = self._create_test(SHELL)
- return [test]
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/mozilla/mozilla.status b/deps/v8/test/mozilla/mozilla.status
index c7dd68db3b..4fef899227 100644
--- a/deps/v8/test/mozilla/mozilla.status
+++ b/deps/v8/test/mozilla/mozilla.status
@@ -1037,4 +1037,9 @@
'*': [SKIP],
}], # variant == no_wasm_traps
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
+
]
diff --git a/deps/v8/test/mozilla/testcfg.py b/deps/v8/test/mozilla/testcfg.py
index 3727fccef3..6d1a44782d 100644
--- a/deps/v8/test/mozilla/testcfg.py
+++ b/deps/v8/test/mozilla/testcfg.py
@@ -32,54 +32,55 @@ from testrunner.local import testsuite
from testrunner.objects import testcase
from testrunner.outproc import mozilla
-EXCLUDED = ["CVS", ".svn"]
-
+EXCLUDED = [
+ "CVS",
+ ".svn",
+]
+
+FRAMEWORK = [
+ "browser.js",
+ "shell.js",
+ "jsref.js",
+ "template.js",
+]
+
+TEST_DIRS = [
+ "ecma",
+ "ecma_2",
+ "ecma_3",
+ "js1_1",
+ "js1_2",
+ "js1_3",
+ "js1_4",
+ "js1_5",
+]
+
+class TestLoader(testsuite.JSTestLoader):
+ @property
+ def excluded_files(self):
+ return set(FRAMEWORK)
-FRAMEWORK = """
- browser.js
- shell.js
- jsref.js
- template.js
-""".split()
+ @property
+ def excluded_dirs(self):
+ return set(EXCLUDED)
+ @property
+ def test_dirs(self):
+ return TEST_DIRS
-TEST_DIRS = """
- ecma
- ecma_2
- ecma_3
- js1_1
- js1_2
- js1_3
- js1_4
- js1_5
-""".split()
+ def _to_relpath(self, abspath, _):
+ # TODO: refactor this by setting the test path during the TestCase creation
+ return os.path.relpath(abspath, self.test_root)
class TestSuite(testsuite.TestSuite):
def __init__(self, *args, **kwargs):
super(TestSuite, self).__init__(*args, **kwargs)
- self.testroot = os.path.join(self.root, "data")
-
- def ListTests(self):
- tests = []
- for testdir in TEST_DIRS:
- current_root = os.path.join(self.testroot, testdir)
- for dirname, dirs, files in os.walk(current_root):
- for dotted in [x for x in dirs if x.startswith(".")]:
- dirs.remove(dotted)
- for excluded in EXCLUDED:
- if excluded in dirs:
- dirs.remove(excluded)
- dirs.sort()
- files.sort()
- for filename in files:
- if filename.endswith(".js") and not filename in FRAMEWORK:
- fullpath = os.path.join(dirname, filename)
- relpath = fullpath[len(self.testroot) + 1 : -3]
- testname = relpath.replace(os.path.sep, "/")
- case = self._create_test(testname)
- tests.append(case)
- return tests
+ self.test_root = os.path.join(self.root, "data")
+ self._test_loader.test_root = self.test_root
+
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
@@ -89,22 +90,22 @@ class TestCase(testcase.D8TestCase):
def _get_files_params(self):
files = [os.path.join(self.suite.root, "mozilla-shell-emulation.js")]
testfilename = self.path + ".js"
- testfilepath = testfilename.split("/")
+ testfilepath = testfilename.split(os.path.sep)
for i in xrange(len(testfilepath)):
- script = os.path.join(self.suite.testroot,
+ script = os.path.join(self.suite.test_root,
reduce(os.path.join, testfilepath[:i], ""),
"shell.js")
if os.path.exists(script):
files.append(script)
- files.append(os.path.join(self.suite.testroot, testfilename))
+ files.append(os.path.join(self.suite.test_root, testfilename))
return files
def _get_suite_flags(self):
return ['--expose-gc']
def _get_source_path(self):
- return os.path.join(self.suite.testroot, self.path + self._get_suffix())
+ return os.path.join(self.suite.test_root, self.path + self._get_suffix())
@property
def output_proc(self):
@@ -117,6 +118,5 @@ class TestCase(testcase.D8TestCase):
return mozilla.OutProc(self.expected_outcomes)
-
def GetSuite(*args, **kwargs):
return TestSuite(*args, **kwargs)
diff --git a/deps/v8/test/preparser/preparser.status b/deps/v8/test/preparser/preparser.status
index 43049d46e0..792c416433 100644
--- a/deps/v8/test/preparser/preparser.status
+++ b/deps/v8/test/preparser/preparser.status
@@ -28,4 +28,9 @@
[
[ALWAYS, {
}], # ALWAYS
+
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
]
diff --git a/deps/v8/test/preparser/testcfg.py b/deps/v8/test/preparser/testcfg.py
index 11e6135444..0567564278 100644
--- a/deps/v8/test/preparser/testcfg.py
+++ b/deps/v8/test/preparser/testcfg.py
@@ -37,6 +37,14 @@ class VariantsGenerator(testsuite.VariantsGenerator):
return self._standard_variant
+class TestLoader(testsuite.TestLoader):
+ def _list_test_filenames(self):
+ for file in os.listdir(self.suite.root):
+ if file.endswith(".pyt"):
+ yield file[:-4]
+
+
+# TODO(tmrts): refactor the python template parsing then use the TestLoader.
class TestSuite(testsuite.TestSuite):
def _ParsePythonTestTemplates(self, result, filename):
pathname = os.path.join(self.root, filename + ".pyt")
@@ -63,16 +71,20 @@ class TestSuite(testsuite.TestSuite):
def ListTests(self):
result = []
- # Find all .pyt files in this directory.
- filenames = [f[:-4] for f in os.listdir(self.root) if f.endswith(".pyt")]
- filenames.sort()
- for f in filenames:
+ filenames = self._test_loader._list_test_filenames()
+ for f in sorted(filenames):
self._ParsePythonTestTemplates(result, f)
+
+ # TODO: remove after converting to use a full TestLoader
+ self._test_loader.test_count_estimation = len(result)
return result
def _create_test(self, path, source, template_flags):
- return super(TestSuite, self)._create_test(
- path, source=source, template_flags=template_flags)
+ return self._test_loader._create_test(
+ path, self, source=source, template_flags=template_flags)
+
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/test262/local-tests/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js b/deps/v8/test/test262/local-tests/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js
deleted file mode 100644
index 430dbdf369..0000000000
--- a/deps/v8/test/test262/local-tests/test/built-ins/TypedArray/prototype/set/typedarray-arg-src-byteoffset-internal.js
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2017 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-/*---
-esid: sec-%typedarray%.prototype.set-typedarray-offset
-description: >
- Uses typedArray's internal [[ByteOffset]]
-info: >
- 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
- 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
- the definition in 22.2.3.23.1 applies.
- ...
- 21. Let srcByteOffset be typedArray.[[ByteOffset]].
- ...
-includes: [testTypedArray.js]
----*/
-
-var getCalls = 0;
-var desc = {
- get: function getLen() {
- getCalls++;
- return 0;
- }
-};
-
-Object.defineProperty(TypedArray.prototype, "byteOffset", desc);
-
-testWithTypedArrayConstructors(function(TA) {
- var sample = new TA(2);
- var src = new TA([42, 43]);
- var differentTA = TA === Uint8Array ? Int8Array : Uint8Array;
- var src2 = new differentTA([42, 43]);
- var src3 = new differentTA(sample.buffer, 0, 2);
-
- Object.defineProperty(TA.prototype, "byteOffset", desc);
- Object.defineProperty(src, "byteOffset", desc);
- Object.defineProperty(src2, "byteOffset", desc);
- Object.defineProperty(src3, "byteOffset", desc);
-
- sample.set(src);
- sample.set(src2);
- sample.set(src3);
-
- assert.sameValue(getCalls, 0, "ignores byteOffset properties");
-});
diff --git a/deps/v8/test/test262/local-tests/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js b/deps/v8/test/test262/local-tests/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js
deleted file mode 100644
index ab49f66a98..0000000000
--- a/deps/v8/test/test262/local-tests/test/built-ins/TypedArray/prototype/set/typedarray-arg-target-byteoffset-internal.js
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright 2017 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-/*---
-esid: sec-%typedarray%.prototype.set-typedarray-offset
-description: >
- Uses target's internal [[ArrayLength]]
-info: >
- 22.2.3.23.2 %TypedArray%.prototype.set(typedArray [ , offset ] )
- 1. Assert: typedArray has a [[TypedArrayName]] internal slot. If it does not,
- the definition in 22.2.3.23.1 applies.
- 2. Let target be the this value.
- ...
- 16. Let targetByteOffset be target.[[ByteOffset]].
- ...
-includes: [testTypedArray.js]
----*/
-
-var getCalls = 0;
-var desc = {
- get: function() {
- getCalls++;
- return 0;
- }
-};
-
-Object.defineProperty(TypedArray.prototype, "byteOffset", desc);
-
-testWithTypedArrayConstructors(function(TA) {
- var sample = new TA(2);
- var src = new TA([42, 43]);
- var differentTA = TA === Uint8Array ? Int8Array : Uint8Array;
- var src2 = new differentTA([42, 43]);
- var src3 = new differentTA(sample.buffer, 0, 2);
-
- Object.defineProperty(TA.prototype, "byteOffset", desc);
- Object.defineProperty(sample, "byteOffset", desc);
-
- sample.set(src);
- sample.set(src2);
- sample.set(src3);
-
- assert.sameValue(getCalls, 0, "ignores byteoffset properties");
-});
diff --git a/deps/v8/test/test262/local-tests/test/intl402/NumberFormat/fraction-digit-options-read-once.js b/deps/v8/test/test262/local-tests/test/intl402/NumberFormat/fraction-digit-options-read-once.js
deleted file mode 100644
index e7e37b8735..0000000000
--- a/deps/v8/test/test262/local-tests/test/intl402/NumberFormat/fraction-digit-options-read-once.js
+++ /dev/null
@@ -1,18 +0,0 @@
-// Copyright 2017 the V8 project authors. All rights reserved.
-// This code is governed by the license found in the LICENSE file.
-
-/*---
-esid: ECMA-402 #sec-setnfdigitoptions
-description: >
- The maximum and minimum fraction digits properties should be read from
- the options bag exactly once from the NumberFormat constructor.
- Regression test for https://bugs.chromium.org/p/v8/issues/detail?id=6015
-include: [assert.js]
----*/
-
-var minCounter = 0;
-var maxCounter = 0;
-new Intl.NumberFormat("en", { get minimumFractionDigits() { minCounter++ },
- get maximumFractionDigits() { maxCounter++ } });
-assert.sameValue(1, minCounter);
-assert.sameValue(1, maxCounter);
diff --git a/deps/v8/test/test262/local-tests/test/intl402/NumberFormat/prototype/formatToParts/default-parameter.js b/deps/v8/test/test262/local-tests/test/intl402/NumberFormat/prototype/formatToParts/default-parameter.js
deleted file mode 100644
index 408694c48c..0000000000
--- a/deps/v8/test/test262/local-tests/test/intl402/NumberFormat/prototype/formatToParts/default-parameter.js
+++ /dev/null
@@ -1,30 +0,0 @@
-// Copyright (C) 2017 Josh Wolfe. All rights reserved.
-// This code is governed by the BSD license found in the LICENSE file.
-/*---
-esid: #sec-intl.numberformat.prototype.formattoparts
-description: Intl.NumberFormat.prototype.formatToParts called with no parameters
-info: >
- Intl.NumberFormat.prototype.formatToParts ([ value ])
-
- 3. If value is not provided, let value be undefined.
----*/
-
-var nf = new Intl.NumberFormat();
-
-// Example value: [{"type":"nan","value":"NaN"}]
-var implicit = nf.formatToParts();
-var explicit = nf.formatToParts(undefined);
-
-assert(partsEquals(implicit, explicit),
- "formatToParts() should be equivalent to formatToParts(undefined)");
-
-function partsEquals(parts1, parts2) {
- if (parts1.length !== parts2.length) return false;
- for (var i = 0; i < parts1.length; i++) {
- var part1 = parts1[i];
- var part2 = parts2[i];
- if (part1.type !== part2.type) return false;
- if (part1.value !== part2.value) return false;
- }
- return true;
-}
diff --git a/deps/v8/test/test262/test262.status b/deps/v8/test/test262/test262.status
index d547824b12..a1237a0848 100644
--- a/deps/v8/test/test262/test262.status
+++ b/deps/v8/test/test262/test262.status
@@ -84,6 +84,11 @@
'language/expressions/prefix-increment/S11.4.4_A5_*': [FAIL],
'language/statements/variable/binding-resolution': [FAIL],
+ # https://code.google.com/p/v8/issues/detail?id=8771
+ 'language/computed-property-names/class/static/method-number': [FAIL],
+ 'language/computed-property-names/class/static/method-string': [FAIL],
+ 'language/computed-property-names/class/static/method-symbol': [FAIL],
+
# https://bugs.chromium.org/p/v8/issues/detail?id=4895
'built-ins/TypedArrayConstructors/internals/DefineOwnProperty/detached-buffer': [FAIL],
'built-ins/TypedArrayConstructors/internals/DefineOwnProperty/BigInt/detached-buffer': [FAIL],
@@ -138,9 +143,6 @@
'built-ins/DataView/prototype/byteLength/detached-buffer': [FAIL],
'built-ins/DataView/prototype/byteOffset/detached-buffer': [FAIL],
- # https://bugs.chromium.org/p/v8/issues/detail?id=4231
- 'language/eval-code/direct/var-env-lower-lex-catch-non-strict': [FAIL],
-
# https://bugs.chromium.org/p/v8/issues/detail?id=4951
'language/expressions/assignment/destructuring/iterator-destructuring-property-reference-target-evaluation-order': [FAIL],
'language/expressions/assignment/destructuring/keyed-destructuring-property-reference-target-evaluation-order': [FAIL],
@@ -374,9 +376,6 @@
'language/literals/regexp/u-unicode-esc-non-hex': [FAIL_PHASE_ONLY],
'language/literals/regexp/unicode-escape-nls-err': [FAIL_PHASE_ONLY],
- # https://bugs.chromium.org/p/v8/issues/detail?id=7829
- 'language/block-scope/syntax/redeclaration/function-declaration-attempt-to-redeclare-with-var-declaration-nested-in-function': [FAIL],
-
# https://bugs.chromium.org/p/v8/issues/detail?id=4628
'language/eval-code/direct/non-definable-function-with-function': [FAIL],
'language/eval-code/direct/non-definable-function-with-variable': [FAIL],
@@ -489,80 +488,28 @@
'built-ins/Object/internals/DefineOwnProperty/consistent-value-function-caller': [FAIL_SLOPPY],
'built-ins/Object/internals/DefineOwnProperty/consistent-value-function-arguments': [FAIL_SLOPPY],
- # https://bugs.chromium.org/p/v8/issues/detail?id=6776
- 'built-ins/Proxy/ownKeys/return-duplicate-entries-throws': [FAIL],
- 'built-ins/Proxy/ownKeys/return-duplicate-symbol-entries-throws': [FAIL],
-
# https://bugs.chromium.org/p/v8/issues/detail?id=7184
'annexB/language/expressions/yield/star-iterable-return-emulates-undefined-throws-when-called': [FAIL],
'annexB/language/statements/for-await-of/iterator-close-return-emulates-undefined-throws-when-called': [FAIL],
'annexB/language/statements/for-of/iterator-close-return-emulates-undefined-throws-when-called': [FAIL],
- # https://bugs.chromium.org/p/v8/issues/detail?id=7468
- 'language/statements/class/elements/privatename-not-valid-earlyerr-script-8': [SKIP],
-
# https://bugs.chromium.org/p/v8/issues/detail?id=5690
'language/expressions/call/eval-spread': [FAIL],
'language/expressions/call/eval-spread-empty-leading': [FAIL],
'language/expressions/call/eval-spread-empty-trailing': [FAIL],
- # https://bugs.chromium.org/p/v8/issues/detail?id=8717
- 'intl402/Segmenter/constructor/constructor/options-granularity-valid': [FAIL],
- 'intl402/Segmenter/constructor/constructor/options-lineBreakStyle-invalid': [FAIL],
- 'intl402/Segmenter/constructor/constructor/options-lineBreakStyle-valid': [FAIL],
- 'intl402/Segmenter/constructor/constructor/options-order': [FAIL],
- 'intl402/Segmenter/constructor/constructor/options-throwing-getters': [FAIL],
- 'intl402/Segmenter/constructor/constructor/options-toobject-prototype': [FAIL],
- 'intl402/Segmenter/constructor/constructor/options-valid-combinations': [FAIL],
- 'intl402/Segmenter/iterator/granularity': [FAIL],
- 'intl402/Segmenter/prototype/resolvedOptions/order': [FAIL],
- 'intl402/Segmenter/prototype/resolvedOptions/type-with-lbs': [FAIL],
- 'intl402/Segmenter/prototype/segment/segment-line': [FAIL],
- 'intl402/Segmenter/prototype/segment/segment-line-following': [FAIL],
- 'intl402/Segmenter/prototype/segment/segment-line-following-modes': [FAIL],
- 'intl402/Segmenter/prototype/segment/segment-line-iterable': [FAIL],
- 'intl402/Segmenter/prototype/segment/segment-line-next': [FAIL],
- 'intl402/Segmenter/prototype/segment/segment-line-preceding': [FAIL],
+ # https://bugs.chromium.org/p/v8/issues/detail?id=8664
+ 'intl402/Collator/missing-unicode-ext-value-defaults-to-true': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=7472
'intl402/NumberFormat/currency-digits': [FAIL],
- # https://bugs.chromium.org/p/v8/issues/detail?id=7482
- 'intl402/DateTimeFormat/prototype/resolvedOptions/resolved-locale-with-hc-unicode': [FAIL],
+ # https://bugs.chromium.org/p/v8/issues/detail?id=8849
+ 'intl402/Intl/getCanonicalLocales/non-iana-canon': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=7483
'annexB/built-ins/Function/createdynfn-html-close-comment-params': [FAIL],
- # https://bugs.chromium.org/p/v8/issues/detail?id=8260
- 'intl402/Locale/constructor-non-iana-canon': [FAIL],
-
- # https://bugs.chromium.org/p/v8/issues/detail?id=8261
- 'intl402/Locale/constructor-options-language-valid': [FAIL],
-
- # https://bugs.chromium.org/p/v8/issues/detail?id=8262
- 'intl402/Locale/constructor-parse-twice': [FAIL],
-
- # https://bugs.chromium.org/p/v8/issues/detail?id=8246
- 'intl402/Locale/constructor-tag': [FAIL],
-
- # https://bugs.chromium.org/p/v8/issues/detail?id=8243
- 'intl402/Locale/extensions-private': [FAIL],
- 'intl402/Locale/getters-privateuse': [FAIL],
-
- # https://bugs.chromium.org/p/v8/issues/detail?id=8236
- 'intl402/Locale/likely-subtags': [FAIL],
-
- # https://bugs.chromium.org/p/v8/issues/detail?id=8242
- 'intl402/Locale/extensions-grandfathered': [FAIL],
- 'intl402/Locale/getters-grandfathered': [FAIL],
- 'intl402/Locale/likely-subtags-grandfathered': [FAIL],
-
- # https://bugs.chromium.org/p/v8/issues/detail?id=8613
- 'intl402/RelativeTimeFormat/prototype/resolvedOptions/order': [FAIL],
-
- # https://bugs.chromium.org/p/v8/issues/detail?id=6705
- 'built-ins/Object/assign/strings-and-symbol-order': [FAIL],
-
# https://bugs.chromium.org/p/v8/issues/detail?id=7831
'language/statements/generators/generator-created-after-decl-inst': [FAIL],
'language/expressions/generators/generator-created-after-decl-inst': [FAIL],
@@ -575,15 +522,6 @@
'language/expressions/await/for-await-of-interleaved': ['--harmony-await-optimization'],
'language/expressions/await/async-await-interleaved': ['--harmony-await-optimization'],
- # https://bugs.chromium.org/p/v8/issues/detail?id=8706
- 'language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-function': [FAIL],
- 'language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-async-generator': [FAIL],
- 'language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-class': [FAIL],
- 'language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-const': [FAIL],
- 'language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-function': [FAIL],
- 'language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-generator': [FAIL],
- 'language/block-scope/syntax/redeclaration/fn-scope-var-name-redeclaration-attempt-with-let' : [FAIL],
-
# https://github.com/tc39/test262/issues/2033
'language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall': [SKIP],
'language/expressions/class/elements/private-derived-cls-direct-eval-err-contains-supercall-1': [SKIP],
@@ -616,44 +554,37 @@
'language/expressions/prefix-increment/eval': [SKIP],
'language/expressions/prefix-increment/eval-nostrict': [SKIP],
- # https://bugs.chromium.org/p/v8/issues/detail?id=8707
- 'language/line-terminators/invalid-string-ls': [SKIP],
- 'language/line-terminators/invalid-string-ps': [SKIP],
-
- # https://github.com/tc39/proposal-class-fields/issues/215
- 'language/expressions/class/elements/syntax/early-errors/invalid-names/method-inner-call-expression-bad-reference': [FAIL],
- 'language/expressions/class/elements/syntax/early-errors/invalid-names/method-inner-call-expression-this': [FAIL],
- 'language/expressions/class/elements/syntax/early-errors/invalid-names/method-inner-member-expression-bad-reference': [FAIL],
- 'language/expressions/class/elements/syntax/early-errors/invalid-names/method-inner-member-expression-this': [FAIL],
- 'language/statements/class/elements/syntax/early-errors/invalid-names/method-inner-call-expression-bad-reference': [FAIL],
- 'language/statements/class/elements/syntax/early-errors/invalid-names/method-inner-call-expression-this': [FAIL],
- 'language/statements/class/elements/syntax/early-errors/invalid-names/method-inner-member-expression-bad-reference': [FAIL],
- 'language/statements/class/elements/syntax/early-errors/invalid-names/method-inner-member-expression-this': [FAIL],
- 'language/expressions/function/early-errors/invalid-names-call-expression-bad-reference': [FAIL],
- 'language/expressions/function/early-errors/invalid-names-call-expression-this': [FAIL],
- 'language/expressions/function/early-errors/invalid-names-member-expression-bad-reference': [FAIL],
- 'language/expressions/function/early-errors/invalid-names-member-expression-this': [FAIL],
- 'language/statements/function/early-errors/invalid-names-call-expression-bad-reference': [FAIL],
- 'language/statements/function/early-errors/invalid-names-call-expression-this': [FAIL],
- 'language/statements/function/early-errors/invalid-names-member-expression-bad-reference': [FAIL],
- 'language/statements/function/early-errors/invalid-names-member-expression-this': [FAIL],
+ # https://bugs.chromium.org/p/v8/issues/detail?id=8850
+ 'language/comments/hashbang/escaped-bang-041': [SKIP],
+ 'language/comments/hashbang/escaped-bang-u0021': [SKIP],
+ 'language/comments/hashbang/escaped-bang-u21': [SKIP],
+ 'language/comments/hashbang/escaped-bang-x21': [SKIP],
+ 'language/comments/hashbang/escaped-hash-043': [SKIP],
+ 'language/comments/hashbang/escaped-hash-u0023': [SKIP],
+ 'language/comments/hashbang/escaped-hash-u23': [SKIP],
+ 'language/comments/hashbang/escaped-hash-x23': [SKIP],
+ 'language/comments/hashbang/escaped-hashbang': [SKIP],
+ 'language/comments/hashbang/eval': [SKIP],
+ 'language/comments/hashbang/eval-indirect': [SKIP],
+ 'language/comments/hashbang/module': [SKIP],
+ 'language/comments/hashbang/multi-line-comment': [SKIP],
+ 'language/comments/hashbang/no-line-separator': [SKIP],
+ 'language/comments/hashbang/not-empty': [SKIP],
+ 'language/comments/hashbang/preceding-directive-prologue': [SKIP],
+ 'language/comments/hashbang/preceding-directive-prologue-sc': [SKIP],
+ 'language/comments/hashbang/preceding-empty-statement': [SKIP],
+ 'language/comments/hashbang/preceding-hashbang': [SKIP],
+ 'language/comments/hashbang/preceding-line-comment': [SKIP],
+ 'language/comments/hashbang/preceding-multi-line-comment': [SKIP],
+ 'language/comments/hashbang/preceding-whitespace': [SKIP],
+ 'language/comments/hashbang/use-strict': [SKIP],
######################## NEEDS INVESTIGATION ###########################
- # These test failures are specific to the intl402 suite and need investigation
- # to be either marked as bugs with issues filed for them or as deliberate
- # incompatibilities if the test cases turn out to be broken or ambiguous.
- # Some of these are related to v8:4361 in being visible side effects from Intl.
-
# https://bugs.chromium.org/p/v8/issues/detail?id=7833
'built-ins/Atomics/wait/cannot-suspend-throws': [SKIP],
'built-ins/Atomics/wait/undefined-index-defaults-to-zero': [SKIP],
- # https://bugs.chromium.org/p/v8/issues/detail?id=8258
- 'intl402/Locale/constructor-options-language-valid-undefined': [FAIL],
- 'intl402/NumberFormat/prototype/format/format-fraction-digits-precision': [FAIL],
- 'intl402/NumberFormat/prototype/format/format-significant-digits-precision': [FAIL],
-
##################### DELIBERATE INCOMPATIBILITIES #####################
# https://github.com/tc39/ecma262/pull/889
@@ -661,24 +592,6 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=6538
- # https://bugs.chromium.org/p/v8/issues/detail?id=6541
- 'language/export/escaped-as-export-specifier': [FAIL],
- 'language/export/escaped-from': [FAIL],
- 'language/expressions/object/method-definition/escaped-get': [FAIL],
- 'language/expressions/object/method-definition/escaped-set': [FAIL],
- 'language/import/escaped-as-import-specifier': [FAIL],
- 'language/import/escaped-as-namespace-import': [FAIL],
- 'language/import/escaped-from': [FAIL],
- 'language/statements/for-await-of/escaped-of': [FAIL],
- 'language/statements/for-of/escaped-of': [FAIL],
-
- # https://bugs.chromium.org/p/v8/issues/detail?id=6543
- 'language/statements/labeled/value-await-non-module-escaped': [FAIL],
- 'language/statements/labeled/value-yield-non-strict-escaped': [FAIL],
- 'language/expressions/async-arrow-function/escaped-async-line-terminator': [FAIL],
- 'language/expressions/class/class-name-ident-await-escaped': [FAIL],
- 'language/statements/class/class-name-ident-await-escaped': [FAIL],
-
############################ INVALID TESTS #############################
# Test makes unjustified assumptions about the number of calls to SortCompare.
@@ -1336,6 +1249,21 @@
'built-ins/SharedArrayBuffer/length-is-too-large-throws': [SKIP],
}], # asan == True or msan == True or tsan == True
+['variant == interpreted_regexp', {
+ # Call stack exceeded: https://crbug.com/v8/8678
+ 'built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u': [SKIP],
+ 'built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u': [SKIP],
+ 'built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u': [SKIP],
+}], # variant == interpreted_regexp
+
+##############################################################################
+['variant == jitless', {
+ # https://crbug.com/v8/7777
+ 'built-ins/RegExp/CharacterClassEscapes/character-class-non-digit-class-escape-plus-quantifier-flags-u': [SKIP],
+ 'built-ins/RegExp/CharacterClassEscapes/character-class-non-whitespace-class-escape-plus-quantifier-flags-u': [SKIP],
+ 'built-ins/RegExp/CharacterClassEscapes/character-class-non-word-class-escape-plus-quantifier-flags-u': [SKIP],
+}], # variant == jitless
+
['variant == no_wasm_traps', {
'*': [SKIP],
}], # variant == no_wasm_traps
@@ -1350,4 +1278,9 @@
'intl402/DateTimeFormat/prototype/resolvedOptions/basic': [SKIP],
}], # system == windows
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
+
]
diff --git a/deps/v8/test/test262/testcfg.py b/deps/v8/test/test262/testcfg.py
index 6674abbfce..54311e952c 100644
--- a/deps/v8/test/test262/testcfg.py
+++ b/deps/v8/test/test262/testcfg.py
@@ -46,20 +46,17 @@ FEATURE_FLAGS = {
'class-static-fields-public': '--harmony-class-fields',
'class-fields-private': '--harmony-private-fields',
'class-static-fields-private': '--harmony-private-fields',
- 'Array.prototype.flat': '--harmony-array-flat',
- 'Array.prototype.flatMap': '--harmony-array-flat',
'String.prototype.matchAll': '--harmony-string-matchall',
'Symbol.matchAll': '--harmony-string-matchall',
'numeric-separator-literal': '--harmony-numeric-separator',
- 'Intl.ListFormat': '--harmony-intl-list-format',
'Intl.Locale': '--harmony-locale',
- 'Intl.RelativeTimeFormat': '--harmony-intl-relative-time-format',
'Intl.Segmenter': '--harmony-intl-segmenter',
'Symbol.prototype.description': '--harmony-symbol-description',
'globalThis': '--harmony-global',
'well-formed-json-stringify': '--harmony-json-stringify',
'export-star-as-namespace-from-module': '--harmony-namespace-exports',
'Object.fromEntries': '--harmony-object-from-entries',
+ 'hashbang': '--harmony-hashbang',
}
SKIPPED_FEATURES = set(['class-methods-private',
@@ -76,9 +73,6 @@ TEST_262_HARNESS_PATH = ["data", "harness"]
TEST_262_TOOLS_PATH = ["harness", "src"]
TEST_262_LOCAL_TESTS_PATH = ["local-tests", "test"]
-TEST_262_RELPATH_REGEXP = re.compile(
- r'.*[\\/]test[\\/]test262[\\/][^\\/]+[\\/]test[\\/](.*)\.js')
-
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),
*TEST_262_TOOLS_PATH))
@@ -106,18 +100,38 @@ class VariantsGenerator(testsuite.VariantsGenerator):
yield (variant, flags + ['--use-strict'], 'strict-%d' % n + phase_var)
-class TestSuite(testsuite.TestSuite):
- # Match the (...) in '/path/to/v8/test/test262/subdir/test/(...).js'
- # In practice, subdir is data or local-tests
+class TestLoader(testsuite.JSTestLoader):
+ @property
+ def test_dirs(self):
+ return [
+ self.test_root,
+ os.path.join(self.suite.root, *TEST_262_LOCAL_TESTS_PATH),
+ ]
+ @property
+ def excluded_suffixes(self):
+ return {"_FIXTURE.js"}
+
+ @property
+ def excluded_dirs(self):
+ return {"intl402"} if self.test_config.noi18n else set()
+
+ def _should_filter_by_test(self, test):
+ features = test.test_record.get("features", [])
+ return SKIPPED_FEATURES.intersection(features)
+
+
+class TestSuite(testsuite.TestSuite):
def __init__(self, *args, **kwargs):
super(TestSuite, self).__init__(*args, **kwargs)
- self.testroot = os.path.join(self.root, *TEST_262_SUITE_PATH)
+ self.test_root = os.path.join(self.root, *TEST_262_SUITE_PATH)
+ # TODO: this makes the TestLoader mutable, refactor it.
+ self._test_loader.test_root = self.test_root
self.harnesspath = os.path.join(self.root, *TEST_262_HARNESS_PATH)
self.harness = [os.path.join(self.harnesspath, f)
for f in TEST_262_HARNESS_FILES]
self.harness += [os.path.join(self.root, "harness-adapt.js")]
- self.localtestroot = os.path.join(self.root, *TEST_262_LOCAL_TESTS_PATH)
+ self.local_test_root = os.path.join(self.root, *TEST_262_LOCAL_TESTS_PATH)
self.parse_test_record = self._load_parse_test_record()
def _load_parse_test_record(self):
@@ -135,28 +149,8 @@ class TestSuite(testsuite.TestSuite):
if f:
f.close()
- def ListTests(self):
- testnames = set()
- for dirname, dirs, files in itertools.chain(os.walk(self.testroot),
- os.walk(self.localtestroot)):
- for dotted in [x for x in dirs if x.startswith(".")]:
- dirs.remove(dotted)
- if self.test_config.noi18n and "intl402" in dirs:
- dirs.remove("intl402")
- dirs.sort()
- files.sort()
- for filename in files:
- if not filename.endswith(".js"):
- continue
- if filename.endswith("_FIXTURE.js"):
- continue
- fullpath = os.path.join(dirname, filename)
- relpath = re.match(TEST_262_RELPATH_REGEXP, fullpath).group(1)
- testnames.add(relpath.replace(os.path.sep, "/"))
- cases = map(self._create_test, testnames)
- return [case for case in cases if len(
- SKIPPED_FEATURES.intersection(
- case.test_record.get("features", []))) == 0]
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
@@ -198,11 +192,15 @@ class TestCase(testcase.D8TestCase):
def _fail_phase_reverse(self):
return 'fail-phase-reverse' in self.procid
+ def __needs_harness_agent(self):
+ tokens = self.path.split(os.path.sep)
+ return tokens[:2] == ["built-ins", "Atomics"]
+
def _get_files_params(self):
return (
list(self.suite.harness) +
([os.path.join(self.suite.root, "harness-agent.js")]
- if self.path.startswith('built-ins/Atomics') else []) +
+ if self.__needs_harness_agent() else []) +
([os.path.join(self.suite.root, "harness-adapt-donotevaluate.js")]
if self.fail_phase_only and not self._fail_phase_reverse else []) +
self._get_includes() +
@@ -233,10 +231,10 @@ class TestCase(testcase.D8TestCase):
def _get_source_path(self):
filename = self.path + self._get_suffix()
- path = os.path.join(self.suite.localtestroot, filename)
+ path = os.path.join(self.suite.local_test_root, filename)
if os.path.exists(path):
return path
- return os.path.join(self.suite.testroot, filename)
+ return os.path.join(self.suite.test_root, filename)
@property
def output_proc(self):
diff --git a/deps/v8/test/torque/test-torque.tq b/deps/v8/test/torque/test-torque.tq
index 59b1c3895f..f81552292a 100644
--- a/deps/v8/test/torque/test-torque.tq
+++ b/deps/v8/test/torque/test-torque.tq
@@ -30,8 +30,8 @@ namespace test {
}
macro LabelTestHelper3(): never
- labels Label3(String, Smi) {
- goto Label3('foo', 7);
+ labels Label3(Oddball, Smi) {
+ goto Label3(Null, 7);
}
macro TestConstexpr1() {
@@ -74,8 +74,8 @@ namespace test {
try {
LabelTestHelper3() otherwise Label3;
}
- label Label3(str: String, smi: Smi) {
- check(str == 'foo');
+ label Label3(o: Oddball, smi: Smi) {
+ check(o == Null);
check(smi == 7);
return True;
}
@@ -156,7 +156,6 @@ namespace test {
check(GenericMacroTest<Object>(True) == True);
check((GenericMacroTestWithLabels<Smi>(0) otherwise Fail) == Undefined);
check((GenericMacroTestWithLabels<Smi>(0) otherwise Fail) == Undefined);
- check((GenericMacroTestWithLabels<Object>(smi0) otherwise Fail) == smi0);
try {
GenericMacroTestWithLabels<Object>(False) otherwise Expected;
}
@@ -413,6 +412,11 @@ namespace test {
label Exit {
check(j == 10);
}
+
+ // Test if we can handle uninitialized values on the stack.
+ let i: Smi;
+ for (let j: Smi = 0; j < 10; ++j) {
+ }
}
macro TestSubtyping(x: Smi) {
@@ -494,6 +498,15 @@ namespace test {
check(UnsafeCast<Smi>(ExampleGenericOverload<Object>(xObject)) == 5);
}
+ macro TestEquality(implicit context: Context)() {
+ const notEqual: bool =
+ AllocateHeapNumberWithValue(0.5) != AllocateHeapNumberWithValue(0.5);
+ check(!notEqual);
+ const equal: bool =
+ AllocateHeapNumberWithValue(0.5) == AllocateHeapNumberWithValue(0.5);
+ check(equal);
+ }
+
macro BoolToBranch(x: bool): never
labels Taken, NotTaken {
if (x) {
@@ -633,7 +646,7 @@ namespace test {
macro TestCatch1(implicit context: Context)(): Smi {
let r: Smi = 0;
try {
- ThrowTypeError(context, kInvalidArrayLength);
+ ThrowTypeError(kInvalidArrayLength);
} catch (e) {
r = 1;
return r;
@@ -641,7 +654,7 @@ namespace test {
}
macro TestCatch2Wrapper(implicit context: Context)(): never {
- ThrowTypeError(context, kInvalidArrayLength);
+ ThrowTypeError(kInvalidArrayLength);
}
macro TestCatch2(implicit context: Context)(): Smi {
@@ -656,7 +669,7 @@ namespace test {
macro TestCatch3WrapperWithLabel(implicit context: Context)(): never
labels Abort {
- ThrowTypeError(context, kInvalidArrayLength);
+ ThrowTypeError(kInvalidArrayLength);
}
macro TestCatch3(implicit context: Context)(): Smi {
@@ -714,7 +727,7 @@ namespace test {
}
macro TestNew(implicit context: Context)() {
- const f: JSArray = new JSArray{};
+ const f: JSArray = NewJSArray();
assert(f.IsEmpty());
f.length = 0;
}
@@ -736,19 +749,6 @@ namespace test {
c: int32;
}
- struct TestCustomStructConstructor {
- constructor(x: int32, y: Smi) {
- this.a = x;
- this.c = x;
- this.b = y;
- this.d = y;
- }
- a: int32;
- b: Smi;
- c: int32;
- d: Smi;
- }
-
macro TestStructConstructor(implicit context: Context)() {
// Test default constructor
let a: TestOuter = TestOuter{5, TestInner{6, 7}, 8};
@@ -761,11 +761,63 @@ namespace test {
a.b.SetX(2);
assert(a.b.x == 2);
assert(a.b.GetX() == 2);
- // Test custom constructor
- let w: TestCustomStructConstructor = TestCustomStructConstructor{1, 2};
- assert(w.a == 1);
- assert(w.b == 2);
- assert(w.c == 1);
- assert(w.d == 2);
+ }
+
+ extern class TestClassWithAllTypes extends JSObject {
+ a: int8;
+ b: uint8;
+ b2: uint8;
+ b3: uint8;
+ c: int16;
+ d: uint16;
+ e: int32;
+ f: uint32;
+ g: RawPtr;
+ h: intptr;
+ i: uintptr;
+ }
+
+ macro TestClassWithAllTypesLoadsAndStores(
+ t: TestClassWithAllTypes, r: RawPtr, v1: int8, v2: uint8, v3: int16,
+ v4: uint16) {
+ t.a = v1;
+ t.b = v2;
+ t.c = v3;
+ t.d = v4;
+ t.e = 0;
+ t.f = 0;
+ t.g = r;
+ t.h = 0;
+ t.i = 0;
+ t.a = t.a;
+ t.b = t.b;
+ t.c = t.c;
+ t.d = t.d;
+ t.e = t.e;
+ t.f = t.f;
+ t.g = t.g;
+ t.h = t.h;
+ t.i = t.i;
+ }
+
+ class InternalClass {
+ Flip() labels NotASmi {
+ const tmp = Cast<Smi>(this.b) otherwise NotASmi;
+ this.b = this.a;
+ this.a = tmp;
+ }
+ a: Smi;
+ b: Number;
+ }
+
+ macro NewInternalClass(x: Smi): InternalClass {
+ return new InternalClass{x, x + 1};
+ }
+
+ macro TestInternalClass(implicit context: Context)() {
+ const o = NewInternalClass(5);
+ o.Flip() otherwise unreachable;
+ check(o.a == 6);
+ check(o.b == 5);
}
}
diff --git a/deps/v8/test/unittests/BUILD.gn b/deps/v8/test/unittests/BUILD.gn
index 77d503c7d4..2da7849073 100644
--- a/deps/v8/test/unittests/BUILD.gn
+++ b/deps/v8/test/unittests/BUILD.gn
@@ -150,6 +150,7 @@ v8_source_set("unittests_sources") {
"eh-frame-iterator-unittest.cc",
"eh-frame-writer-unittest.cc",
"heap/barrier-unittest.cc",
+ "heap/bitmap-test-utils.h",
"heap/bitmap-unittest.cc",
"heap/embedder-tracing-unittest.cc",
"heap/gc-idle-time-handler-unittest.cc",
@@ -198,7 +199,10 @@ v8_source_set("unittests_sources") {
"test-utils.cc",
"test-utils.h",
"torque/earley-parser-unittest.cc",
+ "torque/ls-json-unittest.cc",
+ "torque/ls-message-unittest.cc",
"torque/torque-unittest.cc",
+ "torque/torque-utils-unittest.cc",
"unicode-unittest.cc",
"utils-unittest.cc",
"value-serializer-unittest.cc",
@@ -214,7 +218,6 @@ v8_source_set("unittests_sources") {
"wasm/wasm-macro-gen-unittest.cc",
"wasm/wasm-module-builder-unittest.cc",
"wasm/wasm-opcodes-unittest.cc",
- "zone/segmentpool-unittest.cc",
"zone/zone-allocator-unittest.cc",
"zone/zone-chunk-list-unittest.cc",
"zone/zone-unittest.cc",
@@ -286,6 +289,7 @@ v8_source_set("unittests_sources") {
]
deps = [
+ "..:common_test_headers",
"../..:v8_for_testing",
"../..:v8_libbase",
"../..:v8_libplatform",
diff --git a/deps/v8/test/unittests/background-compile-task-unittest.cc b/deps/v8/test/unittests/background-compile-task-unittest.cc
index 5bb6b68285..2577a974fe 100644
--- a/deps/v8/test/unittests/background-compile-task-unittest.cc
+++ b/deps/v8/test/unittests/background-compile-task-unittest.cc
@@ -18,6 +18,7 @@
#include "src/parsing/parser.h"
#include "src/parsing/preparse-data.h"
#include "src/v8.h"
+#include "src/zone/zone-list-inl.h"
#include "test/unittests/test-helpers.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
diff --git a/deps/v8/test/unittests/base/functional-unittest.cc b/deps/v8/test/unittests/base/functional-unittest.cc
index 207d5cbdd7..857a9de5de 100644
--- a/deps/v8/test/unittests/base/functional-unittest.cc
+++ b/deps/v8/test/unittests/base/functional-unittest.cc
@@ -64,8 +64,7 @@ typedef ::testing::Types<signed char, unsigned char,
int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t,
int64_t, uint64_t, float, double> FunctionalTypes;
-TYPED_TEST_CASE(FunctionalTest, FunctionalTypes);
-
+TYPED_TEST_SUITE(FunctionalTest, FunctionalTypes);
TYPED_TEST(FunctionalTest, EqualToImpliesSameHashCode) {
hash<TypeParam> h;
diff --git a/deps/v8/test/unittests/base/template-utils-unittest.cc b/deps/v8/test/unittests/base/template-utils-unittest.cc
index 42917e0ffc..0819b3de8c 100644
--- a/deps/v8/test/unittests/base/template-utils-unittest.cc
+++ b/deps/v8/test/unittests/base/template-utils-unittest.cc
@@ -32,7 +32,7 @@ TEST(TemplateUtilsTest, MakeArraySimple) {
namespace {
constexpr int doubleIntValue(int i) { return i * 2; }
-}; // namespace
+} // namespace
TEST(TemplateUtilsTest, MakeArrayConstexpr) {
constexpr auto computed_array = base::make_array<3>(doubleIntValue);
diff --git a/deps/v8/test/unittests/base/utils/random-number-generator-unittest.cc b/deps/v8/test/unittests/base/utils/random-number-generator-unittest.cc
index 38c14cd96c..6099cd5a59 100644
--- a/deps/v8/test/unittests/base/utils/random-number-generator-unittest.cc
+++ b/deps/v8/test/unittests/base/utils/random-number-generator-unittest.cc
@@ -244,9 +244,9 @@ TEST_P(RandomNumberGeneratorTest, NextSampleSlowExcludedMax2) {
}
}
-INSTANTIATE_TEST_CASE_P(RandomSeeds, RandomNumberGeneratorTest,
- ::testing::Values(INT_MIN, -1, 0, 1, 42, 100,
- 1234567890, 987654321, INT_MAX));
+INSTANTIATE_TEST_SUITE_P(RandomSeeds, RandomNumberGeneratorTest,
+ ::testing::Values(INT_MIN, -1, 0, 1, 42, 100,
+ 1234567890, 987654321, INT_MAX));
} // namespace base
} // namespace v8
diff --git a/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc b/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc
index 0f918e3a07..1bad7fed10 100644
--- a/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc
+++ b/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc
@@ -20,6 +20,7 @@
#include "src/parsing/parse-info.h"
#include "src/parsing/parsing.h"
#include "src/v8.h"
+#include "src/zone/zone-list-inl.h"
#include "test/unittests/test-helpers.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -292,7 +293,7 @@ class MockPlatform : public v8::Platform {
void PostDelayedTask(std::unique_ptr<Task> task,
double delay_in_seconds) override {
UNREACHABLE();
- };
+ }
void PostIdleTask(std::unique_ptr<IdleTask> task) override {
DCHECK(IdleTasksEnabled());
@@ -301,7 +302,7 @@ class MockPlatform : public v8::Platform {
platform_->idle_task_ = task.release();
}
- bool IdleTasksEnabled() override { return true; };
+ bool IdleTasksEnabled() override { return true; }
private:
MockPlatform* platform_;
diff --git a/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc b/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc
index 77a1587f0b..95be442f0e 100644
--- a/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc
+++ b/deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc
@@ -530,10 +530,8 @@ TEST_P(InstructionSelectorDPITest, BranchIfNotZeroWithImmediate) {
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorDPITest,
- ::testing::ValuesIn(kDPIs));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorDPITest,
+ ::testing::ValuesIn(kDPIs));
// -----------------------------------------------------------------------------
// Data processing instructions with overflow.
@@ -1031,10 +1029,8 @@ TEST_P(InstructionSelectorODPITest, BranchIfNotZeroWithParameters) {
EXPECT_EQ(kOverflow, s[0]->flags_condition());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorODPITest,
- ::testing::ValuesIn(kODPIs));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorODPITest,
+ ::testing::ValuesIn(kODPIs));
// -----------------------------------------------------------------------------
// Shifts.
@@ -1248,10 +1244,8 @@ TEST_P(InstructionSelectorShiftTest,
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorShiftTest,
- ::testing::ValuesIn(kShifts));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorShiftTest,
+ ::testing::ValuesIn(kShifts));
// -----------------------------------------------------------------------------
// Memory access instructions.
@@ -1400,10 +1394,9 @@ TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) {
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessTest,
- ::testing::ValuesIn(kMemoryAccesses));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessTest,
+ ::testing::ValuesIn(kMemoryAccesses));
TEST_F(InstructionSelectorMemoryAccessTest, LoadWithShiftedIndex) {
TRACED_FORRANGE(int, immediate_shift, 1, 31) {
@@ -1572,11 +1565,9 @@ TEST_P(InstructionSelectorComparisonTest, Word32EqualWithZero) {
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorComparisonTest,
- ::testing::ValuesIn(kComparisons));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorComparisonTest,
+ ::testing::ValuesIn(kComparisons));
// -----------------------------------------------------------------------------
// Floating point comparisons.
@@ -1659,11 +1650,9 @@ TEST_P(InstructionSelectorF32ComparisonTest, WithImmediateZeroOnLeft) {
EXPECT_EQ(cmp.commuted_flags_condition, s[0]->flags_condition());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorF32ComparisonTest,
- ::testing::ValuesIn(kF32Comparisons));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorF32ComparisonTest,
+ ::testing::ValuesIn(kF32Comparisons));
namespace {
@@ -1742,11 +1731,9 @@ TEST_P(InstructionSelectorF64ComparisonTest, WithImmediateZeroOnLeft) {
EXPECT_EQ(cmp.commuted_flags_condition, s[0]->flags_condition());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorF64ComparisonTest,
- ::testing::ValuesIn(kF64Comparisons));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorF64ComparisonTest,
+ ::testing::ValuesIn(kF64Comparisons));
// -----------------------------------------------------------------------------
// Floating point arithmetic.
@@ -1774,10 +1761,8 @@ TEST_P(InstructionSelectorFAITest, Parameters) {
EXPECT_EQ(kFlags_none, s[0]->flags_mode());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFAITest,
- ::testing::ValuesIn(kFAIs));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorFAITest,
+ ::testing::ValuesIn(kFAIs));
TEST_F(InstructionSelectorTest, Float32Abs) {
StreamBuilder m(this, MachineType::Float32(), MachineType::Float32());
@@ -2208,9 +2193,9 @@ TEST_P(InstructionSelectorFlagSettingTest, CommuteShift) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorFlagSettingTest,
- ::testing::ValuesIn(kFlagSettingInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorFlagSettingTest,
+ ::testing::ValuesIn(kFlagSettingInstructions));
// -----------------------------------------------------------------------------
// Miscellaneous.
diff --git a/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc b/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
index bca04a5cf3..c5f9645766 100644
--- a/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
+++ b/deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc
@@ -496,10 +496,9 @@ TEST_P(InstructionSelectorLogicalTest, ShiftByImmediate) {
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorLogicalTest,
- ::testing::ValuesIn(kLogicalInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorLogicalTest,
+ ::testing::ValuesIn(kLogicalInstructions));
// -----------------------------------------------------------------------------
// Add and Sub instructions.
@@ -651,10 +650,8 @@ TEST_P(InstructionSelectorAddSubTest, SignedExtendHalfword) {
ASSERT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorAddSubTest,
- ::testing::ValuesIn(kAddSubInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorAddSubTest,
+ ::testing::ValuesIn(kAddSubInstructions));
TEST_F(InstructionSelectorTest, AddImmediateOnLeft) {
{
@@ -1010,11 +1007,9 @@ TEST_P(InstructionSelectorDPFlagSetTest, BranchWithParameters) {
EXPECT_EQ(kNotEqual, s[0]->flags_condition());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorDPFlagSetTest,
- ::testing::ValuesIn(kDPFlagSetInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorDPFlagSetTest,
+ ::testing::ValuesIn(kDPFlagSetInstructions));
TEST_F(InstructionSelectorTest, Word32AndBranchWithImmediateOnRight) {
TRACED_FOREACH(int32_t, imm, kLogical32Immediates) {
@@ -1282,9 +1277,9 @@ TEST_P(InstructionSelectorTestAndBranchTest, TestAndBranch32) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorTestAndBranchTest,
- ::testing::ValuesIn(kTestAndBranchMatchers32));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorTestAndBranchTest,
+ ::testing::ValuesIn(kTestAndBranchMatchers32));
TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnRight) {
TRACED_FORRANGE(int, bit, 0, 63) {
@@ -1761,10 +1756,9 @@ TEST_P(InstructionSelectorOvfAddSubTest, RORShift) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorOvfAddSubTest,
- ::testing::ValuesIn(kOvfAddSubInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorOvfAddSubTest,
+ ::testing::ValuesIn(kOvfAddSubInstructions));
TEST_F(InstructionSelectorTest, OvfFlagAddImmediateOnLeft) {
TRACED_FOREACH(int32_t, imm, kAddSubImmediates) {
@@ -1879,10 +1873,8 @@ TEST_P(InstructionSelectorShiftTest, Immediate) {
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorShiftTest,
- ::testing::ValuesIn(kShiftInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorShiftTest,
+ ::testing::ValuesIn(kShiftInstructions));
TEST_F(InstructionSelectorTest, Word64ShlWithChangeInt32ToInt64) {
TRACED_FORRANGE(int64_t, x, 32, 63) {
@@ -1972,10 +1964,8 @@ TEST_P(InstructionSelectorMulDivTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorMulDivTest,
- ::testing::ValuesIn(kMulDivInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorMulDivTest,
+ ::testing::ValuesIn(kMulDivInstructions));
namespace {
@@ -2080,11 +2070,9 @@ TEST_P(InstructionSelectorIntDPWithIntMulTest, NegativeMul) {
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorIntDPWithIntMulTest,
- ::testing::ValuesIn(kMulDPInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorIntDPWithIntMulTest,
+ ::testing::ValuesIn(kMulDPInstructions));
TEST_F(InstructionSelectorTest, Int32MulWithImmediate) {
// x * (2^k + 1) -> x + (x << k)
@@ -2368,10 +2356,9 @@ TEST_P(InstructionSelectorFPArithTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFPArithTest,
- ::testing::ValuesIn(kFPArithInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorFPArithTest,
+ ::testing::ValuesIn(kFPArithInstructions));
typedef InstructionSelectorTestWithParam<FPCmp> InstructionSelectorFPCmpTest;
@@ -2428,10 +2415,8 @@ TEST_P(InstructionSelectorFPCmpTest, WithImmediateZeroOnLeft) {
EXPECT_EQ(cmp.commuted_cond, s[0]->flags_condition());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFPCmpTest,
- ::testing::ValuesIn(kFPCmpInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorFPCmpTest,
+ ::testing::ValuesIn(kFPCmpInstructions));
// -----------------------------------------------------------------------------
// Conversions.
@@ -2455,10 +2440,9 @@ TEST_P(InstructionSelectorConversionTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorConversionTest,
- ::testing::ValuesIn(kConversionInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorConversionTest,
+ ::testing::ValuesIn(kConversionInstructions));
typedef InstructionSelectorTestWithParam<MachInst2>
InstructionSelectorElidedChangeUint32ToUint64Test;
@@ -2477,9 +2461,9 @@ TEST_P(InstructionSelectorElidedChangeUint32ToUint64Test, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorElidedChangeUint32ToUint64Test,
- ::testing::ValuesIn(kCanElideChangeUint32ToUint64));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorElidedChangeUint32ToUint64Test,
+ ::testing::ValuesIn(kCanElideChangeUint32ToUint64));
TEST_F(InstructionSelectorTest, ChangeUint32ToUint64AfterLoad) {
// For each case, make sure the `ChangeUint32ToUint64` node turned into a
@@ -2873,10 +2857,9 @@ TEST_P(InstructionSelectorMemoryAccessTest, StoreWithShiftedIndex) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessTest,
- ::testing::ValuesIn(kMemoryAccesses));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessTest,
+ ::testing::ValuesIn(kMemoryAccesses));
// -----------------------------------------------------------------------------
// Comparison instructions.
@@ -2943,10 +2926,9 @@ TEST_P(InstructionSelectorComparisonTest, WithImmediate) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorComparisonTest,
- ::testing::ValuesIn(kComparisonInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorComparisonTest,
+ ::testing::ValuesIn(kComparisonInstructions));
TEST_F(InstructionSelectorTest, Word32EqualWithZero) {
{
@@ -3705,9 +3687,9 @@ TEST_P(InstructionSelectorFlagSettingTest, CommuteShift) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorFlagSettingTest,
- ::testing::ValuesIn(kFlagSettingInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorFlagSettingTest,
+ ::testing::ValuesIn(kFlagSettingInstructions));
TEST_F(InstructionSelectorTest, TstInvalidImmediate) {
// Make sure we do not generate an invalid immediate for TST.
@@ -3841,10 +3823,9 @@ TEST_P(InstructionSelectorLogicalWithNotRHSTest, Parameter) {
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorLogicalWithNotRHSTest,
- ::testing::ValuesIn(kLogicalWithNotRHSs));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorLogicalWithNotRHSTest,
+ ::testing::ValuesIn(kLogicalWithNotRHSs));
TEST_F(InstructionSelectorTest, Word32BitwiseNotWithParameter) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
diff --git a/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.cc b/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.cc
index 59d5dccd06..01400041a8 100644
--- a/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.cc
+++ b/deps/v8/test/unittests/compiler/backend/instruction-selector-unittest.cc
@@ -284,7 +284,7 @@ TARGET_TEST_P(InstructionSelectorPhiTest, Referenceness) {
EXPECT_EQ(s.IsReference(phi), s.IsReference(param1));
}
-INSTANTIATE_TEST_CASE_P(
+INSTANTIATE_TEST_SUITE_P(
InstructionSelectorTest, InstructionSelectorPhiTest,
::testing::Values(MachineType::Float64(), MachineType::Int8(),
MachineType::Uint8(), MachineType::Int16(),
diff --git a/deps/v8/test/unittests/compiler/common-operator-unittest.cc b/deps/v8/test/unittests/compiler/common-operator-unittest.cc
index 4d66ded5f1..19e7c6c55f 100644
--- a/deps/v8/test/unittests/compiler/common-operator-unittest.cc
+++ b/deps/v8/test/unittests/compiler/common-operator-unittest.cc
@@ -106,10 +106,8 @@ TEST_P(CommonSharedOperatorTest, Properties) {
EXPECT_EQ(sop.properties, op->properties());
}
-
-INSTANTIATE_TEST_CASE_P(CommonOperatorTest, CommonSharedOperatorTest,
- ::testing::ValuesIn(kSharedOperators));
-
+INSTANTIATE_TEST_SUITE_P(CommonOperatorTest, CommonSharedOperatorTest,
+ ::testing::ValuesIn(kSharedOperators));
// -----------------------------------------------------------------------------
// Other operators.
diff --git a/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc b/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc
index 640526bc90..6ee11be686 100644
--- a/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc
+++ b/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc
@@ -65,7 +65,7 @@ class ConstantFoldingReducerTest : public TypedGraphTest {
: TypedGraphTest(3),
broker_(isolate(), zone()),
simplified_(zone()),
- deps_(isolate(), zone()) {}
+ deps_(&broker_, zone()) {}
~ConstantFoldingReducerTest() override = default;
protected:
diff --git a/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc b/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc
index 65903506ad..72c82da09e 100644
--- a/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc
+++ b/deps/v8/test/unittests/compiler/ia32/instruction-selector-ia32-unittest.cc
@@ -313,11 +313,9 @@ TEST_P(InstructionSelectorMemoryAccessTest, StoreWithImmediateIndex) {
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessTest,
- ::testing::ValuesIn(kMemoryAccesses));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessTest,
+ ::testing::ValuesIn(kMemoryAccesses));
// -----------------------------------------------------------------------------
// AddressingMode for loads and stores.
@@ -622,10 +620,8 @@ TEST_P(InstructionSelectorMultTest, MultAdd32) {
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorMultTest,
- ::testing::ValuesIn(kMultParams));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorMultTest,
+ ::testing::ValuesIn(kMultParams));
TEST_F(InstructionSelectorTest, Int32MulHigh) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
diff --git a/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc b/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc
index 171658d830..7147b6c1a7 100644
--- a/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc
+++ b/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc
@@ -21,7 +21,7 @@ namespace compiler {
class JSCallReducerTest : public TypedGraphTest {
public:
JSCallReducerTest()
- : TypedGraphTest(3), javascript_(zone()), deps_(isolate(), zone()) {
+ : TypedGraphTest(3), javascript_(zone()), deps_(broker(), zone()) {
broker()->SerializeStandardObjects();
}
~JSCallReducerTest() override = default;
diff --git a/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc b/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc
index 41f0c180e6..dcb621ced0 100644
--- a/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc
+++ b/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc
@@ -32,9 +32,8 @@ class JSCreateLoweringTest : public TypedGraphTest {
JSCreateLoweringTest()
: TypedGraphTest(3),
javascript_(zone()),
- deps_(isolate(), zone()),
- handle_scope_(isolate()) {
- }
+ deps_(broker(), zone()),
+ handle_scope_(isolate()) {}
~JSCreateLoweringTest() override = default;
protected:
diff --git a/deps/v8/test/unittests/compiler/js-operator-unittest.cc b/deps/v8/test/unittests/compiler/js-operator-unittest.cc
index 338232b6e0..082e81f27c 100644
--- a/deps/v8/test/unittests/compiler/js-operator-unittest.cc
+++ b/deps/v8/test/unittests/compiler/js-operator-unittest.cc
@@ -108,9 +108,8 @@ TEST_P(JSSharedOperatorTest, Properties) {
EXPECT_EQ(sop.properties, op->properties());
}
-
-INSTANTIATE_TEST_CASE_P(JSOperatorTest, JSSharedOperatorTest,
- ::testing::ValuesIn(kSharedOperators));
+INSTANTIATE_TEST_SUITE_P(JSOperatorTest, JSSharedOperatorTest,
+ ::testing::ValuesIn(kSharedOperators));
} // namespace js_operator_unittest
} // namespace compiler
diff --git a/deps/v8/test/unittests/compiler/load-elimination-unittest.cc b/deps/v8/test/unittests/compiler/load-elimination-unittest.cc
index 042e7e6bbc..292415fed0 100644
--- a/deps/v8/test/unittests/compiler/load-elimination-unittest.cc
+++ b/deps/v8/test/unittests/compiler/load-elimination-unittest.cc
@@ -42,7 +42,7 @@ TEST_F(LoadEliminationTest, LoadElementAndLoadElement) {
Node* effect = graph()->start();
Node* control = graph()->start();
Node* index = Parameter(Type::UnsignedSmall(), 1);
- ElementAccess const access = {kTaggedBase, kPointerSize, Type::Any(),
+ ElementAccess const access = {kTaggedBase, kTaggedSize, Type::Any(),
MachineType::AnyTagged(), kNoWriteBarrier};
StrictMock<MockAdvancedReducerEditor> editor;
@@ -68,7 +68,7 @@ TEST_F(LoadEliminationTest, StoreElementAndLoadElement) {
Node* control = graph()->start();
Node* index = Parameter(Type::UnsignedSmall(), 1);
Node* value = Parameter(Type::Any(), 2);
- ElementAccess const access = {kTaggedBase, kPointerSize, Type::Any(),
+ ElementAccess const access = {kTaggedBase, kTaggedSize, Type::Any(),
MachineType::AnyTagged(), kNoWriteBarrier};
StrictMock<MockAdvancedReducerEditor> editor;
@@ -95,7 +95,7 @@ TEST_F(LoadEliminationTest, StoreElementAndStoreFieldAndLoadElement) {
Node* control = graph()->start();
Node* index = Parameter(Type::UnsignedSmall(), 1);
Node* value = Parameter(Type::Any(), 2);
- ElementAccess const access = {kTaggedBase, kPointerSize, Type::Any(),
+ ElementAccess const access = {kTaggedBase, kTaggedSize, Type::Any(),
MachineType::AnyTagged(), kNoWriteBarrier};
StrictMock<MockAdvancedReducerEditor> editor;
@@ -125,7 +125,7 @@ TEST_F(LoadEliminationTest, LoadFieldAndLoadField) {
Node* object = Parameter(Type::Any(), 0);
Node* effect = graph()->start();
Node* control = graph()->start();
- FieldAccess const access = {kTaggedBase, kPointerSize,
+ FieldAccess const access = {kTaggedBase, kTaggedSize,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::Any(), MachineType::AnyTagged(),
kNoWriteBarrier};
@@ -152,7 +152,7 @@ TEST_F(LoadEliminationTest, StoreFieldAndLoadField) {
Node* value = Parameter(Type::Any(), 1);
Node* effect = graph()->start();
Node* control = graph()->start();
- FieldAccess access = {kTaggedBase, kPointerSize,
+ FieldAccess access = {kTaggedBase, kTaggedSize,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::Any(), MachineType::AnyTagged(),
kNoWriteBarrier};
@@ -180,16 +180,16 @@ TEST_F(LoadEliminationTest, StoreFieldAndKillFields) {
Node* effect = graph()->start();
Node* control = graph()->start();
- FieldAccess access1 = {kTaggedBase, kPointerSize,
- MaybeHandle<Name>(), MaybeHandle<Map>(),
- Type::Any(), MachineType::AnyTagged(),
- kNoWriteBarrier};
+ FieldAccess access1 = {kTaggedBase, kTaggedSize,
+ MaybeHandle<Name>(), MaybeHandle<Map>(),
+ Type::Any(), MachineType::AnyTagged(),
+ kNoWriteBarrier};
// Offset that out of field cache size.
- FieldAccess access2 = {kTaggedBase, 2048 * kPointerSize,
- MaybeHandle<Name>(), MaybeHandle<Map>(),
- Type::Any(), MachineType::AnyTagged(),
- kNoWriteBarrier};
+ FieldAccess access2 = {kTaggedBase, 2048 * kTaggedSize,
+ MaybeHandle<Name>(), MaybeHandle<Map>(),
+ Type::Any(), MachineType::AnyTagged(),
+ kNoWriteBarrier};
StrictMock<MockAdvancedReducerEditor> editor;
LoadElimination load_elimination(&editor, jsgraph(), zone());
@@ -220,7 +220,7 @@ TEST_F(LoadEliminationTest, StoreFieldAndStoreElementAndLoadField) {
Node* index = Parameter(Type::UnsignedSmall(), 2);
Node* effect = graph()->start();
Node* control = graph()->start();
- FieldAccess access = {kTaggedBase, kPointerSize,
+ FieldAccess access = {kTaggedBase, kTaggedSize,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::Any(), MachineType::AnyTagged(),
kNoWriteBarrier};
@@ -253,7 +253,7 @@ TEST_F(LoadEliminationTest, LoadElementOnTrueBranchOfDiamond) {
Node* check = Parameter(Type::Boolean(), 2);
Node* effect = graph()->start();
Node* control = graph()->start();
- ElementAccess const access = {kTaggedBase, kPointerSize, Type::Any(),
+ ElementAccess const access = {kTaggedBase, kTaggedSize, Type::Any(),
MachineType::AnyTagged(), kNoWriteBarrier};
StrictMock<MockAdvancedReducerEditor> editor;
@@ -288,7 +288,7 @@ TEST_F(LoadEliminationTest, LoadElementOnFalseBranchOfDiamond) {
Node* check = Parameter(Type::Boolean(), 2);
Node* effect = graph()->start();
Node* control = graph()->start();
- ElementAccess const access = {kTaggedBase, kPointerSize, Type::Any(),
+ ElementAccess const access = {kTaggedBase, kTaggedSize, Type::Any(),
MachineType::AnyTagged(), kNoWriteBarrier};
StrictMock<MockAdvancedReducerEditor> editor;
@@ -322,7 +322,7 @@ TEST_F(LoadEliminationTest, LoadFieldOnFalseBranchOfDiamond) {
Node* check = Parameter(Type::Boolean(), 1);
Node* effect = graph()->start();
Node* control = graph()->start();
- FieldAccess const access = {kTaggedBase, kPointerSize,
+ FieldAccess const access = {kTaggedBase, kTaggedSize,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::Any(), MachineType::AnyTagged(),
kNoWriteBarrier};
@@ -358,7 +358,7 @@ TEST_F(LoadEliminationTest, LoadFieldOnTrueBranchOfDiamond) {
Node* check = Parameter(Type::Boolean(), 1);
Node* effect = graph()->start();
Node* control = graph()->start();
- FieldAccess const access = {kTaggedBase, kPointerSize,
+ FieldAccess const access = {kTaggedBase, kTaggedSize,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::Any(), MachineType::AnyTagged(),
kNoWriteBarrier};
@@ -394,7 +394,7 @@ TEST_F(LoadEliminationTest, LoadFieldWithTypeMismatch) {
Node* value = Parameter(Type::Signed32(), 1);
Node* effect = graph()->start();
Node* control = graph()->start();
- FieldAccess const access = {kTaggedBase, kPointerSize,
+ FieldAccess const access = {kTaggedBase, kTaggedSize,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::Unsigned31(), MachineType::AnyTagged(),
kNoWriteBarrier};
@@ -422,7 +422,7 @@ TEST_F(LoadEliminationTest, LoadElementWithTypeMismatch) {
Node* value = Parameter(Type::Signed32(), 2);
Node* effect = graph()->start();
Node* control = graph()->start();
- ElementAccess const access = {kTaggedBase, kPointerSize, Type::Unsigned31(),
+ ElementAccess const access = {kTaggedBase, kTaggedSize, Type::Unsigned31(),
MachineType::AnyTagged(), kNoWriteBarrier};
StrictMock<MockAdvancedReducerEditor> editor;
@@ -446,7 +446,7 @@ TEST_F(LoadEliminationTest, AliasAnalysisForFinishRegion) {
Node* value1 = Parameter(Type::Signed32(), 1);
Node* effect = graph()->start();
Node* control = graph()->start();
- FieldAccess const access = {kTaggedBase, kPointerSize,
+ FieldAccess const access = {kTaggedBase, kTaggedSize,
MaybeHandle<Name>(), MaybeHandle<Map>(),
Type::Signed32(), MachineType::AnyTagged(),
kNoWriteBarrier};
diff --git a/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc b/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc
index cd70b3bc41..e7ff126702 100644
--- a/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc
+++ b/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc
@@ -315,6 +315,9 @@ const ComparisonBinaryOperator kComparisonBinaryOperators[] = {
#undef OPCODE
};
+// Avoid undefined behavior on signed integer overflow.
+int32_t Shl(int32_t x, int32_t y) { return static_cast<uint32_t>(x) << y; }
+
} // namespace
@@ -591,13 +594,13 @@ TEST_F(MachineOperatorReducerTest, Word32AndWithWord32ShlWithConstant) {
Reduction const r1 = Reduce(graph()->NewNode(
machine()->Word32And(),
graph()->NewNode(machine()->Word32Shl(), p0, Int32Constant(l)),
- Int32Constant(-1 << k)));
+ Int32Constant(Shl(-1, k))));
ASSERT_TRUE(r1.Changed());
EXPECT_THAT(r1.replacement(), IsWord32Shl(p0, IsInt32Constant(l)));
// (-1 << K) & (x << L) => x << L
Reduction const r2 = Reduce(graph()->NewNode(
- machine()->Word32And(), Int32Constant(-1 << k),
+ machine()->Word32And(), Int32Constant(Shl(-1, k)),
graph()->NewNode(machine()->Word32Shl(), p0, Int32Constant(l))));
ASSERT_TRUE(r2.Changed());
EXPECT_THAT(r2.replacement(), IsWord32Shl(p0, IsInt32Constant(l)));
@@ -643,16 +646,16 @@ TEST_F(MachineOperatorReducerTest, Word32AndWithInt32AddAndConstant) {
TRACED_FORRANGE(int32_t, l, 1, 31) {
TRACED_FOREACH(int32_t, k, kInt32Values) {
- if ((k << l) == 0) continue;
+ if (Shl(k, l) == 0) continue;
// (x + (K << L)) & (-1 << L) => (x & (-1 << L)) + (K << L)
Reduction const r = Reduce(graph()->NewNode(
machine()->Word32And(),
- graph()->NewNode(machine()->Int32Add(), p0, Int32Constant(k << l)),
- Int32Constant(-1 << l)));
+ graph()->NewNode(machine()->Int32Add(), p0, Int32Constant(Shl(k, l))),
+ Int32Constant(Shl(-1, l))));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(),
- IsInt32Add(IsWord32And(p0, IsInt32Constant(-1 << l)),
- IsInt32Constant(k << l)));
+ IsInt32Add(IsWord32And(p0, IsInt32Constant(Shl(-1, l))),
+ IsInt32Constant(Shl(k, l))));
}
Node* s1 = graph()->NewNode(machine()->Word32Shl(), p1, Int32Constant(l));
@@ -660,18 +663,18 @@ TEST_F(MachineOperatorReducerTest, Word32AndWithInt32AddAndConstant) {
// (y << L + x) & (-1 << L) => (x & (-1 << L)) + y << L
Reduction const r1 = Reduce(graph()->NewNode(
machine()->Word32And(), graph()->NewNode(machine()->Int32Add(), s1, p0),
- Int32Constant(-1 << l)));
+ Int32Constant(Shl(-1, l))));
ASSERT_TRUE(r1.Changed());
EXPECT_THAT(r1.replacement(),
- IsInt32Add(IsWord32And(p0, IsInt32Constant(-1 << l)), s1));
+ IsInt32Add(IsWord32And(p0, IsInt32Constant(Shl(-1, l))), s1));
// (x + y << L) & (-1 << L) => (x & (-1 << L)) + y << L
Reduction const r2 = Reduce(graph()->NewNode(
machine()->Word32And(), graph()->NewNode(machine()->Int32Add(), p0, s1),
- Int32Constant(-1 << l)));
+ Int32Constant(Shl(-1, l))));
ASSERT_TRUE(r2.Changed());
EXPECT_THAT(r2.replacement(),
- IsInt32Add(IsWord32And(p0, IsInt32Constant(-1 << l)), s1));
+ IsInt32Add(IsWord32And(p0, IsInt32Constant(Shl(-1, l))), s1));
}
}
@@ -681,23 +684,23 @@ TEST_F(MachineOperatorReducerTest, Word32AndWithInt32MulAndConstant) {
TRACED_FORRANGE(int32_t, l, 1, 31) {
TRACED_FOREACH(int32_t, k, kInt32Values) {
- if ((k << l) == 0) continue;
+ if (Shl(k, l) == 0) continue;
// (x * (K << L)) & (-1 << L) => x * (K << L)
Reduction const r1 = Reduce(graph()->NewNode(
machine()->Word32And(),
- graph()->NewNode(machine()->Int32Mul(), p0, Int32Constant(k << l)),
- Int32Constant(-1 << l)));
+ graph()->NewNode(machine()->Int32Mul(), p0, Int32Constant(Shl(k, l))),
+ Int32Constant(Shl(-1, l))));
ASSERT_TRUE(r1.Changed());
- EXPECT_THAT(r1.replacement(), IsInt32Mul(p0, IsInt32Constant(k << l)));
+ EXPECT_THAT(r1.replacement(), IsInt32Mul(p0, IsInt32Constant(Shl(k, l))));
// ((K << L) * x) & (-1 << L) => x * (K << L)
Reduction const r2 = Reduce(graph()->NewNode(
machine()->Word32And(),
- graph()->NewNode(machine()->Int32Mul(), Int32Constant(k << l), p0),
- Int32Constant(-1 << l)));
+ graph()->NewNode(machine()->Int32Mul(), Int32Constant(Shl(k, l)), p0),
+ Int32Constant(Shl(-1, l))));
ASSERT_TRUE(r2.Changed());
- EXPECT_THAT(r2.replacement(), IsInt32Mul(p0, IsInt32Constant(k << l)));
+ EXPECT_THAT(r2.replacement(), IsInt32Mul(p0, IsInt32Constant(Shl(k, l))));
}
}
}
@@ -710,31 +713,31 @@ TEST_F(MachineOperatorReducerTest,
TRACED_FORRANGE(int32_t, l, 1, 31) {
TRACED_FOREACH(int32_t, k, kInt32Values) {
- if ((k << l) == 0) continue;
+ if (Shl(k, l) == 0) continue;
// (y * (K << L) + x) & (-1 << L) => (x & (-1 << L)) + y * (K << L)
Reduction const r1 = Reduce(graph()->NewNode(
machine()->Word32And(),
graph()->NewNode(machine()->Int32Add(),
graph()->NewNode(machine()->Int32Mul(), p1,
- Int32Constant(k << l)),
+ Int32Constant(Shl(k, l))),
p0),
- Int32Constant(-1 << l)));
+ Int32Constant(Shl(-1, l))));
ASSERT_TRUE(r1.Changed());
EXPECT_THAT(r1.replacement(),
- IsInt32Add(IsWord32And(p0, IsInt32Constant(-1 << l)),
- IsInt32Mul(p1, IsInt32Constant(k << l))));
+ IsInt32Add(IsWord32And(p0, IsInt32Constant(Shl(-1, l))),
+ IsInt32Mul(p1, IsInt32Constant(Shl(k, l)))));
// (x + y * (K << L)) & (-1 << L) => (x & (-1 << L)) + y * (K << L)
Reduction const r2 = Reduce(graph()->NewNode(
machine()->Word32And(),
graph()->NewNode(machine()->Int32Add(), p0,
graph()->NewNode(machine()->Int32Mul(), p1,
- Int32Constant(k << l))),
- Int32Constant(-1 << l)));
+ Int32Constant(Shl(k, l)))),
+ Int32Constant(Shl(-1, l))));
ASSERT_TRUE(r2.Changed());
EXPECT_THAT(r2.replacement(),
- IsInt32Add(IsWord32And(p0, IsInt32Constant(-1 << l)),
- IsInt32Mul(p1, IsInt32Constant(k << l))));
+ IsInt32Add(IsWord32And(p0, IsInt32Constant(Shl(-1, l))),
+ IsInt32Mul(p1, IsInt32Constant(Shl(k, l)))));
}
}
}
@@ -1012,7 +1015,7 @@ TEST_F(MachineOperatorReducerTest, Word32ShlWithWord32Sar) {
Int32Constant(x));
Reduction r = Reduce(node);
ASSERT_TRUE(r.Changed());
- int32_t m = bit_cast<int32_t>(~((1U << x) - 1U));
+ int32_t m = static_cast<int32_t>(~((1U << x) - 1U));
EXPECT_THAT(r.replacement(), IsWord32And(p0, IsInt32Constant(m)));
}
}
@@ -1023,19 +1026,19 @@ TEST_F(MachineOperatorReducerTest,
Node* const p0 = Parameter(0);
TRACED_FOREACH(int32_t, k, kInt32Values) {
TRACED_FORRANGE(int32_t, l, 1, 31) {
- if ((k << l) == 0) continue;
+ if (Shl(k, l) == 0) continue;
// (x + (K << L)) >> L << L => (x & (-1 << L)) + (K << L)
Reduction const r = Reduce(graph()->NewNode(
machine()->Word32Shl(),
graph()->NewNode(machine()->Word32Sar(),
graph()->NewNode(machine()->Int32Add(), p0,
- Int32Constant(k << l)),
+ Int32Constant(Shl(k, l))),
Int32Constant(l)),
Int32Constant(l)));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(),
- IsInt32Add(IsWord32And(p0, IsInt32Constant(-1 << l)),
- IsInt32Constant(k << l)));
+ IsInt32Add(IsWord32And(p0, IsInt32Constant(Shl(-1, l))),
+ IsInt32Constant(Shl(k, l))));
}
}
}
@@ -1050,7 +1053,7 @@ TEST_F(MachineOperatorReducerTest, Word32ShlWithWord32Shr) {
Int32Constant(x));
Reduction r = Reduce(node);
ASSERT_TRUE(r.Changed());
- int32_t m = bit_cast<int32_t>(~((1U << x) - 1U));
+ int32_t m = static_cast<int32_t>(~((1U << x) - 1U));
EXPECT_THAT(r.replacement(), IsWord32And(p0, IsInt32Constant(m)));
}
}
@@ -1134,10 +1137,9 @@ TEST_F(MachineOperatorReducerTest, Int32DivWithConstant) {
IsInt32Constant(shift)));
}
TRACED_FORRANGE(int32_t, shift, 2, 31) {
- Reduction const r = Reduce(graph()->NewNode(
- machine()->Int32Div(), p0,
- Uint32Constant(bit_cast<uint32_t, int32_t>(-1) << shift),
- graph()->start()));
+ Reduction const r = Reduce(graph()->NewNode(machine()->Int32Div(), p0,
+ Int32Constant(Shl(-1, shift)),
+ graph()->start()));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(
r.replacement(),
@@ -1220,7 +1222,7 @@ TEST_F(MachineOperatorReducerTest, Uint32DivWithConstant) {
Uint32Constant(1u << shift), graph()->start()));
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(),
- IsWord32Shr(p0, IsInt32Constant(bit_cast<int32_t>(shift))));
+ IsWord32Shr(p0, IsInt32Constant(static_cast<int32_t>(shift))));
}
}
@@ -1296,11 +1298,10 @@ TEST_F(MachineOperatorReducerTest, Int32ModWithConstant) {
graph()->start())))));
}
TRACED_FORRANGE(int32_t, shift, 1, 31) {
- Reduction const r = Reduce(graph()->NewNode(
- machine()->Int32Mod(), p0,
- Uint32Constant(bit_cast<uint32_t, int32_t>(-1) << shift),
- graph()->start()));
- int32_t const mask = bit_cast<int32_t, uint32_t>((1U << shift) - 1);
+ Reduction const r = Reduce(graph()->NewNode(machine()->Int32Mod(), p0,
+ Int32Constant(Shl(-1, shift)),
+ graph()->start()));
+ int32_t const mask = static_cast<int32_t>((1U << shift) - 1U);
ASSERT_TRUE(r.Changed());
EXPECT_THAT(
r.replacement(),
@@ -1378,7 +1379,7 @@ TEST_F(MachineOperatorReducerTest, Uint32ModWithConstant) {
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(),
IsWord32And(p0, IsInt32Constant(
- bit_cast<int32_t>((1u << shift) - 1u))));
+ static_cast<int32_t>((1u << shift) - 1u))));
}
}
@@ -1676,7 +1677,7 @@ TEST_F(MachineOperatorReducerTest, Uint32LessThanWithWord32Sar) {
ASSERT_TRUE(r.Changed());
EXPECT_THAT(r.replacement(),
IsUint32LessThan(
- p0, IsInt32Constant(bit_cast<int32_t>(limit << shift))));
+ p0, IsInt32Constant(static_cast<int32_t>(limit << shift))));
}
}
@@ -1958,8 +1959,9 @@ TEST_F(MachineOperatorReducerTest, Float64PowWithConstant) {
Reduction const r = Reduce(graph()->NewNode(
machine()->Float64Pow(), Float64Constant(x), Float64Constant(y)));
ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(),
- IsFloat64Constant(NanSensitiveDoubleEq(Pow(x, y))));
+ EXPECT_THAT(
+ r.replacement(),
+ IsFloat64Constant(NanSensitiveDoubleEq(base::ieee754::pow(x, y))));
}
}
}
@@ -2225,7 +2227,7 @@ TEST_F(MachineOperatorReducerTest, Float64RoundDownWithConstant) {
Reduction r = Reduce(graph()->NewNode(
machine()->Float64RoundDown().placeholder(), Float64Constant(x)));
ASSERT_TRUE(r.Changed());
- EXPECT_THAT(r.replacement(), IsFloat64Constant(Floor(x)));
+ EXPECT_THAT(r.replacement(), IsFloat64Constant(std::floor(x)));
}
}
diff --git a/deps/v8/test/unittests/compiler/machine-operator-unittest.cc b/deps/v8/test/unittests/compiler/machine-operator-unittest.cc
index 9eddb1d311..c4a86afffd 100644
--- a/deps/v8/test/unittests/compiler/machine-operator-unittest.cc
+++ b/deps/v8/test/unittests/compiler/machine-operator-unittest.cc
@@ -89,13 +89,11 @@ TEST_P(MachineLoadOperatorTest, ParameterIsCorrect) {
EXPECT_EQ(GetParam(), LoadRepresentationOf(machine.Load(GetParam())));
}
-
-INSTANTIATE_TEST_CASE_P(
+INSTANTIATE_TEST_SUITE_P(
MachineOperatorTest, MachineLoadOperatorTest,
::testing::Combine(::testing::ValuesIn(kMachineReps),
::testing::ValuesIn(kMachineTypesForAccess)));
-
// -----------------------------------------------------------------------------
// Store operator.
@@ -149,8 +147,7 @@ TEST_P(MachineStoreOperatorTest, ParameterIsCorrect) {
EXPECT_EQ(GetParam(), StoreRepresentationOf(machine.Store(GetParam())));
}
-
-INSTANTIATE_TEST_CASE_P(
+INSTANTIATE_TEST_SUITE_P(
MachineOperatorTest, MachineStoreOperatorTest,
::testing::Combine(
::testing::ValuesIn(kMachineReps),
diff --git a/deps/v8/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc b/deps/v8/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc
index 83edb6a21e..09a897a54e 100644
--- a/deps/v8/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc
+++ b/deps/v8/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc
@@ -292,9 +292,8 @@ TEST_P(InstructionSelectorFPCmpTest, Parameter) {
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFPCmpTest,
- ::testing::ValuesIn(kFPCmpInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorFPCmpTest,
+ ::testing::ValuesIn(kFPCmpInstructions));
// ----------------------------------------------------------------------------
// Arithmetic compare instructions integers.
@@ -316,10 +315,8 @@ TEST_P(InstructionSelectorCmpTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorCmpTest,
- ::testing::ValuesIn(kCmpInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorCmpTest,
+ ::testing::ValuesIn(kCmpInstructions));
// ----------------------------------------------------------------------------
// Shift instructions.
@@ -347,10 +344,8 @@ TEST_P(InstructionSelectorShiftTest, Immediate) {
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorShiftTest,
- ::testing::ValuesIn(kShiftInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorShiftTest,
+ ::testing::ValuesIn(kShiftInstructions));
TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) {
// The available shift operand range is `0 <= imm < 32`, but we also test
@@ -464,10 +459,9 @@ TEST_P(InstructionSelectorLogicalTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorLogicalTest,
- ::testing::ValuesIn(kLogicalInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorLogicalTest,
+ ::testing::ValuesIn(kLogicalInstructions));
TEST_F(InstructionSelectorTest, Word32XorMinusOneWithParameter) {
{
@@ -601,10 +595,8 @@ TEST_P(InstructionSelectorMulDivTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorMulDivTest,
- ::testing::ValuesIn(kMulDivInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorMulDivTest,
+ ::testing::ValuesIn(kMulDivInstructions));
// ----------------------------------------------------------------------------
// MOD instructions.
@@ -626,10 +618,8 @@ TEST_P(InstructionSelectorModTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorModTest,
- ::testing::ValuesIn(kModInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorModTest,
+ ::testing::ValuesIn(kModInstructions));
// ----------------------------------------------------------------------------
// Floating point instructions.
@@ -651,10 +641,9 @@ TEST_P(InstructionSelectorFPArithTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFPArithTest,
- ::testing::ValuesIn(kFPArithInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorFPArithTest,
+ ::testing::ValuesIn(kFPArithInstructions));
// ----------------------------------------------------------------------------
// Integer arithmetic.
@@ -677,11 +666,9 @@ TEST_P(InstructionSelectorIntArithTwoTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorIntArithTwoTest,
- ::testing::ValuesIn(kAddSubInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorIntArithTwoTest,
+ ::testing::ValuesIn(kAddSubInstructions));
// ----------------------------------------------------------------------------
// One node.
@@ -704,11 +691,9 @@ TEST_P(InstructionSelectorIntArithOneTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorIntArithOneTest,
- ::testing::ValuesIn(kAddSubOneInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorIntArithOneTest,
+ ::testing::ValuesIn(kAddSubOneInstructions));
// ----------------------------------------------------------------------------
// Conversions.
@@ -730,11 +715,9 @@ TEST_P(InstructionSelectorConversionTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorConversionTest,
- ::testing::ValuesIn(kConversionInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorConversionTest,
+ ::testing::ValuesIn(kConversionInstructions));
typedef InstructionSelectorTestWithParam<Conversion>
CombineChangeFloat64ToInt32WithRoundFloat64;
@@ -753,10 +736,9 @@ TEST_P(CombineChangeFloat64ToInt32WithRoundFloat64, Parameter) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- CombineChangeFloat64ToInt32WithRoundFloat64,
- ::testing::ValuesIn(kFloat64RoundInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ CombineChangeFloat64ToInt32WithRoundFloat64,
+ ::testing::ValuesIn(kFloat64RoundInstructions));
typedef InstructionSelectorTestWithParam<Conversion>
CombineChangeFloat32ToInt32WithRoundFloat32;
@@ -776,10 +758,9 @@ TEST_P(CombineChangeFloat32ToInt32WithRoundFloat32, Parameter) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- CombineChangeFloat32ToInt32WithRoundFloat32,
- ::testing::ValuesIn(kFloat32RoundInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ CombineChangeFloat32ToInt32WithRoundFloat32,
+ ::testing::ValuesIn(kFloat32RoundInstructions));
TEST_F(InstructionSelectorTest, ChangeFloat64ToInt32OfChangeFloat32ToFloat64) {
{
@@ -1035,11 +1016,9 @@ TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessTest,
- ::testing::ValuesIn(kMemoryAccesses));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessTest,
+ ::testing::ValuesIn(kMemoryAccesses));
// ----------------------------------------------------------------------------
// Load immediate.
@@ -1112,9 +1091,9 @@ TEST_P(InstructionSelectorMemoryAccessImmTest, StoreZero) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessImmTest,
- ::testing::ValuesIn(kMemoryAccessesImm));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessImmTest,
+ ::testing::ValuesIn(kMemoryAccessesImm));
typedef InstructionSelectorTestWithParam<MemoryAccessImm2>
InstructionSelectorMemoryAccessUnalignedImmTest;
@@ -1143,9 +1122,9 @@ TEST_P(InstructionSelectorMemoryAccessUnalignedImmTest, StoreZero) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessUnalignedImmTest,
- ::testing::ValuesIn(kMemoryAccessesImmUnaligned));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessUnalignedImmTest,
+ ::testing::ValuesIn(kMemoryAccessesImmUnaligned));
// ----------------------------------------------------------------------------
// Load/store offsets more than 16 bits.
@@ -1190,11 +1169,9 @@ TEST_P(InstructionSelectorMemoryAccessImmMoreThan16bitTest,
}
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessImmMoreThan16bitTest,
- ::testing::ValuesIn(kMemoryAccessImmMoreThan16bit));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessImmMoreThan16bitTest,
+ ::testing::ValuesIn(kMemoryAccessImmMoreThan16bit));
// ----------------------------------------------------------------------------
// kMipsTst testing.
diff --git a/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc b/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc
index c6c1ff3ee8..cd73fe3c9b 100644
--- a/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc
+++ b/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc
@@ -316,8 +316,8 @@ TEST_P(InstructionSelectorFPCmpTest, Parameter) {
EXPECT_EQ(cmp.cond, s[0]->flags_condition());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFPCmpTest,
- ::testing::ValuesIn(kFPCmpInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorFPCmpTest,
+ ::testing::ValuesIn(kFPCmpInstructions));
// ----------------------------------------------------------------------------
// Arithmetic compare instructions integers
@@ -367,8 +367,8 @@ TEST_P(InstructionSelectorCmpTest, Parameter) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorCmpTest,
- ::testing::ValuesIn(kCmpInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorCmpTest,
+ ::testing::ValuesIn(kCmpInstructions));
// ----------------------------------------------------------------------------
// Shift instructions.
@@ -393,8 +393,8 @@ TEST_P(InstructionSelectorShiftTest, Immediate) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorShiftTest,
- ::testing::ValuesIn(kShiftInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorShiftTest,
+ ::testing::ValuesIn(kShiftInstructions));
TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediate) {
// The available shift operand range is `0 <= imm < 32`, but we also test
@@ -549,9 +549,9 @@ TEST_P(InstructionSelectorLogicalTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorLogicalTest,
- ::testing::ValuesIn(kLogicalInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorLogicalTest,
+ ::testing::ValuesIn(kLogicalInstructions));
TEST_F(InstructionSelectorTest, Word64XorMinusOneWithParameter) {
{
@@ -824,8 +824,8 @@ TEST_P(InstructionSelectorMulDivTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorMulDivTest,
- ::testing::ValuesIn(kMulDivInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorMulDivTest,
+ ::testing::ValuesIn(kMulDivInstructions));
// ----------------------------------------------------------------------------
// MOD instructions.
@@ -844,8 +844,8 @@ TEST_P(InstructionSelectorModTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorModTest,
- ::testing::ValuesIn(kModInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest, InstructionSelectorModTest,
+ ::testing::ValuesIn(kModInstructions));
// ----------------------------------------------------------------------------
// Floating point instructions.
@@ -864,8 +864,9 @@ TEST_P(InstructionSelectorFPArithTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest, InstructionSelectorFPArithTest,
- ::testing::ValuesIn(kFPArithInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorFPArithTest,
+ ::testing::ValuesIn(kFPArithInstructions));
// ----------------------------------------------------------------------------
// Integer arithmetic
// ----------------------------------------------------------------------------
@@ -884,10 +885,9 @@ TEST_P(InstructionSelectorIntArithTwoTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorIntArithTwoTest,
- ::testing::ValuesIn(kAddSubInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorIntArithTwoTest,
+ ::testing::ValuesIn(kAddSubInstructions));
// ----------------------------------------------------------------------------
// One node.
@@ -909,9 +909,9 @@ TEST_P(InstructionSelectorIntArithOneTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorIntArithOneTest,
- ::testing::ValuesIn(kAddSubOneInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorIntArithOneTest,
+ ::testing::ValuesIn(kAddSubOneInstructions));
// ----------------------------------------------------------------------------
// Conversions.
// ----------------------------------------------------------------------------
@@ -929,9 +929,9 @@ TEST_P(InstructionSelectorConversionTest, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorConversionTest,
- ::testing::ValuesIn(kConversionInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorConversionTest,
+ ::testing::ValuesIn(kConversionInstructions));
TEST_F(InstructionSelectorTest, ChangesFromToSmi) {
{
@@ -975,9 +975,9 @@ TEST_P(CombineChangeFloat64ToInt32WithRoundFloat64, Parameter) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- CombineChangeFloat64ToInt32WithRoundFloat64,
- ::testing::ValuesIn(kFloat64RoundInstructions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ CombineChangeFloat64ToInt32WithRoundFloat64,
+ ::testing::ValuesIn(kFloat64RoundInstructions));
typedef InstructionSelectorTestWithParam<Conversion>
CombineChangeFloat32ToInt32WithRoundFloat32;
@@ -997,10 +997,9 @@ TEST_P(CombineChangeFloat32ToInt32WithRoundFloat32, Parameter) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- CombineChangeFloat32ToInt32WithRoundFloat32,
- ::testing::ValuesIn(kFloat32RoundInstructions));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ CombineChangeFloat32ToInt32WithRoundFloat32,
+ ::testing::ValuesIn(kFloat32RoundInstructions));
TEST_F(InstructionSelectorTest, ChangeFloat64ToInt32OfChangeFloat32ToFloat64) {
{
@@ -1172,9 +1171,9 @@ TEST_P(InstructionSelectorElidedChangeUint32ToUint64Test, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorElidedChangeUint32ToUint64Test,
- ::testing::ValuesIn(kCanElideChangeUint32ToUint64));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorElidedChangeUint32ToUint64Test,
+ ::testing::ValuesIn(kCanElideChangeUint32ToUint64));
TEST_F(InstructionSelectorTest, ChangeUint32ToUint64AfterLoad) {
// For each case, make sure the `ChangeUint32ToUint64` node turned into a
@@ -1477,10 +1476,9 @@ TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
EXPECT_EQ(kMode_MRI, s[0]->addressing_mode());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessTest,
- ::testing::ValuesIn(kMemoryAccesses));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessTest,
+ ::testing::ValuesIn(kMemoryAccesses));
// ----------------------------------------------------------------------------
// Load immediate.
@@ -1552,9 +1550,9 @@ TEST_P(InstructionSelectorMemoryAccessImmTest, StoreZero) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessImmTest,
- ::testing::ValuesIn(kMemoryAccessesImm));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessImmTest,
+ ::testing::ValuesIn(kMemoryAccessesImm));
typedef InstructionSelectorTestWithParam<MemoryAccessImm2>
InstructionSelectorMemoryAccessUnalignedImmTest;
@@ -1583,9 +1581,9 @@ TEST_P(InstructionSelectorMemoryAccessUnalignedImmTest, StoreZero) {
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessUnalignedImmTest,
- ::testing::ValuesIn(kMemoryAccessesImmUnaligned));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessUnalignedImmTest,
+ ::testing::ValuesIn(kMemoryAccessesImmUnaligned));
// ----------------------------------------------------------------------------
// Load/store offsets more than 16 bits.
@@ -1628,10 +1626,9 @@ TEST_P(InstructionSelectorMemoryAccessImmMoreThan16bitTest,
}
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessImmMoreThan16bitTest,
- ::testing::ValuesIn(kMemoryAccessImmMoreThan16bit));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessImmMoreThan16bitTest,
+ ::testing::ValuesIn(kMemoryAccessImmMoreThan16bit));
// ----------------------------------------------------------------------------
// kMips64Cmp with zero testing.
diff --git a/deps/v8/test/unittests/compiler/node-test-utils.cc b/deps/v8/test/unittests/compiler/node-test-utils.cc
index f23265e8e4..cedbfb9daf 100644
--- a/deps/v8/test/unittests/compiler/node-test-utils.cc
+++ b/deps/v8/test/unittests/compiler/node-test-utils.cc
@@ -1946,7 +1946,7 @@ Matcher<Node*> IsTailCall(
IrOpcode::k##opcode, hint_matcher, lhs_matcher, rhs_matcher, \
effect_matcher, control_matcher)); \
}
-SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DEFINE_SPECULATIVE_BINOP_MATCHER);
+SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DEFINE_SPECULATIVE_BINOP_MATCHER)
DEFINE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberEqual)
DEFINE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThan)
DEFINE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThanOrEqual)
diff --git a/deps/v8/test/unittests/compiler/node-test-utils.h b/deps/v8/test/unittests/compiler/node-test-utils.h
index 96bdbdf3be..2fdfb99e48 100644
--- a/deps/v8/test/unittests/compiler/node-test-utils.h
+++ b/deps/v8/test/unittests/compiler/node-test-utils.h
@@ -212,7 +212,7 @@ Matcher<Node*> IsNumberAdd(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher, \
const Matcher<Node*>& effect_matcher, \
const Matcher<Node*>& control_matcher);
-SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_SPECULATIVE_BINOP_MATCHER);
+SIMPLIFIED_SPECULATIVE_NUMBER_BINOP_LIST(DECLARE_SPECULATIVE_BINOP_MATCHER)
DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberEqual)
DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThan)
DECLARE_SPECULATIVE_BINOP_MATCHER(SpeculativeNumberLessThanOrEqual)
@@ -499,83 +499,83 @@ Matcher<Node*> IsSpeculativeToNumber(const Matcher<Node*>& value_matcher);
// Helpers
static inline Matcher<Node*> IsIntPtrConstant(const intptr_t value) {
- return kPointerSize == 8 ? IsInt64Constant(static_cast<int64_t>(value))
- : IsInt32Constant(static_cast<int32_t>(value));
+ return kSystemPointerSize == 8 ? IsInt64Constant(static_cast<int64_t>(value))
+ : IsInt32Constant(static_cast<int32_t>(value));
}
static inline Matcher<Node*> IsIntPtrAdd(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher) {
- return kPointerSize == 8 ? IsInt64Add(lhs_matcher, rhs_matcher)
- : IsInt32Add(lhs_matcher, rhs_matcher);
+ return kSystemPointerSize == 8 ? IsInt64Add(lhs_matcher, rhs_matcher)
+ : IsInt32Add(lhs_matcher, rhs_matcher);
}
static inline Matcher<Node*> IsIntPtrSub(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher) {
- return kPointerSize == 8 ? IsInt64Sub(lhs_matcher, rhs_matcher)
- : IsInt32Sub(lhs_matcher, rhs_matcher);
+ return kSystemPointerSize == 8 ? IsInt64Sub(lhs_matcher, rhs_matcher)
+ : IsInt32Sub(lhs_matcher, rhs_matcher);
}
static inline Matcher<Node*> IsIntPtrMul(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher) {
- return kPointerSize == 8 ? IsInt64Mul(lhs_matcher, rhs_matcher)
- : IsInt32Mul(lhs_matcher, rhs_matcher);
+ return kSystemPointerSize == 8 ? IsInt64Mul(lhs_matcher, rhs_matcher)
+ : IsInt32Mul(lhs_matcher, rhs_matcher);
}
static inline Matcher<Node*> IsIntPtrDiv(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher) {
- return kPointerSize == 8 ? IsInt64Div(lhs_matcher, rhs_matcher)
- : IsInt32Div(lhs_matcher, rhs_matcher);
+ return kSystemPointerSize == 8 ? IsInt64Div(lhs_matcher, rhs_matcher)
+ : IsInt32Div(lhs_matcher, rhs_matcher);
}
static inline Matcher<Node*> IsWordShl(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher) {
- return kPointerSize == 8 ? IsWord64Shl(lhs_matcher, rhs_matcher)
- : IsWord32Shl(lhs_matcher, rhs_matcher);
+ return kSystemPointerSize == 8 ? IsWord64Shl(lhs_matcher, rhs_matcher)
+ : IsWord32Shl(lhs_matcher, rhs_matcher);
}
static inline Matcher<Node*> IsWordShr(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher) {
- return kPointerSize == 8 ? IsWord64Shr(lhs_matcher, rhs_matcher)
- : IsWord32Shr(lhs_matcher, rhs_matcher);
+ return kSystemPointerSize == 8 ? IsWord64Shr(lhs_matcher, rhs_matcher)
+ : IsWord32Shr(lhs_matcher, rhs_matcher);
}
static inline Matcher<Node*> IsWordSar(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher) {
- return kPointerSize == 8 ? IsWord64Sar(lhs_matcher, rhs_matcher)
- : IsWord32Sar(lhs_matcher, rhs_matcher);
+ return kSystemPointerSize == 8 ? IsWord64Sar(lhs_matcher, rhs_matcher)
+ : IsWord32Sar(lhs_matcher, rhs_matcher);
}
static inline Matcher<Node*> IsWordAnd(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher) {
- return kPointerSize == 8 ? IsWord64And(lhs_matcher, rhs_matcher)
- : IsWord32And(lhs_matcher, rhs_matcher);
+ return kSystemPointerSize == 8 ? IsWord64And(lhs_matcher, rhs_matcher)
+ : IsWord32And(lhs_matcher, rhs_matcher);
}
static inline Matcher<Node*> IsWordOr(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher) {
- return kPointerSize == 8 ? IsWord64Or(lhs_matcher, rhs_matcher)
- : IsWord32Or(lhs_matcher, rhs_matcher);
+ return kSystemPointerSize == 8 ? IsWord64Or(lhs_matcher, rhs_matcher)
+ : IsWord32Or(lhs_matcher, rhs_matcher);
}
static inline Matcher<Node*> IsWordXor(const Matcher<Node*>& lhs_matcher,
const Matcher<Node*>& rhs_matcher) {
- return kPointerSize == 8 ? IsWord64Xor(lhs_matcher, rhs_matcher)
- : IsWord32Xor(lhs_matcher, rhs_matcher);
+ return kSystemPointerSize == 8 ? IsWord64Xor(lhs_matcher, rhs_matcher)
+ : IsWord32Xor(lhs_matcher, rhs_matcher);
}
static inline Matcher<Node*> IsChangeInt32ToIntPtr(
const Matcher<Node*>& matcher) {
- return kPointerSize == 8 ? IsChangeInt32ToInt64(matcher) : matcher;
+ return kSystemPointerSize == 8 ? IsChangeInt32ToInt64(matcher) : matcher;
}
static inline Matcher<Node*> IsChangeUint32ToWord(
const Matcher<Node*>& matcher) {
- return kPointerSize == 8 ? IsChangeUint32ToUint64(matcher) : matcher;
+ return kSystemPointerSize == 8 ? IsChangeUint32ToUint64(matcher) : matcher;
}
static inline Matcher<Node*> IsTruncateIntPtrToInt32(
const Matcher<Node*>& matcher) {
- return kPointerSize == 8 ? IsTruncateInt64ToInt32(matcher) : matcher;
+ return kSystemPointerSize == 8 ? IsTruncateInt64ToInt32(matcher) : matcher;
}
} // namespace compiler
diff --git a/deps/v8/test/unittests/compiler/opcodes-unittest.cc b/deps/v8/test/unittests/compiler/opcodes-unittest.cc
index a0e67ecb27..5036ade61e 100644
--- a/deps/v8/test/unittests/compiler/opcodes-unittest.cc
+++ b/deps/v8/test/unittests/compiler/opcodes-unittest.cc
@@ -78,9 +78,6 @@ bool IsComparisonOpcode(IrOpcode::Value opcode) {
}
}
-
-const IrOpcode::Value kInvalidOpcode = static_cast<IrOpcode::Value>(123456789);
-
char const* const kMnemonics[] = {
#define OPCODE(Opcode) #Opcode,
ALL_OP_LIST(OPCODE)
@@ -96,42 +93,36 @@ const IrOpcode::Value kOpcodes[] = {
} // namespace
TEST(IrOpcodeTest, IsCommonOpcode) {
- EXPECT_FALSE(IrOpcode::IsCommonOpcode(kInvalidOpcode));
TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) {
EXPECT_EQ(IsCommonOpcode(opcode), IrOpcode::IsCommonOpcode(opcode));
}
}
TEST(IrOpcodeTest, IsControlOpcode) {
- EXPECT_FALSE(IrOpcode::IsControlOpcode(kInvalidOpcode));
TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) {
EXPECT_EQ(IsControlOpcode(opcode), IrOpcode::IsControlOpcode(opcode));
}
}
TEST(IrOpcodeTest, IsJsOpcode) {
- EXPECT_FALSE(IrOpcode::IsJsOpcode(kInvalidOpcode));
TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) {
EXPECT_EQ(IsJsOpcode(opcode), IrOpcode::IsJsOpcode(opcode));
}
}
TEST(IrOpcodeTest, IsConstantOpcode) {
- EXPECT_FALSE(IrOpcode::IsConstantOpcode(kInvalidOpcode));
TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) {
EXPECT_EQ(IsConstantOpcode(opcode), IrOpcode::IsConstantOpcode(opcode));
}
}
TEST(IrOpcodeTest, IsComparisonOpcode) {
- EXPECT_FALSE(IrOpcode::IsComparisonOpcode(kInvalidOpcode));
TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) {
EXPECT_EQ(IsComparisonOpcode(opcode), IrOpcode::IsComparisonOpcode(opcode));
}
}
TEST(IrOpcodeTest, Mnemonic) {
- EXPECT_STREQ("UnknownOpcode", IrOpcode::Mnemonic(kInvalidOpcode));
TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) {
EXPECT_STREQ(kMnemonics[opcode], IrOpcode::Mnemonic(opcode));
}
diff --git a/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc b/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc
index 079cc4b99a..a9cf3260a2 100644
--- a/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc
+++ b/deps/v8/test/unittests/compiler/redundancy-elimination-unittest.cc
@@ -668,16 +668,18 @@ TEST_F(RedundancyEliminationTest, CheckedUint32Bounds) {
Node* effect = graph()->start();
Node* control = graph()->start();
- Node* check1 = effect =
- graph()->NewNode(simplified()->CheckedUint32Bounds(feedback1), index,
- length, effect, control);
+ Node* check1 = effect = graph()->NewNode(
+ simplified()->CheckedUint32Bounds(
+ feedback1, CheckBoundsParameters::kDeoptOnOutOfBounds),
+ index, length, effect, control);
Reduction r1 = Reduce(check1);
ASSERT_TRUE(r1.Changed());
EXPECT_EQ(r1.replacement(), check1);
- Node* check2 = effect =
- graph()->NewNode(simplified()->CheckedUint32Bounds(feedback2), index,
- length, effect, control);
+ Node* check2 = effect = graph()->NewNode(
+ simplified()->CheckedUint32Bounds(
+ feedback2, CheckBoundsParameters::kDeoptOnOutOfBounds),
+ index, length, effect, control);
Reduction r2 = Reduce(check2);
ASSERT_TRUE(r2.Changed());
EXPECT_EQ(r2.replacement(), check1);
diff --git a/deps/v8/test/unittests/compiler/regalloc/register-allocator-unittest.cc b/deps/v8/test/unittests/compiler/regalloc/register-allocator-unittest.cc
index d77f424ef7..02ce2bcdac 100644
--- a/deps/v8/test/unittests/compiler/regalloc/register-allocator-unittest.cc
+++ b/deps/v8/test/unittests/compiler/regalloc/register-allocator-unittest.cc
@@ -755,7 +755,7 @@ TEST_P(SlotConstraintTest, SlotConstraint) {
Allocate();
}
-INSTANTIATE_TEST_CASE_P(
+INSTANTIATE_TEST_SUITE_P(
RegisterAllocatorTest, SlotConstraintTest,
::testing::Combine(::testing::ValuesIn(kParameterTypes),
::testing::Range(0, SlotConstraintTest::kMaxVariant)));
diff --git a/deps/v8/test/unittests/compiler/simplified-operator-unittest.cc b/deps/v8/test/unittests/compiler/simplified-operator-unittest.cc
index 239f19ff93..280afef4c9 100644
--- a/deps/v8/test/unittests/compiler/simplified-operator-unittest.cc
+++ b/deps/v8/test/unittests/compiler/simplified-operator-unittest.cc
@@ -115,9 +115,8 @@ TEST_P(SimplifiedPureOperatorTest, Properties) {
EXPECT_EQ(pop.properties, op->properties() & pop.properties);
}
-INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest, SimplifiedPureOperatorTest,
- ::testing::ValuesIn(kPureOperators));
-
+INSTANTIATE_TEST_SUITE_P(SimplifiedOperatorTest, SimplifiedPureOperatorTest,
+ ::testing::ValuesIn(kPureOperators));
// -----------------------------------------------------------------------------
@@ -213,10 +212,9 @@ TEST_P(SimplifiedElementAccessOperatorTest, StoreElement) {
EXPECT_EQ(0, op->ControlOutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(SimplifiedOperatorTest,
- SimplifiedElementAccessOperatorTest,
- ::testing::ValuesIn(kElementAccesses));
+INSTANTIATE_TEST_SUITE_P(SimplifiedOperatorTest,
+ SimplifiedElementAccessOperatorTest,
+ ::testing::ValuesIn(kElementAccesses));
} // namespace simplified_operator_unittest
} // namespace compiler
diff --git a/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc b/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc
index da1f3941f0..c8aaafb6dc 100644
--- a/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc
+++ b/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc
@@ -27,7 +27,7 @@ namespace typed_optimization_unittest {
class TypedOptimizationTest : public TypedGraphTest {
public:
TypedOptimizationTest()
- : TypedGraphTest(3), simplified_(zone()), deps_(isolate(), zone()) {}
+ : TypedGraphTest(3), simplified_(zone()), deps_(broker(), zone()) {}
~TypedOptimizationTest() override = default;
protected:
diff --git a/deps/v8/test/unittests/compiler/typer-unittest.cc b/deps/v8/test/unittests/compiler/typer-unittest.cc
index 5954dbc638..5d712bd220 100644
--- a/deps/v8/test/unittests/compiler/typer-unittest.cc
+++ b/deps/v8/test/unittests/compiler/typer-unittest.cc
@@ -10,7 +10,7 @@
#include "src/compiler/operator-properties.h"
#include "src/compiler/simplified-operator.h"
#include "src/objects-inl.h"
-#include "test/cctest/types-fuzz.h"
+#include "test/common/types-fuzz.h"
#include "test/unittests/compiler/graph-unittest.h"
namespace v8 {
@@ -303,7 +303,9 @@ class TyperTest : public TypedGraphTest {
namespace {
-int32_t shift_left(int32_t x, int32_t y) { return x << (y & 0x1F); }
+int32_t shift_left(int32_t x, int32_t y) {
+ return static_cast<uint32_t>(x) << (y & 0x1F);
+}
int32_t shift_right(int32_t x, int32_t y) { return x >> (y & 0x1F); }
int32_t bit_or(int32_t x, int32_t y) { return x | y; }
int32_t bit_and(int32_t x, int32_t y) { return x & y; }
@@ -506,7 +508,7 @@ TEST_MONOTONICITY(ToBoolean)
TestBinaryMonotonicity(simplified_.name(), Type::Number(), \
Type::Number()); \
}
-SIMPLIFIED_NUMBER_BINOP_LIST(TEST_MONOTONICITY);
+SIMPLIFIED_NUMBER_BINOP_LIST(TEST_MONOTONICITY)
#undef TEST_MONOTONICITY
// SIMPLIFIED BINOPs without hint, without input restriction
diff --git a/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc b/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
index f174b92731..7ba4c5ae4b 100644
--- a/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
+++ b/deps/v8/test/unittests/compiler/x64/instruction-selector-x64-unittest.cc
@@ -103,9 +103,9 @@ TEST_P(InstructionSelectorChangeInt32ToInt64Test, ChangeInt32ToInt64WithLoad) {
EXPECT_EQ(extension.expected_opcode, s[0]->arch_opcode());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorChangeInt32ToInt64Test,
- ::testing::ValuesIn(kLoadWithToInt64Extensions));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorChangeInt32ToInt64Test,
+ ::testing::ValuesIn(kLoadWithToInt64Extensions));
// -----------------------------------------------------------------------------
// Loads and stores
@@ -171,11 +171,9 @@ TEST_P(InstructionSelectorMemoryAccessTest, StoreWithParameters) {
EXPECT_EQ(0U, s[0]->OutputCount());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorMemoryAccessTest,
- ::testing::ValuesIn(kMemoryAccesses));
-
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorMemoryAccessTest,
+ ::testing::ValuesIn(kMemoryAccesses));
// -----------------------------------------------------------------------------
// ChangeUint32ToUint64.
@@ -237,10 +235,9 @@ TEST_P(InstructionSelectorChangeUint32ToUint64Test, ChangeUint32ToUint64) {
ASSERT_EQ(1U, s.size());
}
-
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorChangeUint32ToUint64Test,
- ::testing::ValuesIn(kWord32BinaryOperations));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorChangeUint32ToUint64Test,
+ ::testing::ValuesIn(kWord32BinaryOperations));
// -----------------------------------------------------------------------------
// CanElideChangeUint32ToUint64
@@ -320,9 +317,9 @@ TEST_P(InstructionSelectorElidedChangeUint32ToUint64Test, Parameter) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
- InstructionSelectorElidedChangeUint32ToUint64Test,
- ::testing::ValuesIn(kCanElideChangeUint32ToUint64));
+INSTANTIATE_TEST_SUITE_P(InstructionSelectorTest,
+ InstructionSelectorElidedChangeUint32ToUint64Test,
+ ::testing::ValuesIn(kCanElideChangeUint32ToUint64));
// ChangeUint32ToUint64AfterLoad
TEST_F(InstructionSelectorTest, ChangeUint32ToUint64AfterLoad) {
diff --git a/deps/v8/test/unittests/eh-frame-writer-unittest.cc b/deps/v8/test/unittests/eh-frame-writer-unittest.cc
index 0846fda2f4..52501b462e 100644
--- a/deps/v8/test/unittests/eh-frame-writer-unittest.cc
+++ b/deps/v8/test/unittests/eh-frame-writer-unittest.cc
@@ -43,7 +43,7 @@ TEST_F(EhFrameWriterTest, Alignment) {
ASSERT_EQ(0, EhFrameConstants::kEhFrameTerminatorSize % 4);
EXPECT_EQ(0, (iterator.GetBufferSize() - EhFrameConstants::kEhFrameHdrSize -
EhFrameConstants::kEhFrameTerminatorSize) %
- kPointerSize);
+ kSystemPointerSize);
}
TEST_F(EhFrameWriterTest, FDEHeader) {
diff --git a/deps/v8/test/unittests/heap/bitmap-test-utils.h b/deps/v8/test/unittests/heap/bitmap-test-utils.h
new file mode 100644
index 0000000000..b709263968
--- /dev/null
+++ b/deps/v8/test/unittests/heap/bitmap-test-utils.h
@@ -0,0 +1,35 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_UNITTESTS_HEAP_BITMAP_TEST_UTILS_H_
+#define V8_UNITTESTS_HEAP_BITMAP_TEST_UTILS_H_
+
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace v8 {
+namespace internal {
+
+template <typename T>
+class TestWithBitmap : public ::testing::Test {
+ public:
+ TestWithBitmap() : memory_(new uint8_t[Bitmap::kSize]) {
+ memset(memory_, 0, Bitmap::kSize);
+ }
+
+ ~TestWithBitmap() override { delete[] memory_; }
+
+ T* bitmap() { return reinterpret_cast<T*>(memory_); }
+ uint8_t* raw_bitmap() { return memory_; }
+
+ private:
+ uint8_t* memory_;
+};
+
+using BitmapTypes = ::testing::Types<ConcurrentBitmap<AccessMode::NON_ATOMIC>,
+ ConcurrentBitmap<AccessMode::ATOMIC>>;
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_UNITTESTS_HEAP_BITMAP_TEST_UTILS_H_
diff --git a/deps/v8/test/unittests/heap/bitmap-unittest.cc b/deps/v8/test/unittests/heap/bitmap-unittest.cc
index 1ecab4dd72..393f5ea303 100644
--- a/deps/v8/test/unittests/heap/bitmap-unittest.cc
+++ b/deps/v8/test/unittests/heap/bitmap-unittest.cc
@@ -3,40 +3,26 @@
// found in the LICENSE file.
#include "src/heap/spaces.h"
+#include "test/unittests/heap/bitmap-test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace {
+namespace v8 {
+namespace internal {
-using v8::internal::Bitmap;
+const uint32_t kBlackCell = 0xAAAAAAAA;
+const uint32_t kWhiteCell = 0x00000000;
+const uint32_t kBlackByte = 0xAA;
+const uint32_t kWhiteByte = 0x00;
-class BitmapTest : public ::testing::Test {
- public:
- static const uint32_t kBlackCell;
- static const uint32_t kWhiteCell;
- static const uint32_t kBlackByte;
- static const uint32_t kWhiteByte;
+template <typename T>
+using BitmapTest = TestWithBitmap<T>;
- BitmapTest() : memory_(new uint8_t[Bitmap::kSize]) {
- memset(memory_, 0, Bitmap::kSize);
- }
-
- ~BitmapTest() override { delete[] memory_; }
-
- Bitmap* bitmap() { return reinterpret_cast<Bitmap*>(memory_); }
- uint8_t* raw_bitmap() { return memory_; }
-
- private:
- uint8_t* memory_;
-};
+TYPED_TEST_SUITE(BitmapTest, BitmapTypes);
+using NonAtomicBitmapTest =
+ TestWithBitmap<ConcurrentBitmap<AccessMode::NON_ATOMIC>>;
-const uint32_t BitmapTest::kBlackCell = 0xAAAAAAAA;
-const uint32_t BitmapTest::kWhiteCell = 0x00000000;
-const uint32_t BitmapTest::kBlackByte = 0xAA;
-const uint32_t BitmapTest::kWhiteByte = 0x00;
-
-
-TEST_F(BitmapTest, IsZeroInitialized) {
+TEST_F(NonAtomicBitmapTest, IsZeroInitialized) {
// We require all tests to start from a zero-initialized bitmap. Manually
// verify this invariant here.
for (size_t i = 0; i < Bitmap::kSize; i++) {
@@ -44,9 +30,8 @@ TEST_F(BitmapTest, IsZeroInitialized) {
}
}
-
-TEST_F(BitmapTest, Cells) {
- Bitmap* bm = bitmap();
+TEST_F(NonAtomicBitmapTest, Cells) {
+ auto bm = bitmap();
bm->cells()[1] = kBlackCell;
uint8_t* raw = raw_bitmap();
int second_cell_base = Bitmap::kBytesPerCell;
@@ -55,8 +40,7 @@ TEST_F(BitmapTest, Cells) {
}
}
-
-TEST_F(BitmapTest, CellsCount) {
+TEST_F(NonAtomicBitmapTest, CellsCount) {
int last_cell_index = bitmap()->CellsCount() - 1;
bitmap()->cells()[last_cell_index] = kBlackCell;
// Manually verify on raw memory.
@@ -71,17 +55,34 @@ TEST_F(BitmapTest, CellsCount) {
}
}
-
-TEST_F(BitmapTest, IsClean) {
- Bitmap* bm = bitmap();
+TEST_F(NonAtomicBitmapTest, IsClean) {
+ auto bm = bitmap();
EXPECT_TRUE(bm->IsClean());
bm->cells()[0] = kBlackCell;
EXPECT_FALSE(bm->IsClean());
}
+TYPED_TEST(BitmapTest, Clear) {
+ auto bm = this->bitmap();
+ for (size_t i = 0; i < Bitmap::kSize; i++) {
+ this->raw_bitmap()[i] = 0xFFu;
+ }
+ bm->Clear();
+ for (size_t i = 0; i < Bitmap::kSize; i++) {
+ EXPECT_EQ(this->raw_bitmap()[i], 0);
+ }
+}
+
+TYPED_TEST(BitmapTest, MarkAllBits) {
+ auto bm = this->bitmap();
+ bm->MarkAllBits();
+ for (size_t i = 0; i < Bitmap::kSize; i++) {
+ EXPECT_EQ(this->raw_bitmap()[i], 0xFF);
+ }
+}
-TEST_F(BitmapTest, ClearRange1) {
- Bitmap* bm = bitmap();
+TYPED_TEST(BitmapTest, ClearRange1) {
+ auto bm = this->bitmap();
bm->cells()[0] = kBlackCell;
bm->cells()[1] = kBlackCell;
bm->cells()[2] = kBlackCell;
@@ -91,9 +92,8 @@ TEST_F(BitmapTest, ClearRange1) {
EXPECT_EQ(bm->cells()[2], kBlackCell);
}
-
-TEST_F(BitmapTest, ClearRange2) {
- Bitmap* bm = bitmap();
+TYPED_TEST(BitmapTest, ClearRange2) {
+ auto bm = this->bitmap();
bm->cells()[0] = kBlackCell;
bm->cells()[1] = kBlackCell;
bm->cells()[2] = kBlackCell;
@@ -104,4 +104,59 @@ TEST_F(BitmapTest, ClearRange2) {
EXPECT_EQ(bm->cells()[2], kBlackCell);
}
-} // namespace
+TYPED_TEST(BitmapTest, SetAndClearRange) {
+ auto bm = this->bitmap();
+ for (int i = 0; i < 3; i++) {
+ bm->SetRange(i, Bitmap::kBitsPerCell + i);
+ CHECK_EQ(bm->cells()[0], 0xFFFFFFFFu << i);
+ CHECK_EQ(bm->cells()[1], (1u << i) - 1);
+ bm->ClearRange(i, Bitmap::kBitsPerCell + i);
+ CHECK_EQ(bm->cells()[0], 0x0u);
+ CHECK_EQ(bm->cells()[1], 0x0u);
+ }
+}
+
+// AllBitsSetInRange() and AllBitsClearInRange() are only used when verifying
+// the heap on the main thread so they don't have atomic implementations.
+TEST_F(NonAtomicBitmapTest, ClearMultipleRanges) {
+ auto bm = this->bitmap();
+
+ bm->SetRange(0, Bitmap::kBitsPerCell * 3);
+ CHECK(bm->AllBitsSetInRange(0, Bitmap::kBitsPerCell));
+
+ bm->ClearRange(Bitmap::kBitsPerCell / 2, Bitmap::kBitsPerCell);
+ bm->ClearRange(Bitmap::kBitsPerCell,
+ Bitmap::kBitsPerCell + Bitmap::kBitsPerCell / 2);
+ bm->ClearRange(Bitmap::kBitsPerCell * 2 + 8, Bitmap::kBitsPerCell * 2 + 16);
+ bm->ClearRange(Bitmap::kBitsPerCell * 2 + 24, Bitmap::kBitsPerCell * 3);
+
+ CHECK_EQ(bm->cells()[0], 0xFFFFu);
+ CHECK(bm->AllBitsSetInRange(0, Bitmap::kBitsPerCell / 2));
+ CHECK(
+ bm->AllBitsClearInRange(Bitmap::kBitsPerCell / 2, Bitmap::kBitsPerCell));
+
+ CHECK_EQ(bm->cells()[1], 0xFFFF0000u);
+ CHECK(bm->AllBitsClearInRange(
+ Bitmap::kBitsPerCell, Bitmap::kBitsPerCell + Bitmap::kBitsPerCell / 2));
+ CHECK(bm->AllBitsSetInRange(Bitmap::kBitsPerCell + Bitmap::kBitsPerCell / 2,
+ Bitmap::kBitsPerCell * 2));
+
+ CHECK_EQ(bm->cells()[2], 0xFF00FFu);
+ CHECK(bm->AllBitsSetInRange(
+ Bitmap::kBitsPerCell * 2,
+ Bitmap::kBitsPerCell * 2 + Bitmap::kBitsPerCell / 4));
+ CHECK(bm->AllBitsClearInRange(
+ Bitmap::kBitsPerCell * 2 + Bitmap::kBitsPerCell / 4,
+ Bitmap::kBitsPerCell * 2 + Bitmap::kBitsPerCell / 2));
+ CHECK(bm->AllBitsSetInRange(
+ Bitmap::kBitsPerCell * 2 + Bitmap::kBitsPerCell / 2,
+ Bitmap::kBitsPerCell * 2 + Bitmap::kBitsPerCell / 2 +
+ Bitmap::kBitsPerCell / 4));
+ CHECK(bm->AllBitsClearInRange(Bitmap::kBitsPerCell * 2 +
+ Bitmap::kBitsPerCell / 2 +
+ Bitmap::kBitsPerCell / 4,
+ Bitmap::kBitsPerCell * 3));
+}
+
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/heap/gc-idle-time-handler-unittest.cc b/deps/v8/test/unittests/heap/gc-idle-time-handler-unittest.cc
index 7063b2a280..b3901d74b0 100644
--- a/deps/v8/test/unittests/heap/gc-idle-time-handler-unittest.cc
+++ b/deps/v8/test/unittests/heap/gc-idle-time-handler-unittest.cc
@@ -31,7 +31,6 @@ class GCIdleTimeHandlerTest : public ::testing::Test {
static const size_t kSizeOfObjects = 100 * MB;
static const size_t kMarkCompactSpeed = 200 * KB;
static const size_t kMarkingSpeed = 200 * KB;
- static const int kMaxNotifications = 100;
private:
GCIdleTimeHandler handler_;
@@ -95,8 +94,8 @@ TEST_F(GCIdleTimeHandlerTest, ContextDisposeLowRate) {
heap_state.contexts_disposed = 1;
heap_state.incremental_marking_stopped = true;
double idle_time_ms = 0;
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
+ EXPECT_EQ(GCIdleTimeAction::kDone,
+ handler()->Compute(idle_time_ms, heap_state));
}
@@ -108,8 +107,8 @@ TEST_F(GCIdleTimeHandlerTest, ContextDisposeHighRate) {
GCIdleTimeHandler::kHighContextDisposalRate - 1;
heap_state.incremental_marking_stopped = true;
double idle_time_ms = 0;
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_FULL_GC, action.type);
+ EXPECT_EQ(GCIdleTimeAction::kFullGC,
+ handler()->Compute(idle_time_ms, heap_state));
}
@@ -120,8 +119,8 @@ TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeZeroIdleTime) {
heap_state.contexts_disposal_rate = 1.0;
heap_state.incremental_marking_stopped = true;
double idle_time_ms = 0;
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_FULL_GC, action.type);
+ EXPECT_EQ(GCIdleTimeAction::kFullGC,
+ handler()->Compute(idle_time_ms, heap_state));
}
@@ -133,8 +132,8 @@ TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime1) {
GCIdleTimeHandler::kHighContextDisposalRate;
size_t speed = kMarkCompactSpeed;
double idle_time_ms = static_cast<double>(kSizeOfObjects / speed - 1);
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_INCREMENTAL_STEP, action.type);
+ EXPECT_EQ(GCIdleTimeAction::kIncrementalStep,
+ handler()->Compute(idle_time_ms, heap_state));
}
@@ -146,8 +145,8 @@ TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime2) {
GCIdleTimeHandler::kHighContextDisposalRate;
size_t speed = kMarkCompactSpeed;
double idle_time_ms = static_cast<double>(kSizeOfObjects / speed - 1);
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_INCREMENTAL_STEP, action.type);
+ EXPECT_EQ(GCIdleTimeAction::kIncrementalStep,
+ handler()->Compute(idle_time_ms, heap_state));
}
TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeLargeHeap) {
@@ -158,16 +157,16 @@ TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeLargeHeap) {
heap_state.incremental_marking_stopped = true;
heap_state.size_of_objects = 101 * MB;
double idle_time_ms = 0;
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
+ EXPECT_EQ(GCIdleTimeAction::kDone,
+ handler()->Compute(idle_time_ms, heap_state));
}
TEST_F(GCIdleTimeHandlerTest, IncrementalMarking1) {
if (!handler()->Enabled()) return;
GCIdleTimeHeapState heap_state = DefaultHeapState();
double idle_time_ms = 10;
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_INCREMENTAL_STEP, action.type);
+ EXPECT_EQ(GCIdleTimeAction::kIncrementalStep,
+ handler()->Compute(idle_time_ms, heap_state));
}
@@ -177,8 +176,8 @@ TEST_F(GCIdleTimeHandlerTest, NotEnoughTime) {
heap_state.incremental_marking_stopped = true;
size_t speed = kMarkCompactSpeed;
double idle_time_ms = static_cast<double>(kSizeOfObjects / speed - 1);
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DONE, action.type);
+ EXPECT_EQ(GCIdleTimeAction::kDone,
+ handler()->Compute(idle_time_ms, heap_state));
}
@@ -187,8 +186,8 @@ TEST_F(GCIdleTimeHandlerTest, DoNotStartIncrementalMarking) {
GCIdleTimeHeapState heap_state = DefaultHeapState();
heap_state.incremental_marking_stopped = true;
double idle_time_ms = 10.0;
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DONE, action.type);
+ EXPECT_EQ(GCIdleTimeAction::kDone,
+ handler()->Compute(idle_time_ms, heap_state));
}
@@ -197,32 +196,11 @@ TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop) {
GCIdleTimeHeapState heap_state = DefaultHeapState();
heap_state.incremental_marking_stopped = true;
double idle_time_ms = 10.0;
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DONE, action.type);
+ EXPECT_EQ(GCIdleTimeAction::kDone,
+ handler()->Compute(idle_time_ms, heap_state));
heap_state.incremental_marking_stopped = false;
- action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_INCREMENTAL_STEP, action.type);
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, ZeroIdleTimeNothingToDo) {
- if (!handler()->Enabled()) return;
- GCIdleTimeHeapState heap_state = DefaultHeapState();
- for (int i = 0; i < kMaxNotifications; i++) {
- GCIdleTimeAction action = handler()->Compute(0, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
- }
-}
-
-
-TEST_F(GCIdleTimeHandlerTest, SmallIdleTimeNothingToDo) {
- if (!handler()->Enabled()) return;
- GCIdleTimeHeapState heap_state = DefaultHeapState();
- heap_state.incremental_marking_stopped = true;
- for (int i = 0; i < kMaxNotifications; i++) {
- GCIdleTimeAction action = handler()->Compute(10, heap_state);
- EXPECT_TRUE(DO_NOTHING == action.type || DONE == action.type);
- }
+ EXPECT_EQ(GCIdleTimeAction::kIncrementalStep,
+ handler()->Compute(idle_time_ms, heap_state));
}
@@ -235,9 +213,9 @@ TEST_F(GCIdleTimeHandlerTest, DoneIfNotMakingProgressOnIncrementalMarking) {
// Simulate incremental marking stopped and not eligible to start.
heap_state.incremental_marking_stopped = true;
double idle_time_ms = 10.0;
- // We should return DONE if we cannot start incremental marking.
- GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DONE, action.type);
+ // We should return kDone if we cannot start incremental marking.
+ EXPECT_EQ(GCIdleTimeAction::kDone,
+ handler()->Compute(idle_time_ms, heap_state));
}
} // namespace internal
diff --git a/deps/v8/test/unittests/heap/heap-unittest.cc b/deps/v8/test/unittests/heap/heap-unittest.cc
index 53954d8178..12bd46886d 100644
--- a/deps/v8/test/unittests/heap/heap-unittest.cc
+++ b/deps/v8/test/unittests/heap/heap-unittest.cc
@@ -6,13 +6,10 @@
#include <iostream>
#include <limits>
-#include "src/objects.h"
-#include "src/objects-inl.h"
-
-#include "src/handles.h"
#include "src/handles-inl.h"
-
#include "src/heap/heap.h"
+#include "src/heap/spaces-inl.h"
+#include "src/objects-inl.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -23,14 +20,13 @@ typedef TestWithIsolate HeapTest;
typedef TestWithIsolateAndPointerCompression HeapWithPointerCompressionTest;
TEST(Heap, SemiSpaceSize) {
- const size_t KB = static_cast<size_t>(i::KB);
const size_t MB = static_cast<size_t>(i::MB);
const size_t pm = i::Heap::kPointerMultiplier;
- ASSERT_EQ(1u * pm * MB / 2, i::Heap::ComputeMaxSemiSpaceSize(0u) * KB);
- ASSERT_EQ(1u * pm * MB / 2, i::Heap::ComputeMaxSemiSpaceSize(512u * MB) * KB);
- ASSERT_EQ(2u * pm * MB, i::Heap::ComputeMaxSemiSpaceSize(1024u * MB) * KB);
- ASSERT_EQ(5u * pm * MB, i::Heap::ComputeMaxSemiSpaceSize(2024u * MB) * KB);
- ASSERT_EQ(8u * pm * MB, i::Heap::ComputeMaxSemiSpaceSize(4095u * MB) * KB);
+ ASSERT_EQ(512u * pm, i::Heap::ComputeMaxSemiSpaceSize(0u));
+ ASSERT_EQ(512u * pm, i::Heap::ComputeMaxSemiSpaceSize(512u * MB));
+ ASSERT_EQ(2048u * pm, i::Heap::ComputeMaxSemiSpaceSize(1024u * MB));
+ ASSERT_EQ(5120u * pm, i::Heap::ComputeMaxSemiSpaceSize(2024u * MB));
+ ASSERT_EQ(8192u * pm, i::Heap::ComputeMaxSemiSpaceSize(4095u * MB));
}
TEST_F(HeapTest, ASLR) {
diff --git a/deps/v8/test/unittests/heap/item-parallel-job-unittest.cc b/deps/v8/test/unittests/heap/item-parallel-job-unittest.cc
index 36d99a31ba..e42f22c4e1 100644
--- a/deps/v8/test/unittests/heap/item-parallel-job-unittest.cc
+++ b/deps/v8/test/unittests/heap/item-parallel-job-unittest.cc
@@ -202,7 +202,7 @@ TEST_F(ItemParallelJobTest, SimpleTaskWithNoItemsRuns) {
parallel_job_semaphore());
job.AddTask(new SimpleTask(i_isolate(), &did_run));
- job.Run(i_isolate()->async_counters());
+ job.Run();
EXPECT_TRUE(did_run);
}
@@ -214,7 +214,7 @@ TEST_F(ItemParallelJobTest, SimpleTaskWithSimpleItemRuns) {
job.AddItem(new ItemParallelJob::Item);
- job.Run(i_isolate()->async_counters());
+ job.Run();
EXPECT_TRUE(did_run);
}
@@ -244,7 +244,7 @@ TEST_F(ItemParallelJobTest, MoreTasksThanItems) {
job.AddItem(new SimpleItem);
}
- job.Run(i_isolate()->async_counters());
+ job.Run();
for (int i = 0; i < kNumTasks; i++) {
// Only the first kNumItems tasks should have been assigned a work item.
@@ -261,7 +261,7 @@ TEST_F(ItemParallelJobTest, SingleThreadProcessing) {
for (int i = 0; i < kItems; i++) {
job.AddItem(new SimpleItem(&was_processed[i]));
}
- job.Run(i_isolate()->async_counters());
+ job.Run();
for (int i = 0; i < kItems; i++) {
EXPECT_TRUE(was_processed[i]);
}
@@ -282,7 +282,7 @@ TEST_F(ItemParallelJobTest, DistributeItemsMultipleTasks) {
job.AddTask(
new TaskProcessingOneItem(i_isolate(), &barrier, wait_when_done));
}
- job.Run(i_isolate()->async_counters());
+ job.Run();
for (int i = 0; i < kItemsAndTasks; i++) {
EXPECT_TRUE(was_processed[i]);
}
@@ -296,7 +296,7 @@ TEST_F(ItemParallelJobTest, DifferentItems) {
job.AddItem(new ItemA());
job.AddItem(new ItemB());
job.AddTask(new TaskForDifferentItems(i_isolate(), &item_a, &item_b));
- job.Run(i_isolate()->async_counters());
+ job.Run();
EXPECT_TRUE(item_a);
EXPECT_TRUE(item_b);
}
diff --git a/deps/v8/test/unittests/heap/marking-unittest.cc b/deps/v8/test/unittests/heap/marking-unittest.cc
index be26d4eebd..60aa28c4a9 100644
--- a/deps/v8/test/unittests/heap/marking-unittest.cc
+++ b/deps/v8/test/unittests/heap/marking-unittest.cc
@@ -6,15 +6,19 @@
#include "src/globals.h"
#include "src/heap/marking.h"
+#include "test/unittests/heap/bitmap-test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace v8 {
namespace internal {
+template <typename T>
+using MarkingTest = TestWithBitmap<T>;
-TEST(Marking, TransitionWhiteBlackWhite) {
- Bitmap* bitmap = reinterpret_cast<Bitmap*>(
- calloc(Bitmap::kSize / kTaggedSize, kTaggedSize));
+TYPED_TEST_SUITE(MarkingTest, BitmapTypes);
+
+TYPED_TEST(MarkingTest, TransitionWhiteBlackWhite) {
+ auto bitmap = this->bitmap();
const int kLocationsSize = 3;
int position[kLocationsSize] = {
Bitmap::kBitsPerCell - 2, Bitmap::kBitsPerCell - 1, Bitmap::kBitsPerCell};
@@ -29,12 +33,10 @@ TEST(Marking, TransitionWhiteBlackWhite) {
CHECK(Marking::IsWhite(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit));
}
- free(bitmap);
}
-TEST(Marking, TransitionWhiteGreyBlack) {
- Bitmap* bitmap = reinterpret_cast<Bitmap*>(
- calloc(Bitmap::kSize / kTaggedSize, kTaggedSize));
+TYPED_TEST(MarkingTest, TransitionWhiteGreyBlack) {
+ auto bitmap = this->bitmap();
const int kLocationsSize = 3;
int position[kLocationsSize] = {
Bitmap::kBitsPerCell - 2, Bitmap::kBitsPerCell - 1, Bitmap::kBitsPerCell};
@@ -55,54 +57,7 @@ TEST(Marking, TransitionWhiteGreyBlack) {
CHECK(Marking::IsWhite(mark_bit));
CHECK(!Marking::IsImpossible(mark_bit));
}
- free(bitmap);
}
-TEST(Marking, SetAndClearRange) {
- Bitmap* bitmap = reinterpret_cast<Bitmap*>(
- calloc(Bitmap::kSize / kTaggedSize, kTaggedSize));
- for (int i = 0; i < 3; i++) {
- bitmap->SetRange(i, Bitmap::kBitsPerCell + i);
- CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[0], 0xFFFFFFFFu << i);
- CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[1], (1u << i) - 1);
- bitmap->ClearRange(i, Bitmap::kBitsPerCell + i);
- CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[0], 0x0u);
- CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[1], 0x0u);
- }
- free(bitmap);
-}
-
-TEST(Marking, ClearMultipleRanges) {
- Bitmap* bitmap = reinterpret_cast<Bitmap*>(
- calloc(Bitmap::kSize / kTaggedSize, kTaggedSize));
- CHECK(bitmap->AllBitsClearInRange(0, Bitmap::kBitsPerCell * 3));
- bitmap->SetRange(0, Bitmap::kBitsPerCell * 3);
- CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[0], 0xFFFFFFFFu);
- CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[1], 0xFFFFFFFFu);
- CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[2], 0xFFFFFFFFu);
- CHECK(bitmap->AllBitsSetInRange(0, Bitmap::kBitsPerCell * 3));
- bitmap->ClearRange(Bitmap::kBitsPerCell / 2, Bitmap::kBitsPerCell);
- bitmap->ClearRange(Bitmap::kBitsPerCell,
- Bitmap::kBitsPerCell + Bitmap::kBitsPerCell / 2);
- bitmap->ClearRange(Bitmap::kBitsPerCell * 2 + 8,
- Bitmap::kBitsPerCell * 2 + 16);
- bitmap->ClearRange(Bitmap::kBitsPerCell * 2 + 24, Bitmap::kBitsPerCell * 3);
- CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[0], 0xFFFFu);
- CHECK(bitmap->AllBitsSetInRange(0, Bitmap::kBitsPerCell / 2));
- CHECK(bitmap->AllBitsClearInRange(Bitmap::kBitsPerCell / 2,
- Bitmap::kBitsPerCell));
- CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[1], 0xFFFF0000u);
- CHECK(
- bitmap->AllBitsSetInRange(Bitmap::kBitsPerCell + Bitmap::kBitsPerCell / 2,
- 2 * Bitmap::kBitsPerCell));
- CHECK(bitmap->AllBitsClearInRange(
- Bitmap::kBitsPerCell, Bitmap::kBitsPerCell + Bitmap::kBitsPerCell / 2));
- CHECK_EQ(reinterpret_cast<uint32_t*>(bitmap)[2], 0xFF00FFu);
- CHECK(bitmap->AllBitsSetInRange(2 * Bitmap::kBitsPerCell,
- 2 * Bitmap::kBitsPerCell + 8));
- CHECK(bitmap->AllBitsClearInRange(2 * Bitmap::kBitsPerCell + 24,
- Bitmap::kBitsPerCell * 3));
- free(bitmap);
-}
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/unittests/heap/spaces-unittest.cc b/deps/v8/test/unittests/heap/spaces-unittest.cc
index de4bd39e1e..ecfa4b964f 100644
--- a/deps/v8/test/unittests/heap/spaces-unittest.cc
+++ b/deps/v8/test/unittests/heap/spaces-unittest.cc
@@ -84,38 +84,38 @@ TEST_F(SpacesTest, WriteBarrierIsMarking) {
EXPECT_FALSE(slim_chunk->IsMarking());
}
-TEST_F(SpacesTest, WriteBarrierInNewSpaceToSpace) {
+TEST_F(SpacesTest, WriteBarrierInYoungGenerationToSpace) {
const size_t kSizeOfMemoryChunk = sizeof(MemoryChunk);
char memory[kSizeOfMemoryChunk];
memset(&memory, 0, kSizeOfMemoryChunk);
MemoryChunk* chunk = reinterpret_cast<MemoryChunk*>(&memory);
heap_internals::MemoryChunk* slim_chunk =
reinterpret_cast<heap_internals::MemoryChunk*>(&memory);
- EXPECT_FALSE(chunk->InNewSpace());
- EXPECT_FALSE(slim_chunk->InNewSpace());
- chunk->SetFlag(MemoryChunk::IN_TO_SPACE);
- EXPECT_TRUE(chunk->InNewSpace());
- EXPECT_TRUE(slim_chunk->InNewSpace());
- chunk->ClearFlag(MemoryChunk::IN_TO_SPACE);
- EXPECT_FALSE(chunk->InNewSpace());
- EXPECT_FALSE(slim_chunk->InNewSpace());
+ EXPECT_FALSE(chunk->InYoungGeneration());
+ EXPECT_FALSE(slim_chunk->InYoungGeneration());
+ chunk->SetFlag(MemoryChunk::TO_PAGE);
+ EXPECT_TRUE(chunk->InYoungGeneration());
+ EXPECT_TRUE(slim_chunk->InYoungGeneration());
+ chunk->ClearFlag(MemoryChunk::TO_PAGE);
+ EXPECT_FALSE(chunk->InYoungGeneration());
+ EXPECT_FALSE(slim_chunk->InYoungGeneration());
}
-TEST_F(SpacesTest, WriteBarrierInNewSpaceFromSpace) {
+TEST_F(SpacesTest, WriteBarrierInYoungGenerationFromSpace) {
const size_t kSizeOfMemoryChunk = sizeof(MemoryChunk);
char memory[kSizeOfMemoryChunk];
memset(&memory, 0, kSizeOfMemoryChunk);
MemoryChunk* chunk = reinterpret_cast<MemoryChunk*>(&memory);
heap_internals::MemoryChunk* slim_chunk =
reinterpret_cast<heap_internals::MemoryChunk*>(&memory);
- EXPECT_FALSE(chunk->InNewSpace());
- EXPECT_FALSE(slim_chunk->InNewSpace());
- chunk->SetFlag(MemoryChunk::IN_FROM_SPACE);
- EXPECT_TRUE(chunk->InNewSpace());
- EXPECT_TRUE(slim_chunk->InNewSpace());
- chunk->ClearFlag(MemoryChunk::IN_FROM_SPACE);
- EXPECT_FALSE(chunk->InNewSpace());
- EXPECT_FALSE(slim_chunk->InNewSpace());
+ EXPECT_FALSE(chunk->InYoungGeneration());
+ EXPECT_FALSE(slim_chunk->InYoungGeneration());
+ chunk->SetFlag(MemoryChunk::FROM_PAGE);
+ EXPECT_TRUE(chunk->InYoungGeneration());
+ EXPECT_TRUE(slim_chunk->InYoungGeneration());
+ chunk->ClearFlag(MemoryChunk::FROM_PAGE);
+ EXPECT_FALSE(chunk->InYoungGeneration());
+ EXPECT_FALSE(slim_chunk->InYoungGeneration());
}
TEST_F(SpacesTest, CodeRangeAddressReuse) {
diff --git a/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc
index ed53b8b0d2..21051c6da5 100644
--- a/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc
+++ b/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc
@@ -7,6 +7,7 @@
#include "src/v8.h"
#include "src/ast/scopes.h"
+#include "src/hash-seed-inl.h"
#include "src/interpreter/bytecode-array-builder.h"
#include "src/interpreter/bytecode-array-iterator.h"
#include "src/interpreter/bytecode-jump-table.h"
@@ -34,7 +35,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
BytecodeArrayBuilder builder(zone(), 1, 131, &feedback_spec);
Factory* factory = isolate()->factory();
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
DeclarationScope scope(zone(), &ast_factory);
CHECK_EQ(builder.locals_count(), 131);
@@ -260,7 +261,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
.CompareOperation(Token::Value::GTE, reg, 6)
.CompareTypeOf(TestTypeOfFlags::LiteralFlag::kNumber)
.CompareOperation(Token::Value::INSTANCEOF, reg, 7)
- .CompareOperation(Token::Value::IN, reg)
+ .CompareOperation(Token::Value::IN, reg, 8)
.CompareReference(reg)
.CompareUndetectable()
.CompareUndefined()
@@ -279,10 +280,12 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Short jumps with Imm8 operands
{
- BytecodeLabel start, after_jump1, after_jump2, after_jump3, after_jump4,
+ BytecodeLoopHeader loop_header;
+ BytecodeLabel after_jump1, after_jump2, after_jump3, after_jump4,
after_jump5, after_jump6, after_jump7, after_jump8, after_jump9,
- after_jump10;
- builder.Bind(&start)
+ after_jump10, after_loop;
+ builder.JumpIfNull(&after_loop)
+ .Bind(&loop_header)
.Jump(&after_jump1)
.Bind(&after_jump1)
.JumpIfNull(&after_jump2)
@@ -303,14 +306,16 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
.Bind(&after_jump9)
.JumpIfFalse(ToBooleanMode::kAlreadyBoolean, &after_jump10)
.Bind(&after_jump10)
- .JumpLoop(&start, 0);
+ .JumpLoop(&loop_header, 0)
+ .Bind(&after_loop);
}
- // Longer jumps with constant operands
BytecodeLabel end[10];
{
+ // Longer jumps with constant operands
BytecodeLabel after_jump;
- builder.Jump(&end[0])
+ builder.JumpIfNull(&after_jump)
+ .Jump(&end[0])
.Bind(&after_jump)
.JumpIfTrue(ToBooleanMode::kConvertToBoolean, &end[1])
.JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &end[2])
@@ -336,10 +341,9 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
// Emit throw and re-throw in it's own basic block so that the rest of the
// code isn't omitted due to being dead.
- BytecodeLabel after_throw;
- builder.Throw().Bind(&after_throw);
- BytecodeLabel after_rethrow;
- builder.ReThrow().Bind(&after_rethrow);
+ BytecodeLabel after_throw, after_rethrow;
+ builder.JumpIfNull(&after_throw).Throw().Bind(&after_throw);
+ builder.JumpIfNull(&after_rethrow).ReThrow().Bind(&after_rethrow);
builder.ForInEnumerate(reg)
.ForInPrepare(triple, 1)
@@ -413,10 +417,10 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
builder.Debugger();
// Emit abort bytecode.
- {
- BytecodeLabel after;
- builder.Abort(AbortReason::kOperandIsASmi).Bind(&after);
- }
+ BytecodeLabel after_abort;
+ builder.JumpIfNull(&after_abort)
+ .Abort(AbortReason::kOperandIsASmi)
+ .Bind(&after_abort);
// Insert dummy ops to force longer jumps.
for (int i = 0; i < 256; i++) {
@@ -439,7 +443,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
ast_factory.Internalize(isolate());
Handle<BytecodeArray> the_array = builder.ToBytecodeArray(isolate());
CHECK_EQ(the_array->frame_size(),
- builder.total_register_count() * kPointerSize);
+ builder.total_register_count() * kSystemPointerSize);
// Build scorecard of bytecodes encountered in the BytecodeArray.
std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1);
@@ -504,7 +508,7 @@ TEST_F(BytecodeArrayBuilderTest, FrameSizesLookGood) {
Handle<BytecodeArray> the_array = builder.ToBytecodeArray(isolate());
int total_registers = locals + temps;
- CHECK_EQ(the_array->frame_size(), total_registers * kPointerSize);
+ CHECK_EQ(the_array->frame_size(), total_registers * kSystemPointerSize);
}
}
}
@@ -534,7 +538,7 @@ TEST_F(BytecodeArrayBuilderTest, Parameters) {
TEST_F(BytecodeArrayBuilderTest, Constants) {
BytecodeArrayBuilder builder(zone(), 1, 0);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
double heap_num_1 = 3.14;
double heap_num_2 = 5.2;
@@ -567,10 +571,11 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
Register reg(0);
BytecodeLabel far0, far1, far2, far3, far4;
BytecodeLabel near0, near1, near2, near3, near4;
- BytecodeLabel after_jump0, after_jump1;
+ BytecodeLabel after_jump_near0, after_jump_far0;
- builder.Jump(&near0)
- .Bind(&after_jump0)
+ builder.JumpIfNull(&after_jump_near0)
+ .Jump(&near0)
+ .Bind(&after_jump_near0)
.CompareOperation(Token::Value::EQ, reg, 1)
.JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &near1)
.CompareOperation(Token::Value::EQ, reg, 2)
@@ -584,8 +589,9 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
.Bind(&near2)
.Bind(&near3)
.Bind(&near4)
+ .JumpIfNull(&after_jump_far0)
.Jump(&far0)
- .Bind(&after_jump1)
+ .Bind(&after_jump_far0)
.CompareOperation(Token::Value::EQ, reg, 3)
.JumpIfTrue(ToBooleanMode::kAlreadyBoolean, &far1)
.CompareOperation(Token::Value::EQ, reg, 4)
@@ -601,9 +607,13 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
builder.Return();
Handle<BytecodeArray> array = builder.ToBytecodeArray(isolate());
- DCHECK_EQ(array->length(), 44 + kFarJumpDistance - 22 + 1);
+ DCHECK_EQ(array->length(), 48 + kFarJumpDistance - 22 + 1);
BytecodeArrayIterator iterator(array);
+
+ // Ignore JumpIfNull operation.
+ iterator.Advance();
+
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump);
CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), 22);
iterator.Advance();
@@ -636,6 +646,9 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) {
CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), 2);
iterator.Advance();
+ // Ignore JumpIfNull operation.
+ iterator.Advance();
+
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpConstant);
CHECK_EQ(iterator.GetConstantForIndexOperand(0),
Smi::FromInt(kFarJumpDistance));
@@ -681,11 +694,22 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) {
Register reg(0);
- BytecodeLabel label0;
- builder.Bind(&label0).JumpLoop(&label0, 0);
+ BytecodeLabel end;
+ builder.JumpIfNull(&end);
+
+ BytecodeLabel after_loop;
+ // Conditional jump to force the code after the JumpLoop to be live.
+ // Technically this jump is illegal because it's jumping into the middle of
+ // the subsequent loops, but that's ok for this unit test.
+ BytecodeLoopHeader loop_header;
+ builder.JumpIfNull(&after_loop)
+ .Bind(&loop_header)
+ .JumpLoop(&loop_header, 0)
+ .Bind(&after_loop);
for (int i = 0; i < 42; i++) {
- BytecodeLabel after_jump;
- builder.JumpLoop(&label0, 0).Bind(&after_jump);
+ BytecodeLabel after_loop;
+ // Conditional jump to force the code after the JumpLoop to be live.
+ builder.JumpIfNull(&after_loop).JumpLoop(&loop_header, 0).Bind(&after_loop);
}
// Add padding to force wide backwards jumps.
@@ -693,21 +717,28 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) {
builder.Debugger();
}
- builder.JumpLoop(&label0, 0);
- BytecodeLabel end;
+ builder.JumpLoop(&loop_header, 0);
builder.Bind(&end);
builder.Return();
Handle<BytecodeArray> array = builder.ToBytecodeArray(isolate());
BytecodeArrayIterator iterator(array);
+ // Ignore the JumpIfNull to the end
+ iterator.Advance();
+ // Ignore the JumpIfNull to after the first JumpLoop
+ iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop);
CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), 0);
iterator.Advance();
for (unsigned i = 0; i < 42; i++) {
+ // Ignore the JumpIfNull to after the JumpLoop
+ iterator.Advance();
+
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop);
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
- // offset of 3 (because kJumpLoop takes two immediate operands)
- CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), i * 3 + 3);
+ // offset of 5 (because kJumpLoop takes two immediate operands and
+ // JumpIfNull takes 1)
+ CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), i * 5 + 5);
iterator.Advance();
}
// Check padding to force wide backwards jumps.
@@ -717,7 +748,7 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) {
}
CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop);
CHECK_EQ(iterator.current_operand_scale(), OperandScale::kDouble);
- CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), 386);
+ CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), 42 * 5 + 256 + 4);
iterator.Advance();
CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
iterator.Advance();
@@ -820,71 +851,6 @@ TEST_F(BytecodeArrayBuilderTest, WideSwitch) {
CHECK(iterator.done());
}
-TEST_F(BytecodeArrayBuilderTest, LabelReuse) {
- BytecodeArrayBuilder builder(zone(), 1, 0);
-
- // Labels can only have 1 forward reference, but
- // can be referred to mulitple times once bound.
- BytecodeLabel label, after_jump0, after_jump1;
-
- builder.Jump(&label)
- .Bind(&label)
- .JumpLoop(&label, 0)
- .Bind(&after_jump0)
- .JumpLoop(&label, 0)
- .Bind(&after_jump1)
- .Return();
-
- Handle<BytecodeArray> array = builder.ToBytecodeArray(isolate());
- BytecodeArrayIterator iterator(array);
- CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump);
- CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), 2);
- iterator.Advance();
- CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop);
- CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), 0);
- iterator.Advance();
- CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop);
- CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), 3);
- iterator.Advance();
- CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
- iterator.Advance();
- CHECK(iterator.done());
-}
-
-
-TEST_F(BytecodeArrayBuilderTest, LabelAddressReuse) {
- static const int kRepeats = 3;
-
- BytecodeArrayBuilder builder(zone(), 1, 0);
- for (int i = 0; i < kRepeats; i++) {
- BytecodeLabel label, after_jump0, after_jump1;
- builder.Jump(&label)
- .Bind(&label)
- .JumpLoop(&label, 0)
- .Bind(&after_jump0)
- .JumpLoop(&label, 0)
- .Bind(&after_jump1);
- }
- builder.Return();
-
- Handle<BytecodeArray> array = builder.ToBytecodeArray(isolate());
- BytecodeArrayIterator iterator(array);
- for (int i = 0; i < kRepeats; i++) {
- CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump);
- CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), 2);
- iterator.Advance();
- CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop);
- CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), 0);
- iterator.Advance();
- CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop);
- CHECK_EQ(iterator.GetUnsignedImmediateOperand(0), 3);
- iterator.Advance();
- }
- CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn);
- iterator.Advance();
- CHECK(iterator.done());
-}
-
} // namespace interpreter
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc
index ec70605dde..0e72e2ec8d 100644
--- a/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc
+++ b/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc
@@ -4,6 +4,7 @@
#include "src/v8.h"
+#include "src/hash-seed-inl.h"
#include "src/interpreter/bytecode-array-builder.h"
#include "src/interpreter/bytecode-array-iterator.h"
#include "src/objects-inl.h"
@@ -27,7 +28,7 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) {
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
double heap_num_0 = 2.718;
double heap_num_1 = 2.0 * Smi::kMaxValue;
Smi zero = Smi::zero();
diff --git a/deps/v8/test/unittests/interpreter/bytecode-array-random-iterator-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-array-random-iterator-unittest.cc
index 2e2d92628f..6ec19fb726 100644
--- a/deps/v8/test/unittests/interpreter/bytecode-array-random-iterator-unittest.cc
+++ b/deps/v8/test/unittests/interpreter/bytecode-array-random-iterator-unittest.cc
@@ -4,6 +4,7 @@
#include "src/v8.h"
+#include "src/hash-seed-inl.h"
#include "src/interpreter/bytecode-array-builder.h"
#include "src/interpreter/bytecode-array-random-iterator.h"
#include "src/objects-inl.h"
@@ -27,7 +28,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, InvalidBeforeStart) {
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
double heap_num_0 = 2.718;
double heap_num_1 = 2.0 * Smi::kMaxValue;
Smi zero = Smi::zero();
@@ -81,7 +82,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, InvalidAfterEnd) {
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
double heap_num_0 = 2.718;
double heap_num_1 = 2.0 * Smi::kMaxValue;
Smi zero = Smi::zero();
@@ -135,7 +136,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, AccessesFirst) {
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
double heap_num_0 = 2.718;
double heap_num_1 = 2.0 * Smi::kMaxValue;
Smi zero = Smi::zero();
@@ -193,7 +194,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, AccessesLast) {
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
double heap_num_0 = 2.718;
double heap_num_1 = 2.0 * Smi::kMaxValue;
Smi zero = Smi::zero();
@@ -252,7 +253,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, RandomAccessValid) {
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
double heap_num_0 = 2.718;
double heap_num_1 = 2.0 * Smi::kMaxValue;
Smi zero = Smi::zero();
@@ -437,7 +438,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, IteratesBytecodeArray) {
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
double heap_num_0 = 2.718;
double heap_num_1 = 2.0 * Smi::kMaxValue;
Smi zero = Smi::zero();
@@ -716,7 +717,7 @@ TEST_F(BytecodeArrayRandomIteratorTest, IteratesBytecodeArrayBackwards) {
FeedbackVectorSpec feedback_spec(zone());
BytecodeArrayBuilder builder(zone(), 3, 3, &feedback_spec);
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
double heap_num_0 = 2.718;
double heap_num_1 = 2.0 * Smi::kMaxValue;
Smi zero = Smi::zero();
diff --git a/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc
index 7c01228936..35cc3b3c28 100644
--- a/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc
+++ b/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc
@@ -49,8 +49,8 @@ class BytecodeArrayWriterUnittest : public TestWithIsolateAndZone {
void WriteJump(Bytecode bytecode, BytecodeLabel* label,
BytecodeSourceInfo info = BytecodeSourceInfo());
- void WriteJumpLoop(Bytecode bytecode, BytecodeLabel* label, int depth,
- BytecodeSourceInfo info = BytecodeSourceInfo());
+ void WriteJumpLoop(Bytecode bytecode, BytecodeLoopHeader* loop_header,
+ int depth, BytecodeSourceInfo info = BytecodeSourceInfo());
BytecodeArrayWriter* writer() { return &bytecode_array_writer_; }
ZoneVector<unsigned char>* bytecodes() { return writer()->bytecodes(); }
@@ -105,10 +105,11 @@ void BytecodeArrayWriterUnittest::WriteJump(Bytecode bytecode,
}
void BytecodeArrayWriterUnittest::WriteJumpLoop(Bytecode bytecode,
- BytecodeLabel* label, int depth,
+ BytecodeLoopHeader* loop_header,
+ int depth,
BytecodeSourceInfo info) {
BytecodeNode node(bytecode, 0, depth, info);
- writer()->WriteJump(&node, label);
+ writer()->WriteJumpLoop(&node, loop_header);
}
TEST_F(BytecodeArrayWriterUnittest, SimpleExample) {
@@ -195,7 +196,8 @@ TEST_F(BytecodeArrayWriterUnittest, ComplexExample) {
{0, 30, false}, {1, 42, true}, {3, 42, false}, {6, 68, true},
{18, 63, true}, {32, 54, false}, {37, 85, true}, {46, 85, true}};
- BytecodeLabel back_jump, jump_for_in, jump_end_1, jump_end_2, jump_end_3;
+ BytecodeLoopHeader loop_header;
+ BytecodeLabel jump_for_in, jump_end_1, jump_end_2, jump_end_3;
Write(Bytecode::kStackCheck, {30, false});
Write(Bytecode::kLdaConstant, U8(0), {42, true});
@@ -206,7 +208,7 @@ TEST_F(BytecodeArrayWriterUnittest, ComplexExample) {
Write(Bytecode::kForInPrepare, R(3), U8(4));
Write(Bytecode::kLdaZero);
Write(Bytecode::kStar, R(7));
- writer()->BindLabel(&back_jump);
+ writer()->BindLoopHeader(&loop_header);
Write(Bytecode::kForInContinue, R(7), R(6), {63, true});
WriteJump(Bytecode::kJumpIfFalse, &jump_end_3);
Write(Bytecode::kForInNext, R(3), R(7), R(4), U8(1));
@@ -219,7 +221,7 @@ TEST_F(BytecodeArrayWriterUnittest, ComplexExample) {
writer()->BindLabel(&jump_for_in);
Write(Bytecode::kForInStep, R(7));
Write(Bytecode::kStar, R(7));
- WriteJumpLoop(Bytecode::kJumpLoop, &back_jump, 0);
+ WriteJumpLoop(Bytecode::kJumpLoop, &loop_header, 0);
writer()->BindLabel(&jump_end_1);
writer()->BindLabel(&jump_end_2);
writer()->BindLabel(&jump_end_3);
@@ -328,7 +330,9 @@ TEST_F(BytecodeArrayWriterUnittest, DeadcodeElimination) {
Write(Bytecode::kLdaSmi, 127); // Dead code.
WriteJump(Bytecode::kJumpIfFalse, &after_conditional_jump); // Dead code.
writer()->BindLabel(&after_jump);
- writer()->BindLabel(&after_conditional_jump);
+ // We would bind the after_conditional_jump label here, but the jump to it is
+ // dead.
+ CHECK(!after_conditional_jump.has_referrer_jump());
Write(Bytecode::kLdaSmi, 127, {65, true});
WriteJump(Bytecode::kJumpIfFalse, &after_return);
Write(Bytecode::kReturn, {75, true});
diff --git a/deps/v8/test/unittests/interpreter/bytecode-utils.h b/deps/v8/test/unittests/interpreter/bytecode-utils.h
index 401884559e..912e9dcb7b 100644
--- a/deps/v8/test/unittests/interpreter/bytecode-utils.h
+++ b/deps/v8/test/unittests/interpreter/bytecode-utils.h
@@ -33,7 +33,7 @@ namespace interpreter {
#define U8(i) static_cast<uint8_t>(i)
#define REG_OPERAND(i) \
- (InterpreterFrameConstants::kRegisterFileFromFp / kPointerSize - (i))
+ (InterpreterFrameConstants::kRegisterFileFromFp / kSystemPointerSize - (i))
#define R8(i) static_cast<uint8_t>(REG_OPERAND(i))
#define R16(i) U16(REG_OPERAND(i))
#define R32(i) U32(REG_OPERAND(i))
diff --git a/deps/v8/test/unittests/interpreter/bytecodes-unittest.cc b/deps/v8/test/unittests/interpreter/bytecodes-unittest.cc
index 16b4e80489..6f5a11c0c7 100644
--- a/deps/v8/test/unittests/interpreter/bytecodes-unittest.cc
+++ b/deps/v8/test/unittests/interpreter/bytecodes-unittest.cc
@@ -89,7 +89,7 @@ TEST(OperandScaling, ScalableAndNonScalable) {
1 + 2 + 2 * scale);
CHECK_EQ(Bytecodes::Size(Bytecode::kCreateObjectLiteral, operand_scale),
1 + 2 * scale + 1);
- CHECK_EQ(Bytecodes::Size(Bytecode::kTestIn, operand_scale), 1 + scale);
+ CHECK_EQ(Bytecodes::Size(Bytecode::kTestIn, operand_scale), 1 + 2 * scale);
}
}
diff --git a/deps/v8/test/unittests/interpreter/constant-array-builder-unittest.cc b/deps/v8/test/unittests/interpreter/constant-array-builder-unittest.cc
index 55f1cacf56..894aee16a4 100644
--- a/deps/v8/test/unittests/interpreter/constant-array-builder-unittest.cc
+++ b/deps/v8/test/unittests/interpreter/constant-array-builder-unittest.cc
@@ -6,6 +6,7 @@
#include "src/ast/ast-value-factory.h"
#include "src/handles-inl.h"
+#include "src/hash-seed-inl.h"
#include "src/heap/factory.h"
#include "src/interpreter/constant-array-builder.h"
#include "src/isolate.h"
@@ -34,7 +35,7 @@ TEST_F(ConstantArrayBuilderTest, AllocateAllEntries) {
CanonicalHandleScope canonical(isolate());
ConstantArrayBuilder builder(zone());
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
for (size_t i = 0; i < k16BitCapacity; i++) {
builder.Insert(i + 0.5);
}
@@ -84,7 +85,7 @@ TEST_F(ConstantArrayBuilderTest, ToLargeFixedArrayWithReservations) {
CanonicalHandleScope canonical(isolate());
ConstantArrayBuilder builder(zone());
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
static const int kNumberOfElements = 37373;
for (int i = 0; i < kNumberOfElements; i++) {
builder.CommitReservedEntry(builder.CreateReservedEntry(), Smi::FromInt(i));
@@ -104,7 +105,7 @@ TEST_F(ConstantArrayBuilderTest, AllocateEntriesWithIdx8Reservations) {
for (size_t reserved = 1; reserved < k8BitCapacity; reserved *= 3) {
ConstantArrayBuilder builder(zone());
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
for (size_t i = 0; i < reserved; i++) {
OperandSize operand_size = builder.CreateReservedEntry();
CHECK_EQ(operand_size, OperandSize::kByte);
@@ -172,7 +173,7 @@ TEST_F(ConstantArrayBuilderTest, AllocateEntriesWithWideReservations) {
for (size_t reserved = 1; reserved < k8BitCapacity; reserved *= 3) {
ConstantArrayBuilder builder(zone());
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
for (size_t i = 0; i < k8BitCapacity; i++) {
builder.CommitReservedEntry(builder.CreateReservedEntry(),
Smi::FromInt(static_cast<int>(i)));
@@ -217,7 +218,7 @@ TEST_F(ConstantArrayBuilderTest, GapFilledWhenLowReservationCommitted) {
CanonicalHandleScope canonical(isolate());
ConstantArrayBuilder builder(zone());
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
for (size_t i = 0; i < k8BitCapacity; i++) {
OperandSize operand_size = builder.CreateReservedEntry();
CHECK_EQ(OperandSize::kByte, operand_size);
@@ -283,7 +284,7 @@ TEST_F(ConstantArrayBuilderTest, HolesWithUnusedReservations) {
static int k8BitCapacity = ConstantArrayBuilder::k8BitCapacity;
ConstantArrayBuilder builder(zone());
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
for (int i = 0; i < kNumberOfHoles; ++i) {
CHECK_EQ(builder.CreateReservedEntry(), OperandSize::kByte);
}
@@ -316,7 +317,7 @@ TEST_F(ConstantArrayBuilderTest, ReservationsAtAllScales) {
CanonicalHandleScope canonical(isolate());
ConstantArrayBuilder builder(zone());
AstValueFactory ast_factory(zone(), isolate()->ast_string_constants(),
- isolate()->heap()->HashSeed());
+ HashSeed(isolate()));
for (int i = 0; i < 256; i++) {
CHECK_EQ(builder.CreateReservedEntry(), OperandSize::kByte);
}
diff --git a/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc b/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc
index d5f84952c3..bf240e41a4 100644
--- a/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc
+++ b/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc
@@ -72,8 +72,9 @@ Matcher<Node*> InterpreterAssemblerTest::InterpreterAssemblerForTest::IsStore(
Matcher<Node*> InterpreterAssemblerTest::InterpreterAssemblerForTest::IsWordNot(
const Matcher<Node*>& value_matcher) {
- return kPointerSize == 8 ? IsWord64Xor(value_matcher, c::IsInt64Constant(-1))
- : IsWord32Xor(value_matcher, c::IsInt32Constant(-1));
+ return kSystemPointerSize == 8
+ ? IsWord64Xor(value_matcher, c::IsInt64Constant(-1))
+ : IsWord32Xor(value_matcher, c::IsInt32Constant(-1));
}
Matcher<Node*>
@@ -291,10 +292,10 @@ InterpreterAssemblerTest::InterpreterAssemblerForTest::IsLoadRegisterOperand(
int offset, OperandSize operand_size) {
Matcher<compiler::Node*> reg_operand = IsChangeInt32ToIntPtr(
IsSignedOperand(offset, operand_size, LoadSensitivity::kSafe));
- return IsLoad(
- MachineType::AnyTagged(), c::IsLoadParentFramePointer(),
- c::IsWordShl(reg_operand, c::IsIntPtrConstant(kPointerSizeLog2)),
- LoadSensitivity::kCritical);
+ return IsBitcastWordToTagged(IsLoad(
+ MachineType::Pointer(), c::IsLoadParentFramePointer(),
+ c::IsWordShl(reg_operand, c::IsIntPtrConstant(kSystemPointerSizeLog2)),
+ LoadSensitivity::kCritical));
}
TARGET_TEST_F(InterpreterAssemblerTest, Jump) {
@@ -321,7 +322,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, Jump) {
MachineType::Pointer(),
c::IsParameter(InterpreterDispatchDescriptor::kDispatchTable),
c::IsWordShl(target_bytecode_matcher,
- c::IsIntPtrConstant(kPointerSizeLog2)));
+ c::IsIntPtrConstant(kSystemPointerSizeLog2)));
EXPECT_THAT(
tail_call_node,
@@ -418,9 +419,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, GetContext) {
InterpreterAssemblerForTest m(&state, bytecode);
EXPECT_THAT(
m.GetContext(),
- m.IsLoad(MachineType::AnyTagged(), c::IsLoadParentFramePointer(),
- c::IsIntPtrConstant(Register::current_context().ToOperand()
- << kPointerSizeLog2)));
+ IsBitcastWordToTagged(m.IsLoad(
+ MachineType::Pointer(), c::IsLoadParentFramePointer(),
+ c::IsIntPtrConstant(Register::current_context().ToOperand() *
+ kSystemPointerSize))));
}
}
@@ -457,7 +459,7 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadConstantPoolEntry) {
MachineType::AnyTagged(), constant_pool_matcher,
c::IsIntPtrAdd(
c::IsIntPtrConstant(FixedArray::kHeaderSize - kHeapObjectTag),
- c::IsWordShl(index, c::IsIntPtrConstant(kPointerSizeLog2))),
+ c::IsWordShl(index, c::IsIntPtrConstant(kTaggedSizeLog2))),
LoadSensitivity::kCritical));
}
}
@@ -533,10 +535,10 @@ TARGET_TEST_F(InterpreterAssemblerTest, LoadFeedbackVector) {
InterpreterAssemblerForTest m(&state, bytecode);
Node* feedback_vector = m.LoadFeedbackVector();
- Matcher<Node*> load_function_matcher =
- m.IsLoad(MachineType::AnyTagged(), c::IsLoadParentFramePointer(),
- c::IsIntPtrConstant(Register::function_closure().ToOperand()
- << kPointerSizeLog2));
+ Matcher<Node*> load_function_matcher = IsBitcastWordToTagged(
+ m.IsLoad(MachineType::Pointer(), c::IsLoadParentFramePointer(),
+ c::IsIntPtrConstant(Register::function_closure().ToOperand() *
+ kSystemPointerSize)));
Matcher<Node*> load_vector_cell_matcher = m.IsLoad(
MachineType::AnyTagged(), load_function_matcher,
c::IsIntPtrConstant(JSFunction::kFeedbackCellOffset - kHeapObjectTag));
diff --git a/deps/v8/test/unittests/microtask-queue-unittest.cc b/deps/v8/test/unittests/microtask-queue-unittest.cc
index cc2c7f0de7..f39a1558c6 100644
--- a/deps/v8/test/unittests/microtask-queue-unittest.cc
+++ b/deps/v8/test/unittests/microtask-queue-unittest.cc
@@ -10,7 +10,11 @@
#include <vector>
#include "src/heap/factory.h"
+#include "src/objects-inl.h"
#include "src/objects/foreign.h"
+#include "src/objects/js-array-inl.h"
+#include "src/objects/js-objects-inl.h"
+#include "src/objects/promise-inl.h"
#include "src/visitors.h"
#include "test/unittests/test-utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -25,7 +29,29 @@ void RunStdFunction(void* data) {
(*f)();
}
-class MicrotaskQueueTest : public TestWithNativeContext {
+template <typename TMixin>
+class WithFinalizationGroupMixin : public TMixin {
+ public:
+ WithFinalizationGroupMixin() {
+ FLAG_harmony_weak_refs = true;
+ FLAG_expose_gc = true;
+ }
+
+ private:
+ SaveFlags save_flags_;
+
+ DISALLOW_COPY_AND_ASSIGN(WithFinalizationGroupMixin);
+};
+
+using TestWithNativeContextAndFinalizationGroup = //
+ WithInternalIsolateMixin< //
+ WithContextMixin< //
+ WithFinalizationGroupMixin< //
+ WithIsolateScopeMixin< //
+ WithSharedIsolateMixin< //
+ ::testing::Test>>>>>;
+
+class MicrotaskQueueTest : public TestWithNativeContextAndFinalizationGroup {
public:
template <typename F>
Handle<Microtask> NewMicrotask(F&& f) {
@@ -55,6 +81,11 @@ class MicrotaskQueueTest : public TestWithNativeContext {
microtask_queue_ = nullptr;
}
+ template <size_t N>
+ Handle<Name> NameFromChars(const char (&chars)[N]) {
+ return isolate()->factory()->NewStringFromStaticChars(chars);
+ }
+
private:
std::unique_ptr<MicrotaskQueue> microtask_queue_;
};
@@ -88,7 +119,7 @@ TEST_F(MicrotaskQueueTest, EnqueueAndRun) {
}));
EXPECT_EQ(MicrotaskQueue::kMinimumCapacity, microtask_queue()->capacity());
EXPECT_EQ(1, microtask_queue()->size());
- microtask_queue()->RunMicrotasks(isolate());
+ EXPECT_EQ(1, microtask_queue()->RunMicrotasks(isolate()));
EXPECT_TRUE(ran);
EXPECT_EQ(0, microtask_queue()->size());
}
@@ -100,7 +131,7 @@ TEST_F(MicrotaskQueueTest, BufferGrowth) {
// Enqueue and flush the queue first to have non-zero |start_|.
microtask_queue()->EnqueueMicrotask(
*NewMicrotask([&count] { EXPECT_EQ(0, count++); }));
- microtask_queue()->RunMicrotasks(isolate());
+ EXPECT_EQ(1, microtask_queue()->RunMicrotasks(isolate()));
EXPECT_LT(0, microtask_queue()->capacity());
EXPECT_EQ(0, microtask_queue()->size());
@@ -122,7 +153,8 @@ TEST_F(MicrotaskQueueTest, BufferGrowth) {
EXPECT_EQ(MicrotaskQueue::kMinimumCapacity + 1, microtask_queue()->size());
// Run all pending Microtasks to ensure they run in the proper order.
- microtask_queue()->RunMicrotasks(isolate());
+ EXPECT_EQ(MicrotaskQueue::kMinimumCapacity + 1,
+ microtask_queue()->RunMicrotasks(isolate()));
EXPECT_EQ(MicrotaskQueue::kMinimumCapacity + 2, count);
}
@@ -163,7 +195,8 @@ TEST_F(MicrotaskQueueTest, VisitRoot) {
for (int i = 0; i < MicrotaskQueue::kMinimumCapacity / 2 + 1; ++i) {
microtask_queue()->EnqueueMicrotask(*NewMicrotask([] {}));
}
- microtask_queue()->RunMicrotasks(isolate());
+ EXPECT_EQ(MicrotaskQueue::kMinimumCapacity / 2 + 1,
+ microtask_queue()->RunMicrotasks(isolate()));
std::vector<Object> expected;
for (int i = 0; i < MicrotaskQueue::kMinimumCapacity / 2 + 1; ++i) {
@@ -183,5 +216,287 @@ TEST_F(MicrotaskQueueTest, VisitRoot) {
EXPECT_EQ(expected, actual);
}
+TEST_F(MicrotaskQueueTest, PromiseHandlerContext) {
+ Local<v8::Context> v8_context2 = v8::Context::New(v8_isolate());
+ Local<v8::Context> v8_context3 = v8::Context::New(v8_isolate());
+ Local<v8::Context> v8_context4 = v8::Context::New(v8_isolate());
+ Handle<Context> context2 = Utils::OpenHandle(*v8_context2, isolate());
+ Handle<Context> context3 = Utils::OpenHandle(*v8_context3, isolate());
+ Handle<Context> context4 = Utils::OpenHandle(*v8_context3, isolate());
+ context2->native_context()->set_microtask_queue(microtask_queue());
+ context3->native_context()->set_microtask_queue(microtask_queue());
+ context4->native_context()->set_microtask_queue(microtask_queue());
+
+ Handle<JSFunction> handler;
+ Handle<JSProxy> proxy;
+ Handle<JSProxy> revoked_proxy;
+ Handle<JSBoundFunction> bound;
+
+ // Create a JSFunction on |context2|
+ {
+ v8::Context::Scope scope(v8_context2);
+ handler = RunJS<JSFunction>("()=>{}");
+ EXPECT_EQ(*context2,
+ *JSReceiver::GetContextForMicrotask(handler).ToHandleChecked());
+ }
+
+ // Create a JSProxy on |context3|.
+ {
+ v8::Context::Scope scope(v8_context3);
+ ASSERT_TRUE(
+ v8_context3->Global()
+ ->Set(v8_context3, NewString("handler"), Utils::ToLocal(handler))
+ .FromJust());
+ proxy = RunJS<JSProxy>("new Proxy(handler, {})");
+ revoked_proxy = RunJS<JSProxy>(
+ "let {proxy, revoke} = Proxy.revocable(handler, {});"
+ "revoke();"
+ "proxy");
+ EXPECT_EQ(*context2,
+ *JSReceiver::GetContextForMicrotask(proxy).ToHandleChecked());
+ EXPECT_TRUE(JSReceiver::GetContextForMicrotask(revoked_proxy).is_null());
+ }
+
+ // Create a JSBoundFunction on |context4|.
+ // Note that its CreationContext and ContextForTaskCancellation is |context2|.
+ {
+ v8::Context::Scope scope(v8_context4);
+ ASSERT_TRUE(
+ v8_context4->Global()
+ ->Set(v8_context4, NewString("handler"), Utils::ToLocal(handler))
+ .FromJust());
+ bound = RunJS<JSBoundFunction>("handler.bind()");
+ EXPECT_EQ(*context2,
+ *JSReceiver::GetContextForMicrotask(bound).ToHandleChecked());
+ }
+
+ // Give the objects to the main context.
+ SetGlobalProperty("handler", Utils::ToLocal(handler));
+ SetGlobalProperty("proxy", Utils::ToLocal(proxy));
+ SetGlobalProperty("revoked_proxy", Utils::ToLocal(revoked_proxy));
+ SetGlobalProperty("bound", Utils::ToLocal(Handle<JSReceiver>::cast(bound)));
+ RunJS(
+ "Promise.resolve().then(handler);"
+ "Promise.reject().catch(proxy);"
+ "Promise.resolve().then(revoked_proxy);"
+ "Promise.resolve().then(bound);");
+
+ ASSERT_EQ(4, microtask_queue()->size());
+ Handle<Microtask> microtask1(microtask_queue()->get(0), isolate());
+ ASSERT_TRUE(microtask1->IsPromiseFulfillReactionJobTask());
+ EXPECT_EQ(*context2,
+ Handle<PromiseFulfillReactionJobTask>::cast(microtask1)->context());
+
+ Handle<Microtask> microtask2(microtask_queue()->get(1), isolate());
+ ASSERT_TRUE(microtask2->IsPromiseRejectReactionJobTask());
+ EXPECT_EQ(*context2,
+ Handle<PromiseRejectReactionJobTask>::cast(microtask2)->context());
+
+ Handle<Microtask> microtask3(microtask_queue()->get(2), isolate());
+ ASSERT_TRUE(microtask3->IsPromiseFulfillReactionJobTask());
+ // |microtask3| corresponds to a PromiseReaction for |revoked_proxy|.
+ // As |revoked_proxy| doesn't have a context, the current context should be
+ // used as the fallback context.
+ EXPECT_EQ(*native_context(),
+ Handle<PromiseFulfillReactionJobTask>::cast(microtask3)->context());
+
+ Handle<Microtask> microtask4(microtask_queue()->get(3), isolate());
+ ASSERT_TRUE(microtask4->IsPromiseFulfillReactionJobTask());
+ EXPECT_EQ(*context2,
+ Handle<PromiseFulfillReactionJobTask>::cast(microtask4)->context());
+
+ v8_context4->DetachGlobal();
+ v8_context3->DetachGlobal();
+ v8_context2->DetachGlobal();
+}
+
+TEST_F(MicrotaskQueueTest, DetachGlobal_Enqueue) {
+ EXPECT_EQ(0, microtask_queue()->size());
+
+ // Detach MicrotaskQueue from the current context.
+ context()->DetachGlobal();
+
+ // No microtask should be enqueued after DetachGlobal call.
+ EXPECT_EQ(0, microtask_queue()->size());
+ RunJS("Promise.resolve().then(()=>{})");
+ EXPECT_EQ(0, microtask_queue()->size());
+}
+
+TEST_F(MicrotaskQueueTest, DetachGlobal_Run) {
+ EXPECT_EQ(0, microtask_queue()->size());
+
+ // Enqueue microtasks to the current context.
+ Handle<JSArray> ran = RunJS<JSArray>(
+ "var ran = [false, false, false, false];"
+ "Promise.resolve().then(() => { ran[0] = true; });"
+ "Promise.reject().catch(() => { ran[1] = true; });"
+ "ran");
+
+ Handle<JSFunction> function =
+ RunJS<JSFunction>("(function() { ran[2] = true; })");
+ Handle<CallableTask> callable =
+ factory()->NewCallableTask(function, Utils::OpenHandle(*context()));
+ microtask_queue()->EnqueueMicrotask(*callable);
+
+ // The handler should not run at this point.
+ const int kNumExpectedTasks = 3;
+ for (int i = 0; i < kNumExpectedTasks; ++i) {
+ EXPECT_TRUE(
+ Object::GetElement(isolate(), ran, i).ToHandleChecked()->IsFalse());
+ }
+ EXPECT_EQ(kNumExpectedTasks, microtask_queue()->size());
+
+ // Detach MicrotaskQueue from the current context.
+ context()->DetachGlobal();
+
+ // RunMicrotasks processes pending Microtasks, but Microtasks that are
+ // associated to a detached context should be cancelled and should not take
+ // effect.
+ microtask_queue()->RunMicrotasks(isolate());
+ EXPECT_EQ(0, microtask_queue()->size());
+ for (int i = 0; i < kNumExpectedTasks; ++i) {
+ EXPECT_TRUE(
+ Object::GetElement(isolate(), ran, i).ToHandleChecked()->IsFalse());
+ }
+}
+
+TEST_F(MicrotaskQueueTest, DetachGlobal_FinalizationGroup) {
+ // Enqueue an FinalizationGroupCleanupTask.
+ Handle<JSArray> ran = RunJS<JSArray>(
+ "var ran = [false];"
+ "var wf = new FinalizationGroup(() => { ran[0] = true; });"
+ "(function() { wf.register({}, {}); })();"
+ "gc();"
+ "ran");
+
+ EXPECT_TRUE(
+ Object::GetElement(isolate(), ran, 0).ToHandleChecked()->IsFalse());
+ EXPECT_EQ(1, microtask_queue()->size());
+
+ // Detach MicrotaskQueue from the current context.
+ context()->DetachGlobal();
+
+ microtask_queue()->RunMicrotasks(isolate());
+
+ // RunMicrotasks processes the pending Microtask, but Microtasks that are
+ // associated to a detached context should be cancelled and should not take
+ // effect.
+ EXPECT_EQ(0, microtask_queue()->size());
+ EXPECT_TRUE(
+ Object::GetElement(isolate(), ran, 0).ToHandleChecked()->IsFalse());
+}
+
+namespace {
+
+void DummyPromiseHook(PromiseHookType type, Local<Promise> promise,
+ Local<Value> parent) {}
+
+} // namespace
+
+TEST_F(MicrotaskQueueTest, DetachGlobal_PromiseResolveThenableJobTask) {
+ // Use a PromiseHook to switch the implementation to ResolvePromise runtime,
+ // instead of ResolvePromise builtin.
+ v8_isolate()->SetPromiseHook(&DummyPromiseHook);
+
+ RunJS(
+ "var resolve;"
+ "var promise = new Promise(r => { resolve = r; });"
+ "promise.then(() => {});"
+ "resolve({});");
+
+ // A PromiseResolveThenableJobTask is pending in the MicrotaskQueue.
+ EXPECT_EQ(1, microtask_queue()->size());
+
+ // Detach MicrotaskQueue from the current context.
+ context()->DetachGlobal();
+
+ // RunMicrotasks processes the pending Microtask, but Microtasks that are
+ // associated to a detached context should be cancelled and should not take
+ // effect.
+ // As PromiseResolveThenableJobTask queues another task for resolution,
+ // the return value is 2 if it ran.
+ EXPECT_EQ(1, microtask_queue()->RunMicrotasks(isolate()));
+ EXPECT_EQ(0, microtask_queue()->size());
+}
+
+TEST_F(MicrotaskQueueTest, DetachGlobal_HandlerContext) {
+ // EnqueueMicrotask should use the context associated to the handler instead
+ // of the current context. E.g.
+ // // At Context A.
+ // let resolved = Promise.resolve();
+ // // Call DetachGlobal on A, so that microtasks associated to A is
+ // // cancelled.
+ //
+ // // At Context B.
+ // let handler = () => {
+ // console.log("here");
+ // };
+ // // The microtask to run |handler| should be associated to B instead of A,
+ // // so that handler runs even |resolved| is on the detached context A.
+ // resolved.then(handler);
+
+ Handle<JSReceiver> results = isolate()->factory()->NewJSObjectWithNullProto();
+
+ // These belong to a stale Context.
+ Handle<JSPromise> stale_resolved_promise;
+ Handle<JSPromise> stale_rejected_promise;
+ Handle<JSReceiver> stale_handler;
+
+ Local<v8::Context> sub_context = v8::Context::New(v8_isolate());
+ {
+ v8::Context::Scope scope(sub_context);
+ stale_resolved_promise = RunJS<JSPromise>("Promise.resolve()");
+ stale_rejected_promise = RunJS<JSPromise>("Promise.reject()");
+ stale_handler = RunJS<JSReceiver>(
+ "(results, label) => {"
+ " results[label] = true;"
+ "}");
+ }
+ // DetachGlobal() cancells all microtasks associated to the context.
+ sub_context->DetachGlobal();
+ sub_context.Clear();
+
+ SetGlobalProperty("results", Utils::ToLocal(results));
+ SetGlobalProperty(
+ "stale_resolved_promise",
+ Utils::ToLocal(Handle<JSReceiver>::cast(stale_resolved_promise)));
+ SetGlobalProperty(
+ "stale_rejected_promise",
+ Utils::ToLocal(Handle<JSReceiver>::cast(stale_rejected_promise)));
+ SetGlobalProperty("stale_handler", Utils::ToLocal(stale_handler));
+
+ // Set valid handlers to stale promises.
+ RunJS(
+ "stale_resolved_promise.then(() => {"
+ " results['stale_resolved_promise'] = true;"
+ "})");
+ RunJS(
+ "stale_rejected_promise.catch(() => {"
+ " results['stale_rejected_promise'] = true;"
+ "})");
+ microtask_queue()->RunMicrotasks(isolate());
+ EXPECT_TRUE(
+ JSReceiver::HasProperty(results, NameFromChars("stale_resolved_promise"))
+ .FromJust());
+ EXPECT_TRUE(
+ JSReceiver::HasProperty(results, NameFromChars("stale_rejected_promise"))
+ .FromJust());
+
+ // Set stale handlers to valid promises.
+ RunJS(
+ "Promise.resolve("
+ " stale_handler.bind(null, results, 'stale_handler_resolve'))");
+ RunJS(
+ "Promise.reject("
+ " stale_handler.bind(null, results, 'stale_handler_reject'))");
+ microtask_queue()->RunMicrotasks(isolate());
+ EXPECT_FALSE(
+ JSReceiver::HasProperty(results, NameFromChars("stale_handler_resolve"))
+ .FromJust());
+ EXPECT_FALSE(
+ JSReceiver::HasProperty(results, NameFromChars("stale_handler_reject"))
+ .FromJust());
+}
+
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/unittests/parser/ast-value-unittest.cc b/deps/v8/test/unittests/parser/ast-value-unittest.cc
index 72e35a43a0..c30823b4b1 100644
--- a/deps/v8/test/unittests/parser/ast-value-unittest.cc
+++ b/deps/v8/test/unittests/parser/ast-value-unittest.cc
@@ -4,6 +4,7 @@
#include "src/ast/ast-value-factory.h"
#include "src/ast/ast.h"
+#include "src/hash-seed-inl.h"
#include "src/heap/heap-inl.h"
#include "src/isolate-inl.h"
#include "src/zone/zone.h"
@@ -17,7 +18,7 @@ class AstValueTest : public TestWithIsolateAndZone {
protected:
AstValueTest()
: ast_value_factory_(zone(), i_isolate()->ast_string_constants(),
- i_isolate()->heap()->HashSeed()),
+ HashSeed(i_isolate())),
ast_node_factory_(&ast_value_factory_, zone()) {}
Literal* NewBigInt(const char* str) {
diff --git a/deps/v8/test/unittests/testcfg.py b/deps/v8/test/unittests/testcfg.py
index 05fdd85809..a7fd6dc463 100644
--- a/deps/v8/test/unittests/testcfg.py
+++ b/deps/v8/test/unittests/testcfg.py
@@ -15,9 +15,10 @@ class VariantsGenerator(testsuite.VariantsGenerator):
return self._standard_variant
-class TestSuite(testsuite.TestSuite):
- def ListTests(self):
- shell = os.path.abspath(os.path.join(self.test_config.shell_dir, self.name))
+class TestLoader(testsuite.TestLoader):
+ def _list_test_filenames(self):
+ shell = os.path.abspath(
+ os.path.join(self.test_config.shell_dir, "unittests"))
if utils.IsWindows():
shell += ".exe"
@@ -30,6 +31,7 @@ class TestSuite(testsuite.TestSuite):
output = cmd.execute()
if output.exit_code == 0:
break
+
print "Test executable failed to list the tests (try %d).\n\nCmd:" % i
print cmd
print "\nStdout:"
@@ -40,17 +42,22 @@ class TestSuite(testsuite.TestSuite):
else:
raise Exception("Test executable failed to list the tests.")
- tests = []
- test_case = ''
+ # TODO create an ExecutableTestLoader for refactoring this similar to
+ # JSTestLoader.
+ test_names = []
for line in output.stdout.splitlines():
test_desc = line.strip().split()[0]
if test_desc.endswith('.'):
test_case = test_desc
elif test_case and test_desc:
- test_path = test_case + test_desc
- tests.append(self._create_test(test_path))
- tests.sort(key=lambda t: t.path)
- return tests
+ test_names.append(test_case + test_desc)
+
+ return sorted(test_names)
+
+
+class TestSuite(testsuite.TestSuite):
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/unittests/torque/ls-json-unittest.cc b/deps/v8/test/unittests/torque/ls-json-unittest.cc
new file mode 100644
index 0000000000..5f0ec9252e
--- /dev/null
+++ b/deps/v8/test/unittests/torque/ls-json-unittest.cc
@@ -0,0 +1,103 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/torque/ls/json-parser.h"
+#include "src/torque/ls/json.h"
+#include "src/torque/source-positions.h"
+#include "test/unittests/test-utils.h"
+
+namespace v8 {
+namespace internal {
+namespace torque {
+namespace ls {
+
+TEST(LanguageServerJson, TestJsonPrimitives) {
+ const JsonValue true_result = ParseJson("true");
+ ASSERT_EQ(true_result.tag, JsonValue::BOOL);
+ EXPECT_EQ(true_result.ToBool(), true);
+
+ const JsonValue false_result = ParseJson("false");
+ ASSERT_EQ(false_result.tag, JsonValue::BOOL);
+ EXPECT_EQ(false_result.ToBool(), false);
+
+ const JsonValue null_result = ParseJson("null");
+ ASSERT_EQ(null_result.tag, JsonValue::IS_NULL);
+
+ const JsonValue number = ParseJson("42");
+ ASSERT_EQ(number.tag, JsonValue::NUMBER);
+ EXPECT_EQ(number.ToNumber(), 42);
+}
+
+TEST(LanguageServerJson, TestJsonStrings) {
+ const JsonValue basic = ParseJson("\"basic\"");
+ ASSERT_EQ(basic.tag, JsonValue::STRING);
+ EXPECT_EQ(basic.ToString(), "basic");
+
+ const JsonValue singleQuote = ParseJson("\"'\"");
+ ASSERT_EQ(singleQuote.tag, JsonValue::STRING);
+ EXPECT_EQ(singleQuote.ToString(), "'");
+}
+
+TEST(LanguageServerJson, TestJsonArrays) {
+ const JsonValue empty_array = ParseJson("[]");
+ ASSERT_EQ(empty_array.tag, JsonValue::ARRAY);
+ EXPECT_EQ(empty_array.ToArray().size(), (size_t)0);
+
+ const JsonValue number_array = ParseJson("[1, 2, 3, 4]");
+ ASSERT_EQ(number_array.tag, JsonValue::ARRAY);
+
+ const JsonArray& array = number_array.ToArray();
+ ASSERT_EQ(array.size(), (size_t)4);
+ ASSERT_EQ(array[1].tag, JsonValue::NUMBER);
+ EXPECT_EQ(array[1].ToNumber(), 2);
+
+ const JsonValue string_array_object = ParseJson("[\"a\", \"b\"]");
+ ASSERT_EQ(string_array_object.tag, JsonValue::ARRAY);
+
+ const JsonArray& string_array = string_array_object.ToArray();
+ ASSERT_EQ(string_array.size(), (size_t)2);
+ ASSERT_EQ(string_array[1].tag, JsonValue::STRING);
+ EXPECT_EQ(string_array[1].ToString(), "b");
+}
+
+TEST(LanguageServerJson, TestJsonObjects) {
+ const JsonValue empty_object = ParseJson("{}");
+ ASSERT_EQ(empty_object.tag, JsonValue::OBJECT);
+ EXPECT_EQ(empty_object.ToObject().size(), (size_t)0);
+
+ const JsonValue primitive_fields = ParseJson("{ \"flag\": true, \"id\": 5}");
+ EXPECT_EQ(primitive_fields.tag, JsonValue::OBJECT);
+
+ const JsonValue& flag = primitive_fields.ToObject().at("flag");
+ ASSERT_EQ(flag.tag, JsonValue::BOOL);
+ EXPECT_TRUE(flag.ToBool());
+
+ const JsonValue& id = primitive_fields.ToObject().at("id");
+ ASSERT_EQ(id.tag, JsonValue::NUMBER);
+ EXPECT_EQ(id.ToNumber(), 5);
+
+ const JsonValue& complex_fields =
+ ParseJson("{ \"array\": [], \"object\": { \"name\": \"torque\" } }");
+ ASSERT_EQ(complex_fields.tag, JsonValue::OBJECT);
+
+ const JsonValue& array = complex_fields.ToObject().at("array");
+ ASSERT_EQ(array.tag, JsonValue::ARRAY);
+ EXPECT_EQ(array.ToArray().size(), (size_t)0);
+
+ const JsonValue& object = complex_fields.ToObject().at("object");
+ ASSERT_EQ(object.tag, JsonValue::OBJECT);
+ ASSERT_EQ(object.ToObject().at("name").tag, JsonValue::STRING);
+ EXPECT_EQ(object.ToObject().at("name").ToString(), "torque");
+}
+
+TEST(LanguageServerJsonDeathTest, SyntaxError) {
+ ASSERT_DEATH(ParseJson("{]"), "Parser Error: unexpected token");
+ ASSERT_DEATH(ParseJson("{ noquoteskey: null }"),
+ "Lexer Error: unknown token");
+}
+
+} // namespace ls
+} // namespace torque
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/torque/ls-message-unittest.cc b/deps/v8/test/unittests/torque/ls-message-unittest.cc
new file mode 100644
index 0000000000..b8f7cf5864
--- /dev/null
+++ b/deps/v8/test/unittests/torque/ls-message-unittest.cc
@@ -0,0 +1,117 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/torque/ls/json.h"
+#include "src/torque/ls/message-handler.h"
+#include "src/torque/ls/message.h"
+#include "src/torque/server-data.h"
+#include "src/torque/source-positions.h"
+#include "test/unittests/test-utils.h"
+
+namespace v8 {
+namespace internal {
+namespace torque {
+namespace ls {
+
+TEST(LanguageServerMessage, InitializeRequest) {
+ InitializeRequest request;
+ request.set_id(5);
+ request.set_method("initialize");
+ request.params();
+
+ HandleMessage(request.GetJsonValue(), [](JsonValue& raw_response) {
+ InitializeResponse response(raw_response);
+
+ // Check that the response id matches up with the request id, and that
+ // the language server signals its support for definitions.
+ EXPECT_EQ(response.id(), 5);
+ EXPECT_EQ(response.result().capabilities().definitionProvider(), true);
+ });
+}
+
+TEST(LanguageServerMessage,
+ RegisterDynamicCapabilitiesAfterInitializedNotification) {
+ Request<bool> notification;
+ notification.set_method("initialized");
+
+ HandleMessage(notification.GetJsonValue(), [](JsonValue& raw_request) {
+ RegistrationRequest request(raw_request);
+
+ ASSERT_EQ(request.method(), "client/registerCapability");
+ ASSERT_EQ(request.params().registrations_size(), (size_t)1);
+
+ Registration registration = request.params().registrations(0);
+ ASSERT_EQ(registration.method(), "workspace/didChangeWatchedFiles");
+
+ auto options =
+ registration
+ .registerOptions<DidChangeWatchedFilesRegistrationOptions>();
+ ASSERT_EQ(options.watchers_size(), (size_t)1);
+ });
+}
+
+TEST(LanguageServerMessage, GotoDefinitionUnkownFile) {
+ SourceFileMap::Scope source_file_map_scope;
+
+ GotoDefinitionRequest request;
+ request.set_id(42);
+ request.set_method("textDocument/definition");
+ request.params().textDocument().set_uri("file:///unknown.tq");
+
+ HandleMessage(request.GetJsonValue(), [](JsonValue& raw_response) {
+ GotoDefinitionResponse response(raw_response);
+ EXPECT_EQ(response.id(), 42);
+ EXPECT_TRUE(response.IsNull("result"));
+ });
+}
+
+TEST(LanguageServerMessage, GotoDefinition) {
+ SourceFileMap::Scope source_file_map_scope;
+ SourceId test_id = SourceFileMap::AddSource("file://test.tq");
+ SourceId definition_id = SourceFileMap::AddSource("file://base.tq");
+
+ LanguageServerData::Scope server_data_scope;
+ LanguageServerData::AddDefinition({test_id, {1, 0}, {1, 10}},
+ {definition_id, {4, 1}, {4, 5}});
+
+ // First, check a unknown definition. The result must be null.
+ GotoDefinitionRequest request;
+ request.set_id(42);
+ request.set_method("textDocument/definition");
+ request.params().textDocument().set_uri("file://test.tq");
+ request.params().position().set_line(2);
+ request.params().position().set_character(0);
+
+ HandleMessage(request.GetJsonValue(), [](JsonValue& raw_response) {
+ GotoDefinitionResponse response(raw_response);
+ EXPECT_EQ(response.id(), 42);
+ EXPECT_TRUE(response.IsNull("result"));
+ });
+
+ // Second, check a known defintion.
+ request = GotoDefinitionRequest();
+ request.set_id(43);
+ request.set_method("textDocument/definition");
+ request.params().textDocument().set_uri("file://test.tq");
+ request.params().position().set_line(1);
+ request.params().position().set_character(5);
+
+ HandleMessage(request.GetJsonValue(), [](JsonValue& raw_response) {
+ GotoDefinitionResponse response(raw_response);
+ EXPECT_EQ(response.id(), 43);
+ ASSERT_FALSE(response.IsNull("result"));
+
+ Location location = response.result();
+ EXPECT_EQ(location.uri(), "file://base.tq");
+ EXPECT_EQ(location.range().start().line(), 4);
+ EXPECT_EQ(location.range().start().character(), 1);
+ EXPECT_EQ(location.range().end().line(), 4);
+ EXPECT_EQ(location.range().end().character(), 5);
+ });
+}
+
+} // namespace ls
+} // namespace torque
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/torque/torque-utils-unittest.cc b/deps/v8/test/unittests/torque/torque-utils-unittest.cc
new file mode 100644
index 0000000000..ff877a3c42
--- /dev/null
+++ b/deps/v8/test/unittests/torque/torque-utils-unittest.cc
@@ -0,0 +1,30 @@
+// Copyright 2019 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "src/torque/utils.h"
+#include "test/unittests/test-utils.h"
+
+namespace v8 {
+namespace internal {
+namespace torque {
+
+TEST(TorqueUtils, FileUriDecodeIllegal) {
+ EXPECT_EQ(FileUriDecode("http://wrong.scheme"), base::nullopt);
+ EXPECT_EQ(FileUriDecode("file://wrong-escape%"), base::nullopt);
+ EXPECT_EQ(FileUriDecode("file://another-wrong-escape%a"), base::nullopt);
+ EXPECT_EQ(FileUriDecode("file://no-hex-escape%0g"), base::nullopt);
+}
+
+TEST(TorqueUtils, FileUriDecode) {
+ EXPECT_EQ(FileUriDecode("file:///some/src/file.tq").value(),
+ "/some/src/file.tq");
+ EXPECT_EQ(FileUriDecode("file:///c%3A/torque/base.tq").value(),
+ "/c:/torque/base.tq");
+ EXPECT_EQ(FileUriDecode("file:///d%3a/lower/hex.txt").value(),
+ "/d:/lower/hex.txt");
+}
+
+} // namespace torque
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/unicode-unittest.cc b/deps/v8/test/unittests/unicode-unittest.cc
index 1bede08343..da1383c22c 100644
--- a/deps/v8/test/unittests/unicode-unittest.cc
+++ b/deps/v8/test/unittests/unicode-unittest.cc
@@ -50,9 +50,11 @@ void DecodeIncrementally(const std::vector<byte>& bytes,
std::vector<unibrow::uchar>* output) {
unibrow::Utf8::Utf8IncrementalBuffer buffer = 0;
unibrow::Utf8::State state = unibrow::Utf8::State::kAccept;
- for (size_t i = 0; i < bytes.size();) {
+ const byte* cursor = &bytes[0];
+ const byte* end = &bytes[bytes.size()];
+ while (cursor < end) {
unibrow::uchar result =
- unibrow::Utf8::ValueOfIncremental(bytes[i], &i, &state, &buffer);
+ unibrow::Utf8::ValueOfIncremental(&cursor, &state, &buffer);
if (result != unibrow::Utf8::kIncomplete) {
output->push_back(result);
}
diff --git a/deps/v8/test/unittests/unittests.status b/deps/v8/test/unittests/unittests.status
index 7582deaedd..a105afe987 100644
--- a/deps/v8/test/unittests/unittests.status
+++ b/deps/v8/test/unittests/unittests.status
@@ -22,9 +22,16 @@
}], # '(arch == arm or arch == mips) and not simulator_run'
##############################################################################
-['lite_mode', {
+['lite_mode or variant == jitless', {
# TODO(v8:7777): Re-enable once wasm is supported in jitless mode.
+ 'ValueSerializerTestWithSharedArrayBufferClone.RoundTripWebAssemblyMemory': [SKIP],
'ValueSerializerTestWithWasm.*': [SKIP],
-}], # lite_mode
+ 'Parameterized/WasmCodeManagerTest.*': [SKIP],
+}], # lite_mode or variant == jitless
+
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
]
diff --git a/deps/v8/test/unittests/utils-unittest.cc b/deps/v8/test/unittests/utils-unittest.cc
index c8032d187d..614880f2e7 100644
--- a/deps/v8/test/unittests/utils-unittest.cc
+++ b/deps/v8/test/unittests/utils-unittest.cc
@@ -24,7 +24,7 @@ typedef ::testing::Types<signed char, unsigned char,
int64_t, uint64_t>
IntegerTypes;
-TYPED_TEST_CASE(UtilsTest, IntegerTypes);
+TYPED_TEST_SUITE(UtilsTest, IntegerTypes);
TYPED_TEST(UtilsTest, SaturateSub) {
TypeParam min = std::numeric_limits<TypeParam>::min();
diff --git a/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc b/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc
index e13816744f..13161947e8 100644
--- a/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc
+++ b/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc
@@ -6,6 +6,7 @@
#include "src/objects-inl.h"
#include "src/objects.h"
+#include "src/ostreams.h"
#include "src/v8.h"
#include "src/wasm/function-body-decoder-impl.h"
#include "src/wasm/function-body-decoder.h"
@@ -54,40 +55,6 @@ static const WasmOpcode kInt32BinopOpcodes[] = {
#define WASM_BRV_IF_ZERO(depth, val) \
val, WASM_ZERO, kExprBrIf, static_cast<byte>(depth)
-#define EXPECT_VERIFIES_C(sig, x) \
- Verify(true, sigs.sig(), ArrayVector(x), kAppendEnd)
-
-#define EXPECT_FAILURE_C(sig, x, ...) \
- Verify(false, sigs.sig(), ArrayVector(x), kAppendEnd, ##__VA_ARGS__)
-
-#define EXPECT_VERIFIES_SC(sig, x) Verify(true, sig, ArrayVector(x), kAppendEnd)
-
-#define EXPECT_FAILURE_SC(sig, x) Verify(false, sig, ArrayVector(x), kAppendEnd)
-
-#define EXPECT_VERIFIES_S(env, ...) \
- do { \
- static byte code[] = {__VA_ARGS__}; \
- Verify(true, env, ArrayVector(code), kAppendEnd); \
- } while (false)
-
-#define EXPECT_FAILURE_S(env, ...) \
- do { \
- static byte code[] = {__VA_ARGS__}; \
- Verify(false, env, ArrayVector(code), kAppendEnd); \
- } while (false)
-
-#define EXPECT_VERIFIES(sig, ...) \
- do { \
- static const byte code[] = {__VA_ARGS__}; \
- EXPECT_VERIFIES_C(sig, code); \
- } while (false)
-
-#define EXPECT_FAILURE(sig, ...) \
- do { \
- static const byte code[] = {__VA_ARGS__}; \
- EXPECT_FAILURE_C(sig, code); \
- } while (false)
-
class FunctionBodyDecoderTest : public TestWithZone {
public:
typedef std::pair<uint32_t, ValueType> LocalsDecl;
@@ -116,7 +83,9 @@ class FunctionBodyDecoderTest : public TestWithZone {
// Prepend the local decls to the code.
local_decls.Emit(buffer);
// Emit the code.
- memcpy(buffer + locals_size, code.start(), code.size());
+ if (code.size() > 0) {
+ memcpy(buffer + locals_size, code.start(), code.size());
+ }
if (append_end == kAppendEnd) {
// Append an extra end opcode.
buffer[total_size - 1] = kExprEnd;
@@ -125,13 +94,28 @@ class FunctionBodyDecoderTest : public TestWithZone {
return {buffer, total_size};
}
+ template <size_t N>
+ Vector<const byte> CodeToVector(const byte (&code)[N]) {
+ return ArrayVector(code);
+ }
+
+ Vector<const byte> CodeToVector(
+ const std::initializer_list<const byte>& code) {
+ return VectorOf(&*code.begin(), code.size());
+ }
+
+ Vector<const byte> CodeToVector(Vector<const byte> vec) { return vec; }
+
// Prepends local variable declarations and renders nice error messages for
// verification failures.
- void Verify(bool expected_success, FunctionSig* sig, Vector<const byte> code,
- AppendEnd append_end, const char* message = nullptr) {
- code = PrepareBytecode(code, append_end);
-
- // Verify the code.
+ template <typename Code = std::initializer_list<const byte>>
+ void Validate(bool expected_success, FunctionSig* sig, Code&& raw_code,
+ AppendEnd append_end = kAppendEnd,
+ const char* message = nullptr) {
+ Vector<const byte> code =
+ PrepareBytecode(CodeToVector(std::forward<Code>(raw_code)), append_end);
+
+ // Validate the code.
FunctionBody body(sig, 0, code.start(), code.end());
WasmFeatures unused_detected_features;
DecodeResult result =
@@ -151,10 +135,24 @@ class FunctionBodyDecoderTest : public TestWithZone {
}
}
+ template <typename Code = std::initializer_list<const byte>>
+ void ExpectValidates(FunctionSig* sig, Code&& raw_code,
+ AppendEnd append_end = kAppendEnd,
+ const char* message = nullptr) {
+ Validate(true, sig, std::forward<Code>(raw_code), append_end, message);
+ }
+
+ template <typename Code = std::initializer_list<const byte>>
+ void ExpectFailure(FunctionSig* sig, Code&& raw_code,
+ AppendEnd append_end = kAppendEnd,
+ const char* message = nullptr) {
+ Validate(false, sig, std::forward<Code>(raw_code), append_end, message);
+ }
+
void TestBinop(WasmOpcode opcode, FunctionSig* success) {
// op(local[0], local[1])
byte code[] = {WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))};
- EXPECT_VERIFIES_SC(success, code);
+ ExpectValidates(success, code);
// Try all combinations of return and parameter types.
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
@@ -166,7 +164,7 @@ class FunctionBodyDecoderTest : public TestWithZone {
types[2] != success->GetParam(1)) {
// Test signature mismatch.
FunctionSig sig(1, 2, types);
- EXPECT_FAILURE_SC(&sig, code);
+ ExpectFailure(&sig, code);
}
}
}
@@ -183,7 +181,7 @@ class FunctionBodyDecoderTest : public TestWithZone {
{
ValueType types[] = {ret_type, param_type};
FunctionSig sig(1, 1, types);
- EXPECT_VERIFIES_SC(&sig, code);
+ ExpectValidates(&sig, code);
}
// Try all combinations of return and parameter types.
@@ -193,7 +191,7 @@ class FunctionBodyDecoderTest : public TestWithZone {
if (types[0] != ret_type || types[1] != param_type) {
// Test signature mismatch.
FunctionSig sig(1, 1, types);
- EXPECT_FAILURE_SC(&sig, code);
+ ExpectFailure(&sig, code);
}
}
}
@@ -254,6 +252,18 @@ class TestModuleBuilder {
return static_cast<byte>(mod.exceptions.size() - 1);
}
+ byte AddTable(ValueType type, uint32_t initial_size, bool has_maximum_size,
+ uint32_t maximum_size) {
+ CHECK(type == kWasmAnyRef || type == kWasmAnyFunc);
+ mod.tables.emplace_back();
+ WasmTable& table = mod.tables.back();
+ table.type = type;
+ table.initial_size = initial_size;
+ table.has_maximum_size = has_maximum_size;
+ table.maximum_size = maximum_size;
+ return static_cast<byte>(mod.tables.size() - 1);
+ }
+
void InitializeMemory() {
mod.has_memory = true;
mod.initial_pages = 1;
@@ -285,49 +295,47 @@ TEST_F(FunctionBodyDecoderTest, Int32Const1) {
byte code[] = {kExprI32Const, 0};
for (int i = -64; i <= 63; i++) {
code[1] = static_cast<byte>(i & 0x7F);
- EXPECT_VERIFIES_C(i_i, code);
+ ExpectValidates(sigs.i_i(), code);
}
}
TEST_F(FunctionBodyDecoderTest, RefNull) {
WASM_FEATURE_SCOPE(anyref);
- byte code[] = {kExprRefNull};
- EXPECT_VERIFIES_C(r_v, code);
+ ExpectValidates(sigs.r_v(), {kExprRefNull});
}
TEST_F(FunctionBodyDecoderTest, EmptyFunction) {
- Verify(true, sigs.v_v(), {}, kAppendEnd);
- Verify(false, sigs.i_i(), {}, kAppendEnd);
+ ExpectValidates(sigs.v_v(), {});
+ ExpectFailure(sigs.i_i(), {});
}
TEST_F(FunctionBodyDecoderTest, IncompleteIf1) {
byte code[] = {kExprIf};
- EXPECT_FAILURE_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.v_v(), code);
+ ExpectFailure(sigs.i_i(), code);
}
TEST_F(FunctionBodyDecoderTest, Int32Const_fallthru) {
- EXPECT_VERIFIES(i_i, WASM_I32V_1(0));
+ ExpectValidates(sigs.i_i(), {WASM_I32V_1(0)});
}
TEST_F(FunctionBodyDecoderTest, Int32Const_fallthru2) {
- EXPECT_FAILURE(i_i, WASM_I32V_1(0), WASM_I32V_1(1));
+ ExpectFailure(sigs.i_i(), {WASM_I32V_1(0), WASM_I32V_1(1)});
}
TEST_F(FunctionBodyDecoderTest, Int32Const) {
const int kInc = 4498211;
for (int32_t i = kMinInt; i < kMaxInt - kInc; i = i + kInc) {
// TODO(binji): expand test for other sized int32s; 1 through 5 bytes.
- byte code[] = {WASM_I32V(i)};
- EXPECT_VERIFIES_C(i_i, code);
+ ExpectValidates(sigs.i_i(), {WASM_I32V(i)});
}
}
TEST_F(FunctionBodyDecoderTest, Int64Const) {
const int kInc = 4498211;
for (int32_t i = kMinInt; i < kMaxInt - kInc; i = i + kInc) {
- byte code[] = {WASM_I64V((static_cast<int64_t>(i) << 32) | i)};
- EXPECT_VERIFIES_C(l_l, code);
+ ExpectValidates(sigs.l_l(),
+ {WASM_I64V((static_cast<uint64_t>(i) << 32) | i)});
}
}
@@ -336,7 +344,7 @@ TEST_F(FunctionBodyDecoderTest, Float32Const) {
Address ptr = reinterpret_cast<Address>(code + 1);
for (int i = 0; i < 30; i++) {
WriteLittleEndianValue<float>(ptr, i * -7.75f);
- EXPECT_VERIFIES_C(f_ff, code);
+ ExpectValidates(sigs.f_ff(), code);
}
}
@@ -345,7 +353,7 @@ TEST_F(FunctionBodyDecoderTest, Float64Const) {
Address ptr = reinterpret_cast<Address>(code + 1);
for (int i = 0; i < 30; i++) {
WriteLittleEndianValue<double>(ptr, i * 33.45);
- EXPECT_VERIFIES_C(d_dd, code);
+ ExpectValidates(sigs.d_dd(), code);
}
}
@@ -353,31 +361,31 @@ TEST_F(FunctionBodyDecoderTest, Int32Const_off_end) {
byte code[] = {kExprI32Const, 0xAA, 0xBB, 0xCC, 0x44};
for (size_t size = 1; size <= 4; ++size) {
- Verify(false, sigs.i_i(), {code, size}, kAppendEnd);
+ ExpectFailure(sigs.i_i(), VectorOf(code, size), kAppendEnd);
// Should also fail without the trailing 'end' opcode.
- Verify(false, sigs.i_i(), {code, size}, kOmitEnd);
+ ExpectFailure(sigs.i_i(), VectorOf(code, size), kOmitEnd);
}
}
TEST_F(FunctionBodyDecoderTest, GetLocal0_param) {
- EXPECT_VERIFIES_C(i_i, kCodeGetLocal0);
+ ExpectValidates(sigs.i_i(), kCodeGetLocal0);
}
TEST_F(FunctionBodyDecoderTest, GetLocal0_local) {
AddLocals(kWasmI32, 1);
- EXPECT_VERIFIES_C(i_v, kCodeGetLocal0);
+ ExpectValidates(sigs.i_v(), kCodeGetLocal0);
}
TEST_F(FunctionBodyDecoderTest, TooManyLocals) {
AddLocals(kWasmI32, 4034986500);
- EXPECT_FAILURE_C(i_v, kCodeGetLocal0);
+ ExpectFailure(sigs.i_v(), kCodeGetLocal0);
}
TEST_F(FunctionBodyDecoderTest, GetLocal0_param_n) {
FunctionSig* array[] = {sigs.i_i(), sigs.i_ii(), sigs.i_iii()};
for (size_t i = 0; i < arraysize(array); i++) {
- EXPECT_VERIFIES_SC(array[i], kCodeGetLocal0);
+ ExpectValidates(array[i], kCodeGetLocal0);
}
}
@@ -385,149 +393,143 @@ TEST_F(FunctionBodyDecoderTest, GetLocalN_local) {
for (byte i = 1; i < 8; i++) {
AddLocals(kWasmI32, 1);
for (byte j = 0; j < i; j++) {
- byte code[] = {kExprGetLocal, j};
- EXPECT_VERIFIES_C(i_v, code);
+ ExpectValidates(sigs.i_v(), {kExprGetLocal, j});
}
}
}
TEST_F(FunctionBodyDecoderTest, GetLocal0_fail_no_params) {
- EXPECT_FAILURE_C(i_v, kCodeGetLocal0);
+ ExpectFailure(sigs.i_v(), kCodeGetLocal0);
}
TEST_F(FunctionBodyDecoderTest, GetLocal1_fail_no_locals) {
- EXPECT_FAILURE_C(i_i, kCodeGetLocal1);
+ ExpectFailure(sigs.i_i(), kCodeGetLocal1);
}
TEST_F(FunctionBodyDecoderTest, GetLocal_off_end) {
- static const byte code[] = {kExprGetLocal};
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.i_i(), {kExprGetLocal});
}
TEST_F(FunctionBodyDecoderTest, NumLocalBelowLimit) {
AddLocals(kWasmI32, kV8MaxWasmFunctionLocals - 1);
- EXPECT_VERIFIES(v_v, WASM_NOP);
+ ExpectValidates(sigs.v_v(), {WASM_NOP});
}
TEST_F(FunctionBodyDecoderTest, NumLocalAtLimit) {
AddLocals(kWasmI32, kV8MaxWasmFunctionLocals);
- EXPECT_VERIFIES(v_v, WASM_NOP);
+ ExpectValidates(sigs.v_v(), {WASM_NOP});
}
TEST_F(FunctionBodyDecoderTest, NumLocalAboveLimit) {
AddLocals(kWasmI32, kV8MaxWasmFunctionLocals + 1);
- EXPECT_FAILURE(v_v, WASM_NOP);
+ ExpectFailure(sigs.v_v(), {WASM_NOP});
}
TEST_F(FunctionBodyDecoderTest, GetLocal_varint) {
const int kMaxLocals = kV8MaxWasmFunctionLocals - 1;
AddLocals(kWasmI32, kMaxLocals);
- EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_1(66));
- EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_2(7777));
- EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_3(8888));
- EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_4(9999));
+ ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_1(66)});
+ ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_2(7777)});
+ ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_3(8888)});
+ ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_4(9999)});
- EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_5(kMaxLocals - 1));
+ ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_5(kMaxLocals - 1)});
- EXPECT_FAILURE(i_i, kExprGetLocal, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF);
+ ExpectFailure(sigs.i_i(), {kExprGetLocal, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF});
- EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_4(kMaxLocals - 1));
- EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_4(kMaxLocals));
- EXPECT_FAILURE(i_i, kExprGetLocal, U32V_4(kMaxLocals + 1));
+ ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_4(kMaxLocals - 1)});
+ ExpectValidates(sigs.i_i(), {kExprGetLocal, U32V_4(kMaxLocals)});
+ ExpectFailure(sigs.i_i(), {kExprGetLocal, U32V_4(kMaxLocals + 1)});
- EXPECT_FAILURE(i_v, kExprGetLocal, U32V_4(kMaxLocals));
- EXPECT_FAILURE(i_v, kExprGetLocal, U32V_4(kMaxLocals + 1));
+ ExpectFailure(sigs.i_v(), {kExprGetLocal, U32V_4(kMaxLocals)});
+ ExpectFailure(sigs.i_v(), {kExprGetLocal, U32V_4(kMaxLocals + 1)});
}
TEST_F(FunctionBodyDecoderTest, GetLocal_toomany) {
AddLocals(kWasmI32, kV8MaxWasmFunctionLocals - 100);
AddLocals(kWasmI32, 100);
- EXPECT_VERIFIES(i_v, kExprGetLocal, U32V_1(66));
- EXPECT_FAILURE(i_i, kExprGetLocal, U32V_1(66));
+ ExpectValidates(sigs.i_v(), {kExprGetLocal, U32V_1(66)});
+ ExpectFailure(sigs.i_i(), {kExprGetLocal, U32V_1(66)});
}
TEST_F(FunctionBodyDecoderTest, Binops_off_end) {
byte code1[] = {0}; // [opcode]
for (size_t i = 0; i < arraysize(kInt32BinopOpcodes); i++) {
code1[0] = kInt32BinopOpcodes[i];
- EXPECT_FAILURE_C(i_i, code1);
+ ExpectFailure(sigs.i_i(), code1);
}
byte code3[] = {kExprGetLocal, 0, 0}; // [expr] [opcode]
for (size_t i = 0; i < arraysize(kInt32BinopOpcodes); i++) {
code3[2] = kInt32BinopOpcodes[i];
- EXPECT_FAILURE_C(i_i, code3);
+ ExpectFailure(sigs.i_i(), code3);
}
byte code4[] = {kExprGetLocal, 0, 0, 0}; // [expr] [opcode] [opcode]
for (size_t i = 0; i < arraysize(kInt32BinopOpcodes); i++) {
code4[2] = kInt32BinopOpcodes[i];
code4[3] = kInt32BinopOpcodes[i];
- EXPECT_FAILURE_C(i_i, code4);
+ ExpectFailure(sigs.i_i(), code4);
}
}
TEST_F(FunctionBodyDecoderTest, BinopsAcrossBlock1) {
- static const byte code[] = {WASM_ZERO, kExprBlock, kLocalI32,
- WASM_ZERO, kExprI32Add, kExprEnd};
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.i_i(), {WASM_ZERO, kExprBlock, kLocalI32, WASM_ZERO,
+ kExprI32Add, kExprEnd});
}
TEST_F(FunctionBodyDecoderTest, BinopsAcrossBlock2) {
- static const byte code[] = {WASM_ZERO, WASM_ZERO, kExprBlock,
- kLocalI32, kExprI32Add, kExprEnd};
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.i_i(), {WASM_ZERO, WASM_ZERO, kExprBlock, kLocalI32,
+ kExprI32Add, kExprEnd});
}
TEST_F(FunctionBodyDecoderTest, BinopsAcrossBlock3) {
- static const byte code[] = {WASM_ZERO, WASM_ZERO, kExprIf, kLocalI32,
- kExprI32Add, kExprElse, kExprI32Add, kExprEnd};
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.i_i(), {WASM_ZERO, WASM_ZERO, kExprIf, kLocalI32,
+ kExprI32Add, kExprElse, kExprI32Add, kExprEnd});
}
TEST_F(FunctionBodyDecoderTest, Nop) {
- static const byte code[] = {kExprNop};
- EXPECT_VERIFIES_C(v_v, code);
+ ExpectValidates(sigs.v_v(), {kExprNop});
}
TEST_F(FunctionBodyDecoderTest, SetLocal0_void) {
- EXPECT_FAILURE(i_i, WASM_SET_LOCAL(0, WASM_ZERO));
+ ExpectFailure(sigs.i_i(), {WASM_SET_LOCAL(0, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, SetLocal0_param) {
- EXPECT_FAILURE_C(i_i, kCodeSetLocal0);
- EXPECT_FAILURE_C(f_ff, kCodeSetLocal0);
- EXPECT_FAILURE_C(d_dd, kCodeSetLocal0);
+ ExpectFailure(sigs.i_i(), kCodeSetLocal0);
+ ExpectFailure(sigs.f_ff(), kCodeSetLocal0);
+ ExpectFailure(sigs.d_dd(), kCodeSetLocal0);
}
TEST_F(FunctionBodyDecoderTest, TeeLocal0_param) {
- EXPECT_VERIFIES_C(i_i, kCodeTeeLocal0);
- EXPECT_FAILURE_C(f_ff, kCodeTeeLocal0);
- EXPECT_FAILURE_C(d_dd, kCodeTeeLocal0);
+ ExpectValidates(sigs.i_i(), kCodeTeeLocal0);
+ ExpectFailure(sigs.f_ff(), kCodeTeeLocal0);
+ ExpectFailure(sigs.d_dd(), kCodeTeeLocal0);
}
TEST_F(FunctionBodyDecoderTest, SetLocal0_local) {
- EXPECT_FAILURE_C(i_v, kCodeSetLocal0);
- EXPECT_FAILURE_C(v_v, kCodeSetLocal0);
+ ExpectFailure(sigs.i_v(), kCodeSetLocal0);
+ ExpectFailure(sigs.v_v(), kCodeSetLocal0);
AddLocals(kWasmI32, 1);
- EXPECT_FAILURE_C(i_v, kCodeSetLocal0);
- EXPECT_VERIFIES_C(v_v, kCodeSetLocal0);
+ ExpectFailure(sigs.i_v(), kCodeSetLocal0);
+ ExpectValidates(sigs.v_v(), kCodeSetLocal0);
}
TEST_F(FunctionBodyDecoderTest, TeeLocal0_local) {
- EXPECT_FAILURE_C(i_v, kCodeTeeLocal0);
+ ExpectFailure(sigs.i_v(), kCodeTeeLocal0);
AddLocals(kWasmI32, 1);
- EXPECT_VERIFIES_C(i_v, kCodeTeeLocal0);
+ ExpectValidates(sigs.i_v(), kCodeTeeLocal0);
}
TEST_F(FunctionBodyDecoderTest, TeeLocalN_local) {
for (byte i = 1; i < 8; i++) {
AddLocals(kWasmI32, 1);
for (byte j = 0; j < i; j++) {
- EXPECT_FAILURE(v_v, WASM_TEE_LOCAL(j, WASM_I32V_1(i)));
- EXPECT_VERIFIES(i_i, WASM_TEE_LOCAL(j, WASM_I32V_1(i)));
+ ExpectFailure(sigs.v_v(), {WASM_TEE_LOCAL(j, WASM_I32V_1(i))});
+ ExpectValidates(sigs.i_i(), {WASM_TEE_LOCAL(j, WASM_I32V_1(i))});
}
}
}
@@ -541,243 +543,251 @@ TEST_F(FunctionBodyDecoderTest, BlockN) {
buffer[0] = kExprBlock;
buffer[1] = kLocalVoid;
buffer[i + 2] = kExprEnd;
- Verify(true, sigs.v_i(), {buffer, i + 3}, kAppendEnd);
+ ExpectValidates(sigs.v_i(), VectorOf(buffer, i + 3), kAppendEnd);
}
}
#define WASM_EMPTY_BLOCK kExprBlock, kLocalVoid, kExprEnd
TEST_F(FunctionBodyDecoderTest, Block0) {
- static const byte code[] = {WASM_EMPTY_BLOCK};
- EXPECT_VERIFIES_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
+ ExpectValidates(sigs.v_v(), {WASM_EMPTY_BLOCK});
+ ExpectFailure(sigs.i_i(), {WASM_EMPTY_BLOCK});
}
TEST_F(FunctionBodyDecoderTest, Block0_fallthru1) {
- static const byte code[] = {WASM_BLOCK(WASM_EMPTY_BLOCK)};
- EXPECT_VERIFIES_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
+ ExpectValidates(sigs.v_v(), {WASM_BLOCK(WASM_EMPTY_BLOCK)});
+ ExpectFailure(sigs.i_i(), {WASM_BLOCK(WASM_EMPTY_BLOCK)});
}
TEST_F(FunctionBodyDecoderTest, Block0Block0) {
- static const byte code[] = {WASM_EMPTY_BLOCK, WASM_EMPTY_BLOCK};
- EXPECT_VERIFIES_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
+ ExpectValidates(sigs.v_v(), {WASM_EMPTY_BLOCK, WASM_EMPTY_BLOCK});
+ ExpectFailure(sigs.i_i(), {WASM_EMPTY_BLOCK, WASM_EMPTY_BLOCK});
}
TEST_F(FunctionBodyDecoderTest, Block0_end) {
- EXPECT_FAILURE(v_v, WASM_EMPTY_BLOCK, kExprEnd);
+ ExpectFailure(sigs.v_v(), {WASM_EMPTY_BLOCK, kExprEnd});
}
#undef WASM_EMPTY_BLOCK
TEST_F(FunctionBodyDecoderTest, Block1) {
byte code[] = {WASM_BLOCK_I(WASM_GET_LOCAL(0))};
- EXPECT_VERIFIES_C(i_i, code);
- EXPECT_FAILURE_C(v_i, code);
- EXPECT_FAILURE_C(d_dd, code);
- EXPECT_FAILURE_C(i_f, code);
- EXPECT_FAILURE_C(i_d, code);
+ ExpectValidates(sigs.i_i(), code);
+ ExpectFailure(sigs.v_i(), code);
+ ExpectFailure(sigs.d_dd(), code);
+ ExpectFailure(sigs.i_f(), code);
+ ExpectFailure(sigs.i_d(), code);
}
TEST_F(FunctionBodyDecoderTest, Block1_i) {
byte code[] = {WASM_BLOCK_I(WASM_ZERO)};
- EXPECT_VERIFIES_C(i_i, code);
- EXPECT_FAILURE_C(f_ff, code);
- EXPECT_FAILURE_C(d_dd, code);
- EXPECT_FAILURE_C(l_ll, code);
+ ExpectValidates(sigs.i_i(), code);
+ ExpectFailure(sigs.f_ff(), code);
+ ExpectFailure(sigs.d_dd(), code);
+ ExpectFailure(sigs.l_ll(), code);
}
TEST_F(FunctionBodyDecoderTest, Block1_f) {
byte code[] = {WASM_BLOCK_F(WASM_F32(0))};
- EXPECT_FAILURE_C(i_i, code);
- EXPECT_VERIFIES_C(f_ff, code);
- EXPECT_FAILURE_C(d_dd, code);
- EXPECT_FAILURE_C(l_ll, code);
+ ExpectFailure(sigs.i_i(), code);
+ ExpectValidates(sigs.f_ff(), code);
+ ExpectFailure(sigs.d_dd(), code);
+ ExpectFailure(sigs.l_ll(), code);
}
TEST_F(FunctionBodyDecoderTest, Block1_continue) {
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_BR(0)));
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_BR(0))});
}
TEST_F(FunctionBodyDecoderTest, Block1_br) {
- EXPECT_VERIFIES(v_v, B1(WASM_BR(0)));
- EXPECT_VERIFIES(v_v, B1(WASM_BR(1)));
- EXPECT_FAILURE(v_v, B1(WASM_BR(2)));
+ ExpectValidates(sigs.v_v(), {B1(WASM_BR(0))});
+ ExpectValidates(sigs.v_v(), {B1(WASM_BR(1))});
+ ExpectFailure(sigs.v_v(), {B1(WASM_BR(2))});
}
TEST_F(FunctionBodyDecoderTest, Block2_br) {
- EXPECT_VERIFIES(v_v, B2(WASM_NOP, WASM_BR(0)));
- EXPECT_VERIFIES(v_v, B2(WASM_BR(0), WASM_NOP));
- EXPECT_VERIFIES(v_v, B2(WASM_BR(0), WASM_BR(0)));
+ ExpectValidates(sigs.v_v(), {B2(WASM_NOP, WASM_BR(0))});
+ ExpectValidates(sigs.v_v(), {B2(WASM_BR(0), WASM_NOP)});
+ ExpectValidates(sigs.v_v(), {B2(WASM_BR(0), WASM_BR(0))});
}
TEST_F(FunctionBodyDecoderTest, Block2) {
- EXPECT_FAILURE(i_i, WASM_BLOCK(WASM_NOP, WASM_NOP));
- EXPECT_FAILURE(i_i, WASM_BLOCK_I(WASM_NOP, WASM_NOP));
- EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_NOP, WASM_ZERO));
- EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_ZERO, WASM_NOP));
- EXPECT_FAILURE(i_i, WASM_BLOCK_I(WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.i_i(), {WASM_BLOCK(WASM_NOP, WASM_NOP)});
+ ExpectFailure(sigs.i_i(), {WASM_BLOCK_I(WASM_NOP, WASM_NOP)});
+ ExpectValidates(sigs.i_i(), {WASM_BLOCK_I(WASM_NOP, WASM_ZERO)});
+ ExpectValidates(sigs.i_i(), {WASM_BLOCK_I(WASM_ZERO, WASM_NOP)});
+ ExpectFailure(sigs.i_i(), {WASM_BLOCK_I(WASM_ZERO, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, Block2b) {
byte code[] = {WASM_BLOCK_I(WASM_SET_LOCAL(0, WASM_ZERO), WASM_ZERO)};
- EXPECT_VERIFIES_C(i_i, code);
- EXPECT_FAILURE_C(v_v, code);
- EXPECT_FAILURE_C(f_ff, code);
+ ExpectValidates(sigs.i_i(), code);
+ ExpectFailure(sigs.v_v(), code);
+ ExpectFailure(sigs.f_ff(), code);
}
TEST_F(FunctionBodyDecoderTest, Block2_fallthru) {
- EXPECT_VERIFIES(
- i_i, B2(WASM_SET_LOCAL(0, WASM_ZERO), WASM_SET_LOCAL(0, WASM_ZERO)),
- WASM_I32V_1(23));
+ ExpectValidates(sigs.i_i(), {B2(WASM_SET_LOCAL(0, WASM_ZERO),
+ WASM_SET_LOCAL(0, WASM_ZERO)),
+ WASM_I32V_1(23)});
}
TEST_F(FunctionBodyDecoderTest, Block3) {
- EXPECT_VERIFIES(i_i,
- WASM_BLOCK_I(WASM_SET_LOCAL(0, WASM_ZERO),
- WASM_SET_LOCAL(0, WASM_ZERO), WASM_I32V_1(11)));
+ ExpectValidates(sigs.i_i(), {WASM_BLOCK_I(WASM_SET_LOCAL(0, WASM_ZERO),
+ WASM_SET_LOCAL(0, WASM_ZERO),
+ WASM_I32V_1(11))});
}
TEST_F(FunctionBodyDecoderTest, Block5) {
- EXPECT_FAILURE(v_i, WASM_BLOCK(WASM_ZERO));
+ ExpectFailure(sigs.v_i(), {WASM_BLOCK(WASM_ZERO)});
- EXPECT_FAILURE(v_i, WASM_BLOCK(WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.v_i(), {WASM_BLOCK(WASM_ZERO, WASM_ZERO)});
- EXPECT_FAILURE(v_i, WASM_BLOCK(WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.v_i(), {WASM_BLOCK(WASM_ZERO, WASM_ZERO, WASM_ZERO)});
- EXPECT_FAILURE(v_i, WASM_BLOCK(WASM_ZERO, WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.v_i(),
+ {WASM_BLOCK(WASM_ZERO, WASM_ZERO, WASM_ZERO, WASM_ZERO)});
- EXPECT_FAILURE(
- v_i, WASM_BLOCK(WASM_ZERO, WASM_ZERO, WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.v_i(), {WASM_BLOCK(WASM_ZERO, WASM_ZERO, WASM_ZERO,
+ WASM_ZERO, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, BlockType) {
- EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_GET_LOCAL(0)));
- EXPECT_VERIFIES(l_l, WASM_BLOCK_L(WASM_GET_LOCAL(0)));
- EXPECT_VERIFIES(f_f, WASM_BLOCK_F(WASM_GET_LOCAL(0)));
- EXPECT_VERIFIES(d_d, WASM_BLOCK_D(WASM_GET_LOCAL(0)));
+ ExpectValidates(sigs.i_i(), {WASM_BLOCK_I(WASM_GET_LOCAL(0))});
+ ExpectValidates(sigs.l_l(), {WASM_BLOCK_L(WASM_GET_LOCAL(0))});
+ ExpectValidates(sigs.f_f(), {WASM_BLOCK_F(WASM_GET_LOCAL(0))});
+ ExpectValidates(sigs.d_d(), {WASM_BLOCK_D(WASM_GET_LOCAL(0))});
}
TEST_F(FunctionBodyDecoderTest, BlockType_fail) {
- EXPECT_FAILURE(i_i, WASM_BLOCK_L(WASM_I64V_1(0)));
- EXPECT_FAILURE(i_i, WASM_BLOCK_F(WASM_F32(0.0)));
- EXPECT_FAILURE(i_i, WASM_BLOCK_D(WASM_F64(1.1)));
+ ExpectFailure(sigs.i_i(), {WASM_BLOCK_L(WASM_I64V_1(0))});
+ ExpectFailure(sigs.i_i(), {WASM_BLOCK_F(WASM_F32(0.0))});
+ ExpectFailure(sigs.i_i(), {WASM_BLOCK_D(WASM_F64(1.1))});
- EXPECT_FAILURE(l_l, WASM_BLOCK_I(WASM_ZERO));
- EXPECT_FAILURE(l_l, WASM_BLOCK_F(WASM_F32(0.0)));
- EXPECT_FAILURE(l_l, WASM_BLOCK_D(WASM_F64(1.1)));
+ ExpectFailure(sigs.l_l(), {WASM_BLOCK_I(WASM_ZERO)});
+ ExpectFailure(sigs.l_l(), {WASM_BLOCK_F(WASM_F32(0.0))});
+ ExpectFailure(sigs.l_l(), {WASM_BLOCK_D(WASM_F64(1.1))});
- EXPECT_FAILURE(f_ff, WASM_BLOCK_I(WASM_ZERO));
- EXPECT_FAILURE(f_ff, WASM_BLOCK_L(WASM_I64V_1(0)));
- EXPECT_FAILURE(f_ff, WASM_BLOCK_D(WASM_F64(1.1)));
+ ExpectFailure(sigs.f_ff(), {WASM_BLOCK_I(WASM_ZERO)});
+ ExpectFailure(sigs.f_ff(), {WASM_BLOCK_L(WASM_I64V_1(0))});
+ ExpectFailure(sigs.f_ff(), {WASM_BLOCK_D(WASM_F64(1.1))});
- EXPECT_FAILURE(d_dd, WASM_BLOCK_I(WASM_ZERO));
- EXPECT_FAILURE(d_dd, WASM_BLOCK_L(WASM_I64V_1(0)));
- EXPECT_FAILURE(d_dd, WASM_BLOCK_F(WASM_F32(0.0)));
+ ExpectFailure(sigs.d_dd(), {WASM_BLOCK_I(WASM_ZERO)});
+ ExpectFailure(sigs.d_dd(), {WASM_BLOCK_L(WASM_I64V_1(0))});
+ ExpectFailure(sigs.d_dd(), {WASM_BLOCK_F(WASM_F32(0.0))});
}
TEST_F(FunctionBodyDecoderTest, BlockF32) {
static const byte code[] = {WASM_BLOCK_F(kExprF32Const, 0, 0, 0, 0)};
- EXPECT_VERIFIES_C(f_ff, code);
- EXPECT_FAILURE_C(i_i, code);
- EXPECT_FAILURE_C(d_dd, code);
+ ExpectValidates(sigs.f_ff(), code);
+ ExpectFailure(sigs.i_i(), code);
+ ExpectFailure(sigs.d_dd(), code);
}
TEST_F(FunctionBodyDecoderTest, BlockN_off_end) {
byte code[] = {WASM_BLOCK(kExprNop, kExprNop, kExprNop, kExprNop)};
- EXPECT_VERIFIES_C(v_v, code);
+ ExpectValidates(sigs.v_v(), code);
for (size_t i = 1; i < arraysize(code); i++) {
- Verify(false, sigs.v_v(), {code, i}, kAppendEnd);
- Verify(false, sigs.v_v(), {code, i}, kOmitEnd);
+ ExpectFailure(sigs.v_v(), VectorOf(code, i), kAppendEnd);
+ ExpectFailure(sigs.v_v(), VectorOf(code, i), kOmitEnd);
}
}
TEST_F(FunctionBodyDecoderTest, Block2_continue) {
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_NOP, WASM_BR(0)));
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_NOP, WASM_BR(1)));
- EXPECT_FAILURE(v_v, WASM_LOOP(WASM_NOP, WASM_BR(2)));
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_NOP, WASM_BR(0))});
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_NOP, WASM_BR(1))});
+ ExpectFailure(sigs.v_v(), {WASM_LOOP(WASM_NOP, WASM_BR(2))});
}
TEST_F(FunctionBodyDecoderTest, Block3_continue) {
- EXPECT_VERIFIES(v_v, B1(WASM_LOOP(WASM_NOP, WASM_BR(0))));
- EXPECT_VERIFIES(v_v, B1(WASM_LOOP(WASM_NOP, WASM_BR(1))));
- EXPECT_VERIFIES(v_v, B1(WASM_LOOP(WASM_NOP, WASM_BR(2))));
- EXPECT_FAILURE(v_v, B1(WASM_LOOP(WASM_NOP, WASM_BR(3))));
+ ExpectValidates(sigs.v_v(), {B1(WASM_LOOP(WASM_NOP, WASM_BR(0)))});
+ ExpectValidates(sigs.v_v(), {B1(WASM_LOOP(WASM_NOP, WASM_BR(1)))});
+ ExpectValidates(sigs.v_v(), {B1(WASM_LOOP(WASM_NOP, WASM_BR(2)))});
+ ExpectFailure(sigs.v_v(), {B1(WASM_LOOP(WASM_NOP, WASM_BR(3)))});
}
TEST_F(FunctionBodyDecoderTest, NestedBlock_return) {
- EXPECT_VERIFIES(i_i, B1(B1(WASM_RETURN1(WASM_ZERO))), WASM_ZERO);
+ ExpectValidates(sigs.i_i(), {B1(B1(WASM_RETURN1(WASM_ZERO))), WASM_ZERO});
}
TEST_F(FunctionBodyDecoderTest, BlockBrBinop) {
- EXPECT_VERIFIES(i_i, WASM_I32_AND(WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(1))),
- WASM_I32V_1(2)));
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_AND(WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(1))),
+ WASM_I32V_1(2))});
}
TEST_F(FunctionBodyDecoderTest, If_empty1) {
- EXPECT_VERIFIES(v_v, WASM_ZERO, WASM_IF_OP, kExprEnd);
+ ExpectValidates(sigs.v_v(), {WASM_ZERO, WASM_IF_OP, kExprEnd});
}
TEST_F(FunctionBodyDecoderTest, If_empty2) {
- EXPECT_VERIFIES(v_v, WASM_ZERO, WASM_IF_OP, kExprElse, kExprEnd);
+ ExpectValidates(sigs.v_v(), {WASM_ZERO, WASM_IF_OP, kExprElse, kExprEnd});
}
TEST_F(FunctionBodyDecoderTest, If_empty3) {
- EXPECT_VERIFIES(v_v, WASM_ZERO, WASM_IF_OP, WASM_NOP, kExprElse, kExprEnd);
- EXPECT_FAILURE(v_v, WASM_ZERO, WASM_IF_OP, WASM_ZERO, kExprElse, kExprEnd);
+ ExpectValidates(sigs.v_v(),
+ {WASM_ZERO, WASM_IF_OP, WASM_NOP, kExprElse, kExprEnd});
+ ExpectFailure(sigs.v_v(),
+ {WASM_ZERO, WASM_IF_OP, WASM_ZERO, kExprElse, kExprEnd});
}
TEST_F(FunctionBodyDecoderTest, If_empty4) {
- EXPECT_VERIFIES(v_v, WASM_ZERO, WASM_IF_OP, kExprElse, WASM_NOP, kExprEnd);
- EXPECT_FAILURE(v_v, WASM_ZERO, WASM_IF_OP, kExprElse, WASM_ZERO, kExprEnd);
+ ExpectValidates(sigs.v_v(),
+ {WASM_ZERO, WASM_IF_OP, kExprElse, WASM_NOP, kExprEnd});
+ ExpectFailure(sigs.v_v(),
+ {WASM_ZERO, WASM_IF_OP, kExprElse, WASM_ZERO, kExprEnd});
}
TEST_F(FunctionBodyDecoderTest, If_empty_stack) {
byte code[] = {kExprIf};
- EXPECT_FAILURE_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.v_v(), code);
+ ExpectFailure(sigs.i_i(), code);
}
TEST_F(FunctionBodyDecoderTest, If_incomplete1) {
byte code[] = {kExprI32Const, 0, kExprIf};
- EXPECT_FAILURE_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.v_v(), code);
+ ExpectFailure(sigs.i_i(), code);
}
TEST_F(FunctionBodyDecoderTest, If_incomplete2) {
byte code[] = {kExprI32Const, 0, kExprIf, kExprNop};
- EXPECT_FAILURE_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.v_v(), code);
+ ExpectFailure(sigs.i_i(), code);
}
TEST_F(FunctionBodyDecoderTest, If_else_else) {
byte code[] = {kExprI32Const, 0, WASM_IF_OP, kExprElse, kExprElse, kExprEnd};
- EXPECT_FAILURE_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.v_v(), code);
+ ExpectFailure(sigs.i_i(), code);
}
TEST_F(FunctionBodyDecoderTest, IfEmpty) {
- EXPECT_VERIFIES(v_i, kExprGetLocal, 0, WASM_IF_OP, kExprEnd);
+ ExpectValidates(sigs.v_i(), {kExprGetLocal, 0, WASM_IF_OP, kExprEnd});
}
TEST_F(FunctionBodyDecoderTest, IfSet) {
- EXPECT_VERIFIES(v_i,
- WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO)));
- EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0),
- WASM_SET_LOCAL(0, WASM_ZERO), WASM_NOP));
+ ExpectValidates(sigs.v_i(),
+ {WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO))});
+ ExpectValidates(sigs.v_i(),
+ {WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO),
+ WASM_NOP)});
}
TEST_F(FunctionBodyDecoderTest, IfElseEmpty) {
- EXPECT_VERIFIES(v_i, WASM_GET_LOCAL(0), WASM_IF_OP, kExprElse, kExprEnd);
- EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP));
+ ExpectValidates(sigs.v_i(),
+ {WASM_GET_LOCAL(0), WASM_IF_OP, kExprElse, kExprEnd});
+ ExpectValidates(sigs.v_i(),
+ {WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP)});
}
TEST_F(FunctionBodyDecoderTest, IfElseUnreachable1) {
- EXPECT_VERIFIES(i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_UNREACHABLE,
- WASM_GET_LOCAL(0)));
- EXPECT_VERIFIES(i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
- WASM_UNREACHABLE));
+ ExpectValidates(
+ sigs.i_i(),
+ {WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_UNREACHABLE, WASM_GET_LOCAL(0))});
+ ExpectValidates(
+ sigs.i_i(),
+ {WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE)});
}
TEST_F(FunctionBodyDecoderTest, IfElseUnreachable2) {
@@ -788,247 +798,258 @@ TEST_F(FunctionBodyDecoderTest, IfElseUnreachable2) {
ValueType types[] = {kWasmI32, kValueTypes[i]};
FunctionSig sig(1, 1, types);
- if (kValueTypes[i] == kWasmI32) {
- EXPECT_VERIFIES_SC(&sig, code);
- } else {
- EXPECT_FAILURE_SC(&sig, code);
- }
+ Validate(kValueTypes[i] == kWasmI32, &sig, code);
}
}
TEST_F(FunctionBodyDecoderTest, OneArmedIfWithArity) {
static const byte code[] = {WASM_ZERO, kExprIf, kLocalI32, WASM_ONE,
kExprEnd};
- EXPECT_FAILURE_C(i_v, code,
- "start-arity and end-arity of one-armed if must match");
+ ExpectFailure(sigs.i_v(), code, kAppendEnd,
+ "start-arity and end-arity of one-armed if must match");
}
TEST_F(FunctionBodyDecoderTest, IfBreak) {
- EXPECT_VERIFIES(v_i, WASM_IF(WASM_GET_LOCAL(0), WASM_BR(0)));
- EXPECT_VERIFIES(v_i, WASM_IF(WASM_GET_LOCAL(0), WASM_BR(1)));
- EXPECT_FAILURE(v_i, WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2)));
+ ExpectValidates(sigs.v_i(), {WASM_IF(WASM_GET_LOCAL(0), WASM_BR(0))});
+ ExpectValidates(sigs.v_i(), {WASM_IF(WASM_GET_LOCAL(0), WASM_BR(1))});
+ ExpectFailure(sigs.v_i(), {WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2))});
}
TEST_F(FunctionBodyDecoderTest, IfElseBreak) {
- EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_BR(0)));
- EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_BR(1)));
- EXPECT_FAILURE(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_BR(2)));
+ ExpectValidates(sigs.v_i(),
+ {WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_BR(0))});
+ ExpectValidates(sigs.v_i(),
+ {WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_BR(1))});
+ ExpectFailure(sigs.v_i(),
+ {WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_BR(2))});
}
TEST_F(FunctionBodyDecoderTest, Block_else) {
byte code[] = {kExprI32Const, 0, kExprBlock, kExprElse, kExprEnd};
- EXPECT_FAILURE_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.v_v(), code);
+ ExpectFailure(sigs.i_i(), code);
}
TEST_F(FunctionBodyDecoderTest, IfNop) {
- EXPECT_VERIFIES(v_i, WASM_IF(WASM_GET_LOCAL(0), WASM_NOP));
- EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP));
+ ExpectValidates(sigs.v_i(), {WASM_IF(WASM_GET_LOCAL(0), WASM_NOP)});
+ ExpectValidates(sigs.v_i(),
+ {WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP)});
}
TEST_F(FunctionBodyDecoderTest, If_end) {
- EXPECT_VERIFIES(v_i, kExprGetLocal, 0, WASM_IF_OP, kExprEnd);
- EXPECT_FAILURE(v_i, kExprGetLocal, 0, WASM_IF_OP, kExprEnd, kExprEnd);
+ ExpectValidates(sigs.v_i(), {kExprGetLocal, 0, WASM_IF_OP, kExprEnd});
+ ExpectFailure(sigs.v_i(), {kExprGetLocal, 0, WASM_IF_OP, kExprEnd, kExprEnd});
}
TEST_F(FunctionBodyDecoderTest, If_falloff1) {
- EXPECT_FAILURE(v_i, kExprGetLocal, 0, kExprIf);
- EXPECT_FAILURE(v_i, kExprGetLocal, 0, WASM_IF_OP);
- EXPECT_FAILURE(v_i, kExprGetLocal, 0, WASM_IF_OP, kExprNop, kExprElse);
+ ExpectFailure(sigs.v_i(), {kExprGetLocal, 0, kExprIf});
+ ExpectFailure(sigs.v_i(), {kExprGetLocal, 0, WASM_IF_OP});
+ ExpectFailure(sigs.v_i(),
+ {kExprGetLocal, 0, WASM_IF_OP, kExprNop, kExprElse});
}
TEST_F(FunctionBodyDecoderTest, IfElseNop) {
- EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0),
- WASM_SET_LOCAL(0, WASM_ZERO), WASM_NOP));
+ ExpectValidates(sigs.v_i(),
+ {WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO),
+ WASM_NOP)});
}
TEST_F(FunctionBodyDecoderTest, IfBlock1) {
- EXPECT_VERIFIES(
- v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), B1(WASM_SET_LOCAL(0, WASM_ZERO)),
- WASM_NOP));
+ ExpectValidates(sigs.v_i(),
+ {WASM_IF_ELSE(WASM_GET_LOCAL(0),
+ B1(WASM_SET_LOCAL(0, WASM_ZERO)), WASM_NOP)});
}
TEST_F(FunctionBodyDecoderTest, IfBlock1b) {
- EXPECT_VERIFIES(v_i,
- WASM_IF(WASM_GET_LOCAL(0), B1(WASM_SET_LOCAL(0, WASM_ZERO))));
+ ExpectValidates(sigs.v_i(), {WASM_IF(WASM_GET_LOCAL(0),
+ B1(WASM_SET_LOCAL(0, WASM_ZERO)))});
}
TEST_F(FunctionBodyDecoderTest, IfBlock2a) {
- EXPECT_VERIFIES(v_i,
- WASM_IF(WASM_GET_LOCAL(0), B2(WASM_SET_LOCAL(0, WASM_ZERO),
- WASM_SET_LOCAL(0, WASM_ZERO))));
+ ExpectValidates(sigs.v_i(), {WASM_IF(WASM_GET_LOCAL(0),
+ B2(WASM_SET_LOCAL(0, WASM_ZERO),
+ WASM_SET_LOCAL(0, WASM_ZERO)))});
}
TEST_F(FunctionBodyDecoderTest, IfBlock2b) {
- EXPECT_VERIFIES(
- v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), B2(WASM_SET_LOCAL(0, WASM_ZERO),
- WASM_SET_LOCAL(0, WASM_ZERO)),
- WASM_NOP));
+ ExpectValidates(sigs.v_i(), {WASM_IF_ELSE(WASM_GET_LOCAL(0),
+ B2(WASM_SET_LOCAL(0, WASM_ZERO),
+ WASM_SET_LOCAL(0, WASM_ZERO)),
+ WASM_NOP)});
}
TEST_F(FunctionBodyDecoderTest, IfElseSet) {
- EXPECT_VERIFIES(v_i,
- WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO),
- WASM_SET_LOCAL(0, WASM_I32V_1(1))));
+ ExpectValidates(sigs.v_i(),
+ {WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO),
+ WASM_SET_LOCAL(0, WASM_I32V_1(1)))});
}
TEST_F(FunctionBodyDecoderTest, Loop0) {
- EXPECT_VERIFIES(v_v, WASM_LOOP_OP, kExprEnd);
+ ExpectValidates(sigs.v_v(), {WASM_LOOP_OP, kExprEnd});
}
TEST_F(FunctionBodyDecoderTest, Loop1) {
static const byte code[] = {WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO))};
- EXPECT_VERIFIES_C(v_i, code);
- EXPECT_FAILURE_C(v_v, code);
- EXPECT_FAILURE_C(f_ff, code);
+ ExpectValidates(sigs.v_i(), code);
+ ExpectFailure(sigs.v_v(), code);
+ ExpectFailure(sigs.f_ff(), code);
}
TEST_F(FunctionBodyDecoderTest, Loop2) {
- EXPECT_VERIFIES(v_i, WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO),
- WASM_SET_LOCAL(0, WASM_ZERO)));
+ ExpectValidates(sigs.v_i(), {WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO),
+ WASM_SET_LOCAL(0, WASM_ZERO))});
}
TEST_F(FunctionBodyDecoderTest, Loop1_continue) {
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_BR(0)));
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_BR(0))});
}
TEST_F(FunctionBodyDecoderTest, Loop1_break) {
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_BR(1)));
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_BR(1))});
}
TEST_F(FunctionBodyDecoderTest, Loop2_continue) {
- EXPECT_VERIFIES(v_i, WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(0)));
+ ExpectValidates(sigs.v_i(),
+ {WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(0))});
}
TEST_F(FunctionBodyDecoderTest, Loop2_break) {
- EXPECT_VERIFIES(v_i, WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(1)));
+ ExpectValidates(sigs.v_i(),
+ {WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(1))});
}
TEST_F(FunctionBodyDecoderTest, InfiniteLoop1) {
- EXPECT_VERIFIES(i_i, WASM_LOOP(WASM_BR(0)), WASM_ZERO);
- EXPECT_VERIFIES(i_i, WASM_LOOP(WASM_BR(0)), WASM_ZERO);
- EXPECT_VERIFIES(i_i, WASM_LOOP_I(WASM_BRV(1, WASM_ZERO)));
+ ExpectValidates(sigs.i_i(), {WASM_LOOP(WASM_BR(0)), WASM_ZERO});
+ ExpectValidates(sigs.i_i(), {WASM_LOOP(WASM_BR(0)), WASM_ZERO});
+ ExpectValidates(sigs.i_i(), {WASM_LOOP_I(WASM_BRV(1, WASM_ZERO))});
}
TEST_F(FunctionBodyDecoderTest, InfiniteLoop2) {
- EXPECT_FAILURE(i_i, WASM_LOOP(WASM_BR(0), WASM_ZERO), WASM_ZERO);
+ ExpectFailure(sigs.i_i(), {WASM_LOOP(WASM_BR(0), WASM_ZERO), WASM_ZERO});
}
TEST_F(FunctionBodyDecoderTest, Loop2_unreachable) {
- EXPECT_VERIFIES(i_i, WASM_LOOP_I(WASM_BR(0), WASM_NOP));
+ ExpectValidates(sigs.i_i(), {WASM_LOOP_I(WASM_BR(0), WASM_NOP)});
}
TEST_F(FunctionBodyDecoderTest, LoopType) {
- EXPECT_VERIFIES(i_i, WASM_LOOP_I(WASM_GET_LOCAL(0)));
- EXPECT_VERIFIES(l_l, WASM_LOOP_L(WASM_GET_LOCAL(0)));
- EXPECT_VERIFIES(f_f, WASM_LOOP_F(WASM_GET_LOCAL(0)));
- EXPECT_VERIFIES(d_d, WASM_LOOP_D(WASM_GET_LOCAL(0)));
+ ExpectValidates(sigs.i_i(), {WASM_LOOP_I(WASM_GET_LOCAL(0))});
+ ExpectValidates(sigs.l_l(), {WASM_LOOP_L(WASM_GET_LOCAL(0))});
+ ExpectValidates(sigs.f_f(), {WASM_LOOP_F(WASM_GET_LOCAL(0))});
+ ExpectValidates(sigs.d_d(), {WASM_LOOP_D(WASM_GET_LOCAL(0))});
}
TEST_F(FunctionBodyDecoderTest, LoopType_void) {
- EXPECT_FAILURE(v_v, WASM_LOOP_I(WASM_ZERO));
- EXPECT_FAILURE(v_v, WASM_LOOP_L(WASM_I64V_1(0)));
- EXPECT_FAILURE(v_v, WASM_LOOP_F(WASM_F32(0.0)));
- EXPECT_FAILURE(v_v, WASM_LOOP_D(WASM_F64(1.1)));
+ ExpectFailure(sigs.v_v(), {WASM_LOOP_I(WASM_ZERO)});
+ ExpectFailure(sigs.v_v(), {WASM_LOOP_L(WASM_I64V_1(0))});
+ ExpectFailure(sigs.v_v(), {WASM_LOOP_F(WASM_F32(0.0))});
+ ExpectFailure(sigs.v_v(), {WASM_LOOP_D(WASM_F64(1.1))});
}
TEST_F(FunctionBodyDecoderTest, LoopType_fail) {
- EXPECT_FAILURE(i_i, WASM_LOOP_L(WASM_I64V_1(0)));
- EXPECT_FAILURE(i_i, WASM_LOOP_F(WASM_F32(0.0)));
- EXPECT_FAILURE(i_i, WASM_LOOP_D(WASM_F64(1.1)));
+ ExpectFailure(sigs.i_i(), {WASM_LOOP_L(WASM_I64V_1(0))});
+ ExpectFailure(sigs.i_i(), {WASM_LOOP_F(WASM_F32(0.0))});
+ ExpectFailure(sigs.i_i(), {WASM_LOOP_D(WASM_F64(1.1))});
- EXPECT_FAILURE(l_l, WASM_LOOP_I(WASM_ZERO));
- EXPECT_FAILURE(l_l, WASM_LOOP_F(WASM_F32(0.0)));
- EXPECT_FAILURE(l_l, WASM_LOOP_D(WASM_F64(1.1)));
+ ExpectFailure(sigs.l_l(), {WASM_LOOP_I(WASM_ZERO)});
+ ExpectFailure(sigs.l_l(), {WASM_LOOP_F(WASM_F32(0.0))});
+ ExpectFailure(sigs.l_l(), {WASM_LOOP_D(WASM_F64(1.1))});
- EXPECT_FAILURE(f_ff, WASM_LOOP_I(WASM_ZERO));
- EXPECT_FAILURE(f_ff, WASM_LOOP_L(WASM_I64V_1(0)));
- EXPECT_FAILURE(f_ff, WASM_LOOP_D(WASM_F64(1.1)));
+ ExpectFailure(sigs.f_ff(), {WASM_LOOP_I(WASM_ZERO)});
+ ExpectFailure(sigs.f_ff(), {WASM_LOOP_L(WASM_I64V_1(0))});
+ ExpectFailure(sigs.f_ff(), {WASM_LOOP_D(WASM_F64(1.1))});
- EXPECT_FAILURE(d_dd, WASM_LOOP_I(WASM_ZERO));
- EXPECT_FAILURE(d_dd, WASM_LOOP_L(WASM_I64V_1(0)));
- EXPECT_FAILURE(d_dd, WASM_LOOP_F(WASM_F32(0.0)));
+ ExpectFailure(sigs.d_dd(), {WASM_LOOP_I(WASM_ZERO)});
+ ExpectFailure(sigs.d_dd(), {WASM_LOOP_L(WASM_I64V_1(0))});
+ ExpectFailure(sigs.d_dd(), {WASM_LOOP_F(WASM_F32(0.0))});
}
TEST_F(FunctionBodyDecoderTest, ReturnVoid1) {
static const byte code[] = {kExprNop};
- EXPECT_VERIFIES_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
- EXPECT_FAILURE_C(i_f, code);
+ ExpectValidates(sigs.v_v(), code);
+ ExpectFailure(sigs.i_i(), code);
+ ExpectFailure(sigs.i_f(), code);
}
TEST_F(FunctionBodyDecoderTest, ReturnVoid2) {
static const byte code[] = {WASM_BLOCK(WASM_BR(0))};
- EXPECT_VERIFIES_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
- EXPECT_FAILURE_C(i_f, code);
+ ExpectValidates(sigs.v_v(), code);
+ ExpectFailure(sigs.i_i(), code);
+ ExpectFailure(sigs.i_f(), code);
}
TEST_F(FunctionBodyDecoderTest, ReturnVoid3) {
- EXPECT_FAILURE(v_v, kExprI32Const, 0);
- EXPECT_FAILURE(v_v, kExprI64Const, 0);
- EXPECT_FAILURE(v_v, kExprF32Const, 0, 0, 0, 0);
- EXPECT_FAILURE(v_v, kExprF64Const, 0, 0, 0, 0, 0, 0, 0, 0);
- EXPECT_FAILURE(v_v, kExprRefNull);
+ ExpectFailure(sigs.v_v(), {kExprI32Const, 0});
+ ExpectFailure(sigs.v_v(), {kExprI64Const, 0});
+ ExpectFailure(sigs.v_v(), {kExprF32Const, 0, 0, 0, 0});
+ ExpectFailure(sigs.v_v(), {kExprF64Const, 0, 0, 0, 0, 0, 0, 0, 0});
+ ExpectFailure(sigs.v_v(), {kExprRefNull});
- EXPECT_FAILURE(v_i, kExprGetLocal, 0);
+ ExpectFailure(sigs.v_i(), {kExprGetLocal, 0});
}
TEST_F(FunctionBodyDecoderTest, Unreachable1) {
- EXPECT_VERIFIES(v_v, WASM_UNREACHABLE);
- EXPECT_VERIFIES(v_v, WASM_UNREACHABLE, WASM_UNREACHABLE);
- EXPECT_VERIFIES(i_i, WASM_UNREACHABLE, WASM_ZERO);
+ ExpectValidates(sigs.v_v(), {WASM_UNREACHABLE});
+ ExpectValidates(sigs.v_v(), {WASM_UNREACHABLE, WASM_UNREACHABLE});
+ ExpectValidates(sigs.i_i(), {WASM_UNREACHABLE, WASM_ZERO});
}
TEST_F(FunctionBodyDecoderTest, Unreachable2) {
- EXPECT_FAILURE(v_v, B2(WASM_UNREACHABLE, WASM_ZERO));
- EXPECT_FAILURE(v_v, B2(WASM_BR(0), WASM_ZERO));
+ ExpectFailure(sigs.v_v(), {B2(WASM_UNREACHABLE, WASM_ZERO)});
+ ExpectFailure(sigs.v_v(), {B2(WASM_BR(0), WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, UnreachableLoop1) {
- EXPECT_FAILURE(v_v, WASM_LOOP(WASM_UNREACHABLE, WASM_ZERO));
- EXPECT_FAILURE(v_v, WASM_LOOP(WASM_BR(0), WASM_ZERO));
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_UNREACHABLE, WASM_NOP));
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_BR(0), WASM_NOP));
+ ExpectFailure(sigs.v_v(), {WASM_LOOP(WASM_UNREACHABLE, WASM_ZERO)});
+ ExpectFailure(sigs.v_v(), {WASM_LOOP(WASM_BR(0), WASM_ZERO)});
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_UNREACHABLE, WASM_NOP)});
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_BR(0), WASM_NOP)});
}
TEST_F(FunctionBodyDecoderTest, Unreachable_binop1) {
- EXPECT_VERIFIES(i_i, WASM_I32_AND(WASM_ZERO, WASM_UNREACHABLE));
- EXPECT_VERIFIES(i_i, WASM_I32_AND(WASM_UNREACHABLE, WASM_ZERO));
+ ExpectValidates(sigs.i_i(), {WASM_I32_AND(WASM_ZERO, WASM_UNREACHABLE)});
+ ExpectValidates(sigs.i_i(), {WASM_I32_AND(WASM_UNREACHABLE, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, Unreachable_binop2) {
- EXPECT_VERIFIES(i_i, WASM_I32_AND(WASM_F32(0.0), WASM_UNREACHABLE));
- EXPECT_FAILURE(i_i, WASM_I32_AND(WASM_UNREACHABLE, WASM_F32(0.0)));
+ ExpectValidates(sigs.i_i(), {WASM_I32_AND(WASM_F32(0.0), WASM_UNREACHABLE)});
+ ExpectFailure(sigs.i_i(), {WASM_I32_AND(WASM_UNREACHABLE, WASM_F32(0.0))});
}
TEST_F(FunctionBodyDecoderTest, Unreachable_select1) {
- EXPECT_VERIFIES(i_i, WASM_SELECT(WASM_UNREACHABLE, WASM_ZERO, WASM_ZERO));
- EXPECT_VERIFIES(i_i, WASM_SELECT(WASM_ZERO, WASM_UNREACHABLE, WASM_ZERO));
- EXPECT_VERIFIES(i_i, WASM_SELECT(WASM_ZERO, WASM_ZERO, WASM_UNREACHABLE));
+ ExpectValidates(sigs.i_i(),
+ {WASM_SELECT(WASM_UNREACHABLE, WASM_ZERO, WASM_ZERO)});
+ ExpectValidates(sigs.i_i(),
+ {WASM_SELECT(WASM_ZERO, WASM_UNREACHABLE, WASM_ZERO)});
+ ExpectValidates(sigs.i_i(),
+ {WASM_SELECT(WASM_ZERO, WASM_ZERO, WASM_UNREACHABLE)});
}
TEST_F(FunctionBodyDecoderTest, Unreachable_select2) {
- EXPECT_VERIFIES(i_i, WASM_SELECT(WASM_F32(0.0), WASM_UNREACHABLE, WASM_ZERO));
- EXPECT_FAILURE(i_i, WASM_SELECT(WASM_UNREACHABLE, WASM_F32(0.0), WASM_ZERO));
- EXPECT_FAILURE(i_i, WASM_SELECT(WASM_UNREACHABLE, WASM_ZERO, WASM_F32(0.0)));
+ ExpectValidates(sigs.i_i(),
+ {WASM_SELECT(WASM_F32(0.0), WASM_UNREACHABLE, WASM_ZERO)});
+ ExpectFailure(sigs.i_i(),
+ {WASM_SELECT(WASM_UNREACHABLE, WASM_F32(0.0), WASM_ZERO)});
+ ExpectFailure(sigs.i_i(),
+ {WASM_SELECT(WASM_UNREACHABLE, WASM_ZERO, WASM_F32(0.0))});
}
TEST_F(FunctionBodyDecoderTest, If1) {
- EXPECT_VERIFIES(
- i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I32V_1(9), WASM_I32V_1(8)));
- EXPECT_VERIFIES(i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I32V_1(9),
- WASM_GET_LOCAL(0)));
- EXPECT_VERIFIES(i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
- WASM_I32V_1(8)));
+ ExpectValidates(sigs.i_i(), {WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I32V_1(9),
+ WASM_I32V_1(8))});
+ ExpectValidates(sigs.i_i(), {WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I32V_1(9),
+ WASM_GET_LOCAL(0))});
+ ExpectValidates(
+ sigs.i_i(),
+ {WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_I32V_1(8))});
}
TEST_F(FunctionBodyDecoderTest, If_off_end) {
static const byte kCode[] = {
WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))};
for (size_t len = 3; len < arraysize(kCode); len++) {
- Verify(false, sigs.i_i(), {kCode, len}, kAppendEnd);
- Verify(false, sigs.i_i(), {kCode, len}, kOmitEnd);
+ ExpectFailure(sigs.i_i(), VectorOf(kCode, len), kAppendEnd);
+ ExpectFailure(sigs.i_i(), VectorOf(kCode, len), kOmitEnd);
}
}
@@ -1036,56 +1057,56 @@ TEST_F(FunctionBodyDecoderTest, If_type1) {
// float|double ? 1 : 2
static const byte kCode[] = {
WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I32V_1(0), WASM_I32V_1(2))};
- EXPECT_VERIFIES_C(i_i, kCode);
- EXPECT_FAILURE_C(i_f, kCode);
- EXPECT_FAILURE_C(i_d, kCode);
+ ExpectValidates(sigs.i_i(), kCode);
+ ExpectFailure(sigs.i_f(), kCode);
+ ExpectFailure(sigs.i_d(), kCode);
}
TEST_F(FunctionBodyDecoderTest, If_type2) {
// 1 ? float|double : 2
static const byte kCode[] = {
WASM_IF_ELSE_I(WASM_I32V_1(1), WASM_GET_LOCAL(0), WASM_I32V_1(1))};
- EXPECT_VERIFIES_C(i_i, kCode);
- EXPECT_FAILURE_C(i_f, kCode);
- EXPECT_FAILURE_C(i_d, kCode);
+ ExpectValidates(sigs.i_i(), kCode);
+ ExpectFailure(sigs.i_f(), kCode);
+ ExpectFailure(sigs.i_d(), kCode);
}
TEST_F(FunctionBodyDecoderTest, If_type3) {
// stmt ? 0 : 1
static const byte kCode[] = {
WASM_IF_ELSE_I(WASM_NOP, WASM_I32V_1(0), WASM_I32V_1(1))};
- EXPECT_FAILURE_C(i_i, kCode);
- EXPECT_FAILURE_C(i_f, kCode);
- EXPECT_FAILURE_C(i_d, kCode);
+ ExpectFailure(sigs.i_i(), kCode);
+ ExpectFailure(sigs.i_f(), kCode);
+ ExpectFailure(sigs.i_d(), kCode);
}
TEST_F(FunctionBodyDecoderTest, If_type4) {
// 0 ? stmt : 1
static const byte kCode[] = {
WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_NOP, WASM_I32V_1(1))};
- EXPECT_FAILURE_C(i_i, kCode);
- EXPECT_FAILURE_C(i_f, kCode);
- EXPECT_FAILURE_C(i_d, kCode);
+ ExpectFailure(sigs.i_i(), kCode);
+ ExpectFailure(sigs.i_f(), kCode);
+ ExpectFailure(sigs.i_d(), kCode);
}
TEST_F(FunctionBodyDecoderTest, If_type5) {
// 0 ? 1 : stmt
static const byte kCode[] = {
WASM_IF_ELSE_I(WASM_ZERO, WASM_I32V_1(1), WASM_NOP)};
- EXPECT_FAILURE_C(i_i, kCode);
- EXPECT_FAILURE_C(i_f, kCode);
- EXPECT_FAILURE_C(i_d, kCode);
+ ExpectFailure(sigs.i_i(), kCode);
+ ExpectFailure(sigs.i_f(), kCode);
+ ExpectFailure(sigs.i_d(), kCode);
}
TEST_F(FunctionBodyDecoderTest, Int64Local_param) {
- EXPECT_VERIFIES_C(l_l, kCodeGetLocal0);
+ ExpectValidates(sigs.l_l(), kCodeGetLocal0);
}
TEST_F(FunctionBodyDecoderTest, Int64Locals) {
for (byte i = 1; i < 8; i++) {
AddLocals(kWasmI64, 1);
for (byte j = 0; j < i; j++) {
- EXPECT_VERIFIES(l_v, WASM_GET_LOCAL(j));
+ ExpectValidates(sigs.l_v(), {WASM_GET_LOCAL(j)});
}
}
}
@@ -1150,47 +1171,49 @@ TEST_F(FunctionBodyDecoderTest, MacrosStmt) {
TestModuleBuilder builder;
module = builder.module();
builder.InitializeMemory();
- EXPECT_VERIFIES(v_i, WASM_SET_LOCAL(0, WASM_I32V_3(87348)));
- EXPECT_VERIFIES(v_i, WASM_STORE_MEM(MachineType::Int32(), WASM_I32V_1(24),
- WASM_I32V_1(40)));
- EXPECT_VERIFIES(v_i, WASM_IF(WASM_GET_LOCAL(0), WASM_NOP));
- EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP));
- EXPECT_VERIFIES(v_v, WASM_NOP);
- EXPECT_VERIFIES(v_v, B1(WASM_NOP));
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_NOP));
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_BR(0)));
+ ExpectValidates(sigs.v_i(), {WASM_SET_LOCAL(0, WASM_I32V_3(87348))});
+ ExpectValidates(
+ sigs.v_i(),
+ {WASM_STORE_MEM(MachineType::Int32(), WASM_I32V_1(24), WASM_I32V_1(40))});
+ ExpectValidates(sigs.v_i(), {WASM_IF(WASM_GET_LOCAL(0), WASM_NOP)});
+ ExpectValidates(sigs.v_i(),
+ {WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP)});
+ ExpectValidates(sigs.v_v(), {WASM_NOP});
+ ExpectValidates(sigs.v_v(), {B1(WASM_NOP)});
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_NOP)});
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_BR(0))});
}
TEST_F(FunctionBodyDecoderTest, MacrosContinue) {
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_CONTINUE(0)));
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_CONTINUE(0))});
}
TEST_F(FunctionBodyDecoderTest, MacrosVariadic) {
- EXPECT_VERIFIES(v_v, B2(WASM_NOP, WASM_NOP));
- EXPECT_VERIFIES(v_v, B3(WASM_NOP, WASM_NOP, WASM_NOP));
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_NOP, WASM_NOP));
- EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_NOP));
+ ExpectValidates(sigs.v_v(), {B2(WASM_NOP, WASM_NOP)});
+ ExpectValidates(sigs.v_v(), {B3(WASM_NOP, WASM_NOP, WASM_NOP)});
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_NOP, WASM_NOP)});
+ ExpectValidates(sigs.v_v(), {WASM_LOOP(WASM_NOP, WASM_NOP, WASM_NOP)});
}
TEST_F(FunctionBodyDecoderTest, MacrosNestedBlocks) {
- EXPECT_VERIFIES(v_v, B2(WASM_NOP, B2(WASM_NOP, WASM_NOP)));
- EXPECT_VERIFIES(v_v, B3(WASM_NOP, // --
- B2(WASM_NOP, WASM_NOP), // --
- B2(WASM_NOP, WASM_NOP))); // --
- EXPECT_VERIFIES(v_v, B1(B1(B2(WASM_NOP, WASM_NOP))));
+ ExpectValidates(sigs.v_v(), {B2(WASM_NOP, B2(WASM_NOP, WASM_NOP))});
+ ExpectValidates(sigs.v_v(), {B3(WASM_NOP, // --
+ B2(WASM_NOP, WASM_NOP), // --
+ B2(WASM_NOP, WASM_NOP))}); // --
+ ExpectValidates(sigs.v_v(), {B1(B1(B2(WASM_NOP, WASM_NOP)))});
}
TEST_F(FunctionBodyDecoderTest, MultipleReturn) {
static ValueType kIntTypes5[] = {kWasmI32, kWasmI32, kWasmI32, kWasmI32,
kWasmI32};
FunctionSig sig_ii_v(2, 0, kIntTypes5);
- EXPECT_VERIFIES_S(&sig_ii_v, WASM_RETURNN(2, WASM_ZERO, WASM_ONE));
- EXPECT_FAILURE_S(&sig_ii_v, WASM_RETURNN(1, WASM_ZERO));
+ ExpectValidates(&sig_ii_v, {WASM_RETURNN(2, WASM_ZERO, WASM_ONE)});
+ ExpectFailure(&sig_ii_v, {WASM_RETURNN(1, WASM_ZERO)});
FunctionSig sig_iii_v(3, 0, kIntTypes5);
- EXPECT_VERIFIES_S(&sig_iii_v,
- WASM_RETURNN(3, WASM_ZERO, WASM_ONE, WASM_I32V_1(44)));
- EXPECT_FAILURE_S(&sig_iii_v, WASM_RETURNN(2, WASM_ZERO, WASM_ONE));
+ ExpectValidates(&sig_iii_v,
+ {WASM_RETURNN(3, WASM_ZERO, WASM_ONE, WASM_I32V_1(44))});
+ ExpectFailure(&sig_iii_v, {WASM_RETURNN(2, WASM_ZERO, WASM_ONE)});
}
TEST_F(FunctionBodyDecoderTest, MultipleReturn_fallthru) {
@@ -1198,74 +1221,124 @@ TEST_F(FunctionBodyDecoderTest, MultipleReturn_fallthru) {
kWasmI32};
FunctionSig sig_ii_v(2, 0, kIntTypes5);
- EXPECT_VERIFIES_S(&sig_ii_v, WASM_ZERO, WASM_ONE);
- EXPECT_FAILURE_S(&sig_ii_v, WASM_ZERO);
+ ExpectValidates(&sig_ii_v, {WASM_ZERO, WASM_ONE});
+ ExpectFailure(&sig_ii_v, {WASM_ZERO});
FunctionSig sig_iii_v(3, 0, kIntTypes5);
- EXPECT_VERIFIES_S(&sig_iii_v, WASM_ZERO, WASM_ONE, WASM_I32V_1(44));
- EXPECT_FAILURE_S(&sig_iii_v, WASM_ZERO, WASM_ONE);
+ ExpectValidates(&sig_iii_v, {WASM_ZERO, WASM_ONE, WASM_I32V_1(44)});
+ ExpectFailure(&sig_iii_v, {WASM_ZERO, WASM_ONE});
}
TEST_F(FunctionBodyDecoderTest, MacrosInt32) {
- EXPECT_VERIFIES(i_i, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_I32V_1(12)));
- EXPECT_VERIFIES(i_i, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V_1(13)));
- EXPECT_VERIFIES(i_i, WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_I32V_1(14)));
- EXPECT_VERIFIES(i_i, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(15)));
- EXPECT_VERIFIES(i_i, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I32V_1(16)));
- EXPECT_VERIFIES(i_i, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(17)));
- EXPECT_VERIFIES(i_i, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_I32V_1(18)));
- EXPECT_VERIFIES(i_i, WASM_I32_AND(WASM_GET_LOCAL(0), WASM_I32V_1(19)));
- EXPECT_VERIFIES(i_i, WASM_I32_IOR(WASM_GET_LOCAL(0), WASM_I32V_1(20)));
- EXPECT_VERIFIES(i_i, WASM_I32_XOR(WASM_GET_LOCAL(0), WASM_I32V_1(21)));
- EXPECT_VERIFIES(i_i, WASM_I32_SHL(WASM_GET_LOCAL(0), WASM_I32V_1(22)));
- EXPECT_VERIFIES(i_i, WASM_I32_SHR(WASM_GET_LOCAL(0), WASM_I32V_1(23)));
- EXPECT_VERIFIES(i_i, WASM_I32_SAR(WASM_GET_LOCAL(0), WASM_I32V_1(24)));
- EXPECT_VERIFIES(i_i, WASM_I32_ROR(WASM_GET_LOCAL(0), WASM_I32V_1(24)));
- EXPECT_VERIFIES(i_i, WASM_I32_ROL(WASM_GET_LOCAL(0), WASM_I32V_1(24)));
- EXPECT_VERIFIES(i_i, WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(25)));
- EXPECT_VERIFIES(i_i, WASM_I32_NE(WASM_GET_LOCAL(0), WASM_I32V_1(25)));
-
- EXPECT_VERIFIES(i_i, WASM_I32_LTS(WASM_GET_LOCAL(0), WASM_I32V_1(26)));
- EXPECT_VERIFIES(i_i, WASM_I32_LES(WASM_GET_LOCAL(0), WASM_I32V_1(27)));
- EXPECT_VERIFIES(i_i, WASM_I32_LTU(WASM_GET_LOCAL(0), WASM_I32V_1(28)));
- EXPECT_VERIFIES(i_i, WASM_I32_LEU(WASM_GET_LOCAL(0), WASM_I32V_1(29)));
-
- EXPECT_VERIFIES(i_i, WASM_I32_GTS(WASM_GET_LOCAL(0), WASM_I32V_1(26)));
- EXPECT_VERIFIES(i_i, WASM_I32_GES(WASM_GET_LOCAL(0), WASM_I32V_1(27)));
- EXPECT_VERIFIES(i_i, WASM_I32_GTU(WASM_GET_LOCAL(0), WASM_I32V_1(28)));
- EXPECT_VERIFIES(i_i, WASM_I32_GEU(WASM_GET_LOCAL(0), WASM_I32V_1(29)));
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_I32V_1(12))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V_1(13))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_I32V_1(14))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(15))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I32V_1(16))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(17))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_I32V_1(18))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_AND(WASM_GET_LOCAL(0), WASM_I32V_1(19))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_IOR(WASM_GET_LOCAL(0), WASM_I32V_1(20))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_XOR(WASM_GET_LOCAL(0), WASM_I32V_1(21))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_SHL(WASM_GET_LOCAL(0), WASM_I32V_1(22))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_SHR(WASM_GET_LOCAL(0), WASM_I32V_1(23))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_SAR(WASM_GET_LOCAL(0), WASM_I32V_1(24))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_ROR(WASM_GET_LOCAL(0), WASM_I32V_1(24))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_ROL(WASM_GET_LOCAL(0), WASM_I32V_1(24))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(25))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_NE(WASM_GET_LOCAL(0), WASM_I32V_1(25))});
+
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_LTS(WASM_GET_LOCAL(0), WASM_I32V_1(26))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_LES(WASM_GET_LOCAL(0), WASM_I32V_1(27))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_LTU(WASM_GET_LOCAL(0), WASM_I32V_1(28))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_LEU(WASM_GET_LOCAL(0), WASM_I32V_1(29))});
+
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_GTS(WASM_GET_LOCAL(0), WASM_I32V_1(26))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_GES(WASM_GET_LOCAL(0), WASM_I32V_1(27))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_GTU(WASM_GET_LOCAL(0), WASM_I32V_1(28))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_I32_GEU(WASM_GET_LOCAL(0), WASM_I32V_1(29))});
}
TEST_F(FunctionBodyDecoderTest, MacrosInt64) {
- EXPECT_VERIFIES(l_ll, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_I64V_1(12)));
- EXPECT_VERIFIES(l_ll, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_I64V_1(13)));
- EXPECT_VERIFIES(l_ll, WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_I64V_1(14)));
- EXPECT_VERIFIES(l_ll, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_I64V_1(15)));
- EXPECT_VERIFIES(l_ll, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_I64V_1(16)));
- EXPECT_VERIFIES(l_ll, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_I64V_1(17)));
- EXPECT_VERIFIES(l_ll, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_I64V_1(18)));
- EXPECT_VERIFIES(l_ll, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_I64V_1(19)));
- EXPECT_VERIFIES(l_ll, WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_I64V_1(20)));
- EXPECT_VERIFIES(l_ll, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_I64V_1(21)));
-
- EXPECT_VERIFIES(l_ll, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(22)));
- EXPECT_VERIFIES(l_ll, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(23)));
- EXPECT_VERIFIES(l_ll, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(24)));
- EXPECT_VERIFIES(l_ll, WASM_I64_ROR(WASM_GET_LOCAL(0), WASM_I64V_1(24)));
- EXPECT_VERIFIES(l_ll, WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_I64V_1(24)));
-
- EXPECT_VERIFIES(i_ll, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_I64V_1(26)));
- EXPECT_VERIFIES(i_ll, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_I64V_1(27)));
- EXPECT_VERIFIES(i_ll, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_I64V_1(28)));
- EXPECT_VERIFIES(i_ll, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_I64V_1(29)));
-
- EXPECT_VERIFIES(i_ll, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_I64V_1(26)));
- EXPECT_VERIFIES(i_ll, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_I64V_1(27)));
- EXPECT_VERIFIES(i_ll, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_I64V_1(28)));
- EXPECT_VERIFIES(i_ll, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_I64V_1(29)));
-
- EXPECT_VERIFIES(i_ll, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_I64V_1(25)));
- EXPECT_VERIFIES(i_ll, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_I64V_1(25)));
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_I64V_1(12))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_I64V_1(13))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_I64V_1(14))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_I64V_1(15))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_I64V_1(16))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_I64V_1(17))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_I64V_1(18))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_AND(WASM_GET_LOCAL(0), WASM_I64V_1(19))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_I64V_1(20))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_I64V_1(21))});
+
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(22))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(23))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(24))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_ROR(WASM_GET_LOCAL(0), WASM_I64V_1(24))});
+ ExpectValidates(sigs.l_ll(),
+ {WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_I64V_1(24))});
+
+ ExpectValidates(sigs.i_ll(),
+ {WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_I64V_1(26))});
+ ExpectValidates(sigs.i_ll(),
+ {WASM_I64_LES(WASM_GET_LOCAL(0), WASM_I64V_1(27))});
+ ExpectValidates(sigs.i_ll(),
+ {WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_I64V_1(28))});
+ ExpectValidates(sigs.i_ll(),
+ {WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_I64V_1(29))});
+
+ ExpectValidates(sigs.i_ll(),
+ {WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_I64V_1(26))});
+ ExpectValidates(sigs.i_ll(),
+ {WASM_I64_GES(WASM_GET_LOCAL(0), WASM_I64V_1(27))});
+ ExpectValidates(sigs.i_ll(),
+ {WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_I64V_1(28))});
+ ExpectValidates(sigs.i_ll(),
+ {WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_I64V_1(29))});
+
+ ExpectValidates(sigs.i_ll(),
+ {WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_I64V_1(25))});
+ ExpectValidates(sigs.i_ll(),
+ {WASM_I64_NE(WASM_GET_LOCAL(0), WASM_I64V_1(25))});
}
TEST_F(FunctionBodyDecoderTest, AllSimpleExpressions) {
@@ -1292,8 +1365,8 @@ TEST_F(FunctionBodyDecoderTest, MemorySize) {
module = builder.module();
builder.InitializeMemory();
byte code[] = {kExprMemorySize, 0};
- EXPECT_VERIFIES_C(i_i, code);
- EXPECT_FAILURE_C(f_ff, code);
+ ExpectValidates(sigs.i_i(), code);
+ ExpectFailure(sigs.f_ff(), code);
}
TEST_F(FunctionBodyDecoderTest, LoadMemOffset) {
@@ -1303,7 +1376,7 @@ TEST_F(FunctionBodyDecoderTest, LoadMemOffset) {
for (int offset = 0; offset < 128; offset += 7) {
byte code[] = {kExprI32Const, 0, kExprI32LoadMem, ZERO_ALIGNMENT,
static_cast<byte>(offset)};
- EXPECT_VERIFIES_C(i_i, code);
+ ExpectValidates(sigs.i_i(), code);
}
}
@@ -1335,11 +1408,7 @@ TEST_F(FunctionBodyDecoderTest, LoadMemAlignment) {
for (byte alignment = 0; alignment <= 4; alignment++) {
byte code[] = {WASM_ZERO, static_cast<byte>(values[i].instruction),
alignment, ZERO_OFFSET, WASM_DROP};
- if (static_cast<uint32_t>(alignment) <= values[i].maximum_aligment) {
- EXPECT_VERIFIES_C(v_i, code);
- } else {
- EXPECT_FAILURE_C(v_i, code);
- }
+ Validate(alignment <= values[i].maximum_aligment, sigs.v_i(), code);
}
}
}
@@ -1351,7 +1420,7 @@ TEST_F(FunctionBodyDecoderTest, StoreMemOffset) {
for (byte offset = 0; offset < 128; offset += 7) {
byte code[] = {WASM_STORE_MEM_OFFSET(MachineType::Int32(), offset,
WASM_ZERO, WASM_ZERO)};
- EXPECT_VERIFIES_C(v_i, code);
+ ExpectValidates(sigs.v_i(), code);
}
}
@@ -1359,8 +1428,8 @@ TEST_F(FunctionBodyDecoderTest, StoreMemOffset_void) {
TestModuleBuilder builder;
module = builder.module();
builder.InitializeMemory();
- EXPECT_FAILURE(i_i, WASM_STORE_MEM_OFFSET(MachineType::Int32(), 0, WASM_ZERO,
- WASM_ZERO));
+ ExpectFailure(sigs.i_i(), {WASM_STORE_MEM_OFFSET(MachineType::Int32(), 0,
+ WASM_ZERO, WASM_ZERO)});
}
#define BYTE0(x) ((x)&0x7F)
@@ -1377,28 +1446,28 @@ TEST_F(FunctionBodyDecoderTest, LoadMemOffset_varint) {
TestModuleBuilder builder;
module = builder.module();
builder.InitializeMemory();
- EXPECT_VERIFIES(i_i, WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT,
- VARINT1(0x45));
- EXPECT_VERIFIES(i_i, WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT,
- VARINT2(0x3999));
- EXPECT_VERIFIES(i_i, WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT,
- VARINT3(0x344445));
- EXPECT_VERIFIES(i_i, WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT,
- VARINT4(0x36666667));
+ ExpectValidates(sigs.i_i(),
+ {WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT, VARINT1(0x45)});
+ ExpectValidates(sigs.i_i(), {WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT,
+ VARINT2(0x3999)});
+ ExpectValidates(sigs.i_i(), {WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT,
+ VARINT3(0x344445)});
+ ExpectValidates(sigs.i_i(), {WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT,
+ VARINT4(0x36666667)});
}
TEST_F(FunctionBodyDecoderTest, StoreMemOffset_varint) {
TestModuleBuilder builder;
module = builder.module();
builder.InitializeMemory();
- EXPECT_VERIFIES(v_i, WASM_ZERO, WASM_ZERO, kExprI32StoreMem, ZERO_ALIGNMENT,
- VARINT1(0x33));
- EXPECT_VERIFIES(v_i, WASM_ZERO, WASM_ZERO, kExprI32StoreMem, ZERO_ALIGNMENT,
- VARINT2(0x1111));
- EXPECT_VERIFIES(v_i, WASM_ZERO, WASM_ZERO, kExprI32StoreMem, ZERO_ALIGNMENT,
- VARINT3(0x222222));
- EXPECT_VERIFIES(v_i, WASM_ZERO, WASM_ZERO, kExprI32StoreMem, ZERO_ALIGNMENT,
- VARINT4(0x44444444));
+ ExpectValidates(sigs.v_i(), {WASM_ZERO, WASM_ZERO, kExprI32StoreMem,
+ ZERO_ALIGNMENT, VARINT1(0x33)});
+ ExpectValidates(sigs.v_i(), {WASM_ZERO, WASM_ZERO, kExprI32StoreMem,
+ ZERO_ALIGNMENT, VARINT2(0x1111)});
+ ExpectValidates(sigs.v_i(), {WASM_ZERO, WASM_ZERO, kExprI32StoreMem,
+ ZERO_ALIGNMENT, VARINT3(0x222222)});
+ ExpectValidates(sigs.v_i(), {WASM_ZERO, WASM_ZERO, kExprI32StoreMem,
+ ZERO_ALIGNMENT, VARINT4(0x44444444)});
}
#undef BYTE0
@@ -1421,11 +1490,7 @@ TEST_F(FunctionBodyDecoderTest, AllLoadMemCombinations) {
MachineType mem_type = machineTypes[j];
byte code[] = {WASM_LOAD_MEM(mem_type, WASM_ZERO)};
FunctionSig sig(1, 0, &local_type);
- if (local_type == ValueTypes::ValueTypeFor(mem_type)) {
- EXPECT_VERIFIES_SC(&sig, code);
- } else {
- EXPECT_FAILURE_SC(&sig, code);
- }
+ Validate(local_type == ValueTypes::ValueTypeFor(mem_type), &sig, code);
}
}
}
@@ -1440,11 +1505,7 @@ TEST_F(FunctionBodyDecoderTest, AllStoreMemCombinations) {
MachineType mem_type = machineTypes[j];
byte code[] = {WASM_STORE_MEM(mem_type, WASM_ZERO, WASM_GET_LOCAL(0))};
FunctionSig sig(0, 1, &local_type);
- if (local_type == ValueTypes::ValueTypeFor(mem_type)) {
- EXPECT_VERIFIES_SC(&sig, code);
- } else {
- EXPECT_FAILURE_SC(&sig, code);
- }
+ Validate(local_type == ValueTypes::ValueTypeFor(mem_type), &sig, code);
}
}
}
@@ -1458,10 +1519,10 @@ TEST_F(FunctionBodyDecoderTest, SimpleCalls) {
builder.AddFunction(sigs.i_i());
builder.AddFunction(sigs.i_ii());
- EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION0(0));
- EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(1, WASM_I32V_1(27)));
- EXPECT_VERIFIES_S(sig,
- WASM_CALL_FUNCTION(2, WASM_I32V_1(37), WASM_I32V_2(77)));
+ ExpectValidates(sig, {WASM_CALL_FUNCTION0(0)});
+ ExpectValidates(sig, {WASM_CALL_FUNCTION(1, WASM_I32V_1(27))});
+ ExpectValidates(sig,
+ {WASM_CALL_FUNCTION(2, WASM_I32V_1(37), WASM_I32V_2(77))});
}
TEST_F(FunctionBodyDecoderTest, CallsWithTooFewArguments) {
@@ -1473,9 +1534,9 @@ TEST_F(FunctionBodyDecoderTest, CallsWithTooFewArguments) {
builder.AddFunction(sigs.i_ii());
builder.AddFunction(sigs.f_ff());
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION0(0));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_ZERO));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(2, WASM_GET_LOCAL(0)));
+ ExpectFailure(sig, {WASM_CALL_FUNCTION0(0)});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(1, WASM_ZERO)});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(2, WASM_GET_LOCAL(0))});
}
TEST_F(FunctionBodyDecoderTest, CallsWithMismatchedSigs2) {
@@ -1485,9 +1546,9 @@ TEST_F(FunctionBodyDecoderTest, CallsWithMismatchedSigs2) {
builder.AddFunction(sigs.i_i());
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_I64V_1(17)));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_F32(17.1)));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_F64(17.1)));
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(0, WASM_I64V_1(17))});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(0, WASM_F32(17.1))});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(0, WASM_F64(17.1))});
}
TEST_F(FunctionBodyDecoderTest, CallsWithMismatchedSigs3) {
@@ -1497,15 +1558,167 @@ TEST_F(FunctionBodyDecoderTest, CallsWithMismatchedSigs3) {
builder.AddFunction(sigs.i_f());
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_I32V_1(17)));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_I64V_1(27)));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_F64(37.2)));
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(0, WASM_I32V_1(17))});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(0, WASM_I64V_1(27))});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(0, WASM_F64(37.2))});
builder.AddFunction(sigs.i_d());
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_I32V_1(16)));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_I64V_1(16)));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_F32(17.6)));
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(1, WASM_I32V_1(16))});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(1, WASM_I64V_1(16))});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(1, WASM_F32(17.6))});
+}
+
+TEST_F(FunctionBodyDecoderTest, SimpleReturnCalls) {
+ WASM_FEATURE_SCOPE(return_call);
+
+ FunctionSig* sig = sigs.i_i();
+ TestModuleBuilder builder;
+ module = builder.module();
+
+ builder.AddFunction(sigs.i_v());
+ builder.AddFunction(sigs.i_i());
+ builder.AddFunction(sigs.i_ii());
+
+ ExpectValidates(sig, {WASM_RETURN_CALL_FUNCTION0(0)});
+ ExpectValidates(sig, {WASM_RETURN_CALL_FUNCTION(1, WASM_I32V_1(27))});
+ ExpectValidates(
+ sig, {WASM_RETURN_CALL_FUNCTION(2, WASM_I32V_1(37), WASM_I32V_2(77))});
+}
+
+TEST_F(FunctionBodyDecoderTest, ReturnCallsWithTooFewArguments) {
+ WASM_FEATURE_SCOPE(return_call);
+
+ FunctionSig* sig = sigs.i_i();
+ TestModuleBuilder builder;
+ module = builder.module();
+
+ builder.AddFunction(sigs.i_i());
+ builder.AddFunction(sigs.i_ii());
+ builder.AddFunction(sigs.f_ff());
+
+ ExpectFailure(sig, {WASM_RETURN_CALL_FUNCTION0(0)});
+ ExpectFailure(sig, {WASM_RETURN_CALL_FUNCTION(1, WASM_ZERO)});
+ ExpectFailure(sig, {WASM_RETURN_CALL_FUNCTION(2, WASM_GET_LOCAL(0))});
+}
+
+TEST_F(FunctionBodyDecoderTest, ReturnCallsWithMismatchedSigs) {
+ WASM_FEATURE_SCOPE(return_call);
+
+ FunctionSig* sig = sigs.i_i();
+ TestModuleBuilder builder;
+ module = builder.module();
+
+ builder.AddFunction(sigs.i_f());
+ builder.AddFunction(sigs.f_f());
+
+ ExpectFailure(sig, {WASM_RETURN_CALL_FUNCTION(0, WASM_I32V_1(17))});
+ ExpectFailure(sig, {WASM_RETURN_CALL_FUNCTION(0, WASM_I64V_1(27))});
+ ExpectFailure(sig, {WASM_RETURN_CALL_FUNCTION(0, WASM_F64(37.2))});
+
+ ExpectFailure(sig, {WASM_RETURN_CALL_FUNCTION(1, WASM_F64(37.2))});
+ ExpectFailure(sig, {WASM_RETURN_CALL_FUNCTION(1, WASM_F32(37.2))});
+ ExpectFailure(sig, {WASM_RETURN_CALL_FUNCTION(1, WASM_I32V_1(17))});
+}
+
+TEST_F(FunctionBodyDecoderTest, SimpleIndirectReturnCalls) {
+ WASM_FEATURE_SCOPE(return_call);
+
+ FunctionSig* sig = sigs.i_i();
+ TestModuleBuilder builder;
+ builder.InitializeTable();
+ module = builder.module();
+
+ byte f0 = builder.AddSignature(sigs.i_v());
+ byte f1 = builder.AddSignature(sigs.i_i());
+ byte f2 = builder.AddSignature(sigs.i_ii());
+
+ ExpectValidates(sig, {WASM_RETURN_CALL_INDIRECT0(f0, WASM_ZERO)});
+ ExpectValidates(sig,
+ {WASM_RETURN_CALL_INDIRECT(f1, WASM_ZERO, WASM_I32V_1(22))});
+ ExpectValidates(sig, {WASM_RETURN_CALL_INDIRECT(
+ f2, WASM_ZERO, WASM_I32V_1(32), WASM_I32V_2(72))});
+}
+
+TEST_F(FunctionBodyDecoderTest, IndirectReturnCallsOutOfBounds) {
+ WASM_FEATURE_SCOPE(return_call);
+
+ FunctionSig* sig = sigs.i_i();
+ TestModuleBuilder builder;
+ builder.InitializeTable();
+ module = builder.module();
+
+ ExpectFailure(sig, {WASM_RETURN_CALL_INDIRECT0(0, WASM_ZERO)});
+ builder.AddSignature(sigs.i_v());
+ ExpectValidates(sig, {WASM_RETURN_CALL_INDIRECT0(0, WASM_ZERO)});
+
+ ExpectFailure(sig,
+ {WASM_RETURN_CALL_INDIRECT(1, WASM_ZERO, WASM_I32V_1(22))});
+ builder.AddSignature(sigs.i_i());
+ ExpectValidates(sig,
+ {WASM_RETURN_CALL_INDIRECT(1, WASM_ZERO, WASM_I32V_1(27))});
+
+ ExpectFailure(sig,
+ {WASM_RETURN_CALL_INDIRECT(2, WASM_ZERO, WASM_I32V_1(27))});
+}
+
+TEST_F(FunctionBodyDecoderTest, IndirectReturnCallsWithMismatchedSigs3) {
+ WASM_FEATURE_SCOPE(return_call);
+
+ FunctionSig* sig = sigs.i_i();
+ TestModuleBuilder builder;
+ builder.InitializeTable();
+ module = builder.module();
+
+ byte f0 = builder.AddFunction(sigs.i_f());
+
+ ExpectFailure(sig,
+ {WASM_RETURN_CALL_INDIRECT(f0, WASM_ZERO, WASM_I32V_1(17))});
+ ExpectFailure(sig,
+ {WASM_RETURN_CALL_INDIRECT(f0, WASM_ZERO, WASM_I64V_1(27))});
+ ExpectFailure(sig,
+ {WASM_RETURN_CALL_INDIRECT(f0, WASM_ZERO, WASM_F64(37.2))});
+
+ ExpectFailure(sig, {WASM_RETURN_CALL_INDIRECT0(f0, WASM_I32V_1(17))});
+ ExpectFailure(sig, {WASM_RETURN_CALL_INDIRECT0(f0, WASM_I64V_1(27))});
+ ExpectFailure(sig, {WASM_RETURN_CALL_INDIRECT0(f0, WASM_F64(37.2))});
+
+ byte f1 = builder.AddFunction(sigs.i_d());
+
+ ExpectFailure(sig,
+ {WASM_RETURN_CALL_INDIRECT(f1, WASM_ZERO, WASM_I32V_1(16))});
+ ExpectFailure(sig,
+ {WASM_RETURN_CALL_INDIRECT(f1, WASM_ZERO, WASM_I64V_1(16))});
+ ExpectFailure(sig,
+ {WASM_RETURN_CALL_INDIRECT(f1, WASM_ZERO, WASM_F32(17.6))});
+}
+
+TEST_F(FunctionBodyDecoderTest, IndirectReturnCallsWithoutTableCrash) {
+ WASM_FEATURE_SCOPE(return_call);
+
+ FunctionSig* sig = sigs.i_i();
+ TestModuleBuilder builder;
+ module = builder.module();
+
+ byte f0 = builder.AddSignature(sigs.i_v());
+ byte f1 = builder.AddSignature(sigs.i_i());
+ byte f2 = builder.AddSignature(sigs.i_ii());
+
+ ExpectFailure(sig, {WASM_RETURN_CALL_INDIRECT0(f0, WASM_ZERO)});
+ ExpectFailure(sig,
+ {WASM_RETURN_CALL_INDIRECT(f1, WASM_ZERO, WASM_I32V_1(22))});
+ ExpectFailure(sig, {WASM_RETURN_CALL_INDIRECT(f2, WASM_ZERO, WASM_I32V_1(32),
+ WASM_I32V_2(72))});
+}
+
+TEST_F(FunctionBodyDecoderTest, IncompleteIndirectReturnCall) {
+ FunctionSig* sig = sigs.i_i();
+ TestModuleBuilder builder;
+ builder.InitializeTable();
+ module = builder.module();
+
+ static byte code[] = {kExprReturnCallIndirect};
+ ExpectFailure(sig, ArrayVector(code), kOmitEnd);
}
TEST_F(FunctionBodyDecoderTest, MultiReturn) {
@@ -1519,9 +1732,9 @@ TEST_F(FunctionBodyDecoderTest, MultiReturn) {
builder.AddFunction(&sig_v_ii);
builder.AddFunction(&sig_ii_v);
- EXPECT_VERIFIES_S(&sig_ii_v, WASM_CALL_FUNCTION0(1));
- EXPECT_VERIFIES(v_v, WASM_CALL_FUNCTION0(1), WASM_DROP, WASM_DROP);
- EXPECT_VERIFIES(v_v, WASM_CALL_FUNCTION0(1), kExprCallFunction, 0);
+ ExpectValidates(&sig_ii_v, {WASM_CALL_FUNCTION0(1)});
+ ExpectValidates(sigs.v_v(), {WASM_CALL_FUNCTION0(1), WASM_DROP, WASM_DROP});
+ ExpectValidates(sigs.v_v(), {WASM_CALL_FUNCTION0(1), kExprCallFunction, 0});
}
TEST_F(FunctionBodyDecoderTest, MultiReturnType) {
@@ -1539,12 +1752,12 @@ TEST_F(FunctionBodyDecoderTest, MultiReturnType) {
module = builder.module();
builder.AddFunction(&sig_cd_v);
- EXPECT_VERIFIES_S(&sig_cd_v, WASM_CALL_FUNCTION0(0));
+ ExpectValidates(&sig_cd_v, {WASM_CALL_FUNCTION0(0)});
if (a == c && b == d) {
- EXPECT_VERIFIES_S(&sig_ab_v, WASM_CALL_FUNCTION0(0));
+ ExpectValidates(&sig_ab_v, {WASM_CALL_FUNCTION0(0)});
} else {
- EXPECT_FAILURE_S(&sig_ab_v, WASM_CALL_FUNCTION0(0));
+ ExpectFailure(&sig_ab_v, {WASM_CALL_FUNCTION0(0)});
}
}
}
@@ -1562,10 +1775,10 @@ TEST_F(FunctionBodyDecoderTest, SimpleIndirectCalls) {
byte f1 = builder.AddSignature(sigs.i_i());
byte f2 = builder.AddSignature(sigs.i_ii());
- EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT0(f0, WASM_ZERO));
- EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I32V_1(22)));
- EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT2(f2, WASM_ZERO, WASM_I32V_1(32),
- WASM_I32V_2(72)));
+ ExpectValidates(sig, {WASM_CALL_INDIRECT0(f0, WASM_ZERO)});
+ ExpectValidates(sig, {WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I32V_1(22))});
+ ExpectValidates(sig, {WASM_CALL_INDIRECT2(f2, WASM_ZERO, WASM_I32V_1(32),
+ WASM_I32V_2(72))});
}
TEST_F(FunctionBodyDecoderTest, IndirectCallsOutOfBounds) {
@@ -1574,15 +1787,15 @@ TEST_F(FunctionBodyDecoderTest, IndirectCallsOutOfBounds) {
builder.InitializeTable();
module = builder.module();
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(0, WASM_ZERO));
+ ExpectFailure(sig, {WASM_CALL_INDIRECT0(0, WASM_ZERO)});
builder.AddSignature(sigs.i_v());
- EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT0(0, WASM_ZERO));
+ ExpectValidates(sig, {WASM_CALL_INDIRECT0(0, WASM_ZERO)});
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I32V_1(22)));
+ ExpectFailure(sig, {WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I32V_1(22))});
builder.AddSignature(sigs.i_i());
- EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I32V_1(27)));
+ ExpectValidates(sig, {WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I32V_1(27))});
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(2, WASM_ZERO, WASM_I32V_1(27)));
+ ExpectFailure(sig, {WASM_CALL_INDIRECT1(2, WASM_ZERO, WASM_I32V_1(27))});
}
TEST_F(FunctionBodyDecoderTest, IndirectCallsWithMismatchedSigs3) {
@@ -1593,19 +1806,19 @@ TEST_F(FunctionBodyDecoderTest, IndirectCallsWithMismatchedSigs3) {
byte f0 = builder.AddFunction(sigs.i_f());
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_I32V_1(17)));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_I64V_1(27)));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_F64(37.2)));
+ ExpectFailure(sig, {WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_I32V_1(17))});
+ ExpectFailure(sig, {WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_I64V_1(27))});
+ ExpectFailure(sig, {WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_F64(37.2))});
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_I32V_1(17)));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_I64V_1(27)));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_F64(37.2)));
+ ExpectFailure(sig, {WASM_CALL_INDIRECT0(f0, WASM_I32V_1(17))});
+ ExpectFailure(sig, {WASM_CALL_INDIRECT0(f0, WASM_I64V_1(27))});
+ ExpectFailure(sig, {WASM_CALL_INDIRECT0(f0, WASM_F64(37.2))});
byte f1 = builder.AddFunction(sigs.i_d());
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I32V_1(16)));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I64V_1(16)));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_F32(17.6)));
+ ExpectFailure(sig, {WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I32V_1(16))});
+ ExpectFailure(sig, {WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I64V_1(16))});
+ ExpectFailure(sig, {WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_F32(17.6))});
}
TEST_F(FunctionBodyDecoderTest, IndirectCallsWithoutTableCrash) {
@@ -1617,10 +1830,10 @@ TEST_F(FunctionBodyDecoderTest, IndirectCallsWithoutTableCrash) {
byte f1 = builder.AddSignature(sigs.i_i());
byte f2 = builder.AddSignature(sigs.i_ii());
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_ZERO));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I32V_1(22)));
- EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT2(f2, WASM_ZERO, WASM_I32V_1(32),
- WASM_I32V_2(72)));
+ ExpectFailure(sig, {WASM_CALL_INDIRECT0(f0, WASM_ZERO)});
+ ExpectFailure(sig, {WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I32V_1(22))});
+ ExpectFailure(sig, {WASM_CALL_INDIRECT2(f2, WASM_ZERO, WASM_I32V_1(32),
+ WASM_I32V_2(72))});
}
TEST_F(FunctionBodyDecoderTest, IncompleteIndirectCall) {
@@ -1630,7 +1843,7 @@ TEST_F(FunctionBodyDecoderTest, IncompleteIndirectCall) {
module = builder.module();
static byte code[] = {kExprCallIndirect};
- Verify(false, sig, ArrayVector(code), kOmitEnd);
+ ExpectFailure(sig, ArrayVector(code), kOmitEnd);
}
TEST_F(FunctionBodyDecoderTest, IncompleteStore) {
@@ -1641,7 +1854,7 @@ TEST_F(FunctionBodyDecoderTest, IncompleteStore) {
module = builder.module();
static byte code[] = {kExprI32StoreMem};
- Verify(false, sig, ArrayVector(code), kOmitEnd);
+ ExpectFailure(sig, ArrayVector(code), kOmitEnd);
}
TEST_F(FunctionBodyDecoderTest, IncompleteS8x16Shuffle) {
@@ -1654,7 +1867,7 @@ TEST_F(FunctionBodyDecoderTest, IncompleteS8x16Shuffle) {
static byte code[] = {kSimdPrefix,
static_cast<byte>(kExprS8x16Shuffle & 0xff)};
- Verify(false, sig, ArrayVector(code), kOmitEnd);
+ ExpectFailure(sig, ArrayVector(code), kOmitEnd);
}
TEST_F(FunctionBodyDecoderTest, SimpleImportCalls) {
@@ -1666,10 +1879,10 @@ TEST_F(FunctionBodyDecoderTest, SimpleImportCalls) {
byte f1 = builder.AddImport(sigs.i_i());
byte f2 = builder.AddImport(sigs.i_ii());
- EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION0(f0));
- EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(f1, WASM_I32V_1(22)));
- EXPECT_VERIFIES_S(sig,
- WASM_CALL_FUNCTION(f2, WASM_I32V_1(32), WASM_I32V_2(72)));
+ ExpectValidates(sig, {WASM_CALL_FUNCTION0(f0)});
+ ExpectValidates(sig, {WASM_CALL_FUNCTION(f1, WASM_I32V_1(22))});
+ ExpectValidates(sig,
+ {WASM_CALL_FUNCTION(f2, WASM_I32V_1(32), WASM_I32V_2(72))});
}
TEST_F(FunctionBodyDecoderTest, ImportCallsWithMismatchedSigs3) {
@@ -1679,17 +1892,17 @@ TEST_F(FunctionBodyDecoderTest, ImportCallsWithMismatchedSigs3) {
byte f0 = builder.AddImport(sigs.i_f());
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION0(f0));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f0, WASM_I32V_1(17)));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f0, WASM_I64V_1(27)));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f0, WASM_F64(37.2)));
+ ExpectFailure(sig, {WASM_CALL_FUNCTION0(f0)});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(f0, WASM_I32V_1(17))});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(f0, WASM_I64V_1(27))});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(f0, WASM_F64(37.2))});
byte f1 = builder.AddImport(sigs.i_d());
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION0(f1));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f1, WASM_I32V_1(16)));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f1, WASM_I64V_1(16)));
- EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f1, WASM_F32(17.6)));
+ ExpectFailure(sig, {WASM_CALL_FUNCTION0(f1)});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(f1, WASM_I32V_1(16))});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(f1, WASM_I64V_1(16))});
+ ExpectFailure(sig, {WASM_CALL_FUNCTION(f1, WASM_F32(17.6))});
}
TEST_F(FunctionBodyDecoderTest, Int32Globals) {
@@ -1699,9 +1912,9 @@ TEST_F(FunctionBodyDecoderTest, Int32Globals) {
builder.AddGlobal(kWasmI32);
- EXPECT_VERIFIES_S(sig, WASM_GET_GLOBAL(0));
- EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)));
- EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), WASM_ZERO);
+ ExpectValidates(sig, {WASM_GET_GLOBAL(0)});
+ ExpectFailure(sig, {WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))});
+ ExpectValidates(sig, {WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), WASM_ZERO});
}
TEST_F(FunctionBodyDecoderTest, ImmutableGlobal) {
@@ -1712,8 +1925,8 @@ TEST_F(FunctionBodyDecoderTest, ImmutableGlobal) {
uint32_t g0 = builder.AddGlobal(kWasmI32, true);
uint32_t g1 = builder.AddGlobal(kWasmI32, false);
- EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(g0, WASM_ZERO));
- EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(g1, WASM_ZERO));
+ ExpectValidates(sig, {WASM_SET_GLOBAL(g0, WASM_ZERO)});
+ ExpectFailure(sig, {WASM_SET_GLOBAL(g1, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, Int32Globals_fail) {
@@ -1726,15 +1939,15 @@ TEST_F(FunctionBodyDecoderTest, Int32Globals_fail) {
builder.AddGlobal(kWasmF32);
builder.AddGlobal(kWasmF64);
- EXPECT_FAILURE_S(sig, WASM_GET_GLOBAL(0));
- EXPECT_FAILURE_S(sig, WASM_GET_GLOBAL(1));
- EXPECT_FAILURE_S(sig, WASM_GET_GLOBAL(2));
- EXPECT_FAILURE_S(sig, WASM_GET_GLOBAL(3));
+ ExpectFailure(sig, {WASM_GET_GLOBAL(0)});
+ ExpectFailure(sig, {WASM_GET_GLOBAL(1)});
+ ExpectFailure(sig, {WASM_GET_GLOBAL(2)});
+ ExpectFailure(sig, {WASM_GET_GLOBAL(3)});
- EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), WASM_ZERO);
- EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(1, WASM_GET_LOCAL(0)), WASM_ZERO);
- EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(2, WASM_GET_LOCAL(0)), WASM_ZERO);
- EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(3, WASM_GET_LOCAL(0)), WASM_ZERO);
+ ExpectFailure(sig, {WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), WASM_ZERO});
+ ExpectFailure(sig, {WASM_SET_GLOBAL(1, WASM_GET_LOCAL(0)), WASM_ZERO});
+ ExpectFailure(sig, {WASM_SET_GLOBAL(2, WASM_GET_LOCAL(0)), WASM_ZERO});
+ ExpectFailure(sig, {WASM_SET_GLOBAL(3, WASM_GET_LOCAL(0)), WASM_ZERO});
}
TEST_F(FunctionBodyDecoderTest, Int64Globals) {
@@ -1745,13 +1958,13 @@ TEST_F(FunctionBodyDecoderTest, Int64Globals) {
builder.AddGlobal(kWasmI64);
builder.AddGlobal(kWasmI64);
- EXPECT_VERIFIES_S(sig, WASM_GET_GLOBAL(0));
- EXPECT_VERIFIES_S(sig, WASM_GET_GLOBAL(1));
+ ExpectValidates(sig, {WASM_GET_GLOBAL(0)});
+ ExpectValidates(sig, {WASM_GET_GLOBAL(1)});
- EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)),
- WASM_GET_LOCAL(0));
- EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(1, WASM_GET_LOCAL(0)),
- WASM_GET_LOCAL(0));
+ ExpectValidates(sig,
+ {WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), WASM_GET_LOCAL(0)});
+ ExpectValidates(sig,
+ {WASM_SET_GLOBAL(1, WASM_GET_LOCAL(0)), WASM_GET_LOCAL(0)});
}
TEST_F(FunctionBodyDecoderTest, Float32Globals) {
@@ -1761,9 +1974,9 @@ TEST_F(FunctionBodyDecoderTest, Float32Globals) {
builder.AddGlobal(kWasmF32);
- EXPECT_VERIFIES_S(sig, WASM_GET_GLOBAL(0));
- EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)),
- WASM_GET_LOCAL(0));
+ ExpectValidates(sig, {WASM_GET_GLOBAL(0)});
+ ExpectValidates(sig,
+ {WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), WASM_GET_LOCAL(0)});
}
TEST_F(FunctionBodyDecoderTest, Float64Globals) {
@@ -1773,9 +1986,9 @@ TEST_F(FunctionBodyDecoderTest, Float64Globals) {
builder.AddGlobal(kWasmF64);
- EXPECT_VERIFIES_S(sig, WASM_GET_GLOBAL(0));
- EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)),
- WASM_GET_LOCAL(0));
+ ExpectValidates(sig, {WASM_GET_GLOBAL(0)});
+ ExpectValidates(sig,
+ {WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), WASM_GET_LOCAL(0)});
}
TEST_F(FunctionBodyDecoderTest, AllGetGlobalCombinations) {
@@ -1787,11 +2000,7 @@ TEST_F(FunctionBodyDecoderTest, AllGetGlobalCombinations) {
TestModuleBuilder builder;
module = builder.module();
builder.AddGlobal(global_type);
- if (local_type == global_type) {
- EXPECT_VERIFIES_S(&sig, WASM_GET_GLOBAL(0));
- } else {
- EXPECT_FAILURE_S(&sig, WASM_GET_GLOBAL(0));
- }
+ Validate(local_type == global_type, &sig, {WASM_GET_GLOBAL(0)});
}
}
}
@@ -1805,23 +2014,113 @@ TEST_F(FunctionBodyDecoderTest, AllSetGlobalCombinations) {
TestModuleBuilder builder;
module = builder.module();
builder.AddGlobal(global_type);
- if (local_type == global_type) {
- EXPECT_VERIFIES_S(&sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)));
- } else {
- EXPECT_FAILURE_S(&sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)));
- }
+ Validate(local_type == global_type, &sig,
+ {WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))});
}
}
}
+TEST_F(FunctionBodyDecoderTest, SetTable) {
+ WASM_FEATURE_SCOPE(anyref);
+ TestModuleBuilder builder;
+ module = builder.module();
+ byte tab_ref1 = builder.AddTable(kWasmAnyRef, 10, true, 20);
+ byte tab_func1 = builder.AddTable(kWasmAnyFunc, 20, true, 30);
+ byte tab_func2 = builder.AddTable(kWasmAnyFunc, 10, false, 20);
+ byte tab_ref2 = builder.AddTable(kWasmAnyRef, 10, false, 20);
+ ValueType sig_types[]{kWasmAnyRef, kWasmAnyFunc, kWasmI32};
+ FunctionSig sig(0, 3, sig_types);
+ byte local_ref = 0;
+ byte local_func = 1;
+ byte local_int = 2;
+ ExpectValidates(&sig, {WASM_SET_TABLE(tab_ref1, WASM_I32V(6),
+ WASM_GET_LOCAL(local_ref))});
+ ExpectValidates(&sig, {WASM_SET_TABLE(tab_func1, WASM_I32V(5),
+ WASM_GET_LOCAL(local_func))});
+ ExpectValidates(&sig, {WASM_SET_TABLE(tab_func2, WASM_I32V(7),
+ WASM_GET_LOCAL(local_func))});
+ ExpectValidates(&sig, {WASM_SET_TABLE(tab_ref2, WASM_I32V(8),
+ WASM_GET_LOCAL(local_ref))});
+
+ // We can store anyfunc values as anyref, but not the other way around.
+ ExpectValidates(&sig, {WASM_SET_TABLE(tab_ref1, WASM_I32V(4),
+ WASM_GET_LOCAL(local_func))});
+ ExpectFailure(&sig, {WASM_SET_TABLE(tab_func1, WASM_I32V(9),
+ WASM_GET_LOCAL(local_ref))});
+ ExpectFailure(&sig, {WASM_SET_TABLE(tab_func2, WASM_I32V(3),
+ WASM_GET_LOCAL(local_ref))});
+ ExpectValidates(&sig, {WASM_SET_TABLE(tab_ref2, WASM_I32V(2),
+ WASM_GET_LOCAL(local_func))});
+ ExpectFailure(&sig, {WASM_SET_TABLE(tab_ref1, WASM_I32V(9),
+ WASM_GET_LOCAL(local_int))});
+ ExpectFailure(&sig, {WASM_SET_TABLE(tab_func1, WASM_I32V(3),
+ WASM_GET_LOCAL(local_int))});
+ // Out-of-bounds table index should fail.
+ byte oob_tab = 37;
+ ExpectFailure(
+ &sig, {WASM_SET_TABLE(oob_tab, WASM_I32V(9), WASM_GET_LOCAL(local_ref))});
+ ExpectFailure(&sig, {WASM_SET_TABLE(oob_tab, WASM_I32V(3),
+ WASM_GET_LOCAL(local_func))});
+}
+
+TEST_F(FunctionBodyDecoderTest, GetTable) {
+ WASM_FEATURE_SCOPE(anyref);
+ TestModuleBuilder builder;
+ module = builder.module();
+ byte tab_ref1 = builder.AddTable(kWasmAnyRef, 10, true, 20);
+ byte tab_func1 = builder.AddTable(kWasmAnyFunc, 20, true, 30);
+ byte tab_func2 = builder.AddTable(kWasmAnyFunc, 10, false, 20);
+ byte tab_ref2 = builder.AddTable(kWasmAnyRef, 10, false, 20);
+ ValueType sig_types[]{kWasmAnyRef, kWasmAnyFunc, kWasmI32};
+ FunctionSig sig(0, 3, sig_types);
+ byte local_ref = 0;
+ byte local_func = 1;
+ byte local_int = 2;
+ ExpectValidates(
+ &sig,
+ {WASM_SET_LOCAL(local_ref, WASM_GET_TABLE(tab_ref1, WASM_I32V(6)))});
+ ExpectValidates(
+ &sig,
+ {WASM_SET_LOCAL(local_ref, WASM_GET_TABLE(tab_ref2, WASM_I32V(8)))});
+ ExpectValidates(
+ &sig,
+ {WASM_SET_LOCAL(local_func, WASM_GET_TABLE(tab_func1, WASM_I32V(5)))});
+ ExpectValidates(
+ &sig,
+ {WASM_SET_LOCAL(local_func, WASM_GET_TABLE(tab_func2, WASM_I32V(7)))});
+
+ // We can store anyfunc values as anyref, but not the other way around.
+ ExpectFailure(&sig, {WASM_SET_LOCAL(local_func,
+ WASM_GET_TABLE(tab_ref1, WASM_I32V(4)))});
+ ExpectValidates(
+ &sig,
+ {WASM_SET_LOCAL(local_ref, WASM_GET_TABLE(tab_func1, WASM_I32V(9)))});
+ ExpectValidates(
+ &sig,
+ {WASM_SET_LOCAL(local_ref, WASM_GET_TABLE(tab_func2, WASM_I32V(3)))});
+ ExpectFailure(&sig, {WASM_SET_LOCAL(local_func,
+ WASM_GET_TABLE(tab_ref2, WASM_I32V(2)))});
+
+ ExpectFailure(&sig, {WASM_SET_LOCAL(local_int,
+ WASM_GET_TABLE(tab_ref1, WASM_I32V(9)))});
+ ExpectFailure(&sig, {WASM_SET_LOCAL(
+ local_int, WASM_GET_TABLE(tab_func1, WASM_I32V(3)))});
+ // Out-of-bounds table index should fail.
+ byte oob_tab = 37;
+ ExpectFailure(
+ &sig, {WASM_SET_LOCAL(local_ref, WASM_GET_TABLE(oob_tab, WASM_I32V(9)))});
+ ExpectFailure(&sig, {WASM_SET_LOCAL(local_func,
+ WASM_GET_TABLE(oob_tab, WASM_I32V(3)))});
+}
+
TEST_F(FunctionBodyDecoderTest, WasmMemoryGrow) {
TestModuleBuilder builder;
module = builder.module();
builder.InitializeMemory();
byte code[] = {WASM_GET_LOCAL(0), kExprMemoryGrow, 0};
- EXPECT_VERIFIES_C(i_i, code);
- EXPECT_FAILURE_C(i_d, code);
+ ExpectValidates(sigs.i_i(), code);
+ ExpectFailure(sigs.i_d(), code);
}
TEST_F(FunctionBodyDecoderTest, AsmJsMemoryGrow) {
@@ -1830,7 +2129,7 @@ TEST_F(FunctionBodyDecoderTest, AsmJsMemoryGrow) {
builder.InitializeMemory();
byte code[] = {WASM_GET_LOCAL(0), kExprMemoryGrow, 0};
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.i_i(), code);
}
TEST_F(FunctionBodyDecoderTest, AsmJsBinOpsCheckOrigin) {
@@ -1870,9 +2169,9 @@ TEST_F(FunctionBodyDecoderTest, AsmJsBinOpsCheckOrigin) {
module = builder.module();
builder.InitializeMemory();
for (size_t i = 0; i < arraysize(AsmJsBinOps); i++) {
- byte code[] = {
- WASM_BINOP(AsmJsBinOps[i].op, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))};
- EXPECT_FAILURE_SC(AsmJsBinOps[i].sig, code);
+ ExpectFailure(AsmJsBinOps[i].sig,
+ {WASM_BINOP(AsmJsBinOps[i].op, WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(1))});
}
}
}
@@ -1918,44 +2217,48 @@ TEST_F(FunctionBodyDecoderTest, AsmJsUnOpsCheckOrigin) {
module = builder.module();
builder.InitializeMemory();
for (size_t i = 0; i < arraysize(AsmJsUnOps); i++) {
- byte code[] = {WASM_UNOP(AsmJsUnOps[i].op, WASM_GET_LOCAL(0))};
- EXPECT_FAILURE_SC(AsmJsUnOps[i].sig, code);
+ ExpectFailure(AsmJsUnOps[i].sig,
+ {WASM_UNOP(AsmJsUnOps[i].op, WASM_GET_LOCAL(0))});
}
}
}
TEST_F(FunctionBodyDecoderTest, BreakEnd) {
- EXPECT_VERIFIES(
- i_i, WASM_BLOCK_I(WASM_I32_ADD(WASM_BRV(0, WASM_ZERO), WASM_ZERO)));
- EXPECT_VERIFIES(
- i_i, WASM_BLOCK_I(WASM_I32_ADD(WASM_ZERO, WASM_BRV(0, WASM_ZERO))));
+ ExpectValidates(
+ sigs.i_i(),
+ {WASM_BLOCK_I(WASM_I32_ADD(WASM_BRV(0, WASM_ZERO), WASM_ZERO))});
+ ExpectValidates(
+ sigs.i_i(),
+ {WASM_BLOCK_I(WASM_I32_ADD(WASM_ZERO, WASM_BRV(0, WASM_ZERO)))});
}
TEST_F(FunctionBodyDecoderTest, BreakIfBinop) {
- EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_I32_ADD(
- WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO), WASM_ZERO)));
- EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_I32_ADD(
- WASM_ZERO, WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO))));
- EXPECT_VERIFIES_S(
+ ExpectValidates(sigs.i_i(),
+ {WASM_BLOCK_I(WASM_I32_ADD(
+ WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO), WASM_ZERO))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_BLOCK_I(WASM_I32_ADD(
+ WASM_ZERO, WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO)))});
+ ExpectValidates(
sigs.f_ff(),
- WASM_BLOCK_F(WASM_F32_ABS(WASM_BRV_IF(0, WASM_F32(0.0f), WASM_ZERO))));
+ {WASM_BLOCK_F(WASM_F32_ABS(WASM_BRV_IF(0, WASM_F32(0.0f), WASM_ZERO)))});
}
TEST_F(FunctionBodyDecoderTest, BreakIfBinop_fail) {
- EXPECT_FAILURE_S(
+ ExpectFailure(
sigs.f_ff(),
- WASM_BLOCK_F(WASM_F32_ABS(WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO))));
- EXPECT_FAILURE_S(
+ {WASM_BLOCK_F(WASM_F32_ABS(WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO)))});
+ ExpectFailure(
sigs.i_i(),
- WASM_BLOCK_I(WASM_F32_ABS(WASM_BRV_IF(0, WASM_F32(0.0f), WASM_ZERO))));
+ {WASM_BLOCK_I(WASM_F32_ABS(WASM_BRV_IF(0, WASM_F32(0.0f), WASM_ZERO)))});
}
TEST_F(FunctionBodyDecoderTest, BreakIfUnrNarrow) {
- EXPECT_FAILURE_S(
+ ExpectFailure(
sigs.f_ff(),
- WASM_BLOCK_I(WASM_BRV_IF(0, WASM_UNREACHABLE, WASM_UNREACHABLE),
- WASM_RETURN0),
- WASM_F32(0.0));
+ {WASM_BLOCK_I(WASM_BRV_IF(0, WASM_UNREACHABLE, WASM_UNREACHABLE),
+ WASM_RETURN0),
+ WASM_F32(0.0)});
}
TEST_F(FunctionBodyDecoderTest, BreakNesting1) {
@@ -1965,22 +2268,14 @@ TEST_F(FunctionBodyDecoderTest, BreakNesting1) {
WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(i + 1, WASM_ZERO)),
WASM_SET_LOCAL(0, WASM_I32V_1(1))),
WASM_ZERO)};
- if (i < 3) {
- EXPECT_VERIFIES_C(i_i, code);
- } else {
- EXPECT_FAILURE_C(i_i, code);
- }
+ Validate(i < 3, sigs.i_i(), code);
}
}
TEST_F(FunctionBodyDecoderTest, BreakNesting2) {
for (int i = 0; i < 7; i++) {
byte code[] = {B1(WASM_LOOP(WASM_IF(WASM_ZERO, WASM_BR(i)), WASM_NOP))};
- if (i <= 3) {
- EXPECT_VERIFIES_C(v_v, code);
- } else {
- EXPECT_FAILURE_C(v_v, code);
- }
+ Validate(i <= 3, sigs.v_v(), code);
}
}
@@ -1989,25 +2284,22 @@ TEST_F(FunctionBodyDecoderTest, BreakNesting3) {
// (block[1] (loop[1] (block[1] (if 0 break[N])
byte code[] = {
WASM_BLOCK(WASM_LOOP(B1(WASM_IF(WASM_ZERO, WASM_BR(i + 1)))))};
- if (i < 4) {
- EXPECT_VERIFIES_C(v_v, code);
- } else {
- EXPECT_FAILURE_C(v_v, code);
- }
+ Validate(i < 4, sigs.v_v(), code);
}
}
TEST_F(FunctionBodyDecoderTest, BreaksWithMultipleTypes) {
- EXPECT_FAILURE(i_i, B2(WASM_BRV_IF_ZERO(0, WASM_I32V_1(7)), WASM_F32(7.7)));
+ ExpectFailure(sigs.i_i(),
+ {B2(WASM_BRV_IF_ZERO(0, WASM_I32V_1(7)), WASM_F32(7.7))});
- EXPECT_FAILURE(i_i, B2(WASM_BRV_IF_ZERO(0, WASM_I32V_1(7)),
- WASM_BRV_IF_ZERO(0, WASM_F32(7.7))));
- EXPECT_FAILURE(i_i, B3(WASM_BRV_IF_ZERO(0, WASM_I32V_1(8)),
- WASM_BRV_IF_ZERO(0, WASM_I32V_1(0)),
- WASM_BRV_IF_ZERO(0, WASM_F32(7.7))));
- EXPECT_FAILURE(i_i, B3(WASM_BRV_IF_ZERO(0, WASM_I32V_1(9)),
- WASM_BRV_IF_ZERO(0, WASM_F32(7.7)),
- WASM_BRV_IF_ZERO(0, WASM_I32V_1(11))));
+ ExpectFailure(sigs.i_i(), {B2(WASM_BRV_IF_ZERO(0, WASM_I32V_1(7)),
+ WASM_BRV_IF_ZERO(0, WASM_F32(7.7)))});
+ ExpectFailure(sigs.i_i(), {B3(WASM_BRV_IF_ZERO(0, WASM_I32V_1(8)),
+ WASM_BRV_IF_ZERO(0, WASM_I32V_1(0)),
+ WASM_BRV_IF_ZERO(0, WASM_F32(7.7)))});
+ ExpectFailure(sigs.i_i(), {B3(WASM_BRV_IF_ZERO(0, WASM_I32V_1(9)),
+ WASM_BRV_IF_ZERO(0, WASM_F32(7.7)),
+ WASM_BRV_IF_ZERO(0, WASM_I32V_1(11)))});
}
TEST_F(FunctionBodyDecoderTest, BreakNesting_6_levels) {
@@ -2027,11 +2319,7 @@ TEST_F(FunctionBodyDecoderTest, BreakNesting_6_levels) {
m >>= 1;
}
- if (i <= depth) {
- EXPECT_VERIFIES_C(v_v, code);
- } else {
- EXPECT_FAILURE_C(v_v, code);
- }
+ Validate(i <= depth, sigs.v_v(), code);
}
}
}
@@ -2044,17 +2332,19 @@ TEST_F(FunctionBodyDecoderTest, Break_TypeCheck) {
byte code[] = {WASM_BLOCK_T(
sig->GetReturn(), WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))),
WASM_GET_LOCAL(0))};
- EXPECT_VERIFIES_SC(sig, code);
+ ExpectValidates(sig, code);
}
// unify i32 and f32 => fail
- EXPECT_FAILURE(i_i, WASM_BLOCK_I(WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_ZERO)),
- WASM_F32(1.2)));
+ ExpectFailure(sigs.i_i(),
+ {WASM_BLOCK_I(WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_ZERO)),
+ WASM_F32(1.2))});
// unify f64 and f64 => OK
- EXPECT_VERIFIES(
- d_dd, WASM_BLOCK_D(WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))),
- WASM_F64(1.2)));
+ ExpectValidates(
+ sigs.d_dd(),
+ {WASM_BLOCK_D(WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))),
+ WASM_F64(1.2))});
}
TEST_F(FunctionBodyDecoderTest, Break_TypeCheckAll1) {
@@ -2066,11 +2356,7 @@ TEST_F(FunctionBodyDecoderTest, Break_TypeCheckAll1) {
sig.GetReturn(), WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))),
WASM_GET_LOCAL(1))};
- if (i == j) {
- EXPECT_VERIFIES_SC(&sig, code);
- } else {
- EXPECT_FAILURE_SC(&sig, code);
- }
+ Validate(i == j, &sig, code);
}
}
}
@@ -2084,11 +2370,7 @@ TEST_F(FunctionBodyDecoderTest, Break_TypeCheckAll2) {
WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)),
WASM_GET_LOCAL(1))};
- if (i == j) {
- EXPECT_VERIFIES_SC(&sig, code);
- } else {
- EXPECT_FAILURE_SC(&sig, code);
- }
+ Validate(i == j, &sig, code);
}
}
}
@@ -2102,11 +2384,7 @@ TEST_F(FunctionBodyDecoderTest, Break_TypeCheckAll3) {
WASM_GET_LOCAL(1),
WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))};
- if (i == j) {
- EXPECT_VERIFIES_SC(&sig, code);
- } else {
- EXPECT_FAILURE_SC(&sig, code);
- }
+ Validate(i == j, &sig, code);
}
}
}
@@ -2122,11 +2400,7 @@ TEST_F(FunctionBodyDecoderTest, Break_Unify) {
type, WASM_IF(WASM_ZERO, WASM_BRV(1, WASM_GET_LOCAL(which))),
WASM_GET_LOCAL(which ^ 1))};
- if (type == kWasmI32) {
- EXPECT_VERIFIES_SC(&sig, code1);
- } else {
- EXPECT_FAILURE_SC(&sig, code1);
- }
+ Validate(type == kWasmI32, &sig, code1);
}
}
}
@@ -2139,11 +2413,7 @@ TEST_F(FunctionBodyDecoderTest, BreakIf_cond_type) {
byte code[] = {WASM_BLOCK_T(
types[0], WASM_BRV_IF(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))};
- if (types[2] == kWasmI32) {
- EXPECT_VERIFIES_SC(&sig, code);
- } else {
- EXPECT_FAILURE_SC(&sig, code);
- }
+ Validate(types[2] == kWasmI32, &sig, code);
}
}
}
@@ -2158,11 +2428,7 @@ TEST_F(FunctionBodyDecoderTest, BreakIf_val_type) {
types[1], WASM_BRV_IF(0, WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)),
WASM_DROP, WASM_GET_LOCAL(0))};
- if (i == j) {
- EXPECT_VERIFIES_SC(&sig, code);
- } else {
- EXPECT_FAILURE_SC(&sig, code);
- }
+ Validate(i == j, &sig, code);
}
}
}
@@ -2176,73 +2442,64 @@ TEST_F(FunctionBodyDecoderTest, BreakIf_Unify) {
byte code[] = {WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(which)),
WASM_DROP, WASM_GET_LOCAL(which ^ 1))};
- if (type == kWasmI32) {
- EXPECT_VERIFIES_SC(&sig, code);
- } else {
- EXPECT_FAILURE_SC(&sig, code);
- }
+ Validate(type == kWasmI32, &sig, code);
}
}
}
TEST_F(FunctionBodyDecoderTest, BrTable0) {
- static byte code[] = {kExprBrTable, 0, BR_TARGET(0)};
- EXPECT_FAILURE_C(v_v, code);
+ ExpectFailure(sigs.v_v(), {kExprBrTable, 0, BR_TARGET(0)});
}
TEST_F(FunctionBodyDecoderTest, BrTable0b) {
static byte code[] = {kExprI32Const, 11, kExprBrTable, 0, BR_TARGET(0)};
- EXPECT_VERIFIES_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
+ ExpectValidates(sigs.v_v(), code);
+ ExpectFailure(sigs.i_i(), code);
}
TEST_F(FunctionBodyDecoderTest, BrTable0c) {
static byte code[] = {kExprI32Const, 11, kExprBrTable, 0, BR_TARGET(1)};
- EXPECT_FAILURE_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
+ ExpectFailure(sigs.v_v(), code);
+ ExpectFailure(sigs.i_i(), code);
}
TEST_F(FunctionBodyDecoderTest, BrTable1a) {
- static byte code[] = {B1(WASM_BR_TABLE(WASM_I32V_2(67), 0, BR_TARGET(0)))};
- EXPECT_VERIFIES_C(v_v, code);
+ ExpectValidates(sigs.v_v(),
+ {B1(WASM_BR_TABLE(WASM_I32V_2(67), 0, BR_TARGET(0)))});
}
TEST_F(FunctionBodyDecoderTest, BrTable1b) {
static byte code[] = {B1(WASM_BR_TABLE(WASM_ZERO, 0, BR_TARGET(0)))};
- EXPECT_VERIFIES_C(v_v, code);
- EXPECT_FAILURE_C(i_i, code);
- EXPECT_FAILURE_C(f_ff, code);
- EXPECT_FAILURE_C(d_dd, code);
+ ExpectValidates(sigs.v_v(), code);
+ ExpectFailure(sigs.i_i(), code);
+ ExpectFailure(sigs.f_ff(), code);
+ ExpectFailure(sigs.d_dd(), code);
}
TEST_F(FunctionBodyDecoderTest, BrTable2a) {
- static byte code[] = {
- B1(WASM_BR_TABLE(WASM_I32V_2(67), 1, BR_TARGET(0), BR_TARGET(0)))};
- EXPECT_VERIFIES_C(v_v, code);
+ ExpectValidates(
+ sigs.v_v(),
+ {B1(WASM_BR_TABLE(WASM_I32V_2(67), 1, BR_TARGET(0), BR_TARGET(0)))});
}
TEST_F(FunctionBodyDecoderTest, BrTable2b) {
- static byte code[] = {WASM_BLOCK(WASM_BLOCK(
- WASM_BR_TABLE(WASM_I32V_2(67), 1, BR_TARGET(0), BR_TARGET(1))))};
- EXPECT_VERIFIES_C(v_v, code);
+ ExpectValidates(sigs.v_v(),
+ {WASM_BLOCK(WASM_BLOCK(WASM_BR_TABLE(
+ WASM_I32V_2(67), 1, BR_TARGET(0), BR_TARGET(1))))});
}
TEST_F(FunctionBodyDecoderTest, BrTable_off_end) {
static byte code[] = {B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0)))};
for (size_t len = 1; len < sizeof(code); len++) {
- Verify(false, sigs.i_i(), {code, len}, kAppendEnd);
- Verify(false, sigs.i_i(), {code, len}, kOmitEnd);
+ ExpectFailure(sigs.i_i(), VectorOf(code, len), kAppendEnd);
+ ExpectFailure(sigs.i_i(), VectorOf(code, len), kOmitEnd);
}
}
TEST_F(FunctionBodyDecoderTest, BrTable_invalid_br1) {
for (int depth = 0; depth < 4; depth++) {
byte code[] = {B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(depth)))};
- if (depth <= 1) {
- EXPECT_VERIFIES_C(v_i, code);
- } else {
- EXPECT_FAILURE_C(v_i, code);
- }
+ Validate(depth <= 1, sigs.v_i(), code);
}
}
@@ -2250,136 +2507,143 @@ TEST_F(FunctionBodyDecoderTest, BrTable_invalid_br2) {
for (int depth = 0; depth < 7; depth++) {
byte code[] = {
WASM_LOOP(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(depth)))};
- if (depth < 2) {
- EXPECT_VERIFIES_C(v_i, code);
- } else {
- EXPECT_FAILURE_C(v_i, code);
- }
+ Validate(depth < 2, sigs.v_i(), code);
}
}
TEST_F(FunctionBodyDecoderTest, BrTable_arity_mismatch1) {
- EXPECT_FAILURE(
- v_v,
- WASM_BLOCK(WASM_BLOCK_I(
- WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1)))));
+ ExpectFailure(
+ sigs.v_v(),
+ {WASM_BLOCK(WASM_BLOCK_I(
+ WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1))))});
}
TEST_F(FunctionBodyDecoderTest, BrTable_arity_mismatch2) {
- EXPECT_FAILURE(
- v_v,
- WASM_BLOCK_I(WASM_BLOCK(
- WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1)))));
+ ExpectFailure(
+ sigs.v_v(),
+ {WASM_BLOCK_I(WASM_BLOCK(
+ WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1))))});
}
TEST_F(FunctionBodyDecoderTest, BrTable_arity_mismatch_loop1) {
- EXPECT_FAILURE(
- v_v,
- WASM_LOOP(WASM_BLOCK_I(
- WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1)))));
+ ExpectFailure(
+ sigs.v_v(),
+ {WASM_LOOP(WASM_BLOCK_I(
+ WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1))))});
}
TEST_F(FunctionBodyDecoderTest, BrTable_arity_mismatch_loop2) {
- EXPECT_FAILURE(
- v_v,
- WASM_BLOCK_I(WASM_LOOP(
- WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1)))));
+ ExpectFailure(
+ sigs.v_v(),
+ {WASM_BLOCK_I(WASM_LOOP(
+ WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1))))});
}
TEST_F(FunctionBodyDecoderTest, BrTable_loop_block) {
- EXPECT_VERIFIES(
- v_v,
- WASM_LOOP(WASM_BLOCK(
- WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1)))));
+ ExpectValidates(
+ sigs.v_v(),
+ {WASM_LOOP(WASM_BLOCK(
+ WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1))))});
}
TEST_F(FunctionBodyDecoderTest, BrTable_block_loop) {
- EXPECT_VERIFIES(
- v_v,
- WASM_LOOP(WASM_BLOCK(
- WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1)))));
+ ExpectValidates(
+ sigs.v_v(),
+ {WASM_LOOP(WASM_BLOCK(
+ WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1))))});
}
TEST_F(FunctionBodyDecoderTest, BrTable_type_mismatch1) {
- EXPECT_FAILURE(
- v_v,
- WASM_BLOCK_I(WASM_BLOCK_F(
- WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1)))));
+ ExpectFailure(
+ sigs.v_v(),
+ {WASM_BLOCK_I(WASM_BLOCK_F(
+ WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1))))});
}
TEST_F(FunctionBodyDecoderTest, BrTable_type_mismatch2) {
- EXPECT_FAILURE(
- v_v,
- WASM_BLOCK_F(WASM_BLOCK_I(
- WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1)))));
+ ExpectFailure(
+ sigs.v_v(),
+ {WASM_BLOCK_F(WASM_BLOCK_I(
+ WASM_ONE, WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1))))});
}
TEST_F(FunctionBodyDecoderTest, BrTable_type_mismatch_unreachable) {
- EXPECT_FAILURE(v_v,
- WASM_BLOCK_F(WASM_BLOCK_I(
- WASM_UNREACHABLE,
- WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1)))));
+ ExpectFailure(sigs.v_v(),
+ {WASM_BLOCK_F(WASM_BLOCK_I(
+ WASM_UNREACHABLE,
+ WASM_BR_TABLE(WASM_ONE, 1, BR_TARGET(0), BR_TARGET(1))))});
}
TEST_F(FunctionBodyDecoderTest, BrUnreachable1) {
- EXPECT_VERIFIES(v_i, WASM_GET_LOCAL(0), kExprBrTable, 0, BR_TARGET(0));
+ ExpectValidates(sigs.v_i(),
+ {WASM_GET_LOCAL(0), kExprBrTable, 0, BR_TARGET(0)});
}
TEST_F(FunctionBodyDecoderTest, BrUnreachable2) {
- EXPECT_VERIFIES(v_i, WASM_GET_LOCAL(0), kExprBrTable, 0, BR_TARGET(0),
- WASM_NOP);
- EXPECT_FAILURE(v_i, WASM_GET_LOCAL(0), kExprBrTable, 0, BR_TARGET(0),
- WASM_ZERO);
+ ExpectValidates(sigs.v_i(),
+ {WASM_GET_LOCAL(0), kExprBrTable, 0, BR_TARGET(0), WASM_NOP});
+ ExpectFailure(sigs.v_i(),
+ {WASM_GET_LOCAL(0), kExprBrTable, 0, BR_TARGET(0), WASM_ZERO});
}
TEST_F(FunctionBodyDecoderTest, Brv1) {
- EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_BRV(0, WASM_ZERO)));
- EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_LOOP_I(WASM_BRV(2, WASM_ZERO))));
+ ExpectValidates(sigs.i_i(), {WASM_BLOCK_I(WASM_BRV(0, WASM_ZERO))});
+ ExpectValidates(sigs.i_i(),
+ {WASM_BLOCK_I(WASM_LOOP_I(WASM_BRV(2, WASM_ZERO)))});
}
TEST_F(FunctionBodyDecoderTest, Brv1_type) {
- EXPECT_VERIFIES(i_ii, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0))));
- EXPECT_VERIFIES(l_ll, WASM_BLOCK_L(WASM_BRV(0, WASM_GET_LOCAL(0))));
- EXPECT_VERIFIES(f_ff, WASM_BLOCK_F(WASM_BRV(0, WASM_GET_LOCAL(0))));
- EXPECT_VERIFIES(d_dd, WASM_BLOCK_D(WASM_BRV(0, WASM_GET_LOCAL(0))));
+ ExpectValidates(sigs.i_ii(), {WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)))});
+ ExpectValidates(sigs.l_ll(), {WASM_BLOCK_L(WASM_BRV(0, WASM_GET_LOCAL(0)))});
+ ExpectValidates(sigs.f_ff(), {WASM_BLOCK_F(WASM_BRV(0, WASM_GET_LOCAL(0)))});
+ ExpectValidates(sigs.d_dd(), {WASM_BLOCK_D(WASM_BRV(0, WASM_GET_LOCAL(0)))});
}
TEST_F(FunctionBodyDecoderTest, Brv1_type_n) {
- EXPECT_FAILURE(i_f, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0))));
- EXPECT_FAILURE(i_d, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0))));
+ ExpectFailure(sigs.i_f(), {WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)))});
+ ExpectFailure(sigs.i_d(), {WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)))});
}
TEST_F(FunctionBodyDecoderTest, BrvIf1) {
- EXPECT_VERIFIES(i_v, WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_ZERO)));
+ ExpectValidates(sigs.i_v(), {WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_ZERO))});
}
TEST_F(FunctionBodyDecoderTest, BrvIf1_type) {
- EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0))));
- EXPECT_VERIFIES(l_l, WASM_BLOCK_L(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0))));
- EXPECT_VERIFIES(f_ff, WASM_BLOCK_F(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0))));
- EXPECT_VERIFIES(d_dd, WASM_BLOCK_D(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0))));
+ ExpectValidates(sigs.i_i(),
+ {WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))});
+ ExpectValidates(sigs.l_l(),
+ {WASM_BLOCK_L(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))});
+ ExpectValidates(sigs.f_ff(),
+ {WASM_BLOCK_F(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))});
+ ExpectValidates(sigs.d_dd(),
+ {WASM_BLOCK_D(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))});
}
TEST_F(FunctionBodyDecoderTest, BrvIf1_type_n) {
- EXPECT_FAILURE(i_f, WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0))));
- EXPECT_FAILURE(i_d, WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0))));
+ ExpectFailure(sigs.i_f(),
+ {WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))});
+ ExpectFailure(sigs.i_d(),
+ {WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))});
}
TEST_F(FunctionBodyDecoderTest, Select) {
- EXPECT_VERIFIES(i_i,
- WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_ZERO));
- EXPECT_VERIFIES(f_ff, WASM_SELECT(WASM_F32(0.0), WASM_F32(0.0), WASM_ZERO));
- EXPECT_VERIFIES(d_dd, WASM_SELECT(WASM_F64(0.0), WASM_F64(0.0), WASM_ZERO));
- EXPECT_VERIFIES(l_l, WASM_SELECT(WASM_I64V_1(0), WASM_I64V_1(0), WASM_ZERO));
+ ExpectValidates(sigs.i_i(), {WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
+ WASM_ZERO)});
+ ExpectValidates(sigs.f_ff(),
+ {WASM_SELECT(WASM_F32(0.0), WASM_F32(0.0), WASM_ZERO)});
+ ExpectValidates(sigs.d_dd(),
+ {WASM_SELECT(WASM_F64(0.0), WASM_F64(0.0), WASM_ZERO)});
+ ExpectValidates(sigs.l_l(),
+ {WASM_SELECT(WASM_I64V_1(0), WASM_I64V_1(0), WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, Select_fail1) {
- EXPECT_FAILURE(
- i_i, WASM_SELECT(WASM_F32(0.0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
- EXPECT_FAILURE(
- i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_F32(0.0), WASM_GET_LOCAL(0)));
- EXPECT_FAILURE(
- i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_F32(0.0)));
+ ExpectFailure(sigs.i_i(), {WASM_SELECT(WASM_F32(0.0), WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(0))});
+ ExpectFailure(sigs.i_i(), {WASM_SELECT(WASM_GET_LOCAL(0), WASM_F32(0.0),
+ WASM_GET_LOCAL(0))});
+ ExpectFailure(sigs.i_i(), {WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
+ WASM_F32(0.0))});
}
TEST_F(FunctionBodyDecoderTest, Select_fail2) {
@@ -2390,29 +2654,29 @@ TEST_F(FunctionBodyDecoderTest, Select_fail2) {
ValueType types[] = {type, kWasmI32, type};
FunctionSig sig(1, 2, types);
- EXPECT_VERIFIES_S(&sig, WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(1),
- WASM_GET_LOCAL(0)));
+ ExpectValidates(&sig, {WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(1),
+ WASM_GET_LOCAL(0))});
- EXPECT_FAILURE_S(&sig, WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0),
- WASM_GET_LOCAL(0)));
+ ExpectFailure(&sig, {WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(0))});
- EXPECT_FAILURE_S(&sig, WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_GET_LOCAL(0)));
+ ExpectFailure(&sig, {WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_GET_LOCAL(0))});
- EXPECT_FAILURE_S(&sig, WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
- WASM_GET_LOCAL(1)));
+ ExpectFailure(&sig, {WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(1))});
}
}
TEST_F(FunctionBodyDecoderTest, Select_TypeCheck) {
- EXPECT_FAILURE(
- i_i, WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
+ ExpectFailure(sigs.i_i(), {WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(0))});
- EXPECT_FAILURE(
- i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_F64(0.25), WASM_GET_LOCAL(0)));
+ ExpectFailure(sigs.i_i(), {WASM_SELECT(WASM_GET_LOCAL(0), WASM_F64(0.25),
+ WASM_GET_LOCAL(0))});
- EXPECT_FAILURE(i_i,
- WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0), WASM_I64V_1(0)));
+ ExpectFailure(sigs.i_i(), {WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0),
+ WASM_I64V_1(0))});
}
TEST_F(FunctionBodyDecoderTest, Throw) {
@@ -2422,12 +2686,12 @@ TEST_F(FunctionBodyDecoderTest, Throw) {
byte ex1 = builder.AddException(sigs.v_v());
byte ex2 = builder.AddException(sigs.v_i());
byte ex3 = builder.AddException(sigs.v_ii());
- EXPECT_VERIFIES(v_v, kExprThrow, ex1);
- EXPECT_VERIFIES(v_v, WASM_I32V(0), kExprThrow, ex2);
- EXPECT_FAILURE(v_v, WASM_F32(0.0), kExprThrow, ex2);
- EXPECT_VERIFIES(v_v, WASM_I32V(0), WASM_I32V(0), kExprThrow, ex3);
- EXPECT_FAILURE(v_v, WASM_F32(0.0), WASM_I32V(0), kExprThrow, ex3);
- EXPECT_FAILURE(v_v, kExprThrow, 99);
+ ExpectValidates(sigs.v_v(), {kExprThrow, ex1});
+ ExpectValidates(sigs.v_v(), {WASM_I32V(0), kExprThrow, ex2});
+ ExpectFailure(sigs.v_v(), {WASM_F32(0.0), kExprThrow, ex2});
+ ExpectValidates(sigs.v_v(), {WASM_I32V(0), WASM_I32V(0), kExprThrow, ex3});
+ ExpectFailure(sigs.v_v(), {WASM_F32(0.0), WASM_I32V(0), kExprThrow, ex3});
+ ExpectFailure(sigs.v_v(), {kExprThrow, 99});
}
TEST_F(FunctionBodyDecoderTest, ThrowUnreachable) {
@@ -2436,12 +2700,14 @@ TEST_F(FunctionBodyDecoderTest, ThrowUnreachable) {
module = builder.module();
byte ex1 = builder.AddException(sigs.v_v());
byte ex2 = builder.AddException(sigs.v_i());
- EXPECT_VERIFIES(i_i, WASM_GET_LOCAL(0), kExprThrow, ex1, WASM_NOP);
- EXPECT_VERIFIES(v_i, WASM_GET_LOCAL(0), kExprThrow, ex2, WASM_NOP);
- EXPECT_VERIFIES(i_i, WASM_GET_LOCAL(0), kExprThrow, ex1, WASM_ZERO);
- EXPECT_FAILURE(v_i, WASM_GET_LOCAL(0), kExprThrow, ex2, WASM_ZERO);
- EXPECT_FAILURE(i_i, WASM_GET_LOCAL(0), kExprThrow, ex1, WASM_F32(0.0));
- EXPECT_FAILURE(v_i, WASM_GET_LOCAL(0), kExprThrow, ex2, WASM_F32(0.0));
+ ExpectValidates(sigs.i_i(), {WASM_GET_LOCAL(0), kExprThrow, ex1, WASM_NOP});
+ ExpectValidates(sigs.v_i(), {WASM_GET_LOCAL(0), kExprThrow, ex2, WASM_NOP});
+ ExpectValidates(sigs.i_i(), {WASM_GET_LOCAL(0), kExprThrow, ex1, WASM_ZERO});
+ ExpectFailure(sigs.v_i(), {WASM_GET_LOCAL(0), kExprThrow, ex2, WASM_ZERO});
+ ExpectFailure(sigs.i_i(),
+ {WASM_GET_LOCAL(0), kExprThrow, ex1, WASM_F32(0.0)});
+ ExpectFailure(sigs.v_i(),
+ {WASM_GET_LOCAL(0), kExprThrow, ex2, WASM_F32(0.0)});
}
#define WASM_TRY_OP kExprTry, kLocalVoid
@@ -2452,21 +2718,22 @@ TEST_F(FunctionBodyDecoderTest, TryCatch) {
WASM_FEATURE_SCOPE(eh);
TestModuleBuilder builder;
module = builder.module();
- EXPECT_VERIFIES(v_v, WASM_TRY_OP, kExprCatch, kExprDrop, kExprEnd);
- EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprCatch, kExprCatch, kExprEnd);
- EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprEnd); // Missing catch.
- EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprCatch); // Missing end.
- EXPECT_FAILURE(v_v, kExprCatch, kExprEnd); // Missing try.
+ ExpectValidates(sigs.v_v(), {WASM_TRY_OP, kExprCatch, kExprDrop, kExprEnd});
+ ExpectFailure(sigs.v_v(), {WASM_TRY_OP, kExprCatch, kExprCatch, kExprEnd});
+ ExpectFailure(sigs.v_v(), {WASM_TRY_OP, kExprEnd}); // Missing catch.
+ ExpectFailure(sigs.v_v(), {WASM_TRY_OP, kExprCatch}); // Missing end.
+ ExpectFailure(sigs.v_v(), {kExprCatch, kExprEnd}); // Missing try.
}
TEST_F(FunctionBodyDecoderTest, Rethrow) {
WASM_FEATURE_SCOPE(eh);
TestModuleBuilder builder;
module = builder.module();
- EXPECT_VERIFIES(v_v, WASM_TRY_OP, kExprCatch, kExprRethrow, kExprEnd);
- EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprRethrow, kExprCatch, kExprEnd);
- EXPECT_FAILURE(v_v, WASM_BLOCK(kExprRethrow));
- EXPECT_FAILURE(v_v, kExprRethrow);
+ ExpectValidates(sigs.v_v(),
+ {WASM_TRY_OP, kExprCatch, kExprRethrow, kExprEnd});
+ ExpectFailure(sigs.v_v(), {WASM_TRY_OP, kExprRethrow, kExprCatch, kExprEnd});
+ ExpectFailure(sigs.v_v(), {WASM_BLOCK(kExprRethrow)});
+ ExpectFailure(sigs.v_v(), {kExprRethrow});
}
TEST_F(FunctionBodyDecoderTest, BrOnExn) {
@@ -2475,23 +2742,24 @@ TEST_F(FunctionBodyDecoderTest, BrOnExn) {
module = builder.module();
byte ex1 = builder.AddException(sigs.v_v());
byte ex2 = builder.AddException(sigs.v_i());
- EXPECT_VERIFIES(v_v, WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(0, ex1),
- kExprDrop, kExprEnd);
- EXPECT_VERIFIES(v_v, WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(1, ex1),
- kExprDrop, kExprEnd);
- EXPECT_VERIFIES(v_v, WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(0, ex1),
- WASM_BR_ON_EXN(0, ex1), kExprDrop, kExprEnd);
- EXPECT_VERIFIES(v_v, WASM_BLOCK(WASM_TRY_OP, kExprCatch,
- WASM_BR_ON_EXN(1, ex1), kExprDrop, kExprEnd));
- EXPECT_VERIFIES(i_v,
- WASM_BLOCK_I(WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(1, ex2),
- kExprDrop, kExprEnd, kExprI32Const, 0));
- EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(2, ex1),
- kExprDrop, kExprEnd);
- EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprCatch, kExprDrop,
- WASM_BR_ON_EXN(0, ex1), kExprEnd);
- EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(0, ex1),
- kExprEnd);
+ ExpectValidates(sigs.v_v(), {WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(0, ex1),
+ kExprDrop, kExprEnd});
+ ExpectValidates(sigs.v_v(), {WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(1, ex1),
+ kExprDrop, kExprEnd});
+ ExpectValidates(sigs.v_v(), {WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(0, ex1),
+ WASM_BR_ON_EXN(0, ex1), kExprDrop, kExprEnd});
+ ExpectValidates(sigs.v_v(),
+ {WASM_BLOCK(WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(1, ex1),
+ kExprDrop, kExprEnd)});
+ ExpectValidates(sigs.i_v(),
+ {WASM_BLOCK_I(WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(1, ex2),
+ kExprDrop, kExprEnd, kExprI32Const, 0)});
+ ExpectFailure(sigs.v_v(), {WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(2, ex1),
+ kExprDrop, kExprEnd});
+ ExpectFailure(sigs.v_v(), {WASM_TRY_OP, kExprCatch, kExprDrop,
+ WASM_BR_ON_EXN(0, ex1), kExprEnd});
+ ExpectFailure(sigs.v_v(),
+ {WASM_TRY_OP, kExprCatch, WASM_BR_ON_EXN(0, ex1), kExprEnd});
}
#undef WASM_BR_ON_EXN
@@ -2502,15 +2770,19 @@ TEST_F(FunctionBodyDecoderTest, MultiValBlock1) {
TestModuleBuilder builder;
module = builder.module();
byte f0 = builder.AddSignature(sigs.ii_v());
- EXPECT_VERIFIES(i_ii, WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- kExprI32Add);
- EXPECT_FAILURE(i_ii, WASM_BLOCK_X(f0, WASM_NOP), kExprI32Add);
- EXPECT_FAILURE(i_ii, WASM_BLOCK_X(f0, WASM_GET_LOCAL(0)), kExprI32Add);
- EXPECT_FAILURE(i_ii, WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_GET_LOCAL(0)),
- kExprI32Add);
- EXPECT_FAILURE(i_ii, WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- kExprF32Add);
+ ExpectValidates(
+ sigs.i_ii(),
+ {WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), kExprI32Add});
+ ExpectFailure(sigs.i_ii(), {WASM_BLOCK_X(f0, WASM_NOP), kExprI32Add});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_BLOCK_X(f0, WASM_GET_LOCAL(0)), kExprI32Add});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_GET_LOCAL(0)),
+ kExprI32Add});
+ ExpectFailure(
+ sigs.i_ii(),
+ {WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), kExprF32Add});
}
TEST_F(FunctionBodyDecoderTest, MultiValBlock2) {
@@ -2518,17 +2790,20 @@ TEST_F(FunctionBodyDecoderTest, MultiValBlock2) {
TestModuleBuilder builder;
module = builder.module();
byte f0 = builder.AddSignature(sigs.ii_v());
- EXPECT_VERIFIES(i_ii, WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- WASM_I32_ADD(WASM_NOP, WASM_NOP));
- EXPECT_FAILURE(i_ii, WASM_BLOCK_X(f0, WASM_NOP),
- WASM_I32_ADD(WASM_NOP, WASM_NOP));
- EXPECT_FAILURE(i_ii, WASM_BLOCK_X(f0, WASM_GET_LOCAL(0)),
- WASM_I32_ADD(WASM_NOP, WASM_NOP));
- EXPECT_FAILURE(i_ii, WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_GET_LOCAL(0)),
- WASM_I32_ADD(WASM_NOP, WASM_NOP));
- EXPECT_FAILURE(i_ii, WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- WASM_F32_ADD(WASM_NOP, WASM_NOP));
+ ExpectValidates(sigs.i_ii(),
+ {WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
+ WASM_I32_ADD(WASM_NOP, WASM_NOP)});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_BLOCK_X(f0, WASM_NOP), WASM_I32_ADD(WASM_NOP, WASM_NOP)});
+ ExpectFailure(sigs.i_ii(), {WASM_BLOCK_X(f0, WASM_GET_LOCAL(0)),
+ WASM_I32_ADD(WASM_NOP, WASM_NOP)});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_GET_LOCAL(0)),
+ WASM_I32_ADD(WASM_NOP, WASM_NOP)});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
+ WASM_F32_ADD(WASM_NOP, WASM_NOP)});
}
TEST_F(FunctionBodyDecoderTest, MultiValBlockBr) {
@@ -2536,11 +2811,11 @@ TEST_F(FunctionBodyDecoderTest, MultiValBlockBr) {
TestModuleBuilder builder;
module = builder.module();
byte f0 = builder.AddSignature(sigs.ii_v());
- EXPECT_FAILURE(i_ii, WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_BR(0)),
- kExprI32Add);
- EXPECT_VERIFIES(i_ii, WASM_BLOCK_X(f0, WASM_GET_LOCAL(0),
- WASM_GET_LOCAL(1), WASM_BR(0)),
- kExprI32Add);
+ ExpectFailure(sigs.i_ii(),
+ {WASM_BLOCK_X(f0, WASM_GET_LOCAL(0), WASM_BR(0)), kExprI32Add});
+ ExpectValidates(sigs.i_ii(), {WASM_BLOCK_X(f0, WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(1), WASM_BR(0)),
+ kExprI32Add});
}
TEST_F(FunctionBodyDecoderTest, MultiValLoop1) {
@@ -2548,15 +2823,17 @@ TEST_F(FunctionBodyDecoderTest, MultiValLoop1) {
TestModuleBuilder builder;
module = builder.module();
byte f0 = builder.AddSignature(sigs.ii_v());
- EXPECT_VERIFIES(i_ii, WASM_LOOP_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- kExprI32Add);
- EXPECT_FAILURE(i_ii, WASM_LOOP_X(f0, WASM_NOP), kExprI32Add);
- EXPECT_FAILURE(i_ii, WASM_LOOP_X(f0, WASM_GET_LOCAL(0)), kExprI32Add);
- EXPECT_FAILURE(i_ii, WASM_LOOP_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_GET_LOCAL(0)),
- kExprI32Add);
- EXPECT_FAILURE(i_ii, WASM_LOOP_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- kExprF32Add);
+ ExpectValidates(
+ sigs.i_ii(),
+ {WASM_LOOP_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), kExprI32Add});
+ ExpectFailure(sigs.i_ii(), {WASM_LOOP_X(f0, WASM_NOP), kExprI32Add});
+ ExpectFailure(sigs.i_ii(), {WASM_LOOP_X(f0, WASM_GET_LOCAL(0)), kExprI32Add});
+ ExpectFailure(sigs.i_ii(), {WASM_LOOP_X(f0, WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(1), WASM_GET_LOCAL(0)),
+ kExprI32Add});
+ ExpectFailure(
+ sigs.i_ii(),
+ {WASM_LOOP_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), kExprF32Add});
}
TEST_F(FunctionBodyDecoderTest, MultiValIf) {
@@ -2564,62 +2841,61 @@ TEST_F(FunctionBodyDecoderTest, MultiValIf) {
TestModuleBuilder builder;
module = builder.module();
byte f0 = builder.AddSignature(sigs.ii_v());
- EXPECT_VERIFIES(
- i_ii, WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
- WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))),
- kExprI32Add);
- EXPECT_FAILURE(
- i_ii, WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP),
- kExprI32Add);
- EXPECT_FAILURE(
- i_ii, WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
- WASM_NOP,
- WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))),
- kExprI32Add);
- EXPECT_FAILURE(
- i_ii, WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
- WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- WASM_NOP),
- kExprI32Add);
- EXPECT_FAILURE(
- i_ii, WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
- WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- kExprI32Add);
- EXPECT_FAILURE(
- i_ii, WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
- WASM_GET_LOCAL(0),
- WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))),
- kExprI32Add);
- EXPECT_FAILURE(
- i_ii, WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
- WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- WASM_GET_LOCAL(1)),
- kExprI32Add);
- EXPECT_FAILURE(
- i_ii, WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
- WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
- WASM_GET_LOCAL(0)),
- WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0),
- WASM_GET_LOCAL(0))),
- kExprI32Add);
- EXPECT_FAILURE(
- i_ii, WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
- WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
- WASM_GET_LOCAL(0)),
- WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))),
- kExprI32Add);
- EXPECT_FAILURE(
- i_ii, WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
- WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(1),
- WASM_GET_LOCAL(1))),
- kExprI32Add);
- EXPECT_FAILURE(
- i_ii, WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
- WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
- WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))),
- kExprF32Add);
+ ExpectValidates(
+ sigs.i_ii(),
+ {WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
+ WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
+ WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))),
+ kExprI32Add});
+ ExpectFailure(
+ sigs.i_ii(),
+ {WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP), kExprI32Add});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0), WASM_NOP,
+ WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))),
+ kExprI32Add});
+ ExpectFailure(
+ sigs.i_ii(),
+ {WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
+ WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_NOP),
+ kExprI32Add});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(1)),
+ kExprI32Add});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
+ WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))),
+ kExprI32Add});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
+ WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
+ WASM_GET_LOCAL(1)),
+ kExprI32Add});
+ ExpectFailure(
+ sigs.i_ii(),
+ {WASM_IF_ELSE_X(
+ f0, WASM_GET_LOCAL(0),
+ WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)),
+ WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))),
+ kExprI32Add});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
+ WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0),
+ WASM_GET_LOCAL(0)),
+ WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))),
+ kExprI32Add});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
+ WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
+ WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(1),
+ WASM_GET_LOCAL(1))),
+ kExprI32Add});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_IF_ELSE_X(f0, WASM_GET_LOCAL(0),
+ WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
+ WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))),
+ kExprF32Add});
}
TEST_F(FunctionBodyDecoderTest, BlockParam) {
@@ -2628,24 +2904,27 @@ TEST_F(FunctionBodyDecoderTest, BlockParam) {
module = builder.module();
byte f1 = builder.AddSignature(sigs.i_i());
byte f2 = builder.AddSignature(sigs.i_ii());
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0),
- WASM_BLOCK_X(f1, WASM_GET_LOCAL(1),
- WASM_I32_ADD(WASM_NOP, WASM_NOP)));
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_BLOCK_X(f2, WASM_I32_ADD(WASM_NOP, WASM_NOP)));
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_BLOCK_X(f1, WASM_NOP),
- WASM_I32_ADD(WASM_NOP, WASM_NOP));
- EXPECT_FAILURE(i_ii, WASM_BLOCK_X(f1, WASM_NOP),
- WASM_RETURN1(WASM_GET_LOCAL(0)));
- EXPECT_FAILURE(i_ii, WASM_BLOCK_X(f1, WASM_GET_LOCAL(0)),
- WASM_RETURN1(WASM_GET_LOCAL(0)));
- EXPECT_FAILURE(i_ii, WASM_GET_LOCAL(0),
- WASM_BLOCK_X(f2, WASM_I32_ADD(WASM_NOP, WASM_NOP)),
- WASM_RETURN1(WASM_GET_LOCAL(0)));
- EXPECT_FAILURE(i_ii, WASM_GET_LOCAL(0),
- WASM_BLOCK_X(f1, WASM_F32_NEG(WASM_NOP)),
- WASM_RETURN1(WASM_GET_LOCAL(0)));
+ ExpectValidates(
+ sigs.i_ii(),
+ {WASM_GET_LOCAL(0),
+ WASM_BLOCK_X(f1, WASM_GET_LOCAL(1), WASM_I32_ADD(WASM_NOP, WASM_NOP))});
+ ExpectValidates(sigs.i_ii(),
+ {WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_BLOCK_X(f2, WASM_I32_ADD(WASM_NOP, WASM_NOP))});
+ ExpectValidates(sigs.i_ii(), {WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_BLOCK_X(f1, WASM_NOP),
+ WASM_I32_ADD(WASM_NOP, WASM_NOP)});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_BLOCK_X(f1, WASM_NOP), WASM_RETURN1(WASM_GET_LOCAL(0))});
+ ExpectFailure(sigs.i_ii(), {WASM_BLOCK_X(f1, WASM_GET_LOCAL(0)),
+ WASM_RETURN1(WASM_GET_LOCAL(0))});
+ ExpectFailure(
+ sigs.i_ii(),
+ {WASM_GET_LOCAL(0), WASM_BLOCK_X(f2, WASM_I32_ADD(WASM_NOP, WASM_NOP)),
+ WASM_RETURN1(WASM_GET_LOCAL(0))});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_GET_LOCAL(0), WASM_BLOCK_X(f1, WASM_F32_NEG(WASM_NOP)),
+ WASM_RETURN1(WASM_GET_LOCAL(0))});
}
TEST_F(FunctionBodyDecoderTest, LoopParam) {
@@ -2654,24 +2933,25 @@ TEST_F(FunctionBodyDecoderTest, LoopParam) {
module = builder.module();
byte f1 = builder.AddSignature(sigs.i_i());
byte f2 = builder.AddSignature(sigs.i_ii());
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0),
- WASM_LOOP_X(f1, WASM_GET_LOCAL(1),
- WASM_I32_ADD(WASM_NOP, WASM_NOP)));
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_LOOP_X(f2, WASM_I32_ADD(WASM_NOP, WASM_NOP)));
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_LOOP_X(f1, WASM_NOP),
- WASM_I32_ADD(WASM_NOP, WASM_NOP));
- EXPECT_FAILURE(i_ii, WASM_LOOP_X(f1, WASM_NOP),
- WASM_RETURN1(WASM_GET_LOCAL(0)));
- EXPECT_FAILURE(i_ii, WASM_LOOP_X(f1, WASM_GET_LOCAL(0)),
- WASM_RETURN1(WASM_GET_LOCAL(0)));
- EXPECT_FAILURE(i_ii, WASM_GET_LOCAL(0),
- WASM_LOOP_X(f2, WASM_I32_ADD(WASM_NOP, WASM_NOP)),
- WASM_RETURN1(WASM_GET_LOCAL(0)));
- EXPECT_FAILURE(i_ii, WASM_GET_LOCAL(0),
- WASM_LOOP_X(f1, WASM_F32_NEG(WASM_NOP)),
- WASM_RETURN1(WASM_GET_LOCAL(0)));
+ ExpectValidates(sigs.i_ii(), {WASM_GET_LOCAL(0),
+ WASM_LOOP_X(f1, WASM_GET_LOCAL(1),
+ WASM_I32_ADD(WASM_NOP, WASM_NOP))});
+ ExpectValidates(sigs.i_ii(),
+ {WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_LOOP_X(f2, WASM_I32_ADD(WASM_NOP, WASM_NOP))});
+ ExpectValidates(sigs.i_ii(), {WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_LOOP_X(f1, WASM_NOP),
+ WASM_I32_ADD(WASM_NOP, WASM_NOP)});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_LOOP_X(f1, WASM_NOP), WASM_RETURN1(WASM_GET_LOCAL(0))});
+ ExpectFailure(sigs.i_ii(), {WASM_LOOP_X(f1, WASM_GET_LOCAL(0)),
+ WASM_RETURN1(WASM_GET_LOCAL(0))});
+ ExpectFailure(sigs.i_ii(), {WASM_GET_LOCAL(0),
+ WASM_LOOP_X(f2, WASM_I32_ADD(WASM_NOP, WASM_NOP)),
+ WASM_RETURN1(WASM_GET_LOCAL(0))});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_GET_LOCAL(0), WASM_LOOP_X(f1, WASM_F32_NEG(WASM_NOP)),
+ WASM_RETURN1(WASM_GET_LOCAL(0))});
}
TEST_F(FunctionBodyDecoderTest, LoopParamBr) {
@@ -2680,20 +2960,21 @@ TEST_F(FunctionBodyDecoderTest, LoopParamBr) {
module = builder.module();
byte f1 = builder.AddSignature(sigs.i_i());
byte f2 = builder.AddSignature(sigs.i_ii());
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0),
- WASM_LOOP_X(f1, WASM_BR(0)));
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0),
- WASM_LOOP_X(f1, WASM_BRV(0, WASM_GET_LOCAL(1))));
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_LOOP_X(f2, WASM_BR(0)));
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0),
- WASM_LOOP_X(f1, WASM_BLOCK_X(f1, WASM_BR(1))));
- EXPECT_FAILURE(i_ii, WASM_GET_LOCAL(0),
- WASM_LOOP_X(f1, WASM_BLOCK(WASM_BR(1))),
- WASM_RETURN1(WASM_GET_LOCAL(0)));
- EXPECT_FAILURE(i_ii, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_LOOP_X(f2, WASM_BLOCK_X(f1, WASM_BR(1))),
- WASM_RETURN1(WASM_GET_LOCAL(0)));
+ ExpectValidates(sigs.i_ii(),
+ {WASM_GET_LOCAL(0), WASM_LOOP_X(f1, WASM_BR(0))});
+ ExpectValidates(
+ sigs.i_ii(),
+ {WASM_GET_LOCAL(0), WASM_LOOP_X(f1, WASM_BRV(0, WASM_GET_LOCAL(1)))});
+ ExpectValidates(sigs.i_ii(), {WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_LOOP_X(f2, WASM_BR(0))});
+ ExpectValidates(sigs.i_ii(), {WASM_GET_LOCAL(0),
+ WASM_LOOP_X(f1, WASM_BLOCK_X(f1, WASM_BR(1)))});
+ ExpectFailure(sigs.i_ii(),
+ {WASM_GET_LOCAL(0), WASM_LOOP_X(f1, WASM_BLOCK(WASM_BR(1))),
+ WASM_RETURN1(WASM_GET_LOCAL(0))});
+ ExpectFailure(sigs.i_ii(), {WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_LOOP_X(f2, WASM_BLOCK_X(f1, WASM_BR(1))),
+ WASM_RETURN1(WASM_GET_LOCAL(0))});
}
TEST_F(FunctionBodyDecoderTest, IfParam) {
@@ -2702,29 +2983,32 @@ TEST_F(FunctionBodyDecoderTest, IfParam) {
module = builder.module();
byte f1 = builder.AddSignature(sigs.i_i());
byte f2 = builder.AddSignature(sigs.i_ii());
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0),
- WASM_IF_X(f1, WASM_GET_LOCAL(0),
- WASM_I32_ADD(WASM_NOP, WASM_GET_LOCAL(1))));
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0),
- WASM_IF_ELSE_X(f1, WASM_GET_LOCAL(0),
- WASM_I32_ADD(WASM_NOP, WASM_GET_LOCAL(1)),
- WASM_I32_EQZ(WASM_NOP)));
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_IF_ELSE_X(f2, WASM_GET_LOCAL(0),
- WASM_I32_ADD(WASM_NOP, WASM_NOP),
- WASM_I32_MUL(WASM_NOP, WASM_NOP)));
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_IF_X(f1, WASM_GET_LOCAL(0), WASM_NOP),
- WASM_I32_ADD(WASM_NOP, WASM_NOP));
- EXPECT_VERIFIES(i_ii, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
- WASM_IF_ELSE_X(f1, WASM_GET_LOCAL(0),
- WASM_NOP, WASM_I32_EQZ(WASM_NOP)),
- WASM_I32_ADD(WASM_NOP, WASM_NOP));
+ ExpectValidates(sigs.i_ii(),
+ {WASM_GET_LOCAL(0),
+ WASM_IF_X(f1, WASM_GET_LOCAL(0),
+ WASM_I32_ADD(WASM_NOP, WASM_GET_LOCAL(1)))});
+ ExpectValidates(sigs.i_ii(),
+ {WASM_GET_LOCAL(0),
+ WASM_IF_ELSE_X(f1, WASM_GET_LOCAL(0),
+ WASM_I32_ADD(WASM_NOP, WASM_GET_LOCAL(1)),
+ WASM_I32_EQZ(WASM_NOP))});
+ ExpectValidates(
+ sigs.i_ii(),
+ {WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_IF_ELSE_X(f2, WASM_GET_LOCAL(0), WASM_I32_ADD(WASM_NOP, WASM_NOP),
+ WASM_I32_MUL(WASM_NOP, WASM_NOP))});
+ ExpectValidates(sigs.i_ii(), {WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_IF_X(f1, WASM_GET_LOCAL(0), WASM_NOP),
+ WASM_I32_ADD(WASM_NOP, WASM_NOP)});
+ ExpectValidates(sigs.i_ii(), {WASM_GET_LOCAL(0), WASM_GET_LOCAL(1),
+ WASM_IF_ELSE_X(f1, WASM_GET_LOCAL(0), WASM_NOP,
+ WASM_I32_EQZ(WASM_NOP)),
+ WASM_I32_ADD(WASM_NOP, WASM_NOP)});
}
TEST_F(FunctionBodyDecoderTest, Regression709741) {
AddLocals(kWasmI32, kV8MaxWasmFunctionLocals - 1);
- EXPECT_VERIFIES(v_v, WASM_NOP);
+ ExpectValidates(sigs.v_v(), {WASM_NOP});
byte code[] = {WASM_NOP, WASM_END};
for (size_t i = 0; i < arraysize(code); ++i) {
@@ -2746,10 +3030,13 @@ TEST_F(FunctionBodyDecoderTest, MemoryInit) {
builder.SetDataSegmentCount(1);
module = builder.module();
- EXPECT_FAILURE(v_v, WASM_MEMORY_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.v_v(),
+ {WASM_MEMORY_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO)});
WASM_FEATURE_SCOPE(bulk_memory);
- EXPECT_VERIFIES(v_v, WASM_MEMORY_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO));
- EXPECT_FAILURE(v_v, WASM_TABLE_INIT(1, WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectValidates(sigs.v_v(),
+ {WASM_MEMORY_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO)});
+ ExpectFailure(sigs.v_v(),
+ {WASM_TABLE_INIT(1, WASM_ZERO, WASM_ZERO, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, MemoryInitInvalid) {
@@ -2762,20 +3049,20 @@ TEST_F(FunctionBodyDecoderTest, MemoryInitInvalid) {
byte code[] = {WASM_MEMORY_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO),
WASM_END};
for (size_t i = 0; i <= arraysize(code); ++i) {
- Verify(i == arraysize(code), sigs.v_v(), {code, i}, kOmitEnd);
+ Validate(i == arraysize(code), sigs.v_v(), VectorOf(code, i), kOmitEnd);
}
}
-TEST_F(FunctionBodyDecoderTest, MemoryDrop) {
+TEST_F(FunctionBodyDecoderTest, DataDrop) {
TestModuleBuilder builder;
builder.InitializeMemory();
builder.SetDataSegmentCount(1);
module = builder.module();
- EXPECT_FAILURE(v_v, WASM_MEMORY_DROP(0));
+ ExpectFailure(sigs.v_v(), {WASM_DATA_DROP(0)});
WASM_FEATURE_SCOPE(bulk_memory);
- EXPECT_VERIFIES(v_v, WASM_MEMORY_DROP(0));
- EXPECT_FAILURE(v_v, WASM_MEMORY_DROP(1));
+ ExpectValidates(sigs.v_v(), {WASM_DATA_DROP(0)});
+ ExpectFailure(sigs.v_v(), {WASM_DATA_DROP(1)});
}
TEST_F(FunctionBodyDecoderTest, MemoryCopy) {
@@ -2783,9 +3070,11 @@ TEST_F(FunctionBodyDecoderTest, MemoryCopy) {
builder.InitializeMemory();
module = builder.module();
- EXPECT_FAILURE(v_v, WASM_MEMORY_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.v_v(),
+ {WASM_MEMORY_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO)});
WASM_FEATURE_SCOPE(bulk_memory);
- EXPECT_VERIFIES(v_v, WASM_MEMORY_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectValidates(sigs.v_v(),
+ {WASM_MEMORY_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, MemoryFill) {
@@ -2793,16 +3082,21 @@ TEST_F(FunctionBodyDecoderTest, MemoryFill) {
builder.InitializeMemory();
module = builder.module();
- EXPECT_FAILURE(v_v, WASM_MEMORY_FILL(WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.v_v(),
+ {WASM_MEMORY_FILL(WASM_ZERO, WASM_ZERO, WASM_ZERO)});
WASM_FEATURE_SCOPE(bulk_memory);
- EXPECT_VERIFIES(v_v, WASM_MEMORY_FILL(WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectValidates(sigs.v_v(),
+ {WASM_MEMORY_FILL(WASM_ZERO, WASM_ZERO, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, BulkMemoryOpsWithoutMemory) {
WASM_FEATURE_SCOPE(bulk_memory);
- EXPECT_FAILURE(v_v, WASM_MEMORY_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO));
- EXPECT_FAILURE(v_v, WASM_MEMORY_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO));
- EXPECT_FAILURE(v_v, WASM_MEMORY_FILL(WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.v_v(),
+ {WASM_MEMORY_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO)});
+ ExpectFailure(sigs.v_v(),
+ {WASM_MEMORY_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO)});
+ ExpectFailure(sigs.v_v(),
+ {WASM_MEMORY_FILL(WASM_ZERO, WASM_ZERO, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, TableInit) {
@@ -2811,10 +3105,13 @@ TEST_F(FunctionBodyDecoderTest, TableInit) {
builder.AddPassiveElementSegment();
module = builder.module();
- EXPECT_FAILURE(v_v, WASM_TABLE_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.v_v(),
+ {WASM_TABLE_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO)});
WASM_FEATURE_SCOPE(bulk_memory);
- EXPECT_VERIFIES(v_v, WASM_TABLE_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO));
- EXPECT_FAILURE(v_v, WASM_TABLE_INIT(1, WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectValidates(sigs.v_v(),
+ {WASM_TABLE_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO)});
+ ExpectFailure(sigs.v_v(),
+ {WASM_TABLE_INIT(1, WASM_ZERO, WASM_ZERO, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, TableInitInvalid) {
@@ -2826,20 +3123,20 @@ TEST_F(FunctionBodyDecoderTest, TableInitInvalid) {
WASM_FEATURE_SCOPE(bulk_memory);
byte code[] = {WASM_TABLE_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO), WASM_END};
for (size_t i = 0; i <= arraysize(code); ++i) {
- Verify(i == arraysize(code), sigs.v_v(), {code, i}, kOmitEnd);
+ Validate(i == arraysize(code), sigs.v_v(), VectorOf(code, i), kOmitEnd);
}
}
-TEST_F(FunctionBodyDecoderTest, TableDrop) {
+TEST_F(FunctionBodyDecoderTest, ElemDrop) {
TestModuleBuilder builder;
builder.InitializeTable();
builder.AddPassiveElementSegment();
module = builder.module();
- EXPECT_FAILURE(v_v, WASM_TABLE_DROP(0));
+ ExpectFailure(sigs.v_v(), {WASM_ELEM_DROP(0)});
WASM_FEATURE_SCOPE(bulk_memory);
- EXPECT_VERIFIES(v_v, WASM_TABLE_DROP(0));
- EXPECT_FAILURE(v_v, WASM_TABLE_DROP(1));
+ ExpectValidates(sigs.v_v(), {WASM_ELEM_DROP(0)});
+ ExpectFailure(sigs.v_v(), {WASM_ELEM_DROP(1)});
}
TEST_F(FunctionBodyDecoderTest, TableCopy) {
@@ -2847,9 +3144,10 @@ TEST_F(FunctionBodyDecoderTest, TableCopy) {
builder.InitializeTable();
module = builder.module();
- EXPECT_FAILURE(v_v, WASM_TABLE_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.v_v(), {WASM_TABLE_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO)});
WASM_FEATURE_SCOPE(bulk_memory);
- EXPECT_VERIFIES(v_v, WASM_TABLE_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectValidates(sigs.v_v(),
+ {WASM_TABLE_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO)});
}
TEST_F(FunctionBodyDecoderTest, BulkTableOpsWithoutTable) {
@@ -2858,9 +3156,10 @@ TEST_F(FunctionBodyDecoderTest, BulkTableOpsWithoutTable) {
builder.AddPassiveElementSegment();
WASM_FEATURE_SCOPE(bulk_memory);
- EXPECT_FAILURE(v_v, WASM_TABLE_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO));
- EXPECT_FAILURE(v_v, WASM_TABLE_DROP(0));
- EXPECT_FAILURE(v_v, WASM_TABLE_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO));
+ ExpectFailure(sigs.v_v(),
+ {WASM_TABLE_INIT(0, WASM_ZERO, WASM_ZERO, WASM_ZERO)});
+ ExpectFailure(sigs.v_v(), {WASM_ELEM_DROP(0)});
+ ExpectFailure(sigs.v_v(), {WASM_TABLE_COPY(WASM_ZERO, WASM_ZERO, WASM_ZERO)});
}
class BranchTableIteratorTest : public TestWithZone {
@@ -2926,252 +3225,146 @@ TEST_F(BranchTableIteratorTest, error0) {
#undef CHECK_BR_TABLE_LENGTH
#undef CHECK_BR_TABLE_ERROR
+struct PrintOpcodes {
+ const byte* start;
+ const byte* end;
+};
+std::ostream& operator<<(std::ostream& out, const PrintOpcodes& range) {
+ out << "First opcode: \""
+ << WasmOpcodes::OpcodeName(static_cast<WasmOpcode>(*range.start))
+ << "\"\nall bytes: [";
+ for (const byte* b = range.start; b < range.end; ++b) {
+ out << (b == range.start ? "" : ", ") << uint32_t{*b} << "/"
+ << AsHex(*b, 2, true);
+ }
+ return out << "]";
+}
+
class WasmOpcodeLengthTest : public TestWithZone {
public:
WasmOpcodeLengthTest() : TestWithZone() {}
-};
-#define EXPECT_LENGTH(expected, opcode) \
- { \
- static const byte code[] = {opcode, 0, 0, 0, 0, 0, 0, 0, 0}; \
- EXPECT_EQ(static_cast<unsigned>(expected), \
- OpcodeLength(code, code + sizeof(code))); \
- }
-
-#define EXPECT_LENGTH_N(expected, ...) \
- { \
- static const byte code[] = {__VA_ARGS__}; \
- EXPECT_EQ(static_cast<unsigned>(expected), \
- OpcodeLength(code, code + sizeof(code))); \
+ template <typename... Bytes>
+ void ExpectLength(unsigned expected, Bytes... bytes) {
+ const byte code[] = {bytes..., 0, 0, 0, 0, 0, 0, 0, 0};
+ EXPECT_EQ(expected, OpcodeLength(code, code + sizeof(code)))
+ << PrintOpcodes{code, code + sizeof...(bytes)};
}
+};
TEST_F(WasmOpcodeLengthTest, Statements) {
- EXPECT_LENGTH(1, kExprNop);
- EXPECT_LENGTH(1, kExprElse);
- EXPECT_LENGTH(1, kExprEnd);
- EXPECT_LENGTH(1, kExprSelect);
- EXPECT_LENGTH(1, kExprCatch);
- EXPECT_LENGTH(1, kExprRethrow);
- EXPECT_LENGTH(2, kExprBr);
- EXPECT_LENGTH(2, kExprBrIf);
- EXPECT_LENGTH(2, kExprThrow);
- EXPECT_LENGTH(3, kExprBrOnExn);
- EXPECT_LENGTH_N(2, kExprBlock, kLocalI32);
- EXPECT_LENGTH_N(2, kExprLoop, kLocalI32);
- EXPECT_LENGTH_N(2, kExprIf, kLocalI32);
- EXPECT_LENGTH_N(2, kExprTry, kLocalI32);
+ ExpectLength(1, kExprNop);
+ ExpectLength(1, kExprElse);
+ ExpectLength(1, kExprEnd);
+ ExpectLength(1, kExprSelect);
+ ExpectLength(1, kExprCatch);
+ ExpectLength(1, kExprRethrow);
+ ExpectLength(2, kExprBr);
+ ExpectLength(2, kExprBrIf);
+ ExpectLength(2, kExprThrow);
+ ExpectLength(3, kExprBrOnExn);
+ ExpectLength(2, kExprBlock, kLocalI32);
+ ExpectLength(2, kExprLoop, kLocalI32);
+ ExpectLength(2, kExprIf, kLocalI32);
+ ExpectLength(2, kExprTry, kLocalI32);
}
TEST_F(WasmOpcodeLengthTest, MiscExpressions) {
- EXPECT_LENGTH(5, kExprF32Const);
- EXPECT_LENGTH(9, kExprF64Const);
- EXPECT_LENGTH(1, kExprRefNull);
- EXPECT_LENGTH(2, kExprGetLocal);
- EXPECT_LENGTH(2, kExprSetLocal);
- EXPECT_LENGTH(2, kExprGetGlobal);
- EXPECT_LENGTH(2, kExprSetGlobal);
- EXPECT_LENGTH(2, kExprCallFunction);
- EXPECT_LENGTH(3, kExprCallIndirect);
+ ExpectLength(5, kExprF32Const);
+ ExpectLength(9, kExprF64Const);
+ ExpectLength(1, kExprRefNull);
+ ExpectLength(2, kExprGetLocal);
+ ExpectLength(2, kExprSetLocal);
+ ExpectLength(2, kExprGetGlobal);
+ ExpectLength(2, kExprSetGlobal);
+ ExpectLength(2, kExprCallFunction);
+ ExpectLength(3, kExprCallIndirect);
}
TEST_F(WasmOpcodeLengthTest, I32Const) {
- EXPECT_LENGTH_N(2, kExprI32Const, U32V_1(1));
- EXPECT_LENGTH_N(3, kExprI32Const, U32V_2(999));
- EXPECT_LENGTH_N(4, kExprI32Const, U32V_3(9999));
- EXPECT_LENGTH_N(5, kExprI32Const, U32V_4(999999));
- EXPECT_LENGTH_N(6, kExprI32Const, U32V_5(99999999));
+ ExpectLength(2, kExprI32Const, U32V_1(1));
+ ExpectLength(3, kExprI32Const, U32V_2(999));
+ ExpectLength(4, kExprI32Const, U32V_3(9999));
+ ExpectLength(5, kExprI32Const, U32V_4(999999));
+ ExpectLength(6, kExprI32Const, U32V_5(99999999));
}
TEST_F(WasmOpcodeLengthTest, I64Const) {
- EXPECT_LENGTH_N(2, kExprI64Const, U32V_1(1));
- EXPECT_LENGTH_N(3, kExprI64Const, U32V_2(99));
- EXPECT_LENGTH_N(4, kExprI64Const, U32V_3(9999));
- EXPECT_LENGTH_N(5, kExprI64Const, U32V_4(99999));
- EXPECT_LENGTH_N(6, kExprI64Const, U32V_5(9999999));
- EXPECT_LENGTH_N(7, WASM_I64V_6(777777));
- EXPECT_LENGTH_N(8, WASM_I64V_7(7777777));
- EXPECT_LENGTH_N(9, WASM_I64V_8(77777777));
- EXPECT_LENGTH_N(10, WASM_I64V_9(777777777));
+ ExpectLength(2, kExprI64Const, U32V_1(1));
+ ExpectLength(3, kExprI64Const, U32V_2(99));
+ ExpectLength(4, kExprI64Const, U32V_3(9999));
+ ExpectLength(5, kExprI64Const, U32V_4(99999));
+ ExpectLength(6, kExprI64Const, U32V_5(9999999));
+ ExpectLength(7, WASM_I64V_6(777777));
+ ExpectLength(8, WASM_I64V_7(7777777));
+ ExpectLength(9, WASM_I64V_8(77777777));
+ ExpectLength(10, WASM_I64V_9(777777777));
}
TEST_F(WasmOpcodeLengthTest, VariableLength) {
- EXPECT_LENGTH_N(2, kExprGetGlobal, U32V_1(1));
- EXPECT_LENGTH_N(3, kExprGetGlobal, U32V_2(33));
- EXPECT_LENGTH_N(4, kExprGetGlobal, U32V_3(44));
- EXPECT_LENGTH_N(5, kExprGetGlobal, U32V_4(66));
- EXPECT_LENGTH_N(6, kExprGetGlobal, U32V_5(77));
+ ExpectLength(2, kExprGetGlobal, U32V_1(1));
+ ExpectLength(3, kExprGetGlobal, U32V_2(33));
+ ExpectLength(4, kExprGetGlobal, U32V_3(44));
+ ExpectLength(5, kExprGetGlobal, U32V_4(66));
+ ExpectLength(6, kExprGetGlobal, U32V_5(77));
}
TEST_F(WasmOpcodeLengthTest, LoadsAndStores) {
- EXPECT_LENGTH(3, kExprI32LoadMem8S);
- EXPECT_LENGTH(3, kExprI32LoadMem8U);
- EXPECT_LENGTH(3, kExprI32LoadMem16S);
- EXPECT_LENGTH(3, kExprI32LoadMem16U);
- EXPECT_LENGTH(3, kExprI32LoadMem);
- EXPECT_LENGTH(3, kExprI64LoadMem8S);
- EXPECT_LENGTH(3, kExprI64LoadMem8U);
- EXPECT_LENGTH(3, kExprI64LoadMem16S);
- EXPECT_LENGTH(3, kExprI64LoadMem16U);
- EXPECT_LENGTH(3, kExprI64LoadMem32S);
- EXPECT_LENGTH(3, kExprI64LoadMem32U);
- EXPECT_LENGTH(3, kExprI64LoadMem);
- EXPECT_LENGTH(3, kExprF32LoadMem);
- EXPECT_LENGTH(3, kExprF64LoadMem);
-
- EXPECT_LENGTH(3, kExprI32StoreMem8);
- EXPECT_LENGTH(3, kExprI32StoreMem16);
- EXPECT_LENGTH(3, kExprI32StoreMem);
- EXPECT_LENGTH(3, kExprI64StoreMem8);
- EXPECT_LENGTH(3, kExprI64StoreMem16);
- EXPECT_LENGTH(3, kExprI64StoreMem32);
- EXPECT_LENGTH(3, kExprI64StoreMem);
- EXPECT_LENGTH(3, kExprF32StoreMem);
- EXPECT_LENGTH(3, kExprF64StoreMem);
+ ExpectLength(3, kExprI32LoadMem8S);
+ ExpectLength(3, kExprI32LoadMem8U);
+ ExpectLength(3, kExprI32LoadMem16S);
+ ExpectLength(3, kExprI32LoadMem16U);
+ ExpectLength(3, kExprI32LoadMem);
+ ExpectLength(3, kExprI64LoadMem8S);
+ ExpectLength(3, kExprI64LoadMem8U);
+ ExpectLength(3, kExprI64LoadMem16S);
+ ExpectLength(3, kExprI64LoadMem16U);
+ ExpectLength(3, kExprI64LoadMem32S);
+ ExpectLength(3, kExprI64LoadMem32U);
+ ExpectLength(3, kExprI64LoadMem);
+ ExpectLength(3, kExprF32LoadMem);
+ ExpectLength(3, kExprF64LoadMem);
+
+ ExpectLength(3, kExprI32StoreMem8);
+ ExpectLength(3, kExprI32StoreMem16);
+ ExpectLength(3, kExprI32StoreMem);
+ ExpectLength(3, kExprI64StoreMem8);
+ ExpectLength(3, kExprI64StoreMem16);
+ ExpectLength(3, kExprI64StoreMem32);
+ ExpectLength(3, kExprI64StoreMem);
+ ExpectLength(3, kExprF32StoreMem);
+ ExpectLength(3, kExprF64StoreMem);
}
TEST_F(WasmOpcodeLengthTest, MiscMemExpressions) {
- EXPECT_LENGTH(2, kExprMemorySize);
- EXPECT_LENGTH(2, kExprMemoryGrow);
+ ExpectLength(2, kExprMemorySize);
+ ExpectLength(2, kExprMemoryGrow);
}
TEST_F(WasmOpcodeLengthTest, SimpleExpressions) {
- EXPECT_LENGTH(1, kExprI32Add);
- EXPECT_LENGTH(1, kExprI32Sub);
- EXPECT_LENGTH(1, kExprI32Mul);
- EXPECT_LENGTH(1, kExprI32DivS);
- EXPECT_LENGTH(1, kExprI32DivU);
- EXPECT_LENGTH(1, kExprI32RemS);
- EXPECT_LENGTH(1, kExprI32RemU);
- EXPECT_LENGTH(1, kExprI32And);
- EXPECT_LENGTH(1, kExprI32Ior);
- EXPECT_LENGTH(1, kExprI32Xor);
- EXPECT_LENGTH(1, kExprI32Shl);
- EXPECT_LENGTH(1, kExprI32ShrU);
- EXPECT_LENGTH(1, kExprI32ShrS);
- EXPECT_LENGTH(1, kExprI32Eq);
- EXPECT_LENGTH(1, kExprI32Ne);
- EXPECT_LENGTH(1, kExprI32LtS);
- EXPECT_LENGTH(1, kExprI32LeS);
- EXPECT_LENGTH(1, kExprI32LtU);
- EXPECT_LENGTH(1, kExprI32LeU);
- EXPECT_LENGTH(1, kExprI32GtS);
- EXPECT_LENGTH(1, kExprI32GeS);
- EXPECT_LENGTH(1, kExprI32GtU);
- EXPECT_LENGTH(1, kExprI32GeU);
- EXPECT_LENGTH(1, kExprI32Clz);
- EXPECT_LENGTH(1, kExprI32Ctz);
- EXPECT_LENGTH(1, kExprI32Popcnt);
- EXPECT_LENGTH(1, kExprI32Eqz);
- EXPECT_LENGTH(1, kExprI64Add);
- EXPECT_LENGTH(1, kExprI64Sub);
- EXPECT_LENGTH(1, kExprI64Mul);
- EXPECT_LENGTH(1, kExprI64DivS);
- EXPECT_LENGTH(1, kExprI64DivU);
- EXPECT_LENGTH(1, kExprI64RemS);
- EXPECT_LENGTH(1, kExprI64RemU);
- EXPECT_LENGTH(1, kExprI64And);
- EXPECT_LENGTH(1, kExprI64Ior);
- EXPECT_LENGTH(1, kExprI64Xor);
- EXPECT_LENGTH(1, kExprI64Shl);
- EXPECT_LENGTH(1, kExprI64ShrU);
- EXPECT_LENGTH(1, kExprI64ShrS);
- EXPECT_LENGTH(1, kExprI64Eq);
- EXPECT_LENGTH(1, kExprI64Ne);
- EXPECT_LENGTH(1, kExprI64LtS);
- EXPECT_LENGTH(1, kExprI64LeS);
- EXPECT_LENGTH(1, kExprI64LtU);
- EXPECT_LENGTH(1, kExprI64LeU);
- EXPECT_LENGTH(1, kExprI64GtS);
- EXPECT_LENGTH(1, kExprI64GeS);
- EXPECT_LENGTH(1, kExprI64GtU);
- EXPECT_LENGTH(1, kExprI64GeU);
- EXPECT_LENGTH(1, kExprI64Clz);
- EXPECT_LENGTH(1, kExprI64Ctz);
- EXPECT_LENGTH(1, kExprI64Popcnt);
- EXPECT_LENGTH(1, kExprF32Add);
- EXPECT_LENGTH(1, kExprF32Sub);
- EXPECT_LENGTH(1, kExprF32Mul);
- EXPECT_LENGTH(1, kExprF32Div);
- EXPECT_LENGTH(1, kExprF32Min);
- EXPECT_LENGTH(1, kExprF32Max);
- EXPECT_LENGTH(1, kExprF32Abs);
- EXPECT_LENGTH(1, kExprF32Neg);
- EXPECT_LENGTH(1, kExprF32CopySign);
- EXPECT_LENGTH(1, kExprF32Ceil);
- EXPECT_LENGTH(1, kExprF32Floor);
- EXPECT_LENGTH(1, kExprF32Trunc);
- EXPECT_LENGTH(1, kExprF32NearestInt);
- EXPECT_LENGTH(1, kExprF32Sqrt);
- EXPECT_LENGTH(1, kExprF32Eq);
- EXPECT_LENGTH(1, kExprF32Ne);
- EXPECT_LENGTH(1, kExprF32Lt);
- EXPECT_LENGTH(1, kExprF32Le);
- EXPECT_LENGTH(1, kExprF32Gt);
- EXPECT_LENGTH(1, kExprF32Ge);
- EXPECT_LENGTH(1, kExprF64Add);
- EXPECT_LENGTH(1, kExprF64Sub);
- EXPECT_LENGTH(1, kExprF64Mul);
- EXPECT_LENGTH(1, kExprF64Div);
- EXPECT_LENGTH(1, kExprF64Min);
- EXPECT_LENGTH(1, kExprF64Max);
- EXPECT_LENGTH(1, kExprF64Abs);
- EXPECT_LENGTH(1, kExprF64Neg);
- EXPECT_LENGTH(1, kExprF64CopySign);
- EXPECT_LENGTH(1, kExprF64Ceil);
- EXPECT_LENGTH(1, kExprF64Floor);
- EXPECT_LENGTH(1, kExprF64Trunc);
- EXPECT_LENGTH(1, kExprF64NearestInt);
- EXPECT_LENGTH(1, kExprF64Sqrt);
- EXPECT_LENGTH(1, kExprF64Eq);
- EXPECT_LENGTH(1, kExprF64Ne);
- EXPECT_LENGTH(1, kExprF64Lt);
- EXPECT_LENGTH(1, kExprF64Le);
- EXPECT_LENGTH(1, kExprF64Gt);
- EXPECT_LENGTH(1, kExprF64Ge);
- EXPECT_LENGTH(1, kExprI32SConvertF32);
- EXPECT_LENGTH(1, kExprI32SConvertF64);
- EXPECT_LENGTH(1, kExprI32UConvertF32);
- EXPECT_LENGTH(1, kExprI32UConvertF64);
- EXPECT_LENGTH(1, kExprI32ConvertI64);
- EXPECT_LENGTH(1, kExprI64SConvertF32);
- EXPECT_LENGTH(1, kExprI64SConvertF64);
- EXPECT_LENGTH(1, kExprI64UConvertF32);
- EXPECT_LENGTH(1, kExprI64UConvertF64);
- EXPECT_LENGTH(1, kExprI64SConvertI32);
- EXPECT_LENGTH(1, kExprI64UConvertI32);
- EXPECT_LENGTH(1, kExprF32SConvertI32);
- EXPECT_LENGTH(1, kExprF32UConvertI32);
- EXPECT_LENGTH(1, kExprF32SConvertI64);
- EXPECT_LENGTH(1, kExprF32UConvertI64);
- EXPECT_LENGTH(1, kExprF32ConvertF64);
- EXPECT_LENGTH(1, kExprF32ReinterpretI32);
- EXPECT_LENGTH(1, kExprF64SConvertI32);
- EXPECT_LENGTH(1, kExprF64UConvertI32);
- EXPECT_LENGTH(1, kExprF64SConvertI64);
- EXPECT_LENGTH(1, kExprF64UConvertI64);
- EXPECT_LENGTH(1, kExprF64ConvertF32);
- EXPECT_LENGTH(1, kExprF64ReinterpretI64);
- EXPECT_LENGTH(1, kExprI32ReinterpretF32);
- EXPECT_LENGTH(1, kExprI64ReinterpretF64);
+#define SIMPLE_OPCODE(name, byte, sig) byte,
+ static constexpr uint8_t kSimpleOpcodes[] = {
+ FOREACH_SIMPLE_OPCODE(SIMPLE_OPCODE)};
+#undef SIMPLE_OPCODE
+ for (uint8_t simple_opcode : kSimpleOpcodes) {
+ ExpectLength(1, simple_opcode);
+ }
}
TEST_F(WasmOpcodeLengthTest, SimdExpressions) {
#define TEST_SIMD(name, opcode, sig) \
- EXPECT_LENGTH_N(2, kSimdPrefix, static_cast<byte>(kExpr##name & 0xFF));
+ ExpectLength(2, kSimdPrefix, static_cast<byte>(kExpr##name & 0xFF));
FOREACH_SIMD_0_OPERAND_OPCODE(TEST_SIMD)
#undef TEST_SIMD
#define TEST_SIMD(name, opcode, sig) \
- EXPECT_LENGTH_N(3, kSimdPrefix, static_cast<byte>(kExpr##name & 0xFF));
+ ExpectLength(3, kSimdPrefix, static_cast<byte>(kExpr##name & 0xFF));
FOREACH_SIMD_1_OPERAND_OPCODE(TEST_SIMD)
#undef TEST_SIMD
- EXPECT_LENGTH_N(18, kSimdPrefix, static_cast<byte>(kExprS8x16Shuffle & 0xFF));
+ ExpectLength(18, kSimdPrefix, static_cast<byte>(kExprS8x16Shuffle & 0xFF));
// test for bad simd opcode
- EXPECT_LENGTH_N(2, kSimdPrefix, 0xFF);
+ ExpectLength(2, kSimdPrefix, 0xFF);
}
-#undef EXPECT_LENGTH
-#undef EXPECT_LENGTH_N
-
typedef ZoneVector<ValueType> TypesOfLocals;
class LocalDeclDecoderTest : public TestWithZone {
@@ -3385,14 +3578,6 @@ TEST_F(BytecodeIteratorTest, WithLocalDecls) {
#undef WASM_IF_OP
#undef WASM_LOOP_OP
#undef WASM_BRV_IF_ZERO
-#undef EXPECT_VERIFIES_C
-#undef EXPECT_FAILURE_C
-#undef EXPECT_VERIFIES_SC
-#undef EXPECT_FAILURE_SC
-#undef EXPECT_VERIFIES_S
-#undef EXPECT_FAILURE_S
-#undef EXPECT_VERIFIES
-#undef EXPECT_FAILURE
} // namespace function_body_decoder_unittest
} // namespace wasm
diff --git a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc
index 3d99dffa72..b3b069b7cc 100644
--- a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc
+++ b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc
@@ -32,6 +32,9 @@ namespace module_decoder_unittest {
#define WASM_INIT_EXPR_ANYREF WASM_REF_NULL, kExprEnd
#define WASM_INIT_EXPR_GLOBAL(index) WASM_GET_GLOBAL(index), kExprEnd
+#define REF_NULL_ELEMENT kExprRefNull, kExprEnd
+#define REF_FUNC_ELEMENT(v) kExprRefFunc, U32V_1(v), kExprEnd
+
#define EMPTY_BODY 0
#define NOP_BODY 2, 0, kExprNop
@@ -173,7 +176,9 @@ class WasmModuleVerifyTest : public TestWithIsolateAndZone {
size_t total = sizeof(header) + size;
auto temp = new byte[total];
memcpy(temp, header, sizeof(header));
- memcpy(temp + sizeof(header), module_start, size);
+ if (size > 0) {
+ memcpy(temp + sizeof(header), module_start, size);
+ }
ModuleResult result = DecodeWasmModule(
enabled_features_, temp, temp + total, false, kWasmOrigin,
isolate()->counters(), isolate()->allocator());
@@ -582,7 +587,7 @@ TEST_F(WasmModuleVerifyTest, ExceptionSectionBeforeGlobal) {
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
- EXPECT_NOT_OK(result, "unexpected section: Global");
+ EXPECT_NOT_OK(result, "unexpected section <Global>");
}
TEST_F(WasmModuleVerifyTest, ExceptionSectionAfterMemoryBeforeGlobal) {
@@ -594,7 +599,7 @@ TEST_F(WasmModuleVerifyTest, ExceptionSectionAfterMemoryBeforeGlobal) {
WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
- EXPECT_NOT_OK(result, "unexpected section: Global");
+ EXPECT_NOT_OK(result, "unexpected section <Global>");
}
TEST_F(WasmModuleVerifyTest, ExceptionImport) {
@@ -2256,8 +2261,8 @@ TEST_F(WasmModuleVerifyTest, PassiveElementSegment) {
// table declaration -----------------------------------------------------
SECTION(Table, ENTRY_COUNT(1), kLocalAnyFunc, 0, 1),
// element segments -----------------------------------------------------
- SECTION(Element, ENTRY_COUNT(1), PASSIVE,
- ADD_COUNT(FUNC_INDEX(0), FUNC_INDEX(0))),
+ SECTION(Element, ENTRY_COUNT(1), PASSIVE, kLocalAnyFunc, U32V_1(3),
+ REF_FUNC_ELEMENT(0), REF_FUNC_ELEMENT(0), REF_NULL_ELEMENT),
// code ------------------------------------------------------------------
ONE_EMPTY_BODY};
EXPECT_FAILURE(data);
@@ -2266,6 +2271,22 @@ TEST_F(WasmModuleVerifyTest, PassiveElementSegment) {
EXPECT_OFF_END_FAILURE(data, arraysize(data) - 5);
}
+TEST_F(WasmModuleVerifyTest, PassiveElementSegmentAnyRef) {
+ static const byte data[] = {
+ // sig#0 -----------------------------------------------------------------
+ SIGNATURES_SECTION_VOID_VOID,
+ // funcs -----------------------------------------------------------------
+ ONE_EMPTY_FUNCTION(SIG_INDEX(0)),
+ // table declaration -----------------------------------------------------
+ SECTION(Table, ENTRY_COUNT(1), kLocalAnyFunc, 0, 1),
+ // element segments -----------------------------------------------------
+ SECTION(Element, ENTRY_COUNT(1), PASSIVE, kLocalAnyRef, U32V_1(0)),
+ // code ------------------------------------------------------------------
+ ONE_EMPTY_BODY};
+ WASM_FEATURE_SCOPE(bulk_memory);
+ EXPECT_FAILURE(data);
+}
+
TEST_F(WasmModuleVerifyTest, DataCountSectionCorrectPlacement) {
static const byte data[] = {SECTION(Element, ENTRY_COUNT(0)),
SECTION(DataCount, ENTRY_COUNT(0)),
@@ -2289,7 +2310,7 @@ TEST_F(WasmModuleVerifyTest, DataCountSectionBeforeElement) {
SECTION(Element, ENTRY_COUNT(0))};
WASM_FEATURE_SCOPE(bulk_memory);
ModuleResult result = DecodeModule(data, data + sizeof(data));
- EXPECT_NOT_OK(result, "unexpected section: Element");
+ EXPECT_NOT_OK(result, "unexpected section <Element>");
}
TEST_F(WasmModuleVerifyTest, DataCountSectionAfterStartBeforeElement) {
@@ -2307,7 +2328,7 @@ TEST_F(WasmModuleVerifyTest, DataCountSectionAfterStartBeforeElement) {
};
WASM_FEATURE_SCOPE(bulk_memory);
ModuleResult result = DecodeModule(data, data + sizeof(data));
- EXPECT_NOT_OK(result, "unexpected section: Element");
+ EXPECT_NOT_OK(result, "unexpected section <Element>");
}
TEST_F(WasmModuleVerifyTest, MultipleDataCountSections) {
@@ -2373,6 +2394,8 @@ TEST_F(WasmModuleVerifyTest, DataCountSegmentCount_omitted) {
#undef WASM_INIT_EXPR_F64
#undef WASM_INIT_EXPR_ANYREF
#undef WASM_INIT_EXPR_GLOBAL
+#undef REF_NULL_ELEMENT
+#undef REF_FUNC_ELEMENT
#undef EMPTY_BODY
#undef NOP_BODY
#undef SIG_ENTRY_i_i
diff --git a/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc b/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc
index a5b89762ad..765e5a74ff 100644
--- a/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc
+++ b/deps/v8/test/unittests/wasm/streaming-decoder-unittest.cc
@@ -20,9 +20,11 @@ namespace wasm {
struct MockStreamingResult {
size_t num_sections = 0;
size_t num_functions = 0;
- bool ok = true;
+ WasmError error;
OwnedVector<uint8_t> received_bytes;
+ bool ok() const { return !error.has_error(); }
+
MockStreamingResult() = default;
};
@@ -33,20 +35,20 @@ class MockStreamingProcessor : public StreamingProcessor {
bool ProcessModuleHeader(Vector<const uint8_t> bytes,
uint32_t offset) override {
- // TODO(ahaas): Share code with the module-decoder.
Decoder decoder(bytes.begin(), bytes.end());
uint32_t magic_word = decoder.consume_u32("wasm magic");
if (decoder.failed() || magic_word != kWasmMagic) {
- result_->ok = false;
+ result_->error = WasmError(0, "expected wasm magic");
return false;
}
uint32_t magic_version = decoder.consume_u32("wasm version");
if (decoder.failed() || magic_version != kWasmVersion) {
- result_->ok = false;
+ result_->error = WasmError(4, "expected wasm version");
return false;
}
return true;
}
+
// Process all sections but the code section.
bool ProcessSection(SectionCode section_code, Vector<const uint8_t> bytes,
uint32_t offset) override {
@@ -54,7 +56,7 @@ class MockStreamingProcessor : public StreamingProcessor {
return true;
}
- bool ProcessCodeSectionHeader(size_t num_functions, uint32_t offset,
+ bool ProcessCodeSectionHeader(int num_functions, uint32_t offset,
std::shared_ptr<WireBytesStorage>) override {
return true;
}
@@ -74,14 +76,17 @@ class MockStreamingProcessor : public StreamingProcessor {
}
// Report an error detected in the StreamingDecoder.
- void OnError(const WasmError&) override { result_->ok = false; }
+ void OnError(const WasmError& error) override {
+ result_->error = error;
+ CHECK(!result_->ok());
+ }
void OnAbort() override {}
bool Deserialize(Vector<const uint8_t> module_bytes,
Vector<const uint8_t> wire_bytes) override {
return false;
- };
+ }
private:
MockStreamingResult* const result_;
@@ -98,14 +103,14 @@ class WasmStreamingDecoderTest : public ::testing::Test {
stream.OnBytesReceived(data.SubVector(0, split));
stream.OnBytesReceived(data.SubVector(split, data.length()));
stream.Finish();
- EXPECT_TRUE(result.ok);
+ EXPECT_TRUE(result.ok());
EXPECT_EQ(expected_sections, result.num_sections);
EXPECT_EQ(expected_functions, result.num_functions);
EXPECT_EQ(data, result.received_bytes.as_vector());
}
}
- void ExpectFailure(Vector<const uint8_t> data) {
+ void ExpectFailure(Vector<const uint8_t> data, const char* message) {
for (int split = 0; split <= data.length(); ++split) {
MockStreamingResult result;
StreamingDecoder stream(
@@ -113,18 +118,17 @@ class WasmStreamingDecoderTest : public ::testing::Test {
stream.OnBytesReceived(data.SubVector(0, split));
stream.OnBytesReceived(data.SubVector(split, data.length()));
stream.Finish();
- EXPECT_FALSE(result.ok);
+ EXPECT_FALSE(result.ok());
+ EXPECT_EQ(message, result.error.message());
}
}
-
- MockStreamingResult result;
};
TEST_F(WasmStreamingDecoderTest, EmptyStream) {
MockStreamingResult result;
StreamingDecoder stream(base::make_unique<MockStreamingProcessor>(&result));
stream.Finish();
- EXPECT_FALSE(result.ok);
+ EXPECT_FALSE(result.ok());
}
TEST_F(WasmStreamingDecoderTest, IncompleteModuleHeader) {
@@ -134,10 +138,11 @@ TEST_F(WasmStreamingDecoderTest, IncompleteModuleHeader) {
StreamingDecoder stream(base::make_unique<MockStreamingProcessor>(&result));
stream.OnBytesReceived(Vector<const uint8_t>(data, 1));
stream.Finish();
- EXPECT_FALSE(result.ok);
+ EXPECT_FALSE(result.ok());
}
for (int length = 1; length < static_cast<int>(arraysize(data)); ++length) {
- ExpectFailure(Vector<const uint8_t>(data, length));
+ ExpectFailure(Vector<const uint8_t>(data, length),
+ "unexpected end of stream");
}
}
@@ -149,14 +154,14 @@ TEST_F(WasmStreamingDecoderTest, MagicAndVersion) {
TEST_F(WasmStreamingDecoderTest, BadMagic) {
for (uint32_t x = 1; x; x <<= 1) {
const uint8_t data[] = {U32_LE(kWasmMagic ^ x), U32_LE(kWasmVersion)};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "expected wasm magic");
}
}
TEST_F(WasmStreamingDecoderTest, BadVersion) {
for (uint32_t x = 1; x; x <<= 1) {
const uint8_t data[] = {U32_LE(kWasmMagic), U32_LE(kWasmVersion ^ x)};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "expected wasm version");
}
}
@@ -243,7 +248,7 @@ TEST_F(WasmStreamingDecoderTest, OneSectionNotEnoughPayload1) {
0x0, // 4
0x0 // 5
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "unexpected end of stream");
}
TEST_F(WasmStreamingDecoderTest, OneSectionNotEnoughPayload2) {
@@ -254,7 +259,7 @@ TEST_F(WasmStreamingDecoderTest, OneSectionNotEnoughPayload2) {
0x6, // Section Length
0x0 // Payload
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "unexpected end of stream");
}
TEST_F(WasmStreamingDecoderTest, OneSectionInvalidLength) {
@@ -262,13 +267,13 @@ TEST_F(WasmStreamingDecoderTest, OneSectionInvalidLength) {
U32_LE(kWasmMagic), // --
U32_LE(kWasmVersion), // --
0x1, // Section ID
- 0x80, // Section Length (0 in LEB)
+ 0x80, // Section Length (invalid LEB)
0x80, // --
0x80, // --
0x80, // --
0x80, // --
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "expected section length");
}
TEST_F(WasmStreamingDecoderTest, TwoLongSections) {
@@ -383,7 +388,7 @@ TEST_F(WasmStreamingDecoderTest, EmptyFunction) {
0x1, // Number of Functions
0x0, // Function Length
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "invalid function length (0)");
}
TEST_F(WasmStreamingDecoderTest, TwoFunctions) {
@@ -440,7 +445,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthZero) {
kCodeSectionCode, // Section ID
0x0, // Section Length
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "code section cannot have size 0");
}
TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooHigh) {
@@ -461,7 +466,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooHigh) {
0x1, // Function Length
0x0, // Function
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "not all code section bytes were used");
}
TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooHighZeroFunctions) {
@@ -472,7 +477,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooHighZeroFunctions) {
0xD, // Section Length
0x0, // Number of Functions
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "not all code section bytes were used");
}
TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooLow) {
@@ -493,7 +498,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooLow) {
0x1, // Function Length
0x0, // Function
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "read past code section end");
}
TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooLowEndsInNumFunctions) {
@@ -516,7 +521,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooLowEndsInNumFunctions) {
0x1, // Function Length
0x0, // Function
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "invalid code section length");
}
TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooLowEndsInFunctionLength) {
@@ -541,7 +546,7 @@ TEST_F(WasmStreamingDecoderTest, CodeSectionLengthTooLowEndsInFunctionLength) {
0x1, // Function Length
0x0, // Function
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "read past code section end");
}
TEST_F(WasmStreamingDecoderTest, NumberOfFunctionsTooHigh) {
@@ -562,7 +567,7 @@ TEST_F(WasmStreamingDecoderTest, NumberOfFunctionsTooHigh) {
0x1, // Function Length
0x0, // Function
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "unexpected end of stream");
}
TEST_F(WasmStreamingDecoderTest, NumberOfFunctionsTooLow) {
@@ -586,7 +591,7 @@ TEST_F(WasmStreamingDecoderTest, NumberOfFunctionsTooLow) {
0x0, // 6
0x0, // 7
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "not all code section bytes were used");
}
TEST_F(WasmStreamingDecoderTest, TwoCodeSections) {
@@ -604,7 +609,7 @@ TEST_F(WasmStreamingDecoderTest, TwoCodeSections) {
0x1, // Function Length
0x0, // Function
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "code section can only appear once");
}
TEST_F(WasmStreamingDecoderTest, UnknownSection) {
@@ -645,7 +650,7 @@ TEST_F(WasmStreamingDecoderTest, UnknownSectionSandwich) {
0x1, // Function Length
0x0, // Function
};
- ExpectFailure(ArrayVector(data));
+ ExpectFailure(ArrayVector(data), "code section can only appear once");
}
} // namespace wasm
diff --git a/deps/v8/test/unittests/wasm/trap-handler-x64-unittest.cc b/deps/v8/test/unittests/wasm/trap-handler-x64-unittest.cc
index 8c42b1735c..6baf42e076 100644
--- a/deps/v8/test/unittests/wasm/trap-handler-x64-unittest.cc
+++ b/deps/v8/test/unittests/wasm/trap-handler-x64-unittest.cc
@@ -468,9 +468,9 @@ TEST_P(TrapHandlerTest, TestCrashInOtherThread) {
*trap_handler::GetThreadInWasmThreadLocalAddress() = 0;
}
-INSTANTIATE_TEST_CASE_P(/* no prefix */, TrapHandlerTest,
- ::testing::Values(kDefault, kCallback),
- PrintTrapHandlerTestParam);
+INSTANTIATE_TEST_SUITE_P(/* no prefix */, TrapHandlerTest,
+ ::testing::Values(kDefault, kCallback),
+ PrintTrapHandlerTestParam);
#undef __
} // namespace wasm
diff --git a/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc b/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc
index e90c97f3a1..e43f0ab5f9 100644
--- a/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc
+++ b/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc
@@ -165,8 +165,8 @@ class WasmCodeManagerTest : public TestWithContext,
std::shared_ptr<WasmModule> module(new WasmModule);
module->num_declared_functions = kNumFunctions;
bool can_request_more = style == Growable;
- return manager()->NewNativeModule(i_isolate(), kAllWasmFeatures, size,
- can_request_more, std::move(module));
+ return engine()->NewNativeModule(i_isolate(), kAllWasmFeatures, size,
+ can_request_more, std::move(module));
}
WasmCode* AddCode(NativeModule* native_module, uint32_t index, size_t size) {
@@ -175,24 +175,24 @@ class WasmCodeManagerTest : public TestWithContext,
std::unique_ptr<byte[]> exec_buff(new byte[size]);
desc.buffer = exec_buff.get();
desc.instr_size = static_cast<int>(size);
- return native_module->AddCode(index, desc, 0, 0, 0, {}, OwnedVector<byte>(),
+ return native_module->AddCode(index, desc, 0, 0, {}, OwnedVector<byte>(),
WasmCode::kFunction, WasmCode::kOther);
}
size_t page() const { return AllocatePageSize(); }
- WasmCodeManager* manager() {
- return i_isolate()->wasm_engine()->code_manager();
- }
+ WasmEngine* engine() { return i_isolate()->wasm_engine(); }
+
+ WasmCodeManager* manager() { return engine()->code_manager(); }
void SetMaxCommittedMemory(size_t limit) {
manager()->SetMaxCommittedMemoryForTesting(limit);
}
};
-INSTANTIATE_TEST_CASE_P(Parameterized, WasmCodeManagerTest,
- ::testing::Values(Fixed, Growable),
- PrintWasmCodeManageTestParam);
+INSTANTIATE_TEST_SUITE_P(Parameterized, WasmCodeManagerTest,
+ ::testing::Values(Fixed, Growable),
+ PrintWasmCodeManageTestParam);
TEST_P(WasmCodeManagerTest, EmptyCase) {
SetMaxCommittedMemory(0 * page());
diff --git a/deps/v8/test/unittests/zone/segmentpool-unittest.cc b/deps/v8/test/unittests/zone/segmentpool-unittest.cc
deleted file mode 100644
index b3556a9519..0000000000
--- a/deps/v8/test/unittests/zone/segmentpool-unittest.cc
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2016 the V8 project authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "src/zone/accounting-allocator.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace v8 {
-namespace internal {
-
-TEST(Zone, SegmentPoolConstraints) {
- size_t sizes[]{
- 0, // Corner case
- AccountingAllocator::kMaxPoolSize,
- GB // Something really large
- };
-
- AccountingAllocator allocator;
- for (size_t size : sizes) {
- allocator.ConfigureSegmentPool(size);
- size_t total_size = 0;
- for (size_t power = 0; power < AccountingAllocator::kNumberBuckets;
- ++power) {
- total_size +=
- allocator.unused_segments_max_sizes_[power] * (size_t(1) << power);
- }
- EXPECT_LE(total_size, size);
- }
-}
-
-} // namespace internal
-} // namespace v8
diff --git a/deps/v8/test/wasm-js/testcfg.py b/deps/v8/test/wasm-js/testcfg.py
index b0763e008a..8d67366e30 100644
--- a/deps/v8/test/wasm-js/testcfg.py
+++ b/deps/v8/test/wasm-js/testcfg.py
@@ -11,35 +11,44 @@ from testrunner.objects import testcase
ANY_JS = ".any.js"
WPT_ROOT = "/wasm/jsapi/"
META_SCRIPT_REGEXP = re.compile(r"META:\s*script=(.*)")
+META_TIMEOUT_REGEXP = re.compile(r"META:\s*timeout=(.*)")
+
+
+class TestLoader(testsuite.JSTestLoader):
+ @property
+ def extension(self):
+ return ANY_JS
+
class TestSuite(testsuite.TestSuite):
def __init__(self, *args, **kwargs):
super(TestSuite, self).__init__(*args, **kwargs)
- self.testroot = os.path.join(self.root, "data", "test", "js-api")
self.mjsunit_js = os.path.join(os.path.dirname(self.root), "mjsunit",
"mjsunit.js")
+ self.test_root = os.path.join(self.root, "data", "test", "js-api")
+ self._test_loader.test_root = self.test_root
- def ListTests(self):
- tests = []
- for dirname, dirs, files in os.walk(self.testroot):
- for dotted in [x for x in dirs if x.startswith(".")]:
- dirs.remove(dotted)
- dirs.sort()
- files.sort()
- for filename in files:
- if (filename.endswith(ANY_JS)):
- fullpath = os.path.join(dirname, filename)
- relpath = fullpath[len(self.testroot) + 1 : -len(ANY_JS)]
- testname = relpath.replace(os.path.sep, "/")
- test = self._create_test(testname)
- tests.append(test)
- return tests
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
class TestCase(testcase.D8TestCase):
+ def _get_timeout_param(self):
+ source = self.get_source()
+ timeout_params = META_TIMEOUT_REGEXP.findall(source)
+ if not timeout_params:
+ return None
+
+ if timeout_params[0] in ["long"]:
+ return timeout_params[0]
+ else:
+ print("unknown timeout param %s in %s%s"
+ % (timeout_params[0], self.path, ANY_JS))
+ return None
+
def _get_files_params(self):
files = [os.path.join(self.suite.mjsunit_js),
os.path.join(self.suite.root, "testharness.js")]
@@ -49,7 +58,7 @@ class TestCase(testcase.D8TestCase):
if script.startswith(WPT_ROOT):
# Matched an absolute path, strip the root and replace it with our
# local root.
- script = os.path.join(self.suite.testroot, script[len(WPT_ROOT):])
+ script = os.path.join(self.suite.test_root, script[len(WPT_ROOT):])
elif not script.startswith("/"):
# Matched a relative path, prepend this test's directory.
thisdir = os.path.dirname(self._get_source_path())
@@ -67,7 +76,7 @@ class TestCase(testcase.D8TestCase):
def _get_source_path(self):
# All tests are named `path/name.any.js`
- return os.path.join(self.suite.testroot, self.path + ANY_JS)
+ return os.path.join(self.suite.test_root, self.path + ANY_JS)
def GetSuite(*args, **kwargs):
diff --git a/deps/v8/test/wasm-js/wasm-js.status b/deps/v8/test/wasm-js/wasm-js.status
index 22e5457ae1..51961fd46d 100644
--- a/deps/v8/test/wasm-js/wasm-js.status
+++ b/deps/v8/test/wasm-js/wasm-js.status
@@ -4,11 +4,6 @@
[
[ALWAYS, {
- # https://bugs.chromium.org/p/v8/issues/detail?id=8319
- 'module/customSections': [FAIL],
-}], # ALWAYS
-
-[ALWAYS, {
# https://bugs.chromium.org/p/v8/issues/detail?id=8633
'limits': [SKIP],
}], # ALWAYS
@@ -20,9 +15,14 @@
}], # 'arch == s390 or arch == s390x or system == aix'
##############################################################################
-['lite_mode', {
+['lite_mode or variant == jitless', {
# TODO(v8:7777): Re-enable once wasm is supported in jitless mode.
'*': [SKIP],
-}], # lite_mode
+}], # lite_mode or variant == jitless
+
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
]
diff --git a/deps/v8/test/wasm-spec-tests/testcfg.py b/deps/v8/test/wasm-spec-tests/testcfg.py
index b8d8ed8bd8..b849b63dca 100644
--- a/deps/v8/test/wasm-spec-tests/testcfg.py
+++ b/deps/v8/test/wasm-spec-tests/testcfg.py
@@ -7,20 +7,13 @@ import os
from testrunner.local import testsuite
from testrunner.objects import testcase
+
+class TestLoader(testsuite.JSTestLoader):
+ pass
+
class TestSuite(testsuite.TestSuite):
- def ListTests(self):
- tests = []
- for dirname, dirs, files in os.walk(self.root):
- for dotted in [x for x in dirs if x.startswith('.')]:
- dirs.remove(dotted)
- for filename in files:
- if (filename.endswith(".js")):
- fullpath = os.path.join(dirname, filename)
- relpath = fullpath[len(self.root) + 1 : -3]
- testname = relpath.replace(os.path.sep, "/")
- test = self._create_test(testname)
- tests.append(test)
- return tests
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/wasm-spec-tests/tests.tar.gz.sha1 b/deps/v8/test/wasm-spec-tests/tests.tar.gz.sha1
index b676370dad..d7b0ee9dc9 100644
--- a/deps/v8/test/wasm-spec-tests/tests.tar.gz.sha1
+++ b/deps/v8/test/wasm-spec-tests/tests.tar.gz.sha1
@@ -1 +1 @@
-6a2c7fb6e2a4ead5d261c9fdac77d3129268848e \ No newline at end of file
+ed10dcd09ecd4e7c4fd4c0de1a2cbac60632c21b \ No newline at end of file
diff --git a/deps/v8/test/wasm-spec-tests/wasm-spec-tests.status b/deps/v8/test/wasm-spec-tests/wasm-spec-tests.status
index e61171b6b2..1953efae0a 100644
--- a/deps/v8/test/wasm-spec-tests/wasm-spec-tests.status
+++ b/deps/v8/test/wasm-spec-tests/wasm-spec-tests.status
@@ -44,10 +44,15 @@
}], # 'arch == s390 or arch == s390x'
##############################################################################
-['lite_mode', {
+['lite_mode or variant == jitless', {
# TODO(v8:7777): Re-enable once wasm is supported in jitless mode.
'*': [SKIP],
-}], # lite_mode
+}], # lite_mode or variant == jitless
+
+##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
]
diff --git a/deps/v8/test/webkit/JSON-stringify-replacer-expected.txt b/deps/v8/test/webkit/JSON-stringify-replacer-expected.txt
index cea851edab..1955bd4633 100644
--- a/deps/v8/test/webkit/JSON-stringify-replacer-expected.txt
+++ b/deps/v8/test/webkit/JSON-stringify-replacer-expected.txt
@@ -40,10 +40,18 @@ PASS JSON.stringify(object, returnNullFor1) is '{"0":0,"1":null,"2":2}'
PASS JSON.stringify(array, returnNullFor1) is '[0,null,2,null]'
PASS JSON.stringify(object, returnStringForUndefined) is '{"0":0,"1":1,"2":2,"3":"undefined value"}'
PASS JSON.stringify(array, returnStringForUndefined) is '[0,1,2,"undefined value"]'
-PASS JSON.stringify(object, returnCycleObjectFor1) threw exception TypeError: Converting circular structure to JSON.
-PASS JSON.stringify(array, returnCycleObjectFor1) threw exception TypeError: Converting circular structure to JSON.
-PASS JSON.stringify(object, returnCycleArrayFor1) threw exception TypeError: Converting circular structure to JSON.
-PASS JSON.stringify(array, returnCycleArrayFor1) threw exception TypeError: Converting circular structure to JSON.
+PASS JSON.stringify(object, returnCycleObjectFor1) threw exception TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ --- property '1' closes the circle.
+PASS JSON.stringify(array, returnCycleObjectFor1) threw exception TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ --- property '1' closes the circle.
+PASS JSON.stringify(object, returnCycleArrayFor1) threw exception TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Array'
+ --- index 1 closes the circle.
+PASS JSON.stringify(array, returnCycleArrayFor1) threw exception TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Array'
+ --- index 1 closes the circle.
PASS successfullyParsed is true
TEST COMPLETE
diff --git a/deps/v8/test/webkit/class-syntax-name-expected.txt b/deps/v8/test/webkit/class-syntax-name-expected.txt
index ed49be3309..27ae3088c2 100644
--- a/deps/v8/test/webkit/class-syntax-name-expected.txt
+++ b/deps/v8/test/webkit/class-syntax-name-expected.txt
@@ -108,8 +108,8 @@ PASS 'use strict'; var VarA = class A { constructor() {} }; var VarB = class B e
Class statement binding in other circumstances
PASS var result = A; result threw exception ReferenceError: A is not defined.
PASS 'use strict'; var result = A; result threw exception ReferenceError: A is not defined.
-PASS var result = A; class A {}; result threw exception ReferenceError: A is not defined.
-PASS 'use strict'; var result = A; class A {}; result threw exception ReferenceError: A is not defined.
+PASS var result = A; class A {}; result threw exception ReferenceError: Cannot access 'A' before initialization.
+PASS 'use strict'; var result = A; class A {}; result threw exception ReferenceError: Cannot access 'A' before initialization.
PASS class A { constructor() { A = 1; } }; new A threw exception TypeError: Assignment to constant variable..
PASS 'use strict'; class A { constructor() { A = 1; } }; new A threw exception TypeError: Assignment to constant variable..
PASS class A { constructor() { } }; A = 1; A is 1
diff --git a/deps/v8/test/webkit/run-json-stringify-expected.txt b/deps/v8/test/webkit/run-json-stringify-expected.txt
index 437897efa2..256b552939 100644
--- a/deps/v8/test/webkit/run-json-stringify-expected.txt
+++ b/deps/v8/test/webkit/run-json-stringify-expected.txt
@@ -434,7 +434,9 @@ function (jsonObject){
cycleTracker = "";
return jsonObject.stringify(cyclicObject);
}
-PASS tests[i](nativeJSON) threw exception TypeError: Converting circular structure to JSON.
+PASS tests[i](nativeJSON) threw exception TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Object'
+ --- property 'self' closes the circle.
function (jsonObject){
cycleTracker = "";
try { jsonObject.stringify(cyclicObject); } catch(e) { cycleTracker += " -> exception" }
@@ -445,7 +447,9 @@ function (jsonObject){
cycleTracker = "";
return jsonObject.stringify(cyclicArray);
}
-PASS tests[i](nativeJSON) threw exception TypeError: Converting circular structure to JSON.
+PASS tests[i](nativeJSON) threw exception TypeError: Converting circular structure to JSON
+ --> starting at object with constructor 'Array'
+ --- index 1 closes the circle.
function (jsonObject){
cycleTracker = "";
try { jsonObject.stringify(cyclicArray); } catch { cycleTracker += " -> exception" }
diff --git a/deps/v8/test/webkit/testcfg.py b/deps/v8/test/webkit/testcfg.py
index 5d564b69bc..500f44656b 100644
--- a/deps/v8/test/webkit/testcfg.py
+++ b/deps/v8/test/webkit/testcfg.py
@@ -36,26 +36,15 @@ FILES_PATTERN = re.compile(r"//\s+Files:(.*)")
SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME")
-# TODO (machenbach): Share commonalities with mjstest.
+class TestLoader(testsuite.JSTestLoader):
+ @property
+ def excluded_dirs(self):
+ return {"resources"}
+
+
class TestSuite(testsuite.TestSuite):
- def ListTests(self):
- tests = []
- for dirname, dirs, files in os.walk(self.root):
- for dotted in [x for x in dirs if x.startswith('.')]:
- dirs.remove(dotted)
- if 'resources' in dirs:
- dirs.remove('resources')
-
- dirs.sort()
- files.sort()
- for filename in files:
- if filename.endswith(".js"):
- fullpath = os.path.join(dirname, filename)
- relpath = fullpath[len(self.root) + 1 : -3]
- testname = relpath.replace(os.path.sep, "/")
- test = self._create_test(testname)
- tests.append(test)
- return tests
+ def _test_loader_class(self):
+ return TestLoader
def _test_class(self):
return TestCase
diff --git a/deps/v8/test/webkit/webkit.status b/deps/v8/test/webkit/webkit.status
index d5dac2ba9d..53d0c3b167 100644
--- a/deps/v8/test/webkit/webkit.status
+++ b/deps/v8/test/webkit/webkit.status
@@ -132,4 +132,9 @@
}], # variant == no_wasm_traps
##############################################################################
+['variant == jitless and not embedded_builtins', {
+ '*': [SKIP],
+}], # variant == jitless and not embedded_builtins
+
+##############################################################################
]