summaryrefslogtreecommitdiff
path: root/deps/v8/test
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test')
-rw-r--r--deps/v8/test/BUILD.gn11
-rw-r--r--deps/v8/test/cctest/BUILD.gn12
-rw-r--r--deps/v8/test/cctest/OWNERS5
-rw-r--r--deps/v8/test/cctest/cctest.h27
-rw-r--r--deps/v8/test/cctest/cctest.status59
-rw-r--r--deps/v8/test/cctest/compiler/code-assembler-tester.h4
-rw-r--r--deps/v8/test/cctest/compiler/function-tester.cc5
-rw-r--r--deps/v8/test/cctest/compiler/function-tester.h1
-rw-r--r--deps/v8/test/cctest/compiler/test-basic-block-profiler.cc5
-rw-r--r--deps/v8/test/cctest/compiler/test-code-generator.cc18
-rw-r--r--deps/v8/test/cctest/compiler/test-js-constant-cache.cc4
-rw-r--r--deps/v8/test/cctest/compiler/test-js-context-specialization.cc48
-rw-r--r--deps/v8/test/cctest/compiler/test-js-typed-lowering.cc7
-rw-r--r--deps/v8/test/cctest/compiler/test-linkage.cc7
-rw-r--r--deps/v8/test/cctest/compiler/test-multiple-return.cc166
-rw-r--r--deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc2
-rw-r--r--deps/v8/test/cctest/compiler/test-run-jscalls.cc1
-rw-r--r--deps/v8/test/cctest/compiler/test-run-machops.cc38
-rw-r--r--deps/v8/test/cctest/compiler/test-run-retpoline.cc1
-rw-r--r--deps/v8/test/cctest/compiler/test-run-stubs.cc3
-rw-r--r--deps/v8/test/cctest/compiler/test-run-tail-calls.cc1
-rw-r--r--deps/v8/test/cctest/compiler/test-run-variables.cc2
-rw-r--r--deps/v8/test/cctest/heap/heap-tester.h4
-rw-r--r--deps/v8/test/cctest/heap/test-alloc.cc2
-rw-r--r--deps/v8/test/cctest/heap/test-array-buffer-tracker.cc4
-rw-r--r--deps/v8/test/cctest/heap/test-embedder-tracing.cc18
-rw-r--r--deps/v8/test/cctest/heap/test-external-string-tracker.cc226
-rw-r--r--deps/v8/test/cctest/heap/test-heap.cc213
-rw-r--r--deps/v8/test/cctest/heap/test-invalidated-slots.cc186
-rw-r--r--deps/v8/test/cctest/heap/test-weak-references.cc51
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc18
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h12
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden161
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden2
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden8
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden8
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden18
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden2
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden408
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden109
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden423
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreWithoutOneShot.golden119
-rw-r--r--deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden2
-rw-r--r--deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc27
-rw-r--r--deps/v8/test/cctest/interpreter/interpreter-tester.cc1
-rw-r--r--deps/v8/test/cctest/interpreter/test-bytecode-generator.cc265
-rw-r--r--deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc17
-rw-r--r--deps/v8/test/cctest/interpreter/test-interpreter.cc1
-rw-r--r--deps/v8/test/cctest/interpreter/test-source-positions.cc2
-rw-r--r--deps/v8/test/cctest/parsing/test-parse-decision.cc2
-rw-r--r--deps/v8/test/cctest/parsing/test-preparser.cc2
-rw-r--r--deps/v8/test/cctest/parsing/test-scanner-streams.cc139
-rw-r--r--deps/v8/test/cctest/parsing/test-scanner.cc8
-rw-r--r--deps/v8/test/cctest/test-accessors.cc4
-rw-r--r--deps/v8/test/cctest/test-api-accessors.cc12
-rw-r--r--deps/v8/test/cctest/test-api-interceptors.cc35
-rw-r--r--deps/v8/test/cctest/test-api.cc658
-rw-r--r--deps/v8/test/cctest/test-assembler-arm.cc8
-rw-r--r--deps/v8/test/cctest/test-assembler-arm64.cc164
-rw-r--r--deps/v8/test/cctest/test-assembler-mips.cc50
-rw-r--r--deps/v8/test/cctest/test-assembler-mips64.cc50
-rw-r--r--deps/v8/test/cctest/test-assembler-x64.cc1
-rw-r--r--deps/v8/test/cctest/test-code-stub-assembler.cc56
-rw-r--r--deps/v8/test/cctest/test-code-stubs-arm.cc2
-rw-r--r--deps/v8/test/cctest/test-code-stubs-arm64.cc2
-rw-r--r--deps/v8/test/cctest/test-code-stubs-ia32.cc1
-rw-r--r--deps/v8/test/cctest/test-code-stubs-mips.cc2
-rw-r--r--deps/v8/test/cctest/test-code-stubs-mips64.cc2
-rw-r--r--deps/v8/test/cctest/test-code-stubs-x64.cc1
-rw-r--r--deps/v8/test/cctest/test-compiler.cc9
-rw-r--r--deps/v8/test/cctest/test-cpu-profiler.cc2
-rw-r--r--deps/v8/test/cctest/test-debug.cc17
-rw-r--r--deps/v8/test/cctest/test-deoptimization.cc2
-rw-r--r--deps/v8/test/cctest/test-dictionary.cc3
-rw-r--r--deps/v8/test/cctest/test-disasm-arm.cc22
-rw-r--r--deps/v8/test/cctest/test-disasm-arm64.cc7
-rw-r--r--deps/v8/test/cctest/test-disasm-ia32.cc5
-rw-r--r--deps/v8/test/cctest/test-disasm-x64.cc8
-rw-r--r--deps/v8/test/cctest/test-elements-kind.cc1
-rw-r--r--deps/v8/test/cctest/test-feedback-vector.cc2
-rw-r--r--deps/v8/test/cctest/test-field-type-tracking.cc13
-rw-r--r--deps/v8/test/cctest/test-func-name-inference.cc2
-rw-r--r--deps/v8/test/cctest/test-fuzz-arm64.cc4
-rw-r--r--deps/v8/test/cctest/test-global-handles.cc2
-rw-r--r--deps/v8/test/cctest/test-global-object.cc1
-rw-r--r--deps/v8/test/cctest/test-hashcode.cc19
-rw-r--r--deps/v8/test/cctest/test-heap-profiler.cc157
-rw-r--r--deps/v8/test/cctest/test-inobject-slack-tracking.cc4
-rw-r--r--deps/v8/test/cctest/test-isolate-independent-builtins.cc1
-rw-r--r--deps/v8/test/cctest/test-liveedit.cc56
-rw-r--r--deps/v8/test/cctest/test-lockers.cc1
-rw-r--r--deps/v8/test/cctest/test-log-stack-tracer.cc2
-rw-r--r--deps/v8/test/cctest/test-log.cc543
-rw-r--r--deps/v8/test/cctest/test-macro-assembler-arm.cc1
-rw-r--r--deps/v8/test/cctest/test-macro-assembler-mips.cc5
-rw-r--r--deps/v8/test/cctest/test-macro-assembler-mips64.cc3
-rw-r--r--deps/v8/test/cctest/test-macro-assembler-x64.cc1
-rw-r--r--deps/v8/test/cctest/test-object.cc2
-rw-r--r--deps/v8/test/cctest/test-parsing.cc63
-rw-r--r--deps/v8/test/cctest/test-profile-generator.cc2
-rw-r--r--deps/v8/test/cctest/test-regexp.cc2
-rw-r--r--deps/v8/test/cctest/test-roots.cc34
-rw-r--r--deps/v8/test/cctest/test-serialize.cc35
-rw-r--r--deps/v8/test/cctest/test-strings.cc44
-rw-r--r--deps/v8/test/cctest/test-thread-termination.cc2
-rw-r--r--deps/v8/test/cctest/test-trace-event.cc16
-rw-r--r--deps/v8/test/cctest/test-typedarrays.cc3
-rw-r--r--deps/v8/test/cctest/test-types.cc2
-rw-r--r--deps/v8/test/cctest/test-unboxed-doubles.cc6
-rw-r--r--deps/v8/test/cctest/test-utils.cc1
-rw-r--r--deps/v8/test/cctest/torque/test-torque.cc37
-rw-r--r--deps/v8/test/cctest/types-fuzz.h4
-rw-r--r--deps/v8/test/cctest/wasm/test-c-wasm-entry.cc4
-rw-r--r--deps/v8/test/cctest/wasm/test-jump-table-assembler.cc199
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-64.cc284
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc24
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc68
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc88
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc58
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-js.cc164
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-module.cc6
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-sign-extension.cc10
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm-simd.cc435
-rw-r--r--deps/v8/test/cctest/wasm/test-run-wasm.cc809
-rw-r--r--deps/v8/test/cctest/wasm/test-streaming-compilation.cc16
-rw-r--r--deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc10
-rw-r--r--deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc12
-rw-r--r--deps/v8/test/cctest/wasm/test-wasm-serialization.cc74
-rw-r--r--deps/v8/test/cctest/wasm/test-wasm-shared-engine.cc198
-rw-r--r--deps/v8/test/cctest/wasm/test-wasm-stack.cc10
-rw-r--r--deps/v8/test/cctest/wasm/test-wasm-trap-position.cc8
-rw-r--r--deps/v8/test/cctest/wasm/wasm-run-utils.cc54
-rw-r--r--deps/v8/test/cctest/wasm/wasm-run-utils.h58
-rw-r--r--deps/v8/test/common/assembler-tester.h46
-rw-r--r--deps/v8/test/common/wasm/wasm-macro-gen.h2
-rw-r--r--deps/v8/test/common/wasm/wasm-module-runner.cc11
-rw-r--r--deps/v8/test/debugger/debug/debug-liveedit-arrow-function-at-start.js13
-rw-r--r--deps/v8/test/debugger/debug/wasm/frame-inspection.js1
-rw-r--r--deps/v8/test/debugger/debugger.status5
-rw-r--r--deps/v8/test/fuzzer/multi-return.cc5
-rw-r--r--deps/v8/test/fuzzer/regexp-builtins.cc14
-rw-r--r--deps/v8/test/fuzzer/wasm-async.cc4
-rw-r--r--deps/v8/test/fuzzer/wasm-compile.cc21
-rw-r--r--deps/v8/test/fuzzer/wasm-fuzzer-common.cc49
-rw-r--r--deps/v8/test/fuzzer/wasm.cc8
-rw-r--r--deps/v8/test/inspector/debugger/object-preview-internal-properties-expected.txt5
-rw-r--r--deps/v8/test/inspector/debugger/resource-name-to-url-expected.txt12
-rw-r--r--deps/v8/test/inspector/inspector-test.cc158
-rw-r--r--deps/v8/test/inspector/isolate-data.cc21
-rw-r--r--deps/v8/test/intl/collator/default-locale.js8
-rw-r--r--deps/v8/test/intl/collator/property-override.js2
-rw-r--r--deps/v8/test/intl/date-format/timezone.js35
-rw-r--r--deps/v8/test/intl/general/getCanonicalLocales.js26
-rw-r--r--deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js27
-rw-r--r--deps/v8/test/intl/general/language_tags_with_preferred_values.js11
-rw-r--r--deps/v8/test/intl/list-format/constructor.js108
-rw-r--r--deps/v8/test/intl/list-format/format-en.js119
-rw-r--r--deps/v8/test/intl/list-format/format-to-parts.js92
-rw-r--r--deps/v8/test/intl/list-format/format.js63
-rw-r--r--deps/v8/test/intl/list-format/formatToParts-zh.js157
-rw-r--r--deps/v8/test/intl/list-format/resolved-options.js155
-rw-r--r--deps/v8/test/intl/locale/locale-constructor.js5
-rw-r--r--deps/v8/test/intl/locale/maximize_minimize.js138
-rw-r--r--deps/v8/test/intl/locale/regress-8032.js7
-rw-r--r--deps/v8/test/intl/number-format/options.js13
-rw-r--r--deps/v8/test/intl/regress-8030.js21
-rw-r--r--deps/v8/test/intl/regress-8031.js22
-rw-r--r--deps/v8/test/intl/regress-8725514.js10
-rw-r--r--deps/v8/test/intl/regress-875643.js5
-rw-r--r--deps/v8/test/intl/relative-time-format/format-en.js502
-rw-r--r--deps/v8/test/intl/relative-time-format/format-to-parts-en.js68
-rw-r--r--deps/v8/test/intl/relative-time-format/format-to-parts.js82
-rw-r--r--deps/v8/test/intl/relative-time-format/format.js82
-rw-r--r--deps/v8/test/js-perf-test/Array/copy-within.js43
-rw-r--r--deps/v8/test/js-perf-test/Array/every.js10
-rw-r--r--deps/v8/test/js-perf-test/Array/filter.js20
-rw-r--r--deps/v8/test/js-perf-test/Array/find-index.js23
-rw-r--r--deps/v8/test/js-perf-test/Array/find.js14
-rw-r--r--deps/v8/test/js-perf-test/Array/for-each.js26
-rw-r--r--deps/v8/test/js-perf-test/Array/map.js18
-rw-r--r--deps/v8/test/js-perf-test/Array/reduce-right.js22
-rw-r--r--deps/v8/test/js-perf-test/Array/reduce.js13
-rw-r--r--deps/v8/test/js-perf-test/Array/run.js62
-rw-r--r--deps/v8/test/js-perf-test/Array/slice.js7
-rw-r--r--deps/v8/test/js-perf-test/Array/some.js10
-rw-r--r--deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLarge/run.js153
-rw-r--r--deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeHoley/run.js161
-rw-r--r--deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmall/run.js154
-rw-r--r--deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallHoley/run.js159
-rw-r--r--deps/v8/test/js-perf-test/ArraySort/sort-base.js6
-rw-r--r--deps/v8/test/js-perf-test/ArraySort/sort-lengths.js14
-rw-r--r--deps/v8/test/js-perf-test/JSTests.json96
-rw-r--r--deps/v8/test/js-perf-test/Numbers/run.js20
-rw-r--r--deps/v8/test/js-perf-test/Numbers/toNumber.js25
-rw-r--r--deps/v8/test/js-perf-test/Parsing/arrowfunctions.js60
-rw-r--r--deps/v8/test/js-perf-test/Parsing/comments.js16
-rw-r--r--deps/v8/test/js-perf-test/Parsing/run.js11
-rw-r--r--deps/v8/test/js-perf-test/Parsing/strings.js37
-rw-r--r--deps/v8/test/js-perf-test/StringIterators/string-iterator.js55
-rw-r--r--deps/v8/test/js-perf-test/TurboFan/run.js29
-rw-r--r--deps/v8/test/js-perf-test/TurboFan/typedLowering.js13
-rw-r--r--deps/v8/test/js-perf-test/base.js20
-rw-r--r--deps/v8/test/message/asm-linking-bogus-heap.out2
-rw-r--r--deps/v8/test/message/fail/non-alphanum.out2
-rw-r--r--deps/v8/test/message/wasm-trace-memory-interpreted.out18
-rw-r--r--deps/v8/test/message/wasm-trace-memory-liftoff.out18
-rw-r--r--deps/v8/test/message/wasm-trace-memory.out18
-rw-r--r--deps/v8/test/mjsunit/array-constructor-feedback.js1
-rw-r--r--deps/v8/test/mjsunit/array-iterator-prototype-next.js20
-rw-r--r--deps/v8/test/mjsunit/array-lastindexof.js73
-rw-r--r--deps/v8/test/mjsunit/array-prototype-every.js20
-rw-r--r--deps/v8/test/mjsunit/array-prototype-filter.js22
-rw-r--r--deps/v8/test/mjsunit/array-prototype-find.js20
-rw-r--r--deps/v8/test/mjsunit/array-prototype-findindex.js20
-rw-r--r--deps/v8/test/mjsunit/array-prototype-foreach.js26
-rw-r--r--deps/v8/test/mjsunit/array-prototype-includes.js36
-rw-r--r--deps/v8/test/mjsunit/array-prototype-indexof.js36
-rw-r--r--deps/v8/test/mjsunit/array-prototype-lastindexof.js20
-rw-r--r--deps/v8/test/mjsunit/array-prototype-map.js21
-rw-r--r--deps/v8/test/mjsunit/array-prototype-pop.js29
-rw-r--r--deps/v8/test/mjsunit/array-prototype-reduce.js24
-rw-r--r--deps/v8/test/mjsunit/array-prototype-slice.js21
-rw-r--r--deps/v8/test/mjsunit/array-prototype-some.js20
-rw-r--r--deps/v8/test/mjsunit/array-reverse.js70
-rw-r--r--deps/v8/test/mjsunit/asm/asm-heap.js99
-rw-r--r--deps/v8/test/mjsunit/compiler/array-multiple-receiver-maps.js1
-rw-r--r--deps/v8/test/mjsunit/compiler/array-slice-clone.js365
-rw-r--r--deps/v8/test/mjsunit/compiler/dataview-deopt.js58
-rw-r--r--deps/v8/test/mjsunit/compiler/dataview-get.js63
-rw-r--r--deps/v8/test/mjsunit/compiler/dataview-set.js8
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-iterator-prototype-next.js24
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-every.js26
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-filter.js28
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-find.js26
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-findindex.js26
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-foreach.js31
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-includes.js103
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-indexof.js104
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-lastindexof.js26
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-map.js29
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-pop.js26
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-reduce.js31
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-slice.js29
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-array-prototype-some.js26
-rw-r--r--deps/v8/test/mjsunit/compiler/number-constructor-deopt.js32
-rw-r--r--deps/v8/test/mjsunit/empirical_max_arraybuffer.js101
-rw-r--r--deps/v8/test/mjsunit/es6/array-fill-receiver.js118
-rw-r--r--deps/v8/test/mjsunit/es6/array-fill.js97
-rw-r--r--deps/v8/test/mjsunit/es6/array-iterator.js13
-rw-r--r--deps/v8/test/mjsunit/es6/math-log2-log10.js4
-rw-r--r--deps/v8/test/mjsunit/es6/promise-all-overflow-1.js2
-rw-r--r--deps/v8/test/mjsunit/es6/promise-all-overflow-2.js2
-rw-r--r--deps/v8/test/mjsunit/es6/promise-all.js2
-rw-r--r--deps/v8/test/mjsunit/es6/proxies.js2
-rw-r--r--deps/v8/test/mjsunit/es9/object-spread-ic.js101
-rw-r--r--deps/v8/test/mjsunit/es9/regress/regress-866229.js20
-rw-r--r--deps/v8/test/mjsunit/es9/regress/regress-866282.js17
-rw-r--r--deps/v8/test/mjsunit/es9/regress/regress-866357.js17
-rw-r--r--deps/v8/test/mjsunit/es9/regress/regress-866727.js19
-rw-r--r--deps/v8/test/mjsunit/es9/regress/regress-866861.js11
-rw-r--r--deps/v8/test/mjsunit/es9/regress/regress-867958.js13
-rw-r--r--deps/v8/test/mjsunit/es9/regress/regress-869342.js18
-rw-r--r--deps/v8/test/mjsunit/harmony/async-generators-resume-return.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/async-generators-return.js7
-rw-r--r--deps/v8/test/mjsunit/harmony/async-generators-yield.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js16
-rw-r--r--deps/v8/test/mjsunit/harmony/bigint/turbo.js11
-rw-r--r--deps/v8/test/mjsunit/harmony/global-configurable.js8
-rw-r--r--deps/v8/test/mjsunit/harmony/global-writable.js8
-rw-r--r--deps/v8/test/mjsunit/harmony/global.js28
-rw-r--r--deps/v8/test/mjsunit/harmony/modules-import-namespace.js19
-rw-r--r--deps/v8/test/mjsunit/harmony/private-fields-special-object.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/promise-prototype-finally.js2
-rw-r--r--deps/v8/test/mjsunit/mjsunit.js110
-rw-r--r--deps/v8/test/mjsunit/mjsunit.status50
-rw-r--r--deps/v8/test/mjsunit/regress/regress-356053.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-357103.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-430201.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-430201b.js3
-rw-r--r--deps/v8/test/mjsunit/regress/regress-4325.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-5085.js66
-rw-r--r--deps/v8/test/mjsunit/regress/regress-599414-array-concat-fast-path.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-6700.js12
-rw-r--r--deps/v8/test/mjsunit/regress/regress-685.js43
-rw-r--r--deps/v8/test/mjsunit/regress/regress-7716.js32
-rw-r--r--deps/v8/test/mjsunit/regress/regress-797581.js5
-rw-r--r--deps/v8/test/mjsunit/regress/regress-8033.js45
-rw-r--r--deps/v8/test/mjsunit/regress/regress-865310.js20
-rw-r--r--deps/v8/test/mjsunit/regress/regress-869735.js14
-rw-r--r--deps/v8/test/mjsunit/regress/regress-875493.js20
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-380671.js1
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-759327.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-807096.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-830565.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-865312.js34
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-865892.js20
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-866315.js12
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-871886.js11
-rw-r--r--deps/v8/test/mjsunit/regress/regress-set-flags-stress-compact.js4
-rw-r--r--deps/v8/test/mjsunit/regress/regress-v8-8070.js23
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-776677.js2
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-8059.js42
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-873600.js50
-rw-r--r--deps/v8/test/mjsunit/regress/wasm/regress-875556.js19
-rw-r--r--deps/v8/test/mjsunit/sparse-array-reverse.js131
-rw-r--r--deps/v8/test/mjsunit/string-pad.js155
-rw-r--r--deps/v8/test/mjsunit/test-async.js117
-rw-r--r--deps/v8/test/mjsunit/testcfg.py57
-rw-r--r--deps/v8/test/mjsunit/tools/csvparser.js4
-rw-r--r--deps/v8/test/mjsunit/tools/profviz.js2
-rw-r--r--deps/v8/test/mjsunit/tools/tickprocessor.js8
-rw-r--r--deps/v8/test/mjsunit/wasm/asm-wasm-imports.js181
-rw-r--r--deps/v8/test/mjsunit/wasm/asm-wasm-memory.js212
-rw-r--r--deps/v8/test/mjsunit/wasm/asm-wasm.js356
-rw-r--r--deps/v8/test/mjsunit/wasm/atomics.js75
-rw-r--r--deps/v8/test/mjsunit/wasm/bounds-check-64bit.js5
-rw-r--r--deps/v8/test/mjsunit/wasm/empirical_max_memory.js85
-rw-r--r--deps/v8/test/mjsunit/wasm/ffi-error.js274
-rw-r--r--deps/v8/test/mjsunit/wasm/function-names.js2
-rw-r--r--deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js28
-rw-r--r--deps/v8/test/mjsunit/wasm/interpreter-mixed.js24
-rw-r--r--deps/v8/test/mjsunit/wasm/interpreter.js2
-rw-r--r--deps/v8/test/mjsunit/wasm/memory_1gb_oob.js99
-rw-r--r--deps/v8/test/mjsunit/wasm/memory_2gb_oob.js99
-rw-r--r--deps/v8/test/mjsunit/wasm/memory_4gb_oob.js97
-rw-r--r--deps/v8/test/mjsunit/wasm/module-memory.js6
-rw-r--r--deps/v8/test/mjsunit/wasm/origin-trial-flags.js35
-rw-r--r--deps/v8/test/mjsunit/wasm/wasm-constants.js4
-rw-r--r--deps/v8/test/mjsunit/wasm/worker-interpreter.js63
-rw-r--r--deps/v8/test/mjsunit/wasm/worker-module.js2
-rw-r--r--deps/v8/test/mkgrokdump/mkgrokdump.cc2
-rw-r--r--deps/v8/test/test262/test262.status22
-rw-r--r--deps/v8/test/test262/testcfg.py1
-rw-r--r--deps/v8/test/torque/test-torque.tq171
-rw-r--r--deps/v8/test/unittests/BUILD.gn42
-rw-r--r--deps/v8/test/unittests/api/remote-object-unittest.cc2
-rw-r--r--deps/v8/test/unittests/asmjs/asm-types-unittest.cc4
-rw-r--r--deps/v8/test/unittests/assembler/turbo-assembler-arm-unittest.cc78
-rw-r--r--deps/v8/test/unittests/assembler/turbo-assembler-arm64-unittest.cc78
-rw-r--r--deps/v8/test/unittests/assembler/turbo-assembler-ia32-unittest.cc62
-rw-r--r--deps/v8/test/unittests/assembler/turbo-assembler-mips-unittest.cc66
-rw-r--r--deps/v8/test/unittests/assembler/turbo-assembler-mips64-unittest.cc66
-rw-r--r--deps/v8/test/unittests/assembler/turbo-assembler-ppc-unittest.cc68
-rw-r--r--deps/v8/test/unittests/assembler/turbo-assembler-s390-unittest.cc68
-rw-r--r--deps/v8/test/unittests/assembler/turbo-assembler-x64-unittest.cc62
-rw-r--r--deps/v8/test/unittests/base/functional-unittest.cc8
-rw-r--r--deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc2
-rw-r--r--deps/v8/test/unittests/compiler-dispatcher/optimizing-compile-dispatcher-unittest.cc1
-rw-r--r--deps/v8/test/unittests/compiler-dispatcher/unoptimized-compile-job-unittest.cc2
-rw-r--r--deps/v8/test/unittests/compiler/arm/instruction-selector-arm-unittest.cc38
-rw-r--r--deps/v8/test/unittests/compiler/arm64/instruction-selector-arm64-unittest.cc77
-rw-r--r--deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc2
-rw-r--r--deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc4
-rw-r--r--deps/v8/test/unittests/compiler/graph-unittest.cc3
-rw-r--r--deps/v8/test/unittests/compiler/graph-unittest.h6
-rw-r--r--deps/v8/test/unittests/compiler/int64-lowering-unittest.cc2
-rw-r--r--deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc2
-rw-r--r--deps/v8/test/unittests/compiler/load-elimination-unittest.cc3
-rw-r--r--deps/v8/test/unittests/compiler/mips/OWNERS5
-rw-r--r--deps/v8/test/unittests/compiler/mips/instruction-selector-mips-unittest.cc56
-rw-r--r--deps/v8/test/unittests/compiler/mips64/OWNERS5
-rw-r--r--deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc2
-rw-r--r--deps/v8/test/unittests/compiler/typer-unittest.cc2
-rw-r--r--deps/v8/test/unittests/counters-unittest.cc129
-rw-r--r--deps/v8/test/unittests/heap/embedder-tracing-unittest.cc57
-rw-r--r--deps/v8/test/unittests/heap/heap-controller-unittest.cc80
-rw-r--r--deps/v8/test/unittests/heap/spaces-unittest.cc64
-rw-r--r--deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc3
-rw-r--r--deps/v8/test/unittests/object-unittest.cc1
-rw-r--r--deps/v8/test/unittests/parser/preparser-unittest.cc2
-rw-r--r--deps/v8/test/unittests/test-helpers.cc3
-rw-r--r--deps/v8/test/unittests/test-utils.cc18
-rw-r--r--deps/v8/test/unittests/test-utils.h7
-rw-r--r--deps/v8/test/unittests/torque/earley-parser-unittest.cc84
-rw-r--r--deps/v8/test/unittests/value-serializer-unittest.cc17
-rw-r--r--deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc71
-rw-r--r--deps/v8/test/unittests/wasm/module-decoder-unittest.cc228
-rw-r--r--deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc38
-rw-r--r--deps/v8/test/unittests/zone/zone-chunk-list-unittest.cc72
-rw-r--r--deps/v8/test/wasm-spec-tests/tests.tar.gz.sha12
-rw-r--r--deps/v8/test/webkit/webkit.status4
381 files changed, 14130 insertions, 3997 deletions
diff --git a/deps/v8/test/BUILD.gn b/deps/v8/test/BUILD.gn
index d0d2a40035..45e1b34032 100644
--- a/deps/v8/test/BUILD.gn
+++ b/deps/v8/test/BUILD.gn
@@ -45,6 +45,7 @@ group("v8_perf") {
data_deps = [
"cctest:cctest",
"..:d8",
+ "../tools:v8_android_test_runner_deps",
]
data = [
@@ -52,6 +53,7 @@ group("v8_perf") {
# TODO(machenbach): These files are referenced by the perf runner.
# They should be transformed into a proper python module.
+ "../tools/testrunner/local/android.py",
"../tools/testrunner/local/command.py",
"../tools/testrunner/local/utils.py",
"../tools/testrunner/objects/output.py",
@@ -62,15 +64,6 @@ group("v8_perf") {
"js-perf-test/",
"memory/",
]
-
- if (is_android && !build_with_chromium) {
- data_deps += [ "../build/android:test_runner_py" ]
-
- data += [
- # This is used by run_perf.py, but not included by test_runner_py above.
- "../third_party/catapult/devil/devil/android/perf/",
- ]
- }
}
group("v8_bot_default") {
diff --git a/deps/v8/test/cctest/BUILD.gn b/deps/v8/test/cctest/BUILD.gn
index 9072d6bed7..c4aa51b818 100644
--- a/deps/v8/test/cctest/BUILD.gn
+++ b/deps/v8/test/cctest/BUILD.gn
@@ -50,9 +50,10 @@ v8_source_set("cctest_sources") {
"$target_gen_dir/resources.cc",
### gcmole(all) ###
- "../../test/common/wasm/flag-utils.h",
- "../../test/common/wasm/test-signatures.h",
- "../../test/common/wasm/wasm-macro-gen.h",
+ "../common/assembler-tester.h",
+ "../common/wasm/flag-utils.h",
+ "../common/wasm/test-signatures.h",
+ "../common/wasm/wasm-macro-gen.h",
"cctest.cc",
"cctest.h",
"compiler/c-signature.h",
@@ -117,6 +118,7 @@ v8_source_set("cctest_sources") {
"heap/test-compaction.cc",
"heap/test-concurrent-marking.cc",
"heap/test-embedder-tracing.cc",
+ "heap/test-external-string-tracker.cc",
"heap/test-heap.cc",
"heap/test-incremental-marking.cc",
"heap/test-invalidated-slots.cc",
@@ -237,9 +239,11 @@ v8_source_set("cctest_sources") {
"types-fuzz.h",
"unicode-helpers.h",
"wasm/test-c-wasm-entry.cc",
+ "wasm/test-jump-table-assembler.cc",
"wasm/test-run-wasm-64.cc",
"wasm/test-run-wasm-asmjs.cc",
"wasm/test-run-wasm-atomics.cc",
+ "wasm/test-run-wasm-atomics64.cc",
"wasm/test-run-wasm-interpreter.cc",
"wasm/test-run-wasm-js.cc",
"wasm/test-run-wasm-module.cc",
@@ -296,7 +300,6 @@ v8_source_set("cctest_sources") {
"test-sync-primitives-arm64.cc",
"test-utils-arm64.cc",
"test-utils-arm64.h",
- "wasm/test-run-wasm-atomics64.cc",
]
} else if (v8_current_cpu == "x86") {
sources += [ ### gcmole(arch:ia32) ###
@@ -352,7 +355,6 @@ v8_source_set("cctest_sources") {
"test-disasm-x64.cc",
"test-log-stack-tracer.cc",
"test-macro-assembler-x64.cc",
- "wasm/test-run-wasm-atomics64.cc",
]
} else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
sources += [ ### gcmole(arch:ppc) ###
diff --git a/deps/v8/test/cctest/OWNERS b/deps/v8/test/cctest/OWNERS
index 87396a0535..43d91faf84 100644
--- a/deps/v8/test/cctest/OWNERS
+++ b/deps/v8/test/cctest/OWNERS
@@ -1,6 +1,5 @@
-per-file *-mips*=ivica.bogosavljevic@mips.com
-per-file *-mips*=Miran.Karic@mips.com
-per-file *-mips*=sreten.kovacevic@mips.com
+per-file *-mips*=ibogosavljevic@wavecomp.com
+per-file *-mips*=skovacevic@wavecomp.com
per-file *-ppc*=dstence@us.ibm.com
per-file *-ppc*=joransiu@ca.ibm.com
per-file *-ppc*=jyan@ca.ibm.com
diff --git a/deps/v8/test/cctest/cctest.h b/deps/v8/test/cctest/cctest.h
index 8bae124ea1..383771710a 100644
--- a/deps/v8/test/cctest/cctest.h
+++ b/deps/v8/test/cctest/cctest.h
@@ -32,7 +32,6 @@
#include "include/libplatform/libplatform.h"
#include "include/v8-platform.h"
-#include "src/assembler.h"
#include "src/debug/debug-interface.h"
#include "src/flags.h"
#include "src/heap/factory.h"
@@ -548,32 +547,6 @@ static inline void CheckDoubleEquals(double expected, double actual) {
CHECK_GE(expected, actual - kEpsilon);
}
-static inline uint8_t* AllocateAssemblerBuffer(
- size_t* allocated,
- size_t requested = v8::internal::AssemblerBase::kMinimalBufferSize) {
- size_t page_size = v8::internal::AllocatePageSize();
- size_t alloc_size = RoundUp(requested, page_size);
- void* result = v8::internal::AllocatePages(
- nullptr, alloc_size, page_size, v8::PageAllocator::kReadWriteExecute);
- CHECK(result);
- *allocated = alloc_size;
- return static_cast<uint8_t*>(result);
-}
-
-static inline void MakeAssemblerBufferExecutable(uint8_t* buffer,
- size_t allocated) {
- bool result = v8::internal::SetPermissions(buffer, allocated,
- v8::PageAllocator::kReadExecute);
- CHECK(result);
-}
-
-static inline void MakeAssemblerBufferWritable(uint8_t* buffer,
- size_t allocated) {
- bool result = v8::internal::SetPermissions(buffer, allocated,
- v8::PageAllocator::kReadWrite);
- CHECK(result);
-}
-
static v8::debug::DebugDelegate dummy_delegate;
static inline void EnableDebugger(v8::Isolate* isolate) {
diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status
index a7fcb4f237..c59c443b06 100644
--- a/deps/v8/test/cctest/cctest.status
+++ b/deps/v8/test/cctest/cctest.status
@@ -345,6 +345,13 @@
}], # '(arch == mipsel or arch == mips64el or arch == mips or arch == mips64) and not simd_mips'
##############################################################################
+['arch == mipsel or arch == mips64el or arch == mips or arch == mips64 or arch == ppc or arch == ppc64 or arch == s390 or arch == s390x', {
+ # TODO(mips-team): Implement I64Atomic operations on MIPS
+ # TODO(ppc-team, s390-team): Implement I64Atomic operations on PPC/s390
+ 'test-run-wasm-atomics64/*': [SKIP],
+}], # 'arch == mipsel or arch == mips64el or arch == mips or arch == mips64 or arch == ppc or arch == ppc64 or arch == s390 or arch == s390x'
+
+##############################################################################
['mips_arch_variant == r6', {
# For MIPS[64] architecture release 6, fusion multiply-accumulate instructions
# will cause failures on several tests that expect exact floating-point
@@ -383,6 +390,7 @@
# TODO(ppc): Implement load/store reverse byte instructions
'test-run-wasm-simd/RunWasmCompiled_SimdLoadStoreLoad': [SKIP],
'test-run-wasm-simd/RunWasm_SimdLoadStoreLoad': [SKIP],
+ 'test-run-wasm-simd/RunWasm_SimdLoadStoreLoad_turbofan': [SKIP],
}], # 'system == aix or (arch == ppc64 and byteorder == big)'
@@ -404,57 +412,6 @@
}], # 'arch == ppc or arch == ppc64 or arch == s390 or arch == s390x'
##############################################################################
-['byteorder == big', {
-
- # BUG(7827). fix simd globals for big endian
- 'test-run-wasm-simd/RunWasm_SimdI32x4GetGlobal_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_SimdI32x4SetGlobal_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_SimdF32x4GetGlobal_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_SimdF32x4SetGlobal_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_SimdLoadStoreLoad_simd_turbofan': [SKIP],
- 'test-run-wasm-simd/RunWasm_SimdLoadStoreLoad_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_SimdLoadStoreLoad_simd_lowered': [SKIP],
- 'test-run-wasm-simd/RunWasm_I32x4AddHoriz_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_I16x8AddHoriz_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_F32x4AddHoriz_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S32x4Dup_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S32x4ZipLeft_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S32x4ZipRight_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S32x4UnzipLeft_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S32x4UnzipRight_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S32x4TransposeLeft_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S32x4TransposeRight_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S32x2Reverse_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S32x4Irregular_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S16x8Dup_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S16x8ZipLeft_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S16x8ZipRight_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S16x8UnzipLeft_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S16x8UnzipRight_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S16x8TransposeLeft_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S16x8TransposeRight_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S16x4Reverse_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S16x2Reverse_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S16x8Irregular_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x16Dup_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x16ZipLeft_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x16ZipRight_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x16UnzipLeft_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x16UnzipRight_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x16TransposeLeft_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x16TransposeRight_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x8Reverse_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x4Reverse_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x2Reverse_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x16Irregular_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x16Blend_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_S8x16Concat_interpreter': [SKIP],
- 'test-run-wasm-simd/RunWasm_I16x8ConvertI32x4*': [SKIP],
- 'test-run-wasm-simd/RunWasm_I8x16ConvertI16x8*': [SKIP],
-
-}], # 'byteorder == big'
-
-##############################################################################
['variant == stress_incremental_marking', {
'test-heap-profiler/SamplingHeapProfiler': [SKIP],
}], # variant == stress_incremental_marking
diff --git a/deps/v8/test/cctest/compiler/code-assembler-tester.h b/deps/v8/test/cctest/compiler/code-assembler-tester.h
index 1edb3fdf4b..7c88998f8a 100644
--- a/deps/v8/test/cctest/compiler/code-assembler-tester.h
+++ b/deps/v8/test/cctest/compiler/code-assembler-tester.h
@@ -60,6 +60,10 @@ class CodeAssemblerTester {
&state_, AssemblerOptions::Default(scope_.isolate()));
}
+ Handle<Code> GenerateCode(const AssemblerOptions& options) {
+ return CodeAssembler::GenerateCode(&state_, options);
+ }
+
Handle<Code> GenerateCodeCloseAndEscape() {
return scope_.CloseAndEscape(GenerateCode());
}
diff --git a/deps/v8/test/cctest/compiler/function-tester.cc b/deps/v8/test/cctest/compiler/function-tester.cc
index c3abcf7a15..86678606d4 100644
--- a/deps/v8/test/cctest/compiler/function-tester.cc
+++ b/deps/v8/test/cctest/compiler/function-tester.cc
@@ -4,7 +4,7 @@
#include "test/cctest/compiler/function-tester.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/compiler.h"
#include "src/compiler/linkage.h"
#include "src/compiler/pipeline.h"
@@ -21,6 +21,7 @@ namespace compiler {
FunctionTester::FunctionTester(const char* source, uint32_t flags)
: isolate(main_isolate()),
+ canonical(isolate),
function((FLAG_allow_natives_syntax = true, NewFunction(source))),
flags_(flags) {
Compile(function);
@@ -30,6 +31,7 @@ FunctionTester::FunctionTester(const char* source, uint32_t flags)
FunctionTester::FunctionTester(Graph* graph, int param_count)
: isolate(main_isolate()),
+ canonical(isolate),
function(NewFunction(BuildFunction(param_count).c_str())),
flags_(0) {
CompileGraph(graph);
@@ -37,6 +39,7 @@ FunctionTester::FunctionTester(Graph* graph, int param_count)
FunctionTester::FunctionTester(Handle<Code> code, int param_count)
: isolate(main_isolate()),
+ canonical(isolate),
function((FLAG_allow_natives_syntax = true,
NewFunction(BuildFunction(param_count).c_str()))),
flags_(0) {
diff --git a/deps/v8/test/cctest/compiler/function-tester.h b/deps/v8/test/cctest/compiler/function-tester.h
index abcb924cec..6e0146958f 100644
--- a/deps/v8/test/cctest/compiler/function-tester.h
+++ b/deps/v8/test/cctest/compiler/function-tester.h
@@ -31,6 +31,7 @@ class FunctionTester : public InitializedHandleScope {
explicit FunctionTester(Handle<Code> code);
Isolate* isolate;
+ CanonicalHandleScope canonical;
Handle<JSFunction> function;
MaybeHandle<Object> Call() {
diff --git a/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc b/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc
index 663b66b74d..f961021913 100644
--- a/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc
+++ b/deps/v8/test/cctest/compiler/test-basic-block-profiler.cc
@@ -18,12 +18,11 @@ class BasicBlockProfilerTest : public RawMachineAssemblerTester<int32_t> {
FLAG_turbo_profiling = true;
}
- void ResetCounts() { isolate()->basic_block_profiler()->ResetCounts(); }
+ void ResetCounts() { BasicBlockProfiler::Get()->ResetCounts(); }
void Expect(size_t size, uint32_t* expected) {
- CHECK(isolate()->basic_block_profiler());
const BasicBlockProfiler::DataList* l =
- isolate()->basic_block_profiler()->data_list();
+ BasicBlockProfiler::Get()->data_list();
CHECK_NE(0, static_cast<int>(l->size()));
const BasicBlockProfiler::Data* data = l->back();
CHECK_EQ(static_cast<int>(size), static_cast<int>(data->n_blocks()));
diff --git a/deps/v8/test/cctest/compiler/test-code-generator.cc b/deps/v8/test/cctest/compiler/test-code-generator.cc
index 9a7b590f5a..a3b80bc887 100644
--- a/deps/v8/test/cctest/compiler/test-code-generator.cc
+++ b/deps/v8/test/cctest/compiler/test-code-generator.cc
@@ -83,8 +83,8 @@ Handle<Code> BuildSetupFunction(Isolate* isolate,
// First allocate the FixedArray which will hold the final results. Here we
// should take care of all allocations, meaning we allocate HeapNumbers and
// FixedArrays representing Simd128 values.
- Node* state_out = __ AllocateFixedArray(PACKED_ELEMENTS,
- __ IntPtrConstant(parameters.size()));
+ TNode<FixedArray> state_out = __ Cast(__ AllocateFixedArray(
+ PACKED_ELEMENTS, __ IntPtrConstant(parameters.size())));
for (int i = 0; i < static_cast<int>(parameters.size()); i++) {
switch (parameters[i].representation()) {
case MachineRepresentation::kTagged:
@@ -94,8 +94,8 @@ Handle<Code> BuildSetupFunction(Isolate* isolate,
__ StoreFixedArrayElement(state_out, i, __ AllocateHeapNumber());
break;
case MachineRepresentation::kSimd128: {
- Node* vector =
- __ AllocateFixedArray(PACKED_SMI_ELEMENTS, __ IntPtrConstant(4));
+ TNode<FixedArray> vector = __ Cast(
+ __ AllocateFixedArray(PACKED_SMI_ELEMENTS, __ IntPtrConstant(4)));
for (int lane = 0; lane < 4; lane++) {
__ StoreFixedArrayElement(vector, lane, __ SmiConstant(0));
}
@@ -109,7 +109,7 @@ Handle<Code> BuildSetupFunction(Isolate* isolate,
}
params.push_back(state_out);
// Then take each element of the initial state and pass them as arguments.
- Node* state_in = __ Parameter(1);
+ TNode<FixedArray> state_in = __ Cast(__ Parameter(1));
for (int i = 0; i < static_cast<int>(parameters.size()); i++) {
Node* element = __ LoadFixedArrayElement(state_in, __ IntPtrConstant(i));
// Unbox all elements before passing them as arguments.
@@ -197,7 +197,7 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate,
std::vector<AllocatedOperand> parameters) {
CodeAssemblerTester tester(isolate, call_descriptor, "teardown");
CodeStubAssembler assembler(tester.state());
- Node* result_array = __ Parameter(1);
+ TNode<FixedArray> result_array = __ Cast(__ Parameter(1));
for (int i = 0; i < static_cast<int>(parameters.size()); i++) {
// The first argument is not used and the second is "result_array".
Node* param = __ Parameter(i + 2);
@@ -216,7 +216,8 @@ Handle<Code> BuildTeardownFunction(Isolate* isolate,
param, MachineRepresentation::kFloat64);
break;
case MachineRepresentation::kSimd128: {
- Node* vector = __ LoadFixedArrayElement(result_array, i);
+ TNode<FixedArray> vector =
+ __ Cast(__ LoadFixedArrayElement(result_array, i));
for (int lane = 0; lane < 4; lane++) {
Node* lane_value =
__ SmiFromInt32(tester.raw_assembler_for_testing()->AddNode(
@@ -995,8 +996,7 @@ class CodeGeneratorTester {
generator_ = new CodeGenerator(
environment->main_zone(), &frame_, &linkage_, environment->code(),
&info_, environment->main_isolate(), base::Optional<OsrHelper>(),
- kNoSourcePosition, nullptr, nullptr,
- PoisoningMitigationLevel::kDontPoison,
+ kNoSourcePosition, nullptr, PoisoningMitigationLevel::kDontPoison,
AssemblerOptions::Default(environment->main_isolate()),
Builtins::kNoBuiltinId);
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 5843c51698..a31700ede2 100644
--- a/deps/v8/test/cctest/compiler/test-js-constant-cache.cc
+++ b/deps/v8/test/cctest/compiler/test-js-constant-cache.cc
@@ -15,7 +15,7 @@ namespace compiler {
class JSCacheTesterHelper {
protected:
- JSCacheTesterHelper(Isolate* isolate, Zone* zone)
+ explicit JSCacheTesterHelper(Zone* zone)
: main_graph_(zone),
main_common_(zone),
main_javascript_(zone),
@@ -33,7 +33,7 @@ class JSConstantCacheTester : public HandleAndZoneScope,
public JSGraph {
public:
JSConstantCacheTester()
- : JSCacheTesterHelper(main_isolate(), main_zone()),
+ : JSCacheTesterHelper(main_zone()),
JSGraph(main_isolate(), &main_graph_, &main_common_, &main_javascript_,
nullptr, &main_machine_) {
main_graph_.SetStart(main_graph_.NewNode(common()->Start(0)));
diff --git a/deps/v8/test/cctest/compiler/test-js-context-specialization.cc b/deps/v8/test/cctest/compiler/test-js-context-specialization.cc
index 6560bae096..7938c50069 100644
--- a/deps/v8/test/cctest/compiler/test-js-context-specialization.cc
+++ b/deps/v8/test/cctest/compiler/test-js-context-specialization.cc
@@ -22,7 +22,8 @@ namespace compiler {
class ContextSpecializationTester : public HandleAndZoneScope {
public:
explicit ContextSpecializationTester(Maybe<OuterContext> context)
- : graph_(new (main_zone()) Graph(main_zone())),
+ : canonical_(main_isolate()),
+ graph_(new (main_zone()) Graph(main_zone())),
common_(main_zone()),
javascript_(main_zone()),
machine_(main_zone()),
@@ -30,7 +31,7 @@ class ContextSpecializationTester : public HandleAndZoneScope {
jsgraph_(main_isolate(), graph(), common(), &javascript_, &simplified_,
&machine_),
reducer_(main_zone(), graph()),
- js_heap_broker_(main_isolate()),
+ js_heap_broker_(main_isolate(), main_zone()),
spec_(&reducer_, jsgraph(), &js_heap_broker_, context,
MaybeHandle<JSFunction>()) {}
@@ -50,6 +51,7 @@ class ContextSpecializationTester : public HandleAndZoneScope {
size_t expected_new_depth);
private:
+ CanonicalHandleScope canonical_;
Graph* graph_;
CommonOperatorBuilder common_;
JSOperatorBuilder javascript_;
@@ -106,6 +108,11 @@ void ContextSpecializationTester::CheckContextInputAndDepthChanges(
static const int slot_index = Context::NATIVE_CONTEXT_INDEX;
TEST(ReduceJSLoadContext0) {
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
ContextSpecializationTester t(Nothing<OuterContext>());
Node* start = t.graph()->NewNode(t.common()->Start(0));
@@ -170,6 +177,8 @@ TEST(ReduceJSLoadContext0) {
CHECK(match.HasValue());
CHECK_EQ(*expected, *match.Value());
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(ReduceJSLoadContext1) {
@@ -247,6 +256,11 @@ TEST(ReduceJSLoadContext2) {
// context2 <-- context1 <-- context0 (= HeapConstant(context_object1))
// context_object1 <~~ context_object0
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
ContextSpecializationTester t(Nothing<OuterContext>());
Node* start = t.graph()->NewNode(t.common()->Start(0));
@@ -317,6 +331,8 @@ TEST(ReduceJSLoadContext2) {
t.javascript()->LoadContext(3, slot_index, true), context2, start);
t.CheckChangesToValue(load, slot_value0);
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(ReduceJSLoadContext3) {
@@ -326,6 +342,11 @@ TEST(ReduceJSLoadContext3) {
// context_object2 from ReduceJSLoadContext2 for this, so almost all test
// expectations are the same as in ReduceJSLoadContext2.
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
HandleAndZoneScope handle_zone_scope;
auto factory = handle_zone_scope.main_isolate()->factory();
@@ -400,9 +421,16 @@ TEST(ReduceJSLoadContext3) {
t.javascript()->LoadContext(3, slot_index, true), context2, start);
t.CheckChangesToValue(load, slot_value0);
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(ReduceJSStoreContext0) {
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
ContextSpecializationTester t(Nothing<OuterContext>());
Node* start = t.graph()->NewNode(t.common()->Start(0));
@@ -462,6 +490,8 @@ TEST(ReduceJSStoreContext0) {
CHECK_EQ(0, static_cast<int>(access.depth()));
CHECK_EQ(false, access.immutable());
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(ReduceJSStoreContext1) {
@@ -509,6 +539,11 @@ TEST(ReduceJSStoreContext1) {
}
TEST(ReduceJSStoreContext2) {
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
ContextSpecializationTester t(Nothing<OuterContext>());
Node* start = t.graph()->NewNode(t.common()->Start(0));
@@ -559,9 +594,16 @@ TEST(ReduceJSStoreContext2) {
context2, context2, start, start);
t.CheckContextInputAndDepthChanges(store, context_object0, 0);
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(ReduceJSStoreContext3) {
+ // TODO(neis): The native context below does not have all the fields
+ // initialized that the heap broker wants to serialize.
+ bool concurrent_compiler_frontend = FLAG_concurrent_compiler_frontend;
+ FLAG_concurrent_compiler_frontend = false;
+
HandleAndZoneScope handle_zone_scope;
auto factory = handle_zone_scope.main_isolate()->factory();
@@ -616,6 +658,8 @@ TEST(ReduceJSStoreContext3) {
context2, context2, start, start);
t.CheckContextInputAndDepthChanges(store, context_object0, 0);
}
+
+ FLAG_concurrent_compiler_frontend = concurrent_compiler_frontend;
}
TEST(SpecializeJSFunction_ToConstant1) {
diff --git a/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc b/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc
index 3f969f8bfe..eec562cf36 100644
--- a/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc
+++ b/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc
@@ -23,7 +23,8 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
public:
explicit JSTypedLoweringTester(int num_parameters = 0)
: isolate(main_isolate()),
- js_heap_broker(isolate),
+ canonical(isolate),
+ js_heap_broker(isolate, main_zone()),
binop(nullptr),
unop(nullptr),
javascript(main_zone()),
@@ -39,6 +40,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope {
}
Isolate* isolate;
+ CanonicalHandleScope canonical;
JSHeapBroker js_heap_broker;
const Operator* binop;
const Operator* unop;
@@ -605,7 +607,8 @@ static void CheckIsConvertedToNumber(Node* val, Node* converted) {
CHECK_EQ(val, converted);
} else {
if (converted->opcode() == IrOpcode::kNumberConstant) return;
- CHECK_EQ(IrOpcode::kJSToNumber, converted->opcode());
+ CHECK(IrOpcode::kJSToNumber == converted->opcode() ||
+ IrOpcode::kJSToNumberConvertBigInt == converted->opcode());
CHECK_EQ(val, converted->InputAt(0));
}
}
diff --git a/deps/v8/test/cctest/compiler/test-linkage.cc b/deps/v8/test/cctest/compiler/test-linkage.cc
index 39ef66c5eb..38c5d17b6b 100644
--- a/deps/v8/test/cctest/compiler/test-linkage.cc
+++ b/deps/v8/test/cctest/compiler/test-linkage.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/code-factory.h"
#include "src/code-stubs.h"
#include "src/compiler.h"
@@ -35,8 +35,9 @@ static Handle<JSFunction> Compile(const char* source) {
.ToHandleChecked();
Handle<SharedFunctionInfo> shared =
Compiler::GetSharedFunctionInfoForScript(
- source_code, Compiler::ScriptDetails(), v8::ScriptOriginOptions(),
- nullptr, nullptr, v8::ScriptCompiler::kNoCompileOptions,
+ isolate, source_code, Compiler::ScriptDetails(),
+ v8::ScriptOriginOptions(), nullptr, nullptr,
+ v8::ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked();
return isolate->factory()->NewFunctionFromSharedFunctionInfo(
diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc
index 13496ae829..b591d193e7 100644
--- a/deps/v8/test/cctest/compiler/test-multiple-return.cc
+++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc
@@ -130,92 +130,104 @@ std::unique_ptr<wasm::NativeModule> AllocateNativeModule(Isolate* isolate,
// WasmCallDescriptor assumes that code is on the native heap and not
// within a code object.
return isolate->wasm_engine()->code_manager()->NewNativeModule(
- isolate, code_size, false, std::move(module), env);
+ isolate, wasm::kAllWasmFeatures, code_size, false, std::move(module),
+ env);
}
void TestReturnMultipleValues(MachineType type) {
const int kMaxCount = 20;
- for (int count = 0; count < kMaxCount; ++count) {
- printf("\n==== type = %s, count = %d ====\n\n\n",
- MachineReprToString(type.representation()), count);
- v8::internal::AccountingAllocator allocator;
- Zone zone(&allocator, ZONE_NAME);
- CallDescriptor* desc = CreateCallDescriptor(&zone, count, 2, type);
- HandleAndZoneScope handles;
- RawMachineAssembler m(handles.main_isolate(),
- new (handles.main_zone()) Graph(handles.main_zone()),
- desc, MachineType::PointerRepresentation(),
- InstructionSelector::SupportedMachineOperatorFlags());
-
- // m.Parameter(0) is the WasmContext.
- Node* p0 = m.Parameter(1);
- Node* p1 = m.Parameter(2);
- typedef Node* Node_ptr;
- std::unique_ptr<Node_ptr[]> returns(new Node_ptr[count]);
- for (int i = 0; i < count; ++i) {
- if (i % 3 == 0) returns[i] = Add(m, type, p0, p1);
- if (i % 3 == 1) returns[i] = Sub(m, type, p0, p1);
- if (i % 3 == 2) returns[i] = Mul(m, type, p0, p1);
- }
- m.Return(count, returns.get());
-
- OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(),
- Code::WASM_FUNCTION);
- Handle<Code> code =
- Pipeline::GenerateCodeForTesting(
- &info, handles.main_isolate(), desc, m.graph(),
- AssemblerOptions::Default(handles.main_isolate()), m.Export())
- .ToHandleChecked();
+ const int kMaxParamCount = 9;
+ // Use 9 parameters as a regression test or https://crbug.com/838098.
+ for (int param_count : {2, kMaxParamCount}) {
+ for (int count = 0; count < kMaxCount; ++count) {
+ printf("\n==== type = %s, count = %d ====\n\n\n",
+ MachineReprToString(type.representation()), count);
+ v8::internal::AccountingAllocator allocator;
+ Zone zone(&allocator, ZONE_NAME);
+ CallDescriptor* desc =
+ CreateCallDescriptor(&zone, count, param_count, type);
+ HandleAndZoneScope handles;
+ RawMachineAssembler m(
+ handles.main_isolate(),
+ new (handles.main_zone()) Graph(handles.main_zone()), desc,
+ MachineType::PointerRepresentation(),
+ InstructionSelector::SupportedMachineOperatorFlags());
+
+ // m.Parameter(0) is the WasmContext.
+ Node* p0 = m.Parameter(1);
+ Node* p1 = m.Parameter(2);
+ typedef Node* Node_ptr;
+ std::unique_ptr<Node_ptr[]> returns(new Node_ptr[count]);
+ for (int i = 0; i < count; ++i) {
+ if (i % 3 == 0) returns[i] = Add(m, type, p0, p1);
+ if (i % 3 == 1) returns[i] = Sub(m, type, p0, p1);
+ if (i % 3 == 2) returns[i] = Mul(m, type, p0, p1);
+ }
+ m.Return(count, returns.get());
+
+ OptimizedCompilationInfo info(ArrayVector("testing"), handles.main_zone(),
+ Code::WASM_FUNCTION);
+ Handle<Code> code =
+ Pipeline::GenerateCodeForTesting(
+ &info, handles.main_isolate(), desc, m.graph(),
+ AssemblerOptions::Default(handles.main_isolate()), m.Export())
+ .ToHandleChecked();
#ifdef ENABLE_DISASSEMBLER
- if (FLAG_print_code) {
- StdoutStream os;
- code->Disassemble("multi_value", os);
- }
+ if (FLAG_print_code) {
+ StdoutStream os;
+ code->Disassemble("multi_value", os);
+ }
#endif
- const int a = 47, b = 12;
- int expect = 0;
- for (int i = 0, sign = +1; i < count; ++i) {
- if (i % 3 == 0) expect += sign * (a + b);
- if (i % 3 == 1) expect += sign * (a - b);
- if (i % 3 == 2) expect += sign * (a * b);
- if (i % 4 == 0) sign = -sign;
- }
-
- std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule(
- handles.main_isolate(), code->raw_instruction_size());
- byte* code_start = module->AddCodeCopy(code, wasm::WasmCode::kFunction, 0)
- ->instructions()
- .start();
-
- RawMachineAssemblerTester<int32_t> mt;
- Node* call_inputs[] = {mt.PointerConstant(code_start),
- // WasmContext dummy
- mt.PointerConstant(nullptr),
- // Inputs
- MakeConstant(mt, type, a),
- MakeConstant(mt, type, b)};
-
- Node* ret_multi = mt.AddNode(mt.common()->Call(desc),
- arraysize(call_inputs), call_inputs);
- Node* ret = MakeConstant(mt, type, 0);
- bool sign = false;
- for (int i = 0; i < count; ++i) {
- Node* x = (count == 1)
- ? ret_multi
- : mt.AddNode(mt.common()->Projection(i), ret_multi);
- ret = sign ? Sub(mt, type, ret, x) : Add(mt, type, ret, x);
- if (i % 4 == 0) sign = !sign;
- }
- mt.Return(ToInt32(mt, type, ret));
+ const int a = 47, b = 12;
+ int expect = 0;
+ for (int i = 0, sign = +1; i < count; ++i) {
+ if (i % 3 == 0) expect += sign * (a + b);
+ if (i % 3 == 1) expect += sign * (a - b);
+ if (i % 3 == 2) expect += sign * (a * b);
+ if (i % 4 == 0) sign = -sign;
+ }
+
+ std::unique_ptr<wasm::NativeModule> module = AllocateNativeModule(
+ handles.main_isolate(), code->raw_instruction_size());
+ byte* code_start = module->AddCodeCopy(code, wasm::WasmCode::kFunction, 0)
+ ->instructions()
+ .start();
+
+ RawMachineAssemblerTester<int32_t> mt;
+ const int input_count = 2 + param_count;
+ Node* call_inputs[2 + kMaxParamCount];
+ call_inputs[0] = mt.PointerConstant(code_start);
+ // WasmContext dummy
+ call_inputs[1] = mt.PointerConstant(nullptr);
+ // Special inputs for the test.
+ call_inputs[2] = MakeConstant(mt, type, a);
+ call_inputs[3] = MakeConstant(mt, type, b);
+ for (int i = 2; i < param_count; i++) {
+ call_inputs[2 + i] = MakeConstant(mt, type, i);
+ }
+
+ Node* ret_multi = mt.AddNode(mt.common()->Call(desc),
+ input_count, call_inputs);
+ Node* ret = MakeConstant(mt, type, 0);
+ bool sign = false;
+ for (int i = 0; i < count; ++i) {
+ Node* x = (count == 1)
+ ? ret_multi
+ : mt.AddNode(mt.common()->Projection(i), ret_multi);
+ ret = sign ? Sub(mt, type, ret, x) : Add(mt, type, ret, x);
+ if (i % 4 == 0) sign = !sign;
+ }
+ mt.Return(ToInt32(mt, type, ret));
#ifdef ENABLE_DISASSEMBLER
- Handle<Code> code2 = mt.GetCode();
- if (FLAG_print_code) {
- StdoutStream os;
- code2->Disassemble("multi_value_call", os);
- }
+ Handle<Code> code2 = mt.GetCode();
+ if (FLAG_print_code) {
+ StdoutStream os;
+ code2->Disassemble("multi_value_call", os);
+ }
#endif
- CHECK_EQ(expect, mt.Call());
+ CHECK_EQ(expect, mt.Call());
+ }
}
}
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 3e0e019fd2..c62ed69105 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
@@ -4,7 +4,7 @@
#include <utility>
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/compiler/pipeline.h"
#include "src/debug/debug-interface.h"
#include "src/execution.h"
diff --git a/deps/v8/test/cctest/compiler/test-run-jscalls.cc b/deps/v8/test/cctest/compiler/test-run-jscalls.cc
index 1b6d4fc49f..b1e9ddfce3 100644
--- a/deps/v8/test/cctest/compiler/test-run-jscalls.cc
+++ b/deps/v8/test/cctest/compiler/test-run-jscalls.cc
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
#include "src/contexts.h"
#include "src/flags.h"
#include "src/objects-inl.h"
diff --git a/deps/v8/test/cctest/compiler/test-run-machops.cc b/deps/v8/test/cctest/compiler/test-run-machops.cc
index 709c14e88e..71adbc738d 100644
--- a/deps/v8/test/cctest/compiler/test-run-machops.cc
+++ b/deps/v8/test/cctest/compiler/test-run-machops.cc
@@ -85,11 +85,7 @@ TEST(RunWord32ReverseBits) {
TEST(RunWord32ReverseBytes) {
BufferedRawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- if (!m.machine()->Word32ReverseBytes().IsSupported()) {
- // We can only test the operator if it exists on the testing platform.
- return;
- }
- m.Return(m.AddNode(m.machine()->Word32ReverseBytes().op(), m.Parameter(0)));
+ m.Return(m.AddNode(m.machine()->Word32ReverseBytes(), m.Parameter(0)));
CHECK_EQ(uint32_t(0x00000000), m.Call(uint32_t(0x00000000)));
CHECK_EQ(uint32_t(0x12345678), m.Call(uint32_t(0x78563412)));
@@ -224,11 +220,7 @@ TEST(RunWord64ReverseBits) {
TEST(RunWord64ReverseBytes) {
BufferedRawMachineAssemblerTester<uint64_t> m(MachineType::Uint64());
- if (!m.machine()->Word64ReverseBytes().IsSupported()) {
- return;
- }
-
- m.Return(m.AddNode(m.machine()->Word64ReverseBytes().op(), m.Parameter(0)));
+ m.Return(m.AddNode(m.machine()->Word64ReverseBytes(), m.Parameter(0)));
CHECK_EQ(uint64_t(0x0000000000000000), m.Call(uint64_t(0x0000000000000000)));
CHECK_EQ(uint64_t(0x1234567890ABCDEF), m.Call(uint64_t(0xEFCDAB9078563412)));
@@ -2396,7 +2388,7 @@ TEST(RunWord32AndP) {
{
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
- bt.AddReturn(m.Word32And(bt.param0, m.Word32Not(bt.param1)));
+ bt.AddReturn(m.Word32And(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
int32_t expected = *i & ~(*j);
@@ -2407,7 +2399,7 @@ TEST(RunWord32AndP) {
{
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
- bt.AddReturn(m.Word32And(m.Word32Not(bt.param0), bt.param1));
+ bt.AddReturn(m.Word32And(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
int32_t expected = ~(*i) & *j;
@@ -2516,7 +2508,8 @@ TEST(RunWord32AndImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32And(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
+ m.Return(
+ 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));
@@ -2709,7 +2702,7 @@ TEST(RunWord32OrP) {
{
RawMachineAssemblerTester<int32_t> m;
Uint32BinopTester bt(&m);
- bt.AddReturn(m.Word32Or(bt.param0, m.Word32Not(bt.param1)));
+ bt.AddReturn(m.Word32Or(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = *i | ~(*j);
@@ -2720,7 +2713,7 @@ TEST(RunWord32OrP) {
{
RawMachineAssemblerTester<int32_t> m;
Uint32BinopTester bt(&m);
- bt.AddReturn(m.Word32Or(m.Word32Not(bt.param0), bt.param1));
+ bt.AddReturn(m.Word32Or(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_UINT32_INPUTS(i) {
FOR_UINT32_INPUTS(j) {
uint32_t expected = ~(*i) | *j;
@@ -2745,7 +2738,8 @@ TEST(RunWord32OrImm) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Or(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
+ m.Return(
+ 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));
@@ -2947,7 +2941,7 @@ TEST(RunWord32XorP) {
{
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
- bt.AddReturn(m.Word32Xor(bt.param0, m.Word32Not(bt.param1)));
+ bt.AddReturn(m.Word32Xor(bt.param0, m.Word32BitwiseNot(bt.param1)));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected = *i ^ ~(*j);
@@ -2958,7 +2952,7 @@ TEST(RunWord32XorP) {
{
RawMachineAssemblerTester<int32_t> m;
Int32BinopTester bt(&m);
- bt.AddReturn(m.Word32Xor(m.Word32Not(bt.param0), bt.param1));
+ bt.AddReturn(m.Word32Xor(m.Word32BitwiseNot(bt.param0), bt.param1));
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
int32_t expected = ~(*i) ^ *j;
@@ -2969,7 +2963,8 @@ TEST(RunWord32XorP) {
{
FOR_UINT32_INPUTS(i) {
RawMachineAssemblerTester<uint32_t> m(MachineType::Uint32());
- m.Return(m.Word32Xor(m.Int32Constant(*i), m.Word32Not(m.Parameter(0))));
+ m.Return(
+ 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));
@@ -3454,10 +3449,9 @@ TEST(RunWord32RorInComparison) {
}
}
-
-TEST(RunWord32NotP) {
+TEST(RunWord32BitwiseNotP) {
RawMachineAssemblerTester<int32_t> m(MachineType::Int32());
- m.Return(m.Word32Not(m.Parameter(0)));
+ m.Return(m.Word32BitwiseNot(m.Parameter(0)));
FOR_INT32_INPUTS(i) {
int expected = ~(*i);
CHECK_EQ(expected, m.Call(*i));
diff --git a/deps/v8/test/cctest/compiler/test-run-retpoline.cc b/deps/v8/test/cctest/compiler/test-run-retpoline.cc
index 4e5f99f413..3bbab4265f 100644
--- a/deps/v8/test/cctest/compiler/test-run-retpoline.cc
+++ b/deps/v8/test/cctest/compiler/test-run-retpoline.cc
@@ -128,6 +128,7 @@ CallDescriptor* CreateDescriptorForStackArguments(Zone* zone,
void TestHelper(int n, int m, bool tail) {
HandleAndZoneScope scope;
Isolate* isolate = scope.main_isolate();
+ CanonicalHandleScope canonical(isolate);
Zone* zone = scope.main_zone();
CallDescriptor* caller_descriptor =
CreateDescriptorForStackArguments(zone, n);
diff --git a/deps/v8/test/cctest/compiler/test-run-stubs.cc b/deps/v8/test/cctest/compiler/test-run-stubs.cc
index 1751ee0836..9c76f22b99 100644
--- a/deps/v8/test/cctest/compiler/test-run-stubs.cc
+++ b/deps/v8/test/cctest/compiler/test-run-stubs.cc
@@ -13,6 +13,7 @@
#include "src/compiler/machine-operator.h"
#include "src/compiler/pipeline.h"
#include "src/objects-inl.h"
+#include "src/objects/js-array-inl.h"
#include "src/optimized-compilation-info.h"
#include "test/cctest/compiler/function-tester.h"
@@ -22,7 +23,7 @@ namespace compiler {
class StubTester {
public:
- StubTester(Isolate* isolate, Zone* zone, CodeStub* stub)
+ StubTester(Zone* zone, CodeStub* stub)
: zone_(zone),
info_(ArrayVector("test"), zone, Code::STUB),
interface_descriptor_(stub->GetCallInterfaceDescriptor()),
diff --git a/deps/v8/test/cctest/compiler/test-run-tail-calls.cc b/deps/v8/test/cctest/compiler/test-run-tail-calls.cc
index 34d6212d73..b57b4fcbac 100644
--- a/deps/v8/test/cctest/compiler/test-run-tail-calls.cc
+++ b/deps/v8/test/cctest/compiler/test-run-tail-calls.cc
@@ -108,6 +108,7 @@ CallDescriptor* CreateDescriptorForStackArguments(Zone* zone,
void TestHelper(int n, int m) {
HandleAndZoneScope scope;
Isolate* isolate = scope.main_isolate();
+ CanonicalHandleScope canonical(isolate);
Zone* zone = scope.main_zone();
CallDescriptor* caller_descriptor =
CreateDescriptorForStackArguments(zone, n);
diff --git a/deps/v8/test/cctest/compiler/test-run-variables.cc b/deps/v8/test/cctest/compiler/test-run-variables.cc
index 728d60f491..e2539dc16c 100644
--- a/deps/v8/test/cctest/compiler/test-run-variables.cc
+++ b/deps/v8/test/cctest/compiler/test-run-variables.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/objects-inl.h"
#include "test/cctest/compiler/function-tester.h"
diff --git a/deps/v8/test/cctest/heap/heap-tester.h b/deps/v8/test/cctest/heap/heap-tester.h
index 422560c773..a2e860a8a3 100644
--- a/deps/v8/test/cctest/heap/heap-tester.h
+++ b/deps/v8/test/cctest/heap/heap-tester.h
@@ -21,6 +21,10 @@
V(InvalidatedSlotsEvacuationCandidate) \
V(InvalidatedSlotsNoInvalidatedRanges) \
V(InvalidatedSlotsResetObjectRegression) \
+ V(InvalidatedSlotsRightTrimFixedArray) \
+ V(InvalidatedSlotsRightTrimLargeFixedArray) \
+ V(InvalidatedSlotsLeftTrimFixedArray) \
+ V(InvalidatedSlotsFastToSlow) \
V(InvalidatedSlotsSomeInvalidatedRanges) \
V(TestNewSpaceRefsInCopiedCode) \
V(GCFlags) \
diff --git a/deps/v8/test/cctest/heap/test-alloc.cc b/deps/v8/test/cctest/heap/test-alloc.cc
index ee1a27d4e8..5a19f806bc 100644
--- a/deps/v8/test/cctest/heap/test-alloc.cc
+++ b/deps/v8/test/cctest/heap/test-alloc.cc
@@ -29,7 +29,7 @@
#include "test/cctest/cctest.h"
#include "src/accessors.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/objects-inl.h"
#include "src/objects/api-callbacks.h"
#include "src/property.h"
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 31aff4f673..cb35a73126 100644
--- a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc
+++ b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc
@@ -2,11 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/heap/array-buffer-tracker.h"
+#include "src/heap/heap-inl.h"
#include "src/heap/spaces.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
+#include "src/objects/js-array-buffer-inl.h"
#include "test/cctest/cctest.h"
#include "test/cctest/heap/heap-utils.h"
diff --git a/deps/v8/test/cctest/heap/test-embedder-tracing.cc b/deps/v8/test/cctest/heap/test-embedder-tracing.cc
index 47f48c0c7a..d54ffcf377 100644
--- a/deps/v8/test/cctest/heap/test-embedder-tracing.cc
+++ b/deps/v8/test/cctest/heap/test-embedder-tracing.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
#include "include/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/objects-inl.h"
#include "src/objects/module.h"
#include "src/objects/script.h"
@@ -61,7 +61,7 @@ class TestEmbedderHeapTracer final : public v8::EmbedderHeapTracer {
void TracePrologue() final {}
void TraceEpilogue() final {}
void AbortTracing() final {}
- void EnterFinalPause() final {}
+ void EnterFinalPause(EmbedderStackState) final {}
bool IsRegisteredFromV8(void* first_field) const {
for (auto pair : registered_from_v8_) {
@@ -251,6 +251,20 @@ TEST(FinalizeTracingWhenMarking) {
CHECK(marking->IsStopped());
}
+TEST(GarbageCollectionForTesting) {
+ ManualGCScope manual_gc;
+ i::FLAG_expose_gc = true;
+ CcTest::InitializeVM();
+ v8::Isolate* isolate = CcTest::isolate();
+ Isolate* i_isolate = CcTest::i_isolate();
+ TestEmbedderHeapTracer tracer(isolate);
+ TemporaryEmbedderHeapTracerScope tracer_scope(isolate, &tracer);
+
+ int saved_gc_counter = i_isolate->heap()->gc_count();
+ tracer.GarbageCollectionForTesting(EmbedderHeapTracer::kUnknown);
+ CHECK_GT(i_isolate->heap()->gc_count(), saved_gc_counter);
+}
+
} // 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
new file mode 100644
index 0000000000..501825a296
--- /dev/null
+++ b/deps/v8/test/cctest/heap/test-external-string-tracker.cc
@@ -0,0 +1,226 @@
+// 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.
+
+#include "src/api-inl.h"
+#include "src/api.h"
+#include "src/heap/spaces.h"
+#include "src/isolate.h"
+#include "src/objects-inl.h"
+#include "test/cctest/cctest.h"
+#include "test/cctest/heap/heap-tester.h"
+#include "test/cctest/heap/heap-utils.h"
+
+#define TEST_STR "tests are great!"
+
+namespace v8 {
+namespace internal {
+namespace heap {
+
+// Adapted from cctest/test-api.cc
+class TestOneByteResource : public v8::String::ExternalOneByteStringResource {
+ public:
+ explicit TestOneByteResource(const char* data, int* counter = nullptr,
+ size_t offset = 0)
+ : orig_data_(data),
+ data_(data + offset),
+ length_(strlen(data) - offset),
+ counter_(counter) {}
+
+ ~TestOneByteResource() {
+ i::DeleteArray(orig_data_);
+ if (counter_ != nullptr) ++*counter_;
+ }
+
+ const char* data() const { return data_; }
+
+ size_t length() const { return length_; }
+
+ private:
+ const char* orig_data_;
+ const char* data_;
+ size_t length_;
+ int* counter_;
+};
+
+TEST(ExternalString_ExternalBackingStoreSizeIncreases) {
+ CcTest::InitializeVM();
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap();
+ ExternalBackingStoreType type = ExternalBackingStoreType::kExternalString;
+
+ const size_t backing_store_before =
+ heap->old_space()->ExternalBackingStoreBytes(type);
+
+ {
+ v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::String> es = v8::String::NewExternalOneByte(
+ isolate, new TestOneByteResource(i::StrDup(TEST_STR))).ToLocalChecked();
+ USE(es);
+
+ const size_t backing_store_after =
+ heap->old_space()->ExternalBackingStoreBytes(type);
+
+ CHECK_EQ(es->Length(), backing_store_after - backing_store_before);
+ }
+}
+
+TEST(ExternalString_ExternalBackingStoreSizeDecreases) {
+ ManualGCScope manual_gc_scope;
+ CcTest::InitializeVM();
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap();
+ ExternalBackingStoreType type = ExternalBackingStoreType::kExternalString;
+
+ const size_t backing_store_before =
+ heap->old_space()->ExternalBackingStoreBytes(type);
+
+ {
+ v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::String> es = v8::String::NewExternalOneByte(
+ isolate, new TestOneByteResource(i::StrDup(TEST_STR))).ToLocalChecked();
+ USE(es);
+ }
+
+ heap::GcAndSweep(heap, OLD_SPACE);
+
+ const size_t backing_store_after =
+ heap->old_space()->ExternalBackingStoreBytes(type);
+
+ CHECK_EQ(0, backing_store_after - backing_store_before);
+}
+
+TEST(ExternalString_ExternalBackingStoreSizeIncreasesMarkCompact) {
+ if (FLAG_never_compact) return;
+ ManualGCScope manual_gc_scope;
+ FLAG_manual_evacuation_candidates_selection = true;
+ CcTest::InitializeVM();
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap();
+ heap::AbandonCurrentlyFreeMemory(heap->old_space());
+ ExternalBackingStoreType type = ExternalBackingStoreType::kExternalString;
+
+ const size_t backing_store_before =
+ heap->old_space()->ExternalBackingStoreBytes(type);
+
+ {
+ v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::String> es = v8::String::NewExternalOneByte(
+ isolate, new TestOneByteResource(i::StrDup(TEST_STR))).ToLocalChecked();
+ v8::internal::Handle<v8::internal::String> esh = v8::Utils::OpenHandle(*es);
+
+ Page* page_before_gc = Page::FromAddress(esh->address());
+ heap::ForceEvacuationCandidate(page_before_gc);
+
+ CcTest::CollectAllGarbage();
+
+ const size_t backing_store_after =
+ heap->old_space()->ExternalBackingStoreBytes(type);
+ CHECK_EQ(es->Length(), backing_store_after - backing_store_before);
+ }
+
+ heap::GcAndSweep(heap, OLD_SPACE);
+ const size_t backing_store_after =
+ heap->old_space()->ExternalBackingStoreBytes(type);
+ CHECK_EQ(0, backing_store_after - backing_store_before);
+}
+
+TEST(ExternalString_ExternalBackingStoreSizeIncreasesAfterExternalization) {
+ CcTest::InitializeVM();
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ Heap* heap = reinterpret_cast<Isolate*>(isolate)->heap();
+ ExternalBackingStoreType type = ExternalBackingStoreType::kExternalString;
+ size_t old_backing_store_before = 0, new_backing_store_before = 0;
+
+ {
+ v8::HandleScope handle_scope(isolate);
+
+ new_backing_store_before =
+ heap->new_space()->ExternalBackingStoreBytes(type);
+ old_backing_store_before =
+ heap->old_space()->ExternalBackingStoreBytes(type);
+
+ // Allocate normal string in the new gen.
+ v8::Local<v8::String> str =
+ v8::String::NewFromUtf8(isolate, TEST_STR, v8::NewStringType::kNormal)
+ .ToLocalChecked();
+
+ CHECK_EQ(0, heap->new_space()->ExternalBackingStoreBytes(type) -
+ new_backing_store_before);
+
+ // Trigger GCs so that the newly allocated string moves to old gen.
+ heap::GcAndSweep(heap, NEW_SPACE); // in survivor space now
+ heap::GcAndSweep(heap, NEW_SPACE); // in old gen now
+
+ bool success =
+ str->MakeExternal(new TestOneByteResource(i::StrDup(TEST_STR)));
+ CHECK(success);
+
+ CHECK_EQ(str->Length(), heap->old_space()->ExternalBackingStoreBytes(type) -
+ old_backing_store_before);
+ }
+
+ heap::GcAndSweep(heap, OLD_SPACE);
+
+ CHECK_EQ(0, heap->old_space()->ExternalBackingStoreBytes(type) -
+ old_backing_store_before);
+}
+
+TEST(ExternalString_PromotedThinString) {
+ ManualGCScope manual_gc_scope;
+ CcTest::InitializeVM();
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ i::Isolate* i_isolate = CcTest::i_isolate();
+ i::Factory* factory = i_isolate->factory();
+ Heap* heap = i_isolate->heap();
+
+ {
+ v8::HandleScope handle_scope(isolate);
+
+ // New external string in the old space.
+ v8::internal::Handle<v8::internal::String> string1 =
+ factory
+ ->NewExternalStringFromOneByte(
+ new TestOneByteResource(i::StrDup(TEST_STR)))
+ .ToHandleChecked();
+
+ // Internalize external string.
+ i::Handle<i::String> isymbol1 = factory->InternalizeString(string1);
+ CHECK(isymbol1->IsInternalizedString());
+ CHECK(string1->IsExternalString());
+ CHECK(!heap->InNewSpace(*isymbol1));
+
+ // New external string in the young space. This string has the same content
+ // as the previous one (that was already internalized).
+ v8::Local<v8::String> string2 =
+ v8::String::NewFromUtf8(isolate, TEST_STR, v8::NewStringType::kNormal)
+ .ToLocalChecked();
+ bool success =
+ string2->MakeExternal(new TestOneByteResource(i::StrDup(TEST_STR)));
+ CHECK(success);
+
+ // Internalize (it will create a thin string in the new space).
+ i::Handle<i::String> istring = v8::Utils::OpenHandle(*string2);
+ i::Handle<i::String> isymbol2 = factory->InternalizeString(istring);
+ CHECK(isymbol2->IsInternalizedString());
+ CHECK(istring->IsThinString());
+ CHECK(heap->InNewSpace(*istring));
+
+ // Collect thin string. References to the thin string will be updated to
+ // point to the actual external string in the old space.
+ heap::GcAndSweep(heap, NEW_SPACE);
+
+ USE(isymbol1);
+ USE(isymbol2);
+ }
+}
+} // namespace heap
+} // namespace internal
+} // namespace v8
+
+#undef TEST_STR
diff --git a/deps/v8/test/cctest/heap/test-heap.cc b/deps/v8/test/cctest/heap/test-heap.cc
index 80b361034d..f73f6f0195 100644
--- a/deps/v8/test/cctest/heap/test-heap.cc
+++ b/deps/v8/test/cctest/heap/test-heap.cc
@@ -28,7 +28,7 @@
#include <stdlib.h>
#include <utility>
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/assembler-inl.h"
#include "src/code-stubs.h"
#include "src/compilation-cache.h"
@@ -43,9 +43,11 @@
#include "src/heap/incremental-marking.h"
#include "src/heap/mark-compact.h"
#include "src/heap/memory-reducer.h"
+#include "src/heap/remembered-set.h"
#include "src/ic/ic.h"
#include "src/macro-assembler-inl.h"
#include "src/objects-inl.h"
+#include "src/objects/js-array-inl.h"
#include "src/objects/js-collection-inl.h"
#include "src/objects/managed.h"
#include "src/regexp/jsregexp.h"
@@ -787,7 +789,7 @@ TEST(BytecodeArray) {
CHECK_GE(array->address() + array->BytecodeArraySize(),
array->GetFirstBytecodeAddress() + array->length());
for (int i = 0; i < kRawBytesSize; i++) {
- CHECK_EQ(Memory::uint8_at(array->GetFirstBytecodeAddress() + i),
+ CHECK_EQ(Memory<uint8_t>(array->GetFirstBytecodeAddress() + i),
kRawBytes[i]);
CHECK_EQ(array->get(i), kRawBytes[i]);
}
@@ -805,7 +807,7 @@ TEST(BytecodeArray) {
CHECK_EQ(array->frame_size(), kFrameSize);
for (int i = 0; i < kRawBytesSize; i++) {
CHECK_EQ(array->get(i), kRawBytes[i]);
- CHECK_EQ(Memory::uint8_at(array->GetFirstBytecodeAddress() + i),
+ CHECK_EQ(Memory<uint8_t>(array->GetFirstBytecodeAddress() + i),
kRawBytes[i]);
}
@@ -3628,15 +3630,15 @@ TEST(EnsureAllocationSiteDependentCodesProcessed) {
int dependency_group_count = 0;
DependentCode* dependency = site->dependent_code();
- while (dependency != ReadOnlyRoots(heap).empty_fixed_array()) {
+ while (dependency != ReadOnlyRoots(heap).empty_weak_fixed_array()) {
CHECK(dependency->group() ==
DependentCode::kAllocationSiteTransitionChangedGroup ||
dependency->group() ==
DependentCode::kAllocationSiteTenuringChangedGroup);
CHECK_EQ(1, dependency->count());
- CHECK(dependency->object_at(0)->IsWeakCell());
+ CHECK(dependency->object_at(0)->IsWeakHeapObject());
Code* function_bar =
- Code::cast(WeakCell::cast(dependency->object_at(0))->value());
+ Code::cast(dependency->object_at(0)->ToWeakHeapObject());
CHECK_EQ(bar_handle->code(), function_bar);
dependency = dependency->next_link();
dependency_group_count++;
@@ -3653,8 +3655,7 @@ TEST(EnsureAllocationSiteDependentCodesProcessed) {
// The site still exists because of our global handle, but the code is no
// longer referred to by dependent_code().
- CHECK(site->dependent_code()->object_at(0)->IsWeakCell() &&
- WeakCell::cast(site->dependent_code()->object_at(0))->cleared());
+ CHECK(site->dependent_code()->object_at(0)->IsClearedWeakHeapObject());
}
void CheckNumberOfAllocations(Heap* heap, const char* source,
@@ -3678,20 +3679,51 @@ TEST(AllocationSiteCreation) {
Isolate* isolate = CcTest::i_isolate();
Heap* heap = isolate->heap();
HandleScope scope(isolate);
+ i::FLAG_enable_one_shot_optimization = true;
// Array literals.
- CheckNumberOfAllocations(heap, "(function f1() { return []; })()", 1, 0);
- CheckNumberOfAllocations(heap, "(function f2() { return [1, 2]; })()", 1, 0);
- CheckNumberOfAllocations(heap, "(function f3() { return [[1], [2]]; })()", 1,
- 2);
+ CheckNumberOfAllocations(heap, "function f1() { return []; }; f1()", 1, 0);
+ CheckNumberOfAllocations(heap, "function f2() { return [1, 2]; }; f2()", 1,
+ 0);
+ CheckNumberOfAllocations(heap, "function f3() { return [[1], [2]]; }; f3()",
+ 1, 2);
CheckNumberOfAllocations(heap,
- "(function f4() { "
+ "function f4() { "
"return [0, [1, 1.1, 1.2, "
"], 1.5, [2.1, 2.2], 3];"
- "})()",
+ "}; f4();",
1, 2);
+ // No allocation sites within IIFE/top-level
+ CheckNumberOfAllocations(heap,
+ R"(
+ (function f4() {
+ return [ 0, [ 1, 1.1, 1.2,], 1.5, [2.1, 2.2], 3 ];
+ })();
+ )",
+ 0, 0);
+
+ CheckNumberOfAllocations(heap,
+ R"(
+ l = [ 1, 2, 3, 4];
+ )",
+ 0, 0);
+
+ CheckNumberOfAllocations(heap,
+ R"(
+ a = [];
+ )",
+ 0, 0);
+
+ CheckNumberOfAllocations(heap,
+ R"(
+ (function f4() {
+ return [];
+ })();
+ )",
+ 0, 0);
+
// Object literals have lazy AllocationSites
CheckNumberOfAllocations(heap, "function f5() { return {}; }; f5(); ", 0, 0);
@@ -3727,6 +3759,52 @@ TEST(AllocationSiteCreation) {
// No new AllocationSites created on the second invocation.
CheckNumberOfAllocations(heap, "f9(); ", 0, 0);
+
+ // No allocation sites for literals in an iife/top level code even if it has
+ // array subliterals
+ CheckNumberOfAllocations(heap,
+ R"(
+ (function f10() {
+ return {a: [1], b: [2]};
+ })();
+ )",
+ 0, 0);
+
+ CheckNumberOfAllocations(heap,
+ R"(
+ l = {
+ a: 1,
+ b: {
+ c: [5],
+ }
+ };
+ )",
+ 0, 0);
+
+ // Eagerly create allocation sites for literals within a loop of iife or
+ // top-level code
+ CheckNumberOfAllocations(heap,
+ R"(
+ (function f11() {
+ while(true) {
+ return {a: [1], b: [2]};
+ }
+ })();
+ )",
+ 1, 2);
+
+ CheckNumberOfAllocations(heap,
+ R"(
+ for (i = 0; i < 1; ++i) {
+ l = {
+ a: 1,
+ b: {
+ c: [5],
+ }
+ };
+ }
+ )",
+ 1, 1);
}
TEST(CellsInOptimizedCodeAreWeak) {
@@ -4330,82 +4408,6 @@ TEST(PolymorphicStaysPolymorphicAfterGC) {
CheckIC(loadIC, 0, POLYMORPHIC);
}
-
-TEST(WeakCell) {
- ManualGCScope manual_gc_scope;
- CcTest::InitializeVM();
- Isolate* isolate = CcTest::i_isolate();
- v8::internal::Factory* factory = isolate->factory();
-
- HandleScope outer_scope(isolate);
- Handle<WeakCell> weak_cell1;
- {
- HandleScope inner_scope(isolate);
- Handle<HeapObject> value = factory->NewFixedArray(1, NOT_TENURED);
- weak_cell1 = inner_scope.CloseAndEscape(factory->NewWeakCell(value));
- }
-
- Handle<FixedArray> survivor = factory->NewFixedArray(1, NOT_TENURED);
- Handle<WeakCell> weak_cell2;
- {
- HandleScope inner_scope(isolate);
- weak_cell2 = inner_scope.CloseAndEscape(factory->NewWeakCell(survivor));
- }
- CHECK(weak_cell1->value()->IsFixedArray());
- CHECK_EQ(*survivor, weak_cell2->value());
- CcTest::CollectGarbage(NEW_SPACE);
- CHECK(weak_cell1->value()->IsFixedArray());
- CHECK_EQ(*survivor, weak_cell2->value());
- CcTest::CollectGarbage(NEW_SPACE);
- CHECK(weak_cell1->value()->IsFixedArray());
- CHECK_EQ(*survivor, weak_cell2->value());
- CcTest::CollectAllAvailableGarbage();
- CHECK(weak_cell1->cleared());
- CHECK_EQ(*survivor, weak_cell2->value());
-}
-
-
-TEST(WeakCellsWithIncrementalMarking) {
- if (!FLAG_incremental_marking) return;
- ManualGCScope manual_gc_scope;
- CcTest::InitializeVM();
- Isolate* isolate = CcTest::i_isolate();
- v8::internal::Heap* heap = CcTest::heap();
- v8::internal::Factory* factory = isolate->factory();
-
- const int N = 16;
- HandleScope outer_scope(isolate);
- Handle<FixedArray> survivor = factory->NewFixedArray(1, NOT_TENURED);
- Handle<WeakCell> weak_cells[N];
-
- for (int i = 0; i < N; i++) {
- HandleScope inner_scope(isolate);
- Handle<HeapObject> value =
- i == 0 ? survivor : factory->NewFixedArray(1, NOT_TENURED);
- Handle<WeakCell> weak_cell = factory->NewWeakCell(value);
- CHECK(weak_cell->value()->IsFixedArray());
- IncrementalMarking* marking = heap->incremental_marking();
- if (marking->IsStopped()) {
- heap->StartIncrementalMarking(i::Heap::kNoGCFlags,
- i::GarbageCollectionReason::kTesting);
- }
- marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
- StepOrigin::kV8);
- CcTest::CollectGarbage(NEW_SPACE);
- CHECK(weak_cell->value()->IsFixedArray());
- weak_cells[i] = inner_scope.CloseAndEscape(weak_cell);
- }
- // Call collect all twice to make sure that we also cleared
- // weak cells that were allocated on black pages.
- CcTest::CollectAllGarbage();
- CcTest::CollectAllGarbage();
- CHECK_EQ(*survivor, weak_cells[0]->value());
- for (int i = 1; i < N; i++) {
- CHECK(weak_cells[i]->cleared());
- }
-}
-
-
#ifdef DEBUG
TEST(AddInstructionChangesNewSpacePromotion) {
FLAG_allow_natives_syntax = true;
@@ -4462,7 +4464,7 @@ TEST(CEntryStubOOM) {
CcTest::isolate()->SetFatalErrorHandler(OnFatalErrorExpectOOM);
v8::Local<v8::Value> result = CompileRun(
- "%SetFlags('--gc-interval=1');"
+ "%SetAllocationTimeout(1, 1);"
"var a = [];"
"a.__proto__ = [];"
"a.unshift(1)");
@@ -4694,15 +4696,15 @@ TEST(Regress3877) {
Factory* factory = isolate->factory();
HandleScope scope(isolate);
CompileRun("function cls() { this.x = 10; }");
- Handle<WeakCell> weak_prototype;
+ Handle<WeakFixedArray> weak_prototype_holder = factory->NewWeakFixedArray(1);
{
HandleScope inner_scope(isolate);
v8::Local<v8::Value> result = CompileRun("cls.prototype");
Handle<JSReceiver> proto =
v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(result));
- weak_prototype = inner_scope.CloseAndEscape(factory->NewWeakCell(proto));
+ weak_prototype_holder->Set(0, HeapObjectReference::Weak(*proto));
}
- CHECK(!weak_prototype->cleared());
+ CHECK(!weak_prototype_holder->Get(0)->IsClearedWeakHeapObject());
CompileRun(
"var a = { };"
"a.x = new cls();"
@@ -4711,13 +4713,13 @@ TEST(Regress3877) {
CcTest::CollectAllGarbage();
}
// The map of a.x keeps prototype alive
- CHECK(!weak_prototype->cleared());
+ CHECK(!weak_prototype_holder->Get(0)->IsClearedWeakHeapObject());
// Change the map of a.x and make the previous map garbage collectable.
CompileRun("a.x.__proto__ = {};");
for (int i = 0; i < 4; i++) {
CcTest::CollectAllGarbage();
}
- CHECK(weak_prototype->cleared());
+ CHECK(weak_prototype_holder->Get(0)->IsClearedWeakHeapObject());
}
Handle<WeakFixedArray> AddRetainedMap(Isolate* isolate, Heap* heap) {
@@ -4773,20 +4775,6 @@ TEST(WritableVsImmortalRoots) {
}
}
-TEST(FixedArrayOfWeakCells) {
- CcTest::InitializeVM();
- v8::HandleScope scope(CcTest::isolate());
- Isolate* isolate = CcTest::i_isolate();
-
- Handle<HeapNumber> number = isolate->factory()->NewHeapNumber(1);
- Handle<FixedArrayOfWeakCells> array =
- FixedArrayOfWeakCells::Add(isolate, Handle<Object>(), number);
- array->Remove(number);
- array->Compact<FixedArrayOfWeakCells::NullCallback>(isolate);
- FixedArrayOfWeakCells::Add(isolate, array, number);
-}
-
-
TEST(PreprocessStackTrace) {
// Do not automatically trigger early GC.
FLAG_gc_interval = -1;
@@ -5493,7 +5481,8 @@ TEST(Regress631969) {
s3->MakeExternal(&external_string);
CcTest::CollectGarbage(OLD_SPACE);
// This avoids the GC from trying to free stack allocated resources.
- i::Handle<i::ExternalOneByteString>::cast(s3)->set_resource(nullptr);
+ i::Handle<i::ExternalOneByteString>::cast(s3)->SetResource(isolate,
+ nullptr);
}
}
@@ -5673,7 +5662,7 @@ TEST(Regress618958) {
v8::HandleScope scope(CcTest::isolate());
Heap* heap = CcTest::heap();
bool isolate_is_locked = true;
- heap->update_external_memory(100 * MB);
+ CcTest::isolate()->AdjustAmountOfExternalAllocatedMemory(100 * MB);
int mark_sweep_count_before = heap->ms_count();
heap->MemoryPressureNotification(MemoryPressureLevel::kCritical,
isolate_is_locked);
diff --git a/deps/v8/test/cctest/heap/test-invalidated-slots.cc b/deps/v8/test/cctest/heap/test-invalidated-slots.cc
index f18878d511..9162573dd9 100644
--- a/deps/v8/test/cctest/heap/test-invalidated-slots.cc
+++ b/deps/v8/test/cctest/heap/test-invalidated-slots.cc
@@ -109,6 +109,7 @@ HEAP_TEST(InvalidatedSlotsAllInvalidatedRanges) {
}
HEAP_TEST(InvalidatedSlotsAfterTrimming) {
+ ManualGCScope manual_gc_scope;
CcTest::InitializeVM();
Heap* heap = CcTest::heap();
std::vector<ByteArray*> byte_arrays;
@@ -119,9 +120,7 @@ HEAP_TEST(InvalidatedSlotsAfterTrimming) {
byte_arrays[i]->Size());
}
// Trim byte arrays and check that the slots outside the byte arrays are
- // considered valid. Free space outside invalidated object can be reused
- // during evacuation for allocation of the evacuated objects. That can
- // add new valid slots to evacuation candidates.
+ // considered invalid if the old space page was swept.
InvalidatedSlotsFilter filter(page);
for (size_t i = 0; i < byte_arrays.size(); i++) {
ByteArray* byte_array = byte_arrays[i];
@@ -129,7 +128,7 @@ HEAP_TEST(InvalidatedSlotsAfterTrimming) {
Address end = byte_array->address() + byte_array->Size();
heap->RightTrimFixedArray(byte_array, byte_array->length());
for (Address addr = start; addr < end; addr += kPointerSize) {
- CHECK(filter.IsValid(addr));
+ CHECK_EQ(filter.IsValid(addr), page->SweepingDone());
}
}
}
@@ -184,6 +183,185 @@ HEAP_TEST(InvalidatedSlotsResetObjectRegression) {
}
}
+Handle<FixedArray> AllocateArrayOnFreshPage(Isolate* isolate,
+ PagedSpace* old_space, int length) {
+ AlwaysAllocateScope always_allocate(isolate);
+ heap::SimulateFullSpace(old_space);
+ return isolate->factory()->NewFixedArray(length, TENURED);
+}
+
+Handle<FixedArray> AllocateArrayOnEvacuationCandidate(Isolate* isolate,
+ PagedSpace* old_space,
+ int length) {
+ Handle<FixedArray> object =
+ AllocateArrayOnFreshPage(isolate, old_space, length);
+ heap::ForceEvacuationCandidate(Page::FromHeapObject(*object));
+ return object;
+}
+
+HEAP_TEST(InvalidatedSlotsRightTrimFixedArray) {
+ FLAG_manual_evacuation_candidates_selection = true;
+ FLAG_parallel_compaction = false;
+ ManualGCScope manual_gc_scope;
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
+ Heap* heap = CcTest::heap();
+ HandleScope scope(isolate);
+ PagedSpace* old_space = heap->old_space();
+ // Allocate a dummy page to be swept be the sweeper during evacuation.
+ AllocateArrayOnFreshPage(isolate, old_space, 1);
+ Handle<FixedArray> evacuated =
+ AllocateArrayOnEvacuationCandidate(isolate, old_space, 1);
+ Handle<FixedArray> trimmed = AllocateArrayOnFreshPage(isolate, old_space, 10);
+ heap::SimulateIncrementalMarking(heap);
+ for (int i = 1; i < trimmed->length(); i++) {
+ trimmed->set(i, *evacuated);
+ }
+ {
+ HandleScope scope(isolate);
+ Handle<HeapObject> dead = factory->NewFixedArray(1);
+ for (int i = 1; i < trimmed->length(); i++) {
+ trimmed->set(i, *dead);
+ }
+ heap->RightTrimFixedArray(*trimmed, trimmed->length() - 1);
+ }
+ CcTest::CollectGarbage(i::NEW_SPACE);
+ CcTest::CollectGarbage(i::OLD_SPACE);
+}
+
+HEAP_TEST(InvalidatedSlotsRightTrimLargeFixedArray) {
+ FLAG_manual_evacuation_candidates_selection = true;
+ FLAG_parallel_compaction = false;
+ ManualGCScope manual_gc_scope;
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
+ Heap* heap = CcTest::heap();
+ HandleScope scope(isolate);
+ PagedSpace* old_space = heap->old_space();
+ // Allocate a dummy page to be swept be the sweeper during evacuation.
+ AllocateArrayOnFreshPage(isolate, old_space, 1);
+ Handle<FixedArray> evacuated =
+ AllocateArrayOnEvacuationCandidate(isolate, old_space, 1);
+ Handle<FixedArray> trimmed;
+ {
+ AlwaysAllocateScope always_allocate(isolate);
+ trimmed =
+ factory->NewFixedArray(kMaxRegularHeapObjectSize / kPointerSize + 100);
+ DCHECK(MemoryChunk::FromHeapObject(*trimmed)->InLargeObjectSpace());
+ }
+ heap::SimulateIncrementalMarking(heap);
+ for (int i = 1; i < trimmed->length(); i++) {
+ trimmed->set(i, *evacuated);
+ }
+ {
+ HandleScope scope(isolate);
+ Handle<HeapObject> dead = factory->NewFixedArray(1);
+ for (int i = 1; i < trimmed->length(); i++) {
+ trimmed->set(i, *dead);
+ }
+ heap->RightTrimFixedArray(*trimmed, trimmed->length() - 1);
+ }
+ CcTest::CollectGarbage(i::NEW_SPACE);
+ CcTest::CollectGarbage(i::OLD_SPACE);
+}
+
+HEAP_TEST(InvalidatedSlotsLeftTrimFixedArray) {
+ FLAG_manual_evacuation_candidates_selection = true;
+ FLAG_parallel_compaction = false;
+ ManualGCScope manual_gc_scope;
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
+ Heap* heap = CcTest::heap();
+ HandleScope scope(isolate);
+ PagedSpace* old_space = heap->old_space();
+ // Allocate a dummy page to be swept be the sweeper during evacuation.
+ AllocateArrayOnFreshPage(isolate, old_space, 1);
+ Handle<FixedArray> evacuated =
+ AllocateArrayOnEvacuationCandidate(isolate, old_space, 1);
+ Handle<FixedArray> trimmed = AllocateArrayOnFreshPage(isolate, old_space, 10);
+ heap::SimulateIncrementalMarking(heap);
+ for (int i = 0; i + 1 < trimmed->length(); i++) {
+ trimmed->set(i, *evacuated);
+ }
+ {
+ HandleScope scope(isolate);
+ Handle<HeapObject> dead = factory->NewFixedArray(1);
+ for (int i = 1; i < trimmed->length(); i++) {
+ trimmed->set(i, *dead);
+ }
+ heap->LeftTrimFixedArray(*trimmed, trimmed->length() - 1);
+ }
+ CcTest::CollectGarbage(i::NEW_SPACE);
+ CcTest::CollectGarbage(i::OLD_SPACE);
+}
+
+HEAP_TEST(InvalidatedSlotsFastToSlow) {
+ FLAG_manual_evacuation_candidates_selection = true;
+ FLAG_parallel_compaction = false;
+ ManualGCScope manual_gc_scope;
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
+ Heap* heap = CcTest::heap();
+ PagedSpace* old_space = heap->old_space();
+
+ HandleScope scope(isolate);
+
+ Handle<String> name = factory->InternalizeUtf8String("TestObject");
+ Handle<String> prop_name1 = factory->InternalizeUtf8String("prop1");
+ Handle<String> prop_name2 = factory->InternalizeUtf8String("prop2");
+ Handle<String> prop_name3 = factory->InternalizeUtf8String("prop3");
+ // Allocate a dummy page to be swept be the sweeper during evacuation.
+ AllocateArrayOnFreshPage(isolate, old_space, 1);
+ Handle<FixedArray> evacuated =
+ AllocateArrayOnEvacuationCandidate(isolate, old_space, 1);
+ // Allocate a dummy page to ensure that the JSObject is allocated on
+ // a fresh page.
+ AllocateArrayOnFreshPage(isolate, old_space, 1);
+ Handle<JSObject> obj;
+ {
+ AlwaysAllocateScope always_allocate(isolate);
+ Handle<JSFunction> function = factory->NewFunctionForTest(name);
+ function->shared()->set_expected_nof_properties(3);
+ obj = factory->NewJSObject(function, TENURED);
+ }
+ // Start incremental marking.
+ heap::SimulateIncrementalMarking(heap);
+ // Set properties to point to the evacuation candidate.
+ JSReceiver::SetProperty(isolate, obj, prop_name1, evacuated,
+ LanguageMode::kSloppy)
+ .Check();
+ JSReceiver::SetProperty(isolate, obj, prop_name2, evacuated,
+ LanguageMode::kSloppy)
+ .Check();
+ JSReceiver::SetProperty(isolate, obj, prop_name3, evacuated,
+ LanguageMode::kSloppy)
+ .Check();
+
+ {
+ HandleScope scope(isolate);
+ Handle<HeapObject> dead = factory->NewFixedArray(1);
+ JSReceiver::SetProperty(isolate, obj, prop_name1, dead,
+ LanguageMode::kSloppy)
+ .Check();
+ JSReceiver::SetProperty(isolate, obj, prop_name2, dead,
+ LanguageMode::kSloppy)
+ .Check();
+ JSReceiver::SetProperty(isolate, obj, prop_name3, dead,
+ LanguageMode::kSloppy)
+ .Check();
+ Handle<Map> map(obj->map(), isolate);
+ Handle<Map> normalized_map =
+ Map::Normalize(isolate, map, CLEAR_INOBJECT_PROPERTIES, "testing");
+ JSObject::MigrateToMap(obj, normalized_map);
+ }
+ CcTest::CollectGarbage(i::NEW_SPACE);
+ CcTest::CollectGarbage(i::OLD_SPACE);
+}
+
} // namespace heap
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/heap/test-weak-references.cc b/deps/v8/test/cctest/heap/test-weak-references.cc
index 979a28b1cd..a54b13afd2 100644
--- a/deps/v8/test/cctest/heap/test-weak-references.cc
+++ b/deps/v8/test/cctest/heap/test-weak-references.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/assembler-inl.h"
#include "src/heap/factory.h"
#include "src/isolate.h"
@@ -535,6 +535,55 @@ TEST(WeakArrayListBasic) {
CHECK_EQ(Smi::ToInt(array->Get(7)->ToSmi()), 7);
}
+TEST(WeakArrayListRemove) {
+ ManualGCScope manual_gc_scope;
+ CcTest::InitializeVM();
+ Isolate* isolate = CcTest::i_isolate();
+ Factory* factory = isolate->factory();
+ Heap* heap = isolate->heap();
+ HandleScope outer_scope(isolate);
+
+ Handle<WeakArrayList> array(ReadOnlyRoots(heap).empty_weak_array_list(),
+ isolate);
+
+ Handle<FixedArray> elem0 = factory->NewFixedArray(1);
+ Handle<FixedArray> elem1 = factory->NewFixedArray(1);
+ Handle<FixedArray> elem2 = factory->NewFixedArray(1);
+
+ array =
+ WeakArrayList::AddToEnd(isolate, array, MaybeObjectHandle::Weak(elem0));
+ array =
+ WeakArrayList::AddToEnd(isolate, array, MaybeObjectHandle::Weak(elem1));
+ array =
+ WeakArrayList::AddToEnd(isolate, array, MaybeObjectHandle::Weak(elem2));
+
+ CHECK_EQ(array->length(), 3);
+ CHECK_EQ(array->Get(0), HeapObjectReference::Weak(*elem0));
+ CHECK_EQ(array->Get(1), HeapObjectReference::Weak(*elem1));
+ CHECK_EQ(array->Get(2), HeapObjectReference::Weak(*elem2));
+
+ CHECK(array->RemoveOne(MaybeObjectHandle::Weak(elem1)));
+
+ CHECK_EQ(array->length(), 2);
+ CHECK_EQ(array->Get(0), HeapObjectReference::Weak(*elem0));
+ CHECK_EQ(array->Get(1), HeapObjectReference::Weak(*elem2));
+
+ CHECK(!array->RemoveOne(MaybeObjectHandle::Weak(elem1)));
+
+ CHECK_EQ(array->length(), 2);
+ CHECK_EQ(array->Get(0), HeapObjectReference::Weak(*elem0));
+ CHECK_EQ(array->Get(1), HeapObjectReference::Weak(*elem2));
+
+ CHECK(array->RemoveOne(MaybeObjectHandle::Weak(elem0)));
+
+ CHECK_EQ(array->length(), 1);
+ CHECK_EQ(array->Get(0), HeapObjectReference::Weak(*elem2));
+
+ CHECK(array->RemoveOne(MaybeObjectHandle::Weak(elem2)));
+
+ CHECK_EQ(array->length(), 0);
+}
+
TEST(Regress7768) {
i::FLAG_allow_natives_syntax = true;
i::FLAG_turbo_inlining = false;
diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc
index 0998b3dfd9..a048e82e62 100644
--- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc
+++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc
@@ -10,7 +10,7 @@
#include "include/libplatform/libplatform.h"
#include "include/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/base/logging.h"
#include "src/interpreter/bytecode-array-iterator.h"
#include "src/interpreter/bytecode-generator.h"
@@ -21,6 +21,7 @@
#include "src/objects/module-inl.h"
#include "src/runtime/runtime.h"
#include "src/source-position-table.h"
+#include "test/cctest/cctest.h"
namespace v8 {
namespace internal {
@@ -116,6 +117,17 @@ BytecodeExpectationsPrinter::GetBytecodeArrayForScript(
return i::handle(js_function->shared()->GetBytecodeArray(), i_isolate());
}
+i::Handle<i::BytecodeArray>
+BytecodeExpectationsPrinter::GetBytecodeArrayOfCallee(
+ const char* source_code) const {
+ i::Handle<i::Object> i_object =
+ v8::Utils::OpenHandle(*CompileRun(source_code));
+ i::Handle<i::JSFunction> js_function =
+ i::Handle<i::JSFunction>::cast(i_object);
+ CHECK(js_function->shared()->HasBytecodeArray());
+ return i::handle(js_function->shared()->GetBytecodeArray(), i_isolate());
+}
+
void BytecodeExpectationsPrinter::PrintEscapedString(
std::ostream& stream, const std::string& string) const {
for (char c : string) {
@@ -372,11 +384,15 @@ void BytecodeExpectationsPrinter::PrintExpectation(
wrap_ ? WrapCodeInFunction(test_function_name_.c_str(), snippet)
: snippet;
+ i::FLAG_enable_one_shot_optimization = oneshot_opt_;
+ i::FLAG_compilation_cache = false;
i::Handle<i::BytecodeArray> bytecode_array;
if (module_) {
CHECK(top_level_ && !wrap_);
v8::Local<v8::Module> module = CompileModule(source_code.c_str());
bytecode_array = GetBytecodeArrayForModule(module);
+ } else if (print_callee_) {
+ bytecode_array = GetBytecodeArrayOfCallee(source_code.c_str());
} else {
v8::Local<v8::Script> script = CompileScript(source_code.c_str());
if (top_level_) {
diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h
index be5b143b5d..1d1bc437d0 100644
--- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h
+++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h
@@ -32,6 +32,8 @@ class BytecodeExpectationsPrinter final {
module_(false),
wrap_(true),
top_level_(false),
+ print_callee_(false),
+ oneshot_opt_(false),
test_function_name_(kDefaultTopFunctionName) {}
void PrintExpectation(std::ostream& stream, // NOLINT
@@ -46,6 +48,12 @@ class BytecodeExpectationsPrinter final {
void set_top_level(bool top_level) { top_level_ = top_level; }
bool top_level() const { return top_level_; }
+ void set_print_callee(bool print_callee) { print_callee_ = print_callee; }
+ bool print_callee() { return print_callee_; }
+
+ void set_oneshot_opt(bool oneshot_opt) { oneshot_opt_ = oneshot_opt; }
+ bool oneshot_opt() { return oneshot_opt_; }
+
void set_test_function_name(const std::string& test_function_name) {
test_function_name_ = test_function_name;
}
@@ -94,6 +102,8 @@ class BytecodeExpectationsPrinter final {
v8::Local<v8::Module> module) const;
i::Handle<v8::internal::BytecodeArray> GetBytecodeArrayForScript(
v8::Local<v8::Script> script) const;
+ i::Handle<i::BytecodeArray> GetBytecodeArrayOfCallee(
+ const char* source_code) const;
i::Isolate* i_isolate() const {
return reinterpret_cast<i::Isolate*>(isolate_);
@@ -103,6 +113,8 @@ class BytecodeExpectationsPrinter final {
bool module_;
bool wrap_;
bool top_level_;
+ bool print_callee_;
+ bool oneshot_opt_;
std::string test_function_name_;
static const char* const kDefaultTopFunctionName;
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden
index 9714926254..ae8d050914 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden
@@ -117,3 +117,164 @@ constant pool: [
handlers: [
]
+---
+snippet: "
+ var a = [ 1, 2 ]; return [ ...a ];
+"
+frame size: 8
+parameter count: 1
+bytecode array length: 86
+bytecodes: [
+ /* 30 E> */ B(StackCheck),
+ /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
+ B(Star), R(0),
+ /* 52 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37),
+ B(Star), R(1),
+ B(LdaConstant), U8(2),
+ /* 64 S> */ B(Star), R(2),
+ B(LdaNamedProperty), R(0), U8(3), U8(7),
+ B(Star), R(7),
+ B(CallProperty0), R(7), R(0), U8(9),
+ B(Mov), R(0), R(6),
+ B(JumpIfJSReceiver), U8(7),
+ B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
+ B(Star), R(5),
+ B(LdaNamedProperty), R(5), U8(4), U8(11),
+ B(Star), R(4),
+ B(CallProperty0), R(4), R(5), U8(13),
+ B(Star), R(3),
+ B(JumpIfJSReceiver), U8(7),
+ B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1),
+ B(LdaNamedProperty), R(3), U8(5), U8(15),
+ B(JumpIfToBooleanTrue), U8(21),
+ B(LdaNamedProperty), R(3), U8(6), U8(17),
+ B(Star), R(3),
+ B(StaInArrayLiteral), R(1), R(2), U8(2),
+ B(Ldar), R(2),
+ B(Inc), U8(4),
+ B(Star), R(2),
+ B(JumpLoop), U8(35), I8(0),
+ B(Ldar), R(1),
+ /* 68 S> */ B(Return),
+]
+constant pool: [
+ ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
+ ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
+ Smi [0],
+ SYMBOL_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
+]
+handlers: [
+]
+
+---
+snippet: "
+ var a = [ 1, 2 ]; return [ 0, ...a ];
+"
+frame size: 8
+parameter count: 1
+bytecode array length: 86
+bytecodes: [
+ /* 30 E> */ B(StackCheck),
+ /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
+ B(Star), R(0),
+ /* 52 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37),
+ B(Star), R(1),
+ B(LdaConstant), U8(2),
+ /* 67 S> */ B(Star), R(2),
+ B(LdaNamedProperty), R(0), U8(3), U8(7),
+ B(Star), R(7),
+ B(CallProperty0), R(7), R(0), U8(9),
+ B(Mov), R(0), R(6),
+ B(JumpIfJSReceiver), U8(7),
+ B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
+ B(Star), R(5),
+ B(LdaNamedProperty), R(5), U8(4), U8(11),
+ B(Star), R(4),
+ B(CallProperty0), R(4), R(5), U8(13),
+ B(Star), R(3),
+ B(JumpIfJSReceiver), U8(7),
+ B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1),
+ B(LdaNamedProperty), R(3), U8(5), U8(15),
+ B(JumpIfToBooleanTrue), U8(21),
+ B(LdaNamedProperty), R(3), U8(6), U8(17),
+ B(Star), R(3),
+ B(StaInArrayLiteral), R(1), R(2), U8(2),
+ B(Ldar), R(2),
+ B(Inc), U8(4),
+ B(Star), R(2),
+ B(JumpLoop), U8(35), I8(0),
+ B(Ldar), R(1),
+ /* 71 S> */ B(Return),
+]
+constant pool: [
+ ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
+ ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
+ Smi [1],
+ SYMBOL_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
+]
+handlers: [
+]
+
+---
+snippet: "
+ var a = [ 1, 2 ]; return [ ...a, 3 ];
+"
+frame size: 8
+parameter count: 1
+bytecode array length: 98
+bytecodes: [
+ /* 30 E> */ B(StackCheck),
+ /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(37),
+ B(Star), R(0),
+ /* 52 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(37),
+ B(Star), R(1),
+ B(LdaConstant), U8(2),
+ /* 64 S> */ B(Star), R(2),
+ B(LdaNamedProperty), R(0), U8(3), U8(7),
+ B(Star), R(7),
+ B(CallProperty0), R(7), R(0), U8(9),
+ B(Mov), R(0), R(6),
+ B(JumpIfJSReceiver), U8(7),
+ B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0),
+ B(Star), R(5),
+ B(LdaNamedProperty), R(5), U8(4), U8(11),
+ B(Star), R(4),
+ B(CallProperty0), R(4), R(5), U8(13),
+ B(Star), R(3),
+ B(JumpIfJSReceiver), U8(7),
+ B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1),
+ B(LdaNamedProperty), R(3), U8(5), U8(15),
+ B(JumpIfToBooleanTrue), U8(21),
+ B(LdaNamedProperty), R(3), U8(6), U8(17),
+ B(Star), R(3),
+ B(StaInArrayLiteral), R(1), R(2), U8(2),
+ B(Ldar), R(2),
+ B(Inc), U8(4),
+ B(Star), R(2),
+ B(JumpLoop), U8(35), I8(0),
+ B(LdaSmi), I8(3),
+ B(StaInArrayLiteral), R(1), R(2), U8(2),
+ B(Ldar), R(2),
+ B(Inc), U8(4),
+ B(Star), R(2),
+ B(Ldar), R(1),
+ /* 71 S> */ B(Return),
+]
+constant pool: [
+ ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
+ ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
+ Smi [0],
+ SYMBOL_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"],
+]
+handlers: [
+]
+
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
index d7109321c6..f5cbed6a7a 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AsyncGenerators.golden
@@ -362,7 +362,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(18),
B(LdaConstant), U8(14),
B(Star), R(19),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
index e965d7a689..c5fae1f4f6 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForAwaitOf.golden
@@ -123,7 +123,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(19),
B(LdaConstant), U8(11),
B(Star), R(20),
@@ -377,7 +377,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(19),
B(LdaConstant), U8(11),
B(Star), R(20),
@@ -653,7 +653,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(19),
B(LdaConstant), U8(11),
B(Star), R(20),
@@ -885,7 +885,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(17),
B(LdaConstant), U8(9),
B(Star), R(18),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden
index 5c603964c8..bcb462bc75 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden
@@ -85,7 +85,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(12),
B(LdaConstant), U8(7),
B(Star), R(13),
@@ -217,7 +217,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(13),
B(LdaConstant), U8(7),
B(Star), R(14),
@@ -361,7 +361,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(12),
B(LdaConstant), U8(7),
B(Star), R(13),
@@ -495,7 +495,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(11),
B(LdaConstant), U8(9),
B(Star), R(12),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
index 90fcb9065d..d4fe1a091c 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOfLoop.golden
@@ -89,7 +89,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(14),
B(LdaConstant), U8(6),
B(Star), R(15),
@@ -256,7 +256,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(14),
B(LdaConstant), U8(11),
B(Star), R(15),
@@ -401,7 +401,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(12),
B(LdaConstant), U8(8),
B(Star), R(13),
@@ -495,7 +495,7 @@ bytecodes: [
B(JumpIfUndefined), U8(6),
B(Ldar), R(6),
B(JumpIfNotNull), U8(16),
- B(LdaSmi), I8(78),
+ B(LdaSmi), I8(81),
B(Star), R(18),
B(LdaConstant), U8(4),
B(Star), R(19),
@@ -550,7 +550,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(17),
B(LdaConstant), U8(8),
B(Star), R(18),
@@ -697,7 +697,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(15),
B(LdaConstant), U8(9),
B(Star), R(16),
@@ -859,7 +859,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(14),
B(LdaConstant), U8(12),
B(Star), R(15),
@@ -1007,7 +1007,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(20),
B(LdaConstant), U8(6),
B(Star), R(21),
@@ -1218,7 +1218,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(19),
B(LdaConstant), U8(7),
B(Star), R(20),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden
index 54deec7198..641a2b2eb0 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden
@@ -203,7 +203,7 @@ bytecodes: [
B(TestTypeOf), U8(6),
B(JumpIfFalse), U8(4),
B(Jump), U8(18),
- B(Wide), B(LdaSmi), I16(149),
+ B(Wide), B(LdaSmi), I16(153),
B(Star), R(14),
B(LdaConstant), U8(13),
B(Star), R(15),
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden
new file mode 100644
index 0000000000..f2653a6ed1
--- /dev/null
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithOneshotOpt.golden
@@ -0,0 +1,408 @@
+#
+# Autogenerated by generate-bytecode-expectations.
+#
+
+---
+wrap: no
+top level: yes
+print callee: yes
+oneshot opt: yes
+
+---
+snippet: "
+
+ (function() {
+ l = {};
+ l.aa = 2;
+ l.bb = l.aa;
+ return arguments.callee;
+ })();
+
+"
+frame size: 6
+parameter count: 1
+bytecode array length: 82
+bytecodes: [
+ B(CreateMappedArguments),
+ B(Star), R(0),
+ /* 16 E> */ B(StackCheck),
+ /* 29 S> */ B(CreateEmptyObjectLiteral),
+ /* 31 E> */ B(StaGlobal), U8(0), U8(0),
+ /* 45 S> */ B(LdaGlobal), U8(0), U8(2),
+ B(Star), R(1),
+ B(LdaSmi), I8(2),
+ B(Star), R(4),
+ B(LdaConstant), U8(1),
+ B(Star), R(3),
+ B(LdaZero),
+ B(Star), R(5),
+ B(Mov), R(1), R(2),
+ /* 50 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
+ /* 63 S> */ B(LdaGlobal), U8(0), U8(2),
+ B(Star), R(1),
+ /* 70 E> */ B(LdaGlobal), U8(0), U8(2),
+ B(Star), R(2),
+ B(LdaConstant), U8(1),
+ B(Star), R(4),
+ B(Mov), R(2), R(3),
+ /* 72 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(3), U8(2),
+ B(Star), R(4),
+ B(LdaConstant), U8(2),
+ B(Star), R(3),
+ B(LdaZero),
+ B(Star), R(5),
+ B(Mov), R(1), R(2),
+ /* 68 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
+ /* 84 S> */ B(LdaConstant), U8(3),
+ B(Star), R(3),
+ B(Mov), R(0), R(2),
+ /* 101 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
+ /* 108 S> */ B(Return),
+]
+constant pool: [
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["aa"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["bb"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ (function() {
+ l = {};
+ for (i = 0; i < 5; ++i) {
+ l.aa = 2;
+ l.bb = l.aa;
+ }
+ return arguments.callee;
+ })();
+
+"
+frame size: 4
+parameter count: 1
+bytecode array length: 77
+bytecodes: [
+ B(CreateMappedArguments),
+ B(Star), R(0),
+ /* 16 E> */ B(StackCheck),
+ /* 29 S> */ B(CreateEmptyObjectLiteral),
+ /* 31 E> */ B(StaGlobal), U8(0), U8(0),
+ /* 50 S> */ B(LdaZero),
+ /* 52 E> */ B(StaGlobal), U8(1), U8(2),
+ /* 59 S> */ B(LdaGlobal), U8(1), U8(4),
+ B(Star), R(1),
+ B(LdaSmi), I8(5),
+ /* 59 E> */ B(TestLessThan), R(1), U8(6),
+ B(JumpIfFalse), U8(43),
+ /* 45 E> */ B(StackCheck),
+ /* 81 S> */ B(LdaGlobal), U8(0), U8(7),
+ B(Star), R(1),
+ B(LdaSmi), I8(2),
+ /* 86 E> */ B(StaNamedProperty), R(1), U8(2), U8(9),
+ /* 101 S> */ B(LdaGlobal), U8(0), U8(7),
+ B(Star), R(1),
+ /* 108 E> */ B(LdaGlobal), U8(0), U8(7),
+ B(Star), R(2),
+ /* 110 E> */ B(LdaNamedProperty), R(2), U8(2), U8(11),
+ /* 106 E> */ B(StaNamedProperty), R(1), U8(3), U8(13),
+ /* 66 S> */ B(LdaGlobal), U8(1), U8(4),
+ B(Inc), U8(15),
+ /* 66 E> */ B(StaGlobal), U8(1), U8(2),
+ B(JumpLoop), U8(50), I8(0),
+ /* 132 S> */ B(LdaConstant), U8(4),
+ B(Star), R(3),
+ B(Mov), R(0), R(2),
+ /* 149 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
+ /* 156 S> */ B(Return),
+]
+constant pool: [
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["i"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["aa"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["bb"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ (function() {
+ l = {};
+ c = 4;
+ while(c > 4) {
+ l.aa = 2;
+ l.bb = l.aa;
+ c--;
+ }
+ return arguments.callee;
+ })();
+
+"
+frame size: 4
+parameter count: 1
+bytecode array length: 78
+bytecodes: [
+ B(CreateMappedArguments),
+ B(Star), R(0),
+ /* 16 E> */ B(StackCheck),
+ /* 29 S> */ B(CreateEmptyObjectLiteral),
+ /* 31 E> */ B(StaGlobal), U8(0), U8(0),
+ /* 45 S> */ B(LdaSmi), I8(4),
+ /* 47 E> */ B(StaGlobal), U8(1), U8(2),
+ /* 68 S> */ B(LdaGlobal), U8(1), U8(4),
+ B(Star), R(1),
+ B(LdaSmi), I8(4),
+ /* 68 E> */ B(TestGreaterThan), R(1), U8(6),
+ B(JumpIfFalse), U8(43),
+ /* 60 E> */ B(StackCheck),
+ /* 85 S> */ B(LdaGlobal), U8(0), U8(7),
+ B(Star), R(1),
+ B(LdaSmi), I8(2),
+ /* 90 E> */ B(StaNamedProperty), R(1), U8(2), U8(9),
+ /* 105 S> */ B(LdaGlobal), U8(0), U8(7),
+ B(Star), R(1),
+ /* 112 E> */ B(LdaGlobal), U8(0), U8(7),
+ B(Star), R(2),
+ /* 114 E> */ B(LdaNamedProperty), R(2), U8(2), U8(11),
+ /* 110 E> */ B(StaNamedProperty), R(1), U8(3), U8(13),
+ /* 128 S> */ B(LdaGlobal), U8(1), U8(4),
+ B(Dec), U8(15),
+ /* 129 E> */ B(StaGlobal), U8(1), U8(2),
+ B(JumpLoop), U8(50), I8(0),
+ /* 151 S> */ B(LdaConstant), U8(4),
+ B(Star), R(3),
+ B(Mov), R(0), R(2),
+ /* 168 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
+ /* 175 S> */ B(Return),
+]
+constant pool: [
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["c"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["aa"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["bb"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ (function() {
+ l = {};
+ c = 4;
+ do {
+ l.aa = 2;
+ l.bb = l.aa;
+ c--;
+ } while(c > 4)
+ return arguments.callee;
+ })();
+
+"
+frame size: 4
+parameter count: 1
+bytecode array length: 78
+bytecodes: [
+ B(CreateMappedArguments),
+ B(Star), R(0),
+ /* 16 E> */ B(StackCheck),
+ /* 29 S> */ B(CreateEmptyObjectLiteral),
+ /* 31 E> */ B(StaGlobal), U8(0), U8(0),
+ /* 45 S> */ B(LdaSmi), I8(4),
+ /* 47 E> */ B(StaGlobal), U8(1), U8(2),
+ /* 60 E> */ B(StackCheck),
+ /* 75 S> */ B(LdaGlobal), U8(0), U8(4),
+ B(Star), R(1),
+ B(LdaSmi), I8(2),
+ /* 80 E> */ B(StaNamedProperty), R(1), U8(2), U8(6),
+ /* 95 S> */ B(LdaGlobal), U8(0), U8(4),
+ B(Star), R(1),
+ /* 102 E> */ B(LdaGlobal), U8(0), U8(4),
+ B(Star), R(2),
+ /* 104 E> */ B(LdaNamedProperty), R(2), U8(2), U8(8),
+ /* 100 E> */ B(StaNamedProperty), R(1), U8(3), U8(10),
+ /* 118 S> */ B(LdaGlobal), U8(1), U8(12),
+ B(Dec), U8(14),
+ /* 119 E> */ B(StaGlobal), U8(1), U8(2),
+ /* 141 S> */ B(LdaGlobal), U8(1), U8(12),
+ B(Star), R(1),
+ B(LdaSmi), I8(4),
+ /* 141 E> */ B(TestGreaterThan), R(1), U8(15),
+ B(JumpIfFalse), U8(5),
+ B(JumpLoop), U8(50), I8(0),
+ /* 154 S> */ B(LdaConstant), U8(4),
+ B(Star), R(3),
+ B(Mov), R(0), R(2),
+ /* 171 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
+ /* 178 S> */ B(Return),
+]
+constant pool: [
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["c"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["aa"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["bb"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ (function() {
+ l = {
+ 'aa': 3.3,
+ 'bb': 4.4
+ };
+ if (l.aa < 3) {
+ l.aa = 3;
+ } else {
+ l.aa = l.bb;
+ }
+ return arguments.callee;
+ })();
+
+"
+frame size: 6
+parameter count: 1
+bytecode array length: 121
+bytecodes: [
+ B(CreateMappedArguments),
+ B(Star), R(0),
+ /* 16 E> */ B(StackCheck),
+ /* 29 S> */ B(LdaConstant), U8(0),
+ B(Star), R(2),
+ B(LdaSmi), I8(41),
+ B(Star), R(3),
+ B(CallRuntime), U16(Runtime::kCreateObjectLiteralWithoutAllocationSite), R(2), U8(2),
+ /* 31 E> */ B(StaGlobal), U8(1), U8(0),
+ /* 95 S> */ B(LdaGlobal), U8(1), U8(2),
+ B(Star), R(1),
+ B(LdaConstant), U8(2),
+ B(Star), R(3),
+ B(Mov), R(1), R(2),
+ /* 101 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
+ B(Star), R(1),
+ B(LdaSmi), I8(3),
+ /* 104 E> */ B(TestLessThan), R(1), U8(4),
+ B(JumpIfFalse), U8(28),
+ /* 121 S> */ B(LdaGlobal), U8(1), U8(2),
+ B(Star), R(1),
+ B(LdaSmi), I8(3),
+ B(Star), R(4),
+ B(LdaConstant), U8(2),
+ B(Star), R(3),
+ B(LdaZero),
+ B(Star), R(5),
+ B(Mov), R(1), R(2),
+ /* 126 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
+ B(Jump), U8(40),
+ /* 158 S> */ B(LdaGlobal), U8(1), U8(2),
+ B(Star), R(1),
+ /* 165 E> */ B(LdaGlobal), U8(1), U8(2),
+ B(Star), R(2),
+ B(LdaConstant), U8(3),
+ B(Star), R(4),
+ B(Mov), R(2), R(3),
+ /* 167 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(3), U8(2),
+ B(Star), R(4),
+ B(LdaConstant), U8(2),
+ B(Star), R(3),
+ B(LdaZero),
+ B(Star), R(5),
+ B(Mov), R(1), R(2),
+ /* 163 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
+ /* 189 S> */ B(LdaConstant), U8(4),
+ B(Star), R(3),
+ B(Mov), R(0), R(2),
+ /* 206 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
+ /* 213 S> */ B(Return),
+]
+constant pool: [
+ OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["aa"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["bb"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ (function() {
+ a = [0, [1, 1,2,], 3];
+ return arguments.callee;
+ })();
+
+"
+frame size: 4
+parameter count: 1
+bytecode array length: 32
+bytecodes: [
+ B(CreateMappedArguments),
+ B(Star), R(0),
+ /* 16 E> */ B(StackCheck),
+ /* 29 S> */ B(LdaConstant), U8(0),
+ B(Star), R(1),
+ B(LdaSmi), I8(4),
+ B(Star), R(2),
+ B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(1), U8(2),
+ /* 31 E> */ B(StaGlobal), U8(1), U8(0),
+ /* 60 S> */ B(LdaConstant), U8(2),
+ B(Star), R(3),
+ B(Mov), R(0), R(2),
+ /* 77 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
+ /* 84 S> */ B(Return),
+]
+constant pool: [
+ ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ (function() {
+ a = [];
+ return arguments.callee;
+ })();
+
+"
+frame size: 4
+parameter count: 1
+bytecode array length: 32
+bytecodes: [
+ B(CreateMappedArguments),
+ B(Star), R(0),
+ /* 16 E> */ B(StackCheck),
+ /* 29 S> */ B(LdaConstant), U8(0),
+ B(Star), R(1),
+ B(LdaSmi), I8(37),
+ B(Star), R(2),
+ B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(1), U8(2),
+ /* 31 E> */ B(StaGlobal), U8(1), U8(0),
+ /* 45 S> */ B(LdaConstant), U8(2),
+ B(Star), R(3),
+ B(Mov), R(0), R(2),
+ /* 62 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
+ /* 69 S> */ B(Return),
+]
+constant pool: [
+ ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"],
+]
+handlers: [
+]
+
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden
new file mode 100644
index 0000000000..f116bdc68f
--- /dev/null
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IIFEWithoutOneshotOpt.golden
@@ -0,0 +1,109 @@
+#
+# Autogenerated by generate-bytecode-expectations.
+#
+
+---
+wrap: no
+top level: yes
+print callee: yes
+
+---
+snippet: "
+
+ (function() {
+ l = {};
+ l.a = 2;
+ l.b = l.a;
+ return arguments.callee;
+ })();
+
+"
+frame size: 3
+parameter count: 1
+bytecode array length: 42
+bytecodes: [
+ B(CreateMappedArguments),
+ B(Star), R(0),
+ /* 16 E> */ B(StackCheck),
+ /* 29 S> */ B(CreateEmptyObjectLiteral),
+ /* 31 E> */ B(StaGlobal), U8(0), U8(0),
+ /* 45 S> */ B(LdaGlobal), U8(0), U8(2),
+ B(Star), R(1),
+ B(LdaSmi), I8(2),
+ /* 49 E> */ B(StaNamedProperty), R(1), U8(1), U8(4),
+ /* 62 S> */ B(LdaGlobal), U8(0), U8(2),
+ B(Star), R(1),
+ /* 68 E> */ B(LdaGlobal), U8(0), U8(2),
+ B(Star), R(2),
+ /* 70 E> */ B(LdaNamedProperty), R(2), U8(1), U8(6),
+ /* 66 E> */ B(StaNamedProperty), R(1), U8(2), U8(8),
+ /* 98 S> */ B(LdaNamedProperty), R(0), U8(3), U8(10),
+ /* 105 S> */ B(Return),
+]
+constant pool: [
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ (function() {
+ l = {
+ 'a': 4.3,
+ 'b': 3.4
+ };
+ if (l.a < 3) {
+ l.a = 3;
+ } else {
+ l.a = l.b;
+ }
+ return arguments.callee;
+ })();
+
+"
+frame size: 3
+parameter count: 1
+bytecode array length: 68
+bytecodes: [
+ B(CreateMappedArguments),
+ B(Star), R(0),
+ /* 16 E> */ B(StackCheck),
+ /* 29 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), R(1),
+ B(Ldar), R(1),
+ /* 31 E> */ B(StaGlobal), U8(1), U8(1),
+ /* 93 S> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(1),
+ /* 99 E> */ B(LdaNamedProperty), R(1), U8(2), U8(5),
+ B(Star), R(1),
+ B(LdaSmi), I8(3),
+ /* 101 E> */ B(TestLessThan), R(1), U8(7),
+ B(JumpIfFalse), U8(15),
+ /* 118 S> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(1),
+ B(LdaSmi), I8(3),
+ /* 122 E> */ B(StaNamedProperty), R(1), U8(2), U8(8),
+ B(Jump), U8(20),
+ /* 154 S> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(1),
+ /* 160 E> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(2),
+ /* 162 E> */ B(LdaNamedProperty), R(2), U8(3), U8(10),
+ /* 158 E> */ B(StaNamedProperty), R(1), U8(2), U8(8),
+ /* 200 S> */ B(LdaNamedProperty), R(0), U8(4), U8(12),
+ /* 207 S> */ B(Return),
+]
+constant pool: [
+ OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["callee"],
+]
+handlers: [
+]
+
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden
new file mode 100644
index 0000000000..3bc175b7da
--- /dev/null
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreOneShot.golden
@@ -0,0 +1,423 @@
+#
+# Autogenerated by generate-bytecode-expectations.
+#
+
+---
+wrap: no
+top level: yes
+oneshot opt: yes
+
+---
+snippet: "
+
+ l = {
+ 'a': 1,
+ 'b': 2
+ };
+
+ v = l['a'] + l['b'];
+ l['b'] = 7;
+ l['a'] = l['b'];
+
+"
+frame size: 7
+parameter count: 1
+bytecode array length: 128
+bytecodes: [
+ /* 0 E> */ B(StackCheck),
+ /* 7 S> */ B(LdaConstant), U8(0),
+ B(Star), R(2),
+ B(LdaSmi), I8(41),
+ B(Star), R(3),
+ B(CallRuntime), U16(Runtime::kCreateObjectLiteralWithoutAllocationSite), R(2), U8(2),
+ /* 9 E> */ B(StaGlobal), U8(1), U8(0),
+ /* 60 S> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(1),
+ B(LdaConstant), U8(2),
+ B(Star), R(3),
+ B(Mov), R(1), R(2),
+ /* 65 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
+ B(Star), R(1),
+ /* 73 E> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(2),
+ B(LdaConstant), U8(3),
+ B(Star), R(4),
+ B(Mov), R(2), R(3),
+ /* 74 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(3), U8(2),
+ /* 71 E> */ B(Add), R(1), U8(2),
+ /* 62 E> */ B(StaGlobal), U8(4), U8(5),
+ /* 87 S> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(1),
+ B(LdaSmi), I8(7),
+ B(Star), R(4),
+ B(LdaConstant), U8(3),
+ B(Star), R(3),
+ B(LdaZero),
+ B(Star), R(5),
+ B(Mov), R(1), R(2),
+ /* 94 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4),
+ /* 105 S> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(1),
+ /* 114 E> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(2),
+ B(LdaConstant), U8(3),
+ B(Star), R(4),
+ B(Mov), R(2), R(3),
+ /* 115 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(3), U8(2),
+ B(Star), R(2),
+ B(LdaConstant), U8(2),
+ B(Star), R(4),
+ B(LdaZero),
+ B(Star), R(6),
+ B(Mov), R(1), R(3),
+ B(Mov), R(2), R(5),
+ /* 112 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4),
+ B(Mov), R(5), R(0),
+ B(Ldar), R(0),
+ /* 128 S> */ B(Return),
+]
+constant pool: [
+ OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["v"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ l = {
+ 'a': 1.1,
+ 'b': 2.2
+ };
+ for (i = 0; i < 5; ++i) {
+ l['a'] = l['a'] + l['b'];
+ l['b'] = l['a'] + l['b'];
+ }
+
+"
+frame size: 4
+parameter count: 1
+bytecode array length: 120
+bytecodes: [
+ /* 0 E> */ B(StackCheck),
+ /* 7 S> */ B(LdaConstant), U8(0),
+ B(Star), R(2),
+ B(LdaSmi), I8(41),
+ B(Star), R(3),
+ B(CallRuntime), U16(Runtime::kCreateObjectLiteralWithoutAllocationSite), R(2), U8(2),
+ /* 9 E> */ B(StaGlobal), U8(1), U8(0),
+ B(LdaUndefined),
+ B(Star), R(0),
+ /* 68 S> */ B(LdaZero),
+ /* 70 E> */ B(StaGlobal), U8(2), U8(2),
+ /* 77 S> */ B(LdaGlobal), U8(2), U8(4),
+ B(Star), R(1),
+ B(LdaSmi), I8(5),
+ /* 77 E> */ B(TestLessThan), R(1), U8(6),
+ B(JumpIfFalse), U8(83),
+ /* 63 E> */ B(StackCheck),
+ /* 97 S> */ B(LdaGlobal), U8(1), U8(7),
+ B(Star), R(1),
+ /* 106 E> */ B(LdaGlobal), U8(1), U8(7),
+ B(Star), R(2),
+ /* 107 E> */ B(LdaNamedProperty), R(2), U8(3), U8(10),
+ B(Star), R(2),
+ /* 115 E> */ B(LdaGlobal), U8(1), U8(7),
+ B(Star), R(3),
+ /* 116 E> */ B(LdaNamedProperty), R(3), U8(4), U8(12),
+ /* 113 E> */ B(Add), R(2), U8(9),
+ /* 104 E> */ B(StaNamedProperty), R(1), U8(3), U8(14),
+ /* 131 S> */ B(LdaGlobal), U8(1), U8(7),
+ B(Star), R(1),
+ /* 140 E> */ B(LdaGlobal), U8(1), U8(7),
+ B(Star), R(2),
+ /* 141 E> */ B(LdaNamedProperty), R(2), U8(3), U8(10),
+ B(Star), R(2),
+ /* 149 E> */ B(LdaGlobal), U8(1), U8(7),
+ B(Star), R(3),
+ /* 150 E> */ B(LdaNamedProperty), R(3), U8(4), U8(12),
+ /* 147 E> */ B(Add), R(2), U8(16),
+ B(Star), R(2),
+ /* 138 E> */ B(StaNamedProperty), R(1), U8(4), U8(17),
+ B(Mov), R(2), R(0),
+ /* 84 S> */ B(LdaGlobal), U8(2), U8(4),
+ B(Inc), U8(19),
+ /* 84 E> */ B(StaGlobal), U8(2), U8(2),
+ B(JumpLoop), U8(90), I8(0),
+ B(Ldar), R(0),
+ /* 171 S> */ B(Return),
+]
+constant pool: [
+ OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["i"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ l = {
+ 'a': 1.1,
+ 'b': 2.2
+ };
+ while (s > 0) {
+ l['a'] = l['a'] - l['b'];
+ l['b'] = l['b'] - l['a'];
+ }
+
+"
+frame size: 4
+parameter count: 1
+bytecode array length: 109
+bytecodes: [
+ /* 0 E> */ B(StackCheck),
+ /* 7 S> */ B(LdaConstant), U8(0),
+ B(Star), R(2),
+ B(LdaSmi), I8(41),
+ B(Star), R(3),
+ B(CallRuntime), U16(Runtime::kCreateObjectLiteralWithoutAllocationSite), R(2), U8(2),
+ /* 9 E> */ B(StaGlobal), U8(1), U8(0),
+ B(LdaUndefined),
+ B(Star), R(0),
+ /* 72 S> */ B(LdaGlobal), U8(2), U8(2),
+ B(Star), R(1),
+ B(LdaZero),
+ /* 72 E> */ B(TestGreaterThan), R(1), U8(4),
+ B(JumpIfFalse), U8(77),
+ /* 63 E> */ B(StackCheck),
+ /* 87 S> */ B(LdaGlobal), U8(1), U8(5),
+ B(Star), R(1),
+ /* 97 E> */ B(LdaGlobal), U8(1), U8(5),
+ B(Star), R(2),
+ /* 98 E> */ B(LdaNamedProperty), R(2), U8(3), U8(8),
+ B(Star), R(2),
+ /* 106 E> */ B(LdaGlobal), U8(1), U8(5),
+ B(Star), R(3),
+ /* 107 E> */ B(LdaNamedProperty), R(3), U8(4), U8(10),
+ /* 104 E> */ B(Sub), R(2), U8(7),
+ /* 95 E> */ B(StaNamedProperty), R(1), U8(3), U8(12),
+ /* 122 S> */ B(LdaGlobal), U8(1), U8(5),
+ B(Star), R(1),
+ /* 132 E> */ B(LdaGlobal), U8(1), U8(5),
+ B(Star), R(2),
+ /* 133 E> */ B(LdaNamedProperty), R(2), U8(4), U8(10),
+ B(Star), R(2),
+ /* 141 E> */ B(LdaGlobal), U8(1), U8(5),
+ B(Star), R(3),
+ /* 142 E> */ B(LdaNamedProperty), R(3), U8(3), U8(8),
+ /* 139 E> */ B(Sub), R(2), U8(14),
+ B(Star), R(2),
+ /* 130 E> */ B(StaNamedProperty), R(1), U8(4), U8(15),
+ B(Mov), R(2), R(0),
+ B(Ldar), R(2),
+ B(JumpLoop), U8(83), I8(0),
+ B(Ldar), R(0),
+ /* 163 S> */ B(Return),
+]
+constant pool: [
+ OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["s"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ l = {
+ 'a': 1.1,
+ 'b': 2.2
+ };
+ s = 10;
+ do {
+ l['a'] = l['b'] - l['a'];
+ } while (s < 10);
+
+"
+frame size: 4
+parameter count: 1
+bytecode array length: 81
+bytecodes: [
+ /* 0 E> */ B(StackCheck),
+ /* 7 S> */ B(LdaConstant), U8(0),
+ B(Star), R(2),
+ B(LdaSmi), I8(41),
+ B(Star), R(3),
+ B(CallRuntime), U16(Runtime::kCreateObjectLiteralWithoutAllocationSite), R(2), U8(2),
+ /* 9 E> */ B(StaGlobal), U8(1), U8(0),
+ /* 63 S> */ B(LdaSmi), I8(10),
+ /* 65 E> */ B(StaGlobal), U8(2), U8(2),
+ B(LdaUndefined),
+ B(Star), R(0),
+ /* 77 E> */ B(StackCheck),
+ /* 90 S> */ B(LdaGlobal), U8(1), U8(4),
+ B(Star), R(1),
+ /* 99 E> */ B(LdaGlobal), U8(1), U8(4),
+ B(Star), R(2),
+ /* 100 E> */ B(LdaNamedProperty), R(2), U8(3), U8(7),
+ B(Star), R(2),
+ /* 108 E> */ B(LdaGlobal), U8(1), U8(4),
+ B(Star), R(3),
+ /* 109 E> */ B(LdaNamedProperty), R(3), U8(4), U8(9),
+ /* 106 E> */ B(Sub), R(2), U8(6),
+ B(Star), R(2),
+ /* 97 E> */ B(StaNamedProperty), R(1), U8(4), U8(11),
+ B(Mov), R(2), R(0),
+ /* 133 S> */ B(LdaGlobal), U8(2), U8(13),
+ B(Star), R(1),
+ B(LdaSmi), I8(10),
+ /* 133 E> */ B(TestLessThan), R(1), U8(15),
+ B(JumpIfFalse), U8(5),
+ B(JumpLoop), U8(50), I8(0),
+ B(Ldar), R(0),
+ /* 146 S> */ B(Return),
+]
+constant pool: [
+ OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["s"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ l = {
+ 'c': 1.1,
+ 'd': 2.2
+ };
+ if (l['c'] < 3) {
+ l['c'] = 3;
+ } else {
+ l['d'] = 3;
+ }
+
+"
+frame size: 7
+parameter count: 1
+bytecode array length: 111
+bytecodes: [
+ /* 0 E> */ B(StackCheck),
+ /* 7 S> */ B(LdaConstant), U8(0),
+ B(Star), R(2),
+ B(LdaSmi), I8(41),
+ B(Star), R(3),
+ B(CallRuntime), U16(Runtime::kCreateObjectLiteralWithoutAllocationSite), R(2), U8(2),
+ /* 9 E> */ B(StaGlobal), U8(1), U8(0),
+ /* 63 S> */ B(LdaGlobal), U8(1), U8(2),
+ B(Star), R(1),
+ B(LdaConstant), U8(2),
+ B(Star), R(3),
+ B(Mov), R(1), R(2),
+ /* 68 E> */ B(InvokeIntrinsic), U8(Runtime::k_GetProperty), R(2), U8(2),
+ B(Star), R(1),
+ B(LdaSmi), I8(3),
+ /* 74 E> */ B(TestLessThan), R(1), U8(4),
+ B(JumpIfFalse), U8(36),
+ /* 89 S> */ B(LdaGlobal), U8(1), U8(2),
+ B(Star), R(1),
+ B(LdaSmi), I8(3),
+ B(Star), R(2),
+ B(LdaConstant), U8(2),
+ B(Star), R(4),
+ B(LdaZero),
+ B(Star), R(6),
+ B(Mov), R(1), R(3),
+ B(Mov), R(2), R(5),
+ /* 96 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4),
+ B(Mov), R(5), R(0),
+ B(Ldar), R(2),
+ B(Jump), U8(34),
+ /* 124 S> */ B(LdaGlobal), U8(1), U8(2),
+ B(Star), R(1),
+ B(LdaSmi), I8(3),
+ B(Star), R(2),
+ B(LdaConstant), U8(3),
+ B(Star), R(4),
+ B(LdaZero),
+ B(Star), R(6),
+ B(Mov), R(1), R(3),
+ B(Mov), R(2), R(5),
+ /* 131 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(3), U8(4),
+ B(Mov), R(5), R(0),
+ B(Ldar), R(2),
+ B(Ldar), R(0),
+ /* 150 S> */ B(Return),
+]
+constant pool: [
+ OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["c"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["d"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ a = [1.1, [2.2, 4.5]];
+
+"
+frame size: 3
+parameter count: 1
+bytecode array length: 20
+bytecodes: [
+ /* 0 E> */ B(StackCheck),
+ /* 7 S> */ B(LdaConstant), U8(0),
+ B(Star), R(1),
+ B(LdaSmi), I8(4),
+ B(Star), R(2),
+ B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(1), U8(2),
+ /* 9 E> */ B(StaGlobal), U8(1), U8(0),
+ B(Star), R(0),
+ /* 36 S> */ B(Return),
+]
+constant pool: [
+ ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ b = [];
+
+"
+frame size: 3
+parameter count: 1
+bytecode array length: 20
+bytecodes: [
+ /* 0 E> */ B(StackCheck),
+ /* 7 S> */ B(LdaConstant), U8(0),
+ B(Star), R(1),
+ B(LdaSmi), I8(37),
+ B(Star), R(2),
+ B(CallRuntime), U16(Runtime::kCreateArrayLiteralWithoutAllocationSite), R(1), U8(2),
+ /* 9 E> */ B(StaGlobal), U8(1), U8(0),
+ B(Star), R(0),
+ /* 21 S> */ B(Return),
+]
+constant pool: [
+ ARRAY_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"],
+]
+handlers: [
+]
+
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreWithoutOneShot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreWithoutOneShot.golden
new file mode 100644
index 0000000000..4b249ea15f
--- /dev/null
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoadStoreWithoutOneShot.golden
@@ -0,0 +1,119 @@
+#
+# Autogenerated by generate-bytecode-expectations.
+#
+
+---
+wrap: no
+top level: yes
+
+---
+snippet: "
+
+ l = {
+ 'aa': 1.1,
+ 'bb': 2.2
+ };
+
+ v = l['aa'] + l['bb'];
+ l['bb'] = 7;
+ l['aa'] = l['bb'];
+
+"
+frame size: 3
+parameter count: 1
+bytecode array length: 74
+bytecodes: [
+ /* 0 E> */ B(StackCheck),
+ /* 7 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), R(1),
+ B(Ldar), R(1),
+ /* 9 E> */ B(StaGlobal), U8(1), U8(1),
+ /* 66 S> */ B(LdaGlobal), U8(1), U8(4),
+ B(Star), R(1),
+ /* 71 E> */ B(LdaNamedProperty), R(1), U8(2), U8(6),
+ B(Star), R(1),
+ /* 80 E> */ B(LdaGlobal), U8(1), U8(4),
+ B(Star), R(2),
+ /* 81 E> */ B(LdaNamedProperty), R(2), U8(3), U8(8),
+ /* 78 E> */ B(Add), R(1), U8(3),
+ /* 68 E> */ B(StaGlobal), U8(4), U8(10),
+ /* 95 S> */ B(LdaGlobal), U8(1), U8(4),
+ B(Star), R(1),
+ B(LdaSmi), I8(7),
+ /* 103 E> */ B(StaNamedProperty), R(1), U8(3), U8(12),
+ /* 114 S> */ B(LdaGlobal), U8(1), U8(4),
+ B(Star), R(1),
+ /* 124 E> */ B(LdaGlobal), U8(1), U8(4),
+ B(Star), R(2),
+ /* 125 E> */ B(LdaNamedProperty), R(2), U8(3), U8(8),
+ B(Star), R(2),
+ /* 122 E> */ B(StaNamedProperty), R(1), U8(2), U8(14),
+ B(Mov), R(2), R(0),
+ B(Ldar), R(0),
+ /* 139 S> */ B(Return),
+]
+constant pool: [
+ OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["aa"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["bb"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["v"],
+]
+handlers: [
+]
+
+---
+snippet: "
+
+ l = {
+ 'cc': 3.1,
+ 'dd': 4.2
+ };
+ if (l['cc'] < 3) {
+ l['cc'] = 3;
+ } else {
+ l['dd'] = 3;
+ }
+
+"
+frame size: 3
+parameter count: 1
+bytecode array length: 70
+bytecodes: [
+ /* 0 E> */ B(StackCheck),
+ /* 7 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(41), R(1),
+ B(Ldar), R(1),
+ /* 9 E> */ B(StaGlobal), U8(1), U8(1),
+ /* 65 S> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(1),
+ /* 70 E> */ B(LdaNamedProperty), R(1), U8(2), U8(5),
+ B(Star), R(1),
+ B(LdaSmi), I8(3),
+ /* 77 E> */ B(TestLessThan), R(1), U8(7),
+ B(JumpIfFalse), U8(22),
+ /* 92 S> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(1),
+ B(LdaSmi), I8(3),
+ B(Star), R(2),
+ /* 100 E> */ B(StaNamedProperty), R(1), U8(2), U8(8),
+ B(Mov), R(2), R(0),
+ B(Ldar), R(2),
+ B(Jump), U8(20),
+ /* 128 S> */ B(LdaGlobal), U8(1), U8(3),
+ B(Star), R(1),
+ B(LdaSmi), I8(3),
+ B(Star), R(2),
+ /* 136 E> */ B(StaNamedProperty), R(1), U8(3), U8(10),
+ B(Mov), R(2), R(0),
+ B(Ldar), R(2),
+ B(Ldar), R(0),
+ /* 155 S> */ B(Return),
+]
+constant pool: [
+ OBJECT_BOILERPLATE_DESCRIPTION_TYPE,
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["l"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["cc"],
+ ONE_BYTE_INTERNALIZED_STRING_TYPE ["dd"],
+]
+handlers: [
+]
+
diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden
index e87ceaf0de..d870c4362f 100644
--- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden
+++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StandardForLoop.golden
@@ -229,7 +229,7 @@ bytecodes: [
B(JumpIfUndefined), U8(6),
B(Ldar), R(3),
B(JumpIfNotNull), U8(16),
- B(LdaSmi), I8(78),
+ B(LdaSmi), I8(81),
B(Star), R(4),
B(LdaConstant), U8(1),
B(Star), R(5),
diff --git a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc
index 4dad7d48ce..ef0f616528 100644
--- a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc
+++ b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc
@@ -42,6 +42,8 @@ class ProgramOptions final {
wrap_(true),
module_(false),
top_level_(false),
+ print_callee_(false),
+ oneshot_opt_(false),
do_expressions_(false),
async_iteration_(false),
public_fields_(false),
@@ -64,6 +66,8 @@ class ProgramOptions final {
bool wrap() const { return wrap_; }
bool module() const { return module_; }
bool top_level() const { return top_level_; }
+ bool print_callee() const { return print_callee_; }
+ bool oneshot_opt() const { return oneshot_opt_; }
bool do_expressions() const { return do_expressions_; }
bool async_iteration() const { return async_iteration_; }
bool public_fields() const { return public_fields_; }
@@ -84,6 +88,8 @@ class ProgramOptions final {
bool wrap_;
bool module_;
bool top_level_;
+ bool print_callee_;
+ bool oneshot_opt_;
bool do_expressions_;
bool async_iteration_;
bool public_fields_;
@@ -174,6 +180,10 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) {
options.module_ = true;
} else if (strcmp(argv[i], "--top-level") == 0) {
options.top_level_ = true;
+ } else if (strcmp(argv[i], "--print-callee") == 0) {
+ options.print_callee_ = true;
+ } else if (strcmp(argv[i], "--disable-oneshot-opt") == 0) {
+ options.oneshot_opt_ = false;
} else if (strcmp(argv[i], "--do-expressions") == 0) {
options.do_expressions_ = true;
} else if (strcmp(argv[i], "--async-iteration") == 0) {
@@ -269,6 +279,8 @@ bool ProgramOptions::Validate() const {
void ProgramOptions::UpdateFromHeader(std::istream& stream) {
std::string line;
+ const char* kPrintCallee = "print callee: ";
+ const char* kOneshotOpt = "oneshot opt: ";
// Skip to the beginning of the options header
while (std::getline(stream, line)) {
@@ -284,6 +296,10 @@ void ProgramOptions::UpdateFromHeader(std::istream& stream) {
test_function_name_ = line.c_str() + 20;
} else if (line.compare(0, 11, "top level: ") == 0) {
top_level_ = ParseBoolean(line.c_str() + 11);
+ } else if (line.compare(0, strlen(kPrintCallee), kPrintCallee) == 0) {
+ print_callee_ = ParseBoolean(line.c_str() + strlen(kPrintCallee));
+ } else if (line.compare(0, strlen(kOneshotOpt), kOneshotOpt) == 0) {
+ oneshot_opt_ = ParseBoolean(line.c_str() + strlen(kOneshotOpt));
} else if (line.compare(0, 16, "do expressions: ") == 0) {
do_expressions_ = ParseBoolean(line.c_str() + 16);
} else if (line.compare(0, 17, "async iteration: ") == 0) {
@@ -315,6 +331,8 @@ void ProgramOptions::PrintHeader(std::ostream& stream) const { // NOLINT
if (module_) stream << "\nmodule: yes";
if (top_level_) stream << "\ntop level: yes";
+ if (print_callee_) stream << "\nprint callee: yes";
+ if (oneshot_opt_) stream << "\noneshot opt: yes";
if (do_expressions_) stream << "\ndo expressions: yes";
if (async_iteration_) stream << "\nasync iteration: yes";
if (public_fields_) stream << "\npublic fields: yes";
@@ -364,6 +382,10 @@ bool ReadNextSnippet(std::istream& stream, std::string* string_out) { // NOLINT
}
if (!found_begin_snippet) continue;
if (line == "\"") return true;
+ if (line.size() == 0) {
+ string_out->append("\n"); // consume empty line
+ continue;
+ }
CHECK_GE(line.size(), 2u); // We should have the indent
string_out->append(line.begin() + 2, line.end());
*string_out += '\n';
@@ -418,6 +440,8 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT
printer.set_wrap(options.wrap());
printer.set_module(options.module());
printer.set_top_level(options.top_level());
+ printer.set_print_callee(options.print_callee());
+ printer.set_oneshot_opt(options.oneshot_opt());
if (!options.test_function_name().empty()) {
printer.set_test_function_name(options.test_function_name());
}
@@ -478,6 +502,9 @@ void PrintUsage(const char* exec_path) {
" --stdin Read from standard input instead of file.\n"
" --rebaseline Rebaseline input snippet file.\n"
" --no-wrap Do not wrap the snippet in a function.\n"
+ " --disable-oneshot-opt Disable Oneshot Optimization.\n"
+ " --print-callee Print bytecode of callee, function should "
+ "return arguments.callee.\n"
" --module Compile as JavaScript module.\n"
" --test-function-name=foo "
"Specify the name of the test function.\n"
diff --git a/deps/v8/test/cctest/interpreter/interpreter-tester.cc b/deps/v8/test/cctest/interpreter/interpreter-tester.cc
index d112511d22..acb06f2d8a 100644
--- a/deps/v8/test/cctest/interpreter/interpreter-tester.cc
+++ b/deps/v8/test/cctest/interpreter/interpreter-tester.cc
@@ -4,6 +4,7 @@
#include "test/cctest/interpreter/interpreter-tester.h"
+#include "src/api-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 561d163a69..0ec28d3653 100644
--- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
+++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc
@@ -129,6 +129,27 @@ std::string BuildActual(const BytecodeExpectationsPrinter& printer,
return actual_stream.str();
}
+// inplace left trim
+static inline void ltrim(std::string& str) {
+ str.erase(str.begin(),
+ std::find_if(str.begin(), str.end(),
+ [](unsigned char ch) { return !std::isspace(ch); }));
+}
+
+// inplace right trim
+static inline void rtrim(std::string& str) {
+ str.erase(std::find_if(str.rbegin(), str.rend(),
+ [](unsigned char ch) { return !std::isspace(ch); })
+ .base(),
+ str.end());
+}
+
+static inline std::string trim(std::string& str) {
+ ltrim(str);
+ rtrim(str);
+ return str;
+}
+
bool CompareTexts(const std::string& generated, const std::string& expected) {
std::istringstream generated_stream(generated);
std::istringstream expected_stream(expected);
@@ -157,7 +178,7 @@ bool CompareTexts(const std::string& generated, const std::string& expected) {
return false;
}
- if (generated_line != expected_line) {
+ if (trim(generated_line) != trim(expected_line)) {
std::cerr << "Inputs differ at line " << line_number << "\n";
std::cerr << " Generated: '" << generated_line << "'\n";
std::cerr << " Expected: '" << expected_line << "'\n";
@@ -411,6 +432,242 @@ TEST(PropertyLoads) {
LoadGolden("PropertyLoads.golden")));
}
+TEST(PropertyLoadStoreOneShot) {
+ InitializedIgnitionHandleScope scope;
+ BytecodeExpectationsPrinter printer(CcTest::isolate());
+ printer.set_wrap(false);
+ printer.set_top_level(true);
+ printer.set_oneshot_opt(true);
+
+ const char* snippets[] = {
+ R"(
+ l = {
+ 'a': 1,
+ 'b': 2
+ };
+
+ v = l['a'] + l['b'];
+ l['b'] = 7;
+ l['a'] = l['b'];
+ )",
+
+ R"(
+ l = {
+ 'a': 1.1,
+ 'b': 2.2
+ };
+ for (i = 0; i < 5; ++i) {
+ l['a'] = l['a'] + l['b'];
+ l['b'] = l['a'] + l['b'];
+ }
+ )",
+
+ R"(
+ l = {
+ 'a': 1.1,
+ 'b': 2.2
+ };
+ while (s > 0) {
+ l['a'] = l['a'] - l['b'];
+ l['b'] = l['b'] - l['a'];
+ }
+ )",
+
+ R"(
+ l = {
+ 'a': 1.1,
+ 'b': 2.2
+ };
+ s = 10;
+ do {
+ l['a'] = l['b'] - l['a'];
+ } while (s < 10);
+ )",
+
+ R"(
+ l = {
+ 'c': 1.1,
+ 'd': 2.2
+ };
+ if (l['c'] < 3) {
+ l['c'] = 3;
+ } else {
+ l['d'] = 3;
+ }
+ )",
+
+ R"(
+ a = [1.1, [2.2, 4.5]];
+ )",
+
+ R"(
+ b = [];
+ )",
+ };
+ CHECK(CompareTexts(BuildActual(printer, snippets),
+ LoadGolden("PropertyLoadStoreOneShot.golden")));
+}
+
+TEST(PropertyLoadStoreWithoutOneShot) {
+ InitializedIgnitionHandleScope scope;
+ BytecodeExpectationsPrinter printer(CcTest::isolate());
+ printer.set_wrap(false);
+ printer.set_top_level(true);
+
+ const char* snippets[] = {
+ R"(
+ l = {
+ 'aa': 1.1,
+ 'bb': 2.2
+ };
+
+ v = l['aa'] + l['bb'];
+ l['bb'] = 7;
+ l['aa'] = l['bb'];
+ )",
+
+ R"(
+ l = {
+ 'cc': 3.1,
+ 'dd': 4.2
+ };
+ if (l['cc'] < 3) {
+ l['cc'] = 3;
+ } else {
+ l['dd'] = 3;
+ }
+ )",
+ };
+ CHECK(CompareTexts(BuildActual(printer, snippets),
+ LoadGolden("PropertyLoadStoreWithoutOneShot.golden")));
+}
+
+TEST(IIFEWithOneshotOpt) {
+ InitializedIgnitionHandleScope scope;
+ v8::Isolate* isolate = CcTest::isolate();
+ BytecodeExpectationsPrinter printer(isolate);
+ printer.set_wrap(false);
+ printer.set_top_level(true);
+ printer.set_print_callee(true);
+ printer.set_oneshot_opt(true);
+
+ const char* snippets[] = {
+ // No feedback vectors for top-level loads/store named property in an IIFE
+ R"(
+ (function() {
+ l = {};
+ l.aa = 2;
+ l.bb = l.aa;
+ return arguments.callee;
+ })();
+ )",
+ // Normal load/store within loops of an IIFE
+ R"(
+ (function() {
+ l = {};
+ for (i = 0; i < 5; ++i) {
+ l.aa = 2;
+ l.bb = l.aa;
+ }
+ return arguments.callee;
+ })();
+ )",
+
+ R"(
+ (function() {
+ l = {};
+ c = 4;
+ while(c > 4) {
+ l.aa = 2;
+ l.bb = l.aa;
+ c--;
+ }
+ return arguments.callee;
+ })();
+ )",
+
+ R"(
+ (function() {
+ l = {};
+ c = 4;
+ do {
+ l.aa = 2;
+ l.bb = l.aa;
+ c--;
+ } while(c > 4)
+ return arguments.callee;
+ })();
+ )",
+ // No feedback vectors for loads/stores in conditionals
+ R"(
+ (function() {
+ l = {
+ 'aa': 3.3,
+ 'bb': 4.4
+ };
+ if (l.aa < 3) {
+ l.aa = 3;
+ } else {
+ l.aa = l.bb;
+ }
+ return arguments.callee;
+ })();
+ )",
+
+ R"(
+ (function() {
+ a = [0, [1, 1,2,], 3];
+ return arguments.callee;
+ })();
+ )",
+
+ R"(
+ (function() {
+ a = [];
+ return arguments.callee;
+ })();
+ )",
+ };
+ CHECK(CompareTexts(BuildActual(printer, snippets),
+ LoadGolden("IIFEWithOneshotOpt.golden")));
+}
+
+TEST(IIFEWithoutOneshotOpt) {
+ InitializedIgnitionHandleScope scope;
+ v8::Isolate* isolate = CcTest::isolate();
+ BytecodeExpectationsPrinter printer(isolate);
+ printer.set_wrap(false);
+ printer.set_top_level(true);
+ printer.set_print_callee(true);
+
+ const char* snippets[] = {
+ R"(
+ (function() {
+ l = {};
+ l.a = 2;
+ l.b = l.a;
+ return arguments.callee;
+ })();
+ )",
+ R"(
+ (function() {
+ l = {
+ 'a': 4.3,
+ 'b': 3.4
+ };
+ if (l.a < 3) {
+ l.a = 3;
+ } else {
+ l.a = l.b;
+ }
+ return arguments.callee;
+ })();
+ )",
+ };
+ CHECK(CompareTexts(BuildActual(printer, snippets),
+ LoadGolden("IIFEWithoutOneshotOpt.golden")));
+}
+
TEST(PropertyStores) {
InitializedIgnitionHandleScope scope;
BytecodeExpectationsPrinter printer(CcTest::isolate());
@@ -1202,6 +1459,12 @@ TEST(ArrayLiterals) {
"return [ [ 1, 2 ], [ 3 ] ];\n",
"var a = 1; return [ [ a, 2 ], [ a + 2 ] ];\n",
+
+ "var a = [ 1, 2 ]; return [ ...a ];\n",
+
+ "var a = [ 1, 2 ]; return [ 0, ...a ];\n",
+
+ "var a = [ 1, 2 ]; return [ ...a, 3 ];\n",
};
CHECK(CompareTexts(BuildActual(printer, snippets),
diff --git a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc
index 7eb76ecb21..57d42e2a83 100644
--- a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc
+++ b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc
@@ -4,6 +4,7 @@
#include "src/v8.h"
+#include "src/api-inl.h"
#include "src/interpreter/interpreter-intrinsics.h"
#include "src/objects-inl.h"
#include "test/cctest/interpreter/interpreter-tester.h"
@@ -209,14 +210,14 @@ TEST(IntrinsicAsStubCall) {
InvokeIntrinsicHelper has_property_helper(isolate, handles.main_zone(),
Runtime::kInlineHasProperty);
- CHECK_EQ(*factory->true_value(),
- *has_property_helper.Invoke(
- has_property_helper.NewObject("'x'"),
- has_property_helper.NewObject("({ x: 20 })")));
- CHECK_EQ(*factory->false_value(),
- *has_property_helper.Invoke(
- has_property_helper.NewObject("'y'"),
- has_property_helper.NewObject("({ x: 20 })")));
+ CHECK_EQ(
+ *factory->true_value(),
+ *has_property_helper.Invoke(has_property_helper.NewObject("({ x: 20 })"),
+ has_property_helper.NewObject("'x'")));
+ CHECK_EQ(
+ *factory->false_value(),
+ *has_property_helper.Invoke(has_property_helper.NewObject("({ x: 20 })"),
+ has_property_helper.NewObject("'y'")));
}
} // namespace interpreter
diff --git a/deps/v8/test/cctest/interpreter/test-interpreter.cc b/deps/v8/test/cctest/interpreter/test-interpreter.cc
index 11163d9688..c1898adf4e 100644
--- a/deps/v8/test/cctest/interpreter/test-interpreter.cc
+++ b/deps/v8/test/cctest/interpreter/test-interpreter.cc
@@ -6,6 +6,7 @@
#include "src/v8.h"
+#include "src/api-inl.h"
#include "src/execution.h"
#include "src/handles.h"
#include "src/interpreter/bytecode-array-builder.h"
diff --git a/deps/v8/test/cctest/interpreter/test-source-positions.cc b/deps/v8/test/cctest/interpreter/test-source-positions.cc
index 51dd41c720..8f2aae7e0b 100644
--- a/deps/v8/test/cctest/interpreter/test-source-positions.cc
+++ b/deps/v8/test/cctest/interpreter/test-source-positions.cc
@@ -4,7 +4,7 @@
#include "src/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/compiler/pipeline.h"
#include "src/handles.h"
#include "src/interpreter/bytecode-generator.h"
diff --git a/deps/v8/test/cctest/parsing/test-parse-decision.cc b/deps/v8/test/cctest/parsing/test-parse-decision.cc
index 926d4c24e0..f44a9e4b82 100644
--- a/deps/v8/test/cctest/parsing/test-parse-decision.cc
+++ b/deps/v8/test/cctest/parsing/test-parse-decision.cc
@@ -10,7 +10,7 @@
#include <unordered_map>
#include "include/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/handles-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
diff --git a/deps/v8/test/cctest/parsing/test-preparser.cc b/deps/v8/test/cctest/parsing/test-preparser.cc
index b63a079a78..473debec40 100644
--- a/deps/v8/test/cctest/parsing/test-preparser.cc
+++ b/deps/v8/test/cctest/parsing/test-preparser.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/ast/ast.h"
#include "src/compiler.h"
#include "src/objects-inl.h"
diff --git a/deps/v8/test/cctest/parsing/test-scanner-streams.cc b/deps/v8/test/cctest/parsing/test-scanner-streams.cc
index 6f9b58daf3..a9dc4482ef 100644
--- a/deps/v8/test/cctest/parsing/test-scanner-streams.cc
+++ b/deps/v8/test/cctest/parsing/test-scanner-streams.cc
@@ -185,6 +185,110 @@ TEST(Utf8SplitBOM) {
}
}
+TEST(Utf8SplitMultiBOM) {
+ // Construct chunks with a split BOM followed by another split BOM.
+ const char* chunks = "\xef\xbb\0\xbf\xef\xbb\0\xbf\0\0";
+ ChunkSource chunk_source(chunks);
+ std::unique_ptr<i::Utf16CharacterStream> stream(
+ v8::internal::ScannerStream::For(
+ &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr));
+
+ // Read the data, ensuring we get exactly one of the two BOMs back.
+ CHECK_EQ(0xFEFF, stream->Advance());
+ CHECK_EQ(i::Utf16CharacterStream::kEndOfInput, stream->Advance());
+}
+
+TEST(Utf8AdvanceUntil) {
+ // Test utf-8 advancing until a certain char.
+
+ const char line_term = '\n';
+ const size_t kLen = arraysize(unicode_utf8);
+ char data[kLen + 1];
+ strncpy(data, unicode_utf8, kLen);
+ data[kLen - 1] = line_term;
+ data[kLen] = '\0';
+
+ {
+ const char* chunks[] = {data, "\0"};
+ ChunkSource chunk_source(chunks);
+ std::unique_ptr<v8::internal::Utf16CharacterStream> stream(
+ v8::internal::ScannerStream::For(
+ &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr));
+
+ int32_t res = stream->AdvanceUntil(
+ [](int32_t c0_) { return unibrow::IsLineTerminator(c0_); });
+ CHECK_EQ(line_term, res);
+ }
+}
+
+TEST(AdvanceMatchAdvanceUntil) {
+ // Test if single advance and advanceUntil behave the same
+
+ char data[] = {'a', 'b', '\n', 'c', '\0'};
+
+ {
+ const char* chunks[] = {data, "\0"};
+ ChunkSource chunk_source_a(chunks);
+
+ std::unique_ptr<v8::internal::Utf16CharacterStream> stream_advance(
+ v8::internal::ScannerStream::For(
+ &chunk_source_a, v8::ScriptCompiler::StreamedSource::UTF8,
+ nullptr));
+
+ ChunkSource chunk_source_au(chunks);
+ std::unique_ptr<v8::internal::Utf16CharacterStream> stream_advance_until(
+ v8::internal::ScannerStream::For(
+ &chunk_source_au, v8::ScriptCompiler::StreamedSource::UTF8,
+ nullptr));
+
+ int32_t au_c0_ = stream_advance_until->AdvanceUntil(
+ [](int32_t c0_) { return unibrow::IsLineTerminator(c0_); });
+
+ int32_t a_c0_ = '0';
+ while (!unibrow::IsLineTerminator(a_c0_)) {
+ a_c0_ = stream_advance->Advance();
+ }
+
+ // Check both advances methods have the same output
+ CHECK_EQ(a_c0_, au_c0_);
+
+ // Check if both set the cursor to the correct position by advancing both
+ // streams by one character.
+ a_c0_ = stream_advance->Advance();
+ au_c0_ = stream_advance_until->Advance();
+ CHECK_EQ(a_c0_, au_c0_);
+ }
+}
+
+TEST(Utf8AdvanceUntilOverChunkBoundaries) {
+ // Test utf-8 advancing until a certain char, crossing chunk boundaries.
+
+ // Split the test string at each byte and pass it to the stream. This way,
+ // we'll have a split at each possible boundary.
+ size_t len = strlen(unicode_utf8);
+ char buffer[arraysize(unicode_utf8) + 4];
+ for (size_t i = 1; i < len; i++) {
+ // Copy source string into buffer, splitting it at i.
+ // Then add three chunks, 0..i-1, i..strlen-1, empty.
+ strncpy(buffer, unicode_utf8, i);
+ strncpy(buffer + i + 1, unicode_utf8 + i, len - i);
+ buffer[i] = '\0';
+ buffer[len + 1] = '\n';
+ buffer[len + 2] = '\0';
+ buffer[len + 3] = '\0';
+ const char* chunks[] = {buffer, buffer + i + 1, buffer + len + 2};
+
+ ChunkSource chunk_source(chunks);
+ std::unique_ptr<v8::internal::Utf16CharacterStream> stream(
+ v8::internal::ScannerStream::For(
+ &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8, nullptr));
+
+ int32_t res = stream->AdvanceUntil(
+ [](int32_t c0_) { return unibrow::IsLineTerminator(c0_); });
+ CHECK_EQ(buffer[len + 1], res);
+ }
+}
+
TEST(Utf8ChunkBoundaries) {
// Test utf-8 parsing at chunk boundaries.
@@ -323,7 +427,7 @@ void TestCharacterStreams(const char* one_byte_source, unsigned length,
// This avoids the GC from trying to free a stack allocated resource.
if (uc16_string->IsExternalString())
i::Handle<i::ExternalTwoByteString>::cast(uc16_string)
- ->set_resource(nullptr);
+ ->SetResource(isolate, nullptr);
}
// 1-byte external string
@@ -343,7 +447,7 @@ void TestCharacterStreams(const char* one_byte_source, unsigned length,
// This avoids the GC from trying to free a stack allocated resource.
if (ext_one_byte_string->IsExternalString())
i::Handle<i::ExternalOneByteString>::cast(ext_one_byte_string)
- ->set_resource(nullptr);
+ ->SetResource(isolate, nullptr);
}
// 1-byte generic i::String
@@ -560,3 +664,34 @@ TEST(TestOverlongAndInvalidSequences) {
CHECK_EQ(unicode_expected.size(), arraysize(cases));
TestChunkStreamAgainstReference(cases, unicode_expected);
}
+
+TEST(RelocatingCharacterStream) {
+ ManualGCScope manual_gc_scope;
+ CcTest::InitializeVM();
+ i::Isolate* i_isolate = CcTest::i_isolate();
+ v8::HandleScope scope(CcTest::isolate());
+
+ const char* string = "abcd";
+ int length = static_cast<int>(strlen(string));
+ std::unique_ptr<i::uc16[]> uc16_buffer(new i::uc16[length]);
+ for (int i = 0; i < length; i++) {
+ uc16_buffer[i] = string[i];
+ }
+ i::Vector<const i::uc16> two_byte_vector(uc16_buffer.get(), length);
+ i::Handle<i::String> two_byte_string =
+ i_isolate->factory()
+ ->NewStringFromTwoByte(two_byte_vector, i::NOT_TENURED)
+ .ToHandleChecked();
+ std::unique_ptr<i::Utf16CharacterStream> two_byte_string_stream(
+ i::ScannerStream::For(i_isolate, two_byte_string, 0, length));
+ CHECK_EQ('a', two_byte_string_stream->Advance());
+ CHECK_EQ('b', two_byte_string_stream->Advance());
+ CHECK_EQ(size_t{2}, two_byte_string_stream->pos());
+ i::String* raw = *two_byte_string;
+ i_isolate->heap()->CollectGarbage(i::NEW_SPACE,
+ i::GarbageCollectionReason::kUnknown);
+ // GC moved the string.
+ CHECK_NE(raw, *two_byte_string);
+ CHECK_EQ('c', two_byte_string_stream->Advance());
+ CHECK_EQ('d', two_byte_string_stream->Advance());
+}
diff --git a/deps/v8/test/cctest/parsing/test-scanner.cc b/deps/v8/test/cctest/parsing/test-scanner.cc
index ea7a8fbaa2..56fe0ed83a 100644
--- a/deps/v8/test/cctest/parsing/test-scanner.cc
+++ b/deps/v8/test/cctest/parsing/test-scanner.cc
@@ -21,7 +21,7 @@ const char src_simple[] = "function foo() { var x = 2 * a() + b; }";
struct ScannerTestHelper {
ScannerTestHelper() = default;
- ScannerTestHelper(ScannerTestHelper&& other)
+ ScannerTestHelper(ScannerTestHelper&& other) V8_NOEXCEPT
: unicode_cache(std::move(other.unicode_cache)),
stream(std::move(other.stream)),
scanner(std::move(other.scanner)) {}
@@ -38,9 +38,9 @@ ScannerTestHelper make_scanner(const char* src) {
ScannerTestHelper helper;
helper.unicode_cache = std::unique_ptr<UnicodeCache>(new UnicodeCache);
helper.stream = ScannerStream::ForTesting(src);
- helper.scanner =
- std::unique_ptr<Scanner>(new Scanner(helper.unicode_cache.get()));
- helper.scanner->Initialize(helper.stream.get(), false);
+ helper.scanner = std::unique_ptr<Scanner>(
+ new Scanner(helper.unicode_cache.get(), helper.stream.get(), false));
+ helper.scanner->Initialize();
return helper;
}
diff --git a/deps/v8/test/cctest/test-accessors.cc b/deps/v8/test/cctest/test-accessors.cc
index a998a28642..de1901b6d3 100644
--- a/deps/v8/test/cctest/test-accessors.cc
+++ b/deps/v8/test/cctest/test-accessors.cc
@@ -29,7 +29,7 @@
#include "src/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/frames-inl.h"
#include "src/string-stream.h"
#include "test/cctest/cctest.h"
@@ -812,7 +812,7 @@ TEST(PrototypeGetterAccessCheck) {
CHECK(try_catch.HasCaught());
}
- // Test crankshaft.
+ // Test TurboFan.
CompileRun("%OptimizeFunctionOnNextCall(f);");
security_check_value = true;
diff --git a/deps/v8/test/cctest/test-api-accessors.cc b/deps/v8/test/cctest/test-api-accessors.cc
index a570301213..5bda0432ea 100644
--- a/deps/v8/test/cctest/test-api-accessors.cc
+++ b/deps/v8/test/cctest/test-api-accessors.cc
@@ -17,7 +17,7 @@ static void UnreachableCallback(
}
TEST(CachedAccessor) {
- // Crankshaft support for fast accessors is not implemented; crankshafted
+ // TurboFan support for fast accessors is not implemented; turbofanned
// code uses the slow accessor which breaks this test's expectations.
v8::internal::FLAG_always_opt = false;
LocalContext env;
@@ -64,7 +64,7 @@ TEST(CachedAccessor) {
"Shhh, I'm private!");
}
-TEST(CachedAccessorCrankshaft) {
+TEST(CachedAccessorTurboFan) {
i::FLAG_allow_natives_syntax = true;
// v8::internal::FLAG_always_opt = false;
LocalContext env;
@@ -116,7 +116,7 @@ TEST(CachedAccessorCrankshaft) {
CHECK(obj->SetPrivate(env.local(), priv, v8::Integer::New(isolate, 456))
.FromJust());
- // Test Crankshaft.
+ // Test TurboFan.
CompileRun("%OptimizeFunctionOnNextCall(f);");
ExpectInt32("f()", 456);
@@ -140,7 +140,7 @@ TEST(CachedAccessorCrankshaft) {
CHECK(obj->SetPrivate(env.local(), priv, v8::Integer::New(isolate, 789))
.FromJust());
- // Test non-global access in Crankshaft.
+ // Test non-global access in TurboFan.
CompileRun("%OptimizeFunctionOnNextCall(g);");
ExpectInt32("g()", 789);
@@ -198,7 +198,7 @@ TEST(CachedAccessorOnGlobalObject) {
CHECK(obj->SetPrivate(env.local(), priv, v8::Integer::New(isolate, 456))
.FromJust());
- // Test Crankshaft.
+ // Test TurboFan.
CompileRun("%OptimizeFunctionOnNextCall(f);");
ExpectInt32("f()", 456);
@@ -222,7 +222,7 @@ TEST(CachedAccessorOnGlobalObject) {
CHECK(obj->SetPrivate(env.local(), priv, v8::Integer::New(isolate, 789))
.FromJust());
- // Test non-global access in Crankshaft.
+ // Test non-global access in TurboFan.
CompileRun("%OptimizeFunctionOnNextCall(g);");
ExpectInt32("g()", 789);
diff --git a/deps/v8/test/cctest/test-api-interceptors.cc b/deps/v8/test/cctest/test-api-interceptors.cc
index 030db759fe..9d9138670e 100644
--- a/deps/v8/test/cctest/test-api-interceptors.cc
+++ b/deps/v8/test/cctest/test-api-interceptors.cc
@@ -7,7 +7,7 @@
#include "test/cctest/test-api.h"
#include "include/v8-util.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/arguments.h"
#include "src/base/platform/platform.h"
#include "src/compilation-cache.h"
@@ -76,16 +76,17 @@ void EmptyInterceptorEnumerator(
void SimpleAccessorGetter(Local<String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
Local<Object> self = Local<Object>::Cast(info.This());
- info.GetReturnValue().Set(self->Get(info.GetIsolate()->GetCurrentContext(),
- String::Concat(v8_str("accessor_"), name))
- .ToLocalChecked());
+ info.GetReturnValue().Set(
+ self->Get(info.GetIsolate()->GetCurrentContext(),
+ String::Concat(info.GetIsolate(), v8_str("accessor_"), name))
+ .ToLocalChecked());
}
void SimpleAccessorSetter(Local<String> name, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) {
Local<Object> self = Local<Object>::Cast(info.This());
self->Set(info.GetIsolate()->GetCurrentContext(),
- String::Concat(v8_str("accessor_"), name), value)
+ String::Concat(info.GetIsolate(), v8_str("accessor_"), name), value)
.FromJust();
}
@@ -155,13 +156,14 @@ void GenericInterceptorGetter(Local<Name> generic_name,
if (generic_name->IsSymbol()) {
Local<Value> name = Local<Symbol>::Cast(generic_name)->Name();
if (name->IsUndefined()) return;
- str = String::Concat(v8_str("_sym_"), Local<String>::Cast(name));
+ str = String::Concat(info.GetIsolate(), v8_str("_sym_"),
+ Local<String>::Cast(name));
} else {
Local<String> name = Local<String>::Cast(generic_name);
String::Utf8Value utf8(info.GetIsolate(), name);
char* name_str = *utf8;
if (*name_str == '_') return;
- str = String::Concat(v8_str("_str_"), name);
+ str = String::Concat(info.GetIsolate(), v8_str("_str_"), name);
}
Local<Object> self = Local<Object>::Cast(info.This());
@@ -175,13 +177,14 @@ void GenericInterceptorSetter(Local<Name> generic_name, Local<Value> value,
if (generic_name->IsSymbol()) {
Local<Value> name = Local<Symbol>::Cast(generic_name)->Name();
if (name->IsUndefined()) return;
- str = String::Concat(v8_str("_sym_"), Local<String>::Cast(name));
+ str = String::Concat(info.GetIsolate(), v8_str("_sym_"),
+ Local<String>::Cast(name));
} else {
Local<String> name = Local<String>::Cast(generic_name);
String::Utf8Value utf8(info.GetIsolate(), name);
char* name_str = *utf8;
if (*name_str == '_') return;
- str = String::Concat(v8_str("_str_"), name);
+ str = String::Concat(info.GetIsolate(), v8_str("_str_"), name);
}
Local<Object> self = Local<Object>::Cast(info.This());
@@ -4304,8 +4307,7 @@ THREADED_TEST(Regress256330) {
CHECK_EQ(mask, status & mask);
}
-
-THREADED_TEST(CrankshaftInterceptorSetter) {
+THREADED_TEST(OptimizedInterceptorSetter) {
i::FLAG_allow_natives_syntax = true;
v8::HandleScope scope(CcTest::isolate());
Local<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
@@ -4334,8 +4336,7 @@ THREADED_TEST(CrankshaftInterceptorSetter) {
ExpectInt32("obj.accessor_age", 42);
}
-
-THREADED_TEST(CrankshaftInterceptorGetter) {
+THREADED_TEST(OptimizedInterceptorGetter) {
i::FLAG_allow_natives_syntax = true;
v8::HandleScope scope(CcTest::isolate());
Local<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
@@ -4361,8 +4362,7 @@ THREADED_TEST(CrankshaftInterceptorGetter) {
ExpectInt32("getAge()", 1);
}
-
-THREADED_TEST(CrankshaftInterceptorFieldRead) {
+THREADED_TEST(OptimizedInterceptorFieldRead) {
i::FLAG_allow_natives_syntax = true;
v8::HandleScope scope(CcTest::isolate());
Local<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
@@ -4385,8 +4385,7 @@ THREADED_TEST(CrankshaftInterceptorFieldRead) {
ExpectInt32("getAge();", 100);
}
-
-THREADED_TEST(CrankshaftInterceptorFieldWrite) {
+THREADED_TEST(OptimizedInterceptorFieldWrite) {
i::FLAG_allow_natives_syntax = true;
v8::HandleScope scope(CcTest::isolate());
Local<FunctionTemplate> templ = FunctionTemplate::New(CcTest::isolate());
@@ -5026,7 +5025,7 @@ void ConcatNamedPropertyGetter(
Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) {
info.GetReturnValue().Set(
// Return the property name concatenated with itself.
- String::Concat(name.As<String>(), name.As<String>()));
+ String::Concat(info.GetIsolate(), name.As<String>(), name.As<String>()));
}
void ConcatIndexedPropertyGetter(
diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc
index a018e12853..bf5aba2df6 100644
--- a/deps/v8/test/cctest/test-api.cc
+++ b/deps/v8/test/cctest/test-api.cc
@@ -38,7 +38,7 @@
#endif
#include "include/v8-util.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/arguments.h"
#include "src/base/platform/platform.h"
#include "src/code-stubs.h"
@@ -52,12 +52,14 @@
#include "src/lookup.h"
#include "src/objects-inl.h"
#include "src/objects/hash-table-inl.h"
+#include "src/objects/js-array-buffer-inl.h"
+#include "src/objects/js-array-inl.h"
#include "src/objects/js-promise-inl.h"
-#include "src/parsing/preparse-data.h"
#include "src/profiler/cpu-profiler.h"
#include "src/unicode-inl.h"
#include "src/utils.h"
#include "src/vm-state.h"
+#include "src/wasm/wasm-js.h"
#include "test/cctest/heap/heap-tester.h"
#include "test/cctest/heap/heap-utils.h"
@@ -374,7 +376,7 @@ THREADED_TEST(HulIgennem) {
v8::Local<v8::Primitive> undef = v8::Undefined(isolate);
Local<String> undef_str = undef->ToString(env.local()).ToLocalChecked();
char* value = i::NewArray<char>(undef_str->Utf8Length(isolate) + 1);
- undef_str->WriteUtf8(value);
+ undef_str->WriteUtf8(isolate, value);
CHECK_EQ(0, strcmp(value, "undefined"));
i::DeleteArray(value);
}
@@ -911,7 +913,8 @@ TEST(ExternalStringWithDisposeHandling) {
THREADED_TEST(StringConcat) {
{
LocalContext env;
- v8::HandleScope scope(env->GetIsolate());
+ v8::Isolate* isolate = env->GetIsolate();
+ v8::HandleScope scope(isolate);
const char* one_byte_string_1 = "function a_times_t";
const char* two_byte_string_1 = "wo_plus_b(a, b) {return ";
const char* one_byte_extern_1 = "a * 2 + b;} a_times_two_plus_b(4, 8) + ";
@@ -928,19 +931,19 @@ THREADED_TEST(StringConcat) {
.ToLocalChecked();
i::DeleteArray(two_byte_source);
- Local<String> source = String::Concat(left, right);
+ Local<String> source = String::Concat(isolate, left, right);
right = String::NewExternalOneByte(
env->GetIsolate(),
new TestOneByteResource(i::StrDup(one_byte_extern_1)))
.ToLocalChecked();
- source = String::Concat(source, right);
+ source = String::Concat(isolate, source, right);
right = String::NewExternalTwoByte(
env->GetIsolate(),
new TestResource(AsciiToTwoByteString(two_byte_extern_1)))
.ToLocalChecked();
- source = String::Concat(source, right);
+ source = String::Concat(isolate, source, right);
right = v8_str(one_byte_string_2);
- source = String::Concat(source, right);
+ source = String::Concat(isolate, source, right);
two_byte_source = AsciiToTwoByteString(two_byte_string_2);
right = String::NewFromTwoByte(env->GetIsolate(), two_byte_source,
@@ -948,12 +951,12 @@ THREADED_TEST(StringConcat) {
.ToLocalChecked();
i::DeleteArray(two_byte_source);
- source = String::Concat(source, right);
+ source = String::Concat(isolate, source, right);
right = String::NewExternalTwoByte(
env->GetIsolate(),
new TestResource(AsciiToTwoByteString(two_byte_extern_2)))
.ToLocalChecked();
- source = String::Concat(source, right);
+ source = String::Concat(isolate, source, right);
Local<Script> script = v8_compile(source);
Local<Value> value = script->Run(env.local()).ToLocalChecked();
CHECK(value->IsNumber());
@@ -1736,7 +1739,8 @@ THREADED_TEST(StringObject) {
Local<v8::String> the_string = as_boxed->ValueOf();
CHECK(!the_string.IsEmpty());
ExpectObject("\"test\"", the_string);
- v8::Local<v8::Value> new_boxed_string = v8::StringObject::New(the_string);
+ v8::Local<v8::Value> new_boxed_string =
+ v8::StringObject::New(CcTest::isolate(), the_string);
CHECK(new_boxed_string->IsStringObject());
as_boxed = new_boxed_string.As<v8::StringObject>();
the_string = as_boxed->ValueOf();
@@ -2469,7 +2473,7 @@ THREADED_TEST(DescriptorInheritance2) {
for (int i = 0; i < kDataPropertiesNumber; i++) {
v8::Local<v8::Value> val = v8_num(i);
v8::Local<v8::String> val_str = val->ToString(env.local()).ToLocalChecked();
- v8::Local<v8::String> name = String::Concat(v8_str("p"), val_str);
+ v8::Local<v8::String> name = String::Concat(isolate, v8_str("p"), val_str);
templ->Set(name, val);
templ->Set(val_str, val);
@@ -2506,7 +2510,7 @@ THREADED_TEST(DescriptorInheritance2) {
for (int i = 0; i < kDataPropertiesNumber; i++) {
v8::Local<v8::Value> val = v8_num(i);
v8::Local<v8::String> val_str = val->ToString(env.local()).ToLocalChecked();
- v8::Local<v8::String> name = String::Concat(v8_str("p"), val_str);
+ v8::Local<v8::String> name = String::Concat(isolate, v8_str("p"), val_str);
CHECK_EQ(i, object->Get(env.local(), name)
.ToLocalChecked()
@@ -2525,16 +2529,18 @@ THREADED_TEST(DescriptorInheritance2) {
void SimpleAccessorGetter(Local<String> name,
const v8::PropertyCallbackInfo<v8::Value>& info) {
Local<Object> self = Local<Object>::Cast(info.This());
- info.GetReturnValue().Set(self->Get(info.GetIsolate()->GetCurrentContext(),
- String::Concat(v8_str("accessor_"), name))
- .ToLocalChecked());
+ info.GetReturnValue().Set(
+ self->Get(info.GetIsolate()->GetCurrentContext(),
+ String::Concat(info.GetIsolate(), v8_str("accessor_"), name))
+ .ToLocalChecked());
}
void SimpleAccessorSetter(Local<String> name, Local<Value> value,
const v8::PropertyCallbackInfo<void>& info) {
Local<Object> self = Local<Object>::Cast(info.This());
CHECK(self->Set(info.GetIsolate()->GetCurrentContext(),
- String::Concat(v8_str("accessor_"), name), value)
+ String::Concat(info.GetIsolate(), v8_str("accessor_"), name),
+ value)
.FromJust());
}
@@ -7841,10 +7847,18 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) {
v8::WeakCallbackType::kParameter);
object_b.handle.SetWeak(&object_b, &SetFlag,
v8::WeakCallbackType::kParameter);
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+#endif
+ // MarkIndependent is marked deprecated but we still rely on it temporarily.
CHECK(!object_b.handle.IsIndependent());
object_a.handle.MarkIndependent();
object_b.handle.MarkIndependent();
CHECK(object_b.handle.IsIndependent());
+#if __clang__
+#pragma clang diagnostic pop
+#endif
if (global_gc) {
CcTest::CollectAllGarbage();
} else {
@@ -7996,9 +8010,17 @@ void v8::internal::heap::HeapTester::ResetWeakHandle(bool global_gc) {
object_b.handle.SetWeak(&object_b, &ResetUseValueAndSetFlag,
v8::WeakCallbackType::kParameter);
if (!global_gc) {
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+#endif
+ // MarkIndependent is marked deprecated but we still rely on it temporarily.
object_a.handle.MarkIndependent();
object_b.handle.MarkIndependent();
CHECK(object_b.handle.IsIndependent());
+#if __clang__
+#pragma clang diagnostic pop
+#endif
}
if (global_gc) {
CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask);
@@ -8067,7 +8089,16 @@ THREADED_TEST(GCFromWeakCallbacks) {
object.flag = false;
object.handle.SetWeak(&object, gc_forcing_callback[inner_gc],
v8::WeakCallbackType::kParameter);
+#if __clang__
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+#endif
+ // MarkIndependent is marked deprecated but we still rely on it
+ // temporarily.
object.handle.MarkIndependent();
+#if __clang__
+#pragma clang diagnostic pop
+#endif
invoke_gc[outer_gc]();
EmptyMessageQueues(isolate);
CHECK(object.flag);
@@ -8285,7 +8316,8 @@ int GetUtf8Length(v8::Isolate* isolate, Local<String> str) {
THREADED_TEST(StringWrite) {
LocalContext context;
- v8::HandleScope scope(context->GetIsolate());
+ v8::Isolate* isolate = context->GetIsolate();
+ v8::HandleScope scope(isolate);
v8::Local<String> str = v8_str("abcde");
// abc<Icelandic eth><Unicode snowman>.
v8::Local<String> str2 = v8_str("abc\xC3\xB0\xE2\x98\x83");
@@ -8347,65 +8379,63 @@ THREADED_TEST(StringWrite) {
int charlen;
memset(utf8buf, 0x1, 1000);
- len = str2->WriteUtf8(utf8buf, sizeof(utf8buf), &charlen);
+ len = str2->WriteUtf8(isolate, utf8buf, sizeof(utf8buf), &charlen);
CHECK_EQ(9, len);
CHECK_EQ(5, charlen);
CHECK_EQ(0, strcmp(utf8buf, "abc\xC3\xB0\xE2\x98\x83"));
memset(utf8buf, 0x1, 1000);
- len = str2->WriteUtf8(utf8buf, 8, &charlen);
+ len = str2->WriteUtf8(isolate, utf8buf, 8, &charlen);
CHECK_EQ(8, len);
CHECK_EQ(5, charlen);
CHECK_EQ(0, strncmp(utf8buf, "abc\xC3\xB0\xE2\x98\x83\x01", 9));
memset(utf8buf, 0x1, 1000);
- len = str2->WriteUtf8(utf8buf, 7, &charlen);
+ len = str2->WriteUtf8(isolate, utf8buf, 7, &charlen);
CHECK_EQ(5, len);
CHECK_EQ(4, charlen);
CHECK_EQ(0, strncmp(utf8buf, "abc\xC3\xB0\x01", 5));
memset(utf8buf, 0x1, 1000);
- len = str2->WriteUtf8(utf8buf, 6, &charlen);
+ len = str2->WriteUtf8(isolate, utf8buf, 6, &charlen);
CHECK_EQ(5, len);
CHECK_EQ(4, charlen);
CHECK_EQ(0, strncmp(utf8buf, "abc\xC3\xB0\x01", 5));
memset(utf8buf, 0x1, 1000);
- len = str2->WriteUtf8(utf8buf, 5, &charlen);
+ len = str2->WriteUtf8(isolate, utf8buf, 5, &charlen);
CHECK_EQ(5, len);
CHECK_EQ(4, charlen);
CHECK_EQ(0, strncmp(utf8buf, "abc\xC3\xB0\x01", 5));
memset(utf8buf, 0x1, 1000);
- len = str2->WriteUtf8(utf8buf, 4, &charlen);
+ len = str2->WriteUtf8(isolate, utf8buf, 4, &charlen);
CHECK_EQ(3, len);
CHECK_EQ(3, charlen);
CHECK_EQ(0, strncmp(utf8buf, "abc\x01", 4));
memset(utf8buf, 0x1, 1000);
- len = str2->WriteUtf8(utf8buf, 3, &charlen);
+ len = str2->WriteUtf8(isolate, utf8buf, 3, &charlen);
CHECK_EQ(3, len);
CHECK_EQ(3, charlen);
CHECK_EQ(0, strncmp(utf8buf, "abc\x01", 4));
memset(utf8buf, 0x1, 1000);
- len = str2->WriteUtf8(utf8buf, 2, &charlen);
+ len = str2->WriteUtf8(isolate, utf8buf, 2, &charlen);
CHECK_EQ(2, len);
CHECK_EQ(2, charlen);
CHECK_EQ(0, strncmp(utf8buf, "ab\x01", 3));
// allow orphan surrogates by default
memset(utf8buf, 0x1, 1000);
- len = orphans_str->WriteUtf8(utf8buf, sizeof(utf8buf), &charlen);
+ len = orphans_str->WriteUtf8(isolate, utf8buf, sizeof(utf8buf), &charlen);
CHECK_EQ(13, len);
CHECK_EQ(8, charlen);
CHECK_EQ(0, strcmp(utf8buf, "ab\xED\xA0\x80wx\xED\xB0\x80yz"));
// replace orphan surrogates with Unicode replacement character
memset(utf8buf, 0x1, 1000);
- len = orphans_str->WriteUtf8(utf8buf,
- sizeof(utf8buf),
- &charlen,
+ len = orphans_str->WriteUtf8(isolate, utf8buf, sizeof(utf8buf), &charlen,
String::REPLACE_INVALID_UTF8);
CHECK_EQ(13, len);
CHECK_EQ(8, charlen);
@@ -8413,9 +8443,7 @@ THREADED_TEST(StringWrite) {
// replace single lead surrogate with Unicode replacement character
memset(utf8buf, 0x1, 1000);
- len = lead_str->WriteUtf8(utf8buf,
- sizeof(utf8buf),
- &charlen,
+ len = lead_str->WriteUtf8(isolate, utf8buf, sizeof(utf8buf), &charlen,
String::REPLACE_INVALID_UTF8);
CHECK_EQ(4, len);
CHECK_EQ(1, charlen);
@@ -8423,9 +8451,7 @@ THREADED_TEST(StringWrite) {
// replace single trail surrogate with Unicode replacement character
memset(utf8buf, 0x1, 1000);
- len = trail_str->WriteUtf8(utf8buf,
- sizeof(utf8buf),
- &charlen,
+ len = trail_str->WriteUtf8(isolate, utf8buf, sizeof(utf8buf), &charlen,
String::REPLACE_INVALID_UTF8);
CHECK_EQ(4, len);
CHECK_EQ(1, charlen);
@@ -8434,19 +8460,17 @@ THREADED_TEST(StringWrite) {
// do not replace / write anything if surrogate pair does not fit the buffer
// space
memset(utf8buf, 0x1, 1000);
- len = pair_str->WriteUtf8(utf8buf,
- 3,
- &charlen,
- String::REPLACE_INVALID_UTF8);
+ len = pair_str->WriteUtf8(isolate, utf8buf, 3, &charlen,
+ String::REPLACE_INVALID_UTF8);
CHECK_EQ(0, len);
CHECK_EQ(0, charlen);
memset(utf8buf, 0x1, sizeof(utf8buf));
- len = GetUtf8Length(context->GetIsolate(), left_tree);
+ len = GetUtf8Length(isolate, left_tree);
int utf8_expected =
(0x80 + (0x800 - 0x80) * 2 + (0xD800 - 0x800) * 3) / kStride;
CHECK_EQ(utf8_expected, len);
- len = left_tree->WriteUtf8(utf8buf, utf8_expected, &charlen);
+ len = left_tree->WriteUtf8(isolate, utf8buf, utf8_expected, &charlen);
CHECK_EQ(utf8_expected, len);
CHECK_EQ(0xD800 / kStride, charlen);
CHECK_EQ(0xED, static_cast<unsigned char>(utf8buf[utf8_expected - 3]));
@@ -8456,9 +8480,9 @@ THREADED_TEST(StringWrite) {
CHECK_EQ(1, utf8buf[utf8_expected]);
memset(utf8buf, 0x1, sizeof(utf8buf));
- len = GetUtf8Length(context->GetIsolate(), right_tree);
+ len = GetUtf8Length(isolate, right_tree);
CHECK_EQ(utf8_expected, len);
- len = right_tree->WriteUtf8(utf8buf, utf8_expected, &charlen);
+ len = right_tree->WriteUtf8(isolate, utf8buf, utf8_expected, &charlen);
CHECK_EQ(utf8_expected, len);
CHECK_EQ(0xD800 / kStride, charlen);
CHECK_EQ(0xED, static_cast<unsigned char>(utf8buf[0]));
@@ -8468,9 +8492,9 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf));
+ len = str->WriteOneByte(isolate, reinterpret_cast<uint8_t*>(buf));
CHECK_EQ(5, len);
- len = str->Write(wbuf);
+ len = str->Write(isolate, wbuf);
CHECK_EQ(5, len);
CHECK_EQ(0, strcmp("abcde", buf));
uint16_t answer1[] = {'a', 'b', 'c', 'd', 'e', '\0'};
@@ -8478,9 +8502,9 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 0, 4);
+ len = str->WriteOneByte(isolate, reinterpret_cast<uint8_t*>(buf), 0, 4);
CHECK_EQ(4, len);
- len = str->Write(wbuf, 0, 4);
+ len = str->Write(isolate, wbuf, 0, 4);
CHECK_EQ(4, len);
CHECK_EQ(0, strncmp("abcd\x01", buf, 5));
uint16_t answer2[] = {'a', 'b', 'c', 'd', 0x101};
@@ -8488,9 +8512,9 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 0, 5);
+ len = str->WriteOneByte(isolate, reinterpret_cast<uint8_t*>(buf), 0, 5);
CHECK_EQ(5, len);
- len = str->Write(wbuf, 0, 5);
+ len = str->Write(isolate, wbuf, 0, 5);
CHECK_EQ(5, len);
CHECK_EQ(0, strncmp("abcde\x01", buf, 6));
uint16_t answer3[] = {'a', 'b', 'c', 'd', 'e', 0x101};
@@ -8498,9 +8522,9 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 0, 6);
+ len = str->WriteOneByte(isolate, reinterpret_cast<uint8_t*>(buf), 0, 6);
CHECK_EQ(5, len);
- len = str->Write(wbuf, 0, 6);
+ len = str->Write(isolate, wbuf, 0, 6);
CHECK_EQ(5, len);
CHECK_EQ(0, strcmp("abcde", buf));
uint16_t answer4[] = {'a', 'b', 'c', 'd', 'e', '\0'};
@@ -8508,9 +8532,9 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 4, -1);
+ len = str->WriteOneByte(isolate, reinterpret_cast<uint8_t*>(buf), 4, -1);
CHECK_EQ(1, len);
- len = str->Write(wbuf, 4, -1);
+ len = str->Write(isolate, wbuf, 4, -1);
CHECK_EQ(1, len);
CHECK_EQ(0, strcmp("e", buf));
uint16_t answer5[] = {'e', '\0'};
@@ -8518,18 +8542,18 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 4, 6);
+ len = str->WriteOneByte(isolate, reinterpret_cast<uint8_t*>(buf), 4, 6);
CHECK_EQ(1, len);
- len = str->Write(wbuf, 4, 6);
+ len = str->Write(isolate, wbuf, 4, 6);
CHECK_EQ(1, len);
CHECK_EQ(0, strcmp("e", buf));
CHECK_EQ(0, StrCmp16(answer5, wbuf));
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 4, 1);
+ len = str->WriteOneByte(isolate, reinterpret_cast<uint8_t*>(buf), 4, 1);
CHECK_EQ(1, len);
- len = str->Write(wbuf, 4, 1);
+ len = str->Write(isolate, wbuf, 4, 1);
CHECK_EQ(1, len);
CHECK_EQ(0, strncmp("e\x01", buf, 2));
uint16_t answer6[] = {'e', 0x101};
@@ -8537,9 +8561,9 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
memset(wbuf, 0x1, sizeof(wbuf));
- len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf), 3, 1);
+ len = str->WriteOneByte(isolate, reinterpret_cast<uint8_t*>(buf), 3, 1);
CHECK_EQ(1, len);
- len = str->Write(wbuf, 3, 1);
+ len = str->Write(isolate, wbuf, 3, 1);
CHECK_EQ(1, len);
CHECK_EQ(0, strncmp("d\x01", buf, 2));
uint16_t answer7[] = {'d', 0x101};
@@ -8547,7 +8571,7 @@ THREADED_TEST(StringWrite) {
memset(wbuf, 0x1, sizeof(wbuf));
wbuf[5] = 'X';
- len = str->Write(wbuf, 0, 6, String::NO_NULL_TERMINATION);
+ len = str->Write(isolate, wbuf, 0, 6, String::NO_NULL_TERMINATION);
CHECK_EQ(5, len);
CHECK_EQ('X', wbuf[5]);
uint16_t answer8a[] = {'a', 'b', 'c', 'd', 'e'};
@@ -8559,9 +8583,7 @@ THREADED_TEST(StringWrite) {
memset(buf, 0x1, sizeof(buf));
buf[5] = 'X';
- len = str->WriteOneByte(reinterpret_cast<uint8_t*>(buf),
- 0,
- 6,
+ len = str->WriteOneByte(isolate, reinterpret_cast<uint8_t*>(buf), 0, 6,
String::NO_NULL_TERMINATION);
CHECK_EQ(5, len);
CHECK_EQ('X', buf[5]);
@@ -8572,7 +8594,7 @@ THREADED_TEST(StringWrite) {
memset(utf8buf, 0x1, sizeof(utf8buf));
utf8buf[8] = 'X';
- len = str2->WriteUtf8(utf8buf, sizeof(utf8buf), &charlen,
+ len = str2->WriteUtf8(isolate, utf8buf, sizeof(utf8buf), &charlen,
String::NO_NULL_TERMINATION);
CHECK_EQ(8, len);
CHECK_EQ('X', utf8buf[8]);
@@ -8584,8 +8606,8 @@ THREADED_TEST(StringWrite) {
memset(utf8buf, 0x1, sizeof(utf8buf));
utf8buf[5] = 'X';
- len = str->WriteUtf8(utf8buf, sizeof(utf8buf), &charlen,
- String::NO_NULL_TERMINATION);
+ len = str->WriteUtf8(isolate, utf8buf, sizeof(utf8buf), &charlen,
+ String::NO_NULL_TERMINATION);
CHECK_EQ(5, len);
CHECK_EQ('X', utf8buf[5]); // Test that the sixth character is untouched.
CHECK_EQ(5, charlen);
@@ -8593,15 +8615,17 @@ THREADED_TEST(StringWrite) {
CHECK_EQ(0, strcmp(utf8buf, "abcde"));
memset(buf, 0x1, sizeof(buf));
- len = str3->WriteOneByte(reinterpret_cast<uint8_t*>(buf));
+ len = str3->WriteOneByte(isolate, reinterpret_cast<uint8_t*>(buf));
CHECK_EQ(7, len);
CHECK_EQ(0, strcmp("abc", buf));
CHECK_EQ(0, buf[3]);
CHECK_EQ(0, strcmp("def", buf + 4));
- CHECK_EQ(0, str->WriteOneByte(nullptr, 0, 0, String::NO_NULL_TERMINATION));
- CHECK_EQ(0, str->WriteUtf8(nullptr, 0, 0, String::NO_NULL_TERMINATION));
- CHECK_EQ(0, str->Write(nullptr, 0, 0, String::NO_NULL_TERMINATION));
+ CHECK_EQ(0, str->WriteOneByte(isolate, nullptr, 0, 0,
+ String::NO_NULL_TERMINATION));
+ CHECK_EQ(0,
+ str->WriteUtf8(isolate, nullptr, 0, 0, String::NO_NULL_TERMINATION));
+ CHECK_EQ(0, str->Write(isolate, nullptr, 0, 0, String::NO_NULL_TERMINATION));
}
@@ -8627,14 +8651,14 @@ static void Utf16Helper(
}
void TestUtf8DecodingAgainstReference(
- const char* cases[],
+ v8::Isolate* isolate, const char* cases[],
const std::vector<std::vector<uint16_t>>& unicode_expected) {
for (size_t test_ix = 0; test_ix < unicode_expected.size(); ++test_ix) {
v8::Local<String> str = v8_str(cases[test_ix]);
CHECK_EQ(unicode_expected[test_ix].size(), str->Length());
std::unique_ptr<uint16_t[]> buffer(new uint16_t[str->Length()]);
- str->Write(buffer.get(), 0, -1, String::NO_NULL_TERMINATION);
+ str->Write(isolate, buffer.get(), 0, -1, String::NO_NULL_TERMINATION);
for (size_t i = 0; i < unicode_expected[test_ix].size(); ++i) {
CHECK_EQ(unicode_expected[test_ix][i], buffer[i]);
@@ -8684,7 +8708,8 @@ THREADED_TEST(OverlongSequencesAndSurrogates) {
{0x58, 0xFFFD, 0xFFFD, 0xFFFD, 0x59},
};
CHECK_EQ(unicode_expected.size(), arraysize(cases));
- TestUtf8DecodingAgainstReference(cases, unicode_expected);
+ TestUtf8DecodingAgainstReference(context->GetIsolate(), cases,
+ unicode_expected);
}
THREADED_TEST(Utf16) {
@@ -10592,7 +10617,7 @@ THREADED_TEST(GlobalObjectInstanceProperties) {
v8::FunctionTemplate::New(isolate,
InstanceFunctionCallback));
- // The script to check how Crankshaft compiles missing global function
+ // The script to check how TurboFan compiles missing global function
// invocations. function g is not defined and should throw on call.
const char* script =
"function wrapper(call) {"
@@ -10639,8 +10664,8 @@ THREADED_TEST(ObjectGetOwnPropertyNames) {
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope handle_scope(isolate);
- v8::Local<v8::Object> value =
- v8::Local<v8::Object>::Cast(v8::StringObject::New(v8_str("test")));
+ v8::Local<v8::Object> value = v8::Local<v8::Object>::Cast(
+ v8::StringObject::New(CcTest::isolate(), v8_str("test")));
v8::Local<v8::Array> properties;
CHECK(value
@@ -15366,6 +15391,9 @@ THREADED_TEST(GetPropertyNames) {
v8::HandleScope scope(isolate);
v8::Local<v8::Value> result = CompileRun(
"var result = {0: 0, 1: 1, a: 2, b: 3};"
+ "result[2**32] = '4294967296';"
+ "result[2**32-1] = '4294967295';"
+ "result[2**32-2] = '4294967294';"
"result[Symbol('symbol')] = true;"
"result.__proto__ = {__proto__:null, 2: 4, 3: 5, c: 6, d: 7};"
"result;");
@@ -15376,8 +15404,10 @@ THREADED_TEST(GetPropertyNames) {
v8::Local<v8::Array> properties =
object->GetPropertyNames(context.local()).ToLocalChecked();
- const char* expected_properties1[] = {"0", "1", "a", "b", "2", "3", "c", "d"};
- CheckStringArray(isolate, properties, 8, expected_properties1);
+ const char* expected_properties1[] = {"0", "1", "4294967294", "a",
+ "b", "4294967296", "4294967295", "2",
+ "3", "c", "d"};
+ CheckStringArray(isolate, properties, 11, expected_properties1);
properties =
object
@@ -15385,7 +15415,7 @@ THREADED_TEST(GetPropertyNames) {
v8::KeyCollectionMode::kIncludePrototypes,
default_filter, v8::IndexFilter::kIncludeIndices)
.ToLocalChecked();
- CheckStringArray(isolate, properties, 8, expected_properties1);
+ CheckStringArray(isolate, properties, 11, expected_properties1);
properties = object
->GetPropertyNames(context.local(),
@@ -15393,10 +15423,11 @@ THREADED_TEST(GetPropertyNames) {
include_symbols_filter,
v8::IndexFilter::kIncludeIndices)
.ToLocalChecked();
- const char* expected_properties1_1[] = {"0", "1", "a", "b", nullptr,
- "2", "3", "c", "d"};
- CheckStringArray(isolate, properties, 9, expected_properties1_1);
- CheckIsSymbolAt(isolate, properties, 4, "symbol");
+ const char* expected_properties1_1[] = {
+ "0", "1", "4294967294", "a", "b", "4294967296",
+ "4294967295", nullptr, "2", "3", "c", "d"};
+ CheckStringArray(isolate, properties, 12, expected_properties1_1);
+ CheckIsSymbolAt(isolate, properties, 7, "symbol");
properties =
object
@@ -15404,8 +15435,9 @@ THREADED_TEST(GetPropertyNames) {
v8::KeyCollectionMode::kIncludePrototypes,
default_filter, v8::IndexFilter::kSkipIndices)
.ToLocalChecked();
- const char* expected_properties2[] = {"a", "b", "c", "d"};
- CheckStringArray(isolate, properties, 4, expected_properties2);
+ const char* expected_properties2[] = {"a", "b", "4294967296",
+ "4294967295", "c", "d"};
+ CheckStringArray(isolate, properties, 6, expected_properties2);
properties = object
->GetPropertyNames(context.local(),
@@ -15413,43 +15445,48 @@ THREADED_TEST(GetPropertyNames) {
include_symbols_filter,
v8::IndexFilter::kSkipIndices)
.ToLocalChecked();
- const char* expected_properties2_1[] = {"a", "b", nullptr, "c", "d"};
- CheckStringArray(isolate, properties, 5, expected_properties2_1);
- CheckIsSymbolAt(isolate, properties, 2, "symbol");
+ const char* expected_properties2_1[] = {
+ "a", "b", "4294967296", "4294967295", nullptr, "c", "d"};
+ CheckStringArray(isolate, properties, 7, expected_properties2_1);
+ CheckIsSymbolAt(isolate, properties, 4, "symbol");
properties =
object
->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly,
default_filter, v8::IndexFilter::kIncludeIndices)
.ToLocalChecked();
- const char* expected_properties3[] = {"0", "1", "a", "b"};
- CheckStringArray(isolate, properties, 4, expected_properties3);
+ const char* expected_properties3[] = {
+ "0", "1", "4294967294", "a", "b", "4294967296", "4294967295",
+ };
+ CheckStringArray(isolate, properties, 7, expected_properties3);
properties = object
->GetPropertyNames(
context.local(), v8::KeyCollectionMode::kOwnOnly,
include_symbols_filter, v8::IndexFilter::kIncludeIndices)
.ToLocalChecked();
- const char* expected_properties3_1[] = {"0", "1", "a", "b", nullptr};
- CheckStringArray(isolate, properties, 5, expected_properties3_1);
- CheckIsSymbolAt(isolate, properties, 4, "symbol");
+ const char* expected_properties3_1[] = {
+ "0", "1", "4294967294", "a", "b", "4294967296", "4294967295", nullptr};
+ CheckStringArray(isolate, properties, 8, expected_properties3_1);
+ CheckIsSymbolAt(isolate, properties, 7, "symbol");
properties =
object
->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly,
default_filter, v8::IndexFilter::kSkipIndices)
.ToLocalChecked();
- const char* expected_properties4[] = {"a", "b"};
- CheckStringArray(isolate, properties, 2, expected_properties4);
+ const char* expected_properties4[] = {"a", "b", "4294967296", "4294967295"};
+ CheckStringArray(isolate, properties, 4, expected_properties4);
properties = object
->GetPropertyNames(
context.local(), v8::KeyCollectionMode::kOwnOnly,
include_symbols_filter, v8::IndexFilter::kSkipIndices)
.ToLocalChecked();
- const char* expected_properties4_1[] = {"a", "b", nullptr};
- CheckStringArray(isolate, properties, 3, expected_properties4_1);
- CheckIsSymbolAt(isolate, properties, 2, "symbol");
+ const char* expected_properties4_1[] = {"a", "b", "4294967296", "4294967295",
+ nullptr};
+ CheckStringArray(isolate, properties, 5, expected_properties4_1);
+ CheckIsSymbolAt(isolate, properties, 4, "symbol");
}
THREADED_TEST(ProxyGetPropertyNames) {
@@ -15458,6 +15495,9 @@ THREADED_TEST(ProxyGetPropertyNames) {
v8::HandleScope scope(isolate);
v8::Local<v8::Value> result = CompileRun(
"var target = {0: 0, 1: 1, a: 2, b: 3};"
+ "target[2**32] = '4294967296';"
+ "target[2**32-1] = '4294967295';"
+ "target[2**32-2] = '4294967294';"
"target[Symbol('symbol')] = true;"
"target.__proto__ = {__proto__:null, 2: 4, 3: 5, c: 6, d: 7};"
"var result = new Proxy(target, {});"
@@ -15469,8 +15509,10 @@ THREADED_TEST(ProxyGetPropertyNames) {
v8::Local<v8::Array> properties =
object->GetPropertyNames(context.local()).ToLocalChecked();
- const char* expected_properties1[] = {"0", "1", "a", "b", "2", "3", "c", "d"};
- CheckStringArray(isolate, properties, 8, expected_properties1);
+ const char* expected_properties1[] = {"0", "1", "4294967294", "a",
+ "b", "4294967296", "4294967295", "2",
+ "3", "c", "d"};
+ CheckStringArray(isolate, properties, 11, expected_properties1);
properties =
object
@@ -15478,7 +15520,7 @@ THREADED_TEST(ProxyGetPropertyNames) {
v8::KeyCollectionMode::kIncludePrototypes,
default_filter, v8::IndexFilter::kIncludeIndices)
.ToLocalChecked();
- CheckStringArray(isolate, properties, 8, expected_properties1);
+ CheckStringArray(isolate, properties, 11, expected_properties1);
properties = object
->GetPropertyNames(context.local(),
@@ -15486,10 +15528,11 @@ THREADED_TEST(ProxyGetPropertyNames) {
include_symbols_filter,
v8::IndexFilter::kIncludeIndices)
.ToLocalChecked();
- const char* expected_properties1_1[] = {"0", "1", "a", "b", nullptr,
- "2", "3", "c", "d"};
- CheckStringArray(isolate, properties, 9, expected_properties1_1);
- CheckIsSymbolAt(isolate, properties, 4, "symbol");
+ const char* expected_properties1_1[] = {
+ "0", "1", "4294967294", "a", "b", "4294967296",
+ "4294967295", nullptr, "2", "3", "c", "d"};
+ CheckStringArray(isolate, properties, 12, expected_properties1_1);
+ CheckIsSymbolAt(isolate, properties, 7, "symbol");
properties =
object
@@ -15497,8 +15540,9 @@ THREADED_TEST(ProxyGetPropertyNames) {
v8::KeyCollectionMode::kIncludePrototypes,
default_filter, v8::IndexFilter::kSkipIndices)
.ToLocalChecked();
- const char* expected_properties2[] = {"a", "b", "c", "d"};
- CheckStringArray(isolate, properties, 4, expected_properties2);
+ const char* expected_properties2[] = {"a", "b", "4294967296",
+ "4294967295", "c", "d"};
+ CheckStringArray(isolate, properties, 6, expected_properties2);
properties = object
->GetPropertyNames(context.local(),
@@ -15506,43 +15550,47 @@ THREADED_TEST(ProxyGetPropertyNames) {
include_symbols_filter,
v8::IndexFilter::kSkipIndices)
.ToLocalChecked();
- const char* expected_properties2_1[] = {"a", "b", nullptr, "c", "d"};
- CheckStringArray(isolate, properties, 5, expected_properties2_1);
- CheckIsSymbolAt(isolate, properties, 2, "symbol");
+ const char* expected_properties2_1[] = {
+ "a", "b", "4294967296", "4294967295", nullptr, "c", "d"};
+ CheckStringArray(isolate, properties, 7, expected_properties2_1);
+ CheckIsSymbolAt(isolate, properties, 4, "symbol");
properties =
object
->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly,
default_filter, v8::IndexFilter::kIncludeIndices)
.ToLocalChecked();
- const char* expected_properties3[] = {"0", "1", "a", "b"};
- CheckStringArray(isolate, properties, 4, expected_properties3);
+ const char* expected_properties3[] = {"0", "1", "4294967294", "a",
+ "b", "4294967296", "4294967295"};
+ CheckStringArray(isolate, properties, 7, expected_properties3);
properties = object
->GetPropertyNames(
context.local(), v8::KeyCollectionMode::kOwnOnly,
include_symbols_filter, v8::IndexFilter::kIncludeIndices)
.ToLocalChecked();
- const char* expected_properties3_1[] = {"0", "1", "a", "b", nullptr};
- CheckStringArray(isolate, properties, 5, expected_properties3_1);
- CheckIsSymbolAt(isolate, properties, 4, "symbol");
+ const char* expected_properties3_1[] = {
+ "0", "1", "4294967294", "a", "b", "4294967296", "4294967295", nullptr};
+ CheckStringArray(isolate, properties, 8, expected_properties3_1);
+ CheckIsSymbolAt(isolate, properties, 7, "symbol");
properties =
object
->GetPropertyNames(context.local(), v8::KeyCollectionMode::kOwnOnly,
default_filter, v8::IndexFilter::kSkipIndices)
.ToLocalChecked();
- const char* expected_properties4[] = {"a", "b"};
- CheckStringArray(isolate, properties, 2, expected_properties4);
+ const char* expected_properties4[] = {"a", "b", "4294967296", "4294967295"};
+ CheckStringArray(isolate, properties, 4, expected_properties4);
properties = object
->GetPropertyNames(
context.local(), v8::KeyCollectionMode::kOwnOnly,
include_symbols_filter, v8::IndexFilter::kSkipIndices)
.ToLocalChecked();
- const char* expected_properties4_1[] = {"a", "b", nullptr};
- CheckStringArray(isolate, properties, 3, expected_properties4_1);
- CheckIsSymbolAt(isolate, properties, 2, "symbol");
+ const char* expected_properties4_1[] = {"a", "b", "4294967296", "4294967295",
+ nullptr};
+ CheckStringArray(isolate, properties, 5, expected_properties4_1);
+ CheckIsSymbolAt(isolate, properties, 4, "symbol");
}
THREADED_TEST(AccessChecksReenabledCorrectly) {
@@ -15739,6 +15787,7 @@ class UC16VectorResource : public v8::String::ExternalStringResource {
static void MorphAString(i::String* string,
OneByteVectorResource* one_byte_resource,
UC16VectorResource* uc16_resource) {
+ i::Isolate* isolate = CcTest::i_isolate();
CHECK(i::StringShape(string).IsExternal());
i::ReadOnlyRoots roots(CcTest::heap());
if (string->IsOneByteRepresentation()) {
@@ -15748,14 +15797,16 @@ static void MorphAString(i::String* string,
string->set_map(roots.external_string_map());
i::ExternalTwoByteString* morphed =
i::ExternalTwoByteString::cast(string);
- morphed->set_resource(uc16_resource);
+ CcTest::heap()->UpdateExternalString(morphed, string->length(), 0);
+ morphed->SetResource(isolate, uc16_resource);
} else {
// Check old map is not internalized or long.
CHECK(string->map() == roots.external_string_map());
// Morph external string to be one-byte string.
string->set_map(roots.external_one_byte_string_map());
i::ExternalOneByteString* morphed = i::ExternalOneByteString::cast(string);
- morphed->set_resource(one_byte_resource);
+ CcTest::heap()->UpdateExternalString(morphed, string->length(), 0);
+ morphed->SetResource(isolate, one_byte_resource);
}
}
@@ -15771,6 +15822,7 @@ THREADED_TEST(MorphCompositeStringTest) {
LocalContext env;
i::Factory* factory = CcTest::i_isolate()->factory();
v8::Isolate* isolate = env->GetIsolate();
+ i::Isolate* i_isolate = CcTest::i_isolate();
v8::HandleScope scope(isolate);
OneByteVectorResource one_byte_resource(
i::Vector<const char>(c_string, i::StrLength(c_string)));
@@ -15805,7 +15857,7 @@ THREADED_TEST(MorphCompositeStringTest) {
v8_compile("cons")->Run(env.local()).ToLocalChecked().As<String>();
CHECK_EQ(128, cons->Utf8Length(isolate));
int nchars = -1;
- CHECK_EQ(129, cons->WriteUtf8(utf_buffer, -1, &nchars));
+ CHECK_EQ(129, cons->WriteUtf8(isolate, utf_buffer, -1, &nchars));
CHECK_EQ(128, nchars);
CHECK_EQ(0, strcmp(
utf_buffer,
@@ -15844,13 +15896,13 @@ THREADED_TEST(MorphCompositeStringTest) {
// This avoids the GC from trying to free a stack allocated resource.
if (ilhs->IsExternalOneByteString())
- i::ExternalOneByteString::cast(ilhs)->set_resource(nullptr);
+ i::ExternalOneByteString::cast(ilhs)->SetResource(i_isolate, nullptr);
else
- i::ExternalTwoByteString::cast(ilhs)->set_resource(nullptr);
+ i::ExternalTwoByteString::cast(ilhs)->SetResource(i_isolate, nullptr);
if (irhs->IsExternalOneByteString())
- i::ExternalOneByteString::cast(irhs)->set_resource(nullptr);
+ i::ExternalOneByteString::cast(irhs)->SetResource(i_isolate, nullptr);
else
- i::ExternalTwoByteString::cast(irhs)->set_resource(nullptr);
+ i::ExternalTwoByteString::cast(irhs)->SetResource(i_isolate, nullptr);
}
i::DeleteArray(two_byte_string);
}
@@ -17342,60 +17394,67 @@ void AnalyzeStackInNativeCode(const v8::FunctionCallbackInfo<v8::Value>& args) {
CHECK_EQ(args.Length(), 1);
v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
+ v8::Isolate* isolate = args.GetIsolate();
int testGroup = args[0]->Int32Value(context).FromJust();
if (testGroup == kOverviewTest) {
v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
args.GetIsolate(), 10, v8::StackTrace::kOverview);
CHECK_EQ(4, stackTrace->GetFrameCount());
checkStackFrame(origin, "bar", 2, 10, false, false,
- stackTrace->GetFrame(0));
- checkStackFrame(origin, "foo", 6, 3, false, true, stackTrace->GetFrame(1));
+ stackTrace->GetFrame(args.GetIsolate(), 0));
+ checkStackFrame(origin, "foo", 6, 3, false, true,
+ stackTrace->GetFrame(isolate, 1));
// This is the source string inside the eval which has the call to foo.
- checkStackFrame(nullptr, "", 1, 1, true, false, stackTrace->GetFrame(2));
+ checkStackFrame(nullptr, "", 1, 1, true, false,
+ stackTrace->GetFrame(isolate, 2));
// The last frame is an anonymous function which has the initial eval call.
- checkStackFrame(origin, "", 8, 7, false, false, stackTrace->GetFrame(3));
+ checkStackFrame(origin, "", 8, 7, false, false,
+ stackTrace->GetFrame(isolate, 3));
} else if (testGroup == kDetailedTest) {
v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
args.GetIsolate(), 10, v8::StackTrace::kDetailed);
CHECK_EQ(4, stackTrace->GetFrameCount());
checkStackFrame(origin, "bat", 4, 22, false, false,
- stackTrace->GetFrame(0));
+ stackTrace->GetFrame(isolate, 0));
checkStackFrame(origin, "baz", 8, 3, false, true,
- stackTrace->GetFrame(1));
+ stackTrace->GetFrame(isolate, 1));
bool is_eval = true;
// This is the source string inside the eval which has the call to baz.
- checkStackFrame(nullptr, "", 1, 1, is_eval, false, stackTrace->GetFrame(2));
+ checkStackFrame(nullptr, "", 1, 1, is_eval, false,
+ stackTrace->GetFrame(isolate, 2));
// The last frame is an anonymous function which has the initial eval call.
- checkStackFrame(origin, "", 10, 1, false, false, stackTrace->GetFrame(3));
+ checkStackFrame(origin, "", 10, 1, false, false,
+ stackTrace->GetFrame(isolate, 3));
} else if (testGroup == kFunctionName) {
v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
args.GetIsolate(), 5, v8::StackTrace::kOverview);
CHECK_EQ(3, stackTrace->GetFrameCount());
checkStackFrame(nullptr, "function.name", 3, 1, true, false,
- stackTrace->GetFrame(0));
+ stackTrace->GetFrame(isolate, 0));
} else if (testGroup == kDisplayName) {
v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
args.GetIsolate(), 5, v8::StackTrace::kOverview);
CHECK_EQ(3, stackTrace->GetFrameCount());
checkStackFrame(nullptr, "function.displayName", 3, 1, true, false,
- stackTrace->GetFrame(0));
+ stackTrace->GetFrame(isolate, 0));
} else if (testGroup == kFunctionNameAndDisplayName) {
v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
args.GetIsolate(), 5, v8::StackTrace::kOverview);
CHECK_EQ(3, stackTrace->GetFrameCount());
checkStackFrame(nullptr, "function.displayName", 3, 1, true, false,
- stackTrace->GetFrame(0));
+ stackTrace->GetFrame(isolate, 0));
} else if (testGroup == kDisplayNameIsNotString) {
v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
args.GetIsolate(), 5, v8::StackTrace::kOverview);
CHECK_EQ(3, stackTrace->GetFrameCount());
checkStackFrame(nullptr, "function.name", 3, 1, true, false,
- stackTrace->GetFrame(0));
+ stackTrace->GetFrame(isolate, 0));
} else if (testGroup == kFunctionNameIsNotString) {
v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(
args.GetIsolate(), 5, v8::StackTrace::kOverview);
CHECK_EQ(3, stackTrace->GetFrameCount());
- checkStackFrame(nullptr, "", 3, 1, true, false, stackTrace->GetFrame(0));
+ checkStackFrame(nullptr, "", 3, 1, true, false,
+ stackTrace->GetFrame(isolate, 0));
}
}
@@ -17498,9 +17557,9 @@ static void StackTraceForUncaughtExceptionListener(
v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
CHECK_EQ(2, stack_trace->GetFrameCount());
checkStackFrame("origin", "foo", 2, 3, false, false,
- stack_trace->GetFrame(0));
+ stack_trace->GetFrame(message->GetIsolate(), 0));
checkStackFrame("origin", "bar", 5, 3, false, false,
- stack_trace->GetFrame(1));
+ stack_trace->GetFrame(message->GetIsolate(), 1));
}
@@ -17629,16 +17688,18 @@ TEST(ErrorLevelWarning) {
static void StackTraceFunctionNameListener(v8::Local<v8::Message> message,
v8::Local<Value>) {
v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
+ v8::Isolate* isolate = message->GetIsolate();
CHECK_EQ(5, stack_trace->GetFrameCount());
checkStackFrame("origin", "foo:0", 4, 7, false, false,
- stack_trace->GetFrame(0));
+ stack_trace->GetFrame(isolate, 0));
checkStackFrame("origin", "foo:1", 5, 27, false, false,
- stack_trace->GetFrame(1));
+ stack_trace->GetFrame(isolate, 1));
checkStackFrame("origin", "foo", 5, 27, false, false,
- stack_trace->GetFrame(2));
+ stack_trace->GetFrame(isolate, 2));
checkStackFrame("origin", "foo", 5, 27, false, false,
- stack_trace->GetFrame(3));
- checkStackFrame("origin", "", 1, 14, false, false, stack_trace->GetFrame(4));
+ stack_trace->GetFrame(isolate, 3));
+ checkStackFrame("origin", "", 1, 14, false, false,
+ stack_trace->GetFrame(isolate, 4));
}
@@ -17684,7 +17745,8 @@ static void RethrowStackTraceHandler(v8::Local<v8::Message> message,
CHECK_EQ(3, frame_count);
int line_number[] = {1, 2, 5};
for (int i = 0; i < frame_count; i++) {
- CHECK_EQ(line_number[i], stack_trace->GetFrame(i)->GetLineNumber());
+ CHECK_EQ(line_number[i],
+ stack_trace->GetFrame(message->GetIsolate(), i)->GetLineNumber());
}
}
@@ -17728,7 +17790,8 @@ static void RethrowPrimitiveStackTraceHandler(v8::Local<v8::Message> message,
CHECK_EQ(2, frame_count);
int line_number[] = {3, 7};
for (int i = 0; i < frame_count; i++) {
- CHECK_EQ(line_number[i], stack_trace->GetFrame(i)->GetLineNumber());
+ CHECK_EQ(line_number[i],
+ stack_trace->GetFrame(message->GetIsolate(), i)->GetLineNumber());
}
}
@@ -17763,7 +17826,7 @@ static void RethrowExistingStackTraceHandler(v8::Local<v8::Message> message,
v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
CHECK(!stack_trace.IsEmpty());
CHECK_EQ(1, stack_trace->GetFrameCount());
- CHECK_EQ(1, stack_trace->GetFrame(0)->GetLineNumber());
+ CHECK_EQ(1, stack_trace->GetFrame(message->GetIsolate(), 0)->GetLineNumber());
}
@@ -17790,7 +17853,7 @@ static void RethrowBogusErrorStackTraceHandler(v8::Local<v8::Message> message,
v8::Local<v8::StackTrace> stack_trace = message->GetStackTrace();
CHECK(!stack_trace.IsEmpty());
CHECK_EQ(1, stack_trace->GetFrameCount());
- CHECK_EQ(2, stack_trace->GetFrame(0)->GetLineNumber());
+ CHECK_EQ(2, stack_trace->GetFrame(message->GetIsolate(), 0)->GetLineNumber());
}
@@ -17845,13 +17908,14 @@ void PromiseRejectCallback(v8::PromiseRejectMessage reject_message) {
if (!stack_trace.IsEmpty()) {
promise_reject_frame_count = stack_trace->GetFrameCount();
if (promise_reject_frame_count > 0) {
- CHECK(stack_trace->GetFrame(0)
+ CHECK(stack_trace->GetFrame(CcTest::isolate(), 0)
->GetScriptName()
->Equals(context, v8_str("pro"))
.FromJust());
promise_reject_line_number =
- stack_trace->GetFrame(0)->GetLineNumber();
- promise_reject_column_number = stack_trace->GetFrame(0)->GetColumn();
+ stack_trace->GetFrame(CcTest::isolate(), 0)->GetLineNumber();
+ promise_reject_column_number =
+ stack_trace->GetFrame(CcTest::isolate(), 0)->GetColumn();
} else {
promise_reject_line_number = -1;
promise_reject_column_number = -1;
@@ -18309,7 +18373,7 @@ void AnalyzeStackOfEvalWithSourceURL(
v8::Local<v8::String> url = v8_str("eval_url");
for (int i = 0; i < 3; i++) {
v8::Local<v8::String> name =
- stackTrace->GetFrame(i)->GetScriptNameOrSourceURL();
+ stackTrace->GetFrame(args.GetIsolate(), i)->GetScriptNameOrSourceURL();
CHECK(!name.IsEmpty());
CHECK(url->Equals(args.GetIsolate()->GetCurrentContext(), name).FromJust());
}
@@ -18355,7 +18419,8 @@ void AnalyzeScriptIdInStack(
args.GetIsolate(), 10, v8::StackTrace::kScriptId);
CHECK_EQ(2, stackTrace->GetFrameCount());
for (int i = 0; i < 2; i++) {
- scriptIdInStack[i] = stackTrace->GetFrame(i)->GetScriptId();
+ scriptIdInStack[i] =
+ stackTrace->GetFrame(args.GetIsolate(), i)->GetScriptId();
}
}
@@ -18391,7 +18456,7 @@ void AnalyzeStackOfInlineScriptWithSourceURL(
v8::Local<v8::String> url = v8_str("source_url");
for (int i = 0; i < 3; i++) {
v8::Local<v8::String> name =
- stackTrace->GetFrame(i)->GetScriptNameOrSourceURL();
+ stackTrace->GetFrame(args.GetIsolate(), i)->GetScriptNameOrSourceURL();
CHECK(!name.IsEmpty());
CHECK(url->Equals(args.GetIsolate()->GetCurrentContext(), name).FromJust());
}
@@ -18806,7 +18871,7 @@ void AnalyzeStackOfDynamicScriptWithSourceURL(
v8::Local<v8::String> url = v8_str("source_url");
for (int i = 0; i < 3; i++) {
v8::Local<v8::String> name =
- stackTrace->GetFrame(i)->GetScriptNameOrSourceURL();
+ stackTrace->GetFrame(args.GetIsolate(), i)->GetScriptNameOrSourceURL();
CHECK(!name.IsEmpty());
CHECK(url->Equals(args.GetIsolate()->GetCurrentContext(), name).FromJust());
}
@@ -19072,7 +19137,8 @@ TEST(GetHeapSpaceStatistics) {
// Force allocation in LO_SPACE so that every space has non-zero size.
v8::internal::Isolate* i_isolate =
reinterpret_cast<v8::internal::Isolate*>(isolate);
- (void)i_isolate->factory()->TryNewFixedArray(512 * 1024);
+ auto unused = i_isolate->factory()->TryNewFixedArray(512 * 1024);
+ USE(unused);
isolate->GetHeapStatistics(&heap_statistics);
@@ -19620,7 +19686,7 @@ THREADED_TEST(ScriptOrigin) {
v8::HandleScope scope(isolate);
Local<v8::PrimitiveArray> array(v8::PrimitiveArray::New(isolate, 1));
Local<v8::Symbol> symbol(v8::Symbol::New(isolate));
- array->Set(0, symbol);
+ array->Set(isolate, 0, symbol);
v8::ScriptOrigin origin = v8::ScriptOrigin(
v8_str("test"), v8::Integer::New(env->GetIsolate(), 1),
@@ -19648,7 +19714,7 @@ THREADED_TEST(ScriptOrigin) {
CHECK(script_origin_f.Options().IsSharedCrossOrigin());
CHECK(script_origin_f.Options().IsOpaque());
printf("is name = %d\n", script_origin_f.SourceMapUrl()->IsUndefined());
- CHECK(script_origin_f.HostDefinedOptions()->Get(0)->IsSymbol());
+ CHECK(script_origin_f.HostDefinedOptions()->Get(isolate, 0)->IsSymbol());
CHECK_EQ(0, strcmp("http://sourceMapUrl",
*v8::String::Utf8Value(env->GetIsolate(),
@@ -19666,7 +19732,7 @@ THREADED_TEST(ScriptOrigin) {
CHECK_EQ(0, strcmp("http://sourceMapUrl",
*v8::String::Utf8Value(env->GetIsolate(),
script_origin_g.SourceMapUrl())));
- CHECK(script_origin_g.HostDefinedOptions()->Get(0)->IsSymbol());
+ CHECK(script_origin_g.HostDefinedOptions()->Get(isolate, 0)->IsSymbol());
}
@@ -20470,7 +20536,8 @@ THREADED_TEST(TwoByteStringInOneByteCons) {
CHECK_EQ(static_cast<int32_t>('e'),
reresult->Int32Value(context.local()).FromJust());
// This avoids the GC from trying to free stack allocated resources.
- i::Handle<i::ExternalTwoByteString>::cast(flat_string)->set_resource(nullptr);
+ i::Handle<i::ExternalTwoByteString>::cast(flat_string)
+ ->SetResource(i_isolate, nullptr);
}
@@ -20506,11 +20573,11 @@ TEST(ContainsOnlyOneByte) {
Local<String> left = base;
Local<String> right = base;
for (int i = 0; i < 1000; i++) {
- left = String::Concat(base, left);
- right = String::Concat(right, base);
+ left = String::Concat(isolate, base, left);
+ right = String::Concat(isolate, right, base);
}
- Local<String> balanced = String::Concat(left, base);
- balanced = String::Concat(balanced, right);
+ Local<String> balanced = String::Concat(isolate, left, base);
+ balanced = String::Concat(isolate, balanced, right);
Local<String> cons_strings[] = {left, balanced, right};
Local<String> two_byte =
String::NewExternalTwoByte(
@@ -20522,9 +20589,9 @@ TEST(ContainsOnlyOneByte) {
string = cons_strings[i];
CHECK(string->IsOneByte() && string->ContainsOnlyOneByte());
// Test left and right concatentation.
- string = String::Concat(two_byte, cons_strings[i]);
+ string = String::Concat(isolate, two_byte, cons_strings[i]);
CHECK(!string->IsOneByte() && string->ContainsOnlyOneByte());
- string = String::Concat(cons_strings[i], two_byte);
+ string = String::Concat(isolate, cons_strings[i], two_byte);
CHECK(!string->IsOneByte() && string->ContainsOnlyOneByte());
}
// Set bits in different positions
@@ -21921,12 +21988,11 @@ THREADED_TEST(ReadOnlyIndexedProperties) {
static int CountLiveMapsInMapCache(i::Context* context) {
- i::FixedArray* map_cache = i::FixedArray::cast(context->map_cache());
+ i::WeakFixedArray* map_cache = i::WeakFixedArray::cast(context->map_cache());
int length = map_cache->length();
int count = 0;
for (int i = 0; i < length; i++) {
- i::Object* value = map_cache->get(i);
- if (value->IsWeakCell() && !i::WeakCell::cast(value)->cleared()) count++;
+ if (map_cache->Get(i)->IsWeakHeapObject()) count++;
}
return count;
}
@@ -22752,7 +22818,7 @@ void Recompile(Args... args) {
stub.GetCode();
}
-void RecompileICStubs(i::Isolate* isolate) {
+void RecompileICStubs() {
// BUG(5784): We had a list of IC stubs here to recompile. These are now
// builtins and we can't compile them again (easily). Bug 5784 tracks
// our progress in finding another way to do this.
@@ -22805,7 +22871,6 @@ void TestStubCache(bool primary) {
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
create_params.counter_lookup_callback = LookupCounter;
v8::Isolate* isolate = v8::Isolate::New(create_params);
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
{
v8::Isolate::Scope isolate_scope(isolate);
@@ -22814,7 +22879,7 @@ void TestStubCache(bool primary) {
// Enforce recompilation of IC stubs that access megamorphic stub cache
// to respect enabled native code counters and stub cache test flags.
- RecompileICStubs(i_isolate);
+ RecompileICStubs();
int initial_probes = probes_counter;
int initial_misses = misses_counter;
@@ -23745,7 +23810,6 @@ TEST(AccessCheckInIC) {
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
create_params.counter_lookup_callback = LookupCounter;
v8::Isolate* isolate = v8::Isolate::New(create_params);
- i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
{
v8::Isolate::Scope isolate_scope(isolate);
@@ -23754,7 +23818,7 @@ TEST(AccessCheckInIC) {
// Enforce recompilation of IC stubs that access megamorphic stub cache
// to respect enabled native code counters and stub cache test flags.
- RecompileICStubs(i_isolate);
+ RecompileICStubs();
// Create an ObjectTemplate for global objects and install access
// check callbacks that will block access.
@@ -25010,8 +25074,12 @@ TEST(ResolvedPromiseReFulfill) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
- v8::Local<v8::String> value1 = v8::String::NewFromUtf8(isolate, "foo");
- v8::Local<v8::String> value2 = v8::String::NewFromUtf8(isolate, "bar");
+ v8::Local<v8::String> value1 =
+ v8::String::NewFromUtf8(isolate, "foo", v8::NewStringType::kNormal)
+ .ToLocalChecked();
+ v8::Local<v8::String> value2 =
+ v8::String::NewFromUtf8(isolate, "bar", v8::NewStringType::kNormal)
+ .ToLocalChecked();
v8::Local<v8::Promise::Resolver> resolver =
v8::Promise::Resolver::New(context.local()).ToLocalChecked();
@@ -25037,8 +25105,12 @@ TEST(RejectedPromiseReFulfill) {
LocalContext context;
v8::Isolate* isolate = context->GetIsolate();
v8::HandleScope scope(isolate);
- v8::Local<v8::String> value1 = v8::String::NewFromUtf8(isolate, "foo");
- v8::Local<v8::String> value2 = v8::String::NewFromUtf8(isolate, "bar");
+ v8::Local<v8::String> value1 =
+ v8::String::NewFromUtf8(isolate, "foo", v8::NewStringType::kNormal)
+ .ToLocalChecked();
+ v8::Local<v8::String> value2 =
+ v8::String::NewFromUtf8(isolate, "bar", v8::NewStringType::kNormal)
+ .ToLocalChecked();
v8::Local<v8::Promise::Resolver> resolver =
v8::Promise::Resolver::New(context.local()).ToLocalChecked();
@@ -26325,14 +26397,16 @@ TEST(InvalidCodeCacheData) {
TEST(StringConcatOverflow) {
v8::V8::Initialize();
- v8::HandleScope scope(CcTest::isolate());
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
RandomLengthOneByteResource* r =
new RandomLengthOneByteResource(i::String::kMaxLength);
v8::Local<v8::String> str =
- v8::String::NewExternalOneByte(CcTest::isolate(), r).ToLocalChecked();
+ v8::String::NewExternalOneByte(isolate, r).ToLocalChecked();
CHECK(!str.IsEmpty());
- v8::TryCatch try_catch(CcTest::isolate());
- v8::Local<v8::String> result = v8::String::Concat(str, str);
+ v8::TryCatch try_catch(isolate);
+ v8::Local<v8::String> result = v8::String::Concat(isolate, str, str);
+ v8::String::Concat(CcTest::isolate(), str, str);
CHECK(result.IsEmpty());
CHECK(!try_catch.HasCaught());
}
@@ -26350,7 +26424,7 @@ TEST(TurboAsmDisablesNeuter) {
" function load() { return MEM32[0] | 0; }"
" return { load: load };"
"}"
- "var buffer = new ArrayBuffer(1024);"
+ "var buffer = new ArrayBuffer(4096);"
"var module = Module(this, {}, buffer);"
"%OptimizeFunctionOnNextCall(module.load);"
"module.load();"
@@ -26366,7 +26440,7 @@ TEST(TurboAsmDisablesNeuter) {
" function store() { MEM32[0] = 0; }"
" return { store: store };"
"}"
- "var buffer = new ArrayBuffer(1024);"
+ "var buffer = new ArrayBuffer(4096);"
"var module = Module(this, {}, buffer);"
"%OptimizeFunctionOnNextCall(module.store);"
"module.store();"
@@ -27981,7 +28055,9 @@ v8::MaybeLocal<v8::Promise> HostImportModuleDynamicallyCallbackResolve(
String::Utf8Value referrer_utf8(
context->GetIsolate(), Local<String>::Cast(referrer->GetResourceName()));
CHECK_EQ(0, strcmp("www.google.com", *referrer_utf8));
- CHECK(referrer->GetHostDefinedOptions()->Get(0)->IsSymbol());
+ CHECK(referrer->GetHostDefinedOptions()
+ ->Get(context->GetIsolate(), 0)
+ ->IsSymbol());
CHECK(!specifier.IsEmpty());
String::Utf8Value specifier_utf8(context->GetIsolate(), specifier);
@@ -28151,41 +28227,41 @@ TEST(PrimitiveArray) {
CHECK_EQ(length, array->Length());
for (int i = 0; i < length; i++) {
- Local<v8::Primitive> item = array->Get(i);
+ Local<v8::Primitive> item = array->Get(isolate, i);
CHECK(item->IsUndefined());
}
Local<v8::Symbol> symbol(v8::Symbol::New(isolate));
- array->Set(0, symbol);
- CHECK(array->Get(0)->IsSymbol());
+ array->Set(isolate, 0, symbol);
+ CHECK(array->Get(isolate, 0)->IsSymbol());
Local<v8::String> string =
v8::String::NewFromUtf8(isolate, "test", v8::NewStringType::kInternalized)
.ToLocalChecked();
- array->Set(1, string);
- CHECK(array->Get(0)->IsSymbol());
- CHECK(array->Get(1)->IsString());
+ array->Set(isolate, 1, string);
+ CHECK(array->Get(isolate, 0)->IsSymbol());
+ CHECK(array->Get(isolate, 1)->IsString());
Local<v8::Number> num = v8::Number::New(env->GetIsolate(), 3.1415926);
- array->Set(2, num);
- CHECK(array->Get(0)->IsSymbol());
- CHECK(array->Get(1)->IsString());
- CHECK(array->Get(2)->IsNumber());
+ array->Set(isolate, 2, num);
+ CHECK(array->Get(isolate, 0)->IsSymbol());
+ CHECK(array->Get(isolate, 1)->IsString());
+ CHECK(array->Get(isolate, 2)->IsNumber());
v8::Local<v8::Boolean> f = v8::False(isolate);
- array->Set(3, f);
- CHECK(array->Get(0)->IsSymbol());
- CHECK(array->Get(1)->IsString());
- CHECK(array->Get(2)->IsNumber());
- CHECK(array->Get(3)->IsBoolean());
+ array->Set(isolate, 3, f);
+ CHECK(array->Get(isolate, 0)->IsSymbol());
+ CHECK(array->Get(isolate, 1)->IsString());
+ CHECK(array->Get(isolate, 2)->IsNumber());
+ CHECK(array->Get(isolate, 3)->IsBoolean());
v8::Local<v8::Primitive> n = v8::Null(isolate);
- array->Set(4, n);
- CHECK(array->Get(0)->IsSymbol());
- CHECK(array->Get(1)->IsString());
- CHECK(array->Get(2)->IsNumber());
- CHECK(array->Get(3)->IsBoolean());
- CHECK(array->Get(4)->IsNull());
+ array->Set(isolate, 4, n);
+ CHECK(array->Get(isolate, 0)->IsSymbol());
+ CHECK(array->Get(isolate, 1)->IsString());
+ CHECK(array->Get(isolate, 2)->IsNumber());
+ CHECK(array->Get(isolate, 3)->IsBoolean());
+ CHECK(array->Get(isolate, 4)->IsNull());
}
TEST(PersistentValueMap) {
@@ -28204,22 +28280,123 @@ TEST(PersistentValueMap) {
map.Set("key", value);
}
-TEST(WasmStreamingAbort) {
- LocalContext env;
- v8::Isolate* isolate = env->GetIsolate();
- v8::HandleScope scope(isolate);
- v8::WasmModuleObjectBuilderStreaming streaming(isolate);
- streaming.Abort(v8::Object::New(isolate));
- CHECK_EQ(streaming.GetPromise()->State(), v8::Promise::kRejected);
+namespace {
+
+bool wasm_streaming_callback_got_called = false;
+bool wasm_streaming_data_got_collected = false;
+
+void WasmStreamingTestFinalizer(const v8::WeakCallbackInfo<void>& data) {
+ CHECK(!wasm_streaming_data_got_collected);
+ wasm_streaming_data_got_collected = true;
+ i::JSObject** p = reinterpret_cast<i::JSObject**>(data.GetParameter());
+ i::GlobalHandles::Destroy(reinterpret_cast<i::Object**>(p));
+}
+
+void WasmStreamingCallbackTestCallbackIsCalled(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ CHECK(!wasm_streaming_callback_got_called);
+ wasm_streaming_callback_got_called = true;
+
+ i::Handle<i::Object> global_handle =
+ reinterpret_cast<i::Isolate*>(args.GetIsolate())
+ ->global_handles()
+ ->Create(*v8::Utils::OpenHandle(*args.Data()));
+ i::GlobalHandles::MakeWeak(global_handle.location(), global_handle.location(),
+ WasmStreamingTestFinalizer,
+ v8::WeakCallbackType::kParameter);
+}
+
+void WasmStreamingCallbackTestOnBytesReceived(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ std::shared_ptr<v8::WasmStreaming> streaming =
+ v8::WasmStreaming::Unpack(args.GetIsolate(), args.Data());
+
+ // The first bytes of the WebAssembly magic word.
+ const uint8_t bytes[]{0x00, 0x61, 0x73};
+ streaming->OnBytesReceived(bytes, arraysize(bytes));
+}
+
+void WasmStreamingCallbackTestFinishWithSuccess(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ std::shared_ptr<v8::WasmStreaming> streaming =
+ v8::WasmStreaming::Unpack(args.GetIsolate(), args.Data());
+ // The bytes of a minimal WebAssembly module.
+ const uint8_t bytes[]{0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00};
+ streaming->OnBytesReceived(bytes, arraysize(bytes));
+ streaming->Finish();
+}
+
+void WasmStreamingCallbackTestFinishWithFailure(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ std::shared_ptr<v8::WasmStreaming> streaming =
+ v8::WasmStreaming::Unpack(args.GetIsolate(), args.Data());
+ streaming->Finish();
+}
+
+void WasmStreamingCallbackTestAbortWithReject(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ std::shared_ptr<v8::WasmStreaming> streaming =
+ v8::WasmStreaming::Unpack(args.GetIsolate(), args.Data());
+ streaming->Abort(v8::Object::New(args.GetIsolate()));
+}
+
+void WasmStreamingCallbackTestAbortNoReject(
+ const v8::FunctionCallbackInfo<v8::Value>& args) {
+ std::shared_ptr<v8::WasmStreaming> streaming =
+ v8::WasmStreaming::Unpack(args.GetIsolate(), args.Data());
+ streaming->Abort({});
}
-TEST(WasmStreamingAbortNoReject) {
+void TestWasmStreaming(v8::WasmStreamingCallback callback,
+ v8::Promise::PromiseState expected_state) {
+ CcTest::isolate()->SetWasmStreamingCallback(callback);
LocalContext env;
v8::Isolate* isolate = env->GetIsolate();
v8::HandleScope scope(isolate);
- v8::WasmModuleObjectBuilderStreaming streaming(isolate);
- streaming.Abort({});
- CHECK_EQ(streaming.GetPromise()->State(), v8::Promise::kPending);
+
+ // Call {WebAssembly.compileStreaming} with {null} as parameter. The parameter
+ // is only really processed by the embedder, so for this test the value is
+ // irrelevant.
+ v8::Local<v8::Promise> promise = v8::Local<v8::Promise>::Cast(
+ CompileRun("WebAssembly.compileStreaming(null)"));
+
+ EmptyMessageQueues(isolate);
+ CHECK_EQ(expected_state, promise->State());
+}
+
+} // namespace
+
+TEST(WasmStreamingCallback) {
+ TestWasmStreaming(WasmStreamingCallbackTestCallbackIsCalled,
+ v8::Promise::kPending);
+ CHECK(wasm_streaming_callback_got_called);
+ CcTest::CollectAllAvailableGarbage();
+ CHECK(wasm_streaming_data_got_collected);
+}
+
+TEST(WasmStreamingOnBytesReceived) {
+ TestWasmStreaming(WasmStreamingCallbackTestOnBytesReceived,
+ v8::Promise::kPending);
+}
+
+TEST(WasmStreamingFinishWithSuccess) {
+ TestWasmStreaming(WasmStreamingCallbackTestFinishWithSuccess,
+ v8::Promise::kFulfilled);
+}
+
+TEST(WasmStreamingFinishWithFailure) {
+ TestWasmStreaming(WasmStreamingCallbackTestFinishWithFailure,
+ v8::Promise::kRejected);
+}
+
+TEST(WasmStreamingAbortWithReject) {
+ TestWasmStreaming(WasmStreamingCallbackTestAbortWithReject,
+ v8::Promise::kRejected);
+}
+
+TEST(WasmStreamingAbortWithoutReject) {
+ TestWasmStreaming(WasmStreamingCallbackTestAbortNoReject,
+ v8::Promise::kPending);
}
enum class AtomicsWaitCallbackAction {
@@ -28545,3 +28722,42 @@ TEST(BigIntAPI) {
CHECK_EQ(word_count, 2);
}
}
+
+namespace {
+
+bool wasm_threads_enabled_value = false;
+
+bool MockWasmThreadsEnabledCallback(Local<Context>) {
+ return wasm_threads_enabled_value;
+}
+
+} // namespace
+
+TEST(TestSetWasmThreadsEnabledCallback) {
+ LocalContext env;
+ v8::Isolate* isolate = env->GetIsolate();
+ i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
+ v8::HandleScope scope(isolate);
+ v8::Local<Context> context = Context::New(CcTest::isolate());
+ i::Handle<i::Context> i_context = v8::Utils::OpenHandle(*context);
+
+ // {Isolate::AreWasmThreadsEnabled} calls the callback set by the embedder if
+ // such a callback exists. Otherwise it returns
+ // {FLAG_experimental_wasm_threads}. First we test that the flag is returned
+ // correctly if no callback is set. Then we test that the flag is ignored if
+ // the callback is set.
+
+ i::FLAG_experimental_wasm_threads = false;
+ CHECK(!i_isolate->AreWasmThreadsEnabled(i_context));
+
+ i::FLAG_experimental_wasm_threads = true;
+ CHECK(i_isolate->AreWasmThreadsEnabled(i_context));
+
+ isolate->SetWasmThreadsEnabledCallback(MockWasmThreadsEnabledCallback);
+ wasm_threads_enabled_value = false;
+ CHECK(!i_isolate->AreWasmThreadsEnabled(i_context));
+
+ wasm_threads_enabled_value = true;
+ i::FLAG_experimental_wasm_threads = false;
+ CHECK(i_isolate->AreWasmThreadsEnabled(i_context));
+}
diff --git a/deps/v8/test/cctest/test-assembler-arm.cc b/deps/v8/test/cctest/test-assembler-arm.cc
index 6ed918a533..7e1bb402fc 100644
--- a/deps/v8/test/cctest/test-assembler-arm.cc
+++ b/deps/v8/test/cctest/test-assembler-arm.cc
@@ -1082,14 +1082,14 @@ TEST(13) {
__ vmov(d21, Double(16.0));
__ mov(r1, Operand(372106121));
__ mov(r2, Operand(1079146608));
- __ vmov(d22, VmovIndexLo, r1);
- __ vmov(d22, VmovIndexHi, r2);
+ __ vmov(NeonS32, d22, 0, r1);
+ __ vmov(NeonS32, d22, 1, r2);
__ add(r4, r0, Operand(static_cast<int32_t>(offsetof(T, i))));
__ vstm(ia_w, r4, d20, d22);
// Move d22 into low and high.
- __ vmov(r4, VmovIndexLo, d22);
+ __ vmov(NeonS32, r4, d22, 0);
__ str(r4, MemOperand(r0, offsetof(T, low)));
- __ vmov(r4, VmovIndexHi, d22);
+ __ vmov(NeonS32, r4, d22, 1);
__ str(r4, MemOperand(r0, offsetof(T, high)));
__ ldm(ia_w, sp, r4.bit() | pc.bit());
diff --git a/deps/v8/test/cctest/test-assembler-arm64.cc b/deps/v8/test/cctest/test-assembler-arm64.cc
index c9a13c0b1c..c0f8e171c7 100644
--- a/deps/v8/test/cctest/test-assembler-arm64.cc
+++ b/deps/v8/test/cctest/test-assembler-arm64.cc
@@ -45,6 +45,7 @@
#include "src/macro-assembler.h"
#include "test/cctest/cctest.h"
#include "test/cctest/test-utils-arm64.h"
+#include "test/common/assembler-tester.h"
namespace v8 {
namespace internal {
@@ -129,13 +130,11 @@ static void InitializeVM() {
new Decoder<DispatchingDecoderVisitor>(); \
Simulator simulator(decoder); \
PrintDisassembler* pdis = nullptr; \
- RegisterDump core;
-
-/* if (Cctest::trace_sim()) { \
- pdis = new PrintDisassembler(stdout); \
- decoder.PrependVisitor(pdis); \
- } \
- */
+ RegisterDump core; \
+ if (i::FLAG_trace_sim) { \
+ pdis = new PrintDisassembler(stdout); \
+ decoder->PrependVisitor(pdis); \
+ }
// Reset the assembler and simulator, so that instructions can be generated,
// but don't actually emit any code. This can be used by tests that need to
@@ -198,7 +197,6 @@ static void InitializeVM() {
#define RUN() \
MakeAssemblerBufferExecutable(buf, allocated); \
- Assembler::FlushICache(buf, masm.SizeOfGeneratedCode()); \
{ \
void (*test_function)(void); \
memcpy(&test_function, &buf, sizeof(buf)); \
@@ -1714,7 +1712,7 @@ TEST(adr_far) {
INIT_V8();
int max_range = 1 << (Instruction::ImmPCRelRangeBitwidth - 1);
- SETUP_SIZE(max_range + 1000 * kInstructionSize);
+ SETUP_SIZE(max_range + 1000 * kInstrSize);
Label done, fail;
Label test_near, near_forward, near_backward;
@@ -1744,7 +1742,7 @@ TEST(adr_far) {
__ Orr(x0, x0, 1 << 3);
__ B(&done);
- for (unsigned i = 0; i < max_range / kInstructionSize + 1; ++i) {
+ for (int i = 0; i < max_range / kInstrSize + 1; ++i) {
if (i % 100 == 0) {
// If we do land in this code, we do not want to execute so many nops
// before reaching the end of test (especially if tracing is activated).
@@ -1906,7 +1904,7 @@ TEST(branch_to_reg) {
RUN();
- CHECK_EQUAL_64(core.xreg(3) + kInstructionSize, x0);
+ CHECK_EQUAL_64(core.xreg(3) + kInstrSize, x0);
CHECK_EQUAL_64(42, x1);
CHECK_EQUAL_64(84, x2);
@@ -2048,7 +2046,7 @@ TEST(far_branch_backward) {
std::max(Instruction::ImmBranchRange(CompareBranchType),
Instruction::ImmBranchRange(CondBranchType)));
- SETUP_SIZE(max_range + 1000 * kInstructionSize);
+ SETUP_SIZE(max_range + 1000 * kInstrSize);
START();
@@ -2074,7 +2072,7 @@ TEST(far_branch_backward) {
// Generate enough code to overflow the immediate range of the three types of
// branches below.
- for (unsigned i = 0; i < max_range / kInstructionSize + 1; ++i) {
+ for (int i = 0; i < max_range / kInstrSize + 1; ++i) {
if (i % 100 == 0) {
// If we do land in this code, we do not want to execute so many nops
// before reaching the end of test (especially if tracing is activated).
@@ -2095,7 +2093,7 @@ TEST(far_branch_backward) {
// For each out-of-range branch instructions, at least two instructions should
// have been generated.
- CHECK_GE(7 * kInstructionSize, __ SizeOfCodeGeneratedSince(&test_tbz));
+ CHECK_GE(7 * kInstrSize, __ SizeOfCodeGeneratedSince(&test_tbz));
__ Bind(&fail);
__ Mov(x1, 0);
@@ -2122,7 +2120,7 @@ TEST(far_branch_simple_veneer) {
std::max(Instruction::ImmBranchRange(CompareBranchType),
Instruction::ImmBranchRange(CondBranchType)));
- SETUP_SIZE(max_range + 1000 * kInstructionSize);
+ SETUP_SIZE(max_range + 1000 * kInstrSize);
START();
@@ -2144,7 +2142,7 @@ TEST(far_branch_simple_veneer) {
// Generate enough code to overflow the immediate range of the three types of
// branches below.
- for (unsigned i = 0; i < max_range / kInstructionSize + 1; ++i) {
+ for (int i = 0; i < max_range / kInstrSize + 1; ++i) {
if (i % 100 == 0) {
// If we do land in this code, we do not want to execute so many nops
// before reaching the end of test (especially if tracing is activated).
@@ -2198,7 +2196,7 @@ TEST(far_branch_veneer_link_chain) {
std::max(Instruction::ImmBranchRange(CompareBranchType),
Instruction::ImmBranchRange(CondBranchType)));
- SETUP_SIZE(max_range + 1000 * kInstructionSize);
+ SETUP_SIZE(max_range + 1000 * kInstrSize);
START();
@@ -2239,7 +2237,7 @@ TEST(far_branch_veneer_link_chain) {
// Generate enough code to overflow the immediate range of the three types of
// branches below.
- for (unsigned i = 0; i < max_range / kInstructionSize + 1; ++i) {
+ for (int i = 0; i < max_range / kInstrSize + 1; ++i) {
if (i % 100 == 0) {
// If we do land in this code, we do not want to execute so many nops
// before reaching the end of test (especially if tracing is activated).
@@ -2288,7 +2286,7 @@ TEST(far_branch_veneer_broken_link_chain) {
int max_range = Instruction::ImmBranchRange(TestBranchType);
int inter_range = max_range / 2 + max_range / 10;
- SETUP_SIZE(3 * inter_range + 1000 * kInstructionSize);
+ SETUP_SIZE(3 * inter_range + 1000 * kInstrSize);
START();
@@ -2305,7 +2303,7 @@ TEST(far_branch_veneer_broken_link_chain) {
__ Mov(x0, 1);
__ B(&far_target);
- for (unsigned i = 0; i < inter_range / kInstructionSize; ++i) {
+ for (int i = 0; i < inter_range / kInstrSize; ++i) {
if (i % 100 == 0) {
// Do not allow generating veneers. They should not be needed.
__ b(&fail);
@@ -2319,7 +2317,7 @@ TEST(far_branch_veneer_broken_link_chain) {
__ Mov(x0, 2);
__ Tbz(x10, 7, &far_target);
- for (unsigned i = 0; i < inter_range / kInstructionSize; ++i) {
+ for (int i = 0; i < inter_range / kInstrSize; ++i) {
if (i % 100 == 0) {
// Do not allow generating veneers. They should not be needed.
__ b(&fail);
@@ -2334,7 +2332,7 @@ TEST(far_branch_veneer_broken_link_chain) {
__ Mov(x0, 3);
__ Tbz(x10, 7, &far_target);
- for (unsigned i = 0; i < inter_range / kInstructionSize; ++i) {
+ for (int i = 0; i < inter_range / kInstrSize; ++i) {
if (i % 100 == 0) {
// Allow generating veneers.
__ B(&fail);
@@ -6742,65 +6740,72 @@ TEST(ldr_literal) {
#ifdef DEBUG
// These tests rely on functions available in debug mode.
-enum LiteralPoolEmitOption { NoJumpRequired, JumpRequired };
+enum LiteralPoolEmitOutcome { EmitExpected, NoEmitExpected };
-static void LdrLiteralRangeHelper(int range_, LiteralPoolEmitOption option,
- bool expect_dump) {
- CHECK_GT(range_, 0);
- SETUP_SIZE(range_ + 1024);
+static void LdrLiteralRangeHelper(size_t range, LiteralPoolEmitOutcome outcome,
+ size_t prepadding = 0) {
+ SETUP_SIZE(static_cast<int>(range + 1024));
- Label label_1, label_2;
-
- size_t range = static_cast<size_t>(range_);
size_t code_size = 0;
- size_t pool_guard_size;
-
- if (option == NoJumpRequired) {
- // Space for an explicit branch.
- pool_guard_size = kInstructionSize;
- } else {
- pool_guard_size = 0;
- }
+ const size_t pool_entries = 2;
+ const size_t kEntrySize = 8;
START();
// Force a pool dump so the pool starts off empty.
__ CheckConstPool(true, true);
CHECK_CONSTANT_POOL_SIZE(0);
+ // Emit prepadding to influence alignment of the pool; we don't count this
+ // into code size.
+ for (size_t i = 0; i < prepadding; ++i) __ Nop();
+
LoadLiteral(&masm, x0, 0x1234567890ABCDEFUL);
LoadLiteral(&masm, x1, 0xABCDEF1234567890UL);
- CHECK_CONSTANT_POOL_SIZE(16);
-
- code_size += 2 * kInstructionSize;
+ code_size += 2 * kInstrSize;
+ CHECK_CONSTANT_POOL_SIZE(pool_entries * kEntrySize);
// Check that the requested range (allowing space for a branch over the pool)
// can be handled by this test.
- CHECK_LE(code_size + pool_guard_size, range);
+ CHECK_LE(code_size, range);
+
+ auto PoolSizeAt = [pool_entries](int pc_offset) {
+ // To determine padding, consider the size of the prologue of the pool,
+ // and the jump around the pool, which we always need.
+ size_t prologue_size = 2 * kInstrSize + kInstrSize;
+ size_t pc = pc_offset + prologue_size;
+ const size_t padding = IsAligned(pc, 8) ? 0 : 4;
+ return prologue_size + pool_entries * kEntrySize + padding;
+ };
- // Emit NOPs up to 'range', leaving space for the pool guard.
- while ((code_size + pool_guard_size + kInstructionSize) < range) {
+ int pc_offset_before_emission = -1;
+ // Emit NOPs up to 'range'.
+ while (code_size < range) {
+ pc_offset_before_emission = __ pc_offset() + kInstrSize;
__ Nop();
- code_size += kInstructionSize;
- }
-
- // Emit the guard sequence before the literal pool.
- if (option == NoJumpRequired) {
- __ B(&label_1);
- code_size += kInstructionSize;
+ code_size += kInstrSize;
}
+ CHECK_EQ(code_size, range);
- // The next instruction will trigger pool emission when expect_dump is true.
- CHECK_EQ(code_size, range - kInstructionSize);
- CHECK_CONSTANT_POOL_SIZE(16);
-
- // Possibly generate a literal pool.
- __ Nop();
-
- __ Bind(&label_1);
- if (expect_dump) {
+ if (outcome == EmitExpected) {
CHECK_CONSTANT_POOL_SIZE(0);
+ // Check that the size of the emitted constant pool is as expected.
+ size_t pool_size = PoolSizeAt(pc_offset_before_emission);
+ CHECK_EQ(pc_offset_before_emission + pool_size, __ pc_offset());
+ byte* pool_start = buf + pc_offset_before_emission;
+ Instruction* branch = reinterpret_cast<Instruction*>(pool_start);
+ CHECK(branch->IsImmBranch());
+ CHECK_EQ(pool_size, branch->ImmPCOffset());
+ Instruction* marker =
+ reinterpret_cast<Instruction*>(pool_start + kInstrSize);
+ CHECK(marker->IsLdrLiteralX());
+ const size_t padding =
+ IsAligned(pc_offset_before_emission + kInstrSize, kEntrySize) ? 0 : 1;
+ CHECK_EQ(pool_entries * 2 + 1 + padding, marker->ImmLLiteral());
+
} else {
- CHECK_CONSTANT_POOL_SIZE(16);
+ CHECK_EQ(outcome, NoEmitExpected);
+ CHECK_CONSTANT_POOL_SIZE(pool_entries * kEntrySize);
+ CHECK_EQ(pc_offset_before_emission, __ pc_offset());
}
// Force a pool flush to check that a second pool functions correctly.
@@ -6810,7 +6815,7 @@ static void LdrLiteralRangeHelper(int range_, LiteralPoolEmitOption option,
// These loads should be after the pool (and will require a new one).
LoadLiteral(&masm, x4, 0x34567890ABCDEF12UL);
LoadLiteral(&masm, x5, 0xABCDEF0123456789UL);
- CHECK_CONSTANT_POOL_SIZE(16);
+ CHECK_CONSTANT_POOL_SIZE(pool_entries * kEntrySize);
END();
RUN();
@@ -6824,35 +6829,32 @@ static void LdrLiteralRangeHelper(int range_, LiteralPoolEmitOption option,
TEARDOWN();
}
-TEST(ldr_literal_range_1) {
+TEST(ldr_literal_range_max_dist_emission_1) {
INIT_V8();
LdrLiteralRangeHelper(MacroAssembler::GetApproxMaxDistToConstPoolForTesting(),
- NoJumpRequired, true);
+ EmitExpected);
}
-
-TEST(ldr_literal_range_2) {
+TEST(ldr_literal_range_max_dist_emission_2) {
INIT_V8();
- LdrLiteralRangeHelper(
- MacroAssembler::GetApproxMaxDistToConstPoolForTesting() -
- kInstructionSize,
- NoJumpRequired, false);
+ LdrLiteralRangeHelper(MacroAssembler::GetApproxMaxDistToConstPoolForTesting(),
+ EmitExpected, 1);
}
-
-TEST(ldr_literal_range_3) {
+TEST(ldr_literal_range_max_dist_no_emission_1) {
INIT_V8();
- LdrLiteralRangeHelper(MacroAssembler::GetCheckConstPoolIntervalForTesting(),
- JumpRequired, false);
+ LdrLiteralRangeHelper(
+ MacroAssembler::GetApproxMaxDistToConstPoolForTesting() - kInstrSize,
+ NoEmitExpected);
}
-
-TEST(ldr_literal_range_4) {
+TEST(ldr_literal_range_max_dist_no_emission_2) {
INIT_V8();
LdrLiteralRangeHelper(
- MacroAssembler::GetCheckConstPoolIntervalForTesting() - kInstructionSize,
- JumpRequired, false);
+ MacroAssembler::GetApproxMaxDistToConstPoolForTesting() - kInstrSize,
+ NoEmitExpected, 1);
}
+
#endif
TEST(add_sub_imm) {
@@ -15251,7 +15253,7 @@ TEST(pool_size) {
}
__ RecordVeneerPool(masm.pc_offset(), veneer_pool_size);
- for (unsigned i = 0; i < veneer_pool_size / kInstructionSize; ++i) {
+ for (unsigned i = 0; i < veneer_pool_size / kInstrSize; ++i) {
__ nop();
}
@@ -15289,7 +15291,7 @@ TEST(jump_tables_forward) {
const int kNumCases = 512;
INIT_V8();
- SETUP_SIZE(kNumCases * 5 * kInstructionSize + 8192);
+ SETUP_SIZE(kNumCases * 5 * kInstrSize + 8192);
START();
int32_t values[kNumCases];
@@ -15353,7 +15355,7 @@ TEST(jump_tables_backward) {
const int kNumCases = 512;
INIT_V8();
- SETUP_SIZE(kNumCases * 5 * kInstructionSize + 8192);
+ SETUP_SIZE(kNumCases * 5 * kInstrSize + 8192);
START();
int32_t values[kNumCases];
diff --git a/deps/v8/test/cctest/test-assembler-mips.cc b/deps/v8/test/cctest/test-assembler-mips.cc
index 4538e8ac78..4b625c2b53 100644
--- a/deps/v8/test/cctest/test-assembler-mips.cc
+++ b/deps/v8/test/cctest/test-assembler-mips.cc
@@ -3164,16 +3164,13 @@ TEST(jump_tables1) {
Label done;
{
__ BlockTrampolinePoolFor(kNumCases + 7);
- PredictableCodeSizeScope predictable(
- &assm, (kNumCases + 7) * Assembler::kInstrSize);
- Label here;
+ PredictableCodeSizeScope predictable(&assm, (kNumCases + 7) * kInstrSize);
- __ bal(&here);
+ __ nal();
__ nop();
- __ bind(&here);
__ sll(at, a0, 2);
__ addu(at, at, ra);
- __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize));
+ __ lw(at, MemOperand(at, 5 * kInstrSize));
__ jr(at);
__ nop();
for (int i = 0; i < kNumCases; ++i) {
@@ -3243,16 +3240,13 @@ TEST(jump_tables2) {
__ bind(&dispatch);
{
__ BlockTrampolinePoolFor(kNumCases + 7);
- PredictableCodeSizeScope predictable(
- &assm, (kNumCases + 7) * Assembler::kInstrSize);
- Label here;
+ PredictableCodeSizeScope predictable(&assm, (kNumCases + 7) * kInstrSize);
- __ bal(&here);
+ __ nal();
__ nop();
- __ bind(&here);
__ sll(at, a0, 2);
__ addu(at, at, ra);
- __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize));
+ __ lw(at, MemOperand(at, 5 * kInstrSize));
__ jr(at);
__ nop();
for (int i = 0; i < kNumCases; ++i) {
@@ -3319,16 +3313,13 @@ TEST(jump_tables3) {
__ bind(&dispatch);
{
__ BlockTrampolinePoolFor(kNumCases + 7);
- PredictableCodeSizeScope predictable(
- &assm, (kNumCases + 7) * Assembler::kInstrSize);
- Label here;
+ PredictableCodeSizeScope predictable(&assm, (kNumCases + 7) * kInstrSize);
- __ bal(&here);
+ __ nal();
__ nop();
- __ bind(&here);
__ sll(at, a0, 2);
__ addu(at, at, ra);
- __ lw(at, MemOperand(at, 5 * Assembler::kInstrSize));
+ __ lw(at, MemOperand(at, 5 * kInstrSize));
__ jr(at);
__ nop();
for (int i = 0; i < kNumCases; ++i) {
@@ -4811,8 +4802,8 @@ uint32_t run_jic(int16_t offset) {
__ beq(v0, t1, &stop_execution);
__ nop();
- __ bal(&get_program_counter); // t0 <- program counter
- __ nop();
+ __ nal(); // t0 <- program counter
+ __ mov(t0, ra);
__ jic(t0, offset);
__ addiu(v0, v0, 0x100);
@@ -4823,11 +4814,6 @@ uint32_t run_jic(int16_t offset) {
__ jr(ra);
__ nop();
- __ bind(&get_program_counter);
- __ mov(t0, ra);
- __ jr(ra);
- __ nop();
-
__ bind(&stop_execution);
__ pop(ra);
__ jr(ra);
@@ -5158,8 +5144,8 @@ uint32_t run_jialc(int16_t offset) {
// Block 3 (Main)
__ bind(&main_block);
- __ bal(&get_program_counter); // t0 <- program counter
- __ nop();
+ __ nal(); // t0 <- program counter
+ __ mov(t0, ra);
__ jialc(t0, offset);
__ addiu(v0, v0, 0x4);
__ pop(ra);
@@ -5178,11 +5164,6 @@ uint32_t run_jialc(int16_t offset) {
__ jr(ra);
__ nop();
- __ bind(&get_program_counter);
- __ mov(t0, ra);
- __ jr(ra);
- __ nop();
-
CodeDesc desc;
assm.GetCode(isolate, &desc);
@@ -5557,7 +5538,7 @@ TEST(Trampoline) {
MacroAssembler assm(isolate, nullptr, 0,
v8::internal::CodeObjectRequired::kYes);
Label done;
- size_t nr_calls = kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2;
+ size_t nr_calls = kMaxBranchOffset / (2 * kInstrSize) + 2;
for (size_t i = 0; i < nr_calls; ++i) {
__ BranchShort(&done, eq, a0, Operand(a1));
@@ -5715,8 +5696,7 @@ uint32_t run_Subu(uint32_t imm, int32_t num_instr) {
Label code_start;
__ bind(&code_start);
__ Subu(v0, zero_reg, imm);
- CHECK_EQ(assm.SizeOfCodeGeneratedSince(&code_start),
- num_instr * Assembler::kInstrSize);
+ CHECK_EQ(assm.SizeOfCodeGeneratedSince(&code_start), num_instr * kInstrSize);
__ jr(ra);
__ nop();
diff --git a/deps/v8/test/cctest/test-assembler-mips64.cc b/deps/v8/test/cctest/test-assembler-mips64.cc
index bd96375c48..785ffa2fa3 100644
--- a/deps/v8/test/cctest/test-assembler-mips64.cc
+++ b/deps/v8/test/cctest/test-assembler-mips64.cc
@@ -3293,15 +3293,13 @@ TEST(jump_tables1) {
Label done;
{
__ BlockTrampolinePoolFor(kNumCases * 2 + 6);
- PredictableCodeSizeScope predictable(
- &assm, (kNumCases * 2 + 6) * Assembler::kInstrSize);
- Label here;
+ PredictableCodeSizeScope predictable(&assm,
+ (kNumCases * 2 + 6) * kInstrSize);
- __ bal(&here);
+ __ nal();
__ dsll(at, a0, 3); // In delay slot.
- __ bind(&here);
__ daddu(at, at, ra);
- __ Ld(at, MemOperand(at, 4 * Assembler::kInstrSize));
+ __ Ld(at, MemOperand(at, 4 * kInstrSize));
__ jr(at);
__ nop();
for (int i = 0; i < kNumCases; ++i) {
@@ -3373,15 +3371,13 @@ TEST(jump_tables2) {
__ bind(&dispatch);
{
__ BlockTrampolinePoolFor(kNumCases * 2 + 6);
- PredictableCodeSizeScope predictable(
- &assm, (kNumCases * 2 + 6) * Assembler::kInstrSize);
- Label here;
+ PredictableCodeSizeScope predictable(&assm,
+ (kNumCases * 2 + 6) * kInstrSize);
- __ bal(&here);
+ __ nal();
__ dsll(at, a0, 3); // In delay slot.
- __ bind(&here);
__ daddu(at, at, ra);
- __ Ld(at, MemOperand(at, 4 * Assembler::kInstrSize));
+ __ Ld(at, MemOperand(at, 4 * kInstrSize));
__ jr(at);
__ nop();
for (int i = 0; i < kNumCases; ++i) {
@@ -3453,15 +3449,13 @@ TEST(jump_tables3) {
__ bind(&dispatch);
{
__ BlockTrampolinePoolFor(kNumCases * 2 + 6);
- PredictableCodeSizeScope predictable(
- &assm, (kNumCases * 2 + 6) * Assembler::kInstrSize);
- Label here;
+ PredictableCodeSizeScope predictable(&assm,
+ (kNumCases * 2 + 6) * kInstrSize);
- __ bal(&here);
+ __ nal();
__ dsll(at, a0, 3); // In delay slot.
- __ bind(&here);
__ daddu(at, at, ra);
- __ Ld(at, MemOperand(at, 4 * Assembler::kInstrSize));
+ __ Ld(at, MemOperand(at, 4 * kInstrSize));
__ jr(at);
__ nop();
for (int i = 0; i < kNumCases; ++i) {
@@ -5437,8 +5431,8 @@ uint64_t run_jic(int16_t offset) {
__ beq(v0, t1, &stop_execution);
__ nop();
- __ bal(&get_program_counter); // t0 <- program counter
- __ nop();
+ __ nal(); // t0 <- program counter
+ __ mov(t0, ra);
__ jic(t0, offset);
__ addiu(v0, v0, 0x100);
@@ -5449,11 +5443,6 @@ uint64_t run_jic(int16_t offset) {
__ jr(ra);
__ nop();
- __ bind(&get_program_counter);
- __ mov(t0, ra);
- __ jr(ra);
- __ nop();
-
__ bind(&stop_execution);
__ pop(ra);
__ jr(ra);
@@ -5784,8 +5773,8 @@ uint64_t run_jialc(int16_t offset) {
// Block 3 (Main)
__ bind(&main_block);
- __ bal(&get_program_counter); // t0 <- program counter
- __ nop();
+ __ nal(); // t0 <- program counter
+ __ mov(t0, ra);
__ jialc(t0, offset);
__ addiu(v0, v0, 0x4);
__ pop(ra);
@@ -5804,11 +5793,6 @@ uint64_t run_jialc(int16_t offset) {
__ jr(ra);
__ nop();
- __ bind(&get_program_counter);
- __ mov(t0, ra);
- __ jr(ra);
- __ nop();
-
CodeDesc desc;
assm.GetCode(isolate, &desc);
@@ -6263,7 +6247,7 @@ TEST(Trampoline) {
MacroAssembler assm(isolate, nullptr, 0,
v8::internal::CodeObjectRequired::kYes);
Label done;
- size_t nr_calls = kMaxBranchOffset / (2 * Instruction::kInstrSize) + 2;
+ size_t nr_calls = kMaxBranchOffset / (2 * kInstrSize) + 2;
for (size_t i = 0; i < nr_calls; ++i) {
__ BranchShort(&done, eq, a0, Operand(a1));
diff --git a/deps/v8/test/cctest/test-assembler-x64.cc b/deps/v8/test/cctest/test-assembler-x64.cc
index eb172ee2aa..7ecef4429c 100644
--- a/deps/v8/test/cctest/test-assembler-x64.cc
+++ b/deps/v8/test/cctest/test-assembler-x64.cc
@@ -39,6 +39,7 @@
#include "src/ostreams.h"
#include "src/simulator.h"
#include "test/cctest/cctest.h"
+#include "test/common/assembler-tester.h"
namespace v8 {
namespace internal {
diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc
index ba6af617bb..d7cdb39933 100644
--- a/deps/v8/test/cctest/test-code-stub-assembler.cc
+++ b/deps/v8/test/cctest/test-code-stub-assembler.cc
@@ -4,7 +4,7 @@
#include <cmath>
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/base/utils/random-number-generator.h"
#include "src/builtins/builtins-promise-gen.h"
#include "src/builtins/builtins-string-gen.h"
@@ -13,9 +13,12 @@
#include "src/code-stub-assembler.h"
#include "src/compiler/node.h"
#include "src/debug/debug.h"
+#include "src/heap/heap-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/objects/hash-table-inl.h"
+#include "src/objects/js-array-buffer-inl.h"
+#include "src/objects/js-array-inl.h"
#include "src/objects/promise-inl.h"
#include "test/cctest/compiler/code-assembler-tester.h"
#include "test/cctest/compiler/function-tester.h"
@@ -2377,7 +2380,8 @@ TEST(CreatePromiseResolvingFunctions) {
std::tie(resolve, reject) = m.CreatePromiseResolvingFunctions(
promise, m.BooleanConstant(false), native_context);
Node* const kSize = m.IntPtrConstant(2);
- Node* const arr = m.AllocateFixedArray(PACKED_ELEMENTS, kSize);
+ TNode<FixedArray> const arr =
+ m.Cast(m.AllocateFixedArray(PACKED_ELEMENTS, kSize));
m.StoreFixedArrayElement(arr, 0, resolve);
m.StoreFixedArrayElement(arr, 1, reject);
m.Return(arr);
@@ -3451,6 +3455,54 @@ TEST(IsDoubleElementsKind) {
0);
}
+TEST(TestCallBuiltinInlineTrampoline) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+ const int kNumParams = 1;
+ CodeAssemblerTester asm_tester(isolate, kNumParams);
+ CodeStubAssembler m(asm_tester.state());
+
+ const int kContextOffset = 2;
+ Node* str = m.Parameter(0);
+ Node* context = m.Parameter(kNumParams + kContextOffset);
+
+ Node* index = m.SmiConstant(2);
+
+ m.Return(m.CallStub(Builtins::CallableFor(isolate, Builtins::kStringRepeat),
+ context, str, index));
+ AssemblerOptions options = AssemblerOptions::Default(isolate);
+ options.inline_offheap_trampolines = true;
+ options.use_pc_relative_calls_and_jumps = false;
+ options.isolate_independent_code = false;
+ FunctionTester ft(asm_tester.GenerateCode(options), kNumParams);
+ MaybeHandle<Object> result = ft.Call(MakeString("abcdef"));
+ CHECK(String::Equals(isolate, MakeString("abcdefabcdef"),
+ Handle<String>::cast(result.ToHandleChecked())));
+}
+
+TEST(TestCallBuiltinIndirectLoad) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+ const int kNumParams = 1;
+ CodeAssemblerTester asm_tester(isolate, kNumParams);
+ CodeStubAssembler m(asm_tester.state());
+
+ const int kContextOffset = 2;
+ Node* str = m.Parameter(0);
+ Node* context = m.Parameter(kNumParams + kContextOffset);
+
+ Node* index = m.SmiConstant(2);
+
+ m.Return(m.CallStub(Builtins::CallableFor(isolate, Builtins::kStringRepeat),
+ context, str, index));
+ AssemblerOptions options = AssemblerOptions::Default(isolate);
+ options.inline_offheap_trampolines = false;
+ options.use_pc_relative_calls_and_jumps = false;
+ options.isolate_independent_code = true;
+ FunctionTester ft(asm_tester.GenerateCode(options), kNumParams);
+ MaybeHandle<Object> result = ft.Call(MakeString("abcdef"));
+ CHECK(String::Equals(isolate, MakeString("abcdefabcdef"),
+ Handle<String>::cast(result.ToHandleChecked())));
+}
+
} // namespace compiler
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-code-stubs-arm.cc b/deps/v8/test/cctest/test-code-stubs-arm.cc
index 8247afeb49..a5746a7f8e 100644
--- a/deps/v8/test/cctest/test-code-stubs-arm.cc
+++ b/deps/v8/test/cctest/test-code-stubs-arm.cc
@@ -37,6 +37,7 @@
#include "src/v8.h"
#include "test/cctest/cctest.h"
#include "test/cctest/test-code-stubs.h"
+#include "test/common/assembler-tester.h"
namespace v8 {
namespace internal {
@@ -116,7 +117,6 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate,
CodeDesc desc;
masm.GetCode(isolate, &desc);
MakeAssemblerBufferExecutable(buffer, allocated);
- Assembler::FlushICache(buffer, allocated);
return (reinterpret_cast<ConvertDToIFunc>(
reinterpret_cast<intptr_t>(buffer)));
}
diff --git a/deps/v8/test/cctest/test-code-stubs-arm64.cc b/deps/v8/test/cctest/test-code-stubs-arm64.cc
index 43bea1d910..cb20931a5d 100644
--- a/deps/v8/test/cctest/test-code-stubs-arm64.cc
+++ b/deps/v8/test/cctest/test-code-stubs-arm64.cc
@@ -37,6 +37,7 @@
#include "src/simulator.h"
#include "test/cctest/cctest.h"
#include "test/cctest/test-code-stubs.h"
+#include "test/common/assembler-tester.h"
namespace v8 {
namespace internal {
@@ -128,7 +129,6 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate,
CodeDesc desc;
masm.GetCode(isolate, &desc);
MakeAssemblerBufferExecutable(buffer, allocated);
- Assembler::FlushICache(buffer, allocated);
return (reinterpret_cast<ConvertDToIFunc>(
reinterpret_cast<intptr_t>(buffer)));
}
diff --git a/deps/v8/test/cctest/test-code-stubs-ia32.cc b/deps/v8/test/cctest/test-code-stubs-ia32.cc
index 77a2254245..54f53e57c3 100644
--- a/deps/v8/test/cctest/test-code-stubs-ia32.cc
+++ b/deps/v8/test/cctest/test-code-stubs-ia32.cc
@@ -38,6 +38,7 @@
#include "src/objects-inl.h"
#include "test/cctest/cctest.h"
#include "test/cctest/test-code-stubs.h"
+#include "test/common/assembler-tester.h"
namespace v8 {
namespace internal {
diff --git a/deps/v8/test/cctest/test-code-stubs-mips.cc b/deps/v8/test/cctest/test-code-stubs-mips.cc
index f57459ead0..ed1798160b 100644
--- a/deps/v8/test/cctest/test-code-stubs-mips.cc
+++ b/deps/v8/test/cctest/test-code-stubs-mips.cc
@@ -39,6 +39,7 @@
#include "src/simulator.h"
#include "test/cctest/cctest.h"
#include "test/cctest/test-code-stubs.h"
+#include "test/common/assembler-tester.h"
namespace v8 {
namespace internal {
@@ -129,7 +130,6 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate,
CodeDesc desc;
masm.GetCode(isolate, &desc);
MakeAssemblerBufferExecutable(buffer, allocated);
- Assembler::FlushICache(buffer, allocated);
return (reinterpret_cast<ConvertDToIFunc>(
reinterpret_cast<intptr_t>(buffer)));
}
diff --git a/deps/v8/test/cctest/test-code-stubs-mips64.cc b/deps/v8/test/cctest/test-code-stubs-mips64.cc
index 6605f82422..3518e722c7 100644
--- a/deps/v8/test/cctest/test-code-stubs-mips64.cc
+++ b/deps/v8/test/cctest/test-code-stubs-mips64.cc
@@ -39,6 +39,7 @@
#include "src/simulator.h"
#include "test/cctest/cctest.h"
#include "test/cctest/test-code-stubs.h"
+#include "test/common/assembler-tester.h"
namespace v8 {
namespace internal {
@@ -126,7 +127,6 @@ ConvertDToIFunc MakeConvertDToIFuncTrampoline(Isolate* isolate,
CodeDesc desc;
masm.GetCode(isolate, &desc);
MakeAssemblerBufferExecutable(buffer, allocated);
- Assembler::FlushICache(buffer, allocated);
return (reinterpret_cast<ConvertDToIFunc>(
reinterpret_cast<intptr_t>(buffer)));
}
diff --git a/deps/v8/test/cctest/test-code-stubs-x64.cc b/deps/v8/test/cctest/test-code-stubs-x64.cc
index 327d45d16c..c55b2e2b1e 100644
--- a/deps/v8/test/cctest/test-code-stubs-x64.cc
+++ b/deps/v8/test/cctest/test-code-stubs-x64.cc
@@ -37,6 +37,7 @@
#include "src/register-configuration.h"
#include "test/cctest/cctest.h"
#include "test/cctest/test-code-stubs.h"
+#include "test/common/assembler-tester.h"
namespace v8 {
namespace internal {
diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc
index 34868cd4c4..63904e086f 100644
--- a/deps/v8/test/cctest/test-compiler.cc
+++ b/deps/v8/test/cctest/test-compiler.cc
@@ -30,7 +30,7 @@
#include "src/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/compiler.h"
#include "src/disasm.h"
#include "src/heap/factory.h"
@@ -66,8 +66,9 @@ static Handle<JSFunction> Compile(const char* source) {
CStrVector(source)).ToHandleChecked();
Handle<SharedFunctionInfo> shared =
Compiler::GetSharedFunctionInfoForScript(
- source_code, Compiler::ScriptDetails(), v8::ScriptOriginOptions(),
- nullptr, nullptr, v8::ScriptCompiler::kNoCompileOptions,
+ isolate, source_code, Compiler::ScriptDetails(),
+ v8::ScriptOriginOptions(), nullptr, nullptr,
+ v8::ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked();
return isolate->factory()->NewFunctionFromSharedFunctionInfo(
@@ -658,7 +659,7 @@ TEST(CompileFunctionInContextScriptOrigin) {
v8::Exception::GetStackTrace(try_catch.Exception());
CHECK(!stack.IsEmpty());
CHECK_GT(stack->GetFrameCount(), 0);
- v8::Local<v8::StackFrame> frame = stack->GetFrame(0);
+ v8::Local<v8::StackFrame> frame = stack->GetFrame(CcTest::isolate(), 0);
CHECK_EQ(23, frame->GetLineNumber());
CHECK_EQ(42 + strlen("throw "), static_cast<unsigned>(frame->GetColumn()));
}
diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc
index f74bdf1ede..75af3f6d98 100644
--- a/deps/v8/test/cctest/test-cpu-profiler.cc
+++ b/deps/v8/test/cctest/test-cpu-profiler.cc
@@ -33,7 +33,7 @@
#include "src/v8.h"
#include "include/v8-profiler.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/base/platform/platform.h"
#include "src/deoptimizer.h"
#include "src/libplatform/default-platform.h"
diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc
index 7430fbf06b..f678b8ca6f 100644
--- a/deps/v8/test/cctest/test-debug.cc
+++ b/deps/v8/test/cctest/test-debug.cc
@@ -29,7 +29,7 @@
#include "src/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/compilation-cache.h"
#include "src/debug/debug-interface.h"
#include "src/debug/debug.h"
@@ -191,10 +191,6 @@ class DebugEventCounter : public v8::debug::DebugDelegate {
public:
void BreakProgramRequested(v8::Local<v8::Context>,
const std::vector<v8::debug::BreakpointId>&) {
- v8::internal::Debug* debug = CcTest::i_isolate()->debug();
- // When hitting a debug event listener there must be a break set.
- CHECK_NE(debug->break_id(), 0);
-
break_point_hit_count++;
// Perform a full deoptimization when the specified number of
// breaks have been hit.
@@ -217,10 +213,6 @@ class DebugEventBreakPointCollectGarbage : public v8::debug::DebugDelegate {
public:
void BreakProgramRequested(v8::Local<v8::Context>,
const std::vector<v8::debug::BreakpointId>&) {
- v8::internal::Debug* debug = CcTest::i_isolate()->debug();
- // When hitting a debug event listener there must be a break set.
- CHECK_NE(debug->break_id(), 0);
-
// Perform a garbage collection when break point is hit and continue. Based
// on the number of break points hit either scavenge or mark compact
// collector is used.
@@ -241,10 +233,6 @@ class DebugEventBreak : public v8::debug::DebugDelegate {
public:
void BreakProgramRequested(v8::Local<v8::Context>,
const std::vector<v8::debug::BreakpointId>&) {
- v8::internal::Debug* debug = CcTest::i_isolate()->debug();
- // When hitting a debug event listener there must be a break set.
- CHECK_NE(debug->break_id(), 0);
-
// Count the number of breaks.
break_point_hit_count++;
@@ -271,9 +259,6 @@ class DebugEventBreakMax : public v8::debug::DebugDelegate {
const std::vector<v8::debug::BreakpointId>&) {
v8::Isolate* v8_isolate = CcTest::isolate();
v8::internal::Isolate* isolate = CcTest::i_isolate();
- v8::internal::Debug* debug = isolate->debug();
- // When hitting a debug event listener there must be a break set.
- CHECK_NE(debug->break_id(), 0);
if (break_point_hit_count < max_break_point_hit_count) {
// Count the number of breaks.
break_point_hit_count++;
diff --git a/deps/v8/test/cctest/test-deoptimization.cc b/deps/v8/test/cctest/test-deoptimization.cc
index f0d62caff8..0d86f135ea 100644
--- a/deps/v8/test/cctest/test-deoptimization.cc
+++ b/deps/v8/test/cctest/test-deoptimization.cc
@@ -29,7 +29,7 @@
#include "src/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/base/platform/platform.h"
#include "src/compilation-cache.h"
#include "src/debug/debug.h"
diff --git a/deps/v8/test/cctest/test-dictionary.cc b/deps/v8/test/cctest/test-dictionary.cc
index 9f921558dd..1101ec06eb 100644
--- a/deps/v8/test/cctest/test-dictionary.cc
+++ b/deps/v8/test/cctest/test-dictionary.cc
@@ -28,7 +28,6 @@
#include "src/v8.h"
#include "test/cctest/cctest.h"
-#include "src/api.h"
#include "src/builtins/builtins-constructor.h"
#include "src/debug/debug.h"
#include "src/execution.h"
@@ -195,7 +194,7 @@ class ObjectHashTableTest: public ObjectHashTable {
}
int lookup(int key) {
- Handle<Object> key_obj(Smi::FromInt(key), GetIsolate());
+ Handle<Object> key_obj(Smi::FromInt(key), CcTest::i_isolate());
return Smi::ToInt(Lookup(key_obj));
}
diff --git a/deps/v8/test/cctest/test-disasm-arm.cc b/deps/v8/test/cctest/test-disasm-arm.cc
index d1cebe8138..877ae6665f 100644
--- a/deps/v8/test/cctest/test-disasm-arm.cc
+++ b/deps/v8/test/cctest/test-disasm-arm.cc
@@ -58,7 +58,7 @@ bool DisassembleAndCompare(byte* begin, UseRegex use_regex,
std::vector<std::string> expected_disassembly = {expected_strings...};
size_t n_expected = expected_disassembly.size();
- byte* end = begin + (n_expected * Assembler::kInstrSize);
+ byte* end = begin + (n_expected * kInstrSize);
std::vector<std::string> disassembly;
for (byte* pc = begin; pc < end;) {
@@ -483,6 +483,9 @@ TEST(Type3) {
COMPARE(rbit(r1, r2), "e6ff1f32 rbit r1, r2");
COMPARE(rbit(r10, ip), "e6ffaf3c rbit r10, ip");
+
+ COMPARE(rev(r1, r2), "e6bf1f32 rev r1, r2");
+ COMPARE(rev(r10, ip), "e6bfaf3c rev r10, ip");
}
COMPARE(usat(r0, 1, Operand(r1)),
@@ -672,14 +675,14 @@ TEST(Vfp) {
COMPARE(vmov(s3, Float32(13.0f)),
"eef21a0a vmov.f32 s3, #13");
- COMPARE(vmov(d0, VmovIndexLo, r0),
+ COMPARE(vmov(NeonS32, d0, 0, r0),
"ee000b10 vmov.32 d0[0], r0");
- COMPARE(vmov(d0, VmovIndexHi, r0),
+ COMPARE(vmov(NeonS32, d0, 1, r0),
"ee200b10 vmov.32 d0[1], r0");
- COMPARE(vmov(r2, VmovIndexLo, d15),
+ COMPARE(vmov(NeonS32, r2, d15, 0),
"ee1f2b10 vmov.32 r2, d15[0]");
- COMPARE(vmov(r3, VmovIndexHi, d14),
+ COMPARE(vmov(NeonS32, r3, d14, 1),
"ee3e3b10 vmov.32 r3, d14[1]");
COMPARE(vldr(s0, r0, 0),
@@ -833,9 +836,9 @@ TEST(Vfp) {
COMPARE(vmov(d30, Double(16.0)),
"eef3eb00 vmov.f64 d30, #16");
- COMPARE(vmov(d31, VmovIndexLo, r7),
+ COMPARE(vmov(NeonS32, d31, 0, r7),
"ee0f7b90 vmov.32 d31[0], r7");
- COMPARE(vmov(d31, VmovIndexHi, r7),
+ COMPARE(vmov(NeonS32, d31, 1, r7),
"ee2f7b90 vmov.32 d31[1], r7");
COMPARE(vldr(d25, r0, 0),
@@ -1513,7 +1516,7 @@ static void TestLoadLiteral(byte* buffer, Assembler* assm, bool* failure,
char expected_string[80];
snprintf(expected_string, sizeof(expected_string), expected_string_template,
abs(offset), offset,
- progcounter + Instruction::kPCReadOffset + offset);
+ progcounter + Instruction::kPcLoadDelta + offset);
if (!DisassembleAndCompare(progcounter, kRawString, expected_string)) {
*failure = true;
}
@@ -1612,6 +1615,9 @@ TEST(LoadStoreExclusive) {
COMPARE(strexh(r0, r1, r2), "e1e20f91 strexh r0, r1, [r2]");
COMPARE(ldrex(r0, r1), "e1910f9f ldrex r0, [r1]");
COMPARE(strex(r0, r1, r2), "e1820f91 strex r0, r1, [r2]");
+ COMPARE(ldrexd(r0, r1, r2), "e1b20f9f ldrexd r0, [r2]");
+ COMPARE(strexd(r0, r2, r3, r4),
+ "e1a40f92 strexd r0, r2, [r4]");
VERIFY_RUN();
}
diff --git a/deps/v8/test/cctest/test-disasm-arm64.cc b/deps/v8/test/cctest/test-disasm-arm64.cc
index 275feaa88e..1cc14271a6 100644
--- a/deps/v8/test/cctest/test-disasm-arm64.cc
+++ b/deps/v8/test/cctest/test-disasm-arm64.cc
@@ -815,7 +815,7 @@ TEST_(adr) {
TEST_(branch) {
SET_UP_ASM();
- #define INST_OFF(x) ((x) >> kInstructionSizeLog2)
+#define INST_OFF(x) ((x) >> kInstrSizeLog2)
COMPARE_PREFIX(b(INST_OFF(0x4)), "b #+0x4");
COMPARE_PREFIX(b(INST_OFF(-0x4)), "b #-0x4");
COMPARE_PREFIX(b(INST_OFF(0x7fffffc)), "b #+0x7fffffc");
@@ -840,6 +840,7 @@ TEST_(branch) {
COMPARE_PREFIX(tbnz(w10, 31, INST_OFF(0)), "tbnz w10, #31, #+0x0");
COMPARE_PREFIX(tbnz(x11, 31, INST_OFF(0x4)), "tbnz w11, #31, #+0x4");
COMPARE_PREFIX(tbnz(x12, 32, INST_OFF(0x8)), "tbnz x12, #32, #+0x8");
+#undef INST_OFF
COMPARE(br(x0), "br x0");
COMPARE(blr(x1), "blr x1");
COMPARE(ret(x2), "ret x2");
@@ -1881,7 +1882,11 @@ TEST_(debug) {
byte* buf = static_cast<byte*>(malloc(INSTR_SIZE));
uint32_t encoding = 0;
AssemblerOptions options;
+#ifdef USE_SIMULATOR
options.enable_simulator_code = (i == 1);
+#else
+ CHECK(!options.enable_simulator_code);
+#endif
Assembler* assm = new Assembler(options, buf, INSTR_SIZE);
Decoder<DispatchingDecoderVisitor>* decoder =
new Decoder<DispatchingDecoderVisitor>();
diff --git a/deps/v8/test/cctest/test-disasm-ia32.cc b/deps/v8/test/cctest/test-disasm-ia32.cc
index 84764621c9..a24de5656d 100644
--- a/deps/v8/test/cctest/test-disasm-ia32.cc
+++ b/deps/v8/test/cctest/test-disasm-ia32.cc
@@ -91,6 +91,8 @@ TEST(DisasmIa320) {
__ add(edi, Operand(ebp, ecx, times_4, -3999));
__ add(Operand(ebp, ecx, times_4, 12), Immediate(12));
+ __ bswap(eax);
+
__ nop();
__ add(ebx, Immediate(12));
__ nop();
@@ -391,6 +393,7 @@ TEST(DisasmIa320) {
__ shufps(xmm0, xmm0, 0x0);
__ cvtsd2ss(xmm0, xmm1);
__ cvtsd2ss(xmm0, Operand(ebx, ecx, times_4, 10000));
+ __ movq(xmm0, Operand(edx, 4));
// logic operation
__ andps(xmm0, xmm1);
@@ -871,6 +874,8 @@ TEST(DisasmIa320) {
__ cmpxchg_b(Operand(esp, 12), eax);
__ cmpxchg_w(Operand(ebx, ecx, times_4, 10000), eax);
__ cmpxchg(Operand(ebx, ecx, times_4, 10000), eax);
+ __ cmpxchg(Operand(ebx, ecx, times_4, 10000), eax);
+ __ cmpxchg8b(Operand(ebx, ecx, times_8, 10000));
}
// lock prefix.
diff --git a/deps/v8/test/cctest/test-disasm-x64.cc b/deps/v8/test/cctest/test-disasm-x64.cc
index 5811371999..c42606485c 100644
--- a/deps/v8/test/cctest/test-disasm-x64.cc
+++ b/deps/v8/test/cctest/test-disasm-x64.cc
@@ -89,6 +89,8 @@ TEST(DisasmX64) {
__ addq(rdi, Operand(rbp, rcx, times_4, -3999));
__ addq(Operand(rbp, rcx, times_4, 12), Immediate(12));
+ __ bswapl(rax);
+ __ bswapq(rdi);
__ bsrl(rax, r15);
__ bsrl(r9, Operand(rcx, times_8, 91919));
@@ -384,6 +386,8 @@ TEST(DisasmX64) {
__ cvttss2si(rdx, xmm1);
__ cvtsd2ss(xmm0, xmm1);
__ cvtsd2ss(xmm0, Operand(rbx, rcx, times_4, 10000));
+ __ cvttps2dq(xmm0, xmm1);
+ __ cvttps2dq(xmm0, Operand(rbx, rcx, times_4, 10000));
__ movaps(xmm0, xmm1);
__ movdqa(xmm0, Operand(rsp, 12));
__ movdqa(Operand(rsp, 12), xmm0);
@@ -524,6 +528,8 @@ TEST(DisasmX64) {
{
if (CpuFeatures::IsSupported(SSSE3)) {
CpuFeatureScope scope(&assm, SSSE3);
+ __ palignr(xmm5, xmm1, 5);
+ __ palignr(xmm5, Operand(rdx, 4), 5);
SSSE3_INSTRUCTION_LIST(EMIT_SSE34_INSTR)
}
}
@@ -539,6 +545,8 @@ TEST(DisasmX64) {
__ pextrd(r12, xmm0, 1);
__ pinsrd(xmm9, r9, 0);
__ pinsrd(xmm5, Operand(rax, 4), 1);
+ __ pblendw(xmm5, xmm1, 1);
+ __ pblendw(xmm9, Operand(rax, 4), 1);
__ cmpps(xmm5, xmm1, 1);
__ cmpps(xmm5, Operand(rbx, rcx, times_4, 10000), 1);
diff --git a/deps/v8/test/cctest/test-elements-kind.cc b/deps/v8/test/cctest/test-elements-kind.cc
index 5237a54173..59252f2ef8 100644
--- a/deps/v8/test/cctest/test-elements-kind.cc
+++ b/deps/v8/test/cctest/test-elements-kind.cc
@@ -15,6 +15,7 @@
#include "src/heap/factory.h"
#include "src/ic/stub-cache.h"
#include "src/objects-inl.h"
+#include "src/objects/js-array-inl.h"
namespace v8 {
namespace internal {
diff --git a/deps/v8/test/cctest/test-feedback-vector.cc b/deps/v8/test/cctest/test-feedback-vector.cc
index 44a81dd294..b809854270 100644
--- a/deps/v8/test/cctest/test-feedback-vector.cc
+++ b/deps/v8/test/cctest/test-feedback-vector.cc
@@ -5,7 +5,7 @@
#include "src/v8.h"
#include "test/cctest/cctest.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/debug/debug.h"
#include "src/execution.h"
#include "src/global-handles.h"
diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc
index 95b671b43a..4e37103558 100644
--- a/deps/v8/test/cctest/test-field-type-tracking.cc
+++ b/deps/v8/test/cctest/test-field-type-tracking.cc
@@ -609,7 +609,6 @@ static void TestGeneralizeField(int detach_property_at_index,
bool expected_deprecation,
bool expected_field_type_dependency) {
Isolate* isolate = CcTest::i_isolate();
- JSHeapBroker broker(isolate);
Handle<FieldType> any_type = FieldType::Any(isolate);
CHECK(detach_property_at_index >= -1 &&
@@ -656,6 +655,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);
dependencies.DependOnFieldType(MapRef(&broker, map), property_index);
@@ -989,7 +989,6 @@ TEST(GeneralizeFieldWithAccessorProperties) {
static void TestReconfigureDataFieldAttribute_GeneralizeField(
const CRFTData& from, const CRFTData& to, const CRFTData& expected) {
Isolate* isolate = CcTest::i_isolate();
- JSHeapBroker broker(isolate);
Expectations expectations(isolate);
@@ -1028,6 +1027,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeField(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
+ JSHeapBroker broker(isolate, &zone);
CompilationDependencies dependencies(isolate, &zone);
dependencies.DependOnFieldType(MapRef(&broker, map), kSplitProp);
@@ -1073,7 +1073,6 @@ static void TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial(
const CRFTData& from, const CRFTData& to, const CRFTData& expected,
bool expected_field_type_dependency = true) {
Isolate* isolate = CcTest::i_isolate();
- JSHeapBroker broker(isolate);
Expectations expectations(isolate);
@@ -1112,6 +1111,7 @@ static void TestReconfigureDataFieldAttribute_GeneralizeFieldTrivial(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
+ JSHeapBroker broker(isolate, &zone);
CompilationDependencies dependencies(isolate, &zone);
dependencies.DependOnFieldType(MapRef(&broker, map), kSplitProp);
@@ -1753,7 +1753,6 @@ TEST(ReconfigureDataFieldAttribute_AccConstantToDataFieldAfterTargetMap) {
static void TestReconfigureElementsKind_GeneralizeField(
const CRFTData& from, const CRFTData& to, const CRFTData& expected) {
Isolate* isolate = CcTest::i_isolate();
- JSHeapBroker broker(isolate);
Expectations expectations(isolate, PACKED_SMI_ELEMENTS);
@@ -1793,6 +1792,7 @@ static void TestReconfigureElementsKind_GeneralizeField(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
+ JSHeapBroker broker(isolate, &zone);
CompilationDependencies dependencies(isolate, &zone);
dependencies.DependOnFieldType(MapRef(&broker, map), kDiffProp);
@@ -1848,7 +1848,6 @@ static void TestReconfigureElementsKind_GeneralizeField(
static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
const CRFTData& from, const CRFTData& to, const CRFTData& expected) {
Isolate* isolate = CcTest::i_isolate();
- JSHeapBroker broker(isolate);
Expectations expectations(isolate, PACKED_SMI_ELEMENTS);
@@ -1888,6 +1887,7 @@ static void TestReconfigureElementsKind_GeneralizeFieldTrivial(
Zone zone(isolate->allocator(), ZONE_NAME);
CanonicalHandleScope canonical(isolate);
+ JSHeapBroker broker(isolate, &zone);
CompilationDependencies dependencies(isolate, &zone);
dependencies.DependOnFieldType(MapRef(&broker, map), kDiffProp);
@@ -2636,8 +2636,7 @@ struct SameMapChecker {
// Checks that both |map1| and |map2| should stays non-deprecated, this is
// the case when property kind is change.
struct PropertyKindReconfigurationChecker {
- void Check(Isolate* isolate, Expectations& expectations, Handle<Map> map1,
- Handle<Map> map2) {
+ void Check(Expectations& expectations, Handle<Map> map1, Handle<Map> map2) {
CHECK(!map1->is_deprecated());
CHECK(!map2->is_deprecated());
CHECK_NE(*map1, *map2);
diff --git a/deps/v8/test/cctest/test-func-name-inference.cc b/deps/v8/test/cctest/test-func-name-inference.cc
index 160f68813c..61f3ef0eeb 100644
--- a/deps/v8/test/cctest/test-func-name-inference.cc
+++ b/deps/v8/test/cctest/test-func-name-inference.cc
@@ -29,7 +29,7 @@
#include "src/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/debug/debug.h"
#include "src/objects-inl.h"
#include "src/string-search.h"
diff --git a/deps/v8/test/cctest/test-fuzz-arm64.cc b/deps/v8/test/cctest/test-fuzz-arm64.cc
index 059eda46fd..4345bb5f44 100644
--- a/deps/v8/test/cctest/test-fuzz-arm64.cc
+++ b/deps/v8/test/cctest/test-fuzz-arm64.cc
@@ -41,7 +41,7 @@ TEST(FUZZ_decoder) {
seed48(seed);
Decoder<DispatchingDecoderVisitor> decoder;
- Instruction buffer[kInstructionSize];
+ Instruction buffer[kInstrSize];
for (int i = 0; i < instruction_count; i++) {
uint32_t instr = static_cast<uint32_t>(mrand48());
@@ -61,7 +61,7 @@ TEST(FUZZ_disasm) {
Decoder<DispatchingDecoderVisitor> decoder;
DisassemblingDecoder disasm;
- Instruction buffer[kInstructionSize];
+ Instruction buffer[kInstrSize];
decoder.AppendVisitor(&disasm);
for (int i = 0; i < instruction_count; i++) {
diff --git a/deps/v8/test/cctest/test-global-handles.cc b/deps/v8/test/cctest/test-global-handles.cc
index 89b5ed4c83..ea76faa857 100644
--- a/deps/v8/test/cctest/test-global-handles.cc
+++ b/deps/v8/test/cctest/test-global-handles.cc
@@ -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.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/global-handles.h"
#include "src/heap/factory.h"
#include "src/isolate.h"
diff --git a/deps/v8/test/cctest/test-global-object.cc b/deps/v8/test/cctest/test-global-object.cc
index 24dd270b73..5c154565d9 100644
--- a/deps/v8/test/cctest/test-global-object.cc
+++ b/deps/v8/test/cctest/test-global-object.cc
@@ -25,7 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-#include "src/api.h"
#include "src/objects-inl.h"
#include "src/v8.h"
#include "test/cctest/cctest.h"
diff --git a/deps/v8/test/cctest/test-hashcode.cc b/deps/v8/test/cctest/test-hashcode.cc
index a433c77ac7..2059d53885 100644
--- a/deps/v8/test/cctest/test-hashcode.cc
+++ b/deps/v8/test/cctest/test-hashcode.cc
@@ -6,7 +6,6 @@
#include <sstream>
#include <utility>
-#include "src/api.h"
#include "src/objects-inl.h"
#include "src/objects.h"
#include "src/v8.h"
@@ -26,14 +25,14 @@ int AddToSetAndGetHash(Isolate* isolate, Handle<JSObject> obj,
return Smi::ToInt(obj->GetHash());
}
-void CheckFastObject(Isolate* isolate, Handle<JSObject> obj, int hash) {
+void CheckFastObject(Handle<JSObject> obj, int hash) {
CHECK(obj->HasFastProperties());
CHECK(obj->raw_properties_or_hash()->IsPropertyArray());
CHECK_EQ(Smi::FromInt(hash), obj->GetHash());
CHECK_EQ(hash, obj->property_array()->Hash());
}
-void CheckDictionaryObject(Isolate* isolate, Handle<JSObject> obj, int hash) {
+void CheckDictionaryObject(Handle<JSObject> obj, int hash) {
CHECK(!obj->HasFastProperties());
CHECK(obj->raw_properties_or_hash()->IsDictionary());
CHECK_EQ(Smi::FromInt(hash), obj->GetHash());
@@ -83,7 +82,7 @@ TEST(AddHashCodeToFastObjectWithPropertiesArray) {
CHECK(obj->HasFastProperties());
int hash = AddToSetAndGetHash(isolate, obj, true);
- CheckFastObject(isolate, obj, hash);
+ CheckFastObject(obj, hash);
}
TEST(AddHashCodeToSlowObject) {
@@ -99,7 +98,7 @@ TEST(AddHashCodeToSlowObject) {
CHECK(obj->raw_properties_or_hash()->IsDictionary());
int hash = AddToSetAndGetHash(isolate, obj, false);
- CheckDictionaryObject(isolate, obj, hash);
+ CheckDictionaryObject(obj, hash);
}
TEST(TransitionFastWithInObjectToFastWithPropertyArray) {
@@ -121,7 +120,7 @@ TEST(TransitionFastWithInObjectToFastWithPropertyArray) {
int length = obj->property_array()->length();
CompileRun("x.e = 5;");
CHECK(obj->property_array()->length() > length);
- CheckFastObject(isolate, obj, hash);
+ CheckFastObject(obj, hash);
}
TEST(TransitionFastWithPropertyArray) {
@@ -143,7 +142,7 @@ TEST(TransitionFastWithPropertyArray) {
int length = obj->property_array()->length();
CompileRun("x.f = 2; x.g = 5; x.h = 2");
CHECK(obj->property_array()->length() > length);
- CheckFastObject(isolate, obj, hash);
+ CheckFastObject(obj, hash);
}
TEST(TransitionFastWithPropertyArrayToSlow) {
@@ -165,7 +164,7 @@ TEST(TransitionFastWithPropertyArrayToSlow) {
JSObject::NormalizeProperties(obj, KEEP_INOBJECT_PROPERTIES, 0,
"cctest/test-hashcode");
- CheckDictionaryObject(isolate, obj, hash);
+ CheckDictionaryObject(obj, hash);
}
TEST(TransitionSlowToSlow) {
@@ -187,7 +186,7 @@ TEST(TransitionSlowToSlow) {
int length = obj->property_dictionary()->length();
CompileRun("for(var i = 0; i < 10; i++) { x['f'+i] = i };");
CHECK(obj->property_dictionary()->length() > length);
- CheckDictionaryObject(isolate, obj, hash);
+ CheckDictionaryObject(obj, hash);
}
TEST(TransitionSlowToFastWithoutProperties) {
@@ -225,7 +224,7 @@ TEST(TransitionSlowToFastWithPropertyArray) {
CHECK_EQ(hash, obj->property_dictionary()->Hash());
JSObject::MigrateSlowToFast(obj, 0, "cctest/test-hashcode");
- CheckFastObject(isolate, obj, hash);
+ CheckFastObject(obj, hash);
}
} // namespace internal
diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc
index 18203c7725..5d8094d635 100644
--- a/deps/v8/test/cctest/test-heap-profiler.cc
+++ b/deps/v8/test/cctest/test-heap-profiler.cc
@@ -34,7 +34,7 @@
#include "src/v8.h"
#include "include/v8-profiler.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/assembler-inl.h"
#include "src/base/hashmap.h"
#include "src/collector.h"
@@ -49,7 +49,9 @@ using i::AllocationTraceNode;
using i::AllocationTraceTree;
using i::AllocationTracker;
using i::ArrayVector;
+using i::SourceLocation;
using i::Vector;
+using v8::base::Optional;
namespace {
@@ -151,6 +153,23 @@ static const v8::HeapGraphNode* GetRootChild(const v8::HeapSnapshot* snapshot,
return GetChildByName(snapshot->GetRoot(), name);
}
+static Optional<SourceLocation> GetLocation(const v8::HeapSnapshot* s,
+ const v8::HeapGraphNode* node) {
+ const i::HeapSnapshot* snapshot = reinterpret_cast<const i::HeapSnapshot*>(s);
+ const std::vector<SourceLocation>& locations = snapshot->locations();
+ const int index =
+ const_cast<i::HeapEntry*>(reinterpret_cast<const i::HeapEntry*>(node))
+ ->index();
+
+ for (const auto& loc : locations) {
+ if (loc.entry_index == index) {
+ return Optional<SourceLocation>(loc);
+ }
+ }
+
+ return Optional<SourceLocation>();
+}
+
static const v8::HeapGraphNode* GetProperty(v8::Isolate* isolate,
const v8::HeapGraphNode* node,
v8::HeapGraphEdge::Type type,
@@ -258,6 +277,49 @@ TEST(HeapSnapshot) {
CHECK(det.has_C2);
}
+TEST(HeapSnapshotLocations) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+ v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler();
+
+ CompileRun(
+ "function X(a) { return function() { return a; } }\n"
+ "function* getid() { yield 1; }\n"
+ "class A {}\n"
+ "var x = X(1);\n"
+ "var g = getid();\n"
+ "var o = new A();");
+ const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot();
+ CHECK(ValidateSnapshot(snapshot));
+
+ const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
+ const v8::HeapGraphNode* x =
+ GetProperty(env->GetIsolate(), global, v8::HeapGraphEdge::kProperty, "x");
+ CHECK(x);
+
+ Optional<SourceLocation> x_loc = GetLocation(snapshot, x);
+ CHECK(x_loc);
+ CHECK_EQ(0, x_loc->line);
+ CHECK_EQ(31, x_loc->col);
+
+ const v8::HeapGraphNode* g =
+ GetProperty(env->GetIsolate(), global, v8::HeapGraphEdge::kProperty, "g");
+ CHECK(x);
+
+ Optional<SourceLocation> g_loc = GetLocation(snapshot, g);
+ CHECK(g_loc);
+ CHECK_EQ(1, g_loc->line);
+ CHECK_EQ(15, g_loc->col);
+
+ const v8::HeapGraphNode* o =
+ GetProperty(env->GetIsolate(), global, v8::HeapGraphEdge::kProperty, "o");
+ CHECK(x);
+
+ Optional<SourceLocation> o_loc = GetLocation(snapshot, o);
+ CHECK(o_loc);
+ CHECK_EQ(2, o_loc->line);
+ CHECK_EQ(0, o_loc->col);
+}
TEST(HeapSnapshotObjectSizes) {
LocalContext env;
@@ -1045,6 +1107,7 @@ TEST(HeapSnapshotJSONSerialization) {
CHECK(parsed_snapshot->Has(env.local(), v8_str("snapshot")).FromJust());
CHECK(parsed_snapshot->Has(env.local(), v8_str("nodes")).FromJust());
CHECK(parsed_snapshot->Has(env.local(), v8_str("edges")).FromJust());
+ CHECK(parsed_snapshot->Has(env.local(), v8_str("locations")).FromJust());
CHECK(parsed_snapshot->Has(env.local(), v8_str("strings")).FromJust());
// Get node and edge "member" offsets.
@@ -1869,6 +1932,63 @@ static int StringCmp(const char* ref, i::String* act) {
return result;
}
+TEST(GetConstructor) {
+ LocalContext env;
+ v8::HandleScope scope(env->GetIsolate());
+
+ CompileRun(
+ "function Constructor1() {};\n"
+ "var obj1 = new Constructor1();\n"
+ "var Constructor2 = function() {};\n"
+ "var obj2 = new Constructor2();\n"
+ "var obj3 = {};\n"
+ "obj3.__proto__ = { constructor: function Constructor3() {} };\n"
+ "var obj4 = {};\n"
+ "// Slow properties\n"
+ "for (var i=0; i<2000; ++i) obj4[\"p\" + i] = i;\n"
+ "obj4.__proto__ = { constructor: function Constructor4() {} };\n"
+ "var obj5 = {};\n"
+ "var obj6 = {};\n"
+ "obj6.constructor = 6;");
+ v8::Local<v8::Object> js_global =
+ env->Global()->GetPrototype().As<v8::Object>();
+ v8::Local<v8::Object> obj1 = js_global->Get(env.local(), v8_str("obj1"))
+ .ToLocalChecked()
+ .As<v8::Object>();
+ i::Handle<i::JSObject> js_obj1 =
+ i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj1));
+ CHECK(i::V8HeapExplorer::GetConstructor(*js_obj1));
+ v8::Local<v8::Object> obj2 = js_global->Get(env.local(), v8_str("obj2"))
+ .ToLocalChecked()
+ .As<v8::Object>();
+ i::Handle<i::JSObject> js_obj2 =
+ i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj2));
+ CHECK(i::V8HeapExplorer::GetConstructor(*js_obj2));
+ v8::Local<v8::Object> obj3 = js_global->Get(env.local(), v8_str("obj3"))
+ .ToLocalChecked()
+ .As<v8::Object>();
+ i::Handle<i::JSObject> js_obj3 =
+ i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj3));
+ CHECK(i::V8HeapExplorer::GetConstructor(*js_obj3));
+ v8::Local<v8::Object> obj4 = js_global->Get(env.local(), v8_str("obj4"))
+ .ToLocalChecked()
+ .As<v8::Object>();
+ i::Handle<i::JSObject> js_obj4 =
+ i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj4));
+ CHECK(i::V8HeapExplorer::GetConstructor(*js_obj4));
+ v8::Local<v8::Object> obj5 = js_global->Get(env.local(), v8_str("obj5"))
+ .ToLocalChecked()
+ .As<v8::Object>();
+ i::Handle<i::JSObject> js_obj5 =
+ i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj5));
+ CHECK(!i::V8HeapExplorer::GetConstructor(*js_obj5));
+ v8::Local<v8::Object> obj6 = js_global->Get(env.local(), v8_str("obj6"))
+ .ToLocalChecked()
+ .As<v8::Object>();
+ i::Handle<i::JSObject> js_obj6 =
+ i::Handle<i::JSObject>::cast(v8::Utils::OpenHandle(*obj6));
+ CHECK(!i::V8HeapExplorer::GetConstructor(*js_obj6));
+}
TEST(GetConstructorName) {
LocalContext env;
@@ -2134,6 +2254,35 @@ TEST(AccessorInfo) {
CHECK(setter);
}
+TEST(JSGeneratorObject) {
+ v8::Isolate* isolate = CcTest::isolate();
+ LocalContext env;
+ v8::HandleScope scope(isolate);
+ v8::HeapProfiler* heap_profiler = isolate->GetHeapProfiler();
+
+ CompileRun(
+ "function* foo() { yield 1; }\n"
+ "g = foo();\n");
+ const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot();
+ CHECK(ValidateSnapshot(snapshot));
+ const v8::HeapGraphNode* global = GetGlobalObject(snapshot);
+ const v8::HeapGraphNode* g =
+ GetProperty(isolate, global, v8::HeapGraphEdge::kProperty, "g");
+ CHECK(g);
+ const v8::HeapGraphNode* function = GetProperty(
+ env->GetIsolate(), g, v8::HeapGraphEdge::kInternal, "function");
+ CHECK(function);
+ const v8::HeapGraphNode* context = GetProperty(
+ env->GetIsolate(), g, v8::HeapGraphEdge::kInternal, "context");
+ CHECK(context);
+ const v8::HeapGraphNode* receiver = GetProperty(
+ env->GetIsolate(), g, v8::HeapGraphEdge::kInternal, "receiver");
+ CHECK(receiver);
+ const v8::HeapGraphNode* parameters_and_registers =
+ GetProperty(env->GetIsolate(), g, v8::HeapGraphEdge::kInternal,
+ "parameters_and_registers");
+ CHECK(parameters_and_registers);
+}
bool HasWeakEdge(const v8::HeapGraphNode* node) {
for (int i = 0; i < node->GetChildrenCount(); ++i) {
@@ -3436,12 +3585,18 @@ TEST(SamplingHeapProfilerRateAgnosticEstimates) {
// what we expect in this test.
v8::internal::FLAG_always_opt = false;
+ // Disable compilation cache to force compilation in both cases
+ v8::internal::FLAG_compilation_cache = false;
+
// Suppress randomness to avoid flakiness in tests.
v8::internal::FLAG_sampling_heap_profiler_suppress_randomness = true;
// stress_incremental_marking adds randomness to the test.
v8::internal::FLAG_stress_incremental_marking = false;
+ // warmup compilation
+ CompileRun(simple_sampling_heap_profiler_script);
+
int count_1024 = 0;
{
heap_profiler->StartSamplingHeapProfiler(1024);
diff --git a/deps/v8/test/cctest/test-inobject-slack-tracking.cc b/deps/v8/test/cctest/test-inobject-slack-tracking.cc
index 9ebe67cab4..0e850b1682 100644
--- a/deps/v8/test/cctest/test-inobject-slack-tracking.cc
+++ b/deps/v8/test/cctest/test-inobject-slack-tracking.cc
@@ -6,7 +6,7 @@
#include <sstream>
#include <utility>
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/objects-inl.h"
#include "src/objects.h"
#include "src/v8.h"
@@ -1148,7 +1148,7 @@ TEST(SubclassTypedArrayBuiltin) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
-#define TYPED_ARRAY_TEST(Type, type, TYPE, elementType, size) \
+#define TYPED_ARRAY_TEST(Type, type, TYPE, elementType) \
TestSubclassBuiltin("A" #Type, JS_TYPED_ARRAY_TYPE, #Type "Array", "42");
TYPED_ARRAYS(TYPED_ARRAY_TEST)
diff --git a/deps/v8/test/cctest/test-isolate-independent-builtins.cc b/deps/v8/test/cctest/test-isolate-independent-builtins.cc
index c878484976..4b4babdb37 100644
--- a/deps/v8/test/cctest/test-isolate-independent-builtins.cc
+++ b/deps/v8/test/cctest/test-isolate-independent-builtins.cc
@@ -11,6 +11,7 @@
#include "src/simulator.h"
#include "src/snapshot/macros.h"
#include "src/snapshot/snapshot.h"
+#include "test/common/assembler-tester.h"
// To generate the binary files for the test function, enable this section and
// run GenerateTestFunctionData once on each arch.
diff --git a/deps/v8/test/cctest/test-liveedit.cc b/deps/v8/test/cctest/test-liveedit.cc
index 05044a4aa5..e2fec0a3ae 100644
--- a/deps/v8/test/cctest/test-liveedit.cc
+++ b/deps/v8/test/cctest/test-liveedit.cc
@@ -29,7 +29,7 @@
#include "src/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/debug/liveedit.h"
#include "src/objects-inl.h"
#include "test/cctest/cctest.h"
@@ -248,14 +248,16 @@ TEST(LiveEditPatchFunctions) {
PatchFunctions(context, "function foo() { return 1; }",
"function foo() { return 42; }");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "foo()")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
42);
// It is expected, we do not reevaluate top level function.
PatchFunctions(context, "var a = 1; function foo() { return a; }",
"var a = 3; function foo() { return a; }");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "foo()")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
1);
// Throw exception since var b is not defined in original source.
@@ -270,14 +272,16 @@ TEST(LiveEditPatchFunctions) {
PatchFunctions(context, "var a = 1; function foo() { return a; }",
"var b = 4; function foo() { var b = 5; return b; }");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "foo()")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
5);
PatchFunctions(context, "var a = 1; function foo() { return a; }",
"var b = 4; function foo() { var a = 6; return a; }");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "foo()")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
6);
@@ -292,7 +296,8 @@ TEST(LiveEditPatchFunctions) {
PatchFunctions(context, "var a = 1; function foo() { return a; }",
"var b = 1; var a = 2; function foo() { return a; }");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "foo()")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
1);
@@ -307,14 +312,16 @@ TEST(LiveEditPatchFunctions) {
PatchFunctions(context, "function foo() { var a = 1; return a; }",
"function foo() { var b = 1; return b; }");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "foo()")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
1);
PatchFunctions(context, "var a = 3; function foo() { var a = 1; return a; }",
"function foo() { var b = 1; return a; }");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "foo()")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
3);
@@ -330,14 +337,16 @@ TEST(LiveEditPatchFunctions) {
PatchFunctions(context, "function fooArgs(a1, b1) { return a1 + b1; }",
"function fooArgs(a2, b2, c2) { return a2 + b2 + c2; }");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "fooArgs(1,2,3)")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
6);
PatchFunctions(context, "function fooArgs(a1, b1) { return a1 + b1; }",
"function fooArgs(a1, b1, c1) { return a1 + b1 + c1; }");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "fooArgs(1,2,3)")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
6);
@@ -347,7 +356,8 @@ TEST(LiveEditPatchFunctions) {
"%OptimizeFunctionOnNextCall(foo); foo(1,2);",
"function foo(a, b) { return a * b; };");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "foo(5,7)")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
35);
i::FLAG_allow_natives_syntax = false;
@@ -359,7 +369,8 @@ TEST(LiveEditPatchFunctions) {
"function foo(a,b) { function op(a,b) { return a * b } return op(a,b); "
"}");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "foo(8,9)")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
72);
@@ -368,7 +379,8 @@ TEST(LiveEditPatchFunctions) {
"class Foo { constructor(a,b) { this.data = a + b; } };",
"class Foo { constructor(a,b) { this.data = a * b; } };");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "new Foo(4,5).data")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
20);
// Change inner functions.
@@ -379,7 +391,8 @@ TEST(LiveEditPatchFunctions) {
"function f(evt) { function f2() { return 1; } return f2() + f3(); "
"function f3() { return 2; } } function f4() {}");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "f()")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
3);
// Change usage of outer scope.
@@ -424,21 +437,24 @@ TEST(LiveEditPatchFunctions) {
// TODO(kozyatinskiy): should work when we remove (.
PatchFunctions(context, "f = () => 2", "f = a => a");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "f(3)")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
2);
// Replace function with not a function.
PatchFunctions(context, "f = () => 2", "f = a == 2");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "f(3)")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
2);
// TODO(kozyatinskiy): should work when we put function into (...).
PatchFunctions(context, "f = a => 2", "f = (a => 5)()");
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "f()")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
2);
@@ -457,11 +473,13 @@ TEST(LiveEditPatchFunctions) {
"f()\n");
// TODO(kozyatinskiy): ditto.
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "f2()")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
5);
CHECK_EQ(CompileRunChecked(env->GetIsolate(), "f()")
- ->ToInt32(env->GetIsolate())
+ ->ToInt32(context)
+ .ToLocalChecked()
->Value(),
3);
}
diff --git a/deps/v8/test/cctest/test-lockers.cc b/deps/v8/test/cctest/test-lockers.cc
index ebfbe88de2..dec279e781 100644
--- a/deps/v8/test/cctest/test-lockers.cc
+++ b/deps/v8/test/cctest/test-lockers.cc
@@ -31,7 +31,6 @@
#include "src/v8.h"
-#include "src/api.h"
#include "src/base/platform/platform.h"
#include "src/compilation-cache.h"
#include "src/execution.h"
diff --git a/deps/v8/test/cctest/test-log-stack-tracer.cc b/deps/v8/test/cctest/test-log-stack-tracer.cc
index 8a09a17684..ea51a168d7 100644
--- a/deps/v8/test/cctest/test-log-stack-tracer.cc
+++ b/deps/v8/test/cctest/test-log-stack-tracer.cc
@@ -30,7 +30,7 @@
#include <stdlib.h>
#include "include/v8-profiler.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/code-stubs.h"
#include "src/disassembler.h"
#include "src/isolate.h"
diff --git a/deps/v8/test/cctest/test-log.cc b/deps/v8/test/cctest/test-log.cc
index 1dfa22b4cc..9ac73af3e5 100644
--- a/deps/v8/test/cctest/test-log.cc
+++ b/deps/v8/test/cctest/test-log.cc
@@ -27,27 +27,16 @@
//
// Tests of logging functions from log.h
-#ifdef __linux__
-#include <pthread.h>
-#include <signal.h>
-#include <unistd.h>
-#include <cmath>
-#endif // __linux__
-
#include <unordered_set>
#include <vector>
-// The C++ style guide recommends using <re2> instead of <regex>. However, the
-// former isn't available in V8.
-#include <regex> // NOLINT(build/c++11)
-#include "src/api.h"
+#include "src/api-inl.h"
+#include "src/builtins/builtins.h"
#include "src/log-utils.h"
#include "src/log.h"
#include "src/objects-inl.h"
#include "src/profiler/cpu-profiler.h"
#include "src/snapshot/natives.h"
-#include "src/utils.h"
#include "src/v8.h"
-#include "src/v8threads.h"
#include "src/version.h"
#include "src/vm-state-inl.h"
#include "test/cctest/cctest.h"
@@ -68,35 +57,14 @@ namespace {
i::FLAG_logfile = i::Log::kLogToTemporaryFile; \
i::FLAG_logfile_per_isolate = false
-static const char* StrNStr(const char* s1, const char* s2, size_t n) {
- CHECK_EQ(s1[n], '\0');
- return strstr(s1, s2);
-}
-
-// Look for a log line which starts with {prefix} and ends with {suffix}.
-static const char* FindLogLine(const char* start, const char* end,
- const char* prefix,
- const char* suffix = nullptr) {
- CHECK_LT(start, end);
- CHECK_EQ(end[0], '\0');
- size_t prefixLength = strlen(prefix);
- // Loop through the input until we find /{prefix}[^\n]+{suffix}/.
- while (start < end) {
- const char* prefixResult = strstr(start, prefix);
- if (!prefixResult) return NULL;
- if (suffix == nullptr) return prefixResult;
- const char* suffixResult =
- StrNStr(prefixResult, suffix, (end - prefixResult));
- if (!suffixResult) return NULL;
- // Check that there are no newlines in between the {prefix} and the {suffix}
- // results.
- const char* newlineResult =
- StrNStr(prefixResult, "\n", (end - prefixResult));
- if (!newlineResult) return prefixResult;
- if (newlineResult > suffixResult) return prefixResult;
- start = prefixResult + prefixLength;
+static std::vector<std::string> Split(const std::string& s, char delimiter) {
+ std::vector<std::string> result;
+ std::string line;
+ std::istringstream stream(s);
+ while (std::getline(stream, line, delimiter)) {
+ result.push_back(line);
}
- return NULL;
+ return result;
}
class ScopedLoggerInitializer {
@@ -119,7 +87,6 @@ class ScopedLoggerInitializer {
if (temp_file_ != nullptr) fclose(temp_file_);
i::FLAG_prof = saved_prof_;
i::FLAG_log = saved_log_;
- log_.Dispose();
}
v8::Local<v8::Context>& env() { return env_; }
@@ -130,116 +97,81 @@ class ScopedLoggerInitializer {
Logger* logger() { return logger_; }
- void PrintLog(int requested_nof_lines = 0, const char* start = nullptr) {
- if (requested_nof_lines <= 0) {
- printf("%s", log_.start());
- return;
- }
- // Try to print the last {requested_nof_lines} of the log.
- if (start == nullptr) start = log_.start();
- const char* current = log_.end();
- int nof_lines = requested_nof_lines;
- while (current > start && nof_lines > 0) {
- current--;
- if (*current == '\n') nof_lines--;
- }
- printf(
- "======================================================\n"
- "Last %i log lines:\n"
- "======================================================\n"
- "...\n%s\n"
- "======================================================\n",
- requested_nof_lines, current);
- }
-
v8::Local<v8::String> GetLogString() {
- return v8::String::NewFromUtf8(isolate_, log_.start(),
- v8::NewStringType::kNormal, log_.length())
+ int length = static_cast<int>(raw_log_.size());
+ return v8::String::NewFromUtf8(isolate_, raw_log_.c_str(),
+ v8::NewStringType::kNormal, length)
.ToLocalChecked();
}
void StopLogging() {
bool exists = false;
- log_ = i::ReadFile(StopLoggingGetTempFile(), &exists, true);
+ raw_log_ = i::ReadFile(StopLoggingGetTempFile(), &exists, true);
+ log_ = Split(raw_log_, '\n');
CHECK(exists);
}
- const char* GetEndPosition() { return log_.start() + log_.length(); }
+ // Searches |log_| for a line which contains all the strings in |search_terms|
+ // as substrings, starting from the index |start|, and returns the index of
+ // the found line. Returns std::string::npos if no line is found.
+ size_t IndexOfLine(const std::vector<std::string>& search_terms,
+ size_t start = 0) {
+ for (size_t i = start; i < log_.size(); ++i) {
+ const std::string& line = log_.at(i);
+ bool all_terms_found = true;
+ for (const std::string& term : search_terms) {
+ all_terms_found &= line.find(term) != std::string::npos;
+ }
+ if (all_terms_found) return i;
+ }
+ return std::string::npos;
+ }
- const char* FindLine(const char* prefix, const char* suffix = nullptr,
- const char* start = nullptr) {
- // Make sure that StopLogging() has been called before.
- CHECK(log_.size());
- if (start == nullptr) start = log_.start();
- const char* end = GetEndPosition();
- return FindLogLine(start, end, prefix, suffix);
+ bool ContainsLine(const std::vector<std::string>& search_terms,
+ size_t start = 0) {
+ return IndexOfLine(search_terms, start) != std::string::npos;
}
- // Find all log lines specified by the {prefix, suffix} pairs and ensure they
- // occurr in the specified order.
- void FindLogLines(const char* pairs[][2], size_t limit,
- const char* start = nullptr) {
- const char* prefix = pairs[0][0];
- const char* suffix = pairs[0][1];
- const char* last_position = FindLine(prefix, suffix, start);
- if (last_position == nullptr) {
- PrintLog(100, start);
- V8_Fatal(__FILE__, __LINE__, "Could not find log line: %s ... %s", prefix,
- suffix);
+ // Calls IndexOfLine for each set of substring terms in
+ // |all_line_search_terms|, in order. Returns true if they're all found.
+ bool ContainsLinesInOrder(
+ const std::vector<std::vector<std::string>>& all_line_search_terms,
+ size_t start = 0) {
+ CHECK_GT(log_.size(), 0);
+ for (auto& search_terms : all_line_search_terms) {
+ start = IndexOfLine(search_terms, start);
+ if (start == std::string::npos) return false;
+ ++start; // Skip the found line.
}
- CHECK(last_position);
- for (size_t i = 1; i < limit; i++) {
- prefix = pairs[i][0];
- suffix = pairs[i][1];
- const char* position = FindLine(prefix, suffix, start);
- if (position == nullptr) {
- PrintLog(100, start);
- V8_Fatal(__FILE__, __LINE__, "Could not find log line: %s ... %s",
- prefix, suffix);
- }
- // Check that all string positions are in order.
- if (position <= last_position) {
- PrintLog(100, start);
- V8_Fatal(__FILE__, __LINE__,
- "Log statements not in expected order (prev=%p, current=%p): "
- "%s ... %s",
- reinterpret_cast<const void*>(last_position),
- reinterpret_cast<const void*>(position), prefix, suffix);
- }
- last_position = position;
+ return true;
+ }
+
+ std::unordered_set<uintptr_t> ExtractAllAddresses(std::string search_term,
+ size_t address_column) {
+ CHECK_GT(log_.size(), 0);
+ std::unordered_set<uintptr_t> result;
+ size_t start = 0;
+ while (true) {
+ start = IndexOfLine({search_term}, start);
+ if (start == std::string::npos) break;
+ std::vector<std::string> columns = Split(log_.at(start), ',');
+ CHECK_LT(address_column, columns.size());
+ uintptr_t address =
+ strtoll(columns.at(address_column).c_str(), nullptr, 16);
+ CHECK_GT(address, 0);
+ result.insert(address);
+ ++start; // Skip the found line.
}
+ return result;
}
+ void LogCodeObjects() { logger_->LogCodeObjects(); }
void LogCompiledFunctions() { logger_->LogCompiledFunctions(); }
void StringEvent(const char* name, const char* value) {
logger_->StringEvent(name, value);
}
- void ExtractAllAddresses(std::unordered_set<uintptr_t>* map,
- const char* prefix, int field_index) {
- // Make sure that StopLogging() has been called before.
- CHECK(log_.size());
- const char* current = log_.start();
- while (current != nullptr) {
- current = FindLine(prefix, nullptr, current);
- if (current == nullptr) return;
- // Find token number {index}.
- const char* previous;
- for (int i = 0; i <= field_index; i++) {
- previous = current;
- current = strchr(current + 1, ',');
- if (current == nullptr) break;
- // Skip the comma.
- current++;
- }
- if (current == nullptr) break;
- uintptr_t address = strtoll(previous, nullptr, 16);
- CHECK_LT(0, address);
- map->insert(address);
- }
- }
-
private:
FILE* StopLoggingGetTempFile() {
temp_file_ = logger_->TearDown();
@@ -257,7 +189,9 @@ class ScopedLoggerInitializer {
v8::HandleScope scope_;
v8::Local<v8::Context> env_;
Logger* logger_;
- i::Vector<const char> log_;
+
+ std::string raw_log_;
+ std::vector<std::string> log_;
DISALLOW_COPY_AND_ASSIGN(ScopedLoggerInitializer);
};
@@ -268,15 +202,20 @@ class TestCodeEventHandler : public v8::CodeEventHandler {
: v8::CodeEventHandler(isolate), isolate_(isolate) {}
size_t CountLines(std::string prefix, std::string suffix = std::string()) {
- if (!log_.length()) return 0;
-
- std::regex expression("(^|\\n)" + prefix + ".*" + suffix + "(?=\\n|$)");
-
- size_t match_count(std::distance(
- std::sregex_iterator(log_.begin(), log_.end(), expression),
- std::sregex_iterator()));
+ if (event_log_.empty()) return 0;
+
+ size_t match = 0;
+ for (const std::string& line : event_log_) {
+ size_t prefix_pos = line.find(prefix);
+ if (prefix_pos == std::string::npos) continue;
+ size_t suffix_pos = line.rfind(suffix);
+ if (suffix_pos == std::string::npos) continue;
+ if (suffix_pos != line.length() - suffix.length()) continue;
+ if (prefix_pos >= suffix_pos) continue;
+ match++;
+ }
- return match_count;
+ return match;
}
void Handle(v8::CodeEvent* code_event) override {
@@ -284,8 +223,7 @@ class TestCodeEventHandler : public v8::CodeEventHandler {
log_line += v8::CodeEvent::GetCodeEventTypeName(code_event->GetCodeType());
log_line += " ";
log_line += FormatName(code_event);
- log_line += "\n";
- log_ += log_line;
+ event_log_.push_back(log_line);
}
private:
@@ -294,7 +232,7 @@ class TestCodeEventHandler : public v8::CodeEventHandler {
if (name.empty()) {
v8::Local<v8::String> functionName = code_event->GetFunctionName();
std::string buffer(functionName->Utf8Length(isolate_) + 1, 0);
- functionName->WriteUtf8(&buffer[0],
+ functionName->WriteUtf8(isolate_, &buffer[0],
functionName->Utf8Length(isolate_) + 1);
// Sanitize name, removing unwanted \0 resulted from WriteUtf8
name = std::string(buffer.c_str());
@@ -303,195 +241,12 @@ class TestCodeEventHandler : public v8::CodeEventHandler {
return name;
}
- std::string log_;
+ std::vector<std::string> event_log_;
v8::Isolate* isolate_;
};
} // namespace
-TEST(FindLogLine) {
- const char* string =
- "prefix1, stuff, suffix1\n"
- "prefix2, stuff\n, suffix2\n"
- "prefix3suffix3\n"
- "prefix4 suffix4";
- const char* end = string + strlen(string);
- // Make sure the vector contains the terminating \0 character.
- CHECK(FindLogLine(string, end, "prefix1, stuff, suffix1"));
- CHECK(FindLogLine(string, end, "prefix1, stuff"));
- CHECK(FindLogLine(string, end, "prefix1"));
- CHECK(FindLogLine(string, end, "prefix1", "suffix1"));
- CHECK(FindLogLine(string, end, "prefix1", "suffix1"));
- CHECK(!FindLogLine(string, end, "prefix2", "suffix2"));
- CHECK(!FindLogLine(string, end, "prefix1", "suffix2"));
- CHECK(!FindLogLine(string, end, "prefix1", "suffix3"));
- CHECK(FindLogLine(string, end, "prefix3", "suffix3"));
- CHECK(FindLogLine(string, end, "prefix4", "suffix4"));
- CHECK(!FindLogLine(string, end, "prefix4", "suffix4XXXXXXXXXXXX"));
- CHECK(
- !FindLogLine(string, end, "prefix4XXXXXXXXXXXXXXXXXXXXXXxxx", "suffix4"));
- CHECK(!FindLogLine(string, end, "suffix", "suffix5XXXXXXXXXXXXXXXXXXXX"));
-}
-
-// BUG(913). Need to implement support for profiling multiple VM threads.
-#if 0
-
-namespace {
-
-class LoopingThread : public v8::internal::Thread {
- public:
- explicit LoopingThread(v8::internal::Isolate* isolate)
- : v8::internal::Thread(isolate),
- semaphore_(new v8::internal::Semaphore(0)),
- run_(true) {
- }
-
- virtual ~LoopingThread() { delete semaphore_; }
-
- void Run() {
- self_ = pthread_self();
- RunLoop();
- }
-
- void SendSigProf() { pthread_kill(self_, SIGPROF); }
-
- void Stop() { run_ = false; }
-
- bool WaitForRunning() { return semaphore_->Wait(1000000); }
-
- protected:
- bool IsRunning() { return run_; }
-
- virtual void RunLoop() = 0;
-
- void SetV8ThreadId() {
- v8_thread_id_ = v8::V8::GetCurrentThreadId();
- }
-
- void SignalRunning() { semaphore_->Signal(); }
-
- private:
- v8::internal::Semaphore* semaphore_;
- bool run_;
- pthread_t self_;
- int v8_thread_id_;
-};
-
-
-class LoopingJsThread : public LoopingThread {
- public:
- explicit LoopingJsThread(v8::internal::Isolate* isolate)
- : LoopingThread(isolate) { }
- void RunLoop() {
- v8::Locker locker;
- CHECK_NOT_NULL(CcTest::i_isolate());
- CHECK_GT(CcTest::i_isolate()->thread_manager()->CurrentId(), 0);
- SetV8ThreadId();
- while (IsRunning()) {
- v8::HandleScope scope;
- v8::Persistent<v8::Context> context = v8::Context::New();
- CHECK(!context.IsEmpty());
- {
- v8::Context::Scope context_scope(context);
- SignalRunning();
- CompileRun(
- "var j; for (var i=0; i<10000; ++i) { j = Math.sin(i); }");
- }
- context.Dispose();
- i::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(1));
- }
- }
-};
-
-
-class LoopingNonJsThread : public LoopingThread {
- public:
- explicit LoopingNonJsThread(v8::internal::Isolate* isolate)
- : LoopingThread(isolate) { }
- void RunLoop() {
- v8::Locker locker;
- v8::Unlocker unlocker;
- // Now thread has V8's id, but will not run VM code.
- CHECK_NOT_NULL(CcTest::i_isolate());
- CHECK_GT(CcTest::i_isolate()->thread_manager()->CurrentId(), 0);
- double i = 10;
- SignalRunning();
- while (IsRunning()) {
- i = std::sin(i);
- i::OS::Sleep(v8::base::TimeDelta::FromMilliseconds(1));
- }
- }
-};
-
-
-class TestSampler : public v8::internal::Sampler {
- public:
- explicit TestSampler(v8::internal::Isolate* isolate)
- : Sampler(isolate, 0, true, true),
- semaphore_(new v8::internal::Semaphore(0)),
- was_sample_stack_called_(false) {
- }
-
- ~TestSampler() { delete semaphore_; }
-
- void SampleStack(v8::internal::TickSample*) {
- was_sample_stack_called_ = true;
- }
-
- void Tick(v8::internal::TickSample*) { semaphore_->Signal(); }
-
- bool WaitForTick() { return semaphore_->Wait(1000000); }
-
- void Reset() { was_sample_stack_called_ = false; }
-
- bool WasSampleStackCalled() { return was_sample_stack_called_; }
-
- private:
- v8::internal::Semaphore* semaphore_;
- bool was_sample_stack_called_;
-};
-
-
-} // namespace
-
-TEST(ProfMultipleThreads) {
- TestSampler* sampler = nullptr;
- {
- v8::Locker locker;
- sampler = new TestSampler(CcTest::i_isolate());
- sampler->Start();
- CHECK(sampler->IsActive());
- }
-
- LoopingJsThread jsThread(CcTest::i_isolate());
- jsThread.Start();
- LoopingNonJsThread nonJsThread(CcTest::i_isolate());
- nonJsThread.Start();
-
- CHECK(!sampler->WasSampleStackCalled());
- jsThread.WaitForRunning();
- jsThread.SendSigProf();
- CHECK(sampler->WaitForTick());
- CHECK(sampler->WasSampleStackCalled());
- sampler->Reset();
- CHECK(!sampler->WasSampleStackCalled());
- nonJsThread.WaitForRunning();
- nonJsThread.SendSigProf();
- CHECK(!sampler->WaitForTick());
- CHECK(!sampler->WasSampleStackCalled());
- sampler->Stop();
-
- jsThread.Stop();
- nonJsThread.Stop();
- jsThread.Join();
- nonJsThread.Join();
-
- delete sampler;
-}
-
-#endif // __linux__
-
-
// Test for issue http://crbug.com/23768 in Chromium.
// Heap can contain scripts with already disposed external sources.
// We need to verify that LogCompiledFunctions doesn't crash on them.
@@ -535,17 +290,15 @@ TEST(Issue23768) {
CcTest::i_isolate());
// This situation can happen if source was an external string disposed
// by its owner.
- i_source->set_resource(nullptr);
+ i_source->SetResource(CcTest::i_isolate(), nullptr);
// Must not crash.
CcTest::i_isolate()->logger()->LogCompiledFunctions();
}
-
static void ObjMethod1(const v8::FunctionCallbackInfo<v8::Value>& args) {
}
-
TEST(LogCallbacks) {
SETUP_FLAGS();
v8::Isolate::CreateParams create_params;
@@ -572,21 +325,20 @@ TEST(LogCallbacks) {
CompileRun("Obj.prototype.method1.toString();");
logger.LogCompiledFunctions();
-
logger.StopLogging();
Address ObjMethod1_entry = reinterpret_cast<Address>(ObjMethod1);
#if USES_FUNCTION_DESCRIPTORS
ObjMethod1_entry = *FUNCTION_ENTRYPOINT_ADDRESS(ObjMethod1_entry);
#endif
- i::EmbeddedVector<char, 100> ref_data;
- i::SNPrintF(ref_data, ",0x%" V8PRIxPTR ",1,method1", ObjMethod1_entry);
- CHECK(logger.FindLine("code-creation,Callback,-2,", ref_data.start()));
+ i::EmbeddedVector<char, 100> suffix_buffer;
+ i::SNPrintF(suffix_buffer, ",0x%" V8PRIxPTR ",1,method1", ObjMethod1_entry);
+ CHECK(logger.ContainsLine(
+ {"code-creation,Callback,-2,", std::string(suffix_buffer.start())}));
}
isolate->Dispose();
}
-
static void Prop1Getter(v8::Local<v8::String> property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
}
@@ -600,7 +352,6 @@ static void Prop2Getter(v8::Local<v8::String> property,
const v8::PropertyCallbackInfo<v8::Value>& info) {
}
-
TEST(LogAccessorCallbacks) {
SETUP_FLAGS();
v8::Isolate::CreateParams create_params;
@@ -627,8 +378,8 @@ TEST(LogAccessorCallbacks) {
EmbeddedVector<char, 100> prop1_getter_record;
i::SNPrintF(prop1_getter_record, ",0x%" V8PRIxPTR ",1,get prop1",
Prop1Getter_entry);
- CHECK(logger.FindLine("code-creation,Callback,-2,",
- prop1_getter_record.start()));
+ CHECK(logger.ContainsLine({"code-creation,Callback,-2,",
+ std::string(prop1_getter_record.start())}));
Address Prop1Setter_entry = reinterpret_cast<Address>(Prop1Setter);
#if USES_FUNCTION_DESCRIPTORS
@@ -637,8 +388,8 @@ TEST(LogAccessorCallbacks) {
EmbeddedVector<char, 100> prop1_setter_record;
i::SNPrintF(prop1_setter_record, ",0x%" V8PRIxPTR ",1,set prop1",
Prop1Setter_entry);
- CHECK(logger.FindLine("code-creation,Callback,-2,",
- prop1_setter_record.start()));
+ CHECK(logger.ContainsLine({"code-creation,Callback,-2,",
+ std::string(prop1_setter_record.start())}));
Address Prop2Getter_entry = reinterpret_cast<Address>(Prop2Getter);
#if USES_FUNCTION_DESCRIPTORS
@@ -647,8 +398,8 @@ TEST(LogAccessorCallbacks) {
EmbeddedVector<char, 100> prop2_getter_record;
i::SNPrintF(prop2_getter_record, ",0x%" V8PRIxPTR ",1,get prop2",
Prop2Getter_entry);
- CHECK(logger.FindLine("code-creation,Callback,-2,",
- prop2_getter_record.start()));
+ CHECK(logger.ContainsLine({"code-creation,Callback,-2,",
+ std::string(prop2_getter_record.start())}));
}
isolate->Dispose();
}
@@ -716,7 +467,7 @@ TEST(EquivalenceOfLoggingAndTraversal) {
v8::Local<v8::String> s = result->ToString(logger.env()).ToLocalChecked();
i::ScopedVector<char> data(s->Utf8Length(isolate) + 1);
CHECK(data.start());
- s->WriteUtf8(data.start());
+ s->WriteUtf8(isolate, data.start());
FATAL("%s\n", data.start());
}
}
@@ -733,11 +484,12 @@ TEST(LogVersion) {
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
logger.StopLogging();
- i::EmbeddedVector<char, 100> ref_data;
- i::SNPrintF(ref_data, "%d,%d,%d,%d,%d", i::Version::GetMajor(),
+ i::EmbeddedVector<char, 100> line_buffer;
+ i::SNPrintF(line_buffer, "%d,%d,%d,%d,%d", i::Version::GetMajor(),
i::Version::GetMinor(), i::Version::GetBuild(),
i::Version::GetPatch(), i::Version::IsCandidate());
- CHECK(logger.FindLine("v8-version,", ref_data.start()));
+ CHECK(
+ logger.ContainsLine({"v8-version,", std::string(line_buffer.start())}));
}
isolate->Dispose();
}
@@ -810,7 +562,6 @@ TEST(LogAll) {
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
- // Function that will
const char* source_text =
"function testAddFn(a,b) { return a + b };"
"let result;"
@@ -822,16 +573,16 @@ TEST(LogAll) {
logger.StopLogging();
// We should find at least one code-creation even for testAddFn();
- CHECK(logger.FindLine("api,v8::Context::New"));
- CHECK(logger.FindLine("timer-event-start", "V8.CompileCode"));
- CHECK(logger.FindLine("timer-event-end", "V8.CompileCode"));
- CHECK(logger.FindLine("code-creation,Script", ":1:1"));
- CHECK(logger.FindLine("api,v8::Script::Run"));
- CHECK(logger.FindLine("code-creation,LazyCompile,", "testAddFn"));
+ CHECK(logger.ContainsLine({"api,v8::Context::New"}));
+ CHECK(logger.ContainsLine({"timer-event-start", "V8.CompileCode"}));
+ CHECK(logger.ContainsLine({"timer-event-end", "V8.CompileCode"}));
+ CHECK(logger.ContainsLine({"code-creation,Script", ":1:1"}));
+ CHECK(logger.ContainsLine({"api,v8::Script::Run"}));
+ CHECK(logger.ContainsLine({"code-creation,LazyCompile,", "testAddFn"}));
if (i::FLAG_opt && !i::FLAG_always_opt) {
- CHECK(logger.FindLine("code-deopt,", "soft"));
- CHECK(logger.FindLine("timer-event-start", "V8.DeoptimizeCode"));
- CHECK(logger.FindLine("timer-event-end", "V8.DeoptimizeCode"));
+ CHECK(logger.ContainsLine({"code-deopt,", "soft"}));
+ CHECK(logger.ContainsLine({"timer-event-start", "V8.DeoptimizeCode"}));
+ CHECK(logger.ContainsLine({"timer-event-end", "V8.DeoptimizeCode"}));
}
}
isolate->Dispose();
@@ -854,8 +605,8 @@ TEST(LogInterpretedFramesNativeStack) {
logger.StopLogging();
- CHECK(logger.FindLine("InterpretedFunction",
- "testLogInterpretedFramesNativeStack"));
+ CHECK(logger.ContainsLine(
+ {"InterpretedFunction", "testLogInterpretedFramesNativeStack"}));
}
isolate->Dispose();
}
@@ -978,9 +729,9 @@ TEST(TraceMaps) {
logger.StopLogging();
// Mostly superficial checks.
- CHECK(logger.FindLine("map,InitialMap", ",0x"));
- CHECK(logger.FindLine("map,Transition", ",0x"));
- CHECK(logger.FindLine("map-details", ",0x"));
+ CHECK(logger.ContainsLine({"map,InitialMap", ",0x"}));
+ CHECK(logger.ContainsLine({"map,Transition", ",0x"}));
+ CHECK(logger.ContainsLine({"map-details", ",0x"}));
}
i::FLAG_trace_maps = false;
isolate->Dispose();
@@ -996,9 +747,8 @@ TEST(LogMaps) {
{
ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
logger.StopLogging();
- // Extract all the map-detail entry addresses from the log.
- std::unordered_set<uintptr_t> map_addresses;
- logger.ExtractAllAddresses(&map_addresses, "map-details", 2);
+ std::unordered_set<uintptr_t> map_addresses =
+ logger.ExtractAllAddresses("map-details", 2);
i::Heap* heap = reinterpret_cast<i::Isolate*>(isolate)->heap();
i::HeapIterator iterator(heap);
i::DisallowHeapAllocation no_gc;
@@ -1011,15 +761,12 @@ TEST(LogMaps) {
if (!obj->IsMap()) continue;
uintptr_t address = reinterpret_cast<uintptr_t>(obj);
if (map_addresses.find(address) != map_addresses.end()) continue;
- logger.PrintLog(200);
i::Map::cast(obj)->Print();
V8_Fatal(__FILE__, __LINE__,
"Map (%p, #%zu) was not logged during startup with --trace-maps!"
- "\n# Expected Log Line: map_details, ... %p"
- "\n# Use logger::PrintLog() for more details.",
+ "\n# Expected Log Line: map_details, ... %p",
reinterpret_cast<void*>(obj), i, reinterpret_cast<void*>(obj));
}
- logger.PrintLog(200);
}
i::FLAG_log_function_events = false;
isolate->Dispose();
@@ -1045,14 +792,12 @@ TEST(ConsoleTimeEvents) {
logger.StopLogging();
- const char* pairs[][2] = {{"timer-event-start,default,", nullptr},
- {"timer-event-end,default,", nullptr},
- {"timer-event,default,", nullptr},
- {"timer-event-start,timerEvent1,", nullptr},
- {"timer-event-end,timerEvent1,", nullptr},
- {"timer-event,timerEvent2,", nullptr},
- {"timer-event,timerEvent3,", nullptr}};
- logger.FindLogLines(pairs, arraysize(pairs));
+ std::vector<std::vector<std::string>> lines = {
+ {"timer-event-start,default,"}, {"timer-event-end,default,"},
+ {"timer-event,default,"}, {"timer-event-start,timerEvent1,"},
+ {"timer-event-end,timerEvent1,"}, {"timer-event,timerEvent2,"},
+ {"timer-event,timerEvent3,"}};
+ CHECK(logger.ContainsLinesInOrder(lines));
}
isolate->Dispose();
@@ -1096,13 +841,13 @@ TEST(LogFunctionEvents) {
logger.StopLogging();
// Ignore all the log entries that happened before warmup
- const char* start =
- logger.FindLine("function,first-execution", "warmUpEndMarkerFunction");
- CHECK_NOT_NULL(start);
- const char* pairs[][2] = {
+ size_t start = logger.IndexOfLine(
+ {"function,first-execution", "warmUpEndMarkerFunction"});
+ CHECK(start != std::string::npos);
+ std::vector<std::vector<std::string>> lines = {
// Create a new script
- {"script,create", nullptr},
- {"script-details", nullptr},
+ {"script,create"},
+ {"script-details"},
// Step 1: parsing top-level script, preparsing functions
{"function,preparse-", ",lazyNotExecutedFunction"},
// Missing name for preparsing lazyInnerFunction
@@ -1113,11 +858,11 @@ TEST(LogFunctionEvents) {
// Missing name for inner preparsing of Foo.foo
// {"function,preparse-", nullptr},
// Missing name for top-level script.
- {"function,parse-script,", nullptr},
+ {"function,parse-script,"},
// Step 2: compiling top-level script and eager functions
// - Compiling script without name.
- {"function,compile,", nullptr},
+ {"function,compile,"},
{"function,compile,", ",eagerFunction"},
// Step 3: start executing script
@@ -1141,8 +886,38 @@ TEST(LogFunctionEvents) {
{"function,compile-lazy,", ",Foo.foo"},
{"function,first-execution,", ",Foo.foo"},
};
- logger.FindLogLines(pairs, arraysize(pairs), start);
+ CHECK(logger.ContainsLinesInOrder(lines, start));
}
i::FLAG_log_function_events = false;
isolate->Dispose();
}
+
+TEST(BuiltinsNotLoggedAsLazyCompile) {
+ SETUP_FLAGS();
+ v8::Isolate::CreateParams create_params;
+ create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+ v8::Isolate* isolate = v8::Isolate::New(create_params);
+ {
+ ScopedLoggerInitializer logger(saved_log, saved_prof, isolate);
+
+ logger.LogCodeObjects();
+ logger.LogCompiledFunctions();
+ logger.StopLogging();
+
+ i::Handle<i::Code> builtin = logger.i_isolate()->builtins()->builtin_handle(
+ i::Builtins::kBooleanConstructor);
+ i::EmbeddedVector<char, 100> buffer;
+
+ // Should only be logged as "Builtin" with a name, never as "LazyCompile".
+ i::SNPrintF(buffer, ",0x%" V8PRIxPTR ",%d,BooleanConstructor",
+ builtin->InstructionStart(), builtin->InstructionSize());
+ CHECK(logger.ContainsLine(
+ {"code-creation,Builtin,3,", std::string(buffer.start())}));
+
+ i::SNPrintF(buffer, ",0x%" V8PRIxPTR ",%d,", builtin->InstructionStart(),
+ builtin->InstructionSize());
+ CHECK(!logger.ContainsLine(
+ {"code-creation,LazyCompile,3,", std::string(buffer.start())}));
+ }
+ isolate->Dispose();
+}
diff --git a/deps/v8/test/cctest/test-macro-assembler-arm.cc b/deps/v8/test/cctest/test-macro-assembler-arm.cc
index d442903ea0..3f115af416 100644
--- a/deps/v8/test/cctest/test-macro-assembler-arm.cc
+++ b/deps/v8/test/cctest/test-macro-assembler-arm.cc
@@ -33,6 +33,7 @@
#include "src/simulator.h"
#include "src/v8.h"
#include "test/cctest/cctest.h"
+#include "test/common/assembler-tester.h"
namespace v8 {
namespace internal {
diff --git a/deps/v8/test/cctest/test-macro-assembler-mips.cc b/deps/v8/test/cctest/test-macro-assembler-mips.cc
index accee77f34..18404d6629 100644
--- a/deps/v8/test/cctest/test-macro-assembler-mips.cc
+++ b/deps/v8/test/cctest/test-macro-assembler-mips.cc
@@ -28,7 +28,7 @@
#include <stdlib.h>
#include <iostream> // NOLINT(readability/streams)
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/base/utils/random-number-generator.h"
#include "src/macro-assembler.h"
#include "src/mips/macro-assembler-mips.h"
@@ -236,7 +236,7 @@ TEST(jump_tables5) {
{
__ BlockTrampolinePoolFor(kNumCases + 6 + 1);
PredictableCodeSizeScope predictable(
- masm, kNumCases * kPointerSize + ((6 + 1) * Assembler::kInstrSize));
+ masm, kNumCases * kPointerSize + ((6 + 1) * kInstrSize));
__ addiupc(at, 6 + 1);
__ Lsa(at, at, a0, 2);
@@ -294,7 +294,6 @@ TEST(jump_tables6) {
const int kSwitchTableCases = 40;
- const int kInstrSize = Assembler::kInstrSize;
const int kMaxBranchOffset = Assembler::kMaxBranchOffset;
const int kTrampolineSlotsSize = Assembler::kTrampolineSlotsSize;
const int kSwitchTablePrologueSize = MacroAssembler::kSwitchTablePrologueSize;
diff --git a/deps/v8/test/cctest/test-macro-assembler-mips64.cc b/deps/v8/test/cctest/test-macro-assembler-mips64.cc
index f982e869fe..9a6e319363 100644
--- a/deps/v8/test/cctest/test-macro-assembler-mips64.cc
+++ b/deps/v8/test/cctest/test-macro-assembler-mips64.cc
@@ -309,7 +309,7 @@ TEST(jump_tables5) {
{
__ BlockTrampolinePoolFor(kNumCases * 2 + 6 + 1);
PredictableCodeSizeScope predictable(
- masm, kNumCases * kPointerSize + ((6 + 1) * Assembler::kInstrSize));
+ masm, kNumCases * kPointerSize + ((6 + 1) * kInstrSize));
__ addiupc(at, 6 + 1);
__ Dlsa(at, at, a0, 3);
@@ -368,7 +368,6 @@ TEST(jump_tables6) {
const int kSwitchTableCases = 40;
- const int kInstrSize = Assembler::kInstrSize;
const int kMaxBranchOffset = Assembler::kMaxBranchOffset;
const int kTrampolineSlotsSize = Assembler::kTrampolineSlotsSize;
const int kSwitchTablePrologueSize = MacroAssembler::kSwitchTablePrologueSize;
diff --git a/deps/v8/test/cctest/test-macro-assembler-x64.cc b/deps/v8/test/cctest/test-macro-assembler-x64.cc
index 54924def87..49d57aed21 100644
--- a/deps/v8/test/cctest/test-macro-assembler-x64.cc
+++ b/deps/v8/test/cctest/test-macro-assembler-x64.cc
@@ -35,6 +35,7 @@
#include "src/objects-inl.h"
#include "src/simulator.h"
#include "test/cctest/cctest.h"
+#include "test/common/assembler-tester.h"
namespace v8 {
namespace internal {
diff --git a/deps/v8/test/cctest/test-object.cc b/deps/v8/test/cctest/test-object.cc
index 4a2dccae6d..3f65691141 100644
--- a/deps/v8/test/cctest/test-object.cc
+++ b/deps/v8/test/cctest/test-object.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/handles-inl.h"
#include "src/heap/factory.h"
#include "src/isolate.h"
diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc
index b48cc493c7..72e3711405 100644
--- a/deps/v8/test/cctest/test-parsing.cc
+++ b/deps/v8/test/cctest/test-parsing.cc
@@ -33,7 +33,7 @@
#include "src/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/ast/ast-value-factory.h"
#include "src/ast/ast.h"
#include "src/compiler.h"
@@ -92,16 +92,16 @@ TEST(ScanKeywords) {
CHECK(static_cast<int>(sizeof(buffer)) >= length);
{
auto stream = i::ScannerStream::ForTesting(keyword, length);
- i::Scanner scanner(&unicode_cache);
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(&unicode_cache, stream.get(), false);
+ scanner.Initialize();
CHECK_EQ(key_token.token, scanner.Next());
CHECK_EQ(i::Token::EOS, scanner.Next());
}
// Removing characters will make keyword matching fail.
{
auto stream = i::ScannerStream::ForTesting(keyword, length - 1);
- i::Scanner scanner(&unicode_cache);
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(&unicode_cache, stream.get(), false);
+ scanner.Initialize();
CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
CHECK_EQ(i::Token::EOS, scanner.Next());
}
@@ -111,8 +111,8 @@ TEST(ScanKeywords) {
i::MemMove(buffer, keyword, length);
buffer[length] = chars_to_append[j];
auto stream = i::ScannerStream::ForTesting(buffer, length + 1);
- i::Scanner scanner(&unicode_cache);
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(&unicode_cache, stream.get(), false);
+ scanner.Initialize();
CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
CHECK_EQ(i::Token::EOS, scanner.Next());
}
@@ -121,8 +121,8 @@ TEST(ScanKeywords) {
i::MemMove(buffer, keyword, length);
buffer[length - 1] = '_';
auto stream = i::ScannerStream::ForTesting(buffer, length);
- i::Scanner scanner(&unicode_cache);
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(&unicode_cache, stream.get(), false);
+ scanner.Initialize();
CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
CHECK_EQ(i::Token::EOS, scanner.Next());
}
@@ -188,8 +188,8 @@ TEST(ScanHTMLEndComments) {
for (int i = 0; tests[i]; i++) {
const char* source = tests[i];
auto stream = i::ScannerStream::ForTesting(source);
- i::Scanner scanner(i_isolate->unicode_cache());
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(i_isolate->unicode_cache(), stream.get(), false);
+ scanner.Initialize();
i::Zone zone(i_isolate->allocator(), ZONE_NAME);
i::AstValueFactory ast_value_factory(&zone,
i_isolate->ast_string_constants(),
@@ -207,8 +207,8 @@ TEST(ScanHTMLEndComments) {
for (int i = 0; fail_tests[i]; i++) {
const char* source = fail_tests[i];
auto stream = i::ScannerStream::ForTesting(source);
- i::Scanner scanner(i_isolate->unicode_cache());
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(i_isolate->unicode_cache(), stream.get(), false);
+ scanner.Initialize();
i::Zone zone(i_isolate->allocator(), ZONE_NAME);
i::AstValueFactory ast_value_factory(&zone,
i_isolate->ast_string_constants(),
@@ -232,8 +232,8 @@ TEST(ScanHtmlComments) {
// Disallow HTML comments.
{
auto stream = i::ScannerStream::ForTesting(src);
- i::Scanner scanner(&unicode_cache);
- scanner.Initialize(stream.get(), true);
+ i::Scanner scanner(&unicode_cache, stream.get(), true);
+ scanner.Initialize();
CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
CHECK_EQ(i::Token::ILLEGAL, scanner.Next());
}
@@ -241,8 +241,8 @@ TEST(ScanHtmlComments) {
// Skip HTML comments:
{
auto stream = i::ScannerStream::ForTesting(src);
- i::Scanner scanner(&unicode_cache);
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(&unicode_cache, stream.get(), false);
+ scanner.Initialize();
CHECK_EQ(i::Token::IDENTIFIER, scanner.Next());
CHECK_EQ(i::Token::EOS, scanner.Next());
}
@@ -280,8 +280,8 @@ TEST(StandAlonePreParser) {
uintptr_t stack_limit = i_isolate->stack_guard()->real_climit();
for (int i = 0; programs[i]; i++) {
auto stream = i::ScannerStream::ForTesting(programs[i]);
- i::Scanner scanner(i_isolate->unicode_cache());
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(i_isolate->unicode_cache(), stream.get(), false);
+ scanner.Initialize();
i::Zone zone(i_isolate->allocator(), ZONE_NAME);
i::AstValueFactory ast_value_factory(&zone,
@@ -313,8 +313,8 @@ TEST(StandAlonePreParserNoNatives) {
uintptr_t stack_limit = isolate->stack_guard()->real_climit();
for (int i = 0; programs[i]; i++) {
auto stream = i::ScannerStream::ForTesting(programs[i]);
- i::Scanner scanner(isolate->unicode_cache());
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(isolate->unicode_cache(), stream.get(), false);
+ scanner.Initialize();
// Preparser defaults to disallowing natives syntax.
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
@@ -348,8 +348,8 @@ TEST(RegressChromium62639) {
// failed in debug mode, and sometimes crashed in release mode.
auto stream = i::ScannerStream::ForTesting(program);
- i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(CcTest::i_isolate()->unicode_cache(), 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(),
@@ -381,8 +381,8 @@ TEST(PreParseOverflow) {
uintptr_t stack_limit = isolate->stack_guard()->real_climit();
auto stream = i::ScannerStream::ForTesting(program.get(), kProgramSize);
- i::Scanner scanner(isolate->unicode_cache());
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(isolate->unicode_cache(), stream.get(), false);
+ scanner.Initialize();
i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME);
i::AstValueFactory ast_value_factory(
@@ -396,13 +396,12 @@ TEST(PreParseOverflow) {
CHECK_EQ(i::PreParser::kPreParseStackOverflow, result);
}
-
void TestStreamScanner(i::Utf16CharacterStream* stream,
i::Token::Value* expected_tokens,
int skip_pos = 0, // Zero means not skipping.
int skip_to = 0) {
- i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
- scanner.Initialize(stream, false);
+ i::Scanner scanner(CcTest::i_isolate()->unicode_cache(), stream, false);
+ scanner.Initialize();
int i = 0;
do {
@@ -479,8 +478,8 @@ TEST(StreamScanner) {
void TestScanRegExp(const char* re_source, const char* expected) {
auto stream = i::ScannerStream::ForTesting(re_source);
i::HandleScope scope(CcTest::i_isolate());
- i::Scanner scanner(CcTest::i_isolate()->unicode_cache());
- scanner.Initialize(stream.get(), false);
+ i::Scanner scanner(CcTest::i_isolate()->unicode_cache(), stream.get(), false);
+ scanner.Initialize();
i::Token::Value start = scanner.peek();
CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV);
@@ -1172,9 +1171,9 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
// Preparse the data.
i::PendingCompilationErrorHandler pending_error_handler;
if (test_preparser) {
- i::Scanner scanner(isolate->unicode_cache());
std::unique_ptr<i::Utf16CharacterStream> stream(
i::ScannerStream::For(isolate, source));
+ i::Scanner scanner(isolate->unicode_cache(), 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(),
@@ -1184,7 +1183,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source,
isolate->counters()->runtime_call_stats(),
isolate->logger(), -1, is_module);
SetParserFlags(&preparser, flags);
- scanner.Initialize(stream.get(), is_module);
+ scanner.Initialize();
i::PreParser::PreParseResult result = preparser.PreParseProgram();
CHECK_EQ(i::PreParser::kPreParseSuccess, result);
}
diff --git a/deps/v8/test/cctest/test-profile-generator.cc b/deps/v8/test/cctest/test-profile-generator.cc
index b53bf148e6..c4ad1babc5 100644
--- a/deps/v8/test/cctest/test-profile-generator.cc
+++ b/deps/v8/test/cctest/test-profile-generator.cc
@@ -28,7 +28,7 @@
// Tests of profiles generator and utilities.
#include "include/v8-profiler.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/objects-inl.h"
#include "src/profiler/cpu-profiler.h"
#include "src/profiler/profile-generator-inl.h"
diff --git a/deps/v8/test/cctest/test-regexp.cc b/deps/v8/test/cctest/test-regexp.cc
index bcabebf639..c65714a930 100644
--- a/deps/v8/test/cctest/test-regexp.cc
+++ b/deps/v8/test/cctest/test-regexp.cc
@@ -32,7 +32,7 @@
#include "include/v8.h"
#include "src/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/ast/ast.h"
#include "src/char-predicates-inl.h"
#include "src/objects-inl.h"
diff --git a/deps/v8/test/cctest/test-roots.cc b/deps/v8/test/cctest/test-roots.cc
index e6220be889..f99b9df399 100644
--- a/deps/v8/test/cctest/test-roots.cc
+++ b/deps/v8/test/cctest/test-roots.cc
@@ -74,16 +74,23 @@ TEST(TestAllocationSiteMaps) {
#undef CHECK_IN_RO_SPACE
namespace {
-bool IsInitiallyMutable(Heap* heap, Object* object) {
+bool IsInitiallyMutable(Factory* factory, Address object_address) {
// Entries in this list are in STRONG_MUTABLE_ROOT_LIST, but may initially point
// to objects that in RO_SPACE.
-#define INITIALLY_READ_ONLY_ROOT_LIST(V) \
- V(materialized_objects) \
- V(retaining_path_targets) \
- V(retained_maps)
+#define INITIALLY_READ_ONLY_ROOT_LIST(V) \
+ V(builtins_constants_table) \
+ V(detached_contexts) \
+ V(feedback_vectors_for_profiling_tools) \
+ V(materialized_objects) \
+ V(microtask_queue) \
+ V(noscript_shared_function_infos) \
+ V(retained_maps) \
+ V(retaining_path_targets) \
+ V(serialized_global_proxy_sizes) \
+ V(serialized_objects)
#define TEST_CAN_BE_READ_ONLY(name) \
- if (heap->name() == object) return false;
+ if (factory->name().address() == object_address) return false;
INITIALLY_READ_ONLY_ROOT_LIST(TEST_CAN_BE_READ_ONLY)
#undef TEST_CAN_BE_READ_ONLY
#undef INITIALLY_READ_ONLY_ROOT_LIST
@@ -91,15 +98,21 @@ bool IsInitiallyMutable(Heap* heap, Object* object) {
}
} // namespace
-#define CHECK_NOT_IN_RO_SPACE(name) \
- Object* name = heap->name(); \
- if (name->IsHeapObject() && IsInitiallyMutable(heap, name)) \
- CHECK_NE(RO_SPACE, GetSpaceFromObject(name));
+// The CHECK_EQ line is there just to ensure that the root is publicly
+// accessible from Heap, but ultimately the factory is used as it provides
+// handles that have the address in the root table.
+#define CHECK_NOT_IN_RO_SPACE(name) \
+ Handle<Object> name = factory->name(); \
+ CHECK_EQ(*name, heap->name()); \
+ if (name->IsHeapObject() && IsInitiallyMutable(factory, name.address())) \
+ CHECK_NE(RO_SPACE, \
+ GetSpaceFromObject(reinterpret_cast<HeapObject*>(*name)));
// The following tests check that all the roots accessible via public Heap
// accessors are not in RO_SPACE with the exception of the objects listed in
// INITIALLY_READ_ONLY_ROOT_LIST.
TEST(TestHeapRootsNotReadOnly) {
+ Factory* factory = CcTest::i_isolate()->factory();
Heap* heap = CcTest::i_isolate()->heap();
#define TEST_ROOT(type, name, camel_name) CHECK_NOT_IN_RO_SPACE(name)
@@ -108,6 +121,7 @@ TEST(TestHeapRootsNotReadOnly) {
}
TEST(TestAccessorInfosNotReadOnly) {
+ Factory* factory = CcTest::i_isolate()->factory();
Heap* heap = CcTest::i_isolate()->heap();
#define TEST_ROOT(name, AccessorName) CHECK_NOT_IN_RO_SPACE(name##_accessor)
diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc
index 8a2fe60b11..d3fd665a66 100644
--- a/deps/v8/test/cctest/test-serialize.cc
+++ b/deps/v8/test/cctest/test-serialize.cc
@@ -31,7 +31,7 @@
#include "src/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/assembler-inl.h"
#include "src/bootstrapper.h"
#include "src/compilation-cache.h"
@@ -40,6 +40,8 @@
#include "src/heap/spaces.h"
#include "src/macro-assembler-inl.h"
#include "src/objects-inl.h"
+#include "src/objects/js-array-buffer-inl.h"
+#include "src/objects/js-array-inl.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/builtin-deserializer.h"
#include "src/snapshot/builtin-serializer.h"
@@ -372,7 +374,6 @@ UNINITIALIZED_TEST(StartupSerializerRootMapDependencies) {
// - NullValue
// - Internalized one byte string
// - Map for Internalized one byte string
- // - WeakCell
// - TheHoleValue
// - HeapNumber
// HeapNumber objects require kDoubleUnaligned on 32-bit
@@ -381,7 +382,6 @@ UNINITIALIZED_TEST(StartupSerializerRootMapDependencies) {
v8::internal::Handle<Map> map(
ReadOnlyRoots(internal_isolate).one_byte_internalized_string_map(),
internal_isolate);
- Map::WeakCellForMap(internal_isolate, map);
// Need to avoid DCHECKs inside SnapshotCreator.
snapshot_creator.SetDefaultContext(v8::Context::New(isolate));
}
@@ -1365,9 +1365,9 @@ static Handle<SharedFunctionInfo> CompileScript(
Isolate* isolate, Handle<String> source, Handle<String> name,
ScriptData* cached_data, v8::ScriptCompiler::CompileOptions options) {
return Compiler::GetSharedFunctionInfoForScript(
- source, Compiler::ScriptDetails(name), v8::ScriptOriginOptions(),
- nullptr, cached_data, options, ScriptCompiler::kNoCacheNoReason,
- NOT_NATIVES_CODE)
+ isolate, source, Compiler::ScriptDetails(name),
+ v8::ScriptOriginOptions(), nullptr, cached_data, options,
+ ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked();
}
@@ -1376,9 +1376,9 @@ static Handle<SharedFunctionInfo> CompileScriptAndProduceCache(
ScriptData** script_data, v8::ScriptCompiler::CompileOptions options) {
Handle<SharedFunctionInfo> sfi =
Compiler::GetSharedFunctionInfoForScript(
- source, Compiler::ScriptDetails(name), v8::ScriptOriginOptions(),
- nullptr, nullptr, options, ScriptCompiler::kNoCacheNoReason,
- NOT_NATIVES_CODE)
+ isolate, source, Compiler::ScriptDetails(name),
+ v8::ScriptOriginOptions(), nullptr, nullptr, options,
+ ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked();
std::unique_ptr<ScriptCompiler::CachedData> cached_data(
ScriptCompiler::CreateCodeCache(ToApiHandle<UnboundScript>(sfi)));
@@ -1440,6 +1440,13 @@ void TestCodeSerializerOnePlusOneImpl() {
TEST(CodeSerializerOnePlusOne) { TestCodeSerializerOnePlusOneImpl(); }
+TEST(CodeSerializerOnePlusOneWithDebugger) {
+ v8::HandleScope scope(CcTest::isolate());
+ static v8::debug::DebugDelegate dummy_delegate;
+ v8::debug::SetDebugDelegate(CcTest::isolate(), &dummy_delegate);
+ TestCodeSerializerOnePlusOneImpl();
+}
+
TEST(CodeSerializerOnePlusOne1) {
FLAG_serialization_chunk_size = 1;
TestCodeSerializerOnePlusOneImpl();
@@ -1903,9 +1910,9 @@ TEST(CodeSerializerExternalString) {
// This avoids the GC from trying to free stack allocated resources.
i::Handle<i::ExternalOneByteString>::cast(one_byte_string)
- ->set_resource(nullptr);
+ ->SetResource(isolate, nullptr);
i::Handle<i::ExternalTwoByteString>::cast(two_byte_string)
- ->set_resource(nullptr);
+ ->SetResource(isolate, nullptr);
delete cache;
}
@@ -1963,7 +1970,8 @@ TEST(CodeSerializerLargeExternalString) {
CHECK_EQ(42.0, copy_result->Number());
// This avoids the GC from trying to free stack allocated resources.
- i::Handle<i::ExternalOneByteString>::cast(name)->set_resource(nullptr);
+ i::Handle<i::ExternalOneByteString>::cast(name)->SetResource(isolate,
+ nullptr);
delete cache;
string.Dispose();
}
@@ -2014,7 +2022,8 @@ TEST(CodeSerializerExternalScriptName) {
CHECK_EQ(10.0, copy_result->Number());
// This avoids the GC from trying to free stack allocated resources.
- i::Handle<i::ExternalOneByteString>::cast(name)->set_resource(nullptr);
+ i::Handle<i::ExternalOneByteString>::cast(name)->SetResource(isolate,
+ nullptr);
delete cache;
}
diff --git a/deps/v8/test/cctest/test-strings.cc b/deps/v8/test/cctest/test-strings.cc
index d5ef8af652..8aa621b1c1 100644
--- a/deps/v8/test/cctest/test-strings.cc
+++ b/deps/v8/test/cctest/test-strings.cc
@@ -34,7 +34,7 @@
#include "src/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/heap/factory.h"
#include "src/messages.h"
#include "src/objects-inl.h"
@@ -951,7 +951,8 @@ TEST(Utf8Conversion) {
for (int j = 0; j < 11; j++)
buffer[j] = kNoChar;
int chars_written;
- int written = mixed->WriteUtf8(buffer, i, &chars_written);
+ int written =
+ mixed->WriteUtf8(CcTest::isolate(), buffer, i, &chars_written);
CHECK_EQ(lengths[i], written);
CHECK_EQ(char_lengths[i], chars_written);
// Check that the contents are correct
@@ -1095,7 +1096,7 @@ TEST(JSONStringifySliceMadeExternal) {
int length = underlying->Length();
uc16* two_byte = NewArray<uc16>(length + 1);
- underlying->Write(two_byte);
+ underlying->Write(CcTest::isolate(), two_byte);
Resource* resource = new Resource(two_byte, length);
CHECK(underlying->MakeExternal(resource));
CHECK(v8::Utils::OpenHandle(*slice)->IsSlicedString());
@@ -1245,7 +1246,8 @@ TEST(SliceFromExternal) {
CHECK(SlicedString::cast(*slice)->parent()->IsExternalString());
CHECK(slice->IsFlat());
// This avoids the GC from trying to free stack allocated resources.
- i::Handle<i::ExternalOneByteString>::cast(string)->set_resource(nullptr);
+ i::Handle<i::ExternalOneByteString>::cast(string)->SetResource(
+ CcTest::i_isolate(), nullptr);
}
@@ -1526,8 +1528,9 @@ TEST(FormatMessage) {
Handle<String> arg1 = isolate->factory()->NewStringFromAsciiChecked("arg1");
Handle<String> arg2 = isolate->factory()->NewStringFromAsciiChecked("arg2");
Handle<String> result =
- MessageTemplate::FormatMessage(MessageTemplate::kPropertyNotFunction,
- arg0, arg1, arg2).ToHandleChecked();
+ MessageTemplate::FormatMessage(
+ isolate, MessageTemplate::kPropertyNotFunction, arg0, arg1, arg2)
+ .ToHandleChecked();
Handle<String> expected = isolate->factory()->NewStringFromAsciiChecked(
"'arg0' returned for property 'arg1' of object 'arg2' is not a function");
CHECK(String::Equals(isolate, result, expected));
@@ -1661,6 +1664,35 @@ TEST(HashArrayIndexStrings) {
isolate->factory()->one_string()->Hash());
}
+TEST(StringEquals) {
+ v8::V8::Initialize();
+ v8::Isolate* isolate = CcTest::isolate();
+ v8::HandleScope scope(isolate);
+
+ auto foo_str =
+ v8::String::NewFromUtf8(isolate, "foo", v8::NewStringType::kNormal)
+ .ToLocalChecked();
+ auto bar_str =
+ v8::String::NewFromUtf8(isolate, "bar", v8::NewStringType::kNormal)
+ .ToLocalChecked();
+ auto foo_str2 =
+ v8::String::NewFromUtf8(isolate, "foo", v8::NewStringType::kNormal)
+ .ToLocalChecked();
+
+ uint16_t* two_byte_source = AsciiToTwoByteString("foo");
+ auto foo_two_byte_str =
+ v8::String::NewFromTwoByte(isolate, two_byte_source,
+ v8::NewStringType::kNormal)
+ .ToLocalChecked();
+ i::DeleteArray(two_byte_source);
+
+ CHECK(foo_str->StringEquals(foo_str));
+ CHECK(!foo_str->StringEquals(bar_str));
+ CHECK(foo_str->StringEquals(foo_str2));
+ CHECK(foo_str->StringEquals(foo_two_byte_str));
+ CHECK(!bar_str->StringEquals(foo_str2));
+}
+
} // namespace test_strings
} // namespace internal
} // namespace v8
diff --git a/deps/v8/test/cctest/test-thread-termination.cc b/deps/v8/test/cctest/test-thread-termination.cc
index ddfc262807..902295447b 100644
--- a/deps/v8/test/cctest/test-thread-termination.cc
+++ b/deps/v8/test/cctest/test-thread-termination.cc
@@ -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.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/isolate.h"
#include "src/objects-inl.h"
#include "src/v8.h"
diff --git a/deps/v8/test/cctest/test-trace-event.cc b/deps/v8/test/cctest/test-trace-event.cc
index 47545af37f..10b837aaed 100644
--- a/deps/v8/test/cctest/test-trace-event.cc
+++ b/deps/v8/test/cctest/test-trace-event.cc
@@ -289,6 +289,7 @@ TEST(BuiltinsIsTraceCategoryEnabled) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = isolate->GetCurrentContext();
LocalContext env;
v8::Local<v8::Object> binding = env->GetExtrasBindingObject();
@@ -307,7 +308,7 @@ TEST(BuiltinsIsTraceCategoryEnabled) {
.ToLocalChecked()
.As<v8::Boolean>();
- CHECK(result->BooleanValue());
+ CHECK(result->BooleanValue(context).ToChecked());
}
{
@@ -317,7 +318,7 @@ TEST(BuiltinsIsTraceCategoryEnabled) {
.ToLocalChecked()
.As<v8::Boolean>();
- CHECK(!result->BooleanValue());
+ CHECK(!result->BooleanValue(context).ToChecked());
}
{
@@ -327,7 +328,7 @@ TEST(BuiltinsIsTraceCategoryEnabled) {
.ToLocalChecked()
.As<v8::Boolean>();
- CHECK(result->BooleanValue());
+ CHECK(result->BooleanValue(context).ToChecked());
}
}
@@ -337,6 +338,7 @@ TEST(BuiltinsTrace) {
v8::Isolate* isolate = CcTest::isolate();
v8::HandleScope handle_scope(isolate);
+ v8::Local<v8::Context> context = isolate->GetCurrentContext();
LocalContext env;
v8::Local<v8::Object> binding = env->GetExtrasBindingObject();
@@ -360,7 +362,7 @@ TEST(BuiltinsTrace) {
.ToLocalChecked()
.As<v8::Boolean>();
- CHECK(!result->BooleanValue());
+ CHECK(!result->BooleanValue(context).ToChecked());
CHECK_EQ(0, GET_TRACE_OBJECTS_LIST->size());
}
@@ -368,7 +370,6 @@ TEST(BuiltinsTrace) {
{
v8::Local<v8::String> category = v8_str("v8-cat");
v8::Local<v8::String> name = v8_str("name");
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Object> data = v8::Object::New(isolate);
data->Set(context, v8_str("foo"), v8_str("bar")).FromJust();
v8::Local<v8::Value> argv[] = {
@@ -380,7 +381,7 @@ TEST(BuiltinsTrace) {
.ToLocalChecked()
.As<v8::Boolean>();
- CHECK(result->BooleanValue());
+ CHECK(result->BooleanValue(context).ToChecked());
CHECK_EQ(1, GET_TRACE_OBJECTS_LIST->size());
CHECK_EQ(123, GET_TRACE_OBJECT(0)->id);
@@ -393,7 +394,6 @@ TEST(BuiltinsTrace) {
{
v8::Local<v8::String> category = v8_str("v8-cat\u20ac");
v8::Local<v8::String> name = v8_str("name\u20ac");
- v8::Local<v8::Context> context = isolate->GetCurrentContext();
v8::Local<v8::Object> data = v8::Object::New(isolate);
data->Set(context, v8_str("foo"), v8_str("bar")).FromJust();
v8::Local<v8::Value> argv[] = {
@@ -405,7 +405,7 @@ TEST(BuiltinsTrace) {
.ToLocalChecked()
.As<v8::Boolean>();
- CHECK(result->BooleanValue());
+ CHECK(result->BooleanValue(context).ToChecked());
CHECK_EQ(2, GET_TRACE_OBJECTS_LIST->size());
CHECK_EQ(123, GET_TRACE_OBJECT(1)->id);
diff --git a/deps/v8/test/cctest/test-typedarrays.cc b/deps/v8/test/cctest/test-typedarrays.cc
index bab6e0f2f6..b574fdd94a 100644
--- a/deps/v8/test/cctest/test-typedarrays.cc
+++ b/deps/v8/test/cctest/test-typedarrays.cc
@@ -7,7 +7,6 @@
#include "src/v8.h"
#include "test/cctest/cctest.h"
-#include "src/api.h"
#include "src/heap/heap.h"
#include "src/objects-inl.h"
#include "src/objects.h"
@@ -92,7 +91,7 @@ void TestSpeciesProtector(char* code,
v8::Isolate::CreateParams create_params;
create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
std::string typed_array_constructors[] = {
-#define TYPED_ARRAY_CTOR(Type, type, TYPE, ctype, size) #Type "Array",
+#define TYPED_ARRAY_CTOR(Type, type, TYPE, ctype) #Type "Array",
TYPED_ARRAYS(TYPED_ARRAY_CTOR)
#undef TYPED_ARRAY_CTOR
diff --git a/deps/v8/test/cctest/test-types.cc b/deps/v8/test/cctest/test-types.cc
index 831593f17b..c8d5e37fa2 100644
--- a/deps/v8/test/cctest/test-types.cc
+++ b/deps/v8/test/cctest/test-types.cc
@@ -33,12 +33,14 @@ struct Tests {
Isolate* isolate;
HandleScope scope;
+ CanonicalHandleScope canonical;
Zone zone;
Types T;
Tests()
: isolate(CcTest::InitIsolateOnce()),
scope(isolate),
+ canonical(isolate),
zone(isolate->allocator(), ZONE_NAME),
T(&zone, isolate, isolate->random_number_generator()) {}
diff --git a/deps/v8/test/cctest/test-unboxed-doubles.cc b/deps/v8/test/cctest/test-unboxed-doubles.cc
index 2d63a87fc2..421407180c 100644
--- a/deps/v8/test/cctest/test-unboxed-doubles.cc
+++ b/deps/v8/test/cctest/test-unboxed-doubles.cc
@@ -8,7 +8,7 @@
#include "src/v8.h"
#include "src/accessors.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/compilation-cache.h"
#include "src/execution.h"
#include "src/field-type.h"
@@ -124,7 +124,7 @@ static Handle<DescriptorArray> CreateDescriptorArray(Isolate* isolate,
d = Descriptor::AccessorConstant(name, info, NONE);
} else {
- d = Descriptor::DataField(name, next_field_offset, NONE,
+ d = Descriptor::DataField(isolate, name, next_field_offset, NONE,
representations[kind]);
}
descriptors->Append(&d);
@@ -658,7 +658,7 @@ static Handle<LayoutDescriptor> TestLayoutDescriptorAppend(
d = Descriptor::AccessorConstant(name, info, NONE);
} else {
- d = Descriptor::DataField(name, next_field_offset, NONE,
+ d = Descriptor::DataField(isolate, name, next_field_offset, NONE,
representations[kind]);
}
PropertyDetails details = d.GetDetails();
diff --git a/deps/v8/test/cctest/test-utils.cc b/deps/v8/test/cctest/test-utils.cc
index c1c15873e9..1f5c7c6a70 100644
--- a/deps/v8/test/cctest/test-utils.cc
+++ b/deps/v8/test/cctest/test-utils.cc
@@ -31,6 +31,7 @@
#include "src/v8.h"
+#include "src/api-inl.h"
#include "src/base/platform/platform.h"
#include "src/collector.h"
#include "src/conversions.h"
diff --git a/deps/v8/test/cctest/torque/test-torque.cc b/deps/v8/test/cctest/torque/test-torque.cc
index 11a683f85e..439fe043b8 100644
--- a/deps/v8/test/cctest/torque/test-torque.cc
+++ b/deps/v8/test/cctest/torque/test-torque.cc
@@ -4,7 +4,6 @@
#include <cmath>
-#include "src/api.h"
#include "src/base/utils/random-number-generator.h"
#include "src/builtins/builtins-promise-gen.h"
#include "src/builtins/builtins-string-gen.h"
@@ -224,6 +223,42 @@ TEST(TestLocalConstBindings) {
ft.Call();
}
+TEST(TestForLoop) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+ CodeAssemblerTester asm_tester(isolate, 0);
+ TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ {
+ m.TestForLoop();
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
+TEST(TestTypeswitch) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+ CodeAssemblerTester asm_tester(isolate, 0);
+ TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ {
+ m.TestTypeswitch();
+ m.Return(m.UndefinedConstant());
+ }
+ FunctionTester ft(asm_tester.GenerateCode(), 0);
+ ft.Call();
+}
+
+TEST(TestGenericOverload) {
+ Isolate* isolate(CcTest::InitIsolateOnce());
+ CodeAssemblerTester asm_tester(isolate, 0);
+ TestBuiltinsFromDSLAssembler m(asm_tester.state());
+ {
+ m.TestGenericOverload();
+ 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/types-fuzz.h b/deps/v8/test/cctest/types-fuzz.h
index db264db42c..b6b5bf2dc5 100644
--- a/deps/v8/test/cctest/types-fuzz.h
+++ b/deps/v8/test/cctest/types-fuzz.h
@@ -40,7 +40,7 @@ namespace compiler {
class Types {
public:
Types(Zone* zone, Isolate* isolate, v8::base::RandomNumberGenerator* rng)
- : zone_(zone), js_heap_broker_(isolate), rng_(rng) {
+ : zone_(zone), js_heap_broker_(isolate, zone), rng_(rng) {
#define DECLARE_TYPE(name, value) \
name = Type::name(); \
types.push_back(name);
@@ -209,7 +209,7 @@ class Types {
}
Zone* zone() { return zone_; }
- const JSHeapBroker* js_heap_broker() const { return &js_heap_broker_; }
+ JSHeapBroker* js_heap_broker() { return &js_heap_broker_; }
private:
Zone* zone_;
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 23a0c3369b..e56060bdd9 100644
--- a/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc
+++ b/deps/v8/test/cctest/wasm/test-c-wasm-entry.cc
@@ -30,7 +30,7 @@ class CWasmEntryArgTester {
public:
CWasmEntryArgTester(std::initializer_list<uint8_t> wasm_function_bytes,
std::function<ReturnType(Args...)> expected_fn)
- : runner_(kExecuteTurbofan),
+ : runner_(ExecutionTier::kOptimized),
isolate_(runner_.main_isolate()),
expected_fn_(expected_fn),
sig_(runner_.template CreateSig<ReturnType, Args...>()) {
@@ -93,7 +93,7 @@ class CWasmEntryArgTester {
std::function<ReturnType(Args...)> expected_fn_;
FunctionSig* sig_;
Handle<JSFunction> c_wasm_entry_fn_;
- wasm::WasmCode* wasm_code_;
+ WasmCode* wasm_code_;
};
} // namespace
diff --git a/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc b/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc
new file mode 100644
index 0000000000..53ee5eedd1
--- /dev/null
+++ b/deps/v8/test/cctest/wasm/test-jump-table-assembler.cc
@@ -0,0 +1,199 @@
+// 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.
+
+#include "src/assembler-inl.h"
+#include "src/macro-assembler-inl.h"
+#include "src/simulator.h"
+#include "src/utils.h"
+#include "src/wasm/jump-table-assembler.h"
+#include "test/cctest/cctest.h"
+#include "test/common/assembler-tester.h"
+
+namespace v8 {
+namespace internal {
+namespace wasm {
+
+#if 0
+#define TRACE(...) PrintF(__VA_ARGS__)
+#else
+#define TRACE(...)
+#endif
+
+#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;
+
+Address GenerateJumpTableThunk(Address jump_target) {
+ size_t allocated;
+ byte* buffer;
+#if V8_TARGET_ARCH_ARM64
+ // TODO(wasm): Currently {kMaxWasmCodeMemory} limits code sufficiently, so
+ // that the jump table only supports {near_call} distances.
+ const uintptr_t kThunkAddrMask = (1 << WhichPowerOf2(kMaxWasmCodeMemory)) - 1;
+ const int kArbitrarilyChosenRetryCount = 10; // Retry to avoid flakes.
+ for (int retry = 0; retry < kArbitrarilyChosenRetryCount; ++retry) {
+ Address random_addr = reinterpret_cast<Address>(GetRandomMmapAddr());
+ void* address = reinterpret_cast<void*>((jump_target & ~kThunkAddrMask) |
+ (random_addr & kThunkAddrMask));
+ buffer = AllocateAssemblerBuffer(
+ &allocated, AssemblerBase::kMinimalBufferSize, address);
+ Address bufferptr = reinterpret_cast<uintptr_t>(buffer);
+ if ((bufferptr & ~kThunkAddrMask) == (jump_target & ~kThunkAddrMask)) break;
+ }
+#else
+ buffer = AllocateAssemblerBuffer(
+ &allocated, AssemblerBase::kMinimalBufferSize, GetRandomMmapAddr());
+#endif
+ MacroAssembler masm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+
+ Label exit;
+ Register scratch = kReturnRegister0;
+ Address stop_bit_address = reinterpret_cast<Address>(&global_stop_bit);
+#if V8_TARGET_ARCH_X64
+ __ Move(scratch, stop_bit_address, RelocInfo::NONE);
+ __ testl(MemOperand(scratch, 0), Immediate(1));
+ __ j(not_zero, &exit);
+ __ Jump(jump_target, RelocInfo::NONE);
+#elif V8_TARGET_ARCH_IA32
+ __ Move(scratch, Immediate(stop_bit_address, RelocInfo::NONE));
+ __ test(MemOperand(scratch, 0), Immediate(1));
+ __ j(not_zero, &exit);
+ __ jmp(jump_target, RelocInfo::NONE);
+#elif V8_TARGET_ARCH_ARM
+ __ mov(scratch, Operand(stop_bit_address, RelocInfo::NONE));
+ __ ldr(scratch, MemOperand(scratch, 0));
+ __ tst(scratch, Operand(1));
+ __ b(ne, &exit);
+ __ Jump(jump_target, RelocInfo::NONE);
+#elif V8_TARGET_ARCH_ARM64
+ __ Mov(scratch, Operand(stop_bit_address, RelocInfo::NONE));
+ __ Ldr(scratch, MemOperand(scratch, 0));
+ __ Tbnz(scratch, 0, &exit);
+ __ Mov(scratch, Immediate(jump_target, RelocInfo::NONE));
+ __ Br(scratch);
+#else
+#error Unsupported architecture
+#endif
+ __ bind(&exit);
+ __ Ret();
+
+ CodeDesc desc;
+ masm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ return reinterpret_cast<Address>(buffer);
+}
+
+class JumpTableRunner : public v8::base::Thread {
+ public:
+ JumpTableRunner(Address slot_address, int runner_id)
+ : Thread(Options("JumpTableRunner")),
+ slot_address_(slot_address),
+ runner_id_(runner_id) {}
+
+ void Run() override {
+ TRACE("Runner #%d is starting ...\n", runner_id_);
+ GeneratedCode<void>::FromAddress(CcTest::i_isolate(), slot_address_).Call();
+ TRACE("Runner #%d is stopping ...\n", runner_id_);
+ USE(runner_id_);
+ }
+
+ private:
+ Address slot_address_;
+ int runner_id_;
+};
+
+class JumpTablePatcher : public v8::base::Thread {
+ public:
+ JumpTablePatcher(Address slot_start, uint32_t slot_index, Address thunk1,
+ Address thunk2)
+ : Thread(Options("JumpTablePatcher")),
+ slot_start_(slot_start),
+ slot_index_(slot_index),
+ thunks_{thunk1, thunk2} {}
+
+ void Run() override {
+ TRACE("Patcher is starting ...\n");
+ constexpr int kNumberOfPatchIterations = 64;
+ for (int i = 0; i < kNumberOfPatchIterations; ++i) {
+ TRACE(" patch slot " V8PRIxPTR_FMT " to thunk #%d\n",
+ slot_start_ + JumpTableAssembler::SlotIndexToOffset(slot_index_),
+ i % 2);
+ JumpTableAssembler::PatchJumpTableSlot(
+ slot_start_, slot_index_, thunks_[i % 2], WasmCode::kFlushICache);
+ }
+ TRACE("Patcher is stopping ...\n");
+ }
+
+ private:
+ Address slot_start_;
+ uint32_t slot_index_;
+ Address thunks_[2];
+};
+
+} // namespace
+
+// This test is intended to stress concurrent patching of jump-table slots. It
+// uses the following setup:
+// 1) Picks a particular slot of the jump-table. Slots are iterated over to
+// ensure multiple entries (at different offset alignments) are tested.
+// 2) Starts multiple runners that spin through the above slot. The runners
+// use thunk code that will jump to the same jump-table slot repeatedly
+// until the {global_stop_bit} indicates a test-end condition.
+// 3) Start a patcher that repeatedly patches the jump-table slot back and
+// forth between two thunk. If there is a race then chances are high that
+// one of the runners is currently executing the jump-table slot.
+TEST(JumpTablePatchingStress) {
+ constexpr int kJumpTableSlotCount = 128;
+ constexpr int kNumberOfRunnerThreads = 5;
+
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(
+ &allocated,
+ JumpTableAssembler::SizeForNumberOfSlots(kJumpTableSlotCount));
+
+ // Iterate through jump-table slots to hammer at different alignments within
+ // the jump-table, thereby increasing stress for variable-length ISAs.
+ Address slot_start = reinterpret_cast<Address>(buffer);
+ for (int slot = 0; slot < kJumpTableSlotCount; ++slot) {
+ TRACE("Hammering on jump table slot #%d ...\n", slot);
+ uint32_t slot_offset = JumpTableAssembler::SlotIndexToOffset(slot);
+ Address thunk1 = GenerateJumpTableThunk(slot_start + slot_offset);
+ Address thunk2 = GenerateJumpTableThunk(slot_start + slot_offset);
+ TRACE(" generated thunk1: " V8PRIxPTR_FMT "\n", thunk1);
+ TRACE(" generated thunk2: " V8PRIxPTR_FMT "\n", thunk2);
+ JumpTableAssembler::PatchJumpTableSlot(slot_start, slot, thunk1,
+ WasmCode::kFlushICache);
+
+ // Start multiple runner threads and a patcher thread that hammer on the
+ // same jump-table slot concurrently.
+ std::list<JumpTableRunner> runners;
+ for (int runner = 0; runner < kNumberOfRunnerThreads; ++runner) {
+ runners.emplace_back(slot_start + slot_offset, runner);
+ }
+ JumpTablePatcher patcher(slot_start, slot, thunk1, thunk2);
+ global_stop_bit = 0; // Signal runners to keep going.
+ for (auto& runner : runners) runner.Start();
+ patcher.Start();
+ patcher.Join();
+ global_stop_bit = -1; // Signal runners to stop.
+ for (auto& runner : runners) runner.Join();
+ }
+}
+
+#endif // V8_TARGET_ARCH_X64 || V8_TARGET_ARCH_IA32 || V8_TARGET_ARCH_ARM ||
+ // V8_TARGET_ARCH_ARM64
+
+#undef __
+#undef TRACE
+
+} // namespace wasm
+} // namespace internal
+} // namespace v8
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 157dd519b1..be45f5bc17 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc
@@ -22,7 +22,7 @@ namespace wasm {
namespace test_run_wasm_64 {
WASM_EXEC_TEST(I64Const) {
- WasmRunner<int64_t> r(execution_mode);
+ WasmRunner<int64_t> r(execution_tier);
const int64_t kExpectedValue = 0x1122334455667788LL;
// return(kExpectedValue)
BUILD(r, WASM_I64V_9(kExpectedValue));
@@ -32,7 +32,7 @@ WASM_EXEC_TEST(I64Const) {
WASM_EXEC_TEST(I64Const_many) {
int cntr = 0;
FOR_INT32_INPUTS(i) {
- WasmRunner<int64_t> r(execution_mode);
+ WasmRunner<int64_t> r(execution_tier);
const int64_t kExpectedValue = (static_cast<int64_t>(*i) << 32) | cntr;
// return(kExpectedValue)
BUILD(r, WASM_I64V(kExpectedValue));
@@ -42,7 +42,7 @@ WASM_EXEC_TEST(I64Const_many) {
}
WASM_EXEC_TEST(Return_I64) {
- WasmRunner<int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_RETURN1(WASM_GET_LOCAL(0)));
@@ -50,7 +50,7 @@ WASM_EXEC_TEST(Return_I64) {
}
WASM_EXEC_TEST(I64Add) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ(*i + *j, r.Call(*i, *j)); }
@@ -63,7 +63,7 @@ WASM_EXEC_TEST(I64Add) {
const int64_t kHasBit33On = 0x100000000;
WASM_EXEC_TEST(Regress5800_Add) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_I64_EQZ(WASM_I64_ADD(
WASM_I64V(0), WASM_I64V(kHasBit33On)))),
WASM_RETURN1(WASM_I32V(0))),
@@ -72,7 +72,7 @@ WASM_EXEC_TEST(Regress5800_Add) {
}
WASM_EXEC_TEST(I64Sub) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) { CHECK_EQ(*i - *j, r.Call(*i, *j)); }
@@ -80,7 +80,7 @@ WASM_EXEC_TEST(I64Sub) {
}
WASM_EXEC_TEST(Regress5800_Sub) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_I64_EQZ(WASM_I64_SUB(
WASM_I64V(0), WASM_I64V(kHasBit33On)))),
WASM_RETURN1(WASM_I32V(0))),
@@ -89,7 +89,7 @@ WASM_EXEC_TEST(Regress5800_Sub) {
}
WASM_EXEC_TEST(I64AddUseOnlyLowWord) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
@@ -100,7 +100,7 @@ WASM_EXEC_TEST(I64AddUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64SubUseOnlyLowWord) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
@@ -111,7 +111,7 @@ WASM_EXEC_TEST(I64SubUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64MulUseOnlyLowWord) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
@@ -122,7 +122,7 @@ WASM_EXEC_TEST(I64MulUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64ShlUseOnlyLowWord) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
@@ -134,7 +134,7 @@ WASM_EXEC_TEST(I64ShlUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64ShrUseOnlyLowWord) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_UINT64_INPUTS(i) {
@@ -146,7 +146,7 @@ WASM_EXEC_TEST(I64ShrUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64SarUseOnlyLowWord) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I32_CONVERT_I64(
WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
FOR_INT64_INPUTS(i) {
@@ -158,7 +158,7 @@ WASM_EXEC_TEST(I64SarUseOnlyLowWord) {
}
WASM_EXEC_TEST(I64DivS) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
@@ -174,7 +174,7 @@ WASM_EXEC_TEST(I64DivS) {
}
WASM_EXEC_TEST(I64DivS_Trap) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(0, r.Call(int64_t{0}, int64_t{100}));
CHECK_TRAP64(r.Call(int64_t{100}, int64_t{0}));
@@ -185,7 +185,7 @@ WASM_EXEC_TEST(I64DivS_Trap) {
WASM_EXEC_TEST(I64DivS_Byzero_Const) {
for (int8_t denom = -2; denom < 8; denom++) {
- WasmRunner<int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_I64V_1(denom)));
for (int64_t val = -7; val < 8; val++) {
if (denom == 0) {
@@ -198,7 +198,7 @@ WASM_EXEC_TEST(I64DivS_Byzero_Const) {
}
WASM_EXEC_TEST(I64DivU) {
- WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
@@ -212,7 +212,7 @@ WASM_EXEC_TEST(I64DivU) {
}
WASM_EXEC_TEST(I64DivU_Trap) {
- WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(0, r.Call(uint64_t{0}, uint64_t{100}));
CHECK_TRAP64(r.Call(uint64_t{100}, uint64_t{0}));
@@ -222,7 +222,7 @@ WASM_EXEC_TEST(I64DivU_Trap) {
WASM_EXEC_TEST(I64DivU_Byzero_Const) {
for (uint64_t denom = 0xFFFFFFFFFFFFFFFE; denom < 8; denom++) {
- WasmRunner<uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_I64V_1(denom)));
for (uint64_t val = 0xFFFFFFFFFFFFFFF0; val < 8; val++) {
@@ -236,7 +236,7 @@ WASM_EXEC_TEST(I64DivU_Byzero_Const) {
}
WASM_EXEC_TEST(I64RemS) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
FOR_INT64_INPUTS(j) {
@@ -250,7 +250,7 @@ WASM_EXEC_TEST(I64RemS) {
}
WASM_EXEC_TEST(I64RemS_Trap) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(33, r.Call(int64_t{133}, int64_t{100}));
CHECK_EQ(0, r.Call(std::numeric_limits<int64_t>::min(), int64_t{-1}));
@@ -260,7 +260,7 @@ WASM_EXEC_TEST(I64RemS_Trap) {
}
WASM_EXEC_TEST(I64RemU) {
- WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
FOR_UINT64_INPUTS(j) {
@@ -274,7 +274,7 @@ WASM_EXEC_TEST(I64RemU) {
}
WASM_EXEC_TEST(I64RemU_Trap) {
- WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(17, r.Call(uint64_t{217}, uint64_t{100}));
CHECK_TRAP64(r.Call(uint64_t{100}, uint64_t{0}));
@@ -283,7 +283,7 @@ WASM_EXEC_TEST(I64RemU_Trap) {
}
WASM_EXEC_TEST(I64And) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -291,7 +291,7 @@ WASM_EXEC_TEST(I64And) {
}
WASM_EXEC_TEST(I64Ior) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -299,7 +299,7 @@ WASM_EXEC_TEST(I64Ior) {
}
WASM_EXEC_TEST(I64Xor) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -308,7 +308,7 @@ WASM_EXEC_TEST(I64Xor) {
WASM_EXEC_TEST(I64Shl) {
{
- WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
@@ -319,22 +319,22 @@ WASM_EXEC_TEST(I64Shl) {
}
}
{
- WasmRunner<uint64_t, int64_t> r(execution_mode);
+ 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)); }
}
{
- WasmRunner<uint64_t, int64_t> r(execution_mode);
+ 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)); }
}
{
- WasmRunner<uint64_t, int64_t> r(execution_mode);
+ 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)); }
}
{
- WasmRunner<uint64_t, int64_t> r(execution_mode);
+ 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)); }
}
@@ -342,7 +342,7 @@ WASM_EXEC_TEST(I64Shl) {
WASM_EXEC_TEST(I64ShrU) {
{
- WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
@@ -353,22 +353,22 @@ WASM_EXEC_TEST(I64ShrU) {
}
}
{
- WasmRunner<uint64_t, int64_t> r(execution_mode);
+ 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)); }
}
{
- WasmRunner<uint64_t, int64_t> r(execution_mode);
+ 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)); }
}
{
- WasmRunner<uint64_t, int64_t> r(execution_mode);
+ 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)); }
}
{
- WasmRunner<uint64_t, int64_t> r(execution_mode);
+ 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)); }
}
@@ -376,7 +376,7 @@ WASM_EXEC_TEST(I64ShrU) {
WASM_EXEC_TEST(I64ShrS) {
{
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT64_INPUTS(i) {
@@ -387,29 +387,29 @@ WASM_EXEC_TEST(I64ShrS) {
}
}
{
- WasmRunner<int64_t, int64_t> r(execution_mode);
+ 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)); }
}
{
- WasmRunner<int64_t, int64_t> r(execution_mode);
+ 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)); }
}
{
- WasmRunner<int64_t, int64_t> r(execution_mode);
+ 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)); }
}
{
- WasmRunner<int64_t, int64_t> r(execution_mode);
+ 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)); }
}
}
WASM_EXEC_TEST(I64Eq) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -417,7 +417,7 @@ WASM_EXEC_TEST(I64Eq) {
}
WASM_EXEC_TEST(I64Ne) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -425,7 +425,7 @@ WASM_EXEC_TEST(I64Ne) {
}
WASM_EXEC_TEST(I64LtS) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -433,7 +433,7 @@ WASM_EXEC_TEST(I64LtS) {
}
WASM_EXEC_TEST(I64LeS) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -441,7 +441,7 @@ WASM_EXEC_TEST(I64LeS) {
}
WASM_EXEC_TEST(I64LtU) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -449,7 +449,7 @@ WASM_EXEC_TEST(I64LtU) {
}
WASM_EXEC_TEST(I64LeU) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -457,7 +457,7 @@ WASM_EXEC_TEST(I64LeU) {
}
WASM_EXEC_TEST(I64GtS) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -465,7 +465,7 @@ WASM_EXEC_TEST(I64GtS) {
}
WASM_EXEC_TEST(I64GeS) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -473,7 +473,7 @@ WASM_EXEC_TEST(I64GeS) {
}
WASM_EXEC_TEST(I64GtU) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -481,7 +481,7 @@ WASM_EXEC_TEST(I64GtU) {
}
WASM_EXEC_TEST(I64GeU) {
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ 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)); }
@@ -490,20 +490,20 @@ WASM_EXEC_TEST(I64GeU) {
WASM_EXEC_TEST(I32ConvertI64) {
FOR_INT64_INPUTS(i) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
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_mode);
+ 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)); }
}
WASM_EXEC_TEST(I64UConvertI32) {
- WasmRunner<int64_t, uint32_t> r(execution_mode);
+ 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)); }
}
@@ -518,7 +518,7 @@ WASM_EXEC_TEST(I64Popcnt) {
{26, 0x1123456782345678},
{38, 0xFFEDCBA09EDCBA09}};
- WasmRunner<int64_t, uint64_t> r(execution_mode);
+ WasmRunner<int64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(values[i].expected, r.Call(values[i].input));
@@ -526,7 +526,7 @@ WASM_EXEC_TEST(I64Popcnt) {
}
WASM_EXEC_TEST(F32SConvertI64) {
- WasmRunner<float, int64_t> r(execution_mode);
+ 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)); }
}
@@ -611,7 +611,7 @@ WASM_EXEC_TEST(F32UConvertI64) {
{0x8000008000000001, 0x5F000001},
{0x8000000000000400, 0x5F000000},
{0x8000000000000401, 0x5F000000}};
- WasmRunner<float, uint64_t> r(execution_mode);
+ WasmRunner<float, uint64_t> r(execution_tier);
BUILD(r, WASM_F32_UCONVERT_I64(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(bit_cast<float>(values[i].expected), r.Call(values[i].input));
@@ -619,7 +619,7 @@ WASM_EXEC_TEST(F32UConvertI64) {
}
WASM_EXEC_TEST(F64SConvertI64) {
- WasmRunner<double, int64_t> r(execution_mode);
+ 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)); }
}
@@ -703,7 +703,7 @@ WASM_EXEC_TEST(F64UConvertI64) {
{0x8000008000000001, 0x43E0000010000000},
{0x8000000000000400, 0x43E0000000000000},
{0x8000000000000401, 0x43E0000000000001}};
- WasmRunner<double, uint64_t> r(execution_mode);
+ WasmRunner<double, uint64_t> r(execution_tier);
BUILD(r, WASM_F64_UCONVERT_I64(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(bit_cast<double>(values[i].expected), r.Call(values[i].input));
@@ -711,7 +711,7 @@ WASM_EXEC_TEST(F64UConvertI64) {
}
WASM_EXEC_TEST(I64SConvertF32) {
- WasmRunner<int64_t, float> r(execution_mode);
+ WasmRunner<int64_t, float> r(execution_tier);
BUILD(r, WASM_I64_SCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
@@ -726,7 +726,7 @@ WASM_EXEC_TEST(I64SConvertF32) {
WASM_EXEC_TEST(I64SConvertSatF32) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
- WasmRunner<int64_t, float> r(execution_mode);
+ WasmRunner<int64_t, float> r(execution_tier);
BUILD(r, WASM_I64_SCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
int64_t expected;
@@ -746,7 +746,7 @@ WASM_EXEC_TEST(I64SConvertSatF32) {
}
WASM_EXEC_TEST(I64SConvertF64) {
- WasmRunner<int64_t, double> r(execution_mode);
+ WasmRunner<int64_t, double> r(execution_tier);
BUILD(r, WASM_I64_SCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
@@ -761,7 +761,7 @@ WASM_EXEC_TEST(I64SConvertF64) {
WASM_EXEC_TEST(I64SConvertSatF64) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
- WasmRunner<int64_t, double> r(execution_mode);
+ WasmRunner<int64_t, double> r(execution_tier);
BUILD(r, WASM_I64_SCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int64_t expected;
@@ -781,7 +781,7 @@ WASM_EXEC_TEST(I64SConvertSatF64) {
}
WASM_EXEC_TEST(I64UConvertF32) {
- WasmRunner<uint64_t, float> r(execution_mode);
+ WasmRunner<uint64_t, float> r(execution_tier);
BUILD(r, WASM_I64_UCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
@@ -796,7 +796,7 @@ WASM_EXEC_TEST(I64UConvertF32) {
WASM_EXEC_TEST(I64UConvertSatF32) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
- WasmRunner<int64_t, float> r(execution_mode);
+ WasmRunner<int64_t, float> r(execution_tier);
BUILD(r, WASM_I64_UCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
uint64_t expected;
@@ -816,7 +816,7 @@ WASM_EXEC_TEST(I64UConvertSatF32) {
}
WASM_EXEC_TEST(I64UConvertF64) {
- WasmRunner<uint64_t, double> r(execution_mode);
+ WasmRunner<uint64_t, double> r(execution_tier);
BUILD(r, WASM_I64_UCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
@@ -831,7 +831,7 @@ WASM_EXEC_TEST(I64UConvertF64) {
WASM_EXEC_TEST(I64UConvertSatF64) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
- WasmRunner<int64_t, double> r(execution_mode);
+ WasmRunner<int64_t, double> r(execution_tier);
BUILD(r, WASM_I64_UCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int64_t expected;
@@ -858,7 +858,7 @@ WASM_EXEC_TEST(CallI64Parameter) {
FunctionSig sig(1, 19, param_types);
for (int i = 0; i < 19; i++) {
if (i == 2 || i == 3) continue;
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// Build the target function.
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(i));
@@ -889,7 +889,7 @@ WASM_EXEC_TEST(CallI64Return) {
return_types[1] = kWasmI32;
FunctionSig sig(2, 1, return_types);
- WasmRunner<int64_t> r(execution_mode);
+ WasmRunner<int64_t> r(execution_tier);
// Build the target function.
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(0), WASM_I32V(7));
@@ -901,32 +901,32 @@ WASM_EXEC_TEST(CallI64Return) {
CHECK_EQ(0xBCD12340000000B, r.Call());
}
-void TestI64Binop(WasmExecutionMode execution_mode, WasmOpcode opcode,
+void TestI64Binop(ExecutionTier execution_tier, WasmOpcode opcode,
int64_t expected, int64_t a, int64_t b) {
{
- WasmRunner<int64_t> r(execution_mode);
+ WasmRunner<int64_t> r(execution_tier);
// return K op K
BUILD(r, WASM_BINOP(opcode, WASM_I64V(a), WASM_I64V(b)));
CHECK_EQ(expected, r.Call());
}
{
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
// return a op b
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(expected, r.Call(a, b));
}
}
-void TestI64Cmp(WasmExecutionMode execution_mode, WasmOpcode opcode,
+void TestI64Cmp(ExecutionTier execution_tier, WasmOpcode opcode,
int64_t expected, int64_t a, int64_t b) {
{
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// return K op K
BUILD(r, WASM_BINOP(opcode, WASM_I64V(a), WASM_I64V(b)));
CHECK_EQ(expected, r.Call());
}
{
- WasmRunner<int32_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int32_t, int64_t, int64_t> r(execution_tier);
// return a op b
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(expected, r.Call(a, b));
@@ -934,66 +934,66 @@ void TestI64Cmp(WasmExecutionMode execution_mode, WasmOpcode opcode,
}
WASM_EXEC_TEST(I64Binops) {
- TestI64Binop(execution_mode, kExprI64Add, -5586332274295447011,
+ TestI64Binop(execution_tier, kExprI64Add, -5586332274295447011,
0x501B72EBABC26847, 0x625DE9793D8F79D6);
- TestI64Binop(execution_mode, kExprI64Sub, 9001903251710731490,
+ TestI64Binop(execution_tier, kExprI64Sub, 9001903251710731490,
0xF24FE6474640002E, 0x7562B6F711991B4C);
- TestI64Binop(execution_mode, kExprI64Mul, -4569547818546064176,
+ TestI64Binop(execution_tier, kExprI64Mul, -4569547818546064176,
0x231A263C2CBC6451, 0xEAD44DE6BD3E23D0);
- TestI64Binop(execution_mode, kExprI64Mul, -25963122347507043,
+ TestI64Binop(execution_tier, kExprI64Mul, -25963122347507043,
0x4DA1FA47C9352B73, 0x91FE82317AA035AF);
- TestI64Binop(execution_mode, kExprI64Mul, 7640290486138131960,
+ TestI64Binop(execution_tier, kExprI64Mul, 7640290486138131960,
0x185731ABE8EEA47C, 0x714EC59F1380D4C2);
- TestI64Binop(execution_mode, kExprI64DivS, -91517, 0x93B1190A34DE56A0,
+ TestI64Binop(execution_tier, kExprI64DivS, -91517, 0x93B1190A34DE56A0,
0x00004D8F68863948);
- TestI64Binop(execution_mode, kExprI64DivU, 149016, 0xE15B3727E8A2080A,
+ TestI64Binop(execution_tier, kExprI64DivU, 149016, 0xE15B3727E8A2080A,
0x0000631BFA72DB8B);
- TestI64Binop(execution_mode, kExprI64RemS, -664128064149968,
+ TestI64Binop(execution_tier, kExprI64RemS, -664128064149968,
0x9A78B4E4FE708692, 0x0003E0B6B3BE7609);
- TestI64Binop(execution_mode, kExprI64RemU, 1742040017332765,
+ TestI64Binop(execution_tier, kExprI64RemU, 1742040017332765,
0x0CE84708C6258C81, 0x000A6FDE82016697);
- TestI64Binop(execution_mode, kExprI64And, 2531040582801836054,
+ TestI64Binop(execution_tier, kExprI64And, 2531040582801836054,
0xAF257D1602644A16, 0x33B290A91A10D997);
- TestI64Binop(execution_mode, kExprI64Ior, 8556201506536114940,
+ TestI64Binop(execution_tier, kExprI64Ior, 8556201506536114940,
0x169D9BE7BD3F0A5C, 0x66BCA28D77AF40E8);
- TestI64Binop(execution_mode, kExprI64Xor, -4605655183785456377,
+ TestI64Binop(execution_tier, kExprI64Xor, -4605655183785456377,
0xB6EA20A5D48E85B8, 0x76FF4DA6C80688BF);
- TestI64Binop(execution_mode, kExprI64Shl, -7240704056088331264,
+ TestI64Binop(execution_tier, kExprI64Shl, -7240704056088331264,
0xEF4DC1ED030E8FFE, 9);
- TestI64Binop(execution_mode, kExprI64ShrU, 12500673744059159,
+ TestI64Binop(execution_tier, kExprI64ShrU, 12500673744059159,
0xB1A52FA7DEEC5D14, 10);
- TestI64Binop(execution_mode, kExprI64ShrS, 1725103446999874,
+ TestI64Binop(execution_tier, kExprI64ShrS, 1725103446999874,
0x3107C791461A112B, 11);
- TestI64Binop(execution_mode, kExprI64Ror, -8960135652432576946,
+ TestI64Binop(execution_tier, kExprI64Ror, -8960135652432576946,
0x73418D1717E4E83A, 12);
- TestI64Binop(execution_mode, kExprI64Ror, 7617662827409989779,
+ TestI64Binop(execution_tier, kExprI64Ror, 7617662827409989779,
0xEBFF67CF0C126D36, 13);
- TestI64Binop(execution_mode, kExprI64Rol, -2097714064174346012,
+ TestI64Binop(execution_tier, kExprI64Rol, -2097714064174346012,
0x43938B8DB0B0F230, 14);
- TestI64Binop(execution_mode, kExprI64Rol, 8728493013947314237,
+ TestI64Binop(execution_tier, kExprI64Rol, 8728493013947314237,
0xE07AF243AC4D219D, 15);
}
WASM_EXEC_TEST(I64Compare) {
- TestI64Cmp(execution_mode, kExprI64Eq, 0, 0xB915D8FA494064F0,
+ TestI64Cmp(execution_tier, kExprI64Eq, 0, 0xB915D8FA494064F0,
0x04D700B2536019A3);
- TestI64Cmp(execution_mode, kExprI64Ne, 1, 0xC2FAFAAAB0446CDC,
+ TestI64Cmp(execution_tier, kExprI64Ne, 1, 0xC2FAFAAAB0446CDC,
0x52A3328F780C97A3);
- TestI64Cmp(execution_mode, kExprI64LtS, 0, 0x673636E6306B0578,
+ TestI64Cmp(execution_tier, kExprI64LtS, 0, 0x673636E6306B0578,
0x028EC9ECA78F7227);
- TestI64Cmp(execution_mode, kExprI64LeS, 1, 0xAE5214114B86A0FA,
+ TestI64Cmp(execution_tier, kExprI64LeS, 1, 0xAE5214114B86A0FA,
0x7C1D21DA3DFD0CCF);
- TestI64Cmp(execution_mode, kExprI64LtU, 0, 0x7D52166381EC1CE0,
+ TestI64Cmp(execution_tier, kExprI64LtU, 0, 0x7D52166381EC1CE0,
0x59F4A6A9E78CD3D8);
- TestI64Cmp(execution_mode, kExprI64LeU, 1, 0xE4169A385C7EA0E0,
+ TestI64Cmp(execution_tier, kExprI64LeU, 1, 0xE4169A385C7EA0E0,
0xFBDBED2C8781E5BC);
- TestI64Cmp(execution_mode, kExprI64GtS, 0, 0x9D08FF8FB5F42E81,
+ TestI64Cmp(execution_tier, kExprI64GtS, 0, 0x9D08FF8FB5F42E81,
0xD4E5C9D7FE09F621);
- TestI64Cmp(execution_mode, kExprI64GeS, 1, 0x78DA3B2F73264E0F,
+ TestI64Cmp(execution_tier, kExprI64GeS, 1, 0x78DA3B2F73264E0F,
0x6FE5E2A67C501CBE);
- TestI64Cmp(execution_mode, kExprI64GtU, 0, 0x8F691284E44F7DA9,
+ TestI64Cmp(execution_tier, kExprI64GtU, 0, 0x8F691284E44F7DA9,
0xD5EA9BC1EE149192);
- TestI64Cmp(execution_mode, kExprI64GeU, 0, 0x0886A0C58C7AA224,
+ TestI64Cmp(execution_tier, kExprI64GeU, 0, 0x0886A0C58C7AA224,
0x5DDBE5A81FD7EE47);
}
@@ -1035,7 +1035,7 @@ WASM_EXEC_TEST(I64Clz) {
{62, 0x0000000000000002}, {63, 0x0000000000000001},
{64, 0x0000000000000000}};
- WasmRunner<int64_t, uint64_t> r(execution_mode);
+ WasmRunner<int64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_CLZ(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(values[i].expected, r.Call(values[i].input));
@@ -1080,7 +1080,7 @@ WASM_EXEC_TEST(I64Ctz) {
{2, 0x000000009AFDBC84}, {1, 0x000000009AFDBC82},
{0, 0x000000009AFDBC81}};
- WasmRunner<int64_t, uint64_t> r(execution_mode);
+ WasmRunner<int64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_CTZ(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(values[i].expected, r.Call(values[i].input));
@@ -1097,7 +1097,7 @@ WASM_EXEC_TEST(I64Popcnt2) {
{26, 0x1123456782345678},
{38, 0xFFEDCBA09EDCBA09}};
- WasmRunner<int64_t, uint64_t> r(execution_mode);
+ WasmRunner<int64_t, uint64_t> r(execution_tier);
BUILD(r, WASM_I64_POPCNT(WASM_GET_LOCAL(0)));
for (size_t i = 0; i < arraysize(values); i++) {
CHECK_EQ(values[i].expected, r.Call(values[i].input));
@@ -1107,25 +1107,25 @@ 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_mode);
+ {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_mode);
+ 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_mode);
+ 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> r(execution_mode);
+ 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) {
@@ -1137,7 +1137,7 @@ WASM_EXEC_TEST(I64WasmRunner) {
}
}
{
- WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_mode);
+ 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),
@@ -1154,7 +1154,7 @@ WASM_EXEC_TEST(I64WasmRunner) {
}
WASM_EXEC_TEST(Call_Int64Sub) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
// Build the target function.
TestSignatures sigs;
WasmFunctionCompiler& t = r.NewFunction(sigs.l_ll());
@@ -1183,7 +1183,7 @@ WASM_EXEC_TEST(LoadStoreI64_sx) {
kExprI64LoadMem};
for (size_t m = 0; m < arraysize(loads); m++) {
- WasmRunner<int64_t> r(execution_mode);
+ WasmRunner<int64_t> r(execution_tier);
byte* memory = r.builder().AddMemoryElems<byte>(kWasmPageSize);
byte code[] = {
@@ -1222,7 +1222,7 @@ WASM_EXEC_TEST(LoadStoreI64_sx) {
WASM_EXEC_TEST(I64ReinterpretF64) {
- WasmRunner<int64_t> r(execution_mode);
+ WasmRunner<int64_t> r(execution_tier);
int64_t* memory =
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
@@ -1237,7 +1237,7 @@ WASM_EXEC_TEST(I64ReinterpretF64) {
}
WASM_EXEC_TEST(SignallingNanSurvivesI64ReinterpretF64) {
- WasmRunner<int64_t> r(execution_mode);
+ WasmRunner<int64_t> r(execution_tier);
BUILD(r, WASM_I64_REINTERPRET_F64(WASM_SEQ(kExprF64Const, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0xF4, 0x7F)));
@@ -1246,7 +1246,7 @@ WASM_EXEC_TEST(SignallingNanSurvivesI64ReinterpretF64) {
}
WASM_EXEC_TEST(F64ReinterpretI64) {
- WasmRunner<int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t> r(execution_tier);
int64_t* memory =
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
@@ -1262,7 +1262,7 @@ WASM_EXEC_TEST(F64ReinterpretI64) {
}
WASM_EXEC_TEST(LoadMemI64) {
- WasmRunner<int64_t> r(execution_mode);
+ WasmRunner<int64_t> r(execution_tier);
int64_t* memory =
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
r.builder().RandomizeMemory(1111);
@@ -1281,7 +1281,7 @@ WASM_EXEC_TEST(LoadMemI64) {
WASM_EXEC_TEST(LoadMemI64_alignment) {
for (byte alignment = 0; alignment <= 3; alignment++) {
- WasmRunner<int64_t> r(execution_mode);
+ WasmRunner<int64_t> r(execution_tier);
int64_t* memory =
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
r.builder().RandomizeMemory(1111);
@@ -1302,7 +1302,7 @@ WASM_EXEC_TEST(LoadMemI64_alignment) {
WASM_EXEC_TEST(MemI64_Sum) {
const int kNumElems = 20;
- WasmRunner<uint64_t, int32_t> r(execution_mode);
+ WasmRunner<uint64_t, int32_t> r(execution_tier);
uint64_t* memory =
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t));
const byte kSum = r.AllocateLocal(kWasmI64);
@@ -1334,7 +1334,7 @@ WASM_EXEC_TEST(StoreMemI64_alignment) {
const int64_t kWritten = 0x12345678ABCD0011ll;
for (byte i = 0; i <= 3; i++) {
- WasmRunner<int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t> r(execution_tier);
int64_t* memory =
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int64(), WASM_ZERO, i,
@@ -1349,7 +1349,7 @@ WASM_EXEC_TEST(StoreMemI64_alignment) {
}
WASM_EXEC_TEST(I64Global) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
int64_t* global = r.builder().AddGlobal<int64_t>();
// global = global + p0
BUILD(r, WASM_SET_GLOBAL(
@@ -1359,14 +1359,14 @@ WASM_EXEC_TEST(I64Global) {
r.builder().WriteMemory<int64_t>(global, 0xFFFFFFFFFFFFFFFFLL);
for (int i = 9; i < 444444; i += 111111) {
- int64_t expected = *global & i;
+ int64_t expected = ReadLittleEndianValue<int64_t>(global) & i;
r.Call(i);
- CHECK_EQ(expected, *global);
+ CHECK_EQ(expected, ReadLittleEndianValue<int64_t>(global));
}
}
WASM_EXEC_TEST(I64Eqz) {
- WasmRunner<int32_t, int64_t> r(execution_mode);
+ WasmRunner<int32_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_EQZ(WASM_GET_LOCAL(0)));
FOR_INT64_INPUTS(i) {
@@ -1376,7 +1376,7 @@ WASM_EXEC_TEST(I64Eqz) {
}
WASM_EXEC_TEST(I64Ror) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_ROR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
@@ -1388,7 +1388,7 @@ WASM_EXEC_TEST(I64Ror) {
}
WASM_EXEC_TEST(I64Rol) {
- WasmRunner<int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_UINT64_INPUTS(i) {
@@ -1409,7 +1409,7 @@ WASM_EXEC_TEST(StoreMem_offset_oob_i64) {
constexpr size_t num_bytes = kWasmPageSize;
for (size_t m = 0; m < arraysize(machineTypes); m++) {
- WasmRunner<int32_t, uint32_t> r(execution_mode);
+ WasmRunner<int32_t, uint32_t> r(execution_tier);
byte* memory = r.builder().AddMemoryElems<byte>(num_bytes);
r.builder().RandomizeMemory(1119 + static_cast<int>(m));
@@ -1436,7 +1436,7 @@ WASM_EXEC_TEST(Store_i64_narrowed) {
stored_size_in_bytes = std::max(1, stored_size_in_bytes * 2);
constexpr int kBytes = 24;
uint8_t expected_memory[kBytes] = {0};
- WasmRunner<int32_t, int32_t, int64_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int64_t> r(execution_tier);
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
constexpr uint64_t kPattern = 0x0123456789abcdef;
@@ -1459,14 +1459,14 @@ WASM_EXEC_TEST(Store_i64_narrowed) {
}
WASM_EXEC_TEST(UnalignedInt64Load) {
- WasmRunner<uint64_t> r(execution_mode);
+ WasmRunner<uint64_t> r(execution_tier);
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Int64(), WASM_ONE, 3));
r.Call();
}
WASM_EXEC_TEST(UnalignedInt64Store) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(int64_t));
BUILD(r, WASM_SEQ(WASM_STORE_MEM_ALIGNMENT(MachineType::Int64(), WASM_ONE, 3,
WASM_I64V_1(1)),
@@ -1480,12 +1480,12 @@ WASM_EXEC_TEST(UnalignedInt64Store) {
for (size_t i = 0; i < sizeof(__buf); i++) vec.push_back(__buf[i]); \
} while (false)
-static void CompileCallIndirectMany(WasmExecutionMode mode, ValueType param) {
+static void CompileCallIndirectMany(ExecutionTier tier, ValueType param) {
// Make sure we don't run out of registers when compiling indirect calls
// with many many parameters.
TestSignatures sigs;
for (byte num_params = 0; num_params < 40; num_params++) {
- WasmRunner<void> r(mode);
+ WasmRunner<void> r(tier);
FunctionSig* sig = sigs.many(r.zone(), kWasmStmt, param, num_params);
r.builder().AddSignature(sig);
@@ -1506,10 +1506,10 @@ static void CompileCallIndirectMany(WasmExecutionMode mode, ValueType param) {
}
WASM_EXEC_TEST(Compile_Wasm_CallIndirect_Many_i64) {
- CompileCallIndirectMany(execution_mode, kWasmI64);
+ CompileCallIndirectMany(execution_tier, kWasmI64);
}
-static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
+static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) {
const int kExpected = 6333;
const int kElemSize = 8;
TestSignatures sigs;
@@ -1525,7 +1525,7 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
for (int which = 0; which < num_params; which++) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
MachineType* memtypes = &mixed[start];
MachineType result = memtypes[which];
@@ -1584,13 +1584,13 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
}
}
-WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_mode, 0); }
-WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_mode, 1); }
-WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_mode, 2); }
-WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_mode, 3); }
+WASM_EXEC_TEST(MixedCall_i64_0) { Run_WasmMixedCall_N(execution_tier, 0); }
+WASM_EXEC_TEST(MixedCall_i64_1) { Run_WasmMixedCall_N(execution_tier, 1); }
+WASM_EXEC_TEST(MixedCall_i64_2) { Run_WasmMixedCall_N(execution_tier, 2); }
+WASM_EXEC_TEST(MixedCall_i64_3) { Run_WasmMixedCall_N(execution_tier, 3); }
WASM_EXEC_TEST(Regress5874) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemoryElems<int64_t>(kWasmPageSize / sizeof(int64_t));
BUILD(r, kExprI64Const, 0x00, // --
@@ -1604,7 +1604,7 @@ WASM_EXEC_TEST(Regress5874) {
WASM_EXEC_TEST(Regression_6858) {
// WasmRunner with 5 params and returns, which is the maximum.
- WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t, int64_t, int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
int64_t dividend = 15;
int64_t divisor = 0;
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 9e15c46f8d..fc9e395d44 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc
@@ -20,7 +20,7 @@ namespace internal {
namespace wasm {
WASM_EXEC_TEST(Int32AsmjsDivS) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsDivS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
@@ -32,7 +32,7 @@ WASM_EXEC_TEST(Int32AsmjsDivS) {
}
WASM_EXEC_TEST(Int32AsmjsRemS) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsRemS, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
@@ -44,7 +44,7 @@ WASM_EXEC_TEST(Int32AsmjsRemS) {
}
WASM_EXEC_TEST(Int32AsmjsDivU) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsDivU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
@@ -56,7 +56,7 @@ WASM_EXEC_TEST(Int32AsmjsDivU) {
}
WASM_EXEC_TEST(Int32AsmjsRemU) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_BINOP(kExprI32AsmjsRemU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
@@ -68,7 +68,7 @@ WASM_EXEC_TEST(Int32AsmjsRemU) {
}
WASM_EXEC_TEST(I32AsmjsSConvertF32) {
- WasmRunner<int32_t, float> r(execution_mode);
+ WasmRunner<int32_t, float> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0)));
@@ -79,7 +79,7 @@ WASM_EXEC_TEST(I32AsmjsSConvertF32) {
}
WASM_EXEC_TEST(I32AsmjsSConvertF64) {
- WasmRunner<int32_t, double> r(execution_mode);
+ WasmRunner<int32_t, double> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0)));
@@ -90,7 +90,7 @@ WASM_EXEC_TEST(I32AsmjsSConvertF64) {
}
WASM_EXEC_TEST(I32AsmjsUConvertF32) {
- WasmRunner<uint32_t, float> r(execution_mode);
+ WasmRunner<uint32_t, float> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0)));
@@ -101,7 +101,7 @@ WASM_EXEC_TEST(I32AsmjsUConvertF32) {
}
WASM_EXEC_TEST(I32AsmjsUConvertF64) {
- WasmRunner<uint32_t, double> r(execution_mode);
+ WasmRunner<uint32_t, double> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0)));
@@ -112,7 +112,7 @@ WASM_EXEC_TEST(I32AsmjsUConvertF64) {
}
WASM_EXEC_TEST(LoadMemI32_oob_asm) {
- WasmRunner<int32_t, uint32_t> r(execution_mode);
+ WasmRunner<int32_t, uint32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
int32_t* memory = r.builder().AddMemoryElems<int32_t>(8);
r.builder().RandomizeMemory(1112);
@@ -132,7 +132,7 @@ WASM_EXEC_TEST(LoadMemI32_oob_asm) {
}
WASM_EXEC_TEST(LoadMemF32_oob_asm) {
- WasmRunner<float, uint32_t> r(execution_mode);
+ WasmRunner<float, uint32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
float* memory = r.builder().AddMemoryElems<float>(8);
r.builder().RandomizeMemory(1112);
@@ -152,7 +152,7 @@ WASM_EXEC_TEST(LoadMemF32_oob_asm) {
}
WASM_EXEC_TEST(LoadMemF64_oob_asm) {
- WasmRunner<double, uint32_t> r(execution_mode);
+ WasmRunner<double, uint32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
double* memory = r.builder().AddMemoryElems<double>(8);
r.builder().RandomizeMemory(1112);
@@ -174,7 +174,7 @@ WASM_EXEC_TEST(LoadMemF64_oob_asm) {
}
WASM_EXEC_TEST(StoreMemI32_oob_asm) {
- WasmRunner<int32_t, uint32_t, uint32_t> r(execution_mode);
+ WasmRunner<int32_t, uint32_t, uint32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
int32_t* memory = r.builder().AddMemoryElems<int32_t>(8);
r.builder().RandomizeMemory(1112);
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 fca190440f..96877fd571 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-atomics.cc
@@ -10,10 +10,10 @@ namespace internal {
namespace wasm {
namespace test_run_wasm_atomics {
-void RunU32BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
+void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
Uint32BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t, uint32_t> r(execution_mode);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
r.builder().SetHasSharedMemory();
@@ -33,28 +33,28 @@ void RunU32BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I32AtomicAdd) {
- RunU32BinOp(execution_mode, kExprI32AtomicAdd, Add);
+ RunU32BinOp(execution_tier, kExprI32AtomicAdd, Add);
}
WASM_EXEC_TEST(I32AtomicSub) {
- RunU32BinOp(execution_mode, kExprI32AtomicSub, Sub);
+ RunU32BinOp(execution_tier, kExprI32AtomicSub, Sub);
}
WASM_EXEC_TEST(I32AtomicAnd) {
- RunU32BinOp(execution_mode, kExprI32AtomicAnd, And);
+ RunU32BinOp(execution_tier, kExprI32AtomicAnd, And);
}
WASM_EXEC_TEST(I32AtomicOr) {
- RunU32BinOp(execution_mode, kExprI32AtomicOr, Or);
+ RunU32BinOp(execution_tier, kExprI32AtomicOr, Or);
}
WASM_EXEC_TEST(I32AtomicXor) {
- RunU32BinOp(execution_mode, kExprI32AtomicXor, Xor);
+ RunU32BinOp(execution_tier, kExprI32AtomicXor, Xor);
}
WASM_EXEC_TEST(I32AtomicExchange) {
- RunU32BinOp(execution_mode, kExprI32AtomicExchange, Exchange);
+ RunU32BinOp(execution_tier, kExprI32AtomicExchange, Exchange);
}
-void RunU16BinOp(WasmExecutionMode mode, WasmOpcode wasm_op,
+void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op,
Uint16BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t, uint32_t> r(mode);
+ WasmRunner<uint32_t, uint32_t> r(tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
@@ -74,28 +74,28 @@ void RunU16BinOp(WasmExecutionMode mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I32AtomicAdd16U) {
- RunU16BinOp(execution_mode, kExprI32AtomicAdd16U, Add);
+ RunU16BinOp(execution_tier, kExprI32AtomicAdd16U, Add);
}
WASM_EXEC_TEST(I32AtomicSub16U) {
- RunU16BinOp(execution_mode, kExprI32AtomicSub16U, Sub);
+ RunU16BinOp(execution_tier, kExprI32AtomicSub16U, Sub);
}
WASM_EXEC_TEST(I32AtomicAnd16U) {
- RunU16BinOp(execution_mode, kExprI32AtomicAnd16U, And);
+ RunU16BinOp(execution_tier, kExprI32AtomicAnd16U, And);
}
WASM_EXEC_TEST(I32AtomicOr16U) {
- RunU16BinOp(execution_mode, kExprI32AtomicOr16U, Or);
+ RunU16BinOp(execution_tier, kExprI32AtomicOr16U, Or);
}
WASM_EXEC_TEST(I32AtomicXor16U) {
- RunU16BinOp(execution_mode, kExprI32AtomicXor16U, Xor);
+ RunU16BinOp(execution_tier, kExprI32AtomicXor16U, Xor);
}
WASM_EXEC_TEST(I32AtomicExchange16U) {
- RunU16BinOp(execution_mode, kExprI32AtomicExchange16U, Exchange);
+ RunU16BinOp(execution_tier, kExprI32AtomicExchange16U, Exchange);
}
-void RunU8BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
+void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
Uint8BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t, uint32_t> r(execution_mode);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
@@ -114,27 +114,27 @@ void RunU8BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I32AtomicAdd8U) {
- RunU8BinOp(execution_mode, kExprI32AtomicAdd8U, Add);
+ RunU8BinOp(execution_tier, kExprI32AtomicAdd8U, Add);
}
WASM_EXEC_TEST(I32AtomicSub8U) {
- RunU8BinOp(execution_mode, kExprI32AtomicSub8U, Sub);
+ RunU8BinOp(execution_tier, kExprI32AtomicSub8U, Sub);
}
WASM_EXEC_TEST(I32AtomicAnd8U) {
- RunU8BinOp(execution_mode, kExprI32AtomicAnd8U, And);
+ RunU8BinOp(execution_tier, kExprI32AtomicAnd8U, And);
}
WASM_EXEC_TEST(I32AtomicOr8U) {
- RunU8BinOp(execution_mode, kExprI32AtomicOr8U, Or);
+ RunU8BinOp(execution_tier, kExprI32AtomicOr8U, Or);
}
WASM_EXEC_TEST(I32AtomicXor8U) {
- RunU8BinOp(execution_mode, kExprI32AtomicXor8U, Xor);
+ RunU8BinOp(execution_tier, kExprI32AtomicXor8U, Xor);
}
WASM_EXEC_TEST(I32AtomicExchange8U) {
- RunU8BinOp(execution_mode, kExprI32AtomicExchange8U, Exchange);
+ RunU8BinOp(execution_tier, kExprI32AtomicExchange8U, Exchange);
}
WASM_EXEC_TEST(I32AtomicCompareExchange) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
+ 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));
@@ -155,7 +155,7 @@ WASM_EXEC_TEST(I32AtomicCompareExchange) {
WASM_EXEC_TEST(I32AtomicCompareExchange16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
+ WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
@@ -177,7 +177,7 @@ WASM_EXEC_TEST(I32AtomicCompareExchange16U) {
WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
+ WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
BUILD(r,
@@ -198,7 +198,7 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
WASM_EXEC_TEST(I32AtomicLoad) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t> r(execution_mode);
+ WasmRunner<uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
@@ -214,7 +214,7 @@ WASM_EXEC_TEST(I32AtomicLoad) {
WASM_EXEC_TEST(I32AtomicLoad16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t> r(execution_mode);
+ WasmRunner<uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
@@ -230,7 +230,7 @@ WASM_EXEC_TEST(I32AtomicLoad16U) {
WASM_EXEC_TEST(I32AtomicLoad8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t> r(execution_mode);
+ WasmRunner<uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
BUILD(r, WASM_ATOMICS_LOAD_OP(kExprI32AtomicLoad8U, WASM_ZERO,
@@ -245,7 +245,7 @@ WASM_EXEC_TEST(I32AtomicLoad8U) {
WASM_EXEC_TEST(I32AtomicStoreLoad) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t, uint32_t> r(execution_mode);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
@@ -265,7 +265,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad) {
WASM_EXEC_TEST(I32AtomicStoreLoad16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t, uint32_t> r(execution_mode);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
@@ -286,7 +286,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad16U) {
WASM_EXEC_TEST(I32AtomicStoreLoad8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t, uint32_t> r(execution_mode);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
@@ -305,7 +305,7 @@ WASM_EXEC_TEST(I32AtomicStoreLoad8U) {
WASM_EXEC_TEST(I32AtomicStoreParameter) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint32_t, uint32_t> r(execution_mode);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
r.builder().SetHasSharedMemory();
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 48169db191..21b943595a 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-atomics64.cc
@@ -10,10 +10,10 @@ namespace internal {
namespace wasm {
namespace test_run_wasm_atomics_64 {
-void RunU64BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
+void RunU64BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
Uint64BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t> r(execution_tier);
uint64_t* memory =
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t));
r.builder().SetHasSharedMemory();
@@ -33,28 +33,28 @@ void RunU64BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I64AtomicAdd) {
- RunU64BinOp(execution_mode, kExprI64AtomicAdd, Add);
+ RunU64BinOp(execution_tier, kExprI64AtomicAdd, Add);
}
WASM_EXEC_TEST(I64AtomicSub) {
- RunU64BinOp(execution_mode, kExprI64AtomicSub, Sub);
+ RunU64BinOp(execution_tier, kExprI64AtomicSub, Sub);
}
WASM_EXEC_TEST(I64AtomicAnd) {
- RunU64BinOp(execution_mode, kExprI64AtomicAnd, And);
+ RunU64BinOp(execution_tier, kExprI64AtomicAnd, And);
}
WASM_EXEC_TEST(I64AtomicOr) {
- RunU64BinOp(execution_mode, kExprI64AtomicOr, Or);
+ RunU64BinOp(execution_tier, kExprI64AtomicOr, Or);
}
WASM_EXEC_TEST(I64AtomicXor) {
- RunU64BinOp(execution_mode, kExprI64AtomicXor, Xor);
+ RunU64BinOp(execution_tier, kExprI64AtomicXor, Xor);
}
WASM_EXEC_TEST(I64AtomicExchange) {
- RunU64BinOp(execution_mode, kExprI64AtomicExchange, Exchange);
+ RunU64BinOp(execution_tier, kExprI64AtomicExchange, Exchange);
}
-void RunU32BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
+void RunU32BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
Uint32BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t> r(execution_tier);
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
r.builder().SetHasSharedMemory();
@@ -74,28 +74,28 @@ void RunU32BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I64AtomicAdd32U) {
- RunU32BinOp(execution_mode, kExprI64AtomicAdd32U, Add);
+ RunU32BinOp(execution_tier, kExprI64AtomicAdd32U, Add);
}
WASM_EXEC_TEST(I64AtomicSub32U) {
- RunU32BinOp(execution_mode, kExprI64AtomicSub32U, Sub);
+ RunU32BinOp(execution_tier, kExprI64AtomicSub32U, Sub);
}
WASM_EXEC_TEST(I64AtomicAnd32U) {
- RunU32BinOp(execution_mode, kExprI64AtomicAnd32U, And);
+ RunU32BinOp(execution_tier, kExprI64AtomicAnd32U, And);
}
WASM_EXEC_TEST(I64AtomicOr32U) {
- RunU32BinOp(execution_mode, kExprI64AtomicOr32U, Or);
+ RunU32BinOp(execution_tier, kExprI64AtomicOr32U, Or);
}
WASM_EXEC_TEST(I64AtomicXor32U) {
- RunU32BinOp(execution_mode, kExprI64AtomicXor32U, Xor);
+ RunU32BinOp(execution_tier, kExprI64AtomicXor32U, Xor);
}
WASM_EXEC_TEST(I64AtomicExchange32U) {
- RunU32BinOp(execution_mode, kExprI64AtomicExchange32U, Exchange);
+ RunU32BinOp(execution_tier, kExprI64AtomicExchange32U, Exchange);
}
-void RunU16BinOp(WasmExecutionMode mode, WasmOpcode wasm_op,
+void RunU16BinOp(ExecutionTier tier, WasmOpcode wasm_op,
Uint16BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t> r(mode);
+ WasmRunner<uint64_t, uint64_t> r(tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
@@ -115,28 +115,28 @@ void RunU16BinOp(WasmExecutionMode mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I64AtomicAdd16U) {
- RunU16BinOp(execution_mode, kExprI64AtomicAdd16U, Add);
+ RunU16BinOp(execution_tier, kExprI64AtomicAdd16U, Add);
}
WASM_EXEC_TEST(I64AtomicSub16U) {
- RunU16BinOp(execution_mode, kExprI64AtomicSub16U, Sub);
+ RunU16BinOp(execution_tier, kExprI64AtomicSub16U, Sub);
}
WASM_EXEC_TEST(I64AtomicAnd16U) {
- RunU16BinOp(execution_mode, kExprI64AtomicAnd16U, And);
+ RunU16BinOp(execution_tier, kExprI64AtomicAnd16U, And);
}
WASM_EXEC_TEST(I64AtomicOr16U) {
- RunU16BinOp(execution_mode, kExprI64AtomicOr16U, Or);
+ RunU16BinOp(execution_tier, kExprI64AtomicOr16U, Or);
}
WASM_EXEC_TEST(I64AtomicXor16U) {
- RunU16BinOp(execution_mode, kExprI64AtomicXor16U, Xor);
+ RunU16BinOp(execution_tier, kExprI64AtomicXor16U, Xor);
}
WASM_EXEC_TEST(I64AtomicExchange16U) {
- RunU16BinOp(execution_mode, kExprI64AtomicExchange16U, Exchange);
+ RunU16BinOp(execution_tier, kExprI64AtomicExchange16U, Exchange);
}
-void RunU8BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
+void RunU8BinOp(ExecutionTier execution_tier, WasmOpcode wasm_op,
Uint8BinOp expected_op) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
@@ -155,27 +155,27 @@ void RunU8BinOp(WasmExecutionMode execution_mode, WasmOpcode wasm_op,
}
WASM_EXEC_TEST(I64AtomicAdd8U) {
- RunU8BinOp(execution_mode, kExprI64AtomicAdd8U, Add);
+ RunU8BinOp(execution_tier, kExprI64AtomicAdd8U, Add);
}
WASM_EXEC_TEST(I64AtomicSub8U) {
- RunU8BinOp(execution_mode, kExprI64AtomicSub8U, Sub);
+ RunU8BinOp(execution_tier, kExprI64AtomicSub8U, Sub);
}
WASM_EXEC_TEST(I64AtomicAnd8U) {
- RunU8BinOp(execution_mode, kExprI64AtomicAnd8U, And);
+ RunU8BinOp(execution_tier, kExprI64AtomicAnd8U, And);
}
WASM_EXEC_TEST(I64AtomicOr8U) {
- RunU8BinOp(execution_mode, kExprI64AtomicOr8U, Or);
+ RunU8BinOp(execution_tier, kExprI64AtomicOr8U, Or);
}
WASM_EXEC_TEST(I64AtomicXor8U) {
- RunU8BinOp(execution_mode, kExprI64AtomicXor8U, Xor);
+ RunU8BinOp(execution_tier, kExprI64AtomicXor8U, Xor);
}
WASM_EXEC_TEST(I64AtomicExchange8U) {
- RunU8BinOp(execution_mode, kExprI64AtomicExchange8U, Exchange);
+ RunU8BinOp(execution_tier, kExprI64AtomicExchange8U, Exchange);
}
WASM_EXEC_TEST(I64AtomicCompareExchange) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint64_t* memory =
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t));
@@ -196,7 +196,7 @@ WASM_EXEC_TEST(I64AtomicCompareExchange) {
WASM_EXEC_TEST(I64AtomicCompareExchange32U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
@@ -218,7 +218,7 @@ WASM_EXEC_TEST(I64AtomicCompareExchange32U) {
WASM_EXEC_TEST(I64AtomicCompareExchange16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
@@ -240,7 +240,7 @@ WASM_EXEC_TEST(I64AtomicCompareExchange16U) {
WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
BUILD(r,
@@ -260,7 +260,7 @@ WASM_EXEC_TEST(I32AtomicCompareExchange8U) {
WASM_EXEC_TEST(I64AtomicLoad) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t> r(execution_mode);
+ WasmRunner<uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint64_t* memory =
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t));
@@ -276,7 +276,7 @@ WASM_EXEC_TEST(I64AtomicLoad) {
WASM_EXEC_TEST(I64AtomicLoad32U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t> r(execution_mode);
+ WasmRunner<uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
@@ -292,7 +292,7 @@ WASM_EXEC_TEST(I64AtomicLoad32U) {
WASM_EXEC_TEST(I64AtomicLoad16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t> r(execution_mode);
+ WasmRunner<uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
@@ -308,7 +308,7 @@ WASM_EXEC_TEST(I64AtomicLoad16U) {
WASM_EXEC_TEST(I64AtomicLoad8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t> r(execution_mode);
+ WasmRunner<uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
BUILD(r, WASM_ATOMICS_LOAD_OP(kExprI64AtomicLoad8U, WASM_ZERO,
@@ -323,7 +323,7 @@ WASM_EXEC_TEST(I64AtomicLoad8U) {
WASM_EXEC_TEST(I64AtomicStoreLoad) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint64_t* memory =
r.builder().AddMemoryElems<uint64_t>(kWasmPageSize / sizeof(uint64_t));
@@ -343,7 +343,7 @@ WASM_EXEC_TEST(I64AtomicStoreLoad) {
WASM_EXEC_TEST(I64AtomicStoreLoad32U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
@@ -364,7 +364,7 @@ WASM_EXEC_TEST(I64AtomicStoreLoad32U) {
WASM_EXEC_TEST(I64AtomicStoreLoad16U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint16_t* memory =
r.builder().AddMemoryElems<uint16_t>(kWasmPageSize / sizeof(uint16_t));
@@ -385,7 +385,7 @@ WASM_EXEC_TEST(I64AtomicStoreLoad16U) {
WASM_EXEC_TEST(I64AtomicStoreLoad8U) {
EXPERIMENTAL_FLAG_SCOPE(threads);
- WasmRunner<uint64_t, uint64_t> r(execution_mode);
+ WasmRunner<uint64_t, uint64_t> r(execution_tier);
r.builder().SetHasSharedMemory();
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
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 76ca00cb3b..f788cc84b6 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc
@@ -22,7 +22,7 @@ namespace wasm {
namespace test_run_wasm_interpreter {
TEST(Run_WasmInt8Const_i) {
- WasmRunner<int32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t> r(ExecutionTier::kInterpreter);
const byte kExpectedValue = 109;
// return(kExpectedValue)
BUILD(r, WASM_I32V_2(kExpectedValue));
@@ -30,14 +30,14 @@ TEST(Run_WasmInt8Const_i) {
}
TEST(Run_WasmIfElse) {
- WasmRunner<int32_t, int32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t, int32_t> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I32V_1(9), WASM_I32V_1(10)));
CHECK_EQ(10, r.Call(0));
CHECK_EQ(9, r.Call(1));
}
TEST(Run_WasmIfReturn) {
- WasmRunner<int32_t, int32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t, int32_t> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_RETURN1(WASM_I32V_2(77))),
WASM_I32V_2(65));
CHECK_EQ(65, r.Call(0));
@@ -53,7 +53,7 @@ TEST(Run_WasmNopsN) {
code[nops] = kExprI32Const;
code[nops + 1] = expected;
- WasmRunner<int32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + nops + 2);
CHECK_EQ(expected, r.Call());
}
@@ -76,7 +76,7 @@ TEST(Run_WasmConstsN) {
}
}
- WasmRunner<int32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + (count * 3));
CHECK_EQ(expected, r.Call());
}
@@ -95,7 +95,7 @@ TEST(Run_WasmBlocksN) {
code[2 + nops + 1] = expected;
code[2 + nops + 2] = kExprEnd;
- WasmRunner<int32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + nops + kExtra);
CHECK_EQ(expected, r.Call());
}
@@ -120,7 +120,7 @@ TEST(Run_WasmBlockBreakN) {
code[2 + index + 2] = kExprBr;
code[2 + index + 3] = 0;
- WasmRunner<int32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + kMaxNops + kExtra);
CHECK_EQ(expected, r.Call());
}
@@ -128,7 +128,7 @@ TEST(Run_WasmBlockBreakN) {
}
TEST(Run_Wasm_nested_ifs_i) {
- WasmRunner<int32_t, int32_t, int32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t, int32_t, int32_t> r(ExecutionTier::kInterpreter);
BUILD(
r,
@@ -178,7 +178,7 @@ TEST(Breakpoint_I32Add) {
Find(code, sizeof(code), kNumBreakpoints, kExprGetLocal, kExprGetLocal,
kExprI32Add);
- WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t, uint32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + arraysize(code));
@@ -217,7 +217,7 @@ TEST(Step_I32Mul) {
static const int kTraceLength = 4;
byte code[] = {WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))};
- WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t, uint32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + arraysize(code));
@@ -255,7 +255,7 @@ TEST(Breakpoint_I32And_disable) {
std::unique_ptr<int[]> offsets =
Find(code, sizeof(code), kNumBreakpoints, kExprI32And);
- WasmRunner<int32_t, uint32_t, uint32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t, uint32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.Build(code, code + arraysize(code));
@@ -293,14 +293,14 @@ TEST(Breakpoint_I32And_disable) {
TEST(GrowMemory) {
{
- WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
r.builder().SetMaxMemPages(10);
BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0)));
CHECK_EQ(1, r.Call(1));
}
{
- WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
r.builder().SetMaxMemPages(10);
BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0)));
@@ -311,7 +311,7 @@ TEST(GrowMemory) {
TEST(GrowMemoryPreservesData) {
int32_t index = 16;
int32_t value = 2335;
- WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index),
WASM_I32V(value)),
@@ -322,7 +322,7 @@ TEST(GrowMemoryPreservesData) {
TEST(GrowMemoryInvalidSize) {
// Grow memory by an invalid amount without initial memory.
- WasmRunner<int32_t, uint32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t, uint32_t> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0)));
CHECK_EQ(-1, r.Call(1048575));
@@ -330,7 +330,7 @@ TEST(GrowMemoryInvalidSize) {
TEST(TestPossibleNondeterminism) {
{
- WasmRunner<int32_t, float> r(kExecuteInterpreter);
+ WasmRunner<int32_t, float> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_I32_REINTERPRET_F32(WASM_GET_LOCAL(0)));
r.Call(1048575.5f);
CHECK(!r.possible_nondeterminism());
@@ -338,7 +338,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
- WasmRunner<int64_t, double> r(kExecuteInterpreter);
+ WasmRunner<int64_t, double> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_I64_REINTERPRET_F64(WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
@@ -346,7 +346,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
- WasmRunner<float, float> r(kExecuteInterpreter);
+ WasmRunner<float, float> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F32_COPYSIGN(WASM_F32(42.0f), WASM_GET_LOCAL(0)));
r.Call(16.0f);
CHECK(!r.possible_nondeterminism());
@@ -354,7 +354,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
- WasmRunner<double, double> r(kExecuteInterpreter);
+ WasmRunner<double, double> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F64_COPYSIGN(WASM_F64(42.0), WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
@@ -363,7 +363,7 @@ TEST(TestPossibleNondeterminism) {
}
{
int32_t index = 16;
- WasmRunner<int32_t, float> r(kExecuteInterpreter);
+ WasmRunner<int32_t, float> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_STORE_MEM(MachineType::Float32(), WASM_I32V(index),
WASM_GET_LOCAL(0)),
@@ -375,7 +375,7 @@ TEST(TestPossibleNondeterminism) {
}
{
int32_t index = 16;
- WasmRunner<int32_t, double> r(kExecuteInterpreter);
+ WasmRunner<int32_t, double> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_STORE_MEM(MachineType::Float64(), WASM_I32V(index),
WASM_GET_LOCAL(0)),
@@ -386,7 +386,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
- WasmRunner<float, float> r(kExecuteInterpreter);
+ WasmRunner<float, float> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(1048575.5f);
CHECK(!r.possible_nondeterminism());
@@ -394,7 +394,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(r.possible_nondeterminism());
}
{
- WasmRunner<double, double> r(kExecuteInterpreter);
+ WasmRunner<double, double> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
@@ -402,7 +402,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(r.possible_nondeterminism());
}
{
- WasmRunner<int32_t, float> r(kExecuteInterpreter);
+ WasmRunner<int32_t, float> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F32_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
@@ -410,7 +410,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
- WasmRunner<int32_t, double> r(kExecuteInterpreter);
+ WasmRunner<int32_t, double> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F64_EQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
@@ -418,7 +418,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(!r.possible_nondeterminism());
}
{
- WasmRunner<float, float> r(kExecuteInterpreter);
+ WasmRunner<float, float> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F32_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(1048575.5f);
CHECK(!r.possible_nondeterminism());
@@ -426,7 +426,7 @@ TEST(TestPossibleNondeterminism) {
CHECK(r.possible_nondeterminism());
}
{
- WasmRunner<double, double> r(kExecuteInterpreter);
+ WasmRunner<double, double> r(ExecutionTier::kInterpreter);
BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)));
r.Call(16.0);
CHECK(!r.possible_nondeterminism());
@@ -436,7 +436,7 @@ TEST(TestPossibleNondeterminism) {
}
TEST(WasmInterpreterActivations) {
- WasmRunner<void> r(kExecuteInterpreter);
+ WasmRunner<void> r(ExecutionTier::kInterpreter);
Isolate* isolate = r.main_isolate();
BUILD(r, WASM_NOP);
@@ -466,7 +466,7 @@ TEST(WasmInterpreterActivations) {
}
TEST(InterpreterLoadWithoutMemory) {
- WasmRunner<int32_t, int32_t> r(kExecuteInterpreter);
+ WasmRunner<int32_t, int32_t> r(ExecutionTier::kInterpreter);
r.builder().AddMemory(0);
BUILD(r, WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(0)));
CHECK_TRAP32(r.Call(0));
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 2b62119d25..b9de081c9f 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-js.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-js.cc
@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <string.h>
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/assembler-inl.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/value-helper.h"
@@ -96,7 +96,7 @@ void EXPECT_CALL(double expected, Handle<JSFunction> jsfunc, double a,
} // namespace
WASM_EXEC_TEST(Run_Int32Sub_jswrapped) {
- WasmRunner<int, int, int> r(execution_mode);
+ 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);
@@ -105,7 +105,7 @@ WASM_EXEC_TEST(Run_Int32Sub_jswrapped) {
}
WASM_EXEC_TEST(Run_Float32Div_jswrapped) {
- WasmRunner<float, float, float> r(execution_mode);
+ 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);
@@ -114,7 +114,7 @@ WASM_EXEC_TEST(Run_Float32Div_jswrapped) {
}
WASM_EXEC_TEST(Run_Float64Add_jswrapped) {
- WasmRunner<double, double, double> r(execution_mode);
+ 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);
@@ -123,7 +123,7 @@ WASM_EXEC_TEST(Run_Float64Add_jswrapped) {
}
WASM_EXEC_TEST(Run_I32Popcount_jswrapped) {
- WasmRunner<int, int> r(execution_mode);
+ 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);
@@ -140,7 +140,7 @@ WASM_EXEC_TEST(Run_CallJS_Add_jswrapped) {
Handle<JSFunction>::cast(v8::Utils::OpenHandle(
*v8::Local<v8::Function>::Cast(CompileRun(source))));
ManuallyImportedJSFunction import = {sigs.i_i(), js_function};
- WasmRunner<int, int> r(execution_mode, &import);
+ WasmRunner<int, int> r(execution_tier, &import);
uint32_t js_index = 0;
WasmFunctionCompiler& t = r.NewFunction(sigs.i_i());
@@ -153,7 +153,7 @@ WASM_EXEC_TEST(Run_CallJS_Add_jswrapped) {
EXPECT_CALL(-666666801, jsfunc, -666666900, -1);
}
-void RunJSSelectTest(WasmExecutionMode mode, int which) {
+void RunJSSelectTest(ExecutionTier tier, int which) {
const int kMaxParams = 8;
PredictableInputValues inputs(0x100);
ValueType type = kWasmF64;
@@ -164,7 +164,7 @@ void RunJSSelectTest(WasmExecutionMode mode, int which) {
FunctionSig sig(1, num_params, types);
ManuallyImportedJSFunction import = CreateJSSelector(&sig, which);
- WasmRunner<void> r(mode, &import);
+ WasmRunner<void> r(tier, &import);
uint32_t js_index = 0;
WasmFunctionCompiler& t = r.NewFunction(&sig);
@@ -191,45 +191,45 @@ void RunJSSelectTest(WasmExecutionMode mode, int which) {
WASM_EXEC_TEST(Run_JSSelect_0) {
CcTest::InitializeVM();
- RunJSSelectTest(execution_mode, 0);
+ RunJSSelectTest(execution_tier, 0);
}
WASM_EXEC_TEST(Run_JSSelect_1) {
CcTest::InitializeVM();
- RunJSSelectTest(execution_mode, 1);
+ RunJSSelectTest(execution_tier, 1);
}
WASM_EXEC_TEST(Run_JSSelect_2) {
CcTest::InitializeVM();
- RunJSSelectTest(execution_mode, 2);
+ RunJSSelectTest(execution_tier, 2);
}
WASM_EXEC_TEST(Run_JSSelect_3) {
CcTest::InitializeVM();
- RunJSSelectTest(execution_mode, 3);
+ RunJSSelectTest(execution_tier, 3);
}
WASM_EXEC_TEST(Run_JSSelect_4) {
CcTest::InitializeVM();
- RunJSSelectTest(execution_mode, 4);
+ RunJSSelectTest(execution_tier, 4);
}
WASM_EXEC_TEST(Run_JSSelect_5) {
CcTest::InitializeVM();
- RunJSSelectTest(execution_mode, 5);
+ RunJSSelectTest(execution_tier, 5);
}
WASM_EXEC_TEST(Run_JSSelect_6) {
CcTest::InitializeVM();
- RunJSSelectTest(execution_mode, 6);
+ RunJSSelectTest(execution_tier, 6);
}
WASM_EXEC_TEST(Run_JSSelect_7) {
CcTest::InitializeVM();
- RunJSSelectTest(execution_mode, 7);
+ RunJSSelectTest(execution_tier, 7);
}
-void RunWASMSelectTest(WasmExecutionMode mode, int which) {
+void RunWASMSelectTest(ExecutionTier tier, int which) {
PredictableInputValues inputs(0x200);
Isolate* isolate = CcTest::InitIsolateOnce();
const int kMaxParams = 8;
@@ -239,7 +239,7 @@ void RunWASMSelectTest(WasmExecutionMode mode, int which) {
type, type, type, type};
FunctionSig sig(1, num_params, types);
- WasmRunner<void> r(mode);
+ WasmRunner<void> r(tier);
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(which));
Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
@@ -262,46 +262,45 @@ void RunWASMSelectTest(WasmExecutionMode mode, int which) {
WASM_EXEC_TEST(Run_WASMSelect_0) {
CcTest::InitializeVM();
- RunWASMSelectTest(execution_mode, 0);
+ RunWASMSelectTest(execution_tier, 0);
}
WASM_EXEC_TEST(Run_WASMSelect_1) {
CcTest::InitializeVM();
- RunWASMSelectTest(execution_mode, 1);
+ RunWASMSelectTest(execution_tier, 1);
}
WASM_EXEC_TEST(Run_WASMSelect_2) {
CcTest::InitializeVM();
- RunWASMSelectTest(execution_mode, 2);
+ RunWASMSelectTest(execution_tier, 2);
}
WASM_EXEC_TEST(Run_WASMSelect_3) {
CcTest::InitializeVM();
- RunWASMSelectTest(execution_mode, 3);
+ RunWASMSelectTest(execution_tier, 3);
}
WASM_EXEC_TEST(Run_WASMSelect_4) {
CcTest::InitializeVM();
- RunWASMSelectTest(execution_mode, 4);
+ RunWASMSelectTest(execution_tier, 4);
}
WASM_EXEC_TEST(Run_WASMSelect_5) {
CcTest::InitializeVM();
- RunWASMSelectTest(execution_mode, 5);
+ RunWASMSelectTest(execution_tier, 5);
}
WASM_EXEC_TEST(Run_WASMSelect_6) {
CcTest::InitializeVM();
- RunWASMSelectTest(execution_mode, 6);
+ RunWASMSelectTest(execution_tier, 6);
}
WASM_EXEC_TEST(Run_WASMSelect_7) {
CcTest::InitializeVM();
- RunWASMSelectTest(execution_mode, 7);
+ RunWASMSelectTest(execution_tier, 7);
}
-void RunWASMSelectAlignTest(WasmExecutionMode mode, int num_args,
- int num_params) {
+void RunWASMSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
PredictableInputValues inputs(0x300);
Isolate* isolate = CcTest::InitIsolateOnce();
const int kMaxParams = 10;
@@ -312,7 +311,7 @@ void RunWASMSelectAlignTest(WasmExecutionMode mode, int num_args,
FunctionSig sig(1, num_params, types);
for (int which = 0; which < num_params; which++) {
- WasmRunner<void> r(mode);
+ WasmRunner<void> r(tier);
WasmFunctionCompiler& t = r.NewFunction(&sig);
BUILD(t, WASM_GET_LOCAL(which));
Handle<JSFunction> jsfunc = r.builder().WrapCode(t.function_index());
@@ -336,67 +335,66 @@ void RunWASMSelectAlignTest(WasmExecutionMode mode, int num_args,
WASM_EXEC_TEST(Run_WASMSelectAlign_0) {
CcTest::InitializeVM();
- RunWASMSelectAlignTest(execution_mode, 0, 1);
- RunWASMSelectAlignTest(execution_mode, 0, 2);
+ RunWASMSelectAlignTest(execution_tier, 0, 1);
+ RunWASMSelectAlignTest(execution_tier, 0, 2);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_1) {
CcTest::InitializeVM();
- RunWASMSelectAlignTest(execution_mode, 1, 2);
- RunWASMSelectAlignTest(execution_mode, 1, 3);
+ RunWASMSelectAlignTest(execution_tier, 1, 2);
+ RunWASMSelectAlignTest(execution_tier, 1, 3);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_2) {
CcTest::InitializeVM();
- RunWASMSelectAlignTest(execution_mode, 2, 3);
- RunWASMSelectAlignTest(execution_mode, 2, 4);
+ RunWASMSelectAlignTest(execution_tier, 2, 3);
+ RunWASMSelectAlignTest(execution_tier, 2, 4);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_3) {
CcTest::InitializeVM();
- RunWASMSelectAlignTest(execution_mode, 3, 3);
- RunWASMSelectAlignTest(execution_mode, 3, 4);
+ RunWASMSelectAlignTest(execution_tier, 3, 3);
+ RunWASMSelectAlignTest(execution_tier, 3, 4);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_4) {
CcTest::InitializeVM();
- RunWASMSelectAlignTest(execution_mode, 4, 3);
- RunWASMSelectAlignTest(execution_mode, 4, 4);
+ RunWASMSelectAlignTest(execution_tier, 4, 3);
+ RunWASMSelectAlignTest(execution_tier, 4, 4);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_7) {
CcTest::InitializeVM();
- RunWASMSelectAlignTest(execution_mode, 7, 5);
- RunWASMSelectAlignTest(execution_mode, 7, 6);
- RunWASMSelectAlignTest(execution_mode, 7, 7);
+ RunWASMSelectAlignTest(execution_tier, 7, 5);
+ RunWASMSelectAlignTest(execution_tier, 7, 6);
+ RunWASMSelectAlignTest(execution_tier, 7, 7);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_8) {
CcTest::InitializeVM();
- RunWASMSelectAlignTest(execution_mode, 8, 5);
- RunWASMSelectAlignTest(execution_mode, 8, 6);
- RunWASMSelectAlignTest(execution_mode, 8, 7);
- RunWASMSelectAlignTest(execution_mode, 8, 8);
+ RunWASMSelectAlignTest(execution_tier, 8, 5);
+ RunWASMSelectAlignTest(execution_tier, 8, 6);
+ RunWASMSelectAlignTest(execution_tier, 8, 7);
+ RunWASMSelectAlignTest(execution_tier, 8, 8);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_9) {
CcTest::InitializeVM();
- RunWASMSelectAlignTest(execution_mode, 9, 6);
- RunWASMSelectAlignTest(execution_mode, 9, 7);
- RunWASMSelectAlignTest(execution_mode, 9, 8);
- RunWASMSelectAlignTest(execution_mode, 9, 9);
+ RunWASMSelectAlignTest(execution_tier, 9, 6);
+ RunWASMSelectAlignTest(execution_tier, 9, 7);
+ RunWASMSelectAlignTest(execution_tier, 9, 8);
+ RunWASMSelectAlignTest(execution_tier, 9, 9);
}
WASM_EXEC_TEST(Run_WASMSelectAlign_10) {
CcTest::InitializeVM();
- RunWASMSelectAlignTest(execution_mode, 10, 7);
- RunWASMSelectAlignTest(execution_mode, 10, 8);
- RunWASMSelectAlignTest(execution_mode, 10, 9);
- RunWASMSelectAlignTest(execution_mode, 10, 10);
+ RunWASMSelectAlignTest(execution_tier, 10, 7);
+ RunWASMSelectAlignTest(execution_tier, 10, 8);
+ RunWASMSelectAlignTest(execution_tier, 10, 9);
+ RunWASMSelectAlignTest(execution_tier, 10, 10);
}
-void RunJSSelectAlignTest(WasmExecutionMode mode, int num_args,
- int num_params) {
+void RunJSSelectAlignTest(ExecutionTier tier, int num_args, int num_params) {
PredictableInputValues inputs(0x400);
Isolate* isolate = CcTest::InitIsolateOnce();
Factory* factory = isolate->factory();
@@ -427,7 +425,7 @@ void RunJSSelectAlignTest(WasmExecutionMode mode, int num_args,
for (int which = 0; which < num_params; which++) {
HandleScope scope(isolate);
ManuallyImportedJSFunction import = CreateJSSelector(&sig, which);
- WasmRunner<void> r(mode, &import);
+ WasmRunner<void> r(tier, &import);
WasmFunctionCompiler& t = r.NewFunction(&sig);
t.Build(&code[0], &code[end]);
@@ -454,64 +452,64 @@ void RunJSSelectAlignTest(WasmExecutionMode mode, int num_args,
WASM_EXEC_TEST(Run_JSSelectAlign_0) {
CcTest::InitializeVM();
- RunJSSelectAlignTest(execution_mode, 0, 1);
- RunJSSelectAlignTest(execution_mode, 0, 2);
+ RunJSSelectAlignTest(execution_tier, 0, 1);
+ RunJSSelectAlignTest(execution_tier, 0, 2);
}
WASM_EXEC_TEST(Run_JSSelectAlign_1) {
CcTest::InitializeVM();
- RunJSSelectAlignTest(execution_mode, 1, 2);
- RunJSSelectAlignTest(execution_mode, 1, 3);
+ RunJSSelectAlignTest(execution_tier, 1, 2);
+ RunJSSelectAlignTest(execution_tier, 1, 3);
}
WASM_EXEC_TEST(Run_JSSelectAlign_2) {
CcTest::InitializeVM();
- RunJSSelectAlignTest(execution_mode, 2, 3);
- RunJSSelectAlignTest(execution_mode, 2, 4);
+ RunJSSelectAlignTest(execution_tier, 2, 3);
+ RunJSSelectAlignTest(execution_tier, 2, 4);
}
WASM_EXEC_TEST(Run_JSSelectAlign_3) {
CcTest::InitializeVM();
- RunJSSelectAlignTest(execution_mode, 3, 3);
- RunJSSelectAlignTest(execution_mode, 3, 4);
+ RunJSSelectAlignTest(execution_tier, 3, 3);
+ RunJSSelectAlignTest(execution_tier, 3, 4);
}
WASM_EXEC_TEST(Run_JSSelectAlign_4) {
CcTest::InitializeVM();
- RunJSSelectAlignTest(execution_mode, 4, 3);
- RunJSSelectAlignTest(execution_mode, 4, 4);
+ RunJSSelectAlignTest(execution_tier, 4, 3);
+ RunJSSelectAlignTest(execution_tier, 4, 4);
}
WASM_EXEC_TEST(Run_JSSelectAlign_7) {
CcTest::InitializeVM();
- RunJSSelectAlignTest(execution_mode, 7, 3);
- RunJSSelectAlignTest(execution_mode, 7, 4);
- RunJSSelectAlignTest(execution_mode, 7, 4);
- RunJSSelectAlignTest(execution_mode, 7, 4);
+ RunJSSelectAlignTest(execution_tier, 7, 3);
+ RunJSSelectAlignTest(execution_tier, 7, 4);
+ RunJSSelectAlignTest(execution_tier, 7, 4);
+ RunJSSelectAlignTest(execution_tier, 7, 4);
}
WASM_EXEC_TEST(Run_JSSelectAlign_8) {
CcTest::InitializeVM();
- RunJSSelectAlignTest(execution_mode, 8, 5);
- RunJSSelectAlignTest(execution_mode, 8, 6);
- RunJSSelectAlignTest(execution_mode, 8, 7);
- RunJSSelectAlignTest(execution_mode, 8, 8);
+ RunJSSelectAlignTest(execution_tier, 8, 5);
+ RunJSSelectAlignTest(execution_tier, 8, 6);
+ RunJSSelectAlignTest(execution_tier, 8, 7);
+ RunJSSelectAlignTest(execution_tier, 8, 8);
}
WASM_EXEC_TEST(Run_JSSelectAlign_9) {
CcTest::InitializeVM();
- RunJSSelectAlignTest(execution_mode, 9, 6);
- RunJSSelectAlignTest(execution_mode, 9, 7);
- RunJSSelectAlignTest(execution_mode, 9, 8);
- RunJSSelectAlignTest(execution_mode, 9, 9);
+ RunJSSelectAlignTest(execution_tier, 9, 6);
+ RunJSSelectAlignTest(execution_tier, 9, 7);
+ RunJSSelectAlignTest(execution_tier, 9, 8);
+ RunJSSelectAlignTest(execution_tier, 9, 9);
}
WASM_EXEC_TEST(Run_JSSelectAlign_10) {
CcTest::InitializeVM();
- RunJSSelectAlignTest(execution_mode, 10, 7);
- RunJSSelectAlignTest(execution_mode, 10, 8);
- RunJSSelectAlignTest(execution_mode, 10, 9);
- RunJSSelectAlignTest(execution_mode, 10, 10);
+ RunJSSelectAlignTest(execution_tier, 10, 7);
+ RunJSSelectAlignTest(execution_tier, 10, 8);
+ RunJSSelectAlignTest(execution_tier, 10, 9);
+ RunJSSelectAlignTest(execution_tier, 10, 10);
}
#undef ADD_CODE
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 bbceec73a3..d25aeafa33 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc
@@ -5,7 +5,7 @@
#include <stdlib.h>
#include <string.h>
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/objects-inl.h"
#include "src/snapshot/code-serializer.h"
#include "src/version.h"
@@ -886,9 +886,11 @@ TEST(AtomicOpDisassembly) {
testing::SetupIsolateForWasmModule(isolate);
ErrorThrower thrower(isolate, "Test");
+ auto enabled_features = WasmFeaturesFromIsolate(isolate);
MaybeHandle<WasmModuleObject> module_object =
isolate->wasm_engine()->SyncCompile(
- isolate, &thrower, ModuleWireBytes(buffer.begin(), buffer.end()));
+ isolate, enabled_features, &thrower,
+ ModuleWireBytes(buffer.begin(), buffer.end()));
module_object.ToHandleChecked()->DisassembleFunction(0);
}
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-sign-extension.cc b/deps/v8/test/cctest/wasm/test-run-wasm-sign-extension.cc
index 17a79bc27f..71b5285439 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-sign-extension.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-sign-extension.cc
@@ -13,7 +13,7 @@ namespace wasm {
// TODO(gdeepti): Enable tests to run in the interpreter.
WASM_EXEC_TEST(I32SExtendI8) {
EXPERIMENTAL_FLAG_SCOPE(se);
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_SIGN_EXT_I8(WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1));
@@ -24,7 +24,7 @@ WASM_EXEC_TEST(I32SExtendI8) {
WASM_EXEC_TEST(I32SExtendI16) {
EXPERIMENTAL_FLAG_SCOPE(se);
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_SIGN_EXT_I16(WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1));
@@ -35,7 +35,7 @@ WASM_EXEC_TEST(I32SExtendI16) {
WASM_EXEC_TEST(I64SExtendI8) {
EXPERIMENTAL_FLAG_SCOPE(se);
- WasmRunner<int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SIGN_EXT_I8(WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1));
@@ -46,7 +46,7 @@ WASM_EXEC_TEST(I64SExtendI8) {
WASM_EXEC_TEST(I64SExtendI16) {
EXPERIMENTAL_FLAG_SCOPE(se);
- WasmRunner<int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SIGN_EXT_I16(WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1));
@@ -57,7 +57,7 @@ WASM_EXEC_TEST(I64SExtendI16) {
WASM_EXEC_TEST(I64SExtendI32) {
EXPERIMENTAL_FLAG_SCOPE(se);
- WasmRunner<int64_t, int64_t> r(execution_mode);
+ WasmRunner<int64_t, int64_t> r(execution_tier);
BUILD(r, WASM_I64_SIGN_EXT_I32(WASM_GET_LOCAL(0)));
CHECK_EQ(0, r.Call(0));
CHECK_EQ(1, r.Call(1));
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 271ce341fe..f60c65b727 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc
@@ -32,23 +32,22 @@ typedef int8_t (*Int8BinOp)(int8_t, int8_t);
typedef int (*Int8CompareOp)(int8_t, int8_t);
typedef int8_t (*Int8ShiftOp)(int8_t, int);
-#define WASM_SIMD_TEST(name) \
- void RunWasm_##name##_Impl(LowerSimd lower_simd, \
- WasmExecutionMode execution_mode); \
- TEST(RunWasm_##name##_turbofan) { \
- EXPERIMENTAL_FLAG_SCOPE(simd); \
- RunWasm_##name##_Impl(kNoLowerSimd, kExecuteTurbofan); \
- } \
- TEST(RunWasm_##name##_interpreter) { \
- EXPERIMENTAL_FLAG_SCOPE(simd); \
- RunWasm_##name##_Impl(kNoLowerSimd, kExecuteInterpreter); \
- } \
- TEST(RunWasm_##name##_simd_lowered) { \
- EXPERIMENTAL_FLAG_SCOPE(simd); \
- RunWasm_##name##_Impl(kLowerSimd, kExecuteTurbofan); \
- } \
- void RunWasm_##name##_Impl(LowerSimd lower_simd, \
- WasmExecutionMode execution_mode)
+#define WASM_SIMD_TEST(name) \
+ void RunWasm_##name##_Impl(LowerSimd lower_simd, \
+ ExecutionTier execution_tier); \
+ TEST(RunWasm_##name##_turbofan) { \
+ EXPERIMENTAL_FLAG_SCOPE(simd); \
+ RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kOptimized); \
+ } \
+ TEST(RunWasm_##name##_interpreter) { \
+ EXPERIMENTAL_FLAG_SCOPE(simd); \
+ RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kInterpreter); \
+ } \
+ TEST(RunWasm_##name##_simd_lowered) { \
+ EXPERIMENTAL_FLAG_SCOPE(simd); \
+ RunWasm_##name##_Impl(kLowerSimd, ExecutionTier::kOptimized); \
+ } \
+ void RunWasm_##name##_Impl(LowerSimd lower_simd, ExecutionTier execution_tier)
// Generic expected value functions.
template <typename T>
@@ -400,7 +399,7 @@ bool SkipFPValue(float x) {
bool SkipFPExpectedValue(float x) { return std::isnan(x) || SkipFPValue(x); }
WASM_SIMD_TEST(F32x4Splat) {
- WasmRunner<int32_t, float> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, float> r(execution_tier, lower_simd);
byte lane_val = 0;
byte simd = r.AllocateLocal(kWasmS128);
BUILD(r,
@@ -414,7 +413,7 @@ WASM_SIMD_TEST(F32x4Splat) {
}
WASM_SIMD_TEST(F32x4ReplaceLane) {
- WasmRunner<int32_t, float, float> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, float, float> r(execution_tier, lower_simd);
byte old_val = 0;
byte new_val = 1;
byte simd = r.AllocateLocal(kWasmS128);
@@ -443,7 +442,7 @@ WASM_SIMD_TEST(F32x4ReplaceLane) {
V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
// Tests both signed and unsigned conversion.
WASM_SIMD_TEST(F32x4ConvertI32x4) {
- WasmRunner<int32_t, int32_t, float, float> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, float, float> r(execution_tier, lower_simd);
byte a = 0;
byte expected_signed = 1;
byte expected_unsigned = 2;
@@ -467,10 +466,10 @@ WASM_SIMD_TEST(F32x4ConvertI32x4) {
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
-void RunF32x4UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunF32x4UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, FloatUnOp expected_op,
float error = 0.0f) {
- WasmRunner<int32_t, float, float, float> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, float, float, float> r(execution_tier, lower_simd);
byte a = 0;
byte low = 1;
byte high = 2;
@@ -490,27 +489,27 @@ void RunF32x4UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(F32x4Abs) {
- RunF32x4UnOpTest(execution_mode, lower_simd, kExprF32x4Abs, std::abs);
+ RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4Abs, std::abs);
}
WASM_SIMD_TEST(F32x4Neg) {
- RunF32x4UnOpTest(execution_mode, lower_simd, kExprF32x4Neg, Negate);
+ RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4Neg, Negate);
}
static const float kApproxError = 0.01f;
WASM_SIMD_TEST(F32x4RecipApprox) {
- RunF32x4UnOpTest(execution_mode, lower_simd, kExprF32x4RecipApprox, Recip,
+ RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4RecipApprox, Recip,
kApproxError);
}
WASM_SIMD_TEST(F32x4RecipSqrtApprox) {
- RunF32x4UnOpTest(execution_mode, lower_simd, kExprF32x4RecipSqrtApprox,
+ RunF32x4UnOpTest(execution_tier, lower_simd, kExprF32x4RecipSqrtApprox,
RecipSqrt, kApproxError);
}
-void RunF32x4BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunF32x4BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, FloatBinOp expected_op) {
- WasmRunner<int32_t, float, float, float> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, float, float, float> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
@@ -534,25 +533,24 @@ void RunF32x4BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(F32x4Add) {
- RunF32x4BinOpTest(execution_mode, lower_simd, kExprF32x4Add, Add);
+ RunF32x4BinOpTest(execution_tier, lower_simd, kExprF32x4Add, Add);
}
WASM_SIMD_TEST(F32x4Sub) {
- RunF32x4BinOpTest(execution_mode, lower_simd, kExprF32x4Sub, Sub);
+ RunF32x4BinOpTest(execution_tier, lower_simd, kExprF32x4Sub, Sub);
}
WASM_SIMD_TEST(F32x4Mul) {
- RunF32x4BinOpTest(execution_mode, lower_simd, kExprF32x4Mul, Mul);
+ RunF32x4BinOpTest(execution_tier, lower_simd, kExprF32x4Mul, Mul);
}
WASM_SIMD_TEST(F32x4_Min) {
- RunF32x4BinOpTest(execution_mode, lower_simd, kExprF32x4Min, JSMin);
+ RunF32x4BinOpTest(execution_tier, lower_simd, kExprF32x4Min, JSMin);
}
WASM_SIMD_TEST(F32x4_Max) {
- RunF32x4BinOpTest(execution_mode, lower_simd, kExprF32x4Max, JSMax);
+ RunF32x4BinOpTest(execution_tier, lower_simd, kExprF32x4Max, JSMax);
}
-void RunF32x4CompareOpTest(WasmExecutionMode execution_mode,
- LowerSimd lower_simd, WasmOpcode simd_op,
- FloatCompareOp expected_op) {
- WasmRunner<int32_t, float, float, int32_t> r(execution_mode, lower_simd);
+void RunF32x4CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
+ WasmOpcode simd_op, FloatCompareOp expected_op) {
+ WasmRunner<int32_t, float, float, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
@@ -576,27 +574,27 @@ void RunF32x4CompareOpTest(WasmExecutionMode execution_mode,
}
WASM_SIMD_TEST(F32x4Eq) {
- RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Eq, Equal);
+ RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Eq, Equal);
}
WASM_SIMD_TEST(F32x4Ne) {
- RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Ne, NotEqual);
+ RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Ne, NotEqual);
}
WASM_SIMD_TEST(F32x4Gt) {
- RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Gt, Greater);
+ RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Gt, Greater);
}
WASM_SIMD_TEST(F32x4Ge) {
- RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Ge, GreaterEqual);
+ RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Ge, GreaterEqual);
}
WASM_SIMD_TEST(F32x4Lt) {
- RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Lt, Less);
+ RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Lt, Less);
}
WASM_SIMD_TEST(F32x4Le) {
- RunF32x4CompareOpTest(execution_mode, lower_simd, kExprF32x4Le, LessEqual);
+ RunF32x4CompareOpTest(execution_tier, lower_simd, kExprF32x4Le, LessEqual);
}
WASM_SIMD_TEST(I32x4Splat) {
@@ -610,7 +608,7 @@ WASM_SIMD_TEST(I32x4Splat) {
// return 0
//
// return 1
- WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
byte lane_val = 0;
byte simd = r.AllocateLocal(kWasmS128);
BUILD(r,
@@ -621,7 +619,7 @@ WASM_SIMD_TEST(I32x4Splat) {
}
WASM_SIMD_TEST(I32x4ReplaceLane) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte old_val = 0;
byte new_val = 1;
byte simd = r.AllocateLocal(kWasmS128);
@@ -647,7 +645,7 @@ WASM_SIMD_TEST(I32x4ReplaceLane) {
}
WASM_SIMD_TEST(I16x8Splat) {
- WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
byte lane_val = 0;
byte simd = r.AllocateLocal(kWasmS128);
BUILD(r,
@@ -658,7 +656,7 @@ WASM_SIMD_TEST(I16x8Splat) {
}
WASM_SIMD_TEST(I16x8ReplaceLane) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte old_val = 0;
byte new_val = 1;
byte simd = r.AllocateLocal(kWasmS128);
@@ -707,7 +705,7 @@ WASM_SIMD_TEST(I16x8ReplaceLane) {
}
WASM_SIMD_TEST(I8x16Splat) {
- WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
byte lane_val = 0;
byte simd = r.AllocateLocal(kWasmS128);
BUILD(r,
@@ -718,7 +716,7 @@ WASM_SIMD_TEST(I8x16Splat) {
}
WASM_SIMD_TEST(I8x16ReplaceLane) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte old_val = 0;
byte new_val = 1;
byte simd = r.AllocateLocal(kWasmS128);
@@ -839,7 +837,7 @@ int32_t ConvertToInt(double val, bool unsigned_integer) {
// Tests both signed and unsigned conversion.
WASM_SIMD_TEST(I32x4ConvertF32x4) {
- WasmRunner<int32_t, float, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, float, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected_signed = 1;
byte expected_unsigned = 2;
@@ -864,7 +862,7 @@ WASM_SIMD_TEST(I32x4ConvertF32x4) {
// Tests both signed and unsigned conversion from I16x8 (unpacking).
WASM_SIMD_TEST(I32x4ConvertI16x8) {
- WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(execution_mode,
+ WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(execution_tier,
lower_simd);
byte a = 0;
byte unpacked_signed = 1;
@@ -905,9 +903,9 @@ WASM_SIMD_TEST(I32x4ConvertI16x8) {
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
-void RunI32x4UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunI32x4UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int32UnOp expected_op) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
@@ -919,16 +917,16 @@ void RunI32x4UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I32x4Neg) {
- RunI32x4UnOpTest(execution_mode, lower_simd, kExprI32x4Neg, Negate);
+ RunI32x4UnOpTest(execution_tier, lower_simd, kExprI32x4Neg, Negate);
}
WASM_SIMD_TEST(S128Not) {
- RunI32x4UnOpTest(execution_mode, lower_simd, kExprS128Not, Not);
+ RunI32x4UnOpTest(execution_tier, lower_simd, kExprS128Not, Not);
}
-void RunI32x4BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunI32x4BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int32BinOp expected_op) {
- WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
@@ -946,51 +944,50 @@ void RunI32x4BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I32x4Add) {
- RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4Add, Add);
+ RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4Add, Add);
}
WASM_SIMD_TEST(I32x4Sub) {
- RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4Sub, Sub);
+ RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4Sub, Sub);
}
WASM_SIMD_TEST(I32x4Mul) {
- RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4Mul, Mul);
+ RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4Mul, Mul);
}
WASM_SIMD_TEST(I32x4MinS) {
- RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4MinS, Minimum);
+ RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4MinS, Minimum);
}
WASM_SIMD_TEST(I32x4MaxS) {
- RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4MaxS, Maximum);
+ RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4MaxS, Maximum);
}
WASM_SIMD_TEST(I32x4MinU) {
- RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4MinU,
+ RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4MinU,
UnsignedMinimum);
}
WASM_SIMD_TEST(I32x4MaxU) {
- RunI32x4BinOpTest(execution_mode, lower_simd, kExprI32x4MaxU,
+ RunI32x4BinOpTest(execution_tier, lower_simd, kExprI32x4MaxU,
UnsignedMaximum);
}
WASM_SIMD_TEST(S128And) {
- RunI32x4BinOpTest(execution_mode, lower_simd, kExprS128And, And);
+ RunI32x4BinOpTest(execution_tier, lower_simd, kExprS128And, And);
}
WASM_SIMD_TEST(S128Or) {
- RunI32x4BinOpTest(execution_mode, lower_simd, kExprS128Or, Or);
+ RunI32x4BinOpTest(execution_tier, lower_simd, kExprS128Or, Or);
}
WASM_SIMD_TEST(S128Xor) {
- RunI32x4BinOpTest(execution_mode, lower_simd, kExprS128Xor, Xor);
+ RunI32x4BinOpTest(execution_tier, lower_simd, kExprS128Xor, Xor);
}
-void RunI32x4CompareOpTest(WasmExecutionMode execution_mode,
- LowerSimd lower_simd, WasmOpcode simd_op,
- Int32CompareOp expected_op) {
- WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+void RunI32x4CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
+ WasmOpcode simd_op, Int32CompareOp expected_op) {
+ WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
@@ -1008,54 +1005,54 @@ void RunI32x4CompareOpTest(WasmExecutionMode execution_mode,
}
WASM_SIMD_TEST(I32x4Eq) {
- RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4Eq, Equal);
+ RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4Eq, Equal);
}
WASM_SIMD_TEST(I32x4Ne) {
- RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4Ne, NotEqual);
+ RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4Ne, NotEqual);
}
WASM_SIMD_TEST(I32x4LtS) {
- RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4LtS, Less);
+ RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4LtS, Less);
}
WASM_SIMD_TEST(I32x4LeS) {
- RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4LeS, LessEqual);
+ RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4LeS, LessEqual);
}
WASM_SIMD_TEST(I32x4GtS) {
- RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4GtS, Greater);
+ RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4GtS, Greater);
}
WASM_SIMD_TEST(I32x4GeS) {
- RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4GeS,
+ RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4GeS,
GreaterEqual);
}
WASM_SIMD_TEST(I32x4LtU) {
- RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4LtU,
+ RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4LtU,
UnsignedLess);
}
WASM_SIMD_TEST(I32x4LeU) {
- RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4LeU,
+ RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4LeU,
UnsignedLessEqual);
}
WASM_SIMD_TEST(I32x4GtU) {
- RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4GtU,
+ RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4GtU,
UnsignedGreater);
}
WASM_SIMD_TEST(I32x4GeU) {
- RunI32x4CompareOpTest(execution_mode, lower_simd, kExprI32x4GeU,
+ RunI32x4CompareOpTest(execution_tier, lower_simd, kExprI32x4GeU,
UnsignedGreaterEqual);
}
-void RunI32x4ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunI32x4ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int32ShiftOp expected_op) {
for (int shift = 1; shift < 32; ++shift) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
@@ -1069,17 +1066,17 @@ void RunI32x4ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I32x4Shl) {
- RunI32x4ShiftOpTest(execution_mode, lower_simd, kExprI32x4Shl,
+ RunI32x4ShiftOpTest(execution_tier, lower_simd, kExprI32x4Shl,
LogicalShiftLeft);
}
WASM_SIMD_TEST(I32x4ShrS) {
- RunI32x4ShiftOpTest(execution_mode, lower_simd, kExprI32x4ShrS,
+ RunI32x4ShiftOpTest(execution_tier, lower_simd, kExprI32x4ShrS,
ArithmeticShiftRight);
}
WASM_SIMD_TEST(I32x4ShrU) {
- RunI32x4ShiftOpTest(execution_mode, lower_simd, kExprI32x4ShrU,
+ RunI32x4ShiftOpTest(execution_tier, lower_simd, kExprI32x4ShrU,
LogicalShiftRight);
}
@@ -1087,7 +1084,7 @@ WASM_SIMD_TEST(I32x4ShrU) {
V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
// Tests both signed and unsigned conversion from I8x16 (unpacking).
WASM_SIMD_TEST(I16x8ConvertI8x16) {
- WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(execution_mode,
+ WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t> r(execution_tier,
lower_simd);
byte a = 0;
byte unpacked_signed = 1;
@@ -1130,9 +1127,9 @@ WASM_SIMD_TEST(I16x8ConvertI8x16) {
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
-void RunI16x8UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunI16x8UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int16UnOp expected_op) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
@@ -1144,7 +1141,7 @@ void RunI16x8UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I16x8Neg) {
- RunI16x8UnOpTest(execution_mode, lower_simd, kExprI16x8Neg, Negate);
+ RunI16x8UnOpTest(execution_tier, lower_simd, kExprI16x8Neg, Negate);
}
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \
@@ -1152,7 +1149,7 @@ WASM_SIMD_TEST(I16x8Neg) {
// Tests both signed and unsigned conversion from I32x4 (packing).
WASM_SIMD_TEST(I16x8ConvertI32x4) {
WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t> r(
- execution_mode, lower_simd);
+ execution_tier, lower_simd);
byte a = 0;
byte b = 1;
// indices for packed signed params
@@ -1196,9 +1193,9 @@ WASM_SIMD_TEST(I16x8ConvertI32x4) {
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
-void RunI16x8BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunI16x8BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int16BinOp expected_op) {
- WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
@@ -1216,59 +1213,58 @@ void RunI16x8BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I16x8Add) {
- RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8Add, Add);
+ RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8Add, Add);
}
WASM_SIMD_TEST(I16x8AddSaturateS) {
- RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8AddSaturateS,
+ RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8AddSaturateS,
AddSaturate);
}
WASM_SIMD_TEST(I16x8Sub) {
- RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8Sub, Sub);
+ RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8Sub, Sub);
}
WASM_SIMD_TEST(I16x8SubSaturateS) {
- RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8SubSaturateS,
+ RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8SubSaturateS,
SubSaturate);
}
WASM_SIMD_TEST(I16x8Mul) {
- RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8Mul, Mul);
+ RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8Mul, Mul);
}
WASM_SIMD_TEST(I16x8MinS) {
- RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8MinS, Minimum);
+ RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8MinS, Minimum);
}
WASM_SIMD_TEST(I16x8MaxS) {
- RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8MaxS, Maximum);
+ RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8MaxS, Maximum);
}
WASM_SIMD_TEST(I16x8AddSaturateU) {
- RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8AddSaturateU,
+ RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8AddSaturateU,
UnsignedAddSaturate);
}
WASM_SIMD_TEST(I16x8SubSaturateU) {
- RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8SubSaturateU,
+ RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8SubSaturateU,
UnsignedSubSaturate);
}
WASM_SIMD_TEST(I16x8MinU) {
- RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8MinU,
+ RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8MinU,
UnsignedMinimum);
}
WASM_SIMD_TEST(I16x8MaxU) {
- RunI16x8BinOpTest(execution_mode, lower_simd, kExprI16x8MaxU,
+ RunI16x8BinOpTest(execution_tier, lower_simd, kExprI16x8MaxU,
UnsignedMaximum);
}
-void RunI16x8CompareOpTest(WasmExecutionMode execution_mode,
- LowerSimd lower_simd, WasmOpcode simd_op,
- Int16CompareOp expected_op) {
- WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+void RunI16x8CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
+ WasmOpcode simd_op, Int16CompareOp expected_op) {
+ WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
@@ -1286,54 +1282,54 @@ void RunI16x8CompareOpTest(WasmExecutionMode execution_mode,
}
WASM_SIMD_TEST(I16x8Eq) {
- RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8Eq, Equal);
+ RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8Eq, Equal);
}
WASM_SIMD_TEST(I16x8Ne) {
- RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8Ne, NotEqual);
+ RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8Ne, NotEqual);
}
WASM_SIMD_TEST(I16x8LtS) {
- RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8LtS, Less);
+ RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8LtS, Less);
}
WASM_SIMD_TEST(I16x8LeS) {
- RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8LeS, LessEqual);
+ RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8LeS, LessEqual);
}
WASM_SIMD_TEST(I16x8GtS) {
- RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8GtS, Greater);
+ RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8GtS, Greater);
}
WASM_SIMD_TEST(I16x8GeS) {
- RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8GeS,
+ RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8GeS,
GreaterEqual);
}
WASM_SIMD_TEST(I16x8GtU) {
- RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8GtU,
+ RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8GtU,
UnsignedGreater);
}
WASM_SIMD_TEST(I16x8GeU) {
- RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8GeU,
+ RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8GeU,
UnsignedGreaterEqual);
}
WASM_SIMD_TEST(I16x8LtU) {
- RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8LtU,
+ RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8LtU,
UnsignedLess);
}
WASM_SIMD_TEST(I16x8LeU) {
- RunI16x8CompareOpTest(execution_mode, lower_simd, kExprI16x8LeU,
+ RunI16x8CompareOpTest(execution_tier, lower_simd, kExprI16x8LeU,
UnsignedLessEqual);
}
-void RunI16x8ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunI16x8ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int16ShiftOp expected_op) {
for (int shift = 1; shift < 16; ++shift) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
@@ -1347,23 +1343,23 @@ void RunI16x8ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I16x8Shl) {
- RunI16x8ShiftOpTest(execution_mode, lower_simd, kExprI16x8Shl,
+ RunI16x8ShiftOpTest(execution_tier, lower_simd, kExprI16x8Shl,
LogicalShiftLeft);
}
WASM_SIMD_TEST(I16x8ShrS) {
- RunI16x8ShiftOpTest(execution_mode, lower_simd, kExprI16x8ShrS,
+ RunI16x8ShiftOpTest(execution_tier, lower_simd, kExprI16x8ShrS,
ArithmeticShiftRight);
}
WASM_SIMD_TEST(I16x8ShrU) {
- RunI16x8ShiftOpTest(execution_mode, lower_simd, kExprI16x8ShrU,
+ RunI16x8ShiftOpTest(execution_tier, lower_simd, kExprI16x8ShrU,
LogicalShiftRight);
}
-void RunI8x16UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunI8x16UnOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int8UnOp expected_op) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
@@ -1375,7 +1371,7 @@ void RunI8x16UnOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I8x16Neg) {
- RunI8x16UnOpTest(execution_mode, lower_simd, kExprI8x16Neg, Negate);
+ RunI8x16UnOpTest(execution_tier, lower_simd, kExprI8x16Neg, Negate);
}
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \
@@ -1383,7 +1379,7 @@ WASM_SIMD_TEST(I8x16Neg) {
// Tests both signed and unsigned conversion from I16x8 (packing).
WASM_SIMD_TEST(I8x16ConvertI16x8) {
WasmRunner<int32_t, int32_t, int32_t, int32_t, int32_t, int32_t, int32_t> r(
- execution_mode, lower_simd);
+ execution_tier, lower_simd);
byte a = 0;
byte b = 1;
// indices for packed signed params
@@ -1429,9 +1425,9 @@ WASM_SIMD_TEST(I8x16ConvertI16x8) {
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
-void RunI8x16BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunI8x16BinOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int8BinOp expected_op) {
- WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
@@ -1449,55 +1445,54 @@ void RunI8x16BinOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
}
WASM_SIMD_TEST(I8x16Add) {
- RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16Add, Add);
+ RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16Add, Add);
}
WASM_SIMD_TEST(I8x16AddSaturateS) {
- RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16AddSaturateS,
+ RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16AddSaturateS,
AddSaturate);
}
WASM_SIMD_TEST(I8x16Sub) {
- RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16Sub, Sub);
+ RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16Sub, Sub);
}
WASM_SIMD_TEST(I8x16SubSaturateS) {
- RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16SubSaturateS,
+ RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16SubSaturateS,
SubSaturate);
}
WASM_SIMD_TEST(I8x16MinS) {
- RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16MinS, Minimum);
+ RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16MinS, Minimum);
}
WASM_SIMD_TEST(I8x16MaxS) {
- RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16MaxS, Maximum);
+ RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16MaxS, Maximum);
}
WASM_SIMD_TEST(I8x16AddSaturateU) {
- RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16AddSaturateU,
+ RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16AddSaturateU,
UnsignedAddSaturate);
}
WASM_SIMD_TEST(I8x16SubSaturateU) {
- RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16SubSaturateU,
+ RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16SubSaturateU,
UnsignedSubSaturate);
}
WASM_SIMD_TEST(I8x16MinU) {
- RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16MinU,
+ RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16MinU,
UnsignedMinimum);
}
WASM_SIMD_TEST(I8x16MaxU) {
- RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16MaxU,
+ RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16MaxU,
UnsignedMaximum);
}
-void RunI8x16CompareOpTest(WasmExecutionMode execution_mode,
- LowerSimd lower_simd, WasmOpcode simd_op,
- Int8CompareOp expected_op) {
- WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+void RunI8x16CompareOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
+ WasmOpcode simd_op, Int8CompareOp expected_op) {
+ WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte b = 1;
byte expected = 2;
@@ -1515,62 +1510,62 @@ void RunI8x16CompareOpTest(WasmExecutionMode execution_mode,
}
WASM_SIMD_TEST(I8x16Eq) {
- RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16Eq, Equal);
+ RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16Eq, Equal);
}
WASM_SIMD_TEST(I8x16Ne) {
- RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16Ne, NotEqual);
+ RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16Ne, NotEqual);
}
WASM_SIMD_TEST(I8x16GtS) {
- RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16GtS, Greater);
+ RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16GtS, Greater);
}
WASM_SIMD_TEST(I8x16GeS) {
- RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16GeS,
+ RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16GeS,
GreaterEqual);
}
WASM_SIMD_TEST(I8x16LtS) {
- RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16LtS, Less);
+ RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16LtS, Less);
}
WASM_SIMD_TEST(I8x16LeS) {
- RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16LeS, LessEqual);
+ RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16LeS, LessEqual);
}
WASM_SIMD_TEST(I8x16GtU) {
- RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16GtU,
+ RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16GtU,
UnsignedGreater);
}
WASM_SIMD_TEST(I8x16GeU) {
- RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16GeU,
+ RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16GeU,
UnsignedGreaterEqual);
}
WASM_SIMD_TEST(I8x16LtU) {
- RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16LtU,
+ RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16LtU,
UnsignedLess);
}
WASM_SIMD_TEST(I8x16LeU) {
- RunI8x16CompareOpTest(execution_mode, lower_simd, kExprI8x16LeU,
+ RunI8x16CompareOpTest(execution_tier, lower_simd, kExprI8x16LeU,
UnsignedLessEqual);
}
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \
V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST(I8x16Mul) {
- RunI8x16BinOpTest(execution_mode, lower_simd, kExprI8x16Mul, Mul);
+ RunI8x16BinOpTest(execution_tier, lower_simd, kExprI8x16Mul, Mul);
}
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
-void RunI8x16ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunI8x16ShiftOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op, Int8ShiftOp expected_op) {
for (int shift = 1; shift < 8; ++shift) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd);
byte a = 0;
byte expected = 1;
byte simd = r.AllocateLocal(kWasmS128);
@@ -1586,17 +1581,17 @@ void RunI8x16ShiftOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS || \
V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST(I8x16Shl) {
- RunI8x16ShiftOpTest(execution_mode, lower_simd, kExprI8x16Shl,
+ RunI8x16ShiftOpTest(execution_tier, lower_simd, kExprI8x16Shl,
LogicalShiftLeft);
}
WASM_SIMD_TEST(I8x16ShrS) {
- RunI8x16ShiftOpTest(execution_mode, lower_simd, kExprI8x16ShrS,
+ RunI8x16ShiftOpTest(execution_tier, lower_simd, kExprI8x16ShrS,
ArithmeticShiftRight);
}
WASM_SIMD_TEST(I8x16ShrU) {
- RunI8x16ShiftOpTest(execution_mode, lower_simd, kExprI8x16ShrU,
+ RunI8x16ShiftOpTest(execution_tier, lower_simd, kExprI8x16ShrU,
LogicalShiftRight);
}
#endif // V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64 || V8_TARGET_ARCH_MIPS ||
@@ -1607,7 +1602,7 @@ WASM_SIMD_TEST(I8x16ShrU) {
// vector.
#define WASM_SIMD_SELECT_TEST(format) \
WASM_SIMD_TEST(S##format##Select) { \
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode, lower_simd); \
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier, lower_simd); \
byte val1 = 0; \
byte val2 = 1; \
byte src1 = r.AllocateLocal(kWasmS128); \
@@ -1647,7 +1642,7 @@ WASM_SIMD_SELECT_TEST(8x16)
// rest 0. The mask is not the result of a comparison op.
#define WASM_SIMD_NON_CANONICAL_SELECT_TEST(format) \
WASM_SIMD_TEST(S##format##NonCanonicalSelect) { \
- WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode, \
+ WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier, \
lower_simd); \
byte val1 = 0; \
byte val2 = 1; \
@@ -1684,16 +1679,16 @@ WASM_SIMD_NON_CANONICAL_SELECT_TEST(8x16)
// Test binary ops with two lane test patterns, all lanes distinct.
template <typename T>
void RunBinaryLaneOpTest(
- WasmExecutionMode execution_mode, LowerSimd lower_simd, WasmOpcode simd_op,
+ ExecutionTier execution_tier, LowerSimd lower_simd, WasmOpcode simd_op,
const std::array<T, kSimd128Size / sizeof(T)>& expected) {
- WasmRunner<int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t> r(execution_tier, lower_simd);
// Set up two test patterns as globals, e.g. [0, 1, 2, 3] and [4, 5, 6, 7].
T* src0 = r.builder().AddGlobal<T>(kWasmS128);
T* src1 = r.builder().AddGlobal<T>(kWasmS128);
static const int kElems = kSimd128Size / sizeof(T);
for (int i = 0; i < kElems; i++) {
- src0[i] = i;
- src1[i] = kElems + i;
+ WriteLittleEndianValue<T>(&src0[i], i);
+ WriteLittleEndianValue<T>(&src1[i], kElems + i);
}
if (simd_op == kExprS8x16Shuffle) {
BUILD(r,
@@ -1710,50 +1705,50 @@ void RunBinaryLaneOpTest(
CHECK_EQ(1, r.Call());
for (size_t i = 0; i < expected.size(); i++) {
- CHECK_EQ(src0[i], expected[i]);
+ CHECK_EQ(ReadLittleEndianValue<T>(&src0[i]), expected[i]);
}
}
WASM_SIMD_TEST(I32x4AddHoriz) {
// Inputs are [0 1 2 3] and [4 5 6 7].
- RunBinaryLaneOpTest<int32_t>(execution_mode, lower_simd, kExprI32x4AddHoriz,
+ RunBinaryLaneOpTest<int32_t>(execution_tier, lower_simd, kExprI32x4AddHoriz,
{{1, 5, 9, 13}});
}
WASM_SIMD_TEST(I16x8AddHoriz) {
// Inputs are [0 1 2 3 4 5 6 7] and [8 9 10 11 12 13 14 15].
- RunBinaryLaneOpTest<int16_t>(execution_mode, lower_simd, kExprI16x8AddHoriz,
+ RunBinaryLaneOpTest<int16_t>(execution_tier, lower_simd, kExprI16x8AddHoriz,
{{1, 5, 9, 13, 17, 21, 25, 29}});
}
WASM_SIMD_TEST(F32x4AddHoriz) {
// Inputs are [0.0f 1.0f 2.0f 3.0f] and [4.0f 5.0f 6.0f 7.0f].
- RunBinaryLaneOpTest<float>(execution_mode, lower_simd, kExprF32x4AddHoriz,
+ RunBinaryLaneOpTest<float>(execution_tier, lower_simd, kExprF32x4AddHoriz,
{{1.0f, 5.0f, 9.0f, 13.0f}});
}
// Test shuffle ops.
-void RunShuffleOpTest(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+void RunShuffleOpTest(ExecutionTier execution_tier, LowerSimd lower_simd,
WasmOpcode simd_op,
const std::array<int8_t, kSimd128Size>& shuffle) {
// Test the original shuffle.
- RunBinaryLaneOpTest<int8_t>(execution_mode, lower_simd, simd_op, shuffle);
+ RunBinaryLaneOpTest<int8_t>(execution_tier, lower_simd, simd_op, shuffle);
// Test a non-canonical (inputs reversed) version of the shuffle.
std::array<int8_t, kSimd128Size> other_shuffle(shuffle);
for (size_t i = 0; i < shuffle.size(); ++i) other_shuffle[i] ^= kSimd128Size;
- RunBinaryLaneOpTest<int8_t>(execution_mode, lower_simd, simd_op,
+ RunBinaryLaneOpTest<int8_t>(execution_tier, lower_simd, simd_op,
other_shuffle);
// Test the swizzle (one-operand) version of the shuffle.
std::array<int8_t, kSimd128Size> swizzle(shuffle);
for (size_t i = 0; i < shuffle.size(); ++i) swizzle[i] &= (kSimd128Size - 1);
- RunBinaryLaneOpTest<int8_t>(execution_mode, lower_simd, simd_op, swizzle);
+ RunBinaryLaneOpTest<int8_t>(execution_tier, lower_simd, simd_op, swizzle);
// Test the non-canonical swizzle (one-operand) version of the shuffle.
std::array<int8_t, kSimd128Size> other_swizzle(shuffle);
for (size_t i = 0; i < shuffle.size(); ++i) other_swizzle[i] |= kSimd128Size;
- RunBinaryLaneOpTest<int8_t>(execution_mode, lower_simd, simd_op,
+ RunBinaryLaneOpTest<int8_t>(execution_tier, lower_simd, simd_op,
other_swizzle);
}
@@ -1868,7 +1863,7 @@ ShuffleMap test_shuffles = {
WASM_SIMD_TEST(Name) { \
ShuffleMap::const_iterator it = test_shuffles.find(k##Name); \
DCHECK_NE(it, test_shuffles.end()); \
- RunShuffleOpTest(execution_mode, lower_simd, kExprS8x16Shuffle, \
+ RunShuffleOpTest(execution_tier, lower_simd, kExprS8x16Shuffle, \
it->second); \
}
SHUFFLE_LIST(SHUFFLE_TEST)
@@ -1881,7 +1876,7 @@ WASM_SIMD_TEST(S8x16Blend) {
for (int bias = 1; bias < kSimd128Size; bias++) {
for (int i = 0; i < bias; i++) expected[i] = i;
for (int i = bias; i < kSimd128Size; i++) expected[i] = i + kSimd128Size;
- RunShuffleOpTest(execution_mode, lower_simd, kExprS8x16Shuffle, expected);
+ RunShuffleOpTest(execution_tier, lower_simd, kExprS8x16Shuffle, expected);
}
}
@@ -1899,7 +1894,7 @@ WASM_SIMD_TEST(S8x16Concat) {
for (int j = 0; j < n; ++j) {
expected[i++] = j + kSimd128Size;
}
- RunShuffleOpTest(execution_mode, lower_simd, kExprS8x16Shuffle, expected);
+ RunShuffleOpTest(execution_tier, lower_simd, kExprS8x16Shuffle, expected);
}
}
@@ -1926,7 +1921,7 @@ WASM_SIMD_TEST(S8x16ShuffleFuzz) {
for (int i = 0; i < kTests; ++i) {
auto shuffle = Combine(GetRandomTestShuffle(rng), GetRandomTestShuffle(rng),
GetRandomTestShuffle(rng));
- RunShuffleOpTest(execution_mode, lower_simd, kExprS8x16Shuffle, shuffle);
+ RunShuffleOpTest(execution_tier, lower_simd, kExprS8x16Shuffle, shuffle);
}
}
@@ -1957,35 +1952,34 @@ void BuildShuffle(std::vector<Shuffle>& shuffles, std::vector<byte>* buffer) {
}
// Runs tests of compiled code, using the interpreter as a reference.
-#define WASM_SIMD_COMPILED_TEST(name) \
- void RunWasm_##name##_Impl(LowerSimd lower_simd, \
- WasmExecutionMode execution_mode); \
- TEST(RunWasm_##name##_turbofan) { \
- EXPERIMENTAL_FLAG_SCOPE(simd); \
- RunWasm_##name##_Impl(kNoLowerSimd, kExecuteTurbofan); \
- } \
- TEST(RunWasm_##name##_simd_lowered) { \
- EXPERIMENTAL_FLAG_SCOPE(simd); \
- RunWasm_##name##_Impl(kLowerSimd, kExecuteTurbofan); \
- } \
- void RunWasm_##name##_Impl(LowerSimd lower_simd, \
- WasmExecutionMode execution_mode)
-
-void RunWasmCode(WasmExecutionMode execution_mode, LowerSimd lower_simd,
+#define WASM_SIMD_COMPILED_TEST(name) \
+ void RunWasm_##name##_Impl(LowerSimd lower_simd, \
+ ExecutionTier execution_tier); \
+ TEST(RunWasm_##name##_turbofan) { \
+ EXPERIMENTAL_FLAG_SCOPE(simd); \
+ RunWasm_##name##_Impl(kNoLowerSimd, ExecutionTier::kOptimized); \
+ } \
+ TEST(RunWasm_##name##_simd_lowered) { \
+ EXPERIMENTAL_FLAG_SCOPE(simd); \
+ RunWasm_##name##_Impl(kLowerSimd, ExecutionTier::kOptimized); \
+ } \
+ void RunWasm_##name##_Impl(LowerSimd lower_simd, ExecutionTier execution_tier)
+
+void RunWasmCode(ExecutionTier execution_tier, LowerSimd lower_simd,
const std::vector<byte>& code,
std::array<int8_t, kSimd128Size>* result) {
- WasmRunner<int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t> r(execution_tier, lower_simd);
// Set up two test patterns as globals, e.g. [0, 1, 2, 3] and [4, 5, 6, 7].
int8_t* src0 = r.builder().AddGlobal<int8_t>(kWasmS128);
int8_t* src1 = r.builder().AddGlobal<int8_t>(kWasmS128);
for (int i = 0; i < kSimd128Size; ++i) {
- src0[i] = i;
- src1[i] = kSimd128Size + i;
+ WriteLittleEndianValue<int8_t>(&src0[i], i);
+ WriteLittleEndianValue<int8_t>(&src1[i], kSimd128Size + i);
}
r.Build(code.data(), code.data() + code.size());
CHECK_EQ(1, r.Call());
for (size_t i = 0; i < kSimd128Size; i++) {
- (*result)[i] = src0[i];
+ (*result)[i] = ReadLittleEndianValue<int8_t>(&src0[i]);
}
}
@@ -2009,10 +2003,10 @@ WASM_SIMD_COMPILED_TEST(S8x16MultiShuffleFuzz) {
// Run the code using the interpreter to get the expected result.
std::array<int8_t, kSimd128Size> expected;
- RunWasmCode(kExecuteInterpreter, kNoLowerSimd, buffer, &expected);
+ RunWasmCode(ExecutionTier::kInterpreter, kNoLowerSimd, buffer, &expected);
// Run the SIMD or scalar lowered compiled code and compare results.
std::array<int8_t, kSimd128Size> result;
- RunWasmCode(execution_mode, lower_simd, buffer, &result);
+ RunWasmCode(execution_tier, lower_simd, buffer, &result);
for (size_t i = 0; i < kSimd128Size; ++i) {
CHECK_EQ(result[i], expected[i]);
}
@@ -2024,7 +2018,7 @@ WASM_SIMD_COMPILED_TEST(S8x16MultiShuffleFuzz) {
// test inputs. Test inputs with all true, all false, one true, and one false.
#define WASM_SIMD_BOOL_REDUCTION_TEST(format, lanes) \
WASM_SIMD_TEST(ReductionTest##lanes) { \
- WasmRunner<int32_t> r(execution_mode, lower_simd); \
+ WasmRunner<int32_t> r(execution_tier, lower_simd); \
byte zero = r.AllocateLocal(kWasmS128); \
byte one_one = r.AllocateLocal(kWasmS128); \
byte reduced = r.AllocateLocal(kWasmI32); \
@@ -2097,7 +2091,7 @@ WASM_SIMD_BOOL_REDUCTION_TEST(16x8, 8)
WASM_SIMD_BOOL_REDUCTION_TEST(8x16, 16)
WASM_SIMD_TEST(SimdI32x4ExtractWithF32x4) {
- WasmRunner<int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t> r(execution_tier, lower_simd);
BUILD(r, WASM_IF_ELSE_I(
WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE(
0, WASM_SIMD_F32x4_SPLAT(WASM_F32(30.5))),
@@ -2109,7 +2103,7 @@ WASM_SIMD_TEST(SimdI32x4ExtractWithF32x4) {
// V8_TARGET_ARCH_MIPS64 || V8_TARGET_ARCH_IA32
WASM_SIMD_TEST(SimdF32x4ExtractWithI32x4) {
- WasmRunner<int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t> r(execution_tier, lower_simd);
BUILD(r,
WASM_IF_ELSE_I(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE(
0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(15))),
@@ -2123,7 +2117,7 @@ WASM_SIMD_TEST(SimdF32x4AddWithI32x4) {
// representable as a float.
const int kOne = 0x3F800000;
const int kTwo = 0x40000000;
- WasmRunner<int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t> r(execution_tier, lower_simd);
BUILD(r,
WASM_IF_ELSE_I(
WASM_F32_EQ(
@@ -2138,7 +2132,7 @@ WASM_SIMD_TEST(SimdF32x4AddWithI32x4) {
}
WASM_SIMD_TEST(SimdI32x4AddWithF32x4) {
- WasmRunner<int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t> r(execution_tier, lower_simd);
BUILD(r,
WASM_IF_ELSE_I(
WASM_I32_EQ(
@@ -2153,7 +2147,7 @@ WASM_SIMD_TEST(SimdI32x4AddWithF32x4) {
}
WASM_SIMD_TEST(SimdI32x4Local) {
- WasmRunner<int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t> r(execution_tier, lower_simd);
r.AllocateLocal(kWasmS128);
BUILD(r, WASM_SET_LOCAL(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(31))),
@@ -2162,7 +2156,7 @@ WASM_SIMD_TEST(SimdI32x4Local) {
}
WASM_SIMD_TEST(SimdI32x4SplatFromExtract) {
- WasmRunner<int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t> r(execution_tier, lower_simd);
r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmS128);
BUILD(r, WASM_SET_LOCAL(0, WASM_SIMD_I32x4_EXTRACT_LANE(
@@ -2173,7 +2167,7 @@ WASM_SIMD_TEST(SimdI32x4SplatFromExtract) {
}
WASM_SIMD_TEST(SimdI32x4For) {
- WasmRunner<int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t> r(execution_tier, lower_simd);
r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmS128);
BUILD(r,
@@ -2207,7 +2201,7 @@ WASM_SIMD_TEST(SimdI32x4For) {
}
WASM_SIMD_TEST(SimdF32x4For) {
- WasmRunner<int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t> r(execution_tier, lower_simd);
r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmS128);
BUILD(r, WASM_SET_LOCAL(1, WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25))),
@@ -2233,30 +2227,21 @@ WASM_SIMD_TEST(SimdF32x4For) {
template <typename T, int numLanes = 4>
void SetVectorByLanes(T* v, const std::array<T, numLanes>& arr) {
for (int lane = 0; lane < numLanes; lane++) {
- const T& value = arr[lane];
-#if defined(V8_TARGET_BIG_ENDIAN)
- v[numLanes - 1 - lane] = value;
-#else
- v[lane] = value;
-#endif
+ WriteLittleEndianValue<T>(&v[lane], arr[lane]);
}
}
template <typename T>
-const T& GetScalar(T* v, int lane) {
+const T GetScalar(T* v, int lane) {
constexpr int kElems = kSimd128Size / sizeof(T);
-#if defined(V8_TARGET_BIG_ENDIAN)
- const int index = kElems - 1 - lane;
-#else
const int index = lane;
-#endif
USE(kElems);
DCHECK(index >= 0 && index < kElems);
- return v[index];
+ return ReadLittleEndianValue<T>(&v[index]);
}
WASM_SIMD_TEST(SimdI32x4GetGlobal) {
- WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
// Pad the globals with a few unused slots to get a non-zero offset.
r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused
r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused
@@ -2284,7 +2269,7 @@ WASM_SIMD_TEST(SimdI32x4GetGlobal) {
}
WASM_SIMD_TEST(SimdI32x4SetGlobal) {
- WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
// Pad the globals with a few unused slots to get a non-zero offset.
r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused
r.builder().AddGlobal<int32_t>(kWasmI32); // purposefully unused
@@ -2307,7 +2292,7 @@ WASM_SIMD_TEST(SimdI32x4SetGlobal) {
}
WASM_SIMD_TEST(SimdF32x4GetGlobal) {
- WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
float* global = r.builder().AddGlobal<float>(kWasmS128);
SetVectorByLanes<float>(global, {{0.0, 1.5, 2.25, 3.5}});
r.AllocateLocal(kWasmI32);
@@ -2330,7 +2315,7 @@ WASM_SIMD_TEST(SimdF32x4GetGlobal) {
}
WASM_SIMD_TEST(SimdF32x4SetGlobal) {
- WasmRunner<int32_t, int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t, int32_t> r(execution_tier, lower_simd);
float* global = r.builder().AddGlobal<float>(kWasmS128);
BUILD(r, WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_SPLAT(WASM_F32(13.5))),
WASM_SET_GLOBAL(0, WASM_SIMD_F32x4_REPLACE_LANE(1, WASM_GET_GLOBAL(0),
@@ -2348,7 +2333,7 @@ WASM_SIMD_TEST(SimdF32x4SetGlobal) {
}
WASM_SIMD_TEST(SimdLoadStoreLoad) {
- WasmRunner<int32_t> r(execution_mode, lower_simd);
+ WasmRunner<int32_t> r(execution_tier, lower_simd);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
// Load memory, store it, then reload it and extract the first lane. Use a
diff --git a/deps/v8/test/cctest/wasm/test-run-wasm.cc b/deps/v8/test/cctest/wasm/test-run-wasm.cc
index bf47ddeadb..0ba12aedd9 100644
--- a/deps/v8/test/cctest/wasm/test-run-wasm.cc
+++ b/deps/v8/test/cctest/wasm/test-run-wasm.cc
@@ -27,7 +27,7 @@ namespace test_run_wasm {
#define RET_I8(x) WASM_I32V_2(x), kExprReturn
WASM_EXEC_TEST(Int32Const) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
const int32_t kExpectedValue = 0x11223344;
// return(kExpectedValue)
BUILD(r, WASM_I32V_5(kExpectedValue));
@@ -36,7 +36,7 @@ WASM_EXEC_TEST(Int32Const) {
WASM_EXEC_TEST(Int32Const_many) {
FOR_INT32_INPUTS(i) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
const int32_t kExpectedValue = *i;
// return(kExpectedValue)
BUILD(r, WASM_I32V(kExpectedValue));
@@ -46,58 +46,58 @@ WASM_EXEC_TEST(Int32Const_many) {
WASM_EXEC_TEST(GraphTrimming) {
// This WebAssembly code requires graph trimming in the TurboFan compiler.
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, kExprGetLocal, 0, kExprGetLocal, 0, kExprGetLocal, 0, kExprI32RemS,
kExprI32Eq, kExprGetLocal, 0, kExprI32DivS, kExprUnreachable);
r.Call(1);
}
WASM_EXEC_TEST(Int32Param0) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Int32Param0_fallthru) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Int32Param1) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Int32Add) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// 11 + 44
BUILD(r, WASM_I32_ADD(WASM_I32V_1(11), WASM_I32V_1(44)));
CHECK_EQ(55, r.Call());
}
WASM_EXEC_TEST(Int32Add_P) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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(*i + 13, r.Call(*i)); }
}
WASM_EXEC_TEST(Int32Add_P_fallthru) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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(*i + 13, r.Call(*i)); }
}
-static void RunInt32AddTest(WasmExecutionMode execution_mode, const byte* code,
+static void RunInt32AddTest(ExecutionTier execution_tier, const byte* code,
size_t size) {
TestSignatures sigs;
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().AddSignature(sigs.ii_v());
r.builder().AddSignature(sigs.iii_v());
r.Build(code, code + size);
@@ -114,7 +114,7 @@ WASM_EXEC_TEST(Int32Add_P2) {
EXPERIMENTAL_FLAG_SCOPE(mv);
static const byte code[] = {
WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))};
- RunInt32AddTest(execution_mode, code, sizeof(code));
+ RunInt32AddTest(execution_tier, code, sizeof(code));
}
WASM_EXEC_TEST(Int32Add_block1) {
@@ -122,7 +122,7 @@ WASM_EXEC_TEST(Int32Add_block1) {
static const byte code[] = {
WASM_BLOCK_X(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
kExprI32Add};
- RunInt32AddTest(execution_mode, code, sizeof(code));
+ RunInt32AddTest(execution_tier, code, sizeof(code));
}
WASM_EXEC_TEST(Int32Add_block2) {
@@ -130,7 +130,7 @@ WASM_EXEC_TEST(Int32Add_block2) {
static const byte code[] = {
WASM_BLOCK_X(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), kExprBr, DEPTH_0),
kExprI32Add};
- RunInt32AddTest(execution_mode, code, sizeof(code));
+ RunInt32AddTest(execution_tier, code, sizeof(code));
}
WASM_EXEC_TEST(Int32Add_multi_if) {
@@ -140,11 +140,11 @@ WASM_EXEC_TEST(Int32Add_multi_if) {
WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)),
WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))),
kExprI32Add};
- RunInt32AddTest(execution_mode, code, sizeof(code));
+ RunInt32AddTest(execution_tier, code, sizeof(code));
}
WASM_EXEC_TEST(Float32Add) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// int(11.5f + 44.5f)
BUILD(r,
WASM_I32_SCONVERT_F32(WASM_F32_ADD(WASM_F32(11.5f), WASM_F32(44.5f))));
@@ -152,7 +152,7 @@ WASM_EXEC_TEST(Float32Add) {
}
WASM_EXEC_TEST(Float64Add) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// return int(13.5d + 43.5d)
BUILD(r, WASM_I32_SCONVERT_F64(WASM_F64_ADD(WASM_F64(13.5), WASM_F64(43.5))));
CHECK_EQ(57, r.Call());
@@ -161,18 +161,18 @@ WASM_EXEC_TEST(Float64Add) {
// clang-format messes up the FOR_INT32_INPUTS macros.
// clang-format off
template<typename ctype>
-static void TestInt32Binop(WasmExecutionMode execution_mode, WasmOpcode opcode,
+static void TestInt32Binop(ExecutionTier execution_tier, WasmOpcode opcode,
ctype(*expected)(ctype, ctype)) {
FOR_INT32_INPUTS(i) {
FOR_INT32_INPUTS(j) {
- WasmRunner<ctype> r(execution_mode);
+ 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());
}
}
{
- WasmRunner<ctype, ctype, ctype> r(execution_mode);
+ WasmRunner<ctype, ctype, ctype> r(execution_tier);
// Apply {opcode} on two parameters.
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_INT32_INPUTS(i) {
@@ -186,7 +186,7 @@ static void TestInt32Binop(WasmExecutionMode execution_mode, WasmOpcode opcode,
#define WASM_I32_BINOP_TEST(expr, ctype, expected) \
WASM_EXEC_TEST(I32Binop_##expr) { \
- TestInt32Binop<ctype>(execution_mode, kExprI32##expr, \
+ TestInt32Binop<ctype>(execution_tier, kExprI32##expr, \
[](ctype a, ctype b) -> ctype { return expected; }); \
}
@@ -221,16 +221,16 @@ WASM_I32_BINOP_TEST(GeU, uint32_t, a >= b)
#undef WASM_I32_BINOP_TEST
-void TestInt32Unop(WasmExecutionMode execution_mode, WasmOpcode opcode,
+void TestInt32Unop(ExecutionTier execution_tier, WasmOpcode opcode,
int32_t expected, int32_t a) {
{
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// return op K
BUILD(r, WASM_UNOP(opcode, WASM_I32V(a)));
CHECK_EQ(expected, r.Call());
}
{
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// return op a
BUILD(r, WASM_UNOP(opcode, WASM_GET_LOCAL(0)));
CHECK_EQ(expected, r.Call(a));
@@ -238,96 +238,96 @@ void TestInt32Unop(WasmExecutionMode execution_mode, WasmOpcode opcode,
}
WASM_EXEC_TEST(Int32Clz) {
- TestInt32Unop(execution_mode, kExprI32Clz, 0, 0x80001000);
- TestInt32Unop(execution_mode, kExprI32Clz, 1, 0x40000500);
- TestInt32Unop(execution_mode, kExprI32Clz, 2, 0x20000300);
- TestInt32Unop(execution_mode, kExprI32Clz, 3, 0x10000003);
- TestInt32Unop(execution_mode, kExprI32Clz, 4, 0x08050000);
- TestInt32Unop(execution_mode, kExprI32Clz, 5, 0x04006000);
- TestInt32Unop(execution_mode, kExprI32Clz, 6, 0x02000000);
- TestInt32Unop(execution_mode, kExprI32Clz, 7, 0x010000A0);
- TestInt32Unop(execution_mode, kExprI32Clz, 8, 0x00800C00);
- TestInt32Unop(execution_mode, kExprI32Clz, 9, 0x00400000);
- TestInt32Unop(execution_mode, kExprI32Clz, 10, 0x0020000D);
- TestInt32Unop(execution_mode, kExprI32Clz, 11, 0x00100F00);
- TestInt32Unop(execution_mode, kExprI32Clz, 12, 0x00080000);
- TestInt32Unop(execution_mode, kExprI32Clz, 13, 0x00041000);
- TestInt32Unop(execution_mode, kExprI32Clz, 14, 0x00020020);
- TestInt32Unop(execution_mode, kExprI32Clz, 15, 0x00010300);
- TestInt32Unop(execution_mode, kExprI32Clz, 16, 0x00008040);
- TestInt32Unop(execution_mode, kExprI32Clz, 17, 0x00004005);
- TestInt32Unop(execution_mode, kExprI32Clz, 18, 0x00002050);
- TestInt32Unop(execution_mode, kExprI32Clz, 19, 0x00001700);
- TestInt32Unop(execution_mode, kExprI32Clz, 20, 0x00000870);
- TestInt32Unop(execution_mode, kExprI32Clz, 21, 0x00000405);
- TestInt32Unop(execution_mode, kExprI32Clz, 22, 0x00000203);
- TestInt32Unop(execution_mode, kExprI32Clz, 23, 0x00000101);
- TestInt32Unop(execution_mode, kExprI32Clz, 24, 0x00000089);
- TestInt32Unop(execution_mode, kExprI32Clz, 25, 0x00000041);
- TestInt32Unop(execution_mode, kExprI32Clz, 26, 0x00000022);
- TestInt32Unop(execution_mode, kExprI32Clz, 27, 0x00000013);
- TestInt32Unop(execution_mode, kExprI32Clz, 28, 0x00000008);
- TestInt32Unop(execution_mode, kExprI32Clz, 29, 0x00000004);
- TestInt32Unop(execution_mode, kExprI32Clz, 30, 0x00000002);
- TestInt32Unop(execution_mode, kExprI32Clz, 31, 0x00000001);
- TestInt32Unop(execution_mode, kExprI32Clz, 32, 0x00000000);
+ TestInt32Unop(execution_tier, kExprI32Clz, 0, 0x80001000);
+ TestInt32Unop(execution_tier, kExprI32Clz, 1, 0x40000500);
+ TestInt32Unop(execution_tier, kExprI32Clz, 2, 0x20000300);
+ TestInt32Unop(execution_tier, kExprI32Clz, 3, 0x10000003);
+ TestInt32Unop(execution_tier, kExprI32Clz, 4, 0x08050000);
+ TestInt32Unop(execution_tier, kExprI32Clz, 5, 0x04006000);
+ TestInt32Unop(execution_tier, kExprI32Clz, 6, 0x02000000);
+ TestInt32Unop(execution_tier, kExprI32Clz, 7, 0x010000A0);
+ TestInt32Unop(execution_tier, kExprI32Clz, 8, 0x00800C00);
+ TestInt32Unop(execution_tier, kExprI32Clz, 9, 0x00400000);
+ TestInt32Unop(execution_tier, kExprI32Clz, 10, 0x0020000D);
+ TestInt32Unop(execution_tier, kExprI32Clz, 11, 0x00100F00);
+ TestInt32Unop(execution_tier, kExprI32Clz, 12, 0x00080000);
+ TestInt32Unop(execution_tier, kExprI32Clz, 13, 0x00041000);
+ TestInt32Unop(execution_tier, kExprI32Clz, 14, 0x00020020);
+ TestInt32Unop(execution_tier, kExprI32Clz, 15, 0x00010300);
+ TestInt32Unop(execution_tier, kExprI32Clz, 16, 0x00008040);
+ TestInt32Unop(execution_tier, kExprI32Clz, 17, 0x00004005);
+ TestInt32Unop(execution_tier, kExprI32Clz, 18, 0x00002050);
+ TestInt32Unop(execution_tier, kExprI32Clz, 19, 0x00001700);
+ TestInt32Unop(execution_tier, kExprI32Clz, 20, 0x00000870);
+ TestInt32Unop(execution_tier, kExprI32Clz, 21, 0x00000405);
+ TestInt32Unop(execution_tier, kExprI32Clz, 22, 0x00000203);
+ TestInt32Unop(execution_tier, kExprI32Clz, 23, 0x00000101);
+ TestInt32Unop(execution_tier, kExprI32Clz, 24, 0x00000089);
+ TestInt32Unop(execution_tier, kExprI32Clz, 25, 0x00000041);
+ TestInt32Unop(execution_tier, kExprI32Clz, 26, 0x00000022);
+ TestInt32Unop(execution_tier, kExprI32Clz, 27, 0x00000013);
+ TestInt32Unop(execution_tier, kExprI32Clz, 28, 0x00000008);
+ TestInt32Unop(execution_tier, kExprI32Clz, 29, 0x00000004);
+ TestInt32Unop(execution_tier, kExprI32Clz, 30, 0x00000002);
+ TestInt32Unop(execution_tier, kExprI32Clz, 31, 0x00000001);
+ TestInt32Unop(execution_tier, kExprI32Clz, 32, 0x00000000);
}
WASM_EXEC_TEST(Int32Ctz) {
- TestInt32Unop(execution_mode, kExprI32Ctz, 32, 0x00000000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 31, 0x80000000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 30, 0x40000000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 29, 0x20000000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 28, 0x10000000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 27, 0xA8000000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 26, 0xF4000000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 25, 0x62000000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 24, 0x91000000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 23, 0xCD800000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 22, 0x09400000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 21, 0xAF200000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 20, 0xAC100000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 19, 0xE0B80000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 18, 0x9CE40000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 17, 0xC7920000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 16, 0xB8F10000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 15, 0x3B9F8000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 14, 0xDB4C4000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 13, 0xE9A32000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 12, 0xFCA61000);
- TestInt32Unop(execution_mode, kExprI32Ctz, 11, 0x6C8A7800);
- TestInt32Unop(execution_mode, kExprI32Ctz, 10, 0x8CE5A400);
- TestInt32Unop(execution_mode, kExprI32Ctz, 9, 0xCB7D0200);
- TestInt32Unop(execution_mode, kExprI32Ctz, 8, 0xCB4DC100);
- TestInt32Unop(execution_mode, kExprI32Ctz, 7, 0xDFBEC580);
- TestInt32Unop(execution_mode, kExprI32Ctz, 6, 0x27A9DB40);
- TestInt32Unop(execution_mode, kExprI32Ctz, 5, 0xDE3BCB20);
- TestInt32Unop(execution_mode, kExprI32Ctz, 4, 0xD7E8A610);
- TestInt32Unop(execution_mode, kExprI32Ctz, 3, 0x9AFDBC88);
- TestInt32Unop(execution_mode, kExprI32Ctz, 2, 0x9AFDBC84);
- TestInt32Unop(execution_mode, kExprI32Ctz, 1, 0x9AFDBC82);
- TestInt32Unop(execution_mode, kExprI32Ctz, 0, 0x9AFDBC81);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 32, 0x00000000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 31, 0x80000000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 30, 0x40000000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 29, 0x20000000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 28, 0x10000000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 27, 0xA8000000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 26, 0xF4000000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 25, 0x62000000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 24, 0x91000000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 23, 0xCD800000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 22, 0x09400000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 21, 0xAF200000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 20, 0xAC100000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 19, 0xE0B80000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 18, 0x9CE40000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 17, 0xC7920000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 16, 0xB8F10000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 15, 0x3B9F8000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 14, 0xDB4C4000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 13, 0xE9A32000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 12, 0xFCA61000);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 11, 0x6C8A7800);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 10, 0x8CE5A400);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 9, 0xCB7D0200);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 8, 0xCB4DC100);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 7, 0xDFBEC580);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 6, 0x27A9DB40);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 5, 0xDE3BCB20);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 4, 0xD7E8A610);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 3, 0x9AFDBC88);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 2, 0x9AFDBC84);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 1, 0x9AFDBC82);
+ TestInt32Unop(execution_tier, kExprI32Ctz, 0, 0x9AFDBC81);
}
WASM_EXEC_TEST(Int32Popcnt) {
- TestInt32Unop(execution_mode, kExprI32Popcnt, 32, 0xFFFFFFFF);
- TestInt32Unop(execution_mode, kExprI32Popcnt, 0, 0x00000000);
- TestInt32Unop(execution_mode, kExprI32Popcnt, 1, 0x00008000);
- TestInt32Unop(execution_mode, kExprI32Popcnt, 13, 0x12345678);
- TestInt32Unop(execution_mode, kExprI32Popcnt, 19, 0xFEDCBA09);
+ TestInt32Unop(execution_tier, kExprI32Popcnt, 32, 0xFFFFFFFF);
+ TestInt32Unop(execution_tier, kExprI32Popcnt, 0, 0x00000000);
+ TestInt32Unop(execution_tier, kExprI32Popcnt, 1, 0x00008000);
+ TestInt32Unop(execution_tier, kExprI32Popcnt, 13, 0x12345678);
+ TestInt32Unop(execution_tier, kExprI32Popcnt, 19, 0xFEDCBA09);
}
WASM_EXEC_TEST(I32Eqz) {
- TestInt32Unop(execution_mode, kExprI32Eqz, 0, 1);
- TestInt32Unop(execution_mode, kExprI32Eqz, 0, -1);
- TestInt32Unop(execution_mode, kExprI32Eqz, 0, -827343);
- TestInt32Unop(execution_mode, kExprI32Eqz, 0, 8888888);
- TestInt32Unop(execution_mode, kExprI32Eqz, 1, 0);
+ TestInt32Unop(execution_tier, kExprI32Eqz, 0, 1);
+ TestInt32Unop(execution_tier, kExprI32Eqz, 0, -1);
+ TestInt32Unop(execution_tier, kExprI32Eqz, 0, -827343);
+ TestInt32Unop(execution_tier, kExprI32Eqz, 0, 8888888);
+ TestInt32Unop(execution_tier, kExprI32Eqz, 1, 0);
}
WASM_EXEC_TEST(Int32DivS_trap) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
CHECK_EQ(0, r.Call(0, 100));
@@ -338,7 +338,7 @@ WASM_EXEC_TEST(Int32DivS_trap) {
}
WASM_EXEC_TEST(Int32RemS_trap) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
CHECK_EQ(33, r.Call(133, 100));
@@ -349,7 +349,7 @@ WASM_EXEC_TEST(Int32RemS_trap) {
}
WASM_EXEC_TEST(Int32DivU_trap) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
const int32_t kMin = std::numeric_limits<int32_t>::min();
CHECK_EQ(0, r.Call(0, 100));
@@ -360,7 +360,7 @@ WASM_EXEC_TEST(Int32DivU_trap) {
}
WASM_EXEC_TEST(Int32RemU_trap) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(17, r.Call(217, 100));
const int32_t kMin = std::numeric_limits<int32_t>::min();
@@ -372,7 +372,7 @@ WASM_EXEC_TEST(Int32RemU_trap) {
WASM_EXEC_TEST(Int32DivS_byzero_const) {
for (int8_t denom = -2; denom < 8; ++denom) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
for (int32_t val = -7; val < 8; ++val) {
if (denom == 0) {
@@ -386,7 +386,7 @@ WASM_EXEC_TEST(Int32DivS_byzero_const) {
WASM_EXEC_TEST(Int32AsmjsDivS_byzero_const) {
for (int8_t denom = -2; denom < 8; ++denom) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_I32_ASMJS_DIVS(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
FOR_INT32_INPUTS(i) {
@@ -403,7 +403,7 @@ WASM_EXEC_TEST(Int32AsmjsDivS_byzero_const) {
WASM_EXEC_TEST(Int32AsmjsRemS_byzero_const) {
for (int8_t denom = -2; denom < 8; ++denom) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().ChangeOriginToAsmjs();
BUILD(r, WASM_I32_ASMJS_REMS(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
FOR_INT32_INPUTS(i) {
@@ -420,7 +420,7 @@ WASM_EXEC_TEST(Int32AsmjsRemS_byzero_const) {
WASM_EXEC_TEST(Int32DivU_byzero_const) {
for (uint32_t denom = 0xFFFFFFFE; denom < 8; ++denom) {
- WasmRunner<uint32_t, uint32_t> r(execution_mode);
+ WasmRunner<uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I32V_1(denom)));
for (uint32_t val = 0xFFFFFFF0; val < 8; ++val) {
@@ -434,7 +434,7 @@ WASM_EXEC_TEST(Int32DivU_byzero_const) {
}
WASM_EXEC_TEST(Int32DivS_trap_effect) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_IF_ELSE_I(
@@ -455,34 +455,34 @@ WASM_EXEC_TEST(Int32DivS_trap_effect) {
CHECK_TRAP(r.Call(0, 0));
}
-void TestFloat32Binop(WasmExecutionMode execution_mode, WasmOpcode opcode,
+void TestFloat32Binop(ExecutionTier execution_tier, WasmOpcode opcode,
int32_t expected, float a, float b) {
{
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// return K op K
BUILD(r, WASM_BINOP(opcode, WASM_F32(a), WASM_F32(b)));
CHECK_EQ(expected, r.Call());
}
{
- WasmRunner<int32_t, float, float> r(execution_mode);
+ WasmRunner<int32_t, float, float> r(execution_tier);
// return a op b
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(expected, r.Call(a, b));
}
}
-void TestFloat32BinopWithConvert(WasmExecutionMode execution_mode,
+void TestFloat32BinopWithConvert(ExecutionTier execution_tier,
WasmOpcode opcode, int32_t expected, float a,
float b) {
{
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// return int(K op K)
BUILD(r,
WASM_I32_SCONVERT_F32(WASM_BINOP(opcode, WASM_F32(a), WASM_F32(b))));
CHECK_EQ(expected, r.Call());
}
{
- WasmRunner<int32_t, float, float> r(execution_mode);
+ WasmRunner<int32_t, float, float> r(execution_tier);
// return int(a op b)
BUILD(r, WASM_I32_SCONVERT_F32(
WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
@@ -490,66 +490,66 @@ void TestFloat32BinopWithConvert(WasmExecutionMode execution_mode,
}
}
-void TestFloat32UnopWithConvert(WasmExecutionMode execution_mode,
- WasmOpcode opcode, int32_t expected, float a) {
+void TestFloat32UnopWithConvert(ExecutionTier execution_tier, WasmOpcode opcode,
+ int32_t expected, float a) {
{
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// return int(op(K))
BUILD(r, WASM_I32_SCONVERT_F32(WASM_UNOP(opcode, WASM_F32(a))));
CHECK_EQ(expected, r.Call());
}
{
- WasmRunner<int32_t, float> r(execution_mode);
+ WasmRunner<int32_t, float> r(execution_tier);
// return int(op(a))
BUILD(r, WASM_I32_SCONVERT_F32(WASM_UNOP(opcode, WASM_GET_LOCAL(0))));
CHECK_EQ(expected, r.Call(a));
}
}
-void TestFloat64Binop(WasmExecutionMode execution_mode, WasmOpcode opcode,
+void TestFloat64Binop(ExecutionTier execution_tier, WasmOpcode opcode,
int32_t expected, double a, double b) {
{
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// return K op K
BUILD(r, WASM_BINOP(opcode, WASM_F64(a), WASM_F64(b)));
CHECK_EQ(expected, r.Call());
}
{
- WasmRunner<int32_t, double, double> r(execution_mode);
+ WasmRunner<int32_t, double, double> r(execution_tier);
// return a op b
BUILD(r, WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
CHECK_EQ(expected, r.Call(a, b));
}
}
-void TestFloat64BinopWithConvert(WasmExecutionMode execution_mode,
+void TestFloat64BinopWithConvert(ExecutionTier execution_tier,
WasmOpcode opcode, int32_t expected, double a,
double b) {
{
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// return int(K op K)
BUILD(r,
WASM_I32_SCONVERT_F64(WASM_BINOP(opcode, WASM_F64(a), WASM_F64(b))));
CHECK_EQ(expected, r.Call());
}
{
- WasmRunner<int32_t, double, double> r(execution_mode);
+ WasmRunner<int32_t, double, double> r(execution_tier);
BUILD(r, WASM_I32_SCONVERT_F64(
WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))));
CHECK_EQ(expected, r.Call(a, b));
}
}
-void TestFloat64UnopWithConvert(WasmExecutionMode execution_mode,
- WasmOpcode opcode, int32_t expected, double a) {
+void TestFloat64UnopWithConvert(ExecutionTier execution_tier, WasmOpcode opcode,
+ int32_t expected, double a) {
{
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// return int(op(K))
BUILD(r, WASM_I32_SCONVERT_F64(WASM_UNOP(opcode, WASM_F64(a))));
CHECK_EQ(expected, r.Call());
}
{
- WasmRunner<int32_t, double> r(execution_mode);
+ WasmRunner<int32_t, double> r(execution_tier);
// return int(op(a))
BUILD(r, WASM_I32_SCONVERT_F64(WASM_UNOP(opcode, WASM_GET_LOCAL(0))));
CHECK_EQ(expected, r.Call(a));
@@ -557,50 +557,50 @@ void TestFloat64UnopWithConvert(WasmExecutionMode execution_mode,
}
WASM_EXEC_TEST(Float32Binops) {
- TestFloat32Binop(execution_mode, kExprF32Eq, 1, 8.125f, 8.125f);
- TestFloat32Binop(execution_mode, kExprF32Ne, 1, 8.125f, 8.127f);
- TestFloat32Binop(execution_mode, kExprF32Lt, 1, -9.5f, -9.0f);
- TestFloat32Binop(execution_mode, kExprF32Le, 1, -1111.0f, -1111.0f);
- TestFloat32Binop(execution_mode, kExprF32Gt, 1, -9.0f, -9.5f);
- TestFloat32Binop(execution_mode, kExprF32Ge, 1, -1111.0f, -1111.0f);
+ TestFloat32Binop(execution_tier, kExprF32Eq, 1, 8.125f, 8.125f);
+ TestFloat32Binop(execution_tier, kExprF32Ne, 1, 8.125f, 8.127f);
+ TestFloat32Binop(execution_tier, kExprF32Lt, 1, -9.5f, -9.0f);
+ TestFloat32Binop(execution_tier, kExprF32Le, 1, -1111.0f, -1111.0f);
+ TestFloat32Binop(execution_tier, kExprF32Gt, 1, -9.0f, -9.5f);
+ TestFloat32Binop(execution_tier, kExprF32Ge, 1, -1111.0f, -1111.0f);
- TestFloat32BinopWithConvert(execution_mode, kExprF32Add, 10, 3.5f, 6.5f);
- TestFloat32BinopWithConvert(execution_mode, kExprF32Sub, 2, 44.5f, 42.5f);
- TestFloat32BinopWithConvert(execution_mode, kExprF32Mul, -66, -132.1f, 0.5f);
- TestFloat32BinopWithConvert(execution_mode, kExprF32Div, 11, 22.1f, 2.0f);
+ TestFloat32BinopWithConvert(execution_tier, kExprF32Add, 10, 3.5f, 6.5f);
+ TestFloat32BinopWithConvert(execution_tier, kExprF32Sub, 2, 44.5f, 42.5f);
+ TestFloat32BinopWithConvert(execution_tier, kExprF32Mul, -66, -132.1f, 0.5f);
+ TestFloat32BinopWithConvert(execution_tier, kExprF32Div, 11, 22.1f, 2.0f);
}
WASM_EXEC_TEST(Float32Unops) {
- TestFloat32UnopWithConvert(execution_mode, kExprF32Abs, 8, 8.125f);
- TestFloat32UnopWithConvert(execution_mode, kExprF32Abs, 9, -9.125f);
- TestFloat32UnopWithConvert(execution_mode, kExprF32Neg, -213, 213.125f);
- TestFloat32UnopWithConvert(execution_mode, kExprF32Sqrt, 12, 144.4f);
+ TestFloat32UnopWithConvert(execution_tier, kExprF32Abs, 8, 8.125f);
+ TestFloat32UnopWithConvert(execution_tier, kExprF32Abs, 9, -9.125f);
+ TestFloat32UnopWithConvert(execution_tier, kExprF32Neg, -213, 213.125f);
+ TestFloat32UnopWithConvert(execution_tier, kExprF32Sqrt, 12, 144.4f);
}
WASM_EXEC_TEST(Float64Binops) {
- TestFloat64Binop(execution_mode, kExprF64Eq, 1, 16.25, 16.25);
- TestFloat64Binop(execution_mode, kExprF64Ne, 1, 16.25, 16.15);
- TestFloat64Binop(execution_mode, kExprF64Lt, 1, -32.4, 11.7);
- TestFloat64Binop(execution_mode, kExprF64Le, 1, -88.9, -88.9);
- TestFloat64Binop(execution_mode, kExprF64Gt, 1, 11.7, -32.4);
- TestFloat64Binop(execution_mode, kExprF64Ge, 1, -88.9, -88.9);
-
- TestFloat64BinopWithConvert(execution_mode, kExprF64Add, 100, 43.5, 56.5);
- TestFloat64BinopWithConvert(execution_mode, kExprF64Sub, 200, 12200.1,
+ TestFloat64Binop(execution_tier, kExprF64Eq, 1, 16.25, 16.25);
+ TestFloat64Binop(execution_tier, kExprF64Ne, 1, 16.25, 16.15);
+ TestFloat64Binop(execution_tier, kExprF64Lt, 1, -32.4, 11.7);
+ TestFloat64Binop(execution_tier, kExprF64Le, 1, -88.9, -88.9);
+ TestFloat64Binop(execution_tier, kExprF64Gt, 1, 11.7, -32.4);
+ TestFloat64Binop(execution_tier, kExprF64Ge, 1, -88.9, -88.9);
+
+ TestFloat64BinopWithConvert(execution_tier, kExprF64Add, 100, 43.5, 56.5);
+ TestFloat64BinopWithConvert(execution_tier, kExprF64Sub, 200, 12200.1,
12000.1);
- TestFloat64BinopWithConvert(execution_mode, kExprF64Mul, -33, 134, -0.25);
- TestFloat64BinopWithConvert(execution_mode, kExprF64Div, -1111, -2222.3, 2);
+ TestFloat64BinopWithConvert(execution_tier, kExprF64Mul, -33, 134, -0.25);
+ TestFloat64BinopWithConvert(execution_tier, kExprF64Div, -1111, -2222.3, 2);
}
WASM_EXEC_TEST(Float64Unops) {
- TestFloat64UnopWithConvert(execution_mode, kExprF64Abs, 108, 108.125);
- TestFloat64UnopWithConvert(execution_mode, kExprF64Abs, 209, -209.125);
- TestFloat64UnopWithConvert(execution_mode, kExprF64Neg, -209, 209.125);
- TestFloat64UnopWithConvert(execution_mode, kExprF64Sqrt, 13, 169.4);
+ TestFloat64UnopWithConvert(execution_tier, kExprF64Abs, 108, 108.125);
+ TestFloat64UnopWithConvert(execution_tier, kExprF64Abs, 209, -209.125);
+ TestFloat64UnopWithConvert(execution_tier, kExprF64Neg, -209, 209.125);
+ TestFloat64UnopWithConvert(execution_tier, kExprF64Sqrt, 13, 169.4);
}
WASM_EXEC_TEST(Float32Neg) {
- WasmRunner<float, float> r(execution_mode);
+ WasmRunner<float, float> r(execution_tier);
BUILD(r, WASM_F32_NEG(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
@@ -610,7 +610,7 @@ WASM_EXEC_TEST(Float32Neg) {
}
WASM_EXEC_TEST(Float64Neg) {
- WasmRunner<double, double> r(execution_mode);
+ WasmRunner<double, double> r(execution_tier);
BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
@@ -620,7 +620,7 @@ WASM_EXEC_TEST(Float64Neg) {
}
WASM_EXEC_TEST(IfElse_P) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// if (p0) return 11; else return 22;
BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), // --
WASM_I32V_1(11), // --
@@ -632,34 +632,34 @@ WASM_EXEC_TEST(IfElse_P) {
}
WASM_EXEC_TEST(If_empty1) {
- WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(IfElse_empty1) {
- WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(IfElse_empty2) {
- WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(IfElse_empty3) {
- WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(If_chain1) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// 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));
@@ -667,7 +667,7 @@ WASM_EXEC_TEST(If_chain1) {
}
WASM_EXEC_TEST(If_chain_set) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
// if (p0) p1 = 73; if (p0) p1 = 74; p1
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I32V_2(73))),
WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(1, WASM_I32V_2(74))),
@@ -679,7 +679,7 @@ WASM_EXEC_TEST(If_chain_set) {
}
WASM_EXEC_TEST(IfElse_Unreachable1) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// 0 ? unreachable : 27
BUILD(r, WASM_IF_ELSE_I(WASM_ZERO, // --
WASM_UNREACHABLE, // --
@@ -688,7 +688,7 @@ WASM_EXEC_TEST(IfElse_Unreachable1) {
}
WASM_EXEC_TEST(IfElse_Unreachable2) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// 1 ? 28 : unreachable
BUILD(r, WASM_IF_ELSE_I(WASM_I32V_1(1), // --
WASM_I32V_1(28), // --
@@ -697,21 +697,21 @@ WASM_EXEC_TEST(IfElse_Unreachable2) {
}
WASM_EXEC_TEST(Return12) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r, RET_I8(12));
CHECK_EQ(12, r.Call());
}
WASM_EXEC_TEST(Return17) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK(RET_I8(17)), WASM_ZERO);
CHECK_EQ(17, r.Call());
}
WASM_EXEC_TEST(Return_I32) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, RET(WASM_GET_LOCAL(0)));
@@ -719,7 +719,7 @@ WASM_EXEC_TEST(Return_I32) {
}
WASM_EXEC_TEST(Return_F32) {
- WasmRunner<float, float> r(execution_mode);
+ WasmRunner<float, float> r(execution_tier);
BUILD(r, RET(WASM_GET_LOCAL(0)));
@@ -735,7 +735,7 @@ WASM_EXEC_TEST(Return_F32) {
}
WASM_EXEC_TEST(Return_F64) {
- WasmRunner<double, double> r(execution_mode);
+ WasmRunner<double, double> r(execution_tier);
BUILD(r, RET(WASM_GET_LOCAL(0)));
@@ -751,7 +751,7 @@ WASM_EXEC_TEST(Return_F64) {
}
WASM_EXEC_TEST(Select_float_parameters) {
- WasmRunner<float, float, float, int32_t> r(execution_mode);
+ WasmRunner<float, float, float, int32_t> r(execution_tier);
// return select(11, 22, a);
BUILD(r,
WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)));
@@ -759,7 +759,7 @@ WASM_EXEC_TEST(Select_float_parameters) {
}
WASM_EXEC_TEST(Select) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// 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) {
@@ -769,7 +769,7 @@ WASM_EXEC_TEST(Select) {
}
WASM_EXEC_TEST(Select_strict1) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// select(a=0, a=1, a=2); return a
BUILD(r, WASM_SELECT(WASM_TEE_LOCAL(0, WASM_ZERO),
WASM_TEE_LOCAL(0, WASM_I32V_1(1)),
@@ -779,7 +779,7 @@ WASM_EXEC_TEST(Select_strict1) {
}
WASM_EXEC_TEST(Select_strict2) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmI32);
// select(b=5, c=6, a)
@@ -792,7 +792,7 @@ WASM_EXEC_TEST(Select_strict2) {
}
WASM_EXEC_TEST(Select_strict3) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
r.AllocateLocal(kWasmI32);
r.AllocateLocal(kWasmI32);
// select(b=5, c=6, a=b)
@@ -806,7 +806,7 @@ WASM_EXEC_TEST(Select_strict3) {
}
WASM_EXEC_TEST(BrIf_strict) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_GET_LOCAL(0),
WASM_TEE_LOCAL(0, WASM_I32V_2(99)))));
@@ -814,7 +814,7 @@ WASM_EXEC_TEST(BrIf_strict) {
}
WASM_EXEC_TEST(Br_height) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(
WASM_BLOCK(WASM_BRV_IFD(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)),
WASM_RETURN1(WASM_I32V_1(9))),
@@ -827,7 +827,7 @@ WASM_EXEC_TEST(Br_height) {
}
WASM_EXEC_TEST(Regression_660262) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, kExprI32Const, 0x00, kExprI32Const, 0x00, kExprI32LoadMem, 0x00,
0x0F, kExprBrTable, 0x00, 0x80, 0x00); // entries=0
@@ -835,14 +835,14 @@ WASM_EXEC_TEST(Regression_660262) {
}
WASM_EXEC_TEST(BrTable0a) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(BrTable0b) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r,
B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(0)))),
WASM_I32V_2(92));
@@ -850,7 +850,7 @@ WASM_EXEC_TEST(BrTable0b) {
}
WASM_EXEC_TEST(BrTable0c) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(
r,
B1(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(1))),
@@ -863,13 +863,13 @@ WASM_EXEC_TEST(BrTable0c) {
}
WASM_EXEC_TEST(BrTable1) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(BrTable_loop) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r,
B2(B1(WASM_LOOP(WASM_BR_TABLE(WASM_INC_LOCAL_BYV(0, 1), 2, BR_TARGET(2),
BR_TARGET(1), BR_TARGET(0)))),
@@ -883,7 +883,7 @@ WASM_EXEC_TEST(BrTable_loop) {
}
WASM_EXEC_TEST(BrTable_br) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r,
B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(1), BR_TARGET(0))),
RET_I8(91)),
@@ -895,7 +895,7 @@ WASM_EXEC_TEST(BrTable_br) {
}
WASM_EXEC_TEST(BrTable_br2) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B2(B2(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 3, BR_TARGET(1),
BR_TARGET(2), BR_TARGET(3), BR_TARGET(0))),
@@ -926,7 +926,7 @@ WASM_EXEC_TEST(BrTable4) {
RET_I8(73)),
WASM_I32V_2(75)};
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
r.Build(code, code + arraysize(code));
for (int x = -3; x < 50; ++x) {
@@ -956,7 +956,7 @@ WASM_EXEC_TEST(BrTable4x4) {
RET_I8(53)),
WASM_I32V_2(55)};
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
r.Build(code, code + arraysize(code));
for (int x = -6; x < 47; ++x) {
@@ -981,7 +981,7 @@ WASM_EXEC_TEST(BrTable4_fallthru) {
WASM_INC_LOCAL_BY(1, 8)),
WASM_GET_LOCAL(1)};
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
r.Build(code, code + arraysize(code));
CHECK_EQ(15, r.Call(0, 0));
@@ -1005,14 +1005,14 @@ WASM_EXEC_TEST(BrTable_loop_target) {
BR_TARGET(0), BR_TARGET(1), BR_TARGET(1))),
WASM_ONE)};
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
r.Build(code, code + arraysize(code));
CHECK_EQ(1, r.Call(0));
}
WASM_EXEC_TEST(F32ReinterpretI32) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
@@ -1027,7 +1027,7 @@ WASM_EXEC_TEST(F32ReinterpretI32) {
}
WASM_EXEC_TEST(I32ReinterpretF32) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
@@ -1046,7 +1046,7 @@ WASM_EXEC_TEST(I32ReinterpretF32) {
#ifndef USE_SIMULATOR
WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_I32_REINTERPRET_F32(
WASM_SEQ(kExprF32Const, 0x00, 0x00, 0xA0, 0x7F)));
@@ -1058,7 +1058,7 @@ WASM_EXEC_TEST(SignallingNanSurvivesI32ReinterpretF32) {
#endif
WASM_EXEC_TEST(LoadMaxUint32Offset) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_LOAD_MEM_OFFSET(MachineType::Int32(), // type
@@ -1069,7 +1069,7 @@ WASM_EXEC_TEST(LoadMaxUint32Offset) {
}
WASM_EXEC_TEST(LoadStoreLoad) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
@@ -1085,28 +1085,28 @@ WASM_EXEC_TEST(LoadStoreLoad) {
}
WASM_EXEC_TEST(UnalignedFloat32Load) {
- WasmRunner<float> r(execution_mode);
+ WasmRunner<float> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Float32(), WASM_ONE, 2));
r.Call();
}
WASM_EXEC_TEST(UnalignedFloat64Load) {
- WasmRunner<double> r(execution_mode);
+ WasmRunner<double> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Float64(), WASM_ONE, 3));
r.Call();
}
WASM_EXEC_TEST(UnalignedInt32Load) {
- WasmRunner<uint32_t> r(execution_mode);
+ WasmRunner<uint32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Int32(), WASM_ONE, 2));
r.Call();
}
WASM_EXEC_TEST(UnalignedInt32Store) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_SEQ(WASM_STORE_MEM_ALIGNMENT(MachineType::Int32(), WASM_ONE, 2,
WASM_I32V_1(1)),
@@ -1115,7 +1115,7 @@ WASM_EXEC_TEST(UnalignedInt32Store) {
}
WASM_EXEC_TEST(UnalignedFloat32Store) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_SEQ(WASM_STORE_MEM_ALIGNMENT(MachineType::Float32(), WASM_ONE,
2, WASM_F32(1.0)),
@@ -1124,7 +1124,7 @@ WASM_EXEC_TEST(UnalignedFloat32Store) {
}
WASM_EXEC_TEST(UnalignedFloat64Store) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_SEQ(WASM_STORE_MEM_ALIGNMENT(MachineType::Float64(), WASM_ONE,
3, WASM_F64(1.0)),
@@ -1134,7 +1134,7 @@ WASM_EXEC_TEST(UnalignedFloat64Store) {
WASM_EXEC_TEST(VoidReturn1) {
const int32_t kExpected = -414444;
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// Build the test function.
WasmFunctionCompiler& test_func = r.NewFunction<void>();
@@ -1151,7 +1151,7 @@ WASM_EXEC_TEST(VoidReturn1) {
WASM_EXEC_TEST(VoidReturn2) {
const int32_t kExpected = -414444;
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// Build the test function.
WasmFunctionCompiler& test_func = r.NewFunction<void>();
@@ -1167,67 +1167,67 @@ WASM_EXEC_TEST(VoidReturn2) {
}
WASM_EXEC_TEST(BrEmpty) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(BrIfEmpty) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Block_empty) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Block_empty_br1) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Block_empty_brif1) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Block_empty_brif2) {
- WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Block_i) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Block_f) {
- WasmRunner<float, float> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Block_d) {
- WasmRunner<double, double> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Block_br2) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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))); }
}
WASM_EXEC_TEST(Block_If_P) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// block { if (p0) break 51; 52; }
BUILD(r, WASM_BLOCK_I( // --
WASM_IF(WASM_GET_LOCAL(0), // --
@@ -1240,49 +1240,49 @@ WASM_EXEC_TEST(Block_If_P) {
}
WASM_EXEC_TEST(Loop_empty) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Loop_i) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Loop_f) {
- WasmRunner<float, float> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Loop_d) {
- WasmRunner<double, double> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Loop_empty_br1) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Loop_empty_brif1) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Loop_empty_brif2) {
- WasmRunner<uint32_t, uint32_t, uint32_t> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(Loop_empty_brif3) {
- WasmRunner<uint32_t, uint32_t, uint32_t, uint32_t> r(execution_mode);
+ WasmRunner<uint32_t, uint32_t, uint32_t, uint32_t> r(execution_tier);
BUILD(r, WASM_LOOP(WASM_BRV_IFD(1, WASM_GET_LOCAL(2), WASM_GET_LOCAL(0))),
WASM_GET_LOCAL(1));
FOR_UINT32_INPUTS(i) {
@@ -1294,7 +1294,7 @@ WASM_EXEC_TEST(Loop_empty_brif3) {
}
WASM_EXEC_TEST(Block_BrIf_P) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
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) {
@@ -1304,7 +1304,7 @@ WASM_EXEC_TEST(Block_BrIf_P) {
}
WASM_EXEC_TEST(Block_IfElse_P_assign) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// { if (p0) p0 = 71; else p0 = 72; return p0; }
BUILD(r, // --
WASM_IF_ELSE(WASM_GET_LOCAL(0), // --
@@ -1318,7 +1318,7 @@ WASM_EXEC_TEST(Block_IfElse_P_assign) {
}
WASM_EXEC_TEST(Block_IfElse_P_return) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// if (p0) return 81; else return 82;
BUILD(r, // --
WASM_IF_ELSE(WASM_GET_LOCAL(0), // --
@@ -1332,7 +1332,7 @@ WASM_EXEC_TEST(Block_IfElse_P_return) {
}
WASM_EXEC_TEST(Block_If_P_assign) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// { if (p0) p0 = 61; p0; }
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I32V_1(61))),
WASM_GET_LOCAL(0));
@@ -1343,14 +1343,14 @@ WASM_EXEC_TEST(Block_If_P_assign) {
}
WASM_EXEC_TEST(DanglingAssign) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// { return 0; p0 = 0; }
BUILD(r, WASM_BLOCK_I(RET_I8(99), WASM_TEE_LOCAL(0, WASM_ZERO)));
CHECK_EQ(99, r.Call(1));
}
WASM_EXEC_TEST(ExprIf_P) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// p0 ? 11 : 22;
BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), // --
WASM_I32V_1(11), // --
@@ -1362,7 +1362,7 @@ WASM_EXEC_TEST(ExprIf_P) {
}
WASM_EXEC_TEST(CountDown) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_LOOP(WASM_IFB(WASM_GET_LOCAL(0),
WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0),
WASM_I32V_1(1))),
@@ -1374,7 +1374,7 @@ WASM_EXEC_TEST(CountDown) {
}
WASM_EXEC_TEST(CountDown_fallthru) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(
r,
WASM_LOOP(
@@ -1388,7 +1388,7 @@ WASM_EXEC_TEST(CountDown_fallthru) {
}
WASM_EXEC_TEST(WhileCountDown) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_WHILE(WASM_GET_LOCAL(0),
WASM_SET_LOCAL(
0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I32V_1(1)))),
@@ -1399,7 +1399,7 @@ WASM_EXEC_TEST(WhileCountDown) {
}
WASM_EXEC_TEST(Loop_if_break1) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(2, WASM_GET_LOCAL(1))),
WASM_SET_LOCAL(0, WASM_I32V_2(99))),
WASM_GET_LOCAL(0));
@@ -1410,7 +1410,7 @@ WASM_EXEC_TEST(Loop_if_break1) {
}
WASM_EXEC_TEST(Loop_if_break2) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_LOOP(WASM_BRV_IF(1, WASM_GET_LOCAL(1), WASM_GET_LOCAL(0)),
WASM_DROP, WASM_SET_LOCAL(0, WASM_I32V_2(99))),
WASM_GET_LOCAL(0));
@@ -1421,7 +1421,7 @@ WASM_EXEC_TEST(Loop_if_break2) {
}
WASM_EXEC_TEST(Loop_if_break_fallthru) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2)),
WASM_SET_LOCAL(0, WASM_I32V_2(93)))),
WASM_GET_LOCAL(0));
@@ -1432,7 +1432,7 @@ WASM_EXEC_TEST(Loop_if_break_fallthru) {
}
WASM_EXEC_TEST(Loop_if_break_fallthru2) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, B1(B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2)),
WASM_SET_LOCAL(0, WASM_I32V_2(93))))),
WASM_GET_LOCAL(0));
@@ -1443,7 +1443,7 @@ WASM_EXEC_TEST(Loop_if_break_fallthru2) {
}
WASM_EXEC_TEST(IfBreak1) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), WASM_UNREACHABLE)),
WASM_I32V_2(91));
CHECK_EQ(91, r.Call(0));
@@ -1452,7 +1452,7 @@ WASM_EXEC_TEST(IfBreak1) {
}
WASM_EXEC_TEST(IfBreak2) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), RET_I8(77))),
WASM_I32V_2(81));
CHECK_EQ(81, r.Call(0));
@@ -1461,7 +1461,7 @@ WASM_EXEC_TEST(IfBreak2) {
}
WASM_EXEC_TEST(LoadMemI32) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
r.builder().RandomizeMemory(1111);
@@ -1480,7 +1480,7 @@ WASM_EXEC_TEST(LoadMemI32) {
WASM_EXEC_TEST(LoadMemI32_alignment) {
for (byte alignment = 0; alignment <= 2; ++alignment) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
r.builder().RandomizeMemory(1111);
@@ -1500,7 +1500,7 @@ WASM_EXEC_TEST(LoadMemI32_alignment) {
}
WASM_EXEC_TEST(LoadMemI32_oob) {
- WasmRunner<int32_t, uint32_t> r(execution_mode);
+ WasmRunner<int32_t, uint32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
r.builder().RandomizeMemory(1111);
@@ -1529,7 +1529,7 @@ WASM_EXEC_TEST(LoadMem_offset_oob) {
constexpr size_t num_bytes = kWasmPageSize;
for (size_t m = 0; m < arraysize(machineTypes); ++m) {
- WasmRunner<int32_t, uint32_t> r(execution_mode);
+ WasmRunner<int32_t, uint32_t> r(execution_tier);
r.builder().AddMemoryElems<byte>(num_bytes);
r.builder().RandomizeMemory(1116 + static_cast<int>(m));
@@ -1549,7 +1549,7 @@ WASM_EXEC_TEST(LoadMem_offset_oob) {
}
WASM_EXEC_TEST(LoadMemI32_offset) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
r.builder().RandomizeMemory(1111);
@@ -1581,7 +1581,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob_misaligned) {
for (byte offset = 0; offset < kRunwayLength + 5; ++offset) {
for (uint32_t index = kWasmPageSize - kRunwayLength;
index < kWasmPageSize + 5; ++index) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemoryElems<byte>(kWasmPageSize);
r.builder().RandomizeMemory();
@@ -1604,7 +1604,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob) {
for (byte offset = 0; offset < kRunwayLength + 5; offset += 4) {
for (uint32_t index = kWasmPageSize - kRunwayLength;
index < kWasmPageSize + 5; index += 4) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemoryElems<byte>(kWasmPageSize);
r.builder().RandomizeMemory();
@@ -1624,7 +1624,7 @@ WASM_EXEC_TEST(StoreMemI32_alignment) {
const int32_t kWritten = 0x12345678;
for (byte i = 0; i <= 2; ++i) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int32(), WASM_ZERO, i,
@@ -1639,7 +1639,7 @@ WASM_EXEC_TEST(StoreMemI32_alignment) {
}
WASM_EXEC_TEST(StoreMemI32_offset) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
const int32_t kWritten = 0xAABBCCDD;
@@ -1672,7 +1672,7 @@ WASM_EXEC_TEST(StoreMem_offset_oob) {
constexpr size_t num_bytes = kWasmPageSize;
for (size_t m = 0; m < arraysize(machineTypes); ++m) {
- WasmRunner<int32_t, uint32_t> r(execution_mode);
+ WasmRunner<int32_t, uint32_t> r(execution_tier);
byte* memory = r.builder().AddMemoryElems<byte>(num_bytes);
r.builder().RandomizeMemory(1119 + static_cast<int>(m));
@@ -1700,7 +1700,7 @@ WASM_EXEC_TEST(Store_i32_narrowed) {
stored_size_in_bytes = std::max(1, stored_size_in_bytes * 2);
constexpr int kBytes = 24;
uint8_t expected_memory[kBytes] = {0};
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
uint8_t* memory = r.builder().AddMemoryElems<uint8_t>(kWasmPageSize);
constexpr uint32_t kPattern = 0x12345678;
@@ -1724,7 +1724,7 @@ WASM_EXEC_TEST(Store_i32_narrowed) {
WASM_EXEC_TEST(LoadMemI32_P) {
const int kNumElems = 8;
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* memory =
r.builder().AddMemoryElems<int32_t>(kWasmPageSize / sizeof(int32_t));
r.builder().RandomizeMemory(2222);
@@ -1738,7 +1738,7 @@ WASM_EXEC_TEST(LoadMemI32_P) {
WASM_EXEC_TEST(MemI32_Sum) {
const int kNumElems = 20;
- WasmRunner<uint32_t, int32_t> r(execution_mode);
+ WasmRunner<uint32_t, int32_t> r(execution_tier);
uint32_t* memory =
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(int32_t));
const byte kSum = r.AllocateLocal(kWasmI32);
@@ -1768,7 +1768,7 @@ WASM_EXEC_TEST(MemI32_Sum) {
WASM_EXEC_TEST(CheckMachIntsZero) {
const int kNumElems = 55;
- WasmRunner<uint32_t, int32_t> r(execution_mode);
+ WasmRunner<uint32_t, int32_t> r(execution_tier);
r.builder().AddMemoryElems<uint32_t>(kWasmPageSize / sizeof(uint32_t));
BUILD(r, // --
@@ -1796,7 +1796,7 @@ WASM_EXEC_TEST(CheckMachIntsZero) {
WASM_EXEC_TEST(MemF32_Sum) {
const int kSize = 5;
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().AddMemoryElems<float>(kWasmPageSize / sizeof(float));
float* buffer = r.builder().raw_mem_start<float>();
r.builder().WriteMemory(&buffer[0], -99.25f);
@@ -1824,10 +1824,9 @@ WASM_EXEC_TEST(MemF32_Sum) {
}
template <typename T>
-T GenerateAndRunFold(WasmExecutionMode execution_mode, WasmOpcode binop,
- T* buffer, uint32_t size, ValueType astType,
- MachineType memType) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+T GenerateAndRunFold(ExecutionTier execution_tier, WasmOpcode binop, T* buffer,
+ uint32_t size, ValueType astType, MachineType memType) {
+ WasmRunner<int32_t, int32_t> r(execution_tier);
T* memory = r.builder().AddMemoryElems<T>(static_cast<uint32_t>(
RoundUp(size * sizeof(T), kWasmPageSize) / sizeof(sizeof(T))));
for (uint32_t i = 0; i < size; ++i) {
@@ -1855,19 +1854,19 @@ WASM_EXEC_TEST(MemF64_Mul) {
const size_t kSize = 6;
double buffer[kSize] = {1, 2, 2, 2, 2, 2};
double result =
- GenerateAndRunFold<double>(execution_mode, kExprF64Mul, buffer, kSize,
+ GenerateAndRunFold<double>(execution_tier, kExprF64Mul, buffer, kSize,
kWasmF64, MachineType::Float64());
CHECK_EQ(32, result);
}
WASM_EXEC_TEST(Build_Wasm_Infinite_Loop) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// Only build the graph and compile, don't run.
BUILD(r, WASM_INFINITE_LOOP, WASM_ZERO);
}
WASM_EXEC_TEST(Build_Wasm_Infinite_Loop_effect) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
// Only build the graph and compile, don't run.
@@ -1876,49 +1875,49 @@ WASM_EXEC_TEST(Build_Wasm_Infinite_Loop_effect) {
}
WASM_EXEC_TEST(Unreachable0a) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(9)), RET(WASM_GET_LOCAL(0))));
CHECK_EQ(9, r.Call(0));
CHECK_EQ(9, r.Call(1));
}
WASM_EXEC_TEST(Unreachable0b) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I32V_1(7)), WASM_UNREACHABLE));
CHECK_EQ(7, r.Call(0));
CHECK_EQ(7, r.Call(1));
}
WASM_COMPILED_EXEC_TEST(Build_Wasm_Unreachable1) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_UNREACHABLE);
}
WASM_COMPILED_EXEC_TEST(Build_Wasm_Unreachable2) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE);
}
WASM_COMPILED_EXEC_TEST(Build_Wasm_Unreachable3) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_UNREACHABLE, WASM_UNREACHABLE, WASM_UNREACHABLE);
}
WASM_COMPILED_EXEC_TEST(Build_Wasm_UnreachableIf1) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_UNREACHABLE,
WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_GET_LOCAL(0), WASM_DROP)),
WASM_ZERO);
}
WASM_COMPILED_EXEC_TEST(Build_Wasm_UnreachableIf2) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_UNREACHABLE,
WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE));
}
WASM_EXEC_TEST(Unreachable_Load) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)),
WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0))));
@@ -1927,21 +1926,21 @@ WASM_EXEC_TEST(Unreachable_Load) {
}
WASM_EXEC_TEST(BrV_Fallthrough) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BLOCK(WASM_BRV(1, WASM_I32V_1(42))),
WASM_I32V_1(22)));
CHECK_EQ(42, r.Call());
}
WASM_EXEC_TEST(Infinite_Loop_not_taken1) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I32V_1(45));
// Run the code, but don't go into the infinite loop.
CHECK_EQ(45, r.Call(0));
}
WASM_EXEC_TEST(Infinite_Loop_not_taken2) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(
WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I32V_1(45)),
WASM_INFINITE_LOOP),
@@ -1951,7 +1950,7 @@ WASM_EXEC_TEST(Infinite_Loop_not_taken2) {
}
WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_I32V_1(45), WASM_GET_LOCAL(0)),
WASM_INFINITE_LOOP));
// Run the code, but don't go into the infinite loop.
@@ -2005,7 +2004,7 @@ TEST(Build_Wasm_SimpleExprs) {
}
WASM_EXEC_TEST(Int32LoadInt8_signext) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
const int kNumElems = kWasmPageSize;
int8_t* memory = r.builder().AddMemoryElems<int8_t>(kNumElems);
r.builder().RandomizeMemory();
@@ -2018,7 +2017,7 @@ WASM_EXEC_TEST(Int32LoadInt8_signext) {
}
WASM_EXEC_TEST(Int32LoadInt8_zeroext) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
const int kNumElems = kWasmPageSize;
byte* memory = r.builder().AddMemory(kNumElems);
r.builder().RandomizeMemory(77);
@@ -2031,7 +2030,7 @@ WASM_EXEC_TEST(Int32LoadInt8_zeroext) {
}
WASM_EXEC_TEST(Int32LoadInt16_signext) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
const int kNumBytes = kWasmPageSize;
byte* memory = r.builder().AddMemory(kNumBytes);
r.builder().RandomizeMemory(888);
@@ -2045,7 +2044,7 @@ WASM_EXEC_TEST(Int32LoadInt16_signext) {
}
WASM_EXEC_TEST(Int32LoadInt16_zeroext) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
const int kNumBytes = kWasmPageSize;
byte* memory = r.builder().AddMemory(kNumBytes);
r.builder().RandomizeMemory(9999);
@@ -2059,18 +2058,18 @@ WASM_EXEC_TEST(Int32LoadInt16_zeroext) {
}
WASM_EXEC_TEST(Int32Global) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* global = r.builder().AddGlobal<int32_t>();
// global = global + p0
BUILD(r,
WASM_SET_GLOBAL(0, WASM_I32_ADD(WASM_GET_GLOBAL(0), WASM_GET_LOCAL(0))),
WASM_ZERO);
- *global = 116;
+ WriteLittleEndianValue<int32_t>(global, 116);
for (int i = 9; i < 444444; i += 111111) {
- int32_t expected = *global + i;
+ int32_t expected = ReadLittleEndianValue<int32_t>(global) + i;
r.Call(i);
- CHECK_EQ(expected, *global);
+ CHECK_EQ(expected, ReadLittleEndianValue<int32_t>(global));
}
}
@@ -2078,7 +2077,7 @@ WASM_EXEC_TEST(Int32Globals_DontAlias) {
const int kNumGlobals = 3;
for (int g = 0; g < kNumGlobals; ++g) {
// global = global + p0
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* globals[] = {r.builder().AddGlobal<int32_t>(),
r.builder().AddGlobal<int32_t>(),
r.builder().AddGlobal<int32_t>()};
@@ -2088,23 +2087,24 @@ WASM_EXEC_TEST(Int32Globals_DontAlias) {
WASM_GET_GLOBAL(g));
// Check that reading/writing global number {g} doesn't alter the others.
- *globals[g] = 116 * g;
+ WriteLittleEndianValue<int32_t>(globals[g], 116 * g);
int32_t before[kNumGlobals];
for (int i = 9; i < 444444; i += 111113) {
- int32_t sum = *globals[g] + i;
- for (int j = 0; j < kNumGlobals; ++j) before[j] = *globals[j];
+ int32_t sum = ReadLittleEndianValue<int32_t>(globals[g]) + i;
+ for (int j = 0; j < kNumGlobals; ++j)
+ before[j] = ReadLittleEndianValue<int32_t>(globals[j]);
int32_t result = r.Call(i);
CHECK_EQ(sum, result);
for (int j = 0; j < kNumGlobals; ++j) {
int32_t expected = j == g ? sum : before[j];
- CHECK_EQ(expected, *globals[j]);
+ CHECK_EQ(expected, ReadLittleEndianValue<int32_t>(globals[j]));
}
}
}
}
WASM_EXEC_TEST(Float32Global) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
float* global = r.builder().AddGlobal<float>();
// global = global + p0
BUILD(r, WASM_SET_GLOBAL(
@@ -2112,16 +2112,16 @@ WASM_EXEC_TEST(Float32Global) {
WASM_F32_SCONVERT_I32(WASM_GET_LOCAL(0)))),
WASM_ZERO);
- *global = 1.25;
+ WriteLittleEndianValue<float>(global, 1.25);
for (int i = 9; i < 4444; i += 1111) {
- volatile float expected = *global + i;
+ volatile float expected = ReadLittleEndianValue<float>(global) + i;
r.Call(i);
- CHECK_EQ(expected, *global);
+ CHECK_EQ(expected, ReadLittleEndianValue<float>(global));
}
}
WASM_EXEC_TEST(Float64Global) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
double* global = r.builder().AddGlobal<double>();
// global = global + p0
BUILD(r, WASM_SET_GLOBAL(
@@ -2129,16 +2129,16 @@ WASM_EXEC_TEST(Float64Global) {
WASM_F64_SCONVERT_I32(WASM_GET_LOCAL(0)))),
WASM_ZERO);
- *global = 1.25;
+ WriteLittleEndianValue<double>(global, 1.25);
for (int i = 9; i < 4444; i += 1111) {
- volatile double expected = *global + i;
+ volatile double expected = ReadLittleEndianValue<double>(global) + i;
r.Call(i);
- CHECK_EQ(expected, *global);
+ CHECK_EQ(expected, ReadLittleEndianValue<double>(global));
}
}
WASM_EXEC_TEST(MixedGlobals) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
int32_t* unused = r.builder().AddGlobal<int32_t>();
byte* memory = r.builder().AddMemory(kWasmPageSize);
@@ -2164,17 +2164,20 @@ WASM_EXEC_TEST(MixedGlobals) {
memory[7] = 0x99;
r.Call(1);
- CHECK(static_cast<int32_t>(0xEE55CCAA) == *var_int32);
- CHECK(static_cast<uint32_t>(0xEE55CCAA) == *var_uint32);
- CHECK(bit_cast<float>(0xEE55CCAA) == *var_float);
- CHECK(bit_cast<double>(0x99112233EE55CCAAULL) == *var_double);
+ CHECK(static_cast<int32_t>(0xEE55CCAA) ==
+ ReadLittleEndianValue<int32_t>(var_int32));
+ CHECK(static_cast<uint32_t>(0xEE55CCAA) ==
+ ReadLittleEndianValue<uint32_t>(var_uint32));
+ CHECK(bit_cast<float>(0xEE55CCAA) == ReadLittleEndianValue<float>(var_float));
+ CHECK(bit_cast<double>(0x99112233EE55CCAAULL) ==
+ ReadLittleEndianValue<double>(var_double));
USE(unused);
}
WASM_EXEC_TEST(CallEmpty) {
const int32_t kExpected = -414444;
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
// Build the target function.
WasmFunctionCompiler& target_func = r.NewFunction<int>();
@@ -2188,7 +2191,7 @@ WASM_EXEC_TEST(CallEmpty) {
}
WASM_EXEC_TEST(CallF32StackParameter) {
- WasmRunner<float> r(execution_mode);
+ WasmRunner<float> r(execution_tier);
// Build the target function.
ValueType param_types[20];
@@ -2211,7 +2214,7 @@ WASM_EXEC_TEST(CallF32StackParameter) {
}
WASM_EXEC_TEST(CallF64StackParameter) {
- WasmRunner<double> r(execution_mode);
+ WasmRunner<double> r(execution_tier);
// Build the target function.
ValueType param_types[20];
@@ -2234,7 +2237,7 @@ WASM_EXEC_TEST(CallF64StackParameter) {
}
WASM_EXEC_TEST(CallVoid) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
const byte kMemOffset = 8;
const int32_t kElemNum = kMemOffset / sizeof(int32_t);
@@ -2259,7 +2262,7 @@ WASM_EXEC_TEST(CallVoid) {
}
WASM_EXEC_TEST(Call_Int32Add) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
// Build the target function.
WasmFunctionCompiler& t = r.NewFunction<int32_t, int32_t, int32_t>();
@@ -2279,7 +2282,7 @@ WASM_EXEC_TEST(Call_Int32Add) {
}
WASM_EXEC_TEST(Call_Float32Sub) {
- WasmRunner<float, float, float> r(execution_mode);
+ WasmRunner<float, float, float> r(execution_tier);
// Build the target function.
WasmFunctionCompiler& target_func = r.NewFunction<float, float, float>();
@@ -2295,7 +2298,7 @@ WASM_EXEC_TEST(Call_Float32Sub) {
}
WASM_EXEC_TEST(Call_Float64Sub) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
double* memory =
r.builder().AddMemoryElems<double>(kWasmPageSize / sizeof(double));
@@ -2329,7 +2332,7 @@ WASM_EXEC_TEST(Call_Float64Sub) {
for (size_t i = 0; i < sizeof(__buf); ++i) vec.push_back(__buf[i]); \
} while (false)
-static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
+static void Run_WasmMixedCall_N(ExecutionTier execution_tier, int start) {
const int kExpected = 6333;
const int kElemSize = 8;
TestSignatures sigs;
@@ -2345,7 +2348,7 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
for (int which = 0; which < num_params; ++which) {
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
r.builder().AddMemory(kWasmPageSize);
MachineType* memtypes = &mixed[start];
MachineType result = memtypes[which];
@@ -2404,13 +2407,13 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) {
}
}
-WASM_EXEC_TEST(MixedCall_0) { Run_WasmMixedCall_N(execution_mode, 0); }
-WASM_EXEC_TEST(MixedCall_1) { Run_WasmMixedCall_N(execution_mode, 1); }
-WASM_EXEC_TEST(MixedCall_2) { Run_WasmMixedCall_N(execution_mode, 2); }
-WASM_EXEC_TEST(MixedCall_3) { Run_WasmMixedCall_N(execution_mode, 3); }
+WASM_EXEC_TEST(MixedCall_0) { Run_WasmMixedCall_N(execution_tier, 0); }
+WASM_EXEC_TEST(MixedCall_1) { Run_WasmMixedCall_N(execution_tier, 1); }
+WASM_EXEC_TEST(MixedCall_2) { Run_WasmMixedCall_N(execution_tier, 2); }
+WASM_EXEC_TEST(MixedCall_3) { Run_WasmMixedCall_N(execution_tier, 3); }
WASM_EXEC_TEST(AddCall) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
WasmFunctionCompiler& t1 = r.NewFunction<int32_t, int32_t, int32_t>();
BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
@@ -2429,7 +2432,7 @@ WASM_EXEC_TEST(AddCall) {
WASM_EXEC_TEST(MultiReturnSub) {
EXPERIMENTAL_FLAG_SCOPE(mv);
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
ValueType storage[] = {kWasmI32, kWasmI32, kWasmI32, kWasmI32};
FunctionSig sig_ii_ii(2, 2, storage);
@@ -2449,7 +2452,7 @@ WASM_EXEC_TEST(MultiReturnSub) {
}
template <typename T>
-void RunMultiReturnSelect(WasmExecutionMode execution_mode, const T* inputs) {
+void RunMultiReturnSelect(ExecutionTier execution_tier, const T* inputs) {
EXPERIMENTAL_FLAG_SCOPE(mv);
ValueType type = ValueTypes::ValueTypeFor(MachineTypeForC<T>());
ValueType storage[] = {type, type, type, type, type, type};
@@ -2460,7 +2463,7 @@ void RunMultiReturnSelect(WasmExecutionMode execution_mode, const T* inputs) {
for (size_t i = 0; i < kNumParams; i++) {
for (size_t j = 0; j < kNumParams; j++) {
for (int k = 0; k < 2; k++) {
- WasmRunner<T, T, T, T, T> r(execution_mode);
+ WasmRunner<T, T, T, T, T> r(execution_tier);
WasmFunctionCompiler& r1 = r.NewFunction(&sig);
BUILD(r1, WASM_GET_LOCAL(i), WASM_GET_LOCAL(j));
@@ -2486,12 +2489,12 @@ void RunMultiReturnSelect(WasmExecutionMode execution_mode, const T* inputs) {
WASM_EXEC_TEST(MultiReturnSelect_i32) {
static const int32_t inputs[] = {3333333, 4444444, -55555555, -7777777};
- RunMultiReturnSelect<int32_t>(execution_mode, inputs);
+ RunMultiReturnSelect<int32_t>(execution_tier, inputs);
}
WASM_EXEC_TEST(MultiReturnSelect_f32) {
static const float inputs[] = {33.33333f, 444.4444f, -55555.555f, -77777.77f};
- RunMultiReturnSelect<float>(execution_mode, inputs);
+ RunMultiReturnSelect<float>(execution_tier, inputs);
}
WASM_EXEC_TEST(MultiReturnSelect_i64) {
@@ -2499,17 +2502,17 @@ WASM_EXEC_TEST(MultiReturnSelect_i64) {
// TODO(titzer): implement int64-lowering for multiple return values
static const int64_t inputs[] = {33333338888, 44444446666, -555555553333,
-77777771111};
- RunMultiReturnSelect<int64_t>(execution_mode, inputs);
+ RunMultiReturnSelect<int64_t>(execution_tier, inputs);
#endif
}
WASM_EXEC_TEST(MultiReturnSelect_f64) {
static const double inputs[] = {3.333333, 44444.44, -55.555555, -7777.777};
- RunMultiReturnSelect<double>(execution_mode, inputs);
+ RunMultiReturnSelect<double>(execution_tier, inputs);
}
WASM_EXEC_TEST(ExprBlock2a) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I32V_1(1))),
WASM_I32V_1(1)));
CHECK_EQ(1, r.Call(0));
@@ -2517,7 +2520,7 @@ WASM_EXEC_TEST(ExprBlock2a) {
}
WASM_EXEC_TEST(ExprBlock2b) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I32V_1(1))),
WASM_I32V_1(2)));
CHECK_EQ(2, r.Call(0));
@@ -2525,7 +2528,7 @@ WASM_EXEC_TEST(ExprBlock2b) {
}
WASM_EXEC_TEST(ExprBlock2c) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I32V_1(1), WASM_GET_LOCAL(0)),
WASM_I32V_1(1)));
CHECK_EQ(1, r.Call(0));
@@ -2533,7 +2536,7 @@ WASM_EXEC_TEST(ExprBlock2c) {
}
WASM_EXEC_TEST(ExprBlock2d) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I32V_1(1), WASM_GET_LOCAL(0)),
WASM_I32V_1(2)));
CHECK_EQ(2, r.Call(0));
@@ -2541,7 +2544,7 @@ WASM_EXEC_TEST(ExprBlock2d) {
}
WASM_EXEC_TEST(ExprBlock_ManualSwitch) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(1)),
WASM_BRV(1, WASM_I32V_1(11))),
WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(2)),
@@ -2563,7 +2566,7 @@ WASM_EXEC_TEST(ExprBlock_ManualSwitch) {
}
WASM_EXEC_TEST(ExprBlock_ManualSwitch_brif) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(
WASM_BRV_IFD(0, WASM_I32V_1(11),
WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I32V_1(1))),
@@ -2586,7 +2589,7 @@ WASM_EXEC_TEST(ExprBlock_ManualSwitch_brif) {
}
WASM_EXEC_TEST(If_nested) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(
r,
@@ -2602,7 +2605,7 @@ WASM_EXEC_TEST(If_nested) {
}
WASM_EXEC_TEST(ExprBlock_if) {
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_IF_ELSE_I(WASM_GET_LOCAL(0),
WASM_BRV(0, WASM_I32V_1(11)),
@@ -2613,7 +2616,7 @@ WASM_EXEC_TEST(ExprBlock_if) {
}
WASM_EXEC_TEST(ExprBlock_nested_ifs) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_BLOCK_I(WASM_IF_ELSE_I(
WASM_GET_LOCAL(0),
@@ -2630,7 +2633,7 @@ WASM_EXEC_TEST(ExprBlock_nested_ifs) {
WASM_EXEC_TEST(SimpleCallIndirect) {
TestSignatures sigs;
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii());
BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
@@ -2664,7 +2667,7 @@ WASM_EXEC_TEST(SimpleCallIndirect) {
WASM_EXEC_TEST(MultipleCallIndirect) {
TestSignatures sigs;
- WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t, int32_t> r(execution_tier);
WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii());
BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
@@ -2707,7 +2710,7 @@ WASM_EXEC_TEST(MultipleCallIndirect) {
WASM_EXEC_TEST(CallIndirect_EmptyTable) {
TestSignatures sigs;
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
// One function.
WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii());
@@ -2730,7 +2733,7 @@ WASM_EXEC_TEST(CallIndirect_EmptyTable) {
WASM_EXEC_TEST(CallIndirect_canonical) {
TestSignatures sigs;
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
WasmFunctionCompiler& t1 = r.NewFunction(sigs.i_ii());
BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
@@ -2772,63 +2775,63 @@ WASM_EXEC_TEST(CallIndirect_canonical) {
}
WASM_EXEC_TEST(F32Floor) {
- WasmRunner<float, float> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(F32Ceil) {
- WasmRunner<float, float> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(F32Trunc) {
- WasmRunner<float, float> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(F32NearestInt) {
- WasmRunner<float, float> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(F64Floor) {
- WasmRunner<double, double> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(F64Ceil) {
- WasmRunner<double, double> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(F64Trunc) {
- WasmRunner<double, double> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(F64NearestInt) {
- WasmRunner<double, double> r(execution_mode);
+ 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)); }
}
WASM_EXEC_TEST(F32Min) {
- WasmRunner<float, float, float> r(execution_mode);
+ WasmRunner<float, float, float> r(execution_tier);
BUILD(r, WASM_F32_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
@@ -2837,7 +2840,7 @@ WASM_EXEC_TEST(F32Min) {
}
WASM_EXEC_TEST(F64Min) {
- WasmRunner<double, double, double> r(execution_mode);
+ WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_MIN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT64_INPUTS(i) {
@@ -2846,7 +2849,7 @@ WASM_EXEC_TEST(F64Min) {
}
WASM_EXEC_TEST(F32Max) {
- WasmRunner<float, float, float> r(execution_mode);
+ WasmRunner<float, float, float> r(execution_tier);
BUILD(r, WASM_F32_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
@@ -2855,7 +2858,7 @@ WASM_EXEC_TEST(F32Max) {
}
WASM_EXEC_TEST(F64Max) {
- WasmRunner<double, double, double> r(execution_mode);
+ WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_MAX(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT64_INPUTS(i) {
@@ -2867,7 +2870,7 @@ WASM_EXEC_TEST(F64Max) {
}
WASM_EXEC_TEST(I32SConvertF32) {
- WasmRunner<int32_t, float> r(execution_mode);
+ WasmRunner<int32_t, float> r(execution_tier);
BUILD(r, WASM_I32_SCONVERT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
@@ -2881,7 +2884,7 @@ WASM_EXEC_TEST(I32SConvertF32) {
WASM_EXEC_TEST(I32SConvertSatF32) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
- WasmRunner<int32_t, float> r(execution_mode);
+ WasmRunner<int32_t, float> r(execution_tier);
BUILD(r, WASM_I32_SCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
@@ -2897,7 +2900,7 @@ WASM_EXEC_TEST(I32SConvertSatF32) {
}
WASM_EXEC_TEST(I32SConvertF64) {
- WasmRunner<int32_t, double> r(execution_mode);
+ WasmRunner<int32_t, double> r(execution_tier);
BUILD(r, WASM_I32_SCONVERT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
@@ -2911,7 +2914,7 @@ WASM_EXEC_TEST(I32SConvertF64) {
WASM_EXEC_TEST(I32SConvertSatF64) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
- WasmRunner<int32_t, double> r(execution_mode);
+ WasmRunner<int32_t, double> r(execution_tier);
BUILD(r, WASM_I32_SCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int32_t expected =
@@ -2926,7 +2929,7 @@ WASM_EXEC_TEST(I32SConvertSatF64) {
}
WASM_EXEC_TEST(I32UConvertF32) {
- WasmRunner<uint32_t, float> r(execution_mode);
+ 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)) {
@@ -2939,7 +2942,7 @@ WASM_EXEC_TEST(I32UConvertF32) {
WASM_EXEC_TEST(I32UConvertSatF32) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
- WasmRunner<uint32_t, float> r(execution_mode);
+ WasmRunner<uint32_t, float> r(execution_tier);
BUILD(r, WASM_I32_UCONVERT_SAT_F32(WASM_GET_LOCAL(0)));
FOR_FLOAT32_INPUTS(i) {
int32_t expected =
@@ -2954,7 +2957,7 @@ WASM_EXEC_TEST(I32UConvertSatF32) {
}
WASM_EXEC_TEST(I32UConvertF64) {
- WasmRunner<uint32_t, double> r(execution_mode);
+ 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)) {
@@ -2967,7 +2970,7 @@ WASM_EXEC_TEST(I32UConvertF64) {
WASM_EXEC_TEST(I32UConvertSatF64) {
EXPERIMENTAL_FLAG_SCOPE(sat_f2i_conversions);
- WasmRunner<uint32_t, double> r(execution_mode);
+ WasmRunner<uint32_t, double> r(execution_tier);
BUILD(r, WASM_I32_UCONVERT_SAT_F64(WASM_GET_LOCAL(0)));
FOR_FLOAT64_INPUTS(i) {
int32_t expected =
@@ -2982,7 +2985,7 @@ WASM_EXEC_TEST(I32UConvertSatF64) {
}
WASM_EXEC_TEST(F64CopySign) {
- WasmRunner<double, double, double> r(execution_mode);
+ WasmRunner<double, double, double> r(execution_tier);
BUILD(r, WASM_F64_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT64_INPUTS(i) {
@@ -2991,7 +2994,7 @@ WASM_EXEC_TEST(F64CopySign) {
}
WASM_EXEC_TEST(F32CopySign) {
- WasmRunner<float, float, float> r(execution_mode);
+ WasmRunner<float, float, float> r(execution_tier);
BUILD(r, WASM_F32_COPYSIGN(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
FOR_FLOAT32_INPUTS(i) {
@@ -2999,12 +3002,12 @@ WASM_EXEC_TEST(F32CopySign) {
}
}
-static void CompileCallIndirectMany(WasmExecutionMode mode, ValueType param) {
+static void CompileCallIndirectMany(ExecutionTier tier, ValueType param) {
// Make sure we don't run out of registers when compiling indirect calls
// with many many parameters.
TestSignatures sigs;
for (byte num_params = 0; num_params < 40; ++num_params) {
- WasmRunner<void> r(mode);
+ WasmRunner<void> r(tier);
FunctionSig* sig = sigs.many(r.zone(), kWasmStmt, param, num_params);
r.builder().AddSignature(sig);
@@ -3025,19 +3028,19 @@ static void CompileCallIndirectMany(WasmExecutionMode mode, ValueType param) {
}
WASM_COMPILED_EXEC_TEST(Compile_Wasm_CallIndirect_Many_i32) {
- CompileCallIndirectMany(execution_mode, kWasmI32);
+ CompileCallIndirectMany(execution_tier, kWasmI32);
}
WASM_COMPILED_EXEC_TEST(Compile_Wasm_CallIndirect_Many_f32) {
- CompileCallIndirectMany(execution_mode, kWasmF32);
+ CompileCallIndirectMany(execution_tier, kWasmF32);
}
WASM_COMPILED_EXEC_TEST(Compile_Wasm_CallIndirect_Many_f64) {
- CompileCallIndirectMany(execution_mode, kWasmF64);
+ CompileCallIndirectMany(execution_tier, kWasmF64);
}
WASM_EXEC_TEST(Int32RemS_dead) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_DROP,
WASM_ZERO);
const int32_t kMin = std::numeric_limits<int32_t>::min();
@@ -3050,7 +3053,7 @@ WASM_EXEC_TEST(Int32RemS_dead) {
}
WASM_EXEC_TEST(BrToLoopWithValue) {
- WasmRunner<int32_t, int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t, int32_t> r(execution_tier);
// Subtracts <1> times 3 from <0> and returns the result.
BUILD(r,
// loop i32
@@ -3070,7 +3073,7 @@ WASM_EXEC_TEST(BrToLoopWithValue) {
WASM_EXEC_TEST(BrToLoopWithoutValue) {
// This was broken in the interpreter, see http://crbug.com/715454
- WasmRunner<int32_t, int32_t> r(execution_mode);
+ WasmRunner<int32_t, int32_t> r(execution_tier);
BUILD(
r, kExprLoop, kLocalI32, // loop i32
WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_ONE)), // dec <0>
@@ -3081,31 +3084,31 @@ WASM_EXEC_TEST(BrToLoopWithoutValue) {
}
WASM_EXEC_TEST(LoopsWithValues) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_LOOP_I(WASM_LOOP_I(WASM_ONE), WASM_ONE, kExprI32Add));
CHECK_EQ(2, r.Call());
}
WASM_EXEC_TEST(InvalidStackAfterUnreachable) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r, kExprUnreachable, kExprI32Add);
CHECK_TRAP32(r.Call());
}
WASM_EXEC_TEST(InvalidStackAfterBr) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_BRV(0, WASM_I32V_1(27)), kExprI32Add);
CHECK_EQ(27, r.Call());
}
WASM_EXEC_TEST(InvalidStackAfterReturn) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_RETURN1(WASM_I32V_1(17)), kExprI32Add);
CHECK_EQ(17, r.Call());
}
WASM_EXEC_TEST(BranchOverUnreachableCode) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r,
// Start a block which breaks in the middle (hence unreachable code
// afterwards) and continue execution after this block.
@@ -3116,7 +3119,7 @@ WASM_EXEC_TEST(BranchOverUnreachableCode) {
}
WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop0) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r,
WASM_BLOCK_I(
// Start a loop which breaks in the middle (hence unreachable code
@@ -3130,7 +3133,7 @@ WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop0) {
}
WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop1) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r,
WASM_BLOCK_I(
// Start a loop which breaks in the middle (hence unreachable code
@@ -3143,7 +3146,7 @@ WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop1) {
}
WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop2) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r,
WASM_BLOCK_I(
// Start a loop which breaks in the middle (hence unreachable code
@@ -3157,13 +3160,13 @@ WASM_EXEC_TEST(BranchOverUnreachableCodeInLoop2) {
}
WASM_EXEC_TEST(BlockInsideUnreachable) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(r, WASM_RETURN1(WASM_I32V_1(17)), WASM_BLOCK(WASM_BR(0)));
CHECK_EQ(17, r.Call());
}
WASM_EXEC_TEST(IfInsideUnreachable) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
BUILD(
r, WASM_RETURN1(WASM_I32V_1(17)),
WASM_IF_ELSE_I(WASM_ONE, WASM_BRV(0, WASM_ONE), WASM_RETURN1(WASM_ONE)));
@@ -3177,9 +3180,8 @@ WASM_EXEC_TEST(IfInsideUnreachable) {
// not overwritten.
template <typename ctype>
void BinOpOnDifferentRegisters(
- WasmExecutionMode execution_mode, ValueType type,
- Vector<const ctype> inputs, WasmOpcode opcode,
- std::function<ctype(ctype, ctype, bool*)> expect_fn) {
+ ExecutionTier execution_tier, ValueType type, Vector<const ctype> inputs,
+ WasmOpcode opcode, std::function<ctype(ctype, ctype, bool*)> expect_fn) {
static constexpr int kMaxNumLocals = 8;
for (int num_locals = 1; num_locals < kMaxNumLocals; ++num_locals) {
// {init_locals_code} is shared by all code generated in the loop below.
@@ -3202,7 +3204,7 @@ void BinOpOnDifferentRegisters(
}
for (int lhs = 0; lhs < num_locals; ++lhs) {
for (int rhs = 0; rhs < num_locals; ++rhs) {
- WasmRunner<int32_t> r(execution_mode);
+ WasmRunner<int32_t> r(execution_tier);
ctype* memory =
r.builder().AddMemoryElems<ctype>(kWasmPageSize / sizeof(ctype));
for (int i = 0; i < num_locals; ++i) {
@@ -3226,8 +3228,7 @@ void BinOpOnDifferentRegisters(
ctype value =
i == lhs ? lhs_value
: i == rhs ? rhs_value : static_cast<ctype>(i + 47);
- WriteLittleEndianValue<ctype>(
- reinterpret_cast<Address>(&memory[i]), value);
+ WriteLittleEndianValue<ctype>(&memory[i], value);
}
bool trap = false;
int64_t expect = expect_fn(lhs_value, rhs_value, &trap);
@@ -3236,14 +3237,12 @@ void BinOpOnDifferentRegisters(
continue;
}
CHECK_EQ(0, r.Call());
- CHECK_EQ(expect, ReadLittleEndianValue<ctype>(
- reinterpret_cast<Address>(&memory[0])));
+ CHECK_EQ(expect, ReadLittleEndianValue<ctype>(&memory[0]));
for (int i = 0; i < num_locals; ++i) {
ctype value =
i == lhs ? lhs_value
: i == rhs ? rhs_value : static_cast<ctype>(i + 47);
- CHECK_EQ(value, ReadLittleEndianValue<ctype>(
- reinterpret_cast<Address>(&memory[i + 1])));
+ CHECK_EQ(value, ReadLittleEndianValue<ctype>(&memory[i + 1]));
}
}
}
@@ -3260,37 +3259,37 @@ static constexpr int64_t kSome64BitInputs[] = {
WASM_EXEC_TEST(I32AddOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
- execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Add,
+ execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Add,
[](int32_t lhs, int32_t rhs, bool* trap) { return lhs + rhs; });
}
WASM_EXEC_TEST(I32SubOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
- execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Sub,
+ execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Sub,
[](int32_t lhs, int32_t rhs, bool* trap) { return lhs - rhs; });
}
WASM_EXEC_TEST(I32MulOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
- execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Mul,
+ execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Mul,
[](int32_t lhs, int32_t rhs, bool* trap) { return lhs * rhs; });
}
WASM_EXEC_TEST(I32ShlOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
- execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Shl,
+ execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32Shl,
[](int32_t lhs, int32_t rhs, bool* trap) { return lhs << (rhs & 31); });
}
WASM_EXEC_TEST(I32ShrSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
- execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrS,
+ execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrS,
[](int32_t lhs, int32_t rhs, bool* trap) { return lhs >> (rhs & 31); });
}
WASM_EXEC_TEST(I32ShrUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
- execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrU,
+ execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32ShrU,
[](int32_t lhs, int32_t rhs, bool* trap) {
return static_cast<uint32_t>(lhs) >> (rhs & 31);
});
@@ -3298,7 +3297,7 @@ WASM_EXEC_TEST(I32ShrUOnDifferentRegisters) {
WASM_EXEC_TEST(I32DivSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
- execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivS,
+ execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivS,
[](int32_t lhs, int32_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap ? 0 : lhs / rhs;
@@ -3307,7 +3306,7 @@ WASM_EXEC_TEST(I32DivSOnDifferentRegisters) {
WASM_EXEC_TEST(I32DivUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
- execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivU,
+ execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32DivU,
[](uint32_t lhs, uint32_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap ? 0 : lhs / rhs;
@@ -3316,7 +3315,7 @@ WASM_EXEC_TEST(I32DivUOnDifferentRegisters) {
WASM_EXEC_TEST(I32RemSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
- execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemS,
+ execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemS,
[](int32_t lhs, int32_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap || rhs == -1 ? 0 : lhs % rhs;
@@ -3325,7 +3324,7 @@ WASM_EXEC_TEST(I32RemSOnDifferentRegisters) {
WASM_EXEC_TEST(I32RemUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int32_t>(
- execution_mode, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemU,
+ execution_tier, kWasmI32, ArrayVector(kSome32BitInputs), kExprI32RemU,
[](uint32_t lhs, uint32_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap ? 0 : lhs % rhs;
@@ -3334,37 +3333,37 @@ WASM_EXEC_TEST(I32RemUOnDifferentRegisters) {
WASM_EXEC_TEST(I64AddOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
- execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Add,
+ execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Add,
[](int64_t lhs, int64_t rhs, bool* trap) { return lhs + rhs; });
}
WASM_EXEC_TEST(I64SubOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
- execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Sub,
+ execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Sub,
[](int64_t lhs, int64_t rhs, bool* trap) { return lhs - rhs; });
}
WASM_EXEC_TEST(I64MulOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
- execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Mul,
+ execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Mul,
[](int64_t lhs, int64_t rhs, bool* trap) { return lhs * rhs; });
}
WASM_EXEC_TEST(I64ShlOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
- execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Shl,
+ execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64Shl,
[](int64_t lhs, int64_t rhs, bool* trap) { return lhs << (rhs & 63); });
}
WASM_EXEC_TEST(I64ShrSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
- execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrS,
+ execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrS,
[](int64_t lhs, int64_t rhs, bool* trap) { return lhs >> (rhs & 63); });
}
WASM_EXEC_TEST(I64ShrUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
- execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrU,
+ execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64ShrU,
[](int64_t lhs, int64_t rhs, bool* trap) {
return static_cast<uint64_t>(lhs) >> (rhs & 63);
});
@@ -3372,7 +3371,7 @@ WASM_EXEC_TEST(I64ShrUOnDifferentRegisters) {
WASM_EXEC_TEST(I64DivSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
- execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivS,
+ execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivS,
[](int64_t lhs, int64_t rhs, bool* trap) {
*trap = rhs == 0 ||
(rhs == -1 && lhs == std::numeric_limits<int64_t>::min());
@@ -3382,7 +3381,7 @@ WASM_EXEC_TEST(I64DivSOnDifferentRegisters) {
WASM_EXEC_TEST(I64DivUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
- execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivU,
+ execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64DivU,
[](uint64_t lhs, uint64_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap ? 0 : lhs / rhs;
@@ -3391,7 +3390,7 @@ WASM_EXEC_TEST(I64DivUOnDifferentRegisters) {
WASM_EXEC_TEST(I64RemSOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
- execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemS,
+ execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemS,
[](int64_t lhs, int64_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap || rhs == -1 ? 0 : lhs % rhs;
@@ -3400,7 +3399,7 @@ WASM_EXEC_TEST(I64RemSOnDifferentRegisters) {
WASM_EXEC_TEST(I64RemUOnDifferentRegisters) {
BinOpOnDifferentRegisters<int64_t>(
- execution_mode, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemU,
+ execution_tier, kWasmI64, ArrayVector(kSome64BitInputs), kExprI64RemU,
[](uint64_t lhs, uint64_t rhs, bool* trap) {
*trap = rhs == 0;
return *trap ? 0 : lhs % rhs;
@@ -3408,7 +3407,7 @@ WASM_EXEC_TEST(I64RemUOnDifferentRegisters) {
}
TEST(Liftoff_tier_up) {
- WasmRunner<int32_t, int32_t, int32_t> r(WasmExecutionMode::kExecuteLiftoff);
+ WasmRunner<int32_t, int32_t, int32_t> r(ExecutionTier::kBaseline);
WasmFunctionCompiler& add = r.NewFunction<int32_t, int32_t, int32_t>("add");
BUILD(add, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)));
diff --git a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc
index e9ee63d93c..39d7e1a5be 100644
--- a/deps/v8/test/cctest/wasm/test-streaming-compilation.cc
+++ b/deps/v8/test/cctest/wasm/test-streaming-compilation.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/objects-inl.h"
#include "src/v8.h"
#include "src/vector.h"
@@ -88,7 +88,7 @@ enum class CompilationState {
kFailed,
};
-class TestResolver : public i::wasm::CompilationResultResolver {
+class TestResolver : public CompilationResultResolver {
public:
explicit TestResolver(CompilationState* state) : state_(state) {}
@@ -109,12 +109,13 @@ class StreamTester {
StreamTester() : zone_(&allocator_, "StreamTester") {
v8::Isolate* isolate = CcTest::isolate();
i::Isolate* i_isolate = CcTest::i_isolate();
+ i::HandleScope internal_scope(i_isolate);
v8::Local<v8::Context> context = isolate->GetCurrentContext();
stream_ = i_isolate->wasm_engine()->StartStreamingCompilation(
- i_isolate, v8::Utils::OpenHandle(*context),
- base::make_unique<TestResolver>(&state_));
+ i_isolate, kAllWasmFeatures, v8::Utils::OpenHandle(*context),
+ std::make_shared<TestResolver>(&state_));
}
std::shared_ptr<StreamingDecoder> stream() { return stream_; }
@@ -151,8 +152,6 @@ class StreamTester {
TEST(name) { \
MockPlatform platform; \
CcTest::InitializeVM(); \
- v8::HandleScope handle_scope(CcTest::isolate()); \
- i::HandleScope internal_scope(CcTest::i_isolate()); \
RunStream_##name(); \
} \
void RunStream_##name()
@@ -212,8 +211,9 @@ STREAM_TEST(TestAllBytesArriveAOTCompilerFinishesFirst) {
size_t GetFunctionOffset(i::Isolate* isolate, const uint8_t* buffer,
size_t size, size_t index) {
- ModuleResult result = SyncDecodeWasmModule(isolate, buffer, buffer + size,
- false, ModuleOrigin::kWasmOrigin);
+ ModuleResult result = DecodeWasmModule(
+ kAllWasmFeatures, buffer, buffer + size, false, ModuleOrigin::kWasmOrigin,
+ isolate->counters(), isolate->allocator());
CHECK(result.ok());
const WasmFunction* func = &result.val->functions[1];
return func->code.offset();
diff --git a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc
index ef0a0e545e..ec93639e17 100644
--- a/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc
+++ b/deps/v8/test/cctest/wasm/test-wasm-breakpoints.cc
@@ -242,7 +242,7 @@ std::vector<WasmValue> wasmVec(Args... args) {
} // namespace
WASM_COMPILED_EXEC_TEST(WasmCollectPossibleBreakpoints) {
- WasmRunner<int> runner(execution_mode);
+ WasmRunner<int> runner(execution_tier);
BUILD(runner, WASM_NOP, WASM_I32_ADD(WASM_ZERO, WASM_ONE));
@@ -269,7 +269,7 @@ WASM_COMPILED_EXEC_TEST(WasmCollectPossibleBreakpoints) {
}
WASM_COMPILED_EXEC_TEST(WasmSimpleBreak) {
- WasmRunner<int> runner(execution_mode);
+ WasmRunner<int> runner(execution_tier);
Isolate* isolate = runner.main_isolate();
BUILD(runner, WASM_NOP, WASM_I32_ADD(WASM_I32V_1(11), WASM_I32V_1(3)));
@@ -290,7 +290,7 @@ WASM_COMPILED_EXEC_TEST(WasmSimpleBreak) {
}
WASM_COMPILED_EXEC_TEST(WasmSimpleStepping) {
- WasmRunner<int> runner(execution_mode);
+ WasmRunner<int> runner(execution_tier);
BUILD(runner, WASM_I32_ADD(WASM_I32V_1(11), WASM_I32V_1(3)));
Isolate* isolate = runner.main_isolate();
@@ -317,7 +317,7 @@ WASM_COMPILED_EXEC_TEST(WasmSimpleStepping) {
}
WASM_COMPILED_EXEC_TEST(WasmStepInAndOut) {
- WasmRunner<int, int> runner(execution_mode);
+ WasmRunner<int, int> runner(execution_tier);
WasmFunctionCompiler& f2 = runner.NewFunction<void>();
f2.AllocateLocal(kWasmI32);
@@ -357,7 +357,7 @@ WASM_COMPILED_EXEC_TEST(WasmStepInAndOut) {
}
WASM_COMPILED_EXEC_TEST(WasmGetLocalsAndStack) {
- WasmRunner<void, int> runner(execution_mode);
+ WasmRunner<void, int> runner(execution_tier);
runner.AllocateLocal(kWasmI64);
runner.AllocateLocal(kWasmF32);
runner.AllocateLocal(kWasmF64);
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 16c525945f..d927de34ca 100644
--- a/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc
+++ b/deps/v8/test/cctest/wasm/test-wasm-interpreter-entry.cc
@@ -91,7 +91,7 @@ static ArgPassingHelper<T> GetHelper(
// Pass int32_t, return int32_t.
TEST(TestArgumentPassing_int32) {
- WasmRunner<int32_t, int32_t> runner(kExecuteTurbofan);
+ WasmRunner<int32_t, int32_t> runner(ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 = runner.NewFunction<int32_t, int32_t>();
auto helper = GetHelper(
@@ -107,7 +107,7 @@ TEST(TestArgumentPassing_int32) {
// Pass int64_t, return double.
TEST(TestArgumentPassing_double_int64) {
- WasmRunner<double, int32_t, int32_t> runner(kExecuteTurbofan);
+ WasmRunner<double, int32_t, int32_t> runner(ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 = runner.NewFunction<double, int64_t>();
auto helper = GetHelper(
@@ -140,7 +140,7 @@ TEST(TestArgumentPassing_double_int64) {
// Pass double, return int64_t.
TEST(TestArgumentPassing_int64_double) {
// Outer function still returns double.
- WasmRunner<double, double> runner(kExecuteTurbofan);
+ WasmRunner<double, double> runner(ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 = runner.NewFunction<int64_t, double>();
auto helper = GetHelper(
@@ -159,7 +159,7 @@ TEST(TestArgumentPassing_int64_double) {
// Pass float, return double.
TEST(TestArgumentPassing_float_double) {
- WasmRunner<double, float> runner(kExecuteTurbofan);
+ WasmRunner<double, float> runner(ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 = runner.NewFunction<double, float>();
auto helper = GetHelper(
@@ -177,7 +177,7 @@ TEST(TestArgumentPassing_float_double) {
// Pass two doubles, return double.
TEST(TestArgumentPassing_double_double) {
- WasmRunner<double, double, double> runner(kExecuteTurbofan);
+ WasmRunner<double, double, double> runner(ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 = runner.NewFunction<double, double, double>();
auto helper = GetHelper(runner, f2,
@@ -197,7 +197,7 @@ TEST(TestArgumentPassing_double_double) {
TEST(TestArgumentPassing_AllTypes) {
// The second and third argument will be combined to an i64.
WasmRunner<double, int32_t, int32_t, int32_t, float, double> runner(
- kExecuteTurbofan);
+ ExecutionTier::kOptimized);
WasmFunctionCompiler& f2 =
runner.NewFunction<double, int32_t, int64_t, float, double>();
diff --git a/deps/v8/test/cctest/wasm/test-wasm-serialization.cc b/deps/v8/test/cctest/wasm/test-wasm-serialization.cc
index 9475332ad0..a2c53ab210 100644
--- a/deps/v8/test/cctest/wasm/test-wasm-serialization.cc
+++ b/deps/v8/test/cctest/wasm/test-wasm-serialization.cc
@@ -5,7 +5,7 @@
#include <stdlib.h>
#include <string.h>
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/objects-inl.h"
#include "src/snapshot/code-serializer.h"
#include "src/version.h"
@@ -147,9 +147,10 @@ class WasmSerializationTest {
HandleScope scope(serialization_isolate);
testing::SetupIsolateForWasmModule(serialization_isolate);
+ auto enabled_features = WasmFeaturesFromIsolate(serialization_isolate);
MaybeHandle<WasmModuleObject> maybe_module_object =
serialization_isolate->wasm_engine()->SyncCompile(
- serialization_isolate, &thrower,
+ serialization_isolate, enabled_features, &thrower,
ModuleWireBytes(buffer.begin(), buffer.end()));
Handle<WasmModuleObject> module_object =
maybe_module_object.ToHandleChecked();
@@ -269,46 +270,75 @@ TEST(BlockWasmCodeGenAtDeserialization) {
Cleanup();
}
-TEST(TransferrableWasmModules) {
+namespace {
+
+void TestTransferrableWasmModules(bool should_share) {
+ i::wasm::WasmEngine::InitializeOncePerProcess();
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
ZoneBuffer buffer(&zone);
WasmSerializationTest::BuildWireBytes(&zone, &buffer);
- Isolate* from_isolate = CcTest::InitIsolateOnce();
- ErrorThrower thrower(from_isolate, "");
+ v8::Isolate::CreateParams create_params;
+ create_params.array_buffer_allocator = CcTest::array_buffer_allocator();
+ v8::Isolate* from_isolate = v8::Isolate::New(create_params);
std::vector<v8::WasmCompiledModule::TransferrableModule> store;
+ std::shared_ptr<NativeModule> original_native_module;
{
- HandleScope scope(from_isolate);
- testing::SetupIsolateForWasmModule(from_isolate);
-
- MaybeHandle<WasmModuleObject> module_object =
- from_isolate->wasm_engine()->SyncCompile(
- from_isolate, &thrower,
+ v8::HandleScope scope(from_isolate);
+ LocalContext env(from_isolate);
+
+ Isolate* from_i_isolate = reinterpret_cast<Isolate*>(from_isolate);
+ testing::SetupIsolateForWasmModule(from_i_isolate);
+ ErrorThrower thrower(from_i_isolate, "TestTransferrableWasmModules");
+ auto enabled_features = WasmFeaturesFromIsolate(from_i_isolate);
+ MaybeHandle<WasmModuleObject> maybe_module_object =
+ from_i_isolate->wasm_engine()->SyncCompile(
+ from_i_isolate, enabled_features, &thrower,
ModuleWireBytes(buffer.begin(), buffer.end()));
+ Handle<WasmModuleObject> module_object =
+ maybe_module_object.ToHandleChecked();
v8::Local<v8::WasmCompiledModule> v8_module =
- v8::Local<v8::WasmCompiledModule>::Cast(v8::Utils::ToLocal(
- Handle<JSObject>::cast(module_object.ToHandleChecked())));
+ v8::Local<v8::WasmCompiledModule>::Cast(
+ v8::Utils::ToLocal(Handle<JSObject>::cast(module_object)));
store.push_back(v8_module->GetTransferrableModule());
+ original_native_module = module_object->managed_native_module()->get();
}
{
- v8::Isolate::CreateParams create_params;
- create_params.array_buffer_allocator =
- from_isolate->array_buffer_allocator();
v8::Isolate* to_isolate = v8::Isolate::New(create_params);
{
- v8::HandleScope new_scope(to_isolate);
- v8::Local<v8::Context> deserialization_context =
- v8::Context::New(to_isolate);
- deserialization_context->Enter();
- v8::MaybeLocal<v8::WasmCompiledModule> mod =
+ v8::HandleScope scope(to_isolate);
+ LocalContext env(to_isolate);
+
+ v8::MaybeLocal<v8::WasmCompiledModule> transferred_module =
v8::WasmCompiledModule::FromTransferrableModule(to_isolate, store[0]);
- CHECK(!mod.IsEmpty());
+ CHECK(!transferred_module.IsEmpty());
+ Handle<WasmModuleObject> module_object = Handle<WasmModuleObject>::cast(
+ v8::Utils::OpenHandle(*transferred_module.ToLocalChecked()));
+ std::shared_ptr<NativeModule> transferred_native_module =
+ module_object->managed_native_module()->get();
+ bool is_sharing = (original_native_module == transferred_native_module);
+ CHECK_EQ(should_share, is_sharing);
}
to_isolate->Dispose();
}
+ original_native_module.reset();
+ from_isolate->Dispose();
+}
+
+} // namespace
+
+UNINITIALIZED_TEST(TransferrableWasmModulesCloned) {
+ FlagScope<bool> flag_scope_code(&FLAG_wasm_shared_code, false);
+ TestTransferrableWasmModules(false);
+}
+
+UNINITIALIZED_TEST(TransferrableWasmModulesShared) {
+ FlagScope<bool> flag_scope_engine(&FLAG_wasm_shared_engine, true);
+ FlagScope<bool> flag_scope_code(&FLAG_wasm_shared_code, true);
+ TestTransferrableWasmModules(true);
}
#undef EMIT_CODE_WITH_END
diff --git a/deps/v8/test/cctest/wasm/test-wasm-shared-engine.cc b/deps/v8/test/cctest/wasm/test-wasm-shared-engine.cc
index 8d9131ad75..5e70edf830 100644
--- a/deps/v8/test/cctest/wasm/test-wasm-shared-engine.cc
+++ b/deps/v8/test/cctest/wasm/test-wasm-shared-engine.cc
@@ -5,6 +5,7 @@
#include <memory>
#include "src/objects-inl.h"
+#include "src/wasm/function-compiler.h"
#include "src/wasm/wasm-engine.h"
#include "src/wasm/wasm-module-builder.h"
#include "src/wasm/wasm-module.h"
@@ -25,8 +26,7 @@ namespace test_wasm_shared_engine {
class SharedEngine {
public:
explicit SharedEngine(size_t max_committed = kMaxWasmCodeMemory)
- : wasm_engine_(base::make_unique<WasmEngine>(
- base::make_unique<WasmCodeManager>(max_committed))) {}
+ : wasm_engine_(base::make_unique<WasmEngine>()) {}
~SharedEngine() {
// Ensure no remaining uses exist.
CHECK(wasm_engine_.unique());
@@ -83,20 +83,9 @@ class SharedEngineIsolate {
return instance.ToHandleChecked();
}
- // TODO(mstarzinger): Switch over to a public API for sharing modules via the
- // {v8::WasmCompiledModule::TransferrableModule} class once it is ready.
Handle<WasmInstanceObject> ImportInstance(SharedModule shared_module) {
- Vector<const byte> wire_bytes = shared_module->wire_bytes();
- Handle<Script> script = CreateWasmScript(isolate(), wire_bytes);
Handle<WasmModuleObject> module_object =
- WasmModuleObject::New(isolate(), shared_module, script);
-
- // TODO(6792): Wrappers below might be cloned using {Factory::CopyCode}.
- // This requires unlocking the code space here. This should eventually be
- // moved into the allocator.
- CodeSpaceMemoryModificationScope modification_scope(isolate()->heap());
- CompileJsToWasmWrappers(isolate(), module_object);
-
+ isolate()->wasm_engine()->ImportNativeModule(isolate(), shared_module);
ErrorThrower thrower(isolate(), "ImportInstance");
MaybeHandle<WasmInstanceObject> instance =
isolate()->wasm_engine()->SyncInstantiate(isolate(), &thrower,
@@ -117,6 +106,26 @@ class SharedEngineIsolate {
std::unique_ptr<Zone> zone_;
};
+// Helper class representing a Thread running its own instance of an Isolate
+// with a shared WebAssembly engine available at construction time.
+class SharedEngineThread : public v8::base::Thread {
+ public:
+ SharedEngineThread(SharedEngine* engine,
+ std::function<void(SharedEngineIsolate&)> callback)
+ : Thread(Options("SharedEngineThread")),
+ engine_(engine),
+ callback_(callback) {}
+
+ virtual void Run() {
+ SharedEngineIsolate isolate(engine_);
+ callback_(isolate);
+ }
+
+ private:
+ SharedEngine* engine_;
+ std::function<void(SharedEngineIsolate&)> callback_;
+};
+
namespace {
ZoneBuffer* BuildReturnConstantModule(Zone* zone, int constant) {
@@ -132,6 +141,62 @@ ZoneBuffer* BuildReturnConstantModule(Zone* zone, int constant) {
return buffer;
}
+class MockInstantiationResolver : public InstantiationResultResolver {
+ public:
+ explicit MockInstantiationResolver(Handle<Object>* out_instance)
+ : out_instance_(out_instance) {}
+ virtual void OnInstantiationSucceeded(Handle<WasmInstanceObject> result) {
+ *out_instance_->location() = *result;
+ }
+ virtual void OnInstantiationFailed(Handle<Object> error_reason) {
+ UNREACHABLE();
+ }
+
+ private:
+ Handle<Object>* out_instance_;
+};
+
+class MockCompilationResolver : public CompilationResultResolver {
+ public:
+ MockCompilationResolver(SharedEngineIsolate& isolate,
+ Handle<Object>* out_instance)
+ : isolate_(isolate), out_instance_(out_instance) {}
+ virtual void OnCompilationSucceeded(Handle<WasmModuleObject> result) {
+ isolate_.isolate()->wasm_engine()->AsyncInstantiate(
+ isolate_.isolate(),
+ base::make_unique<MockInstantiationResolver>(out_instance_), result,
+ {});
+ }
+ virtual void OnCompilationFailed(Handle<Object> error_reason) {
+ UNREACHABLE();
+ }
+
+ private:
+ SharedEngineIsolate& isolate_;
+ Handle<Object>* out_instance_;
+};
+
+void PumpMessageLoop(SharedEngineIsolate& isolate) {
+ v8::platform::PumpMessageLoop(i::V8::GetCurrentPlatform(),
+ isolate.v8_isolate(),
+ platform::MessageLoopBehavior::kWaitForWork);
+ isolate.isolate()->RunMicrotasks();
+}
+
+Handle<WasmInstanceObject> CompileAndInstantiateAsync(
+ SharedEngineIsolate& isolate, ZoneBuffer* buffer) {
+ Handle<Object> maybe_instance = handle(Smi::kZero, isolate.isolate());
+ auto enabled_features = WasmFeaturesFromIsolate(isolate.isolate());
+ isolate.isolate()->wasm_engine()->AsyncCompile(
+ isolate.isolate(), enabled_features,
+ base::make_unique<MockCompilationResolver>(isolate, &maybe_instance),
+ ModuleWireBytes(buffer->begin(), buffer->end()), true);
+ while (!maybe_instance->IsWasmInstanceObject()) PumpMessageLoop(isolate);
+ Handle<WasmInstanceObject> instance =
+ Handle<WasmInstanceObject>::cast(maybe_instance);
+ return instance;
+}
+
} // namespace
TEST(SharedEngineUseCount) {
@@ -192,6 +257,111 @@ TEST(SharedEngineRunImported) {
CHECK_EQ(1, module.use_count());
}
+TEST(SharedEngineRunThreadedBuildingSync) {
+ SharedEngine engine;
+ SharedEngineThread thread1(&engine, [](SharedEngineIsolate& isolate) {
+ HandleScope scope(isolate.isolate());
+ ZoneBuffer* buffer = BuildReturnConstantModule(isolate.zone(), 23);
+ Handle<WasmInstanceObject> instance = isolate.CompileAndInstantiate(buffer);
+ CHECK_EQ(23, isolate.Run(instance));
+ });
+ SharedEngineThread thread2(&engine, [](SharedEngineIsolate& isolate) {
+ HandleScope scope(isolate.isolate());
+ ZoneBuffer* buffer = BuildReturnConstantModule(isolate.zone(), 42);
+ Handle<WasmInstanceObject> instance = isolate.CompileAndInstantiate(buffer);
+ CHECK_EQ(42, isolate.Run(instance));
+ });
+ thread1.Start();
+ thread2.Start();
+ thread1.Join();
+ thread2.Join();
+}
+
+TEST(SharedEngineRunThreadedBuildingAsync) {
+ SharedEngine engine;
+ SharedEngineThread thread1(&engine, [](SharedEngineIsolate& isolate) {
+ HandleScope scope(isolate.isolate());
+ ZoneBuffer* buffer = BuildReturnConstantModule(isolate.zone(), 23);
+ Handle<WasmInstanceObject> instance =
+ CompileAndInstantiateAsync(isolate, buffer);
+ CHECK_EQ(23, isolate.Run(instance));
+ });
+ SharedEngineThread thread2(&engine, [](SharedEngineIsolate& isolate) {
+ HandleScope scope(isolate.isolate());
+ ZoneBuffer* buffer = BuildReturnConstantModule(isolate.zone(), 42);
+ Handle<WasmInstanceObject> instance =
+ CompileAndInstantiateAsync(isolate, buffer);
+ CHECK_EQ(42, isolate.Run(instance));
+ });
+ thread1.Start();
+ thread2.Start();
+ thread1.Join();
+ thread2.Join();
+}
+
+TEST(SharedEngineRunThreadedExecution) {
+ SharedEngine engine;
+ SharedModule module;
+ {
+ SharedEngineIsolate isolate(&engine);
+ HandleScope scope(isolate.isolate());
+ ZoneBuffer* buffer = BuildReturnConstantModule(isolate.zone(), 23);
+ Handle<WasmInstanceObject> instance = isolate.CompileAndInstantiate(buffer);
+ module = isolate.ExportInstance(instance);
+ }
+ SharedEngineThread thread1(&engine, [module](SharedEngineIsolate& isolate) {
+ HandleScope scope(isolate.isolate());
+ Handle<WasmInstanceObject> instance = isolate.ImportInstance(module);
+ CHECK_EQ(23, isolate.Run(instance));
+ });
+ SharedEngineThread thread2(&engine, [module](SharedEngineIsolate& isolate) {
+ HandleScope scope(isolate.isolate());
+ Handle<WasmInstanceObject> instance = isolate.ImportInstance(module);
+ CHECK_EQ(23, isolate.Run(instance));
+ });
+ thread1.Start();
+ thread2.Start();
+ thread1.Join();
+ thread2.Join();
+}
+
+TEST(SharedEngineRunThreadedTierUp) {
+ SharedEngine engine;
+ SharedModule module;
+ {
+ SharedEngineIsolate isolate(&engine);
+ HandleScope scope(isolate.isolate());
+ ZoneBuffer* buffer = BuildReturnConstantModule(isolate.zone(), 23);
+ Handle<WasmInstanceObject> instance = isolate.CompileAndInstantiate(buffer);
+ module = isolate.ExportInstance(instance);
+ }
+ constexpr int kNumberOfThreads = 5;
+ std::list<SharedEngineThread> threads;
+ for (int i = 0; i < kNumberOfThreads; ++i) {
+ threads.emplace_back(&engine, [module](SharedEngineIsolate& isolate) {
+ constexpr int kNumberOfIterations = 100;
+ HandleScope scope(isolate.isolate());
+ Handle<WasmInstanceObject> instance = isolate.ImportInstance(module);
+ for (int j = 0; j < kNumberOfIterations; ++j) {
+ CHECK_EQ(23, isolate.Run(instance));
+ }
+ });
+ }
+ threads.emplace_back(&engine, [module](SharedEngineIsolate& isolate) {
+ HandleScope scope(isolate.isolate());
+ Handle<WasmInstanceObject> instance = isolate.ImportInstance(module);
+ ErrorThrower thrower(isolate.isolate(), "Forced Tier Up");
+ WasmFeatures detected = kNoWasmFeatures;
+ WasmCompilationUnit::CompileWasmFunction(
+ isolate.isolate(), module.get(), &detected, &thrower,
+ GetModuleEnv(module->compilation_state()),
+ &module->module()->functions[0], ExecutionTier::kOptimized);
+ CHECK_EQ(23, isolate.Run(instance));
+ });
+ for (auto& thread : threads) thread.Start();
+ for (auto& thread : threads) thread.Join();
+}
+
} // namespace test_wasm_shared_engine
} // namespace wasm
} // namespace internal
diff --git a/deps/v8/test/cctest/wasm/test-wasm-stack.cc b/deps/v8/test/cctest/wasm/test-wasm-stack.cc
index 227b90187a..2bed7e64db 100644
--- a/deps/v8/test/cctest/wasm/test-wasm-stack.cc
+++ b/deps/v8/test/cctest/wasm/test-wasm-stack.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/assembler-inl.h"
#include "test/cctest/cctest.h"
#include "test/cctest/compiler/value-helper.h"
@@ -35,7 +35,7 @@ namespace {
void PrintStackTrace(v8::Isolate* isolate, v8::Local<v8::StackTrace> stack) {
printf("Stack Trace (length %d):\n", stack->GetFrameCount());
for (int i = 0, e = stack->GetFrameCount(); i != e; ++i) {
- v8::Local<v8::StackFrame> frame = stack->GetFrame(i);
+ v8::Local<v8::StackFrame> frame = stack->GetFrame(isolate, i);
v8::Local<v8::String> script = frame->GetScriptName();
v8::Local<v8::String> func = frame->GetFunctionName();
printf(
@@ -68,7 +68,7 @@ void CheckExceptionInfos(v8::internal::Isolate* i_isolate, Handle<Object> exc,
CHECK_EQ(N, stack->GetFrameCount());
for (int frameNr = 0; frameNr < N; ++frameNr) {
- v8::Local<v8::StackFrame> frame = stack->GetFrame(frameNr);
+ v8::Local<v8::StackFrame> frame = stack->GetFrame(v8_isolate, frameNr);
v8::String::Utf8Value funName(v8_isolate, frame->GetFunctionName());
CHECK_CSTREQ(excInfos[frameNr].func_name, *funName);
// Line and column are 1-based in v8::StackFrame, just as in ExceptionInfo.
@@ -111,7 +111,7 @@ WASM_EXEC_TEST(CollectDetailedWasmStack_ExplicitThrowFromJs) {
*v8::Local<v8::Function>::Cast(CompileRun(source))));
ManuallyImportedJSFunction import = {sigs.v_v(), js_function};
uint32_t js_throwing_index = 0;
- WasmRunner<void> r(execution_mode, &import);
+ WasmRunner<void> r(execution_tier, &import);
// Add a nop such that we don't always get position 1.
BUILD(r, WASM_NOP, WASM_CALL_FUNCTION0(js_throwing_index));
@@ -157,7 +157,7 @@ WASM_EXEC_TEST(CollectDetailedWasmStack_WasmError) {
int unreachable_pos = 1 << (8 * pos_shift);
TestSignatures sigs;
// Create a WasmRunner with stack checks and traps enabled.
- WasmRunner<int> r(execution_mode, 0, "main", kRuntimeExceptionSupport);
+ WasmRunner<int> r(execution_tier, 0, "main", kRuntimeExceptionSupport);
std::vector<byte> code(unreachable_pos + 1, kExprNop);
code[unreachable_pos] = kExprUnreachable;
diff --git a/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc b/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc
index 08ad5d31f8..ad9b6d3b56 100644
--- a/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc
+++ b/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/assembler-inl.h"
#include "src/trap-handler/trap-handler.h"
#include "test/cctest/cctest.h"
@@ -54,7 +54,7 @@ void CheckExceptionInfos(v8::internal::Isolate* i_isolate, Handle<Object> exc,
CHECK_EQ(N, stack->GetFrameCount());
for (int frameNr = 0; frameNr < N; ++frameNr) {
- v8::Local<v8::StackFrame> frame = stack->GetFrame(frameNr);
+ v8::Local<v8::StackFrame> frame = stack->GetFrame(v8_isolate, frameNr);
v8::String::Utf8Value funName(v8_isolate, frame->GetFunctionName());
CHECK_CSTREQ(excInfos[frameNr].func_name, *funName);
CHECK_EQ(excInfos[frameNr].line_nr, frame->GetLineNumber());
@@ -69,7 +69,7 @@ void CheckExceptionInfos(v8::internal::Isolate* i_isolate, Handle<Object> exc,
// Trigger a trap for executing unreachable.
WASM_EXEC_TEST(Unreachable) {
// Create a WasmRunner with stack checks and traps enabled.
- WasmRunner<void> r(execution_mode, 0, "main", kRuntimeExceptionSupport);
+ WasmRunner<void> r(execution_tier, 0, "main", kRuntimeExceptionSupport);
TestSignatures sigs;
BUILD(r, WASM_UNREACHABLE);
@@ -103,7 +103,7 @@ WASM_EXEC_TEST(Unreachable) {
// Trigger a trap for loading from out-of-bounds.
WASM_EXEC_TEST(IllegalLoad) {
- WasmRunner<void> r(execution_mode, 0, "main", kRuntimeExceptionSupport);
+ WasmRunner<void> r(execution_tier, 0, "main", kRuntimeExceptionSupport);
TestSignatures sigs;
r.builder().AddMemory(0L);
diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.cc b/deps/v8/test/cctest/wasm/wasm-run-utils.cc
index d7a87849a2..5f623a46cc 100644
--- a/deps/v8/test/cctest/wasm/wasm-run-utils.cc
+++ b/deps/v8/test/cctest/wasm/wasm-run-utils.cc
@@ -14,13 +14,13 @@ namespace internal {
namespace wasm {
TestingModuleBuilder::TestingModuleBuilder(
- Zone* zone, ManuallyImportedJSFunction* maybe_import,
- WasmExecutionMode mode, RuntimeExceptionSupport exception_support,
- LowerSimd lower_simd)
+ Zone* zone, ManuallyImportedJSFunction* maybe_import, ExecutionTier tier,
+ RuntimeExceptionSupport exception_support, LowerSimd lower_simd)
: test_module_(std::make_shared<WasmModule>()),
test_module_ptr_(test_module_.get()),
isolate_(CcTest::InitIsolateOnce()),
- execution_mode_(mode),
+ enabled_features_(WasmFeaturesFromIsolate(isolate_)),
+ execution_tier_(tier),
runtime_exception_support_(exception_support),
lower_simd_(lower_simd) {
WasmJs::Install(isolate_, true);
@@ -47,14 +47,13 @@ TestingModuleBuilder::TestingModuleBuilder(
trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler
: kNoTrapHandler);
auto wasm_to_js_wrapper = native_module_->AddCodeCopy(
- code.ToHandleChecked(), wasm::WasmCode::kWasmToJsWrapper,
- maybe_import_index);
+ code.ToHandleChecked(), WasmCode::kWasmToJsWrapper, maybe_import_index);
ImportedFunctionEntry(instance_object_, maybe_import_index)
.set_wasm_to_js(*maybe_import->js_function, wasm_to_js_wrapper);
}
- if (mode == kExecuteInterpreter) {
+ if (tier == ExecutionTier::kInterpreter) {
interpreter_ = WasmDebugInfo::SetupForTesting(instance_object_);
}
}
@@ -69,7 +68,7 @@ byte* TestingModuleBuilder::AddMemory(uint32_t size) {
test_module_->has_memory = true;
uint32_t alloc_size = RoundUp(size, kWasmPageSize);
Handle<JSArrayBuffer> new_buffer;
- CHECK(wasm::NewArrayBuffer(isolate_, alloc_size).ToHandle(&new_buffer));
+ 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;
@@ -195,7 +194,7 @@ ModuleEnv TestingModuleBuilder::CreateModuleEnv() {
return {
test_module_ptr_,
trap_handler::IsTrapHandlerEnabled() ? kUseTrapHandler : kNoTrapHandler,
- runtime_exception_support_};
+ runtime_exception_support_, lower_simd()};
}
const WasmGlobal* TestingModuleBuilder::AddGlobal(ValueType type) {
@@ -214,8 +213,9 @@ Handle<WasmInstanceObject> TestingModuleBuilder::InitInstanceObject() {
isolate_->factory()->NewScript(isolate_->factory()->empty_string());
script->set_type(Script::TYPE_WASM);
ModuleEnv env = CreateModuleEnv();
- Handle<WasmModuleObject> module_object = WasmModuleObject::New(
- isolate_, test_module_, env, {}, script, Handle<ByteArray>::null());
+ Handle<WasmModuleObject> module_object =
+ WasmModuleObject::New(isolate_, enabled_features_, test_module_, env, {},
+ script, Handle<ByteArray>::null());
// This method is called when we initialize TestEnvironment. We don't
// have a memory yet, so we won't create it here. We'll update the
// interpreter when we get a memory. We do have globals, though.
@@ -230,14 +230,18 @@ Handle<WasmInstanceObject> TestingModuleBuilder::InitInstanceObject() {
void TestBuildingGraphWithBuilder(compiler::WasmGraphBuilder* builder,
Zone* zone, FunctionSig* sig,
const byte* start, const byte* end) {
+ WasmFeatures unused_detected_features;
+ FunctionBody body(sig, 0, start, end);
DecodeResult result =
- BuildTFGraph(zone->allocator(), builder, sig, start, end);
+ BuildTFGraph(zone->allocator(), kAllWasmFeatures, nullptr, builder,
+ &unused_detected_features, body, nullptr);
if (result.failed()) {
#ifdef DEBUG
if (!FLAG_trace_wasm_decoder) {
// Retry the compilation with the tracing flag on, to help in debugging.
FLAG_trace_wasm_decoder = true;
- result = BuildTFGraph(zone->allocator(), builder, sig, start, end);
+ result = BuildTFGraph(zone->allocator(), kAllWasmFeatures, nullptr,
+ builder, &unused_detected_features, body, nullptr);
}
#endif
@@ -398,6 +402,13 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
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;
+ }
+
Vector<const uint8_t> wire_bytes = builder_->instance_object()
->module_object()
->native_module()
@@ -416,18 +427,15 @@ void WasmFunctionCompiler::Build(const byte* start, const byte* end) {
FunctionBody func_body{function_->sig, function_->code.offset(),
func_wire_bytes.start(), func_wire_bytes.end()};
- WasmCompilationUnit::CompilationMode comp_mode =
- builder_->execution_mode() == WasmExecutionMode::kExecuteLiftoff
- ? WasmCompilationUnit::CompilationMode::kLiftoff
- : WasmCompilationUnit::CompilationMode::kTurbofan;
NativeModule* native_module =
builder_->instance_object()->module_object()->native_module();
- WasmCompilationUnit unit(isolate(), &module_env, native_module, func_body,
- func_name, function_->func_index, comp_mode,
- isolate()->counters(), builder_->lower_simd());
- unit.ExecuteCompilation();
- wasm::WasmCode* wasm_code = unit.FinishCompilation(&thrower);
- if (wasm::WasmCode::ShouldBeLogged(isolate())) {
+ WasmCompilationUnit unit(isolate()->wasm_engine(), &module_env, native_module,
+ func_body, func_name, function_->func_index,
+ isolate()->counters(), tier);
+ WasmFeatures unused_detected_features;
+ unit.ExecuteCompilation(&unused_detected_features);
+ WasmCode* wasm_code = unit.FinishCompilation(&thrower);
+ if (WasmCode::ShouldBeLogged(isolate())) {
wasm_code->LogCode(isolate());
}
CHECK(!thrower.error());
diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.h b/deps/v8/test/cctest/wasm/wasm-run-utils.h
index ca1c922dd4..899dc06268 100644
--- a/deps/v8/test/cctest/wasm/wasm-run-utils.h
+++ b/deps/v8/test/cctest/wasm/wasm-run-utils.h
@@ -33,6 +33,7 @@
#include "src/wasm/wasm-objects-inl.h"
#include "src/wasm/wasm-objects.h"
#include "src/wasm/wasm-opcodes.h"
+#include "src/wasm/wasm-tier.h"
#include "src/zone/accounting-allocator.h"
#include "src/zone/zone.h"
@@ -48,14 +49,6 @@ namespace wasm {
constexpr uint32_t kMaxFunctions = 10;
constexpr uint32_t kMaxGlobalsSize = 128;
-enum WasmExecutionMode {
- kExecuteInterpreter,
- kExecuteTurbofan,
- kExecuteLiftoff
-};
-
-enum LowerSimd : bool { kLowerSimd = true, kNoLowerSimd = false };
-
using compiler::CallDescriptor;
using compiler::MachineTypeForC;
using compiler::Node;
@@ -90,7 +83,7 @@ struct ManuallyImportedJSFunction {
// the interpreter.
class TestingModuleBuilder {
public:
- TestingModuleBuilder(Zone*, ManuallyImportedJSFunction*, WasmExecutionMode,
+ TestingModuleBuilder(Zone*, ManuallyImportedJSFunction*, ExecutionTier,
RuntimeExceptionSupport, LowerSimd);
void ChangeOriginToAsmjs() { test_module_->origin = kAsmJsOrigin; }
@@ -203,7 +196,7 @@ class TestingModuleBuilder {
Handle<WasmInstanceObject> instance_object() const {
return instance_object_;
}
- wasm::WasmCode* GetFunctionCode(uint32_t index) const {
+ WasmCode* GetFunctionCode(uint32_t index) const {
return native_module_->code(index);
}
Address globals_start() const {
@@ -217,7 +210,7 @@ class TestingModuleBuilder {
ModuleEnv CreateModuleEnv();
- WasmExecutionMode execution_mode() const { return execution_mode_; }
+ ExecutionTier execution_tier() const { return execution_tier_; }
RuntimeExceptionSupport runtime_exception_support() const {
return runtime_exception_support_;
@@ -227,12 +220,13 @@ class TestingModuleBuilder {
std::shared_ptr<WasmModule> test_module_;
WasmModule* test_module_ptr_;
Isolate* isolate_;
+ WasmFeatures enabled_features_;
uint32_t global_offset = 0;
byte* mem_start_ = nullptr;
uint32_t mem_size_ = 0;
V8_ALIGNED(16) byte globals_data_[kMaxGlobalsSize];
WasmInterpreter* interpreter_ = nullptr;
- WasmExecutionMode execution_mode_;
+ ExecutionTier execution_tier_;
Handle<WasmInstanceObject> instance_object_;
NativeModule* native_module_ = nullptr;
bool linked_ = false;
@@ -265,7 +259,7 @@ class WasmFunctionWrapper : private compiler::GraphAndBuilders {
Init(call_descriptor, MachineTypeForC<ReturnType>(), param_vec);
}
- void SetInnerCode(wasm::WasmCode* code) {
+ void SetInnerCode(WasmCode* code) {
intptr_t address = static_cast<intptr_t>(code->instruction_start());
compiler::NodeProperties::ChangeOp(
inner_code_node_,
@@ -347,11 +341,11 @@ class WasmFunctionCompiler : public compiler::GraphAndBuilders {
class WasmRunnerBase : public HandleAndZoneScope {
public:
WasmRunnerBase(ManuallyImportedJSFunction* maybe_import,
- WasmExecutionMode execution_mode, int num_params,
+ ExecutionTier execution_tier, int num_params,
RuntimeExceptionSupport runtime_exception_support,
LowerSimd lower_simd)
: zone_(&allocator_, ZONE_NAME),
- builder_(&zone_, maybe_import, execution_mode,
+ builder_(&zone_, maybe_import, execution_tier,
runtime_exception_support, lower_simd),
wrapper_(&zone_, num_params) {}
@@ -428,13 +422,13 @@ class WasmRunnerBase : public HandleAndZoneScope {
template <typename ReturnType, typename... ParamTypes>
class WasmRunner : public WasmRunnerBase {
public:
- WasmRunner(WasmExecutionMode execution_mode,
+ WasmRunner(ExecutionTier execution_tier,
ManuallyImportedJSFunction* maybe_import = nullptr,
const char* main_fn_name = "main",
RuntimeExceptionSupport runtime_exception_support =
kNoRuntimeExceptionSupport,
LowerSimd lower_simd = kNoLowerSimd)
- : WasmRunnerBase(maybe_import, execution_mode, sizeof...(ParamTypes),
+ : WasmRunnerBase(maybe_import, execution_tier, sizeof...(ParamTypes),
runtime_exception_support, lower_simd) {
NewFunction<ReturnType, ParamTypes...>(main_fn_name);
if (!interpret()) {
@@ -442,8 +436,8 @@ class WasmRunner : public WasmRunnerBase {
}
}
- WasmRunner(WasmExecutionMode execution_mode, LowerSimd lower_simd)
- : WasmRunner(execution_mode, nullptr, "main", kNoRuntimeExceptionSupport,
+ WasmRunner(ExecutionTier execution_tier, LowerSimd lower_simd)
+ : WasmRunner(execution_tier, nullptr, "main", kNoRuntimeExceptionSupport,
lower_simd) {}
ReturnType Call(ParamTypes... p) {
@@ -501,18 +495,20 @@ class WasmRunner : public WasmRunnerBase {
};
// A macro to define tests that run in different engine configurations.
-#define WASM_EXEC_TEST(name) \
- void RunWasm_##name(WasmExecutionMode execution_mode); \
- TEST(RunWasmTurbofan_##name) { RunWasm_##name(kExecuteTurbofan); } \
- TEST(RunWasmLiftoff_##name) { RunWasm_##name(kExecuteLiftoff); } \
- TEST(RunWasmInterpreter_##name) { RunWasm_##name(kExecuteInterpreter); } \
- void RunWasm_##name(WasmExecutionMode execution_mode)
-
-#define WASM_COMPILED_EXEC_TEST(name) \
- void RunWasm_##name(WasmExecutionMode execution_mode); \
- TEST(RunWasmTurbofan_##name) { RunWasm_##name(kExecuteTurbofan); } \
- TEST(RunWasmLiftoff_##name) { RunWasm_##name(kExecuteLiftoff); } \
- void RunWasm_##name(WasmExecutionMode execution_mode)
+#define WASM_EXEC_TEST(name) \
+ void RunWasm_##name(ExecutionTier execution_tier); \
+ TEST(RunWasmTurbofan_##name) { RunWasm_##name(ExecutionTier::kOptimized); } \
+ TEST(RunWasmLiftoff_##name) { RunWasm_##name(ExecutionTier::kBaseline); } \
+ TEST(RunWasmInterpreter_##name) { \
+ RunWasm_##name(ExecutionTier::kInterpreter); \
+ } \
+ void RunWasm_##name(ExecutionTier execution_tier)
+
+#define WASM_COMPILED_EXEC_TEST(name) \
+ void RunWasm_##name(ExecutionTier execution_tier); \
+ TEST(RunWasmTurbofan_##name) { RunWasm_##name(ExecutionTier::kOptimized); } \
+ TEST(RunWasmLiftoff_##name) { RunWasm_##name(ExecutionTier::kBaseline); } \
+ void RunWasm_##name(ExecutionTier execution_tier)
} // namespace wasm
} // namespace internal
diff --git a/deps/v8/test/common/assembler-tester.h b/deps/v8/test/common/assembler-tester.h
new file mode 100644
index 0000000000..0291e48efb
--- /dev/null
+++ b/deps/v8/test/common/assembler-tester.h
@@ -0,0 +1,46 @@
+// 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.
+
+#ifndef V8_TEST_COMMON_ASSEMBLER_TESTER_H_
+#define V8_TEST_COMMON_ASSEMBLER_TESTER_H_
+
+#include "src/assembler.h"
+
+namespace v8 {
+namespace internal {
+
+static inline uint8_t* AllocateAssemblerBuffer(
+ size_t* allocated,
+ size_t requested = v8::internal::AssemblerBase::kMinimalBufferSize,
+ void* address = nullptr) {
+ size_t page_size = v8::internal::AllocatePageSize();
+ size_t alloc_size = RoundUp(requested, page_size);
+ void* result = v8::internal::AllocatePages(
+ address, alloc_size, page_size, v8::PageAllocator::kReadWriteExecute);
+ CHECK(result);
+ *allocated = alloc_size;
+ return static_cast<uint8_t*>(result);
+}
+
+static inline void MakeAssemblerBufferExecutable(uint8_t* buffer,
+ size_t allocated) {
+ bool result = v8::internal::SetPermissions(buffer, allocated,
+ v8::PageAllocator::kReadExecute);
+ CHECK(result);
+
+ // Flush the instruction cache as part of making the buffer executable.
+ Assembler::FlushICache(buffer, allocated);
+}
+
+static inline void MakeAssemblerBufferWritable(uint8_t* buffer,
+ size_t allocated) {
+ bool result = v8::internal::SetPermissions(buffer, allocated,
+ v8::PageAllocator::kReadWrite);
+ CHECK(result);
+}
+
+} // namespace internal
+} // namespace v8
+
+#endif // V8_TEST_COMMON_ASSEMBLER_TESTER_H_
diff --git a/deps/v8/test/common/wasm/wasm-macro-gen.h b/deps/v8/test/common/wasm/wasm-macro-gen.h
index a42c96dd24..1015701e3b 100644
--- a/deps/v8/test/common/wasm/wasm-macro-gen.h
+++ b/deps/v8/test/common/wasm/wasm-macro-gen.h
@@ -591,10 +591,12 @@ inline WasmOpcode LoadStoreOpcodeOf(MachineType type, bool store) {
#define SIG_ENTRY_x(r) kWasmFunctionTypeCode, 0, 1, r
#define SIG_ENTRY_x_x(r, a) kWasmFunctionTypeCode, 1, a, 1, r
#define SIG_ENTRY_x_xx(r, a, b) kWasmFunctionTypeCode, 2, a, b, 1, r
+#define SIG_ENTRY_xx_xx(r, s, a, b) kWasmFunctionTypeCode, 2, a, b, 2, r, s
#define SIG_ENTRY_x_xxx(r, a, b, c) kWasmFunctionTypeCode, 3, a, b, c, 1, r
#define SIZEOF_SIG_ENTRY_x 4
#define SIZEOF_SIG_ENTRY_x_x 5
#define SIZEOF_SIG_ENTRY_x_xx 6
+#define SIZEOF_SIG_ENTRY_xx_xx 7
#define SIZEOF_SIG_ENTRY_x_xxx 7
#define WASM_BRV(depth, ...) __VA_ARGS__, kExprBr, static_cast<byte>(depth)
diff --git a/deps/v8/test/common/wasm/wasm-module-runner.cc b/deps/v8/test/common/wasm/wasm-module-runner.cc
index d091aa5cd2..9dfbe6fe1a 100644
--- a/deps/v8/test/common/wasm/wasm-module-runner.cc
+++ b/deps/v8/test/common/wasm/wasm-module-runner.cc
@@ -28,8 +28,9 @@ uint32_t GetInitialMemSize(const WasmModule* module) {
MaybeHandle<WasmInstanceObject> CompileAndInstantiateForTesting(
Isolate* isolate, ErrorThrower* thrower, const ModuleWireBytes& bytes) {
- MaybeHandle<WasmModuleObject> module =
- isolate->wasm_engine()->SyncCompile(isolate, thrower, bytes);
+ auto enabled_features = WasmFeaturesFromIsolate(isolate);
+ MaybeHandle<WasmModuleObject> module = isolate->wasm_engine()->SyncCompile(
+ isolate, enabled_features, thrower, bytes);
DCHECK_EQ(thrower->error(), module.is_null());
if (module.is_null()) return {};
@@ -42,8 +43,10 @@ std::shared_ptr<WasmModule> DecodeWasmModuleForTesting(
const byte* module_end, ModuleOrigin origin, bool verify_functions) {
// Decode the module, but don't verify function bodies, since we'll
// be compiling them anyway.
- ModuleResult decoding_result = SyncDecodeWasmModule(
- isolate, module_start, module_end, verify_functions, origin);
+ auto enabled_features = WasmFeaturesFromIsolate(isolate);
+ ModuleResult decoding_result = DecodeWasmModule(
+ enabled_features, module_start, module_end, verify_functions, origin,
+ isolate->counters(), isolate->allocator());
if (decoding_result.failed()) {
// Module verification failed. throw.
diff --git a/deps/v8/test/debugger/debug/debug-liveedit-arrow-function-at-start.js b/deps/v8/test/debugger/debug/debug-liveedit-arrow-function-at-start.js
new file mode 100644
index 0000000000..ce0fe39ad0
--- /dev/null
+++ b/deps/v8/test/debugger/debug/debug-liveedit-arrow-function-at-start.js
@@ -0,0 +1,13 @@
+// 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: --allow-natives-syntax
+
+// ()=>42 will have the same start and end position as the top-level script.
+var foo = eval("()=>{ return 42 }");
+assertEquals(42, foo());
+
+%LiveEditPatchScript(foo, "()=>{ return 13 }");
+
+assertEquals(13, foo());
diff --git a/deps/v8/test/debugger/debug/wasm/frame-inspection.js b/deps/v8/test/debugger/debug/wasm/frame-inspection.js
index 45fa8a96f4..b91a466a10 100644
--- a/deps/v8/test/debugger/debug/wasm/frame-inspection.js
+++ b/deps/v8/test/debugger/debug/wasm/frame-inspection.js
@@ -25,7 +25,6 @@ function listener(event, exec_state, event_data, data) {
if (event != Debug.DebugEvent.Break) return;
++break_count;
try {
- var break_id = exec_state.break_id;
var frame_count = exec_state.frameCount();
assertEquals(expected_frames.length, frame_count, 'frame count');
diff --git a/deps/v8/test/debugger/debugger.status b/deps/v8/test/debugger/debugger.status
index ab4ed47366..8500344fb5 100644
--- a/deps/v8/test/debugger/debugger.status
+++ b/deps/v8/test/debugger/debugger.status
@@ -18,8 +18,9 @@
'debug/es6/debug-promises/reject-with-invalid-reject': [FAIL],
# Issue 5651: Context mismatch in ScopeIterator::Type() for eval default
- # parameter value
- 'debug/es6/debug-scope-default-param-with-eval': [FAIL],
+ # parameter value (the test causes indexing a FixedArray out of bounds ->
+ # CRASH is also a reasonable outcome).
+ 'debug/es6/debug-scope-default-param-with-eval': [FAIL, CRASH],
# Slow tests
'debug/debug-scopes': [PASS, SLOW],
diff --git a/deps/v8/test/fuzzer/multi-return.cc b/deps/v8/test/fuzzer/multi-return.cc
index 4f109228a5..0be812c8dd 100644
--- a/deps/v8/test/fuzzer/multi-return.cc
+++ b/deps/v8/test/fuzzer/multi-return.cc
@@ -19,6 +19,7 @@
#include "src/optimized-compilation-info.h"
#include "src/simulator.h"
#include "src/wasm/wasm-engine.h"
+#include "src/wasm/wasm-features.h"
#include "src/wasm/wasm-limits.h"
#include "src/wasm/wasm-objects-inl.h"
#include "src/wasm/wasm-objects.h"
@@ -160,7 +161,8 @@ std::unique_ptr<wasm::NativeModule> AllocateNativeModule(i::Isolate* isolate,
// WasmCallDescriptor assumes that code is on the native heap and not
// within a code object.
return isolate->wasm_engine()->code_manager()->NewNativeModule(
- isolate, code_size, false, std::move(module), env);
+ isolate, i::wasm::kAllWasmFeatures, code_size, false, std::move(module),
+ env);
}
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
@@ -306,6 +308,7 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
&wrapper_info, i_isolate, wrapper_desc, caller.graph(),
AssemblerOptions::Default(i_isolate), caller.Export())
.ToHandleChecked();
+
auto fn = GeneratedCode<int32_t>::FromCode(*wrapper_code);
int result = fn.Call();
diff --git a/deps/v8/test/fuzzer/regexp-builtins.cc b/deps/v8/test/fuzzer/regexp-builtins.cc
index 495604b071..c4ff115d72 100644
--- a/deps/v8/test/fuzzer/regexp-builtins.cc
+++ b/deps/v8/test/fuzzer/regexp-builtins.cc
@@ -319,12 +319,12 @@ std::string GenerateSourceString(FuzzerArgs* args, const std::string& test) {
return ss.str();
}
-void PrintExceptionMessage(v8::TryCatch* try_catch) {
+void PrintExceptionMessage(v8::Isolate* isolate, v8::TryCatch* try_catch) {
CHECK(try_catch->HasCaught());
static const int kBufferLength = 256;
char buffer[kBufferLength + 1];
try_catch->Message()->Get()->WriteOneByte(
- reinterpret_cast<uint8_t*>(&buffer[0]), 0, kBufferLength);
+ isolate, reinterpret_cast<uint8_t*>(&buffer[0]), 0, kBufferLength);
fprintf(stderr, "%s\n", buffer);
}
@@ -337,9 +337,10 @@ bool ResultsAreIdentical(FuzzerArgs* args) {
"assertEquals(fast.re.lastIndex, slow.re.lastIndex);\n";
v8::Local<v8::Value> result;
- v8::TryCatch try_catch(reinterpret_cast<v8::Isolate*>(args->isolate));
+ v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(args->isolate);
+ v8::TryCatch try_catch(isolate);
if (!CompileRun(args->context, source.c_str()).ToLocal(&result)) {
- PrintExceptionMessage(&try_catch);
+ PrintExceptionMessage(isolate, &try_catch);
args->isolate->clear_pending_exception();
return false;
}
@@ -349,14 +350,15 @@ bool ResultsAreIdentical(FuzzerArgs* args) {
void CompileRunAndVerify(FuzzerArgs* args, const std::string& source) {
v8::Local<v8::Value> result;
- v8::TryCatch try_catch(reinterpret_cast<v8::Isolate*>(args->isolate));
+ v8::Isolate* isolate = reinterpret_cast<v8::Isolate*>(args->isolate);
+ v8::TryCatch try_catch(isolate);
if (!CompileRun(args->context, source.c_str()).ToLocal(&result)) {
args->isolate->clear_pending_exception();
// No need to verify result if an exception was thrown here, since that
// implies a syntax error somewhere in the pattern or string. We simply
// ignore those.
if (kVerbose) {
- PrintExceptionMessage(&try_catch);
+ PrintExceptionMessage(isolate, &try_catch);
fprintf(stderr, "Failed to run script:\n```\n%s\n```\n", source.c_str());
}
return;
diff --git a/deps/v8/test/fuzzer/wasm-async.cc b/deps/v8/test/fuzzer/wasm-async.cc
index 5ceb8d8bf8..8e140b71f2 100644
--- a/deps/v8/test/fuzzer/wasm-async.cc
+++ b/deps/v8/test/fuzzer/wasm-async.cc
@@ -68,8 +68,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
testing::SetupIsolateForWasmModule(i_isolate);
bool done = false;
+ auto enabled_features = i::wasm::WasmFeaturesFromIsolate(i_isolate);
i_isolate->wasm_engine()->AsyncCompile(
- i_isolate, base::make_unique<AsyncFuzzerResolver>(i_isolate, &done),
+ i_isolate, enabled_features,
+ std::make_shared<AsyncFuzzerResolver>(i_isolate, &done),
ModuleWireBytes(data, data + size), false);
// Wait for the promise to resolve.
diff --git a/deps/v8/test/fuzzer/wasm-compile.cc b/deps/v8/test/fuzzer/wasm-compile.cc
index 93c03a92db..a9f4382cd1 100644
--- a/deps/v8/test/fuzzer/wasm-compile.cc
+++ b/deps/v8/test/fuzzer/wasm-compile.cc
@@ -43,8 +43,10 @@ class DataRange {
// lead to OOM because the end might not be reached.
// Define move constructor and move assignment, disallow copy constructor and
// copy assignment (below).
- DataRange(DataRange&& other) : DataRange(other.data_) { other.data_ = {}; }
- DataRange& operator=(DataRange&& other) {
+ DataRange(DataRange&& other) V8_NOEXCEPT : DataRange(other.data_) {
+ other.data_ = {};
+ }
+ DataRange& operator=(DataRange&& other) V8_NOEXCEPT {
data_ = other.data_;
other.data_ = {};
return *this;
@@ -380,9 +382,9 @@ class WasmGenerator {
void set_global(DataRange& data) { global_op<kWasmStmt>(data); }
- template <ValueType T1, ValueType T2>
+ template <ValueType... Types>
void sequence(DataRange& data) {
- Generate<T1, T2>(data);
+ Generate<Types...>(data);
}
void current_memory(DataRange& data) {
@@ -472,6 +474,9 @@ void WasmGenerator::Generate<kWasmStmt>(DataRange& data) {
constexpr generate_fn alternates[] = {
&WasmGenerator::sequence<kWasmStmt, kWasmStmt>,
+ &WasmGenerator::sequence<kWasmStmt, kWasmStmt, kWasmStmt, kWasmStmt>,
+ &WasmGenerator::sequence<kWasmStmt, kWasmStmt, kWasmStmt, kWasmStmt,
+ kWasmStmt, kWasmStmt, kWasmStmt, kWasmStmt>,
&WasmGenerator::block<kWasmStmt>,
&WasmGenerator::loop<kWasmStmt>,
&WasmGenerator::if_<kWasmStmt, kIf>,
@@ -508,7 +513,9 @@ void WasmGenerator::Generate<kWasmI32>(DataRange& data) {
}
constexpr generate_fn alternates[] = {
+ &WasmGenerator::sequence<kWasmI32, kWasmStmt>,
&WasmGenerator::sequence<kWasmStmt, kWasmI32>,
+ &WasmGenerator::sequence<kWasmStmt, kWasmI32, kWasmStmt>,
&WasmGenerator::op<kExprI32Eqz, kWasmI32>,
&WasmGenerator::op<kExprI32Eq, kWasmI32, kWasmI32>,
@@ -597,7 +604,9 @@ void WasmGenerator::Generate<kWasmI64>(DataRange& data) {
}
constexpr generate_fn alternates[] = {
+ &WasmGenerator::sequence<kWasmI64, kWasmStmt>,
&WasmGenerator::sequence<kWasmStmt, kWasmI64>,
+ &WasmGenerator::sequence<kWasmStmt, kWasmI64, kWasmStmt>,
&WasmGenerator::op<kExprI64Add, kWasmI64, kWasmI64>,
&WasmGenerator::op<kExprI64Sub, kWasmI64, kWasmI64>,
@@ -652,7 +661,9 @@ void WasmGenerator::Generate<kWasmF32>(DataRange& data) {
}
constexpr generate_fn alternates[] = {
+ &WasmGenerator::sequence<kWasmF32, kWasmStmt>,
&WasmGenerator::sequence<kWasmStmt, kWasmF32>,
+ &WasmGenerator::sequence<kWasmStmt, kWasmF32, kWasmStmt>,
&WasmGenerator::op<kExprF32Add, kWasmF32, kWasmF32>,
&WasmGenerator::op<kExprF32Sub, kWasmF32, kWasmF32>,
@@ -683,7 +694,9 @@ void WasmGenerator::Generate<kWasmF64>(DataRange& data) {
}
constexpr generate_fn alternates[] = {
+ &WasmGenerator::sequence<kWasmF64, kWasmStmt>,
&WasmGenerator::sequence<kWasmStmt, kWasmF64>,
+ &WasmGenerator::sequence<kWasmStmt, kWasmF64, kWasmStmt>,
&WasmGenerator::op<kExprF64Add, kWasmF64, kWasmF64>,
&WasmGenerator::op<kExprF64Sub, kWasmF64, kWasmF64>,
diff --git a/deps/v8/test/fuzzer/wasm-fuzzer-common.cc b/deps/v8/test/fuzzer/wasm-fuzzer-common.cc
index f84e700fc9..c253da9cb5 100644
--- a/deps/v8/test/fuzzer/wasm-fuzzer-common.cc
+++ b/deps/v8/test/fuzzer/wasm-fuzzer-common.cc
@@ -10,7 +10,7 @@
#include "src/wasm/wasm-engine.h"
#include "src/wasm/wasm-module-builder.h"
#include "src/wasm/wasm-module.h"
-#include "src/wasm/wasm-objects.h"
+#include "src/wasm/wasm-objects-inl.h"
#include "src/zone/accounting-allocator.h"
#include "src/zone/zone.h"
#include "test/common/wasm/flag-utils.h"
@@ -153,9 +153,10 @@ std::ostream& operator<<(std::ostream& os, const PrintName& name) {
void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes,
bool compiles) {
constexpr bool kVerifyFunctions = false;
- ModuleResult module_res =
- SyncDecodeWasmModule(isolate, wire_bytes.start(), wire_bytes.end(),
- kVerifyFunctions, ModuleOrigin::kWasmOrigin);
+ auto enabled_features = i::wasm::WasmFeaturesFromIsolate(isolate);
+ ModuleResult module_res = DecodeWasmModule(
+ enabled_features, wire_bytes.start(), wire_bytes.end(), kVerifyFunctions,
+ ModuleOrigin::kWasmOrigin, isolate->counters(), isolate->allocator());
CHECK(module_res.ok());
WasmModule* module = module_res.val.get();
CHECK_NOT_NULL(module);
@@ -181,7 +182,7 @@ void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes,
os << ", undefined";
}
os << ", " << (module->mem_export ? "true" : "false");
- if (FLAG_experimental_wasm_threads && module->has_shared_memory) {
+ if (module->has_shared_memory) {
os << ", shared";
}
os << ");\n";
@@ -208,7 +209,8 @@ void GenerateTestCase(Isolate* isolate, ModuleWireBytes wire_bytes,
// Add locals.
BodyLocalDecls decls(&tmp_zone);
- DecodeLocalDecls(&decls, func_code.start(), func_code.end());
+ DecodeLocalDecls(enabled_features, &decls, func_code.start(),
+ func_code.end());
if (!decls.type_list.empty()) {
os << " ";
for (size_t pos = 0, count = 1, locals = decls.type_list.size();
@@ -284,6 +286,7 @@ int WasmExecutionFuzzer::FuzzWasmModule(Vector<const uint8_t> data,
ModuleWireBytes wire_bytes(buffer.begin(), buffer.end());
// Compile with Turbofan here. Liftoff will be tested later.
+ auto enabled_features = i::wasm::WasmFeaturesFromIsolate(i_isolate);
MaybeHandle<WasmModuleObject> compiled_module;
{
// Explicitly enable Liftoff, disable tiering and set the tier_mask. This
@@ -292,7 +295,7 @@ int WasmExecutionFuzzer::FuzzWasmModule(Vector<const uint8_t> data,
FlagScope<bool> no_tier_up(&FLAG_wasm_tier_up, false);
FlagScope<int> tier_mask_scope(&FLAG_wasm_tier_mask_for_testing, tier_mask);
compiled_module = i_isolate->wasm_engine()->SyncCompile(
- i_isolate, &interpreter_thrower, wire_bytes);
+ i_isolate, enabled_features, &interpreter_thrower, wire_bytes);
}
bool compiles = !compiled_module.is_null();
@@ -300,8 +303,8 @@ int WasmExecutionFuzzer::FuzzWasmModule(Vector<const uint8_t> data,
GenerateTestCase(i_isolate, wire_bytes, compiles);
}
- bool validates =
- i_isolate->wasm_engine()->SyncValidate(i_isolate, wire_bytes);
+ bool validates = i_isolate->wasm_engine()->SyncValidate(
+ i_isolate, enabled_features, wire_bytes);
CHECK_EQ(compiles, validates);
CHECK_IMPLIES(require_valid, validates);
@@ -332,6 +335,16 @@ int WasmExecutionFuzzer::FuzzWasmModule(Vector<const uint8_t> data,
return 0;
}
+ // The WebAssembly spec allows the sign bit of NaN to be non-deterministic.
+ // This sign bit can make the difference between an infinite loop and
+ // terminating code. With possible non-determinism we cannot guarantee that
+ // the generated code will not go into an infinite loop and cause a timeout in
+ // Clusterfuzz. Therefore we do not execute the generated code if the result
+ // may be non-deterministic.
+ if (possible_nondeterminism) {
+ return 0;
+ }
+
bool expect_exception =
result_interpreter == static_cast<int32_t>(0xDEADBEEF);
@@ -349,20 +362,14 @@ int WasmExecutionFuzzer::FuzzWasmModule(Vector<const uint8_t> data,
"main", num_args, compiler_args.get());
}
- // The WebAssembly spec allows the sign bit of NaN to be non-deterministic.
- // This sign bit may cause result_interpreter to be different than
- // result_compiled. Therefore we do not check the equality of the results
- // if the execution may have produced a NaN at some point.
- if (!possible_nondeterminism) {
- if (expect_exception != i_isolate->has_pending_exception()) {
- const char* exception_text[] = {"no exception", "exception"};
- FATAL("interpreter: %s; compiled: %s", exception_text[expect_exception],
- exception_text[i_isolate->has_pending_exception()]);
- }
-
- if (!expect_exception) CHECK_EQ(result_interpreter, result_compiled);
+ if (expect_exception != i_isolate->has_pending_exception()) {
+ const char* exception_text[] = {"no exception", "exception"};
+ FATAL("interpreter: %s; compiled: %s", exception_text[expect_exception],
+ exception_text[i_isolate->has_pending_exception()]);
}
+ if (!expect_exception) CHECK_EQ(result_interpreter, result_compiled);
+
// Cleanup any pending exception.
i_isolate->clear_pending_exception();
return 0;
diff --git a/deps/v8/test/fuzzer/wasm.cc b/deps/v8/test/fuzzer/wasm.cc
index 75a6dd9865..fb9135b0f1 100644
--- a/deps/v8/test/fuzzer/wasm.cc
+++ b/deps/v8/test/fuzzer/wasm.cc
@@ -42,9 +42,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
i::HandleScope scope(i_isolate);
i::wasm::ErrorThrower thrower(i_isolate, "wasm fuzzer");
i::Handle<i::WasmModuleObject> module_object;
- bool compiles = i_isolate->wasm_engine()
- ->SyncCompile(i_isolate, &thrower, wire_bytes)
- .ToHandle(&module_object);
+ auto enabled_features = i::wasm::WasmFeaturesFromIsolate(i_isolate);
+ bool compiles =
+ i_isolate->wasm_engine()
+ ->SyncCompile(i_isolate, enabled_features, &thrower, wire_bytes)
+ .ToHandle(&module_object);
if (i::FLAG_wasm_fuzzer_gen_test) {
i::wasm::fuzzer::GenerateTestCase(i_isolate, wire_bytes, compiles);
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 9173fe7e70..a24ba5c370 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
@@ -30,6 +30,11 @@ expression: Object(Symbol(42))
description : Symbol
overflow : false
properties : [
+ [0] : {
+ name : description
+ type : string
+ value : 42
+ }
]
type : object
}
diff --git a/deps/v8/test/inspector/debugger/resource-name-to-url-expected.txt b/deps/v8/test/inspector/debugger/resource-name-to-url-expected.txt
index 0ecd0b82ef..2e6e589b25 100644
--- a/deps/v8/test/inspector/debugger/resource-name-to-url-expected.txt
+++ b/deps/v8/test/inspector/debugger/resource-name-to-url-expected.txt
@@ -12,7 +12,7 @@ Check script with url:
isModule : false
length : 16
scriptId : <scriptId>
- sourceMapURL :
+ sourceMapURL :
startColumn : 0
startLine : 0
url : prefix://url
@@ -31,7 +31,7 @@ Check script with sourceURL comment:
isModule : false
length : 37
scriptId : <scriptId>
- sourceMapURL :
+ sourceMapURL :
startColumn : 0
startLine : 0
url : foo.js
@@ -49,7 +49,7 @@ Check script failed to parse:
isModule : false
length : 15
scriptId : <scriptId>
- sourceMapURL :
+ sourceMapURL :
startColumn : 0
startLine : 0
url : prefix://url
@@ -67,7 +67,7 @@ Check script failed to parse with sourceURL comment:
isModule : false
length : 36
scriptId : <scriptId>
- sourceMapURL :
+ sourceMapURL :
startColumn : 0
startLine : 0
url : foo.js
@@ -96,14 +96,14 @@ Test runtime stack trace:
}
[1] : {
columnNumber : 0
- functionName :
+ functionName :
lineNumber : 0
scriptId : <scriptId>
url : boo.js
}
[2] : {
columnNumber : 4
- functionName :
+ functionName :
lineNumber : 4
scriptId : <scriptId>
url : prefix://url
diff --git a/deps/v8/test/inspector/inspector-test.cc b/deps/v8/test/inspector/inspector-test.cc
index 93a8b1d3f2..dbb4493e66 100644
--- a/deps/v8/test/inspector/inspector-test.cc
+++ b/deps/v8/test/inspector/inspector-test.cc
@@ -7,6 +7,8 @@
#endif // !defined(_WIN32) && !defined(_WIN64)
#include <locale.h>
+#include <string>
+#include <vector>
#include "include/libplatform/libplatform.h"
#include "include/v8.h"
@@ -38,10 +40,10 @@ void Exit() {
Terminate();
}
-v8::internal::Vector<uint16_t> ToVector(v8::Local<v8::String> str) {
- v8::internal::Vector<uint16_t> buffer =
- v8::internal::Vector<uint16_t>::New(str->Length());
- str->Write(buffer.start(), 0, str->Length());
+std::vector<uint16_t> ToVector(v8::Isolate* isolate,
+ v8::Local<v8::String> str) {
+ std::vector<uint16_t> buffer(str->Length());
+ str->Write(isolate, buffer.data(), 0, str->Length());
return buffer;
}
@@ -50,24 +52,24 @@ v8::Local<v8::String> ToV8String(v8::Isolate* isolate, const char* str) {
.ToLocalChecked();
}
-v8::Local<v8::String> ToV8String(v8::Isolate* isolate, const char* str,
- int length) {
- return v8::String::NewFromUtf8(isolate, str, v8::NewStringType::kNormal,
- length)
+v8::Local<v8::String> ToV8String(v8::Isolate* isolate,
+ const std::string& buffer) {
+ int length = static_cast<int>(buffer.size());
+ return v8::String::NewFromUtf8(isolate, buffer.data(),
+ v8::NewStringType::kNormal, length)
.ToLocalChecked();
}
v8::Local<v8::String> ToV8String(v8::Isolate* isolate,
- const v8::internal::Vector<uint16_t>& buffer) {
- return v8::String::NewFromTwoByte(isolate, buffer.start(),
- v8::NewStringType::kNormal, buffer.length())
+ const std::vector<uint16_t>& buffer) {
+ int length = static_cast<int>(buffer.size());
+ return v8::String::NewFromTwoByte(isolate, buffer.data(),
+ v8::NewStringType::kNormal, length)
.ToLocalChecked();
}
-v8::internal::Vector<uint16_t> ToVector(
- const v8_inspector::StringView& string) {
- v8::internal::Vector<uint16_t> buffer =
- v8::internal::Vector<uint16_t>::New(static_cast<int>(string.length()));
+std::vector<uint16_t> ToVector(const v8_inspector::StringView& string) {
+ std::vector<uint16_t> buffer(string.length());
for (size_t i = 0; i < string.length(); i++) {
if (string.is8Bit())
buffer[i] = string.characters8()[i];
@@ -105,7 +107,7 @@ class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel {
class SendMessageTask : public TaskRunner::Task {
public:
SendMessageTask(FrontendChannelImpl* channel,
- const v8::internal::Vector<uint16_t>& message)
+ const std::vector<uint16_t>& message)
: channel_(channel), message_(message) {}
virtual ~SendMessageTask() {}
bool is_priority_task() final { return false; }
@@ -124,7 +126,7 @@ class FrontendChannelImpl : public v8_inspector::V8Inspector::Channel {
->Call(context, context->Global(), 1, &message);
}
FrontendChannelImpl* channel_;
- v8::internal::Vector<uint16_t> message_;
+ std::vector<uint16_t> message_;
};
TaskRunner* task_runner_;
@@ -160,19 +162,18 @@ void RunSyncTask(TaskRunner* task_runner, T callback) {
class SendMessageToBackendTask : public TaskRunner::Task {
public:
- SendMessageToBackendTask(int session_id,
- const v8::internal::Vector<uint16_t>& message)
+ SendMessageToBackendTask(int session_id, const std::vector<uint16_t>& message)
: session_id_(session_id), message_(message) {}
bool is_priority_task() final { return true; }
private:
void Run(IsolateData* data) override {
- v8_inspector::StringView message_view(message_.start(), message_.length());
+ v8_inspector::StringView message_view(message_.data(), message_.size());
data->SendMessage(session_id_, message_view);
}
int session_id_;
- v8::internal::Vector<uint16_t> message_;
+ std::vector<uint16_t> message_;
};
void RunAsyncTask(TaskRunner* task_runner,
@@ -200,21 +201,23 @@ void RunAsyncTask(TaskRunner* task_runner,
class ExecuteStringTask : public TaskRunner::Task {
public:
- ExecuteStringTask(int context_group_id,
- const v8::internal::Vector<uint16_t>& expression,
+ ExecuteStringTask(v8::Isolate* isolate, int context_group_id,
+ const std::vector<uint16_t>& expression,
v8::Local<v8::String> name,
v8::Local<v8::Integer> line_offset,
v8::Local<v8::Integer> column_offset,
v8::Local<v8::Boolean> is_module)
: expression_(expression),
- name_(ToVector(name)),
+ name_(ToVector(isolate, name)),
line_offset_(line_offset.As<v8::Int32>()->Value()),
column_offset_(column_offset.As<v8::Int32>()->Value()),
is_module_(is_module->Value()),
context_group_id_(context_group_id) {}
- ExecuteStringTask(const v8::internal::Vector<const char>& expression,
- int context_group_id)
+ ExecuteStringTask(const std::string& expression, int context_group_id)
: expression_utf8_(expression), context_group_id_(context_group_id) {}
+
+ virtual ~ExecuteStringTask() {
+ }
bool is_priority_task() override { return false; }
void Run(IsolateData* data) override {
v8::MicrotasksScope microtasks_scope(data->isolate(),
@@ -233,11 +236,10 @@ class ExecuteStringTask : public TaskRunner::Task {
/* is_wasm */ v8::Local<v8::Boolean>(),
v8::Boolean::New(data->isolate(), is_module_));
v8::Local<v8::String> source;
- if (expression_.length())
+ if (expression_.size() != 0)
source = ToV8String(data->isolate(), expression_);
else
- source = ToV8String(data->isolate(), expression_utf8_.start(),
- expression_utf8_.length());
+ source = ToV8String(data->isolate(), expression_utf8_);
v8::ScriptCompiler::Source scriptSource(source, origin);
v8::Isolate::SafeForTerminationScope allowTermination(data->isolate());
@@ -248,14 +250,19 @@ class ExecuteStringTask : public TaskRunner::Task {
v8::MaybeLocal<v8::Value> result;
result = script->Run(context);
} else {
- data->RegisterModule(context, name_, &scriptSource);
+ // Register Module takes ownership of {buffer}, so we need to make a copy.
+ int length = static_cast<int>(name_.size());
+ v8::internal::Vector<uint16_t> buffer =
+ v8::internal::Vector<uint16_t>::New(length);
+ std::copy(name_.begin(), name_.end(), buffer.start());
+ data->RegisterModule(context, buffer, &scriptSource);
}
}
private:
- v8::internal::Vector<uint16_t> expression_;
- v8::internal::Vector<const char> expression_utf8_;
- v8::internal::Vector<uint16_t> name_;
+ std::vector<uint16_t> expression_;
+ std::string expression_utf8_;
+ std::vector<uint16_t> name_;
int32_t line_offset_ = 0;
int32_t column_offset_ = 0;
bool is_module_ = false;
@@ -372,7 +379,7 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
}
static bool ReadFile(v8::Isolate* isolate, v8::Local<v8::Value> name,
- v8::internal::Vector<const char>* chars) {
+ std::string* chars) {
v8::String::Utf8Value str(isolate, name);
bool exists = false;
std::string filename(*str, str.length());
@@ -389,10 +396,11 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
fprintf(stderr, "Internal error: read gets one string argument.");
Exit();
}
- v8::internal::Vector<const char> chars;
+ std::string chars;
v8::Isolate* isolate = args.GetIsolate();
- if (ReadFile(isolate, args[0], &chars))
- args.GetReturnValue().Set(ToV8String(isolate, chars.start()));
+ if (ReadFile(isolate, args[0], &chars)) {
+ args.GetReturnValue().Set(ToV8String(isolate, chars));
+ }
}
static void Load(const v8::FunctionCallbackInfo<v8::Value>& args) {
@@ -400,7 +408,7 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
fprintf(stderr, "Internal error: load gets one string argument.");
Exit();
}
- v8::internal::Vector<const char> chars;
+ std::string chars;
v8::Isolate* isolate = args.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
IsolateData* data = IsolateData::FromContext(context);
@@ -423,7 +431,8 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
}
backend_runner_->Append(new ExecuteStringTask(
- args[0].As<v8::Int32>()->Value(), ToVector(args[1].As<v8::String>()),
+ args.GetIsolate(), args[0].As<v8::Int32>()->Value(),
+ ToVector(args.GetIsolate(), args[1].As<v8::String>()),
args[2].As<v8::String>(), args[3].As<v8::Int32>(),
args[4].As<v8::Int32>(), args[5].As<v8::Boolean>()));
}
@@ -456,16 +465,18 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
"'reason', 'details').");
Exit();
}
- v8::internal::Vector<uint16_t> reason = ToVector(args[1].As<v8::String>());
- v8::internal::Vector<uint16_t> details = ToVector(args[2].As<v8::String>());
+ std::vector<uint16_t> reason =
+ ToVector(args.GetIsolate(), args[1].As<v8::String>());
+ std::vector<uint16_t> details =
+ ToVector(args.GetIsolate(), args[2].As<v8::String>());
int context_group_id = args[0].As<v8::Int32>()->Value();
- RunSyncTask(backend_runner_, [&context_group_id, &reason,
- &details](IsolateData* data) {
- data->SchedulePauseOnNextStatement(
- context_group_id,
- v8_inspector::StringView(reason.start(), reason.length()),
- v8_inspector::StringView(details.start(), details.length()));
- });
+ RunSyncTask(backend_runner_,
+ [&context_group_id, &reason, &details](IsolateData* data) {
+ data->SchedulePauseOnNextStatement(
+ context_group_id,
+ v8_inspector::StringView(reason.data(), reason.size()),
+ v8_inspector::StringView(details.data(), details.size()));
+ });
}
static void CancelPauseOnNextStatement(
@@ -530,14 +541,15 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
IsolateData::FromContext(context)->GetContextGroupId(context),
args.GetIsolate(), args[2].As<v8::Function>());
- v8::internal::Vector<uint16_t> state = ToVector(args[1].As<v8::String>());
+ std::vector<uint16_t> state =
+ ToVector(args.GetIsolate(), args[1].As<v8::String>());
int context_group_id = args[0].As<v8::Int32>()->Value();
int session_id = 0;
RunSyncTask(backend_runner_, [&context_group_id, &session_id, &channel,
&state](IsolateData* data) {
session_id = data->ConnectSession(
context_group_id,
- v8_inspector::StringView(state.start(), state.length()), channel);
+ v8_inspector::StringView(state.data(), state.size()), channel);
channel->set_session_id(session_id);
});
@@ -552,7 +564,7 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
Exit();
}
int session_id = args[0].As<v8::Int32>()->Value();
- v8::internal::Vector<uint16_t> state;
+ std::vector<uint16_t> state;
RunSyncTask(backend_runner_, [&session_id, &state](IsolateData* data) {
state = ToVector(data->DisconnectSession(session_id)->string());
});
@@ -568,7 +580,8 @@ class UtilsExtension : public IsolateData::SetupGlobalTask {
Exit();
}
backend_runner_->Append(new SendMessageToBackendTask(
- args[0].As<v8::Int32>()->Value(), ToVector(args[1].As<v8::String>())));
+ args[0].As<v8::Int32>()->Value(),
+ ToVector(args.GetIsolate(), args[1].As<v8::String>())));
}
static std::map<int, std::unique_ptr<FrontendChannelImpl>> channels_;
@@ -636,7 +649,8 @@ class SetTimeoutExtension : public IsolateData::SetupGlobalTask {
RunAsyncTask(
data->task_runner(), task_name_view,
new ExecuteStringTask(
- context_group_id, ToVector(args[0].As<v8::String>()),
+ isolate, context_group_id,
+ ToVector(isolate, args[0].As<v8::String>()),
v8::String::Empty(isolate), v8::Integer::New(isolate, 0),
v8::Integer::New(isolate, 0), v8::Boolean::New(isolate, false)));
}
@@ -778,10 +792,12 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
}
v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
IsolateData* data = IsolateData::FromContext(context);
- v8::internal::Vector<uint16_t> reason = ToVector(args[0].As<v8::String>());
- v8_inspector::StringView reason_view(reason.start(), reason.length());
- v8::internal::Vector<uint16_t> details = ToVector(args[1].As<v8::String>());
- v8_inspector::StringView details_view(details.start(), details.length());
+ std::vector<uint16_t> reason =
+ ToVector(args.GetIsolate(), args[0].As<v8::String>());
+ v8_inspector::StringView reason_view(reason.data(), reason.size());
+ std::vector<uint16_t> details =
+ ToVector(args.GetIsolate(), args[1].As<v8::String>());
+ v8_inspector::StringView details_view(details.data(), details.size());
data->BreakProgram(data->GetContextGroupId(context), reason_view,
details_view);
}
@@ -808,10 +824,12 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
"Internal error: callWithScheduledBreak('reason', 'details').");
Exit();
}
- v8::internal::Vector<uint16_t> reason = ToVector(args[1].As<v8::String>());
- v8_inspector::StringView reason_view(reason.start(), reason.length());
- v8::internal::Vector<uint16_t> details = ToVector(args[2].As<v8::String>());
- v8_inspector::StringView details_view(details.start(), details.length());
+ std::vector<uint16_t> reason =
+ ToVector(args.GetIsolate(), args[1].As<v8::String>());
+ v8_inspector::StringView reason_view(reason.data(), reason.size());
+ std::vector<uint16_t> details =
+ ToVector(args.GetIsolate(), args[2].As<v8::String>());
+ v8_inspector::StringView details_view(details.data(), details.size());
v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext();
IsolateData* data = IsolateData::FromContext(context);
int context_group_id = data->GetContextGroupId(context);
@@ -898,10 +916,10 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
v8::Isolate* isolate = args.GetIsolate();
v8::Local<v8::Context> context = isolate->GetCurrentContext();
IsolateData* data = IsolateData::FromContext(context);
- v8::internal::Vector<uint16_t> description =
- ToVector(args[0].As<v8::String>());
- v8_inspector::StringView description_view(description.start(),
- description.length());
+ std::vector<uint16_t> description =
+ ToVector(isolate, args[0].As<v8::String>());
+ v8_inspector::StringView description_view(description.data(),
+ description.size());
v8_inspector::V8StackTraceId id =
data->StoreCurrentStackTrace(description_view);
v8::Local<v8::ArrayBuffer> buffer =
@@ -955,10 +973,9 @@ class InspectorExtension : public IsolateData::SetupGlobalTask {
bool with_empty_stack = args[2].As<v8::Boolean>()->Value();
if (with_empty_stack) context->Exit();
- v8::internal::Vector<uint16_t> task_name =
- ToVector(args[1].As<v8::String>());
- v8_inspector::StringView task_name_view(task_name.start(),
- task_name.length());
+ std::vector<uint16_t> task_name =
+ ToVector(isolate, args[1].As<v8::String>());
+ v8_inspector::StringView task_name_view(task_name.data(), task_name.size());
RunAsyncTask(data->task_runner(), task_name_view,
new SetTimeoutTask(context_group_id, isolate,
@@ -1085,8 +1102,7 @@ int main(int argc, char* argv[]) {
if (argv[i] == nullptr || argv[i][0] == '-') continue;
bool exists = false;
- v8::internal::Vector<const char> chars =
- v8::internal::ReadFile(argv[i], &exists, true);
+ std::string chars = v8::internal::ReadFile(argv[i], &exists, true);
if (!exists) {
fprintf(stderr, "Internal error: script file doesn't exists: %s\n",
argv[i]);
diff --git a/deps/v8/test/inspector/isolate-data.cc b/deps/v8/test/inspector/isolate-data.cc
index a669cc41a1..57b9af57c2 100644
--- a/deps/v8/test/inspector/isolate-data.cc
+++ b/deps/v8/test/inspector/isolate-data.cc
@@ -12,10 +12,11 @@ namespace {
const int kIsolateDataIndex = 2;
const int kContextGroupIdIndex = 3;
-v8::internal::Vector<uint16_t> ToVector(v8::Local<v8::String> str) {
+v8::internal::Vector<uint16_t> ToVector(v8::Isolate* isolate,
+ v8::Local<v8::String> str) {
v8::internal::Vector<uint16_t> buffer =
v8::internal::Vector<uint16_t>::New(str->Length());
- str->Write(buffer.start(), 0, str->Length());
+ str->Write(isolate, buffer.start(), 0, str->Length());
return buffer;
}
@@ -137,7 +138,8 @@ v8::MaybeLocal<v8::Module> IsolateData::ModuleResolveCallback(
v8::Local<v8::Module> referrer) {
IsolateData* data = IsolateData::FromContext(context);
std::string str = *v8::String::Utf8Value(data->isolate(), specifier);
- return data->modules_[ToVector(specifier)].Get(data->isolate());
+ return data->modules_[ToVector(data->isolate(), specifier)].Get(
+ data->isolate());
}
int IsolateData::ConnectSession(int context_group_id,
@@ -249,7 +251,7 @@ int IsolateData::HandleMessage(v8::Local<v8::Message> message,
int script_id =
static_cast<int>(message->GetScriptOrigin().ScriptID()->Value());
if (!stack.IsEmpty() && stack->GetFrameCount() > 0) {
- int top_script_id = stack->GetFrame(0)->GetScriptId();
+ int top_script_id = stack->GetFrame(isolate, 0)->GetScriptId();
if (top_script_id == script_id) script_id = 0;
}
int line_number = message->GetLineNumber(context).FromMaybe(0);
@@ -258,13 +260,14 @@ int IsolateData::HandleMessage(v8::Local<v8::Message> message,
column_number = message->GetStartColumn(context).FromJust() + 1;
v8_inspector::StringView detailed_message;
- v8::internal::Vector<uint16_t> message_text_string = ToVector(message->Get());
+ v8::internal::Vector<uint16_t> message_text_string =
+ ToVector(isolate, message->Get());
v8_inspector::StringView message_text(message_text_string.start(),
message_text_string.length());
v8::internal::Vector<uint16_t> url_string;
if (message->GetScriptOrigin().ResourceName()->IsString()) {
- url_string =
- ToVector(message->GetScriptOrigin().ResourceName().As<v8::String>());
+ url_string = ToVector(
+ isolate, message->GetScriptOrigin().ResourceName().As<v8::String>());
}
v8_inspector::StringView url(url_string.start(), url_string.length());
@@ -432,7 +435,7 @@ namespace {
class StringBufferImpl : public v8_inspector::StringBuffer {
public:
StringBufferImpl(v8::Isolate* isolate, v8::Local<v8::String> string)
- : data_(ToVector(string)),
+ : data_(ToVector(isolate, string)),
view_(data_.start(), data_.length()) {}
const v8_inspector::StringView& string() override { return view_; }
@@ -449,6 +452,6 @@ std::unique_ptr<v8_inspector::StringBuffer> IsolateData::resourceNameToUrl(
v8::HandleScope handle_scope(isolate);
v8::Local<v8::String> name = ToString(isolate, resourceName);
v8::Local<v8::String> prefix = resource_name_prefix_.Get(isolate);
- v8::Local<v8::String> url = v8::String::Concat(prefix, name);
+ v8::Local<v8::String> url = v8::String::Concat(isolate, prefix, name);
return std::unique_ptr<StringBufferImpl>(new StringBufferImpl(isolate, url));
}
diff --git a/deps/v8/test/intl/collator/default-locale.js b/deps/v8/test/intl/collator/default-locale.js
index 5fc6ff4665..fd964f0620 100644
--- a/deps/v8/test/intl/collator/default-locale.js
+++ b/deps/v8/test/intl/collator/default-locale.js
@@ -48,8 +48,6 @@ var collatorBraket = new Intl.Collator({});
assertEquals(options.locale, collatorBraket.resolvedOptions().locale);
var collatorWithOptions = new Intl.Collator(undefined, {usage: 'search'});
-assertLanguageTag(%GetDefaultICULocale(),
- collatorWithOptions.resolvedOptions().locale);
-assertNotNull(
- %regexp_internal_match(/-u(-[a-zA-Z]+-[a-zA-Z]+)*-co-search/,
- collatorWithOptions.resolvedOptions().locale));
+var locale = collatorWithOptions.resolvedOptions().locale;
+assertLanguageTag(%GetDefaultICULocale(), locale);
+assertEquals(locale.indexOf('-co-search'), -1);
diff --git a/deps/v8/test/intl/collator/property-override.js b/deps/v8/test/intl/collator/property-override.js
index bed4d7773d..1e17b1e741 100644
--- a/deps/v8/test/intl/collator/property-override.js
+++ b/deps/v8/test/intl/collator/property-override.js
@@ -61,5 +61,3 @@ properties.forEach(function(prop) {
});
taintProperties(properties);
-
-var locale = Intl.Collator().resolvedOptions().locale;
diff --git a/deps/v8/test/intl/date-format/timezone.js b/deps/v8/test/intl/date-format/timezone.js
index af363711c7..57044d48d8 100644
--- a/deps/v8/test/intl/date-format/timezone.js
+++ b/deps/v8/test/intl/date-format/timezone.js
@@ -31,11 +31,15 @@
// var df = Intl.DateTimeFormat();
// assertEquals(getDefaultTimeZone(), df.resolvedOptions().timeZone);
-df = Intl.DateTimeFormat(undefined, {timeZone: 'UtC'});
-assertEquals('UTC', df.resolvedOptions().timeZone);
+[
+ 'UtC', 'gmt', 'Etc/UTC', 'Etc/GMT', 'Etc/GMT0', 'Etc/GMT+0',
+ 'etc/gmt-0', 'etc/zulu', 'Etc/universal', 'etc/greenwich'
+].forEach((timezone) => {
+ const df = Intl.DateTimeFormat(undefined, {timeZone: timezone});
+ assertEquals('UTC', df.resolvedOptions().timeZone);
+})
-df = Intl.DateTimeFormat(undefined, {timeZone: 'gmt'});
-assertEquals('UTC', df.resolvedOptions().timeZone);
+// See test/mjsunit/regress/regress-crbug-364374.js for additional/ tests.
df = Intl.DateTimeFormat(undefined, {timeZone: 'America/Los_Angeles'});
assertEquals('America/Los_Angeles', df.resolvedOptions().timeZone);
@@ -43,22 +47,29 @@ assertEquals('America/Los_Angeles', df.resolvedOptions().timeZone);
df = Intl.DateTimeFormat(undefined, {timeZone: 'Europe/Belgrade'});
assertEquals('Europe/Belgrade', df.resolvedOptions().timeZone);
-// Check Etc/XXX variants. They should work too.
-df = Intl.DateTimeFormat(undefined, {timeZone: 'Etc/UTC'});
-assertEquals('UTC', df.resolvedOptions().timeZone);
-
-df = Intl.DateTimeFormat(undefined, {timeZone: 'Etc/GMT'});
-assertEquals('UTC', df.resolvedOptions().timeZone);
-
df = Intl.DateTimeFormat(undefined, {timeZone: 'euRope/beLGRade'});
assertEquals('Europe/Belgrade', df.resolvedOptions().timeZone);
+// Etc/GMT-14 to Etc/GMT+12 are valid.
+df = Intl.DateTimeFormat(undefined, {timeZone: 'etc/gmt+12'});
+assertEquals('Etc/GMT+12', df.resolvedOptions().timeZone);
+
+df = Intl.DateTimeFormat(undefined, {timeZone: 'etc/gmt+9'});
+assertEquals('Etc/GMT+9', df.resolvedOptions().timeZone);
+
+df = Intl.DateTimeFormat(undefined, {timeZone: 'etc/gmt-9'});
+assertEquals('Etc/GMT-9', df.resolvedOptions().timeZone);
+
+df = Intl.DateTimeFormat(undefined, {timeZone: 'etc/gmt-14'});
+assertEquals('Etc/GMT-14', df.resolvedOptions().timeZone);
+
+assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'Etc/GMT+13\'})');
+
// : + - are not allowed, only / _ are.
assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'GMT+07:00\'})');
assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'GMT+0700\'})');
assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'GMT-05:00\'})');
assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'GMT-0500\'})');
-assertThrows('Intl.DateTimeFormat(undefined, {timeZone: \'Etc/GMT+0\'})');
assertThrows('Intl.DateTimeFormat(undefined, ' +
'{timeZone: \'America/Los-Angeles\'})');
diff --git a/deps/v8/test/intl/general/getCanonicalLocales.js b/deps/v8/test/intl/general/getCanonicalLocales.js
index dd01363c4f..0df6846ce6 100644
--- a/deps/v8/test/intl/general/getCanonicalLocales.js
+++ b/deps/v8/test/intl/general/getCanonicalLocales.js
@@ -2,24 +2,12 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-var locales = ['en-US', 'fr'];
-var result = Intl.getCanonicalLocales(locales);
-var len = result.length
+// Ignore the first tag when checking for duplicate subtags.
+assertDoesNotThrow(() => Intl.getCanonicalLocales("foobar-foobar"));
-// TODO(jshin): Remove the following when
-// https://github.com/tc39/test262/issues/745 is resolved and
-// test262 in v8 is updated.
+// Ignore duplicate subtags in different namespaces; eg, 'a' vs 'u'.
+assertDoesNotThrow(() => Intl.getCanonicalLocales("en-a-ca-Chinese-u-ca-Chinese"));
-assertEquals(Object.getPrototypeOf(result), Array.prototype);
-assertEquals(result.constructor, Array);
-
-for (var key in result) {
- var desc = Object.getOwnPropertyDescriptor(result, key);
- assertTrue(desc.writable);
- assertTrue(desc.configurable);
- assertTrue(desc.enumerable);
-}
-
-var desc = Object.getOwnPropertyDescriptor(result, 'length');
-assertTrue(desc.writable);
-assertEquals(result.push('de'), desc.value + 1);
+// Check duplicate subtags (after the first tag) are detected.
+assertThrows(() => Intl.getCanonicalLocales("en-foobar-foobar"), RangeError);
+assertThrows(() => Intl.getCanonicalLocales("en-u-ca-gregory-ca-chinese"), RangeError);
diff --git a/deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js b/deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js
new file mode 100644
index 0000000000..b4d529652f
--- /dev/null
+++ b/deps/v8/test/intl/general/grandfathered_tags_without_preferred_value.js
@@ -0,0 +1,27 @@
+// 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.
+
+[
+ // Grandfathered tags without a preferred value in the IANA language
+ // tag registry. Nonetheless, ICU cooks up a value when canonicalizing.
+ // v8 works around that ICU issue.
+ // See https://www.iana.org/assignments/language-subtag-registry/language-subtag-registry .
+ ["cel-gaulish", "cel-gaulish"],
+ ["i-default", "i-default"],
+ ["i-mingo", "i-mingo"],
+ ["i-enochian", "i-enochian"],
+ ["zh-min", "zh-min"],
+
+ // Matching should be case-insensitive.
+ ["I-default", "i-default"],
+ ["i-DEFAULT", "i-default"],
+ ["I-DEFAULT", "i-default"],
+ ["i-DEfauLT", "i-default"],
+ ["zh-Min", "zh-min"],
+ ["Zh-min", "zh-min"],
+].forEach(([inputLocale, expectedLocale]) => {
+ const canonicalLocales = Intl.getCanonicalLocales(inputLocale);
+ assertEquals(canonicalLocales.length, 1);
+ assertEquals(canonicalLocales[0], expectedLocale);
+})
diff --git a/deps/v8/test/intl/general/language_tags_with_preferred_values.js b/deps/v8/test/intl/general/language_tags_with_preferred_values.js
index 391db53a98..073a6c9aff 100644
--- a/deps/v8/test/intl/general/language_tags_with_preferred_values.js
+++ b/deps/v8/test/intl/general/language_tags_with_preferred_values.js
@@ -7,6 +7,11 @@
["sgn-de", "gsg"],
["sgn-de-u-co-phonebk", "gsg-u-co-phonebk"],
+ // Matching should be case-insensitive.
+ ["sgn-De", "gsg"],
+ ["sgn-BE-FR", "sfb"],
+ ["Sgn-bE-Fr", "sfb"],
+
// deprecated region tag
["und-Latn-dd", "und-Latn-DE"],
["und-dd-u-co-phonebk", "und-DE-u-co-phonebk"],
@@ -22,8 +27,8 @@
["jw", "jv"],
["aam", "aas"],
["aam-u-ca-gregory", "aas-u-ca-gregory"],
-].forEach(function (entry) {
- const canonicalLocales = Intl.getCanonicalLocales(entry[0]);
+].forEach(([inputLocale, expectedLocale]) => {
+ const canonicalLocales = Intl.getCanonicalLocales(inputLocale);
assertEquals(canonicalLocales.length, 1);
- assertEquals(canonicalLocales[0], entry[1]);
+ assertEquals(canonicalLocales[0], expectedLocale);
})
diff --git a/deps/v8/test/intl/list-format/constructor.js b/deps/v8/test/intl/list-format/constructor.js
new file mode 100644
index 0000000000..33a85fd79f
--- /dev/null
+++ b/deps/v8/test/intl/list-format/constructor.js
@@ -0,0 +1,108 @@
+// 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-intl-list-format
+
+// ListFormat constructor can't be called as function.
+assertThrows(() => Intl.ListFormat(['sr']), TypeError);
+
+// Non-string locale.
+// assertThrows(() => new Intl.ListFormat(5), TypeError);
+
+// Invalid locale string.
+assertThrows(() => new Intl.ListFormat(['abcdefghi']), RangeError);
+
+assertDoesNotThrow(() => new Intl.ListFormat(['sr'], {}), TypeError);
+
+assertDoesNotThrow(() => new Intl.ListFormat([], {}));
+
+assertDoesNotThrow(() => new Intl.ListFormat(['fr', 'ar'], {}));
+
+assertDoesNotThrow(() => new Intl.ListFormat({0: 'ja', 1:'fr'}, {}));
+
+assertDoesNotThrow(() => new Intl.ListFormat({1: 'ja', 2:'fr'}, {}));
+
+assertDoesNotThrow(() => new Intl.ListFormat(['sr']));
+
+assertDoesNotThrow(() => new Intl.ListFormat());
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(
+ ['sr'], {
+ style: 'short',
+ type: 'unit'
+ }));
+
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'conjunction'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'disjunction'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'unit'}));
+
+assertThrows(
+ () => new Intl.ListFormat(['sr'], {type: 'standard'}),
+ RangeError);
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {style: 'long'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {style: 'short'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {style: 'narrow'}));
+
+assertThrows(
+ () => new Intl.ListFormat(['sr'], {style: 'giant'}),
+ RangeError);
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'conjunction', style: 'long'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'conjunction', style: 'short'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'conjunction', style: 'narrow'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'disjunction', style: 'long'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'disjunction', style: 'short'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'disjunction', style: 'narrow'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'unit', style: 'long'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'unit', style: 'short'}));
+
+assertDoesNotThrow(
+ () => new Intl.ListFormat(['sr'], {type: 'unit', style: 'narrow'}));
+
+// Throws only once during construction.
+// Check for all getters to prevent regression.
+// Preserve the order of getter initialization.
+let getCount = 0;
+let style = -1;
+let type = -1;
+
+new Intl.ListFormat(['en-US'], {
+ get style() {
+ style = ++getCount;
+ },
+ get type() {
+ type = ++getCount;
+ }
+});
+
+assertEquals(1, type);
+assertEquals(2, style);
diff --git a/deps/v8/test/intl/list-format/format-en.js b/deps/v8/test/intl/list-format/format-en.js
new file mode 100644
index 0000000000..21eb99d06d
--- /dev/null
+++ b/deps/v8/test/intl/list-format/format-en.js
@@ -0,0 +1,119 @@
+// 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-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.
+// NOTE: These are UNSPECIFIED behavior in
+// http://tc39.github.io/proposal-intl-list-time/
+
+let enLongConjunction = new Intl.ListFormat(
+ ["en"], {style: "long", type: 'conjunction'});
+
+assertEquals('', enLongConjunction.format());
+ assertEquals('', enLongConjunction.format([]));
+assertEquals('a', enLongConjunction.format(['a']));
+assertEquals('b', enLongConjunction.format(['b']));
+assertEquals('a and b', enLongConjunction.format(['a', 'b']));
+assertEquals('a, b, and c', enLongConjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, and d', enLongConjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, and and', enLongConjunction.format(['a', 'b', 'c', 'd', 'and']));
+
+let enLongDisjunction = new Intl.ListFormat(
+ ["en"], {style: "long", type: 'disjunction'});
+
+assertEquals('', enLongDisjunction.format());
+assertEquals('', enLongDisjunction.format([]));
+assertEquals('a', enLongDisjunction.format(['a']));
+assertEquals('b', enLongDisjunction.format(['b']));
+assertEquals('a or b', enLongDisjunction.format(['a', 'b']));
+assertEquals('a, b, or c', enLongDisjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, or d', enLongDisjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, or or', enLongDisjunction.format(['a', 'b', 'c', 'd', 'or']));
+
+let enLongUnit = new Intl.ListFormat(
+ ["en"], {style: "long", type: 'unit'});
+
+assertEquals('', enLongUnit.format());
+assertEquals('', enLongUnit.format([]));
+assertEquals('a', enLongUnit.format(['a']));
+assertEquals('b', enLongUnit.format(['b']));
+assertEquals('a, b', enLongUnit.format(['a', 'b']));
+assertEquals('a, b, c', enLongUnit.format(['a', 'b', 'c']));
+assertEquals('a, b, c, d', enLongUnit.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, or', enLongUnit.format(['a', 'b', 'c', 'd', 'or']));
+
+let enShortConjunction = new Intl.ListFormat(
+ ["en"], {style: "short", type: 'conjunction'});
+
+assertEquals('', enShortConjunction.format());
+assertEquals('', enShortConjunction.format([]));
+assertEquals('a', enShortConjunction.format(['a']));
+assertEquals('b', enShortConjunction.format(['b']));
+assertEquals('a and b', enShortConjunction.format(['a', 'b']));
+assertEquals('a, b, and c', enShortConjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, and d', enShortConjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, and and', enShortConjunction.format(['a', 'b', 'c', 'd', 'and']));
+
+let enShortDisjunction = new Intl.ListFormat(
+ ["en"], {style: "short", type: 'disjunction'});
+
+assertEquals('', enShortDisjunction.format());
+assertEquals('', enShortDisjunction.format([]));
+assertEquals('a', enShortDisjunction.format(['a']));
+assertEquals('b', enShortDisjunction.format(['b']));
+assertEquals('a or b', enShortDisjunction.format(['a', 'b']));
+assertEquals('a, b, or c', enShortDisjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, or d', enShortDisjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, or or', enShortDisjunction.format(['a', 'b', 'c', 'd', 'or']));
+
+let enShortUnit = new Intl.ListFormat(
+ ["en"], {style: "short", type: 'unit'});
+
+assertEquals('', enShortUnit.format());
+assertEquals('', enShortUnit.format([]));
+assertEquals('a', enShortUnit.format(['a']));
+assertEquals('b', enShortUnit.format(['b']));
+assertEquals('a, b', enShortUnit.format(['a', 'b']));
+assertEquals('a, b, c', enShortUnit.format(['a', 'b', 'c']));
+assertEquals('a, b, c, d', enShortUnit.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, or', enShortUnit.format(['a', 'b', 'c', 'd', 'or']));
+
+let enNarrowConjunction = new Intl.ListFormat(
+ ["en"], {style: "narrow", type: 'conjunction'});
+
+assertEquals('', enNarrowConjunction.format());
+assertEquals('', enNarrowConjunction.format([]));
+assertEquals('a', enNarrowConjunction.format(['a']));
+assertEquals('b', enNarrowConjunction.format(['b']));
+assertEquals('a and b', enNarrowConjunction.format(['a', 'b']));
+assertEquals('a, b, and c', enNarrowConjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, and d', enNarrowConjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, and and', enNarrowConjunction.format(['a', 'b', 'c', 'd', 'and']));
+
+let enNarrowDisjunction = new Intl.ListFormat(
+ ["en"], {style: "narrow", type: 'disjunction'});
+
+assertEquals('', enNarrowDisjunction.format());
+assertEquals('', enNarrowDisjunction.format([]));
+assertEquals('a', enNarrowDisjunction.format(['a']));
+assertEquals('b', enNarrowDisjunction.format(['b']));
+assertEquals('a or b', enNarrowDisjunction.format(['a', 'b']));
+assertEquals('a, b, or c', enNarrowDisjunction.format(['a', 'b', 'c']));
+assertEquals('a, b, c, or d', enNarrowDisjunction.format(['a', 'b', 'c', 'd']));
+assertEquals('a, b, c, d, or or', enNarrowDisjunction.format(['a', 'b', 'c', 'd', 'or']));
+
+let enNarrowUnit = new Intl.ListFormat(
+ ["en"], {style: "narrow", type: 'unit'});
+
+assertEquals('', enNarrowUnit.format());
+assertEquals('', enNarrowUnit.format([]));
+assertEquals('a', enNarrowUnit.format(['a']));
+assertEquals('b', enNarrowUnit.format(['b']));
+assertEquals('a b', enNarrowUnit.format(['a', 'b']));
+assertEquals('a b c', enNarrowUnit.format(['a', 'b', 'c']));
+assertEquals('a b c d', enNarrowUnit.format(['a', 'b', 'c', 'd']));
+assertEquals('a b c d or', enNarrowUnit.format(['a', 'b', 'c', 'd', 'or']));
diff --git a/deps/v8/test/intl/list-format/format-to-parts.js b/deps/v8/test/intl/list-format/format-to-parts.js
new file mode 100644
index 0000000000..83473b6d0b
--- /dev/null
+++ b/deps/v8/test/intl/list-format/format-to-parts.js
@@ -0,0 +1,92 @@
+// 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-intl-list-format
+
+function assertListFormat(listFormat, input) {
+ var result;
+ try {
+ result = listFormat.formatToParts(input);
+ } catch (e) {
+ fail('should not throw exception ' + e);
+ }
+ assertTrue(Array.isArray(result));
+ if (input) {
+ assertTrue(result.length >= input.length * 2 - 1);
+ for (var i = 0, j = 0; i < result.length; i++) {
+ assertEquals('string', typeof result[i].value);
+ assertEquals('string', typeof result[i].type);
+ assertTrue(result[i].type == 'literal' || result[i].type == 'element');
+ if (result[i].type == 'element') {
+ assertEquals(String(input[j++]), result[i].value);
+ if (i - 1 >= 0) {
+ assertEquals('literal', result[i - 1].type);
+ }
+ if (i + 1 < result.length) {
+ assertEquals('literal', result[i + 1].type);
+ }
+ }
+ if (result[i].type == 'literal') {
+ assertTrue(result[i].value.length > 0);
+ if (i - 1 >= 0) {
+ assertEquals('element', result[i - 1].type);
+ }
+ if (i + 1 < result.length) {
+ assertEquals('element', result[i + 1].type);
+ }
+ }
+ }
+ }
+}
+
+function testFormatter(listFormat) {
+
+ assertListFormat(listFormat, []);
+ assertListFormat(listFormat, undefined);
+ assertListFormat(listFormat, ['1']);
+ assertListFormat(listFormat, ['a']);
+ assertListFormat(listFormat, ['1', 'b']);
+ assertListFormat(listFormat, ['1', 'b', '3']);
+ assertListFormat(listFormat, ['a', 'b']);
+ assertListFormat(listFormat, ['a', 'b', 'c']);
+ assertListFormat(listFormat, ['a', 'b', 'c', 'd']);
+ assertListFormat(listFormat, ['作者', '譚永鋒', '1', (new Date()).toString()]);
+ assertListFormat(listFormat, ['作者', '譚永鋒', '1', 'b', '3']);
+ // Tricky cases
+ assertListFormat(listFormat, [' ', 'b', 'c', 'and']);
+ assertListFormat(listFormat, [' ', 'b', 'c', 'or']);
+ assertListFormat(listFormat, ['and']);
+ assertListFormat(listFormat, ['or']);
+
+ assertThrows(() => listFormat.formatToParts(null), TypeError);
+ assertThrows(() => listFormat.formatToParts([new Date()]), TypeError);
+ assertThrows(() => listFormat.formatToParts([1]), TypeError);
+ assertThrows(() => listFormat.formatToParts([1, 'b']), TypeError);
+ assertThrows(() => listFormat.formatToParts([1, 'b', 3]), TypeError);
+ assertThrows(() => listFormat.formatToParts([[3, 4]]), TypeError);
+ assertThrows(() => listFormat.formatToParts([undefined, 'world']), TypeError);
+ assertThrows(() => listFormat.formatToParts(['hello', undefined]), TypeError);
+ assertThrows(() => listFormat.formatToParts([undefined]), TypeError);
+ assertThrows(() => listFormat.formatToParts([null, 'world']), TypeError);
+ assertThrows(() => listFormat.formatToParts(['hello', null]), TypeError);
+ assertThrows(() => listFormat.formatToParts([null]), TypeError);
+
+}
+testFormatter(new Intl.ListFormat());
+testFormatter(new Intl.ListFormat(["en"]));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'unit'}));
diff --git a/deps/v8/test/intl/list-format/format.js b/deps/v8/test/intl/list-format/format.js
new file mode 100644
index 0000000000..677cb22496
--- /dev/null
+++ b/deps/v8/test/intl/list-format/format.js
@@ -0,0 +1,63 @@
+// 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-intl-list-format
+
+function assertListFormat(listFormat, input) {
+ try {
+ let result = listFormat.format(input);
+ assertEquals('string', typeof result);
+ if (input) {
+ for (var i = 0; i < input.length; i++) {
+ assertTrue(result.indexOf(input[i]) >= 0);
+ }
+ }
+ } catch (e) {
+ fail('should not throw exception ' + e);
+ }
+}
+
+function testFormatter(listFormat) {
+ assertListFormat(listFormat, []);
+ assertListFormat(listFormat, undefined);
+ assertListFormat(listFormat, ['1']);
+ assertListFormat(listFormat, ['a']);
+ assertListFormat(listFormat, ['1', 'b']);
+ assertListFormat(listFormat, ['1', 'b', '3']);
+ assertListFormat(listFormat, ['a', 'b']);
+ assertListFormat(listFormat, ['a', 'b', 'c']);
+ assertListFormat(listFormat, ['a', 'b', 'c', 'd']);
+ assertListFormat(listFormat, ['作者', '譚永鋒', '1', (new Date()).toString()]);
+ assertListFormat(listFormat, ['作者', '譚永鋒', '1', 'b', '3']);
+
+ assertThrows(() => listFormat.format(null), TypeError);
+ assertThrows(() => listFormat.format([new Date()]), TypeError);
+ assertThrows(() => listFormat.format([1]), TypeError);
+ assertThrows(() => listFormat.format([1, 'b']), TypeError);
+ assertThrows(() => listFormat.format([1, 'b', 3]), TypeError);
+ assertThrows(() => listFormat.format([[3, 4]]), TypeError);
+ assertThrows(() => listFormat.format([undefined, 'world']), TypeError);
+ assertThrows(() => listFormat.format(['hello', undefined]), TypeError);
+ assertThrows(() => listFormat.format([undefined]), TypeError);
+ assertThrows(() => listFormat.format([null, 'world']), TypeError);
+ assertThrows(() => listFormat.format(['hello', null]), TypeError);
+ assertThrows(() => listFormat.format([null]), TypeError);
+}
+testFormatter(new Intl.ListFormat());
+testFormatter(new Intl.ListFormat(["en"]));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'conjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'disjunction'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'long', type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'short', type: 'unit'}));
+testFormatter(new Intl.ListFormat(["en"], {style: 'narrow', type: 'unit'}));
diff --git a/deps/v8/test/intl/list-format/formatToParts-zh.js b/deps/v8/test/intl/list-format/formatToParts-zh.js
new file mode 100644
index 0000000000..a7204b0b29
--- /dev/null
+++ b/deps/v8/test/intl/list-format/formatToParts-zh.js
@@ -0,0 +1,157 @@
+// 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-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.
+// NOTE: These are UNSPECIFIED behavior in
+// http://tc39.github.io/proposal-intl-list-time/
+
+let zhLongConjunction = new Intl.ListFormat(
+ ["zh"], {style: "long", type: 'conjunction'});
+
+var parts;
+parts = zhLongConjunction.formatToParts();
+assertEquals(0, parts.length);
+
+parts = zhLongConjunction.formatToParts([]);
+assertEquals(0, parts.length);
+
+parts = zhLongConjunction.formatToParts(['譚永鋒']);
+assertEquals(1, parts.length);
+assertEquals('譚永鋒', parts[0].value);
+assertEquals('element', parts[0].type);
+
+parts = zhLongConjunction.formatToParts(['譚永鋒', '劉新宇']);
+assertEquals(3, parts.length);
+assertEquals('譚永鋒', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('和', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('劉新宇', parts[2].value);
+assertEquals('element', parts[2].type);
+
+parts = zhLongConjunction.formatToParts(['黄子容', '譚永鋒', '劉新宇']);
+assertEquals(5, parts.length);
+assertEquals('黄子容', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('、', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('譚永鋒', parts[2].value);
+assertEquals('element', parts[2].type);
+assertEquals('和', parts[3].value);
+assertEquals('literal', parts[3].type);
+assertEquals('劉新宇', parts[4].value);
+assertEquals('element', parts[4].type);
+
+parts = zhLongConjunction.formatToParts(['黄子容', '譚永鋒', '劉新宇', '朱君毅']);
+assertEquals(7, parts.length);
+assertEquals('黄子容', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('、', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('譚永鋒', parts[2].value);
+assertEquals('element', parts[2].type);
+assertEquals('、', parts[3].value);
+assertEquals('literal', parts[3].type);
+assertEquals('劉新宇', parts[4].value);
+assertEquals('element', parts[4].type);
+assertEquals('和', parts[5].value);
+assertEquals('literal', parts[5].type);
+assertEquals('朱君毅', parts[6].value);
+assertEquals('element', parts[6].type);
+
+let zhShortDisjunction = new Intl.ListFormat(
+ ["zh"], {style: "short", type: 'disjunction'});
+parts = zhShortDisjunction.formatToParts();
+assertEquals(0, parts.length);
+
+parts = zhShortDisjunction.formatToParts([]);
+assertEquals(0, parts.length);
+
+parts = zhShortDisjunction.formatToParts(['譚永鋒']);
+assertEquals(1, parts.length);
+assertEquals('譚永鋒', parts[0].value);
+assertEquals('element', parts[0].type);
+
+parts = zhShortDisjunction.formatToParts(['譚永鋒', '劉新宇']);
+assertEquals(3, parts.length);
+assertEquals('譚永鋒', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('或', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('劉新宇', parts[2].value);
+assertEquals('element', parts[2].type);
+
+parts = zhShortDisjunction.formatToParts(['黄子容', '譚永鋒', '劉新宇']);
+assertEquals(5, parts.length);
+assertEquals('黄子容', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('、', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('譚永鋒', parts[2].value);
+assertEquals('element', parts[2].type);
+assertEquals('或', parts[3].value);
+assertEquals('literal', parts[3].type);
+assertEquals('劉新宇', parts[4].value);
+assertEquals('element', parts[4].type);
+
+parts = zhShortDisjunction.formatToParts(['黄子容', '譚永鋒', '劉新宇', '朱君毅']);
+assertEquals(7, parts.length);
+assertEquals('黄子容', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('、', parts[1].value);
+assertEquals('literal', parts[1].type);
+assertEquals('譚永鋒', parts[2].value);
+assertEquals('element', parts[2].type);
+assertEquals('、', parts[3].value);
+assertEquals('literal', parts[3].type);
+assertEquals('劉新宇', parts[4].value);
+assertEquals('element', parts[4].type);
+assertEquals('或', parts[5].value);
+assertEquals('literal', parts[5].type);
+assertEquals('朱君毅', parts[6].value);
+
+let zhNarrowUnit = new Intl.ListFormat(
+ ["zh"], {style: "narrow", type: 'unit'});
+
+parts = zhNarrowUnit.formatToParts();
+assertEquals(0, parts.length);
+
+parts = zhNarrowUnit.formatToParts([]);
+assertEquals(0, parts.length);
+
+parts = zhNarrowUnit.formatToParts(['3英哩']);
+assertEquals(1, parts.length);
+assertEquals('3英哩', parts[0].value);
+assertEquals('element', parts[0].type);
+
+parts = zhNarrowUnit.formatToParts(['3英哩', '4碼']);
+assertEquals(2, parts.length);
+assertEquals('3英哩', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('4碼', parts[1].value);
+assertEquals('element', parts[1].type);
+
+parts = zhNarrowUnit.formatToParts(['3英哩', '4碼', '5英尺']);
+assertEquals(3, parts.length);
+assertEquals('3英哩', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('4碼', parts[1].value);
+assertEquals('element', parts[1].type);
+assertEquals('5英尺', parts[2].value);
+assertEquals('element', parts[2].type);
+
+parts = zhNarrowUnit.formatToParts(['3英哩', '4碼', '5英尺','7英吋']);
+assertEquals(4, parts.length);
+assertEquals('3英哩', parts[0].value);
+assertEquals('element', parts[0].type);
+assertEquals('4碼', parts[1].value);
+assertEquals('element', parts[1].type);
+assertEquals('5英尺', parts[2].value);
+assertEquals('element', parts[2].type);
+assertEquals('7英吋', parts[3].value);
+assertEquals('element', parts[3].type);
diff --git a/deps/v8/test/intl/list-format/resolved-options.js b/deps/v8/test/intl/list-format/resolved-options.js
new file mode 100644
index 0000000000..270eb33e45
--- /dev/null
+++ b/deps/v8/test/intl/list-format/resolved-options.js
@@ -0,0 +1,155 @@
+// 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-intl-list-format
+
+let listFormat = new Intl.ListFormat();
+// The default style is 'long'
+assertEquals('long', listFormat.resolvedOptions().style);
+
+// The default type is 'conjunction'
+assertEquals('conjunction', listFormat.resolvedOptions().type);
+
+assertEquals(
+ 'short',
+ (new Intl.ListFormat(['sr'], {style: 'short'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'conjunction',
+ (new Intl.ListFormat(['sr'], {style: 'short'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'narrow',
+ (new Intl.ListFormat(['sr'], {style: 'narrow'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'conjunction',
+ (new Intl.ListFormat(['sr'], {style: 'narrow'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {style: 'long'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'conjunction',
+ (new Intl.ListFormat(['sr'], {style: 'long'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'conjunction',
+ (new Intl.ListFormat(['sr'], {type: 'conjunction'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {type: 'conjunction'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'disjunction',
+ (new Intl.ListFormat(['sr'], {type: 'disjunction'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {type: 'disjunction'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'unit',
+ (new Intl.ListFormat(['sr'], {type: 'unit'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {type: 'unit'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'disjunction',
+ (new Intl.ListFormat(['sr'], {style: 'long', type: 'disjunction'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {style: 'long', type: 'disjunction'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'disjunction',
+ (new Intl.ListFormat(['sr'], {style: 'short', type: 'disjunction'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'short',
+ (new Intl.ListFormat(['sr'], {style: 'short', type: 'disjunction'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'disjunction',
+ (new Intl.ListFormat(['sr'], {style: 'narrow', type: 'disjunction'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'narrow',
+ (new Intl.ListFormat(['sr'], {style: 'narrow', type: 'disjunction'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'unit',
+ (new Intl.ListFormat(['sr'], {style: 'long', type: 'unit'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'long',
+ (new Intl.ListFormat(['sr'], {style: 'long', type: 'unit'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'unit',
+ (new Intl.ListFormat(['sr'], {style: 'short', type: 'unit'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'short',
+ (new Intl.ListFormat(['sr'], {style: 'short', type: 'unit'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'unit',
+ (new Intl.ListFormat(['sr'], {style: 'narrow', type: 'unit'}))
+ .resolvedOptions().type);
+
+assertEquals(
+ 'narrow',
+ (new Intl.ListFormat(['sr'], {style: 'narrow', type: 'unit'}))
+ .resolvedOptions().style);
+
+assertEquals(
+ 'ar',
+ (new Intl.ListFormat(['ar'])).resolvedOptions().locale);
+
+assertEquals(
+ 'ar',
+ (new Intl.ListFormat(['ar', 'en'])).resolvedOptions().locale);
+
+assertEquals(
+ 'fr',
+ (new Intl.ListFormat(['fr', 'en'])).resolvedOptions().locale);
+
+assertEquals(
+ 'ar',
+ (new Intl.ListFormat(['xyz', 'ar'])).resolvedOptions().locale);
+
+// The following is not working yet because it depend on the getAvailableLocales
+// work in another path set.
+// TODO(ftang): uncomment the following once that patchset is checked in.
+// assertEquals(
+// 'ar',
+// (new Intl.ListFormat(['i-default', 'ar'])).resolvedOptions().locale);
diff --git a/deps/v8/test/intl/locale/locale-constructor.js b/deps/v8/test/intl/locale/locale-constructor.js
index 170cc81c36..3da9e291be 100644
--- a/deps/v8/test/intl/locale/locale-constructor.js
+++ b/deps/v8/test/intl/locale/locale-constructor.js
@@ -9,6 +9,11 @@ assertThrows(() => Intl.Locale('sr'), TypeError);
// Non-string locale.
assertThrows(() => new Intl.Locale(5), TypeError);
+assertThrows(() => new Intl.Locale(Symbol()), TypeError);
+assertThrows(() => new Intl.Locale(null), TypeError);
+assertThrows(() => new Intl.Locale(undefined), TypeError);
+assertThrows(() => new Intl.Locale(false), TypeError);
+assertThrows(() => new Intl.Locale(true), TypeError);
// Invalid locale string.
assertThrows(() => new Intl.Locale('abcdefghi'), RangeError);
diff --git a/deps/v8/test/intl/locale/maximize_minimize.js b/deps/v8/test/intl/locale/maximize_minimize.js
new file mode 100644
index 0000000000..823a6670e3
--- /dev/null
+++ b/deps/v8/test/intl/locale/maximize_minimize.js
@@ -0,0 +1,138 @@
+// 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-locale
+
+// Make sure that maximize and minimize of all locales work reasonbly.
+
+assertEquals(new Intl.Locale("zh-TW").maximize().toString(), "zh-Hant-TW",
+ "zh-TW should maximize to zh-Hant-TW");
+assertEquals(new Intl.Locale("zh-Hant-TW").minimize().toString(), "zh-TW",
+ "zh-Hant-TW should minimize to zh-TW");
+assertEquals(new Intl.Locale("zh-Hans-CN").minimize().toString(), "zh",
+ "zh-Hans-CN should minimize to zh");
+assertEquals(new Intl.Locale("zh-CN").minimize().toString(), "zh",
+ "zh-CN should minimize to zh");
+assertEquals(new Intl.Locale("zh-Hans").minimize().toString(), "zh",
+ "zh-Hans should minimize to zh");
+
+function assertExpandRoundTrip(loc) {
+ assertEquals(
+ loc.toString(), loc.maximize().minimize().toString(), loc.toString());
+ assertEquals(
+ loc.toString(), loc.minimize().toString(), loc.toString());
+ assertTrue(
+ loc.maximize().toString().length > loc.toString().length, loc.toString());
+}
+
+var simpleLocales = [
+ "af", "agq", "ak", "am", "ar", "asa", "ast", "as", "az", "bas", "bem", "be",
+ "bez", "bg", "bm", "bn", "bo", "br", "brx", "bs", "ca", "ccp", "ce", "cgg",
+ "chr", "ckb", "cs", "cu", "cy", "dav", "da", "de", "dje", "dsb", "dua", "dyo",
+ "dz", "ebu", "ee", "el", "en", "eo", "es", "et", "eu", "ewo", "fa", "ff",
+ "fil", "fi", "fo", "fr", "fur", "fy", "ga", "gd", "gl", "gsw", "gu", "guz",
+ "gv", "haw", "ha", "he", "hi", "hr", "hsb", "hu", "hy", "id", "ig", "ii",
+ "is", "it", "ja", "jgo", "jmc", "kab", "kam", "ka", "kde", "kea", "khq", "ki",
+ "kkj", "kk", "kln", "kl", "km", "kn", "kok", "ko", "ksb", "ksf", "ksh", "ks",
+ "kw", "ky", "lag", "lb", "lg", "lkt", "ln", "lo", "lrc", "lt", "luo", "lu",
+ "luy", "lv", "mas", "mer", "mfe", "mgh", "mgo", "mg", "mk", "ml", "mn", "mr",
+ "ms", "mt", "mua", "my", "mzn", "naq", "nb", "nds", "nd", "ne", "nl", "nmg",
+ "nnh", "nn", "nus", "nyn", "om", "or", "os", "pa", "pl", "prg", "ps", "pt",
+ "qu", "rm", "rn", "rof", "ro", "ru", "rwk", "rw", "sah", "saq", "sbp", "sd",
+ "seh", "ses", "se", "sg", "shi", "si", "sk", "sl", "smn", "sn", "so", "sq",
+ "sr", "sv", "sw", "ta", "teo", "te", "tg", "th", "ti", "tk", "to", "tr", "tt",
+ "twq", "tzm", "ug", "uk", "ur", "uz", "vai", "vi", "vo", "vun", "wae", "wo",
+ "xog", "yav", "yi", "yo", "yue", "zgh", "zh", "zu"];
+for (var i = 0; i < simpleLocales.length; i++) {
+ assertExpandRoundTrip(new Intl.Locale(simpleLocales[i]));
+}
+
+function assertReduceRoundTrip(loc) {
+ assertEquals(
+ loc.minimize().toString(), loc.maximize().minimize().toString(),
+ loc.toString());
+ assertEquals(
+ loc.maximize().toString(), loc.minimize().maximize().toString(),
+ loc.toString());
+ assertTrue(
+ loc.maximize().toString().length >= loc.toString().length, loc.toString());
+ assertTrue(
+ loc.minimize().toString().length <= loc.toString().length, loc.toString());
+}
+
+var complexLocales = [
+ "af-NA", "af-ZA", "agq-CM", "ak-GH", "am-ET", "ar-001", "ar-AE", "ar-BH",
+ "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER", "ar-IL", "ar-IQ", "ar-JO",
+ "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA", "ar-MR", "ar-OM", "ar-PS",
+ "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS", "ar-SY", "ar-TD", "ar-TN",
+ "ar-YE", "asa-TZ", "as-IN", "ast-ES", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
+ "az-Latn", "bas-CM", "be-BY", "bem-ZM", "bez-TZ", "bg-BG", "bm-ML", "bn-BD",
+ "bn-IN", "bo-CN", "bo-IN", "br-FR", "brx-IN", "bs-Cyrl-BA", "bs-Cyrl",
+ "bs-Latn-BA", "bs-Latn", "ca-AD", "ca-ES", "ca-FR", "ca-IT",
+ "ccp-BD", "ccp-IN", "ce-RU", "cgg-UG", "chr-US", "ckb-Arab-IQ", "ckb-Arab-IR",
+ "ckb-Arab", "ckb-IQ", "ckb-IR", "ckb-Latn-IQ", "ckb-Latn", "cs-CZ", "cu-RU",
+ "cy-GB", "da-DK", "da-GL", "dav-KE", "de-AT", "de-BE", "de-CH", "de-DE",
+ "de-IT", "de-LI", "de-LU", "dje-NE", "dsb-DE", "dua-CM", "dyo-SN", "dz-BT",
+ "ebu-KE", "ee-GH", "ee-TG", "el-CY", "el-GR", "en-001", "en-150", "en-AG",
+ "en-AI", "en-AS", "en-AT", "en-AU", "en-BB", "en-BE", "en-BI", "en-BM",
+ "en-BS", "en-BW", "en-BZ", "en-CA", "en-CC", "en-CH", "en-CK", "en-CM",
+ "en-CX", "en-CY", "en-DE", "en-DG", "en-DK", "en-DM", "en-ER", "en-FI",
+ "en-FJ", "en-FK", "en-FM", "en-GB", "en-GD", "en-GG", "en-GH", "en-GI",
+ "en-GM", "en-GU", "en-GY", "en-HK", "en-IE", "en-IL", "en-IM", "en-IN",
+ "en-IO", "en-JE", "en-JM", "en-KE", "en-KI", "en-KN", "en-KY", "en-LC",
+ "en-LR", "en-LS", "en-MG", "en-MH", "en-MO", "en-MP", "en-MS", "en-MT",
+ "en-MU", "en-MW", "en-MY", "en-NA", "en-NF", "en-NG", "en-NL", "en-NR",
+ "en-NU", "en-NZ", "en-PG", "en-PH", "en-PK", "en-PN", "en-PR", "en-PW",
+ "en-RW", "en-SB", "en-SC", "en-SD", "en-SE", "en-SG", "en-SH", "en-SI",
+ "en-SL", "en-SS", "en-SX", "en-SZ", "en-TC", "en-TK", "en-TO", "en-TT",
+ "en-TV", "en-TZ", "en-UG", "en-UM", "en-US", "en-VC",
+ "en-VG", "en-VI", "en-VU", "en-WS", "en-ZA", "en-ZM", "en-ZW", "eo-001",
+ "es-419", "es-AR", "es-BO", "es-BR", "es-BZ", "es-CL", "es-CO", "es-CR",
+ "es-CU", "es-DO", "es-EA", "es-EC", "es-ES", "es-GQ", "es-GT", "es-HN",
+ "es-IC", "es-MX", "es-NI", "es-PA", "es-PE", "es-PH", "es-PR", "es-PY",
+ "es-SV", "es-US", "es-UY", "es-VE", "et-EE", "eu-ES", "ewo-CM", "fa-AF",
+ "fa-IR", "ff-CM", "ff-GN", "ff-MR", "ff-SN", "fi-FI", "fil-PH", "fo-DK",
+ "fo-FO", "fr-BE", "fr-BF", "fr-BI", "fr-BJ", "fr-BL", "fr-CA", "fr-CD",
+ "fr-CF", "fr-CG", "fr-CH", "fr-CI", "fr-CM", "fr-DJ", "fr-DZ", "fr-FR",
+ "fr-GA", "fr-GF", "fr-GN", "fr-GP", "fr-GQ", "fr-HT", "fr-KM", "fr-LU",
+ "fr-MA", "fr-MC", "fr-MF", "fr-MG", "fr-ML", "fr-MQ", "fr-MR", "fr-MU",
+ "fr-NC", "fr-NE", "fr-PF", "fr-PM", "fr-RE", "fr-RW", "fr-SC", "fr-SN",
+ "fr-SY", "fr-TD", "fr-TG", "fr-TN", "fr-VU", "fr-WF", "fr-YT", "fur-IT",
+ "fy-NL", "ga-IE", "gd-GB", "gl-ES", "gsw-CH", "gsw-FR", "gsw-LI", "gu-IN",
+ "guz-KE", "gv-IM", "ha-GH", "ha-NE", "ha-NG", "haw-US", "he-IL", "hi-IN",
+ "hr-BA", "hr-HR", "hsb-DE", "hu-HU", "hy-AM", "id-ID", "ig-NG", "ii-CN",
+ "is-IS", "it-CH", "it-IT", "it-SM", "it-VA", "ja-JP", "jgo-CM", "jmc-TZ",
+ "kab-DZ", "ka-GE", "kam-KE", "kde-TZ", "kea-CV", "khq-ML", "ki-KE",
+ "kkj-CM", "kk-KZ", "kl-GL", "kln-KE", "km-KH", "kn-IN", "kok-IN", "ko-KP",
+ "ko-KR", "ksb-TZ", "ksf-CM", "ksh-DE", "ks-IN", "kw-GB", "ky-KG", "lag-TZ",
+ "lb-LU", "lg-UG", "lkt-US", "ln-AO", "ln-CD", "ln-CF", "ln-CG", "lo-LA",
+ "lrc-IQ", "lrc-IR", "lt-LT", "lu-CD", "luo-KE", "luy-KE", "lv-LV", "mas-KE",
+ "mas-TZ", "mer-KE", "mfe-MU", "mgh-MZ", "mg-MG", "mgo-CM", "mk-MK", "ml-IN",
+ "mn-MN", "mr-IN", "ms-BN", "ms-MY", "ms-SG", "mt-MT", "mua-CM", "my-MM",
+ "mzn-IR", "naq-NA", "nb-NO", "nb-SJ", "nds-DE", "nds-NL", "nd-ZW", "ne-IN",
+ "ne-NP", "nl-AW", "nl-BE", "nl-BQ", "nl-CW", "nl-NL", "nl-SR", "nl-SX",
+ "nmg-CM", "nnh-CM", "nn-NO", "nus-SS", "nyn-UG", "om-ET", "om-KE",
+ "or-IN", "os-GE", "os-RU", "pa-Arab-PK", "pa-Guru-IN", "pa-Guru",
+ "pl-PL", "prg-001", "ps-AF", "pt-AO", "pt-BR", "pt-CH", "pt-CV", "pt-GQ",
+ "pt-GW", "pt-LU", "pt-MO", "pt-MZ", "pt-PT", "pt-ST", "pt-TL", "qu-BO",
+ "qu-EC", "qu-PE", "rm-CH", "rn-BI", "rof-TZ", "ro-MD", "ro-RO", "ru-BY",
+ "ru-KG", "ru-KZ", "ru-MD", "ru-RU", "ru-UA", "rwk-TZ", "rw-RW", "sah-RU",
+ "saq-KE", "sbp-TZ", "sd-PK", "se-FI", "seh-MZ", "se-NO", "se-SE", "ses-ML",
+ "sg-CF", "shi-Latn-MA", "shi-Latn", "shi-Tfng-MA", "shi-Tfng", "si-LK",
+ "sk-SK", "sl-SI", "smn-FI", "sn-ZW", "so-DJ", "so-ET", "so-KE", "so-SO",
+ "sq-AL", "sq-MK", "sq-XK", "sr-Cyrl-BA", "sr-Cyrl-ME", "sr-Cyrl-RS",
+ "sr-Cyrl-XK", "sr-Cyrl", "sr-Latn-BA", "sr-Latn-ME", "sr-Latn-RS",
+ "sr-Latn-XK", "sr-Latn", "sv-AX", "sv-FI", "sv-SE", "sw-CD", "sw-KE",
+ "sw-TZ", "sw-UG", "ta-IN", "ta-LK", "ta-MY", "ta-SG", "te-IN", "teo-KE",
+ "teo-UG", "tg-TJ", "th-TH", "ti-ER", "ti-ET", "tk-TM", "to-TO", "tr-CY",
+ "tr-TR", "tt-RU", "twq-NE", "tzm-MA", "ug-CN", "uk-UA", "ur-IN", "ur-PK",
+ "uz-Arab-AF", "uz-Cyrl-UZ", "uz-Cyrl", "uz-Latn-UZ", "uz-Latn",
+ "vai-Latn-LR", "vai-Latn", "vai-Vaii-LR", "vai-Vaii", "vi-VN", "vo-001",
+ "vun-TZ", "wae-CH", "wo-SN", "xog-UG", "yav-CM", "yi-001", "yo-BJ", "yo-NG",
+ "yue-Hans-CN", "yue-Hant-HK", "yue-Hant", "zgh-MA", "zh-Hans-CN",
+ "zh-Hans-HK", "zh-Hans-MO", "zh-Hans-SG", "zh-Hans", "zh-Hant-HK",
+ "zh-Hant-MO", "zh-Hant-TW", "zu-ZA"];
+for (var i = 0; i < complexLocales.length; i++) {
+ assertReduceRoundTrip(new Intl.Locale(complexLocales[i]));
+}
diff --git a/deps/v8/test/intl/locale/regress-8032.js b/deps/v8/test/intl/locale/regress-8032.js
new file mode 100644
index 0000000000..b8219b1b50
--- /dev/null
+++ b/deps/v8/test/intl/locale/regress-8032.js
@@ -0,0 +1,7 @@
+// 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-locale
+
+assertThrows(() => new Intl.Locale(''), RangeError);
diff --git a/deps/v8/test/intl/number-format/options.js b/deps/v8/test/intl/number-format/options.js
new file mode 100644
index 0000000000..80ddc025d1
--- /dev/null
+++ b/deps/v8/test/intl/number-format/options.js
@@ -0,0 +1,13 @@
+// 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.
+
+assertThrows(() => new Intl.NumberFormat('en', null));
+assertDoesNotThrow(() => new Intl.NumberFormat('en', undefined));
+
+for (let key of [false, true, "foo", Symbol, 1]) {
+ assertDoesNotThrow(() => new Intl.NumberFormat('en', key));
+}
+
+assertDoesNotThrow(() => new Intl.NumberFormat('en', {}));
+assertDoesNotThrow(() => new Intl.NumberFormat('en', new Proxy({}, {})));
diff --git a/deps/v8/test/intl/regress-8030.js b/deps/v8/test/intl/regress-8030.js
new file mode 100644
index 0000000000..eac6b84f81
--- /dev/null
+++ b/deps/v8/test/intl/regress-8030.js
@@ -0,0 +1,21 @@
+// 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-intl-relative-time-format
+
+var locales = ["tlh", "id", "en"];
+var referenceRelativeTimeFormat = new Intl.RelativeTimeFormat(locales);
+var referenceFormatted = referenceRelativeTimeFormat.format(3, "day");
+
+class MyFormat extends Intl.RelativeTimeFormat {
+ constructor(locales, options) {
+ super(locales, options);
+ // could initialize MyRelativeTimeFormat properties
+ }
+ // could add methods to MyRelativeTimeFormat.prototype
+}
+
+var format = new MyFormat(locales);
+var actual = format.format(3, "day");
+assertEquals(actual, referenceFormatted);
diff --git a/deps/v8/test/intl/regress-8031.js b/deps/v8/test/intl/regress-8031.js
new file mode 100644
index 0000000000..0898026d99
--- /dev/null
+++ b/deps/v8/test/intl/regress-8031.js
@@ -0,0 +1,22 @@
+// 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-intl-list-format
+
+var locales = ["tlh", "id", "en"];
+var input = ["a", "b", "c"];
+var referenceListFormat = new Intl.ListFormat(locales);
+var referenceFormatted = referenceListFormat.format(input);
+
+class MyFormat extends Intl.ListFormat {
+ constructor(locales, options) {
+ super(locales, options);
+ // could initialize MyListFormat properties
+ }
+ // could add methods to MyListFormat.prototype
+}
+
+var format = new MyFormat(locales);
+var actual = format.format(input);
+assertEquals(actual, referenceFormatted);
diff --git a/deps/v8/test/intl/regress-8725514.js b/deps/v8/test/intl/regress-8725514.js
new file mode 100644
index 0000000000..82f884a093
--- /dev/null
+++ b/deps/v8/test/intl/regress-8725514.js
@@ -0,0 +1,10 @@
+// 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.
+
+Object.prototype.__defineGetter__('x', function () {
+ return -2147483648;
+ });
+
+var f = ["x-u-foo"];
+Intl.NumberFormat(f);
diff --git a/deps/v8/test/intl/regress-875643.js b/deps/v8/test/intl/regress-875643.js
new file mode 100644
index 0000000000..2625c8110f
--- /dev/null
+++ b/deps/v8/test/intl/regress-875643.js
@@ -0,0 +1,5 @@
+// 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.
+
+new Intl.NumberFormat(undefined, false)
diff --git a/deps/v8/test/intl/relative-time-format/format-en.js b/deps/v8/test/intl/relative-time-format/format-en.js
new file mode 100644
index 0000000000..cd58d65355
--- /dev/null
+++ b/deps/v8/test/intl/relative-time-format/format-en.js
@@ -0,0 +1,502 @@
+// 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-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.
+// NOTE: These are UNSPECIFIED behavior in
+// http://tc39.github.io/proposal-intl-relative-time/
+
+let longAuto = new Intl.RelativeTimeFormat(
+ "en", {style: "long", localeMatcher: 'lookup', numeric: 'auto'});
+
+assertEquals('3 seconds ago', longAuto.format(-3, 'second'));
+assertEquals('2 seconds ago', longAuto.format(-2, 'second'));
+assertEquals('1 second ago', longAuto.format(-1, 'second'));
+assertEquals('now', longAuto.format(0, 'second'));
+assertEquals('now', longAuto.format(-0, 'second'));
+assertEquals('in 1 second', longAuto.format(1, 'second'));
+assertEquals('in 2 seconds', longAuto.format(2, 'second'));
+assertEquals('in 345 seconds', longAuto.format(345, 'second'));
+
+assertEquals('3 minutes ago', longAuto.format(-3, 'minute'));
+assertEquals('2 minutes ago', longAuto.format(-2, 'minute'));
+assertEquals('1 minute ago', longAuto.format(-1, 'minute'));
+assertEquals('in 0 minutes', longAuto.format(0, 'minute'));
+assertEquals('0 minutes ago', longAuto.format(-0, 'minute'));
+assertEquals('in 1 minute', longAuto.format(1, 'minute'));
+assertEquals('in 2 minutes', longAuto.format(2, 'minute'));
+assertEquals('in 345 minutes', longAuto.format(345, 'minute'));
+
+assertEquals('3 hours ago', longAuto.format(-3, 'hour'));
+assertEquals('2 hours ago', longAuto.format(-2, 'hour'));
+assertEquals('1 hour ago', longAuto.format(-1, 'hour'));
+assertEquals('in 0 hours', longAuto.format(0, 'hour'));
+assertEquals('0 hours ago', longAuto.format(-0, 'hour'));
+assertEquals('in 1 hour', longAuto.format(1, 'hour'));
+assertEquals('in 2 hours', longAuto.format(2, 'hour'));
+assertEquals('in 345 hours', longAuto.format(345, 'hour'));
+
+assertEquals('3 days ago', longAuto.format(-3, 'day'));
+assertEquals('2 days ago', longAuto.format(-2, 'day'));
+assertEquals('yesterday', longAuto.format(-1, 'day'));
+assertEquals('today', longAuto.format(0, 'day'));
+assertEquals('today', longAuto.format(-0, 'day'));
+assertEquals('tomorrow', longAuto.format(1, 'day'));
+assertEquals('in 2 days', longAuto.format(2, 'day'));
+assertEquals('in 345 days', longAuto.format(345, 'day'));
+
+assertEquals('3 weeks ago', longAuto.format(-3, 'week'));
+assertEquals('2 weeks ago', longAuto.format(-2, 'week'));
+assertEquals('last week', longAuto.format(-1, 'week'));
+assertEquals('this week', longAuto.format(0, 'week'));
+assertEquals('this week', longAuto.format(-0, 'week'));
+assertEquals('next week', longAuto.format(1, 'week'));
+assertEquals('in 2 weeks', longAuto.format(2, 'week'));
+assertEquals('in 345 weeks', longAuto.format(345, 'week'));
+
+assertEquals('3 months ago', longAuto.format(-3, 'month'));
+assertEquals('2 months ago', longAuto.format(-2, 'month'));
+assertEquals('last month', longAuto.format(-1, 'month'));
+assertEquals('this month', longAuto.format(0, 'month'));
+assertEquals('this month', longAuto.format(-0, 'month'));
+assertEquals('next month', longAuto.format(1, 'month'));
+assertEquals('in 2 months', longAuto.format(2, 'month'));
+assertEquals('in 345 months', longAuto.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+// Tracked by ICU bug in http://bugs.icu-project.org/trac/ticket/12171
+/*
+assertEquals('3 quarters ago', longAuto.format(-3, 'quarter'));
+assertEquals('2 quarters ago', longAuto.format(-2, 'quarter'));
+assertEquals('last quarter', longAuto.format(-1, 'quarter'));
+assertEquals('this quarter', longAuto.format(0, 'quarter'));
+assertEquals('this quarter', longAuto.format(-0, 'quarter'));
+assertEquals('next quarter', longAuto.format(1, 'quarter'));
+assertEquals('in 2 quarters', longAuto.format(2, 'quarter'));
+assertEquals('in 345 quarters', longAuto.format(345, 'quarter'));
+*/
+
+assertEquals('3 years ago', longAuto.format(-3, 'year'));
+assertEquals('2 years ago', longAuto.format(-2, 'year'));
+assertEquals('last year', longAuto.format(-1, 'year'));
+assertEquals('this year', longAuto.format(0, 'year'));
+assertEquals('this year', longAuto.format(-0, 'year'));
+assertEquals('next year', longAuto.format(1, 'year'));
+assertEquals('in 2 years', longAuto.format(2, 'year'));
+assertEquals('in 345 years', longAuto.format(345, 'year'));
+
+let shortAuto = new Intl.RelativeTimeFormat(
+ "en", {style: "short", localeMatcher: 'lookup', numeric: 'auto'});
+
+assertEquals('3 sec. ago', shortAuto.format(-3, 'second'));
+assertEquals('2 sec. ago', shortAuto.format(-2, 'second'));
+assertEquals('1 sec. ago', shortAuto.format(-1, 'second'));
+assertEquals('now', shortAuto.format(0, 'second'));
+assertEquals('now', shortAuto.format(-0, 'second'));
+assertEquals('in 1 sec.', shortAuto.format(1, 'second'));
+assertEquals('in 2 sec.', shortAuto.format(2, 'second'));
+assertEquals('in 345 sec.', shortAuto.format(345, 'second'));
+
+assertEquals('3 min. ago', shortAuto.format(-3, 'minute'));
+assertEquals('2 min. ago', shortAuto.format(-2, 'minute'));
+assertEquals('1 min. ago', shortAuto.format(-1, 'minute'));
+assertEquals('in 0 min.', shortAuto.format(0, 'minute'));
+assertEquals('0 min. ago', shortAuto.format(-0, 'minute'));
+assertEquals('in 1 min.', shortAuto.format(1, 'minute'));
+assertEquals('in 2 min.', shortAuto.format(2, 'minute'));
+assertEquals('in 345 min.', shortAuto.format(345, 'minute'));
+
+assertEquals('3 hr. ago', shortAuto.format(-3, 'hour'));
+assertEquals('2 hr. ago', shortAuto.format(-2, 'hour'));
+assertEquals('1 hr. ago', shortAuto.format(-1, 'hour'));
+assertEquals('in 0 hr.', shortAuto.format(0, 'hour'));
+assertEquals('0 hr. ago', shortAuto.format(-0, 'hour'));
+assertEquals('in 1 hr.', shortAuto.format(1, 'hour'));
+assertEquals('in 2 hr.', shortAuto.format(2, 'hour'));
+assertEquals('in 345 hr.', shortAuto.format(345, 'hour'));
+
+assertEquals('3 days ago', shortAuto.format(-3, 'day'));
+assertEquals('2 days ago', shortAuto.format(-2, 'day'));
+assertEquals('yesterday', shortAuto.format(-1, 'day'));
+assertEquals('today', shortAuto.format(0, 'day'));
+assertEquals('today', shortAuto.format(-0, 'day'));
+assertEquals('tomorrow', shortAuto.format(1, 'day'));
+assertEquals('in 2 days', shortAuto.format(2, 'day'));
+assertEquals('in 345 days', shortAuto.format(345, 'day'));
+
+assertEquals('3 wk. ago', shortAuto.format(-3, 'week'));
+assertEquals('2 wk. ago', shortAuto.format(-2, 'week'));
+assertEquals('last wk.', shortAuto.format(-1, 'week'));
+assertEquals('this wk.', shortAuto.format(0, 'week'));
+assertEquals('this wk.', shortAuto.format(-0, 'week'));
+assertEquals('next wk.', shortAuto.format(1, 'week'));
+assertEquals('in 2 wk.', shortAuto.format(2, 'week'));
+assertEquals('in 345 wk.', shortAuto.format(345, 'week'));
+
+assertEquals('3 mo. ago', shortAuto.format(-3, 'month'));
+assertEquals('2 mo. ago', shortAuto.format(-2, 'month'));
+assertEquals('last mo.', shortAuto.format(-1, 'month'));
+assertEquals('this mo.', shortAuto.format(0, 'month'));
+assertEquals('this mo.', shortAuto.format(-0, 'month'));
+assertEquals('next mo.', shortAuto.format(1, 'month'));
+assertEquals('in 2 mo.', shortAuto.format(2, 'month'));
+assertEquals('in 345 mo.', shortAuto.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+/*
+assertEquals('3 qtrs. ago', shortAuto.format(-3, 'quarter'));
+assertEquals('2 qtrs. ago', shortAuto.format(-2, 'quarter'));
+assertEquals('last qtr.', shortAuto.format(-1, 'quarter'));
+assertEquals('this qtr.', shortAuto.format(0, 'quarter'));
+assertEquals('this qtr.', shortAuto.format(-0, 'quarter'));
+assertEquals('next qtr.', shortAuto.format(1, 'quarter'));
+assertEquals('in 2 qtrs.', shortAuto.format(2, 'quarter'));
+assertEquals('in 345 qtrs.', shortAuto.format(345, 'quarter'));
+*/
+
+assertEquals('3 yr. ago', shortAuto.format(-3, 'year'));
+assertEquals('2 yr. ago', shortAuto.format(-2, 'year'));
+assertEquals('last yr.', shortAuto.format(-1, 'year'));
+assertEquals('this yr.', shortAuto.format(0, 'year'));
+assertEquals('this yr.', shortAuto.format(-0, 'year'));
+assertEquals('next yr.', shortAuto.format(1, 'year'));
+assertEquals('in 2 yr.', shortAuto.format(2, 'year'));
+assertEquals('in 345 yr.', shortAuto.format(345, 'year'));
+
+// Somehow in the 'en' locale, there are no valeu for -narrow
+let narrowAuto = new Intl.RelativeTimeFormat(
+ "en", {style: "narrow", localeMatcher: 'lookup', numeric: 'auto'});
+
+assertEquals('3 sec. ago', narrowAuto.format(-3, 'second'));
+assertEquals('2 sec. ago', narrowAuto.format(-2, 'second'));
+assertEquals('1 sec. ago', narrowAuto.format(-1, 'second'));
+assertEquals('now', narrowAuto.format(0, 'second'));
+assertEquals('now', narrowAuto.format(-0, 'second'));
+assertEquals('in 1 sec.', narrowAuto.format(1, 'second'));
+assertEquals('in 2 sec.', narrowAuto.format(2, 'second'));
+assertEquals('in 345 sec.', narrowAuto.format(345, 'second'));
+
+assertEquals('3 min. ago', narrowAuto.format(-3, 'minute'));
+assertEquals('2 min. ago', narrowAuto.format(-2, 'minute'));
+assertEquals('1 min. ago', narrowAuto.format(-1, 'minute'));
+assertEquals('in 0 min.', narrowAuto.format(0, 'minute'));
+assertEquals('0 min. ago', narrowAuto.format(-0, 'minute'));
+assertEquals('in 1 min.', narrowAuto.format(1, 'minute'));
+assertEquals('in 2 min.', narrowAuto.format(2, 'minute'));
+assertEquals('in 345 min.', narrowAuto.format(345, 'minute'));
+
+assertEquals('3 hr. ago', narrowAuto.format(-3, 'hour'));
+assertEquals('2 hr. ago', narrowAuto.format(-2, 'hour'));
+assertEquals('1 hr. ago', narrowAuto.format(-1, 'hour'));
+assertEquals('in 0 hr.', narrowAuto.format(0, 'hour'));
+assertEquals('0 hr. ago', narrowAuto.format(-0, 'hour'));
+assertEquals('in 1 hr.', narrowAuto.format(1, 'hour'));
+assertEquals('in 2 hr.', narrowAuto.format(2, 'hour'));
+assertEquals('in 345 hr.', narrowAuto.format(345, 'hour'));
+
+assertEquals('3 days ago', narrowAuto.format(-3, 'day'));
+assertEquals('2 days ago', narrowAuto.format(-2, 'day'));
+assertEquals('yesterday', narrowAuto.format(-1, 'day'));
+assertEquals('today', narrowAuto.format(0, 'day'));
+assertEquals('today', narrowAuto.format(-0, 'day'));
+assertEquals('tomorrow', narrowAuto.format(1, 'day'));
+assertEquals('in 2 days', narrowAuto.format(2, 'day'));
+assertEquals('in 345 days', narrowAuto.format(345, 'day'));
+
+assertEquals('3 wk. ago', narrowAuto.format(-3, 'week'));
+assertEquals('2 wk. ago', narrowAuto.format(-2, 'week'));
+assertEquals('last wk.', narrowAuto.format(-1, 'week'));
+assertEquals('this wk.', narrowAuto.format(0, 'week'));
+assertEquals('this wk.', narrowAuto.format(-0, 'week'));
+assertEquals('next wk.', narrowAuto.format(1, 'week'));
+assertEquals('in 2 wk.', narrowAuto.format(2, 'week'));
+assertEquals('in 345 wk.', narrowAuto.format(345, 'week'));
+
+assertEquals('3 mo. ago', narrowAuto.format(-3, 'month'));
+assertEquals('2 mo. ago', narrowAuto.format(-2, 'month'));
+assertEquals('last mo.', narrowAuto.format(-1, 'month'));
+assertEquals('this mo.', narrowAuto.format(0, 'month'));
+assertEquals('this mo.', narrowAuto.format(-0, 'month'));
+assertEquals('next mo.', narrowAuto.format(1, 'month'));
+assertEquals('in 2 mo.', narrowAuto.format(2, 'month'));
+assertEquals('in 345 mo.', narrowAuto.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+/*
+assertEquals('3 qtrs. ago', narrowAuto.format(-3, 'quarter'));
+assertEquals('2 qtrs. ago', narrowAuto.format(-2, 'quarter'));
+assertEquals('last qtr.', narrowAuto.format(-1, 'quarter'));
+assertEquals('this qtr.', narrowAuto.format(0, 'quarter'));
+assertEquals('this qtr.', narrowAuto.format(-0, 'quarter'));
+assertEquals('next qtr.', narrowAuto.format(1, 'quarter'));
+assertEquals('in 2 qtrs.', narrowAuto.format(2, 'quarter'));
+assertEquals('in 345 qtrs.', narrowAuto.format(345, 'quarter'));
+*/
+
+assertEquals('3 yr. ago', narrowAuto.format(-3, 'year'));
+assertEquals('2 yr. ago', narrowAuto.format(-2, 'year'));
+assertEquals('last yr.', narrowAuto.format(-1, 'year'));
+assertEquals('this yr.', narrowAuto.format(0, 'year'));
+assertEquals('this yr.', narrowAuto.format(-0, 'year'));
+assertEquals('next yr.', narrowAuto.format(1, 'year'));
+assertEquals('in 2 yr.', narrowAuto.format(2, 'year'));
+assertEquals('in 345 yr.', narrowAuto.format(345, 'year'));
+
+let longAlways = new Intl.RelativeTimeFormat(
+ "en", {style: "long", localeMatcher: 'lookup', numeric: 'always'});
+
+assertEquals('3 seconds ago', longAlways.format(-3, 'second'));
+assertEquals('2 seconds ago', longAlways.format(-2, 'second'));
+assertEquals('1 second ago', longAlways.format(-1, 'second'));
+assertEquals('in 0 seconds', longAlways.format(0, 'second'));
+assertEquals('0 seconds ago', longAlways.format(-0, 'second'));
+assertEquals('in 1 second', longAlways.format(1, 'second'));
+assertEquals('in 2 seconds', longAlways.format(2, 'second'));
+assertEquals('in 345 seconds', longAlways.format(345, 'second'));
+
+assertEquals('3 minutes ago', longAlways.format(-3, 'minute'));
+assertEquals('2 minutes ago', longAlways.format(-2, 'minute'));
+assertEquals('1 minute ago', longAlways.format(-1, 'minute'));
+assertEquals('in 0 minutes', longAlways.format(0, 'minute'));
+assertEquals('0 minutes ago', longAlways.format(-0, 'minute'));
+assertEquals('in 1 minute', longAlways.format(1, 'minute'));
+assertEquals('in 2 minutes', longAlways.format(2, 'minute'));
+assertEquals('in 345 minutes', longAlways.format(345, 'minute'));
+
+assertEquals('3 hours ago', longAlways.format(-3, 'hour'));
+assertEquals('2 hours ago', longAlways.format(-2, 'hour'));
+assertEquals('1 hour ago', longAlways.format(-1, 'hour'));
+assertEquals('in 0 hours', longAlways.format(0, 'hour'));
+assertEquals('0 hours ago', longAlways.format(-0, 'hour'));
+assertEquals('in 1 hour', longAlways.format(1, 'hour'));
+assertEquals('in 2 hours', longAlways.format(2, 'hour'));
+assertEquals('in 345 hours', longAlways.format(345, 'hour'));
+
+assertEquals('3 days ago', longAlways.format(-3, 'day'));
+assertEquals('2 days ago', longAlways.format(-2, 'day'));
+assertEquals('1 day ago', longAlways.format(-1, 'day'));
+assertEquals('in 0 days', longAlways.format(0, 'day'));
+assertEquals('0 days ago', longAlways.format(-0, 'day'));
+assertEquals('in 1 day', longAlways.format(1, 'day'));
+assertEquals('in 2 days', longAlways.format(2, 'day'));
+assertEquals('in 345 days', longAlways.format(345, 'day'));
+
+assertEquals('3 weeks ago', longAlways.format(-3, 'week'));
+assertEquals('2 weeks ago', longAlways.format(-2, 'week'));
+assertEquals('1 week ago', longAlways.format(-1, 'week'));
+assertEquals('in 0 weeks', longAlways.format(0, 'week'));
+assertEquals('0 weeks ago', longAlways.format(-0, 'week'));
+assertEquals('in 1 week', longAlways.format(1, 'week'));
+assertEquals('in 2 weeks', longAlways.format(2, 'week'));
+assertEquals('in 345 weeks', longAlways.format(345, 'week'));
+
+assertEquals('3 months ago', longAlways.format(-3, 'month'));
+assertEquals('2 months ago', longAlways.format(-2, 'month'));
+assertEquals('1 month ago', longAlways.format(-1, 'month'));
+assertEquals('in 0 months', longAlways.format(0, 'month'));
+assertEquals('0 months ago', longAlways.format(-0, 'month'));
+assertEquals('in 1 month', longAlways.format(1, 'month'));
+assertEquals('in 2 months', longAlways.format(2, 'month'));
+assertEquals('in 345 months', longAlways.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+/*
+assertEquals('3 quarters ago', longAlways.format(-3, 'quarter'));
+assertEquals('2 quarters ago', longAlways.format(-2, 'quarter'));
+assertEquals('1 quarter ago', longAlways.format(-1, 'quarter'));
+assertEquals('in 0 quarters', longAlways.format(0, 'quarter'));
+assertEquals('0 quarters ago', longAlways.format(-0, 'quarter'));
+assertEquals('in 1 quarter', longAlways.format(1, 'quarter'));
+assertEquals('in 2 quarters', longAlways.format(2, 'quarter'));
+assertEquals('in 345 quarters', longAlways.format(345, 'quarter'));
+*/
+
+assertEquals('3 years ago', longAlways.format(-3, 'year'));
+assertEquals('2 years ago', longAlways.format(-2, 'year'));
+assertEquals('1 year ago', longAlways.format(-1, 'year'));
+assertEquals('in 0 years', longAlways.format(0, 'year'));
+assertEquals('0 years ago', longAlways.format(-0, 'year'));
+assertEquals('in 1 year', longAlways.format(1, 'year'));
+assertEquals('in 2 years', longAlways.format(2, 'year'));
+assertEquals('in 345 years', longAlways.format(345, 'year'));
+
+let shortAlways = new Intl.RelativeTimeFormat(
+ "en", {style: "short", localeMatcher: 'lookup', numeric: 'always'});
+
+assertEquals('3 sec. ago', shortAlways.format(-3, 'second'));
+assertEquals('2 sec. ago', shortAlways.format(-2, 'second'));
+assertEquals('1 sec. ago', shortAlways.format(-1, 'second'));
+assertEquals('in 0 sec.', shortAlways.format(0, 'second'));
+assertEquals('0 sec. ago', shortAlways.format(-0, 'second'));
+assertEquals('in 1 sec.', shortAlways.format(1, 'second'));
+assertEquals('in 2 sec.', shortAlways.format(2, 'second'));
+assertEquals('in 345 sec.', shortAlways.format(345, 'second'));
+
+assertEquals('3 min. ago', shortAlways.format(-3, 'minute'));
+assertEquals('2 min. ago', shortAlways.format(-2, 'minute'));
+assertEquals('1 min. ago', shortAlways.format(-1, 'minute'));
+assertEquals('in 0 min.', shortAlways.format(0, 'minute'));
+assertEquals('0 min. ago', shortAlways.format(-0, 'minute'));
+assertEquals('in 1 min.', shortAlways.format(1, 'minute'));
+assertEquals('in 2 min.', shortAlways.format(2, 'minute'));
+assertEquals('in 345 min.', shortAlways.format(345, 'minute'));
+
+assertEquals('3 hr. ago', shortAlways.format(-3, 'hour'));
+assertEquals('2 hr. ago', shortAlways.format(-2, 'hour'));
+assertEquals('1 hr. ago', shortAlways.format(-1, 'hour'));
+assertEquals('in 0 hr.', shortAlways.format(0, 'hour'));
+assertEquals('0 hr. ago', shortAlways.format(-0, 'hour'));
+assertEquals('in 1 hr.', shortAlways.format(1, 'hour'));
+assertEquals('in 2 hr.', shortAlways.format(2, 'hour'));
+assertEquals('in 345 hr.', shortAlways.format(345, 'hour'));
+
+assertEquals('3 days ago', shortAlways.format(-3, 'day'));
+assertEquals('2 days ago', shortAlways.format(-2, 'day'));
+assertEquals('1 day ago', shortAlways.format(-1, 'day'));
+assertEquals('in 0 days', shortAlways.format(0, 'day'));
+assertEquals('0 days ago', shortAlways.format(-0, 'day'));
+assertEquals('in 1 day', shortAlways.format(1, 'day'));
+assertEquals('in 2 days', shortAlways.format(2, 'day'));
+assertEquals('in 345 days', shortAlways.format(345, 'day'));
+
+assertEquals('3 wk. ago', shortAlways.format(-3, 'week'));
+assertEquals('2 wk. ago', shortAlways.format(-2, 'week'));
+assertEquals('1 wk. ago', shortAlways.format(-1, 'week'));
+assertEquals('in 0 wk.', shortAlways.format(0, 'week'));
+assertEquals('0 wk. ago', shortAlways.format(-0, 'week'));
+assertEquals('in 1 wk.', shortAlways.format(1, 'week'));
+assertEquals('in 2 wk.', shortAlways.format(2, 'week'));
+assertEquals('in 345 wk.', shortAlways.format(345, 'week'));
+
+assertEquals('3 mo. ago', shortAlways.format(-3, 'month'));
+assertEquals('2 mo. ago', shortAlways.format(-2, 'month'));
+assertEquals('1 mo. ago', shortAlways.format(-1, 'month'));
+assertEquals('in 0 mo.', shortAlways.format(0, 'month'));
+assertEquals('0 mo. ago', shortAlways.format(-0, 'month'));
+assertEquals('in 1 mo.', shortAlways.format(1, 'month'));
+assertEquals('in 2 mo.', shortAlways.format(2, 'month'));
+assertEquals('in 345 mo.', shortAlways.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+/*
+assertEquals('3 qtrs. ago', shortAlways.format(-3, 'quarter'));
+assertEquals('2 qtrs. ago', shortAlways.format(-2, 'quarter'));
+assertEquals('1 qtr. ago', shortAlways.format(-1, 'quarter'));
+assertEquals('in 0 qtrs.', shortAlways.format(0, 'quarter'));
+assertEquals('0 qtr. ago', shortAlways.format(-0, 'quarter'));
+assertEquals('in 1 qtr.', shortAlways.format(1, 'quarter'));
+assertEquals('in 2 qtrs.', shortAlways.format(2, 'quarter'));
+assertEquals('in 345 qtrs.', shortAlways.format(345, 'quarter'));
+*/
+
+assertEquals('3 yr. ago', shortAlways.format(-3, 'year'));
+assertEquals('2 yr. ago', shortAlways.format(-2, 'year'));
+assertEquals('1 yr. ago', shortAlways.format(-1, 'year'));
+assertEquals('in 0 yr.', shortAlways.format(0, 'year'));
+assertEquals('0 yr. ago', shortAlways.format(-0, 'year'));
+assertEquals('in 1 yr.', shortAlways.format(1, 'year'));
+assertEquals('in 2 yr.', shortAlways.format(2, 'year'));
+assertEquals('in 345 yr.', shortAlways.format(345, 'year'));
+
+// Somehow in the 'en' locale, there are no valeu for -narrow
+let narrowAlways = new Intl.RelativeTimeFormat(
+ "en", {style: "narrow", localeMatcher: 'lookup', numeric: 'always'});
+
+assertEquals('3 sec. ago', narrowAlways.format(-3, 'second'));
+assertEquals('2 sec. ago', narrowAlways.format(-2, 'second'));
+assertEquals('1 sec. ago', narrowAlways.format(-1, 'second'));
+assertEquals('in 0 sec.', narrowAlways.format(0, 'second'));
+assertEquals('0 sec. ago', narrowAlways.format(-0, 'second'));
+assertEquals('in 1 sec.', narrowAlways.format(1, 'second'));
+assertEquals('in 2 sec.', narrowAlways.format(2, 'second'));
+assertEquals('in 345 sec.', narrowAlways.format(345, 'second'));
+
+assertEquals('3 min. ago', narrowAlways.format(-3, 'minute'));
+assertEquals('2 min. ago', narrowAlways.format(-2, 'minute'));
+assertEquals('1 min. ago', narrowAlways.format(-1, 'minute'));
+assertEquals('in 0 min.', narrowAlways.format(0, 'minute'));
+assertEquals('0 min. ago', narrowAlways.format(-0, 'minute'));
+assertEquals('in 1 min.', narrowAlways.format(1, 'minute'));
+assertEquals('in 2 min.', narrowAlways.format(2, 'minute'));
+assertEquals('in 345 min.', narrowAlways.format(345, 'minute'));
+
+assertEquals('3 hr. ago', narrowAlways.format(-3, 'hour'));
+assertEquals('2 hr. ago', narrowAlways.format(-2, 'hour'));
+assertEquals('1 hr. ago', narrowAlways.format(-1, 'hour'));
+assertEquals('in 0 hr.', narrowAlways.format(0, 'hour'));
+assertEquals('0 hr. ago', narrowAlways.format(-0, 'hour'));
+assertEquals('in 1 hr.', narrowAlways.format(1, 'hour'));
+assertEquals('in 2 hr.', narrowAlways.format(2, 'hour'));
+assertEquals('in 345 hr.', narrowAlways.format(345, 'hour'));
+
+assertEquals('3 days ago', narrowAlways.format(-3, 'day'));
+assertEquals('2 days ago', narrowAlways.format(-2, 'day'));
+assertEquals('1 day ago', narrowAlways.format(-1, 'day'));
+assertEquals('in 0 days', narrowAlways.format(0, 'day'));
+assertEquals('0 days ago', narrowAlways.format(-0, 'day'));
+assertEquals('in 1 day', narrowAlways.format(1, 'day'));
+assertEquals('in 2 days', narrowAlways.format(2, 'day'));
+assertEquals('in 345 days', narrowAlways.format(345, 'day'));
+
+assertEquals('3 wk. ago', narrowAlways.format(-3, 'week'));
+assertEquals('2 wk. ago', narrowAlways.format(-2, 'week'));
+assertEquals('1 wk. ago', narrowAlways.format(-1, 'week'));
+assertEquals('in 0 wk.', narrowAlways.format(0, 'week'));
+assertEquals('0 wk. ago', narrowAlways.format(-0, 'week'));
+assertEquals('in 1 wk.', narrowAlways.format(1, 'week'));
+assertEquals('in 2 wk.', narrowAlways.format(2, 'week'));
+assertEquals('in 345 wk.', narrowAlways.format(345, 'week'));
+
+assertEquals('3 mo. ago', narrowAlways.format(-3, 'month'));
+assertEquals('2 mo. ago', narrowAlways.format(-2, 'month'));
+assertEquals('1 mo. ago', narrowAlways.format(-1, 'month'));
+assertEquals('in 0 mo.', narrowAlways.format(0, 'month'));
+assertEquals('0 mo. ago', narrowAlways.format(-0, 'month'));
+assertEquals('in 1 mo.', narrowAlways.format(1, 'month'));
+assertEquals('in 2 mo.', narrowAlways.format(2, 'month'));
+assertEquals('in 345 mo.', narrowAlways.format(345, 'month'));
+
+// "quarter" is not working in ICU now
+/*
+assertEquals('3 qtrs. ago', narrowAlways.format(-3, 'quarter'));
+assertEquals('2 qtrs. ago', narrowAlways.format(-2, 'quarter'));
+assertEquals('1 qtr. ago', narrowAlways.format(-1, 'quarter'));
+assertEquals('in 0 qtrs.', narrowAlways.format(0, 'quarter'));
+assertEquals('0 qtr. ago', narrowAlways.format(-0, 'quarter'));
+assertEquals('in 1 qtr.', narrowAlways.format(1, 'quarter'));
+assertEquals('in 2 qtrs.', narrowAlways.format(2, 'quarter'));
+assertEquals('in 345 qtrs.', narrowAlways.format(345, 'quarter'));
+*/
+
+assertEquals('3 yr. ago', narrowAlways.format(-3, 'year'));
+assertEquals('2 yr. ago', narrowAlways.format(-2, 'year'));
+assertEquals('1 yr. ago', narrowAlways.format(-1, 'year'));
+assertEquals('in 0 yr.', narrowAlways.format(0, 'year'));
+assertEquals('0 yr. ago', narrowAlways.format(-0, 'year'));
+assertEquals('in 1 yr.', narrowAlways.format(1, 'year'));
+assertEquals('in 2 yr.', narrowAlways.format(2, 'year'));
+assertEquals('in 345 yr.', narrowAlways.format(345, 'year'));
+
+var styleNumericCombinations = [
+ longAuto, shortAuto, narrowAuto, longAlways,
+ shortAlways, narrowAlways ];
+var validUnits = [
+ 'second', 'minute', 'hour', 'day', 'week', 'month', 'quarter', 'year'];
+
+// Test these all throw RangeError
+for (var i = 0; i < styleNumericCombinations.length; i++) {
+ for (var j = 0; j < validUnits.length; j++) {
+ assertThrows(() => styleNumericCombinations[i].format(NaN, validUnits[j]),
+ RangeError);
+ assertThrows(() => styleNumericCombinations[i].format(NaN, validUnits[j] + 's'),
+ RangeError);
+ assertThrows(() => styleNumericCombinations[i].format(NaN, validUnits[j]),
+ RangeError);
+ assertThrows(() => styleNumericCombinations[i].format(NaN, validUnits[j] + 's'),
+ RangeError);
+ }
+}
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
new file mode 100644
index 0000000000..52a0b885d7
--- /dev/null
+++ b/deps/v8/test/intl/relative-time-format/format-to-parts-en.js
@@ -0,0 +1,68 @@
+// 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-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.
+// NOTE: These are UNSPECIFIED behavior in
+// http://tc39.github.io/proposal-intl-relative-time/
+
+// From Sample code in https://github.com/tc39/proposal-intl-relative-time#intlrelativetimeformatprototypeformattopartsvalue-unit
+// // Format relative time using the day unit.
+// rtf.formatToParts(-1, "day");
+// // > [{ type: "literal", value: "yesterday"}]
+let longAuto = new Intl.RelativeTimeFormat(
+ "en", {style: "long", localeMatcher: 'lookup', numeric: 'auto'});
+var parts = longAuto.formatToParts(-1, "day");
+assertEquals(1, parts.length);
+assertEquals(2, Object.getOwnPropertyNames(parts[0]).length);
+assertEquals('literal', parts[0].type);
+assertEquals('yesterday', parts[0].value);
+
+// From Sample code in https://github.com/tc39/proposal-intl-relative-time#intlrelativetimeformatprototypeformattopartsvalue-unit
+// rtf.formatToParts(100, "day");
+// // > [{ type: "literal", value: "in " }, { type: "integer", value: "100", unit: "day" }, { type: "literal", value: " days" }]
+let longAlways = new Intl.RelativeTimeFormat(
+ "en", {style: "long", localeMatcher: 'lookup', numeric: 'always'});
+
+parts = longAlways.formatToParts(100, "day");
+assertEquals(3, parts.length);
+
+assertEquals(2, Object.getOwnPropertyNames(parts[0]).length);
+assertEquals('literal', parts[0].type);
+assertEquals('in ', parts[0].value);
+
+assertEquals(3, Object.getOwnPropertyNames(parts[1]).length);
+assertEquals('integer', parts[1].type);
+assertEquals('100', parts[1].value);
+assertEquals('day', parts[1].unit);
+
+assertEquals(2, Object.getOwnPropertyNames(parts[2]).length);
+assertEquals('literal', parts[2].type);
+assertEquals(' days', parts[2].value);
+
+assertThrows(() => longAlways.format(NaN, 'second'), RangeError);
+assertThrows(() => longAuto.format(NaN, 'second'), RangeError);
+
+parts = longAlways.formatToParts(-10, "day");
+assertEquals(2, parts.length);
+assertEquals(3, Object.getOwnPropertyNames(parts[0]).length);
+assertEquals('integer', parts[0].type);
+assertEquals('10', parts[0].value);
+assertEquals('day', parts[0].unit);
+assertEquals(2, Object.getOwnPropertyNames(parts[1]).length);
+assertEquals('literal', parts[1].type);
+assertEquals(' days ago', parts[1].value);
+
+parts = longAlways.formatToParts(-0, "day");
+assertEquals(2, parts.length);
+assertEquals(3, Object.getOwnPropertyNames(parts[0]).length);
+assertEquals('integer', parts[0].type);
+assertEquals('0', parts[0].value);
+assertEquals('day', parts[0].unit);
+assertEquals(2, Object.getOwnPropertyNames(parts[1]).length);
+assertEquals('literal', parts[1].type);
+assertEquals(' days ago', parts[1].value);
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
new file mode 100644
index 0000000000..071c4468c0
--- /dev/null
+++ b/deps/v8/test/intl/relative-time-format/format-to-parts.js
@@ -0,0 +1,82 @@
+// 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-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/
+
+let rtf = new Intl.RelativeTimeFormat();
+
+// Test 1.4.4 Intl.RelativeTimeFormat.prototype.formatToParts( value, unit )
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'seconds')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'second')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'minutes')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'minute')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'hours')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'hour')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'days')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'day')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'weeks')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'week')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'months')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'month')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'quarters')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'quarter')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'years')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-1, 'year')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'seconds')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'second')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'minutes')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'minute')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'hours')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'hour')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'days')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'day')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'weeks')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'week')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'months')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'month')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'quarters')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'quarter')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'years')));
+assertEquals(true, Array.isArray(rtf.formatToParts(-0, 'year')));
+
+assertThrows(() => rtf.formatToParts(-1, 'decades'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'decade'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'centuries'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'century'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'milliseconds'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'millisecond'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'microseconds'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'microsecond'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'nanoseconds'), RangeError);
+assertThrows(() => rtf.formatToParts(-1, 'nanosecond'), RangeError);
+
+assertThrows(() => rtf.formatToParts(NaN, 'seconds'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'second'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'minutes'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'minute'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'hours'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'hour'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'days'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'day'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'weeks'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'week'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'months'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'month'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'years'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'year'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'quarters'), RangeError);
+assertThrows(() => rtf.formatToParts(NaN, 'quarter'), RangeError);
+
+assertEquals(true, Array.isArray(rtf.formatToParts(100, 'day')));
+rtf.formatToParts(100, 'day').forEach(function(part) {
+ assertEquals(true, part.type == 'literal' || part.type == 'integer');
+ assertEquals('string', typeof part.value);
+ if (part.type == 'integer') {
+ assertEquals('string', typeof part.unit);
+ }
+});
diff --git a/deps/v8/test/intl/relative-time-format/format.js b/deps/v8/test/intl/relative-time-format/format.js
new file mode 100644
index 0000000000..769358423d
--- /dev/null
+++ b/deps/v8/test/intl/relative-time-format/format.js
@@ -0,0 +1,82 @@
+// 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-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/
+
+let rtf = new Intl.RelativeTimeFormat();
+
+// Test 1.4.3 Intl.RelativeTimeFormat.prototype.format( value, unit )
+assertEquals('string', typeof rtf.format(-1, 'seconds'));
+assertEquals('string', typeof rtf.format(-1, 'second'));
+assertEquals('string', typeof rtf.format(-1, 'minutes'));
+assertEquals('string', typeof rtf.format(-1, 'minute'));
+assertEquals('string', typeof rtf.format(-1, 'hours'));
+assertEquals('string', typeof rtf.format(-1, 'hour'));
+assertEquals('string', typeof rtf.format(-1, 'days'));
+assertEquals('string', typeof rtf.format(-1, 'day'));
+assertEquals('string', typeof rtf.format(-1, 'weeks'));
+assertEquals('string', typeof rtf.format(-1, 'week'));
+assertEquals('string', typeof rtf.format(-1, 'months'));
+assertEquals('string', typeof rtf.format(-1, 'month'));
+assertEquals('string', typeof rtf.format(-1, 'years'));
+assertEquals('string', typeof rtf.format(-1, 'year'));
+assertEquals('string', typeof rtf.format(-1, 'quarter'));
+assertEquals('string', typeof rtf.format(-1, 'quarters'));
+
+assertEquals('string', typeof rtf.format(-0, 'seconds'));
+assertEquals('string', typeof rtf.format(-0, 'second'));
+assertEquals('string', typeof rtf.format(-0, 'minutes'));
+assertEquals('string', typeof rtf.format(-0, 'minute'));
+assertEquals('string', typeof rtf.format(-0, 'hours'));
+assertEquals('string', typeof rtf.format(-0, 'hour'));
+assertEquals('string', typeof rtf.format(-0, 'days'));
+assertEquals('string', typeof rtf.format(-0, 'day'));
+assertEquals('string', typeof rtf.format(-0, 'weeks'));
+assertEquals('string', typeof rtf.format(-0, 'week'));
+assertEquals('string', typeof rtf.format(-0, 'months'));
+assertEquals('string', typeof rtf.format(-0, 'month'));
+assertEquals('string', typeof rtf.format(-0, 'years'));
+assertEquals('string', typeof rtf.format(-0, 'year'));
+assertEquals('string', typeof rtf.format(-0, 'quarter'));
+assertEquals('string', typeof rtf.format(-0, 'quarters'));
+
+assertThrows(() => rtf.format(NaN, 'seconds'), RangeError);
+assertThrows(() => rtf.format(NaN, 'second'), RangeError);
+assertThrows(() => rtf.format(NaN, 'minutes'), RangeError);
+assertThrows(() => rtf.format(NaN, 'minute'), RangeError);
+assertThrows(() => rtf.format(NaN, 'hours'), RangeError);
+assertThrows(() => rtf.format(NaN, 'hour'), RangeError);
+assertThrows(() => rtf.format(NaN, 'days'), RangeError);
+assertThrows(() => rtf.format(NaN, 'day'), RangeError);
+assertThrows(() => rtf.format(NaN, 'weeks'), RangeError);
+assertThrows(() => rtf.format(NaN, 'week'), RangeError);
+assertThrows(() => rtf.format(NaN, 'months'), RangeError);
+assertThrows(() => rtf.format(NaN, 'month'), RangeError);
+assertThrows(() => rtf.format(NaN, 'years'), RangeError);
+assertThrows(() => rtf.format(NaN, 'year'), RangeError);
+assertThrows(() => rtf.format(NaN, 'quarters'), RangeError);
+assertThrows(() => rtf.format(NaN, 'quarter'), RangeError);
+
+assertThrows(() => rtf.format(-1, 'decades'), RangeError);
+assertThrows(() => rtf.format(-1, 'decade'), RangeError);
+assertThrows(() => rtf.format(-1, 'centuries'), RangeError);
+assertThrows(() => rtf.format(-1, 'century'), RangeError);
+assertThrows(() => rtf.format(-1, 'milliseconds'), RangeError);
+assertThrows(() => rtf.format(-1, 'millisecond'), RangeError);
+assertThrows(() => rtf.format(-1, 'microseconds'), RangeError);
+assertThrows(() => rtf.format(-1, 'microsecond'), RangeError);
+assertThrows(() => rtf.format(-1, 'nanoseconds'), RangeError);
+assertThrows(() => rtf.format(-1, 'nanosecond'), RangeError);
+
+assertEquals('string', typeof rtf.format(5, 'day'));
+assertEquals('string', typeof rtf.format('5', 'day'));
+assertEquals('string', typeof rtf.format('-5', 'day'));
+assertEquals('string', typeof rtf.format('534', 'day'));
+assertEquals('string', typeof rtf.format('-534', 'day'));
+
+//assertThrows(() => rtf.format('xyz', 'day'), RangeError);
diff --git a/deps/v8/test/js-perf-test/Array/copy-within.js b/deps/v8/test/js-perf-test/Array/copy-within.js
new file mode 100644
index 0000000000..c3cf33b481
--- /dev/null
+++ b/deps/v8/test/js-perf-test/Array/copy-within.js
@@ -0,0 +1,43 @@
+// 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 kArraySize = 1000;
+const kQuarterSize = kArraySize / 4;
+
+let array = [];
+
+// Copy a quarter of the elements from the middle to the front.
+function CopyWithin() {
+ return new Function(
+ 'array.copyWithin(0, kQuarterSize * 2, kQuarterSize * 3);');
+}
+
+createSuite('SmiCopyWithin', 1000, CopyWithin, SmiCopyWithinSetup);
+createSuite('StringCopyWithin', 1000, CopyWithin, StringCopyWithinSetup);
+createSuite('SparseSmiCopyWithin', 1000, CopyWithin, SparseSmiCopyWithinSetup);
+createSuite(
+ 'SparseStringCopyWithin', 1000, CopyWithin, SparseStringCopyWithinSetup);
+
+function SmiCopyWithinSetup() {
+ array = [];
+ for (let i = 0; i < kArraySize; ++i) array[i] = i;
+}
+
+function StringCopyWithinSetup() {
+ array = [];
+ for (let i = 0; i < kArraySize; ++i) array[i] = `Item no. ${i}`;
+}
+
+function SparseSmiCopyWithinSetup() {
+ array = [];
+ for (let i = 0; i < kArraySize; i += 10) array[i] = i;
+}
+
+function SparseStringCopyWithinSetup() {
+ array = [];
+ for (let i = 0; i < kArraySize; i += 10) array[i] = `Item no. ${i}`;
+}
+
+})();
diff --git a/deps/v8/test/js-perf-test/Array/every.js b/deps/v8/test/js-perf-test/Array/every.js
index 5a29f44e41..6e9425543a 100644
--- a/deps/v8/test/js-perf-test/Array/every.js
+++ b/deps/v8/test/js-perf-test/Array/every.js
@@ -27,11 +27,11 @@ function OptUnreliableEvery() {
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "DoubleEvery", mc("every"), DoubleSetup, v => v > 0.0,
- "SmiEvery", mc("every"), SmiSetup, v => v != 34343,
- "FastEvery", mc("every"), FastSetup, v => v !== 'hi',
- "OptFastEvery", OptFastEvery, FastSetup, v => true,
- "OptUnreliableEvery", OptUnreliableEvery, FastSetup, v => true
+ ['DoubleEvery', newClosure('every'), DoubleSetup, v => v > 0.0],
+ ['SmiEvery', newClosure('every'), SmiSetup, v => v != 34343],
+ ['FastEvery', newClosure('every'), FastSetup, v => v !== 'hi'],
+ ['OptFastEvery', OptFastEvery, FastSetup, v => true],
+ ['OptUnreliableEvery', OptUnreliableEvery, FastSetup, v => true]
]);
})();
diff --git a/deps/v8/test/js-perf-test/Array/filter.js b/deps/v8/test/js-perf-test/Array/filter.js
index e0d4327dd6..4ceaf5cce2 100644
--- a/deps/v8/test/js-perf-test/Array/filter.js
+++ b/deps/v8/test/js-perf-test/Array/filter.js
@@ -54,13 +54,19 @@ function OptUnreliableFilter() {
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "NaiveFilterReplacement", NaiveFilter, NaiveFilterSetup, v => true,
- "DoubleFilter", mc("filter"), DoubleSetup, v => Math.floor(v) % 2 === 0,
- "SmiFilter", mc("filter"), SmiSetup, v => v % 2 === 0,
- "FastFilter", mc("filter"), FastSetup, (_, i) => i % 2 === 0,
- "GenericFilter", mc("filter", true), ObjectSetup, (_, i) => i % 2 === 0,
- "OptFastFilter", OptFastFilter, FastSetup, undefined,
- "OptUnreliableFilter", OptUnreliableFilter, FastSetup, v => true
+ ['NaiveFilterReplacement', NaiveFilter, NaiveFilterSetup, v => true],
+ [
+ 'DoubleFilter', newClosure('filter'), DoubleSetup,
+ v => Math.floor(v) % 2 === 0
+ ],
+ ['SmiFilter', newClosure('filter'), SmiSetup, v => v % 2 === 0],
+ ['FastFilter', newClosure('filter'), FastSetup, (_, i) => i % 2 === 0],
+ [
+ 'GenericFilter', newClosure('filter', true), ObjectSetup,
+ (_, i) => i % 2 === 0
+ ],
+ ['OptFastFilter', OptFastFilter, FastSetup, undefined],
+ ['OptUnreliableFilter', OptUnreliableFilter, FastSetup, v => true]
]);
})();
diff --git a/deps/v8/test/js-perf-test/Array/find-index.js b/deps/v8/test/js-perf-test/Array/find-index.js
index 716aa710bb..1029b26124 100644
--- a/deps/v8/test/js-perf-test/Array/find-index.js
+++ b/deps/v8/test/js-perf-test/Array/find-index.js
@@ -51,13 +51,22 @@ function NaiveSetup() {
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "NaiveFindIndexReplacement", Naive, NaiveSetup, v => v === max_index,
- "DoubleFindIndex", mc("findIndex"), DoubleSetup, v => v === max_index + 0.5,
- "SmiFindIndex", mc("findIndex"), SmiSetup, v => v === max_index,
- "FastFindIndex", mc("findIndex"), FastSetup, v => v === `value ${max_index}`,
- "GenericFindIndex", mc("findIndex", true), ObjectSetup, v => v === max_index,
- "OptFastFindIndex", OptFast, FastSetup, undefined,
- "OptUnreliableFindIndex", OptUnreliable, FastSetup, v => v === max_index
+ ['NaiveFindIndexReplacement', Naive, NaiveSetup, v => v === max_index],
+ [
+ 'DoubleFindIndex', newClosure('findIndex'), DoubleSetup,
+ v => v === max_index + 0.5
+ ],
+ ['SmiFindIndex', newClosure('findIndex'), SmiSetup, v => v === max_index],
+ [
+ 'FastFindIndex', newClosure('findIndex'), FastSetup,
+ v => v === `value ${max_index}`
+ ],
+ [
+ 'GenericFindIndex', newClosure('findIndex', true), ObjectSetup,
+ v => v === max_index
+ ],
+ ['OptFastFindIndex', OptFast, FastSetup, undefined],
+ ['OptUnreliableFindIndex', OptUnreliable, FastSetup, v => v === max_index]
]);
})();
diff --git a/deps/v8/test/js-perf-test/Array/find.js b/deps/v8/test/js-perf-test/Array/find.js
index 9b9a19f1c4..580d646a30 100644
--- a/deps/v8/test/js-perf-test/Array/find.js
+++ b/deps/v8/test/js-perf-test/Array/find.js
@@ -51,13 +51,13 @@ function NaiveSetup() {
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "NaiveFindReplacement", Naive, NaiveSetup, v => v === max_index,
- "DoubleFind", mc("find"), DoubleSetup, v => v === max_index + 0.5,
- "SmiFind", mc("find"), SmiSetup, v => v === max_index,
- "FastFind", mc("find"), FastSetup, v => v === `value ${max_index}`,
- "GenericFind", mc("find", true), ObjectSetup, v => v === max_index,
- "OptFastFind", OptFast, FastSetup, undefined,
- "OptUnreliableFind", OptUnreliable, FastSetup, v => v === max_index
+ ['NaiveFindReplacement', Naive, NaiveSetup, v => v === max_index],
+ ['DoubleFind', newClosure('find'), DoubleSetup, v => v === max_index + 0.5],
+ ['SmiFind', newClosure('find'), SmiSetup, v => v === max_index],
+ ['FastFind', newClosure('find'), FastSetup, v => v === `value ${max_index}`],
+ ['GenericFind', newClosure('find', true), ObjectSetup, v => v === max_index],
+ ['OptFastFind', OptFast, FastSetup, undefined],
+ ['OptUnreliableFind', OptUnreliable, FastSetup, v => v === max_index]
]);
})();
diff --git a/deps/v8/test/js-perf-test/Array/for-each.js b/deps/v8/test/js-perf-test/Array/for-each.js
index 79d279894b..c87d5406e0 100644
--- a/deps/v8/test/js-perf-test/Array/for-each.js
+++ b/deps/v8/test/js-perf-test/Array/for-each.js
@@ -50,13 +50,25 @@ function OptUnreliable() {
}
DefineHigherOrderTests([
- "NaiveForEachReplacement", Naive, NaiveSetup, v => v === max_index,
- "DoubleForEach", mc("forEach"), DoubleSetup, v => v === max_index + 0.5,
- "SmiForEach", mc("forEach"), SmiSetup, v => v === max_index,
- "FastForEach", mc("forEach"), FastSetup, v => v === `value ${max_index}`,
- "GenericForEach", mc("forEach", true), ObjectSetup, v => v === max_index,
- "OptFastForEach", OptFast, FastSetup, undefined,
- "OptUnreliableForEach", OptUnreliable, FastSetup, v => v === `value ${max_index}`
+ ['NaiveForEachReplacement', Naive, NaiveSetup, v => v === max_index],
+ [
+ 'DoubleForEach', newClosure('forEach'), DoubleSetup,
+ v => v === max_index + 0.5
+ ],
+ ['SmiForEach', newClosure('forEach'), SmiSetup, v => v === max_index],
+ [
+ 'FastForEach', newClosure('forEach'), FastSetup,
+ v => v === `value ${max_index}`
+ ],
+ [
+ 'GenericForEach', newClosure('forEach', true), ObjectSetup,
+ v => v === max_index
+ ],
+ ['OptFastForEach', OptFast, FastSetup, undefined],
+ [
+ 'OptUnreliableForEach', OptUnreliable, FastSetup,
+ v => v === `value ${max_index}`
+ ]
]);
})();
diff --git a/deps/v8/test/js-perf-test/Array/map.js b/deps/v8/test/js-perf-test/Array/map.js
index 9179aa3c88..4b278b8882 100644
--- a/deps/v8/test/js-perf-test/Array/map.js
+++ b/deps/v8/test/js-perf-test/Array/map.js
@@ -49,15 +49,15 @@ function OptUnreliableMap() {
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "NaiveMapReplacement", NaiveMap, NaiveMapSetup, v => v,
- "SmiMap", mc("map"), SmiSetup, v => v,
- "DoubleMap", mc("map"), DoubleSetup, v => v,
- "FastMap", mc("map"), FastSetup, v => v,
- "SmallSmiToDoubleMap", mc("map"), SmiSetup, v => v + 0.5,
- "SmallSmiToFastMap", mc("map"), SmiSetup, v => "hi" + v,
- "GenericMap", mc("map", true), ObjectSetup, v => v,
- "OptFastMap", OptFastMap, FastSetup, undefined,
- "OptUnreliableMap", OptUnreliableMap, FastSetup, v => v
+ ['NaiveMapReplacement', NaiveMap, NaiveMapSetup, v => v],
+ ['SmiMap', newClosure('map'), SmiSetup, v => v],
+ ['DoubleMap', newClosure('map'), DoubleSetup, v => v],
+ ['FastMap', newClosure('map'), FastSetup, v => v],
+ ['SmallSmiToDoubleMap', newClosure('map'), SmiSetup, v => v + 0.5],
+ ['SmallSmiToFastMap', newClosure('map'), SmiSetup, v => 'hi' + v],
+ ['GenericMap', newClosure('map', true), ObjectSetup, v => v],
+ ['OptFastMap', OptFastMap, FastSetup, undefined],
+ ['OptUnreliableMap', OptUnreliableMap, FastSetup, v => v]
]);
})();
diff --git a/deps/v8/test/js-perf-test/Array/reduce-right.js b/deps/v8/test/js-perf-test/Array/reduce-right.js
index ed00f5ac27..c643c2b383 100644
--- a/deps/v8/test/js-perf-test/Array/reduce-right.js
+++ b/deps/v8/test/js-perf-test/Array/reduce-right.js
@@ -27,12 +27,22 @@ function OptUnreliableReduceRight() {
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "DoubleReduceRight", mc("reduceRight"), DoubleSetup, (p, v, i, o) => p + v,
- "SmiReduceRight", mc("reduceRight"), SmiSetup, (p, v, i, a) => p + 1,
- "FastReduceRight", mc("reduceRight"), FastSetup, (p, v, i, a) => p + v,
- "OptFastReduceRight", OptFastReduceRight, FastSetup, undefined,
- "OptUnreliableReduceRight", OptUnreliableReduceRight, FastSetup,
- (p, v, i, a) => p + v
+ [
+ 'DoubleReduceRight', newClosure('reduceRight'), DoubleSetup,
+ (p, v, i, o) => p + v
+ ],
+ [
+ 'SmiReduceRight', newClosure('reduceRight'), SmiSetup, (p, v, i, a) => p + 1
+ ],
+ [
+ 'FastReduceRight', newClosure('reduceRight'), FastSetup,
+ (p, v, i, a) => p + v
+ ],
+ ['OptFastReduceRight', OptFastReduceRight, FastSetup, undefined],
+ [
+ 'OptUnreliableReduceRight', OptUnreliableReduceRight, FastSetup,
+ (p, v, i, a) => p + v
+ ]
]);
})();
diff --git a/deps/v8/test/js-perf-test/Array/reduce.js b/deps/v8/test/js-perf-test/Array/reduce.js
index 02d689f7c4..2b9a28f098 100644
--- a/deps/v8/test/js-perf-test/Array/reduce.js
+++ b/deps/v8/test/js-perf-test/Array/reduce.js
@@ -27,12 +27,13 @@ function OptUnreliableReduce() {
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "DoubleReduce", mc("reduce"), DoubleSetup, (p, v, i, o) => p + v,
- "SmiReduce", mc("reduce"), SmiSetup, (p, v, i, a) => p + 1,
- "FastReduce", mc("reduce"), FastSetup, (p, v, i, a) => p + v,
- "OptFastReduce", OptFastReduce, FastSetup, undefined,
- "OptUnreliableReduce", OptUnreliableReduce, FastSetup,
- (p, v, i, a) => p = v
+ ['DoubleReduce', newClosure('reduce'), DoubleSetup, (p, v, i, o) => p + v],
+ ['SmiReduce', newClosure('reduce'), SmiSetup, (p, v, i, a) => p + 1],
+ ['FastReduce', newClosure('reduce'), FastSetup, (p, v, i, a) => p + v],
+ ['OptFastReduce', OptFastReduce, FastSetup, undefined],
+ [
+ 'OptUnreliableReduce', OptUnreliableReduce, FastSetup, (p, v, i, a) => p = v
+ ]
]);
})();
diff --git a/deps/v8/test/js-perf-test/Array/run.js b/deps/v8/test/js-perf-test/Array/run.js
index 52de9c3809..e8b6ef0024 100644
--- a/deps/v8/test/js-perf-test/Array/run.js
+++ b/deps/v8/test/js-perf-test/Array/run.js
@@ -13,10 +13,10 @@ let result;
const array_size = 100;
const max_index = array_size - 1;
-// mc stands for "Make Closure," it's a handy function to get a fresh
+// newClosure is a handy function to get a fresh
// closure unpolluted by IC feedback for a 2nd-order array builtin
// test.
-function mc(name, generic = false) {
+function newClosure(name, generic = false) {
if (generic) {
return new Function(
`result = Array.prototype.${name}.call(array, func, this_arg);`);
@@ -24,16 +24,55 @@ function mc(name, generic = false) {
return new Function(`result = array.${name}(func, this_arg);`);
}
+function MakeHoley(array) {
+ for (let i =0; i < array.length; i+=2) {
+ delete array[i];
+ }
+ assert(%HasHoleyElements(array));
+}
+
function SmiSetup() {
array = Array.from({ length: array_size }, (_, i) => i);
+ assert(%HasSmiElements(array));
+}
+
+function HoleySmiSetup() {
+ SmiSetup();
+ MakeHoley(array);
+ assert(%HasSmiElements(array));
}
function DoubleSetup() {
array = Array.from({ length: array_size }, (_, i) => i + 0.5);
+ assert(%HasDoubleElements(array));
+}
+
+function HoleyDoubleSetup() {
+ DoubleSetup();
+ MakeHoley(array);
+ assert(%HasDoubleElements(array));
}
function FastSetup() {
array = Array.from({ length: array_size }, (_, i) => `value ${i}`);
+ assert(%HasObjectElements(array));
+}
+
+function HoleyFastSetup() {
+ FastSetup();
+ MakeHoley(array);
+ assert(%HasObjectElements(array));
+}
+
+function DictionarySetup() {
+ array = [];
+ // Add a large index to force dictionary elements.
+ array[2**30] = 10;
+ // Spread out {array_size} elements.
+ for (var i = 0; i < array_size-1; i++) {
+ array[i*101] = i;
+ }
+ assert(%HasDictionaryElements(array));
}
function ObjectSetup() {
@@ -41,15 +80,25 @@ function ObjectSetup() {
for (var i = 0; i < array_size; i++) {
array[i] = i;
}
+ assert(%HasObjectElements(array));
+ assert(%HasHoleyElements(array));
+}
+
+
+const ARRAY_SETUP = {
+ PACKED_SMI: SmiSetup,
+ HOLEY_SMI: HoleySmiSetup,
+ PACKED_DOUBLE: DoubleSetup,
+ HOLEY_DOUBLE: HoleyDoubleSetup,
+ PACKED: FastSetup,
+ HOLEY: HoleyFastSetup,
+ DICTIONARY: DictionarySetup,
}
function DefineHigherOrderTests(tests) {
let i = 0;
while (i < tests.length) {
- const name = tests[i++];
- const testFunc = tests[i++];
- const setupFunc = tests[i++];
- const callback = tests[i++];
+ const [name, testFunc, setupFunc, callback] = tests[i++];
let setupFuncWrapper = () => {
func = callback;
@@ -77,6 +126,7 @@ load('of.js');
load('join.js');
load('to-string.js');
load('slice.js');
+load('copy-within.js');
var success = true;
diff --git a/deps/v8/test/js-perf-test/Array/slice.js b/deps/v8/test/js-perf-test/Array/slice.js
index c9e60930f3..af99c092b1 100644
--- a/deps/v8/test/js-perf-test/Array/slice.js
+++ b/deps/v8/test/js-perf-test/Array/slice.js
@@ -43,13 +43,6 @@
})();
(() => {
-
- function assert(condition, message) {
- if (!condition) {
- throw Error(message);
- }
- }
-
const A = new Array(1000);
for (let i = 0; i < A.length; i++) {
diff --git a/deps/v8/test/js-perf-test/Array/some.js b/deps/v8/test/js-perf-test/Array/some.js
index ea820e9801..d7d5efa908 100644
--- a/deps/v8/test/js-perf-test/Array/some.js
+++ b/deps/v8/test/js-perf-test/Array/some.js
@@ -27,11 +27,11 @@ function OptUnreliableSome() {
DefineHigherOrderTests([
// name, test function, setup function, user callback
- "DoubleSome", mc("some"), DoubleSetup, v => v < 0.0,
- "SmiSome", mc("some"), SmiSetup, v => v === 34343,
- "FastSome", mc("some"), FastSetup, v => v === 'hi',
- "OptFastSome", OptFastSome, FastSetup, undefined,
- "OptUnreliableSome", OptUnreliableSome, FastSetup, v => v === 'hi'
+ ['DoubleSome', newClosure('some'), DoubleSetup, v => v < 0.0],
+ ['SmiSome', newClosure('some'), SmiSetup, v => v === 34343],
+ ['FastSome', newClosure('some'), FastSetup, v => v === 'hi'],
+ ['OptFastSome', OptFastSome, FastSetup, undefined],
+ ['OptUnreliableSome', OptUnreliableSome, FastSetup, v => v === 'hi']
]);
})();
diff --git a/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLarge/run.js b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLarge/run.js
new file mode 100644
index 0000000000..a018735fc9
--- /dev/null
+++ b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLarge/run.js
@@ -0,0 +1,153 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for large packed arrays.
+
+const largeHoleyArray = new Array(100000);
+const largeArray = Array.from(largeHoleyArray.keys());
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadLarge() {
+ var newArr = [...largeArray];
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthLarge() {
+ var newArr = new Array(largeArray.length);
+ for (let i = 0; i < largeArray.length; i++) {
+ newArr[i] = largeArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptyLarge() {
+ var newArr = [];
+ for (let i = 0; i < largeArray.length; i++) {
+ newArr[i] = largeArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceLarge() {
+ var newArr = largeArray.slice();
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0Large() {
+ var newArr = largeArray.slice(0);
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveLarge() {
+ var newArr = largeArray.concat();
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgLarge() {
+ var newArr = [].concat(largeArray);
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushLarge() {
+ var newArr = [];
+ for (let x of largeArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdLarge() {
+ var newArr = largeArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != largeArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadLarge(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+// Run the benchmark (20 x 100) iterations instead of 1 second.
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 20, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadLarge);
+CreateBenchmark('ForLength', ForLengthLarge);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptyLarge);
+CreateBenchmark('Slice', SliceLarge);
+CreateBenchmark('Slice0', Slice0Large);
+CreateBenchmark('ConcatReceive', ConcatReceiveLarge);
+CreateBenchmark('ConcatArg', ConcatArgLarge);
+CreateBenchmark('ForOfPush', ForOfPushLarge);
+CreateBenchmark('MapId', MapIdLarge);
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = true;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeHoley/run.js b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeHoley/run.js
new file mode 100644
index 0000000000..b56efe9836
--- /dev/null
+++ b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadLargeHoley/run.js
@@ -0,0 +1,161 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for large holey arrays.
+
+const largeHoleyArray = new Array(100000);
+
+for (var i = 0; i < 100; i++) {
+ largeHoleyArray[i] = i;
+}
+
+for (var i = 5000; i < 5500; i++) {
+ largeHoleyArray[i] = i;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadLargeHoley() {
+ var newArr = [...largeHoleyArray];
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthLargeHoley() {
+ var newArr = new Array(largeHoleyArray.length);
+ for (let i = 0; i < largeHoleyArray.length; i++) {
+ newArr[i] = largeHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptyLargeHoley() {
+ var newArr = [];
+ for (let i = 0; i < largeHoleyArray.length; i++) {
+ newArr[i] = largeHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceLargeHoley() {
+ var newArr = largeHoleyArray.slice();
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0LargeHoley() {
+ var newArr = largeHoleyArray.slice(0);
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveLargeHoley() {
+ var newArr = largeHoleyArray.concat();
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgLargeHoley() {
+ var newArr = [].concat(largeHoleyArray);
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushLargeHoley() {
+ var newArr = [];
+ for (let x of largeHoleyArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdLargeHoley() {
+ var newArr = largeHoleyArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != largeHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadLargeHoley(Score): ' + result);
+}
+
+function PrintError(name, error) {
+ PrintResult('Error: ' + name, error);
+ success = false;
+}
+
+// Run the benchmark (20 x 100) iterations instead of 1 second.
+function CreateBenchmark(name, f) {
+ new BenchmarkSuite(name, [1000], [ new Benchmark(name, false, false, 20, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadLargeHoley);
+CreateBenchmark('ForLength', ForLengthLargeHoley);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptyLargeHoley);
+CreateBenchmark('Slice', SliceLargeHoley);
+CreateBenchmark('Slice0', Slice0LargeHoley);
+CreateBenchmark('ConcatReceive', ConcatReceiveLargeHoley);
+CreateBenchmark('ConcatArg', ConcatArgLargeHoley);
+CreateBenchmark('ForOfPush', ForOfPushLargeHoley);
+CreateBenchmark('MapId', MapIdLargeHoley);
+
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = true;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmall/run.js b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmall/run.js
new file mode 100644
index 0000000000..5c8b8d1ac4
--- /dev/null
+++ b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmall/run.js
@@ -0,0 +1,154 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for small packed arrays.
+
+const smallHoleyArray = Array(100);
+const smallArray = Array.from(Array(100).keys());
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadSmall() {
+ var newArr = [...smallArray];
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthSmall() {
+ var newArr = new Array(smallArray.length);
+ for (let i = 0; i < smallArray.length; i++) {
+ newArr[i] = smallArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptySmall() {
+ var newArr = [];
+ for (let i = 0; i < smallArray.length; i++) {
+ newArr[i] = smallArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceSmall() {
+ var newArr = smallArray.slice();
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0Small() {
+ var newArr = smallArray.slice(0);
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveSmall() {
+ var newArr = smallArray.concat();
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgSmall() {
+ var newArr = [].concat(smallArray);
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushSmall() {
+ var newArr = [];
+ for (let x of smallArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdSmall() {
+ var newArr = smallArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != smallArray.length) throw 666;
+ return newArr;
+}
+
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadSmall(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, 0, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadSmall);
+CreateBenchmark('ForLength', ForLengthSmall);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptySmall);
+CreateBenchmark('Slice', SliceSmall);
+CreateBenchmark('Slice0', Slice0Small);
+CreateBenchmark('ConcatReceive', ConcatReceiveSmall);
+CreateBenchmark('ConcatArg', ConcatArgSmall);
+CreateBenchmark('ForOfPush', ForOfPushSmall);
+CreateBenchmark('MapId', MapIdSmall);
+
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = false;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallHoley/run.js b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallHoley/run.js
new file mode 100644
index 0000000000..9e7aea2f19
--- /dev/null
+++ b/deps/v8/test/js-perf-test/ArrayLiteralInitialSpreadSmallHoley/run.js
@@ -0,0 +1,159 @@
+// 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.
+
+// Comparing different copy schemes against spread initial literals.
+// Benchmarks for small holey arrays.
+
+const smallHoleyArray = Array(100);
+
+for (var i = 0; i < 10; i++) {
+ smallHoleyArray[i] = i;
+}
+for (var i = 90; i < 99; i++) {
+ smallHoleyArray[i] = i;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Spread
+// ----------------------------------------------------------------------------
+
+function SpreadSmallHoley() {
+ var newArr = [...smallHoleyArray];
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLength
+// ----------------------------------------------------------------------------
+
+function ForLengthSmallHoley() {
+ var newArr = new Array(smallHoleyArray.length);
+ for (let i = 0; i < smallHoleyArray.length; i++) {
+ newArr[i] = smallHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForLengthEmpty
+// ----------------------------------------------------------------------------
+
+function ForLengthEmptySmallHoley() {
+ var newArr = [];
+ for (let i = 0; i < smallHoleyArray.length; i++) {
+ newArr[i] = smallHoleyArray[i];
+ }
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice
+// ----------------------------------------------------------------------------
+
+function SliceSmallHoley() {
+ var newArr = smallHoleyArray.slice();
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: Slice0
+// ----------------------------------------------------------------------------
+
+function Slice0SmallHoley() {
+ var newArr = smallHoleyArray.slice(0);
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatReceive
+// ----------------------------------------------------------------------------
+
+function ConcatReceiveSmallHoley() {
+ var newArr = smallHoleyArray.concat();
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ConcatArg
+// ----------------------------------------------------------------------------
+
+function ConcatArgSmallHoley() {
+ var newArr = [].concat(smallHoleyArray);
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: ForOfPush
+// ----------------------------------------------------------------------------
+
+function ForOfPushSmallHoley() {
+ var newArr = [];
+ for (let x of smallHoleyArray) {
+ newArr.push(x)
+ }
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+// ----------------------------------------------------------------------------
+// Benchmark: MapId
+// ----------------------------------------------------------------------------
+
+function MapIdSmallHoley() {
+ var newArr = smallHoleyArray.map(x => x);
+ // basic sanity check
+ if (newArr.length != smallHoleyArray.length) throw 666;
+ return newArr;
+}
+
+
+// ----------------------------------------------------------------------------
+// Setup and Run
+// ----------------------------------------------------------------------------
+
+load('../base.js');
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + '-ArrayLiteralInitialSpreadSmallHoley(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, 0, f) ]);
+}
+
+CreateBenchmark('Spread', SpreadSmallHoley);
+CreateBenchmark('ForLength', ForLengthSmallHoley);
+CreateBenchmark('ForLengthEmpty', ForLengthEmptySmallHoley);
+CreateBenchmark('Slice', SliceSmallHoley);
+CreateBenchmark('Slice0', Slice0SmallHoley);
+CreateBenchmark('ConcatReceive', ConcatReceiveSmallHoley);
+CreateBenchmark('ConcatArg', ConcatArgSmallHoley);
+CreateBenchmark('ForOfPush', ForOfPushSmallHoley);
+CreateBenchmark('MapId', MapIdSmallHoley);
+
+BenchmarkSuite.config.doWarmup = true;
+BenchmarkSuite.config.doDeterministic = false;
+BenchmarkSuite.RunSuites({NotifyResult: PrintResult, NotifyError: PrintError});
diff --git a/deps/v8/test/js-perf-test/ArraySort/sort-base.js b/deps/v8/test/js-perf-test/ArraySort/sort-base.js
index a3301752b2..c888972191 100644
--- a/deps/v8/test/js-perf-test/ArraySort/sort-base.js
+++ b/deps/v8/test/js-perf-test/ArraySort/sort-base.js
@@ -11,12 +11,6 @@ for (let i = 0; i < kArraySize; ++i) {
let array_to_sort = [];
-function assert(condition, message) {
- if (!condition) {
- throw Error(message);
- }
-}
-
function AssertPackedSmiElements() {
assert(%HasFastPackedElements(array_to_sort) &&
%HasSmiElements(array_to_sort),
diff --git a/deps/v8/test/js-perf-test/ArraySort/sort-lengths.js b/deps/v8/test/js-perf-test/ArraySort/sort-lengths.js
index aa681295c1..f27805a0ef 100644
--- a/deps/v8/test/js-perf-test/ArraySort/sort-lengths.js
+++ b/deps/v8/test/js-perf-test/ArraySort/sort-lengths.js
@@ -9,28 +9,24 @@ function SortAsc() {
}
function Random(length) {
+ array_to_sort = [];
for (let i = 0; i < length; ++i) {
- array_to_sort.push(Math.floor(Math.random()) * length);
+ array_to_sort.push(Math.floor(Math.random() * length));
}
AssertPackedSmiElements();
}
function Sorted(length) {
+ array_to_sort = [];
for (let i = 0; i < length; ++i) {
array_to_sort.push(i);
}
AssertPackedSmiElements();
}
-function TearDown() {
- array_to_sort = [];
-}
-
function CreateSortSuitesForLength(length) {
- createSortSuite(
- 'Random' + length, 1000, SortAsc, () => Random(length), TearDown);
- createSortSuite(
- 'Sorted' + length, 1000, SortAsc, () => Sorted(length), TearDown);
+ createSortSuite('Random' + length, 1000, SortAsc, () => Random(length));
+ createSortSuite('Sorted' + length, 1000, SortAsc, () => Sorted(length));
}
CreateSortSuitesForLength(10);
diff --git a/deps/v8/test/js-perf-test/JSTests.json b/deps/v8/test/js-perf-test/JSTests.json
index ce7e102b62..3793e2c9a8 100644
--- a/deps/v8/test/js-perf-test/JSTests.json
+++ b/deps/v8/test/js-perf-test/JSTests.json
@@ -60,6 +60,51 @@
"results_regexp": "^Generators\\-Generators\\(Score\\): (.+)$"
},
{
+ "name": "ArrayLiteralInitialSpread",
+ "path": ["ArrayLiteralInitialSpread"],
+ "main": "run.js",
+ "resources": [],
+ "results_regexp": "^%s\\-ArrayLiteralInitialSpread\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Spread-Small"},
+ {"name": "ForLength-Small"},
+ {"name": "ForLengthEmpty-Small"},
+ {"name": "Slice-Small"},
+ {"name": "Slice0-Small"},
+ {"name": "ConcatReceive-Small"},
+ {"name": "ConcatArg-Small"},
+ {"name": "ForOfPush-Small"},
+ {"name": "MapId-Small"},
+ {"name": "Spread-Large"},
+ {"name": "ForLength-Large"},
+ {"name": "ForLengthEmpty-Large"},
+ {"name": "Slice-Large"},
+ {"name": "Slice0-Large"},
+ {"name": "ConcatReceive-Large"},
+ {"name": "ConcatArg-Large"},
+ {"name": "ForOfPush-Large"},
+ {"name": "MapId-Large"},
+ {"name": "Spread-SmallHoley"},
+ {"name": "ForLength-SmallHoley"},
+ {"name": "ForLengthEmpty-SmallHoley"},
+ {"name": "Slice-SmallHoley"},
+ {"name": "Slice0-SmallHoley"},
+ {"name": "ConcatReceive-SmallHoley"},
+ {"name": "ConcatArg-SmallHoley"},
+ {"name": "ForOfPush-SmallHoley"},
+ {"name": "MapId-SmallHoley"},
+ {"name": "Spread-LargeHoley"},
+ {"name": "ForLength-LargeHoley"},
+ {"name": "ForLengthEmpty-LargeHoley"},
+ {"name": "Slice-LargeHoley"},
+ {"name": "Slice0-LargeHoley"},
+ {"name": "ConcatReceive-LargeHoley"},
+ {"name": "ConcatArg-LargeHoley"},
+ {"name": "ForOfPush-LargeHoley"},
+ {"name": "MapId-LargeHoley"}
+ ]
+ },
+ {
"name": "ArrayLiteralSpread",
"path": ["ArrayLiteralSpread"],
"main": "run.js",
@@ -141,7 +186,7 @@
"path": ["Closures"],
"main": "run.js",
"resources": ["closures.js"],
- "flags": ["--mark_shared_functions_for_tier_up"],
+ "flags": [],
"results_regexp": "^%s\\-Closures\\(Score\\): (.+)$",
"tests": [
{"name": "Closures"}
@@ -614,9 +659,9 @@
"path": ["Array"],
"main": "run.js",
"resources": [
- "filter.js", "map.js", "every.js", "join.js", "some.js",
- "reduce.js", "reduce-right.js", "to-string.js", "find.js",
- "find-index.js", "from.js", "of.js", "for-each.js", "slice.js"
+ "filter.js", "map.js", "every.js", "join.js", "some.js", "reduce.js",
+ "reduce-right.js", "to-string.js", "find.js", "find-index.js",
+ "from.js", "of.js", "for-each.js", "slice.js", "copy-within.js"
],
"flags": [
"--allow-natives-syntax"
@@ -711,7 +756,11 @@
{"name": "Array.slice(500,999)-dict"},
{"name": "Array.slice(200,700)-dict"},
{"name": "Array.slice(200,-300)-dict"},
- {"name": "Array.slice(4,1)-dict"}
+ {"name": "Array.slice(4,1)-dict"},
+ {"name": "SmiCopyWithin"},
+ {"name": "StringCopyWithin"},
+ {"name": "SparseSmiCopyWithin"},
+ {"name": "SparseStringCopyWithin"}
]
},
{
@@ -1032,12 +1081,45 @@
"path": ["Parsing"],
"main": "run.js",
"flags": ["--no-compilation-cache", "--allow-natives-syntax"],
- "resources": [ "comments.js"],
+ "resources": [ "comments.js", "strings.js", "arrowfunctions.js"],
"results_regexp": "^%s\\-Parsing\\(Score\\): (.+)$",
"tests": [
{"name": "OneLineComment"},
{"name": "OneLineComments"},
- {"name": "MultiLineComment"}
+ {"name": "MultiLineComment"},
+ {"name": "SingleLineString"},
+ {"name": "SingleLineStrings"},
+ {"name": "MultiLineString"},
+ {"name": "ArrowFunctionShort"},
+ {"name": "ArrowFunctionLong"},
+ {"name": "CommaSepExpressionListShort"},
+ {"name": "CommaSepExpressionListLong"},
+ {"name": "CommaSepExpressionListLate"},
+ {"name": "FakeArrowFunction"}
+ ]
+ },
+ {
+ "name": "Numbers",
+ "path": ["Numbers"],
+ "main": "run.js",
+ "flags": ["--allow-natives-syntax"],
+ "resources": [ "toNumber.js"],
+ "results_regexp": "^%s\\-Numbers\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "Constructor"},
+ {"name": "UnaryPlus"},
+ {"name": "ParseFloat"}
+ ]
+ },
+ {
+ "name": "TurboFan",
+ "path": ["TurboFan"],
+ "main": "run.js",
+ "flags": [],
+ "resources": [ "typedLowering.js"],
+ "results_regexp": "^%s\\-TurboFan\\(Score\\): (.+)$",
+ "tests": [
+ {"name": "NumberToString"}
]
}
]
diff --git a/deps/v8/test/js-perf-test/Numbers/run.js b/deps/v8/test/js-perf-test/Numbers/run.js
new file mode 100644
index 0000000000..cdfbf25a70
--- /dev/null
+++ b/deps/v8/test/js-perf-test/Numbers/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('toNumber.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/Numbers/toNumber.js b/deps/v8/test/js-perf-test/Numbers/toNumber.js
new file mode 100644
index 0000000000..44382f092b
--- /dev/null
+++ b/deps/v8/test/js-perf-test/Numbers/toNumber.js
@@ -0,0 +1,25 @@
+// 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 A = [undefined, 12, "123"];
+
+function NumberConstructor() {
+ Number.isNaN(Number(A[0]))
+ Number.isNaN(Number(A[1]))
+ Number.isNaN(Number(A[2]))
+}
+createSuite('Constructor', 1000, NumberConstructor, ()=>{});
+
+function NumberPlus() {
+ Number.isNaN(+(A[0]))
+ Number.isNaN(+(A[1]))
+ Number.isNaN(+(A[2]))
+}
+createSuite('UnaryPlus', 1000, NumberPlus, ()=>{});
+
+function NumberParseFloat() {
+ Number.isNaN(parseFloat(A[0]))
+ Number.isNaN(parseFloat(A[1]))
+ Number.isNaN(parseFloat(A[2]))
+}
+createSuite('ParseFloat', 1000, NumberParseFloat, ()=>{});
diff --git a/deps/v8/test/js-perf-test/Parsing/arrowfunctions.js b/deps/v8/test/js-perf-test/Parsing/arrowfunctions.js
new file mode 100644
index 0000000000..bee4ef8b30
--- /dev/null
+++ b/deps/v8/test/js-perf-test/Parsing/arrowfunctions.js
@@ -0,0 +1,60 @@
+// 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.
+
+new BenchmarkSuite("ArrowFunctionShort", [1000], [
+ new Benchmark("ArrowFunctionShort", false, true, iterations, Run, ArrowFunctionShortSetup)
+]);
+
+new BenchmarkSuite("ArrowFunctionLong", [1000], [
+ new Benchmark("ArrowFunctionLong", false, true, iterations, Run, ArrowFunctionLongSetup)
+]);
+
+new BenchmarkSuite("CommaSepExpressionListShort", [1000], [
+ new Benchmark("CommaSepExpressionListShort", false, true, iterations, Run, CommaSepExpressionListShortSetup)
+]);
+
+new BenchmarkSuite("CommaSepExpressionListLong", [1000], [
+ new Benchmark("CommaSepExpressionListLong", false, true, iterations, Run, CommaSepExpressionListLongSetup)
+]);
+
+new BenchmarkSuite("CommaSepExpressionListLate", [1000], [
+ new Benchmark("CommaSepExpressionListLate", false, true, iterations, Run, CommaSepExpressionListLateSetup)
+]);
+
+new BenchmarkSuite("FakeArrowFunction", [1000], [
+ new Benchmark("FakeArrowFunction", false, true, iterations, Run, FakeArrowFunctionSetup)
+]);
+
+function ArrowFunctionShortSetup() {
+ code = "let a;\n" + "a = (a,b) => { return a+b; }\n".repeat(100)
+}
+
+function ArrowFunctionLongSetup() {
+ code = "let a;\n" + "a = (a,b,c,d,e,f,g,h,i,j) => { return a+b; }\n".repeat(100)
+}
+
+function CommaSepExpressionListShortSetup() {
+ code = "let a;\n" + "a = (a,1)\n".repeat(100)
+}
+
+function CommaSepExpressionListLongSetup() {
+ code = "let a; let b; let c;\n" + "a = (a,2,3,4,5,b,c,1,7,1)\n".repeat(100)
+}
+
+function CommaSepExpressionListLateSetup() {
+ code = "let a; let b; let c; let d; let e; let f; let g; let h; let i;\n"
+ + "a = (a,b,c,d,e,f,g,h,i,1)\n".repeat(100)
+}
+
+function FakeArrowFunctionSetup() {
+ code = "let a; let b; let c; let d; let e; let f; let g; let h; let i; let j;\n"
+ + "a = (a,b,c,d,e,f,g,h,i,j)\n".repeat(100)
+}
+
+function Run() {
+ if (code == undefined) {
+ throw new Error("No test data");
+ }
+ eval(code);
+}
diff --git a/deps/v8/test/js-perf-test/Parsing/comments.js b/deps/v8/test/js-perf-test/Parsing/comments.js
index e5dbab1c75..5d6b70f085 100644
--- a/deps/v8/test/js-perf-test/Parsing/comments.js
+++ b/deps/v8/test/js-perf-test/Parsing/comments.js
@@ -2,22 +2,18 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-const iterations = 100;
-
-new BenchmarkSuite('OneLineComment', [1000], [
- new Benchmark('OneLineComment', false, true, iterations, Run, OneLineCommentSetup)
+new BenchmarkSuite("OneLineComment", [1000], [
+ new Benchmark("OneLineComment", false, true, iterations, Run, OneLineCommentSetup)
]);
-new BenchmarkSuite('OneLineComments', [1000], [
- new Benchmark('OneLineComments', false, true, iterations, Run, OneLineCommentsSetup)
+new BenchmarkSuite("OneLineComments", [1000], [
+ new Benchmark("OneLineComments", false, true, iterations, Run, OneLineCommentsSetup)
]);
-new BenchmarkSuite('MultiLineComment', [1000], [
- new Benchmark('MultiLineComment', false, true, iterations, Run, MultiLineCommentSetup)
+new BenchmarkSuite("MultiLineComment", [1000], [
+ new Benchmark("MultiLineComment", false, true, iterations, Run, MultiLineCommentSetup)
]);
-let code;
-
function OneLineCommentSetup() {
code = "//" + " This is a comment... ".repeat(600);
%FlattenString(code);
diff --git a/deps/v8/test/js-perf-test/Parsing/run.js b/deps/v8/test/js-perf-test/Parsing/run.js
index e6531af5bb..d699af2eff 100644
--- a/deps/v8/test/js-perf-test/Parsing/run.js
+++ b/deps/v8/test/js-perf-test/Parsing/run.js
@@ -3,14 +3,19 @@
// found in the LICENSE file.
-load('../base.js');
+load("../base.js");
-load('comments.js');
+const iterations = 100;
+let code;
+
+load("comments.js");
+load("strings.js");
+load("arrowfunctions.js")
var success = true;
function PrintResult(name, result) {
- print(name + '-Parsing(Score): ' + result);
+ print(name + "-Parsing(Score): " + result);
}
diff --git a/deps/v8/test/js-perf-test/Parsing/strings.js b/deps/v8/test/js-perf-test/Parsing/strings.js
new file mode 100644
index 0000000000..63eef38701
--- /dev/null
+++ b/deps/v8/test/js-perf-test/Parsing/strings.js
@@ -0,0 +1,37 @@
+// 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.
+
+new BenchmarkSuite("SingleLineString", [1000], [
+ new Benchmark("SingleLineString", false, true, iterations, Run, SingleLineStringSetup)
+]);
+
+new BenchmarkSuite("SingleLineStrings", [3000], [
+ new Benchmark("SingleLineStrings", false, true, iterations, Run, SingleLineStringsSetup)
+]);
+
+new BenchmarkSuite("MultiLineString", [1000], [
+ new Benchmark("MultiLineString", false, true, iterations, Run, MultiLineStringSetup)
+]);
+
+function SingleLineStringSetup() {
+ code = "\"" + "This is a string".repeat(600) + "\"";
+ %FlattenString(code);
+}
+
+function SingleLineStringsSetup() {
+ code = "\"This is a string\"\n".repeat(600);
+ %FlattenString(code);
+}
+
+function MultiLineStringSetup() {
+ code = "\"" + "This is a string \\\n".repeat(600) + "\"";
+ %FlattenString(code);
+}
+
+function Run() {
+ if (code == undefined) {
+ throw new Error("No test data");
+ }
+ eval(code);
+}
diff --git a/deps/v8/test/js-perf-test/StringIterators/string-iterator.js b/deps/v8/test/js-perf-test/StringIterators/string-iterator.js
index c55925415b..8a7e323b42 100644
--- a/deps/v8/test/js-perf-test/StringIterators/string-iterator.js
+++ b/deps/v8/test/js-perf-test/StringIterators/string-iterator.js
@@ -2,37 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-function assert(expression, message) {
- if (typeof expression === "string" && message === void 0) {
- message = expression;
- expression = eval(expression);
- }
-
- if (!expression) {
- var lines = ["Benchmark Error"];
- if (message !== void 0) {
- lines = ["Benchmark Error:", String(message)];
- }
- throw new Error(lines.join("\n"));
- }
- return true;
-}
-
-assert.same = function(expected, actual, message) {
- var isSame =
- expected === actual || typeof expected !== expected && actual !== actual;
- if (!isSame) {
- var details = `Expected: ${String(expected)}\n` +
- `But found: ${String(actual)}`;
- var lines = ["Benchmark Error:", details];
- if (message !== void 0) {
- lines = ["Benchmark Error:", details, "", String(message)];
- }
- throw new Error(lines.join("\n"));
- }
- return true;
-}
-
new BenchmarkSuite('Spread_OneByteShort', [1000], [
new Benchmark('test', false, false, 0,
Spread_OneByteShort, Spread_OneByteShortSetup,
@@ -52,8 +21,8 @@ function Spread_OneByteShort() {
function Spread_OneByteShortTearDown() {
var expected = "A|l|p|h|a|b|e|t|-|S|o|u|p";
- return assert("Array.isArray(result)")
- && assert.same(expected, result.join("|"));
+ return assert(Array.isArray(result))
+ && assertEquals(expected, result.join("|"));
}
// ----------------------------------------------------------------------------
@@ -75,8 +44,8 @@ function Spread_TwoByteShort() {
function Spread_TwoByteShortTearDown() {
var expected = "\u5FCD|\u8005|\u306E|\u653B|\u6483";
- return assert("Array.isArray(result)")
- && assert.same(expected, result.join("|"));
+ return assert(Array.isArray(result))
+ && assertEquals(expected, result.join("|"));
}
// ----------------------------------------------------------------------------
@@ -100,8 +69,8 @@ function Spread_WithSurrogatePairsShort() {
function Spread_WithSurrogatePairsShortTearDown() {
var expected =
"\uD83C\uDF1F|\u5FCD|\u8005|\u306E|\u653B|\u6483|\uD83C\uDF1F";
- return assert("Array.isArray(result)")
- && assert.same(expected, result.join("|"));
+ return assert(Array.isArray(result))
+ && assertEquals(expected, result.join("|"));
}
// ----------------------------------------------------------------------------
@@ -123,7 +92,7 @@ function ForOf_OneByteShort() {
}
function ForOf_OneByteShortTearDown() {
- return assert.same(string, result);
+ return assertEquals(string, result);
}
// ----------------------------------------------------------------------------
@@ -145,7 +114,7 @@ function ForOf_TwoByteShort() {
}
function ForOf_TwoByteShortTearDown() {
- return assert.same(string, result);
+ return assertEquals(string, result);
}
// ----------------------------------------------------------------------------
@@ -168,7 +137,7 @@ function ForOf_WithSurrogatePairsShort() {
}
function ForOf_WithSurrogatePairsShortTearDown() {
- return assert.same(string, result);
+ return assertEquals(string, result);
}
// ----------------------------------------------------------------------------
@@ -190,7 +159,7 @@ function ForOf_OneByteLong() {
}
function ForOf_OneByteLongTearDown() {
- return assert.same(string, result);
+ return assertEquals(string, result);
}
// ----------------------------------------------------------------------------
@@ -212,7 +181,7 @@ function ForOf_TwoByteLong() {
}
function ForOf_TwoByteLongTearDown() {
- return assert.same(string, result);
+ return assertEquals(string, result);
}
// ----------------------------------------------------------------------------
@@ -235,5 +204,5 @@ function ForOf_WithSurrogatePairsLong() {
}
function ForOf_WithSurrogatePairsLongTearDown() {
- return assert.same(string, result);
+ return assertEquals(string, result);
}
diff --git a/deps/v8/test/js-perf-test/TurboFan/run.js b/deps/v8/test/js-perf-test/TurboFan/run.js
new file mode 100644
index 0000000000..3415262317
--- /dev/null
+++ b/deps/v8/test/js-perf-test/TurboFan/run.js
@@ -0,0 +1,29 @@
+// 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");
+
+const iterations = 100;
+
+load("typedLowering.js");
+
+var success = true;
+
+function PrintResult(name, result) {
+ print(name + "-TurboFan(Score): " + result);
+}
+
+
+function PrintError(name, error) {
+ PrintResult(name, error);
+ success = false;
+}
+
+
+BenchmarkSuite.config.doWarmup = undefined;
+BenchmarkSuite.config.doDeterministic = undefined;
+
+BenchmarkSuite.RunSuites({ NotifyResult: PrintResult,
+ NotifyError: PrintError });
diff --git a/deps/v8/test/js-perf-test/TurboFan/typedLowering.js b/deps/v8/test/js-perf-test/TurboFan/typedLowering.js
new file mode 100644
index 0000000000..d2ce15cc6e
--- /dev/null
+++ b/deps/v8/test/js-perf-test/TurboFan/typedLowering.js
@@ -0,0 +1,13 @@
+// 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.
+
+function NumberToString() {
+ var ret;
+ var num = 10240;
+ var obj = {};
+
+ for ( var i = 0; i < num; i++ )
+ ret = obj["test" + num];
+}
+createSuite('NumberToString', 1000, NumberToString);
diff --git a/deps/v8/test/js-perf-test/base.js b/deps/v8/test/js-perf-test/base.js
index 61089f039f..ca25789488 100644
--- a/deps/v8/test/js-perf-test/base.js
+++ b/deps/v8/test/js-perf-test/base.js
@@ -373,3 +373,23 @@ BenchmarkSuite.prototype.RunStep = function(runner) {
// Start out running the setup.
return RunNextSetup();
}
+
+
+
+function assert(condition, message) {
+ if (!condition) throw Error(message);
+}
+
+
+function assertEquals(expected, actual, message) {
+ var isSame =
+ expected === actual || typeof expected !== expected && actual !== actual;
+ if (isSame) return true;
+ var details = `Expected: ${String(expected)}\n` +
+ `But found: ${String(actual)}`;
+ var lines = ["Benchmark Error:", details];
+ if (message !== undefined) {
+ lines = ["Benchmark Error:", details, "", String(message)];
+ }
+ throw new Error(lines.join("\n"));
+}
diff --git a/deps/v8/test/message/asm-linking-bogus-heap.out b/deps/v8/test/message/asm-linking-bogus-heap.out
index 5a324c1fea..b0af630e57 100644
--- a/deps/v8/test/message/asm-linking-bogus-heap.out
+++ b/deps/v8/test/message/asm-linking-bogus-heap.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:7: Linking failure in asm.js: Unexpected heap size
+*%(basename)s:7: Linking failure in asm.js: Invalid heap size
diff --git a/deps/v8/test/message/fail/non-alphanum.out b/deps/v8/test/message/fail/non-alphanum.out
index 34464efb74..3a147dd9a2 100644
--- a/deps/v8/test/message/fail/non-alphanum.out
+++ b/deps/v8/test/message/fail/non-alphanum.out
@@ -2,5 +2,5 @@
([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]])([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(![]+[])[+!+[]]]((![]+[])[+!+[]])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+(+[![]]+[])[+[]])[+[]]+(![]+[])[+!+[]]+(+[]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[!+[]+!+[]+!+[]+[+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[+!+[]]+(+[![]]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+!+[]]]+([]+([]+[])[([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][[]]+[])[+!+[]]+(![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[+!+[]]+([][[]]+[])[+[]]+([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]])[+!+[]+[!+[]+!+[]+!+[]+!+[]]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[!+[]+!+[]+!+[]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((![]+[])[+!+[]]+[+[]])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+([][[]]+[])[!+[]+!+[]]+[][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()[(![]+[])[+!+[]]+(!![]+[])[+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+([][(![]+[])[!+[]+!+[]+!+[]]+(!![]+[][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]])[+!+[]+[+[]]]+(!![]+[])[+!+[]]+(!![]+[])[+[]]][([][(![]+[])[+[]]+(![]+[]+[][[]])[+!+[]+[+[]]]+(![]+[])[!+[]+!+[]]+(!![]+[])[+[]]+(!![]+[])[!+[]+!+[]+!+[]]+(!![]+[])[+!+[]]]+[])[!+[]+!+[]+!+[]]+(![]+[])[+!+[]]+(![]+[])[!+[]+!+[]]+(![]+[])[!+[]+!+[]]]()+[])[!+[]+!+[]]]((+(+!+[]+(!+[]+[])[!+[]+!+[]+!+[]]+[+!+[]]+[+[]]+[+[]]+[+[]])+[])[+[]]+(![]+[])[+[]])[+[]])
^
TypeError: Cannot convert undefined or null to object
- at sort (native)
+ at sort (<anonymous>)
at *%(basename)s:34:410
diff --git a/deps/v8/test/message/wasm-trace-memory-interpreted.out b/deps/v8/test/message/wasm-trace-memory-interpreted.out
index 7865195649..248d67e827 100644
--- a/deps/v8/test/message/wasm-trace-memory-interpreted.out
+++ b/deps/v8/test/message/wasm-trace-memory-interpreted.out
@@ -1,9 +1,9 @@
-I 0+0x3 load @00000004 i32:0 / 00000000
-I 1+0x3 load @00000001 i8:0 / 00
-I 3+0x5 store @00000004 i32:305419896 / 12345678
-I 0+0x3 load @00000002 i32:1450704896 / 56780000
-I 1+0x3 load @00000006 i8:52 / 34
-I 2+0x3 load @00000002 f32:68169720922112.000000 / 56780000
-I 4+0x5 store @00000004 i8:171 / ab
-I 0+0x3 load @00000002 i32:1454047232 / 56ab0000
-I 2+0x3 load @00000002 f32:94008244174848.000000 / 56ab0000
+interpreter func: 0+0x3 load from 00000004 val: i32:0 / 00000000
+interpreter func: 1+0x3 load from 00000001 val: i8:0 / 00
+interpreter func: 3+0x5 store to 00000004 val: i32:305419896 / 12345678
+interpreter func: 0+0x3 load from 00000002 val: i32:1450704896 / 56780000
+interpreter func: 1+0x3 load from 00000006 val: i8:52 / 34
+interpreter func: 2+0x3 load from 00000002 val: f32:68169720922112.000000 / 56780000
+interpreter func: 4+0x5 store to 00000004 val: i8:171 / ab
+interpreter func: 0+0x3 load from 00000002 val: i32:1454047232 / 56ab0000
+interpreter func: 2+0x3 load from 00000002 val: f32:94008244174848.000000 / 56ab0000
diff --git a/deps/v8/test/message/wasm-trace-memory-liftoff.out b/deps/v8/test/message/wasm-trace-memory-liftoff.out
index 26f22a5498..31fdefde3d 100644
--- a/deps/v8/test/message/wasm-trace-memory-liftoff.out
+++ b/deps/v8/test/message/wasm-trace-memory-liftoff.out
@@ -1,9 +1,9 @@
-L 0+0x3 load @00000004 i32:0 / 00000000
-L 1+0x3 load @00000001 i8:0 / 00
-L 3+0x5 store @00000004 i32:305419896 / 12345678
-L 0+0x3 load @00000002 i32:1450704896 / 56780000
-L 1+0x3 load @00000006 i8:52 / 34
-L 2+0x3 load @00000002 f32:68169720922112.000000 / 56780000
-L 4+0x5 store @00000004 i8:171 / ab
-L 0+0x3 load @00000002 i32:1454047232 / 56ab0000
-L 2+0x3 load @00000002 f32:94008244174848.000000 / 56ab0000
+liftoff func: 0+0x3 load from 00000004 val: i32:0 / 00000000
+liftoff func: 1+0x3 load from 00000001 val: i8:0 / 00
+liftoff func: 3+0x5 store to 00000004 val: i32:305419896 / 12345678
+liftoff func: 0+0x3 load from 00000002 val: i32:1450704896 / 56780000
+liftoff func: 1+0x3 load from 00000006 val: i8:52 / 34
+liftoff func: 2+0x3 load from 00000002 val: f32:68169720922112.000000 / 56780000
+liftoff func: 4+0x5 store to 00000004 val: i8:171 / ab
+liftoff func: 0+0x3 load from 00000002 val: i32:1454047232 / 56ab0000
+liftoff func: 2+0x3 load from 00000002 val: f32:94008244174848.000000 / 56ab0000
diff --git a/deps/v8/test/message/wasm-trace-memory.out b/deps/v8/test/message/wasm-trace-memory.out
index 37faa6a989..bc6b1b64ec 100644
--- a/deps/v8/test/message/wasm-trace-memory.out
+++ b/deps/v8/test/message/wasm-trace-memory.out
@@ -1,9 +1,9 @@
-T 0+0x3 load @00000004 i32:0 / 00000000
-T 1+0x3 load @00000001 i8:0 / 00
-T 3+0x5 store @00000004 i32:305419896 / 12345678
-T 0+0x3 load @00000002 i32:1450704896 / 56780000
-T 1+0x3 load @00000006 i8:52 / 34
-T 2+0x3 load @00000002 f32:68169720922112.000000 / 56780000
-T 4+0x5 store @00000004 i8:171 / ab
-T 0+0x3 load @00000002 i32:1454047232 / 56ab0000
-T 2+0x3 load @00000002 f32:94008244174848.000000 / 56ab0000
+turbofan func: 0+0x3 load from 00000004 val: i32:0 / 00000000
+turbofan func: 1+0x3 load from 00000001 val: i8:0 / 00
+turbofan func: 3+0x5 store to 00000004 val: i32:305419896 / 12345678
+turbofan func: 0+0x3 load from 00000002 val: i32:1450704896 / 56780000
+turbofan func: 1+0x3 load from 00000006 val: i8:52 / 34
+turbofan func: 2+0x3 load from 00000002 val: f32:68169720922112.000000 / 56780000
+turbofan func: 4+0x5 store to 00000004 val: i8:171 / ab
+turbofan func: 0+0x3 load from 00000002 val: i32:1454047232 / 56ab0000
+turbofan func: 2+0x3 load from 00000002 val: f32:94008244174848.000000 / 56ab0000
diff --git a/deps/v8/test/mjsunit/array-constructor-feedback.js b/deps/v8/test/mjsunit/array-constructor-feedback.js
index fb4ad5a19a..44d132820c 100644
--- a/deps/v8/test/mjsunit/array-constructor-feedback.js
+++ b/deps/v8/test/mjsunit/array-constructor-feedback.js
@@ -138,7 +138,6 @@ function assertKind(expected, obj, name_opt) {
%OptimizeFunctionOnNextCall(bar);
b = bar();
assertOptimized(bar);
- %DebugPrint(3);
b[0] = 3.5;
c = bar();
assertKind(elements_kind.fast_smi_only, c);
diff --git a/deps/v8/test/mjsunit/array-iterator-prototype-next.js b/deps/v8/test/mjsunit/array-iterator-prototype-next.js
new file mode 100644
index 0000000000..d17bf2740c
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-iterator-prototype-next.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.
+
+// Flags: --allow-natives-syntax
+
+/* Test behaviors when the prototype has elements */
+
+(function () {
+ var array = [,];
+
+ function next() {
+ return array[Symbol.iterator]().next();
+ }
+
+ assertEquals(next().value, undefined);
+
+ array.__proto__.push(5);
+ assertEquals(next().value, 5);
+})();
diff --git a/deps/v8/test/mjsunit/array-lastindexof.js b/deps/v8/test/mjsunit/array-lastindexof.js
index 785bd64727..c31ad18b55 100644
--- a/deps/v8/test/mjsunit/array-lastindexof.js
+++ b/deps/v8/test/mjsunit/array-lastindexof.js
@@ -8,3 +8,76 @@ assertThrows(() => {
assertThrows(() => {
Array.prototype.lastIndexOf.call(undefined, 42);
}, TypeError);
+
+/* Tests inspired by test262's
+ lastIndexOf/calls-only-has-on-prototype-after-length-zeroed.js */
+// Stateful fromIndex that tries to empty the array
+(function testFromIndex() {
+ var array = [5, undefined, 7];
+ var fromIndex = {
+ valueOf: function() {
+ array.length = 1;
+ return 2;
+ }
+ };
+ assertEquals(-1, array.lastIndexOf(undefined, fromIndex));
+
+ array = [5, undefined, 7];
+ assertEquals(0, array.lastIndexOf(5, fromIndex));
+})();
+
+// Stateful fromIndex and proxy as Prototype
+// Must test for [[HasProperty]] before [[Get]]
+var testHasProperty = function(value) {
+ var array = [5, undefined, 7];
+ var fromIndex = {
+ valueOf: function() {
+ array.length = 0;
+ return 2;
+ }
+ };
+
+ // Install a prototype that only has [[HasProperty]], and throws on [[Get]]
+ Object.setPrototypeOf(array,
+ new Proxy(Array.prototype, {
+ has: function(t, pk) { return pk in t; },
+ get: function () { throw new Error('[[Get]] trap called') },
+ }));
+
+ assertEquals(-1, Array.prototype.lastIndexOf.call(array, value, fromIndex));
+}
+
+testHasProperty(5);
+testHasProperty(undefined);
+
+// Test call order: [[HasProperty]] before [[Get]]
+var testHasPropertyThenGet = function(value) {
+ var array = [5, , 7];
+ var log = [];
+
+ // Install a prototype with only [[HasProperty]] and [[Get]]
+ Object.setPrototypeOf(array,
+ new Proxy(Array.prototype, {
+ has: function() { log.push("HasProperty"); return true; },
+ get: function() { log.push("Get"); },
+ }));
+ // The 2nd element (index 1) will trigger the calls to the prototype
+ Array.prototype.lastIndexOf.call(array, value);
+ assertEquals(["HasProperty", "Get"], log);
+}
+
+testHasPropertyThenGet(5);
+testHasPropertyThenGet(undefined);
+
+// Test for sparse Arrays
+/* This will not enter the fast path for sparse arrays, due to UseSparseVariant
+ excluding array elements with accessors */
+(function() {
+ var array = new Array(10000);
+ array[0] = 5; array[9999] = 7;
+
+ var count = 0;
+ Object.defineProperty(array.__proto__, 9998, { get: () => ++count });
+ Array.prototype.lastIndexOf.call(array, 0);
+ assertEquals(1,count);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-every.js b/deps/v8/test/mjsunit/array-prototype-every.js
new file mode 100644
index 0000000000..a9e415e084
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-every.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.
+
+/* Test behaviors when the prototype has elements */
+
+// every
+
+(function () {
+ var array = [,];
+
+ function every() {
+ return array.every(v => v > 0);
+ }
+
+ assertEquals(every(), true);
+
+ array.__proto__.push(-6);
+ assertEquals(every(), false);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-filter.js b/deps/v8/test/mjsunit/array-prototype-filter.js
new file mode 100644
index 0000000000..958df23a26
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-filter.js
@@ -0,0 +1,22 @@
+// 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.
+
+/* Test behaviors when the prototype has elements */
+
+// filter
+
+(function () {
+ var array = [,];
+
+ function filter() {
+ return array.filter(v => v > 0);
+ }
+
+ assertEquals(filter(), []);
+
+ array.__proto__.push(6);
+ var narr = filter();
+ assertNotEquals(Object.getOwnPropertyDescriptor(narr, 0), undefined);
+ assertEquals(narr, [6]);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-find.js b/deps/v8/test/mjsunit/array-prototype-find.js
new file mode 100644
index 0000000000..8847fddd63
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-find.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.
+
+/* Test behaviors when the prototype has elements */
+
+// find
+
+(function () {
+ var array = [,];
+
+ function find() {
+ return array.find(v => v > 0);
+ }
+
+ assertEquals(find(), undefined);
+
+ array.__proto__.push(6);
+ assertEquals(find(), 6);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-findindex.js b/deps/v8/test/mjsunit/array-prototype-findindex.js
new file mode 100644
index 0000000000..5d627ca043
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-findindex.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.
+
+/* Test behaviors when the prototype has elements */
+
+// findIndex
+
+(function () {
+ var array = [,];
+
+ function findIndex() {
+ return array.findIndex(v => v > 0);
+ }
+
+ assertEquals(findIndex(), -1);
+
+ array.__proto__.push(6);
+ assertEquals(findIndex(), 0);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-foreach.js b/deps/v8/test/mjsunit/array-prototype-foreach.js
new file mode 100644
index 0000000000..7f01d8ef65
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-foreach.js
@@ -0,0 +1,26 @@
+// 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.
+
+/* Test behaviors when the prototype has elements */
+
+// forEach
+
+(function () {
+ var array = [,];
+
+ function increment(v, k, arr) { arr[k] = v + 1; }
+ function forEach() {
+ array.forEach(increment);
+ }
+
+ forEach();
+ assertEquals(array, [,]);
+
+ // behavior from the prototype
+ array.__proto__.push(5);
+ assertEquals(Object.getOwnPropertyDescriptor(array, 0), undefined);
+ forEach();
+ assertNotEquals(Object.getOwnPropertyDescriptor(array, 0), undefined);
+ assertEquals(array[0], 6);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-includes.js b/deps/v8/test/mjsunit/array-prototype-includes.js
new file mode 100644
index 0000000000..5c1d926372
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-includes.js
@@ -0,0 +1,36 @@
+// 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.
+
+/* Test behaviors when the prototype has elements */
+
+// includes
+
+(function() {
+ const iarr = [,3];
+
+ function includes(arr, val) {
+ return arr.includes(val);
+ }
+
+ assertFalse(includes(iarr, 2));
+ assertTrue(includes(iarr, 3));
+
+ iarr.__proto__ = [2];
+ assertTrue(includes(iarr, 2));
+})();
+
+// This pollutes the Array prototype, so we should not run more tests
+// in the same environment after this.
+(function () {
+ var array = [,];
+
+ function includes(val) {
+ return array.includes(val);
+ }
+
+ assertFalse(includes(6));
+
+ array.__proto__.push(6);
+ assertTrue(includes(6));
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-indexof.js b/deps/v8/test/mjsunit/array-prototype-indexof.js
new file mode 100644
index 0000000000..ca639f4da2
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-indexof.js
@@ -0,0 +1,36 @@
+// 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.
+
+// indexOf
+
+/* Test behaviors when the prototype has elements */
+
+(function() {
+ const iarr = [,3];
+
+ function indexOf(arr, val) {
+ return arr.indexOf(val);
+ }
+
+ assertEquals(-1, indexOf(iarr, 2));
+ assertEquals(1, indexOf(iarr, 3));
+
+ iarr.__proto__ = [2];
+ assertEquals(0, indexOf(iarr, 2));
+})();
+
+// This pollutes the Array prototype, so we should not run more tests
+// in the same environment after this.
+(function () {
+ var array = [,];
+
+ function indexOf(val) {
+ return array.indexOf(val);
+ }
+
+ assertEquals(indexOf(6), -1);
+
+ array.__proto__.push(6);
+ assertEquals(indexOf(6), 0);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-lastindexof.js b/deps/v8/test/mjsunit/array-prototype-lastindexof.js
new file mode 100644
index 0000000000..b0345301c9
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-lastindexof.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.
+
+/* Test behaviors when the prototype has elements */
+
+// lastIndexOf
+
+(function () {
+ var array = [,];
+
+ function lastIndexOf(val) {
+ return array.lastIndexOf(val);
+ }
+
+ assertEquals(lastIndexOf(6), -1);
+
+ array.__proto__.push(6);
+ assertEquals(lastIndexOf(6), 0);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-map.js b/deps/v8/test/mjsunit/array-prototype-map.js
new file mode 100644
index 0000000000..1ef6088669
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-map.js
@@ -0,0 +1,21 @@
+// 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.
+
+/* Test behaviors when the prototype has elements */
+
+// map
+(function () {
+ var array = [,];
+
+ function map() {
+ return array.map(x => x + 1);
+ }
+
+ assertEquals(map(), [,]);
+
+ array.__proto__.push(5);
+ var narr = map();
+ assertNotEquals(Object.getOwnPropertyDescriptor(narr, 0), undefined);
+ assertEquals(narr[0], 6);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-pop.js b/deps/v8/test/mjsunit/array-prototype-pop.js
new file mode 100644
index 0000000000..730b98255a
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-pop.js
@@ -0,0 +1,29 @@
+// 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.
+
+/* Test behaviors when the prototype has elements */
+
+// pop
+
+(function () {
+ var array = [,];
+
+ function pop() {
+ return array.pop();
+ }
+
+ assertEquals(pop(), undefined);
+})();
+
+
+(function () {
+ var array = [,];
+
+ function pop() {
+ return array.pop();
+ }
+
+ array.__proto__.push(6);
+ assertEquals(pop(), 6);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-reduce.js b/deps/v8/test/mjsunit/array-prototype-reduce.js
new file mode 100644
index 0000000000..593066f897
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-reduce.js
@@ -0,0 +1,24 @@
+// 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.
+
+/* Test behaviors when the prototype has elements */
+
+// reduce
+
+(function () {
+ var array = [, 3];
+
+ function accumulate (prev, cur, curIdx, arr) { arr[curIdx] = cur + prev; }
+ function reduce() {
+ array.reduce(accumulate);
+ }
+
+ reduce();
+ assertEquals(array, [,3]);
+
+ array.__proto__.push(3);
+ reduce();
+ assertEquals(array, [, 6]);
+ assertEquals(Object.getOwnPropertyDescriptor(array, 0), undefined);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-slice.js b/deps/v8/test/mjsunit/array-prototype-slice.js
new file mode 100644
index 0000000000..d4bcad277d
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-slice.js
@@ -0,0 +1,21 @@
+// 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.
+
+/* Test behaviors when the prototype has elements */
+
+// slice
+(function () {
+ var array = [,];
+
+ function slice() {
+ return array.slice();
+ }
+
+ assertEquals(slice(), [,]);
+
+ array.__proto__.push(5);
+ var narr = slice();
+ assertNotEquals(Object.getOwnPropertyDescriptor(narr, 0), undefined);
+ assertEquals(narr[0], 5);
+})();
diff --git a/deps/v8/test/mjsunit/array-prototype-some.js b/deps/v8/test/mjsunit/array-prototype-some.js
new file mode 100644
index 0000000000..2118444168
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-prototype-some.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.
+
+/* Test behaviors when the prototype has elements */
+
+// some
+
+(function () {
+ var array = [,];
+
+ function some() {
+ return array.some(v => v > 0);
+ }
+
+ assertEquals(some(), false);
+
+ array.__proto__.push(6);
+ assertEquals(some(), true);
+})();
diff --git a/deps/v8/test/mjsunit/array-reverse.js b/deps/v8/test/mjsunit/array-reverse.js
new file mode 100644
index 0000000000..11aeb60cac
--- /dev/null
+++ b/deps/v8/test/mjsunit/array-reverse.js
@@ -0,0 +1,70 @@
+// 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.
+
+assertArrayEquals([], [].reverse());
+assertArrayEquals([8, 6, 4, 2], [2, 4, 6, 8].reverse());
+assertArrayEquals([0.8, 0.6, 0.4], [0.4, 0.6, 0.8].reverse());
+assertArrayEquals(["str4", "str3", "str2"], ["str2", "str3", "str4"].reverse());
+
+assertArrayEquals([4,3,,1], [1,,3,4].reverse());
+assertArrayEquals([4,,2,1], [1,2,,4].reverse());
+assertArrayEquals([5,,3,,1], [1,,3,,5].reverse());
+
+function TestReverseWithObject() {
+ let obj = { length: 5 };
+ obj[0] = "foo";
+ obj[3] = "bar";
+ Array.prototype.reverse.call(obj);
+
+ assertArrayEquals([,"bar",,,"foo"], obj);
+}
+TestReverseWithObject();
+
+function TestReverseWithPrototypeChain() {
+ let proto = { 0: "foo", 19: "bar" };
+ let obj = { length: 20, 5: "foobar", __proto__: proto };
+ Array.prototype.reverse.call(obj);
+
+ assertEquals("bar", obj[0]);
+ assertEquals("foobar", obj[14]);
+ assertEquals("foo", obj[19]);
+}
+TestReverseWithPrototypeChain();
+
+function TestReverseWithTypedArrays() {
+ const constructors = [
+ Uint8Array,
+ Int8Array,
+ Uint16Array,
+ Int16Array,
+ Uint32Array,
+ Int32Array,
+ Uint8ClampedArray,
+ Float32Array,
+ Float64Array
+ ];
+
+ for (const constructor of constructors) {
+ const array_odd = new constructor([1, 2, 3]);
+ Array.prototype.reverse.call(array_odd);
+ assertArrayEquals([3, 2, 1], array_odd, constructor);
+
+ const array_even = new constructor([1, 2, 3, 4]);
+ Array.prototype.reverse.call(array_even);
+ assertArrayEquals([4, 3, 2, 1], array_even, constructor);
+
+ // Array.prototype.reverse respects shadowing length on TypedArrays.
+ const array = new constructor([1, 2, 3, 4]);
+ Object.defineProperty(array, 'length', {value: 2});
+ Array.prototype.reverse.call(array);
+
+ assertArrayEquals([2, 1], array, constructor);
+
+ const array_shadowed_length = new constructor([1, 2]);
+ Object.defineProperty(array_shadowed_length, 'length', {value: 5});
+
+ assertThrows(() => Array.prototype.reverse.call(array_shadowed_length));
+ }
+}
+TestReverseWithTypedArrays();
diff --git a/deps/v8/test/mjsunit/asm/asm-heap.js b/deps/v8/test/mjsunit/asm/asm-heap.js
new file mode 100644
index 0000000000..d0d190a73d
--- /dev/null
+++ b/deps/v8/test/mjsunit/asm/asm-heap.js
@@ -0,0 +1,99 @@
+// 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: --validate-asm --allow-natives-syntax --expose-gc --mock-arraybuffer-allocator
+
+let gCounter = 1000;
+let gMinHeap = new ArrayBuffer(1 << 12);
+let gStdlib = {Uint8Array: Uint8Array};
+
+// The template of asm.js modules used in this test.
+function Template(stdlib, ffi, heap) {
+ "use asm";
+ var MEM8 = new stdlib.Uint8Array(heap);
+ function foo() { return VAL; }
+ return { foo: foo };
+}
+
+// Create a fresh module each time.
+function NewModule() {
+ // Use eval() to get a unique module each time.
+ let val = gCounter++;
+ let string = (Template + "; Template").replace("VAL", "" + val);
+// print(string);
+ let module = eval(string);
+// print(module);
+ module(gStdlib, {}, gMinHeap);
+ assertTrue(%IsAsmWasmCode(module));
+ return {module: module, val: val};
+}
+
+(function TestValid_PowerOfTwo() {
+ print("TestValid_PowerOfTwo...");
+ let r = NewModule();
+ for (let i = 12; i <= 24; i++) {
+ gc(); // Likely OOM otherwise.
+ let size = 1 << i;
+ print(" size=" + size);
+ let heap = new ArrayBuffer(size);
+ var instance = r.module(gStdlib, {}, heap);
+ assertTrue(%IsAsmWasmCode(r.module));
+ assertEquals(r.val, instance.foo());
+ }
+})();
+
+(function TestValid_Multiple() {
+ print("TestValid_Multiple...");
+ let r = NewModule();
+ for (let i = 1; i < 47; i += 7) {
+ gc(); // Likely OOM otherwise.
+ let size = i * (1 << 24);
+ print(" size=" + size);
+ let heap = new ArrayBuffer(size);
+ var instance = r.module(gStdlib, {}, heap);
+ assertTrue(%IsAsmWasmCode(r.module));
+ assertEquals(r.val, instance.foo());
+ }
+})();
+
+(function TestInvalid_TooSmall() {
+ print("TestInvalid_TooSmall...");
+ for (let i = 1; i < 12; i++) {
+ let size = 1 << i;
+ print(" size=" + size);
+ let r = NewModule();
+ let heap = new ArrayBuffer(size);
+ var instance = r.module(gStdlib, {}, heap);
+ assertFalse(%IsAsmWasmCode(r.module));
+ assertEquals(r.val, instance.foo());
+ }
+})();
+
+(function TestInValid_NonPowerOfTwo() {
+ print("TestInvalid_NonPowerOfTwo...");
+ for (let i = 12; i <= 24; i++) {
+ gc(); // Likely OOM otherwise.
+ let size = 1 + (1 << i);
+ print(" size=" + size);
+ let r = NewModule();
+ let heap = new ArrayBuffer(size);
+ var instance = r.module(gStdlib, {}, heap);
+ assertFalse(%IsAsmWasmCode(r.module));
+ assertEquals(r.val, instance.foo());
+ }
+})();
+
+(function TestInValid_NonMultiple() {
+ print("TestInvalid_NonMultiple...");
+ for (let i = (1 << 24); i < (1 << 25); i += (1 << 22)) {
+ gc(); // Likely OOM otherwise.
+ let size = i + (1 << 20);
+ print(" size=" + size);
+ let r = NewModule();
+ let heap = new ArrayBuffer(size);
+ var instance = r.module(gStdlib, {}, heap);
+ assertFalse(%IsAsmWasmCode(r.module));
+ assertEquals(r.val, instance.foo());
+ }
+})();
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 8699346bf2..3ddff992f7 100644
--- a/deps/v8/test/mjsunit/compiler/array-multiple-receiver-maps.js
+++ b/deps/v8/test/mjsunit/compiler/array-multiple-receiver-maps.js
@@ -3,6 +3,7 @@
// found in the LICENSE file.
// Flags: --allow-natives-syntax --opt --no-always-opt
+// Flags: --no-stress-background-compile
let id = 0;
diff --git a/deps/v8/test/mjsunit/compiler/array-slice-clone.js b/deps/v8/test/mjsunit/compiler/array-slice-clone.js
new file mode 100644
index 0000000000..610fa17c1a
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/array-slice-clone.js
@@ -0,0 +1,365 @@
+// 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: --allow-natives-syntax --opt
+
+
+// Test CloneFastJSArray inserted by JSCallReducer for Array.prototype.slice.
+// CloneFastJSArray produces COW arrays if the original array is COW.
+
+// Trigger JSCallReducer on slice() and slice(0)
+(function() {
+ const arr = [1,2,3,4,5];
+
+ function slice() {
+ return arr.slice();
+ }
+
+ function slice0() {
+ return arr.slice(0);
+ }
+
+ assertEquals(arr, slice());
+ assertFalse(arr === slice());
+ assertEquals(slice(), slice0());
+ assertEquals(slice0(), slice());
+
+ %OptimizeFunctionOnNextCall(slice0);
+ %OptimizeFunctionOnNextCall(slice);
+
+ assertEquals(slice(), slice0());
+ assertOptimized(slice); assertOptimized(slice0);
+})();
+
+// This will cause deopt of slice by a CheckMap installed by
+// JSNativeContextSpecialization::ReduceNamedAccess
+(function() {
+ const arr = [1,2,3,4,5];
+
+ function slice() {
+ return arr.slice();
+ }
+
+ assertEquals(arr, slice());
+ assertEquals(slice(), arr);
+
+ %OptimizeFunctionOnNextCall(slice);
+ slice();
+
+ // Trigger deopt here
+ arr.push(7.2);
+ assertEquals(slice()[5], 7.2);
+})();
+
+// There should not be a deopt cycle.
+(function() {
+ const arr = [1,2,3,4,5];
+
+ function slice() {
+ return arr.slice();
+ }
+
+ assertEquals(arr, slice());
+ assertEquals(slice(), arr);
+
+ %OptimizeFunctionOnNextCall(slice);
+ // Trigger opt
+ assertEquals(slice(), arr);
+
+ // Trigger deopt by CheckMap from JSNativeContextSpecialization
+ arr.push(7.2);
+ slice();
+
+ %OptimizeFunctionOnNextCall(slice);
+ // Trigger opt again
+ slice();
+
+ // Should not deopt again
+ arr.push(8.2);
+ slice();
+ assertOptimized(slice);
+})();
+
+// JSCallReducer will not reduce because the species has been modified
+(function() {
+ const array = [3,4,5];
+
+ function slice(){
+ return array.slice();
+ }
+
+ class MyArray extends Array {};
+ array.constructor = MyArray;
+
+ slice(); slice();
+
+ %OptimizeFunctionOnNextCall(slice);
+ var narr = slice();
+ assertInstanceof(narr, MyArray);
+})();
+
+(function() {
+ const array = [3,4,5];
+
+ function slice(){
+ return array.slice();
+ }
+
+ slice(); slice();
+
+ %OptimizeFunctionOnNextCall(slice);
+
+ slice();
+
+ class MyArray extends Array {};
+ array.constructor = MyArray;
+ // deopt
+ var narr = slice();
+ // if not deopt, narr will be instanceof Array
+ assertTrue(narr instanceof MyArray);
+})();
+
+// JSCallReducer adds check for UnreliableReceiverMaps
+(function() {
+ const arr = [1,2,3,4,5];
+
+ function slice() {
+ return arr.slice();
+ }
+
+ slice(); slice();
+ arr.foo = 6.2;
+
+ %OptimizeFunctionOnNextCall(slice);
+ // JSCallReducer will add check for UnreliableReceiverMaps
+ slice();
+
+ // Trigger deopt because of DependOnStableMaps
+ // installed by JSNativeContextSpecialization,
+ // but not the check installed by ReduceArrayPrototypeSlice itself
+ arr.bar = 7.2;
+
+ let narr = slice();
+ assertEquals(arr, narr);
+ assertEquals(narr.foo, undefined);
+ assertEquals(narr.bar, undefined);
+})();
+
+// Multiple maps
+(function() {
+ const iarr = [1,2,3];
+ const darr = [2.1, 3.3, 0.2];
+
+ function slice(arr) {
+ return arr.slice();
+ }
+
+ slice(iarr); slice(darr);
+ slice(iarr); slice(darr);
+
+ %OptimizeFunctionOnNextCall(slice);
+ // The optimization works for both maps
+ assertEquals(iarr, slice(iarr));
+ assertEquals(darr, slice(darr));
+ assertOptimized(slice);
+})();
+
+// Tests for the branch of CanInlineArrayIteratingBuiltin
+
+// JSCallReducer will not reduce to CloneFastJSArray
+// if array's prototype is not JS_ARRAY_TYPE
+(function () {
+ class MyArray extends Array {
+ constructor() {
+ super();
+ this[6]= 6;
+ }
+ }
+ let array = new MyArray(3, 5, 4);
+
+ function slice() {
+ return array.slice();
+ }
+
+ assertEquals(slice(),array);
+ slice();
+
+ %OptimizeFunctionOnNextCall(slice);
+ let narr = slice();
+ // here, slice supposes to call MyArray's constructor.
+ // If we optimize with CloneFastJSArray, Array's constructor is called instead.
+ assertEquals(narr[6], 6);
+ assertTrue(narr instanceof MyArray);
+})();
+
+// JSCallReducer will not reduce to CloneFastJSArray
+// if array's instance type is not JS_ARRAY_TYPE.
+// CloneFastJSArray does not work with non JS_ARRAY_TYPE.
+// Check : receiver_map->instance_type() == JS_ARRAY_TYPE
+(function () {
+ var x = {"0" : 0, "2": 2} ;
+ x.__proto__ = Array.prototype;
+
+ function slice() {
+ return x.slice();
+ }
+
+ slice(); slice();
+
+ %OptimizeFunctionOnNextCall(slice);
+ assertEquals(slice(), []);
+})();
+
+// JSCallReducer will not reduce to CloneFastJSArray
+// since array is not Fast Elements Kind
+// Check : IsFastElementsKind(receiver_map->elements_kind())
+(function () {
+ var array = [3, 4, 5];
+
+ function slice() {
+ return array.slice();
+ }
+
+ assertEquals(slice(),array);
+ slice();
+
+ // a sparse array switches to Dictionary Elements
+ array[9999] = 0;
+ %OptimizeFunctionOnNextCall(slice);
+ var narr = slice();
+ assertEquals(narr, array);
+})();
+
+(function () {
+ var array = [3, 4, 5];
+
+ function slice() {
+ return array.slice();
+ }
+
+ assertEquals(slice(),array);
+ slice();
+
+ %OptimizeFunctionOnNextCall(slice);
+ slice();
+
+ // a sparse array switches to Dictionary Elements
+ array[9999] = 0;
+ // trigger deopt because map changes
+ assertEquals(slice(),array);
+})();
+
+// JSCallReducer will not reduce to CloneFastJSArray
+// if array is used as a prototype and has unstable map
+(function () {
+ var array = [3, 5, 4];
+
+ function slice(arr) {
+ return arr.slice();
+ }
+
+ // make array's map is_prototype_map()
+ var x = {__proto__ : array};
+
+ assertEquals(slice(array),array);
+ slice(array);
+
+ // make array's map unstable
+ array.push(6.3);
+ slice(array);
+
+ %OptimizeFunctionOnNextCall(slice);
+
+ assertEquals(slice(array),array);
+})();
+
+// JSCallReducer will not reduce to CloneFastJSArray
+// if the Array prototype got some elements.
+// Check: isolate->IsNoElementsProtectorIntact()
+(function () {
+ var array = [, 6, 6];
+
+ function slice() {
+ return array.slice();
+ }
+
+ assertEquals(slice(),array);
+ slice();
+
+ array.__proto__.push(6);
+
+ %OptimizeFunctionOnNextCall(slice);
+
+ // if we optimized, we would get [ , 6, 6]
+ // here, slice copies elements from both the object and the prototype
+ let narr = slice();
+ assertNotEquals(Object.getOwnPropertyDescriptor(narr,0), undefined);
+ assertEquals(narr, [6, 6, 6]);
+})();
+
+(function () {
+ var array = [, 6, 6];
+
+ function slice() {
+ return array.slice();
+ }
+
+ assertEquals(slice(),array);
+ slice();
+
+ %OptimizeFunctionOnNextCall(slice);
+ slice();
+
+ // Deopt
+ array.__proto__.push(6);
+ let narr = slice();
+ assertNotEquals(Object.getOwnPropertyDescriptor(narr, 0), undefined);
+ assertEquals(narr[0], 6);
+})();
+
+// JSCallReducer will not reduce to CloneFastJSArray
+// if the Array prototype is not original
+// Check: isolate->IsAnyInitialArrayPrototype(receiver_prototype)
+(function () {
+ var array = [6, , 6];
+
+ function slice() {
+ return array.slice();
+ }
+
+ assertEquals(slice(),array);
+ slice();
+
+ // change the prototype
+ array.__proto__ = [ , 6, ];
+
+ %OptimizeFunctionOnNextCall(slice);
+ let narr = slice();
+ // if optimized, we would get [6, , 6]
+ assertNotEquals(Object.getOwnPropertyDescriptor(narr, 1), undefined);
+ assertEquals(narr, [6,6,6]);
+})();
+
+(function () {
+ var array = [6, ,6];
+
+ function slice() {
+ return array.slice();
+ }
+
+ assertEquals(slice(),array);
+ slice();
+
+ %OptimizeFunctionOnNextCall(slice);
+ slice();
+
+ // change the prototype
+ array.__proto__ = [,6,];
+ // deopt because of map changed
+ let narr = slice();
+
+ // if optimized, we would get [6, , 6]
+ assertNotEquals(Object.getOwnPropertyDescriptor(narr, 1), undefined);
+ assertEquals(narr, [6,6,6]);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/dataview-deopt.js b/deps/v8/test/mjsunit/compiler/dataview-deopt.js
new file mode 100644
index 0000000000..b19de30e5d
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/dataview-deopt.js
@@ -0,0 +1,58 @@
+// 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: --allow-natives-syntax --opt --no-always-opt
+
+// Check that there are no deopt loops for DataView methods.
+
+var buffer = new ArrayBuffer(64);
+var dataview = new DataView(buffer, 8, 24);
+
+// Check DataView getters.
+
+function readUint8(offset) {
+ return dataview.getUint8(offset);
+}
+
+function warmupRead(f) {
+ f(0);
+ f(1);
+ %OptimizeFunctionOnNextCall(f);
+ f(2);
+ f(3);
+}
+
+warmupRead(readUint8);
+assertOptimized(readUint8);
+readUint8(0.5); // Deopts.
+assertUnoptimized(readUint8);
+
+warmupRead(readUint8);
+assertOptimized(readUint8);
+readUint8(1.5); // Doesn't deopt because getUint8 didn't get inlined this time.
+assertOptimized(readUint8);
+
+// Check DataView setters.
+
+function writeUint8(offset, value) {
+ dataview.setUint8(offset, value);
+}
+
+function warmupWrite(f) {
+ f(0, 0);
+ f(0, 1);
+ %OptimizeFunctionOnNextCall(f);
+ f(0, 2);
+ f(0, 3);
+}
+
+warmupWrite(writeUint8);
+assertOptimized(writeUint8);
+writeUint8(0.5, 0); // Deopts.
+assertUnoptimized(writeUint8);
+
+warmupWrite(writeUint8);
+assertOptimized(writeUint8);
+writeUint8(1.5, 0); // Doesn't deopt.
+assertOptimized(writeUint8);
diff --git a/deps/v8/test/mjsunit/compiler/dataview-get.js b/deps/v8/test/mjsunit/compiler/dataview-get.js
index 6c64410344..78c6bdf4ac 100644
--- a/deps/v8/test/mjsunit/compiler/dataview-get.js
+++ b/deps/v8/test/mjsunit/compiler/dataview-get.js
@@ -131,43 +131,56 @@ assertEquals(b4, readFloat64(16));
dataview.setFloat64(16, b4, true);
assertEquals(b4, readFloat64(16, true));
-
-// TurboFan out of bounds read, throw with exception handler.
+// TurboFan out of bounds reads deopt.
assertOptimized(readInt8Handled);
assertInstanceof(readInt8Handled(24), RangeError);
-assertOptimized(readInt8Handled);
+assertUnoptimized(readInt8Handled);
assertOptimized(readInt16Handled);
assertInstanceof(readInt16Handled(23), RangeError);
-assertOptimized(readInt16Handled);
+assertUnoptimized(readInt16Handled);
assertOptimized(readInt32Handled);
assertInstanceof(readInt32Handled(21), RangeError);
-assertOptimized(readInt32Handled);
+assertUnoptimized(readInt32Handled);
// Without exception handler.
assertOptimized(readUint8);
assertThrows(() => readUint8(24));
-assertOptimized(readUint8);
+assertUnoptimized(readUint8);
assertOptimized(readFloat32);
assertThrows(() => readFloat32(21));
-assertOptimized(readFloat32);
+assertUnoptimized(readFloat32);
assertOptimized(readFloat64);
assertThrows(() => readFloat64(17));
-assertOptimized(readFloat64);
-
+assertUnoptimized(readFloat64);
-// TurboFan deoptimizations.
-assertOptimized(readInt8Handled);
-assertInstanceof(readInt8Handled(-1), RangeError); // Negative Smi deopts.
-assertUnoptimized(readInt8Handled);
-
-warmup(readInt8Handled);
-assertOptimized(readInt8Handled);
-assertEquals(values[3], readInt8Handled(3.14)); // Non-Smi index deopts.
-assertUnoptimized(readInt8Handled);
-
-// TurboFan neutered buffer.
-warmup(readInt8Handled);
-assertOptimized(readInt8Handled);
-%ArrayBufferNeuter(buffer);
-assertInstanceof(readInt8Handled(0), TypeError);
-assertOptimized(readInt8Handled);
+// Negative Smi deopts.
+(function() {
+ function readInt8Handled(offset) {
+ try { return dataview.getInt8(offset); } catch (e) { return e; }
+ }
+ warmup(readInt8Handled);
+ assertOptimized(readInt8Handled);
+ assertInstanceof(readInt8Handled(-1), RangeError);
+ assertUnoptimized(readInt8Handled);
+})();
+
+// Non-Smi index deopts.
+(function() {
+ function readUint8(offset) { return dataview.getUint8(offset); }
+ warmup(readUint8);
+ assertOptimized(readUint8);
+ assertEquals(values[3], readUint8(3.14));
+ assertUnoptimized(readUint8);
+})();
+
+// TurboFan neutered buffer deopts.
+(function() {
+ function readInt8Handled(offset) {
+ try { return dataview.getInt8(offset); } catch (e) { return e; }
+ }
+ warmup(readInt8Handled);
+ assertOptimized(readInt8Handled);
+ %ArrayBufferNeuter(buffer);
+ assertInstanceof(readInt8Handled(0), TypeError);
+ assertUnoptimized(readInt8Handled);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/dataview-set.js b/deps/v8/test/mjsunit/compiler/dataview-set.js
index 07bcb8d93c..4759597881 100644
--- a/deps/v8/test/mjsunit/compiler/dataview-set.js
+++ b/deps/v8/test/mjsunit/compiler/dataview-set.js
@@ -117,15 +117,15 @@ assertEquals(b4, dataview.getFloat64(8));
writeFloat64(8, b4, true);
assertEquals(b4, dataview.getFloat64(8, true));
-// TurboFan out of bounds read, throw with exception handler.
+// TurboFan out of bounds read, deopt.
assertOptimized(writeInt8Handled);
assertInstanceof(writeInt8Handled(24, 0), RangeError);
-assertOptimized(writeInt8Handled);
+assertUnoptimized(writeInt8Handled);
-// Without exception handler.
+// Without exception handler, deopt too.
assertOptimized(writeUint8);
assertThrows(() => writeUint8(24, 0));
-assertOptimized(writeUint8);
+assertUnoptimized(writeUint8);
// None of the stores wrote out of bounds.
var bytes = new Uint8Array(buffer);
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
new file mode 100644
index 0000000000..b75f3185ac
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-iterator-prototype-next.js
@@ -0,0 +1,24 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+(function () {
+ var array = [,];
+
+ function next() {
+ return array[Symbol.iterator]().next();
+ }
+
+ assertEquals(next().value, undefined);
+ assertEquals(next().value, undefined);
+
+ %OptimizeFunctionOnNextCall(next);
+ assertEquals(next().value, undefined);
+
+ array.__proto__.push(5);
+ assertEquals(next().value, 5);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-every.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-every.js
new file mode 100644
index 0000000000..0ebf126fa6
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-every.js
@@ -0,0 +1,26 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// every
+
+(function () {
+ var array = [,];
+
+ function every() {
+ return array.every(v => v > 0);
+ }
+
+ every(); every();
+
+ %OptimizeFunctionOnNextCall(every);
+ assertEquals(every(), true);
+
+ array.__proto__.push(-6);
+ //deopt
+ assertEquals(every(), false);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-filter.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-filter.js
new file mode 100644
index 0000000000..fcae939eb8
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-filter.js
@@ -0,0 +1,28 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// filter
+
+(function () {
+ var array = [,];
+
+ function filter() {
+ return array.filter(v => v > 0);
+ }
+
+ filter(); filter();
+
+ %OptimizeFunctionOnNextCall(filter);
+ assertEquals(filter(), []);
+
+ array.__proto__.push(6);
+ // deopt
+ var narr = filter();
+ assertNotEquals(Object.getOwnPropertyDescriptor(narr, 0), undefined);
+ assertEquals(narr, [6]);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-find.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-find.js
new file mode 100644
index 0000000000..e8b5b9bd1b
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-find.js
@@ -0,0 +1,26 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// find
+
+(function () {
+ var array = [,];
+
+ function find() {
+ return array.find(v => v > 0);
+ }
+
+ find(); find();
+
+ %OptimizeFunctionOnNextCall(find);
+ assertEquals(find(), undefined);
+
+ array.__proto__.push(6);
+ // deopt
+ assertEquals(find(), 6);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-findindex.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-findindex.js
new file mode 100644
index 0000000000..37866a4506
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-findindex.js
@@ -0,0 +1,26 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// findIndex
+
+(function () {
+ var array = [,];
+
+ function findIndex() {
+ return array.findIndex(v => v > 0);
+ }
+
+ findIndex(); findIndex();
+
+ %OptimizeFunctionOnNextCall(findIndex);
+ assertEquals(findIndex(), -1);
+
+ array.__proto__.push(6);
+ // deopt
+ assertEquals(findIndex(), 0);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-foreach.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-foreach.js
new file mode 100644
index 0000000000..6db9078e1b
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-foreach.js
@@ -0,0 +1,31 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// forEach
+
+(function () {
+ var array = [,];
+
+ function increment (v, k, arr) { arr[k] = v + 1; }
+ function forEach() {
+ array.forEach(increment);
+ }
+ forEach(); forEach();
+
+ %OptimizeFunctionOnNextCall(forEach);
+
+ forEach();
+ assertEquals(array, [,]);
+
+ array.__proto__.push(5);
+ assertEquals(Object.getOwnPropertyDescriptor(array, 0), undefined);
+ // deopt
+ forEach();
+ assertNotEquals(Object.getOwnPropertyDescriptor(array, 0), undefined);
+ assertEquals(array[0], 6); // this reads from the prototype
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-includes.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-includes.js
new file mode 100644
index 0000000000..77aedfe1e6
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-includes.js
@@ -0,0 +1,103 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// includes
+
+(function() {
+ const iarr = [0,1,2];
+ const darr = [0.0, 2.0, 3.3];
+
+ function includes(arr, val) {
+ return arr.includes(val);
+ }
+
+ assertTrue(includes(iarr, 0)); assertTrue(includes(darr, 0));
+ assertTrue(includes(iarr, 2)); assertTrue(includes(darr, 2));
+
+ // JSCallReducer for includes not reduce because it only works with single map
+ %OptimizeFunctionOnNextCall(includes);
+
+ assertTrue(includes(iarr, 0));
+ assertTrue(includes(darr, 0));
+})();
+
+(function() {
+ const iarr = [0,1,2];
+
+ function includes(arr, val) {
+ return arr.includes(val);
+ }
+
+ assertTrue(includes(iarr, 0));
+ assertTrue(includes(iarr, 2));
+
+ %OptimizeFunctionOnNextCall(includes);
+
+ assertTrue(includes(iarr, 0));
+
+ const darr = [0.0, 2.0, 3.3];
+ // deopt because of map change
+ assertTrue(includes(darr, 0));
+})();
+
+(function() {
+ const iarr = [,3];
+
+ function includes(arr, val) {
+ return arr.includes(val);
+ }
+
+ iarr.__proto__ = [2];
+
+ // get feedback
+ assertFalse(includes(iarr, 0));
+ assertTrue(includes(iarr, 2));
+
+ %OptimizeFunctionOnNextCall(includes);
+
+ assertFalse(includes(iarr, 0));
+
+ assertTrue(includes(iarr, 2));
+})();
+
+(function() {
+ const iarr = [,3];
+
+ function includes(arr, val) {
+ return arr.includes(val);
+ }
+
+ assertFalse(includes(iarr, 2));
+ assertTrue(includes(iarr, 3));
+
+ %OptimizeFunctionOnNextCall(includes);
+ assertFalse(includes(iarr, 2));
+
+ // deopt because of map change
+ iarr.__proto__ = [2];
+ assertTrue(includes(iarr, 2));
+})();
+
+// This pollutes the Array prototype, so we should not run more tests
+// in the same environment after this.
+(function () {
+ var array = [,];
+
+ function includes(val) {
+ return array.includes(val);
+ }
+
+ includes(6); includes(6);
+
+ %OptimizeFunctionOnNextCall(includes);
+ assertFalse(includes(6));
+
+ array.__proto__.push(6);
+ // deopt because of no_elements_protector
+ assertTrue(includes(6));
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-indexof.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-indexof.js
new file mode 100644
index 0000000000..78cf60507c
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-indexof.js
@@ -0,0 +1,104 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// indexOf
+
+(function() {
+ const iarr = [0,1,2];
+ const darr = [0.0, 2.0, 3.3];
+
+ function indexOf(arr, val) {
+ return arr.indexOf(val);
+ }
+
+ assertEquals(0, indexOf(iarr, 0));
+ assertEquals(0, indexOf(darr, 0));
+ assertEquals(2, indexOf(iarr, 2));
+ assertEquals(1, indexOf(darr, 2));
+
+ // JSCallReducer for indexOf will not reduce
+ // because it only works with single map
+ %OptimizeFunctionOnNextCall(indexOf);
+
+ assertEquals(0, indexOf(iarr, 0));
+ assertEquals(0, indexOf(darr, 0));
+})();
+
+(function() {
+ const iarr = [0,1,2];
+
+ function indexOf(arr, val) {
+ return arr.indexOf(val);
+ }
+
+ assertEquals(0, indexOf(iarr, 0));
+ assertEquals(2, indexOf(iarr, 2));
+
+ %OptimizeFunctionOnNextCall(indexOf);
+
+ assertEquals(0, indexOf(iarr, 0));
+
+ const darr = [0.0, 2.0, 3.3];
+ // deopt because of map change
+ assertEquals(0, indexOf(darr, 0));
+})();
+
+(function() {
+ const iarr = [,3];
+
+ function indexOf(arr, val) {
+ return arr.indexOf(val);
+ }
+
+ iarr.__proto__ = [2];
+ assertEquals(-1, indexOf(iarr, 0));
+ assertEquals(0, indexOf(iarr, 2));
+
+ %OptimizeFunctionOnNextCall(indexOf);
+
+ assertEquals(-1, indexOf(iarr, 0));
+
+ assertEquals(0, indexOf(iarr, 2));
+})();
+
+(function() {
+ const iarr = [,3];
+
+ function indexOf(arr, val) {
+ return arr.indexOf(val);
+ }
+
+ assertEquals(-1, indexOf(iarr, 2));
+ assertEquals(1, indexOf(iarr, 3));
+
+ %OptimizeFunctionOnNextCall(indexOf);
+ assertEquals(-1, indexOf(iarr, 2));
+
+ // deopt because of map change
+ iarr.__proto__ = [2];
+ assertEquals(0, indexOf(iarr, 2));
+})();
+
+// This pollutes the Array prototype, so we should not run more tests
+// in the same environment after this.
+(function () {
+ var array = [,];
+
+ function indexOf(val) {
+ return array.indexOf(val);
+ }
+
+ indexOf(6); indexOf(6);
+
+ %OptimizeFunctionOnNextCall(indexOf);
+ assertEquals(indexOf(6), -1);
+
+ array.__proto__.push(6);
+ // deopt because of no_elements_protector
+ assertEquals(indexOf(6), 0);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-lastindexof.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-lastindexof.js
new file mode 100644
index 0000000000..d47926cd3d
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-lastindexof.js
@@ -0,0 +1,26 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// lastIndexOf
+
+(function () {
+ var array = [,];
+
+ function lastIndexOf(val) {
+ return array.lastIndexOf(val);
+ }
+
+ lastIndexOf(6); lastIndexOf(6);
+
+ %OptimizeFunctionOnNextCall(lastIndexOf);
+ assertEquals(lastIndexOf(6), -1);
+
+ array.__proto__.push(6);
+ // deopt
+ assertEquals(lastIndexOf(6), 0);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-map.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-map.js
new file mode 100644
index 0000000000..29c7d32174
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-map.js
@@ -0,0 +1,29 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// map
+
+(function () {
+ var array = [,];
+
+ function map() {
+ return array.map(x => x + 1);
+ }
+
+ map(); map();
+
+ %OptimizeFunctionOnNextCall(map);
+
+ assertEquals(map(), [,]);
+
+ array.__proto__.push(5);
+ // deopt
+ var narr = map();
+ assertNotEquals(Object.getOwnPropertyDescriptor(narr, 0), undefined);
+ assertEquals(narr[0], 6);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-pop.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-pop.js
new file mode 100644
index 0000000000..6d0fe068e4
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-pop.js
@@ -0,0 +1,26 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test behaviors when the prototype has elements */
+
+// pop
+
+(function () {
+ var array = [, , , ,];
+
+ function pop() {
+ return array.pop();
+ }
+
+ assertEquals(pop(), undefined);
+ assertEquals(pop(), undefined);
+
+ %OptimizeFunctionOnNextCall(pop);
+ assertEquals(pop(), undefined);
+
+ array.__proto__.push(6);
+ assertEquals(pop(), 6);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-reduce.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-reduce.js
new file mode 100644
index 0000000000..d2ba0db0f8
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-reduce.js
@@ -0,0 +1,31 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// reduce
+
+(function () {
+ var array = [, 3];
+
+ function accumulate (prev, cur, curIdx, arr) { arr[curIdx] = cur + prev; }
+ function reduce() {
+ array.reduce(accumulate);
+ }
+
+ reduce(); reduce();
+
+ %OptimizeFunctionOnNextCall(reduce);
+
+ reduce();
+ assertEquals(array, [,3]);
+
+ array.__proto__.push(3);
+ // deopt
+ reduce();
+ assertEquals(array, [, 6]);
+ assertEquals(Object.getOwnPropertyDescriptor(array, 0), undefined);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-slice.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-slice.js
new file mode 100644
index 0000000000..6b2d5fa22d
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-slice.js
@@ -0,0 +1,29 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// slice
+
+(function () {
+ var array = [,];
+
+ function slice() {
+ return array.slice();
+ }
+
+ slice(); slice();
+
+ %OptimizeFunctionOnNextCall(slice);
+
+ assertEquals(slice(), [,]);
+
+ array.__proto__.push(5);
+ // deopt
+ var narr = slice();
+ assertNotEquals(Object.getOwnPropertyDescriptor(narr, 0), undefined);
+ assertEquals(narr[0], 5);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/deopt-array-prototype-some.js b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-some.js
new file mode 100644
index 0000000000..d9604d0c76
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-array-prototype-some.js
@@ -0,0 +1,26 @@
+// 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: --allow-natives-syntax --opt
+
+/* Test deopt behaviors when the prototype has elements */
+
+// some
+
+(function () {
+ var array = [,];
+
+ function some() {
+ return array.some(v => v > 0);
+ }
+
+ some(); some();
+
+ %OptimizeFunctionOnNextCall(some);
+ assertEquals(some(), false);
+
+ array.__proto__.push(6);
+ //deopt
+ assertEquals(some(), true);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/number-constructor-deopt.js b/deps/v8/test/mjsunit/compiler/number-constructor-deopt.js
new file mode 100644
index 0000000000..edffc9ec53
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/number-constructor-deopt.js
@@ -0,0 +1,32 @@
+// 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: --allow-natives-syntax
+
+// This test writes {} to x to trigger lazy deopt
+// from inside the number constructor.
+var x = "5";
+var b = false;
+
+check = function() {
+ if (b) x = {};
+ return 0;
+}
+
+var obj = {};
+obj.valueOf = check;
+
+function f() {
+ try {
+ return x + Number(obj);
+ } catch(e) {
+ console.log(e.stack);
+ }
+}
+
+f();
+f();
+%OptimizeFunctionOnNextCall(f);
+b = true;
+f();
diff --git a/deps/v8/test/mjsunit/empirical_max_arraybuffer.js b/deps/v8/test/mjsunit/empirical_max_arraybuffer.js
new file mode 100644
index 0000000000..cacefd4692
--- /dev/null
+++ b/deps/v8/test/mjsunit/empirical_max_arraybuffer.js
@@ -0,0 +1,101 @@
+// 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.
+
+let kMax31BitSmi = (1 << 30) - 1;
+let k1MiB = 1 * 1024 * 1024;
+let k1GiB = 1 * 1024 * 1024 * 1024;
+let k4GiB = 4 * k1GiB;
+let kPageSize = 65536;
+let kMaxArrayBufferSize = 2 * k1GiB - kPageSize; // TODO(titzer): raise this to 4GiB
+let kStrideLength = 65536;
+
+(function Test() {
+ var buffer;
+ try {
+ buffer = new ArrayBuffer(kMaxArrayBufferSize);
+ } catch (e) {
+ print("OOM: sorry, best effort max array buffer size test!");
+ return;
+ }
+
+ print("Allocated " + buffer.byteLength + " bytes");
+ assertEquals(kMaxArrayBufferSize, buffer.byteLength);
+
+ function probe(view, stride, f) {
+ print("--------------------");
+ let max = view.length;
+ for (let i = 0; i < max; i += stride) {
+ view[i] = f(i);
+ }
+ for (let i = 0; i < max; i += stride) {
+ // print(`${i} = ${f(i)}`);
+ assertEquals(f(i), view[i]);
+ }
+ }
+
+ {
+ // Make an uint32 view and probe it.
+ let elemSize = 4;
+ let viewSize = kMaxArrayBufferSize / elemSize;
+ // TODO(titzer): view sizes are limited to 31 bit SMIs. fix.
+ if (viewSize <= kMax31BitSmi) {
+ let uint32 = new Uint32Array(buffer);
+ assertEquals(kMaxArrayBufferSize / elemSize, uint32.length);
+ probe(uint32, kStrideLength / elemSize,
+ i => (0xaabbccee ^ ((i >> 11) * 0x110005)) >>> 0);
+ }
+ }
+
+ {
+ // Make an uint16 view and probe it.
+ let elemSize = 2;
+ let viewSize = kMaxArrayBufferSize / elemSize;
+ // TODO(titzer): view sizes are limited to 31 bit SMIs. fix.
+ if (viewSize <= kMax31BitSmi) {
+ let uint16 = new Uint16Array(buffer);
+ assertEquals(kMaxArrayBufferSize / elemSize, uint16.length);
+ probe(uint16, kStrideLength / elemSize,
+ i => (0xccee ^ ((i >> 11) * 0x110005)) & 0xFFFF);
+ }
+ }
+
+ {
+ // Make an uint8 view and probe it.
+ let elemSize = 1;
+ let viewSize = kMaxArrayBufferSize / elemSize;
+ // TODO(titzer): view sizes are limited to 31 bit SMIs. fix.
+ if (viewSize <= kMax31BitSmi) {
+ let uint8 = new Uint8Array(buffer);
+ assertEquals(kMaxArrayBufferSize / elemSize, uint8.length);
+ probe(uint8, kStrideLength / elemSize,
+ i => (0xee ^ ((i >> 11) * 0x05)) & 0xFF);
+ }
+ }
+
+ {
+ // Make a float64 view and probe it.
+ let elemSize = 8;
+ let viewSize = kMaxArrayBufferSize / elemSize;
+ // TODO(titzer): view sizes are limited to 31 bit SMIs. fix.
+ if (viewSize <= kMax31BitSmi) {
+ let float64 = new Float64Array(buffer);
+ assertEquals(kMaxArrayBufferSize / elemSize, float64.length);
+ probe(float64, kStrideLength / elemSize,
+ i => 0xaabbccee ^ ((i >> 11) * 0x110005));
+ }
+ }
+
+ {
+ // Make a float32 view and probe it.
+ let elemSize = 4;
+ let viewSize = kMaxArrayBufferSize / elemSize;
+ // TODO(titzer): view sizes are limited to 31 bit SMIs. fix.
+ if (viewSize <= kMax31BitSmi) {
+ let float32 = new Float32Array(buffer);
+ assertEquals(kMaxArrayBufferSize / elemSize, float32.length);
+ probe(float32, kStrideLength / elemSize,
+ i => Math.fround(0xaabbccee ^ ((i >> 11) * 0x110005)));
+ }
+ }
+})();
diff --git a/deps/v8/test/mjsunit/es6/array-fill-receiver.js b/deps/v8/test/mjsunit/es6/array-fill-receiver.js
new file mode 100644
index 0000000000..21d7a2ab03
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/array-fill-receiver.js
@@ -0,0 +1,118 @@
+// 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: --allow-natives-syntax
+
+// Ensure `Array.prototype.fill` functions correctly for numerous elements
+// kinds.
+
+// If no arguments are provided, call Array.p.fill without any arguments,
+// otherwise the test is allowed to specify what value to use to better control
+// ElementsKind transitions. From and to is provided by the harness.
+function callAndAssertFill(object, test_value, harness_value, from, to) {
+ let value = arguments.length > 2 ? test_value : harness_value;
+
+ Array.prototype.fill.call(object, value, from, to);
+
+ %HeapObjectVerify(object);
+ assertArrayHasValueInRange(object, value, from, to);
+}
+
+function assertArrayHasValueInRange(obj, value, from, to) {
+ for (let i = from; i < to; ++i) {
+ assertEquals(value, obj[i]);
+ }
+}
+
+// Tests are executed multiple times. Creating arrays using literal notation
+// will create COW-Arrays, which will propagate the most general ElementsKind
+// back to their allocation site.
+// pristineArray will always return a 🐄-Array with the ElementsKind we actually
+// want.
+let i = 0;
+function pristineArray(str) {
+ return eval(str + "//" + (i++));
+}
+
+let tests = {
+ ARRAY_PACKED_ELEMENTS(value, from, to) {
+ let array = pristineArray(
+ `["Some string", {}, /foobar/, "Another string", {}]`);
+ assertTrue(%HasObjectElements(array));
+ assertFalse(%HasHoleyElements(array));
+
+ callAndAssertFill(array, "42", ...arguments);
+ },
+
+ ARRAY_HOLEY_ELEMENTS(value, from, to) {
+ let array = pristineArray(`["Some string", , {}, , "Another string"]`);
+ assertTrue(%HasObjectElements(array));
+ assertTrue(%HasHoleyElements(array));
+
+ callAndAssertFill(array, "42", ...arguments);
+ },
+
+ ARRAY_PACKED_SMI_ELEMENTS(value, from, to) {
+ let array = pristineArray(`[0, -42, 5555, 23, 6]`);
+ assertTrue(%HasSmiElements(array));
+ assertFalse(%HasHoleyElements(array));
+
+ callAndAssertFill(array, 42, ...arguments);
+ },
+
+ ARRAY_HOLEY_SMI_ELEMENTS(value, from, to) {
+ let array = pristineArray(`[0, , 5555, , 6]`);
+ assertTrue(%HasSmiElements(array));
+ assertTrue(%HasHoleyElements(array));
+
+ callAndAssertFill(array, 42, ...arguments);
+ },
+
+ ARRAY_PACKED_DOUBLE_ELEMENTS(value, from, to) {
+ let array = pristineArray(`[3.14, 7.00001, NaN, -25.3333, 1.0]`);
+ assertTrue(%HasDoubleElements(array));
+ assertFalse(%HasHoleyElements(array));
+
+ callAndAssertFill(array, 42.42, ...arguments);
+ },
+
+ ARRAY_HOLEY_DOUBLE_ELEMENTS(value, from, to) {
+ let array = pristineArray(`[3.14, , , , 1.0]`);
+ assertTrue(%HasDoubleElements(array));
+ assertTrue(%HasHoleyElements(array));
+
+ callAndAssertFill(array, 42.42, ...arguments);
+ },
+
+ ARRAY_DICTIONARY_ELEMENTS(value, from, to) {
+ let array = pristineArray(`[0, , 2, 3, 4]`);
+ Object.defineProperty(array, 1, { get() { return this.foo; },
+ set(val) { this.foo = val; }});
+ assertTrue(%HasDictionaryElements(array));
+
+ callAndAssertFill(array, "42", ...arguments);
+ }
+
+ // TODO(szuend): Add additional tests receivers other than arrays
+ // (Objects, TypedArrays, etc.).
+};
+
+function RunTest(test) {
+ test();
+ test(undefined);
+ test(undefined, 1);
+ test(undefined, 1, 4);
+}
+
+function RunTests(tests) {
+ Object.keys(tests).forEach(test => RunTest(tests[test]));
+}
+
+RunTests(tests);
+
+Array.prototype.__proto__ = {
+ __proto__: Array.prototype.__proto__
+};
+
+RunTests(tests);
diff --git a/deps/v8/test/mjsunit/es6/array-fill.js b/deps/v8/test/mjsunit/es6/array-fill.js
index ef316e8146..8ca41c7248 100644
--- a/deps/v8/test/mjsunit/es6/array-fill.js
+++ b/deps/v8/test/mjsunit/es6/array-fill.js
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Flags: --allow-natives-syntax
+
assertEquals(1, Array.prototype.fill.length);
assertArrayEquals([].fill(8), []);
@@ -28,3 +30,98 @@ assertArrayEquals(Object.freeze([1, 2, 3]).fill(0, 0, 0), [1, 2, 3]);
assertThrows('Object.freeze([0]).fill()', TypeError);
assertThrows('Array.prototype.fill.call(null)', TypeError);
assertThrows('Array.prototype.fill.call(undefined)', TypeError);
+
+function TestFillObjectWithAccessors() {
+ const kLength = 5;
+
+ let log = [];
+
+ let object = {
+ length: kLength,
+ get 1() {
+ log.push("get 1");
+ return this.foo;
+ },
+
+ set 1(val) {
+ log.push("set 1 " + val);
+ this.foo = val;
+ }
+ };
+
+ Array.prototype.fill.call(object, 42);
+
+ %HeapObjectVerify(object);
+ assertEquals(kLength, object.length);
+ assertArrayEquals(["set 1 42"], log);
+
+ for (let i = 0; i < kLength; ++i) {
+ assertEquals(42, object[i]);
+ }
+}
+TestFillObjectWithAccessors();
+
+function TestFillObjectWithMaxNumberLength() {
+ const kMaxSafeInt = 2 ** 53 - 1;
+ let object = {};
+ object.length = kMaxSafeInt;
+
+ Array.prototype.fill.call(object, 42, 2 ** 53 - 4);
+
+ %HeapObjectVerify(object);
+ assertEquals(kMaxSafeInt, object.length);
+ assertEquals(42, object[kMaxSafeInt - 3]);
+ assertEquals(42, object[kMaxSafeInt - 2]);
+ assertEquals(42, object[kMaxSafeInt - 1]);
+}
+TestFillObjectWithMaxNumberLength();
+
+function TestFillObjectWithPrototypeAccessors() {
+ const kLength = 5;
+ let log = [];
+ let proto = {
+ get 1() {
+ log.push("get 0");
+ return this.foo;
+ },
+
+ set 1(val) {
+ log.push("set 1 " + val);
+ this.foo = val;
+ }
+ };
+
+ let object = { __proto__: proto, 0:0, 2:2, length: kLength};
+
+ Array.prototype.fill.call(object, "42");
+
+ %HeapObjectVerify(object);
+ assertEquals(kLength, object.length);
+ assertArrayEquals(["set 1 42"], log);
+ assertTrue(object.hasOwnProperty(0));
+ assertFalse(object.hasOwnProperty(1));
+ assertTrue(object.hasOwnProperty(2));
+ assertTrue(object.hasOwnProperty(3));
+ assertTrue(object.hasOwnProperty(4));
+
+ for (let i = 0; i < kLength; ++i) {
+ assertEquals("42", object[i]);
+ }
+}
+TestFillObjectWithPrototypeAccessors();
+
+function TestFillSealedObject() {
+ let object = { length: 42 };
+ Object.seal(object);
+
+ assertThrows(() => Array.prototype.fill.call(object), TypeError);
+}
+TestFillSealedObject();
+
+function TestFillFrozenObject() {
+ let object = { length: 42 };
+ Object.freeze(object);
+
+ assertThrows(() => Array.prototype.fill.call(object), TypeError);
+}
+TestFillFrozenObject();
diff --git a/deps/v8/test/mjsunit/es6/array-iterator.js b/deps/v8/test/mjsunit/es6/array-iterator.js
index b143c8c034..62485dfc2c 100644
--- a/deps/v8/test/mjsunit/es6/array-iterator.js
+++ b/deps/v8/test/mjsunit/es6/array-iterator.js
@@ -252,3 +252,16 @@ function TestNonOwnSlots() {
}, TypeError);
}
TestNonOwnSlots();
+
+function TestForDictionaryArray() {
+ var array = [];
+ array[1024] = 'c';
+ assertTrue(%HasDictionaryElements(array));
+ var iterator = array[Symbol.iterator]();
+ for (var i = 0; i < 1024; ++i) {
+ assertIteratorResult(void 0, false, iterator.next());
+ }
+ assertIteratorResult('c', false, iterator.next());
+ assertIteratorResult(void 0, true, iterator.next());
+}
+TestForDictionaryArray();
diff --git a/deps/v8/test/mjsunit/es6/math-log2-log10.js b/deps/v8/test/mjsunit/es6/math-log2-log10.js
index ea17a79daf..eeacee927b 100644
--- a/deps/v8/test/mjsunit/es6/math-log2-log10.js
+++ b/deps/v8/test/mjsunit/es6/math-log2-log10.js
@@ -44,7 +44,9 @@
for (var i = -310; i <= 308; i += 0.5) {
assertEquals(i, Math.log10(Math.pow(10, i)));
// Square roots are tested below.
- if (i != -0.5 && i != 0.5) assertEquals(i, Math.log2(Math.pow(2, i)));
+ if (i != -0.5 && i != 0.5 ) {
+ assertEqualsDelta(i, Math.log2(Math.pow(2, i)), Number.EPSILON);
+ }
}
// Test denormals.
diff --git a/deps/v8/test/mjsunit/es6/promise-all-overflow-1.js b/deps/v8/test/mjsunit/es6/promise-all-overflow-1.js
index e86edbbc27..1a1cb4b61b 100644
--- a/deps/v8/test/mjsunit/es6/promise-all-overflow-1.js
+++ b/deps/v8/test/mjsunit/es6/promise-all-overflow-1.js
@@ -4,6 +4,8 @@
// Flags: --allow-natives-syntax
+load('test/mjsunit/test-async.js');
+
// Make sure we properly throw a RangeError when overflowing the maximum
// number of elements for Promise.all, which is capped at 2^21 bits right
// now, since we store the indices as identity hash on the resolve element
diff --git a/deps/v8/test/mjsunit/es6/promise-all-overflow-2.js b/deps/v8/test/mjsunit/es6/promise-all-overflow-2.js
index ece2c5b9b9..61d0bd9ce5 100644
--- a/deps/v8/test/mjsunit/es6/promise-all-overflow-2.js
+++ b/deps/v8/test/mjsunit/es6/promise-all-overflow-2.js
@@ -4,6 +4,8 @@
// Flags: --allow-natives-syntax
+load('test/mjsunit/test-async.js');
+
// Test that pre-allocation of the result array works even if it needs to be
// allocated in large object space.
const a = new Array(64 * 1024);
diff --git a/deps/v8/test/mjsunit/es6/promise-all.js b/deps/v8/test/mjsunit/es6/promise-all.js
index c60d3069a6..3a0980d425 100644
--- a/deps/v8/test/mjsunit/es6/promise-all.js
+++ b/deps/v8/test/mjsunit/es6/promise-all.js
@@ -4,6 +4,8 @@
// Flags: --allow-natives-syntax
+load('test/mjsunit/test-async.js');
+
// We store the index in the hash code field of the Promise.all resolve
// element closures, so make sure we properly handle the cases where this
// magical field turns into a PropertyArray later.
diff --git a/deps/v8/test/mjsunit/es6/proxies.js b/deps/v8/test/mjsunit/es6/proxies.js
index f67f9df41e..fc59b346b7 100644
--- a/deps/v8/test/mjsunit/es6/proxies.js
+++ b/deps/v8/test/mjsunit/es6/proxies.js
@@ -55,7 +55,7 @@ function TestWithFunctionProxy(test, x, y, z) {
(function TestProxyProperties() {
assertEquals(2, Proxy.length);
assertEquals(Function.__proto__, Proxy.__proto__);
- assertEquals(null, Proxy.prototype);
+ assertEquals(undefined, Proxy.prototype);
assertEquals(undefined, Object.getOwnPropertyDescriptor(Proxy, "arguments"));
assertThrows(() => Proxy.arguments, TypeError);
assertEquals(undefined, Object.getOwnPropertyDescriptor(Proxy, "caller"));
diff --git a/deps/v8/test/mjsunit/es9/object-spread-ic.js b/deps/v8/test/mjsunit/es9/object-spread-ic.js
new file mode 100644
index 0000000000..d76ffd4eb8
--- /dev/null
+++ b/deps/v8/test/mjsunit/es9/object-spread-ic.js
@@ -0,0 +1,101 @@
+// 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.
+
+(function testDoubleElements() {
+ function f(src) { return {...src}; }
+ var src = [1.5];
+ src[0] = 1;
+
+ // Uninitialized
+ assertEquals({ 0: 1 }, f(src));
+
+ src[0] = 1.3;
+
+ // Monomorphic
+ assertEquals({ 0: 1.3 }, f(src));
+})();
+
+(function testInObjectProperties() {
+ function f(src) { return {...src}; }
+ function C() { this.foo = "foo"; }
+ var src;
+ for (var i = 0; i < 10; ++i) {
+ src = new C();
+ }
+
+ // Uninitialized
+ assertEquals({ foo: "foo" }, f(src));
+
+ // Monomorphic
+ assertEquals({ foo: "foo" }, f(src));
+})();
+
+(function testInObjectProperties2() {
+ function f(src) { return {...src}; }
+ function C() {
+ this.foo = "foo";
+ this.p0 = "0";
+ this.p1 = "1";
+ this.p2 = "2";
+ this.p3 = "3";
+ }
+ var src;
+ for (var i = 0; i < 10; ++i) {
+ src = new C();
+ }
+
+ // Uninitialized
+ assertEquals({ foo: "foo", p0: "0", p1: "1", p2: "2", p3: "3" }, f(src));
+
+ // Monomorphic
+ assertEquals({ foo: "foo", p0: "0", p1: "1", p2: "2", p3: "3" }, f(src));
+})();
+
+(function testPolymorphicToMegamorphic() {
+ function f(src) { return {...src}; }
+ function C1() {
+ this.foo = "foo";
+ this.p0 = "0";
+ this.p1 = "1";
+ this.p2 = "2";
+ this.p3 = "3";
+ }
+ function C2() {
+ this.p0 = "0";
+ this.p1 = "1";
+ this[0] = 0;
+ }
+ function C3() {
+ this.x = 774;
+ this.y = 663;
+ this.rgb = 0xFF00FF;
+ }
+ function C4() {
+ this.qqq = {};
+ this.v_1 = [];
+ this.name = "C4";
+ this.constructor = C4;
+ }
+
+ // Uninitialized
+ assertEquals({ foo: "foo", p0: "0", p1: "1", p2: "2", p3: "3" }, f(new C1()));
+
+ // Monomorphic
+ assertEquals({ foo: "foo", p0: "0", p1: "1", p2: "2", p3: "3" }, f(new C1()));
+
+ // Polymorphic (2)
+ assertEquals({ 0: 0, p0: "0", p1: "1" }, f(new C2()));
+ assertEquals({ 0: 0, p0: "0", p1: "1" }, f(new C2()));
+
+ // Polymorphic (3)
+ assertEquals({ x: 774, y: 663, rgb: 0xFF00FF }, f(new C3()));
+ assertEquals({ x: 774, y: 663, rgb: 0xFF00FF }, f(new C3()));
+
+ // Polymorphic (4)
+ assertEquals({ qqq: {}, v_1: [], name: "C4", constructor: C4 }, f(new C4()));
+ assertEquals({ qqq: {}, v_1: [], name: "C4", constructor: C4 }, f(new C4()));
+
+ // Megamorphic
+ assertEquals({ boop: 1 }, f({ boop: 1 }));
+})();
diff --git a/deps/v8/test/mjsunit/es9/regress/regress-866229.js b/deps/v8/test/mjsunit/es9/regress/regress-866229.js
new file mode 100644
index 0000000000..7e98c6ae8a
--- /dev/null
+++ b/deps/v8/test/mjsunit/es9/regress/regress-866229.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.
+
+// Flags: --allow-natives-syntax
+
+var obj = { length: 1, 0: "spread" };
+obj[Symbol.toStringTag] = "foo";
+obj[Symbol.hasInstance] = function() { return true; }
+obj[Symbol.isConcatSpreadable] = true;
+
+var obj2 = { ...obj };
+
+// Crash if fast result map bitfield is not set correctly, if verifying heap
+%HeapObjectVerify(obj2);
+
+// Ensure correct result for some well-known symbols
+assertEquals("[object foo]", Object.prototype.toString.call(obj2));
+assertTrue(Uint8Array instanceof obj2);
+assertEquals(["spread"], [].concat(obj2));
diff --git a/deps/v8/test/mjsunit/es9/regress/regress-866282.js b/deps/v8/test/mjsunit/es9/regress/regress-866282.js
new file mode 100644
index 0000000000..ae23c05c27
--- /dev/null
+++ b/deps/v8/test/mjsunit/es9/regress/regress-866282.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.
+
+// Runtime_ObjectCloneIC_Slow() source argument must be a HeapObject handle,
+// because undefined/null are allowed.
+function spread(o) { return { ...o }; }
+
+// Transition to MEGAMORPHIC
+assertEquals({}, spread(new function C1() {}));
+assertEquals({}, spread(new function C2() {}));
+assertEquals({}, spread(new function C3() {}));
+assertEquals({}, spread(new function C4() {}));
+assertEquals({}, spread(new function C5() {}));
+
+// Trigger Runtime_ObjectCloneIC_Slow() with a non-JSReceiver.
+assertEquals({}, spread(undefined));
diff --git a/deps/v8/test/mjsunit/es9/regress/regress-866357.js b/deps/v8/test/mjsunit/es9/regress/regress-866357.js
new file mode 100644
index 0000000000..3b6230b0f4
--- /dev/null
+++ b/deps/v8/test/mjsunit/es9/regress/regress-866357.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.
+
+// Flags: --allow-natives-syntax
+
+// Check that we do appropriate used/unused field accounting
+var p = Promise.resolve();
+var then = p.then = () => {};
+
+function spread() { return { ...p }; }
+
+assertEquals({ then }, spread());
+assertEquals({ then }, spread());
+assertEquals({ then }, spread());
+%OptimizeFunctionOnNextCall(spread);
+assertEquals({ then }, spread());
diff --git a/deps/v8/test/mjsunit/es9/regress/regress-866727.js b/deps/v8/test/mjsunit/es9/regress/regress-866727.js
new file mode 100644
index 0000000000..ddfcf7edf9
--- /dev/null
+++ b/deps/v8/test/mjsunit/es9/regress/regress-866727.js
@@ -0,0 +1,19 @@
+// 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: --allow-natives-syntax
+
+// Check that IfException/IfSuccess rewiring works in JSInliner
+function test() {
+ var spread = function(value) { return { ...value }; }
+ try {
+ assertEquals({}, spread());
+ } catch (e) {}
+}
+
+test();
+test();
+test();
+%OptimizeFunctionOnNextCall(test);
+test();
diff --git a/deps/v8/test/mjsunit/es9/regress/regress-866861.js b/deps/v8/test/mjsunit/es9/regress/regress-866861.js
new file mode 100644
index 0000000000..dc6c764f5c
--- /dev/null
+++ b/deps/v8/test/mjsunit/es9/regress/regress-866861.js
@@ -0,0 +1,11 @@
+// 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.
+
+// Check that property constness for out-of-object fields is valid
+var o = {};
+var toString = o.toString = function() {};
+try {
+assertEquals({ toString }, o = { ...o });
+} catch (e) {}
+o.toString = [];
diff --git a/deps/v8/test/mjsunit/es9/regress/regress-867958.js b/deps/v8/test/mjsunit/es9/regress/regress-867958.js
new file mode 100644
index 0000000000..eca3f1e8b8
--- /dev/null
+++ b/deps/v8/test/mjsunit/es9/regress/regress-867958.js
@@ -0,0 +1,13 @@
+// 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.
+
+// Check that encountering deprecated Maps does not cause CloneObjectIC to
+// crash.
+var obj1 = { x: 1 };
+var obj2 = { x: 2 }; // same map
+obj2.x = null; // deprecate map
+
+function f() { return { ...obj1 } };
+assertEquals({ x: 1 }, f()); // missed, object migrated to cached new map
+assertEquals({ x: 1 }, f()); // monomorphic cache-hit
diff --git a/deps/v8/test/mjsunit/es9/regress/regress-869342.js b/deps/v8/test/mjsunit/es9/regress/regress-869342.js
new file mode 100644
index 0000000000..fceb98e68f
--- /dev/null
+++ b/deps/v8/test/mjsunit/es9/regress/regress-869342.js
@@ -0,0 +1,18 @@
+// 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: --expose-gc
+
+function spread(o) { return { ...o }; }
+
+(function setupPolymorphicFeedback() {
+ function C1() { this.p0 = 1; }
+ function C2() { this.p1 = 2; this.p2 = 3; }
+ assertEquals({ p0: 1 }, spread(new C1));
+ assertEquals({ p1: 2, p2: 3 }, spread(new C2));
+})();
+
+gc(); // Clobber cached map in feedback[0], and check that we don't crash
+function C3() { this.p0 = 3; }
+assertEquals({ p0: 3 }, spread(new C3));
diff --git a/deps/v8/test/mjsunit/harmony/async-generators-resume-return.js b/deps/v8/test/mjsunit/harmony/async-generators-resume-return.js
index 715c81fc21..2c6973e646 100644
--- a/deps/v8/test/mjsunit/harmony/async-generators-resume-return.js
+++ b/deps/v8/test/mjsunit/harmony/async-generators-resume-return.js
@@ -4,6 +4,8 @@
// Flags: --allow-natives-syntax
+load('test/mjsunit/test-async.js');
+
// .return() from state suspendedStart with undefined
testAsync(test => {
test.plan(3);
diff --git a/deps/v8/test/mjsunit/harmony/async-generators-return.js b/deps/v8/test/mjsunit/harmony/async-generators-return.js
index 27cbd4373b..45f359fd54 100644
--- a/deps/v8/test/mjsunit/harmony/async-generators-return.js
+++ b/deps/v8/test/mjsunit/harmony/async-generators-return.js
@@ -4,6 +4,8 @@
// Flags: --allow-natives-syntax
+load('test/mjsunit/test-async.js');
+
testAsync(test => {
test.plan(2);
@@ -68,7 +70,7 @@ testAsync(test => {
// Return a thenable which is fulfilled later
testAsync(test => {
- test.plan(2);
+ test.plan(3);
let resolve;
let awaitedThenable = { then(resolveFn) { resolve = resolveFn; } };
@@ -84,7 +86,8 @@ testAsync(test => {
gen().next().then(
(iterResult) => {
- test.equals({ value: "resolvedPromise", done: true }, iterResult);
+ test.equals("resolvedPromise", iterResult.value);
+ test.equals(true, iterResult.done);
test.equals(true, finallyEvaluated);
},
test.unexpectedRejection());
diff --git a/deps/v8/test/mjsunit/harmony/async-generators-yield.js b/deps/v8/test/mjsunit/harmony/async-generators-yield.js
index feb6339af2..b34f6b8050 100644
--- a/deps/v8/test/mjsunit/harmony/async-generators-yield.js
+++ b/deps/v8/test/mjsunit/harmony/async-generators-yield.js
@@ -4,6 +4,8 @@
// Flags: --allow-natives-syntax
+load('test/mjsunit/test-async.js');
+
// Yield a thenable which is never settled
testAsync(test => {
test.plan(0);
diff --git a/deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js b/deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js
new file mode 100644
index 0000000000..4dedf4d27c
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/bigint/regress-tonumbercode.js
@@ -0,0 +1,16 @@
+// 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: --allow-natives-syntax --harmony-bigint
+
+function f(x, b) {
+ if (b) return Math.trunc(+(x))
+ else return Math.trunc(Number(x))
+}
+
+f("1", true);
+f("2", true);
+f("2", false);
+%OptimizeFunctionOnNextCall(f);
+f(3n);
diff --git a/deps/v8/test/mjsunit/harmony/bigint/turbo.js b/deps/v8/test/mjsunit/harmony/bigint/turbo.js
index 87130ea101..4ce4880f3d 100644
--- a/deps/v8/test/mjsunit/harmony/bigint/turbo.js
+++ b/deps/v8/test/mjsunit/harmony/bigint/turbo.js
@@ -31,7 +31,7 @@ function Test(f, ...cases) {
function V(input, expected_value) {
function check(result) {
- assertFalse(result.exception, input);
+ assertFalse(result.exception, `unexpected exception ${result.value} on input ${input}`);
assertEquals(expected_value, result.value);
}
return {input, check};
@@ -39,7 +39,7 @@ function V(input, expected_value) {
function E(input, expected_exception) {
function check(result) {
- assertTrue(result.exception, input);
+ assertTrue(result.exception, `expected exception ${expected_exception.name} on input ${input}`);
assertInstanceof(result.value, expected_exception);
}
return {input, check};
@@ -56,10 +56,15 @@ const six = {[Symbol.toPrimitive]() {return 6n}};
// inputs.
////////////////////////////////////////////////////////////////////////////////
-
Test(x => Number(x),
V(1n, 1), V(1, 1), V("", 0), V(1.4, 1.4), V(null, 0), V(six, 6));
+Test(x => Math.trunc(+x),
+ E(1n, TypeError), V(1, 1), V("", 0), V(1.4, 1), V(null, 0), E(six, TypeError));
+
+Test(x => Math.trunc(Number(x)),
+ V(1n, 1), V(1, 1), V("", 0), V(1.4, 1), V(null, 0), V(six, 6));
+
Test(x => String(x),
V(1n, "1"), V(1, "1"), V(1.4, "1.4"), V(null, "null"), V(six, "6"));
diff --git a/deps/v8/test/mjsunit/harmony/global-configurable.js b/deps/v8/test/mjsunit/harmony/global-configurable.js
new file mode 100644
index 0000000000..dd823f1531
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/global-configurable.js
@@ -0,0 +1,8 @@
+// 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-global
+
+assertTrue(delete globalThis);
+assertEquals(this.globalThis, undefined);
diff --git a/deps/v8/test/mjsunit/harmony/global-writable.js b/deps/v8/test/mjsunit/harmony/global-writable.js
new file mode 100644
index 0000000000..f0c2d754bb
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/global-writable.js
@@ -0,0 +1,8 @@
+// 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-global
+
+globalThis = '[[Writable]]';
+assertEquals(globalThis, '[[Writable]]');
diff --git a/deps/v8/test/mjsunit/harmony/global.js b/deps/v8/test/mjsunit/harmony/global.js
new file mode 100644
index 0000000000..733b95312b
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/global.js
@@ -0,0 +1,28 @@
+// 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-global
+
+assertEquals(globalThis, this);
+assertEquals(this.globalThis, this);
+assertEquals(globalThis.globalThis, this);
+assertEquals(globalThis.globalThis.globalThis, this);
+assertEquals(globalThis.globalThis.globalThis.globalThis, this);
+
+{
+ const realm = Realm.create();
+ assertEquals(Realm.global(realm), Realm.eval(realm, 'globalThis'));
+ assertTrue(Realm.global(realm) !== globalThis);
+}
+
+{
+ const descriptor = Object.getOwnPropertyDescriptor(
+ this,
+ 'globalThis'
+ );
+ assertEquals(descriptor.value, this);
+ assertEquals(descriptor.writable, true);
+ assertEquals(descriptor.enumerable, false);
+ assertEquals(descriptor.configurable, true);
+}
diff --git a/deps/v8/test/mjsunit/harmony/modules-import-namespace.js b/deps/v8/test/mjsunit/harmony/modules-import-namespace.js
new file mode 100644
index 0000000000..dfcd6cd502
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/modules-import-namespace.js
@@ -0,0 +1,19 @@
+// 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.
+//
+// MODULE
+
+// Flags: --allow-natives-syntax
+
+import * as m from "modules-skip-3.js";
+
+function get() {
+ return m.stringlife;
+}
+
+assertEquals("42", get());
+assertEquals("42", get());
+assertEquals("42", get());
+%OptimizeFunctionOnNextCall(get);
+assertEquals("42", get());
diff --git a/deps/v8/test/mjsunit/harmony/private-fields-special-object.js b/deps/v8/test/mjsunit/harmony/private-fields-special-object.js
index 309143d904..0ade4305bf 100644
--- a/deps/v8/test/mjsunit/harmony/private-fields-special-object.js
+++ b/deps/v8/test/mjsunit/harmony/private-fields-special-object.js
@@ -4,6 +4,8 @@
// Flags: --harmony-private-fields --allow-natives-syntax
+load('test/mjsunit/test-async.js');
+
async function f(assert) {
try {
module_namespace_obj = await import('modules-skip-1.js');
diff --git a/deps/v8/test/mjsunit/harmony/promise-prototype-finally.js b/deps/v8/test/mjsunit/harmony/promise-prototype-finally.js
index 3051c91d2b..b5456504fa 100644
--- a/deps/v8/test/mjsunit/harmony/promise-prototype-finally.js
+++ b/deps/v8/test/mjsunit/harmony/promise-prototype-finally.js
@@ -4,6 +4,8 @@
// Flags: --allow-natives-syntax
+load('test/mjsunit/test-async.js');
+
assertThrows(() => Promise.prototype.finally.call(5), TypeError);
testAsync(assert => {
diff --git a/deps/v8/test/mjsunit/mjsunit.js b/deps/v8/test/mjsunit/mjsunit.js
index 60f2219db1..a458e0cd10 100644
--- a/deps/v8/test/mjsunit/mjsunit.js
+++ b/deps/v8/test/mjsunit/mjsunit.js
@@ -180,9 +180,6 @@ var isOptimized;
// Returns true if given function is compiled by TurboFan.
var isTurboFanned;
-// Used for async tests. See definition below for more documentation.
-var testAsync;
-
// Monkey-patchable all-purpose failure handler.
var failWithMessage;
@@ -757,111 +754,4 @@ var prettyPrinted;
} catch(e) {};
return error.stack;
}
-
- /**
- * This is to be used through the testAsync helper function defined
- * below.
- *
- * This requires the --allow-natives-syntax flag to allow calling
- * runtime functions.
- *
- * There must be at least one assertion in an async test. A test
- * with no assertions will fail.
- *
- * @example
- * testAsync(assert => {
- * assert.plan(1) // There should be one assertion in this test.
- * Promise.resolve(1)
- * .then(val => assert.equals(1, val),
- * assert.unreachable);
- * })
- */
- class AsyncAssertion {
- constructor(test, name) {
- this.expectedAsserts_ = -1;
- this.actualAsserts_ = 0;
- this.test_ = test;
- this.name_ = name || '';
- }
-
- /**
- * Sets the number of expected asserts in the test. The test fails
- * if the number of asserts computed after running the test is not
- * equal to this specified value.
- * @param {number} expectedAsserts
- */
- plan(expectedAsserts) {
- this.expectedAsserts_ = expectedAsserts;
- }
-
- fail(expectedText, found) {
- let message = formatFailureText(expectedText, found);
- message += "\nin test:" + this.name_
- message += "\n" + Function.prototype.toString.apply(this.test_);
- eval("%AbortJS(message)");
- }
-
- equals(expected, found, name_opt) {
- this.actualAsserts_++;
- if (!deepEquals(expected, found)) {
- this.fail(prettyPrinted(expected), found, name_opt);
- }
- }
-
- unreachable() {
- let message = "Failure: unreachable in test: " + this.name_;
- message += "\n" + Function.prototype.toString.apply(this.test_);
- eval("%AbortJS(message)");
- }
-
- unexpectedRejection(details) {
- return (error) => {
- let message =
- "Failure: unexpected Promise rejection in test: " + this.name_;
- if (details) message += "\n @" + details;
- if (error instanceof Error) {
- message += "\n" + String(error.stack);
- } else {
- message += "\n" + String(error);
- }
- message += "\n\n" + Function.prototype.toString.apply(this.test_);
- eval("%AbortJS(message)");
- };
- }
-
- drainMicrotasks() {
- eval("%RunMicrotasks()");
- }
-
- done_() {
- if (this.expectedAsserts_ === -1) {
- let message = "Please call t.plan(count) to initialize test harness " +
- "with correct assert count (Note: count > 0)";
- eval("%AbortJS(message)");
- }
-
- if (this.expectedAsserts_ !== this.actualAsserts_) {
- let message = "Expected asserts: " + this.expectedAsserts_;
- message += ", Actual asserts: " + this.actualAsserts_;
- message += "\nin test: " + this.name_;
- message += "\n" + Function.prototype.toString.apply(this.test_);
- eval("%AbortJS(message)");
- }
- }
- }
-
- /** This is used to test async functions and promises.
- * @param {testCallback} test - test function
- * @param {string} [name] - optional name of the test
- *
- *
- * @callback testCallback
- * @param {AsyncAssertion} assert
- */
- testAsync = function(test, name) {
- let assert = new AsyncAssertion(test, name);
- test(assert);
- eval("%RunMicrotasks()");
- assert.done_();
- }
})();
diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status
index 28900d22da..4d54808b46 100644
--- a/deps/v8/test/mjsunit/mjsunit.status
+++ b/deps/v8/test/mjsunit/mjsunit.status
@@ -154,17 +154,23 @@
'asm/poppler/*': [PASS, SLOW, NO_VARIANTS],
'asm/sqlite3/*': [PASS, SLOW, NO_VARIANTS],
+ # OOM flakes in isolates tests because too many largish heaps are created.
+ 'asm/asm-heap': [PASS, NO_VARIANTS, ['isolates', SKIP]],
+
# Slow tests.
'copy-on-write-assert': [PASS, SLOW],
'es6/typedarray-construct-offset-not-smi': [PASS, SLOW],
'harmony/regexp-property-script-extensions': [PASS, SLOW],
+ 'md5': [PASS, SLOW],
'numops-fuzz-part*': [PASS, ['mode == debug', SLOW]],
'readonly': [PASS, SLOW],
'regress/regress-1122': [PASS, SLOW],
'regress/regress-605470': [PASS, SLOW],
'regress/regress-655573': [PASS, SLOW],
'regress/regress-1200351': [PASS, SLOW],
+ 'string-replace-gc': [PASS, SLOW],
'wasm/asm-wasm-f32': [PASS, SLOW],
+ 'wasm/asm-wasm-f64': [PASS, SLOW],
'wasm/embenchen/*': [PASS, SLOW],
'wasm/grow-memory': [PASS, SLOW],
'wasm/unreachable-validation': [PASS, SLOW],
@@ -253,6 +259,7 @@
'regress/regress-2249': [SKIP],
'regress/regress-4121': [SKIP],
'compare-known-objects-slow': [SKIP],
+ 'compiler/array-multiple-receiver-maps': [SKIP],
# Tests taking too long
'packed-elements': [SKIP],
'regress/regress-1122': [SKIP],
@@ -294,12 +301,6 @@
# BUG(v8:4779): Crashes flakily with stress mode on arm64.
'array-splice': [PASS, SLOW, ['arch == arm64', NO_VARIANTS]],
- # BUG(chromium:751825): Crashes flakily.
- 'wasm/js-api': [SKIP],
-
- # BUG(chromium:773631): Crashes flakily.
- 'wasm/streaming-trap-location': [SKIP],
-
# BUG(v8:7880): Slow tests.
'regress/regress-707066': [SKIP],
'regress/regress-446389': [SKIP],
@@ -319,6 +320,9 @@
'asm/sqlite3/*': [SKIP],
# TODO(mips-team): Fix Wasm for big-endian.
'wasm/*': [SKIP],
+ # TODO(mips-team): Fix SEGV on regress-864509.js on big endian
+ # (https://crbug.com/v8/7953).
+ 'regress/wasm/regress-864509': [SKIP],
}], # 'byteorder == big'
##############################################################################
@@ -638,6 +642,18 @@
}], # 'system == windows'
##############################################################################
+['system == android', {
+ # Tests consistently failing on Android.
+ # Unable to change locale on Android:
+ 'icu-date-to-string': [FAIL],
+ 'regress/regress-6288': [FAIL],
+ # OOM:
+ 'regress/regress-748069': [FAIL],
+ 'regress/regress-752764': [FAIL],
+ 'regress/regress-779407': [FAIL],
+}], # 'system == android'
+
+##############################################################################
['system == macos', {
# BUG(v8:5333)
'big-object-literal': [SKIP],
@@ -769,17 +785,39 @@
# Flaky crash on Odroid devices: https://crbug.com/v8/7678
'regress/regress-336820': [PASS, ['arch == arm and not simulator_run', SKIP]],
+
+ # Too slow for TSAN in stress mode.
+ 'es6/classes': [PASS, ['tsan', SKIP]],
+ 'regress/regress-1122': [PASS, ['tsan', SKIP]],
+
+ # Slow on arm64 simulator: https://crbug.com/v8/7783
+ 'string-replace-gc': [PASS, ['arch == arm64 and simulator_run', SKIP]],
}], # variant == stress
##############################################################################
['variant == nooptimization and (arch == arm or arch == arm64) and simulator_run', {
# Slow tests: https://crbug.com/v8/7783
'lexicographic-compare': [SKIP],
+ 'md5': [SKIP],
'regress/regress-2185': [SKIP],
+ 'wasm/asm-wasm-f32': [SKIP],
+ 'wasm/asm-wasm-f64': [SKIP],
'wasm/grow-memory': [SKIP],
}], # variant == nooptimization and (arch == arm or arch == arm64) and simulator_run
##############################################################################
+['(arch == arm or arch == arm64) and simulator_run', {
+ # Slow tests: https://crbug.com/v8/7783
+ 'regress/regress-2185': [SKIP],
+}], # (arch == arm or arch == arm64) and simulator_run
+
+##############################################################################
+['(arch == arm or arch == arm64)', {
+ # Flaky tests: https://crbug.com/v8/8090
+ 'regress/regress-752764': [SKIP],
+}], # (arch == arm or arch == arm64)
+
+##############################################################################
['gcov_coverage', {
# Tests taking too long.
'array-functions-prototype-misc': [SKIP],
diff --git a/deps/v8/test/mjsunit/regress/regress-356053.js b/deps/v8/test/mjsunit/regress/regress-356053.js
index 8f0dbdd093..2695c48fd1 100644
--- a/deps/v8/test/mjsunit/regress/regress-356053.js
+++ b/deps/v8/test/mjsunit/regress/regress-356053.js
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// Flags: --noconcurrent-recompilation --expose-gc --allow-natives-syntax
+// Flags: --concurrent-recompilation --block-concurrent-recompilation
-%SetFlags("--concurrent-recompilation --block-concurrent-recompilation");
gc();
try { %UnblockConcurrentRecompilation(); } catch (e) { }
diff --git a/deps/v8/test/mjsunit/regress/regress-357103.js b/deps/v8/test/mjsunit/regress/regress-357103.js
index 692729ddb3..c56c8893b3 100644
--- a/deps/v8/test/mjsunit/regress/regress-357103.js
+++ b/deps/v8/test/mjsunit/regress/regress-357103.js
@@ -4,7 +4,7 @@
// Flags: --allow-natives-syntax
-%SetFlags("--gc-interval=1");
+%SetAllocationTimeout(1, 1);
var key = "Huckleberry Finn" + "Tom Sawyer";
var o = {};
diff --git a/deps/v8/test/mjsunit/regress/regress-430201.js b/deps/v8/test/mjsunit/regress/regress-430201.js
index dfd1346a01..9443d1ddc4 100644
--- a/deps/v8/test/mjsunit/regress/regress-430201.js
+++ b/deps/v8/test/mjsunit/regress/regress-430201.js
@@ -26,10 +26,10 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --allow-natives-syntax --expose-gc --nostress-incremental-marking
+// Flags: --stress-compaction
var array_1 = [];
-%SetFlags("--stress-compaction");
for (var a = 0; a < 10000; a++) { array_1[a * 100] = 0; }
gc();
diff --git a/deps/v8/test/mjsunit/regress/regress-430201b.js b/deps/v8/test/mjsunit/regress/regress-430201b.js
index 056504d1d7..7e890b7930 100644
--- a/deps/v8/test/mjsunit/regress/regress-430201b.js
+++ b/deps/v8/test/mjsunit/regress/regress-430201b.js
@@ -25,12 +25,11 @@
// (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 --expose-gc
+// Flags: --allow-natives-syntax --expose-gc --stress-compaction
(function() {
var array_1 = [];
- %SetFlags("--stress-compaction");
for (var a = 0; a < 10000; a++) { array_1[a * 100] = 0; }
gc();
diff --git a/deps/v8/test/mjsunit/regress/regress-4325.js b/deps/v8/test/mjsunit/regress/regress-4325.js
index e88bdd3b08..27d690d579 100644
--- a/deps/v8/test/mjsunit/regress/regress-4325.js
+++ b/deps/v8/test/mjsunit/regress/regress-4325.js
@@ -23,7 +23,7 @@ i1.p1 = 0.5;
// Let Inner.map1 die by migrating i2 to Inner.map2:
print(i2.p1);
gc();
-// o1.map's descriptor for "inner" is now a cleared WeakCell;
+// o1.map's descriptor for "inner" is now a cleared weak reference;
// o1.inner's actual map is Inner.map2.
// Prepare Inner.map3, deprecating Inner.map2.
i2.p2 = 0.5;
diff --git a/deps/v8/test/mjsunit/regress/regress-5085.js b/deps/v8/test/mjsunit/regress/regress-5085.js
index 0ed034dc2d..167bfa0f44 100644
--- a/deps/v8/test/mjsunit/regress/regress-5085.js
+++ b/deps/v8/test/mjsunit/regress/regress-5085.js
@@ -4,11 +4,71 @@
// Flags: --allow-natives-syntax
+g = async function () {
+ await 10;
+}
+assertEquals(undefined, g.prototype)
+g();
+assertEquals(undefined, g.prototype)
+
+gen = function* () {
+ yield 10;
+}
+assertTrue(gen.prototype != undefined && gen.prototype != null)
+gen()
+assertTrue(gen.prototype != undefined && gen.prototype != null)
+
+async_gen = async function* () {
+ yield 10;
+}
+assertTrue(async_gen.prototype != undefined && async_gen.prototype != null)
+async_gen()
+assertTrue(async_gen.prototype != undefined && async_gen.prototype != null)
+
function foo(x) {
return x instanceof Proxy;
}
-assertFalse(foo({}));
-assertFalse(foo({}));
+function test_for_exception() {
+ caught_exception = false;
+ try {
+ foo({});
+ } catch (e) {
+ caught_exception = true;
+ assertEquals(
+ 'Function has non-object prototype \'undefined\' in instanceof check',
+ e.message);
+ } finally {
+ assertTrue(caught_exception)
+ }
+}
+
+test_for_exception();
+test_for_exception();
%OptimizeFunctionOnNextCall(foo);
-assertFalse(foo({}));
+test_for_exception();
+
+Proxy.__proto__.prototype = Function.prototype;
+assertTrue((() => {}) instanceof Proxy);
+
+assertEquals(
+ new Proxy({}, {
+ get(o, s) {
+ return s
+ }
+ }).test,
+ 'test');
+
+Proxy.__proto__ = {
+ prototype: {b: 2},
+ a: 1
+};
+assertEquals(Proxy.prototype, {b: 2});
+
+(function testProxyCreationContext() {
+ let realm = Realm.create();
+ let p1 = new Proxy({}, {});
+ let p2 = Realm.eval(realm, "new Proxy({}, {})");
+ assertEquals(0, Realm.owner(p1));
+ assertEquals(1, Realm.owner(p2));
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-599414-array-concat-fast-path.js b/deps/v8/test/mjsunit/regress/regress-599414-array-concat-fast-path.js
index 3819233f99..9febb6545d 100644
--- a/deps/v8/test/mjsunit/regress/regress-599414-array-concat-fast-path.js
+++ b/deps/v8/test/mjsunit/regress/regress-599414-array-concat-fast-path.js
@@ -7,5 +7,5 @@ var a = largeArray;
assertThrows(() => {
for (;;) {
- a = a.concat(a, a, a, a, a, a);
+ a = a.concat(a, a, a, a, a);
}}, RangeError);
diff --git a/deps/v8/test/mjsunit/regress/regress-6700.js b/deps/v8/test/mjsunit/regress/regress-6700.js
index 342cac485e..c20cefd02c 100644
--- a/deps/v8/test/mjsunit/regress/regress-6700.js
+++ b/deps/v8/test/mjsunit/regress/regress-6700.js
@@ -4,6 +4,8 @@
// Flags: --allow-natives-syntax
+let kMinHeapSize = 4096;
+
(function TestLeftRight() {
function Module(stdlib, foreign, heap) {
"use asm";
@@ -14,7 +16,7 @@
}
return { f:f }
}
- var buffer = new ArrayBuffer(1024);
+ var buffer = new ArrayBuffer(kMinHeapSize);
var module = new Module(this, {}, buffer);
assertTrue(%IsAsmWasmCode(Module));
new Int32Array(buffer)[42] = 23;
@@ -31,7 +33,7 @@
}
return { f:f }
}
- var buffer = new ArrayBuffer(1024);
+ var buffer = new ArrayBuffer(kMinHeapSize);
var module = new Module(this, {}, buffer)
assertTrue(%IsAsmWasmCode(Module));
new Int32Array(buffer)[42 >> 4] = 23;
@@ -48,7 +50,7 @@
}
return { f:f }
}
- var buffer = new ArrayBuffer(1024);
+ var buffer = new ArrayBuffer(kMinHeapSize);
var module = new Module(this, {}, buffer)
assertFalse(%IsAsmWasmCode(Module));
new Int32Array(buffer)[42 & 0xfc] = 23;
@@ -65,7 +67,7 @@
}
return { f:f }
}
- var buffer = new ArrayBuffer(1024);
+ var buffer = new ArrayBuffer(kMinHeapSize);
var module = new Module(this, {}, buffer)
assertFalse(%IsAsmWasmCode(Module));
new Int32Array(buffer)[42 >> 3] = 23;
@@ -82,7 +84,7 @@
}
return { f:f }
}
- var buffer = new ArrayBuffer(1024);
+ var buffer = new ArrayBuffer(kMinHeapSize);
var module = new Module(this, {}, buffer)
assertFalse(%IsAsmWasmCode(Module));
new Int32Array(buffer)[42 << 2] = 23;
diff --git a/deps/v8/test/mjsunit/regress/regress-685.js b/deps/v8/test/mjsunit/regress/regress-685.js
deleted file mode 100644
index d77d61b8fb..0000000000
--- a/deps/v8/test/mjsunit/regress/regress-685.js
+++ /dev/null
@@ -1,43 +0,0 @@
-// Copyright 2010 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Regression test for http://code.google.com/p/v8/issues/detail?id=685.
-//
-// Test that keyed load IC generic stub uses unsigned comparison for
-// for the length field of arrays.
-//
-// The test passes if it does not crash.
-
-function test() {
- var N = 0xFFFFFFFF;
- var a = [];
- a[N - 1] = 0;
- a[N - 2] = 1;
- a.reverse();
-}
-
-test();
diff --git a/deps/v8/test/mjsunit/regress/regress-7716.js b/deps/v8/test/mjsunit/regress/regress-7716.js
index ac891ceec5..8ce83678d9 100644
--- a/deps/v8/test/mjsunit/regress/regress-7716.js
+++ b/deps/v8/test/mjsunit/regress/regress-7716.js
@@ -10,22 +10,22 @@ for (let i = 0; i < 100000; i++) {
proxy = new Proxy(proxy, {});
}
-// We get a stack overflow in all cases except for Reflect.apply, which here
-// happens to run in constant space: Call jumps into CallProxy and CallProxy
-// jumps into the next Call.
-assertDoesNotThrow(() => Reflect.apply(proxy, {}, []));
-assertThrows(() => Reflect.construct(proxy, []), RangeError);
-assertThrows(() => Reflect.defineProperty(proxy, "x", {}), RangeError);
-assertThrows(() => Reflect.deleteProperty(proxy, "x"), RangeError);
-assertThrows(() => Reflect.get(proxy, "x"), RangeError);
-assertThrows(() => Reflect.getOwnPropertyDescriptor(proxy, "x"), RangeError);
-assertThrows(() => Reflect.getPrototypeOf(proxy), RangeError);
-assertThrows(() => Reflect.has(proxy, "x"), RangeError);
-assertThrows(() => Reflect.isExtensible(proxy), RangeError);
-assertThrows(() => Reflect.ownKeys(proxy), RangeError);
-assertThrows(() => Reflect.preventExtensions(proxy), RangeError);
-assertThrows(() => Reflect.setPrototypeOf(proxy, {}), RangeError);
-assertThrows(() => Reflect.set(proxy, "x", {}), RangeError);
+// Ensure these nested calls don't segfault. They may not all throw exceptions
+// depending on whether the compiler is able to perform tail call optimization
+// on the affected routines.
+try { Reflect.apply(proxy, {}, []) } catch(_) {}
+try { Reflect.construct(proxy, []) } catch(_) {}
+try { Reflect.defineProperty(proxy, "x", {}) } catch(_) {}
+try { Reflect.deleteProperty(proxy, "x") } catch(_) {}
+try { Reflect.get(proxy, "x") } catch(_) {}
+try { Reflect.getOwnPropertyDescriptor(proxy, "x") } catch(_) {}
+try { Reflect.getPrototypeOf(proxy) } catch(_) {}
+try { Reflect.has(proxy, "x") } catch(_) {}
+try { Reflect.isExtensible(proxy) } catch(_) {}
+try { Reflect.ownKeys(proxy) } catch(_) {}
+try { Reflect.preventExtensions(proxy) } catch(_) {}
+try { Reflect.setPrototypeOf(proxy, {}) } catch(_) {}
+try { Reflect.set(proxy, "x", {}) } catch(_) {}
// Recursive handler.
diff --git a/deps/v8/test/mjsunit/regress/regress-797581.js b/deps/v8/test/mjsunit/regress/regress-797581.js
index 17ac0ea50d..eb87e67128 100644
--- a/deps/v8/test/mjsunit/regress/regress-797581.js
+++ b/deps/v8/test/mjsunit/regress/regress-797581.js
@@ -3,6 +3,11 @@
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-dynamic-import
+// Resources: test/mjsunit/regress/modules-skip-regress-797581-1.js
+// Resources: test/mjsunit/regress/modules-skip-regress-797581-2.js
+// Resources: test/mjsunit/regress/modules-skip-regress-797581-3.js
+// Resources: test/mjsunit/regress/modules-skip-regress-797581-4.js
+// Resources: test/mjsunit/regress/modules-skip-regress-797581-5.js
function TryToLoadModule(filename, expect_error, token) {
let caught_error;
diff --git a/deps/v8/test/mjsunit/regress/regress-8033.js b/deps/v8/test/mjsunit/regress/regress-8033.js
new file mode 100644
index 0000000000..437ca2a0a6
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-8033.js
@@ -0,0 +1,45 @@
+// 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.
+
+assertThrows("foo: if (true) do { continue foo } while (false)", SyntaxError);
+assertThrows("foo: if (true) while (false) { continue foo }", SyntaxError);
+assertThrows("foo: if (true) for (; false; ) { continue foo }", SyntaxError);
+assertThrows("foo: if (true) for (let x of []) { continue foo }", SyntaxError);
+assertThrows("foo: if (true) for (let x in []) { continue foo }", SyntaxError);
+
+assertThrows("foo: if (true) { do { continue foo } while (false) }", SyntaxError);
+assertThrows("foo: if (true) { while (false) { continue foo } }", SyntaxError);
+assertThrows("foo: if (true) { for (; false; ) { continue foo } }", SyntaxError);
+assertThrows("foo: if (true) { for (let x of []) { continue foo } }", SyntaxError);
+assertThrows("foo: if (true) { for (let x in []) { continue foo } }", SyntaxError);
+
+assertThrows("foo: goo: if (true) do { continue foo } while (false)", SyntaxError);
+assertThrows("foo: goo: if (true) while (false) { continue foo }", SyntaxError);
+assertThrows("foo: goo: if (true) for (; false; ) { continue foo }", SyntaxError);
+assertThrows("foo: goo: if (true) for (let x of []) { continue foo }", SyntaxError);
+assertThrows("foo: goo: if (true) for (let x in []) { continue foo }", SyntaxError);
+
+assertThrows("foo: goo: if (true) { do { continue foo } while (false) }", SyntaxError);
+assertThrows("foo: goo: if (true) { while (false) { continue foo } }", SyntaxError);
+assertThrows("foo: goo: if (true) { for (; false; ) { continue foo } }", SyntaxError);
+assertThrows("foo: goo: if (true) { for (let x of []) { continue foo } }", SyntaxError);
+assertThrows("foo: goo: if (true) { for (let x in []) { continue foo } }", SyntaxError);
+
+assertDoesNotThrow("if (true) foo: goo: do { continue foo } while (false)");
+assertDoesNotThrow("if (true) foo: goo: while (false) { continue foo }");
+assertDoesNotThrow("if (true) foo: goo: for (; false; ) { continue foo }");
+assertDoesNotThrow("if (true) foo: goo: for (let x of []) { continue foo }");
+assertDoesNotThrow("if (true) foo: goo: for (let x in []) { continue foo }");
+
+assertThrows("if (true) foo: goo: { do { continue foo } while (false) }", SyntaxError);
+assertThrows("if (true) foo: goo: { while (false) { continue foo } }", SyntaxError);
+assertThrows("if (true) foo: goo: { for (; false; ) { continue foo } }", SyntaxError);
+assertThrows("if (true) foo: goo: { for (let x of []) { continue foo } }", SyntaxError);
+assertThrows("if (true) foo: goo: { for (let x in []) { continue foo } }", SyntaxError);
+
+assertDoesNotThrow("if (true) { foo: goo: do { continue foo } while (false) }");
+assertDoesNotThrow("if (true) { foo: goo: while (false) { continue foo } }");
+assertDoesNotThrow("if (true) { foo: goo: for (; false; ) { continue foo } }");
+assertDoesNotThrow("if (true) { foo: goo: for (let x of []) { continue foo } }");
+assertDoesNotThrow("if (true) { foo: goo: for (let x in []) { continue foo } }");
diff --git a/deps/v8/test/mjsunit/regress/regress-865310.js b/deps/v8/test/mjsunit/regress/regress-865310.js
new file mode 100644
index 0000000000..57f976991a
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-865310.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.
+
+// Flags: --allow-natives-syntax
+
+check = function() {
+ assertEquals(null, check.caller);
+}
+
+var obj = {};
+obj.valueOf = check;
+
+function f() {
+ Number(obj);
+}
+
+f();
+%OptimizeFunctionOnNextCall(f);
+f();
diff --git a/deps/v8/test/mjsunit/regress/regress-869735.js b/deps/v8/test/mjsunit/regress/regress-869735.js
new file mode 100644
index 0000000000..dfa7b8385b
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-869735.js
@@ -0,0 +1,14 @@
+// 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: --allow-natives-syntax
+
+function f() {
+ return arguments.length;
+}
+
+var a = [];
+%OptimizeFunctionOnNextCall(f);
+a.length = 81832;
+f(...a);
diff --git a/deps/v8/test/mjsunit/regress/regress-875493.js b/deps/v8/test/mjsunit/regress/regress-875493.js
new file mode 100644
index 0000000000..81fbac4319
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-875493.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.
+
+// Flags: --allow-natives-syntax
+
+function test() {
+ const re = /./y;
+ re.lastIndex = 3;
+ const str = 'fg';
+ return re[Symbol.replace](str, '$');
+}
+
+%SetForceSlowPath(false);
+const fast = test();
+%SetForceSlowPath(true);
+const slow = test();
+%SetForceSlowPath(false);
+
+assertEquals(slow, fast);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-380671.js b/deps/v8/test/mjsunit/regress/regress-crbug-380671.js
index 3b03064eb9..e2909e0a43 100644
--- a/deps/v8/test/mjsunit/regress/regress-crbug-380671.js
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-380671.js
@@ -10,4 +10,5 @@ assertEquals(0xc0000000, buffer.byteLength);
// mock allocator would allow us to allocate more than the physical memory
// available on 32bit platforms, leaving the internal counters in an invalid
// state.
+buffer = null;
gc();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-759327.js b/deps/v8/test/mjsunit/regress/regress-crbug-759327.js
index 9b422176b8..4aed8a456a 100644
--- a/deps/v8/test/mjsunit/regress/regress-crbug-759327.js
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-759327.js
@@ -13,7 +13,7 @@ function Module(stdlib, env, heap) {
return { f: f };
}
function instantiate() {
- var buffer = new ArrayBuffer(0);
+ var buffer = new ArrayBuffer(4096);
Module(this, {}, buffer).f();
try {} finally {}
gc();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-807096.js b/deps/v8/test/mjsunit/regress/regress-crbug-807096.js
index 845120db6a..c503fdad97 100644
--- a/deps/v8/test/mjsunit/regress/regress-crbug-807096.js
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-807096.js
@@ -4,6 +4,8 @@
//
// Flags: --allow-natives-syntax --no-lazy
+load('test/mjsunit/test-async.js');
+
// For regression testing, it's important that these functions are:
// 1) toplevel
// 2) arrow functions with single-expression bodies
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-830565.js b/deps/v8/test/mjsunit/regress/regress-crbug-830565.js
index ee2c3bdaca..00f49bb9ff 100644
--- a/deps/v8/test/mjsunit/regress/regress-crbug-830565.js
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-830565.js
@@ -4,6 +4,8 @@
// Flags: --allow-natives-syntax
+load('test/mjsunit/test-async.js');
+
testAsync(assert => {
assert.plan(1);
const error = new TypeError('Throwing');
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-865312.js b/deps/v8/test/mjsunit/regress/regress-crbug-865312.js
new file mode 100644
index 0000000000..8df1bd92d2
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-865312.js
@@ -0,0 +1,34 @@
+// 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 intArrayConstructors = [
+ Uint8Array,
+ Int8Array,
+ Uint16Array,
+ Int16Array,
+ Uint32Array,
+ Int32Array,
+ Uint8ClampedArray
+];
+
+const floatArrayConstructors = [
+ Float32Array,
+ Float64Array
+];
+
+const typedArrayConstructors = [...intArrayConstructors,
+ ...floatArrayConstructors];
+
+for (let constructor of typedArrayConstructors) {
+ // Shadowing the length of a TypedArray should work for Array.p.fill,
+ // but not crash it.
+ let array = new constructor([2, 2]);
+ assertEquals(2, array.length);
+
+ Object.defineProperty(array, 'length', {value: 5});
+ Array.prototype.fill.call(array, 5);
+
+ assertArrayEquals([5, 5], [array[0], array[1]]);
+ assertEquals(undefined, array[2]);
+}
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-865892.js b/deps/v8/test/mjsunit/regress/regress-crbug-865892.js
new file mode 100644
index 0000000000..f2d2f6ff71
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-865892.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.
+
+// Flags: --expose-async-hooks
+
+let ah = async_hooks.createHook(
+{
+ init(asyncId, type) {
+ if (type !== 'PROMISE') { return; }
+ assertThrows('asyncIds.push(asyncId);');
+ }
+});
+ah.enable();
+
+async function foo() {
+ let x = { toString() { return 'modules-skip-1.js' } };
+ assertThrows('await import(x);');
+}
+foo();
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-866315.js b/deps/v8/test/mjsunit/regress/regress-crbug-866315.js
new file mode 100644
index 0000000000..4eb032d78e
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-866315.js
@@ -0,0 +1,12 @@
+// 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: --expose-async-hooks
+
+let num = 42;
+let ah = async_hooks.createHook({});
+
+num.__proto__.__proto__ = ah;
+assertThrows('num.enable()');
+assertThrows('num.disable()');
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-871886.js b/deps/v8/test/mjsunit/regress/regress-crbug-871886.js
new file mode 100644
index 0000000000..011443145b
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-871886.js
@@ -0,0 +1,11 @@
+// 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.
+
+let arr = [1.5, 2.5];
+arr.slice(0,
+ { valueOf: function () {
+ arr.length = 0;
+ return 2;
+ }
+ });
diff --git a/deps/v8/test/mjsunit/regress/regress-set-flags-stress-compact.js b/deps/v8/test/mjsunit/regress/regress-set-flags-stress-compact.js
index 5bc59a7e11..f86148659f 100644
--- a/deps/v8/test/mjsunit/regress/regress-set-flags-stress-compact.js
+++ b/deps/v8/test/mjsunit/regress/regress-set-flags-stress-compact.js
@@ -2,9 +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
-
-%SetFlags("--gc-interval=164 --stress-compaction");
+// Flags: --allow-natives-syntax --gc-interval=164 --stress-compaction
var a = [];
for (var i = 0; i < 10000; i++) { a[i * 100] = 0; }
diff --git a/deps/v8/test/mjsunit/regress/regress-v8-8070.js b/deps/v8/test/mjsunit/regress/regress-v8-8070.js
new file mode 100644
index 0000000000..a75230da1f
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-v8-8070.js
@@ -0,0 +1,23 @@
+// 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: --allow-natives-syntax
+
+function bar(iterator) {
+ for (const entry of iterator) {}
+}
+
+%NeverOptimizeFunction(bar);
+
+function foo(a) {
+ const iterator = a.values();
+ bar(iterator);
+ return iterator.next().done;
+}
+
+const a = [1, 2, 3];
+assertTrue(foo(a));
+assertTrue(foo(a));
+%OptimizeFunctionOnNextCall(foo);
+assertTrue(foo(a));
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-776677.js b/deps/v8/test/mjsunit/regress/wasm/regress-776677.js
index 1b2357dcf2..87bf8fac7e 100644
--- a/deps/v8/test/mjsunit/regress/wasm/regress-776677.js
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-776677.js
@@ -16,7 +16,7 @@ function module(stdlib,foreign,buffer) {
var global = {Uint32Array:Uint32Array};
var env = {};
-memory = new WebAssembly.Memory({initial:200});
+memory = new WebAssembly.Memory({initial:128});
var buffer = memory.buffer;
evil_f = module(global,env,buffer);
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-8059.js b/deps/v8/test/mjsunit/regress/wasm/regress-8059.js
new file mode 100644
index 0000000000..5c421c4ee4
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-8059.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: --no-wasm-disable-structured-cloning
+
+load("test/mjsunit/wasm/wasm-constants.js");
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+(function TestPostModule() {
+ let builder = new WasmModuleBuilder();
+ builder.addFunction("add", kSig_i_ii)
+ .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add])
+ .exportFunc();
+
+ let module = builder.toModule();
+
+ let workerScript = `
+ onmessage = function(module) {
+ try {
+ let instance = new WebAssembly.Instance(module);
+ let result = instance.exports.add(40, 2);
+ postMessage(result);
+ } catch(e) {
+ postMessage('ERROR: ' + e);
+ }
+ }
+ `;
+
+ let realm = Realm.create();
+ Realm.shared = { m:module, s:workerScript };
+
+ let realmScript = `
+ let worker = new Worker(Realm.shared.s);
+ worker.postMessage(Realm.shared.m);
+ let message = worker.getMessage();
+ worker.terminate();
+ message;
+ `;
+ let message = Realm.eval(realm, realmScript);
+ assertEquals(42, message);
+})();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-873600.js b/deps/v8/test/mjsunit/regress/wasm/regress-873600.js
new file mode 100644
index 0000000000..b3f2d739a2
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-873600.js
@@ -0,0 +1,50 @@
+// 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.
+
+(function DoTest() {
+
+ var stdlib = this;
+ try {
+ var buffer = new ArrayBuffer((2097120) * 1024);
+ } catch (e) {
+ // Out of memory: soft pass because 2GiB is actually a lot!
+ print("OOM: soft pass");
+ return;
+ }
+ var foreign = {}
+
+ var m = (function Module(stdlib, foreign, heap) {
+ "use asm";
+ var MEM16 = new stdlib.Int16Array(heap);
+ function load(i) {
+ i = i|0;
+ i = MEM16[i >> 1]|0;
+ return i | 0;
+ }
+ function store(i, v) {
+ i = i|0;
+ v = v|0;
+ MEM16[i >> 1] = v;
+ }
+ function load8(i) {
+ i = i|0;
+ i = MEM16[i + 8 >> 1]|0;
+ return i | 0;
+ }
+ function store8(i, v) {
+ i = i|0;
+ v = v|0;
+ MEM16[i + 8 >> 1] = v;
+ }
+ return { load: load, store: store, load8: load8, store8: store8 };
+ })(stdlib, foreign, buffer);
+
+ assertEquals(0, m.load(-8));
+ assertEquals(0, m.load8(-16));
+ m.store(2014, 2, 30, 1, 0);
+ assertEquals(0, m.load8(-8));
+ m.store8(-8, 99);
+ assertEquals(99, m.load(0));
+ assertEquals(99, m.load8(-8));
+})();
diff --git a/deps/v8/test/mjsunit/regress/wasm/regress-875556.js b/deps/v8/test/mjsunit/regress/wasm/regress-875556.js
new file mode 100644
index 0000000000..e1ea426f87
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/wasm/regress-875556.js
@@ -0,0 +1,19 @@
+// 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: --expose-wasm --experimental-wasm-mv
+
+load('test/mjsunit/wasm/wasm-constants.js');
+load('test/mjsunit/wasm/wasm-module-builder.js');
+
+(function() {
+ const builder = new WasmModuleBuilder();
+ // Generate function 1 (out of 2).
+ sig1 = makeSig([kWasmI32], []);
+ builder.addFunction("main", sig1).addBodyWithEnd([
+ // signature: v_i
+ // body:
+ kExprBlock,
+ ]);
+ assertThrows(function() { builder.instantiate(); }, WebAssembly.CompileError);
+})();
diff --git a/deps/v8/test/mjsunit/sparse-array-reverse.js b/deps/v8/test/mjsunit/sparse-array-reverse.js
deleted file mode 100644
index 45a6da4b5e..0000000000
--- a/deps/v8/test/mjsunit/sparse-array-reverse.js
+++ /dev/null
@@ -1,131 +0,0 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-/**
- * @fileoverview Test reverse on small * and large arrays.
- */
-
-var VERYLARGE = 4000000000;
-
-// Nicer for firefox 1.5. Unless you uncomment the following line,
-// smjs will appear to hang on this file.
-//var VERYLARGE = 40000;
-
-
-// Simple test of reverse on sparse array.
-var a = [];
-a.length = 2000;
-a[15] = 'a';
-a[30] = 'b';
-Array.prototype[30] = 'B'; // Should be hidden by a[30].
-a[40] = 'c';
-a[50] = 'deleted';
-delete a[50]; // Should leave no trace once deleted.
-a[1959] = 'd'; // Swapped with a[40] when reversing.
-a[1999] = 'e';
-assertEquals("abcde", a.join(''));
-a.reverse();
-delete Array.prototype[30];
-assertEquals("edcba", a.join(''));
-
-
-
-var seed = 43;
-
-// CONG pseudo random number generator. Used for fuzzing the sparse array
-// reverse code.
-function DoOrDont() {
- seed = (69069 * seed + 1234567) % 0x100000000;
- return (seed & 0x100000) != 0;
-}
-
-var sizes = [140, 40000, VERYLARGE];
-var poses = [0, 10, 50, 69];
-
-
-// Fuzzing test of reverse on sparse array.
-for (var iterations = 0; iterations < 20; iterations++) {
- for (var size_pos = 0; size_pos < sizes.length; size_pos++) {
- var size = sizes[size_pos];
-
- var to_delete = [];
-
- var a;
- // Make sure we test both array-backed and hash-table backed
- // arrays.
- if (size < 1000) {
- a = new Array(size);
- } else {
- a = new Array();
- a.length = size;
- }
-
- var expected = '';
- var expected_reversed = '';
-
- for (var pos_pos = 0; pos_pos < poses.length; pos_pos++) {
- var pos = poses[pos_pos];
- var letter = String.fromCharCode(97 + pos_pos);
- if (DoOrDont()) {
- a[pos] = letter;
- expected += letter;
- expected_reversed = letter + expected_reversed;
- } else if (DoOrDont()) {
- Array.prototype[pos] = letter;
- expected += letter;
- expected_reversed = letter + expected_reversed;
- to_delete.push(pos);
- }
- }
- var expected2 = '';
- var expected_reversed2 = '';
- for (var pos_pos = poses.length - 1; pos_pos >= 0; pos_pos--) {
- var letter = String.fromCharCode(110 + pos_pos);
- var pos = size - poses[pos_pos] - 1;
- if (DoOrDont()) {
- a[pos] = letter;
- expected2 += letter;
- expected_reversed2 = letter + expected_reversed2;
- } else if (DoOrDont()) {
- Array.prototype[pos] = letter;
- expected2 += letter;
- expected_reversed2 = letter + expected_reversed2;
- to_delete.push(pos);
- }
- }
-
- assertEquals(expected + expected2, a.join(''), 'join' + size);
- a.reverse();
-
- while (to_delete.length != 0) {
- var pos = to_delete.pop();
- delete(Array.prototype[pos]);
- }
-
- assertEquals(expected_reversed2 + expected_reversed, a.join(''), 'reverse then join' + size);
- }
-}
diff --git a/deps/v8/test/mjsunit/string-pad.js b/deps/v8/test/mjsunit/string-pad.js
new file mode 100644
index 0000000000..836ab8160e
--- /dev/null
+++ b/deps/v8/test/mjsunit/string-pad.js
@@ -0,0 +1,155 @@
+// 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.
+
+class MyError {};
+const throwing = {toString() {throw new MyError}};
+const empties = ['', {toString() {return ''}}];
+
+{
+ const s = '';
+
+ assertThrows(_ => s.padStart(Symbol(), throwing), TypeError);
+ assertEquals(s, s.padStart(NaN, throwing));
+ assertEquals(s, s.padStart(-Infinity, throwing));
+ assertEquals(s, s.padStart(-9, throwing));
+ assertEquals(s, s.padStart(-1, throwing));
+ assertEquals(s, s.padStart(-0, throwing));
+ assertEquals(s, s.padStart(0, throwing));
+ assertThrows(_ => s.padStart(3, throwing), MyError);
+ assertThrows(_ => s.padStart(9, throwing), MyError);
+ assertThrows(_ => s.padStart(2**31-1, throwing), MyError);
+ assertThrows(_ => s.padStart(2**31, throwing), MyError);
+ assertThrows(_ => s.padStart(2**32-1, throwing), MyError);
+ assertThrows(_ => s.padStart(2**32, throwing), MyError);
+ assertThrows(_ => s.padStart(2**53-1, throwing), MyError);
+ assertThrows(_ => s.padStart(2**53, throwing), MyError);
+ assertThrows(_ => s.padStart(Infinity, throwing), MyError);
+
+ assertThrows(_ => s.padEnd(Symbol(), throwing), TypeError);
+ assertEquals(s, s.padEnd(NaN, throwing));
+ assertEquals(s, s.padEnd(-Infinity, throwing));
+ assertEquals(s, s.padEnd(-9, throwing));
+ assertEquals(s, s.padEnd(-1, throwing));
+ assertEquals(s, s.padEnd(-0, throwing));
+ assertEquals(s, s.padEnd(0, throwing));
+ assertThrows(_ => s.padEnd(3, throwing), MyError);
+ assertThrows(_ => s.padEnd(9, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**31-1, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**31, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**32-1, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**32, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**53-1, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**53, throwing), MyError);
+ assertThrows(_ => s.padEnd(Infinity, throwing), MyError);
+
+ for (const empty of empties) {
+ assertThrows(_ => s.padStart(Symbol(), empty), TypeError);
+ assertEquals(s, s.padStart(NaN, empty));
+ assertEquals(s, s.padStart(-Infinity, empty));
+ assertEquals(s, s.padStart(-9, empty));
+ assertEquals(s, s.padStart(-1, empty));
+ assertEquals(s, s.padStart(-0, empty));
+ assertEquals(s, s.padStart(0, empty));
+ assertEquals(s, s.padStart(3, empty));
+ assertEquals(s, s.padStart(9, empty));
+ assertEquals(s, s.padStart(2**31-1, empty));
+ assertEquals(s, s.padStart(2**31, empty));
+ assertEquals(s, s.padStart(2**32-1, empty));
+ assertEquals(s, s.padStart(2**32, empty));
+ assertEquals(s, s.padStart(2**53-1, empty));
+ assertEquals(s, s.padStart(2**53, empty));
+ assertEquals(s, s.padStart(Infinity, empty));
+
+ assertThrows(_ => s.padEnd(Symbol(), empty), TypeError);
+ assertEquals(s, s.padEnd(NaN, empty));
+ assertEquals(s, s.padEnd(-Infinity, empty));
+ assertEquals(s, s.padEnd(-9, empty));
+ assertEquals(s, s.padEnd(-1, empty));
+ assertEquals(s, s.padEnd(-0, empty));
+ assertEquals(s, s.padEnd(0, empty));
+ assertEquals(s, s.padEnd(3, empty));
+ assertEquals(s, s.padEnd(9, empty));
+ assertEquals(s, s.padEnd(2**31-1, empty));
+ assertEquals(s, s.padEnd(2**31, empty));
+ assertEquals(s, s.padEnd(2**32-1, empty));
+ assertEquals(s, s.padEnd(2**32, empty));
+ assertEquals(s, s.padEnd(2**53-1, empty));
+ assertEquals(s, s.padEnd(2**53, empty));
+ assertEquals(s, s.padEnd(Infinity, empty));
+ }
+}
+
+{
+ const s = 'hello';
+
+ assertThrows(_ => s.padStart(Symbol(), throwing), TypeError);
+ assertEquals(s, s.padStart(NaN, throwing));
+ assertEquals(s, s.padStart(-Infinity, throwing));
+ assertEquals(s, s.padStart(-9, throwing));
+ assertEquals(s, s.padStart(-1, throwing));
+ assertEquals(s, s.padStart(-0, throwing));
+ assertEquals(s, s.padStart(0, throwing));
+ assertEquals(s, s.padStart(3, throwing));
+ assertThrows(_ => s.padStart(9, throwing), MyError);
+ assertThrows(_ => s.padStart(2**31-1, throwing), MyError);
+ assertThrows(_ => s.padStart(2**31, throwing), MyError);
+ assertThrows(_ => s.padStart(2**32-1, throwing), MyError);
+ assertThrows(_ => s.padStart(2**32, throwing), MyError);
+ assertThrows(_ => s.padStart(2**53-1, throwing), MyError);
+ assertThrows(_ => s.padStart(2**53, throwing), MyError);
+ assertThrows(_ => s.padStart(Infinity, throwing), MyError);
+
+ assertThrows(_ => s.padEnd(Symbol(), throwing), TypeError);
+ assertEquals(s, s.padEnd(NaN, throwing));
+ assertEquals(s, s.padEnd(-Infinity, throwing));
+ assertEquals(s, s.padEnd(-9, throwing));
+ assertEquals(s, s.padEnd(-1, throwing));
+ assertEquals(s, s.padEnd(-0, throwing));
+ assertEquals(s, s.padEnd(0, throwing));
+ assertEquals(s, s.padEnd(3, throwing));
+ assertThrows(_ => s.padEnd(9, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**31-1, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**31, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**32-1, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**32, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**53-1, throwing), MyError);
+ assertThrows(_ => s.padEnd(2**53, throwing), MyError);
+ assertThrows(_ => s.padEnd(Infinity, throwing), MyError);
+
+ for (const empty of empties) {
+ assertThrows(_ => s.padStart(Symbol(), empty), TypeError);
+ assertEquals(s, s.padStart(NaN, empty));
+ assertEquals(s, s.padStart(-Infinity, empty));
+ assertEquals(s, s.padStart(-9, empty));
+ assertEquals(s, s.padStart(-1, empty));
+ assertEquals(s, s.padStart(-0, empty));
+ assertEquals(s, s.padStart(0, empty));
+ assertEquals(s, s.padStart(3, empty));
+ assertEquals(s, s.padStart(9, empty));
+ assertEquals(s, s.padStart(2**31-1, empty));
+ assertEquals(s, s.padStart(2**31, empty));
+ assertEquals(s, s.padStart(2**32-1, empty));
+ assertEquals(s, s.padStart(2**32, empty));
+ assertEquals(s, s.padStart(2**53-1, empty));
+ assertEquals(s, s.padStart(2**53, empty));
+ assertEquals(s, s.padStart(Infinity, empty));
+
+ assertThrows(_ => s.padEnd(Symbol(), empty), TypeError);
+ assertEquals(s, s.padEnd(NaN, empty));
+ assertEquals(s, s.padEnd(-Infinity, empty));
+ assertEquals(s, s.padEnd(-9, empty));
+ assertEquals(s, s.padEnd(-1, empty));
+ assertEquals(s, s.padEnd(-0, empty));
+ assertEquals(s, s.padEnd(0, empty));
+ assertEquals(s, s.padEnd(3, empty));
+ assertEquals(s, s.padEnd(9, empty));
+ assertEquals(s, s.padEnd(2**31-1, empty));
+ assertEquals(s, s.padEnd(2**31, empty));
+ assertEquals(s, s.padEnd(2**32-1, empty));
+ assertEquals(s, s.padEnd(2**32, empty));
+ assertEquals(s, s.padEnd(2**53-1, empty));
+ assertEquals(s, s.padEnd(2**53, empty));
+ assertEquals(s, s.padEnd(Infinity, empty));
+ }
+}
diff --git a/deps/v8/test/mjsunit/test-async.js b/deps/v8/test/mjsunit/test-async.js
new file mode 100644
index 0000000000..f8a11c5238
--- /dev/null
+++ b/deps/v8/test/mjsunit/test-async.js
@@ -0,0 +1,117 @@
+// 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: --allow-natives-syntax
+
+// Used for async tests. See definition below for more documentation.
+var testAsync;
+
+(function () { // Scope for utility functions.
+ /**
+ * This is to be used through the testAsync helper function defined
+ * below.
+ *
+ * This requires the --allow-natives-syntax flag to allow calling
+ * runtime functions.
+ *
+ * There must be at least one assertion in an async test. A test
+ * with no assertions will fail.
+ *
+ * @example
+ * testAsync(assert => {
+ * assert.plan(1) // There should be one assertion in this test.
+ * Promise.resolve(1)
+ * .then(val => assert.equals(1, val),
+ * assert.unreachable);
+ * })
+ */
+ class AsyncAssertion {
+ constructor(test, name) {
+ this.expectedAsserts_ = -1;
+ this.actualAsserts_ = 0;
+ this.test_ = test;
+ this.name_ = name || '';
+ }
+
+ /**
+ * Sets the number of expected asserts in the test. The test fails
+ * if the number of asserts computed after running the test is not
+ * equal to this specified value.
+ * @param {number} expectedAsserts
+ */
+ plan(expectedAsserts) {
+ this.expectedAsserts_ = expectedAsserts;
+ }
+
+ fail(expectedText, found) {
+ let message = formatFailureText(expectedText, found);
+ message += "\nin test:" + this.name_
+ message += "\n" + Function.prototype.toString.apply(this.test_);
+ %AbortJS(message);
+ }
+
+ equals(expected, found, name_opt) {
+ this.actualAsserts_++;
+ if (expected !== found) {
+ this.fail(prettyPrinted(expected), found, name_opt);
+ }
+ }
+
+ unreachable() {
+ let message = "Failure: unreachable in test: " + this.name_;
+ message += "\n" + Function.prototype.toString.apply(this.test_);
+ %AbortJS(message);
+ }
+
+ unexpectedRejection(details) {
+ return (error) => {
+ let message =
+ "Failure: unexpected Promise rejection in test: " + this.name_;
+ if (details) message += "\n @" + details;
+ if (error instanceof Error) {
+ message += "\n" + String(error.stack);
+ } else {
+ message += "\n" + String(error);
+ }
+ message += "\n\n" + Function.prototype.toString.apply(this.test_);
+ %AbortJS(message);
+ };
+ }
+
+ drainMicrotasks() {
+ %RunMicrotasks();
+ }
+
+ done_() {
+ if (this.expectedAsserts_ === -1) {
+ let message = "Please call t.plan(count) to initialize test harness " +
+ "with correct assert count (Note: count > 0)";
+ %AbortJS(message);
+ }
+
+ if (this.expectedAsserts_ !== this.actualAsserts_) {
+ let message = "Expected asserts: " + this.expectedAsserts_;
+ message += ", Actual asserts: " + this.actualAsserts_;
+ message += "\nin test: " + this.name_;
+ message += "\n" + Function.prototype.toString.apply(this.test_);
+ %AbortJS(message);
+ }
+ }
+ }
+
+ /** This is used to test async functions and promises.
+ * @param {testCallback} test - test function
+ * @param {string} [name] - optional name of the test
+ *
+ *
+ * @callback testCallback
+ * @param {AsyncAssertion} assert
+ */
+ testAsync = function(test, name) {
+ let assert = new AsyncAssertion(test, name);
+ test(assert);
+ %RunMicrotasks();
+ assert.done_();
+ }
+})();
diff --git a/deps/v8/test/mjsunit/testcfg.py b/deps/v8/test/mjsunit/testcfg.py
index d31a189ba2..d843cfaf02 100644
--- a/deps/v8/test/mjsunit/testcfg.py
+++ b/deps/v8/test/mjsunit/testcfg.py
@@ -41,6 +41,22 @@ SELF_SCRIPT_PATTERN = re.compile(r"//\s+Env: TEST_FILE_NAME")
MODULE_PATTERN = re.compile(r"^// MODULE$", flags=re.MULTILINE)
NO_HARNESS_PATTERN = re.compile(r"^// NO HARNESS$", flags=re.MULTILINE)
+# Patterns for additional resource files on Android. Files that are not covered
+# by one of the other patterns below will be specified in the resources section.
+RESOURCES_PATTERN = re.compile(r"//\s+Resources:(.*)")
+# Pattern to auto-detect files to push on Android for statements like:
+# load("path/to/file.js")
+LOAD_PATTERN = re.compile(
+ r"(?:load|readbuffer|read)\((?:'|\")([^'\"]*)(?:'|\")\)")
+# Pattern to auto-detect files to push on Android for statements like:
+# import "path/to/file.js"
+MODULE_RESOURCES_PATTERN_1 = re.compile(
+ r"(?:import|export)(?:\(| )(?:'|\")([^'\"]*)(?:'|\")")
+# Pattern to auto-detect files to push on Android for statements like:
+# import foobar from "path/to/file.js"
+MODULE_RESOURCES_PATTERN_2 = re.compile(
+ r"(?:import|export).*from (?:'|\")([^'\"]*)(?:'|\")")
+
# Flags known to misbehave when combining arbitrary mjsunit tests. Can also
# be compiled regular expressions.
COMBINE_TESTS_FLAGS_BLACKLIST = [
@@ -124,6 +140,47 @@ class TestCase(testcase.TestCase):
self._files_suffix = files_suffix
self._env = self._parse_source_env(source)
+ def _get_resources_for_file(self, file):
+ """Returns for a given file a list of absolute paths of files needed by the
+ given file.
+ """
+ with open(file) as f:
+ source = f.read()
+ result = []
+ def add_path(path):
+ result.append(os.path.abspath(path.replace('/', os.path.sep)))
+ for match in RESOURCES_PATTERN.finditer(source):
+ # There are several resources per line. Relative to base dir.
+ for path in match.group(1).strip().split():
+ add_path(path)
+ for match in LOAD_PATTERN.finditer(source):
+ # Files in load statements are relative to base dir.
+ add_path(match.group(1))
+ for match in MODULE_RESOURCES_PATTERN_1.finditer(source):
+ # Imported files are side by side with the test case.
+ add_path(os.path.join(
+ self.suite.root, os.path.dirname(self.path), match.group(1)))
+ for match in MODULE_RESOURCES_PATTERN_2.finditer(source):
+ # Imported files are side by side with the test case.
+ add_path(os.path.join(
+ self.suite.root, os.path.dirname(self.path), match.group(1)))
+ return result
+
+ def _get_resources(self):
+ """Returns the list of files needed by a test case."""
+ result = set()
+ to_check = [self._get_source_path()]
+ # Recurse over all files until reaching a fixpoint.
+ while to_check:
+ next_resource = to_check.pop()
+ result.add(next_resource)
+ for resource in self._get_resources_for_file(next_resource):
+ # Only add files that exist on disc. The pattens we check for give some
+ # false positives otherwise.
+ if resource not in result and os.path.exists(resource):
+ to_check.append(resource)
+ return sorted(list(result))
+
def _parse_source_env(self, source):
env_match = ENV_PATTERN.search(source)
env = {}
diff --git a/deps/v8/test/mjsunit/tools/csvparser.js b/deps/v8/test/mjsunit/tools/csvparser.js
index ffca9dd463..91eb3e45b5 100644
--- a/deps/v8/test/mjsunit/tools/csvparser.js
+++ b/deps/v8/test/mjsunit/tools/csvparser.js
@@ -84,3 +84,7 @@ assertEquals(
assertEquals(
['code-creation','Function','0x42f0a0','163','""'],
parser.parseLine('code-creation,Function,0x42f0a0,163,""'));
+
+assertEquals(
+ ['foo C:\\Users\\someuser\\script.js:1:13'],
+ parser.parseLine('foo C:\\\\Users\\\\someuser\\\\script.js:1:13'));
diff --git a/deps/v8/test/mjsunit/tools/profviz.js b/deps/v8/test/mjsunit/tools/profviz.js
index fc0da5d4b0..f89a2adeb3 100644
--- a/deps/v8/test/mjsunit/tools/profviz.js
+++ b/deps/v8/test/mjsunit/tools/profviz.js
@@ -30,6 +30,8 @@
// Files: tools/consarray.js tools/profile.js tools/profile_view.js
// Files: tools/logreader.js tools/arguments.js tools/tickprocessor.js
// Files: tools/profviz/composer.js
+// Resources: test/mjsunit/tools/profviz-test.log
+// Resources: test/mjsunit/tools/profviz-test.default
// Env: TEST_FILE_NAME
assertEquals('string', typeof TEST_FILE_NAME);
diff --git a/deps/v8/test/mjsunit/tools/tickprocessor.js b/deps/v8/test/mjsunit/tools/tickprocessor.js
index cf38985e78..3247ddf145 100644
--- a/deps/v8/test/mjsunit/tools/tickprocessor.js
+++ b/deps/v8/test/mjsunit/tools/tickprocessor.js
@@ -29,6 +29,14 @@
// Files: tools/splaytree.js tools/codemap.js tools/csvparser.js
// Files: tools/consarray.js tools/profile.js tools/profile_view.js
// Files: tools/logreader.js tools/arguments.js tools/tickprocessor.js
+// Resources: test/mjsunit/tools/tickprocessor-test-func-info.log
+// Resources: test/mjsunit/tools/tickprocessor-test.default
+// Resources: test/mjsunit/tools/tickprocessor-test.func-info
+// Resources: test/mjsunit/tools/tickprocessor-test.gc-state
+// Resources: test/mjsunit/tools/tickprocessor-test.ignore-unknown
+// Resources: test/mjsunit/tools/tickprocessor-test.log
+// Resources: test/mjsunit/tools/tickprocessor-test.only-summary
+// Resources: test/mjsunit/tools/tickprocessor-test.separate-ic
// Env: TEST_FILE_NAME
diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm-imports.js b/deps/v8/test/mjsunit/wasm/asm-wasm-imports.js
new file mode 100644
index 0000000000..bfcb25b825
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/asm-wasm-imports.js
@@ -0,0 +1,181 @@
+// 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: --validate-asm --allow-natives-syntax
+
+var stdlib = this;
+
+function assertValidAsm(func) {
+ assertTrue(%IsAsmWasmCode(func), "must be valid asm code");
+}
+
+function assertWasm(expected, func, ffi) {
+ print("Testing " + func.name + "...");
+ assertEquals(
+ expected, func(stdlib, ffi, new ArrayBuffer(1024)).caller());
+ assertValidAsm(func);
+}
+
+
+function TestForeignFunctions() {
+ function AsmModule(stdlib, foreign, buffer) {
+ "use asm";
+
+ var setVal = foreign.setVal;
+ var getVal = foreign.getVal;
+
+ function caller(initial_value, new_value) {
+ initial_value = initial_value|0;
+ new_value = new_value|0;
+ if ((getVal()|0) == (initial_value|0)) {
+ setVal(new_value|0);
+ return getVal()|0;
+ }
+ return 0;
+ }
+
+ return {caller:caller};
+ }
+
+ function ffi(initial_val) {
+ var val = initial_val;
+
+ function getVal() {
+ return val;
+ }
+
+ function setVal(new_val) {
+ val = new_val;
+ }
+
+ return {getVal:getVal, setVal:setVal};
+ }
+
+ var foreign = new ffi(23);
+
+ var module = AsmModule({Math: Math}, foreign, null);
+ assertValidAsm(AsmModule);
+
+ assertEquals(103, module.caller(23, 103));
+}
+
+print("TestForeignFunctions...");
+TestForeignFunctions();
+
+
+function TestForeignFunctionMultipleUse() {
+ function AsmModule(stdlib, foreign, buffer) {
+ "use asm";
+
+ var getVal = foreign.getVal;
+
+ function caller(int_val, double_val) {
+ int_val = int_val|0;
+ double_val = +double_val;
+ if ((getVal()|0) == (int_val|0)) {
+ if ((+getVal()) == (+double_val)) {
+ return 89;
+ }
+ }
+ return 0;
+ }
+
+ return {caller:caller};
+ }
+
+ function ffi() {
+ function getVal() {
+ return 83.25;
+ }
+
+ return {getVal:getVal};
+ }
+
+ var foreign = new ffi();
+
+ var module_decl = eval('(' + AsmModule.toString() + ')');
+ var module = module_decl(stdlib, foreign, null);
+ assertValidAsm(module_decl);
+
+ assertEquals(89, module.caller(83, 83.25));
+}
+
+print("TestForeignFunctionMultipleUse...");
+TestForeignFunctionMultipleUse();
+
+function TestForeignVariables() {
+ function AsmModule(stdlib, foreign, buffer) {
+ "use asm";
+
+ var i1 = foreign.foo | 0;
+ var f1 = +foreign.bar;
+ var i2 = foreign.baz | 0;
+ var f2 = +foreign.baz;
+
+ function geti1() {
+ return i1|0;
+ }
+
+ function getf1() {
+ return +f1;
+ }
+
+ function geti2() {
+ return i2|0;
+ }
+
+ function getf2() {
+ return +f2;
+ }
+
+ return {geti1:geti1, getf1:getf1, geti2:geti2, getf2:getf2};
+ }
+
+ function TestCase(env, i1, f1, i2, f2) {
+ print("Testing foreign variables...");
+ var module_decl = eval('(' + AsmModule.toString() + ')');
+ var module = module_decl(stdlib, env);
+ assertValidAsm(module_decl);
+ assertEquals(i1, module.geti1());
+ assertEquals(f1, module.getf1());
+ assertEquals(i2, module.geti2());
+ assertEquals(f2, module.getf2());
+ }
+
+ // Check normal operation.
+ TestCase({foo: 123, bar: 234.5, baz: 345.7}, 123, 234.5, 345, 345.7);
+ // Check partial operation.
+ TestCase({baz: 345.7}, 0, NaN, 345, 345.7);
+ // Check that undefined values are converted to proper defaults.
+ TestCase({qux: 999}, 0, NaN, 0, NaN);
+ // Check that true values are converted properly.
+ TestCase({foo: true, bar: true, baz: true}, 1, 1.0, 1, 1.0);
+ // Check that false values are converted properly.
+ TestCase({foo: false, bar: false, baz: false}, 0, 0, 0, 0);
+ // Check that null values are converted properly.
+ TestCase({foo: null, bar: null, baz: null}, 0, 0, 0, 0);
+ // Check that string values are converted properly.
+ TestCase({foo: 'hi', bar: 'there', baz: 'dude'}, 0, NaN, 0, NaN);
+ TestCase({foo: '0xff', bar: '234', baz: '456.1'}, 255, 234, 456, 456.1);
+ // Check that function values are converted properly.
+ TestCase({foo: TestCase, bar: TestCase, qux: TestCase}, 0, NaN, 0, NaN);
+}
+
+print("TestForeignVariables...");
+TestForeignVariables();
+
+
+function TestGlobalBlock(stdlib, foreign, buffer) {
+ "use asm";
+
+ var x = foreign.x | 0, y = foreign.y | 0;
+
+ function test() {
+ return (x + y) | 0;
+ }
+
+ return {caller: test};
+}
+
+assertWasm(15, TestGlobalBlock, { x: 4, y: 11 });
diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm-memory.js b/deps/v8/test/mjsunit/wasm/asm-wasm-memory.js
new file mode 100644
index 0000000000..9c2ff77998
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/asm-wasm-memory.js
@@ -0,0 +1,212 @@
+// 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: --validate-asm --allow-natives-syntax
+
+var stdlib = this;
+let kMinHeapSize = 4096;
+
+function assertValidAsm(func) {
+ assertTrue(%IsAsmWasmCode(func), "must be valid asm code");
+}
+
+function assertWasm(expected, func, ffi) {
+ print("Testing " + func.name + "...");
+ assertEquals(
+ expected, func(stdlib, ffi, new ArrayBuffer(kMinHeapSize)).caller());
+ assertValidAsm(func);
+}
+
+
+function TestInt32HeapAccess(stdlib, foreign, buffer) {
+ "use asm";
+
+ var m = new stdlib.Int32Array(buffer);
+ function caller() {
+ var i = 4;
+
+ m[0] = (i + 1) | 0;
+ m[i >> 2] = ((m[0]|0) + 1) | 0;
+ m[2] = ((m[i >> 2]|0) + 1) | 0;
+ return m[2] | 0;
+ }
+
+ return {caller: caller};
+}
+
+assertWasm(7, TestInt32HeapAccess);
+
+
+function TestInt32HeapAccessExternal() {
+ var memory = new ArrayBuffer(kMinHeapSize);
+ var memory_int32 = new Int32Array(memory);
+ var module_decl = eval('(' + TestInt32HeapAccess.toString() + ')');
+ var module = module_decl(stdlib, null, memory);
+ assertValidAsm(module_decl);
+ assertEquals(7, module.caller());
+ assertEquals(7, memory_int32[2]);
+}
+
+TestInt32HeapAccessExternal();
+
+
+function TestHeapAccessIntTypes() {
+ var types = [
+ [Int8Array, 'Int8Array', '>> 0'],
+ [Uint8Array, 'Uint8Array', '>> 0'],
+ [Int16Array, 'Int16Array', '>> 1'],
+ [Uint16Array, 'Uint16Array', '>> 1'],
+ [Int32Array, 'Int32Array', '>> 2'],
+ [Uint32Array, 'Uint32Array', '>> 2'],
+ ];
+ for (var i = 0; i < types.length; i++) {
+ var code = TestInt32HeapAccess.toString();
+ code = code.replace('Int32Array', types[i][1]);
+ code = code.replace(/>> 2/g, types[i][2]);
+ var memory = new ArrayBuffer(kMinHeapSize);
+ var memory_view = new types[i][0](memory);
+ var module_decl = eval('(' + code + ')');
+ var module = module_decl(stdlib, null, memory);
+ assertValidAsm(module_decl);
+ assertEquals(7, module.caller());
+ assertEquals(7, memory_view[2]);
+ assertValidAsm(module_decl);
+ }
+}
+
+TestHeapAccessIntTypes();
+
+
+function TestFloatHeapAccess(stdlib, foreign, buffer) {
+ "use asm";
+
+ var f32 = new stdlib.Float32Array(buffer);
+ var f64 = new stdlib.Float64Array(buffer);
+ var fround = stdlib.Math.fround;
+ function caller() {
+ var i = 8;
+ var j = 8;
+ var v = 6.0;
+
+ f64[2] = v + 1.0;
+ f64[i >> 3] = +f64[2] + 1.0;
+ f64[j >> 3] = +f64[j >> 3] + 1.0;
+ i = +f64[i >> 3] == 9.0;
+ return i|0;
+ }
+
+ return {caller: caller};
+}
+
+assertWasm(1, TestFloatHeapAccess);
+
+
+function TestFloatHeapAccessExternal() {
+ var memory = new ArrayBuffer(kMinHeapSize);
+ var memory_float64 = new Float64Array(memory);
+ var module_decl = eval('(' + TestFloatHeapAccess.toString() + ')');
+ var module = module_decl(stdlib, null, memory);
+ assertValidAsm(module_decl);
+ assertEquals(1, module.caller());
+ assertEquals(9.0, memory_float64[1]);
+}
+
+TestFloatHeapAccessExternal();
+
+
+(function() {
+ function TestByteHeapAccessCompat(stdlib, foreign, buffer) {
+ "use asm";
+
+ var HEAP8 = new stdlib.Uint8Array(buffer);
+ var HEAP32 = new stdlib.Int32Array(buffer);
+
+ function store(i, v) {
+ i = i | 0;
+ v = v | 0;
+ HEAP32[i >> 2] = v;
+ }
+
+ function storeb(i, v) {
+ i = i | 0;
+ v = v | 0;
+ HEAP8[i | 0] = v;
+ }
+
+ function load(i) {
+ i = i | 0;
+ return HEAP8[i] | 0;
+ }
+
+ function iload(i) {
+ i = i | 0;
+ return HEAP8[HEAP32[i >> 2] | 0] | 0;
+ }
+
+ return {load: load, iload: iload, store: store, storeb: storeb};
+ }
+
+ var memory = new ArrayBuffer(kMinHeapSize);
+ var module_decl = eval('(' + TestByteHeapAccessCompat.toString() + ')');
+ var m = module_decl(stdlib, null, memory);
+ assertValidAsm(module_decl);
+ m.store(0, 20);
+ m.store(4, 21);
+ m.store(8, 22);
+ m.storeb(20, 123);
+ m.storeb(21, 42);
+ m.storeb(22, 77);
+ assertEquals(123, m.load(20));
+ assertEquals(42, m.load(21));
+ assertEquals(77, m.load(22));
+ assertEquals(123, m.iload(0));
+ assertEquals(42, m.iload(4));
+ assertEquals(77, m.iload(8));
+})();
+
+
+function TestIntishAssignment(stdlib, foreign, heap) {
+ "use asm";
+ var HEAP32 = new stdlib.Int32Array(heap);
+ function func() {
+ var a = 1;
+ var b = 2;
+ HEAP32[0] = a + b;
+ return HEAP32[0] | 0;
+ }
+ return {caller: func};
+}
+
+assertWasm(3, TestIntishAssignment);
+
+
+function TestFloatishAssignment(stdlib, foreign, heap) {
+ "use asm";
+ var HEAPF32 = new stdlib.Float32Array(heap);
+ var fround = stdlib.Math.fround;
+ function func() {
+ var a = fround(1.0);
+ var b = fround(2.0);
+ HEAPF32[0] = a + b;
+ return +HEAPF32[0];
+ }
+ return {caller: func};
+}
+
+assertWasm(3, TestFloatishAssignment);
+
+
+function TestDoubleToFloatAssignment(stdlib, foreign, heap) {
+ "use asm";
+ var HEAPF32 = new stdlib.Float32Array(heap);
+ var fround = stdlib.Math.fround;
+ function func() {
+ var a = 1.23;
+ HEAPF32[0] = a;
+ return +HEAPF32[0];
+ }
+ return {caller: func};
+}
+
+assertWasm(Math.fround(1.23), TestDoubleToFloatAssignment);
diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm.js b/deps/v8/test/mjsunit/wasm/asm-wasm.js
index 71c6b10490..97219f113b 100644
--- a/deps/v8/test/mjsunit/wasm/asm-wasm.js
+++ b/deps/v8/test/mjsunit/wasm/asm-wasm.js
@@ -5,6 +5,7 @@
// Flags: --validate-asm --allow-natives-syntax
var stdlib = this;
+let kMinHeapSize = 4096;
function assertValidAsm(func) {
assertTrue(%IsAsmWasmCode(func), "must be valid asm code");
@@ -13,7 +14,7 @@ function assertValidAsm(func) {
function assertWasm(expected, func, ffi) {
print("Testing " + func.name + "...");
assertEquals(
- expected, func(stdlib, ffi, new ArrayBuffer(1024)).caller());
+ expected, func(stdlib, ffi, new ArrayBuffer(kMinHeapSize)).caller());
assertValidAsm(func);
}
@@ -514,100 +515,6 @@ function TestMixedAdd() {
assertWasm(23, TestMixedAdd);
-function TestInt32HeapAccess(stdlib, foreign, buffer) {
- "use asm";
-
- var m = new stdlib.Int32Array(buffer);
- function caller() {
- var i = 4;
-
- m[0] = (i + 1) | 0;
- m[i >> 2] = ((m[0]|0) + 1) | 0;
- m[2] = ((m[i >> 2]|0) + 1) | 0;
- return m[2] | 0;
- }
-
- return {caller: caller};
-}
-
-assertWasm(7, TestInt32HeapAccess);
-
-
-function TestInt32HeapAccessExternal() {
- var memory = new ArrayBuffer(1024);
- var memory_int32 = new Int32Array(memory);
- var module_decl = eval('(' + TestInt32HeapAccess.toString() + ')');
- var module = module_decl(stdlib, null, memory);
- assertValidAsm(module_decl);
- assertEquals(7, module.caller());
- assertEquals(7, memory_int32[2]);
-}
-
-TestInt32HeapAccessExternal();
-
-
-function TestHeapAccessIntTypes() {
- var types = [
- [Int8Array, 'Int8Array', '>> 0'],
- [Uint8Array, 'Uint8Array', '>> 0'],
- [Int16Array, 'Int16Array', '>> 1'],
- [Uint16Array, 'Uint16Array', '>> 1'],
- [Int32Array, 'Int32Array', '>> 2'],
- [Uint32Array, 'Uint32Array', '>> 2'],
- ];
- for (var i = 0; i < types.length; i++) {
- var code = TestInt32HeapAccess.toString();
- code = code.replace('Int32Array', types[i][1]);
- code = code.replace(/>> 2/g, types[i][2]);
- var memory = new ArrayBuffer(1024);
- var memory_view = new types[i][0](memory);
- var module_decl = eval('(' + code + ')');
- var module = module_decl(stdlib, null, memory);
- assertValidAsm(module_decl);
- assertEquals(7, module.caller());
- assertEquals(7, memory_view[2]);
- assertValidAsm(module_decl);
- }
-}
-
-TestHeapAccessIntTypes();
-
-
-function TestFloatHeapAccess(stdlib, foreign, buffer) {
- "use asm";
-
- var f32 = new stdlib.Float32Array(buffer);
- var f64 = new stdlib.Float64Array(buffer);
- var fround = stdlib.Math.fround;
- function caller() {
- var i = 8;
- var j = 8;
- var v = 6.0;
-
- f64[2] = v + 1.0;
- f64[i >> 3] = +f64[2] + 1.0;
- f64[j >> 3] = +f64[j >> 3] + 1.0;
- i = +f64[i >> 3] == 9.0;
- return i|0;
- }
-
- return {caller: caller};
-}
-
-assertWasm(1, TestFloatHeapAccess);
-
-
-function TestFloatHeapAccessExternal() {
- var memory = new ArrayBuffer(1024);
- var memory_float64 = new Float64Array(memory);
- var module_decl = eval('(' + TestFloatHeapAccess.toString() + ')');
- var module = module_decl(stdlib, null, memory);
- assertValidAsm(module_decl);
- assertEquals(1, module.caller());
- assertEquals(9.0, memory_float64[1]);
-}
-
-TestFloatHeapAccessExternal();
function TestConvertI32() {
@@ -1031,219 +938,6 @@ assertEquals(31, module.caller(1, 0, 30, 11));
})();
-function TestForeignFunctions() {
- function AsmModule(stdlib, foreign, buffer) {
- "use asm";
-
- var setVal = foreign.setVal;
- var getVal = foreign.getVal;
-
- function caller(initial_value, new_value) {
- initial_value = initial_value|0;
- new_value = new_value|0;
- if ((getVal()|0) == (initial_value|0)) {
- setVal(new_value|0);
- return getVal()|0;
- }
- return 0;
- }
-
- return {caller:caller};
- }
-
- function ffi(initial_val) {
- var val = initial_val;
-
- function getVal() {
- return val;
- }
-
- function setVal(new_val) {
- val = new_val;
- }
-
- return {getVal:getVal, setVal:setVal};
- }
-
- var foreign = new ffi(23);
-
- var module = AsmModule({Math: Math}, foreign, null);
- assertValidAsm(AsmModule);
-
- assertEquals(103, module.caller(23, 103));
-}
-
-print("TestForeignFunctions...");
-TestForeignFunctions();
-
-
-function TestForeignFunctionMultipleUse() {
- function AsmModule(stdlib, foreign, buffer) {
- "use asm";
-
- var getVal = foreign.getVal;
-
- function caller(int_val, double_val) {
- int_val = int_val|0;
- double_val = +double_val;
- if ((getVal()|0) == (int_val|0)) {
- if ((+getVal()) == (+double_val)) {
- return 89;
- }
- }
- return 0;
- }
-
- return {caller:caller};
- }
-
- function ffi() {
- function getVal() {
- return 83.25;
- }
-
- return {getVal:getVal};
- }
-
- var foreign = new ffi();
-
- var module_decl = eval('(' + AsmModule.toString() + ')');
- var module = module_decl(stdlib, foreign, null);
- assertValidAsm(module_decl);
-
- assertEquals(89, module.caller(83, 83.25));
-}
-
-print("TestForeignFunctionMultipleUse...");
-TestForeignFunctionMultipleUse();
-
-function TestForeignVariables() {
- function AsmModule(stdlib, foreign, buffer) {
- "use asm";
-
- var i1 = foreign.foo | 0;
- var f1 = +foreign.bar;
- var i2 = foreign.baz | 0;
- var f2 = +foreign.baz;
-
- function geti1() {
- return i1|0;
- }
-
- function getf1() {
- return +f1;
- }
-
- function geti2() {
- return i2|0;
- }
-
- function getf2() {
- return +f2;
- }
-
- return {geti1:geti1, getf1:getf1, geti2:geti2, getf2:getf2};
- }
-
- function TestCase(env, i1, f1, i2, f2) {
- print("Testing foreign variables...");
- var module_decl = eval('(' + AsmModule.toString() + ')');
- var module = module_decl(stdlib, env);
- assertValidAsm(module_decl);
- assertEquals(i1, module.geti1());
- assertEquals(f1, module.getf1());
- assertEquals(i2, module.geti2());
- assertEquals(f2, module.getf2());
- }
-
- // Check normal operation.
- TestCase({foo: 123, bar: 234.5, baz: 345.7}, 123, 234.5, 345, 345.7);
- // Check partial operation.
- TestCase({baz: 345.7}, 0, NaN, 345, 345.7);
- // Check that undefined values are converted to proper defaults.
- TestCase({qux: 999}, 0, NaN, 0, NaN);
- // Check that true values are converted properly.
- TestCase({foo: true, bar: true, baz: true}, 1, 1.0, 1, 1.0);
- // Check that false values are converted properly.
- TestCase({foo: false, bar: false, baz: false}, 0, 0, 0, 0);
- // Check that null values are converted properly.
- TestCase({foo: null, bar: null, baz: null}, 0, 0, 0, 0);
- // Check that string values are converted properly.
- TestCase({foo: 'hi', bar: 'there', baz: 'dude'}, 0, NaN, 0, NaN);
- TestCase({foo: '0xff', bar: '234', baz: '456.1'}, 255, 234, 456, 456.1);
- // Check that function values are converted properly.
- TestCase({foo: TestCase, bar: TestCase, qux: TestCase}, 0, NaN, 0, NaN);
-}
-
-print("TestForeignVariables...");
-TestForeignVariables();
-
-
-(function() {
- function TestByteHeapAccessCompat(stdlib, foreign, buffer) {
- "use asm";
-
- var HEAP8 = new stdlib.Uint8Array(buffer);
- var HEAP32 = new stdlib.Int32Array(buffer);
-
- function store(i, v) {
- i = i | 0;
- v = v | 0;
- HEAP32[i >> 2] = v;
- }
-
- function storeb(i, v) {
- i = i | 0;
- v = v | 0;
- HEAP8[i | 0] = v;
- }
-
- function load(i) {
- i = i | 0;
- return HEAP8[i] | 0;
- }
-
- function iload(i) {
- i = i | 0;
- return HEAP8[HEAP32[i >> 2] | 0] | 0;
- }
-
- return {load: load, iload: iload, store: store, storeb: storeb};
- }
-
- var memory = new ArrayBuffer(1024);
- var module_decl = eval('(' + TestByteHeapAccessCompat.toString() + ')');
- var m = module_decl(stdlib, null, memory);
- assertValidAsm(module_decl);
- m.store(0, 20);
- m.store(4, 21);
- m.store(8, 22);
- m.storeb(20, 123);
- m.storeb(21, 42);
- m.storeb(22, 77);
- assertEquals(123, m.load(20));
- assertEquals(42, m.load(21));
- assertEquals(77, m.load(22));
- assertEquals(123, m.iload(0));
- assertEquals(42, m.iload(4));
- assertEquals(77, m.iload(8));
-})();
-
-
-function TestGlobalBlock(stdlib, foreign, buffer) {
- "use asm";
-
- var x = foreign.x | 0, y = foreign.y | 0;
-
- function test() {
- return (x + y) | 0;
- }
-
- return {caller: test};
-}
-
-assertWasm(15, TestGlobalBlock, { x: 4, y: 11 });
-
(function TestComma() {
function CommaModule() {
"use asm";
@@ -1322,52 +1016,6 @@ function TestXor() {
assertWasm(1, TestXor);
-function TestIntishAssignment(stdlib, foreign, heap) {
- "use asm";
- var HEAP32 = new stdlib.Int32Array(heap);
- function func() {
- var a = 1;
- var b = 2;
- HEAP32[0] = a + b;
- return HEAP32[0] | 0;
- }
- return {caller: func};
-}
-
-assertWasm(3, TestIntishAssignment);
-
-
-function TestFloatishAssignment(stdlib, foreign, heap) {
- "use asm";
- var HEAPF32 = new stdlib.Float32Array(heap);
- var fround = stdlib.Math.fround;
- function func() {
- var a = fround(1.0);
- var b = fround(2.0);
- HEAPF32[0] = a + b;
- return +HEAPF32[0];
- }
- return {caller: func};
-}
-
-assertWasm(3, TestFloatishAssignment);
-
-
-function TestDoubleToFloatAssignment(stdlib, foreign, heap) {
- "use asm";
- var HEAPF32 = new stdlib.Float32Array(heap);
- var fround = stdlib.Math.fround;
- function func() {
- var a = 1.23;
- HEAPF32[0] = a;
- return +HEAPF32[0];
- }
- return {caller: func};
-}
-
-assertWasm(Math.fround(1.23), TestDoubleToFloatAssignment);
-
-
function TestIntegerMultiplyBothWays(stdlib, foreign, heap) {
"use asm";
function func() {
diff --git a/deps/v8/test/mjsunit/wasm/atomics.js b/deps/v8/test/mjsunit/wasm/atomics.js
index 63d8eb0ca8..58d3d950d5 100644
--- a/deps/v8/test/mjsunit/wasm/atomics.js
+++ b/deps/v8/test/mjsunit/wasm/atomics.js
@@ -145,109 +145,109 @@ function Test8Op(operation, func) {
}
(function TestAtomicAdd() {
- print("TestAtomicAdd");
+ print(arguments.callee.name);
let wasmAdd = GetAtomicBinOpFunction(kExprI32AtomicAdd, 2, 0);
Test32Op(Add, wasmAdd);
})();
(function TestAtomicAdd16U() {
- print("TestAtomicAdd16U");
+ print(arguments.callee.name);
let wasmAdd = GetAtomicBinOpFunction(kExprI32AtomicAdd16U, 1, 0);
Test16Op(Add, wasmAdd);
})();
(function TestAtomicAdd8U() {
- print("TestAtomicAdd8U");
+ print(arguments.callee.name);
let wasmAdd = GetAtomicBinOpFunction(kExprI32AtomicAdd8U, 0, 0);
Test8Op(Add, wasmAdd);
})();
(function TestAtomicSub() {
- print("TestAtomicSub");
+ print(arguments.callee.name);
let wasmSub = GetAtomicBinOpFunction(kExprI32AtomicSub, 2, 0);
Test32Op(Sub, wasmSub);
})();
(function TestAtomicSub16U() {
- print("TestAtomicSub16U");
+ print(arguments.callee.name);
let wasmSub = GetAtomicBinOpFunction(kExprI32AtomicSub16U, 1, 0);
Test16Op(Sub, wasmSub);
})();
(function TestAtomicSub8U() {
- print("TestAtomicSub8U");
+ print(arguments.callee.name);
let wasmSub = GetAtomicBinOpFunction(kExprI32AtomicSub8U, 0, 0);
Test8Op(Sub, wasmSub);
})();
(function TestAtomicAnd() {
- print("TestAtomicAnd");
+ print(arguments.callee.name);
let wasmAnd = GetAtomicBinOpFunction(kExprI32AtomicAnd, 2, 0);
Test32Op(And, wasmAnd);
})();
(function TestAtomicAnd16U() {
- print("TestAtomicAnd16U");
+ print(arguments.callee.name);
let wasmAnd = GetAtomicBinOpFunction(kExprI32AtomicAnd16U, 1, 0);
Test16Op(And, wasmAnd);
})();
(function TestAtomicAnd8U() {
- print("TestAtomicAnd8U");
+ print(arguments.callee.name);
let wasmAnd = GetAtomicBinOpFunction(kExprI32AtomicAnd8U, 0, 0);
Test8Op(And, wasmAnd);
})();
(function TestAtomicOr() {
- print("TestAtomicOr");
+ print(arguments.callee.name);
let wasmOr = GetAtomicBinOpFunction(kExprI32AtomicOr, 2, 0);
Test32Op(Or, wasmOr);
})();
(function TestAtomicOr16U() {
- print("TestAtomicOr16U");
+ print(arguments.callee.name);
let wasmOr = GetAtomicBinOpFunction(kExprI32AtomicOr16U, 1, 0);
Test16Op(Or, wasmOr);
})();
(function TestAtomicOr8U() {
- print("TestAtomicOr8U");
+ print(arguments.callee.name);
let wasmOr = GetAtomicBinOpFunction(kExprI32AtomicOr8U, 0, 0);
Test8Op(Or, wasmOr);
})();
(function TestAtomicXor() {
- print("TestAtomicXor");
+ print(arguments.callee.name);
let wasmXor = GetAtomicBinOpFunction(kExprI32AtomicXor, 2, 0);
Test32Op(Xor, wasmXor);
})();
(function TestAtomicXor16U() {
- print("TestAtomicXor16U");
+ print(arguments.callee.name);
let wasmXor = GetAtomicBinOpFunction(kExprI32AtomicXor16U, 1, 0);
Test16Op(Xor, wasmXor);
})();
(function TestAtomicXor8U() {
- print("TestAtomicXor8U");
+ print(arguments.callee.name);
let wasmXor = GetAtomicBinOpFunction(kExprI32AtomicXor8U, 0, 0);
Test8Op(Xor, wasmXor);
})();
(function TestAtomicExchange() {
- print("TestAtomicExchange");
+ print(arguments.callee.name);
let wasmExchange = GetAtomicBinOpFunction(kExprI32AtomicExchange, 2, 0);
Test32Op(Exchange, wasmExchange);
})();
(function TestAtomicExchange16U() {
- print("TestAtomicExchange16U");
+ print(arguments.callee.name);
let wasmExchange = GetAtomicBinOpFunction(kExprI32AtomicExchange16U, 1, 0);
Test16Op(Exchange, wasmExchange);
})();
(function TestAtomicExchange8U() {
- print("TestAtomicExchange8U");
+ print(arguments.callee.name);
let wasmExchange = GetAtomicBinOpFunction(kExprI32AtomicExchange8U, 0, 0);
Test8Op(Exchange, wasmExchange);
})();
@@ -268,7 +268,7 @@ function TestCmpExchange(func, buffer, params, size) {
}
(function TestAtomicCompareExchange() {
- print("TestAtomicCompareExchange");
+ print(arguments.callee.name);
let wasmCmpExchange =
GetAtomicCmpExchangeFunction(kExprI32AtomicCompareExchange, 2, 0);
let i32 = new Uint32Array(memory.buffer);
@@ -277,7 +277,7 @@ function TestCmpExchange(func, buffer, params, size) {
})();
(function TestAtomicCompareExchange16U() {
- print("TestAtomicCompareExchange16U");
+ print(arguments.callee.name);
let wasmCmpExchange =
GetAtomicCmpExchangeFunction(kExprI32AtomicCompareExchange16U, 1, 0);
let i16 = new Uint16Array(memory.buffer);
@@ -286,7 +286,7 @@ function TestCmpExchange(func, buffer, params, size) {
})();
(function TestAtomicCompareExchange8U() {
- print("TestAtomicCompareExchange8U");
+ print(arguments.callee.name);
let wasmCmpExchange =
GetAtomicCmpExchangeFunction(kExprI32AtomicCompareExchange8U, 0, 0);
let i8 = new Uint8Array(memory.buffer);
@@ -303,7 +303,7 @@ function TestLoad(func, buffer, value, size) {
}
(function TestAtomicLoad() {
- print("TestAtomicLoad");
+ print(arguments.callee.name);
let wasmLoad = GetAtomicLoadFunction(kExprI32AtomicLoad, 2, 0);
let i32 = new Uint32Array(memory.buffer);
let value = 0xacedaced;
@@ -311,7 +311,7 @@ function TestLoad(func, buffer, value, size) {
})();
(function TestAtomicLoad16U() {
- print("TestAtomicLoad16U");
+ print(arguments.callee.name);
let wasmLoad = GetAtomicLoadFunction(kExprI32AtomicLoad16U, 1, 0);
let i16 = new Uint16Array(memory.buffer);
let value = 0xaced;
@@ -319,7 +319,7 @@ function TestLoad(func, buffer, value, size) {
})();
(function TestAtomicLoad8U() {
- print("TestAtomicLoad8U");
+ print(arguments.callee.name);
let wasmLoad = GetAtomicLoadFunction(kExprI32AtomicLoad8U, 0, 0);
let i8 = new Uint8Array(memory.buffer);
let value = 0xac;
@@ -335,7 +335,7 @@ function TestStore(func, buffer, value, size) {
}
(function TestAtomicStore() {
- print("TestAtomicStore");
+ print(arguments.callee.name);
let wasmStore = GetAtomicStoreFunction(kExprI32AtomicStore, 2, 0);
let i32 = new Uint32Array(memory.buffer);
let value = 0xacedaced;
@@ -343,7 +343,7 @@ function TestStore(func, buffer, value, size) {
})();
(function TestAtomicStore16U() {
- print("TestAtomicStore16U");
+ print(arguments.callee.name);
let wasmStore = GetAtomicStoreFunction(kExprI32AtomicStore16U, 1, 0);
let i16 = new Uint16Array(memory.buffer);
let value = 0xaced;
@@ -351,7 +351,7 @@ function TestStore(func, buffer, value, size) {
})();
(function TestAtomicStore8U() {
- print("TestAtomicStore8U");
+ print(arguments.callee.name);
let wasmStore = GetAtomicStoreFunction(kExprI32AtomicStore8U, 0, 0);
let i8 = new Uint8Array(memory.buffer);
let value = 0xac;
@@ -359,7 +359,7 @@ function TestStore(func, buffer, value, size) {
})();
(function TestAtomicLoadStoreOffset() {
- print("TestAtomicLoadStoreOffset");
+ print(arguments.callee.name);
var builder = new WasmModuleBuilder();
let memory = new WebAssembly.Memory({
initial: 16, maximum: 128, shared: true});
@@ -390,7 +390,7 @@ function TestStore(func, buffer, value, size) {
})();
(function TestAtomicOpinLoop() {
- print("TestAtomicOpinLoop");
+ print(arguments.callee.name);
var builder = new WasmModuleBuilder();
let memory = new WebAssembly.Memory({
initial: 16, maximum: 128, shared: true});
@@ -415,3 +415,20 @@ function TestStore(func, buffer, value, size) {
{m: {imported_mem: memory}}));
assertEquals(20, instance.exports.main());
})();
+
+(function TestUnalignedAtomicAccesses() {
+ print(arguments.callee.name);
+ let wasmAdd = GetAtomicBinOpFunction(kExprI32AtomicAdd, 2, 17);
+ assertTraps(kTrapUnalignedAccess, () => wasmAdd(4, 1001));
+ let wasmLoad = GetAtomicLoadFunction(kExprI32AtomicLoad16U, 1, 0);
+ assertTraps(kTrapUnalignedAccess, () => wasmLoad(15));
+ let wasmStore = GetAtomicStoreFunction(kExprI32AtomicStore, 2, 0);
+ assertTraps(kTrapUnalignedAccess, () => wasmStore(22, 5));
+ let wasmCmpExchange =
+ GetAtomicCmpExchangeFunction(kExprI32AtomicCompareExchange, 2, 0x16);
+ assertTraps(kTrapUnalignedAccess, () => wasmCmpExchange(11, 6, 5));
+
+ // Building functions with bad alignment should fail to compile
+ assertThrows(() => GetAtomicBinOpFunction(kExprI32AtomicSub16U, 3, 0),
+ WebAssembly.CompileError);
+})();
diff --git a/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js b/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js
index 8643093db0..9308393da4 100644
--- a/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js
+++ b/deps/v8/test/mjsunit/wasm/bounds-check-64bit.js
@@ -21,13 +21,14 @@ builder.addFunction('load', kSig_i_ii)
const module = builder.instantiate();
let start = 12;
let address = start;
-for (i = 1; i < 64; i++) {
+for (i = 0; i < 64; i++) {
// This is the address which will be accessed in the code. We cannot use
// shifts to calculate the address because JS shifts work on 32-bit integers.
- address = (address * 2) % 4294967296;
+ print(`address=${address}`);
if (address < kPageSize) {
assertEquals(0, module.exports.load(start, i));
} else {
assertTraps(kTrapMemOutOfBounds, _ => { module.exports.load(start, i);});
}
+ address = (address * 2) % 4294967296;
}
diff --git a/deps/v8/test/mjsunit/wasm/empirical_max_memory.js b/deps/v8/test/mjsunit/wasm/empirical_max_memory.js
new file mode 100644
index 0000000000..262dfe10ef
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/empirical_max_memory.js
@@ -0,0 +1,85 @@
+// 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: --expose-wasm
+
+load('test/mjsunit/wasm/wasm-constants.js');
+load('test/mjsunit/wasm/wasm-module-builder.js');
+
+let k1MiB = 1 * 1024 * 1024;
+let k1GiB = 1 * 1024 * 1024 * 1024;
+let k4GiB = 4 * k1GiB;
+let kMaxMemory = 2 * k1GiB - kPageSize; // TODO(titzer): raise this to 4GiB
+
+(function Test() {
+ var memory;
+
+ function BuildAccessors(type, load_opcode, store_opcode) {
+ builder = new WasmModuleBuilder();
+ builder.addImportedMemory("i", "mem");
+ builder.addFunction("load", makeSig([kWasmI32], [type]))
+ .addBody([ // --
+ kExprGetLocal, 0, // --
+ load_opcode, 0, 0, // --
+ ]) // --
+ .exportFunc();
+ builder.addFunction("store", makeSig([kWasmI32, type], []))
+ .addBody([ // --
+ kExprGetLocal, 0, // --
+ kExprGetLocal, 1, // --
+ store_opcode, 0, 0, // --
+ ]) // --
+ .exportFunc();
+ let i = builder.instantiate({i: {mem: memory}});
+ return {load: i.exports.load, store: i.exports.store};
+ }
+
+ function probe(a, f) {
+ print("------------------------");
+ let stride = kPageSize;
+ let max = kMaxMemory;
+ for (let i = 0; i < max; i += stride) {
+ a.store(i, f(i));
+ }
+ for (let i = 0; i < max; i += stride) {
+ // print(`${i} = ${f(i)}`);
+ assertEquals(f(i), a.load(i));
+ }
+ }
+
+ try {
+ let kPages = kMaxMemory / kPageSize;
+ memory = new WebAssembly.Memory({initial: kPages, maximum: kPages});
+ } catch (e) {
+ print("OOM: sorry, best effort max memory size test.");
+ return;
+ }
+
+ assertEquals(kMaxMemory, memory.buffer.byteLength);
+
+ {
+ let a = BuildAccessors(kWasmI32, kExprI32LoadMem, kExprI32StoreMem);
+ probe(a, i => (0xaabbccee ^ ((i >> 11) * 0x110005)) | 0);
+ }
+
+ {
+ let a = BuildAccessors(kWasmI32, kExprI32LoadMem16U, kExprI32StoreMem16);
+ probe(a, i => (0xccee ^ ((i >> 11) * 0x110005)) & 0xFFFF);
+ }
+
+ {
+ let a = BuildAccessors(kWasmI32, kExprI32LoadMem8U, kExprI32StoreMem8);
+ probe(a, i => (0xee ^ ((i >> 11) * 0x05)) & 0xFF);
+ }
+
+ {
+ let a = BuildAccessors(kWasmF64, kExprF64LoadMem, kExprF64StoreMem);
+ probe(a, i => 0xaabbccee ^ ((i >> 11) * 0x110005));
+ }
+
+ {
+ let a = BuildAccessors(kWasmF32, kExprF32LoadMem, kExprF32StoreMem);
+ probe(a, i => Math.fround(0xaabbccee ^ ((i >> 11) * 0x110005)));
+ }
+})();
diff --git a/deps/v8/test/mjsunit/wasm/ffi-error.js b/deps/v8/test/mjsunit/wasm/ffi-error.js
index e7811d2b78..2b4cb9a4eb 100644
--- a/deps/v8/test/mjsunit/wasm/ffi-error.js
+++ b/deps/v8/test/mjsunit/wasm/ffi-error.js
@@ -4,180 +4,222 @@
// Flags: --expose-wasm
-load("test/mjsunit/wasm/wasm-constants.js");
-load("test/mjsunit/wasm/wasm-module-builder.js");
-
-function instantiateWithFFI(ffi) {
- var builder = new WasmModuleBuilder();
-
- var sig_index = kSig_i_dd;
- builder.addImport("mod", "fun", sig_index);
- builder.addFunction("main", sig_index)
- .addBody([
- kExprGetLocal, 0, // --
- kExprGetLocal, 1, // --
- kExprCallFunction, 0, // --
- ]) // --
- .exportFunc();
-
- return builder.instantiate(ffi);
+load('test/mjsunit/wasm/wasm-constants.js');
+load('test/mjsunit/wasm/wasm-module-builder.js');
+
+function CreateDefaultBuilder() {
+ const builder = new WasmModuleBuilder();
+
+ const sig_index = kSig_i_dd;
+ builder.addImport('mod', 'fun', sig_index);
+ builder.addFunction('main', sig_index)
+ .addBody([
+ kExprGetLocal, 0, // --
+ kExprGetLocal, 1, // --
+ kExprCallFunction, 0, // --
+ ]) // --
+ .exportFunc();
+ return builder;
}
-// everything is good.
-(function() {
- var ffi = {"mod": {fun: function(a, b) { print(a, b); }}}
- instantiateWithFFI(ffi);
-})();
-
-
-// FFI object should be an object.
-assertThrows(function() {
- var ffi = 0;
- instantiateWithFFI(ffi);
-});
+function checkSuccessfulInstantiation(builder, ffi, handler) {
+ // Test synchronous instantiation.
+ const instance = builder.instantiate(ffi);
+ if (handler) handler(instance);
+ // Test asynchronous instantiation.
+ assertPromiseResult(builder.asyncInstantiate(ffi), handler);
+}
-// FFI object should have a "mod" property.
-assertThrows(function() {
- instantiateWithFFI({});
-});
+function checkFailingInstantiation(builder, ffi, error, message) {
+ // Test synchronous instantiation.
+ assertThrows(_ => builder.instantiate(ffi), error, message);
+ // Test asynchronous instantiation.
+ assertPromiseResult(builder.asyncInstantiate(ffi), assertUnreachable, e => {
+ assertInstanceof(e, error);
+ assertEquals(message, e.message);
+ });
+}
-// FFI object should have a "fun" property.
-assertThrows(function() {
- instantiateWithFFI({mod: {}});
-});
+(function testValidFFI() {
+ print(arguments.callee.name);
+ let ffi = {'mod': {fun: print}};
+ checkSuccessfulInstantiation(CreateDefaultBuilder(), ffi, undefined);
+})();
+(function testInvalidFFIs() {
+ print(arguments.callee.name);
+ checkFailingInstantiation(
+ CreateDefaultBuilder(), 17, TypeError,
+ 'WebAssembly Instantiation: Argument 1 must be an object');
+ checkFailingInstantiation(
+ CreateDefaultBuilder(), {}, TypeError,
+ 'WebAssembly Instantiation: 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');
+ checkFailingInstantiation(
+ CreateDefaultBuilder(), {mod: {fun: {}}}, WebAssembly.LinkError,
+ 'WebAssembly Instantiation: 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');
+})();
-// "fun" should be a JS function.
-assertThrows(function() {
- instantiateWithFFI({mod: {fun: new Object()}});
-});
+(function testImportWithInvalidSignature() {
+ print(arguments.callee.name);
+ // "fun" should have signature "i_dd"
+ let builder = new WasmModuleBuilder();
+
+ let sig_index = kSig_i_dd;
+ builder.addFunction('exp', kSig_i_i)
+ .addBody([
+ kExprGetLocal,
+ 0,
+ ]) // --
+ .exportFunc();
+ 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');
+})();
-// "fun" should be a JS function.
-assertThrows(function() {
- instantiateWithFFI({mod: {fun: 0}});
-});
+(function regression870646() {
+ print(arguments.callee.name);
+ const ffi = {mod: {fun: function() {}}};
+ Object.defineProperty(ffi, 'mod', {
+ get: function() {
+ throw new Error('my_exception');
+ }
+ });
-// "fun" should have signature "i_dd"
-assertThrows(function () {
- var builder = new WasmModuleBuilder();
+ checkFailingInstantiation(CreateDefaultBuilder(), ffi, Error, 'my_exception');
+})();
- var sig_index = kSig_i_dd;
- builder.addFunction("exp", kSig_i_i)
- .addBody([
- kExprGetLocal, 0,
- ]) // --
- .exportFunc();
+// "fun" matches signature "i_dd"
+(function testImportWithValidSignature() {
+ print(arguments.callee.name);
+ let builder = new WasmModuleBuilder();
+
+ builder.addFunction('exp', kSig_i_dd)
+ .addBody([
+ kExprI32Const,
+ 33,
+ ]) // --
+ .exportFunc();
- var exported = builder.instantiate().exports.exp;
- instantiateWithFFI({mod: {fun: exported}});
-});
+ let exported = builder.instantiate().exports.exp;
-// "fun" matches signature "i_dd"
-(function () {
- var builder = new WasmModuleBuilder();
-
- builder.addFunction("exp", kSig_i_dd)
- .addBody([
- kExprI32Const, 33,
- ]) // --
- .exportFunc();
-
- var exported = builder.instantiate().exports.exp;
- var instance = instantiateWithFFI({mod: {fun: exported}});
- assertEquals(33, instance.exports.main());
+ checkSuccessfulInstantiation(
+ CreateDefaultBuilder(), {mod: {fun: exported}},
+ instance => assertEquals(33, instance.exports.main()));
})();
(function I64InSignatureThrows() {
- var builder = new WasmModuleBuilder();
+ print(arguments.callee.name);
+ let builder = new WasmModuleBuilder();
builder.addMemory(1, 1, true);
- builder.addFunction("function_with_invalid_signature", kSig_l_ll)
+ builder.addFunction('function_with_invalid_signature', kSig_l_ll)
.addBody([ // --
kExprGetLocal, 0, // --
kExprGetLocal, 1, // --
kExprI64Sub]) // --
.exportFunc()
- var module = builder.instantiate();
-
- assertThrows(function() {
- module.exports.function_with_invalid_signature(33, 88);
- }, TypeError);
+ checkSuccessfulInstantiation(
+ builder, undefined,
+ instance => assertThrows(function() {
+ instance.exports.function_with_invalid_signature(33, 88);
+ }, TypeError, 'wasm function signature contains illegal type'));
})();
(function I64ParamsInSignatureThrows() {
- var builder = new WasmModuleBuilder();
+ print(arguments.callee.name);
+ let builder = new WasmModuleBuilder();
builder.addMemory(1, 1, true);
- builder.addFunction("function_with_invalid_signature", kSig_i_l)
- .addBody([
- kExprGetLocal, 0,
- kExprI32ConvertI64
- ])
- .exportFunc()
+ builder.addFunction('function_with_invalid_signature', kSig_i_l)
+ .addBody([kExprGetLocal, 0, kExprI32ConvertI64])
+ .exportFunc();
- var module = builder.instantiate();
+ checkSuccessfulInstantiation(
+ builder, undefined,
+ instance => assertThrows(
+ _ => instance.exports.function_with_invalid_signature(12), TypeError,
+ 'wasm function signature contains illegal type'));
- assertThrows(function() {
- module.exports.function_with_invalid_signature(33);
- }, TypeError);
})();
(function I64JSImportThrows() {
- var builder = new WasmModuleBuilder();
- var sig_index = builder.addType(kSig_i_i);
- var sig_i64_index = builder.addType(kSig_i_l);
- var index = builder.addImport("", "func", sig_i64_index);
- builder.addFunction("main", sig_index)
- .addBody([
- kExprGetLocal, 0,
- kExprI64SConvertI32,
- kExprCallFunction, index // --
- ]) // --
- .exportFunc();
- var func = function() {return {};};
- var main = builder.instantiate({"": {func: func}}).exports.main;
- assertThrows(function() {
- main(13);
- }, TypeError);
+ print(arguments.callee.name);
+ let builder = new WasmModuleBuilder();
+ let sig_index = builder.addType(kSig_i_i);
+ let sig_i64_index = builder.addType(kSig_i_l);
+ let index = builder.addImport('', 'func', sig_i64_index);
+ builder.addFunction('main', sig_index)
+ .addBody([
+ kExprGetLocal, 0, kExprI64SConvertI32, kExprCallFunction, index // --
+ ]) // --
+ .exportFunc();
+
+ checkSuccessfulInstantiation(
+ builder, {'': {func: _ => {}}},
+ instance => assertThrows(
+ instance.exports.main, TypeError,
+ 'wasm function signature contains illegal type'));
+
})();
(function ImportI64ParamWithF64ReturnThrows() {
+ print(arguments.callee.name);
// This tests that we generate correct code by using the correct return
// register. See bug 6096.
- var builder = new WasmModuleBuilder();
+ let builder = new WasmModuleBuilder();
builder.addImport('', 'f', makeSig([kWasmI64], [kWasmF64]));
builder.addFunction('main', kSig_v_v)
.addBody([kExprI64Const, 0, kExprCallFunction, 0, kExprDrop])
.exportFunc();
- var instance = builder.instantiate({'': {f: i => i}});
- assertThrows(() => instance.exports.main(), TypeError);
+ checkSuccessfulInstantiation(
+ builder, {'': {f: i => i}},
+ instance => assertThrows(
+ instance.exports.main, TypeError,
+ 'wasm function signature contains illegal type'));
+
})();
(function ImportI64Return() {
+ print(arguments.callee.name);
// This tests that we generate correct code by using the correct return
// register(s). See bug 6104.
- var builder = new WasmModuleBuilder();
+ let builder = new WasmModuleBuilder();
builder.addImport('', 'f', makeSig([], [kWasmI64]));
builder.addFunction('main', kSig_v_v)
.addBody([kExprCallFunction, 0, kExprDrop])
.exportFunc();
- var instance = builder.instantiate({'': {f: () => 1}});
- assertThrows(() => instance.exports.main(), TypeError);
+ checkSuccessfulInstantiation(
+ builder, {'': {f: _ => 1}},
+ instance => assertThrows(
+ instance.exports.main, TypeError,
+ 'wasm function signature contains illegal type'));
+
})();
(function ImportSymbolToNumberThrows() {
- var builder = new WasmModuleBuilder();
- var index = builder.addImport("", "func", kSig_i_v);
- builder.addFunction("main", kSig_i_v)
+ print(arguments.callee.name);
+ let builder = new WasmModuleBuilder();
+ let index = builder.addImport('', 'f', kSig_i_v);
+ builder.addFunction('main', kSig_i_v)
.addBody([kExprCallFunction, 0])
.exportFunc();
- var func = () => Symbol();
- var main = builder.instantiate({"": {func: func}}).exports.main;
- assertThrows(() => main(), TypeError);
+
+ checkSuccessfulInstantiation(
+ builder, {'': {f: _ => Symbol()}},
+ instance => assertThrows(
+ instance.exports.main, TypeError,
+ 'Cannot convert a Symbol value to a number'));
})();
diff --git a/deps/v8/test/mjsunit/wasm/function-names.js b/deps/v8/test/mjsunit/wasm/function-names.js
index 9320c50789..fe7c401177 100644
--- a/deps/v8/test/mjsunit/wasm/function-names.js
+++ b/deps/v8/test/mjsunit/wasm/function-names.js
@@ -40,7 +40,7 @@ var module = builder.instantiate();
for (var i = 0; i < names.length; ++i) {
var line = lines[i].trim();
if (names[i] === null) continue;
- var printed_name = names[i] === undefined ? "<WASM UNNAMED>" : names[i]
+ var printed_name = names[i];
var expected_start = "at " + printed_name + " (";
assertTrue(line.startsWith(expected_start),
"should start with '" + expected_start + "': '" + line + "'");
diff --git a/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js b/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js
new file mode 100644
index 0000000000..c40bf2f11d
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/graceful_shutdown_during_tierup.js
@@ -0,0 +1,28 @@
+// 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: --no-wait-for-wasm --wasm-tier-up
+
+load("test/mjsunit/wasm/wasm-constants.js");
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+(function ShutdownDuringTierUp() {
+ // Create a big module.
+ var builder = new WasmModuleBuilder();
+
+ builder.addMemory(1, 1, true);
+ for (i = 0; i < 100; i++) {
+ builder.addFunction("sub" + i, kSig_i_i)
+ .addBody([ // --
+ kExprGetLocal, 0, // --
+ kExprI32Const, i % 61, // --
+ kExprI32Sub]) // --
+ .exportFunc()
+ }
+
+ var buffer = builder.toBuffer();
+ // Wait for compilation to finish, but then shutdown while tier-up is still
+ // running.
+ assertPromiseResult(WebAssembly.compile(buffer));
+})();
diff --git a/deps/v8/test/mjsunit/wasm/interpreter-mixed.js b/deps/v8/test/mjsunit/wasm/interpreter-mixed.js
index 08cfc8c96d..6225220c8d 100644
--- a/deps/v8/test/mjsunit/wasm/interpreter-mixed.js
+++ b/deps/v8/test/mjsunit/wasm/interpreter-mixed.js
@@ -193,3 +193,27 @@ function redirectToInterpreter(
}
}
})();
+
+(function testInterpreterPreservedOnTierUp() {
+ print(arguments.callee.name);
+ var builder = new WasmModuleBuilder();
+ var fun_body = [kExprI32Const, 23];
+ var fun = builder.addFunction('fun', kSig_i_v).addBody(fun_body).exportFunc();
+ var instance = builder.instantiate();
+ var exp = instance.exports;
+
+ // Initially the interpreter is not being called.
+ var initial_interpreted = %WasmNumInterpretedCalls(instance);
+ assertEquals(23, exp.fun());
+ assertEquals(initial_interpreted + 0, %WasmNumInterpretedCalls(instance));
+
+ // Redirection will cause the interpreter to be called.
+ %RedirectToWasmInterpreter(instance, fun.index);
+ assertEquals(23, exp.fun());
+ assertEquals(initial_interpreted + 1, %WasmNumInterpretedCalls(instance));
+
+ // Requesting a tier-up still ensure the interpreter is being called.
+ %WasmTierUpFunction(instance, fun.index);
+ assertEquals(23, exp.fun());
+ assertEquals(initial_interpreted + 2, %WasmNumInterpretedCalls(instance));
+})();
diff --git a/deps/v8/test/mjsunit/wasm/interpreter.js b/deps/v8/test/mjsunit/wasm/interpreter.js
index 0bf3f8610b..b887b40918 100644
--- a/deps/v8/test/mjsunit/wasm/interpreter.js
+++ b/deps/v8/test/mjsunit/wasm/interpreter.js
@@ -310,7 +310,7 @@ function checkStack(stack, expected_lines) {
if (!(e instanceof TypeError)) throw e;
checkStack(stripPath(e.stack), [
'TypeError: ' + kTrapMsgs[kTrapTypeError], // -
- ' at indirect (wasm-function[2]:1)', // -
+ ' at indirect (wasm-function[2]:3)', // -
' at main (wasm-function[3]:3)', // -
/^ at testIllegalImports \(interpreter.js:\d+:22\)$/, // -
/^ at interpreter.js:\d+:3$/
diff --git a/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js
new file mode 100644
index 0000000000..f9593e84f7
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/memory_1gb_oob.js
@@ -0,0 +1,99 @@
+// 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-mem-pages=16384
+
+load('test/mjsunit/wasm/wasm-constants.js');
+load('test/mjsunit/wasm/wasm-module-builder.js');
+
+const k1MiB = 1 * 1024 * 1024;
+const k1GiB = 1 * 1024 * 1024 * 1024;
+const k2GiB = 2 * k1GiB;
+const k3GiB = 3 * k1GiB;
+const k4GiB = 4 * k1GiB;
+const kMaxMemory = k1GiB;
+
+// Indexes (and offsets) used to systematically probe the memory.
+const indexes = (() => {
+ const a = k1GiB, b = k2GiB, c = k3GiB, d = k4GiB;
+ return [
+ 0, 1, 2, 3, 4, 5, 7, 8, 9, // near 0
+ a-8, a-4, a+0, a+1, a+2, a+3, a+4, a+5, a+7, a+8, a+9, // near 1GiB
+ b-8, b-4, b+0, b+1, b+2, b+3, b+4, b+5, b+7, b+8, b+9, // near 2GiB
+ c-8, c-4, c+0, c+1, c+2, c+3, c+4, c+5, c+7, c+8, c+9, // near 3GiB
+ d-9, d-8, d-7, d-5, d-4, d-3, d-2, d-1 // near 4GiB
+];
+})();
+
+(function Test() {
+ var memory;
+
+ function BuildAccessors(type, load_opcode, store_opcode, offset) {
+ builder = new WasmModuleBuilder();
+ builder.addImportedMemory("i", "mem");
+ const h = 0x80;
+ const m = 0x7f;
+ let offset_bytes = [h|((offset >>> 0) & m), // LEB encoding of offset
+ h|((offset >>> 7) & m),
+ h|((offset >>> 14) & m),
+ h|((offset >>> 21) & m),
+ 0|((offset >>> 28) & m)];
+ builder.addFunction("load", makeSig([kWasmI32], [type]))
+ .addBody([ // --
+ kExprGetLocal, 0, // --
+ load_opcode, 0, ...offset_bytes, // --
+ ]) // --
+ .exportFunc();
+ builder.addFunction("store", makeSig([kWasmI32, type], []))
+ .addBody([ // --
+ kExprGetLocal, 0, // --
+ kExprGetLocal, 1, // --
+ store_opcode, 0, ...offset_bytes, // --
+ ]) // --
+ .exportFunc();
+ let i = builder.instantiate({i: {mem: memory}});
+ return {offset: offset, load: i.exports.load, store: i.exports.store};
+ }
+
+ function probe(a, size, offset, f) {
+ print(`size=${size} offset=${offset}`);
+ for (let i of indexes) {
+ let oob = (i + size + offset) > kMaxMemory;
+ if (oob) {
+// print(` ${i} + ${offset} OOB`);
+ assertThrows(() => a.store(i, f(i)));
+ assertThrows(() => a.load(i));
+ } else {
+// print(` ${i} = ${f(i)}`);
+ a.store(i, f(i));
+ assertEquals(f(i), a.load(i));
+ }
+ }
+ }
+
+ try {
+ const kPages = kMaxMemory / kPageSize;
+ memory = new WebAssembly.Memory({initial: kPages, maximum: kPages});
+ } catch (e) {
+ print("OOM: sorry, best effort max memory size test.");
+ return;
+ }
+
+ assertEquals(kMaxMemory, memory.buffer.byteLength);
+
+ for (let offset of indexes) {
+ let a = BuildAccessors(kWasmI32, kExprI32LoadMem, kExprI32StoreMem, offset);
+ probe(a, 4, offset, i => (0xaabbccee ^ ((i >> 11) * 0x110005)) | 0);
+ }
+
+ for (let offset of indexes) {
+ let a = BuildAccessors(kWasmI32, kExprI32LoadMem8U, kExprI32StoreMem8, offset);
+ probe(a, 1, offset, i => (0xee ^ ((i >> 11) * 0x05)) & 0xFF);
+ }
+
+ for (let offset of indexes) {
+ let a = BuildAccessors(kWasmF64, kExprF64LoadMem, kExprF64StoreMem, offset);
+ probe(a, 8, offset, i => 0xaabbccee ^ ((i >> 11) * 0x110005));
+ }
+})();
diff --git a/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js
new file mode 100644
index 0000000000..db344f30f3
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/memory_2gb_oob.js
@@ -0,0 +1,99 @@
+// 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-mem-pages=32768
+
+load('test/mjsunit/wasm/wasm-constants.js');
+load('test/mjsunit/wasm/wasm-module-builder.js');
+
+const k1MiB = 1 * 1024 * 1024;
+const k1GiB = 1 * 1024 * 1024 * 1024;
+const k2GiB = 2 * k1GiB;
+const k3GiB = 3 * k1GiB;
+const k4GiB = 4 * k1GiB;
+const kMaxMemory = k2GiB;
+
+// Indexes (and offsets) used to systematically probe the memory.
+const indexes = (() => {
+ const a = k1GiB, b = k2GiB, c = k3GiB, d = k4GiB;
+ return [
+ 0, 1, 2, 3, 4, 5, 7, 8, 9, // near 0
+ a-8, a-4, a+0, a+1, a+2, a+3, a+4, a+5, a+7, a+8, a+9, // near 1GiB
+ b-8, b-4, b+0, b+1, b+2, b+3, b+4, b+5, b+7, b+8, b+9, // near 2GiB
+ c-8, c-4, c+0, c+1, c+2, c+3, c+4, c+5, c+7, c+8, c+9, // near 3GiB
+ d-9, d-8, d-7, d-5, d-4, d-3, d-2, d-1 // near 4GiB
+];
+})();
+
+(function Test() {
+ var memory;
+
+ function BuildAccessors(type, load_opcode, store_opcode, offset) {
+ builder = new WasmModuleBuilder();
+ builder.addImportedMemory("i", "mem");
+ const h = 0x80;
+ const m = 0x7f;
+ let offset_bytes = [h|((offset >>> 0) & m), // LEB encoding of offset
+ h|((offset >>> 7) & m),
+ h|((offset >>> 14) & m),
+ h|((offset >>> 21) & m),
+ 0|((offset >>> 28) & m)];
+ builder.addFunction("load", makeSig([kWasmI32], [type]))
+ .addBody([ // --
+ kExprGetLocal, 0, // --
+ load_opcode, 0, ...offset_bytes, // --
+ ]) // --
+ .exportFunc();
+ builder.addFunction("store", makeSig([kWasmI32, type], []))
+ .addBody([ // --
+ kExprGetLocal, 0, // --
+ kExprGetLocal, 1, // --
+ store_opcode, 0, ...offset_bytes, // --
+ ]) // --
+ .exportFunc();
+ let i = builder.instantiate({i: {mem: memory}});
+ return {offset: offset, load: i.exports.load, store: i.exports.store};
+ }
+
+ function probe(a, size, offset, f) {
+ print(`size=${size} offset=${offset}`);
+ for (let i of indexes) {
+ let oob = (i + size + offset) > kMaxMemory;
+ if (oob) {
+// print(` ${i} + ${offset} OOB`);
+ assertThrows(() => a.store(i, f(i)));
+ assertThrows(() => a.load(i));
+ } else {
+// print(` ${i} = ${f(i)}`);
+ a.store(i, f(i));
+ assertEquals(f(i), a.load(i));
+ }
+ }
+ }
+
+ try {
+ let kPages = kMaxMemory / kPageSize;
+ memory = new WebAssembly.Memory({initial: kPages, maximum: kPages});
+ } catch (e) {
+ print("OOM: sorry, best effort max memory size test.");
+ return;
+ }
+
+ assertEquals(kMaxMemory, memory.buffer.byteLength);
+
+ for (let offset of indexes) {
+ let a = BuildAccessors(kWasmI32, kExprI32LoadMem, kExprI32StoreMem, offset);
+ probe(a, 4, offset, i => (0xaabbccee ^ ((i >> 11) * 0x110005)) | 0);
+ }
+
+ for (let offset of indexes) {
+ let a = BuildAccessors(kWasmI32, kExprI32LoadMem8U, kExprI32StoreMem8, offset);
+ probe(a, 1, offset, i => (0xee ^ ((i >> 11) * 0x05)) & 0xFF);
+ }
+
+ for (let offset of indexes) {
+ let a = BuildAccessors(kWasmF64, kExprF64LoadMem, kExprF64StoreMem, offset);
+ probe(a, 8, offset, i => 0xaabbccee ^ ((i >> 11) * 0x110005));
+ }
+})();
diff --git a/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js b/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js
new file mode 100644
index 0000000000..d5cb006a79
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/memory_4gb_oob.js
@@ -0,0 +1,97 @@
+// 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('test/mjsunit/wasm/wasm-constants.js');
+load('test/mjsunit/wasm/wasm-module-builder.js');
+
+const k1MiB = 1 * 1024 * 1024;
+const k1GiB = 1 * 1024 * 1024 * 1024;
+const k2GiB = 2 * k1GiB;
+const k3GiB = 3 * k1GiB;
+const k4GiB = 4 * k1GiB;
+const kMaxMemory = k4GiB;
+
+// Indexes (and offsets) used to systematically probe the memory.
+const indexes = (() => {
+ const a = k1GiB, b = k2GiB, c = k3GiB, d = k4GiB;
+ return [
+ 0, 1, 2, 3, 4, 5, 7, 8, 9, // near 0
+ a-8, a-4, a+0, a+1, a+2, a+3, a+4, a+5, a+7, a+8, a+9, // near 1GiB
+ b-8, b-4, b+0, b+1, b+2, b+3, b+4, b+5, b+7, b+8, b+9, // near 2GiB
+ c-8, c-4, c+0, c+1, c+2, c+3, c+4, c+5, c+7, c+8, c+9, // near 3GiB
+ d-9, d-8, d-7, d-5, d-4, d-3, d-2, d-1 // near 4GiB
+];
+})();
+
+(function Test() {
+ var memory;
+
+ function BuildAccessors(type, load_opcode, store_opcode, offset) {
+ builder = new WasmModuleBuilder();
+ builder.addImportedMemory("i", "mem");
+ const h = 0x80;
+ const m = 0x7f;
+ let offset_bytes = [h|((offset >>> 0) & m), // LEB encoding of offset
+ h|((offset >>> 7) & m),
+ h|((offset >>> 14) & m),
+ h|((offset >>> 21) & m),
+ 0|((offset >>> 28) & m)];
+ builder.addFunction("load", makeSig([kWasmI32], [type]))
+ .addBody([ // --
+ kExprGetLocal, 0, // --
+ load_opcode, 0, ...offset_bytes, // --
+ ]) // --
+ .exportFunc();
+ builder.addFunction("store", makeSig([kWasmI32, type], []))
+ .addBody([ // --
+ kExprGetLocal, 0, // --
+ kExprGetLocal, 1, // --
+ store_opcode, 0, ...offset_bytes, // --
+ ]) // --
+ .exportFunc();
+ let i = builder.instantiate({i: {mem: memory}});
+ return {offset: offset, load: i.exports.load, store: i.exports.store};
+ }
+
+ function probe(a, size, offset, f) {
+ print(`size=${size} offset=${offset}`);
+ for (let i of indexes) {
+ let oob = (i + size + offset) > kMaxMemory;
+ if (oob) {
+// print(` ${i} + ${offset} OOB`);
+ assertThrows(() => a.store(i, f(i)));
+ assertThrows(() => a.load(i));
+ } else {
+// print(` ${i} = ${f(i)}`);
+ a.store(i, f(i));
+ assertEquals(f(i), a.load(i));
+ }
+ }
+ }
+
+ try {
+ let kPages = kMaxMemory / kPageSize;
+ memory = new WebAssembly.Memory({initial: kPages, maximum: kPages});
+ } catch (e) {
+ print("OOM: sorry, best effort max memory size test.");
+ return;
+ }
+
+ assertEquals(kMaxMemory, memory.buffer.byteLength);
+
+ for (let offset of indexes) {
+ let a = BuildAccessors(kWasmI32, kExprI32LoadMem, kExprI32StoreMem, offset);
+ probe(a, 4, offset, i => (0xaabbccee ^ ((i >> 11) * 0x110005)) | 0);
+ }
+
+ for (let offset of indexes) {
+ let a = BuildAccessors(kWasmI32, kExprI32LoadMem8U, kExprI32StoreMem8, offset);
+ probe(a, 1, offset, i => (0xee ^ ((i >> 11) * 0x05)) & 0xFF);
+ }
+
+ for (let offset of indexes) {
+ let a = BuildAccessors(kWasmF64, kExprF64LoadMem, kExprF64StoreMem, offset);
+ probe(a, 8, offset, i => 0xaabbccee ^ ((i >> 11) * 0x110005));
+ }
+})();
diff --git a/deps/v8/test/mjsunit/wasm/module-memory.js b/deps/v8/test/mjsunit/wasm/module-memory.js
index de05dd4657..2ca5d9a725 100644
--- a/deps/v8/test/mjsunit/wasm/module-memory.js
+++ b/deps/v8/test/mjsunit/wasm/module-memory.js
@@ -160,13 +160,15 @@ function testOOBThrows() {
assertEquals(0, write());
}
-
+ // Note that this test might be run concurrently in multiple Isolates, which
+ // makes an exact comparison of the expected trap count unreliable. But is is
+ // still possible to check the lower bound for the expected trap count.
for (offset = 65534; offset < 66536; offset++) {
const trap_count = %GetWasmRecoveredTrapCount();
assertTraps(kTrapMemOutOfBounds, read);
assertTraps(kTrapMemOutOfBounds, write);
if (%IsWasmTrapHandlerEnabled()) {
- assertEquals(trap_count + 2, %GetWasmRecoveredTrapCount());
+ assertTrue(trap_count + 2 <= %GetWasmRecoveredTrapCount());
}
}
}
diff --git a/deps/v8/test/mjsunit/wasm/origin-trial-flags.js b/deps/v8/test/mjsunit/wasm/origin-trial-flags.js
new file mode 100644
index 0000000000..d41f581e13
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/origin-trial-flags.js
@@ -0,0 +1,35 @@
+// 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.
+
+// Flags: --noexperimental-wasm-threads --allow-natives-syntax
+
+load("test/mjsunit/wasm/wasm-constants.js");
+load("test/mjsunit/wasm/wasm-module-builder.js");
+
+function instantiateModuleWithThreads() {
+ // Build a WebAssembly module which uses threads-features.
+ const builder = new WasmModuleBuilder();
+ const shared = true;
+ builder.addMemory(2, 10, false, shared);
+ builder.addFunction('main', kSig_i_ii)
+ .addBody([
+ kExprGetLocal, 0, kExprGetLocal, 1, kAtomicPrefix, kExprI32AtomicAdd, 2,
+ 0
+ ])
+ .exportFunc();
+
+ return builder.instantiate();
+}
+
+// Disable WebAssembly threads initially.
+%SetWasmThreadsEnabled(false);
+assertThrows(instantiateModuleWithThreads, WebAssembly.CompileError);
+
+// Enable WebAssembly threads.
+%SetWasmThreadsEnabled(true);
+assertInstanceof(instantiateModuleWithThreads(), WebAssembly.Instance);
+
+// Disable WebAssembly threads.
+%SetWasmThreadsEnabled(false);
+assertThrows(instantiateModuleWithThreads, WebAssembly.CompileError);
diff --git a/deps/v8/test/mjsunit/wasm/wasm-constants.js b/deps/v8/test/mjsunit/wasm/wasm-constants.js
index 8afe209e9b..f5aead9fb6 100644
--- a/deps/v8/test/mjsunit/wasm/wasm-constants.js
+++ b/deps/v8/test/mjsunit/wasm/wasm-constants.js
@@ -382,6 +382,7 @@ let kTrapFloatUnrepresentable = 5;
let kTrapFuncInvalid = 6;
let kTrapFuncSigMismatch = 7;
let kTrapTypeError = 8;
+let kTrapUnalignedAccess = 9;
let kTrapMsgs = [
"unreachable",
@@ -392,7 +393,8 @@ let kTrapMsgs = [
"float unrepresentable in integer range",
"invalid index into function table",
"function signature mismatch",
- "wasm function signature contains illegal type"
+ "wasm function signature contains illegal type",
+ "operation does not support unaligned accesses"
];
function assertTraps(trap, code) {
diff --git a/deps/v8/test/mjsunit/wasm/worker-interpreter.js b/deps/v8/test/mjsunit/wasm/worker-interpreter.js
new file mode 100644
index 0000000000..d730ed7a74
--- /dev/null
+++ b/deps/v8/test/mjsunit/wasm/worker-interpreter.js
@@ -0,0 +1,63 @@
+// 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: --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() {
+ let builder = new WasmModuleBuilder();
+ let add = builder.addFunction("add", kSig_i_ii)
+ .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add])
+ .exportFunc();
+
+ let module = builder.toModule();
+ let instance = new WebAssembly.Instance(module);
+ let exp = instance.exports;
+
+ let workerScript = `
+ var instance = null;
+ onmessage = function(message) {
+ try {
+ if (message.command == 'module') {
+ instance = new WebAssembly.Instance(message.module);
+ postMessage('OK');
+ }
+ if (message.command == 'call') {
+ let result = instance.exports.add(40, 2);
+ postMessage(result);
+ }
+ } catch(e) {
+ postMessage('ERROR: ' + e);
+ }
+ }
+ `;
+ let worker = new Worker(workerScript);
+
+ // Call method without using the interpreter.
+ var initial_interpreted = %WasmNumInterpretedCalls(instance);
+ assertEquals(23, exp.add(20, 3));
+ assertEquals(initial_interpreted + 0, %WasmNumInterpretedCalls(instance));
+
+ // Send module to the worker, still not interpreting.
+ worker.postMessage({ command:'module', module:module });
+ assertEquals('OK', worker.getMessage());
+ worker.postMessage({ command:'call' });
+ assertEquals(42, worker.getMessage());
+ assertEquals(initial_interpreted + 0, %WasmNumInterpretedCalls(instance));
+
+ // Switch to the interpreter and call method.
+ %RedirectToWasmInterpreter(instance, add.index);
+ assertEquals(23, exp.add(20, 3));
+ assertEquals(initial_interpreted + 1, %WasmNumInterpretedCalls(instance));
+
+ // Let worker call interpreted function.
+ worker.postMessage({ command:'call' });
+ assertEquals(42, worker.getMessage());
+ assertEquals(initial_interpreted + 1, %WasmNumInterpretedCalls(instance));
+
+ // All done.
+ worker.terminate();
+})();
diff --git a/deps/v8/test/mjsunit/wasm/worker-module.js b/deps/v8/test/mjsunit/wasm/worker-module.js
index 00615b8434..72645f8dbf 100644
--- a/deps/v8/test/mjsunit/wasm/worker-module.js
+++ b/deps/v8/test/mjsunit/wasm/worker-module.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: --no-wasm-disable-structured-cloning
+// Flags: --wasm-shared-engine --no-wasm-disable-structured-cloning
load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");
diff --git a/deps/v8/test/mkgrokdump/mkgrokdump.cc b/deps/v8/test/mkgrokdump/mkgrokdump.cc
index d610bf228a..713e952378 100644
--- a/deps/v8/test/mkgrokdump/mkgrokdump.cc
+++ b/deps/v8/test/mkgrokdump/mkgrokdump.cc
@@ -16,7 +16,7 @@
namespace v8 {
static const char* kHeader =
- "# Copyright 2017 the V8 project authors. All rights reserved.\n"
+ "# Copyright 2018 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/test262/test262.status b/deps/v8/test/test262/test262.status
index 59adae65fc..c581a9806c 100644
--- a/deps/v8/test/test262/test262.status
+++ b/deps/v8/test/test262/test262.status
@@ -419,10 +419,6 @@
'intl402/NumberFormat/prototype/format/format-fraction-digits': [FAIL],
'intl402/NumberFormat/prototype/format/format-significant-digits': [FAIL],
- # https://bugs.chromium.org/p/v8/issues/detail?id=7480
- 'intl402/Collator/unicode-ext-seq-in-private-tag': [FAIL],
- 'intl402/Collator/unicode-ext-seq-with-attribute': [FAIL],
-
# https://bugs.chromium.org/p/v8/issues/detail?id=7481
'intl402/NumberFormat/ignore-invalid-unicode-ext-values': [FAIL],
'intl402/DateTimeFormat/ignore-invalid-unicode-ext-values': [FAIL],
@@ -435,7 +431,6 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=7669
'intl402/Intl/getCanonicalLocales/canonicalized-tags': [FAIL],
- 'intl402/Intl/getCanonicalLocales/preferred-grandfathered': [FAIL],
# Tests assume that the sort order of "same elements" (comparator returns 0)
# is deterministic.
@@ -467,12 +462,6 @@
'intl402/Locale/invalid-tag-throws': [FAIL],
'intl402/Locale/likely-subtags': [FAIL],
'intl402/Locale/likely-subtags-grandfathered': [FAIL],
- 'intl402/Locale/prototype/maximize/length': [FAIL],
- 'intl402/Locale/prototype/maximize/name': [FAIL],
- 'intl402/Locale/prototype/maximize/prop-desc': [FAIL],
- 'intl402/Locale/prototype/minimize/length': [FAIL],
- 'intl402/Locale/prototype/minimize/name': [FAIL],
- 'intl402/Locale/prototype/minimize/prop-desc': [FAIL],
'intl402/Locale/prototype/toStringTag/toStringTag': [FAIL],
'intl402/Locale/prototype/toStringTag/toString': [FAIL],
@@ -481,15 +470,9 @@
'intl402/RelativeTimeFormat/constructor/supportedLocalesOf/length': [FAIL],
'intl402/RelativeTimeFormat/constructor/supportedLocalesOf/name': [FAIL],
'intl402/RelativeTimeFormat/constructor/supportedLocalesOf/prop-desc': [FAIL],
- 'intl402/RelativeTimeFormat/prototype/format/length': [FAIL],
- 'intl402/RelativeTimeFormat/prototype/format/name': [FAIL],
- 'intl402/RelativeTimeFormat/prototype/format/prop-desc': [FAIL],
- 'intl402/RelativeTimeFormat/prototype/formatToParts/length': [FAIL],
- 'intl402/RelativeTimeFormat/prototype/formatToParts/name': [FAIL],
- 'intl402/RelativeTimeFormat/prototype/formatToParts/prop-desc': [FAIL],
- # https://bugs.chromium.org/p/v8/issues/detail?id=7813
- 'built-ins/Array/prototype/lastIndexOf/calls-only-has-on-prototype-after-length-zeroed': [FAIL],
+ # https://bugs.chromium.org/p/v8/issues/detail?id=7993
+ 'intl402/RelativeTimeFormat/prototype/toStringTag/toStringTag': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=7814
'built-ins/Array/prototype/splice/property-traps-order-with-species': [FAIL],
@@ -534,7 +517,6 @@
# https://bugs.chromium.org/p/v8/issues/detail?id=6538
'built-ins/Array/prototype/unshift/throws-if-integer-limit-exceeded': [SKIP],
- 'built-ins/Array/prototype/reverse/length-exceeding-integer-limit-with-proxy': [FAIL],
'built-ins/Array/prototype/splice/create-species-length-exceeding-integer-limit': [FAIL],
'built-ins/Array/prototype/splice/throws-if-integer-limit-exceeded': [SKIP],
diff --git a/deps/v8/test/test262/testcfg.py b/deps/v8/test/test262/testcfg.py
index e944b3ebec..7a1de38ce1 100644
--- a/deps/v8/test/test262/testcfg.py
+++ b/deps/v8/test/test262/testcfg.py
@@ -50,6 +50,7 @@ FEATURE_FLAGS = {
'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',
'Symbol.prototype.description': '--harmony-symbol-description',
diff --git a/deps/v8/test/torque/test-torque.tq b/deps/v8/test/torque/test-torque.tq
index 1ed8e986b6..3c258607fc 100644
--- a/deps/v8/test/torque/test-torque.tq
+++ b/deps/v8/test/torque/test-torque.tq
@@ -98,10 +98,11 @@ module test {
}
macro LabelTestHelper4(flag: constexpr bool): never labels Label4, Label5 {
- if
- constexpr(flag) goto Label4;
- else
+ if constexpr(flag) {
+ goto Label4;
+ } else {
goto Label5;
+ }
}
macro CallLabelTestHelper4(flag: constexpr bool): bool {
@@ -120,10 +121,11 @@ module test {
let r1: bool = CallLabelTestHelper4(true);
let r2: bool = CallLabelTestHelper4(false);
- if (r1 && !r2)
+ if (r1 && !r2) {
return True;
- else
+ } else {
return False;
+ }
}
macro GenericMacroTest<T : type>(param: T): Object {
@@ -242,8 +244,17 @@ module test {
}
macro TestLocalConstBindings() {
- const kSmi: Smi = 3;
- check(kSmi == 3);
+ const x : constexpr int31 = 3;
+ const x_smi : Smi = x;
+ {
+ const x : Smi = x + from_constexpr<Smi>(1);
+ check(x == x_smi + 1);
+ const x_smi : Smi = x;
+ check(x == x_smi);
+ check(x == 4);
+ }
+ check(x_smi == 3);
+ check(x == x_smi);
}
struct TestStructA {
@@ -289,4 +300,150 @@ module test {
macro TestStruct4(): TestStructC {
return TestStructC{TestStruct2(), TestStruct2()};
}
+
+ // This macro tests different versions of the for-loop where some parts
+ // are (not) present.
+ macro TestForLoop() {
+ let sum: Smi = 0;
+ for (let i: Smi = 0; i < 5; ++i) sum += i;
+ check(sum == 10);
+
+ sum = 0;
+ let j: Smi = 0;
+ for (; j < 5; ++j) sum += j;
+ check(sum == 10);
+
+ sum = 0;
+ j = 0;
+ for (; j < 5;) sum += j++;
+ check(sum == 10);
+
+ // Check that break works. No test expression.
+ sum = 0;
+ for (let i: Smi = 0;; ++i) {
+ if (i == 5) break;
+ sum += i;
+ }
+ check(sum == 10);
+
+ sum = 0;
+ j = 0;
+ for (;;) {
+ if (j == 5) break;
+ sum += j;
+ j++;
+ }
+ check(sum == 10);
+
+ // The following tests are the same as above, but use continue to skip
+ // index 3.
+ sum = 0;
+ for (let i: Smi = 0; i < 5; ++i) {
+ if (i == 3) continue;
+ sum += i;
+ }
+ check(sum == 7);
+
+ sum = 0;
+ j = 0;
+ for (; j < 5; ++j) {
+ if (j == 3) continue;
+ sum += j;
+ }
+ check(sum == 7);
+
+ sum = 0;
+ j = 0;
+ for (; j < 5;) {
+ if (j == 3) {
+ j++;
+ continue;
+ }
+ sum += j;
+ j++;
+ }
+ check(sum == 7);
+
+ sum = 0;
+ for (let i: Smi = 0;; ++i) {
+ if (i == 3) continue;
+ if (i == 5) break;
+ sum += i;
+ }
+ check(sum == 7);
+
+ sum = 0;
+ j = 0;
+ for (;;) {
+ if (j == 3) {
+ j++;
+ continue;
+ }
+
+ if (j == 5) break;
+ sum += j;
+ j++;
+ }
+ check(sum == 7);
+ }
+
+ macro TestSubtyping(x : Smi) {
+ const foo : Object = x;
+ }
+
+ macro IncrementIfSmi<A : type>(x : A) : A {
+ typeswitch (x) {
+ case (x : Smi) {
+ return x + 1;
+ } case (o : A) {
+ return o;
+ }
+ }
+ }
+
+ macro TypeswitchExample(x : Number | FixedArray) : int32 {
+ let result : int32 = 0;
+ typeswitch (IncrementIfSmi<(Number|FixedArray)>(x)) {
+ case (x : FixedArray) {
+ result = result + 1;
+ } case (Number) {
+ result = result + 2;
+ }
+ }
+
+ result = result * 10;
+
+ typeswitch (IncrementIfSmi<(Number|FixedArray)>(x)) {
+ case (x : Smi) {
+ result = result + convert<int32>(x);
+ } case (a : FixedArray) {
+ result = result + convert<int32>(a.length);
+ } case (x : HeapNumber) {
+ result = result + 7;
+ }
+ }
+
+ return result;
+ }
+
+ macro TestTypeswitch() {
+ check(TypeswitchExample(from_constexpr<Smi>(5)) == 26);
+ const a : FixedArray = AllocateZeroedFixedArray(3);
+ check(TypeswitchExample(a) == 13);
+ check(TypeswitchExample(from_constexpr<Number>(0.5)) == 27);
+ }
+
+ macro ExampleGenericOverload<A: type>(o : Object) : A {
+ return o;
+ }
+ macro ExampleGenericOverload<A: type>(o : Smi) : A {
+ return o + 1;
+ }
+
+ macro TestGenericOverload() {
+ const x_smi : Smi = 5;
+ const x_object : Object = x_smi;
+ check(ExampleGenericOverload<Smi>(x_smi) == 6);
+ check(unsafe_cast<Smi>(ExampleGenericOverload<Object>(x_object)) == 5);
+ }
}
diff --git a/deps/v8/test/unittests/BUILD.gn b/deps/v8/test/unittests/BUILD.gn
index a6cf82f163..606fe9c343 100644
--- a/deps/v8/test/unittests/BUILD.gn
+++ b/deps/v8/test/unittests/BUILD.gn
@@ -41,6 +41,7 @@ v8_source_set("unittests_sources") {
testonly = true
sources = [
+ "../../test/common/assembler-tester.h",
"../../test/common/wasm/wasm-macro-gen.h",
"../../testing/gmock-support.h",
"../../testing/gtest-support.h",
@@ -191,6 +192,7 @@ v8_source_set("unittests_sources") {
"test-helpers.h",
"test-utils.cc",
"test-utils.h",
+ "torque/earley-parser-unittest.cc",
"unicode-unittest.cc",
"utils-unittest.cc",
"value-serializer-unittest.cc",
@@ -222,21 +224,45 @@ v8_source_set("unittests_sources") {
}
if (v8_current_cpu == "arm") {
- sources += [ "compiler/arm/instruction-selector-arm-unittest.cc" ]
+ sources += [
+ "assembler/turbo-assembler-arm-unittest.cc",
+ "compiler/arm/instruction-selector-arm-unittest.cc",
+ ]
} else if (v8_current_cpu == "arm64") {
- sources += [ "compiler/arm64/instruction-selector-arm64-unittest.cc" ]
+ sources += [
+ "assembler/turbo-assembler-arm64-unittest.cc",
+ "compiler/arm64/instruction-selector-arm64-unittest.cc",
+ ]
} else if (v8_current_cpu == "x86") {
- sources += [ "compiler/ia32/instruction-selector-ia32-unittest.cc" ]
+ sources += [
+ "assembler/turbo-assembler-ia32-unittest.cc",
+ "compiler/ia32/instruction-selector-ia32-unittest.cc",
+ ]
} else if (v8_current_cpu == "mips" || v8_current_cpu == "mipsel") {
- sources += [ "compiler/mips/instruction-selector-mips-unittest.cc" ]
+ sources += [
+ "assembler/turbo-assembler-mips-unittest.cc",
+ "compiler/mips/instruction-selector-mips-unittest.cc",
+ ]
} else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") {
- sources += [ "compiler/mips64/instruction-selector-mips64-unittest.cc" ]
+ sources += [
+ "assembler/turbo-assembler-mips64-unittest.cc",
+ "compiler/mips64/instruction-selector-mips64-unittest.cc",
+ ]
} else if (v8_current_cpu == "x64") {
- sources += [ "compiler/x64/instruction-selector-x64-unittest.cc" ]
+ sources += [
+ "assembler/turbo-assembler-x64-unittest.cc",
+ "compiler/x64/instruction-selector-x64-unittest.cc",
+ ]
} else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") {
- sources += [ "compiler/ppc/instruction-selector-ppc-unittest.cc" ]
+ sources += [
+ "assembler/turbo-assembler-ppc-unittest.cc",
+ "compiler/ppc/instruction-selector-ppc-unittest.cc",
+ ]
} else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") {
- sources += [ "compiler/s390/instruction-selector-s390-unittest.cc" ]
+ sources += [
+ "assembler/turbo-assembler-s390-unittest.cc",
+ "compiler/s390/instruction-selector-s390-unittest.cc",
+ ]
}
configs = [
diff --git a/deps/v8/test/unittests/api/remote-object-unittest.cc b/deps/v8/test/unittests/api/remote-object-unittest.cc
index 40754d50f4..5fa0646425 100644
--- a/deps/v8/test/unittests/api/remote-object-unittest.cc
+++ b/deps/v8/test/unittests/api/remote-object-unittest.cc
@@ -5,7 +5,7 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "include/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/handles.h"
#include "src/objects-inl.h"
#include "test/unittests/test-utils.h"
diff --git a/deps/v8/test/unittests/asmjs/asm-types-unittest.cc b/deps/v8/test/unittests/asmjs/asm-types-unittest.cc
index 7430ce6b35..f17528977c 100644
--- a/deps/v8/test/unittests/asmjs/asm-types-unittest.cc
+++ b/deps/v8/test/unittests/asmjs/asm-types-unittest.cc
@@ -63,12 +63,12 @@ class AsmTypeTest : public TestWithZone {
class FunctionTypeBuilder {
public:
- FunctionTypeBuilder(FunctionTypeBuilder&& b)
+ FunctionTypeBuilder(FunctionTypeBuilder&& b) V8_NOEXCEPT
: function_type_(b.function_type_) {
b.function_type_ = nullptr;
}
- FunctionTypeBuilder& operator=(FunctionTypeBuilder&& b) {
+ FunctionTypeBuilder& operator=(FunctionTypeBuilder&& b) V8_NOEXCEPT {
if (this != &b) {
function_type_ = b.function_type_;
b.function_type_ = nullptr;
diff --git a/deps/v8/test/unittests/assembler/turbo-assembler-arm-unittest.cc b/deps/v8/test/unittests/assembler/turbo-assembler-arm-unittest.cc
new file mode 100644
index 0000000000..056bd1c2c6
--- /dev/null
+++ b/deps/v8/test/unittests/assembler/turbo-assembler-arm-unittest.cc
@@ -0,0 +1,78 @@
+// 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.
+
+#include "src/arm/assembler-arm-inl.h"
+#include "src/macro-assembler.h"
+#include "src/simulator.h"
+#include "test/common/assembler-tester.h"
+#include "test/unittests/test-utils.h"
+#include "testing/gtest-support.h"
+
+namespace v8 {
+namespace internal {
+
+#define __ tasm.
+
+// If we are running on android and the output is not redirected (i.e. ends up
+// in the android log) then we cannot find the error message in the output. This
+// macro just returns the empty string in that case.
+#if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT)
+#define ERROR_MESSAGE(msg) ""
+#else
+#define ERROR_MESSAGE(msg) msg
+#endif
+
+// Test the x64 assembler by compiling some simple functions into
+// a buffer and executing them. These tests do not initialize the
+// V8 library, create a context, or use any V8 objects.
+
+class TurboAssemblerTest : public TestWithIsolate {};
+
+TEST_F(TurboAssemblerTest, TestHardAbort) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ __ Abort(AbortReason::kNoReason);
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void>::FromBuffer(isolate(), buffer);
+
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, ERROR_MESSAGE("abort: no reason"));
+}
+
+TEST_F(TurboAssemblerTest, TestCheck) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ // Fail if the first parameter is 17.
+ __ Move32BitImmediate(r1, Operand(17));
+ __ cmp(r0, r1); // 1st parameter is in {r0}.
+ __ Check(Condition::ne, AbortReason::kNoReason);
+ __ Ret();
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void, int>::FromBuffer(isolate(), buffer);
+
+ f.Call(0);
+ f.Call(18);
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(17); }, ERROR_MESSAGE("abort: no reason"));
+}
+
+#undef __
+#undef ERROR_MESSAGE
+
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/assembler/turbo-assembler-arm64-unittest.cc b/deps/v8/test/unittests/assembler/turbo-assembler-arm64-unittest.cc
new file mode 100644
index 0000000000..e354fb91d9
--- /dev/null
+++ b/deps/v8/test/unittests/assembler/turbo-assembler-arm64-unittest.cc
@@ -0,0 +1,78 @@
+// 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.
+
+#include "src/arm64/macro-assembler-arm64-inl.h"
+#include "src/macro-assembler.h"
+#include "src/simulator.h"
+#include "test/common/assembler-tester.h"
+#include "test/unittests/test-utils.h"
+#include "testing/gtest-support.h"
+
+namespace v8 {
+namespace internal {
+
+#define __ tasm.
+
+// If we are running on android and the output is not redirected (i.e. ends up
+// in the android log) then we cannot find the error message in the output. This
+// macro just returns the empty string in that case.
+#if defined(ANDROID) && !defined(V8_ANDROID_LOG_STDOUT)
+#define ERROR_MESSAGE(msg) ""
+#else
+#define ERROR_MESSAGE(msg) msg
+#endif
+
+// Test the x64 assembler by compiling some simple functions into
+// a buffer and executing them. These tests do not initialize the
+// V8 library, create a context, or use any V8 objects.
+
+class TurboAssemblerTest : public TestWithIsolate {};
+
+TEST_F(TurboAssemblerTest, TestHardAbort) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ __ Abort(AbortReason::kNoReason);
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void>::FromBuffer(isolate(), buffer);
+
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, ERROR_MESSAGE("abort: no reason"));
+}
+
+TEST_F(TurboAssemblerTest, TestCheck) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ // Fail if the first parameter is 17.
+ __ Mov(w1, Immediate(17));
+ __ Cmp(w0, w1); // 1st parameter is in {w0}.
+ __ Check(Condition::ne, AbortReason::kNoReason);
+ __ Ret();
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void, int>::FromBuffer(isolate(), buffer);
+
+ f.Call(0);
+ f.Call(18);
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(17); }, ERROR_MESSAGE("abort: no reason"));
+}
+
+#undef __
+#undef ERROR_MESSAGE
+
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/assembler/turbo-assembler-ia32-unittest.cc b/deps/v8/test/unittests/assembler/turbo-assembler-ia32-unittest.cc
new file mode 100644
index 0000000000..ba3634314f
--- /dev/null
+++ b/deps/v8/test/unittests/assembler/turbo-assembler-ia32-unittest.cc
@@ -0,0 +1,62 @@
+// 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.
+
+#include "src/macro-assembler.h"
+#include "src/simulator.h"
+#include "test/common/assembler-tester.h"
+#include "testing/gtest-support.h"
+
+namespace v8 {
+namespace internal {
+
+#define __ tasm.
+
+// Test the x64 assembler by compiling some simple functions into
+// a buffer and executing them. These tests do not initialize the
+// V8 library, create a context, or use any V8 objects.
+
+TEST(TurboAssemblerTest, TestHardAbort) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ __ Abort(AbortReason::kNoReason);
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ auto f = GeneratedCode<void>::FromBuffer(nullptr, buffer);
+
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, "abort: no reason");
+}
+
+TEST(TurboAssemblerTest, TestCheck) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ // Fail if the first parameter is 17.
+ __ mov(eax, 17);
+ __ cmp(eax, Operand(esp, 4)); // compare with 1st parameter.
+ __ Check(Condition::not_equal, AbortReason::kNoReason);
+ __ ret(0);
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ auto f = GeneratedCode<void, int>::FromBuffer(nullptr, buffer);
+
+ f.Call(0);
+ f.Call(18);
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(17); }, "abort: no reason");
+}
+
+#undef __
+
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/assembler/turbo-assembler-mips-unittest.cc b/deps/v8/test/unittests/assembler/turbo-assembler-mips-unittest.cc
new file mode 100644
index 0000000000..abba0ff30b
--- /dev/null
+++ b/deps/v8/test/unittests/assembler/turbo-assembler-mips-unittest.cc
@@ -0,0 +1,66 @@
+// 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.
+
+#include "src/macro-assembler.h"
+#include "src/mips/assembler-mips-inl.h"
+#include "src/simulator.h"
+#include "test/common/assembler-tester.h"
+#include "test/unittests/test-utils.h"
+#include "testing/gtest-support.h"
+
+namespace v8 {
+namespace internal {
+
+#define __ tasm.
+
+// Test the x64 assembler by compiling some simple functions into
+// a buffer and executing them. These tests do not initialize the
+// V8 library, create a context, or use any V8 objects.
+
+class TurboAssemblerTest : public TestWithIsolate {};
+
+TEST_F(TurboAssemblerTest, TestHardAbort) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ __ Abort(AbortReason::kNoReason);
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void>::FromBuffer(isolate(), buffer);
+
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, "abort: no reason");
+}
+
+TEST_F(TurboAssemblerTest, TestCheck) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ // Fail if the first parameter (in {a0}) is 17.
+ __ Check(Condition::ne, AbortReason::kNoReason, a0, Operand(17));
+ __ Ret();
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void, int>::FromBuffer(isolate(), buffer);
+
+ f.Call(0);
+ f.Call(18);
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(17); }, "abort: no reason");
+}
+
+#undef __
+
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/assembler/turbo-assembler-mips64-unittest.cc b/deps/v8/test/unittests/assembler/turbo-assembler-mips64-unittest.cc
new file mode 100644
index 0000000000..8d8bc0756c
--- /dev/null
+++ b/deps/v8/test/unittests/assembler/turbo-assembler-mips64-unittest.cc
@@ -0,0 +1,66 @@
+// 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.
+
+#include "src/macro-assembler.h"
+#include "src/mips64/assembler-mips64-inl.h"
+#include "src/simulator.h"
+#include "test/common/assembler-tester.h"
+#include "test/unittests/test-utils.h"
+#include "testing/gtest-support.h"
+
+namespace v8 {
+namespace internal {
+
+#define __ tasm.
+
+// Test the x64 assembler by compiling some simple functions into
+// a buffer and executing them. These tests do not initialize the
+// V8 library, create a context, or use any V8 objects.
+
+class TurboAssemblerTest : public TestWithIsolate {};
+
+TEST_F(TurboAssemblerTest, TestHardAbort) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ __ Abort(AbortReason::kNoReason);
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void>::FromBuffer(isolate(), buffer);
+
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, "abort: no reason");
+}
+
+TEST_F(TurboAssemblerTest, TestCheck) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ // Fail if the first parameter (in {a0}) is 17.
+ __ Check(Condition::ne, AbortReason::kNoReason, a0, Operand(17));
+ __ Ret();
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void, int>::FromBuffer(isolate(), buffer);
+
+ f.Call(0);
+ f.Call(18);
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(17); }, "abort: no reason");
+}
+
+#undef __
+
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/assembler/turbo-assembler-ppc-unittest.cc b/deps/v8/test/unittests/assembler/turbo-assembler-ppc-unittest.cc
new file mode 100644
index 0000000000..8054eb1da5
--- /dev/null
+++ b/deps/v8/test/unittests/assembler/turbo-assembler-ppc-unittest.cc
@@ -0,0 +1,68 @@
+// 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.
+
+#include "src/macro-assembler.h"
+#include "src/ppc/assembler-ppc-inl.h"
+#include "src/simulator.h"
+#include "test/common/assembler-tester.h"
+#include "test/unittests/test-utils.h"
+#include "testing/gtest-support.h"
+
+namespace v8 {
+namespace internal {
+
+#define __ tasm.
+
+// Test the ppc assembler by compiling some simple functions into
+// a buffer and executing them. These tests do not initialize the
+// V8 library, create a context, or use any V8 objects.
+
+class TurboAssemblerTest : public TestWithIsolate {};
+
+TEST_F(TurboAssemblerTest, TestHardAbort) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ __ Abort(AbortReason::kNoReason);
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void>::FromBuffer(isolate(), buffer);
+
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, "abort: no reason");
+}
+
+TEST_F(TurboAssemblerTest, TestCheck) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ // Fail if the first parameter is 17.
+ __ mov(r4, Operand(17));
+ __ cmp(r3, r4); // 1st parameter is in {r3}.
+ __ Check(Condition::ne, AbortReason::kNoReason);
+ __ Ret();
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void, int>::FromBuffer(isolate(), buffer);
+
+ f.Call(0);
+ f.Call(18);
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(17); }, "abort: no reason");
+}
+
+#undef __
+
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/assembler/turbo-assembler-s390-unittest.cc b/deps/v8/test/unittests/assembler/turbo-assembler-s390-unittest.cc
new file mode 100644
index 0000000000..7d45ec907f
--- /dev/null
+++ b/deps/v8/test/unittests/assembler/turbo-assembler-s390-unittest.cc
@@ -0,0 +1,68 @@
+// 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.
+
+#include "src/macro-assembler.h"
+#include "src/s390/assembler-s390-inl.h"
+#include "src/simulator.h"
+#include "test/common/assembler-tester.h"
+#include "test/unittests/test-utils.h"
+#include "testing/gtest-support.h"
+
+namespace v8 {
+namespace internal {
+
+#define __ tasm.
+
+// Test the s390 assembler by compiling some simple functions into
+// a buffer and executing them. These tests do not initialize the
+// V8 library, create a context, or use any V8 objects.
+
+class TurboAssemblerTest : public TestWithIsolate {};
+
+TEST_F(TurboAssemblerTest, TestHardAbort) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ __ Abort(AbortReason::kNoReason);
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void>::FromBuffer(isolate(), buffer);
+
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, "abort: no reason");
+}
+
+TEST_F(TurboAssemblerTest, TestCheck) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ // Fail if the first parameter is 17.
+ __ lgfi(r3, Operand(17));
+ __ CmpP(r2, r3); // 1st parameter is in {r2}.
+ __ Check(Condition::ne, AbortReason::kNoReason);
+ __ Ret();
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ // We need an isolate here to execute in the simulator.
+ auto f = GeneratedCode<void, int>::FromBuffer(isolate(), buffer);
+
+ f.Call(0);
+ f.Call(18);
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(17); }, "abort: no reason");
+}
+
+#undef __
+
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/assembler/turbo-assembler-x64-unittest.cc b/deps/v8/test/unittests/assembler/turbo-assembler-x64-unittest.cc
new file mode 100644
index 0000000000..060060c762
--- /dev/null
+++ b/deps/v8/test/unittests/assembler/turbo-assembler-x64-unittest.cc
@@ -0,0 +1,62 @@
+// 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.
+
+#include "src/macro-assembler.h"
+#include "src/simulator.h"
+#include "test/common/assembler-tester.h"
+#include "testing/gtest-support.h"
+
+namespace v8 {
+namespace internal {
+
+#define __ tasm.
+
+// Test the x64 assembler by compiling some simple functions into
+// a buffer and executing them. These tests do not initialize the
+// V8 library, create a context, or use any V8 objects.
+
+TEST(TurboAssemblerTest, TestHardAbort) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ __ Abort(AbortReason::kNoReason);
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ auto f = GeneratedCode<void>::FromBuffer(nullptr, buffer);
+
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(); }, "abort: no reason");
+}
+
+TEST(TurboAssemblerTest, TestCheck) {
+ size_t allocated;
+ byte* buffer = AllocateAssemblerBuffer(&allocated);
+ TurboAssembler tasm(nullptr, AssemblerOptions{}, buffer,
+ static_cast<int>(allocated), CodeObjectRequired::kNo);
+ __ set_abort_hard(true);
+
+ // Fail if the first parameter is 17.
+ __ movl(rax, Immediate(17));
+ __ cmpl(rax, arg_reg_1);
+ __ Check(Condition::not_equal, AbortReason::kNoReason);
+ __ ret(0);
+
+ CodeDesc desc;
+ tasm.GetCode(nullptr, &desc);
+ MakeAssemblerBufferExecutable(buffer, allocated);
+ auto f = GeneratedCode<void, int>::FromBuffer(nullptr, buffer);
+
+ f.Call(0);
+ f.Call(18);
+ ASSERT_DEATH_IF_SUPPORTED({ f.Call(17); }, "abort: no reason");
+}
+
+#undef __
+
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/base/functional-unittest.cc b/deps/v8/test/unittests/base/functional-unittest.cc
index 10f9f32c7d..b9295d49a0 100644
--- a/deps/v8/test/unittests/base/functional-unittest.cc
+++ b/deps/v8/test/unittests/base/functional-unittest.cc
@@ -74,7 +74,9 @@ TYPED_TEST(FunctionalTest, EqualToImpliesSameHashCode) {
this->rng()->NextBytes(values, sizeof(values));
TRACED_FOREACH(TypeParam, v1, values) {
TRACED_FOREACH(TypeParam, v2, values) {
- if (e(v1, v2)) EXPECT_EQ(h(v1), h(v2));
+ if (e(v1, v2)) {
+ EXPECT_EQ(h(v1), h(v2));
+ }
}
}
}
@@ -143,7 +145,9 @@ TYPED_TEST(FunctionalTest, BitEqualToImpliesSameBitHash) {
this->rng()->NextBytes(&values, sizeof(values));
TRACED_FOREACH(TypeParam, v1, values) {
TRACED_FOREACH(TypeParam, v2, values) {
- if (e(v1, v2)) EXPECT_EQ(h(v1), h(v2));
+ if (e(v1, v2)) {
+ EXPECT_EQ(h(v1), h(v2));
+ }
}
}
}
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 c523906027..45121aedb3 100644
--- a/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc
+++ b/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-unittest.cc
@@ -7,7 +7,7 @@
#include <sstream>
#include "include/v8-platform.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/ast/ast-value-factory.h"
#include "src/base/platform/semaphore.h"
#include "src/base/template-utils.h"
diff --git a/deps/v8/test/unittests/compiler-dispatcher/optimizing-compile-dispatcher-unittest.cc b/deps/v8/test/unittests/compiler-dispatcher/optimizing-compile-dispatcher-unittest.cc
index 95052c9b75..b796e457d4 100644
--- a/deps/v8/test/unittests/compiler-dispatcher/optimizing-compile-dispatcher-unittest.cc
+++ b/deps/v8/test/unittests/compiler-dispatcher/optimizing-compile-dispatcher-unittest.cc
@@ -4,6 +4,7 @@
#include "src/compiler-dispatcher/optimizing-compile-dispatcher.h"
+#include "src/api-inl.h"
#include "src/base/atomic-utils.h"
#include "src/base/platform/semaphore.h"
#include "src/compiler.h"
diff --git a/deps/v8/test/unittests/compiler-dispatcher/unoptimized-compile-job-unittest.cc b/deps/v8/test/unittests/compiler-dispatcher/unoptimized-compile-job-unittest.cc
index f7fb335ac6..5a0e89326b 100644
--- a/deps/v8/test/unittests/compiler-dispatcher/unoptimized-compile-job-unittest.cc
+++ b/deps/v8/test/unittests/compiler-dispatcher/unoptimized-compile-job-unittest.cc
@@ -5,7 +5,7 @@
#include <memory>
#include "include/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/ast/ast.h"
#include "src/ast/scopes.h"
#include "src/base/platform/semaphore.h"
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 70e04043c4..011cc67c81 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
@@ -1183,12 +1183,12 @@ TEST_P(InstructionSelectorShiftTest, Word32EqualToZeroWithImmediate) {
}
}
-
-TEST_P(InstructionSelectorShiftTest, Word32NotWithParameters) {
+TEST_P(InstructionSelectorShiftTest, Word32BitwiseNotWithParameters) {
const Shift shift = GetParam();
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
- m.Return(m.Word32Not((m.*shift.constructor)(m.Parameter(0), m.Parameter(1))));
+ m.Return(m.Word32BitwiseNot(
+ (m.*shift.constructor)(m.Parameter(0), m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArmMvn, s[0]->arch_opcode());
@@ -1197,12 +1197,11 @@ TEST_P(InstructionSelectorShiftTest, Word32NotWithParameters) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-TEST_P(InstructionSelectorShiftTest, Word32NotWithImmediate) {
+TEST_P(InstructionSelectorShiftTest, Word32BitwiseNotWithImmediate) {
const Shift shift = GetParam();
TRACED_FORRANGE(int32_t, imm, shift.i_low, shift.i_high) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
- m.Return(m.Word32Not(
+ m.Return(m.Word32BitwiseNot(
(m.*shift.constructor)(m.Parameter(0), m.Int32Constant(imm))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
@@ -1214,13 +1213,14 @@ TEST_P(InstructionSelectorShiftTest, Word32NotWithImmediate) {
}
}
-
-TEST_P(InstructionSelectorShiftTest, Word32AndWithWord32NotWithParameters) {
+TEST_P(InstructionSelectorShiftTest,
+ Word32AndWithWord32BitwiseNotWithParameters) {
const Shift shift = GetParam();
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32(), MachineType::Int32());
- m.Return(m.Word32And(m.Parameter(0), m.Word32Not((m.*shift.constructor)(
- m.Parameter(1), m.Parameter(2)))));
+ m.Return(
+ m.Word32And(m.Parameter(0), m.Word32BitwiseNot((m.*shift.constructor)(
+ m.Parameter(1), m.Parameter(2)))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArmBic, s[0]->arch_opcode());
@@ -1229,14 +1229,14 @@ TEST_P(InstructionSelectorShiftTest, Word32AndWithWord32NotWithParameters) {
EXPECT_EQ(1U, s[0]->OutputCount());
}
-
-TEST_P(InstructionSelectorShiftTest, Word32AndWithWord32NotWithImmediate) {
+TEST_P(InstructionSelectorShiftTest,
+ Word32AndWithWord32BitwiseNotWithImmediate) {
const Shift shift = GetParam();
TRACED_FORRANGE(int32_t, imm, shift.i_low, shift.i_high) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
m.Return(m.Word32And(m.Parameter(0),
- m.Word32Not((m.*shift.constructor)(
+ m.Word32BitwiseNot((m.*shift.constructor)(
m.Parameter(1), m.Int32Constant(imm)))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
@@ -2971,12 +2971,11 @@ TEST_F(InstructionSelectorTest, Word32ShrWithWord32AndWithImmediateForARMv7) {
}
}
-
-TEST_F(InstructionSelectorTest, Word32AndWithWord32Not) {
+TEST_F(InstructionSelectorTest, Word32AndWithWord32BitwiseNot) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
- m.Return(m.Word32And(m.Parameter(0), m.Word32Not(m.Parameter(1))));
+ m.Return(m.Word32And(m.Parameter(0), m.Word32BitwiseNot(m.Parameter(1))));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArmBic, s[0]->arch_opcode());
@@ -2987,7 +2986,7 @@ TEST_F(InstructionSelectorTest, Word32AndWithWord32Not) {
{
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(),
MachineType::Int32());
- m.Return(m.Word32And(m.Word32Not(m.Parameter(0)), m.Parameter(1)));
+ m.Return(m.Word32And(m.Word32BitwiseNot(m.Parameter(0)), m.Parameter(1)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArmBic, s[0]->arch_opcode());
@@ -3076,10 +3075,9 @@ TEST_F(InstructionSelectorTest, Word32EqualWithZero) {
}
}
-
-TEST_F(InstructionSelectorTest, Word32NotWithParameter) {
+TEST_F(InstructionSelectorTest, Word32BitwiseNotWithParameter) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
- m.Return(m.Word32Not(m.Parameter(0)));
+ m.Return(m.Word32BitwiseNot(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArmMvn, s[0]->arch_opcode());
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 be876c7cb3..aa54abe320 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
@@ -1327,6 +1327,70 @@ TEST_F(InstructionSelectorTest, Word64AndBranchWithOneBitMaskOnLeft) {
}
}
+TEST_F(InstructionSelectorTest, TestAndBranch64EqualWhenCanCoverFalse) {
+ TRACED_FORRANGE(int, bit, 0, 63) {
+ uint64_t mask = uint64_t{1} << bit;
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
+ RawMachineLabel a, b, c;
+ Node* n = m.Word64And(m.Parameter(0), m.Int64Constant(mask));
+ m.Branch(m.Word64Equal(n, m.Int64Constant(0)), &a, &b);
+ m.Bind(&a);
+ m.Branch(m.Word64Equal(n, m.Int64Constant(3)), &b, &c);
+ m.Bind(&c);
+ m.Return(m.Int64Constant(1));
+ m.Bind(&b);
+ m.Return(m.Int64Constant(0));
+
+ Stream s = m.Build();
+ ASSERT_EQ(3U, s.size());
+ EXPECT_EQ(kArm64And, s[0]->arch_opcode());
+ EXPECT_EQ(kEqual, s[0]->flags_condition());
+ EXPECT_EQ(kArm64TestAndBranch, s[1]->arch_opcode());
+ EXPECT_EQ(kEqual, s[1]->flags_condition());
+ EXPECT_EQ(kArm64Cmp, s[2]->arch_opcode());
+ EXPECT_EQ(kEqual, s[2]->flags_condition());
+ EXPECT_EQ(2U, s[0]->InputCount());
+ }
+}
+
+TEST_F(InstructionSelectorTest, TestAndBranch64AndWhenCanCoverFalse) {
+ TRACED_FORRANGE(int, bit, 0, 63) {
+ uint64_t mask = uint64_t{1} << bit;
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
+ RawMachineLabel a, b, c;
+ m.Branch(m.Word64And(m.Parameter(0), m.Int64Constant(mask)), &a, &b);
+ m.Bind(&a);
+ m.Return(m.Int64Constant(1));
+ m.Bind(&b);
+ m.Return(m.Int64Constant(0));
+
+ Stream s = m.Build();
+ ASSERT_EQ(1U, s.size());
+ EXPECT_EQ(kArm64TestAndBranch, s[0]->arch_opcode());
+ EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
+ EXPECT_EQ(4U, s[0]->InputCount());
+ }
+}
+
+TEST_F(InstructionSelectorTest, TestAndBranch32AndWhenCanCoverFalse) {
+ TRACED_FORRANGE(int, bit, 0, 31) {
+ uint32_t mask = uint32_t{1} << bit;
+ StreamBuilder m(this, MachineType::Int64(), MachineType::Int64());
+ RawMachineLabel a, b, c;
+ m.Branch(m.Word32And(m.Parameter(0), m.Int32Constant(mask)), &a, &b);
+ m.Bind(&a);
+ m.Return(m.Int32Constant(1));
+ m.Bind(&b);
+ m.Return(m.Int32Constant(0));
+
+ Stream s = m.Build();
+ ASSERT_EQ(1U, s.size());
+ EXPECT_EQ(kArm64TestAndBranch32, s[0]->arch_opcode());
+ EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind());
+ EXPECT_EQ(4U, s[0]->InputCount());
+ }
+}
+
TEST_F(InstructionSelectorTest, Word32EqualZeroAndBranchWithOneBitMask) {
TRACED_FORRANGE(int, bit, 0, 31) {
uint32_t mask = 1 << bit;
@@ -3746,8 +3810,8 @@ TEST_P(InstructionSelectorLogicalWithNotRHSTest, Parameter) {
{
StreamBuilder m(this, type, type, type);
if (type == MachineType::Int32()) {
- m.Return(
- (m.*inst.constructor)(m.Parameter(0), m.Word32Not(m.Parameter(1))));
+ m.Return((m.*inst.constructor)(m.Parameter(0),
+ m.Word32BitwiseNot(m.Parameter(1))));
} else {
ASSERT_EQ(MachineType::Int64(), type);
m.Return(
@@ -3762,8 +3826,8 @@ TEST_P(InstructionSelectorLogicalWithNotRHSTest, Parameter) {
{
StreamBuilder m(this, type, type, type);
if (type == MachineType::Int32()) {
- m.Return(
- (m.*inst.constructor)(m.Word32Not(m.Parameter(0)), m.Parameter(1)));
+ m.Return((m.*inst.constructor)(m.Word32BitwiseNot(m.Parameter(0)),
+ m.Parameter(1)));
} else {
ASSERT_EQ(MachineType::Int64(), type);
m.Return(
@@ -3782,10 +3846,9 @@ INSTANTIATE_TEST_CASE_P(InstructionSelectorTest,
InstructionSelectorLogicalWithNotRHSTest,
::testing::ValuesIn(kLogicalWithNotRHSs));
-
-TEST_F(InstructionSelectorTest, Word32NotWithParameter) {
+TEST_F(InstructionSelectorTest, Word32BitwiseNotWithParameter) {
StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
- m.Return(m.Word32Not(m.Parameter(0)));
+ m.Return(m.Word32BitwiseNot(m.Parameter(0)));
Stream s = m.Build();
ASSERT_EQ(1U, s.size());
EXPECT_EQ(kArm64Not32, s[0]->arch_opcode());
diff --git a/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc b/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc
index 086fa2ec7d..cb5b5fd806 100644
--- a/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc
+++ b/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc
@@ -29,7 +29,7 @@ class CommonOperatorReducerTest : public GraphTest {
Reduction Reduce(
AdvancedReducer::Editor* editor, Node* node,
MachineOperatorBuilder::Flags flags = MachineOperatorBuilder::kNoFlags) {
- JSHeapBroker broker(isolate());
+ JSHeapBroker broker(isolate(), zone());
MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(),
flags);
CommonOperatorReducer reducer(editor, graph(), &broker, common(), &machine,
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 6780bf8500..464ee3a971 100644
--- a/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc
+++ b/deps/v8/test/unittests/compiler/constant-folding-reducer-unittest.cc
@@ -63,7 +63,7 @@ class ConstantFoldingReducerTest : public TypedGraphTest {
public:
ConstantFoldingReducerTest()
: TypedGraphTest(3),
- js_heap_broker_(isolate()),
+ js_heap_broker_(isolate(), zone()),
simplified_(zone()),
deps_(isolate(), zone()) {}
~ConstantFoldingReducerTest() override {}
@@ -81,7 +81,7 @@ class ConstantFoldingReducerTest : public TypedGraphTest {
}
SimplifiedOperatorBuilder* simplified() { return &simplified_; }
- const JSHeapBroker* js_heap_broker() const { return &js_heap_broker_; }
+ JSHeapBroker* js_heap_broker() { return &js_heap_broker_; }
private:
JSHeapBroker js_heap_broker_;
diff --git a/deps/v8/test/unittests/compiler/graph-unittest.cc b/deps/v8/test/unittests/compiler/graph-unittest.cc
index a731a8f1cb..af2c382f5b 100644
--- a/deps/v8/test/unittests/compiler/graph-unittest.cc
+++ b/deps/v8/test/unittests/compiler/graph-unittest.cc
@@ -16,9 +16,10 @@ namespace compiler {
GraphTest::GraphTest(int num_parameters)
: TestWithNativeContext(),
TestWithIsolateAndZone(),
+ canonical_(isolate()),
common_(zone()),
graph_(zone()),
- js_heap_broker_(isolate()),
+ js_heap_broker_(isolate(), zone()),
source_positions_(&graph_),
node_origins_(&graph_) {
graph()->SetStart(graph()->NewNode(common()->Start(num_parameters)));
diff --git a/deps/v8/test/unittests/compiler/graph-unittest.h b/deps/v8/test/unittests/compiler/graph-unittest.h
index 1a9c83bb8a..d9b9934770 100644
--- a/deps/v8/test/unittests/compiler/graph-unittest.h
+++ b/deps/v8/test/unittests/compiler/graph-unittest.h
@@ -10,6 +10,7 @@
#include "src/compiler/graph.h"
#include "src/compiler/node-origin-table.h"
#include "src/compiler/typer.h"
+#include "src/handles.h"
#include "test/unittests/test-utils.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -17,8 +18,6 @@ namespace v8 {
namespace internal {
// Forward declarations.
-template <class T>
-class Handle;
class HeapObject;
namespace compiler {
@@ -62,9 +61,10 @@ class GraphTest : public virtual TestWithNativeContext,
Graph* graph() { return &graph_; }
SourcePositionTable* source_positions() { return &source_positions_; }
NodeOriginTable* node_origins() { return &node_origins_; }
- const JSHeapBroker* js_heap_broker() { return &js_heap_broker_; }
+ JSHeapBroker* js_heap_broker() { return &js_heap_broker_; }
private:
+ CanonicalHandleScope canonical_;
CommonOperatorBuilder common_;
Graph graph_;
JSHeapBroker js_heap_broker_;
diff --git a/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc b/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc
index 5897187ae4..4df81d5d59 100644
--- a/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc
+++ b/deps/v8/test/unittests/compiler/int64-lowering-unittest.cc
@@ -882,7 +882,7 @@ TEST_F(Int64LoweringTest, I64PhiWord32) {
}
TEST_F(Int64LoweringTest, I64ReverseBytes) {
- LowerGraph(graph()->NewNode(machine()->Word64ReverseBytes().placeholder(),
+ LowerGraph(graph()->NewNode(machine()->Word64ReverseBytes(),
Int64Constant(value(0))),
MachineRepresentation::kWord64);
EXPECT_THAT(
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 1f5e666eb2..53e3b48762 100644
--- a/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc
+++ b/deps/v8/test/unittests/compiler/js-call-reducer-unittest.cc
@@ -24,7 +24,7 @@ class JSCallReducerTest : public TypedGraphTest {
: TypedGraphTest(3),
javascript_(zone()),
deps_(isolate(), zone()),
- js_heap_broker(isolate()) {}
+ js_heap_broker(isolate(), zone()) {}
~JSCallReducerTest() override {}
protected:
diff --git a/deps/v8/test/unittests/compiler/load-elimination-unittest.cc b/deps/v8/test/unittests/compiler/load-elimination-unittest.cc
index 8cf5bd3236..5c49468991 100644
--- a/deps/v8/test/unittests/compiler/load-elimination-unittest.cc
+++ b/deps/v8/test/unittests/compiler/load-elimination-unittest.cc
@@ -410,9 +410,10 @@ TEST_F(LoadEliminationTest, LoadFieldWithTypeMismatch) {
Node* load = graph()->NewNode(simplified()->LoadField(access), object, effect,
control);
+ EXPECT_CALL(editor, ReplaceWithValue(load, IsTypeGuard(value, _), _, _));
Reduction r = load_elimination.Reduce(load);
ASSERT_TRUE(r.Changed());
- EXPECT_EQ(load, r.replacement());
+ EXPECT_THAT(r.replacement(), IsTypeGuard(value, _));
}
TEST_F(LoadEliminationTest, LoadElementWithTypeMismatch) {
diff --git a/deps/v8/test/unittests/compiler/mips/OWNERS b/deps/v8/test/unittests/compiler/mips/OWNERS
index 4ce9d7f91d..8bbcab4c2d 100644
--- a/deps/v8/test/unittests/compiler/mips/OWNERS
+++ b/deps/v8/test/unittests/compiler/mips/OWNERS
@@ -1,3 +1,2 @@
-ivica.bogosavljevic@mips.com
-Miran.Karic@mips.com
-sreten.kovacevic@mips.com \ No newline at end of file
+ibogosavljevic@wavecomp.com
+skovacevic@wavecomp.com \ No newline at end of file
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 34faec9690..15f5de7b2f 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
@@ -411,33 +411,35 @@ TEST_F(InstructionSelectorTest, Word32ShlWithWord32And) {
}
TEST_F(InstructionSelectorTest, Word32SarWithWord32Shl) {
- {
- StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
- Node* const p0 = m.Parameter(0);
- Node* const r =
- m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(24)), m.Int32Constant(24));
- m.Return(r);
- Stream s = m.Build();
- ASSERT_EQ(1U, s.size());
- EXPECT_EQ(kMipsSeb, s[0]->arch_opcode());
- ASSERT_EQ(1U, s[0]->InputCount());
- EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
- ASSERT_EQ(1U, s[0]->OutputCount());
- EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output()));
- }
- {
- StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
- Node* const p0 = m.Parameter(0);
- Node* const r =
- m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(16)), m.Int32Constant(16));
- m.Return(r);
- Stream s = m.Build();
- ASSERT_EQ(1U, s.size());
- EXPECT_EQ(kMipsSeh, s[0]->arch_opcode());
- ASSERT_EQ(1U, s[0]->InputCount());
- EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
- ASSERT_EQ(1U, s[0]->OutputCount());
- EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output()));
+ if (IsMipsArchVariant(kMips32r2) || IsMipsArchVariant(kMips32r6)) {
+ {
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
+ Node* const p0 = m.Parameter(0);
+ Node* const r = m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(24)),
+ m.Int32Constant(24));
+ m.Return(r);
+ Stream s = m.Build();
+ ASSERT_EQ(1U, s.size());
+ EXPECT_EQ(kMipsSeb, s[0]->arch_opcode());
+ ASSERT_EQ(1U, s[0]->InputCount());
+ EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
+ ASSERT_EQ(1U, s[0]->OutputCount());
+ EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output()));
+ }
+ {
+ StreamBuilder m(this, MachineType::Int32(), MachineType::Int32());
+ Node* const p0 = m.Parameter(0);
+ Node* const r = m.Word32Sar(m.Word32Shl(p0, m.Int32Constant(16)),
+ m.Int32Constant(16));
+ m.Return(r);
+ Stream s = m.Build();
+ ASSERT_EQ(1U, s.size());
+ EXPECT_EQ(kMipsSeh, s[0]->arch_opcode());
+ ASSERT_EQ(1U, s[0]->InputCount());
+ EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0)));
+ ASSERT_EQ(1U, s[0]->OutputCount());
+ EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output()));
+ }
}
}
diff --git a/deps/v8/test/unittests/compiler/mips64/OWNERS b/deps/v8/test/unittests/compiler/mips64/OWNERS
index 4ce9d7f91d..8bbcab4c2d 100644
--- a/deps/v8/test/unittests/compiler/mips64/OWNERS
+++ b/deps/v8/test/unittests/compiler/mips64/OWNERS
@@ -1,3 +1,2 @@
-ivica.bogosavljevic@mips.com
-Miran.Karic@mips.com
-sreten.kovacevic@mips.com \ No newline at end of file
+ibogosavljevic@wavecomp.com
+skovacevic@wavecomp.com \ No newline at end of file
diff --git a/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc b/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc
index f0e463265e..7913d6398c 100644
--- a/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc
+++ b/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc
@@ -29,7 +29,7 @@ class SimplifiedOperatorReducerTest : public GraphTest {
protected:
Reduction Reduce(Node* node) {
- JSHeapBroker js_heap_broker(isolate());
+ JSHeapBroker js_heap_broker(isolate(), zone());
MachineOperatorBuilder machine(zone());
JSOperatorBuilder javascript(zone());
JSGraph jsgraph(isolate(), graph(), common(), &javascript, simplified(),
diff --git a/deps/v8/test/unittests/compiler/typer-unittest.cc b/deps/v8/test/unittests/compiler/typer-unittest.cc
index d1283a8ad1..53459c314a 100644
--- a/deps/v8/test/unittests/compiler/typer-unittest.cc
+++ b/deps/v8/test/unittests/compiler/typer-unittest.cc
@@ -22,7 +22,7 @@ class TyperTest : public TypedGraphTest {
public:
TyperTest()
: TypedGraphTest(3),
- js_heap_broker_(isolate()),
+ js_heap_broker_(isolate(), zone()),
operation_typer_(isolate(), &js_heap_broker_, zone()),
types_(zone(), isolate(), random_number_generator()),
javascript_(zone()),
diff --git a/deps/v8/test/unittests/counters-unittest.cc b/deps/v8/test/unittests/counters-unittest.cc
index d4772934d6..d137d68ee9 100644
--- a/deps/v8/test/unittests/counters-unittest.cc
+++ b/deps/v8/test/unittests/counters-unittest.cc
@@ -4,6 +4,7 @@
#include <vector>
+#include "src/api-inl.h"
#include "src/base/atomic-utils.h"
#include "src/base/platform/time.h"
#include "src/counters-inl.h"
@@ -570,7 +571,7 @@ TEST_F(RuntimeCallStatsTest, BasicJavaScript) {
{
NativeTimeScope native_timer_scope;
- RunJS("function f() { return 1; }");
+ RunJS("function f() { return 1; };");
}
EXPECT_EQ(1, counter->count());
int64_t time = counter->time().InMicroseconds();
@@ -578,7 +579,7 @@ TEST_F(RuntimeCallStatsTest, BasicJavaScript) {
{
NativeTimeScope native_timer_scope;
- RunJS("f()");
+ RunJS("f();");
}
EXPECT_EQ(2, counter->count());
EXPECT_LE(time, counter->time().InMicroseconds());
@@ -587,38 +588,43 @@ TEST_F(RuntimeCallStatsTest, BasicJavaScript) {
TEST_F(RuntimeCallStatsTest, FunctionLengthGetter) {
RuntimeCallCounter* getter_counter =
stats()->GetCounter(RuntimeCallCounterId::kFunctionLengthGetter);
- RuntimeCallCounter* js_counter =
- stats()->GetCounter(RuntimeCallCounterId::kJS_Execution);
EXPECT_EQ(0, getter_counter->count());
- EXPECT_EQ(0, js_counter->count());
+ EXPECT_EQ(0, js_counter()->count());
EXPECT_EQ(0, getter_counter->time().InMicroseconds());
- EXPECT_EQ(0, js_counter->time().InMicroseconds());
+ EXPECT_EQ(0, js_counter()->time().InMicroseconds());
{
NativeTimeScope native_timer_scope;
- RunJS("function f(array) { return array.length; }");
+ RunJS("function f(array) { return array.length; };");
}
EXPECT_EQ(0, getter_counter->count());
- EXPECT_EQ(1, js_counter->count());
+ EXPECT_EQ(1, js_counter()->count());
EXPECT_EQ(0, getter_counter->time().InMicroseconds());
- int64_t js_time = js_counter->time().InMicroseconds();
+ int64_t js_time = js_counter()->time().InMicroseconds();
EXPECT_LT(0, js_time);
{
NativeTimeScope native_timer_scope;
- RunJS("f.length");
+ RunJS("f.length;");
}
EXPECT_EQ(1, getter_counter->count());
- EXPECT_EQ(2, js_counter->count());
+ EXPECT_EQ(2, js_counter()->count());
EXPECT_LE(0, getter_counter->time().InMicroseconds());
- EXPECT_LE(js_time, js_counter->time().InMicroseconds());
+ EXPECT_LE(js_time, js_counter()->time().InMicroseconds());
{
NativeTimeScope native_timer_scope;
- RunJS("for (let i = 0; i < 50; i++) { f.length }");
+ RunJS("for (let i = 0; i < 50; i++) { f.length };");
}
EXPECT_EQ(51, getter_counter->count());
- EXPECT_EQ(3, js_counter->count());
+ EXPECT_EQ(3, js_counter()->count());
+
+ {
+ NativeTimeScope native_timer_scope;
+ RunJS("for (let i = 0; i < 1000; i++) { f.length; };");
+ }
+ EXPECT_EQ(1051, getter_counter->count());
+ EXPECT_EQ(4, js_counter()->count());
}
namespace {
@@ -631,7 +637,10 @@ static void CustomCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
}
} // namespace
-TEST_F(RuntimeCallStatsTest, CustomCallback) {
+TEST_F(RuntimeCallStatsTest, CallbackFunction) {
+ RuntimeCallCounter* callback_counter =
+ stats()->GetCounter(RuntimeCallCounterId::kFunctionCallback);
+
current_test = this;
// Set up a function template with a custom callback.
v8::Isolate* isolate = v8_isolate();
@@ -645,9 +654,9 @@ TEST_F(RuntimeCallStatsTest, CustomCallback) {
object_template->NewInstance(v8_context()).ToLocalChecked();
SetGlobalProperty("custom_object", object);
- // TODO(cbruni): Check api accessor timer (one above the custom callback).
EXPECT_EQ(0, js_counter()->count());
EXPECT_EQ(0, counter()->count());
+ EXPECT_EQ(0, callback_counter->count());
EXPECT_EQ(0, counter2()->count());
{
RuntimeCallTimerScope scope(stats(), counter_id());
@@ -655,29 +664,105 @@ TEST_F(RuntimeCallStatsTest, CustomCallback) {
RunJS("custom_object.callback();");
}
EXPECT_EQ(1, js_counter()->count());
+ EXPECT_EQ(1, counter()->count());
+ EXPECT_EQ(1, callback_counter->count());
+ EXPECT_EQ(1, counter2()->count());
// Given that no native timers are used, only the two scopes explitly
// mentioned above will track the time.
EXPECT_EQ(0, js_counter()->time().InMicroseconds());
- EXPECT_EQ(1, counter()->count());
+ EXPECT_EQ(0, callback_counter->time().InMicroseconds());
EXPECT_EQ(100, counter()->time().InMicroseconds());
- EXPECT_EQ(1, counter2()->count());
EXPECT_EQ(kCustomCallbackTime, counter2()->time().InMicroseconds());
- RunJS("for (let i = 0; i < 9; i++) { custom_object.callback() };");
+ RunJS("for (let i = 0; i < 9; i++) { custom_object.callback(); };");
EXPECT_EQ(2, js_counter()->count());
- EXPECT_EQ(0, js_counter()->time().InMicroseconds());
EXPECT_EQ(1, counter()->count());
- EXPECT_EQ(100, counter()->time().InMicroseconds());
+ EXPECT_EQ(10, callback_counter->count());
EXPECT_EQ(10, counter2()->count());
+ EXPECT_EQ(0, js_counter()->time().InMicroseconds());
+ EXPECT_EQ(0, callback_counter->time().InMicroseconds());
+ EXPECT_EQ(100, counter()->time().InMicroseconds());
EXPECT_EQ(kCustomCallbackTime * 10, counter2()->time().InMicroseconds());
- RunJS("for (let i = 0; i < 4000; i++) { custom_object.callback() };");
+ RunJS("for (let i = 0; i < 4000; i++) { custom_object.callback(); };");
EXPECT_EQ(3, js_counter()->count());
+ EXPECT_EQ(1, counter()->count());
+ EXPECT_EQ(4010, callback_counter->count());
+ EXPECT_EQ(4010, counter2()->count());
EXPECT_EQ(0, js_counter()->time().InMicroseconds());
+ EXPECT_EQ(0, callback_counter->time().InMicroseconds());
+ EXPECT_EQ(100, counter()->time().InMicroseconds());
+ EXPECT_EQ(kCustomCallbackTime * 4010, counter2()->time().InMicroseconds());
+}
+
+TEST_F(RuntimeCallStatsTest, ApiGetter) {
+ RuntimeCallCounter* callback_counter =
+ stats()->GetCounter(RuntimeCallCounterId::kFunctionCallback);
+ current_test = this;
+ // Set up a function template with an api accessor.
+ v8::Isolate* isolate = v8_isolate();
+ v8::HandleScope scope(isolate);
+
+ v8::Local<v8::ObjectTemplate> object_template =
+ v8::ObjectTemplate::New(isolate);
+ object_template->SetAccessorProperty(
+ NewString("apiGetter"),
+ v8::FunctionTemplate::New(isolate, CustomCallback));
+ v8::Local<v8::Object> object =
+ object_template->NewInstance(v8_context()).ToLocalChecked();
+ SetGlobalProperty("custom_object", object);
+
+ // TODO(cbruni): Check api accessor timer (one above the custom callback).
+ EXPECT_EQ(0, js_counter()->count());
+ EXPECT_EQ(0, counter()->count());
+ EXPECT_EQ(0, callback_counter->count());
+ EXPECT_EQ(0, counter2()->count());
+
+ {
+ RuntimeCallTimerScope scope(stats(), counter_id());
+ Sleep(100);
+ RunJS("custom_object.apiGetter;");
+ }
+ PrintStats();
+
+ EXPECT_EQ(1, js_counter()->count());
+ EXPECT_EQ(1, counter()->count());
+ EXPECT_EQ(1, callback_counter->count());
+ EXPECT_EQ(1, counter2()->count());
+ // Given that no native timers are used, only the two scopes explitly
+ // mentioned above will track the time.
+ EXPECT_EQ(0, js_counter()->time().InMicroseconds());
+ EXPECT_EQ(100, counter()->time().InMicroseconds());
+ EXPECT_EQ(0, callback_counter->time().InMicroseconds());
+ EXPECT_EQ(kCustomCallbackTime, counter2()->time().InMicroseconds());
+
+ RunJS("for (let i = 0; i < 9; i++) { custom_object.apiGetter };");
+ PrintStats();
+
+ EXPECT_EQ(2, js_counter()->count());
EXPECT_EQ(1, counter()->count());
+ EXPECT_EQ(10, callback_counter->count());
+ EXPECT_EQ(10, counter2()->count());
+
+ EXPECT_EQ(0, js_counter()->time().InMicroseconds());
EXPECT_EQ(100, counter()->time().InMicroseconds());
+ EXPECT_EQ(0, callback_counter->time().InMicroseconds());
+ EXPECT_EQ(kCustomCallbackTime * 10, counter2()->time().InMicroseconds());
+
+ RunJS("for (let i = 0; i < 4000; i++) { custom_object.apiGetter };");
+ PrintStats();
+
+ EXPECT_EQ(3, js_counter()->count());
+ EXPECT_EQ(1, counter()->count());
+ EXPECT_EQ(4010, callback_counter->count());
EXPECT_EQ(4010, counter2()->count());
+
+ EXPECT_EQ(0, js_counter()->time().InMicroseconds());
+ EXPECT_EQ(100, counter()->time().InMicroseconds());
+ EXPECT_EQ(0, callback_counter->time().InMicroseconds());
EXPECT_EQ(kCustomCallbackTime * 4010, counter2()->time().InMicroseconds());
+
+ PrintStats();
}
} // namespace internal
diff --git a/deps/v8/test/unittests/heap/embedder-tracing-unittest.cc b/deps/v8/test/unittests/heap/embedder-tracing-unittest.cc
index e07fa1b327..ac2cb3e2ee 100644
--- a/deps/v8/test/unittests/heap/embedder-tracing-unittest.cc
+++ b/deps/v8/test/unittests/heap/embedder-tracing-unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "src/heap/embedder-tracing.h"
+#include "src/heap/heap.h"
#include "test/unittests/test-utils.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -33,12 +34,11 @@ class MockEmbedderHeapTracer : public EmbedderHeapTracer {
MOCK_METHOD0(TracePrologue, void());
MOCK_METHOD0(TraceEpilogue, void());
MOCK_METHOD0(AbortTracing, void());
- MOCK_METHOD0(EnterFinalPause, void());
+ MOCK_METHOD1(EnterFinalPause, void(EmbedderHeapTracer::EmbedderStackState));
MOCK_METHOD0(IsTracingDone, bool());
MOCK_METHOD1(RegisterV8References,
void(const std::vector<std::pair<void*, void*> >&));
- MOCK_METHOD2(AdvanceTracing,
- bool(double deadline_in_ms, AdvanceTracingActions actions));
+ MOCK_METHOD1(AdvanceTracing, bool(double deadline_in_ms));
};
TEST(LocalEmbedderHeapTracer, InUse) {
@@ -55,10 +55,8 @@ TEST(LocalEmbedderHeapTracer, NoRemoteTracer) {
EXPECT_FALSE(local_tracer.InUse());
local_tracer.TracePrologue();
local_tracer.EnterFinalPause();
- bool more_work = local_tracer.Trace(
- 0, EmbedderHeapTracer::AdvanceTracingActions(
- EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION));
- EXPECT_FALSE(more_work);
+ bool done = local_tracer.Trace(std::numeric_limits<double>::infinity());
+ EXPECT_TRUE(done);
local_tracer.TraceEpilogue();
}
@@ -100,7 +98,38 @@ TEST(LocalEmbedderHeapTracer, EnterFinalPauseForwards) {
StrictMock<MockEmbedderHeapTracer> remote_tracer;
LocalEmbedderHeapTracer local_tracer(nullptr);
local_tracer.SetRemoteTracer(&remote_tracer);
- EXPECT_CALL(remote_tracer, EnterFinalPause());
+ EXPECT_CALL(remote_tracer, EnterFinalPause(_));
+ local_tracer.EnterFinalPause();
+}
+
+TEST(LocalEmbedderHeapTracer, EnterFinalPauseDefaultStackStateUnkown) {
+ StrictMock<MockEmbedderHeapTracer> remote_tracer;
+ LocalEmbedderHeapTracer local_tracer(nullptr);
+ local_tracer.SetRemoteTracer(&remote_tracer);
+ // The default stack state is expected to be unkown.
+ EXPECT_CALL(remote_tracer, EnterFinalPause(EmbedderHeapTracer::kUnknown));
+ local_tracer.EnterFinalPause();
+}
+
+TEST(LocalEmbedderHeapTracer, EnterFinalPauseStackStateIsForwarded) {
+ StrictMock<MockEmbedderHeapTracer> remote_tracer;
+ LocalEmbedderHeapTracer local_tracer(nullptr);
+ local_tracer.SetRemoteTracer(&remote_tracer);
+ local_tracer.SetEmbedderStackStateForNextFinalization(
+ EmbedderHeapTracer::kEmpty);
+ EXPECT_CALL(remote_tracer, EnterFinalPause(EmbedderHeapTracer::kEmpty));
+ local_tracer.EnterFinalPause();
+}
+
+TEST(LocalEmbedderHeapTracer, EnterFinalPauseStackStateResets) {
+ StrictMock<MockEmbedderHeapTracer> remote_tracer;
+ LocalEmbedderHeapTracer local_tracer(nullptr);
+ local_tracer.SetRemoteTracer(&remote_tracer);
+ local_tracer.SetEmbedderStackStateForNextFinalization(
+ EmbedderHeapTracer::kEmpty);
+ EXPECT_CALL(remote_tracer, EnterFinalPause(EmbedderHeapTracer::kEmpty));
+ local_tracer.EnterFinalPause();
+ EXPECT_CALL(remote_tracer, EnterFinalPause(EmbedderHeapTracer::kUnknown));
local_tracer.EnterFinalPause();
}
@@ -140,10 +169,8 @@ TEST(LocalEmbedderHeapTracer, TraceFinishes) {
EXPECT_EQ(1u, local_tracer.NumberOfCachedWrappersToTrace());
EXPECT_CALL(remote_tracer, RegisterV8References(_));
local_tracer.RegisterWrappersWithRemoteTracer();
- EXPECT_CALL(remote_tracer, AdvanceTracing(0, _)).WillOnce(Return(false));
- EXPECT_FALSE(local_tracer.Trace(
- 0, EmbedderHeapTracer::AdvanceTracingActions(
- EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION)));
+ EXPECT_CALL(remote_tracer, AdvanceTracing(_)).WillOnce(Return(true));
+ EXPECT_TRUE(local_tracer.Trace(std::numeric_limits<double>::infinity()));
EXPECT_EQ(0u, local_tracer.NumberOfCachedWrappersToTrace());
}
@@ -155,10 +182,8 @@ TEST(LocalEmbedderHeapTracer, TraceDoesNotFinish) {
EXPECT_EQ(1u, local_tracer.NumberOfCachedWrappersToTrace());
EXPECT_CALL(remote_tracer, RegisterV8References(_));
local_tracer.RegisterWrappersWithRemoteTracer();
- EXPECT_CALL(remote_tracer, AdvanceTracing(0, _)).WillOnce(Return(true));
- EXPECT_TRUE(local_tracer.Trace(
- 0, EmbedderHeapTracer::AdvanceTracingActions(
- EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION)));
+ EXPECT_CALL(remote_tracer, AdvanceTracing(_)).WillOnce(Return(false));
+ EXPECT_FALSE(local_tracer.Trace(1.0));
EXPECT_EQ(0u, local_tracer.NumberOfCachedWrappersToTrace());
}
diff --git a/deps/v8/test/unittests/heap/heap-controller-unittest.cc b/deps/v8/test/unittests/heap/heap-controller-unittest.cc
index dc75820f64..b2446afa84 100644
--- a/deps/v8/test/unittests/heap/heap-controller-unittest.cc
+++ b/deps/v8/test/unittests/heap/heap-controller-unittest.cc
@@ -32,80 +32,82 @@ void CheckEqualRounded(double expected, double actual) {
EXPECT_DOUBLE_EQ(expected, actual);
}
-TEST(HeapController, HeapGrowingFactor) {
- CheckEqualRounded(HeapController::kMaxHeapGrowingFactor,
- HeapController::HeapGrowingFactor(34, 1, 4.0));
- CheckEqualRounded(3.553, HeapController::HeapGrowingFactor(45, 1, 4.0));
- CheckEqualRounded(2.830, HeapController::HeapGrowingFactor(50, 1, 4.0));
- CheckEqualRounded(1.478, HeapController::HeapGrowingFactor(100, 1, 4.0));
- CheckEqualRounded(1.193, HeapController::HeapGrowingFactor(200, 1, 4.0));
- CheckEqualRounded(1.121, HeapController::HeapGrowingFactor(300, 1, 4.0));
- CheckEqualRounded(HeapController::HeapGrowingFactor(300, 1, 4.0),
- HeapController::HeapGrowingFactor(600, 2, 4.0));
- CheckEqualRounded(HeapController::kMinHeapGrowingFactor,
- HeapController::HeapGrowingFactor(400, 1, 4.0));
+TEST_F(HeapControllerTest, HeapGrowingFactor) {
+ HeapController heap_controller(i_isolate()->heap());
+ double min_factor = heap_controller.kMinGrowingFactor;
+ double max_factor = heap_controller.kMaxGrowingFactor;
+
+ CheckEqualRounded(max_factor, heap_controller.GrowingFactor(34, 1, 4.0));
+ CheckEqualRounded(3.553, heap_controller.GrowingFactor(45, 1, 4.0));
+ CheckEqualRounded(2.830, heap_controller.GrowingFactor(50, 1, 4.0));
+ CheckEqualRounded(1.478, heap_controller.GrowingFactor(100, 1, 4.0));
+ CheckEqualRounded(1.193, heap_controller.GrowingFactor(200, 1, 4.0));
+ CheckEqualRounded(1.121, heap_controller.GrowingFactor(300, 1, 4.0));
+ CheckEqualRounded(heap_controller.GrowingFactor(300, 1, 4.0),
+ heap_controller.GrowingFactor(600, 2, 4.0));
+ CheckEqualRounded(min_factor, heap_controller.GrowingFactor(400, 1, 4.0));
}
-TEST(HeapController, MaxHeapGrowingFactor) {
- CheckEqualRounded(1.3, HeapController::MaxHeapGrowingFactor(
- HeapController::kMinOldGenerationSize * MB));
- CheckEqualRounded(1.600, HeapController::MaxHeapGrowingFactor(
- HeapController::kMaxOldGenerationSize / 2 * MB));
- CheckEqualRounded(1.999, HeapController::MaxHeapGrowingFactor(
- (HeapController::kMaxOldGenerationSize -
- Heap::kPointerMultiplier) *
- MB));
+TEST_F(HeapControllerTest, MaxHeapGrowingFactor) {
+ HeapController heap_controller(i_isolate()->heap());
CheckEqualRounded(
- 4.0,
- HeapController::MaxHeapGrowingFactor(
- static_cast<size_t>(HeapController::kMaxOldGenerationSize) * MB));
+ 1.3, heap_controller.MaxGrowingFactor(heap_controller.kMinSize * MB));
+ CheckEqualRounded(1.600, heap_controller.MaxGrowingFactor(
+ heap_controller.kMaxSize / 2 * MB));
+ CheckEqualRounded(
+ 1.999, heap_controller.MaxGrowingFactor(
+ (heap_controller.kMaxSize - Heap::kPointerMultiplier) * MB));
+ CheckEqualRounded(4.0,
+ heap_controller.MaxGrowingFactor(
+ static_cast<size_t>(heap_controller.kMaxSize) * MB));
}
TEST_F(HeapControllerTest, OldGenerationAllocationLimit) {
Heap* heap = i_isolate()->heap();
+ HeapController heap_controller(heap);
size_t old_gen_size = 128 * MB;
size_t max_old_generation_size = 512 * MB;
double gc_speed = 100;
double mutator_speed = 1;
size_t new_space_capacity = 16 * MB;
- double max_factor =
- HeapController::MaxHeapGrowingFactor(max_old_generation_size);
+ double max_factor = heap_controller.MaxGrowingFactor(max_old_generation_size);
double factor =
- HeapController::HeapGrowingFactor(gc_speed, mutator_speed, max_factor);
+ heap_controller.GrowingFactor(gc_speed, mutator_speed, max_factor);
EXPECT_EQ(static_cast<size_t>(old_gen_size * factor + new_space_capacity),
- heap->heap_controller()->CalculateOldGenerationAllocationLimit(
+ heap->heap_controller()->CalculateAllocationLimit(
old_gen_size, max_old_generation_size, gc_speed, mutator_speed,
new_space_capacity, Heap::HeapGrowingMode::kDefault));
- factor = Min(factor, HeapController::kConservativeHeapGrowingFactor);
+ factor = Min(factor, heap_controller.kConservativeGrowingFactor);
EXPECT_EQ(static_cast<size_t>(old_gen_size * factor + new_space_capacity),
- heap->heap_controller()->CalculateOldGenerationAllocationLimit(
+ heap->heap_controller()->CalculateAllocationLimit(
old_gen_size, max_old_generation_size, gc_speed, mutator_speed,
new_space_capacity, Heap::HeapGrowingMode::kSlow));
- factor = Min(factor, HeapController::kConservativeHeapGrowingFactor);
+ factor = Min(factor, heap_controller.kConservativeGrowingFactor);
EXPECT_EQ(static_cast<size_t>(old_gen_size * factor + new_space_capacity),
- heap->heap_controller()->CalculateOldGenerationAllocationLimit(
+ heap->heap_controller()->CalculateAllocationLimit(
old_gen_size, max_old_generation_size, gc_speed, mutator_speed,
new_space_capacity, Heap::HeapGrowingMode::kConservative));
- factor = HeapController::kMinHeapGrowingFactor;
+ factor = heap_controller.kMinGrowingFactor;
EXPECT_EQ(static_cast<size_t>(old_gen_size * factor + new_space_capacity),
- heap->heap_controller()->CalculateOldGenerationAllocationLimit(
+ heap->heap_controller()->CalculateAllocationLimit(
old_gen_size, max_old_generation_size, gc_speed, mutator_speed,
new_space_capacity, Heap::HeapGrowingMode::kMinimal));
}
-TEST(HeapController, MaxOldGenerationSize) {
+TEST_F(HeapControllerTest, MaxOldGenerationSize) {
+ HeapController heap_controller(i_isolate()->heap());
uint64_t configurations[][2] = {
- {0, HeapController::kMinOldGenerationSize},
- {512, HeapController::kMinOldGenerationSize},
+ {0, heap_controller.kMinSize},
+ {512, heap_controller.kMinSize},
{1 * GB, 256 * Heap::kPointerMultiplier},
{2 * static_cast<uint64_t>(GB), 512 * Heap::kPointerMultiplier},
- {4 * static_cast<uint64_t>(GB), HeapController::kMaxOldGenerationSize},
- {8 * static_cast<uint64_t>(GB), HeapController::kMaxOldGenerationSize}};
+ {4 * static_cast<uint64_t>(GB), heap_controller.kMaxSize},
+ {8 * static_cast<uint64_t>(GB), heap_controller.kMaxSize}};
for (auto configuration : configurations) {
ASSERT_EQ(configuration[1],
diff --git a/deps/v8/test/unittests/heap/spaces-unittest.cc b/deps/v8/test/unittests/heap/spaces-unittest.cc
index 13c0297489..d81b7e1413 100644
--- a/deps/v8/test/unittests/heap/spaces-unittest.cc
+++ b/deps/v8/test/unittests/heap/spaces-unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "src/heap/heap-inl.h"
+#include "src/heap/heap-write-barrier-inl.h"
#include "src/heap/spaces-inl.h"
#include "src/isolate.h"
#include "test/unittests/test-utils.h"
@@ -51,6 +52,69 @@ TEST_F(SpacesTest, CompactionSpaceMerge) {
delete compaction_space;
}
+TEST_F(SpacesTest, WriteBarrierFromHeapObject) {
+ constexpr Address address1 = Page::kPageSize;
+ HeapObject* object1 = reinterpret_cast<HeapObject*>(address1);
+ MemoryChunk* chunk1 = MemoryChunk::FromHeapObject(object1);
+ heap_internals::MemoryChunk* slim_chunk1 =
+ heap_internals::MemoryChunk::FromHeapObject(object1);
+ EXPECT_EQ(static_cast<void*>(chunk1), static_cast<void*>(slim_chunk1));
+ constexpr Address address2 = 2 * Page::kPageSize - 1;
+ HeapObject* object2 = reinterpret_cast<HeapObject*>(address2);
+ MemoryChunk* chunk2 = MemoryChunk::FromHeapObject(object2);
+ heap_internals::MemoryChunk* slim_chunk2 =
+ heap_internals::MemoryChunk::FromHeapObject(object2);
+ EXPECT_EQ(static_cast<void*>(chunk2), static_cast<void*>(slim_chunk2));
+}
+
+TEST_F(SpacesTest, WriteBarrierIsMarking) {
+ char memory[256];
+ memset(&memory, 0, sizeof(memory));
+ MemoryChunk* chunk = reinterpret_cast<MemoryChunk*>(&memory);
+ heap_internals::MemoryChunk* slim_chunk =
+ reinterpret_cast<heap_internals::MemoryChunk*>(&memory);
+ EXPECT_FALSE(chunk->IsFlagSet(MemoryChunk::INCREMENTAL_MARKING));
+ EXPECT_FALSE(slim_chunk->IsMarking());
+ chunk->SetFlag(MemoryChunk::INCREMENTAL_MARKING);
+ EXPECT_TRUE(chunk->IsFlagSet(MemoryChunk::INCREMENTAL_MARKING));
+ EXPECT_TRUE(slim_chunk->IsMarking());
+ chunk->ClearFlag(MemoryChunk::INCREMENTAL_MARKING);
+ EXPECT_FALSE(chunk->IsFlagSet(MemoryChunk::INCREMENTAL_MARKING));
+ EXPECT_FALSE(slim_chunk->IsMarking());
+}
+
+TEST_F(SpacesTest, WriteBarrierInNewSpaceToSpace) {
+ char memory[256];
+ memset(&memory, 0, sizeof(memory));
+ 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());
+}
+
+TEST_F(SpacesTest, WriteBarrierInNewSpaceFromSpace) {
+ char memory[256];
+ memset(&memory, 0, sizeof(memory));
+ 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());
+}
+
TEST_F(SpacesTest, CodeRangeAddressReuse) {
CodeRangeAddressHint hint;
// Create code ranges.
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 1ae636eceb..5030d3897d 100644
--- a/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc
+++ b/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc
@@ -376,7 +376,8 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) {
.CreateArrayLiteral(0, 0, 0)
.CreateEmptyArrayLiteral(0)
.CreateObjectLiteral(0, 0, 0, reg)
- .CreateEmptyObjectLiteral();
+ .CreateEmptyObjectLiteral()
+ .CloneObject(reg, 0, 0);
// Emit load and store operations for module variables.
builder.LoadModuleVariable(-1, 42)
diff --git a/deps/v8/test/unittests/object-unittest.cc b/deps/v8/test/unittests/object-unittest.cc
index 0b603298ad..ad8d631961 100644
--- a/deps/v8/test/unittests/object-unittest.cc
+++ b/deps/v8/test/unittests/object-unittest.cc
@@ -6,6 +6,7 @@
#include <iostream>
#include <limits>
+#include "src/api-inl.h"
#include "src/compiler.h"
#include "src/objects-inl.h"
#include "src/objects.h"
diff --git a/deps/v8/test/unittests/parser/preparser-unittest.cc b/deps/v8/test/unittests/parser/preparser-unittest.cc
index a9f77b4b7a..f20fbb2cee 100644
--- a/deps/v8/test/unittests/parser/preparser-unittest.cc
+++ b/deps/v8/test/unittests/parser/preparser-unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/objects-inl.h"
#include "test/unittests/test-helpers.h"
#include "test/unittests/test-utils.h"
diff --git a/deps/v8/test/unittests/test-helpers.cc b/deps/v8/test/unittests/test-helpers.cc
index ee601da900..c771906dc2 100644
--- a/deps/v8/test/unittests/test-helpers.cc
+++ b/deps/v8/test/unittests/test-helpers.cc
@@ -42,7 +42,8 @@ Handle<SharedFunctionInfo> CreateSharedFunctionInfo(
// Ensure that the function can be compiled lazily.
shared->set_uncompiled_data(
*isolate->factory()->NewUncompiledDataWithoutPreParsedScope(
- 0, source->length(), function_literal_id));
+ ReadOnlyRoots(isolate).empty_string_handle(), 0, source->length(),
+ function_literal_id));
// Make sure we have an outer scope info, even though it's empty
shared->set_raw_outer_scope_info_or_feedback_metadata(
ScopeInfo::Empty(isolate));
diff --git a/deps/v8/test/unittests/test-utils.cc b/deps/v8/test/unittests/test-utils.cc
index d19c337239..2b099e0ea5 100644
--- a/deps/v8/test/unittests/test-utils.cc
+++ b/deps/v8/test/unittests/test-utils.cc
@@ -6,7 +6,7 @@
#include "include/libplatform/libplatform.h"
#include "include/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/base/platform/time.h"
#include "src/flags.h"
#include "src/isolate.h"
@@ -67,17 +67,19 @@ Local<Value> TestWithIsolate::RunJS(const char* source) {
TestWithContext::TestWithContext()
: context_(Context::New(isolate())), context_scope_(context_) {}
-
TestWithContext::~TestWithContext() {}
+v8::Local<v8::String> TestWithContext::NewString(const char* string) {
+ return v8::String::NewFromUtf8(v8_isolate(), string,
+ v8::NewStringType::kNormal)
+ .ToLocalChecked();
+}
+
void TestWithContext::SetGlobalProperty(const char* name,
v8::Local<v8::Value> value) {
- v8::Local<v8::String> property_name =
- v8::String::NewFromUtf8(v8_isolate(), name, v8::NewStringType::kNormal)
- .ToLocalChecked();
CHECK(v8_context()
->Global()
- ->Set(v8_context(), property_name, value)
+ ->Set(v8_context(), NewString(name), value)
.FromJust());
}
@@ -89,6 +91,10 @@ TestWithIsolateAndZone::~TestWithIsolateAndZone() {}
Factory* TestWithIsolate::factory() const { return isolate()->factory(); }
+Handle<Object> TestWithIsolate::RunJSInternal(const char* source) {
+ return Utils::OpenHandle(*::v8::TestWithIsolate::RunJS(source));
+}
+
base::RandomNumberGenerator* TestWithIsolate::random_number_generator() const {
return isolate()->random_number_generator();
}
diff --git a/deps/v8/test/unittests/test-utils.h b/deps/v8/test/unittests/test-utils.h
index 17a5eb7c21..c361810219 100644
--- a/deps/v8/test/unittests/test-utils.h
+++ b/deps/v8/test/unittests/test-utils.h
@@ -8,7 +8,6 @@
#include <vector>
#include "include/v8.h"
-#include "src/api.h"
#include "src/base/macros.h"
#include "src/base/utils/random-number-generator.h"
#include "src/handles.h"
@@ -61,6 +60,7 @@ class TestWithContext : public virtual v8::TestWithIsolate {
const Local<Context>& context() const { return v8_context(); }
const Local<Context>& v8_context() const { return context_; }
+ v8::Local<v8::String> NewString(const char* string);
void SetGlobalProperty(const char* name, v8::Local<v8::Value> value);
private:
@@ -85,10 +85,9 @@ class TestWithIsolate : public virtual ::v8::TestWithIsolate {
Isolate* isolate() const { return i_isolate(); }
template <typename T = Object>
Handle<T> RunJS(const char* source) {
- Handle<Object> result =
- Utils::OpenHandle(*::v8::TestWithIsolate::RunJS(source));
- return Handle<T>::cast(result);
+ return Handle<T>::cast(RunJSInternal(source));
}
+ Handle<Object> RunJSInternal(const char* source);
base::RandomNumberGenerator* random_number_generator() const;
private:
diff --git a/deps/v8/test/unittests/torque/earley-parser-unittest.cc b/deps/v8/test/unittests/torque/earley-parser-unittest.cc
new file mode 100644
index 0000000000..9718a404c9
--- /dev/null
+++ b/deps/v8/test/unittests/torque/earley-parser-unittest.cc
@@ -0,0 +1,84 @@
+// 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.
+
+#include "src/torque/earley-parser.h"
+#include "test/unittests/test-utils.h"
+
+namespace v8 {
+namespace internal {
+namespace torque {
+
+namespace {
+
+template <int op(int, int)>
+base::Optional<ParseResult> MakeBinop(ParseResultIterator* child_results) {
+ // Ideally, we would want to use int as a result type here instead of
+ // std::string. This is possible, but requires adding int to the list of
+ // supported ParseResult types in torque-parser.cc. To avoid changing that
+ // code, we use std::string here, which is already used in the Torque parser.
+ auto a = child_results->NextAs<std::string>();
+ auto b = child_results->NextAs<std::string>();
+ return ParseResult{std::to_string(op(std::stoi(a), std::stoi(b)))};
+}
+
+int plus(int a, int b) { return a + b; }
+int minus(int a, int b) { return a - b; }
+int mul(int a, int b) { return a * b; }
+
+} // namespace
+
+struct SimpleArithmeticGrammar : Grammar {
+ static bool MatchWhitespace(InputPosition* pos) {
+ while (MatchChar(std::isspace, pos)) {
+ }
+ return true;
+ }
+
+ static bool MatchInteger(InputPosition* pos) {
+ InputPosition current = *pos;
+ MatchString("-", &current);
+ if (MatchChar(std::isdigit, &current)) {
+ while (MatchChar(std::isdigit, &current)) {
+ }
+ *pos = current;
+ return true;
+ }
+ return false;
+ }
+
+ SimpleArithmeticGrammar() : Grammar(&sum_expression) {
+ SetWhitespace(MatchWhitespace);
+ }
+
+ Symbol integer = {Rule({Pattern(MatchInteger)}, YieldMatchedInput)};
+
+ Symbol atomic_expression = {Rule({&integer}),
+ Rule({Token("("), &sum_expression, Token(")")})};
+
+ Symbol mul_expression = {
+ Rule({&atomic_expression}),
+ Rule({&mul_expression, Token("*"), &atomic_expression}, MakeBinop<mul>)};
+
+ Symbol sum_expression = {
+ Rule({&mul_expression}),
+ Rule({&sum_expression, Token("+"), &mul_expression}, MakeBinop<plus>),
+ Rule({&sum_expression, Token("-"), &mul_expression}, MakeBinop<minus>)};
+};
+
+TEST(EarleyParser, SimpleArithmetic) {
+ SimpleArithmeticGrammar grammar;
+ SourceFileMap::Scope source_file_map;
+ CurrentSourceFile::Scope current_source_file{
+ SourceFileMap::AddSource("dummy_filename")};
+ std::string result1 =
+ grammar.Parse("-5 - 5 + (3 + 5) * 2")->Cast<std::string>();
+ ASSERT_EQ("6", result1);
+ std::string result2 = grammar.Parse("((-1 + (1) * 2 + 3 - 4 * 5 + -6 * 7))")
+ ->Cast<std::string>();
+ ASSERT_EQ("-58", result2);
+}
+
+} // namespace torque
+} // namespace internal
+} // namespace v8
diff --git a/deps/v8/test/unittests/value-serializer-unittest.cc b/deps/v8/test/unittests/value-serializer-unittest.cc
index 92603b588a..77f609052a 100644
--- a/deps/v8/test/unittests/value-serializer-unittest.cc
+++ b/deps/v8/test/unittests/value-serializer-unittest.cc
@@ -8,7 +8,7 @@
#include <string>
#include "include/v8.h"
-#include "src/api.h"
+#include "src/api-inl.h"
#include "src/base/build_config.h"
#include "src/objects-inl.h"
#include "src/wasm/wasm-objects.h"
@@ -1689,12 +1689,12 @@ TEST_F(ValueSerializerTest, RoundTripTypedArray) {
// Check that the right type comes out the other side for every kind of typed
// array.
Local<Value> value;
-#define TYPED_ARRAY_ROUND_TRIP_TEST(Type, type, TYPE, ctype, size) \
- value = RoundTripTest("new " #Type "Array(2)"); \
- ASSERT_TRUE(value->Is##Type##Array()); \
- EXPECT_EQ(2u * size, TypedArray::Cast(*value)->ByteLength()); \
- EXPECT_EQ(2u, TypedArray::Cast(*value)->Length()); \
- ExpectScriptTrue("Object.getPrototypeOf(result) === " #Type \
+#define TYPED_ARRAY_ROUND_TRIP_TEST(Type, type, TYPE, ctype) \
+ value = RoundTripTest("new " #Type "Array(2)"); \
+ ASSERT_TRUE(value->Is##Type##Array()); \
+ EXPECT_EQ(2u * sizeof(ctype), TypedArray::Cast(*value)->ByteLength()); \
+ EXPECT_EQ(2u, TypedArray::Cast(*value)->Length()); \
+ ExpectScriptTrue("Object.getPrototypeOf(result) === " #Type \
"Array.prototype");
TYPED_ARRAYS(TYPED_ARRAY_ROUND_TRIP_TEST)
@@ -2514,7 +2514,8 @@ TEST_F(ValueSerializerTestWithWasm, DefaultSerializationDelegate) {
Local<Message> message = InvalidEncodeTest(MakeWasm());
size_t msg_len = static_cast<size_t>(message->Get()->Length());
std::unique_ptr<char[]> buff(new char[msg_len + 1]);
- message->Get()->WriteOneByte(reinterpret_cast<uint8_t*>(buff.get()));
+ message->Get()->WriteOneByte(isolate(),
+ reinterpret_cast<uint8_t*>(buff.get()));
// the message ends with the custom error string
size_t custom_msg_len = strlen(kUnsupportedSerialization);
ASSERT_GE(msg_len, custom_msg_len);
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 3b25056160..771c61e237 100644
--- a/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc
+++ b/deps/v8/test/unittests/wasm/function-body-decoder-unittest.cc
@@ -92,6 +92,9 @@ static const WasmOpcode kInt32BinopOpcodes[] = {
class FunctionBodyDecoderTest : public TestWithZone {
public:
typedef std::pair<uint32_t, ValueType> LocalsDecl;
+ // All features are disabled by default and must be activated with
+ // a WASM_FEATURE_SCOPE in individual tests.
+ WasmFeatures enabled_features_;
FunctionBodyDecoderTest() : module(nullptr), local_decls(zone()) {}
@@ -133,8 +136,11 @@ class FunctionBodyDecoderTest : public TestWithZone {
PrepareBytecode(&start, &end, append_end);
// Verify the code.
+ FunctionBody body(sig, 0, start, end);
+ WasmFeatures unused_detected_features;
DecodeResult result =
- VerifyWasmCode(zone()->allocator(), module, sig, start, end);
+ VerifyWasmCode(zone()->allocator(), enabled_features_, module,
+ &unused_detected_features, body);
uint32_t pc = result.error_offset();
std::ostringstream str;
@@ -198,6 +204,17 @@ class FunctionBodyDecoderTest : public TestWithZone {
namespace {
+class EnableBoolScope {
+ public:
+ bool prev_;
+ bool* ptr_;
+ explicit EnableBoolScope(bool* ptr) : prev_(*ptr), ptr_(ptr) { *ptr = true; }
+ ~EnableBoolScope() { *ptr_ = prev_; }
+};
+
+#define WASM_FEATURE_SCOPE(feat) \
+ EnableBoolScope feat##_scope(&this->enabled_features_.feat);
+
constexpr size_t kMaxByteSizedLeb128 = 127;
// A helper for tests that require a module environment for functions,
@@ -263,7 +280,7 @@ TEST_F(FunctionBodyDecoderTest, Int32Const1) {
}
TEST_F(FunctionBodyDecoderTest, RefNull) {
- FlagScope<bool> flag_scope(&FLAG_experimental_wasm_anyref, true);
+ WASM_FEATURE_SCOPE(anyref);
byte code[] = {kExprRefNull};
EXPECT_VERIFIES_C(r_v, code);
}
@@ -1236,8 +1253,8 @@ TEST_F(FunctionBodyDecoderTest, MacrosInt64) {
}
TEST_F(FunctionBodyDecoderTest, AllSimpleExpressions) {
- EXPERIMENTAL_FLAG_SCOPE(se);
- EXPERIMENTAL_FLAG_SCOPE(anyref);
+ WASM_FEATURE_SCOPE(se);
+ WASM_FEATURE_SCOPE(anyref);
// Test all simple expressions which are described by a signature.
#define DECODE_TEST(name, opcode, sig) \
{ \
@@ -1476,7 +1493,7 @@ TEST_F(FunctionBodyDecoderTest, CallsWithMismatchedSigs3) {
}
TEST_F(FunctionBodyDecoderTest, MultiReturn) {
- EXPERIMENTAL_FLAG_SCOPE(mv);
+ WASM_FEATURE_SCOPE(mv);
ValueType storage[] = {kWasmI32, kWasmI32};
FunctionSig sig_ii_v(2, 0, storage);
FunctionSig sig_v_ii(0, 2, storage);
@@ -1492,7 +1509,7 @@ TEST_F(FunctionBodyDecoderTest, MultiReturn) {
}
TEST_F(FunctionBodyDecoderTest, MultiReturnType) {
- EXPERIMENTAL_FLAG_SCOPE(mv);
+ WASM_FEATURE_SCOPE(mv);
for (size_t a = 0; a < arraysize(kValueTypes); a++) {
for (size_t b = 0; b < arraysize(kValueTypes); b++) {
for (size_t c = 0; c < arraysize(kValueTypes); c++) {
@@ -1612,7 +1629,7 @@ TEST_F(FunctionBodyDecoderTest, IncompleteStore) {
}
TEST_F(FunctionBodyDecoderTest, IncompleteS8x16Shuffle) {
- EXPERIMENTAL_FLAG_SCOPE(simd);
+ WASM_FEATURE_SCOPE(simd);
FunctionSig* sig = sigs.i_i();
TestModuleBuilder builder;
builder.InitializeMemory();
@@ -2383,7 +2400,7 @@ TEST_F(FunctionBodyDecoderTest, Select_TypeCheck) {
}
TEST_F(FunctionBodyDecoderTest, Throw) {
- EXPERIMENTAL_FLAG_SCOPE(eh);
+ WASM_FEATURE_SCOPE(eh);
TestModuleBuilder builder;
module = builder.module();
@@ -2403,7 +2420,7 @@ TEST_F(FunctionBodyDecoderTest, Throw) {
TEST_F(FunctionBodyDecoderTest, ThrowUnreachable) {
// TODO(titzer): unreachable code after throw should validate.
- EXPERIMENTAL_FLAG_SCOPE(eh);
+ WASM_FEATURE_SCOPE(eh);
TestModuleBuilder builder;
module = builder.module();
@@ -2420,7 +2437,7 @@ TEST_F(FunctionBodyDecoderTest, ThrowUnreachable) {
#define WASM_CATCH(index) kExprCatch, static_cast<byte>(index)
TEST_F(FunctionBodyDecoderTest, TryCatch) {
- EXPERIMENTAL_FLAG_SCOPE(eh);
+ WASM_FEATURE_SCOPE(eh);
TestModuleBuilder builder;
module = builder.module();
@@ -2445,7 +2462,7 @@ TEST_F(FunctionBodyDecoderTest, TryCatch) {
#undef WASM_CATCH
TEST_F(FunctionBodyDecoderTest, MultiValBlock1) {
- EXPERIMENTAL_FLAG_SCOPE(mv);
+ WASM_FEATURE_SCOPE(mv);
TestModuleBuilder builder;
module = builder.module();
byte f0 = builder.AddSignature(sigs.ii_v());
@@ -2461,7 +2478,7 @@ TEST_F(FunctionBodyDecoderTest, MultiValBlock1) {
}
TEST_F(FunctionBodyDecoderTest, MultiValBlock2) {
- EXPERIMENTAL_FLAG_SCOPE(mv);
+ WASM_FEATURE_SCOPE(mv);
TestModuleBuilder builder;
module = builder.module();
byte f0 = builder.AddSignature(sigs.ii_v());
@@ -2479,7 +2496,7 @@ TEST_F(FunctionBodyDecoderTest, MultiValBlock2) {
}
TEST_F(FunctionBodyDecoderTest, MultiValBlockBr) {
- EXPERIMENTAL_FLAG_SCOPE(mv);
+ WASM_FEATURE_SCOPE(mv);
TestModuleBuilder builder;
module = builder.module();
byte f0 = builder.AddSignature(sigs.ii_v());
@@ -2491,7 +2508,7 @@ TEST_F(FunctionBodyDecoderTest, MultiValBlockBr) {
}
TEST_F(FunctionBodyDecoderTest, MultiValLoop1) {
- EXPERIMENTAL_FLAG_SCOPE(mv);
+ WASM_FEATURE_SCOPE(mv);
TestModuleBuilder builder;
module = builder.module();
byte f0 = builder.AddSignature(sigs.ii_v());
@@ -2507,7 +2524,7 @@ TEST_F(FunctionBodyDecoderTest, MultiValLoop1) {
}
TEST_F(FunctionBodyDecoderTest, MultiValIf) {
- EXPERIMENTAL_FLAG_SCOPE(mv);
+ WASM_FEATURE_SCOPE(mv);
TestModuleBuilder builder;
module = builder.module();
byte f0 = builder.AddSignature(sigs.ii_v());
@@ -2570,7 +2587,7 @@ TEST_F(FunctionBodyDecoderTest, MultiValIf) {
}
TEST_F(FunctionBodyDecoderTest, BlockParam) {
- EXPERIMENTAL_FLAG_SCOPE(mv);
+ WASM_FEATURE_SCOPE(mv);
TestModuleBuilder builder;
module = builder.module();
byte f1 = builder.AddSignature(sigs.i_i());
@@ -2596,7 +2613,7 @@ TEST_F(FunctionBodyDecoderTest, BlockParam) {
}
TEST_F(FunctionBodyDecoderTest, LoopParam) {
- EXPERIMENTAL_FLAG_SCOPE(mv);
+ WASM_FEATURE_SCOPE(mv);
TestModuleBuilder builder;
module = builder.module();
byte f1 = builder.AddSignature(sigs.i_i());
@@ -2622,7 +2639,7 @@ TEST_F(FunctionBodyDecoderTest, LoopParam) {
}
TEST_F(FunctionBodyDecoderTest, LoopParamBr) {
- EXPERIMENTAL_FLAG_SCOPE(mv);
+ WASM_FEATURE_SCOPE(mv);
TestModuleBuilder builder;
module = builder.module();
byte f1 = builder.AddSignature(sigs.i_i());
@@ -2644,7 +2661,7 @@ TEST_F(FunctionBodyDecoderTest, LoopParamBr) {
}
TEST_F(FunctionBodyDecoderTest, IfParam) {
- EXPERIMENTAL_FLAG_SCOPE(mv);
+ WASM_FEATURE_SCOPE(mv);
TestModuleBuilder builder;
module = builder.module();
byte f1 = builder.AddSignature(sigs.i_i());
@@ -2678,8 +2695,11 @@ TEST_F(FunctionBodyDecoderTest, Regression709741) {
PrepareBytecode(&start, &end, kAppendEnd);
for (const byte* i = start; i < end; i++) {
+ FunctionBody body(sigs.v_v(), 0, start, i);
+ WasmFeatures unused_detected_features;
DecodeResult result =
- VerifyWasmCode(zone()->allocator(), nullptr, sigs.v_v(), start, i);
+ VerifyWasmCode(zone()->allocator(), kAllWasmFeatures, nullptr,
+ &unused_detected_features, body);
if (result.ok()) {
std::ostringstream str;
str << "Expected verification to fail";
@@ -2999,6 +3019,7 @@ typedef ZoneVector<ValueType> TypesOfLocals;
class LocalDeclDecoderTest : public TestWithZone {
public:
v8::internal::AccountingAllocator allocator;
+ WasmFeatures enabled_features_;
size_t ExpectRun(TypesOfLocals map, size_t pos, ValueType expected,
size_t count) {
@@ -3007,6 +3028,11 @@ class LocalDeclDecoderTest : public TestWithZone {
}
return pos;
}
+
+ bool DecodeLocalDecls(BodyLocalDecls* decls, const byte* start,
+ const byte* end) {
+ return i::wasm::DecodeLocalDecls(enabled_features_, decls, start, end);
+ }
};
TEST_F(LocalDeclDecoderTest, EmptyLocals) {
@@ -3024,7 +3050,7 @@ TEST_F(LocalDeclDecoderTest, NoLocals) {
}
TEST_F(LocalDeclDecoderTest, OneLocal) {
- EXPERIMENTAL_FLAG_SCOPE(anyref);
+ WASM_FEATURE_SCOPE(anyref);
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
ValueType type = kValueTypes[i];
const byte data[] = {1, 1,
@@ -3040,7 +3066,7 @@ TEST_F(LocalDeclDecoderTest, OneLocal) {
}
TEST_F(LocalDeclDecoderTest, FiveLocals) {
- EXPERIMENTAL_FLAG_SCOPE(anyref);
+ WASM_FEATURE_SCOPE(anyref);
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
ValueType type = kValueTypes[i];
const byte data[] = {1, 5,
@@ -3180,6 +3206,7 @@ TEST_F(BytecodeIteratorTest, WithLocalDecls) {
EXPECT_FALSE(iter.has_next());
}
+#undef WASM_FEATURE_SCOPE
#undef B1
#undef B2
#undef B3
diff --git a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc
index 26b4f74a7a..3507f897f9 100644
--- a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc
+++ b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc
@@ -7,6 +7,7 @@
#include "src/handles.h"
#include "src/objects-inl.h"
#include "src/wasm/module-decoder.h"
+#include "src/wasm/wasm-features.h"
#include "src/wasm/wasm-limits.h"
#include "src/wasm/wasm-opcodes.h"
#include "test/common/wasm/flag-utils.h"
@@ -146,6 +147,8 @@ struct ValueTypePair {
class WasmModuleVerifyTest : public TestWithIsolateAndZone {
public:
+ WasmFeatures enabled_features_;
+
ModuleResult DecodeModule(const byte* module_start, const byte* module_end) {
// Add the wasm magic and version number automatically.
size_t size = static_cast<size_t>(module_end - module_start);
@@ -154,18 +157,39 @@ class WasmModuleVerifyTest : public TestWithIsolateAndZone {
auto temp = new byte[total];
memcpy(temp, header, sizeof(header));
memcpy(temp + sizeof(header), module_start, size);
- ModuleResult result =
- SyncDecodeWasmModule(isolate(), temp, temp + total, false, kWasmOrigin);
+ ModuleResult result = DecodeWasmModule(
+ enabled_features_, temp, temp + total, false, kWasmOrigin,
+ isolate()->counters(), isolate()->allocator());
delete[] temp;
return result;
}
ModuleResult DecodeModuleNoHeader(const byte* module_start,
const byte* module_end) {
- return SyncDecodeWasmModule(isolate(), module_start, module_end, false,
- kWasmOrigin);
+ return DecodeWasmModule(enabled_features_, module_start, module_end, false,
+ kWasmOrigin, isolate()->counters(),
+ isolate()->allocator());
+ }
+};
+
+namespace {
+class EnableBoolScope {
+ public:
+ bool prev_;
+ bool* ptr_;
+ explicit EnableBoolScope(bool* ptr, bool val = true)
+ : prev_(*ptr), ptr_(ptr) {
+ *ptr = val;
}
+ ~EnableBoolScope() { *ptr_ = prev_; }
};
+#define WASM_FEATURE_SCOPE(feat) \
+ EnableBoolScope feat##_scope(&this->enabled_features_.feat)
+
+#define WASM_FEATURE_SCOPE_VAL(feat, val) \
+ EnableBoolScope feat##_scope(&this->enabled_features_.feat, val)
+} // namespace
+
TEST_F(WasmModuleVerifyTest, WrongMagic) {
for (uint32_t x = 1; x; x <<= 1) {
const byte data[] = {U32_LE(kWasmMagic ^ x), U32_LE(kWasmVersion)};
@@ -217,7 +241,7 @@ TEST_F(WasmModuleVerifyTest, OneGlobal) {
}
TEST_F(WasmModuleVerifyTest, AnyRefGlobal) {
- EXPERIMENTAL_FLAG_SCOPE(anyref);
+ WASM_FEATURE_SCOPE(anyref);
static const byte data[] = {
SECTION(Global, 5), // --
1,
@@ -243,7 +267,7 @@ TEST_F(WasmModuleVerifyTest, AnyRefGlobal) {
}
TEST_F(WasmModuleVerifyTest, AnyRefGlobalWithGlobalInit) {
- EXPERIMENTAL_FLAG_SCOPE(anyref);
+ WASM_FEATURE_SCOPE(anyref);
static const byte data[] = {
SECTION(Import, 8), // section header
1, // number of imports
@@ -313,6 +337,7 @@ TEST_F(WasmModuleVerifyTest, ZeroGlobals) {
}
TEST_F(WasmModuleVerifyTest, ExportMutableGlobal) {
+ WASM_FEATURE_SCOPE(mut_global);
{
static const byte data[] = {
SECTION(Global, 6), // --
@@ -444,7 +469,7 @@ TEST_F(WasmModuleVerifyTest, ZeroExceptions) {
};
FAIL_IF_NO_EXPERIMENTAL_EH(data);
- EXPERIMENTAL_FLAG_SCOPE(eh);
+ WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_OK(result);
EXPECT_EQ(0u, result.val->exceptions.size());
@@ -458,7 +483,7 @@ TEST_F(WasmModuleVerifyTest, OneI32Exception) {
};
FAIL_IF_NO_EXPERIMENTAL_EH(data);
- EXPERIMENTAL_FLAG_SCOPE(eh);
+ WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_OK(result);
EXPECT_EQ(1u, result.val->exceptions.size());
@@ -476,7 +501,7 @@ TEST_F(WasmModuleVerifyTest, TwoExceptions) {
1, kLocalI32};
FAIL_IF_NO_EXPERIMENTAL_EH(data);
- EXPERIMENTAL_FLAG_SCOPE(eh);
+ WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_OK(result);
EXPECT_EQ(2u, result.val->exceptions.size());
@@ -495,7 +520,7 @@ TEST_F(WasmModuleVerifyTest, Exception_invalid_type) {
FAIL_IF_NO_EXPERIMENTAL_EH(data);
// Should fail decoding exception section.
- EXPERIMENTAL_FLAG_SCOPE(eh);
+ WASM_FEATURE_SCOPE(eh);
ModuleResult result = DecodeModule(data, data + sizeof(data));
EXPECT_FALSE(result.ok());
}
@@ -939,7 +964,7 @@ TEST_F(WasmModuleVerifyTest, MultipleIndirectFunctions) {
TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTables) {
// Test that if we have multiple tables, in the element section we can target
// and initialize all tables.
- FlagScope<bool> flag_scope(&FLAG_experimental_wasm_anyref, true);
+ WASM_FEATURE_SCOPE(anyref);
static const byte data[] = {
// sig#0 ---------------------------------------------------------------
SIGNATURES_SECTION_VOID_VOID,
@@ -969,7 +994,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTables) {
TEST_F(WasmModuleVerifyTest, ElementSectionMixedTables) {
// Test that if we have multiple tables, both imported and module-defined, in
// the element section we can target and initialize all tables.
- FlagScope<bool> flag_scope(&FLAG_experimental_wasm_anyref, true);
+ WASM_FEATURE_SCOPE(anyref);
static const byte data[] = {
// sig#0 ---------------------------------------------------------------
SIGNATURES_SECTION_VOID_VOID,
@@ -1026,7 +1051,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMixedTables) {
TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTablesArbitraryOrder) {
// Test that the order in which tables are targeted in the element secion
// can be arbitrary.
- FlagScope<bool> flag_scope(&FLAG_experimental_wasm_anyref, true);
+ WASM_FEATURE_SCOPE(anyref);
static const byte data[] = {
// sig#0 ---------------------------------------------------------------
SIGNATURES_SECTION_VOID_VOID,
@@ -1060,7 +1085,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMultipleTablesArbitraryOrder) {
TEST_F(WasmModuleVerifyTest, ElementSectionMixedTablesArbitraryOrder) {
// Test that the order in which tables are targeted in the element secion can
// be arbitrary. In this test, tables can be both imported and module-defined.
- FlagScope<bool> flag_scope(&FLAG_experimental_wasm_anyref, true);
+ WASM_FEATURE_SCOPE(anyref);
static const byte data[] = {
// sig#0 ---------------------------------------------------------------
SIGNATURES_SECTION_VOID_VOID,
@@ -1117,7 +1142,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionMixedTablesArbitraryOrder) {
TEST_F(WasmModuleVerifyTest, ElementSectionDontInitAnyRefTable) {
// Test that tables of type 'AnyRef' cannot be initialized by the element
// section.
- FlagScope<bool> flag_scope(&FLAG_experimental_wasm_anyref, true);
+ WASM_FEATURE_SCOPE(anyref);
static const byte data[] = {
// sig#0 ---------------------------------------------------------------
SIGNATURES_SECTION_VOID_VOID,
@@ -1147,7 +1172,7 @@ TEST_F(WasmModuleVerifyTest, ElementSectionDontInitAnyRefTable) {
TEST_F(WasmModuleVerifyTest, ElementSectionDontInitAnyRefImportedTable) {
// Test that imported tables of type AnyRef cannot be initialized in the
// elements section.
- FlagScope<bool> flag_scope(&FLAG_experimental_wasm_anyref, true);
+ WASM_FEATURE_SCOPE(anyref);
static const byte data[] = {
// sig#0 ---------------------------------------------------------------
SIGNATURES_SECTION_VOID_VOID,
@@ -1231,7 +1256,7 @@ TEST_F(WasmModuleVerifyTest, MultipleTablesWithoutFlag) {
}
TEST_F(WasmModuleVerifyTest, MultipleTablesWithFlag) {
- FlagScope<bool> flag_scope(&FLAG_experimental_wasm_anyref, true);
+ WASM_FEATURE_SCOPE(anyref);
static const byte data[] = {
SECTION(Table, 7), // table section
ENTRY_COUNT(2), // 2 tables
@@ -1257,22 +1282,18 @@ TEST_F(WasmModuleVerifyTest, MultipleTablesWithFlag) {
class WasmSignatureDecodeTest : public TestWithZone {
public:
- WasmSignatureDecodeTest()
- // In the following tests we turn on support for AnyRef by default. There
- // is a test (Fail_anyref_without_flag) which explicitly turns off support
- // for AnyRef.
- : flag_scope(&FLAG_experimental_wasm_anyref, true) {}
-
- private:
- FlagScope<bool> flag_scope;
+ WasmFeatures enabled_features_;
+
+ FunctionSig* DecodeSig(const byte* start, const byte* end) {
+ return DecodeWasmSignatureForTesting(enabled_features_, zone(), start, end);
+ }
};
TEST_F(WasmSignatureDecodeTest, Ok_v_v) {
static const byte data[] = {SIG_ENTRY_v_v};
v8::internal::AccountingAllocator allocator;
Zone zone(&allocator, ZONE_NAME);
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(&zone, data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_TRUE(sig != nullptr);
EXPECT_EQ(0u, sig->parameter_count());
@@ -1280,11 +1301,11 @@ TEST_F(WasmSignatureDecodeTest, Ok_v_v) {
}
TEST_F(WasmSignatureDecodeTest, Ok_t_v) {
+ WASM_FEATURE_SCOPE(anyref);
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
ValueTypePair ret_type = kValueTypes[i];
const byte data[] = {SIG_ENTRY_x(ret_type.code)};
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_TRUE(sig != nullptr);
EXPECT_EQ(0u, sig->parameter_count());
@@ -1294,11 +1315,11 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_v) {
}
TEST_F(WasmSignatureDecodeTest, Ok_v_t) {
+ WASM_FEATURE_SCOPE(anyref);
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
ValueTypePair param_type = kValueTypes[i];
const byte data[] = {SIG_ENTRY_v_x(param_type.code)};
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_TRUE(sig != nullptr);
EXPECT_EQ(1u, sig->parameter_count());
@@ -1308,13 +1329,13 @@ TEST_F(WasmSignatureDecodeTest, Ok_v_t) {
}
TEST_F(WasmSignatureDecodeTest, Ok_t_t) {
+ WASM_FEATURE_SCOPE(anyref);
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
ValueTypePair ret_type = kValueTypes[i];
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
ValueTypePair param_type = kValueTypes[j];
const byte data[] = {SIG_ENTRY_x_x(ret_type.code, param_type.code)};
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_TRUE(sig != nullptr);
EXPECT_EQ(1u, sig->parameter_count());
@@ -1326,14 +1347,15 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_t) {
}
TEST_F(WasmSignatureDecodeTest, Ok_i_tt) {
+ WASM_FEATURE_SCOPE(anyref);
+ WASM_FEATURE_SCOPE(mv);
for (size_t i = 0; i < arraysize(kValueTypes); i++) {
ValueTypePair p0_type = kValueTypes[i];
for (size_t j = 0; j < arraysize(kValueTypes); j++) {
ValueTypePair p1_type = kValueTypes[j];
const byte data[] = {
SIG_ENTRY_x_xx(kLocalI32, p0_type.code, p1_type.code)};
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_TRUE(sig != nullptr);
EXPECT_EQ(2u, sig->parameter_count());
@@ -1344,25 +1366,45 @@ TEST_F(WasmSignatureDecodeTest, Ok_i_tt) {
}
}
+TEST_F(WasmSignatureDecodeTest, Ok_tt_tt) {
+ WASM_FEATURE_SCOPE(anyref);
+ WASM_FEATURE_SCOPE(mv);
+ for (size_t i = 0; i < arraysize(kValueTypes); i++) {
+ ValueTypePair p0_type = kValueTypes[i];
+ for (size_t j = 0; j < arraysize(kValueTypes); j++) {
+ ValueTypePair p1_type = kValueTypes[j];
+ const byte data[] = {SIG_ENTRY_xx_xx(p0_type.code, p1_type.code,
+ p0_type.code, p1_type.code)};
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
+
+ EXPECT_TRUE(sig != nullptr);
+ EXPECT_EQ(2u, sig->parameter_count());
+ EXPECT_EQ(2u, sig->return_count());
+ EXPECT_EQ(p0_type.type, sig->GetParam(0));
+ EXPECT_EQ(p1_type.type, sig->GetParam(1));
+ EXPECT_EQ(p0_type.type, sig->GetReturn(0));
+ EXPECT_EQ(p1_type.type, sig->GetReturn(1));
+ }
+ }
+}
+
TEST_F(WasmSignatureDecodeTest, TooManyParams) {
static const byte data[] = {kWasmFunctionTypeCode,
WASM_I32V_3(kV8MaxWasmFunctionParams + 1),
kLocalI32, 0};
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_FALSE(sig != nullptr);
}
TEST_F(WasmSignatureDecodeTest, TooManyReturns) {
for (int i = 0; i < 2; i++) {
- FlagScope<bool> flag_scope(&FLAG_experimental_wasm_mv, i != 0);
+ bool enable_mv = i != 0;
+ WASM_FEATURE_SCOPE_VAL(mv, enable_mv);
const int max_return_count = static_cast<int>(
- FLAG_experimental_wasm_mv ? kV8MaxWasmFunctionMultiReturns
- : kV8MaxWasmFunctionReturns);
+ enable_mv ? kV8MaxWasmFunctionMultiReturns : kV8MaxWasmFunctionReturns);
byte data[] = {kWasmFunctionTypeCode, 0, WASM_I32V_3(max_return_count + 1),
kLocalI32};
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_EQ(nullptr, sig);
}
}
@@ -1375,7 +1417,7 @@ TEST_F(WasmSignatureDecodeTest, Fail_off_end) {
for (int i = 0; i < p + 1; i++) {
// Should fall off the end for all signatures.
- FunctionSig* sig = DecodeWasmSignatureForTesting(zone(), data, data + i);
+ FunctionSig* sig = DecodeSig(data, data + i);
EXPECT_EQ(nullptr, sig);
}
}
@@ -1383,14 +1425,13 @@ TEST_F(WasmSignatureDecodeTest, Fail_off_end) {
TEST_F(WasmSignatureDecodeTest, Fail_anyref_without_flag) {
// Disable AnyRef support and check that decoding fails.
- FlagScope<bool> flag_scope(&FLAG_experimental_wasm_anyref, false);
+ WASM_FEATURE_SCOPE_VAL(anyref, false);
byte ref_types[] = {kLocalAnyFunc, kLocalAnyRef};
for (byte invalid_type : ref_types) {
for (size_t i = 0; i < SIZEOF_SIG_ENTRY_x_xx; i++) {
byte data[] = {SIG_ENTRY_x_xx(kLocalI32, kLocalI32, kLocalI32)};
data[i] = invalid_type;
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_EQ(nullptr, sig);
}
}
@@ -1401,41 +1442,43 @@ TEST_F(WasmSignatureDecodeTest, Fail_invalid_type) {
for (size_t i = 0; i < SIZEOF_SIG_ENTRY_x_xx; i++) {
byte data[] = {SIG_ENTRY_x_xx(kLocalI32, kLocalI32, kLocalI32)};
data[i] = kInvalidType;
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_EQ(nullptr, sig);
}
}
TEST_F(WasmSignatureDecodeTest, Fail_invalid_ret_type1) {
static const byte data[] = {SIG_ENTRY_x_x(kLocalVoid, kLocalI32)};
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_EQ(nullptr, sig);
}
TEST_F(WasmSignatureDecodeTest, Fail_invalid_param_type1) {
static const byte data[] = {SIG_ENTRY_x_x(kLocalI32, kLocalVoid)};
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_EQ(nullptr, sig);
}
TEST_F(WasmSignatureDecodeTest, Fail_invalid_param_type2) {
static const byte data[] = {SIG_ENTRY_x_xx(kLocalI32, kLocalI32, kLocalVoid)};
- FunctionSig* sig =
- DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data));
+ FunctionSig* sig = DecodeSig(data, data + sizeof(data));
EXPECT_EQ(nullptr, sig);
}
class WasmFunctionVerifyTest : public TestWithIsolateAndZone {
public:
- WasmFunctionVerifyTest() {}
- virtual ~WasmFunctionVerifyTest() {}
-
+ WasmFeatures enabled_features_;
WasmModule module;
Vector<const byte> bytes;
- DISALLOW_COPY_AND_ASSIGN(WasmFunctionVerifyTest);
+
+ FunctionResult DecodeWasmFunction(const ModuleWireBytes& wire_bytes,
+ const WasmModule* module,
+ const byte* function_start,
+ const byte* function_end) {
+ return DecodeWasmFunctionForTesting(enabled_features_, zone(), wire_bytes,
+ module, function_start, function_end,
+ isolate()->counters());
+ }
};
TEST_F(WasmFunctionVerifyTest, Ok_v_v_empty) {
@@ -1453,8 +1496,8 @@ TEST_F(WasmFunctionVerifyTest, Ok_v_v_empty) {
kExprEnd // body
};
- FunctionResult result = SyncDecodeWasmFunction(
- isolate(), zone(), bytes, &module, data, data + sizeof(data));
+ FunctionResult result =
+ DecodeWasmFunction(bytes, &module, data, data + sizeof(data));
EXPECT_OK(result);
if (result.val && result.ok()) {
@@ -1583,6 +1626,7 @@ TEST_F(WasmModuleVerifyTest, ImportTable_nosigs1) {
}
TEST_F(WasmModuleVerifyTest, ImportTable_mutable_global) {
+ WASM_FEATURE_SCOPE(mut_global);
{
static const byte data[] = {
SECTION(Import, 8), // section header
@@ -1614,6 +1658,7 @@ TEST_F(WasmModuleVerifyTest, ImportTable_mutable_global) {
}
TEST_F(WasmModuleVerifyTest, ImportTable_mutability_malformed) {
+ WASM_FEATURE_SCOPE(mut_global);
static const byte data[] = {
SECTION(Import, 8),
1, // --
@@ -2021,61 +2066,68 @@ TEST_F(WasmModuleVerifyTest, Regression684855) {
EXPECT_VERIFIES(data);
}
-#define EXPECT_INIT_EXPR(Type, type, value, ...) \
- { \
- static const byte data[] = {__VA_ARGS__, kExprEnd}; \
- WasmInitExpr expr = \
- DecodeWasmInitExprForTesting(data, data + sizeof(data)); \
- EXPECT_EQ(WasmInitExpr::k##Type##Const, expr.kind); \
- EXPECT_EQ(value, expr.val.type##_const); \
+class WasmInitExprDecodeTest : public TestWithZone {
+ public:
+ WasmInitExprDecodeTest() {}
+
+ WasmFeatures enabled_features_;
+
+ WasmInitExpr DecodeInitExpr(const byte* start, const byte* end) {
+ return DecodeWasmInitExprForTesting(enabled_features_, start, end);
+ }
+};
+
+#define EXPECT_INIT_EXPR(Type, type, value, ...) \
+ { \
+ static const byte data[] = {__VA_ARGS__, kExprEnd}; \
+ WasmInitExpr expr = DecodeInitExpr(data, data + sizeof(data)); \
+ EXPECT_EQ(WasmInitExpr::k##Type##Const, expr.kind); \
+ EXPECT_EQ(value, expr.val.type##_const); \
}
-TEST_F(WasmModuleVerifyTest, InitExpr_i32) {
+#define EXPECT_INIT_EXPR_FAIL(...) \
+ { \
+ static const byte data[] = {__VA_ARGS__, kExprEnd}; \
+ WasmInitExpr expr = DecodeInitExpr(data, data + sizeof(data)); \
+ EXPECT_EQ(WasmInitExpr::kNone, expr.kind); \
+ }
+
+TEST_F(WasmInitExprDecodeTest, InitExpr_i32) {
EXPECT_INIT_EXPR(I32, i32, 33, WASM_I32V_1(33));
EXPECT_INIT_EXPR(I32, i32, -21, WASM_I32V_1(-21));
EXPECT_INIT_EXPR(I32, i32, 437, WASM_I32V_2(437));
EXPECT_INIT_EXPR(I32, i32, 77777, WASM_I32V_3(77777));
}
-TEST_F(WasmModuleVerifyTest, InitExpr_f32) {
+TEST_F(WasmInitExprDecodeTest, InitExpr_f32) {
EXPECT_INIT_EXPR(F32, f32, static_cast<float>(13.1), WASM_F32(13.1));
EXPECT_INIT_EXPR(F32, f32, static_cast<float>(-21.1), WASM_F32(-21.1));
EXPECT_INIT_EXPR(F32, f32, static_cast<float>(437.2), WASM_F32(437.2));
EXPECT_INIT_EXPR(F32, f32, static_cast<float>(77777.3), WASM_F32(77777.3));
}
-TEST_F(WasmModuleVerifyTest, InitExpr_i64) {
+TEST_F(WasmInitExprDecodeTest, InitExpr_i64) {
EXPECT_INIT_EXPR(I64, i64, 33, WASM_I64V_1(33));
EXPECT_INIT_EXPR(I64, i64, -21, WASM_I64V_2(-21));
EXPECT_INIT_EXPR(I64, i64, 437, WASM_I64V_5(437));
EXPECT_INIT_EXPR(I64, i64, 77777, WASM_I64V_7(77777));
}
-TEST_F(WasmModuleVerifyTest, InitExpr_f64) {
+TEST_F(WasmInitExprDecodeTest, InitExpr_f64) {
EXPECT_INIT_EXPR(F64, f64, 83.22, WASM_F64(83.22));
EXPECT_INIT_EXPR(F64, f64, -771.3, WASM_F64(-771.3));
EXPECT_INIT_EXPR(F64, f64, 43703.0, WASM_F64(43703.0));
EXPECT_INIT_EXPR(F64, f64, 77999.1, WASM_F64(77999.1));
}
-TEST_F(WasmModuleVerifyTest, InitExpr_AnyRef) {
- EXPERIMENTAL_FLAG_SCOPE(anyref);
+TEST_F(WasmInitExprDecodeTest, InitExpr_AnyRef) {
+ WASM_FEATURE_SCOPE(anyref);
static const byte data[] = {kExprRefNull, kExprEnd};
- WasmInitExpr expr = DecodeWasmInitExprForTesting(data, data + sizeof(data));
+ WasmInitExpr expr = DecodeInitExpr(data, data + sizeof(data));
EXPECT_EQ(WasmInitExpr::kAnyRefConst, expr.kind);
}
-#undef EXPECT_INIT_EXPR
-
-#define EXPECT_INIT_EXPR_FAIL(...) \
- { \
- static const byte data[] = {__VA_ARGS__, kExprEnd}; \
- WasmInitExpr expr = \
- DecodeWasmInitExprForTesting(data, data + sizeof(data)); \
- EXPECT_EQ(WasmInitExpr::kNone, expr.kind); \
- }
-
-TEST_F(WasmModuleVerifyTest, InitExpr_illegal) {
+TEST_F(WasmInitExprDecodeTest, InitExpr_illegal) {
EXPECT_INIT_EXPR_FAIL(WASM_I32V_1(0), WASM_I32V_1(0));
EXPECT_INIT_EXPR_FAIL(WASM_GET_LOCAL(0));
EXPECT_INIT_EXPR_FAIL(WASM_SET_LOCAL(0, WASM_I32V_1(0)));
@@ -2083,8 +2135,6 @@ TEST_F(WasmModuleVerifyTest, InitExpr_illegal) {
EXPECT_INIT_EXPR_FAIL(WASM_IF_ELSE(WASM_ZERO, WASM_ZERO, WASM_ZERO));
}
-#undef EXPECT_INIT_EXPR_FAIL
-
TEST_F(WasmModuleVerifyTest, Multiple_Named_Sections) {
static const byte data[] = {
SECTION(Unknown, 4), 1, 'X', 17, 18, // --
@@ -2173,6 +2223,10 @@ TEST_F(WasmModuleCustomSectionTest, TwoKnownTwoUnknownSections) {
CheckSections(data, data + sizeof(data), expected, arraysize(expected));
}
+#undef WASM_FEATURE_SCOPE
+#undef WASM_FEATURE_SCOPE_VAL
+#undef EXPECT_INIT_EXPR
+#undef EXPECT_INIT_EXPR_FAIL
#undef WASM_INIT_EXPR_I32V_1
#undef WASM_INIT_EXPR_I32V_2
#undef WASM_INIT_EXPR_I32V_3
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 c05a13c431..cc66f14d9c 100644
--- a/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc
+++ b/deps/v8/test/unittests/wasm/wasm-code-manager-unittest.cc
@@ -8,6 +8,7 @@
#include "src/wasm/function-compiler.h"
#include "src/wasm/jump-table-assembler.h"
#include "src/wasm/wasm-code-manager.h"
+#include "src/wasm/wasm-memory.h"
namespace v8 {
namespace internal {
@@ -157,7 +158,7 @@ class WasmCodeManagerTest : public TestWithContext,
public:
static constexpr uint32_t kNumFunctions = 10;
static constexpr uint32_t kJumpTableSize = RoundUp<kCodeAlignment>(
- kNumFunctions * JumpTableAssembler::kJumpTableSlotSize);
+ JumpTableAssembler::SizeForNumberOfSlots(kNumFunctions));
using NativeModulePtr = std::unique_ptr<NativeModule>;
@@ -166,10 +167,10 @@ class WasmCodeManagerTest : public TestWithContext,
std::shared_ptr<WasmModule> module(new WasmModule);
module->num_declared_functions = kNumFunctions;
bool can_request_more = style == Growable;
- wasm::ModuleEnv env(module.get(), UseTrapHandler::kNoTrapHandler,
- RuntimeExceptionSupport::kNoRuntimeExceptionSupport);
- return manager->NewNativeModule(i_isolate(), size, can_request_more,
- std::move(module), env);
+ ModuleEnv env(module.get(), UseTrapHandler::kNoTrapHandler,
+ RuntimeExceptionSupport::kNoRuntimeExceptionSupport);
+ return manager->NewNativeModule(i_isolate(), kAllWasmFeatures, size,
+ can_request_more, std::move(module), env);
}
WasmCode* AddCode(NativeModule* native_module, uint32_t index, size_t size) {
@@ -183,6 +184,11 @@ class WasmCodeManagerTest : public TestWithContext,
}
size_t page() const { return AllocatePageSize(); }
+
+ WasmMemoryTracker* memory_tracker() { return &memory_tracker_; }
+
+ private:
+ WasmMemoryTracker memory_tracker_;
};
INSTANTIATE_TEST_CASE_P(Parameterized, WasmCodeManagerTest,
@@ -190,7 +196,7 @@ INSTANTIATE_TEST_CASE_P(Parameterized, WasmCodeManagerTest,
PrintWasmCodeManageTestParam);
TEST_P(WasmCodeManagerTest, EmptyCase) {
- WasmCodeManager manager(0 * page());
+ WasmCodeManager manager(memory_tracker(), 0 * page());
CHECK_EQ(0, manager.remaining_uncommitted_code_space());
ASSERT_DEATH_IF_SUPPORTED(AllocModule(&manager, 1 * page(), GetParam()),
@@ -198,7 +204,7 @@ TEST_P(WasmCodeManagerTest, EmptyCase) {
}
TEST_P(WasmCodeManagerTest, AllocateAndGoOverLimit) {
- WasmCodeManager manager(1 * page());
+ WasmCodeManager manager(memory_tracker(), 1 * page());
CHECK_EQ(1 * page(), manager.remaining_uncommitted_code_space());
NativeModulePtr native_module = AllocModule(&manager, 1 * page(), GetParam());
CHECK(native_module);
@@ -223,7 +229,7 @@ TEST_P(WasmCodeManagerTest, AllocateAndGoOverLimit) {
}
TEST_P(WasmCodeManagerTest, TotalLimitIrrespectiveOfModuleCount) {
- WasmCodeManager manager(3 * page());
+ WasmCodeManager manager(memory_tracker(), 3 * page());
NativeModulePtr nm1 = AllocModule(&manager, 2 * page(), GetParam());
NativeModulePtr nm2 = AllocModule(&manager, 2 * page(), GetParam());
CHECK(nm1);
@@ -235,8 +241,8 @@ TEST_P(WasmCodeManagerTest, TotalLimitIrrespectiveOfModuleCount) {
}
TEST_P(WasmCodeManagerTest, DifferentHeapsApplyLimitsIndependently) {
- WasmCodeManager manager1(1 * page());
- WasmCodeManager manager2(2 * page());
+ WasmCodeManager manager1(memory_tracker(), 1 * page());
+ WasmCodeManager manager2(memory_tracker(), 2 * page());
NativeModulePtr nm1 = AllocModule(&manager1, 1 * page(), GetParam());
NativeModulePtr nm2 = AllocModule(&manager2, 1 * page(), GetParam());
CHECK(nm1);
@@ -249,7 +255,7 @@ TEST_P(WasmCodeManagerTest, DifferentHeapsApplyLimitsIndependently) {
}
TEST_P(WasmCodeManagerTest, GrowingVsFixedModule) {
- WasmCodeManager manager(3 * page());
+ WasmCodeManager manager(memory_tracker(), 3 * page());
NativeModulePtr nm = AllocModule(&manager, 1 * page(), GetParam());
size_t module_size = GetParam() == Fixed ? kMaxWasmCodeMemory : 1 * page();
size_t remaining_space_in_module = module_size - kJumpTableSize;
@@ -268,7 +274,7 @@ TEST_P(WasmCodeManagerTest, GrowingVsFixedModule) {
}
TEST_P(WasmCodeManagerTest, CommitIncrements) {
- WasmCodeManager manager(10 * page());
+ WasmCodeManager manager(memory_tracker(), 10 * page());
NativeModulePtr nm = AllocModule(&manager, 3 * page(), GetParam());
WasmCode* code = AddCode(nm.get(), 0, kCodeAlignment);
CHECK_NOT_NULL(code);
@@ -282,7 +288,7 @@ TEST_P(WasmCodeManagerTest, CommitIncrements) {
}
TEST_P(WasmCodeManagerTest, Lookup) {
- WasmCodeManager manager(2 * page());
+ WasmCodeManager manager(memory_tracker(), 2 * page());
NativeModulePtr nm1 = AllocModule(&manager, 1 * page(), GetParam());
NativeModulePtr nm2 = AllocModule(&manager, 1 * page(), GetParam());
@@ -321,8 +327,8 @@ TEST_P(WasmCodeManagerTest, Lookup) {
}
TEST_P(WasmCodeManagerTest, MultiManagerLookup) {
- WasmCodeManager manager1(2 * page());
- WasmCodeManager manager2(2 * page());
+ WasmCodeManager manager1(memory_tracker(), 2 * page());
+ WasmCodeManager manager2(memory_tracker(), 2 * page());
NativeModulePtr nm1 = AllocModule(&manager1, 1 * page(), GetParam());
NativeModulePtr nm2 = AllocModule(&manager2, 1 * page(), GetParam());
@@ -344,7 +350,7 @@ TEST_P(WasmCodeManagerTest, MultiManagerLookup) {
}
TEST_P(WasmCodeManagerTest, LookupWorksAfterRewrite) {
- WasmCodeManager manager(2 * page());
+ WasmCodeManager manager(memory_tracker(), 2 * page());
NativeModulePtr nm1 = AllocModule(&manager, 1 * page(), GetParam());
diff --git a/deps/v8/test/unittests/zone/zone-chunk-list-unittest.cc b/deps/v8/test/unittests/zone/zone-chunk-list-unittest.cc
index 0883dd9538..d982c1e0ec 100644
--- a/deps/v8/test/unittests/zone/zone-chunk-list-unittest.cc
+++ b/deps/v8/test/unittests/zone/zone-chunk-list-unittest.cc
@@ -280,5 +280,77 @@ TEST(ZoneChunkList, PushBackPopBackSize) {
CHECK_EQ(size_t(0), zone_chunk_list.size());
}
+TEST(ZoneChunkList, AdvanceZeroTest) {
+ AccountingAllocator allocator;
+ Zone zone(&allocator, ZONE_NAME);
+
+ ZoneChunkList<uintptr_t> zone_chunk_list(&zone);
+
+ for (size_t i = 0; i < kItemCount; ++i) {
+ zone_chunk_list.push_back(static_cast<uintptr_t>(i));
+ }
+
+ auto iterator_advance = zone_chunk_list.begin();
+
+ iterator_advance.Advance(0);
+
+ CHECK_EQ(iterator_advance, zone_chunk_list.begin());
+}
+
+TEST(ZoneChunkList, AdvancePartwayTest) {
+ AccountingAllocator allocator;
+ Zone zone(&allocator, ZONE_NAME);
+
+ ZoneChunkList<uintptr_t> zone_chunk_list(&zone);
+
+ for (size_t i = 0; i < kItemCount; ++i) {
+ zone_chunk_list.push_back(static_cast<uintptr_t>(i));
+ }
+
+ auto iterator_advance = zone_chunk_list.begin();
+ auto iterator_one_by_one = zone_chunk_list.begin();
+
+ iterator_advance.Advance(kItemCount / 2);
+ for (size_t i = 0; i < kItemCount / 2; ++i) {
+ ++iterator_one_by_one;
+ }
+
+ CHECK_EQ(iterator_advance, iterator_one_by_one);
+}
+
+TEST(ZoneChunkList, AdvanceEndTest) {
+ AccountingAllocator allocator;
+ Zone zone(&allocator, ZONE_NAME);
+
+ ZoneChunkList<uintptr_t> zone_chunk_list(&zone);
+
+ for (size_t i = 0; i < kItemCount; ++i) {
+ zone_chunk_list.push_back(static_cast<uintptr_t>(i));
+ }
+
+ auto iterator_advance = zone_chunk_list.begin();
+
+ iterator_advance.Advance(kItemCount);
+
+ CHECK_EQ(iterator_advance, zone_chunk_list.end());
+}
+
+TEST(ZoneChunkList, FindOverChunkBoundary) {
+ AccountingAllocator allocator;
+ Zone zone(&allocator, ZONE_NAME);
+
+ ZoneChunkList<int> zone_chunk_list(&zone);
+
+ // Make sure we get two chunks.
+ int chunk_size = static_cast<int>(ZoneChunkList<int>::StartMode::kSmall);
+ for (int i = 0; i < chunk_size + 1; ++i) {
+ zone_chunk_list.push_back(i);
+ }
+
+ for (int i = 0; i < chunk_size + 1; ++i) {
+ CHECK_EQ(i, *zone_chunk_list.Find(i));
+ }
+}
+
} // namespace internal
} // namespace v8
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 4bc2a4dba9..1dd1c7217b 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 @@
-9c9ffb1170cc729f41c661299aa2dbfbac6a118a \ No newline at end of file
+7e2cdbd60dd1d10db95fb61b491ebf7b9f2c69e6 \ No newline at end of file
diff --git a/deps/v8/test/webkit/webkit.status b/deps/v8/test/webkit/webkit.status
index 5f2489546f..412784d252 100644
--- a/deps/v8/test/webkit/webkit.status
+++ b/deps/v8/test/webkit/webkit.status
@@ -116,10 +116,10 @@
}], # arch == arm64 and msan
##############################################################################
-['(variant == nooptimization or variant == stress) and (arch == arm or arch == arm64) and simulator_run', {
+['(variant == nooptimization or variant == stress or variant == no_liftoff) and (arch == arm or arch == arm64) and simulator_run', {
# Slow tests: https://crbug.com/v8/7783
'dfg-double-vote-fuzz': [SKIP],
-}], # (variant == nooptimization or variant == stress) and (arch == arm or arch == arm64) and simulator_run
+}], # (variant == nooptimization or variant == stress or variant == no_liftoff) and (arch == arm or arch == arm64) and simulator_run
##############################################################################
['gcov_coverage', {