diff options
Diffstat (limited to 'deps/v8/test')
674 files changed, 41121 insertions, 17450 deletions
diff --git a/deps/v8/test/BUILD.gn b/deps/v8/test/BUILD.gn index 36ca7a2049..e24615a443 100644 --- a/deps/v8/test/BUILD.gn +++ b/deps/v8/test/BUILD.gn @@ -3,6 +3,7 @@ # found in the LICENSE file. import("../gni/isolate.gni") +import("//build_overrides/v8.gni") group("gn_all") { testonly = true @@ -20,6 +21,10 @@ group("gn_all") { ] } + if (v8_enable_inspector_override) { + deps += [ "inspector:inspector-test" ] + } + if (v8_test_isolation_mode != "noop") { deps += [ ":benchmarks_run", diff --git a/deps/v8/test/cctest/BUILD.gn b/deps/v8/test/cctest/BUILD.gn index db94e0c7ff..d2918d90ae 100644 --- a/deps/v8/test/cctest/BUILD.gn +++ b/deps/v8/test/cctest/BUILD.gn @@ -2,42 +2,307 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# The sources are kept automatically in sync with cctest.gyp. - import("../../gni/v8.gni") -gypi_values = exec_script("//build/gypi_to_gn.py", - [ rebase_path("cctest.gyp") ], - "scope", - [ "cctest.gyp" ]) - v8_executable("cctest") { testonly = true - sources = [ "$target_gen_dir/resources.cc" ] + gypi_values.cctest_sources + sources = [ + "$target_gen_dir/resources.cc", + + ### gcmole(all) ### + "asmjs/test-asm-typer.cc", + "ast-types-fuzz.h", + "cctest.cc", + "cctest.h", + "compiler/c-signature.h", + "compiler/call-tester.h", + "compiler/code-assembler-tester.h", + "compiler/codegen-tester.cc", + "compiler/codegen-tester.h", + "compiler/function-tester.cc", + "compiler/function-tester.h", + "compiler/graph-builder-tester.h", + "compiler/test-basic-block-profiler.cc", + "compiler/test-branch-combine.cc", + "compiler/test-code-assembler.cc", + "compiler/test-gap-resolver.cc", + "compiler/test-graph-visualizer.cc", + "compiler/test-instruction.cc", + "compiler/test-js-constant-cache.cc", + "compiler/test-js-context-specialization.cc", + "compiler/test-js-typed-lowering.cc", + "compiler/test-jump-threading.cc", + "compiler/test-linkage.cc", + "compiler/test-loop-analysis.cc", + "compiler/test-loop-assignment-analysis.cc", + "compiler/test-machine-operator-reducer.cc", + "compiler/test-multiple-return.cc", + "compiler/test-node.cc", + "compiler/test-operator.cc", + "compiler/test-osr.cc", + "compiler/test-representation-change.cc", + "compiler/test-run-bytecode-graph-builder.cc", + "compiler/test-run-calls-to-external-references.cc", + "compiler/test-run-deopt.cc", + "compiler/test-run-inlining.cc", + "compiler/test-run-intrinsics.cc", + "compiler/test-run-jsbranches.cc", + "compiler/test-run-jscalls.cc", + "compiler/test-run-jsexceptions.cc", + "compiler/test-run-jsobjects.cc", + "compiler/test-run-jsops.cc", + "compiler/test-run-load-store.cc", + "compiler/test-run-machops.cc", + "compiler/test-run-native-calls.cc", + "compiler/test-run-stackcheck.cc", + "compiler/test-run-stubs.cc", + "compiler/test-run-unwinding-info.cc", + "compiler/test-run-variables.cc", + "compiler/test-run-wasm-machops.cc", + "compiler/value-helper.h", + "expression-type-collector-macros.h", + "gay-fixed.cc", + "gay-fixed.h", + "gay-precision.cc", + "gay-precision.h", + "gay-shortest.cc", + "gay-shortest.h", + "heap/heap-tester.h", + "heap/heap-utils.cc", + "heap/heap-utils.h", + "heap/test-alloc.cc", + "heap/test-array-buffer-tracker.cc", + "heap/test-compaction.cc", + "heap/test-heap.cc", + "heap/test-incremental-marking.cc", + "heap/test-lab.cc", + "heap/test-mark-compact.cc", + "heap/test-page-promotion.cc", + "heap/test-spaces.cc", + "interpreter/bytecode-expectations-printer.cc", + "interpreter/bytecode-expectations-printer.h", + "interpreter/interpreter-tester.cc", + "interpreter/interpreter-tester.h", + "interpreter/source-position-matcher.cc", + "interpreter/source-position-matcher.h", + "interpreter/test-bytecode-generator.cc", + "interpreter/test-interpreter-intrinsics.cc", + "interpreter/test-interpreter.cc", + "interpreter/test-source-positions.cc", + "libplatform/test-tracing.cc", + "libsampler/test-sampler.cc", + "parsing/test-scanner-streams.cc", + "parsing/test-scanner.cc", + "print-extension.cc", + "print-extension.h", + "profiler-extension.cc", + "profiler-extension.h", + "test-access-checks.cc", + "test-accessors.cc", + "test-api-accessors.cc", + "test-api-fast-accessor-builder.cc", + "test-api-interceptors.cc", + "test-api.cc", + "test-api.h", + "test-array-list.cc", + "test-ast-types.cc", + "test-ast.cc", + "test-atomicops.cc", + "test-bignum-dtoa.cc", + "test-bignum.cc", + "test-bit-vector.cc", + "test-circular-queue.cc", + "test-code-cache.cc", + "test-code-layout.cc", + "test-code-stub-assembler.cc", + "test-compiler.cc", + "test-constantpool.cc", + "test-conversions.cc", + "test-cpu-profiler.cc", + "test-date.cc", + "test-debug.cc", + "test-decls.cc", + "test-deoptimization.cc", + "test-dictionary.cc", + "test-diy-fp.cc", + "test-double.cc", + "test-dtoa.cc", + "test-elements-kind.cc", + "test-fast-dtoa.cc", + "test-feedback-vector.cc", + "test-feedback-vector.h", + "test-field-type-tracking.cc", + "test-fixed-dtoa.cc", + "test-flags.cc", + "test-func-name-inference.cc", + "test-global-handles.cc", + "test-global-object.cc", + "test-hashing.cc", + "test-hashmap.cc", + "test-heap-profiler.cc", + "test-hydrogen-types.cc", + "test-identity-map.cc", + "test-inobject-slack-tracking.cc", + "test-list.cc", + "test-liveedit.cc", + "test-lockers.cc", + "test-log.cc", + "test-mementos.cc", + "test-modules.cc", + "test-object.cc", + "test-parsing.cc", + "test-platform.cc", + "test-profile-generator.cc", + "test-random-number-generator.cc", + "test-receiver-check-hidden-prototype.cc", + "test-regexp.cc", + "test-representation.cc", + "test-sampler-api.cc", + "test-serialize.cc", + "test-simd.cc", + "test-strings.cc", + "test-strtod.cc", + "test-symbols.cc", + "test-thread-termination.cc", + "test-threads.cc", + "test-trace-event.cc", + "test-transitions.cc", + "test-typedarrays.cc", + "test-types.cc", + "test-unbound-queue.cc", + "test-unboxed-doubles.cc", + "test-unique.cc", + "test-unscopables-hidden-prototype.cc", + "test-usecounters.cc", + "test-utils.cc", + "test-version.cc", + "test-weakmaps.cc", + "test-weaksets.cc", + "trace-extension.cc", + "trace-extension.h", + "types-fuzz.h", + "wasm/test-run-wasm-64.cc", + "wasm/test-run-wasm-asmjs.cc", + "wasm/test-run-wasm-interpreter.cc", + "wasm/test-run-wasm-js.cc", + "wasm/test-run-wasm-module.cc", + "wasm/test-run-wasm-relocation.cc", + "wasm/test-run-wasm.cc", + "wasm/test-wasm-function-name-table.cc", + "wasm/test-wasm-stack.cc", + "wasm/test-wasm-trap-position.cc", + "wasm/wasm-run-utils.h", + ] if (v8_current_cpu == "arm") { - sources += gypi_values.cctest_sources_arm + sources += [ ### gcmole(arch:arm) ### + "test-assembler-arm.cc", + "test-code-stubs-arm.cc", + "test-code-stubs.cc", + "test-code-stubs.h", + "test-disasm-arm.cc", + "test-macro-assembler-arm.cc", + "test-run-wasm-relocation-arm.cc", + ] } else if (v8_current_cpu == "arm64") { - sources += gypi_values.cctest_sources_arm64 + sources += [ ### gcmole(arch:arm64) ### + "test-assembler-arm64.cc", + "test-code-stubs-arm64.cc", + "test-code-stubs.cc", + "test-code-stubs.h", + "test-disasm-arm64.cc", + "test-fuzz-arm64.cc", + "test-javascript-arm64.cc", + "test-js-arm64-variables.cc", + "test-run-wasm-relocation-arm64.cc", + "test-utils-arm64.cc", + "test-utils-arm64.h", + ] } else if (v8_current_cpu == "x86") { - sources += gypi_values.cctest_sources_ia32 + sources += [ ### gcmole(arch:ia32) ### + "test-assembler-ia32.cc", + "test-code-stubs-ia32.cc", + "test-code-stubs.cc", + "test-code-stubs.h", + "test-disasm-ia32.cc", + "test-log-stack-tracer.cc", + "test-macro-assembler-ia32.cc", + "test-run-wasm-relocation-ia32.cc", + ] } else if (v8_current_cpu == "mips") { - sources += gypi_values.cctest_sources_mips + sources += [ ### gcmole(arch:mips) ### + "test-assembler-mips.cc", + "test-code-stubs-mips.cc", + "test-code-stubs.cc", + "test-code-stubs.h", + "test-disasm-mips.cc", + "test-macro-assembler-mips.cc", + ] } else if (v8_current_cpu == "mipsel") { - sources += gypi_values.cctest_sources_mipsel + sources += [ ### gcmole(arch:mipsel) ### + "test-assembler-mips.cc", + "test-code-stubs-mips.cc", + "test-code-stubs.cc", + "test-code-stubs.h", + "test-disasm-mips.cc", + "test-macro-assembler-mips.cc", + ] } else if (v8_current_cpu == "mips64") { - sources += gypi_values.cctest_sources_mips64 + sources += [ ### gcmole(arch:mips64) ### + "test-assembler-mips64.cc", + "test-code-stubs-mips64.cc", + "test-code-stubs.cc", + "test-code-stubs.h", + "test-disasm-mips64.cc", + "test-macro-assembler-mips64.cc", + ] } else if (v8_current_cpu == "mips64el") { - sources += gypi_values.cctest_sources_mips64el + sources += [ ### gcmole(arch:mips64el) ### + "test-assembler-mips64.cc", + "test-code-stubs-mips64.cc", + "test-code-stubs.cc", + "test-code-stubs.h", + "test-disasm-mips64.cc", + "test-macro-assembler-mips64.cc", + ] } else if (v8_current_cpu == "x64") { - sources += gypi_values.cctest_sources_x64 + sources += [ ### gcmole(arch:x64) ### + "test-assembler-x64.cc", + "test-code-stubs-x64.cc", + "test-code-stubs.cc", + "test-code-stubs.h", + "test-disasm-x64.cc", + "test-log-stack-tracer.cc", + "test-macro-assembler-x64.cc", + "test-run-wasm-relocation-x64.cc", + "wasm/test-run-wasm-simd.cc", + ] } else if (v8_current_cpu == "x87") { - sources += gypi_values.cctest_sources_x87 + sources += [ ### gcmole(arch:x87) ### + "test-assembler-x87.cc", + "test-code-stubs-x87.cc", + "test-code-stubs.cc", + "test-code-stubs.h", + "test-disasm-x87.cc", + "test-log-stack-tracer.cc", + "test-macro-assembler-x87.cc", + "test-run-wasm-relocation-x87.cc", + ] } else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") { - sources += gypi_values.cctest_sources_ppc + sources += [ ### gcmole(arch:ppc) ### + "test-assembler-ppc.cc", + "test-code-stubs.cc", + "test-code-stubs.h", + "test-disasm-ppc.cc", + ] } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") { - sources += gypi_values.cctest_sources_s390 + sources += [ ### gcmole(arch:s390) ### + "test-assembler-s390.cc", + "test-code-stubs.cc", + "test-code-stubs.h", + "test-disasm-s390.cc", + ] } if (is_linux) { @@ -60,6 +325,8 @@ v8_executable("cctest") { deps = [ ":resources", "../..:v8_libplatform", + "../..:wasm_module_runner", + "../..:wasm_test_signatures", "//build/config/sanitizers:deps", "//build/win:default_exe_manifest", ] diff --git a/deps/v8/test/cctest/asmjs/test-asm-typer.cc b/deps/v8/test/cctest/asmjs/test-asm-typer.cc index dcb778533d..a44ecf9283 100644 --- a/deps/v8/test/cctest/asmjs/test-asm-typer.cc +++ b/deps/v8/test/cctest/asmjs/test-asm-typer.cc @@ -276,12 +276,13 @@ class AsmTyperHarnessBuilder { private: Variable* DeclareVariable(VariableName var_name) { auto* name_ast_string = ast_value_factory_.GetOneByteString(var_name.name_); + ast_value_factory_.Internalize(isolate_); return var_name.mode_ == DYNAMIC_GLOBAL ? outer_scope_->DeclareDynamicGlobal(name_ast_string, - Variable::NORMAL) + NORMAL_VARIABLE) : module_->scope()->DeclareLocal(name_ast_string, VAR, kCreatedInitialized, - Variable::NORMAL); + NORMAL_VARIABLE); } bool ValidateAllStatements(FunctionDeclaration* fun_decl) { @@ -514,7 +515,6 @@ TEST(ErrorsInGlobalVariableDefinition) { {"var v = __fround__(1.0);", "expected call fround(literal)"}, {"var v = fround(1.0, 1.0);", "expected call fround(literal)"}, {"var v = fround(not_fround);", "literal argument for call to fround"}, - {"var v = fround(1);", "literal argument to be a floating point"}, {"var v = stdlib.nan", "Invalid import"}, {"var v = stdlib.Math.nan", "Invalid import"}, {"var v = stdlib.Mathh.E", "Invalid import"}, diff --git a/deps/v8/test/cctest/ast-types-fuzz.h b/deps/v8/test/cctest/ast-types-fuzz.h new file mode 100644 index 0000000000..ba6286d54a --- /dev/null +++ b/deps/v8/test/cctest/ast-types-fuzz.h @@ -0,0 +1,327 @@ +// Copyright 2014 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. + +#ifndef V8_TEST_CCTEST_TYPES_H_ +#define V8_TEST_CCTEST_TYPES_H_ + +#include "src/base/utils/random-number-generator.h" +#include "src/factory.h" +#include "src/isolate.h" +#include "src/v8.h" + +namespace v8 { +namespace internal { + +class AstTypes { + public: + AstTypes(Zone* zone, Isolate* isolate, v8::base::RandomNumberGenerator* rng) + : zone_(zone), isolate_(isolate), rng_(rng) { +#define DECLARE_TYPE(name, value) \ + name = AstType::name(); \ + types.push_back(name); + AST_PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) +#undef DECLARE_TYPE + + SignedSmall = AstType::SignedSmall(); + UnsignedSmall = AstType::UnsignedSmall(); + + object_map = + isolate->factory()->NewMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); + array_map = isolate->factory()->NewMap(JS_ARRAY_TYPE, JSArray::kSize); + number_map = + isolate->factory()->NewMap(HEAP_NUMBER_TYPE, HeapNumber::kSize); + uninitialized_map = isolate->factory()->uninitialized_map(); + ObjectClass = AstType::Class(object_map, zone); + ArrayClass = AstType::Class(array_map, zone); + NumberClass = AstType::Class(number_map, zone); + UninitializedClass = AstType::Class(uninitialized_map, zone); + + maps.push_back(object_map); + maps.push_back(array_map); + maps.push_back(uninitialized_map); + for (MapVector::iterator it = maps.begin(); it != maps.end(); ++it) { + types.push_back(AstType::Class(*it, zone)); + } + + smi = handle(Smi::FromInt(666), isolate); + signed32 = isolate->factory()->NewHeapNumber(0x40000000); + object1 = isolate->factory()->NewJSObjectFromMap(object_map); + object2 = isolate->factory()->NewJSObjectFromMap(object_map); + array = isolate->factory()->NewJSArray(20); + uninitialized = isolate->factory()->uninitialized_value(); + SmiConstant = AstType::Constant(smi, zone); + Signed32Constant = AstType::Constant(signed32, zone); + + ObjectConstant1 = AstType::Constant(object1, zone); + ObjectConstant2 = AstType::Constant(object2, zone); + ArrayConstant = AstType::Constant(array, zone); + UninitializedConstant = AstType::Constant(uninitialized, zone); + + values.push_back(smi); + values.push_back(signed32); + values.push_back(object1); + values.push_back(object2); + values.push_back(array); + values.push_back(uninitialized); + for (ValueVector::iterator it = values.begin(); it != values.end(); ++it) { + types.push_back(AstType::Constant(*it, zone)); + } + + integers.push_back(isolate->factory()->NewNumber(-V8_INFINITY)); + integers.push_back(isolate->factory()->NewNumber(+V8_INFINITY)); + integers.push_back(isolate->factory()->NewNumber(-rng_->NextInt(10))); + integers.push_back(isolate->factory()->NewNumber(+rng_->NextInt(10))); + for (int i = 0; i < 10; ++i) { + double x = rng_->NextInt(); + integers.push_back(isolate->factory()->NewNumber(x)); + x *= rng_->NextInt(); + if (!IsMinusZero(x)) integers.push_back(isolate->factory()->NewNumber(x)); + } + + Integer = AstType::Range(-V8_INFINITY, +V8_INFINITY, zone); + + NumberArray = AstType::Array(Number, zone); + StringArray = AstType::Array(String, zone); + AnyArray = AstType::Array(Any, zone); + + SignedFunction1 = AstType::Function(SignedSmall, SignedSmall, zone); + NumberFunction1 = AstType::Function(Number, Number, zone); + NumberFunction2 = AstType::Function(Number, Number, Number, zone); + MethodFunction = AstType::Function(String, Object, 0, zone); + + for (int i = 0; i < 30; ++i) { + types.push_back(Fuzz()); + } + } + + Handle<i::Map> object_map; + Handle<i::Map> array_map; + Handle<i::Map> number_map; + Handle<i::Map> uninitialized_map; + + Handle<i::Smi> smi; + Handle<i::HeapNumber> signed32; + Handle<i::JSObject> object1; + Handle<i::JSObject> object2; + Handle<i::JSArray> array; + Handle<i::Oddball> uninitialized; + +#define DECLARE_TYPE(name, value) AstType* name; + AST_PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) +#undef DECLARE_TYPE + +#define DECLARE_TYPE(name, value) AstType* Mask##name##ForTesting; + AST_MASK_BITSET_TYPE_LIST(DECLARE_TYPE) +#undef DECLARE_TYPE + AstType* SignedSmall; + AstType* UnsignedSmall; + + AstType* ObjectClass; + AstType* ArrayClass; + AstType* NumberClass; + AstType* UninitializedClass; + + AstType* SmiConstant; + AstType* Signed32Constant; + AstType* ObjectConstant1; + AstType* ObjectConstant2; + AstType* ArrayConstant; + AstType* UninitializedConstant; + + AstType* Integer; + + AstType* NumberArray; + AstType* StringArray; + AstType* AnyArray; + + AstType* SignedFunction1; + AstType* NumberFunction1; + AstType* NumberFunction2; + AstType* MethodFunction; + + typedef std::vector<AstType*> TypeVector; + typedef std::vector<Handle<i::Map> > MapVector; + typedef std::vector<Handle<i::Object> > ValueVector; + + TypeVector types; + MapVector maps; + ValueVector values; + ValueVector integers; // "Integer" values used for range limits. + + AstType* Of(Handle<i::Object> value) { return AstType::Of(value, zone_); } + + AstType* NowOf(Handle<i::Object> value) { + return AstType::NowOf(value, zone_); + } + + AstType* Class(Handle<i::Map> map) { return AstType::Class(map, zone_); } + + AstType* Constant(Handle<i::Object> value) { + return AstType::Constant(value, zone_); + } + + AstType* Range(double min, double max) { + return AstType::Range(min, max, zone_); + } + + AstType* Context(AstType* outer) { return AstType::Context(outer, zone_); } + + AstType* Array1(AstType* element) { return AstType::Array(element, zone_); } + + AstType* Function0(AstType* result, AstType* receiver) { + return AstType::Function(result, receiver, 0, zone_); + } + + AstType* Function1(AstType* result, AstType* receiver, AstType* arg) { + AstType* type = AstType::Function(result, receiver, 1, zone_); + type->AsFunction()->InitParameter(0, arg); + return type; + } + + AstType* Function2(AstType* result, AstType* arg1, AstType* arg2) { + return AstType::Function(result, arg1, arg2, zone_); + } + + AstType* Union(AstType* t1, AstType* t2) { + return AstType::Union(t1, t2, zone_); + } + + AstType* Intersect(AstType* t1, AstType* t2) { + return AstType::Intersect(t1, t2, zone_); + } + + AstType* Representation(AstType* t) { + return AstType::Representation(t, zone_); + } + + AstType* Semantic(AstType* t) { return AstType::Semantic(t, zone_); } + + AstType* Random() { + return types[rng_->NextInt(static_cast<int>(types.size()))]; + } + + AstType* Fuzz(int depth = 4) { + switch (rng_->NextInt(depth == 0 ? 3 : 20)) { + case 0: { // bitset +#define COUNT_BITSET_TYPES(type, value) +1 + int n = 0 AST_PROPER_BITSET_TYPE_LIST(COUNT_BITSET_TYPES); +#undef COUNT_BITSET_TYPES + // Pick a bunch of named bitsets and return their intersection. + AstType* result = AstType::Any(); + for (int i = 0, m = 1 + rng_->NextInt(3); i < m; ++i) { + int j = rng_->NextInt(n); +#define PICK_BITSET_TYPE(type, value) \ + if (j-- == 0) { \ + AstType* tmp = AstType::Intersect(result, AstType::type(), zone_); \ + if (tmp->Is(AstType::None()) && i != 0) { \ + break; \ + } else { \ + result = tmp; \ + continue; \ + } \ + } + AST_PROPER_BITSET_TYPE_LIST(PICK_BITSET_TYPE) +#undef PICK_BITSET_TYPE + } + return result; + } + case 1: { // class + int i = rng_->NextInt(static_cast<int>(maps.size())); + return AstType::Class(maps[i], zone_); + } + case 2: { // constant + int i = rng_->NextInt(static_cast<int>(values.size())); + return AstType::Constant(values[i], zone_); + } + case 3: { // range + int i = rng_->NextInt(static_cast<int>(integers.size())); + int j = rng_->NextInt(static_cast<int>(integers.size())); + double min = integers[i]->Number(); + double max = integers[j]->Number(); + if (min > max) std::swap(min, max); + return AstType::Range(min, max, zone_); + } + case 4: { // context + int depth = rng_->NextInt(3); + AstType* type = AstType::Internal(); + for (int i = 0; i < depth; ++i) type = AstType::Context(type, zone_); + return type; + } + case 5: { // array + AstType* element = Fuzz(depth / 2); + return AstType::Array(element, zone_); + } + case 6: + case 7: { // function + AstType* result = Fuzz(depth / 2); + AstType* receiver = Fuzz(depth / 2); + int arity = rng_->NextInt(3); + AstType* type = AstType::Function(result, receiver, arity, zone_); + for (int i = 0; i < type->AsFunction()->Arity(); ++i) { + AstType* parameter = Fuzz(depth / 2); + type->AsFunction()->InitParameter(i, parameter); + } + return type; + } + case 8: { // simd + static const int num_simd_types = +#define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) +1 + SIMD128_TYPES(COUNT_SIMD_TYPE); +#undef COUNT_SIMD_TYPE + AstType* (*simd_constructors[num_simd_types])(Isolate*, Zone*) = { +#define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) &AstType::Name, + SIMD128_TYPES(COUNT_SIMD_TYPE) +#undef COUNT_SIMD_TYPE + }; + return simd_constructors[rng_->NextInt(num_simd_types)](isolate_, + zone_); + } + default: { // union + int n = rng_->NextInt(10); + AstType* type = None; + for (int i = 0; i < n; ++i) { + AstType* operand = Fuzz(depth - 1); + type = AstType::Union(type, operand, zone_); + } + return type; + } + } + UNREACHABLE(); + } + + Zone* zone() { return zone_; } + + private: + Zone* zone_; + Isolate* isolate_; + v8::base::RandomNumberGenerator* rng_; +}; + +} // namespace internal +} // namespace v8 + +#endif diff --git a/deps/v8/test/cctest/cctest.cc b/deps/v8/test/cctest/cctest.cc index 312001a35b..17127ed9ec 100644 --- a/deps/v8/test/cctest/cctest.cc +++ b/deps/v8/test/cctest/cctest.cc @@ -105,6 +105,39 @@ void CcTest::Run() { } } +i::Heap* CcTest::heap() { return i_isolate()->heap(); } + +void CcTest::CollectGarbage(i::AllocationSpace space) { + heap()->CollectGarbage(space, i::GarbageCollectionReason::kTesting); +} + +void CcTest::CollectAllGarbage(int flags) { + heap()->CollectAllGarbage(flags, i::GarbageCollectionReason::kTesting); +} + +void CcTest::CollectAllAvailableGarbage() { + heap()->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); +} + +v8::base::RandomNumberGenerator* CcTest::random_number_generator() { + return InitIsolateOnce()->random_number_generator(); +} + +v8::Local<v8::Object> CcTest::global() { + return isolate()->GetCurrentContext()->Global(); +} + +void CcTest::InitializeVM() { + CHECK(!v8::base::NoBarrier_Load(&isolate_used_)); + CHECK(!initialize_called_); + initialize_called_ = true; + v8::HandleScope handle_scope(CcTest::isolate()); + v8::Context::New(CcTest::isolate())->Enter(); +} + +void CcTest::TearDown() { + if (isolate_ != NULL) isolate_->Dispose(); +} v8::Local<v8::Context> CcTest::NewContext(CcTestExtensionFlags extensions, v8::Isolate* isolate) { @@ -126,6 +159,47 @@ void CcTest::DisableAutomaticDispose() { disable_automatic_dispose_ = true; } +LocalContext::~LocalContext() { + v8::HandleScope scope(isolate_); + v8::Local<v8::Context>::New(isolate_, context_)->Exit(); + context_.Reset(); +} + +void LocalContext::Initialize(v8::Isolate* isolate, + v8::ExtensionConfiguration* extensions, + v8::Local<v8::ObjectTemplate> global_template, + v8::Local<v8::Value> global_object) { + v8::HandleScope scope(isolate); + v8::Local<v8::Context> context = + v8::Context::New(isolate, extensions, global_template, global_object); + context_.Reset(isolate, context); + context->Enter(); + // We can't do this later perhaps because of a fatal error. + isolate_ = isolate; +} + +// This indirection is needed because HandleScopes cannot be heap-allocated, and +// we don't want any unnecessary #includes in cctest.h. +class InitializedHandleScopeImpl { + public: + explicit InitializedHandleScopeImpl(i::Isolate* isolate) + : handle_scope_(isolate) {} + + private: + i::HandleScope handle_scope_; +}; + +InitializedHandleScope::InitializedHandleScope() + : main_isolate_(CcTest::InitIsolateOnce()), + initialized_handle_scope_impl_( + new InitializedHandleScopeImpl(main_isolate_)) {} + +InitializedHandleScope::~InitializedHandleScope() {} + +HandleAndZoneScope::HandleAndZoneScope() + : main_zone_(new i::Zone(&allocator_)) {} + +HandleAndZoneScope::~HandleAndZoneScope() {} static void PrintTestList(CcTest* current) { if (current == NULL) return; diff --git a/deps/v8/test/cctest/cctest.gyp b/deps/v8/test/cctest/cctest.gyp index 217d74b6dc..c95a0b1749 100644 --- a/deps/v8/test/cctest/cctest.gyp +++ b/deps/v8/test/cctest/cctest.gyp @@ -33,10 +33,13 @@ 'generated_file': '<(SHARED_INTERMEDIATE_DIR)/resources.cc', 'cctest_sources': [ ### gcmole(all) ### 'asmjs/test-asm-typer.cc', + 'ast-types-fuzz.h', 'compiler/c-signature.h', + 'compiler/call-tester.h', 'compiler/codegen-tester.cc', 'compiler/codegen-tester.h', 'compiler/code-assembler-tester.h', + 'compiler/function-tester.cc', 'compiler/function-tester.h', 'compiler/graph-builder-tester.h', 'compiler/test-basic-block-profiler.cc', @@ -76,9 +79,12 @@ 'compiler/test-run-stubs.cc', 'compiler/test-run-variables.cc', 'compiler/test-run-wasm-machops.cc', - 'compiler/test-simplified-lowering.cc', + 'compiler/value-helper.h', 'cctest.cc', + 'cctest.h', + 'expression-type-collector-macros.h', 'interpreter/interpreter-tester.cc', + 'interpreter/interpreter-tester.h', 'interpreter/source-position-matcher.cc', 'interpreter/source-position-matcher.h', 'interpreter/test-bytecode-generator.cc', @@ -88,8 +94,11 @@ 'interpreter/bytecode-expectations-printer.cc', 'interpreter/bytecode-expectations-printer.h', 'gay-fixed.cc', + 'gay-fixed.h', 'gay-precision.cc', + 'gay-precision.h', 'gay-shortest.cc', + 'gay-shortest.h', 'heap/heap-tester.h', 'heap/heap-utils.cc', 'heap/heap-utils.h', @@ -104,8 +113,12 @@ 'heap/test-spaces.cc', 'libplatform/test-tracing.cc', 'libsampler/test-sampler.cc', + 'parsing/test-scanner-streams.cc', + 'parsing/test-scanner.cc', 'print-extension.cc', + 'print-extension.h', 'profiler-extension.cc', + 'profiler-extension.h', 'test-access-checks.cc', 'test-accessors.cc', 'test-api.cc', @@ -138,6 +151,7 @@ 'test-elements-kind.cc', 'test-fast-dtoa.cc', 'test-feedback-vector.cc', + 'test-feedback-vector.h', 'test-field-type-tracking.cc', 'test-fixed-dtoa.cc', 'test-flags.cc', @@ -155,6 +169,7 @@ 'test-lockers.cc', 'test-log.cc', 'test-mementos.cc', + 'test-modules.cc', 'test-object.cc', 'test-parsing.cc', 'test-platform.cc', @@ -174,6 +189,7 @@ 'test-trace-event.cc', 'test-transitions.cc', 'test-typedarrays.cc', + 'test-ast-types.cc', 'test-types.cc', 'test-unbound-queue.cc', 'test-unboxed-doubles.cc', @@ -185,6 +201,8 @@ 'test-weakmaps.cc', 'test-weaksets.cc', 'trace-extension.cc', + 'trace-extension.h', + 'types-fuzz.h', 'wasm/test-run-wasm.cc', 'wasm/test-run-wasm-64.cc', 'wasm/test-run-wasm-asmjs.cc', @@ -192,7 +210,6 @@ 'wasm/test-run-wasm-js.cc', 'wasm/test-run-wasm-module.cc', 'wasm/test-run-wasm-relocation.cc', - 'wasm/test-signatures.h', 'wasm/test-wasm-function-name-table.cc', 'wasm/test-wasm-stack.cc', 'wasm/test-wasm-trap-position.cc', @@ -201,6 +218,7 @@ 'cctest_sources_ia32': [ ### gcmole(arch:ia32) ### 'test-assembler-ia32.cc', 'test-code-stubs.cc', + 'test-code-stubs.h', 'test-code-stubs-ia32.cc', 'test-disasm-ia32.cc', 'test-macro-assembler-ia32.cc', @@ -210,15 +228,18 @@ 'cctest_sources_x64': [ ### gcmole(arch:x64) ### 'test-assembler-x64.cc', 'test-code-stubs.cc', + 'test-code-stubs.h', 'test-code-stubs-x64.cc', 'test-disasm-x64.cc', 'test-macro-assembler-x64.cc', 'test-log-stack-tracer.cc', - 'test-run-wasm-relocation-x64.cc' + 'test-run-wasm-relocation-x64.cc', + 'wasm/test-run-wasm-simd.cc' ], 'cctest_sources_arm': [ ### gcmole(arch:arm) ### 'test-assembler-arm.cc', 'test-code-stubs.cc', + 'test-code-stubs.h', 'test-code-stubs-arm.cc', 'test-disasm-arm.cc', 'test-macro-assembler-arm.cc', @@ -226,8 +247,10 @@ ], 'cctest_sources_arm64': [ ### gcmole(arch:arm64) ### 'test-utils-arm64.cc', + 'test-utils-arm64.h', 'test-assembler-arm64.cc', 'test-code-stubs.cc', + 'test-code-stubs.h', 'test-code-stubs-arm64.cc', 'test-disasm-arm64.cc', 'test-fuzz-arm64.cc', @@ -238,16 +261,19 @@ 'cctest_sources_s390': [ ### gcmole(arch:s390) ### 'test-assembler-s390.cc', 'test-code-stubs.cc', + 'test-code-stubs.h', 'test-disasm-s390.cc' ], 'cctest_sources_ppc': [ ### gcmole(arch:ppc) ### 'test-assembler-ppc.cc', 'test-code-stubs.cc', + 'test-code-stubs.h', 'test-disasm-ppc.cc' ], 'cctest_sources_mips': [ ### gcmole(arch:mips) ### 'test-assembler-mips.cc', 'test-code-stubs.cc', + 'test-code-stubs.h', 'test-code-stubs-mips.cc', 'test-disasm-mips.cc', 'test-macro-assembler-mips.cc' @@ -255,6 +281,7 @@ 'cctest_sources_mipsel': [ ### gcmole(arch:mipsel) ### 'test-assembler-mips.cc', 'test-code-stubs.cc', + 'test-code-stubs.h', 'test-code-stubs-mips.cc', 'test-disasm-mips.cc', 'test-macro-assembler-mips.cc' @@ -262,6 +289,7 @@ 'cctest_sources_mips64': [ ### gcmole(arch:mips64) ### 'test-assembler-mips64.cc', 'test-code-stubs.cc', + 'test-code-stubs.h', 'test-code-stubs-mips64.cc', 'test-disasm-mips64.cc', 'test-macro-assembler-mips64.cc' @@ -269,6 +297,7 @@ 'cctest_sources_mips64el': [ ### gcmole(arch:mips64el) ### 'test-assembler-mips64.cc', 'test-code-stubs.cc', + 'test-code-stubs.h', 'test-code-stubs-mips64.cc', 'test-disasm-mips64.cc', 'test-macro-assembler-mips64.cc' @@ -276,6 +305,7 @@ 'cctest_sources_x87': [ ### gcmole(arch:x87) ### 'test-assembler-x87.cc', 'test-code-stubs.cc', + 'test-code-stubs.h', 'test-code-stubs-x87.cc', 'test-disasm-x87.cc', 'test-macro-assembler-x87.cc', @@ -296,6 +326,9 @@ '../..', ], 'sources': [ + '../common/wasm/test-signatures.h', + '../common/wasm/wasm-module-runner.cc', + '../common/wasm/wasm-module-runner.h', '<@(cctest_sources)', '<(generated_file)', ], diff --git a/deps/v8/test/cctest/cctest.h b/deps/v8/test/cctest/cctest.h index dac3a5b94f..d8fa871484 100644 --- a/deps/v8/test/cctest/cctest.h +++ b/deps/v8/test/cctest/cctest.h @@ -28,10 +28,29 @@ #ifndef CCTEST_H_ #define CCTEST_H_ +#include <memory> + #include "include/libplatform/libplatform.h" -#include "src/isolate-inl.h" // TODO(everyone): Make cctest IWYU. -#include "src/objects-inl.h" // TODO(everyone): Make cctest IWYU. +#include "include/v8-debug.h" +#include "src/utils.h" #include "src/v8.h" +#include "src/zone/accounting-allocator.h" + +namespace v8 { +namespace base { + +class RandomNumberGenerator; + +} // namespace base + +namespace internal { + +class HandleScope; +class Zone; + +} // namespace internal + +} // namespace v8 #ifndef TEST #define TEST(Name) \ @@ -104,17 +123,15 @@ class CcTest { return reinterpret_cast<i::Isolate*>(isolate()); } - static i::Heap* heap() { - return i_isolate()->heap(); - } + static i::Heap* heap(); - static v8::base::RandomNumberGenerator* random_number_generator() { - return InitIsolateOnce()->random_number_generator(); - } + static void CollectGarbage(i::AllocationSpace space); + static void CollectAllGarbage(int flags); + static void CollectAllAvailableGarbage(); - static v8::Local<v8::Object> global() { - return isolate()->GetCurrentContext()->Global(); - } + static v8::base::RandomNumberGenerator* random_number_generator(); + + static v8::Local<v8::Object> global(); static v8::ArrayBuffer::Allocator* array_buffer_allocator() { return allocator_; @@ -127,13 +144,7 @@ class CcTest { // TODO(dcarney): Remove. // This must be called first in a test. - static void InitializeVM() { - CHECK(!v8::base::NoBarrier_Load(&isolate_used_)); - CHECK(!initialize_called_); - initialize_called_ = true; - v8::HandleScope handle_scope(CcTest::isolate()); - v8::Context::New(CcTest::isolate())->Enter(); - } + static void InitializeVM(); // Only for UNINITIALIZED_TESTs static void DisableAutomaticDispose(); @@ -144,9 +155,7 @@ class CcTest { CcTestExtensionFlags extensions, v8::Isolate* isolate = CcTest::isolate()); - static void TearDown() { - if (isolate_ != NULL) isolate_->Dispose(); - } + static void TearDown(); private: friend int main(int argc, char** argv); @@ -269,11 +278,7 @@ class LocalContext { Initialize(CcTest::isolate(), extensions, global_template, global_object); } - virtual ~LocalContext() { - v8::HandleScope scope(isolate_); - v8::Local<v8::Context>::New(isolate_, context_)->Exit(); - context_.Reset(); - } + virtual ~LocalContext(); v8::Context* operator->() { return *reinterpret_cast<v8::Context**>(&context_); @@ -288,17 +293,7 @@ class LocalContext { private: void Initialize(v8::Isolate* isolate, v8::ExtensionConfiguration* extensions, v8::Local<v8::ObjectTemplate> global_template, - v8::Local<v8::Value> global_object) { - v8::HandleScope scope(isolate); - v8::Local<v8::Context> context = v8::Context::New(isolate, - extensions, - global_template, - global_object); - context_.Reset(isolate, context); - context->Enter(); - // We can't do this later perhaps because of a fatal error. - isolate_ = isolate; - } + v8::Local<v8::Value> global_object); v8::Persistent<v8::Context> context_; v8::Isolate* isolate_; @@ -567,32 +562,33 @@ static inline void EmptyMessageQueues(v8::Isolate* isolate) { } } +class InitializedHandleScopeImpl; class InitializedHandleScope { public: - InitializedHandleScope() - : main_isolate_(CcTest::InitIsolateOnce()), - handle_scope_(main_isolate_) {} + InitializedHandleScope(); + ~InitializedHandleScope(); // Prefixing the below with main_ reduces a lot of naming clashes. i::Isolate* main_isolate() { return main_isolate_; } private: i::Isolate* main_isolate_; - i::HandleScope handle_scope_; + std::unique_ptr<InitializedHandleScopeImpl> initialized_handle_scope_impl_; }; class HandleAndZoneScope : public InitializedHandleScope { public: - HandleAndZoneScope() : main_zone_(&allocator_) {} + HandleAndZoneScope(); + ~HandleAndZoneScope(); // Prefixing the below with main_ reduces a lot of naming clashes. - i::Zone* main_zone() { return &main_zone_; } + i::Zone* main_zone() { return main_zone_.get(); } private: - v8::base::AccountingAllocator allocator_; - i::Zone main_zone_; + v8::internal::AccountingAllocator allocator_; + std::unique_ptr<i::Zone> main_zone_; }; #endif // ifndef CCTEST_H_ diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status index 5a88f0f701..b7bcb6b5e3 100644 --- a/deps/v8/test/cctest/cctest.status +++ b/deps/v8/test/cctest/cctest.status @@ -66,6 +66,7 @@ # This tests only the type system, no point in running several variants. 'test-hydrogen-types/*': [PASS, NO_VARIANTS], 'test-types/*': [PASS, NO_VARIANTS], + 'test-ast-types/*': [PASS, NO_VARIANTS], # This tests API threading, no point in running several variants. 'test-api/Threading*': [PASS, NO_VARIANTS], @@ -150,6 +151,12 @@ ['asan == True', { # Skip tests not suitable for ASAN. 'test-assembler-x64/AssemblerX64XchglOperations': [SKIP], + + # BUG(v8:5243). + 'test-cpu-profiler/JsNative1JsNative2JsSample': [SKIP], + 'test-cpu-profiler/JsNativeJsRuntimeJsSample': [SKIP], + 'test-cpu-profiler/JsNativeJsRuntimeJsSampleMultiple': [SKIP], + 'test-cpu-profiler/JsNativeJsSample': [SKIP], }], # 'asan == True' ############################################################################## @@ -284,6 +291,8 @@ 'test-run-machops/RunFloat64Tan': [SKIP], 'test-cpu-profiler/Inlining': [SKIP], 'test-gap-resolver/FuzzResolver': [SKIP], + 'test-run-wasm/RunWasmCompiled_MultiReturnSelect_f32': [SKIP], + 'test-run-wasm/RunWasmCompiled_MultiReturnSelect_f64': [SKIP], }], # 'arch == x87' ############################################################################## @@ -327,11 +336,6 @@ ############################################################################## ['variant == turbofan', { - # TODO(bmeurer): TurboFan embeds strong references to all kinds of objects - # via deoptimization data (Crankshaft also does this, but lack proper test - # coverage). - 'test-heap/ObjectsInOptimizedCodeAreWeak': [FAIL], - # TurboFan cpu profiler result is different. 'test-cpu-profiler/CollectDeoptEvents': [FAIL], 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL], @@ -354,14 +358,6 @@ 'test-heap/TestCodeFlushingIncremental': [FAIL], 'test-heap/TestCodeFlushingIncrementalAbort': [PASS, ['mode == debug or dcheck_always_on == True', FAIL]], - # TODO(mythria,4780): Related to type feedback support for Array function. - 'test-feedback-vector/VectorCallFeedbackForArray': [FAIL], - - # TODO(mythria,4780): Related to type feedback support for constructor. - 'test-feedback-vector/VectorConstructCounts': [FAIL], - 'test-heap/WeakFunctionInConstructor': [FAIL], - 'test-heap/IncrementalMarkingPreservesMonomorphicConstructor': [FAIL], - # TODO(mythria,4680): Lack of code-ageing in interpreter. 'test-heap/Regress169209': [FAIL], @@ -369,23 +365,9 @@ # in interpreter. 'test-heap/CompilationCacheCachingBehavior': [FAIL], - # BUG(rmcilroy,4680): Function is optimized without type feedback and so immediately deopts again, causing check failure in the test. - 'test-heap/ResetSharedFunctionInfoCountersDuringIncrementalMarking': [FAIL], - 'test-heap/ResetSharedFunctionInfoCountersDuringMarkSweep': [FAIL], - # BUG(4680): Missing type feedback makes optimistic optimizations fail. - 'test-cpu-profiler/CollectDeoptEvents': [FAIL], 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP], - # BUG(4680): Ignition doesn't support allocation sites currently. - 'test-heap/EnsureAllocationSiteDependentCodesProcessed': [FAIL], - 'test-heap/OptimizedPretenuringAllocationFolding': [FAIL], - 'test-heap/OptimizedPretenuringdoubleArrayLiterals': [FAIL], - 'test-heap/OptimizedPretenuringNestedDoubleLiterals': [FAIL], - 'test-heap/OptimizedPretenuringNestedMixedArrayLiterals': [FAIL], - 'test-heap/OptimizedPretenuringNestedObjectLiterals': [FAIL], - 'test-heap/OptimizedPretenuringObjectArrayLiterals': [FAIL], - # BUG(4751). Flaky with ignition. 'test-cpu-profiler/JsNativeJsSample': [PASS, FAIL], @@ -393,10 +375,6 @@ # with crankshaft. 'test-cpu-profiler/TickLinesOptimized': [SKIP], - # TurboFan cpu profiler result is different. - 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL], - 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL], - # BUG(5193): Flaky. 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], }], # variant == ignition @@ -405,51 +383,12 @@ ['variant == ignition_staging', { 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP], 'test-cpu-profiler/TickLinesOptimized': [SKIP], - 'test-cpu-profiler/CollectDeoptEvents': [FAIL], - 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL], - 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL], - 'test-feedback-vector/VectorCallFeedbackForArray': [FAIL], - 'test-feedback-vector/VectorConstructCounts': [FAIL], 'test-heap/CompilationCacheCachingBehavior': [FAIL], - 'test-heap/EnsureAllocationSiteDependentCodesProcessed': [FAIL], - 'test-heap/IncrementalMarkingPreservesMonomorphicConstructor': [FAIL], - 'test-heap/OptimizedPretenuringAllocationFolding': [FAIL], - 'test-heap/OptimizedPretenuringdoubleArrayLiterals': [FAIL], - 'test-heap/OptimizedPretenuringNestedDoubleLiterals': [FAIL], - 'test-heap/OptimizedPretenuringNestedMixedArrayLiterals': [FAIL], - 'test-heap/OptimizedPretenuringNestedObjectLiterals': [FAIL], - 'test-heap/OptimizedPretenuringObjectArrayLiterals': [FAIL], 'test-heap/Regress169209': [FAIL], - 'test-heap/ResetSharedFunctionInfoCountersDuringIncrementalMarking': [FAIL], - 'test-heap/ResetSharedFunctionInfoCountersDuringMarkSweep': [FAIL], 'test-heap/TestCodeFlushing': [FAIL], 'test-heap/TestCodeFlushingIncremental': [FAIL], 'test-heap/TestCodeFlushingIncrementalScavenge': [FAIL], 'test-heap/TestCodeFlushingPreAged': [FAIL], - 'test-heap/WeakFunctionInConstructor': [FAIL], - 'test-run-inlining/InlineBuiltin': [FAIL], - 'test-run-inlining/InlineLoopGuardedEmpty': [FAIL], - 'test-run-inlining/InlineLoopGuardedOnce': [FAIL], - 'test-run-inlining/InlineLoopGuardedTwice': [FAIL], - 'test-run-inlining/InlineLoopUnguardedEmpty': [FAIL], - 'test-run-inlining/InlineLoopUnguardedOnce': [FAIL], - 'test-run-inlining/InlineLoopUnguardedTwice': [FAIL], - 'test-run-inlining/InlineMutuallyRecursive': [FAIL], - 'test-run-inlining/InlineNestedBuiltin': [FAIL], - 'test-run-inlining/InlineOmitArgumentsDeopt': [FAIL], - 'test-run-inlining/InlineOmitArguments': [FAIL], - 'test-run-inlining/InlineOmitArgumentsObject': [FAIL], - 'test-run-inlining/InlineSurplusArgumentsDeopt': [FAIL], - 'test-run-inlining/InlineSurplusArguments': [FAIL], - 'test-run-inlining/InlineSurplusArgumentsObject': [FAIL], - 'test-run-inlining/InlineTwiceDependentDiamondDifferent': [FAIL], - 'test-run-inlining/InlineTwiceDependentDiamond': [FAIL], - 'test-run-inlining/InlineTwiceDependent': [FAIL], - 'test-run-inlining/InlineTwice': [FAIL], - 'test-run-inlining/InlineWithArguments': [FAIL], - 'test-run-inlining/SimpleInliningContextDeopt': [FAIL], - 'test-run-inlining/SimpleInliningContext': [FAIL], - 'test-run-inlining/SimpleInlining': [FAIL], # BUG(5193): Flaky. 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], @@ -457,31 +396,6 @@ ############################################################################## ['variant == ignition_turbofan', { - # TODO(5251): Inlining is currently disabled for the BytecodeGraphBuilder. - 'test-run-inlining/InlineLoopGuardedTwice': [FAIL], - 'test-run-inlining/InlineSurplusArgumentsDeopt': [FAIL], - 'test-run-inlining/InlineTwice': [FAIL], - 'test-run-inlining/InlineSurplusArgumentsObject': [FAIL], - 'test-run-inlining/InlineTwiceDependentDiamond': [FAIL], - 'test-run-inlining/InlineWithArguments': [FAIL], - 'test-run-inlining/InlineLoopUnguardedTwice': [FAIL], - 'test-run-inlining/InlineOmitArgumentsObject': [FAIL], - 'test-run-inlining/InlineLoopUnguardedOnce': [FAIL], - 'test-run-inlining/InlineOmitArgumentsDeopt': [FAIL], - 'test-run-inlining/InlineTwiceDependentDiamondDifferent': [FAIL], - 'test-run-inlining/SimpleInliningContext': [FAIL], - 'test-run-inlining/InlineMutuallyRecursive': [FAIL], - 'test-run-inlining/InlineLoopGuardedEmpty': [FAIL], - 'test-run-inlining/InlineLoopGuardedOnce': [FAIL], - 'test-run-inlining/InlineOmitArguments': [FAIL], - 'test-run-inlining/SimpleInlining': [FAIL], - 'test-run-inlining/InlineLoopUnguardedEmpty': [FAIL], - 'test-run-inlining/InlineNestedBuiltin': [FAIL], - 'test-run-inlining/InlineSurplusArguments': [FAIL], - 'test-run-inlining/InlineBuiltin': [FAIL], - 'test-run-inlining/InlineTwiceDependent': [FAIL], - 'test-run-inlining/SimpleInliningContextDeopt': [FAIL], - # TODO(rmcilroy,4766): Requires BytecodeGraphBuilder to track source position # on nodes (behind --turbo_source_positions flag). 'test-cpu-profiler/TickLinesOptimized': [FAIL], @@ -493,14 +407,6 @@ 'test-heap/TestCodeFlushingIncremental': [FAIL], 'test-heap/TestCodeFlushingIncrementalAbort': [PASS, ['mode == debug or dcheck_always_on == True', FAIL]], - # TODO(mythria,4780): Related to type feedback support for Array function. - 'test-feedback-vector/VectorCallFeedbackForArray': [FAIL], - - # TODO(mythria,4780): Related to type feedback support for constructor. - 'test-feedback-vector/VectorConstructCounts': [FAIL], - 'test-heap/WeakFunctionInConstructor': [FAIL], - 'test-heap/IncrementalMarkingPreservesMonomorphicConstructor': [FAIL], - # TODO(mythria,4680): Lack of code-ageing in interpreter. 'test-heap/Regress169209': [FAIL], @@ -512,23 +418,9 @@ 'test-cpu-profiler/CollectDeoptEvents': [FAIL], 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP], - # BUG(4680): Ignition doesn't support allocation sites currently. - 'test-heap/EnsureAllocationSiteDependentCodesProcessed': [FAIL], - 'test-heap/OptimizedPretenuringAllocationFolding': [FAIL], - 'test-heap/OptimizedPretenuringdoubleArrayLiterals': [FAIL], - 'test-heap/OptimizedPretenuringNestedDoubleLiterals': [FAIL], - 'test-heap/OptimizedPretenuringNestedMixedArrayLiterals': [FAIL], - 'test-heap/OptimizedPretenuringNestedObjectLiterals': [FAIL], - 'test-heap/OptimizedPretenuringObjectArrayLiterals': [FAIL], - # BUG(4751). Flaky with Ignition. 'test-cpu-profiler/JsNativeJsSample': [SKIP], - # TODO(bmeurer): TurboFan embeds strong references to all kinds of objects - # via deoptimization data (Crankshaft also does this, but lack proper test - # coverage). - 'test-heap/ObjectsInOptimizedCodeAreWeak': [FAIL], - # TurboFan cpu profiler result is different. 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL], 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL], @@ -537,4 +429,16 @@ 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], }], # variant == ignition_turbofan +############################################################################## +['variant != ignition and variant != ignition_staging and variant != ignition_turbofan', { + # Ongoing implementation of modules. + # https://bugs.chromium.org/p/v8/issues/detail?id=1569 + 'test-modules/*': [SKIP], +}], # variant != ignition and variant != ignition_staging and variant != ignition_turbofan + +############################################################################## +['variant == asm_wasm', { + '*': [SKIP], +}], # variant == asm_wasm + ] diff --git a/deps/v8/test/cctest/compiler/codegen-tester.h b/deps/v8/test/cctest/compiler/codegen-tester.h index 3d115454b9..90c32ce99e 100644 --- a/deps/v8/test/cctest/compiler/codegen-tester.h +++ b/deps/v8/test/cctest/compiler/codegen-tester.h @@ -5,7 +5,7 @@ #ifndef V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ #define V8_CCTEST_COMPILER_CODEGEN_TESTER_H_ -#include "src/compiler.h" +#include "src/compilation-info.h" #include "src/compiler/instruction-selector.h" #include "src/compiler/pipeline.h" #include "src/compiler/raw-machine-assembler.h" @@ -67,7 +67,8 @@ class RawMachineAssemblerTester : public HandleAndZoneScope, Schedule* schedule = this->Export(); CallDescriptor* call_descriptor = this->call_descriptor(); Graph* graph = this->graph(); - CompilationInfo info(ArrayVector("testing"), main_isolate(), main_zone()); + CompilationInfo info(ArrayVector("testing"), main_isolate(), main_zone(), + Code::ComputeFlags(Code::STUB)); code_ = Pipeline::GenerateCodeForTesting(&info, call_descriptor, graph, schedule); } diff --git a/deps/v8/test/cctest/compiler/function-tester.cc b/deps/v8/test/cctest/compiler/function-tester.cc new file mode 100644 index 0000000000..2da2dc14aa --- /dev/null +++ b/deps/v8/test/cctest/compiler/function-tester.cc @@ -0,0 +1,211 @@ +// Copyright 2014 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 "test/cctest/compiler/function-tester.h" + +#include "src/ast/ast-numbering.h" +#include "src/compilation-info.h" +#include "src/compiler.h" +#include "src/compiler/linkage.h" +#include "src/compiler/pipeline.h" +#include "src/execution.h" +#include "src/full-codegen/full-codegen.h" +#include "src/handles.h" +#include "src/objects-inl.h" +#include "src/parsing/parse-info.h" +#include "src/parsing/parser.h" +#include "test/cctest/cctest.h" + +namespace v8 { +namespace internal { +namespace compiler { + +FunctionTester::FunctionTester(const char* source, uint32_t flags) + : isolate(main_isolate()), + function((FLAG_allow_natives_syntax = true, NewFunction(source))), + flags_(flags) { + Compile(function); + const uint32_t supported_flags = CompilationInfo::kNativeContextSpecializing | + CompilationInfo::kInliningEnabled; + CHECK_EQ(0u, flags_ & ~supported_flags); +} + +FunctionTester::FunctionTester(Graph* graph, int param_count) + : isolate(main_isolate()), + function(NewFunction(BuildFunction(param_count).c_str())), + flags_(0) { + CompileGraph(graph); +} + +FunctionTester::FunctionTester(Handle<Code> code, int param_count) + : isolate(main_isolate()), + function((FLAG_allow_natives_syntax = true, + NewFunction(BuildFunction(param_count).c_str()))), + flags_(0) { + Compile(function); + function->ReplaceCode(*code); +} + +FunctionTester::FunctionTester(const CallInterfaceDescriptor& descriptor, + Handle<Code> code) + : FunctionTester(code, descriptor.GetParameterCount()) {} + +MaybeHandle<Object> FunctionTester::Call() { + return Execution::Call(isolate, function, undefined(), 0, nullptr); +} + +MaybeHandle<Object> FunctionTester::Call(Handle<Object> a) { + Handle<Object> args[] = {a}; + return Execution::Call(isolate, function, undefined(), 1, args); +} + +MaybeHandle<Object> FunctionTester::Call(Handle<Object> a, Handle<Object> b) { + Handle<Object> args[] = {a, b}; + return Execution::Call(isolate, function, undefined(), 2, args); +} + +MaybeHandle<Object> FunctionTester::Call(Handle<Object> a, Handle<Object> b, + Handle<Object> c) { + Handle<Object> args[] = {a, b, c}; + return Execution::Call(isolate, function, undefined(), 3, args); +} + +MaybeHandle<Object> FunctionTester::Call(Handle<Object> a, Handle<Object> b, + Handle<Object> c, Handle<Object> d) { + Handle<Object> args[] = {a, b, c, d}; + return Execution::Call(isolate, function, undefined(), 4, args); +} + +void FunctionTester::CheckThrows(Handle<Object> a, Handle<Object> b) { + TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); + MaybeHandle<Object> no_result = Call(a, b); + CHECK(isolate->has_pending_exception()); + CHECK(try_catch.HasCaught()); + CHECK(no_result.is_null()); + isolate->OptionalRescheduleException(true); +} + +v8::Local<v8::Message> FunctionTester::CheckThrowsReturnMessage( + Handle<Object> a, Handle<Object> b) { + TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); + MaybeHandle<Object> no_result = Call(a, b); + CHECK(isolate->has_pending_exception()); + CHECK(try_catch.HasCaught()); + CHECK(no_result.is_null()); + isolate->OptionalRescheduleException(true); + CHECK(!try_catch.Message().IsEmpty()); + return try_catch.Message(); +} + +void FunctionTester::CheckCall(Handle<Object> expected, Handle<Object> a, + Handle<Object> b, Handle<Object> c, + Handle<Object> d) { + Handle<Object> result = Call(a, b, c, d).ToHandleChecked(); + CHECK(expected->SameValue(*result)); +} + +Handle<JSFunction> FunctionTester::NewFunction(const char* source) { + return Handle<JSFunction>::cast(v8::Utils::OpenHandle( + *v8::Local<v8::Function>::Cast(CompileRun(source)))); +} + +Handle<JSObject> FunctionTester::NewObject(const char* source) { + return Handle<JSObject>::cast( + v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast(CompileRun(source)))); +} + +Handle<String> FunctionTester::Val(const char* string) { + return isolate->factory()->InternalizeUtf8String(string); +} + +Handle<Object> FunctionTester::Val(double value) { + return isolate->factory()->NewNumber(value); +} + +Handle<Object> FunctionTester::infinity() { + return isolate->factory()->infinity_value(); +} + +Handle<Object> FunctionTester::minus_infinity() { return Val(-V8_INFINITY); } + +Handle<Object> FunctionTester::nan() { return isolate->factory()->nan_value(); } + +Handle<Object> FunctionTester::undefined() { + return isolate->factory()->undefined_value(); +} + +Handle<Object> FunctionTester::null() { + return isolate->factory()->null_value(); +} + +Handle<Object> FunctionTester::true_value() { + return isolate->factory()->true_value(); +} + +Handle<Object> FunctionTester::false_value() { + return isolate->factory()->false_value(); +} + +Handle<JSFunction> FunctionTester::ForMachineGraph(Graph* graph, + int param_count) { + JSFunction* p = NULL; + { // because of the implicit handle scope of FunctionTester. + FunctionTester f(graph, param_count); + p = *f.function; + } + return Handle<JSFunction>(p); // allocated in outer handle scope. +} + +Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) { + Zone zone(function->GetIsolate()->allocator()); + ParseInfo parse_info(&zone, function); + CompilationInfo info(&parse_info, function); + info.MarkAsDeoptimizationEnabled(); + + if (!FLAG_turbo_from_bytecode) { + CHECK(Parser::ParseStatic(info.parse_info())); + } + info.SetOptimizing(); + if (flags_ & CompilationInfo::kNativeContextSpecializing) { + info.MarkAsNativeContextSpecializing(); + } + if (flags_ & CompilationInfo::kInliningEnabled) { + info.MarkAsInliningEnabled(); + } + if (FLAG_turbo_from_bytecode) { + CHECK(Compiler::EnsureBytecode(&info)); + info.MarkAsOptimizeFromBytecode(); + } else { + CHECK(Compiler::Analyze(info.parse_info())); + CHECK(Compiler::EnsureDeoptimizationSupport(&info)); + } + JSFunction::EnsureLiterals(function); + + Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); + CHECK(!code.is_null()); + info.dependencies()->Commit(code); + info.context()->native_context()->AddOptimizedCode(*code); + function->ReplaceCode(*code); + return function; +} + +// Compile the given machine graph instead of the source of the function +// and replace the JSFunction's code with the result. +Handle<JSFunction> FunctionTester::CompileGraph(Graph* graph) { + Zone zone(function->GetIsolate()->allocator()); + ParseInfo parse_info(&zone, function); + CompilationInfo info(&parse_info, function); + + CHECK(Parser::ParseStatic(info.parse_info())); + info.SetOptimizing(); + + Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); + CHECK(!code.is_null()); + function->ReplaceCode(*code); + return function; +} + +} // namespace compiler +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/cctest/compiler/function-tester.h b/deps/v8/test/cctest/compiler/function-tester.h index c1473ac960..e65fa78c13 100644 --- a/deps/v8/test/cctest/compiler/function-tester.h +++ b/deps/v8/test/cctest/compiler/function-tester.h @@ -5,110 +5,45 @@ #ifndef V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ #define V8_CCTEST_COMPILER_FUNCTION_TESTER_H_ -#include "src/ast/ast-numbering.h" -#include "src/compiler.h" -#include "src/compiler/linkage.h" -#include "src/compiler/pipeline.h" -#include "src/execution.h" -#include "src/full-codegen/full-codegen.h" #include "src/handles.h" -#include "src/objects-inl.h" -#include "src/parsing/parse-info.h" -#include "src/parsing/parser.h" -#include "src/parsing/rewriter.h" #include "test/cctest/cctest.h" namespace v8 { namespace internal { + +class CallInterfaceDescriptor; +class Isolate; + namespace compiler { +class Graph; + class FunctionTester : public InitializedHandleScope { public: - explicit FunctionTester(const char* source, uint32_t flags = 0) - : isolate(main_isolate()), - function((FLAG_allow_natives_syntax = true, NewFunction(source))), - flags_(flags) { - Compile(function); - const uint32_t supported_flags = - CompilationInfo::kNativeContextSpecializing | - CompilationInfo::kInliningEnabled; - CHECK_EQ(0u, flags_ & ~supported_flags); - } + explicit FunctionTester(const char* source, uint32_t flags = 0); - FunctionTester(Graph* graph, int param_count) - : isolate(main_isolate()), - function(NewFunction(BuildFunction(param_count).c_str())), - flags_(0) { - CompileGraph(graph); - } + FunctionTester(Graph* graph, int param_count); - FunctionTester(Handle<Code> code, int param_count) - : isolate(main_isolate()), - function((FLAG_allow_natives_syntax = true, - NewFunction(BuildFunction(param_count).c_str()))), - flags_(0) { - Compile(function); - function->ReplaceCode(*code); - } + FunctionTester(Handle<Code> code, int param_count); - FunctionTester(const CallInterfaceDescriptor& descriptor, Handle<Code> code) - : FunctionTester(code, descriptor.GetParameterCount()) {} + FunctionTester(const CallInterfaceDescriptor& descriptor, Handle<Code> code); Isolate* isolate; Handle<JSFunction> function; - MaybeHandle<Object> Call() { - return Execution::Call(isolate, function, undefined(), 0, nullptr); - } - - MaybeHandle<Object> Call(Handle<Object> a) { - Handle<Object> args[] = {a}; - return Execution::Call(isolate, function, undefined(), 1, args); - } - - MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b) { - Handle<Object> args[] = {a, b}; - return Execution::Call(isolate, function, undefined(), 2, args); - } - + MaybeHandle<Object> Call(); + MaybeHandle<Object> Call(Handle<Object> a); + MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b); MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b, - Handle<Object> c) { - Handle<Object> args[] = {a, b, c}; - return Execution::Call(isolate, function, undefined(), 3, args); - } - + Handle<Object> c); MaybeHandle<Object> Call(Handle<Object> a, Handle<Object> b, Handle<Object> c, - Handle<Object> d) { - Handle<Object> args[] = {a, b, c, d}; - return Execution::Call(isolate, function, undefined(), 4, args); - } - - void CheckThrows(Handle<Object> a, Handle<Object> b) { - TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); - MaybeHandle<Object> no_result = Call(a, b); - CHECK(isolate->has_pending_exception()); - CHECK(try_catch.HasCaught()); - CHECK(no_result.is_null()); - isolate->OptionalRescheduleException(true); - } + Handle<Object> d); + void CheckThrows(Handle<Object> a, Handle<Object> b); v8::Local<v8::Message> CheckThrowsReturnMessage(Handle<Object> a, - Handle<Object> b) { - TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); - MaybeHandle<Object> no_result = Call(a, b); - CHECK(isolate->has_pending_exception()); - CHECK(try_catch.HasCaught()); - CHECK(no_result.is_null()); - isolate->OptionalRescheduleException(true); - CHECK(!try_catch.Message().IsEmpty()); - return try_catch.Message(); - } - + Handle<Object> b); void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b, - Handle<Object> c, Handle<Object> d) { - Handle<Object> result = Call(a, b, c, d).ToHandleChecked(); - CHECK(expected->SameValue(*result)); - } + Handle<Object> c, Handle<Object> d); void CheckCall(Handle<Object> expected, Handle<Object> a, Handle<Object> b, Handle<Object> c) { @@ -158,83 +93,25 @@ class FunctionTester : public InitializedHandleScope { CheckCall(false_value(), Val(a), Val(b)); } - Handle<JSFunction> NewFunction(const char* source) { - return Handle<JSFunction>::cast(v8::Utils::OpenHandle( - *v8::Local<v8::Function>::Cast(CompileRun(source)))); - } + Handle<JSFunction> NewFunction(const char* source); + Handle<JSObject> NewObject(const char* source); - Handle<JSObject> NewObject(const char* source) { - return Handle<JSObject>::cast(v8::Utils::OpenHandle( - *v8::Local<v8::Object>::Cast(CompileRun(source)))); - } + Handle<String> Val(const char* string); + Handle<Object> Val(double value); + Handle<Object> infinity(); + Handle<Object> minus_infinity(); + Handle<Object> nan(); + Handle<Object> undefined(); + Handle<Object> null(); + Handle<Object> true_value(); + Handle<Object> false_value(); - Handle<String> Val(const char* string) { - return isolate->factory()->InternalizeUtf8String(string); - } - - Handle<Object> Val(double value) { - return isolate->factory()->NewNumber(value); - } - - Handle<Object> infinity() { return isolate->factory()->infinity_value(); } - - Handle<Object> minus_infinity() { return Val(-V8_INFINITY); } - - Handle<Object> nan() { return isolate->factory()->nan_value(); } - - Handle<Object> undefined() { return isolate->factory()->undefined_value(); } - - Handle<Object> null() { return isolate->factory()->null_value(); } - - Handle<Object> true_value() { return isolate->factory()->true_value(); } - - Handle<Object> false_value() { return isolate->factory()->false_value(); } - - static Handle<JSFunction> ForMachineGraph(Graph* graph, int param_count) { - JSFunction* p = NULL; - { // because of the implicit handle scope of FunctionTester. - FunctionTester f(graph, param_count); - p = *f.function; - } - return Handle<JSFunction>(p); // allocated in outer handle scope. - } + static Handle<JSFunction> ForMachineGraph(Graph* graph, int param_count); private: uint32_t flags_; - Handle<JSFunction> Compile(Handle<JSFunction> function) { - Zone zone(function->GetIsolate()->allocator()); - ParseInfo parse_info(&zone, function); - CompilationInfo info(&parse_info, function); - info.MarkAsDeoptimizationEnabled(); - - if (!FLAG_turbo_from_bytecode) { - CHECK(Parser::ParseStatic(info.parse_info())); - } - info.SetOptimizing(); - if (flags_ & CompilationInfo::kNativeContextSpecializing) { - info.MarkAsNativeContextSpecializing(); - } - if (flags_ & CompilationInfo::kInliningEnabled) { - info.MarkAsInliningEnabled(); - } - if (FLAG_turbo_from_bytecode) { - CHECK(Compiler::EnsureBytecode(&info)); - info.MarkAsOptimizeFromBytecode(); - } else { - CHECK(Compiler::Analyze(info.parse_info())); - CHECK(Compiler::EnsureDeoptimizationSupport(&info)); - } - JSFunction::EnsureLiterals(function); - - Handle<Code> code = Pipeline::GenerateCodeForTesting(&info); - CHECK(!code.is_null()); - info.dependencies()->Commit(code); - info.context()->native_context()->AddOptimizedCode(*code); - function->ReplaceCode(*code); - return function; - } - + Handle<JSFunction> Compile(Handle<JSFunction> function); std::string BuildFunction(int param_count) { std::string function_string = "(function("; if (param_count > 0) { @@ -250,19 +127,7 @@ class FunctionTester : public InitializedHandleScope { // Compile the given machine graph instead of the source of the function // and replace the JSFunction's code with the result. - Handle<JSFunction> CompileGraph(Graph* graph) { - Zone zone(function->GetIsolate()->allocator()); - ParseInfo parse_info(&zone, function); - CompilationInfo info(&parse_info, function); - - CHECK(Parser::ParseStatic(info.parse_info())); - info.SetOptimizing(); - - Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, graph); - CHECK(!code.is_null()); - function->ReplaceCode(*code); - return function; - } + Handle<JSFunction> CompileGraph(Graph* graph); }; } // namespace compiler } // namespace internal diff --git a/deps/v8/test/cctest/compiler/graph-builder-tester.h b/deps/v8/test/cctest/compiler/graph-builder-tester.h index c870a3e84e..c257448b8a 100644 --- a/deps/v8/test/cctest/compiler/graph-builder-tester.h +++ b/deps/v8/test/cctest/compiler/graph-builder-tester.h @@ -5,7 +5,7 @@ #ifndef V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ #define V8_CCTEST_COMPILER_GRAPH_BUILDER_TESTER_H_ -#include "src/compiler.h" +#include "src/compilation-info.h" #include "src/compiler/common-operator.h" #include "src/compiler/instruction-selector.h" #include "src/compiler/linkage.h" @@ -279,7 +279,8 @@ class GraphBuilderTester : public HandleAndZoneScope, Zone* zone = graph()->zone(); CallDescriptor* desc = Linkage::GetSimplifiedCDescriptor(zone, this->csig_); - CompilationInfo info(ArrayVector("testing"), main_isolate(), main_zone()); + CompilationInfo info(ArrayVector("testing"), main_isolate(), main_zone(), + Code::ComputeFlags(Code::STUB)); code_ = Pipeline::GenerateCodeForTesting(&info, desc, graph()); #ifdef ENABLE_DISASSEMBLER if (!code_.is_null() && FLAG_print_opt_code) { diff --git a/deps/v8/test/cctest/compiler/test-code-assembler.cc b/deps/v8/test/cctest/compiler/test-code-assembler.cc index d9bb9346f5..6fe733af8d 100644 --- a/deps/v8/test/cctest/compiler/test-code-assembler.cc +++ b/deps/v8/test/cctest/compiler/test-code-assembler.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/code-factory.h" #include "src/compiler/code-assembler.h" #include "src/isolate.h" #include "test/cctest/compiler/code-assembler-tester.h" diff --git a/deps/v8/test/cctest/compiler/test-gap-resolver.cc b/deps/v8/test/cctest/compiler/test-gap-resolver.cc index b8b1251724..3b1cdb6d81 100644 --- a/deps/v8/test/cctest/compiler/test-gap-resolver.cc +++ b/deps/v8/test/cctest/compiler/test-gap-resolver.cc @@ -11,6 +11,19 @@ namespace v8 { namespace internal { namespace compiler { +const auto GetRegConfig = RegisterConfiguration::Turbofan; + +// Fragments the given operand into an equivalent set of operands to simplify +// ParallelMove equivalence testing. +void GetCanonicalOperands(const InstructionOperand& op, + std::vector<InstructionOperand>* fragments) { + CHECK(!kSimpleFPAliasing); + CHECK(op.IsFPLocationOperand()); + // TODO(bbudge) Split into float operands on platforms with non-simple FP + // register aliasing. + fragments->push_back(op); +} + // The state of our move interpreter is the mapping of operands to values. Note // that the actual values don't really matter, all we care about is equality. class InterpreterState { @@ -18,7 +31,26 @@ class InterpreterState { void ExecuteInParallel(const ParallelMove* moves) { InterpreterState copy(*this); for (const auto m : *moves) { - if (!m->IsRedundant()) write(m->destination(), copy.read(m->source())); + CHECK(!m->IsRedundant()); + const InstructionOperand& src = m->source(); + const InstructionOperand& dst = m->destination(); + if (!kSimpleFPAliasing && src.IsFPLocationOperand() && + dst.IsFPLocationOperand()) { + // Canonicalize FP location-location moves. + std::vector<InstructionOperand> src_fragments; + GetCanonicalOperands(src, &src_fragments); + CHECK(!src_fragments.empty()); + std::vector<InstructionOperand> dst_fragments; + GetCanonicalOperands(dst, &dst_fragments); + CHECK_EQ(src_fragments.size(), dst_fragments.size()); + + for (size_t i = 0; i < src_fragments.size(); ++i) { + write(dst_fragments[i], copy.read(src_fragments[i])); + } + continue; + } + // All other moves. + write(dst, copy.read(src)); } } @@ -26,11 +58,13 @@ class InterpreterState { return values_ == other.values_; } - bool operator!=(const InterpreterState& other) const { - return values_ != other.values_; - } - private: + // struct for mapping operands to a unique value, that makes it easier to + // detect illegal parallel moves, and to evaluate moves for equivalence. This + // is a one way transformation. All general register and slot operands are + // mapped to the default representation. FP registers and slots are mapped to + // float64 except on architectures with non-simple FP register aliasing, where + // the actual representation is used. struct Key { bool is_constant; MachineRepresentation rep; @@ -42,7 +76,7 @@ class InterpreterState { return this->is_constant; } if (this->rep != other.rep) { - return static_cast<int>(this->rep) < static_cast<int>(other.rep); + return this->rep < other.rep; } if (this->kind != other.kind) { return this->kind < other.kind; @@ -56,7 +90,7 @@ class InterpreterState { } }; - // Internally, the state is a normalized permutation of (kind,index) pairs. + // Internally, the state is a normalized permutation of Value pairs. typedef Key Value; typedef std::map<Key, Value> OperandMap; @@ -65,11 +99,11 @@ class InterpreterState { return (it == values_.end()) ? ValueFor(op) : it->second; } - void write(const InstructionOperand& op, Value v) { - if (v == ValueFor(op)) { - values_.erase(KeyFor(op)); + void write(const InstructionOperand& dst, Value v) { + if (v == ValueFor(dst)) { + values_.erase(KeyFor(dst)); } else { - values_[KeyFor(op)] = v; + values_[KeyFor(dst)] = v; } } @@ -81,10 +115,11 @@ class InterpreterState { int index; if (!is_constant) { const LocationOperand& loc_op = LocationOperand::cast(op); + // Canonicalize FP location operand representations to kFloat64. + if (IsFloatingPoint(loc_op.representation())) { + rep = MachineRepresentation::kFloat64; + } if (loc_op.IsAnyRegister()) { - if (loc_op.IsFPRegister()) { - rep = MachineRepresentation::kFloat64; - } index = loc_op.register_code(); } else { index = loc_op.index(); @@ -115,7 +150,7 @@ class InterpreterState { InstructionOperand source = FromKey(it->second); InstructionOperand destination = FromKey(it->first); MoveOperands mo(source, destination); - PrintableMoveOperands pmo = {RegisterConfiguration::Turbofan(), &mo}; + PrintableMoveOperands pmo = {GetRegConfig(), &mo}; os << pmo; } return os; @@ -124,7 +159,6 @@ class InterpreterState { OperandMap values_; }; - // An abstract interpreter for moves, swaps and parallel moves. class MoveInterpreter : public GapResolver::Assembler { public: @@ -161,24 +195,87 @@ class ParallelMoveCreator : public HandleAndZoneScope { public: ParallelMoveCreator() : rng_(CcTest::random_number_generator()) {} + // Creates a ParallelMove with 'size' random MoveOperands. Note that illegal + // moves will be rejected, so the actual number of MoveOperands may be less. ParallelMove* Create(int size) { ParallelMove* parallel_move = new (main_zone()) ParallelMove(main_zone()); - std::set<InstructionOperand, CompareOperandModuloType> seen; + // Valid ParallelMoves can't have interfering destination ops. + std::set<InstructionOperand, CompareOperandModuloType> destinations; + // Valid ParallelMoves can't have interfering source ops of different reps. + std::map<InstructionOperand, MachineRepresentation, + CompareOperandModuloType> + sources; for (int i = 0; i < size; ++i) { MachineRepresentation rep = RandomRepresentation(); MoveOperands mo(CreateRandomOperand(true, rep), CreateRandomOperand(false, rep)); - if (!mo.IsRedundant() && seen.find(mo.destination()) == seen.end()) { + if (mo.IsRedundant()) continue; + + const InstructionOperand& dst = mo.destination(); + bool reject = false; + // On architectures where FP register aliasing is non-simple, update the + // destinations set with the float equivalents of the operand and check + // that all destinations are unique and do not alias each other. + if (!kSimpleFPAliasing && mo.destination().IsFPLocationOperand()) { + std::vector<InstructionOperand> fragments; + GetCanonicalOperands(dst, &fragments); + CHECK(!fragments.empty()); + for (size_t i = 0; i < fragments.size(); ++i) { + if (destinations.find(fragments[i]) == destinations.end()) { + destinations.insert(fragments[i]); + } else { + reject = true; + break; + } + } + // Update the sources map, and check that no FP source has multiple + // representations. + const InstructionOperand& src = mo.source(); + if (src.IsFPRegister()) { + std::vector<InstructionOperand> fragments; + MachineRepresentation src_rep = + LocationOperand::cast(src).representation(); + GetCanonicalOperands(src, &fragments); + CHECK(!fragments.empty()); + for (size_t i = 0; i < fragments.size(); ++i) { + auto find_it = sources.find(fragments[i]); + if (find_it != sources.end() && find_it->second != src_rep) { + reject = true; + break; + } + sources.insert(std::make_pair(fragments[i], src_rep)); + } + } + } else { + if (destinations.find(dst) == destinations.end()) { + destinations.insert(dst); + } else { + reject = true; + } + } + + if (!reject) { parallel_move->AddMove(mo.source(), mo.destination()); - seen.insert(mo.destination()); } } return parallel_move; } + // Creates a ParallelMove from a list of operand pairs. Even operands are + // destinations, odd ones are sources. + ParallelMove* Create(const std::vector<InstructionOperand>& operand_pairs) { + ParallelMove* parallel_move = new (main_zone()) ParallelMove(main_zone()); + for (size_t i = 0; i < operand_pairs.size(); i += 2) { + const InstructionOperand& dst = operand_pairs[i]; + const InstructionOperand& src = operand_pairs[i + 1]; + parallel_move->AddMove(src, dst); + } + return parallel_move; + } + private: MachineRepresentation RandomRepresentation() { - int index = rng_->NextInt(5); + int index = rng_->NextInt(6); switch (index) { case 0: return MachineRepresentation::kWord32; @@ -189,47 +286,65 @@ class ParallelMoveCreator : public HandleAndZoneScope { case 3: return MachineRepresentation::kFloat64; case 4: + return MachineRepresentation::kSimd128; + case 5: return MachineRepresentation::kTagged; } UNREACHABLE(); return MachineRepresentation::kNone; } + const int kMaxIndex = 7; + const int kMaxIndices = kMaxIndex + 1; + + // Non-FP slots shouldn't overlap FP slots. + // FP slots with different representations shouldn't overlap. + int GetValidSlotIndex(MachineRepresentation rep, int index) { + DCHECK_GE(kMaxIndex, index); + // The first group of slots are for non-FP values. + if (!IsFloatingPoint(rep)) return index; + // The next group are for float values. + int base = kMaxIndices; + if (rep == MachineRepresentation::kFloat32) return base + index; + // Double values. + base += kMaxIndices; + if (rep == MachineRepresentation::kFloat64) return base + index * 2; + // SIMD values + base += kMaxIndices * 2; + CHECK_EQ(MachineRepresentation::kSimd128, rep); + return base + index * 4; + } + InstructionOperand CreateRandomOperand(bool is_source, MachineRepresentation rep) { auto conf = RegisterConfiguration::Turbofan(); - auto GetRegisterCode = [&conf](MachineRepresentation rep, int index) { + auto GetValidRegisterCode = [&conf](MachineRepresentation rep, int index) { switch (rep) { case MachineRepresentation::kFloat32: -#if V8_TARGET_ARCH_ARM - // Only even number float registers are used on Arm. - // TODO(bbudge) Eliminate this when FP register aliasing works. - return conf->RegisterConfiguration::GetAllocatableDoubleCode(index) * - 2; -#endif - // Fall through on non-Arm targets. case MachineRepresentation::kFloat64: + case MachineRepresentation::kSimd128: return conf->RegisterConfiguration::GetAllocatableDoubleCode(index); - default: return conf->RegisterConfiguration::GetAllocatableGeneralCode(index); } UNREACHABLE(); return static_cast<int>(Register::kCode_no_reg); }; - int index = rng_->NextInt(7); + int index = rng_->NextInt(kMaxIndex); // destination can't be Constant. switch (rng_->NextInt(is_source ? 5 : 4)) { case 0: - return AllocatedOperand(LocationOperand::STACK_SLOT, rep, index); + return AllocatedOperand(LocationOperand::STACK_SLOT, rep, + GetValidSlotIndex(rep, index)); case 1: - return AllocatedOperand(LocationOperand::REGISTER, rep, index); + return AllocatedOperand(LocationOperand::REGISTER, rep, + GetValidRegisterCode(rep, index)); case 2: return ExplicitOperand(LocationOperand::REGISTER, rep, - GetRegisterCode(rep, 1)); + GetValidRegisterCode(rep, 1)); case 3: return ExplicitOperand(LocationOperand::STACK_SLOT, rep, - GetRegisterCode(rep, index)); + GetValidSlotIndex(rep, index)); case 4: return ConstantOperand(index); } @@ -241,22 +356,23 @@ class ParallelMoveCreator : public HandleAndZoneScope { v8::base::RandomNumberGenerator* rng_; }; +void RunTest(ParallelMove* pm, Zone* zone) { + // Note: The gap resolver modifies the ParallelMove, so interpret first. + MoveInterpreter mi1(zone); + mi1.AssembleParallelMove(pm); + + MoveInterpreter mi2(zone); + GapResolver resolver(&mi2); + resolver.Resolve(pm); + + CHECK_EQ(mi1.state(), mi2.state()); +} TEST(FuzzResolver) { ParallelMoveCreator pmc; - for (int size = 0; size < 20; ++size) { + for (int size = 0; size < 80; ++size) { for (int repeat = 0; repeat < 50; ++repeat) { - ParallelMove* pm = pmc.Create(size); - - // Note: The gap resolver modifies the ParallelMove, so interpret first. - MoveInterpreter mi1(pmc.main_zone()); - mi1.AssembleParallelMove(pm); - - MoveInterpreter mi2(pmc.main_zone()); - GapResolver resolver(&mi2); - resolver.Resolve(pm); - - CHECK_EQ(mi1.state(), mi2.state()); + RunTest(pmc.Create(size), pmc.main_zone()); } } } diff --git a/deps/v8/test/cctest/compiler/test-instruction.cc b/deps/v8/test/cctest/compiler/test-instruction.cc index 4cf72a55ce..5265e476aa 100644 --- a/deps/v8/test/cctest/compiler/test-instruction.cc +++ b/deps/v8/test/cctest/compiler/test-instruction.cc @@ -268,7 +268,7 @@ TEST(InstructionAddGapMove) { TEST(InstructionOperands) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); { 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 06169f3ba6..24107b88ea 100644 --- a/deps/v8/test/cctest/compiler/test-js-constant-cache.cc +++ b/deps/v8/test/cctest/compiler/test-js-constant-cache.cc @@ -5,8 +5,14 @@ #include "src/assembler.h" #include "src/compiler/js-graph.h" #include "src/compiler/node-properties.h" -#include "src/compiler/typer.h" -#include "src/types.h" +#include "src/factory.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" @@ -20,12 +26,10 @@ class JSCacheTesterHelper { : main_graph_(zone), main_common_(zone), main_javascript_(zone), - main_typer_(isolate, &main_graph_), main_machine_(zone) {} Graph main_graph_; CommonOperatorBuilder main_common_; JSOperatorBuilder main_javascript_; - Typer main_typer_; MachineOperatorBuilder main_machine_; }; @@ -42,11 +46,8 @@ class JSConstantCacheTester : public HandleAndZoneScope, main_graph_.SetStart(main_graph_.NewNode(common()->Start(0))); main_graph_.SetEnd( main_graph_.NewNode(common()->End(1), main_graph_.start())); - main_typer_.Run(); } - Type* TypeOf(Node* node) { return NodeProperties::GetType(node); } - Handle<HeapObject> handle(Node* node) { CHECK_EQ(IrOpcode::kHeapConstant, node->opcode()); return OpParameter<Handle<HeapObject>>(node); @@ -68,15 +69,6 @@ TEST(ZeroConstant1) { CHECK_NE(zero, T.Constant(std::numeric_limits<double>::quiet_NaN())); CHECK_NE(zero, T.Float64Constant(0)); CHECK_NE(zero, T.Int32Constant(0)); - - Type* t = T.TypeOf(zero); - - CHECK(t->Is(Type::Number())); - CHECK(t->Is(Type::Integral32())); - CHECK(t->Is(Type::Signed32())); - CHECK(t->Is(Type::Unsigned32())); - CHECK(t->Is(Type::SignedSmall())); - CHECK(t->Is(Type::UnsignedSmall())); } @@ -90,16 +82,6 @@ TEST(MinusZeroConstant) { CHECK_EQ(minus_zero, T.Constant(-0.0)); CHECK_NE(zero, minus_zero); - Type* t = T.TypeOf(minus_zero); - - CHECK(t->Is(Type::Number())); - CHECK(t->Is(Type::MinusZero())); - CHECK(!t->Is(Type::Integral32())); - CHECK(!t->Is(Type::Signed32())); - CHECK(!t->Is(Type::Unsigned32())); - CHECK(!t->Is(Type::SignedSmall())); - CHECK(!t->Is(Type::UnsignedSmall())); - double zero_value = OpParameter<double>(zero); double minus_zero_value = OpParameter<double>(minus_zero); @@ -122,15 +104,6 @@ TEST(ZeroConstant2) { CHECK_NE(zero, T.Constant(std::numeric_limits<double>::quiet_NaN())); CHECK_NE(zero, T.Float64Constant(0)); CHECK_NE(zero, T.Int32Constant(0)); - - Type* t = T.TypeOf(zero); - - CHECK(t->Is(Type::Number())); - CHECK(t->Is(Type::Integral32())); - CHECK(t->Is(Type::Signed32())); - CHECK(t->Is(Type::Unsigned32())); - CHECK(t->Is(Type::SignedSmall())); - CHECK(t->Is(Type::UnsignedSmall())); } @@ -147,15 +120,6 @@ TEST(OneConstant1) { CHECK_NE(one, T.Constant(std::numeric_limits<double>::quiet_NaN())); CHECK_NE(one, T.Float64Constant(1.0)); CHECK_NE(one, T.Int32Constant(1)); - - Type* t = T.TypeOf(one); - - CHECK(t->Is(Type::Number())); - CHECK(t->Is(Type::Integral32())); - CHECK(t->Is(Type::Signed32())); - CHECK(t->Is(Type::Unsigned32())); - CHECK(t->Is(Type::SignedSmall())); - CHECK(t->Is(Type::UnsignedSmall())); } @@ -172,15 +136,6 @@ TEST(OneConstant2) { CHECK_NE(one, T.Constant(std::numeric_limits<double>::quiet_NaN())); CHECK_NE(one, T.Float64Constant(1.0)); CHECK_NE(one, T.Int32Constant(1)); - - Type* t = T.TypeOf(one); - - CHECK(t->Is(Type::Number())); - CHECK(t->Is(Type::Integral32())); - CHECK(t->Is(Type::Signed32())); - CHECK(t->Is(Type::Unsigned32())); - CHECK(t->Is(Type::SignedSmall())); - CHECK(t->Is(Type::UnsignedSmall())); } @@ -227,17 +182,6 @@ TEST(CanonicalizingNumbers) { } -TEST(NumberTypes) { - JSConstantCacheTester T; - - FOR_FLOAT64_INPUTS(i) { - double value = *i; - Node* node = T.Constant(value); - CHECK(T.TypeOf(node)->Is(Type::Of(value, T.main_zone()))); - } -} - - TEST(HeapNumbers) { JSConstantCacheTester T; @@ -277,21 +221,6 @@ TEST(OddballValues) { } -TEST(OddballTypes) { - JSConstantCacheTester T; - - CHECK(T.TypeOf(T.UndefinedConstant())->Is(Type::Undefined())); - // TODO(dcarney): figure this out. - // CHECK(T.TypeOf(T.TheHoleConstant())->Is(Type::Internal())); - CHECK(T.TypeOf(T.TrueConstant())->Is(Type::Boolean())); - CHECK(T.TypeOf(T.FalseConstant())->Is(Type::Boolean())); - CHECK(T.TypeOf(T.NullConstant())->Is(Type::Null())); - CHECK(T.TypeOf(T.ZeroConstant())->Is(Type::Number())); - CHECK(T.TypeOf(T.OneConstant())->Is(Type::Number())); - CHECK(T.TypeOf(T.NaNConstant())->Is(Type::NaN())); -} - - TEST(ExternalReferences) { // TODO(titzer): test canonicalization of external references. } 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 88cd6c663c..604e696ab5 100644 --- a/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc +++ b/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc @@ -11,6 +11,13 @@ #include "src/compiler/operator-properties.h" #include "src/compiler/simplified-operator.h" #include "src/compiler/typer.h" +#include "src/factory.h" +#include "src/isolate.h" +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" namespace v8 { @@ -463,10 +470,9 @@ TEST(JSToNumber_replacement) { TEST(JSToNumberOfConstant) { JSTypedLoweringTester R; - const Operator* ops[] = { - R.common.NumberConstant(0), R.common.NumberConstant(-1), - R.common.NumberConstant(0.1), R.common.Int32Constant(1177), - R.common.Float64Constant(0.99)}; + const Operator* ops[] = {R.common.NumberConstant(0), + R.common.NumberConstant(-1), + R.common.NumberConstant(0.1)}; for (size_t i = 0; i < arraysize(ops); i++) { Node* n = R.graph.NewNode(ops[i]); diff --git a/deps/v8/test/cctest/compiler/test-jump-threading.cc b/deps/v8/test/cctest/compiler/test-jump-threading.cc index ed3d79e4ba..e58de67afc 100644 --- a/deps/v8/test/cctest/compiler/test-jump-threading.cc +++ b/deps/v8/test/cctest/compiler/test-jump-threading.cc @@ -106,7 +106,7 @@ class TestCode : public HandleAndZoneScope { void VerifyForwarding(TestCode& code, int count, int* expected) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone local_zone(&allocator); ZoneVector<RpoNumber> result(&local_zone); JumpThreading::ComputeForwarding(&local_zone, result, &code.sequence_, true); diff --git a/deps/v8/test/cctest/compiler/test-linkage.cc b/deps/v8/test/cctest/compiler/test-linkage.cc index 6661e916db..59ef5fdd25 100644 --- a/deps/v8/test/cctest/compiler/test-linkage.cc +++ b/deps/v8/test/cctest/compiler/test-linkage.cc @@ -2,12 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/code-factory.h" #include "src/code-stubs.h" +#include "src/compilation-info.h" #include "src/compiler.h" -#include "src/parsing/parse-info.h" -#include "src/zone.h" - -#include "src/code-factory.h" #include "src/compiler/common-operator.h" #include "src/compiler/graph.h" #include "src/compiler/linkage.h" @@ -16,6 +14,8 @@ #include "src/compiler/operator.h" #include "src/compiler/pipeline.h" #include "src/compiler/schedule.h" +#include "src/parsing/parse-info.h" +#include "src/zone/zone.h" #include "test/cctest/cctest.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/test-loop-assignment-analysis.cc b/deps/v8/test/cctest/compiler/test-loop-assignment-analysis.cc index 8ee79ddb60..d97e038883 100644 --- a/deps/v8/test/cctest/compiler/test-loop-assignment-analysis.cc +++ b/deps/v8/test/cctest/compiler/test-loop-assignment-analysis.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "src/ast/scopes.h" -#include "src/compiler.h" +#include "src/compilation-info.h" #include "src/compiler/ast-loop-assignment-analyzer.h" #include "src/parsing/parse-info.h" #include "src/parsing/parser.h" @@ -37,7 +37,7 @@ struct TestHelper : public HandleAndZoneScope { CHECK(Parser::ParseStatic(&parse_info)); CHECK(Rewriter::Rewrite(&parse_info)); - Scope::Analyze(&parse_info); + DeclarationScope::Analyze(&parse_info, AnalyzeMode::kRegular); DeclarationScope* scope = info.literal()->scope(); AstValueFactory* factory = parse_info.ast_value_factory(); diff --git a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc index d4ea47368a..cf3da887ba 100644 --- a/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc +++ b/deps/v8/test/cctest/compiler/test-machine-operator-reducer.cc @@ -83,7 +83,6 @@ class ReducerTester : public HandleAndZoneScope { common(main_zone()), graph(main_zone()), javascript(main_zone()), - typer(isolate, &graph), jsgraph(isolate, &graph, &common, &javascript, nullptr, &machine), maxuint32(Constant<int32_t>(kMaxUInt32)) { Node* s = graph.NewNode(common.Start(num_parameters)); @@ -97,7 +96,6 @@ class ReducerTester : public HandleAndZoneScope { CommonOperatorBuilder common; Graph graph; JSOperatorBuilder javascript; - Typer typer; JSGraph jsgraph; Node* maxuint32; diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc index 2221ffbc86..6cda32c792 100644 --- a/deps/v8/test/cctest/compiler/test-multiple-return.cc +++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc @@ -64,7 +64,7 @@ CallDescriptor* GetCallDescriptor(Zone* zone, int return_count, TEST(ReturnThreeValues) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); CallDescriptor* desc = GetCallDescriptor(&zone, 3, 2); HandleAndZoneScope handles; @@ -81,7 +81,7 @@ TEST(ReturnThreeValues) { m.Return(add, sub, mul); CompilationInfo info(ArrayVector("testing"), handles.main_isolate(), - handles.main_zone()); + handles.main_zone(), Code::ComputeFlags(Code::STUB)); Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, desc, m.graph(), m.Export()); #ifdef ENABLE_DISASSEMBLER diff --git a/deps/v8/test/cctest/compiler/test-node.cc b/deps/v8/test/cctest/compiler/test-node.cc index e2aacf3100..c5fc5b3c50 100644 --- a/deps/v8/test/cctest/compiler/test-node.cc +++ b/deps/v8/test/cctest/compiler/test-node.cc @@ -141,7 +141,7 @@ void CheckInputs(Node* node, Node** inputs, int input_count) { TEST(NodeUseIteratorReplaceUses) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -167,7 +167,7 @@ TEST(NodeUseIteratorReplaceUses) { TEST(NodeUseIteratorReplaceUsesSelf) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -192,7 +192,7 @@ TEST(NodeUseIteratorReplaceUsesSelf) { TEST(ReplaceInput) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -219,7 +219,7 @@ TEST(ReplaceInput) { TEST(OwnedBy) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -270,7 +270,7 @@ TEST(OwnedBy) { TEST(Uses) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -293,7 +293,7 @@ TEST(Uses) { TEST(Inputs) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -321,7 +321,7 @@ TEST(Inputs) { } TEST(InsertInputs) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -396,7 +396,7 @@ TEST(InsertInputs) { } TEST(RemoveInput) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -427,7 +427,7 @@ TEST(RemoveInput) { TEST(AppendInputsAndIterator) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -450,7 +450,7 @@ TEST(AppendInputsAndIterator) { TEST(NullInputsSimple) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -478,7 +478,7 @@ TEST(NullInputsSimple) { TEST(NullInputsAppended) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -502,7 +502,7 @@ TEST(NullInputsAppended) { TEST(ReplaceUsesFromAppendedInputs) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -531,7 +531,7 @@ TEST(ReplaceUsesFromAppendedInputs) { TEST(ReplaceInputMultipleUses) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -550,7 +550,7 @@ TEST(ReplaceInputMultipleUses) { TEST(TrimInputCountInline) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -619,7 +619,7 @@ TEST(TrimInputCountInline) { TEST(TrimInputCountOutOfLine1) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -714,7 +714,7 @@ TEST(TrimInputCountOutOfLine1) { TEST(TrimInputCountOutOfLine2) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -784,7 +784,7 @@ TEST(TrimInputCountOutOfLine2) { TEST(NullAllInputs) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); @@ -837,7 +837,7 @@ TEST(NullAllInputs) { TEST(AppendAndTrim) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); Graph graph(&zone); diff --git a/deps/v8/test/cctest/compiler/test-representation-change.cc b/deps/v8/test/cctest/compiler/test-representation-change.cc index b475e9a5b9..242793340e 100644 --- a/deps/v8/test/cctest/compiler/test-representation-change.cc +++ b/deps/v8/test/cctest/compiler/test-representation-change.cc @@ -493,9 +493,9 @@ static void CheckChange(IrOpcode::Value expected, MachineRepresentation from, TEST(SingleChanges) { CheckChange(IrOpcode::kChangeTaggedToBit, MachineRepresentation::kTagged, - Type::None(), MachineRepresentation::kBit); + Type::Boolean(), MachineRepresentation::kBit); CheckChange(IrOpcode::kChangeBitToTagged, MachineRepresentation::kBit, - Type::None(), MachineRepresentation::kTagged); + Type::Boolean(), MachineRepresentation::kTagged); CheckChange(IrOpcode::kChangeInt31ToTaggedSigned, MachineRepresentation::kWord32, Type::Signed31(), @@ -525,15 +525,11 @@ TEST(SingleChanges) { Type::Unsigned32(), MachineRepresentation::kWord32); CheckChange(IrOpcode::kChangeTaggedToFloat64, MachineRepresentation::kTagged, Type::Number(), MachineRepresentation::kFloat64); - CheckChange(IrOpcode::kChangeTaggedToFloat64, MachineRepresentation::kTagged, - Type::Number(), MachineRepresentation::kFloat64); CheckChange(IrOpcode::kTruncateTaggedToFloat64, MachineRepresentation::kTagged, Type::NumberOrUndefined(), MachineRepresentation::kFloat64); - CheckTwoChanges(IrOpcode::kChangeTaggedSignedToInt32, - IrOpcode::kChangeInt32ToFloat64, - MachineRepresentation::kTagged, Type::TaggedSigned(), - MachineRepresentation::kFloat64); + CheckChange(IrOpcode::kChangeTaggedToFloat64, MachineRepresentation::kTagged, + Type::Signed31(), MachineRepresentation::kFloat64); // Int32,Uint32 <-> Float64 are actually machine conversions. CheckChange(IrOpcode::kChangeInt32ToFloat64, MachineRepresentation::kWord32, @@ -546,7 +542,7 @@ TEST(SingleChanges) { Type::Unsigned32(), MachineRepresentation::kWord32); CheckChange(IrOpcode::kTruncateFloat64ToFloat32, - MachineRepresentation::kFloat64, Type::None(), + MachineRepresentation::kFloat64, Type::Number(), MachineRepresentation::kFloat32); // Int32,Uint32 <-> Float32 require two changes. @@ -570,11 +566,11 @@ TEST(SingleChanges) { // Float32 <-> Tagged require two changes. CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64, IrOpcode::kChangeFloat64ToTagged, - MachineRepresentation::kFloat32, Type::None(), + MachineRepresentation::kFloat32, Type::Number(), MachineRepresentation::kTagged); CheckTwoChanges(IrOpcode::kChangeTaggedToFloat64, IrOpcode::kTruncateFloat64ToFloat32, - MachineRepresentation::kTagged, Type::None(), + MachineRepresentation::kTagged, Type::Number(), MachineRepresentation::kFloat32); } @@ -587,7 +583,7 @@ TEST(SignednessInWord32) { CheckChange(IrOpcode::kChangeTaggedToUint32, MachineRepresentation::kTagged, Type::Unsigned32(), MachineRepresentation::kWord32); CheckChange(IrOpcode::kChangeInt32ToFloat64, MachineRepresentation::kWord32, - Type::None(), MachineRepresentation::kFloat64); + Type::Signed32(), MachineRepresentation::kFloat64); CheckChange(IrOpcode::kChangeFloat64ToInt32, MachineRepresentation::kFloat64, Type::Signed32(), MachineRepresentation::kWord32); CheckChange(IrOpcode::kTruncateFloat64ToWord32, @@ -600,7 +596,7 @@ TEST(SignednessInWord32) { CheckTwoChanges(IrOpcode::kChangeInt32ToFloat64, IrOpcode::kTruncateFloat64ToFloat32, - MachineRepresentation::kWord32, Type::None(), + MachineRepresentation::kWord32, Type::Signed32(), MachineRepresentation::kFloat32); CheckTwoChanges(IrOpcode::kChangeFloat32ToFloat64, IrOpcode::kTruncateFloat64ToWord32, @@ -614,13 +610,11 @@ TEST(Nops) { // X -> X is always a nop for any single representation X. for (size_t i = 0; i < arraysize(kMachineTypes); i++) { - r.CheckNop(kMachineTypes[i].representation(), Type::None(), + r.CheckNop(kMachineTypes[i].representation(), Type::Number(), kMachineTypes[i].representation()); } // 32-bit floats. - r.CheckNop(MachineRepresentation::kFloat32, Type::None(), - MachineRepresentation::kFloat32); r.CheckNop(MachineRepresentation::kFloat32, Type::Number(), MachineRepresentation::kFloat32); @@ -639,14 +633,6 @@ TEST(Nops) { MachineRepresentation::kWord32); // kRepBit (result of comparison) is implicitly a wordish thing. - r.CheckNop(MachineRepresentation::kBit, Type::None(), - MachineRepresentation::kWord8); - r.CheckNop(MachineRepresentation::kBit, Type::None(), - MachineRepresentation::kWord16); - r.CheckNop(MachineRepresentation::kBit, Type::None(), - MachineRepresentation::kWord32); - r.CheckNop(MachineRepresentation::kBit, Type::None(), - MachineRepresentation::kWord64); r.CheckNop(MachineRepresentation::kBit, Type::Boolean(), MachineRepresentation::kWord8); r.CheckNop(MachineRepresentation::kBit, Type::Boolean(), @@ -661,40 +647,24 @@ TEST(Nops) { TEST(TypeErrors) { RepresentationChangerTester r; - // Wordish cannot be implicitly converted to/from comparison conditions. - r.CheckTypeError(MachineRepresentation::kWord8, Type::None(), - MachineRepresentation::kBit); - r.CheckTypeError(MachineRepresentation::kWord16, Type::None(), - MachineRepresentation::kBit); - r.CheckTypeError(MachineRepresentation::kWord32, Type::None(), - MachineRepresentation::kBit); - r.CheckTypeError(MachineRepresentation::kWord64, Type::None(), - MachineRepresentation::kBit); - - // Floats cannot be implicitly converted to/from comparison conditions. - r.CheckTypeError(MachineRepresentation::kFloat64, Type::None(), - MachineRepresentation::kBit); - // Floats cannot be implicitly converted to/from comparison conditions. - r.CheckTypeError(MachineRepresentation::kFloat32, Type::None(), - MachineRepresentation::kBit); - r.CheckTypeError(MachineRepresentation::kBit, Type::None(), + r.CheckTypeError(MachineRepresentation::kBit, Type::Number(), MachineRepresentation::kFloat32); r.CheckTypeError(MachineRepresentation::kBit, Type::Boolean(), MachineRepresentation::kFloat32); // Word64 is internal and shouldn't be implicitly converted. - r.CheckTypeError(MachineRepresentation::kWord64, Type::None(), + r.CheckTypeError(MachineRepresentation::kWord64, Type::Internal(), MachineRepresentation::kTagged); - r.CheckTypeError(MachineRepresentation::kTagged, Type::None(), + r.CheckTypeError(MachineRepresentation::kTagged, Type::Number(), MachineRepresentation::kWord64); r.CheckTypeError(MachineRepresentation::kTagged, Type::Boolean(), MachineRepresentation::kWord64); // Word64 / Word32 shouldn't be implicitly converted. - r.CheckTypeError(MachineRepresentation::kWord64, Type::None(), + r.CheckTypeError(MachineRepresentation::kWord64, Type::Internal(), MachineRepresentation::kWord32); - r.CheckTypeError(MachineRepresentation::kWord32, Type::None(), + r.CheckTypeError(MachineRepresentation::kWord32, Type::Number(), MachineRepresentation::kWord64); r.CheckTypeError(MachineRepresentation::kWord32, Type::Signed32(), MachineRepresentation::kWord64); diff --git a/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc b/deps/v8/test/cctest/compiler/test-run-bytecode-graph-builder.cc index 446b5e7d5f..9c2b05dd4b 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/compiler.h" +#include "src/compilation-info.h" #include "src/compiler/pipeline.h" #include "src/execution.h" #include "src/handles.h" @@ -1067,6 +1067,105 @@ TEST(BytecodeGraphBuilderLookupSlot) { } } +TEST(BytecodeGraphBuilderLookupContextSlot) { + HandleAndZoneScope scope; + Isolate* isolate = scope.main_isolate(); + Zone* zone = scope.main_zone(); + Factory* factory = isolate->factory(); + + // Testing with eval called in the current context. + const char* inner_eval_prologue = "var x = 0; function inner() {"; + const char* inner_eval_epilogue = "}; return inner();"; + + ExpectedSnippet<0> inner_eval_snippets[] = { + {"eval(''); return x;", {factory->NewNumber(0)}}, + {"eval('var x = 1'); return x;", {factory->NewNumber(1)}}, + {"'use strict'; eval('var x = 1'); return x;", {factory->NewNumber(0)}}}; + + for (size_t i = 0; i < arraysize(inner_eval_snippets); i++) { + ScopedVector<char> script(1024); + SNPrintF(script, "function %s(p1) { %s %s %s } ; %s() ;", kFunctionName, + inner_eval_prologue, inner_eval_snippets[i].code_snippet, + inner_eval_epilogue, kFunctionName); + + BytecodeGraphTester tester(isolate, zone, script.start()); + auto callable = tester.GetCallable<>(); + Handle<Object> return_value = callable().ToHandleChecked(); + CHECK(return_value->SameValue(*inner_eval_snippets[i].return_value())); + } + + // Testing with eval called in a parent context. + const char* outer_eval_prologue = ""; + const char* outer_eval_epilogue = + "function inner() { return x; }; return inner();"; + + ExpectedSnippet<0> outer_eval_snippets[] = { + {"var x = 0; eval('');", {factory->NewNumber(0)}}, + {"var x = 0; eval('var x = 1');", {factory->NewNumber(1)}}, + {"'use strict'; var x = 0; eval('var x = 1');", {factory->NewNumber(0)}}}; + + for (size_t i = 0; i < arraysize(outer_eval_snippets); i++) { + ScopedVector<char> script(1024); + SNPrintF(script, "function %s() { %s %s %s } ; %s() ;", kFunctionName, + outer_eval_prologue, outer_eval_snippets[i].code_snippet, + outer_eval_epilogue, kFunctionName); + + BytecodeGraphTester tester(isolate, zone, script.start()); + auto callable = tester.GetCallable<>(); + Handle<Object> return_value = callable().ToHandleChecked(); + CHECK(return_value->SameValue(*outer_eval_snippets[i].return_value())); + } +} + +TEST(BytecodeGraphBuilderLookupGlobalSlot) { + HandleAndZoneScope scope; + Isolate* isolate = scope.main_isolate(); + Zone* zone = scope.main_zone(); + Factory* factory = isolate->factory(); + + // Testing with eval called in the current context. + const char* inner_eval_prologue = "x = 0; function inner() {"; + const char* inner_eval_epilogue = "}; return inner();"; + + ExpectedSnippet<0> inner_eval_snippets[] = { + {"eval(''); return x;", {factory->NewNumber(0)}}, + {"eval('var x = 1'); return x;", {factory->NewNumber(1)}}, + {"'use strict'; eval('var x = 1'); return x;", {factory->NewNumber(0)}}}; + + for (size_t i = 0; i < arraysize(inner_eval_snippets); i++) { + ScopedVector<char> script(1024); + SNPrintF(script, "function %s(p1) { %s %s %s } ; %s() ;", kFunctionName, + inner_eval_prologue, inner_eval_snippets[i].code_snippet, + inner_eval_epilogue, kFunctionName); + + BytecodeGraphTester tester(isolate, zone, script.start()); + auto callable = tester.GetCallable<>(); + Handle<Object> return_value = callable().ToHandleChecked(); + CHECK(return_value->SameValue(*inner_eval_snippets[i].return_value())); + } + + // Testing with eval called in a parent context. + const char* outer_eval_prologue = ""; + const char* outer_eval_epilogue = + "function inner() { return x; }; return inner();"; + + ExpectedSnippet<0> outer_eval_snippets[] = { + {"x = 0; eval('');", {factory->NewNumber(0)}}, + {"x = 0; eval('var x = 1');", {factory->NewNumber(1)}}, + {"'use strict'; x = 0; eval('var x = 1');", {factory->NewNumber(0)}}}; + + for (size_t i = 0; i < arraysize(outer_eval_snippets); i++) { + ScopedVector<char> script(1024); + SNPrintF(script, "function %s() { %s %s %s } ; %s() ;", kFunctionName, + outer_eval_prologue, outer_eval_snippets[i].code_snippet, + outer_eval_epilogue, kFunctionName); + + BytecodeGraphTester tester(isolate, zone, script.start()); + auto callable = tester.GetCallable<>(); + Handle<Object> return_value = callable().ToHandleChecked(); + CHECK(return_value->SameValue(*outer_eval_snippets[i].return_value())); + } +} TEST(BytecodeGraphBuilderLookupSlotWide) { HandleAndZoneScope scope; diff --git a/deps/v8/test/cctest/compiler/test-run-inlining.cc b/deps/v8/test/cctest/compiler/test-run-inlining.cc index b715214c0d..aab8b4e86b 100644 --- a/deps/v8/test/cctest/compiler/test-run-inlining.cc +++ b/deps/v8/test/cctest/compiler/test-run-inlining.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/compilation-info.h" #include "src/frames-inl.h" #include "test/cctest/compiler/function-tester.h" diff --git a/deps/v8/test/cctest/compiler/test-run-intrinsics.cc b/deps/v8/test/cctest/compiler/test-run-intrinsics.cc index 681891c91f..47116ad674 100644 --- a/deps/v8/test/cctest/compiler/test-run-intrinsics.cc +++ b/deps/v8/test/cctest/compiler/test-run-intrinsics.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/compilation-info.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { @@ -130,15 +131,6 @@ TEST(StringCharCodeAt) { } -TEST(StringCharFromCode) { - FunctionTester T("(function(a) { return %_StringCharFromCode(a); })", flags); - - T.CheckCall(T.Val("a"), T.Val(97)); - T.CheckCall(T.Val("\xE2\x9D\x8A"), T.Val(0x274A)); - T.CheckCall(T.Val(""), T.undefined()); -} - - TEST(StringCompare) { FunctionTester T("(function(a,b) { return %_StringCompare(a,b); })", flags); diff --git a/deps/v8/test/cctest/compiler/test-run-jsbranches.cc b/deps/v8/test/cctest/compiler/test-run-jsbranches.cc index 613528d7a0..502295e471 100644 --- a/deps/v8/test/cctest/compiler/test-run-jsbranches.cc +++ b/deps/v8/test/cctest/compiler/test-run-jsbranches.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/objects-inl.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/test-run-jscalls.cc b/deps/v8/test/cctest/compiler/test-run-jscalls.cc index f69e508f90..84d7f714ae 100644 --- a/deps/v8/test/cctest/compiler/test-run-jscalls.cc +++ b/deps/v8/test/cctest/compiler/test-run-jscalls.cc @@ -2,6 +2,10 @@ // 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.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/test-run-jsexceptions.cc b/deps/v8/test/cctest/compiler/test-run-jsexceptions.cc index ab8c42a979..8da2b53fe6 100644 --- a/deps/v8/test/cctest/compiler/test-run-jsexceptions.cc +++ b/deps/v8/test/cctest/compiler/test-run-jsexceptions.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/objects-inl.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/test-run-jsobjects.cc b/deps/v8/test/cctest/compiler/test-run-jsobjects.cc index 80a918134f..338e0e27d3 100644 --- a/deps/v8/test/cctest/compiler/test-run-jsobjects.cc +++ b/deps/v8/test/cctest/compiler/test-run-jsobjects.cc @@ -2,6 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/factory.h" +#include "src/isolate.h" +#include "src/objects.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/test-run-jsops.cc b/deps/v8/test/cctest/compiler/test-run-jsops.cc index 78e12576f1..49033f7995 100644 --- a/deps/v8/test/cctest/compiler/test-run-jsops.cc +++ b/deps/v8/test/cctest/compiler/test-run-jsops.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/objects-inl.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/test-run-native-calls.cc b/deps/v8/test/cctest/compiler/test-run-native-calls.cc index 5c2672f8d4..0f76b897c3 100644 --- a/deps/v8/test/cctest/compiler/test-run-native-calls.cc +++ b/deps/v8/test/cctest/compiler/test-run-native-calls.cc @@ -242,7 +242,8 @@ class Int32Signature : public MachineSignature { Handle<Code> CompileGraph(const char* name, CallDescriptor* desc, Graph* graph, Schedule* schedule = nullptr) { Isolate* isolate = CcTest::InitIsolateOnce(); - CompilationInfo info(ArrayVector("testing"), isolate, graph->zone()); + CompilationInfo info(ArrayVector("testing"), isolate, graph->zone(), + Code::ComputeFlags(Code::STUB)); Handle<Code> code = Pipeline::GenerateCodeForTesting(&info, desc, graph, schedule); CHECK(!code.is_null()); @@ -604,7 +605,7 @@ static void CopyTwentyInt32(CallDescriptor* desc) { static void Test_RunInt32SubWithRet(int retreg) { Int32Signature sig(2); - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); RegisterPairs pairs; while (pairs.More()) { @@ -655,7 +656,7 @@ TEST(Run_Int32Sub_all_allocatable_single) { Int32Signature sig(2); RegisterPairs pairs; while (pairs.More()) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); int parray[1]; int rarray[1]; @@ -673,7 +674,7 @@ TEST(Run_CopyTwentyInt32_all_allocatable_pairs) { Int32Signature sig(20); RegisterPairs pairs; while (pairs.More()) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); int parray[2]; int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; @@ -724,7 +725,7 @@ static void Test_Int32_WeightedSum_of_size(int count) { Int32Signature sig(count); for (int p0 = 0; p0 < Register::kNumRegisters; p0++) { if (GetRegConfig()->IsAllocatableGeneralCode(p0)) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); int parray[] = {p0}; @@ -787,7 +788,7 @@ void Test_Int32_Select() { Allocator rets(rarray, 1, nullptr, 0); RegisterConfig config(params, rets); - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); for (int i = which + 1; i <= 64; i++) { @@ -826,7 +827,7 @@ TEST(Int64Select_registers) { ArgsBuffer<int64_t>::Sig sig(2); RegisterPairs pairs; - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); while (pairs.More()) { int parray[2]; @@ -851,7 +852,7 @@ TEST(Float32Select_registers) { ArgsBuffer<float32>::Sig sig(2); Float32RegisterPairs pairs; - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); while (pairs.More()) { int parray[2]; @@ -874,7 +875,7 @@ TEST(Float64Select_registers) { ArgsBuffer<float64>::Sig sig(2); Float64RegisterPairs pairs; - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); while (pairs.More()) { int parray[2]; @@ -896,7 +897,7 @@ TEST(Float32Select_stack_params_return_reg) { Allocator rets(nullptr, 0, rarray, 1); RegisterConfig config(params, rets); - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); for (int count = 1; count < 6; count++) { ArgsBuffer<float32>::Sig sig(count); @@ -917,7 +918,7 @@ TEST(Float64Select_stack_params_return_reg) { Allocator rets(nullptr, 0, rarray, 1); RegisterConfig config(params, rets); - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); for (int count = 1; count < 6; count++) { ArgsBuffer<float64>::Sig sig(count); @@ -969,7 +970,7 @@ TEST(Float64StackParamsToStackParams) { Allocator params(nullptr, 0, nullptr, 0); Allocator rets(nullptr, 0, rarray, 1); - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); ArgsBuffer<float64>::Sig sig(2); RegisterConfig config(params, rets); @@ -1024,7 +1025,7 @@ void MixedParamTest(int start) { RegisterConfig config(palloc, ralloc); for (int which = 0; which < num_params; which++) { - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); HandleScope scope(isolate); MachineSignature::Builder builder(&zone, 1, num_params); diff --git a/deps/v8/test/cctest/compiler/test-run-stackcheck.cc b/deps/v8/test/cctest/compiler/test-run-stackcheck.cc index 52556ac87f..0dd28a7419 100644 --- a/deps/v8/test/cctest/compiler/test-run-stackcheck.cc +++ b/deps/v8/test/cctest/compiler/test-run-stackcheck.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/isolate.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/test-run-stubs.cc b/deps/v8/test/cctest/compiler/test-run-stubs.cc index feb25c992a..b34e5d4a51 100644 --- a/deps/v8/test/cctest/compiler/test-run-stubs.cc +++ b/deps/v8/test/cctest/compiler/test-run-stubs.cc @@ -4,6 +4,7 @@ #include "src/bootstrapper.h" #include "src/code-stubs.h" +#include "src/compilation-info.h" #include "src/compiler/common-operator.h" #include "src/compiler/graph.h" #include "src/compiler/js-graph.h" @@ -11,7 +12,6 @@ #include "src/compiler/linkage.h" #include "src/compiler/machine-operator.h" #include "src/compiler/pipeline.h" -#include "src/parsing/parser.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/test-run-unwinding-info.cc b/deps/v8/test/cctest/compiler/test-run-unwinding-info.cc index 4536725d4f..a7e63822b5 100644 --- a/deps/v8/test/cctest/compiler/test-run-unwinding-info.cc +++ b/deps/v8/test/cctest/compiler/test-run-unwinding-info.cc @@ -6,6 +6,10 @@ #if defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_ARM) || \ defined(V8_TARGET_ARCH_ARM64) +#include "src/flags.h" +#include "src/objects-inl.h" +#include "src/objects.h" +#include "src/unicode-cache.h" #include "test/cctest/compiler/function-tester.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/test-run-variables.cc b/deps/v8/test/cctest/compiler/test-run-variables.cc index 6997967b42..9d6291a5aa 100644 --- a/deps/v8/test/cctest/compiler/test-run-variables.cc +++ b/deps/v8/test/cctest/compiler/test-run-variables.cc @@ -2,6 +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 "test/cctest/compiler/function-tester.h" namespace v8 { diff --git a/deps/v8/test/cctest/compiler/test-simplified-lowering.cc b/deps/v8/test/cctest/compiler/test-simplified-lowering.cc deleted file mode 100644 index 2e3dcd148a..0000000000 --- a/deps/v8/test/cctest/compiler/test-simplified-lowering.cc +++ /dev/null @@ -1,1756 +0,0 @@ -// Copyright 2014 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 <limits> - -#include "src/ast/scopes.h" -#include "src/compiler/access-builder.h" -#include "src/compiler/control-builders.h" -#include "src/compiler/effect-control-linearizer.h" -#include "src/compiler/graph-visualizer.h" -#include "src/compiler/memory-optimizer.h" -#include "src/compiler/node-properties.h" -#include "src/compiler/pipeline.h" -#include "src/compiler/representation-change.h" -#include "src/compiler/scheduler.h" -#include "src/compiler/simplified-lowering.h" -#include "src/compiler/source-position.h" -#include "src/compiler/typer.h" -#include "src/compiler/verifier.h" -#include "src/execution.h" -#include "src/parsing/parser.h" -#include "src/parsing/rewriter.h" -#include "test/cctest/cctest.h" -#include "test/cctest/compiler/codegen-tester.h" -#include "test/cctest/compiler/function-tester.h" -#include "test/cctest/compiler/graph-builder-tester.h" -#include "test/cctest/compiler/value-helper.h" - -namespace v8 { -namespace internal { -namespace compiler { - -template <typename ReturnType> -class SimplifiedLoweringTester : public GraphBuilderTester<ReturnType> { - public: - SimplifiedLoweringTester(MachineType p0 = MachineType::None(), - MachineType p1 = MachineType::None()) - : GraphBuilderTester<ReturnType>(p0, p1), - typer(new Typer(this->isolate(), this->graph())), - javascript(this->zone()), - jsgraph(this->isolate(), this->graph(), this->common(), &javascript, - this->simplified(), this->machine()), - source_positions(jsgraph.graph()), - lowering(&jsgraph, this->zone(), &source_positions) {} - ~SimplifiedLoweringTester() final { delete typer; } - - Typer* typer = nullptr; - JSOperatorBuilder javascript; - JSGraph jsgraph; - SourcePositionTable source_positions; - SimplifiedLowering lowering; - - void LowerAllNodes() { - this->End(); - typer->Run(); - delete typer, typer = nullptr; - lowering.LowerAllNodes(); - } - - void LowerAllNodesAndLowerChanges() { - this->End(); - typer->Run(); - delete typer, typer = nullptr; - lowering.LowerAllNodes(); - - Schedule* schedule = Scheduler::ComputeSchedule(this->zone(), this->graph(), - Scheduler::kNoFlags); - EffectControlLinearizer linearizer(&jsgraph, schedule, this->zone()); - linearizer.Run(); - - MemoryOptimizer memory_optimizer(&jsgraph, this->zone()); - memory_optimizer.Optimize(); - } - - void CheckNumberCall(double expected, double input) { - // TODO(titzer): make calls to NewNumber work in cctests. - if (expected <= Smi::kMinValue) return; - if (expected >= Smi::kMaxValue) return; - Handle<Object> num = factory()->NewNumber(input); - Object* result = this->Call(*num); - CHECK(factory()->NewNumber(expected)->SameValue(result)); - } - - template <typename T> - T* CallWithPotentialGC() { - // TODO(titzer): we wrap the code in a JSFunction here to reuse the - // JSEntryStub; that could be done with a special prologue or other stub. - Handle<JSFunction> fun = FunctionTester::ForMachineGraph(this->graph(), 0); - Handle<Object>* args = NULL; - MaybeHandle<Object> result = Execution::Call( - this->isolate(), fun, factory()->undefined_value(), 0, args); - return T::cast(*result.ToHandleChecked()); - } - - Factory* factory() { return this->isolate()->factory(); } - Heap* heap() { return this->isolate()->heap(); } -}; - - -// TODO(titzer): factor these tests out to test-run-simplifiedops.cc. -// TODO(titzer): test tagged representation for input to NumberToInt32. -TEST(RunNumberToInt32_float64) { - // TODO(titzer): explicit load/stores here are only because of representations - double input; - int32_t result; - SimplifiedLoweringTester<Object*> t; - FieldAccess load = {kUntaggedBase, 0, - Handle<Name>(), Type::Number(), - MachineType::Float64(), kNoWriteBarrier}; - Node* loaded = t.LoadField(load, t.PointerConstant(&input)); - NodeProperties::SetType(loaded, Type::Number()); - Node* convert = t.NumberToInt32(loaded); - FieldAccess store = {kUntaggedBase, 0, - Handle<Name>(), Type::Signed32(), - MachineType::Int32(), kNoWriteBarrier}; - t.StoreField(store, t.PointerConstant(&result), convert); - t.Return(t.jsgraph.TrueConstant()); - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - FOR_FLOAT64_INPUTS(i) { - input = *i; - int32_t expected = DoubleToInt32(*i); - t.Call(); - CHECK_EQ(expected, result); - } -} - - -// TODO(titzer): test tagged representation for input to NumberToUint32. -TEST(RunNumberToUint32_float64) { - // TODO(titzer): explicit load/stores here are only because of representations - double input; - uint32_t result; - SimplifiedLoweringTester<Object*> t; - FieldAccess load = {kUntaggedBase, 0, - Handle<Name>(), Type::Number(), - MachineType::Float64(), kNoWriteBarrier}; - Node* loaded = t.LoadField(load, t.PointerConstant(&input)); - NodeProperties::SetType(loaded, Type::Number()); - Node* convert = t.NumberToUint32(loaded); - FieldAccess store = {kUntaggedBase, 0, - Handle<Name>(), Type::Unsigned32(), - MachineType::Uint32(), kNoWriteBarrier}; - t.StoreField(store, t.PointerConstant(&result), convert); - t.Return(t.jsgraph.TrueConstant()); - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - FOR_FLOAT64_INPUTS(i) { - input = *i; - uint32_t expected = DoubleToUint32(*i); - t.Call(); - CHECK_EQ(static_cast<int32_t>(expected), static_cast<int32_t>(result)); - } - } - - -// Create a simple JSObject with a unique map. -static Handle<JSObject> TestObject() { - static int index = 0; - char buffer[50]; - v8::base::OS::SNPrintF(buffer, 50, "({'a_%d':1})", index++); - return Handle<JSObject>::cast(v8::Utils::OpenHandle(*CompileRun(buffer))); -} - - -TEST(RunLoadMap) { - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - FieldAccess access = AccessBuilder::ForMap(); - Node* load = t.LoadField(access, t.Parameter(0)); - t.Return(load); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - Handle<JSObject> src = TestObject(); - Handle<Map> src_map(src->map()); - Object* result = t.Call(*src); // TODO(titzer): raw pointers in call - CHECK_EQ(*src_map, result); -} - - -TEST(RunStoreMap) { - SimplifiedLoweringTester<int32_t> t(MachineType::AnyTagged(), - MachineType::AnyTagged()); - FieldAccess access = AccessBuilder::ForMap(); - t.StoreField(access, t.Parameter(1), t.Parameter(0)); - t.Return(t.jsgraph.TrueConstant()); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - Handle<JSObject> src = TestObject(); - Handle<Map> src_map(src->map()); - Handle<JSObject> dst = TestObject(); - CHECK(src->map() != dst->map()); - t.Call(*src_map, *dst); // TODO(titzer): raw pointers in call - CHECK(*src_map == dst->map()); - } - - -TEST(RunLoadProperties) { - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - FieldAccess access = AccessBuilder::ForJSObjectProperties(); - Node* load = t.LoadField(access, t.Parameter(0)); - t.Return(load); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - Handle<JSObject> src = TestObject(); - Handle<FixedArray> src_props(src->properties()); - Object* result = t.Call(*src); // TODO(titzer): raw pointers in call - CHECK_EQ(*src_props, result); -} - - -TEST(RunLoadStoreMap) { - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged(), - MachineType::AnyTagged()); - FieldAccess access = AccessBuilder::ForMap(); - Node* load = t.LoadField(access, t.Parameter(0)); - t.StoreField(access, t.Parameter(1), load); - t.Return(load); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - Handle<JSObject> src = TestObject(); - Handle<Map> src_map(src->map()); - Handle<JSObject> dst = TestObject(); - CHECK(src->map() != dst->map()); - Object* result = t.Call(*src, *dst); // TODO(titzer): raw pointers in call - CHECK(result->IsMap()); - CHECK_EQ(*src_map, result); - CHECK(*src_map == dst->map()); -} - - -TEST(RunLoadStoreFixedArrayIndex) { - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - ElementAccess access = AccessBuilder::ForFixedArrayElement(); - Node* load = t.LoadElement(access, t.Parameter(0), t.Int32Constant(0)); - t.StoreElement(access, t.Parameter(0), t.Int32Constant(1), load); - t.Return(load); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - Handle<FixedArray> array = t.factory()->NewFixedArray(2); - Handle<JSObject> src = TestObject(); - Handle<JSObject> dst = TestObject(); - array->set(0, *src); - array->set(1, *dst); - Object* result = t.Call(*array); - CHECK_EQ(*src, result); - CHECK_EQ(*src, array->get(0)); - CHECK_EQ(*src, array->get(1)); -} - - -TEST(RunLoadStoreArrayBuffer) { - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - const int index = 12; - const int array_length = 2 * index; - ElementAccess buffer_access = - AccessBuilder::ForTypedArrayElement(kExternalInt8Array, true); - Node* backing_store = t.LoadField( - AccessBuilder::ForJSArrayBufferBackingStore(), t.Parameter(0)); - Node* load = - t.LoadElement(buffer_access, backing_store, t.Int32Constant(index)); - t.StoreElement(buffer_access, backing_store, t.Int32Constant(index + 1), - load); - t.Return(t.jsgraph.TrueConstant()); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - Handle<JSArrayBuffer> array = t.factory()->NewJSArrayBuffer(); - JSArrayBuffer::SetupAllocatingData(array, t.isolate(), array_length); - uint8_t* data = reinterpret_cast<uint8_t*>(array->backing_store()); - for (int i = 0; i < array_length; i++) { - data[i] = i; - } - - // TODO(titzer): raw pointers in call - Object* result = t.Call(*array); - CHECK_EQ(t.isolate()->heap()->true_value(), result); - for (int i = 0; i < array_length; i++) { - uint8_t expected = i; - if (i == (index + 1)) expected = index; - CHECK_EQ(data[i], expected); - } - } - - -TEST(RunLoadFieldFromUntaggedBase) { - Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3)}; - - for (size_t i = 0; i < arraysize(smis); i++) { - int offset = static_cast<int>(i * sizeof(Smi*)); - FieldAccess access = {kUntaggedBase, - offset, - Handle<Name>(), - Type::Integral32(), - MachineType::AnyTagged(), - kNoWriteBarrier}; - - SimplifiedLoweringTester<Object*> t; - Node* load = t.LoadField(access, t.PointerConstant(smis)); - t.Return(load); - t.LowerAllNodesAndLowerChanges(); - - for (int j = -5; j <= 5; j++) { - Smi* expected = Smi::FromInt(j); - smis[i] = expected; - CHECK_EQ(expected, t.Call()); - } - } -} - - -TEST(RunStoreFieldToUntaggedBase) { - Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3)}; - - for (size_t i = 0; i < arraysize(smis); i++) { - int offset = static_cast<int>(i * sizeof(Smi*)); - FieldAccess access = {kUntaggedBase, - offset, - Handle<Name>(), - Type::Integral32(), - MachineType::AnyTagged(), - kNoWriteBarrier}; - - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - Node* p0 = t.Parameter(0); - t.StoreField(access, t.PointerConstant(smis), p0); - t.Return(p0); - t.LowerAllNodesAndLowerChanges(); - - for (int j = -5; j <= 5; j++) { - Smi* expected = Smi::FromInt(j); - smis[i] = Smi::FromInt(-100); - CHECK_EQ(expected, t.Call(expected)); - CHECK_EQ(expected, smis[i]); - } - } -} - - -TEST(RunLoadElementFromUntaggedBase) { - Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3), - Smi::FromInt(4), Smi::FromInt(5)}; - - for (size_t i = 0; i < arraysize(smis); i++) { // for header sizes - for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index - int offset = static_cast<int>(i * sizeof(Smi*)); - ElementAccess access = {kUntaggedBase, offset, Type::Integral32(), - MachineType::AnyTagged(), kNoWriteBarrier}; - - SimplifiedLoweringTester<Object*> t; - Node* load = t.LoadElement(access, t.PointerConstant(smis), - t.Int32Constant(static_cast<int>(j))); - t.Return(load); - t.LowerAllNodesAndLowerChanges(); - - for (int k = -5; k <= 5; k++) { - Smi* expected = Smi::FromInt(k); - smis[i + j] = expected; - CHECK_EQ(expected, t.Call()); - } - } - } -} - - -TEST(RunStoreElementFromUntaggedBase) { - Smi* smis[] = {Smi::FromInt(1), Smi::FromInt(2), Smi::FromInt(3), - Smi::FromInt(4), Smi::FromInt(5)}; - - for (size_t i = 0; i < arraysize(smis); i++) { // for header sizes - for (size_t j = 0; (i + j) < arraysize(smis); j++) { // for element index - int offset = static_cast<int>(i * sizeof(Smi*)); - ElementAccess access = {kUntaggedBase, offset, Type::Integral32(), - MachineType::AnyTagged(), kNoWriteBarrier}; - - SimplifiedLoweringTester<Object*> t(MachineType::AnyTagged()); - Node* p0 = t.Parameter(0); - t.StoreElement(access, t.PointerConstant(smis), - t.Int32Constant(static_cast<int>(j)), p0); - t.Return(p0); - t.LowerAllNodesAndLowerChanges(); - - for (int k = -5; k <= 5; k++) { - Smi* expected = Smi::FromInt(k); - smis[i + j] = Smi::FromInt(-100); - CHECK_EQ(expected, t.Call(expected)); - CHECK_EQ(expected, smis[i + j]); - } - - // TODO(titzer): assert the contents of the array. - } - } -} - - -// A helper class for accessing fields and elements of various types, on both -// tagged and untagged base pointers. Contains both tagged and untagged buffers -// for testing direct memory access from generated code. -template <typename E> -class AccessTester : public HandleAndZoneScope { - public: - bool tagged; - MachineType rep; - E* original_elements; - size_t num_elements; - E* untagged_array; - Handle<ByteArray> tagged_array; // TODO(titzer): use FixedArray for tagged. - - AccessTester(bool t, MachineType r, E* orig, size_t num) - : tagged(t), - rep(r), - original_elements(orig), - num_elements(num), - untagged_array(static_cast<E*>(malloc(ByteSize()))), - tagged_array(main_isolate()->factory()->NewByteArray( - static_cast<int>(ByteSize()))) { - Reinitialize(); - } - - ~AccessTester() { free(untagged_array); } - - size_t ByteSize() { return num_elements * sizeof(E); } - - // Nuke both {untagged_array} and {tagged_array} with {original_elements}. - void Reinitialize() { - memcpy(untagged_array, original_elements, ByteSize()); - CHECK_EQ(static_cast<int>(ByteSize()), tagged_array->length()); - E* raw = reinterpret_cast<E*>(tagged_array->GetDataStartAddress()); - memcpy(raw, original_elements, ByteSize()); - } - - // Create and run code that copies the element in either {untagged_array} - // or {tagged_array} at index {from_index} to index {to_index}. - void RunCopyElement(int from_index, int to_index) { - // TODO(titzer): test element and field accesses where the base is not - // a constant in the code. - BoundsCheck(from_index); - BoundsCheck(to_index); - ElementAccess access = GetElementAccess(); - - SimplifiedLoweringTester<Object*> t; - Node* ptr = GetBaseNode(&t); - Node* load = t.LoadElement(access, ptr, t.Int32Constant(from_index)); - t.StoreElement(access, ptr, t.Int32Constant(to_index), load); - t.Return(t.jsgraph.TrueConstant()); - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - Object* result = t.Call(); - CHECK_EQ(t.isolate()->heap()->true_value(), result); - } - - // Create and run code that copies the field in either {untagged_array} - // or {tagged_array} at index {from_index} to index {to_index}. - void RunCopyField(int from_index, int to_index) { - BoundsCheck(from_index); - BoundsCheck(to_index); - FieldAccess from_access = GetFieldAccess(from_index); - FieldAccess to_access = GetFieldAccess(to_index); - - SimplifiedLoweringTester<Object*> t; - Node* ptr = GetBaseNode(&t); - Node* load = t.LoadField(from_access, ptr); - t.StoreField(to_access, ptr, load); - t.Return(t.jsgraph.TrueConstant()); - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - Object* result = t.Call(); - CHECK_EQ(t.isolate()->heap()->true_value(), result); - } - - // Create and run code that copies the elements from {this} to {that}. - void RunCopyElements(AccessTester<E>* that) { -// TODO(titzer): Rewrite this test without StructuredGraphBuilder support. -#if 0 - SimplifiedLoweringTester<Object*> t; - - Node* one = t.Int32Constant(1); - Node* index = t.Int32Constant(0); - Node* limit = t.Int32Constant(static_cast<int>(num_elements)); - t.environment()->Push(index); - Node* src = this->GetBaseNode(&t); - Node* dst = that->GetBaseNode(&t); - { - LoopBuilder loop(&t); - loop.BeginLoop(); - // Loop exit condition - index = t.environment()->Top(); - Node* condition = t.Int32LessThan(index, limit); - loop.BreakUnless(condition); - // dst[index] = src[index] - index = t.environment()->Pop(); - Node* load = t.LoadElement(this->GetElementAccess(), src, index); - t.StoreElement(that->GetElementAccess(), dst, index, load); - // index++ - index = t.Int32Add(index, one); - t.environment()->Push(index); - // continue - loop.EndBody(); - loop.EndLoop(); - } - index = t.environment()->Pop(); - t.Return(t.jsgraph.TrueConstant()); - t.LowerAllNodes(); - t.GenerateCode(); - - Object* result = t.Call(); - CHECK_EQ(t.isolate()->heap()->true_value(), result); -#endif - } - - E GetElement(int index) { - BoundsCheck(index); - if (tagged) { - return GetTaggedElement(index); - } else { - return untagged_array[index]; - } - } - - private: - ElementAccess GetElementAccess() { - ElementAccess access = {tagged ? kTaggedBase : kUntaggedBase, - tagged ? FixedArrayBase::kHeaderSize : 0, - Type::Any(), rep, kFullWriteBarrier}; - return access; - } - - FieldAccess GetFieldAccess(int field) { - int offset = field * sizeof(E); - FieldAccess access = {tagged ? kTaggedBase : kUntaggedBase, - offset + (tagged ? FixedArrayBase::kHeaderSize : 0), - Handle<Name>(), - Type::Any(), - rep, - kFullWriteBarrier}; - return access; - } - - template <typename T> - Node* GetBaseNode(SimplifiedLoweringTester<T>* t) { - return tagged ? t->HeapConstant(tagged_array) - : t->PointerConstant(untagged_array); - } - - void BoundsCheck(int index) { - CHECK_GE(index, 0); - CHECK_LT(index, static_cast<int>(num_elements)); - CHECK_EQ(static_cast<int>(ByteSize()), tagged_array->length()); - } - - E GetTaggedElement(int index) { - E* raw = reinterpret_cast<E*>(tagged_array->GetDataStartAddress()); - return raw[index]; - } -}; - -template <> -double AccessTester<double>::GetTaggedElement(int index) { - return ReadDoubleValue(tagged_array->GetDataStartAddress() + - index * sizeof(double)); -} - - -template <typename E> -static void RunAccessTest(MachineType rep, E* original_elements, size_t num) { - int num_elements = static_cast<int>(num); - - for (int taggedness = 0; taggedness < 2; taggedness++) { - AccessTester<E> a(taggedness == 1, rep, original_elements, num); - for (int field = 0; field < 2; field++) { - for (int i = 0; i < num_elements - 1; i++) { - a.Reinitialize(); - if (field == 0) { - a.RunCopyField(i, i + 1); // Test field read/write. - } else { - a.RunCopyElement(i, i + 1); // Test element read/write. - } - for (int j = 0; j < num_elements; j++) { - E expect = - j == (i + 1) ? original_elements[i] : original_elements[j]; - CHECK_EQ(expect, a.GetElement(j)); - } - } - } - } - // Test array copy. - for (int tf = 0; tf < 2; tf++) { - for (int tt = 0; tt < 2; tt++) { - AccessTester<E> a(tf == 1, rep, original_elements, num); - AccessTester<E> b(tt == 1, rep, original_elements, num); - a.RunCopyElements(&b); - for (int i = 0; i < num_elements; i++) { - CHECK_EQ(a.GetElement(i), b.GetElement(i)); - } - } - } -} - - -TEST(RunAccessTests_uint8) { - uint8_t data[] = {0x07, 0x16, 0x25, 0x34, 0x43, 0x99, - 0xab, 0x78, 0x89, 0x19, 0x2b, 0x38}; - RunAccessTest<uint8_t>(MachineType::Int8(), data, arraysize(data)); -} - - -TEST(RunAccessTests_uint16) { - uint16_t data[] = {0x071a, 0x162b, 0x253c, 0x344d, 0x435e, 0x7777}; - RunAccessTest<uint16_t>(MachineType::Int16(), data, arraysize(data)); -} - - -TEST(RunAccessTests_int32) { - int32_t data[] = {-211, 211, 628347, 2000000000, -2000000000, -1, -100000034}; - RunAccessTest<int32_t>(MachineType::Int32(), data, arraysize(data)); -} - - -#define V8_2PART_INT64(a, b) (((static_cast<int64_t>(a) << 32) + 0x##b##u)) - - -TEST(RunAccessTests_int64) { - if (kPointerSize != 8) return; - int64_t data[] = {V8_2PART_INT64(0x10111213, 14151617), - V8_2PART_INT64(0x20212223, 24252627), - V8_2PART_INT64(0x30313233, 34353637), - V8_2PART_INT64(0xa0a1a2a3, a4a5a6a7), - V8_2PART_INT64(0xf0f1f2f3, f4f5f6f7)}; - RunAccessTest<int64_t>(MachineType::Int64(), data, arraysize(data)); -} - - -TEST(RunAccessTests_float64) { - double data[] = {1.25, -1.25, 2.75, 11.0, 11100.8}; - RunAccessTest<double>(MachineType::Float64(), data, arraysize(data)); -} - - -TEST(RunAccessTests_Smi) { - Smi* data[] = {Smi::FromInt(-1), Smi::FromInt(-9), - Smi::FromInt(0), Smi::FromInt(666), - Smi::FromInt(77777), Smi::FromInt(Smi::kMaxValue)}; - RunAccessTest<Smi*>(MachineType::AnyTagged(), data, arraysize(data)); -} - - -TEST(RunAllocate) { - PretenureFlag flag[] = {NOT_TENURED, TENURED}; - - for (size_t i = 0; i < arraysize(flag); i++) { - SimplifiedLoweringTester<HeapObject*> t; - FieldAccess access = AccessBuilder::ForMap(); - Node* size = t.jsgraph.Constant(HeapNumber::kSize); - Node* alloc = t.NewNode(t.simplified()->Allocate(flag[i]), size); - Node* map = t.jsgraph.Constant(t.factory()->heap_number_map()); - t.StoreField(access, alloc, map); - t.Return(alloc); - - t.LowerAllNodesAndLowerChanges(); - t.GenerateCode(); - - HeapObject* result = t.CallWithPotentialGC<HeapObject>(); - CHECK(t.heap()->new_space()->Contains(result) || flag[i] == TENURED); - CHECK(t.heap()->old_space()->Contains(result) || flag[i] == NOT_TENURED); - CHECK(result->IsHeapNumber()); - } -} - - -// Fills in most of the nodes of the graph in order to make tests shorter. -class TestingGraph : public HandleAndZoneScope, public GraphAndBuilders { - public: - Typer* typer = nullptr; - JSOperatorBuilder javascript; - JSGraph jsgraph; - Node* p0; - Node* p1; - Node* p2; - Node* start; - Node* end; - Node* ret; - - explicit TestingGraph(Type* p0_type, Type* p1_type = Type::None(), - Type* p2_type = Type::None()) - : GraphAndBuilders(main_zone()), - typer(new Typer(main_isolate(), graph())), - javascript(main_zone()), - jsgraph(main_isolate(), graph(), common(), &javascript, simplified(), - machine()) { - start = graph()->NewNode(common()->Start(4)); - graph()->SetStart(start); - ret = - graph()->NewNode(common()->Return(), jsgraph.Constant(0), start, start); - end = graph()->NewNode(common()->End(1), ret); - graph()->SetEnd(end); - p0 = graph()->NewNode(common()->Parameter(0), start); - p1 = graph()->NewNode(common()->Parameter(1), start); - p2 = graph()->NewNode(common()->Parameter(2), start); - typer->Run(); - NodeProperties::SetType(p0, p0_type); - NodeProperties::SetType(p1, p1_type); - NodeProperties::SetType(p2, p2_type); - } - ~TestingGraph() { delete typer; } - - void CheckLoweringBinop(IrOpcode::Value expected, const Operator* op) { - Node* node = Return(graph()->NewNode(op, p0, p1)); - Lower(); - CHECK_EQ(expected, node->opcode()); - } - - void CheckLoweringStringBinop(IrOpcode::Value expected, const Operator* op) { - Node* node = Return( - graph()->NewNode(op, p0, p1, graph()->start(), graph()->start())); - Lower(); - CHECK_EQ(expected, node->opcode()); - } - - void CheckLoweringTruncatedBinop(IrOpcode::Value expected, const Operator* op, - const Operator* trunc) { - Node* node = graph()->NewNode(op, p0, p1); - Return(graph()->NewNode(trunc, node)); - Lower(); - CHECK_EQ(expected, node->opcode()); - } - - void Lower() { - delete typer; - SourcePositionTable table(jsgraph.graph()); - SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes(); - typer = new Typer(main_isolate(), graph()); - } - - void LowerAllNodesAndLowerChanges() { - delete typer; - SourcePositionTable table(jsgraph.graph()); - SimplifiedLowering(&jsgraph, jsgraph.zone(), &table).LowerAllNodes(); - - Schedule* schedule = Scheduler::ComputeSchedule(this->zone(), this->graph(), - Scheduler::kNoFlags); - EffectControlLinearizer linearizer(&jsgraph, schedule, this->zone()); - linearizer.Run(); - - MemoryOptimizer memory_optimizer(&jsgraph, this->zone()); - memory_optimizer.Optimize(); - typer = new Typer(main_isolate(), graph()); - } - - // Inserts the node as the return value of the graph. - Node* Return(Node* node) { - ret->ReplaceInput(0, node); - return node; - } - - // Inserts the node as the effect input to the return of the graph. - void Effect(Node* node) { ret->ReplaceInput(1, node); } - - Node* ExampleWithOutput(MachineType type) { - if (type.semantic() == MachineSemantic::kInt32) { - return graph()->NewNode(machine()->Int32Add(), jsgraph.Int32Constant(1), - jsgraph.Int32Constant(1)); - } else if (type.semantic() == MachineSemantic::kUint32) { - return graph()->NewNode(machine()->Word32Shr(), jsgraph.Int32Constant(1), - jsgraph.Int32Constant(1)); - } else if (type.representation() == MachineRepresentation::kFloat64) { - return graph()->NewNode(machine()->Float64Add(), - jsgraph.Float64Constant(1), - jsgraph.Float64Constant(1)); - } else if (type.representation() == MachineRepresentation::kBit) { - return graph()->NewNode(machine()->Word32Equal(), - jsgraph.Int32Constant(1), - jsgraph.Int32Constant(1)); - } else if (type.representation() == MachineRepresentation::kWord64) { - return graph()->NewNode(machine()->Int64Add(), Int64Constant(1), - Int64Constant(1)); - } else { - CHECK(type.representation() == MachineRepresentation::kTagged); - return p0; - } - } - - Node* Use(Node* node, MachineType type) { - if (type.semantic() == MachineSemantic::kInt32) { - return graph()->NewNode(machine()->Int32LessThan(), node, - jsgraph.Int32Constant(1)); - } else if (type.semantic() == MachineSemantic::kUint32) { - return graph()->NewNode(machine()->Uint32LessThan(), node, - jsgraph.Int32Constant(1)); - } else if (type.representation() == MachineRepresentation::kFloat64) { - return graph()->NewNode(machine()->Float64Add(), node, - jsgraph.Float64Constant(1)); - } else if (type.representation() == MachineRepresentation::kWord64) { - return graph()->NewNode(machine()->Int64LessThan(), node, - Int64Constant(1)); - } else if (type.representation() == MachineRepresentation::kWord32) { - return graph()->NewNode(machine()->Word32Equal(), node, - jsgraph.Int32Constant(1)); - } else { - return graph()->NewNode(simplified()->ReferenceEqual(), node, - jsgraph.TrueConstant()); - } - } - - Node* Branch(Node* cond) { - Node* br = graph()->NewNode(common()->Branch(), cond, start); - Node* tb = graph()->NewNode(common()->IfTrue(), br); - Node* fb = graph()->NewNode(common()->IfFalse(), br); - Node* m = graph()->NewNode(common()->Merge(2), tb, fb); - NodeProperties::ReplaceControlInput(ret, m); - return br; - } - - Node* Int64Constant(int64_t v) { - return graph()->NewNode(common()->Int64Constant(v)); - } - - SimplifiedOperatorBuilder* simplified() { return &main_simplified_; } - MachineOperatorBuilder* machine() { return &main_machine_; } - CommonOperatorBuilder* common() { return &main_common_; } - Graph* graph() { return main_graph_; } -}; - - -TEST(LowerBooleanNot_bit_bit) { - // BooleanNot(x: kRepBit) used as kRepBit - TestingGraph t(Type::Boolean()); - Node* b = t.ExampleWithOutput(MachineType::Bool()); - Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b); - Node* use = t.Branch(inv); - t.Lower(); - Node* cmp = use->InputAt(0); - CHECK_EQ(t.machine()->Word32Equal()->opcode(), cmp->opcode()); - CHECK(b == cmp->InputAt(0) || b == cmp->InputAt(1)); - Node* f = t.jsgraph.Int32Constant(0); - CHECK(f == cmp->InputAt(0) || f == cmp->InputAt(1)); -} - - -TEST(LowerBooleanNot_bit_tagged) { - // BooleanNot(x: kRepBit) used as kRepTagged - TestingGraph t(Type::Boolean()); - Node* b = t.ExampleWithOutput(MachineType::Bool()); - Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b); - Node* use = t.Use(inv, MachineType::AnyTagged()); - t.Return(use); - t.Lower(); - CHECK_EQ(IrOpcode::kChangeBitToTagged, use->InputAt(0)->opcode()); - Node* cmp = use->InputAt(0)->InputAt(0); - CHECK_EQ(t.machine()->Word32Equal()->opcode(), cmp->opcode()); - CHECK(b == cmp->InputAt(0) || b == cmp->InputAt(1)); - Node* f = t.jsgraph.Int32Constant(0); - CHECK(f == cmp->InputAt(0) || f == cmp->InputAt(1)); -} - - -TEST(LowerBooleanNot_tagged_bit) { - // BooleanNot(x: kRepTagged) used as kRepBit - TestingGraph t(Type::Boolean()); - Node* b = t.p0; - Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b); - Node* use = t.Branch(inv); - t.Lower(); - Node* cmp = use->InputAt(0); - CHECK_EQ(t.machine()->WordEqual()->opcode(), cmp->opcode()); - CHECK(b == cmp->InputAt(0) || b == cmp->InputAt(1)); - Node* f = t.jsgraph.FalseConstant(); - CHECK(f == cmp->InputAt(0) || f == cmp->InputAt(1)); -} - - -TEST(LowerBooleanNot_tagged_tagged) { - // BooleanNot(x: kRepTagged) used as kRepTagged - TestingGraph t(Type::Boolean()); - Node* b = t.p0; - Node* inv = t.graph()->NewNode(t.simplified()->BooleanNot(), b); - Node* use = t.Use(inv, MachineType::AnyTagged()); - t.Return(use); - t.Lower(); - CHECK_EQ(IrOpcode::kChangeBitToTagged, use->InputAt(0)->opcode()); - Node* cmp = use->InputAt(0)->InputAt(0); - CHECK_EQ(t.machine()->WordEqual()->opcode(), cmp->opcode()); - CHECK(b == cmp->InputAt(0) || b == cmp->InputAt(1)); - Node* f = t.jsgraph.FalseConstant(); - CHECK(f == cmp->InputAt(0) || f == cmp->InputAt(1)); -} - -static Type* test_types[] = {Type::Signed32(), Type::Unsigned32(), - Type::Number()}; - -TEST(LowerNumberCmp_to_int32) { - TestingGraph t(Type::Signed32(), Type::Signed32()); - - t.CheckLoweringBinop(IrOpcode::kWord32Equal, t.simplified()->NumberEqual()); - t.CheckLoweringBinop(IrOpcode::kInt32LessThan, - t.simplified()->NumberLessThan()); - t.CheckLoweringBinop(IrOpcode::kInt32LessThanOrEqual, - t.simplified()->NumberLessThanOrEqual()); -} - - -TEST(LowerNumberCmp_to_uint32) { - TestingGraph t(Type::Unsigned32(), Type::Unsigned32()); - - t.CheckLoweringBinop(IrOpcode::kWord32Equal, t.simplified()->NumberEqual()); - t.CheckLoweringBinop(IrOpcode::kUint32LessThan, - t.simplified()->NumberLessThan()); - t.CheckLoweringBinop(IrOpcode::kUint32LessThanOrEqual, - t.simplified()->NumberLessThanOrEqual()); -} - - -TEST(LowerNumberCmp_to_float64) { - TestingGraph t(Type::Number(), Type::Number()); - - t.CheckLoweringBinop(IrOpcode::kFloat64Equal, t.simplified()->NumberEqual()); - t.CheckLoweringBinop(IrOpcode::kFloat64LessThan, - t.simplified()->NumberLessThan()); - t.CheckLoweringBinop(IrOpcode::kFloat64LessThanOrEqual, - t.simplified()->NumberLessThanOrEqual()); -} - - -TEST(LowerNumberAddSub_to_int32) { - HandleAndZoneScope scope; - Type* small_range = Type::Range(1, 10, scope.main_zone()); - Type* large_range = Type::Range(-1e+13, 1e+14, scope.main_zone()); - static Type* types[] = {Type::Signed32(), Type::Integral32(), small_range, - large_range}; - - for (size_t i = 0; i < arraysize(types); i++) { - for (size_t j = 0; j < arraysize(types); j++) { - TestingGraph t(types[i], types[j]); - t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Add, - t.simplified()->NumberAdd(), - t.simplified()->NumberToInt32()); - t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Sub, - t.simplified()->NumberSubtract(), - t.simplified()->NumberToInt32()); - } - } -} - - -TEST(LowerNumberAddSub_to_uint32) { - HandleAndZoneScope scope; - Type* small_range = Type::Range(1, 10, scope.main_zone()); - Type* large_range = Type::Range(-1e+13, 1e+14, scope.main_zone()); - static Type* types[] = {Type::Signed32(), Type::Integral32(), small_range, - large_range}; - - for (size_t i = 0; i < arraysize(types); i++) { - for (size_t j = 0; j < arraysize(types); j++) { - TestingGraph t(types[i], types[j]); - t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Add, - t.simplified()->NumberAdd(), - t.simplified()->NumberToUint32()); - t.CheckLoweringTruncatedBinop(IrOpcode::kInt32Sub, - t.simplified()->NumberSubtract(), - t.simplified()->NumberToUint32()); - } - } -} - - -TEST(LowerNumberAddSub_to_float64) { - for (size_t i = 0; i < arraysize(test_types); i++) { - TestingGraph t(test_types[i], test_types[i]); - - t.CheckLoweringBinop(IrOpcode::kFloat64Add, t.simplified()->NumberAdd()); - t.CheckLoweringBinop(IrOpcode::kFloat64Sub, - t.simplified()->NumberSubtract()); - } -} - - -TEST(LowerNumberDivMod_to_float64) { - for (size_t i = 0; i < arraysize(test_types); i++) { - TestingGraph t(test_types[i], test_types[i]); - - t.CheckLoweringBinop(IrOpcode::kFloat64Div, t.simplified()->NumberDivide()); - if (!test_types[i]->Is(Type::Unsigned32())) { - t.CheckLoweringBinop(IrOpcode::kFloat64Mod, - t.simplified()->NumberModulus()); - } - } -} - - -static void CheckChangeOf(IrOpcode::Value change, Node* of, Node* node) { - CHECK_EQ(change, node->opcode()); - CHECK_EQ(of, node->InputAt(0)); -} - - -TEST(LowerNumberToInt32_to_ChangeTaggedToInt32) { - // NumberToInt32(x: kRepTagged | kTypeInt32) used as kRepWord32 - TestingGraph t(Type::Signed32()); - Node* trunc = t.graph()->NewNode(t.simplified()->NumberToInt32(), t.p0); - Node* use = t.Use(trunc, MachineType::Int32()); - t.Return(use); - t.Lower(); - CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p0, use->InputAt(0)); -} - -TEST(LowerNumberToInt32_to_TruncateFloat64ToWord32) { - // NumberToInt32(x: kRepFloat64) used as MachineType::Int32() - TestingGraph t(Type::Number()); - Node* p0 = t.ExampleWithOutput(MachineType::Float64()); - Node* trunc = t.graph()->NewNode(t.simplified()->NumberToInt32(), p0); - Node* use = t.Use(trunc, MachineType::Int32()); - t.Return(use); - t.Lower(); - CheckChangeOf(IrOpcode::kTruncateFloat64ToWord32, p0, use->InputAt(0)); -} - -TEST(LowerNumberToInt32_to_TruncateTaggedToWord32) { - // NumberToInt32(x: kTypeNumber | kRepTagged) used as MachineType::Int32() - TestingGraph t(Type::Number()); - Node* trunc = t.graph()->NewNode(t.simplified()->NumberToInt32(), t.p0); - Node* use = t.Use(trunc, MachineType::Int32()); - t.Return(use); - t.Lower(); - CheckChangeOf(IrOpcode::kTruncateTaggedToWord32, t.p0, use->InputAt(0)); -} - - -TEST(LowerNumberToUint32_to_ChangeTaggedToUint32) { - // NumberToUint32(x: kRepTagged | kTypeUint32) used as kRepWord32 - TestingGraph t(Type::Unsigned32()); - Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), t.p0); - Node* use = t.Use(trunc, MachineType::Uint32()); - t.Return(use); - t.Lower(); - CheckChangeOf(IrOpcode::kChangeTaggedToUint32, t.p0, use->InputAt(0)); -} - -TEST(LowerNumberToUint32_to_TruncateFloat64ToWord32) { - // NumberToUint32(x: kRepFloat64) used as MachineType::Uint32() - TestingGraph t(Type::Number()); - Node* p0 = t.ExampleWithOutput(MachineType::Float64()); - // TODO(titzer): run the typer here, or attach machine type to param. - NodeProperties::SetType(p0, Type::Number()); - Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), p0); - Node* use = t.Use(trunc, MachineType::Uint32()); - t.Return(use); - t.Lower(); - CheckChangeOf(IrOpcode::kTruncateFloat64ToWord32, p0, use->InputAt(0)); -} - -TEST(LowerNumberToUint32_to_TruncateTaggedToWord32) { - // NumberToInt32(x: kTypeNumber | kRepTagged) used as MachineType::Uint32() - TestingGraph t(Type::Number()); - Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), t.p0); - Node* use = t.Use(trunc, MachineType::Uint32()); - t.Return(use); - t.Lower(); - CheckChangeOf(IrOpcode::kTruncateTaggedToWord32, t.p0, use->InputAt(0)); -} - -TEST(LowerNumberToUint32_to_TruncateFloat64ToWord32_uint32) { - // NumberToUint32(x: kRepFloat64) used as kRepWord32 - TestingGraph t(Type::Unsigned32()); - Node* input = t.ExampleWithOutput(MachineType::Float64()); - Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), input); - Node* use = t.Use(trunc, MachineType::RepWord32()); - t.Return(use); - t.Lower(); - CheckChangeOf(IrOpcode::kTruncateFloat64ToWord32, input, use->InputAt(0)); -} - - -TEST(LowerReferenceEqual_to_wordeq) { - TestingGraph t(Type::Any(), Type::Any()); - IrOpcode::Value opcode = - static_cast<IrOpcode::Value>(t.machine()->WordEqual()->opcode()); - t.CheckLoweringBinop(opcode, t.simplified()->ReferenceEqual()); -} - -void CheckChangeInsertion(IrOpcode::Value expected, MachineType from, - MachineType to, Type* type = Type::Any()) { - TestingGraph t(Type::Any()); - Node* in = t.ExampleWithOutput(from); - NodeProperties::SetType(in, type); - Node* use = t.Use(in, to); - t.Return(use); - t.Lower(); - CHECK_EQ(expected, use->InputAt(0)->opcode()); - CHECK_EQ(in, use->InputAt(0)->InputAt(0)); -} - -TEST(InsertBasicChanges) { - CheckChangeInsertion(IrOpcode::kChangeFloat64ToInt32, MachineType::Float64(), - MachineType::Int32(), Type::Signed32()); - CheckChangeInsertion(IrOpcode::kChangeFloat64ToUint32, MachineType::Float64(), - MachineType::Uint32(), Type::Unsigned32()); - CheckChangeInsertion(IrOpcode::kTruncateFloat64ToWord32, - MachineType::Float64(), MachineType::Uint32(), - Type::Integral32()); - CheckChangeInsertion(IrOpcode::kChangeTaggedToInt32, MachineType::AnyTagged(), - MachineType::Int32(), Type::Signed32()); - CheckChangeInsertion(IrOpcode::kChangeTaggedToUint32, - MachineType::AnyTagged(), MachineType::Uint32(), - Type::Unsigned32()); - - CheckChangeInsertion(IrOpcode::kChangeFloat64ToTagged, MachineType::Float64(), - MachineType::AnyTagged(), Type::Number()); - CheckChangeInsertion(IrOpcode::kChangeTaggedToFloat64, - MachineType::AnyTagged(), MachineType::Float64(), - Type::Number()); - - CheckChangeInsertion(IrOpcode::kChangeInt32ToFloat64, MachineType::Int32(), - MachineType::Float64(), Type::Signed32()); - CheckChangeInsertion(IrOpcode::kChangeInt32ToTagged, MachineType::Int32(), - MachineType::AnyTagged(), Type::Signed32()); - - CheckChangeInsertion(IrOpcode::kChangeUint32ToFloat64, MachineType::Uint32(), - MachineType::Float64(), Type::Unsigned32()); - CheckChangeInsertion(IrOpcode::kChangeUint32ToTagged, MachineType::Uint32(), - MachineType::AnyTagged(), Type::Unsigned32()); -} - -static void CheckChangesAroundBinop(TestingGraph* t, const Operator* op, - IrOpcode::Value input_change, - IrOpcode::Value output_change, Type* type) { - Node* binop = - op->ControlInputCount() == 0 - ? t->graph()->NewNode(op, t->p0, t->p1) - : t->graph()->NewNode(op, t->p0, t->p1, t->graph()->start()); - NodeProperties::SetType(binop, type); - t->Return(binop); - t->Lower(); - CHECK_EQ(input_change, binop->InputAt(0)->opcode()); - CHECK_EQ(input_change, binop->InputAt(1)->opcode()); - CHECK_EQ(t->p0, binop->InputAt(0)->InputAt(0)); - CHECK_EQ(t->p1, binop->InputAt(1)->InputAt(0)); - CHECK_EQ(output_change, t->ret->InputAt(0)->opcode()); - CHECK_EQ(binop, t->ret->InputAt(0)->InputAt(0)); -} - - -TEST(InsertChangesAroundInt32Binops) { - TestingGraph t(Type::Signed32(), Type::Signed32()); - - const Operator* ops[] = {t.machine()->Int32Add(), t.machine()->Int32Sub(), - t.machine()->Int32Mul(), t.machine()->Int32Div(), - t.machine()->Int32Mod(), t.machine()->Word32And(), - t.machine()->Word32Or(), t.machine()->Word32Xor(), - t.machine()->Word32Shl(), t.machine()->Word32Sar()}; - - for (size_t i = 0; i < arraysize(ops); i++) { - CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToInt32, - IrOpcode::kChangeInt32ToTagged, Type::Signed32()); - CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToInt32, - IrOpcode::kChangeInt32ToTagged, Type::Signed32()); - } -} - - -TEST(InsertChangesAroundInt32Cmp) { - TestingGraph t(Type::Signed32(), Type::Signed32()); - - const Operator* ops[] = {t.machine()->Int32LessThan(), - t.machine()->Int32LessThanOrEqual()}; - - for (size_t i = 0; i < arraysize(ops); i++) { - CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToInt32, - IrOpcode::kChangeBitToTagged, Type::Boolean()); - } -} - - -TEST(InsertChangesAroundUint32Cmp) { - TestingGraph t(Type::Unsigned32(), Type::Unsigned32()); - - const Operator* ops[] = {t.machine()->Uint32LessThan(), - t.machine()->Uint32LessThanOrEqual()}; - - for (size_t i = 0; i < arraysize(ops); i++) { - CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToUint32, - IrOpcode::kChangeBitToTagged, Type::Boolean()); - } -} - - -TEST(InsertChangesAroundFloat64Binops) { - TestingGraph t(Type::Number(), Type::Number()); - - const Operator* ops[] = { - t.machine()->Float64Add(), t.machine()->Float64Sub(), - t.machine()->Float64Mul(), t.machine()->Float64Div(), - t.machine()->Float64Mod(), - }; - - for (size_t i = 0; i < arraysize(ops); i++) { - CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToFloat64, - IrOpcode::kChangeFloat64ToTagged, Type::Number()); - } -} - - -TEST(InsertChangesAroundFloat64Cmp) { - TestingGraph t(Type::Number(), Type::Number()); - - const Operator* ops[] = {t.machine()->Float64Equal(), - t.machine()->Float64LessThan(), - t.machine()->Float64LessThanOrEqual()}; - - for (size_t i = 0; i < arraysize(ops); i++) { - CheckChangesAroundBinop(&t, ops[i], IrOpcode::kChangeTaggedToFloat64, - IrOpcode::kChangeBitToTagged, Type::Boolean()); - } -} - - -namespace { - -void CheckFieldAccessArithmetic(FieldAccess access, Node* load_or_store) { - IntPtrMatcher mindex(load_or_store->InputAt(1)); - CHECK(mindex.Is(access.offset - access.tag())); -} - - -Node* CheckElementAccessArithmetic(ElementAccess access, Node* load_or_store) { - Node* index = load_or_store->InputAt(1); - if (kPointerSize == 8) { - Int64BinopMatcher mindex(index); - CHECK_EQ(IrOpcode::kInt64Add, mindex.node()->opcode()); - CHECK(mindex.right().Is(access.header_size - access.tag())); - - const int element_size_shift = - ElementSizeLog2Of(access.machine_type.representation()); - Node* index; - if (element_size_shift) { - Int64BinopMatcher shl(mindex.left().node()); - CHECK_EQ(IrOpcode::kWord64Shl, shl.node()->opcode()); - CHECK(shl.right().Is(element_size_shift)); - index = shl.left().node(); - } else { - index = mindex.left().node(); - } - CHECK_EQ(IrOpcode::kChangeUint32ToUint64, index->opcode()); - return index->InputAt(0); - } else { - Int32BinopMatcher mindex(index); - CHECK_EQ(IrOpcode::kInt32Add, mindex.node()->opcode()); - CHECK(mindex.right().Is(access.header_size - access.tag())); - - const int element_size_shift = - ElementSizeLog2Of(access.machine_type.representation()); - if (element_size_shift) { - Int32BinopMatcher shl(mindex.left().node()); - CHECK_EQ(IrOpcode::kWord32Shl, shl.node()->opcode()); - CHECK(shl.right().Is(element_size_shift)); - return shl.left().node(); - } else { - return mindex.left().node(); - } - } -} - - -const MachineType kMachineReps[] = { - MachineType::Int8(), MachineType::Int16(), MachineType::Int32(), - MachineType::Uint32(), MachineType::Int64(), MachineType::Float64(), - MachineType::AnyTagged()}; - -} // namespace - - -TEST(LowerLoadField_to_load) { - for (size_t i = 0; i < arraysize(kMachineReps); i++) { - TestingGraph t(Type::Any(), Type::Signed32()); - FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Handle<Name>::null(), Type::Any(), - kMachineReps[i], kNoWriteBarrier}; - - Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, - t.start, t.start); - Node* use = t.Use(load, kMachineReps[i]); - t.Return(use); - t.LowerAllNodesAndLowerChanges(); - CHECK_EQ(IrOpcode::kLoad, load->opcode()); - CHECK_EQ(t.p0, load->InputAt(0)); - CheckFieldAccessArithmetic(access, load); - - MachineType rep = LoadRepresentationOf(load->op()); - CHECK_EQ(kMachineReps[i], rep); - } -} - - -TEST(LowerStoreField_to_store) { - { - TestingGraph t(Type::Any(), Type::Signed32()); - - for (size_t i = 0; i < arraysize(kMachineReps); i++) { - FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Handle<Name>::null(), Type::Any(), - kMachineReps[i], kNoWriteBarrier}; - - Node* val = t.ExampleWithOutput(kMachineReps[i]); - Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, - val, t.start, t.start); - t.Effect(store); - t.LowerAllNodesAndLowerChanges(); - CHECK_EQ(IrOpcode::kStore, store->opcode()); - CHECK_EQ(val, store->InputAt(2)); - CheckFieldAccessArithmetic(access, store); - - StoreRepresentation rep = StoreRepresentationOf(store->op()); - if (kMachineReps[i].representation() == MachineRepresentation::kTagged) { - CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); - } - CHECK_EQ(kMachineReps[i].representation(), rep.representation()); - } - } - { - HandleAndZoneScope scope; - Zone* z = scope.main_zone(); - TestingGraph t(Type::Any(), Type::Intersect(Type::SignedSmall(), - Type::TaggedSigned(), z)); - FieldAccess access = { - kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(), - Type::Any(), MachineType::AnyTagged(), kNoWriteBarrier}; - Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, - t.p1, t.start, t.start); - t.Effect(store); - t.LowerAllNodesAndLowerChanges(); - CHECK_EQ(IrOpcode::kStore, store->opcode()); - CHECK_EQ(t.p1, store->InputAt(2)); - StoreRepresentation rep = StoreRepresentationOf(store->op()); - CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); - } -} - - -TEST(LowerLoadElement_to_load) { - for (size_t i = 0; i < arraysize(kMachineReps); i++) { - TestingGraph t(Type::Any(), Type::Signed32()); - ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Type::Any(), kMachineReps[i], kNoWriteBarrier}; - - Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, - t.p1, t.start, t.start); - Node* use = t.Use(load, kMachineReps[i]); - t.Return(use); - t.LowerAllNodesAndLowerChanges(); - CHECK_EQ(IrOpcode::kLoad, load->opcode()); - CHECK_EQ(t.p0, load->InputAt(0)); - CheckElementAccessArithmetic(access, load); - - MachineType rep = LoadRepresentationOf(load->op()); - CHECK_EQ(kMachineReps[i], rep); - } -} - - -TEST(LowerStoreElement_to_store) { - { - for (size_t i = 0; i < arraysize(kMachineReps); i++) { - TestingGraph t(Type::Any(), Type::Signed32()); - - ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Type::Any(), kMachineReps[i], kNoWriteBarrier}; - - Node* val = t.ExampleWithOutput(kMachineReps[i]); - Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), - t.p0, t.p1, val, t.start, t.start); - t.Effect(store); - t.LowerAllNodesAndLowerChanges(); - CHECK_EQ(IrOpcode::kStore, store->opcode()); - CHECK_EQ(val, store->InputAt(2)); - CheckElementAccessArithmetic(access, store); - - StoreRepresentation rep = StoreRepresentationOf(store->op()); - if (kMachineReps[i].representation() == MachineRepresentation::kTagged) { - CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); - } - CHECK_EQ(kMachineReps[i].representation(), rep.representation()); - } - } - { - HandleAndZoneScope scope; - Zone* z = scope.main_zone(); - TestingGraph t( - Type::Any(), Type::Signed32(), - Type::Intersect(Type::SignedSmall(), Type::TaggedSigned(), z)); - ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Type::Any(), MachineType::AnyTagged(), - kNoWriteBarrier}; - Node* store = t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, - t.p1, t.p2, t.start, t.start); - t.Effect(store); - t.LowerAllNodesAndLowerChanges(); - CHECK_EQ(IrOpcode::kStore, store->opcode()); - CHECK_EQ(t.p2, store->InputAt(2)); - StoreRepresentation rep = StoreRepresentationOf(store->op()); - CHECK_EQ(kNoWriteBarrier, rep.write_barrier_kind()); - } -} - - -TEST(InsertChangeForLoadElementIndex) { - // LoadElement(obj: Tagged, index: kTypeInt32 | kRepTagged, length) => - // Load(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k)) - TestingGraph t(Type::Any(), Type::Signed32()); - ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), - MachineType::AnyTagged(), kNoWriteBarrier}; - - Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, - t.p1, t.start, t.start); - t.Return(load); - t.Lower(); - CHECK_EQ(IrOpcode::kLoadElement, load->opcode()); - CHECK_EQ(t.p0, load->InputAt(0)); - CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, load->InputAt(1)); -} - - -TEST(InsertChangeForStoreElementIndex) { - // StoreElement(obj: Tagged, index: kTypeInt32 | kRepTagged, length, val) => - // Store(obj, Int32Add(Int32Mul(ChangeTaggedToInt32(index), #k), #k), val) - TestingGraph t(Type::Any(), Type::Signed32()); - ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), - MachineType::AnyTagged(), kFullWriteBarrier}; - - Node* store = - t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, t.p1, - t.jsgraph.TrueConstant(), t.start, t.start); - t.Effect(store); - t.Lower(); - CHECK_EQ(IrOpcode::kStoreElement, store->opcode()); - CHECK_EQ(t.p0, store->InputAt(0)); - CheckChangeOf(IrOpcode::kChangeTaggedToInt32, t.p1, store->InputAt(1)); -} - - -TEST(InsertChangeForLoadElement) { - // TODO(titzer): test all load/store representation change insertions. - TestingGraph t(Type::Any(), Type::Signed32(), Type::Any()); - ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Type::Number(), MachineType::Float64(), - kNoWriteBarrier}; - - Node* load = t.graph()->NewNode(t.simplified()->LoadElement(access), t.p0, - t.p1, t.start, t.start); - t.Return(load); - t.Lower(); - CHECK_EQ(IrOpcode::kLoadElement, load->opcode()); - CHECK_EQ(t.p0, load->InputAt(0)); - CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); -} - - -TEST(InsertChangeForLoadField) { - // TODO(titzer): test all load/store representation change insertions. - TestingGraph t(Type::Any(), Type::Signed32()); - FieldAccess access = { - kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(), - Type::Number(), MachineType::Float64(), kNoWriteBarrier}; - - Node* load = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, - t.start, t.start); - t.Return(load); - t.Lower(); - CHECK_EQ(IrOpcode::kLoadField, load->opcode()); - CHECK_EQ(t.p0, load->InputAt(0)); - CheckChangeOf(IrOpcode::kChangeFloat64ToTagged, load, t.ret->InputAt(0)); -} - - -TEST(InsertChangeForStoreElement) { - // TODO(titzer): test all load/store representation change insertions. - TestingGraph t(Type::Any(), Type::Signed32()); - ElementAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, Type::Any(), - MachineType::Float64(), kFullWriteBarrier}; - - Node* store = - t.graph()->NewNode(t.simplified()->StoreElement(access), t.p0, - t.jsgraph.Int32Constant(0), t.p1, t.start, t.start); - t.Effect(store); - t.Lower(); - - CHECK_EQ(IrOpcode::kStoreElement, store->opcode()); - CHECK_EQ(t.p0, store->InputAt(0)); - CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(2)); -} - - -TEST(InsertChangeForStoreField) { - // TODO(titzer): test all load/store representation change insertions. - TestingGraph t(Type::Any(), Type::Signed32()); - FieldAccess access = { - kTaggedBase, FixedArrayBase::kHeaderSize, Handle<Name>::null(), - Type::Any(), MachineType::Float64(), kNoWriteBarrier}; - - Node* store = t.graph()->NewNode(t.simplified()->StoreField(access), t.p0, - t.p1, t.start, t.start); - t.Effect(store); - t.Lower(); - - CHECK_EQ(IrOpcode::kStoreField, store->opcode()); - CHECK_EQ(t.p0, store->InputAt(0)); - CheckChangeOf(IrOpcode::kChangeTaggedToFloat64, t.p1, store->InputAt(1)); -} - - -TEST(UpdatePhi) { - TestingGraph t(Type::Any(), Type::Signed32()); - static const MachineType kMachineTypes[] = { - MachineType::Int32(), MachineType::Uint32(), MachineType::Float64()}; - Type* kTypes[] = {Type::Signed32(), Type::Unsigned32(), Type::Number()}; - - for (size_t i = 0; i < arraysize(kMachineTypes); i++) { - FieldAccess access = {kTaggedBase, FixedArrayBase::kHeaderSize, - Handle<Name>::null(), kTypes[i], - kMachineTypes[i], kFullWriteBarrier}; - - Node* load0 = t.graph()->NewNode(t.simplified()->LoadField(access), t.p0, - t.start, t.start); - Node* load1 = t.graph()->NewNode(t.simplified()->LoadField(access), t.p1, - t.start, t.start); - Node* phi = - t.graph()->NewNode(t.common()->Phi(MachineRepresentation::kTagged, 2), - load0, load1, t.start); - t.Return(t.Use(phi, kMachineTypes[i])); - t.Lower(); - - CHECK_EQ(IrOpcode::kPhi, phi->opcode()); - CHECK_EQ(kMachineTypes[i].representation(), PhiRepresentationOf(phi->op())); - } -} - - -TEST(NumberMultiply_ConstantOutOfRange) { - TestingGraph t(Type::Signed32()); - Node* k = t.jsgraph.Constant(1000000023); - Node* mul = t.graph()->NewNode(t.simplified()->NumberMultiply(), t.p0, k); - Node* trunc = t.graph()->NewNode(t.simplified()->NumberToInt32(), mul); - t.Return(trunc); - t.Lower(); - - CHECK_EQ(IrOpcode::kFloat64Mul, mul->opcode()); -} - - -TEST(NumberMultiply_NonTruncating) { - TestingGraph t(Type::Signed32()); - Node* k = t.jsgraph.Constant(111); - Node* mul = t.graph()->NewNode(t.simplified()->NumberMultiply(), t.p0, k); - t.Return(mul); - t.Lower(); - - CHECK_EQ(IrOpcode::kFloat64Mul, mul->opcode()); -} - - -TEST(NumberDivide_TruncatingToInt32) { - int32_t constants[] = {-100, -10, 1, 4, 100, 1000}; - - for (size_t i = 0; i < arraysize(constants); i++) { - TestingGraph t(Type::Signed32()); - Node* k = t.jsgraph.Constant(constants[i]); - Node* div = t.graph()->NewNode(t.simplified()->NumberDivide(), t.p0, k); - Node* use = t.Use(div, MachineType::Int32()); - t.Return(use); - t.Lower(); - - CHECK_EQ(IrOpcode::kInt32Div, use->InputAt(0)->opcode()); - } -} - - -TEST(NumberDivide_TruncatingToUint32) { - double constants[] = {1, 3, 100, 1000, 100998348}; - - for (size_t i = 0; i < arraysize(constants); i++) { - TestingGraph t(Type::Unsigned32()); - Node* k = t.jsgraph.Constant(constants[i]); - Node* div = t.graph()->NewNode(t.simplified()->NumberDivide(), t.p0, k); - Node* use = t.Use(div, MachineType::Uint32()); - t.Return(use); - t.Lower(); - - CHECK_EQ(IrOpcode::kUint32Div, use->InputAt(0)->opcode()); - } -} - - -TEST(NumberDivide_BadConstants) { - { - TestingGraph t(Type::Signed32()); - Node* k = t.jsgraph.Constant(-1); - Node* div = t.graph()->NewNode(t.simplified()->NumberDivide(), t.p0, k); - Node* use = t.Use(div, MachineType::Int32()); - t.Return(use); - t.Lower(); - - CHECK_EQ(IrOpcode::kInt32Sub, use->InputAt(0)->opcode()); - } - - { - TestingGraph t(Type::Signed32()); - Node* k = t.jsgraph.Constant(0); - Node* div = t.graph()->NewNode(t.simplified()->NumberDivide(), t.p0, k); - Node* use = t.Use(div, MachineType::Int32()); - t.Return(use); - t.Lower(); - - CHECK_EQ(IrOpcode::kInt32Constant, use->InputAt(0)->opcode()); - CHECK_EQ(0, OpParameter<int32_t>(use->InputAt(0))); - } - - { - TestingGraph t(Type::Unsigned32()); - Node* k = t.jsgraph.Constant(0); - Node* div = t.graph()->NewNode(t.simplified()->NumberDivide(), t.p0, k); - Node* use = t.Use(div, MachineType::Uint32()); - t.Return(use); - t.Lower(); - - CHECK_EQ(IrOpcode::kInt32Constant, use->InputAt(0)->opcode()); - CHECK_EQ(0, OpParameter<int32_t>(use->InputAt(0))); - } -} - - -TEST(NumberModulus_TruncatingToInt32) { - int32_t constants[] = {-100, -10, 1, 4, 100, 1000}; - - for (size_t i = 0; i < arraysize(constants); i++) { - TestingGraph t(Type::Signed32()); - Node* k = t.jsgraph.Constant(constants[i]); - Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k); - Node* use = t.Use(mod, MachineType::Int32()); - t.Return(use); - t.Lower(); - - CHECK_EQ(IrOpcode::kInt32Mod, use->InputAt(0)->opcode()); - } -} - - -TEST(NumberModulus_TruncatingToUint32) { - double constants[] = {1, 3, 100, 1000, 100998348}; - - for (size_t i = 0; i < arraysize(constants); i++) { - TestingGraph t(Type::Unsigned32()); - Node* k = t.jsgraph.Constant(constants[i]); - Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k); - Node* trunc = t.graph()->NewNode(t.simplified()->NumberToUint32(), mod); - t.Return(trunc); - t.Lower(); - - CHECK_EQ(IrOpcode::kUint32Mod, t.ret->InputAt(0)->InputAt(0)->opcode()); - } -} - - -TEST(NumberModulus_Int32) { - int32_t constants[] = {-100, -10, 1, 4, 100, 1000}; - - for (size_t i = 0; i < arraysize(constants); i++) { - TestingGraph t(Type::Signed32()); - Node* k = t.jsgraph.Constant(constants[i]); - Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k); - t.Return(mod); - t.Lower(); - - CHECK_EQ(IrOpcode::kFloat64Mod, mod->opcode()); // Pesky -0 behavior. - } -} - - -TEST(NumberModulus_Uint32) { - const double kConstants[] = {2, 100, 1000, 1024, 2048}; - const MachineType kTypes[] = {MachineType::Int32(), MachineType::Uint32()}; - - for (auto const type : kTypes) { - for (auto const c : kConstants) { - TestingGraph t(Type::Unsigned32()); - Node* k = t.jsgraph.Constant(c); - Node* mod = t.graph()->NewNode(t.simplified()->NumberModulus(), t.p0, k); - Node* use = t.Use(mod, type); - t.Return(use); - t.Lower(); - - CHECK_EQ(IrOpcode::kUint32Mod, use->InputAt(0)->opcode()); - } - } -} - - -TEST(PhiRepresentation) { - HandleAndZoneScope scope; - Zone* z = scope.main_zone(); - - struct TestData { - Type* arg1; - Type* arg2; - MachineType use; - MachineRepresentation expected; - }; - - TestData test_data[] = { - {Type::Signed32(), Type::Unsigned32(), MachineType::Int32(), - MachineRepresentation::kWord32}, - {Type::Signed32(), Type::Unsigned32(), MachineType::Uint32(), - MachineRepresentation::kWord32}, - {Type::Signed32(), Type::Signed32(), MachineType::Int32(), - MachineRepresentation::kWord32}, - {Type::Unsigned32(), Type::Unsigned32(), MachineType::Int32(), - MachineRepresentation::kWord32}, - {Type::Number(), Type::Signed32(), MachineType::Int32(), - MachineRepresentation::kWord32}}; - - for (auto const d : test_data) { - TestingGraph t(d.arg1, d.arg2, Type::Boolean()); - - Node* br = t.graph()->NewNode(t.common()->Branch(), t.p2, t.start); - Node* tb = t.graph()->NewNode(t.common()->IfTrue(), br); - Node* fb = t.graph()->NewNode(t.common()->IfFalse(), br); - Node* m = t.graph()->NewNode(t.common()->Merge(2), tb, fb); - - Node* phi = t.graph()->NewNode( - t.common()->Phi(MachineRepresentation::kTagged, 2), t.p0, t.p1, m); - - Type* phi_type = Type::Union(d.arg1, d.arg2, z); - NodeProperties::SetType(phi, phi_type); - - Node* use = t.Use(phi, d.use); - t.Return(use); - t.Lower(); - - CHECK_EQ(d.expected, PhiRepresentationOf(phi->op())); - } -} - -} // namespace compiler -} // namespace internal -} // namespace v8 diff --git a/deps/v8/test/cctest/heap/heap-tester.h b/deps/v8/test/cctest/heap/heap-tester.h index 674bdcb1cc..a01de69291 100644 --- a/deps/v8/test/cctest/heap/heap-tester.h +++ b/deps/v8/test/cctest/heap/heap-tester.h @@ -30,6 +30,7 @@ V(TestMemoryReducerSampleJsCalls) \ V(TestSizeOfObjects) \ V(Regress587004) \ + V(Regress538257) \ V(Regress589413) \ V(WriteBarriersInCopyJSObject) diff --git a/deps/v8/test/cctest/heap/heap-utils.cc b/deps/v8/test/cctest/heap/heap-utils.cc index 7d4d4bf40d..4f7d088a94 100644 --- a/deps/v8/test/cctest/heap/heap-utils.cc +++ b/deps/v8/test/cctest/heap/heap-utils.cc @@ -15,8 +15,10 @@ namespace internal { namespace heap { void SealCurrentObjects(Heap* heap) { - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); + heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, + GarbageCollectionReason::kTesting); + heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, + GarbageCollectionReason::kTesting); heap->mark_compact_collector()->EnsureSweepingCompleted(); heap->old_space()->EmptyAllocationInfo(); for (Page* page : *heap->old_space()) { @@ -28,6 +30,35 @@ int FixedArrayLenFromSize(int size) { return (size - FixedArray::kHeaderSize) / kPointerSize; } +std::vector<Handle<FixedArray>> FillOldSpacePageWithFixedArrays(Heap* heap, + int remainder) { + std::vector<Handle<FixedArray>> handles; + Isolate* isolate = heap->isolate(); + const int kArraySize = 128; + const int kArrayLen = heap::FixedArrayLenFromSize(kArraySize); + CHECK_EQ(Page::kAllocatableMemory % kArraySize, 0); + Handle<FixedArray> array; + for (size_t allocated = 0; + allocated != (Page::kAllocatableMemory - remainder); + allocated += array->Size()) { + if (allocated == (Page::kAllocatableMemory - kArraySize)) { + array = isolate->factory()->NewFixedArray( + heap::FixedArrayLenFromSize(kArraySize - remainder), TENURED); + CHECK_EQ(kArraySize - remainder, array->Size()); + } else { + array = isolate->factory()->NewFixedArray(kArrayLen, TENURED); + CHECK_EQ(kArraySize, array->Size()); + } + if (handles.empty()) { + // Check that allocations started on a new page. + CHECK_EQ(array->address(), + Page::FromAddress(array->address())->area_start()); + } + handles.push_back(array); + } + return handles; +} + std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size, PretenureFlag tenure, int object_size) { @@ -112,20 +143,25 @@ void SimulateFullSpace(v8::internal::NewSpace* space, } void SimulateIncrementalMarking(i::Heap* heap, bool force_completion) { - i::MarkCompactCollector* collector = heap->mark_compact_collector(); i::IncrementalMarking* marking = heap->incremental_marking(); + i::MarkCompactCollector* collector = heap->mark_compact_collector(); if (collector->sweeping_in_progress()) { collector->EnsureSweepingCompleted(); } - CHECK(marking->IsMarking() || marking->IsStopped()); + if (marking->IsSweeping()) { + marking->FinalizeSweeping(); + } + CHECK(marking->IsMarking() || marking->IsStopped() || marking->IsComplete()); if (marking->IsStopped()) { - heap->StartIncrementalMarking(); + heap->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); } - CHECK(marking->IsMarking()); + CHECK(marking->IsMarking() || marking->IsComplete()); if (!force_completion) return; while (!marking->IsComplete()) { - marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); + marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, + i::IncrementalMarking::FORCE_COMPLETION, i::StepOrigin::kV8); if (marking->IsReadyToOverApproximateWeakClosure()) { marking->FinalizeIncrementally(); } @@ -147,7 +183,7 @@ void AbandonCurrentlyFreeMemory(PagedSpace* space) { } void GcAndSweep(Heap* heap, AllocationSpace space) { - heap->CollectGarbage(space); + heap->CollectGarbage(space, GarbageCollectionReason::kTesting); if (heap->mark_compact_collector()->sweeping_in_progress()) { heap->mark_compact_collector()->EnsureSweepingCompleted(); } diff --git a/deps/v8/test/cctest/heap/heap-utils.h b/deps/v8/test/cctest/heap/heap-utils.h index e03e6fa6e0..2f704cb422 100644 --- a/deps/v8/test/cctest/heap/heap-utils.h +++ b/deps/v8/test/cctest/heap/heap-utils.h @@ -15,9 +15,15 @@ void SealCurrentObjects(Heap* heap); int FixedArrayLenFromSize(int size); +// Fill a page with fixed arrays leaving remainder behind. The function does +// not create additional fillers and assumes that the space has just been +// sealed. +std::vector<Handle<FixedArray>> FillOldSpacePageWithFixedArrays(Heap* heap, + int remainder); + std::vector<Handle<FixedArray>> CreatePadding( Heap* heap, int padding_size, PretenureFlag tenure, - int object_size = Page::kMaxRegularHeapObjectSize); + int object_size = kMaxRegularHeapObjectSize); void AllocateAllButNBytes( v8::internal::NewSpace* space, int extra_bytes, diff --git a/deps/v8/test/cctest/heap/test-alloc.cc b/deps/v8/test/cctest/heap/test-alloc.cc index 348ba1979d..c01827eee1 100644 --- a/deps/v8/test/cctest/heap/test-alloc.cc +++ b/deps/v8/test/cctest/heap/test-alloc.cc @@ -91,7 +91,7 @@ Handle<Object> v8::internal::HeapTester::TestAllocateAfterFailures() { // Similar to what the CALL_AND_RETRY macro does in the last-resort case, we // are wrapping the allocator function in an AlwaysAllocateScope. Test that // all allocations succeed immediately without any retry. - CcTest::heap()->CollectAllAvailableGarbage("panic"); + CcTest::CollectAllAvailableGarbage(); AlwaysAllocateScope scope(CcTest::i_isolate()); return handle(AllocateAfterFailures().ToObjectChecked(), CcTest::i_isolate()); } @@ -220,12 +220,11 @@ TEST(CodeRange) { if (current_allocated < code_range_size / 10) { // Allocate a block. // Geometrically distributed sizes, greater than - // Page::kMaxRegularHeapObjectSize (which is greater than code page area). + // kMaxRegularHeapObjectSize (which is greater than code page area). // TODO(gc): instead of using 3 use some contant based on code_range_size // kMaxRegularHeapObjectSize. - size_t requested = - (Page::kMaxRegularHeapObjectSize << (Pseudorandom() % 3)) + - Pseudorandom() % 5000 + 1; + size_t requested = (kMaxRegularHeapObjectSize << (Pseudorandom() % 3)) + + Pseudorandom() % 5000 + 1; size_t allocated = 0; // The request size has to be at least 2 code guard pages larger than the 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 b331f6bf3a..173d1fa85f 100644 --- a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc +++ b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc @@ -2,7 +2,9 @@ // 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/heap/array-buffer-tracker.h" +#include "src/isolate.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-utils.h" @@ -128,7 +130,7 @@ TEST(ArrayBuffer_Compaction) { page_before_gc->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); CHECK(IsTracked(*buf1)); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); Page* page_after_gc = Page::FromAddress(buf1->address()); CHECK(IsTracked(*buf1)); @@ -175,7 +177,7 @@ TEST(ArrayBuffer_UnregisterDuringSweep) { CHECK(IsTracked(*buf2)); } - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); // |Externalize| will cause the buffer to be |Unregister|ed. Without // barriers and proper synchronization this will trigger a data race on // TSAN. diff --git a/deps/v8/test/cctest/heap/test-compaction.cc b/deps/v8/test/cctest/heap/test-compaction.cc index f61f7e1c41..339aef3ea5 100644 --- a/deps/v8/test/cctest/heap/test-compaction.cc +++ b/deps/v8/test/cctest/heap/test-compaction.cc @@ -2,6 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/factory.h" +#include "src/heap/mark-compact.h" +#include "src/isolate.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-tester.h" #include "test/cctest/heap/heap-utils.h" @@ -58,7 +68,7 @@ HEAP_TEST(CompactionFullAbortedPage) { CheckAllObjectsOnPage(compaction_page_handles, to_be_aborted_page); heap->set_force_oom(true); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); heap->mark_compact_collector()->EnsureSweepingCompleted(); // Check that all handles still point to the same page, i.e., compaction @@ -118,7 +128,7 @@ HEAP_TEST(CompactionPartiallyAbortedPage) { Page::FromAddress(page_to_fill_handles.front()->address()); heap->set_force_oom(true); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); heap->mark_compact_collector()->EnsureSweepingCompleted(); bool migration_aborted = false; @@ -200,7 +210,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageIntraAbortedPointers) { Page::FromAddress(page_to_fill_handles.front()->address()); heap->set_force_oom(true); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); heap->mark_compact_collector()->EnsureSweepingCompleted(); // The following check makes sure that we compacted "some" objects, while @@ -293,7 +303,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) { Page::FromAddress(page_to_fill_handles.front()->address()); heap->set_force_oom(true); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); heap->mark_compact_collector()->EnsureSweepingCompleted(); // The following check makes sure that we compacted "some" objects, while @@ -343,7 +353,7 @@ HEAP_TEST(CompactionPartiallyAbortedPageWithStoreBufferEntries) { // If store buffer entries are not properly filtered/reset for aborted // pages we have now a broken address at an object slot in old space and // the following scavenge will crash. - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); } } } diff --git a/deps/v8/test/cctest/heap/test-heap.cc b/deps/v8/test/cctest/heap/test-heap.cc index 80c4cc7c34..c69d391f90 100644 --- a/deps/v8/test/cctest/heap/test-heap.cc +++ b/deps/v8/test/cctest/heap/test-heap.cc @@ -138,7 +138,7 @@ HEAP_TEST(TestNewSpaceRefsInCopiedCode) { Handle<Code> copy(tmp); CheckEmbeddedObjectsAreEqual(code, copy); - heap->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CheckEmbeddedObjectsAreEqual(code, copy); } @@ -478,12 +478,11 @@ TEST(Tagging) { TEST(GarbageCollection) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); Factory* factory = isolate->factory(); HandleScope sc(isolate); // Check GC. - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); Handle<JSGlobalObject> global( CcTest::i_isolate()->context()->global_object()); @@ -510,7 +509,7 @@ TEST(GarbageCollection) { *Object::GetProperty(obj, prop_namex).ToHandleChecked()); } - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); // Function should be alive. CHECK(Just(true) == JSReceiver::HasOwnProperty(global, name)); @@ -529,7 +528,7 @@ TEST(GarbageCollection) { } // After gc, it should survive. - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK(Just(true) == JSReceiver::HasOwnProperty(global, obj_name)); Handle<Object> obj = @@ -578,7 +577,6 @@ TEST(LocalHandles) { TEST(GlobalHandles) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); Factory* factory = isolate->factory(); GlobalHandles* global_handles = isolate->global_handles(); @@ -600,7 +598,7 @@ TEST(GlobalHandles) { } // after gc, it should survive - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK((*h1)->IsString()); CHECK((*h2)->IsHeapNumber()); @@ -633,7 +631,6 @@ TEST(WeakGlobalHandlesScavenge) { i::FLAG_stress_compaction = false; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); Factory* factory = isolate->factory(); GlobalHandles* global_handles = isolate->global_handles(); @@ -658,7 +655,7 @@ TEST(WeakGlobalHandlesScavenge) { &TestWeakGlobalHandleCallback, v8::WeakCallbackType::kParameter); // Scavenge treats weak pointers as normal roots. - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK((*h1)->IsString()); CHECK((*h2)->IsHeapNumber()); @@ -695,8 +692,8 @@ TEST(WeakGlobalHandlesMark) { } // Make sure the objects are promoted. - heap->CollectGarbage(OLD_SPACE); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK(!heap->InNewSpace(*h1) && !heap->InNewSpace(*h2)); std::pair<Handle<Object>*, int> handle_and_id(&h2, 1234); @@ -707,7 +704,7 @@ TEST(WeakGlobalHandlesMark) { CHECK(!GlobalHandles::IsNearDeath(h2.location())); // Incremental marking potentially marked handles before they turned weak. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK((*h1)->IsString()); @@ -722,7 +719,6 @@ TEST(DeleteWeakGlobalHandle) { i::FLAG_stress_compaction = false; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); Factory* factory = isolate->factory(); GlobalHandles* global_handles = isolate->global_handles(); @@ -743,12 +739,12 @@ TEST(DeleteWeakGlobalHandle) { v8::WeakCallbackType::kParameter); // Scanvenge does not recognize weak reference. - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK(!WeakPointerCleared); // Mark-compact treats weak reference properly. - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); CHECK(WeakPointerCleared); } @@ -764,7 +760,7 @@ TEST(DoNotPromoteWhiteObjectsOnScavenge) { CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*white)))); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK(heap->InNewSpace(*white)); } @@ -780,15 +776,15 @@ TEST(PromoteGreyOrBlackObjectsOnScavenge) { IncrementalMarking* marking = heap->incremental_marking(); marking->Stop(); - heap->StartIncrementalMarking(); + heap->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); while ( Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*marked)))) { marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, - IncrementalMarking::FORCE_MARKING, - IncrementalMarking::DO_NOT_FORCE_COMPLETION); + IncrementalMarking::DO_NOT_FORCE_COMPLETION, StepOrigin::kV8); } - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK(!heap->InNewSpace(*marked)); } @@ -836,7 +832,7 @@ TEST(BytecodeArray) { // evacuation candidate. Page* evac_page = Page::FromAddress(constant_pool->address()); evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // BytecodeArray should survive. CHECK_EQ(array->length(), kRawBytesSize); @@ -1254,7 +1250,7 @@ TEST(Iteration) { factory->NewStringFromStaticChars("abcdefghij", TENURED); // Allocate a large string (for large object space). - int large_size = Page::kMaxRegularHeapObjectSize + 1; + int large_size = kMaxRegularHeapObjectSize + 1; char* str = new char[large_size]; for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; str[large_size - 1] = '\0'; @@ -1306,14 +1302,20 @@ UNINITIALIZED_TEST(TestCodeFlushing) { CHECK(function->shared()->is_compiled()); // The code will survive at least two GCs. - i_isolate->heap()->CollectAllGarbage(); - i_isolate->heap()->CollectAllGarbage(); + i_isolate->heap()->CollectAllGarbage( + i::Heap::kFinalizeIncrementalMarkingMask, + i::GarbageCollectionReason::kTesting); + i_isolate->heap()->CollectAllGarbage( + i::Heap::kFinalizeIncrementalMarkingMask, + i::GarbageCollectionReason::kTesting); CHECK(function->shared()->is_compiled()); // Simulate several GCs that use full marking. const int kAgingThreshold = 6; for (int i = 0; i < kAgingThreshold; i++) { - i_isolate->heap()->CollectAllGarbage(); + i_isolate->heap()->CollectAllGarbage( + i::Heap::kFinalizeIncrementalMarkingMask, + i::GarbageCollectionReason::kTesting); } // foo should no longer be in the compilation cache @@ -1359,12 +1361,12 @@ TEST(TestCodeFlushingPreAged) { CHECK(function->shared()->is_compiled()); // The code has been run so will survive at least one GC. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(function->shared()->is_compiled()); // The code was only run once, so it should be pre-aged and collected on the // next GC. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(!function->shared()->is_compiled() || function->IsOptimized()); // Execute the function again twice, and ensure it is reset to the young age. @@ -1374,14 +1376,14 @@ TEST(TestCodeFlushingPreAged) { } // The code will survive at least two GC now that it is young again. - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(function->shared()->is_compiled()); // Simulate several GCs that use full marking. const int kAgingThreshold = 6; for (int i = 0; i < kAgingThreshold; i++) { - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } // foo should no longer be in the compilation cache @@ -1424,15 +1426,15 @@ TEST(TestCodeFlushingIncremental) { CHECK(function->shared()->is_compiled()); // The code will survive at least two GCs. - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(function->shared()->is_compiled()); // Simulate several GCs that use incremental marking. const int kAgingThreshold = 6; for (int i = 0; i < kAgingThreshold; i++) { heap::SimulateIncrementalMarking(CcTest::heap()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } CHECK(!function->shared()->is_compiled() || function->IsOptimized()); CHECK(!function->is_compiled() || function->IsOptimized()); @@ -1448,7 +1450,7 @@ TEST(TestCodeFlushingIncremental) { heap::SimulateIncrementalMarking(CcTest::heap()); if (!function->next_function_link()->IsUndefined(CcTest::i_isolate())) break; - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } // Force optimization while incremental marking is active and while @@ -1458,7 +1460,7 @@ TEST(TestCodeFlushingIncremental) { } // Simulate one final GC to make sure the candidate queue is sane. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(function->shared()->is_compiled() || !function->IsOptimized()); CHECK(function->is_compiled() || !function->IsOptimized()); } @@ -1487,7 +1489,7 @@ TEST(TestCodeFlushingIncrementalScavenge) { Handle<String> bar_name = factory->InternalizeUtf8String("bar"); // Perfrom one initial GC to enable code flushing. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // This compile will add the code to the compilation cache. { v8::HandleScope scope(CcTest::isolate()); @@ -1524,10 +1526,10 @@ TEST(TestCodeFlushingIncrementalScavenge) { // perform a scavenge while incremental marking is still running. heap::SimulateIncrementalMarking(CcTest::heap(), false); *function2.location() = NULL; - CcTest::heap()->CollectGarbage(NEW_SPACE, "test scavenge while marking"); + CcTest::CollectGarbage(NEW_SPACE); // Simulate one final GC to make sure the candidate queue is sane. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(!function->shared()->is_compiled() || function->IsOptimized()); CHECK(!function->is_compiled() || function->IsOptimized()); } @@ -1564,8 +1566,8 @@ TEST(TestCodeFlushingIncrementalAbort) { CHECK(function->shared()->is_compiled()); // The code will survive at least two GCs. - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(function->shared()->is_compiled()); // Bump the code age so that flushing is triggered. @@ -1594,7 +1596,7 @@ TEST(TestCodeFlushingIncrementalAbort) { } // Simulate one final GC to make sure the candidate queue is sane. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(function->shared()->is_compiled() || !function->IsOptimized()); CHECK(function->is_compiled() || !function->IsOptimized()); } @@ -1650,7 +1652,6 @@ TEST(CompilationCacheCachingBehavior) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Heap* heap = isolate->heap(); CompilationCache* compilation_cache = isolate->compilation_cache(); LanguageMode language_mode = construct_language_mode(FLAG_use_strict); @@ -1681,7 +1682,7 @@ TEST(CompilationCacheCachingBehavior) { // (Unless --optimize-for-size, in which case it might get collected // immediately.) if (!FLAG_optimize_for_size) { - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); info = compilation_cache->LookupScript( source, Handle<Object>(), 0, 0, v8::ScriptOriginOptions(false, true, false), native_context, @@ -1699,7 +1700,7 @@ TEST(CompilationCacheCachingBehavior) { info.ToHandleChecked()->code()->MakeOlder(EVEN_MARKING_PARITY); } - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Ensure code aging cleared the entry from the cache. info = compilation_cache->LookupScript( source, Handle<Object>(), 0, 0, @@ -1762,7 +1763,6 @@ TEST(TestInternalWeakLists) { static const int kNumTestContexts = 10; Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); HandleScope scope(isolate); v8::Local<v8::Context> ctx[kNumTestContexts]; if (!isolate->use_crankshaft()) return; @@ -1776,7 +1776,7 @@ TEST(TestInternalWeakLists) { // Collect garbage that might have been created by one of the // installed extensions. isolate->compilation_cache()->Clear(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(i + 1, CountNativeContexts()); @@ -1802,29 +1802,29 @@ TEST(TestInternalWeakLists) { // Scavenge treats these references as strong. for (int j = 0; j < 10; j++) { - CcTest::heap()->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK_EQ(5, CountOptimizedUserFunctions(ctx[i])); } // Mark compact handles the weak references. isolate->compilation_cache()->Clear(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(4, CountOptimizedUserFunctions(ctx[i])); // Get rid of f3 and f5 in the same way. CompileRun("f3=null"); for (int j = 0; j < 10; j++) { - CcTest::heap()->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK_EQ(4, CountOptimizedUserFunctions(ctx[i])); } - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(3, CountOptimizedUserFunctions(ctx[i])); CompileRun("f5=null"); for (int j = 0; j < 10; j++) { - CcTest::heap()->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK_EQ(3, CountOptimizedUserFunctions(ctx[i])); } - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(2, CountOptimizedUserFunctions(ctx[i])); ctx[i]->Exit(); @@ -1832,7 +1832,7 @@ TEST(TestInternalWeakLists) { // Force compilation cache cleanup. CcTest::heap()->NotifyContextDisposed(true); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Dispose the native contexts one by one. for (int i = 0; i < kNumTestContexts; i++) { @@ -1843,12 +1843,12 @@ TEST(TestInternalWeakLists) { // Scavenge treats these references as strong. for (int j = 0; j < 10; j++) { - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); CHECK_EQ(kNumTestContexts - i, CountNativeContexts()); } // Mark compact handles the weak references. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(kNumTestContexts - i - 1, CountNativeContexts()); } @@ -1864,7 +1864,8 @@ static int CountNativeContextsWithGC(Isolate* isolate, int n) { Handle<Object> object(heap->native_contexts_list(), isolate); while (!object->IsUndefined(isolate)) { count++; - if (count == n) heap->CollectAllGarbage(); + if (count == n) + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); object = Handle<Object>(Context::cast(*object)->next_context_link(), isolate); } @@ -1885,7 +1886,10 @@ static int CountOptimizedUserFunctionsWithGC(v8::Local<v8::Context> context, while (object->IsJSFunction() && !Handle<JSFunction>::cast(object)->shared()->IsBuiltin()) { count++; - if (count == n) isolate->heap()->CollectAllGarbage(); + if (count == n) + isolate->heap()->CollectAllGarbage( + i::Heap::kFinalizeIncrementalMarkingMask, + i::GarbageCollectionReason::kTesting); object = Handle<Object>( Object::cast(JSFunction::cast(*object)->next_function_link()), isolate); @@ -1968,7 +1972,7 @@ TEST(TestSizeOfRegExpCode) { // Get initial heap size after several full GCs, which will stabilize // the heap size and return with sweeping finished completely. - CcTest::heap()->CollectAllAvailableGarbage("initial cleanup"); + CcTest::CollectAllAvailableGarbage(); MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector(); if (collector->sweeping_in_progress()) { collector->EnsureSweepingCompleted(); @@ -1976,11 +1980,11 @@ TEST(TestSizeOfRegExpCode) { int initial_size = static_cast<int>(CcTest::heap()->SizeOfObjects()); CompileRun("'foo'.match(reg_exp_source);"); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); int size_with_regexp = static_cast<int>(CcTest::heap()->SizeOfObjects()); CompileRun("'foo'.match(half_size_reg_exp);"); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); int size_with_optimized_regexp = static_cast<int>(CcTest::heap()->SizeOfObjects()); @@ -2006,7 +2010,7 @@ HEAP_TEST(TestSizeOfObjects) { // Get initial heap size after several full GCs, which will stabilize // the heap size and return with sweeping finished completely. - heap->CollectAllAvailableGarbage("initial cleanup"); + CcTest::CollectAllAvailableGarbage(); if (collector->sweeping_in_progress()) { collector->EnsureSweepingCompleted(); } @@ -2027,7 +2031,7 @@ HEAP_TEST(TestSizeOfObjects) { // The heap size should go back to initial size after a full GC, even // though sweeping didn't finish yet. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Normally sweeping would not be complete here, but no guarantees. CHECK_EQ(initial_size, static_cast<int>(heap->SizeOfObjects())); // Waiting for sweeper threads should not change heap size. @@ -2218,6 +2222,17 @@ static Address AlignOldSpace(AllocationAlignment alignment, int offset) { // Test the case where allocation must be done from the free list, so filler // may precede or follow the object. TEST(TestAlignedOverAllocation) { + Heap* heap = CcTest::heap(); + // Test checks for fillers before and behind objects and requires a fresh + // page and empty free list. + heap::AbandonCurrentlyFreeMemory(heap->old_space()); + // Allocate a dummy object to properly set up the linear allocation info. + AllocationResult dummy = + heap->old_space()->AllocateRawUnaligned(kPointerSize); + CHECK(!dummy.IsRetry()); + heap->CreateFillerObjectAt(dummy.ToObjectChecked()->address(), kPointerSize, + ClearRecordedSlots::kNo); + // Double misalignment is 4 on 32-bit platforms, 0 on 64-bit ones. const intptr_t double_misalignment = kDoubleSize - kPointerSize; Address start; @@ -2340,24 +2355,11 @@ TEST(TestSizeOfObjectsVsHeapIteratorPrecision) { } } - -static void FillUpNewSpace(NewSpace* new_space) { - // Fill up new space to the point that it is completely full. Make sure - // that the scavenger does not undo the filling. - Heap* heap = new_space->heap(); - Isolate* isolate = heap->isolate(); - Factory* factory = isolate->factory(); - HandleScope scope(isolate); - AlwaysAllocateScope always_allocate(isolate); - intptr_t available = new_space->Capacity() - new_space->Size(); - intptr_t number_of_fillers = (available / FixedArray::SizeFor(32)) - 1; - for (intptr_t i = 0; i < number_of_fillers; i++) { - CHECK(heap->InNewSpace(*factory->NewFixedArray(32, NOT_TENURED))); - } -} - - TEST(GrowAndShrinkNewSpace) { + // Avoid shrinking new space in GC epilogue. This can happen if allocation + // throughput samples have been taken while executing the benchmark. + FLAG_predictable = true; + CcTest::InitializeVM(); Heap* heap = CcTest::heap(); NewSpace* new_space = heap->new_space(); @@ -2371,28 +2373,31 @@ TEST(GrowAndShrinkNewSpace) { old_capacity = new_space->TotalCapacity(); new_space->Grow(); new_capacity = new_space->TotalCapacity(); - CHECK(2 * old_capacity == new_capacity); + CHECK_EQ(2 * old_capacity, new_capacity); old_capacity = new_space->TotalCapacity(); - FillUpNewSpace(new_space); + { + v8::HandleScope temporary_scope(CcTest::isolate()); + heap::SimulateFullSpace(new_space); + } new_capacity = new_space->TotalCapacity(); - CHECK(old_capacity == new_capacity); + CHECK_EQ(old_capacity, new_capacity); // Explicitly shrinking should not affect space capacity. old_capacity = new_space->TotalCapacity(); new_space->Shrink(); new_capacity = new_space->TotalCapacity(); - CHECK(old_capacity == new_capacity); + CHECK_EQ(old_capacity, new_capacity); // Let the scavenger empty the new space. - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK_LE(new_space->Size(), old_capacity); // Explicitly shrinking should halve the space capacity. old_capacity = new_space->TotalCapacity(); new_space->Shrink(); new_capacity = new_space->TotalCapacity(); - CHECK(old_capacity == 2 * new_capacity); + CHECK_EQ(old_capacity, 2 * new_capacity); // Consecutive shrinking should not affect space capacity. old_capacity = new_space->TotalCapacity(); @@ -2400,10 +2405,9 @@ TEST(GrowAndShrinkNewSpace) { new_space->Shrink(); new_space->Shrink(); new_capacity = new_space->TotalCapacity(); - CHECK(old_capacity == new_capacity); + CHECK_EQ(old_capacity, new_capacity); } - TEST(CollectingAllAvailableGarbageShrinksNewSpace) { CcTest::InitializeVM(); Heap* heap = CcTest::heap(); @@ -2417,14 +2421,16 @@ TEST(CollectingAllAvailableGarbageShrinksNewSpace) { old_capacity = new_space->TotalCapacity(); new_space->Grow(); new_capacity = new_space->TotalCapacity(); - CHECK(2 * old_capacity == new_capacity); - FillUpNewSpace(new_space); - heap->CollectAllAvailableGarbage(); + CHECK_EQ(2 * old_capacity, new_capacity); + { + v8::HandleScope temporary_scope(CcTest::isolate()); + heap::SimulateFullSpace(new_space); + } + CcTest::CollectAllAvailableGarbage(); new_capacity = new_space->TotalCapacity(); - CHECK(old_capacity == new_capacity); + CHECK_EQ(old_capacity, new_capacity); } - static int NumberOfGlobalObjects() { int count = 0; HeapIterator iterator(CcTest::heap()); @@ -2450,7 +2456,7 @@ TEST(LeakNativeContextViaMap) { v8::Local<v8::Context>::New(isolate, ctx1p)->Enter(); } - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(2, NumberOfGlobalObjects()); { @@ -2476,10 +2482,10 @@ TEST(LeakNativeContextViaMap) { ctx1p.Reset(); isolate->ContextDisposedNotification(); } - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(1, NumberOfGlobalObjects()); ctx2p.Reset(); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); } @@ -2499,7 +2505,7 @@ TEST(LeakNativeContextViaFunction) { v8::Local<v8::Context>::New(isolate, ctx1p)->Enter(); } - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(2, NumberOfGlobalObjects()); { @@ -2525,10 +2531,10 @@ TEST(LeakNativeContextViaFunction) { ctx1p.Reset(); isolate->ContextDisposedNotification(); } - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(1, NumberOfGlobalObjects()); ctx2p.Reset(); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); } @@ -2546,7 +2552,7 @@ TEST(LeakNativeContextViaMapKeyed) { v8::Local<v8::Context>::New(isolate, ctx1p)->Enter(); } - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(2, NumberOfGlobalObjects()); { @@ -2572,10 +2578,10 @@ TEST(LeakNativeContextViaMapKeyed) { ctx1p.Reset(); isolate->ContextDisposedNotification(); } - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(1, NumberOfGlobalObjects()); ctx2p.Reset(); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); } @@ -2593,7 +2599,7 @@ TEST(LeakNativeContextViaMapProto) { v8::Local<v8::Context>::New(isolate, ctx1p)->Enter(); } - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(2, NumberOfGlobalObjects()); { @@ -2623,10 +2629,10 @@ TEST(LeakNativeContextViaMapProto) { ctx1p.Reset(); isolate->ContextDisposedNotification(); } - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(1, NumberOfGlobalObjects()); ctx2p.Reset(); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(0, NumberOfGlobalObjects()); } @@ -2657,7 +2663,8 @@ TEST(InstanceOfStubWriteBarrier) { IncrementalMarking* marking = CcTest::heap()->incremental_marking(); marking->Stop(); - CcTest::heap()->StartIncrementalMarking(); + CcTest::heap()->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); i::Handle<JSFunction> f = i::Handle<JSFunction>::cast( v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( @@ -2669,7 +2676,8 @@ TEST(InstanceOfStubWriteBarrier) { !marking->IsStopped()) { // Discard any pending GC requests otherwise we will get GC when we enter // code below. - marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); + marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, + IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); } CHECK(marking->IsMarking()); @@ -2683,7 +2691,7 @@ TEST(InstanceOfStubWriteBarrier) { } CcTest::heap()->incremental_marking()->set_should_hurry(true); - CcTest::heap()->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); } namespace { @@ -2716,6 +2724,8 @@ TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { " return s;" "}" "f(); f();" + "%BaselineFunctionOnNextCall(f);" + "f(); f();" "%OptimizeFunctionOnNextCall(f);" "f();"); } @@ -2727,11 +2737,12 @@ TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) { // Make sure incremental marking it not running. CcTest::heap()->incremental_marking()->Stop(); - CcTest::heap()->StartIncrementalMarking(); + CcTest::heap()->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); // The following calls will increment CcTest::heap()->global_ic_age(). CcTest::isolate()->ContextDisposedNotification(); heap::SimulateIncrementalMarking(CcTest::heap()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); CHECK_EQ(0, f->shared()->opt_count()); @@ -2760,6 +2771,8 @@ TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { " return s;" "}" "f(); f();" + "%BaselineFunctionOnNextCall(f);" + "f(); f();" "%OptimizeFunctionOnNextCall(f);" "f();"); } @@ -2773,7 +2786,7 @@ TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) { // The following two calls will increment CcTest::heap()->global_ic_age(). CcTest::isolate()->ContextDisposedNotification(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(CcTest::heap()->global_ic_age(), f->shared()->ic_age()); CHECK_EQ(0, f->shared()->opt_count()); @@ -2790,7 +2803,7 @@ HEAP_TEST(GCFlags) { // Set the flags to check whether we appropriately resets them after the GC. heap->set_current_gc_flags(Heap::kAbortIncrementalMarkingMask); - heap->CollectAllGarbage(Heap::kReduceMemoryFootprintMask); + CcTest::CollectAllGarbage(Heap::kReduceMemoryFootprintMask); CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_); MarkCompactCollector* collector = heap->mark_compact_collector(); @@ -2800,14 +2813,15 @@ HEAP_TEST(GCFlags) { IncrementalMarking* marking = heap->incremental_marking(); marking->Stop(); - heap->StartIncrementalMarking(Heap::kReduceMemoryFootprintMask); + heap->StartIncrementalMarking(Heap::kReduceMemoryFootprintMask, + i::GarbageCollectionReason::kTesting); CHECK_NE(0, heap->current_gc_flags_ & Heap::kReduceMemoryFootprintMask); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); // NewSpace scavenges should not overwrite the flags. CHECK_NE(0, heap->current_gc_flags_ & Heap::kReduceMemoryFootprintMask); - heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); CHECK_EQ(Heap::kNoGCFlags, heap->current_gc_flags_); } @@ -2819,7 +2833,8 @@ TEST(IdleNotificationFinishMarking) { heap::SimulateFullSpace(CcTest::heap()->old_space()); IncrementalMarking* marking = CcTest::heap()->incremental_marking(); marking->Stop(); - CcTest::heap()->StartIncrementalMarking(); + CcTest::heap()->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); CHECK_EQ(CcTest::heap()->gc_count(), initial_gc_count); @@ -2828,14 +2843,12 @@ TEST(IdleNotificationFinishMarking) { // marking delay counter. // Perform a huge incremental marking step but don't complete marking. - intptr_t bytes_processed = 0; do { - bytes_processed = - marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, - IncrementalMarking::FORCE_MARKING, - IncrementalMarking::DO_NOT_FORCE_COMPLETION); + marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, + IncrementalMarking::DO_NOT_FORCE_COMPLETION, StepOrigin::kV8); CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); - } while (bytes_processed); + } while ( + !CcTest::heap()->mark_compact_collector()->marking_deque()->IsEmpty()); // The next invocations of incremental marking are not going to complete // marking @@ -2843,8 +2856,7 @@ TEST(IdleNotificationFinishMarking) { for (size_t i = 0; i < IncrementalMarking::kMaxIdleMarkingDelayCounter - 2; i++) { marking->Step(1 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, - IncrementalMarking::FORCE_MARKING, - IncrementalMarking::DO_NOT_FORCE_COMPLETION); + IncrementalMarking::DO_NOT_FORCE_COMPLETION, StepOrigin::kV8); CHECK(!marking->IsIdleMarkingDelayCounterLimitReached()); } @@ -3344,7 +3356,7 @@ TEST(Regress1465) { CHECK_EQ(transitions_count, transitions_before); heap::SimulateIncrementalMarking(CcTest::heap()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Count number of live transitions after marking. Note that one transition // is left, because 'o' still holds an instance of one transition target. @@ -3408,7 +3420,7 @@ TEST(TransitionArrayShrinksDuringAllocToZero) { "root = new F"); root = GetByName("root"); AddPropertyTo(2, root, "funny"); - CcTest::heap()->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); // Count number of live transitions after marking. Note that one transition // is left, because 'o' still holds an instance of one transition target. @@ -3435,7 +3447,7 @@ TEST(TransitionArrayShrinksDuringAllocToOne) { root = GetByName("root"); AddPropertyTo(2, root, "funny"); - CcTest::heap()->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); // Count number of live transitions after marking. Note that one transition // is left, because 'o' still holds an instance of one transition target. @@ -3462,7 +3474,7 @@ TEST(TransitionArrayShrinksDuringAllocToOnePropertyFound) { root = GetByName("root"); AddPropertyTo(0, root, "prop9"); - CcTest::i_isolate()->heap()->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); // Count number of live transitions after marking. Note that one transition // is left, because 'o' still holds an instance of one transition target. @@ -3528,7 +3540,7 @@ TEST(Regress2143a) { CcTest::heap()->AgeInlineCaches(); // Explicitly request GC to perform final marking step and sweeping. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); Handle<JSReceiver> root = v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast( CcTest::global() @@ -3571,7 +3583,7 @@ TEST(Regress2143b) { CcTest::heap()->AgeInlineCaches(); // Explicitly request GC to perform final marking step and sweeping. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); Handle<JSReceiver> root = v8::Utils::OpenHandle(*v8::Local<v8::Object>::Cast( CcTest::global() @@ -3601,6 +3613,9 @@ TEST(ReleaseOverReservedPages) { i::FLAG_page_promotion = false; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); + // If there's snapshot available, we don't know whether 20 small arrays will + // fit on the initial pages. + if (!isolate->snapshot_available()) return; Factory* factory = isolate->factory(); Heap* heap = isolate->heap(); v8::HandleScope scope(CcTest::isolate()); @@ -3619,17 +3634,14 @@ TEST(ReleaseOverReservedPages) { // Triggering one GC will cause a lot of garbage to be discovered but // even spread across all allocated pages. - heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, - "triggered for preparation"); + CcTest::CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask); CHECK_GE(overall_page_count, old_space->CountTotalPages()); // Triggering subsequent GCs should cause at least half of the pages // to be released to the OS after at most two cycles. - heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, - "triggered by test 1"); + CcTest::CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask); CHECK_GE(overall_page_count, old_space->CountTotalPages()); - heap->CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask, - "triggered by test 2"); + CcTest::CollectAllGarbage(Heap::kFinalizeIncrementalMarkingMask); CHECK_GE(overall_page_count, old_space->CountTotalPages() * 2); // Triggering a last-resort GC should cause all pages to be released to the @@ -3639,7 +3651,7 @@ TEST(ReleaseOverReservedPages) { // first page should be small in order to reduce memory used when the VM // boots, but if the 20 small arrays don't fit on the first page then that's // an indication that it is too small. - heap->CollectAllAvailableGarbage("triggered really hard"); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(initial_page_count, old_space->CountTotalPages()); } @@ -3724,7 +3736,7 @@ TEST(IncrementalMarkingPreservesMonomorphicCallIC) { CHECK(feedback_vector->Get(feedback_helper.slot(slot2))->IsWeakCell()); heap::SimulateIncrementalMarking(CcTest::heap()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(!WeakCell::cast(feedback_vector->Get(feedback_helper.slot(slot1))) ->cleared()); @@ -3781,7 +3793,7 @@ TEST(IncrementalMarkingPreservesMonomorphicConstructor) { CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell()); heap::SimulateIncrementalMarking(CcTest::heap()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(vector->Get(FeedbackVectorSlot(0))->IsWeakCell()); } @@ -3802,7 +3814,7 @@ TEST(IncrementalMarkingPreservesMonomorphicIC) { CheckVectorIC(f, 0, MONOMORPHIC); heap::SimulateIncrementalMarking(CcTest::heap()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CheckVectorIC(f, 0, MONOMORPHIC); } @@ -3839,7 +3851,7 @@ TEST(IncrementalMarkingPreservesPolymorphicIC) { // Fire context dispose notification. heap::SimulateIncrementalMarking(CcTest::heap()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CheckVectorIC(f, 0, POLYMORPHIC); } @@ -3877,7 +3889,7 @@ TEST(ContextDisposeDoesntClearPolymorphicIC) { // Fire context dispose notification. CcTest::isolate()->ContextDisposedNotification(); heap::SimulateIncrementalMarking(CcTest::heap()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CheckVectorIC(f, 0, POLYMORPHIC); } @@ -3919,7 +3931,8 @@ void ReleaseStackTraceDataTest(v8::Isolate* isolate, const char* source, v8::Local<v8::Context> ctx = isolate->GetCurrentContext(); v8::Local<v8::String> source_string = v8::String::NewExternalOneByte(isolate, resource).ToLocalChecked(); - i_isolate->heap()->CollectAllAvailableGarbage(); + i_isolate->heap()->CollectAllAvailableGarbage( + i::GarbageCollectionReason::kTesting); v8::Script::Compile(ctx, source_string) .ToLocalChecked() ->Run(ctx) @@ -3930,7 +3943,8 @@ void ReleaseStackTraceDataTest(v8::Isolate* isolate, const char* source, CHECK(!resource->IsDisposed()); CompileRun(accessor); - i_isolate->heap()->CollectAllAvailableGarbage(); + i_isolate->heap()->CollectAllAvailableGarbage( + i::GarbageCollectionReason::kTesting); // External source has been released. CHECK(resource->IsDisposed()); @@ -4006,7 +4020,7 @@ TEST(Regress159140) { HandleScope scope(isolate); // Perform one initial GC to enable code flushing. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Prepare several closures that are all eligible for code flushing // because all reachable ones are not optimized. Make sure that the @@ -4050,7 +4064,7 @@ TEST(Regress159140) { // finish the GC to complete code flushing. heap::SimulateIncrementalMarking(heap); CompileRun("%OptimizeFunctionOnNextCall(g); g(3);"); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Unoptimized code is missing and the deoptimizer will go ballistic. CompileRun("g('bozo');"); @@ -4065,7 +4079,7 @@ TEST(Regress165495) { HandleScope scope(isolate); // Perform one initial GC to enable code flushing. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Prepare an optimized closure that the optimized code map will get // populated. Then age the unoptimized code to trigger code flushing @@ -4095,7 +4109,7 @@ TEST(Regress165495) { // Simulate incremental marking so that unoptimized code is flushed // even though it still is cached in the optimized code map. heap::SimulateIncrementalMarking(heap); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Make a new closure that will get code installed from the code map. // Unoptimized code is missing and the deoptimizer will go ballistic. @@ -4113,7 +4127,7 @@ TEST(Regress169209) { HandleScope scope(isolate); // Perform one initial GC to enable code flushing. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Prepare a shared function info eligible for code flushing for which // the unoptimized code will be replaced during optimization. @@ -4170,7 +4184,7 @@ TEST(Regress169209) { "g(false);"); // Finish garbage collection cycle. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(shared1->code()->gc_metadata() == NULL); } @@ -4211,7 +4225,7 @@ TEST(Regress169928) { .FromJust()); // First make sure we flip spaces - CcTest::heap()->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); // Allocate the object. Handle<FixedArray> array_data = factory->NewFixedArray(2, NOT_TENURED); @@ -4321,7 +4335,7 @@ TEST(Regress514122) { HandleScope scope(isolate); // Perfrom one initial GC to enable code flushing. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Prepare function whose optimized code map we can use. Handle<SharedFunctionInfo> shared; @@ -4399,7 +4413,7 @@ TEST(Regress514122) { } // Trigger a GC to flush out the bug. - heap->CollectGarbage(i::OLD_SPACE, "fire in the hole"); + CcTest::CollectGarbage(i::OLD_SPACE); boomer->Print(); } @@ -4413,7 +4427,6 @@ TEST(OptimizedCodeMapReuseEntries) { CcTest::InitializeVM(); v8::Isolate* v8_isolate = CcTest::isolate(); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); HandleScope scope(isolate); // Create 3 contexts, allow the 2nd one to be disposed, and verify that @@ -4429,7 +4442,7 @@ TEST(OptimizedCodeMapReuseEntries) { .ToLocalChecked(); const char* toplevel = "foo(3); %OptimizeFunctionOnNextCall(foo); foo(3);"; // Perfrom one initial GC to enable code flushing. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); c1->Enter(); indep->BindToCurrentContext()->Run(c1).ToLocalChecked(); @@ -4463,7 +4476,7 @@ TEST(OptimizedCodeMapReuseEntries) { // Now, collect garbage. Context c2 should have no roots to it, and it's // entry in the optimized code map should be free for a new context. for (int i = 0; i < 4; i++) { - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } Handle<FixedArray> optimized_code_map = @@ -4518,11 +4531,10 @@ TEST(Regress513496) { i::FLAG_allow_natives_syntax = true; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); HandleScope scope(isolate); // Perfrom one initial GC to enable code flushing. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Prepare an optimized closure with containing an inlined function. Then age // the inlined unoptimized code to trigger code flushing but make sure the @@ -4566,7 +4578,7 @@ TEST(Regress513496) { // Finish a full GC cycle so that the unoptimized code of 'g' is flushed even // though the optimized code for 'f' is reachable via the optimized code map. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Make a new closure that will get code installed from the code map. // Unoptimized code is missing and the deoptimizer will go ballistic. @@ -4589,15 +4601,16 @@ TEST(LargeObjectSlotRecording) { FixedArray* old_location = *lit; // Allocate a large object. - int size = Max(1000000, Page::kMaxRegularHeapObjectSize + KB); - CHECK(size > Page::kMaxRegularHeapObjectSize); + int size = Max(1000000, kMaxRegularHeapObjectSize + KB); + CHECK(size > kMaxRegularHeapObjectSize); Handle<FixedArray> lo = isolate->factory()->NewFixedArray(size, TENURED); CHECK(heap->lo_space()->Contains(*lo)); // Start incremental marking to active write barrier. heap::SimulateIncrementalMarking(heap, false); heap->incremental_marking()->AdvanceIncrementalMarking( - 10000000, IncrementalMarking::IdleStepActions()); + 10000000, IncrementalMarking::NO_GC_VIA_STACK_GUARD, + IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); // Create references from the large object to the object on the evacuation // candidate. @@ -4608,7 +4621,7 @@ TEST(LargeObjectSlotRecording) { } // Move the evaucation candidate object. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Verify that the pointers in the large object got updated. for (int i = 0; i < size; i += kStep) { @@ -4655,10 +4668,12 @@ TEST(IncrementalMarkingStepMakesBigProgressWithLargeObjects) { "f(10 * 1024 * 1024);"); IncrementalMarking* marking = CcTest::heap()->incremental_marking(); if (marking->IsStopped()) { - CcTest::heap()->StartIncrementalMarking(); + CcTest::heap()->StartIncrementalMarking( + i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting); } // This big step should be sufficient to mark the whole array. - marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); + marking->Step(100 * MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, + IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); CHECK(marking->IsComplete() || marking->IsReadyToOverApproximateWeakClosure()); } @@ -4765,7 +4780,7 @@ TEST(EnsureAllocationSiteDependentCodesProcessed) { // Now make sure that a gc should get rid of the function, even though we // still have the allocation site alive. for (int i = 0; i < 4; i++) { - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } // The site still exists because of our global handle, but the code is no @@ -4813,7 +4828,7 @@ TEST(CellsInOptimizedCodeAreWeak) { // Now make sure that a gc should get rid of the function for (int i = 0; i < 4; i++) { - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } CHECK(code->marked_for_deoptimization()); @@ -4856,7 +4871,7 @@ TEST(ObjectsInOptimizedCodeAreWeak) { // Now make sure that a gc should get rid of the function for (int i = 0; i < 4; i++) { - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } CHECK(code->marked_for_deoptimization()); @@ -4906,8 +4921,8 @@ TEST(NewSpaceObjectsInOptimizedCode) { .ToLocalChecked()))); CHECK(heap->InNewSpace(*foo)); - heap->CollectGarbage(NEW_SPACE); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK(!heap->InNewSpace(*foo)); #ifdef VERIFY_HEAP heap->Verify(); @@ -4918,7 +4933,7 @@ TEST(NewSpaceObjectsInOptimizedCode) { // Now make sure that a gc should get rid of the function for (int i = 0; i < 4; i++) { - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } CHECK(code->marked_for_deoptimization()); @@ -4941,7 +4956,7 @@ TEST(NoWeakHashTableLeakWithIncrementalMarking) { // Get a clean slate regarding optimized functions on the heap. i::Deoptimizer::DeoptimizeAll(isolate); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); if (!isolate->use_crankshaft()) return; HandleScope outer_scope(heap->isolate()); @@ -4965,7 +4980,7 @@ TEST(NoWeakHashTableLeakWithIncrementalMarking) { CompileRun(source.start()); } // We have to abort incremental marking here to abandon black pages. - heap->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); } int elements = 0; if (heap->weak_object_to_code_table()->IsHashTable()) { @@ -5014,7 +5029,7 @@ TEST(NextCodeLinkIsWeak) { if (!isolate->use_crankshaft()) return; HandleScope outer_scope(heap->isolate()); Handle<Code> code; - heap->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); int code_chain_length_before, code_chain_length_after; { HandleScope scope(heap->isolate()); @@ -5028,7 +5043,7 @@ TEST(NextCodeLinkIsWeak) { code = scope.CloseAndEscape(Handle<Code>(immortal->code())); CompileRun("mortal = null; immortal = null;"); } - heap->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); // Now mortal code should be dead. code_chain_length_after = GetCodeChainLength(*code); CHECK_EQ(code_chain_length_before - 1, code_chain_length_after); @@ -5059,7 +5074,7 @@ TEST(NextCodeLinkIsWeak2) { if (!isolate->use_crankshaft()) return; HandleScope outer_scope(heap->isolate()); - heap->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); Handle<Context> context(Context::cast(heap->native_contexts_list()), isolate); Handle<Code> new_head; Handle<Object> old_head(context->get(Context::OPTIMIZED_CODE_LIST), isolate); @@ -5072,7 +5087,7 @@ TEST(NextCodeLinkIsWeak2) { context->set(Context::OPTIMIZED_CODE_LIST, *immortal); new_head = scope.CloseAndEscape(immortal); } - heap->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); // Now mortal code should be dead. CHECK_EQ(*old_head, new_head->next_code_link()); } @@ -5122,8 +5137,7 @@ TEST(WeakFunctionInConstructor) { } weak_ic_cleared = false; garbage.SetWeak(&garbage, &ClearWeakIC, v8::WeakCallbackType::kParameter); - Heap* heap = CcTest::i_isolate()->heap(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(weak_ic_cleared); // We've determined the constructor in createObj has had it's weak cell @@ -5135,7 +5149,7 @@ TEST(WeakFunctionInConstructor) { Object* slot_value = feedback_vector->Get(FeedbackVectorSlot(0)); CHECK(slot_value->IsWeakCell()); if (WeakCell::cast(slot_value)->cleared()) break; - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } Object* slot_value = feedback_vector->Get(FeedbackVectorSlot(0)); @@ -5165,8 +5179,7 @@ void CheckWeakness(const char* source) { } weak_ic_cleared = false; garbage.SetWeak(&garbage, &ClearWeakIC, v8::WeakCallbackType::kParameter); - Heap* heap = CcTest::i_isolate()->heap(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(weak_ic_cleared); } @@ -5360,7 +5373,6 @@ TEST(MonomorphicStaysMonomorphicAfterGC) { if (FLAG_always_opt) return; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); v8::HandleScope scope(CcTest::isolate()); CompileRun( "function loadIC(obj) {" @@ -5379,7 +5391,7 @@ TEST(MonomorphicStaysMonomorphicAfterGC) { v8::HandleScope scope(CcTest::isolate()); CompileRun("(testIC())"); } - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CheckIC(loadIC, Code::LOAD_IC, 0, MONOMORPHIC); { v8::HandleScope scope(CcTest::isolate()); @@ -5393,7 +5405,6 @@ TEST(PolymorphicStaysPolymorphicAfterGC) { if (FLAG_always_opt) return; CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); v8::HandleScope scope(CcTest::isolate()); CompileRun( "function loadIC(obj) {" @@ -5415,7 +5426,7 @@ TEST(PolymorphicStaysPolymorphicAfterGC) { v8::HandleScope scope(CcTest::isolate()); CompileRun("(testIC())"); } - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CheckIC(loadIC, Code::LOAD_IC, 0, POLYMORPHIC); { v8::HandleScope scope(CcTest::isolate()); @@ -5428,7 +5439,6 @@ TEST(PolymorphicStaysPolymorphicAfterGC) { TEST(WeakCell) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - v8::internal::Heap* heap = CcTest::heap(); v8::internal::Factory* factory = isolate->factory(); HandleScope outer_scope(isolate); @@ -5447,13 +5457,13 @@ TEST(WeakCell) { } CHECK(weak_cell1->value()->IsFixedArray()); CHECK_EQ(*survivor, weak_cell2->value()); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK(weak_cell1->value()->IsFixedArray()); CHECK_EQ(*survivor, weak_cell2->value()); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK(weak_cell1->value()->IsFixedArray()); CHECK_EQ(*survivor, weak_cell2->value()); - heap->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK(weak_cell1->cleared()); CHECK_EQ(*survivor, weak_cell2->value()); } @@ -5478,17 +5488,19 @@ TEST(WeakCellsWithIncrementalMarking) { CHECK(weak_cell->value()->IsFixedArray()); IncrementalMarking* marking = heap->incremental_marking(); if (marking->IsStopped()) { - heap->StartIncrementalMarking(); + heap->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); } - marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD); - heap->CollectGarbage(NEW_SPACE); + marking->Step(128, IncrementalMarking::NO_GC_VIA_STACK_GUARD, + IncrementalMarking::FORCE_COMPLETION, 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. - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(*survivor, weak_cells[0]->value()); for (int i = 1; i < N; i++) { CHECK(weak_cells[i]->cleared()); @@ -5535,7 +5547,7 @@ TEST(AddInstructionChangesNewSpacePromotion) { heap->DisableInlineAllocation(); heap->set_allocation_timeout(1); g->Call(env.local(), global, 1, args1).ToLocalChecked(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -5570,13 +5582,12 @@ static void RequestInterrupt(const v8::FunctionCallbackInfo<v8::Value>& args) { CcTest::isolate()->RequestInterrupt(&InterruptCallback357137, NULL); } - -UNINITIALIZED_TEST(Regress538257) { +HEAP_TEST(Regress538257) { i::FLAG_manual_evacuation_candidates_selection = true; v8::Isolate::CreateParams create_params; // Set heap limits. - create_params.constraints.set_max_semi_space_size(1 * Page::kPageSize / MB); - create_params.constraints.set_max_old_space_size(6 * Page::kPageSize / MB); + create_params.constraints.set_max_semi_space_size(1); + create_params.constraints.set_max_old_space_size(6); create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); v8::Isolate* isolate = v8::Isolate::New(create_params); isolate->Enter(); @@ -5596,7 +5607,8 @@ UNINITIALIZED_TEST(Regress538257) { ->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); } heap::SimulateFullSpace(old_space); - heap->CollectGarbage(OLD_SPACE); + heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, + i::GarbageCollectionReason::kTesting); // If we get this far, we've successfully aborted compaction. Any further // allocations might trigger OOM. } @@ -5692,8 +5704,8 @@ UNINITIALIZED_TEST(PromotionQueue) { CHECK(i::FLAG_min_semi_space_size * MB == new_space->TotalCapacity()); // Call the scavenger two times to get an empty new space - heap->CollectGarbage(NEW_SPACE); - heap->CollectGarbage(NEW_SPACE); + heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting); + heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting); // First create a few objects which will survive a scavenge, and will get // promoted to the old generation later on. These objects will create @@ -5704,7 +5716,7 @@ UNINITIALIZED_TEST(PromotionQueue) { handles[i] = i_isolate->factory()->NewFixedArray(1, NOT_TENURED); } - heap->CollectGarbage(NEW_SPACE); + heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting); CHECK(i::FLAG_min_semi_space_size * MB == new_space->TotalCapacity()); // Fill-up the first semi-space page. @@ -5721,7 +5733,7 @@ UNINITIALIZED_TEST(PromotionQueue) { // This scavenge will corrupt memory if the promotion queue is not // evacuated. - heap->CollectGarbage(NEW_SPACE); + heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting); } isolate->Dispose(); } @@ -5764,7 +5776,8 @@ TEST(Regress388880) { // that would cause crash. IncrementalMarking* marking = CcTest::heap()->incremental_marking(); marking->Stop(); - CcTest::heap()->StartIncrementalMarking(); + CcTest::heap()->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); CHECK(marking->IsMarking()); // Now everything is set up for crashing in JSObject::MigrateFastToFast() @@ -5790,7 +5803,8 @@ TEST(Regress3631) { "}" "weak_map"); if (marking->IsStopped()) { - CcTest::heap()->StartIncrementalMarking(); + CcTest::heap()->StartIncrementalMarking( + i::Heap::kNoGCFlags, i::GarbageCollectionReason::kTesting); } // Incrementally mark the backing store. Handle<JSReceiver> obj = @@ -5799,7 +5813,8 @@ TEST(Regress3631) { while (!Marking::IsBlack( ObjectMarking::MarkBitFrom(HeapObject::cast(weak_map->table()))) && !marking->IsStopped()) { - marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD); + marking->Step(MB, IncrementalMarking::NO_GC_VIA_STACK_GUARD, + IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); } // Stash the backing store in a handle. Handle<Object> save(weak_map->table(), isolate); @@ -5809,14 +5824,13 @@ TEST(Regress3631) { " weak_map.set(future_keys[i], i);" "}"); heap->incremental_marking()->set_should_hurry(true); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); } TEST(Regress442710) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); Factory* factory = isolate->factory(); HandleScope sc(isolate); @@ -5827,7 +5841,7 @@ TEST(Regress442710) { Handle<String> name = factory->InternalizeUtf8String("testArray"); JSReceiver::SetProperty(global, name, array, SLOPPY).Check(); CompileRun("testArray[0] = 1; testArray[1] = 2; testArray.shift();"); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); } @@ -5845,7 +5859,6 @@ HEAP_TEST(NumberStringCacheSize) { TEST(Regress3877) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); Factory* factory = isolate->factory(); HandleScope scope(isolate); CompileRun("function cls() { this.x = 10; }"); @@ -5863,14 +5876,14 @@ TEST(Regress3877) { "a.x = new cls();" "cls.prototype = null;"); for (int i = 0; i < 4; i++) { - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } // The map of a.x keeps prototype alive CHECK(!weak_prototype->cleared()); // Change the map of a.x and make the previous map garbage collectable. CompileRun("a.x.__proto__ = {};"); for (int i = 0; i < 4; i++) { - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } CHECK(weak_prototype->cleared()); } @@ -5897,11 +5910,11 @@ void CheckMapRetainingFor(int n) { CHECK(!weak_cell->cleared()); for (int i = 0; i < n; i++) { heap::SimulateIncrementalMarking(heap); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); } CHECK(!weak_cell->cleared()); heap::SimulateIncrementalMarking(heap); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); CHECK(weak_cell->cleared()); } @@ -5926,14 +5939,14 @@ TEST(RegressArrayListGC) { Heap* heap = isolate->heap(); AddRetainedMap(isolate, heap); Handle<Map> map = Map::Create(isolate, 1); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); // Force GC in old space on next addition of retained map. Map::WeakCellForMap(map); heap::SimulateFullSpace(CcTest::heap()->new_space()); for (int i = 0; i < 10; i++) { heap->AddRetainedMap(map); } - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); } @@ -5984,7 +5997,7 @@ static void TestRightTrimFixedTypedArray(i::ExternalArrayType type, Address next_obj_address = array->address() + array->size(); CHECK(HeapObject::FromAddress(next_obj_address)->IsFiller()); } - heap->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); } @@ -6041,7 +6054,7 @@ TEST(PreprocessStackTrace) { Object::GetElement(isolate, stack_trace, 3).ToHandleChecked(); CHECK(code->IsCode()); - isolate->heap()->CollectAllAvailableGarbage("stack trace preprocessing"); + CcTest::CollectAllAvailableGarbage(); Handle<Object> pos = Object::GetElement(isolate, stack_trace, 3).ToHandleChecked(); @@ -6094,7 +6107,7 @@ TEST(BootstrappingExports) { utils.SetWeak(&utils, UtilsHasBeenCollected, v8::WeakCallbackType::kParameter); - CcTest::heap()->CollectAllAvailableGarbage("fire weak callbacks"); + CcTest::CollectAllAvailableGarbage(); CHECK(utils_has_been_collected); } @@ -6152,12 +6165,12 @@ TEST(NewSpaceAllocationCounter) { Isolate* isolate = CcTest::i_isolate(); Heap* heap = isolate->heap(); size_t counter1 = heap->NewSpaceAllocationCounter(); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); const size_t kSize = 1024; AllocateInSpace(isolate, kSize, NEW_SPACE); size_t counter2 = heap->NewSpaceAllocationCounter(); CHECK_EQ(kSize, counter2 - counter1); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); size_t counter3 = heap->NewSpaceAllocationCounter(); CHECK_EQ(0U, counter3 - counter2); // Test counter overflow. @@ -6179,23 +6192,24 @@ TEST(OldSpaceAllocationCounter) { Isolate* isolate = CcTest::i_isolate(); Heap* heap = isolate->heap(); size_t counter1 = heap->OldGenerationAllocationCounter(); - heap->CollectGarbage(NEW_SPACE); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); const size_t kSize = 1024; AllocateInSpace(isolate, kSize, OLD_SPACE); size_t counter2 = heap->OldGenerationAllocationCounter(); // TODO(ulan): replace all CHECK_LE with CHECK_EQ after v8:4148 is fixed. CHECK_LE(kSize, counter2 - counter1); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); size_t counter3 = heap->OldGenerationAllocationCounter(); CHECK_EQ(0u, counter3 - counter2); AllocateInSpace(isolate, kSize, OLD_SPACE); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); size_t counter4 = heap->OldGenerationAllocationCounter(); CHECK_LE(kSize, counter4 - counter3); // Test counter overflow. size_t max_counter = -1; - heap->set_old_generation_allocation_counter(max_counter - 10 * kSize); + heap->set_old_generation_allocation_counter_at_last_gc(max_counter - + 10 * kSize); size_t start = heap->OldGenerationAllocationCounter(); for (int i = 0; i < 20; i++) { AllocateInSpace(isolate, kSize, OLD_SPACE); @@ -6265,7 +6279,7 @@ static void RemoveCodeAndGC(const v8::FunctionCallbackInfo<v8::Value>& args) { fun->ReplaceCode(*isolate->builtins()->CompileLazy()); fun->shared()->ReplaceCode(*isolate->builtins()->CompileLazy()); fun->shared()->ClearBytecodeArray(); // Bytecode is code too. - isolate->heap()->CollectAllAvailableGarbage("remove code and gc"); + CcTest::CollectAllAvailableGarbage(); } @@ -6352,7 +6366,7 @@ TEST(ScriptIterator) { Heap* heap = CcTest::heap(); LocalContext context; - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); int script_count = 0; { @@ -6378,8 +6392,8 @@ TEST(SharedFunctionInfoIterator) { Heap* heap = CcTest::heap(); LocalContext context; - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); int sfi_count = 0; { @@ -6419,7 +6433,7 @@ TEST(Regress519319) { child.Reset(isolate, v8::Object::New(isolate)); heap::SimulateFullSpace(heap->old_space()); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); { UniqueId id = MakeUniqueId(parent); isolate->SetObjectGroupId(parent, id); @@ -6428,8 +6442,10 @@ TEST(Regress519319) { // The CollectGarbage call above starts sweeper threads. // The crash will happen if the following two functions // are called before sweeping finishes. - heap->StartIncrementalMarking(); - heap->FinalizeIncrementalMarkingIfComplete("test"); + heap->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); + heap->FinalizeIncrementalMarkingIfComplete( + i::GarbageCollectionReason::kTesting); } @@ -6467,8 +6483,8 @@ HEAP_TEST(Regress587004) { Heap* heap = CcTest::heap(); Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - const int N = (Page::kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / - kPointerSize; + const int N = + (kMaxRegularHeapObjectSize - FixedArray::kHeaderSize) / kPointerSize; Handle<FixedArray> array = factory->NewFixedArray(N, TENURED); CHECK(heap->old_space()->Contains(*array)); Handle<Object> number = factory->NewHeapNumber(1.0); @@ -6476,7 +6492,7 @@ HEAP_TEST(Regress587004) { for (int i = 0; i < N; i++) { array->set(i, *number); } - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); heap::SimulateFullSpace(heap->old_space()); heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*array, N - 1); heap->mark_compact_collector()->EnsureSweepingCompleted(); @@ -6492,7 +6508,7 @@ HEAP_TEST(Regress587004) { } // Re-enable old space expansion to avoid OOM crash. heap->set_force_oom(false); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); } HEAP_TEST(Regress589413) { @@ -6504,8 +6520,8 @@ HEAP_TEST(Regress589413) { v8::HandleScope scope(CcTest::isolate()); Heap* heap = CcTest::heap(); // Get the heap in clean state. - heap->CollectGarbage(OLD_SPACE); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); // Fill the new space with byte arrays with elements looking like pointers. @@ -6519,7 +6535,7 @@ HEAP_TEST(Regress589413) { handle(byte_array); } // Make sure the byte arrays will be promoted on the next GC. - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); // This number is close to large free list category threshold. const int N = 0x3eee; { @@ -6567,7 +6583,7 @@ HEAP_TEST(Regress589413) { } // Force allocation from the free list. heap->set_force_oom(true); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); } TEST(Regress598319) { @@ -6579,7 +6595,7 @@ TEST(Regress598319) { Heap* heap = CcTest::heap(); Isolate* isolate = heap->isolate(); - const int kNumberOfObjects = Page::kMaxRegularHeapObjectSize / kPointerSize; + const int kNumberOfObjects = kMaxRegularHeapObjectSize / kPointerSize; struct Arr { Arr(Isolate* isolate, int number_of_objects) { @@ -6608,7 +6624,7 @@ TEST(Regress598319) { CHECK_NOT_NULL(page); // GC to cleanup state - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); MarkCompactCollector* collector = heap->mark_compact_collector(); if (collector->sweeping_in_progress()) { collector->EnsureSweepingCompleted(); @@ -6625,7 +6641,8 @@ TEST(Regress598319) { IncrementalMarking* marking = heap->incremental_marking(); CHECK(marking->IsMarking() || marking->IsStopped()); if (marking->IsStopped()) { - heap->StartIncrementalMarking(); + heap->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); } CHECK(marking->IsMarking()); @@ -6638,7 +6655,8 @@ TEST(Regress598319) { // Now we search for a state where we are in incremental marking and have // only partially marked the large object. while (!marking->IsComplete()) { - marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); + marking->Step(i::KB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, + IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); if (page->IsFlagSet(Page::HAS_PROGRESS_BAR) && page->progress_bar() > 0) { CHECK_NE(page->progress_bar(), arr.get()->Size()); { @@ -6655,7 +6673,8 @@ TEST(Regress598319) { // Finish marking with bigger steps to speed up test. while (!marking->IsComplete()) { - marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); + marking->Step(10 * i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, + IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); if (marking->IsReadyToOverApproximateWeakClosure()) { marking->FinalizeIncrementally(); } @@ -6689,7 +6708,7 @@ TEST(Regress615489) { v8::HandleScope scope(CcTest::isolate()); Heap* heap = CcTest::heap(); Isolate* isolate = heap->isolate(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); i::MarkCompactCollector* collector = heap->mark_compact_collector(); i::IncrementalMarking* marking = heap->incremental_marking(); @@ -6698,7 +6717,8 @@ TEST(Regress615489) { } CHECK(marking->IsMarking() || marking->IsStopped()); if (marking->IsStopped()) { - heap->StartIncrementalMarking(); + heap->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); } CHECK(marking->IsMarking()); marking->StartBlackAllocationForTesting(); @@ -6708,14 +6728,15 @@ TEST(Regress615489) { isolate->factory()->NewFixedArray(500, TENURED)->Size(); } while (!marking->IsComplete()) { - marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); + marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, + IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); if (marking->IsReadyToOverApproximateWeakClosure()) { marking->FinalizeIncrementally(); } } CHECK(marking->IsComplete()); intptr_t size_before = heap->SizeOfObjects(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); intptr_t size_after = heap->SizeOfObjects(); // Live size does not increase after garbage collection. CHECK_LE(size_after, size_before); @@ -6743,8 +6764,8 @@ TEST(Regress631969) { v8::HandleScope scope(CcTest::isolate()); Heap* heap = CcTest::heap(); // Get the heap in clean state. - heap->CollectGarbage(OLD_SPACE); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); // Allocate two strings in a fresh page and mark the page as evacuation @@ -6761,13 +6782,14 @@ TEST(Regress631969) { heap::SimulateFullSpace(heap->old_space()); Handle<String> s3; factory->NewConsString(s1, s2).ToHandle(&s3); - heap->CollectGarbage(NEW_SPACE); - heap->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); // Finish incremental marking. IncrementalMarking* marking = heap->incremental_marking(); while (!marking->IsComplete()) { - marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); + marking->Step(MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, + IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); if (marking->IsReadyToOverApproximateWeakClosure()) { marking->FinalizeIncrementally(); } @@ -6776,7 +6798,7 @@ TEST(Regress631969) { { StaticOneByteResource external_string("12345678901234"); s3->MakeExternal(&external_string); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); } } @@ -6786,7 +6808,7 @@ TEST(LeftTrimFixedArrayInBlackArea) { v8::HandleScope scope(CcTest::isolate()); Heap* heap = CcTest::heap(); Isolate* isolate = heap->isolate(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); i::MarkCompactCollector* collector = heap->mark_compact_collector(); i::IncrementalMarking* marking = heap->incremental_marking(); @@ -6795,7 +6817,8 @@ TEST(LeftTrimFixedArrayInBlackArea) { } CHECK(marking->IsMarking() || marking->IsStopped()); if (marking->IsStopped()) { - heap->StartIncrementalMarking(); + heap->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); } CHECK(marking->IsMarking()); marking->StartBlackAllocationForTesting(); @@ -6823,7 +6846,7 @@ TEST(ContinuousLeftTrimFixedArrayInBlackArea) { v8::HandleScope scope(CcTest::isolate()); Heap* heap = CcTest::heap(); Isolate* isolate = heap->isolate(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); i::MarkCompactCollector* collector = heap->mark_compact_collector(); i::IncrementalMarking* marking = heap->incremental_marking(); @@ -6832,7 +6855,8 @@ TEST(ContinuousLeftTrimFixedArrayInBlackArea) { } CHECK(marking->IsMarking() || marking->IsStopped()); if (marking->IsStopped()) { - heap->StartIncrementalMarking(); + heap->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); } CHECK(marking->IsMarking()); marking->StartBlackAllocationForTesting(); @@ -6887,7 +6911,7 @@ TEST(ContinuousRightTrimFixedArrayInBlackArea) { v8::HandleScope scope(CcTest::isolate()); Heap* heap = CcTest::heap(); Isolate* isolate = heap->isolate(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); i::MarkCompactCollector* collector = heap->mark_compact_collector(); i::IncrementalMarking* marking = heap->incremental_marking(); @@ -6896,7 +6920,8 @@ TEST(ContinuousRightTrimFixedArrayInBlackArea) { } CHECK(marking->IsMarking() || marking->IsStopped()); if (marking->IsStopped()) { - heap->StartIncrementalMarking(); + heap->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); } CHECK(marking->IsMarking()); marking->StartBlackAllocationForTesting(); @@ -6945,7 +6970,7 @@ TEST(SlotFilteringAfterBlackAreas) { Heap* heap = CcTest::heap(); Isolate* isolate = heap->isolate(); MarkCompactCollector* mark_compact_collector = heap->mark_compact_collector(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); i::MarkCompactCollector* collector = heap->mark_compact_collector(); i::IncrementalMarking* marking = heap->incremental_marking(); @@ -6954,7 +6979,8 @@ TEST(SlotFilteringAfterBlackAreas) { } CHECK(marking->IsMarking() || marking->IsStopped()); if (marking->IsStopped()) { - heap->StartIncrementalMarking(); + heap->StartIncrementalMarking(i::Heap::kNoGCFlags, + i::GarbageCollectionReason::kTesting); } CHECK(marking->IsMarking()); marking->StartBlackAllocationForTesting(); @@ -7014,7 +7040,7 @@ TEST(UncommitUnusedLargeObjectMemory) { array->Shrink(1); CHECK(array->Size() < size_before); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(chunk->CommittedPhysicalMemory() < committed_memory_before); size_t shrinked_size = RoundUp((array->address() - chunk->address()) + array->Size(), diff --git a/deps/v8/test/cctest/heap/test-incremental-marking.cc b/deps/v8/test/cctest/heap/test-incremental-marking.cc index 59697a94a1..c659cecea7 100644 --- a/deps/v8/test/cctest/heap/test-incremental-marking.cc +++ b/deps/v8/test/cctest/heap/test-incremental-marking.cc @@ -31,11 +31,8 @@ namespace internal { class MockPlatform : public v8::Platform { public: explicit MockPlatform(v8::Platform* platform) - : platform_(platform), idle_task_(nullptr), delayed_task_(nullptr) {} - virtual ~MockPlatform() { - delete idle_task_; - delete delayed_task_; - } + : platform_(platform), task_(nullptr) {} + virtual ~MockPlatform() { delete task_; } void CallOnBackgroundThread(Task* task, ExpectedRuntime expected_runtime) override { @@ -43,15 +40,12 @@ class MockPlatform : public v8::Platform { } void CallOnForegroundThread(v8::Isolate* isolate, Task* task) override { - platform_->CallOnForegroundThread(isolate, task); + task_ = task; } void CallDelayedOnForegroundThread(v8::Isolate* isolate, Task* task, double delay_in_seconds) override { - if (delayed_task_ != nullptr) { - delete delayed_task_; - } - delayed_task_ = task; + platform_->CallDelayedOnForegroundThread(isolate, task, delay_in_seconds); } double MonotonicallyIncreasingTime() override { @@ -60,30 +54,21 @@ class MockPlatform : public v8::Platform { void CallIdleOnForegroundThread(v8::Isolate* isolate, IdleTask* task) override { - CHECK(nullptr == idle_task_); - idle_task_ = task; + platform_->CallIdleOnForegroundThread(isolate, task); } bool IdleTasksEnabled(v8::Isolate* isolate) override { return true; } - bool PendingIdleTask() { return idle_task_ != nullptr; } - - void PerformIdleTask(double idle_time_in_seconds) { - IdleTask* task = idle_task_; - idle_task_ = nullptr; - task->Run(MonotonicallyIncreasingTime() + idle_time_in_seconds); - delete task; - } - - bool PendingDelayedTask() { return delayed_task_ != nullptr; } + bool PendingTask() { return task_ != nullptr; } - void PerformDelayedTask() { - Task* task = delayed_task_; - delayed_task_ = nullptr; + void PerformTask() { + Task* task = task_; + task_ = nullptr; task->Run(); delete task; } + using Platform::AddTraceEvent; uint64_t AddTraceEvent(char phase, const uint8_t* categoryEnabledFlag, const char* name, const char* scope, uint64_t id, uint64_t bind_id, int numArgs, const char** argNames, @@ -108,12 +93,10 @@ class MockPlatform : public v8::Platform { private: v8::Platform* platform_; - IdleTask* idle_task_; - Task* delayed_task_; + Task* task_; }; - -TEST(IncrementalMarkingUsingIdleTasks) { +TEST(IncrementalMarkingUsingTasks) { if (!i::FLAG_incremental_marking) return; CcTest::InitializeVM(); v8::Platform* old_platform = i::V8::GetCurrentPlatform(); @@ -122,16 +105,10 @@ TEST(IncrementalMarkingUsingIdleTasks) { i::heap::SimulateFullSpace(CcTest::heap()->old_space()); i::IncrementalMarking* marking = CcTest::heap()->incremental_marking(); marking->Stop(); - marking->Start(); - CHECK(platform.PendingIdleTask()); - const double kLongIdleTimeInSeconds = 1; - const double kShortIdleTimeInSeconds = 0.010; - const int kShortStepCount = 10; - for (int i = 0; i < kShortStepCount && platform.PendingIdleTask(); i++) { - platform.PerformIdleTask(kShortIdleTimeInSeconds); - } - while (platform.PendingIdleTask()) { - platform.PerformIdleTask(kLongIdleTimeInSeconds); + marking->Start(i::GarbageCollectionReason::kTesting); + CHECK(platform.PendingTask()); + while (platform.PendingTask()) { + platform.PerformTask(); } CHECK(marking->IsStopped()); i::V8::SetPlatformForTesting(old_platform); @@ -140,55 +117,25 @@ TEST(IncrementalMarkingUsingIdleTasks) { TEST(IncrementalMarkingUsingIdleTasksAfterGC) { if (!i::FLAG_incremental_marking) return; - CcTest::InitializeVM(); - v8::Platform* old_platform = i::V8::GetCurrentPlatform(); - MockPlatform platform(old_platform); - i::V8::SetPlatformForTesting(&platform); - i::heap::SimulateFullSpace(CcTest::heap()->old_space()); - CcTest::heap()->CollectAllGarbage(); - i::IncrementalMarking* marking = CcTest::heap()->incremental_marking(); - marking->Stop(); - marking->Start(); - CHECK(platform.PendingIdleTask()); - const double kLongIdleTimeInSeconds = 1; - const double kShortIdleTimeInSeconds = 0.010; - const int kShortStepCount = 10; - for (int i = 0; i < kShortStepCount && platform.PendingIdleTask(); i++) { - platform.PerformIdleTask(kShortIdleTimeInSeconds); - } - while (platform.PendingIdleTask()) { - platform.PerformIdleTask(kLongIdleTimeInSeconds); - } - CHECK(marking->IsStopped()); - i::V8::SetPlatformForTesting(old_platform); -} - -TEST(IncrementalMarkingUsingDelayedTasks) { - if (!i::FLAG_incremental_marking) return; CcTest::InitializeVM(); v8::Platform* old_platform = i::V8::GetCurrentPlatform(); MockPlatform platform(old_platform); i::V8::SetPlatformForTesting(&platform); i::heap::SimulateFullSpace(CcTest::heap()->old_space()); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + // Perform any pending idle tasks. + while (platform.PendingTask()) { + platform.PerformTask(); + } + CHECK(!platform.PendingTask()); i::IncrementalMarking* marking = CcTest::heap()->incremental_marking(); marking->Stop(); - marking->Start(); - CHECK(platform.PendingIdleTask()); - // The delayed task should be a no-op if the idle task makes progress. - const int kIgnoredDelayedTaskStepCount = 1000; - for (int i = 0; i < kIgnoredDelayedTaskStepCount; i++) { - // Dummy idle task progress. - marking->incremental_marking_job()->NotifyIdleTaskProgress(); - CHECK(platform.PendingDelayedTask()); - platform.PerformDelayedTask(); - } - // Once we stop notifying idle task progress, the delayed tasks - // should finish marking. - while (!marking->IsStopped() && platform.PendingDelayedTask()) { - platform.PerformDelayedTask(); + marking->Start(i::GarbageCollectionReason::kTesting); + CHECK(platform.PendingTask()); + while (platform.PendingTask()) { + platform.PerformTask(); } - // There could be pending delayed task from memory reducer after GC finishes. CHECK(marking->IsStopped()); i::V8::SetPlatformForTesting(old_platform); } diff --git a/deps/v8/test/cctest/heap/test-lab.cc b/deps/v8/test/cctest/heap/test-lab.cc index 5a0ff2fbc4..b625206f48 100644 --- a/deps/v8/test/cctest/heap/test-lab.cc +++ b/deps/v8/test/cctest/heap/test-lab.cc @@ -8,6 +8,9 @@ #include "src/heap/heap.h" #include "src/heap/spaces.h" #include "src/heap/spaces-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/heap/incremental-marking.h -> src/objects-inl.h +#include "src/objects-inl.h" #include "test/cctest/cctest.h" namespace v8 { @@ -16,8 +19,7 @@ namespace internal { static Address AllocateLabBackingStore(Heap* heap, intptr_t size_in_bytes) { AllocationResult result = heap->old_space()->AllocateRaw( static_cast<int>(size_in_bytes), kDoubleAligned); - Object* obj = result.ToObjectChecked(); - Address adr = HeapObject::cast(obj)->address(); + Address adr = result.ToObjectChecked()->address(); return adr; } diff --git a/deps/v8/test/cctest/heap/test-mark-compact.cc b/deps/v8/test/cctest/heap/test-mark-compact.cc index 1e5d30d0e7..d0f7f82741 100644 --- a/deps/v8/test/cctest/heap/test-mark-compact.cc +++ b/deps/v8/test/cctest/heap/test-mark-compact.cc @@ -84,19 +84,22 @@ TEST(Promotion) { heap::SealCurrentObjects(heap); - int array_length = - heap::FixedArrayLenFromSize(Page::kMaxRegularHeapObjectSize); + int array_length = heap::FixedArrayLenFromSize(kMaxRegularHeapObjectSize); Handle<FixedArray> array = isolate->factory()->NewFixedArray(array_length); // Array should be in the new space. CHECK(heap->InSpace(*array, NEW_SPACE)); - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(heap->InSpace(*array, OLD_SPACE)); } } HEAP_TEST(NoPromotion) { + // Page promotion allows pages to be moved to old space even in the case of + // OOM scenarios. + FLAG_page_promotion = false; + CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); { @@ -105,15 +108,14 @@ HEAP_TEST(NoPromotion) { heap::SealCurrentObjects(heap); - int array_length = - heap::FixedArrayLenFromSize(Page::kMaxRegularHeapObjectSize); + int array_length = heap::FixedArrayLenFromSize(kMaxRegularHeapObjectSize); Handle<FixedArray> array = isolate->factory()->NewFixedArray(array_length); heap->set_force_oom(true); // Array should be in the new space. CHECK(heap->InSpace(*array, NEW_SPACE)); - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(heap->InSpace(*array, NEW_SPACE)); } } @@ -130,7 +132,7 @@ HEAP_TEST(MarkCompactCollector) { Handle<JSGlobalObject> global(isolate->context()->global_object()); // call mark-compact when heap is empty - heap->CollectGarbage(OLD_SPACE, "trigger 1"); + CcTest::CollectGarbage(OLD_SPACE); // keep allocating garbage in new space until it fails const int arraysize = 100; @@ -138,14 +140,14 @@ HEAP_TEST(MarkCompactCollector) { do { allocation = heap->AllocateFixedArray(arraysize); } while (!allocation.IsRetry()); - heap->CollectGarbage(NEW_SPACE, "trigger 2"); + CcTest::CollectGarbage(NEW_SPACE); heap->AllocateFixedArray(arraysize).ToObjectChecked(); // keep allocating maps until it fails do { allocation = heap->AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize); } while (!allocation.IsRetry()); - heap->CollectGarbage(MAP_SPACE, "trigger 3"); + CcTest::CollectGarbage(MAP_SPACE); heap->AllocateMap(JS_OBJECT_TYPE, JSObject::kHeaderSize).ToObjectChecked(); { HandleScope scope(isolate); @@ -157,7 +159,7 @@ HEAP_TEST(MarkCompactCollector) { factory->NewJSObject(function); } - heap->CollectGarbage(OLD_SPACE, "trigger 4"); + CcTest::CollectGarbage(OLD_SPACE); { HandleScope scope(isolate); Handle<String> func_name = factory->InternalizeUtf8String("theFunction"); @@ -175,7 +177,7 @@ HEAP_TEST(MarkCompactCollector) { JSReceiver::SetProperty(obj, prop_name, twenty_three, SLOPPY).Check(); } - heap->CollectGarbage(OLD_SPACE, "trigger 5"); + CcTest::CollectGarbage(OLD_SPACE); { HandleScope scope(isolate); Handle<String> obj_name = factory->InternalizeUtf8String("theObject"); @@ -218,7 +220,7 @@ TEST(MapCompact) { // be able to trigger map compaction. // To give an additional chance to fail, try to force compaction which // should be impossible right now. - CcTest::heap()->CollectAllGarbage(Heap::kForceCompactionMask); + CcTest::CollectAllGarbage(Heap::kForceCompactionMask); // And now map pointers should be encodable again. CHECK(CcTest::heap()->map_space()->MapPointersEncodable()); } @@ -299,7 +301,7 @@ HEAP_TEST(ObjectGroups) { g2c1.location()); } // Do a full GC - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); // All object should be alive. CHECK_EQ(0, NumberOfWeakCalls); @@ -326,7 +328,7 @@ HEAP_TEST(ObjectGroups) { g2c1.location()); } - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); // All objects should be gone. 5 global handles in total. CHECK_EQ(5, NumberOfWeakCalls); @@ -339,7 +341,7 @@ HEAP_TEST(ObjectGroups) { g2c1.location(), reinterpret_cast<void*>(&g2c1_and_id), &WeakPointerCallback, v8::WeakCallbackType::kParameter); - heap->CollectGarbage(OLD_SPACE); + CcTest::CollectGarbage(OLD_SPACE); CHECK_EQ(7, NumberOfWeakCalls); } diff --git a/deps/v8/test/cctest/heap/test-page-promotion.cc b/deps/v8/test/cctest/heap/test-page-promotion.cc index 4ec2e2a416..b3ac4960a5 100644 --- a/deps/v8/test/cctest/heap/test-page-promotion.cc +++ b/deps/v8/test/cctest/heap/test-page-promotion.cc @@ -2,7 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/factory.h" #include "src/heap/array-buffer-tracker.h" +#include "src/heap/spaces-inl.h" +#include "src/isolate.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-utils.h" @@ -11,7 +21,7 @@ namespace { v8::Isolate* NewIsolateForPagePromotion() { i::FLAG_page_promotion = true; i::FLAG_page_promotion_threshold = 0; // % - i::FLAG_min_semi_space_size = 8 * (i::Page::kPageSize / i::MB); + i::FLAG_min_semi_space_size = 8; // We cannot optimize for size as we require a new space with more than one // page. i::FLAG_optimize_for_size = false; @@ -40,7 +50,7 @@ UNINITIALIZED_TEST(PagePromotion_NewToOld) { std::vector<Handle<FixedArray>> handles; heap::SimulateFullSpace(heap->new_space(), &handles); - heap->CollectGarbage(NEW_SPACE); + heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting); CHECK_GT(handles.size(), 0u); // First object in handle should be on the first page. Handle<FixedArray> first_object = handles.front(); @@ -99,7 +109,6 @@ UNINITIALIZED_TEST(PagePromotion_NewToNewJSArrayBuffer) { // Fill the current page which potentially contains the age mark. heap::FillCurrentPage(heap->new_space()); - // Allocate a buffer we would like to check against. Handle<JSArrayBuffer> buffer = i_isolate->factory()->NewJSArrayBuffer(SharedFlag::kNotShared); diff --git a/deps/v8/test/cctest/heap/test-spaces.cc b/deps/v8/test/cctest/heap/test-spaces.cc index 2328518f2a..262d0c5d58 100644 --- a/deps/v8/test/cctest/heap/test-spaces.cc +++ b/deps/v8/test/cctest/heap/test-spaces.cc @@ -28,10 +28,15 @@ #include <stdlib.h> #include "src/base/platform/platform.h" +#include "src/heap/spaces-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/heap/incremental-marking.h -> src/objects-inl.h +#include "src/objects-inl.h" #include "src/snapshot/snapshot.h" #include "src/v8.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-tester.h" +#include "test/cctest/heap/heap-utils.h" namespace v8 { namespace internal { @@ -362,11 +367,10 @@ TEST(NewSpace) { CcTest::heap()->InitialSemiSpaceSize())); CHECK(new_space.HasBeenSetUp()); - while (new_space.Available() >= Page::kMaxRegularHeapObjectSize) { - Object* obj = - new_space.AllocateRawUnaligned(Page::kMaxRegularHeapObjectSize) - .ToObjectChecked(); - CHECK(new_space.Contains(HeapObject::cast(obj))); + while (new_space.Available() >= kMaxRegularHeapObjectSize) { + CHECK(new_space.Contains( + new_space.AllocateRawUnaligned(kMaxRegularHeapObjectSize) + .ToObjectChecked())); } new_space.TearDown(); @@ -389,7 +393,7 @@ TEST(OldSpace) { CHECK(s->SetUp()); while (s->Available() > 0) { - s->AllocateRawUnaligned(Page::kMaxRegularHeapObjectSize).ToObjectChecked(); + s->AllocateRawUnaligned(kMaxRegularHeapObjectSize).ToObjectChecked(); } delete s; @@ -420,11 +424,11 @@ TEST(CompactionSpace) { // and would thus neither grow, nor be able to allocate an object. const int kNumObjects = 100; const int kNumObjectsPerPage = - compaction_space->AreaSize() / Page::kMaxRegularHeapObjectSize; + compaction_space->AreaSize() / kMaxRegularHeapObjectSize; const int kExpectedPages = (kNumObjects + kNumObjectsPerPage - 1) / kNumObjectsPerPage; for (int i = 0; i < kNumObjects; i++) { - compaction_space->AllocateRawUnaligned(Page::kMaxRegularHeapObjectSize) + compaction_space->AllocateRawUnaligned(kMaxRegularHeapObjectSize) .ToObjectChecked(); } int pages_in_old_space = old_space->CountTotalPages(); @@ -445,6 +449,9 @@ TEST(CompactionSpace) { TEST(LargeObjectSpace) { + // This test does not initialize allocated objects, which confuses the + // incremental marker. + FLAG_incremental_marking = false; v8::V8::Initialize(); LargeObjectSpace* lo = CcTest::heap()->lo_space(); @@ -478,8 +485,7 @@ TEST(LargeObjectSpace) { CHECK(lo->AllocateRaw(lo_size, NOT_EXECUTABLE).IsRetry()); } - -TEST(SizeOfFirstPageIsLargeEnough) { +TEST(SizeOfInitialHeap) { if (i::FLAG_always_opt) return; // Bootstrapping without a snapshot causes more allocations. CcTest::InitializeVM(); @@ -494,27 +500,37 @@ TEST(SizeOfFirstPageIsLargeEnough) { ->IsUndefined()) { return; } + // Initial size of LO_SPACE + size_t initial_lo_space = isolate->heap()->lo_space()->Size(); - // If this test fails due to enabling experimental natives that are not part - // of the snapshot, we may need to adjust CalculateFirstPageSizes. + // The limit for each space for an empty isolate containing just the + // snapshot. + const size_t kMaxInitialSizePerSpace = 2 * MB; - // Freshly initialized VM gets by with one page per space. + // Freshly initialized VM gets by with the snapshot size (which is below + // kMaxInitialSizePerSpace per space). + Heap* heap = isolate->heap(); + int page_count[LAST_PAGED_SPACE + 1] = {0, 0, 0, 0}; for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { // Debug code can be very large, so skip CODE_SPACE if we are generating it. if (i == CODE_SPACE && i::FLAG_debug_code) continue; - CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); + + page_count[i] = heap->paged_space(i)->CountTotalPages(); + // Check that the initial heap is also below the limit. + CHECK_LT(heap->paged_space(i)->CommittedMemory(), kMaxInitialSizePerSpace); } - // Executing the empty script gets by with one page per space. + // Executing the empty script gets by with the same number of pages, i.e., + // requires no extra space. CompileRun("/*empty*/"); for (int i = FIRST_PAGED_SPACE; i <= LAST_PAGED_SPACE; i++) { // Debug code can be very large, so skip CODE_SPACE if we are generating it. if (i == CODE_SPACE && i::FLAG_debug_code) continue; - CHECK_EQ(1, isolate->heap()->paged_space(i)->CountTotalPages()); + CHECK_EQ(page_count[i], isolate->heap()->paged_space(i)->CountTotalPages()); } // No large objects required to perform the above steps. - CHECK(isolate->heap()->lo_space()->IsEmpty()); + CHECK_EQ(initial_lo_space, isolate->heap()->lo_space()->Size()); } static HeapObject* AllocateUnaligned(NewSpace* space, int size) { @@ -681,5 +697,104 @@ UNINITIALIZED_TEST(InlineAllocationObserverCadence) { isolate->Dispose(); } +TEST(ShrinkPageToHighWaterMarkFreeSpaceEnd) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + heap::SealCurrentObjects(CcTest::heap()); + + // Prepare page that only contains a single object and a trailing FreeSpace + // filler. + Handle<FixedArray> array = isolate->factory()->NewFixedArray(128, TENURED); + Page* page = Page::FromAddress(array->address()); + + // Reset space so high water mark is consistent. + CcTest::heap()->old_space()->ResetFreeList(); + CcTest::heap()->old_space()->EmptyAllocationInfo(); + + HeapObject* filler = + HeapObject::FromAddress(array->address() + array->Size()); + CHECK(filler->IsFreeSpace()); + size_t shrinked = page->ShrinkToHighWaterMark(); + size_t should_have_shrinked = + RoundDown(static_cast<size_t>(Page::kAllocatableMemory - array->Size()), + base::OS::CommitPageSize()); + CHECK_EQ(should_have_shrinked, shrinked); +} + +TEST(ShrinkPageToHighWaterMarkNoFiller) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + heap::SealCurrentObjects(CcTest::heap()); + + const int kFillerSize = 0; + std::vector<Handle<FixedArray>> arrays = + heap::FillOldSpacePageWithFixedArrays(CcTest::heap(), kFillerSize); + Handle<FixedArray> array = arrays.back(); + Page* page = Page::FromAddress(array->address()); + CHECK_EQ(page->area_end(), array->address() + array->Size() + kFillerSize); + + // Reset space so high water mark and fillers are consistent. + CcTest::heap()->old_space()->ResetFreeList(); + CcTest::heap()->old_space()->EmptyAllocationInfo(); + + const size_t shrinked = page->ShrinkToHighWaterMark(); + CHECK_EQ(0, shrinked); +} + +TEST(ShrinkPageToHighWaterMarkOneWordFiller) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + heap::SealCurrentObjects(CcTest::heap()); + + const int kFillerSize = kPointerSize; + std::vector<Handle<FixedArray>> arrays = + heap::FillOldSpacePageWithFixedArrays(CcTest::heap(), kFillerSize); + Handle<FixedArray> array = arrays.back(); + Page* page = Page::FromAddress(array->address()); + CHECK_EQ(page->area_end(), array->address() + array->Size() + kFillerSize); + + // Reset space so high water mark and fillers are consistent. + CcTest::heap()->old_space()->ResetFreeList(); + CcTest::heap()->old_space()->EmptyAllocationInfo(); + + HeapObject* filler = + HeapObject::FromAddress(array->address() + array->Size()); + CHECK_EQ(filler->map(), CcTest::heap()->one_pointer_filler_map()); + + const size_t shrinked = page->ShrinkToHighWaterMark(); + CHECK_EQ(0, shrinked); +} + +TEST(ShrinkPageToHighWaterMarkTwoWordFiller) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + heap::SealCurrentObjects(CcTest::heap()); + + const int kFillerSize = 2 * kPointerSize; + std::vector<Handle<FixedArray>> arrays = + heap::FillOldSpacePageWithFixedArrays(CcTest::heap(), kFillerSize); + Handle<FixedArray> array = arrays.back(); + Page* page = Page::FromAddress(array->address()); + CHECK_EQ(page->area_end(), array->address() + array->Size() + kFillerSize); + + // Reset space so high water mark and fillers are consistent. + CcTest::heap()->old_space()->ResetFreeList(); + CcTest::heap()->old_space()->EmptyAllocationInfo(); + + HeapObject* filler = + HeapObject::FromAddress(array->address() + array->Size()); + CHECK_EQ(filler->map(), CcTest::heap()->two_pointer_filler_map()); + + const size_t shrinked = page->ShrinkToHighWaterMark(); + CHECK_EQ(0, shrinked); +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc index 507875742d..81be1c0028 100644 --- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc +++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc @@ -12,7 +12,6 @@ #include "include/v8.h" #include "src/base/logging.h" -#include "src/compiler.h" #include "src/runtime/runtime.h" #include "src/interpreter/bytecode-array-iterator.h" @@ -47,13 +46,19 @@ std::string BytecodeExpectationsPrinter::WrapCodeInFunction( return program_stream.str(); } -v8::Local<v8::Script> BytecodeExpectationsPrinter::Compile( +v8::Local<v8::Script> BytecodeExpectationsPrinter::CompileScript( const char* program) const { v8::Local<v8::String> source = V8StringFromUTF8(program); return v8::Script::Compile(isolate_->GetCurrentContext(), source) .ToLocalChecked(); } +v8::Local<v8::Module> BytecodeExpectationsPrinter::CompileModule( + const char* program) const { + v8::ScriptCompiler::Source source(V8StringFromUTF8(program)); + return v8::ScriptCompiler::CompileModule(isolate_, &source).ToLocalChecked(); +} + void BytecodeExpectationsPrinter::Run(v8::Local<v8::Script> script) const { (void)script->Run(isolate_->GetCurrentContext()); } @@ -75,6 +80,13 @@ BytecodeExpectationsPrinter::GetBytecodeArrayForGlobal( } i::Handle<i::BytecodeArray> +BytecodeExpectationsPrinter::GetBytecodeArrayForModule( + v8::Local<v8::Module> module) const { + i::Handle<i::Module> i_module = v8::Utils::OpenHandle(*module); + return i::handle(i_module->shared()->bytecode_array(), i_isolate()); +} + +i::Handle<i::BytecodeArray> BytecodeExpectationsPrinter::GetBytecodeArrayForScript( v8::Local<v8::Script> script) const { i::Handle<i::JSFunction> js_function = v8::Utils::OpenHandle(*script); @@ -151,6 +163,9 @@ void BytecodeExpectationsPrinter::PrintBytecodeOperand( case OperandType::kIdx: stream << bytecode_iterator.GetIndexOperand(op_index); break; + case OperandType::kUImm: + stream << bytecode_iterator.GetUnsignedImmediateOperand(op_index); + break; case OperandType::kImm: stream << bytecode_iterator.GetImmediateOperand(op_index); break; @@ -225,32 +240,21 @@ void BytecodeExpectationsPrinter::PrintV8String(std::ostream& stream, void BytecodeExpectationsPrinter::PrintConstant( std::ostream& stream, i::Handle<i::Object> constant) const { - switch (const_pool_type_) { - case ConstantPoolType::kString: - CHECK(constant->IsString()); + if (constant->IsSmi()) { + stream << "Smi ["; + i::Smi::cast(*constant)->SmiPrint(stream); + stream << "]"; + } else { + stream << i::HeapObject::cast(*constant)->map()->instance_type(); + if (constant->IsHeapNumber()) { + stream << " ["; + i::HeapNumber::cast(*constant)->HeapNumberPrint(stream); + stream << "]"; + } else if (constant->IsString()) { + stream << " ["; PrintV8String(stream, i::String::cast(*constant)); - break; - case ConstantPoolType::kNumber: - if (constant->IsSmi()) { - i::Smi::cast(*constant)->SmiPrint(stream); - } else if (constant->IsHeapNumber()) { - i::HeapNumber::cast(*constant)->HeapNumberPrint(stream); - } else { - UNREACHABLE(); - } - break; - case ConstantPoolType::kMixed: - if (constant->IsSmi()) { - stream << "kInstanceTypeDontCare"; - } else { - stream << "InstanceType::" - << i::HeapObject::cast(*constant)->map()->instance_type(); - } - break; - case ConstantPoolType::kUnknown: - default: - UNREACHABLE(); - return; + stream << "]"; + } } } @@ -335,13 +339,20 @@ void BytecodeExpectationsPrinter::PrintExpectation( wrap_ ? WrapCodeInFunction(test_function_name_.c_str(), snippet) : snippet; - v8::Local<v8::Script> script = Compile(source_code.c_str()); - - if (execute_) Run(script); - - i::Handle<i::BytecodeArray> bytecode_array = - top_level_ ? GetBytecodeArrayForScript(script) - : GetBytecodeArrayForGlobal(test_function_name_.c_str()); + 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 { + v8::Local<v8::Script> script = CompileScript(source_code.c_str()); + if (top_level_) { + bytecode_array = GetBytecodeArrayForScript(script); + } else { + Run(script); + bytecode_array = GetBytecodeArrayForGlobal(test_function_name_.c_str()); + } + } stream << "---\n"; PrintCodeSnippet(stream, snippet); diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h index c64ca90c81..89f79d3b40 100644 --- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h +++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.h @@ -26,18 +26,9 @@ class BytecodeArrayIterator; class BytecodeExpectationsPrinter final { public: - enum class ConstantPoolType { - kUnknown, - kString, - kNumber, - kMixed, - }; - - BytecodeExpectationsPrinter(v8::Isolate* i, - ConstantPoolType t = ConstantPoolType::kMixed) + explicit BytecodeExpectationsPrinter(v8::Isolate* i) : isolate_(i), - const_pool_type_(t), - execute_(true), + module_(false), wrap_(true), top_level_(false), test_function_name_(kDefaultTopFunctionName) {} @@ -45,13 +36,8 @@ class BytecodeExpectationsPrinter final { void PrintExpectation(std::ostream& stream, // NOLINT const std::string& snippet) const; - void set_constant_pool_type(ConstantPoolType const_pool_type) { - const_pool_type_ = const_pool_type; - } - ConstantPoolType const_pool_type() const { return const_pool_type_; } - - void set_execute(bool execute) { execute_ = execute; } - bool execute() const { return execute_; } + void set_module(bool module) { module_ = module; } + bool module() const { return module_; } void set_wrap(bool wrap) { wrap_ = wrap; } bool wrap() const { return wrap_; } @@ -98,10 +84,13 @@ class BytecodeExpectationsPrinter final { std::string WrapCodeInFunction(const char* function_name, const std::string& function_body) const; - v8::Local<v8::Script> Compile(const char* program) const; + v8::Local<v8::Script> CompileScript(const char* program) const; + v8::Local<v8::Module> CompileModule(const char* program) const; void Run(v8::Local<v8::Script> script) const; i::Handle<i::BytecodeArray> GetBytecodeArrayForGlobal( const char* global_name) const; + i::Handle<v8::internal::BytecodeArray> GetBytecodeArrayForModule( + v8::Local<v8::Module> module) const; i::Handle<v8::internal::BytecodeArray> GetBytecodeArrayForScript( v8::Local<v8::Script> script) const; @@ -110,8 +99,7 @@ class BytecodeExpectationsPrinter final { } v8::Isolate* isolate_; - ConstantPoolType const_pool_type_; - bool execute_; + bool module_; bool wrap_; bool top_level_; std::string test_function_name_; diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden index 4997d1a004..92cdcac1bf 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiterals.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -16,11 +14,11 @@ parameter count: 1 bytecode array length: 6 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), /* 51 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -36,21 +34,21 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), - /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), B(Star), R(2), B(LdaZero), B(Star), R(1), B(Ldar), R(0), - /* 54 E> */ B(StaKeyedPropertySloppy), R(2), R(1), U8(2), + /* 54 E> */ B(StaKeyedPropertySloppy), R(2), R(1), U8(3), B(LdaSmi), U8(1), B(Star), R(1), - /* 57 E> */ B(AddSmi), U8(1), R(0), U8(1), - B(StaKeyedPropertySloppy), R(2), R(1), U8(2), + /* 57 E> */ B(AddSmi), U8(1), R(0), U8(2), + B(StaKeyedPropertySloppy), R(2), R(1), U8(3), B(Ldar), R(2), /* 66 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -64,11 +62,11 @@ parameter count: 1 bytecode array length: 6 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(2), + /* 34 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(0), /* 62 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -84,35 +82,35 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), - /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(2), + /* 45 S> */ B(CreateArrayLiteral), U8(0), U8(2), U8(0), B(Star), R(2), B(LdaZero), B(Star), R(1), - B(CreateArrayLiteral), U8(1), U8(0), U8(3), + B(CreateArrayLiteral), U8(1), U8(0), U8(9), B(Star), R(4), B(LdaZero), B(Star), R(3), B(Ldar), R(0), - /* 56 E> */ B(StaKeyedPropertySloppy), R(4), R(3), U8(1), + /* 56 E> */ B(StaKeyedPropertySloppy), R(4), R(3), U8(2), B(Ldar), R(4), - B(StaKeyedPropertySloppy), R(2), R(1), U8(6), + B(StaKeyedPropertySloppy), R(2), R(1), U8(7), B(LdaSmi), U8(1), B(Star), R(1), - B(CreateArrayLiteral), U8(2), U8(1), U8(3), + B(CreateArrayLiteral), U8(2), U8(1), U8(9), B(Star), R(4), B(LdaZero), B(Star), R(3), - /* 66 E> */ B(AddSmi), U8(2), R(0), U8(3), - B(StaKeyedPropertySloppy), R(4), R(3), U8(4), + /* 66 E> */ B(AddSmi), U8(2), R(0), U8(4), + B(StaKeyedPropertySloppy), R(4), R(3), U8(5), B(Ldar), R(4), - B(StaKeyedPropertySloppy), R(2), R(1), U8(6), + B(StaKeyedPropertySloppy), R(2), R(1), U8(7), B(Ldar), R(2), /* 77 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden index 9f9a25120b..6431d8adbe 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ArrayLiteralsWide.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -785,267 +783,267 @@ bytecodes: [ B(Star), R(0), /* 2591 S> */ B(LdaConstant), U8(255), B(Star), R(0), - /* 2601 S> */ B(Wide), B(CreateArrayLiteral), U16(256), U16(0), U8(3), + /* 2601 S> */ B(Wide), B(CreateArrayLiteral), U16(256), U16(0), U8(9), /* 2619 S> */ B(Return), ] constant pool: [ - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::FIXED_ARRAY_TYPE, + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + FIXED_ARRAY_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden index 5a1efc2889..4d78aa6bfc 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: yes --- @@ -66,7 +64,7 @@ snippet: " x = x + (x = 100) + (x = 101); return x; " -frame size: 3 +frame size: 2 parameter count: 1 bytecode array length: 28 bytecodes: [ @@ -76,11 +74,11 @@ bytecodes: [ /* 46 S> */ B(LdaSmi), U8(100), B(Mov), R(0), R(1), B(Star), R(0), - /* 57 E> */ B(Add), R(1), U8(1), - B(Star), R(2), + /* 57 E> */ B(Add), R(1), U8(2), + B(Star), R(1), B(LdaSmi), U8(101), B(Star), R(0), - /* 69 E> */ B(Add), R(2), U8(2), + /* 69 E> */ B(Add), R(1), U8(3), B(Star), R(0), /* 77 S> */ B(Nop), /* 87 S> */ B(Return), @@ -97,7 +95,7 @@ snippet: " x++; return x; " -frame size: 3 +frame size: 2 parameter count: 1 bytecode array length: 29 bytecodes: [ @@ -106,13 +104,13 @@ bytecodes: [ B(Star), R(0), /* 46 S> */ B(LdaSmi), U8(56), B(Star), R(0), - /* 61 E> */ B(Sub), R(0), U8(1), - B(Star), R(2), + /* 61 E> */ B(Sub), R(0), U8(2), + B(Star), R(1), B(LdaSmi), U8(57), B(Star), R(0), - /* 68 E> */ B(Add), R(2), U8(2), + /* 68 E> */ B(Add), R(1), U8(3), B(Star), R(0), - /* 75 S> */ B(Inc), U8(3), + /* 75 S> */ B(Inc), U8(4), B(Star), R(0), /* 80 S> */ B(Nop), /* 90 S> */ B(Return), @@ -128,7 +126,7 @@ snippet: " var y = x + (x = 1) + (x = 2) + (x = 3); return y; " -frame size: 4 +frame size: 3 parameter count: 1 bytecode array length: 37 bytecodes: [ @@ -138,15 +136,15 @@ bytecodes: [ /* 76 S> */ B(LdaSmi), U8(1), B(Mov), R(0), R(2), B(Star), R(0), - /* 61 E> */ B(Add), R(2), U8(1), - B(Star), R(3), + /* 61 E> */ B(Add), R(2), U8(2), + B(Star), R(2), B(LdaSmi), U8(2), B(Star), R(0), - /* 71 E> */ B(Add), R(3), U8(2), + /* 71 E> */ B(Add), R(2), U8(3), B(Star), R(2), B(LdaSmi), U8(3), B(Star), R(0), - /* 81 E> */ B(Add), R(2), U8(3), + /* 81 E> */ B(Add), R(2), U8(4), B(Star), R(1), /* 87 S> */ B(Nop), /* 97 S> */ B(Return), @@ -162,7 +160,7 @@ snippet: " var x = x + (x = 1) + (x = 2) + (x = 3); return x; " -frame size: 3 +frame size: 2 parameter count: 1 bytecode array length: 37 bytecodes: [ @@ -172,15 +170,15 @@ bytecodes: [ /* 76 S> */ B(LdaSmi), U8(1), B(Mov), R(0), R(1), B(Star), R(0), - /* 61 E> */ B(Add), R(1), U8(1), - B(Star), R(2), + /* 61 E> */ B(Add), R(1), U8(2), + B(Star), R(1), B(LdaSmi), U8(2), B(Star), R(0), - /* 71 E> */ B(Add), R(2), U8(2), + /* 71 E> */ B(Add), R(1), U8(3), B(Star), R(1), B(LdaSmi), U8(3), B(Star), R(0), - /* 81 E> */ B(Add), R(1), U8(3), + /* 81 E> */ B(Add), R(1), U8(4), B(Star), R(0), /* 87 S> */ B(Nop), /* 97 S> */ B(Return), @@ -195,7 +193,7 @@ snippet: " var x = 10, y = 20; return x + (x = 1) + (x + 1) * (y = 2) + (y = 3) + (x = 4) + (y = 5) + y; " -frame size: 5 +frame size: 4 parameter count: 1 bytecode array length: 72 bytecodes: [ @@ -207,29 +205,29 @@ bytecodes: [ /* 54 S> */ B(LdaSmi), U8(1), B(Mov), R(0), R(2), B(Star), R(0), - /* 68 E> */ B(Add), R(2), U8(1), + /* 68 E> */ B(Add), R(2), U8(2), + B(Star), R(2), + /* 76 E> */ B(AddSmi), U8(1), R(0), U8(3), B(Star), R(3), - /* 76 E> */ B(AddSmi), U8(1), R(0), U8(2), - B(Star), R(4), B(LdaSmi), U8(2), B(Star), R(1), - /* 88 E> */ B(Mul), R(4), U8(3), - B(Add), R(3), U8(4), + /* 88 E> */ B(Mul), R(3), U8(4), + B(Add), R(2), U8(5), B(Star), R(2), B(LdaSmi), U8(3), B(Star), R(1), - /* 98 E> */ B(Add), R(2), U8(5), - B(Star), R(3), + /* 98 E> */ B(Add), R(2), U8(6), + B(Star), R(2), B(LdaSmi), U8(4), B(Star), R(0), - /* 108 E> */ B(Add), R(3), U8(6), + /* 108 E> */ B(Add), R(2), U8(7), B(Star), R(2), B(LdaSmi), U8(5), B(Star), R(1), - /* 118 E> */ B(Add), R(2), U8(7), - B(Star), R(3), + /* 118 E> */ B(Add), R(2), U8(8), + B(Star), R(2), B(Ldar), R(1), - /* 125 E> */ B(Add), R(3), U8(8), + /* 125 E> */ B(Add), R(2), U8(9), /* 128 S> */ B(Return), ] constant pool: [ @@ -242,7 +240,7 @@ snippet: " var x = 17; return 1 + x + (x++) + (++x); " -frame size: 4 +frame size: 3 parameter count: 1 bytecode array length: 41 bytecodes: [ @@ -252,19 +250,19 @@ bytecodes: [ /* 46 S> */ B(LdaSmi), U8(1), B(Star), R(1), B(Ldar), R(0), - /* 57 E> */ B(Add), R(1), U8(1), - B(Star), R(2), + /* 57 E> */ B(Add), R(1), U8(2), + B(Star), R(1), B(Ldar), R(0), - B(ToNumber), R(1), - B(Inc), U8(2), + B(ToNumber), R(2), + B(Inc), U8(3), B(Star), R(0), - B(Ldar), R(1), - /* 63 E> */ B(Add), R(2), U8(3), - B(Star), R(3), + B(Ldar), R(2), + /* 63 E> */ B(Add), R(1), U8(4), + B(Star), R(1), B(Ldar), R(0), - B(Inc), U8(4), + B(Inc), U8(5), B(Star), R(0), - /* 72 E> */ B(Add), R(3), U8(5), + /* 72 E> */ B(Add), R(1), U8(6), /* 76 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden index 422fad3283..547e83590e 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicBlockToBoolean.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- @@ -13,14 +11,14 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 17 +bytecode array length: 18 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), - /* 45 S> */ B(JumpIfToBooleanTrue), U8(7), + /* 45 S> */ B(JumpIfToBooleanTrue), U8(8), B(LdaZero), - /* 56 E> */ B(TestLessThan), R(0), + /* 56 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(5), /* 63 S> */ B(LdaSmi), U8(1), /* 75 S> */ B(Return), @@ -38,14 +36,14 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 17 +bytecode array length: 18 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), - /* 45 S> */ B(JumpIfToBooleanFalse), U8(10), + /* 45 S> */ B(JumpIfToBooleanFalse), U8(11), B(LdaZero), - /* 56 E> */ B(TestLessThan), R(0), + /* 56 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(5), /* 63 S> */ B(LdaSmi), U8(1), /* 75 S> */ B(Return), @@ -63,14 +61,14 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 22 +bytecode array length: 23 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), - /* 45 S> */ B(JumpIfToBooleanTrue), U8(7), + /* 45 S> */ B(JumpIfToBooleanTrue), U8(8), B(LdaZero), - /* 57 E> */ B(TestLessThan), R(0), + /* 57 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(6), B(LdaSmi), U8(2), B(Jump), U8(4), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden index 6dcd2692af..19d83661f0 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -65,7 +63,7 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 49 +bytecode array length: 53 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), @@ -73,23 +71,23 @@ bytecodes: [ /* 53 S> */ B(LdaSmi), U8(1), B(Star), R(1), /* 65 S> */ B(LdaSmi), U8(10), - /* 65 E> */ B(TestLessThan), R(0), - B(JumpIfFalse), U8(34), + /* 65 E> */ B(TestLessThan), R(0), U8(2), + B(JumpIfFalse), U8(37), /* 56 E> */ B(StackCheck), /* 75 S> */ B(LdaSmi), U8(12), - B(Mul), R(1), U8(1), + B(Mul), R(1), U8(3), B(Star), R(1), - /* 89 S> */ B(AddSmi), U8(1), R(0), U8(2), + /* 89 S> */ B(AddSmi), U8(1), R(0), U8(4), B(Star), R(0), /* 102 S> */ B(LdaSmi), U8(3), - /* 108 E> */ B(TestEqual), R(0), + /* 108 E> */ B(TestEqual), R(0), U8(5), B(JumpIfFalse), U8(4), - /* 114 S> */ B(Jump), U8(10), + /* 114 S> */ B(Jump), U8(11), /* 126 S> */ B(LdaSmi), U8(4), - /* 132 E> */ B(TestEqual), R(0), + /* 132 E> */ B(TestEqual), R(0), U8(6), B(JumpIfFalse), U8(4), - /* 138 S> */ B(Jump), U8(4), - B(Jump), U8(-36), + /* 138 S> */ B(Jump), U8(5), + B(JumpLoop), U8(-39), U8(0), /* 147 S> */ B(Ldar), R(1), /* 157 S> */ B(Return), ] @@ -113,35 +111,35 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 55 +bytecode array length: 61 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 E> */ B(StackCheck), /* 62 S> */ B(LdaZero), - /* 68 E> */ B(TestLessThan), R(0), + /* 68 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(4), - /* 73 S> */ B(Jump), U8(40), + /* 73 S> */ B(Jump), U8(44), /* 85 S> */ B(LdaSmi), U8(3), - /* 91 E> */ B(TestEqual), R(0), + /* 91 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), - /* 97 S> */ B(Jump), U8(34), + /* 97 S> */ B(Jump), U8(38), /* 106 S> */ B(LdaSmi), U8(4), - /* 112 E> */ B(TestEqual), R(0), + /* 112 E> */ B(TestEqual), R(0), U8(4), B(JumpIfFalse), U8(4), - /* 118 S> */ B(Jump), U8(26), + /* 118 S> */ B(Jump), U8(29), /* 127 S> */ B(LdaSmi), U8(10), - /* 133 E> */ B(TestEqual), R(0), + /* 133 E> */ B(TestEqual), R(0), U8(5), B(JumpIfFalse), U8(4), - /* 140 S> */ B(Jump), U8(16), + /* 140 S> */ B(Jump), U8(17), /* 152 S> */ B(LdaSmi), U8(5), - /* 158 E> */ B(TestEqual), R(0), + /* 158 E> */ B(TestEqual), R(0), U8(6), B(JumpIfFalse), U8(4), - /* 164 S> */ B(Jump), U8(10), - /* 173 S> */ B(AddSmi), U8(1), R(0), U8(1), + /* 164 S> */ B(Jump), U8(11), + /* 173 S> */ B(AddSmi), U8(1), R(0), U8(7), B(Star), R(0), - B(Jump), U8(-46), + B(JumpLoop), U8(-51), U8(0), /* 186 S> */ B(Ldar), R(0), /* 196 S> */ B(Return), ] @@ -165,24 +163,24 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 39 +bytecode array length: 42 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 E> */ B(StackCheck), /* 71 S> */ B(LdaSmi), U8(3), - /* 71 E> */ B(TestLessThan), R(0), - B(JumpIfFalse), U8(19), + /* 71 E> */ B(TestLessThan), R(0), U8(2), + B(JumpIfFalse), U8(21), /* 62 E> */ B(StackCheck), /* 82 S> */ B(LdaSmi), U8(2), - /* 88 E> */ B(TestEqual), R(0), + /* 88 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), - /* 94 S> */ B(Jump), U8(10), - /* 105 S> */ B(AddSmi), U8(1), R(0), U8(1), + /* 94 S> */ B(Jump), U8(11), + /* 105 S> */ B(AddSmi), U8(1), R(0), U8(4), B(Star), R(0), - B(Jump), U8(-21), - /* 122 S> */ B(AddSmi), U8(1), R(0), U8(2), + B(JumpLoop), U8(-23), U8(1), + /* 122 S> */ B(AddSmi), U8(1), R(0), U8(5), B(Star), R(0), /* 135 S> */ B(Jump), U8(2), /* 144 S> */ B(Ldar), R(0), @@ -205,7 +203,7 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 32 +bytecode array length: 33 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(10), @@ -213,14 +211,14 @@ bytecodes: [ /* 54 S> */ B(LdaSmi), U8(1), B(Star), R(1), /* 64 S> */ B(Ldar), R(0), - B(JumpIfToBooleanFalse), U8(18), + B(JumpIfToBooleanFalse), U8(19), /* 57 E> */ B(StackCheck), /* 71 S> */ B(LdaSmi), U8(12), - B(Mul), R(1), U8(1), + B(Mul), R(1), U8(2), B(Star), R(1), - /* 85 S> */ B(SubSmi), U8(1), R(0), U8(2), + /* 85 S> */ B(SubSmi), U8(1), R(0), U8(3), B(Star), R(0), - B(Jump), U8(-18), + B(JumpLoop), U8(-18), U8(0), /* 98 S> */ B(Ldar), R(1), /* 108 S> */ B(Return), ] @@ -242,7 +240,7 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 47 +bytecode array length: 53 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), @@ -251,21 +249,22 @@ bytecodes: [ B(Star), R(1), /* 56 E> */ B(StackCheck), /* 63 S> */ B(LdaSmi), U8(10), - B(Mul), R(1), U8(1), + B(Mul), R(1), U8(2), B(Star), R(1), /* 77 S> */ B(LdaSmi), U8(5), - /* 83 E> */ B(TestEqual), R(0), + /* 83 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), - /* 89 S> */ B(Jump), U8(22), + /* 89 S> */ B(Jump), U8(27), /* 98 S> */ B(LdaSmi), U8(6), - /* 104 E> */ B(TestEqual), R(0), + /* 104 E> */ B(TestEqual), R(0), U8(4), B(JumpIfFalse), U8(4), /* 110 S> */ B(Jump), U8(8), - /* 122 S> */ B(AddSmi), U8(1), R(0), U8(2), + /* 122 S> */ B(AddSmi), U8(1), R(0), U8(5), B(Star), R(0), /* 144 S> */ B(LdaSmi), U8(10), - /* 144 E> */ B(TestLessThan), R(0), - B(JumpIfTrue), U8(-34), + /* 144 E> */ B(TestLessThan), R(0), U8(6), + B(JumpIfFalse), U8(5), + B(JumpLoop), U8(-39), U8(0), /* 151 S> */ B(Ldar), R(1), /* 161 S> */ B(Return), ] @@ -286,7 +285,7 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 28 +bytecode array length: 31 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(10), @@ -295,11 +294,12 @@ bytecodes: [ B(Star), R(1), /* 57 E> */ B(StackCheck), /* 64 S> */ B(LdaSmi), U8(12), - B(Mul), R(1), U8(1), + B(Mul), R(1), U8(2), B(Star), R(1), - /* 78 S> */ B(SubSmi), U8(1), R(0), U8(2), + /* 78 S> */ B(SubSmi), U8(1), R(0), U8(3), B(Star), R(0), - /* 98 S> */ B(JumpIfToBooleanTrue), U8(-14), + /* 98 S> */ B(JumpIfToBooleanFalse), U8(5), + B(JumpLoop), U8(-16), U8(0), /* 102 S> */ B(Ldar), R(1), /* 112 S> */ B(Return), ] @@ -321,7 +321,7 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 41 +bytecode array length: 43 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), @@ -330,16 +330,16 @@ bytecodes: [ B(Star), R(1), /* 56 E> */ B(StackCheck), /* 63 S> */ B(LdaSmi), U8(10), - B(Mul), R(1), U8(1), + B(Mul), R(1), U8(2), B(Star), R(1), /* 77 S> */ B(LdaSmi), U8(5), - /* 83 E> */ B(TestEqual), R(0), + /* 83 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), - /* 89 S> */ B(Jump), U8(16), - /* 98 S> */ B(AddSmi), U8(1), R(0), U8(2), + /* 89 S> */ B(Jump), U8(17), + /* 98 S> */ B(AddSmi), U8(1), R(0), U8(4), B(Star), R(0), /* 111 S> */ B(LdaSmi), U8(6), - /* 117 E> */ B(TestEqual), R(0), + /* 117 E> */ B(TestEqual), R(0), U8(5), B(JumpIfFalse), U8(4), /* 123 S> */ B(Jump), U8(2), /* 150 S> */ B(Ldar), R(1), @@ -363,7 +363,7 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 43 +bytecode array length: 46 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), @@ -372,19 +372,19 @@ bytecodes: [ B(Star), R(1), /* 56 E> */ B(StackCheck), /* 63 S> */ B(LdaSmi), U8(10), - B(Mul), R(1), U8(1), + B(Mul), R(1), U8(2), B(Star), R(1), /* 77 S> */ B(LdaSmi), U8(5), - /* 83 E> */ B(TestEqual), R(0), + /* 83 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), - /* 89 S> */ B(Jump), U8(18), - /* 98 S> */ B(AddSmi), U8(1), R(0), U8(2), + /* 89 S> */ B(Jump), U8(20), + /* 98 S> */ B(AddSmi), U8(1), R(0), U8(4), B(Star), R(0), /* 111 S> */ B(LdaSmi), U8(6), - /* 117 E> */ B(TestEqual), R(0), + /* 117 E> */ B(TestEqual), R(0), U8(5), B(JumpIfFalse), U8(4), /* 123 S> */ B(Jump), U8(2), - B(Jump), U8(-30), + B(JumpLoop), U8(-32), U8(0), /* 149 S> */ B(Ldar), R(1), /* 159 S> */ B(Return), ] @@ -404,23 +404,23 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 31 +bytecode array length: 34 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 E> */ B(StackCheck), /* 58 S> */ B(LdaSmi), U8(1), - /* 64 E> */ B(TestEqual), R(0), + /* 64 E> */ B(TestEqual), R(0), U8(2), B(JumpIfFalse), U8(4), - /* 70 S> */ B(Jump), U8(18), + /* 70 S> */ B(Jump), U8(20), /* 79 S> */ B(LdaSmi), U8(2), - /* 85 E> */ B(TestEqual), R(0), + /* 85 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 91 S> */ B(Jump), U8(8), - /* 103 S> */ B(AddSmi), U8(1), R(0), U8(1), + /* 103 S> */ B(AddSmi), U8(1), R(0), U8(4), B(Star), R(0), - B(Jump), U8(-23), + B(JumpLoop), U8(-25), U8(0), B(LdaUndefined), /* 116 S> */ B(Return), ] @@ -439,23 +439,23 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 31 +bytecode array length: 34 bytecodes: [ /* 30 E> */ B(StackCheck), /* 47 S> */ B(LdaZero), B(Star), R(0), /* 34 E> */ B(StackCheck), /* 56 S> */ B(LdaSmi), U8(1), - /* 62 E> */ B(TestEqual), R(0), + /* 62 E> */ B(TestEqual), R(0), U8(2), B(JumpIfFalse), U8(4), - /* 68 S> */ B(Jump), U8(18), + /* 68 S> */ B(Jump), U8(20), /* 77 S> */ B(LdaSmi), U8(2), - /* 83 E> */ B(TestEqual), R(0), + /* 83 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), /* 89 S> */ B(Jump), U8(8), - /* 101 S> */ B(AddSmi), U8(1), R(0), U8(1), + /* 101 S> */ B(AddSmi), U8(1), R(0), U8(4), B(Star), R(0), - B(Jump), U8(-23), + B(JumpLoop), U8(-25), U8(0), B(LdaUndefined), /* 114 S> */ B(Return), ] @@ -474,23 +474,23 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 31 +bytecode array length: 34 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 E> */ B(StackCheck), /* 68 S> */ B(LdaSmi), U8(1), - /* 74 E> */ B(TestEqual), R(0), + /* 74 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), - /* 80 S> */ B(Jump), U8(18), + /* 80 S> */ B(Jump), U8(20), /* 89 S> */ B(LdaSmi), U8(2), - /* 95 E> */ B(TestEqual), R(0), + /* 95 E> */ B(TestEqual), R(0), U8(4), B(JumpIfFalse), U8(4), /* 101 S> */ B(Jump), U8(2), - /* 55 S> */ B(AddSmi), U8(1), R(0), U8(1), + /* 55 S> */ B(AddSmi), U8(1), R(0), U8(2), B(Star), R(0), - B(Jump), U8(-23), + B(JumpLoop), U8(-25), U8(0), B(LdaUndefined), /* 113 S> */ B(Return), ] @@ -508,23 +508,23 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 31 +bytecode array length: 34 bytecodes: [ /* 30 E> */ B(StackCheck), /* 47 S> */ B(LdaZero), B(Star), R(0), /* 34 E> */ B(StackCheck), /* 66 S> */ B(LdaSmi), U8(1), - /* 72 E> */ B(TestEqual), R(0), + /* 72 E> */ B(TestEqual), R(0), U8(3), B(JumpIfFalse), U8(4), - /* 78 S> */ B(Jump), U8(18), + /* 78 S> */ B(Jump), U8(20), /* 87 S> */ B(LdaSmi), U8(2), - /* 93 E> */ B(TestEqual), R(0), + /* 93 E> */ B(TestEqual), R(0), U8(4), B(JumpIfFalse), U8(4), /* 99 S> */ B(Jump), U8(2), - /* 53 S> */ B(AddSmi), U8(1), R(0), U8(1), + /* 53 S> */ B(AddSmi), U8(1), R(0), U8(2), B(Star), R(0), - B(Jump), U8(-23), + B(JumpLoop), U8(-25), U8(0), B(LdaUndefined), /* 111 S> */ B(Return), ] @@ -543,7 +543,7 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 32 +bytecode array length: 34 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), @@ -551,15 +551,15 @@ bytecodes: [ /* 58 S> */ B(LdaZero), B(Star), R(1), /* 63 S> */ B(LdaSmi), U8(100), - /* 63 E> */ B(TestLessThan), R(1), - B(JumpIfFalse), U8(19), + /* 63 E> */ B(TestLessThan), R(1), U8(2), + B(JumpIfFalse), U8(20), /* 45 E> */ B(StackCheck), - /* 85 S> */ B(AddSmi), U8(1), R(0), U8(2), + /* 85 S> */ B(AddSmi), U8(1), R(0), U8(4), B(Star), R(0), /* 98 S> */ B(Jump), U8(2), - /* 72 S> */ B(AddSmi), U8(1), R(1), U8(1), + /* 72 S> */ B(AddSmi), U8(1), R(1), U8(3), B(Star), R(1), - B(Jump), U8(-21), + B(JumpLoop), U8(-22), U8(0), B(LdaUndefined), /* 110 S> */ B(Return), ] @@ -578,7 +578,7 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 32 +bytecode array length: 33 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), @@ -586,15 +586,15 @@ bytecodes: [ /* 58 S> */ B(LdaSmi), U8(10), B(Star), R(1), /* 62 S> */ B(Ldar), R(1), - B(JumpIfToBooleanFalse), U8(18), + B(JumpIfToBooleanFalse), U8(19), /* 45 E> */ B(StackCheck), /* 74 S> */ B(LdaSmi), U8(12), - B(Mul), R(0), U8(2), + B(Mul), R(0), U8(3), B(Star), R(0), /* 67 S> */ B(Ldar), R(1), - B(Dec), U8(1), + B(Dec), U8(2), B(Star), R(1), - B(Jump), U8(-18), + B(JumpLoop), U8(-18), U8(0), /* 88 S> */ B(Ldar), R(0), /* 98 S> */ B(Return), ] @@ -639,7 +639,7 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 33 +bytecode array length: 35 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), @@ -647,16 +647,16 @@ bytecodes: [ /* 58 S> */ B(LdaZero), B(Star), R(1), /* 45 E> */ B(StackCheck), - /* 76 S> */ B(AddSmi), U8(1), R(0), U8(2), + /* 76 S> */ B(AddSmi), U8(1), R(0), U8(3), B(Star), R(0), /* 89 S> */ B(LdaSmi), U8(20), - /* 95 E> */ B(TestEqual), R(0), + /* 95 E> */ B(TestEqual), R(0), U8(4), B(JumpIfFalse), U8(4), - /* 102 S> */ B(Jump), U8(10), + /* 102 S> */ B(Jump), U8(11), /* 69 S> */ B(Ldar), R(1), - B(Inc), U8(1), + B(Inc), U8(2), B(Star), R(1), - B(Jump), U8(-21), + B(JumpLoop), U8(-22), U8(0), /* 112 S> */ B(Ldar), R(0), /* 122 S> */ B(Return), ] @@ -679,25 +679,25 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 97 +bytecode array length: 104 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(1), /* 52 S> */ B(Ldar), R(1), - B(JumpIfToBooleanFalse), U8(89), + B(JumpIfToBooleanFalse), U8(96), /* 45 E> */ B(StackCheck), B(Ldar), R(closure), B(CreateBlockContext), U8(0), B(PushContext), R(3), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateClosure), U8(1), U8(2), B(Star), R(0), /* 73 S> */ B(LdaSmi), U8(1), - /* 73 E> */ B(StaContextSlot), R(context), U8(4), + /* 73 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(Mov), R(0), R(2), - /* 106 S> */ B(LdaContextSlot), R(context), U8(4), + /* 106 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(2), B(Star), R(4), @@ -705,30 +705,30 @@ bytecodes: [ B(JumpIfToBooleanFalse), U8(8), /* 113 S> */ B(PopContext), R(3), B(PopContext), R(3), - B(Jump), U8(41), - /* 126 S> */ B(LdaContextSlot), R(context), U8(4), + B(Jump), U8(44), + /* 126 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(2), B(Star), R(4), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), - B(Inc), U8(1), + B(Inc), U8(2), B(Star), R(4), - /* 127 E> */ B(LdaContextSlot), R(context), U8(4), + /* 127 E> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(2), B(Star), R(5), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), B(Ldar), R(4), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(PopContext), R(3), - B(Jump), U8(-89), + B(JumpLoop), U8(-95), U8(0), B(LdaUndefined), /* 137 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["z"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden index bae9bd4da3..276c8daacb 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -24,7 +22,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 56 S> */ B(AddSmi), U8(1), R(0), U8(1), + /* 56 S> */ B(AddSmi), U8(1), R(0), U8(2), B(Star), R(0), /* 69 S> */ B(Jump), U8(2), /* 97 S> */ B(Ldar), R(0), @@ -48,9 +46,9 @@ snippet: " } return sum; " -frame size: 5 +frame size: 4 parameter count: 1 -bytecode array length: 64 +bytecode array length: 69 bytecodes: [ /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaZero), @@ -58,33 +56,33 @@ bytecodes: [ /* 71 S> */ B(LdaZero), B(Star), R(1), /* 76 S> */ B(LdaSmi), U8(10), - /* 76 E> */ B(TestLessThan), R(1), - B(JumpIfFalse), U8(50), + /* 76 E> */ B(TestLessThan), R(1), U8(2), + B(JumpIfFalse), U8(54), /* 58 E> */ B(StackCheck), /* 106 S> */ B(LdaZero), B(Star), R(2), /* 111 S> */ B(LdaSmi), U8(3), - /* 111 E> */ B(TestLessThan), R(2), - B(JumpIfFalse), U8(32), + /* 111 E> */ B(TestLessThan), R(2), U8(4), + B(JumpIfFalse), U8(34), /* 93 E> */ B(StackCheck), /* 129 S> */ B(Ldar), R(0), - B(Inc), U8(3), + B(Inc), U8(6), B(Star), R(0), /* 142 S> */ B(Ldar), R(2), - /* 150 E> */ B(Add), R(1), U8(4), - B(Star), R(4), + /* 150 E> */ B(Add), R(1), U8(7), + B(Star), R(3), B(LdaSmi), U8(12), - /* 152 E> */ B(TestEqual), R(4), + /* 152 E> */ B(TestEqual), R(3), U8(8), B(JumpIfFalse), U8(4), - /* 161 S> */ B(Jump), U8(18), + /* 161 S> */ B(Jump), U8(20), /* 118 S> */ B(Ldar), R(2), - B(Inc), U8(2), + B(Inc), U8(5), B(Star), R(2), - B(Jump), U8(-34), + B(JumpLoop), U8(-36), U8(1), /* 84 S> */ B(Ldar), R(1), - B(Inc), U8(1), + B(Inc), U8(3), B(Star), R(1), - B(Jump), U8(-52), + B(JumpLoop), U8(-56), U8(0), /* 188 S> */ B(Ldar), R(0), /* 200 S> */ B(Return), ] @@ -103,18 +101,18 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 32 +bytecode array length: 34 bytecodes: [ /* 30 E> */ B(StackCheck), B(Ldar), R(closure), B(CreateBlockContext), U8(0), B(PushContext), R(2), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateClosure), U8(1), U8(2), B(Star), R(0), /* 53 S> */ B(LdaSmi), U8(10), - /* 53 E> */ B(StaContextSlot), R(context), U8(4), + /* 53 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(Mov), R(0), R(1), B(Ldar), R(0), /* 88 S> */ B(Jump), U8(2), @@ -123,8 +121,8 @@ bytecodes: [ /* 103 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -144,60 +142,60 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 107 +bytecode array length: 116 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(2), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(Ldar), R(closure), B(CreateBlockContext), U8(0), B(PushContext), R(3), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateClosure), U8(1), U8(2), B(Star), R(0), /* 76 S> */ B(LdaSmi), U8(2), - /* 76 E> */ B(StaContextSlot), R(context), U8(4), + /* 76 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(Mov), R(0), R(1), - /* 118 S> */ B(LdaContextSlot), R(context), U8(4), + /* 118 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(2), B(Star), R(4), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), B(JumpIfToBooleanFalse), U8(6), /* 125 S> */ B(PopContext), R(3), - B(Jump), U8(27), + B(Jump), U8(29), /* 142 S> */ B(LdaSmi), U8(3), B(Star), R(4), - /* 144 E> */ B(LdaContextSlot), R(context), U8(4), + /* 144 E> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(2), B(Star), R(5), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), B(Ldar), R(4), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(PopContext), R(3), /* 155 S> */ B(LdaSmi), U8(4), B(Star), R(4), - /* 157 E> */ B(LdaContextSlot), R(context), U8(4), + /* 157 E> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(3), B(Star), R(5), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), B(Ldar), R(4), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(LdaUndefined), /* 162 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["y"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden index 45fb07ad08..49e6f71265 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -20,8 +18,8 @@ bytecode array length: 12 bytecodes: [ /* 27 E> */ B(StackCheck), /* 32 S> */ B(LdrUndefined), R(1), - B(LdrGlobal), U8(3), R(0), - /* 39 E> */ B(Call), R(0), R(1), U8(1), U8(1), + B(LdrGlobal), U8(4), R(0), + /* 39 E> */ B(Call), R(0), R(1), U8(1), U8(2), /* 44 S> */ B(Return), ] constant pool: [ @@ -41,14 +39,14 @@ bytecode array length: 24 bytecodes: [ /* 34 E> */ B(StackCheck), /* 39 S> */ B(LdrUndefined), R(1), - B(LdrGlobal), U8(3), R(0), + B(LdrGlobal), U8(4), R(0), B(LdaSmi), U8(1), B(Star), R(2), B(LdaSmi), U8(2), B(Star), R(3), B(LdaSmi), U8(3), B(Star), R(4), - /* 46 E> */ B(Call), R(0), R(1), U8(4), U8(1), + /* 46 E> */ B(Call), R(0), R(1), U8(4), U8(2), /* 58 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden index 9438503ae4..b238d95954 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -13,22 +11,22 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 86 +bytecode array length: 89 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(5), + B(StaContextSlot), R(context), U8(6), U8(0), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), + B(StaContextSlot), R(context), U8(5), U8(0), /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateClosure), U8(0), U8(2), /* 36 E> */ B(StaLookupSlotSloppy), U8(1), /* 52 S> */ B(LdaConstant), U8(2), - B(Star), R(3), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), + B(Star), R(4), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(4), U8(1), R(1), B(LdaConstant), U8(3), B(Star), R(3), B(LdaZero), @@ -46,14 +44,14 @@ bytecodes: [ /* 62 S> */ B(LdaConstant), U8(1), B(Star), R(3), B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), - /* 69 E> */ B(Call), R(1), R(2), U8(1), U8(3), + /* 69 E> */ B(Call), R(1), R(2), U8(1), U8(4), /* 74 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["g"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["eval"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [""], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden index 2ee9613b59..56f4f3ae59 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: no test function name: f @@ -16,12 +14,12 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 11 +bytecode array length: 12 bytecodes: [ /* 45 E> */ B(StackCheck), - /* 50 S> */ B(LdrGlobal), U8(3), R(0), + /* 50 S> */ B(LdrGlobal), U8(4), R(0), B(Ldar), R(0), - /* 57 E> */ B(New), R(0), R(0), U8(0), + /* 57 E> */ B(New), R(0), R(0), U8(0), U8(2), /* 68 S> */ B(Return), ] constant pool: [ @@ -37,14 +35,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 16 bytecodes: [ /* 58 E> */ B(StackCheck), - /* 63 S> */ B(LdrGlobal), U8(3), R(0), + /* 63 S> */ B(LdrGlobal), U8(4), R(0), B(LdaSmi), U8(3), B(Star), R(1), B(Ldar), R(0), - /* 70 E> */ B(New), R(0), R(1), U8(1), + /* 70 E> */ B(New), R(0), R(1), U8(1), U8(2), /* 82 S> */ B(Return), ] constant pool: [ @@ -65,10 +63,10 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 23 +bytecode array length: 24 bytecodes: [ /* 100 E> */ B(StackCheck), - /* 105 S> */ B(LdrGlobal), U8(3), R(0), + /* 105 S> */ B(LdrGlobal), U8(4), R(0), B(LdaSmi), U8(3), B(Star), R(1), B(LdaSmi), U8(4), @@ -76,7 +74,7 @@ bytecodes: [ B(LdaSmi), U8(5), B(Star), R(3), B(Ldar), R(0), - /* 112 E> */ B(New), R(0), R(1), U8(3), + /* 112 E> */ B(New), R(0), R(1), U8(3), U8(2), /* 130 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden index aa2a994507..3d4f5f7cc7 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: no test function name: f @@ -78,13 +76,13 @@ bytecode array length: 14 bytecodes: [ /* 10 E> */ B(StackCheck), /* 15 S> */ B(LdrUndefined), R(0), - B(CreateArrayLiteral), U8(0), U8(0), U8(3), + B(CreateArrayLiteral), U8(0), U8(0), U8(9), B(Star), R(1), - B(CallJSRuntime), U8(134), R(0), U8(2), + B(CallJSRuntime), U8(141), R(0), U8(2), /* 44 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden index 865a4c3000..8a381f803f 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: no test function name: test @@ -29,20 +27,20 @@ bytecodes: [ B(Mov), R(closure), R(0), /* 99 E> */ B(StackCheck), /* 104 S> */ B(LdaConstant), U8(0), - /* 111 E> */ B(LdrKeyedProperty), R(closure), U8(3), R(4), + /* 111 E> */ B(LdrKeyedProperty), R(closure), U8(4), R(4), B(LdaConstant), U8(1), B(Star), R(5), B(Mov), R(this), R(3), B(CallRuntime), U16(Runtime::kLoadFromSuper), R(3), U8(3), B(Star), R(1), - /* 117 E> */ B(Call), R(1), R(this), U8(1), U8(1), - B(Star), R(3), - B(AddSmi), U8(1), R(3), U8(7), + /* 117 E> */ B(Call), R(1), R(this), U8(1), U8(2), + B(Star), R(1), + B(AddSmi), U8(1), R(1), U8(8), /* 131 S> */ B(Return), ] constant pool: [ - InstanceType::SYMBOL_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + SYMBOL_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["method"], ] handlers: [ ] @@ -69,7 +67,7 @@ bytecodes: [ B(Mov), R(closure), R(0), /* 125 E> */ B(StackCheck), /* 130 S> */ B(LdaConstant), U8(0), - /* 130 E> */ B(LdrKeyedProperty), R(closure), U8(1), R(2), + /* 130 E> */ B(LdrKeyedProperty), R(closure), U8(2), R(2), B(LdaConstant), U8(1), B(Star), R(3), B(LdaSmi), U8(2), @@ -77,7 +75,7 @@ bytecodes: [ B(Mov), R(this), R(1), /* 138 E> */ B(CallRuntime), U16(Runtime::kStoreToSuper_Strict), R(1), U8(4), /* 143 S> */ B(LdaConstant), U8(0), - /* 150 E> */ B(LdrKeyedProperty), R(closure), U8(3), R(2), + /* 150 E> */ B(LdrKeyedProperty), R(closure), U8(4), R(2), B(LdaConstant), U8(1), B(Star), R(3), B(Mov), R(this), R(1), @@ -85,8 +83,8 @@ bytecodes: [ /* 159 S> */ B(Return), ] constant pool: [ - InstanceType::SYMBOL_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + SYMBOL_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -106,17 +104,18 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 79 +bytecode array length: 82 bytecodes: [ B(Mov), R(closure), R(1), B(Mov), R(new_target), R(0), + B(Ldar), R(new_target), /* 113 E> */ B(StackCheck), - /* 118 S> */ B(CallRuntime), U16(Runtime::k_GetSuperConstructor), R(closure), U8(1), + /* 118 S> */ B(CallRuntime), U16(Runtime::k_GetSuperConstructor), R(1), U8(1), B(Star), R(2), B(LdaSmi), U8(1), B(Star), R(3), - B(Ldar), R(new_target), - /* 118 E> */ B(New), R(2), R(3), U8(1), + B(Ldar), R(0), + /* 118 E> */ B(New), R(2), R(3), U8(1), U8(0), B(Star), R(2), B(Ldar), R(this), B(JumpIfNotHole), U8(4), @@ -132,7 +131,7 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), B(Star), R(2), B(LdaSmi), U8(2), - /* 136 E> */ B(StaNamedPropertyStrict), R(2), U8(1), U8(4), + /* 136 E> */ B(StaNamedPropertyStrict), R(2), U8(1), U8(5), B(Ldar), R(this), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(0), @@ -141,8 +140,8 @@ bytecodes: [ /* 141 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["this"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["y_"], ] handlers: [ ] @@ -162,15 +161,16 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 75 +bytecode array length: 78 bytecodes: [ B(Mov), R(closure), R(1), B(Mov), R(new_target), R(0), + B(Ldar), R(new_target), /* 112 E> */ B(StackCheck), - /* 117 S> */ B(CallRuntime), U16(Runtime::k_GetSuperConstructor), R(closure), U8(1), + /* 117 S> */ B(CallRuntime), U16(Runtime::k_GetSuperConstructor), R(1), U8(1), B(Star), R(2), - B(Ldar), R(new_target), - /* 117 E> */ B(New), R(2), R(0), U8(0), + B(Ldar), R(0), + /* 117 E> */ B(New), R(2), R(0), U8(0), U8(0), B(Star), R(2), B(Ldar), R(this), B(JumpIfNotHole), U8(4), @@ -186,7 +186,7 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), B(Star), R(2), B(LdaSmi), U8(2), - /* 134 E> */ B(StaNamedPropertyStrict), R(2), U8(1), U8(4), + /* 134 E> */ B(StaNamedPropertyStrict), R(2), U8(1), U8(5), B(Ldar), R(this), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(0), @@ -195,8 +195,8 @@ bytecodes: [ /* 139 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["this"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["y_"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden index d7ebabc8e4..f1a15639a8 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -33,7 +31,7 @@ bytecodes: [ B(Star), R(6), B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), B(Star), R(3), - B(LdrNamedProperty), R(3), U8(1), U8(1), R(4), + B(LdrNamedProperty), R(3), U8(1), U8(2), R(4), B(LdaConstant), U8(2), B(ToName), R(6), B(CreateClosure), U8(3), U8(2), @@ -52,10 +50,10 @@ bytecodes: [ /* 149 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["prototype"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["speak"], + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -86,7 +84,7 @@ bytecodes: [ B(Star), R(6), B(CallRuntime), U16(Runtime::kDefineClass), R(3), U8(4), B(Star), R(3), - B(LdrNamedProperty), R(3), U8(1), U8(1), R(4), + B(LdrNamedProperty), R(3), U8(1), U8(2), R(4), B(LdaConstant), U8(2), B(ToName), R(6), B(CreateClosure), U8(3), U8(2), @@ -105,10 +103,10 @@ bytecodes: [ /* 149 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["prototype"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["speak"], + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -124,7 +122,7 @@ snippet: " " frame size: 11 parameter count: 1 -bytecode array length: 123 +bytecode array length: 128 bytecodes: [ B(CreateFunctionContext), U8(2), B(PushContext), R(3), @@ -132,9 +130,9 @@ bytecodes: [ B(Star), R(2), /* 30 E> */ B(StackCheck), /* 43 S> */ B(LdaConstant), U8(0), - /* 43 E> */ B(StaContextSlot), R(context), U8(4), + /* 43 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 57 S> */ B(LdaConstant), U8(1), - /* 57 E> */ B(StaContextSlot), R(context), U8(5), + /* 57 E> */ B(StaContextSlot), R(context), U8(5), U8(0), B(LdaTheHole), B(Star), R(0), /* 62 S> */ B(LdaTheHole), @@ -147,8 +145,8 @@ bytecodes: [ B(Star), R(7), B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), B(Star), R(4), - B(LdrNamedProperty), R(4), U8(3), U8(1), R(5), - /* 75 E> */ B(LdaContextSlot), R(context), U8(4), + B(LdrNamedProperty), R(4), U8(3), U8(2), R(5), + /* 75 E> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(ToName), R(7), B(CreateClosure), U8(4), U8(2), B(Star), R(8), @@ -158,10 +156,10 @@ bytecodes: [ B(Star), R(10), B(Mov), R(5), R(6), B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(6), U8(5), - /* 106 E> */ B(LdaContextSlot), R(context), U8(5), + /* 106 E> */ B(LdaContextSlot), R(context), U8(5), U8(0), B(ToName), R(7), B(LdaConstant), U8(3), - B(TestEqualStrict), R(7), + B(TestEqualStrict), R(7), U8(0), B(Mov), R(4), R(6), B(JumpIfToBooleanFalse), U8(7), B(CallRuntime), U16(Runtime::kThrowStaticPrototypeError), R(0), U8(0), @@ -178,12 +176,12 @@ bytecodes: [ /* 129 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"], + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["prototype"], + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -196,7 +194,7 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 72 +bytecode array length: 74 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(3), @@ -204,7 +202,7 @@ bytecodes: [ B(Star), R(2), /* 30 E> */ B(StackCheck), /* 46 S> */ B(LdaZero), - /* 46 E> */ B(StaContextSlot), R(context), U8(4), + /* 46 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(LdaTheHole), B(Star), R(0), /* 49 S> */ B(LdaTheHole), @@ -217,23 +215,23 @@ bytecodes: [ B(Star), R(7), B(CallRuntime), U16(Runtime::kDefineClass), R(4), U8(4), B(Star), R(4), - B(LdrNamedProperty), R(4), U8(1), U8(1), R(5), + B(LdrNamedProperty), R(4), U8(1), U8(2), R(5), B(CallRuntime), U16(Runtime::kToFastProperties), R(4), U8(1), B(Star), R(0), B(Star), R(1), B(Star), R(2), /* 87 S> */ B(JumpIfNotHole), U8(11), B(LdaConstant), U8(2), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), B(Star), R(4), - /* 94 E> */ B(New), R(4), R(0), U8(0), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), + B(Star), R(4), + /* 94 E> */ B(New), R(4), R(0), U8(0), U8(4), /* 103 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["prototype"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["C"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden index 873857a613..053bce6e0f 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -18,7 +16,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), - /* 45 S> */ B(AddSmi), U8(2), R(0), U8(1), + /* 45 S> */ B(AddSmi), U8(2), R(0), U8(2), B(Mov), R(0), R(1), B(Star), R(0), B(LdaUndefined), @@ -41,7 +39,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 45 S> */ B(LdaSmi), U8(2), - B(Div), R(0), U8(1), + B(Div), R(0), U8(2), B(Mov), R(0), R(1), B(Star), R(0), B(LdaUndefined), @@ -63,16 +61,16 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), B(Mov), R(1), R(0), - /* 54 S> */ B(LdrNamedProperty), R(0), U8(1), U8(1), R(2), + /* 54 S> */ B(LdrNamedProperty), R(0), U8(1), U8(2), R(2), B(LdaSmi), U8(2), - B(Mul), R(2), U8(3), - /* 61 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(4), + B(Mul), R(2), U8(4), + /* 61 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(5), B(LdaUndefined), /* 67 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], ] handlers: [ ] @@ -90,15 +88,15 @@ bytecodes: [ B(Mov), R(1), R(0), /* 52 S> */ B(LdaSmi), U8(1), B(Star), R(2), - B(LdrKeyedProperty), R(0), U8(1), R(3), + B(LdrKeyedProperty), R(0), U8(2), R(3), B(LdaSmi), U8(2), - B(BitwiseXor), R(3), U8(3), - /* 57 E> */ B(StaKeyedPropertySloppy), R(0), R(2), U8(4), + B(BitwiseXor), R(3), U8(4), + /* 57 E> */ B(StaKeyedPropertySloppy), R(0), R(2), U8(5), B(LdaUndefined), /* 63 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -109,22 +107,22 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 26 +bytecode array length: 29 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 45 S> */ B(CreateClosure), U8(0), U8(2), - /* 75 S> */ B(LdrContextSlot), R(context), U8(4), R(1), - B(BitwiseOrSmi), U8(24), R(1), U8(1), - /* 77 E> */ B(StaContextSlot), R(context), U8(4), + /* 75 S> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(1), + B(BitwiseOrSmi), U8(24), R(1), U8(2), + /* 77 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(LdaUndefined), /* 84 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden index ddaf989ca3..049de5a8b3 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Conditional.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- @@ -47,13 +45,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 17 +bytecode array length: 18 bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaZero), B(Star), R(0), B(LdaSmi), U8(1), - /* 43 E> */ B(TestLessThan), R(0), + /* 43 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalse), U8(6), B(LdaSmi), U8(2), B(Jump), U8(4), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden index f2120cf876..107844cf6a 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: yes --- @@ -48,7 +46,7 @@ bytecodes: [ /* 58 S> */ B(Return), ] constant pool: [ - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -77,7 +75,7 @@ bytecodes: [ /* 55 S> */ B(Return), ] constant pool: [ - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -107,7 +105,7 @@ bytecodes: [ /* 56 S> */ B(Return), ] constant pool: [ - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden index 8bc1afcf37..f1b696bdff 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -13,22 +11,22 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 21 +bytecode array length: 23 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateClosure), U8(0), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaSmi), U8(10), - /* 44 E> */ B(StaContextSlot), R(context), U8(4), + /* 44 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(LdaUndefined), /* 74 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -39,18 +37,18 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 34 +bytecode array length: 37 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateClosure), U8(0), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaSmi), U8(10), - /* 44 E> */ B(StaContextSlot), R(context), U8(4), - /* 74 S> */ B(LdaContextSlot), R(context), U8(4), + /* 44 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 74 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(1), B(Star), R(2), @@ -58,8 +56,8 @@ bytecodes: [ /* 84 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -70,30 +68,30 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 42 +bytecode array length: 45 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateClosure), U8(0), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), /* 47 S> */ B(LdaSmi), U8(20), B(Star), R(2), - /* 47 E> */ B(LdaContextSlot), R(context), U8(4), + /* 47 E> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(1), B(Star), R(3), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), - /* 47 E> */ B(StaContextSlot), R(context), U8(4), + /* 47 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(LdaUndefined), /* 80 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -104,20 +102,20 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 44 +bytecode array length: 47 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateClosure), U8(0), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaSmi), U8(10), - /* 44 E> */ B(StaContextSlot), R(context), U8(4), + /* 44 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 48 S> */ B(LdaSmi), U8(20), B(Star), R(2), - /* 50 E> */ B(LdaContextSlot), R(context), U8(4), + /* 50 E> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(1), B(Star), R(3), @@ -127,8 +125,8 @@ bytecodes: [ /* 82 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden index f07e5ce4d7..4e65f63fa2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: no test function name: f @@ -15,18 +13,18 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 14 +bytecode array length: 15 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), /* 10 E> */ B(StackCheck), /* 19 S> */ B(CreateClosure), U8(0), U8(2), /* 52 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -38,20 +36,20 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 19 +bytecode array length: 21 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), /* 10 E> */ B(StackCheck), /* 27 S> */ B(CreateClosure), U8(0), U8(2), B(Star), R(0), - /* 53 S> */ B(LdaContextSlot), R(context), U8(4), + /* 53 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), /* 66 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -63,20 +61,20 @@ snippet: " " frame size: 1 parameter count: 5 -bytecode array length: 19 +bytecode array length: 21 bytecodes: [ B(CreateFunctionContext), U8(2), B(PushContext), R(0), B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(5), + B(StaContextSlot), R(context), U8(5), U8(0), B(Ldar), R(arg2), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), /* 10 E> */ B(StackCheck), /* 29 S> */ B(CreateClosure), U8(0), U8(2), /* 61 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -88,18 +86,18 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 15 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), /* 10 E> */ B(StackCheck), /* 26 S> */ B(Ldar), R(this), - /* 26 E> */ B(StaContextSlot), R(context), U8(4), + /* 26 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 32 S> */ B(CreateClosure), U8(0), U8(2), /* 65 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden index b3226e0d64..2eb52731bb 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -22,7 +20,7 @@ bytecodes: [ /* 71 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -33,18 +31,18 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 15 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 45 S> */ B(CreateClosure), U8(0), U8(2), /* 75 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -55,20 +53,20 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 19 +bytecode array length: 21 bytecodes: [ B(CreateFunctionContext), U8(2), B(PushContext), R(0), /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 53 S> */ B(LdaSmi), U8(2), - /* 53 E> */ B(StaContextSlot), R(context), U8(5), + /* 53 E> */ B(StaContextSlot), R(context), U8(5), U8(0), /* 56 S> */ B(CreateClosure), U8(0), U8(2), /* 92 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -79,7 +77,7 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 21 +bytecode array length: 22 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), @@ -87,12 +85,12 @@ bytecodes: [ /* 41 S> */ B(LdrUndefined), R(2), B(CreateClosure), U8(0), U8(2), B(Star), R(1), - /* 64 E> */ B(Call), R(1), R(2), U8(1), U8(1), - /* 68 S> */ B(LdaContextSlot), R(context), U8(4), + /* 64 E> */ B(Call), R(1), R(2), U8(1), U8(2), + /* 68 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), /* 78 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -105,29 +103,29 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 35 +bytecode array length: 39 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), /* 30 E> */ B(StackCheck), /* 56 S> */ B(LdaSmi), U8(1), - /* 56 E> */ B(StaContextSlot), R(context), U8(4), + /* 56 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(Ldar), R(closure), B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), /* 69 S> */ B(LdaSmi), U8(2), - /* 69 E> */ B(StaContextSlot), R(context), U8(4), + /* 69 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 72 S> */ B(CreateClosure), U8(1), U8(2), B(PopContext), R(0), /* 104 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -384,528 +382,531 @@ snippet: " var a246 = 0; var a247 = 0; var a248 = 0; + var a249 = 0; eval(); var b = 100; return b " frame size: 3 parameter count: 1 -bytecode array length: 1040 +bytecode array length: 1305 bytecodes: [ - B(CreateFunctionContext), U8(253), + B(CreateFunctionContext), U8(254), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateUnmappedArguments), - B(StaContextSlot), R(context), U8(5), + B(Wide), B(StaContextSlot), R16(context), U16(257), U16(0), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), + B(StaContextSlot), R(context), U8(5), U8(0), /* 30 E> */ B(StackCheck), /* 57 S> */ B(LdaZero), - /* 57 E> */ B(StaContextSlot), R(context), U8(7), + /* 57 E> */ B(StaContextSlot), R(context), U8(6), U8(0), /* 69 S> */ B(LdaZero), - /* 69 E> */ B(StaContextSlot), R(context), U8(8), + /* 69 E> */ B(StaContextSlot), R(context), U8(7), U8(0), /* 81 S> */ B(LdaZero), - /* 81 E> */ B(StaContextSlot), R(context), U8(9), + /* 81 E> */ B(StaContextSlot), R(context), U8(8), U8(0), /* 93 S> */ B(LdaZero), - /* 93 E> */ B(StaContextSlot), R(context), U8(10), + /* 93 E> */ B(StaContextSlot), R(context), U8(9), U8(0), /* 105 S> */ B(LdaZero), - /* 105 E> */ B(StaContextSlot), R(context), U8(11), + /* 105 E> */ B(StaContextSlot), R(context), U8(10), U8(0), /* 117 S> */ B(LdaZero), - /* 117 E> */ B(StaContextSlot), R(context), U8(12), + /* 117 E> */ B(StaContextSlot), R(context), U8(11), U8(0), /* 129 S> */ B(LdaZero), - /* 129 E> */ B(StaContextSlot), R(context), U8(13), + /* 129 E> */ B(StaContextSlot), R(context), U8(12), U8(0), /* 141 S> */ B(LdaZero), - /* 141 E> */ B(StaContextSlot), R(context), U8(14), + /* 141 E> */ B(StaContextSlot), R(context), U8(13), U8(0), /* 153 S> */ B(LdaZero), - /* 153 E> */ B(StaContextSlot), R(context), U8(15), + /* 153 E> */ B(StaContextSlot), R(context), U8(14), U8(0), /* 165 S> */ B(LdaZero), - /* 165 E> */ B(StaContextSlot), R(context), U8(16), + /* 165 E> */ B(StaContextSlot), R(context), U8(15), U8(0), /* 178 S> */ B(LdaZero), - /* 178 E> */ B(StaContextSlot), R(context), U8(17), + /* 178 E> */ B(StaContextSlot), R(context), U8(16), U8(0), /* 191 S> */ B(LdaZero), - /* 191 E> */ B(StaContextSlot), R(context), U8(18), + /* 191 E> */ B(StaContextSlot), R(context), U8(17), U8(0), /* 204 S> */ B(LdaZero), - /* 204 E> */ B(StaContextSlot), R(context), U8(19), + /* 204 E> */ B(StaContextSlot), R(context), U8(18), U8(0), /* 217 S> */ B(LdaZero), - /* 217 E> */ B(StaContextSlot), R(context), U8(20), + /* 217 E> */ B(StaContextSlot), R(context), U8(19), U8(0), /* 230 S> */ B(LdaZero), - /* 230 E> */ B(StaContextSlot), R(context), U8(21), + /* 230 E> */ B(StaContextSlot), R(context), U8(20), U8(0), /* 243 S> */ B(LdaZero), - /* 243 E> */ B(StaContextSlot), R(context), U8(22), + /* 243 E> */ B(StaContextSlot), R(context), U8(21), U8(0), /* 256 S> */ B(LdaZero), - /* 256 E> */ B(StaContextSlot), R(context), U8(23), + /* 256 E> */ B(StaContextSlot), R(context), U8(22), U8(0), /* 269 S> */ B(LdaZero), - /* 269 E> */ B(StaContextSlot), R(context), U8(24), + /* 269 E> */ B(StaContextSlot), R(context), U8(23), U8(0), /* 282 S> */ B(LdaZero), - /* 282 E> */ B(StaContextSlot), R(context), U8(25), + /* 282 E> */ B(StaContextSlot), R(context), U8(24), U8(0), /* 295 S> */ B(LdaZero), - /* 295 E> */ B(StaContextSlot), R(context), U8(26), + /* 295 E> */ B(StaContextSlot), R(context), U8(25), U8(0), /* 308 S> */ B(LdaZero), - /* 308 E> */ B(StaContextSlot), R(context), U8(27), + /* 308 E> */ B(StaContextSlot), R(context), U8(26), U8(0), /* 321 S> */ B(LdaZero), - /* 321 E> */ B(StaContextSlot), R(context), U8(28), + /* 321 E> */ B(StaContextSlot), R(context), U8(27), U8(0), /* 334 S> */ B(LdaZero), - /* 334 E> */ B(StaContextSlot), R(context), U8(29), + /* 334 E> */ B(StaContextSlot), R(context), U8(28), U8(0), /* 347 S> */ B(LdaZero), - /* 347 E> */ B(StaContextSlot), R(context), U8(30), + /* 347 E> */ B(StaContextSlot), R(context), U8(29), U8(0), /* 360 S> */ B(LdaZero), - /* 360 E> */ B(StaContextSlot), R(context), U8(31), + /* 360 E> */ B(StaContextSlot), R(context), U8(30), U8(0), /* 373 S> */ B(LdaZero), - /* 373 E> */ B(StaContextSlot), R(context), U8(32), + /* 373 E> */ B(StaContextSlot), R(context), U8(31), U8(0), /* 386 S> */ B(LdaZero), - /* 386 E> */ B(StaContextSlot), R(context), U8(33), + /* 386 E> */ B(StaContextSlot), R(context), U8(32), U8(0), /* 399 S> */ B(LdaZero), - /* 399 E> */ B(StaContextSlot), R(context), U8(34), + /* 399 E> */ B(StaContextSlot), R(context), U8(33), U8(0), /* 412 S> */ B(LdaZero), - /* 412 E> */ B(StaContextSlot), R(context), U8(35), + /* 412 E> */ B(StaContextSlot), R(context), U8(34), U8(0), /* 425 S> */ B(LdaZero), - /* 425 E> */ B(StaContextSlot), R(context), U8(36), + /* 425 E> */ B(StaContextSlot), R(context), U8(35), U8(0), /* 438 S> */ B(LdaZero), - /* 438 E> */ B(StaContextSlot), R(context), U8(37), + /* 438 E> */ B(StaContextSlot), R(context), U8(36), U8(0), /* 451 S> */ B(LdaZero), - /* 451 E> */ B(StaContextSlot), R(context), U8(38), + /* 451 E> */ B(StaContextSlot), R(context), U8(37), U8(0), /* 464 S> */ B(LdaZero), - /* 464 E> */ B(StaContextSlot), R(context), U8(39), + /* 464 E> */ B(StaContextSlot), R(context), U8(38), U8(0), /* 477 S> */ B(LdaZero), - /* 477 E> */ B(StaContextSlot), R(context), U8(40), + /* 477 E> */ B(StaContextSlot), R(context), U8(39), U8(0), /* 490 S> */ B(LdaZero), - /* 490 E> */ B(StaContextSlot), R(context), U8(41), + /* 490 E> */ B(StaContextSlot), R(context), U8(40), U8(0), /* 503 S> */ B(LdaZero), - /* 503 E> */ B(StaContextSlot), R(context), U8(42), + /* 503 E> */ B(StaContextSlot), R(context), U8(41), U8(0), /* 516 S> */ B(LdaZero), - /* 516 E> */ B(StaContextSlot), R(context), U8(43), + /* 516 E> */ B(StaContextSlot), R(context), U8(42), U8(0), /* 529 S> */ B(LdaZero), - /* 529 E> */ B(StaContextSlot), R(context), U8(44), + /* 529 E> */ B(StaContextSlot), R(context), U8(43), U8(0), /* 542 S> */ B(LdaZero), - /* 542 E> */ B(StaContextSlot), R(context), U8(45), + /* 542 E> */ B(StaContextSlot), R(context), U8(44), U8(0), /* 555 S> */ B(LdaZero), - /* 555 E> */ B(StaContextSlot), R(context), U8(46), + /* 555 E> */ B(StaContextSlot), R(context), U8(45), U8(0), /* 568 S> */ B(LdaZero), - /* 568 E> */ B(StaContextSlot), R(context), U8(47), + /* 568 E> */ B(StaContextSlot), R(context), U8(46), U8(0), /* 581 S> */ B(LdaZero), - /* 581 E> */ B(StaContextSlot), R(context), U8(48), + /* 581 E> */ B(StaContextSlot), R(context), U8(47), U8(0), /* 594 S> */ B(LdaZero), - /* 594 E> */ B(StaContextSlot), R(context), U8(49), + /* 594 E> */ B(StaContextSlot), R(context), U8(48), U8(0), /* 607 S> */ B(LdaZero), - /* 607 E> */ B(StaContextSlot), R(context), U8(50), + /* 607 E> */ B(StaContextSlot), R(context), U8(49), U8(0), /* 620 S> */ B(LdaZero), - /* 620 E> */ B(StaContextSlot), R(context), U8(51), + /* 620 E> */ B(StaContextSlot), R(context), U8(50), U8(0), /* 633 S> */ B(LdaZero), - /* 633 E> */ B(StaContextSlot), R(context), U8(52), + /* 633 E> */ B(StaContextSlot), R(context), U8(51), U8(0), /* 646 S> */ B(LdaZero), - /* 646 E> */ B(StaContextSlot), R(context), U8(53), + /* 646 E> */ B(StaContextSlot), R(context), U8(52), U8(0), /* 659 S> */ B(LdaZero), - /* 659 E> */ B(StaContextSlot), R(context), U8(54), + /* 659 E> */ B(StaContextSlot), R(context), U8(53), U8(0), /* 672 S> */ B(LdaZero), - /* 672 E> */ B(StaContextSlot), R(context), U8(55), + /* 672 E> */ B(StaContextSlot), R(context), U8(54), U8(0), /* 685 S> */ B(LdaZero), - /* 685 E> */ B(StaContextSlot), R(context), U8(56), + /* 685 E> */ B(StaContextSlot), R(context), U8(55), U8(0), /* 698 S> */ B(LdaZero), - /* 698 E> */ B(StaContextSlot), R(context), U8(57), + /* 698 E> */ B(StaContextSlot), R(context), U8(56), U8(0), /* 711 S> */ B(LdaZero), - /* 711 E> */ B(StaContextSlot), R(context), U8(58), + /* 711 E> */ B(StaContextSlot), R(context), U8(57), U8(0), /* 724 S> */ B(LdaZero), - /* 724 E> */ B(StaContextSlot), R(context), U8(59), + /* 724 E> */ B(StaContextSlot), R(context), U8(58), U8(0), /* 737 S> */ B(LdaZero), - /* 737 E> */ B(StaContextSlot), R(context), U8(60), + /* 737 E> */ B(StaContextSlot), R(context), U8(59), U8(0), /* 750 S> */ B(LdaZero), - /* 750 E> */ B(StaContextSlot), R(context), U8(61), + /* 750 E> */ B(StaContextSlot), R(context), U8(60), U8(0), /* 763 S> */ B(LdaZero), - /* 763 E> */ B(StaContextSlot), R(context), U8(62), + /* 763 E> */ B(StaContextSlot), R(context), U8(61), U8(0), /* 776 S> */ B(LdaZero), - /* 776 E> */ B(StaContextSlot), R(context), U8(63), + /* 776 E> */ B(StaContextSlot), R(context), U8(62), U8(0), /* 789 S> */ B(LdaZero), - /* 789 E> */ B(StaContextSlot), R(context), U8(64), + /* 789 E> */ B(StaContextSlot), R(context), U8(63), U8(0), /* 802 S> */ B(LdaZero), - /* 802 E> */ B(StaContextSlot), R(context), U8(65), + /* 802 E> */ B(StaContextSlot), R(context), U8(64), U8(0), /* 815 S> */ B(LdaZero), - /* 815 E> */ B(StaContextSlot), R(context), U8(66), + /* 815 E> */ B(StaContextSlot), R(context), U8(65), U8(0), /* 828 S> */ B(LdaZero), - /* 828 E> */ B(StaContextSlot), R(context), U8(67), + /* 828 E> */ B(StaContextSlot), R(context), U8(66), U8(0), /* 841 S> */ B(LdaZero), - /* 841 E> */ B(StaContextSlot), R(context), U8(68), + /* 841 E> */ B(StaContextSlot), R(context), U8(67), U8(0), /* 854 S> */ B(LdaZero), - /* 854 E> */ B(StaContextSlot), R(context), U8(69), + /* 854 E> */ B(StaContextSlot), R(context), U8(68), U8(0), /* 867 S> */ B(LdaZero), - /* 867 E> */ B(StaContextSlot), R(context), U8(70), + /* 867 E> */ B(StaContextSlot), R(context), U8(69), U8(0), /* 880 S> */ B(LdaZero), - /* 880 E> */ B(StaContextSlot), R(context), U8(71), + /* 880 E> */ B(StaContextSlot), R(context), U8(70), U8(0), /* 893 S> */ B(LdaZero), - /* 893 E> */ B(StaContextSlot), R(context), U8(72), + /* 893 E> */ B(StaContextSlot), R(context), U8(71), U8(0), /* 906 S> */ B(LdaZero), - /* 906 E> */ B(StaContextSlot), R(context), U8(73), + /* 906 E> */ B(StaContextSlot), R(context), U8(72), U8(0), /* 919 S> */ B(LdaZero), - /* 919 E> */ B(StaContextSlot), R(context), U8(74), + /* 919 E> */ B(StaContextSlot), R(context), U8(73), U8(0), /* 932 S> */ B(LdaZero), - /* 932 E> */ B(StaContextSlot), R(context), U8(75), + /* 932 E> */ B(StaContextSlot), R(context), U8(74), U8(0), /* 945 S> */ B(LdaZero), - /* 945 E> */ B(StaContextSlot), R(context), U8(76), + /* 945 E> */ B(StaContextSlot), R(context), U8(75), U8(0), /* 958 S> */ B(LdaZero), - /* 958 E> */ B(StaContextSlot), R(context), U8(77), + /* 958 E> */ B(StaContextSlot), R(context), U8(76), U8(0), /* 971 S> */ B(LdaZero), - /* 971 E> */ B(StaContextSlot), R(context), U8(78), + /* 971 E> */ B(StaContextSlot), R(context), U8(77), U8(0), /* 984 S> */ B(LdaZero), - /* 984 E> */ B(StaContextSlot), R(context), U8(79), + /* 984 E> */ B(StaContextSlot), R(context), U8(78), U8(0), /* 997 S> */ B(LdaZero), - /* 997 E> */ B(StaContextSlot), R(context), U8(80), + /* 997 E> */ B(StaContextSlot), R(context), U8(79), U8(0), /* 1010 S> */ B(LdaZero), - /* 1010 E> */ B(StaContextSlot), R(context), U8(81), + /* 1010 E> */ B(StaContextSlot), R(context), U8(80), U8(0), /* 1023 S> */ B(LdaZero), - /* 1023 E> */ B(StaContextSlot), R(context), U8(82), + /* 1023 E> */ B(StaContextSlot), R(context), U8(81), U8(0), /* 1036 S> */ B(LdaZero), - /* 1036 E> */ B(StaContextSlot), R(context), U8(83), + /* 1036 E> */ B(StaContextSlot), R(context), U8(82), U8(0), /* 1049 S> */ B(LdaZero), - /* 1049 E> */ B(StaContextSlot), R(context), U8(84), + /* 1049 E> */ B(StaContextSlot), R(context), U8(83), U8(0), /* 1062 S> */ B(LdaZero), - /* 1062 E> */ B(StaContextSlot), R(context), U8(85), + /* 1062 E> */ B(StaContextSlot), R(context), U8(84), U8(0), /* 1075 S> */ B(LdaZero), - /* 1075 E> */ B(StaContextSlot), R(context), U8(86), + /* 1075 E> */ B(StaContextSlot), R(context), U8(85), U8(0), /* 1088 S> */ B(LdaZero), - /* 1088 E> */ B(StaContextSlot), R(context), U8(87), + /* 1088 E> */ B(StaContextSlot), R(context), U8(86), U8(0), /* 1101 S> */ B(LdaZero), - /* 1101 E> */ B(StaContextSlot), R(context), U8(88), + /* 1101 E> */ B(StaContextSlot), R(context), U8(87), U8(0), /* 1114 S> */ B(LdaZero), - /* 1114 E> */ B(StaContextSlot), R(context), U8(89), + /* 1114 E> */ B(StaContextSlot), R(context), U8(88), U8(0), /* 1127 S> */ B(LdaZero), - /* 1127 E> */ B(StaContextSlot), R(context), U8(90), + /* 1127 E> */ B(StaContextSlot), R(context), U8(89), U8(0), /* 1140 S> */ B(LdaZero), - /* 1140 E> */ B(StaContextSlot), R(context), U8(91), + /* 1140 E> */ B(StaContextSlot), R(context), U8(90), U8(0), /* 1153 S> */ B(LdaZero), - /* 1153 E> */ B(StaContextSlot), R(context), U8(92), + /* 1153 E> */ B(StaContextSlot), R(context), U8(91), U8(0), /* 1166 S> */ B(LdaZero), - /* 1166 E> */ B(StaContextSlot), R(context), U8(93), + /* 1166 E> */ B(StaContextSlot), R(context), U8(92), U8(0), /* 1179 S> */ B(LdaZero), - /* 1179 E> */ B(StaContextSlot), R(context), U8(94), + /* 1179 E> */ B(StaContextSlot), R(context), U8(93), U8(0), /* 1192 S> */ B(LdaZero), - /* 1192 E> */ B(StaContextSlot), R(context), U8(95), + /* 1192 E> */ B(StaContextSlot), R(context), U8(94), U8(0), /* 1205 S> */ B(LdaZero), - /* 1205 E> */ B(StaContextSlot), R(context), U8(96), + /* 1205 E> */ B(StaContextSlot), R(context), U8(95), U8(0), /* 1218 S> */ B(LdaZero), - /* 1218 E> */ B(StaContextSlot), R(context), U8(97), + /* 1218 E> */ B(StaContextSlot), R(context), U8(96), U8(0), /* 1231 S> */ B(LdaZero), - /* 1231 E> */ B(StaContextSlot), R(context), U8(98), + /* 1231 E> */ B(StaContextSlot), R(context), U8(97), U8(0), /* 1244 S> */ B(LdaZero), - /* 1244 E> */ B(StaContextSlot), R(context), U8(99), + /* 1244 E> */ B(StaContextSlot), R(context), U8(98), U8(0), /* 1257 S> */ B(LdaZero), - /* 1257 E> */ B(StaContextSlot), R(context), U8(100), + /* 1257 E> */ B(StaContextSlot), R(context), U8(99), U8(0), /* 1270 S> */ B(LdaZero), - /* 1270 E> */ B(StaContextSlot), R(context), U8(101), + /* 1270 E> */ B(StaContextSlot), R(context), U8(100), U8(0), /* 1283 S> */ B(LdaZero), - /* 1283 E> */ B(StaContextSlot), R(context), U8(102), + /* 1283 E> */ B(StaContextSlot), R(context), U8(101), U8(0), /* 1296 S> */ B(LdaZero), - /* 1296 E> */ B(StaContextSlot), R(context), U8(103), + /* 1296 E> */ B(StaContextSlot), R(context), U8(102), U8(0), /* 1309 S> */ B(LdaZero), - /* 1309 E> */ B(StaContextSlot), R(context), U8(104), + /* 1309 E> */ B(StaContextSlot), R(context), U8(103), U8(0), /* 1322 S> */ B(LdaZero), - /* 1322 E> */ B(StaContextSlot), R(context), U8(105), + /* 1322 E> */ B(StaContextSlot), R(context), U8(104), U8(0), /* 1335 S> */ B(LdaZero), - /* 1335 E> */ B(StaContextSlot), R(context), U8(106), + /* 1335 E> */ B(StaContextSlot), R(context), U8(105), U8(0), /* 1349 S> */ B(LdaZero), - /* 1349 E> */ B(StaContextSlot), R(context), U8(107), + /* 1349 E> */ B(StaContextSlot), R(context), U8(106), U8(0), /* 1363 S> */ B(LdaZero), - /* 1363 E> */ B(StaContextSlot), R(context), U8(108), + /* 1363 E> */ B(StaContextSlot), R(context), U8(107), U8(0), /* 1377 S> */ B(LdaZero), - /* 1377 E> */ B(StaContextSlot), R(context), U8(109), + /* 1377 E> */ B(StaContextSlot), R(context), U8(108), U8(0), /* 1391 S> */ B(LdaZero), - /* 1391 E> */ B(StaContextSlot), R(context), U8(110), + /* 1391 E> */ B(StaContextSlot), R(context), U8(109), U8(0), /* 1405 S> */ B(LdaZero), - /* 1405 E> */ B(StaContextSlot), R(context), U8(111), + /* 1405 E> */ B(StaContextSlot), R(context), U8(110), U8(0), /* 1419 S> */ B(LdaZero), - /* 1419 E> */ B(StaContextSlot), R(context), U8(112), + /* 1419 E> */ B(StaContextSlot), R(context), U8(111), U8(0), /* 1433 S> */ B(LdaZero), - /* 1433 E> */ B(StaContextSlot), R(context), U8(113), + /* 1433 E> */ B(StaContextSlot), R(context), U8(112), U8(0), /* 1447 S> */ B(LdaZero), - /* 1447 E> */ B(StaContextSlot), R(context), U8(114), + /* 1447 E> */ B(StaContextSlot), R(context), U8(113), U8(0), /* 1461 S> */ B(LdaZero), - /* 1461 E> */ B(StaContextSlot), R(context), U8(115), + /* 1461 E> */ B(StaContextSlot), R(context), U8(114), U8(0), /* 1475 S> */ B(LdaZero), - /* 1475 E> */ B(StaContextSlot), R(context), U8(116), + /* 1475 E> */ B(StaContextSlot), R(context), U8(115), U8(0), /* 1489 S> */ B(LdaZero), - /* 1489 E> */ B(StaContextSlot), R(context), U8(117), + /* 1489 E> */ B(StaContextSlot), R(context), U8(116), U8(0), /* 1503 S> */ B(LdaZero), - /* 1503 E> */ B(StaContextSlot), R(context), U8(118), + /* 1503 E> */ B(StaContextSlot), R(context), U8(117), U8(0), /* 1517 S> */ B(LdaZero), - /* 1517 E> */ B(StaContextSlot), R(context), U8(119), + /* 1517 E> */ B(StaContextSlot), R(context), U8(118), U8(0), /* 1531 S> */ B(LdaZero), - /* 1531 E> */ B(StaContextSlot), R(context), U8(120), + /* 1531 E> */ B(StaContextSlot), R(context), U8(119), U8(0), /* 1545 S> */ B(LdaZero), - /* 1545 E> */ B(StaContextSlot), R(context), U8(121), + /* 1545 E> */ B(StaContextSlot), R(context), U8(120), U8(0), /* 1559 S> */ B(LdaZero), - /* 1559 E> */ B(StaContextSlot), R(context), U8(122), + /* 1559 E> */ B(StaContextSlot), R(context), U8(121), U8(0), /* 1573 S> */ B(LdaZero), - /* 1573 E> */ B(StaContextSlot), R(context), U8(123), + /* 1573 E> */ B(StaContextSlot), R(context), U8(122), U8(0), /* 1587 S> */ B(LdaZero), - /* 1587 E> */ B(StaContextSlot), R(context), U8(124), + /* 1587 E> */ B(StaContextSlot), R(context), U8(123), U8(0), /* 1601 S> */ B(LdaZero), - /* 1601 E> */ B(StaContextSlot), R(context), U8(125), + /* 1601 E> */ B(StaContextSlot), R(context), U8(124), U8(0), /* 1615 S> */ B(LdaZero), - /* 1615 E> */ B(StaContextSlot), R(context), U8(126), + /* 1615 E> */ B(StaContextSlot), R(context), U8(125), U8(0), /* 1629 S> */ B(LdaZero), - /* 1629 E> */ B(StaContextSlot), R(context), U8(127), + /* 1629 E> */ B(StaContextSlot), R(context), U8(126), U8(0), /* 1643 S> */ B(LdaZero), - /* 1643 E> */ B(StaContextSlot), R(context), U8(128), + /* 1643 E> */ B(StaContextSlot), R(context), U8(127), U8(0), /* 1657 S> */ B(LdaZero), - /* 1657 E> */ B(StaContextSlot), R(context), U8(129), + /* 1657 E> */ B(StaContextSlot), R(context), U8(128), U8(0), /* 1671 S> */ B(LdaZero), - /* 1671 E> */ B(StaContextSlot), R(context), U8(130), + /* 1671 E> */ B(StaContextSlot), R(context), U8(129), U8(0), /* 1685 S> */ B(LdaZero), - /* 1685 E> */ B(StaContextSlot), R(context), U8(131), + /* 1685 E> */ B(StaContextSlot), R(context), U8(130), U8(0), /* 1699 S> */ B(LdaZero), - /* 1699 E> */ B(StaContextSlot), R(context), U8(132), + /* 1699 E> */ B(StaContextSlot), R(context), U8(131), U8(0), /* 1713 S> */ B(LdaZero), - /* 1713 E> */ B(StaContextSlot), R(context), U8(133), + /* 1713 E> */ B(StaContextSlot), R(context), U8(132), U8(0), /* 1727 S> */ B(LdaZero), - /* 1727 E> */ B(StaContextSlot), R(context), U8(134), + /* 1727 E> */ B(StaContextSlot), R(context), U8(133), U8(0), /* 1741 S> */ B(LdaZero), - /* 1741 E> */ B(StaContextSlot), R(context), U8(135), + /* 1741 E> */ B(StaContextSlot), R(context), U8(134), U8(0), /* 1755 S> */ B(LdaZero), - /* 1755 E> */ B(StaContextSlot), R(context), U8(136), + /* 1755 E> */ B(StaContextSlot), R(context), U8(135), U8(0), /* 1769 S> */ B(LdaZero), - /* 1769 E> */ B(StaContextSlot), R(context), U8(137), + /* 1769 E> */ B(StaContextSlot), R(context), U8(136), U8(0), /* 1783 S> */ B(LdaZero), - /* 1783 E> */ B(StaContextSlot), R(context), U8(138), + /* 1783 E> */ B(StaContextSlot), R(context), U8(137), U8(0), /* 1797 S> */ B(LdaZero), - /* 1797 E> */ B(StaContextSlot), R(context), U8(139), + /* 1797 E> */ B(StaContextSlot), R(context), U8(138), U8(0), /* 1811 S> */ B(LdaZero), - /* 1811 E> */ B(StaContextSlot), R(context), U8(140), + /* 1811 E> */ B(StaContextSlot), R(context), U8(139), U8(0), /* 1825 S> */ B(LdaZero), - /* 1825 E> */ B(StaContextSlot), R(context), U8(141), + /* 1825 E> */ B(StaContextSlot), R(context), U8(140), U8(0), /* 1839 S> */ B(LdaZero), - /* 1839 E> */ B(StaContextSlot), R(context), U8(142), + /* 1839 E> */ B(StaContextSlot), R(context), U8(141), U8(0), /* 1853 S> */ B(LdaZero), - /* 1853 E> */ B(StaContextSlot), R(context), U8(143), + /* 1853 E> */ B(StaContextSlot), R(context), U8(142), U8(0), /* 1867 S> */ B(LdaZero), - /* 1867 E> */ B(StaContextSlot), R(context), U8(144), + /* 1867 E> */ B(StaContextSlot), R(context), U8(143), U8(0), /* 1881 S> */ B(LdaZero), - /* 1881 E> */ B(StaContextSlot), R(context), U8(145), + /* 1881 E> */ B(StaContextSlot), R(context), U8(144), U8(0), /* 1895 S> */ B(LdaZero), - /* 1895 E> */ B(StaContextSlot), R(context), U8(146), + /* 1895 E> */ B(StaContextSlot), R(context), U8(145), U8(0), /* 1909 S> */ B(LdaZero), - /* 1909 E> */ B(StaContextSlot), R(context), U8(147), + /* 1909 E> */ B(StaContextSlot), R(context), U8(146), U8(0), /* 1923 S> */ B(LdaZero), - /* 1923 E> */ B(StaContextSlot), R(context), U8(148), + /* 1923 E> */ B(StaContextSlot), R(context), U8(147), U8(0), /* 1937 S> */ B(LdaZero), - /* 1937 E> */ B(StaContextSlot), R(context), U8(149), + /* 1937 E> */ B(StaContextSlot), R(context), U8(148), U8(0), /* 1951 S> */ B(LdaZero), - /* 1951 E> */ B(StaContextSlot), R(context), U8(150), + /* 1951 E> */ B(StaContextSlot), R(context), U8(149), U8(0), /* 1965 S> */ B(LdaZero), - /* 1965 E> */ B(StaContextSlot), R(context), U8(151), + /* 1965 E> */ B(StaContextSlot), R(context), U8(150), U8(0), /* 1979 S> */ B(LdaZero), - /* 1979 E> */ B(StaContextSlot), R(context), U8(152), + /* 1979 E> */ B(StaContextSlot), R(context), U8(151), U8(0), /* 1993 S> */ B(LdaZero), - /* 1993 E> */ B(StaContextSlot), R(context), U8(153), + /* 1993 E> */ B(StaContextSlot), R(context), U8(152), U8(0), /* 2007 S> */ B(LdaZero), - /* 2007 E> */ B(StaContextSlot), R(context), U8(154), + /* 2007 E> */ B(StaContextSlot), R(context), U8(153), U8(0), /* 2021 S> */ B(LdaZero), - /* 2021 E> */ B(StaContextSlot), R(context), U8(155), + /* 2021 E> */ B(StaContextSlot), R(context), U8(154), U8(0), /* 2035 S> */ B(LdaZero), - /* 2035 E> */ B(StaContextSlot), R(context), U8(156), + /* 2035 E> */ B(StaContextSlot), R(context), U8(155), U8(0), /* 2049 S> */ B(LdaZero), - /* 2049 E> */ B(StaContextSlot), R(context), U8(157), + /* 2049 E> */ B(StaContextSlot), R(context), U8(156), U8(0), /* 2063 S> */ B(LdaZero), - /* 2063 E> */ B(StaContextSlot), R(context), U8(158), + /* 2063 E> */ B(StaContextSlot), R(context), U8(157), U8(0), /* 2077 S> */ B(LdaZero), - /* 2077 E> */ B(StaContextSlot), R(context), U8(159), + /* 2077 E> */ B(StaContextSlot), R(context), U8(158), U8(0), /* 2091 S> */ B(LdaZero), - /* 2091 E> */ B(StaContextSlot), R(context), U8(160), + /* 2091 E> */ B(StaContextSlot), R(context), U8(159), U8(0), /* 2105 S> */ B(LdaZero), - /* 2105 E> */ B(StaContextSlot), R(context), U8(161), + /* 2105 E> */ B(StaContextSlot), R(context), U8(160), U8(0), /* 2119 S> */ B(LdaZero), - /* 2119 E> */ B(StaContextSlot), R(context), U8(162), + /* 2119 E> */ B(StaContextSlot), R(context), U8(161), U8(0), /* 2133 S> */ B(LdaZero), - /* 2133 E> */ B(StaContextSlot), R(context), U8(163), + /* 2133 E> */ B(StaContextSlot), R(context), U8(162), U8(0), /* 2147 S> */ B(LdaZero), - /* 2147 E> */ B(StaContextSlot), R(context), U8(164), + /* 2147 E> */ B(StaContextSlot), R(context), U8(163), U8(0), /* 2161 S> */ B(LdaZero), - /* 2161 E> */ B(StaContextSlot), R(context), U8(165), + /* 2161 E> */ B(StaContextSlot), R(context), U8(164), U8(0), /* 2175 S> */ B(LdaZero), - /* 2175 E> */ B(StaContextSlot), R(context), U8(166), + /* 2175 E> */ B(StaContextSlot), R(context), U8(165), U8(0), /* 2189 S> */ B(LdaZero), - /* 2189 E> */ B(StaContextSlot), R(context), U8(167), + /* 2189 E> */ B(StaContextSlot), R(context), U8(166), U8(0), /* 2203 S> */ B(LdaZero), - /* 2203 E> */ B(StaContextSlot), R(context), U8(168), + /* 2203 E> */ B(StaContextSlot), R(context), U8(167), U8(0), /* 2217 S> */ B(LdaZero), - /* 2217 E> */ B(StaContextSlot), R(context), U8(169), + /* 2217 E> */ B(StaContextSlot), R(context), U8(168), U8(0), /* 2231 S> */ B(LdaZero), - /* 2231 E> */ B(StaContextSlot), R(context), U8(170), + /* 2231 E> */ B(StaContextSlot), R(context), U8(169), U8(0), /* 2245 S> */ B(LdaZero), - /* 2245 E> */ B(StaContextSlot), R(context), U8(171), + /* 2245 E> */ B(StaContextSlot), R(context), U8(170), U8(0), /* 2259 S> */ B(LdaZero), - /* 2259 E> */ B(StaContextSlot), R(context), U8(172), + /* 2259 E> */ B(StaContextSlot), R(context), U8(171), U8(0), /* 2273 S> */ B(LdaZero), - /* 2273 E> */ B(StaContextSlot), R(context), U8(173), + /* 2273 E> */ B(StaContextSlot), R(context), U8(172), U8(0), /* 2287 S> */ B(LdaZero), - /* 2287 E> */ B(StaContextSlot), R(context), U8(174), + /* 2287 E> */ B(StaContextSlot), R(context), U8(173), U8(0), /* 2301 S> */ B(LdaZero), - /* 2301 E> */ B(StaContextSlot), R(context), U8(175), + /* 2301 E> */ B(StaContextSlot), R(context), U8(174), U8(0), /* 2315 S> */ B(LdaZero), - /* 2315 E> */ B(StaContextSlot), R(context), U8(176), + /* 2315 E> */ B(StaContextSlot), R(context), U8(175), U8(0), /* 2329 S> */ B(LdaZero), - /* 2329 E> */ B(StaContextSlot), R(context), U8(177), + /* 2329 E> */ B(StaContextSlot), R(context), U8(176), U8(0), /* 2343 S> */ B(LdaZero), - /* 2343 E> */ B(StaContextSlot), R(context), U8(178), + /* 2343 E> */ B(StaContextSlot), R(context), U8(177), U8(0), /* 2357 S> */ B(LdaZero), - /* 2357 E> */ B(StaContextSlot), R(context), U8(179), + /* 2357 E> */ B(StaContextSlot), R(context), U8(178), U8(0), /* 2371 S> */ B(LdaZero), - /* 2371 E> */ B(StaContextSlot), R(context), U8(180), + /* 2371 E> */ B(StaContextSlot), R(context), U8(179), U8(0), /* 2385 S> */ B(LdaZero), - /* 2385 E> */ B(StaContextSlot), R(context), U8(181), + /* 2385 E> */ B(StaContextSlot), R(context), U8(180), U8(0), /* 2399 S> */ B(LdaZero), - /* 2399 E> */ B(StaContextSlot), R(context), U8(182), + /* 2399 E> */ B(StaContextSlot), R(context), U8(181), U8(0), /* 2413 S> */ B(LdaZero), - /* 2413 E> */ B(StaContextSlot), R(context), U8(183), + /* 2413 E> */ B(StaContextSlot), R(context), U8(182), U8(0), /* 2427 S> */ B(LdaZero), - /* 2427 E> */ B(StaContextSlot), R(context), U8(184), + /* 2427 E> */ B(StaContextSlot), R(context), U8(183), U8(0), /* 2441 S> */ B(LdaZero), - /* 2441 E> */ B(StaContextSlot), R(context), U8(185), + /* 2441 E> */ B(StaContextSlot), R(context), U8(184), U8(0), /* 2455 S> */ B(LdaZero), - /* 2455 E> */ B(StaContextSlot), R(context), U8(186), + /* 2455 E> */ B(StaContextSlot), R(context), U8(185), U8(0), /* 2469 S> */ B(LdaZero), - /* 2469 E> */ B(StaContextSlot), R(context), U8(187), + /* 2469 E> */ B(StaContextSlot), R(context), U8(186), U8(0), /* 2483 S> */ B(LdaZero), - /* 2483 E> */ B(StaContextSlot), R(context), U8(188), + /* 2483 E> */ B(StaContextSlot), R(context), U8(187), U8(0), /* 2497 S> */ B(LdaZero), - /* 2497 E> */ B(StaContextSlot), R(context), U8(189), + /* 2497 E> */ B(StaContextSlot), R(context), U8(188), U8(0), /* 2511 S> */ B(LdaZero), - /* 2511 E> */ B(StaContextSlot), R(context), U8(190), + /* 2511 E> */ B(StaContextSlot), R(context), U8(189), U8(0), /* 2525 S> */ B(LdaZero), - /* 2525 E> */ B(StaContextSlot), R(context), U8(191), + /* 2525 E> */ B(StaContextSlot), R(context), U8(190), U8(0), /* 2539 S> */ B(LdaZero), - /* 2539 E> */ B(StaContextSlot), R(context), U8(192), + /* 2539 E> */ B(StaContextSlot), R(context), U8(191), U8(0), /* 2553 S> */ B(LdaZero), - /* 2553 E> */ B(StaContextSlot), R(context), U8(193), + /* 2553 E> */ B(StaContextSlot), R(context), U8(192), U8(0), /* 2567 S> */ B(LdaZero), - /* 2567 E> */ B(StaContextSlot), R(context), U8(194), + /* 2567 E> */ B(StaContextSlot), R(context), U8(193), U8(0), /* 2581 S> */ B(LdaZero), - /* 2581 E> */ B(StaContextSlot), R(context), U8(195), + /* 2581 E> */ B(StaContextSlot), R(context), U8(194), U8(0), /* 2595 S> */ B(LdaZero), - /* 2595 E> */ B(StaContextSlot), R(context), U8(196), + /* 2595 E> */ B(StaContextSlot), R(context), U8(195), U8(0), /* 2609 S> */ B(LdaZero), - /* 2609 E> */ B(StaContextSlot), R(context), U8(197), + /* 2609 E> */ B(StaContextSlot), R(context), U8(196), U8(0), /* 2623 S> */ B(LdaZero), - /* 2623 E> */ B(StaContextSlot), R(context), U8(198), + /* 2623 E> */ B(StaContextSlot), R(context), U8(197), U8(0), /* 2637 S> */ B(LdaZero), - /* 2637 E> */ B(StaContextSlot), R(context), U8(199), + /* 2637 E> */ B(StaContextSlot), R(context), U8(198), U8(0), /* 2651 S> */ B(LdaZero), - /* 2651 E> */ B(StaContextSlot), R(context), U8(200), + /* 2651 E> */ B(StaContextSlot), R(context), U8(199), U8(0), /* 2665 S> */ B(LdaZero), - /* 2665 E> */ B(StaContextSlot), R(context), U8(201), + /* 2665 E> */ B(StaContextSlot), R(context), U8(200), U8(0), /* 2679 S> */ B(LdaZero), - /* 2679 E> */ B(StaContextSlot), R(context), U8(202), + /* 2679 E> */ B(StaContextSlot), R(context), U8(201), U8(0), /* 2693 S> */ B(LdaZero), - /* 2693 E> */ B(StaContextSlot), R(context), U8(203), + /* 2693 E> */ B(StaContextSlot), R(context), U8(202), U8(0), /* 2707 S> */ B(LdaZero), - /* 2707 E> */ B(StaContextSlot), R(context), U8(204), + /* 2707 E> */ B(StaContextSlot), R(context), U8(203), U8(0), /* 2721 S> */ B(LdaZero), - /* 2721 E> */ B(StaContextSlot), R(context), U8(205), + /* 2721 E> */ B(StaContextSlot), R(context), U8(204), U8(0), /* 2735 S> */ B(LdaZero), - /* 2735 E> */ B(StaContextSlot), R(context), U8(206), + /* 2735 E> */ B(StaContextSlot), R(context), U8(205), U8(0), /* 2749 S> */ B(LdaZero), - /* 2749 E> */ B(StaContextSlot), R(context), U8(207), + /* 2749 E> */ B(StaContextSlot), R(context), U8(206), U8(0), /* 2763 S> */ B(LdaZero), - /* 2763 E> */ B(StaContextSlot), R(context), U8(208), + /* 2763 E> */ B(StaContextSlot), R(context), U8(207), U8(0), /* 2777 S> */ B(LdaZero), - /* 2777 E> */ B(StaContextSlot), R(context), U8(209), + /* 2777 E> */ B(StaContextSlot), R(context), U8(208), U8(0), /* 2791 S> */ B(LdaZero), - /* 2791 E> */ B(StaContextSlot), R(context), U8(210), + /* 2791 E> */ B(StaContextSlot), R(context), U8(209), U8(0), /* 2805 S> */ B(LdaZero), - /* 2805 E> */ B(StaContextSlot), R(context), U8(211), + /* 2805 E> */ B(StaContextSlot), R(context), U8(210), U8(0), /* 2819 S> */ B(LdaZero), - /* 2819 E> */ B(StaContextSlot), R(context), U8(212), + /* 2819 E> */ B(StaContextSlot), R(context), U8(211), U8(0), /* 2833 S> */ B(LdaZero), - /* 2833 E> */ B(StaContextSlot), R(context), U8(213), + /* 2833 E> */ B(StaContextSlot), R(context), U8(212), U8(0), /* 2847 S> */ B(LdaZero), - /* 2847 E> */ B(StaContextSlot), R(context), U8(214), + /* 2847 E> */ B(StaContextSlot), R(context), U8(213), U8(0), /* 2861 S> */ B(LdaZero), - /* 2861 E> */ B(StaContextSlot), R(context), U8(215), + /* 2861 E> */ B(StaContextSlot), R(context), U8(214), U8(0), /* 2875 S> */ B(LdaZero), - /* 2875 E> */ B(StaContextSlot), R(context), U8(216), + /* 2875 E> */ B(StaContextSlot), R(context), U8(215), U8(0), /* 2889 S> */ B(LdaZero), - /* 2889 E> */ B(StaContextSlot), R(context), U8(217), + /* 2889 E> */ B(StaContextSlot), R(context), U8(216), U8(0), /* 2903 S> */ B(LdaZero), - /* 2903 E> */ B(StaContextSlot), R(context), U8(218), + /* 2903 E> */ B(StaContextSlot), R(context), U8(217), U8(0), /* 2917 S> */ B(LdaZero), - /* 2917 E> */ B(StaContextSlot), R(context), U8(219), + /* 2917 E> */ B(StaContextSlot), R(context), U8(218), U8(0), /* 2931 S> */ B(LdaZero), - /* 2931 E> */ B(StaContextSlot), R(context), U8(220), + /* 2931 E> */ B(StaContextSlot), R(context), U8(219), U8(0), /* 2945 S> */ B(LdaZero), - /* 2945 E> */ B(StaContextSlot), R(context), U8(221), + /* 2945 E> */ B(StaContextSlot), R(context), U8(220), U8(0), /* 2959 S> */ B(LdaZero), - /* 2959 E> */ B(StaContextSlot), R(context), U8(222), + /* 2959 E> */ B(StaContextSlot), R(context), U8(221), U8(0), /* 2973 S> */ B(LdaZero), - /* 2973 E> */ B(StaContextSlot), R(context), U8(223), + /* 2973 E> */ B(StaContextSlot), R(context), U8(222), U8(0), /* 2987 S> */ B(LdaZero), - /* 2987 E> */ B(StaContextSlot), R(context), U8(224), + /* 2987 E> */ B(StaContextSlot), R(context), U8(223), U8(0), /* 3001 S> */ B(LdaZero), - /* 3001 E> */ B(StaContextSlot), R(context), U8(225), + /* 3001 E> */ B(StaContextSlot), R(context), U8(224), U8(0), /* 3015 S> */ B(LdaZero), - /* 3015 E> */ B(StaContextSlot), R(context), U8(226), + /* 3015 E> */ B(StaContextSlot), R(context), U8(225), U8(0), /* 3029 S> */ B(LdaZero), - /* 3029 E> */ B(StaContextSlot), R(context), U8(227), + /* 3029 E> */ B(StaContextSlot), R(context), U8(226), U8(0), /* 3043 S> */ B(LdaZero), - /* 3043 E> */ B(StaContextSlot), R(context), U8(228), + /* 3043 E> */ B(StaContextSlot), R(context), U8(227), U8(0), /* 3057 S> */ B(LdaZero), - /* 3057 E> */ B(StaContextSlot), R(context), U8(229), + /* 3057 E> */ B(StaContextSlot), R(context), U8(228), U8(0), /* 3071 S> */ B(LdaZero), - /* 3071 E> */ B(StaContextSlot), R(context), U8(230), + /* 3071 E> */ B(StaContextSlot), R(context), U8(229), U8(0), /* 3085 S> */ B(LdaZero), - /* 3085 E> */ B(StaContextSlot), R(context), U8(231), + /* 3085 E> */ B(StaContextSlot), R(context), U8(230), U8(0), /* 3099 S> */ B(LdaZero), - /* 3099 E> */ B(StaContextSlot), R(context), U8(232), + /* 3099 E> */ B(StaContextSlot), R(context), U8(231), U8(0), /* 3113 S> */ B(LdaZero), - /* 3113 E> */ B(StaContextSlot), R(context), U8(233), + /* 3113 E> */ B(StaContextSlot), R(context), U8(232), U8(0), /* 3127 S> */ B(LdaZero), - /* 3127 E> */ B(StaContextSlot), R(context), U8(234), + /* 3127 E> */ B(StaContextSlot), R(context), U8(233), U8(0), /* 3141 S> */ B(LdaZero), - /* 3141 E> */ B(StaContextSlot), R(context), U8(235), + /* 3141 E> */ B(StaContextSlot), R(context), U8(234), U8(0), /* 3155 S> */ B(LdaZero), - /* 3155 E> */ B(StaContextSlot), R(context), U8(236), + /* 3155 E> */ B(StaContextSlot), R(context), U8(235), U8(0), /* 3169 S> */ B(LdaZero), - /* 3169 E> */ B(StaContextSlot), R(context), U8(237), + /* 3169 E> */ B(StaContextSlot), R(context), U8(236), U8(0), /* 3183 S> */ B(LdaZero), - /* 3183 E> */ B(StaContextSlot), R(context), U8(238), + /* 3183 E> */ B(StaContextSlot), R(context), U8(237), U8(0), /* 3197 S> */ B(LdaZero), - /* 3197 E> */ B(StaContextSlot), R(context), U8(239), + /* 3197 E> */ B(StaContextSlot), R(context), U8(238), U8(0), /* 3211 S> */ B(LdaZero), - /* 3211 E> */ B(StaContextSlot), R(context), U8(240), + /* 3211 E> */ B(StaContextSlot), R(context), U8(239), U8(0), /* 3225 S> */ B(LdaZero), - /* 3225 E> */ B(StaContextSlot), R(context), U8(241), + /* 3225 E> */ B(StaContextSlot), R(context), U8(240), U8(0), /* 3239 S> */ B(LdaZero), - /* 3239 E> */ B(StaContextSlot), R(context), U8(242), + /* 3239 E> */ B(StaContextSlot), R(context), U8(241), U8(0), /* 3253 S> */ B(LdaZero), - /* 3253 E> */ B(StaContextSlot), R(context), U8(243), + /* 3253 E> */ B(StaContextSlot), R(context), U8(242), U8(0), /* 3267 S> */ B(LdaZero), - /* 3267 E> */ B(StaContextSlot), R(context), U8(244), + /* 3267 E> */ B(StaContextSlot), R(context), U8(243), U8(0), /* 3281 S> */ B(LdaZero), - /* 3281 E> */ B(StaContextSlot), R(context), U8(245), + /* 3281 E> */ B(StaContextSlot), R(context), U8(244), U8(0), /* 3295 S> */ B(LdaZero), - /* 3295 E> */ B(StaContextSlot), R(context), U8(246), + /* 3295 E> */ B(StaContextSlot), R(context), U8(245), U8(0), /* 3309 S> */ B(LdaZero), - /* 3309 E> */ B(StaContextSlot), R(context), U8(247), + /* 3309 E> */ B(StaContextSlot), R(context), U8(246), U8(0), /* 3323 S> */ B(LdaZero), - /* 3323 E> */ B(StaContextSlot), R(context), U8(248), + /* 3323 E> */ B(StaContextSlot), R(context), U8(247), U8(0), /* 3337 S> */ B(LdaZero), - /* 3337 E> */ B(StaContextSlot), R(context), U8(249), + /* 3337 E> */ B(StaContextSlot), R(context), U8(248), U8(0), /* 3351 S> */ B(LdaZero), - /* 3351 E> */ B(StaContextSlot), R(context), U8(250), + /* 3351 E> */ B(StaContextSlot), R(context), U8(249), U8(0), /* 3365 S> */ B(LdaZero), - /* 3365 E> */ B(StaContextSlot), R(context), U8(251), + /* 3365 E> */ B(StaContextSlot), R(context), U8(250), U8(0), /* 3379 S> */ B(LdaZero), - /* 3379 E> */ B(StaContextSlot), R(context), U8(252), + /* 3379 E> */ B(StaContextSlot), R(context), U8(251), U8(0), /* 3393 S> */ B(LdaZero), - /* 3393 E> */ B(StaContextSlot), R(context), U8(253), + /* 3393 E> */ B(StaContextSlot), R(context), U8(252), U8(0), /* 3407 S> */ B(LdaZero), - /* 3407 E> */ B(StaContextSlot), R(context), U8(254), + /* 3407 E> */ B(StaContextSlot), R(context), U8(253), U8(0), /* 3421 S> */ B(LdaZero), - /* 3421 E> */ B(StaContextSlot), R(context), U8(255), - /* 3424 S> */ B(LdrUndefined), R(2), - /* 3424 E> */ B(LdrGlobal), U8(1), R(1), - /* 3424 E> */ B(Call), R(1), R(2), U8(1), U8(0), - /* 3440 S> */ B(LdaSmi), U8(100), - /* 3440 E> */ B(Wide), B(StaContextSlot), R16(context), U16(256), - /* 3445 S> */ B(Wide), B(LdaContextSlot), R16(context), U16(256), - /* 3454 S> */ B(Return), + /* 3421 E> */ B(StaContextSlot), R(context), U8(254), U8(0), + /* 3435 S> */ B(LdaZero), + /* 3435 E> */ B(StaContextSlot), R(context), U8(255), U8(0), + /* 3438 S> */ B(LdrUndefined), R(2), + /* 3438 E> */ B(LdrGlobal), U8(2), R(1), + /* 3438 E> */ B(Call), R(1), R(2), U8(1), U8(0), + /* 3454 S> */ B(LdaSmi), U8(100), + /* 3454 E> */ B(Wide), B(StaContextSlot), R16(context), U16(256), U16(0), + /* 3459 S> */ B(Wide), B(LdaContextSlot), R16(context), U16(256), U16(0), + /* 3468 S> */ B(Return), ] constant pool: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden index aef4e1456c..29e0ec3582 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -18,7 +16,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), - /* 45 S> */ B(Inc), U8(1), + /* 45 S> */ B(Inc), U8(2), B(Star), R(0), /* 57 S> */ B(Return), ] @@ -39,7 +37,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 45 S> */ B(ToNumber), R(1), - B(Inc), U8(1), + B(Inc), U8(2), B(Star), R(0), B(Ldar), R(1), /* 57 S> */ B(Return), @@ -60,7 +58,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), - /* 45 S> */ B(Dec), U8(1), + /* 45 S> */ B(Dec), U8(2), B(Star), R(0), /* 57 S> */ B(Return), ] @@ -81,7 +79,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 45 S> */ B(ToNumber), R(1), - B(Dec), U8(1), + B(Dec), U8(2), B(Star), R(0), B(Ldar), R(1), /* 57 S> */ B(Return), @@ -102,16 +100,16 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), B(Mov), R(1), R(0), - /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(1), + /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(2), B(ToNumber), R(2), - B(Inc), U8(5), - /* 66 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(3), + B(Inc), U8(6), + /* 66 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(4), B(Ldar), R(2), /* 70 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], ] handlers: [ ] @@ -127,14 +125,14 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), B(Mov), R(1), R(0), - /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(1), - B(Dec), U8(5), - /* 65 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(3), + /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(2), + B(Dec), U8(6), + /* 65 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(4), /* 70 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], ] handlers: [ ] @@ -153,16 +151,16 @@ bytecodes: [ /* 60 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(1), R(2), B(Mov), R(2), R(1), /* 72 S> */ B(Ldar), R(0), - /* 81 E> */ B(LdaKeyedProperty), R(1), U8(1), + /* 81 E> */ B(LdaKeyedProperty), R(1), U8(2), B(ToNumber), R(4), - B(Dec), U8(5), - /* 86 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(3), + B(Dec), U8(6), + /* 86 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(4), B(Ldar), R(4), /* 90 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["var"], + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -181,14 +179,14 @@ bytecodes: [ /* 60 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(1), R(2), B(Mov), R(2), R(1), /* 72 S> */ B(Ldar), R(0), - /* 83 E> */ B(LdaKeyedProperty), R(1), U8(1), - B(Inc), U8(5), - /* 87 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(3), + /* 83 E> */ B(LdaKeyedProperty), R(1), U8(2), + B(Inc), U8(6), + /* 87 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(4), /* 90 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["var"], + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -199,22 +197,22 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 24 +bytecode array length: 27 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 53 S> */ B(CreateClosure), U8(0), U8(2), B(Star), R(0), - /* 78 S> */ B(LdaContextSlot), R(context), U8(4), - B(Inc), U8(1), - /* 87 E> */ B(StaContextSlot), R(context), U8(4), + /* 78 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), + B(Inc), U8(2), + /* 87 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 90 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -225,24 +223,24 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 28 +bytecode array length: 31 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 53 S> */ B(CreateClosure), U8(0), U8(2), B(Star), R(0), - /* 78 S> */ B(LdaContextSlot), R(context), U8(4), + /* 78 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(ToNumber), R(2), - B(Dec), U8(1), - /* 86 E> */ B(StaContextSlot), R(context), U8(4), + B(Dec), U8(2), + /* 86 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(Ldar), R(2), /* 90 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -258,18 +256,18 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaSmi), U8(1), B(Star), R(0), - /* 55 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + /* 55 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), B(Star), R(1), /* 63 S> */ B(Ldar), R(0), B(ToNumber), R(3), - B(Inc), U8(1), + B(Inc), U8(2), B(Star), R(0), B(LdaSmi), U8(2), - /* 79 E> */ B(StaKeyedPropertySloppy), R(1), R(3), U8(2), + /* 79 E> */ B(StaKeyedPropertySloppy), R(1), R(3), U8(3), /* 84 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden index 1668c81302..1c12767e09 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -41,7 +39,7 @@ bytecodes: [ B(Star), R(0), /* 10 E> */ B(StackCheck), /* 15 S> */ B(LdaZero), - /* 31 E> */ B(LdaKeyedProperty), R(0), U8(1), + /* 31 E> */ B(LdaKeyedProperty), R(0), U8(2), /* 36 S> */ B(Return), ] constant pool: [ @@ -76,17 +74,17 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 18 +bytecode array length: 19 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateMappedArguments), B(Star), R(0), /* 10 E> */ B(StackCheck), /* 16 S> */ B(LdaZero), - /* 32 E> */ B(LdaKeyedProperty), R(0), U8(1), + /* 32 E> */ B(LdaKeyedProperty), R(0), U8(2), /* 37 S> */ B(Return), ] constant pool: [ @@ -101,16 +99,16 @@ snippet: " " frame size: 2 parameter count: 4 -bytecode array length: 25 +bytecode array length: 28 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(1), B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(6), + B(StaContextSlot), R(context), U8(6), U8(0), B(Ldar), R(arg1), - B(StaContextSlot), R(context), U8(5), + B(StaContextSlot), R(context), U8(5), U8(0), B(Ldar), R(arg2), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateMappedArguments), B(Star), R(0), /* 10 E> */ B(StackCheck), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden index afa349ac3e..c960237f09 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: no test function name: f @@ -67,7 +65,7 @@ bytecodes: [ /* 10 E> */ B(StackCheck), B(Mov), R(arg0), R(1), /* 29 S> */ B(LdaZero), - /* 44 E> */ B(LdaKeyedProperty), R(0), U8(1), + /* 44 E> */ B(LdaKeyedProperty), R(0), U8(2), /* 49 S> */ B(Return), ] constant pool: [ @@ -80,23 +78,23 @@ snippet: " function f(a, ...restArgs) { return restArgs[0] + arguments[0]; } f(); " -frame size: 5 +frame size: 4 parameter count: 2 bytecode array length: 26 bytecodes: [ B(CreateUnmappedArguments), - B(Star), R(0), + B(Star), R(2), B(CreateRestParameter), - B(Star), R(1), + B(Star), R(0), B(LdaTheHole), - B(Star), R(2), + B(Star), R(1), /* 10 E> */ B(StackCheck), - B(Mov), R(arg0), R(2), + B(Mov), R(arg0), R(1), /* 29 S> */ B(LdaZero), - /* 44 E> */ B(LdrKeyedProperty), R(1), U8(1), R(4), + /* 44 E> */ B(LdrKeyedProperty), R(0), U8(2), R(3), B(LdaZero), - /* 59 E> */ B(LdaKeyedProperty), R(0), U8(3), - B(Add), R(4), U8(5), + /* 59 E> */ B(LdaKeyedProperty), R(2), U8(4), + B(Add), R(3), U8(6), /* 64 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden index 2530404379..6c4a7b5ac2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeadCodeRemoval.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden index 9d16d06aff..a61e993e52 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: no wrap: no top level: yes @@ -34,8 +32,8 @@ bytecodes: [ /* 10 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], ] handlers: [ ] @@ -59,7 +57,7 @@ bytecodes: [ /* 15 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -88,13 +86,13 @@ bytecodes: [ B(Star), R(3), B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), /* 11 S> */ B(LdaSmi), U8(2), - /* 12 E> */ B(StaGlobalSloppy), U8(1), U8(3), + /* 12 E> */ B(StaGlobalSloppy), U8(1), U8(4), B(Star), R(0), /* 15 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], ] handlers: [ ] @@ -116,13 +114,13 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kDeclareGlobalsForInterpreter), R(1), U8(3), /* 0 E> */ B(StackCheck), /* 16 S> */ B(LdrUndefined), R(2), - B(LdrGlobal), U8(1), R(1), - /* 16 E> */ B(Call), R(1), R(2), U8(1), U8(3), + B(LdrGlobal), U8(2), R(1), + /* 16 E> */ B(Call), R(1), R(2), U8(1), U8(4), B(Star), R(0), /* 20 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden index aeebe7a3c2..d7d60aa26f 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -23,8 +21,8 @@ bytecodes: [ /* 75 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -45,8 +43,8 @@ bytecodes: [ /* 89 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -67,7 +65,7 @@ bytecodes: [ /* 76 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -100,23 +98,23 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 27 +bytecode array length: 29 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), /* 30 E> */ B(StackCheck), /* 56 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), B(Ldar), R(1), - /* 56 E> */ B(StaContextSlot), R(context), U8(4), + /* 56 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 64 S> */ B(CreateClosure), U8(1), U8(2), - /* 93 S> */ B(LdrContextSlot), R(context), U8(4), R(1), + /* 93 S> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(1), B(LdaSmi), U8(1), B(DeletePropertyStrict), R(1), /* 113 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden index dcc72134b2..6869dcfa2c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeleteLookupSlotInEval.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -31,7 +29,7 @@ bytecodes: [ /* 25 S> */ B(Return), ] constant pool: [ - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -82,7 +80,7 @@ bytecodes: [ /* 32 S> */ B(Return), ] constant pool: [ - "z", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["z"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden index ac0b2ee8d4..60e585f974 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoDebugger.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: yes --- diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden index e04e131928..08a5aaa871 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: yes do expressions: yes @@ -36,9 +34,9 @@ bytecode array length: 13 bytecodes: [ /* 30 E> */ B(StackCheck), /* 55 S> */ B(LdaSmi), U8(100), - B(Star), R(1), - /* 42 S> */ B(LdrUndefined), R(0), - B(Ldar), R(0), + B(Star), R(0), + /* 42 S> */ B(LdrUndefined), R(1), + B(Ldar), R(1), B(Star), R(2), /* 63 S> */ B(Nop), /* 73 S> */ B(Return), @@ -59,10 +57,10 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 E> */ B(StackCheck), /* 56 S> */ B(LdaSmi), U8(10), - B(Star), R(1), - /* 69 S> */ B(Inc), U8(1), - B(Star), R(1), B(Star), R(0), + /* 69 S> */ B(Inc), U8(2), + B(Star), R(0), + B(Star), R(1), /* 74 S> */ B(Jump), U8(2), B(LdaUndefined), /* 94 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden index f8ee37a398..07bd99c1f0 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: yes --- @@ -13,20 +11,20 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 66 +bytecode array length: 69 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(5), + B(StaContextSlot), R(context), U8(6), U8(0), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), + B(StaContextSlot), R(context), U8(5), U8(0), /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaConstant), U8(0), - B(Star), R(3), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), + B(Star), R(4), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(4), U8(1), R(1), B(LdaConstant), U8(1), B(Star), R(3), B(LdaZero), @@ -44,8 +42,8 @@ bytecodes: [ /* 53 S> */ B(Return), ] constant pool: [ - "eval", - "1;", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["eval"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["1;"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden index b6a8df8636..a23bb90226 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -65,34 +63,34 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 44 +bytecode array length: 45 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), - B(Star), R(1), - /* 68 S> */ B(JumpIfUndefined), U8(37), - B(JumpIfNull), U8(35), + B(Star), R(0), + /* 68 S> */ B(JumpIfUndefined), U8(38), + B(JumpIfNull), U8(36), B(ToObject), R(3), B(ForInPrepare), R(3), R(4), B(LdaZero), B(Star), R(7), - /* 63 S> */ B(ForInDone), R(7), R(6), - B(JumpIfTrue), U8(22), - B(ForInNext), R(3), R(7), R(4), U8(1), + /* 63 S> */ B(ForInContinue), R(7), R(6), + B(JumpIfFalse), U8(23), + B(ForInNext), R(3), R(7), R(4), U8(2), B(JumpIfUndefined), U8(9), - B(Star), R(0), + B(Star), R(1), /* 54 E> */ B(StackCheck), B(Star), R(2), /* 73 S> */ B(Nop), /* 85 S> */ B(Return), B(ForInStep), R(7), B(Star), R(7), - B(Jump), U8(-23), + B(JumpLoop), U8(-23), U8(0), B(LdaUndefined), /* 85 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["potatoes"], ] handlers: [ ] @@ -104,37 +102,37 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 55 +bytecode array length: 56 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), - B(Star), R(1), - /* 59 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), - B(JumpIfUndefined), U8(45), - B(JumpIfNull), U8(43), + B(Star), R(0), + /* 59 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), + B(JumpIfUndefined), U8(46), + B(JumpIfNull), U8(44), B(ToObject), R(3), B(ForInPrepare), R(3), R(4), B(LdaZero), B(Star), R(7), - /* 54 S> */ B(ForInDone), R(7), R(6), - B(JumpIfTrue), U8(30), - B(ForInNext), R(3), R(7), R(4), U8(2), + /* 54 S> */ B(ForInContinue), R(7), R(6), + B(JumpIfFalse), U8(31), + B(ForInNext), R(3), R(7), R(4), U8(3), B(JumpIfUndefined), U8(17), - B(Star), R(0), + B(Star), R(1), /* 45 E> */ B(StackCheck), B(Star), R(2), - /* 70 S> */ B(Ldar), R(0), - /* 75 E> */ B(Add), R(1), U8(1), - B(Mov), R(1), R(8), - B(Star), R(1), + /* 70 S> */ B(Ldar), R(1), + /* 75 E> */ B(Add), R(0), U8(2), + B(Mov), R(0), R(8), + B(Star), R(0), /* 72 E> */ B(ForInStep), R(7), B(Star), R(7), - B(Jump), U8(-31), + B(JumpLoop), U8(-31), U8(0), B(LdaUndefined), /* 80 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -147,49 +145,49 @@ snippet: " if (x['a'] == 20) break; } " -frame size: 8 +frame size: 7 parameter count: 1 -bytecode array length: 80 +bytecode array length: 83 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), B(Mov), R(1), R(0), - /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(3), - B(JumpIfUndefined), U8(65), - B(JumpIfNull), U8(63), + /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(9), + B(JumpIfUndefined), U8(68), + B(JumpIfNull), U8(66), B(ToObject), R(1), B(ForInPrepare), R(1), R(2), B(LdaZero), B(Star), R(5), - /* 68 S> */ B(ForInDone), R(5), R(4), - B(JumpIfTrue), U8(50), - B(ForInNext), R(1), R(5), R(2), U8(9), - B(JumpIfUndefined), U8(37), + /* 68 S> */ B(ForInContinue), R(5), R(4), + B(JumpIfFalse), U8(53), + B(ForInNext), R(1), R(5), R(2), U8(12), + B(JumpIfUndefined), U8(39), B(Star), R(6), - /* 67 E> */ B(StaNamedPropertySloppy), R(0), U8(2), U8(7), + /* 67 E> */ B(StaNamedPropertySloppy), R(0), U8(2), U8(10), /* 62 E> */ B(StackCheck), /* 95 S> */ B(Nop), - /* 100 E> */ B(LdrNamedProperty), R(0), U8(2), U8(3), R(7), + /* 100 E> */ B(LdrNamedProperty), R(0), U8(2), U8(4), R(6), B(LdaSmi), U8(10), - /* 106 E> */ B(TestEqual), R(7), + /* 106 E> */ B(TestEqual), R(6), U8(6), B(JumpIfFalse), U8(4), - /* 113 S> */ B(Jump), U8(16), + /* 113 S> */ B(Jump), U8(17), /* 125 S> */ B(Nop), - /* 130 E> */ B(LdrNamedProperty), R(0), U8(2), U8(5), R(7), + /* 130 E> */ B(LdrNamedProperty), R(0), U8(2), U8(7), R(6), B(LdaSmi), U8(20), - /* 136 E> */ B(TestEqual), R(7), + /* 136 E> */ B(TestEqual), R(6), U8(9), B(JumpIfFalse), U8(4), - /* 143 S> */ B(Jump), U8(8), + /* 143 S> */ B(Jump), U8(9), B(ForInStep), R(5), B(Star), R(5), - B(Jump), U8(-51), + B(JumpLoop), U8(-53), U8(0), B(LdaUndefined), /* 152 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], ] handlers: [ ] @@ -201,40 +199,40 @@ snippet: " " frame size: 9 parameter count: 1 -bytecode array length: 61 +bytecode array length: 62 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + /* 42 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), B(Star), R(0), - /* 72 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(3), - B(JumpIfUndefined), U8(48), - B(JumpIfNull), U8(46), + /* 72 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(9), + B(JumpIfUndefined), U8(49), + B(JumpIfNull), U8(47), B(ToObject), R(1), B(ForInPrepare), R(1), R(2), B(LdaZero), B(Star), R(5), - /* 65 S> */ B(ForInDone), R(5), R(4), - B(JumpIfTrue), U8(33), - B(ForInNext), R(1), R(5), R(2), U8(7), + /* 65 S> */ B(ForInContinue), R(5), R(4), + B(JumpIfFalse), U8(34), + B(ForInNext), R(1), R(5), R(2), U8(8), B(JumpIfUndefined), U8(20), B(Star), R(6), B(LdaZero), B(Star), R(8), B(Ldar), R(6), - /* 64 E> */ B(StaKeyedPropertySloppy), R(0), R(8), U8(5), + /* 64 E> */ B(StaKeyedPropertySloppy), R(0), R(8), U8(6), /* 59 E> */ B(StackCheck), /* 83 S> */ B(LdaSmi), U8(3), - /* 91 E> */ B(LdaKeyedProperty), R(0), U8(3), + /* 91 E> */ B(LdaKeyedProperty), R(0), U8(4), /* 98 S> */ B(Return), B(ForInStep), R(5), B(Star), R(5), - B(Jump), U8(-34), + B(JumpLoop), U8(-34), U8(0), B(LdaUndefined), /* 98 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden index 01121e5017..3ede3ec597 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -13,49 +11,49 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 268 +bytecode array length: 279 bytecodes: [ /* 30 E> */ B(StackCheck), B(LdaZero), - B(Star), R(3), + B(Star), R(4), B(Mov), R(context), R(11), B(Mov), R(context), R(12), - /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), B(Star), R(14), B(LdaConstant), U8(1), - /* 48 E> */ B(LdrKeyedProperty), R(14), U8(3), R(13), - /* 48 E> */ B(Call), R(13), R(14), U8(1), U8(1), - B(Star), R(1), - /* 45 S> */ B(LdrNamedProperty), R(1), U8(2), U8(7), R(14), - /* 45 E> */ B(Call), R(14), R(1), U8(1), U8(5), + /* 48 E> */ B(LdrKeyedProperty), R(14), U8(4), R(13), + /* 48 E> */ B(Call), R(13), R(14), U8(1), U8(2), B(Star), R(2), - /* 45 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), + /* 45 S> */ B(LdrNamedProperty), R(2), U8(2), U8(8), R(14), + /* 45 E> */ B(Call), R(14), R(2), U8(1), U8(6), + B(Star), R(3), + /* 45 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), - B(LdaNamedProperty), R(2), U8(3), U8(9), - B(JumpIfToBooleanTrue), U8(23), - B(LdrNamedProperty), R(2), U8(4), U8(11), R(4), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), + B(LdaNamedProperty), R(3), U8(3), U8(10), + B(JumpIfToBooleanTrue), U8(24), + B(LdrNamedProperty), R(3), U8(4), U8(12), R(5), B(LdaSmi), U8(2), - B(Star), R(3), - B(Mov), R(4), R(0), + B(Star), R(4), + B(Mov), R(5), R(0), /* 34 E> */ B(StackCheck), - B(Mov), R(0), R(7), + B(Mov), R(0), R(1), B(LdaZero), - B(Star), R(3), - B(Jump), U8(-49), - B(Jump), U8(34), + B(Star), R(4), + B(JumpLoop), U8(-49), U8(0), + B(Jump), U8(37), B(Star), R(13), B(Ldar), R(closure), - B(CreateCatchContext), R(13), U8(5), + B(CreateCatchContext), R(13), U8(5), U8(6), B(Star), R(12), B(PushContext), R(8), B(LdaSmi), U8(2), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(4), U8(14), B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), - B(Star), R(3), - B(LdrContextSlot), R(context), U8(4), R(13), + B(Star), R(4), + B(LdrContextSlot), R(context), U8(4), U8(0), R(13), B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), B(PopContext), R(8), B(LdaSmi), U8(-1), @@ -67,57 +65,57 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(11), B(LdaZero), - B(TestEqualStrict), R(3), - B(JumpIfTrue), U8(116), + B(TestEqualStrict), R(4), U8(15), + B(JumpIfTrue), U8(121), B(LdaUndefined), - B(TestEqualStrict), R(1), - B(JumpIfTrue), U8(111), - B(LdrNamedProperty), R(1), U8(6), U8(13), R(5), + B(TestEqualStrict), R(2), U8(16), + B(JumpIfTrue), U8(115), + B(LdrNamedProperty), R(2), U8(7), U8(17), R(6), B(LdaNull), - B(TestEqual), R(5), + B(TestEqual), R(6), U8(19), B(JumpIfFalse), U8(4), - B(Jump), U8(99), + B(Jump), U8(102), B(LdaSmi), U8(1), - B(TestEqualStrict), R(3), - B(JumpIfFalse), U8(68), - B(Ldar), R(5), + B(TestEqualStrict), R(4), U8(20), + B(JumpIfFalse), U8(70), + B(Ldar), R(6), B(TypeOf), B(Star), R(12), - B(LdaConstant), U8(7), - B(TestEqualStrict), R(12), + B(LdaConstant), U8(8), + B(TestEqualStrict), R(12), U8(21), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(129), + B(Wide), B(LdaSmi), U16(130), B(Star), R(12), - B(LdaConstant), U8(8), + B(LdaConstant), U8(9), B(Star), R(13), B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), B(Throw), B(Mov), R(context), R(12), - B(Mov), R(5), R(13), - B(Mov), R(1), R(14), + B(Mov), R(6), R(13), + B(Mov), R(2), R(14), B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), - B(Jump), U8(22), + B(Jump), U8(23), B(Star), R(13), B(Ldar), R(closure), - B(CreateCatchContext), R(13), U8(5), + B(CreateCatchContext), R(13), U8(5), U8(10), B(Star), R(12), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Ldar), R(12), B(PushContext), R(8), B(PopContext), R(8), B(Jump), U8(27), - B(Mov), R(5), R(12), - B(Mov), R(1), R(13), + B(Mov), R(6), R(12), + B(Mov), R(2), R(13), B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), - B(Star), R(6), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + B(Star), R(7), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(11), U8(1), B(LdaZero), - B(TestEqualStrict), R(9), + B(TestEqualStrict), R(9), U8(0), B(JumpIfTrue), U8(4), B(Jump), U8(5), B(Ldar), R(10), @@ -126,20 +124,22 @@ bytecodes: [ /* 62 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SYMBOL_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + SYMBOL_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["function"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [""], + FIXED_ARRAY_TYPE, ] handlers: [ - [7, 114, 120], - [10, 80, 82], - [192, 202, 204], + [7, 118, 124], + [10, 81, 83], + [201, 211, 213], ] --- @@ -149,50 +149,50 @@ snippet: " " frame size: 16 parameter count: 1 -bytecode array length: 279 +bytecode array length: 290 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), - B(Star), R(7), + B(Star), R(0), B(LdaZero), - B(Star), R(3), + B(Star), R(5), B(Mov), R(context), R(12), B(Mov), R(context), R(13), /* 68 S> */ B(LdaConstant), U8(1), - /* 68 E> */ B(LdrKeyedProperty), R(7), U8(3), R(14), - /* 68 E> */ B(Call), R(14), R(7), U8(1), U8(1), - B(Star), R(1), - /* 65 S> */ B(LdrNamedProperty), R(1), U8(2), U8(7), R(15), - /* 65 E> */ B(Call), R(15), R(1), U8(1), U8(5), - B(Star), R(2), - /* 65 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), + /* 68 E> */ B(LdrKeyedProperty), R(0), U8(4), R(14), + /* 68 E> */ B(Call), R(14), R(0), U8(1), U8(2), + B(Star), R(3), + /* 65 S> */ B(LdrNamedProperty), R(3), U8(2), U8(8), R(15), + /* 65 E> */ B(Call), R(15), R(3), U8(1), U8(6), + B(Star), R(4), + /* 65 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(4), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), - B(LdaNamedProperty), R(2), U8(3), U8(9), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(4), U8(1), + B(LdaNamedProperty), R(4), U8(3), U8(10), B(JumpIfToBooleanTrue), U8(26), - B(LdrNamedProperty), R(2), U8(4), U8(11), R(4), + B(LdrNamedProperty), R(4), U8(4), U8(12), R(6), B(LdaSmi), U8(2), - B(Star), R(3), - B(Mov), R(4), R(0), + B(Star), R(5), + B(Mov), R(6), R(1), /* 54 E> */ B(StackCheck), - B(Mov), R(0), R(8), + B(Mov), R(1), R(2), /* 73 S> */ B(LdaZero), B(Star), R(10), - B(Mov), R(0), R(11), - B(Jump), U8(48), - B(Jump), U8(34), + B(Mov), R(1), R(11), + B(Jump), U8(51), + B(Jump), U8(37), B(Star), R(14), B(Ldar), R(closure), - B(CreateCatchContext), R(14), U8(5), + B(CreateCatchContext), R(14), U8(5), U8(6), B(Star), R(13), B(PushContext), R(9), B(LdaSmi), U8(2), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(5), U8(14), B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), - B(Star), R(3), - B(LdrContextSlot), R(context), U8(4), R(14), + B(Star), R(5), + B(LdrContextSlot), R(context), U8(4), U8(0), R(14), B(CallRuntime), U16(Runtime::kReThrow), R(14), U8(1), B(PopContext), R(9), B(LdaSmi), U8(-1), @@ -204,60 +204,60 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(12), B(LdaZero), - B(TestEqualStrict), R(3), - B(JumpIfTrue), U8(116), + B(TestEqualStrict), R(5), U8(15), + B(JumpIfTrue), U8(121), B(LdaUndefined), - B(TestEqualStrict), R(1), - B(JumpIfTrue), U8(111), - B(LdrNamedProperty), R(1), U8(6), U8(13), R(5), + B(TestEqualStrict), R(3), U8(16), + B(JumpIfTrue), U8(115), + B(LdrNamedProperty), R(3), U8(7), U8(17), R(7), B(LdaNull), - B(TestEqual), R(5), + B(TestEqual), R(7), U8(19), B(JumpIfFalse), U8(4), - B(Jump), U8(99), + B(Jump), U8(102), B(LdaSmi), U8(1), - B(TestEqualStrict), R(3), - B(JumpIfFalse), U8(68), - B(Ldar), R(5), + B(TestEqualStrict), R(5), U8(20), + B(JumpIfFalse), U8(70), + B(Ldar), R(7), B(TypeOf), B(Star), R(13), - B(LdaConstant), U8(7), - B(TestEqualStrict), R(13), + B(LdaConstant), U8(8), + B(TestEqualStrict), R(13), U8(21), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(129), + B(Wide), B(LdaSmi), U16(130), B(Star), R(13), - B(LdaConstant), U8(8), + B(LdaConstant), U8(9), B(Star), R(14), B(CallRuntime), U16(Runtime::kNewTypeError), R(13), U8(2), B(Throw), B(Mov), R(context), R(13), - B(Mov), R(5), R(14), - B(Mov), R(1), R(15), + B(Mov), R(7), R(14), + B(Mov), R(3), R(15), B(InvokeIntrinsic), U8(Runtime::k_Call), R(14), U8(2), - B(Jump), U8(22), + B(Jump), U8(23), B(Star), R(14), B(Ldar), R(closure), - B(CreateCatchContext), R(14), U8(5), + B(CreateCatchContext), R(14), U8(5), U8(10), B(Star), R(13), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Ldar), R(13), B(PushContext), R(9), B(PopContext), R(9), B(Jump), U8(27), - B(Mov), R(5), R(13), - B(Mov), R(1), R(14), + B(Mov), R(7), R(13), + B(Mov), R(3), R(14), B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), - B(Star), R(6), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + B(Star), R(8), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(8), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(8), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(12), U8(1), B(LdaZero), - B(TestEqualStrict), R(10), - B(JumpIfTrue), U8(10), + B(TestEqualStrict), R(10), U8(0), + B(JumpIfTrue), U8(11), B(LdaSmi), U8(1), - B(TestEqualStrict), R(10), + B(TestEqualStrict), R(10), U8(0), B(JumpIfTrue), U8(7), B(Jump), U8(8), B(Ldar), R(11), @@ -268,20 +268,22 @@ bytecodes: [ /* 85 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::SYMBOL_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["potatoes"], + SYMBOL_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["function"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [""], + FIXED_ARRAY_TYPE, ] handlers: [ - [11, 115, 121], + [11, 118, 124], [14, 81, 83], - [194, 204, 206], + [202, 212, 214], ] --- @@ -293,57 +295,57 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 284 +bytecode array length: 297 bytecodes: [ /* 30 E> */ B(StackCheck), B(LdaZero), - B(Star), R(3), + B(Star), R(4), B(Mov), R(context), R(11), B(Mov), R(context), R(12), - /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(3), + /* 48 S> */ B(CreateArrayLiteral), U8(0), U8(0), U8(9), B(Star), R(14), B(LdaConstant), U8(1), - /* 48 E> */ B(LdrKeyedProperty), R(14), U8(3), R(13), - /* 48 E> */ B(Call), R(13), R(14), U8(1), U8(1), - B(Star), R(1), - /* 45 S> */ B(LdrNamedProperty), R(1), U8(2), U8(7), R(14), - /* 45 E> */ B(Call), R(14), R(1), U8(1), U8(5), + /* 48 E> */ B(LdrKeyedProperty), R(14), U8(4), R(13), + /* 48 E> */ B(Call), R(13), R(14), U8(1), U8(2), B(Star), R(2), - /* 45 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), + /* 45 S> */ B(LdrNamedProperty), R(2), U8(2), U8(8), R(14), + /* 45 E> */ B(Call), R(14), R(2), U8(1), U8(6), + B(Star), R(3), + /* 45 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), - B(LdaNamedProperty), R(2), U8(3), U8(9), - B(JumpIfToBooleanTrue), U8(39), - B(LdrNamedProperty), R(2), U8(4), U8(11), R(4), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(3), U8(1), + B(LdaNamedProperty), R(3), U8(3), U8(10), + B(JumpIfToBooleanTrue), U8(42), + B(LdrNamedProperty), R(3), U8(4), U8(12), R(5), B(LdaSmi), U8(2), - B(Star), R(3), - B(Mov), R(4), R(0), + B(Star), R(4), + B(Mov), R(5), R(0), /* 34 E> */ B(StackCheck), - B(Mov), R(0), R(7), + B(Mov), R(0), R(1), /* 66 S> */ B(LdaSmi), U8(10), - /* 72 E> */ B(TestEqual), R(7), + /* 72 E> */ B(TestEqual), R(1), U8(14), B(JumpIfFalse), U8(4), - /* 79 S> */ B(Jump), U8(13), + /* 79 S> */ B(Jump), U8(14), /* 91 S> */ B(LdaSmi), U8(20), - /* 97 E> */ B(TestEqual), R(7), + /* 97 E> */ B(TestEqual), R(1), U8(15), B(JumpIfFalse), U8(4), - /* 104 S> */ B(Jump), U8(7), + /* 104 S> */ B(Jump), U8(8), B(LdaZero), - B(Star), R(3), - B(Jump), U8(-65), - B(Jump), U8(34), + B(Star), R(4), + B(JumpLoop), U8(-67), U8(0), + B(Jump), U8(37), B(Star), R(13), B(Ldar), R(closure), - B(CreateCatchContext), R(13), U8(5), + B(CreateCatchContext), R(13), U8(5), U8(6), B(Star), R(12), B(PushContext), R(8), B(LdaSmi), U8(2), - B(TestEqualStrict), R(3), + B(TestEqualStrict), R(4), U8(16), B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), - B(Star), R(3), - B(LdrContextSlot), R(context), U8(4), R(13), + B(Star), R(4), + B(LdrContextSlot), R(context), U8(4), U8(0), R(13), B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), B(PopContext), R(8), B(LdaSmi), U8(-1), @@ -355,57 +357,57 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(11), B(LdaZero), - B(TestEqualStrict), R(3), - B(JumpIfTrue), U8(116), + B(TestEqualStrict), R(4), U8(17), + B(JumpIfTrue), U8(121), B(LdaUndefined), - B(TestEqualStrict), R(1), - B(JumpIfTrue), U8(111), - B(LdrNamedProperty), R(1), U8(6), U8(13), R(5), + B(TestEqualStrict), R(2), U8(18), + B(JumpIfTrue), U8(115), + B(LdrNamedProperty), R(2), U8(7), U8(19), R(6), B(LdaNull), - B(TestEqual), R(5), + B(TestEqual), R(6), U8(21), B(JumpIfFalse), U8(4), - B(Jump), U8(99), + B(Jump), U8(102), B(LdaSmi), U8(1), - B(TestEqualStrict), R(3), - B(JumpIfFalse), U8(68), - B(Ldar), R(5), + B(TestEqualStrict), R(4), U8(22), + B(JumpIfFalse), U8(70), + B(Ldar), R(6), B(TypeOf), B(Star), R(12), - B(LdaConstant), U8(7), - B(TestEqualStrict), R(12), + B(LdaConstant), U8(8), + B(TestEqualStrict), R(12), U8(23), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(129), + B(Wide), B(LdaSmi), U16(130), B(Star), R(12), - B(LdaConstant), U8(8), + B(LdaConstant), U8(9), B(Star), R(13), B(CallRuntime), U16(Runtime::kNewTypeError), R(12), U8(2), B(Throw), B(Mov), R(context), R(12), - B(Mov), R(5), R(13), - B(Mov), R(1), R(14), + B(Mov), R(6), R(13), + B(Mov), R(2), R(14), B(InvokeIntrinsic), U8(Runtime::k_Call), R(13), U8(2), - B(Jump), U8(22), + B(Jump), U8(23), B(Star), R(13), B(Ldar), R(closure), - B(CreateCatchContext), R(13), U8(5), + B(CreateCatchContext), R(13), U8(5), U8(10), B(Star), R(12), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Ldar), R(12), B(PushContext), R(8), B(PopContext), R(8), B(Jump), U8(27), - B(Mov), R(5), R(12), - B(Mov), R(1), R(13), + B(Mov), R(6), R(12), + B(Mov), R(2), R(13), B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), - B(Star), R(6), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), + B(Star), R(7), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(7), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(7), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(11), U8(1), B(LdaZero), - B(TestEqualStrict), R(9), + B(TestEqualStrict), R(9), U8(0), B(JumpIfTrue), U8(4), B(Jump), U8(5), B(Ldar), R(10), @@ -414,20 +416,22 @@ bytecodes: [ /* 113 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SYMBOL_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + SYMBOL_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["function"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [""], + FIXED_ARRAY_TYPE, ] handlers: [ - [7, 130, 136], - [10, 96, 98], - [208, 218, 220], + [7, 136, 142], + [10, 99, 101], + [219, 229, 231], ] --- @@ -437,53 +441,53 @@ snippet: " " frame size: 14 parameter count: 1 -bytecode array length: 292 +bytecode array length: 303 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(8), - B(Mov), R(8), R(6), + B(Mov), R(8), R(0), B(LdaZero), - B(Star), R(2), + B(Star), R(3), B(Mov), R(context), R(10), B(Mov), R(context), R(11), - /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(3), + /* 77 S> */ B(CreateArrayLiteral), U8(1), U8(1), U8(9), B(Star), R(13), B(LdaConstant), U8(2), - /* 77 E> */ B(LdrKeyedProperty), R(13), U8(3), R(12), - /* 77 E> */ B(Call), R(12), R(13), U8(1), U8(1), - B(Star), R(0), - /* 74 S> */ B(LdrNamedProperty), R(0), U8(3), U8(7), R(13), - /* 74 E> */ B(Call), R(13), R(0), U8(1), U8(5), + /* 77 E> */ B(LdrKeyedProperty), R(13), U8(4), R(12), + /* 77 E> */ B(Call), R(12), R(13), U8(1), U8(2), B(Star), R(1), - /* 74 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(1), U8(1), + /* 74 S> */ B(LdrNamedProperty), R(1), U8(3), U8(8), R(13), + /* 74 E> */ B(Call), R(13), R(1), U8(1), U8(6), + B(Star), R(2), + /* 74 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), B(ToBooleanLogicalNot), B(JumpIfFalse), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(1), U8(1), - B(LdaNamedProperty), R(1), U8(4), U8(9), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(2), U8(1), + B(LdaNamedProperty), R(2), U8(4), U8(10), B(JumpIfToBooleanTrue), U8(29), - /* 67 E> */ B(LdrNamedProperty), R(1), U8(5), U8(11), R(3), + /* 67 E> */ B(LdrNamedProperty), R(2), U8(5), U8(12), R(4), B(LdaSmi), U8(2), - B(Star), R(2), - B(Ldar), R(3), - B(StaNamedPropertySloppy), R(6), U8(6), U8(13), + B(Star), R(3), + B(Ldar), R(4), + B(StaNamedPropertySloppy), R(0), U8(6), U8(14), /* 62 E> */ B(StackCheck), /* 88 S> */ B(Nop), - /* 96 E> */ B(LdrNamedProperty), R(6), U8(6), U8(15), R(9), + /* 96 E> */ B(LdrNamedProperty), R(0), U8(6), U8(16), R(9), B(LdaZero), B(Star), R(8), - B(Jump), U8(48), - B(Jump), U8(34), + B(Jump), U8(51), + B(Jump), U8(37), B(Star), R(12), B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(7), + B(CreateCatchContext), R(12), U8(7), U8(8), B(Star), R(11), B(PushContext), R(7), B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(3), U8(18), B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), - B(Star), R(2), - B(LdrContextSlot), R(context), U8(4), R(12), + B(Star), R(3), + B(LdrContextSlot), R(context), U8(4), U8(0), R(12), B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1), B(PopContext), R(7), B(LdaSmi), U8(-1), @@ -495,60 +499,60 @@ bytecodes: [ B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(10), B(LdaZero), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(116), + B(TestEqualStrict), R(3), U8(19), + B(JumpIfTrue), U8(121), B(LdaUndefined), - B(TestEqualStrict), R(0), - B(JumpIfTrue), U8(111), - B(LdrNamedProperty), R(0), U8(8), U8(17), R(4), + B(TestEqualStrict), R(1), U8(20), + B(JumpIfTrue), U8(115), + B(LdrNamedProperty), R(1), U8(9), U8(21), R(5), B(LdaNull), - B(TestEqual), R(4), + B(TestEqual), R(5), U8(23), B(JumpIfFalse), U8(4), - B(Jump), U8(99), + B(Jump), U8(102), B(LdaSmi), U8(1), - B(TestEqualStrict), R(2), - B(JumpIfFalse), U8(68), - B(Ldar), R(4), + B(TestEqualStrict), R(3), U8(24), + B(JumpIfFalse), U8(70), + B(Ldar), R(5), B(TypeOf), B(Star), R(11), - B(LdaConstant), U8(9), - B(TestEqualStrict), R(11), + B(LdaConstant), U8(10), + B(TestEqualStrict), R(11), U8(25), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(129), + B(Wide), B(LdaSmi), U16(130), B(Star), R(11), - B(LdaConstant), U8(10), + B(LdaConstant), U8(11), B(Star), R(12), B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), B(Throw), B(Mov), R(context), R(11), - B(Mov), R(4), R(12), - B(Mov), R(0), R(13), + B(Mov), R(5), R(12), + B(Mov), R(1), R(13), B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), - B(Jump), U8(22), + B(Jump), U8(23), B(Star), R(12), B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(7), + B(CreateCatchContext), R(12), U8(7), U8(12), B(Star), R(11), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Ldar), R(11), B(PushContext), R(7), B(PopContext), R(7), B(Jump), U8(27), - B(Mov), R(4), R(11), - B(Mov), R(0), R(12), + B(Mov), R(5), R(11), + B(Mov), R(1), R(12), B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), - B(Star), R(5), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(5), U8(1), + B(Star), R(6), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(6), U8(1), B(JumpIfToBooleanFalse), U8(4), B(Jump), U8(7), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(5), U8(1), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(6), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(10), U8(1), B(LdaZero), - B(TestEqualStrict), R(8), - B(JumpIfTrue), U8(10), + B(TestEqualStrict), R(8), U8(0), + B(JumpIfTrue), U8(11), B(LdaSmi), U8(1), - B(TestEqualStrict), R(8), + B(TestEqualStrict), R(8), U8(0), B(JumpIfTrue), U8(7), B(Jump), U8(8), B(Ldar), R(9), @@ -559,21 +563,23 @@ bytecodes: [ /* 105 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SYMBOL_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + SYMBOL_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["function"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [""], + FIXED_ARRAY_TYPE, ] handlers: [ - [15, 128, 134], + [15, 131, 137], [18, 94, 96], - [207, 217, 219], + [215, 225, 227], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden index fd04c713a4..9a81b88a03 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -20,7 +18,7 @@ bytecodes: [ /* 55 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -37,11 +35,11 @@ bytecodes: [ /* 34 S> */ B(LdrUndefined), R(1), B(CreateClosure), U8(0), U8(2), B(Star), R(0), - /* 56 E> */ B(Call), R(0), R(1), U8(1), U8(1), + /* 56 E> */ B(Call), R(0), R(1), U8(1), U8(2), /* 59 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -60,11 +58,11 @@ bytecodes: [ B(Star), R(0), B(LdaSmi), U8(1), B(Star), R(2), - /* 67 E> */ B(Call), R(0), R(1), U8(2), U8(1), + /* 67 E> */ B(Call), R(0), R(1), U8(2), U8(2), /* 71 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden index 57dbfd153d..840aa9ae42 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: no test function name: f @@ -15,15 +13,15 @@ snippet: " " frame size: 11 parameter count: 1 -bytecode array length: 201 +bytecode array length: 212 bytecodes: [ B(Ldar), R(new_target), - B(JumpIfUndefined), U8(20), + B(JumpIfUndefined), U8(21), B(ResumeGenerator), R(new_target), B(Star), R(1), B(LdaZero), - B(TestEqualStrict), R(1), - B(JumpIfTrue), U8(57), + B(TestEqualStrict), R(1), U8(0), + B(JumpIfTrue), U8(61), B(LdaSmi), U8(76), B(Star), R(2), B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), @@ -32,16 +30,16 @@ bytecodes: [ B(CreateFunctionContext), U8(2), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), /* 11 E> */ B(StackCheck), B(Mov), R(context), R(4), - /* 11 E> */ B(LdrContextSlot), R(context), U8(4), R(6), + /* 11 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(6), B(Ldar), R(6), B(Mov), R(closure), R(5), B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(5), U8(2), - B(StaContextSlot), R(context), U8(5), + B(StaContextSlot), R(context), U8(5), U8(0), B(Star), R(5), - B(LdrContextSlot), R(context), U8(5), R(6), + B(LdrContextSlot), R(context), U8(5), U8(0), R(6), B(LdaZero), B(SuspendGenerator), R(6), B(Ldar), R(5), @@ -53,10 +51,10 @@ bytecodes: [ B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(6), U8(1), B(Star), R(8), B(LdaZero), - B(TestEqualStrict), R(8), - B(JumpIfTrue), U8(31), + B(TestEqualStrict), R(8), U8(0), + B(JumpIfTrue), U8(32), B(LdaSmi), U8(2), - B(TestEqualStrict), R(8), + B(TestEqualStrict), R(8), U8(0), B(JumpIfTrue), U8(22), B(Jump), U8(2), B(LdaTrue), @@ -85,17 +83,17 @@ bytecodes: [ B(Star), R(2), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(4), - B(LdrContextSlot), R(context), U8(5), R(5), + B(LdrContextSlot), R(context), U8(5), U8(0), R(5), B(CallRuntime), U16(Runtime::k_GeneratorClose), R(5), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), B(LdaZero), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(16), + B(TestEqualStrict), R(2), U8(0), + B(JumpIfTrue), U8(18), B(LdaSmi), U8(1), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(13), + B(TestEqualStrict), R(2), U8(0), + B(JumpIfTrue), U8(14), B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(2), U8(0), B(JumpIfTrue), U8(10), B(Jump), U8(11), B(Ldar), R(3), @@ -110,7 +108,7 @@ bytecodes: [ constant pool: [ ] handlers: [ - [39, 138, 144], + [41, 145, 151], ] --- @@ -120,17 +118,17 @@ snippet: " " frame size: 11 parameter count: 1 -bytecode array length: 294 +bytecode array length: 310 bytecodes: [ B(Ldar), R(new_target), - B(JumpIfUndefined), U8(26), + B(JumpIfUndefined), U8(28), B(ResumeGenerator), R(new_target), B(Star), R(1), B(LdaZero), - B(TestEqualStrict), R(1), - B(JumpIfTrue), U8(63), + B(TestEqualStrict), R(1), U8(0), + B(JumpIfTrue), U8(68), B(LdaSmi), U8(1), - B(TestEqualStrict), R(1), + B(TestEqualStrict), R(1), U8(0), B(JumpIfTrueConstant), U8(0), B(LdaSmi), U8(76), B(Star), R(2), @@ -140,16 +138,16 @@ bytecodes: [ B(CreateFunctionContext), U8(2), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), /* 11 E> */ B(StackCheck), B(Mov), R(context), R(4), - /* 11 E> */ B(LdrContextSlot), R(context), U8(4), R(6), + /* 11 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(6), B(Ldar), R(6), B(Mov), R(closure), R(5), B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(5), U8(2), - B(StaContextSlot), R(context), U8(5), + B(StaContextSlot), R(context), U8(5), U8(0), B(Star), R(5), - B(LdrContextSlot), R(context), U8(5), R(6), + B(LdrContextSlot), R(context), U8(5), U8(0), R(6), B(LdaZero), B(SuspendGenerator), R(6), B(Ldar), R(5), @@ -161,10 +159,10 @@ bytecodes: [ B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(6), U8(1), B(Star), R(8), B(LdaZero), - B(TestEqualStrict), R(8), - B(JumpIfTrue), U8(31), + B(TestEqualStrict), R(8), U8(0), + B(JumpIfTrue), U8(32), B(LdaSmi), U8(2), - B(TestEqualStrict), R(8), + B(TestEqualStrict), R(8), U8(0), B(JumpIfTrue), U8(22), B(Jump), U8(2), B(LdaTrue), @@ -174,7 +172,7 @@ bytecodes: [ B(Star), R(3), B(LdaZero), B(Star), R(2), - B(Jump), U8(113), + B(Jump), U8(116), B(Ldar), R(7), /* 11 E> */ B(Throw), /* 16 S> */ B(LdaSmi), U8(42), @@ -182,34 +180,34 @@ bytecodes: [ B(LdaFalse), B(Star), R(6), B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(5), U8(2), - B(Star), R(7), - B(LdrContextSlot), R(context), U8(5), R(5), + B(Star), R(5), + B(LdrContextSlot), R(context), U8(5), U8(0), R(6), B(LdaSmi), U8(1), - B(SuspendGenerator), R(5), - B(Ldar), R(7), + B(SuspendGenerator), R(6), + B(Ldar), R(5), /* 25 S> */ B(Return), B(LdaSmi), U8(-2), B(Star), R(1), - B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(5), U8(1), - B(Star), R(6), - B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(5), U8(1), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(6), U8(1), + B(Star), R(7), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(6), U8(1), B(Star), R(8), B(LdaZero), - B(TestEqualStrict), R(8), - B(JumpIfTrue), U8(32), + B(TestEqualStrict), R(8), U8(0), + B(JumpIfTrue), U8(33), B(LdaSmi), U8(2), - B(TestEqualStrict), R(8), + B(TestEqualStrict), R(8), U8(0), B(JumpIfTrue), U8(23), B(Jump), U8(2), B(LdaTrue), B(Star), R(10), - B(Mov), R(6), R(9), + B(Mov), R(7), R(9), B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(9), U8(2), B(Star), R(3), B(LdaSmi), U8(1), B(Star), R(2), B(Jump), U8(35), - B(Ldar), R(6), + B(Ldar), R(7), /* 16 E> */ B(Throw), B(LdrUndefined), R(5), B(LdaTrue), @@ -227,20 +225,20 @@ bytecodes: [ B(Star), R(2), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(4), - B(LdrContextSlot), R(context), U8(5), R(5), + B(LdrContextSlot), R(context), U8(5), U8(0), R(5), B(CallRuntime), U16(Runtime::k_GeneratorClose), R(5), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), B(LdaZero), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(22), + B(TestEqualStrict), R(2), U8(0), + B(JumpIfTrue), U8(25), B(LdaSmi), U8(1), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(19), + B(TestEqualStrict), R(2), U8(0), + B(JumpIfTrue), U8(21), B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), - B(JumpIfTrue), U8(16), + B(TestEqualStrict), R(2), U8(0), + B(JumpIfTrue), U8(17), B(LdaSmi), U8(3), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(2), U8(0), B(JumpIfTrue), U8(13), B(Jump), U8(14), B(Ldar), R(3), @@ -255,10 +253,10 @@ bytecodes: [ /* 25 S> */ B(Return), ] constant pool: [ - kInstanceTypeDontCare, + Smi [141], ] handlers: [ - [45, 222, 228], + [48, 233, 239], ] --- @@ -266,339 +264,341 @@ snippet: " function* f() { for (let x of [42]) yield x } f(); " -frame size: 18 +frame size: 17 parameter count: 1 -bytecode array length: 742 +bytecode array length: 805 bytecodes: [ B(Ldar), R(new_target), - B(JumpIfUndefined), U8(26), + B(JumpIfUndefined), U8(28), B(ResumeGenerator), R(new_target), - B(Star), R(4), + B(Star), R(3), B(LdaZero), - B(TestEqualStrict), R(4), - B(JumpIfTrue), U8(63), + B(TestEqualStrict), R(3), U8(0), + B(JumpIfTrue), U8(68), B(LdaSmi), U8(1), - B(TestEqualStrict), R(4), + B(TestEqualStrict), R(3), U8(0), B(JumpIfTrueConstant), U8(3), B(LdaSmi), U8(76), - B(Star), R(5), - B(CallRuntime), U16(Runtime::kAbort), R(5), U8(1), - B(LdaSmi), U8(-2), B(Star), R(4), + B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(3), B(CreateFunctionContext), U8(9), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), /* 11 E> */ B(StackCheck), - B(Mov), R(context), R(7), - /* 11 E> */ B(LdrContextSlot), R(context), U8(4), R(9), - B(Ldar), R(9), - B(Mov), R(closure), R(8), - B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(8), U8(2), - B(StaContextSlot), R(context), U8(5), - B(Star), R(8), - B(LdrContextSlot), R(context), U8(5), R(9), - B(LdaZero), - B(SuspendGenerator), R(9), + B(Mov), R(context), R(6), + /* 11 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(8), B(Ldar), R(8), + B(Mov), R(closure), R(7), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(7), U8(2), + B(StaContextSlot), R(context), U8(5), U8(0), + B(Star), R(7), + B(LdrContextSlot), R(context), U8(5), U8(0), R(8), + B(LdaZero), + B(SuspendGenerator), R(8), + B(Ldar), R(7), /* 44 S> */ B(Return), B(LdaSmi), U8(-2), - B(Star), R(4), - B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(9), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(8), U8(1), + B(Star), R(9), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(8), U8(1), B(Star), R(10), - B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(9), U8(1), - B(Star), R(11), B(LdaZero), - B(TestEqualStrict), R(11), - B(JumpIfTrue), U8(31), + B(TestEqualStrict), R(10), U8(0), + B(JumpIfTrue), U8(32), B(LdaSmi), U8(2), - B(TestEqualStrict), R(11), + B(TestEqualStrict), R(10), U8(0), B(JumpIfTrue), U8(22), B(Jump), U8(2), B(LdaTrue), - B(Star), R(13), - B(Mov), R(10), R(12), - B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(12), U8(2), - B(Star), R(6), - B(LdaZero), + B(Star), R(12), + B(Mov), R(9), R(11), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(11), U8(2), B(Star), R(5), - B(JumpConstant), U8(17), - B(Ldar), R(10), + B(LdaZero), + B(Star), R(4), + B(JumpConstant), U8(20), + B(Ldar), R(9), /* 11 E> */ B(Throw), B(Ldar), R(closure), B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(LdaZero), - B(StaContextSlot), R(1), U8(9), + B(StaContextSlot), R(1), U8(9), U8(0), + B(Mov), R(context), R(9), B(Mov), R(context), R(10), - B(Mov), R(context), R(11), - /* 30 S> */ B(CreateArrayLiteral), U8(1), U8(0), U8(3), - B(Star), R(13), + /* 30 S> */ B(CreateArrayLiteral), U8(1), U8(0), U8(9), + B(Star), R(12), B(LdaConstant), U8(2), - /* 30 E> */ B(LdrKeyedProperty), R(13), U8(3), R(12), - /* 30 E> */ B(Call), R(12), R(13), U8(1), U8(1), - /* 30 E> */ B(StaContextSlot), R(1), U8(7), + /* 30 E> */ B(LdrKeyedProperty), R(12), U8(4), R(11), + /* 30 E> */ B(Call), R(11), R(12), U8(1), U8(2), + /* 30 E> */ B(StaContextSlot), R(1), U8(7), U8(0), B(LdaSmi), U8(-2), - B(TestEqual), R(4), - B(JumpIfTrue), U8(17), + B(TestEqual), R(3), U8(0), + B(JumpIfTrue), U8(18), B(LdaSmi), U8(1), - B(TestEqualStrict), R(4), + B(TestEqualStrict), R(3), U8(0), B(JumpIfTrueConstant), U8(9), B(LdaSmi), U8(76), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1), - /* 27 S> */ B(LdrContextSlot), R(1), U8(7), R(14), - B(LdrNamedProperty), R(14), U8(4), U8(7), R(13), - /* 27 E> */ B(Call), R(13), R(14), U8(1), U8(5), - /* 27 E> */ B(StaContextSlot), R(1), U8(8), - B(Star), R(12), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(12), U8(1), + B(Star), R(11), + B(CallRuntime), U16(Runtime::kAbort), R(11), U8(1), + /* 27 S> */ B(LdrContextSlot), R(1), U8(7), U8(0), R(13), + B(LdrNamedProperty), R(13), U8(4), U8(8), R(12), + /* 27 E> */ B(Call), R(12), R(13), U8(1), U8(6), + /* 27 E> */ B(StaContextSlot), R(1), U8(8), U8(0), + B(Star), R(11), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(11), U8(1), B(ToBooleanLogicalNot), - B(JumpIfFalse), U8(11), - B(LdrContextSlot), R(1), U8(8), R(12), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(12), U8(1), - B(LdrContextSlot), R(1), U8(8), R(12), - B(LdaNamedProperty), R(12), U8(5), U8(9), + B(JumpIfFalse), U8(12), + B(LdrContextSlot), R(1), U8(8), U8(0), R(11), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), + B(LdrContextSlot), R(1), U8(8), U8(0), R(11), + B(LdaNamedProperty), R(11), U8(5), U8(10), B(JumpIfToBooleanTrueConstant), U8(10), - B(LdrContextSlot), R(1), U8(8), R(12), - B(LdaNamedProperty), R(12), U8(6), U8(11), - B(StaContextSlot), R(1), U8(10), + B(LdrContextSlot), R(1), U8(8), U8(0), R(11), + B(LdaNamedProperty), R(11), U8(6), U8(12), + B(StaContextSlot), R(1), U8(10), U8(0), B(LdaSmi), U8(2), - B(StaContextSlot), R(1), U8(9), - B(LdaContextSlot), R(1), U8(10), - B(StaContextSlot), R(1), U8(6), + B(StaContextSlot), R(1), U8(9), U8(0), + B(LdaContextSlot), R(1), U8(10), U8(0), + B(StaContextSlot), R(1), U8(6), U8(0), /* 16 E> */ B(StackCheck), B(Ldar), R(closure), B(CreateBlockContext), U8(7), B(PushContext), R(2), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), - B(LdaContextSlot), R(1), U8(6), - B(StaContextSlot), R(context), U8(4), - /* 36 S> */ B(LdaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), + B(LdaContextSlot), R(1), U8(6), U8(0), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 36 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(8), B(Star), R(13), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(13), U8(1), - B(Star), R(12), + B(Star), R(11), B(LdaFalse), - B(Star), R(13), - B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(12), U8(2), - B(Star), R(14), - B(LdrContextSlot), R(1), U8(5), R(12), + B(Star), R(12), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(11), U8(2), + B(Star), R(11), + B(LdrContextSlot), R(1), U8(5), U8(0), R(12), B(LdaSmi), U8(1), B(SuspendGenerator), R(12), - B(Ldar), R(14), + B(Ldar), R(11), /* 44 S> */ B(Return), B(LdaSmi), U8(-2), - B(Star), R(4), + B(Star), R(3), B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(12), U8(1), B(Star), R(13), B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(12), U8(1), - B(Star), R(15), + B(Star), R(14), B(LdaZero), - B(TestEqualStrict), R(15), - B(JumpIfTrue), U8(43), + B(TestEqualStrict), R(14), U8(0), + B(JumpIfTrue), U8(44), B(LdaSmi), U8(2), - B(TestEqualStrict), R(15), + B(TestEqualStrict), R(14), U8(0), B(JumpIfTrue), U8(34), B(Jump), U8(2), B(LdaTrue), - B(Star), R(17), - B(Mov), R(13), R(16), - B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(16), U8(2), + B(Star), R(16), + B(Mov), R(13), R(15), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(15), U8(2), B(PopContext), R(2), B(PopContext), R(2), B(PopContext), R(2), B(PopContext), R(2), B(PopContext), R(2), B(PopContext), R(2), - B(Star), R(9), - B(LdaZero), B(Star), R(8), - B(Jump), U8(68), + B(LdaZero), + B(Star), R(7), + B(Jump), U8(74), B(Ldar), R(13), /* 36 E> */ B(Throw), - B(Ldar), R(13), B(PopContext), R(2), B(LdaZero), - B(StaContextSlot), R(1), U8(9), - B(Wide), B(Jump), U16(-215), - B(Jump), U8(39), - B(Star), R(12), - B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(11), + B(StaContextSlot), R(1), U8(9), U8(0), + B(Wide), B(JumpLoop), U16(-232), U16(0), + B(Jump), U8(44), B(Star), R(11), + B(Ldar), R(closure), + B(CreateCatchContext), R(11), U8(11), U8(12), + B(Star), R(10), B(PushContext), R(2), - B(LdrContextSlot), R(0), U8(9), R(12), + B(LdrContextSlot), R(1), U8(9), U8(0), R(11), B(LdaSmi), U8(2), - B(TestEqualStrict), R(12), - B(JumpIfFalse), U8(7), + B(TestEqualStrict), R(11), U8(14), + B(JumpIfFalse), U8(8), B(LdaSmi), U8(1), - B(StaContextSlot), R(0), U8(9), - B(LdrContextSlot), R(context), U8(4), R(12), - B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1), + B(StaContextSlot), R(1), U8(9), U8(0), + B(LdrContextSlot), R(context), U8(4), U8(0), R(11), + B(CallRuntime), U16(Runtime::kReThrow), R(11), U8(1), B(PopContext), R(2), B(LdaSmi), U8(-1), - B(Star), R(8), + B(Star), R(7), B(Jump), U8(8), - B(Star), R(9), - B(LdaSmi), U8(1), B(Star), R(8), + B(LdaSmi), U8(1), + B(Star), R(7), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Star), R(10), - B(LdrContextSlot), R(1), U8(9), R(11), + B(Star), R(9), + B(LdrContextSlot), R(1), U8(9), U8(0), R(10), B(LdaZero), - B(TestEqualStrict), R(11), - B(JumpIfTrueConstant), U8(15), - B(LdrContextSlot), R(1), U8(7), R(11), + B(TestEqualStrict), R(10), U8(15), + B(JumpIfTrueConstant), U8(18), + B(LdrContextSlot), R(1), U8(7), U8(0), R(10), B(LdaUndefined), - B(TestEqualStrict), R(11), - B(JumpIfTrueConstant), U8(16), - B(LdrContextSlot), R(1), U8(7), R(11), - B(LdaNamedProperty), R(11), U8(12), U8(13), - B(StaContextSlot), R(1), U8(11), - B(LdrContextSlot), R(1), U8(11), R(11), + B(TestEqualStrict), R(10), U8(16), + B(JumpIfTrueConstant), U8(19), + B(LdrContextSlot), R(1), U8(7), U8(0), R(10), + B(LdaNamedProperty), R(10), U8(13), U8(17), + B(StaContextSlot), R(1), U8(11), U8(0), + B(LdrContextSlot), R(1), U8(11), U8(0), R(10), B(LdaNull), - B(TestEqual), R(11), + B(TestEqual), R(10), U8(19), B(JumpIfFalse), U8(4), - B(Jump), U8(117), - B(LdrContextSlot), R(1), U8(9), R(11), + B(JumpConstant), U8(17), + B(LdrContextSlot), R(1), U8(9), U8(0), R(10), B(LdaSmi), U8(1), - B(TestEqualStrict), R(11), - B(JumpIfFalse), U8(71), - B(LdaContextSlot), R(1), U8(11), + B(TestEqualStrict), R(10), U8(20), + B(JumpIfFalse), U8(76), + B(LdaContextSlot), R(1), U8(11), U8(0), B(TypeOf), - B(Star), R(11), - B(LdaConstant), U8(13), - B(TestEqualStrict), R(11), + B(Star), R(10), + B(LdaConstant), U8(14), + B(TestEqualStrict), R(10), U8(21), B(JumpIfFalse), U8(4), B(Jump), U8(18), - B(Wide), B(LdaSmi), U16(129), + B(Wide), B(LdaSmi), U16(130), + B(Star), R(10), + B(LdaConstant), U8(15), B(Star), R(11), - B(LdaConstant), U8(14), - B(Star), R(12), - B(CallRuntime), U16(Runtime::kNewTypeError), R(11), U8(2), + B(CallRuntime), U16(Runtime::kNewTypeError), R(10), U8(2), B(Throw), - B(Mov), R(context), R(11), - B(LdrContextSlot), R(1), U8(11), R(12), - B(LdrContextSlot), R(1), U8(7), R(13), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(12), U8(2), - B(Jump), U8(22), - B(Star), R(12), - B(Ldar), R(closure), - B(CreateCatchContext), R(12), U8(11), + B(Mov), R(context), R(10), + B(LdrContextSlot), R(1), U8(11), U8(0), R(11), + B(LdrContextSlot), R(1), U8(7), U8(0), R(12), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), + B(Jump), U8(23), B(Star), R(11), + B(Ldar), R(closure), + B(CreateCatchContext), R(11), U8(11), U8(16), + B(Star), R(10), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Ldar), R(11), + B(Ldar), R(10), B(PushContext), R(2), B(PopContext), R(2), - B(Jump), U8(38), - B(LdrContextSlot), R(1), U8(11), R(11), - B(LdrContextSlot), R(1), U8(7), R(12), - B(InvokeIntrinsic), U8(Runtime::k_Call), R(11), U8(2), - B(StaContextSlot), R(1), U8(12), - B(LdrContextSlot), R(1), U8(12), R(11), - B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(11), U8(1), + B(Jump), U8(43), + B(LdrContextSlot), R(1), U8(11), U8(0), R(10), + B(LdrContextSlot), R(1), U8(7), U8(0), R(11), + B(InvokeIntrinsic), U8(Runtime::k_Call), R(10), U8(2), + B(StaContextSlot), R(1), U8(12), U8(0), + B(LdrContextSlot), R(1), U8(12), U8(0), R(10), + B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(10), U8(1), B(JumpIfToBooleanFalse), U8(4), - B(Jump), U8(11), - B(LdrContextSlot), R(1), U8(12), R(11), - B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), - B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(10), U8(1), + B(Jump), U8(12), + B(LdrContextSlot), R(1), U8(12), U8(0), R(10), + B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), + B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(9), U8(1), B(LdaZero), - B(TestEqualStrict), R(8), - B(JumpIfTrue), U8(10), + B(TestEqualStrict), R(7), U8(0), + B(JumpIfTrue), U8(11), B(LdaSmi), U8(1), - B(TestEqualStrict), R(8), + B(TestEqualStrict), R(7), U8(0), B(JumpIfTrue), U8(17), B(Jump), U8(28), B(PopContext), R(1), B(PopContext), R(1), B(LdaSmi), U8(1), - B(Star), R(5), - B(Mov), R(9), R(6), + B(Star), R(4), + B(Mov), R(8), R(5), B(Jump), U8(47), B(PopContext), R(1), B(PopContext), R(1), B(LdaSmi), U8(2), - B(Star), R(5), - B(Mov), R(9), R(6), + B(Star), R(4), + B(Mov), R(8), R(5), B(Jump), U8(34), B(PopContext), R(1), - B(LdrUndefined), R(8), + B(LdrUndefined), R(7), B(LdaTrue), - B(Star), R(9), - B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(8), U8(2), - B(Star), R(6), - B(LdaSmi), U8(3), + B(Star), R(8), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(7), U8(2), B(Star), R(5), + B(LdaSmi), U8(3), + B(Star), R(4), B(Jump), U8(14), B(LdaSmi), U8(-1), - B(Star), R(5), + B(Star), R(4), B(Jump), U8(8), - B(Star), R(6), - B(LdaSmi), U8(4), B(Star), R(5), + B(LdaSmi), U8(4), + B(Star), R(4), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), - B(Star), R(7), - B(LdrContextSlot), R(context), U8(5), R(8), - B(CallRuntime), U16(Runtime::k_GeneratorClose), R(8), U8(1), - B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(7), U8(1), + B(Star), R(6), + B(LdrContextSlot), R(context), U8(5), U8(0), R(7), + B(CallRuntime), U16(Runtime::k_GeneratorClose), R(7), U8(1), + B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(6), U8(1), B(LdaZero), - B(TestEqualStrict), R(5), - B(JumpIfTrue), U8(28), + B(TestEqualStrict), R(4), U8(0), + B(JumpIfTrue), U8(32), B(LdaSmi), U8(1), - B(TestEqualStrict), R(5), - B(JumpIfTrue), U8(25), + B(TestEqualStrict), R(4), U8(0), + B(JumpIfTrue), U8(28), B(LdaSmi), U8(2), - B(TestEqualStrict), R(5), - B(JumpIfTrue), U8(22), + B(TestEqualStrict), R(4), U8(0), + B(JumpIfTrue), U8(24), B(LdaSmi), U8(3), - B(TestEqualStrict), R(5), - B(JumpIfTrue), U8(19), + B(TestEqualStrict), R(4), U8(0), + B(JumpIfTrue), U8(20), B(LdaSmi), U8(4), - B(TestEqualStrict), R(5), + B(TestEqualStrict), R(4), U8(0), B(JumpIfTrue), U8(16), B(Jump), U8(17), - B(Ldar), R(6), + B(Ldar), R(5), /* 44 S> */ B(Return), - B(Ldar), R(6), + B(Ldar), R(5), /* 44 S> */ B(Return), - B(Ldar), R(6), + B(Ldar), R(5), B(ReThrow), - B(Ldar), R(6), + B(Ldar), R(5), /* 44 S> */ B(Return), - B(Ldar), R(6), + B(Ldar), R(5), B(ReThrow), B(LdaUndefined), /* 44 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SYMBOL_TYPE, - kInstanceTypeDontCare, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - kInstanceTypeDontCare, - kInstanceTypeDontCare, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - kInstanceTypeDontCare, - kInstanceTypeDontCare, - kInstanceTypeDontCare, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + SYMBOL_TYPE, + Smi [158], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["next"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["done"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["value"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], + Smi [146], + Smi [167], + ONE_BYTE_INTERNALIZED_STRING_TYPE [".catch"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["return"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["function"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [""], + FIXED_ARRAY_TYPE, + Smi [129], + Smi [166], + Smi [155], + Smi [601], ] handlers: [ - [45, 661, 667], - [143, 423, 429], - [146, 384, 386], - [525, 537, 539], + [48, 718, 724], + [153, 458, 464], + [156, 414, 416], + [572, 586, 588], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden index 166f7f0351..f222e9034b 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -19,13 +17,13 @@ parameter count: 1 bytecode array length: 12 bytecodes: [ /* 26 E> */ B(StackCheck), - /* 31 S> */ B(LdrGlobal), U8(1), R(0), - B(BitwiseAndSmi), U8(1), R(0), U8(3), - /* 45 E> */ B(StaGlobalSloppy), U8(0), U8(4), + /* 31 S> */ B(LdrGlobal), U8(2), R(0), + B(BitwiseAndSmi), U8(1), R(0), U8(4), + /* 45 E> */ B(StaGlobalSloppy), U8(0), U8(5), /* 51 S> */ B(Return), ] constant pool: [ - "global", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["global"], ] handlers: [ ] @@ -41,13 +39,13 @@ parameter count: 1 bytecode array length: 12 bytecodes: [ /* 27 E> */ B(StackCheck), - /* 32 S> */ B(LdrGlobal), U8(1), R(0), - B(AddSmi), U8(1), R(0), U8(3), - /* 51 E> */ B(StaGlobalSloppy), U8(0), U8(4), + /* 32 S> */ B(LdrGlobal), U8(2), R(0), + B(AddSmi), U8(1), R(0), U8(4), + /* 51 E> */ B(StaGlobalSloppy), U8(0), U8(5), /* 57 S> */ B(Return), ] constant pool: [ - "unallocated", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["unallocated"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden index 6a2406ad12..2c6616bb58 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -19,13 +17,13 @@ parameter count: 1 bytecode array length: 9 bytecodes: [ /* 26 E> */ B(StackCheck), - /* 31 S> */ B(LdaGlobal), U8(1), - B(Inc), U8(5), - /* 40 E> */ B(StaGlobalSloppy), U8(0), U8(3), + /* 31 S> */ B(LdaGlobal), U8(2), + B(Inc), U8(6), + /* 40 E> */ B(StaGlobalSloppy), U8(0), U8(4), /* 48 S> */ B(Return), ] constant pool: [ - "global", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["global"], ] handlers: [ ] @@ -41,15 +39,15 @@ parameter count: 1 bytecode array length: 13 bytecodes: [ /* 26 E> */ B(StackCheck), - /* 31 S> */ B(LdaGlobal), U8(1), + /* 31 S> */ B(LdaGlobal), U8(2), B(ToNumber), R(0), - B(Dec), U8(5), - /* 44 E> */ B(StaGlobalSloppy), U8(0), U8(3), + B(Dec), U8(6), + /* 44 E> */ B(StaGlobalSloppy), U8(0), U8(4), B(Ldar), R(0), /* 48 S> */ B(Return), ] constant pool: [ - "global", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["global"], ] handlers: [ ] @@ -65,13 +63,13 @@ parameter count: 1 bytecode array length: 9 bytecodes: [ /* 27 E> */ B(StackCheck), - /* 46 S> */ B(LdaGlobal), U8(1), - B(Dec), U8(5), - /* 55 E> */ B(StaGlobalStrict), U8(0), U8(3), + /* 46 S> */ B(LdaGlobal), U8(2), + B(Dec), U8(6), + /* 55 E> */ B(StaGlobalStrict), U8(0), U8(4), /* 68 S> */ B(Return), ] constant pool: [ - "unallocated", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["unallocated"], ] handlers: [ ] @@ -87,15 +85,15 @@ parameter count: 1 bytecode array length: 13 bytecodes: [ /* 27 E> */ B(StackCheck), - /* 32 S> */ B(LdaGlobal), U8(1), + /* 32 S> */ B(LdaGlobal), U8(2), B(ToNumber), R(0), - B(Inc), U8(5), - /* 50 E> */ B(StaGlobalSloppy), U8(0), U8(3), + B(Inc), U8(6), + /* 50 E> */ B(StaGlobalSloppy), U8(0), U8(4), B(Ldar), R(0), /* 54 S> */ B(Return), ] constant pool: [ - "unallocated", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["unallocated"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden index adead06c5c..66583f3389 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: no test function name: f @@ -21,13 +19,13 @@ parameter count: 1 bytecode array length: 9 bytecodes: [ /* 32 E> */ B(StackCheck), - /* 39 S> */ B(LdrGlobal), U8(1), R(0), + /* 39 S> */ B(LdrGlobal), U8(2), R(0), B(LdaConstant), U8(0), B(DeletePropertySloppy), R(0), /* 58 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -46,7 +44,7 @@ parameter count: 1 bytecode array length: 9 bytecodes: [ /* 28 E> */ B(StackCheck), - /* 51 S> */ B(LdrGlobal), U8(1), R(0), + /* 51 S> */ B(LdrGlobal), U8(2), R(0), B(LdaSmi), U8(1), B(DeletePropertyStrict), R(0), /* 71 S> */ B(Return), @@ -66,17 +64,17 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 14 +bytecode array length: 16 bytecodes: [ /* 32 E> */ B(StackCheck), - /* 39 S> */ B(LdrContextSlot), R(context), U8(3), R(0), - B(LdrContextSlot), R(0), U8(2), R(1), + /* 39 S> */ B(LdrContextSlot), R(context), U8(3), U8(0), R(0), + B(LdrContextSlot), R(0), U8(2), U8(0), R(1), B(LdaConstant), U8(0), B(DeletePropertySloppy), R(1), /* 56 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], ] handlers: [ ] @@ -91,17 +89,17 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 14 +bytecode array length: 16 bytecodes: [ /* 18 E> */ B(StackCheck), - /* 25 S> */ B(LdrContextSlot), R(context), U8(3), R(0), - B(LdrContextSlot), R(0), U8(2), R(1), + /* 25 S> */ B(LdrContextSlot), R(context), U8(3), U8(0), R(0), + B(LdrContextSlot), R(0), U8(2), U8(0), R(1), B(LdaConstant), U8(0), B(DeletePropertySloppy), R(1), /* 42 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden index f70321aa99..14bf7088e6 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/HeapNumberConstants.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- @@ -20,7 +18,7 @@ bytecodes: [ /* 46 S> */ B(Return), ] constant pool: [ - 1.2, + HEAP_NUMBER_TYPE [1.2], ] handlers: [ ] @@ -40,8 +38,8 @@ bytecodes: [ /* 59 S> */ B(Return), ] constant pool: [ - 1.2, - 2.6, + HEAP_NUMBER_TYPE [1.2], + HEAP_NUMBER_TYPE [2.6], ] handlers: [ ] @@ -61,8 +59,8 @@ bytecodes: [ /* 61 S> */ B(Return), ] constant pool: [ - 3.14, - 3.14, + HEAP_NUMBER_TYPE [3.14], + HEAP_NUMBER_TYPE [3.14], ] handlers: [ ] @@ -850,263 +848,263 @@ bytecodes: [ /* 2867 S> */ B(Return), ] constant pool: [ - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 1.414, - 3.14, + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [1.414], + HEAP_NUMBER_TYPE [3.14], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden index c375fb1e1e..17ee039b91 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IfConditions.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: no test function name: f @@ -122,7 +120,7 @@ bytecodes: [ /* 25 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 30 S> */ B(JumpIfToBooleanFalse), U8(13), - /* 43 S> */ B(AddSmi), U8(1), R(0), U8(1), + /* 43 S> */ B(AddSmi), U8(1), R(0), U8(2), B(Mov), R(0), R(1), B(Star), R(0), B(Jump), U8(5), @@ -149,11 +147,11 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 18 +bytecode array length: 19 bytecodes: [ /* 10 E> */ B(StackCheck), /* 18 S> */ B(LdaZero), - /* 24 E> */ B(TestLessThanOrEqual), R(arg0), + /* 24 E> */ B(TestLessThanOrEqual), R(arg0), U8(2), B(JumpIfFalse), U8(7), /* 36 S> */ B(Wide), B(LdaSmi), U16(200), /* 80 S> */ B(Return), @@ -260,7 +258,7 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 409 +bytecode array length: 410 bytecodes: [ /* 10 E> */ B(StackCheck), /* 24 S> */ B(LdaZero), @@ -268,7 +266,7 @@ bytecodes: [ /* 35 S> */ B(LdaZero), B(Star), R(1), /* 38 S> */ B(LdaConstant), U8(0), - /* 44 E> */ B(TestEqualStrict), R(0), + /* 44 E> */ B(TestEqualStrict), R(0), U8(2), B(JumpIfFalseConstant), U8(1), /* 58 S> */ B(Mov), R(0), R(1), /* 65 S> */ B(Mov), R(1), R(0), @@ -406,8 +404,8 @@ bytecodes: [ /* 1117 S> */ B(Return), ] constant pool: [ - InstanceType::HEAP_NUMBER_TYPE, - kInstanceTypeDontCare, + HEAP_NUMBER_TYPE [0.01], + Smi [391], ] handlers: [ ] @@ -632,7 +630,7 @@ bytecodes: [ /* 1112 S> */ B(Return), ] constant pool: [ - kInstanceTypeDontCare, + Smi [391], ] handlers: [ ] @@ -654,36 +652,36 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 75 +bytecode array length: 81 bytecodes: [ /* 10 E> */ B(StackCheck), /* 21 S> */ B(Ldar), R(arg1), - /* 27 E> */ B(TestEqual), R(arg0), + /* 27 E> */ B(TestEqual), R(arg0), U8(2), B(JumpIfFalse), U8(5), /* 35 S> */ B(LdaSmi), U8(1), /* 262 S> */ B(Return), /* 49 S> */ B(Ldar), R(arg1), - /* 55 E> */ B(TestEqualStrict), R(arg0), + /* 55 E> */ B(TestEqualStrict), R(arg0), U8(3), B(JumpIfFalse), U8(5), /* 64 S> */ B(LdaSmi), U8(1), /* 262 S> */ B(Return), /* 78 S> */ B(Ldar), R(arg1), - /* 84 E> */ B(TestLessThan), R(arg0), + /* 84 E> */ B(TestLessThan), R(arg0), U8(4), B(JumpIfFalse), U8(5), /* 91 S> */ B(LdaSmi), U8(1), /* 262 S> */ B(Return), /* 105 S> */ B(Ldar), R(arg1), - /* 111 E> */ B(TestGreaterThan), R(arg0), + /* 111 E> */ B(TestGreaterThan), R(arg0), U8(5), B(JumpIfFalse), U8(5), /* 118 S> */ B(LdaSmi), U8(1), /* 262 S> */ B(Return), /* 132 S> */ B(Ldar), R(arg1), - /* 138 E> */ B(TestLessThanOrEqual), R(arg0), + /* 138 E> */ B(TestLessThanOrEqual), R(arg0), U8(6), B(JumpIfFalse), U8(5), /* 146 S> */ B(LdaSmi), U8(1), /* 262 S> */ B(Return), /* 160 S> */ B(Ldar), R(arg1), - /* 166 E> */ B(TestGreaterThanOrEqual), R(arg0), + /* 166 E> */ B(TestGreaterThanOrEqual), R(arg0), U8(7), B(JumpIfFalse), U8(5), /* 174 S> */ B(LdaSmi), U8(1), /* 262 S> */ B(Return), @@ -752,22 +750,22 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 32 +bytecode array length: 36 bytecodes: [ /* 10 E> */ B(StackCheck), /* 21 S> */ B(Ldar), R(arg1), - /* 27 E> */ B(TestEqual), R(arg0), - B(JumpIfTrue), U8(7), + /* 27 E> */ B(TestEqual), R(arg0), U8(2), + B(JumpIfTrue), U8(8), B(LdaZero), - /* 37 E> */ B(TestLessThan), R(arg0), + /* 37 E> */ B(TestLessThan), R(arg0), U8(3), B(JumpIfFalse), U8(5), /* 48 S> */ B(LdaSmi), U8(1), /* 133 S> */ B(Return), /* 67 S> */ B(LdaZero), - /* 73 E> */ B(TestGreaterThan), R(arg0), - B(JumpIfFalse), U8(9), + /* 73 E> */ B(TestGreaterThan), R(arg0), U8(4), + B(JumpIfFalse), U8(10), B(LdaZero), - /* 82 E> */ B(TestGreaterThan), R(arg1), + /* 82 E> */ B(TestGreaterThan), R(arg1), U8(5), B(JumpIfFalse), U8(4), /* 93 S> */ B(LdaZero), /* 133 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden index 6ac81a606b..f71907ba4d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/IntegerConstants.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/JumpsRequiringConstantWideOperands.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/JumpsRequiringConstantWideOperands.golden index a5efe58049..99e7eac9c2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/JumpsRequiringConstantWideOperands.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/JumpsRequiringConstantWideOperands.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- @@ -329,7 +327,7 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 1408 +bytecode array length: 1412 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), @@ -959,337 +957,337 @@ bytecodes: [ /* 4103 S> */ B(LdaZero), B(Star), R(1), /* 4108 S> */ B(LdaSmi), U8(3), - /* 4108 E> */ B(TestLessThan), R(1), - B(Wide), B(JumpIfFalse), U16(36), + /* 4108 E> */ B(TestLessThan), R(1), U8(2), + B(Wide), B(JumpIfFalse), U16(39), /* 4090 E> */ B(StackCheck), /* 4122 S> */ B(LdaSmi), U8(1), - /* 4128 E> */ B(TestEqual), R(1), + /* 4128 E> */ B(TestEqual), R(1), U8(4), B(Wide), B(JumpIfFalse), U16(7), - /* 4134 S> */ B(Wide), B(Jump), U16(15), + /* 4134 S> */ B(Wide), B(Jump), U16(16), /* 4146 S> */ B(LdaSmi), U8(2), - /* 4152 E> */ B(TestEqual), R(1), + /* 4152 E> */ B(TestEqual), R(1), U8(5), B(Wide), B(JumpIfFalse), U16(7), - /* 4158 S> */ B(Wide), B(Jump), U16(11), + /* 4158 S> */ B(Wide), B(Jump), U16(12), /* 4114 S> */ B(Ldar), R(1), - B(Inc), U8(1), + B(Inc), U8(3), B(Star), R(1), - B(Jump), U8(-39), + B(JumpLoop), U8(-42), U8(0), /* 4167 S> */ B(LdaSmi), U8(3), /* 4177 S> */ B(Return), ] constant pool: [ - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.1, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.2, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.3, - 0.4, - 0.4, - 0.4, - 0.4, - 0.4, - 0.4, - 0.4, - 0.4, + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.1], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.2], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.3], + HEAP_NUMBER_TYPE [0.4], + HEAP_NUMBER_TYPE [0.4], + HEAP_NUMBER_TYPE [0.4], + HEAP_NUMBER_TYPE [0.4], + HEAP_NUMBER_TYPE [0.4], + HEAP_NUMBER_TYPE [0.4], + HEAP_NUMBER_TYPE [0.4], + HEAP_NUMBER_TYPE [0.4], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden index 4dbbdafd5e..d9d8f79e0a 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: yes --- @@ -48,7 +46,7 @@ bytecodes: [ /* 56 S> */ B(Return), ] constant pool: [ - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -59,7 +57,7 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 26 +bytecode array length: 29 bytecodes: [ B(LdaTheHole), B(Star), R(0), @@ -72,11 +70,12 @@ bytecodes: [ B(Star), R(2), /* 45 E> */ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), B(Mov), R(1), R(0), + B(Mov), R(1), R(0), B(LdaUndefined), /* 52 S> */ B(Return), ] constant pool: [ - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -106,7 +105,7 @@ bytecodes: [ /* 54 S> */ B(Return), ] constant pool: [ - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden index 0b25fbf329..eb2a5c6b47 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -13,22 +11,22 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 21 +bytecode array length: 23 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateClosure), U8(0), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(10), - /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(LdaUndefined), /* 72 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -39,18 +37,18 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 34 +bytecode array length: 37 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateClosure), U8(0), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(10), - /* 42 E> */ B(StaContextSlot), R(context), U8(4), - /* 72 S> */ B(LdaContextSlot), R(context), U8(4), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 72 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(1), B(Star), R(2), @@ -58,8 +56,8 @@ bytecodes: [ /* 82 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -70,31 +68,31 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 42 +bytecode array length: 46 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateClosure), U8(0), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), /* 45 S> */ B(LdaSmi), U8(20), B(Star), R(2), - /* 45 E> */ B(LdaContextSlot), R(context), U8(4), + /* 45 E> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(1), B(Star), R(3), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), B(Ldar), R(2), - B(StaContextSlot), R(context), U8(4), - /* 45 E> */ B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 45 E> */ B(StaContextSlot), R(context), U8(4), U8(0), B(LdaUndefined), /* 78 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -105,32 +103,32 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 44 +bytecode array length: 48 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateClosure), U8(0), U8(2), B(Star), R(0), /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(10), - /* 42 E> */ B(StaContextSlot), R(context), U8(4), + /* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0), /* 46 S> */ B(LdaSmi), U8(20), B(Star), R(2), - /* 48 E> */ B(LdaContextSlot), R(context), U8(4), + /* 48 E> */ B(LdaContextSlot), R(context), U8(4), U8(0), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(1), B(Star), R(3), B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), B(Ldar), R(2), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(LdaUndefined), /* 80 S> */ B(Return), ] constant pool: [ - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden index dd9f714394..9c1c1b3701 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LoadGlobal.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -19,7 +17,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 21 E> */ B(StackCheck), - /* 26 S> */ B(LdaGlobal), U8(1), + /* 26 S> */ B(LdaGlobal), U8(2), /* 36 S> */ B(Return), ] constant pool: [ @@ -38,7 +36,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 27 E> */ B(StackCheck), - /* 32 S> */ B(LdaGlobal), U8(1), + /* 32 S> */ B(LdaGlobal), U8(2), /* 42 S> */ B(Return), ] constant pool: [ @@ -57,7 +55,7 @@ parameter count: 1 bytecode array length: 4 bytecodes: [ /* 17 E> */ B(StackCheck), - /* 22 S> */ B(LdaGlobal), U8(1), + /* 22 S> */ B(LdaGlobal), U8(2), /* 32 S> */ B(Return), ] constant pool: [ @@ -203,270 +201,270 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 646 +bytecode array length: 650 bytecodes: [ /* 17 E> */ B(StackCheck), /* 25 S> */ B(Nop), - /* 26 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 26 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(2), /* 35 S> */ B(Nop), - /* 36 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(3), + /* 36 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4), /* 45 S> */ B(Nop), - /* 46 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(5), + /* 46 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(6), /* 55 S> */ B(Nop), - /* 56 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(7), + /* 56 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(8), /* 65 S> */ B(Nop), - /* 66 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(9), + /* 66 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(10), /* 75 S> */ B(Nop), - /* 76 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(11), + /* 76 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(12), /* 85 S> */ B(Nop), - /* 86 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(13), + /* 86 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(14), /* 95 S> */ B(Nop), - /* 96 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(15), + /* 96 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(16), /* 105 S> */ B(Nop), - /* 106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(17), + /* 106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(18), /* 115 S> */ B(Nop), - /* 116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(19), + /* 116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(20), /* 125 S> */ B(Nop), - /* 126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(21), + /* 126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(22), /* 135 S> */ B(Nop), - /* 136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(23), + /* 136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(24), /* 145 S> */ B(Nop), - /* 146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(25), + /* 146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(26), /* 155 S> */ B(Nop), - /* 156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(27), + /* 156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(28), /* 165 S> */ B(Nop), - /* 166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(29), + /* 166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(30), /* 175 S> */ B(Nop), - /* 176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(31), + /* 176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(32), /* 185 S> */ B(Nop), - /* 186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(33), + /* 186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(34), /* 195 S> */ B(Nop), - /* 196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(35), + /* 196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(36), /* 205 S> */ B(Nop), - /* 206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(37), + /* 206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(38), /* 215 S> */ B(Nop), - /* 216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(39), + /* 216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(40), /* 225 S> */ B(Nop), - /* 226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(41), + /* 226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(42), /* 235 S> */ B(Nop), - /* 236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(43), + /* 236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(44), /* 245 S> */ B(Nop), - /* 246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(45), + /* 246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(46), /* 255 S> */ B(Nop), - /* 256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(47), + /* 256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(48), /* 265 S> */ B(Nop), - /* 266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(49), + /* 266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(50), /* 275 S> */ B(Nop), - /* 276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(51), + /* 276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(52), /* 285 S> */ B(Nop), - /* 286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(53), + /* 286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(54), /* 295 S> */ B(Nop), - /* 296 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(55), + /* 296 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(56), /* 305 S> */ B(Nop), - /* 306 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(57), + /* 306 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(58), /* 315 S> */ B(Nop), - /* 316 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(59), + /* 316 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(60), /* 325 S> */ B(Nop), - /* 326 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(61), + /* 326 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(62), /* 335 S> */ B(Nop), - /* 336 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(63), + /* 336 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(64), /* 345 S> */ B(Nop), - /* 346 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(65), + /* 346 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(66), /* 355 S> */ B(Nop), - /* 356 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(67), + /* 356 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(68), /* 365 S> */ B(Nop), - /* 366 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(69), + /* 366 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(70), /* 375 S> */ B(Nop), - /* 376 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(71), + /* 376 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(72), /* 385 S> */ B(Nop), - /* 386 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(73), + /* 386 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(74), /* 395 S> */ B(Nop), - /* 396 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(75), + /* 396 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(76), /* 405 S> */ B(Nop), - /* 406 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(77), + /* 406 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(78), /* 415 S> */ B(Nop), - /* 416 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(79), + /* 416 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(80), /* 425 S> */ B(Nop), - /* 426 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(81), + /* 426 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(82), /* 435 S> */ B(Nop), - /* 436 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(83), + /* 436 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(84), /* 445 S> */ B(Nop), - /* 446 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(85), + /* 446 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(86), /* 455 S> */ B(Nop), - /* 456 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(87), + /* 456 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(88), /* 465 S> */ B(Nop), - /* 466 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(89), + /* 466 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(90), /* 475 S> */ B(Nop), - /* 476 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(91), + /* 476 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(92), /* 485 S> */ B(Nop), - /* 486 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(93), + /* 486 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(94), /* 495 S> */ B(Nop), - /* 496 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(95), + /* 496 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(96), /* 505 S> */ B(Nop), - /* 506 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(97), + /* 506 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(98), /* 515 S> */ B(Nop), - /* 516 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(99), + /* 516 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(100), /* 525 S> */ B(Nop), - /* 526 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(101), + /* 526 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(102), /* 535 S> */ B(Nop), - /* 536 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(103), + /* 536 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(104), /* 545 S> */ B(Nop), - /* 546 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(105), + /* 546 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(106), /* 555 S> */ B(Nop), - /* 556 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(107), + /* 556 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(108), /* 565 S> */ B(Nop), - /* 566 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(109), + /* 566 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(110), /* 575 S> */ B(Nop), - /* 576 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(111), + /* 576 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(112), /* 585 S> */ B(Nop), - /* 586 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(113), + /* 586 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(114), /* 595 S> */ B(Nop), - /* 596 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(115), + /* 596 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(116), /* 605 S> */ B(Nop), - /* 606 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(117), + /* 606 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(118), /* 615 S> */ B(Nop), - /* 616 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(119), + /* 616 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(120), /* 625 S> */ B(Nop), - /* 626 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(121), + /* 626 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(122), /* 635 S> */ B(Nop), - /* 636 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(123), + /* 636 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(124), /* 645 S> */ B(Nop), - /* 646 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(125), + /* 646 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(126), /* 655 S> */ B(Nop), - /* 656 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(127), + /* 656 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(128), /* 665 S> */ B(Nop), - /* 666 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(129), + /* 666 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(130), /* 675 S> */ B(Nop), - /* 676 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(131), + /* 676 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(132), /* 685 S> */ B(Nop), - /* 686 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(133), + /* 686 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(134), /* 695 S> */ B(Nop), - /* 696 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(135), + /* 696 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(136), /* 705 S> */ B(Nop), - /* 706 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(137), + /* 706 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(138), /* 715 S> */ B(Nop), - /* 716 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(139), + /* 716 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(140), /* 725 S> */ B(Nop), - /* 726 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(141), + /* 726 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(142), /* 735 S> */ B(Nop), - /* 736 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(143), + /* 736 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(144), /* 745 S> */ B(Nop), - /* 746 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(145), + /* 746 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(146), /* 755 S> */ B(Nop), - /* 756 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(147), + /* 756 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(148), /* 765 S> */ B(Nop), - /* 766 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(149), + /* 766 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(150), /* 775 S> */ B(Nop), - /* 776 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(151), + /* 776 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(152), /* 785 S> */ B(Nop), - /* 786 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(153), + /* 786 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(154), /* 795 S> */ B(Nop), - /* 796 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(155), + /* 796 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(156), /* 805 S> */ B(Nop), - /* 806 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(157), + /* 806 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(158), /* 815 S> */ B(Nop), - /* 816 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(159), + /* 816 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(160), /* 825 S> */ B(Nop), - /* 826 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(161), + /* 826 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(162), /* 835 S> */ B(Nop), - /* 836 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(163), + /* 836 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(164), /* 845 S> */ B(Nop), - /* 846 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(165), + /* 846 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(166), /* 855 S> */ B(Nop), - /* 856 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(167), + /* 856 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(168), /* 865 S> */ B(Nop), - /* 866 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(169), + /* 866 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(170), /* 875 S> */ B(Nop), - /* 876 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(171), + /* 876 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(172), /* 885 S> */ B(Nop), - /* 886 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(173), + /* 886 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(174), /* 895 S> */ B(Nop), - /* 896 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(175), + /* 896 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(176), /* 905 S> */ B(Nop), - /* 906 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(177), + /* 906 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(178), /* 915 S> */ B(Nop), - /* 916 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(179), + /* 916 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(180), /* 925 S> */ B(Nop), - /* 926 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(181), + /* 926 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(182), /* 935 S> */ B(Nop), - /* 936 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(183), + /* 936 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(184), /* 945 S> */ B(Nop), - /* 946 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(185), + /* 946 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(186), /* 955 S> */ B(Nop), - /* 956 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(187), + /* 956 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(188), /* 965 S> */ B(Nop), - /* 966 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(189), + /* 966 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(190), /* 975 S> */ B(Nop), - /* 976 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(191), + /* 976 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(192), /* 985 S> */ B(Nop), - /* 986 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(193), + /* 986 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(194), /* 995 S> */ B(Nop), - /* 996 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(195), + /* 996 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(196), /* 1005 S> */ B(Nop), - /* 1006 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(197), + /* 1006 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(198), /* 1015 S> */ B(Nop), - /* 1016 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(199), + /* 1016 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(200), /* 1025 S> */ B(Nop), - /* 1026 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(201), + /* 1026 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(202), /* 1035 S> */ B(Nop), - /* 1036 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(203), + /* 1036 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(204), /* 1045 S> */ B(Nop), - /* 1046 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(205), + /* 1046 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(206), /* 1055 S> */ B(Nop), - /* 1056 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(207), + /* 1056 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(208), /* 1065 S> */ B(Nop), - /* 1066 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(209), + /* 1066 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(210), /* 1075 S> */ B(Nop), - /* 1076 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(211), + /* 1076 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(212), /* 1085 S> */ B(Nop), - /* 1086 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(213), + /* 1086 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(214), /* 1095 S> */ B(Nop), - /* 1096 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(215), + /* 1096 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(216), /* 1105 S> */ B(Nop), - /* 1106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(217), + /* 1106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(218), /* 1115 S> */ B(Nop), - /* 1116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(219), + /* 1116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(220), /* 1125 S> */ B(Nop), - /* 1126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(221), + /* 1126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(222), /* 1135 S> */ B(Nop), - /* 1136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(223), + /* 1136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(224), /* 1145 S> */ B(Nop), - /* 1146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(225), + /* 1146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(226), /* 1155 S> */ B(Nop), - /* 1156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(227), + /* 1156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(228), /* 1165 S> */ B(Nop), - /* 1166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(229), + /* 1166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(230), /* 1175 S> */ B(Nop), - /* 1176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(231), + /* 1176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(232), /* 1185 S> */ B(Nop), - /* 1186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(233), + /* 1186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(234), /* 1195 S> */ B(Nop), - /* 1196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(235), + /* 1196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(236), /* 1205 S> */ B(Nop), - /* 1206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(237), + /* 1206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(238), /* 1215 S> */ B(Nop), - /* 1216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(239), + /* 1216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(240), /* 1225 S> */ B(Nop), - /* 1226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(241), + /* 1226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(242), /* 1235 S> */ B(Nop), - /* 1236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(243), + /* 1236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(244), /* 1245 S> */ B(Nop), - /* 1246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(245), + /* 1246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(246), /* 1255 S> */ B(Nop), - /* 1256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(247), + /* 1256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(248), /* 1265 S> */ B(Nop), - /* 1266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(249), + /* 1266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(250), /* 1275 S> */ B(Nop), - /* 1276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(251), + /* 1276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(252), /* 1285 S> */ B(Nop), - /* 1286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(253), + /* 1286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(254), /* 1295 S> */ B(Nop), - /* 1296 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(255), - /* 1305 S> */ B(Wide), B(LdaGlobal), U16(257), + /* 1296 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(256), + /* 1305 S> */ B(Wide), B(LdaGlobal), U16(258), /* 1315 S> */ B(Return), ] constant pool: [ - "name", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden index b8c8c5fa72..fae86a673d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LogicalExpressions.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- @@ -33,13 +31,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 14 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(LdaSmi), U8(1), - /* 55 E> */ B(TestEqual), R(0), + /* 55 E> */ B(TestEqual), R(0), U8(2), B(JumpIfTrue), U8(4), B(LdaSmi), U8(3), /* 67 S> */ B(Return), @@ -75,13 +73,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 13 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 45 S> */ B(LdaZero), - /* 55 E> */ B(TestEqual), R(0), + /* 55 E> */ B(TestEqual), R(0), U8(2), B(JumpIfFalse), U8(4), B(LdaSmi), U8(3), /* 67 S> */ B(Return), @@ -319,7 +317,7 @@ bytecodes: [ /* 624 S> */ B(Return), ] constant pool: [ - 260, + Smi [260], ] handlers: [ ] @@ -505,7 +503,7 @@ bytecodes: [ /* 624 S> */ B(Return), ] constant pool: [ - 260, + Smi [260], ] handlers: [ ] @@ -548,7 +546,7 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 278 +bytecode array length: 279 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), @@ -558,7 +556,7 @@ bytecodes: [ /* 60 S> */ B(LdaSmi), U8(3), B(Star), R(2), /* 63 S> */ B(LdaSmi), U8(3), - /* 73 E> */ B(TestGreaterThan), R(0), + /* 73 E> */ B(TestGreaterThan), R(0), U8(2), B(JumpIfTrueConstant), U8(0), B(LdaSmi), U8(1), B(Star), R(1), @@ -692,7 +690,7 @@ bytecodes: [ /* 630 S> */ B(Return), ] constant pool: [ - 260, + Smi [260], ] handlers: [ ] @@ -735,7 +733,7 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 277 +bytecode array length: 278 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), @@ -745,7 +743,7 @@ bytecodes: [ /* 60 S> */ B(LdaSmi), U8(3), B(Star), R(2), /* 63 S> */ B(LdaSmi), U8(5), - /* 73 E> */ B(TestLessThan), R(0), + /* 73 E> */ B(TestLessThan), R(0), U8(2), B(JumpIfFalseConstant), U8(0), B(LdaSmi), U8(1), B(Star), R(1), @@ -879,7 +877,7 @@ bytecodes: [ /* 630 S> */ B(Return), ] constant pool: [ - 260, + Smi [260], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden index ed13d254ac..acef8f74ad 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden @@ -3,9 +3,8 @@ # --- -pool type: string -execute: yes wrap: yes +test function name: f --- snippet: " @@ -13,41 +12,41 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 68 +bytecode array length: 73 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(5), + B(StaContextSlot), R(context), U8(6), U8(0), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), - /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaConstant), U8(0), - B(Star), R(3), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), + B(StaContextSlot), R(context), U8(5), U8(0), + /* 10 E> */ B(StackCheck), + /* 14 S> */ B(LdaConstant), U8(0), + B(Star), R(4), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(4), U8(1), R(1), B(LdaConstant), U8(1), B(Star), R(3), B(LdaZero), B(Star), R(7), - B(LdaSmi), U8(30), + B(LdaSmi), U8(10), B(Star), R(8), - B(LdaSmi), U8(34), + B(LdaSmi), U8(14), B(Star), R(9), B(Mov), R(1), R(4), B(Mov), R(3), R(5), B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 34 E> */ B(Call), R(1), R(2), U8(2), U8(0), - /* 55 S> */ B(LdaLookupSlot), U8(2), - /* 65 S> */ B(Return), + /* 14 E> */ B(Call), R(1), R(2), U8(2), U8(0), + /* 35 S> */ B(LdaLookupGlobalSlot), U8(2), U8(4), U8(1), + /* 45 S> */ B(Return), ] constant pool: [ - "eval", - "var x = 10;", - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["eval"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["var x = 10;"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -58,42 +57,42 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 69 +bytecode array length: 74 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(5), + B(StaContextSlot), R(context), U8(6), U8(0), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), - /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaConstant), U8(0), - B(Star), R(3), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), + B(StaContextSlot), R(context), U8(5), U8(0), + /* 10 E> */ B(StackCheck), + /* 14 S> */ B(LdaConstant), U8(0), + B(Star), R(4), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(4), U8(1), R(1), B(LdaConstant), U8(1), B(Star), R(3), B(LdaZero), B(Star), R(7), - B(LdaSmi), U8(30), + B(LdaSmi), U8(10), B(Star), R(8), - B(LdaSmi), U8(34), + B(LdaSmi), U8(14), B(Star), R(9), B(Mov), R(1), R(4), B(Mov), R(3), R(5), B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 34 E> */ B(Call), R(1), R(2), U8(2), U8(0), - /* 55 S> */ B(LdaLookupSlotInsideTypeof), U8(2), + /* 14 E> */ B(Call), R(1), R(2), U8(2), U8(0), + /* 35 S> */ B(LdaLookupGlobalSlotInsideTypeof), U8(2), U8(4), U8(1), B(TypeOf), - /* 72 S> */ B(Return), + /* 52 S> */ B(Return), ] constant pool: [ - "eval", - "var x = 10;", - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["eval"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["var x = 10;"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -104,42 +103,142 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 70 +bytecode array length: 73 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), + B(StaContextSlot), R(context), U8(4), U8(0), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(5), + B(StaContextSlot), R(context), U8(6), U8(0), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(6), - /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaSmi), U8(20), - /* 36 E> */ B(StaLookupSlotSloppy), U8(0), - /* 42 S> */ B(LdaConstant), U8(1), - B(Star), R(3), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(3), U8(1), R(1), + B(StaContextSlot), R(context), U8(5), U8(0), + /* 10 E> */ B(StackCheck), + /* 14 S> */ B(LdaSmi), U8(20), + /* 16 E> */ B(StaLookupSlotSloppy), U8(0), + /* 22 S> */ B(LdaConstant), U8(1), + B(Star), R(4), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(4), U8(1), R(1), B(LdaConstant), U8(2), B(Star), R(3), B(LdaZero), B(Star), R(7), - B(LdaSmi), U8(30), + B(LdaSmi), U8(10), + B(Star), R(8), + B(LdaSmi), U8(29), + B(Star), R(9), + B(Mov), R(1), R(4), + B(Mov), R(3), R(5), + B(Mov), R(closure), R(6), + B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), + B(Star), R(1), + /* 29 E> */ B(Call), R(1), R(2), U8(2), U8(0), + /* 39 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["eval"], + ONE_BYTE_INTERNALIZED_STRING_TYPE [""], +] +handlers: [ +] + +--- +snippet: " + var x = 20; + f = function(){ + eval('var x = 10'); + return x; + } + f(); +" +frame size: 10 +parameter count: 1 +bytecode array length: 73 +bytecodes: [ + B(CreateFunctionContext), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + B(CreateMappedArguments), + B(StaContextSlot), R(context), U8(6), U8(0), + B(Ldar), R(new_target), + B(StaContextSlot), R(context), U8(5), U8(0), + /* 38 E> */ B(StackCheck), + /* 44 S> */ B(LdaConstant), U8(0), + B(Star), R(4), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(4), U8(1), R(1), + B(LdaConstant), U8(1), + B(Star), R(3), + B(LdaZero), + B(Star), R(7), + B(LdaSmi), U8(38), + B(Star), R(8), + B(LdaSmi), U8(44), + B(Star), R(9), + B(Mov), R(1), R(4), + B(Mov), R(3), R(5), + B(Mov), R(closure), R(6), + B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), + B(Star), R(1), + /* 44 E> */ B(Call), R(1), R(2), U8(2), U8(0), + /* 66 S> */ B(LdaLookupContextSlot), U8(2), U8(6), U8(1), + /* 76 S> */ B(Return), +] +constant pool: [ + ONE_BYTE_INTERNALIZED_STRING_TYPE ["eval"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["var x = 10"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], +] +handlers: [ +] + +--- +snippet: " + x = 20; + f = function(){ + eval('var x = 10'); + return x; + } + f(); +" +frame size: 10 +parameter count: 1 +bytecode array length: 73 +bytecodes: [ + B(CreateFunctionContext), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + B(CreateMappedArguments), + B(StaContextSlot), R(context), U8(6), U8(0), + B(Ldar), R(new_target), + B(StaContextSlot), R(context), U8(5), U8(0), + /* 34 E> */ B(StackCheck), + /* 40 S> */ B(LdaConstant), U8(0), + B(Star), R(4), + B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(4), U8(1), R(1), + B(LdaConstant), U8(1), + B(Star), R(3), + B(LdaZero), + B(Star), R(7), + B(LdaSmi), U8(34), B(Star), R(8), - B(LdaSmi), U8(49), + B(LdaSmi), U8(40), B(Star), R(9), B(Mov), R(1), R(4), B(Mov), R(3), R(5), B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 49 E> */ B(Call), R(1), R(2), U8(2), U8(0), - /* 59 S> */ B(Return), + /* 40 E> */ B(Call), R(1), R(2), U8(2), U8(0), + /* 62 S> */ B(LdaLookupGlobalSlot), U8(2), U8(4), U8(1), + /* 72 S> */ B(Return), ] constant pool: [ - "x", - "eval", - "", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["eval"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["var x = 10"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden index 41476311e8..ce915d51c0 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotInEval.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -19,14 +17,14 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 4 +bytecode array length: 6 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 15 S> */ B(LdaLookupSlot), U8(0), + /* 15 S> */ B(LdaLookupGlobalSlot), U8(0), U8(2), U8(1), /* 25 S> */ B(Return), ] constant pool: [ - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -51,7 +49,7 @@ bytecodes: [ /* 23 S> */ B(Return), ] constant pool: [ - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -76,7 +74,7 @@ bytecodes: [ /* 37 S> */ B(Return), ] constant pool: [ - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -92,15 +90,15 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 5 +bytecode array length: 7 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 15 S> */ B(LdaLookupSlotInsideTypeof), U8(0), + /* 15 S> */ B(LdaLookupGlobalSlotInsideTypeof), U8(0), U8(2), U8(1), B(TypeOf), /* 32 S> */ B(Return), ] constant pool: [ - "x", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden index a668d62452..f7e64f4864 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlotWideInEval.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: no test function name: f @@ -279,7 +277,7 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 1030 +bytecode array length: 1034 bytecodes: [ /* 10 E> */ B(StackCheck), /* 22 S> */ B(LdaConstant), U8(0), @@ -794,267 +792,267 @@ bytecodes: [ B(Star), R(0), /* 3082 S> */ B(LdaConstant), U8(255), B(Star), R(0), - /* 3086 S> */ B(Wide), B(LdaLookupSlot), U16(256), + /* 3086 S> */ B(Wide), B(LdaLookupGlobalSlot), U16(256), U16(2), U16(1), /* 3095 S> */ B(Return), ] constant pool: [ - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -1330,7 +1328,7 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 1031 +bytecode array length: 1035 bytecodes: [ /* 10 E> */ B(StackCheck), /* 22 S> */ B(LdaConstant), U8(0), @@ -1845,268 +1843,268 @@ bytecodes: [ B(Star), R(0), /* 3082 S> */ B(LdaConstant), U8(255), B(Star), R(0), - /* 3086 S> */ B(Wide), B(LdaLookupSlotInsideTypeof), U16(256), + /* 3086 S> */ B(Wide), B(LdaLookupGlobalSlotInsideTypeof), U16(256), U16(2), U16(1), B(TypeOf), /* 3102 S> */ B(Return), ] constant pool: [ - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -2903,263 +2901,263 @@ bytecodes: [ /* 3093 S> */ B(Return), ] constant pool: [ - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -3957,263 +3955,263 @@ bytecodes: [ /* 3106 S> */ B(Return), ] constant pool: [ - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + HEAP_NUMBER_TYPE [2.3], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden new file mode 100644 index 0000000000..62dbeb7ada --- /dev/null +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden @@ -0,0 +1,896 @@ +# +# Autogenerated by generate-bytecode-expectations. +# + +--- +wrap: no +module: yes +top level: yes + +--- +snippet: " + import \"bar\"; +" +frame size: 8 +parameter count: 2 +bytecode array length: 133 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(21), + B(ResumeGenerator), R(new_target), + B(Star), R(1), + B(LdaZero), + B(TestEqualStrict), R(1), U8(0), + B(JumpIfTrue), U8(71), + B(LdaSmi), U8(76), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(LdaConstant), U8(0), + B(Star), R(4), + B(Mov), R(arg0), R(2), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), + B(Ldar), R(3), + B(Mov), R(closure), R(2), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaContextSlot), R(context), U8(5), U8(0), + B(Star), R(2), + B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaZero), + B(SuspendGenerator), R(3), + B(Ldar), R(2), + /* 13 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(3), U8(1), + B(Star), R(4), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), + B(Star), R(5), + B(LdaZero), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(26), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(16), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(7), + B(Mov), R(4), R(6), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(6), U8(2), + /* 13 S> */ B(Return), + B(Ldar), R(4), + /* 0 E> */ B(Throw), + B(LdaUndefined), + /* 13 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, +] +handlers: [ +] + +--- +snippet: " + import {foo} from \"bar\"; +" +frame size: 8 +parameter count: 2 +bytecode array length: 133 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(21), + B(ResumeGenerator), R(new_target), + B(Star), R(1), + B(LdaZero), + B(TestEqualStrict), R(1), U8(0), + B(JumpIfTrue), U8(71), + B(LdaSmi), U8(76), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(LdaConstant), U8(0), + B(Star), R(4), + B(Mov), R(arg0), R(2), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), + B(Ldar), R(3), + B(Mov), R(closure), R(2), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaContextSlot), R(context), U8(5), U8(0), + B(Star), R(2), + B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaZero), + B(SuspendGenerator), R(3), + B(Ldar), R(2), + /* 24 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(3), U8(1), + B(Star), R(4), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), + B(Star), R(5), + B(LdaZero), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(26), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(16), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(7), + B(Mov), R(4), R(6), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(6), U8(2), + /* 24 S> */ B(Return), + B(Ldar), R(4), + /* 0 E> */ B(Throw), + B(LdaUndefined), + /* 24 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, +] +handlers: [ +] + +--- +snippet: " + import {foo as goo} from \"bar\"; + goo(42); + { let x; { goo(42) } }; +" +frame size: 9 +parameter count: 2 +bytecode array length: 223 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(21), + B(ResumeGenerator), R(new_target), + B(Star), R(2), + B(LdaZero), + B(TestEqualStrict), R(2), U8(0), + B(JumpIfTrue), U8(71), + B(LdaSmi), U8(76), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(2), + B(LdaConstant), U8(0), + B(Star), R(5), + B(Mov), R(arg0), R(3), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(4), + B(Ldar), R(4), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), + B(StaContextSlot), R(context), U8(5), U8(0), + B(Star), R(3), + B(LdrContextSlot), R(context), U8(5), U8(0), R(4), + B(LdaZero), + B(SuspendGenerator), R(4), + B(Ldar), R(3), + /* 64 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(2), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(4), U8(1), + B(Star), R(5), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(4), U8(1), + B(Star), R(6), + B(LdaZero), + B(TestEqualStrict), R(6), U8(0), + B(JumpIfTrue), U8(26), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(6), U8(0), + B(JumpIfTrue), U8(16), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(8), + B(Mov), R(5), R(7), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(7), U8(2), + /* 64 S> */ B(Return), + B(Ldar), R(5), + /* 0 E> */ B(Throw), + /* 32 S> */ B(LdrUndefined), R(4), + B(LdaConstant), U8(1), + B(Star), R(6), + B(LdaZero), + B(Star), R(7), + /* 32 E> */ B(CallRuntime), U16(Runtime::kLoadModuleImport), R(6), U8(2), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(2), + B(Star), R(8), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(8), U8(1), + B(Star), R(3), + B(LdaSmi), U8(42), + B(Star), R(5), + /* 32 E> */ B(Call), R(3), R(4), U8(2), U8(2), + B(Ldar), R(closure), + B(CreateBlockContext), U8(3), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 47 S> */ B(LdaUndefined), + /* 47 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 52 S> */ B(LdrUndefined), R(4), + B(LdaConstant), U8(1), + B(Star), R(6), + B(LdaZero), + B(Star), R(7), + /* 52 E> */ B(CallRuntime), U16(Runtime::kLoadModuleImport), R(6), U8(2), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(2), + B(Star), R(8), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(8), U8(1), + B(Star), R(3), + B(LdaSmi), U8(42), + B(Star), R(5), + /* 52 E> */ B(Call), R(3), R(4), U8(2), U8(4), + B(PopContext), R(1), + B(LdaUndefined), + /* 64 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["foo"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["goo"], + FIXED_ARRAY_TYPE, +] +handlers: [ +] + +--- +snippet: " + export var foo = 42; + foo++; + { let x; { foo++ } }; +" +frame size: 9 +parameter count: 2 +bytecode array length: 208 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(21), + B(ResumeGenerator), R(new_target), + B(Star), R(2), + B(LdaZero), + B(TestEqualStrict), R(2), U8(0), + B(JumpIfTrue), U8(71), + B(LdaSmi), U8(76), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(2), + B(LdaConstant), U8(0), + B(Star), R(5), + B(Mov), R(arg0), R(3), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(4), + B(Ldar), R(4), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), + B(StaContextSlot), R(context), U8(5), U8(0), + B(Star), R(3), + B(LdrContextSlot), R(context), U8(5), U8(0), R(4), + B(LdaZero), + B(SuspendGenerator), R(4), + B(Ldar), R(3), + /* 49 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(2), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(4), U8(1), + B(Star), R(5), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(4), U8(1), + B(Star), R(6), + B(LdaZero), + B(TestEqualStrict), R(6), U8(0), + B(JumpIfTrue), U8(26), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(6), U8(0), + B(JumpIfTrue), U8(16), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(8), + B(Mov), R(5), R(7), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(7), U8(2), + /* 49 S> */ B(Return), + B(Ldar), R(5), + /* 0 E> */ B(Throw), + /* 17 S> */ B(LdaSmi), U8(42), + B(Star), R(4), + B(LdaConstant), U8(1), + B(Star), R(3), + /* 17 E> */ B(CallRuntime), U16(Runtime::kStoreModuleExport), R(3), U8(2), + /* 21 S> */ B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kLoadModuleExport), R(3), U8(1), + B(Inc), U8(2), + B(Star), R(4), + B(LdaConstant), U8(1), + B(Star), R(3), + /* 24 E> */ B(CallRuntime), U16(Runtime::kStoreModuleExport), R(3), U8(2), + B(Ldar), R(closure), + B(CreateBlockContext), U8(2), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 34 S> */ B(LdaUndefined), + /* 34 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 39 S> */ B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kLoadModuleExport), R(3), U8(1), + B(Inc), U8(3), + B(Star), R(4), + B(LdaConstant), U8(1), + B(Star), R(3), + /* 42 E> */ B(CallRuntime), U16(Runtime::kStoreModuleExport), R(3), U8(2), + B(PopContext), R(1), + B(LdaUndefined), + /* 49 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["foo"], + FIXED_ARRAY_TYPE, +] +handlers: [ +] + +--- +snippet: " + export let foo = 42; + foo++; + { let x; { foo++ } }; +" +frame size: 9 +parameter count: 2 +bytecode array length: 242 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(21), + B(ResumeGenerator), R(new_target), + B(Star), R(2), + B(LdaZero), + B(TestEqualStrict), R(2), U8(0), + B(JumpIfTrue), U8(83), + B(LdaSmi), U8(76), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(2), + B(LdaConstant), U8(0), + B(Star), R(5), + B(Mov), R(arg0), R(3), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + B(LdaTheHole), + B(Star), R(4), + B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kStoreModuleExport), R(3), U8(2), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(4), + B(Ldar), R(4), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), + B(StaContextSlot), R(context), U8(5), U8(0), + B(Star), R(3), + B(LdrContextSlot), R(context), U8(5), U8(0), R(4), + B(LdaZero), + B(SuspendGenerator), R(4), + B(Ldar), R(3), + /* 49 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(2), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(4), U8(1), + B(Star), R(5), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(4), U8(1), + B(Star), R(6), + B(LdaZero), + B(TestEqualStrict), R(6), U8(0), + B(JumpIfTrue), U8(26), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(6), U8(0), + B(JumpIfTrue), U8(16), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(8), + B(Mov), R(5), R(7), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(7), U8(2), + /* 49 S> */ B(Return), + B(Ldar), R(5), + /* 0 E> */ B(Throw), + /* 17 S> */ B(LdaSmi), U8(42), + B(Star), R(4), + B(LdaConstant), U8(1), + B(Star), R(3), + /* 17 E> */ B(CallRuntime), U16(Runtime::kStoreModuleExport), R(3), U8(2), + /* 21 S> */ B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kLoadModuleExport), R(3), U8(1), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(1), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), + B(Inc), U8(2), + B(Star), R(4), + B(LdaConstant), U8(1), + B(Star), R(3), + /* 24 E> */ B(CallRuntime), U16(Runtime::kStoreModuleExport), R(3), U8(2), + B(Ldar), R(closure), + B(CreateBlockContext), U8(2), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 34 S> */ B(LdaUndefined), + /* 34 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 39 S> */ B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kLoadModuleExport), R(3), U8(1), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(1), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), + B(Inc), U8(3), + B(Star), R(4), + B(LdaConstant), U8(1), + B(Star), R(3), + /* 42 E> */ B(CallRuntime), U16(Runtime::kStoreModuleExport), R(3), U8(2), + B(PopContext), R(1), + B(LdaUndefined), + /* 49 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["foo"], + FIXED_ARRAY_TYPE, +] +handlers: [ +] + +--- +snippet: " + export const foo = 42; + foo++; + { let x; { foo++ } }; +" +frame size: 9 +parameter count: 2 +bytecode array length: 230 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(21), + B(ResumeGenerator), R(new_target), + B(Star), R(2), + B(LdaZero), + B(TestEqualStrict), R(2), U8(0), + B(JumpIfTrue), U8(83), + B(LdaSmi), U8(76), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(2), + B(LdaConstant), U8(0), + B(Star), R(5), + B(Mov), R(arg0), R(3), + B(Mov), R(closure), R(4), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(3), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + B(LdaTheHole), + B(Star), R(4), + B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kStoreModuleExport), R(3), U8(2), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(4), + B(Ldar), R(4), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), + B(StaContextSlot), R(context), U8(5), U8(0), + B(Star), R(3), + B(LdrContextSlot), R(context), U8(5), U8(0), R(4), + B(LdaZero), + B(SuspendGenerator), R(4), + B(Ldar), R(3), + /* 51 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(2), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(4), U8(1), + B(Star), R(5), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(4), U8(1), + B(Star), R(6), + B(LdaZero), + B(TestEqualStrict), R(6), U8(0), + B(JumpIfTrue), U8(26), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(6), U8(0), + B(JumpIfTrue), U8(16), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(8), + B(Mov), R(5), R(7), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(7), U8(2), + /* 51 S> */ B(Return), + B(Ldar), R(5), + /* 0 E> */ B(Throw), + /* 19 S> */ B(LdaSmi), U8(42), + B(Star), R(4), + B(LdaConstant), U8(1), + B(Star), R(3), + /* 19 E> */ B(CallRuntime), U16(Runtime::kStoreModuleExport), R(3), U8(2), + /* 23 S> */ B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kLoadModuleExport), R(3), U8(1), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(1), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), + B(Inc), U8(2), + /* 26 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), + B(Ldar), R(closure), + B(CreateBlockContext), U8(2), + B(PushContext), R(1), + B(LdaTheHole), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 36 S> */ B(LdaUndefined), + /* 36 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 41 S> */ B(LdaConstant), U8(1), + B(Star), R(3), + B(CallRuntime), U16(Runtime::kLoadModuleExport), R(3), U8(1), + B(JumpIfNotHole), U8(11), + B(LdaConstant), U8(1), + B(Star), R(4), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(4), U8(1), + B(Inc), U8(3), + /* 44 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), + B(PopContext), R(1), + B(LdaUndefined), + /* 51 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["foo"], + FIXED_ARRAY_TYPE, +] +handlers: [ +] + +--- +snippet: " + export default (function () {}); +" +frame size: 8 +parameter count: 2 +bytecode array length: 159 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(21), + B(ResumeGenerator), R(new_target), + B(Star), R(1), + B(LdaZero), + B(TestEqualStrict), R(1), U8(0), + B(JumpIfTrue), U8(83), + B(LdaSmi), U8(76), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(LdaConstant), U8(0), + B(Star), R(4), + B(Mov), R(arg0), R(2), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + B(LdaTheHole), + B(Star), R(3), + B(LdaConstant), U8(1), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kStoreModuleExport), R(2), U8(2), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), + B(Ldar), R(3), + B(Mov), R(closure), R(2), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaContextSlot), R(context), U8(5), U8(0), + B(Star), R(2), + B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaZero), + B(SuspendGenerator), R(3), + B(Ldar), R(2), + /* 32 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(3), U8(1), + B(Star), R(4), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), + B(Star), R(5), + B(LdaZero), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(26), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(16), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(7), + B(Mov), R(4), R(6), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(6), U8(2), + /* 32 S> */ B(Return), + B(Ldar), R(4), + /* 0 E> */ B(Throw), + B(CreateClosure), U8(2), U8(0), + B(Star), R(3), + B(LdaConstant), U8(1), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kStoreModuleExport), R(2), U8(2), + B(LdaUndefined), + /* 32 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["default"], + SHARED_FUNCTION_INFO_TYPE, +] +handlers: [ +] + +--- +snippet: " + export default (class {}); +" +frame size: 8 +parameter count: 2 +bytecode array length: 196 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(21), + B(ResumeGenerator), R(new_target), + B(Star), R(1), + B(LdaZero), + B(TestEqualStrict), R(1), U8(0), + B(JumpIfTrue), U8(83), + B(LdaSmi), U8(76), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(LdaConstant), U8(0), + B(Star), R(4), + B(Mov), R(arg0), R(2), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + B(LdaTheHole), + B(Star), R(3), + B(LdaConstant), U8(1), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kStoreModuleExport), R(2), U8(2), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), + B(Ldar), R(3), + B(Mov), R(closure), R(2), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaContextSlot), R(context), U8(5), U8(0), + B(Star), R(2), + B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaZero), + B(SuspendGenerator), R(3), + B(Ldar), R(2), + /* 26 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(3), U8(1), + B(Star), R(4), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), + B(Star), R(5), + B(LdaZero), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(26), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(16), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(7), + B(Mov), R(4), R(6), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(6), U8(2), + /* 26 S> */ B(Return), + B(Ldar), R(4), + /* 0 E> */ B(Throw), + /* 16 S> */ B(LdaTheHole), + B(Star), R(2), + B(CreateClosure), U8(2), U8(0), + B(Star), R(3), + B(LdaSmi), U8(16), + B(Star), R(4), + B(LdaSmi), U8(24), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kDefineClass), R(2), U8(4), + B(Star), R(2), + B(LdrNamedProperty), R(2), U8(3), U8(2), R(3), + B(CallRuntime), U16(Runtime::kToFastProperties), R(2), U8(1), + B(StaContextSlot), R(context), U8(6), U8(0), + /* 16 E> */ B(LdrContextSlot), R(context), U8(6), U8(0), R(3), + B(LdaConstant), U8(1), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kStoreModuleExport), R(2), U8(2), + B(LdaUndefined), + /* 26 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["default"], + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["prototype"], +] +handlers: [ +] + +--- +snippet: " + export {foo as goo} from \"bar\" +" +frame size: 8 +parameter count: 2 +bytecode array length: 133 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(21), + B(ResumeGenerator), R(new_target), + B(Star), R(1), + B(LdaZero), + B(TestEqualStrict), R(1), U8(0), + B(JumpIfTrue), U8(71), + B(LdaSmi), U8(76), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(LdaConstant), U8(0), + B(Star), R(4), + B(Mov), R(arg0), R(2), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), + B(Ldar), R(3), + B(Mov), R(closure), R(2), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaContextSlot), R(context), U8(5), U8(0), + B(Star), R(2), + B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaZero), + B(SuspendGenerator), R(3), + B(Ldar), R(2), + /* 30 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(3), U8(1), + B(Star), R(4), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), + B(Star), R(5), + B(LdaZero), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(26), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(16), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(7), + B(Mov), R(4), R(6), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(6), U8(2), + /* 30 S> */ B(Return), + B(Ldar), R(4), + /* 0 E> */ B(Throw), + B(LdaUndefined), + /* 30 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, +] +handlers: [ +] + +--- +snippet: " + export * from \"bar\" +" +frame size: 8 +parameter count: 2 +bytecode array length: 133 +bytecodes: [ + B(Ldar), R(new_target), + B(JumpIfUndefined), U8(21), + B(ResumeGenerator), R(new_target), + B(Star), R(1), + B(LdaZero), + B(TestEqualStrict), R(1), U8(0), + B(JumpIfTrue), U8(71), + B(LdaSmi), U8(76), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(LdaConstant), U8(0), + B(Star), R(4), + B(Mov), R(arg0), R(2), + B(Mov), R(closure), R(3), + B(CallRuntime), U16(Runtime::kPushModuleContext), R(2), U8(3), + B(PushContext), R(0), + B(Ldar), R(this), + B(StaContextSlot), R(context), U8(4), U8(0), + /* 0 E> */ B(StackCheck), + /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), + B(Ldar), R(3), + B(Mov), R(closure), R(2), + B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaContextSlot), R(context), U8(5), U8(0), + B(Star), R(2), + B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaZero), + B(SuspendGenerator), R(3), + B(Ldar), R(2), + /* 19 S> */ B(Return), + B(LdaSmi), U8(-2), + B(Star), R(1), + B(CallRuntime), U16(Runtime::k_GeneratorGetInputOrDebugPos), R(3), U8(1), + B(Star), R(4), + B(CallRuntime), U16(Runtime::k_GeneratorGetResumeMode), R(3), U8(1), + B(Star), R(5), + B(LdaZero), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(26), + B(LdaSmi), U8(2), + B(TestEqualStrict), R(5), U8(0), + B(JumpIfTrue), U8(16), + B(Jump), U8(2), + B(LdaTrue), + B(Star), R(7), + B(Mov), R(4), R(6), + B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(6), U8(2), + /* 19 S> */ B(Return), + B(Ldar), R(4), + /* 0 E> */ B(Throw), + B(LdaUndefined), + /* 19 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, +] +handlers: [ +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden index 090fb0bb7a..f2a8bacc27 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/NewTarget.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -13,9 +11,10 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 7 +bytecode array length: 9 bytecodes: [ B(Mov), R(new_target), R(0), + B(Ldar), R(new_target), /* 30 E> */ B(StackCheck), /* 34 S> */ B(Ldar), R(0), /* 53 S> */ B(Return), @@ -31,9 +30,10 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 6 +bytecode array length: 8 bytecodes: [ B(Mov), R(new_target), R(0), + B(Ldar), R(new_target), /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaUndefined), /* 46 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden index b9c7d0ca4d..7f81d82a2d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiterals.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -21,7 +19,7 @@ bytecodes: [ /* 46 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -40,7 +38,7 @@ bytecodes: [ /* 71 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -57,13 +55,13 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), - /* 75 E> */ B(StaNamedPropertySloppy), R(1), U8(1), U8(1), + /* 75 E> */ B(StaNamedPropertySloppy), R(1), U8(1), U8(2), B(Ldar), R(1), /* 80 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], ] handlers: [ ] @@ -80,14 +78,14 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 45 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), - /* 67 E> */ B(AddSmi), U8(1), R(0), U8(1), - B(StaNamedPropertySloppy), R(1), U8(1), U8(2), + /* 67 E> */ B(AddSmi), U8(1), R(0), U8(2), + B(StaNamedPropertySloppy), R(1), U8(1), U8(3), B(Ldar), R(1), /* 76 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], ] handlers: [ ] @@ -103,14 +101,14 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), B(CreateClosure), U8(1), U8(2), - B(StaNamedPropertySloppy), R(0), U8(2), U8(1), + B(StaNamedPropertySloppy), R(0), U8(2), U8(2), B(Ldar), R(0), /* 67 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["func"], ] handlers: [ ] @@ -126,14 +124,14 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(0), B(CreateClosure), U8(1), U8(2), - B(StaNamedPropertySloppy), R(0), U8(2), U8(1), + B(StaNamedPropertySloppy), R(0), U8(2), U8(2), B(Ldar), R(0), /* 68 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["func"], ] handlers: [ ] @@ -158,13 +156,13 @@ bytecodes: [ B(Star), R(5), B(Mov), R(0), R(1), B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5), - B(Ldar), R(0), + B(Ldar), R(1), /* 68 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -189,14 +187,14 @@ bytecodes: [ B(Star), R(5), B(Mov), R(0), R(1), B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5), - B(Ldar), R(0), + B(Ldar), R(1), /* 102 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -221,13 +219,13 @@ bytecodes: [ B(Star), R(5), B(Mov), R(0), R(1), B(CallRuntime), U16(Runtime::kDefineAccessorPropertyUnchecked), R(1), U8(5), - B(Ldar), R(0), + B(Ldar), R(1), /* 74 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["b"], + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] @@ -251,11 +249,11 @@ bytecodes: [ B(Mov), R(1), R(2), B(Mov), R(0), R(4), /* 57 E> */ B(CallRuntime), U16(Runtime::kSetProperty), R(2), U8(4), - B(Ldar), R(1), + B(Ldar), R(2), /* 62 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -274,11 +272,11 @@ bytecodes: [ B(Star), R(2), B(Mov), R(0), R(1), B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(1), U8(2), - B(Ldar), R(0), + B(Ldar), R(1), /* 62 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -304,12 +302,12 @@ bytecodes: [ B(Star), R(6), B(Mov), R(1), R(2), B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5), - B(Ldar), R(1), + B(Ldar), R(2), /* 69 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["test"], + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -326,7 +324,7 @@ bytecodes: [ /* 42 S> */ B(LdaConstant), U8(0), B(Star), R(0), /* 50 S> */ B(CreateObjectLiteral), U8(1), U8(0), U8(1), R(1), - /* 64 E> */ B(StaNamedPropertySloppy), R(1), U8(2), U8(1), + /* 64 E> */ B(StaNamedPropertySloppy), R(1), U8(2), U8(2), /* 68 E> */ B(ToName), R(3), B(LdaSmi), U8(1), B(Star), R(4), @@ -336,13 +334,13 @@ bytecodes: [ B(Star), R(6), B(Mov), R(1), R(2), B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5), - B(Ldar), R(1), + B(Ldar), R(2), /* 77 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["test"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], ] handlers: [ ] @@ -353,7 +351,7 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 49 +bytecode array length: 46 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), @@ -369,15 +367,14 @@ bytecodes: [ B(Mov), R(1), R(2), B(CallRuntime), U16(Runtime::kDefineDataPropertyInLiteral), R(2), U8(5), B(CreateObjectLiteral), U8(1), U8(0), U8(35), R(4), - B(Mov), R(1), R(2), B(Mov), R(4), R(3), B(CallRuntime), U16(Runtime::kInternalSetPrototype), R(2), U8(2), - B(Ldar), R(1), + B(Ldar), R(2), /* 84 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["test"], + FIXED_ARRAY_TYPE, ] handlers: [ ] @@ -388,7 +385,7 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 73 +bytecode array length: 67 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), @@ -409,7 +406,6 @@ bytecodes: [ B(Star), R(4), B(LdaZero), B(Star), R(5), - B(Mov), R(1), R(2), B(CallRuntime), U16(Runtime::kDefineGetterPropertyUnchecked), R(2), U8(4), B(LdaConstant), U8(3), B(ToName), R(3), @@ -417,18 +413,17 @@ bytecodes: [ B(Star), R(4), B(LdaZero), B(Star), R(5), - B(Mov), R(1), R(2), B(CallRuntime), U16(Runtime::kDefineSetterPropertyUnchecked), R(2), U8(4), - B(Ldar), R(1), + B(Ldar), R(2), /* 99 S> */ B(Return), ] constant pool: [ - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], + SHARED_FUNCTION_INFO_TYPE, + SHARED_FUNCTION_INFO_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden index 62b1ace69d..b281cb7336 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ObjectLiteralsWide.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -790,263 +788,263 @@ bytecodes: [ /* 2638 S> */ B(Return), ] constant pool: [ - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::FIXED_ARRAY_TYPE, + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + FIXED_ARRAY_TYPE, ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden index e58694f982..397b0de724 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: no test function name: f @@ -20,15 +18,14 @@ snippet: " var f = new Outer().getInnerFunc(); f(); " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 16 +bytecode array length: 14 bytecodes: [ /* 97 E> */ B(StackCheck), - /* 102 S> */ B(LdrContextSlot), R(context), U8(1), R(0), - B(LdrContextSlot), R(0), U8(4), R(1), - /* 120 E> */ B(LdaContextSlot), R(context), U8(4), - B(Mul), R(1), U8(1), + /* 102 S> */ B(LdrContextSlot), R(context), U8(4), U8(1), R(0), + /* 120 E> */ B(LdaContextSlot), R(context), U8(4), U8(0), + B(Mul), R(0), U8(2), /* 130 S> */ B(Return), ] constant pool: [ @@ -48,15 +45,13 @@ snippet: " var f = new Outer().getInnerFunc(); f(); " -frame size: 2 +frame size: 0 parameter count: 1 -bytecode array length: 16 +bytecode array length: 11 bytecodes: [ /* 97 E> */ B(StackCheck), - /* 102 S> */ B(LdrContextSlot), R(context), U8(4), R(0), - /* 111 E> */ B(LdrContextSlot), R(context), U8(1), R(1), - B(Ldar), R(0), - B(StaContextSlot), R(1), U8(4), + /* 102 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), + /* 111 E> */ B(StaContextSlot), R(context), U8(4), U8(1), B(LdaUndefined), /* 123 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden index 71b6df7687..01c3ad0694 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Parameters.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: no test function name: f diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden index aadf2dec01..adcf911cdd 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveExpressions.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- @@ -37,7 +35,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 45 S> */ B(AddSmi), U8(3), R(0), U8(1), + /* 45 S> */ B(AddSmi), U8(3), R(0), U8(2), /* 59 S> */ B(Return), ] constant pool: [ @@ -56,7 +54,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), - /* 45 S> */ B(SubSmi), U8(3), R(0), U8(1), + /* 45 S> */ B(SubSmi), U8(3), R(0), U8(2), /* 59 S> */ B(Return), ] constant pool: [ @@ -76,7 +74,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(4), B(Star), R(0), /* 45 S> */ B(LdaSmi), U8(3), - B(Mul), R(0), U8(1), + B(Mul), R(0), U8(2), /* 59 S> */ B(Return), ] constant pool: [ @@ -96,7 +94,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(4), B(Star), R(0), /* 45 S> */ B(LdaSmi), U8(3), - B(Div), R(0), U8(1), + B(Div), R(0), U8(2), /* 59 S> */ B(Return), ] constant pool: [ @@ -116,7 +114,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(4), B(Star), R(0), /* 45 S> */ B(LdaSmi), U8(3), - B(Mod), R(0), U8(1), + B(Mod), R(0), U8(2), /* 59 S> */ B(Return), ] constant pool: [ @@ -135,7 +133,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), - /* 45 S> */ B(BitwiseOrSmi), U8(2), R(0), U8(1), + /* 45 S> */ B(BitwiseOrSmi), U8(2), R(0), U8(2), /* 59 S> */ B(Return), ] constant pool: [ @@ -155,7 +153,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 45 S> */ B(LdaSmi), U8(2), - B(BitwiseXor), R(0), U8(1), + B(BitwiseXor), R(0), U8(2), /* 59 S> */ B(Return), ] constant pool: [ @@ -174,7 +172,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), - /* 45 S> */ B(BitwiseAndSmi), U8(2), R(0), U8(1), + /* 45 S> */ B(BitwiseAndSmi), U8(2), R(0), U8(2), /* 59 S> */ B(Return), ] constant pool: [ @@ -193,7 +191,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(10), B(Star), R(0), - /* 46 S> */ B(ShiftLeftSmi), U8(3), R(0), U8(1), + /* 46 S> */ B(ShiftLeftSmi), U8(3), R(0), U8(2), /* 61 S> */ B(Return), ] constant pool: [ @@ -212,7 +210,7 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(10), B(Star), R(0), - /* 46 S> */ B(ShiftRightSmi), U8(3), R(0), U8(1), + /* 46 S> */ B(ShiftRightSmi), U8(3), R(0), U8(2), /* 61 S> */ B(Return), ] constant pool: [ @@ -232,7 +230,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(10), B(Star), R(0), /* 46 S> */ B(LdaSmi), U8(3), - B(ShiftRightLogical), R(0), U8(1), + B(ShiftRightLogical), R(0), U8(2), /* 62 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden index 7eaaa88d05..48db168d03 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PrimitiveReturnStatements.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden index 23501bd4b9..96c0428c6c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -19,12 +17,12 @@ bytecode array length: 13 bytecodes: [ /* 10 E> */ B(StackCheck), /* 16 S> */ B(Nop), - /* 24 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(3), R(0), - /* 25 E> */ B(Call), R(0), R(arg0), U8(1), U8(1), + /* 24 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(4), R(0), + /* 25 E> */ B(Call), R(0), R(arg0), U8(1), U8(2), /* 33 S> */ B(Return), ] constant pool: [ - "func", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["func"], ] handlers: [ ] @@ -40,16 +38,16 @@ bytecode array length: 24 bytecodes: [ /* 10 E> */ B(StackCheck), /* 22 S> */ B(Nop), - /* 30 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(3), R(0), + /* 30 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(4), R(0), B(Ldar), R(0), B(Mov), R(arg0), R(1), B(Mov), R(arg1), R(2), B(Mov), R(arg2), R(3), - /* 31 E> */ B(Call), R(0), R(1), U8(3), U8(1), + /* 31 E> */ B(Call), R(0), R(1), U8(3), U8(2), /* 43 S> */ B(Return), ] constant pool: [ - "func", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["func"], ] handlers: [ ] @@ -65,17 +63,17 @@ bytecode array length: 26 bytecodes: [ /* 10 E> */ B(StackCheck), /* 19 S> */ B(Nop), - /* 27 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(3), R(0), + /* 27 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(4), R(0), B(Ldar), R(arg1), - /* 37 E> */ B(Add), R(arg1), U8(5), + /* 37 E> */ B(Add), R(arg1), U8(6), B(Star), R(2), B(Mov), R(arg0), R(1), B(Mov), R(arg1), R(3), - /* 28 E> */ B(Call), R(0), R(1), U8(3), U8(1), + /* 28 E> */ B(Call), R(0), R(1), U8(3), U8(2), /* 44 S> */ B(Return), ] constant pool: [ - "func", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["func"], ] handlers: [ ] @@ -216,272 +214,272 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 663 +bytecode array length: 667 bytecodes: [ /* 10 E> */ B(StackCheck), /* 17 S> */ B(Nop), - /* 18 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 18 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(2), /* 26 S> */ B(Nop), - /* 27 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(3), + /* 27 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4), /* 35 S> */ B(Nop), - /* 36 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(5), + /* 36 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(6), /* 44 S> */ B(Nop), - /* 45 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(7), + /* 45 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(8), /* 53 S> */ B(Nop), - /* 54 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(9), + /* 54 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(10), /* 62 S> */ B(Nop), - /* 63 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(11), + /* 63 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(12), /* 71 S> */ B(Nop), - /* 72 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(13), + /* 72 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(14), /* 80 S> */ B(Nop), - /* 81 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(15), + /* 81 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(16), /* 89 S> */ B(Nop), - /* 90 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(17), + /* 90 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(18), /* 98 S> */ B(Nop), - /* 99 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(19), + /* 99 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(20), /* 107 S> */ B(Nop), - /* 108 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(21), + /* 108 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(22), /* 116 S> */ B(Nop), - /* 117 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(23), + /* 117 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(24), /* 125 S> */ B(Nop), - /* 126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(25), + /* 126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(26), /* 134 S> */ B(Nop), - /* 135 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(27), + /* 135 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(28), /* 143 S> */ B(Nop), - /* 144 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(29), + /* 144 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(30), /* 152 S> */ B(Nop), - /* 153 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(31), + /* 153 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(32), /* 161 S> */ B(Nop), - /* 162 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(33), + /* 162 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(34), /* 170 S> */ B(Nop), - /* 171 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(35), + /* 171 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(36), /* 179 S> */ B(Nop), - /* 180 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(37), + /* 180 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(38), /* 188 S> */ B(Nop), - /* 189 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(39), + /* 189 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(40), /* 197 S> */ B(Nop), - /* 198 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(41), + /* 198 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(42), /* 206 S> */ B(Nop), - /* 207 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(43), + /* 207 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(44), /* 215 S> */ B(Nop), - /* 216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(45), + /* 216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(46), /* 224 S> */ B(Nop), - /* 225 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(47), + /* 225 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(48), /* 233 S> */ B(Nop), - /* 234 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(49), + /* 234 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(50), /* 242 S> */ B(Nop), - /* 243 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(51), + /* 243 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(52), /* 251 S> */ B(Nop), - /* 252 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(53), + /* 252 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(54), /* 260 S> */ B(Nop), - /* 261 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(55), + /* 261 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(56), /* 269 S> */ B(Nop), - /* 270 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(57), + /* 270 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(58), /* 278 S> */ B(Nop), - /* 279 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(59), + /* 279 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(60), /* 287 S> */ B(Nop), - /* 288 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(61), + /* 288 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(62), /* 296 S> */ B(Nop), - /* 297 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(63), + /* 297 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(64), /* 305 S> */ B(Nop), - /* 306 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(65), + /* 306 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(66), /* 314 S> */ B(Nop), - /* 315 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(67), + /* 315 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(68), /* 323 S> */ B(Nop), - /* 324 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(69), + /* 324 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(70), /* 332 S> */ B(Nop), - /* 333 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(71), + /* 333 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(72), /* 341 S> */ B(Nop), - /* 342 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(73), + /* 342 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(74), /* 350 S> */ B(Nop), - /* 351 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(75), + /* 351 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(76), /* 359 S> */ B(Nop), - /* 360 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(77), + /* 360 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(78), /* 368 S> */ B(Nop), - /* 369 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(79), + /* 369 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(80), /* 377 S> */ B(Nop), - /* 378 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(81), + /* 378 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(82), /* 386 S> */ B(Nop), - /* 387 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(83), + /* 387 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(84), /* 395 S> */ B(Nop), - /* 396 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(85), + /* 396 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(86), /* 404 S> */ B(Nop), - /* 405 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(87), + /* 405 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(88), /* 413 S> */ B(Nop), - /* 414 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(89), + /* 414 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(90), /* 422 S> */ B(Nop), - /* 423 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(91), + /* 423 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(92), /* 431 S> */ B(Nop), - /* 432 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(93), + /* 432 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(94), /* 440 S> */ B(Nop), - /* 441 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(95), + /* 441 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(96), /* 449 S> */ B(Nop), - /* 450 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(97), + /* 450 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(98), /* 458 S> */ B(Nop), - /* 459 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(99), + /* 459 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(100), /* 467 S> */ B(Nop), - /* 468 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(101), + /* 468 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(102), /* 476 S> */ B(Nop), - /* 477 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(103), + /* 477 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(104), /* 485 S> */ B(Nop), - /* 486 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(105), + /* 486 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(106), /* 494 S> */ B(Nop), - /* 495 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(107), + /* 495 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(108), /* 503 S> */ B(Nop), - /* 504 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(109), + /* 504 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(110), /* 512 S> */ B(Nop), - /* 513 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(111), + /* 513 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(112), /* 521 S> */ B(Nop), - /* 522 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(113), + /* 522 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(114), /* 530 S> */ B(Nop), - /* 531 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(115), + /* 531 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(116), /* 539 S> */ B(Nop), - /* 540 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(117), + /* 540 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(118), /* 548 S> */ B(Nop), - /* 549 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(119), + /* 549 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(120), /* 557 S> */ B(Nop), - /* 558 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(121), + /* 558 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(122), /* 566 S> */ B(Nop), - /* 567 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(123), + /* 567 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(124), /* 575 S> */ B(Nop), - /* 576 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(125), + /* 576 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(126), /* 584 S> */ B(Nop), - /* 585 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(127), + /* 585 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(128), /* 593 S> */ B(Nop), - /* 594 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(129), + /* 594 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(130), /* 602 S> */ B(Nop), - /* 603 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(131), + /* 603 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(132), /* 611 S> */ B(Nop), - /* 612 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(133), + /* 612 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(134), /* 620 S> */ B(Nop), - /* 621 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(135), + /* 621 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(136), /* 629 S> */ B(Nop), - /* 630 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(137), + /* 630 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(138), /* 638 S> */ B(Nop), - /* 639 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(139), + /* 639 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(140), /* 647 S> */ B(Nop), - /* 648 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(141), + /* 648 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(142), /* 656 S> */ B(Nop), - /* 657 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(143), + /* 657 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(144), /* 665 S> */ B(Nop), - /* 666 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(145), + /* 666 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(146), /* 674 S> */ B(Nop), - /* 675 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(147), + /* 675 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(148), /* 683 S> */ B(Nop), - /* 684 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(149), + /* 684 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(150), /* 692 S> */ B(Nop), - /* 693 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(151), + /* 693 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(152), /* 701 S> */ B(Nop), - /* 702 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(153), + /* 702 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(154), /* 710 S> */ B(Nop), - /* 711 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(155), + /* 711 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(156), /* 719 S> */ B(Nop), - /* 720 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(157), + /* 720 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(158), /* 728 S> */ B(Nop), - /* 729 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(159), + /* 729 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(160), /* 737 S> */ B(Nop), - /* 738 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(161), + /* 738 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(162), /* 746 S> */ B(Nop), - /* 747 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(163), + /* 747 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(164), /* 755 S> */ B(Nop), - /* 756 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(165), + /* 756 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(166), /* 764 S> */ B(Nop), - /* 765 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(167), + /* 765 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(168), /* 773 S> */ B(Nop), - /* 774 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(169), + /* 774 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(170), /* 782 S> */ B(Nop), - /* 783 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(171), + /* 783 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(172), /* 791 S> */ B(Nop), - /* 792 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(173), + /* 792 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(174), /* 800 S> */ B(Nop), - /* 801 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(175), + /* 801 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(176), /* 809 S> */ B(Nop), - /* 810 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(177), + /* 810 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(178), /* 818 S> */ B(Nop), - /* 819 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(179), + /* 819 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(180), /* 827 S> */ B(Nop), - /* 828 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(181), + /* 828 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(182), /* 836 S> */ B(Nop), - /* 837 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(183), + /* 837 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(184), /* 845 S> */ B(Nop), - /* 846 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(185), + /* 846 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(186), /* 854 S> */ B(Nop), - /* 855 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(187), + /* 855 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(188), /* 863 S> */ B(Nop), - /* 864 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(189), + /* 864 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(190), /* 872 S> */ B(Nop), - /* 873 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(191), + /* 873 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(192), /* 881 S> */ B(Nop), - /* 882 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(193), + /* 882 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(194), /* 890 S> */ B(Nop), - /* 891 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(195), + /* 891 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(196), /* 899 S> */ B(Nop), - /* 900 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(197), + /* 900 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(198), /* 908 S> */ B(Nop), - /* 909 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(199), + /* 909 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(200), /* 917 S> */ B(Nop), - /* 918 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(201), + /* 918 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(202), /* 926 S> */ B(Nop), - /* 927 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(203), + /* 927 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(204), /* 935 S> */ B(Nop), - /* 936 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(205), + /* 936 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(206), /* 944 S> */ B(Nop), - /* 945 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(207), + /* 945 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(208), /* 953 S> */ B(Nop), - /* 954 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(209), + /* 954 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(210), /* 962 S> */ B(Nop), - /* 963 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(211), + /* 963 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(212), /* 971 S> */ B(Nop), - /* 972 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(213), + /* 972 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(214), /* 980 S> */ B(Nop), - /* 981 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(215), + /* 981 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(216), /* 989 S> */ B(Nop), - /* 990 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(217), + /* 990 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(218), /* 998 S> */ B(Nop), - /* 999 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(219), + /* 999 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(220), /* 1007 S> */ B(Nop), - /* 1008 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(221), + /* 1008 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(222), /* 1016 S> */ B(Nop), - /* 1017 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(223), + /* 1017 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(224), /* 1025 S> */ B(Nop), - /* 1026 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(225), + /* 1026 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(226), /* 1034 S> */ B(Nop), - /* 1035 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(227), + /* 1035 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(228), /* 1043 S> */ B(Nop), - /* 1044 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(229), + /* 1044 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(230), /* 1052 S> */ B(Nop), - /* 1053 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(231), + /* 1053 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(232), /* 1061 S> */ B(Nop), - /* 1062 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(233), + /* 1062 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(234), /* 1070 S> */ B(Nop), - /* 1071 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(235), + /* 1071 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(236), /* 1079 S> */ B(Nop), - /* 1080 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(237), + /* 1080 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(238), /* 1088 S> */ B(Nop), - /* 1089 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(239), + /* 1089 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(240), /* 1097 S> */ B(Nop), - /* 1098 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(241), + /* 1098 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(242), /* 1106 S> */ B(Nop), - /* 1107 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(243), + /* 1107 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(244), /* 1115 S> */ B(Nop), - /* 1116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(245), + /* 1116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(246), /* 1124 S> */ B(Nop), - /* 1125 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(247), + /* 1125 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(248), /* 1133 S> */ B(Nop), - /* 1134 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(249), + /* 1134 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(250), /* 1142 S> */ B(Nop), - /* 1143 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(251), + /* 1143 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(252), /* 1151 S> */ B(Nop), - /* 1152 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(253), + /* 1152 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(254), /* 1160 S> */ B(Nop), - /* 1161 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(255), + /* 1161 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(256), /* 1169 S> */ B(Nop), - /* 1177 E> */ B(Wide), B(LdrNamedProperty), R16(arg0), U16(0), U16(259), R16(0), - /* 1178 E> */ B(Wide), B(Call), R16(0), R16(arg0), U16(1), U16(257), + /* 1177 E> */ B(Wide), B(LdrNamedProperty), R16(arg0), U16(0), U16(260), R16(0), + /* 1178 E> */ B(Wide), B(Call), R16(0), R16(arg0), U16(1), U16(258), /* 1186 S> */ B(Return), ] constant pool: [ - "func", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["func"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden index cee0357ab8..09f073e859 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -19,11 +17,11 @@ bytecode array length: 7 bytecodes: [ /* 10 E> */ B(StackCheck), /* 16 S> */ B(Nop), - /* 24 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 24 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(2), /* 31 S> */ B(Return), ] constant pool: [ - "name", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], ] handlers: [ ] @@ -39,11 +37,11 @@ bytecode array length: 7 bytecodes: [ /* 10 E> */ B(StackCheck), /* 16 S> */ B(Nop), - /* 24 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 24 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(2), /* 33 S> */ B(Return), ] constant pool: [ - "key", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["key"], ] handlers: [ ] @@ -59,7 +57,7 @@ bytecode array length: 7 bytecodes: [ /* 10 E> */ B(StackCheck), /* 16 S> */ B(LdaSmi), U8(100), - /* 24 E> */ B(LdaKeyedProperty), R(arg0), U8(1), + /* 24 E> */ B(LdaKeyedProperty), R(arg0), U8(2), /* 31 S> */ B(Return), ] constant pool: [ @@ -78,7 +76,7 @@ bytecode array length: 7 bytecodes: [ /* 10 E> */ B(StackCheck), /* 19 S> */ B(Ldar), R(arg1), - /* 28 E> */ B(LdaKeyedProperty), R(arg0), U8(1), + /* 28 E> */ B(LdaKeyedProperty), R(arg0), U8(2), /* 32 S> */ B(Return), ] constant pool: [ @@ -97,14 +95,14 @@ bytecode array length: 15 bytecodes: [ /* 10 E> */ B(StackCheck), /* 25 S> */ B(Nop), - /* 25 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(1), R(0), + /* 25 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(2), R(0), B(Ldar), R(0), /* 32 S> */ B(LdaSmi), U8(-124), - /* 40 E> */ B(LdaKeyedProperty), R(arg0), U8(3), + /* 40 E> */ B(LdaKeyedProperty), R(arg0), U8(4), /* 48 S> */ B(Return), ] constant pool: [ - "name", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], ] handlers: [ ] @@ -247,399 +245,399 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 1035 +bytecode array length: 1040 bytecodes: [ /* 10 E> */ B(StackCheck), /* 27 S> */ B(Nop), - /* 32 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(1), R(0), + /* 32 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(2), R(0), B(Ldar), R(0), /* 41 S> */ B(Nop), - /* 46 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(3), R(0), + /* 46 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(4), R(0), B(Ldar), R(0), /* 55 S> */ B(Nop), - /* 60 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(5), R(0), + /* 60 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(6), R(0), B(Ldar), R(0), /* 69 S> */ B(Nop), - /* 74 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(7), R(0), + /* 74 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(8), R(0), B(Ldar), R(0), /* 83 S> */ B(Nop), - /* 88 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(9), R(0), + /* 88 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(10), R(0), B(Ldar), R(0), /* 97 S> */ B(Nop), - /* 102 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(11), R(0), + /* 102 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(12), R(0), B(Ldar), R(0), /* 111 S> */ B(Nop), - /* 116 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(13), R(0), + /* 116 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(14), R(0), B(Ldar), R(0), /* 125 S> */ B(Nop), - /* 130 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(15), R(0), + /* 130 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(16), R(0), B(Ldar), R(0), /* 139 S> */ B(Nop), - /* 144 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(17), R(0), + /* 144 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(18), R(0), B(Ldar), R(0), /* 153 S> */ B(Nop), - /* 158 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(19), R(0), + /* 158 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(20), R(0), B(Ldar), R(0), /* 167 S> */ B(Nop), - /* 172 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(21), R(0), + /* 172 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(22), R(0), B(Ldar), R(0), /* 181 S> */ B(Nop), - /* 186 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(23), R(0), + /* 186 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(24), R(0), B(Ldar), R(0), /* 195 S> */ B(Nop), - /* 200 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(25), R(0), + /* 200 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(26), R(0), B(Ldar), R(0), /* 209 S> */ B(Nop), - /* 214 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(27), R(0), + /* 214 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(28), R(0), B(Ldar), R(0), /* 223 S> */ B(Nop), - /* 228 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(29), R(0), + /* 228 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(30), R(0), B(Ldar), R(0), /* 237 S> */ B(Nop), - /* 242 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(31), R(0), + /* 242 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(32), R(0), B(Ldar), R(0), /* 251 S> */ B(Nop), - /* 256 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(33), R(0), + /* 256 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(34), R(0), B(Ldar), R(0), /* 265 S> */ B(Nop), - /* 270 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(35), R(0), + /* 270 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(36), R(0), B(Ldar), R(0), /* 279 S> */ B(Nop), - /* 284 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(37), R(0), + /* 284 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(38), R(0), B(Ldar), R(0), /* 293 S> */ B(Nop), - /* 298 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(39), R(0), + /* 298 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(40), R(0), B(Ldar), R(0), /* 307 S> */ B(Nop), - /* 312 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(41), R(0), + /* 312 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(42), R(0), B(Ldar), R(0), /* 321 S> */ B(Nop), - /* 326 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(43), R(0), + /* 326 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(44), R(0), B(Ldar), R(0), /* 335 S> */ B(Nop), - /* 340 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(45), R(0), + /* 340 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(46), R(0), B(Ldar), R(0), /* 349 S> */ B(Nop), - /* 354 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(47), R(0), + /* 354 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(48), R(0), B(Ldar), R(0), /* 363 S> */ B(Nop), - /* 368 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(49), R(0), + /* 368 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(50), R(0), B(Ldar), R(0), /* 377 S> */ B(Nop), - /* 382 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(51), R(0), + /* 382 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(52), R(0), B(Ldar), R(0), /* 391 S> */ B(Nop), - /* 396 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(53), R(0), + /* 396 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(54), R(0), B(Ldar), R(0), /* 405 S> */ B(Nop), - /* 410 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(55), R(0), + /* 410 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(56), R(0), B(Ldar), R(0), /* 419 S> */ B(Nop), - /* 424 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(57), R(0), + /* 424 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(58), R(0), B(Ldar), R(0), /* 433 S> */ B(Nop), - /* 438 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(59), R(0), + /* 438 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(60), R(0), B(Ldar), R(0), /* 447 S> */ B(Nop), - /* 452 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(61), R(0), + /* 452 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(62), R(0), B(Ldar), R(0), /* 461 S> */ B(Nop), - /* 466 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(63), R(0), + /* 466 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(64), R(0), B(Ldar), R(0), /* 475 S> */ B(Nop), - /* 480 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(65), R(0), + /* 480 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(66), R(0), B(Ldar), R(0), /* 489 S> */ B(Nop), - /* 494 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(67), R(0), + /* 494 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(68), R(0), B(Ldar), R(0), /* 503 S> */ B(Nop), - /* 508 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(69), R(0), + /* 508 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(70), R(0), B(Ldar), R(0), /* 517 S> */ B(Nop), - /* 522 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(71), R(0), + /* 522 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(72), R(0), B(Ldar), R(0), /* 531 S> */ B(Nop), - /* 536 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(73), R(0), + /* 536 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(74), R(0), B(Ldar), R(0), /* 545 S> */ B(Nop), - /* 550 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(75), R(0), + /* 550 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(76), R(0), B(Ldar), R(0), /* 559 S> */ B(Nop), - /* 564 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(77), R(0), + /* 564 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(78), R(0), B(Ldar), R(0), /* 573 S> */ B(Nop), - /* 578 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(79), R(0), + /* 578 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(80), R(0), B(Ldar), R(0), /* 587 S> */ B(Nop), - /* 592 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(81), R(0), + /* 592 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(82), R(0), B(Ldar), R(0), /* 601 S> */ B(Nop), - /* 606 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(83), R(0), + /* 606 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(84), R(0), B(Ldar), R(0), /* 615 S> */ B(Nop), - /* 620 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(85), R(0), + /* 620 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(86), R(0), B(Ldar), R(0), /* 629 S> */ B(Nop), - /* 634 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(87), R(0), + /* 634 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(88), R(0), B(Ldar), R(0), /* 643 S> */ B(Nop), - /* 648 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(89), R(0), + /* 648 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(90), R(0), B(Ldar), R(0), /* 657 S> */ B(Nop), - /* 662 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(91), R(0), + /* 662 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(92), R(0), B(Ldar), R(0), /* 671 S> */ B(Nop), - /* 676 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(93), R(0), + /* 676 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(94), R(0), B(Ldar), R(0), /* 685 S> */ B(Nop), - /* 690 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(95), R(0), + /* 690 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(96), R(0), B(Ldar), R(0), /* 699 S> */ B(Nop), - /* 704 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(97), R(0), + /* 704 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(98), R(0), B(Ldar), R(0), /* 713 S> */ B(Nop), - /* 718 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(99), R(0), + /* 718 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(100), R(0), B(Ldar), R(0), /* 727 S> */ B(Nop), - /* 732 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(101), R(0), + /* 732 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(102), R(0), B(Ldar), R(0), /* 741 S> */ B(Nop), - /* 746 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(103), R(0), + /* 746 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(104), R(0), B(Ldar), R(0), /* 755 S> */ B(Nop), - /* 760 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(105), R(0), + /* 760 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(106), R(0), B(Ldar), R(0), /* 769 S> */ B(Nop), - /* 774 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(107), R(0), + /* 774 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(108), R(0), B(Ldar), R(0), /* 783 S> */ B(Nop), - /* 788 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(109), R(0), + /* 788 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(110), R(0), B(Ldar), R(0), /* 797 S> */ B(Nop), - /* 802 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(111), R(0), + /* 802 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(112), R(0), B(Ldar), R(0), /* 811 S> */ B(Nop), - /* 816 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(113), R(0), + /* 816 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(114), R(0), B(Ldar), R(0), /* 825 S> */ B(Nop), - /* 830 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(115), R(0), + /* 830 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(116), R(0), B(Ldar), R(0), /* 839 S> */ B(Nop), - /* 844 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(117), R(0), + /* 844 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(118), R(0), B(Ldar), R(0), /* 853 S> */ B(Nop), - /* 858 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(119), R(0), + /* 858 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(120), R(0), B(Ldar), R(0), /* 867 S> */ B(Nop), - /* 872 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(121), R(0), + /* 872 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(122), R(0), B(Ldar), R(0), /* 881 S> */ B(Nop), - /* 886 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(123), R(0), + /* 886 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(124), R(0), B(Ldar), R(0), /* 895 S> */ B(Nop), - /* 900 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(125), R(0), + /* 900 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(126), R(0), B(Ldar), R(0), /* 909 S> */ B(Nop), - /* 914 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(127), R(0), + /* 914 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(128), R(0), B(Ldar), R(0), /* 923 S> */ B(Nop), - /* 928 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(129), R(0), + /* 928 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(130), R(0), B(Ldar), R(0), /* 937 S> */ B(Nop), - /* 942 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(131), R(0), + /* 942 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(132), R(0), B(Ldar), R(0), /* 951 S> */ B(Nop), - /* 956 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(133), R(0), + /* 956 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(134), R(0), B(Ldar), R(0), /* 965 S> */ B(Nop), - /* 970 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(135), R(0), + /* 970 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(136), R(0), B(Ldar), R(0), /* 979 S> */ B(Nop), - /* 984 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(137), R(0), + /* 984 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(138), R(0), B(Ldar), R(0), /* 993 S> */ B(Nop), - /* 998 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(139), R(0), + /* 998 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(140), R(0), B(Ldar), R(0), /* 1007 S> */ B(Nop), - /* 1012 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(141), R(0), + /* 1012 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(142), R(0), B(Ldar), R(0), /* 1021 S> */ B(Nop), - /* 1026 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(143), R(0), + /* 1026 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(144), R(0), B(Ldar), R(0), /* 1035 S> */ B(Nop), - /* 1040 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(145), R(0), + /* 1040 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(146), R(0), B(Ldar), R(0), /* 1049 S> */ B(Nop), - /* 1054 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(147), R(0), + /* 1054 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(148), R(0), B(Ldar), R(0), /* 1063 S> */ B(Nop), - /* 1068 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(149), R(0), + /* 1068 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(150), R(0), B(Ldar), R(0), /* 1077 S> */ B(Nop), - /* 1082 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(151), R(0), + /* 1082 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(152), R(0), B(Ldar), R(0), /* 1091 S> */ B(Nop), - /* 1096 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(153), R(0), + /* 1096 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(154), R(0), B(Ldar), R(0), /* 1105 S> */ B(Nop), - /* 1110 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(155), R(0), + /* 1110 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(156), R(0), B(Ldar), R(0), /* 1119 S> */ B(Nop), - /* 1124 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(157), R(0), + /* 1124 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(158), R(0), B(Ldar), R(0), /* 1133 S> */ B(Nop), - /* 1138 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(159), R(0), + /* 1138 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(160), R(0), B(Ldar), R(0), /* 1147 S> */ B(Nop), - /* 1152 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(161), R(0), + /* 1152 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(162), R(0), B(Ldar), R(0), /* 1161 S> */ B(Nop), - /* 1166 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(163), R(0), + /* 1166 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(164), R(0), B(Ldar), R(0), /* 1175 S> */ B(Nop), - /* 1180 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(165), R(0), + /* 1180 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(166), R(0), B(Ldar), R(0), /* 1189 S> */ B(Nop), - /* 1194 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(167), R(0), + /* 1194 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(168), R(0), B(Ldar), R(0), /* 1203 S> */ B(Nop), - /* 1208 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(169), R(0), + /* 1208 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(170), R(0), B(Ldar), R(0), /* 1217 S> */ B(Nop), - /* 1222 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(171), R(0), + /* 1222 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(172), R(0), B(Ldar), R(0), /* 1231 S> */ B(Nop), - /* 1236 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(173), R(0), + /* 1236 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(174), R(0), B(Ldar), R(0), /* 1245 S> */ B(Nop), - /* 1250 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(175), R(0), + /* 1250 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(176), R(0), B(Ldar), R(0), /* 1259 S> */ B(Nop), - /* 1264 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(177), R(0), + /* 1264 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(178), R(0), B(Ldar), R(0), /* 1273 S> */ B(Nop), - /* 1278 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(179), R(0), + /* 1278 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(180), R(0), B(Ldar), R(0), /* 1287 S> */ B(Nop), - /* 1292 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(181), R(0), + /* 1292 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(182), R(0), B(Ldar), R(0), /* 1301 S> */ B(Nop), - /* 1306 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(183), R(0), + /* 1306 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(184), R(0), B(Ldar), R(0), /* 1315 S> */ B(Nop), - /* 1320 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(185), R(0), + /* 1320 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(186), R(0), B(Ldar), R(0), /* 1329 S> */ B(Nop), - /* 1334 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(187), R(0), + /* 1334 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(188), R(0), B(Ldar), R(0), /* 1343 S> */ B(Nop), - /* 1348 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(189), R(0), + /* 1348 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(190), R(0), B(Ldar), R(0), /* 1357 S> */ B(Nop), - /* 1362 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(191), R(0), + /* 1362 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(192), R(0), B(Ldar), R(0), /* 1371 S> */ B(Nop), - /* 1376 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(193), R(0), + /* 1376 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(194), R(0), B(Ldar), R(0), /* 1385 S> */ B(Nop), - /* 1390 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(195), R(0), + /* 1390 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(196), R(0), B(Ldar), R(0), /* 1399 S> */ B(Nop), - /* 1404 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(197), R(0), + /* 1404 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(198), R(0), B(Ldar), R(0), /* 1413 S> */ B(Nop), - /* 1418 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(199), R(0), + /* 1418 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(200), R(0), B(Ldar), R(0), /* 1427 S> */ B(Nop), - /* 1432 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(201), R(0), + /* 1432 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(202), R(0), B(Ldar), R(0), /* 1441 S> */ B(Nop), - /* 1446 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(203), R(0), + /* 1446 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(204), R(0), B(Ldar), R(0), /* 1455 S> */ B(Nop), - /* 1460 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(205), R(0), + /* 1460 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(206), R(0), B(Ldar), R(0), /* 1469 S> */ B(Nop), - /* 1474 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(207), R(0), + /* 1474 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(208), R(0), B(Ldar), R(0), /* 1483 S> */ B(Nop), - /* 1488 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(209), R(0), + /* 1488 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(210), R(0), B(Ldar), R(0), /* 1497 S> */ B(Nop), - /* 1502 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(211), R(0), + /* 1502 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(212), R(0), B(Ldar), R(0), /* 1511 S> */ B(Nop), - /* 1516 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(213), R(0), + /* 1516 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(214), R(0), B(Ldar), R(0), /* 1525 S> */ B(Nop), - /* 1530 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(215), R(0), + /* 1530 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(216), R(0), B(Ldar), R(0), /* 1539 S> */ B(Nop), - /* 1544 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(217), R(0), + /* 1544 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(218), R(0), B(Ldar), R(0), /* 1553 S> */ B(Nop), - /* 1558 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(219), R(0), + /* 1558 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(220), R(0), B(Ldar), R(0), /* 1567 S> */ B(Nop), - /* 1572 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(221), R(0), + /* 1572 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(222), R(0), B(Ldar), R(0), /* 1581 S> */ B(Nop), - /* 1586 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(223), R(0), + /* 1586 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(224), R(0), B(Ldar), R(0), /* 1595 S> */ B(Nop), - /* 1600 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(225), R(0), + /* 1600 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(226), R(0), B(Ldar), R(0), /* 1609 S> */ B(Nop), - /* 1614 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(227), R(0), + /* 1614 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(228), R(0), B(Ldar), R(0), /* 1623 S> */ B(Nop), - /* 1628 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(229), R(0), + /* 1628 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(230), R(0), B(Ldar), R(0), /* 1637 S> */ B(Nop), - /* 1642 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(231), R(0), + /* 1642 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(232), R(0), B(Ldar), R(0), /* 1651 S> */ B(Nop), - /* 1656 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(233), R(0), + /* 1656 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(234), R(0), B(Ldar), R(0), /* 1665 S> */ B(Nop), - /* 1670 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(235), R(0), + /* 1670 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(236), R(0), B(Ldar), R(0), /* 1679 S> */ B(Nop), - /* 1684 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(237), R(0), + /* 1684 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(238), R(0), B(Ldar), R(0), /* 1693 S> */ B(Nop), - /* 1698 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(239), R(0), + /* 1698 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(240), R(0), B(Ldar), R(0), /* 1707 S> */ B(Nop), - /* 1712 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(241), R(0), + /* 1712 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(242), R(0), B(Ldar), R(0), /* 1721 S> */ B(Nop), - /* 1726 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(243), R(0), + /* 1726 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(244), R(0), B(Ldar), R(0), /* 1735 S> */ B(Nop), - /* 1740 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(245), R(0), + /* 1740 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(246), R(0), B(Ldar), R(0), /* 1749 S> */ B(Nop), - /* 1754 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(247), R(0), + /* 1754 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(248), R(0), B(Ldar), R(0), /* 1763 S> */ B(Nop), - /* 1768 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(249), R(0), + /* 1768 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(250), R(0), B(Ldar), R(0), /* 1777 S> */ B(Nop), - /* 1782 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(251), R(0), + /* 1782 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(252), R(0), B(Ldar), R(0), /* 1791 S> */ B(Nop), - /* 1796 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(253), R(0), + /* 1796 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(254), R(0), B(Ldar), R(0), /* 1805 S> */ B(Nop), - /* 1810 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(255), R(0), + /* 1810 E> */ B(Wide), B(LdrNamedProperty), R16(arg0), U16(0), U16(256), R16(0), B(Ldar), R(0), /* 1819 S> */ B(Nop), - /* 1827 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(257), + /* 1827 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(258), /* 1834 S> */ B(Return), ] constant pool: [ - "name", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], ] handlers: [ ] @@ -782,395 +780,395 @@ snippet: " " frame size: 1 parameter count: 3 -bytecode array length: 1034 +bytecode array length: 1038 bytecodes: [ /* 10 E> */ B(StackCheck), /* 30 S> */ B(Ldar), R(arg1), - /* 36 E> */ B(LdrKeyedProperty), R(arg0), U8(1), R(0), + /* 36 E> */ B(LdrKeyedProperty), R(arg0), U8(2), R(0), B(Ldar), R(0), /* 42 S> */ B(Ldar), R(arg1), - /* 48 E> */ B(LdrKeyedProperty), R(arg0), U8(3), R(0), + /* 48 E> */ B(LdrKeyedProperty), R(arg0), U8(4), R(0), B(Ldar), R(0), /* 54 S> */ B(Ldar), R(arg1), - /* 60 E> */ B(LdrKeyedProperty), R(arg0), U8(5), R(0), + /* 60 E> */ B(LdrKeyedProperty), R(arg0), U8(6), R(0), B(Ldar), R(0), /* 66 S> */ B(Ldar), R(arg1), - /* 72 E> */ B(LdrKeyedProperty), R(arg0), U8(7), R(0), + /* 72 E> */ B(LdrKeyedProperty), R(arg0), U8(8), R(0), B(Ldar), R(0), /* 78 S> */ B(Ldar), R(arg1), - /* 84 E> */ B(LdrKeyedProperty), R(arg0), U8(9), R(0), + /* 84 E> */ B(LdrKeyedProperty), R(arg0), U8(10), R(0), B(Ldar), R(0), /* 90 S> */ B(Ldar), R(arg1), - /* 96 E> */ B(LdrKeyedProperty), R(arg0), U8(11), R(0), + /* 96 E> */ B(LdrKeyedProperty), R(arg0), U8(12), R(0), B(Ldar), R(0), /* 102 S> */ B(Ldar), R(arg1), - /* 108 E> */ B(LdrKeyedProperty), R(arg0), U8(13), R(0), + /* 108 E> */ B(LdrKeyedProperty), R(arg0), U8(14), R(0), B(Ldar), R(0), /* 114 S> */ B(Ldar), R(arg1), - /* 120 E> */ B(LdrKeyedProperty), R(arg0), U8(15), R(0), + /* 120 E> */ B(LdrKeyedProperty), R(arg0), U8(16), R(0), B(Ldar), R(0), /* 126 S> */ B(Ldar), R(arg1), - /* 132 E> */ B(LdrKeyedProperty), R(arg0), U8(17), R(0), + /* 132 E> */ B(LdrKeyedProperty), R(arg0), U8(18), R(0), B(Ldar), R(0), /* 138 S> */ B(Ldar), R(arg1), - /* 144 E> */ B(LdrKeyedProperty), R(arg0), U8(19), R(0), + /* 144 E> */ B(LdrKeyedProperty), R(arg0), U8(20), R(0), B(Ldar), R(0), /* 150 S> */ B(Ldar), R(arg1), - /* 156 E> */ B(LdrKeyedProperty), R(arg0), U8(21), R(0), + /* 156 E> */ B(LdrKeyedProperty), R(arg0), U8(22), R(0), B(Ldar), R(0), /* 162 S> */ B(Ldar), R(arg1), - /* 168 E> */ B(LdrKeyedProperty), R(arg0), U8(23), R(0), + /* 168 E> */ B(LdrKeyedProperty), R(arg0), U8(24), R(0), B(Ldar), R(0), /* 174 S> */ B(Ldar), R(arg1), - /* 180 E> */ B(LdrKeyedProperty), R(arg0), U8(25), R(0), + /* 180 E> */ B(LdrKeyedProperty), R(arg0), U8(26), R(0), B(Ldar), R(0), /* 186 S> */ B(Ldar), R(arg1), - /* 192 E> */ B(LdrKeyedProperty), R(arg0), U8(27), R(0), + /* 192 E> */ B(LdrKeyedProperty), R(arg0), U8(28), R(0), B(Ldar), R(0), /* 198 S> */ B(Ldar), R(arg1), - /* 204 E> */ B(LdrKeyedProperty), R(arg0), U8(29), R(0), + /* 204 E> */ B(LdrKeyedProperty), R(arg0), U8(30), R(0), B(Ldar), R(0), /* 210 S> */ B(Ldar), R(arg1), - /* 216 E> */ B(LdrKeyedProperty), R(arg0), U8(31), R(0), + /* 216 E> */ B(LdrKeyedProperty), R(arg0), U8(32), R(0), B(Ldar), R(0), /* 222 S> */ B(Ldar), R(arg1), - /* 228 E> */ B(LdrKeyedProperty), R(arg0), U8(33), R(0), + /* 228 E> */ B(LdrKeyedProperty), R(arg0), U8(34), R(0), B(Ldar), R(0), /* 234 S> */ B(Ldar), R(arg1), - /* 240 E> */ B(LdrKeyedProperty), R(arg0), U8(35), R(0), + /* 240 E> */ B(LdrKeyedProperty), R(arg0), U8(36), R(0), B(Ldar), R(0), /* 246 S> */ B(Ldar), R(arg1), - /* 252 E> */ B(LdrKeyedProperty), R(arg0), U8(37), R(0), + /* 252 E> */ B(LdrKeyedProperty), R(arg0), U8(38), R(0), B(Ldar), R(0), /* 258 S> */ B(Ldar), R(arg1), - /* 264 E> */ B(LdrKeyedProperty), R(arg0), U8(39), R(0), + /* 264 E> */ B(LdrKeyedProperty), R(arg0), U8(40), R(0), B(Ldar), R(0), /* 270 S> */ B(Ldar), R(arg1), - /* 276 E> */ B(LdrKeyedProperty), R(arg0), U8(41), R(0), + /* 276 E> */ B(LdrKeyedProperty), R(arg0), U8(42), R(0), B(Ldar), R(0), /* 282 S> */ B(Ldar), R(arg1), - /* 288 E> */ B(LdrKeyedProperty), R(arg0), U8(43), R(0), + /* 288 E> */ B(LdrKeyedProperty), R(arg0), U8(44), R(0), B(Ldar), R(0), /* 294 S> */ B(Ldar), R(arg1), - /* 300 E> */ B(LdrKeyedProperty), R(arg0), U8(45), R(0), + /* 300 E> */ B(LdrKeyedProperty), R(arg0), U8(46), R(0), B(Ldar), R(0), /* 306 S> */ B(Ldar), R(arg1), - /* 312 E> */ B(LdrKeyedProperty), R(arg0), U8(47), R(0), + /* 312 E> */ B(LdrKeyedProperty), R(arg0), U8(48), R(0), B(Ldar), R(0), /* 318 S> */ B(Ldar), R(arg1), - /* 324 E> */ B(LdrKeyedProperty), R(arg0), U8(49), R(0), + /* 324 E> */ B(LdrKeyedProperty), R(arg0), U8(50), R(0), B(Ldar), R(0), /* 330 S> */ B(Ldar), R(arg1), - /* 336 E> */ B(LdrKeyedProperty), R(arg0), U8(51), R(0), + /* 336 E> */ B(LdrKeyedProperty), R(arg0), U8(52), R(0), B(Ldar), R(0), /* 342 S> */ B(Ldar), R(arg1), - /* 348 E> */ B(LdrKeyedProperty), R(arg0), U8(53), R(0), + /* 348 E> */ B(LdrKeyedProperty), R(arg0), U8(54), R(0), B(Ldar), R(0), /* 354 S> */ B(Ldar), R(arg1), - /* 360 E> */ B(LdrKeyedProperty), R(arg0), U8(55), R(0), + /* 360 E> */ B(LdrKeyedProperty), R(arg0), U8(56), R(0), B(Ldar), R(0), /* 366 S> */ B(Ldar), R(arg1), - /* 372 E> */ B(LdrKeyedProperty), R(arg0), U8(57), R(0), + /* 372 E> */ B(LdrKeyedProperty), R(arg0), U8(58), R(0), B(Ldar), R(0), /* 378 S> */ B(Ldar), R(arg1), - /* 384 E> */ B(LdrKeyedProperty), R(arg0), U8(59), R(0), + /* 384 E> */ B(LdrKeyedProperty), R(arg0), U8(60), R(0), B(Ldar), R(0), /* 390 S> */ B(Ldar), R(arg1), - /* 396 E> */ B(LdrKeyedProperty), R(arg0), U8(61), R(0), + /* 396 E> */ B(LdrKeyedProperty), R(arg0), U8(62), R(0), B(Ldar), R(0), /* 402 S> */ B(Ldar), R(arg1), - /* 408 E> */ B(LdrKeyedProperty), R(arg0), U8(63), R(0), + /* 408 E> */ B(LdrKeyedProperty), R(arg0), U8(64), R(0), B(Ldar), R(0), /* 414 S> */ B(Ldar), R(arg1), - /* 420 E> */ B(LdrKeyedProperty), R(arg0), U8(65), R(0), + /* 420 E> */ B(LdrKeyedProperty), R(arg0), U8(66), R(0), B(Ldar), R(0), /* 426 S> */ B(Ldar), R(arg1), - /* 432 E> */ B(LdrKeyedProperty), R(arg0), U8(67), R(0), + /* 432 E> */ B(LdrKeyedProperty), R(arg0), U8(68), R(0), B(Ldar), R(0), /* 438 S> */ B(Ldar), R(arg1), - /* 444 E> */ B(LdrKeyedProperty), R(arg0), U8(69), R(0), + /* 444 E> */ B(LdrKeyedProperty), R(arg0), U8(70), R(0), B(Ldar), R(0), /* 450 S> */ B(Ldar), R(arg1), - /* 456 E> */ B(LdrKeyedProperty), R(arg0), U8(71), R(0), + /* 456 E> */ B(LdrKeyedProperty), R(arg0), U8(72), R(0), B(Ldar), R(0), /* 462 S> */ B(Ldar), R(arg1), - /* 468 E> */ B(LdrKeyedProperty), R(arg0), U8(73), R(0), + /* 468 E> */ B(LdrKeyedProperty), R(arg0), U8(74), R(0), B(Ldar), R(0), /* 474 S> */ B(Ldar), R(arg1), - /* 480 E> */ B(LdrKeyedProperty), R(arg0), U8(75), R(0), + /* 480 E> */ B(LdrKeyedProperty), R(arg0), U8(76), R(0), B(Ldar), R(0), /* 486 S> */ B(Ldar), R(arg1), - /* 492 E> */ B(LdrKeyedProperty), R(arg0), U8(77), R(0), + /* 492 E> */ B(LdrKeyedProperty), R(arg0), U8(78), R(0), B(Ldar), R(0), /* 498 S> */ B(Ldar), R(arg1), - /* 504 E> */ B(LdrKeyedProperty), R(arg0), U8(79), R(0), + /* 504 E> */ B(LdrKeyedProperty), R(arg0), U8(80), R(0), B(Ldar), R(0), /* 510 S> */ B(Ldar), R(arg1), - /* 516 E> */ B(LdrKeyedProperty), R(arg0), U8(81), R(0), + /* 516 E> */ B(LdrKeyedProperty), R(arg0), U8(82), R(0), B(Ldar), R(0), /* 522 S> */ B(Ldar), R(arg1), - /* 528 E> */ B(LdrKeyedProperty), R(arg0), U8(83), R(0), + /* 528 E> */ B(LdrKeyedProperty), R(arg0), U8(84), R(0), B(Ldar), R(0), /* 534 S> */ B(Ldar), R(arg1), - /* 540 E> */ B(LdrKeyedProperty), R(arg0), U8(85), R(0), + /* 540 E> */ B(LdrKeyedProperty), R(arg0), U8(86), R(0), B(Ldar), R(0), /* 546 S> */ B(Ldar), R(arg1), - /* 552 E> */ B(LdrKeyedProperty), R(arg0), U8(87), R(0), + /* 552 E> */ B(LdrKeyedProperty), R(arg0), U8(88), R(0), B(Ldar), R(0), /* 558 S> */ B(Ldar), R(arg1), - /* 564 E> */ B(LdrKeyedProperty), R(arg0), U8(89), R(0), + /* 564 E> */ B(LdrKeyedProperty), R(arg0), U8(90), R(0), B(Ldar), R(0), /* 570 S> */ B(Ldar), R(arg1), - /* 576 E> */ B(LdrKeyedProperty), R(arg0), U8(91), R(0), + /* 576 E> */ B(LdrKeyedProperty), R(arg0), U8(92), R(0), B(Ldar), R(0), /* 582 S> */ B(Ldar), R(arg1), - /* 588 E> */ B(LdrKeyedProperty), R(arg0), U8(93), R(0), + /* 588 E> */ B(LdrKeyedProperty), R(arg0), U8(94), R(0), B(Ldar), R(0), /* 594 S> */ B(Ldar), R(arg1), - /* 600 E> */ B(LdrKeyedProperty), R(arg0), U8(95), R(0), + /* 600 E> */ B(LdrKeyedProperty), R(arg0), U8(96), R(0), B(Ldar), R(0), /* 606 S> */ B(Ldar), R(arg1), - /* 612 E> */ B(LdrKeyedProperty), R(arg0), U8(97), R(0), + /* 612 E> */ B(LdrKeyedProperty), R(arg0), U8(98), R(0), B(Ldar), R(0), /* 618 S> */ B(Ldar), R(arg1), - /* 624 E> */ B(LdrKeyedProperty), R(arg0), U8(99), R(0), + /* 624 E> */ B(LdrKeyedProperty), R(arg0), U8(100), R(0), B(Ldar), R(0), /* 630 S> */ B(Ldar), R(arg1), - /* 636 E> */ B(LdrKeyedProperty), R(arg0), U8(101), R(0), + /* 636 E> */ B(LdrKeyedProperty), R(arg0), U8(102), R(0), B(Ldar), R(0), /* 642 S> */ B(Ldar), R(arg1), - /* 648 E> */ B(LdrKeyedProperty), R(arg0), U8(103), R(0), + /* 648 E> */ B(LdrKeyedProperty), R(arg0), U8(104), R(0), B(Ldar), R(0), /* 654 S> */ B(Ldar), R(arg1), - /* 660 E> */ B(LdrKeyedProperty), R(arg0), U8(105), R(0), + /* 660 E> */ B(LdrKeyedProperty), R(arg0), U8(106), R(0), B(Ldar), R(0), /* 666 S> */ B(Ldar), R(arg1), - /* 672 E> */ B(LdrKeyedProperty), R(arg0), U8(107), R(0), + /* 672 E> */ B(LdrKeyedProperty), R(arg0), U8(108), R(0), B(Ldar), R(0), /* 678 S> */ B(Ldar), R(arg1), - /* 684 E> */ B(LdrKeyedProperty), R(arg0), U8(109), R(0), + /* 684 E> */ B(LdrKeyedProperty), R(arg0), U8(110), R(0), B(Ldar), R(0), /* 690 S> */ B(Ldar), R(arg1), - /* 696 E> */ B(LdrKeyedProperty), R(arg0), U8(111), R(0), + /* 696 E> */ B(LdrKeyedProperty), R(arg0), U8(112), R(0), B(Ldar), R(0), /* 702 S> */ B(Ldar), R(arg1), - /* 708 E> */ B(LdrKeyedProperty), R(arg0), U8(113), R(0), + /* 708 E> */ B(LdrKeyedProperty), R(arg0), U8(114), R(0), B(Ldar), R(0), /* 714 S> */ B(Ldar), R(arg1), - /* 720 E> */ B(LdrKeyedProperty), R(arg0), U8(115), R(0), + /* 720 E> */ B(LdrKeyedProperty), R(arg0), U8(116), R(0), B(Ldar), R(0), /* 726 S> */ B(Ldar), R(arg1), - /* 732 E> */ B(LdrKeyedProperty), R(arg0), U8(117), R(0), + /* 732 E> */ B(LdrKeyedProperty), R(arg0), U8(118), R(0), B(Ldar), R(0), /* 738 S> */ B(Ldar), R(arg1), - /* 744 E> */ B(LdrKeyedProperty), R(arg0), U8(119), R(0), + /* 744 E> */ B(LdrKeyedProperty), R(arg0), U8(120), R(0), B(Ldar), R(0), /* 750 S> */ B(Ldar), R(arg1), - /* 756 E> */ B(LdrKeyedProperty), R(arg0), U8(121), R(0), + /* 756 E> */ B(LdrKeyedProperty), R(arg0), U8(122), R(0), B(Ldar), R(0), /* 762 S> */ B(Ldar), R(arg1), - /* 768 E> */ B(LdrKeyedProperty), R(arg0), U8(123), R(0), + /* 768 E> */ B(LdrKeyedProperty), R(arg0), U8(124), R(0), B(Ldar), R(0), /* 774 S> */ B(Ldar), R(arg1), - /* 780 E> */ B(LdrKeyedProperty), R(arg0), U8(125), R(0), + /* 780 E> */ B(LdrKeyedProperty), R(arg0), U8(126), R(0), B(Ldar), R(0), /* 786 S> */ B(Ldar), R(arg1), - /* 792 E> */ B(LdrKeyedProperty), R(arg0), U8(127), R(0), + /* 792 E> */ B(LdrKeyedProperty), R(arg0), U8(128), R(0), B(Ldar), R(0), /* 798 S> */ B(Ldar), R(arg1), - /* 804 E> */ B(LdrKeyedProperty), R(arg0), U8(129), R(0), + /* 804 E> */ B(LdrKeyedProperty), R(arg0), U8(130), R(0), B(Ldar), R(0), /* 810 S> */ B(Ldar), R(arg1), - /* 816 E> */ B(LdrKeyedProperty), R(arg0), U8(131), R(0), + /* 816 E> */ B(LdrKeyedProperty), R(arg0), U8(132), R(0), B(Ldar), R(0), /* 822 S> */ B(Ldar), R(arg1), - /* 828 E> */ B(LdrKeyedProperty), R(arg0), U8(133), R(0), + /* 828 E> */ B(LdrKeyedProperty), R(arg0), U8(134), R(0), B(Ldar), R(0), /* 834 S> */ B(Ldar), R(arg1), - /* 840 E> */ B(LdrKeyedProperty), R(arg0), U8(135), R(0), + /* 840 E> */ B(LdrKeyedProperty), R(arg0), U8(136), R(0), B(Ldar), R(0), /* 846 S> */ B(Ldar), R(arg1), - /* 852 E> */ B(LdrKeyedProperty), R(arg0), U8(137), R(0), + /* 852 E> */ B(LdrKeyedProperty), R(arg0), U8(138), R(0), B(Ldar), R(0), /* 858 S> */ B(Ldar), R(arg1), - /* 864 E> */ B(LdrKeyedProperty), R(arg0), U8(139), R(0), + /* 864 E> */ B(LdrKeyedProperty), R(arg0), U8(140), R(0), B(Ldar), R(0), /* 870 S> */ B(Ldar), R(arg1), - /* 876 E> */ B(LdrKeyedProperty), R(arg0), U8(141), R(0), + /* 876 E> */ B(LdrKeyedProperty), R(arg0), U8(142), R(0), B(Ldar), R(0), /* 882 S> */ B(Ldar), R(arg1), - /* 888 E> */ B(LdrKeyedProperty), R(arg0), U8(143), R(0), + /* 888 E> */ B(LdrKeyedProperty), R(arg0), U8(144), R(0), B(Ldar), R(0), /* 894 S> */ B(Ldar), R(arg1), - /* 900 E> */ B(LdrKeyedProperty), R(arg0), U8(145), R(0), + /* 900 E> */ B(LdrKeyedProperty), R(arg0), U8(146), R(0), B(Ldar), R(0), /* 906 S> */ B(Ldar), R(arg1), - /* 912 E> */ B(LdrKeyedProperty), R(arg0), U8(147), R(0), + /* 912 E> */ B(LdrKeyedProperty), R(arg0), U8(148), R(0), B(Ldar), R(0), /* 918 S> */ B(Ldar), R(arg1), - /* 924 E> */ B(LdrKeyedProperty), R(arg0), U8(149), R(0), + /* 924 E> */ B(LdrKeyedProperty), R(arg0), U8(150), R(0), B(Ldar), R(0), /* 930 S> */ B(Ldar), R(arg1), - /* 936 E> */ B(LdrKeyedProperty), R(arg0), U8(151), R(0), + /* 936 E> */ B(LdrKeyedProperty), R(arg0), U8(152), R(0), B(Ldar), R(0), /* 942 S> */ B(Ldar), R(arg1), - /* 948 E> */ B(LdrKeyedProperty), R(arg0), U8(153), R(0), + /* 948 E> */ B(LdrKeyedProperty), R(arg0), U8(154), R(0), B(Ldar), R(0), /* 954 S> */ B(Ldar), R(arg1), - /* 960 E> */ B(LdrKeyedProperty), R(arg0), U8(155), R(0), + /* 960 E> */ B(LdrKeyedProperty), R(arg0), U8(156), R(0), B(Ldar), R(0), /* 966 S> */ B(Ldar), R(arg1), - /* 972 E> */ B(LdrKeyedProperty), R(arg0), U8(157), R(0), + /* 972 E> */ B(LdrKeyedProperty), R(arg0), U8(158), R(0), B(Ldar), R(0), /* 978 S> */ B(Ldar), R(arg1), - /* 984 E> */ B(LdrKeyedProperty), R(arg0), U8(159), R(0), + /* 984 E> */ B(LdrKeyedProperty), R(arg0), U8(160), R(0), B(Ldar), R(0), /* 990 S> */ B(Ldar), R(arg1), - /* 996 E> */ B(LdrKeyedProperty), R(arg0), U8(161), R(0), + /* 996 E> */ B(LdrKeyedProperty), R(arg0), U8(162), R(0), B(Ldar), R(0), /* 1002 S> */ B(Ldar), R(arg1), - /* 1008 E> */ B(LdrKeyedProperty), R(arg0), U8(163), R(0), + /* 1008 E> */ B(LdrKeyedProperty), R(arg0), U8(164), R(0), B(Ldar), R(0), /* 1014 S> */ B(Ldar), R(arg1), - /* 1020 E> */ B(LdrKeyedProperty), R(arg0), U8(165), R(0), + /* 1020 E> */ B(LdrKeyedProperty), R(arg0), U8(166), R(0), B(Ldar), R(0), /* 1026 S> */ B(Ldar), R(arg1), - /* 1032 E> */ B(LdrKeyedProperty), R(arg0), U8(167), R(0), + /* 1032 E> */ B(LdrKeyedProperty), R(arg0), U8(168), R(0), B(Ldar), R(0), /* 1038 S> */ B(Ldar), R(arg1), - /* 1044 E> */ B(LdrKeyedProperty), R(arg0), U8(169), R(0), + /* 1044 E> */ B(LdrKeyedProperty), R(arg0), U8(170), R(0), B(Ldar), R(0), /* 1050 S> */ B(Ldar), R(arg1), - /* 1056 E> */ B(LdrKeyedProperty), R(arg0), U8(171), R(0), + /* 1056 E> */ B(LdrKeyedProperty), R(arg0), U8(172), R(0), B(Ldar), R(0), /* 1062 S> */ B(Ldar), R(arg1), - /* 1068 E> */ B(LdrKeyedProperty), R(arg0), U8(173), R(0), + /* 1068 E> */ B(LdrKeyedProperty), R(arg0), U8(174), R(0), B(Ldar), R(0), /* 1074 S> */ B(Ldar), R(arg1), - /* 1080 E> */ B(LdrKeyedProperty), R(arg0), U8(175), R(0), + /* 1080 E> */ B(LdrKeyedProperty), R(arg0), U8(176), R(0), B(Ldar), R(0), /* 1086 S> */ B(Ldar), R(arg1), - /* 1092 E> */ B(LdrKeyedProperty), R(arg0), U8(177), R(0), + /* 1092 E> */ B(LdrKeyedProperty), R(arg0), U8(178), R(0), B(Ldar), R(0), /* 1098 S> */ B(Ldar), R(arg1), - /* 1104 E> */ B(LdrKeyedProperty), R(arg0), U8(179), R(0), + /* 1104 E> */ B(LdrKeyedProperty), R(arg0), U8(180), R(0), B(Ldar), R(0), /* 1110 S> */ B(Ldar), R(arg1), - /* 1116 E> */ B(LdrKeyedProperty), R(arg0), U8(181), R(0), + /* 1116 E> */ B(LdrKeyedProperty), R(arg0), U8(182), R(0), B(Ldar), R(0), /* 1122 S> */ B(Ldar), R(arg1), - /* 1128 E> */ B(LdrKeyedProperty), R(arg0), U8(183), R(0), + /* 1128 E> */ B(LdrKeyedProperty), R(arg0), U8(184), R(0), B(Ldar), R(0), /* 1134 S> */ B(Ldar), R(arg1), - /* 1140 E> */ B(LdrKeyedProperty), R(arg0), U8(185), R(0), + /* 1140 E> */ B(LdrKeyedProperty), R(arg0), U8(186), R(0), B(Ldar), R(0), /* 1146 S> */ B(Ldar), R(arg1), - /* 1152 E> */ B(LdrKeyedProperty), R(arg0), U8(187), R(0), + /* 1152 E> */ B(LdrKeyedProperty), R(arg0), U8(188), R(0), B(Ldar), R(0), /* 1158 S> */ B(Ldar), R(arg1), - /* 1164 E> */ B(LdrKeyedProperty), R(arg0), U8(189), R(0), + /* 1164 E> */ B(LdrKeyedProperty), R(arg0), U8(190), R(0), B(Ldar), R(0), /* 1170 S> */ B(Ldar), R(arg1), - /* 1176 E> */ B(LdrKeyedProperty), R(arg0), U8(191), R(0), + /* 1176 E> */ B(LdrKeyedProperty), R(arg0), U8(192), R(0), B(Ldar), R(0), /* 1182 S> */ B(Ldar), R(arg1), - /* 1188 E> */ B(LdrKeyedProperty), R(arg0), U8(193), R(0), + /* 1188 E> */ B(LdrKeyedProperty), R(arg0), U8(194), R(0), B(Ldar), R(0), /* 1194 S> */ B(Ldar), R(arg1), - /* 1200 E> */ B(LdrKeyedProperty), R(arg0), U8(195), R(0), + /* 1200 E> */ B(LdrKeyedProperty), R(arg0), U8(196), R(0), B(Ldar), R(0), /* 1206 S> */ B(Ldar), R(arg1), - /* 1212 E> */ B(LdrKeyedProperty), R(arg0), U8(197), R(0), + /* 1212 E> */ B(LdrKeyedProperty), R(arg0), U8(198), R(0), B(Ldar), R(0), /* 1218 S> */ B(Ldar), R(arg1), - /* 1224 E> */ B(LdrKeyedProperty), R(arg0), U8(199), R(0), + /* 1224 E> */ B(LdrKeyedProperty), R(arg0), U8(200), R(0), B(Ldar), R(0), /* 1230 S> */ B(Ldar), R(arg1), - /* 1236 E> */ B(LdrKeyedProperty), R(arg0), U8(201), R(0), + /* 1236 E> */ B(LdrKeyedProperty), R(arg0), U8(202), R(0), B(Ldar), R(0), /* 1242 S> */ B(Ldar), R(arg1), - /* 1248 E> */ B(LdrKeyedProperty), R(arg0), U8(203), R(0), + /* 1248 E> */ B(LdrKeyedProperty), R(arg0), U8(204), R(0), B(Ldar), R(0), /* 1254 S> */ B(Ldar), R(arg1), - /* 1260 E> */ B(LdrKeyedProperty), R(arg0), U8(205), R(0), + /* 1260 E> */ B(LdrKeyedProperty), R(arg0), U8(206), R(0), B(Ldar), R(0), /* 1266 S> */ B(Ldar), R(arg1), - /* 1272 E> */ B(LdrKeyedProperty), R(arg0), U8(207), R(0), + /* 1272 E> */ B(LdrKeyedProperty), R(arg0), U8(208), R(0), B(Ldar), R(0), /* 1278 S> */ B(Ldar), R(arg1), - /* 1284 E> */ B(LdrKeyedProperty), R(arg0), U8(209), R(0), + /* 1284 E> */ B(LdrKeyedProperty), R(arg0), U8(210), R(0), B(Ldar), R(0), /* 1290 S> */ B(Ldar), R(arg1), - /* 1296 E> */ B(LdrKeyedProperty), R(arg0), U8(211), R(0), + /* 1296 E> */ B(LdrKeyedProperty), R(arg0), U8(212), R(0), B(Ldar), R(0), /* 1302 S> */ B(Ldar), R(arg1), - /* 1308 E> */ B(LdrKeyedProperty), R(arg0), U8(213), R(0), + /* 1308 E> */ B(LdrKeyedProperty), R(arg0), U8(214), R(0), B(Ldar), R(0), /* 1314 S> */ B(Ldar), R(arg1), - /* 1320 E> */ B(LdrKeyedProperty), R(arg0), U8(215), R(0), + /* 1320 E> */ B(LdrKeyedProperty), R(arg0), U8(216), R(0), B(Ldar), R(0), /* 1326 S> */ B(Ldar), R(arg1), - /* 1332 E> */ B(LdrKeyedProperty), R(arg0), U8(217), R(0), + /* 1332 E> */ B(LdrKeyedProperty), R(arg0), U8(218), R(0), B(Ldar), R(0), /* 1338 S> */ B(Ldar), R(arg1), - /* 1344 E> */ B(LdrKeyedProperty), R(arg0), U8(219), R(0), + /* 1344 E> */ B(LdrKeyedProperty), R(arg0), U8(220), R(0), B(Ldar), R(0), /* 1350 S> */ B(Ldar), R(arg1), - /* 1356 E> */ B(LdrKeyedProperty), R(arg0), U8(221), R(0), + /* 1356 E> */ B(LdrKeyedProperty), R(arg0), U8(222), R(0), B(Ldar), R(0), /* 1362 S> */ B(Ldar), R(arg1), - /* 1368 E> */ B(LdrKeyedProperty), R(arg0), U8(223), R(0), + /* 1368 E> */ B(LdrKeyedProperty), R(arg0), U8(224), R(0), B(Ldar), R(0), /* 1374 S> */ B(Ldar), R(arg1), - /* 1380 E> */ B(LdrKeyedProperty), R(arg0), U8(225), R(0), + /* 1380 E> */ B(LdrKeyedProperty), R(arg0), U8(226), R(0), B(Ldar), R(0), /* 1386 S> */ B(Ldar), R(arg1), - /* 1392 E> */ B(LdrKeyedProperty), R(arg0), U8(227), R(0), + /* 1392 E> */ B(LdrKeyedProperty), R(arg0), U8(228), R(0), B(Ldar), R(0), /* 1398 S> */ B(Ldar), R(arg1), - /* 1404 E> */ B(LdrKeyedProperty), R(arg0), U8(229), R(0), + /* 1404 E> */ B(LdrKeyedProperty), R(arg0), U8(230), R(0), B(Ldar), R(0), /* 1410 S> */ B(Ldar), R(arg1), - /* 1416 E> */ B(LdrKeyedProperty), R(arg0), U8(231), R(0), + /* 1416 E> */ B(LdrKeyedProperty), R(arg0), U8(232), R(0), B(Ldar), R(0), /* 1422 S> */ B(Ldar), R(arg1), - /* 1428 E> */ B(LdrKeyedProperty), R(arg0), U8(233), R(0), + /* 1428 E> */ B(LdrKeyedProperty), R(arg0), U8(234), R(0), B(Ldar), R(0), /* 1434 S> */ B(Ldar), R(arg1), - /* 1440 E> */ B(LdrKeyedProperty), R(arg0), U8(235), R(0), + /* 1440 E> */ B(LdrKeyedProperty), R(arg0), U8(236), R(0), B(Ldar), R(0), /* 1446 S> */ B(Ldar), R(arg1), - /* 1452 E> */ B(LdrKeyedProperty), R(arg0), U8(237), R(0), + /* 1452 E> */ B(LdrKeyedProperty), R(arg0), U8(238), R(0), B(Ldar), R(0), /* 1458 S> */ B(Ldar), R(arg1), - /* 1464 E> */ B(LdrKeyedProperty), R(arg0), U8(239), R(0), + /* 1464 E> */ B(LdrKeyedProperty), R(arg0), U8(240), R(0), B(Ldar), R(0), /* 1470 S> */ B(Ldar), R(arg1), - /* 1476 E> */ B(LdrKeyedProperty), R(arg0), U8(241), R(0), + /* 1476 E> */ B(LdrKeyedProperty), R(arg0), U8(242), R(0), B(Ldar), R(0), /* 1482 S> */ B(Ldar), R(arg1), - /* 1488 E> */ B(LdrKeyedProperty), R(arg0), U8(243), R(0), + /* 1488 E> */ B(LdrKeyedProperty), R(arg0), U8(244), R(0), B(Ldar), R(0), /* 1494 S> */ B(Ldar), R(arg1), - /* 1500 E> */ B(LdrKeyedProperty), R(arg0), U8(245), R(0), + /* 1500 E> */ B(LdrKeyedProperty), R(arg0), U8(246), R(0), B(Ldar), R(0), /* 1506 S> */ B(Ldar), R(arg1), - /* 1512 E> */ B(LdrKeyedProperty), R(arg0), U8(247), R(0), + /* 1512 E> */ B(LdrKeyedProperty), R(arg0), U8(248), R(0), B(Ldar), R(0), /* 1518 S> */ B(Ldar), R(arg1), - /* 1524 E> */ B(LdrKeyedProperty), R(arg0), U8(249), R(0), + /* 1524 E> */ B(LdrKeyedProperty), R(arg0), U8(250), R(0), B(Ldar), R(0), /* 1530 S> */ B(Ldar), R(arg1), - /* 1536 E> */ B(LdrKeyedProperty), R(arg0), U8(251), R(0), + /* 1536 E> */ B(LdrKeyedProperty), R(arg0), U8(252), R(0), B(Ldar), R(0), /* 1542 S> */ B(Ldar), R(arg1), - /* 1548 E> */ B(LdrKeyedProperty), R(arg0), U8(253), R(0), + /* 1548 E> */ B(LdrKeyedProperty), R(arg0), U8(254), R(0), B(Ldar), R(0), /* 1554 S> */ B(Ldar), R(arg1), - /* 1560 E> */ B(LdrKeyedProperty), R(arg0), U8(255), R(0), + /* 1560 E> */ B(Wide), B(LdrKeyedProperty), R16(arg0), U16(256), R16(0), B(Ldar), R(0), /* 1566 S> */ B(Ldar), R(arg1), - /* 1575 E> */ B(Wide), B(LdaKeyedProperty), R16(arg0), U16(257), + /* 1575 E> */ B(Wide), B(LdaKeyedProperty), R16(arg0), U16(258), /* 1579 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden index 7f456cf4fc..ed71814500 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyStores.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -19,13 +17,13 @@ bytecode array length: 9 bytecodes: [ /* 10 E> */ B(StackCheck), /* 16 S> */ B(LdaConstant), U8(0), - /* 23 E> */ B(StaNamedPropertySloppy), R(arg0), U8(1), U8(1), + /* 23 E> */ B(StaNamedPropertySloppy), R(arg0), U8(1), U8(2), B(LdaUndefined), /* 32 S> */ B(Return), ] constant pool: [ - "val", - "name", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], ] handlers: [ ] @@ -41,13 +39,13 @@ bytecode array length: 9 bytecodes: [ /* 10 E> */ B(StackCheck), /* 16 S> */ B(LdaConstant), U8(0), - /* 25 E> */ B(StaNamedPropertySloppy), R(arg0), U8(1), U8(1), + /* 25 E> */ B(StaNamedPropertySloppy), R(arg0), U8(1), U8(2), B(LdaUndefined), /* 34 S> */ B(Return), ] constant pool: [ - "val", - "key", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["key"], ] handlers: [ ] @@ -65,12 +63,12 @@ bytecodes: [ /* 16 S> */ B(LdaSmi), U8(100), B(Star), R(1), B(LdaConstant), U8(0), - /* 23 E> */ B(StaKeyedPropertySloppy), R(arg0), R(1), U8(1), + /* 23 E> */ B(StaKeyedPropertySloppy), R(arg0), R(1), U8(2), B(LdaUndefined), /* 32 S> */ B(Return), ] constant pool: [ - "val", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], ] handlers: [ ] @@ -86,12 +84,12 @@ bytecode array length: 9 bytecodes: [ /* 10 E> */ B(StackCheck), /* 19 S> */ B(LdaConstant), U8(0), - /* 24 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(1), + /* 24 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(2), B(LdaUndefined), /* 33 S> */ B(Return), ] constant pool: [ - "val", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], ] handlers: [ ] @@ -107,13 +105,13 @@ bytecode array length: 12 bytecodes: [ /* 10 E> */ B(StackCheck), /* 16 S> */ B(LdaSmi), U8(-124), - /* 26 E> */ B(LdaKeyedProperty), R(arg0), U8(1), - /* 23 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(3), + /* 26 E> */ B(LdaKeyedProperty), R(arg0), U8(2), + /* 23 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(4), B(LdaUndefined), /* 34 S> */ B(Return), ] constant pool: [ - "name", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], ] handlers: [ ] @@ -129,13 +127,13 @@ bytecode array length: 9 bytecodes: [ /* 10 E> */ B(StackCheck), /* 30 S> */ B(LdaConstant), U8(0), - /* 37 E> */ B(StaNamedPropertyStrict), R(arg0), U8(1), U8(1), + /* 37 E> */ B(StaNamedPropertyStrict), R(arg0), U8(1), U8(2), B(LdaUndefined), /* 46 S> */ B(Return), ] constant pool: [ - "val", - "name", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], ] handlers: [ ] @@ -151,12 +149,12 @@ bytecode array length: 9 bytecodes: [ /* 10 E> */ B(StackCheck), /* 33 S> */ B(LdaConstant), U8(0), - /* 38 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(1), + /* 38 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(2), B(LdaUndefined), /* 47 S> */ B(Return), ] constant pool: [ - "val", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["val"], ] handlers: [ ] @@ -298,272 +296,272 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 781 +bytecode array length: 785 bytecodes: [ /* 10 E> */ B(StackCheck), /* 18 S> */ B(LdaSmi), U8(1), - /* 25 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(1), + /* 25 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(2), /* 32 S> */ B(LdaSmi), U8(1), - /* 39 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(3), + /* 39 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(4), /* 46 S> */ B(LdaSmi), U8(1), - /* 53 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(5), + /* 53 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(6), /* 60 S> */ B(LdaSmi), U8(1), - /* 67 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(7), + /* 67 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(8), /* 74 S> */ B(LdaSmi), U8(1), - /* 81 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(9), + /* 81 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(10), /* 88 S> */ B(LdaSmi), U8(1), - /* 95 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(11), + /* 95 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(12), /* 102 S> */ B(LdaSmi), U8(1), - /* 109 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(13), + /* 109 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(14), /* 116 S> */ B(LdaSmi), U8(1), - /* 123 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(15), + /* 123 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(16), /* 130 S> */ B(LdaSmi), U8(1), - /* 137 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(17), + /* 137 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(18), /* 144 S> */ B(LdaSmi), U8(1), - /* 151 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(19), + /* 151 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(20), /* 158 S> */ B(LdaSmi), U8(1), - /* 165 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(21), + /* 165 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(22), /* 172 S> */ B(LdaSmi), U8(1), - /* 179 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(23), + /* 179 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(24), /* 186 S> */ B(LdaSmi), U8(1), - /* 193 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(25), + /* 193 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(26), /* 200 S> */ B(LdaSmi), U8(1), - /* 207 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(27), + /* 207 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(28), /* 214 S> */ B(LdaSmi), U8(1), - /* 221 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(29), + /* 221 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(30), /* 228 S> */ B(LdaSmi), U8(1), - /* 235 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(31), + /* 235 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(32), /* 242 S> */ B(LdaSmi), U8(1), - /* 249 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(33), + /* 249 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(34), /* 256 S> */ B(LdaSmi), U8(1), - /* 263 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(35), + /* 263 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(36), /* 270 S> */ B(LdaSmi), U8(1), - /* 277 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(37), + /* 277 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(38), /* 284 S> */ B(LdaSmi), U8(1), - /* 291 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(39), + /* 291 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(40), /* 298 S> */ B(LdaSmi), U8(1), - /* 305 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(41), + /* 305 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(42), /* 312 S> */ B(LdaSmi), U8(1), - /* 319 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(43), + /* 319 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(44), /* 326 S> */ B(LdaSmi), U8(1), - /* 333 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(45), + /* 333 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(46), /* 340 S> */ B(LdaSmi), U8(1), - /* 347 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(47), + /* 347 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(48), /* 354 S> */ B(LdaSmi), U8(1), - /* 361 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(49), + /* 361 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(50), /* 368 S> */ B(LdaSmi), U8(1), - /* 375 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(51), + /* 375 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(52), /* 382 S> */ B(LdaSmi), U8(1), - /* 389 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(53), + /* 389 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(54), /* 396 S> */ B(LdaSmi), U8(1), - /* 403 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(55), + /* 403 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(56), /* 410 S> */ B(LdaSmi), U8(1), - /* 417 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(57), + /* 417 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(58), /* 424 S> */ B(LdaSmi), U8(1), - /* 431 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(59), + /* 431 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(60), /* 438 S> */ B(LdaSmi), U8(1), - /* 445 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(61), + /* 445 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(62), /* 452 S> */ B(LdaSmi), U8(1), - /* 459 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(63), + /* 459 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(64), /* 466 S> */ B(LdaSmi), U8(1), - /* 473 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(65), + /* 473 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(66), /* 480 S> */ B(LdaSmi), U8(1), - /* 487 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(67), + /* 487 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(68), /* 494 S> */ B(LdaSmi), U8(1), - /* 501 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(69), + /* 501 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(70), /* 508 S> */ B(LdaSmi), U8(1), - /* 515 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(71), + /* 515 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(72), /* 522 S> */ B(LdaSmi), U8(1), - /* 529 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(73), + /* 529 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(74), /* 536 S> */ B(LdaSmi), U8(1), - /* 543 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(75), + /* 543 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(76), /* 550 S> */ B(LdaSmi), U8(1), - /* 557 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(77), + /* 557 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(78), /* 564 S> */ B(LdaSmi), U8(1), - /* 571 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(79), + /* 571 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(80), /* 578 S> */ B(LdaSmi), U8(1), - /* 585 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(81), + /* 585 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(82), /* 592 S> */ B(LdaSmi), U8(1), - /* 599 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(83), + /* 599 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(84), /* 606 S> */ B(LdaSmi), U8(1), - /* 613 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(85), + /* 613 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(86), /* 620 S> */ B(LdaSmi), U8(1), - /* 627 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(87), + /* 627 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(88), /* 634 S> */ B(LdaSmi), U8(1), - /* 641 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(89), + /* 641 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(90), /* 648 S> */ B(LdaSmi), U8(1), - /* 655 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(91), + /* 655 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(92), /* 662 S> */ B(LdaSmi), U8(1), - /* 669 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(93), + /* 669 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(94), /* 676 S> */ B(LdaSmi), U8(1), - /* 683 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(95), + /* 683 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(96), /* 690 S> */ B(LdaSmi), U8(1), - /* 697 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(97), + /* 697 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(98), /* 704 S> */ B(LdaSmi), U8(1), - /* 711 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(99), + /* 711 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(100), /* 718 S> */ B(LdaSmi), U8(1), - /* 725 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(101), + /* 725 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(102), /* 732 S> */ B(LdaSmi), U8(1), - /* 739 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(103), + /* 739 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(104), /* 746 S> */ B(LdaSmi), U8(1), - /* 753 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(105), + /* 753 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(106), /* 760 S> */ B(LdaSmi), U8(1), - /* 767 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(107), + /* 767 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(108), /* 774 S> */ B(LdaSmi), U8(1), - /* 781 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(109), + /* 781 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(110), /* 788 S> */ B(LdaSmi), U8(1), - /* 795 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(111), + /* 795 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(112), /* 802 S> */ B(LdaSmi), U8(1), - /* 809 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(113), + /* 809 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(114), /* 816 S> */ B(LdaSmi), U8(1), - /* 823 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(115), + /* 823 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(116), /* 830 S> */ B(LdaSmi), U8(1), - /* 837 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(117), + /* 837 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(118), /* 844 S> */ B(LdaSmi), U8(1), - /* 851 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(119), + /* 851 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(120), /* 858 S> */ B(LdaSmi), U8(1), - /* 865 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(121), + /* 865 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(122), /* 872 S> */ B(LdaSmi), U8(1), - /* 879 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(123), + /* 879 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(124), /* 886 S> */ B(LdaSmi), U8(1), - /* 893 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(125), + /* 893 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(126), /* 900 S> */ B(LdaSmi), U8(1), - /* 907 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(127), + /* 907 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(128), /* 914 S> */ B(LdaSmi), U8(1), - /* 921 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(129), + /* 921 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(130), /* 928 S> */ B(LdaSmi), U8(1), - /* 935 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(131), + /* 935 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(132), /* 942 S> */ B(LdaSmi), U8(1), - /* 949 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(133), + /* 949 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(134), /* 956 S> */ B(LdaSmi), U8(1), - /* 963 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(135), + /* 963 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(136), /* 970 S> */ B(LdaSmi), U8(1), - /* 977 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(137), + /* 977 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(138), /* 984 S> */ B(LdaSmi), U8(1), - /* 991 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(139), + /* 991 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(140), /* 998 S> */ B(LdaSmi), U8(1), - /* 1005 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(141), + /* 1005 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(142), /* 1012 S> */ B(LdaSmi), U8(1), - /* 1019 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(143), + /* 1019 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(144), /* 1026 S> */ B(LdaSmi), U8(1), - /* 1033 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(145), + /* 1033 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(146), /* 1040 S> */ B(LdaSmi), U8(1), - /* 1047 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(147), + /* 1047 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(148), /* 1054 S> */ B(LdaSmi), U8(1), - /* 1061 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(149), + /* 1061 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(150), /* 1068 S> */ B(LdaSmi), U8(1), - /* 1075 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(151), + /* 1075 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(152), /* 1082 S> */ B(LdaSmi), U8(1), - /* 1089 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(153), + /* 1089 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(154), /* 1096 S> */ B(LdaSmi), U8(1), - /* 1103 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(155), + /* 1103 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(156), /* 1110 S> */ B(LdaSmi), U8(1), - /* 1117 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(157), + /* 1117 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(158), /* 1124 S> */ B(LdaSmi), U8(1), - /* 1131 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(159), + /* 1131 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(160), /* 1138 S> */ B(LdaSmi), U8(1), - /* 1145 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(161), + /* 1145 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(162), /* 1152 S> */ B(LdaSmi), U8(1), - /* 1159 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(163), + /* 1159 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(164), /* 1166 S> */ B(LdaSmi), U8(1), - /* 1173 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(165), + /* 1173 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(166), /* 1180 S> */ B(LdaSmi), U8(1), - /* 1187 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(167), + /* 1187 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(168), /* 1194 S> */ B(LdaSmi), U8(1), - /* 1201 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(169), + /* 1201 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(170), /* 1208 S> */ B(LdaSmi), U8(1), - /* 1215 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(171), + /* 1215 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(172), /* 1222 S> */ B(LdaSmi), U8(1), - /* 1229 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(173), + /* 1229 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(174), /* 1236 S> */ B(LdaSmi), U8(1), - /* 1243 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(175), + /* 1243 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(176), /* 1250 S> */ B(LdaSmi), U8(1), - /* 1257 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(177), + /* 1257 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(178), /* 1264 S> */ B(LdaSmi), U8(1), - /* 1271 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(179), + /* 1271 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(180), /* 1278 S> */ B(LdaSmi), U8(1), - /* 1285 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(181), + /* 1285 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(182), /* 1292 S> */ B(LdaSmi), U8(1), - /* 1299 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(183), + /* 1299 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(184), /* 1306 S> */ B(LdaSmi), U8(1), - /* 1313 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(185), + /* 1313 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(186), /* 1320 S> */ B(LdaSmi), U8(1), - /* 1327 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(187), + /* 1327 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(188), /* 1334 S> */ B(LdaSmi), U8(1), - /* 1341 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(189), + /* 1341 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(190), /* 1348 S> */ B(LdaSmi), U8(1), - /* 1355 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(191), + /* 1355 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(192), /* 1362 S> */ B(LdaSmi), U8(1), - /* 1369 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(193), + /* 1369 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(194), /* 1376 S> */ B(LdaSmi), U8(1), - /* 1383 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(195), + /* 1383 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(196), /* 1390 S> */ B(LdaSmi), U8(1), - /* 1397 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(197), + /* 1397 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(198), /* 1404 S> */ B(LdaSmi), U8(1), - /* 1411 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(199), + /* 1411 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(200), /* 1418 S> */ B(LdaSmi), U8(1), - /* 1425 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(201), + /* 1425 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(202), /* 1432 S> */ B(LdaSmi), U8(1), - /* 1439 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(203), + /* 1439 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(204), /* 1446 S> */ B(LdaSmi), U8(1), - /* 1453 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(205), + /* 1453 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(206), /* 1460 S> */ B(LdaSmi), U8(1), - /* 1467 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(207), + /* 1467 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(208), /* 1474 S> */ B(LdaSmi), U8(1), - /* 1481 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(209), + /* 1481 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(210), /* 1488 S> */ B(LdaSmi), U8(1), - /* 1495 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(211), + /* 1495 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(212), /* 1502 S> */ B(LdaSmi), U8(1), - /* 1509 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(213), + /* 1509 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(214), /* 1516 S> */ B(LdaSmi), U8(1), - /* 1523 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(215), + /* 1523 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(216), /* 1530 S> */ B(LdaSmi), U8(1), - /* 1537 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(217), + /* 1537 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(218), /* 1544 S> */ B(LdaSmi), U8(1), - /* 1551 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(219), + /* 1551 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(220), /* 1558 S> */ B(LdaSmi), U8(1), - /* 1565 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(221), + /* 1565 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(222), /* 1572 S> */ B(LdaSmi), U8(1), - /* 1579 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(223), + /* 1579 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(224), /* 1586 S> */ B(LdaSmi), U8(1), - /* 1593 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(225), + /* 1593 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(226), /* 1600 S> */ B(LdaSmi), U8(1), - /* 1607 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(227), + /* 1607 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(228), /* 1614 S> */ B(LdaSmi), U8(1), - /* 1621 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(229), + /* 1621 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(230), /* 1628 S> */ B(LdaSmi), U8(1), - /* 1635 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(231), + /* 1635 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(232), /* 1642 S> */ B(LdaSmi), U8(1), - /* 1649 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(233), + /* 1649 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(234), /* 1656 S> */ B(LdaSmi), U8(1), - /* 1663 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(235), + /* 1663 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(236), /* 1670 S> */ B(LdaSmi), U8(1), - /* 1677 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(237), + /* 1677 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(238), /* 1684 S> */ B(LdaSmi), U8(1), - /* 1691 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(239), + /* 1691 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(240), /* 1698 S> */ B(LdaSmi), U8(1), - /* 1705 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(241), + /* 1705 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(242), /* 1712 S> */ B(LdaSmi), U8(1), - /* 1719 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(243), + /* 1719 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(244), /* 1726 S> */ B(LdaSmi), U8(1), - /* 1733 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(245), + /* 1733 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(246), /* 1740 S> */ B(LdaSmi), U8(1), - /* 1747 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(247), + /* 1747 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(248), /* 1754 S> */ B(LdaSmi), U8(1), - /* 1761 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(249), + /* 1761 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(250), /* 1768 S> */ B(LdaSmi), U8(1), - /* 1775 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(251), + /* 1775 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(252), /* 1782 S> */ B(LdaSmi), U8(1), - /* 1789 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(253), + /* 1789 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(254), /* 1796 S> */ B(LdaSmi), U8(1), - /* 1803 E> */ B(StaNamedPropertySloppy), R(arg0), U8(0), U8(255), + /* 1803 E> */ B(Wide), B(StaNamedPropertySloppy), R16(arg0), U16(0), U16(256), /* 1810 S> */ B(LdaSmi), U8(2), - /* 1817 E> */ B(Wide), B(StaNamedPropertySloppy), R16(arg0), U16(0), U16(257), + /* 1817 E> */ B(Wide), B(StaNamedPropertySloppy), R16(arg0), U16(0), U16(258), B(LdaUndefined), /* 1822 S> */ B(Return), ] constant pool: [ - "name", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], ] handlers: [ ] @@ -706,272 +704,272 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 781 +bytecode array length: 785 bytecodes: [ /* 10 E> */ B(StackCheck), /* 33 S> */ B(LdaSmi), U8(1), - /* 40 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(1), + /* 40 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(2), /* 47 S> */ B(LdaSmi), U8(1), - /* 54 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(3), + /* 54 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(4), /* 61 S> */ B(LdaSmi), U8(1), - /* 68 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(5), + /* 68 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(6), /* 75 S> */ B(LdaSmi), U8(1), - /* 82 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(7), + /* 82 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(8), /* 89 S> */ B(LdaSmi), U8(1), - /* 96 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(9), + /* 96 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(10), /* 103 S> */ B(LdaSmi), U8(1), - /* 110 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(11), + /* 110 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(12), /* 117 S> */ B(LdaSmi), U8(1), - /* 124 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(13), + /* 124 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(14), /* 131 S> */ B(LdaSmi), U8(1), - /* 138 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(15), + /* 138 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(16), /* 145 S> */ B(LdaSmi), U8(1), - /* 152 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(17), + /* 152 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(18), /* 159 S> */ B(LdaSmi), U8(1), - /* 166 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(19), + /* 166 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(20), /* 173 S> */ B(LdaSmi), U8(1), - /* 180 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(21), + /* 180 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(22), /* 187 S> */ B(LdaSmi), U8(1), - /* 194 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(23), + /* 194 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(24), /* 201 S> */ B(LdaSmi), U8(1), - /* 208 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(25), + /* 208 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(26), /* 215 S> */ B(LdaSmi), U8(1), - /* 222 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(27), + /* 222 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(28), /* 229 S> */ B(LdaSmi), U8(1), - /* 236 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(29), + /* 236 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(30), /* 243 S> */ B(LdaSmi), U8(1), - /* 250 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(31), + /* 250 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(32), /* 257 S> */ B(LdaSmi), U8(1), - /* 264 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(33), + /* 264 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(34), /* 271 S> */ B(LdaSmi), U8(1), - /* 278 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(35), + /* 278 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(36), /* 285 S> */ B(LdaSmi), U8(1), - /* 292 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(37), + /* 292 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(38), /* 299 S> */ B(LdaSmi), U8(1), - /* 306 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(39), + /* 306 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(40), /* 313 S> */ B(LdaSmi), U8(1), - /* 320 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(41), + /* 320 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(42), /* 327 S> */ B(LdaSmi), U8(1), - /* 334 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(43), + /* 334 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(44), /* 341 S> */ B(LdaSmi), U8(1), - /* 348 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(45), + /* 348 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(46), /* 355 S> */ B(LdaSmi), U8(1), - /* 362 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(47), + /* 362 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(48), /* 369 S> */ B(LdaSmi), U8(1), - /* 376 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(49), + /* 376 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(50), /* 383 S> */ B(LdaSmi), U8(1), - /* 390 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(51), + /* 390 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(52), /* 397 S> */ B(LdaSmi), U8(1), - /* 404 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(53), + /* 404 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(54), /* 411 S> */ B(LdaSmi), U8(1), - /* 418 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(55), + /* 418 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(56), /* 425 S> */ B(LdaSmi), U8(1), - /* 432 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(57), + /* 432 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(58), /* 439 S> */ B(LdaSmi), U8(1), - /* 446 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(59), + /* 446 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(60), /* 453 S> */ B(LdaSmi), U8(1), - /* 460 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(61), + /* 460 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(62), /* 467 S> */ B(LdaSmi), U8(1), - /* 474 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(63), + /* 474 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(64), /* 481 S> */ B(LdaSmi), U8(1), - /* 488 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(65), + /* 488 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(66), /* 495 S> */ B(LdaSmi), U8(1), - /* 502 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(67), + /* 502 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(68), /* 509 S> */ B(LdaSmi), U8(1), - /* 516 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(69), + /* 516 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(70), /* 523 S> */ B(LdaSmi), U8(1), - /* 530 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(71), + /* 530 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(72), /* 537 S> */ B(LdaSmi), U8(1), - /* 544 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(73), + /* 544 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(74), /* 551 S> */ B(LdaSmi), U8(1), - /* 558 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(75), + /* 558 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(76), /* 565 S> */ B(LdaSmi), U8(1), - /* 572 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(77), + /* 572 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(78), /* 579 S> */ B(LdaSmi), U8(1), - /* 586 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(79), + /* 586 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(80), /* 593 S> */ B(LdaSmi), U8(1), - /* 600 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(81), + /* 600 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(82), /* 607 S> */ B(LdaSmi), U8(1), - /* 614 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(83), + /* 614 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(84), /* 621 S> */ B(LdaSmi), U8(1), - /* 628 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(85), + /* 628 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(86), /* 635 S> */ B(LdaSmi), U8(1), - /* 642 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(87), + /* 642 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(88), /* 649 S> */ B(LdaSmi), U8(1), - /* 656 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(89), + /* 656 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(90), /* 663 S> */ B(LdaSmi), U8(1), - /* 670 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(91), + /* 670 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(92), /* 677 S> */ B(LdaSmi), U8(1), - /* 684 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(93), + /* 684 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(94), /* 691 S> */ B(LdaSmi), U8(1), - /* 698 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(95), + /* 698 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(96), /* 705 S> */ B(LdaSmi), U8(1), - /* 712 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(97), + /* 712 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(98), /* 719 S> */ B(LdaSmi), U8(1), - /* 726 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(99), + /* 726 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(100), /* 733 S> */ B(LdaSmi), U8(1), - /* 740 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(101), + /* 740 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(102), /* 747 S> */ B(LdaSmi), U8(1), - /* 754 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(103), + /* 754 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(104), /* 761 S> */ B(LdaSmi), U8(1), - /* 768 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(105), + /* 768 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(106), /* 775 S> */ B(LdaSmi), U8(1), - /* 782 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(107), + /* 782 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(108), /* 789 S> */ B(LdaSmi), U8(1), - /* 796 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(109), + /* 796 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(110), /* 803 S> */ B(LdaSmi), U8(1), - /* 810 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(111), + /* 810 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(112), /* 817 S> */ B(LdaSmi), U8(1), - /* 824 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(113), + /* 824 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(114), /* 831 S> */ B(LdaSmi), U8(1), - /* 838 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(115), + /* 838 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(116), /* 845 S> */ B(LdaSmi), U8(1), - /* 852 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(117), + /* 852 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(118), /* 859 S> */ B(LdaSmi), U8(1), - /* 866 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(119), + /* 866 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(120), /* 873 S> */ B(LdaSmi), U8(1), - /* 880 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(121), + /* 880 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(122), /* 887 S> */ B(LdaSmi), U8(1), - /* 894 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(123), + /* 894 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(124), /* 901 S> */ B(LdaSmi), U8(1), - /* 908 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(125), + /* 908 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(126), /* 915 S> */ B(LdaSmi), U8(1), - /* 922 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(127), + /* 922 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(128), /* 929 S> */ B(LdaSmi), U8(1), - /* 936 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(129), + /* 936 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(130), /* 943 S> */ B(LdaSmi), U8(1), - /* 950 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(131), + /* 950 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(132), /* 957 S> */ B(LdaSmi), U8(1), - /* 964 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(133), + /* 964 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(134), /* 971 S> */ B(LdaSmi), U8(1), - /* 978 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(135), + /* 978 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(136), /* 985 S> */ B(LdaSmi), U8(1), - /* 992 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(137), + /* 992 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(138), /* 999 S> */ B(LdaSmi), U8(1), - /* 1006 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(139), + /* 1006 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(140), /* 1013 S> */ B(LdaSmi), U8(1), - /* 1020 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(141), + /* 1020 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(142), /* 1027 S> */ B(LdaSmi), U8(1), - /* 1034 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(143), + /* 1034 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(144), /* 1041 S> */ B(LdaSmi), U8(1), - /* 1048 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(145), + /* 1048 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(146), /* 1055 S> */ B(LdaSmi), U8(1), - /* 1062 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(147), + /* 1062 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(148), /* 1069 S> */ B(LdaSmi), U8(1), - /* 1076 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(149), + /* 1076 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(150), /* 1083 S> */ B(LdaSmi), U8(1), - /* 1090 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(151), + /* 1090 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(152), /* 1097 S> */ B(LdaSmi), U8(1), - /* 1104 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(153), + /* 1104 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(154), /* 1111 S> */ B(LdaSmi), U8(1), - /* 1118 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(155), + /* 1118 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(156), /* 1125 S> */ B(LdaSmi), U8(1), - /* 1132 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(157), + /* 1132 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(158), /* 1139 S> */ B(LdaSmi), U8(1), - /* 1146 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(159), + /* 1146 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(160), /* 1153 S> */ B(LdaSmi), U8(1), - /* 1160 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(161), + /* 1160 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(162), /* 1167 S> */ B(LdaSmi), U8(1), - /* 1174 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(163), + /* 1174 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(164), /* 1181 S> */ B(LdaSmi), U8(1), - /* 1188 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(165), + /* 1188 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(166), /* 1195 S> */ B(LdaSmi), U8(1), - /* 1202 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(167), + /* 1202 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(168), /* 1209 S> */ B(LdaSmi), U8(1), - /* 1216 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(169), + /* 1216 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(170), /* 1223 S> */ B(LdaSmi), U8(1), - /* 1230 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(171), + /* 1230 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(172), /* 1237 S> */ B(LdaSmi), U8(1), - /* 1244 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(173), + /* 1244 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(174), /* 1251 S> */ B(LdaSmi), U8(1), - /* 1258 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(175), + /* 1258 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(176), /* 1265 S> */ B(LdaSmi), U8(1), - /* 1272 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(177), + /* 1272 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(178), /* 1279 S> */ B(LdaSmi), U8(1), - /* 1286 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(179), + /* 1286 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(180), /* 1293 S> */ B(LdaSmi), U8(1), - /* 1300 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(181), + /* 1300 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(182), /* 1307 S> */ B(LdaSmi), U8(1), - /* 1314 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(183), + /* 1314 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(184), /* 1321 S> */ B(LdaSmi), U8(1), - /* 1328 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(185), + /* 1328 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(186), /* 1335 S> */ B(LdaSmi), U8(1), - /* 1342 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(187), + /* 1342 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(188), /* 1349 S> */ B(LdaSmi), U8(1), - /* 1356 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(189), + /* 1356 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(190), /* 1363 S> */ B(LdaSmi), U8(1), - /* 1370 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(191), + /* 1370 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(192), /* 1377 S> */ B(LdaSmi), U8(1), - /* 1384 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(193), + /* 1384 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(194), /* 1391 S> */ B(LdaSmi), U8(1), - /* 1398 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(195), + /* 1398 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(196), /* 1405 S> */ B(LdaSmi), U8(1), - /* 1412 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(197), + /* 1412 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(198), /* 1419 S> */ B(LdaSmi), U8(1), - /* 1426 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(199), + /* 1426 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(200), /* 1433 S> */ B(LdaSmi), U8(1), - /* 1440 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(201), + /* 1440 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(202), /* 1447 S> */ B(LdaSmi), U8(1), - /* 1454 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(203), + /* 1454 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(204), /* 1461 S> */ B(LdaSmi), U8(1), - /* 1468 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(205), + /* 1468 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(206), /* 1475 S> */ B(LdaSmi), U8(1), - /* 1482 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(207), + /* 1482 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(208), /* 1489 S> */ B(LdaSmi), U8(1), - /* 1496 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(209), + /* 1496 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(210), /* 1503 S> */ B(LdaSmi), U8(1), - /* 1510 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(211), + /* 1510 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(212), /* 1517 S> */ B(LdaSmi), U8(1), - /* 1524 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(213), + /* 1524 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(214), /* 1531 S> */ B(LdaSmi), U8(1), - /* 1538 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(215), + /* 1538 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(216), /* 1545 S> */ B(LdaSmi), U8(1), - /* 1552 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(217), + /* 1552 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(218), /* 1559 S> */ B(LdaSmi), U8(1), - /* 1566 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(219), + /* 1566 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(220), /* 1573 S> */ B(LdaSmi), U8(1), - /* 1580 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(221), + /* 1580 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(222), /* 1587 S> */ B(LdaSmi), U8(1), - /* 1594 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(223), + /* 1594 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(224), /* 1601 S> */ B(LdaSmi), U8(1), - /* 1608 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(225), + /* 1608 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(226), /* 1615 S> */ B(LdaSmi), U8(1), - /* 1622 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(227), + /* 1622 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(228), /* 1629 S> */ B(LdaSmi), U8(1), - /* 1636 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(229), + /* 1636 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(230), /* 1643 S> */ B(LdaSmi), U8(1), - /* 1650 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(231), + /* 1650 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(232), /* 1657 S> */ B(LdaSmi), U8(1), - /* 1664 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(233), + /* 1664 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(234), /* 1671 S> */ B(LdaSmi), U8(1), - /* 1678 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(235), + /* 1678 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(236), /* 1685 S> */ B(LdaSmi), U8(1), - /* 1692 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(237), + /* 1692 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(238), /* 1699 S> */ B(LdaSmi), U8(1), - /* 1706 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(239), + /* 1706 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(240), /* 1713 S> */ B(LdaSmi), U8(1), - /* 1720 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(241), + /* 1720 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(242), /* 1727 S> */ B(LdaSmi), U8(1), - /* 1734 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(243), + /* 1734 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(244), /* 1741 S> */ B(LdaSmi), U8(1), - /* 1748 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(245), + /* 1748 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(246), /* 1755 S> */ B(LdaSmi), U8(1), - /* 1762 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(247), + /* 1762 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(248), /* 1769 S> */ B(LdaSmi), U8(1), - /* 1776 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(249), + /* 1776 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(250), /* 1783 S> */ B(LdaSmi), U8(1), - /* 1790 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(251), + /* 1790 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(252), /* 1797 S> */ B(LdaSmi), U8(1), - /* 1804 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(253), + /* 1804 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(254), /* 1811 S> */ B(LdaSmi), U8(1), - /* 1818 E> */ B(StaNamedPropertyStrict), R(arg0), U8(0), U8(255), + /* 1818 E> */ B(Wide), B(StaNamedPropertyStrict), R16(arg0), U16(0), U16(256), /* 1825 S> */ B(LdaSmi), U8(2), - /* 1832 E> */ B(Wide), B(StaNamedPropertyStrict), R16(arg0), U16(0), U16(257), + /* 1832 E> */ B(Wide), B(StaNamedPropertyStrict), R16(arg0), U16(0), U16(258), B(LdaUndefined), /* 1837 S> */ B(Return), ] constant pool: [ - "name", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], ] handlers: [ ] @@ -1113,267 +1111,267 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 781 +bytecode array length: 785 bytecodes: [ /* 10 E> */ B(StackCheck), /* 21 S> */ B(LdaSmi), U8(1), - /* 26 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(1), + /* 26 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(2), /* 33 S> */ B(LdaSmi), U8(1), - /* 38 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(3), + /* 38 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(4), /* 45 S> */ B(LdaSmi), U8(1), - /* 50 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(5), + /* 50 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(6), /* 57 S> */ B(LdaSmi), U8(1), - /* 62 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(7), + /* 62 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(8), /* 69 S> */ B(LdaSmi), U8(1), - /* 74 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(9), + /* 74 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(10), /* 81 S> */ B(LdaSmi), U8(1), - /* 86 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(11), + /* 86 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(12), /* 93 S> */ B(LdaSmi), U8(1), - /* 98 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(13), + /* 98 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(14), /* 105 S> */ B(LdaSmi), U8(1), - /* 110 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(15), + /* 110 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(16), /* 117 S> */ B(LdaSmi), U8(1), - /* 122 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(17), + /* 122 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(18), /* 129 S> */ B(LdaSmi), U8(1), - /* 134 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(19), + /* 134 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(20), /* 141 S> */ B(LdaSmi), U8(1), - /* 146 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(21), + /* 146 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(22), /* 153 S> */ B(LdaSmi), U8(1), - /* 158 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(23), + /* 158 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(24), /* 165 S> */ B(LdaSmi), U8(1), - /* 170 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(25), + /* 170 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(26), /* 177 S> */ B(LdaSmi), U8(1), - /* 182 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(27), + /* 182 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(28), /* 189 S> */ B(LdaSmi), U8(1), - /* 194 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(29), + /* 194 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(30), /* 201 S> */ B(LdaSmi), U8(1), - /* 206 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(31), + /* 206 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(32), /* 213 S> */ B(LdaSmi), U8(1), - /* 218 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(33), + /* 218 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(34), /* 225 S> */ B(LdaSmi), U8(1), - /* 230 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(35), + /* 230 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(36), /* 237 S> */ B(LdaSmi), U8(1), - /* 242 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(37), + /* 242 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(38), /* 249 S> */ B(LdaSmi), U8(1), - /* 254 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(39), + /* 254 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(40), /* 261 S> */ B(LdaSmi), U8(1), - /* 266 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(41), + /* 266 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(42), /* 273 S> */ B(LdaSmi), U8(1), - /* 278 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(43), + /* 278 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(44), /* 285 S> */ B(LdaSmi), U8(1), - /* 290 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(45), + /* 290 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(46), /* 297 S> */ B(LdaSmi), U8(1), - /* 302 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(47), + /* 302 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(48), /* 309 S> */ B(LdaSmi), U8(1), - /* 314 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(49), + /* 314 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(50), /* 321 S> */ B(LdaSmi), U8(1), - /* 326 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(51), + /* 326 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(52), /* 333 S> */ B(LdaSmi), U8(1), - /* 338 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(53), + /* 338 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(54), /* 345 S> */ B(LdaSmi), U8(1), - /* 350 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(55), + /* 350 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(56), /* 357 S> */ B(LdaSmi), U8(1), - /* 362 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(57), + /* 362 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(58), /* 369 S> */ B(LdaSmi), U8(1), - /* 374 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(59), + /* 374 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(60), /* 381 S> */ B(LdaSmi), U8(1), - /* 386 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(61), + /* 386 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(62), /* 393 S> */ B(LdaSmi), U8(1), - /* 398 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(63), + /* 398 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(64), /* 405 S> */ B(LdaSmi), U8(1), - /* 410 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(65), + /* 410 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(66), /* 417 S> */ B(LdaSmi), U8(1), - /* 422 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(67), + /* 422 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(68), /* 429 S> */ B(LdaSmi), U8(1), - /* 434 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(69), + /* 434 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(70), /* 441 S> */ B(LdaSmi), U8(1), - /* 446 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(71), + /* 446 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(72), /* 453 S> */ B(LdaSmi), U8(1), - /* 458 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(73), + /* 458 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(74), /* 465 S> */ B(LdaSmi), U8(1), - /* 470 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(75), + /* 470 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(76), /* 477 S> */ B(LdaSmi), U8(1), - /* 482 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(77), + /* 482 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(78), /* 489 S> */ B(LdaSmi), U8(1), - /* 494 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(79), + /* 494 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(80), /* 501 S> */ B(LdaSmi), U8(1), - /* 506 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(81), + /* 506 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(82), /* 513 S> */ B(LdaSmi), U8(1), - /* 518 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(83), + /* 518 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(84), /* 525 S> */ B(LdaSmi), U8(1), - /* 530 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(85), + /* 530 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(86), /* 537 S> */ B(LdaSmi), U8(1), - /* 542 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(87), + /* 542 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(88), /* 549 S> */ B(LdaSmi), U8(1), - /* 554 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(89), + /* 554 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(90), /* 561 S> */ B(LdaSmi), U8(1), - /* 566 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(91), + /* 566 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(92), /* 573 S> */ B(LdaSmi), U8(1), - /* 578 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(93), + /* 578 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(94), /* 585 S> */ B(LdaSmi), U8(1), - /* 590 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(95), + /* 590 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(96), /* 597 S> */ B(LdaSmi), U8(1), - /* 602 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(97), + /* 602 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(98), /* 609 S> */ B(LdaSmi), U8(1), - /* 614 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(99), + /* 614 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(100), /* 621 S> */ B(LdaSmi), U8(1), - /* 626 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(101), + /* 626 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(102), /* 633 S> */ B(LdaSmi), U8(1), - /* 638 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(103), + /* 638 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(104), /* 645 S> */ B(LdaSmi), U8(1), - /* 650 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(105), + /* 650 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(106), /* 657 S> */ B(LdaSmi), U8(1), - /* 662 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(107), + /* 662 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(108), /* 669 S> */ B(LdaSmi), U8(1), - /* 674 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(109), + /* 674 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(110), /* 681 S> */ B(LdaSmi), U8(1), - /* 686 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(111), + /* 686 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(112), /* 693 S> */ B(LdaSmi), U8(1), - /* 698 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(113), + /* 698 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(114), /* 705 S> */ B(LdaSmi), U8(1), - /* 710 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(115), + /* 710 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(116), /* 717 S> */ B(LdaSmi), U8(1), - /* 722 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(117), + /* 722 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(118), /* 729 S> */ B(LdaSmi), U8(1), - /* 734 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(119), + /* 734 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(120), /* 741 S> */ B(LdaSmi), U8(1), - /* 746 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(121), + /* 746 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(122), /* 753 S> */ B(LdaSmi), U8(1), - /* 758 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(123), + /* 758 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(124), /* 765 S> */ B(LdaSmi), U8(1), - /* 770 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(125), + /* 770 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(126), /* 777 S> */ B(LdaSmi), U8(1), - /* 782 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(127), + /* 782 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(128), /* 789 S> */ B(LdaSmi), U8(1), - /* 794 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(129), + /* 794 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(130), /* 801 S> */ B(LdaSmi), U8(1), - /* 806 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(131), + /* 806 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(132), /* 813 S> */ B(LdaSmi), U8(1), - /* 818 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(133), + /* 818 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(134), /* 825 S> */ B(LdaSmi), U8(1), - /* 830 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(135), + /* 830 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(136), /* 837 S> */ B(LdaSmi), U8(1), - /* 842 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(137), + /* 842 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(138), /* 849 S> */ B(LdaSmi), U8(1), - /* 854 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(139), + /* 854 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(140), /* 861 S> */ B(LdaSmi), U8(1), - /* 866 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(141), + /* 866 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(142), /* 873 S> */ B(LdaSmi), U8(1), - /* 878 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(143), + /* 878 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(144), /* 885 S> */ B(LdaSmi), U8(1), - /* 890 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(145), + /* 890 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(146), /* 897 S> */ B(LdaSmi), U8(1), - /* 902 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(147), + /* 902 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(148), /* 909 S> */ B(LdaSmi), U8(1), - /* 914 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(149), + /* 914 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(150), /* 921 S> */ B(LdaSmi), U8(1), - /* 926 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(151), + /* 926 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(152), /* 933 S> */ B(LdaSmi), U8(1), - /* 938 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(153), + /* 938 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(154), /* 945 S> */ B(LdaSmi), U8(1), - /* 950 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(155), + /* 950 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(156), /* 957 S> */ B(LdaSmi), U8(1), - /* 962 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(157), + /* 962 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(158), /* 969 S> */ B(LdaSmi), U8(1), - /* 974 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(159), + /* 974 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(160), /* 981 S> */ B(LdaSmi), U8(1), - /* 986 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(161), + /* 986 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(162), /* 993 S> */ B(LdaSmi), U8(1), - /* 998 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(163), + /* 998 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(164), /* 1005 S> */ B(LdaSmi), U8(1), - /* 1010 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(165), + /* 1010 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(166), /* 1017 S> */ B(LdaSmi), U8(1), - /* 1022 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(167), + /* 1022 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(168), /* 1029 S> */ B(LdaSmi), U8(1), - /* 1034 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(169), + /* 1034 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(170), /* 1041 S> */ B(LdaSmi), U8(1), - /* 1046 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(171), + /* 1046 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(172), /* 1053 S> */ B(LdaSmi), U8(1), - /* 1058 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(173), + /* 1058 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(174), /* 1065 S> */ B(LdaSmi), U8(1), - /* 1070 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(175), + /* 1070 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(176), /* 1077 S> */ B(LdaSmi), U8(1), - /* 1082 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(177), + /* 1082 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(178), /* 1089 S> */ B(LdaSmi), U8(1), - /* 1094 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(179), + /* 1094 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(180), /* 1101 S> */ B(LdaSmi), U8(1), - /* 1106 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(181), + /* 1106 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(182), /* 1113 S> */ B(LdaSmi), U8(1), - /* 1118 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(183), + /* 1118 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(184), /* 1125 S> */ B(LdaSmi), U8(1), - /* 1130 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(185), + /* 1130 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(186), /* 1137 S> */ B(LdaSmi), U8(1), - /* 1142 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(187), + /* 1142 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(188), /* 1149 S> */ B(LdaSmi), U8(1), - /* 1154 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(189), + /* 1154 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(190), /* 1161 S> */ B(LdaSmi), U8(1), - /* 1166 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(191), + /* 1166 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(192), /* 1173 S> */ B(LdaSmi), U8(1), - /* 1178 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(193), + /* 1178 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(194), /* 1185 S> */ B(LdaSmi), U8(1), - /* 1190 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(195), + /* 1190 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(196), /* 1197 S> */ B(LdaSmi), U8(1), - /* 1202 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(197), + /* 1202 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(198), /* 1209 S> */ B(LdaSmi), U8(1), - /* 1214 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(199), + /* 1214 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(200), /* 1221 S> */ B(LdaSmi), U8(1), - /* 1226 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(201), + /* 1226 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(202), /* 1233 S> */ B(LdaSmi), U8(1), - /* 1238 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(203), + /* 1238 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(204), /* 1245 S> */ B(LdaSmi), U8(1), - /* 1250 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(205), + /* 1250 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(206), /* 1257 S> */ B(LdaSmi), U8(1), - /* 1262 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(207), + /* 1262 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(208), /* 1269 S> */ B(LdaSmi), U8(1), - /* 1274 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(209), + /* 1274 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(210), /* 1281 S> */ B(LdaSmi), U8(1), - /* 1286 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(211), + /* 1286 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(212), /* 1293 S> */ B(LdaSmi), U8(1), - /* 1298 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(213), + /* 1298 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(214), /* 1305 S> */ B(LdaSmi), U8(1), - /* 1310 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(215), + /* 1310 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(216), /* 1317 S> */ B(LdaSmi), U8(1), - /* 1322 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(217), + /* 1322 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(218), /* 1329 S> */ B(LdaSmi), U8(1), - /* 1334 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(219), + /* 1334 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(220), /* 1341 S> */ B(LdaSmi), U8(1), - /* 1346 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(221), + /* 1346 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(222), /* 1353 S> */ B(LdaSmi), U8(1), - /* 1358 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(223), + /* 1358 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(224), /* 1365 S> */ B(LdaSmi), U8(1), - /* 1370 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(225), + /* 1370 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(226), /* 1377 S> */ B(LdaSmi), U8(1), - /* 1382 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(227), + /* 1382 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(228), /* 1389 S> */ B(LdaSmi), U8(1), - /* 1394 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(229), + /* 1394 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(230), /* 1401 S> */ B(LdaSmi), U8(1), - /* 1406 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(231), + /* 1406 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(232), /* 1413 S> */ B(LdaSmi), U8(1), - /* 1418 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(233), + /* 1418 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(234), /* 1425 S> */ B(LdaSmi), U8(1), - /* 1430 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(235), + /* 1430 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(236), /* 1437 S> */ B(LdaSmi), U8(1), - /* 1442 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(237), + /* 1442 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(238), /* 1449 S> */ B(LdaSmi), U8(1), - /* 1454 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(239), + /* 1454 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(240), /* 1461 S> */ B(LdaSmi), U8(1), - /* 1466 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(241), + /* 1466 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(242), /* 1473 S> */ B(LdaSmi), U8(1), - /* 1478 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(243), + /* 1478 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(244), /* 1485 S> */ B(LdaSmi), U8(1), - /* 1490 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(245), + /* 1490 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(246), /* 1497 S> */ B(LdaSmi), U8(1), - /* 1502 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(247), + /* 1502 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(248), /* 1509 S> */ B(LdaSmi), U8(1), - /* 1514 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(249), + /* 1514 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(250), /* 1521 S> */ B(LdaSmi), U8(1), - /* 1526 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(251), + /* 1526 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(252), /* 1533 S> */ B(LdaSmi), U8(1), - /* 1538 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(253), + /* 1538 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(254), /* 1545 S> */ B(LdaSmi), U8(1), - /* 1550 E> */ B(StaKeyedPropertySloppy), R(arg0), R(arg1), U8(255), + /* 1550 E> */ B(Wide), B(StaKeyedPropertySloppy), R16(arg0), R16(arg1), U16(256), /* 1557 S> */ B(LdaSmi), U8(2), - /* 1562 E> */ B(Wide), B(StaKeyedPropertySloppy), R16(arg0), R16(arg1), U16(257), + /* 1562 E> */ B(Wide), B(StaKeyedPropertySloppy), R16(arg0), R16(arg1), U16(258), B(LdaUndefined), /* 1567 S> */ B(Return), ] @@ -1520,267 +1518,267 @@ snippet: " " frame size: 0 parameter count: 3 -bytecode array length: 781 +bytecode array length: 785 bytecodes: [ /* 10 E> */ B(StackCheck), /* 37 S> */ B(LdaSmi), U8(1), - /* 42 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(1), + /* 42 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(2), /* 49 S> */ B(LdaSmi), U8(1), - /* 54 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(3), + /* 54 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(4), /* 61 S> */ B(LdaSmi), U8(1), - /* 66 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(5), + /* 66 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(6), /* 73 S> */ B(LdaSmi), U8(1), - /* 78 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(7), + /* 78 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(8), /* 85 S> */ B(LdaSmi), U8(1), - /* 90 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(9), + /* 90 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(10), /* 97 S> */ B(LdaSmi), U8(1), - /* 102 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(11), + /* 102 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(12), /* 109 S> */ B(LdaSmi), U8(1), - /* 114 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(13), + /* 114 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(14), /* 121 S> */ B(LdaSmi), U8(1), - /* 126 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(15), + /* 126 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(16), /* 133 S> */ B(LdaSmi), U8(1), - /* 138 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(17), + /* 138 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(18), /* 145 S> */ B(LdaSmi), U8(1), - /* 150 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(19), + /* 150 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(20), /* 157 S> */ B(LdaSmi), U8(1), - /* 162 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(21), + /* 162 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(22), /* 169 S> */ B(LdaSmi), U8(1), - /* 174 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(23), + /* 174 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(24), /* 181 S> */ B(LdaSmi), U8(1), - /* 186 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(25), + /* 186 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(26), /* 193 S> */ B(LdaSmi), U8(1), - /* 198 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(27), + /* 198 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(28), /* 205 S> */ B(LdaSmi), U8(1), - /* 210 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(29), + /* 210 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(30), /* 217 S> */ B(LdaSmi), U8(1), - /* 222 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(31), + /* 222 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(32), /* 229 S> */ B(LdaSmi), U8(1), - /* 234 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(33), + /* 234 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(34), /* 241 S> */ B(LdaSmi), U8(1), - /* 246 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(35), + /* 246 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(36), /* 253 S> */ B(LdaSmi), U8(1), - /* 258 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(37), + /* 258 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(38), /* 265 S> */ B(LdaSmi), U8(1), - /* 270 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(39), + /* 270 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(40), /* 277 S> */ B(LdaSmi), U8(1), - /* 282 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(41), + /* 282 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(42), /* 289 S> */ B(LdaSmi), U8(1), - /* 294 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(43), + /* 294 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(44), /* 301 S> */ B(LdaSmi), U8(1), - /* 306 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(45), + /* 306 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(46), /* 313 S> */ B(LdaSmi), U8(1), - /* 318 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(47), + /* 318 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(48), /* 325 S> */ B(LdaSmi), U8(1), - /* 330 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(49), + /* 330 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(50), /* 337 S> */ B(LdaSmi), U8(1), - /* 342 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(51), + /* 342 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(52), /* 349 S> */ B(LdaSmi), U8(1), - /* 354 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(53), + /* 354 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(54), /* 361 S> */ B(LdaSmi), U8(1), - /* 366 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(55), + /* 366 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(56), /* 373 S> */ B(LdaSmi), U8(1), - /* 378 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(57), + /* 378 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(58), /* 385 S> */ B(LdaSmi), U8(1), - /* 390 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(59), + /* 390 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(60), /* 397 S> */ B(LdaSmi), U8(1), - /* 402 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(61), + /* 402 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(62), /* 409 S> */ B(LdaSmi), U8(1), - /* 414 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(63), + /* 414 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(64), /* 421 S> */ B(LdaSmi), U8(1), - /* 426 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(65), + /* 426 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(66), /* 433 S> */ B(LdaSmi), U8(1), - /* 438 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(67), + /* 438 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(68), /* 445 S> */ B(LdaSmi), U8(1), - /* 450 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(69), + /* 450 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(70), /* 457 S> */ B(LdaSmi), U8(1), - /* 462 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(71), + /* 462 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(72), /* 469 S> */ B(LdaSmi), U8(1), - /* 474 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(73), + /* 474 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(74), /* 481 S> */ B(LdaSmi), U8(1), - /* 486 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(75), + /* 486 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(76), /* 493 S> */ B(LdaSmi), U8(1), - /* 498 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(77), + /* 498 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(78), /* 505 S> */ B(LdaSmi), U8(1), - /* 510 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(79), + /* 510 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(80), /* 517 S> */ B(LdaSmi), U8(1), - /* 522 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(81), + /* 522 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(82), /* 529 S> */ B(LdaSmi), U8(1), - /* 534 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(83), + /* 534 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(84), /* 541 S> */ B(LdaSmi), U8(1), - /* 546 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(85), + /* 546 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(86), /* 553 S> */ B(LdaSmi), U8(1), - /* 558 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(87), + /* 558 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(88), /* 565 S> */ B(LdaSmi), U8(1), - /* 570 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(89), + /* 570 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(90), /* 577 S> */ B(LdaSmi), U8(1), - /* 582 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(91), + /* 582 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(92), /* 589 S> */ B(LdaSmi), U8(1), - /* 594 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(93), + /* 594 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(94), /* 601 S> */ B(LdaSmi), U8(1), - /* 606 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(95), + /* 606 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(96), /* 613 S> */ B(LdaSmi), U8(1), - /* 618 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(97), + /* 618 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(98), /* 625 S> */ B(LdaSmi), U8(1), - /* 630 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(99), + /* 630 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(100), /* 637 S> */ B(LdaSmi), U8(1), - /* 642 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(101), + /* 642 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(102), /* 649 S> */ B(LdaSmi), U8(1), - /* 654 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(103), + /* 654 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(104), /* 661 S> */ B(LdaSmi), U8(1), - /* 666 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(105), + /* 666 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(106), /* 673 S> */ B(LdaSmi), U8(1), - /* 678 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(107), + /* 678 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(108), /* 685 S> */ B(LdaSmi), U8(1), - /* 690 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(109), + /* 690 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(110), /* 697 S> */ B(LdaSmi), U8(1), - /* 702 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(111), + /* 702 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(112), /* 709 S> */ B(LdaSmi), U8(1), - /* 714 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(113), + /* 714 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(114), /* 721 S> */ B(LdaSmi), U8(1), - /* 726 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(115), + /* 726 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(116), /* 733 S> */ B(LdaSmi), U8(1), - /* 738 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(117), + /* 738 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(118), /* 745 S> */ B(LdaSmi), U8(1), - /* 750 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(119), + /* 750 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(120), /* 757 S> */ B(LdaSmi), U8(1), - /* 762 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(121), + /* 762 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(122), /* 769 S> */ B(LdaSmi), U8(1), - /* 774 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(123), + /* 774 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(124), /* 781 S> */ B(LdaSmi), U8(1), - /* 786 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(125), + /* 786 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(126), /* 793 S> */ B(LdaSmi), U8(1), - /* 798 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(127), + /* 798 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(128), /* 805 S> */ B(LdaSmi), U8(1), - /* 810 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(129), + /* 810 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(130), /* 817 S> */ B(LdaSmi), U8(1), - /* 822 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(131), + /* 822 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(132), /* 829 S> */ B(LdaSmi), U8(1), - /* 834 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(133), + /* 834 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(134), /* 841 S> */ B(LdaSmi), U8(1), - /* 846 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(135), + /* 846 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(136), /* 853 S> */ B(LdaSmi), U8(1), - /* 858 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(137), + /* 858 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(138), /* 865 S> */ B(LdaSmi), U8(1), - /* 870 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(139), + /* 870 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(140), /* 877 S> */ B(LdaSmi), U8(1), - /* 882 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(141), + /* 882 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(142), /* 889 S> */ B(LdaSmi), U8(1), - /* 894 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(143), + /* 894 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(144), /* 901 S> */ B(LdaSmi), U8(1), - /* 906 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(145), + /* 906 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(146), /* 913 S> */ B(LdaSmi), U8(1), - /* 918 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(147), + /* 918 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(148), /* 925 S> */ B(LdaSmi), U8(1), - /* 930 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(149), + /* 930 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(150), /* 937 S> */ B(LdaSmi), U8(1), - /* 942 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(151), + /* 942 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(152), /* 949 S> */ B(LdaSmi), U8(1), - /* 954 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(153), + /* 954 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(154), /* 961 S> */ B(LdaSmi), U8(1), - /* 966 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(155), + /* 966 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(156), /* 973 S> */ B(LdaSmi), U8(1), - /* 978 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(157), + /* 978 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(158), /* 985 S> */ B(LdaSmi), U8(1), - /* 990 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(159), + /* 990 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(160), /* 997 S> */ B(LdaSmi), U8(1), - /* 1002 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(161), + /* 1002 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(162), /* 1009 S> */ B(LdaSmi), U8(1), - /* 1014 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(163), + /* 1014 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(164), /* 1021 S> */ B(LdaSmi), U8(1), - /* 1026 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(165), + /* 1026 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(166), /* 1033 S> */ B(LdaSmi), U8(1), - /* 1038 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(167), + /* 1038 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(168), /* 1045 S> */ B(LdaSmi), U8(1), - /* 1050 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(169), + /* 1050 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(170), /* 1057 S> */ B(LdaSmi), U8(1), - /* 1062 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(171), + /* 1062 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(172), /* 1069 S> */ B(LdaSmi), U8(1), - /* 1074 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(173), + /* 1074 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(174), /* 1081 S> */ B(LdaSmi), U8(1), - /* 1086 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(175), + /* 1086 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(176), /* 1093 S> */ B(LdaSmi), U8(1), - /* 1098 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(177), + /* 1098 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(178), /* 1105 S> */ B(LdaSmi), U8(1), - /* 1110 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(179), + /* 1110 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(180), /* 1117 S> */ B(LdaSmi), U8(1), - /* 1122 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(181), + /* 1122 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(182), /* 1129 S> */ B(LdaSmi), U8(1), - /* 1134 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(183), + /* 1134 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(184), /* 1141 S> */ B(LdaSmi), U8(1), - /* 1146 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(185), + /* 1146 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(186), /* 1153 S> */ B(LdaSmi), U8(1), - /* 1158 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(187), + /* 1158 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(188), /* 1165 S> */ B(LdaSmi), U8(1), - /* 1170 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(189), + /* 1170 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(190), /* 1177 S> */ B(LdaSmi), U8(1), - /* 1182 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(191), + /* 1182 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(192), /* 1189 S> */ B(LdaSmi), U8(1), - /* 1194 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(193), + /* 1194 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(194), /* 1201 S> */ B(LdaSmi), U8(1), - /* 1206 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(195), + /* 1206 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(196), /* 1213 S> */ B(LdaSmi), U8(1), - /* 1218 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(197), + /* 1218 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(198), /* 1225 S> */ B(LdaSmi), U8(1), - /* 1230 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(199), + /* 1230 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(200), /* 1237 S> */ B(LdaSmi), U8(1), - /* 1242 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(201), + /* 1242 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(202), /* 1249 S> */ B(LdaSmi), U8(1), - /* 1254 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(203), + /* 1254 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(204), /* 1261 S> */ B(LdaSmi), U8(1), - /* 1266 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(205), + /* 1266 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(206), /* 1273 S> */ B(LdaSmi), U8(1), - /* 1278 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(207), + /* 1278 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(208), /* 1285 S> */ B(LdaSmi), U8(1), - /* 1290 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(209), + /* 1290 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(210), /* 1297 S> */ B(LdaSmi), U8(1), - /* 1302 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(211), + /* 1302 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(212), /* 1309 S> */ B(LdaSmi), U8(1), - /* 1314 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(213), + /* 1314 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(214), /* 1321 S> */ B(LdaSmi), U8(1), - /* 1326 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(215), + /* 1326 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(216), /* 1333 S> */ B(LdaSmi), U8(1), - /* 1338 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(217), + /* 1338 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(218), /* 1345 S> */ B(LdaSmi), U8(1), - /* 1350 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(219), + /* 1350 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(220), /* 1357 S> */ B(LdaSmi), U8(1), - /* 1362 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(221), + /* 1362 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(222), /* 1369 S> */ B(LdaSmi), U8(1), - /* 1374 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(223), + /* 1374 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(224), /* 1381 S> */ B(LdaSmi), U8(1), - /* 1386 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(225), + /* 1386 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(226), /* 1393 S> */ B(LdaSmi), U8(1), - /* 1398 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(227), + /* 1398 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(228), /* 1405 S> */ B(LdaSmi), U8(1), - /* 1410 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(229), + /* 1410 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(230), /* 1417 S> */ B(LdaSmi), U8(1), - /* 1422 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(231), + /* 1422 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(232), /* 1429 S> */ B(LdaSmi), U8(1), - /* 1434 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(233), + /* 1434 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(234), /* 1441 S> */ B(LdaSmi), U8(1), - /* 1446 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(235), + /* 1446 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(236), /* 1453 S> */ B(LdaSmi), U8(1), - /* 1458 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(237), + /* 1458 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(238), /* 1465 S> */ B(LdaSmi), U8(1), - /* 1470 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(239), + /* 1470 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(240), /* 1477 S> */ B(LdaSmi), U8(1), - /* 1482 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(241), + /* 1482 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(242), /* 1489 S> */ B(LdaSmi), U8(1), - /* 1494 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(243), + /* 1494 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(244), /* 1501 S> */ B(LdaSmi), U8(1), - /* 1506 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(245), + /* 1506 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(246), /* 1513 S> */ B(LdaSmi), U8(1), - /* 1518 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(247), + /* 1518 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(248), /* 1525 S> */ B(LdaSmi), U8(1), - /* 1530 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(249), + /* 1530 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(250), /* 1537 S> */ B(LdaSmi), U8(1), - /* 1542 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(251), + /* 1542 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(252), /* 1549 S> */ B(LdaSmi), U8(1), - /* 1554 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(253), + /* 1554 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(254), /* 1561 S> */ B(LdaSmi), U8(1), - /* 1566 E> */ B(StaKeyedPropertyStrict), R(arg0), R(arg1), U8(255), + /* 1566 E> */ B(Wide), B(StaKeyedPropertyStrict), R16(arg0), R16(arg1), U16(256), /* 1573 S> */ B(LdaSmi), U8(2), - /* 1578 E> */ B(Wide), B(StaKeyedPropertyStrict), R16(arg0), R16(arg1), U16(257), + /* 1578 E> */ B(Wide), B(StaKeyedPropertyStrict), R16(arg0), R16(arg1), U16(258), B(LdaUndefined), /* 1583 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden index 3637f78230..03973619fd 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: yes --- @@ -20,7 +18,7 @@ bytecodes: [ /* 49 S> */ B(Return), ] constant pool: [ - "ab+d", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["ab+d"], ] handlers: [ ] @@ -38,7 +36,7 @@ bytecodes: [ /* 58 S> */ B(Return), ] constant pool: [ - "(\u005cw+)\u005cs(\u005cw+)", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["(\u005cw+)\u005cs(\u005cw+)"], ] handlers: [ ] @@ -54,16 +52,16 @@ bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateRegExpLiteral), U8(0), U8(0), U8(0), B(Star), R(1), - /* 47 E> */ B(LdrNamedProperty), R(1), U8(1), U8(3), R(0), + /* 47 E> */ B(LdrNamedProperty), R(1), U8(1), U8(4), R(0), B(LdaConstant), U8(2), B(Star), R(2), - /* 48 E> */ B(Call), R(0), R(1), U8(2), U8(1), + /* 48 E> */ B(Call), R(0), R(1), U8(2), U8(2), /* 62 S> */ B(Return), ] constant pool: [ - "ab+d", - "exec", - "abdd", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["ab+d"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["exec"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["abdd"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden index 3c5499b4cf..3eb79ba725 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiteralsWide.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: yes wrap: yes --- @@ -789,263 +787,263 @@ bytecodes: [ /* 2616 S> */ B(Return), ] constant pool: [ - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::HEAP_NUMBER_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + HEAP_NUMBER_TYPE [1.23], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["ab+d"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden index c632a76e69..de6e8935b3 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RemoveRedundantLdar.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- @@ -18,20 +16,20 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 26 +bytecode array length: 28 bytecodes: [ /* 30 E> */ B(StackCheck), /* 45 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 48 E> */ B(StackCheck), /* 64 S> */ B(Ldar), R(0), - /* 78 E> */ B(Add), R(0), U8(1), + /* 78 E> */ B(Add), R(0), U8(2), B(Star), R(0), /* 86 S> */ B(LdaSmi), U8(10), - /* 95 E> */ B(TestGreaterThan), R(0), + /* 95 E> */ B(TestGreaterThan), R(0), U8(3), B(JumpIfFalse), U8(4), - /* 101 S> */ B(Jump), U8(4), - B(Jump), U8(-16), + /* 101 S> */ B(Jump), U8(5), + B(JumpLoop), U8(-17), U8(0), /* 110 S> */ B(Ldar), R(0), /* 123 S> */ B(Return), ] @@ -51,17 +49,17 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 23 +bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), /* 45 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 48 E> */ B(StackCheck), /* 55 S> */ B(Nop), - /* 69 E> */ B(Add), R(0), U8(1), + /* 69 E> */ B(Add), R(0), U8(2), B(Star), R(0), /* 77 S> */ B(LdaSmi), U8(10), - /* 86 E> */ B(TestGreaterThan), R(0), + /* 86 E> */ B(TestGreaterThan), R(0), U8(3), B(JumpIfFalse), U8(4), /* 92 S> */ B(Jump), U8(2), /* 118 S> */ B(Ldar), R(0), @@ -86,7 +84,7 @@ bytecodes: [ /* 45 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 50 S> */ B(Nop), - /* 64 E> */ B(Add), R(0), U8(1), + /* 64 E> */ B(Add), R(0), U8(2), B(Star), R(0), /* 72 S> */ B(Nop), /* 85 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden index 5cc49b2035..422fa12cb1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StoreGlobal.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -20,12 +18,12 @@ bytecode array length: 8 bytecodes: [ /* 21 E> */ B(StackCheck), /* 26 S> */ B(LdaSmi), U8(2), - /* 28 E> */ B(StaGlobalSloppy), U8(0), U8(1), + /* 28 E> */ B(StaGlobalSloppy), U8(0), U8(2), B(LdaUndefined), /* 33 S> */ B(Return), ] constant pool: [ - "a", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], ] handlers: [ ] @@ -41,12 +39,12 @@ bytecode array length: 8 bytecodes: [ /* 26 E> */ B(StackCheck), /* 32 S> */ B(Ldar), R(arg0), - /* 34 E> */ B(StaGlobalSloppy), U8(0), U8(1), + /* 34 E> */ B(StaGlobalSloppy), U8(0), U8(2), B(LdaUndefined), /* 39 S> */ B(Return), ] constant pool: [ - "a", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], ] handlers: [ ] @@ -63,12 +61,12 @@ bytecode array length: 8 bytecodes: [ /* 35 E> */ B(StackCheck), /* 40 S> */ B(LdaSmi), U8(2), - /* 42 E> */ B(StaGlobalStrict), U8(0), U8(1), + /* 42 E> */ B(StaGlobalStrict), U8(0), U8(2), B(LdaUndefined), /* 47 S> */ B(Return), ] constant pool: [ - "a", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], ] handlers: [ ] @@ -85,12 +83,12 @@ bytecode array length: 8 bytecodes: [ /* 17 E> */ B(StackCheck), /* 22 S> */ B(LdaSmi), U8(2), - /* 24 E> */ B(StaGlobalSloppy), U8(0), U8(1), + /* 24 E> */ B(StaGlobalSloppy), U8(0), U8(2), B(LdaUndefined), /* 29 S> */ B(Return), ] constant pool: [ - "a", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], ] handlers: [ ] @@ -233,273 +231,273 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 651 +bytecode array length: 655 bytecodes: [ /* 17 E> */ B(StackCheck), /* 25 S> */ B(Nop), - /* 26 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 26 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(2), /* 35 S> */ B(Nop), - /* 36 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(3), + /* 36 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4), /* 45 S> */ B(Nop), - /* 46 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(5), + /* 46 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(6), /* 55 S> */ B(Nop), - /* 56 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(7), + /* 56 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(8), /* 65 S> */ B(Nop), - /* 66 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(9), + /* 66 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(10), /* 75 S> */ B(Nop), - /* 76 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(11), + /* 76 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(12), /* 85 S> */ B(Nop), - /* 86 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(13), + /* 86 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(14), /* 95 S> */ B(Nop), - /* 96 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(15), + /* 96 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(16), /* 105 S> */ B(Nop), - /* 106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(17), + /* 106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(18), /* 115 S> */ B(Nop), - /* 116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(19), + /* 116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(20), /* 125 S> */ B(Nop), - /* 126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(21), + /* 126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(22), /* 135 S> */ B(Nop), - /* 136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(23), + /* 136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(24), /* 145 S> */ B(Nop), - /* 146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(25), + /* 146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(26), /* 155 S> */ B(Nop), - /* 156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(27), + /* 156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(28), /* 165 S> */ B(Nop), - /* 166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(29), + /* 166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(30), /* 175 S> */ B(Nop), - /* 176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(31), + /* 176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(32), /* 185 S> */ B(Nop), - /* 186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(33), + /* 186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(34), /* 195 S> */ B(Nop), - /* 196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(35), + /* 196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(36), /* 205 S> */ B(Nop), - /* 206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(37), + /* 206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(38), /* 215 S> */ B(Nop), - /* 216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(39), + /* 216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(40), /* 225 S> */ B(Nop), - /* 226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(41), + /* 226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(42), /* 235 S> */ B(Nop), - /* 236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(43), + /* 236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(44), /* 245 S> */ B(Nop), - /* 246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(45), + /* 246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(46), /* 255 S> */ B(Nop), - /* 256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(47), + /* 256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(48), /* 265 S> */ B(Nop), - /* 266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(49), + /* 266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(50), /* 275 S> */ B(Nop), - /* 276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(51), + /* 276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(52), /* 285 S> */ B(Nop), - /* 286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(53), + /* 286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(54), /* 295 S> */ B(Nop), - /* 296 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(55), + /* 296 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(56), /* 305 S> */ B(Nop), - /* 306 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(57), + /* 306 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(58), /* 315 S> */ B(Nop), - /* 316 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(59), + /* 316 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(60), /* 325 S> */ B(Nop), - /* 326 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(61), + /* 326 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(62), /* 335 S> */ B(Nop), - /* 336 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(63), + /* 336 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(64), /* 345 S> */ B(Nop), - /* 346 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(65), + /* 346 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(66), /* 355 S> */ B(Nop), - /* 356 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(67), + /* 356 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(68), /* 365 S> */ B(Nop), - /* 366 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(69), + /* 366 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(70), /* 375 S> */ B(Nop), - /* 376 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(71), + /* 376 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(72), /* 385 S> */ B(Nop), - /* 386 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(73), + /* 386 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(74), /* 395 S> */ B(Nop), - /* 396 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(75), + /* 396 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(76), /* 405 S> */ B(Nop), - /* 406 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(77), + /* 406 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(78), /* 415 S> */ B(Nop), - /* 416 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(79), + /* 416 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(80), /* 425 S> */ B(Nop), - /* 426 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(81), + /* 426 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(82), /* 435 S> */ B(Nop), - /* 436 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(83), + /* 436 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(84), /* 445 S> */ B(Nop), - /* 446 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(85), + /* 446 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(86), /* 455 S> */ B(Nop), - /* 456 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(87), + /* 456 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(88), /* 465 S> */ B(Nop), - /* 466 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(89), + /* 466 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(90), /* 475 S> */ B(Nop), - /* 476 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(91), + /* 476 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(92), /* 485 S> */ B(Nop), - /* 486 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(93), + /* 486 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(94), /* 495 S> */ B(Nop), - /* 496 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(95), + /* 496 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(96), /* 505 S> */ B(Nop), - /* 506 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(97), + /* 506 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(98), /* 515 S> */ B(Nop), - /* 516 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(99), + /* 516 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(100), /* 525 S> */ B(Nop), - /* 526 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(101), + /* 526 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(102), /* 535 S> */ B(Nop), - /* 536 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(103), + /* 536 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(104), /* 545 S> */ B(Nop), - /* 546 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(105), + /* 546 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(106), /* 555 S> */ B(Nop), - /* 556 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(107), + /* 556 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(108), /* 565 S> */ B(Nop), - /* 566 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(109), + /* 566 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(110), /* 575 S> */ B(Nop), - /* 576 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(111), + /* 576 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(112), /* 585 S> */ B(Nop), - /* 586 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(113), + /* 586 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(114), /* 595 S> */ B(Nop), - /* 596 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(115), + /* 596 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(116), /* 605 S> */ B(Nop), - /* 606 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(117), + /* 606 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(118), /* 615 S> */ B(Nop), - /* 616 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(119), + /* 616 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(120), /* 625 S> */ B(Nop), - /* 626 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(121), + /* 626 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(122), /* 635 S> */ B(Nop), - /* 636 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(123), + /* 636 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(124), /* 645 S> */ B(Nop), - /* 646 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(125), + /* 646 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(126), /* 655 S> */ B(Nop), - /* 656 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(127), + /* 656 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(128), /* 665 S> */ B(Nop), - /* 666 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(129), + /* 666 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(130), /* 675 S> */ B(Nop), - /* 676 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(131), + /* 676 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(132), /* 685 S> */ B(Nop), - /* 686 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(133), + /* 686 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(134), /* 695 S> */ B(Nop), - /* 696 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(135), + /* 696 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(136), /* 705 S> */ B(Nop), - /* 706 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(137), + /* 706 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(138), /* 715 S> */ B(Nop), - /* 716 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(139), + /* 716 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(140), /* 725 S> */ B(Nop), - /* 726 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(141), + /* 726 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(142), /* 735 S> */ B(Nop), - /* 736 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(143), + /* 736 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(144), /* 745 S> */ B(Nop), - /* 746 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(145), + /* 746 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(146), /* 755 S> */ B(Nop), - /* 756 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(147), + /* 756 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(148), /* 765 S> */ B(Nop), - /* 766 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(149), + /* 766 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(150), /* 775 S> */ B(Nop), - /* 776 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(151), + /* 776 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(152), /* 785 S> */ B(Nop), - /* 786 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(153), + /* 786 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(154), /* 795 S> */ B(Nop), - /* 796 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(155), + /* 796 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(156), /* 805 S> */ B(Nop), - /* 806 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(157), + /* 806 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(158), /* 815 S> */ B(Nop), - /* 816 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(159), + /* 816 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(160), /* 825 S> */ B(Nop), - /* 826 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(161), + /* 826 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(162), /* 835 S> */ B(Nop), - /* 836 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(163), + /* 836 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(164), /* 845 S> */ B(Nop), - /* 846 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(165), + /* 846 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(166), /* 855 S> */ B(Nop), - /* 856 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(167), + /* 856 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(168), /* 865 S> */ B(Nop), - /* 866 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(169), + /* 866 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(170), /* 875 S> */ B(Nop), - /* 876 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(171), + /* 876 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(172), /* 885 S> */ B(Nop), - /* 886 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(173), + /* 886 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(174), /* 895 S> */ B(Nop), - /* 896 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(175), + /* 896 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(176), /* 905 S> */ B(Nop), - /* 906 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(177), + /* 906 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(178), /* 915 S> */ B(Nop), - /* 916 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(179), + /* 916 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(180), /* 925 S> */ B(Nop), - /* 926 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(181), + /* 926 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(182), /* 935 S> */ B(Nop), - /* 936 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(183), + /* 936 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(184), /* 945 S> */ B(Nop), - /* 946 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(185), + /* 946 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(186), /* 955 S> */ B(Nop), - /* 956 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(187), + /* 956 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(188), /* 965 S> */ B(Nop), - /* 966 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(189), + /* 966 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(190), /* 975 S> */ B(Nop), - /* 976 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(191), + /* 976 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(192), /* 985 S> */ B(Nop), - /* 986 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(193), + /* 986 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(194), /* 995 S> */ B(Nop), - /* 996 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(195), + /* 996 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(196), /* 1005 S> */ B(Nop), - /* 1006 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(197), + /* 1006 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(198), /* 1015 S> */ B(Nop), - /* 1016 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(199), + /* 1016 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(200), /* 1025 S> */ B(Nop), - /* 1026 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(201), + /* 1026 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(202), /* 1035 S> */ B(Nop), - /* 1036 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(203), + /* 1036 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(204), /* 1045 S> */ B(Nop), - /* 1046 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(205), + /* 1046 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(206), /* 1055 S> */ B(Nop), - /* 1056 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(207), + /* 1056 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(208), /* 1065 S> */ B(Nop), - /* 1066 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(209), + /* 1066 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(210), /* 1075 S> */ B(Nop), - /* 1076 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(211), + /* 1076 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(212), /* 1085 S> */ B(Nop), - /* 1086 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(213), + /* 1086 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(214), /* 1095 S> */ B(Nop), - /* 1096 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(215), + /* 1096 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(216), /* 1105 S> */ B(Nop), - /* 1106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(217), + /* 1106 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(218), /* 1115 S> */ B(Nop), - /* 1116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(219), + /* 1116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(220), /* 1125 S> */ B(Nop), - /* 1126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(221), + /* 1126 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(222), /* 1135 S> */ B(Nop), - /* 1136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(223), + /* 1136 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(224), /* 1145 S> */ B(Nop), - /* 1146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(225), + /* 1146 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(226), /* 1155 S> */ B(Nop), - /* 1156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(227), + /* 1156 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(228), /* 1165 S> */ B(Nop), - /* 1166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(229), + /* 1166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(230), /* 1175 S> */ B(Nop), - /* 1176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(231), + /* 1176 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(232), /* 1185 S> */ B(Nop), - /* 1186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(233), + /* 1186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(234), /* 1195 S> */ B(Nop), - /* 1196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(235), + /* 1196 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(236), /* 1205 S> */ B(Nop), - /* 1206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(237), + /* 1206 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(238), /* 1215 S> */ B(Nop), - /* 1216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(239), + /* 1216 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(240), /* 1225 S> */ B(Nop), - /* 1226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(241), + /* 1226 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(242), /* 1235 S> */ B(Nop), - /* 1236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(243), + /* 1236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(244), /* 1245 S> */ B(Nop), - /* 1246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(245), + /* 1246 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(246), /* 1255 S> */ B(Nop), - /* 1256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(247), + /* 1256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(248), /* 1265 S> */ B(Nop), - /* 1266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(249), + /* 1266 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(250), /* 1275 S> */ B(Nop), - /* 1276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(251), + /* 1276 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(252), /* 1285 S> */ B(Nop), - /* 1286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(253), + /* 1286 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(254), /* 1295 S> */ B(Nop), - /* 1296 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(255), + /* 1296 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(256), /* 1305 S> */ B(LdaSmi), U8(2), - /* 1307 E> */ B(Wide), B(StaGlobalSloppy), U16(1), U16(257), + /* 1307 E> */ B(Wide), B(StaGlobalSloppy), U16(1), U16(258), B(LdaUndefined), /* 1312 S> */ B(Return), ] constant pool: [ - "name", - "a", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], ] handlers: [ ] @@ -643,273 +641,273 @@ snippet: " " frame size: 0 parameter count: 2 -bytecode array length: 651 +bytecode array length: 655 bytecodes: [ /* 17 E> */ B(StackCheck), /* 41 S> */ B(Nop), - /* 42 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(1), + /* 42 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(2), /* 51 S> */ B(Nop), - /* 52 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(3), + /* 52 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4), /* 61 S> */ B(Nop), - /* 62 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(5), + /* 62 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(6), /* 71 S> */ B(Nop), - /* 72 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(7), + /* 72 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(8), /* 81 S> */ B(Nop), - /* 82 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(9), + /* 82 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(10), /* 91 S> */ B(Nop), - /* 92 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(11), + /* 92 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(12), /* 101 S> */ B(Nop), - /* 102 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(13), + /* 102 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(14), /* 111 S> */ B(Nop), - /* 112 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(15), + /* 112 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(16), /* 121 S> */ B(Nop), - /* 122 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(17), + /* 122 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(18), /* 131 S> */ B(Nop), - /* 132 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(19), + /* 132 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(20), /* 141 S> */ B(Nop), - /* 142 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(21), + /* 142 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(22), /* 151 S> */ B(Nop), - /* 152 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(23), + /* 152 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(24), /* 161 S> */ B(Nop), - /* 162 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(25), + /* 162 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(26), /* 171 S> */ B(Nop), - /* 172 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(27), + /* 172 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(28), /* 181 S> */ B(Nop), - /* 182 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(29), + /* 182 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(30), /* 191 S> */ B(Nop), - /* 192 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(31), + /* 192 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(32), /* 201 S> */ B(Nop), - /* 202 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(33), + /* 202 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(34), /* 211 S> */ B(Nop), - /* 212 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(35), + /* 212 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(36), /* 221 S> */ B(Nop), - /* 222 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(37), + /* 222 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(38), /* 231 S> */ B(Nop), - /* 232 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(39), + /* 232 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(40), /* 241 S> */ B(Nop), - /* 242 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(41), + /* 242 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(42), /* 251 S> */ B(Nop), - /* 252 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(43), + /* 252 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(44), /* 261 S> */ B(Nop), - /* 262 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(45), + /* 262 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(46), /* 271 S> */ B(Nop), - /* 272 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(47), + /* 272 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(48), /* 281 S> */ B(Nop), - /* 282 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(49), + /* 282 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(50), /* 291 S> */ B(Nop), - /* 292 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(51), + /* 292 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(52), /* 301 S> */ B(Nop), - /* 302 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(53), + /* 302 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(54), /* 311 S> */ B(Nop), - /* 312 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(55), + /* 312 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(56), /* 321 S> */ B(Nop), - /* 322 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(57), + /* 322 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(58), /* 331 S> */ B(Nop), - /* 332 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(59), + /* 332 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(60), /* 341 S> */ B(Nop), - /* 342 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(61), + /* 342 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(62), /* 351 S> */ B(Nop), - /* 352 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(63), + /* 352 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(64), /* 361 S> */ B(Nop), - /* 362 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(65), + /* 362 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(66), /* 371 S> */ B(Nop), - /* 372 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(67), + /* 372 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(68), /* 381 S> */ B(Nop), - /* 382 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(69), + /* 382 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(70), /* 391 S> */ B(Nop), - /* 392 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(71), + /* 392 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(72), /* 401 S> */ B(Nop), - /* 402 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(73), + /* 402 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(74), /* 411 S> */ B(Nop), - /* 412 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(75), + /* 412 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(76), /* 421 S> */ B(Nop), - /* 422 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(77), + /* 422 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(78), /* 431 S> */ B(Nop), - /* 432 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(79), + /* 432 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(80), /* 441 S> */ B(Nop), - /* 442 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(81), + /* 442 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(82), /* 451 S> */ B(Nop), - /* 452 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(83), + /* 452 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(84), /* 461 S> */ B(Nop), - /* 462 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(85), + /* 462 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(86), /* 471 S> */ B(Nop), - /* 472 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(87), + /* 472 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(88), /* 481 S> */ B(Nop), - /* 482 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(89), + /* 482 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(90), /* 491 S> */ B(Nop), - /* 492 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(91), + /* 492 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(92), /* 501 S> */ B(Nop), - /* 502 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(93), + /* 502 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(94), /* 511 S> */ B(Nop), - /* 512 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(95), + /* 512 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(96), /* 521 S> */ B(Nop), - /* 522 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(97), + /* 522 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(98), /* 531 S> */ B(Nop), - /* 532 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(99), + /* 532 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(100), /* 541 S> */ B(Nop), - /* 542 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(101), + /* 542 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(102), /* 551 S> */ B(Nop), - /* 552 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(103), + /* 552 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(104), /* 561 S> */ B(Nop), - /* 562 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(105), + /* 562 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(106), /* 571 S> */ B(Nop), - /* 572 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(107), + /* 572 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(108), /* 581 S> */ B(Nop), - /* 582 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(109), + /* 582 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(110), /* 591 S> */ B(Nop), - /* 592 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(111), + /* 592 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(112), /* 601 S> */ B(Nop), - /* 602 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(113), + /* 602 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(114), /* 611 S> */ B(Nop), - /* 612 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(115), + /* 612 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(116), /* 621 S> */ B(Nop), - /* 622 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(117), + /* 622 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(118), /* 631 S> */ B(Nop), - /* 632 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(119), + /* 632 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(120), /* 641 S> */ B(Nop), - /* 642 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(121), + /* 642 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(122), /* 651 S> */ B(Nop), - /* 652 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(123), + /* 652 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(124), /* 661 S> */ B(Nop), - /* 662 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(125), + /* 662 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(126), /* 671 S> */ B(Nop), - /* 672 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(127), + /* 672 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(128), /* 681 S> */ B(Nop), - /* 682 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(129), + /* 682 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(130), /* 691 S> */ B(Nop), - /* 692 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(131), + /* 692 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(132), /* 701 S> */ B(Nop), - /* 702 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(133), + /* 702 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(134), /* 711 S> */ B(Nop), - /* 712 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(135), + /* 712 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(136), /* 721 S> */ B(Nop), - /* 722 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(137), + /* 722 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(138), /* 731 S> */ B(Nop), - /* 732 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(139), + /* 732 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(140), /* 741 S> */ B(Nop), - /* 742 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(141), + /* 742 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(142), /* 751 S> */ B(Nop), - /* 752 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(143), + /* 752 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(144), /* 761 S> */ B(Nop), - /* 762 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(145), + /* 762 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(146), /* 771 S> */ B(Nop), - /* 772 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(147), + /* 772 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(148), /* 781 S> */ B(Nop), - /* 782 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(149), + /* 782 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(150), /* 791 S> */ B(Nop), - /* 792 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(151), + /* 792 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(152), /* 801 S> */ B(Nop), - /* 802 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(153), + /* 802 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(154), /* 811 S> */ B(Nop), - /* 812 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(155), + /* 812 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(156), /* 821 S> */ B(Nop), - /* 822 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(157), + /* 822 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(158), /* 831 S> */ B(Nop), - /* 832 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(159), + /* 832 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(160), /* 841 S> */ B(Nop), - /* 842 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(161), + /* 842 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(162), /* 851 S> */ B(Nop), - /* 852 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(163), + /* 852 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(164), /* 861 S> */ B(Nop), - /* 862 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(165), + /* 862 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(166), /* 871 S> */ B(Nop), - /* 872 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(167), + /* 872 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(168), /* 881 S> */ B(Nop), - /* 882 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(169), + /* 882 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(170), /* 891 S> */ B(Nop), - /* 892 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(171), + /* 892 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(172), /* 901 S> */ B(Nop), - /* 902 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(173), + /* 902 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(174), /* 911 S> */ B(Nop), - /* 912 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(175), + /* 912 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(176), /* 921 S> */ B(Nop), - /* 922 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(177), + /* 922 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(178), /* 931 S> */ B(Nop), - /* 932 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(179), + /* 932 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(180), /* 941 S> */ B(Nop), - /* 942 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(181), + /* 942 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(182), /* 951 S> */ B(Nop), - /* 952 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(183), + /* 952 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(184), /* 961 S> */ B(Nop), - /* 962 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(185), + /* 962 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(186), /* 971 S> */ B(Nop), - /* 972 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(187), + /* 972 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(188), /* 981 S> */ B(Nop), - /* 982 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(189), + /* 982 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(190), /* 991 S> */ B(Nop), - /* 992 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(191), + /* 992 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(192), /* 1001 S> */ B(Nop), - /* 1002 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(193), + /* 1002 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(194), /* 1011 S> */ B(Nop), - /* 1012 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(195), + /* 1012 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(196), /* 1021 S> */ B(Nop), - /* 1022 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(197), + /* 1022 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(198), /* 1031 S> */ B(Nop), - /* 1032 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(199), + /* 1032 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(200), /* 1041 S> */ B(Nop), - /* 1042 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(201), + /* 1042 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(202), /* 1051 S> */ B(Nop), - /* 1052 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(203), + /* 1052 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(204), /* 1061 S> */ B(Nop), - /* 1062 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(205), + /* 1062 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(206), /* 1071 S> */ B(Nop), - /* 1072 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(207), + /* 1072 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(208), /* 1081 S> */ B(Nop), - /* 1082 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(209), + /* 1082 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(210), /* 1091 S> */ B(Nop), - /* 1092 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(211), + /* 1092 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(212), /* 1101 S> */ B(Nop), - /* 1102 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(213), + /* 1102 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(214), /* 1111 S> */ B(Nop), - /* 1112 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(215), + /* 1112 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(216), /* 1121 S> */ B(Nop), - /* 1122 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(217), + /* 1122 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(218), /* 1131 S> */ B(Nop), - /* 1132 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(219), + /* 1132 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(220), /* 1141 S> */ B(Nop), - /* 1142 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(221), + /* 1142 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(222), /* 1151 S> */ B(Nop), - /* 1152 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(223), + /* 1152 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(224), /* 1161 S> */ B(Nop), - /* 1162 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(225), + /* 1162 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(226), /* 1171 S> */ B(Nop), - /* 1172 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(227), + /* 1172 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(228), /* 1181 S> */ B(Nop), - /* 1182 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(229), + /* 1182 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(230), /* 1191 S> */ B(Nop), - /* 1192 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(231), + /* 1192 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(232), /* 1201 S> */ B(Nop), - /* 1202 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(233), + /* 1202 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(234), /* 1211 S> */ B(Nop), - /* 1212 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(235), + /* 1212 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(236), /* 1221 S> */ B(Nop), - /* 1222 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(237), + /* 1222 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(238), /* 1231 S> */ B(Nop), - /* 1232 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(239), + /* 1232 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(240), /* 1241 S> */ B(Nop), - /* 1242 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(241), + /* 1242 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(242), /* 1251 S> */ B(Nop), - /* 1252 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(243), + /* 1252 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(244), /* 1261 S> */ B(Nop), - /* 1262 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(245), + /* 1262 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(246), /* 1271 S> */ B(Nop), - /* 1272 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(247), + /* 1272 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(248), /* 1281 S> */ B(Nop), - /* 1282 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(249), + /* 1282 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(250), /* 1291 S> */ B(Nop), - /* 1292 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(251), + /* 1292 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(252), /* 1301 S> */ B(Nop), - /* 1302 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(253), + /* 1302 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(254), /* 1311 S> */ B(Nop), - /* 1312 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(255), + /* 1312 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(256), /* 1321 S> */ B(LdaSmi), U8(2), - /* 1323 E> */ B(Wide), B(StaGlobalStrict), U16(1), U16(257), + /* 1323 E> */ B(Wide), B(StaGlobalStrict), U16(1), U16(258), B(LdaUndefined), /* 1328 S> */ B(Return), ] constant pool: [ - "name", - "a", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["name"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden index c28ac2a8c9..260153b8e6 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/StringConstants.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: yes --- @@ -20,7 +18,7 @@ bytecodes: [ /* 61 S> */ B(Return), ] constant pool: [ - "This is a string", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["This is a string"], ] handlers: [ ] @@ -40,8 +38,8 @@ bytecodes: [ /* 82 S> */ B(Return), ] constant pool: [ - "First string", - "Second string", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["First string"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["Second string"], ] handlers: [ ] @@ -61,7 +59,7 @@ bytecodes: [ /* 79 S> */ B(Return), ] constant pool: [ - "Same string", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["Same string"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden index bc16a7b964..9334dbebfd 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Switch.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- @@ -17,18 +15,18 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 32 +bytecode array length: 34 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(1), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), U8(2), B(Mov), R(0), R(2), - B(JumpIfToBooleanTrue), U8(10), + B(JumpIfToBooleanTrue), U8(11), B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(2), U8(3), B(JumpIfTrue), U8(7), B(Jump), U8(8), /* 66 S> */ B(LdaSmi), U8(2), @@ -53,25 +51,25 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 38 +bytecode array length: 40 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(1), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), U8(2), B(Mov), R(0), R(2), - B(JumpIfToBooleanTrue), U8(10), + B(JumpIfToBooleanTrue), U8(11), B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(2), U8(3), B(JumpIfTrue), U8(10), B(Jump), U8(14), /* 66 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 73 S> */ B(Jump), U8(8), /* 89 S> */ B(LdaSmi), U8(3), - B(Star), R(1), + B(Star), R(0), /* 96 S> */ B(Jump), U8(2), B(LdaUndefined), /* 105 S> */ B(Return), @@ -91,24 +89,24 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 36 +bytecode array length: 38 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(1), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), U8(2), B(Mov), R(0), R(2), - B(JumpIfToBooleanTrue), U8(10), + B(JumpIfToBooleanTrue), U8(11), B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(2), U8(3), B(JumpIfTrue), U8(8), B(Jump), U8(12), /* 66 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 98 S> */ B(LdaSmi), U8(3), - B(Star), R(1), + B(Star), R(0), /* 105 S> */ B(Jump), U8(2), B(LdaUndefined), /* 114 S> */ B(Return), @@ -129,24 +127,24 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 36 +bytecode array length: 38 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(2), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), U8(2), B(Mov), R(0), R(2), - B(JumpIfToBooleanTrue), U8(10), + B(JumpIfToBooleanTrue), U8(11), B(LdaSmi), U8(3), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(2), U8(3), B(JumpIfTrue), U8(6), B(Jump), U8(6), /* 66 S> */ B(Jump), U8(10), /* 82 S> */ B(Jump), U8(8), /* 99 S> */ B(LdaSmi), U8(1), - B(Star), R(1), + B(Star), R(0), /* 106 S> */ B(Jump), U8(2), B(LdaUndefined), /* 115 S> */ B(Return), @@ -167,29 +165,29 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 45 +bytecode array length: 47 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), - /* 42 E> */ B(TypeOf), B(Star), R(0), + /* 42 E> */ B(TypeOf), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(2), - B(TestEqualStrict), R(0), - B(Mov), R(0), R(2), - B(JumpIfToBooleanTrue), U8(10), + B(TestEqualStrict), R(1), U8(2), + B(Mov), R(1), R(2), + B(JumpIfToBooleanTrue), U8(11), B(LdaSmi), U8(3), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(2), U8(3), B(JumpIfTrue), U8(10), B(Jump), U8(14), /* 74 S> */ B(LdaSmi), U8(1), - B(Star), R(1), + B(Star), R(0), /* 81 S> */ B(Jump), U8(14), /* 97 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 104 S> */ B(Jump), U8(8), /* 121 S> */ B(LdaSmi), U8(3), - B(Star), R(1), + B(Star), R(0), /* 128 S> */ B(Jump), U8(2), B(LdaUndefined), /* 137 S> */ B(Return), @@ -209,22 +207,22 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 31 +bytecode array length: 32 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(TypeOf), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), U8(2), B(Mov), R(0), R(2), B(JumpIfToBooleanTrue), U8(4), B(Jump), U8(8), /* 74 S> */ B(LdaSmi), U8(1), - B(Star), R(1), + B(Star), R(0), /* 81 S> */ B(Jump), U8(8), /* 98 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 105 S> */ B(Jump), U8(2), B(LdaUndefined), /* 114 S> */ B(Return), @@ -311,158 +309,158 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 290 +bytecode array length: 292 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(1), B(Star), R(0), + B(Star), R(1), /* 45 S> */ B(LdaSmi), U8(1), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(1), U8(2), B(Mov), R(0), R(2), - B(JumpIfToBooleanTrue), U8(10), + B(JumpIfToBooleanTrue), U8(11), B(LdaSmi), U8(2), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(2), U8(3), B(JumpIfTrueConstant), U8(0), B(JumpConstant), U8(1), /* 68 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 77 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 86 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 95 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 104 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 113 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 122 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 131 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 140 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 149 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 158 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 167 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 176 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 185 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 194 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 203 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 212 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 221 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 230 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 239 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 248 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 257 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 266 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 275 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 284 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 293 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 302 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 311 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 320 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 329 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 338 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 347 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 356 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 365 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 374 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 383 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 392 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 401 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 410 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 419 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 428 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 437 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 446 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 455 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 464 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 473 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 482 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 491 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 500 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 509 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 518 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 527 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 536 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 545 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 554 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 563 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 572 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 581 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 590 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 599 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 608 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 617 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 626 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 635 S> */ B(LdaSmi), U8(2), - B(Star), R(1), + B(Star), R(0), /* 644 S> */ B(Jump), U8(8), /* 662 S> */ B(LdaSmi), U8(3), - B(Star), R(1), + B(Star), R(0), /* 671 S> */ B(Jump), U8(2), B(LdaUndefined), /* 680 S> */ B(Return), ] constant pool: [ - 262, - 266, + Smi [262], + Smi [266], ] handlers: [ ] @@ -481,35 +479,35 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 59 +bytecode array length: 62 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - B(Star), R(2), B(Star), R(0), + B(Star), R(2), /* 45 S> */ B(LdaSmi), U8(1), - B(TestEqualStrict), R(0), + B(TestEqualStrict), R(2), U8(5), B(Mov), R(0), R(3), - B(JumpIfToBooleanTrue), U8(10), + B(JumpIfToBooleanTrue), U8(11), B(LdaSmi), U8(2), - B(TestEqualStrict), R(3), - B(JumpIfTrue), U8(33), - B(Jump), U8(35), - /* 77 E> */ B(AddSmi), U8(1), R(2), U8(1), + B(TestEqualStrict), R(3), U8(6), + B(JumpIfTrue), U8(34), + B(Jump), U8(36), + /* 77 E> */ B(AddSmi), U8(1), R(0), U8(2), B(Star), R(1), /* 70 S> */ B(LdaSmi), U8(2), - B(TestEqualStrict), R(1), + B(TestEqualStrict), R(1), U8(3), B(Mov), R(1), R(4), B(JumpIfToBooleanTrue), U8(4), B(Jump), U8(8), /* 101 S> */ B(LdaSmi), U8(1), - B(Star), R(2), + B(Star), R(0), /* 108 S> */ B(Jump), U8(8), /* 131 S> */ B(LdaSmi), U8(2), - B(Star), R(2), + B(Star), R(0), /* 138 S> */ B(Jump), U8(2), /* 176 S> */ B(LdaSmi), U8(3), - B(Star), R(2), + B(Star), R(0), B(LdaUndefined), /* 185 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden index 582c087341..5d1c7c9143 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ThisFunction.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: no test function name: f diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden index 4e7a0bc225..15afe2f4eb 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Throw.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: yes --- @@ -37,7 +35,7 @@ bytecodes: [ /* 34 E> */ B(Throw), ] constant pool: [ - "Error", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["Error"], ] handlers: [ ] @@ -60,7 +58,7 @@ bytecodes: [ /* 72 S> */ B(Return), ] constant pool: [ - "Error", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["Error"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden index 03f8b5496d..59052b85d8 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden @@ -3,8 +3,6 @@ # --- -pool type: mixed -execute: no wrap: no top level: yes @@ -29,18 +27,18 @@ bytecodes: [ B(CreateObjectLiteral), U8(2), U8(0), U8(1), R(4), B(Star), R(2), B(CreateClosure), U8(3), U8(0), - B(StaNamedPropertySloppy), R(4), U8(4), U8(3), + B(StaNamedPropertySloppy), R(4), U8(4), U8(4), B(Mov), R(4), R(3), B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), B(LdaUndefined), /* 33 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::SHARED_FUNCTION_INFO_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["a"], + FIXED_ARRAY_TYPE, + SHARED_FUNCTION_INFO_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["func"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden index 17d4ef0fd4..c2f6113e71 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryCatch.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: yes --- @@ -13,16 +11,16 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 34 +bytecode array length: 35 bytecodes: [ /* 30 E> */ B(StackCheck), B(Mov), R(context), R(1), /* 40 S> */ B(LdaSmi), U8(1), /* 75 S> */ B(Return), - B(Jump), U8(25), + B(Jump), U8(26), B(Star), R(2), B(Ldar), R(closure), - B(CreateCatchContext), R(2), U8(0), + B(CreateCatchContext), R(2), U8(0), U8(1), B(Star), R(1), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Ldar), R(1), @@ -34,7 +32,8 @@ bytecodes: [ /* 75 S> */ B(Return), ] constant pool: [ - "e", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["e"], + FIXED_ARRAY_TYPE, ] handlers: [ [4, 7, 9], @@ -48,16 +47,16 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 65 +bytecode array length: 67 bytecodes: [ /* 30 E> */ B(StackCheck), B(Mov), R(context), R(2), /* 47 S> */ B(LdaSmi), U8(1), B(Star), R(0), - B(Jump), U8(22), + B(Jump), U8(23), B(Star), R(3), B(Ldar), R(closure), - /* 49 E> */ B(CreateCatchContext), R(3), U8(0), + /* 49 E> */ B(CreateCatchContext), R(3), U8(0), U8(1), B(Star), R(2), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Ldar), R(2), @@ -66,10 +65,10 @@ bytecodes: [ B(Mov), R(context), R(2), /* 75 S> */ B(LdaSmi), U8(2), B(Star), R(0), - B(Jump), U8(26), + B(Jump), U8(27), B(Star), R(3), B(Ldar), R(closure), - /* 77 E> */ B(CreateCatchContext), R(3), U8(1), + /* 77 E> */ B(CreateCatchContext), R(3), U8(2), U8(3), B(Star), R(2), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Ldar), R(2), @@ -81,11 +80,13 @@ bytecodes: [ /* 103 S> */ B(Return), ] constant pool: [ - "e1", - "e2", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["e1"], + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["e2"], + FIXED_ARRAY_TYPE, ] handlers: [ [4, 8, 10], - [33, 37, 39], + [34, 38, 40], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden index a42f90c844..61deb6e69c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TryFinally.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: yes --- @@ -14,7 +12,7 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 51 +bytecode array length: 52 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), @@ -34,7 +32,7 @@ bytecodes: [ B(Star), R(0), /* 72 E> */ B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(3), U8(1), B(LdaZero), - B(TestEqualStrict), R(1), + B(TestEqualStrict), R(1), U8(0), B(JumpIfTrue), U8(4), B(Jump), U8(5), B(Ldar), R(2), @@ -55,7 +53,7 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 80 +bytecode array length: 82 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), @@ -64,10 +62,10 @@ bytecodes: [ B(Mov), R(context), R(5), /* 51 S> */ B(LdaSmi), U8(2), B(Star), R(0), - B(Jump), U8(26), + B(Jump), U8(27), B(Star), R(6), B(Ldar), R(closure), - /* 53 E> */ B(CreateCatchContext), R(6), U8(0), + /* 53 E> */ B(CreateCatchContext), R(6), U8(0), U8(1), B(Star), R(5), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Ldar), R(5), @@ -87,7 +85,7 @@ bytecodes: [ B(Star), R(0), /* 92 E> */ B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), B(LdaZero), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(2), U8(0), B(JumpIfTrue), U8(4), B(Jump), U8(5), B(Ldar), R(3), @@ -96,10 +94,11 @@ bytecodes: [ /* 99 S> */ B(Return), ] constant pool: [ - "e", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["e"], + FIXED_ARRAY_TYPE, ] handlers: [ - [8, 41, 47], + [8, 42, 48], [11, 15, 17], ] @@ -111,7 +110,7 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 105 +bytecode array length: 108 bytecodes: [ /* 30 E> */ B(StackCheck), B(Mov), R(context), R(4), @@ -119,10 +118,10 @@ bytecodes: [ B(Mov), R(context), R(6), /* 55 S> */ B(LdaSmi), U8(1), B(Star), R(0), - B(Jump), U8(26), + B(Jump), U8(27), B(Star), R(7), B(Ldar), R(closure), - /* 57 E> */ B(CreateCatchContext), R(7), U8(0), + /* 57 E> */ B(CreateCatchContext), R(7), U8(0), U8(1), B(Star), R(6), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Ldar), R(6), @@ -130,10 +129,10 @@ bytecodes: [ /* 74 S> */ B(LdaSmi), U8(2), B(Star), R(0), B(PopContext), R(1), - B(Jump), U8(26), + B(Jump), U8(27), B(Star), R(6), B(Ldar), R(closure), - /* 76 E> */ B(CreateCatchContext), R(6), U8(0), + /* 76 E> */ B(CreateCatchContext), R(6), U8(0), U8(2), B(Star), R(5), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Ldar), R(5), @@ -153,7 +152,7 @@ bytecodes: [ B(Star), R(0), /* 116 E> */ B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), B(LdaZero), - B(TestEqualStrict), R(2), + B(TestEqualStrict), R(2), U8(0), B(JumpIfTrue), U8(4), B(Jump), U8(5), B(Ldar), R(3), @@ -162,11 +161,13 @@ bytecodes: [ /* 123 S> */ B(Return), ] constant pool: [ - "e", + ONE_BYTE_INTERNALIZED_STRING_TYPE ["e"], + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, ] handlers: [ - [4, 66, 72], - [7, 40, 42], + [4, 68, 74], + [7, 41, 43], [10, 14, 16], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden index 1fe9354b6f..5e15e5981e 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Typeof.golden @@ -3,8 +3,6 @@ # --- -pool type: string -execute: yes wrap: no test function name: f @@ -44,7 +42,7 @@ parameter count: 1 bytecode array length: 5 bytecodes: [ /* 22 E> */ B(StackCheck), - /* 28 S> */ B(LdaGlobalInsideTypeof), U8(1), + /* 28 S> */ B(LdaGlobalInsideTypeof), U8(2), B(TypeOf), /* 46 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden index 0e2c767256..c9f8790384 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- @@ -17,18 +15,18 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 22 +bytecode array length: 24 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(0), /* 54 S> */ B(LdaSmi), U8(10), - /* 54 E> */ B(TestEqual), R(0), - B(JumpIfTrue), U8(11), + /* 54 E> */ B(TestEqual), R(0), U8(2), + B(JumpIfTrue), U8(12), /* 45 E> */ B(StackCheck), - /* 65 S> */ B(AddSmi), U8(10), R(0), U8(1), + /* 65 S> */ B(AddSmi), U8(10), R(0), U8(3), B(Star), R(0), - B(Jump), U8(-13), + B(JumpLoop), U8(-14), U8(0), /* 79 S> */ B(Ldar), R(0), /* 89 S> */ B(Return), ] @@ -47,7 +45,7 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 18 +bytecode array length: 22 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaFalse), @@ -57,8 +55,9 @@ bytecodes: [ B(ToBooleanLogicalNot), B(Star), R(0), /* 74 S> */ B(LdaFalse), - /* 74 E> */ B(TestEqual), R(0), - B(JumpIfTrue), U8(-9), + /* 74 E> */ B(TestEqual), R(0), U8(2), + B(JumpIfFalse), U8(5), + B(JumpLoop), U8(-12), U8(0), /* 85 S> */ B(Ldar), R(0), /* 95 S> */ B(Return), ] @@ -80,7 +79,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(101), B(Star), R(0), /* 47 S> */ B(LdaSmi), U8(3), - B(Mul), R(0), U8(1), + B(Mul), R(0), U8(2), B(LdaUndefined), /* 67 S> */ B(Return), ] @@ -95,7 +94,7 @@ snippet: " var y = void (x * x - 1); return y; " -frame size: 4 +frame size: 3 parameter count: 1 bytecode array length: 23 bytecodes: [ @@ -103,9 +102,9 @@ bytecodes: [ /* 42 S> */ B(Wide), B(LdaSmi), U16(1234), B(Star), R(0), /* 56 S> */ B(Nop), - /* 66 E> */ B(Mul), R(0), U8(1), - B(Star), R(3), - B(SubSmi), U8(1), R(3), U8(2), + /* 66 E> */ B(Mul), R(0), U8(2), + B(Star), R(2), + B(SubSmi), U8(1), R(2), U8(3), B(LdrUndefined), R(1), B(Ldar), R(1), /* 74 S> */ B(Nop), @@ -129,7 +128,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(13), B(Star), R(0), /* 46 S> */ B(LdaSmi), U8(-1), - B(BitwiseXor), R(0), U8(1), + B(BitwiseXor), R(0), U8(2), /* 57 S> */ B(Return), ] constant pool: [ @@ -150,7 +149,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(13), B(Star), R(0), /* 46 S> */ B(LdaSmi), U8(1), - B(Mul), R(0), U8(1), + B(Mul), R(0), U8(2), /* 57 S> */ B(Return), ] constant pool: [ @@ -171,7 +170,7 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(13), B(Star), R(0), /* 46 S> */ B(LdaSmi), U8(-1), - B(Mul), R(0), U8(1), + B(Mul), R(0), U8(2), /* 57 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden index a39a1cf6aa..fc7d322e60 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/WideRegisters.golden @@ -3,8 +3,6 @@ # --- -pool type: number -execute: yes wrap: yes --- @@ -523,11 +521,11 @@ snippet: " " frame size: 157 parameter count: 1 -bytecode array length: 17 +bytecode array length: 18 bytecodes: [ /* 30 E> */ B(StackCheck), /* 1494 S> */ B(LdaSmi), U8(3), - /* 1501 E> */ B(TestGreaterThan), R(2), + /* 1501 E> */ B(TestGreaterThan), R(2), U8(2), B(JumpIfFalse), U8(7), /* 1508 S> */ B(Wide), B(Ldar), R16(129), /* 1536 S> */ B(Return), @@ -705,18 +703,18 @@ snippet: " " frame size: 157 parameter count: 1 -bytecode array length: 34 +bytecode array length: 37 bytecodes: [ /* 30 E> */ B(StackCheck), /* 1503 S> */ B(LdaZero), B(Star), R(0), /* 1506 S> */ B(LdaSmi), U8(3), - /* 1515 E> */ B(Wide), B(TestEqual), R16(129), + /* 1515 E> */ B(Wide), B(TestEqual), R16(129), U16(2), B(JumpIfFalse), U8(10), /* 1534 S> */ B(Wide), B(Mov), R16(0), R16(129), B(Ldar), R(0), /* 1540 S> */ B(LdaSmi), U8(3), - /* 1547 E> */ B(TestGreaterThan), R(2), + /* 1547 E> */ B(TestGreaterThan), R(2), U8(3), B(JumpIfFalse), U8(5), /* 1554 S> */ B(Ldar), R(0), /* 1580 S> */ B(Return), @@ -893,7 +891,7 @@ snippet: " " frame size: 158 parameter count: 1 -bytecode array length: 53 +bytecode array length: 56 bytecodes: [ /* 30 E> */ B(StackCheck), /* 1503 S> */ B(LdaZero), @@ -903,17 +901,17 @@ bytecodes: [ /* 1523 S> */ B(LdaZero), B(Wide), B(Star), R16(128), /* 1538 S> */ B(LdaSmi), U8(64), - /* 1538 E> */ B(Wide), B(TestLessThan), R16(128), - B(JumpIfFalse), U8(30), + /* 1538 E> */ B(Wide), B(TestLessThan), R16(128), U16(2), + B(JumpIfFalse), U8(31), /* 1518 E> */ B(StackCheck), /* 1555 S> */ B(Wide), B(Ldar), R16(128), - /* 1561 E> */ B(Add), R(1), U8(2), + /* 1561 E> */ B(Add), R(1), U8(4), B(Wide), B(Mov), R16(1), R16(157), B(Star), R(1), /* 1548 S> */ B(Wide), B(Ldar), R16(128), - B(Inc), U8(1), + B(Inc), U8(3), B(Wide), B(Star), R16(128), - B(Jump), U8(-34), + B(JumpLoop), U8(-36), U8(0), /* 1567 S> */ B(Wide), B(Ldar), R16(128), /* 1580 S> */ B(Return), ] @@ -1087,7 +1085,7 @@ snippet: " " frame size: 163 parameter count: 1 -bytecode array length: 84 +bytecode array length: 85 bytecodes: [ /* 30 E> */ B(StackCheck), /* 1503 S> */ B(Wide), B(LdaSmi), U16(1234), @@ -1095,25 +1093,25 @@ bytecodes: [ /* 1518 S> */ B(LdaZero), B(Star), R(1), /* 1534 S> */ B(Ldar), R(0), - B(JumpIfUndefined), U8(69), - B(JumpIfNull), U8(67), + B(JumpIfUndefined), U8(70), + B(JumpIfNull), U8(68), B(Wide), B(ToObject), R16(157), B(Wide), B(ForInPrepare), R16(157), R16(158), B(LdaZero), B(Wide), B(Star), R16(161), - /* 1526 S> */ B(Wide), B(ForInDone), R16(161), R16(160), - B(JumpIfTrue), U8(44), - B(Wide), B(ForInNext), R16(157), R16(161), R16(158), U16(2), + /* 1526 S> */ B(Wide), B(ForInContinue), R16(161), R16(160), + B(JumpIfFalse), U8(45), + B(Wide), B(ForInNext), R16(157), R16(161), R16(158), U16(3), B(JumpIfUndefined), U8(22), B(Wide), B(Star), R16(128), /* 1521 E> */ B(StackCheck), /* 1541 S> */ B(Wide), B(Ldar), R16(128), - /* 1547 E> */ B(Add), R(1), U8(1), + /* 1547 E> */ B(Add), R(1), U8(2), B(Wide), B(Mov), R16(1), R16(162), B(Star), R(1), /* 1544 E> */ B(Wide), B(ForInStep), R16(161), B(Wide), B(Star), R16(161), - B(Jump), U8(-48), + B(JumpLoop), U8(-48), U8(0), /* 1553 S> */ B(Ldar), R(1), /* 1564 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden index b5a0df5da2..963c71f184 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/WithStatement.golden @@ -3,32 +3,31 @@ # --- -pool type: mixed -execute: yes wrap: yes --- snippet: " with ({x:42}) { return x; } " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 21 +bytecode array length: 22 bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), B(Ldar), R(1), - B(ToObject), R(2), + B(ToObject), R(1), B(Ldar), R(closure), - B(CreateWithContext), R(2), + B(CreateWithContext), R(1), U8(1), B(PushContext), R(0), - /* 50 S> */ B(LdaLookupSlot), U8(1), + /* 50 S> */ B(LdaLookupSlot), U8(2), B(PopContext), R(0), /* 62 S> */ B(Return), ] constant pool: [ - InstanceType::FIXED_ARRAY_TYPE, - InstanceType::ONE_BYTE_INTERNALIZED_STRING_TYPE, + FIXED_ARRAY_TYPE, + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc index dd03c24b3c..e5dca853a5 100644 --- a/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc +++ b/deps/v8/test/cctest/interpreter/generate-bytecode-expectations.cc @@ -13,7 +13,6 @@ #include "include/v8.h" #include "src/base/logging.h" -#include "src/compiler.h" #include "src/interpreter/interpreter.h" #ifdef V8_OS_POSIX @@ -41,12 +40,10 @@ class ProgramOptions final { read_from_stdin_(false), rebaseline_(false), wrap_(true), - execute_(true), + module_(false), top_level_(false), do_expressions_(false), - verbose_(false), - const_pool_type_( - BytecodeExpectationsPrinter::ConstantPoolType::kMixed) {} + verbose_(false) {} bool Validate() const; void UpdateFromHeader(std::istream& stream); // NOLINT @@ -61,14 +58,11 @@ class ProgramOptions final { } bool rebaseline() const { return rebaseline_; } bool wrap() const { return wrap_; } - bool execute() const { return execute_; } + bool module() const { return module_; } bool top_level() const { return top_level_; } bool do_expressions() const { return do_expressions_; } bool verbose() const { return verbose_; } bool suppress_runtime_errors() const { return rebaseline_ && !verbose_; } - BytecodeExpectationsPrinter::ConstantPoolType const_pool_type() const { - return const_pool_type_; - } std::vector<std::string> input_filenames() const { return input_filenames_; } std::string output_filename() const { return output_filename_; } std::string test_function_name() const { return test_function_name_; } @@ -80,11 +74,10 @@ class ProgramOptions final { bool read_from_stdin_; bool rebaseline_; bool wrap_; - bool execute_; + bool module_; bool top_level_; bool do_expressions_; bool verbose_; - BytecodeExpectationsPrinter::ConstantPoolType const_pool_type_; std::vector<std::string> input_filenames_; std::string output_filename_; std::string test_function_name_; @@ -106,33 +99,6 @@ class V8InitializationScope final { DISALLOW_COPY_AND_ASSIGN(V8InitializationScope); }; -BytecodeExpectationsPrinter::ConstantPoolType ParseConstantPoolType( - const char* type_string) { - if (strcmp(type_string, "number") == 0) { - return BytecodeExpectationsPrinter::ConstantPoolType::kNumber; - } else if (strcmp(type_string, "string") == 0) { - return BytecodeExpectationsPrinter::ConstantPoolType::kString; - } else if (strcmp(type_string, "mixed") == 0) { - return BytecodeExpectationsPrinter::ConstantPoolType::kMixed; - } - return BytecodeExpectationsPrinter::ConstantPoolType::kUnknown; -} - -const char* ConstantPoolTypeToString( - BytecodeExpectationsPrinter::ConstantPoolType type) { - switch (type) { - case BytecodeExpectationsPrinter::ConstantPoolType::kNumber: - return "number"; - case BytecodeExpectationsPrinter::ConstantPoolType::kMixed: - return "mixed"; - case BytecodeExpectationsPrinter::ConstantPoolType::kString: - return "string"; - default: - UNREACHABLE(); - return nullptr; - } -} - bool ParseBoolean(const char* string) { if (strcmp(string, "yes") == 0) { return true; @@ -161,15 +127,14 @@ bool CollectGoldenFiles(std::vector<std::string>* golden_file_list, DIR* directory = opendir(directory_path); if (!directory) return false; - dirent entry_buffer; - dirent* entry; - - while (readdir_r(directory, &entry_buffer, &entry) == 0 && entry) { + dirent* entry = readdir(directory); + while (entry) { if (StrEndsWith(entry->d_name, ".golden")) { std::string golden_filename(kGoldenFilesPath); golden_filename += entry->d_name; golden_file_list->push_back(golden_filename); } + entry = readdir(directory); } closedir(directory); @@ -188,16 +153,14 @@ ProgramOptions ProgramOptions::FromCommandLine(int argc, char** argv) { options.print_help_ = true; } else if (strcmp(argv[i], "--raw-js") == 0) { options.read_raw_js_snippet_ = true; - } else if (strncmp(argv[i], "--pool-type=", 12) == 0) { - options.const_pool_type_ = ParseConstantPoolType(argv[i] + 12); } else if (strcmp(argv[i], "--stdin") == 0) { options.read_from_stdin_ = true; } else if (strcmp(argv[i], "--rebaseline") == 0) { options.rebaseline_ = true; } else if (strcmp(argv[i], "--no-wrap") == 0) { options.wrap_ = false; - } else if (strcmp(argv[i], "--no-execute") == 0) { - options.execute_ = false; + } else if (strcmp(argv[i], "--module") == 0) { + options.module_ = true; } else if (strcmp(argv[i], "--top-level") == 0) { options.top_level_ = true; } else if (strcmp(argv[i], "--do-expressions") == 0) { @@ -239,12 +202,6 @@ bool ProgramOptions::Validate() const { if (parsing_failed_) return false; if (print_help_) return true; - if (const_pool_type_ == - BytecodeExpectationsPrinter::ConstantPoolType::kUnknown) { - REPORT_ERROR("Unknown constant pool type."); - return false; - } - if (!read_from_stdin_ && input_filenames_.empty()) { REPORT_ERROR("No input file specified."); return false; @@ -282,6 +239,12 @@ bool ProgramOptions::Validate() const { return false; } + if (module_ && (!top_level_ || wrap_)) { + REPORT_ERROR( + "The flag --module currently requires --top-level and --no-wrap."); + return false; + } + return true; } @@ -294,10 +257,8 @@ void ProgramOptions::UpdateFromHeader(std::istream& stream) { } while (std::getline(stream, line)) { - if (line.compare(0, 11, "pool type: ") == 0) { - const_pool_type_ = ParseConstantPoolType(line.c_str() + 11); - } else if (line.compare(0, 9, "execute: ") == 0) { - execute_ = ParseBoolean(line.c_str() + 9); + if (line.compare(0, 8, "module: ") == 0) { + module_ = ParseBoolean(line.c_str() + 8); } else if (line.compare(0, 6, "wrap: ") == 0) { wrap_ = ParseBoolean(line.c_str() + 6); } else if (line.compare(0, 20, "test function name: ") == 0) { @@ -319,15 +280,13 @@ void ProgramOptions::UpdateFromHeader(std::istream& stream) { void ProgramOptions::PrintHeader(std::ostream& stream) const { // NOLINT stream << "---" - "\npool type: " - << ConstantPoolTypeToString(const_pool_type_) - << "\nexecute: " << BooleanToString(execute_) << "\nwrap: " << BooleanToString(wrap_); if (!test_function_name_.empty()) { stream << "\ntest function name: " << test_function_name_; } + if (module_) stream << "\nmodule: yes"; if (top_level_) stream << "\ntop level: yes"; if (do_expressions_) stream << "\ndo expressions: yes"; @@ -425,10 +384,9 @@ void GenerateExpectationsFile(std::ostream& stream, // NOLINT v8::Local<v8::Context> context = v8::Context::New(platform.isolate()); v8::Context::Scope context_scope(context); - BytecodeExpectationsPrinter printer(platform.isolate(), - options.const_pool_type()); + BytecodeExpectationsPrinter printer(platform.isolate()); printer.set_wrap(options.wrap()); - printer.set_execute(options.execute()); + printer.set_module(options.module()); printer.set_top_level(options.top_level()); if (!options.test_function_name().empty()) { printer.set_test_function_name(options.test_function_name()); @@ -482,7 +440,7 @@ 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" - " --no-execute Do not execute after compilation.\n" + " --module Compile as JavaScript module.\n" " --test-function-name=foo " "Specify the name of the test function.\n" " --top-level Process top level code, not the top-level function.\n" @@ -494,9 +452,9 @@ void PrintUsage(const char* exec_path) { " Specify the type of the entries in the constant pool " "(default: mixed).\n" "\n" - "When using --rebaseline, flags --no-wrap, --no-execute, " - "--test-function-name\nand --pool-type will be overridden by the " - "options specified in the input file\nheader.\n\n" + "When using --rebaseline, flags --no-wrap, --test-function-name \n" + "and --pool-type will be overridden by the options specified in \n" + "the input file header.\n\n" "Each raw JavaScript file is interpreted as a single snippet.\n\n" "This tool is intended as a help in writing tests.\n" "Please, DO NOT blindly copy and paste the output " diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc index d82bad228b..fbcd297dd6 100644 --- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc +++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc @@ -6,7 +6,6 @@ #include "src/v8.h" -#include "src/compiler.h" #include "src/interpreter/bytecode-array-iterator.h" #include "src/interpreter/bytecode-generator.h" #include "src/interpreter/interpreter.h" @@ -57,12 +56,13 @@ namespace interpreter { #define REPEAT_64_UNIQUE_VARS() REPEAT_32_UNIQUE_VARS() REPEAT_32_UNIQUE_VARS() #define REPEAT_128_UNIQUE_VARS() REPEAT_64_UNIQUE_VARS() REPEAT_64_UNIQUE_VARS() -#define REPEAT_249_UNIQUE_VARS() \ +#define REPEAT_250_UNIQUE_VARS() \ REPEAT_128_UNIQUE_VARS() \ REPEAT_64_UNIQUE_VARS() \ REPEAT_32_UNIQUE_VARS() \ REPEAT_16_UNIQUE_VARS() \ REPEAT_8_UNIQUE_VARS() \ + UNIQUE_VAR() \ UNIQUE_VAR() static const char* kGoldenFileDirectory = @@ -72,7 +72,6 @@ class InitializedIgnitionHandleScope : public InitializedHandleScope { public: InitializedIgnitionHandleScope() { i::FLAG_ignition = true; - i::FLAG_ignition_osr = false; // TODO(4764): Disabled for now. i::FLAG_always_opt = false; i::FLAG_allow_natives_syntax = true; CcTest::i_isolate()->interpreter()->Initialize(); @@ -152,12 +151,9 @@ bool CompareTexts(const std::string& generated, const std::string& expected) { } while (true); } -using ConstantPoolType = BytecodeExpectationsPrinter::ConstantPoolType; - TEST(PrimitiveReturnStatements) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "", @@ -188,8 +184,7 @@ TEST(PrimitiveReturnStatements) { TEST(PrimitiveExpressions) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var x = 0; return x;\n", @@ -224,8 +219,7 @@ TEST(PrimitiveExpressions) { TEST(LogicalExpressions) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var x = 0; return x || 3;\n", @@ -268,8 +262,7 @@ TEST(LogicalExpressions) { TEST(Parameters) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -295,8 +288,7 @@ TEST(Parameters) { TEST(IntegerConstants) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "return 12345678;\n", @@ -311,8 +303,7 @@ TEST(IntegerConstants) { TEST(HeapNumberConstants) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "return 1.2;\n", @@ -331,8 +322,7 @@ TEST(HeapNumberConstants) { TEST(StringConstants) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "return \"This is a string\";\n", @@ -347,8 +337,7 @@ TEST(StringConstants) { TEST(PropertyLoads) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -391,8 +380,7 @@ TEST(PropertyLoads) { TEST(PropertyStores) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -457,8 +445,7 @@ TEST(PropertyStores) { TEST(PropertyCall) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -485,8 +472,7 @@ TEST(PropertyCall) { TEST(LoadGlobal) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -518,8 +504,7 @@ TEST(LoadGlobal) { TEST(StoreGlobal) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -563,8 +548,7 @@ TEST(StoreGlobal) { TEST(CallGlobal) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -584,8 +568,7 @@ TEST(CallGlobal) { TEST(CallRuntime) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -609,8 +592,7 @@ TEST(CallRuntime) { TEST(IfConditions) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -724,11 +706,9 @@ TEST(IfConditions) { TEST(DeclareGlobals) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); - printer.set_execute(false); printer.set_top_level(true); const char* snippets[] = { @@ -749,8 +729,7 @@ TEST(DeclareGlobals) { TEST(BreakableBlocks) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var x = 0;\n" @@ -796,8 +775,7 @@ TEST(BreakableBlocks) { TEST(BasicLoops) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var x = 0;\n" "while (false) { x = 99; break; continue; }\n" @@ -950,8 +928,7 @@ TEST(BasicLoops) { TEST(JumpsRequiringConstantWideOperands) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { REPEAT_256("var x = 0.1;\n") REPEAT_32("var x = 0.2;\n") @@ -970,8 +947,7 @@ TEST(JumpsRequiringConstantWideOperands) { TEST(UnaryOperators) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var x = 0;\n" "while (x != 10) {\n" @@ -1008,8 +984,7 @@ TEST(UnaryOperators) { TEST(Typeof) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1031,8 +1006,7 @@ TEST(Typeof) { TEST(Delete) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var a = {x:13, y:14}; return delete a.x;\n", @@ -1057,8 +1031,7 @@ TEST(Delete) { TEST(GlobalDelete) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1095,8 +1068,7 @@ TEST(GlobalDelete) { TEST(FunctionLiterals) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "return function(){ }\n", @@ -1112,8 +1084,7 @@ TEST(FunctionLiterals) { TEST(RegExpLiterals) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "return /ab+d/;\n", @@ -1129,8 +1100,7 @@ TEST(RegExpLiterals) { TEST(RegExpLiteralsWide) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var a;" // @@ -1144,8 +1114,7 @@ TEST(RegExpLiteralsWide) { TEST(ArrayLiterals) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "return [ 1, 2 ];\n", @@ -1163,8 +1132,7 @@ TEST(ArrayLiterals) { TEST(ArrayLiteralsWide) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var a;" // @@ -1178,8 +1146,7 @@ TEST(ArrayLiteralsWide) { TEST(ObjectLiterals) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "return { };\n", @@ -1219,8 +1186,7 @@ TEST(ObjectLiterals) { TEST(ObjectLiteralsWide) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var a;" // REPEAT_256("\na = 1.23;") // @@ -1233,11 +1199,9 @@ TEST(ObjectLiteralsWide) { TEST(TopLevelObjectLiterals) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); - printer.set_execute(false); printer.set_top_level(true); const char* snippets[] = { @@ -1250,8 +1214,7 @@ TEST(TopLevelObjectLiterals) { TEST(TryCatch) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "try { return 1; } catch(e) { return 2; }\n", @@ -1267,8 +1230,7 @@ TEST(TryCatch) { TEST(TryFinally) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var a = 1;\n" "try { a = 2; } finally { a = 3; }\n", @@ -1287,8 +1249,7 @@ TEST(TryFinally) { TEST(Throw) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "throw 1;\n", @@ -1303,8 +1264,7 @@ TEST(Throw) { TEST(CallNew) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1338,8 +1298,7 @@ TEST(ContextVariables) { STATIC_ASSERT(Context::MIN_CONTEXT_SLOTS + 3 + 249 == 256); InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var a; return function() { a = 1; };\n", @@ -1354,7 +1313,7 @@ TEST(ContextVariables) { "{ let b = 2; return function() { a + b; }; }\n", "'use strict';\n" - REPEAT_249_UNIQUE_VARS() + REPEAT_250_UNIQUE_VARS() "eval();\n" "var b = 100;\n" "return b\n", @@ -1366,8 +1325,7 @@ TEST(ContextVariables) { TEST(ContextParameters) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1387,8 +1345,7 @@ TEST(ContextParameters) { TEST(OuterContextVariables) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1418,8 +1375,7 @@ TEST(OuterContextVariables) { TEST(CountOperators) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var a = 1; return ++a;\n", @@ -1450,8 +1406,7 @@ TEST(CountOperators) { TEST(GlobalCountOperators) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1479,8 +1434,7 @@ TEST(GlobalCountOperators) { TEST(CompoundExpressions) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var a = 1; a += 2;\n", @@ -1499,8 +1453,7 @@ TEST(CompoundExpressions) { TEST(GlobalCompoundExpressions) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1520,8 +1473,7 @@ TEST(GlobalCompoundExpressions) { TEST(CreateArguments) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1545,8 +1497,7 @@ TEST(CreateArguments) { TEST(CreateRestParameter) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1566,8 +1517,7 @@ TEST(CreateRestParameter) { TEST(ForIn) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "for (var p in null) {}\n", @@ -1597,8 +1547,7 @@ TEST(ForIn) { TEST(ForOf) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "for (var p of [0, 1, 2]) {}\n", @@ -1620,8 +1569,7 @@ TEST(ForOf) { TEST(Conditional) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "return 1 ? 2 : 3;\n", @@ -1639,8 +1587,7 @@ TEST(Conditional) { TEST(Switch) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var a = 1;\n" "switch(a) {\n" @@ -1707,8 +1654,7 @@ TEST(Switch) { TEST(BasicBlockToBoolean) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var a = 1; if (a || a < 0) { return 1; }\n", @@ -1723,8 +1669,7 @@ TEST(BasicBlockToBoolean) { TEST(DeadCodeRemoval) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "return; var a = 1; a();\n", @@ -1741,8 +1686,7 @@ TEST(DeadCodeRemoval) { TEST(ThisFunction) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1760,8 +1704,7 @@ TEST(ThisFunction) { TEST(NewTarget) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "return new.target;\n", @@ -1775,8 +1718,7 @@ TEST(NewTarget) { TEST(RemoveRedundantLdar) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var ld_a = 1;\n" // This test is to check Ldar does not "while(true) {\n" // get removed if the preceding Star is @@ -1803,8 +1745,7 @@ TEST(RemoveRedundantLdar) { TEST(AssignmentsInBinaryExpression) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var x = 0, y = 1;\n" "return (x = 2, y = 3, x = 4, y = 5);\n", @@ -1844,8 +1785,7 @@ TEST(AssignmentsInBinaryExpression) { TEST(Eval) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "return eval('1;');\n", }; @@ -1856,16 +1796,32 @@ TEST(Eval) { TEST(LookupSlot) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); + printer.set_test_function_name("f"); + // clang-format off const char* snippets[] = { "eval('var x = 10;'); return x;\n", "eval('var x = 10;'); return typeof x;\n", "x = 20; return eval('');\n", + + "var x = 20;\n" + "f = function(){\n" + " eval('var x = 10');\n" + " return x;\n" + "}\n" + "f();\n", + + "x = 20;\n" + "f = function(){\n" + " eval('var x = 10');\n" + " return x;\n" + "}\n" + "f();\n" }; + // clang-format on CHECK(CompareTexts(BuildActual(printer, snippets), LoadGolden("LookupSlot.golden"))); @@ -1873,8 +1829,7 @@ TEST(LookupSlot) { TEST(CallLookupSlot) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "g = function(){}; eval(''); return g();\n", }; @@ -1887,8 +1842,7 @@ TEST(CallLookupSlot) { TEST(LookupSlotInEval) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1917,8 +1871,7 @@ TEST(LookupSlotInEval) { TEST(LookupSlotWideInEval) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1953,8 +1906,7 @@ TEST(LookupSlotWideInEval) { TEST(DeleteLookupSlotInEval) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -1990,8 +1942,7 @@ TEST(WideRegisters) { std::string prologue(os.str()); InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kNumber); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "x0 = x127;\n" "return x0;\n", @@ -2033,8 +1984,7 @@ TEST(WideRegisters) { TEST(ConstVariable) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "const x = 10;\n", @@ -2051,8 +2001,7 @@ TEST(ConstVariable) { TEST(LetVariable) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "let x = 10;\n", @@ -2071,8 +2020,7 @@ TEST(ConstVariableContextSlot) { // TODO(mythria): Add tests for initialization of this via super calls. // TODO(mythria): Add tests that walk the context chain. InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "const x = 10; function f1() {return x;}\n", @@ -2089,8 +2037,7 @@ TEST(ConstVariableContextSlot) { TEST(LetVariableContextSlot) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "let x = 10; function f1() {return x;}\n", @@ -2110,8 +2057,7 @@ TEST(DoExpression) { FLAG_harmony_do_expressions = true; InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "var a = do { }; return a;\n", @@ -2128,8 +2074,7 @@ TEST(DoExpression) { TEST(WithStatement) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "with ({x:42}) { return x; }\n", }; @@ -2140,8 +2085,7 @@ TEST(WithStatement) { TEST(DoDebugger) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kString); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "debugger;\n", }; @@ -2152,8 +2096,7 @@ TEST(DoDebugger) { TEST(ClassDeclarations) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); const char* snippets[] = { "class Person {\n" " constructor(name) { this.name = name; }\n" @@ -2183,8 +2126,7 @@ TEST(ClassDeclarations) { TEST(ClassAndSuperClass) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("test"); const char* snippets[] = { @@ -2242,8 +2184,7 @@ TEST(ClassAndSuperClass) { TEST(Generators) { InitializedIgnitionHandleScope scope; - BytecodeExpectationsPrinter printer(CcTest::isolate(), - ConstantPoolType::kMixed); + BytecodeExpectationsPrinter printer(CcTest::isolate()); printer.set_wrap(false); printer.set_test_function_name("f"); @@ -2262,6 +2203,47 @@ TEST(Generators) { LoadGolden("Generators.golden"))); } +TEST(Modules) { + InitializedIgnitionHandleScope scope; + BytecodeExpectationsPrinter printer(CcTest::isolate()); + printer.set_wrap(false); + printer.set_module(true); + printer.set_top_level(true); + + const char* snippets[] = { + "import \"bar\";\n", + + "import {foo} from \"bar\";\n", + + "import {foo as goo} from \"bar\";\n" + "goo(42);\n" + "{ let x; { goo(42) } };\n", + + "export var foo = 42;\n" + "foo++;\n" + "{ let x; { foo++ } };\n", + + "export let foo = 42;\n" + "foo++;\n" + "{ let x; { foo++ } };\n", + + "export const foo = 42;\n" + "foo++;\n" + "{ let x; { foo++ } };\n", + + "export default (function () {});\n", + + "export default (class {});\n", + + "export {foo as goo} from \"bar\"\n", + + "export * from \"bar\"\n", + }; + + CHECK(CompareTexts(BuildActual(printer, snippets), + LoadGolden("Modules.golden"))); +} + } // namespace interpreter } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc index 9591e2810e..3cb2beffd4 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter-intrinsics.cc @@ -26,8 +26,8 @@ class InvokeIntrinsicHelper { Handle<Object> Invoke(A... args) { CHECK(IntrinsicsHelper::IsSupported(function_id_)); BytecodeArrayBuilder builder(isolate_, zone_, sizeof...(args), 0, 0); - builder.CallRuntime(function_id_, builder.Parameter(0), sizeof...(args)) - .Return(); + RegisterList reg_list(builder.Parameter(0).index(), sizeof...(args)); + builder.CallRuntime(function_id_, reg_list).Return(); InterpreterTester tester(isolate_, builder.ToBytecodeArray(isolate_)); auto callable = tester.GetCallable<A...>(); return callable(args...).ToHandleChecked(); diff --git a/deps/v8/test/cctest/interpreter/test-interpreter.cc b/deps/v8/test/cctest/interpreter/test-interpreter.cc index 9572a2d731..77c146edaf 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <tuple> + #include "src/v8.h" #include "src/execution.h" @@ -267,7 +269,7 @@ TEST(InterpreterShiftOpsSmi) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = NewTypeFeedbackVector(isolate, &feedback_spec); @@ -306,7 +308,7 @@ TEST(InterpreterBinaryOpsSmi) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = NewTypeFeedbackVector(isolate, &feedback_spec); @@ -347,7 +349,7 @@ TEST(InterpreterBinaryOpsHeapNumber) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = NewTypeFeedbackVector(isolate, &feedback_spec); @@ -384,34 +386,42 @@ TEST(InterpreterStringAdd) { Handle<Object> lhs; Handle<Object> rhs; Handle<Object> expected_value; + int32_t expected_feedback; } test_cases[] = { {factory->NewStringFromStaticChars("a"), factory->NewStringFromStaticChars("b"), - factory->NewStringFromStaticChars("ab")}, + factory->NewStringFromStaticChars("ab"), + BinaryOperationFeedback::kString}, {factory->NewStringFromStaticChars("aaaaaa"), factory->NewStringFromStaticChars("b"), - factory->NewStringFromStaticChars("aaaaaab")}, + factory->NewStringFromStaticChars("aaaaaab"), + BinaryOperationFeedback::kString}, {factory->NewStringFromStaticChars("aaa"), factory->NewStringFromStaticChars("bbbbb"), - factory->NewStringFromStaticChars("aaabbbbb")}, + factory->NewStringFromStaticChars("aaabbbbb"), + BinaryOperationFeedback::kString}, {factory->NewStringFromStaticChars(""), factory->NewStringFromStaticChars("b"), - factory->NewStringFromStaticChars("b")}, + factory->NewStringFromStaticChars("b"), + BinaryOperationFeedback::kString}, {factory->NewStringFromStaticChars("a"), factory->NewStringFromStaticChars(""), - factory->NewStringFromStaticChars("a")}, + factory->NewStringFromStaticChars("a"), + BinaryOperationFeedback::kString}, {factory->NewStringFromStaticChars("1.11"), factory->NewHeapNumber(2.5), - factory->NewStringFromStaticChars("1.112.5")}, + factory->NewStringFromStaticChars("1.112.5"), + BinaryOperationFeedback::kAny}, {factory->NewStringFromStaticChars("-1.11"), factory->NewHeapNumber(2.56), - factory->NewStringFromStaticChars("-1.112.56")}, + factory->NewStringFromStaticChars("-1.112.56"), + BinaryOperationFeedback::kAny}, {factory->NewStringFromStaticChars(""), factory->NewHeapNumber(2.5), - factory->NewStringFromStaticChars("2.5")}, + factory->NewStringFromStaticChars("2.5"), BinaryOperationFeedback::kAny}, }; for (size_t i = 0; i < arraysize(test_cases); i++) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = NewTypeFeedbackVector(isolate, &feedback_spec); @@ -423,10 +433,15 @@ TEST(InterpreterStringAdd) { .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->SameValue(*test_cases[i].expected_value)); + + Object* feedback = vector->Get(slot); + CHECK(feedback->IsSmi()); + CHECK_EQ(test_cases[i].expected_feedback, + static_cast<Smi*>(feedback)->value()); } } @@ -461,13 +476,13 @@ TEST(InterpreterParameter8) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 8, 0, 0); FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot5 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot6 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot5 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot6 = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = NewTypeFeedbackVector(isolate, &feedback_spec); @@ -630,7 +645,7 @@ TEST(InterpreterBinaryOpTypeFeedback) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot0 = feedback_spec.AddGeneralSlot(); + i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = i::NewTypeFeedbackVector(isolate, &feedback_spec); @@ -734,7 +749,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot0 = feedback_spec.AddGeneralSlot(); + i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = i::NewTypeFeedbackVector(isolate, &feedback_spec); @@ -784,10 +799,10 @@ TEST(InterpreterUnaryOpFeedback) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 4, 0, 0); i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot0 = feedback_spec.AddGeneralSlot(); - i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); - i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); - i::FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); + i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = i::NewTypeFeedbackVector(isolate, &feedback_spec); @@ -848,9 +863,9 @@ TEST(InterpreterBitwiseTypeFeedback) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 4, 0, 0); i::FeedbackVectorSpec feedback_spec(&zone); - i::FeedbackVectorSlot slot0 = feedback_spec.AddGeneralSlot(); - i::FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); - i::FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); + i::FeedbackVectorSlot slot0 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + i::FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = i::NewTypeFeedbackVector(isolate, &feedback_spec); @@ -1234,12 +1249,13 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { // Check with no args. { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); - + Register reg = builder.register_allocator()->NewRegister(); + RegisterList args = builder.register_allocator()->NewRegisterList(1); builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) - .StoreAccumulatorInRegister(Register(0)); + .StoreAccumulatorInRegister(reg) + .MoveRegister(builder.Parameter(0), args[0]); - builder.Call(Register(0), builder.Parameter(0), 1, call_slot_index, - tail_call_mode); + builder.Call(reg, args, call_slot_index, tail_call_mode); builder.Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -1256,11 +1272,12 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { // Check that receiver is passed properly. { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); - + Register reg = builder.register_allocator()->NewRegister(); + RegisterList args = builder.register_allocator()->NewRegisterList(1); builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) - .StoreAccumulatorInRegister(Register(0)); - builder.Call(Register(0), builder.Parameter(0), 1, call_slot_index, - tail_call_mode); + .StoreAccumulatorInRegister(reg) + .MoveRegister(builder.Parameter(0), args[0]); + builder.Call(reg, args, call_slot_index, tail_call_mode); builder.Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -1279,17 +1296,19 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { // Check with two parameters (+ receiver). { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 4); + Register reg = builder.register_allocator()->NewRegister(); + RegisterList args = builder.register_allocator()->NewRegisterList(3); builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) - .StoreAccumulatorInRegister(Register(0)) + .StoreAccumulatorInRegister(reg) .LoadAccumulatorWithRegister(builder.Parameter(0)) - .StoreAccumulatorInRegister(Register(1)) + .StoreAccumulatorInRegister(args[0]) .LoadLiteral(Smi::FromInt(51)) - .StoreAccumulatorInRegister(Register(2)) + .StoreAccumulatorInRegister(args[1]) .LoadLiteral(Smi::FromInt(11)) - .StoreAccumulatorInRegister(Register(3)); + .StoreAccumulatorInRegister(args[2]); - builder.Call(Register(0), Register(1), 3, call_slot_index, tail_call_mode); + builder.Call(reg, args, call_slot_index, tail_call_mode); builder.Return(); @@ -1309,33 +1328,35 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { // Check with 10 parameters (+ receiver). { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 12); + Register reg = builder.register_allocator()->NewRegister(); + RegisterList args = builder.register_allocator()->NewRegisterList(11); builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) - .StoreAccumulatorInRegister(Register(0)) + .StoreAccumulatorInRegister(reg) .LoadAccumulatorWithRegister(builder.Parameter(0)) - .StoreAccumulatorInRegister(Register(1)) + .StoreAccumulatorInRegister(args[0]) .LoadLiteral(factory->NewStringFromAsciiChecked("a")) - .StoreAccumulatorInRegister(Register(2)) + .StoreAccumulatorInRegister(args[1]) .LoadLiteral(factory->NewStringFromAsciiChecked("b")) - .StoreAccumulatorInRegister(Register(3)) + .StoreAccumulatorInRegister(args[2]) .LoadLiteral(factory->NewStringFromAsciiChecked("c")) - .StoreAccumulatorInRegister(Register(4)) + .StoreAccumulatorInRegister(args[3]) .LoadLiteral(factory->NewStringFromAsciiChecked("d")) - .StoreAccumulatorInRegister(Register(5)) + .StoreAccumulatorInRegister(args[4]) .LoadLiteral(factory->NewStringFromAsciiChecked("e")) - .StoreAccumulatorInRegister(Register(6)) + .StoreAccumulatorInRegister(args[5]) .LoadLiteral(factory->NewStringFromAsciiChecked("f")) - .StoreAccumulatorInRegister(Register(7)) + .StoreAccumulatorInRegister(args[6]) .LoadLiteral(factory->NewStringFromAsciiChecked("g")) - .StoreAccumulatorInRegister(Register(8)) + .StoreAccumulatorInRegister(args[7]) .LoadLiteral(factory->NewStringFromAsciiChecked("h")) - .StoreAccumulatorInRegister(Register(9)) + .StoreAccumulatorInRegister(args[8]) .LoadLiteral(factory->NewStringFromAsciiChecked("i")) - .StoreAccumulatorInRegister(Register(10)) + .StoreAccumulatorInRegister(args[9]) .LoadLiteral(factory->NewStringFromAsciiChecked("j")) - .StoreAccumulatorInRegister(Register(11)); + .StoreAccumulatorInRegister(args[10]); - builder.Call(Register(0), Register(1), 11, call_slot_index, tail_call_mode); + builder.Call(reg, args, call_slot_index, tail_call_mode); builder.Return(); @@ -1390,9 +1411,9 @@ TEST(InterpreterJumps) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = NewTypeFeedbackVector(isolate, &feedback_spec); @@ -1408,7 +1429,7 @@ TEST(InterpreterJumps) { .Jump(&label[2]); SetRegister(builder, reg, 2048, scratch).Bind(&label[1]); IncrementRegister(builder, reg, 2, scratch, vector->GetIndex(slot1)) - .Jump(&label[0]); + .JumpLoop(&label[0], 0); SetRegister(builder, reg, 4096, scratch).Bind(&label[2]); IncrementRegister(builder, reg, 4, scratch, vector->GetIndex(slot2)) .LoadAccumulatorWithRegister(reg) @@ -1429,11 +1450,11 @@ TEST(InterpreterConditionalJumps) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = NewTypeFeedbackVector(isolate, &feedback_spec); @@ -1479,11 +1500,11 @@ TEST(InterpreterConditionalJumps2) { BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot1 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot2 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot3 = feedback_spec.AddGeneralSlot(); - FeedbackVectorSlot slot4 = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot1 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot2 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot3 = feedback_spec.AddInterpreterBinaryOpICSlot(); + FeedbackVectorSlot slot4 = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = NewTypeFeedbackVector(isolate, &feedback_spec); @@ -1529,7 +1550,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { Zone zone(isolate->allocator()); FeedbackVectorSpec feedback_spec(&zone); - FeedbackVectorSlot slot = feedback_spec.AddGeneralSlot(); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); Handle<i::TypeFeedbackVector> vector = NewTypeFeedbackVector(isolate, &feedback_spec); @@ -1671,22 +1692,32 @@ TEST(InterpreterSmiComparisons) { for (size_t j = 0; j < arraysize(inputs); j++) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); + Zone zone(isolate->allocator()); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + Register r0(0); builder.LoadLiteral(Smi::FromInt(inputs[i])) .StoreAccumulatorInRegister(r0) .LoadLiteral(Smi::FromInt(inputs[j])) - .CompareOperation(comparison, r0) + .CompareOperation(comparison, r0, vector->GetIndex(slot)) .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); CHECK_EQ(return_value->BooleanValue(), CompareC(comparison, inputs[i], inputs[j])); + Object* feedback = vector->Get(slot); + CHECK(feedback->IsSmi()); + CHECK_EQ(CompareOperationFeedback::kSignedSmall, + static_cast<Smi*>(feedback)->value()); } } } @@ -1708,22 +1739,32 @@ TEST(InterpreterHeapNumberComparisons) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); + Zone zone(isolate->allocator()); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + Register r0(0); builder.LoadLiteral(factory->NewHeapNumber(inputs[i])) .StoreAccumulatorInRegister(r0) .LoadLiteral(factory->NewHeapNumber(inputs[j])) - .CompareOperation(comparison, r0) + .CompareOperation(comparison, r0, vector->GetIndex(slot)) .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); CHECK_EQ(return_value->BooleanValue(), CompareC(comparison, inputs[i], inputs[j])); + Object* feedback = vector->Get(slot); + CHECK(feedback->IsSmi()); + CHECK_EQ(CompareOperationFeedback::kNumber, + static_cast<Smi*>(feedback)->value()); } } } @@ -1734,6 +1775,7 @@ TEST(InterpreterStringComparisons) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); + Zone zone(isolate->allocator()); std::string inputs[] = {"A", "abc", "z", "", "Foo!", "Foo"}; @@ -1744,21 +1786,31 @@ TEST(InterpreterStringComparisons) { CanonicalHandleScope canonical(isolate); const char* lhs = inputs[i].c_str(); const char* rhs = inputs[j].c_str(); + + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); + BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); Register r0(0); builder.LoadLiteral(factory->NewStringFromAsciiChecked(lhs)) .StoreAccumulatorInRegister(r0) .LoadLiteral(factory->NewStringFromAsciiChecked(rhs)) - .CompareOperation(comparison, r0) + .CompareOperation(comparison, r0, vector->GetIndex(slot)) .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); CHECK_EQ(return_value->BooleanValue(), CompareC(comparison, inputs[i], inputs[j])); + Object* feedback = vector->Get(slot); + CHECK(feedback->IsSmi()); + CHECK_EQ(CompareOperationFeedback::kAny, + static_cast<Smi*>(feedback)->value()); } } } @@ -1789,6 +1841,12 @@ TEST(InterpreterMixedComparisons) { Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); + Zone zone(isolate->allocator()); + + FeedbackVectorSpec feedback_spec(&zone); + FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); + Handle<i::TypeFeedbackVector> vector = + NewTypeFeedbackVector(isolate, &feedback_spec); Register r0(0); if (pass == 0) { @@ -1796,25 +1854,29 @@ TEST(InterpreterMixedComparisons) { builder.LoadLiteral(factory->NewNumber(lhs)) .StoreAccumulatorInRegister(r0) .LoadLiteral(factory->NewStringFromAsciiChecked(rhs_cstr)) - .CompareOperation(comparison, r0) + .CompareOperation(comparison, r0, vector->GetIndex(slot)) .Return(); } else { // Comparison with HeapNumber on the rhs and String on the lhs builder.LoadLiteral(factory->NewStringFromAsciiChecked(lhs_cstr)) .StoreAccumulatorInRegister(r0) .LoadLiteral(factory->NewNumber(rhs)) - .CompareOperation(comparison, r0) + .CompareOperation(comparison, r0, vector->GetIndex(slot)) .Return(); } Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); - InterpreterTester tester(isolate, bytecode_array); + InterpreterTester tester(isolate, bytecode_array, vector); auto callable = tester.GetCallable<>(); Handle<Object> return_value = callable().ToHandleChecked(); CHECK(return_value->IsBoolean()); CHECK_EQ(return_value->BooleanValue(), CompareC(comparison, lhs, rhs, true)); + Object* feedback = vector->Get(slot); + CHECK(feedback->IsSmi()); + CHECK_EQ(CompareOperationFeedback::kAny, + static_cast<Smi*>(feedback)->value()); } } } @@ -1910,7 +1972,7 @@ TEST(InterpreterInstanceOf) { builder.LoadLiteral(cases[i]); builder.StoreAccumulatorInRegister(r0) .LoadLiteral(func) - .CompareOperation(Token::Value::INSTANCEOF, r0) + .CompareOperation(Token::Value::INSTANCEOF, r0, 0) .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -1940,7 +2002,7 @@ TEST(InterpreterTestIn) { builder.LoadLiteral(factory->NewStringFromAsciiChecked(properties[i])) .StoreAccumulatorInRegister(r0) .LoadLiteral(Handle<Object>::cast(array)) - .CompareOperation(Token::Value::IN, r0) + .CompareOperation(Token::Value::IN, r0, 0) .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -2069,12 +2131,13 @@ TEST(InterpreterCallRuntime) { Isolate* isolate = handles.main_isolate(); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 2); + RegisterList args = builder.register_allocator()->NewRegisterList(2); builder.LoadLiteral(Smi::FromInt(15)) - .StoreAccumulatorInRegister(Register(0)) + .StoreAccumulatorInRegister(args[0]) .LoadLiteral(Smi::FromInt(40)) - .StoreAccumulatorInRegister(Register(1)) - .CallRuntime(Runtime::kAdd, Register(0), 2) + .StoreAccumulatorInRegister(args[1]) + .CallRuntime(Runtime::kAdd, args) .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -2093,7 +2156,7 @@ TEST(InterpreterInvokeIntrinsic) { builder.LoadLiteral(Smi::FromInt(15)) .StoreAccumulatorInRegister(Register(0)) - .CallRuntime(Runtime::kInlineIsArray, Register(0), 1) + .CallRuntime(Runtime::kInlineIsArray, Register(0)) .Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -3821,6 +3884,88 @@ TEST(InterpreterLookupSlot) { } } +TEST(InterpreterLookupContextSlot) { + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + + const char* inner_function_prologue = "function inner() {"; + const char* inner_function_epilogue = "};"; + const char* outer_function_epilogue = "return inner();"; + + std::tuple<const char*, const char*, Handle<Object>> lookup_slot[] = { + // Eval in inner context. + std::make_tuple("var x = 0;", "eval(''); return x;", + handle(Smi::FromInt(0), isolate)), + std::make_tuple("var x = 0;", "eval('var x = 1'); return x;", + handle(Smi::FromInt(1), isolate)), + std::make_tuple("var x = 0;", + "'use strict'; eval('var x = 1'); return x;", + handle(Smi::FromInt(0), isolate)), + // Eval in outer context. + std::make_tuple("var x = 0; eval('');", "return x;", + handle(Smi::FromInt(0), isolate)), + std::make_tuple("var x = 0; eval('var x = 1');", "return x;", + handle(Smi::FromInt(1), isolate)), + std::make_tuple("'use strict'; var x = 0; eval('var x = 1');", + "return x;", handle(Smi::FromInt(0), isolate)), + }; + + for (size_t i = 0; i < arraysize(lookup_slot); i++) { + std::string body = std::string(std::get<0>(lookup_slot[i])) + + std::string(inner_function_prologue) + + std::string(std::get<1>(lookup_slot[i])) + + std::string(inner_function_epilogue) + + std::string(outer_function_epilogue); + std::string script = InterpreterTester::SourceForBody(body.c_str()); + + InterpreterTester tester(isolate, script.c_str()); + auto callable = tester.GetCallable<>(); + + Handle<i::Object> return_value = callable().ToHandleChecked(); + CHECK(return_value->SameValue(*std::get<2>(lookup_slot[i]))); + } +} + +TEST(InterpreterLookupGlobalSlot) { + HandleAndZoneScope handles; + Isolate* isolate = handles.main_isolate(); + + const char* inner_function_prologue = "function inner() {"; + const char* inner_function_epilogue = "};"; + const char* outer_function_epilogue = "return inner();"; + + std::tuple<const char*, const char*, Handle<Object>> lookup_slot[] = { + // Eval in inner context. + std::make_tuple("x = 0;", "eval(''); return x;", + handle(Smi::FromInt(0), isolate)), + std::make_tuple("x = 0;", "eval('var x = 1'); return x;", + handle(Smi::FromInt(1), isolate)), + std::make_tuple("x = 0;", "'use strict'; eval('var x = 1'); return x;", + handle(Smi::FromInt(0), isolate)), + // Eval in outer context. + std::make_tuple("x = 0; eval('');", "return x;", + handle(Smi::FromInt(0), isolate)), + std::make_tuple("x = 0; eval('var x = 1');", "return x;", + handle(Smi::FromInt(1), isolate)), + std::make_tuple("'use strict'; x = 0; eval('var x = 1');", "return x;", + handle(Smi::FromInt(0), isolate)), + }; + + for (size_t i = 0; i < arraysize(lookup_slot); i++) { + std::string body = std::string(std::get<0>(lookup_slot[i])) + + std::string(inner_function_prologue) + + std::string(std::get<1>(lookup_slot[i])) + + std::string(inner_function_epilogue) + + std::string(outer_function_epilogue); + std::string script = InterpreterTester::SourceForBody(body.c_str()); + + InterpreterTester tester(isolate, script.c_str()); + auto callable = tester.GetCallable<>(); + + Handle<i::Object> return_value = callable().ToHandleChecked(); + CHECK(return_value->SameValue(*std::get<2>(lookup_slot[i]))); + } +} TEST(InterpreterCallLookupSlot) { HandleAndZoneScope handles; diff --git a/deps/v8/test/cctest/interpreter/test-source-positions.cc b/deps/v8/test/cctest/interpreter/test-source-positions.cc index 3161f92db9..2b7f5c368a 100644 --- a/deps/v8/test/cctest/interpreter/test-source-positions.cc +++ b/deps/v8/test/cctest/interpreter/test-source-positions.cc @@ -9,7 +9,6 @@ #include "src/interpreter/bytecode-generator.h" #include "src/interpreter/interpreter.h" #include "src/isolate.h" -#include "src/parsing/parser.h" #include "test/cctest/cctest.h" #include "test/cctest/interpreter/source-position-matcher.h" diff --git a/deps/v8/test/cctest/libplatform/test-tracing.cc b/deps/v8/test/cctest/libplatform/test-tracing.cc index 2e15d6af9e..66fa0e05a5 100644 --- a/deps/v8/test/cctest/libplatform/test-tracing.cc +++ b/deps/v8/test/cctest/libplatform/test-tracing.cc @@ -35,7 +35,8 @@ TEST(TestTraceObject) { TraceObject trace_object; uint8_t category_enabled_flag = 41; trace_object.Initialize('X', &category_enabled_flag, "Test.Trace", - "Test.Scope", 42, 123, 0, NULL, NULL, NULL, 0); + "Test.Scope", 42, 123, 0, nullptr, nullptr, nullptr, + nullptr, 0); CHECK_EQ('X', trace_object.phase()); CHECK_EQ(category_enabled_flag, *trace_object.category_enabled_flag()); CHECK_EQ(std::string("Test.Trace"), std::string(trace_object.name())); @@ -44,6 +45,19 @@ TEST(TestTraceObject) { CHECK_EQ(0, trace_object.cpu_duration()); } +class ConvertableToTraceFormatMock : public v8::ConvertableToTraceFormat { + public: + explicit ConvertableToTraceFormatMock(int value) : value_(value) {} + void AppendAsTraceFormat(std::string* out) const override { + *out += "[" + std::to_string(value_) + "," + std::to_string(value_) + "]"; + } + + private: + int value_; + + DISALLOW_COPY_AND_ASSIGN(ConvertableToTraceFormatMock); +}; + class MockTraceWriter : public TraceWriter { public: void AppendTraceEvent(TraceObject* trace_event) override { @@ -75,7 +89,8 @@ TEST(TestTraceBufferRingBuffer) { TraceObject* trace_object = ring_buffer->AddTraceEvent(&handles[i]); CHECK_NOT_NULL(trace_object); trace_object->Initialize('X', &category_enabled_flag, names[i].c_str(), - "Test.Scope", 42, 123, 0, NULL, NULL, NULL, 0); + "Test.Scope", 42, 123, 0, nullptr, nullptr, + nullptr, nullptr, 0); trace_object = ring_buffer->GetEventByHandle(handles[i]); CHECK_NOT_NULL(trace_object); CHECK_EQ('X', trace_object->phase()); @@ -128,13 +143,13 @@ TEST(TestJSONTraceWriter) { TraceObject trace_object; trace_object.InitializeForTesting( 'X', tracing_controller.GetCategoryGroupEnabled("v8-cat"), "Test0", - v8::internal::tracing::kGlobalScope, 42, 123, 0, NULL, NULL, NULL, - TRACE_EVENT_FLAG_HAS_ID, 11, 22, 100, 50, 33, 44); + v8::internal::tracing::kGlobalScope, 42, 123, 0, nullptr, nullptr, + nullptr, nullptr, TRACE_EVENT_FLAG_HAS_ID, 11, 22, 100, 50, 33, 44); writer->AppendTraceEvent(&trace_object); trace_object.InitializeForTesting( 'Y', tracing_controller.GetCategoryGroupEnabled("v8-cat"), "Test1", - v8::internal::tracing::kGlobalScope, 43, 456, 0, NULL, NULL, NULL, 0, - 55, 66, 110, 55, 77, 88); + v8::internal::tracing::kGlobalScope, 43, 456, 0, nullptr, nullptr, + nullptr, nullptr, 0, 55, 66, 110, 55, 77, 88); writer->AppendTraceEvent(&trace_object); tracing_controller.StopTracing(); } @@ -264,6 +279,14 @@ TEST(TestTracingControllerMultipleArgsAndCopy) { mm = "CHANGED"; mmm = "CHANGED"; + TRACE_EVENT_INSTANT1("v8", "v8.Test", TRACE_EVENT_SCOPE_THREAD, "a1", + new ConvertableToTraceFormatMock(42)); + std::unique_ptr<ConvertableToTraceFormatMock> trace_event_arg( + new ConvertableToTraceFormatMock(42)); + TRACE_EVENT_INSTANT2("v8", "v8.Test", TRACE_EVENT_SCOPE_THREAD, "a1", + std::move(trace_event_arg), "a2", + new ConvertableToTraceFormatMock(123)); + tracing_controller.StopTracing(); } @@ -274,7 +297,7 @@ TEST(TestTracingControllerMultipleArgsAndCopy) { GetJSONStrings(all_names, trace_str, "\"name\"", "\"", "\""); GetJSONStrings(all_cats, trace_str, "\"cat\"", "\"", "\""); - CHECK_EQ(all_args.size(), 22); + CHECK_EQ(all_args.size(), 24); CHECK_EQ(all_args[0], "\"aa\":11"); CHECK_EQ(all_args[1], "\"bb\":22"); CHECK_EQ(all_args[2], "\"cc\":33"); @@ -303,6 +326,81 @@ TEST(TestTracingControllerMultipleArgsAndCopy) { CHECK_EQ(all_names[20], "INIT"); CHECK_EQ(all_names[21], "INIT"); CHECK_EQ(all_args[21], "\"mm1\":\"INIT\",\"mm2\":\"\\\"INIT\\\"\""); + CHECK_EQ(all_args[22], "\"a1\":[42,42]"); + CHECK_EQ(all_args[23], "\"a1\":[42,42],\"a2\":[123,123]"); + + i::V8::SetPlatformForTesting(old_platform); +} + +namespace { + +class TraceStateObserverImpl : public Platform::TraceStateObserver { + public: + void OnTraceEnabled() override { ++enabled_count; } + void OnTraceDisabled() override { ++disabled_count; } + + int enabled_count = 0; + int disabled_count = 0; +}; + +} // namespace + +TEST(TracingObservers) { + v8::Platform* old_platform = i::V8::GetCurrentPlatform(); + v8::Platform* default_platform = v8::platform::CreateDefaultPlatform(); + i::V8::SetPlatformForTesting(default_platform); + + v8::platform::tracing::TracingController tracing_controller; + v8::platform::SetTracingController(default_platform, &tracing_controller); + MockTraceWriter* writer = new MockTraceWriter(); + v8::platform::tracing::TraceBuffer* ring_buffer = + v8::platform::tracing::TraceBuffer::CreateTraceBufferRingBuffer(1, + writer); + tracing_controller.Initialize(ring_buffer); + v8::platform::tracing::TraceConfig* trace_config = + new v8::platform::tracing::TraceConfig(); + trace_config->AddIncludedCategory("v8"); + + TraceStateObserverImpl observer; + default_platform->AddTraceStateObserver(&observer); + + CHECK_EQ(0, observer.enabled_count); + CHECK_EQ(0, observer.disabled_count); + + tracing_controller.StartTracing(trace_config); + + CHECK_EQ(1, observer.enabled_count); + CHECK_EQ(0, observer.disabled_count); + + TraceStateObserverImpl observer2; + default_platform->AddTraceStateObserver(&observer2); + + CHECK_EQ(1, observer2.enabled_count); + CHECK_EQ(0, observer2.disabled_count); + + default_platform->RemoveTraceStateObserver(&observer2); + + CHECK_EQ(1, observer2.enabled_count); + CHECK_EQ(0, observer2.disabled_count); + + tracing_controller.StopTracing(); + + CHECK_EQ(1, observer.enabled_count); + CHECK_EQ(1, observer.disabled_count); + CHECK_EQ(1, observer2.enabled_count); + CHECK_EQ(0, observer2.disabled_count); + + default_platform->RemoveTraceStateObserver(&observer); + + CHECK_EQ(1, observer.enabled_count); + CHECK_EQ(1, observer.disabled_count); + + trace_config = new v8::platform::tracing::TraceConfig(); + tracing_controller.StartTracing(trace_config); + tracing_controller.StopTracing(); + + CHECK_EQ(1, observer.enabled_count); + CHECK_EQ(1, observer.disabled_count); i::V8::SetPlatformForTesting(old_platform); } diff --git a/deps/v8/test/cctest/libsampler/test-sampler.cc b/deps/v8/test/cctest/libsampler/test-sampler.cc index b88d347914..2ec3b870df 100644 --- a/deps/v8/test/cctest/libsampler/test-sampler.cc +++ b/deps/v8/test/cctest/libsampler/test-sampler.cc @@ -6,6 +6,7 @@ #include "src/libsampler/sampler.h" #include "src/base/platform/platform.h" +#include "src/base/platform/time.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/parsing/test-scanner-streams.cc b/deps/v8/test/cctest/parsing/test-scanner-streams.cc new file mode 100644 index 0000000000..fffd1200f2 --- /dev/null +++ b/deps/v8/test/cctest/parsing/test-scanner-streams.cc @@ -0,0 +1,448 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/factory.h" // for i::Factory::NewExternalStringFrom*Byte +#include "src/objects-inl.h" +#include "src/parsing/scanner-character-streams.h" +#include "src/parsing/scanner.h" +#include "src/type-feedback-vector-inl.h" // for include "src/factory.h" +#include "test/cctest/cctest.h" + +namespace { + +// Implement ExternalSourceStream based on const char**. +// This will take each string as one chunk. The last chunk must be empty. +class ChunkSource : public v8::ScriptCompiler::ExternalSourceStream { + public: + explicit ChunkSource(const char** chunks) : current_(0) { + do { + chunks_.push_back( + {reinterpret_cast<const uint8_t*>(*chunks), strlen(*chunks)}); + chunks++; + } while (chunks_.back().len > 0); + } + ChunkSource(const uint8_t* data, size_t len, bool extra_chunky) + : current_(0) { + // If extra_chunky, we'll use increasingly large chunk sizes. + // If not, we'll have a single chunk of full length. + size_t chunk_size = extra_chunky ? 1 : len; + for (size_t i = 0; i < len; i += chunk_size, chunk_size *= 2) { + chunks_.push_back({data + i, i::Min(chunk_size, len - i)}); + } + chunks_.push_back({nullptr, 0}); + } + ~ChunkSource() {} + bool SetBookmark() override { return false; } + void ResetToBookmark() override {} + size_t GetMoreData(const uint8_t** src) override { + DCHECK_LT(current_, chunks_.size()); + Chunk& next = chunks_[current_++]; + uint8_t* chunk = new uint8_t[next.len]; + i::MemMove(chunk, next.ptr, next.len); + *src = chunk; + return next.len; + } + + private: + struct Chunk { + const uint8_t* ptr; + size_t len; + }; + std::vector<Chunk> chunks_; + size_t current_; +}; + +class TestExternalResource : public v8::String::ExternalStringResource { + public: + explicit TestExternalResource(uint16_t* data, int length) + : data_(data), length_(static_cast<size_t>(length)) {} + + ~TestExternalResource() {} + + const uint16_t* data() const { return data_; } + size_t length() const { return length_; } + + private: + uint16_t* data_; + size_t length_; +}; + +class TestExternalOneByteResource + : public v8::String::ExternalOneByteStringResource { + public: + TestExternalOneByteResource(const char* data, size_t length) + : data_(data), length_(length) {} + + const char* data() const { return data_; } + size_t length() const { return length_; } + + private: + const char* data_; + size_t length_; +}; + +// A test string with all lengths of utf-8 encodings. +const char unicode_utf8[] = + "abc" // 3x ascii + "\xc3\xa4" // a Umlaut, code point 228 + "\xe2\xa8\xa0" // >> (math symbol), code point 10784 + "\xf0\x9f\x92\xa9" // best character, code point 128169, + // as utf-16 surrogates: 55357 56489 + "def"; // 3x ascii again. +const uint16_t unicode_ucs2[] = {97, 98, 99, 228, 10784, 55357, + 56489, 100, 101, 102, 0}; + +} // anonymous namespace + +TEST(Utf8StreamAsciiOnly) { + const char* chunks[] = {"abc", "def", "ghi", ""}; + ChunkSource chunk_source(chunks); + std::unique_ptr<v8::internal::Utf16CharacterStream> stream( + v8::internal::ScannerStream::For( + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); + + // Read the data without dying. + v8::internal::uc32 c; + do { + c = stream->Advance(); + } while (c != v8::internal::Utf16CharacterStream::kEndOfInput); +} + +TEST(Utf8StreamBOM) { + // Construct test string w/ UTF-8 BOM (byte order mark) + char data[3 + arraysize(unicode_utf8)] = {"\xef\xbb\xbf"}; + strncpy(data + 3, unicode_utf8, arraysize(unicode_utf8)); + + 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)); + + // Read the data without tripping over the BOM. + for (size_t i = 0; unicode_ucs2[i]; i++) { + CHECK_EQ(unicode_ucs2[i], stream->Advance()); + } + CHECK_EQ(v8::internal::Utf16CharacterStream::kEndOfInput, stream->Advance()); + + // Make sure seek works. + stream->Seek(0); + CHECK_EQ(unicode_ucs2[0], stream->Advance()); + + stream->Seek(5); + CHECK_EQ(unicode_ucs2[5], stream->Advance()); +} + +TEST(Utf8SplitBOM) { + // Construct chunks with a BOM split into two chunks. + char partial_bom[] = "\xef\xbb"; + char data[1 + arraysize(unicode_utf8)] = {"\xbf"}; + strncpy(data + 1, unicode_utf8, arraysize(unicode_utf8)); + + { + const char* chunks[] = {partial_bom, data, "\0"}; + ChunkSource chunk_source(chunks); + std::unique_ptr<v8::internal::Utf16CharacterStream> stream( + v8::internal::ScannerStream::For( + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); + + // Read the data without tripping over the BOM. + for (size_t i = 0; unicode_ucs2[i]; i++) { + CHECK_EQ(unicode_ucs2[i], stream->Advance()); + } + } + + // And now with single-byte BOM chunks. + char bom_byte_1[] = "\xef"; + char bom_byte_2[] = "\xbb"; + { + const char* chunks[] = {bom_byte_1, bom_byte_2, data, "\0"}; + ChunkSource chunk_source(chunks); + std::unique_ptr<v8::internal::Utf16CharacterStream> stream( + v8::internal::ScannerStream::For( + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); + + // Read the data without tripping over the BOM. + for (size_t i = 0; unicode_ucs2[i]; i++) { + CHECK_EQ(unicode_ucs2[i], stream->Advance()); + } + } +} + +TEST(Utf8ChunkBoundaries) { + // Test utf-8 parsing at 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) + 3]; + 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] = '\0'; + buffer[len + 2] = '\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)); + + for (size_t i = 0; unicode_ucs2[i]; i++) { + CHECK_EQ(unicode_ucs2[i], stream->Advance()); + } + CHECK_EQ(v8::internal::Utf16CharacterStream::kEndOfInput, + stream->Advance()); + } +} + +TEST(Utf8SingleByteChunks) { + // Have each byte as a single-byte chunk. + size_t len = strlen(unicode_utf8); + char buffer[arraysize(unicode_utf8) + 4]; + for (size_t i = 1; i < len - 1; i++) { + // Copy source string into buffer, make a single-byte chunk at i. + strncpy(buffer, unicode_utf8, i); + strncpy(buffer + i + 3, unicode_utf8 + i + 1, len - i - 1); + buffer[i] = '\0'; + buffer[i + 1] = unicode_utf8[i]; + buffer[i + 2] = '\0'; + buffer[len + 2] = '\0'; + buffer[len + 3] = '\0'; + const char* chunks[] = {buffer, buffer + i + 1, buffer + i + 3, + buffer + len + 3}; + + ChunkSource chunk_source(chunks); + std::unique_ptr<v8::internal::Utf16CharacterStream> stream( + v8::internal::ScannerStream::For( + &chunk_source, v8::ScriptCompiler::StreamedSource::UTF8)); + + for (size_t j = 0; unicode_ucs2[j]; j++) { + CHECK_EQ(unicode_ucs2[j], stream->Advance()); + } + CHECK_EQ(v8::internal::Utf16CharacterStream::kEndOfInput, + stream->Advance()); + } +} + +#define CHECK_EQU(v1, v2) CHECK_EQ(static_cast<int>(v1), static_cast<int>(v2)) + +void TestCharacterStream(const char* reference, i::Utf16CharacterStream* stream, + unsigned length, unsigned start, unsigned end) { + // Read streams one char at a time + unsigned i; + for (i = start; i < end; i++) { + CHECK_EQU(i, stream->pos()); + CHECK_EQU(reference[i], stream->Advance()); + } + CHECK_EQU(end, stream->pos()); + + // Pushback, re-read, pushback again. + while (i > end / 4) { + int32_t c0 = reference[i - 1]; + CHECK_EQU(i, stream->pos()); + stream->Back(); + i--; + CHECK_EQU(i, stream->pos()); + int32_t c1 = stream->Advance(); + i++; + CHECK_EQU(i, stream->pos()); + CHECK_EQ(c0, c1); + stream->Back(); + i--; + CHECK_EQU(i, stream->pos()); + } + + // Seek + read streams one char at a time. + unsigned halfway = end / 2; + stream->Seek(stream->pos() + halfway - i); + for (i = halfway; i < end; i++) { + CHECK_EQU(i, stream->pos()); + CHECK_EQU(reference[i], stream->Advance()); + } + CHECK_EQU(i, stream->pos()); + CHECK_LT(stream->Advance(), 0); + + // Seek back, then seek beyond end of stream. + stream->Seek(start); + if (start < length) { + CHECK_EQU(stream->Advance(), reference[start]); + } else { + CHECK_LT(stream->Advance(), 0); + } + stream->Seek(length + 5); + CHECK_LT(stream->Advance(), 0); +} + +#undef CHECK_EQU + +void TestCharacterStreams(const char* one_byte_source, unsigned length, + unsigned start = 0, unsigned end = 0) { + if (end == 0) end = length; + + i::Isolate* isolate = CcTest::i_isolate(); + i::Factory* factory = isolate->factory(); + + // 2-byte external string + std::unique_ptr<i::uc16[]> uc16_buffer(new i::uc16[length]); + i::Vector<const i::uc16> two_byte_vector(uc16_buffer.get(), + static_cast<int>(length)); + { + for (unsigned i = 0; i < length; i++) { + uc16_buffer[i] = static_cast<i::uc16>(one_byte_source[i]); + } + TestExternalResource resource(uc16_buffer.get(), length); + i::Handle<i::String> uc16_string( + factory->NewExternalStringFromTwoByte(&resource).ToHandleChecked()); + std::unique_ptr<i::Utf16CharacterStream> uc16_stream( + i::ScannerStream::For(uc16_string, start, end)); + TestCharacterStream(one_byte_source, uc16_stream.get(), length, start, end); + } + + // 1-byte external string + i::Vector<const char> one_byte_vector(one_byte_source, + static_cast<int>(length)); + i::Handle<i::String> one_byte_string = + factory->NewStringFromAscii(one_byte_vector).ToHandleChecked(); + { + TestExternalOneByteResource one_byte_resource(one_byte_source, length); + i::Handle<i::String> ext_one_byte_string( + factory->NewExternalStringFromOneByte(&one_byte_resource) + .ToHandleChecked()); + std::unique_ptr<i::Utf16CharacterStream> one_byte_stream( + i::ScannerStream::For(ext_one_byte_string, start, end)); + TestCharacterStream(one_byte_source, one_byte_stream.get(), length, start, + end); + } + + // 1-byte generic i::String + { + std::unique_ptr<i::Utf16CharacterStream> string_stream( + i::ScannerStream::For(one_byte_string, start, end)); + TestCharacterStream(one_byte_source, string_stream.get(), length, start, + end); + } + + // 2-byte generic i::String + { + i::Handle<i::String> two_byte_string = + factory->NewStringFromTwoByte(two_byte_vector).ToHandleChecked(); + std::unique_ptr<i::Utf16CharacterStream> two_byte_string_stream( + i::ScannerStream::For(two_byte_string, start, end)); + TestCharacterStream(one_byte_source, two_byte_string_stream.get(), length, + start, end); + } + + // Streaming has no notion of start/end, so let's skip streaming tests for + // these cases. + if (start != 0 || end != length) return; + + // 1-byte streaming stream, single + many chunks. + { + const uint8_t* data = + reinterpret_cast<const uint8_t*>(one_byte_vector.begin()); + const uint8_t* data_end = + reinterpret_cast<const uint8_t*>(one_byte_vector.end()); + + ChunkSource single_chunk(data, data_end - data, false); + std::unique_ptr<i::Utf16CharacterStream> one_byte_streaming_stream( + i::ScannerStream::For(&single_chunk, + v8::ScriptCompiler::StreamedSource::ONE_BYTE)); + TestCharacterStream(one_byte_source, one_byte_streaming_stream.get(), + length, start, end); + + ChunkSource many_chunks(data, data_end - data, true); + one_byte_streaming_stream.reset(i::ScannerStream::For( + &many_chunks, v8::ScriptCompiler::StreamedSource::ONE_BYTE)); + TestCharacterStream(one_byte_source, one_byte_streaming_stream.get(), + length, start, end); + } + + // UTF-8 streaming stream, single + many chunks. + { + const uint8_t* data = + reinterpret_cast<const uint8_t*>(one_byte_vector.begin()); + const uint8_t* data_end = + reinterpret_cast<const uint8_t*>(one_byte_vector.end()); + ChunkSource chunks(data, data_end - data, false); + std::unique_ptr<i::Utf16CharacterStream> utf8_streaming_stream( + i::ScannerStream::For(&chunks, + v8::ScriptCompiler::StreamedSource::UTF8)); + TestCharacterStream(one_byte_source, utf8_streaming_stream.get(), length, + start, end); + + ChunkSource many_chunks(data, data_end - data, true); + utf8_streaming_stream.reset(i::ScannerStream::For( + &many_chunks, v8::ScriptCompiler::StreamedSource::UTF8)); + TestCharacterStream(one_byte_source, utf8_streaming_stream.get(), length, + start, end); + } + + // 2-byte streaming stream, single + many chunks. + { + const uint8_t* data = + reinterpret_cast<const uint8_t*>(two_byte_vector.begin()); + const uint8_t* data_end = + reinterpret_cast<const uint8_t*>(two_byte_vector.end()); + ChunkSource chunks(data, data_end - data, false); + std::unique_ptr<i::Utf16CharacterStream> two_byte_streaming_stream( + i::ScannerStream::For(&chunks, + v8::ScriptCompiler::StreamedSource::TWO_BYTE)); + TestCharacterStream(one_byte_source, two_byte_streaming_stream.get(), + length, start, end); + + ChunkSource many_chunks(data, data_end - data, true); + two_byte_streaming_stream.reset(i::ScannerStream::For( + &many_chunks, v8::ScriptCompiler::StreamedSource::TWO_BYTE)); + TestCharacterStream(one_byte_source, two_byte_streaming_stream.get(), + length, start, end); + } +} + +TEST(CharacterStreams) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope handles(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + + TestCharacterStreams("abcdefghi", 9); + TestCharacterStreams("abc\0\n\r\x7f", 7); + TestCharacterStreams("\0", 1); + TestCharacterStreams("", 0); + + // 4k large buffer. + char buffer[4096 + 1]; + for (unsigned i = 0; i < arraysize(buffer); i++) { + buffer[i] = static_cast<char>(i & 0x7F); + } + buffer[arraysize(buffer) - 1] = '\0'; + TestCharacterStreams(buffer, arraysize(buffer) - 1); + TestCharacterStreams(buffer, arraysize(buffer) - 1, 576, 3298); +} + +// Regression test for crbug.com/651333. Read invalid utf-8. +TEST(Regress651333) { + const uint8_t bytes[] = + "A\xf1" + "ad"; // Anad, with n == n-with-tilde. + const uint16_t unicode[] = {65, 65533, 97, 100}; + + // Run the test for all sub-strings 0..N of bytes, to make sure we hit the + // error condition in and at chunk boundaries. + for (size_t len = 0; len < arraysize(bytes); len++) { + // Read len bytes from bytes, and compare against the expected unicode + // characters. Expect kBadChar ( == Unicode replacement char == code point + // 65533) instead of the incorrectly coded Latin1 char. + ChunkSource chunks(bytes, len, false); + std::unique_ptr<i::Utf16CharacterStream> stream(i::ScannerStream::For( + &chunks, v8::ScriptCompiler::StreamedSource::UTF8)); + for (size_t i = 0; i < len; i++) { + CHECK_EQ(unicode[i], stream->Advance()); + } + CHECK_EQ(i::Utf16CharacterStream::kEndOfInput, stream->Advance()); + } +} diff --git a/deps/v8/test/cctest/parsing/test-scanner.cc b/deps/v8/test/cctest/parsing/test-scanner.cc new file mode 100644 index 0000000000..2577aa5868 --- /dev/null +++ b/deps/v8/test/cctest/parsing/test-scanner.cc @@ -0,0 +1,87 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Tests v8::internal::Scanner. Note that presently most unit tests for the +// Scanner are in cctest/test-parsing.cc, rather than here. + +#include "src/handles-inl.h" +#include "src/parsing/scanner-character-streams.h" +#include "src/parsing/scanner.h" +#include "src/unicode-cache.h" +#include "test/cctest/cctest.h" + +using namespace v8::internal; + +namespace { + +const char src_simple[] = "function foo() { var x = 2 * a() + b; }"; + +std::unique_ptr<Scanner> make_scanner(const char* src) { + std::unique_ptr<Scanner> scanner(new Scanner(new UnicodeCache())); + scanner->Initialize(ScannerStream::ForTesting(src).release()); + return scanner; +} + +} // anonymous namespace + +// DCHECK_TOK checks token equality, but by checking for equality of the token +// names. That should have the same result, but has much nicer error messaages. +#define DCHECK_TOK(a, b) DCHECK_EQ(Token::Name(a), Token::Name(b)) + +TEST(Bookmarks) { + // Scan through the given source and record the tokens for use as reference + // below. + std::vector<Token::Value> tokens; + { + auto scanner = make_scanner(src_simple); + do { + tokens.push_back(scanner->Next()); + } while (scanner->current_token() != Token::EOS); + } + + // For each position: + // - Scan through file, + // - set a bookmark once the position is reached, + // - scan a bit more, + // - reset to the bookmark, and + // - scan until the end. + // At each step, compare to the reference token sequence generated above. + for (size_t bookmark_pos = 0; bookmark_pos < tokens.size(); bookmark_pos++) { + auto scanner = make_scanner(src_simple); + Scanner::BookmarkScope bookmark(scanner.get()); + + for (size_t i = 0; i < std::min(bookmark_pos + 10, tokens.size()); i++) { + if (i == bookmark_pos) { + bookmark.Set(); + } + DCHECK_TOK(tokens[i], scanner->Next()); + } + + bookmark.Apply(); + for (size_t i = bookmark_pos; i < tokens.size(); i++) { + DCHECK_TOK(tokens[i], scanner->Next()); + } + } +} + +TEST(AllThePushbacks) { + const struct { + const char* src; + const Token::Value tokens[5]; // Large enough for any of the test cases. + } test_cases[] = { + {"<-x", {Token::LT, Token::SUB, Token::IDENTIFIER, Token::EOS}}, + {"<!x", {Token::LT, Token::NOT, Token::IDENTIFIER, Token::EOS}}, + {"<!-x", + {Token::LT, Token::NOT, Token::SUB, Token::IDENTIFIER, Token::EOS}}, + {"<!-- xx -->\nx", {Token::IDENTIFIER, Token::EOS}}, + }; + + for (const auto& test_case : test_cases) { + auto scanner = make_scanner(test_case.src); + for (size_t i = 0; test_case.tokens[i] != Token::EOS; i++) { + DCHECK_TOK(test_case.tokens[i], scanner->Next()); + } + DCHECK_TOK(Token::EOS, scanner->Next()); + } +} diff --git a/deps/v8/test/cctest/test-accessors.cc b/deps/v8/test/cctest/test-accessors.cc index 9667afb703..63c25c5b8c 100644 --- a/deps/v8/test/cctest/test-accessors.cc +++ b/deps/v8/test/cctest/test-accessors.cc @@ -319,7 +319,7 @@ static void CheckAccessorArgsCorrect( CHECK(info.Data() ->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("data")) .FromJust()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(info.GetIsolate() == CcTest::isolate()); CHECK(info.This() == info.Holder()); CHECK(info.Data() diff --git a/deps/v8/test/cctest/test-api-interceptors.cc b/deps/v8/test/cctest/test-api-interceptors.cc index 6e4c6028e9..572487976e 100644 --- a/deps/v8/test/cctest/test-api-interceptors.cc +++ b/deps/v8/test/cctest/test-api-interceptors.cc @@ -13,7 +13,6 @@ #include "src/compilation-cache.h" #include "src/execution.h" #include "src/objects.h" -#include "src/parsing/parser.h" #include "src/unicode-inl.h" #include "src/utils.h" @@ -239,6 +238,26 @@ void CheckThisNamedPropertyHandler( .FromJust()); } +void CheckThisIndexedPropertyDefiner( + uint32_t index, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CheckReturnValue(info, FUNCTION_ADDR(CheckThisIndexedPropertyDefiner)); + ApiTestFuzzer::Fuzz(); + CHECK(info.This() + ->Equals(info.GetIsolate()->GetCurrentContext(), bottom) + .FromJust()); +} + +void CheckThisNamedPropertyDefiner( + Local<Name> property, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CheckReturnValue(info, FUNCTION_ADDR(CheckThisNamedPropertyDefiner)); + ApiTestFuzzer::Fuzz(); + CHECK(info.This() + ->Equals(info.GetIsolate()->GetCurrentContext(), bottom) + .FromJust()); +} + void CheckThisIndexedPropertySetter( uint32_t index, Local<Value> value, const v8::PropertyCallbackInfo<v8::Value>& info) { @@ -249,6 +268,23 @@ void CheckThisIndexedPropertySetter( .FromJust()); } +void CheckThisIndexedPropertyDescriptor( + uint32_t index, const v8::PropertyCallbackInfo<v8::Value>& info) { + CheckReturnValue(info, FUNCTION_ADDR(CheckThisIndexedPropertyDescriptor)); + ApiTestFuzzer::Fuzz(); + CHECK(info.This() + ->Equals(info.GetIsolate()->GetCurrentContext(), bottom) + .FromJust()); +} + +void CheckThisNamedPropertyDescriptor( + Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { + CheckReturnValue(info, FUNCTION_ADDR(CheckThisNamedPropertyDescriptor)); + ApiTestFuzzer::Fuzz(); + CHECK(info.This() + ->Equals(info.GetIsolate()->GetCurrentContext(), bottom) + .FromJust()); +} void CheckThisNamedPropertySetter( Local<Name> property, Local<Value> value, @@ -341,11 +377,284 @@ void InterceptorHasOwnPropertyGetter( void InterceptorHasOwnPropertyGetterGC( Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { ApiTestFuzzer::Fuzz(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); +} + +} // namespace + +int query_counter_int = 0; + +namespace { +void QueryCallback(Local<Name> property, + const v8::PropertyCallbackInfo<v8::Integer>& info) { + query_counter_int++; +} + +} // namespace + +// Examples that show when the query callback is triggered. +THREADED_TEST(QueryInterceptor) { + v8::HandleScope scope(CcTest::isolate()); + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler( + v8::NamedPropertyHandlerConfiguration(0, 0, QueryCallback)); + LocalContext env; + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + CHECK_EQ(query_counter_int, 0); + v8::Local<Value> result = + v8_compile("Object.getOwnPropertyDescriptor(obj, 'x');") + ->Run(env.local()) + .ToLocalChecked(); + CHECK_EQ(query_counter_int, 1); + CHECK_EQ(v8::PropertyAttribute::None, + static_cast<v8::PropertyAttribute>( + result->Int32Value(env.local()).FromJust())); + + v8_compile("Object.defineProperty(obj, 'not_enum', {value: 17});") + ->Run(env.local()) + .ToLocalChecked(); + CHECK_EQ(query_counter_int, 2); + + v8_compile( + "Object.defineProperty(obj, 'enum', {value: 17, enumerable: true, " + "writable: true});") + ->Run(env.local()) + .ToLocalChecked(); + CHECK_EQ(query_counter_int, 3); + + CHECK(v8_compile("obj.propertyIsEnumerable('enum');") + ->Run(env.local()) + .ToLocalChecked() + ->BooleanValue(env.local()) + .FromJust()); + CHECK_EQ(query_counter_int, 4); + + CHECK(!v8_compile("obj.propertyIsEnumerable('not_enum');") + ->Run(env.local()) + .ToLocalChecked() + ->BooleanValue(env.local()) + .FromJust()); + CHECK_EQ(query_counter_int, 5); + + CHECK(v8_compile("obj.hasOwnProperty('enum');") + ->Run(env.local()) + .ToLocalChecked() + ->BooleanValue(env.local()) + .FromJust()); + CHECK_EQ(query_counter_int, 5); + + CHECK(v8_compile("obj.hasOwnProperty('not_enum');") + ->Run(env.local()) + .ToLocalChecked() + ->BooleanValue(env.local()) + .FromJust()); + CHECK_EQ(query_counter_int, 5); + + CHECK(!v8_compile("obj.hasOwnProperty('x');") + ->Run(env.local()) + .ToLocalChecked() + ->BooleanValue(env.local()) + .FromJust()); + CHECK_EQ(query_counter_int, 6); + + CHECK(!v8_compile("obj.propertyIsEnumerable('undef');") + ->Run(env.local()) + .ToLocalChecked() + ->BooleanValue(env.local()) + .FromJust()); + CHECK_EQ(query_counter_int, 7); + + v8_compile("Object.defineProperty(obj, 'enum', {value: 42});") + ->Run(env.local()) + .ToLocalChecked(); + CHECK_EQ(query_counter_int, 8); + + v8_compile("Object.isFrozen('obj.x');")->Run(env.local()).ToLocalChecked(); + CHECK_EQ(query_counter_int, 8); +} + +bool get_was_called = false; +bool set_was_called = false; + +int set_was_called_counter = 0; + +namespace { +void GetterCallback(Local<Name> property, + const v8::PropertyCallbackInfo<v8::Value>& info) { + get_was_called = true; +} + +void SetterCallback(Local<Name> property, Local<Value> value, + const v8::PropertyCallbackInfo<v8::Value>& info) { + set_was_called = true; + set_was_called_counter++; +} + +} // namespace + +// Check that get callback is called in defineProperty with accessor descriptor. +THREADED_TEST(DefinerCallbackAccessorInterceptor) { + v8::HandleScope scope(CcTest::isolate()); + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler( + v8::NamedPropertyHandlerConfiguration(GetterCallback, SetterCallback)); + LocalContext env; + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + + get_was_called = false; + set_was_called = false; + + v8_compile("Object.defineProperty(obj, 'x', {set: function() {return 17;}});") + ->Run(env.local()) + .ToLocalChecked(); + CHECK_EQ(get_was_called, true); + CHECK_EQ(set_was_called, false); +} + +// Check that set callback is called for function declarations. +THREADED_TEST(SetterCallbackFunctionDeclarationInterceptor) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + + v8::Local<ObjectTemplate> object_template = templ->InstanceTemplate(); + object_template->SetHandler( + v8::NamedPropertyHandlerConfiguration(nullptr, SetterCallback)); + v8::Local<v8::Context> ctx = + v8::Context::New(CcTest::isolate(), nullptr, object_template); + + set_was_called_counter = 0; + + // Declare function. + v8::Local<v8::String> code = v8_str("function x() {return 42;}; x();"); + CHECK_EQ(42, v8::Script::Compile(ctx, code) + .ToLocalChecked() + ->Run(ctx) + .ToLocalChecked() + ->Int32Value(ctx) + .FromJust()); + CHECK_EQ(set_was_called_counter, 1); + + // Redeclare function. + code = v8_str("function x() {return 43;}; x();"); + CHECK_EQ(43, v8::Script::Compile(ctx, code) + .ToLocalChecked() + ->Run(ctx) + .ToLocalChecked() + ->Int32Value(ctx) + .FromJust()); + CHECK_EQ(set_was_called_counter, 2); + + // Redefine function. + code = v8_str("x = function() {return 44;}; x();"); + CHECK_EQ(44, v8::Script::Compile(ctx, code) + .ToLocalChecked() + ->Run(ctx) + .ToLocalChecked() + ->Int32Value(ctx) + .FromJust()); + CHECK_EQ(set_was_called_counter, 3); +} + +// Check that function re-declarations throw if they are read-only. +THREADED_TEST(SetterCallbackFunctionDeclarationInterceptorThrow) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + + v8::Local<ObjectTemplate> object_template = templ->InstanceTemplate(); + object_template->SetHandler( + v8::NamedPropertyHandlerConfiguration(nullptr, SetterCallback)); + v8::Local<v8::Context> ctx = + v8::Context::New(CcTest::isolate(), nullptr, object_template); + + set_was_called = false; + + v8::Local<v8::String> code = v8_str( + "function x() {return 42;};" + "Object.defineProperty(this, 'x', {" + "configurable: false, " + "writable: false});" + "x();"); + CHECK_EQ(42, v8::Script::Compile(ctx, code) + .ToLocalChecked() + ->Run(ctx) + .ToLocalChecked() + ->Int32Value(ctx) + .FromJust()); + + CHECK_EQ(set_was_called, true); + + v8::TryCatch try_catch(CcTest::isolate()); + set_was_called = false; + + // Redeclare function that is read-only. + code = v8_str("function x() {return 43;};"); + CHECK(v8::Script::Compile(ctx, code).ToLocalChecked()->Run(ctx).IsEmpty()); + CHECK(try_catch.HasCaught()); + + CHECK_EQ(set_was_called, false); +} + +bool get_was_called_in_order = false; +bool define_was_called_in_order = false; + +namespace { + +void GetterCallbackOrder(Local<Name> property, + const v8::PropertyCallbackInfo<v8::Value>& info) { + get_was_called_in_order = true; + CHECK_EQ(define_was_called_in_order, true); + info.GetReturnValue().Set(property); +} + +void DefinerCallbackOrder(Local<Name> property, + const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK_EQ(get_was_called_in_order, false); // Define called before get. + define_was_called_in_order = true; } } // namespace +// Check that definer callback is called before getter callback. +THREADED_TEST(DefinerCallbackGetAndDefine) { + v8::HandleScope scope(CcTest::isolate()); + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + GetterCallbackOrder, SetterCallback, 0, 0, 0, DefinerCallbackOrder)); + LocalContext env; + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + + CHECK_EQ(get_was_called_in_order, false); + CHECK_EQ(define_was_called_in_order, false); + + v8_compile("Object.defineProperty(obj, 'x', {set: function() {return 17;}});") + ->Run(env.local()) + .ToLocalChecked(); + CHECK_EQ(get_was_called_in_order, true); + CHECK_EQ(define_was_called_in_order, true); +} THREADED_TEST(InterceptorHasOwnProperty) { LocalContext context; @@ -1103,6 +1412,503 @@ THREADED_TEST(NamedPropertyHandlerGetter) { .FromJust()); } +namespace { +void NotInterceptingPropertyDefineCallback( + Local<Name> name, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + // Do not intercept by not calling info.GetReturnValue().Set(). +} + +void InterceptingPropertyDefineCallback( + Local<Name> name, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + // Intercept the callback by setting a non-empty handle + info.GetReturnValue().Set(name); +} + +void CheckDescriptorInDefineCallback( + Local<Name> name, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(!desc.has_writable()); + CHECK(!desc.has_value()); + CHECK(!desc.has_enumerable()); + CHECK(desc.has_configurable()); + CHECK(!desc.configurable()); + CHECK(desc.has_get()); + CHECK(desc.get()->IsFunction()); + CHECK(desc.has_set()); + CHECK(desc.set()->IsUndefined()); + // intercept the callback by setting a non-empty handle + info.GetReturnValue().Set(name); +} +} // namespace + +THREADED_TEST(PropertyDefinerCallback) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + + { // Intercept defineProperty() + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, NotInterceptingPropertyDefineCallback)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "obj.x = 17; " + "Object.defineProperty(obj, 'x', {value: 42});" + "obj.x;"; + CHECK_EQ(42, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } + + { // Intercept defineProperty() for correct accessor descriptor + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, CheckDescriptorInDefineCallback)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "obj.x = 17; " + "Object.defineProperty(obj, 'x', {" + "get: function(){ return 42; }, " + "set: undefined," + "configurable: 0" + "});" + "obj.x;"; + CHECK_EQ(17, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } + + { // Do not intercept defineProperty() + v8::Local<v8::FunctionTemplate> templ2 = + v8::FunctionTemplate::New(CcTest::isolate()); + templ2->InstanceTemplate()->SetHandler( + v8::NamedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, InterceptingPropertyDefineCallback)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ2->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + + const char* code = + "obj.x = 17; " + "Object.defineProperty(obj, 'x', {value: 42});" + "obj.x;"; + CHECK_EQ(17, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } +} + +namespace { +void NotInterceptingPropertyDefineCallbackIndexed( + uint32_t index, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + // Do not intercept by not calling info.GetReturnValue().Set() +} + +void InterceptingPropertyDefineCallbackIndexed( + uint32_t index, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + // intercept the callback by setting a non-empty handle + info.GetReturnValue().Set(index); +} + +void CheckDescriptorInDefineCallbackIndexed( + uint32_t index, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(!desc.has_writable()); + CHECK(!desc.has_value()); + CHECK(desc.has_enumerable()); + CHECK(desc.enumerable()); + CHECK(!desc.has_configurable()); + CHECK(desc.has_get()); + CHECK(desc.get()->IsFunction()); + CHECK(desc.has_set()); + CHECK(desc.set()->IsUndefined()); + // intercept the callback by setting a non-empty handle + info.GetReturnValue().Set(index); +} +} // namespace + +THREADED_TEST(PropertyDefinerCallbackIndexed) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + + { // Intercept defineProperty() + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler( + v8::IndexedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, NotInterceptingPropertyDefineCallbackIndexed)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "obj[2] = 17; " + "Object.defineProperty(obj, 2, {value: 42});" + "obj[2];"; + CHECK_EQ(42, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } + + { // Intercept defineProperty() for correct accessor descriptor + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler( + v8::IndexedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, CheckDescriptorInDefineCallbackIndexed)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "obj[2] = 17; " + "Object.defineProperty(obj, 2, {" + "get: function(){ return 42; }, " + "set: undefined," + "enumerable: true" + "});" + "obj[2];"; + CHECK_EQ(17, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } + + { // Do not intercept defineProperty() + v8::Local<v8::FunctionTemplate> templ2 = + v8::FunctionTemplate::New(CcTest::isolate()); + templ2->InstanceTemplate()->SetHandler( + v8::IndexedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, InterceptingPropertyDefineCallbackIndexed)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ2->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + + const char* code = + "obj[2] = 17; " + "Object.defineProperty(obj, 2, {value: 42});" + "obj[2];"; + CHECK_EQ(17, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } +} + +// Test that freeze() is intercepted. +THREADED_TEST(PropertyDefinerCallbackForFreeze) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, InterceptingPropertyDefineCallback)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "obj.x = 17; " + "Object.freeze(obj.x); " + "Object.isFrozen(obj.x);"; + + CHECK(v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->BooleanValue(env.local()) + .FromJust()); +} + +// Check that the descriptor passed to the callback is enumerable. +namespace { +void CheckEnumerablePropertyDefineCallback( + Local<Name> name, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(desc.has_value()); + CHECK_EQ(42, desc.value() + ->Int32Value(info.GetIsolate()->GetCurrentContext()) + .FromJust()); + CHECK(desc.has_enumerable()); + CHECK(desc.enumerable()); + CHECK(!desc.has_writable()); + + // intercept the callback by setting a non-empty handle + info.GetReturnValue().Set(name); +} +} // namespace +THREADED_TEST(PropertyDefinerCallbackEnumerable) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, CheckEnumerablePropertyDefineCallback)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "obj.x = 17; " + "Object.defineProperty(obj, 'x', {value: 42, enumerable: true});" + "obj.x;"; + CHECK_EQ(17, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); +} + +// Check that the descriptor passed to the callback is configurable. +namespace { +void CheckConfigurablePropertyDefineCallback( + Local<Name> name, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(desc.has_value()); + CHECK_EQ(42, desc.value() + ->Int32Value(info.GetIsolate()->GetCurrentContext()) + .FromJust()); + CHECK(desc.has_configurable()); + CHECK(desc.configurable()); + + // intercept the callback by setting a non-empty handle + info.GetReturnValue().Set(name); +} +} // namespace +THREADED_TEST(PropertyDefinerCallbackConfigurable) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, CheckConfigurablePropertyDefineCallback)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "obj.x = 17; " + "Object.defineProperty(obj, 'x', {value: 42, configurable: true});" + "obj.x;"; + CHECK_EQ(17, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); +} + +// Check that the descriptor passed to the callback is writable. +namespace { +void CheckWritablePropertyDefineCallback( + Local<Name> name, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(desc.has_writable()); + CHECK(desc.writable()); + + // intercept the callback by setting a non-empty handle + info.GetReturnValue().Set(name); +} +} // namespace +THREADED_TEST(PropertyDefinerCallbackWritable) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, CheckWritablePropertyDefineCallback)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "obj.x = 17; " + "Object.defineProperty(obj, 'x', {value: 42, writable: true});" + "obj.x;"; + CHECK_EQ(17, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); +} + +// Check that the descriptor passed to the callback has a getter. +namespace { +void CheckGetterPropertyDefineCallback( + Local<Name> name, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(desc.has_get()); + CHECK(!desc.has_set()); + // intercept the callback by setting a non-empty handle + info.GetReturnValue().Set(name); +} +} // namespace +THREADED_TEST(PropertyDefinerCallbackWithGetter) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, CheckGetterPropertyDefineCallback)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "obj.x = 17;" + "Object.defineProperty(obj, 'x', {get: function() {return 42;}});" + "obj.x;"; + CHECK_EQ(17, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); +} + +// Check that the descriptor passed to the callback has a setter. +namespace { +void CheckSetterPropertyDefineCallback( + Local<Name> name, const v8::PropertyDescriptor& desc, + const v8::PropertyCallbackInfo<v8::Value>& info) { + CHECK(desc.has_set()); + CHECK(!desc.has_get()); + // intercept the callback by setting a non-empty handle + info.GetReturnValue().Set(name); +} +} // namespace +THREADED_TEST(PropertyDefinerCallbackWithSetter) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + 0, 0, 0, 0, 0, CheckSetterPropertyDefineCallback)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "Object.defineProperty(obj, 'x', {set: function() {return 42;}});" + "obj.x = 17;"; + CHECK_EQ(17, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); +} + +namespace { +void EmptyPropertyDescriptorCallback( + Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { + // Do not intercept by not calling info.GetReturnValue().Set(). +} + +void InterceptingPropertyDescriptorCallback( + Local<Name> name, const v8::PropertyCallbackInfo<v8::Value>& info) { + // Intercept the callback by setting a different descriptor. + const char* code = + "var desc = {value: 42};" + "desc;"; + Local<Value> descriptor = v8_compile(code) + ->Run(info.GetIsolate()->GetCurrentContext()) + .ToLocalChecked(); + info.GetReturnValue().Set(descriptor); +} +} // namespace + +THREADED_TEST(PropertyDescriptorCallback) { + v8::HandleScope scope(CcTest::isolate()); + LocalContext env; + + { // Normal behavior of getOwnPropertyDescriptor() with empty callback. + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + 0, 0, EmptyPropertyDescriptorCallback, 0, 0, 0)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "obj.x = 17; " + "var desc = Object.getOwnPropertyDescriptor(obj, 'x');" + "desc.value;"; + CHECK_EQ(17, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } + + { // Intercept getOwnPropertyDescriptor(). + v8::Local<v8::FunctionTemplate> templ = + v8::FunctionTemplate::New(CcTest::isolate()); + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + 0, 0, InterceptingPropertyDescriptorCallback, 0, 0, 0)); + env->Global() + ->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked()) + .FromJust(); + const char* code = + "obj.x = 17; " + "var desc = Object.getOwnPropertyDescriptor(obj, 'x');" + "desc.value;"; + CHECK_EQ(42, v8_compile(code) + ->Run(env.local()) + .ToLocalChecked() + ->Int32Value(env.local()) + .FromJust()); + } +} int echo_indexed_call_count = 0; @@ -1145,7 +1951,6 @@ THREADED_TEST(PropertyHandlerInPrototype) { v8::Isolate* isolate = env->GetIsolate(); v8::HandleScope scope(isolate); - // Set up a prototype chain with three interceptors. v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate); templ->InstanceTemplate()->SetHandler(v8::IndexedPropertyHandlerConfiguration( CheckThisIndexedPropertyHandler, CheckThisIndexedPropertySetter, @@ -1194,6 +1999,63 @@ THREADED_TEST(PropertyHandlerInPrototype) { CompileRun("for (var p in obj) ;"); } +TEST(PropertyHandlerInPrototypeWithDefine) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + v8::Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate); + templ->InstanceTemplate()->SetHandler(v8::IndexedPropertyHandlerConfiguration( + CheckThisIndexedPropertyHandler, CheckThisIndexedPropertySetter, + CheckThisIndexedPropertyDescriptor, CheckThisIndexedPropertyDeleter, + CheckThisIndexedPropertyEnumerator, CheckThisIndexedPropertyDefiner)); + + templ->InstanceTemplate()->SetHandler(v8::NamedPropertyHandlerConfiguration( + CheckThisNamedPropertyHandler, CheckThisNamedPropertySetter, + CheckThisNamedPropertyDescriptor, CheckThisNamedPropertyDeleter, + CheckThisNamedPropertyEnumerator, CheckThisNamedPropertyDefiner)); + + bottom = templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked(); + Local<v8::Object> top = templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked(); + Local<v8::Object> middle = templ->GetFunction(env.local()) + .ToLocalChecked() + ->NewInstance(env.local()) + .ToLocalChecked(); + + bottom->SetPrototype(env.local(), middle).FromJust(); + middle->SetPrototype(env.local(), top).FromJust(); + env->Global()->Set(env.local(), v8_str("obj"), bottom).FromJust(); + + // Indexed and named get. + CompileRun("obj[0]"); + CompileRun("obj.x"); + + // Indexed and named set. + CompileRun("obj[1] = 42"); + CompileRun("obj.y = 42"); + + // Indexed and named deleter. + CompileRun("delete obj[0]"); + CompileRun("delete obj.x"); + + // Enumerators. + CompileRun("for (var p in obj) ;"); + + // Indexed and named definer. + CompileRun("Object.defineProperty(obj, 2, {});"); + CompileRun("Object.defineProperty(obj, 'z', {});"); + + // Indexed and named propertyDescriptor. + CompileRun("Object.getOwnPropertyDescriptor(obj, 2);"); + CompileRun("Object.getOwnPropertyDescriptor(obj, 'z');"); +} + bool is_bootstrapping = false; static void PrePropertyHandlerGet( @@ -3789,6 +4651,9 @@ THREADED_TEST(NonMaskingInterceptorOwnProperty) { ExpectInt32("obj.whatever", 239); CompileRun("obj.whatever = 4;"); + + // obj.whatever exists, thus it is not affected by the non-masking + // interceptor. ExpectInt32("obj.whatever", 4); CompileRun("delete obj.whatever;"); diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index 484d2f3226..8317a06aa2 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -47,7 +47,7 @@ #include "src/execution.h" #include "src/futex-emulation.h" #include "src/objects.h" -#include "src/parsing/parser.h" +#include "src/parsing/preparse-data.h" #include "src/profiler/cpu-profiler.h" #include "src/unicode-inl.h" #include "src/utils.h" @@ -453,11 +453,11 @@ THREADED_TEST(ScriptUsingStringResource) { CHECK_EQ(static_cast<const String::ExternalStringResourceBase*>(resource), source->GetExternalStringResourceBase(&encoding)); CHECK_EQ(String::TWO_BYTE_ENCODING, encoding); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(0, dispose_count); } CcTest::i_isolate()->compilation_cache()->Clear(); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(1, dispose_count); } @@ -484,11 +484,11 @@ THREADED_TEST(ScriptUsingOneByteStringResource) { Local<Value> value = script->Run(env.local()).ToLocalChecked(); CHECK(value->IsNumber()); CHECK_EQ(7, value->Int32Value(env.local()).FromJust()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(0, dispose_count); } CcTest::i_isolate()->compilation_cache()->Clear(); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(1, dispose_count); } @@ -504,8 +504,8 @@ THREADED_TEST(ScriptMakingExternalString) { v8::NewStringType::kNormal) .ToLocalChecked(); // Trigger GCs so that the newly allocated string moves to old gen. - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now + CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now + CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now CHECK_EQ(source->IsExternal(), false); CHECK_EQ(source->IsExternalOneByte(), false); String::Encoding encoding = String::UNKNOWN_ENCODING; @@ -518,11 +518,11 @@ THREADED_TEST(ScriptMakingExternalString) { Local<Value> value = script->Run(env.local()).ToLocalChecked(); CHECK(value->IsNumber()); CHECK_EQ(7, value->Int32Value(env.local()).FromJust()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(0, dispose_count); } CcTest::i_isolate()->compilation_cache()->Clear(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(1, dispose_count); } @@ -535,8 +535,8 @@ THREADED_TEST(ScriptMakingExternalOneByteString) { v8::HandleScope scope(env->GetIsolate()); Local<String> source = v8_str(c_source); // Trigger GCs so that the newly allocated string moves to old gen. - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now + CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now + CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now bool success = source->MakeExternal( new TestOneByteResource(i::StrDup(c_source), &dispose_count)); CHECK(success); @@ -544,11 +544,11 @@ THREADED_TEST(ScriptMakingExternalOneByteString) { Local<Value> value = script->Run(env.local()).ToLocalChecked(); CHECK(value->IsNumber()); CHECK_EQ(7, value->Int32Value(env.local()).FromJust()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(0, dispose_count); } CcTest::i_isolate()->compilation_cache()->Clear(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(1, dispose_count); } @@ -558,8 +558,8 @@ TEST(MakingExternalStringConditions) { v8::HandleScope scope(env->GetIsolate()); // Free some space in the new space so that we can check freshness. - CcTest::heap()->CollectGarbage(i::NEW_SPACE); - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); uint16_t* two_byte_string = AsciiToTwoByteString("s1"); Local<String> local_string = @@ -571,8 +571,8 @@ TEST(MakingExternalStringConditions) { // We should refuse to externalize new space strings. CHECK(!local_string->CanMakeExternal()); // Trigger GCs so that the newly allocated string moves to old gen. - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now + CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now + CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now // Old space strings should be accepted. CHECK(local_string->CanMakeExternal()); } @@ -583,15 +583,15 @@ TEST(MakingExternalOneByteStringConditions) { v8::HandleScope scope(env->GetIsolate()); // Free some space in the new space so that we can check freshness. - CcTest::heap()->CollectGarbage(i::NEW_SPACE); - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); Local<String> local_string = v8_str("s1"); // We should refuse to externalize new space strings. CHECK(!local_string->CanMakeExternal()); // Trigger GCs so that the newly allocated string moves to old gen. - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now + CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now + CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now // Old space strings should be accepted. CHECK(local_string->CanMakeExternal()); } @@ -612,8 +612,8 @@ TEST(MakingExternalUnalignedOneByteString) { // Trigger GCs so that the newly allocated string moves to old gen. i::heap::SimulateFullSpace(CcTest::heap()->old_space()); - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now + CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now + CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now // Turn into external string with unaligned resource data. const char* c_cons = "_abcdefghijklmnopqrstuvwxyz"; @@ -626,8 +626,8 @@ TEST(MakingExternalUnalignedOneByteString) { CHECK(success); // Trigger GCs and force evacuation. - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(i::Heap::kReduceMemoryFootprintMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kReduceMemoryFootprintMask); } @@ -642,14 +642,14 @@ THREADED_TEST(UsingExternalString) { .ToLocalChecked(); i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); // Trigger GCs so that the newly allocated string moves to old gen. - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now + CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now + CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now i::Handle<i::String> isymbol = factory->InternalizeString(istring); CHECK(isymbol->IsInternalizedString()); } - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -665,14 +665,14 @@ THREADED_TEST(UsingExternalOneByteString) { .ToLocalChecked(); i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); // Trigger GCs so that the newly allocated string moves to old gen. - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now + CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now + CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now i::Handle<i::String> isymbol = factory->InternalizeString(istring); CHECK(isymbol->IsInternalizedString()); } - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -739,12 +739,12 @@ THREADED_TEST(ScavengeExternalString) { new TestResource(two_byte_string, &dispose_count)) .ToLocalChecked(); i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); in_new_space = CcTest::heap()->InNewSpace(*istring); CHECK(in_new_space || CcTest::heap()->old_space()->Contains(*istring)); CHECK_EQ(0, dispose_count); } - CcTest::heap()->CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_SPACE); + CcTest::CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_SPACE); CHECK_EQ(1, dispose_count); } @@ -763,12 +763,12 @@ THREADED_TEST(ScavengeExternalOneByteString) { new TestOneByteResource(i::StrDup(one_byte_string), &dispose_count)) .ToLocalChecked(); i::Handle<i::String> istring = v8::Utils::OpenHandle(*string); - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); in_new_space = CcTest::heap()->InNewSpace(*istring); CHECK(in_new_space || CcTest::heap()->old_space()->Contains(*istring)); CHECK_EQ(0, dispose_count); } - CcTest::heap()->CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_SPACE); + CcTest::CollectGarbage(in_new_space ? i::NEW_SPACE : i::OLD_SPACE); CHECK_EQ(1, dispose_count); } @@ -812,11 +812,11 @@ TEST(ExternalStringWithDisposeHandling) { Local<Value> value = script->Run(env.local()).ToLocalChecked(); CHECK(value->IsNumber()); CHECK_EQ(7, value->Int32Value(env.local()).FromJust()); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(0, TestOneByteResourceWithDisposeControl::dispose_count); } CcTest::i_isolate()->compilation_cache()->Clear(); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(1, TestOneByteResourceWithDisposeControl::dispose_calls); CHECK_EQ(0, TestOneByteResourceWithDisposeControl::dispose_count); @@ -835,11 +835,11 @@ TEST(ExternalStringWithDisposeHandling) { Local<Value> value = script->Run(env.local()).ToLocalChecked(); CHECK(value->IsNumber()); CHECK_EQ(7, value->Int32Value(env.local()).FromJust()); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(0, TestOneByteResourceWithDisposeControl::dispose_count); } CcTest::i_isolate()->compilation_cache()->Clear(); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(1, TestOneByteResourceWithDisposeControl::dispose_calls); CHECK_EQ(1, TestOneByteResourceWithDisposeControl::dispose_count); } @@ -897,8 +897,8 @@ THREADED_TEST(StringConcat) { CHECK_EQ(68, value->Int32Value(env.local()).FromJust()); } CcTest::i_isolate()->compilation_cache()->Clear(); - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -1581,6 +1581,26 @@ THREADED_TEST(IsGeneratorFunctionOrObject) { CHECK(!func->IsGeneratorObject()); } +THREADED_TEST(IsAsyncFunction) { + i::FLAG_harmony_async_await = true; + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + CompileRun("async function foo() {}"); + v8::Local<Value> foo = CompileRun("foo"); + + CHECK(foo->IsAsyncFunction()); + CHECK(foo->IsFunction()); + CHECK(!foo->IsGeneratorFunction()); + CHECK(!foo->IsGeneratorObject()); + + CompileRun("function bar() {}"); + v8::Local<Value> bar = CompileRun("bar"); + + CHECK(!bar->IsAsyncFunction()); + CHECK(bar->IsFunction()); +} THREADED_TEST(ArgumentsObject) { LocalContext env; @@ -2651,7 +2671,7 @@ static void CheckAlignedPointerInInternalField(Local<v8::Object> obj, void* value) { CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1)); obj->SetAlignedPointerInInternalField(0, value); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(value, obj->GetAlignedPointerFromInternalField(0)); } @@ -2707,14 +2727,14 @@ THREADED_TEST(SetAlignedPointerInInternalFields) { void* values[] = {heap_allocated_1, heap_allocated_2}; obj->SetAlignedPointerInInternalFields(2, indices, values); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(heap_allocated_1, obj->GetAlignedPointerFromInternalField(0)); CHECK_EQ(heap_allocated_2, obj->GetAlignedPointerFromInternalField(1)); indices[0] = 1; indices[1] = 0; obj->SetAlignedPointerInInternalFields(2, indices, values); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(heap_allocated_2, obj->GetAlignedPointerFromInternalField(0)); CHECK_EQ(heap_allocated_1, obj->GetAlignedPointerFromInternalField(1)); @@ -2726,7 +2746,7 @@ static void CheckAlignedPointerInEmbedderData(LocalContext* env, int index, void* value) { CHECK_EQ(0, static_cast<int>(reinterpret_cast<uintptr_t>(value) & 0x1)); (*env)->SetAlignedPointerInEmbedderData(index, value); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(value, (*env)->GetAlignedPointerFromEmbedderData(index)); } @@ -2756,7 +2776,7 @@ THREADED_TEST(EmbedderDataAlignedPointers) { for (int i = 0; i < 100; i++) { env->SetAlignedPointerInEmbedderData(i, AlignedTestPointer(i)); } - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); for (int i = 0; i < 100; i++) { CHECK_EQ(AlignedTestPointer(i), env->GetAlignedPointerFromEmbedderData(i)); } @@ -2788,7 +2808,7 @@ THREADED_TEST(IdentityHash) { // Ensure that the test starts with an fresh heap to test whether the hash // code is based on the address. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); Local<v8::Object> obj = v8::Object::New(isolate); int hash = obj->GetIdentityHash(); int hash1 = obj->GetIdentityHash(); @@ -2798,7 +2818,7 @@ THREADED_TEST(IdentityHash) { // objects should not be assigned the same hash code. If the test below fails // the random number generator should be evaluated. CHECK_NE(hash, hash2); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); int hash3 = v8::Object::New(isolate)->GetIdentityHash(); // Make sure that the identity hash is not based on the initial address of // the object alone. If the test below fails the random number generator @@ -2874,7 +2894,7 @@ TEST(SymbolIdentityHash) { int hash = symbol->GetIdentityHash(); int hash1 = symbol->GetIdentityHash(); CHECK_EQ(hash, hash1); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); int hash3 = symbol->GetIdentityHash(); CHECK_EQ(hash, hash3); } @@ -2885,7 +2905,7 @@ TEST(SymbolIdentityHash) { int hash = js_symbol->GetIdentityHash(); int hash1 = js_symbol->GetIdentityHash(); CHECK_EQ(hash, hash1); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); int hash3 = js_symbol->GetIdentityHash(); CHECK_EQ(hash, hash3); } @@ -2901,7 +2921,7 @@ TEST(StringIdentityHash) { int hash = str->GetIdentityHash(); int hash1 = str->GetIdentityHash(); CHECK_EQ(hash, hash1); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); int hash3 = str->GetIdentityHash(); CHECK_EQ(hash, hash3); @@ -2921,7 +2941,7 @@ THREADED_TEST(SymbolProperties) { v8::Local<v8::Symbol> sym2 = v8::Symbol::New(isolate, v8_str("my-symbol")); v8::Local<v8::Symbol> sym3 = v8::Symbol::New(isolate, v8_str("sym3")); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Check basic symbol functionality. CHECK(sym1->IsSymbol()); @@ -2990,7 +3010,7 @@ THREADED_TEST(SymbolProperties) { CHECK_EQ(num_props + 1, obj->GetPropertyNames(env.local()).ToLocalChecked()->Length()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(obj->SetAccessor(env.local(), sym3, SymbolAccessorGetter, SymbolAccessorSetter) @@ -3100,7 +3120,7 @@ THREADED_TEST(PrivatePropertiesOnProxies) { v8::Local<v8::Private> priv2 = v8::Private::New(isolate, v8_str("my-private")); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(priv2->Name() ->Equals(env.local(), @@ -3142,7 +3162,7 @@ THREADED_TEST(PrivatePropertiesOnProxies) { CHECK_EQ(num_props + 1, proxy->GetPropertyNames(env.local()).ToLocalChecked()->Length()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Add another property and delete it afterwards to force the object in // slow case. @@ -3194,7 +3214,7 @@ THREADED_TEST(PrivateProperties) { v8::Local<v8::Private> priv2 = v8::Private::New(isolate, v8_str("my-private")); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(priv2->Name() ->Equals(env.local(), @@ -3236,7 +3256,7 @@ THREADED_TEST(PrivateProperties) { CHECK_EQ(num_props + 1, obj->GetPropertyNames(env.local()).ToLocalChecked()->Length()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Add another property and delete it afterwards to force the object in // slow case. @@ -3385,7 +3405,7 @@ THREADED_TEST(ArrayBuffer_ApiInternalToExternal) { CheckInternalFieldsAreZero(ab); CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); CHECK(!ab->IsExternal()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); ScopedArrayBufferContents ab_contents(ab->Externalize()); CHECK(ab->IsExternal()); @@ -3661,7 +3681,7 @@ THREADED_TEST(SharedArrayBuffer_ApiInternalToExternal) { CheckInternalFieldsAreZero(ab); CHECK_EQ(1024, static_cast<int>(ab->ByteLength())); CHECK(!ab->IsExternal()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); ScopedSharedArrayBufferContents ab_contents(ab->Externalize()); CHECK(ab->IsExternal()); @@ -3778,7 +3798,7 @@ THREADED_TEST(HiddenProperties) { v8::Local<v8::String> empty = v8_str(""); v8::Local<v8::String> prop_name = v8_str("prop_name"); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Make sure delete of a non-existent hidden value works obj->DeletePrivate(env.local(), key).FromJust(); @@ -3796,7 +3816,7 @@ THREADED_TEST(HiddenProperties) { ->Int32Value(env.local()) .FromJust()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Make sure we do not find the hidden property. CHECK(!obj->Has(env.local(), empty).FromJust()); @@ -3820,7 +3840,7 @@ THREADED_TEST(HiddenProperties) { ->Int32Value(env.local()) .FromJust()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Add another property and delete it afterwards to force the object in // slow case. @@ -3844,7 +3864,7 @@ THREADED_TEST(HiddenProperties) { ->Int32Value(env.local()) .FromJust()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK(obj->SetPrivate(env.local(), key, v8::Integer::New(isolate, 2002)) .FromJust()); @@ -4135,7 +4155,7 @@ void SecondPassCallback(const v8::WeakCallbackInfo<TwoPassCallbackData>& data) { if (!trigger_gc) return; auto data_2 = new TwoPassCallbackData(data.GetIsolate(), instance_counter); data_2->SetWeak(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -4156,7 +4176,7 @@ TEST(TwoPassPhantomCallbacks) { data->SetWeak(); } CHECK_EQ(static_cast<int>(kLength), instance_counter); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); EmptyMessageQueues(isolate); CHECK_EQ(0, instance_counter); } @@ -4175,7 +4195,7 @@ TEST(TwoPassPhantomCallbacksNestedGc) { array[10]->MarkTriggerGc(); array[15]->MarkTriggerGc(); CHECK_EQ(static_cast<int>(kLength), instance_counter); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); EmptyMessageQueues(isolate); CHECK_EQ(0, instance_counter); } @@ -4286,8 +4306,7 @@ void TestGlobalValueMap() { } CHECK_EQ(initial_handle_count + 1, global_handles->global_handles_count()); if (map.IsWeak()) { - CcTest::i_isolate()->heap()->CollectAllGarbage( - i::Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); } else { map.Clear(); } @@ -4518,9 +4537,7 @@ THREADED_TEST(ApiObjectGroups) { iso->SetReferenceFromGroup(id2, g2c1.handle); } // Do a single full GC, ensure incremental marking is stopped. - v8::internal::Heap* heap = - reinterpret_cast<v8::internal::Isolate*>(iso)->heap(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // All object should be alive. CHECK_EQ(0, counter.NumberOfWeakCalls()); @@ -4545,7 +4562,7 @@ THREADED_TEST(ApiObjectGroups) { iso->SetReferenceFromGroup(id2, g2c1.handle); } - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // All objects should be gone. 5 global handles in total. CHECK_EQ(5, counter.NumberOfWeakCalls()); @@ -4556,7 +4573,7 @@ THREADED_TEST(ApiObjectGroups) { g2c1.handle.SetWeak(&g2c1, &WeakPointerCallback, v8::WeakCallbackType::kParameter); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(7, counter.NumberOfWeakCalls()); } @@ -4623,9 +4640,7 @@ THREADED_TEST(ApiObjectGroupsForSubtypes) { iso->SetReferenceFromGroup(id2, g2c1.handle); } // Do a single full GC, ensure incremental marking is stopped. - v8::internal::Heap* heap = - reinterpret_cast<v8::internal::Isolate*>(iso)->heap(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // All object should be alive. CHECK_EQ(0, counter.NumberOfWeakCalls()); @@ -4650,7 +4665,7 @@ THREADED_TEST(ApiObjectGroupsForSubtypes) { iso->SetReferenceFromGroup(id2, g2c1.handle); } - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // All objects should be gone. 5 global handles in total. CHECK_EQ(5, counter.NumberOfWeakCalls()); @@ -4661,7 +4676,7 @@ THREADED_TEST(ApiObjectGroupsForSubtypes) { g2c1.handle.SetWeak(&g2c1, &WeakPointerCallback, v8::WeakCallbackType::kParameter); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(7, counter.NumberOfWeakCalls()); } @@ -4746,9 +4761,7 @@ THREADED_TEST(ApiObjectGroupsCycle) { iso->SetReferenceFromGroup(id4, g1s1.handle); } // Do a single full GC - v8::internal::Heap* heap = - reinterpret_cast<v8::internal::Isolate*>(iso)->heap(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // All object should be alive. CHECK_EQ(0, counter.NumberOfWeakCalls()); @@ -4777,7 +4790,7 @@ THREADED_TEST(ApiObjectGroupsCycle) { iso->SetReferenceFromGroup(id4, g1s1.handle); } - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // All objects should be gone. 9 global handles in total. CHECK_EQ(9, counter.NumberOfWeakCalls()); @@ -5077,7 +5090,7 @@ TEST(NativeWeakMap) { CHECK(value->Equals(env.local(), weak_map->Get(obj2)).FromJust()); CHECK(value->Equals(env.local(), weak_map->Get(sym1)).FromJust()); } - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); { HandleScope scope(isolate); CHECK(value->Equals(env.local(), weak_map->Get(local1)).FromJust()); @@ -5099,7 +5112,7 @@ TEST(NativeWeakMap) { s1.handle.SetWeak(&s1, &WeakPointerCallback, v8::WeakCallbackType::kParameter); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(3, counter.NumberOfWeakCalls()); CHECK(o1.handle.IsEmpty()); @@ -7458,13 +7471,11 @@ TEST(ExceptionExtensions) { CHECK(context.IsEmpty()); } - static const char* kNativeCallInExtensionSource = "function call_runtime_last_index_of(x) {" - " return %StringLastIndexOf(x, 'bob', 10);" + " return %StringLastIndexOf(x, 'bob');" "}"; - static const char* kNativeCallTest = "call_runtime_last_index_of('bobbobboellebobboellebobbob');"; @@ -7478,7 +7489,7 @@ TEST(NativeCallInExtensions) { v8::Local<Context> context = Context::New(CcTest::isolate(), &extensions); Context::Scope lock(context); v8::Local<Value> result = CompileRun(kNativeCallTest); - CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 3)) + CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 24)) .FromJust()); } @@ -7770,9 +7781,9 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) { b->Set(context, v8_str("x"), a).FromJust(); } if (global_gc) { - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } else { - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); } // We are relying on this creating a big flag array and reserving the space // up front. @@ -7792,9 +7803,9 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) { object_b.handle.MarkIndependent(); CHECK(object_b.handle.IsIndependent()); if (global_gc) { - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } else { - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); } // A single GC should be enough to reclaim the memory, since we are using // phantom handles. @@ -7891,9 +7902,9 @@ void InternalFieldCallback(bool global_gc) { } } if (global_gc) { - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } else { - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); } CHECK_EQ(1729, t1->x()); @@ -7938,9 +7949,9 @@ void v8::internal::HeapTester::ResetWeakHandle(bool global_gc) { object_a.handle.Reset(iso, a); object_b.handle.Reset(iso, b); if (global_gc) { - CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); } else { - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); } } @@ -7956,9 +7967,9 @@ void v8::internal::HeapTester::ResetWeakHandle(bool global_gc) { CHECK(object_b.handle.IsIndependent()); } if (global_gc) { - CcTest::heap()->CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); } else { - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); } CHECK(object_a.flag); CHECK(object_b.flag); @@ -7970,12 +7981,11 @@ THREADED_HEAP_TEST(ResetWeakHandle) { v8::internal::HeapTester::ResetWeakHandle(true); } +static void InvokeScavenge() { CcTest::CollectGarbage(i::NEW_SPACE); } -static void InvokeScavenge() { CcTest::heap()->CollectGarbage(i::NEW_SPACE); } - - -static void InvokeMarkSweep() { CcTest::heap()->CollectAllGarbage(); } - +static void InvokeMarkSweep() { + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); +} static void ForceScavenge2( const v8::WeakCallbackInfo<FlagAndPersistent>& data) { @@ -8051,7 +8061,7 @@ static void ArgumentsTestCallback( CHECK(v8::Integer::New(isolate, 3)->Equals(context, args[2]).FromJust()); CHECK(v8::Undefined(isolate)->Equals(context, args[3]).FromJust()); v8::HandleScope scope(args.GetIsolate()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -9381,7 +9391,7 @@ static bool security_check_with_gc_called; static bool SecurityTestCallbackWithGC(Local<v8::Context> accessing_context, Local<v8::Object> accessed_object, Local<v8::Value> data) { - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); security_check_with_gc_called = true; return true; } @@ -12169,7 +12179,7 @@ static void InterceptorCallICFastApi( reinterpret_cast<int*>(v8::External::Cast(*info.Data())->Value()); ++(*call_count); if ((*call_count) % 20 == 0) { - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } } @@ -12226,8 +12236,8 @@ static void GenerateSomeGarbage() { void DirectApiCallback(const v8::FunctionCallbackInfo<v8::Value>& args) { static int count = 0; if (count++ % 3 == 0) { - CcTest::heap()->CollectAllGarbage(); - // This should move the stub + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + // This should move the stub GenerateSomeGarbage(); // This should ensure the old stub memory is flushed } } @@ -12296,7 +12306,7 @@ static int p_getter_count_3; static Local<Value> DoDirectGetter() { if (++p_getter_count_3 % 3 == 0) { - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); GenerateSomeGarbage(); } return v8_str("Direct Getter Result"); @@ -14016,8 +14026,8 @@ static void CheckSurvivingGlobalObjectsCount(int expected) { // the first garbage collection but some of the maps have already // been marked at that point. Therefore some of the maps are not // collected until the second garbage collection. - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(i::Heap::kMakeHeapIterableMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kMakeHeapIterableMask); int count = GetGlobalObjectsCount(); #ifdef DEBUG if (count != expected) CcTest::heap()->TracePathToGlobal(); @@ -14118,7 +14128,8 @@ TEST(WeakCallbackApi) { handle, WeakApiCallback, v8::WeakCallbackType::kParameter); } reinterpret_cast<i::Isolate*>(isolate)->heap()->CollectAllGarbage( - i::Heap::kAbortIncrementalMarkingMask); + i::Heap::kAbortIncrementalMarkingMask, + i::GarbageCollectionReason::kTesting); // Verify disposed. CHECK_EQ(initial_handles, globals->global_handles_count()); } @@ -14160,7 +14171,7 @@ THREADED_TEST(NewPersistentHandleFromWeakCallback) { handle1.SetWeak(&handle1, NewPersistentHandleCallback1, v8::WeakCallbackType::kParameter); handle2.Reset(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -14170,7 +14181,7 @@ v8::Persistent<v8::Object> to_be_disposed; void DisposeAndForceGcCallback2( const v8::WeakCallbackInfo<v8::Persistent<v8::Object>>& data) { to_be_disposed.Reset(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -14194,7 +14205,7 @@ THREADED_TEST(DoNotUseDeletedNodesInSecondLevelGc) { handle1.SetWeak(&handle1, DisposeAndForceGcCallback1, v8::WeakCallbackType::kParameter); to_be_disposed.Reset(isolate, handle2); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } void DisposingCallback( @@ -14232,7 +14243,7 @@ THREADED_TEST(NoGlobalHandlesOrphaningDueToWeakCallback) { v8::WeakCallbackType::kParameter); handle3.SetWeak(&handle3, HandleCreatingCallback1, v8::WeakCallbackType::kParameter); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); EmptyMessageQueues(isolate); } @@ -14282,11 +14293,6 @@ THREADED_TEST(NestedHandleScopeAndContexts) { } -static bool MatchPointers(void* key1, void* key2) { - return key1 == key2; -} - - struct SymbolInfo { size_t id; size_t size; @@ -14793,14 +14799,14 @@ UNINITIALIZED_TEST(SetJitCodeEventHandler) { i::Heap* heap = i_isolate->heap(); // Start with a clean slate. - heap->CollectAllAvailableGarbage("TestSetJitCodeEventHandler_Prepare"); + heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); { v8::HandleScope scope(isolate); - v8::base::HashMap code(MatchPointers); + v8::base::HashMap code; code_map = &code; - v8::base::HashMap lineinfo(MatchPointers); + v8::base::HashMap lineinfo; jitcode_line_info = &lineinfo; saw_bar = 0; @@ -14837,7 +14843,7 @@ UNINITIALIZED_TEST(SetJitCodeEventHandler) { } // Force code movement. - heap->CollectAllAvailableGarbage("TestSetJitCodeEventHandler_Move"); + heap->CollectAllAvailableGarbage(i::GarbageCollectionReason::kTesting); isolate->SetJitCodeEventHandler(v8::kJitCodeEventDefault, NULL); @@ -14863,10 +14869,10 @@ UNINITIALIZED_TEST(SetJitCodeEventHandler) { CompileRun(script); // Now get code through initial iteration. - v8::base::HashMap code(MatchPointers); + v8::base::HashMap code; code_map = &code; - v8::base::HashMap lineinfo(MatchPointers); + v8::base::HashMap lineinfo; jitcode_line_info = &lineinfo; isolate->SetJitCodeEventHandler(v8::kJitCodeEventEnumExisting, @@ -14887,8 +14893,7 @@ UNINITIALIZED_TEST(SetJitCodeEventHandler) { isolate->Dispose(); } - -THREADED_TEST(ExternalAllocatedMemory) { +TEST(ExternalAllocatedMemory) { v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope outer(isolate); v8::Local<Context> env(Context::New(isolate)); @@ -14899,7 +14904,8 @@ THREADED_TEST(ExternalAllocatedMemory) { isolate->AdjustAmountOfExternalAllocatedMemory(kSize)); CHECK_EQ(baseline, isolate->AdjustAmountOfExternalAllocatedMemory(-kSize)); - const int64_t kTriggerGCSize = i::kExternalAllocationLimit + 1; + const int64_t kTriggerGCSize = + CcTest::i_isolate()->heap()->external_memory_hard_limit() + 1; CHECK_EQ(baseline + kTriggerGCSize, isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize)); CHECK_EQ(baseline, @@ -14911,7 +14917,8 @@ TEST(Regress51719) { i::FLAG_incremental_marking = false; CcTest::InitializeVM(); - const int64_t kTriggerGCSize = i::kExternalAllocationLimit + 1; + const int64_t kTriggerGCSize = + CcTest::i_isolate()->heap()->external_memory_hard_limit() + 1; v8::Isolate* isolate = CcTest::isolate(); isolate->AdjustAmountOfExternalAllocatedMemory(kTriggerGCSize); } @@ -16004,6 +16011,292 @@ TEST(DefineOwnProperty) { } } +TEST(DefineProperty) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope handle_scope(isolate); + + v8::Local<v8::Name> p; + + CompileRun( + "var a = {};" + "var b = [];" + "Object.defineProperty(a, 'v1', {value: 23});" + "Object.defineProperty(a, 'v2', {value: 23, configurable: true});"); + + v8::Local<v8::Object> obj = v8::Local<v8::Object>::Cast( + env->Global()->Get(env.local(), v8_str("a")).ToLocalChecked()); + v8::Local<v8::Array> arr = v8::Local<v8::Array>::Cast( + env->Global()->Get(env.local(), v8_str("b")).ToLocalChecked()); + + v8::PropertyDescriptor desc(v8_num(42)); + { + // Use a data descriptor. + + // Cannot change a non-configurable property. + p = v8_str("v1"); + v8::TryCatch try_catch(isolate); + CHECK(!obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(!try_catch.HasCaught()); + v8::Local<v8::Value> val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK(val->IsNumber()); + CHECK_EQ(23.0, val->NumberValue(env.local()).FromJust()); + + // Change a configurable property. + p = v8_str("v2"); + obj->DefineProperty(env.local(), p, desc).FromJust(); + CHECK(obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(!try_catch.HasCaught()); + val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK(val->IsNumber()); + CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust()); + + // Check that missing writable has default value false. + p = v8_str("v12"); + CHECK(obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(!try_catch.HasCaught()); + val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK(val->IsNumber()); + CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust()); + v8::PropertyDescriptor desc2(v8_num(43)); + CHECK(!obj->DefineProperty(env.local(), p, desc2).FromJust()); + val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust()); + CHECK(!try_catch.HasCaught()); + } + + { + // Set a regular property. + p = v8_str("v3"); + v8::TryCatch try_catch(isolate); + CHECK(obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(!try_catch.HasCaught()); + v8::Local<v8::Value> val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK(val->IsNumber()); + CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust()); + } + + { + // Set an indexed property. + v8::TryCatch try_catch(isolate); + CHECK(obj->DefineProperty(env.local(), v8_str("1"), desc).FromJust()); + CHECK(!try_catch.HasCaught()); + v8::Local<v8::Value> val = obj->Get(env.local(), 1).ToLocalChecked(); + CHECK(val->IsNumber()); + CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust()); + } + + { + // No special case when changing array length. + v8::TryCatch try_catch(isolate); + // Use a writable descriptor, otherwise the next test, that changes + // the array length will fail. + v8::PropertyDescriptor desc(v8_num(42), true); + CHECK(arr->DefineProperty(env.local(), v8_str("length"), desc).FromJust()); + CHECK(!try_catch.HasCaught()); + } + + { + // Special cases for arrays: index exceeds the array's length. + v8::TryCatch try_catch(isolate); + CHECK(arr->DefineProperty(env.local(), v8_str("100"), desc).FromJust()); + CHECK(!try_catch.HasCaught()); + CHECK_EQ(101U, arr->Length()); + v8::Local<v8::Value> val = arr->Get(env.local(), 100).ToLocalChecked(); + CHECK(val->IsNumber()); + CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust()); + + // Set an existing entry. + CHECK(arr->DefineProperty(env.local(), v8_str("0"), desc).FromJust()); + CHECK(!try_catch.HasCaught()); + val = arr->Get(env.local(), 0).ToLocalChecked(); + CHECK(val->IsNumber()); + CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust()); + } + + { + // Use a generic descriptor. + v8::PropertyDescriptor desc_generic; + + p = v8_str("v4"); + v8::TryCatch try_catch(isolate); + CHECK(obj->DefineProperty(env.local(), p, desc_generic).FromJust()); + CHECK(!try_catch.HasCaught()); + v8::Local<v8::Value> val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK(val->IsUndefined()); + + obj->Set(env.local(), p, v8_num(1)).FromJust(); + CHECK(!try_catch.HasCaught()); + + val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK(val->IsUndefined()); + CHECK(!try_catch.HasCaught()); + } + + { + // Use a data descriptor with undefined value. + v8::PropertyDescriptor desc_empty(v8::Undefined(isolate)); + + v8::TryCatch try_catch(isolate); + CHECK(obj->DefineProperty(env.local(), p, desc_empty).FromJust()); + CHECK(!try_catch.HasCaught()); + v8::Local<v8::Value> val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK(val->IsUndefined()); + CHECK(!try_catch.HasCaught()); + } + + { + // Use a descriptor with attribute == v8::ReadOnly. + v8::PropertyDescriptor desc_read_only(v8_num(42), false); + desc_read_only.set_enumerable(true); + desc_read_only.set_configurable(true); + + p = v8_str("v5"); + v8::TryCatch try_catch(isolate); + CHECK(obj->DefineProperty(env.local(), p, desc_read_only).FromJust()); + CHECK(!try_catch.HasCaught()); + v8::Local<v8::Value> val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK(val->IsNumber()); + CHECK_EQ(42.0, val->NumberValue(env.local()).FromJust()); + CHECK_EQ(v8::ReadOnly, + obj->GetPropertyAttributes(env.local(), p).FromJust()); + CHECK(!try_catch.HasCaught()); + } + + { + // Use an accessor descriptor with empty handles. + v8::PropertyDescriptor desc_empty(v8::Undefined(isolate), + v8::Undefined(isolate)); + + p = v8_str("v6"); + v8::TryCatch try_catch(isolate); + CHECK(obj->DefineProperty(env.local(), p, desc_empty).FromJust()); + CHECK(!try_catch.HasCaught()); + v8::Local<v8::Value> val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK(val->IsUndefined()); + CHECK(!try_catch.HasCaught()); + } + + { + // Use an accessor descriptor. + CompileRun( + "var set = function(x) {this.val = 2*x;};" + "var get = function() {return this.val || 0;};"); + + v8::Local<v8::Function> get = v8::Local<v8::Function>::Cast( + env->Global()->Get(env.local(), v8_str("get")).ToLocalChecked()); + v8::Local<v8::Function> set = v8::Local<v8::Function>::Cast( + env->Global()->Get(env.local(), v8_str("set")).ToLocalChecked()); + v8::PropertyDescriptor desc(get, set); + + p = v8_str("v7"); + v8::TryCatch try_catch(isolate); + CHECK(obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(!try_catch.HasCaught()); + + v8::Local<v8::Value> val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK(val->IsNumber()); + CHECK_EQ(0.0, val->NumberValue(env.local()).FromJust()); + CHECK(!try_catch.HasCaught()); + + obj->Set(env.local(), p, v8_num(7)).FromJust(); + CHECK(!try_catch.HasCaught()); + + val = obj->Get(env.local(), p).ToLocalChecked(); + CHECK(val->IsNumber()); + CHECK_EQ(14.0, val->NumberValue(env.local()).FromJust()); + CHECK(!try_catch.HasCaught()); + } + + { + // Redefine an existing property. + + // desc = {value: 42, enumerable: true} + v8::PropertyDescriptor desc(v8_num(42)); + desc.set_enumerable(true); + + p = v8_str("v8"); + v8::TryCatch try_catch(isolate); + CHECK(obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(!try_catch.HasCaught()); + + // desc = {enumerable: true} + v8::PropertyDescriptor desc_true((v8::Local<v8::Value>())); + desc_true.set_enumerable(true); + + // Successful redefinition because all present attributes have the same + // value as the current descriptor. + CHECK(obj->DefineProperty(env.local(), p, desc_true).FromJust()); + CHECK(!try_catch.HasCaught()); + + // desc = {} + v8::PropertyDescriptor desc_empty; + // Successful redefinition because no attributes are overwritten in the + // current descriptor. + CHECK(obj->DefineProperty(env.local(), p, desc_empty).FromJust()); + CHECK(!try_catch.HasCaught()); + + // desc = {enumerable: false} + v8::PropertyDescriptor desc_false((v8::Local<v8::Value>())); + desc_false.set_enumerable(false); + // Not successful because we cannot define a different value for enumerable. + CHECK(!obj->DefineProperty(env.local(), p, desc_false).FromJust()); + CHECK(!try_catch.HasCaught()); + } + + { + // Redefine a property that has a getter. + CompileRun("var get = function() {};"); + v8::Local<v8::Function> get = v8::Local<v8::Function>::Cast( + env->Global()->Get(env.local(), v8_str("get")).ToLocalChecked()); + + // desc = {get: function() {}} + v8::PropertyDescriptor desc(get, v8::Local<v8::Function>()); + v8::TryCatch try_catch(isolate); + + p = v8_str("v9"); + CHECK(obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(!try_catch.HasCaught()); + + // desc_empty = {} + // Successful because we are not redefining the current getter. + v8::PropertyDescriptor desc_empty; + CHECK(obj->DefineProperty(env.local(), p, desc_empty).FromJust()); + CHECK(!try_catch.HasCaught()); + + // desc = {get: function() {}} + // Successful because we redefine the getter with its current value. + CHECK(obj->DefineProperty(env.local(), p, desc).FromJust()); + CHECK(!try_catch.HasCaught()); + + // desc = {get: undefined} + v8::PropertyDescriptor desc_undefined(v8::Undefined(isolate), + v8::Local<v8::Function>()); + // Not successful because we cannot redefine with the current value of get + // with undefined. + CHECK(!obj->DefineProperty(env.local(), p, desc_undefined).FromJust()); + CHECK(!try_catch.HasCaught()); + } + + CompileRun("Object.freeze(a);"); + { + // We cannot change non-extensible objects. + v8::TryCatch try_catch(isolate); + CHECK(!obj->DefineProperty(env.local(), v8_str("v10"), desc).FromJust()); + CHECK(!try_catch.HasCaught()); + } + + v8::Local<v8::ObjectTemplate> templ = v8::ObjectTemplate::New(isolate); + templ->SetAccessCheckCallback(AccessAlwaysBlocked); + v8::Local<v8::Object> access_checked = + templ->NewInstance(env.local()).ToLocalChecked(); + { + v8::TryCatch try_catch(isolate); + CHECK(access_checked->DefineProperty(env.local(), v8_str("v11"), desc) + .IsNothing()); + CHECK(try_catch.HasCaught()); + } +} THREADED_TEST(GetCurrentContextWhenNotInContext) { i::Isolate* isolate = CcTest::i_isolate(); @@ -16177,7 +16470,7 @@ static void ObjectWithExternalArrayTestHelper(Local<Context> context, "}" "sum;"); // Force GC to trigger verification. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(28, result->Int32Value(context).FromJust()); // Make sure out-of-range loads do not throw. @@ -16393,12 +16686,12 @@ static void FixedTypedArrayTestHelper(i::ExternalArrayType array_type, CHECK_EQ(FixedTypedArrayClass::kInstanceType, fixed_array->map()->instance_type()); CHECK_EQ(kElementCount, fixed_array->length()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); for (int i = 0; i < kElementCount; i++) { fixed_array->set(i, static_cast<ElementType>(i)); } // Force GC to trigger verification. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); for (int i = 0; i < kElementCount; i++) { CHECK_EQ(static_cast<int64_t>(static_cast<ElementType>(i)), static_cast<int64_t>(fixed_array->get_scalar(i))); @@ -16588,10 +16881,10 @@ THREADED_TEST(SkipArrayBufferBackingStoreDuringGC) { Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, store_ptr, 8); // Should not crash - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now + CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Should not move the pointer CHECK_EQ(ab->GetContents().Data(), store_ptr); @@ -16609,15 +16902,15 @@ THREADED_TEST(SkipArrayBufferDuringScavenge) { reinterpret_cast<uint8_t*>(*reinterpret_cast<uintptr_t*>(*tmp)); // Make `store_ptr` point to from space - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); // Create ArrayBuffer with pointer-that-cannot-be-visited in the backing store Local<v8::ArrayBuffer> ab = v8::ArrayBuffer::New(isolate, store_ptr, 8); // Should not crash, // i.e. backing store pointer should not be treated as a heap object pointer - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in survivor space now - CcTest::heap()->CollectGarbage(i::NEW_SPACE); // in old gen now + CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now + CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now // Use `ab` to silence compiler warning CHECK_EQ(ab->GetContents().Data(), store_ptr); @@ -17918,7 +18211,8 @@ TEST(TestIdleNotification) { bool finished = false; for (int i = 0; i < 200 && !finished; i++) { if (i < 10 && CcTest::heap()->incremental_marking()->IsStopped()) { - CcTest::heap()->StartIdleIncrementalMarking(); + CcTest::heap()->StartIdleIncrementalMarking( + i::GarbageCollectionReason::kTesting); } finished = env->GetIsolate()->IdleNotificationDeadline( (v8::base::TimeTicks::HighResolutionNow().ToInternalValue() / @@ -17937,7 +18231,7 @@ TEST(TestIdleNotification) { TEST(Regress2333) { LocalContext env; for (int i = 0; i < 3; i++) { - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); } } @@ -18075,7 +18369,7 @@ TEST(ExternalizeOldSpaceTwoByteCons) { ->ToString(env.local()) .ToLocalChecked(); CHECK(v8::Utils::OpenHandle(*cons)->IsConsString()); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK(CcTest::heap()->old_space()->Contains(*v8::Utils::OpenHandle(*cons))); TestResource* resource = new TestResource( @@ -18099,7 +18393,7 @@ TEST(ExternalizeOldSpaceOneByteCons) { ->ToString(env.local()) .ToLocalChecked(); CHECK(v8::Utils::OpenHandle(*cons)->IsConsString()); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK(CcTest::heap()->old_space()->Contains(*v8::Utils::OpenHandle(*cons))); TestOneByteResource* resource = @@ -18143,7 +18437,7 @@ TEST(VisitExternalStrings) { v8::Local<v8::String> string3 = v8::String::NewExternalTwoByte(env->GetIsolate(), resource[3]) .ToLocalChecked(); - CcTest::heap()->CollectAllAvailableGarbage(); // Tenure string. + CcTest::CollectAllAvailableGarbage(); // Tenure string. // Turn into a symbol. i::Handle<i::String> string3_i = v8::Utils::OpenHandle(*string3); CHECK(!CcTest::i_isolate()->factory()->InternalizeString( @@ -18230,7 +18524,7 @@ TEST(ExternalInternalizedStringCollectedAtGC) { // Garbage collector deals swift blows to evil. CcTest::i_isolate()->compilation_cache()->Clear(); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); // Ring has been destroyed. Free Peoples of Middle-earth Rejoice. CHECK_EQ(1, destroyed); @@ -18431,7 +18725,7 @@ TEST(Regress528) { other_context->Enter(); CompileRun(source_simple); other_context->Exit(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); if (GetGlobalObjectsCount() == 1) break; } CHECK_GE(2, gc_count); @@ -18453,7 +18747,7 @@ TEST(Regress528) { other_context->Enter(); CompileRun(source_eval); other_context->Exit(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); if (GetGlobalObjectsCount() == 1) break; } CHECK_GE(2, gc_count); @@ -18480,7 +18774,7 @@ TEST(Regress528) { other_context->Enter(); CompileRun(source_exception); other_context->Exit(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); if (GetGlobalObjectsCount() == 1) break; } CHECK_GE(2, gc_count); @@ -19097,8 +19391,7 @@ void PrologueCallbackAlloc(v8::Isolate* isolate, Local<Object> obj = Object::New(isolate); CHECK(!obj.IsEmpty()); - CcTest::heap()->CollectAllGarbage( - i::Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); } @@ -19117,8 +19410,7 @@ void EpilogueCallbackAlloc(v8::Isolate* isolate, Local<Object> obj = Object::New(isolate); CHECK(!obj.IsEmpty()); - CcTest::heap()->CollectAllGarbage( - i::Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); } @@ -19131,26 +19423,26 @@ TEST(GCCallbacksOld) { context->GetIsolate()->AddGCEpilogueCallback(EpilogueCallback); CHECK_EQ(0, prologue_call_count); CHECK_EQ(0, epilogue_call_count); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(1, prologue_call_count); CHECK_EQ(1, epilogue_call_count); context->GetIsolate()->AddGCPrologueCallback(PrologueCallbackSecond); context->GetIsolate()->AddGCEpilogueCallback(EpilogueCallbackSecond); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(2, prologue_call_count); CHECK_EQ(2, epilogue_call_count); CHECK_EQ(1, prologue_call_count_second); CHECK_EQ(1, epilogue_call_count_second); context->GetIsolate()->RemoveGCPrologueCallback(PrologueCallback); context->GetIsolate()->RemoveGCEpilogueCallback(EpilogueCallback); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(2, prologue_call_count); CHECK_EQ(2, epilogue_call_count); CHECK_EQ(2, prologue_call_count_second); CHECK_EQ(2, epilogue_call_count_second); context->GetIsolate()->RemoveGCPrologueCallback(PrologueCallbackSecond); context->GetIsolate()->RemoveGCEpilogueCallback(EpilogueCallbackSecond); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(2, prologue_call_count); CHECK_EQ(2, epilogue_call_count); CHECK_EQ(2, prologue_call_count_second); @@ -19166,26 +19458,26 @@ TEST(GCCallbacks) { isolate->AddGCEpilogueCallback(EpilogueCallback); CHECK_EQ(0, prologue_call_count); CHECK_EQ(0, epilogue_call_count); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(1, prologue_call_count); CHECK_EQ(1, epilogue_call_count); isolate->AddGCPrologueCallback(PrologueCallbackSecond); isolate->AddGCEpilogueCallback(EpilogueCallbackSecond); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(2, prologue_call_count); CHECK_EQ(2, epilogue_call_count); CHECK_EQ(1, prologue_call_count_second); CHECK_EQ(1, epilogue_call_count_second); isolate->RemoveGCPrologueCallback(PrologueCallback); isolate->RemoveGCEpilogueCallback(EpilogueCallback); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(2, prologue_call_count); CHECK_EQ(2, epilogue_call_count); CHECK_EQ(2, prologue_call_count_second); CHECK_EQ(2, epilogue_call_count_second); isolate->RemoveGCPrologueCallback(PrologueCallbackSecond); isolate->RemoveGCEpilogueCallback(EpilogueCallbackSecond); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(2, prologue_call_count); CHECK_EQ(2, epilogue_call_count); CHECK_EQ(2, prologue_call_count_second); @@ -19195,8 +19487,7 @@ TEST(GCCallbacks) { CHECK_EQ(0, epilogue_call_count_alloc); isolate->AddGCPrologueCallback(PrologueCallbackAlloc); isolate->AddGCEpilogueCallback(EpilogueCallbackAlloc); - CcTest::heap()->CollectAllGarbage( - i::Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); CHECK_EQ(1, prologue_call_count_alloc); CHECK_EQ(1, epilogue_call_count_alloc); isolate->RemoveGCPrologueCallback(PrologueCallbackAlloc); @@ -19374,7 +19665,7 @@ TEST(ContainsOnlyOneByte) { void FailedAccessCheckCallbackGC(Local<v8::Object> target, v8::AccessType type, Local<v8::Value> data) { - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CcTest::isolate()->ThrowException( v8::Exception::Error(v8_str("cross context"))); } @@ -19817,12 +20108,10 @@ class InitDefaultIsolateThread : public v8::base::Thread { void Run() { v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); - const intptr_t pageSizeMult = - v8::internal::Page::kPageSize / v8::internal::MB; switch (testCase_) { case SetResourceConstraints: { - create_params.constraints.set_max_semi_space_size(1 * pageSizeMult); - create_params.constraints.set_max_old_space_size(4 * pageSizeMult); + create_params.constraints.set_max_semi_space_size(1); + create_params.constraints.set_max_old_space_size(6); break; } default: @@ -19999,7 +20288,7 @@ TEST(DontDeleteCellLoadIC) { "})()", "ReferenceError: cell is not defined"); CompileRun("cell = \"new_second\";"); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); ExpectString("readCell()", "new_second"); ExpectString("readCell()", "new_second"); } @@ -20069,8 +20358,8 @@ TEST(PersistentHandleInNewSpaceVisitor) { object1.SetWrapperClassId(42); CHECK_EQ(42, object1.WrapperClassId()); - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); v8::Persistent<v8::Object> object2(isolate, v8::Object::New(isolate)); CHECK_EQ(0, object2.WrapperClassId()); @@ -20747,7 +21036,7 @@ THREADED_TEST(Regress1516) { CHECK_LE(1, elements); // We have to abort incremental marking here to abandon black pages. - CcTest::heap()->CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kAbortIncrementalMarkingMask); CHECK_GT(elements, CountLiveMapsInMapCache(CcTest::i_isolate()->context())); } @@ -21488,12 +21777,15 @@ int* LookupCounter(const char* name) { const char* kMegamorphicTestProgram = "function CreateClass(name) {\n" " var src = \n" - " ` function ${name}() {};` +\n" + " ` function ${name}() { this.a = 0; };` +\n" " ` ${name}.prototype.foo = function() {};` +\n" " ` ${name};\\n`;\n" " return (0, eval)(src);\n" "}\n" - "function fooify(obj) { obj.foo(); };\n" + "function trigger_ics(obj, v) {\n" + " obj.foo();\n" + " obj.a = v;\n" + "};\n" "var objs = [];\n" "for (var i = 0; i < 50; i++) {\n" " var Class = CreateClass('Class' + i);\n" @@ -21502,7 +21794,7 @@ const char* kMegamorphicTestProgram = "}\n" "for (var i = 0; i < 1000; i++) {\n" " for (var obj of objs) {\n" - " fooify(obj);\n" + " trigger_ics(obj, 1);\n" " }\n" "}\n"; @@ -21538,6 +21830,7 @@ void TestStubCache(bool primary) { i::CodeStub::LoadICTF, i::CodeStub::LoadICTrampolineTF, i::CodeStub::KeyedLoadIC, i::CodeStub::KeyedLoadICTrampoline, i::CodeStub::StoreIC, i::CodeStub::StoreICTrampoline, + i::CodeStub::StoreICTF, i::CodeStub::StoreICTrampolineTF, i::CodeStub::KeyedStoreIC, i::CodeStub::KeyedStoreICTrampoline, }; i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); @@ -21558,17 +21851,18 @@ void TestStubCache(bool primary) { int updates = updates_counter - initial_updates; const int kClassesCount = 50; const int kIterationsCount = 1000; - CHECK_LE(kClassesCount, updates); + const int kICKinds = 2; // LoadIC and StoreIC + CHECK_LE(kClassesCount * kICKinds, updates); // Check that updates and misses counts are bounded. // If there are too many updates then most likely the stub cache does not // work properly. - CHECK_LE(updates, kClassesCount * 2); - CHECK_LE(1, misses); - CHECK_LE(misses, kClassesCount * 2); + CHECK_LE(updates, kClassesCount * 2 * kICKinds); + CHECK_LE(kICKinds, misses); + CHECK_LE(misses, kClassesCount * 2 * kICKinds); // 2 is for PREMONOMORPHIC and MONOMORPHIC states, // 4 is for POLYMORPHIC states, // and all the others probes are for MEGAMORPHIC state. - CHECK_EQ(kIterationsCount * kClassesCount - 2 - 4, probes); + CHECK_EQ((kIterationsCount * kClassesCount - 2 - 4) * kICKinds, probes); } isolate->Dispose(); } @@ -23339,6 +23633,140 @@ TEST(EventLogging) { CHECK_EQ(1, last_event_status); } +TEST(PropertyDescriptor) { + LocalContext context; + v8::Isolate* isolate = context->GetIsolate(); + v8::HandleScope scope(isolate); + + { // empty descriptor + v8::PropertyDescriptor desc; + CHECK(!desc.has_value()); + CHECK(!desc.has_set()); + CHECK(!desc.has_get()); + CHECK(!desc.has_enumerable()); + CHECK(!desc.has_configurable()); + CHECK(!desc.has_writable()); + } + { + // data descriptor + v8::PropertyDescriptor desc(v8_num(42)); + desc.set_enumerable(false); + CHECK(desc.value() == v8_num(42)); + CHECK(desc.has_value()); + CHECK(!desc.has_set()); + CHECK(!desc.has_get()); + CHECK(desc.has_enumerable()); + CHECK(!desc.enumerable()); + CHECK(!desc.has_configurable()); + CHECK(!desc.has_writable()); + } + { + // data descriptor + v8::PropertyDescriptor desc(v8_num(42)); + desc.set_configurable(true); + CHECK(desc.value() == v8_num(42)); + CHECK(desc.has_value()); + CHECK(!desc.has_set()); + CHECK(!desc.has_get()); + CHECK(desc.has_configurable()); + CHECK(desc.configurable()); + CHECK(!desc.has_enumerable()); + CHECK(!desc.has_writable()); + } + { + // data descriptor + v8::PropertyDescriptor desc(v8_num(42)); + desc.set_configurable(false); + CHECK(desc.value() == v8_num(42)); + CHECK(desc.has_value()); + CHECK(!desc.has_set()); + CHECK(!desc.has_get()); + CHECK(desc.has_configurable()); + CHECK(!desc.configurable()); + CHECK(!desc.has_enumerable()); + CHECK(!desc.has_writable()); + } + { + // data descriptor + v8::PropertyDescriptor desc(v8_num(42), false); + CHECK(desc.value() == v8_num(42)); + CHECK(desc.has_value()); + CHECK(!desc.has_set()); + CHECK(!desc.has_get()); + CHECK(!desc.has_enumerable()); + CHECK(!desc.has_configurable()); + CHECK(desc.has_writable()); + CHECK(!desc.writable()); + } + { + // data descriptor + v8::PropertyDescriptor desc(v8::Local<v8::Value>(), true); + CHECK(!desc.has_value()); + CHECK(!desc.has_set()); + CHECK(!desc.has_get()); + CHECK(!desc.has_enumerable()); + CHECK(!desc.has_configurable()); + CHECK(desc.has_writable()); + CHECK(desc.writable()); + } + { + // accessor descriptor + CompileRun("var set = function() {return 43;};"); + + v8::Local<v8::Function> set = + v8::Local<v8::Function>::Cast(context->Global() + ->Get(context.local(), v8_str("set")) + .ToLocalChecked()); + v8::PropertyDescriptor desc(v8::Undefined(isolate), set); + desc.set_configurable(false); + CHECK(!desc.has_value()); + CHECK(desc.has_get()); + CHECK(desc.get() == v8::Undefined(isolate)); + CHECK(desc.has_set()); + CHECK(desc.set() == set); + CHECK(!desc.has_enumerable()); + CHECK(desc.has_configurable()); + CHECK(!desc.configurable()); + CHECK(!desc.has_writable()); + } + { + // accessor descriptor with Proxy + CompileRun( + "var set = new Proxy(function() {}, {});" + "var get = undefined;"); + + v8::Local<v8::Value> get = + v8::Local<v8::Value>::Cast(context->Global() + ->Get(context.local(), v8_str("get")) + .ToLocalChecked()); + v8::Local<v8::Function> set = + v8::Local<v8::Function>::Cast(context->Global() + ->Get(context.local(), v8_str("set")) + .ToLocalChecked()); + v8::PropertyDescriptor desc(get, set); + desc.set_configurable(false); + CHECK(!desc.has_value()); + CHECK(desc.get() == v8::Undefined(isolate)); + CHECK(desc.has_get()); + CHECK(desc.set() == set); + CHECK(desc.has_set()); + CHECK(!desc.has_enumerable()); + CHECK(desc.has_configurable()); + CHECK(!desc.configurable()); + CHECK(!desc.has_writable()); + } + { + // accessor descriptor with empty function handle + v8::Local<v8::Function> get = v8::Local<v8::Function>(); + v8::PropertyDescriptor desc(get, get); + CHECK(!desc.has_value()); + CHECK(!desc.has_get()); + CHECK(!desc.has_set()); + CHECK(!desc.has_enumerable()); + CHECK(!desc.has_configurable()); + CHECK(!desc.has_writable()); + } +} TEST(Promises) { LocalContext context; @@ -24141,7 +24569,7 @@ TEST(StreamingUtf8ScriptWithSplitCharactersValidEdgeCases) { TEST(StreamingUtf8ScriptWithSplitCharactersInvalidEdgeCases) { // Test cases where a UTF-8 character is split over several chunks. Those // cases are not supported (the embedder should give the data in big enough - // chunks), but we shouldn't crash, just produce a parse error. + // chunks), but we shouldn't crash and parse this just fine. const char* reference = "\xec\x92\x81"; char chunk1[] = "function foo() {\n" @@ -24158,7 +24586,7 @@ TEST(StreamingUtf8ScriptWithSplitCharactersInvalidEdgeCases) { chunk3[0] = reference[2]; const char* chunks[] = {chunk1, chunk2, chunk3, "foo();", NULL}; - RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8, false); + RunStreamingTest(chunks, v8::ScriptCompiler::StreamedSource::UTF8); } diff --git a/deps/v8/test/cctest/test-api.h b/deps/v8/test/cctest/test-api.h index f9a335a7f4..6194a11405 100644 --- a/deps/v8/test/cctest/test-api.h +++ b/deps/v8/test/cctest/test-api.h @@ -4,6 +4,7 @@ #include "src/v8.h" +#include "src/api.h" #include "src/isolate.h" #include "src/vm-state.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-array-list.cc b/deps/v8/test/cctest/test-array-list.cc index abcbf110e7..9f2970dd6c 100644 --- a/deps/v8/test/cctest/test-array-list.cc +++ b/deps/v8/test/cctest/test-array-list.cc @@ -7,6 +7,13 @@ #include "src/v8.h" #include "src/factory.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" namespace { diff --git a/deps/v8/test/cctest/test-assembler-arm.cc b/deps/v8/test/cctest/test-assembler-arm.cc index 93a19c1a14..de024f8869 100644 --- a/deps/v8/test/cctest/test-assembler-arm.cc +++ b/deps/v8/test/cctest/test-assembler-arm.cc @@ -30,11 +30,11 @@ #include "src/v8.h" #include "test/cctest/cctest.h" -#include "src/arm/assembler-arm-inl.h" #include "src/arm/simulator-arm.h" #include "src/base/utils/random-number-generator.h" #include "src/disassembler.h" #include "src/factory.h" +#include "src/macro-assembler.h" #include "src/ostreams.h" using namespace v8::base; @@ -244,9 +244,8 @@ TEST(4) { Assembler assm(isolate, NULL, 0); Label L, C; - - if (CpuFeatures::IsSupported(VFP3)) { - CpuFeatureScope scope(&assm, VFP3); + if (CpuFeatures::IsSupported(VFPv3)) { + CpuFeatureScope scope(&assm, VFPv3); __ mov(ip, Operand(sp)); __ stm(db_w, sp, r4.bit() | fp.bit() | lr.bit()); @@ -267,12 +266,12 @@ TEST(4) { // Load t.x and t.y, switch values, and store back to the struct. __ vldr(s0, r4, offsetof(T, x)); - __ vldr(s31, r4, offsetof(T, y)); - __ vmov(s16, s0); - __ vmov(s0, s31); - __ vmov(s31, s16); + __ vldr(s1, r4, offsetof(T, y)); + __ vmov(s2, s0); + __ vmov(s0, s1); + __ vmov(s1, s2); __ vstr(s0, r4, offsetof(T, x)); - __ vstr(s31, r4, offsetof(T, y)); + __ vstr(s1, r4, offsetof(T, y)); // Move a literal into a register that can be encoded in the instruction. __ vmov(d4, 1.0); @@ -285,13 +284,13 @@ TEST(4) { // Convert from floating point to integer. __ vmov(d4, 2.0); - __ vcvt_s32_f64(s31, d4); - __ vstr(s31, r4, offsetof(T, i)); + __ vcvt_s32_f64(s1, d4); + __ vstr(s1, r4, offsetof(T, i)); // Convert from integer to floating point. __ mov(lr, Operand(42)); - __ vmov(s31, lr); - __ vcvt_f64_s32(d4, s31); + __ vmov(s1, lr); + __ vcvt_f64_s32(d4, s1); __ vstr(d4, r4, offsetof(T, f)); // Convert from fixed point to floating point. @@ -450,62 +449,57 @@ static void TestRoundingMode(VCVTTypes types, Assembler assm(isolate, NULL, 0); - if (CpuFeatures::IsSupported(VFP3)) { - CpuFeatureScope scope(&assm, VFP3); - - Label wrong_exception; - - __ vmrs(r1); - // Set custom FPSCR. - __ bic(r2, r1, Operand(kVFPRoundingModeMask | kVFPExceptionMask)); - __ orr(r2, r2, Operand(mode)); - __ vmsr(r2); - - // Load value, convert, and move back result to r0 if everything went well. - __ vmov(d1, value); - switch (types) { - case s32_f64: - __ vcvt_s32_f64(s0, d1, kFPSCRRounding); - break; - - case u32_f64: - __ vcvt_u32_f64(s0, d1, kFPSCRRounding); - break; - - default: - UNREACHABLE(); - break; - } - // Check for vfp exceptions - __ vmrs(r2); - __ tst(r2, Operand(kVFPExceptionMask)); - // Check that we behaved as expected. - __ b(&wrong_exception, - expected_exception ? eq : ne); - // There was no exception. Retrieve the result and return. - __ vmov(r0, s0); - __ mov(pc, Operand(lr)); + Label wrong_exception; - // The exception behaviour is not what we expected. - // Load a special value and return. - __ bind(&wrong_exception); - __ mov(r0, Operand(11223344)); - __ mov(pc, Operand(lr)); + __ vmrs(r1); + // Set custom FPSCR. + __ bic(r2, r1, Operand(kVFPRoundingModeMask | kVFPExceptionMask)); + __ orr(r2, r2, Operand(mode)); + __ vmsr(r2); + + // Load value, convert, and move back result to r0 if everything went well. + __ vmov(d1, value); + switch (types) { + case s32_f64: + __ vcvt_s32_f64(s0, d1, kFPSCRRounding); + break; + + case u32_f64: + __ vcvt_u32_f64(s0, d1, kFPSCRRounding); + break; + + default: + UNREACHABLE(); + break; + } + // Check for vfp exceptions + __ vmrs(r2); + __ tst(r2, Operand(kVFPExceptionMask)); + // Check that we behaved as expected. + __ b(&wrong_exception, expected_exception ? eq : ne); + // There was no exception. Retrieve the result and return. + __ vmov(r0, s0); + __ mov(pc, Operand(lr)); - CodeDesc desc; - assm.GetCode(&desc); - Handle<Code> code = isolate->factory()->NewCode( - desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + // The exception behaviour is not what we expected. + // Load a special value and return. + __ bind(&wrong_exception); + __ mov(r0, Operand(11223344)); + __ mov(pc, Operand(lr)); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); #ifdef DEBUG - OFStream os(stdout); - code->Print(os); + OFStream os(stdout); + code->Print(os); #endif - F1 f = FUNCTION_CAST<F1>(code->entry()); - int res = - reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); - ::printf("res = %d\n", res); - CHECK_EQ(expected, res); - } + F1 f = FUNCTION_CAST<F1>(code->entry()); + int res = + reinterpret_cast<int>(CALL_GENERATED_CODE(isolate, f, 0, 0, 0, 0, 0)); + ::printf("res = %d\n", res); + CHECK_EQ(expected, res); } @@ -1051,9 +1045,8 @@ TEST(13) { Assembler assm(isolate, NULL, 0); Label L, C; - - if (CpuFeatures::IsSupported(VFP3)) { - CpuFeatureScope scope(&assm, VFP3); + if (CpuFeatures::IsSupported(VFPv3)) { + CpuFeatureScope scope(&assm, VFPv3); __ stm(db_w, sp, r4.bit() | lr.bit()); @@ -2381,6 +2374,400 @@ TEST(ARMv8_vsel) { } } +TEST(ARMv8_vminmax_f64) { + // Test the vminnm and vmaxnm floating point instructions. + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + Assembler assm(isolate, NULL, 0); + + struct Inputs { + double left_; + double right_; + }; + + struct Results { + double vminnm_; + double vmaxnm_; + }; + + if (CpuFeatures::IsSupported(ARMv8)) { + CpuFeatureScope scope(&assm, ARMv8); + + // Create a helper function: + // void TestVminmax(const Inputs* inputs, + // Results* results); + __ vldr(d1, r0, offsetof(Inputs, left_)); + __ vldr(d2, r0, offsetof(Inputs, right_)); + + __ vminnm(d0, d1, d2); + __ vstr(d0, r1, offsetof(Results, vminnm_)); + __ vmaxnm(d0, d1, d2); + __ vstr(d0, r1, offsetof(Results, vmaxnm_)); + + __ bx(lr); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); +#ifdef DEBUG + OFStream os(stdout); + code->Print(os); +#endif + F4 f = FUNCTION_CAST<F4>(code->entry()); + Object* dummy = nullptr; + USE(dummy); + +#define CHECK_VMINMAX(left, right, vminnm, vmaxnm) \ + do { \ + Inputs inputs = {left, right}; \ + Results results; \ + dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + /* Use a bit_cast to correctly identify -0.0 and NaNs. */ \ + CHECK_EQ(bit_cast<uint64_t>(vminnm), bit_cast<uint64_t>(results.vminnm_)); \ + CHECK_EQ(bit_cast<uint64_t>(vmaxnm), bit_cast<uint64_t>(results.vmaxnm_)); \ + } while (0); + + double nan_a = bit_cast<double>(UINT64_C(0x7ff8000000000001)); + double nan_b = bit_cast<double>(UINT64_C(0x7ff8000000000002)); + + CHECK_VMINMAX(1.0, -1.0, -1.0, 1.0); + CHECK_VMINMAX(-1.0, 1.0, -1.0, 1.0); + CHECK_VMINMAX(0.0, -1.0, -1.0, 0.0); + CHECK_VMINMAX(-1.0, 0.0, -1.0, 0.0); + CHECK_VMINMAX(-0.0, -1.0, -1.0, -0.0); + CHECK_VMINMAX(-1.0, -0.0, -1.0, -0.0); + CHECK_VMINMAX(0.0, 1.0, 0.0, 1.0); + CHECK_VMINMAX(1.0, 0.0, 0.0, 1.0); + + CHECK_VMINMAX(0.0, 0.0, 0.0, 0.0); + CHECK_VMINMAX(-0.0, -0.0, -0.0, -0.0); + CHECK_VMINMAX(-0.0, 0.0, -0.0, 0.0); + CHECK_VMINMAX(0.0, -0.0, -0.0, 0.0); + + CHECK_VMINMAX(0.0, nan_a, 0.0, 0.0); + CHECK_VMINMAX(nan_a, 0.0, 0.0, 0.0); + CHECK_VMINMAX(nan_a, nan_b, nan_a, nan_a); + CHECK_VMINMAX(nan_b, nan_a, nan_b, nan_b); + +#undef CHECK_VMINMAX + } +} + +TEST(ARMv8_vminmax_f32) { + // Test the vminnm and vmaxnm floating point instructions. + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + Assembler assm(isolate, NULL, 0); + + struct Inputs { + float left_; + float right_; + }; + + struct Results { + float vminnm_; + float vmaxnm_; + }; + + if (CpuFeatures::IsSupported(ARMv8)) { + CpuFeatureScope scope(&assm, ARMv8); + + // Create a helper function: + // void TestVminmax(const Inputs* inputs, + // Results* results); + __ vldr(s1, r0, offsetof(Inputs, left_)); + __ vldr(s2, r0, offsetof(Inputs, right_)); + + __ vminnm(s0, s1, s2); + __ vstr(s0, r1, offsetof(Results, vminnm_)); + __ vmaxnm(s0, s1, s2); + __ vstr(s0, r1, offsetof(Results, vmaxnm_)); + + __ bx(lr); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); +#ifdef DEBUG + OFStream os(stdout); + code->Print(os); +#endif + F4 f = FUNCTION_CAST<F4>(code->entry()); + Object* dummy = nullptr; + USE(dummy); + +#define CHECK_VMINMAX(left, right, vminnm, vmaxnm) \ + do { \ + Inputs inputs = {left, right}; \ + Results results; \ + dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + /* Use a bit_cast to correctly identify -0.0 and NaNs. */ \ + CHECK_EQ(bit_cast<uint32_t>(vminnm), bit_cast<uint32_t>(results.vminnm_)); \ + CHECK_EQ(bit_cast<uint32_t>(vmaxnm), bit_cast<uint32_t>(results.vmaxnm_)); \ + } while (0); + + float nan_a = bit_cast<float>(UINT32_C(0x7fc00001)); + float nan_b = bit_cast<float>(UINT32_C(0x7fc00002)); + + CHECK_VMINMAX(1.0f, -1.0f, -1.0f, 1.0f); + CHECK_VMINMAX(-1.0f, 1.0f, -1.0f, 1.0f); + CHECK_VMINMAX(0.0f, -1.0f, -1.0f, 0.0f); + CHECK_VMINMAX(-1.0f, 0.0f, -1.0f, 0.0f); + CHECK_VMINMAX(-0.0f, -1.0f, -1.0f, -0.0f); + CHECK_VMINMAX(-1.0f, -0.0f, -1.0f, -0.0f); + CHECK_VMINMAX(0.0f, 1.0f, 0.0f, 1.0f); + CHECK_VMINMAX(1.0f, 0.0f, 0.0f, 1.0f); + + CHECK_VMINMAX(0.0f, 0.0f, 0.0f, 0.0f); + CHECK_VMINMAX(-0.0f, -0.0f, -0.0f, -0.0f); + CHECK_VMINMAX(-0.0f, 0.0f, -0.0f, 0.0f); + CHECK_VMINMAX(0.0f, -0.0f, -0.0f, 0.0f); + + CHECK_VMINMAX(0.0f, nan_a, 0.0f, 0.0f); + CHECK_VMINMAX(nan_a, 0.0f, 0.0f, 0.0f); + CHECK_VMINMAX(nan_a, nan_b, nan_a, nan_a); + CHECK_VMINMAX(nan_b, nan_a, nan_b, nan_b); + +#undef CHECK_VMINMAX + } +} + +template <typename T, typename Inputs, typename Results> +static F4 GenerateMacroFloatMinMax(MacroAssembler& assm) { + T a = T::from_code(0); // d0/s0 + T b = T::from_code(1); // d1/s1 + T c = T::from_code(2); // d2/s2 + + // Create a helper function: + // void TestFloatMinMax(const Inputs* inputs, + // Results* results); + Label ool_min_abc, ool_min_aab, ool_min_aba; + Label ool_max_abc, ool_max_aab, ool_max_aba; + + Label done_min_abc, done_min_aab, done_min_aba; + Label done_max_abc, done_max_aab, done_max_aba; + + // a = min(b, c); + __ vldr(b, r0, offsetof(Inputs, left_)); + __ vldr(c, r0, offsetof(Inputs, right_)); + __ FloatMin(a, b, c, &ool_min_abc); + __ bind(&done_min_abc); + __ vstr(a, r1, offsetof(Results, min_abc_)); + + // a = min(a, b); + __ vldr(a, r0, offsetof(Inputs, left_)); + __ vldr(b, r0, offsetof(Inputs, right_)); + __ FloatMin(a, a, b, &ool_min_aab); + __ bind(&done_min_aab); + __ vstr(a, r1, offsetof(Results, min_aab_)); + + // a = min(b, a); + __ vldr(b, r0, offsetof(Inputs, left_)); + __ vldr(a, r0, offsetof(Inputs, right_)); + __ FloatMin(a, b, a, &ool_min_aba); + __ bind(&done_min_aba); + __ vstr(a, r1, offsetof(Results, min_aba_)); + + // a = max(b, c); + __ vldr(b, r0, offsetof(Inputs, left_)); + __ vldr(c, r0, offsetof(Inputs, right_)); + __ FloatMax(a, b, c, &ool_max_abc); + __ bind(&done_max_abc); + __ vstr(a, r1, offsetof(Results, max_abc_)); + + // a = max(a, b); + __ vldr(a, r0, offsetof(Inputs, left_)); + __ vldr(b, r0, offsetof(Inputs, right_)); + __ FloatMax(a, a, b, &ool_max_aab); + __ bind(&done_max_aab); + __ vstr(a, r1, offsetof(Results, max_aab_)); + + // a = max(b, a); + __ vldr(b, r0, offsetof(Inputs, left_)); + __ vldr(a, r0, offsetof(Inputs, right_)); + __ FloatMax(a, b, a, &ool_max_aba); + __ bind(&done_max_aba); + __ vstr(a, r1, offsetof(Results, max_aba_)); + + __ bx(lr); + + // Generate out-of-line cases. + __ bind(&ool_min_abc); + __ FloatMinOutOfLine(a, b, c); + __ b(&done_min_abc); + + __ bind(&ool_min_aab); + __ FloatMinOutOfLine(a, a, b); + __ b(&done_min_aab); + + __ bind(&ool_min_aba); + __ FloatMinOutOfLine(a, b, a); + __ b(&done_min_aba); + + __ bind(&ool_max_abc); + __ FloatMaxOutOfLine(a, b, c); + __ b(&done_max_abc); + + __ bind(&ool_max_aab); + __ FloatMaxOutOfLine(a, a, b); + __ b(&done_max_aab); + + __ bind(&ool_max_aba); + __ FloatMaxOutOfLine(a, b, a); + __ b(&done_max_aba); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = assm.isolate()->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); +#ifdef DEBUG + OFStream os(stdout); + code->Print(os); +#endif + return FUNCTION_CAST<F4>(code->entry()); +} + +TEST(macro_float_minmax_f64) { + // Test the FloatMin and FloatMax macros. + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + MacroAssembler assm(isolate, NULL, 0, CodeObjectRequired::kYes); + + struct Inputs { + double left_; + double right_; + }; + + struct Results { + // Check all register aliasing possibilities in order to exercise all + // code-paths in the macro assembler. + double min_abc_; + double min_aab_; + double min_aba_; + double max_abc_; + double max_aab_; + double max_aba_; + }; + + F4 f = GenerateMacroFloatMinMax<DwVfpRegister, Inputs, Results>(assm); + + Object* dummy = nullptr; + USE(dummy); + +#define CHECK_MINMAX(left, right, min, max) \ + do { \ + Inputs inputs = {left, right}; \ + Results results; \ + dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + /* Use a bit_cast to correctly identify -0.0 and NaNs. */ \ + CHECK_EQ(bit_cast<uint64_t>(min), bit_cast<uint64_t>(results.min_abc_)); \ + CHECK_EQ(bit_cast<uint64_t>(min), bit_cast<uint64_t>(results.min_aab_)); \ + CHECK_EQ(bit_cast<uint64_t>(min), bit_cast<uint64_t>(results.min_aba_)); \ + CHECK_EQ(bit_cast<uint64_t>(max), bit_cast<uint64_t>(results.max_abc_)); \ + CHECK_EQ(bit_cast<uint64_t>(max), bit_cast<uint64_t>(results.max_aab_)); \ + CHECK_EQ(bit_cast<uint64_t>(max), bit_cast<uint64_t>(results.max_aba_)); \ + } while (0) + + double nan_a = bit_cast<double>(UINT64_C(0x7ff8000000000001)); + double nan_b = bit_cast<double>(UINT64_C(0x7ff8000000000002)); + + CHECK_MINMAX(1.0, -1.0, -1.0, 1.0); + CHECK_MINMAX(-1.0, 1.0, -1.0, 1.0); + CHECK_MINMAX(0.0, -1.0, -1.0, 0.0); + CHECK_MINMAX(-1.0, 0.0, -1.0, 0.0); + CHECK_MINMAX(-0.0, -1.0, -1.0, -0.0); + CHECK_MINMAX(-1.0, -0.0, -1.0, -0.0); + CHECK_MINMAX(0.0, 1.0, 0.0, 1.0); + CHECK_MINMAX(1.0, 0.0, 0.0, 1.0); + + CHECK_MINMAX(0.0, 0.0, 0.0, 0.0); + CHECK_MINMAX(-0.0, -0.0, -0.0, -0.0); + CHECK_MINMAX(-0.0, 0.0, -0.0, 0.0); + CHECK_MINMAX(0.0, -0.0, -0.0, 0.0); + + CHECK_MINMAX(0.0, nan_a, nan_a, nan_a); + CHECK_MINMAX(nan_a, 0.0, nan_a, nan_a); + CHECK_MINMAX(nan_a, nan_b, nan_a, nan_a); + CHECK_MINMAX(nan_b, nan_a, nan_b, nan_b); + +#undef CHECK_MINMAX +} + +TEST(macro_float_minmax_f32) { + // Test the FloatMin and FloatMax macros. + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + + MacroAssembler assm(isolate, NULL, 0, CodeObjectRequired::kYes); + + struct Inputs { + float left_; + float right_; + }; + + struct Results { + // Check all register aliasing possibilities in order to exercise all + // code-paths in the macro assembler. + float min_abc_; + float min_aab_; + float min_aba_; + float max_abc_; + float max_aab_; + float max_aba_; + }; + + F4 f = GenerateMacroFloatMinMax<SwVfpRegister, Inputs, Results>(assm); + Object* dummy = nullptr; + USE(dummy); + +#define CHECK_MINMAX(left, right, min, max) \ + do { \ + Inputs inputs = {left, right}; \ + Results results; \ + dummy = CALL_GENERATED_CODE(isolate, f, &inputs, &results, 0, 0, 0); \ + /* Use a bit_cast to correctly identify -0.0 and NaNs. */ \ + CHECK_EQ(bit_cast<uint32_t>(min), bit_cast<uint32_t>(results.min_abc_)); \ + CHECK_EQ(bit_cast<uint32_t>(min), bit_cast<uint32_t>(results.min_aab_)); \ + CHECK_EQ(bit_cast<uint32_t>(min), bit_cast<uint32_t>(results.min_aba_)); \ + CHECK_EQ(bit_cast<uint32_t>(max), bit_cast<uint32_t>(results.max_abc_)); \ + CHECK_EQ(bit_cast<uint32_t>(max), bit_cast<uint32_t>(results.max_aab_)); \ + CHECK_EQ(bit_cast<uint32_t>(max), bit_cast<uint32_t>(results.max_aba_)); \ + } while (0) + + float nan_a = bit_cast<float>(UINT32_C(0x7fc00001)); + float nan_b = bit_cast<float>(UINT32_C(0x7fc00002)); + + CHECK_MINMAX(1.0f, -1.0f, -1.0f, 1.0f); + CHECK_MINMAX(-1.0f, 1.0f, -1.0f, 1.0f); + CHECK_MINMAX(0.0f, -1.0f, -1.0f, 0.0f); + CHECK_MINMAX(-1.0f, 0.0f, -1.0f, 0.0f); + CHECK_MINMAX(-0.0f, -1.0f, -1.0f, -0.0f); + CHECK_MINMAX(-1.0f, -0.0f, -1.0f, -0.0f); + CHECK_MINMAX(0.0f, 1.0f, 0.0f, 1.0f); + CHECK_MINMAX(1.0f, 0.0f, 0.0f, 1.0f); + + CHECK_MINMAX(0.0f, 0.0f, 0.0f, 0.0f); + CHECK_MINMAX(-0.0f, -0.0f, -0.0f, -0.0f); + CHECK_MINMAX(-0.0f, 0.0f, -0.0f, 0.0f); + CHECK_MINMAX(0.0f, -0.0f, -0.0f, 0.0f); + + CHECK_MINMAX(0.0f, nan_a, nan_a, nan_a); + CHECK_MINMAX(nan_a, 0.0f, nan_a, nan_a); + CHECK_MINMAX(nan_a, nan_b, nan_a, nan_a); + CHECK_MINMAX(nan_b, nan_a, nan_b, nan_b); + +#undef CHECK_MINMAX +} + TEST(unaligned_loads) { // All supported ARM targets allow unaligned accesses. CcTest::InitializeVM(); @@ -2495,6 +2882,55 @@ TEST(unaligned_stores) { } } +TEST(vswp) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + Assembler assm(isolate, NULL, 0); + + typedef struct { + double result0; + double result1; + double result2; + double result3; + } T; + T t; + + __ vmov(d0, 1.0); + __ vmov(d1, -1.0); + __ vswp(d0, d1); + __ vstr(d0, r0, offsetof(T, result0)); + __ vstr(d1, r0, offsetof(T, result1)); + + if (CpuFeatures::IsSupported(VFP32DREGS)) { + __ vmov(d30, 1.0); + __ vmov(d31, -1.0); + __ vswp(d30, d31); + __ vstr(d30, r0, offsetof(T, result2)); + __ vstr(d31, r0, offsetof(T, result3)); + } + + __ bx(lr); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); +#ifdef DEBUG + OFStream os(stdout); + code->Print(os); +#endif + F3 f = FUNCTION_CAST<F3>(code->entry()); + Object* dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); + USE(dummy); + CHECK_EQ(-1.0, t.result0); + CHECK_EQ(1.0, t.result1); + if (CpuFeatures::IsSupported(VFP32DREGS)) { + CHECK_EQ(-1.0, t.result2); + CHECK_EQ(1.0, t.result3); + } +} + TEST(regress4292_b) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); diff --git a/deps/v8/test/cctest/test-assembler-mips.cc b/deps/v8/test/cctest/test-assembler-mips.cc index e73b40e96b..08d3c606c0 100644 --- a/deps/v8/test/cctest/test-assembler-mips.cc +++ b/deps/v8/test/cctest/test-assembler-mips.cc @@ -5386,4 +5386,130 @@ TEST(Trampoline) { CHECK_EQ(res, 0); } +template <class T> +struct TestCaseMaddMsub { + T fr, fs, ft, fd_add, fd_sub; +}; + +template <typename T, typename F> +void helper_madd_msub_maddf_msubf(F func) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); + + T x = std::sqrt(static_cast<T>(2.0)); + T y = std::sqrt(static_cast<T>(3.0)); + T z = std::sqrt(static_cast<T>(5.0)); + T x2 = 11.11, y2 = 22.22, z2 = 33.33; + TestCaseMaddMsub<T> test_cases[] = { + {x, y, z, 0.0, 0.0}, + {x, y, -z, 0.0, 0.0}, + {x, -y, z, 0.0, 0.0}, + {x, -y, -z, 0.0, 0.0}, + {-x, y, z, 0.0, 0.0}, + {-x, y, -z, 0.0, 0.0}, + {-x, -y, z, 0.0, 0.0}, + {-x, -y, -z, 0.0, 0.0}, + {-3.14, 0.2345, -123.000056, 0.0, 0.0}, + {7.3, -23.257, -357.1357, 0.0, 0.0}, + {x2, y2, z2, 0.0, 0.0}, + {x2, y2, -z2, 0.0, 0.0}, + {x2, -y2, z2, 0.0, 0.0}, + {x2, -y2, -z2, 0.0, 0.0}, + {-x2, y2, z2, 0.0, 0.0}, + {-x2, y2, -z2, 0.0, 0.0}, + {-x2, -y2, z2, 0.0, 0.0}, + {-x2, -y2, -z2, 0.0, 0.0}, + }; + + if (std::is_same<T, float>::value) { + __ lwc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fr))); + __ lwc1(f6, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fs))); + __ lwc1(f8, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, ft))); + __ lwc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fr))); + } else if (std::is_same<T, double>::value) { + __ ldc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fr))); + __ ldc1(f6, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fs))); + __ ldc1(f8, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, ft))); + __ ldc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fr))); + } else { + UNREACHABLE(); + } + + func(assm); + + __ jr(ra); + __ nop(); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + F3 f = FUNCTION_CAST<F3>(code->entry()); + + const size_t kTableLength = sizeof(test_cases) / sizeof(TestCaseMaddMsub<T>); + TestCaseMaddMsub<T> tc; + for (size_t i = 0; i < kTableLength; i++) { + tc.fr = test_cases[i].fr; + tc.fs = test_cases[i].fs; + tc.ft = test_cases[i].ft; + + (CALL_GENERATED_CODE(isolate, f, &tc, 0, 0, 0, 0)); + + T res_add = tc.fr + (tc.fs * tc.ft); + T res_sub = 0; + if (IsMipsArchVariant(kMips32r2)) { + res_sub = (tc.fs * tc.ft) - tc.fr; + } else if (IsMipsArchVariant(kMips32r6)) { + res_sub = tc.fr - (tc.fs * tc.ft); + } else { + UNREACHABLE(); + } + + CHECK_EQ(tc.fd_add, res_add); + CHECK_EQ(tc.fd_sub, res_sub); + } +} + +TEST(madd_msub_s) { + if (!IsMipsArchVariant(kMips32r2)) return; + helper_madd_msub_maddf_msubf<float>([](MacroAssembler& assm) { + __ madd_s(f10, f4, f6, f8); + __ swc1(f10, MemOperand(a0, offsetof(TestCaseMaddMsub<float>, fd_add))); + __ msub_s(f16, f4, f6, f8); + __ swc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<float>, fd_sub))); + }); +} + +TEST(madd_msub_d) { + if (!IsMipsArchVariant(kMips32r2)) return; + helper_madd_msub_maddf_msubf<double>([](MacroAssembler& assm) { + __ madd_d(f10, f4, f6, f8); + __ sdc1(f10, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_add))); + __ msub_d(f16, f4, f6, f8); + __ sdc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_sub))); + }); +} + +TEST(maddf_msubf_s) { + if (!IsMipsArchVariant(kMips32r6)) return; + helper_madd_msub_maddf_msubf<float>([](MacroAssembler& assm) { + __ maddf_s(f4, f6, f8); + __ swc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<float>, fd_add))); + __ msubf_s(f16, f6, f8); + __ swc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<float>, fd_sub))); + }); +} + +TEST(maddf_msubf_d) { + if (!IsMipsArchVariant(kMips32r6)) return; + helper_madd_msub_maddf_msubf<double>([](MacroAssembler& assm) { + __ maddf_d(f4, f6, f8); + __ sdc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_add))); + __ msubf_d(f16, f6, f8); + __ sdc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_sub))); + }); +} + #undef __ diff --git a/deps/v8/test/cctest/test-assembler-mips64.cc b/deps/v8/test/cctest/test-assembler-mips64.cc index 9529dab242..b0315343b5 100644 --- a/deps/v8/test/cctest/test-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-assembler-mips64.cc @@ -5934,5 +5934,128 @@ TEST(Trampoline) { CHECK_EQ(res, 0); } +template <class T> +struct TestCaseMaddMsub { + T fr, fs, ft, fd_add, fd_sub; +}; + +template <typename T, typename F> +void helper_madd_msub_maddf_msubf(F func) { + CcTest::InitializeVM(); + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + MacroAssembler assm(isolate, NULL, 0, v8::internal::CodeObjectRequired::kYes); + + T x = std::sqrt(static_cast<T>(2.0)); + T y = std::sqrt(static_cast<T>(3.0)); + T z = std::sqrt(static_cast<T>(5.0)); + T x2 = 11.11, y2 = 22.22, z2 = 33.33; + TestCaseMaddMsub<T> test_cases[] = { + {x, y, z, 0.0, 0.0}, + {x, y, -z, 0.0, 0.0}, + {x, -y, z, 0.0, 0.0}, + {x, -y, -z, 0.0, 0.0}, + {-x, y, z, 0.0, 0.0}, + {-x, y, -z, 0.0, 0.0}, + {-x, -y, z, 0.0, 0.0}, + {-x, -y, -z, 0.0, 0.0}, + {-3.14, 0.2345, -123.000056, 0.0, 0.0}, + {7.3, -23.257, -357.1357, 0.0, 0.0}, + {x2, y2, z2, 0.0, 0.0}, + {x2, y2, -z2, 0.0, 0.0}, + {x2, -y2, z2, 0.0, 0.0}, + {x2, -y2, -z2, 0.0, 0.0}, + {-x2, y2, z2, 0.0, 0.0}, + {-x2, y2, -z2, 0.0, 0.0}, + {-x2, -y2, z2, 0.0, 0.0}, + {-x2, -y2, -z2, 0.0, 0.0}, + }; + + if (std::is_same<T, float>::value) { + __ lwc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fr))); + __ lwc1(f6, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fs))); + __ lwc1(f8, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, ft))); + __ lwc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fr))); + } else if (std::is_same<T, double>::value) { + __ ldc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fr))); + __ ldc1(f6, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fs))); + __ ldc1(f8, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, ft))); + __ ldc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<T>, fr))); + } else { + UNREACHABLE(); + } + + func(assm); + + __ jr(ra); + __ nop(); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + F3 f = FUNCTION_CAST<F3>(code->entry()); + + const size_t kTableLength = sizeof(test_cases) / sizeof(TestCaseMaddMsub<T>); + TestCaseMaddMsub<T> tc; + for (size_t i = 0; i < kTableLength; i++) { + tc.fr = test_cases[i].fr; + tc.fs = test_cases[i].fs; + tc.ft = test_cases[i].ft; + + (CALL_GENERATED_CODE(isolate, f, &tc, 0, 0, 0, 0)); + + T res_add = tc.fr + (tc.fs * tc.ft); + T res_sub; + if (kArchVariant != kMips64r6) { + res_sub = (tc.fs * tc.ft) - tc.fr; + } else { + res_sub = tc.fr - (tc.fs * tc.ft); + } + + CHECK_EQ(tc.fd_add, res_add); + CHECK_EQ(tc.fd_sub, res_sub); + } +} + +TEST(madd_msub_s) { + if (kArchVariant == kMips64r6) return; + helper_madd_msub_maddf_msubf<float>([](MacroAssembler& assm) { + __ madd_s(f10, f4, f6, f8); + __ swc1(f10, MemOperand(a0, offsetof(TestCaseMaddMsub<float>, fd_add))); + __ msub_s(f16, f4, f6, f8); + __ swc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<float>, fd_sub))); + }); +} + +TEST(madd_msub_d) { + if (kArchVariant == kMips64r6) return; + helper_madd_msub_maddf_msubf<double>([](MacroAssembler& assm) { + __ madd_d(f10, f4, f6, f8); + __ sdc1(f10, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_add))); + __ msub_d(f16, f4, f6, f8); + __ sdc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_sub))); + }); +} + +TEST(maddf_msubf_s) { + if (kArchVariant != kMips64r6) return; + helper_madd_msub_maddf_msubf<float>([](MacroAssembler& assm) { + __ maddf_s(f4, f6, f8); + __ swc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<float>, fd_add))); + __ msubf_s(f16, f6, f8); + __ swc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<float>, fd_sub))); + }); +} + +TEST(maddf_msubf_d) { + if (kArchVariant != kMips64r6) return; + helper_madd_msub_maddf_msubf<double>([](MacroAssembler& assm) { + __ maddf_d(f4, f6, f8); + __ sdc1(f4, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_add))); + __ msubf_d(f16, f6, f8); + __ sdc1(f16, MemOperand(a0, offsetof(TestCaseMaddMsub<double>, fd_sub))); + }); +} #undef __ diff --git a/deps/v8/test/cctest/test-ast-types.cc b/deps/v8/test/cctest/test-ast-types.cc new file mode 100644 index 0000000000..39d2d70eb0 --- /dev/null +++ b/deps/v8/test/cctest/test-ast-types.cc @@ -0,0 +1,1904 @@ +// Copyright 2013 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 <vector> + +#include "src/crankshaft/hydrogen-types.h" +#include "src/factory.h" +#include "src/heap/heap.h" +#include "src/isolate.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/ast/ast-types.h" +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" +#include "test/cctest/ast-types-fuzz.h" +#include "test/cctest/cctest.h" + +using namespace v8::internal; + +namespace { + +// Testing auxiliaries (breaking the Type abstraction). + +static bool IsInteger(double x) { + return nearbyint(x) == x && !i::IsMinusZero(x); // Allows for infinities. +} + +static bool IsInteger(i::Object* x) { + return x->IsNumber() && IsInteger(x->Number()); +} + +typedef uint32_t bitset; + +struct Tests { + typedef AstTypes::TypeVector::iterator TypeIterator; + typedef AstTypes::MapVector::iterator MapIterator; + typedef AstTypes::ValueVector::iterator ValueIterator; + + Isolate* isolate; + HandleScope scope; + Zone zone; + AstTypes T; + + Tests() + : isolate(CcTest::InitIsolateOnce()), + scope(isolate), + zone(isolate->allocator()), + T(&zone, isolate, isolate->random_number_generator()) {} + + bool IsBitset(AstType* type) { return type->IsBitsetForTesting(); } + bool IsUnion(AstType* type) { return type->IsUnionForTesting(); } + AstBitsetType::bitset AsBitset(AstType* type) { + return type->AsBitsetForTesting(); + } + AstUnionType* AsUnion(AstType* type) { return type->AsUnionForTesting(); } + + bool Equal(AstType* type1, AstType* type2) { + return type1->Equals(type2) && + this->IsBitset(type1) == this->IsBitset(type2) && + this->IsUnion(type1) == this->IsUnion(type2) && + type1->NumClasses() == type2->NumClasses() && + type1->NumConstants() == type2->NumConstants() && + (!this->IsBitset(type1) || + this->AsBitset(type1) == this->AsBitset(type2)) && + (!this->IsUnion(type1) || + this->AsUnion(type1)->LengthForTesting() == + this->AsUnion(type2)->LengthForTesting()); + } + + void CheckEqual(AstType* type1, AstType* type2) { + CHECK(Equal(type1, type2)); + } + + void CheckSub(AstType* type1, AstType* type2) { + CHECK(type1->Is(type2)); + CHECK(!type2->Is(type1)); + if (this->IsBitset(type1) && this->IsBitset(type2)) { + CHECK(this->AsBitset(type1) != this->AsBitset(type2)); + } + } + + void CheckSubOrEqual(AstType* type1, AstType* type2) { + CHECK(type1->Is(type2)); + if (this->IsBitset(type1) && this->IsBitset(type2)) { + CHECK((this->AsBitset(type1) | this->AsBitset(type2)) == + this->AsBitset(type2)); + } + } + + void CheckUnordered(AstType* type1, AstType* type2) { + CHECK(!type1->Is(type2)); + CHECK(!type2->Is(type1)); + if (this->IsBitset(type1) && this->IsBitset(type2)) { + CHECK(this->AsBitset(type1) != this->AsBitset(type2)); + } + } + + void CheckOverlap(AstType* type1, AstType* type2) { + CHECK(type1->Maybe(type2)); + CHECK(type2->Maybe(type1)); + } + + void CheckDisjoint(AstType* type1, AstType* type2) { + CHECK(!type1->Is(type2)); + CHECK(!type2->Is(type1)); + CHECK(!type1->Maybe(type2)); + CHECK(!type2->Maybe(type1)); + } + + void IsSomeType() { + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* t = *it; + CHECK(1 == + this->IsBitset(t) + t->IsClass() + t->IsConstant() + t->IsRange() + + this->IsUnion(t) + t->IsArray() + t->IsFunction() + + t->IsContext()); + } + } + + void Bitset() { + // None and Any are bitsets. + CHECK(this->IsBitset(T.None)); + CHECK(this->IsBitset(T.Any)); + + CHECK(bitset(0) == this->AsBitset(T.None)); + CHECK(bitset(0xfffffffeu) == this->AsBitset(T.Any)); + + // Union(T1, T2) is bitset for bitsets T1,T2 + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* union12 = T.Union(type1, type2); + CHECK(!(this->IsBitset(type1) && this->IsBitset(type2)) || + this->IsBitset(union12)); + } + } + + // Intersect(T1, T2) is bitset for bitsets T1,T2 + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* intersect12 = T.Intersect(type1, type2); + CHECK(!(this->IsBitset(type1) && this->IsBitset(type2)) || + this->IsBitset(intersect12)); + } + } + + // Union(T1, T2) is bitset if T2 is bitset and T1->Is(T2) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* union12 = T.Union(type1, type2); + CHECK(!(this->IsBitset(type2) && type1->Is(type2)) || + this->IsBitset(union12)); + } + } + + // Union(T1, T2) is bitwise disjunction for bitsets T1,T2 + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* union12 = T.Union(type1, type2); + if (this->IsBitset(type1) && this->IsBitset(type2)) { + CHECK((this->AsBitset(type1) | this->AsBitset(type2)) == + this->AsBitset(union12)); + } + } + } + + // Intersect(T1, T2) is bitwise conjunction for bitsets T1,T2 (modulo None) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + if (this->IsBitset(type1) && this->IsBitset(type2)) { + AstType* intersect12 = T.Intersect(type1, type2); + bitset bits = this->AsBitset(type1) & this->AsBitset(type2); + CHECK(bits == this->AsBitset(intersect12)); + } + } + } + } + + void PointwiseRepresentation() { + // Check we can decompose type into semantics and representation and + // then compose it back to get an equivalent type. + int counter = 0; + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + counter++; + printf("Counter: %i\n", counter); + fflush(stdout); + AstType* type1 = *it1; + AstType* representation = T.Representation(type1); + AstType* semantic = T.Semantic(type1); + AstType* composed = T.Union(representation, semantic); + CHECK(type1->Equals(composed)); + } + + // Pointwiseness of Union. + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* representation1 = T.Representation(type1); + AstType* semantic1 = T.Semantic(type1); + AstType* representation2 = T.Representation(type2); + AstType* semantic2 = T.Semantic(type2); + AstType* direct_union = T.Union(type1, type2); + AstType* representation_union = + T.Union(representation1, representation2); + AstType* semantic_union = T.Union(semantic1, semantic2); + AstType* composed_union = T.Union(representation_union, semantic_union); + CHECK(direct_union->Equals(composed_union)); + } + } + + // Pointwiseness of Intersect. + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* representation1 = T.Representation(type1); + AstType* semantic1 = T.Semantic(type1); + AstType* representation2 = T.Representation(type2); + AstType* semantic2 = T.Semantic(type2); + AstType* direct_intersection = T.Intersect(type1, type2); + AstType* representation_intersection = + T.Intersect(representation1, representation2); + AstType* semantic_intersection = T.Intersect(semantic1, semantic2); + AstType* composed_intersection = + T.Union(representation_intersection, semantic_intersection); + CHECK(direct_intersection->Equals(composed_intersection)); + } + } + + // Pointwiseness of Is. + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* representation1 = T.Representation(type1); + AstType* semantic1 = T.Semantic(type1); + AstType* representation2 = T.Representation(type2); + AstType* semantic2 = T.Semantic(type2); + bool representation_is = representation1->Is(representation2); + bool semantic_is = semantic1->Is(semantic2); + bool direct_is = type1->Is(type2); + CHECK(direct_is == (semantic_is && representation_is)); + } + } + } + + void Class() { + // Constructor + for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { + Handle<i::Map> map = *mt; + AstType* type = T.Class(map); + CHECK(type->IsClass()); + } + + // Map attribute + for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { + Handle<i::Map> map = *mt; + AstType* type = T.Class(map); + CHECK(*map == *type->AsClass()->Map()); + } + + // Functionality & Injectivity: Class(M1) = Class(M2) iff M1 = M2 + for (MapIterator mt1 = T.maps.begin(); mt1 != T.maps.end(); ++mt1) { + for (MapIterator mt2 = T.maps.begin(); mt2 != T.maps.end(); ++mt2) { + Handle<i::Map> map1 = *mt1; + Handle<i::Map> map2 = *mt2; + AstType* type1 = T.Class(map1); + AstType* type2 = T.Class(map2); + CHECK(Equal(type1, type2) == (*map1 == *map2)); + } + } + } + + void Constant() { + // Constructor + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + Handle<i::Object> value = *vt; + AstType* type = T.Constant(value); + CHECK(type->IsConstant()); + } + + // Value attribute + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + Handle<i::Object> value = *vt; + AstType* type = T.Constant(value); + CHECK(*value == *type->AsConstant()->Value()); + } + + // Functionality & Injectivity: Constant(V1) = Constant(V2) iff V1 = V2 + for (ValueIterator vt1 = T.values.begin(); vt1 != T.values.end(); ++vt1) { + for (ValueIterator vt2 = T.values.begin(); vt2 != T.values.end(); ++vt2) { + Handle<i::Object> value1 = *vt1; + Handle<i::Object> value2 = *vt2; + AstType* type1 = T.Constant(value1); + AstType* type2 = T.Constant(value2); + CHECK(Equal(type1, type2) == (*value1 == *value2)); + } + } + + // Typing of numbers + Factory* fac = isolate->factory(); + CHECK(T.Constant(fac->NewNumber(0))->Is(T.UnsignedSmall)); + CHECK(T.Constant(fac->NewNumber(1))->Is(T.UnsignedSmall)); + CHECK(T.Constant(fac->NewNumber(0x3fffffff))->Is(T.UnsignedSmall)); + CHECK(T.Constant(fac->NewNumber(-1))->Is(T.Negative31)); + CHECK(T.Constant(fac->NewNumber(-0x3fffffff))->Is(T.Negative31)); + CHECK(T.Constant(fac->NewNumber(-0x40000000))->Is(T.Negative31)); + CHECK(T.Constant(fac->NewNumber(0x40000000))->Is(T.Unsigned31)); + CHECK(!T.Constant(fac->NewNumber(0x40000000))->Is(T.Unsigned30)); + CHECK(T.Constant(fac->NewNumber(0x7fffffff))->Is(T.Unsigned31)); + CHECK(!T.Constant(fac->NewNumber(0x7fffffff))->Is(T.Unsigned30)); + CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.Negative32)); + CHECK(!T.Constant(fac->NewNumber(-0x40000001))->Is(T.Negative31)); + CHECK(T.Constant(fac->NewNumber(-0x7fffffff))->Is(T.Negative32)); + CHECK(!T.Constant(fac->NewNumber(-0x7fffffff - 1))->Is(T.Negative31)); + if (SmiValuesAre31Bits()) { + CHECK(!T.Constant(fac->NewNumber(0x40000000))->Is(T.UnsignedSmall)); + CHECK(!T.Constant(fac->NewNumber(0x7fffffff))->Is(T.UnsignedSmall)); + CHECK(!T.Constant(fac->NewNumber(-0x40000001))->Is(T.SignedSmall)); + CHECK(!T.Constant(fac->NewNumber(-0x7fffffff - 1))->Is(T.SignedSmall)); + } else { + CHECK(SmiValuesAre32Bits()); + CHECK(T.Constant(fac->NewNumber(0x40000000))->Is(T.UnsignedSmall)); + CHECK(T.Constant(fac->NewNumber(0x7fffffff))->Is(T.UnsignedSmall)); + CHECK(T.Constant(fac->NewNumber(-0x40000001))->Is(T.SignedSmall)); + CHECK(T.Constant(fac->NewNumber(-0x7fffffff - 1))->Is(T.SignedSmall)); + } + CHECK(T.Constant(fac->NewNumber(0x80000000u))->Is(T.Unsigned32)); + CHECK(!T.Constant(fac->NewNumber(0x80000000u))->Is(T.Unsigned31)); + CHECK(T.Constant(fac->NewNumber(0xffffffffu))->Is(T.Unsigned32)); + CHECK(!T.Constant(fac->NewNumber(0xffffffffu))->Is(T.Unsigned31)); + CHECK(T.Constant(fac->NewNumber(0xffffffffu + 1.0))->Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(0xffffffffu + 1.0))->Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(-0x7fffffff - 2.0))->Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(-0x7fffffff - 2.0))->Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(0.1))->Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(0.1))->Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(-10.1))->Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(-10.1))->Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(10e60))->Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(10e60))->Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(-1.0 * 0.0))->Is(T.MinusZero)); + CHECK(T.Constant(fac->NewNumber(std::numeric_limits<double>::quiet_NaN())) + ->Is(T.NaN)); + CHECK(T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(V8_INFINITY))->Is(T.Integral32)); + CHECK(T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.PlainNumber)); + CHECK(!T.Constant(fac->NewNumber(-V8_INFINITY))->Is(T.Integral32)); + } + + void Range() { + // Constructor + for (ValueIterator i = T.integers.begin(); i != T.integers.end(); ++i) { + for (ValueIterator j = T.integers.begin(); j != T.integers.end(); ++j) { + double min = (*i)->Number(); + double max = (*j)->Number(); + if (min > max) std::swap(min, max); + AstType* type = T.Range(min, max); + CHECK(type->IsRange()); + } + } + + // Range attributes + for (ValueIterator i = T.integers.begin(); i != T.integers.end(); ++i) { + for (ValueIterator j = T.integers.begin(); j != T.integers.end(); ++j) { + double min = (*i)->Number(); + double max = (*j)->Number(); + if (min > max) std::swap(min, max); + AstType* type = T.Range(min, max); + CHECK(min == type->AsRange()->Min()); + CHECK(max == type->AsRange()->Max()); + } + } + + // Functionality & Injectivity: + // Range(min1, max1) = Range(min2, max2) <=> min1 = min2 /\ max1 = max2 + for (ValueIterator i1 = T.integers.begin(); i1 != T.integers.end(); ++i1) { + for (ValueIterator j1 = i1; j1 != T.integers.end(); ++j1) { + for (ValueIterator i2 = T.integers.begin(); i2 != T.integers.end(); + ++i2) { + for (ValueIterator j2 = i2; j2 != T.integers.end(); ++j2) { + double min1 = (*i1)->Number(); + double max1 = (*j1)->Number(); + double min2 = (*i2)->Number(); + double max2 = (*j2)->Number(); + if (min1 > max1) std::swap(min1, max1); + if (min2 > max2) std::swap(min2, max2); + AstType* type1 = T.Range(min1, max1); + AstType* type2 = T.Range(min2, max2); + CHECK(Equal(type1, type2) == (min1 == min2 && max1 == max2)); + } + } + } + } + } + + void Context() { + // Constructor + for (int i = 0; i < 20; ++i) { + AstType* type = T.Random(); + AstType* context = T.Context(type); + CHECK(context->IsContext()); + } + + // Attributes + for (int i = 0; i < 20; ++i) { + AstType* type = T.Random(); + AstType* context = T.Context(type); + CheckEqual(type, context->AsContext()->Outer()); + } + + // Functionality & Injectivity: Context(T1) = Context(T2) iff T1 = T2 + for (int i = 0; i < 20; ++i) { + for (int j = 0; j < 20; ++j) { + AstType* type1 = T.Random(); + AstType* type2 = T.Random(); + AstType* context1 = T.Context(type1); + AstType* context2 = T.Context(type2); + CHECK(Equal(context1, context2) == Equal(type1, type2)); + } + } + } + + void Array() { + // Constructor + for (int i = 0; i < 20; ++i) { + AstType* type = T.Random(); + AstType* array = T.Array1(type); + CHECK(array->IsArray()); + } + + // Attributes + for (int i = 0; i < 20; ++i) { + AstType* type = T.Random(); + AstType* array = T.Array1(type); + CheckEqual(type, array->AsArray()->Element()); + } + + // Functionality & Injectivity: Array(T1) = Array(T2) iff T1 = T2 + for (int i = 0; i < 20; ++i) { + for (int j = 0; j < 20; ++j) { + AstType* type1 = T.Random(); + AstType* type2 = T.Random(); + AstType* array1 = T.Array1(type1); + AstType* array2 = T.Array1(type2); + CHECK(Equal(array1, array2) == Equal(type1, type2)); + } + } + } + + void Function() { + // Constructors + for (int i = 0; i < 20; ++i) { + for (int j = 0; j < 20; ++j) { + for (int k = 0; k < 20; ++k) { + AstType* type1 = T.Random(); + AstType* type2 = T.Random(); + AstType* type3 = T.Random(); + AstType* function0 = T.Function0(type1, type2); + AstType* function1 = T.Function1(type1, type2, type3); + AstType* function2 = T.Function2(type1, type2, type3); + CHECK(function0->IsFunction()); + CHECK(function1->IsFunction()); + CHECK(function2->IsFunction()); + } + } + } + + // Attributes + for (int i = 0; i < 20; ++i) { + for (int j = 0; j < 20; ++j) { + for (int k = 0; k < 20; ++k) { + AstType* type1 = T.Random(); + AstType* type2 = T.Random(); + AstType* type3 = T.Random(); + AstType* function0 = T.Function0(type1, type2); + AstType* function1 = T.Function1(type1, type2, type3); + AstType* function2 = T.Function2(type1, type2, type3); + CHECK_EQ(0, function0->AsFunction()->Arity()); + CHECK_EQ(1, function1->AsFunction()->Arity()); + CHECK_EQ(2, function2->AsFunction()->Arity()); + CheckEqual(type1, function0->AsFunction()->Result()); + CheckEqual(type1, function1->AsFunction()->Result()); + CheckEqual(type1, function2->AsFunction()->Result()); + CheckEqual(type2, function0->AsFunction()->Receiver()); + CheckEqual(type2, function1->AsFunction()->Receiver()); + CheckEqual(T.Any, function2->AsFunction()->Receiver()); + CheckEqual(type3, function1->AsFunction()->Parameter(0)); + CheckEqual(type2, function2->AsFunction()->Parameter(0)); + CheckEqual(type3, function2->AsFunction()->Parameter(1)); + } + } + } + + // Functionality & Injectivity: Function(Ts1) = Function(Ts2) iff Ts1 = Ts2 + for (int i = 0; i < 20; ++i) { + for (int j = 0; j < 20; ++j) { + for (int k = 0; k < 20; ++k) { + AstType* type1 = T.Random(); + AstType* type2 = T.Random(); + AstType* type3 = T.Random(); + AstType* function01 = T.Function0(type1, type2); + AstType* function02 = T.Function0(type1, type3); + AstType* function03 = T.Function0(type3, type2); + AstType* function11 = T.Function1(type1, type2, type2); + AstType* function12 = T.Function1(type1, type2, type3); + AstType* function21 = T.Function2(type1, type2, type2); + AstType* function22 = T.Function2(type1, type2, type3); + AstType* function23 = T.Function2(type1, type3, type2); + CHECK(Equal(function01, function02) == Equal(type2, type3)); + CHECK(Equal(function01, function03) == Equal(type1, type3)); + CHECK(Equal(function11, function12) == Equal(type2, type3)); + CHECK(Equal(function21, function22) == Equal(type2, type3)); + CHECK(Equal(function21, function23) == Equal(type2, type3)); + } + } + } + } + + void Of() { + // Constant(V)->Is(Of(V)) + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + Handle<i::Object> value = *vt; + AstType* const_type = T.Constant(value); + AstType* of_type = T.Of(value); + CHECK(const_type->Is(of_type)); + } + + // If Of(V)->Is(T), then Constant(V)->Is(T) + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + Handle<i::Object> value = *vt; + AstType* type = *it; + AstType* const_type = T.Constant(value); + AstType* of_type = T.Of(value); + CHECK(!of_type->Is(type) || const_type->Is(type)); + } + } + + // If Constant(V)->Is(T), then Of(V)->Is(T) or T->Maybe(Constant(V)) + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + Handle<i::Object> value = *vt; + AstType* type = *it; + AstType* const_type = T.Constant(value); + AstType* of_type = T.Of(value); + CHECK(!const_type->Is(type) || of_type->Is(type) || + type->Maybe(const_type)); + } + } + } + + void NowOf() { + // Constant(V)->NowIs(NowOf(V)) + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + Handle<i::Object> value = *vt; + AstType* const_type = T.Constant(value); + AstType* nowof_type = T.NowOf(value); + CHECK(const_type->NowIs(nowof_type)); + } + + // NowOf(V)->Is(Of(V)) + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + Handle<i::Object> value = *vt; + AstType* nowof_type = T.NowOf(value); + AstType* of_type = T.Of(value); + CHECK(nowof_type->Is(of_type)); + } + + // If NowOf(V)->NowIs(T), then Constant(V)->NowIs(T) + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + Handle<i::Object> value = *vt; + AstType* type = *it; + AstType* const_type = T.Constant(value); + AstType* nowof_type = T.NowOf(value); + CHECK(!nowof_type->NowIs(type) || const_type->NowIs(type)); + } + } + + // If Constant(V)->NowIs(T), + // then NowOf(V)->NowIs(T) or T->Maybe(Constant(V)) + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + Handle<i::Object> value = *vt; + AstType* type = *it; + AstType* const_type = T.Constant(value); + AstType* nowof_type = T.NowOf(value); + CHECK(!const_type->NowIs(type) || nowof_type->NowIs(type) || + type->Maybe(const_type)); + } + } + + // If Constant(V)->Is(T), + // then NowOf(V)->Is(T) or T->Maybe(Constant(V)) + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + Handle<i::Object> value = *vt; + AstType* type = *it; + AstType* const_type = T.Constant(value); + AstType* nowof_type = T.NowOf(value); + CHECK(!const_type->Is(type) || nowof_type->Is(type) || + type->Maybe(const_type)); + } + } + } + + void MinMax() { + // If b is regular numeric bitset, then Range(b->Min(), b->Max())->Is(b). + // TODO(neis): Need to ignore representation for this to be true. + /* + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + if (this->IsBitset(type) && type->Is(T.Number) && + !type->Is(T.None) && !type->Is(T.NaN)) { + AstType* range = T.Range( + isolate->factory()->NewNumber(type->Min()), + isolate->factory()->NewNumber(type->Max())); + CHECK(range->Is(type)); + } + } + */ + + // If b is regular numeric bitset, then b->Min() and b->Max() are integers. + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + if (this->IsBitset(type) && type->Is(T.Number) && !type->Is(T.NaN)) { + CHECK(IsInteger(type->Min()) && IsInteger(type->Max())); + } + } + + // If b1 and b2 are regular numeric bitsets with b1->Is(b2), then + // b1->Min() >= b2->Min() and b1->Max() <= b2->Max(). + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + if (this->IsBitset(type1) && type1->Is(type2) && type2->Is(T.Number) && + !type1->Is(T.NaN) && !type2->Is(T.NaN)) { + CHECK(type1->Min() >= type2->Min()); + CHECK(type1->Max() <= type2->Max()); + } + } + } + + // Lub(Range(x,y))->Min() <= x and y <= Lub(Range(x,y))->Max() + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + if (type->IsRange()) { + AstType* lub = AstBitsetType::NewForTesting(AstBitsetType::Lub(type)); + CHECK(lub->Min() <= type->Min() && type->Max() <= lub->Max()); + } + } + + // Rangification: If T->Is(Range(-inf,+inf)) and T is inhabited, then + // T->Is(Range(T->Min(), T->Max())). + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + CHECK(!type->Is(T.Integer) || !type->IsInhabited() || + type->Is(T.Range(type->Min(), type->Max()))); + } + } + + void BitsetGlb() { + // Lower: (T->BitsetGlb())->Is(T) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + AstType* glb = AstBitsetType::NewForTesting(AstBitsetType::Glb(type)); + CHECK(glb->Is(type)); + } + + // Greatest: If T1->IsBitset() and T1->Is(T2), then T1->Is(T2->BitsetGlb()) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* glb2 = AstBitsetType::NewForTesting(AstBitsetType::Glb(type2)); + CHECK(!this->IsBitset(type1) || !type1->Is(type2) || type1->Is(glb2)); + } + } + + // Monotonicity: T1->Is(T2) implies (T1->BitsetGlb())->Is(T2->BitsetGlb()) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* glb1 = AstBitsetType::NewForTesting(AstBitsetType::Glb(type1)); + AstType* glb2 = AstBitsetType::NewForTesting(AstBitsetType::Glb(type2)); + CHECK(!type1->Is(type2) || glb1->Is(glb2)); + } + } + } + + void BitsetLub() { + // Upper: T->Is(T->BitsetLub()) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + AstType* lub = AstBitsetType::NewForTesting(AstBitsetType::Lub(type)); + CHECK(type->Is(lub)); + } + + // Least: If T2->IsBitset() and T1->Is(T2), then (T1->BitsetLub())->Is(T2) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* lub1 = AstBitsetType::NewForTesting(AstBitsetType::Lub(type1)); + CHECK(!this->IsBitset(type2) || !type1->Is(type2) || lub1->Is(type2)); + } + } + + // Monotonicity: T1->Is(T2) implies (T1->BitsetLub())->Is(T2->BitsetLub()) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* lub1 = AstBitsetType::NewForTesting(AstBitsetType::Lub(type1)); + AstType* lub2 = AstBitsetType::NewForTesting(AstBitsetType::Lub(type2)); + CHECK(!type1->Is(type2) || lub1->Is(lub2)); + } + } + } + + void Is1() { + // Least Element (Bottom): None->Is(T) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + CHECK(T.None->Is(type)); + } + + // Greatest Element (Top): T->Is(Any) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + CHECK(type->Is(T.Any)); + } + + // Bottom Uniqueness: T->Is(None) implies T = None + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + if (type->Is(T.None)) CheckEqual(type, T.None); + } + + // Top Uniqueness: Any->Is(T) implies T = Any + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + if (T.Any->Is(type)) CheckEqual(type, T.Any); + } + + // Reflexivity: T->Is(T) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + CHECK(type->Is(type)); + } + + // Transitivity: T1->Is(T2) and T2->Is(T3) implies T1->Is(T3) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + CHECK(!(type1->Is(type2) && type2->Is(type3)) || type1->Is(type3)); + } + } + } + + // Antisymmetry: T1->Is(T2) and T2->Is(T1) iff T1 = T2 + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + CHECK((type1->Is(type2) && type2->Is(type1)) == Equal(type1, type2)); + } + } + + // (In-)Compatibilities. + for (TypeIterator i = T.types.begin(); i != T.types.end(); ++i) { + for (TypeIterator j = T.types.begin(); j != T.types.end(); ++j) { + AstType* type1 = *i; + AstType* type2 = *j; + CHECK(!type1->Is(type2) || this->IsBitset(type2) || + this->IsUnion(type2) || this->IsUnion(type1) || + (type1->IsClass() && type2->IsClass()) || + (type1->IsConstant() && type2->IsConstant()) || + (type1->IsConstant() && type2->IsRange()) || + (this->IsBitset(type1) && type2->IsRange()) || + (type1->IsRange() && type2->IsRange()) || + (type1->IsContext() && type2->IsContext()) || + (type1->IsArray() && type2->IsArray()) || + (type1->IsFunction() && type2->IsFunction()) || + !type1->IsInhabited()); + } + } + } + + void Is2() { + // Class(M1)->Is(Class(M2)) iff M1 = M2 + for (MapIterator mt1 = T.maps.begin(); mt1 != T.maps.end(); ++mt1) { + for (MapIterator mt2 = T.maps.begin(); mt2 != T.maps.end(); ++mt2) { + Handle<i::Map> map1 = *mt1; + Handle<i::Map> map2 = *mt2; + AstType* class_type1 = T.Class(map1); + AstType* class_type2 = T.Class(map2); + CHECK(class_type1->Is(class_type2) == (*map1 == *map2)); + } + } + + // Range(X1, Y1)->Is(Range(X2, Y2)) iff X1 >= X2 /\ Y1 <= Y2 + for (ValueIterator i1 = T.integers.begin(); i1 != T.integers.end(); ++i1) { + for (ValueIterator j1 = i1; j1 != T.integers.end(); ++j1) { + for (ValueIterator i2 = T.integers.begin(); i2 != T.integers.end(); + ++i2) { + for (ValueIterator j2 = i2; j2 != T.integers.end(); ++j2) { + double min1 = (*i1)->Number(); + double max1 = (*j1)->Number(); + double min2 = (*i2)->Number(); + double max2 = (*j2)->Number(); + if (min1 > max1) std::swap(min1, max1); + if (min2 > max2) std::swap(min2, max2); + AstType* type1 = T.Range(min1, max1); + AstType* type2 = T.Range(min2, max2); + CHECK(type1->Is(type2) == (min1 >= min2 && max1 <= max2)); + } + } + } + } + + // Constant(V1)->Is(Constant(V2)) iff V1 = V2 + for (ValueIterator vt1 = T.values.begin(); vt1 != T.values.end(); ++vt1) { + for (ValueIterator vt2 = T.values.begin(); vt2 != T.values.end(); ++vt2) { + Handle<i::Object> value1 = *vt1; + Handle<i::Object> value2 = *vt2; + AstType* const_type1 = T.Constant(value1); + AstType* const_type2 = T.Constant(value2); + CHECK(const_type1->Is(const_type2) == (*value1 == *value2)); + } + } + + // Context(T1)->Is(Context(T2)) iff T1 = T2 + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* outer1 = *it1; + AstType* outer2 = *it2; + AstType* type1 = T.Context(outer1); + AstType* type2 = T.Context(outer2); + CHECK(type1->Is(type2) == outer1->Equals(outer2)); + } + } + + // Array(T1)->Is(Array(T2)) iff T1 = T2 + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* element1 = *it1; + AstType* element2 = *it2; + AstType* type1 = T.Array1(element1); + AstType* type2 = T.Array1(element2); + CHECK(type1->Is(type2) == element1->Equals(element2)); + } + } + + // Function0(S1, T1)->Is(Function0(S2, T2)) iff S1 = S2 and T1 = T2 + for (TypeIterator i = T.types.begin(); i != T.types.end(); ++i) { + for (TypeIterator j = T.types.begin(); j != T.types.end(); ++j) { + AstType* result1 = *i; + AstType* receiver1 = *j; + AstType* type1 = T.Function0(result1, receiver1); + AstType* result2 = T.Random(); + AstType* receiver2 = T.Random(); + AstType* type2 = T.Function0(result2, receiver2); + CHECK(type1->Is(type2) == + (result1->Equals(result2) && receiver1->Equals(receiver2))); + } + } + + // Range-specific subtyping + + // If IsInteger(v) then Constant(v)->Is(Range(v, v)). + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + if (type->IsConstant() && IsInteger(*type->AsConstant()->Value())) { + CHECK(type->Is(T.Range(type->AsConstant()->Value()->Number(), + type->AsConstant()->Value()->Number()))); + } + } + + // If Constant(x)->Is(Range(min,max)) then IsInteger(v) and min <= x <= max. + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + if (type1->IsConstant() && type2->IsRange() && type1->Is(type2)) { + double x = type1->AsConstant()->Value()->Number(); + double min = type2->AsRange()->Min(); + double max = type2->AsRange()->Max(); + CHECK(IsInteger(x) && min <= x && x <= max); + } + } + } + + // Lub(Range(x,y))->Is(T.Union(T.Integral32, T.OtherNumber)) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + if (type->IsRange()) { + AstType* lub = AstBitsetType::NewForTesting(AstBitsetType::Lub(type)); + CHECK(lub->Is(T.PlainNumber)); + } + } + + // Subtyping between concrete basic types + + CheckUnordered(T.Boolean, T.Null); + CheckUnordered(T.Undefined, T.Null); + CheckUnordered(T.Boolean, T.Undefined); + + CheckSub(T.SignedSmall, T.Number); + CheckSub(T.Signed32, T.Number); + CheckSubOrEqual(T.SignedSmall, T.Signed32); + CheckUnordered(T.SignedSmall, T.MinusZero); + CheckUnordered(T.Signed32, T.Unsigned32); + + CheckSub(T.UniqueName, T.Name); + CheckSub(T.String, T.Name); + CheckSub(T.InternalizedString, T.String); + CheckSub(T.InternalizedString, T.UniqueName); + CheckSub(T.InternalizedString, T.Name); + CheckSub(T.Symbol, T.UniqueName); + CheckSub(T.Symbol, T.Name); + CheckUnordered(T.String, T.UniqueName); + CheckUnordered(T.String, T.Symbol); + CheckUnordered(T.InternalizedString, T.Symbol); + + CheckSub(T.Object, T.Receiver); + CheckSub(T.Proxy, T.Receiver); + CheckSub(T.OtherObject, T.Object); + CheckSub(T.OtherUndetectable, T.Object); + CheckSub(T.OtherObject, T.Object); + + CheckUnordered(T.Object, T.Proxy); + CheckUnordered(T.OtherObject, T.Undetectable); + + // Subtyping between concrete structural types + + CheckSub(T.ObjectClass, T.Object); + CheckSub(T.ArrayClass, T.OtherObject); + CheckSub(T.UninitializedClass, T.Internal); + CheckUnordered(T.ObjectClass, T.ArrayClass); + CheckUnordered(T.UninitializedClass, T.Null); + CheckUnordered(T.UninitializedClass, T.Undefined); + + CheckSub(T.SmiConstant, T.SignedSmall); + CheckSub(T.SmiConstant, T.Signed32); + CheckSub(T.SmiConstant, T.Number); + CheckSub(T.ObjectConstant1, T.Object); + CheckSub(T.ObjectConstant2, T.Object); + CheckSub(T.ArrayConstant, T.Object); + CheckSub(T.ArrayConstant, T.OtherObject); + CheckSub(T.ArrayConstant, T.Receiver); + CheckSub(T.UninitializedConstant, T.Internal); + CheckUnordered(T.ObjectConstant1, T.ObjectConstant2); + CheckUnordered(T.ObjectConstant1, T.ArrayConstant); + CheckUnordered(T.UninitializedConstant, T.Null); + CheckUnordered(T.UninitializedConstant, T.Undefined); + + CheckUnordered(T.ObjectConstant1, T.ObjectClass); + CheckUnordered(T.ObjectConstant2, T.ObjectClass); + CheckUnordered(T.ObjectConstant1, T.ArrayClass); + CheckUnordered(T.ObjectConstant2, T.ArrayClass); + CheckUnordered(T.ArrayConstant, T.ObjectClass); + + CheckSub(T.NumberArray, T.OtherObject); + CheckSub(T.NumberArray, T.Receiver); + CheckSub(T.NumberArray, T.Object); + CheckUnordered(T.StringArray, T.AnyArray); + + CheckSub(T.MethodFunction, T.Object); + CheckSub(T.NumberFunction1, T.Object); + CheckUnordered(T.SignedFunction1, T.NumberFunction1); + CheckUnordered(T.NumberFunction1, T.NumberFunction2); + } + + void NowIs() { + // Least Element (Bottom): None->NowIs(T) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + CHECK(T.None->NowIs(type)); + } + + // Greatest Element (Top): T->NowIs(Any) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + CHECK(type->NowIs(T.Any)); + } + + // Bottom Uniqueness: T->NowIs(None) implies T = None + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + if (type->NowIs(T.None)) CheckEqual(type, T.None); + } + + // Top Uniqueness: Any->NowIs(T) implies T = Any + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + if (T.Any->NowIs(type)) CheckEqual(type, T.Any); + } + + // Reflexivity: T->NowIs(T) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + CHECK(type->NowIs(type)); + } + + // Transitivity: T1->NowIs(T2) and T2->NowIs(T3) implies T1->NowIs(T3) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + CHECK(!(type1->NowIs(type2) && type2->NowIs(type3)) || + type1->NowIs(type3)); + } + } + } + + // Antisymmetry: T1->NowIs(T2) and T2->NowIs(T1) iff T1 = T2 + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + CHECK((type1->NowIs(type2) && type2->NowIs(type1)) == + Equal(type1, type2)); + } + } + + // T1->Is(T2) implies T1->NowIs(T2) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + CHECK(!type1->Is(type2) || type1->NowIs(type2)); + } + } + + // Constant(V1)->NowIs(Constant(V2)) iff V1 = V2 + for (ValueIterator vt1 = T.values.begin(); vt1 != T.values.end(); ++vt1) { + for (ValueIterator vt2 = T.values.begin(); vt2 != T.values.end(); ++vt2) { + Handle<i::Object> value1 = *vt1; + Handle<i::Object> value2 = *vt2; + AstType* const_type1 = T.Constant(value1); + AstType* const_type2 = T.Constant(value2); + CHECK(const_type1->NowIs(const_type2) == (*value1 == *value2)); + } + } + + // Class(M1)->NowIs(Class(M2)) iff M1 = M2 + for (MapIterator mt1 = T.maps.begin(); mt1 != T.maps.end(); ++mt1) { + for (MapIterator mt2 = T.maps.begin(); mt2 != T.maps.end(); ++mt2) { + Handle<i::Map> map1 = *mt1; + Handle<i::Map> map2 = *mt2; + AstType* class_type1 = T.Class(map1); + AstType* class_type2 = T.Class(map2); + CHECK(class_type1->NowIs(class_type2) == (*map1 == *map2)); + } + } + + // Constant(V)->NowIs(Class(M)) iff V has map M + for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + Handle<i::Map> map = *mt; + Handle<i::Object> value = *vt; + AstType* const_type = T.Constant(value); + AstType* class_type = T.Class(map); + CHECK((value->IsHeapObject() && + i::HeapObject::cast(*value)->map() == *map) == + const_type->NowIs(class_type)); + } + } + + // Class(M)->NowIs(Constant(V)) never + for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + Handle<i::Map> map = *mt; + Handle<i::Object> value = *vt; + AstType* const_type = T.Constant(value); + AstType* class_type = T.Class(map); + CHECK(!class_type->NowIs(const_type)); + } + } + } + + void Contains() { + // T->Contains(V) iff Constant(V)->Is(T) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + AstType* type = *it; + Handle<i::Object> value = *vt; + AstType* const_type = T.Constant(value); + CHECK(type->Contains(value) == const_type->Is(type)); + } + } + } + + void NowContains() { + // T->NowContains(V) iff Constant(V)->NowIs(T) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + AstType* type = *it; + Handle<i::Object> value = *vt; + AstType* const_type = T.Constant(value); + CHECK(type->NowContains(value) == const_type->NowIs(type)); + } + } + + // T->Contains(V) implies T->NowContains(V) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + AstType* type = *it; + Handle<i::Object> value = *vt; + CHECK(!type->Contains(value) || type->NowContains(value)); + } + } + + // NowOf(V)->Is(T) implies T->NowContains(V) + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + AstType* type = *it; + Handle<i::Object> value = *vt; + AstType* nowof_type = T.Of(value); + CHECK(!nowof_type->NowIs(type) || type->NowContains(value)); + } + } + } + + void Maybe() { + // T->Maybe(Any) iff T inhabited + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + CHECK(type->Maybe(T.Any) == type->IsInhabited()); + } + + // T->Maybe(None) never + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + CHECK(!type->Maybe(T.None)); + } + + // Reflexivity upto Inhabitation: T->Maybe(T) iff T inhabited + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + CHECK(type->Maybe(type) == type->IsInhabited()); + } + + // Symmetry: T1->Maybe(T2) iff T2->Maybe(T1) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + CHECK(type1->Maybe(type2) == type2->Maybe(type1)); + } + } + + // T1->Maybe(T2) implies T1, T2 inhabited + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + CHECK(!type1->Maybe(type2) || + (type1->IsInhabited() && type2->IsInhabited())); + } + } + + // T1->Maybe(T2) implies Intersect(T1, T2) inhabited + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* intersect12 = T.Intersect(type1, type2); + CHECK(!type1->Maybe(type2) || intersect12->IsInhabited()); + } + } + + // T1->Is(T2) and T1 inhabited implies T1->Maybe(T2) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + CHECK(!(type1->Is(type2) && type1->IsInhabited()) || + type1->Maybe(type2)); + } + } + + // Constant(V1)->Maybe(Constant(V2)) iff V1 = V2 + for (ValueIterator vt1 = T.values.begin(); vt1 != T.values.end(); ++vt1) { + for (ValueIterator vt2 = T.values.begin(); vt2 != T.values.end(); ++vt2) { + Handle<i::Object> value1 = *vt1; + Handle<i::Object> value2 = *vt2; + AstType* const_type1 = T.Constant(value1); + AstType* const_type2 = T.Constant(value2); + CHECK(const_type1->Maybe(const_type2) == (*value1 == *value2)); + } + } + + // Class(M1)->Maybe(Class(M2)) iff M1 = M2 + for (MapIterator mt1 = T.maps.begin(); mt1 != T.maps.end(); ++mt1) { + for (MapIterator mt2 = T.maps.begin(); mt2 != T.maps.end(); ++mt2) { + Handle<i::Map> map1 = *mt1; + Handle<i::Map> map2 = *mt2; + AstType* class_type1 = T.Class(map1); + AstType* class_type2 = T.Class(map2); + CHECK(class_type1->Maybe(class_type2) == (*map1 == *map2)); + } + } + + // Constant(V)->Maybe(Class(M)) never + // This does NOT hold! + /* + for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + Handle<i::Map> map = *mt; + Handle<i::Object> value = *vt; + AstType* const_type = T.Constant(value); + AstType* class_type = T.Class(map); + CHECK(!const_type->Maybe(class_type)); + } + } + */ + + // Class(M)->Maybe(Constant(V)) never + // This does NOT hold! + /* + for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { + for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { + Handle<i::Map> map = *mt; + Handle<i::Object> value = *vt; + AstType* const_type = T.Constant(value); + AstType* class_type = T.Class(map); + CHECK(!class_type->Maybe(const_type)); + } + } + */ + + // Basic types + CheckDisjoint(T.Boolean, T.Null); + CheckDisjoint(T.Undefined, T.Null); + CheckDisjoint(T.Boolean, T.Undefined); + CheckOverlap(T.SignedSmall, T.Number); + CheckOverlap(T.NaN, T.Number); + CheckDisjoint(T.Signed32, T.NaN); + CheckOverlap(T.UniqueName, T.Name); + CheckOverlap(T.String, T.Name); + CheckOverlap(T.InternalizedString, T.String); + CheckOverlap(T.InternalizedString, T.UniqueName); + CheckOverlap(T.InternalizedString, T.Name); + CheckOverlap(T.Symbol, T.UniqueName); + CheckOverlap(T.Symbol, T.Name); + CheckOverlap(T.String, T.UniqueName); + CheckDisjoint(T.String, T.Symbol); + CheckDisjoint(T.InternalizedString, T.Symbol); + CheckOverlap(T.Object, T.Receiver); + CheckOverlap(T.OtherObject, T.Object); + CheckOverlap(T.Proxy, T.Receiver); + CheckDisjoint(T.Object, T.Proxy); + + // Structural types + CheckOverlap(T.ObjectClass, T.Object); + CheckOverlap(T.ArrayClass, T.Object); + CheckOverlap(T.ObjectClass, T.ObjectClass); + CheckOverlap(T.ArrayClass, T.ArrayClass); + CheckDisjoint(T.ObjectClass, T.ArrayClass); + CheckOverlap(T.SmiConstant, T.SignedSmall); + CheckOverlap(T.SmiConstant, T.Signed32); + CheckOverlap(T.SmiConstant, T.Number); + CheckOverlap(T.ObjectConstant1, T.Object); + CheckOverlap(T.ObjectConstant2, T.Object); + CheckOverlap(T.ArrayConstant, T.Object); + CheckOverlap(T.ArrayConstant, T.Receiver); + CheckOverlap(T.ObjectConstant1, T.ObjectConstant1); + CheckDisjoint(T.ObjectConstant1, T.ObjectConstant2); + CheckDisjoint(T.ObjectConstant1, T.ArrayConstant); + CheckOverlap(T.ObjectConstant1, T.ArrayClass); + CheckOverlap(T.ObjectConstant2, T.ArrayClass); + CheckOverlap(T.ArrayConstant, T.ObjectClass); + CheckOverlap(T.NumberArray, T.Receiver); + CheckDisjoint(T.NumberArray, T.AnyArray); + CheckDisjoint(T.NumberArray, T.StringArray); + CheckOverlap(T.MethodFunction, T.Object); + CheckDisjoint(T.SignedFunction1, T.NumberFunction1); + CheckDisjoint(T.SignedFunction1, T.NumberFunction2); + CheckDisjoint(T.NumberFunction1, T.NumberFunction2); + CheckDisjoint(T.SignedFunction1, T.MethodFunction); + CheckOverlap(T.ObjectConstant1, T.ObjectClass); // !!! + CheckOverlap(T.ObjectConstant2, T.ObjectClass); // !!! + CheckOverlap(T.NumberClass, T.Intersect(T.Number, T.Tagged)); // !!! + } + + void Union1() { + // Identity: Union(T, None) = T + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + AstType* union_type = T.Union(type, T.None); + CheckEqual(union_type, type); + } + + // Domination: Union(T, Any) = Any + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + AstType* union_type = T.Union(type, T.Any); + CheckEqual(union_type, T.Any); + } + + // Idempotence: Union(T, T) = T + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + AstType* union_type = T.Union(type, type); + CheckEqual(union_type, type); + } + + // Commutativity: Union(T1, T2) = Union(T2, T1) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* union12 = T.Union(type1, type2); + AstType* union21 = T.Union(type2, type1); + CheckEqual(union12, union21); + } + } + + // Associativity: Union(T1, Union(T2, T3)) = Union(Union(T1, T2), T3) + // This does NOT hold! For example: + // (Unsigned32 \/ Range(0,5)) \/ Range(-5,0) = Unsigned32 \/ Range(-5,0) + // Unsigned32 \/ (Range(0,5) \/ Range(-5,0)) = Unsigned32 \/ Range(-5,5) + /* + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + AstType* union12 = T.Union(type1, type2); + AstType* union23 = T.Union(type2, type3); + AstType* union1_23 = T.Union(type1, union23); + AstType* union12_3 = T.Union(union12, type3); + CheckEqual(union1_23, union12_3); + } + } + } + */ + + // Meet: T1->Is(Union(T1, T2)) and T2->Is(Union(T1, T2)) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* union12 = T.Union(type1, type2); + CHECK(type1->Is(union12)); + CHECK(type2->Is(union12)); + } + } + + // Upper Boundedness: T1->Is(T2) implies Union(T1, T2) = T2 + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* union12 = T.Union(type1, type2); + if (type1->Is(type2)) CheckEqual(union12, type2); + } + } + + // Monotonicity: T1->Is(T2) implies Union(T1, T3)->Is(Union(T2, T3)) + // This does NOT hold. For example: + // Range(-5,-1) <= Signed32 + // Range(-5,-1) \/ Range(1,5) = Range(-5,5) </= Signed32 \/ Range(1,5) + /* + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + AstType* union13 = T.Union(type1, type3); + AstType* union23 = T.Union(type2, type3); + CHECK(!type1->Is(type2) || union13->Is(union23)); + } + } + } + */ + } + + void Union2() { + // Monotonicity: T1->Is(T3) and T2->Is(T3) implies Union(T1, T2)->Is(T3) + // This does NOT hold. For example: + // Range(-2^33, -2^33) <= OtherNumber + // Range(2^33, 2^33) <= OtherNumber + // Range(-2^33, 2^33) </= OtherNumber + /* + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + AstType* union12 = T.Union(type1, type2); + CHECK(!(type1->Is(type3) && type2->Is(type3)) || union12->Is(type3)); + } + } + } + */ + } + + void Union3() { + // Monotonicity: T1->Is(T2) or T1->Is(T3) implies T1->Is(Union(T2, T3)) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + HandleScope scope(isolate); + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = it2; it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + AstType* union23 = T.Union(type2, type3); + CHECK(!(type1->Is(type2) || type1->Is(type3)) || type1->Is(union23)); + } + } + } + } + + void Union4() { + // Class-class + CheckSub(T.Union(T.ObjectClass, T.ArrayClass), T.Object); + CheckOverlap(T.Union(T.ObjectClass, T.ArrayClass), T.OtherObject); + CheckOverlap(T.Union(T.ObjectClass, T.ArrayClass), T.Receiver); + CheckDisjoint(T.Union(T.ObjectClass, T.ArrayClass), T.Number); + + // Constant-constant + CheckSub(T.Union(T.ObjectConstant1, T.ObjectConstant2), T.Object); + CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayConstant), T.OtherObject); + CheckUnordered(T.Union(T.ObjectConstant1, T.ObjectConstant2), + T.ObjectClass); + CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayConstant), T.OtherObject); + CheckDisjoint(T.Union(T.ObjectConstant1, T.ArrayConstant), T.Number); + CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayConstant), + T.ObjectClass); // !!! + + // Bitset-array + CHECK(this->IsBitset(T.Union(T.AnyArray, T.Receiver))); + CHECK(this->IsUnion(T.Union(T.NumberArray, T.Number))); + + CheckEqual(T.Union(T.AnyArray, T.Receiver), T.Receiver); + CheckEqual(T.Union(T.AnyArray, T.OtherObject), T.OtherObject); + CheckUnordered(T.Union(T.AnyArray, T.String), T.Receiver); + CheckOverlap(T.Union(T.NumberArray, T.String), T.Object); + CheckDisjoint(T.Union(T.NumberArray, T.String), T.Number); + + // Bitset-function + CHECK(this->IsBitset(T.Union(T.MethodFunction, T.Object))); + CHECK(this->IsUnion(T.Union(T.NumberFunction1, T.Number))); + + CheckEqual(T.Union(T.MethodFunction, T.Object), T.Object); + CheckUnordered(T.Union(T.NumberFunction1, T.String), T.Object); + CheckOverlap(T.Union(T.NumberFunction2, T.String), T.Object); + CheckDisjoint(T.Union(T.NumberFunction1, T.String), T.Number); + + // Bitset-class + CheckSub(T.Union(T.ObjectClass, T.SignedSmall), + T.Union(T.Object, T.Number)); + CheckSub(T.Union(T.ObjectClass, T.OtherObject), T.Object); + CheckUnordered(T.Union(T.ObjectClass, T.String), T.OtherObject); + CheckOverlap(T.Union(T.ObjectClass, T.String), T.Object); + CheckDisjoint(T.Union(T.ObjectClass, T.String), T.Number); + + // Bitset-constant + CheckSub(T.Union(T.ObjectConstant1, T.Signed32), + T.Union(T.Object, T.Number)); + CheckSub(T.Union(T.ObjectConstant1, T.OtherObject), T.Object); + CheckUnordered(T.Union(T.ObjectConstant1, T.String), T.OtherObject); + CheckOverlap(T.Union(T.ObjectConstant1, T.String), T.Object); + CheckDisjoint(T.Union(T.ObjectConstant1, T.String), T.Number); + + // Class-constant + CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), T.Object); + CheckUnordered(T.ObjectClass, T.Union(T.ObjectConstant1, T.ArrayClass)); + CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), + T.Union(T.Receiver, T.Object)); + CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayClass), T.ArrayConstant); + CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayClass), T.ObjectConstant2); + CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayClass), + T.ObjectClass); // !!! + + // Bitset-union + CheckSub(T.NaN, + T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Number)); + CheckSub(T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Signed32), + T.Union(T.ObjectConstant1, T.Union(T.Number, T.ArrayClass))); + + // Class-union + CheckSub(T.Union(T.ObjectClass, T.Union(T.ObjectConstant1, T.ObjectClass)), + T.Object); + CheckEqual(T.Union(T.Union(T.ArrayClass, T.ObjectConstant2), T.ArrayClass), + T.Union(T.ArrayClass, T.ObjectConstant2)); + + // Constant-union + CheckEqual(T.Union(T.ObjectConstant1, + T.Union(T.ObjectConstant1, T.ObjectConstant2)), + T.Union(T.ObjectConstant2, T.ObjectConstant1)); + CheckEqual( + T.Union(T.Union(T.ArrayConstant, T.ObjectConstant2), T.ObjectConstant1), + T.Union(T.ObjectConstant2, + T.Union(T.ArrayConstant, T.ObjectConstant1))); + + // Array-union + CheckEqual(T.Union(T.AnyArray, T.Union(T.NumberArray, T.AnyArray)), + T.Union(T.AnyArray, T.NumberArray)); + CheckSub(T.Union(T.AnyArray, T.NumberArray), T.OtherObject); + + // Function-union + CheckEqual(T.Union(T.NumberFunction1, T.NumberFunction2), + T.Union(T.NumberFunction2, T.NumberFunction1)); + CheckSub(T.Union(T.SignedFunction1, T.MethodFunction), T.Object); + + // Union-union + CheckEqual(T.Union(T.Union(T.ObjectConstant2, T.ObjectConstant1), + T.Union(T.ObjectConstant1, T.ObjectConstant2)), + T.Union(T.ObjectConstant2, T.ObjectConstant1)); + CheckEqual(T.Union(T.Union(T.Number, T.ArrayClass), + T.Union(T.SignedSmall, T.Receiver)), + T.Union(T.Number, T.Receiver)); + } + + void Intersect() { + // Identity: Intersect(T, Any) = T + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + AstType* intersect_type = T.Intersect(type, T.Any); + CheckEqual(intersect_type, type); + } + + // Domination: Intersect(T, None) = None + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + AstType* intersect_type = T.Intersect(type, T.None); + CheckEqual(intersect_type, T.None); + } + + // Idempotence: Intersect(T, T) = T + for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { + AstType* type = *it; + AstType* intersect_type = T.Intersect(type, type); + CheckEqual(intersect_type, type); + } + + // Commutativity: Intersect(T1, T2) = Intersect(T2, T1) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* intersect12 = T.Intersect(type1, type2); + AstType* intersect21 = T.Intersect(type2, type1); + CheckEqual(intersect12, intersect21); + } + } + + // Associativity: + // Intersect(T1, Intersect(T2, T3)) = Intersect(Intersect(T1, T2), T3) + // This does NOT hold. For example: + // (Class(..stringy1..) /\ Class(..stringy2..)) /\ Constant(..string..) = + // None + // Class(..stringy1..) /\ (Class(..stringy2..) /\ Constant(..string..)) = + // Constant(..string..) + /* + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + AstType* intersect12 = T.Intersect(type1, type2); + AstType* intersect23 = T.Intersect(type2, type3); + AstType* intersect1_23 = T.Intersect(type1, intersect23); + AstType* intersect12_3 = T.Intersect(intersect12, type3); + CheckEqual(intersect1_23, intersect12_3); + } + } + } + */ + + // Join: Intersect(T1, T2)->Is(T1) and Intersect(T1, T2)->Is(T2) + // This does NOT hold. For example: + // Class(..stringy..) /\ Constant(..string..) = Constant(..string..) + // Currently, not even the disjunction holds: + // Class(Internal/TaggedPtr) /\ (Any/Untagged \/ Context(..)) = + // Class(Internal/TaggedPtr) \/ Context(..) + /* + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* intersect12 = T.Intersect(type1, type2); + CHECK(intersect12->Is(type1)); + CHECK(intersect12->Is(type2)); + } + } + */ + + // Lower Boundedness: T1->Is(T2) implies Intersect(T1, T2) = T1 + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* intersect12 = T.Intersect(type1, type2); + if (type1->Is(type2)) CheckEqual(intersect12, type1); + } + } + + // Monotonicity: T1->Is(T2) implies Intersect(T1, T3)->Is(Intersect(T2, T3)) + // This does NOT hold. For example: + // Class(OtherObject/TaggedPtr) <= Any/TaggedPtr + // Class(OtherObject/TaggedPtr) /\ Any/UntaggedInt1 = Class(..) + // Any/TaggedPtr /\ Any/UntaggedInt1 = None + /* + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + AstType* intersect13 = T.Intersect(type1, type3); + AstType* intersect23 = T.Intersect(type2, type3); + CHECK(!type1->Is(type2) || intersect13->Is(intersect23)); + } + } + } + */ + + // Monotonicity: T1->Is(T3) or T2->Is(T3) implies Intersect(T1, T2)->Is(T3) + // This does NOT hold. For example: + // Class(..stringy..) <= Class(..stringy..) + // Class(..stringy..) /\ Constant(..string..) = Constant(..string..) + // Constant(..string..) </= Class(..stringy..) + /* + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + AstType* intersect12 = T.Intersect(type1, type2); + CHECK(!(type1->Is(type3) || type2->Is(type3)) || + intersect12->Is(type3)); + } + } + } + */ + + // Monotonicity: T1->Is(T2) and T1->Is(T3) implies T1->Is(Intersect(T2, T3)) + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + HandleScope scope(isolate); + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + AstType* intersect23 = T.Intersect(type2, type3); + CHECK(!(type1->Is(type2) && type1->Is(type3)) || + type1->Is(intersect23)); + } + } + } + + // Bitset-class + CheckEqual(T.Intersect(T.ObjectClass, T.Object), T.ObjectClass); + CheckEqual(T.Semantic(T.Intersect(T.ObjectClass, T.Number)), T.None); + + // Bitset-array + CheckEqual(T.Intersect(T.NumberArray, T.Object), T.NumberArray); + CheckEqual(T.Semantic(T.Intersect(T.AnyArray, T.Proxy)), T.None); + + // Bitset-function + CheckEqual(T.Intersect(T.MethodFunction, T.Object), T.MethodFunction); + CheckEqual(T.Semantic(T.Intersect(T.NumberFunction1, T.Proxy)), T.None); + + // Bitset-union + CheckEqual(T.Intersect(T.Object, T.Union(T.ObjectConstant1, T.ObjectClass)), + T.Union(T.ObjectConstant1, T.ObjectClass)); + CheckEqual(T.Semantic(T.Intersect(T.Union(T.ArrayClass, T.ObjectConstant1), + T.Number)), + T.None); + + // Class-constant + CHECK(T.Intersect(T.ObjectConstant1, T.ObjectClass)->IsInhabited()); // !!! + CHECK(T.Intersect(T.ArrayClass, T.ObjectConstant2)->IsInhabited()); + + // Array-union + CheckEqual(T.Intersect(T.NumberArray, T.Union(T.NumberArray, T.ArrayClass)), + T.NumberArray); + CheckEqual(T.Intersect(T.AnyArray, T.Union(T.Object, T.SmiConstant)), + T.AnyArray); + CHECK(!T.Intersect(T.Union(T.AnyArray, T.ArrayConstant), T.NumberArray) + ->IsInhabited()); + + // Function-union + CheckEqual( + T.Intersect(T.MethodFunction, T.Union(T.String, T.MethodFunction)), + T.MethodFunction); + CheckEqual(T.Intersect(T.NumberFunction1, T.Union(T.Object, T.SmiConstant)), + T.NumberFunction1); + CHECK(!T.Intersect(T.Union(T.MethodFunction, T.Name), T.NumberFunction2) + ->IsInhabited()); + + // Class-union + CheckEqual( + T.Intersect(T.ArrayClass, T.Union(T.ObjectConstant2, T.ArrayClass)), + T.ArrayClass); + CheckEqual(T.Intersect(T.ArrayClass, T.Union(T.Object, T.SmiConstant)), + T.ArrayClass); + CHECK(T.Intersect(T.Union(T.ObjectClass, T.ArrayConstant), T.ArrayClass) + ->IsInhabited()); // !!! + + // Constant-union + CheckEqual(T.Intersect(T.ObjectConstant1, + T.Union(T.ObjectConstant1, T.ObjectConstant2)), + T.ObjectConstant1); + CheckEqual(T.Intersect(T.SmiConstant, T.Union(T.Number, T.ObjectConstant2)), + T.SmiConstant); + CHECK( + T.Intersect(T.Union(T.ArrayConstant, T.ObjectClass), T.ObjectConstant1) + ->IsInhabited()); // !!! + + // Union-union + CheckEqual(T.Intersect(T.Union(T.Number, T.ArrayClass), + T.Union(T.SignedSmall, T.Receiver)), + T.Union(T.SignedSmall, T.ArrayClass)); + CheckEqual(T.Intersect(T.Union(T.Number, T.ObjectClass), + T.Union(T.Signed32, T.OtherObject)), + T.Union(T.Signed32, T.ObjectClass)); + CheckEqual(T.Intersect(T.Union(T.ObjectConstant2, T.ObjectConstant1), + T.Union(T.ObjectConstant1, T.ObjectConstant2)), + T.Union(T.ObjectConstant2, T.ObjectConstant1)); + CheckEqual( + T.Intersect(T.Union(T.ArrayClass, + T.Union(T.ObjectConstant2, T.ObjectConstant1)), + T.Union(T.ObjectConstant1, + T.Union(T.ArrayConstant, T.ObjectConstant2))), + T.Union(T.ArrayConstant, + T.Union(T.ObjectConstant2, T.ObjectConstant1))); // !!! + } + + void Distributivity() { + // Union(T1, Intersect(T2, T3)) = Intersect(Union(T1, T2), Union(T1, T3)) + // This does NOT hold. For example: + // Untagged \/ (Untagged /\ Class(../Tagged)) = Untagged \/ Class(../Tagged) + // (Untagged \/ Untagged) /\ (Untagged \/ Class(../Tagged)) = + // Untagged /\ (Untagged \/ Class(../Tagged)) = Untagged + // because Untagged <= Untagged \/ Class(../Tagged) + /* + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + AstType* union12 = T.Union(type1, type2); + AstType* union13 = T.Union(type1, type3); + AstType* intersect23 = T.Intersect(type2, type3); + AstType* union1_23 = T.Union(type1, intersect23); + AstType* intersect12_13 = T.Intersect(union12, union13); + CHECK(Equal(union1_23, intersect12_13)); + } + } + } + */ + + // Intersect(T1, Union(T2, T3)) = Union(Intersect(T1, T2), Intersect(T1,T3)) + // This does NOT hold. For example: + // Untagged /\ (Untagged \/ Class(../Tagged)) = Untagged + // (Untagged /\ Untagged) \/ (Untagged /\ Class(../Tagged)) = + // Untagged \/ Class(../Tagged) + /* + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { + AstType* type1 = *it1; + AstType* type2 = *it2; + AstType* type3 = *it3; + AstType* intersect12 = T.Intersect(type1, type2); + AstType* intersect13 = T.Intersect(type1, type3); + AstType* union23 = T.Union(type2, type3); + AstType* intersect1_23 = T.Intersect(type1, union23); + AstType* union12_13 = T.Union(intersect12, intersect13); + CHECK(Equal(intersect1_23, union12_13)); + } + } + } + */ + } + + void GetRange() { + // GetRange(Range(a, b)) = Range(a, b). + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + AstType* type1 = *it1; + if (type1->IsRange()) { + AstRangeType* range = type1->GetRange()->AsRange(); + CHECK(type1->Min() == range->Min()); + CHECK(type1->Max() == range->Max()); + } + } + + // GetRange(Union(Constant(x), Range(min,max))) == Range(min, max). + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + if (type1->IsConstant() && type2->IsRange()) { + AstType* u = T.Union(type1, type2); + + CHECK(type2->Min() == u->GetRange()->Min()); + CHECK(type2->Max() == u->GetRange()->Max()); + } + } + } + } + + void HTypeFromType() { + for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { + for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { + AstType* type1 = *it1; + AstType* type2 = *it2; + HType htype1 = HType::FromType(type1); + HType htype2 = HType::FromType(type2); + CHECK(!type1->Is(type2) || htype1.IsSubtypeOf(htype2)); + } + } + } +}; + +} // namespace + +TEST(AstIsSomeType_zone) { Tests().IsSomeType(); } + +TEST(AstPointwiseRepresentation_zone) { Tests().PointwiseRepresentation(); } + +TEST(AstBitsetType_zone) { Tests().Bitset(); } + +TEST(AstClassType_zone) { Tests().Class(); } + +TEST(AstConstantType_zone) { Tests().Constant(); } + +TEST(AstRangeType_zone) { Tests().Range(); } + +TEST(AstArrayType_zone) { Tests().Array(); } + +TEST(AstFunctionType_zone) { Tests().Function(); } + +TEST(AstOf_zone) { Tests().Of(); } + +TEST(AstNowOf_zone) { Tests().NowOf(); } + +TEST(AstMinMax_zone) { Tests().MinMax(); } + +TEST(AstBitsetGlb_zone) { Tests().BitsetGlb(); } + +TEST(AstBitsetLub_zone) { Tests().BitsetLub(); } + +TEST(AstIs1_zone) { Tests().Is1(); } + +TEST(AstIs2_zone) { Tests().Is2(); } + +TEST(AstNowIs_zone) { Tests().NowIs(); } + +TEST(AstContains_zone) { Tests().Contains(); } + +TEST(AstNowContains_zone) { Tests().NowContains(); } + +TEST(AstMaybe_zone) { Tests().Maybe(); } + +TEST(AstUnion1_zone) { Tests().Union1(); } + +TEST(AstUnion2_zone) { Tests().Union2(); } + +TEST(AstUnion3_zone) { Tests().Union3(); } + +TEST(AstUnion4_zone) { Tests().Union4(); } + +TEST(AstIntersect_zone) { Tests().Intersect(); } + +TEST(AstDistributivity_zone) { Tests().Distributivity(); } + +TEST(AstGetRange_zone) { Tests().GetRange(); } + +TEST(AstHTypeFromType_zone) { Tests().HTypeFromType(); } diff --git a/deps/v8/test/cctest/test-ast.cc b/deps/v8/test/cctest/test-ast.cc index c2cc89828e..5512bfce96 100644 --- a/deps/v8/test/cctest/test-ast.cc +++ b/deps/v8/test/cctest/test-ast.cc @@ -30,6 +30,7 @@ #include "src/v8.h" #include "src/ast/ast.h" +#include "src/zone/accounting-allocator.h" #include "test/cctest/cctest.h" using namespace v8::internal; @@ -38,7 +39,7 @@ TEST(List) { List<AstNode*>* list = new List<AstNode*>(0); CHECK_EQ(0, list->length()); - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); AstValueFactory value_factory(&zone, 0); AstNodeFactory factory(&value_factory); @@ -58,3 +59,43 @@ TEST(List) { CHECK_EQ(0, list->length()); delete list; } + +TEST(ConcatStrings) { + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator); + AstValueFactory value_factory(&zone, 0); + + const AstRawString* one_byte = value_factory.GetOneByteString("a"); + + uint16_t two_byte_buffer[] = { + 0x3b1, + }; + const AstRawString* two_byte = value_factory.GetTwoByteString( + Vector<const uint16_t>(two_byte_buffer, 1)); + + const AstRawString* expectation = value_factory.GetOneByteString("aa"); + const AstRawString* result = value_factory.ConcatStrings(one_byte, one_byte); + CHECK(result->is_one_byte()); + CHECK_EQ(expectation, result); + + uint16_t expectation_buffer_one_two[] = {'a', 0x3b1}; + expectation = value_factory.GetTwoByteString( + Vector<const uint16_t>(expectation_buffer_one_two, 2)); + result = value_factory.ConcatStrings(one_byte, two_byte); + CHECK(!result->is_one_byte()); + CHECK_EQ(expectation, result); + + uint16_t expectation_buffer_two_one[] = {0x3b1, 'a'}; + expectation = value_factory.GetTwoByteString( + Vector<const uint16_t>(expectation_buffer_two_one, 2)); + result = value_factory.ConcatStrings(two_byte, one_byte); + CHECK(!result->is_one_byte()); + CHECK_EQ(expectation, result); + + uint16_t expectation_buffer_two_two[] = {0x3b1, 0x3b1}; + expectation = value_factory.GetTwoByteString( + Vector<const uint16_t>(expectation_buffer_two_two, 2)); + result = value_factory.ConcatStrings(two_byte, two_byte); + CHECK(!result->is_one_byte()); + CHECK_EQ(expectation, result); +} diff --git a/deps/v8/test/cctest/test-bit-vector.cc b/deps/v8/test/cctest/test-bit-vector.cc index 6b9fbc7ee2..99c5a68d45 100644 --- a/deps/v8/test/cctest/test-bit-vector.cc +++ b/deps/v8/test/cctest/test-bit-vector.cc @@ -35,7 +35,7 @@ using namespace v8::internal; TEST(BitVector) { - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); { BitVector v(15, &zone); diff --git a/deps/v8/test/cctest/test-code-cache.cc b/deps/v8/test/cctest/test-code-cache.cc index 817fa15b34..b0f020d960 100644 --- a/deps/v8/test/cctest/test-code-cache.cc +++ b/deps/v8/test/cctest/test-code-cache.cc @@ -4,8 +4,17 @@ #include "src/v8.h" +#include "src/factory.h" +#include "src/isolate.h" #include "src/list.h" #include "src/objects.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" namespace v8 { diff --git a/deps/v8/test/cctest/test-code-layout.cc b/deps/v8/test/cctest/test-code-layout.cc index a88c8783e6..7e80dd6417 100644 --- a/deps/v8/test/cctest/test-code-layout.cc +++ b/deps/v8/test/cctest/test-code-layout.cc @@ -2,7 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/factory.h" +#include "src/isolate.h" #include "src/objects.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" using namespace v8::internal; diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc index 2d153e3822..588f430131 100644 --- a/deps/v8/test/cctest/test-code-stub-assembler.cc +++ b/deps/v8/test/cctest/test-code-stub-assembler.cc @@ -3,6 +3,9 @@ // found in the LICENSE file. #include "src/base/utils/random-number-generator.h" +#include "src/code-factory.h" +#include "src/code-stub-assembler.h" +#include "src/compiler/node.h" #include "src/ic/stub-cache.h" #include "src/isolate.h" #include "test/cctest/compiler/code-assembler-tester.h" @@ -132,7 +135,7 @@ TEST(TryToName) { Label passed(&m), failed(&m); Label if_keyisindex(&m), if_keyisunique(&m), if_bailout(&m); - Variable var_index(&m, MachineRepresentation::kWord32); + Variable var_index(&m, MachineType::PointerRepresentation()); m.TryToName(key, &if_keyisindex, &var_index, &if_keyisunique, &if_bailout); @@ -140,8 +143,8 @@ TEST(TryToName) { m.GotoUnless( m.WordEqual(expected_result, m.SmiConstant(Smi::FromInt(kKeyIsIndex))), &failed); - m.Branch(m.Word32Equal(m.SmiToWord32(expected_arg), var_index.value()), - &passed, &failed); + m.Branch(m.WordEqual(m.SmiUntag(expected_arg), var_index.value()), &passed, + &failed); m.Bind(&if_keyisunique); m.GotoUnless( @@ -181,9 +184,17 @@ TEST(TryToName) { } { - // TryToName(<negative smi>) => bailout. + // TryToName(<negative smi>) => if_keyisindex: smi value. + // A subsequent bounds check needs to take care of this case. Handle<Object> key(Smi::FromInt(-1), isolate); - ft.CheckTrue(key, expect_bailout); + ft.CheckTrue(key, expect_index, key); + } + + { + // TryToName(<heap number with int value>) => if_keyisindex: number. + Handle<Object> key(isolate->factory()->NewHeapNumber(153)); + Handle<Object> index(Smi::FromInt(153), isolate); + ft.CheckTrue(key, expect_index, index); } { @@ -206,6 +217,31 @@ TEST(TryToName) { } { + // TryToName(<internalized uncacheable number string>) => bailout + Handle<Object> key = + isolate->factory()->InternalizeUtf8String("4294967294"); + ft.CheckTrue(key, expect_bailout); + } + + { + // TryToName(<non-internalized number string>) => if_keyisindex: number. + Handle<String> key = isolate->factory()->NewStringFromAsciiChecked("153"); + uint32_t dummy; + CHECK(key->AsArrayIndex(&dummy)); + CHECK(key->HasHashCode()); + CHECK(!key->IsInternalizedString()); + Handle<Object> index(Smi::FromInt(153), isolate); + ft.CheckTrue(key, expect_index, index); + } + + { + // TryToName(<number string without cached index>) => bailout. + Handle<String> key = isolate->factory()->NewStringFromAsciiChecked("153"); + CHECK(!key->HasHashCode()); + ft.CheckTrue(key, expect_bailout); + } + + { // TryToName(<non-internalized string>) => bailout. Handle<Object> key = isolate->factory()->NewStringFromAsciiChecked("test"); ft.CheckTrue(key, expect_bailout); @@ -232,7 +268,7 @@ void TestNameDictionaryLookup() { Label passed(&m), failed(&m); Label if_found(&m), if_not_found(&m); - Variable var_name_index(&m, MachineRepresentation::kWord32); + Variable var_name_index(&m, MachineType::PointerRepresentation()); m.NameDictionaryLookup<Dictionary>(dictionary, unique_name, &if_found, &var_name_index, &if_not_found); @@ -338,7 +374,7 @@ void TestNumberDictionaryLookup() { Label passed(&m), failed(&m); Label if_found(&m), if_not_found(&m); - Variable var_entry(&m, MachineRepresentation::kWord32); + Variable var_entry(&m, MachineType::PointerRepresentation()); m.NumberDictionaryLookup<Dictionary>(dictionary, key, &if_found, &var_entry, &if_not_found); diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc index aef10f1f7a..bce3fb2394 100644 --- a/deps/v8/test/cctest/test-compiler.cc +++ b/deps/v8/test/cctest/test-compiler.cc @@ -30,10 +30,11 @@ #include "src/v8.h" +#include "src/api.h" #include "src/compiler.h" #include "src/disasm.h" +#include "src/factory.h" #include "src/interpreter/interpreter.h" -#include "src/parsing/parser.h" #include "test/cctest/cctest.h" using namespace v8::internal; @@ -841,3 +842,26 @@ TEST(IgnitionEntryTrampolineSelfHealing) { CHECK_NE(*isolate->builtins()->InterpreterEntryTrampoline(), f2->code()); CHECK_EQ(23.0, GetGlobalProperty("result2")->Number()); } + +TEST(InvocationCount) { + FLAG_allow_natives_syntax = true; + FLAG_always_opt = false; + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + + CompileRun( + "function bar() {};" + "function foo() { return bar(); };" + "foo();"); + Handle<JSFunction> foo = Handle<JSFunction>::cast(GetGlobalProperty("foo")); + CHECK_EQ(1, foo->feedback_vector()->invocation_count()); + CompileRun("foo()"); + CHECK_EQ(2, foo->feedback_vector()->invocation_count()); + CompileRun("bar()"); + CHECK_EQ(2, foo->feedback_vector()->invocation_count()); + CompileRun("foo(); foo()"); + CHECK_EQ(4, foo->feedback_vector()->invocation_count()); + CompileRun("%BaselineFunctionOnNextCall(foo);"); + CompileRun("foo();"); + CHECK_EQ(5, foo->feedback_vector()->invocation_count()); +} diff --git a/deps/v8/test/cctest/test-conversions.cc b/deps/v8/test/cctest/test-conversions.cc index 9569dc8678..87dc99c3f0 100644 --- a/deps/v8/test/cctest/test-conversions.cc +++ b/deps/v8/test/cctest/test-conversions.cc @@ -27,9 +27,20 @@ #include <stdlib.h> -#include "src/v8.h" - #include "src/base/platform/platform.h" +#include "src/conversions.h" +#include "src/factory.h" +#include "src/isolate.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +#include "src/objects.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" +#include "src/unicode-cache.h" +#include "src/v8.h" #include "test/cctest/cctest.h" using namespace v8::internal; diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index 83c4e33c45..2f92f54d37 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -1023,6 +1023,7 @@ TEST(BoundFunctionCall) { // This tests checks distribution of the samples through the source lines. static void TickLines(bool optimize) { + if (!optimize) i::FLAG_crankshaft = false; CcTest::InitializeVM(); LocalContext env; i::FLAG_allow_natives_syntax = true; @@ -1032,10 +1033,15 @@ static void TickLines(bool optimize) { i::HandleScope scope(isolate); i::EmbeddedVector<char, 512> script; + i::EmbeddedVector<char, 64> optimize_call; const char* func_name = "func"; - const char* opt_func = - optimize ? "%OptimizeFunctionOnNextCall" : "%NeverOptimizeFunction"; + if (optimize) { + i::SNPrintF(optimize_call, "%%OptimizeFunctionOnNextCall(%s);\n", + func_name); + } else { + optimize_call[0] = '\0'; + } i::SNPrintF(script, "function %s() {\n" " var n = 0;\n" @@ -1045,10 +1051,10 @@ static void TickLines(bool optimize) { " n += m * m * m;\n" " }\n" "}\n" - "%s();" - "%s(%s);\n" + "%s();\n" + "%s" "%s();\n", - func_name, func_name, opt_func, func_name, func_name); + func_name, func_name, optimize_call.start(), func_name); CompileRun(script.start()); @@ -1164,7 +1170,7 @@ TEST(FunctionCallSample) { // Collect garbage that might have be generated while installing // extensions. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CompileRun(call_function_test_source); v8::Local<v8::Function> function = GetFunction(env.local(), "start"); @@ -1671,9 +1677,11 @@ static void CheckFunctionDetails(v8::Isolate* isolate, int script_id, int line, int column) { v8::Local<v8::Context> context = isolate->GetCurrentContext(); CHECK(v8_str(name)->Equals(context, node->GetFunctionName()).FromJust()); + CHECK_EQ(0, strcmp(name, node->GetFunctionNameStr())); CHECK(v8_str(script_name) ->Equals(context, node->GetScriptResourceName()) .FromJust()); + CHECK_EQ(0, strcmp(script_name, node->GetScriptResourceNameStr())); CHECK_EQ(script_id, node->GetScriptId()); CHECK_EQ(line, node->GetLineNumber()); CHECK_EQ(column, node->GetColumnNumber()); diff --git a/deps/v8/test/cctest/test-date.cc b/deps/v8/test/cctest/test-date.cc index a745949fbd..aa9f9f7ca1 100644 --- a/deps/v8/test/cctest/test-date.cc +++ b/deps/v8/test/cctest/test-date.cc @@ -25,9 +25,10 @@ // (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/v8.h" - +#include "src/date.h" #include "src/global-handles.h" +#include "src/isolate.h" +#include "src/v8.h" #include "test/cctest/cctest.h" using namespace v8::internal; diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc index 925eaf4c27..9d63e7b3a6 100644 --- a/deps/v8/test/cctest/test-debug.cc +++ b/deps/v8/test/cctest/test-debug.cc @@ -371,8 +371,8 @@ void CheckDebuggerUnloaded(bool check_functions) { CHECK(!CcTest::i_isolate()->debug()->debug_info_list_); // Collect garbage to ensure weak handles are cleared. - CcTest::heap()->CollectAllGarbage(); - CcTest::heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(Heap::kMakeHeapIterableMask); // Iterate the head and check that there are no debugger related objects left. HeapIterator iterator(CcTest::heap()); @@ -800,10 +800,10 @@ static void DebugEventBreakPointCollectGarbage( break_point_hit_count++; if (break_point_hit_count % 2 == 0) { // Scavenge. - CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); + CcTest::CollectGarbage(v8::internal::NEW_SPACE); } else { // Mark sweep compact. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } } } @@ -824,7 +824,7 @@ static void DebugEventBreak( // Run the garbage collector to enforce heap verification if option // --verify-heap is set. - CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); + CcTest::CollectGarbage(v8::internal::NEW_SPACE); // Set the break flag again to come back here as soon as possible. v8::Debug::DebugBreak(CcTest::isolate()); @@ -1217,12 +1217,12 @@ static void CallAndGC(v8::Local<v8::Context> context, CHECK_EQ(1 + i * 3, break_point_hit_count); // Scavenge and call function. - CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); + CcTest::CollectGarbage(v8::internal::NEW_SPACE); f->Call(context, recv, 0, NULL).ToLocalChecked(); CHECK_EQ(2 + i * 3, break_point_hit_count); // Mark sweep (and perhaps compact) and call function. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); f->Call(context, recv, 0, NULL).ToLocalChecked(); CHECK_EQ(3 + i * 3, break_point_hit_count); } @@ -2080,7 +2080,7 @@ TEST(ScriptBreakPointLineTopLevel) { ->Get(context, v8_str(env->GetIsolate(), "f")) .ToLocalChecked()); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); SetScriptBreakPointByNameFromJS(env->GetIsolate(), "test.html", 3, -1); diff --git a/deps/v8/test/cctest/test-decls.cc b/deps/v8/test/cctest/test-decls.cc index e4506aee50..d7d71c2383 100644 --- a/deps/v8/test/cctest/test-decls.cc +++ b/deps/v8/test/cctest/test-decls.cc @@ -29,6 +29,7 @@ #include "src/v8.h" +#include "src/heap/heap-inl.h" #include "src/heap/heap.h" #include "test/cctest/cctest.h" @@ -144,7 +145,7 @@ void DeclarationContext::Check(const char* source, int get, int set, int query, InitializeIfNeeded(); // A retry after a GC may pollute the counts, so perform gc now // to avoid that. - CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); + CcTest::CollectGarbage(v8::internal::NEW_SPACE); HandleScope scope(CcTest::isolate()); TryCatch catcher(CcTest::isolate()); catcher.SetVerbose(true); @@ -175,7 +176,7 @@ void DeclarationContext::Check(const char* source, int get, int set, int query, } } // Clean slate for the next test. - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); } @@ -248,9 +249,7 @@ TEST(Unknown) { { DeclarationContext context; context.Check("function x() { }; x", 1, // access - 0, - 0, - EXPECT_RESULT); + 1, 1, EXPECT_RESULT); } } @@ -284,9 +283,7 @@ TEST(Absent) { { AbsentPropertyContext context; context.Check("function x() { }; x", 1, // access - 0, - 0, - EXPECT_RESULT); + 1, 1, EXPECT_RESULT); } { AbsentPropertyContext context; @@ -354,9 +351,7 @@ TEST(Appearing) { { AppearingPropertyContext context; context.Check("function x() { }; x", 1, // access - 0, - 0, - EXPECT_RESULT); + 1, 1, EXPECT_RESULT); } } @@ -485,11 +480,7 @@ TEST(ExistsInHiddenPrototype) { } { ExistsInHiddenPrototypeContext context; - context.Check("function x() { }; x", - 0, - 0, - 0, - EXPECT_RESULT); + context.Check("function x() { }; x", 0, 1, 1, EXPECT_RESULT); } } diff --git a/deps/v8/test/cctest/test-deoptimization.cc b/deps/v8/test/cctest/test-deoptimization.cc index 7ba16b59f8..0d435c5e10 100644 --- a/deps/v8/test/cctest/test-deoptimization.cc +++ b/deps/v8/test/cctest/test-deoptimization.cc @@ -109,7 +109,8 @@ class AllowNativesSyntaxNoInlining { // Abort any ongoing incremental marking to make sure that all weak global // handle callbacks are processed. static void NonIncrementalGC(i::Isolate* isolate) { - isolate->heap()->CollectAllGarbage(); + isolate->heap()->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, + i::GarbageCollectionReason::kTesting); } diff --git a/deps/v8/test/cctest/test-dictionary.cc b/deps/v8/test/cctest/test-dictionary.cc index 0756de6c1d..c1184fa2b4 100644 --- a/deps/v8/test/cctest/test-dictionary.cc +++ b/deps/v8/test/cctest/test-dictionary.cc @@ -56,7 +56,7 @@ static void TestHashMap(Handle<HashMap> table) { CHECK_EQ(table->Lookup(b), CcTest::heap()->the_hole_value()); // Keys still have to be valid after objects were moved. - CcTest::heap()->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK_EQ(table->NumberOfElements(), 1); CHECK_EQ(table->Lookup(a), *b); CHECK_EQ(table->Lookup(b), CcTest::heap()->the_hole_value()); @@ -126,7 +126,7 @@ static void TestHashSet(Handle<HashSet> table) { CHECK(!table->Has(isolate, b)); // Keys still have to be valid after objects were moved. - CcTest::heap()->CollectGarbage(NEW_SPACE); + CcTest::CollectGarbage(NEW_SPACE); CHECK_EQ(table->NumberOfElements(), 1); CHECK(table->Has(isolate, a)); CHECK(!table->Has(isolate, b)); diff --git a/deps/v8/test/cctest/test-disasm-arm.cc b/deps/v8/test/cctest/test-disasm-arm.cc index d5f594962c..1c6d360d7f 100644 --- a/deps/v8/test/cctest/test-disasm-arm.cc +++ b/deps/v8/test/cctest/test-disasm-arm.cc @@ -505,8 +505,8 @@ TEST(msr_mrs_disasm) { TEST(Vfp) { SET_UP(); - if (CpuFeatures::IsSupported(VFP3)) { - CpuFeatureScope scope(&assm, VFP3); + if (CpuFeatures::IsSupported(VFPv3)) { + CpuFeatureScope scope(&assm, VFPv3); COMPARE(vmov(d0, r2, r3), "ec432b10 vmov d0, r2, r3"); COMPARE(vmov(r2, r3, d0), @@ -737,6 +737,7 @@ TEST(Vfp) { "eeba9bcf vcvt.f64.s32 d9, d9, #2"); if (CpuFeatures::IsSupported(VFP32DREGS)) { + CpuFeatureScope scope(&assm, VFP32DREGS); COMPARE(vmov(d3, d27), "eeb03b6b vmov.f64 d3, d27"); COMPARE(vmov(d18, d7), @@ -840,6 +841,7 @@ TEST(ARMv8_vrintX_disasm) { SET_UP(); if (CpuFeatures::IsSupported(ARMv8)) { + CpuFeatureScope scope(&assm, ARMv8); COMPARE(vrinta(d0, d0), "feb80b40 vrinta.f64.f64 d0, d0"); COMPARE(vrinta(d2, d3), "feb82b43 vrinta.f64.f64 d2, d3"); @@ -860,10 +862,26 @@ TEST(ARMv8_vrintX_disasm) { } +TEST(ARMv8_vminmax_disasm) { + SET_UP(); + + if (CpuFeatures::IsSupported(ARMv8)) { + CpuFeatureScope scope(&assm, ARMv8); + COMPARE(vmaxnm(d0, d1, d2), "fe810b02 vmaxnm.f64 d0, d1, d2"); + COMPARE(vminnm(d3, d4, d5), "fe843b45 vminnm.f64 d3, d4, d5"); + COMPARE(vmaxnm(s6, s7, s8), "fe833a84 vmaxnm.f32 s6, s7, s8"); + COMPARE(vminnm(s9, s10, s11), "fec54a65 vminnm.f32 s9, s10, s11"); + } + + VERIFY_RUN(); +} + + TEST(ARMv8_vselX_disasm) { SET_UP(); if (CpuFeatures::IsSupported(ARMv8)) { + CpuFeatureScope scope(&assm, ARMv8); // Native instructions. COMPARE(vsel(eq, d0, d1, d2), "fe010b02 vseleq.f64 d0, d1, d2"); @@ -918,6 +936,10 @@ TEST(Neon) { "f3886a11 vmovl.u8 q3, d1"); COMPARE(vmovl(NeonU8, q4, d2), "f3888a12 vmovl.u8 q4, d2"); + COMPARE(vswp(d0, d31), + "f3b2002f vswp d0, d31"); + COMPARE(vswp(d16, d14), + "f3f2000e vswp d16, d14"); } VERIFY_RUN(); @@ -1165,10 +1187,33 @@ TEST(Barrier) { COMPARE(dsb(ISH), "f57ff04b dsb ish"); - COMPARE(isb(ISH), - "f57ff06b isb ish"); + COMPARE(isb(SY), + "f57ff06f isb sy"); + } else { + // ARMv6 uses CP15 to implement barriers. The BarrierOption argument is + // ignored. + COMPARE(dmb(ISH), + "ee070fba mcr (CP15DMB)"); + COMPARE(dsb(OSH), + "ee070f9a mcr (CP15DSB)"); + COMPARE(isb(SY), + "ee070f95 mcr (CP15ISB)"); } + // ARMv6 barriers. + // Details available in ARM DDI 0406C.b, B3-1750. + COMPARE(mcr(p15, 0, r0, cr7, cr10, 5), "ee070fba mcr (CP15DMB)"); + COMPARE(mcr(p15, 0, r0, cr7, cr10, 4), "ee070f9a mcr (CP15DSB)"); + COMPARE(mcr(p15, 0, r0, cr7, cr5, 4), "ee070f95 mcr (CP15ISB)"); + // Rt is ignored. + COMPARE(mcr(p15, 0, lr, cr7, cr10, 5), "ee07efba mcr (CP15DMB)"); + COMPARE(mcr(p15, 0, lr, cr7, cr10, 4), "ee07ef9a mcr (CP15DSB)"); + COMPARE(mcr(p15, 0, lr, cr7, cr5, 4), "ee07ef95 mcr (CP15ISB)"); + // The mcr instruction can be conditional. + COMPARE(mcr(p15, 0, r0, cr7, cr10, 5, eq), "0e070fba mcreq (CP15DMB)"); + COMPARE(mcr(p15, 0, r0, cr7, cr10, 4, ne), "1e070f9a mcrne (CP15DSB)"); + COMPARE(mcr(p15, 0, r0, cr7, cr5, 4, mi), "4e070f95 mcrmi (CP15ISB)"); + VERIFY_RUN(); } diff --git a/deps/v8/test/cctest/test-disasm-mips.cc b/deps/v8/test/cctest/test-disasm-mips.cc index b4f81ec3b1..010657d468 100644 --- a/deps/v8/test/cctest/test-disasm-mips.cc +++ b/deps/v8/test/cctest/test-disasm-mips.cc @@ -1090,3 +1090,20 @@ TEST(ctc1_cfc1_disasm) { COMPARE(cfc1(a0, FCSR), "4444f800 cfc1 a0, FCSR"); VERIFY_RUN(); } + +TEST(madd_msub_maddf_msubf) { + SET_UP(); + if (IsMipsArchVariant(kMips32r2)) { + COMPARE(madd_s(f4, f6, f8, f10), "4cca4120 madd.s f4, f6, f8, f10"); + COMPARE(madd_d(f4, f6, f8, f10), "4cca4121 madd.d f4, f6, f8, f10"); + COMPARE(msub_s(f4, f6, f8, f10), "4cca4128 msub.s f4, f6, f8, f10"); + COMPARE(msub_d(f4, f6, f8, f10), "4cca4129 msub.d f4, f6, f8, f10"); + } + if (IsMipsArchVariant(kMips32r6)) { + COMPARE(maddf_s(f4, f8, f10), "460a4118 maddf.s f4, f8, f10"); + COMPARE(maddf_d(f4, f8, f10), "462a4118 maddf.d f4, f8, f10"); + COMPARE(msubf_s(f4, f8, f10), "460a4119 msubf.s f4, f8, f10"); + COMPARE(msubf_d(f4, f8, f10), "462a4119 msubf.d f4, f8, f10"); + } + VERIFY_RUN(); +} diff --git a/deps/v8/test/cctest/test-disasm-mips64.cc b/deps/v8/test/cctest/test-disasm-mips64.cc index dc6f34e462..fbc370daa1 100644 --- a/deps/v8/test/cctest/test-disasm-mips64.cc +++ b/deps/v8/test/cctest/test-disasm-mips64.cc @@ -699,6 +699,10 @@ TEST(Type0) { COMPARE(dsbh(s6, s7), "7c17b0a4 dsbh s6, s7"); COMPARE(dsbh(v0, v1), "7c0310a4 dsbh v0, v1"); + COMPARE(dins_(a0, a1, 31, 1), "7ca4ffc7 dins a0, a1, 31, 1"); + COMPARE(dins_(s6, s7, 30, 2), "7ef6ff87 dins s6, s7, 30, 2"); + COMPARE(dins_(v0, v1, 0, 32), "7c62f807 dins v0, v1, 0, 32"); + COMPARE(dshd(a0, a1), "7c052164 dshd a0, a1"); COMPARE(dshd(s6, s7), "7c17b164 dshd s6, s7"); COMPARE(dshd(v0, v1), "7c031164 dshd v0, v1"); @@ -1272,3 +1276,20 @@ TEST(ctc1_cfc1_disasm) { COMPARE(cfc1(a0, FCSR), "4444f800 cfc1 a0, FCSR"); VERIFY_RUN(); } + +TEST(madd_msub_maddf_msubf) { + SET_UP(); + if (kArchVariant == kMips64r2) { + COMPARE(madd_s(f4, f6, f8, f10), "4cca4120 madd.s f4, f6, f8, f10"); + COMPARE(madd_d(f4, f6, f8, f10), "4cca4121 madd.d f4, f6, f8, f10"); + COMPARE(msub_s(f4, f6, f8, f10), "4cca4128 msub.s f4, f6, f8, f10"); + COMPARE(msub_d(f4, f6, f8, f10), "4cca4129 msub.d f4, f6, f8, f10"); + } + if (kArchVariant == kMips64r6) { + COMPARE(maddf_s(f4, f8, f10), "460a4118 maddf.s f4, f8, f10"); + COMPARE(maddf_d(f4, f8, f10), "462a4118 maddf.d f4, f8, f10"); + COMPARE(msubf_s(f4, f8, f10), "460a4119 msubf.s f4, f8, f10"); + COMPARE(msubf_d(f4, f8, f10), "462a4119 msubf.d f4, f8, f10"); + } + VERIFY_RUN(); +} diff --git a/deps/v8/test/cctest/test-disasm-x64.cc b/deps/v8/test/cctest/test-disasm-x64.cc index 284ca859be..af8beaaa83 100644 --- a/deps/v8/test/cctest/test-disasm-x64.cc +++ b/deps/v8/test/cctest/test-disasm-x64.cc @@ -50,7 +50,7 @@ TEST(DisasmX64) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); HandleScope scope(isolate); - v8::internal::byte buffer[4096]; + v8::internal::byte buffer[8192]; Assembler assm(isolate, buffer, sizeof buffer); DummyStaticFunction(NULL); // just bloody use it (DELETE; debugging) @@ -420,7 +420,8 @@ TEST(DisasmX64) { __ ucomiss(xmm0, xmm1); __ ucomiss(xmm0, Operand(rbx, rcx, times_4, 10000)); } - // SSE 2 instructions + + // SSE2 instructions { __ cvttsd2si(rdx, Operand(rbx, rcx, times_4, 10000)); __ cvttsd2si(rdx, xmm1); @@ -467,6 +468,13 @@ TEST(DisasmX64) { __ punpckldq(xmm1, xmm11); __ punpckldq(xmm5, Operand(rdx, 4)); __ punpckhdq(xmm8, xmm15); + +#define EMIT_SSE2_INSTR(instruction, notUsed1, notUsed2, notUsed3) \ + __ instruction(xmm5, xmm1); \ + __ instruction(xmm5, Operand(rdx, 4)); + + SSE2_INSTRUCTION_LIST(EMIT_SSE2_INSTR) +#undef EMIT_SSE2_INSTR } // cmov. @@ -490,6 +498,24 @@ TEST(DisasmX64) { } { + if (CpuFeatures::IsSupported(SSE3)) { + CpuFeatureScope scope(&assm, SSE3); + __ lddqu(xmm1, Operand(rdx, 4)); + } + } + +#define EMIT_SSE34_INSTR(instruction, notUsed1, notUsed2, notUsed3, notUsed4) \ + __ instruction(xmm5, xmm1); \ + __ instruction(xmm5, Operand(rdx, 4)); + + { + if (CpuFeatures::IsSupported(SSSE3)) { + CpuFeatureScope scope(&assm, SSSE3); + SSSE3_INSTRUCTION_LIST(EMIT_SSE34_INSTR) + } + } + + { if (CpuFeatures::IsSupported(SSE4_1)) { CpuFeatureScope scope(&assm, SSE4_1); __ insertps(xmm5, xmm1, 123); @@ -539,12 +565,10 @@ TEST(DisasmX64) { __ movups(xmm5, xmm1); __ movups(xmm5, Operand(rdx, 4)); __ movups(Operand(rdx, 4), xmm5); - __ paddd(xmm5, xmm1); - __ paddd(xmm5, Operand(rdx, 4)); - __ psubd(xmm5, xmm1); - __ psubd(xmm5, Operand(rdx, 4)); __ pmulld(xmm5, xmm1); __ pmulld(xmm5, Operand(rdx, 4)); + __ pmullw(xmm5, xmm1); + __ pmullw(xmm5, Operand(rdx, 4)); __ pmuludq(xmm5, xmm1); __ pmuludq(xmm5, Operand(rdx, 4)); __ psrldq(xmm5, 123); @@ -553,8 +577,11 @@ TEST(DisasmX64) { __ cvtps2dq(xmm5, Operand(rdx, 4)); __ cvtdq2ps(xmm5, xmm1); __ cvtdq2ps(xmm5, Operand(rdx, 4)); + + SSE4_INSTRUCTION_LIST(EMIT_SSE34_INSTR) } } +#undef EMIT_SSE34_INSTR // AVX instruction { @@ -678,6 +705,41 @@ TEST(DisasmX64) { __ vcmpnltpd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); __ vcmpnlepd(xmm5, xmm4, xmm1); __ vcmpnlepd(xmm5, xmm4, Operand(rbx, rcx, times_4, 10000)); + +#define EMIT_SSE2_AVXINSTR(instruction, notUsed1, notUsed2, notUsed3) \ + __ v##instruction(xmm10, xmm5, xmm1); \ + __ v##instruction(xmm10, xmm5, Operand(rdx, 4)); + +#define EMIT_SSE34_AVXINSTR(instruction, notUsed1, notUsed2, notUsed3, \ + notUsed4) \ + __ v##instruction(xmm10, xmm5, xmm1); \ + __ v##instruction(xmm10, xmm5, Operand(rdx, 4)); + + SSE2_INSTRUCTION_LIST(EMIT_SSE2_AVXINSTR) + SSSE3_INSTRUCTION_LIST(EMIT_SSE34_AVXINSTR) + SSE4_INSTRUCTION_LIST(EMIT_SSE34_AVXINSTR) +#undef EMIT_SSE2_AVXINSTR +#undef EMIT_SSE34_AVXINSTR + + __ vlddqu(xmm1, Operand(rbx, rcx, times_4, 10000)); + __ vpsllw(xmm0, xmm15, 21); + __ vpsrlw(xmm0, xmm15, 21); + __ vpsraw(xmm0, xmm15, 21); + __ vpsrad(xmm0, xmm15, 21); + __ vpextrb(rax, xmm2, 12); + __ vpextrb(Operand(rbx, rcx, times_4, 10000), xmm2, 12); + __ vpextrw(rax, xmm2, 5); + __ vpextrw(Operand(rbx, rcx, times_4, 10000), xmm2, 5); + __ vpextrd(rax, xmm2, 2); + __ vpextrd(Operand(rbx, rcx, times_4, 10000), xmm2, 2); + + __ vpinsrb(xmm1, xmm2, rax, 12); + __ vpinsrb(xmm1, xmm2, Operand(rbx, rcx, times_4, 10000), 12); + __ vpinsrw(xmm1, xmm2, rax, 5); + __ vpinsrw(xmm1, xmm2, Operand(rbx, rcx, times_4, 10000), 5); + __ vpinsrd(xmm1, xmm2, rax, 2); + __ vpinsrd(xmm1, xmm2, Operand(rbx, rcx, times_4, 10000), 2); + __ vpshufd(xmm1, xmm2, 85); } } diff --git a/deps/v8/test/cctest/test-feedback-vector.cc b/deps/v8/test/cctest/test-feedback-vector.cc index 4322e746e2..af9c6feef0 100644 --- a/deps/v8/test/cctest/test-feedback-vector.cc +++ b/deps/v8/test/cctest/test-feedback-vector.cc @@ -41,8 +41,8 @@ TEST(VectorStructure) { // Empty vectors are the empty fixed array. StaticFeedbackVectorSpec empty; Handle<TypeFeedbackVector> vector = NewTypeFeedbackVector(isolate, &empty); - CHECK(Handle<FixedArray>::cast(vector) - .is_identical_to(factory->empty_fixed_array())); + CHECK(Handle<FixedArray>::cast(vector).is_identical_to( + factory->empty_type_feedback_vector())); // Which can nonetheless be queried. CHECK(vector->is_empty()); @@ -199,8 +199,6 @@ TEST(VectorCallICStates) { LocalContext context; v8::HandleScope scope(context->GetIsolate()); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); - // Make sure function f has a call that uses a type feedback slot. CompileRun( "function foo() { return 17; }" @@ -219,7 +217,7 @@ TEST(VectorCallICStates) { CHECK_EQ(GENERIC, nexus.StateFromFeedback()); // After a collection, state should remain GENERIC. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(GENERIC, nexus.StateFromFeedback()); } @@ -229,8 +227,6 @@ TEST(VectorCallFeedbackForArray) { LocalContext context; v8::HandleScope scope(context->GetIsolate()); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); - // Make sure function f has a call that uses a type feedback slot. CompileRun( "function foo() { return 17; }" @@ -246,7 +242,7 @@ TEST(VectorCallFeedbackForArray) { CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); CHECK(nexus.GetFeedback()->IsAllocationSite()); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // It should stay monomorphic even after a GC. CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); } @@ -273,6 +269,11 @@ TEST(VectorCallCounts) { CompileRun("f(foo); f(foo);"); CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); CHECK_EQ(3, nexus.ExtractCallCount()); + + // Send the IC megamorphic, but we should still have incrementing counts. + CompileRun("f(function() { return 12; });"); + CHECK_EQ(GENERIC, nexus.StateFromFeedback()); + CHECK_EQ(4, nexus.ExtractCallCount()); } TEST(VectorConstructCounts) { @@ -289,13 +290,21 @@ TEST(VectorConstructCounts) { Handle<JSFunction> f = GetFunction("f"); Handle<TypeFeedbackVector> feedback_vector = Handle<TypeFeedbackVector>(f->feedback_vector(), isolate); + FeedbackVectorSlot slot(0); + CallICNexus nexus(feedback_vector, slot); + CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); + CHECK(feedback_vector->Get(slot)->IsWeakCell()); CompileRun("f(Foo); f(Foo);"); - FeedbackVectorSlot cslot(1); - CHECK(feedback_vector->Get(cslot)->IsSmi()); - CHECK_EQ(3, Smi::cast(feedback_vector->Get(cslot))->value()); + CHECK_EQ(MONOMORPHIC, nexus.StateFromFeedback()); + CHECK_EQ(3, nexus.ExtractCallCount()); + + // Send the IC megamorphic, but we should still have incrementing counts. + CompileRun("f(function() {});"); + CHECK_EQ(GENERIC, nexus.StateFromFeedback()); + CHECK_EQ(4, nexus.ExtractCallCount()); } TEST(VectorLoadICStates) { @@ -304,7 +313,6 @@ TEST(VectorLoadICStates) { LocalContext context; v8::HandleScope scope(context->GetIsolate()); Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); // Make sure function f has a call that uses a type feedback slot. CompileRun( @@ -348,7 +356,7 @@ TEST(VectorLoadICStates) { CHECK(!nexus.FindFirstMap()); // After a collection, state should not be reset to PREMONOMORPHIC. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); CHECK_EQ(MEGAMORPHIC, nexus.StateFromFeedback()); } @@ -551,8 +559,7 @@ TEST(ReferenceContextAllocatesNoSlots) { CHECK_SLOT_KIND(helper, 3, FeedbackVectorSlotKind::STORE_IC); CHECK_SLOT_KIND(helper, 4, FeedbackVectorSlotKind::LOAD_IC); CHECK_SLOT_KIND(helper, 5, FeedbackVectorSlotKind::LOAD_IC); - // Binary operation feedback is a general slot. - CHECK_SLOT_KIND(helper, 6, FeedbackVectorSlotKind::GENERAL); + CHECK_SLOT_KIND(helper, 6, FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC); } } diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc index d2f44ce1be..771d3f116d 100644 --- a/deps/v8/test/cctest/test-field-type-tracking.cc +++ b/deps/v8/test/cctest/test-field-type-tracking.cc @@ -10,14 +10,14 @@ #include "src/v8.h" #include "src/compilation-cache.h" -#include "src/compiler.h" +#include "src/compilation-dependencies.h" +#include "src/compilation-info.h" #include "src/execution.h" #include "src/factory.h" #include "src/field-type.h" #include "src/global-handles.h" #include "src/ic/stub-cache.h" #include "src/macro-assembler.h" -#include "src/types.h" using namespace v8::internal; @@ -604,10 +604,10 @@ static void TestGeneralizeRepresentation( // Create new maps by generalizing representation of propX field. Handle<Map> field_owner(map->FindFieldOwner(property_index), isolate); - CompilationInfo info(ArrayVector("testing"), isolate, &zone); - CHECK(!info.dependencies()->HasAborted()); + CompilationDependencies dependencies(isolate, &zone); + CHECK(!dependencies.HasAborted()); - info.dependencies()->AssumeFieldType(field_owner); + dependencies.AssumeFieldType(field_owner); Handle<Map> new_map = Map::ReconfigureProperty(map, property_index, kData, NONE, @@ -624,21 +624,21 @@ static void TestGeneralizeRepresentation( CHECK(map->is_deprecated()); CHECK_NE(*map, *new_map); CHECK_EQ(expected_field_type_dependency && !field_owner->is_deprecated(), - info.dependencies()->HasAborted()); + dependencies.HasAborted()); } else if (expected_deprecation) { CHECK(!map->is_stable()); CHECK(map->is_deprecated()); CHECK(field_owner->is_deprecated()); CHECK_NE(*map, *new_map); - CHECK(!info.dependencies()->HasAborted()); + CHECK(!dependencies.HasAborted()); } else { CHECK(!field_owner->is_deprecated()); CHECK(map->is_stable()); // Map did not change, must be left stable. CHECK_EQ(*map, *new_map); - CHECK_EQ(expected_field_type_dependency, info.dependencies()->HasAborted()); + CHECK_EQ(expected_field_type_dependency, dependencies.HasAborted()); } { @@ -652,7 +652,7 @@ static void TestGeneralizeRepresentation( } } - info.dependencies()->Rollback(); // Properly cleanup compilation info. + dependencies.Rollback(); // Properly cleanup compilation info. // Update all deprecated maps and check that they are now the same. Handle<Map> updated_map = Map::Update(map); @@ -983,9 +983,9 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( Zone zone(isolate->allocator()); Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); - CompilationInfo info(ArrayVector("testing"), isolate, &zone); - CHECK(!info.dependencies()->HasAborted()); - info.dependencies()->AssumeFieldType(field_owner); + CompilationDependencies dependencies(isolate, &zone); + CHECK(!dependencies.HasAborted()); + dependencies.AssumeFieldType(field_owner); // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which // should generalize representations in |map1|. @@ -1003,8 +1003,8 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( expectations.SetDataField(i, expected_representation, expected_type); } CHECK(map->is_deprecated()); - CHECK(!info.dependencies()->HasAborted()); - info.dependencies()->Rollback(); // Properly cleanup compilation info. + CHECK(!dependencies.HasAborted()); + dependencies.Rollback(); // Properly cleanup compilation info. CHECK_NE(*map, *new_map); CHECK(!new_map->is_deprecated()); @@ -1068,9 +1068,9 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( Zone zone(isolate->allocator()); Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); - CompilationInfo info(ArrayVector("testing"), isolate, &zone); - CHECK(!info.dependencies()->HasAborted()); - info.dependencies()->AssumeFieldType(field_owner); + CompilationDependencies dependencies(isolate, &zone); + CHECK(!dependencies.HasAborted()); + dependencies.AssumeFieldType(field_owner); // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which // should generalize representations in |map1|. @@ -1092,8 +1092,8 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( } CHECK(!map->is_deprecated()); CHECK_EQ(*map, *new_map); - CHECK_EQ(expected_field_type_dependency, info.dependencies()->HasAborted()); - info.dependencies()->Rollback(); // Properly cleanup compilation info. + CHECK_EQ(expected_field_type_dependency, dependencies.HasAborted()); + dependencies.Rollback(); // Properly cleanup compilation info. CHECK(!new_map->is_deprecated()); CHECK(expectations.Check(*new_map)); @@ -1599,9 +1599,9 @@ static void TestReconfigureElementsKind_GeneralizeRepresentation( Zone zone(isolate->allocator()); Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); - CompilationInfo info(ArrayVector("testing"), isolate, &zone); - CHECK(!info.dependencies()->HasAborted()); - info.dependencies()->AssumeFieldType(field_owner); + CompilationDependencies dependencies(isolate, &zone); + CHECK(!dependencies.HasAborted()); + dependencies.AssumeFieldType(field_owner); // Reconfigure elements kinds of |map2|, which should generalize // representations in |map|. @@ -1617,8 +1617,8 @@ static void TestReconfigureElementsKind_GeneralizeRepresentation( expectations.SetDataField(kDiffProp, expected_representation, expected_type); CHECK(map->is_deprecated()); - CHECK(!info.dependencies()->HasAborted()); - info.dependencies()->Rollback(); // Properly cleanup compilation info. + CHECK(!dependencies.HasAborted()); + dependencies.Rollback(); // Properly cleanup compilation info. CHECK_NE(*map, *new_map); CHECK(!new_map->is_deprecated()); @@ -1692,9 +1692,9 @@ static void TestReconfigureElementsKind_GeneralizeRepresentationTrivial( Zone zone(isolate->allocator()); Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); - CompilationInfo info(ArrayVector("testing"), isolate, &zone); - CHECK(!info.dependencies()->HasAborted()); - info.dependencies()->AssumeFieldType(field_owner); + CompilationDependencies dependencies(isolate, &zone); + CHECK(!dependencies.HasAborted()); + dependencies.AssumeFieldType(field_owner); // Reconfigure elements kinds of |map2|, which should generalize // representations in |map|. @@ -1713,8 +1713,8 @@ static void TestReconfigureElementsKind_GeneralizeRepresentationTrivial( expectations.SetDataField(kDiffProp, expected_representation, expected_type); CHECK(!map->is_deprecated()); CHECK_EQ(*map, *new_map); - CHECK_EQ(expected_field_type_dependency, info.dependencies()->HasAborted()); - info.dependencies()->Rollback(); // Properly cleanup compilation info. + CHECK_EQ(expected_field_type_dependency, dependencies.HasAborted()); + dependencies.Rollback(); // Properly cleanup compilation info. CHECK(!new_map->is_deprecated()); CHECK(expectations.Check(*new_map)); @@ -2418,8 +2418,8 @@ TEST(FieldTypeConvertSimple) { Zone zone(isolate->allocator()); - CHECK_EQ(FieldType::Any()->Convert(&zone), Type::NonInternal()); - CHECK_EQ(FieldType::None()->Convert(&zone), Type::None()); + CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal()); + CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None()); } // TODO(ishell): add this test once IS_ACCESSOR_FIELD_SUPPORTED is supported. diff --git a/deps/v8/test/cctest/test-flags.cc b/deps/v8/test/cctest/test-flags.cc index e423fdc7e0..fd49dae1e9 100644 --- a/deps/v8/test/cctest/test-flags.cc +++ b/deps/v8/test/cctest/test-flags.cc @@ -27,6 +27,7 @@ #include <stdlib.h> +#include "src/flags.h" #include "src/v8.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-global-handles.cc b/deps/v8/test/cctest/test-global-handles.cc index 06e7466dc6..d777432f2f 100644 --- a/deps/v8/test/cctest/test-global-handles.cc +++ b/deps/v8/test/cctest/test-global-handles.cc @@ -25,8 +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. +#include "src/api.h" +#include "src/factory.h" #include "src/global-handles.h" - +#include "src/isolate.h" +#include "src/objects.h" #include "test/cctest/cctest.h" using namespace v8::internal; @@ -349,7 +352,7 @@ TEST(EternalHandles) { CHECK(!eternals[i].IsEmpty()); } - isolate->heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); for (int i = 0; i < kArrayLength; i++) { for (int j = 0; j < 2; j++) { @@ -442,7 +445,7 @@ TEST(FinalizerWeakness) { g.SetWeak(&g, finalizer, v8::WeakCallbackType::kFinalizer); } - CcTest::i_isolate()->heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK(!g.IsEmpty()); v8::HandleScope scope(isolate); @@ -465,7 +468,7 @@ TEST(PhatomHandlesWithoutCallbacks) { } CHECK_EQ(0, isolate->NumberOfPhantomHandleResetsSinceLastCall()); - CcTest::i_isolate()->heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); CHECK_EQ(2, isolate->NumberOfPhantomHandleResetsSinceLastCall()); CHECK_EQ(0, isolate->NumberOfPhantomHandleResetsSinceLastCall()); } diff --git a/deps/v8/test/cctest/test-hashmap.cc b/deps/v8/test/cctest/test-hashmap.cc index 2d423b4543..b1adc7b005 100644 --- a/deps/v8/test/cctest/test-hashmap.cc +++ b/deps/v8/test/cctest/test-hashmap.cc @@ -34,17 +34,13 @@ using namespace v8::internal; -static bool DefaultMatchFun(void* a, void* b) { - return a == b; -} - typedef uint32_t (*IntKeyHash)(uint32_t key); class IntSet { public: - explicit IntSet(IntKeyHash hash) : hash_(hash), map_(DefaultMatchFun) {} + explicit IntSet(IntKeyHash hash) : hash_(hash) {} void Insert(int x) { CHECK_NE(0, x); // 0 corresponds to (void*)NULL - illegal key value diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc index b0a2e00202..17893b3b48 100644 --- a/deps/v8/test/cctest/test-heap-profiler.cc +++ b/deps/v8/test/cctest/test-heap-profiler.cc @@ -62,12 +62,8 @@ class NamedEntriesDetector { if (strcmp(entry->name(), "C2") == 0) has_C2 = true; } - static bool AddressesMatch(void* key1, void* key2) { - return key1 == key2; - } - void CheckAllReachables(i::HeapEntry* root) { - v8::base::HashMap visited(AddressesMatch); + v8::base::HashMap visited; i::List<i::HeapEntry*> list(10); list.Add(root); CheckEntry(root); @@ -135,17 +131,12 @@ static bool HasString(const v8::HeapGraphNode* node, const char* contents) { } -static bool AddressesMatch(void* key1, void* key2) { - return key1 == key2; -} - - // Check that snapshot has no unretained entries except root. static bool ValidateSnapshot(const v8::HeapSnapshot* snapshot, int depth = 3) { i::HeapSnapshot* heap_snapshot = const_cast<i::HeapSnapshot*>( reinterpret_cast<const i::HeapSnapshot*>(snapshot)); - v8::base::HashMap visited(AddressesMatch); + v8::base::HashMap visited; i::List<i::HeapGraphEdge>& edges = heap_snapshot->edges(); for (int i = 0; i < edges.length(); ++i) { v8::base::HashMap::Entry* entry = visited.LookupOrInsert( @@ -501,7 +492,7 @@ void CheckSimdSnapshot(const char* program, const char* var_name) { // 28 @ 13523 entry with no retainer: /hidden/ system / AllocationSite // 44 @ 767 $map: /hidden/ system / Map // 44 @ 59 $map: /hidden/ system / Map - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); const v8::HeapSnapshot* snapshot = heap_profiler->TakeHeapSnapshot(); CHECK(ValidateSnapshot(snapshot)); @@ -738,7 +729,7 @@ TEST(HeapSnapshotAddressReuse) { CompileRun( "for (var i = 0; i < 10000; ++i)\n" " a[i] = new A();\n"); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); const v8::HeapSnapshot* snapshot2 = heap_profiler->TakeHeapSnapshot(); CHECK(ValidateSnapshot(snapshot2)); @@ -780,7 +771,7 @@ TEST(HeapEntryIdsAndArrayShift) { "for (var i = 0; i < 1; ++i)\n" " a.shift();\n"); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); const v8::HeapSnapshot* snapshot2 = heap_profiler->TakeHeapSnapshot(); CHECK(ValidateSnapshot(snapshot2)); @@ -821,7 +812,7 @@ TEST(HeapEntryIdsAndGC) { const v8::HeapSnapshot* snapshot1 = heap_profiler->TakeHeapSnapshot(); CHECK(ValidateSnapshot(snapshot1)); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); const v8::HeapSnapshot* snapshot2 = heap_profiler->TakeHeapSnapshot(); CHECK(ValidateSnapshot(snapshot2)); @@ -1150,7 +1141,7 @@ TEST(HeapSnapshotObjectsStats) { // We have to call GC 6 times. In other case the garbage will be // the reason of flakiness. for (int i = 0; i < 6; ++i) { - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } v8::SnapshotObjectId initial_id; @@ -1305,7 +1296,7 @@ TEST(HeapObjectIds) { } heap_profiler->StopTrackingHeapObjects(); - CcTest::heap()->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); for (int i = 0; i < kLength; i++) { v8::SnapshotObjectId id = heap_profiler->GetObjectId(objects[i]); @@ -2557,8 +2548,34 @@ TEST(ArrayGrowLeftTrim) { heap_profiler->StopTrackingHeapObjects(); } +TEST(TrackHeapAllocationsWithInlining) { + v8::HandleScope scope(v8::Isolate::GetCurrent()); + LocalContext env; + + v8::HeapProfiler* heap_profiler = env->GetIsolate()->GetHeapProfiler(); + heap_profiler->StartTrackingHeapObjects(true); + + CompileRun(record_trace_tree_source); + + AllocationTracker* tracker = + reinterpret_cast<i::HeapProfiler*>(heap_profiler)->allocation_tracker(); + CHECK(tracker); + // Resolve all function locations. + tracker->PrepareForSerialization(); + // Print for better diagnostics in case of failure. + tracker->trace_tree()->Print(tracker); + + const char* names[] = {"", "start", "f_0_0"}; + AllocationTraceNode* node = FindNode(tracker, ArrayVector(names)); + CHECK(node); + CHECK_GE(node->allocation_count(), 12u); + CHECK_GE(node->allocation_size(), 4 * node->allocation_count()); + heap_profiler->StopTrackingHeapObjects(); +} -TEST(TrackHeapAllocations) { +TEST(TrackHeapAllocationsWithoutInlining) { + i::FLAG_turbo_inlining = false; + i::FLAG_max_inlined_source_size = 0; // Disable inlining v8::HandleScope scope(v8::Isolate::GetCurrent()); LocalContext env; @@ -3033,7 +3050,7 @@ TEST(SamplingHeapProfiler) { " eval(\"new Array(100)\");\n" "}\n"); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); std::unique_ptr<v8::AllocationProfile> profile( heap_profiler->GetAllocationProfile()); @@ -3087,7 +3104,7 @@ TEST(SamplingHeapProfilerLeftTrimming) { " a.shift();\n" "}\n"); - CcTest::heap()->CollectGarbage(v8::internal::NEW_SPACE); + CcTest::CollectGarbage(v8::internal::NEW_SPACE); // Should not crash. heap_profiler->StopSamplingHeapProfiler(); diff --git a/deps/v8/test/cctest/test-identity-map.cc b/deps/v8/test/cctest/test-identity-map.cc index 648508cbd1..bf07b033db 100644 --- a/deps/v8/test/cctest/test-identity-map.cc +++ b/deps/v8/test/cctest/test-identity-map.cc @@ -2,11 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "src/v8.h" - +#include "src/factory.h" #include "src/identity-map.h" -#include "src/zone.h" - +#include "src/isolate.h" +#include "src/objects.h" +#include "src/zone/zone.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" +#include "src/v8.h" #include "test/cctest/cctest.h" namespace v8 { @@ -327,7 +335,7 @@ TEST(ExplicitGC) { } // Do an explicit, real GC. - t.heap()->CollectGarbage(i::NEW_SPACE); + t.heap()->CollectGarbage(i::NEW_SPACE, i::GarbageCollectionReason::kTesting); // Check that searching for the numbers finds the same values. for (size_t i = 0; i < arraysize(num_keys); i++) { @@ -379,7 +387,7 @@ TEST(CanonicalHandleScope) { Handle<String> string2(*string1); CHECK_EQ(number1.location(), number2.location()); CHECK_EQ(string1.location(), string2.location()); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); Handle<HeapNumber> number3(*number2); Handle<String> string3(*string2); CHECK_EQ(number1.location(), number3.location()); diff --git a/deps/v8/test/cctest/test-javascript-arm64.cc b/deps/v8/test/cctest/test-javascript-arm64.cc index 3f7d9d17c3..aa4988ef06 100644 --- a/deps/v8/test/cctest/test-javascript-arm64.cc +++ b/deps/v8/test/cctest/test-javascript-arm64.cc @@ -34,7 +34,6 @@ #include "src/compilation-cache.h" #include "src/execution.h" #include "src/isolate.h" -#include "src/parsing/parser.h" #include "src/unicode-inl.h" #include "src/utils.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-js-arm64-variables.cc b/deps/v8/test/cctest/test-js-arm64-variables.cc index 38b22f9b1b..f6958fd422 100644 --- a/deps/v8/test/cctest/test-js-arm64-variables.cc +++ b/deps/v8/test/cctest/test-js-arm64-variables.cc @@ -36,7 +36,6 @@ #include "src/compilation-cache.h" #include "src/execution.h" #include "src/isolate.h" -#include "src/parsing/parser.h" #include "src/unicode-inl.h" #include "src/utils.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-list.cc b/deps/v8/test/cctest/test-list.cc index 20c13f6e65..1ffff19ef8 100644 --- a/deps/v8/test/cctest/test-list.cc +++ b/deps/v8/test/cctest/test-list.cc @@ -27,6 +27,8 @@ #include <stdlib.h> #include <string.h> +#include "src/list-inl.h" +#include "src/list.h" #include "src/v8.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-liveedit.cc b/deps/v8/test/cctest/test-liveedit.cc index bae3ed5ac4..6cc6c70214 100644 --- a/deps/v8/test/cctest/test-liveedit.cc +++ b/deps/v8/test/cctest/test-liveedit.cc @@ -95,7 +95,7 @@ void CompareStringsOneWay(const char* s1, const char* s2, int expected_diff_parameter = -1) { StringCompareInput input(s1, s2); - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); DiffChunkStruct* first_chunk; diff --git a/deps/v8/test/cctest/test-lockers.cc b/deps/v8/test/cctest/test-lockers.cc index 09546e94f3..4d4f3e2177 100644 --- a/deps/v8/test/cctest/test-lockers.cc +++ b/deps/v8/test/cctest/test-lockers.cc @@ -36,7 +36,6 @@ #include "src/compilation-cache.h" #include "src/execution.h" #include "src/isolate.h" -#include "src/parsing/parser.h" #include "src/unicode-inl.h" #include "src/utils.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-log.cc b/deps/v8/test/cctest/test-log.cc index b6bb2569dd..91029286f7 100644 --- a/deps/v8/test/cctest/test-log.cc +++ b/deps/v8/test/cctest/test-log.cc @@ -34,13 +34,13 @@ #include <cmath> #endif // __linux__ -#include "src/v8.h" - -#include "src/log.h" +#include "src/api.h" #include "src/log-utils.h" +#include "src/log.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" @@ -486,7 +486,7 @@ TEST(EquivalenceOfLoggingAndTraversal) { "})(this);"); logger->StopProfiler(); reinterpret_cast<i::Isolate*>(isolate)->heap()->CollectAllGarbage( - i::Heap::kMakeHeapIterableMask); + i::Heap::kMakeHeapIterableMask, i::GarbageCollectionReason::kTesting); logger->StringEvent("test-logging-done", ""); // Iterate heap to find compiled functions, will write to log. diff --git a/deps/v8/test/cctest/test-macro-assembler-mips.cc b/deps/v8/test/cctest/test-macro-assembler-mips.cc index 057c370304..9561db691e 100644 --- a/deps/v8/test/cctest/test-macro-assembler-mips.cc +++ b/deps/v8/test/cctest/test-macro-assembler-mips.cc @@ -1306,4 +1306,57 @@ TEST(Uldc1) { } } +static const std::vector<uint32_t> sltu_test_values() { + static const uint32_t kValues[] = { + 0, 1, 0x7ffe, 0x7fff, 0x8000, + 0x8001, 0xfffe, 0xffff, 0xffff7ffe, 0xffff7fff, + 0xffff8000, 0xffff8001, 0xfffffffe, 0xffffffff, + }; + return std::vector<uint32_t>(&kValues[0], &kValues[arraysize(kValues)]); +} + +template <typename Func> +bool run_Sltu(uint32_t rs, uint32_t rd, Func GenerateSltuInstructionFunc) { + typedef int32_t (*F_CVT)(uint32_t x0, uint32_t x1, int x2, int x3, int x4); + + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + MacroAssembler assm(isolate, nullptr, 0, + v8::internal::CodeObjectRequired::kYes); + MacroAssembler* masm = &assm; + + GenerateSltuInstructionFunc(masm, rd); + __ jr(ra); + __ nop(); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + + F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + int32_t res = reinterpret_cast<int32_t>( + CALL_GENERATED_CODE(isolate, f, rs, rd, 0, 0, 0)); + return res == 1; +} + +TEST(Sltu) { + CcTest::InitializeVM(); + + FOR_UINT32_INPUTS(i, sltu_test_values) { + FOR_UINT32_INPUTS(j, sltu_test_values) { + uint32_t rs = *i; + uint32_t rd = *j; + + CHECK_EQ(rs < rd, run_Sltu(rs, rd, + [](MacroAssembler* masm, uint32_t imm) { + __ Sltu(v0, a0, Operand(imm)); + })); + CHECK_EQ(rs < rd, + run_Sltu(rs, rd, [](MacroAssembler* masm, + uint32_t imm) { __ Sltu(v0, a0, a1); })); + } + } +} + #undef __ diff --git a/deps/v8/test/cctest/test-macro-assembler-mips64.cc b/deps/v8/test/cctest/test-macro-assembler-mips64.cc index 5f9451027c..1dc260ff01 100644 --- a/deps/v8/test/cctest/test-macro-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-macro-assembler-mips64.cc @@ -1901,4 +1901,68 @@ TEST(Uldc1) { } } +static const std::vector<uint64_t> sltu_test_values() { + static const uint64_t kValues[] = { + 0, + 1, + 0x7ffe, + 0x7fff, + 0x8000, + 0x8001, + 0xfffe, + 0xffff, + 0xffffffffffff7ffe, + 0xffffffffffff7fff, + 0xffffffffffff8000, + 0xffffffffffff8001, + 0xfffffffffffffffe, + 0xffffffffffffffff, + }; + return std::vector<uint64_t>(&kValues[0], &kValues[arraysize(kValues)]); +} + +template <typename Func> +bool run_Sltu(uint64_t rs, uint64_t rd, Func GenerateSltuInstructionFunc) { + typedef int64_t (*F_CVT)(uint64_t x0, uint64_t x1, int x2, int x3, int x4); + + Isolate* isolate = CcTest::i_isolate(); + HandleScope scope(isolate); + MacroAssembler assm(isolate, nullptr, 0, + v8::internal::CodeObjectRequired::kYes); + MacroAssembler* masm = &assm; + + GenerateSltuInstructionFunc(masm, rd); + __ jr(ra); + __ nop(); + + CodeDesc desc; + assm.GetCode(&desc); + Handle<Code> code = isolate->factory()->NewCode( + desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); + + F_CVT f = FUNCTION_CAST<F_CVT>(code->entry()); + int64_t res = reinterpret_cast<int64_t>( + CALL_GENERATED_CODE(isolate, f, rs, rd, 0, 0, 0)); + return res == 1; +} + +TEST(Sltu) { + CcTest::InitializeVM(); + + FOR_UINT64_INPUTS(i, sltu_test_values) { + FOR_UINT64_INPUTS(j, sltu_test_values) { + uint64_t rs = *i; + uint64_t rd = *j; + + CHECK_EQ(rs < rd, run_Sltu(rs, rd, + [](MacroAssembler* masm, uint64_t imm) { + __ Sltu(v0, a0, Operand(imm)); + })); + CHECK_EQ(rs < rd, + run_Sltu(rs, rd, [](MacroAssembler* masm, + uint64_t imm) { __ Sltu(v0, a0, a1); })); + } + } +} + #undef __ diff --git a/deps/v8/test/cctest/test-mementos.cc b/deps/v8/test/cctest/test-mementos.cc index b26aad03a5..da5ce8ce69 100644 --- a/deps/v8/test/cctest/test-mementos.cc +++ b/deps/v8/test/cctest/test-mementos.cc @@ -25,6 +25,16 @@ // (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/factory.h" +#include "src/heap/heap.h" +#include "src/isolate.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" using namespace v8::internal; @@ -36,7 +46,7 @@ static void SetUpNewSpaceWithPoisonedMementoAtTop() { NewSpace* new_space = heap->new_space(); // Make sure we can allocate some objects without causing a GC later. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // Allocate a string, the GC may suspect a memento behind the string. Handle<SeqOneByteString> string = @@ -62,8 +72,7 @@ TEST(Regress340063) { // Call GC to see if we can handle a poisonous memento right after the // current new space top pointer. - CcTest::i_isolate()->heap()->CollectAllGarbage( - Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); } @@ -80,8 +89,7 @@ TEST(Regress470390) { // Call GC to see if we can handle a poisonous memento right after the // current new space top pointer. - CcTest::i_isolate()->heap()->CollectAllGarbage( - Heap::kAbortIncrementalMarkingMask); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); } @@ -93,5 +101,5 @@ TEST(BadMementoAfterTopForceScavenge) { SetUpNewSpaceWithPoisonedMementoAtTop(); // Force GC to test the poisoned memento handling - CcTest::i_isolate()->heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); } diff --git a/deps/v8/test/cctest/test-modules.cc b/deps/v8/test/cctest/test-modules.cc new file mode 100644 index 0000000000..c33a5a124b --- /dev/null +++ b/deps/v8/test/cctest/test-modules.cc @@ -0,0 +1,111 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/flags.h" + +#include "test/cctest/cctest.h" + +namespace { + +using v8::Context; +using v8::HandleScope; +using v8::Isolate; +using v8::Local; +using v8::MaybeLocal; +using v8::Module; +using v8::ScriptCompiler; +using v8::ScriptOrigin; +using v8::String; +using v8::Value; + +MaybeLocal<Module> AlwaysEmptyResolveCallback(Local<Context> context, + Local<String> specifier, + Local<Module> referrer, + Local<Value> data) { + return MaybeLocal<Module>(); +} + +static int g_count = 0; +MaybeLocal<Module> FailOnSecondCallResolveCallback(Local<Context> context, + Local<String> specifier, + Local<Module> referrer, + Local<Value> data) { + if (g_count++ > 0) return MaybeLocal<Module>(); + Local<String> source_text = v8_str(""); + ScriptOrigin origin(v8_str("module.js")); + ScriptCompiler::Source source(source_text, origin); + return ScriptCompiler::CompileModule(CcTest::isolate(), &source) + .ToLocalChecked(); +} + +TEST(ModuleInstantiationFailures) { + Isolate* isolate = CcTest::isolate(); + HandleScope scope(isolate); + LocalContext env; + + Local<String> source_text = v8_str( + "import './foo.js';" + "export {} from './bar.js';"); + ScriptOrigin origin(v8_str("file.js")); + ScriptCompiler::Source source(source_text, origin); + Local<Module> module = + ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK_EQ(2, module->GetModuleRequestsLength()); + CHECK(v8_str("./foo.js")->StrictEquals(module->GetModuleRequest(0))); + CHECK(v8_str("./bar.js")->StrictEquals(module->GetModuleRequest(1))); + + // Instantiation should fail. + CHECK(!module->Instantiate(env.local(), AlwaysEmptyResolveCallback)); + + // Start over again... + module = ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + + // Instantiation should fail if a sub-module fails to resolve. + g_count = 0; + CHECK(!module->Instantiate(env.local(), FailOnSecondCallResolveCallback)); +} + +static MaybeLocal<Module> CompileSpecifierAsModuleResolveCallback( + Local<Context> context, Local<String> specifier, Local<Module> referrer, + Local<Value> data) { + ScriptOrigin origin(v8_str("module.js")); + ScriptCompiler::Source source(specifier, origin); + return ScriptCompiler::CompileModule(CcTest::isolate(), &source) + .ToLocalChecked(); +} + +TEST(ModuleEvaluation) { + Isolate* isolate = CcTest::isolate(); + HandleScope scope(isolate); + LocalContext env; + + Local<String> source_text = v8_str( + "import 'Object.expando = 5';" + "import 'Object.expando *= 2';"); + ScriptOrigin origin(v8_str("file.js")); + ScriptCompiler::Source source(source_text, origin); + Local<Module> module = + ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK(module->Instantiate(env.local(), + CompileSpecifierAsModuleResolveCallback)); + CHECK(!module->Evaluate(env.local()).IsEmpty()); + ExpectInt32("Object.expando", 10); +} + +TEST(EmbedderData) { + Isolate* isolate = CcTest::isolate(); + HandleScope scope(isolate); + LocalContext env; + + Local<String> source_text = v8_str(""); + ScriptOrigin origin(v8_str("file.js")); + ScriptCompiler::Source source(source_text, origin); + Local<Module> module = + ScriptCompiler::CompileModule(isolate, &source).ToLocalChecked(); + CHECK(module->GetEmbedderData()->IsUndefined()); + module->SetEmbedderData(v8_num(42)); + CHECK_EQ(42, Local<v8::Int32>::Cast(module->GetEmbedderData())->Value()); +} + +} // anonymous namespace diff --git a/deps/v8/test/cctest/test-object.cc b/deps/v8/test/cctest/test-object.cc index e078bfcdb0..396318121a 100644 --- a/deps/v8/test/cctest/test-object.cc +++ b/deps/v8/test/cctest/test-object.cc @@ -2,8 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/factory.h" +#include "src/handles-inl.h" +#include "src/handles.h" +#include "src/isolate.h" +#include "src/objects.h" #include "src/v8.h" - #include "test/cctest/cctest.h" using namespace v8::internal; diff --git a/deps/v8/test/cctest/test-parsing.cc b/deps/v8/test/cctest/test-parsing.cc index 658e73ca84..921cebcad6 100644 --- a/deps/v8/test/cctest/test-parsing.cc +++ b/deps/v8/test/cctest/test-parsing.cc @@ -38,6 +38,7 @@ #include "src/ast/ast.h" #include "src/compiler.h" #include "src/execution.h" +#include "src/flags.h" #include "src/isolate.h" #include "src/objects.h" #include "src/parsing/parse-info.h" @@ -71,17 +72,17 @@ TEST(ScanKeywords) { size_t length = strlen(key_token.keyword); CHECK(static_cast<int>(sizeof(buffer)) >= length); { - i::ExternalOneByteStringUtf16CharacterStream stream(keyword, length); + auto stream = i::ScannerStream::ForTesting(keyword, length); i::Scanner scanner(&unicode_cache); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); CHECK_EQ(key_token.token, scanner.Next()); CHECK_EQ(i::Token::EOS, scanner.Next()); } // Removing characters will make keyword matching fail. { - i::ExternalOneByteStringUtf16CharacterStream stream(keyword, length - 1); + auto stream = i::ScannerStream::ForTesting(keyword, length - 1); i::Scanner scanner(&unicode_cache); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); CHECK_EQ(i::Token::EOS, scanner.Next()); } @@ -90,9 +91,9 @@ TEST(ScanKeywords) { for (int j = 0; j < static_cast<int>(arraysize(chars_to_append)); ++j) { i::MemMove(buffer, keyword, length); buffer[length] = chars_to_append[j]; - i::ExternalOneByteStringUtf16CharacterStream stream(buffer, length + 1); + auto stream = i::ScannerStream::ForTesting(buffer, length + 1); i::Scanner scanner(&unicode_cache); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); CHECK_EQ(i::Token::EOS, scanner.Next()); } @@ -100,9 +101,9 @@ TEST(ScanKeywords) { { i::MemMove(buffer, keyword, length); buffer[length - 1] = '_'; - i::ExternalOneByteStringUtf16CharacterStream stream(buffer, length); + auto stream = i::ScannerStream::ForTesting(buffer, length); i::Scanner scanner(&unicode_cache); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); CHECK_EQ(i::Token::IDENTIFIER, scanner.Next()); CHECK_EQ(i::Token::EOS, scanner.Next()); } @@ -166,10 +167,10 @@ TEST(ScanHTMLEndComments) { uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); for (int i = 0; tests[i]; i++) { const char* source = tests[i]; - i::ExternalOneByteStringUtf16CharacterStream stream(source); + auto stream = i::ScannerStream::ForTesting(source); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); i::Zone zone(CcTest::i_isolate()->allocator()); i::AstValueFactory ast_value_factory( &zone, CcTest::i_isolate()->heap()->HashSeed()); @@ -183,10 +184,10 @@ TEST(ScanHTMLEndComments) { for (int i = 0; fail_tests[i]; i++) { const char* source = fail_tests[i]; - i::ExternalOneByteStringUtf16CharacterStream stream(source); + auto stream = i::ScannerStream::ForTesting(source); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); i::Zone zone(CcTest::i_isolate()->allocator()); i::AstValueFactory ast_value_factory( &zone, CcTest::i_isolate()->heap()->HashSeed()); @@ -340,11 +341,10 @@ TEST(StandAlonePreParser) { uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); for (int i = 0; programs[i]; i++) { - const char* program = programs[i]; - i::ExternalOneByteStringUtf16CharacterStream stream(program); + auto stream = i::ScannerStream::ForTesting(programs[i]); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); i::Zone zone(CcTest::i_isolate()->allocator()); i::AstValueFactory ast_value_factory( @@ -374,11 +374,10 @@ TEST(StandAlonePreParserNoNatives) { uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); for (int i = 0; programs[i]; i++) { - const char* program = programs[i]; - i::ExternalOneByteStringUtf16CharacterStream stream(program); + auto stream = i::ScannerStream::ForTesting(programs[i]); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); // Preparser defaults to disallowing natives syntax. i::Zone zone(CcTest::i_isolate()->allocator()); @@ -444,10 +443,10 @@ TEST(RegressChromium62639) { // and then used the invalid currently scanned literal. This always // failed in debug mode, and sometimes crashed in release mode. - i::ExternalOneByteStringUtf16CharacterStream stream(program); + auto stream = i::ScannerStream::ForTesting(program); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); i::Zone zone(CcTest::i_isolate()->allocator()); i::AstValueFactory ast_value_factory(&zone, CcTest::i_isolate()->heap()->HashSeed()); @@ -464,7 +463,6 @@ TEST(RegressChromium62639) { TEST(Regress928) { v8::V8::Initialize(); i::Isolate* isolate = CcTest::i_isolate(); - i::Factory* factory = isolate->factory(); // Preparsing didn't consider the catch clause of a try statement // as with-content, which made it assume that a function inside @@ -478,11 +476,10 @@ TEST(Regress928) { "var bar = function () { /* second */ }"; v8::HandleScope handles(CcTest::isolate()); - i::Handle<i::String> source = factory->NewStringFromAsciiChecked(program); - i::GenericStringUtf16CharacterStream stream(source, 0, source->length()); + auto stream = i::ScannerStream::ForTesting(program); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); i::Zone zone(CcTest::i_isolate()->allocator()); i::AstValueFactory ast_value_factory(&zone, CcTest::i_isolate()->heap()->HashSeed()); @@ -528,11 +525,10 @@ TEST(PreParseOverflow) { uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); - i::ExternalOneByteStringUtf16CharacterStream stream(program.get(), - kProgramSize); + auto stream = i::ScannerStream::ForTesting(program.get(), kProgramSize); i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); i::Zone zone(CcTest::i_isolate()->allocator()); i::AstValueFactory ast_value_factory(&zone, @@ -545,189 +541,6 @@ TEST(PreParseOverflow) { } -class TestExternalResource: public v8::String::ExternalStringResource { - public: - explicit TestExternalResource(uint16_t* data, int length) - : data_(data), length_(static_cast<size_t>(length)) { } - - ~TestExternalResource() { } - - const uint16_t* data() const { - return data_; - } - - size_t length() const { - return length_; - } - private: - uint16_t* data_; - size_t length_; -}; - - -#define CHECK_EQU(v1, v2) CHECK_EQ(static_cast<int>(v1), static_cast<int>(v2)) - -void TestCharacterStream(const char* one_byte_source, unsigned length, - unsigned start = 0, unsigned end = 0) { - if (end == 0) end = length; - unsigned sub_length = end - start; - i::Isolate* isolate = CcTest::i_isolate(); - i::Factory* factory = isolate->factory(); - i::HandleScope test_scope(isolate); - std::unique_ptr<i::uc16[]> uc16_buffer(new i::uc16[length]); - for (unsigned i = 0; i < length; i++) { - uc16_buffer[i] = static_cast<i::uc16>(one_byte_source[i]); - } - i::Vector<const char> one_byte_vector(one_byte_source, - static_cast<int>(length)); - i::Handle<i::String> one_byte_string = - factory->NewStringFromAscii(one_byte_vector).ToHandleChecked(); - TestExternalResource resource(uc16_buffer.get(), length); - i::Handle<i::String> uc16_string( - factory->NewExternalStringFromTwoByte(&resource).ToHandleChecked()); - ScriptResource one_byte_resource(one_byte_source, length); - i::Handle<i::String> ext_one_byte_string( - factory->NewExternalStringFromOneByte(&one_byte_resource) - .ToHandleChecked()); - - i::ExternalTwoByteStringUtf16CharacterStream uc16_stream( - i::Handle<i::ExternalTwoByteString>::cast(uc16_string), start, end); - i::ExternalOneByteStringUtf16CharacterStream one_byte_stream( - i::Handle<i::ExternalOneByteString>::cast(ext_one_byte_string), start, - end); - i::GenericStringUtf16CharacterStream string_stream(one_byte_string, start, - end); - i::ExternalOneByteStringUtf16CharacterStream utf8_stream(one_byte_source, - end); - utf8_stream.SeekForward(start); - - unsigned i = start; - while (i < end) { - // Read streams one char at a time - CHECK_EQU(i, uc16_stream.pos()); - CHECK_EQU(i, string_stream.pos()); - CHECK_EQU(i, utf8_stream.pos()); - CHECK_EQU(i, one_byte_stream.pos()); - int32_t c0 = one_byte_source[i]; - int32_t c1 = uc16_stream.Advance(); - int32_t c2 = string_stream.Advance(); - int32_t c3 = utf8_stream.Advance(); - int32_t c4 = one_byte_stream.Advance(); - i++; - CHECK_EQ(c0, c1); - CHECK_EQ(c0, c2); - CHECK_EQ(c0, c3); - CHECK_EQ(c0, c4); - CHECK_EQU(i, uc16_stream.pos()); - CHECK_EQU(i, string_stream.pos()); - CHECK_EQU(i, utf8_stream.pos()); - CHECK_EQU(i, one_byte_stream.pos()); - } - while (i > start + sub_length / 4) { - // Pushback, re-read, pushback again. - int32_t c0 = one_byte_source[i - 1]; - CHECK_EQU(i, uc16_stream.pos()); - CHECK_EQU(i, string_stream.pos()); - CHECK_EQU(i, utf8_stream.pos()); - CHECK_EQU(i, one_byte_stream.pos()); - uc16_stream.PushBack(c0); - string_stream.PushBack(c0); - utf8_stream.PushBack(c0); - one_byte_stream.PushBack(c0); - i--; - CHECK_EQU(i, uc16_stream.pos()); - CHECK_EQU(i, string_stream.pos()); - CHECK_EQU(i, utf8_stream.pos()); - CHECK_EQU(i, one_byte_stream.pos()); - int32_t c1 = uc16_stream.Advance(); - int32_t c2 = string_stream.Advance(); - int32_t c3 = utf8_stream.Advance(); - int32_t c4 = one_byte_stream.Advance(); - i++; - CHECK_EQU(i, uc16_stream.pos()); - CHECK_EQU(i, string_stream.pos()); - CHECK_EQU(i, utf8_stream.pos()); - CHECK_EQU(i, one_byte_stream.pos()); - CHECK_EQ(c0, c1); - CHECK_EQ(c0, c2); - CHECK_EQ(c0, c3); - CHECK_EQ(c0, c4); - uc16_stream.PushBack(c0); - string_stream.PushBack(c0); - utf8_stream.PushBack(c0); - one_byte_stream.PushBack(c0); - i--; - CHECK_EQU(i, uc16_stream.pos()); - CHECK_EQU(i, string_stream.pos()); - CHECK_EQU(i, utf8_stream.pos()); - CHECK_EQU(i, one_byte_stream.pos()); - } - unsigned halfway = start + sub_length / 2; - uc16_stream.SeekForward(halfway - i); - string_stream.SeekForward(halfway - i); - utf8_stream.SeekForward(halfway - i); - one_byte_stream.SeekForward(halfway - i); - i = halfway; - CHECK_EQU(i, uc16_stream.pos()); - CHECK_EQU(i, string_stream.pos()); - CHECK_EQU(i, utf8_stream.pos()); - CHECK_EQU(i, one_byte_stream.pos()); - - while (i < end) { - // Read streams one char at a time - CHECK_EQU(i, uc16_stream.pos()); - CHECK_EQU(i, string_stream.pos()); - CHECK_EQU(i, utf8_stream.pos()); - CHECK_EQU(i, one_byte_stream.pos()); - int32_t c0 = one_byte_source[i]; - int32_t c1 = uc16_stream.Advance(); - int32_t c2 = string_stream.Advance(); - int32_t c3 = utf8_stream.Advance(); - int32_t c4 = one_byte_stream.Advance(); - i++; - CHECK_EQ(c0, c1); - CHECK_EQ(c0, c2); - CHECK_EQ(c0, c3); - CHECK_EQ(c0, c4); - CHECK_EQU(i, uc16_stream.pos()); - CHECK_EQU(i, string_stream.pos()); - CHECK_EQU(i, utf8_stream.pos()); - CHECK_EQU(i, one_byte_stream.pos()); - } - - int32_t c1 = uc16_stream.Advance(); - int32_t c2 = string_stream.Advance(); - int32_t c3 = utf8_stream.Advance(); - int32_t c4 = one_byte_stream.Advance(); - CHECK_LT(c1, 0); - CHECK_LT(c2, 0); - CHECK_LT(c3, 0); - CHECK_LT(c4, 0); -} - -#undef CHECK_EQU - -TEST(CharacterStreams) { - v8::Isolate* isolate = CcTest::isolate(); - v8::HandleScope handles(isolate); - v8::Local<v8::Context> context = v8::Context::New(isolate); - v8::Context::Scope context_scope(context); - - TestCharacterStream("abc\0\n\r\x7f", 7); - static const unsigned kBigStringSize = 4096; - char buffer[kBigStringSize + 1]; - for (unsigned i = 0; i < kBigStringSize; i++) { - buffer[i] = static_cast<char>(i & 0x7f); - } - TestCharacterStream(buffer, kBigStringSize); - - TestCharacterStream(buffer, kBigStringSize, 576, 3298); - - TestCharacterStream("\0", 1); - TestCharacterStream("", 0); -} - - void TestStreamScanner(i::Utf16CharacterStream* stream, i::Token::Value* expected_tokens, int skip_pos = 0, // Zero means not skipping. @@ -750,9 +563,9 @@ void TestStreamScanner(i::Utf16CharacterStream* stream, TEST(StreamScanner) { v8::V8::Initialize(); - const char* str1 = "{ foo get for : */ <- \n\n /*foo*/ bib"; - i::ExternalOneByteStringUtf16CharacterStream stream1(str1); + std::unique_ptr<i::Utf16CharacterStream> stream1( + i::ScannerStream::ForTesting(str1)); i::Token::Value expectations1[] = { i::Token::LBRACE, i::Token::IDENTIFIER, @@ -767,10 +580,11 @@ TEST(StreamScanner) { i::Token::EOS, i::Token::ILLEGAL }; - TestStreamScanner(&stream1, expectations1, 0, 0); + TestStreamScanner(stream1.get(), expectations1, 0, 0); const char* str2 = "case default const {THIS\nPART\nSKIPPED} do"; - i::ExternalOneByteStringUtf16CharacterStream stream2(str2); + std::unique_ptr<i::Utf16CharacterStream> stream2( + i::ScannerStream::ForTesting(str2)); i::Token::Value expectations2[] = { i::Token::CASE, i::Token::DEFAULT, @@ -784,7 +598,7 @@ TEST(StreamScanner) { }; CHECK_EQ('{', str2[19]); CHECK_EQ('}', str2[37]); - TestStreamScanner(&stream2, expectations2, 20, 37); + TestStreamScanner(stream2.get(), expectations2, 20, 37); const char* str3 = "{}}}}"; i::Token::Value expectations3[] = { @@ -800,17 +614,17 @@ TEST(StreamScanner) { for (int i = 0; i <= 4; i++) { expectations3[6 - i] = i::Token::ILLEGAL; expectations3[5 - i] = i::Token::EOS; - i::ExternalOneByteStringUtf16CharacterStream stream3(str3); - TestStreamScanner(&stream3, expectations3, 1, 1 + i); + std::unique_ptr<i::Utf16CharacterStream> stream3( + i::ScannerStream::ForTesting(str3)); + TestStreamScanner(stream3.get(), expectations3, 1, 1 + i); } } - void TestScanRegExp(const char* re_source, const char* expected) { - i::ExternalOneByteStringUtf16CharacterStream stream(re_source); + auto stream = i::ScannerStream::ForTesting(re_source); i::HandleScope scope(CcTest::i_isolate()); i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); i::Token::Value start = scanner.peek(); CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV); @@ -819,9 +633,10 @@ void TestScanRegExp(const char* re_source, const char* expected) { i::Zone zone(CcTest::i_isolate()->allocator()); i::AstValueFactory ast_value_factory(&zone, CcTest::i_isolate()->heap()->HashSeed()); + const i::AstRawString* current_symbol = + scanner.CurrentSymbol(&ast_value_factory); ast_value_factory.Internalize(CcTest::i_isolate()); - i::Handle<i::String> val = - scanner.CurrentSymbol(&ast_value_factory)->string(); + i::Handle<i::String> val = current_symbol->string(); i::DisallowHeapAllocation no_alloc; i::String::FlatContent content = val->GetFlatContent(); CHECK(content.IsOneByte()); @@ -869,74 +684,26 @@ TEST(RegExpScanning) { TestScanRegExp("/=?/", "=?"); } +static int Ucs2CharLength(unibrow::uchar c) { + if (c == unibrow::Utf8::kIncomplete || c == unibrow::Utf8::kBufferEmpty) { + return 0; + } else if (c < 0xffff) { + return 1; + } else { + return 2; + } +} static int Utf8LengthHelper(const char* s) { - int len = i::StrLength(s); - int character_length = len; - for (int i = 0; i < len; i++) { - unsigned char c = s[i]; - int input_offset = 0; - int output_adjust = 0; - if (c > 0x7f) { - if (c < 0xc0) continue; - if (c >= 0xf0) { - if (c >= 0xf8) { - // 5 and 6 byte UTF-8 sequences turn into a kBadChar for each UTF-8 - // byte. - continue; // Handle first UTF-8 byte. - } - if ((c & 7) == 0 && ((s[i + 1] & 0x30) == 0)) { - // This 4 byte sequence could have been coded as a 3 byte sequence. - // Record a single kBadChar for the first byte and continue. - continue; - } - input_offset = 3; - // 4 bytes of UTF-8 turn into 2 UTF-16 code units. - character_length -= 2; - } else if (c >= 0xe0) { - if ((c & 0xf) == 0 && ((s[i + 1] & 0x20) == 0)) { - // This 3 byte sequence could have been coded as a 2 byte sequence. - // Record a single kBadChar for the first byte and continue. - continue; - } - if (c == 0xed) { - unsigned char d = s[i + 1]; - if ((d < 0x80) || (d > 0x9f)) { - // This 3 byte sequence is part of a surrogate pair which is not - // supported by UTF-8. Record a single kBadChar for the first byte - // and continue. - continue; - } - } - input_offset = 2; - // 3 bytes of UTF-8 turn into 1 UTF-16 code unit. - output_adjust = 2; - } else { - if ((c & 0x1e) == 0) { - // This 2 byte sequence could have been coded as a 1 byte sequence. - // Record a single kBadChar for the first byte and continue. - continue; - } - input_offset = 1; - // 2 bytes of UTF-8 turn into 1 UTF-16 code unit. - output_adjust = 1; - } - bool bad = false; - for (int j = 1; j <= input_offset; j++) { - if ((s[i + j] & 0xc0) != 0x80) { - // Bad UTF-8 sequence turns the first in the sequence into kBadChar, - // which is a single UTF-16 code unit. - bad = true; - break; - } - } - if (!bad) { - i += input_offset; - character_length -= output_adjust; - } - } + unibrow::Utf8::Utf8IncrementalBuffer buffer(unibrow::Utf8::kBufferEmpty); + int length = 0; + for (; *s != '\0'; s++) { + unibrow::uchar tmp = unibrow::Utf8::ValueOfIncremental(*s, &buffer); + length += Ucs2CharLength(tmp); } - return character_length; + unibrow::uchar tmp = unibrow::Utf8::ValueOfIncrementalFinish(&buffer); + length += Ucs2CharLength(tmp); + return length; } @@ -1046,7 +813,7 @@ TEST(ScopeUsesArgumentsSuperThis) { info.set_global(); CHECK(parser.Parse(&info)); CHECK(i::Rewriter::Rewrite(&info)); - i::Scope::Analyze(&info); + i::DeclarationScope::Analyze(&info, i::AnalyzeMode::kRegular); CHECK(info.literal() != NULL); i::DeclarationScope* script_scope = info.literal()->scope(); @@ -1166,169 +933,206 @@ TEST(ScopePositions) { }; const SourceData source_data[] = { - { " with ({}) ", "{ block; }", " more;", i::WITH_SCOPE, i::SLOPPY }, - { " with ({}) ", "{ block; }", "; more;", i::WITH_SCOPE, i::SLOPPY }, - { " with ({}) ", "{\n" - " block;\n" - " }", "\n" - " more;", i::WITH_SCOPE, i::SLOPPY }, - { " with ({}) ", "statement;", " more;", i::WITH_SCOPE, i::SLOPPY }, - { " with ({}) ", "statement", "\n" - " more;", i::WITH_SCOPE, i::SLOPPY }, - { " with ({})\n" - " ", "statement;", "\n" - " more;", i::WITH_SCOPE, i::SLOPPY }, - { " try {} catch ", "(e) { block; }", " more;", - i::CATCH_SCOPE, i::SLOPPY }, - { " try {} catch ", "(e) { block; }", "; more;", - i::CATCH_SCOPE, i::SLOPPY }, - { " try {} catch ", "(e) {\n" - " block;\n" - " }", "\n" - " more;", i::CATCH_SCOPE, i::SLOPPY }, - { " try {} catch ", "(e) { block; }", " finally { block; } more;", - i::CATCH_SCOPE, i::SLOPPY }, - { " start;\n" - " ", "{ let block; }", " more;", i::BLOCK_SCOPE, i::STRICT }, - { " start;\n" - " ", "{ let block; }", "; more;", i::BLOCK_SCOPE, i::STRICT }, - { " start;\n" - " ", "{\n" - " let block;\n" - " }", "\n" - " more;", i::BLOCK_SCOPE, i::STRICT }, - { " start;\n" - " function fun", "(a,b) { infunction; }", " more;", - i::FUNCTION_SCOPE, i::SLOPPY }, - { " start;\n" - " function fun", "(a,b) {\n" - " infunction;\n" - " }", "\n" - " more;", i::FUNCTION_SCOPE, i::SLOPPY }, - { " start;\n", "(a,b) => a + b", "; more;", - i::FUNCTION_SCOPE, i::SLOPPY }, - { " start;\n", "(a,b) => { return a+b; }", "\nmore;", - i::FUNCTION_SCOPE, i::SLOPPY }, - { " start;\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - { " for ", "(let x = 1 ; x < 10; ++ x) { block; }", " more;", - i::BLOCK_SCOPE, i::STRICT }, - { " for ", "(let x = 1 ; x < 10; ++ x) { block; }", "; more;", - i::BLOCK_SCOPE, i::STRICT }, - { " for ", "(let x = 1 ; x < 10; ++ x) {\n" - " block;\n" - " }", "\n" - " more;", i::BLOCK_SCOPE, i::STRICT }, - { " for ", "(let x = 1 ; x < 10; ++ x) statement;", " more;", - i::BLOCK_SCOPE, i::STRICT }, - { " for ", "(let x = 1 ; x < 10; ++ x) statement", "\n" - " more;", i::BLOCK_SCOPE, i::STRICT }, - { " for ", "(let x = 1 ; x < 10; ++ x)\n" - " statement;", "\n" - " more;", i::BLOCK_SCOPE, i::STRICT }, - { " for ", "(let x in {}) { block; }", " more;", - i::BLOCK_SCOPE, i::STRICT }, - { " for ", "(let x in {}) { block; }", "; more;", - i::BLOCK_SCOPE, i::STRICT }, - { " for ", "(let x in {}) {\n" - " block;\n" - " }", "\n" - " more;", i::BLOCK_SCOPE, i::STRICT }, - { " for ", "(let x in {}) statement;", " more;", - i::BLOCK_SCOPE, i::STRICT }, - { " for ", "(let x in {}) statement", "\n" - " more;", i::BLOCK_SCOPE, i::STRICT }, - { " for ", "(let x in {})\n" - " statement;", "\n" - " more;", i::BLOCK_SCOPE, i::STRICT }, - // Check that 6-byte and 4-byte encodings of UTF-8 strings do not throw - // the preparser off in terms of byte offsets. - // 6 byte encoding. - { " 'foo\355\240\201\355\260\211';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // 4 byte encoding. - { " 'foo\360\220\220\212';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // 3 byte encoding of \u0fff. - { " 'foo\340\277\277';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Broken 6 byte encoding with missing last byte. - { " 'foo\355\240\201\355\211';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Broken 3 byte encoding of \u0fff with missing last byte. - { " 'foo\340\277';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Broken 3 byte encoding of \u0fff with missing 2 last bytes. - { " 'foo\340';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Broken 3 byte encoding of \u00ff should be a 2 byte encoding. - { " 'foo\340\203\277';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Broken 3 byte encoding of \u007f should be a 2 byte encoding. - { " 'foo\340\201\277';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Unpaired lead surrogate. - { " 'foo\355\240\201';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Unpaired lead surrogate where following code point is a 3 byte sequence. - { " 'foo\355\240\201\340\277\277';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Unpaired lead surrogate where following code point is a 4 byte encoding - // of a trail surrogate. - { " 'foo\355\240\201\360\215\260\211';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Unpaired trail surrogate. - { " 'foo\355\260\211';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // 2 byte encoding of \u00ff. - { " 'foo\303\277';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Broken 2 byte encoding of \u00ff with missing last byte. - { " 'foo\303';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Broken 2 byte encoding of \u007f should be a 1 byte encoding. - { " 'foo\301\277';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Illegal 5 byte encoding. - { " 'foo\370\277\277\277\277';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Illegal 6 byte encoding. - { " 'foo\374\277\277\277\277\277';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Illegal 0xfe byte - { " 'foo\376\277\277\277\277\277\277';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - // Illegal 0xff byte - { " 'foo\377\277\277\277\277\277\277\277';\n" - " (function fun", "(a,b) { infunction; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - { " 'foo';\n" - " (function fun", "(a,b) { 'bar\355\240\201\355\260\213'; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - { " 'foo';\n" - " (function fun", "(a,b) { 'bar\360\220\220\214'; }", ")();", - i::FUNCTION_SCOPE, i::SLOPPY }, - { NULL, NULL, NULL, i::EVAL_SCOPE, i::SLOPPY } - }; + {" with ({}) ", "{ block; }", " more;", i::WITH_SCOPE, i::SLOPPY}, + {" with ({}) ", "{ block; }", "; more;", i::WITH_SCOPE, i::SLOPPY}, + {" with ({}) ", + "{\n" + " block;\n" + " }", + "\n" + " more;", + i::WITH_SCOPE, i::SLOPPY}, + {" with ({}) ", "statement;", " more;", i::WITH_SCOPE, i::SLOPPY}, + {" with ({}) ", "statement", + "\n" + " more;", + i::WITH_SCOPE, i::SLOPPY}, + {" with ({})\n" + " ", + "statement;", + "\n" + " more;", + i::WITH_SCOPE, i::SLOPPY}, + {" try {} catch ", "(e) { block; }", " more;", i::CATCH_SCOPE, + i::SLOPPY}, + {" try {} catch ", "(e) { block; }", "; more;", i::CATCH_SCOPE, + i::SLOPPY}, + {" try {} catch ", + "(e) {\n" + " block;\n" + " }", + "\n" + " more;", + i::CATCH_SCOPE, i::SLOPPY}, + {" try {} catch ", "(e) { block; }", " finally { block; } more;", + i::CATCH_SCOPE, i::SLOPPY}, + {" start;\n" + " ", + "{ let block; }", " more;", i::BLOCK_SCOPE, i::STRICT}, + {" start;\n" + " ", + "{ let block; }", "; more;", i::BLOCK_SCOPE, i::STRICT}, + {" start;\n" + " ", + "{\n" + " let block;\n" + " }", + "\n" + " more;", + i::BLOCK_SCOPE, i::STRICT}, + {" start;\n" + " function fun", + "(a,b) { infunction; }", " more;", i::FUNCTION_SCOPE, i::SLOPPY}, + {" start;\n" + " function fun", + "(a,b) {\n" + " infunction;\n" + " }", + "\n" + " more;", + i::FUNCTION_SCOPE, i::SLOPPY}, + {" start;\n", "(a,b) => a + b", "; more;", i::FUNCTION_SCOPE, i::SLOPPY}, + {" start;\n", "(a,b) => { return a+b; }", "\nmore;", i::FUNCTION_SCOPE, + i::SLOPPY}, + {" start;\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + {" for ", "(let x = 1 ; x < 10; ++ x) { block; }", " more;", + i::BLOCK_SCOPE, i::STRICT}, + {" for ", "(let x = 1 ; x < 10; ++ x) { block; }", "; more;", + i::BLOCK_SCOPE, i::STRICT}, + {" for ", + "(let x = 1 ; x < 10; ++ x) {\n" + " block;\n" + " }", + "\n" + " more;", + i::BLOCK_SCOPE, i::STRICT}, + {" for ", "(let x = 1 ; x < 10; ++ x) statement;", " more;", + i::BLOCK_SCOPE, i::STRICT}, + {" for ", "(let x = 1 ; x < 10; ++ x) statement", + "\n" + " more;", + i::BLOCK_SCOPE, i::STRICT}, + {" for ", + "(let x = 1 ; x < 10; ++ x)\n" + " statement;", + "\n" + " more;", + i::BLOCK_SCOPE, i::STRICT}, + {" for ", "(let x in {}) { block; }", " more;", i::BLOCK_SCOPE, + i::STRICT}, + {" for ", "(let x in {}) { block; }", "; more;", i::BLOCK_SCOPE, + i::STRICT}, + {" for ", + "(let x in {}) {\n" + " block;\n" + " }", + "\n" + " more;", + i::BLOCK_SCOPE, i::STRICT}, + {" for ", "(let x in {}) statement;", " more;", i::BLOCK_SCOPE, + i::STRICT}, + {" for ", "(let x in {}) statement", + "\n" + " more;", + i::BLOCK_SCOPE, i::STRICT}, + {" for ", + "(let x in {})\n" + " statement;", + "\n" + " more;", + i::BLOCK_SCOPE, i::STRICT}, + // Check that 6-byte and 4-byte encodings of UTF-8 strings do not throw + // the preparser off in terms of byte offsets. + // 2 surrogates, encode a character that doesn't need a surrogate. + {" 'foo\355\240\201\355\260\211';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // 4 byte encoding. + {" 'foo\360\220\220\212';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // 3 byte encoding of \u0fff. + {" 'foo\340\277\277';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // 3 byte surrogate, followed by broken 2-byte surrogate w/ impossible 2nd + // byte and last byte missing. + {" 'foo\355\240\201\355\211';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Broken 3 byte encoding of \u0fff with missing last byte. + {" 'foo\340\277';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Broken 3 byte encoding of \u0fff with missing 2 last bytes. + {" 'foo\340';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Broken 3 byte encoding of \u00ff should be a 2 byte encoding. + {" 'foo\340\203\277';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Broken 3 byte encoding of \u007f should be a 2 byte encoding. + {" 'foo\340\201\277';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Unpaired lead surrogate. + {" 'foo\355\240\201';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Unpaired lead surrogate where following code point is a 3 byte + // sequence. + {" 'foo\355\240\201\340\277\277';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Unpaired lead surrogate where following code point is a 4 byte encoding + // of a trail surrogate. + {" 'foo\355\240\201\360\215\260\211';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Unpaired trail surrogate. + {" 'foo\355\260\211';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // 2 byte encoding of \u00ff. + {" 'foo\303\277';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Broken 2 byte encoding of \u00ff with missing last byte. + {" 'foo\303';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Broken 2 byte encoding of \u007f should be a 1 byte encoding. + {" 'foo\301\277';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Illegal 5 byte encoding. + {" 'foo\370\277\277\277\277';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Illegal 6 byte encoding. + {" 'foo\374\277\277\277\277\277';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Illegal 0xfe byte + {" 'foo\376\277\277\277\277\277\277';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + // Illegal 0xff byte + {" 'foo\377\277\277\277\277\277\277\277';\n" + " (function fun", + "(a,b) { infunction; }", ")();", i::FUNCTION_SCOPE, i::SLOPPY}, + {" 'foo';\n" + " (function fun", + "(a,b) { 'bar\355\240\201\355\260\213'; }", ")();", i::FUNCTION_SCOPE, + i::SLOPPY}, + {" 'foo';\n" + " (function fun", + "(a,b) { 'bar\360\220\220\214'; }", ")();", i::FUNCTION_SCOPE, + i::SLOPPY}, + {NULL, NULL, NULL, i::EVAL_SCOPE, i::SLOPPY}}; i::Isolate* isolate = CcTest::i_isolate(); i::Factory* factory = isolate->factory(); @@ -1490,6 +1294,7 @@ enum ParserFlag { kAllowHarmonyAsyncAwait, kAllowHarmonyRestrictiveGenerators, kAllowHarmonyTrailingCommas, + kAllowHarmonyClassFields, }; enum ParserSyncTestResult { @@ -1514,6 +1319,8 @@ void SetParserFlags(i::ParserBase<Traits>* parser, flags.Contains(kAllowHarmonyRestrictiveGenerators)); parser->set_allow_harmony_trailing_commas( flags.Contains(kAllowHarmonyTrailingCommas)); + parser->set_allow_harmony_class_fields( + flags.Contains(kAllowHarmonyClassFields)); } @@ -1533,14 +1340,15 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, i::CompleteParserRecorder log; if (test_preparser) { i::Scanner scanner(isolate->unicode_cache()); - i::GenericStringUtf16CharacterStream stream(source, 0, source->length()); + std::unique_ptr<i::Utf16CharacterStream> stream( + i::ScannerStream::For(source)); i::Zone zone(CcTest::i_isolate()->allocator()); i::AstValueFactory ast_value_factory( &zone, CcTest::i_isolate()->heap()->HashSeed()); i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, stack_limit); SetParserFlags(&preparser, flags); - scanner.Initialize(&stream); + scanner.Initialize(stream.get()); i::PreParser::PreParseResult result = preparser.PreParseProgram(&preparser_materialized_literals, is_module); CHECK_EQ(i::PreParser::kPreParseSuccess, result); @@ -2896,6 +2704,7 @@ TEST(StrictObjectLiteralChecking) { TEST(ErrorsObjectLiteralChecking) { + // clang-format off const char* context_data[][2] = { {"\"use strict\"; var myobject = {", "};"}, {"var myobject = {", "};"}, @@ -2912,14 +2721,60 @@ TEST(ErrorsObjectLiteralChecking) { // Parsing FunctionLiteral for getter or setter fails "get foo( +", "get foo() \"error\"", + // Various forbidden forms + "static x: 0", + "static x(){}", + "static async x(){}", + "static get x(){}", + "static get x : 0", + "static x", + "static 0", + "*x: 0", + "*x", + "*get x(){}", + "*set x(y){}", + "get *x(){}", + "set *x(y){}", + "get x*(){}", + "set x*(y){}", + "x = 0", + "* *x(){}", + "x*(){}", + // This should fail without --harmony-async-await + "async x(){}", NULL }; + // clang-format on RunParserSyncTest(context_data, statement_data, kError); + + // clang-format off + const char* async_data[] = { + "static async x(){}", + "static async x : 0", + "static async get x : 0", + "async static x(){}", + "*async x(){}", + "async *x(){}", + "async x*(){}", + "async x : 0", + "async 0 : 0", + "async get x(){}", + "async get *x(){}", + "async set x(y){}", + "async get : 0", + NULL + }; + // clang-format on + + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; + RunParserSyncTest(context_data, async_data, kError, NULL, 0, always_flags, + arraysize(always_flags)); } TEST(NoErrorsObjectLiteralChecking) { + // clang-format off const char* context_data[][2] = { {"var myobject = {", "};"}, {"var myobject = {", ",};"}, @@ -2968,6 +2823,19 @@ TEST(NoErrorsObjectLiteralChecking) { "1: 1, set 2(v) {}", "get: 1, get foo() {}", "set: 1, set foo(_) {}", + // Potentially confusing cases + "get(){}", + "set(){}", + "static(){}", + "async(){}", + "*get() {}", + "*set() {}", + "*static() {}", + "*async(){}", + "get : 0", + "set : 0", + "static : 0", + "async : 0", // Keywords, future reserved and strict future reserved are also allowed as // property names. "if: 4", @@ -2977,8 +2845,28 @@ TEST(NoErrorsObjectLiteralChecking) { "arguments: 8", NULL }; + // clang-format on RunParserSyncTest(context_data, statement_data, kSuccess); + + // clang-format off + const char* async_data[] = { + "async x(){}", + "async 0(){}", + "async get(){}", + "async set(){}", + "async static(){}", + "async async(){}", + "async : 0", + "async(){}", + "*async(){}", + NULL + }; + // clang-format on + + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; + RunParserSyncTest(context_data, async_data, kSuccess, NULL, 0, always_flags, + arraysize(always_flags)); } @@ -3317,14 +3205,15 @@ TEST(SerializationOfMaybeAssignmentFlag) { i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); i::Context* context = f->context(); i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); - avf.Internalize(isolate); const i::AstRawString* name = avf.GetOneByteString("result"); + avf.Internalize(isolate); i::Handle<i::String> str = name->string(); CHECK(str->IsInternalizedString()); - i::DeclarationScope* script_scope = new (&zone) i::DeclarationScope(&zone); + i::DeclarationScope* script_scope = + new (&zone) i::DeclarationScope(&zone, &avf); i::Scope* s = i::Scope::DeserializeScopeChain( - isolate, &zone, context, script_scope, &avf, - i::Scope::DeserializationMode::kKeepScopeInfo); + isolate, &zone, context->scope_info(), script_scope, &avf, + i::Scope::DeserializationMode::kIncludingVariables); CHECK(s != script_scope); CHECK(name != NULL); @@ -3366,14 +3255,15 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) { i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); i::Context* context = f->context(); i::AstValueFactory avf(&zone, isolate->heap()->HashSeed()); + const i::AstRawString* name_x = avf.GetOneByteString("x"); avf.Internalize(isolate); - i::DeclarationScope* script_scope = new (&zone) i::DeclarationScope(&zone); + i::DeclarationScope* script_scope = + new (&zone) i::DeclarationScope(&zone, &avf); i::Scope* s = i::Scope::DeserializeScopeChain( - isolate, &zone, context, script_scope, &avf, - i::Scope::DeserializationMode::kKeepScopeInfo); + isolate, &zone, context->scope_info(), script_scope, &avf, + i::Scope::DeserializationMode::kIncludingVariables); CHECK(s != script_scope); - const i::AstRawString* name_x = avf.GetOneByteString("x"); // Get result from f's function context (that is g's outer context) i::Variable* var_x = s->Lookup(name_x); @@ -3470,7 +3360,7 @@ TEST(InnerAssignment) { { "(function(x) { eval(''); })", true, false }, }; - // Used to trigger lazy compilation of function + // Used to trigger lazy parsing of the outer function. int comment_len = 2048; i::ScopedVector<char> comment(comment_len + 1); i::SNPrintF(comment, "/*%0*d*/", comment_len - 4, 0); @@ -3481,46 +3371,48 @@ TEST(InnerAssignment) { const char* outer = outers[i].source; int outer_len = Utf8LengthHelper(outer); for (unsigned j = 0; j < arraysize(inners); ++j) { - for (unsigned outer_lazy = 0; outer_lazy < 2; ++outer_lazy) { - for (unsigned inner_lazy = 0; inner_lazy < 2; ++inner_lazy) { - if (outers[i].strict && inners[j].with) continue; - const char* inner = inners[j].source; - int inner_len = Utf8LengthHelper(inner); - - int outer_comment_len = outer_lazy ? comment_len : 0; - int inner_comment_len = inner_lazy ? comment_len : 0; - const char* outer_comment = outer_lazy ? comment.start() : ""; - const char* inner_comment = inner_lazy ? comment.start() : ""; - int len = prefix_len + outer_comment_len + outer_len + midfix_len + - inner_comment_len + inner_len + suffix_len; - i::ScopedVector<char> program(len + 1); - - i::SNPrintF(program, "%s%s%s%s%s%s%s", prefix, outer_comment, outer, - midfix, inner_comment, inner, suffix); - i::Handle<i::String> source = - factory->InternalizeUtf8String(program.start()); - source->PrintOn(stdout); - printf("\n"); - - i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator()); - i::ParseInfo info(&zone, script); - i::Parser parser(&info); - CHECK(parser.Parse(&info)); - CHECK(i::Compiler::Analyze(&info)); - CHECK(info.literal() != NULL); - - i::Scope* scope = info.literal()->scope(); - i::Scope* inner_scope = scope->inner_scope(); - DCHECK_NOT_NULL(inner_scope); - DCHECK_NULL(inner_scope->sibling()); - const i::AstRawString* var_name = - info.ast_value_factory()->GetOneByteString("x"); - i::Variable* var = inner_scope->Lookup(var_name); - bool expected = outers[i].assigned || inners[j].assigned; - CHECK(var != NULL); - CHECK(var->is_used() || !expected); - CHECK((var->maybe_assigned() == i::kMaybeAssigned) == expected); + for (unsigned lazy = 0; lazy < 2; ++lazy) { + if (outers[i].strict && inners[j].with) continue; + const char* inner = inners[j].source; + int inner_len = Utf8LengthHelper(inner); + + const char* comment_chars = lazy ? comment.start() : ""; + int len = prefix_len + (lazy ? comment_len : 0) + outer_len + + midfix_len + inner_len + suffix_len; + i::ScopedVector<char> program(len + 1); + + i::SNPrintF(program, "%s%s%s%s%s%s", comment_chars, prefix, outer, + midfix, inner, suffix); + i::Handle<i::String> source = + factory->InternalizeUtf8String(program.start()); + source->PrintOn(stdout); + printf("\n"); + + i::Handle<i::Script> script = factory->NewScript(source); + i::Zone zone(CcTest::i_isolate()->allocator()); + i::ParseInfo info(&zone, script); + i::Parser parser(&info); + CHECK(parser.Parse(&info)); + CHECK(i::Compiler::Analyze(&info)); + CHECK(info.literal() != NULL); + + i::Scope* scope = info.literal()->scope(); + i::Scope* inner_scope = scope->inner_scope(); + DCHECK_NOT_NULL(inner_scope); + DCHECK_NULL(inner_scope->sibling()); + const i::AstRawString* var_name = + info.ast_value_factory()->GetOneByteString("x"); + i::Variable* var = inner_scope->Lookup(var_name); + bool expected = outers[i].assigned || inners[j].assigned; + CHECK(var != NULL); + CHECK(var->is_used() || !expected); + bool is_maybe_assigned = var->maybe_assigned() == i::kMaybeAssigned; + if (i::FLAG_lazy_inner_functions) { + // If we parse inner functions lazily, allow being pessimistic about + // maybe_assigned. + CHECK(is_maybe_assigned || (is_maybe_assigned == expected)); + } else { + CHECK(is_maybe_assigned == expected); } } } @@ -4392,6 +4284,10 @@ TEST(ClassBodyNoErrors) { "*get() {}", "*set() {}", "static *g() {}", + "async(){}", + "*async(){}", + "static async(){}", + "static *async(){}", // Escaped 'static' should be allowed anywhere // static-as-PropertyName is. @@ -4407,6 +4303,27 @@ TEST(ClassBodyNoErrors) { // clang-format on RunParserSyncTest(context_data, class_body_data, kSuccess); + + // clang-format off + const char* async_data[] = { + "static async x(){}", + "static async(){}", + "static *async(){}", + "async x(){}", + "async 0(){}", + "async get(){}", + "async set(){}", + "async static(){}", + "async async(){}", + "async(){}", + "*async(){}", + NULL + }; + // clang-format on + + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; + RunParserSyncTest(context_data, async_data, kSuccess, NULL, 0, always_flags, + arraysize(always_flags)); } @@ -4462,6 +4379,160 @@ TEST(ClassPropertyNameNoErrors) { RunParserSyncTest(context_data, name_data, kSuccess); } +TEST(ClassFieldsNoErrors) { + // clang-format off + // Tests proposed class fields syntax. + const char* context_data[][2] = {{"(class {", "});"}, + {"(class extends Base {", "});"}, + {"class C {", "}"}, + {"class C extends Base {", "}"}, + {NULL, NULL}}; + const char* class_body_data[] = { + // Basic syntax + "a = 0;", + "a = 0; b", + "a = 0; b(){}", + "a = 0; *b(){}", + "a = 0; ['b'](){}", + "a;", + "a; b;", + "a; b(){}", + "a; *b(){}", + "a; ['b'](){}", + "['a'] = 0;", + "['a'] = 0; b", + "['a'] = 0; b(){}", + "['a'] = 0; *b(){}", + "['a'] = 0; ['b'](){}", + "['a'];", + "['a']; b;", + "['a']; b(){}", + "['a']; *b(){}", + "['a']; ['b'](){}", + + "0 = 0;", + "0;", + "'a' = 0;", + "'a';", + + "static a = 0;", + "static a;", + "static ['a'] = 0", + "static ['a']", + "static 0 = 0;", + "static 0;", + "static 'a' = 0;", + "static 'a';", + + // ASI + "a = 0\n", + "a = 0\n b", + "a = 0\n b(){}", + "a\n", + "a\n b\n", + "a\n b(){}", + "a\n *b(){}", + "a\n ['b'](){}", + "['a'] = 0\n", + "['a'] = 0\n b", + "['a'] = 0\n b(){}", + "['a']\n", + "['a']\n b\n", + "['a']\n b(){}", + "['a']\n *b(){}", + "['a']\n ['b'](){}", + + // ASI edge cases + "a\n get", + "get\n *a(){}", + "a\n static", + + // Misc edge cases + "yield", + "yield = 0", + "yield\n a", + NULL + }; + // clang-format on + + static const ParserFlag without_async[] = {kAllowHarmonyClassFields}; + RunParserSyncTest(context_data, class_body_data, kSuccess, NULL, 0, + without_async, arraysize(without_async)); + + // clang-format off + const char* async_data[] = { + "async;", + "async = 0;", + "static async;" + "async", + "async = 0", + "static async", + "async\n a(){}", // a field named async, and a method named a. + "async\n a", + "await;", + "await = 0;", + "await\n a", + NULL + }; + // clang-format on + + static const ParserFlag with_async[] = {kAllowHarmonyClassFields, + kAllowHarmonyAsyncAwait}; + RunParserSyncTest(context_data, async_data, kSuccess, NULL, 0, with_async, + arraysize(with_async)); +} + +TEST(ClassFieldsErrors) { + // clang-format off + // Tests proposed class fields syntax. + const char* context_data[][2] = {{"(class {", "});"}, + {"(class extends Base {", "});"}, + {"class C {", "}"}, + {"class C extends Base {", "}"}, + {NULL, NULL}}; + const char* class_body_data[] = { + "a : 0", + "a =", + "*a = 0", + "*a", + "get a", + "yield a", + "a : 0;", + "a =;", + "*a = 0;", + "*a;", + "get a;", + "yield a;", + + // ASI requires a linebreak + "a b", + "a = 0 b", + + // ASI requires that the next token is not part of any legal production + "a = 0\n *b(){}", + "a = 0\n ['b'](){}", + "get\n a", + NULL + }; + // clang-format on + + static const ParserFlag without_async[] = {kAllowHarmonyClassFields}; + RunParserSyncTest(context_data, class_body_data, kError, NULL, 0, + without_async, arraysize(without_async)); + + // clang-format off + const char* async_data[] = { + "async a = 0", + "async a", + NULL + }; + // clang-format on + + static const ParserFlag with_async[] = {kAllowHarmonyClassFields, + kAllowHarmonyAsyncAwait}; + RunParserSyncTest(context_data, async_data, kError, NULL, 0, with_async, + arraysize(with_async)); +} TEST(ClassExpressionErrors) { const char* context_data[][2] = {{"(", ");"}, @@ -4520,6 +4591,43 @@ TEST(ClassDeclarationErrors) { RunParserSyncTest(context_data, class_data, kError); } +TEST(ClassAsyncErrors) { + // clang-format off + const char* context_data[][2] = {{"(class {", "});"}, + {"(class extends Base {", "});"}, + {"class C {", "}"}, + {"class C extends Base {", "}"}, + {NULL, NULL}}; + const char* async_data[] = { + "*async x(){}", + "async *(){}", + "async *x(){}", + "async get x(){}", + "async set x(y){}", + "async x : 0", + "async : 0", + + "async static x(){}", + + "static *async x(){}", + "static async *(){}", + "static async *x(){}", + "static async get x(){}", + "static async set x(y){}", + "static async x : 0", + "static async : 0", + NULL + }; + // clang-format on + + // All of these are illegal whether or not async functions are permitted, + // although for different reasons. + RunParserSyncTest(context_data, async_data, kError); + + static const ParserFlag always_flags[] = {kAllowHarmonyAsyncAwait}; + RunParserSyncTest(context_data, async_data, kError, NULL, 0, always_flags, + arraysize(always_flags)); +} TEST(ClassNameErrors) { const char* context_data[][2] = {{"class ", "{}"}, @@ -5845,30 +5953,26 @@ TEST(EnumReserved) { RunModuleParserSyncTest(context_data, kErrorSources, kError); } -static void CheckModuleEntry(const i::ModuleDescriptor::ModuleEntry* entry, - const char* export_name, const char* local_name, const char* import_name, - const char* module_request) { +static void CheckEntry(const i::ModuleDescriptor::Entry* entry, + const char* export_name, const char* local_name, + const char* import_name, int module_request) { CHECK_NOT_NULL(entry); if (export_name == nullptr) { CHECK_NULL(entry->export_name); } else { - entry->export_name->IsOneByteEqualTo(export_name); + CHECK(entry->export_name->IsOneByteEqualTo(export_name)); } if (local_name == nullptr) { CHECK_NULL(entry->local_name); } else { - entry->local_name->IsOneByteEqualTo(local_name); + CHECK(entry->local_name->IsOneByteEqualTo(local_name)); } if (import_name == nullptr) { CHECK_NULL(entry->import_name); } else { - entry->import_name->IsOneByteEqualTo(import_name); - } - if (module_request == nullptr) { - CHECK_NULL(entry->module_request); - } else { - entry->module_request->IsOneByteEqualTo(module_request); + CHECK(entry->import_name->IsOneByteEqualTo(import_name)); } + CHECK_EQ(entry->module_request, module_request); } TEST(ModuleParsingInternals) { @@ -5914,6 +6018,7 @@ TEST(ModuleParsingInternals) { CHECK(outer_scope->is_script_scope()); CHECK_NULL(outer_scope->outer_scope()); CHECK(module_scope->is_module_scope()); + const i::ModuleDescriptor::Entry* entry; i::ZoneList<i::Declaration*>* declarations = module_scope->declarations(); CHECK_EQ(13, declarations->length()); @@ -5999,52 +6104,86 @@ TEST(ModuleParsingInternals) { i::ModuleDescriptor* descriptor = module_scope->module(); CHECK_NOT_NULL(descriptor); - CHECK_EQ(11, descriptor->exports().length()); - CheckModuleEntry( - descriptor->exports().at(0), "y", "x", nullptr, nullptr); - CheckModuleEntry( - descriptor->exports().at(1), "b", nullptr, "a", "m.js"); - CheckModuleEntry( - descriptor->exports().at(2), nullptr, nullptr, nullptr, "p.js"); - CheckModuleEntry( - descriptor->exports().at(3), "foo", "foo", nullptr, nullptr); - CheckModuleEntry( - descriptor->exports().at(4), "goo", "goo", nullptr, nullptr); - CheckModuleEntry( - descriptor->exports().at(5), "hoo", "hoo", nullptr, nullptr); - CheckModuleEntry( - descriptor->exports().at(6), "joo", "joo", nullptr, nullptr); - CheckModuleEntry( - descriptor->exports().at(7), "default", "*default*", nullptr, nullptr); - CheckModuleEntry( - descriptor->exports().at(8), "bb", nullptr, "aa", "m.js"); // !!! - CheckModuleEntry( - descriptor->exports().at(9), "x", "x", nullptr, nullptr); - CheckModuleEntry( - descriptor->exports().at(10), "foob", "foob", nullptr, nullptr); - - CHECK_EQ(3, descriptor->special_imports().length()); - CheckModuleEntry( - descriptor->special_imports().at(0), nullptr, nullptr, nullptr, "q.js"); - CheckModuleEntry( - descriptor->special_imports().at(1), nullptr, "loo", nullptr, "bar.js"); - CheckModuleEntry( - descriptor->special_imports().at(2), nullptr, "foob", nullptr, "bar.js"); + CHECK_EQ(5, descriptor->module_requests().size()); + for (const auto& elem : descriptor->module_requests()) { + if (elem.first->IsOneByteEqualTo("m.js")) + CHECK_EQ(elem.second, 0); + else if (elem.first->IsOneByteEqualTo("n.js")) + CHECK_EQ(elem.second, 1); + else if (elem.first->IsOneByteEqualTo("p.js")) + CHECK_EQ(elem.second, 2); + else if (elem.first->IsOneByteEqualTo("q.js")) + CHECK_EQ(elem.second, 3); + else if (elem.first->IsOneByteEqualTo("bar.js")) + CHECK_EQ(elem.second, 4); + else + CHECK(false); + } + + CHECK_EQ(3, descriptor->special_exports().length()); + CheckEntry(descriptor->special_exports().at(0), "b", nullptr, "a", 0); + CheckEntry(descriptor->special_exports().at(1), nullptr, nullptr, nullptr, 2); + CheckEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa", + 0); // !!! + + CHECK_EQ(8, descriptor->regular_exports().size()); + entry = descriptor->regular_exports() + .find(declarations->at(3)->proxy()->raw_name()) + ->second; + CheckEntry(entry, "foo", "foo", nullptr, -1); + entry = descriptor->regular_exports() + .find(declarations->at(4)->proxy()->raw_name()) + ->second; + CheckEntry(entry, "goo", "goo", nullptr, -1); + entry = descriptor->regular_exports() + .find(declarations->at(5)->proxy()->raw_name()) + ->second; + CheckEntry(entry, "hoo", "hoo", nullptr, -1); + entry = descriptor->regular_exports() + .find(declarations->at(6)->proxy()->raw_name()) + ->second; + CheckEntry(entry, "joo", "joo", nullptr, -1); + entry = descriptor->regular_exports() + .find(declarations->at(7)->proxy()->raw_name()) + ->second; + CheckEntry(entry, "default", "*default*", nullptr, -1); + entry = descriptor->regular_exports() + .find(declarations->at(12)->proxy()->raw_name()) + ->second; + CheckEntry(entry, "foob", "foob", nullptr, -1); + // TODO(neis): The next lines are terrible. Find a better way. + auto name_x = declarations->at(0)->proxy()->raw_name(); + CHECK_EQ(2, descriptor->regular_exports().count(name_x)); + auto it = descriptor->regular_exports().equal_range(name_x).first; + entry = it->second; + if (entry->export_name->IsOneByteEqualTo("y")) { + CheckEntry(entry, "y", "x", nullptr, -1); + entry = (++it)->second; + CheckEntry(entry, "x", "x", nullptr, -1); + } else { + CheckEntry(entry, "x", "x", nullptr, -1); + entry = (++it)->second; + CheckEntry(entry, "y", "x", nullptr, -1); + } + + CHECK_EQ(2, descriptor->namespace_imports().length()); + CheckEntry(descriptor->namespace_imports().at(0), nullptr, "loo", nullptr, 4); + CheckEntry(descriptor->namespace_imports().at(1), nullptr, "foob", nullptr, + 4); CHECK_EQ(4, descriptor->regular_imports().size()); - const i::ModuleDescriptor::ModuleEntry* entry; entry = descriptor->regular_imports().find( declarations->at(1)->proxy()->raw_name())->second; - CheckModuleEntry(entry, nullptr, "z", "q", "m.js"); + CheckEntry(entry, nullptr, "z", "q", 0); entry = descriptor->regular_imports().find( declarations->at(2)->proxy()->raw_name())->second; - CheckModuleEntry(entry, nullptr, "n", "default", "n.js"); + CheckEntry(entry, nullptr, "n", "default", 1); entry = descriptor->regular_imports().find( declarations->at(9)->proxy()->raw_name())->second; - CheckModuleEntry(entry, nullptr, "mm", "m", "m.js"); + CheckEntry(entry, nullptr, "mm", "m", 0); entry = descriptor->regular_imports().find( declarations->at(10)->proxy()->raw_name())->second; - CheckModuleEntry(entry, nullptr, "aa", "aa", "m.js"); + CheckEntry(entry, nullptr, "aa", "aa", 0); } @@ -6277,10 +6416,9 @@ TEST(DestructuringPositiveTests) { RunParserSyncTest(context_data, data, kSuccess); // v8:5201 - // TODO(lpy): The two test sets below should be merged once - // we fix https://bugs.chromium.org/p/v8/issues/detail?id=4577 { - const char* sloppy_context_data1[][2] = { + // clang-format off + const char* sloppy_context_data[][2] = { {"var ", " = {};"}, {"function f(", ") {}"}, {"function f(argument1, ", ") {}"}, @@ -6289,26 +6427,17 @@ TEST(DestructuringPositiveTests) { {"try {} catch(", ") {}"}, {NULL, NULL} }; - const char* data1[] = { + const char* data[] = { + "{arguments}", "{eval}", + "{x: arguments}", "{x: eval}", + "{arguments = false}", "{eval = false}", NULL }; - RunParserSyncTest(sloppy_context_data1, data1, kSuccess); - - const char* sloppy_context_data2[][2] = { - {"var ", " = {};"}, - {"try {} catch(", ") {}"}, - {NULL, NULL} - }; - const char* data2[] = { - "{arguments}", - "{x: arguments}", - "{arguments = false}", - NULL, - }; - RunParserSyncTest(sloppy_context_data2, data2, kSuccess); + // clang-format on + RunParserSyncTest(sloppy_context_data, data, kSuccess); } } @@ -7685,6 +7814,9 @@ TEST(AsyncAwait) { "var asyncFn = async({ foo = 1 }) => foo;", "var asyncFn = async({ foo = 1 } = {}) => foo;", + + "function* g() { var f = async(yield); }", + "function* g() { var f = async(x = yield); }", NULL }; // clang-format on @@ -7790,7 +7922,10 @@ TEST(AsyncAwaitErrors) { "var f = async(x = await 1) => x;", "var O = { async method(x = await 1) { return x; } };", - "var f = async(x = await) => 1;", + "function* g() { var f = async yield => 1; }", + "function* g() { var f = async(yield) => 1; }", + "function* g() { var f = async(x = yield) => 1; }", + "function* g() { var f = async({x = yield}) => 1; }", "class C { async constructor() {} }", "class C {}; class C2 extends C { async constructor() {} }", @@ -7863,6 +7998,7 @@ TEST(AsyncAwaitErrors) { "var f = async(await) => 1;", "var f = async(await = 1) => 1;", "var f = async(...[await]) => 1;", + "var f = async(x = await) => 1;", // v8:5190 "var f = async(1) => 1", @@ -7871,6 +8007,12 @@ TEST(AsyncAwaitErrors) { "var f = async({ foo = async(1) => 1 }) => 1", "var f = async({ foo = async(a) => 1 })", + "var f = async(x = async(await)) => 1;", + "var f = async(x = { [await]: 1 }) => 1;", + "var f = async(x = class extends (await) { }) => 1;", + "var f = async(x = class { static [await]() {} }) => 1;", + "var f = async({ x = await }) => 1;", + NULL }; // clang-format on @@ -8150,3 +8292,38 @@ TEST(TrailingCommasInParametersErrors) { RunParserSyncTest(context_data, data, kError, NULL, 0, always_flags, arraysize(always_flags)); } + +TEST(ArgumentsRedeclaration) { + { + // clang-format off + const char* context_data[][2] = { + { "function f(", ") {}" }, + { NULL, NULL } + }; + const char* success_data[] = { + "{arguments}", + "{arguments = false}", + "arg1, arguments", + "arg1, ...arguments", + NULL + }; + // clang-format on + RunParserSyncTest(context_data, success_data, kSuccess); + } + + { + // clang-format off + const char* context_data[][2] = { + { "function f() {", "}" }, + { NULL, NULL } + }; + const char* data[] = { + "const arguments = 1", + "let arguments", + "var arguments", + NULL + }; + // clang-format on + RunParserSyncTest(context_data, data, kSuccess); + } +} diff --git a/deps/v8/test/cctest/test-profile-generator.cc b/deps/v8/test/cctest/test-profile-generator.cc index 2a133bf1f8..272dec39b4 100644 --- a/deps/v8/test/cctest/test-profile-generator.cc +++ b/deps/v8/test/cctest/test-profile-generator.cc @@ -27,11 +27,11 @@ // // Tests of profiles generator and utilities. -#include "src/v8.h" - #include "include/v8-profiler.h" +#include "src/api.h" #include "src/profiler/cpu-profiler.h" #include "src/profiler/profile-generator-inl.h" +#include "src/v8.h" #include "test/cctest/cctest.h" #include "test/cctest/profiler-extension.h" diff --git a/deps/v8/test/cctest/test-random-number-generator.cc b/deps/v8/test/cctest/test-random-number-generator.cc index 8a855fe5d5..0615f15ab9 100644 --- a/deps/v8/test/cctest/test-random-number-generator.cc +++ b/deps/v8/test/cctest/test-random-number-generator.cc @@ -25,6 +25,8 @@ // (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/flags.h" +#include "src/isolate.h" #include "src/v8.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-representation.cc b/deps/v8/test/cctest/test-representation.cc index fc1f531331..496547f0d7 100644 --- a/deps/v8/test/cctest/test-representation.cc +++ b/deps/v8/test/cctest/test-representation.cc @@ -28,7 +28,6 @@ #include "test/cctest/cctest.h" #include "src/property-details.h" -#include "src/types.h" using namespace v8::internal; diff --git a/deps/v8/test/cctest/test-sampler-api.cc b/deps/v8/test/cctest/test-sampler-api.cc index e2c1c25638..9d17e8bed1 100644 --- a/deps/v8/test/cctest/test-sampler-api.cc +++ b/deps/v8/test/cctest/test-sampler-api.cc @@ -7,6 +7,7 @@ #include <map> #include <string> #include "include/v8.h" +#include "src/flags.h" #include "src/simulator.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc index b2bf51b1c6..37992fa7e7 100644 --- a/deps/v8/test/cctest/test-serialize.cc +++ b/deps/v8/test/cctest/test-serialize.cc @@ -38,7 +38,6 @@ #include "src/heap/spaces.h" #include "src/macro-assembler.h" #include "src/objects.h" -#include "src/parsing/parser.h" #include "src/runtime/runtime.h" #include "src/snapshot/code-serializer.h" #include "src/snapshot/deserializer.h" @@ -91,7 +90,8 @@ static Vector<const byte> Serialize(v8::Isolate* isolate) { } Isolate* internal_isolate = reinterpret_cast<Isolate*>(isolate); - internal_isolate->heap()->CollectAllAvailableGarbage("serialize"); + internal_isolate->heap()->CollectAllAvailableGarbage( + i::GarbageCollectionReason::kTesting); StartupSerializer ser(internal_isolate, v8::SnapshotCreator::FunctionCodeHandling::kClear); ser.SerializeStrongReferences(); @@ -264,8 +264,10 @@ static void PartiallySerializeObject(Vector<const byte>* startup_blob_out, isolate->bootstrapper()->SourceLookup<Natives>(i); } } - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); + heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, + i::GarbageCollectionReason::kTesting); + heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, + i::GarbageCollectionReason::kTesting); Object* raw_foo; { @@ -367,7 +369,8 @@ static void PartiallySerializeContext(Vector<const byte>* startup_blob_out, } // If we don't do this then we end up with a stray root pointing at the // context even after we have disposed of env. - heap->CollectAllGarbage(); + heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, + i::GarbageCollectionReason::kTesting); { v8::HandleScope handle_scope(v8_isolate); @@ -485,7 +488,8 @@ static void PartiallySerializeCustomContext( } // If we don't do this then we end up with a stray root pointing at the // context even after we have disposed of env. - isolate->heap()->CollectAllAvailableGarbage("snapshotting"); + isolate->heap()->CollectAllAvailableGarbage( + i::GarbageCollectionReason::kTesting); { v8::HandleScope handle_scope(v8_isolate); @@ -811,7 +815,7 @@ TEST(SnapshotDataBlobWithWarmup) { // Running the warmup script has effect on whether functions are // pre-compiled, but does not pollute the context. CHECK(IsCompiled("Math.abs")); - CHECK(!IsCompiled("Number.isFinite")); + CHECK(!IsCompiled("Number.parseInt")); CHECK(CompileRun("Math.random")->IsFunction()); } isolate->Dispose(); @@ -821,8 +825,8 @@ TEST(CustomSnapshotDataBlobWithWarmup) { DisableTurbofan(); const char* source = "function f() { return Math.abs(1); }\n" - "function g() { return Number.isFinite(1); }\n" - "Number.isNaN(1);" + "function g() { return Number.parseInt(1); }\n" + "Number.parseFloat(1);" "var a = 5"; const char* warmup = "a = f()"; @@ -846,8 +850,8 @@ TEST(CustomSnapshotDataBlobWithWarmup) { CHECK(IsCompiled("f")); CHECK(IsCompiled("Math.abs")); CHECK(!IsCompiled("g")); - CHECK(!IsCompiled("Number.isFinite")); - CHECK(!IsCompiled("Number.isNaN")); + CHECK(!IsCompiled("Number.parseInt")); + CHECK(!IsCompiled("Number.parseFloat")); CHECK_EQ(5, CompileRun("a")->Int32Value(context).FromJust()); } isolate->Dispose(); @@ -1178,13 +1182,13 @@ TEST(CodeSerializerThreeBigStrings) { Vector<const uint8_t> source_b = ConstructSource(STATIC_CHAR_VECTOR("var b = \""), STATIC_CHAR_VECTOR("b"), - STATIC_CHAR_VECTOR("\";"), 600000); + STATIC_CHAR_VECTOR("\";"), 400000); Handle<String> source_b_str = f->NewStringFromOneByte(source_b).ToHandleChecked(); Vector<const uint8_t> source_c = ConstructSource(STATIC_CHAR_VECTOR("var c = \""), STATIC_CHAR_VECTOR("c"), - STATIC_CHAR_VECTOR("\";"), 500000); + STATIC_CHAR_VECTOR("\";"), 400000); Handle<String> source_c_str = f->NewStringFromOneByte(source_c).ToHandleChecked(); @@ -1217,10 +1221,10 @@ TEST(CodeSerializerThreeBigStrings) { v8::Maybe<int32_t> result = CompileRun("(a + b).length") ->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext()); - CHECK_EQ(600000 + 700000, result.FromJust()); + CHECK_EQ(400000 + 700000, result.FromJust()); result = CompileRun("(b + c).length") ->Int32Value(v8::Isolate::GetCurrent()->GetCurrentContext()); - CHECK_EQ(500000 + 600000, result.FromJust()); + CHECK_EQ(400000 + 400000, result.FromJust()); Heap* heap = isolate->heap(); v8::Local<v8::String> result_str = CompileRun("a") @@ -1895,7 +1899,6 @@ TEST(CodeSerializerEmbeddedObject) { LocalContext context; Isolate* isolate = CcTest::i_isolate(); isolate->compilation_cache()->Disable(); // Disable same-isolate code cache. - Heap* heap = isolate->heap(); v8::HandleScope scope(CcTest::isolate()); size_t actual_size; @@ -1935,7 +1938,7 @@ TEST(CodeSerializerEmbeddedObject) { CHECK(rit2.rinfo()->target_object()->IsHeapNumber()); CHECK_EQ(0.3, HeapNumber::cast(rit2.rinfo()->target_object())->value()); - heap->CollectAllAvailableGarbage(); + CcTest::CollectAllAvailableGarbage(); RelocIterator rit3(copy->code(), RelocInfo::ModeMask(RelocInfo::EMBEDDED_OBJECT)); diff --git a/deps/v8/test/cctest/test-simd.cc b/deps/v8/test/cctest/test-simd.cc index 1f412affba..9f0195de1e 100644 --- a/deps/v8/test/cctest/test-simd.cc +++ b/deps/v8/test/cctest/test-simd.cc @@ -4,8 +4,17 @@ #include "src/v8.h" +#include "src/factory.h" +#include "src/isolate.h" #include "src/objects.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" #include "src/ostreams.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" using namespace v8::internal; diff --git a/deps/v8/test/cctest/test-slots-buffer.cc b/deps/v8/test/cctest/test-slots-buffer.cc deleted file mode 100644 index 4b8aeb7931..0000000000 --- a/deps/v8/test/cctest/test-slots-buffer.cc +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "src/heap/slots-buffer.h" -#include "test/cctest/cctest.h" -#include "test/cctest/heap/heap-utils.h" - -namespace v8 { -namespace internal { - -TEST(SlotsBufferObjectSlotsRemoval) { - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); - Factory* factory = isolate->factory(); - - SlotsBuffer* buffer = new SlotsBuffer(NULL); - void* fake_object[1]; - - Handle<FixedArray> array = factory->NewFixedArray(2, TENURED); - CHECK(heap->old_space()->Contains(*array)); - array->set(0, reinterpret_cast<Object*>(fake_object), SKIP_WRITE_BARRIER); - - // Firstly, let's test the regular slots buffer entry. - buffer->Add(HeapObject::RawField(*array, FixedArray::kHeaderSize)); - CHECK(reinterpret_cast<void*>(buffer->Get(0)) == - HeapObject::RawField(*array, FixedArray::kHeaderSize)); - SlotsBuffer::RemoveObjectSlots(CcTest::i_isolate()->heap(), buffer, - array->address(), - array->address() + array->Size()); - CHECK(reinterpret_cast<void*>(buffer->Get(0)) == - HeapObject::RawField(heap->empty_fixed_array(), - FixedArrayBase::kLengthOffset)); - - // Secondly, let's test the typed slots buffer entry. - SlotsBuffer::AddTo(NULL, &buffer, SlotsBuffer::EMBEDDED_OBJECT_SLOT, - array->address() + FixedArray::kHeaderSize, - SlotsBuffer::FAIL_ON_OVERFLOW); - CHECK(reinterpret_cast<void*>(buffer->Get(1)) == - reinterpret_cast<Object**>(SlotsBuffer::EMBEDDED_OBJECT_SLOT)); - CHECK(reinterpret_cast<void*>(buffer->Get(2)) == - HeapObject::RawField(*array, FixedArray::kHeaderSize)); - SlotsBuffer::RemoveObjectSlots(CcTest::i_isolate()->heap(), buffer, - array->address(), - array->address() + array->Size()); - CHECK(reinterpret_cast<void*>(buffer->Get(1)) == - HeapObject::RawField(heap->empty_fixed_array(), - FixedArrayBase::kLengthOffset)); - CHECK(reinterpret_cast<void*>(buffer->Get(2)) == - HeapObject::RawField(heap->empty_fixed_array(), - FixedArrayBase::kLengthOffset)); - delete buffer; -} - - -TEST(FilterInvalidSlotsBufferEntries) { - FLAG_manual_evacuation_candidates_selection = true; - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); - Factory* factory = isolate->factory(); - SlotsBuffer* buffer = new SlotsBuffer(NULL); - - // Set up a fake black object that will contain a recorded SMI, a recorded - // pointer to a new space object, and a recorded pointer to a non-evacuation - // candidate object. These object should be filtered out. Additionally, - // we point to an evacuation candidate object which should not be filtered - // out. - - // Create fake object and mark it black. - Handle<FixedArray> fake_object = factory->NewFixedArray(23, TENURED); - MarkBit mark_bit = Marking::MarkBitFrom(*fake_object); - Marking::MarkBlack(mark_bit); - - // Write a SMI into field one and record its address; - Object** field_smi = fake_object->RawFieldOfElementAt(0); - *field_smi = Smi::FromInt(100); - buffer->Add(field_smi); - - // Write a new space reference into field 2 and record its address; - Handle<FixedArray> new_space_object = factory->NewFixedArray(23); - mark_bit = Marking::MarkBitFrom(*new_space_object); - Marking::MarkBlack(mark_bit); - Object** field_new_space = fake_object->RawFieldOfElementAt(1); - *field_new_space = *new_space_object; - buffer->Add(field_new_space); - - // Write an old space reference into field 3 which points to an object not on - // an evacuation candidate. - Handle<FixedArray> old_space_object_non_evacuation = - factory->NewFixedArray(23, TENURED); - mark_bit = Marking::MarkBitFrom(*old_space_object_non_evacuation); - Marking::MarkBlack(mark_bit); - Object** field_old_space_object_non_evacuation = - fake_object->RawFieldOfElementAt(2); - *field_old_space_object_non_evacuation = *old_space_object_non_evacuation; - buffer->Add(field_old_space_object_non_evacuation); - - // Write an old space reference into field 4 which points to an object on an - // evacuation candidate. - heap::SimulateFullSpace(heap->old_space()); - Handle<FixedArray> valid_object = - isolate->factory()->NewFixedArray(23, TENURED); - Page* page = Page::FromAddress(valid_object->address()); - page->SetFlag(MemoryChunk::EVACUATION_CANDIDATE); - Object** valid_field = fake_object->RawFieldOfElementAt(3); - *valid_field = *valid_object; - buffer->Add(valid_field); - - SlotsBuffer::RemoveInvalidSlots(heap, buffer); - Object** kRemovedEntry = HeapObject::RawField(heap->empty_fixed_array(), - FixedArrayBase::kLengthOffset); - CHECK_EQ(buffer->Get(0), kRemovedEntry); - CHECK_EQ(buffer->Get(1), kRemovedEntry); - CHECK_EQ(buffer->Get(2), kRemovedEntry); - CHECK_EQ(buffer->Get(3), valid_field); - - // Clean-up to make verify heap happy. - mark_bit = Marking::MarkBitFrom(*fake_object); - Marking::MarkWhite(mark_bit); - mark_bit = Marking::MarkBitFrom(*new_space_object); - Marking::MarkWhite(mark_bit); - mark_bit = Marking::MarkBitFrom(*old_space_object_non_evacuation); - Marking::MarkWhite(mark_bit); - - delete buffer; -} - -} // namespace internal -} // namespace v8 diff --git a/deps/v8/test/cctest/test-strings.cc b/deps/v8/test/cctest/test-strings.cc index afa8ecb7ec..9793ae7f18 100644 --- a/deps/v8/test/cctest/test-strings.cc +++ b/deps/v8/test/cctest/test-strings.cc @@ -40,6 +40,7 @@ #include "src/objects.h" #include "src/unicode-decoder.h" #include "test/cctest/cctest.h" +#include "test/cctest/heap/heap-utils.h" // Adapted from http://en.wikipedia.org/wiki/Multiply-with-carry class MyRandomNumberGenerator { @@ -1239,8 +1240,8 @@ TEST(SliceFromSlice) { UNINITIALIZED_TEST(OneByteArrayJoin) { v8::Isolate::CreateParams create_params; // Set heap limits. - create_params.constraints.set_max_semi_space_size(1 * Page::kPageSize / MB); - create_params.constraints.set_max_old_space_size(6 * Page::kPageSize / MB); + create_params.constraints.set_max_semi_space_size(1); + create_params.constraints.set_max_old_space_size(6); create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); v8::Isolate* isolate = v8::Isolate::New(create_params); isolate->Enter(); @@ -1319,6 +1320,46 @@ TEST(RobustSubStringStub) { CheckException("%_SubString(slice, 0, 17);"); } +TEST(RobustSubStringStubExternalStrings) { + // Ensure that the specific combination of calling the SubStringStub on an + // external string and triggering a GC on string allocation does not crash. + // See crbug.com/649967. + + FLAG_allow_natives_syntax = true; +#ifdef VERIFY_HEAP + FLAG_verify_heap = true; +#endif + + CcTest::InitializeVM(); + v8::HandleScope handle_scope(CcTest::isolate()); + + v8::Local<v8::String> underlying = + CompileRun( + "var str = 'abcdefghijklmnopqrstuvwxyz';" + "str") + ->ToString(CcTest::isolate()->GetCurrentContext()) + .ToLocalChecked(); + CHECK(v8::Utils::OpenHandle(*underlying)->IsSeqOneByteString()); + + const int length = underlying->Length(); + uc16* two_byte = NewArray<uc16>(length + 1); + underlying->Write(two_byte); + + Resource* resource = new Resource(two_byte, length); + CHECK(underlying->MakeExternal(resource)); + CHECK(v8::Utils::OpenHandle(*underlying)->IsExternalTwoByteString()); + + v8::Local<v8::Script> script = v8_compile(v8_str("%_SubString(str, 5, 8)")); + + // Trigger a GC on string allocation. + i::heap::SimulateFullSpace(CcTest::heap()->new_space()); + + v8::Local<v8::Value> result; + CHECK(script->Run(v8::Isolate::GetCurrent()->GetCurrentContext()) + .ToLocal(&result)); + Handle<String> string = v8::Utils::OpenHandle(v8::String::Cast(*result)); + CHECK_EQ(0, strcmp("fgh", string->ToCString().get())); +} namespace { diff --git a/deps/v8/test/cctest/test-symbols.cc b/deps/v8/test/cctest/test-symbols.cc index 1024a27edf..220c52bd65 100644 --- a/deps/v8/test/cctest/test-symbols.cc +++ b/deps/v8/test/cctest/test-symbols.cc @@ -30,10 +30,18 @@ // of ConsStrings. These operations may not be very fast, but they // should be possible without getting errors due to too deep recursion. -#include "src/v8.h" - +#include "src/factory.h" +#include "src/isolate.h" #include "src/objects.h" #include "src/ostreams.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" +#include "src/v8.h" #include "test/cctest/cctest.h" using namespace v8::internal; @@ -63,8 +71,8 @@ TEST(Create) { #endif } - CcTest::heap()->CollectGarbage(i::NEW_SPACE); - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectGarbage(i::NEW_SPACE); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // All symbols should be distinct. for (int i = 0; i < kNumSymbols; ++i) { diff --git a/deps/v8/test/cctest/test-thread-termination.cc b/deps/v8/test/cctest/test-thread-termination.cc index 06e6fb00cd..523704ba69 100644 --- a/deps/v8/test/cctest/test-thread-termination.cc +++ b/deps/v8/test/cctest/test-thread-termination.cc @@ -25,6 +25,8 @@ // (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/isolate.h" #include "src/v8.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/test-threads.cc b/deps/v8/test/cctest/test-threads.cc index a9058a523a..afeb212253 100644 --- a/deps/v8/test/cctest/test-threads.cc +++ b/deps/v8/test/cctest/test-threads.cc @@ -30,7 +30,7 @@ #include "src/base/platform/platform.h" #include "src/isolate.h" - +#include "src/list-inl.h" class ThreadIdValidationThread : public v8::base::Thread { public: diff --git a/deps/v8/test/cctest/test-trace-event.cc b/deps/v8/test/cctest/test-trace-event.cc index 190cb40782..88f295f301 100644 --- a/deps/v8/test/cctest/test-trace-event.cc +++ b/deps/v8/test/cctest/test-trace-event.cc @@ -71,11 +71,14 @@ class MockTracingPlatform : public v8::Platform { void PerformDelayedTask() {} - uint64_t AddTraceEvent(char phase, const uint8_t* category_enabled_flag, - const char* name, const char* scope, uint64_t id, - uint64_t bind_id, int num_args, const char** arg_names, - const uint8_t* arg_types, const uint64_t* arg_values, - unsigned int flags) override { + using Platform::AddTraceEvent; + uint64_t AddTraceEvent( + char phase, const uint8_t* category_enabled_flag, const char* name, + const char* scope, uint64_t id, uint64_t bind_id, int num_args, + const char** arg_names, const uint8_t* arg_types, + const uint64_t* arg_values, + std::unique_ptr<v8::ConvertableToTraceFormat>* arg_convertables, + unsigned int flags) override { MockTraceObject* to = new MockTraceObject(phase, std::string(name), id, bind_id, num_args, flags); trace_object_list_.Add(to); diff --git a/deps/v8/test/cctest/test-transitions.cc b/deps/v8/test/cctest/test-transitions.cc index b7eb50f1c9..2f00900057 100644 --- a/deps/v8/test/cctest/test-transitions.cc +++ b/deps/v8/test/cctest/test-transitions.cc @@ -12,6 +12,10 @@ #include "src/factory.h" #include "src/field-type.h" #include "src/global-handles.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/field-type.h -> src/objects-inl.h +#include "src/objects-inl.h" +#include "src/transitions.h" #include "test/cctest/cctest.h" using namespace v8::internal; diff --git a/deps/v8/test/cctest/test-types.cc b/deps/v8/test/cctest/test-types.cc index 7b7706febf..dd1b3e3703 100644 --- a/deps/v8/test/cctest/test-types.cc +++ b/deps/v8/test/cctest/test-types.cc @@ -4,13 +4,25 @@ #include <vector> +#include "src/compiler/types.h" #include "src/crankshaft/hydrogen-types.h" -#include "src/types.h" +#include "src/factory.h" +#include "src/heap/heap.h" +#include "src/isolate.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/types-fuzz.h" using namespace v8::internal; +using namespace v8::internal::compiler; +namespace { // Testing auxiliaries (breaking the Type abstraction). @@ -29,7 +41,6 @@ typedef uint32_t bitset; struct Tests { typedef Types::TypeVector::iterator TypeIterator; - typedef Types::MapVector::iterator MapIterator; typedef Types::ValueVector::iterator ValueIterator; Isolate* isolate; @@ -52,7 +63,6 @@ struct Tests { return type1->Equals(type2) && this->IsBitset(type1) == this->IsBitset(type2) && this->IsUnion(type1) == this->IsUnion(type2) && - type1->NumClasses() == type2->NumClasses() && type1->NumConstants() == type2->NumConstants() && (!this->IsBitset(type1) || this->AsBitset(type1) == this->AsBitset(type2)) && @@ -103,8 +113,8 @@ struct Tests { for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { Type* t = *it; CHECK(1 == - this->IsBitset(t) + t->IsClass() + t->IsConstant() + t->IsRange() + - this->IsUnion(t) + t->IsArray() + t->IsFunction() + t->IsContext()); + this->IsBitset(t) + t->IsConstant() + t->IsRange() + + this->IsUnion(t)); } } @@ -177,101 +187,6 @@ struct Tests { } } - void PointwiseRepresentation() { - // Check we can decompose type into semantics and representation and - // then compose it back to get an equivalent type. - int counter = 0; - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - counter++; - printf("Counter: %i\n", counter); - fflush(stdout); - Type* type1 = *it1; - Type* representation = T.Representation(type1); - Type* semantic = T.Semantic(type1); - Type* composed = T.Union(representation, semantic); - CHECK(type1->Equals(composed)); - } - - // Pointwiseness of Union. - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - Type* type1 = *it1; - Type* type2 = *it2; - Type* representation1 = T.Representation(type1); - Type* semantic1 = T.Semantic(type1); - Type* representation2 = T.Representation(type2); - Type* semantic2 = T.Semantic(type2); - Type* direct_union = T.Union(type1, type2); - Type* representation_union = T.Union(representation1, representation2); - Type* semantic_union = T.Union(semantic1, semantic2); - Type* composed_union = T.Union(representation_union, semantic_union); - CHECK(direct_union->Equals(composed_union)); - } - } - - // Pointwiseness of Intersect. - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - Type* type1 = *it1; - Type* type2 = *it2; - Type* representation1 = T.Representation(type1); - Type* semantic1 = T.Semantic(type1); - Type* representation2 = T.Representation(type2); - Type* semantic2 = T.Semantic(type2); - Type* direct_intersection = T.Intersect(type1, type2); - Type* representation_intersection = - T.Intersect(representation1, representation2); - Type* semantic_intersection = T.Intersect(semantic1, semantic2); - Type* composed_intersection = - T.Union(representation_intersection, semantic_intersection); - CHECK(direct_intersection->Equals(composed_intersection)); - } - } - - // Pointwiseness of Is. - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - Type* type1 = *it1; - Type* type2 = *it2; - Type* representation1 = T.Representation(type1); - Type* semantic1 = T.Semantic(type1); - Type* representation2 = T.Representation(type2); - Type* semantic2 = T.Semantic(type2); - bool representation_is = representation1->Is(representation2); - bool semantic_is = semantic1->Is(semantic2); - bool direct_is = type1->Is(type2); - CHECK(direct_is == (semantic_is && representation_is)); - } - } - } - - void Class() { - // Constructor - for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { - Handle<i::Map> map = *mt; - Type* type = T.Class(map); - CHECK(type->IsClass()); - } - - // Map attribute - for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { - Handle<i::Map> map = *mt; - Type* type = T.Class(map); - CHECK(*map == *type->AsClass()->Map()); - } - - // Functionality & Injectivity: Class(M1) = Class(M2) iff M1 = M2 - for (MapIterator mt1 = T.maps.begin(); mt1 != T.maps.end(); ++mt1) { - for (MapIterator mt2 = T.maps.begin(); mt2 != T.maps.end(); ++mt2) { - Handle<i::Map> map1 = *mt1; - Handle<i::Map> map2 = *mt2; - Type* type1 = T.Class(map1); - Type* type2 = T.Class(map2); - CHECK(Equal(type1, type2) == (*map1 == *map2)); - } - } - } - void Constant() { // Constructor for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { @@ -398,129 +313,6 @@ struct Tests { } } - void Context() { - // Constructor - for (int i = 0; i < 20; ++i) { - Type* type = T.Random(); - Type* context = T.Context(type); - CHECK(context->IsContext()); - } - - // Attributes - for (int i = 0; i < 20; ++i) { - Type* type = T.Random(); - Type* context = T.Context(type); - CheckEqual(type, context->AsContext()->Outer()); - } - - // Functionality & Injectivity: Context(T1) = Context(T2) iff T1 = T2 - for (int i = 0; i < 20; ++i) { - for (int j = 0; j < 20; ++j) { - Type* type1 = T.Random(); - Type* type2 = T.Random(); - Type* context1 = T.Context(type1); - Type* context2 = T.Context(type2); - CHECK(Equal(context1, context2) == Equal(type1, type2)); - } - } - } - - void Array() { - // Constructor - for (int i = 0; i < 20; ++i) { - Type* type = T.Random(); - Type* array = T.Array1(type); - CHECK(array->IsArray()); - } - - // Attributes - for (int i = 0; i < 20; ++i) { - Type* type = T.Random(); - Type* array = T.Array1(type); - CheckEqual(type, array->AsArray()->Element()); - } - - // Functionality & Injectivity: Array(T1) = Array(T2) iff T1 = T2 - for (int i = 0; i < 20; ++i) { - for (int j = 0; j < 20; ++j) { - Type* type1 = T.Random(); - Type* type2 = T.Random(); - Type* array1 = T.Array1(type1); - Type* array2 = T.Array1(type2); - CHECK(Equal(array1, array2) == Equal(type1, type2)); - } - } - } - - void Function() { - // Constructors - for (int i = 0; i < 20; ++i) { - for (int j = 0; j < 20; ++j) { - for (int k = 0; k < 20; ++k) { - Type* type1 = T.Random(); - Type* type2 = T.Random(); - Type* type3 = T.Random(); - Type* function0 = T.Function0(type1, type2); - Type* function1 = T.Function1(type1, type2, type3); - Type* function2 = T.Function2(type1, type2, type3); - CHECK(function0->IsFunction()); - CHECK(function1->IsFunction()); - CHECK(function2->IsFunction()); - } - } - } - - // Attributes - for (int i = 0; i < 20; ++i) { - for (int j = 0; j < 20; ++j) { - for (int k = 0; k < 20; ++k) { - Type* type1 = T.Random(); - Type* type2 = T.Random(); - Type* type3 = T.Random(); - Type* function0 = T.Function0(type1, type2); - Type* function1 = T.Function1(type1, type2, type3); - Type* function2 = T.Function2(type1, type2, type3); - CHECK_EQ(0, function0->AsFunction()->Arity()); - CHECK_EQ(1, function1->AsFunction()->Arity()); - CHECK_EQ(2, function2->AsFunction()->Arity()); - CheckEqual(type1, function0->AsFunction()->Result()); - CheckEqual(type1, function1->AsFunction()->Result()); - CheckEqual(type1, function2->AsFunction()->Result()); - CheckEqual(type2, function0->AsFunction()->Receiver()); - CheckEqual(type2, function1->AsFunction()->Receiver()); - CheckEqual(T.Any, function2->AsFunction()->Receiver()); - CheckEqual(type3, function1->AsFunction()->Parameter(0)); - CheckEqual(type2, function2->AsFunction()->Parameter(0)); - CheckEqual(type3, function2->AsFunction()->Parameter(1)); - } - } - } - - // Functionality & Injectivity: Function(Ts1) = Function(Ts2) iff Ts1 = Ts2 - for (int i = 0; i < 20; ++i) { - for (int j = 0; j < 20; ++j) { - for (int k = 0; k < 20; ++k) { - Type* type1 = T.Random(); - Type* type2 = T.Random(); - Type* type3 = T.Random(); - Type* function01 = T.Function0(type1, type2); - Type* function02 = T.Function0(type1, type3); - Type* function03 = T.Function0(type3, type2); - Type* function11 = T.Function1(type1, type2, type2); - Type* function12 = T.Function1(type1, type2, type3); - Type* function21 = T.Function2(type1, type2, type2); - Type* function22 = T.Function2(type1, type2, type3); - Type* function23 = T.Function2(type1, type3, type2); - CHECK(Equal(function01, function02) == Equal(type2, type3)); - CHECK(Equal(function01, function03) == Equal(type1, type3)); - CHECK(Equal(function11, function12) == Equal(type2, type3)); - CHECK(Equal(function21, function22) == Equal(type2, type3)); - CHECK(Equal(function21, function23) == Equal(type2, type3)); - } - } - } - } - void Of() { // Constant(V)->Is(Of(V)) for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { @@ -554,61 +346,6 @@ struct Tests { } } - void NowOf() { - // Constant(V)->NowIs(NowOf(V)) - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - Handle<i::Object> value = *vt; - Type* const_type = T.Constant(value); - Type* nowof_type = T.NowOf(value); - CHECK(const_type->NowIs(nowof_type)); - } - - // NowOf(V)->Is(Of(V)) - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - Handle<i::Object> value = *vt; - Type* nowof_type = T.NowOf(value); - Type* of_type = T.Of(value); - CHECK(nowof_type->Is(of_type)); - } - - // If NowOf(V)->NowIs(T), then Constant(V)->NowIs(T) - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - Handle<i::Object> value = *vt; - Type* type = *it; - Type* const_type = T.Constant(value); - Type* nowof_type = T.NowOf(value); - CHECK(!nowof_type->NowIs(type) || const_type->NowIs(type)); - } - } - - // If Constant(V)->NowIs(T), - // then NowOf(V)->NowIs(T) or T->Maybe(Constant(V)) - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - Handle<i::Object> value = *vt; - Type* type = *it; - Type* const_type = T.Constant(value); - Type* nowof_type = T.NowOf(value); - CHECK(!const_type->NowIs(type) || - nowof_type->NowIs(type) || type->Maybe(const_type)); - } - } - - // If Constant(V)->Is(T), - // then NowOf(V)->Is(T) or T->Maybe(Constant(V)) - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - Handle<i::Object> value = *vt; - Type* type = *it; - Type* const_type = T.Constant(value); - Type* nowof_type = T.NowOf(value); - CHECK(!const_type->Is(type) || - nowof_type->Is(type) || type->Maybe(const_type)); - } - } - } - void MinMax() { // If b is regular numeric bitset, then Range(b->Min(), b->Max())->Is(b). // TODO(neis): Need to ignore representation for this to be true. @@ -784,31 +521,16 @@ struct Tests { Type* type2 = *j; CHECK(!type1->Is(type2) || this->IsBitset(type2) || this->IsUnion(type2) || this->IsUnion(type1) || - (type1->IsClass() && type2->IsClass()) || (type1->IsConstant() && type2->IsConstant()) || (type1->IsConstant() && type2->IsRange()) || (this->IsBitset(type1) && type2->IsRange()) || (type1->IsRange() && type2->IsRange()) || - (type1->IsContext() && type2->IsContext()) || - (type1->IsArray() && type2->IsArray()) || - (type1->IsFunction() && type2->IsFunction()) || !type1->IsInhabited()); } } } void Is2() { - // Class(M1)->Is(Class(M2)) iff M1 = M2 - for (MapIterator mt1 = T.maps.begin(); mt1 != T.maps.end(); ++mt1) { - for (MapIterator mt2 = T.maps.begin(); mt2 != T.maps.end(); ++mt2) { - Handle<i::Map> map1 = *mt1; - Handle<i::Map> map2 = *mt2; - Type* class_type1 = T.Class(map1); - Type* class_type2 = T.Class(map2); - CHECK(class_type1->Is(class_type2) == (*map1 == *map2)); - } - } - // Range(X1, Y1)->Is(Range(X2, Y2)) iff X1 >= X2 /\ Y1 <= Y2 for (ValueIterator i1 = T.integers.begin(); i1 != T.integers.end(); ++i1) { @@ -843,43 +565,6 @@ struct Tests { } } - // Context(T1)->Is(Context(T2)) iff T1 = T2 - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - Type* outer1 = *it1; - Type* outer2 = *it2; - Type* type1 = T.Context(outer1); - Type* type2 = T.Context(outer2); - CHECK(type1->Is(type2) == outer1->Equals(outer2)); - } - } - - // Array(T1)->Is(Array(T2)) iff T1 = T2 - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - Type* element1 = *it1; - Type* element2 = *it2; - Type* type1 = T.Array1(element1); - Type* type2 = T.Array1(element2); - CHECK(type1->Is(type2) == element1->Equals(element2)); - } - } - - // Function0(S1, T1)->Is(Function0(S2, T2)) iff S1 = S2 and T1 = T2 - for (TypeIterator i = T.types.begin(); i != T.types.end(); ++i) { - for (TypeIterator j = T.types.begin(); j != T.types.end(); ++j) { - Type* result1 = *i; - Type* receiver1 = *j; - Type* type1 = T.Function0(result1, receiver1); - Type* result2 = T.Random(); - Type* receiver2 = T.Random(); - Type* type2 = T.Function0(result2, receiver2); - CHECK(type1->Is(type2) == - (result1->Equals(result2) && receiver1->Equals(receiver2))); - } - } - - // Range-specific subtyping // If IsInteger(v) then Constant(v)->Is(Range(v, v)). @@ -949,13 +634,6 @@ struct Tests { // Subtyping between concrete structural types - CheckSub(T.ObjectClass, T.Object); - CheckSub(T.ArrayClass, T.OtherObject); - CheckSub(T.UninitializedClass, T.Internal); - CheckUnordered(T.ObjectClass, T.ArrayClass); - CheckUnordered(T.UninitializedClass, T.Null); - CheckUnordered(T.UninitializedClass, T.Undefined); - CheckSub(T.SmiConstant, T.SignedSmall); CheckSub(T.SmiConstant, T.Signed32); CheckSub(T.SmiConstant, T.Number); @@ -969,175 +647,6 @@ struct Tests { CheckUnordered(T.ObjectConstant1, T.ArrayConstant); CheckUnordered(T.UninitializedConstant, T.Null); CheckUnordered(T.UninitializedConstant, T.Undefined); - - CheckUnordered(T.ObjectConstant1, T.ObjectClass); - CheckUnordered(T.ObjectConstant2, T.ObjectClass); - CheckUnordered(T.ObjectConstant1, T.ArrayClass); - CheckUnordered(T.ObjectConstant2, T.ArrayClass); - CheckUnordered(T.ArrayConstant, T.ObjectClass); - - CheckSub(T.NumberArray, T.OtherObject); - CheckSub(T.NumberArray, T.Receiver); - CheckSub(T.NumberArray, T.Object); - CheckUnordered(T.StringArray, T.AnyArray); - - CheckSub(T.MethodFunction, T.Object); - CheckSub(T.NumberFunction1, T.Object); - CheckUnordered(T.SignedFunction1, T.NumberFunction1); - CheckUnordered(T.NumberFunction1, T.NumberFunction2); - } - - void NowIs() { - // Least Element (Bottom): None->NowIs(T) - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - Type* type = *it; - CHECK(T.None->NowIs(type)); - } - - // Greatest Element (Top): T->NowIs(Any) - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - Type* type = *it; - CHECK(type->NowIs(T.Any)); - } - - // Bottom Uniqueness: T->NowIs(None) implies T = None - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - Type* type = *it; - if (type->NowIs(T.None)) CheckEqual(type, T.None); - } - - // Top Uniqueness: Any->NowIs(T) implies T = Any - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - Type* type = *it; - if (T.Any->NowIs(type)) CheckEqual(type, T.Any); - } - - // Reflexivity: T->NowIs(T) - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - Type* type = *it; - CHECK(type->NowIs(type)); - } - - // Transitivity: T1->NowIs(T2) and T2->NowIs(T3) implies T1->NowIs(T3) - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { - Type* type1 = *it1; - Type* type2 = *it2; - Type* type3 = *it3; - CHECK(!(type1->NowIs(type2) && type2->NowIs(type3)) || - type1->NowIs(type3)); - } - } - } - - // Antisymmetry: T1->NowIs(T2) and T2->NowIs(T1) iff T1 = T2 - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - Type* type1 = *it1; - Type* type2 = *it2; - CHECK((type1->NowIs(type2) && type2->NowIs(type1)) == - Equal(type1, type2)); - } - } - - // T1->Is(T2) implies T1->NowIs(T2) - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - Type* type1 = *it1; - Type* type2 = *it2; - CHECK(!type1->Is(type2) || type1->NowIs(type2)); - } - } - - // Constant(V1)->NowIs(Constant(V2)) iff V1 = V2 - for (ValueIterator vt1 = T.values.begin(); vt1 != T.values.end(); ++vt1) { - for (ValueIterator vt2 = T.values.begin(); vt2 != T.values.end(); ++vt2) { - Handle<i::Object> value1 = *vt1; - Handle<i::Object> value2 = *vt2; - Type* const_type1 = T.Constant(value1); - Type* const_type2 = T.Constant(value2); - CHECK(const_type1->NowIs(const_type2) == (*value1 == *value2)); - } - } - - // Class(M1)->NowIs(Class(M2)) iff M1 = M2 - for (MapIterator mt1 = T.maps.begin(); mt1 != T.maps.end(); ++mt1) { - for (MapIterator mt2 = T.maps.begin(); mt2 != T.maps.end(); ++mt2) { - Handle<i::Map> map1 = *mt1; - Handle<i::Map> map2 = *mt2; - Type* class_type1 = T.Class(map1); - Type* class_type2 = T.Class(map2); - CHECK(class_type1->NowIs(class_type2) == (*map1 == *map2)); - } - } - - // Constant(V)->NowIs(Class(M)) iff V has map M - for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - Handle<i::Map> map = *mt; - Handle<i::Object> value = *vt; - Type* const_type = T.Constant(value); - Type* class_type = T.Class(map); - CHECK((value->IsHeapObject() && - i::HeapObject::cast(*value)->map() == *map) - == const_type->NowIs(class_type)); - } - } - - // Class(M)->NowIs(Constant(V)) never - for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - Handle<i::Map> map = *mt; - Handle<i::Object> value = *vt; - Type* const_type = T.Constant(value); - Type* class_type = T.Class(map); - CHECK(!class_type->NowIs(const_type)); - } - } - } - - void Contains() { - // T->Contains(V) iff Constant(V)->Is(T) - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - Type* type = *it; - Handle<i::Object> value = *vt; - Type* const_type = T.Constant(value); - CHECK(type->Contains(value) == const_type->Is(type)); - } - } - } - - void NowContains() { - // T->NowContains(V) iff Constant(V)->NowIs(T) - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - Type* type = *it; - Handle<i::Object> value = *vt; - Type* const_type = T.Constant(value); - CHECK(type->NowContains(value) == const_type->NowIs(type)); - } - } - - // T->Contains(V) implies T->NowContains(V) - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - Type* type = *it; - Handle<i::Object> value = *vt; - CHECK(!type->Contains(value) || type->NowContains(value)); - } - } - - // NowOf(V)->Is(T) implies T->NowContains(V) - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - Type* type = *it; - Handle<i::Object> value = *vt; - Type* nowof_type = T.Of(value); - CHECK(!nowof_type->NowIs(type) || type->NowContains(value)); - } - } } void Maybe() { @@ -1209,45 +718,6 @@ struct Tests { } } - // Class(M1)->Maybe(Class(M2)) iff M1 = M2 - for (MapIterator mt1 = T.maps.begin(); mt1 != T.maps.end(); ++mt1) { - for (MapIterator mt2 = T.maps.begin(); mt2 != T.maps.end(); ++mt2) { - Handle<i::Map> map1 = *mt1; - Handle<i::Map> map2 = *mt2; - Type* class_type1 = T.Class(map1); - Type* class_type2 = T.Class(map2); - CHECK(class_type1->Maybe(class_type2) == (*map1 == *map2)); - } - } - - // Constant(V)->Maybe(Class(M)) never - // This does NOT hold! - /* - for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - Handle<i::Map> map = *mt; - Handle<i::Object> value = *vt; - Type* const_type = T.Constant(value); - Type* class_type = T.Class(map); - CHECK(!const_type->Maybe(class_type)); - } - } - */ - - // Class(M)->Maybe(Constant(V)) never - // This does NOT hold! - /* - for (MapIterator mt = T.maps.begin(); mt != T.maps.end(); ++mt) { - for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { - Handle<i::Map> map = *mt; - Handle<i::Object> value = *vt; - Type* const_type = T.Constant(value); - Type* class_type = T.Class(map); - CHECK(!class_type->Maybe(const_type)); - } - } - */ - // Basic types CheckDisjoint(T.Boolean, T.Null); CheckDisjoint(T.Undefined, T.Null); @@ -1271,11 +741,6 @@ struct Tests { CheckDisjoint(T.Object, T.Proxy); // Structural types - CheckOverlap(T.ObjectClass, T.Object); - CheckOverlap(T.ArrayClass, T.Object); - CheckOverlap(T.ObjectClass, T.ObjectClass); - CheckOverlap(T.ArrayClass, T.ArrayClass); - CheckDisjoint(T.ObjectClass, T.ArrayClass); CheckOverlap(T.SmiConstant, T.SignedSmall); CheckOverlap(T.SmiConstant, T.Signed32); CheckOverlap(T.SmiConstant, T.Number); @@ -1286,20 +751,6 @@ struct Tests { CheckOverlap(T.ObjectConstant1, T.ObjectConstant1); CheckDisjoint(T.ObjectConstant1, T.ObjectConstant2); CheckDisjoint(T.ObjectConstant1, T.ArrayConstant); - CheckOverlap(T.ObjectConstant1, T.ArrayClass); - CheckOverlap(T.ObjectConstant2, T.ArrayClass); - CheckOverlap(T.ArrayConstant, T.ObjectClass); - CheckOverlap(T.NumberArray, T.Receiver); - CheckDisjoint(T.NumberArray, T.AnyArray); - CheckDisjoint(T.NumberArray, T.StringArray); - CheckOverlap(T.MethodFunction, T.Object); - CheckDisjoint(T.SignedFunction1, T.NumberFunction1); - CheckDisjoint(T.SignedFunction1, T.NumberFunction2); - CheckDisjoint(T.NumberFunction1, T.NumberFunction2); - CheckDisjoint(T.SignedFunction1, T.MethodFunction); - CheckOverlap(T.ObjectConstant1, T.ObjectClass); // !!! - CheckOverlap(T.ObjectConstant2, T.ObjectClass); // !!! - CheckOverlap(T.NumberClass, T.Intersect(T.Number, T.Tagged)); // !!! } void Union1() { @@ -1435,49 +886,12 @@ struct Tests { } void Union4() { - // Class-class - CheckSub(T.Union(T.ObjectClass, T.ArrayClass), T.Object); - CheckOverlap(T.Union(T.ObjectClass, T.ArrayClass), T.OtherObject); - CheckOverlap(T.Union(T.ObjectClass, T.ArrayClass), T.Receiver); - CheckDisjoint(T.Union(T.ObjectClass, T.ArrayClass), T.Number); - // Constant-constant CheckSub(T.Union(T.ObjectConstant1, T.ObjectConstant2), T.Object); CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayConstant), T.OtherObject); - CheckUnordered( - T.Union(T.ObjectConstant1, T.ObjectConstant2), T.ObjectClass); CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayConstant), T.OtherObject); CheckDisjoint( T.Union(T.ObjectConstant1, T.ArrayConstant), T.Number); - CheckOverlap( - T.Union(T.ObjectConstant1, T.ArrayConstant), T.ObjectClass); // !!! - - // Bitset-array - CHECK(this->IsBitset(T.Union(T.AnyArray, T.Receiver))); - CHECK(this->IsUnion(T.Union(T.NumberArray, T.Number))); - - CheckEqual(T.Union(T.AnyArray, T.Receiver), T.Receiver); - CheckEqual(T.Union(T.AnyArray, T.OtherObject), T.OtherObject); - CheckUnordered(T.Union(T.AnyArray, T.String), T.Receiver); - CheckOverlap(T.Union(T.NumberArray, T.String), T.Object); - CheckDisjoint(T.Union(T.NumberArray, T.String), T.Number); - - // Bitset-function - CHECK(this->IsBitset(T.Union(T.MethodFunction, T.Object))); - CHECK(this->IsUnion(T.Union(T.NumberFunction1, T.Number))); - - CheckEqual(T.Union(T.MethodFunction, T.Object), T.Object); - CheckUnordered(T.Union(T.NumberFunction1, T.String), T.Object); - CheckOverlap(T.Union(T.NumberFunction2, T.String), T.Object); - CheckDisjoint(T.Union(T.NumberFunction1, T.String), T.Number); - - // Bitset-class - CheckSub(T.Union(T.ObjectClass, T.SignedSmall), - T.Union(T.Object, T.Number)); - CheckSub(T.Union(T.ObjectClass, T.OtherObject), T.Object); - CheckUnordered(T.Union(T.ObjectClass, T.String), T.OtherObject); - CheckOverlap(T.Union(T.ObjectClass, T.String), T.Object); - CheckDisjoint(T.Union(T.ObjectClass, T.String), T.Number); // Bitset-constant CheckSub( @@ -1487,32 +901,6 @@ struct Tests { CheckOverlap(T.Union(T.ObjectConstant1, T.String), T.Object); CheckDisjoint(T.Union(T.ObjectConstant1, T.String), T.Number); - // Class-constant - CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), T.Object); - CheckUnordered(T.ObjectClass, T.Union(T.ObjectConstant1, T.ArrayClass)); - CheckSub(T.Union(T.ObjectConstant1, T.ArrayClass), - T.Union(T.Receiver, T.Object)); - CheckUnordered(T.Union(T.ObjectConstant1, T.ArrayClass), T.ArrayConstant); - CheckOverlap(T.Union(T.ObjectConstant1, T.ArrayClass), T.ObjectConstant2); - CheckOverlap( - T.Union(T.ObjectConstant1, T.ArrayClass), T.ObjectClass); // !!! - - // Bitset-union - CheckSub( - T.NaN, - T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Number)); - CheckSub( - T.Union(T.Union(T.ArrayClass, T.ObjectConstant1), T.Signed32), - T.Union(T.ObjectConstant1, T.Union(T.Number, T.ArrayClass))); - - // Class-union - CheckSub( - T.Union(T.ObjectClass, T.Union(T.ObjectConstant1, T.ObjectClass)), - T.Object); - CheckEqual( - T.Union(T.Union(T.ArrayClass, T.ObjectConstant2), T.ArrayClass), - T.Union(T.ArrayClass, T.ObjectConstant2)); - // Constant-union CheckEqual( T.Union( @@ -1524,27 +912,12 @@ struct Tests { T.Union( T.ObjectConstant2, T.Union(T.ArrayConstant, T.ObjectConstant1))); - // Array-union - CheckEqual( - T.Union(T.AnyArray, T.Union(T.NumberArray, T.AnyArray)), - T.Union(T.AnyArray, T.NumberArray)); - CheckSub(T.Union(T.AnyArray, T.NumberArray), T.OtherObject); - - // Function-union - CheckEqual( - T.Union(T.NumberFunction1, T.NumberFunction2), - T.Union(T.NumberFunction2, T.NumberFunction1)); - CheckSub(T.Union(T.SignedFunction1, T.MethodFunction), T.Object); - // Union-union CheckEqual( T.Union( T.Union(T.ObjectConstant2, T.ObjectConstant1), T.Union(T.ObjectConstant1, T.ObjectConstant2)), T.Union(T.ObjectConstant2, T.ObjectConstant1)); - CheckEqual(T.Union(T.Union(T.Number, T.ArrayClass), - T.Union(T.SignedSmall, T.Receiver)), - T.Union(T.Number, T.Receiver)); } void Intersect() { @@ -1580,48 +953,6 @@ struct Tests { } } - // Associativity: - // Intersect(T1, Intersect(T2, T3)) = Intersect(Intersect(T1, T2), T3) - // This does NOT hold. For example: - // (Class(..stringy1..) /\ Class(..stringy2..)) /\ Constant(..string..) = - // None - // Class(..stringy1..) /\ (Class(..stringy2..) /\ Constant(..string..)) = - // Constant(..string..) - /* - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { - Type* type1 = *it1; - Type* type2 = *it2; - Type* type3 = *it3; - Type* intersect12 = T.Intersect(type1, type2); - Type* intersect23 = T.Intersect(type2, type3); - Type* intersect1_23 = T.Intersect(type1, intersect23); - Type* intersect12_3 = T.Intersect(intersect12, type3); - CheckEqual(intersect1_23, intersect12_3); - } - } - } - */ - - // Join: Intersect(T1, T2)->Is(T1) and Intersect(T1, T2)->Is(T2) - // This does NOT hold. For example: - // Class(..stringy..) /\ Constant(..string..) = Constant(..string..) - // Currently, not even the disjunction holds: - // Class(Internal/TaggedPtr) /\ (Any/Untagged \/ Context(..)) = - // Class(Internal/TaggedPtr) \/ Context(..) - /* - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - Type* type1 = *it1; - Type* type2 = *it2; - Type* intersect12 = T.Intersect(type1, type2); - CHECK(intersect12->Is(type1)); - CHECK(intersect12->Is(type2)); - } - } - */ - // Lower Boundedness: T1->Is(T2) implies Intersect(T1, T2) = T1 for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { @@ -1632,46 +963,6 @@ struct Tests { } } - // Monotonicity: T1->Is(T2) implies Intersect(T1, T3)->Is(Intersect(T2, T3)) - // This does NOT hold. For example: - // Class(OtherObject/TaggedPtr) <= Any/TaggedPtr - // Class(OtherObject/TaggedPtr) /\ Any/UntaggedInt1 = Class(..) - // Any/TaggedPtr /\ Any/UntaggedInt1 = None - /* - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { - Type* type1 = *it1; - Type* type2 = *it2; - Type* type3 = *it3; - Type* intersect13 = T.Intersect(type1, type3); - Type* intersect23 = T.Intersect(type2, type3); - CHECK(!type1->Is(type2) || intersect13->Is(intersect23)); - } - } - } - */ - - // Monotonicity: T1->Is(T3) or T2->Is(T3) implies Intersect(T1, T2)->Is(T3) - // This does NOT hold. For example: - // Class(..stringy..) <= Class(..stringy..) - // Class(..stringy..) /\ Constant(..string..) = Constant(..string..) - // Constant(..string..) </= Class(..stringy..) - /* - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - for (TypeIterator it3 = T.types.begin(); it3 != T.types.end(); ++it3) { - Type* type1 = *it1; - Type* type2 = *it2; - Type* type3 = *it3; - Type* intersect12 = T.Intersect(type1, type2); - CHECK(!(type1->Is(type3) || type2->Is(type3)) || - intersect12->Is(type3)); - } - } - } - */ - // Monotonicity: T1->Is(T2) and T1->Is(T3) implies T1->Is(Intersect(T2, T3)) for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { HandleScope scope(isolate); @@ -1687,63 +978,6 @@ struct Tests { } } - // Bitset-class - CheckEqual(T.Intersect(T.ObjectClass, T.Object), T.ObjectClass); - CheckEqual(T.Semantic(T.Intersect(T.ObjectClass, T.Number)), T.None); - - // Bitset-array - CheckEqual(T.Intersect(T.NumberArray, T.Object), T.NumberArray); - CheckEqual(T.Semantic(T.Intersect(T.AnyArray, T.Proxy)), T.None); - - // Bitset-function - CheckEqual(T.Intersect(T.MethodFunction, T.Object), T.MethodFunction); - CheckEqual(T.Semantic(T.Intersect(T.NumberFunction1, T.Proxy)), T.None); - - // Bitset-union - CheckEqual( - T.Intersect(T.Object, T.Union(T.ObjectConstant1, T.ObjectClass)), - T.Union(T.ObjectConstant1, T.ObjectClass)); - CheckEqual(T.Semantic(T.Intersect(T.Union(T.ArrayClass, T.ObjectConstant1), - T.Number)), - T.None); - - // Class-constant - CHECK(T.Intersect(T.ObjectConstant1, T.ObjectClass)->IsInhabited()); // !!! - CHECK(T.Intersect(T.ArrayClass, T.ObjectConstant2)->IsInhabited()); - - // Array-union - CheckEqual( - T.Intersect(T.NumberArray, T.Union(T.NumberArray, T.ArrayClass)), - T.NumberArray); - CheckEqual( - T.Intersect(T.AnyArray, T.Union(T.Object, T.SmiConstant)), - T.AnyArray); - CHECK( - !T.Intersect(T.Union(T.AnyArray, T.ArrayConstant), T.NumberArray) - ->IsInhabited()); - - // Function-union - CheckEqual( - T.Intersect(T.MethodFunction, T.Union(T.String, T.MethodFunction)), - T.MethodFunction); - CheckEqual( - T.Intersect(T.NumberFunction1, T.Union(T.Object, T.SmiConstant)), - T.NumberFunction1); - CHECK( - !T.Intersect(T.Union(T.MethodFunction, T.Name), T.NumberFunction2) - ->IsInhabited()); - - // Class-union - CheckEqual( - T.Intersect(T.ArrayClass, T.Union(T.ObjectConstant2, T.ArrayClass)), - T.ArrayClass); - CheckEqual( - T.Intersect(T.ArrayClass, T.Union(T.Object, T.SmiConstant)), - T.ArrayClass); - CHECK( - T.Intersect(T.Union(T.ObjectClass, T.ArrayConstant), T.ArrayClass) - ->IsInhabited()); // !!! - // Constant-union CheckEqual( T.Intersect( @@ -1752,34 +986,13 @@ struct Tests { CheckEqual( T.Intersect(T.SmiConstant, T.Union(T.Number, T.ObjectConstant2)), T.SmiConstant); - CHECK( - T.Intersect( - T.Union(T.ArrayConstant, T.ObjectClass), T.ObjectConstant1) - ->IsInhabited()); // !!! // Union-union - CheckEqual(T.Intersect(T.Union(T.Number, T.ArrayClass), - T.Union(T.SignedSmall, T.Receiver)), - T.Union(T.SignedSmall, T.ArrayClass)); - CheckEqual(T.Intersect(T.Union(T.Number, T.ObjectClass), - T.Union(T.Signed32, T.OtherObject)), - T.Union(T.Signed32, T.ObjectClass)); CheckEqual( T.Intersect( T.Union(T.ObjectConstant2, T.ObjectConstant1), T.Union(T.ObjectConstant1, T.ObjectConstant2)), T.Union(T.ObjectConstant2, T.ObjectConstant1)); - CheckEqual( - T.Intersect( - T.Union( - T.ArrayClass, - T.Union(T.ObjectConstant2, T.ObjectConstant1)), - T.Union( - T.ObjectConstant1, - T.Union(T.ArrayConstant, T.ObjectConstant2))), - T.Union( - T.ArrayConstant, - T.Union(T.ObjectConstant2, T.ObjectConstant1))); // !!! } void Distributivity() { @@ -1856,70 +1069,42 @@ struct Tests { } } } - - void HTypeFromType() { - for (TypeIterator it1 = T.types.begin(); it1 != T.types.end(); ++it1) { - for (TypeIterator it2 = T.types.begin(); it2 != T.types.end(); ++it2) { - Type* type1 = *it1; - Type* type2 = *it2; - HType htype1 = HType::FromType(type1); - HType htype2 = HType::FromType(type2); - CHECK(!type1->Is(type2) || htype1.IsSubtypeOf(htype2)); - } - } - } }; -TEST(IsSomeType_zone) { Tests().IsSomeType(); } - -TEST(PointwiseRepresentation_zone) { Tests().PointwiseRepresentation(); } - -TEST(BitsetType_zone) { Tests().Bitset(); } - -TEST(ClassType_zone) { Tests().Class(); } - -TEST(ConstantType_zone) { Tests().Constant(); } - -TEST(RangeType_zone) { Tests().Range(); } - -TEST(ArrayType_zone) { Tests().Array(); } - -TEST(FunctionType_zone) { Tests().Function(); } - -TEST(Of_zone) { Tests().Of(); } +} // namespace -TEST(NowOf_zone) { Tests().NowOf(); } +TEST(IsSomeType) { Tests().IsSomeType(); } -TEST(MinMax_zone) { Tests().MinMax(); } +TEST(BitsetType) { Tests().Bitset(); } -TEST(BitsetGlb_zone) { Tests().BitsetGlb(); } +TEST(ConstantType) { Tests().Constant(); } -TEST(BitsetLub_zone) { Tests().BitsetLub(); } +TEST(RangeType) { Tests().Range(); } -TEST(Is1_zone) { Tests().Is1(); } +TEST(Of) { Tests().Of(); } -TEST(Is2_zone) { Tests().Is2(); } +TEST(MinMax) { Tests().MinMax(); } -TEST(NowIs_zone) { Tests().NowIs(); } +TEST(BitsetGlb) { Tests().BitsetGlb(); } -TEST(Contains_zone) { Tests().Contains(); } +TEST(BitsetLub) { Tests().BitsetLub(); } -TEST(NowContains_zone) { Tests().NowContains(); } +TEST(Is1) { Tests().Is1(); } -TEST(Maybe_zone) { Tests().Maybe(); } +TEST(Is2) { Tests().Is2(); } -TEST(Union1_zone) { Tests().Union1(); } +TEST(Maybe) { Tests().Maybe(); } -TEST(Union2_zone) { Tests().Union2(); } +TEST(Union1) { Tests().Union1(); } -TEST(Union3_zone) { Tests().Union3(); } +TEST(Union2) { Tests().Union2(); } -TEST(Union4_zone) { Tests().Union4(); } +TEST(Union3) { Tests().Union3(); } -TEST(Intersect_zone) { Tests().Intersect(); } +TEST(Union4) { Tests().Union4(); } -TEST(Distributivity_zone) { Tests().Distributivity(); } +TEST(Intersect) { Tests().Intersect(); } -TEST(GetRange_zone) { Tests().GetRange(); } +TEST(Distributivity) { Tests().Distributivity(); } -TEST(HTypeFromType_zone) { Tests().HTypeFromType(); } +TEST(GetRange) { Tests().GetRange(); } diff --git a/deps/v8/test/cctest/test-unboxed-doubles.cc b/deps/v8/test/cctest/test-unboxed-doubles.cc index 6a1d87015b..dde26d2676 100644 --- a/deps/v8/test/cctest/test-unboxed-doubles.cc +++ b/deps/v8/test/cctest/test-unboxed-doubles.cc @@ -934,7 +934,7 @@ TEST(Regress436816) { CHECK(object->map()->HasFastPointerLayout()); // Trigger GCs and heap verification. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -991,7 +991,7 @@ TEST(DescriptorArrayTrimming) { // Call GC that should trim both |map|'s descriptor array and layout // descriptor. - CcTest::heap()->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // The unused tail of the layout descriptor is now "clean" again. CHECK(map->layout_descriptor()->IsConsistentWithMap(*map, true)); @@ -1057,7 +1057,7 @@ TEST(DoScavenge) { CHECK(isolate->heap()->new_space()->Contains(*obj)); // Do scavenge so that |obj| is moved to survivor space. - CcTest::heap()->CollectGarbage(i::NEW_SPACE); + CcTest::CollectGarbage(i::NEW_SPACE); // Create temp object in the new space. Handle<JSArray> temp = factory->NewJSArray(0, FAST_ELEMENTS); @@ -1074,7 +1074,7 @@ TEST(DoScavenge) { // Now |obj| moves to old gen and it has a double field that looks like // a pointer to a from semi-space. - CcTest::heap()->CollectGarbage(i::NEW_SPACE, "boom"); + CcTest::CollectGarbage(i::NEW_SPACE); CHECK(isolate->heap()->old_space()->Contains(*obj)); @@ -1155,14 +1155,14 @@ TEST(DoScavengeWithIncrementalWriteBarrier) { CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); // Trigger GCs so that |obj| moves to old gen. - heap->CollectGarbage(i::NEW_SPACE); // in survivor space now - heap->CollectGarbage(i::NEW_SPACE); // in old gen now + CcTest::CollectGarbage(i::NEW_SPACE); // in survivor space now + CcTest::CollectGarbage(i::NEW_SPACE); // in old gen now CHECK(isolate->heap()->old_space()->Contains(*obj)); CHECK(isolate->heap()->old_space()->Contains(*obj_value)); CHECK(MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); - heap->CollectGarbage(i::OLD_SPACE, "boom"); + CcTest::CollectGarbage(i::OLD_SPACE); // |obj_value| must be evacuated. CHECK(!MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); @@ -1412,7 +1412,7 @@ static void TestWriteBarrier(Handle<Map> map, Handle<Map> new_map, obj->RawFastDoublePropertyAtPut(double_field_index, boom_value); // Trigger GC to evacuate all candidates. - CcTest::heap()->CollectGarbage(NEW_SPACE, "boom"); + CcTest::CollectGarbage(NEW_SPACE); if (check_tagged_value) { FieldIndex tagged_field_index = @@ -1491,7 +1491,7 @@ static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map, obj->RawFastDoublePropertyAtPut(double_field_index, boom_value); // Trigger GC to evacuate all candidates. - CcTest::heap()->CollectGarbage(OLD_SPACE, "boom"); + CcTest::CollectGarbage(OLD_SPACE); // Ensure that the values are still there and correct. CHECK(!MarkCompactCollector::IsOnEvacuationCandidate(*obj_value)); diff --git a/deps/v8/test/cctest/test-unique.cc b/deps/v8/test/cctest/test-unique.cc index d84279475d..980f0b6538 100644 --- a/deps/v8/test/cctest/test-unique.cc +++ b/deps/v8/test/cctest/test-unique.cc @@ -32,6 +32,13 @@ #include "src/crankshaft/unique.h" #include "src/factory.h" #include "src/global-handles.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" using namespace v8::internal; diff --git a/deps/v8/test/cctest/test-utils.cc b/deps/v8/test/cctest/test-utils.cc index 00702a5e19..463672ccc8 100644 --- a/deps/v8/test/cctest/test-utils.cc +++ b/deps/v8/test/cctest/test-utils.cc @@ -33,6 +33,7 @@ #include "src/base/platform/platform.h" #include "src/collector.h" +#include "src/conversions.h" #include "test/cctest/cctest.h" using namespace v8::internal; diff --git a/deps/v8/test/cctest/test-weakmaps.cc b/deps/v8/test/cctest/test-weakmaps.cc index 2d0e620d7d..eb5333f6c0 100644 --- a/deps/v8/test/cctest/test-weakmaps.cc +++ b/deps/v8/test/cctest/test-weakmaps.cc @@ -29,7 +29,16 @@ #include "src/v8.h" +#include "src/factory.h" #include "src/global-handles.h" +#include "src/isolate.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-utils.h" @@ -67,7 +76,6 @@ TEST(Weakness) { LocalContext context; Isolate* isolate = GetIsolateFrom(&context); Factory* factory = isolate->factory(); - Heap* heap = isolate->heap(); HandleScope scope(isolate); Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); GlobalHandles* global_handles = isolate->global_handles(); @@ -96,7 +104,7 @@ TEST(Weakness) { CHECK_EQ(2, ObjectHashTable::cast(weakmap->table())->NumberOfElements()); // Force a full GC. - heap->CollectAllGarbage(false); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); CHECK_EQ(0, NumberOfWeakCalls); CHECK_EQ(2, ObjectHashTable::cast(weakmap->table())->NumberOfElements()); CHECK_EQ( @@ -112,7 +120,7 @@ TEST(Weakness) { } CHECK(global_handles->IsWeak(key.location())); - heap->CollectAllGarbage(false); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); CHECK_EQ(1, NumberOfWeakCalls); CHECK_EQ(0, ObjectHashTable::cast(weakmap->table())->NumberOfElements()); CHECK_EQ(2, @@ -124,7 +132,6 @@ TEST(Shrinking) { LocalContext context; Isolate* isolate = GetIsolateFrom(&context); Factory* factory = isolate->factory(); - Heap* heap = isolate->heap(); HandleScope scope(isolate); Handle<JSWeakMap> weakmap = AllocateJSWeakMap(isolate); @@ -150,7 +157,7 @@ TEST(Shrinking) { CHECK_EQ(32, ObjectHashTable::cast(weakmap->table())->NumberOfElements()); CHECK_EQ( 0, ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements()); - heap->CollectAllGarbage(false); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); CHECK_EQ(0, ObjectHashTable::cast(weakmap->table())->NumberOfElements()); CHECK_EQ( 32, ObjectHashTable::cast(weakmap->table())->NumberOfDeletedElements()); @@ -193,7 +200,7 @@ TEST(Regress2060a) { // Force compacting garbage collection. CHECK(FLAG_always_compact); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -235,9 +242,9 @@ TEST(Regress2060b) { // Force compacting garbage collection. The subsequent collections are used // to verify that key references were actually updated. CHECK(FLAG_always_compact); - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -254,5 +261,5 @@ TEST(Regress399527) { // The weak map is marked black here but leaving the handle scope will make // the object unreachable. Aborting incremental marking will clear all the // marking bits which makes the weak map garbage. - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } diff --git a/deps/v8/test/cctest/test-weaksets.cc b/deps/v8/test/cctest/test-weaksets.cc index ec6945aec7..c51c70a421 100644 --- a/deps/v8/test/cctest/test-weaksets.cc +++ b/deps/v8/test/cctest/test-weaksets.cc @@ -29,7 +29,16 @@ #include "src/v8.h" +#include "src/factory.h" #include "src/global-handles.h" +#include "src/isolate.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/factory.h -> src/objects-inl.h +#include "src/objects-inl.h" +// FIXME(mstarzinger, marja): This is weird, but required because of the missing +// (disallowed) include: src/type-feedback-vector.h -> +// src/type-feedback-vector-inl.h +#include "src/type-feedback-vector-inl.h" #include "test/cctest/cctest.h" #include "test/cctest/heap/heap-utils.h" @@ -70,7 +79,6 @@ TEST(WeakSet_Weakness) { LocalContext context; Isolate* isolate = GetIsolateFrom(&context); Factory* factory = isolate->factory(); - Heap* heap = isolate->heap(); HandleScope scope(isolate); Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate); GlobalHandles* global_handles = isolate->global_handles(); @@ -95,7 +103,7 @@ TEST(WeakSet_Weakness) { CHECK_EQ(1, ObjectHashTable::cast(weakset->table())->NumberOfElements()); // Force a full GC. - heap->CollectAllGarbage(false); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); CHECK_EQ(0, NumberOfWeakCalls); CHECK_EQ(1, ObjectHashTable::cast(weakset->table())->NumberOfElements()); CHECK_EQ( @@ -111,7 +119,7 @@ TEST(WeakSet_Weakness) { } CHECK(global_handles->IsWeak(key.location())); - heap->CollectAllGarbage(false); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); CHECK_EQ(1, NumberOfWeakCalls); CHECK_EQ(0, ObjectHashTable::cast(weakset->table())->NumberOfElements()); CHECK_EQ( @@ -123,7 +131,6 @@ TEST(WeakSet_Shrinking) { LocalContext context; Isolate* isolate = GetIsolateFrom(&context); Factory* factory = isolate->factory(); - Heap* heap = isolate->heap(); HandleScope scope(isolate); Handle<JSWeakSet> weakset = AllocateJSWeakSet(isolate); @@ -149,7 +156,7 @@ TEST(WeakSet_Shrinking) { CHECK_EQ(32, ObjectHashTable::cast(weakset->table())->NumberOfElements()); CHECK_EQ( 0, ObjectHashTable::cast(weakset->table())->NumberOfDeletedElements()); - heap->CollectAllGarbage(false); + CcTest::CollectAllGarbage(Heap::kAbortIncrementalMarkingMask); CHECK_EQ(0, ObjectHashTable::cast(weakset->table())->NumberOfElements()); CHECK_EQ( 32, ObjectHashTable::cast(weakset->table())->NumberOfDeletedElements()); @@ -192,7 +199,7 @@ TEST(WeakSet_Regress2060a) { // Force compacting garbage collection. CHECK(FLAG_always_compact); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } @@ -234,7 +241,7 @@ TEST(WeakSet_Regress2060b) { // Force compacting garbage collection. The subsequent collections are used // to verify that key references were actually updated. CHECK(FLAG_always_compact); - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); - heap->CollectAllGarbage(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } diff --git a/deps/v8/test/cctest/types-fuzz.h b/deps/v8/test/cctest/types-fuzz.h index 7bf9700b40..16bfd737ea 100644 --- a/deps/v8/test/cctest/types-fuzz.h +++ b/deps/v8/test/cctest/types-fuzz.h @@ -29,16 +29,18 @@ #define V8_TEST_CCTEST_TYPES_H_ #include "src/base/utils/random-number-generator.h" +#include "src/factory.h" +#include "src/isolate.h" #include "src/v8.h" namespace v8 { namespace internal { - +namespace compiler { class Types { public: Types(Zone* zone, Isolate* isolate, v8::base::RandomNumberGenerator* rng) - : zone_(zone), isolate_(isolate), rng_(rng) { + : zone_(zone), rng_(rng) { #define DECLARE_TYPE(name, value) \ name = Type::name(); \ types.push_back(name); @@ -50,22 +52,6 @@ class Types { object_map = isolate->factory()->NewMap( JS_OBJECT_TYPE, JSObject::kHeaderSize); - array_map = isolate->factory()->NewMap( - JS_ARRAY_TYPE, JSArray::kSize); - number_map = isolate->factory()->NewMap( - HEAP_NUMBER_TYPE, HeapNumber::kSize); - uninitialized_map = isolate->factory()->uninitialized_map(); - ObjectClass = Type::Class(object_map, zone); - ArrayClass = Type::Class(array_map, zone); - NumberClass = Type::Class(number_map, zone); - UninitializedClass = Type::Class(uninitialized_map, zone); - - maps.push_back(object_map); - maps.push_back(array_map); - maps.push_back(uninitialized_map); - for (MapVector::iterator it = maps.begin(); it != maps.end(); ++it) { - types.push_back(Type::Class(*it, zone)); - } smi = handle(Smi::FromInt(666), isolate); signed32 = isolate->factory()->NewHeapNumber(0x40000000); @@ -104,24 +90,12 @@ class Types { Integer = Type::Range(-V8_INFINITY, +V8_INFINITY, zone); - NumberArray = Type::Array(Number, zone); - StringArray = Type::Array(String, zone); - AnyArray = Type::Array(Any, zone); - - SignedFunction1 = Type::Function(SignedSmall, SignedSmall, zone); - NumberFunction1 = Type::Function(Number, Number, zone); - NumberFunction2 = Type::Function(Number, Number, Number, zone); - MethodFunction = Type::Function(String, Object, 0, zone); - for (int i = 0; i < 30; ++i) { types.push_back(Fuzz()); } } Handle<i::Map> object_map; - Handle<i::Map> array_map; - Handle<i::Map> number_map; - Handle<i::Map> uninitialized_map; Handle<i::Smi> smi; Handle<i::HeapNumber> signed32; @@ -134,17 +108,9 @@ class Types { PROPER_BITSET_TYPE_LIST(DECLARE_TYPE) #undef DECLARE_TYPE -#define DECLARE_TYPE(name, value) Type* Mask##name##ForTesting; - MASK_BITSET_TYPE_LIST(DECLARE_TYPE) -#undef DECLARE_TYPE Type* SignedSmall; Type* UnsignedSmall; - Type* ObjectClass; - Type* ArrayClass; - Type* NumberClass; - Type* UninitializedClass; - Type* SmiConstant; Type* Signed32Constant; Type* ObjectConstant1; @@ -154,62 +120,25 @@ class Types { Type* Integer; - Type* NumberArray; - Type* StringArray; - Type* AnyArray; - - Type* SignedFunction1; - Type* NumberFunction1; - Type* NumberFunction2; - Type* MethodFunction; - typedef std::vector<Type*> TypeVector; - typedef std::vector<Handle<i::Map> > MapVector; typedef std::vector<Handle<i::Object> > ValueVector; TypeVector types; - MapVector maps; ValueVector values; ValueVector integers; // "Integer" values used for range limits. Type* Of(Handle<i::Object> value) { return Type::Of(value, zone_); } - Type* NowOf(Handle<i::Object> value) { return Type::NowOf(value, zone_); } - - Type* Class(Handle<i::Map> map) { return Type::Class(map, zone_); } - Type* Constant(Handle<i::Object> value) { return Type::Constant(value, zone_); } Type* Range(double min, double max) { return Type::Range(min, max, zone_); } - Type* Context(Type* outer) { return Type::Context(outer, zone_); } - - Type* Array1(Type* element) { return Type::Array(element, zone_); } - - Type* Function0(Type* result, Type* receiver) { - return Type::Function(result, receiver, 0, zone_); - } - - Type* Function1(Type* result, Type* receiver, Type* arg) { - Type* type = Type::Function(result, receiver, 1, zone_); - type->AsFunction()->InitParameter(0, arg); - return type; - } - - Type* Function2(Type* result, Type* arg1, Type* arg2) { - return Type::Function(result, arg1, arg2, zone_); - } - Type* Union(Type* t1, Type* t2) { return Type::Union(t1, t2, zone_); } Type* Intersect(Type* t1, Type* t2) { return Type::Intersect(t1, t2, zone_); } - Type* Representation(Type* t) { return Type::Representation(t, zone_); } - - Type* Semantic(Type* t) { return Type::Semantic(t, zone_); } - Type* Random() { return types[rng_->NextInt(static_cast<int>(types.size()))]; } @@ -239,15 +168,11 @@ class Types { } return result; } - case 1: { // class - int i = rng_->NextInt(static_cast<int>(maps.size())); - return Type::Class(maps[i], zone_); - } - case 2: { // constant + case 1: { // constant int i = rng_->NextInt(static_cast<int>(values.size())); return Type::Constant(values[i], zone_); } - case 3: { // range + case 2: { // range int i = rng_->NextInt(static_cast<int>(integers.size())); int j = rng_->NextInt(static_cast<int>(integers.size())); double min = integers[i]->Number(); @@ -255,42 +180,6 @@ class Types { if (min > max) std::swap(min, max); return Type::Range(min, max, zone_); } - case 4: { // context - int depth = rng_->NextInt(3); - Type* type = Type::Internal(); - for (int i = 0; i < depth; ++i) type = Type::Context(type, zone_); - return type; - } - case 5: { // array - Type* element = Fuzz(depth / 2); - return Type::Array(element, zone_); - } - case 6: - case 7: { // function - Type* result = Fuzz(depth / 2); - Type* receiver = Fuzz(depth / 2); - int arity = rng_->NextInt(3); - Type* type = Type::Function(result, receiver, arity, zone_); - for (int i = 0; i < type->AsFunction()->Arity(); ++i) { - Type* parameter = Fuzz(depth / 2); - type->AsFunction()->InitParameter(i, parameter); - } - return type; - } - case 8: { // simd - static const int num_simd_types = - #define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) +1 - SIMD128_TYPES(COUNT_SIMD_TYPE); - #undef COUNT_SIMD_TYPE - Type* (*simd_constructors[num_simd_types])(Isolate*, Zone*) = { - #define COUNT_SIMD_TYPE(NAME, Name, name, lane_count, lane_type) \ - &Type::Name, - SIMD128_TYPES(COUNT_SIMD_TYPE) - #undef COUNT_SIMD_TYPE - }; - return simd_constructors[rng_->NextInt(num_simd_types)](isolate_, - zone_); - } default: { // union int n = rng_->NextInt(10); Type* type = None; @@ -308,11 +197,10 @@ class Types { private: Zone* zone_; - Isolate* isolate_; v8::base::RandomNumberGenerator* rng_; }; - +} // namespace compiler } // 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 a978bdf1f7..3d8d484295 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc @@ -11,8 +11,8 @@ #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" -#include "test/cctest/wasm/test-signatures.h" #include "test/cctest/wasm/wasm-run-utils.h" +#include "test/common/wasm/test-signatures.h" // If the target architecture is 64-bit, enable all tests. #if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64 @@ -32,7 +32,6 @@ #define asu64(x) static_cast<uint64_t>(x) #define B2(a, b) kExprBlock, a, b, kExprEnd -#define B1(a) kExprBlock, a, kExprEnd // Can't bridge macro land with nested macros. #if V8_TARGET_ARCH_MIPS @@ -835,8 +834,8 @@ WASM_EXEC_TEST(CallI64Parameter) { WasmRunner<int32_t> r(&module); BUILD( r, - WASM_I32_CONVERT_I64(WASM_CALL_FUNCTIONN( - 19, index, WASM_I64V_9(0xbcd12340000000b), + WASM_I32_CONVERT_I64(WASM_CALL_FUNCTION( + index, WASM_I64V_9(0xbcd12340000000b), WASM_I64V_9(0xbcd12340000000c), WASM_I32V_1(0xd), WASM_I32_CONVERT_I64(WASM_I64V_9(0xbcd12340000000e)), WASM_I64V_9(0xbcd12340000000f), WASM_I64V_10(0xbcd1234000000010), @@ -1119,7 +1118,7 @@ WASM_EXEC_TEST(Call_Int64Sub) { // Build the caller function. WasmRunner<int64_t> r(&module, MachineType::Int64(), MachineType::Int64()); - BUILD(r, WASM_CALL_FUNCTION2(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + BUILD(r, WASM_CALL_FUNCTION(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(j) { @@ -1154,7 +1153,11 @@ WASM_EXEC_TEST(LoadStoreI64_sx) { ZERO_OFFSET, // -- kExprI64StoreMem, // -- ZERO_ALIGNMENT, // -- - ZERO_OFFSET // -- + ZERO_OFFSET, // -- + kExprI8Const, 0, // -- + loads[m], // -- + ZERO_ALIGNMENT, // -- + ZERO_OFFSET, // -- }; r.Build(code, code + arraysize(code)); @@ -1256,10 +1259,9 @@ WASM_EXEC_TEST(F64ReinterpretI64) { int64_t* memory = module.AddMemoryElems<int64_t>(8); WasmRunner<int64_t> r(&module, MachineType::Int64()); - BUILD(r, - WASM_BLOCK(WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO, - WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))), - WASM_GET_LOCAL(0))); + BUILD(r, WASM_STORE_MEM(MachineType::Float64(), WASM_ZERO, + WASM_F64_REINTERPRET_I64(WASM_GET_LOCAL(0))), + WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { int64_t expected = static_cast<int64_t>(*i) * 0x300010001; @@ -1320,18 +1322,17 @@ WASM_EXEC_TEST(MemI64_Sum) { WasmRunner<uint64_t> r(&module, MachineType::Int32()); const byte kSum = r.AllocateLocal(kAstI64); - BUILD(r, - WASM_BLOCK( - WASM_WHILE( - WASM_GET_LOCAL(0), - WASM_BLOCK( - WASM_SET_LOCAL( - kSum, WASM_I64_ADD(WASM_GET_LOCAL(kSum), - WASM_LOAD_MEM(MachineType::Int64(), - WASM_GET_LOCAL(0)))), - WASM_SET_LOCAL( - 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(8))))), - WASM_GET_LOCAL(1))); + BUILD( + r, + WASM_WHILE( + WASM_GET_LOCAL(0), + WASM_BLOCK( + WASM_SET_LOCAL(kSum, + WASM_I64_ADD(WASM_GET_LOCAL(kSum), + WASM_LOAD_MEM(MachineType::Int64(), + WASM_GET_LOCAL(0)))), + WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(8))))), + WASM_GET_LOCAL(1)); // Run 4 trials. for (int i = 0; i < 3; i++) { @@ -1353,7 +1354,8 @@ WASM_EXEC_TEST(StoreMemI64_alignment) { for (byte i = 0; i <= 3; i++) { WasmRunner<int64_t> r(&module, MachineType::Int64()); BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int64(), WASM_ZERO, i, - WASM_GET_LOCAL(0))); + WASM_GET_LOCAL(0)), + WASM_GET_LOCAL(0)); module.RandomizeMemory(1111); module.WriteMemory<int64_t>(&memory[0], 0); @@ -1371,10 +1373,10 @@ WASM_EXEC_TEST(I64Global) { int64_t* global = module.AddGlobal<int64_t>(kAstI64); WasmRunner<int32_t> r(&module, MachineType::Int32()); // global = global + p0 - BUILD(r, B2(WASM_SET_GLOBAL( - 0, WASM_I64_AND(WASM_GET_GLOBAL(0), - WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)))), - WASM_ZERO)); + BUILD(r, WASM_SET_GLOBAL( + 0, WASM_I64_AND(WASM_GET_GLOBAL(0), + WASM_I64_SCONVERT_I32(WASM_GET_LOCAL(0)))), + WASM_ZERO); module.WriteMemory<int64_t>(global, 0xFFFFFFFFFFFFFFFFLL); for (int i = 9; i < 444444; i += 111111) { @@ -1464,7 +1466,7 @@ static void CompileCallIndirectMany(LocalType param) { // with many many parameters. TestSignatures sigs; for (byte num_params = 0; num_params < 40; num_params++) { - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); HandleScope scope(CcTest::InitIsolateOnce()); TestingModule module(kExecuteCompiled); @@ -1477,11 +1479,11 @@ static void CompileCallIndirectMany(LocalType param) { WasmFunctionCompiler t(sig, &module); std::vector<byte> code; - ADD_CODE(code, kExprI8Const, 0); for (byte p = 0; p < num_params; p++) { ADD_CODE(code, kExprGetLocal, p); } - ADD_CODE(code, kExprCallIndirect, static_cast<byte>(num_params), 1); + ADD_CODE(code, kExprI8Const, 0); + ADD_CODE(code, kExprCallIndirect, 1); t.Build(&code[0], &code[0] + code.size()); t.Compile(); @@ -1504,7 +1506,7 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { int num_params = static_cast<int>(arraysize(mixed)) - start; for (int which = 0; which < num_params; which++) { - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); TestingModule module(execution_mode); module.AddMemory(1024); @@ -1540,8 +1542,7 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { } // Call the selector function. - ADD_CODE(code, kExprCallFunction, static_cast<byte>(num_params), - static_cast<byte>(index)); + ADD_CODE(code, kExprCallFunction, static_cast<byte>(index)); // Store the result in memory. ADD_CODE(code, 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 4d39dd6ff7..007fc7a864 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc @@ -12,8 +12,8 @@ #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" -#include "test/cctest/wasm/test-signatures.h" #include "test/cctest/wasm/wasm-run-utils.h" +#include "test/common/wasm/test-signatures.h" using namespace v8::base; using namespace v8::internal; @@ -38,8 +38,9 @@ uint32_t GetMatchingRelocInfoCount(Handle<Code> code, RelocInfo::Mode rmode) { } WASM_EXEC_TEST(Int32AsmjsDivS) { - WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), - MachineType::Int32()); + TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; + WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); BUILD(r, WASM_BINOP(kExprI32AsmjsDivS, 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)); @@ -50,8 +51,9 @@ WASM_EXEC_TEST(Int32AsmjsDivS) { } WASM_EXEC_TEST(Int32AsmjsRemS) { - WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), - MachineType::Int32()); + TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; + WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); BUILD(r, WASM_BINOP(kExprI32AsmjsRemS, 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)); @@ -62,8 +64,9 @@ WASM_EXEC_TEST(Int32AsmjsRemS) { } WASM_EXEC_TEST(Int32AsmjsDivU) { - WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), - MachineType::Int32()); + TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; + WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); BUILD(r, WASM_BINOP(kExprI32AsmjsDivU, 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)); @@ -74,8 +77,9 @@ WASM_EXEC_TEST(Int32AsmjsDivU) { } WASM_EXEC_TEST(Int32AsmjsRemU) { - WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), - MachineType::Int32()); + TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; + WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); BUILD(r, WASM_BINOP(kExprI32AsmjsRemU, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); const int32_t kMin = std::numeric_limits<int32_t>::min(); CHECK_EQ(17, r.Call(217, 100)); @@ -86,7 +90,9 @@ WASM_EXEC_TEST(Int32AsmjsRemU) { } WASM_EXEC_TEST(I32AsmjsSConvertF32) { - WasmRunner<int32_t> r(execution_mode, MachineType::Float32()); + TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; + WasmRunner<int32_t> r(&module, MachineType::Float32()); BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF32, WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { @@ -96,7 +102,9 @@ WASM_EXEC_TEST(I32AsmjsSConvertF32) { } WASM_EXEC_TEST(I32AsmjsSConvertF64) { - WasmRunner<int32_t> r(execution_mode, MachineType::Float64()); + TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; + WasmRunner<int32_t> r(&module, MachineType::Float64()); BUILD(r, WASM_UNOP(kExprI32AsmjsSConvertF64, WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { @@ -106,7 +114,9 @@ WASM_EXEC_TEST(I32AsmjsSConvertF64) { } WASM_EXEC_TEST(I32AsmjsUConvertF32) { - WasmRunner<uint32_t> r(execution_mode, MachineType::Float32()); + TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; + WasmRunner<uint32_t> r(&module, MachineType::Float32()); BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF32, WASM_GET_LOCAL(0))); FOR_FLOAT32_INPUTS(i) { @@ -116,7 +126,9 @@ WASM_EXEC_TEST(I32AsmjsUConvertF32) { } WASM_EXEC_TEST(I32AsmjsUConvertF64) { - WasmRunner<uint32_t> r(execution_mode, MachineType::Float64()); + TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; + WasmRunner<uint32_t> r(&module, MachineType::Float64()); BUILD(r, WASM_UNOP(kExprI32AsmjsUConvertF64, WASM_GET_LOCAL(0))); FOR_FLOAT64_INPUTS(i) { @@ -127,6 +139,7 @@ WASM_EXEC_TEST(I32AsmjsUConvertF64) { WASM_EXEC_TEST(LoadMemI32_oob_asm) { TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; int32_t* memory = module.AddMemoryElems<int32_t>(8); WasmRunner<int32_t> r(&module, MachineType::Uint32()); module.RandomizeMemory(1112); @@ -147,6 +160,7 @@ WASM_EXEC_TEST(LoadMemI32_oob_asm) { WASM_EXEC_TEST(LoadMemF32_oob_asm) { TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; float* memory = module.AddMemoryElems<float>(8); WasmRunner<float> r(&module, MachineType::Uint32()); module.RandomizeMemory(1112); @@ -167,6 +181,7 @@ WASM_EXEC_TEST(LoadMemF32_oob_asm) { WASM_EXEC_TEST(LoadMemF64_oob_asm) { TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; double* memory = module.AddMemoryElems<double>(8); WasmRunner<double> r(&module, MachineType::Uint32()); module.RandomizeMemory(1112); @@ -189,6 +204,7 @@ WASM_EXEC_TEST(LoadMemF64_oob_asm) { WASM_EXEC_TEST(StoreMemI32_oob_asm) { TestingModule module(execution_mode); + module.origin = kAsmJsOrigin; int32_t* memory = module.AddMemoryElems<int32_t>(8); WasmRunner<int32_t> r(&module, MachineType::Uint32(), MachineType::Uint32()); module.RandomizeMemory(1112); @@ -224,6 +240,7 @@ WASM_EXEC_TEST(StoreMemI32_oob_asm) { #define INT_LOAD_TEST(OP_TYPE) \ TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ TestingModule module(kExecuteCompiled); \ + module.origin = kAsmJsOrigin; \ WasmRunner<int32_t> r(&module, MachineType::Uint32()); \ BUILD(r, WASM_UNOP(OP_TYPE, WASM_GET_LOCAL(0))); \ CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \ @@ -238,6 +255,7 @@ FOREACH_INT_CHECKED_LOAD_OP(INT_LOAD_TEST) #define INT_STORE_TEST(OP_TYPE) \ TEST(RunWasm_AsmCheckedRelocInfo##OP_TYPE) { \ TestingModule module(kExecuteCompiled); \ + module.origin = kAsmJsOrigin; \ WasmRunner<int32_t> r(&module, MachineType::Uint32(), \ MachineType::Uint32()); \ BUILD(r, WASM_BINOP(OP_TYPE, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); \ @@ -252,6 +270,7 @@ FOREACH_INT_CHECKED_STORE_OP(INT_STORE_TEST) TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) { TestingModule module(kExecuteCompiled); + module.origin = kAsmJsOrigin; WasmRunner<float> r(&module, MachineType::Uint32()); BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); @@ -263,6 +282,7 @@ TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) { TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) { TestingModule module(kExecuteCompiled); + module.origin = kAsmJsOrigin; WasmRunner<float> r(&module, MachineType::Uint32(), MachineType::Float32()); BUILD(r, WASM_BINOP(kExprF32AsmjsStoreMem, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); @@ -275,6 +295,7 @@ TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) { TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) { TestingModule module(kExecuteCompiled); + module.origin = kAsmJsOrigin; WasmRunner<double> r(&module, MachineType::Uint32()); BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); @@ -286,6 +307,7 @@ TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) { TEST(RunWasm_AsmCheckedStoreFloat64RelocInfo) { TestingModule module(kExecuteCompiled); + module.origin = kAsmJsOrigin; WasmRunner<double> r(&module, MachineType::Uint32(), MachineType::Float64()); BUILD(r, WASM_BINOP(kExprF64AsmjsStoreMem, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); 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 c4e03b50d6..0489d016d7 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc @@ -14,8 +14,8 @@ #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" -#include "test/cctest/wasm/test-signatures.h" #include "test/cctest/wasm/wasm-run-utils.h" +#include "test/common/wasm/test-signatures.h" using namespace v8::base; using namespace v8::internal; @@ -36,7 +36,7 @@ TEST(Run_WasmInt8Const_i) { TEST(Run_WasmIfElse) { WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Int32()); - BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_I8(9), WASM_I8(10))); + BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I8(9), WASM_I8(10))); CHECK_EQ(10, r.Call(0)); CHECK_EQ(9, r.Call(1)); } @@ -65,31 +65,39 @@ TEST(Run_WasmNopsN) { TEST(Run_WasmConstsN) { const int kMaxConsts = 10; - byte code[kMaxConsts * 2]; + byte code[kMaxConsts * 3]; + int32_t expected = 0; for (int count = 1; count < kMaxConsts; count++) { for (int i = 0; i < count; i++) { - code[i * 2] = kExprI8Const; - code[i * 2 + 1] = static_cast<byte>(count * 10 + i); + byte val = static_cast<byte>(count * 10 + i); + code[i * 3] = kExprI8Const; + code[i * 3 + 1] = val; + if (i == (count - 1)) { + code[i * 3 + 2] = kExprNop; + expected = val; + } else { + code[i * 3 + 2] = kExprDrop; + } } - byte expected = static_cast<byte>(count * 11 - 1); WasmRunner<int32_t> r(kExecuteInterpreted); - r.Build(code, code + (count * 2)); + r.Build(code, code + (count * 3)); CHECK_EQ(expected, r.Call()); } } TEST(Run_WasmBlocksN) { const int kMaxNops = 10; - const int kExtra = 4; + const int kExtra = 5; byte code[kMaxNops + kExtra]; for (int nops = 0; nops < kMaxNops; nops++) { byte expected = static_cast<byte>(30 + nops); memset(code, kExprNop, sizeof(code)); code[0] = kExprBlock; - code[1 + nops] = kExprI8Const; - code[1 + nops + 1] = expected; - code[1 + nops + 2] = kExprEnd; + code[1] = kLocalI32; + code[2 + nops] = kExprI8Const; + code[2 + nops + 1] = expected; + code[2 + nops + 2] = kExprEnd; WasmRunner<int32_t> r(kExecuteInterpreted); r.Build(code, code + nops + kExtra); @@ -106,14 +114,14 @@ TEST(Run_WasmBlockBreakN) { for (int index = 0; index < nops; index++) { memset(code, kExprNop, sizeof(code)); code[0] = kExprBlock; + code[1] = kLocalI32; code[sizeof(code) - 1] = kExprEnd; int expected = nops * 11 + index; - code[1 + index + 0] = kExprI8Const; - code[1 + index + 1] = static_cast<byte>(expected); - code[1 + index + 2] = kExprBr; - code[1 + index + 3] = ARITY_1; - code[1 + index + 4] = 0; + code[2 + index + 0] = kExprI8Const; + code[2 + index + 1] = static_cast<byte>(expected); + code[2 + index + 2] = kExprBr; + code[2 + index + 3] = 0; WasmRunner<int32_t> r(kExecuteInterpreted); r.Build(code, code + kMaxNops + kExtra); @@ -126,10 +134,10 @@ TEST(Run_Wasm_nested_ifs_i) { WasmRunner<int32_t> r(kExecuteInterpreted, MachineType::Int32(), MachineType::Int32()); - BUILD(r, WASM_IF_ELSE( + BUILD(r, WASM_IF_ELSE_I( WASM_GET_LOCAL(0), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(11), WASM_I8(12)), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(13), WASM_I8(14)))); + WASM_IF_ELSE_I(WASM_GET_LOCAL(1), WASM_I8(11), WASM_I8(12)), + WASM_IF_ELSE_I(WASM_GET_LOCAL(1), WASM_I8(13), WASM_I8(14)))); CHECK_EQ(11, r.Call(1, 1)); CHECK_EQ(12, r.Call(1, 0)); @@ -286,6 +294,45 @@ TEST(Breakpoint_I32And_disable) { } } +TEST(GrowMemory) { + TestingModule module(kExecuteInterpreted); + WasmRunner<int32_t> r(&module, MachineType::Uint32()); + module.AddMemory(WasmModule::kPageSize); + BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0))); + CHECK_EQ(1, r.Call(1)); +} + +TEST(GrowMemoryPreservesData) { + int32_t index = 16; + int32_t value = 2335; + TestingModule module(kExecuteInterpreted); + WasmRunner<int32_t> r(&module, MachineType::Uint32()); + module.AddMemory(WasmModule::kPageSize); + BUILD(r, WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index), + WASM_I32V(value)), + WASM_GROW_MEMORY(WASM_GET_LOCAL(0)), WASM_DROP, + WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V(index))); + CHECK_EQ(value, r.Call(1)); +} + +TEST(GrowMemoryInvalidSize) { + { + // Grow memory by an invalid amount without initial memory. + TestingModule module(kExecuteInterpreted); + WasmRunner<int32_t> r(&module, MachineType::Uint32()); + BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0))); + CHECK_EQ(-1, r.Call(1048575)); + } + { + // Grow memory by an invalid amount without initial memory. + TestingModule module(kExecuteInterpreted); + WasmRunner<int32_t> r(&module, MachineType::Uint32()); + module.AddMemory(WasmModule::kPageSize); + BUILD(r, WASM_GROW_MEMORY(WASM_GET_LOCAL(0))); + CHECK_EQ(-1, r.Call(1048575)); + } +} + } // namespace wasm } // namespace internal } // namespace v8 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 9dfba74ecc..c0307e0511 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-js.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-js.cc @@ -11,8 +11,8 @@ #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" -#include "test/cctest/wasm/test-signatures.h" #include "test/cctest/wasm/wasm-run-utils.h" +#include "test/common/wasm/test-signatures.h" using namespace v8::base; using namespace v8::internal; @@ -152,7 +152,7 @@ TEST(Run_CallJS_Add_jswrapped) { WasmFunctionCompiler t(sigs.i_i(), &module); uint32_t js_index = module.AddJsFunction(sigs.i_i(), "(function(a) { return a + 99; })"); - BUILD(t, WASM_CALL_FUNCTION1(js_index, WASM_GET_LOCAL(0))); + BUILD(t, WASM_CALL_FUNCTION(js_index, WASM_GET_LOCAL(0))); Handle<JSFunction> jsfunc = module.WrapCode(t.CompileAndAdd()); @@ -182,8 +182,7 @@ void RunJSSelectTest(int which) { ADD_CODE(code, WASM_F64(inputs.arg_d(i))); } - ADD_CODE(code, kExprCallFunction, static_cast<byte>(num_params), - static_cast<byte>(js_index)); + ADD_CODE(code, kExprCallFunction, static_cast<byte>(js_index)); size_t end = code.size(); code.push_back(0); @@ -420,7 +419,7 @@ void RunJSSelectAlignTest(int num_args, int num_params) { ADD_CODE(code, WASM_GET_LOCAL(i)); } - ADD_CODE(code, kExprCallFunction, static_cast<byte>(num_params), 0); + ADD_CODE(code, kExprCallFunction, 0); size_t end = code.size(); code.push_back(0); 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 8449a52ff3..b358208bc3 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc @@ -5,15 +5,15 @@ #include <stdlib.h> #include <string.h> -#include "src/wasm/encoder.h" #include "src/wasm/module-decoder.h" -#include "src/wasm/wasm-js.h" #include "src/wasm/wasm-macro-gen.h" +#include "src/wasm/wasm-module-builder.h" #include "src/wasm/wasm-module.h" #include "src/wasm/wasm-opcodes.h" #include "test/cctest/cctest.h" -#include "test/cctest/wasm/test-signatures.h" +#include "test/common/wasm/test-signatures.h" +#include "test/common/wasm/wasm-module-runner.h" using namespace v8::base; using namespace v8::internal; @@ -28,12 +28,26 @@ void TestModule(Zone* zone, WasmModuleBuilder* builder, Isolate* isolate = CcTest::InitIsolateOnce(); HandleScope scope(isolate); - WasmJs::InstallWasmFunctionMap(isolate, isolate->native_context()); - int32_t result = - testing::CompileAndRunWasmModule(isolate, buffer.begin(), buffer.end()); + testing::SetupIsolateForWasmModule(isolate); + int32_t result = testing::CompileAndRunWasmModule( + isolate, buffer.begin(), buffer.end(), ModuleOrigin::kWasmOrigin); CHECK_EQ(expected_result, result); } +void TestModuleException(Zone* zone, WasmModuleBuilder* builder) { + ZoneBuffer buffer(zone); + builder->WriteTo(buffer); + + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + testing::SetupIsolateForWasmModule(isolate); + v8::TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); + testing::CompileAndRunWasmModule(isolate, buffer.begin(), buffer.end(), + ModuleOrigin::kWasmOrigin); + CHECK(try_catch.HasCaught()); + isolate->clear_pending_exception(); +} + void ExportAs(WasmFunctionBuilder* f, const char* name) { f->SetExported(); f->SetName(name, static_cast<int>(strlen(name))); @@ -49,13 +63,11 @@ void ExportAsMain(WasmFunctionBuilder* f) { TEST(Run_WasmModule_Return114) { static const int32_t kReturnValue = 114; TestSignatures sigs; - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - uint16_t f_index = builder->AddFunction(); - WasmFunctionBuilder* f = builder->FunctionAt(f_index); - f->SetSignature(sigs.i_v()); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); ExportAsMain(f); byte code[] = {WASM_I8(kReturnValue)}; f->EmitCode(code, sizeof(code)); @@ -63,136 +75,119 @@ TEST(Run_WasmModule_Return114) { } TEST(Run_WasmModule_CallAdd) { - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); TestSignatures sigs; WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - uint16_t f1_index = builder->AddFunction(); - WasmFunctionBuilder* f = builder->FunctionAt(f1_index); - f->SetSignature(sigs.i_ii()); + WasmFunctionBuilder* f1 = builder->AddFunction(sigs.i_ii()); uint16_t param1 = 0; uint16_t param2 = 1; byte code1[] = {WASM_I32_ADD(WASM_GET_LOCAL(param1), WASM_GET_LOCAL(param2))}; - f->EmitCode(code1, sizeof(code1)); + f1->EmitCode(code1, sizeof(code1)); - uint16_t f2_index = builder->AddFunction(); - f = builder->FunctionAt(f2_index); - f->SetSignature(sigs.i_v()); + WasmFunctionBuilder* f2 = builder->AddFunction(sigs.i_v()); - ExportAsMain(f); - byte code2[] = {WASM_CALL_FUNCTION2(f1_index, WASM_I8(77), WASM_I8(22))}; - f->EmitCode(code2, sizeof(code2)); + ExportAsMain(f2); + byte code2[] = { + WASM_CALL_FUNCTION(f1->func_index(), WASM_I8(77), WASM_I8(22))}; + f2->EmitCode(code2, sizeof(code2)); TestModule(&zone, builder, 99); } TEST(Run_WasmModule_ReadLoadedDataSegment) { static const byte kDataSegmentDest0 = 12; - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); TestSignatures sigs; WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - uint16_t f_index = builder->AddFunction(); - WasmFunctionBuilder* f = builder->FunctionAt(f_index); - f->SetSignature(sigs.i_v()); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); ExportAsMain(f); byte code[] = { WASM_LOAD_MEM(MachineType::Int32(), WASM_I8(kDataSegmentDest0))}; f->EmitCode(code, sizeof(code)); byte data[] = {0xaa, 0xbb, 0xcc, 0xdd}; - builder->AddDataSegment(new (&zone) WasmDataSegmentEncoder( - &zone, data, sizeof(data), kDataSegmentDest0)); + builder->AddDataSegment(data, sizeof(data), kDataSegmentDest0); TestModule(&zone, builder, 0xddccbbaa); } TEST(Run_WasmModule_CheckMemoryIsZero) { static const int kCheckSize = 16 * 1024; - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); TestSignatures sigs; WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - uint16_t f_index = builder->AddFunction(); - WasmFunctionBuilder* f = builder->FunctionAt(f_index); - f->SetSignature(sigs.i_v()); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); uint16_t localIndex = f->AddLocal(kAstI32); ExportAsMain(f); - byte code[] = {WASM_BLOCK( + byte code[] = {WASM_BLOCK_I( WASM_WHILE( WASM_I32_LTS(WASM_GET_LOCAL(localIndex), WASM_I32V_3(kCheckSize)), WASM_IF_ELSE( WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(localIndex)), - WASM_BRV(2, WASM_I8(-1)), WASM_INC_LOCAL_BY(localIndex, 4))), + WASM_BRV(3, WASM_I8(-1)), WASM_INC_LOCAL_BY(localIndex, 4))), WASM_I8(11))}; f->EmitCode(code, sizeof(code)); TestModule(&zone, builder, 11); } TEST(Run_WasmModule_CallMain_recursive) { - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); TestSignatures sigs; WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - uint16_t f_index = builder->AddFunction(); - WasmFunctionBuilder* f = builder->FunctionAt(f_index); - f->SetSignature(sigs.i_v()); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); uint16_t localIndex = f->AddLocal(kAstI32); ExportAsMain(f); - byte code[] = {WASM_BLOCK( + byte code[] = { WASM_SET_LOCAL(localIndex, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), - WASM_IF_ELSE(WASM_I32_LTS(WASM_GET_LOCAL(localIndex), WASM_I8(5)), - WASM_BLOCK(WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, + WASM_IF_ELSE_I(WASM_I32_LTS(WASM_GET_LOCAL(localIndex), WASM_I8(5)), + WASM_SEQ(WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, WASM_INC_LOCAL(localIndex)), - WASM_BRV(1, WASM_CALL_FUNCTION0(0))), - WASM_BRV(0, WASM_I8(55))))}; + WASM_CALL_FUNCTION0(0)), + WASM_I8(55))}; f->EmitCode(code, sizeof(code)); TestModule(&zone, builder, 55); } TEST(Run_WasmModule_Global) { - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); TestSignatures sigs; WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); uint32_t global1 = builder->AddGlobal(kAstI32, 0); uint32_t global2 = builder->AddGlobal(kAstI32, 0); - uint16_t f1_index = builder->AddFunction(); - WasmFunctionBuilder* f = builder->FunctionAt(f1_index); - f->SetSignature(sigs.i_v()); + WasmFunctionBuilder* f1 = builder->AddFunction(sigs.i_v()); byte code1[] = { WASM_I32_ADD(WASM_GET_GLOBAL(global1), WASM_GET_GLOBAL(global2))}; - f->EmitCode(code1, sizeof(code1)); - uint16_t f2_index = builder->AddFunction(); - f = builder->FunctionAt(f2_index); - f->SetSignature(sigs.i_v()); - ExportAsMain(f); + f1->EmitCode(code1, sizeof(code1)); + WasmFunctionBuilder* f2 = builder->AddFunction(sigs.i_v()); + ExportAsMain(f2); byte code2[] = {WASM_SET_GLOBAL(global1, WASM_I32V_1(56)), WASM_SET_GLOBAL(global2, WASM_I32V_1(41)), - WASM_RETURN1(WASM_CALL_FUNCTION0(f1_index))}; - f->EmitCode(code2, sizeof(code2)); + WASM_RETURN1(WASM_CALL_FUNCTION0(f1->func_index()))}; + f2->EmitCode(code2, sizeof(code2)); TestModule(&zone, builder, 97); } TEST(Run_WasmModule_Serialization) { - FLAG_expose_wasm = true; static const char* kFunctionName = "increment"; - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - uint16_t f_index = builder->AddFunction(); TestSignatures sigs; - WasmFunctionBuilder* f = builder->FunctionAt(f_index); - f->SetSignature(sigs.i_i()); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i()); byte code[] = {WASM_GET_LOCAL(0), kExprI32Const, 1, kExprI32Add}; f->EmitCode(code, sizeof(code)); ExportAs(f, kFunctionName); @@ -202,10 +197,10 @@ TEST(Run_WasmModule_Serialization) { Isolate* isolate = CcTest::InitIsolateOnce(); ErrorThrower thrower(isolate, ""); - v8::WasmCompiledModule::SerializedModule data; { HandleScope scope(isolate); + testing::SetupIsolateForWasmModule(isolate); ModuleResult decoding_result = DecodeWasmModule( isolate, &zone, buffer.begin(), buffer.end(), false, kWasmOrigin); @@ -215,8 +210,8 @@ TEST(Run_WasmModule_Serialization) { MaybeHandle<FixedArray> compiled_module = module->CompileFunctions(isolate, &thrower); CHECK(!compiled_module.is_null()); - Handle<JSObject> module_obj = - CreateCompiledModuleObject(isolate, compiled_module.ToHandleChecked()); + Handle<JSObject> module_obj = CreateCompiledModuleObject( + isolate, compiled_module.ToHandleChecked(), ModuleOrigin::kWasmOrigin); v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj); CHECK(v8_module_obj->IsWebAssemblyCompiledModule()); @@ -226,15 +221,17 @@ TEST(Run_WasmModule_Serialization) { } v8::Isolate::CreateParams create_params; - create_params.array_buffer_allocator = isolate->array_buffer_allocator(); + create_params.array_buffer_allocator = + CcTest::InitIsolateOnce()->array_buffer_allocator(); v8::Isolate* v8_isolate = v8::Isolate::New(create_params); - isolate = reinterpret_cast<Isolate*>(v8_isolate); { v8::Isolate::Scope isolate_scope(v8_isolate); v8::HandleScope new_scope(v8_isolate); v8::Local<v8::Context> new_ctx = v8::Context::New(v8_isolate); new_ctx->Enter(); + isolate = reinterpret_cast<Isolate*>(v8_isolate); + testing::SetupIsolateForWasmModule(isolate); v8::MaybeLocal<v8::WasmCompiledModule> deserialized = v8::WasmCompiledModule::Deserialize(v8_isolate, data); @@ -242,17 +239,178 @@ TEST(Run_WasmModule_Serialization) { CHECK(deserialized.ToLocal(&compiled_module)); Handle<JSObject> module_object = Handle<JSObject>::cast(v8::Utils::OpenHandle(*compiled_module)); - Handle<FixedArray> compiled_part = - handle(FixedArray::cast(module_object->GetInternalField(0))); Handle<JSObject> instance = - WasmModule::Instantiate(isolate, compiled_part, + WasmModule::Instantiate(isolate, &thrower, module_object, Handle<JSReceiver>::null(), Handle<JSArrayBuffer>::null()) .ToHandleChecked(); Handle<Object> params[1] = {Handle<Object>(Smi::FromInt(41), isolate)}; - int32_t result = testing::CallFunction(isolate, instance, &thrower, - kFunctionName, 1, params); + int32_t result = testing::CallWasmFunctionForTesting( + isolate, instance, &thrower, kFunctionName, 1, params, + ModuleOrigin::kWasmOrigin); CHECK(result == 42); new_ctx->Exit(); } } + +TEST(MemorySize) { + // Initial memory size is 16, see wasm-module-builder.cc + static const int kExpectedValue = 16; + TestSignatures sigs; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator); + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); + ExportAsMain(f); + byte code[] = {WASM_MEMORY_SIZE}; + f->EmitCode(code, sizeof(code)); + TestModule(&zone, builder, kExpectedValue); +} + +TEST(Run_WasmModule_MemSize_GrowMem) { + // Initial memory size = 16 + GrowMemory(10) + static const int kExpectedValue = 26; + TestSignatures sigs; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator); + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); + ExportAsMain(f); + byte code[] = {WASM_GROW_MEMORY(WASM_I8(10)), WASM_DROP, WASM_MEMORY_SIZE}; + f->EmitCode(code, sizeof(code)); + TestModule(&zone, builder, kExpectedValue); +} + +TEST(Run_WasmModule_GrowMemoryInIf) { + TestSignatures sigs; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator); + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); + ExportAsMain(f); + byte code[] = {WASM_IF_ELSE_I(WASM_I32V(0), WASM_GROW_MEMORY(WASM_I32V(1)), + WASM_I32V(12))}; + f->EmitCode(code, sizeof(code)); + TestModule(&zone, builder, 12); +} + +TEST(Run_WasmModule_GrowMemOobOffset) { + static const int kPageSize = 0x10000; + // Initial memory size = 16 + GrowMemory(10) + static const int index = kPageSize * 17 + 4; + int value = 0xaced; + TestSignatures sigs; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator); + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); + ExportAsMain(f); + byte code[] = { + WASM_GROW_MEMORY(WASM_I8(1)), + WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index), WASM_I32V(value))}; + f->EmitCode(code, sizeof(code)); + TestModuleException(&zone, builder); +} + +TEST(Run_WasmModule_GrowMemOobFixedIndex) { + static const int kPageSize = 0x10000; + // Initial memory size = 16 + GrowMemory(10) + static const int index = kPageSize * 26 + 4; + int value = 0xaced; + TestSignatures sigs; + Isolate* isolate = CcTest::InitIsolateOnce(); + Zone zone(isolate->allocator()); + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i()); + ExportAsMain(f); + byte code[] = { + WASM_GROW_MEMORY(WASM_GET_LOCAL(0)), WASM_DROP, + WASM_STORE_MEM(MachineType::Int32(), WASM_I32V(index), WASM_I32V(value)), + WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V(index))}; + f->EmitCode(code, sizeof(code)); + + HandleScope scope(isolate); + ZoneBuffer buffer(&zone); + builder->WriteTo(buffer); + testing::SetupIsolateForWasmModule(isolate); + + Handle<JSObject> instance = testing::CompileInstantiateWasmModuleForTesting( + isolate, &zone, buffer.begin(), buffer.end(), ModuleOrigin::kWasmOrigin); + CHECK(!instance.is_null()); + + // Initial memory size is 16 pages, should trap till index > MemSize on + // consecutive GrowMem calls + for (uint32_t i = 1; i < 5; i++) { + Handle<Object> params[1] = {Handle<Object>(Smi::FromInt(i), isolate)}; + v8::TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); + testing::RunWasmModuleForTesting(isolate, instance, 1, params, + ModuleOrigin::kWasmOrigin); + CHECK(try_catch.HasCaught()); + isolate->clear_pending_exception(); + } + + Handle<Object> params[1] = {Handle<Object>(Smi::FromInt(1), isolate)}; + int32_t result = testing::RunWasmModuleForTesting( + isolate, instance, 1, params, ModuleOrigin::kWasmOrigin); + CHECK(result == 0xaced); +} + +TEST(Run_WasmModule_GrowMemOobVariableIndex) { + static const int kPageSize = 0x10000; + int value = 0xaced; + TestSignatures sigs; + Isolate* isolate = CcTest::InitIsolateOnce(); + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator); + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i()); + ExportAsMain(f); + byte code[] = { + WASM_GROW_MEMORY(WASM_I8(1)), WASM_DROP, + WASM_STORE_MEM(MachineType::Int32(), WASM_GET_LOCAL(0), WASM_I32V(value)), + WASM_LOAD_MEM(MachineType::Int32(), WASM_GET_LOCAL(0))}; + f->EmitCode(code, sizeof(code)); + + HandleScope scope(isolate); + ZoneBuffer buffer(&zone); + builder->WriteTo(buffer); + testing::SetupIsolateForWasmModule(isolate); + + Handle<JSObject> instance = testing::CompileInstantiateWasmModuleForTesting( + isolate, &zone, buffer.begin(), buffer.end(), ModuleOrigin::kWasmOrigin); + + CHECK(!instance.is_null()); + + // Initial memory size is 16 pages, should trap till index > MemSize on + // consecutive GrowMem calls + for (int i = 1; i < 5; i++) { + Handle<Object> params[1] = { + Handle<Object>(Smi::FromInt((16 + i) * kPageSize - 3), isolate)}; + v8::TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); + testing::RunWasmModuleForTesting(isolate, instance, 1, params, + ModuleOrigin::kWasmOrigin); + CHECK(try_catch.HasCaught()); + isolate->clear_pending_exception(); + } + + for (int i = 1; i < 5; i++) { + Handle<Object> params[1] = { + Handle<Object>(Smi::FromInt((20 + i) * kPageSize - 4), isolate)}; + int32_t result = testing::RunWasmModuleForTesting( + isolate, instance, 1, params, ModuleOrigin::kWasmOrigin); + CHECK(result == 0xaced); + } + + v8::TryCatch try_catch(reinterpret_cast<v8::Isolate*>(isolate)); + Handle<Object> params[1] = { + Handle<Object>(Smi::FromInt(25 * kPageSize), isolate)}; + testing::RunWasmModuleForTesting(isolate, instance, 1, params, + ModuleOrigin::kWasmOrigin); + CHECK(try_catch.HasCaught()); + isolate->clear_pending_exception(); +} diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-relocation.cc b/deps/v8/test/cctest/wasm/test-run-wasm-relocation.cc index 65b1d57bc1..e3a28f611b 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-relocation.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-relocation.cc @@ -19,42 +19,43 @@ using namespace v8::internal::compiler; TEST_BODY(float, F32, WASM_F32_ADD) \ TEST_BODY(double, F64, WASM_F64_ADD) -#define LOAD_SET_GLOBAL_TEST_BODY(C_TYPE, MACHINE_TYPE, ADD) \ - TEST(WasmRelocateGlobal##MACHINE_TYPE) { \ - TestingModule module(kExecuteCompiled); \ - module.AddGlobal<C_TYPE>(kAst##MACHINE_TYPE); \ - module.AddGlobal<C_TYPE>(kAst##MACHINE_TYPE); \ - \ - WasmRunner<C_TYPE> r(&module, \ - WasmOpcodes::MachineTypeFor(kAst##MACHINE_TYPE)); \ - \ - /* global = global + p0 */ \ - BUILD(r, WASM_SET_GLOBAL(1, ADD(WASM_GET_GLOBAL(0), WASM_GET_LOCAL(0)))); \ - CHECK_EQ(1, module.instance->function_code.size()); \ - \ - int filter = 1 << RelocInfo::WASM_GLOBAL_REFERENCE; \ - \ - Handle<Code> code = module.instance->function_code[0]; \ - \ - Address old_start = module.instance->globals_start; \ - Address new_start = old_start + 1; \ - \ - Address old_addresses[2]; \ - uint32_t address_index = 0U; \ - for (RelocIterator it(*code, filter); !it.done(); it.next()) { \ - old_addresses[address_index] = it.rinfo()->wasm_global_reference(); \ - it.rinfo()->update_wasm_global_reference(old_start, new_start); \ - ++address_index; \ - } \ - CHECK_EQ(2U, address_index); \ - \ - address_index = 0U; \ - for (RelocIterator it(*code, filter); !it.done(); it.next()) { \ - CHECK_EQ(old_addresses[address_index] + 1, \ - it.rinfo()->wasm_global_reference()); \ - ++address_index; \ - } \ - CHECK_EQ(2U, address_index); \ +#define LOAD_SET_GLOBAL_TEST_BODY(C_TYPE, MACHINE_TYPE, ADD) \ + TEST(WasmRelocateGlobal##MACHINE_TYPE) { \ + TestingModule module(kExecuteCompiled); \ + module.AddGlobal<C_TYPE>(kAst##MACHINE_TYPE); \ + module.AddGlobal<C_TYPE>(kAst##MACHINE_TYPE); \ + \ + WasmRunner<C_TYPE> r(&module, \ + WasmOpcodes::MachineTypeFor(kAst##MACHINE_TYPE)); \ + \ + /* global = global + p0 */ \ + BUILD(r, WASM_SET_GLOBAL(1, ADD(WASM_GET_GLOBAL(0), WASM_GET_LOCAL(0))), \ + WASM_GET_GLOBAL(0)); \ + CHECK_EQ(1, module.instance->function_code.size()); \ + \ + int filter = 1 << RelocInfo::WASM_GLOBAL_REFERENCE; \ + \ + Handle<Code> code = module.instance->function_code[0]; \ + \ + Address old_start = module.instance->globals_start; \ + Address new_start = old_start + 1; \ + \ + Address old_addresses[4]; \ + uint32_t address_index = 0U; \ + for (RelocIterator it(*code, filter); !it.done(); it.next()) { \ + old_addresses[address_index] = it.rinfo()->wasm_global_reference(); \ + it.rinfo()->update_wasm_global_reference(old_start, new_start); \ + ++address_index; \ + } \ + CHECK_LE(address_index, 4U); \ + \ + address_index = 0U; \ + for (RelocIterator it(*code, filter); !it.done(); it.next()) { \ + CHECK_EQ(old_addresses[address_index] + 1, \ + it.rinfo()->wasm_global_reference()); \ + ++address_index; \ + } \ + CHECK_LE(address_index, 4U); \ } FOREACH_TYPE(LOAD_SET_GLOBAL_TEST_BODY) diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc new file mode 100644 index 0000000000..76eac5e793 --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-run-wasm-simd.cc @@ -0,0 +1,49 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/wasm/wasm-macro-gen.h" + +#include "test/cctest/cctest.h" +#include "test/cctest/compiler/value-helper.h" +#include "test/cctest/wasm/wasm-run-utils.h" + +using namespace v8::base; +using namespace v8::internal; +using namespace v8::internal::compiler; +using namespace v8::internal::wasm; + +WASM_EXEC_TEST(Splat) { + FLAG_wasm_simd_prototype = true; + + // Store SIMD value in a local variable, use extract lane to check lane values + // This test is not a test for ExtractLane as Splat does not create + // interesting SIMD values. + // + // SetLocal(1, I32x4Splat(Local(0))); + // For each lane index + // if(Local(0) != I32x4ExtractLane(Local(1), index) + // return 0 + // + // return 1 + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); + r.AllocateLocal(kAstS128); + BUILD(r, + WASM_BLOCK( + WASM_SET_LOCAL(1, WASM_SIMD_I32x4_SPLAT(WASM_GET_LOCAL(0))), + WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), WASM_SIMD_I32x4_EXTRACT_LANE( + 0, WASM_GET_LOCAL(1))), + WASM_RETURN1(WASM_ZERO)), + WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), WASM_SIMD_I32x4_EXTRACT_LANE( + 1, WASM_GET_LOCAL(1))), + WASM_RETURN1(WASM_ZERO)), + WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), WASM_SIMD_I32x4_EXTRACT_LANE( + 2, WASM_GET_LOCAL(1))), + WASM_RETURN1(WASM_ZERO)), + WASM_IF(WASM_I32_NE(WASM_GET_LOCAL(0), WASM_SIMD_I32x4_EXTRACT_LANE( + 3, WASM_GET_LOCAL(1))), + WASM_RETURN1(WASM_ZERO)), + WASM_RETURN1(WASM_ONE))); + + FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call(*i)); } +} diff --git a/deps/v8/test/cctest/wasm/test-run-wasm.cc b/deps/v8/test/cctest/wasm/test-run-wasm.cc index 42ca816655..d9d9db80e1 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm.cc @@ -12,8 +12,8 @@ #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" -#include "test/cctest/wasm/test-signatures.h" #include "test/cctest/wasm/wasm-run-utils.h" +#include "test/common/wasm/test-signatures.h" using namespace v8::base; using namespace v8::internal; @@ -21,10 +21,11 @@ using namespace v8::internal::compiler; using namespace v8::internal::wasm; // for even shorter tests. -#define B2(a, b) kExprBlock, a, b, kExprEnd -#define B1(a) kExprBlock, a, kExprEnd -#define RET(x) x, kExprReturn, 1 -#define RET_I8(x) kExprI8Const, x, kExprReturn, 1 +#define B1(a) WASM_BLOCK(a) +#define B2(a, b) WASM_BLOCK(a, b) +#define B3(a, b, c) WASM_BLOCK(a, b, c) +#define RET(x) x, kExprReturn +#define RET_I8(x) kExprI8Const, x, kExprReturn WASM_EXEC_TEST(Int8Const) { WasmRunner<int32_t> r(execution_mode); @@ -34,11 +35,11 @@ WASM_EXEC_TEST(Int8Const) { CHECK_EQ(kExpectedValue, r.Call()); } -WASM_EXEC_TEST(Int8Const_fallthru1) { +WASM_EXEC_TEST(Int8Const_end) { WasmRunner<int32_t> r(execution_mode); - const byte kExpectedValue = 122; - // kExpectedValue - BUILD(r, WASM_I8(kExpectedValue)); + const byte kExpectedValue = 121; + // return(kExpectedValue) + BUILD(r, WASM_I8(kExpectedValue), kExprEnd); CHECK_EQ(kExpectedValue, r.Call()); } @@ -46,7 +47,7 @@ WASM_EXEC_TEST(Int8Const_fallthru2) { WasmRunner<int32_t> r(execution_mode); const byte kExpectedValue = 123; // -99 kExpectedValue - BUILD(r, WASM_I8(-99), WASM_I8(kExpectedValue)); + BUILD(r, WASM_I8(-99), WASM_DROP, WASM_I8(kExpectedValue)); CHECK_EQ(kExpectedValue, r.Call()); } @@ -78,14 +79,6 @@ WASM_EXEC_TEST(Int32Const_many) { } } -WASM_EXEC_TEST(MemorySize) { - TestingModule module(execution_mode); - WasmRunner<int32_t> r(&module); - module.AddMemory(1024); - BUILD(r, kExprMemorySize); - CHECK_EQ(1024, r.Call()); -} - WASM_EXEC_TEST(Int32Param0) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // return(local[0]) @@ -129,11 +122,11 @@ WASM_EXEC_TEST(Int32Add_P_fallthru) { FOR_INT32_INPUTS(i) { CHECK_EQ(*i + 13, r.Call(*i)); } } -WASM_EXEC_TEST(Int32Add_P2) { +static void RunInt32AddTest(WasmExecutionMode execution_mode, const byte* code, + size_t size) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), MachineType::Int32()); - // p0 + p1 - BUILD(r, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + r.Build(code, code + size); FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(j) { int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*i) + @@ -143,6 +136,40 @@ WASM_EXEC_TEST(Int32Add_P2) { } } +WASM_EXEC_TEST(Int32Add_P2) { + FLAG_wasm_mv_prototype = true; + static const byte code[] = { + WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; + RunInt32AddTest(execution_mode, code, sizeof(code)); +} + +WASM_EXEC_TEST(Int32Add_block1) { + FLAG_wasm_mv_prototype = true; + static const byte code[] = { + WASM_BLOCK_TT(kAstI32, kAstI32, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), + kExprI32Add}; + RunInt32AddTest(execution_mode, code, sizeof(code)); +} + +WASM_EXEC_TEST(Int32Add_block2) { + FLAG_wasm_mv_prototype = true; + static const byte code[] = { + WASM_BLOCK_TT(kAstI32, kAstI32, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), + kExprBr, DEPTH_0), + kExprI32Add}; + RunInt32AddTest(execution_mode, code, sizeof(code)); +} + +WASM_EXEC_TEST(Int32Add_multi_if) { + FLAG_wasm_mv_prototype = true; + static const byte code[] = { + WASM_IF_ELSE_TT(kAstI32, kAstI32, WASM_GET_LOCAL(0), + WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), + WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))), + kExprI32Add}; + RunInt32AddTest(execution_mode, code, sizeof(code)); +} + WASM_EXEC_TEST(Float32Add) { WasmRunner<int32_t> r(execution_mode); // int(11.5f + 44.5f) @@ -433,14 +460,18 @@ WASM_EXEC_TEST(Int32DivS_trap_effect) { module.AddMemoryElems<int32_t>(8); WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); - BUILD(r, - WASM_IF_ELSE(WASM_GET_LOCAL(0), - WASM_I32_DIVS(WASM_STORE_MEM(MachineType::Int8(), - WASM_ZERO, WASM_GET_LOCAL(0)), - WASM_GET_LOCAL(1)), - WASM_I32_DIVS(WASM_STORE_MEM(MachineType::Int8(), - WASM_ZERO, WASM_GET_LOCAL(0)), - WASM_GET_LOCAL(1)))); + BUILD(r, WASM_IF_ELSE_I( + WASM_GET_LOCAL(0), + WASM_I32_DIVS( + WASM_BLOCK_I(WASM_STORE_MEM(MachineType::Int8(), WASM_ZERO, + WASM_GET_LOCAL(0)), + WASM_GET_LOCAL(0)), + WASM_GET_LOCAL(1)), + WASM_I32_DIVS( + WASM_BLOCK_I(WASM_STORE_MEM(MachineType::Int8(), WASM_ZERO, + WASM_GET_LOCAL(0)), + WASM_GET_LOCAL(0)), + WASM_GET_LOCAL(1)))); CHECK_EQ(0, r.Call(0, 100)); CHECK_TRAP(r.Call(8, 0)); CHECK_TRAP(r.Call(4, 0)); @@ -605,46 +636,6 @@ WASM_EXEC_TEST(Float32Neg) { } } -WASM_EXEC_TEST(Float32SubMinusZero) { - WasmRunner<float> r(execution_mode, MachineType::Float32()); - BUILD(r, WASM_F32_SUB(WASM_F32(-0.0), WASM_GET_LOCAL(0))); - - uint32_t sNanValue = - bit_cast<uint32_t>(std::numeric_limits<float>::signaling_NaN()); - uint32_t qNanValue = - bit_cast<uint32_t>(std::numeric_limits<float>::quiet_NaN()); - uint32_t payload = 0x00200000; - - uint32_t expected = (qNanValue & 0xffc00000) | payload; - uint32_t operand = (sNanValue & 0xffc00000) | payload; - CHECK_EQ(expected, bit_cast<uint32_t>(r.Call(bit_cast<float>(operand)))); - - // Change the sign of the NaN. - expected |= 0x80000000; - operand |= 0x80000000; - CHECK_EQ(expected, bit_cast<uint32_t>(r.Call(bit_cast<float>(operand)))); -} - -WASM_EXEC_TEST(Float64SubMinusZero) { - WasmRunner<double> r(execution_mode, MachineType::Float64()); - BUILD(r, WASM_F64_SUB(WASM_F64(-0.0), WASM_GET_LOCAL(0))); - - uint64_t sNanValue = - bit_cast<uint64_t>(std::numeric_limits<double>::signaling_NaN()); - uint64_t qNanValue = - bit_cast<uint64_t>(std::numeric_limits<double>::quiet_NaN()); - uint64_t payload = 0x0000123456789abc; - - uint64_t expected = (qNanValue & 0xfff8000000000000) | payload; - uint64_t operand = (sNanValue & 0xfff8000000000000) | payload; - CHECK_EQ(expected, bit_cast<uint64_t>(r.Call(bit_cast<double>(operand)))); - - // Change the sign of the NaN. - expected |= 0x8000000000000000; - operand |= 0x8000000000000000; - CHECK_EQ(expected, bit_cast<uint64_t>(r.Call(bit_cast<double>(operand)))); -} - WASM_EXEC_TEST(Float64Neg) { WasmRunner<double> r(execution_mode, MachineType::Float64()); BUILD(r, WASM_F64_NEG(WASM_GET_LOCAL(0))); @@ -658,50 +649,52 @@ WASM_EXEC_TEST(Float64Neg) { WASM_EXEC_TEST(IfElse_P) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // if (p0) return 11; else return 22; - BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- - WASM_I8(11), // -- - WASM_I8(22))); // -- + BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), // -- + WASM_I8(11), // -- + WASM_I8(22))); // -- FOR_INT32_INPUTS(i) { int32_t expected = *i ? 11 : 22; CHECK_EQ(expected, r.Call(*i)); } } +#define EMPTY WASM_EXEC_TEST(If_empty1) { WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(), MachineType::Uint32()); - BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprEnd, WASM_GET_LOCAL(1)); + 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> r(execution_mode, MachineType::Uint32(), MachineType::Uint32()); - BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprElse, kExprEnd, WASM_GET_LOCAL(1)); + 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> r(execution_mode, MachineType::Uint32(), MachineType::Uint32()); - BUILD(r, WASM_GET_LOCAL(0), kExprIf, WASM_ZERO, kExprElse, kExprEnd, - WASM_GET_LOCAL(1)); + 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> r(execution_mode, MachineType::Uint32(), MachineType::Uint32()); - BUILD(r, WASM_GET_LOCAL(0), kExprIf, kExprElse, WASM_ZERO, kExprEnd, - WASM_GET_LOCAL(1)); + 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_chain) { +WASM_EXEC_TEST(If_chain1) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // if (p0) 13; if (p0) 14; 15 - BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_I8(13)), - WASM_IF(WASM_GET_LOCAL(0), WASM_I8(14)), WASM_I8(15)); + BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_NOP), + WASM_IF(WASM_GET_LOCAL(0), WASM_NOP), WASM_I8(15)); FOR_INT32_INPUTS(i) { CHECK_EQ(15, r.Call(*i)); } } @@ -720,13 +713,22 @@ WASM_EXEC_TEST(If_chain_set) { WASM_EXEC_TEST(IfElse_Unreachable1) { WasmRunner<int32_t> r(execution_mode); - // if (0) unreachable; else return 22; - BUILD(r, WASM_IF_ELSE(WASM_ZERO, // -- - WASM_UNREACHABLE, // -- - WASM_I8(27))); // -- + // 0 ? unreachable : 27 + BUILD(r, WASM_IF_ELSE_I(WASM_ZERO, // -- + WASM_UNREACHABLE, // -- + WASM_I8(27))); // -- CHECK_EQ(27, r.Call()); } +WASM_EXEC_TEST(IfElse_Unreachable2) { + WasmRunner<int32_t> r(execution_mode); + // 1 ? 28 : unreachable + BUILD(r, WASM_IF_ELSE_I(WASM_I8(1), // -- + WASM_I8(28), // -- + WASM_UNREACHABLE)); // -- + CHECK_EQ(28, r.Call()); +} + WASM_EXEC_TEST(Return12) { WasmRunner<int32_t> r(execution_mode); @@ -737,7 +739,7 @@ WASM_EXEC_TEST(Return12) { WASM_EXEC_TEST(Return17) { WasmRunner<int32_t> r(execution_mode); - BUILD(r, B1(RET_I8(17))); + BUILD(r, WASM_BLOCK(RET_I8(17))); CHECK_EQ(17, r.Call()); } @@ -794,10 +796,10 @@ WASM_EXEC_TEST(Select) { WASM_EXEC_TEST(Select_strict1) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // select(a=0, a=1, a=2); return a - BUILD(r, B2(WASM_SELECT(WASM_SET_LOCAL(0, WASM_I8(0)), - WASM_SET_LOCAL(0, WASM_I8(1)), - WASM_SET_LOCAL(0, WASM_I8(2))), - WASM_GET_LOCAL(0))); + BUILD(r, WASM_SELECT(WASM_TEE_LOCAL(0, WASM_I8(0)), + WASM_TEE_LOCAL(0, WASM_I8(1)), + WASM_TEE_LOCAL(0, WASM_I8(2))), + WASM_DROP, WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(2, r.Call(*i)); } } @@ -806,8 +808,8 @@ WASM_EXEC_TEST(Select_strict2) { r.AllocateLocal(kAstI32); r.AllocateLocal(kAstI32); // select(b=5, c=6, a) - BUILD(r, WASM_SELECT(WASM_SET_LOCAL(1, WASM_I8(5)), - WASM_SET_LOCAL(2, WASM_I8(6)), WASM_GET_LOCAL(0))); + BUILD(r, WASM_SELECT(WASM_TEE_LOCAL(1, WASM_I8(5)), + WASM_TEE_LOCAL(2, WASM_I8(6)), WASM_GET_LOCAL(0))); FOR_INT32_INPUTS(i) { int32_t expected = *i ? 5 : 6; CHECK_EQ(expected, r.Call(*i)); @@ -819,9 +821,9 @@ WASM_EXEC_TEST(Select_strict3) { r.AllocateLocal(kAstI32); r.AllocateLocal(kAstI32); // select(b=5, c=6, a=b) - BUILD(r, WASM_SELECT(WASM_SET_LOCAL(1, WASM_I8(5)), - WASM_SET_LOCAL(2, WASM_I8(6)), - WASM_SET_LOCAL(0, WASM_GET_LOCAL(1)))); + BUILD(r, WASM_SELECT(WASM_TEE_LOCAL(1, WASM_I8(5)), + WASM_TEE_LOCAL(2, WASM_I8(6)), + WASM_TEE_LOCAL(0, WASM_GET_LOCAL(1)))); FOR_INT32_INPUTS(i) { int32_t expected = 5; CHECK_EQ(expected, r.Call(*i)); @@ -830,26 +832,38 @@ WASM_EXEC_TEST(Select_strict3) { WASM_EXEC_TEST(BrIf_strict) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD( - r, - B2(B1(WASM_BRV_IF(0, WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(99)))), - WASM_GET_LOCAL(0))); + BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_GET_LOCAL(0), + WASM_TEE_LOCAL(0, WASM_I8(99))))); - FOR_INT32_INPUTS(i) { CHECK_EQ(99, r.Call(*i)); } + FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } -WASM_EXEC_TEST(BrTable0a) { +WASM_EXEC_TEST(Br_height) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, - B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0))), WASM_I8(91))); + WASM_BLOCK_I( + WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(0)), + WASM_RETURN1(WASM_I8(9)), WASM_I8(7), WASM_I8(7)), + WASM_BRV(0, WASM_I8(8)))); + + for (int32_t i = 0; i < 5; i++) { + int32_t expected = i != 0 ? 8 : 9; + CHECK_EQ(expected, r.Call(i)); + } +} + +WASM_EXEC_TEST(BrTable0a) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(0)))), + WASM_I8(91)); FOR_INT32_INPUTS(i) { CHECK_EQ(91, r.Call(*i)); } } WASM_EXEC_TEST(BrTable0b) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, - B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(0))), - WASM_I8(92))); + B1(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(0)))), + WASM_I8(92)); FOR_INT32_INPUTS(i) { CHECK_EQ(92, r.Call(*i)); } } @@ -857,9 +871,9 @@ WASM_EXEC_TEST(BrTable0c) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD( r, - B2(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(1))), - RET_I8(76)), - WASM_I8(77))); + B1(B2(B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 1, BR_TARGET(0), BR_TARGET(1))), + RET_I8(76))), + WASM_I8(77)); FOR_INT32_INPUTS(i) { int32_t expected = *i == 0 ? 76 : 77; CHECK_EQ(expected, r.Call(*i)); @@ -874,9 +888,10 @@ WASM_EXEC_TEST(BrTable1) { WASM_EXEC_TEST(BrTable_loop) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_LOOP(WASM_BR_TABLE(WASM_INC_LOCAL_BY(0, 1), 2, BR_TARGET(2), - BR_TARGET(1), BR_TARGET(0))), - RET_I8(99)), + 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)))), + RET_I8(99)), WASM_I8(98)); CHECK_EQ(99, r.Call(0)); CHECK_EQ(98, r.Call(-1)); @@ -1021,10 +1036,9 @@ WASM_EXEC_TEST(I32ReinterpretF32) { int32_t* memory = module.AddMemoryElems<int32_t>(8); WasmRunner<int32_t> r(&module, MachineType::Int32()); - BUILD(r, - WASM_BLOCK(WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, - WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))), - WASM_I8(107))); + BUILD(r, WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, + WASM_F32_REINTERPRET_I32(WASM_GET_LOCAL(0))), + WASM_I8(107)); FOR_INT32_INPUTS(i) { int32_t expected = *i; @@ -1033,13 +1047,14 @@ WASM_EXEC_TEST(I32ReinterpretF32) { } } -WASM_EXEC_TEST(ReturnStore) { +WASM_EXEC_TEST(LoadStoreLoad) { TestingModule module(execution_mode); int32_t* memory = module.AddMemoryElems<int32_t>(8); WasmRunner<int32_t> r(&module); BUILD(r, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, - WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))); + WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), + WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)); FOR_INT32_INPUTS(i) { int32_t expected = *i; @@ -1061,7 +1076,7 @@ WASM_EXEC_TEST(VoidReturn1) { const int32_t kExpected = -414444; // Build the calling function. WasmRunner<int32_t> r(&module); - BUILD(r, B2(WASM_CALL_FUNCTION0(index), WASM_I32V_3(kExpected))); + BUILD(r, WASM_CALL_FUNCTION0(index), WASM_I32V_3(kExpected)); int32_t result = r.Call(); CHECK_EQ(kExpected, result); @@ -1079,15 +1094,27 @@ WASM_EXEC_TEST(VoidReturn2) { const int32_t kExpected = -414444; // Build the calling function. WasmRunner<int32_t> r(&module); - BUILD(r, B2(WASM_CALL_FUNCTION0(index), WASM_I32V_3(kExpected))); + BUILD(r, B1(WASM_CALL_FUNCTION0(index)), WASM_I32V_3(kExpected)); int32_t result = r.Call(); CHECK_EQ(kExpected, result); } +WASM_EXEC_TEST(BrEmpty) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + 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> r(execution_mode, MachineType::Int32()); + 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> r(execution_mode, MachineType::Int32()); - BUILD(r, kExprBlock, kExprEnd, WASM_GET_LOCAL(0)); + BUILD(r, kExprBlock, kLocalVoid, kExprEnd, WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } @@ -1099,27 +1126,45 @@ WASM_EXEC_TEST(Block_empty_br1) { WASM_EXEC_TEST(Block_empty_brif1) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B1(WASM_BR_IF(0, WASM_ZERO)), WASM_GET_LOCAL(0)); + 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> r(execution_mode, MachineType::Uint32(), MachineType::Uint32()); - BUILD(r, B1(WASM_BR_IF(0, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0)); + BUILD(r, WASM_BLOCK(WASM_BR_IF(0, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); } } +WASM_EXEC_TEST(Block_i) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + 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> r(execution_mode, MachineType::Float32()); + 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> r(execution_mode, MachineType::Float64()); + 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> r(execution_mode, MachineType::Int32()); - BUILD(r, B1(WASM_BRV(0, WASM_GET_LOCAL(0)))); + BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)))); FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } } WASM_EXEC_TEST(Block_If_P) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - // { if (p0) return 51; return 52; } - BUILD(r, B2( // -- + // block { if (p0) break 51; 52; } + BUILD(r, WASM_BLOCK_I( // -- WASM_IF(WASM_GET_LOCAL(0), // -- WASM_BRV(1, WASM_I8(51))), // -- WASM_I8(52))); // -- @@ -1131,32 +1176,64 @@ WASM_EXEC_TEST(Block_If_P) { WASM_EXEC_TEST(Loop_empty) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, kExprLoop, kExprEnd, WASM_GET_LOCAL(0)); + 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> r(execution_mode, MachineType::Int32()); + 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> r(execution_mode, MachineType::Float32()); + 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> r(execution_mode, MachineType::Float64()); + 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> r(execution_mode, MachineType::Int32()); - BUILD(r, WASM_LOOP(WASM_BR(1)), WASM_GET_LOCAL(0)); + 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> r(execution_mode, MachineType::Int32()); - BUILD(r, WASM_LOOP(WASM_BR_IF(1, WASM_ZERO)), WASM_GET_LOCAL(0)); + 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> r(execution_mode, MachineType::Uint32(), MachineType::Uint32()); - BUILD(r, WASM_LOOP(WASM_BR_IF(1, WASM_GET_LOCAL(1))), WASM_GET_LOCAL(0)); + 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> r(execution_mode, MachineType::Uint32(), + MachineType::Uint32(), MachineType::Uint32()); + BUILD(r, WASM_LOOP(WASM_BRV_IFD(1, WASM_GET_LOCAL(2), WASM_GET_LOCAL(0))), + WASM_GET_LOCAL(1)); + FOR_UINT32_INPUTS(i) { + FOR_UINT32_INPUTS(j) { + CHECK_EQ(*i, r.Call(0, *i, *j)); + CHECK_EQ(*j, r.Call(1, *i, *j)); + } + } +} + WASM_EXEC_TEST(Block_BrIf_P) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(51), WASM_GET_LOCAL(0)), WASM_I8(52))); + BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I8(51), WASM_GET_LOCAL(0)), + WASM_I8(52))); FOR_INT32_INPUTS(i) { int32_t expected = *i ? 51 : 52; CHECK_EQ(expected, r.Call(*i)); @@ -1166,11 +1243,11 @@ WASM_EXEC_TEST(Block_BrIf_P) { WASM_EXEC_TEST(Block_IfElse_P_assign) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // { if (p0) p0 = 71; else p0 = 72; return p0; } - BUILD(r, B2( // -- - WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- - WASM_SET_LOCAL(0, WASM_I8(71)), // -- - WASM_SET_LOCAL(0, WASM_I8(72))), // -- - WASM_GET_LOCAL(0))); + BUILD(r, // -- + WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- + WASM_SET_LOCAL(0, WASM_I8(71)), // -- + WASM_SET_LOCAL(0, WASM_I8(72))), // -- + WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { int32_t expected = *i ? 71 : 72; CHECK_EQ(expected, r.Call(*i)); @@ -1193,9 +1270,8 @@ WASM_EXEC_TEST(Block_IfElse_P_return) { WASM_EXEC_TEST(Block_If_P_assign) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // { if (p0) p0 = 61; p0; } - BUILD(r, - WASM_BLOCK(WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(61))), - WASM_GET_LOCAL(0))); + BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_I8(61))), + WASM_GET_LOCAL(0)); FOR_INT32_INPUTS(i) { int32_t expected = *i ? 61 : *i; CHECK_EQ(expected, r.Call(*i)); @@ -1212,21 +1288,9 @@ WASM_EXEC_TEST(DanglingAssign) { WASM_EXEC_TEST(ExprIf_P) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // p0 ? 11 : 22; - BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- - WASM_I8(11), // -- - WASM_I8(22))); // -- - FOR_INT32_INPUTS(i) { - int32_t expected = *i ? 11 : 22; - CHECK_EQ(expected, r.Call(*i)); - } -} - -WASM_EXEC_TEST(ExprIf_P_fallthru) { - WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - // p0 ? 11 : 22; - BUILD(r, WASM_IF_ELSE(WASM_GET_LOCAL(0), // -- - WASM_I8(11), // -- - WASM_I8(22))); // -- + BUILD(r, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), // -- + WASM_I8(11), // -- + WASM_I8(22))); // -- FOR_INT32_INPUTS(i) { int32_t expected = *i ? 11 : 22; CHECK_EQ(expected, r.Call(*i)); @@ -1235,12 +1299,11 @@ WASM_EXEC_TEST(ExprIf_P_fallthru) { WASM_EXEC_TEST(CountDown) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, WASM_BLOCK( - WASM_LOOP(WASM_IF( - WASM_GET_LOCAL(0), - WASM_BRV(1, WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), - WASM_I8(1)))))), - WASM_GET_LOCAL(0))); + BUILD(r, WASM_LOOP(WASM_IFB( + WASM_GET_LOCAL(0), + WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(1))), + WASM_BR(1))), + WASM_GET_LOCAL(0)); CHECK_EQ(0, r.Call(1)); CHECK_EQ(0, r.Call(10)); CHECK_EQ(0, r.Call(100)); @@ -1248,12 +1311,12 @@ WASM_EXEC_TEST(CountDown) { WASM_EXEC_TEST(CountDown_fallthru) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, WASM_BLOCK( - WASM_LOOP(WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)), WASM_BREAK(1)), - WASM_SET_LOCAL( - 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(1))), - WASM_CONTINUE(0)), - WASM_GET_LOCAL(0))); + BUILD(r, WASM_LOOP( + WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)), + WASM_BRV(2, WASM_GET_LOCAL(0))), + WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(1))), + WASM_CONTINUE(0)), + WASM_GET_LOCAL(0)); CHECK_EQ(0, r.Call(1)); CHECK_EQ(0, r.Call(10)); CHECK_EQ(0, r.Call(100)); @@ -1261,41 +1324,42 @@ WASM_EXEC_TEST(CountDown_fallthru) { WASM_EXEC_TEST(WhileCountDown) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, - WASM_BLOCK(WASM_WHILE(WASM_GET_LOCAL(0), - WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), - WASM_I8(1)))), - WASM_GET_LOCAL(0))); + BUILD(r, WASM_WHILE( + WASM_GET_LOCAL(0), + WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(1)))), + WASM_GET_LOCAL(0)); CHECK_EQ(0, r.Call(1)); CHECK_EQ(0, r.Call(10)); CHECK_EQ(0, r.Call(100)); } WASM_EXEC_TEST(Loop_if_break1) { - WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)), - WASM_SET_LOCAL(0, WASM_I8(99))), - WASM_GET_LOCAL(0))); - CHECK_EQ(99, r.Call(0)); - CHECK_EQ(3, r.Call(3)); - CHECK_EQ(10000, r.Call(10000)); - CHECK_EQ(-29, r.Call(-29)); + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); + BUILD(r, WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(2, WASM_GET_LOCAL(1))), + WASM_SET_LOCAL(0, WASM_I8(99))), + WASM_GET_LOCAL(0)); + CHECK_EQ(99, r.Call(0, 11)); + CHECK_EQ(65, r.Call(3, 65)); + CHECK_EQ(10001, r.Call(10000, 10001)); + CHECK_EQ(-29, r.Call(-28, -29)); } WASM_EXEC_TEST(Loop_if_break2) { - WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_LOOP(WASM_BR_IF(1, WASM_GET_LOCAL(0)), - WASM_SET_LOCAL(0, WASM_I8(99))), - WASM_GET_LOCAL(0))); - CHECK_EQ(99, r.Call(0)); - CHECK_EQ(3, r.Call(3)); - CHECK_EQ(10000, r.Call(10000)); - CHECK_EQ(-29, r.Call(-29)); + WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), + MachineType::Int32()); + BUILD(r, WASM_LOOP(WASM_BRV_IF(1, WASM_GET_LOCAL(1), WASM_GET_LOCAL(0)), + WASM_DROP, WASM_SET_LOCAL(0, WASM_I8(99))), + WASM_GET_LOCAL(0)); + CHECK_EQ(99, r.Call(0, 33)); + CHECK_EQ(3, r.Call(1, 3)); + CHECK_EQ(10000, r.Call(99, 10000)); + CHECK_EQ(-29, r.Call(-11, -29)); } WASM_EXEC_TEST(Loop_if_break_fallthru) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BREAK(1)), + BUILD(r, B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2)), WASM_SET_LOCAL(0, WASM_I8(93)))), WASM_GET_LOCAL(0)); CHECK_EQ(93, r.Call(0)); @@ -1304,6 +1368,17 @@ WASM_EXEC_TEST(Loop_if_break_fallthru) { CHECK_EQ(-22, r.Call(-22)); } +WASM_EXEC_TEST(Loop_if_break_fallthru2) { + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, B1(B1(WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2)), + WASM_SET_LOCAL(0, WASM_I8(93))))), + WASM_GET_LOCAL(0)); + CHECK_EQ(93, r.Call(0)); + CHECK_EQ(3, r.Call(3)); + CHECK_EQ(10001, r.Call(10001)); + CHECK_EQ(-22, r.Call(-22)); +} + WASM_EXEC_TEST(IfBreak1) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_SEQ(WASM_BR(0), WASM_UNREACHABLE)), @@ -1396,7 +1471,7 @@ WASM_EXEC_TEST(LoadMem_offset_oob) { uint32_t boundary = 24 - WasmOpcodes::MemSize(machineTypes[m]); BUILD(r, WASM_LOAD_MEM_OFFSET(machineTypes[m], 8, WASM_GET_LOCAL(0)), - WASM_ZERO); + WASM_DROP, WASM_ZERO); CHECK_EQ(0, r.Call(boundary)); // in bounds. @@ -1484,7 +1559,8 @@ WASM_EXEC_TEST(StoreMemI32_alignment) { for (byte i = 0; i <= 2; ++i) { WasmRunner<int32_t> r(&module, MachineType::Int32()); BUILD(r, WASM_STORE_MEM_ALIGNMENT(MachineType::Int32(), WASM_ZERO, i, - WASM_GET_LOCAL(0))); + WASM_GET_LOCAL(0)), + WASM_GET_LOCAL(0)); module.RandomizeMemory(1111); memory[0] = 0; @@ -1500,7 +1576,8 @@ WASM_EXEC_TEST(StoreMemI32_offset) { const int32_t kWritten = 0xaabbccdd; BUILD(r, WASM_STORE_MEM_OFFSET(MachineType::Int32(), 4, WASM_GET_LOCAL(0), - WASM_I32V_5(kWritten))); + WASM_I32V_5(kWritten)), + WASM_I32V_5(kWritten)); for (int i = 0; i < 2; ++i) { module.RandomizeMemory(1111); @@ -1566,18 +1643,17 @@ WASM_EXEC_TEST(MemI32_Sum) { WasmRunner<uint32_t> r(&module, MachineType::Int32()); const byte kSum = r.AllocateLocal(kAstI32); - BUILD(r, - WASM_BLOCK( - WASM_WHILE( - WASM_GET_LOCAL(0), - WASM_BLOCK( - WASM_SET_LOCAL( - kSum, WASM_I32_ADD(WASM_GET_LOCAL(kSum), - WASM_LOAD_MEM(MachineType::Int32(), - WASM_GET_LOCAL(0)))), - WASM_SET_LOCAL( - 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))), - WASM_GET_LOCAL(1))); + BUILD( + r, + WASM_WHILE( + WASM_GET_LOCAL(0), + WASM_BLOCK( + WASM_SET_LOCAL(kSum, + WASM_I32_ADD(WASM_GET_LOCAL(kSum), + WASM_LOAD_MEM(MachineType::Int32(), + WASM_GET_LOCAL(0)))), + WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))), + WASM_GET_LOCAL(1)); // Run 4 trials. for (int i = 0; i < 3; ++i) { @@ -1597,10 +1673,24 @@ WASM_EXEC_TEST(CheckMachIntsZero) { module.AddMemoryElems<uint32_t>(kNumElems); WasmRunner<uint32_t> r(&module, MachineType::Int32()); - BUILD(r, kExprLoop, kExprGetLocal, 0, kExprIf, kExprGetLocal, 0, - kExprI32LoadMem, 0, 0, kExprIf, kExprI8Const, 255, kExprReturn, ARITY_1, - kExprEnd, kExprGetLocal, 0, kExprI8Const, 4, kExprI32Sub, kExprSetLocal, - 0, kExprBr, ARITY_1, DEPTH_0, kExprEnd, kExprEnd, kExprI8Const, 0); + BUILD(r, // -- + /**/ kExprLoop, kLocalVoid, // -- + /* */ kExprGetLocal, 0, // -- + /* */ kExprIf, kLocalVoid, // -- + /* */ kExprGetLocal, 0, // -- + /* */ kExprI32LoadMem, 0, 0, // -- + /* */ kExprIf, kLocalVoid, // -- + /* */ kExprI8Const, 255, // -- + /* */ kExprReturn, // -- + /* */ kExprEnd, // -- + /* */ kExprGetLocal, 0, // -- + /* */ kExprI8Const, 4, // -- + /* */ kExprI32Sub, // -- + /* */ kExprTeeLocal, 0, // -- + /* */ kExprBr, DEPTH_0, // -- + /* */ kExprEnd, // -- + /**/ kExprEnd, // -- + /**/ kExprI8Const, 0); // -- module.BlankMemory(); CHECK_EQ(0, r.Call((kNumElems - 1) * 4)); @@ -1619,20 +1709,18 @@ WASM_EXEC_TEST(MemF32_Sum) { WasmRunner<int32_t> r(&module, MachineType::Int32()); const byte kSum = r.AllocateLocal(kAstF32); - BUILD(r, - WASM_BLOCK( - WASM_WHILE( - WASM_GET_LOCAL(0), - WASM_BLOCK( - WASM_SET_LOCAL( - kSum, WASM_F32_ADD(WASM_GET_LOCAL(kSum), - WASM_LOAD_MEM(MachineType::Float32(), - WASM_GET_LOCAL(0)))), - WASM_SET_LOCAL( - 0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))), - WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, - WASM_GET_LOCAL(kSum)), - WASM_GET_LOCAL(0))); + BUILD( + r, + WASM_WHILE( + WASM_GET_LOCAL(0), + WASM_BLOCK( + WASM_SET_LOCAL(kSum, + WASM_F32_ADD(WASM_GET_LOCAL(kSum), + WASM_LOAD_MEM(MachineType::Float32(), + WASM_GET_LOCAL(0)))), + WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(4))))), + WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, WASM_GET_LOCAL(kSum)), + WASM_GET_LOCAL(0)); CHECK_EQ(0, r.Call(4 * (kSize - 1))); CHECK_NE(-99.25f, module.ReadMemory(&buffer[0])); @@ -1651,19 +1739,17 @@ T GenerateAndRunFold(WasmExecutionMode execution_mode, WasmOpcode binop, WasmRunner<int32_t> r(&module, MachineType::Int32()); const byte kAccum = r.AllocateLocal(astType); - BUILD(r, WASM_BLOCK( - WASM_SET_LOCAL(kAccum, WASM_LOAD_MEM(memType, WASM_ZERO)), - WASM_WHILE( - WASM_GET_LOCAL(0), - WASM_BLOCK( - WASM_SET_LOCAL( + BUILD(r, WASM_SET_LOCAL(kAccum, WASM_LOAD_MEM(memType, WASM_ZERO)), + WASM_WHILE( + WASM_GET_LOCAL(0), + WASM_BLOCK(WASM_SET_LOCAL( kAccum, WASM_BINOP(binop, WASM_GET_LOCAL(kAccum), WASM_LOAD_MEM( memType, WASM_GET_LOCAL(0)))), WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(sizeof(T)))))), - WASM_STORE_MEM(memType, WASM_ZERO, WASM_GET_LOCAL(kAccum)), - WASM_GET_LOCAL(0))); + WASM_STORE_MEM(memType, WASM_ZERO, WASM_GET_LOCAL(kAccum)), + WASM_GET_LOCAL(0)); r.Call(static_cast<int>(sizeof(T) * (size - 1))); return module.ReadMemory(&memory[0]); } @@ -1689,19 +1775,20 @@ WASM_EXEC_TEST(Build_Wasm_Infinite_Loop_effect) { WasmRunner<int32_t> r(&module, MachineType::Int32()); // Only build the graph and compile, don't run. - BUILD(r, WASM_LOOP(WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO))); + BUILD(r, WASM_LOOP(WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO), WASM_DROP), + WASM_ZERO); } WASM_EXEC_TEST(Unreachable0a) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_BRV(0, WASM_I8(9)), RET(WASM_GET_LOCAL(0)))); + BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I8(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> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_BRV(0, WASM_I8(7)), WASM_UNREACHABLE)); + BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_I8(7)), WASM_UNREACHABLE)); CHECK_EQ(7, r.Call(0)); CHECK_EQ(7, r.Call(1)); } @@ -1734,31 +1821,32 @@ TEST(Build_Wasm_UnreachableIf2) { WASM_EXEC_TEST(Unreachable_Load) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_BRV(0, WASM_GET_LOCAL(0)), - WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0)))); + BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)), + WASM_LOAD_MEM(MachineType::Int8(), WASM_GET_LOCAL(0)))); CHECK_EQ(11, r.Call(11)); CHECK_EQ(21, r.Call(21)); } WASM_EXEC_TEST(Infinite_Loop_not_taken1) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I8(45))); + BUILD(r, WASM_IF(WASM_GET_LOCAL(0), WASM_INFINITE_LOOP), WASM_I8(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> r(execution_mode, MachineType::Int32()); - BUILD(r, B1(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(45)), - WASM_INFINITE_LOOP))); + BUILD(r, + WASM_BLOCK_I(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(45)), + WASM_INFINITE_LOOP))); // Run the code, but don't go into the infinite loop. CHECK_EQ(45, r.Call(1)); } WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, - B2(WASM_BRV_IF(0, WASM_I8(45), WASM_GET_LOCAL(0)), WASM_INFINITE_LOOP)); + BUILD(r, WASM_BLOCK_I(WASM_BRV_IF(0, WASM_I8(45), WASM_GET_LOCAL(0)), + WASM_INFINITE_LOOP)); // Run the code, but don't go into the infinite loop. CHECK_EQ(45, r.Call(1)); } @@ -1861,8 +1949,9 @@ WASM_EXEC_TEST(Int32Global) { int32_t* global = module.AddGlobal<int32_t>(kAstI32); WasmRunner<int32_t> r(&module, MachineType::Int32()); // global = global + p0 - BUILD(r, WASM_SET_GLOBAL( - 0, WASM_I32_ADD(WASM_GET_GLOBAL(0), WASM_GET_LOCAL(0)))); + BUILD(r, + WASM_SET_GLOBAL(0, WASM_I32_ADD(WASM_GET_GLOBAL(0), WASM_GET_LOCAL(0))), + WASM_ZERO); *global = 116; for (int i = 9; i < 444444; i += 111111) { @@ -1883,7 +1972,8 @@ WASM_EXEC_TEST(Int32Globals_DontAlias) { // global = global + p0 WasmRunner<int32_t> r(&module, MachineType::Int32()); BUILD(r, WASM_SET_GLOBAL( - g, WASM_I32_ADD(WASM_GET_GLOBAL(g), WASM_GET_LOCAL(0)))); + g, WASM_I32_ADD(WASM_GET_GLOBAL(g), WASM_GET_LOCAL(0))), + WASM_GET_GLOBAL(g)); // Check that reading/writing global number {g} doesn't alter the others. *globals[g] = 116 * g; @@ -1891,7 +1981,8 @@ WASM_EXEC_TEST(Int32Globals_DontAlias) { 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]; - r.Call(i); + 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]); @@ -1905,10 +1996,10 @@ WASM_EXEC_TEST(Float32Global) { float* global = module.AddGlobal<float>(kAstF32); WasmRunner<int32_t> r(&module, MachineType::Int32()); // global = global + p0 - BUILD(r, B2(WASM_SET_GLOBAL( - 0, WASM_F32_ADD(WASM_GET_GLOBAL(0), - WASM_F32_SCONVERT_I32(WASM_GET_LOCAL(0)))), - WASM_ZERO)); + BUILD(r, WASM_SET_GLOBAL( + 0, WASM_F32_ADD(WASM_GET_GLOBAL(0), + WASM_F32_SCONVERT_I32(WASM_GET_LOCAL(0)))), + WASM_ZERO); *global = 1.25; for (int i = 9; i < 4444; i += 1111) { @@ -1923,10 +2014,10 @@ WASM_EXEC_TEST(Float64Global) { double* global = module.AddGlobal<double>(kAstF64); WasmRunner<int32_t> r(&module, MachineType::Int32()); // global = global + p0 - BUILD(r, B2(WASM_SET_GLOBAL( - 0, WASM_F64_ADD(WASM_GET_GLOBAL(0), - WASM_F64_SCONVERT_I32(WASM_GET_LOCAL(0)))), - WASM_ZERO)); + BUILD(r, WASM_SET_GLOBAL( + 0, WASM_F64_ADD(WASM_GET_GLOBAL(0), + WASM_F64_SCONVERT_I32(WASM_GET_LOCAL(0)))), + WASM_ZERO); *global = 1.25; for (int i = 9; i < 4444; i += 1111) { @@ -1948,14 +2039,11 @@ WASM_EXEC_TEST(MixedGlobals) { WasmRunner<int32_t> r(&module, MachineType::Int32()); - BUILD( - r, - WASM_BLOCK( - WASM_SET_GLOBAL(1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), - WASM_SET_GLOBAL(2, WASM_LOAD_MEM(MachineType::Uint32(), WASM_ZERO)), - WASM_SET_GLOBAL(3, WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)), - WASM_SET_GLOBAL(4, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)), - WASM_ZERO)); + BUILD(r, WASM_SET_GLOBAL(1, WASM_LOAD_MEM(MachineType::Int32(), WASM_ZERO)), + WASM_SET_GLOBAL(2, WASM_LOAD_MEM(MachineType::Uint32(), WASM_ZERO)), + WASM_SET_GLOBAL(3, WASM_LOAD_MEM(MachineType::Float32(), WASM_ZERO)), + WASM_SET_GLOBAL(4, WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO)), + WASM_ZERO); memory[0] = 0xaa; memory[1] = 0xcc; @@ -2004,8 +2092,8 @@ WASM_EXEC_TEST(CallF32StackParameter) { // Build the calling function. WasmRunner<float> r(&module); - BUILD(r, WASM_CALL_FUNCTIONN( - 19, index, WASM_F32(1.0f), WASM_F32(2.0f), WASM_F32(4.0f), + BUILD(r, WASM_CALL_FUNCTION( + index, WASM_F32(1.0f), WASM_F32(2.0f), WASM_F32(4.0f), WASM_F32(8.0f), WASM_F32(16.0f), WASM_F32(32.0f), WASM_F32(64.0f), WASM_F32(128.0f), WASM_F32(256.0f), WASM_F32(1.5f), WASM_F32(2.5f), WASM_F32(4.5f), WASM_F32(8.5f), @@ -2028,13 +2116,13 @@ WASM_EXEC_TEST(CallF64StackParameter) { // Build the calling function. WasmRunner<double> r(&module); - BUILD(r, WASM_CALL_FUNCTIONN(19, index, WASM_F64(1.0), WASM_F64(2.0), - WASM_F64(4.0), WASM_F64(8.0), WASM_F64(16.0), - WASM_F64(32.0), WASM_F64(64.0), WASM_F64(128.0), - WASM_F64(256.0), WASM_F64(1.5), WASM_F64(2.5), - WASM_F64(4.5), WASM_F64(8.5), WASM_F64(16.5), - WASM_F64(32.5), WASM_F64(64.5), WASM_F64(128.5), - WASM_F64(256.5), WASM_F64(512.5))); + BUILD(r, WASM_CALL_FUNCTION(index, WASM_F64(1.0), WASM_F64(2.0), + WASM_F64(4.0), WASM_F64(8.0), WASM_F64(16.0), + WASM_F64(32.0), WASM_F64(64.0), WASM_F64(128.0), + WASM_F64(256.0), WASM_F64(1.5), WASM_F64(2.5), + WASM_F64(4.5), WASM_F64(8.5), WASM_F64(16.5), + WASM_F64(32.5), WASM_F64(64.5), WASM_F64(128.5), + WASM_F64(256.5), WASM_F64(512.5))); float result = r.Call(); CHECK_EQ(256.5, result); @@ -2075,7 +2163,7 @@ WASM_EXEC_TEST(Call_Int32Add) { // Build the caller function. WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); - BUILD(r, WASM_CALL_FUNCTION2(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + BUILD(r, WASM_CALL_FUNCTION(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_INT32_INPUTS(i) { FOR_INT32_INPUTS(j) { @@ -2097,7 +2185,7 @@ WASM_EXEC_TEST(Call_Float32Sub) { // Builder the caller function. WasmRunner<float> r(&module, MachineType::Float32(), MachineType::Float32()); - BUILD(r, WASM_CALL_FUNCTION2(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + BUILD(r, WASM_CALL_FUNCTION(index, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); FOR_FLOAT32_INPUTS(i) { FOR_FLOAT32_INPUTS(j) { CHECK_FLOAT_EQ(*i - *j, r.Call(*i, *j)); } @@ -2109,13 +2197,11 @@ WASM_EXEC_TEST(Call_Float64Sub) { double* memory = module.AddMemoryElems<double>(16); WasmRunner<int32_t> r(&module); - BUILD(r, - WASM_BLOCK(WASM_STORE_MEM( - MachineType::Float64(), WASM_ZERO, - WASM_F64_SUB( - WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO), - WASM_LOAD_MEM(MachineType::Float64(), WASM_I8(8)))), - WASM_I8(107))); + BUILD(r, WASM_STORE_MEM( + MachineType::Float64(), WASM_ZERO, + WASM_F64_SUB(WASM_LOAD_MEM(MachineType::Float64(), WASM_ZERO), + WASM_LOAD_MEM(MachineType::Float64(), WASM_I8(8)))), + WASM_I8(107)); FOR_FLOAT64_INPUTS(i) { FOR_FLOAT64_INPUTS(j) { @@ -2153,7 +2239,7 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { int num_params = static_cast<int>(arraysize(mixed)) - start; for (int which = 0; which < num_params; ++which) { - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); TestingModule module(execution_mode); module.AddMemory(1024); @@ -2189,8 +2275,7 @@ static void Run_WasmMixedCall_N(WasmExecutionMode execution_mode, int start) { } // Call the selector function. - ADD_CODE(code, kExprCallFunction, static_cast<byte>(num_params), - static_cast<byte>(index)); + ADD_CODE(code, kExprCallFunction, static_cast<byte>(index)); // Store the result in memory. ADD_CODE(code, @@ -2232,71 +2317,149 @@ WASM_EXEC_TEST(AddCall) { WasmRunner<int32_t> r(&module, MachineType::Int32()); byte local = r.AllocateLocal(kAstI32); - BUILD(r, B2(WASM_SET_LOCAL(local, WASM_I8(99)), - WASM_I32_ADD( - WASM_CALL_FUNCTION2(t1.function_index(), WASM_GET_LOCAL(0), - WASM_GET_LOCAL(0)), - WASM_CALL_FUNCTION2(t1.function_index(), WASM_GET_LOCAL(1), - WASM_GET_LOCAL(local))))); + BUILD(r, WASM_SET_LOCAL(local, WASM_I8(99)), + WASM_I32_ADD(WASM_CALL_FUNCTION(t1.function_index(), WASM_GET_LOCAL(0), + WASM_GET_LOCAL(0)), + WASM_CALL_FUNCTION(t1.function_index(), WASM_GET_LOCAL(1), + WASM_GET_LOCAL(local)))); CHECK_EQ(198, r.Call(0)); CHECK_EQ(200, r.Call(1)); CHECK_EQ(100, r.Call(-49)); } -WASM_EXEC_TEST(CountDown_expr) { - WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, WASM_LOOP( - WASM_IF(WASM_NOT(WASM_GET_LOCAL(0)), - WASM_BREAKV(1, WASM_GET_LOCAL(0))), - WASM_SET_LOCAL(0, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(1))), - WASM_CONTINUE(0))); - CHECK_EQ(0, r.Call(1)); - CHECK_EQ(0, r.Call(10)); - CHECK_EQ(0, r.Call(100)); +WASM_EXEC_TEST(MultiReturnSub) { + FLAG_wasm_mv_prototype = true; + LocalType storage[] = {kAstI32, kAstI32, kAstI32, kAstI32}; + FunctionSig sig_ii_ii(2, 2, storage); + TestingModule module(execution_mode); + WasmFunctionCompiler t1(&sig_ii_ii, &module); + BUILD(t1, WASM_GET_LOCAL(1), WASM_GET_LOCAL(0)); + t1.CompileAndAdd(); + + WasmRunner<int32_t> r(&module, MachineType::Int32(), MachineType::Int32()); + BUILD(r, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), kExprCallFunction, 0, + kExprI32Sub); + + FOR_INT32_INPUTS(i) { + FOR_INT32_INPUTS(j) { + int32_t expected = static_cast<int32_t>(static_cast<uint32_t>(*j) - + static_cast<uint32_t>(*i)); + CHECK_EQ(expected, r.Call(*i, *j)); + } + } +} + +template <typename T> +void RunMultiReturnSelect(WasmExecutionMode execution_mode, LocalType type, + const T* inputs) { + FLAG_wasm_mv_prototype = true; + LocalType storage[] = {type, type, type, type, type, type}; + const size_t kNumReturns = 2; + const size_t kNumParams = arraysize(storage) - kNumReturns; + FunctionSig sig(kNumReturns, kNumParams, storage); + + for (size_t i = 0; i < kNumParams; i++) { + for (size_t j = 0; j < kNumParams; j++) { + for (int k = 0; k < 2; k++) { + TestingModule module(execution_mode); + WasmFunctionCompiler r1(&sig, &module); + + BUILD(r1, WASM_GET_LOCAL(i), WASM_GET_LOCAL(j)); + r1.CompileAndAdd(); + + MachineType machine_type = WasmOpcodes::MachineTypeFor(type); + WasmRunner<T> r2(&module, machine_type, machine_type, machine_type, + machine_type); + + if (k == 0) { + BUILD(r2, WASM_CALL_FUNCTION(r1.function_index(), WASM_GET_LOCAL(0), + WASM_GET_LOCAL(1), WASM_GET_LOCAL(2), + WASM_GET_LOCAL(3)), + WASM_DROP); + } else { + BUILD(r2, WASM_CALL_FUNCTION(r1.function_index(), WASM_GET_LOCAL(0), + WASM_GET_LOCAL(1), WASM_GET_LOCAL(2), + WASM_GET_LOCAL(3)), + kExprSetLocal, 0, WASM_DROP, WASM_GET_LOCAL(0)); + } + + T expected = inputs[k == 0 ? i : j]; + CHECK_EQ(expected, r2.Call(inputs[0], inputs[1], inputs[2], inputs[3])); + } + } + } +} + +WASM_EXEC_TEST(MultiReturnSelect_i32) { + static const int32_t inputs[] = {3333333, 4444444, -55555555, -7777777}; + RunMultiReturnSelect<int32_t>(execution_mode, kAstI32, inputs); +} + +WASM_EXEC_TEST(MultiReturnSelect_f32) { + static const float inputs[] = {33.33333f, 444.4444f, -55555.555f, -77777.77f}; + RunMultiReturnSelect<float>(execution_mode, kAstF32, inputs); +} + +WASM_EXEC_TEST(MultiReturnSelect_i64) { +#if !V8_TARGET_ARCH_32_BIT || V8_TARGET_ARCH_X64 + // TODO(titzer): implement int64-lowering for multiple return values + static const int64_t inputs[] = {33333338888, 44444446666, -555555553333, + -77777771111}; + RunMultiReturnSelect<int64_t>(execution_mode, kAstI64, inputs); +#endif +} + +WASM_EXEC_TEST(MultiReturnSelect_f64) { + static const double inputs[] = {3.333333, 44444.44, -55.555555, -7777.777}; + RunMultiReturnSelect<double>(execution_mode, kAstF64, inputs); } WASM_EXEC_TEST(ExprBlock2a) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(1))); + BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), + WASM_I8(1))); CHECK_EQ(1, r.Call(0)); CHECK_EQ(1, r.Call(1)); } WASM_EXEC_TEST(ExprBlock2b) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), WASM_I8(2))); + BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(1, WASM_I8(1))), + WASM_I8(2))); CHECK_EQ(2, r.Call(0)); CHECK_EQ(1, r.Call(1)); } WASM_EXEC_TEST(ExprBlock2c) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(1))); + BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I8(1), WASM_GET_LOCAL(0)), + WASM_I8(1))); CHECK_EQ(1, r.Call(0)); CHECK_EQ(1, r.Call(1)); } WASM_EXEC_TEST(ExprBlock2d) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B2(WASM_BRV_IF(0, WASM_I8(1), WASM_GET_LOCAL(0)), WASM_I8(2))); + BUILD(r, WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I8(1), WASM_GET_LOCAL(0)), + WASM_I8(2))); CHECK_EQ(2, r.Call(0)); CHECK_EQ(1, r.Call(1)); } WASM_EXEC_TEST(ExprBlock_ManualSwitch) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, WASM_BLOCK(WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1)), - WASM_BRV(1, WASM_I8(11))), - WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(2)), - WASM_BRV(1, WASM_I8(12))), - WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(3)), - WASM_BRV(1, WASM_I8(13))), - WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(4)), - WASM_BRV(1, WASM_I8(14))), - WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(5)), - WASM_BRV(1, WASM_I8(15))), - WASM_I8(99))); + BUILD(r, WASM_BLOCK_I(WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1)), + WASM_BRV(1, WASM_I8(11))), + WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(2)), + WASM_BRV(1, WASM_I8(12))), + WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(3)), + WASM_BRV(1, WASM_I8(13))), + WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(4)), + WASM_BRV(1, WASM_I8(14))), + WASM_IF(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(5)), + WASM_BRV(1, WASM_I8(15))), + WASM_I8(99))); CHECK_EQ(99, r.Call(0)); CHECK_EQ(11, r.Call(1)); CHECK_EQ(12, r.Call(2)); @@ -2308,17 +2471,18 @@ WASM_EXEC_TEST(ExprBlock_ManualSwitch) { WASM_EXEC_TEST(ExprBlock_ManualSwitch_brif) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, WASM_BLOCK(WASM_BRV_IF(0, WASM_I8(11), + BUILD(r, + WASM_BLOCK_I(WASM_BRV_IFD(0, WASM_I8(11), WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(1))), - WASM_BRV_IF(0, WASM_I8(12), + WASM_BRV_IFD(0, WASM_I8(12), WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(2))), - WASM_BRV_IF(0, WASM_I8(13), + WASM_BRV_IFD(0, WASM_I8(13), WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(3))), - WASM_BRV_IF(0, WASM_I8(14), + WASM_BRV_IFD(0, WASM_I8(14), WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(4))), - WASM_BRV_IF(0, WASM_I8(15), + WASM_BRV_IFD(0, WASM_I8(15), WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(5))), - WASM_I8(99))); + WASM_I8(99))); CHECK_EQ(99, r.Call(0)); CHECK_EQ(11, r.Call(1)); CHECK_EQ(12, r.Call(2)); @@ -2328,14 +2492,14 @@ WASM_EXEC_TEST(ExprBlock_ManualSwitch_brif) { CHECK_EQ(99, r.Call(6)); } -WASM_EXEC_TEST(nested_ifs) { +WASM_EXEC_TEST(If_nested) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), MachineType::Int32()); - BUILD(r, WASM_IF_ELSE( + BUILD(r, WASM_IF_ELSE_I( WASM_GET_LOCAL(0), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(11), WASM_I8(12)), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_I8(13), WASM_I8(14)))); + WASM_IF_ELSE_I(WASM_GET_LOCAL(1), WASM_I8(11), WASM_I8(12)), + WASM_IF_ELSE_I(WASM_GET_LOCAL(1), WASM_I8(13), WASM_I8(14)))); CHECK_EQ(11, r.Call(1, 1)); CHECK_EQ(12, r.Call(1, 0)); @@ -2346,8 +2510,9 @@ WASM_EXEC_TEST(nested_ifs) { WASM_EXEC_TEST(ExprBlock_if) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); - BUILD(r, B1(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_BRV(0, WASM_I8(11)), - WASM_BRV(1, WASM_I8(14))))); + BUILD(r, + WASM_BLOCK_I(WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_BRV(0, WASM_I8(11)), + WASM_BRV(1, WASM_I8(14))))); CHECK_EQ(11, r.Call(1)); CHECK_EQ(14, r.Call(0)); @@ -2357,29 +2522,12 @@ WASM_EXEC_TEST(ExprBlock_nested_ifs) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), MachineType::Int32()); - BUILD(r, WASM_BLOCK(WASM_IF_ELSE( - WASM_GET_LOCAL(0), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(11)), - WASM_BRV(1, WASM_I8(12))), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(13)), - WASM_BRV(1, WASM_I8(14)))))); - - CHECK_EQ(11, r.Call(1, 1)); - CHECK_EQ(12, r.Call(1, 0)); - CHECK_EQ(13, r.Call(0, 1)); - CHECK_EQ(14, r.Call(0, 0)); -} - -WASM_EXEC_TEST(ExprLoop_nested_ifs) { - WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), - MachineType::Int32()); - - BUILD(r, WASM_LOOP(WASM_IF_ELSE( + BUILD(r, WASM_BLOCK_I(WASM_IF_ELSE_I( WASM_GET_LOCAL(0), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(1, WASM_I8(11)), - WASM_BRV(3, WASM_I8(12))), - WASM_IF_ELSE(WASM_GET_LOCAL(1), WASM_BRV(1, WASM_I8(13)), - WASM_BRV(3, WASM_I8(14)))))); + WASM_IF_ELSE_I(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(11)), + WASM_BRV(1, WASM_I8(12))), + WASM_IF_ELSE_I(WASM_GET_LOCAL(1), WASM_BRV(0, WASM_I8(13)), + WASM_BRV(1, WASM_I8(14)))))); CHECK_EQ(11, r.Call(1, 1)); CHECK_EQ(12, r.Call(1, 0)); @@ -2681,7 +2829,7 @@ static void CompileCallIndirectMany(LocalType param) { // with many many parameters. TestSignatures sigs; for (byte num_params = 0; num_params < 40; ++num_params) { - v8::base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); HandleScope scope(CcTest::InitIsolateOnce()); TestingModule module(kExecuteCompiled); @@ -2694,11 +2842,11 @@ static void CompileCallIndirectMany(LocalType param) { WasmFunctionCompiler t(sig, &module); std::vector<byte> code; - ADD_CODE(code, kExprI8Const, 0); for (byte p = 0; p < num_params; ++p) { ADD_CODE(code, kExprGetLocal, p); } - ADD_CODE(code, kExprCallIndirect, static_cast<byte>(num_params), 1); + ADD_CODE(code, kExprI8Const, 0); + ADD_CODE(code, kExprCallIndirect, 1); t.Build(&code[0], &code[0] + code.size()); t.Compile(); @@ -2714,7 +2862,8 @@ TEST(Compile_Wasm_CallIndirect_Many_f64) { CompileCallIndirectMany(kAstF64); } WASM_EXEC_TEST(Int32RemS_dead) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32(), MachineType::Int32()); - BUILD(r, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), WASM_ZERO); + 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(); CHECK_EQ(0, r.Call(133, 100)); CHECK_EQ(0, r.Call(kMin, -1)); diff --git a/deps/v8/test/cctest/wasm/test-wasm-function-name-table.cc b/deps/v8/test/cctest/wasm/test-wasm-function-name-table.cc index 1ae78dcb4e..9a4394204b 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-function-name-table.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-function-name-table.cc @@ -41,9 +41,9 @@ void testFunctionNameTable(Vector<Vector<const char>> names) { name.start() + name.length()); // Make every second function name null-terminated. if (func_index % 2) all_names.push_back('\0'); - module.functions.push_back({nullptr, 0, 0, - static_cast<uint32_t>(name_offset), - static_cast<uint32_t>(name.length()), 0, 0}); + module.functions.push_back( + {nullptr, 0, 0, static_cast<uint32_t>(name_offset), + static_cast<uint32_t>(name.length()), 0, 0, false, false}); ++func_index; } diff --git a/deps/v8/test/cctest/wasm/test-wasm-stack.cc b/deps/v8/test/cctest/wasm/test-wasm-stack.cc index f2a848161b..2b51287e87 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-stack.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-stack.cc @@ -6,8 +6,8 @@ #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" -#include "test/cctest/wasm/test-signatures.h" #include "test/cctest/wasm/wasm-run-utils.h" +#include "test/common/wasm/test-signatures.h" using namespace v8::base; using namespace v8::internal; 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 30f5d48a07..d4a2b4fe0b 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc @@ -6,8 +6,8 @@ #include "test/cctest/cctest.h" #include "test/cctest/compiler/value-helper.h" -#include "test/cctest/wasm/test-signatures.h" #include "test/cctest/wasm/wasm-run-utils.h" +#include "test/common/wasm/test-signatures.h" using namespace v8::base; using namespace v8::internal; @@ -104,8 +104,9 @@ TEST(IllegalLoad) { WasmFunctionCompiler comp1(sigs.v_v(), &module, ArrayVector("mem_oob")); // Set the execution context, such that a runtime error can be thrown. comp1.SetModuleContext(); - BUILD(comp1, WASM_IF(WASM_ONE, - WASM_LOAD_MEM(MachineType::Int32(), WASM_I32V_1(-3)))); + BUILD(comp1, WASM_IF(WASM_ONE, WASM_SEQ(WASM_LOAD_MEM(MachineType::Int32(), + WASM_I32V_1(-3)), + WASM_DROP))); uint32_t wasm_index = comp1.CompileAndAdd(); WasmFunctionCompiler comp2(sigs.v_v(), &module, ArrayVector("call_mem_oob")); @@ -131,7 +132,7 @@ TEST(IllegalLoad) { // The column is 1-based, so add 1 to the actual byte offset. ExceptionInfo expected_exceptions[] = { - {"<WASM UNNAMED>", static_cast<int>(wasm_index), 7}, // -- + {"<WASM UNNAMED>", static_cast<int>(wasm_index), 8}, // -- {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 3}, // -- {"callFn", 1, 24} // -- }; diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.h b/deps/v8/test/cctest/wasm/wasm-run-utils.h index 0a11fedfd1..93fcb89dba 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.h +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.h @@ -11,8 +11,8 @@ #include <memory> -#include "src/base/accounting-allocator.h" #include "src/base/utils/random-number-generator.h" +#include "src/zone/accounting-allocator.h" #include "src/compiler/graph-visualizer.h" #include "src/compiler/int64-lowering.h" @@ -29,7 +29,7 @@ #include "src/wasm/wasm-module.h" #include "src/wasm/wasm-opcodes.h" -#include "src/zone.h" +#include "src/zone/zone.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/call-tester.h" @@ -181,7 +181,7 @@ class TestingModule : public ModuleEnv { module_.functions.reserve(kMaxFunctions); } uint32_t index = static_cast<uint32_t>(module->functions.size()); - module_.functions.push_back({sig, index, 0, 0, 0, 0, 0}); + module_.functions.push_back({sig, index, 0, 0, 0, 0, 0, false, false}); instance->function_code.push_back(code); if (interpreter_) { const WasmFunction* function = &module->functions.back(); @@ -208,7 +208,7 @@ class TestingModule : public ModuleEnv { Handle<String> name = isolate_->factory()->NewStringFromStaticChars("main"); Handle<JSObject> module_object = Handle<JSObject>(0, isolate_); Handle<Code> code = instance->function_code[index]; - WasmJs::InstallWasmFunctionMap(isolate_, isolate_->native_context()); + WasmJs::InstallWasmMapsIfNeeded(isolate_, isolate_->native_context()); Handle<Code> ret_code = compiler::CompileJSToWasmWrapper(isolate_, this, code, index); FunctionSig* funcSig = this->module->functions[index].sig; @@ -230,7 +230,7 @@ class TestingModule : public ModuleEnv { void AddIndirectFunctionTable(uint16_t* functions, uint32_t table_size) { module_.function_tables.push_back( - {table_size, table_size, std::vector<uint16_t>()}); + {table_size, table_size, std::vector<int32_t>(), false, false}); for (uint32_t i = 0; i < table_size; ++i) { module_.function_tables.back().values.push_back(functions[i]); } @@ -259,7 +259,7 @@ class TestingModule : public ModuleEnv { WasmModule module_; WasmModuleInstance instance_; Isolate* isolate_; - v8::base::AccountingAllocator allocator_; + v8::internal::AccountingAllocator allocator_; uint32_t global_offset; V8_ALIGNED(8) byte global_data[kMaxGlobalsSize]; // preallocated global data. WasmInterpreter* interpreter_; @@ -267,7 +267,8 @@ class TestingModule : public ModuleEnv { const WasmGlobal* AddGlobal(LocalType type) { byte size = WasmOpcodes::MemSize(WasmOpcodes::MachineTypeFor(type)); global_offset = (global_offset + size - 1) & ~(size - 1); // align - module_.globals.push_back({0, 0, type, global_offset, false}); + module_.globals.push_back( + {type, true, NO_INIT, global_offset, false, false}); global_offset += size; // limit number of globals. CHECK_LT(global_offset, kMaxGlobalsSize); @@ -283,6 +284,13 @@ inline void TestBuildingGraph(Zone* zone, JSGraph* jsgraph, ModuleEnv* module, DecodeResult result = BuildTFGraph(zone->allocator(), &builder, module, sig, start, end); if (result.failed()) { + 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, module, sig, start, end); + } + ptrdiff_t pc = result.error_pc - result.start; ptrdiff_t pt = result.error_pt - result.start; std::ostringstream str; @@ -415,7 +423,8 @@ class WasmFunctionWrapper : public HandleAndZoneScope, r.LowerGraph(); } - CompilationInfo info(ArrayVector("testing"), isolate, graph()->zone()); + CompilationInfo info(ArrayVector("testing"), isolate, graph()->zone(), + Code::ComputeFlags(Code::STUB)); code_ = Pipeline::GenerateCodeForTesting(&info, descriptor, graph(), nullptr); CHECK(!code_.is_null()); @@ -748,7 +757,7 @@ class WasmRunner { WasmInterpreter* interpreter() { return compiler_.interpreter_; } protected: - v8::base::AccountingAllocator allocator_; + v8::internal::AccountingAllocator allocator_; Zone zone; bool compiled_; LocalType storage_[WASM_RUNNER_MAX_NUM_PARAMETERS]; diff --git a/deps/v8/test/common/DEPS b/deps/v8/test/common/DEPS new file mode 100644 index 0000000000..3e73aa244f --- /dev/null +++ b/deps/v8/test/common/DEPS @@ -0,0 +1,3 @@ +include_rules = [ + "+src", +] diff --git a/deps/v8/test/cctest/wasm/test-signatures.h b/deps/v8/test/common/wasm/test-signatures.h index 95f24cbb93..3bf53f6867 100644 --- a/deps/v8/test/cctest/wasm/test-signatures.h +++ b/deps/v8/test/common/wasm/test-signatures.h @@ -30,7 +30,9 @@ class TestSignatures { sig_l_l(1, 1, kLongTypes4), sig_l_ll(1, 2, kLongTypes4), sig_i_ll(1, 2, kIntLongTypes4), + sig_f_f(1, 1, kFloatTypes4), sig_f_ff(1, 2, kFloatTypes4), + sig_d_d(1, 1, kDoubleTypes4), sig_d_dd(1, 2, kDoubleTypes4), sig_v_v(0, 0, kIntTypes4), sig_v_i(0, 1, kIntTypes4), @@ -67,7 +69,9 @@ class TestSignatures { FunctionSig* l_ll() { return &sig_l_ll; } FunctionSig* i_ll() { return &sig_i_ll; } + FunctionSig* f_f() { return &sig_f_f; } FunctionSig* f_ff() { return &sig_f_ff; } + FunctionSig* d_d() { return &sig_d_d; } FunctionSig* d_dd() { return &sig_d_dd; } FunctionSig* v_v() { return &sig_v_v; } @@ -110,7 +114,9 @@ class TestSignatures { FunctionSig sig_l_ll; FunctionSig sig_i_ll; + FunctionSig sig_f_f; FunctionSig sig_f_ff; + FunctionSig sig_d_d; FunctionSig sig_d_dd; FunctionSig sig_v_v; diff --git a/deps/v8/test/common/wasm/wasm-module-runner.cc b/deps/v8/test/common/wasm/wasm-module-runner.cc new file mode 100644 index 0000000000..15c3ef433f --- /dev/null +++ b/deps/v8/test/common/wasm/wasm-module-runner.cc @@ -0,0 +1,231 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/common/wasm/wasm-module-runner.h" + +#include "src/handles.h" +#include "src/isolate.h" +#include "src/objects.h" +#include "src/property-descriptor.h" +#include "src/wasm/module-decoder.h" +#include "src/wasm/wasm-interpreter.h" +#include "src/wasm/wasm-js.h" +#include "src/wasm/wasm-module.h" +#include "src/wasm/wasm-result.h" + +namespace v8 { +namespace internal { +namespace wasm { +namespace testing { + +uint32_t GetMinModuleMemSize(const WasmModule* module) { + return WasmModule::kPageSize * module->min_mem_pages; +} + +const WasmModule* DecodeWasmModuleForTesting(Isolate* isolate, Zone* zone, + ErrorThrower* thrower, + const byte* module_start, + const byte* module_end, + ModuleOrigin origin) { + // Decode the module, but don't verify function bodies, since we'll + // be compiling them anyway. + ModuleResult decoding_result = + DecodeWasmModule(isolate, zone, module_start, module_end, false, origin); + + std::unique_ptr<const WasmModule> module(decoding_result.val); + if (decoding_result.failed()) { + // Module verification failed. throw. + thrower->Error("WASM.compileRun() failed: %s", + decoding_result.error_msg.get()); + return nullptr; + } + + if (thrower->error()) return nullptr; + return module.release(); +} + +const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate, + ErrorThrower* thrower, + const WasmModule* module) { + CHECK(module != nullptr); + + if (module->import_table.size() > 0) { + thrower->Error("Not supported: module has imports."); + } + if (module->export_table.size() == 0) { + thrower->Error("Not supported: module has no exports."); + } + if (thrower->error()) return Handle<JSObject>::null(); + + // Although we decoded the module for some pre-validation, run the bytes + // again through the normal pipeline. + MaybeHandle<JSObject> module_object = CreateModuleObjectFromBytes( + isolate, module->module_start, module->module_end, thrower, + ModuleOrigin::kWasmOrigin); + if (module_object.is_null()) { + thrower->Error("Module pre-validation failed."); + return Handle<JSObject>::null(); + } + MaybeHandle<JSObject> maybe_instance = WasmModule::Instantiate( + isolate, thrower, module_object.ToHandleChecked(), + Handle<JSReceiver>::null(), Handle<JSArrayBuffer>::null()); + Handle<JSObject> instance; + if (!maybe_instance.ToHandle(&instance)) { + return Handle<JSObject>::null(); + } + return instance; +} + +const Handle<JSObject> CompileInstantiateWasmModuleForTesting( + Isolate* isolate, Zone* zone, const byte* module_start, + const byte* module_end, ModuleOrigin origin) { + ErrorThrower thrower(isolate, "CompileInstantiateWasmModule"); + std::unique_ptr<const WasmModule> module(DecodeWasmModuleForTesting( + isolate, zone, &thrower, module_start, module_end, origin)); + + if (module == nullptr) { + thrower.Error("Wasm module decode failed"); + return Handle<JSObject>::null(); + } + return InstantiateModuleForTesting(isolate, &thrower, module.get()); +} + +int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance, + int argc, Handle<Object> argv[], + ModuleOrigin origin) { + ErrorThrower thrower(isolate, "RunWasmModule"); + const char* f_name = origin == ModuleOrigin::kAsmJsOrigin ? "caller" : "main"; + return CallWasmFunctionForTesting(isolate, instance, &thrower, f_name, argc, + argv, origin); +} + +int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, + const byte* module_end, ModuleOrigin origin) { + HandleScope scope(isolate); + Zone zone(isolate->allocator()); + + Handle<JSObject> instance = CompileInstantiateWasmModuleForTesting( + isolate, &zone, module_start, module_end, origin); + if (instance.is_null()) { + return -1; + } + return RunWasmModuleForTesting(isolate, instance, 0, nullptr, origin); +} + +int32_t InterpretWasmModule(Isolate* isolate, ErrorThrower* thrower, + const WasmModule* module, int function_index, + WasmVal* args) { + CHECK(module != nullptr); + + Zone zone(isolate->allocator()); + v8::internal::HandleScope scope(isolate); + + if (module->import_table.size() > 0) { + thrower->Error("Not supported: module has imports."); + } + if (module->export_table.size() == 0) { + thrower->Error("Not supported: module has no exports."); + } + + if (thrower->error()) return -1; + + ModuleEnv module_env; + module_env.module = module; + module_env.origin = module->origin; + + for (size_t i = 0; i < module->functions.size(); i++) { + FunctionBody body = { + &module_env, module->functions[i].sig, module->module_start, + module->module_start + module->functions[i].code_start_offset, + module->module_start + module->functions[i].code_end_offset}; + DecodeResult result = VerifyWasmCode(isolate->allocator(), body); + if (result.failed()) { + thrower->Error("Function did not verify"); + return -1; + } + } + + // The code verifies, we create an instance to run it in the interpreter. + WasmModuleInstance instance(module); + instance.context = isolate->native_context(); + instance.mem_size = GetMinModuleMemSize(module); + // TODO(ahaas): Move memory allocation to wasm-module.cc for better + // encapsulation. + instance.mem_start = + static_cast<byte*>(calloc(GetMinModuleMemSize(module), 1)); + instance.globals_start = nullptr; + module_env.instance = &instance; + + WasmInterpreter interpreter(&instance, isolate->allocator()); + + WasmInterpreter::Thread* thread = interpreter.GetThread(0); + thread->Reset(); + thread->PushFrame(&(module->functions[function_index]), args); + WasmInterpreter::State interpreter_result = thread->Run(); + if (instance.mem_start) { + free(instance.mem_start); + } + if (interpreter_result == WasmInterpreter::FINISHED) { + WasmVal val = thread->GetReturnValue(); + return val.to<int32_t>(); + } else if (thread->state() == WasmInterpreter::TRAPPED) { + return 0xdeadbeef; + } else { + thrower->Error( + "Interpreter did not finish execution within its step bound"); + return -1; + } +} + +int32_t CallWasmFunctionForTesting(Isolate* isolate, Handle<JSObject> instance, + ErrorThrower* thrower, const char* name, + int argc, Handle<Object> argv[], + ModuleOrigin origin) { + Handle<JSObject> exports_object; + if (origin == ModuleOrigin::kAsmJsOrigin) { + exports_object = instance; + } else { + Handle<Name> exports = isolate->factory()->InternalizeUtf8String("exports"); + exports_object = Handle<JSObject>::cast( + JSObject::GetProperty(instance, exports).ToHandleChecked()); + } + Handle<Name> main_name = isolate->factory()->NewStringFromAsciiChecked(name); + PropertyDescriptor desc; + Maybe<bool> property_found = JSReceiver::GetOwnPropertyDescriptor( + isolate, exports_object, main_name, &desc); + if (!property_found.FromMaybe(false)) return -1; + + Handle<JSFunction> main_export = Handle<JSFunction>::cast(desc.value()); + + // Call the JS function. + Handle<Object> undefined = isolate->factory()->undefined_value(); + MaybeHandle<Object> retval = + Execution::Call(isolate, main_export, undefined, argc, argv); + + // The result should be a number. + if (retval.is_null()) { + thrower->Error("WASM.compileRun() failed: Invocation was null"); + return -1; + } + Handle<Object> result = retval.ToHandleChecked(); + if (result->IsSmi()) { + return Smi::cast(*result)->value(); + } + if (result->IsHeapNumber()) { + return static_cast<int32_t>(HeapNumber::cast(*result)->value()); + } + thrower->Error("WASM.compileRun() failed: Return value should be number"); + return -1; +} + +void SetupIsolateForWasmModule(Isolate* isolate) { + WasmJs::InstallWasmMapsIfNeeded(isolate, isolate->native_context()); + WasmJs::InstallWasmModuleSymbolIfNeeded(isolate, isolate->global_object(), + isolate->native_context()); +} + +} // namespace testing +} // namespace wasm +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/common/wasm/wasm-module-runner.h b/deps/v8/test/common/wasm/wasm-module-runner.h new file mode 100644 index 0000000000..780d23e06f --- /dev/null +++ b/deps/v8/test/common/wasm/wasm-module-runner.h @@ -0,0 +1,66 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef V8_WASM_MODULE_RUNNER_H_ +#define V8_WASM_MODULE_RUNNER_H_ + +#include "src/handles.h" +#include "src/isolate.h" +#include "src/objects.h" +#include "src/wasm/wasm-interpreter.h" +#include "src/wasm/wasm-module.h" +#include "src/wasm/wasm-result.h" +#include "src/zone/zone.h" + +namespace v8 { +namespace internal { +namespace wasm { +namespace testing { + +// Decodes the given encoded module. +const WasmModule* DecodeWasmModuleForTesting(Isolate* isolate, Zone* zone, + ErrorThrower* thrower, + const byte* module_start, + const byte* module_end, + ModuleOrigin origin); + +// Instantiates a module without any imports and exports. +const Handle<JSObject> InstantiateModuleForTesting(Isolate* isolate, + ErrorThrower* thrower, + const WasmModule* module); + +int32_t CallWasmFunctionForTesting(Isolate* isolate, Handle<JSObject> instance, + ErrorThrower* thrower, const char* name, + int argc, Handle<Object> argv[], + ModuleOrigin origin); + +// Decode, verify, and run the function labeled "main" in the +// given encoded module. The module should have no imports. +int32_t CompileAndRunWasmModule(Isolate* isolate, const byte* module_start, + const byte* module_end, ModuleOrigin origin); + +// Interprets the given module, starting at the function specified by +// {function_index}. The return type of the function has to be int32. The module +// should not have any imports or exports +int32_t InterpretWasmModule(Isolate* isolate, ErrorThrower* thrower, + const WasmModule* module, int function_index, + WasmVal* args); + +// Compiles WasmModule bytes and return an instance of the compiled module. +const Handle<JSObject> CompileInstantiateWasmModuleForTesting( + Isolate* isolate, Zone* zone, const byte* module_start, + const byte* module_end, ModuleOrigin origin); + +// Runs the module instance with arguments. +int32_t RunWasmModuleForTesting(Isolate* isolate, Handle<JSObject> instance, + int argc, Handle<Object> argv[], + ModuleOrigin origin); +// Install function map, module symbol for testing +void SetupIsolateForWasmModule(Isolate* isolate); +} // namespace testing +} // namespace wasm +} // namespace internal +} // namespace v8 + +#endif // V8_WASM_MODULE_RUNNER_H_ diff --git a/deps/v8/test/fuzzer/fuzzer.gyp b/deps/v8/test/fuzzer/fuzzer.gyp index c7c4cb47ba..f8629f6030 100644 --- a/deps/v8/test/fuzzer/fuzzer.gyp +++ b/deps/v8/test/fuzzer/fuzzer.gyp @@ -51,7 +51,7 @@ 'target_name': 'parser_fuzzer_lib', 'type': 'static_library', 'dependencies': [ - 'fuzzer_support', + 'fuzzer_support_nocomponent', ], 'include_dirs': [ '../..', @@ -110,6 +110,8 @@ ], 'sources': [ ### gcmole(all) ### 'wasm.cc', + '../common/wasm/wasm-module-runner.cc', + '../common/wasm/wasm-module-runner.h', ], }, { @@ -136,12 +138,268 @@ ], 'sources': [ ### gcmole(all) ### 'wasm-asmjs.cc', + '../common/wasm/wasm-module-runner.cc', + '../common/wasm/wasm-module-runner.h', + ], + }, + { + 'target_name': 'v8_simple_wasm_code_fuzzer', + 'type': 'executable', + 'dependencies': [ + 'wasm_code_fuzzer_lib', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ + 'fuzzer.cc', + ], + }, + { + 'target_name': 'wasm_code_fuzzer_lib', + 'type': 'static_library', + 'dependencies': [ + 'fuzzer_support', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ ### gcmole(all) ### + 'wasm-code.cc', + '../common/wasm/test-signatures.h', + '../common/wasm/wasm-module-runner.cc', + '../common/wasm/wasm-module-runner.h', + ], + }, + { + 'target_name': 'v8_simple_wasm_data_section_fuzzer', + 'type': 'executable', + 'dependencies': [ + 'wasm_data_section_fuzzer_lib', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ + 'fuzzer.cc', + ], + }, + { + 'target_name': 'wasm_data_section_fuzzer_lib', + 'type': 'static_library', + 'dependencies': [ + 'fuzzer_support', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ ### gcmole(all) ### + 'wasm-data-section.cc', + '../common/wasm/wasm-module-runner.cc', + '../common/wasm/wasm-module-runner.h', + 'wasm-section-fuzzers.cc', + 'wasm-section-fuzzers.h', + ], + }, + { + 'target_name': 'v8_simple_wasm_function_sigs_section_fuzzer', + 'type': 'executable', + 'dependencies': [ + 'wasm_function_sigs_section_fuzzer_lib', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ + 'fuzzer.cc', + ], + }, + { + 'target_name': 'wasm_function_sigs_section_fuzzer_lib', + 'type': 'static_library', + 'dependencies': [ + 'fuzzer_support', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ ### gcmole(all) ### + 'wasm-function-sigs-section.cc', + '../common/wasm/wasm-module-runner.cc', + '../common/wasm/wasm-module-runner.h', + 'wasm-section-fuzzers.cc', + 'wasm-section-fuzzers.h', + ], + }, + { + 'target_name': 'v8_simple_wasm_globals_section_fuzzer', + 'type': 'executable', + 'dependencies': [ + 'wasm_globals_section_fuzzer_lib', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ + 'fuzzer.cc', + ], + }, + { + 'target_name': 'wasm_globals_section_fuzzer_lib', + 'type': 'static_library', + 'dependencies': [ + 'fuzzer_support', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ ### gcmole(all) ### + 'wasm-globals-section.cc', + '../common/wasm/wasm-module-runner.cc', + '../common/wasm/wasm-module-runner.h', + 'wasm-section-fuzzers.cc', + 'wasm-section-fuzzers.h', + ], + }, + { + 'target_name': 'v8_simple_wasm_imports_section_fuzzer', + 'type': 'executable', + 'dependencies': [ + 'wasm_imports_section_fuzzer_lib', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ + 'fuzzer.cc', + ], + }, + { + 'target_name': 'wasm_imports_section_fuzzer_lib', + 'type': 'static_library', + 'dependencies': [ + 'fuzzer_support', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ ### gcmole(all) ### + 'wasm-imports-section.cc', + '../common/wasm/wasm-module-runner.cc', + '../common/wasm/wasm-module-runner.h', + 'wasm-section-fuzzers.cc', + 'wasm-section-fuzzers.h', + ], + }, + { + 'target_name': 'v8_simple_wasm_memory_section_fuzzer', + 'type': 'executable', + 'dependencies': [ + 'wasm_memory_section_fuzzer_lib', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ + 'fuzzer.cc', + ], + }, + { + 'target_name': 'wasm_memory_section_fuzzer_lib', + 'type': 'static_library', + 'dependencies': [ + 'fuzzer_support', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ ### gcmole(all) ### + 'wasm-memory-section.cc', + '../common/wasm/wasm-module-runner.cc', + '../common/wasm/wasm-module-runner.h', + 'wasm-section-fuzzers.cc', + 'wasm-section-fuzzers.h', + ], + }, + { + 'target_name': 'v8_simple_wasm_names_section_fuzzer', + 'type': 'executable', + 'dependencies': [ + 'wasm_names_section_fuzzer_lib', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ + 'fuzzer.cc', + ], + }, + { + 'target_name': 'wasm_names_section_fuzzer_lib', + 'type': 'static_library', + 'dependencies': [ + 'fuzzer_support', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ ### gcmole(all) ### + 'wasm-names-section.cc', + '../common/wasm/wasm-module-runner.cc', + '../common/wasm/wasm-module-runner.h', + 'wasm-section-fuzzers.cc', + 'wasm-section-fuzzers.h', + ], + }, + { + 'target_name': 'v8_simple_wasm_types_section_fuzzer', + 'type': 'executable', + 'dependencies': [ + 'wasm_types_section_fuzzer_lib', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ + 'fuzzer.cc', + ], + }, + { + 'target_name': 'wasm_types_section_fuzzer_lib', + 'type': 'static_library', + 'dependencies': [ + 'fuzzer_support', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ ### gcmole(all) ### + 'wasm-types-section.cc', + '../common/wasm/wasm-module-runner.cc', + '../common/wasm/wasm-module-runner.h', + 'wasm-section-fuzzers.cc', + 'wasm-section-fuzzers.h', ], }, { 'target_name': 'fuzzer_support', 'type': 'static_library', 'dependencies': [ + '../../src/v8.gyp:v8', + '../../src/v8.gyp:v8_libplatform', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ ### gcmole(all) ### + 'fuzzer-support.cc', + 'fuzzer-support.h', + ], + }, + { + 'target_name': 'fuzzer_support_nocomponent', + 'type': 'static_library', + 'dependencies': [ '../../src/v8.gyp:v8_libplatform', ], 'include_dirs': [ diff --git a/deps/v8/test/fuzzer/fuzzer.isolate b/deps/v8/test/fuzzer/fuzzer.isolate index 2611c72104..6b93c53481 100644 --- a/deps/v8/test/fuzzer/fuzzer.isolate +++ b/deps/v8/test/fuzzer/fuzzer.isolate @@ -10,6 +10,14 @@ '<(PRODUCT_DIR)/v8_simple_regexp_fuzzer<(EXECUTABLE_SUFFIX)', '<(PRODUCT_DIR)/v8_simple_wasm_fuzzer<(EXECUTABLE_SUFFIX)', '<(PRODUCT_DIR)/v8_simple_wasm_asmjs_fuzzer<(EXECUTABLE_SUFFIX)', + '<(PRODUCT_DIR)/v8_simple_wasm_code_fuzzer<(EXECUTABLE_SUFFIX)', + '<(PRODUCT_DIR)/v8_simple_wasm_data_section_fuzzer<(EXECUTABLE_SUFFIX)', + '<(PRODUCT_DIR)/v8_simple_wasm_function_sigs_section_fuzzer<(EXECUTABLE_SUFFIX)', + '<(PRODUCT_DIR)/v8_simple_wasm_globals_section_fuzzer<(EXECUTABLE_SUFFIX)', + '<(PRODUCT_DIR)/v8_simple_wasm_imports_section_fuzzer<(EXECUTABLE_SUFFIX)', + '<(PRODUCT_DIR)/v8_simple_wasm_memory_section_fuzzer<(EXECUTABLE_SUFFIX)', + '<(PRODUCT_DIR)/v8_simple_wasm_names_section_fuzzer<(EXECUTABLE_SUFFIX)', + '<(PRODUCT_DIR)/v8_simple_wasm_types_section_fuzzer<(EXECUTABLE_SUFFIX)', './fuzzer.status', './testcfg.py', './json/', @@ -17,6 +25,14 @@ './regexp/', './wasm/', './wasm_asmjs/', + './wasm_code/', + './wasm_data_section/', + './wasm_function_sigs_section/', + './wasm_globals_section/', + './wasm_imports_section/', + './wasm_memory_section/', + './wasm_names_section/', + './wasm_types_section/', ], }, 'includes': [ diff --git a/deps/v8/test/fuzzer/testcfg.py b/deps/v8/test/fuzzer/testcfg.py index 85a38eda08..830b459742 100644 --- a/deps/v8/test/fuzzer/testcfg.py +++ b/deps/v8/test/fuzzer/testcfg.py @@ -18,7 +18,10 @@ class FuzzerVariantGenerator(testsuite.VariantGenerator): class FuzzerTestSuite(testsuite.TestSuite): - SUB_TESTS = ( 'json', 'parser', 'regexp', 'wasm', 'wasm_asmjs', ) + SUB_TESTS = ( 'json', 'parser', 'regexp', 'wasm', 'wasm_asmjs', 'wasm_code', + 'wasm_data_section', 'wasm_function_sigs_section', + 'wasm_globals_section', 'wasm_imports_section', 'wasm_memory_section', + 'wasm_names_section', 'wasm_types_section' ) def __init__(self, name, root): super(FuzzerTestSuite, self).__init__(name, root) diff --git a/deps/v8/test/fuzzer/wasm-asmjs.cc b/deps/v8/test/fuzzer/wasm-asmjs.cc index cb8b86bad4..d3341fa5b3 100644 --- a/deps/v8/test/fuzzer/wasm-asmjs.cc +++ b/deps/v8/test/fuzzer/wasm-asmjs.cc @@ -12,8 +12,8 @@ #include "src/isolate.h" #include "src/objects-inl.h" #include "src/objects.h" -#include "src/wasm/wasm-js.h" #include "src/wasm/wasm-module.h" +#include "test/common/wasm/wasm-module-runner.h" #include "test/fuzzer/fuzzer-support.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { @@ -31,9 +31,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { v8::HandleScope handle_scope(isolate); v8::Context::Scope context_scope(support->GetContext()); v8::TryCatch try_catch(isolate); - v8::internal::WasmJs::InstallWasmFunctionMap(i_isolate, - i_isolate->native_context()); - v8::internal::wasm::testing::CompileAndRunWasmModule(i_isolate, data, - data + size, true); + v8::internal::wasm::testing::SetupIsolateForWasmModule(i_isolate); + v8::internal::wasm::testing::CompileAndRunWasmModule( + i_isolate, data, data + size, + v8::internal::wasm::ModuleOrigin::kAsmJsOrigin); return 0; } diff --git a/deps/v8/test/fuzzer/wasm-code.cc b/deps/v8/test/fuzzer/wasm-code.cc new file mode 100644 index 0000000000..13b665137d --- /dev/null +++ b/deps/v8/test/fuzzer/wasm-code.cc @@ -0,0 +1,104 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <stddef.h> +#include <stdint.h> + +#include "include/v8.h" +#include "src/isolate.h" +#include "src/objects.h" +#include "src/wasm/wasm-interpreter.h" +#include "src/wasm/wasm-module-builder.h" +#include "src/wasm/wasm-module.h" +#include "test/common/wasm/test-signatures.h" +#include "test/common/wasm/wasm-module-runner.h" +#include "test/fuzzer/fuzzer-support.h" + +#define WASM_CODE_FUZZER_HASH_SEED 83 + +using namespace v8::internal::wasm; + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + v8_fuzzer::FuzzerSupport* support = v8_fuzzer::FuzzerSupport::Get(); + v8::Isolate* isolate = support->GetIsolate(); + v8::internal::Isolate* i_isolate = + reinterpret_cast<v8::internal::Isolate*>(isolate); + + // Clear any pending exceptions from a prior run. + if (i_isolate->has_pending_exception()) { + i_isolate->clear_pending_exception(); + } + + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Context::Scope context_scope(support->GetContext()); + v8::TryCatch try_catch(isolate); + + v8::internal::AccountingAllocator allocator; + v8::internal::Zone zone(&allocator); + + TestSignatures sigs; + + WasmModuleBuilder builder(&zone); + + v8::internal::wasm::WasmFunctionBuilder* f = + builder.AddFunction(sigs.i_iii()); + f->EmitCode(data, static_cast<uint32_t>(size)); + f->SetExported(); + f->SetName("main", 4); + + ZoneBuffer buffer(&zone); + builder.WriteTo(buffer); + + v8::internal::wasm::testing::SetupIsolateForWasmModule(i_isolate); + + v8::internal::HandleScope scope(i_isolate); + + ErrorThrower interpreter_thrower(i_isolate, "Interpreter"); + std::unique_ptr<const WasmModule> module(testing::DecodeWasmModuleForTesting( + i_isolate, &zone, &interpreter_thrower, buffer.begin(), buffer.end(), + v8::internal::wasm::ModuleOrigin::kWasmOrigin)); + + if (module == nullptr) { + return 0; + } + int32_t result_interpreted; + { + WasmVal args[] = {WasmVal(1), WasmVal(2), WasmVal(3)}; + result_interpreted = testing::InterpretWasmModule( + i_isolate, &interpreter_thrower, module.get(), 0, args); + } + + ErrorThrower compiler_thrower(i_isolate, "Compiler"); + v8::internal::Handle<v8::internal::JSObject> instance = + testing::InstantiateModuleForTesting(i_isolate, &compiler_thrower, + module.get()); + + if (!interpreter_thrower.error()) { + CHECK(!instance.is_null()); + } else { + return 0; + } + int32_t result_compiled; + { + v8::internal::Handle<v8::internal::Object> arguments[] = { + v8::internal::handle(v8::internal::Smi::FromInt(1), i_isolate), + v8::internal::handle(v8::internal::Smi::FromInt(2), i_isolate), + v8::internal::handle(v8::internal::Smi::FromInt(3), i_isolate)}; + result_compiled = testing::CallWasmFunctionForTesting( + i_isolate, instance, &compiler_thrower, "main", arraysize(arguments), + arguments, v8::internal::wasm::ModuleOrigin::kWasmOrigin); + } + if (result_interpreted == 0xdeadbeef) { + CHECK(i_isolate->has_pending_exception()); + i_isolate->clear_pending_exception(); + } else { + if (result_interpreted != result_compiled) { + V8_Fatal(__FILE__, __LINE__, "WasmCodeFuzzerHash=%x", + v8::internal::StringHasher::HashSequentialString( + data, static_cast<int>(size), WASM_CODE_FUZZER_HASH_SEED)); + } + } + return 0; +} diff --git a/deps/v8/test/fuzzer/wasm-data-section.cc b/deps/v8/test/fuzzer/wasm-data-section.cc new file mode 100644 index 0000000000..2fbdbcd906 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm-data-section.cc @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/fuzzer/wasm-section-fuzzers.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + return fuzz_wasm_section(v8::internal::wasm::kDataSectionCode, data, size); +} diff --git a/deps/v8/test/fuzzer/wasm-function-sigs-section.cc b/deps/v8/test/fuzzer/wasm-function-sigs-section.cc new file mode 100644 index 0000000000..a0b66e12d0 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm-function-sigs-section.cc @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/fuzzer/wasm-section-fuzzers.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + return fuzz_wasm_section(v8::internal::wasm::kFunctionSectionCode, data, + size); +} diff --git a/deps/v8/test/fuzzer/wasm-globals-section.cc b/deps/v8/test/fuzzer/wasm-globals-section.cc new file mode 100644 index 0000000000..a58ef0f2b5 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm-globals-section.cc @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/fuzzer/wasm-section-fuzzers.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + return fuzz_wasm_section(v8::internal::wasm::kGlobalSectionCode, data, size); +} diff --git a/deps/v8/test/fuzzer/wasm-imports-section.cc b/deps/v8/test/fuzzer/wasm-imports-section.cc new file mode 100644 index 0000000000..d6513e59dc --- /dev/null +++ b/deps/v8/test/fuzzer/wasm-imports-section.cc @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/fuzzer/wasm-section-fuzzers.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + return fuzz_wasm_section(v8::internal::wasm::kImportSectionCode, data, size); +} diff --git a/deps/v8/test/fuzzer/wasm-memory-section.cc b/deps/v8/test/fuzzer/wasm-memory-section.cc new file mode 100644 index 0000000000..77065f1729 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm-memory-section.cc @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/fuzzer/wasm-section-fuzzers.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + return fuzz_wasm_section(v8::internal::wasm::kMemorySectionCode, data, size); +} diff --git a/deps/v8/test/fuzzer/wasm-names-section.cc b/deps/v8/test/fuzzer/wasm-names-section.cc new file mode 100644 index 0000000000..01846823ff --- /dev/null +++ b/deps/v8/test/fuzzer/wasm-names-section.cc @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/fuzzer/wasm-section-fuzzers.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + // TODO(titzer): Names section requires a preceding function section. + return fuzz_wasm_section(v8::internal::wasm::kNameSectionCode, data, size); +} diff --git a/deps/v8/test/fuzzer/wasm-section-fuzzers.cc b/deps/v8/test/fuzzer/wasm-section-fuzzers.cc new file mode 100644 index 0000000000..e95beba0fd --- /dev/null +++ b/deps/v8/test/fuzzer/wasm-section-fuzzers.cc @@ -0,0 +1,63 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/fuzzer/wasm-section-fuzzers.h" + +#include "include/v8.h" +#include "src/isolate.h" +#include "src/wasm/wasm-module-builder.h" +#include "src/wasm/wasm-module.h" +#include "src/zone/accounting-allocator.h" +#include "src/zone/zone.h" +#include "test/common/wasm/wasm-module-runner.h" +#include "test/fuzzer/fuzzer-support.h" + +using namespace v8::internal::wasm; + +static const char* kNameString = "name"; +static const size_t kNameStringLength = 4; + +int fuzz_wasm_section(WasmSectionCode section, const uint8_t* data, + size_t size) { + v8_fuzzer::FuzzerSupport* support = v8_fuzzer::FuzzerSupport::Get(); + v8::Isolate* isolate = support->GetIsolate(); + v8::internal::Isolate* i_isolate = + reinterpret_cast<v8::internal::Isolate*>(isolate); + + // Clear any pending exceptions from a prior run. + if (i_isolate->has_pending_exception()) { + i_isolate->clear_pending_exception(); + } + + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Context::Scope context_scope(support->GetContext()); + v8::TryCatch try_catch(isolate); + + v8::internal::AccountingAllocator allocator; + v8::internal::Zone zone(&allocator); + + ZoneBuffer buffer(&zone); + buffer.write_u32(kWasmMagic); + buffer.write_u32(kWasmVersion); + if (section == kNameSectionCode) { + buffer.write_u8(kUnknownSectionCode); + buffer.write_size(size + kNameStringLength + 1); + buffer.write_u8(kNameStringLength); + buffer.write(reinterpret_cast<const uint8_t*>(kNameString), + kNameStringLength); + buffer.write(data, size); + } else { + buffer.write_u8(section); + buffer.write_size(size); + buffer.write(data, size); + } + + ErrorThrower thrower(i_isolate, "decoder"); + + std::unique_ptr<const WasmModule> module(testing::DecodeWasmModuleForTesting( + i_isolate, &zone, &thrower, buffer.begin(), buffer.end(), kWasmOrigin)); + + return 0; +} diff --git a/deps/v8/test/fuzzer/wasm-section-fuzzers.h b/deps/v8/test/fuzzer/wasm-section-fuzzers.h new file mode 100644 index 0000000000..a28ada134e --- /dev/null +++ b/deps/v8/test/fuzzer/wasm-section-fuzzers.h @@ -0,0 +1,16 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef WASM_SECTION_FUZZERS_H_ +#define WASM_SECTION_FUZZERS_H_ + +#include <stddef.h> +#include <stdint.h> + +#include "src/wasm/wasm-module.h" + +int fuzz_wasm_section(v8::internal::wasm::WasmSectionCode section, + const uint8_t* data, size_t size); + +#endif // WASM_SECTION_FUZZERS_H_ diff --git a/deps/v8/test/fuzzer/wasm-types-section.cc b/deps/v8/test/fuzzer/wasm-types-section.cc new file mode 100644 index 0000000000..7d5fe65277 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm-types-section.cc @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/fuzzer/wasm-section-fuzzers.h" + +extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { + return fuzz_wasm_section(v8::internal::wasm::kTypeSectionCode, data, size); +} diff --git a/deps/v8/test/fuzzer/wasm.cc b/deps/v8/test/fuzzer/wasm.cc index 27259c6417..933be71344 100644 --- a/deps/v8/test/fuzzer/wasm.cc +++ b/deps/v8/test/fuzzer/wasm.cc @@ -12,8 +12,8 @@ #include "src/isolate.h" #include "src/objects-inl.h" #include "src/objects.h" -#include "src/wasm/wasm-js.h" #include "src/wasm/wasm-module.h" +#include "test/common/wasm/wasm-module-runner.h" #include "test/fuzzer/fuzzer-support.h" extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { @@ -31,9 +31,8 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { v8::HandleScope handle_scope(isolate); v8::Context::Scope context_scope(support->GetContext()); v8::TryCatch try_catch(isolate); - v8::internal::WasmJs::InstallWasmFunctionMap(i_isolate, - i_isolate->native_context()); - v8::internal::wasm::testing::CompileAndRunWasmModule(i_isolate, data, - data + size, false); + v8::internal::wasm::testing::SetupIsolateForWasmModule(i_isolate); + v8::internal::wasm::testing::CompileAndRunWasmModule( + i_isolate, data, data + size, v8::internal::wasm::kWasmOrigin); return 0; } diff --git a/deps/v8/test/fuzzer/wasm.tar.gz.sha1 b/deps/v8/test/fuzzer/wasm.tar.gz.sha1 new file mode 100644 index 0000000000..9fc4cf50d2 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm.tar.gz.sha1 @@ -0,0 +1 @@ +43dbe4810e9b08a5add1dd4076e26410e18c828c
\ No newline at end of file diff --git a/deps/v8/test/fuzzer/wasm/foo.wasm b/deps/v8/test/fuzzer/wasm/foo.wasm Binary files differdeleted file mode 100644 index 79cd64b50c..0000000000 --- a/deps/v8/test/fuzzer/wasm/foo.wasm +++ /dev/null diff --git a/deps/v8/test/fuzzer/wasm_asmjs.tar.gz.sha1 b/deps/v8/test/fuzzer/wasm_asmjs.tar.gz.sha1 new file mode 100644 index 0000000000..b8cf779dee --- /dev/null +++ b/deps/v8/test/fuzzer/wasm_asmjs.tar.gz.sha1 @@ -0,0 +1 @@ +3a2c9658f3f644c7b8c309201b964fedc2766f9c
\ No newline at end of file diff --git a/deps/v8/test/fuzzer/wasm_asmjs/foo.wasm b/deps/v8/test/fuzzer/wasm_asmjs/foo.wasm Binary files differdeleted file mode 100644 index 79cd64b50c..0000000000 --- a/deps/v8/test/fuzzer/wasm_asmjs/foo.wasm +++ /dev/null diff --git a/deps/v8/test/fuzzer/wasm_code/foo b/deps/v8/test/fuzzer/wasm_code/foo new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm_code/foo diff --git a/deps/v8/test/fuzzer/wasm_data_section/foo b/deps/v8/test/fuzzer/wasm_data_section/foo new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm_data_section/foo diff --git a/deps/v8/test/fuzzer/wasm_function_sigs_section/foo b/deps/v8/test/fuzzer/wasm_function_sigs_section/foo new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm_function_sigs_section/foo diff --git a/deps/v8/test/fuzzer/wasm_globals_section/foo b/deps/v8/test/fuzzer/wasm_globals_section/foo new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm_globals_section/foo diff --git a/deps/v8/test/fuzzer/wasm_imports_section/foo b/deps/v8/test/fuzzer/wasm_imports_section/foo new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm_imports_section/foo diff --git a/deps/v8/test/fuzzer/wasm_memory_section/foo b/deps/v8/test/fuzzer/wasm_memory_section/foo new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm_memory_section/foo diff --git a/deps/v8/test/fuzzer/wasm_names_section/foo b/deps/v8/test/fuzzer/wasm_names_section/foo new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm_names_section/foo diff --git a/deps/v8/test/fuzzer/wasm_types_section/foo b/deps/v8/test/fuzzer/wasm_types_section/foo new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/deps/v8/test/fuzzer/wasm_types_section/foo diff --git a/deps/v8/test/inspector/BUILD.gn b/deps/v8/test/inspector/BUILD.gn new file mode 100644 index 0000000000..cb96bf423c --- /dev/null +++ b/deps/v8/test/inspector/BUILD.gn @@ -0,0 +1,39 @@ +# Copyright 2016 the V8 project authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import("../../gni/v8.gni") + +v8_executable("inspector-test") { + testonly = true + + sources = [ + "inspector-impl.cc", + "inspector-impl.h", + "inspector-test.cc", + "task-runner.cc", + "task-runner.h", + ] + + configs = [ + "../..:external_config", + "../..:internal_config_base", + ] + + deps = [ + "../..:v8_libplatform", + "//build/config/sanitizers:deps", + "//build/win:default_exe_manifest", + ] + + if (is_component_build) { + # inspector-test can't be built against a shared library, so we + # need to depend on the underlying static target in that case. + deps += [ "../..:v8_maybe_snapshot" ] + } else { + deps += [ "../..:v8" ] + } + + cflags = [] + ldflags = [] +} diff --git a/deps/v8/test/inspector/DEPS b/deps/v8/test/inspector/DEPS new file mode 100644 index 0000000000..af99e05595 --- /dev/null +++ b/deps/v8/test/inspector/DEPS @@ -0,0 +1,10 @@ +include_rules = [ + "-src", + "+src/base/macros.h", + "+src/base/platform/platform.h", + "+src/flags.h", + "+src/inspector/string-16.h", + "+src/locked-queue-inl.h", + "+src/utils.h", + "+src/vector.h", +]
\ No newline at end of file diff --git a/deps/v8/test/inspector/OWNERS b/deps/v8/test/inspector/OWNERS new file mode 100644 index 0000000000..9edb707b78 --- /dev/null +++ b/deps/v8/test/inspector/OWNERS @@ -0,0 +1,2 @@ +dgozman@chromium.org +kozyatinskiy@chromium.org diff --git a/deps/v8/test/inspector/console/let-const-with-api-expected.txt b/deps/v8/test/inspector/console/let-const-with-api-expected.txt new file mode 100644 index 0000000000..a5b889632d --- /dev/null +++ b/deps/v8/test/inspector/console/let-const-with-api-expected.txt @@ -0,0 +1,19 @@ +first "let a = 1;" result: wasThrown = false +second "let a = 1;" result: wasThrown = true +exception message: Uncaught SyntaxError: Identifier 'a' has already been declared + at <anonymous>:1:1 +{"result":{"type":"number","value":42,"description":"42"}} +function dir(value) { [Command Line API] } +function dirxml(value) { [Command Line API] } +function keys(object) { [Command Line API] } +function values(object) { [Command Line API] } +function profile(title) { [Command Line API] } +function profileEnd(title) { [Command Line API] } +function inspect(object) { [Command Line API] } +function copy(value) { [Command Line API] } +function clear() { [Command Line API] } +function debug(function) { [Command Line API] } +function undebug(function) { [Command Line API] } +function monitor(function) { [Command Line API] } +function unmonitor(function) { [Command Line API] } +function table(data, [columns]) { [Command Line API] }
\ No newline at end of file diff --git a/deps/v8/test/inspector/console/let-const-with-api.js b/deps/v8/test/inspector/console/let-const-with-api.js new file mode 100644 index 0000000000..0280fe1174 --- /dev/null +++ b/deps/v8/test/inspector/console/let-const-with-api.js @@ -0,0 +1,52 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Protocol.Runtime.evaluate({ expression: "let a = 42;" }).then(step2); + +function step2(response) +{ + failIfError(response); + InspectorTest.log("first \"let a = 1;\" result: wasThrown = " + !!response.result.exceptionDetails); + Protocol.Runtime.evaluate({ expression: "let a = 239;" }).then(step3); +} + +function step3(response) +{ + failIfError(response); + InspectorTest.log("second \"let a = 1;\" result: wasThrown = " + !!response.result.exceptionDetails); + if (response.result.exceptionDetails) + InspectorTest.log("exception message: " + response.result.exceptionDetails.text + " " + response.result.exceptionDetails.exception.description); + Protocol.Runtime.evaluate({ expression: "a" }).then(step4); +} + +function step4(response) +{ + failIfError(response); + InspectorTest.log(JSON.stringify(response.result)); + checkMethod(null); +} + +var methods = [ "dir", "dirxml", "keys", "values", "profile", "profileEnd", + "inspect", "copy", "clear", + "debug", "undebug", "monitor", "unmonitor", "table" ]; + +function checkMethod(response) +{ + failIfError(response); + + if (response) + InspectorTest.log(response.result.result.description); + + var method = methods.shift(); + if (!method) + InspectorTest.completeTest(); + + Protocol.Runtime.evaluate({ expression: method, includeCommandLineAPI: true }).then(checkMethod); +} + +function failIfError(response) +{ + if (response && response.error) + InspectorTest.log("FAIL: " + JSON.stringify(response.error)); +} diff --git a/deps/v8/test/inspector/console/memory-setter-in-strict-mode-expected.txt b/deps/v8/test/inspector/console/memory-setter-in-strict-mode-expected.txt new file mode 100644 index 0000000000..04b60d8c14 --- /dev/null +++ b/deps/v8/test/inspector/console/memory-setter-in-strict-mode-expected.txt @@ -0,0 +1,9 @@ +Tests checks that console.memory property can be set in strict mode (crbug.com/468611). +{ + id : <messageId> + result : { + result : { + type : undefined + } + } +}
\ No newline at end of file diff --git a/deps/v8/test/inspector/console/memory-setter-in-strict-mode.js b/deps/v8/test/inspector/console/memory-setter-in-strict-mode.js new file mode 100644 index 0000000000..11db993bee --- /dev/null +++ b/deps/v8/test/inspector/console/memory-setter-in-strict-mode.js @@ -0,0 +1,13 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Tests checks that console.memory property can be set in strict mode (crbug.com/468611).") + +Protocol.Runtime.evaluate({ expression: "\"use strict\"\nconsole.memory = {};undefined" }).then(dumpResult); + +function dumpResult(result) +{ + InspectorTest.logMessage(result); + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/cpu-profiler/console-profile-end-parameterless-crash-expected.txt b/deps/v8/test/inspector/cpu-profiler/console-profile-end-parameterless-crash-expected.txt new file mode 100644 index 0000000000..a28765a100 --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/console-profile-end-parameterless-crash-expected.txt @@ -0,0 +1,3 @@ +Tests that "console.profileEnd()" does not cause crash. (webkit:105759) +SUCCESS: found 2 profile headers +SUCCESS: titled profile found
\ No newline at end of file diff --git a/deps/v8/test/inspector/cpu-profiler/console-profile-end-parameterless-crash.js b/deps/v8/test/inspector/cpu-profiler/console-profile-end-parameterless-crash.js new file mode 100644 index 0000000000..d266bb0fdc --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/console-profile-end-parameterless-crash.js @@ -0,0 +1,46 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Tests that \"console.profileEnd()\" does not cause crash. (webkit:105759)"); + +InspectorTest.addScript(` +function collectProfiles() +{ + console.profile(); + console.profile("titled"); + console.profileEnd(); + console.profileEnd(); +}`); + +InspectorTest.fail = function(message) +{ + InspectorTest.log("FAIL: " + message); + InspectorTest.completeTest(); +} + +Protocol.Profiler.enable(); +Protocol.Runtime.evaluate({ expression: "collectProfiles()"}).then(didCollectProfiles); + +var headers = []; +Protocol.Profiler.onConsoleProfileFinished(function(messageObject) +{ + headers.push({ + title: messageObject["params"]["title"] + }); +}); + +function didCollectProfiles(messageObject) +{ + if (headers.length !== 2) + return InspectorTest.fail("Cannot retrive headers: " + JSON.stringify(messageObject, null, 4)); + InspectorTest.log("SUCCESS: found 2 profile headers"); + for (var i = 0; i < headers.length; i++) { + if (headers[i].title === "titled") { + InspectorTest.log("SUCCESS: titled profile found"); + InspectorTest.completeTest(); + return; + } + } + InspectorTest.fail("Cannot find titled profile"); +} diff --git a/deps/v8/test/inspector/cpu-profiler/console-profile-expected.txt b/deps/v8/test/inspector/cpu-profiler/console-profile-expected.txt new file mode 100644 index 0000000000..b3da7ba0c1 --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/console-profile-expected.txt @@ -0,0 +1,3 @@ +Tests that console.profile/profileEnd will record CPU profile when inspector front-end is connected. +SUCCESS: retrieved '42' profile +SUCCESS: found 'collectProfiles' function in the profile
\ No newline at end of file diff --git a/deps/v8/test/inspector/cpu-profiler/console-profile.js b/deps/v8/test/inspector/cpu-profiler/console-profile.js new file mode 100644 index 0000000000..84873cd169 --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/console-profile.js @@ -0,0 +1,59 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Tests that console.profile/profileEnd will record CPU profile when inspector front-end is connected."); + +InspectorTest.addScript(` +function collectProfiles() +{ + console.profile("outer"); + console.profile(42); + console.profileEnd("outer"); + console.profileEnd(42); +}`); + +InspectorTest.fail = function(message) +{ + InspectorTest.log("FAIL: " + message); + InspectorTest.completeTest(); +} + +Protocol.Profiler.enable(); +Protocol.Runtime.evaluate({ expression: "collectProfiles()"}).then(didCollectProfiles); + +var headers = []; +Protocol.Profiler.onConsoleProfileFinished(function(messageObject) +{ + headers.push({ + profile: messageObject["params"]["profile"], + title: messageObject["params"]["title"] + }); +}); + +function didCollectProfiles(messageObject) +{ + if (headers.length !== 2) + return InspectorTest.fail("Cannot retrive headers: " + JSON.stringify(messageObject, null, 4)); + for (var i = 0; i < headers.length; i++) { + if (headers[i].title === "42") { + checkInnerProfile(headers[i].profile); + return; + } + } + InspectorTest.fail("Cannot find '42' profile header"); +} + +function checkInnerProfile(profile) +{ + InspectorTest.log("SUCCESS: retrieved '42' profile"); + if (!findFunctionInProfile(profile.nodes, "collectProfiles")) + return InspectorTest.fail("collectProfiles function not found in the profile: " + JSON.stringify(profile, null, 4)); + InspectorTest.log("SUCCESS: found 'collectProfiles' function in the profile"); + InspectorTest.completeTest(); +} + +function findFunctionInProfile(nodes, functionName) +{ + return nodes.some(n => n.callFrame.functionName === functionName); +} diff --git a/deps/v8/test/inspector/cpu-profiler/enable-disable-expected.txt b/deps/v8/test/inspector/cpu-profiler/enable-disable-expected.txt new file mode 100644 index 0000000000..05d3fd3d5f --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/enable-disable-expected.txt @@ -0,0 +1,8 @@ +Test that profiling can only be started when Profiler was enabled and that Profiler.disable command will stop recording all profiles. +PASS: didFailToStartWhenDisabled +PASS: didStartFrontendProfile +PASS: console initiated profile started +PASS: didStartConsoleProfile +PASS: didDisableProfiler +PASS: no front-end initiated profiles found +PASS: didStopConsoleProfile
\ No newline at end of file diff --git a/deps/v8/test/inspector/cpu-profiler/enable-disable.js b/deps/v8/test/inspector/cpu-profiler/enable-disable.js new file mode 100644 index 0000000000..3ed1b74b36 --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/enable-disable.js @@ -0,0 +1,75 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Test that profiling can only be started when Profiler was enabled and that Profiler.disable command will stop recording all profiles."); + +Protocol.Profiler.start().then(didFailToStartWhenDisabled); +disallowConsoleProfiles(); + +function disallowConsoleProfiles() +{ + Protocol.Profiler.onConsoleProfileStarted(function(messageObject) + { + InspectorTest.log("FAIL: console profile started " + JSON.stringify(messageObject, null, 4)); + }); + Protocol.Profiler.onConsoleProfileFinished(function(messageObject) + { + InspectorTest.log("FAIL: unexpected profile received " + JSON.stringify(messageObject, null, 4)); + }); +} +function allowConsoleProfiles() +{ + Protocol.Profiler.onConsoleProfileStarted(function(messageObject) + { + InspectorTest.log("PASS: console initiated profile started"); + }); + Protocol.Profiler.onConsoleProfileFinished(function(messageObject) + { + InspectorTest.log("PASS: console initiated profile received"); + }); +} +function didFailToStartWhenDisabled(messageObject) +{ + if (!InspectorTest.expectedError("didFailToStartWhenDisabled", messageObject)) + return; + allowConsoleProfiles(); + Protocol.Profiler.enable(); + Protocol.Profiler.start().then(didStartFrontendProfile); +} +function didStartFrontendProfile(messageObject) +{ + if (!InspectorTest.expectedSuccess("didStartFrontendProfile", messageObject)) + return; + Protocol.Runtime.evaluate({expression: "console.profile('p1');"}).then(didStartConsoleProfile); +} + +function didStartConsoleProfile(messageObject) +{ + if (!InspectorTest.expectedSuccess("didStartConsoleProfile", messageObject)) + return; + Protocol.Profiler.disable().then(didDisableProfiler); +} + +function didDisableProfiler(messageObject) +{ + if (!InspectorTest.expectedSuccess("didDisableProfiler", messageObject)) + return; + Protocol.Profiler.enable(); + Protocol.Profiler.stop().then(didStopFrontendProfile); +} + +function didStopFrontendProfile(messageObject) +{ + if (!InspectorTest.expectedError("no front-end initiated profiles found", messageObject)) + return; + disallowConsoleProfiles(); + Protocol.Runtime.evaluate({expression: "console.profileEnd();"}).then(didStopConsoleProfile); +} + +function didStopConsoleProfile(messageObject) +{ + if (!InspectorTest.expectedSuccess("didStopConsoleProfile", messageObject)) + return; + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/cpu-profiler/record-cpu-profile-expected.txt b/deps/v8/test/inspector/cpu-profiler/record-cpu-profile-expected.txt new file mode 100644 index 0000000000..d810093968 --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/record-cpu-profile-expected.txt @@ -0,0 +1,7 @@ +Test that profiler is able to record a profile. Also it tests that profiler returns an error when it unable to find the profile. +PASS: startFrontendProfile +PASS: startConsoleProfile +PASS: stopConsoleProfile +PASS: stoppedFrontendProfile +PASS: startFrontendProfileSecondTime +PASS: stopFrontendProfileSecondTime
\ No newline at end of file diff --git a/deps/v8/test/inspector/cpu-profiler/record-cpu-profile.js b/deps/v8/test/inspector/cpu-profiler/record-cpu-profile.js new file mode 100644 index 0000000000..3ce16fcfb5 --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/record-cpu-profile.js @@ -0,0 +1,48 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Test that profiler is able to record a profile. Also it tests that profiler returns an error when it unable to find the profile."); + +Protocol.Profiler.enable(); +Protocol.Profiler.start().then(didStartFrontendProfile); +function didStartFrontendProfile(messageObject) +{ + if (!InspectorTest.expectedSuccess("startFrontendProfile", messageObject)) + return; + Protocol.Runtime.evaluate({expression: "console.profile('Profile 1');"}).then(didStartConsoleProfile); +} + +function didStartConsoleProfile(messageObject) +{ + if (!InspectorTest.expectedSuccess("startConsoleProfile", messageObject)) + return; + Protocol.Runtime.evaluate({expression: "console.profileEnd('Profile 1');"}).then(didStopConsoleProfile); +} + +function didStopConsoleProfile(messageObject) +{ + if (!InspectorTest.expectedSuccess("stopConsoleProfile", messageObject)) + return; + Protocol.Profiler.stop().then(didStopFrontendProfile); +} + +function didStopFrontendProfile(messageObject) +{ + if (!InspectorTest.expectedSuccess("stoppedFrontendProfile", messageObject)) + return; + Protocol.Profiler.start().then(didStartFrontendProfile2); +} + +function didStartFrontendProfile2(messageObject) +{ + if (!InspectorTest.expectedSuccess("startFrontendProfileSecondTime", messageObject)) + return; + Protocol.Profiler.stop().then(didStopFrontendProfile2); +} + +function didStopFrontendProfile2(messageObject) +{ + InspectorTest.expectedSuccess("stopFrontendProfileSecondTime", messageObject) + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/cpu-profiler/stop-without-preceeding-start-expected.txt b/deps/v8/test/inspector/cpu-profiler/stop-without-preceeding-start-expected.txt new file mode 100644 index 0000000000..91b5c9e6e2 --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/stop-without-preceeding-start-expected.txt @@ -0,0 +1,2 @@ +Test that profiler doesn't crash when we call stop without preceeding start. +PASS: ProfileAgent.stop
\ No newline at end of file diff --git a/deps/v8/test/inspector/cpu-profiler/stop-without-preceeding-start.js b/deps/v8/test/inspector/cpu-profiler/stop-without-preceeding-start.js new file mode 100644 index 0000000000..3e4717a19c --- /dev/null +++ b/deps/v8/test/inspector/cpu-profiler/stop-without-preceeding-start.js @@ -0,0 +1,12 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Test that profiler doesn't crash when we call stop without preceeding start."); + +Protocol.Profiler.stop().then(didStopProfile); +function didStopProfile(messageObject) +{ + InspectorTest.expectedError("ProfileAgent.stop", messageObject); + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/debugger/access-obsolete-frame-expected.txt b/deps/v8/test/inspector/debugger/access-obsolete-frame-expected.txt new file mode 100644 index 0000000000..643d382f24 --- /dev/null +++ b/deps/v8/test/inspector/debugger/access-obsolete-frame-expected.txt @@ -0,0 +1,8 @@ +Paused on 'debugger;' +resume +restartFrame +PASS, error message as expected +evaluateOnFrame +PASS, error message as expected +setVariableValue +PASS, error message as expected
\ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/access-obsolete-frame.js b/deps/v8/test/inspector/debugger/access-obsolete-frame.js new file mode 100644 index 0000000000..b5a96e1c3c --- /dev/null +++ b/deps/v8/test/inspector/debugger/access-obsolete-frame.js @@ -0,0 +1,67 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +InspectorTest.addScript(` +function testFunction() +{ + debugger; +} +//# sourceURL=foo.js`); + +Protocol.Debugger.enable(); + +Protocol.Debugger.oncePaused().then(handleDebuggerPausedOne); + +Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0)" }); + +var obsoleteTopFrameId; + +function handleDebuggerPausedOne(messageObject) +{ + InspectorTest.log("Paused on 'debugger;'"); + + var topFrame = messageObject.params.callFrames[0]; + obsoleteTopFrameId = topFrame.callFrameId; + + Protocol.Debugger.resume().then(callbackResume); +} + +function callbackResume(response) +{ + InspectorTest.log("resume"); + InspectorTest.log("restartFrame"); + Protocol.Debugger.restartFrame({ callFrameId: obsoleteTopFrameId }).then(callbackRestartFrame); +} + +function callbackRestartFrame(response) +{ + logErrorResponse(response); + InspectorTest.log("evaluateOnFrame"); + Protocol.Debugger.evaluateOnCallFrame({ callFrameId: obsoleteTopFrameId, expression: "0"}).then(callbackEvaluate); +} + +function callbackEvaluate(response) +{ + logErrorResponse(response); + InspectorTest.log("setVariableValue"); + Protocol.Debugger.setVariableValue({ callFrameId: obsoleteTopFrameId, scopeNumber: 0, variableName: "a", newValue: { value: 0 } }).then(callbackSetVariableValue); +} + +function callbackSetVariableValue(response) +{ + logErrorResponse(response); + InspectorTest.completeTest(); +} + +function logErrorResponse(response) +{ + if (response.error) { + if (response.error.message.indexOf("Can only perform operation while paused.") !== -1) { + InspectorTest.log("PASS, error message as expected"); + return; + } + } + InspectorTest.log("FAIL, unexpected error message"); + InspectorTest.log(JSON.stringify(response)); +} diff --git a/deps/v8/test/inspector/debugger/async-console-count-doesnt-crash-expected.txt b/deps/v8/test/inspector/debugger/async-console-count-doesnt-crash-expected.txt new file mode 100644 index 0000000000..aaaf9ebf96 --- /dev/null +++ b/deps/v8/test/inspector/debugger/async-console-count-doesnt-crash-expected.txt @@ -0,0 +1 @@ +setTimeout(console.count, 0) doesn't crash with enabled async stacks. diff --git a/deps/v8/test/inspector/debugger/async-console-count-doesnt-crash.js b/deps/v8/test/inspector/debugger/async-console-count-doesnt-crash.js new file mode 100644 index 0000000000..d4941950b1 --- /dev/null +++ b/deps/v8/test/inspector/debugger/async-console-count-doesnt-crash.js @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("setTimeout(console.count, 0) doesn't crash with enabled async stacks.") + +Protocol.Debugger.enable(); +Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 1 }); +Protocol.Runtime.evaluate({ expression: "setTimeout(console.count, 0)" }); +InspectorTest.completeTestAfterPendingTimeouts(); diff --git a/deps/v8/test/inspector/debugger/call-frame-function-location-expected.txt b/deps/v8/test/inspector/debugger/call-frame-function-location-expected.txt new file mode 100644 index 0000000000..8a34f45272 --- /dev/null +++ b/deps/v8/test/inspector/debugger/call-frame-function-location-expected.txt @@ -0,0 +1,3 @@ +Paused on 'debugger;' +Top frame location: {"scriptId":"42","lineNumber":3,"columnNumber":4} +Top frame functionLocation: {"scriptId":"42","lineNumber":0,"columnNumber":21} diff --git a/deps/v8/test/inspector/debugger/call-frame-function-location.js b/deps/v8/test/inspector/debugger/call-frame-function-location.js new file mode 100644 index 0000000000..c91164a037 --- /dev/null +++ b/deps/v8/test/inspector/debugger/call-frame-function-location.js @@ -0,0 +1,25 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +InspectorTest.addScript( +`function testFunction() +{ + var a = 2; + debugger; +}`); + +Protocol.Debugger.enable(); +Protocol.Debugger.oncePaused().then(handleDebuggerPaused); +Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0)" }); + +function handleDebuggerPaused(messageObject) +{ + InspectorTest.log("Paused on 'debugger;'"); + var topFrame = messageObject.params.callFrames[0]; + topFrame.location.scriptId = "42"; + topFrame.functionLocation.scriptId = "42"; + InspectorTest.log("Top frame location: " + JSON.stringify(topFrame.location)); + InspectorTest.log("Top frame functionLocation: " + JSON.stringify(topFrame.functionLocation)); + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/debugger/command-line-api-with-bound-function-expected.txt b/deps/v8/test/inspector/debugger/command-line-api-with-bound-function-expected.txt new file mode 100644 index 0000000000..4148ef860a --- /dev/null +++ b/deps/v8/test/inspector/debugger/command-line-api-with-bound-function-expected.txt @@ -0,0 +1,23 @@ +Check that debug and monitor methods from Command Line API works with bound function. +debug foo and bar +call foo and bar +paused in foo +paused in boo +undebug foo and bar +call foo and bar +monitor foo and bar +call foo and bar +function foo called +function boo called +unmonitor foo and bar +call foo and bar +monitor and debug bar +call bar +function boo called +paused in boo +undebug bar +call bar +function boo called +debug and unmonitor bar +call bar +paused in boo
\ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/command-line-api-with-bound-function.js b/deps/v8/test/inspector/debugger/command-line-api-with-bound-function.js new file mode 100644 index 0000000000..0f1ae21ebe --- /dev/null +++ b/deps/v8/test/inspector/debugger/command-line-api-with-bound-function.js @@ -0,0 +1,64 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Check that debug and monitor methods from Command Line API works with bound function."); + +InspectorTest.addScript(` +function foo() {} +function boo() {} +var bar = boo.bind(null); + +function testFunction() { + console.log("> debug foo and bar"); + debug(foo); + debug(bar); + console.log("> call foo and bar"); + foo(); + bar(); + console.log("> undebug foo and bar"); + undebug(foo); + undebug(bar); + console.log("> call foo and bar"); + foo(); + bar(); + + console.log("> monitor foo and bar"); + monitor(foo); + monitor(bar); + console.log("> call foo and bar"); + foo(); + bar(); + console.log("> unmonitor foo and bar"); + unmonitor(foo); + unmonitor(bar); + console.log("> call foo and bar"); + foo(); + bar(); + + console.log("> monitor and debug bar"); + monitor(bar); + debug(bar); + console.log("> call bar"); + bar(); + console.log("> undebug bar"); + undebug(bar); + console.log("> call bar"); + bar(); + console.log("> debug and unmonitor bar"); + debug(bar); + unmonitor(bar); + console.log("> call bar"); + bar(); +}`); + +Protocol.Runtime.enable(); +Protocol.Debugger.enable(); +Protocol.Debugger.onPaused(message => { + var functionName = message.params.callFrames[0].functionName; + InspectorTest.log(`paused in ${functionName}`); + Protocol.Debugger.resume(); +}); +Protocol.Runtime.onConsoleAPICalled(message => InspectorTest.log(message.params.args[0].value)); +Protocol.Runtime.evaluate({ expression: "testFunction()", includeCommandLineAPI: true }) + .then(InspectorTest.completeTest); diff --git a/deps/v8/test/inspector/debugger/continue-to-location-expected.txt b/deps/v8/test/inspector/debugger/continue-to-location-expected.txt new file mode 100644 index 0000000000..d0c6ce715a --- /dev/null +++ b/deps/v8/test/inspector/debugger/continue-to-location-expected.txt @@ -0,0 +1,31 @@ +Paused on debugger statement +Paused after continueToLocation +Stopped on line 8, expected 8, requested 8, (0-based numbers). +Control parameter 'step' calculation result: 1, expected: 1 +SUCCESS +Paused on debugger statement +Paused after continueToLocation +Stopped on line 8, expected 8, requested 8, (0-based numbers). +Control parameter 'step' calculation result: 1, expected: 1 +SUCCESS +Paused on debugger statement +Paused after continueToLocation +Stopped on line 17, expected 17, requested 12, (0-based numbers). +Control parameter 'step' calculation result: 6, expected: 6 +SUCCESS +Paused on debugger statement +Paused after continueToLocation +Stopped on line 17, expected 17, requested 13, (0-based numbers). +Control parameter 'step' calculation result: 6, expected: 6 +SUCCESS +Paused on debugger statement +Paused after continueToLocation +Stopped on line 17, expected 17, requested 17, (0-based numbers). +Control parameter 'step' calculation result: 6, expected: 6 +SUCCESS +Paused on debugger statement +Paused after continueToLocation +Stopped on line 17, expected 17, requested 17, (0-based numbers). +Control parameter 'step' calculation result: 6, expected: 6 +SUCCESS + diff --git a/deps/v8/test/inspector/debugger/continue-to-location.js b/deps/v8/test/inspector/debugger/continue-to-location.js new file mode 100644 index 0000000000..b72c8585e6 --- /dev/null +++ b/deps/v8/test/inspector/debugger/continue-to-location.js @@ -0,0 +1,114 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +InspectorTest.addScript( +`function statementsExample() +{ + var self = arguments.callee; + + debugger; + + self.step = 1; + + self.step = 2; + + void [ + self.step = 3, + self.step = 4, + self.step = 5, + self.step = 6 + ]; + + self.step = 7; +}`); + +var scenario = [ + // requested line number, expected control parameter 'step', expected line number + [ 8, 1, 8 ], + [ 8, 1, 8 ], + [ 12, 6, 17 ], + [ 13, 6, 17 ], + [ 17, 6, 17 ], + [ 17, 6, 17 ], +]; + +Protocol.Debugger.enable(); + +Protocol.Runtime.evaluate({ "expression": "statementsExample" }).then(callbackEvalFunctionObject); + +function callbackEvalFunctionObject(response) +{ + var functionObjectId = response.result.result.objectId; + Protocol.Runtime.getProperties({ objectId: functionObjectId }).then(callbackFunctionDetails); +} + +function callbackFunctionDetails(response) +{ + var result = response.result; + var scriptId; + for (var prop of result.internalProperties) { + if (prop.name === "[[FunctionLocation]]") + scriptId = prop.value.value.scriptId; + } + + nextScenarioStep(0); + + function nextScenarioStep(pos) + { + if (pos < scenario.length) + gotoSinglePassChain(scriptId, scenario[pos][0], scenario[pos][1], scenario[pos][2], nextScenarioStep.bind(this, pos + 1)); + else + InspectorTest.completeTest(); + } +} + +function gotoSinglePassChain(scriptId, lineNumber, expectedResult, expectedLineNumber, next) +{ + Protocol.Debugger.oncePaused().then(handleDebuggerPausedOne); + + Protocol.Runtime.evaluate({ "expression": "setTimeout(statementsExample, 0)" }); + + function handleDebuggerPausedOne(messageObject) + { + InspectorTest.log("Paused on debugger statement"); + + Protocol.Debugger.oncePaused().then(handleDebuggerPausedTwo); + + Protocol.Debugger.continueToLocation({ location: { scriptId: scriptId, lineNumber: lineNumber, columnNumber: 0} }).then(logContinueToLocation); + + function logContinueToLocation(response) + { + if (response.error) { + InspectorTest.log("Failed to execute continueToLocation " + JSON.stringify(response.error)); + InspectorTest.completeTest(); + } + } + } + function handleDebuggerPausedTwo(messageObject) + { + InspectorTest.log("Paused after continueToLocation"); + var actualLineNumber = messageObject.params.callFrames[0].location.lineNumber; + + InspectorTest.log("Stopped on line " + actualLineNumber + ", expected " + expectedLineNumber + ", requested " + lineNumber + ", (0-based numbers)."); + + Protocol.Debugger.oncePaused(handleDebuggerPausedUnexpected); + + Protocol.Runtime.evaluate({ "expression": "statementsExample.step" }).then(callbackStepEvaluate); + } + + function callbackStepEvaluate(response) + { + var resultValue = response.result.result.value; + InspectorTest.log("Control parameter 'step' calculation result: " + resultValue + ", expected: " + expectedResult); + InspectorTest.log(resultValue === expectedResult ? "SUCCESS" : "FAIL"); + Protocol.Debugger.resume(); + next(); + } + + function handleDebuggerPausedUnexpected(messageObject) + { + InspectorTest.log("Unexpected debugger pause"); + InspectorTest.completeTest(); + } +} diff --git a/deps/v8/test/inspector/debugger/doesnt-step-into-injected-script-expected.txt b/deps/v8/test/inspector/debugger/doesnt-step-into-injected-script-expected.txt new file mode 100644 index 0000000000..7fd52a0ba9 --- /dev/null +++ b/deps/v8/test/inspector/debugger/doesnt-step-into-injected-script-expected.txt @@ -0,0 +1,17 @@ +Check that stepInto at then end of the script go to next user script instead InjectedScriptSource.js. +Stack trace: +boo:0:38 +:0:50 + +Perform stepInto +Stack trace: +boo:0:48 +:0:50 + +Perform stepInto +Stack trace: +:0:51 + +Perform stepInto +Stack trace: +foo:0:12
\ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/doesnt-step-into-injected-script.js b/deps/v8/test/inspector/debugger/doesnt-step-into-injected-script.js new file mode 100644 index 0000000000..4d0d1d1f19 --- /dev/null +++ b/deps/v8/test/inspector/debugger/doesnt-step-into-injected-script.js @@ -0,0 +1,32 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Check that stepInto at then end of the script go to next user script instead InjectedScriptSource.js."); + +InspectorTest.addScript( +`function foo() +{ + return 239; +}`); + +Protocol.Debugger.enable(); +Protocol.Debugger.onPaused(debuggerPaused); +Protocol.Runtime.evaluate({ "expression": "(function boo() { setTimeout(foo, 0); debugger; })()" }); + +var actions = [ "stepInto", "stepInto", "stepInto" ]; +function debuggerPaused(result) +{ + InspectorTest.log("Stack trace:"); + for (var callFrame of result.params.callFrames) + InspectorTest.log(callFrame.functionName + ":" + callFrame.location.lineNumber + ":" + callFrame.location.columnNumber); + InspectorTest.log(""); + + var action = actions.shift(); + if (!action) { + Protocol.Debugger.resume().then(InspectorTest.completeTest); + return; + } + InspectorTest.log("Perform " + action); + Protocol.Debugger[action](); +} diff --git a/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt new file mode 100644 index 0000000000..b3dce305d8 --- /dev/null +++ b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name-expected.txt @@ -0,0 +1,19 @@ +{ + id : <messageId> + result : { + result : [ + [0] : { + configurable : true + enumerable : true + isOwn : true + name : a + value : { + description : 2 + type : number + value : 2 + } + writable : true + } + ] + } +}
\ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name.js b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name.js new file mode 100644 index 0000000000..e2b38d8ec9 --- /dev/null +++ b/deps/v8/test/inspector/debugger/scope-skip-variables-with-empty-name.js @@ -0,0 +1,42 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +InspectorTest.addScript( +`function testFunction() +{ + for (var a of [1]) { + ++a; + debugger; + } +}`); + +Protocol.Debugger.enable(); +Protocol.Debugger.oncePaused().then(dumpScopeOnPause); +Protocol.Runtime.evaluate({ "expression": "testFunction()" }); + +var waitScopeObjects = 0; +function dumpScopeOnPause(message) +{ + var scopeChain = message.params.callFrames[0].scopeChain; + var localScopeObjectIds = []; + for (var scope of scopeChain) { + if (scope.type === "local") + localScopeObjectIds.push(scope.object.objectId); + } + waitScopeObjects = localScopeObjectIds.length; + if (!waitScopeObjects) { + InspectorTest.completeTest(); + } else { + for (var objectId of localScopeObjectIds) + Protocol.Runtime.getProperties({ "objectId" : objectId }).then(dumpProperties); + } +} + +function dumpProperties(message) +{ + InspectorTest.logMessage(message); + --waitScopeObjects; + if (!waitScopeObjects) + Protocol.Debugger.resume().then(InspectorTest.completeTest); +} diff --git a/deps/v8/test/inspector/debugger/script-parsed-hash-expected.txt b/deps/v8/test/inspector/debugger/script-parsed-hash-expected.txt new file mode 100644 index 0000000000..20fdb859fd --- /dev/null +++ b/deps/v8/test/inspector/debugger/script-parsed-hash-expected.txt @@ -0,0 +1,3 @@ +Hash received: 1C6D2E82E4E4F1BA4CB5762843D429DC872EBA18 +Hash received: EBF1ECD351E7A3294CB5762843D429DC872EBA18 +Hash received: 86A31E7131896CF01BA837945C2894385F369F24
\ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/script-parsed-hash.js b/deps/v8/test/inspector/debugger/script-parsed-hash.js new file mode 100644 index 0000000000..5dd1dfacee --- /dev/null +++ b/deps/v8/test/inspector/debugger/script-parsed-hash.js @@ -0,0 +1,31 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var hashes = new Set(["1C6D2E82E4E4F1BA4CB5762843D429DC872EBA18", + "EBF1ECD351E7A3294CB5762843D429DC872EBA18", + "86A31E7131896CF01BA837945C2894385F369F24"]); +Protocol.Debugger.enable(); +Protocol.Debugger.onScriptParsed(function(messageObject) +{ + if (hashes.has(messageObject.params.hash)) + InspectorTest.log(`Hash received: ${messageObject.params.hash}`); + else + InspectorTest.log(`[FAIL]: unknown hash ${messageObject.params.hash}`); +}); + +function longScript() { + var longScript = "var b = 1;"; + for (var i = 0; i < 2024; ++i) + longScript += "++b;"; +} + +Protocol.Runtime.enable(); +Protocol.Runtime.compileScript({ expression: "1", sourceURL: "foo1.js", persistScript: true }); +Protocol.Runtime.compileScript({ expression: "239", sourceURL: "foo2.js", persistScript: true }); +Protocol.Runtime.compileScript({ expression: "(" + longScript + ")()", sourceURL: "foo3.js", persistScript: true }).then(step2); + +function step2() +{ + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/debugger/set-blackbox-patterns-expected.txt b/deps/v8/test/inspector/debugger/set-blackbox-patterns-expected.txt new file mode 100644 index 0000000000..fb54163107 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-blackbox-patterns-expected.txt @@ -0,0 +1,25 @@ +Pattern parser error: Uncaught SyntaxError: Invalid regular expression: /(foo([)/: Unterminated character class +Paused in +(...):1 +Paused in +(...):1 +Paused in +qwe:3 +baz:3 +(...):1 +Paused in +bar:3 +foo:3 +qwe:3 +baz:3 +(...):1 +Paused in +qwe:4 +baz:3 +(...):1 +Paused in +qwe:5 +baz:3 +(...):1 +Paused in +(...):1 diff --git a/deps/v8/test/inspector/debugger/set-blackbox-patterns.js b/deps/v8/test/inspector/debugger/set-blackbox-patterns.js new file mode 100644 index 0000000000..12e9e214d3 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-blackbox-patterns.js @@ -0,0 +1,59 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +InspectorTest.addScript( +`function bar() +{ + return 42; +}`); + +InspectorTest.addScript( +`function foo() +{ + var a = bar(); + return a + 1; +} +//# sourceURL=foo.js`); + +InspectorTest.addScript( +`function qwe() +{ + var a = foo(); + return a + 1; +} +//# sourceURL=qwe.js`); + +InspectorTest.addScript( +`function baz() +{ + var a = qwe(); + return a + 1; +} +//# sourceURL=baz.js`); + +Protocol.Debugger.enable(); +Protocol.Debugger.setBlackboxPatterns({ patterns: [ "foo([" ] }).then(dumpError); + +function dumpError(message) +{ + InspectorTest.log(message.error.message); + Protocol.Debugger.onPaused(dumpStackAndRunNextCommand); + Protocol.Debugger.setBlackboxPatterns({ patterns: [ "baz\.js", "foo\.js" ] }); + Protocol.Runtime.evaluate({ "expression": "debugger;baz()" }); +} + +var commands = [ "stepInto", "stepInto", "stepInto", "stepOut", "stepInto", "stepInto" ]; +function dumpStackAndRunNextCommand(message) +{ + InspectorTest.log("Paused in"); + var callFrames = message.params.callFrames; + for (var callFrame of callFrames) + InspectorTest.log((callFrame.functionName || "(...)") + ":" + (callFrame.location.lineNumber + 1)); + var command = commands.shift(); + if (!command) { + InspectorTest.completeTest(); + return; + } + Protocol.Debugger[command](); +} diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling-expected.txt b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling-expected.txt new file mode 100644 index 0000000000..81685a2b8b --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling-expected.txt @@ -0,0 +1,7 @@ +setBreakpointByUrl error: undefined +setBreakpoint error: { + "code": -32602, + "message": "Invalid request", + "data": "location: object expected" +} + diff --git a/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling.js b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling.js new file mode 100644 index 0000000000..8480aa6f75 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-breakpoint-before-enabling.js @@ -0,0 +1,17 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Protocol.Debugger.setBreakpointByUrl({ url: "http://example.com", lineNumber: 10 }).then(didSetBreakpointByUrlBeforeEnable); + +function didSetBreakpointByUrlBeforeEnable(message) +{ + InspectorTest.log("setBreakpointByUrl error: " + JSON.stringify(message.error, null, 2)); + Protocol.Debugger.setBreakpoint().then(didSetBreakpointBeforeEnable); +} + +function didSetBreakpointBeforeEnable(message) +{ + InspectorTest.log("setBreakpoint error: " + JSON.stringify(message.error, null, 2)); + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/debugger/set-script-source-expected.txt b/deps/v8/test/inspector/debugger/set-script-source-expected.txt new file mode 100644 index 0000000000..1b76ec5f95 --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-script-source-expected.txt @@ -0,0 +1,8 @@ +Function evaluate: {"type":"number","value":6,"description":"6"} +PASS, result value: 6 +Function evaluate: {"type":"number","value":8,"description":"8"} +PASS, result value: 8 +Has error reported: PASS +Reported error is a compile error: PASS +PASS, result value: 1 + diff --git a/deps/v8/test/inspector/debugger/set-script-source.js b/deps/v8/test/inspector/debugger/set-script-source.js new file mode 100644 index 0000000000..36944cca6c --- /dev/null +++ b/deps/v8/test/inspector/debugger/set-script-source.js @@ -0,0 +1,152 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +InspectorTest.addScript( +`function TestExpression(a, b) { + return a + b; +}`); + +// A general-purpose engine for sending a sequence of protocol commands. +// The clients provide requests and response handlers, while the engine catches +// errors and makes sure that once there's nothing to do completeTest() is called. +// @param step is an object with command, params and callback fields +function runRequestSeries(step) { + processStep(step); + + function processStep(currentStep) { + try { + processStepOrFail(currentStep); + } catch (e) { + InspectorTest.log(e.stack); + InspectorTest.completeTest(); + } + } + + function processStepOrFail(currentStep) { + if (!currentStep) { + InspectorTest.completeTest(); + return; + } + if (!currentStep.command) { + // A simple loopback step. + var next = currentStep.callback(); + processStep(next); + return; + } + + var innerCallback = function(response) { + var next; + if ("error" in response) { + if (!("errorHandler" in currentStep)) { + // Error message is not logged intentionally, it may be platform-specific. + InspectorTest.log("Protocol command '" + currentStep.command + "' failed"); + InspectorTest.completeTest(); + return; + } + try { + next = currentStep.errorHandler(response.error); + } catch (e) { + InspectorTest.log(e.stack); + InspectorTest.completeTest(); + return; + } + } else { + try { + next = currentStep.callback(response.result); + } catch (e) { + InspectorTest.log(e.stack); + InspectorTest.completeTest(); + return; + } + } + processStep(next); + } + var command = currentStep.command.split("."); + Protocol[command[0]][command[1]](currentStep.params).then(innerCallback); + } +} + +function logEqualsCheck(actual, expected) +{ + if (actual === expected) { + InspectorTest.log("PASS, result value: " + actual); + } else { + InspectorTest.log("FAIL, actual value: " + actual + ", expected: " + expected); + } +} +function logCheck(description, success) +{ + InspectorTest.log(description + ": " + (success ? "PASS" : "FAIL")); +} + +var firstStep = { callback: enableDebugger }; + +runRequestSeries(firstStep); + +function enableDebugger() { + return { command: "Debugger.enable", params: {}, callback: evalFunction }; +} + +function evalFunction(response) { + var expression = "TestExpression(2, 4)"; + return { command: "Runtime.evaluate", params: { expression: expression }, callback: callbackEvalFunction }; +} + +function callbackEvalFunction(result) { + InspectorTest.log("Function evaluate: " + JSON.stringify(result.result)); + logEqualsCheck(result.result.value, 6); + + return { command: "Runtime.evaluate", params: { expression: "TestExpression" }, callback: callbackEvalFunctionObject }; +} + +function callbackEvalFunctionObject(result) { + return { command: "Runtime.getProperties", params: { objectId: result.result.objectId }, callback: callbackFunctionDetails }; +} + +function callbackFunctionDetails(result) +{ + var scriptId; + for (var prop of result.internalProperties) { + if (prop.name === "[[FunctionLocation]]") + scriptId = prop.value.value.scriptId; + } + return createScriptManipulationArc(scriptId, null); +} + +// Several steps with scriptId in context. +function createScriptManipulationArc(scriptId, next) { + return { command: "Debugger.getScriptSource", params: { scriptId: scriptId }, callback: callbackGetScriptSource }; + + var originalText; + + function callbackGetScriptSource(result) { + originalText = result.scriptSource; + var patched = originalText.replace("a + b", "a * b"); + + return { command: "Debugger.setScriptSource", params: { scriptId: scriptId, scriptSource: patched }, callback: callbackSetScriptSource }; + } + + function callbackSetScriptSource(result) { + var expression = "TestExpression(2, 4)"; + return { command: "Runtime.evaluate", params: { expression: expression }, callback: callbackEvalFunction2 }; + } + + function callbackEvalFunction2(result) { + InspectorTest.log("Function evaluate: " + JSON.stringify(result.result)); + logEqualsCheck(result.result.value, 8); + + var patched = originalText.replace("a + b", "a # b"); + + return { command: "Debugger.setScriptSource", params: { scriptId: scriptId, scriptSource: patched }, callback: errorCallbackSetScriptSource2 }; + } + + function errorCallbackSetScriptSource2(result) { + var exceptionDetails = result.exceptionDetails; + logCheck("Has error reported", !!exceptionDetails); + logCheck("Reported error is a compile error", !!exceptionDetails); + if (exceptionDetails) + logEqualsCheck(exceptionDetails.lineNumber, 1); + return next; + } +} diff --git a/deps/v8/test/inspector/debugger/step-over-caught-exception-expected.txt b/deps/v8/test/inspector/debugger/step-over-caught-exception-expected.txt new file mode 100644 index 0000000000..a18b0934cb --- /dev/null +++ b/deps/v8/test/inspector/debugger/step-over-caught-exception-expected.txt @@ -0,0 +1,4 @@ +testFunction:9 +testFunction:11 +testFunction:9 +testFunction:11
\ No newline at end of file diff --git a/deps/v8/test/inspector/debugger/step-over-caught-exception.js b/deps/v8/test/inspector/debugger/step-over-caught-exception.js new file mode 100644 index 0000000000..e00dcf27dc --- /dev/null +++ b/deps/v8/test/inspector/debugger/step-over-caught-exception.js @@ -0,0 +1,76 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +InspectorTest.addScript( +`function testFunction() +{ + function foo() + { + try { + throw new Error(); + } catch (e) { + } + } + debugger; + foo(); + console.log("completed"); +}`); + +Protocol.Debugger.enable(); +Protocol.Runtime.enable(); +step1(); + +function step1() +{ + Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0);"}); + var commands = [ "Print", "stepOver", "stepOver", "Print", "resume" ]; + Protocol.Debugger.onPaused(function(messageObject) + { + var command = commands.shift(); + if (command === "Print") { + var callFrames = messageObject.params.callFrames; + for (var callFrame of callFrames) + InspectorTest.log(callFrame.functionName + ":" + callFrame.location.lineNumber); + command = commands.shift(); + } + if (command) + Protocol.Debugger[command](); + }); + + Protocol.Runtime.onConsoleAPICalled(function(messageObject) + { + if (messageObject.params.args[0].value === "completed") { + if (commands.length) + InspectorTest.log("[FAIL]: execution was resumed too earlier.") + step2(); + } + }); +} + +function step2() +{ + Protocol.Runtime.evaluate({ "expression": "setTimeout(testFunction, 0);"}); + var commands = [ "Print", "stepOver", "stepInto", "stepOver", "stepOver", "Print", "resume" ]; + Protocol.Debugger.onPaused(function(messageObject) + { + var command = commands.shift(); + if (command === "Print") { + var callFrames = messageObject.params.callFrames; + for (var callFrame of callFrames) + InspectorTest.log(callFrame.functionName + ":" + callFrame.location.lineNumber); + command = commands.shift(); + } + if (command) + Protocol.Debugger[command](); + }); + + Protocol.Runtime.onConsoleAPICalled(function(messageObject) + { + if (messageObject.params.args[0].value === "completed") { + if (commands.length) + InspectorTest.log("[FAIL]: execution was resumed too earlier.") + InspectorTest.completeTest(); + } + }); +} diff --git a/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges-expected.txt b/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges-expected.txt new file mode 100644 index 0000000000..acea22fd5f --- /dev/null +++ b/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges-expected.txt @@ -0,0 +1,54 @@ +foo: 8:4 +blackboxedBoo: 3:12 +notBlackboxedFoo: 3:12 +blackboxedFoo: 10:12 +notBlackboxedBoo: 17:12 +testFunction: 2:4 + +Try to set positions: [{"lineNumber":0,"columnNumber":0},{"lineNumber":0,"columnNumber":0}] +Input positions array is not sorted or contains duplicate values. +Try to set positions: [{"lineNumber":0,"columnNumber":1},{"lineNumber":0,"columnNumber":0}] +Input positions array is not sorted or contains duplicate values. +Try to set positions: [{"lineNumber":0,"columnNumber":-1}] +Position missing 'column' or 'column' < 0. +action: stepOut +notBlackboxedFoo: 4:4 +blackboxedFoo: 10:12 +notBlackboxedBoo: 17:12 +testFunction: 2:4 + +action: stepOut +notBlackboxedBoo: 18:4 +testFunction: 2:4 + +action: stepOut +testFunction: 3:4 + +action: stepInto +notBlackboxedBoo: 16:12 +testFunction: 3:4 + +action: stepOver +action: stepInto +notBlackboxedFoo: 2:12 +blackboxedFoo: 10:12 +notBlackboxedBoo: 17:12 +testFunction: 3:4 + +action: stepOver +action: stepInto +foo: 8:4 +blackboxedBoo: 3:12 +notBlackboxedFoo: 3:12 +blackboxedFoo: 10:12 +notBlackboxedBoo: 17:12 +testFunction: 3:4 + +action: stepOver +action: stepInto +foo: 10:0 +blackboxedBoo: 3:12 +notBlackboxedFoo: 3:12 +blackboxedFoo: 10:12 +notBlackboxedBoo: 17:12 +testFunction: 3:4 diff --git a/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges.js b/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges.js new file mode 100644 index 0000000000..740634f68f --- /dev/null +++ b/deps/v8/test/inspector/debugger/stepping-with-blackboxed-ranges.js @@ -0,0 +1,126 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +InspectorTest.addScript( +`function blackboxedBoo() +{ + var a = 42; + var b = foo(); + return a + b; +} +//# sourceURL=blackboxed-script.js`); + +InspectorTest.addScript( +`function notBlackboxedFoo() +{ + var a = 42; + var b = blackboxedBoo(); + return a + b; +} + +function blackboxedFoo() +{ + var a = 42; + var b = notBlackboxedFoo(); + return a + b; +} + +function notBlackboxedBoo() +{ + var a = 42; + var b = blackboxedFoo(); + return a + b; +} +//# sourceURL=mixed-source.js`); + +InspectorTest.addScript( +`function testFunction() +{ + notBlackboxedBoo(); // for setup ranges and stepOut + notBlackboxedBoo(); // for stepIn +} + +function foo() +{ + debugger; + return 239; +}`); + +Protocol.Debugger.oncePaused().then(setBlackboxedScriptRanges); +Protocol.Debugger.enable().then(callTestFunction); + +function callTestFunction(response) +{ + Protocol.Runtime.evaluate({ expression: "setTimeout(testFunction, 0);"}); +} + +function setBlackboxedScriptRanges(response) +{ + var callFrames = response.params.callFrames; + printCallFrames(callFrames); + Protocol.Debugger.setBlackboxedRanges({ + scriptId: callFrames[1].location.scriptId, + positions: [ { lineNumber: 0, columnNumber: 0 } ] // blackbox ranges for blackboxed.js + }).then(setIncorrectRanges.bind(null, callFrames[2].location.scriptId)); +} + +var incorrectPositions = [ + [ { lineNumber: 0, columnNumber: 0 }, { lineNumber: 0, columnNumber: 0 } ], + [ { lineNumber: 0, columnNumber: 1 }, { lineNumber: 0, columnNumber: 0 } ], + [ { lineNumber: 0, columnNumber: -1 } ], +]; + +function setIncorrectRanges(scriptId, response) +{ + if (response.error) + InspectorTest.log(response.error.message); + var positions = incorrectPositions.shift(); + if (!positions) { + setMixedSourceRanges(scriptId); + return; + } + InspectorTest.log("Try to set positions: " + JSON.stringify(positions)); + Protocol.Debugger.setBlackboxedRanges({ + scriptId: scriptId, + positions: positions + }).then(setIncorrectRanges.bind(null, scriptId)); +} + +function setMixedSourceRanges(scriptId) +{ + Protocol.Debugger.onPaused(runAction); + Protocol.Debugger.setBlackboxedRanges({ + scriptId: scriptId, + positions: [ { lineNumber: 8, columnNumber: 0 }, { lineNumber: 15, columnNumber: 0 } ] // blackbox ranges for mixed.js + }).then(runAction); +} + +var actions = [ "stepOut", "print", "stepOut", "print", "stepOut", "print", + "stepInto", "print", "stepOver", "stepInto", "print", "stepOver", "stepInto", "print", + "stepOver", "stepInto", "print" ]; + +function runAction(response) +{ + var action = actions.shift(); + if (!action) + InspectorTest.completeTest(); + + if (action === "print") { + printCallFrames(response.params.callFrames); + runAction({}); + } else { + InspectorTest.log("action: " + action); + Protocol.Debugger[action](); + } +} + +function printCallFrames(callFrames) +{ + var topCallFrame = callFrames[0]; + if (topCallFrame.functionName.startsWith("blackboxed")) + InspectorTest.log("FAIL: blackboxed function in top call frame"); + for (var callFrame of callFrames) + InspectorTest.log(callFrame.functionName + ": " + callFrame.location.lineNumber + ":" + callFrame.location.columnNumber); + InspectorTest.log(""); +} diff --git a/deps/v8/test/inspector/debugger/update-call-frame-scopes-expected.txt b/deps/v8/test/inspector/debugger/update-call-frame-scopes-expected.txt new file mode 100644 index 0000000000..ed52d231c2 --- /dev/null +++ b/deps/v8/test/inspector/debugger/update-call-frame-scopes-expected.txt @@ -0,0 +1,7 @@ +Paused on 'debugger;' +Variable value changed +Stacktrace re-read again +Scope variables downloaded anew +New variable is 55, expected is 55, old was: 2 +SUCCESS + diff --git a/deps/v8/test/inspector/debugger/update-call-frame-scopes.js b/deps/v8/test/inspector/debugger/update-call-frame-scopes.js new file mode 100644 index 0000000000..f4a0f12397 --- /dev/null +++ b/deps/v8/test/inspector/debugger/update-call-frame-scopes.js @@ -0,0 +1,63 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +InspectorTest.addScript( +`function TestFunction() +{ + var a = 2; + debugger; + debugger; +}`); + +var newVariableValue = 55; + +Protocol.Debugger.enable(); + +Protocol.Debugger.oncePaused().then(handleDebuggerPaused); + +Protocol.Runtime.evaluate({ "expression": "setTimeout(TestFunction, 0)" }); + +function handleDebuggerPaused(messageObject) +{ + InspectorTest.log("Paused on 'debugger;'"); + + var topFrame = messageObject.params.callFrames[0]; + var topFrameId = topFrame.callFrameId; + Protocol.Debugger.evaluateOnCallFrame({ "callFrameId": topFrameId, "expression": "a = " + newVariableValue }).then(callbackChangeValue); +} + +function callbackChangeValue(response) +{ + InspectorTest.log("Variable value changed"); + Protocol.Debugger.oncePaused().then(callbackGetBacktrace); + Protocol.Debugger.resume(); +} + +function callbackGetBacktrace(response) +{ + InspectorTest.log("Stacktrace re-read again"); + var localScope = response.params.callFrames[0].scopeChain[0]; + Protocol.Runtime.getProperties({ "objectId": localScope.object.objectId }).then(callbackGetProperties); +} + +function callbackGetProperties(response) +{ + InspectorTest.log("Scope variables downloaded anew"); + var varNamedA; + var propertyList = response.result.result; + for (var i = 0; i < propertyList.length; i++) { + if (propertyList[i].name === "a") { + varNamedA = propertyList[i]; + break; + } + } + if (varNamedA) { + var actualValue = varNamedA.value.value; + InspectorTest.log("New variable is " + actualValue + ", expected is " + newVariableValue + ", old was: 2"); + InspectorTest.log(actualValue === newVariableValue ? "SUCCESS" : "FAIL"); + } else { + InspectorTest.log("Failed to find variable in scope"); + } + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/inspector-impl.cc b/deps/v8/test/inspector/inspector-impl.cc new file mode 100644 index 0000000000..57499215b9 --- /dev/null +++ b/deps/v8/test/inspector/inspector-impl.cc @@ -0,0 +1,201 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/inspector/inspector-impl.h" + +#include "include/v8.h" +#include "src/inspector/string-16.h" + +namespace { + +const int kInspectorClientIndex = v8::Context::kDebugIdIndex + 1; + +class ChannelImpl final : public v8_inspector::V8Inspector::Channel { + public: + explicit ChannelImpl(InspectorClientImpl::FrontendChannel* frontend_channel) + : frontend_channel_(frontend_channel) {} + virtual ~ChannelImpl() = default; + + private: + void sendProtocolResponse(int callId, + const v8_inspector::StringView& message) override { + frontend_channel_->SendMessageToFrontend(message); + } + void sendProtocolNotification( + const v8_inspector::StringView& message) override { + frontend_channel_->SendMessageToFrontend(message); + } + void flushProtocolNotifications() override {} + + InspectorClientImpl::FrontendChannel* frontend_channel_; + DISALLOW_COPY_AND_ASSIGN(ChannelImpl); +}; + +InspectorClientImpl* InspectorClientFromContext( + v8::Local<v8::Context> context) { + InspectorClientImpl* inspector_client = static_cast<InspectorClientImpl*>( + context->GetAlignedPointerFromEmbedderData(kInspectorClientIndex)); + CHECK(inspector_client); + return inspector_client; +} + +v8_inspector::String16 ToString16(v8::Local<v8::String> str) { + std::unique_ptr<uint16_t[]> buffer(new uint16_t[str->Length()]); + str->Write(reinterpret_cast<uint16_t*>(buffer.get()), 0, str->Length()); + return v8_inspector::String16(buffer.get(), str->Length()); +} + +void MessageHandler(v8::Local<v8::Message> message, + v8::Local<v8::Value> exception) { + v8::Isolate* isolate = v8::Isolate::GetCurrent(); + v8::Local<v8::Context> context = isolate->GetEnteredContext(); + if (context.IsEmpty()) return; + v8_inspector::V8Inspector* inspector = + InspectorClientImpl::InspectorFromContext(context); + + v8::Local<v8::StackTrace> stack = message->GetStackTrace(); + int script_id = message->GetScriptOrigin().ScriptID()->Value(); + if (!stack.IsEmpty() && stack->GetFrameCount() > 0) { + int top_script_id = stack->GetFrame(0)->GetScriptId(); + if (top_script_id == script_id) script_id = 0; + } + int line_number = message->GetLineNumber(context).FromMaybe(0); + int column_number = 0; + if (message->GetStartColumn(context).IsJust()) + column_number = message->GetStartColumn(context).FromJust() + 1; + + v8_inspector::StringView detailed_message; + v8_inspector::String16 message_text_string = ToString16(message->Get()); + v8_inspector::StringView message_text(message_text_string.characters16(), + message_text_string.length()); + v8_inspector::String16 url_string; + if (message->GetScriptOrigin().ResourceName()->IsString()) { + url_string = + ToString16(message->GetScriptOrigin().ResourceName().As<v8::String>()); + } + v8_inspector::StringView url(url_string.characters16(), url_string.length()); + + inspector->exceptionThrown(context, message_text, exception, detailed_message, + url, line_number, column_number, + inspector->createStackTrace(stack), script_id); +} + +} // namespace + +class ConnectTask : public TaskRunner::Task { + public: + ConnectTask(InspectorClientImpl* client, v8::base::Semaphore* ready_semaphore) + : client_(client), ready_semaphore_(ready_semaphore) {} + virtual ~ConnectTask() = default; + + bool is_inspector_task() final { return true; } + + void Run(v8::Isolate* isolate, + const v8::Global<v8::Context>& global_context) { + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = global_context.Get(isolate); + client_->connect(context); + if (ready_semaphore_) ready_semaphore_->Signal(); + } + + private: + InspectorClientImpl* client_; + v8::base::Semaphore* ready_semaphore_; +}; + +InspectorClientImpl::InspectorClientImpl(TaskRunner* task_runner, + FrontendChannel* frontend_channel, + v8::base::Semaphore* ready_semaphore) + : isolate_(nullptr), + task_runner_(task_runner), + frontend_channel_(frontend_channel) { + task_runner_->Append(new ConnectTask(this, ready_semaphore)); +} + +InspectorClientImpl::~InspectorClientImpl() {} + +void InspectorClientImpl::connect(v8::Local<v8::Context> context) { + isolate_ = context->GetIsolate(); + isolate_->AddMessageListener(MessageHandler); + channel_.reset(new ChannelImpl(frontend_channel_)); + + inspector_ = v8_inspector::V8Inspector::create(isolate_, this); + session_ = inspector_->connect(1, channel_.get(), v8_inspector::StringView()); + + context->SetAlignedPointerInEmbedderData(kInspectorClientIndex, this); + inspector_->contextCreated( + v8_inspector::V8ContextInfo(context, 1, v8_inspector::StringView())); + context_.Reset(isolate_, context); +} + +v8::Local<v8::Context> InspectorClientImpl::ensureDefaultContextInGroup(int) { + CHECK(isolate_); + return context_.Get(isolate_); +} + +double InspectorClientImpl::currentTimeMS() { + return v8::base::OS::TimeCurrentMillis(); +} + +void InspectorClientImpl::runMessageLoopOnPause(int) { + task_runner_->RunMessageLoop(true); +} + +void InspectorClientImpl::quitMessageLoopOnPause() { + task_runner_->QuitMessageLoop(); +} + +v8_inspector::V8Inspector* InspectorClientImpl::InspectorFromContext( + v8::Local<v8::Context> context) { + return InspectorClientFromContext(context)->inspector_.get(); +} + +v8_inspector::V8InspectorSession* InspectorClientImpl::SessionFromContext( + v8::Local<v8::Context> context) { + return InspectorClientFromContext(context)->session_.get(); +} + +class SendMessageToBackendTask : public TaskRunner::Task { + public: + explicit SendMessageToBackendTask(const v8_inspector::String16& message) + : message_(message) {} + + bool is_inspector_task() final { return true; } + + void Run(v8::Isolate* isolate, + const v8::Global<v8::Context>& global_context) override { + v8_inspector::V8InspectorSession* session = nullptr; + { + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = global_context.Get(isolate); + session = InspectorClientImpl::SessionFromContext(context); + CHECK(session); + } + v8_inspector::StringView message_view( + reinterpret_cast<const uint16_t*>(message_.characters16()), + message_.length()); + session->dispatchProtocolMessage(message_view); + } + + private: + v8_inspector::String16 message_; +}; + +TaskRunner* SendMessageToBackendExtension::backend_task_runner_ = nullptr; + +v8::Local<v8::FunctionTemplate> +SendMessageToBackendExtension::GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Local<v8::String> name) { + return v8::FunctionTemplate::New( + isolate, SendMessageToBackendExtension::SendMessageToBackend); +} + +void SendMessageToBackendExtension::SendMessageToBackend( + const v8::FunctionCallbackInfo<v8::Value>& args) { + CHECK(backend_task_runner_); + CHECK(args.Length() == 1 && args[0]->IsString()); + v8::Local<v8::String> message = args[0].As<v8::String>(); + backend_task_runner_->Append( + new SendMessageToBackendTask(ToString16(message))); +} diff --git a/deps/v8/test/inspector/inspector-impl.h b/deps/v8/test/inspector/inspector-impl.h new file mode 100644 index 0000000000..f94bef1599 --- /dev/null +++ b/deps/v8/test/inspector/inspector-impl.h @@ -0,0 +1,79 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ +#define V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ + +#include "include/v8-inspector.h" +#include "include/v8.h" +#include "src/base/macros.h" +#include "src/base/platform/platform.h" +#include "test/inspector/task-runner.h" + +class InspectorClientImpl : public v8_inspector::V8InspectorClient { + public: + class FrontendChannel { + public: + virtual ~FrontendChannel() = default; + virtual void SendMessageToFrontend( + const v8_inspector::StringView& message) = 0; + }; + + InspectorClientImpl(TaskRunner* task_runner, + FrontendChannel* frontend_channel, + v8::base::Semaphore* ready_semaphore); + virtual ~InspectorClientImpl(); + + static v8_inspector::V8Inspector* InspectorFromContext( + v8::Local<v8::Context> context); + + private: + // V8InspectorClient implementation. + v8::Local<v8::Context> ensureDefaultContextInGroup( + int context_group_id) override; + double currentTimeMS() override; + void runMessageLoopOnPause(int context_group_id) override; + void quitMessageLoopOnPause() override; + + static v8_inspector::V8InspectorSession* SessionFromContext( + v8::Local<v8::Context> context); + + friend class SendMessageToBackendTask; + + friend class ConnectTask; + void connect(v8::Local<v8::Context> context); + + std::unique_ptr<v8_inspector::V8Inspector> inspector_; + std::unique_ptr<v8_inspector::V8InspectorSession> session_; + std::unique_ptr<v8_inspector::V8Inspector::Channel> channel_; + + v8::Isolate* isolate_; + v8::Global<v8::Context> context_; + + TaskRunner* task_runner_; + FrontendChannel* frontend_channel_; + + DISALLOW_COPY_AND_ASSIGN(InspectorClientImpl); +}; + +class SendMessageToBackendExtension : public v8::Extension { + public: + SendMessageToBackendExtension() + : v8::Extension("v8_inspector/frontend", + "native function sendMessageToBackend();") {} + virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Local<v8::String> name); + + static void set_backend_task_runner(TaskRunner* task_runner) { + backend_task_runner_ = task_runner; + } + + private: + static void SendMessageToBackend( + const v8::FunctionCallbackInfo<v8::Value>& args); + + static TaskRunner* backend_task_runner_; +}; + +#endif // V8_TEST_INSPECTOR_PROTOCOL_INSPECTOR_IMPL_H_ diff --git a/deps/v8/test/inspector/inspector-test.cc b/deps/v8/test/inspector/inspector-test.cc new file mode 100644 index 0000000000..872d211c75 --- /dev/null +++ b/deps/v8/test/inspector/inspector-test.cc @@ -0,0 +1,254 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#if !defined(_WIN32) && !defined(_WIN64) +#include <unistd.h> // NOLINT +#endif // !defined(_WIN32) && !defined(_WIN64) + +#include <locale.h> + +#include "include/libplatform/libplatform.h" +#include "include/v8.h" + +#include "src/base/platform/platform.h" +#include "src/flags.h" +#include "src/utils.h" +#include "src/vector.h" + +#include "test/inspector/inspector-impl.h" +#include "test/inspector/task-runner.h" + +namespace { + +void Exit() { + fflush(stdout); + fflush(stderr); + _exit(0); +} + +class UtilsExtension : public v8::Extension { + public: + UtilsExtension() + : v8::Extension("v8_inspector/utils", + "native function print();" + "native function quit();" + "native function setlocale();") {} + virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Local<v8::String> name) { + v8::Local<v8::Context> context = isolate->GetCurrentContext(); + if (name->Equals(context, v8::String::NewFromUtf8( + isolate, "print", v8::NewStringType::kNormal) + .ToLocalChecked()) + .FromJust()) { + return v8::FunctionTemplate::New(isolate, UtilsExtension::Print); + } else if (name->Equals(context, + v8::String::NewFromUtf8(isolate, "quit", + v8::NewStringType::kNormal) + .ToLocalChecked()) + .FromJust()) { + return v8::FunctionTemplate::New(isolate, UtilsExtension::Quit); + } else if (name->Equals(context, + v8::String::NewFromUtf8(isolate, "setlocale", + v8::NewStringType::kNormal) + .ToLocalChecked()) + .FromJust()) { + return v8::FunctionTemplate::New(isolate, UtilsExtension::SetLocale); + } + return v8::Local<v8::FunctionTemplate>(); + } + + private: + static void Print(const v8::FunctionCallbackInfo<v8::Value>& args) { + for (int i = 0; i < args.Length(); i++) { + v8::HandleScope handle_scope(args.GetIsolate()); + if (i != 0) { + printf(" "); + } + + // Explicitly catch potential exceptions in toString(). + v8::TryCatch try_catch(args.GetIsolate()); + v8::Local<v8::Value> arg = args[i]; + v8::Local<v8::String> str_obj; + + if (arg->IsSymbol()) { + arg = v8::Local<v8::Symbol>::Cast(arg)->Name(); + } + if (!arg->ToString(args.GetIsolate()->GetCurrentContext()) + .ToLocal(&str_obj)) { + try_catch.ReThrow(); + return; + } + + v8::String::Utf8Value str(str_obj); + int n = + static_cast<int>(fwrite(*str, sizeof(**str), str.length(), stdout)); + if (n != str.length()) { + printf("Error in fwrite\n"); + Quit(args); + } + } + printf("\n"); + fflush(stdout); + } + + static void Quit(const v8::FunctionCallbackInfo<v8::Value>& args) { Exit(); } + + static void SetLocale(const v8::FunctionCallbackInfo<v8::Value>& args) { + if (args.Length() != 1 || !args[0]->IsString()) { + fprintf(stderr, "Internal error: setlocale get one string argument."); + Exit(); + } + v8::String::Utf8Value str(args[0]); + setlocale(LC_NUMERIC, *str); + } +}; + +class SetTimeoutTask : public TaskRunner::Task { + public: + SetTimeoutTask(v8::Isolate* isolate, v8::Local<v8::Function> function) + : function_(isolate, function) {} + virtual ~SetTimeoutTask() {} + + bool is_inspector_task() final { return false; } + + void Run(v8::Isolate* isolate, + const v8::Global<v8::Context>& global_context) override { + v8::MicrotasksScope microtasks_scope(isolate, + v8::MicrotasksScope::kRunMicrotasks); + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = global_context.Get(isolate); + v8::Context::Scope context_scope(context); + + v8::Local<v8::Function> function = function_.Get(isolate); + v8::MaybeLocal<v8::Value> result; + v8_inspector::V8Inspector* inspector = + InspectorClientImpl::InspectorFromContext(context); + if (inspector) inspector->willExecuteScript(context, function->ScriptId()); + result = function->Call(context, context->Global(), 0, nullptr); + if (inspector) inspector->didExecuteScript(context); + } + + private: + v8::Global<v8::Function> function_; +}; + +class SetTimeoutExtension : public v8::Extension { + public: + SetTimeoutExtension() + : v8::Extension("v8_inspector/setTimeout", + "native function setTimeout();") {} + + virtual v8::Local<v8::FunctionTemplate> GetNativeFunctionTemplate( + v8::Isolate* isolate, v8::Local<v8::String> name) { + return v8::FunctionTemplate::New(isolate, SetTimeoutExtension::SetTimeout); + } + + private: + static void SetTimeout(const v8::FunctionCallbackInfo<v8::Value>& args) { + if (args.Length() != 2 || !args[1]->IsNumber() || + (!args[0]->IsFunction() && !args[0]->IsString()) || + args[1].As<v8::Number>()->Value() != 0.0) { + fprintf(stderr, + "Internal error: only setTimeout(function, 0) is supported."); + Exit(); + } + v8::Local<v8::Context> context = args.GetIsolate()->GetCurrentContext(); + if (args[0]->IsFunction()) { + TaskRunner::FromContext(context)->Append(new SetTimeoutTask( + args.GetIsolate(), v8::Local<v8::Function>::Cast(args[0]))); + } else { + v8::Local<v8::String> data = args[0].As<v8::String>(); + std::unique_ptr<uint16_t[]> buffer(new uint16_t[data->Length()]); + data->Write(reinterpret_cast<uint16_t*>(buffer.get()), 0, data->Length()); + v8_inspector::String16 source = + v8_inspector::String16(buffer.get(), data->Length()); + TaskRunner::FromContext(context)->Append(new ExecuteStringTask(source)); + } + } +}; + +v8_inspector::String16 ToString16(const v8_inspector::StringView& string) { + if (string.is8Bit()) + return v8_inspector::String16( + reinterpret_cast<const char*>(string.characters8()), string.length()); + return v8_inspector::String16( + reinterpret_cast<const uint16_t*>(string.characters16()), + string.length()); +} + +class FrontendChannelImpl : public InspectorClientImpl::FrontendChannel { + public: + explicit FrontendChannelImpl(TaskRunner* frontend_task_runner) + : frontend_task_runner_(frontend_task_runner) {} + virtual ~FrontendChannelImpl() {} + + void SendMessageToFrontend(const v8_inspector::StringView& message) final { + v8_inspector::String16Builder script; + script.append("InspectorTest._dispatchMessage("); + script.append(ToString16(message)); + script.append(")"); + frontend_task_runner_->Append(new ExecuteStringTask(script.toString())); + } + + private: + TaskRunner* frontend_task_runner_; +}; + +} // namespace + +int main(int argc, char* argv[]) { + v8::V8::InitializeICUDefaultLocation(argv[0]); + v8::Platform* platform = v8::platform::CreateDefaultPlatform(); + v8::V8::InitializePlatform(platform); + v8::internal::FlagList::SetFlagsFromCommandLine(&argc, argv, true); + v8::V8::InitializeExternalStartupData(argv[0]); + v8::V8::Initialize(); + + SetTimeoutExtension set_timeout_extension; + v8::RegisterExtension(&set_timeout_extension); + UtilsExtension utils_extension; + v8::RegisterExtension(&utils_extension); + SendMessageToBackendExtension send_message_to_backend_extension; + v8::RegisterExtension(&send_message_to_backend_extension); + + v8::base::Semaphore ready_semaphore(0); + + const char* backend_extensions[] = {"v8_inspector/setTimeout"}; + v8::ExtensionConfiguration backend_configuration( + arraysize(backend_extensions), backend_extensions); + TaskRunner backend_runner(&backend_configuration, false, &ready_semaphore); + ready_semaphore.Wait(); + SendMessageToBackendExtension::set_backend_task_runner(&backend_runner); + + const char* frontend_extensions[] = {"v8_inspector/utils", + "v8_inspector/frontend"}; + v8::ExtensionConfiguration frontend_configuration( + arraysize(frontend_extensions), frontend_extensions); + TaskRunner frontend_runner(&frontend_configuration, true, &ready_semaphore); + ready_semaphore.Wait(); + + FrontendChannelImpl frontend_channel(&frontend_runner); + InspectorClientImpl inspector_client(&backend_runner, &frontend_channel, + &ready_semaphore); + ready_semaphore.Wait(); + + for (int i = 1; i < argc; ++i) { + if (argv[i][0] == '-') break; + + bool exists = false; + v8::internal::Vector<const char> chars = + v8::internal::ReadFile(argv[i], &exists, true); + if (!exists) { + fprintf(stderr, "Internal error: script file doesn't exists: %s\n", + argv[i]); + Exit(); + } + v8_inspector::String16 source = + v8_inspector::String16::fromUTF8(chars.start(), chars.length()); + frontend_runner.Append(new ExecuteStringTask(source)); + } + + frontend_runner.Join(); + return 0; +} diff --git a/deps/v8/test/inspector/inspector.gyp b/deps/v8/test/inspector/inspector.gyp new file mode 100644 index 0000000000..21a75f9eef --- /dev/null +++ b/deps/v8/test/inspector/inspector.gyp @@ -0,0 +1,41 @@ +# Copyright 2016 the V8 project authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +{ + 'variables': { + 'v8_code': 1, + 'inspector_protocol_sources': [ + 'inspector-impl.cc', + 'inspector-impl.h', + 'inspector-test.cc', + 'task-runner.cc', + 'task-runner.h', + ], + }, + 'includes': ['../../gypfiles/toolchain.gypi', '../../gypfiles/features.gypi'], + 'targets': [ + { + 'target_name': 'inspector-test', + 'type': 'executable', + 'dependencies': [ + '../../src/v8.gyp:v8_libplatform', + ], + 'include_dirs': [ + '../..', + ], + 'sources': [ + '<@(inspector_protocol_sources)', + ], + 'conditions': [ + ['component=="shared_library"', { + # inspector-test can't be built against a shared library, so we + # need to depend on the underlying static target in that case. + 'dependencies': ['../../src/v8.gyp:v8_maybe_snapshot'], + }, { + 'dependencies': ['../../src/v8.gyp:v8'], + }], + ], + }, + ], +} diff --git a/deps/v8/test/inspector/inspector.status b/deps/v8/test/inspector/inspector.status new file mode 100644 index 0000000000..df922bbf4e --- /dev/null +++ b/deps/v8/test/inspector/inspector.status @@ -0,0 +1,7 @@ +# Copyright 2016 the V8 project authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +[ + +] diff --git a/deps/v8/test/inspector/json-parse-expected.txt b/deps/v8/test/inspector/json-parse-expected.txt new file mode 100644 index 0000000000..b11d6e2ee0 --- /dev/null +++ b/deps/v8/test/inspector/json-parse-expected.txt @@ -0,0 +1,9 @@ +{ + id : 1 + result : { + result : { + type : string + value : Привет мир + } + } +} diff --git a/deps/v8/test/inspector/json-parse.js b/deps/v8/test/inspector/json-parse.js new file mode 100644 index 0000000000..2d88fea0f0 --- /dev/null +++ b/deps/v8/test/inspector/json-parse.js @@ -0,0 +1,14 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +const id = ++InspectorTest._requestId; +var command = { "method": "Runtime.evaluate", "params": { expression: "\"!!!\"" }, "id": id }; +InspectorTest.sendRawCommand(id, JSON.stringify(command).replace("!!!", "\\u041F\\u0440\\u0438\\u0432\\u0435\\u0442 \\u043C\\u0438\\u0440"), step2); + +function step2(msg) +{ + msg.id = 1; + InspectorTest.logObject(msg); + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/protocol-test.js b/deps/v8/test/inspector/protocol-test.js new file mode 100644 index 0000000000..7eb822ae2e --- /dev/null +++ b/deps/v8/test/inspector/protocol-test.js @@ -0,0 +1,210 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +InspectorTest = {}; +InspectorTest._dispatchTable = new Map(); +InspectorTest._requestId = 0; +InspectorTest._dumpInspectorProtocolMessages = false; +InspectorTest._eventHandler = {}; + +Protocol = new Proxy({}, { + get: function(target, agentName, receiver) { + return new Proxy({}, { + get: function(target, methodName, receiver) { + const eventPattern = /^on(ce)?([A-Z][A-Za-z0-9]+)/; + var match = eventPattern.exec(methodName); + if (!match) { + return (args) => InspectorTest._sendCommandPromise(`${agentName}.${methodName}`, args || {}); + } else { + var eventName = match[2]; + eventName = eventName.charAt(0).toLowerCase() + eventName.slice(1); + if (match[1]) + return (args) => InspectorTest._waitForEventPromise(`${agentName}.${eventName}`, args || {}); + else + return (listener) => { InspectorTest._eventHandler[`${agentName}.${eventName}`] = listener }; + } + } + }); + } +}); + +InspectorTest.log = print.bind(null); + +InspectorTest.logMessage = function(message) +{ + if (message.id) + message.id = "<messageId>"; + + const nonStableFields = new Set(["objectId", "scriptId", "exceptionId", "timestamp", "executionContextId", "callFrameId"]); + var objects = [ message ]; + while (objects.length) { + var object = objects.shift(); + for (var key in object) { + if (nonStableFields.has(key)) + object[key] = `<${key}>`; + else if (typeof object[key] === "object") + objects.push(object[key]); + } + } + + InspectorTest.logObject(message); + return message; +} + +InspectorTest.logObject = function(object, title) +{ + var lines = []; + + function dumpValue(value, prefix, prefixWithName) + { + if (typeof value === "object" && value !== null) { + if (value instanceof Array) + dumpItems(value, prefix, prefixWithName); + else + dumpProperties(value, prefix, prefixWithName); + } else { + lines.push(prefixWithName + String(value).replace(/\n/g, " ")); + } + } + + function dumpProperties(object, prefix, firstLinePrefix) + { + prefix = prefix || ""; + firstLinePrefix = firstLinePrefix || prefix; + lines.push(firstLinePrefix + "{"); + + var propertyNames = Object.keys(object); + propertyNames.sort(); + for (var i = 0; i < propertyNames.length; ++i) { + var name = propertyNames[i]; + if (!object.hasOwnProperty(name)) + continue; + var prefixWithName = " " + prefix + name + " : "; + dumpValue(object[name], " " + prefix, prefixWithName); + } + lines.push(prefix + "}"); + } + + function dumpItems(object, prefix, firstLinePrefix) + { + prefix = prefix || ""; + firstLinePrefix = firstLinePrefix || prefix; + lines.push(firstLinePrefix + "["); + for (var i = 0; i < object.length; ++i) + dumpValue(object[i], " " + prefix, " " + prefix + "[" + i + "] : "); + lines.push(prefix + "]"); + } + + dumpValue(object, "", title); + InspectorTest.log(lines.join("\n")); +} + +InspectorTest.completeTest = quit.bind(null); + +InspectorTest.completeTestAfterPendingTimeouts = function() +{ + Protocol.Runtime.evaluate({ + expression: "new Promise(resolve => setTimeout(resolve, 0))", + awaitPromise: true }).then(InspectorTest.completeTest); +} + +InspectorTest.addScript = function(string) +{ + return InspectorTest._sendCommandPromise("Runtime.evaluate", { "expression": string }).then(dumpErrorIfNeeded); + + function dumpErrorIfNeeded(message) + { + if (message.error) { + InspectorTest.log("Error while executing '" + string + "': " + message.error.message); + InspectorTest.completeTest(); + } + } +}; + +InspectorTest.startDumpingProtocolMessages = function() +{ + InspectorTest._dumpInspectorProtocolMessages = true; +} + +InspectorTest.sendRawCommand = function(requestId, command, handler) +{ + if (InspectorTest._dumpInspectorProtocolMessages) + print("frontend: " + command); + InspectorTest._dispatchTable.set(requestId, handler); + sendMessageToBackend(command); +} + +InspectorTest.checkExpectation = function(fail, name, messageObject) +{ + if (fail === !!messageObject.error) { + InspectorTest.log("PASS: " + name); + return true; + } + + InspectorTest.log("FAIL: " + name + ": " + JSON.stringify(messageObject)); + InspectorTest.completeTest(); + return false; +} +InspectorTest.expectedSuccess = InspectorTest.checkExpectation.bind(null, false); +InspectorTest.expectedError = InspectorTest.checkExpectation.bind(null, true); + +InspectorTest.runTestSuite = function(testSuite) +{ + function nextTest() + { + if (!testSuite.length) { + InspectorTest.completeTest(); + return; + } + var fun = testSuite.shift(); + InspectorTest.log("\nRunning test: " + fun.name); + fun(nextTest); + } + nextTest(); +} + +InspectorTest._sendCommandPromise = function(method, params) +{ + var requestId = ++InspectorTest._requestId; + var messageObject = { "id": requestId, "method": method, "params": params }; + var fulfillCallback; + var promise = new Promise(fulfill => fulfillCallback = fulfill); + InspectorTest.sendRawCommand(requestId, JSON.stringify(messageObject), fulfillCallback); + return promise; +} + +InspectorTest._waitForEventPromise = function(eventName) +{ + return new Promise(fulfill => InspectorTest._eventHandler[eventName] = fullfillAndClearListener.bind(null, fulfill)); + + function fullfillAndClearListener(fulfill, result) + { + delete InspectorTest._eventHandler[eventName]; + fulfill(result); + } +} + +InspectorTest._dispatchMessage = function(messageObject) +{ + if (InspectorTest._dumpInspectorProtocolMessages) + print("backend: " + JSON.stringify(messageObject)); + try { + var messageId = messageObject["id"]; + if (typeof messageId === "number") { + var handler = InspectorTest._dispatchTable.get(messageId); + if (handler) { + handler(messageObject); + InspectorTest._dispatchTable.delete(messageId); + } + } else { + var eventName = messageObject["method"]; + var eventHandler = InspectorTest._eventHandler[eventName]; + if (eventHandler) + eventHandler(messageObject); + } + } catch (e) { + InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stack + "\n message = " + JSON.stringify(messageObject, null, 2)); + InspectorTest.completeTest(); + } +} diff --git a/deps/v8/test/inspector/runtime/await-promise-expected.txt b/deps/v8/test/inspector/runtime/await-promise-expected.txt new file mode 100644 index 0000000000..e23ead86cd --- /dev/null +++ b/deps/v8/test/inspector/runtime/await-promise-expected.txt @@ -0,0 +1,119 @@ +Tests that Runtime.awaitPromise works. + +Running test: testResolvedPromise +{ + id : <messageId> + result : { + result : { + description : 239 + type : number + value : 239 + } + } +} + +Running test: testRejectedPromise +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 0 + exception : { + type : object + value : { + a : 1 + } + } + exceptionId : <exceptionId> + lineNumber : 0 + stackTrace : { + callFrames : [ + ] + } + text : Uncaught (in promise) + } + result : { + type : object + value : { + a : 1 + } + } + } +} + +Running test: testRejectedPromiseWithStack +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 0 + exception : { + description : 239 + type : number + value : 239 + } + exceptionId : <exceptionId> + lineNumber : 0 + stackTrace : { + callFrames : [ + ] + parent : { + callFrames : [ + [0] : { + columnNumber : 4 + functionName : rejectPromise + lineNumber : 17 + scriptId : <scriptId> + url : test.js + } + [1] : { + columnNumber : 0 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + description : Promise.reject + } + } + text : Uncaught (in promise) + } + result : { + description : 239 + type : number + value : 239 + } + } +} + +Running test: testPendingPromise +{ + id : <messageId> + result : { + result : { + description : 239 + type : number + value : 239 + } + } +} + +Running test: testResolvedWithoutArgsPromise +{ + id : <messageId> + result : { + result : { + type : undefined + } + } +} + +Running test: testGarbageCollectedPromise +{ + error : { + code : -32000 + message : Promise was collected + } + id : <messageId> +} diff --git a/deps/v8/test/inspector/runtime/await-promise.js b/deps/v8/test/inspector/runtime/await-promise.js new file mode 100644 index 0000000000..dc0c132bab --- /dev/null +++ b/deps/v8/test/inspector/runtime/await-promise.js @@ -0,0 +1,116 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// Flags: --expose_gc + +print("Tests that Runtime.awaitPromise works."); + +InspectorTest.addScript( +` +var resolveCallback; +var rejectCallback; +function createPromise() +{ + return new Promise((resolve, reject) => { resolveCallback = resolve; rejectCallback = reject }); +} + +function resolvePromise() +{ + resolveCallback(239); + resolveCallback = undefined; + rejectCallback = undefined; +} + +function rejectPromise() +{ + rejectCallback(239); + resolveCallback = undefined; + rejectCallback = undefined; +} + +//# sourceURL=test.js`); + +Protocol.Debugger.enable() + .then(() => Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 })) + .then(() => testSuite()); + +function testSuite() +{ + InspectorTest.runTestSuite([ + function testResolvedPromise(next) + { + Protocol.Runtime.evaluate({ expression: "Promise.resolve(239)"}) + .then(result => Protocol.Runtime.awaitPromise({ promiseObjectId: result.result.result.objectId, returnByValue: false, generatePreview: true })) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testRejectedPromise(next) + { + Protocol.Runtime.evaluate({ expression: "Promise.reject({ a : 1 })"}) + .then(result => Protocol.Runtime.awaitPromise({ promiseObjectId: result.result.result.objectId, returnByValue: true, generatePreview: false })) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testRejectedPromiseWithStack(next) + { + Protocol.Runtime.evaluate({ expression: "createPromise()"}) + .then(result => scheduleRejectAndAwaitPromise(result)) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + + function scheduleRejectAndAwaitPromise(result) + { + var promise = Protocol.Runtime.awaitPromise({ promiseObjectId: result.result.result.objectId }); + Protocol.Runtime.evaluate({ expression: "rejectPromise()" }); + return promise; + } + }, + + function testPendingPromise(next) + { + Protocol.Runtime.evaluate({ expression: "createPromise()"}) + .then(result => scheduleFulfillAndAwaitPromise(result)) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + + function scheduleFulfillAndAwaitPromise(result) + { + var promise = Protocol.Runtime.awaitPromise({ promiseObjectId: result.result.result.objectId }); + Protocol.Runtime.evaluate({ expression: "resolvePromise()" }); + return promise; + } + }, + + function testResolvedWithoutArgsPromise(next) + { + Protocol.Runtime.evaluate({ expression: "Promise.resolve()"}) + .then(result => Protocol.Runtime.awaitPromise({ promiseObjectId: result.result.result.objectId, returnByValue: true, generatePreview: false })) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testGarbageCollectedPromise(next) + { + Protocol.Runtime.evaluate({ expression: "new Promise(() => undefined)" }) + .then(result => scheduleGCAndawaitPromise(result)) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + + function scheduleGCAndawaitPromise(result) + { + var objectId = result.result.result.objectId; + var promise = Protocol.Runtime.awaitPromise({ promiseObjectId: objectId }); + gcPromise(objectId); + return promise; + } + + function gcPromise(objectId) + { + Protocol.Runtime.releaseObject({ objectId: objectId}) + .then(() => Protocol.Runtime.evaluate({ expression: "gc()" })); + } + } + ]); +} diff --git a/deps/v8/test/inspector/runtime/call-function-on-async-expected.txt b/deps/v8/test/inspector/runtime/call-function-on-async-expected.txt new file mode 100644 index 0000000000..2d558b85dd --- /dev/null +++ b/deps/v8/test/inspector/runtime/call-function-on-async-expected.txt @@ -0,0 +1,141 @@ +Tests that Runtime.callFunctionOn works with awaitPromise flag. + +Running test: testArguments +{ + id : <messageId> + result : { + result : { + type : string + value : undefined|NaN|[object Object]|[object Object] + } + } +} + +Running test: testSyntaxErrorInFunction +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 2 + exception : { + className : SyntaxError + description : SyntaxError: Unexpected token } + objectId : <objectId> + subtype : error + type : object + } + exceptionId : <exceptionId> + lineNumber : 1 + scriptId : <scriptId> + text : Uncaught + } + result : { + className : SyntaxError + description : SyntaxError: Unexpected token } + objectId : <objectId> + subtype : error + type : object + } + } +} + +Running test: testExceptionInFunctionExpression +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 15 + exception : { + className : Error + description : Error at <anonymous>:1:22 at <anonymous>:1:36 + objectId : <objectId> + subtype : error + type : object + } + exceptionId : <exceptionId> + lineNumber : 0 + scriptId : <scriptId> + text : Uncaught + } + result : { + className : Error + description : Error at <anonymous>:1:22 at <anonymous>:1:36 + objectId : <objectId> + subtype : error + type : object + } + } +} + +Running test: testFunctionReturnNotPromise +{ + code : -32000 + message : Result of the function call is not a promise +} + +Running test: testFunctionReturnResolvedPromiseReturnByValue +{ + id : <messageId> + result : { + result : { + type : object + value : { + a : 3 + } + } + } +} + +Running test: testFunctionReturnResolvedPromiseWithPreview +{ + id : <messageId> + result : { + result : { + className : Object + description : Object + objectId : <objectId> + preview : { + description : Object + overflow : false + properties : [ + [0] : { + name : a + type : number + value : 3 + } + ] + type : object + } + type : object + } + } +} + +Running test: testFunctionReturnRejectedPromise +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 0 + exception : { + type : object + value : { + a : 3 + } + } + exceptionId : <exceptionId> + lineNumber : 0 + stackTrace : { + callFrames : [ + ] + } + text : Uncaught (in promise) + } + result : { + type : object + value : { + a : 3 + } + } + } +}
\ No newline at end of file diff --git a/deps/v8/test/inspector/runtime/call-function-on-async.js b/deps/v8/test/inspector/runtime/call-function-on-async.js new file mode 100644 index 0000000000..4a72bbd40f --- /dev/null +++ b/deps/v8/test/inspector/runtime/call-function-on-async.js @@ -0,0 +1,129 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Tests that Runtime.callFunctionOn works with awaitPromise flag."); + +InspectorTest.runTestSuite([ + function testArguments(next) + { + callFunctionOn( + "({a : 1})", + "function(arg1, arg2, arg3, arg4) { return \"\" + arg1 + \"|\" + arg2 + \"|\" + arg3 + \"|\" + arg4; }", + [ "undefined", "NaN", "({a:2})", "this"], + /* returnByValue */ true, + /* generatePreview */ false, + /* awaitPromise */ false) + .then((result) => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testSyntaxErrorInFunction(next) + { + callFunctionOn( + "({a : 1})", + "\n }", + [], + /* returnByValue */ false, + /* generatePreview */ false, + /* awaitPromise */ true) + .then((result) => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testExceptionInFunctionExpression(next) + { + callFunctionOn( + "({a : 1})", + "(function() { throw new Error() })()", + [], + /* returnByValue */ false, + /* generatePreview */ false, + /* awaitPromise */ true) + .then((result) => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testFunctionReturnNotPromise(next) + { + callFunctionOn( + "({a : 1})", + "(function() { return 239; })", + [], + /* returnByValue */ false, + /* generatePreview */ false, + /* awaitPromise */ true) + .then((result) => InspectorTest.logMessage(result.error)) + .then(() => next()); + }, + + function testFunctionReturnResolvedPromiseReturnByValue(next) + { + callFunctionOn( + "({a : 1})", + "(function(arg) { return Promise.resolve({a : this.a + arg.a}); })", + [ "({a:2})" ], + /* returnByValue */ true, + /* generatePreview */ false, + /* awaitPromise */ true) + .then((result) => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testFunctionReturnResolvedPromiseWithPreview(next) + { + callFunctionOn( + "({a : 1})", + "(function(arg) { return Promise.resolve({a : this.a + arg.a}); })", + [ "({a:2})" ], + /* returnByValue */ false, + /* generatePreview */ true, + /* awaitPromise */ true) + .then((result) => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testFunctionReturnRejectedPromise(next) + { + callFunctionOn( + "({a : 1})", + "(function(arg) { return Promise.reject({a : this.a + arg.a}); })", + [ "({a:2})" ], + /* returnByValue */ true, + /* generatePreview */ false, + /* awaitPromise */ true) + .then((result) => InspectorTest.logMessage(result)) + .then(() => next()); + } +]); + +function callFunctionOn(objectExpression, functionDeclaration, argumentExpressions, returnByValue, generatePreview, awaitPromise) +{ + var objectId; + var callArguments = []; + var promise = Protocol.Runtime.evaluate({ expression: objectExpression }) + .then((result) => objectId = result.result.result.objectId) + for (let argumentExpression of argumentExpressions) { + promise = promise + .then(() => Protocol.Runtime.evaluate({ expression: argumentExpression })) + .then((result) => addArgument(result.result.result)); + } + return promise.then(() => Protocol.Runtime.callFunctionOn({ objectId: objectId, functionDeclaration: functionDeclaration, arguments: callArguments, returnByValue: returnByValue, generatePreview: generatePreview, awaitPromise: awaitPromise })); + + function addArgument(result) + { + if (result.objectId) { + callArguments.push({ objectId: result.objectId }); + } else if (result.value) { + callArguments.push({ value: result.value }) + } else if (result.unserializableValue) { + callArguments.push({ unserializableValue: result.unserializableValue }); + } else if (result.type === "undefined") { + callArguments.push({}); + } else { + InspectorTest.log("Unexpected argument object:"); + InspectorTest.logMessage(result); + InspectorTest.completeTest(); + } + } +} diff --git a/deps/v8/test/inspector/runtime/clear-of-command-line-api-expected.txt b/deps/v8/test/inspector/runtime/clear-of-command-line-api-expected.txt new file mode 100644 index 0000000000..142989b731 --- /dev/null +++ b/deps/v8/test/inspector/runtime/clear-of-command-line-api-expected.txt @@ -0,0 +1,177 @@ +Tests that CommandLineAPI is presented only while evaluation. + +{ + id : <messageId> + result : { + result : { + description : 15 + type : number + value : 15 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 0 + type : number + value : 0 + } + } +} +setPropertyForMethod() +{ + id : <messageId> + result : { + result : { + description : 14 + type : number + value : 14 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 0 + type : number + value : 0 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 42 + type : number + value : 42 + } + } +} +defineValuePropertyForMethod() +{ + id : <messageId> + result : { + result : { + description : 14 + type : number + value : 14 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 0 + type : number + value : 0 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 42 + type : number + value : 42 + } + } +} +definePropertiesForMethod() +{ + id : <messageId> + result : { + result : { + description : 14 + type : number + value : 14 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 0 + type : number + value : 0 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 42 + type : number + value : 42 + } + } +} +defineAccessorPropertyForMethod() +{ + id : <messageId> + result : { + result : { + description : 14 + type : number + value : 14 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 0 + type : number + value : 0 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 42 + type : number + value : 42 + } + } +} +redefineGetOwnPropertyDescriptors() +{ + id : <messageId> + result : { + result : { + description : 14 + type : number + value : 14 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 0 + type : number + value : 0 + } + } +} +{ + id : <messageId> + result : { + result : { + description : 42 + type : number + value : 42 + } + } +}
\ No newline at end of file diff --git a/deps/v8/test/inspector/runtime/clear-of-command-line-api.js b/deps/v8/test/inspector/runtime/clear-of-command-line-api.js new file mode 100644 index 0000000000..2af2f4917f --- /dev/null +++ b/deps/v8/test/inspector/runtime/clear-of-command-line-api.js @@ -0,0 +1,117 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Tests that CommandLineAPI is presented only while evaluation."); + +InspectorTest.addScript( +` +var methods = ["dir","dirxml","profile","profileEnd","clear","table","keys","values","debug","undebug","monitor","unmonitor","inspect","copy"]; +var window = this; +function presentedAPIMethods() +{ + var methodCount = 0; + for (var method of methods) { + try { + if (eval("window." + method + "&&" + method + ".toString ? " + method + ".toString().indexOf(\\"[Command Line API]\\") !== -1 : false")) + ++methodCount; + } catch (e) { + } + } + methodCount += eval("\\"$_\\" in window ? $_ === 239 : false") ? 1 : 0; + return methodCount; +} + +function setPropertyForMethod() +{ + window.dir = 42; +} + +function defineValuePropertyForMethod() +{ + Object.defineProperty(window, "dir", { value: 42 }); +} + +function defineAccessorPropertyForMethod() +{ + Object.defineProperty(window, "dir", { set: function() {}, get: function(){ return 42 } }); +} + +function definePropertiesForMethod() +{ + Object.defineProperties(window, { "dir": { set: function() {}, get: function(){ return 42 } }}); +} + +var builtinGetOwnPropertyDescriptorOnObject; +var builtinGetOwnPropertyDescriptorOnObjectPrototype; +var builtinGetOwnPropertyDescriptorOnWindow; + +function redefineGetOwnPropertyDescriptors() +{ + builtinGetOwnPropertyDescriptorOnObject = Object.getOwnPropertyDescriptor; + Object.getOwnPropertyDescriptor = function() {} + builtinGetOwnPropertyDescriptorOnObjectPrototype = Object.prototype.getOwnPropertyDescriptor; + Object.prototype.getOwnPropertyDescriptor = function() {} + builtinGetOwnPropertyDescriptorOnWindow = window.getOwnPropertyDescriptor; + window.getOwnPropertyDescriptor = function() {} +} + +function restoreGetOwnPropertyDescriptors() +{ + Object.getOwnPropertyDescriptor = builtinGetOwnPropertyDescriptorOnObject; + Object.prototype.getOwnPropertyDescriptor = builtinGetOwnPropertyDescriptorOnObjectPrototype; + window.getOwnPropertyDescriptor = builtinGetOwnPropertyDescriptorOnWindow; +}`); + +runExpressionAndDumpPresentedMethods("") + .then(dumpLeftMethods) + .then(() => runExpressionAndDumpPresentedMethods("setPropertyForMethod()")) + .then(dumpLeftMethods) + .then(dumpDir) + .then(() => runExpressionAndDumpPresentedMethods("defineValuePropertyForMethod()")) + .then(dumpLeftMethods) + .then(dumpDir) + .then(() => runExpressionAndDumpPresentedMethods("definePropertiesForMethod()")) + .then(dumpLeftMethods) + .then(dumpDir) + .then(() => runExpressionAndDumpPresentedMethods("defineAccessorPropertyForMethod()")) + .then(dumpLeftMethods) + .then(dumpDir) + .then(() => runExpressionAndDumpPresentedMethods("redefineGetOwnPropertyDescriptors()")) + .then(dumpLeftMethods) + .then(dumpDir) + .then(() => evaluate("restoreGetOwnPropertyDescriptors()", false)) + .then(InspectorTest.completeTest); + +function evaluate(expression, includeCommandLineAPI) +{ + return Protocol.Runtime.evaluate({ expression: expression, objectGroup: "console", includeCommandLineAPI: includeCommandLineAPI }); +} + +function setLastEvaluationResultTo239() +{ + return evaluate("239", false); +} + +function runExpressionAndDumpPresentedMethods(expression) +{ + InspectorTest.log(expression); + return setLastEvaluationResultTo239() + .then(() => evaluate(expression + "; var a = presentedAPIMethods(); a", true)) + .then((result) => InspectorTest.logMessage(result)); +} + +function dumpLeftMethods() +{ + // Should always be zero. + return setLastEvaluationResultTo239() + .then(() => evaluate("presentedAPIMethods()", false)) + .then((result) => InspectorTest.logMessage(result)); +} + +function dumpDir() +{ + // Should always be presented. + return evaluate("dir", false) + .then((result) => InspectorTest.logMessage(result)); +} diff --git a/deps/v8/test/inspector/runtime/compile-script-expected.txt b/deps/v8/test/inspector/runtime/compile-script-expected.txt new file mode 100644 index 0000000000..3d6d580487 --- /dev/null +++ b/deps/v8/test/inspector/runtime/compile-script-expected.txt @@ -0,0 +1,66 @@ +Compiling script: foo1.js + persist: false +compilation result: +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 2 + exception : { + className : SyntaxError + description : SyntaxError: Unexpected end of input + objectId : <objectId> + subtype : error + type : object + } + exceptionId : <exceptionId> + lineNumber : 1 + scriptId : <scriptId> + text : Uncaught + } + } +} +----- +Compiling script: foo2.js + persist: true +Debugger.scriptParsed: foo2.js +compilation result: +{ + id : <messageId> + result : { + scriptId : <scriptId> + } +} +----- +Compiling script: foo3.js + persist: false +compilation result: +{ + id : <messageId> + result : { + } +} +----- +Compiling script: foo4.js + persist: false +compilation result: +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 13 + exception : { + className : SyntaxError + description : SyntaxError: Unexpected identifier + objectId : <objectId> + subtype : error + type : object + } + exceptionId : <exceptionId> + lineNumber : 0 + scriptId : <scriptId> + text : Uncaught + } + } +} +-----
\ No newline at end of file diff --git a/deps/v8/test/inspector/runtime/compile-script.js b/deps/v8/test/inspector/runtime/compile-script.js new file mode 100644 index 0000000000..4f1c6468e1 --- /dev/null +++ b/deps/v8/test/inspector/runtime/compile-script.js @@ -0,0 +1,50 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var executionContextId; + +Protocol.Debugger.enable().then(onDebuggerEnabled); + +function onDebuggerEnabled() +{ + Protocol.Runtime.enable(); + Protocol.Debugger.onScriptParsed(onScriptParsed); + Protocol.Runtime.onExecutionContextCreated(onExecutionContextCreated); +} + +function onScriptParsed(messageObject) +{ + if (!messageObject.params.url) + return; + InspectorTest.log("Debugger.scriptParsed: " + messageObject.params.url); +} + +function onExecutionContextCreated(messageObject) +{ + executionContextId = messageObject.params.context.id; + testCompileScript("\n (", false, "foo1.js") + .then(() => testCompileScript("239", true, "foo2.js")) + .then(() => testCompileScript("239", false, "foo3.js")) + .then(() => testCompileScript("testfunction f()\n{\n return 0;\n}\n", false, "foo4.js")) + .then(() => InspectorTest.completeTest()); +} + +function testCompileScript(expression, persistScript, sourceURL) +{ + InspectorTest.log("Compiling script: " + sourceURL); + InspectorTest.log(" persist: " + persistScript); + return Protocol.Runtime.compileScript({ + expression: expression, + sourceURL: sourceURL, + persistScript: persistScript, + executionContextId: executionContextId + }).then(onCompiled); + + function onCompiled(messageObject) + { + InspectorTest.log("compilation result: "); + InspectorTest.logMessage(messageObject); + InspectorTest.log("-----"); + } +} diff --git a/deps/v8/test/inspector/runtime/console-api-repeated-in-console-expected.txt b/deps/v8/test/inspector/runtime/console-api-repeated-in-console-expected.txt new file mode 100644 index 0000000000..04d2d90265 --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-api-repeated-in-console-expected.txt @@ -0,0 +1,6 @@ +Check that console.log is reported through Console domain as well. +api call: 42 +api call: abc +console message: 42 +console message: abc + diff --git a/deps/v8/test/inspector/runtime/console-api-repeated-in-console.js b/deps/v8/test/inspector/runtime/console-api-repeated-in-console.js new file mode 100644 index 0000000000..ec4b34d8ad --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-api-repeated-in-console.js @@ -0,0 +1,37 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Check that console.log is reported through Console domain as well."); + +var expectedMessages = 4; +var messages = []; + +Protocol.Runtime.onConsoleAPICalled(consoleAPICalled); +Protocol.Console.onMessageAdded(messageAdded); +Protocol.Runtime.enable(); +Protocol.Console.enable(); +Protocol.Runtime.evaluate({ "expression": "console.log(42)" }); +Protocol.Runtime.evaluate({ "expression": "console.error('abc')" }); + +function consoleAPICalled(result) +{ + messages.push("api call: " + result.params.args[0].value); + if (!(--expectedMessages)) + done(); +} + +function messageAdded(result) +{ + messages.push("console message: " + result.params.message.text); + if (!(--expectedMessages)) + done(); +} + +function done() +{ + messages.sort(); + for (var message of messages) + InspectorTest.log(message); + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/runtime/console-deprecated-methods-expected.txt b/deps/v8/test/inspector/runtime/console-deprecated-methods-expected.txt new file mode 100644 index 0000000000..1b8e4aa2ce --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-deprecated-methods-expected.txt @@ -0,0 +1,5 @@ +Tests checks that deprecation messages for console. +'console.timeline' is deprecated. Please use 'console.time' instead. +'console.timelineEnd' is deprecated. Please use 'console.timeEnd' instead. +'console.markTimeline' is deprecated. Please use 'console.timeStamp' instead. + diff --git a/deps/v8/test/inspector/runtime/console-deprecated-methods.js b/deps/v8/test/inspector/runtime/console-deprecated-methods.js new file mode 100644 index 0000000000..2705cb083f --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-deprecated-methods.js @@ -0,0 +1,28 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Tests checks that deprecation messages for console.") + +Protocol.Runtime.onConsoleAPICalled(messageAdded); +Protocol.Runtime.enable(); + +var deprecatedMethods = [ + "console.timeline(\"42\")", + "console.timeline(\"42\")", + "console.timeline(\"42\")", // three calls should produce one warning message + "console.timelineEnd(\"42\")", + "console.markTimeline(\"42\")", +]; +Protocol.Runtime.evaluate({ expression: deprecatedMethods.join(";") }); + +var messagesLeft = 3; +function messageAdded(data) +{ + var text = data.params.args[0].value; + if (text.indexOf("deprecated") === -1) + return; + InspectorTest.log(text); + if (!--messagesLeft) + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/runtime/console-line-and-column-expected.txt b/deps/v8/test/inspector/runtime/console-line-and-column-expected.txt new file mode 100644 index 0000000000..4eab60af0d --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-line-and-column-expected.txt @@ -0,0 +1,52 @@ +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + description : 239 + type : number + value : 239 + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 8 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : log + } +} +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + description : 239 + type : number + value : 239 + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 2 + functionName : + lineNumber : 1 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : log + } +}
\ No newline at end of file diff --git a/deps/v8/test/inspector/runtime/console-line-and-column.js b/deps/v8/test/inspector/runtime/console-line-and-column.js new file mode 100644 index 0000000000..fe5c24f27c --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-line-and-column.js @@ -0,0 +1,18 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Protocol.Runtime.enable(); + +addConsoleMessagePromise("console.log(239)") + .then(message => InspectorTest.logMessage(message)) + .then(() => addConsoleMessagePromise("var l = console.log;\n l(239)")) + .then(message => InspectorTest.logMessage(message)) + .then(() => InspectorTest.completeTest()); + +function addConsoleMessagePromise(expression) +{ + var wait = Protocol.Runtime.onceConsoleAPICalled(); + Protocol.Runtime.evaluate({ expression: expression }); + return wait; +} diff --git a/deps/v8/test/inspector/runtime/console-log-doesnt-run-microtasks-expected.txt b/deps/v8/test/inspector/runtime/console-log-doesnt-run-microtasks-expected.txt new file mode 100644 index 0000000000..5a234ec78c --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-log-doesnt-run-microtasks-expected.txt @@ -0,0 +1,21 @@ +Check that console.log doesn't run microtasks. +{ + description : 42 + type : number + value : 42 +} +{ + description : 43 + type : number + value : 43 +} +{ + description : 239 + type : number + value : 239 +} +{ + type : string + value : finished +} + diff --git a/deps/v8/test/inspector/runtime/console-log-doesnt-run-microtasks.js b/deps/v8/test/inspector/runtime/console-log-doesnt-run-microtasks.js new file mode 100644 index 0000000000..b7a87391e0 --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-log-doesnt-run-microtasks.js @@ -0,0 +1,26 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Check that console.log doesn't run microtasks."); + +InspectorTest.addScript( +` +function testFunction() +{ + Promise.resolve().then(function(){ console.log(239); }); + console.log(42); + console.log(43); +}`); + +Protocol.Runtime.enable(); +Protocol.Runtime.onConsoleAPICalled(messageAdded); +Protocol.Runtime.evaluate({ "expression": "testFunction()" }); +Protocol.Runtime.evaluate({ "expression": "setTimeout(() => console.log(\"finished\"), 0)" }); + +function messageAdded(result) +{ + InspectorTest.logObject(result.params.args[0]); + if (result.params.args[0].value === "finished") + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/runtime/console-timestamp-expected.txt b/deps/v8/test/inspector/runtime/console-timestamp-expected.txt new file mode 100644 index 0000000000..5e4d7b5ada --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-timestamp-expected.txt @@ -0,0 +1,9 @@ +Message has timestamp: true +Message timestamp doesn't differ too much from current time (one minute interval): true +Message 1 has non-decreasing timestamp: true +Message has timestamp: true +Message timestamp doesn't differ too much from current time (one minute interval): true +Message 2 has non-decreasing timestamp: true +Message has timestamp: true +Message timestamp doesn't differ too much from current time (one minute interval): true + diff --git a/deps/v8/test/inspector/runtime/console-timestamp.js b/deps/v8/test/inspector/runtime/console-timestamp.js new file mode 100644 index 0000000000..0dceaed23f --- /dev/null +++ b/deps/v8/test/inspector/runtime/console-timestamp.js @@ -0,0 +1,23 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var messages = []; + +function messageAdded(data) +{ + var payload = data.params; + if (messages.length > 0) + InspectorTest.log("Message " + messages.length + " has non-decreasing timestamp: " + (payload.timestamp >= messages[messages.length - 1].timestamp)); + + messages.push(payload); + InspectorTest.log("Message has timestamp: " + !!payload.timestamp); + + InspectorTest.log("Message timestamp doesn't differ too much from current time (one minute interval): " + (Math.abs(new Date().getTime() - payload.timestamp) < 60000)); + if (messages.length === 3) + InspectorTest.completeTest(); +} + +Protocol.Runtime.onConsoleAPICalled(messageAdded); +Protocol.Runtime.enable(); +Protocol.Runtime.evaluate({ expression: "console.log('testUnique'); for (var i = 0; i < 2; ++i) console.log('testDouble');" }); diff --git a/deps/v8/test/inspector/runtime/evaluate-async-expected.txt b/deps/v8/test/inspector/runtime/evaluate-async-expected.txt new file mode 100644 index 0000000000..c03dd7a409 --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-async-expected.txt @@ -0,0 +1,95 @@ +Tests that Runtime.evaluate works with awaitPromise flag. + +Running test: testResolvedPromise +{ + id : <messageId> + result : { + result : { + description : 239 + type : number + value : 239 + } + } +} + +Running test: testRejectedPromise +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 0 + exception : { + description : 239 + type : number + value : 239 + } + exceptionId : <exceptionId> + lineNumber : 0 + stackTrace : { + callFrames : [ + ] + } + text : Uncaught (in promise) + } + result : { + description : 239 + type : number + value : 239 + } + } +} + +Running test: testPrimitiveValueInsteadOfPromise +{ + error : { + code : -32000 + message : Result of the evaluation is not a promise + } + id : <messageId> +} + +Running test: testObjectInsteadOfPromise +{ + error : { + code : -32000 + message : Result of the evaluation is not a promise + } + id : <messageId> +} + +Running test: testPendingPromise +{ + id : <messageId> + result : { + result : { + type : object + value : { + a : 239 + } + } + } +} + +Running test: testExceptionInEvaluate +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 0 + exception : { + description : 239 + type : number + value : 239 + } + exceptionId : <exceptionId> + lineNumber : 0 + scriptId : <scriptId> + text : Uncaught + } + result : { + description : 239 + type : number + value : 239 + } + } +} diff --git a/deps/v8/test/inspector/runtime/evaluate-async-with-wrap-error-expected.txt b/deps/v8/test/inspector/runtime/evaluate-async-with-wrap-error-expected.txt new file mode 100644 index 0000000000..743acdbc08 --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-async-with-wrap-error-expected.txt @@ -0,0 +1,8 @@ +Test that Runtime.evaluate correctly process errors during wrapping async result. +{ + error : { + code : -32000 + message : Object couldn't be returned by value + } + id : <messageId> +} diff --git a/deps/v8/test/inspector/runtime/evaluate-async-with-wrap-error.js b/deps/v8/test/inspector/runtime/evaluate-async-with-wrap-error.js new file mode 100644 index 0000000000..e5da89ecfc --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-async-with-wrap-error.js @@ -0,0 +1,15 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Test that Runtime.evaluate correctly process errors during wrapping \ +async result."); + +var evaluateArguments = { + expression: "Promise.resolve(Symbol(123))", + returnByValue: true, + awaitPromise: true +}; +Protocol.Runtime.evaluate(evaluateArguments) + .then(message => InspectorTest.logMessage(message)) + .then(() => InspectorTest.completeTest()); diff --git a/deps/v8/test/inspector/runtime/evaluate-async.js b/deps/v8/test/inspector/runtime/evaluate-async.js new file mode 100644 index 0000000000..ed4b6e30e2 --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-async.js @@ -0,0 +1,58 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Tests that Runtime.evaluate works with awaitPromise flag."); + +InspectorTest.addScript(` +function createPromiseAndScheduleResolve() +{ + var resolveCallback; + var promise = new Promise((resolve) => resolveCallback = resolve); + setTimeout(resolveCallback.bind(null, { a : 239 }), 0); + return promise; +}`); + +InspectorTest.runTestSuite([ + function testResolvedPromise(next) + { + Protocol.Runtime.evaluate({ expression: "Promise.resolve(239)", awaitPromise: true, generatePreview: true }) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testRejectedPromise(next) + { + Protocol.Runtime.evaluate({ expression: "Promise.reject(239)", awaitPromise: true }) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testPrimitiveValueInsteadOfPromise(next) + { + Protocol.Runtime.evaluate({ expression: "true", awaitPromise: true }) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testObjectInsteadOfPromise(next) + { + Protocol.Runtime.evaluate({ expression: "({})", awaitPromise: true }) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testPendingPromise(next) + { + Protocol.Runtime.evaluate({ expression: "createPromiseAndScheduleResolve()", awaitPromise: true, returnByValue: true }) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testExceptionInEvaluate(next) + { + Protocol.Runtime.evaluate({ expression: "throw 239", awaitPromise: true }) + .then(result => InspectorTest.logMessage(result)) + .then(() => next()); + } +]); diff --git a/deps/v8/test/inspector/runtime/evaluate-with-context-id-equal-zero-expected.txt b/deps/v8/test/inspector/runtime/evaluate-with-context-id-equal-zero-expected.txt new file mode 100644 index 0000000000..9521a06c06 --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-with-context-id-equal-zero-expected.txt @@ -0,0 +1,9 @@ +Tests that DevTools doesn't crash on Runtime.evaluate with contextId equals 0. +{ + error : { + code : -32000 + message : Cannot find context with specified id + } + id : <messageId> +} + diff --git a/deps/v8/test/inspector/runtime/evaluate-with-context-id-equal-zero.js b/deps/v8/test/inspector/runtime/evaluate-with-context-id-equal-zero.js new file mode 100644 index 0000000000..d37a00ce37 --- /dev/null +++ b/deps/v8/test/inspector/runtime/evaluate-with-context-id-equal-zero.js @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Tests that DevTools doesn't crash on Runtime.evaluate with contextId equals 0."); + +Protocol.Runtime.evaluate({ "contextId": 0, "expression": "" }) + .then(message => InspectorTest.logMessage(message)) + .then(() => InspectorTest.completeTest()); diff --git a/deps/v8/test/inspector/runtime/exception-thrown-expected.txt b/deps/v8/test/inspector/runtime/exception-thrown-expected.txt new file mode 100644 index 0000000000..228c348298 --- /dev/null +++ b/deps/v8/test/inspector/runtime/exception-thrown-expected.txt @@ -0,0 +1,117 @@ +Check that exceptionThrown is supported by test runner. +{ + method : Runtime.exceptionThrown + params : { + exceptionDetails : { + columnNumber : 2 + exception : { + className : Error + description : Error at setTimeout (<anonymous>:2:9) + objectId : <objectId> + preview : { + description : Error at setTimeout (<anonymous>:2:9) + overflow : false + properties : [ + [0] : { + name : stack + type : string + value : Error at setTimeout (<anonymous>:2:9) + } + ] + subtype : error + type : object + } + subtype : error + type : object + } + exceptionId : <exceptionId> + executionContextId : <executionContextId> + lineNumber : 1 + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 8 + functionName : setTimeout + lineNumber : 1 + scriptId : <scriptId> + url : + } + ] + } + text : Uncaught Error + } + timestamp : <timestamp> + } +} +{ + method : Runtime.exceptionThrown + params : { + exceptionDetails : { + columnNumber : 1 + exception : { + className : SyntaxError + description : SyntaxError: Unexpected token } + objectId : <objectId> + preview : { + description : SyntaxError: Unexpected token } + overflow : false + properties : [ + [0] : { + name : stack + type : string + value : SyntaxError: Unexpected token } + } + [1] : { + name : message + type : string + value : Unexpected token } + } + ] + subtype : error + type : object + } + subtype : error + type : object + } + exceptionId : <exceptionId> + executionContextId : <executionContextId> + lineNumber : 0 + scriptId : <scriptId> + stackTrace : { + callFrames : [ + ] + } + text : Uncaught SyntaxError: Unexpected token } + } + timestamp : <timestamp> + } +} +{ + method : Runtime.exceptionThrown + params : { + exceptionDetails : { + columnNumber : 2 + exception : { + description : 239 + type : number + value : 239 + } + exceptionId : <exceptionId> + executionContextId : <executionContextId> + lineNumber : 1 + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 2 + functionName : setTimeout + lineNumber : 1 + scriptId : <scriptId> + url : + } + ] + } + text : Uncaught 239 + } + timestamp : <timestamp> + } +} diff --git a/deps/v8/test/inspector/runtime/exception-thrown.js b/deps/v8/test/inspector/runtime/exception-thrown.js new file mode 100644 index 0000000000..76752f9d3b --- /dev/null +++ b/deps/v8/test/inspector/runtime/exception-thrown.js @@ -0,0 +1,12 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Check that exceptionThrown is supported by test runner.") + +Protocol.Runtime.enable(); +Protocol.Runtime.onExceptionThrown(message => InspectorTest.logMessage(message)); +Protocol.Runtime.evaluate({ expression: "setTimeout(() => { \n throw new Error() }, 0)" }); +Protocol.Runtime.evaluate({ expression: "setTimeout(\" }\", 0)" }); +Protocol.Runtime.evaluate({ expression: "setTimeout(() => { \n throw 239; }, 0)" }); +InspectorTest.completeTestAfterPendingTimeouts(); diff --git a/deps/v8/test/inspector/runtime/get-properties-expected.txt b/deps/v8/test/inspector/runtime/get-properties-expected.txt new file mode 100644 index 0000000000..bb74386de8 --- /dev/null +++ b/deps/v8/test/inspector/runtime/get-properties-expected.txt @@ -0,0 +1,39 @@ +Properties of Object(5) + __proto__ own object undefined + foo own string cat +Internal properties + [[PrimitiveValue]] number 5 +Properties of Not own properties + __defineGetter__ inherited function undefined + __defineSetter__ inherited function undefined + __lookupGetter__ inherited function undefined + __lookupSetter__ inherited function undefined + __proto__ inherited no value, getter, setter + a own number 2 + b own no value, getter, setter + c inherited number 4 + constructor inherited function undefined + d inherited no value, getter + hasOwnProperty inherited function undefined + isPrototypeOf inherited function undefined + propertyIsEnumerable inherited function undefined + toLocaleString inherited function undefined + toString inherited function undefined + valueOf inherited function undefined +Properties of Accessor only properties + b own no value, getter, setter + d own no value, setter +Properties of array + 0 own string red + 1 own string green + 2 own string blue + __proto__ own object undefined + length own number 3 +Properties of Bound function + __proto__ own function undefined + length own number 0 + name own string bound Number +Internal properties + [[BoundArgs]] object undefined + [[BoundThis]] object undefined + [[TargetFunction]] function undefined diff --git a/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt b/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt new file mode 100644 index 0000000000..b36c811771 --- /dev/null +++ b/deps/v8/test/inspector/runtime/get-properties-on-proxy-expected.txt @@ -0,0 +1,11 @@ +Check that while Runtime.getProperties call on proxy object no user defined trap will be executed. +{ + id : <messageId> + result : { + result : { + description : 0 + type : number + value : 0 + } + } +}
\ No newline at end of file diff --git a/deps/v8/test/inspector/runtime/get-properties-on-proxy.js b/deps/v8/test/inspector/runtime/get-properties-on-proxy.js new file mode 100644 index 0000000000..40e2a96107 --- /dev/null +++ b/deps/v8/test/inspector/runtime/get-properties-on-proxy.js @@ -0,0 +1,101 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Check that while Runtime.getProperties call on proxy object no user defined trap will be executed."); + +InspectorTest.addScript(` +var self = this; +function testFunction() +{ + self.counter = 0; + var handler = { + get: function(target, name){ + self.counter++; + return Reflect.get.apply(this, arguments); + }, + set: function(target, name){ + self.counter++; + return Reflect.set.apply(this, arguments); + }, + getPrototypeOf: function(target) { + self.counter++; + return Reflect.getPrototypeOf.apply(this, arguments); + }, + setPrototypeOf: function(target) { + self.counter++; + return Reflect.setPrototypeOf.apply(this, arguments); + }, + isExtensible: function(target) { + self.counter++; + return Reflect.isExtensible.apply(this, arguments); + }, + isExtensible: function(target) { + self.counter++; + return Reflect.isExtensible.apply(this, arguments); + }, + isExtensible: function(target) { + self.counter++; + return Reflect.isExtensible.apply(this, arguments); + }, + preventExtensions: function() { + self.counter++; + return Reflect.preventExtensions.apply(this, arguments); + }, + getOwnPropertyDescriptor: function() { + self.counter++; + return Reflect.getOwnPropertyDescriptor.apply(this, arguments); + }, + defineProperty: function() { + self.counter++; + return Reflect.defineProperty.apply(this, arguments); + }, + has: function() { + self.counter++; + return Reflect.has.apply(this, arguments); + }, + get: function() { + self.counter++; + return Reflect.get.apply(this, arguments); + }, + set: function() { + self.counter++; + return Reflect.set.apply(this, arguments); + }, + deleteProperty: function() { + self.counter++; + return Reflect.deleteProperty.apply(this, arguments); + }, + ownKeys: function() { + self.counter++; + return Reflect.ownKeys.apply(this, arguments); + }, + apply: function() { + self.counter++; + return Reflect.apply.apply(this, arguments); + }, + construct: function() { + self.counter++; + return Reflect.construct.apply(this, arguments); + } + }; + return new Proxy({ a : 1}, handler); +}`); + +Protocol.Runtime.evaluate({ expression: "testFunction()"}).then(requestProperties); + +function requestProperties(result) +{ + Protocol.Runtime.getProperties({ objectId: result.result.objectId, generatePreview: true }).then(checkCounter); +} + +function checkCounter(result) +{ + Protocol.Runtime.evaluate({ expression: "self.counter" }).then(dumpCounter); +} + +function dumpCounter(result) +{ + InspectorTest.logMessage(result); + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/runtime/get-properties-preview-expected.txt b/deps/v8/test/inspector/runtime/get-properties-preview-expected.txt new file mode 100644 index 0000000000..fd1f31a4c2 --- /dev/null +++ b/deps/v8/test/inspector/runtime/get-properties-preview-expected.txt @@ -0,0 +1,32 @@ +p1 : Object +p2 : Object +p1 : { + "type": "object", + "description": "Object", + "overflow": false, + "properties": [ + { + "name": "a", + "type": "number", + "value": "1" + } + ] +} +p2 : { + "type": "object", + "description": "Object", + "overflow": false, + "properties": [ + { + "name": "b", + "type": "string", + "value": "foo" + }, + { + "name": "bb", + "type": "string", + "value": "bar" + } + ] +} + diff --git a/deps/v8/test/inspector/runtime/get-properties-preview.js b/deps/v8/test/inspector/runtime/get-properties-preview.js new file mode 100644 index 0000000000..7cc81bc486 --- /dev/null +++ b/deps/v8/test/inspector/runtime/get-properties-preview.js @@ -0,0 +1,25 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Protocol.Runtime.evaluate({ "expression": "({p1: {a:1}, p2: {b:'foo', bb:'bar'}})" }).then(callbackEvaluate); + +function callbackEvaluate(result) +{ + Protocol.Runtime.getProperties({ "objectId": result.result.result.objectId, "ownProperties": true }).then(callbackGetProperties.bind(null, false)); + Protocol.Runtime.getProperties({ "objectId": result.result.result.objectId, "ownProperties": true, "generatePreview": true }).then(callbackGetProperties.bind(null, true)); +} + +function callbackGetProperties(completeTest, result) +{ + for (var property of result.result.result) { + if (!property.value || property.name === "__proto__") + continue; + if (property.value.preview) + InspectorTest.log(property.name + " : " + JSON.stringify(property.value.preview, null, 4)); + else + InspectorTest.log(property.name + " : " + property.value.description); + } + if (completeTest) + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/runtime/get-properties.js b/deps/v8/test/inspector/runtime/get-properties.js new file mode 100644 index 0000000000..579e5422d9 --- /dev/null +++ b/deps/v8/test/inspector/runtime/get-properties.js @@ -0,0 +1,221 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// A general-purpose engine for sending a sequence of protocol commands. +// The clients provide requests and response handlers, while the engine catches +// errors and makes sure that once there's nothing to do completeTest() is called. +// @param step is an object with command, params and callback fields +function runRequestSeries(step) +{ + processStep(step); + + function processStep(s) + { + try { + processStepOrFail(s); + } catch (e) { + InspectorTest.log(e.stack); + InspectorTest.completeTest(); + } + } + + function processStepOrFail(s) + { + if (!s) { + InspectorTest.completeTest(); + return; + } + if (!s.command) { + // A simple loopback step. + var next = s.callback(); + processStep(next); + return; + } + + var innerCallback = function(response) + { + if ("error" in response) { + InspectorTest.log(response.error.message); + InspectorTest.completeTest(); + return; + } + var next; + try { + next = s.callback(response.result); + } catch (e) { + InspectorTest.log(e.stack); + InspectorTest.completeTest(); + return; + } + processStep(next); + } + var command = s.command.split("."); + Protocol[command[0]][command[1]](s.params).then(innerCallback); + } +} + +var firstStep = { callback: callbackStart5 }; + +runRequestSeries(firstStep); + +// 'Object5' section -- check properties of '5' wrapped as object (has an internal property). + +function callbackStart5() +{ + // Create an wrapper object with additional property. + var expression = "(function(){var r = Object(5); r.foo = 'cat';return r;})()"; + + return { command: "Runtime.evaluate", params: {expression: expression}, callback: callbackEval5 }; +} +function callbackEval5(result) +{ + var id = result.result.objectId; + if (id === undefined) + throw new Error("objectId is expected"); + return { + command: "Runtime.getProperties", params: {objectId: id, ownProperties: true}, callback: callbackProperties5 + }; +} +function callbackProperties5(result) +{ + logGetPropertiesResult("Object(5)", result); + return { callback: callbackStartNotOwn }; +} + + +// 'Not own' section -- check all properties of the object, including ones from it prototype chain. + +function callbackStartNotOwn() +{ + // Create an wrapper object with additional property. + var expression = "({ a: 2, set b(_) {}, get b() {return 5;}, __proto__: { a: 3, c: 4, get d() {return 6;} }})"; + + return { command: "Runtime.evaluate", params: {expression: expression}, callback: callbackEvalNotOwn }; +} +function callbackEvalNotOwn(result) +{ + var id = result.result.objectId; + if (id === undefined) + throw new Error("objectId is expected"); + return { + command: "Runtime.getProperties", params: {objectId: id, ownProperties: false}, callback: callbackPropertiesNotOwn + }; +} +function callbackPropertiesNotOwn(result) +{ + logGetPropertiesResult("Not own properties", result); + return { callback: callbackStartAccessorsOnly }; +} + + +// 'Accessors only' section -- check only accessor properties of the object. + +function callbackStartAccessorsOnly() +{ + // Create an wrapper object with additional property. + var expression = "({ a: 2, set b(_) {}, get b() {return 5;}, c: 'c', set d(_){} })"; + + return { command: "Runtime.evaluate", params: {expression: expression}, callback: callbackEvalAccessorsOnly }; +} +function callbackEvalAccessorsOnly(result) +{ + var id = result.result.objectId; + if (id === undefined) + throw new Error("objectId is expected"); + return { + command: "Runtime.getProperties", params: {objectId: id, ownProperties: true, accessorPropertiesOnly: true}, callback: callbackPropertiesAccessorsOnly + }; +} +function callbackPropertiesAccessorsOnly(result) +{ + logGetPropertiesResult("Accessor only properties", result); + return { callback: callbackStartArray }; +} + + +// 'Array' section -- check properties of an array. + +function callbackStartArray() +{ + var expression = "['red', 'green', 'blue']"; + return { command: "Runtime.evaluate", params: {expression: expression}, callback: callbackEvalArray }; +} +function callbackEvalArray(result) +{ + var id = result.result.objectId; + if (id === undefined) + throw new Error("objectId is expected"); + return { + command: "Runtime.getProperties", params: {objectId: id, ownProperties: true}, callback: callbackPropertiesArray + }; +} +function callbackPropertiesArray(result) +{ + logGetPropertiesResult("array", result); + return { callback: callbackStartBound }; +} + + +// 'Bound' section -- check properties of a bound function (has a bunch of internal properties). + +function callbackStartBound() +{ + var expression = "Number.bind({}, 5)"; + return { command: "Runtime.evaluate", params: {expression: expression}, callback: callbackEvalBound }; +} +function callbackEvalBound(result) +{ + var id = result.result.objectId; + if (id === undefined) + throw new Error("objectId is expected"); + return { + command: "Runtime.getProperties", params: {objectId: id, ownProperties: true}, callback: callbackPropertiesBound + }; +} +function callbackPropertiesBound(result) +{ + logGetPropertiesResult("Bound function", result); + return; // End of test +} + +// A helper function that dumps object properties and internal properties in sorted order. +function logGetPropertiesResult(title, protocolResult) +{ + function hasGetterSetter(property, fieldName) + { + var v = property[fieldName]; + if (!v) + return false; + return v.type !== "undefined" + } + + InspectorTest.log("Properties of " + title); + var propertyArray = protocolResult.result; + propertyArray.sort(NamedThingComparator); + for (var i = 0; i < propertyArray.length; i++) { + var p = propertyArray[i]; + var v = p.value; + var own = p.isOwn ? "own" : "inherited"; + if (v) + InspectorTest.log(" " + p.name + " " + own + " " + v.type + " " + v.value); + else + InspectorTest.log(" " + p.name + " " + own + " no value" + + (hasGetterSetter(p, "get") ? ", getter" : "") + (hasGetterSetter(p, "set") ? ", setter" : "")); + } + var internalPropertyArray = protocolResult.internalProperties; + if (internalPropertyArray) { + InspectorTest.log("Internal properties"); + internalPropertyArray.sort(NamedThingComparator); + for (var i = 0; i < internalPropertyArray.length; i++) { + var p = internalPropertyArray[i]; + var v = p.value; + InspectorTest.log(" " + p.name + " " + v.type + " " + v.value); + } + } + + function NamedThingComparator(o1, o2) + { + return o1.name === o2.name ? 0 : (o1.name < o2.name ? -1 : 1); + } +} diff --git a/deps/v8/test/inspector/runtime/property-on-console-proto-expected.txt b/deps/v8/test/inspector/runtime/property-on-console-proto-expected.txt new file mode 100644 index 0000000000..6e75294e82 --- /dev/null +++ b/deps/v8/test/inspector/runtime/property-on-console-proto-expected.txt @@ -0,0 +1,12 @@ +Tests that property defined on console.__proto__ doesn't observable on other Objects. +{ + id : <messageId> + result : { + result : { + description : 0 + type : number + value : 0 + } + } +} + diff --git a/deps/v8/test/inspector/runtime/property-on-console-proto.js b/deps/v8/test/inspector/runtime/property-on-console-proto.js new file mode 100644 index 0000000000..001dd00291 --- /dev/null +++ b/deps/v8/test/inspector/runtime/property-on-console-proto.js @@ -0,0 +1,25 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Tests that property defined on console.__proto__ doesn't observable on other Objects."); + +InspectorTest.addScript(` +function testFunction() +{ + var amountOfProperties = 0; + for (var p in {}) + ++amountOfProperties; + console.__proto__.debug = 239; + for (var p in {}) + --amountOfProperties; + return amountOfProperties; +}`); + +Protocol.Runtime.evaluate({ "expression": "testFunction()" }).then(dumpResult); + +function dumpResult(result) +{ + InspectorTest.logMessage(result); + InspectorTest.completeTest(); +} diff --git a/deps/v8/test/inspector/runtime/protocol-works-with-different-locale-expected.txt b/deps/v8/test/inspector/runtime/protocol-works-with-different-locale-expected.txt new file mode 100644 index 0000000000..d526d5d447 --- /dev/null +++ b/deps/v8/test/inspector/runtime/protocol-works-with-different-locale-expected.txt @@ -0,0 +1,138 @@ +Running test: consoleLogWithDefaultLocale +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + description : 239 + type : number + value : 239 + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 8 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : log + } +} + +Running test: consoleTimeWithCommaAsSeparator +set locale to fr_CA.UTF-8 (has comma as separator) +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : a: x.xms + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 27 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : debug + } +} + +Running test: consoleLogWithCommaAsSeparator +set locale to fr_CA.UTF-8 (has comma as separator) +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + description : 239 + type : number + value : 239 + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 8 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : log + } +} + +Running test: consoleTimeWithCommaAfterConsoleLog +set locale to fr_CA.UTF-8 (has comma as separator) +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + description : 239 + type : number + value : 239 + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 8 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : log + } +} +{ + method : Runtime.consoleAPICalled + params : { + args : [ + [0] : { + type : string + value : a: x.xms + } + ] + executionContextId : <executionContextId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 27 + functionName : + lineNumber : 0 + scriptId : <scriptId> + url : + } + ] + } + timestamp : <timestamp> + type : debug + } +} diff --git a/deps/v8/test/inspector/runtime/protocol-works-with-different-locale.js b/deps/v8/test/inspector/runtime/protocol-works-with-different-locale.js new file mode 100644 index 0000000000..381dfab31e --- /dev/null +++ b/deps/v8/test/inspector/runtime/protocol-works-with-different-locale.js @@ -0,0 +1,40 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +Protocol.Runtime.enable(); + +Protocol.Runtime.onConsoleAPICalled(dumpConsoleApiCalled); + +InspectorTest.runTestSuite([ + function consoleLogWithDefaultLocale(next) { + Protocol.Runtime.evaluate({ expression: "console.log(239) "}).then(next); + }, + + function consoleTimeWithCommaAsSeparator(next) { + InspectorTest.log("set locale to fr_CA.UTF-8 (has comma as separator)"); + setlocale("fr_CA.UTF-8"); + Protocol.Runtime.evaluate({ expression: "console.time(\"a\"); console.timeEnd(\"a\")"}).then(next); + }, + + function consoleLogWithCommaAsSeparator(next) { + InspectorTest.log("set locale to fr_CA.UTF-8 (has comma as separator)"); + setlocale("fr_CA.UTF-8"); + Protocol.Runtime.evaluate({ expression: "console.log(239) "}).then(next); + }, + + function consoleTimeWithCommaAfterConsoleLog(next) { + InspectorTest.log("set locale to fr_CA.UTF-8 (has comma as separator)"); + setlocale("fr_CA.UTF-8"); + Protocol.Runtime.evaluate({ expression: "console.log(239) "}) + .then(() => Protocol.Runtime.evaluate({ expression: "console.time(\"a\"); console.timeEnd(\"a\")"})) + .then(next); + } +]); + +function dumpConsoleApiCalled(message) { + var firstArg = message.params.args[0]; + if (firstArg.type === "string") + firstArg.value = firstArg.value.replace(/[0-9]+/g, "x"); + InspectorTest.logMessage(message); +} diff --git a/deps/v8/test/inspector/runtime/run-script-async-expected.txt b/deps/v8/test/inspector/runtime/run-script-async-expected.txt new file mode 100644 index 0000000000..c6a53caee6 --- /dev/null +++ b/deps/v8/test/inspector/runtime/run-script-async-expected.txt @@ -0,0 +1,191 @@ +Tests that Runtime.compileScript and Runtime.runScript work with awaitPromise flag. + +Running test: testRunAndCompileWithoutAgentEnable +{ + error : { + code : -32000 + message : Runtime agent is not enabled + } + id : <messageId> +} +{ + error : { + code : -32000 + message : Runtime agent is not enabled + } + id : <messageId> +} + +Running test: testSyntaxErrorInScript +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 1 + exception : { + className : SyntaxError + description : SyntaxError: Unexpected token } + objectId : <objectId> + subtype : error + type : object + } + exceptionId : <exceptionId> + lineNumber : 1 + scriptId : <scriptId> + text : Uncaught + } + } +} + +Running test: testSyntaxErrorInEvalInScript +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 0 + exception : { + className : SyntaxError + description : SyntaxError: Unexpected token } at boo.js:2:2 + objectId : <objectId> + subtype : error + type : object + } + exceptionId : <exceptionId> + lineNumber : 0 + scriptId : <scriptId> + stackTrace : { + callFrames : [ + [0] : { + columnNumber : 1 + functionName : + lineNumber : 1 + scriptId : <scriptId> + url : boo.js + } + ] + } + text : Uncaught + } + result : { + className : SyntaxError + description : SyntaxError: Unexpected token } at boo.js:2:2 + objectId : <objectId> + subtype : error + type : object + } + } +} + +Running test: testRunNotCompiledScript +{ + error : { + code : -32000 + message : No script with given id + } + id : <messageId> +} + +Running test: testRunCompiledScriptAfterAgentWasReenabled +{ + error : { + code : -32000 + message : Runtime agent is not enabled + } + id : <messageId> +} +{ + error : { + code : -32000 + message : No script with given id + } + id : <messageId> +} + +Running test: testRunScriptWithPreview +{ + id : <messageId> + result : { + result : { + className : Object + description : Object + objectId : <objectId> + preview : { + description : Object + overflow : false + properties : [ + [0] : { + name : a + type : number + value : 1 + } + ] + type : object + } + type : object + } + } +} + +Running test: testRunScriptReturnByValue +{ + id : <messageId> + result : { + result : { + type : object + value : { + a : 1 + } + } + } +} + +Running test: testAwaitNotPromise +{ + error : { + code : -32000 + message : Result of the script execution is not a promise + } + id : <messageId> +} + +Running test: testAwaitResolvedPromise +{ + id : <messageId> + result : { + result : { + type : object + value : { + a : 1 + } + } + } +} + +Running test: testAwaitRejectedPromise +{ + id : <messageId> + result : { + exceptionDetails : { + columnNumber : 0 + exception : { + type : object + value : { + a : 1 + } + } + exceptionId : <exceptionId> + lineNumber : 0 + stackTrace : { + callFrames : [ + ] + } + text : Uncaught (in promise) + } + result : { + type : object + value : { + a : 1 + } + } + } +}
\ No newline at end of file diff --git a/deps/v8/test/inspector/runtime/run-script-async.js b/deps/v8/test/inspector/runtime/run-script-async.js new file mode 100644 index 0000000000..0aa90962a5 --- /dev/null +++ b/deps/v8/test/inspector/runtime/run-script-async.js @@ -0,0 +1,110 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Tests that Runtime.compileScript and Runtime.runScript work with awaitPromise flag."); + +InspectorTest.runTestSuite([ + function testRunAndCompileWithoutAgentEnable(next) + { + Protocol.Runtime.compileScript({ expression: "", sourceURL: "", persistScript: true }) + .then((result) => InspectorTest.logMessage(result)) + .then(() => Protocol.Runtime.runScript({ scriptId: "1" })) + .then((result) => InspectorTest.logMessage(result)) + .then(() => next()); + }, + + function testSyntaxErrorInScript(next) + { + Protocol.Runtime.enable() + .then(() => Protocol.Runtime.compileScript({ expression: "\n }", sourceURL: "boo.js", persistScript: true })) + .then((result) => InspectorTest.logMessage(result)) + .then(() => Protocol.Runtime.disable()) + .then(() => next()); + }, + + function testSyntaxErrorInEvalInScript(next) + { + Protocol.Runtime.enable() + .then(() => Protocol.Runtime.compileScript({ expression: "{\n eval(\"\\\n}\")\n}", sourceURL: "boo.js", persistScript: true })) + .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId })) + .then((result) => InspectorTest.logMessage(result)) + .then(() => Protocol.Runtime.disable()) + .then(() => next()); + }, + + function testRunNotCompiledScript(next) + { + Protocol.Runtime.enable() + .then((result) => Protocol.Runtime.runScript({ scriptId: "1" })) + .then((result) => InspectorTest.logMessage(result)) + .then(() => Protocol.Runtime.disable()) + .then(() => next()); + }, + + function testRunCompiledScriptAfterAgentWasReenabled(next) + { + var scriptId; + Protocol.Runtime.enable() + .then(() => Protocol.Runtime.compileScript({ expression: "{\n eval(\"\\\n}\")\n}", sourceURL: "boo.js", persistScript: true })) + .then((result) => scriptId = result.result.scriptId) + .then(() => Protocol.Runtime.disable()) + .then((result) => Protocol.Runtime.runScript({ scriptId: scriptId })) + .then((result) => InspectorTest.logMessage(result)) + .then(() => Protocol.Runtime.enable()) + .then((result) => Protocol.Runtime.runScript({ scriptId: scriptId })) + .then((result) => InspectorTest.logMessage(result)) + .then(() => Protocol.Runtime.disable()) + .then(() => next()); + }, + + function testRunScriptWithPreview(next) + { + Protocol.Runtime.enable() + .then(() => Protocol.Runtime.compileScript({ expression: "({a:1})", sourceURL: "boo.js", persistScript: true })) + .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId, generatePreview: true })) + .then((result) => InspectorTest.logMessage(result)) + .then(() => Protocol.Runtime.disable()) + .then(() => next()); + }, + + function testRunScriptReturnByValue(next) + { + Protocol.Runtime.enable() + .then(() => Protocol.Runtime.compileScript({ expression: "({a:1})", sourceURL: "boo.js", persistScript: true })) + .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId, returnByValue: true })) + .then((result) => InspectorTest.logMessage(result)) + .then(() => Protocol.Runtime.disable()) + .then(() => next()); + }, + + function testAwaitNotPromise(next) + { + Protocol.Runtime.enable() + .then(() => Protocol.Runtime.compileScript({ expression: "({a:1})", sourceURL: "boo.js", persistScript: true })) + .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId, awaitPromise: true })) + .then((result) => InspectorTest.logMessage(result)) + .then(() => Protocol.Runtime.disable()) + .then(() => next()); + }, + + function testAwaitResolvedPromise(next) + { + Protocol.Runtime.enable() + .then(() => Protocol.Runtime.compileScript({ expression: "Promise.resolve({a:1})", sourceURL: "boo.js", persistScript: true })) + .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId, awaitPromise: true, returnByValue: true })) + .then((result) => InspectorTest.logMessage(result)) + .then(() => Protocol.Runtime.disable()) + .then(() => next()); + }, + + function testAwaitRejectedPromise(next) + { + Protocol.Runtime.enable() + .then(() => Protocol.Runtime.compileScript({ expression: "Promise.reject({a:1})", sourceURL: "boo.js", persistScript: true })) + .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scriptId, awaitPromise: true, returnByValue: true })) + .then((result) => InspectorTest.logMessage(result)) + .then(() => Protocol.Runtime.disable()) + .then(() => next()); + } +]); diff --git a/deps/v8/test/inspector/runtime/set-or-map-entries-expected.txt b/deps/v8/test/inspector/runtime/set-or-map-entries-expected.txt new file mode 100644 index 0000000000..05f6d972f1 --- /dev/null +++ b/deps/v8/test/inspector/runtime/set-or-map-entries-expected.txt @@ -0,0 +1,9 @@ +Test that Runtime.getProperties doesn't truncate set and map entries in internalProperties. +Entries for "createSet(10)" +Array[10] +Entries for "createSet(1000)" +Array[1000] +Entries for "createMap(10)" +Array[10] +Entries for "createMap(1000)" +Array[1000] diff --git a/deps/v8/test/inspector/runtime/set-or-map-entries.js b/deps/v8/test/inspector/runtime/set-or-map-entries.js new file mode 100644 index 0000000000..33ba7c0547 --- /dev/null +++ b/deps/v8/test/inspector/runtime/set-or-map-entries.js @@ -0,0 +1,52 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +print("Test that Runtime.getProperties doesn't truncate set and map entries in internalProperties.") + +InspectorTest.addScript(` + function createSet(size) { + var s = new Set(); + var a = {}; + a.a = a; + for (var i = 0; i < size; ++i) s.add({ wrapper: a}); + return s; + } + + function createMap(size) { + var m = new Map(); + var a = {}; + a.a = a; + for (var i = 0; i < size; ++i) m.set(i, { wrapper: a}); + return m; + } +`); + +Protocol.Debugger.enable(); +Protocol.Runtime.enable(); + +testExpression("createSet(10)") + .then(() => testExpression("createSet(1000)")) + .then(() => testExpression("createMap(10)")) + .then(() => testExpression("createMap(1000)")) + .then(() => InspectorTest.completeTest()); + +function testExpression(expression) +{ + return Protocol.Runtime.evaluate({ "expression": expression}) + .then(result => Protocol.Runtime.getProperties({ ownProperties: true, objectId: result.result.result.objectId })) + .then(message => dumpEntriesDescription(expression, message)); +} + +function dumpEntriesDescription(expression, message) +{ + InspectorTest.log(`Entries for "${expression}"`); + var properties = message.result.internalProperties; + var property; + if (properties) + property = properties.find(property => property.name === "[[Entries]]"); + if (!property) + InspectorTest.log("[[Entries]] not found"); + else + InspectorTest.log(property.value.description); +} diff --git a/deps/v8/test/inspector/task-runner.cc b/deps/v8/test/inspector/task-runner.cc new file mode 100644 index 0000000000..c78d23b415 --- /dev/null +++ b/deps/v8/test/inspector/task-runner.cc @@ -0,0 +1,145 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "test/inspector/task-runner.h" + +#if !defined(_WIN32) && !defined(_WIN64) +#include <unistd.h> // NOLINT +#endif // !defined(_WIN32) && !defined(_WIN64) + +namespace { + +const int kTaskRunnerIndex = 2; + +void ReportUncaughtException(v8::Isolate* isolate, + const v8::TryCatch& try_catch) { + CHECK(try_catch.HasCaught()); + v8::HandleScope handle_scope(isolate); + std::string message = *v8::String::Utf8Value(try_catch.Message()->Get()); + fprintf(stderr, "Unhandle exception: %s\n", message.data()); +} + +} // namespace + +TaskRunner::TaskRunner(v8::ExtensionConfiguration* extensions, + bool catch_exceptions, + v8::base::Semaphore* ready_semaphore) + : Thread(Options("Task Runner")), + extensions_(extensions), + catch_exceptions_(catch_exceptions), + ready_semaphore_(ready_semaphore), + isolate_(nullptr), + process_queue_semaphore_(0), + nested_loop_count_(0) { + Start(); +} + +TaskRunner::~TaskRunner() { Join(); } + +void TaskRunner::InitializeContext() { + v8::Isolate::CreateParams params; + params.array_buffer_allocator = + v8::ArrayBuffer::Allocator::NewDefaultAllocator(); + isolate_ = v8::Isolate::New(params); + isolate_->SetMicrotasksPolicy(v8::MicrotasksPolicy::kScoped); + v8::Isolate::Scope isolate_scope(isolate_); + v8::HandleScope handle_scope(isolate_); + + v8::Local<v8::ObjectTemplate> global_template = + v8::ObjectTemplate::New(isolate_); + v8::Local<v8::Context> context = + v8::Context::New(isolate_, extensions_, global_template); + context->SetAlignedPointerInEmbedderData(kTaskRunnerIndex, this); + context_.Reset(isolate_, context); + + if (ready_semaphore_) ready_semaphore_->Signal(); +} + +void TaskRunner::Run() { + InitializeContext(); + RunMessageLoop(false); +} + +void TaskRunner::RunMessageLoop(bool only_protocol) { + int loop_number = ++nested_loop_count_; + while (nested_loop_count_ == loop_number) { + TaskRunner::Task* task = GetNext(only_protocol); + v8::Isolate::Scope isolate_scope(isolate_); + if (catch_exceptions_) { + v8::TryCatch try_catch(isolate_); + task->Run(isolate_, context_); + delete task; + if (try_catch.HasCaught()) { + ReportUncaughtException(isolate_, try_catch); + fflush(stdout); + fflush(stderr); + _exit(0); + } + } else { + task->Run(isolate_, context_); + delete task; + } + } +} + +void TaskRunner::QuitMessageLoop() { + DCHECK(nested_loop_count_ > 0); + --nested_loop_count_; +} + +void TaskRunner::Append(Task* task) { + queue_.Enqueue(task); + process_queue_semaphore_.Signal(); +} + +TaskRunner::Task* TaskRunner::GetNext(bool only_protocol) { + for (;;) { + if (only_protocol) { + Task* task = nullptr; + if (queue_.Dequeue(&task)) { + if (task->is_inspector_task()) return task; + deffered_queue_.Enqueue(task); + } + } else { + Task* task = nullptr; + if (deffered_queue_.Dequeue(&task)) return task; + if (queue_.Dequeue(&task)) return task; + } + process_queue_semaphore_.Wait(); + } + UNREACHABLE(); + return nullptr; +} + +TaskRunner* TaskRunner::FromContext(v8::Local<v8::Context> context) { + return static_cast<TaskRunner*>( + context->GetAlignedPointerFromEmbedderData(kTaskRunnerIndex)); +} + +ExecuteStringTask::ExecuteStringTask(const v8_inspector::String16& expression) + : expression_(expression) {} + +void ExecuteStringTask::Run(v8::Isolate* isolate, + const v8::Global<v8::Context>& context) { + v8::MicrotasksScope microtasks_scope(isolate, + v8::MicrotasksScope::kRunMicrotasks); + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> local_context = context.Get(isolate); + v8::Context::Scope context_scope(local_context); + + v8::ScriptOrigin origin(v8::String::Empty(isolate)); + v8::Local<v8::String> source = + v8::String::NewFromTwoByte(isolate, expression_.characters16(), + v8::NewStringType::kNormal, + static_cast<int>(expression_.length())) + .ToLocalChecked(); + + v8::ScriptCompiler::Source scriptSource(source, origin); + v8::Local<v8::Script> script; + if (!v8::ScriptCompiler::Compile(local_context, &scriptSource) + .ToLocal(&script)) + return; + v8::MaybeLocal<v8::Value> result; + result = script->Run(local_context); +} diff --git a/deps/v8/test/inspector/task-runner.h b/deps/v8/test/inspector/task-runner.h new file mode 100644 index 0000000000..88c36543d3 --- /dev/null +++ b/deps/v8/test/inspector/task-runner.h @@ -0,0 +1,80 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ +#define V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ + +#include "include/v8-inspector.h" +#include "include/v8-platform.h" +#include "include/v8.h" +#include "src/base/macros.h" +#include "src/base/platform/platform.h" +#include "src/inspector/string-16.h" +#include "src/locked-queue-inl.h" + +class TaskRunner : public v8::base::Thread { + public: + class Task { + public: + virtual ~Task() {} + virtual bool is_inspector_task() = 0; + virtual void Run(v8::Isolate* isolate, + const v8::Global<v8::Context>& context) = 0; + }; + + TaskRunner(v8::ExtensionConfiguration* extensions, bool catch_exceptions, + v8::base::Semaphore* ready_semaphore); + virtual ~TaskRunner(); + + // Thread implementation. + void Run() override; + + // Should be called from the same thread and only from task. + void RunMessageLoop(bool only_protocol); + void QuitMessageLoop(); + + // TaskRunner takes ownership. + void Append(Task* task); + + static TaskRunner* FromContext(v8::Local<v8::Context>); + + private: + void InitializeContext(); + Task* GetNext(bool only_protocol); + + v8::ExtensionConfiguration* extensions_; + bool catch_exceptions_; + v8::base::Semaphore* ready_semaphore_; + + v8::Isolate* isolate_; + v8::Global<v8::Context> context_; + + // deferred_queue_ combined with queue_ (in this order) have all tasks in the + // correct order. + // Sometimes we skip non-protocol tasks by moving them from queue_ to + // deferred_queue_. + v8::internal::LockedQueue<Task*> queue_; + v8::internal::LockedQueue<Task*> deffered_queue_; + v8::base::Semaphore process_queue_semaphore_; + + int nested_loop_count_; + + DISALLOW_COPY_AND_ASSIGN(TaskRunner); +}; + +class ExecuteStringTask : public TaskRunner::Task { + public: + explicit ExecuteStringTask(const v8_inspector::String16& expression); + bool is_inspector_task() override { return false; } + + void Run(v8::Isolate* isolate, + const v8::Global<v8::Context>& context) override; + + private: + v8_inspector::String16 expression_; + + DISALLOW_COPY_AND_ASSIGN(ExecuteStringTask); +}; + +#endif // V8_TEST_INSPECTOR_PROTOCOL_TASK_RUNNER_H_ diff --git a/deps/v8/test/inspector/testcfg.py b/deps/v8/test/inspector/testcfg.py new file mode 100644 index 0000000000..6995669a15 --- /dev/null +++ b/deps/v8/test/inspector/testcfg.py @@ -0,0 +1,109 @@ +# Copyright 2016 the V8 project authors. All rights reserved. +# Use of this source code is governed by a BSD-style license that can be +# found in the LICENSE file. + +import itertools +import os +import re + +from testrunner.local import testsuite +from testrunner.local import utils +from testrunner.objects import testcase + +FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") +PROTOCOL_TEST_JS = "protocol-test.js" +EXPECTED_SUFFIX = "-expected.txt" + +class InspectorProtocolTestSuite(testsuite.TestSuite): + + def __init__(self, name, root): + super(InspectorProtocolTestSuite, self).__init__(name, root) + + def ListTests(self, context): + tests = [] + for dirname, dirs, files in os.walk(os.path.join(self.root), followlinks=True): + for dotted in [x for x in dirs if x.startswith('.')]: + dirs.remove(dotted) + dirs.sort() + files.sort() + for filename in files: + if filename.endswith(".js") and filename != PROTOCOL_TEST_JS: + fullpath = os.path.join(dirname, filename) + relpath = fullpath[len(self.root) + 1 : -3] + testname = relpath.replace(os.path.sep, "/") + test = testcase.TestCase(self, testname) + tests.append(test) + return tests + + def GetFlagsForTestCase(self, testcase, context): + source = self.GetSourceForTest(testcase) + flags_match = re.findall(FLAGS_PATTERN, source) + flags = [] + for match in flags_match: + flags += match.strip().split() + testname = testcase.path.split(os.path.sep)[-1] + testfilename = os.path.join(self.root, testcase.path + self.suffix()) + protocoltestfilename = os.path.join(self.root, PROTOCOL_TEST_JS) + return [ protocoltestfilename, testfilename ] + flags + + def GetSourceForTest(self, testcase): + filename = os.path.join(self.root, testcase.path + self.suffix()) + with open(filename) as f: + return f.read() + + def shell(self): + return "inspector-test" + + def _IgnoreLine(self, string): + """Ignore empty lines, valgrind output and Android output.""" + if not string: return True + return (string.startswith("==") or string.startswith("**") or + string.startswith("ANDROID") or + # FIXME(machenbach): The test driver shouldn't try to use slow + # asserts if they weren't compiled. This fails in optdebug=2. + string == "Warning: unknown flag --enable-slow-asserts." or + string == "Try --help for options") + + def IsFailureOutput(self, testcase): + file_name = os.path.join(self.root, testcase.path) + EXPECTED_SUFFIX + with file(file_name, "r") as expected: + expected_lines = expected.readlines() + + def ExpIterator(): + for line in expected_lines: + if line.startswith("#") or not line.strip(): continue + yield line.strip() + + def ActIterator(lines): + for line in lines: + if self._IgnoreLine(line.strip()): continue + yield line.strip() + + def ActBlockIterator(): + """Iterates over blocks of actual output lines.""" + lines = testcase.output.stdout.splitlines() + start_index = 0 + found_eqeq = False + for index, line in enumerate(lines): + # If a stress test separator is found: + if line.startswith("=="): + # Iterate over all lines before a separator except the first. + if not found_eqeq: + found_eqeq = True + else: + yield ActIterator(lines[start_index:index]) + # The next block of output lines starts after the separator. + start_index = index + 1 + # Iterate over complete output if no separator was found. + if not found_eqeq: + yield ActIterator(lines) + + for act_iterator in ActBlockIterator(): + for (expected, actual) in itertools.izip_longest( + ExpIterator(), act_iterator, fillvalue=''): + if expected != actual: + return True + return False + +def GetSuite(name, root): + return InspectorProtocolTestSuite(name, root) diff --git a/deps/v8/test/intl/assert.js b/deps/v8/test/intl/assert.js index e17615267a..26405e8e9e 100644 --- a/deps/v8/test/intl/assert.js +++ b/deps/v8/test/intl/assert.js @@ -27,6 +27,14 @@ // Some methods are taken from v8/test/mjsunit/mjsunit.js + +function classOf(object) { + // Argument must not be null or undefined. + var string = Object.prototype.toString.call(object); + // String has format [object <ClassName>]. + return string.substring(8, string.length - 1); +} + /** * Compares two objects for key/value equality. * Returns true if they are equal, false otherwise. diff --git a/deps/v8/test/intl/date-format/date-format-to-parts.js b/deps/v8/test/intl/date-format/date-format-to-parts.js new file mode 100644 index 0000000000..cd954acc79 --- /dev/null +++ b/deps/v8/test/intl/date-format/date-format-to-parts.js @@ -0,0 +1,20 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --datetime-format-to-parts + +var d = new Date(2016, 11, 15, 14, 10, 34); +var df = Intl.DateTimeFormat("ja", + {hour: 'numeric', minute: 'numeric', second: 'numeric', year: 'numeric', + month: 'numeric', day: 'numeric', timeZoneName: 'short', era: 'short'}); + +var formattedParts = df.formatToParts(d); + +var formattedReconstructedFromParts = formattedParts.map((part) => part.value) + .reduce((accumulated, part) => accumulated + part); +assertEquals(df.format(d), formattedReconstructedFromParts); +// 西暦2016年11月15日 14:10:34 GMT-7 +assertEquals(["era", "year", "literal", "month", "literal", "day", "literal", + "hour", "literal", "minute", "literal", "second", "literal", + "timeZoneName"], formattedParts.map((part) => part.type)); diff --git a/deps/v8/test/intl/date-format/parse-MMMdy.js b/deps/v8/test/intl/date-format/parse-MMMdy.js deleted file mode 100644 index f8291f49a9..0000000000 --- a/deps/v8/test/intl/date-format/parse-MMMdy.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2013 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. - -// Testing v8Parse method for date and time pattern. -// Month is represented as a short name. - -// Flags: --intl-extra - -var dtf = new Intl.DateTimeFormat(['en'], - {year: 'numeric', month: 'short', - day: 'numeric', - timeZone: 'America/Los_Angeles'}); - -// Make sure we have pattern we expect (may change in the future). -assertEquals('MMM d, y', dtf.resolved.pattern); - -var date = dtf.v8Parse('Feb 4, 1974'); -assertEquals(1974, date.getUTCFullYear()); -assertEquals(1, date.getUTCMonth()); -assertEquals(4, date.getUTCDate()); - -// Can deal with a missing ','. -date = dtf.v8Parse('Feb 4 1974'); -assertEquals(1974, date.getUTCFullYear()); -assertEquals(1, date.getUTCMonth()); -assertEquals(4, date.getUTCDate()); - -// Extra "th" after 4 in the pattern. -assertEquals(undefined, dtf.v8Parse('Feb 4th, 1974')); - -// TODO(jshin): Make sure if this is what's supposed to be. -date = dtf.v8Parse('2/4/1974'); -assertEquals(1974, date.getUTCFullYear()); -assertEquals(1, date.getUTCMonth()); -assertEquals(4, date.getUTCDate()); diff --git a/deps/v8/test/intl/date-format/parse-invalid-input.js b/deps/v8/test/intl/date-format/parse-invalid-input.js deleted file mode 100644 index 47a95477eb..0000000000 --- a/deps/v8/test/intl/date-format/parse-invalid-input.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2013 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. - -// Flags: --intl-extra - -// Invalid input is handled properly. - -var dtf = new Intl.DateTimeFormat(['en']); - -assertEquals(undefined, dtf.v8Parse('')); -assertEquals(undefined, dtf.v8Parse('A')); -assertEquals(undefined, dtf.v8Parse(5)); -assertEquals(undefined, dtf.v8Parse(new Date())); diff --git a/deps/v8/test/intl/date-format/parse-mdy.js b/deps/v8/test/intl/date-format/parse-mdy.js deleted file mode 100644 index a248a08422..0000000000 --- a/deps/v8/test/intl/date-format/parse-mdy.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2013 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. - -// Flags: --intl-extra - -// Testing v8Parse method for date only. - -function checkDate(date) { - assertEquals(1974, date.getUTCFullYear()); - assertEquals(1, date.getUTCMonth()); - assertEquals(4, date.getUTCDate()); -} - -var dtf = new Intl.DateTimeFormat(['en'], {timeZone: 'America/Los_Angeles'}); - -// Make sure we have pattern we expect (may change in the future). -assertEquals('M/d/y', dtf.resolved.pattern); - -checkDate(dtf.v8Parse('2/4/74')); -checkDate(dtf.v8Parse('02/04/74')); -checkDate(dtf.v8Parse('2/04/74')); -checkDate(dtf.v8Parse('02/4/74')); -checkDate(dtf.v8Parse('2/4/1974')); -checkDate(dtf.v8Parse('02/4/1974')); -checkDate(dtf.v8Parse('2/04/1974')); -checkDate(dtf.v8Parse('02/04/1974')); - -// Month is numeric, so it fails on "Feb". -assertEquals(undefined, dtf.v8Parse('Feb 4th 1974')); diff --git a/deps/v8/test/intl/date-format/parse-mdyhms.js b/deps/v8/test/intl/date-format/parse-mdyhms.js deleted file mode 100644 index 766f7192fe..0000000000 --- a/deps/v8/test/intl/date-format/parse-mdyhms.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2013 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. - -// Testing v8Parse method for date and time pattern. -// -// Flags: --intl-extra - -var dtf = new Intl.DateTimeFormat(['en'], - {year: 'numeric', month: 'numeric', - day: 'numeric', hour: 'numeric', - minute: 'numeric', second: 'numeric', - timeZone: 'UTC'}); - -// Make sure we have pattern we expect (may change in the future). -assertEquals('M/d/y, h:mm:ss a', dtf.resolved.pattern); - -var date = dtf.v8Parse('2/4/74 12:30:42 pm'); -assertEquals(1974, date.getUTCFullYear()); -assertEquals(1, date.getUTCMonth()); -assertEquals(4, date.getUTCDate()); -assertEquals(12, date.getUTCHours()); -assertEquals(30, date.getUTCMinutes()); -assertEquals(42, date.getUTCSeconds()); - -// Can deal with '-' vs '/'. -date = dtf.v8Parse('2-4-74 12:30:42 am'); -assertEquals(1974, date.getUTCFullYear()); -assertEquals(1, date.getUTCMonth()); -assertEquals(4, date.getUTCDate()); -assertEquals(0, date.getUTCHours()); -assertEquals(30, date.getUTCMinutes()); -assertEquals(42, date.getUTCSeconds()); - -// AM/PM were not specified. -assertEquals(undefined, dtf.v8Parse('2/4/74 12:30:42')); - -// Time was not specified. -assertEquals(undefined, dtf.v8Parse('2/4/74')); - -// Month is numeric, so it fails on "Feb". -assertEquals(undefined, dtf.v8Parse('Feb 4th 1974')); diff --git a/deps/v8/test/intl/extra-flag.js b/deps/v8/test/intl/extra-flag.js deleted file mode 100644 index 3d434a302b..0000000000 --- a/deps/v8/test/intl/extra-flag.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --intl-extra - -// Turning on the creates the non-standard properties - -var dtf = new Intl.DateTimeFormat(['en']); -assertTrue('v8Parse' in dtf); -assertTrue('resolved' in dtf); -assertTrue(!!dtf.resolved && 'pattern' in dtf.resolved); - -var nf = new Intl.NumberFormat(['en']); -assertTrue('v8Parse' in nf); -assertTrue('resolved' in nf); -assertTrue(!!nf.resolved && 'pattern' in nf.resolved); - -var col = new Intl.Collator(['en']); -assertTrue('resolved' in col); - -var br = new Intl.v8BreakIterator(['en']); -assertTrue('resolved' in br); diff --git a/deps/v8/test/intl/intl.status b/deps/v8/test/intl/intl.status index 15fbe43c12..a0722177d1 100644 --- a/deps/v8/test/intl/intl.status +++ b/deps/v8/test/intl/intl.status @@ -36,4 +36,9 @@ 'date-format/timezone': [PASS, ['no_snap', SKIP]], 'number-format/check-digit-ranges': [PASS, ['no_snap', SKIP]], }], # 'arch == arm64 and mode == debug and simulator_run == True and variant == ignition' + +['variant == asm_wasm', { + '*': [SKIP], +}], # variant == asm_wasm + ] diff --git a/deps/v8/test/intl/no-extra-flag.js b/deps/v8/test/intl/no-extra-flag.js deleted file mode 100644 index 6735f84a2e..0000000000 --- a/deps/v8/test/intl/no-extra-flag.js +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --no-intl-extra - -// Turning off the flag removes the non-standard properties - -var dtf = new Intl.DateTimeFormat(['en']); -assertFalse('v8Parse' in dtf); -assertFalse('resolved' in dtf); -assertFalse(!!dtf.resolved && 'pattern' in dtf.resolved); - -var nf = new Intl.NumberFormat(['en']); -assertFalse('v8Parse' in nf); -assertFalse('resolved' in nf); -assertFalse(!!nf.resolved && 'pattern' in nf.resolved); - -var col = new Intl.Collator(['en']); -assertFalse('resolved' in col); - -var br = new Intl.v8BreakIterator(['en']); -assertFalse('resolved' in br); diff --git a/deps/v8/test/intl/number-format/parse-currency.js b/deps/v8/test/intl/number-format/parse-currency.js deleted file mode 100644 index a57128ea60..0000000000 --- a/deps/v8/test/intl/number-format/parse-currency.js +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2013 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. - -// Currency parsing is not yet supported. We need ICU49 or higher to get -// it working. - -// Flags: --intl-extra - -var nf = new Intl.NumberFormat(['en'], {style: 'currency', currency: 'USD'}); - -assertEquals(undefined, nf.v8Parse('USD 123.43')); diff --git a/deps/v8/test/intl/number-format/parse-decimal.js b/deps/v8/test/intl/number-format/parse-decimal.js deleted file mode 100644 index 62f4728911..0000000000 --- a/deps/v8/test/intl/number-format/parse-decimal.js +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2013 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. -// -// Flags: --intl-extra - -var nf = new Intl.NumberFormat(['en'], {style: 'decimal'}); - -assertEquals(123.43, nf.v8Parse('123.43')); -assertEquals(123, nf.v8Parse('123')); -assertEquals(NaN, nf.v8Parse(NaN)); -assertEquals(12323, nf.v8Parse('12,323')); -assertEquals(12323, nf.v8Parse('12323')); -assertEquals(12323.456, nf.v8Parse('12,323.456')); -assertEquals(12323.456, nf.v8Parse('000000012323.456')); -assertEquals(12323.456, nf.v8Parse('000,000,012,323.456')); -assertEquals(-12323.456, nf.v8Parse('-12,323.456')); - -assertEquals(12323, nf.v8Parse('000000012323')); -assertEquals(12323, nf.v8Parse('000,000,012,323')); -assertEquals(undefined, nf.v8Parse('000000012,323.456')); - -// not tolerant of a misplaced thousand separator -assertEquals(undefined, nf.v8Parse('123,23.456')); -assertEquals(undefined, nf.v8Parse('0000000123,23.456')); -assertEquals(undefined, nf.v8Parse('-123,23.456')); - -// Scientific notation is supported. -assertEquals(0.123456, nf.v8Parse('123.456e-3')); diff --git a/deps/v8/test/intl/number-format/parse-percent.js b/deps/v8/test/intl/number-format/parse-percent.js deleted file mode 100644 index 0dc36d3f0b..0000000000 --- a/deps/v8/test/intl/number-format/parse-percent.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2013 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. - -// Flags: --intl-extra - -var nf = new Intl.NumberFormat(['en'], {style: 'percent'}); - -assertEquals(1.2343, nf.v8Parse('123.43%')); -assertEquals(1.23, nf.v8Parse('123%')); -assertEquals(NaN, nf.v8Parse(NaN)); -assertEquals(123.23, nf.v8Parse('12,323%')); -assertEquals(123.23456, nf.v8Parse('12,323.456%')); -assertEquals(123.23456, nf.v8Parse('000000012323.456%')); -assertEquals(-123.23456, nf.v8Parse('-12,323.456%')); - -// Not tolerant of misplaced group separators. -assertEquals(undefined, nf.v8Parse('123,23%')); -assertEquals(undefined, nf.v8Parse('123,23.456%')); -assertEquals(undefined, nf.v8Parse('0000000123,23.456%')); -assertEquals(undefined, nf.v8Parse('-123,23.456%')); -assertEquals(undefined, nf.v8Parse('0000000123,23.456%')); -assertEquals(undefined, nf.v8Parse('-123,23.456%')); diff --git a/deps/v8/test/js-perf-test/JSTests.json b/deps/v8/test/js-perf-test/JSTests.json index 52bff011db..a88746b10c 100644 --- a/deps/v8/test/js-perf-test/JSTests.json +++ b/deps/v8/test/js-perf-test/JSTests.json @@ -1,8 +1,8 @@ { "name": "JSTests", - "run_count": 5, - "run_count_android_arm": 3, - "run_count_android_arm64": 3, + "run_count": 3, + "run_count_android_arm": 1, + "run_count_android_arm64": 1, "timeout": 120, "units": "score", "total": true, @@ -45,7 +45,6 @@ "path": ["RestParameters"], "main": "run.js", "resources": ["rest.js"], - "run_count": 5, "units": "score", "results_regexp": "^%s\\-RestParameters\\(Score\\): (.+)$", "tests": [ @@ -57,7 +56,6 @@ "path": ["SpreadCalls"], "main": "run.js", "resources": ["spreadcalls.js"], - "run_count": 5, "units": "score", "results_regexp": "^%s\\-SpreadCalls\\(Score\\): (.+)$", "tests": [ @@ -119,16 +117,35 @@ "main": "run.js", "resources": ["harmony-string.js"], "results_regexp": "^%s\\-Strings\\(Score\\): (.+)$", + "run_count": 1, + "timeout": 240, "tests": [ {"name": "StringFunctions"} ] }, { + "name": "StringIterators", + "path": ["StringIterators"], + "main": "run.js", + "resources": ["string-iterator.js"], + "results_regexp": "^%s\\-StringIterators\\(Score\\): (.+)$", + "tests": [ + {"name": "Spread_OneByteShort"}, + {"name": "Spread_TwoByteShort"}, + {"name": "Spread_WithSurrogatePairsShort"}, + {"name": "ForOf_OneByteShort"}, + {"name": "ForOf_TwoByteShort"}, + {"name": "ForOf_WithSurrogatePairsShort"}, + {"name": "ForOf_OneByteLong"}, + {"name": "ForOf_TwoByteLong"}, + {"name": "ForOf_WithSurrogatePairsLong"} + ] + }, + { "name": "Templates", "path": ["Templates"], "main": "run.js", "resources": ["templates.js"], - "run_count": 5, "units": "score", "results_regexp": "^%s\\-Templates\\(Score\\): (.+)$", "total": true, @@ -183,9 +200,6 @@ "main": "run.js", "resources": ["keys.js"], "results_regexp": "^%s\\-Keys\\(Score\\): (.+)$", - "run_count": 3, - "run_count_android_arm": 2, - "run_count_android_arm64": 2, "tests": [ {"name": "Object.keys()"}, {"name": "for-in"}, diff --git a/deps/v8/test/js-perf-test/Object/ObjectTests.json b/deps/v8/test/js-perf-test/Object/ObjectTests.json index 1c0e5ed2ee..47b1bf9f4c 100644 --- a/deps/v8/test/js-perf-test/Object/ObjectTests.json +++ b/deps/v8/test/js-perf-test/Object/ObjectTests.json @@ -15,12 +15,14 @@ "flags": ["--harmony"], "resources": [ "assign.js", - "values.js", - "entries.js" + "create.js", + "entries.js", + "values.js" ], "results_regexp": "^%s\\-Object\\(Score\\): (.+)$", "tests": [ {"name": "Assign"}, + {"name": "Create"}, {"name": "Entries"}, {"name": "EntriesMegamorphic"}, {"name": "Values"}, diff --git a/deps/v8/test/js-perf-test/Object/create.js b/deps/v8/test/js-perf-test/Object/create.js new file mode 100644 index 0000000000..49ebe5c1bf --- /dev/null +++ b/deps/v8/test/js-perf-test/Object/create.js @@ -0,0 +1,70 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// ---------------------------------------------------------------------------- + +function shallowClone(object) { + return Object.create(object.__proto__, + Object.getOwnPropertyDescriptors(object)); +} + +function makeSlowCopy(object) { + object = shallowClone(object); + object.__foo__ = 1; + delete object.__foo__; + return object; +} + +function convertToPropertyDescriptors(dict) { + for (var key in dict) { + var propertiesObject = dict[key]; + dict[key] = Object.getOwnPropertyDescriptors(propertiesObject); + } + return dict; +} + +var properties_5 = { a:1, b:2, c:3, d:4, e:5 }; +var TEST_PROPERTIES = convertToPropertyDescriptors({ + empty: {}, + array_5: [1, 2, 3, 4, 5], + properties_5: properties_5, + properties_10: { a:1, b:2, c:3, d:4, e:5, f:6, g:7, h:8, i:9, j:10 }, + properties_dict: makeSlowCopy(properties_5) +}); + +var TEST_PROTOTYPES = { + null: null, + empty: {}, + 'Object.prototype': Object.prototype, + 'Array.prototype': Array.prototype +}; + +// ---------------------------------------------------------------------------- + +var testFunction = () => { + return Object.create(prototype, properties); +} + +function createTestFunction(prototype, properties) { + // Force a new function for each test-object to avoid side-effects due to ICs. + var random_comment = "\n// random comment" + Math.random() + "\n"; + return eval(random_comment + testFunction.toString()); +} + +// ---------------------------------------------------------------------------- + +var benchmarks = [] + +for (var proto_name in TEST_PROTOTYPES) { + var prototype = TEST_PROTOTYPES[proto_name]; + for (var prop_name in TEST_PROPERTIES) { + var properties = TEST_PROPERTIES[prop_name]; + var name = 'Create proto:' + proto_name + " properties:" + prop_name; + benchmarks.push( + new Benchmark(name, false, false, 0, + createTestFunction(prototype, properties))); + } +} + +new BenchmarkSuite('Create', [1000], benchmarks); diff --git a/deps/v8/test/js-perf-test/Object/run.js b/deps/v8/test/js-perf-test/Object/run.js index f25bee4572..0dc65a8e57 100644 --- a/deps/v8/test/js-perf-test/Object/run.js +++ b/deps/v8/test/js-perf-test/Object/run.js @@ -6,8 +6,9 @@ load('../base.js'); load('assign.js'); -load('values.js'); +load('create.js'); load('entries.js'); +load('values.js'); var success = true; diff --git a/deps/v8/test/js-perf-test/StringIterators/run.js b/deps/v8/test/js-perf-test/StringIterators/run.js new file mode 100644 index 0000000000..4f9f2dd30d --- /dev/null +++ b/deps/v8/test/js-perf-test/StringIterators/run.js @@ -0,0 +1,27 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +load('../base.js'); +load('string-iterator.js'); + + +var success = true; + +function PrintResult(name, result) { + print(name + '-StringIterators(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/StringIterators/string-iterator.js b/deps/v8/test/js-perf-test/StringIterators/string-iterator.js new file mode 100644 index 0000000000..c55925415b --- /dev/null +++ b/deps/v8/test/js-perf-test/StringIterators/string-iterator.js @@ -0,0 +1,239 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +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, + Spread_OneByteShortTearDown), +]); + +var result; +var string; +function Spread_OneByteShortSetup() { + result = undefined; + string = "Alphabet-Soup"; +} + +function Spread_OneByteShort() { + result = [...string]; +} + +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("|")); +} + +// ---------------------------------------------------------------------------- + +new BenchmarkSuite('Spread_TwoByteShort', [1000], [ + new Benchmark('test', false, false, 0, + Spread_TwoByteShort, Spread_TwoByteShortSetup, + Spread_TwoByteShortTearDown), +]); + +function Spread_TwoByteShortSetup() { + result = undefined; + string = "\u5FCD\u8005\u306E\u653B\u6483"; +} + +function Spread_TwoByteShort() { + result = [...string]; +} + +function Spread_TwoByteShortTearDown() { + var expected = "\u5FCD|\u8005|\u306E|\u653B|\u6483"; + return assert("Array.isArray(result)") + && assert.same(expected, result.join("|")); +} + +// ---------------------------------------------------------------------------- + +new BenchmarkSuite('Spread_WithSurrogatePairsShort', [1000], [ + new Benchmark('test', false, false, 0, + Spread_WithSurrogatePairsShort, + Spread_WithSurrogatePairsShortSetup, + Spread_WithSurrogatePairsShortTearDown), +]); + +function Spread_WithSurrogatePairsShortSetup() { + result = undefined; + string = "\uD83C\uDF1F\u5FCD\u8005\u306E\u653B\u6483\uD83C\uDF1F"; +} + +function Spread_WithSurrogatePairsShort() { + result = [...string]; +} + +function Spread_WithSurrogatePairsShortTearDown() { + var expected = + "\uD83C\uDF1F|\u5FCD|\u8005|\u306E|\u653B|\u6483|\uD83C\uDF1F"; + return assert("Array.isArray(result)") + && assert.same(expected, result.join("|")); +} + +// ---------------------------------------------------------------------------- + +new BenchmarkSuite('ForOf_OneByteShort', [1000], [ + new Benchmark('test', false, false, 0, + ForOf_OneByteShort, ForOf_OneByteShortSetup, + ForOf_OneByteShortTearDown), +]); + +function ForOf_OneByteShortSetup() { + result = undefined; + string = "Alphabet-Soup"; +} + +function ForOf_OneByteShort() { + result = ""; + for (var c of string) result += c; +} + +function ForOf_OneByteShortTearDown() { + return assert.same(string, result); +} + +// ---------------------------------------------------------------------------- + +new BenchmarkSuite('ForOf_TwoByteShort', [1000], [ + new Benchmark('test', false, false, 0, + ForOf_TwoByteShort, ForOf_TwoByteShortSetup, + ForOf_TwoByteShortTearDown), +]); + +function ForOf_TwoByteShortSetup() { + result = undefined; + string = "\u5FCD\u8005\u306E\u653B\u6483"; +} + +function ForOf_TwoByteShort() { + result = ""; + for (var c of string) result += c; +} + +function ForOf_TwoByteShortTearDown() { + return assert.same(string, result); +} + +// ---------------------------------------------------------------------------- + +new BenchmarkSuite('ForOf_WithSurrogatePairsShort', [1000], [ + new Benchmark('test', false, false, 0, + ForOf_WithSurrogatePairsShort, + ForOf_WithSurrogatePairsShortSetup, + ForOf_WithSurrogatePairsShortTearDown), +]); + +function ForOf_WithSurrogatePairsShortSetup() { + result = undefined; + string = "\uD83C\uDF1F\u5FCD\u8005\u306E\u653B\u6483\uD83C\uDF1F"; +} + +function ForOf_WithSurrogatePairsShort() { + result = ""; + for (var c of string) result += c; +} + +function ForOf_WithSurrogatePairsShortTearDown() { + return assert.same(string, result); +} + +// ---------------------------------------------------------------------------- + +new BenchmarkSuite('ForOf_OneByteLong', [1000], [ + new Benchmark('test', false, false, 0, + ForOf_OneByteLong, ForOf_OneByteLongSetup, + ForOf_OneByteLongTearDown), +]); + +function ForOf_OneByteLongSetup() { + result = undefined; + string = "Alphabet-Soup|".repeat(128); +} + +function ForOf_OneByteLong() { + result = ""; + for (var c of string) result += c; +} + +function ForOf_OneByteLongTearDown() { + return assert.same(string, result); +} + +// ---------------------------------------------------------------------------- + +new BenchmarkSuite('ForOf_TwoByteLong', [1000], [ + new Benchmark('test', false, false, 0, + ForOf_OneByteLong, ForOf_OneByteLongSetup, + ForOf_OneByteLongTearDown), +]); + +function ForOf_TwoByteLongSetup() { + result = undefined; + string = "\u5FCD\u8005\u306E\u653B\u6483".repeat(128); +} + +function ForOf_TwoByteLong() { + result = ""; + for (var c of string) result += c; +} + +function ForOf_TwoByteLongTearDown() { + return assert.same(string, result); +} + +// ---------------------------------------------------------------------------- + +new BenchmarkSuite('ForOf_WithSurrogatePairsLong', [1000], [ + new Benchmark('test', false, false, 0, + ForOf_WithSurrogatePairsLong, ForOf_WithSurrogatePairsLongSetup, + ForOf_WithSurrogatePairsLongTearDown), +]); + +function ForOf_WithSurrogatePairsLongSetup() { + result = undefined; + string = "\uD83C\uDF1F\u5FCD\u8005\u306E\u653B\u6483\uD83C\uDF1F|" + .repeat(128); +} + +function ForOf_WithSurrogatePairsLong() { + result = ""; + for (var c of string) result += c; +} + +function ForOf_WithSurrogatePairsLongTearDown() { + return assert.same(string, result); +} diff --git a/deps/v8/test/message/arrow-invalid-rest-2.out b/deps/v8/test/message/arrow-invalid-rest-2.out index 0196483a66..ad6bcb034d 100644 --- a/deps/v8/test/message/arrow-invalid-rest-2.out +++ b/deps/v8/test/message/arrow-invalid-rest-2.out @@ -1,4 +1,4 @@ -*%(basename)s:7: SyntaxError: Rest parameter must be an identifier or destructuring pattern +*%(basename)s:7: SyntaxError: Unexpected token = var f = (a, ...x = 10) => x; - ^^^^^^^^^ -SyntaxError: Rest parameter must be an identifier or destructuring pattern + ^ +SyntaxError: Unexpected token = diff --git a/deps/v8/test/message/arrow-invalid-rest.out b/deps/v8/test/message/arrow-invalid-rest.out index 4045f14e78..99a8557f1e 100644 --- a/deps/v8/test/message/arrow-invalid-rest.out +++ b/deps/v8/test/message/arrow-invalid-rest.out @@ -1,4 +1,4 @@ -*%(basename)s:7: SyntaxError: Rest parameter must be an identifier or destructuring pattern +*%(basename)s:7: SyntaxError: Unexpected token = var f = (...x = 10) => x; - ^^^^^^^^^ -SyntaxError: Rest parameter must be an identifier or destructuring pattern + ^ +SyntaxError: Unexpected token = diff --git a/deps/v8/test/message/export-duplicate-as.js b/deps/v8/test/message/export-duplicate-as.js index 49b52d4b17..416180b093 100644 --- a/deps/v8/test/message/export-duplicate-as.js +++ b/deps/v8/test/message/export-duplicate-as.js @@ -4,6 +4,6 @@ // // MODULE -var a, b; +var a, b, c; export { a as c }; -export { a, b as c }; +export { a, b as c, c, b }; diff --git a/deps/v8/test/message/export-duplicate-as.out b/deps/v8/test/message/export-duplicate-as.out index 1726d9491a..729de8a904 100644 --- a/deps/v8/test/message/export-duplicate-as.out +++ b/deps/v8/test/message/export-duplicate-as.out @@ -2,6 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. *%(basename)s:9: SyntaxError: Duplicate export of 'c' -export { a, b as c }; - ^ +export { a, b as c, c, b }; + ^ SyntaxError: Duplicate export of 'c' diff --git a/deps/v8/test/message/export-duplicate-default.js b/deps/v8/test/message/export-duplicate-default.js index 72a54a45f4..de1a8807c1 100644 --- a/deps/v8/test/message/export-duplicate-default.js +++ b/deps/v8/test/message/export-duplicate-default.js @@ -5,4 +5,5 @@ // MODULE export default function f() {}; +export default 42; export default class C {}; diff --git a/deps/v8/test/message/export-duplicate-default.out b/deps/v8/test/message/export-duplicate-default.out index 4c6b97a7a1..685e289891 100644 --- a/deps/v8/test/message/export-duplicate-default.out +++ b/deps/v8/test/message/export-duplicate-default.out @@ -1,7 +1,7 @@ # 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. -*%(basename)s:8: SyntaxError: Duplicate export of 'default' +*%(basename)s:9: SyntaxError: Duplicate export of 'default' export default class C {}; ^^^^^^^ SyntaxError: Duplicate export of 'default' diff --git a/deps/v8/test/message/export-duplicate.js b/deps/v8/test/message/export-duplicate.js index f45aefe13f..93011f0c1c 100644 --- a/deps/v8/test/message/export-duplicate.js +++ b/deps/v8/test/message/export-duplicate.js @@ -4,6 +4,7 @@ // // MODULE -var a, b; +var a, b, c; export { a }; export { a, b }; +export { b, c }; diff --git a/deps/v8/test/message/export-duplicate.out b/deps/v8/test/message/export-duplicate.out index e88779f580..9811cb122c 100644 --- a/deps/v8/test/message/export-duplicate.out +++ b/deps/v8/test/message/export-duplicate.out @@ -1,7 +1,7 @@ # 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. -*%(basename)s:9: SyntaxError: Duplicate export of 'a' -export { a, b }; +*%(basename)s:10: SyntaxError: Duplicate export of 'b' +export { b, c }; ^ -SyntaxError: Duplicate export of 'a' +SyntaxError: Duplicate export of 'b' diff --git a/deps/v8/test/message/syntactic-tail-call-in-binop-lhs.out b/deps/v8/test/message/syntactic-tail-call-in-binop-lhs.out deleted file mode 100644 index 14670cd280..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-binop-lhs.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:13: SyntaxError: Tail call expression is not allowed here - return continue f() - a ; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression is not allowed here diff --git a/deps/v8/test/message/syntactic-tail-call-in-binop-rhs.out b/deps/v8/test/message/syntactic-tail-call-in-binop-rhs.out deleted file mode 100644 index 207c526e2f..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-binop-rhs.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:13: SyntaxError: Tail call expression is not allowed here - return b + continue f() ; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression is not allowed here diff --git a/deps/v8/test/message/syntactic-tail-call-in-comma.out b/deps/v8/test/message/syntactic-tail-call-in-comma.out deleted file mode 100644 index c4ecc28c97..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-comma.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:13: SyntaxError: Tail call expression is not allowed here - return 1, 2, 3, continue f() , 4 ; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression is not allowed here diff --git a/deps/v8/test/message/syntactic-tail-call-in-extends.out b/deps/v8/test/message/syntactic-tail-call-in-extends.out deleted file mode 100644 index f54155d2b5..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-extends.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:9: SyntaxError: Tail call expression is not allowed here - return class A extends continue f() {}; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression is not allowed here diff --git a/deps/v8/test/message/syntactic-tail-call-in-for-in.out b/deps/v8/test/message/syntactic-tail-call-in-for-in.out deleted file mode 100644 index 1bf52c48cb..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-for-in.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:14: SyntaxError: Tail call expression in for-in/of body - return continue f() ; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression in for-in/of body diff --git a/deps/v8/test/message/syntactic-tail-call-in-for-of.js b/deps/v8/test/message/syntactic-tail-call-in-for-of.js deleted file mode 100644 index 7cd761f38e..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-for-of.js +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-explicit-tailcalls -"use strict"; - -function f() { - return 1; -} - -function g() { - for (var v of [1, 2, 3]) { - return continue f() ; - } -} diff --git a/deps/v8/test/message/syntactic-tail-call-in-for-of.out b/deps/v8/test/message/syntactic-tail-call-in-for-of.out deleted file mode 100644 index 1bf52c48cb..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-for-of.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:14: SyntaxError: Tail call expression in for-in/of body - return continue f() ; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression in for-in/of body diff --git a/deps/v8/test/message/syntactic-tail-call-in-logical-and.out b/deps/v8/test/message/syntactic-tail-call-in-logical-and.out deleted file mode 100644 index c400f74628..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-logical-and.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:13: SyntaxError: Tail call expression is not allowed here - return continue f() && a ; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression is not allowed here diff --git a/deps/v8/test/message/syntactic-tail-call-in-logical-or.js b/deps/v8/test/message/syntactic-tail-call-in-logical-or.js deleted file mode 100644 index 6829bc629a..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-logical-or.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-explicit-tailcalls -"use strict"; - -function f() { - return 1; -} - -function g() { - return continue f() || a ; -} diff --git a/deps/v8/test/message/syntactic-tail-call-in-logical-or.out b/deps/v8/test/message/syntactic-tail-call-in-logical-or.out deleted file mode 100644 index 4ced76118a..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-logical-or.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:13: SyntaxError: Tail call expression is not allowed here - return continue f() || a ; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression is not allowed here diff --git a/deps/v8/test/message/syntactic-tail-call-in-subclass.out b/deps/v8/test/message/syntactic-tail-call-in-subclass.out deleted file mode 100644 index fff26cc59b..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-subclass.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:12: SyntaxError: Tail call expression is not allowed here - return continue f() ; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression is not allowed here diff --git a/deps/v8/test/message/syntactic-tail-call-in-try-catch-finally.out b/deps/v8/test/message/syntactic-tail-call-in-try-catch-finally.out deleted file mode 100644 index b488c15af2..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-try-catch-finally.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:16: SyntaxError: Tail call expression in catch block when finally block is also present - return continue f() ; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression in catch block when finally block is also present diff --git a/deps/v8/test/message/syntactic-tail-call-in-try-try-catch-finally.out b/deps/v8/test/message/syntactic-tail-call-in-try-try-catch-finally.out deleted file mode 100644 index bfc2692a27..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-try-try-catch-finally.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:17: SyntaxError: Tail call expression in try block - return continue f() ; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression in try block diff --git a/deps/v8/test/message/syntactic-tail-call-in-try.js b/deps/v8/test/message/syntactic-tail-call-in-try.js deleted file mode 100644 index 71662db877..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-try.js +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-explicit-tailcalls -"use strict"; - -function f() { - return 1; -} - -function g() { - try { - return continue f() ; - } catch(e) { - } -} diff --git a/deps/v8/test/message/syntactic-tail-call-in-try.out b/deps/v8/test/message/syntactic-tail-call-in-try.out deleted file mode 100644 index ed0b15cc61..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-in-try.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:14: SyntaxError: Tail call expression in try block - return continue f() ; - ^^^^^^^^^^^^ -SyntaxError: Tail call expression in try block diff --git a/deps/v8/test/message/syntactic-tail-call-inside-member-expr.js b/deps/v8/test/message/syntactic-tail-call-inside-member-expr.js deleted file mode 100644 index 9b85dd42bb..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-inside-member-expr.js +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-explicit-tailcalls -"use strict"; - -function f() { - return 1; -} - -function g() { - return (continue f(1)) (2) ; -} diff --git a/deps/v8/test/message/syntactic-tail-call-inside-member-expr.out b/deps/v8/test/message/syntactic-tail-call-inside-member-expr.out deleted file mode 100644 index 10fd54db5d..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-inside-member-expr.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:13: SyntaxError: Tail call expression is not allowed here - return (continue f(1)) (2) ; - ^^^^^^^^^^^^^^ -SyntaxError: Tail call expression is not allowed here diff --git a/deps/v8/test/message/syntactic-tail-call-of-eval.out b/deps/v8/test/message/syntactic-tail-call-of-eval.out deleted file mode 100644 index 06eeb78baf..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-of-eval.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:8: SyntaxError: Tail call of a direct eval is not allowed - return continue eval ("f()") ; - ^^^^^^^^^^^^^ -SyntaxError: Tail call of a direct eval is not allowed diff --git a/deps/v8/test/message/syntactic-tail-call-of-identifier.out b/deps/v8/test/message/syntactic-tail-call-of-identifier.out deleted file mode 100644 index 393bbc657c..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-of-identifier.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:9: SyntaxError: Unexpected expression inside tail call - return continue x ; - ^ -SyntaxError: Unexpected expression inside tail call diff --git a/deps/v8/test/message/syntactic-tail-call-of-new.out b/deps/v8/test/message/syntactic-tail-call-of-new.out deleted file mode 100644 index 954e1ca0ec..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-of-new.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:12: SyntaxError: Unexpected expression inside tail call - return continue new f() ; - ^^^^^^^ -SyntaxError: Unexpected expression inside tail call diff --git a/deps/v8/test/message/syntactic-tail-call-sloppy.out b/deps/v8/test/message/syntactic-tail-call-sloppy.out deleted file mode 100644 index 74d9d53bb4..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-sloppy.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:8: SyntaxError: Tail call expressions are not allowed in non-strict mode - return continue f() ; - ^^^^^^^^^^^^^ -SyntaxError: Tail call expressions are not allowed in non-strict mode diff --git a/deps/v8/test/message/syntactic-tail-call-without-return.out b/deps/v8/test/message/syntactic-tail-call-without-return.out deleted file mode 100644 index 0508fc3378..0000000000 --- a/deps/v8/test/message/syntactic-tail-call-without-return.out +++ /dev/null @@ -1,4 +0,0 @@ -*%(basename)s:13: SyntaxError: Tail call expression is not allowed here - var x = continue f() ; - ^^^^^^^^^^^^^ -SyntaxError: Tail call expression is not allowed here diff --git a/deps/v8/test/mjsunit/array-indexing-receiver.js b/deps/v8/test/mjsunit/array-indexing-receiver.js index d5f5a7692d..5d1dbf3e56 100644 --- a/deps/v8/test/mjsunit/array-indexing-receiver.js +++ b/deps/v8/test/mjsunit/array-indexing-receiver.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --allow-natives-syntax +// Flags: --allow-natives-syntax --expose-gc // Ensure `Array.prototype.indexOf` functions correctly for numerous elements // kinds, and various exotic receiver types, @@ -107,7 +107,7 @@ var kTests = { DICTIONARY_ELEMENTS() { var array = []; - Object.defineProperty(array, 4, { get() { return NaN; } }); + Object.defineProperty(array, 4, { get() { gc(); return NaN; } }); Object.defineProperty(array, 7, { value: Function }); assertTrue(%HasDictionaryElements(array)); @@ -226,7 +226,7 @@ var kTests = { DICTIONARY_ELEMENTS() { var object = { length: 8 }; - Object.defineProperty(object, 4, { get() { return NaN; } }); + Object.defineProperty(object, 4, { get() { gc(); return NaN; } }); Object.defineProperty(object, 7, { value: Function }); assertTrue(%HasDictionaryElements(object)); @@ -244,8 +244,10 @@ var kTests = { return { __proto__: {}, get 0() { + gc(); this.__proto__.__proto__ = { get 1() { + gc(); this[2] = "c"; return "b"; } @@ -313,7 +315,7 @@ var kTests = { SLOW_SLOPPY_ARGUMENTS_ELEMENTS() { var args = (function(a, a) { return arguments; })("foo", NaN, "bar"); - Object.defineProperty(args, 3, { get() { return "silver"; } }); + Object.defineProperty(args, 3, { get() { gc(); return "silver"; } }); Object.defineProperty(args, "length", { value: 4 }); assertTrue(%HasSloppyArgumentsElements(args)); diff --git a/deps/v8/test/mjsunit/compiler/dead-string-char-from-code.js b/deps/v8/test/mjsunit/compiler/dead-string-char-from-code.js deleted file mode 100644 index 1de5d9e44b..0000000000 --- a/deps/v8/test/mjsunit/compiler/dead-string-char-from-code.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2013 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. - -// Flags: --allow-natives-syntax - -function dead1(a, b) { - var x = %_StringCharFromCode(a); - return a; // x is dead code -} - -function dead2(a, b) { - var x = %_StringCharFromCode(a); - var y = %_StringCharFromCode(b); - return a; // x and y are both dead -} - -function dead3(a, b) { - a = a ? 11 : 12; - b = b ? 13 : 14; - var x = %_StringCharFromCode(a); - var y = %_StringCharFromCode(b); - return a; // x and y are both dead -} - -function test() { - assertEquals(33, dead1(33, 32)); - assertEquals(33, dead2(33, 32)); - assertEquals(11, dead3(33, 32)); - - assertEquals(31, dead1(31, 30)); - assertEquals(31, dead2(31, 30)); - assertEquals(11, dead3(31, 32)); - - assertEquals(0, dead1(0, 30)); - assertEquals(0, dead2(0, 30)); - assertEquals(12, dead3(0, 32)); - - assertEquals(true, dead1(true, 0)); - assertEquals(true, dead2(true, 0)); - assertEquals(11, dead3(true, 0)); - - assertEquals("true", dead1("true", 0)); - assertEquals("true", dead2("true", 0)); - assertEquals(11, dead3("true", 0)); -} - -test(); -test(); -%OptimizeFunctionOnNextCall(dead1); -%OptimizeFunctionOnNextCall(dead2); -%OptimizeFunctionOnNextCall(dead3); -test(); diff --git a/deps/v8/test/mjsunit/compiler/escape-analysis-materialize.js b/deps/v8/test/mjsunit/compiler/escape-analysis-materialize.js new file mode 100644 index 0000000000..e72797d823 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/escape-analysis-materialize.js @@ -0,0 +1,29 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --turbo --turbo-escape + +(function TestMaterializeArray() { + function f() { + var a = [1,2,3]; + %_DeoptimizeNow(); + return a.length; + } + assertEquals(3, f()); + assertEquals(3, f()); + %OptimizeFunctionOnNextCall(f); + assertEquals(3, f()); +})(); + +(function TestMaterializeFunction() { + function g() { + function fun(a, b) {} + %_DeoptimizeNow(); + return fun.length; + } + assertEquals(2, g()); + assertEquals(2, g()); + %OptimizeFunctionOnNextCall(g); + assertEquals(2, g()); +})(); diff --git a/deps/v8/test/mjsunit/compiler/inline-exception-1.js b/deps/v8/test/mjsunit/compiler/inline-exception-1.js new file mode 100644 index 0000000000..ac259afad7 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/inline-exception-1.js @@ -0,0 +1,2219 @@ +// Shard 1. + +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --turbo --no-always-opt + +// This test file was generated by tools/gen-inlining-tests.py . + +// Global variables +var deopt = undefined; // either true or false +var counter = 0; + +function resetState() { + counter = 0; +} + +function warmUp(f) { + try { + f(); + } catch (ex) { + // ok + } + try { + f(); + } catch (ex) { + // ok + } +} + +function resetOptAndAssertResultEquals(expected, f) { + warmUp(f); + resetState(); + // %DebugPrint(f); + eval("'dont optimize this function itself please, but do optimize f'"); + %OptimizeFunctionOnNextCall(f); + assertEquals(expected, f()); +} + +function resetOptAndAssertThrowsWith(expected, f) { + warmUp(f); + resetState(); + // %DebugPrint(f); + eval("'dont optimize this function itself please, but do optimize f'"); + %OptimizeFunctionOnNextCall(f); + try { + var result = f(); + fail("resetOptAndAssertThrowsWith", + "exception: " + expected, + "result: " + result); + } catch (ex) { + assertEquals(expected, ex); + } +} + +function increaseAndReturn15() { + if (deopt) %DeoptimizeFunction(f); + counter++; + return 15; +} + +function increaseAndThrow42() { + if (deopt) %DeoptimizeFunction(f); + counter++; + throw 42; +} + +function increaseAndReturn15_noopt_inner() { + if (deopt) %DeoptimizeFunction(f); + counter++; + return 15; +} + +%NeverOptimizeFunction(increaseAndReturn15_noopt_inner); + +function increaseAndThrow42_noopt_inner() { + if (deopt) %DeoptimizeFunction(f); + counter++; + throw 42; +} + +%NeverOptimizeFunction(increaseAndThrow42_noopt_inner); + +// Alternative 1 + +function returnOrThrow(doReturn) { + if (doReturn) { + return increaseAndReturn15(); + } else { + return increaseAndThrow42(); + } +} + +// Alternative 2 + +function increaseAndReturn15_calls_noopt() { + return increaseAndReturn15_noopt_inner(); +} + +function increaseAndThrow42_calls_noopt() { + return increaseAndThrow42_noopt_inner(); +} + +// Alternative 3. +// When passed either {increaseAndReturn15} or {increaseAndThrow42}, it acts +// as the other one. +function invertFunctionCall(f) { + var result; + try { + result = f(); + } catch (ex) { + return ex - 27; + } + throw result + 27; +} + +// Alternative 4: constructor +function increaseAndStore15Constructor() { + if (deopt) %DeoptimizeFunction(f); + ++counter; + this.x = 15; +} + +function increaseAndThrow42Constructor() { + if (deopt) %DeoptimizeFunction(f); + ++counter; + this.x = 42; + throw this.x; +} + +// Alternative 5: property +var magic = {}; +Object.defineProperty(magic, 'prop', { + get: function () { + if (deopt) %DeoptimizeFunction(f); + return 15 + 0 * ++counter; + }, + + set: function(x) { + // argument should be 37 + if (deopt) %DeoptimizeFunction(f); + counter -= 36 - x; // increments counter + throw 42; + } +}) + +// Generate type feedback. + +assertEquals(15, increaseAndReturn15_calls_noopt()); +assertThrowsEquals(function() { return increaseAndThrow42_noopt_inner() }, 42); + +assertEquals(15, (new increaseAndStore15Constructor()).x); +assertThrowsEquals(function() { + return (new increaseAndThrow42Constructor()).x; + }, + 42); + +function runThisShard() { + + // Variant flags: [tryReturns, doFinally] + + f = function f_______r______f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(4, counter); + + // Variant flags: [tryReturns, doFinally, finallyThrows] + + f = function f_______r______f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(3, counter); + + // Variant flags: [tryReturns, doFinally, finallyReturns] + + f = function f_______r______fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(3, counter); + + // Variant flags: [tryReturns, doCatch] + + f = function f_______r__c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [tryReturns, doCatch, deopt] + + f = function f_______r__c_______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [tryReturns, doCatch, doFinally] + + f = function f_______r__c___f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(4, counter); + + // Variant flags: [tryReturns, doCatch, doFinally, finallyThrows] + + f = function f_______r__c___f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(3, counter); + + // Variant flags: [tryReturns, doCatch, doFinally, finallyReturns] + + f = function f_______r__c___fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(3, counter); + + // Variant flags: [tryReturns, doCatch, catchThrows] + + f = function f_______r__c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [tryReturns, doCatch, catchThrows, deopt] + + f = function f_______r__c__t____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [tryReturns, doCatch, catchThrows, doFinally] + + f = function f_______r__c__tf____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(4, counter); + + // Variant flags: [tryReturns, doCatch, catchThrows, doFinally, + // finallyThrows] + + f = function f_______r__c__tf_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(3, counter); + + // Variant flags: [tryReturns, doCatch, catchThrows, doFinally, + // finallyReturns] + + f = function f_______r__c__tfr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(3, counter); + + // Variant flags: [tryReturns, doCatch, catchReturns] + + f = function f_______r__cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [tryReturns, doCatch, catchReturns, deopt] + + f = function f_______r__cr______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [tryReturns, doCatch, catchReturns, doFinally] + + f = function f_______r__cr__f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(4, counter); + + // Variant flags: [tryReturns, doCatch, catchReturns, doFinally, + // finallyThrows] + + f = function f_______r__cr__f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(3, counter); + + // Variant flags: [tryReturns, doCatch, catchReturns, doFinally, + // finallyReturns] + + f = function f_______r__cr__fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, doFinally] + + f = function f______t_______f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(42, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, doFinally, finallyThrows] + + f = function f______t_______f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, doFinally, finallyReturns] + + f = function f______t_______fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, doCatch] + + f = function f______t___c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [tryThrows, doCatch, deopt] + + f = function f______t___c_______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [tryThrows, doCatch, doFinally] + + f = function f______t___c___f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(7, counter); + + // Variant flags: [tryThrows, doCatch, doFinally, finallyThrows] + + f = function f______t___c___f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(5, counter); + + // Variant flags: [tryThrows, doCatch, doFinally, finallyReturns] + + f = function f______t___c___fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(5, counter); + + // Variant flags: [tryThrows, doCatch, catchThrows] + + f = function f______t___c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, doCatch, catchThrows, deopt] + + f = function f______t___c__t____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, doCatch, catchThrows, doFinally] + + f = function f______t___c__tf____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(5, counter); + + // Variant flags: [tryThrows, doCatch, catchThrows, doFinally, + // finallyThrows] + + f = function f______t___c__tf_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, doCatch, catchThrows, doFinally, + // finallyReturns] + + f = function f______t___c__tfr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, doCatch, catchReturns] + + f = function f______t___cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, doCatch, catchReturns, deopt] + + f = function f______t___cr______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, doCatch, catchReturns, doFinally] + + f = function f______t___cr__f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(5, counter); + + // Variant flags: [tryThrows, doCatch, catchReturns, doFinally, + // finallyThrows] + + f = function f______t___cr__f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, doCatch, catchReturns, doFinally, + // finallyReturns] + + f = function f______t___cr__fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, tryReturns, doFinally] + + f = function f______tr______f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(42, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, tryReturns, doFinally, finallyThrows] + + f = function f______tr______f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, tryReturns, doFinally, finallyReturns] + + f = function f______tr______fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch] + + f = function f______tr__c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch, doFinally] + + f = function f______tr__c___f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(7, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch, doFinally, + // finallyThrows] + + f = function f______tr__c___f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(5, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch, doFinally, + // finallyReturns] + + f = function f______tr__c___fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(5, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch, catchThrows] + + f = function f______tr__c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch, catchThrows, + // doFinally] + + f = function f______tr__c__tf____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(5, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch, catchThrows, + // doFinally, finallyThrows] + + f = function f______tr__c__tf_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch, catchThrows, + // doFinally, finallyReturns] + + f = function f______tr__c__tfr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch, catchReturns] + + f = function f______tr__cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch, catchReturns, + // doFinally] + + f = function f______tr__cr__f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(5, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch, catchReturns, + // doFinally, finallyThrows] + + f = function f______tr__cr__f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, tryReturns, doCatch, catchReturns, + // doFinally, finallyReturns] + + f = function f______tr__cr__fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndThrow42(); + return 4 + increaseAndReturn15(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, + // doFinally] + + f = function f______trf_____f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, + // doFinally, finallyThrows] + + f = function f______trf_____f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, + // doFinally, finallyReturns] + + f = function f______trf_____fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch] + + f = function f______trf_c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch, + // doFinally] + + f = function f______trf_c___f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch, + // doFinally, finallyThrows] + + f = function f______trf_c___f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch, + // doFinally, finallyReturns] + + f = function f______trf_c___fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch, + // catchThrows] + + f = function f______trf_c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch, + // catchThrows, doFinally] + + f = function f______trf_c__tf____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch, + // catchThrows, doFinally, finallyThrows] + + f = function f______trf_c__tf_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch, + // catchThrows, doFinally, finallyReturns] + + f = function f______trf_c__tfr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch, + // catchReturns] + + f = function f______trf_cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch, + // catchReturns, doFinally] + + f = function f______trf_cr__f____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + local += 2; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(4, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch, + // catchReturns, doFinally, finallyThrows] + + f = function f______trf_cr__f_t__ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + throw 25; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(25, f); + assertEquals(3, counter); + + // Variant flags: [tryThrows, tryReturns, tryFirstReturns, doCatch, + // catchReturns, doFinally, finallyReturns] + + f = function f______trf_cr__fr___ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + increaseAndReturn15(); + return 4 + increaseAndThrow42(); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } finally { + counter++; + return 3 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(891, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn1, tryReturns, doCatch] + + f = function f_____1_r__c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + returnOrThrow(true); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn1, tryReturns, doCatch, deopt] + + f = function f_____1_r__c_______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + returnOrThrow(true); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn1, tryReturns, doCatch, catchThrows] + + f = function f_____1_r__c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + returnOrThrow(true); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn1, tryReturns, doCatch, catchThrows, + // deopt] + + f = function f_____1_r__c__t____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + returnOrThrow(true); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn1, tryReturns, doCatch, + // catchReturns] + + f = function f_____1_r__cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + returnOrThrow(true); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn1, tryReturns, doCatch, + // catchReturns, deopt] + + f = function f_____1_r__cr______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + returnOrThrow(true); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn1, tryThrows, doCatch] + + f = function f_____1t___c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + returnOrThrow(false); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn1, tryThrows, doCatch, deopt] + + f = function f_____1t___c_______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + returnOrThrow(false); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn1, tryThrows, doCatch, catchThrows] + + f = function f_____1t___c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + returnOrThrow(false); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn1, tryThrows, doCatch, catchThrows, + // deopt] + + f = function f_____1t___c__t____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + returnOrThrow(false); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn1, tryThrows, doCatch, catchReturns] + + f = function f_____1t___cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + returnOrThrow(false); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn1, tryThrows, doCatch, catchReturns, + // deopt] + + f = function f_____1t___cr______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + returnOrThrow(false); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn2, tryReturns, doCatch, + // catchWithLocal, endReturnLocal, deopt] + + f = function f____2__r__c_l____ld () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + increaseAndReturn15_calls_noopt(); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn2, tryReturns, tryResultToLocal, + // doCatch, endReturnLocal, deopt] + + f = function f____2__r_lc______ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + increaseAndReturn15_calls_noopt(); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn2, tryReturns, tryResultToLocal, + // doCatch, catchWithLocal, endReturnLocal, deopt] + + f = function f____2__r_lc_l____ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + increaseAndReturn15_calls_noopt(); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn2, tryThrows, doCatch, + // catchWithLocal, endReturnLocal, deopt] + + f = function f____2_t___c_l____ld () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + increaseAndThrow42_calls_noopt(); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(935, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn2, tryThrows, tryResultToLocal, + // doCatch, endReturnLocal, deopt] + + f = function f____2_t__lc______ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + increaseAndThrow42_calls_noopt(); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(893, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn2, tryThrows, tryResultToLocal, + // doCatch, catchWithLocal, endReturnLocal, deopt] + + f = function f____2_t__lc_l____ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + increaseAndThrow42_calls_noopt(); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(935, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch] + + f = function f___3___r__c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, deopt] + + f = function f___3___r__c_______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, catchThrows] + + f = function f___3___r__c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, catchThrows, + // deopt] + + f = function f___3___r__c__t____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchWithLocal] + + f = function f___3___r__c_l______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchWithLocal, deopt] + + f = function f___3___r__c_l_____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchWithLocal, endReturnLocal] + + f = function f___3___r__c_l____l_ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchWithLocal, endReturnLocal, deopt] + + f = function f___3___r__c_l____ld () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchWithLocal, catchThrows] + + f = function f___3___r__c_lt_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchWithLocal, catchThrows, deopt] + + f = function f___3___r__c_lt____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchWithLocal, catchThrows, endReturnLocal] + + f = function f___3___r__c_lt___l_ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchWithLocal, catchThrows, endReturnLocal, deopt] + + f = function f___3___r__c_lt___ld () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchReturns] + + f = function f___3___r__cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + +} +%NeverOptimizeFunction(runThisShard); + +// 97 tests in this shard. +// 97 tests up to here. + +runThisShard(); diff --git a/deps/v8/test/mjsunit/compiler/inline-exception-2.js b/deps/v8/test/mjsunit/compiler/inline-exception-2.js new file mode 100644 index 0000000000..89523cc6b2 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/inline-exception-2.js @@ -0,0 +1,2063 @@ +// Shard 2. + +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --turbo --no-always-opt + +// This test file was generated by tools/gen-inlining-tests.py . + +// Global variables +var deopt = undefined; // either true or false +var counter = 0; + +function resetState() { + counter = 0; +} + +function warmUp(f) { + try { + f(); + } catch (ex) { + // ok + } + try { + f(); + } catch (ex) { + // ok + } +} + +function resetOptAndAssertResultEquals(expected, f) { + warmUp(f); + resetState(); + // %DebugPrint(f); + eval("'dont optimize this function itself please, but do optimize f'"); + %OptimizeFunctionOnNextCall(f); + assertEquals(expected, f()); +} + +function resetOptAndAssertThrowsWith(expected, f) { + warmUp(f); + resetState(); + // %DebugPrint(f); + eval("'dont optimize this function itself please, but do optimize f'"); + %OptimizeFunctionOnNextCall(f); + try { + var result = f(); + fail("resetOptAndAssertThrowsWith", + "exception: " + expected, + "result: " + result); + } catch (ex) { + assertEquals(expected, ex); + } +} + +function increaseAndReturn15() { + if (deopt) %DeoptimizeFunction(f); + counter++; + return 15; +} + +function increaseAndThrow42() { + if (deopt) %DeoptimizeFunction(f); + counter++; + throw 42; +} + +function increaseAndReturn15_noopt_inner() { + if (deopt) %DeoptimizeFunction(f); + counter++; + return 15; +} + +%NeverOptimizeFunction(increaseAndReturn15_noopt_inner); + +function increaseAndThrow42_noopt_inner() { + if (deopt) %DeoptimizeFunction(f); + counter++; + throw 42; +} + +%NeverOptimizeFunction(increaseAndThrow42_noopt_inner); + +// Alternative 1 + +function returnOrThrow(doReturn) { + if (doReturn) { + return increaseAndReturn15(); + } else { + return increaseAndThrow42(); + } +} + +// Alternative 2 + +function increaseAndReturn15_calls_noopt() { + return increaseAndReturn15_noopt_inner(); +} + +function increaseAndThrow42_calls_noopt() { + return increaseAndThrow42_noopt_inner(); +} + +// Alternative 3. +// When passed either {increaseAndReturn15} or {increaseAndThrow42}, it acts +// as the other one. +function invertFunctionCall(f) { + var result; + try { + result = f(); + } catch (ex) { + return ex - 27; + } + throw result + 27; +} + +// Alternative 4: constructor +function increaseAndStore15Constructor() { + if (deopt) %DeoptimizeFunction(f); + ++counter; + this.x = 15; +} + +function increaseAndThrow42Constructor() { + if (deopt) %DeoptimizeFunction(f); + ++counter; + this.x = 42; + throw this.x; +} + +// Alternative 5: property +var magic = {}; +Object.defineProperty(magic, 'prop', { + get: function () { + if (deopt) %DeoptimizeFunction(f); + return 15 + 0 * ++counter; + }, + + set: function(x) { + // argument should be 37 + if (deopt) %DeoptimizeFunction(f); + counter -= 36 - x; // increments counter + throw 42; + } +}) + +// Generate type feedback. + +assertEquals(15, increaseAndReturn15_calls_noopt()); +assertThrowsEquals(function() { return increaseAndThrow42_noopt_inner() }, 42); + +assertEquals(15, (new increaseAndStore15Constructor()).x); +assertThrowsEquals(function() { + return (new increaseAndThrow42Constructor()).x; + }, + 42); + +function runThisShard() { + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchReturns, deopt] + + f = function f___3___r__cr______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchReturns, catchWithLocal] + + f = function f___3___r__crl______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchReturns, catchWithLocal, deopt] + + f = function f___3___r__crl_____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchReturns, catchWithLocal, endReturnLocal] + + f = function f___3___r__crl____l_ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, doCatch, + // catchReturns, catchWithLocal, endReturnLocal, deopt] + + f = function f___3___r__crl____ld () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch] + + f = function f___3___r_lc________ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, deopt] + + f = function f___3___r_lc_______d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, endReturnLocal] + + f = function f___3___r_lc______l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, endReturnLocal, deopt] + + f = function f___3___r_lc______ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchThrows] + + f = function f___3___r_lc__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchThrows, deopt] + + f = function f___3___r_lc__t____d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchThrows, endReturnLocal] + + f = function f___3___r_lc__t___l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchThrows, endReturnLocal, deopt] + + f = function f___3___r_lc__t___ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchWithLocal] + + f = function f___3___r_lc_l______ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchWithLocal, deopt] + + f = function f___3___r_lc_l_____d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchWithLocal, endReturnLocal] + + f = function f___3___r_lc_l____l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchWithLocal, endReturnLocal, deopt] + + f = function f___3___r_lc_l____ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchWithLocal, catchThrows] + + f = function f___3___r_lc_lt_____ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchWithLocal, catchThrows, deopt] + + f = function f___3___r_lc_lt____d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchWithLocal, catchThrows, endReturnLocal] + + f = function f___3___r_lc_lt___l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchWithLocal, catchThrows, endReturnLocal, deopt] + + f = function f___3___r_lc_lt___ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchReturns] + + f = function f___3___r_lcr_______ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchReturns, deopt] + + f = function f___3___r_lcr______d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchReturns, endReturnLocal] + + f = function f___3___r_lcr_____l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchReturns, endReturnLocal, deopt] + + f = function f___3___r_lcr_____ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchReturns, catchWithLocal] + + f = function f___3___r_lcrl______ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchReturns, catchWithLocal, deopt] + + f = function f___3___r_lcrl_____d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchReturns, catchWithLocal, endReturnLocal] + + f = function f___3___r_lcrl____l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryReturns, tryResultToLocal, + // doCatch, catchReturns, catchWithLocal, endReturnLocal, deopt] + + f = function f___3___r_lcrl____ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndThrow42); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(912, f); + assertEquals(4, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch] + + f = function f___3__t___c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, deopt] + + f = function f___3__t___c_______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, catchThrows] + + f = function f___3__t___c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, catchThrows, + // deopt] + + f = function f___3__t___c__t____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, + // catchWithLocal] + + f = function f___3__t___c_l______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, + // catchWithLocal, deopt] + + f = function f___3__t___c_l_____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, + // catchWithLocal, endReturnLocal] + + f = function f___3__t___c_l____l_ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(935, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, + // catchWithLocal, endReturnLocal, deopt] + + f = function f___3__t___c_l____ld () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(935, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, + // catchWithLocal, catchThrows] + + f = function f___3__t___c_lt_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, + // catchWithLocal, catchThrows, deopt] + + f = function f___3__t___c_lt____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, + // catchWithLocal, catchThrows, endReturnLocal] + + f = function f___3__t___c_lt___l_ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, + // catchWithLocal, catchThrows, endReturnLocal, deopt] + + f = function f___3__t___c_lt___ld () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, catchReturns] + + f = function f___3__t___cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, catchReturns, + // deopt] + + f = function f___3__t___cr______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, catchReturns, + // catchWithLocal] + + f = function f___3__t___crl______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(890, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, catchReturns, + // catchWithLocal, deopt] + + f = function f___3__t___crl_____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(890, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, catchReturns, + // catchWithLocal, endReturnLocal] + + f = function f___3__t___crl____l_ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(890, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, doCatch, catchReturns, + // catchWithLocal, endReturnLocal, deopt] + + f = function f___3__t___crl____ld () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(890, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch] + + f = function f___3__t__lc________ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, deopt] + + f = function f___3__t__lc_______d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, endReturnLocal] + + f = function f___3__t__lc______l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(893, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, endReturnLocal, deopt] + + f = function f___3__t__lc______ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(893, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchThrows] + + f = function f___3__t__lc__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchThrows, deopt] + + f = function f___3__t__lc__t____d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchThrows, endReturnLocal] + + f = function f___3__t__lc__t___l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchThrows, endReturnLocal, deopt] + + f = function f___3__t__lc__t___ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchWithLocal] + + f = function f___3__t__lc_l______ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchWithLocal, deopt] + + f = function f___3__t__lc_l_____d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchWithLocal, endReturnLocal] + + f = function f___3__t__lc_l____l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(935, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchWithLocal, endReturnLocal, deopt] + + f = function f___3__t__lc_l____ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + local += ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(935, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchWithLocal, catchThrows] + + f = function f___3__t__lc_lt_____ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchWithLocal, catchThrows, deopt] + + f = function f___3__t__lc_lt____d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchWithLocal, catchThrows, endReturnLocal] + + f = function f___3__t__lc_lt___l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchWithLocal, catchThrows, endReturnLocal, deopt] + + f = function f___3__t__lc_lt___ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchReturns] + + f = function f___3__t__lcr_______ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchReturns, deopt] + + f = function f___3__t__lcr______d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchReturns, endReturnLocal] + + f = function f___3__t__lcr_____l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchReturns, endReturnLocal, deopt] + + f = function f___3__t__lcr_____ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchReturns, catchWithLocal] + + f = function f___3__t__lcrl______ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(890, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchReturns, catchWithLocal, deopt] + + f = function f___3__t__lcrl_____d () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(890, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchReturns, catchWithLocal, endReturnLocal] + + f = function f___3__t__lcrl____l_ () { + var local = 888; + deopt = false; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(890, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn3, tryThrows, tryResultToLocal, + // doCatch, catchReturns, catchWithLocal, endReturnLocal, deopt] + + f = function f___3__t__lcrl____ld () { + var local = 888; + deopt = true; + try { + counter++; + local += 4 + invertFunctionCall(increaseAndReturn15); + counter++; + } catch (ex) { + counter++; + return 2 + local; + counter++; + } + counter++; + return 5 + local; + } + resetOptAndAssertResultEquals(890, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn4, tryReturns, doCatch] + + f = function f__4____r__c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + (new increaseAndStore15Constructor()).x; + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn4, tryReturns, doCatch, deopt] + + f = function f__4____r__c_______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + (new increaseAndStore15Constructor()).x; + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn4, tryReturns, doCatch, catchThrows] + + f = function f__4____r__c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + (new increaseAndStore15Constructor()).x; + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn4, tryReturns, doCatch, catchThrows, + // deopt] + + f = function f__4____r__c__t____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + (new increaseAndStore15Constructor()).x; + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn4, tryReturns, doCatch, + // catchReturns] + + f = function f__4____r__cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + (new increaseAndStore15Constructor()).x; + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn4, tryReturns, doCatch, + // catchReturns, deopt] + + f = function f__4____r__cr______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + (new increaseAndStore15Constructor()).x; + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn4, tryThrows, doCatch] + + f = function f__4___t___c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + (new increaseAndThrow42Constructor()).x; + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn4, tryThrows, doCatch, deopt] + + f = function f__4___t___c_______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + (new increaseAndThrow42Constructor()).x; + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn4, tryThrows, doCatch, catchThrows] + + f = function f__4___t___c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + (new increaseAndThrow42Constructor()).x; + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn4, tryThrows, doCatch, catchThrows, + // deopt] + + f = function f__4___t___c__t____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + (new increaseAndThrow42Constructor()).x; + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn4, tryThrows, doCatch, catchReturns] + + f = function f__4___t___cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + (new increaseAndThrow42Constructor()).x; + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn4, tryThrows, doCatch, catchReturns, + // deopt] + + f = function f__4___t___cr______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + (new increaseAndThrow42Constructor()).x; + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn5, tryReturns, doCatch] + + f = function f_5_____r__c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + magic.prop /* returns 15 */; + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn5, tryReturns, doCatch, deopt] + + f = function f_5_____r__c_______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + magic.prop /* returns 15 */; + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn5, tryReturns, doCatch, catchThrows] + + f = function f_5_____r__c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + magic.prop /* returns 15 */; + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn5, tryReturns, doCatch, catchThrows, + // deopt] + + f = function f_5_____r__c__t____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + magic.prop /* returns 15 */; + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn5, tryReturns, doCatch, + // catchReturns] + + f = function f_5_____r__cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + magic.prop /* returns 15 */; + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn5, tryReturns, doCatch, + // catchReturns, deopt] + + f = function f_5_____r__cr______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + magic.prop /* returns 15 */; + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(19, f); + assertEquals(2, counter); + + // Variant flags: [alternativeFn5, tryThrows, doCatch] + + f = function f_5____t___c________ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + (magic.prop = 37 /* throws 42 */); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn5, tryThrows, doCatch, deopt] + + f = function f_5____t___c_______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + (magic.prop = 37 /* throws 42 */); + counter++; + } catch (ex) { + counter++; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(undefined, f); + assertEquals(5, counter); + + // Variant flags: [alternativeFn5, tryThrows, doCatch, catchThrows] + + f = function f_5____t___c__t_____ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + (magic.prop = 37 /* throws 42 */); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn5, tryThrows, doCatch, catchThrows, + // deopt] + + f = function f_5____t___c__t____d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + (magic.prop = 37 /* throws 42 */); + counter++; + } catch (ex) { + counter++; + throw 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertThrowsWith(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn5, tryThrows, doCatch, catchReturns] + + f = function f_5____t___cr_______ () { + var local = 888; + deopt = false; + try { + counter++; + return 4 + (magic.prop = 37 /* throws 42 */); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + + // Variant flags: [alternativeFn5, tryThrows, doCatch, catchReturns, + // deopt] + + f = function f_5____t___cr______d () { + var local = 888; + deopt = true; + try { + counter++; + return 4 + (magic.prop = 37 /* throws 42 */); + counter++; + } catch (ex) { + counter++; + return 2 + ex; + counter++; + } + counter++; + } + resetOptAndAssertResultEquals(44, f); + assertEquals(3, counter); + +} +%NeverOptimizeFunction(runThisShard); + +// 95 tests in this shard. +// 192 tests up to here. + +runThisShard(); diff --git a/deps/v8/test/mjsunit/compiler/instanceof.js b/deps/v8/test/mjsunit/compiler/instanceof.js new file mode 100644 index 0000000000..cb88e7c284 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/instanceof.js @@ -0,0 +1,133 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function A() {} +var a = new A(); + +var B = { + [Symbol.hasInstance](o) { + return false; + } +}; +%ToFastProperties(B.__proto__); + +var C = Object.create({ + [Symbol.hasInstance](o) { + return true; + } +}); +%ToFastProperties(C.__proto__); + +var D = Object.create({ + [Symbol.hasInstance](o) { + return o === a; + } +}); +%ToFastProperties(D.__proto__); + +var E = Object.create({ + [Symbol.hasInstance](o) { + if (o === a) throw o; + return true; + } +}); +%ToFastProperties(E.__proto__); + +function F() {} +F.__proto__ = null; + +(function() { + function foo(o) { return o instanceof A; } + + assertTrue(foo(a)); + assertTrue(foo(a)); + assertTrue(foo(new A())); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(a)); + assertTrue(foo(new A())); +})(); + +(function() { + function foo(o) { + try { + return o instanceof A; + } catch (e) { + return e; + } + } + + assertTrue(foo(a)); + assertTrue(foo(a)); + assertTrue(foo(new A())); + assertEquals(1, foo(new Proxy({}, {getPrototypeOf() { throw 1; }}))); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(a)); + assertTrue(foo(new A())); + assertEquals(1, foo(new Proxy({}, {getPrototypeOf() { throw 1; }}))); +})(); + +(function() { + function foo(o) { return o instanceof B; } + + assertFalse(foo(a)); + assertFalse(foo(a)); + assertFalse(foo(new A())); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(a)); + assertFalse(foo(new A())); +})(); + +(function() { + function foo(o) { return o instanceof C; } + + assertTrue(foo(a)); + assertTrue(foo(a)); + assertTrue(foo(new A())); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(a)); + assertTrue(foo(new A())); +})(); + +(function() { + function foo(o) { return o instanceof D; } + + assertTrue(foo(a)); + assertTrue(foo(a)); + assertFalse(foo(new A())); + %OptimizeFunctionOnNextCall(foo); + assertTrue(foo(a)); + assertFalse(foo(new A())); +})(); + +(function() { + function foo(o) { + try { + return o instanceof E; + } catch (e) { + return false; + } + } + + assertFalse(foo(a)); + assertTrue(foo(new A())); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(a)); + assertTrue(foo(new A())); +})(); + +(function() { + function foo(o) { + return o instanceof F; + } + + assertFalse(foo(a)); + assertFalse(foo(new A())); + assertTrue(foo(new F())); + %OptimizeFunctionOnNextCall(foo); + assertFalse(foo(a)); + assertFalse(foo(new A())); + assertTrue(foo(new F())); +})(); diff --git a/deps/v8/test/mjsunit/compiler/number-isfinite.js b/deps/v8/test/mjsunit/compiler/number-isfinite.js new file mode 100644 index 0000000000..689e31cf37 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-isfinite.js @@ -0,0 +1,29 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function test(f) { + assertTrue(f(0)); + assertTrue(f(Number.MIN_VALUE)); + assertTrue(f(Number.MAX_VALUE)); + assertTrue(f(Number.MIN_SAFE_INTEGER)); + assertTrue(f(Number.MIN_SAFE_INTEGER - 13)); + assertTrue(f(Number.MAX_SAFE_INTEGER)); + assertTrue(f(Number.MAX_SAFE_INTEGER + 23)); + assertFalse(f(Number.NaN)); + assertFalse(f(Number.POSITIVE_INFINITY)); + assertFalse(f(Number.NEGATIVE_INFINITY)); + assertFalse(f(1 / 0)); + assertFalse(f(-1 / 0)); +} + +function f(x) { + return Number.isFinite(+x); +} + +test(f); +test(f); +%OptimizeFunctionOnNextCall(f); +test(f); diff --git a/deps/v8/test/mjsunit/compiler/number-isinteger.js b/deps/v8/test/mjsunit/compiler/number-isinteger.js new file mode 100644 index 0000000000..8999569bb0 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-isinteger.js @@ -0,0 +1,30 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function test(f) { + assertTrue(f(0)); + assertFalse(f(Number.MIN_VALUE)); + assertTrue(f(Number.MAX_VALUE)); + assertTrue(f(Number.MIN_SAFE_INTEGER)); + assertTrue(f(Number.MIN_SAFE_INTEGER - 13)); + assertTrue(f(Number.MAX_SAFE_INTEGER)); + assertTrue(f(Number.MAX_SAFE_INTEGER + 23)); + assertFalse(f(Number.NaN)); + assertFalse(f(Number.POSITIVE_INFINITY)); + assertFalse(f(Number.NEGATIVE_INFINITY)); + assertFalse(f(1 / 0)); + assertFalse(f(-1 / 0)); + assertFalse(f(Number.EPSILON)); +} + +function f(x) { + return Number.isInteger(+x); +} + +test(f); +test(f); +%OptimizeFunctionOnNextCall(f); +test(f); diff --git a/deps/v8/test/mjsunit/compiler/number-isnan.js b/deps/v8/test/mjsunit/compiler/number-isnan.js new file mode 100644 index 0000000000..fb6bb6d741 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-isnan.js @@ -0,0 +1,28 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function test(f) { + assertFalse(f(0)); + assertFalse(f(Number.MIN_VALUE)); + assertFalse(f(Number.MAX_VALUE)); + assertFalse(f(Number.MIN_SAFE_INTEGER - 13)); + assertFalse(f(Number.MAX_SAFE_INTEGER + 23)); + assertTrue(f(Number.NaN)); + assertFalse(f(Number.POSITIVE_INFINITY)); + assertFalse(f(Number.NEGATIVE_INFINITY)); + assertFalse(f(Number.EPSILON)); + assertFalse(f(1 / 0)); + assertFalse(f(-1 / 0)); +} + +function f(x) { + return Number.isNaN(+x); +} + +test(f); +test(f); +%OptimizeFunctionOnNextCall(f); +test(f); diff --git a/deps/v8/test/mjsunit/compiler/number-issafeinteger.js b/deps/v8/test/mjsunit/compiler/number-issafeinteger.js new file mode 100644 index 0000000000..192fb6c124 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/number-issafeinteger.js @@ -0,0 +1,50 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function test(f) { + assertTrue(f(0)); + assertTrue(f(Number.MIN_SAFE_INTEGER)); + assertFalse(f(Number.MIN_SAFE_INTEGER - 13)); + assertTrue(f(Number.MIN_SAFE_INTEGER + 13)); + assertTrue(f(Number.MAX_SAFE_INTEGER)); + assertFalse(f(Number.MAX_SAFE_INTEGER + 23)); + assertTrue(f(Number.MAX_SAFE_INTEGER - 23)); + assertFalse(f(Number.MIN_VALUE)); + assertFalse(f(Number.MAX_VALUE)); + assertFalse(f(Number.NaN)); + assertFalse(f(Number.POSITIVE_INFINITY)); + assertFalse(f(Number.NEGATIVE_INFINITY)); + assertFalse(f(1 / 0)); + assertFalse(f(-1 / 0)); + assertFalse(f(Number.EPSILON)); + + var near_upper = Math.pow(2, 52); + assertTrue(f(near_upper)); + assertFalse(f(2 * near_upper)); + assertTrue(f(2 * near_upper - 1)); + assertTrue(f(2 * near_upper - 2)); + assertFalse(f(2 * near_upper + 1)); + assertFalse(f(2 * near_upper + 2)); + assertFalse(f(2 * near_upper + 7)); + + var near_lower = -near_upper; + assertTrue(f(near_lower)); + assertFalse(f(2 * near_lower)); + assertTrue(f(2 * near_lower + 1)); + assertTrue(f(2 * near_lower + 2)); + assertFalse(f(2 * near_lower - 1)); + assertFalse(f(2 * near_lower - 2)); + assertFalse(f(2 * near_lower - 7)); +} + +function f(x) { + return Number.isSafeInteger(+x); +} + +test(f); +test(f); +%OptimizeFunctionOnNextCall(f); +test(f); diff --git a/deps/v8/test/intl/number-format/parse-invalid-input.js b/deps/v8/test/mjsunit/compiler/regress-5320.js index 251b52a5e7..2e30a7b4f5 100644 --- a/deps/v8/test/intl/number-format/parse-invalid-input.js +++ b/deps/v8/test/mjsunit/compiler/regress-5320.js @@ -1,4 +1,4 @@ -// Copyright 2013 the V8 project authors. All rights reserved. +// Copyright 2016 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: @@ -25,16 +25,28 @@ // (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: --intl-extra +// Flags: --allow-natives-syntax -// Invalid input is handled properly. +function OptimizeTruncatingBinaryOp(func) { + func(42, -2); + func(31, undefined); + %BaselineFunctionOnNextCall(func); + func(42, -2); + func(31, undefined); + %OptimizeFunctionOnNextCall(func); + func(-1, 2.1); + assertOptimized(func); +} -var nf = new Intl.NumberFormat(['en']); - -assertEquals(undefined, nf.v8Parse('')); -assertEquals(undefined, nf.v8Parse('A')); -assertEquals(undefined, nf.v8Parse(new Date())); -assertEquals(undefined, nf.v8Parse(undefined)); -assertEquals(undefined, nf.v8Parse(null)); -assertEquals(undefined, nf.v8Parse()); -assertEquals(undefined, nf.v8Parse('Text before 12345')); +// SAR +OptimizeTruncatingBinaryOp(function(a, b) { return a >> b; }); +// SHR +OptimizeTruncatingBinaryOp(function(a, b) { return a >>> b; }); +// SHL +OptimizeTruncatingBinaryOp(function(a, b) { return a << b; }); +// BIT_AND +OptimizeTruncatingBinaryOp(function(a, b) { return a & b; }); +// BIT_OR +OptimizeTruncatingBinaryOp(function(a, b) { return a | b; }); +// BIT_XOR +OptimizeTruncatingBinaryOp(function(a, b) { return a ^ b; }); diff --git a/deps/v8/test/message/syntactic-tail-call-of-identifier.js b/deps/v8/test/mjsunit/compiler/regress-625966.js index b3ca31df01..187596e4af 100644 --- a/deps/v8/test/message/syntactic-tail-call-of-identifier.js +++ b/deps/v8/test/mjsunit/compiler/regress-625966.js @@ -2,9 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls "use strict"; - -function g(x) { - return continue x ; +var s = ""; +for (var i = 0; i < 65535; i++) { + s += ("var a" + i + ";"); } +eval(s); diff --git a/deps/v8/test/mjsunit/compiler/regress-626986.js b/deps/v8/test/mjsunit/compiler/regress-626986.js new file mode 100644 index 0000000000..5e02918423 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-626986.js @@ -0,0 +1,23 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function g() { + return 42; +} + +var o = {}; + +function f(o, x) { + o.f = x; +} + +f(o, g); +f(o, g); +f(o, g); +assertEquals(42, o.f()); +%OptimizeFunctionOnNextCall(f); +f(o, function() { return 0; }); +assertEquals(0, o.f()); diff --git a/deps/v8/test/mjsunit/compiler/regress-638132.js b/deps/v8/test/mjsunit/compiler/regress-638132.js new file mode 100644 index 0000000000..1b94feb125 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-638132.js @@ -0,0 +1,26 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function g(x, y) { + return x | y; +} + +function f(b) { + if (b) { + var s = g("a", "b") && true; + return s; + } +} + +// Prime function g with Smi feedback. +g(1, 2); +g(1, 2); + +f(0); +f(0); +%OptimizeFunctionOnNextCall(f); +// Compile inlined function g with string inputs but Smi feedback. +f(1); diff --git a/deps/v8/test/mjsunit/compiler/regress-639210.js b/deps/v8/test/mjsunit/compiler/regress-639210.js new file mode 100644 index 0000000000..50303fb9d6 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-639210.js @@ -0,0 +1,38 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +var m = (function m() { + "use asm" + var i32 = new Int32Array(4); + var f64 = new Float64Array(4); + + function init() { + i32[0] = 1; + f64[0] = 0.1; + } + + function load(b) { + return (b ? 0 : i32[0]) + i32[0]; + } + + function store(b) { + if (b|0) { + } else { + f64[0] = 42; + } + return f64[0]; + } + + return { init : init, load : load, store : store }; +})(); + +m.init(); + +%OptimizeFunctionOnNextCall(m.load); +assertEquals(2, m.load()); + +%OptimizeFunctionOnNextCall(m.store); +assertEquals(0.1, m.store(1)); diff --git a/deps/v8/test/mjsunit/compiler/regress-644048.js b/deps/v8/test/mjsunit/compiler/regress-644048.js new file mode 100644 index 0000000000..ee2dd6edef --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-644048.js @@ -0,0 +1,16 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function foo(x) { + (x + ? (!0 / 0) + : x) | 0 +} + +foo(1); +foo(2); +%OptimizeFunctionOnNextCall(foo); +foo(3); diff --git a/deps/v8/test/message/syntactic-tail-call-of-new.js b/deps/v8/test/mjsunit/compiler/regress-644633.js index 60adec7027..5087fd77fc 100644 --- a/deps/v8/test/message/syntactic-tail-call-of-new.js +++ b/deps/v8/test/mjsunit/compiler/regress-644633.js @@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls +var g = -1073741824; function f() { - return 1; + var x = g*g*g*g*g*g*g; + for (var i = g; i < 1; ) { + i += i * x; + } } -function g() { - return continue new f() ; -} +f(); diff --git a/deps/v8/test/mjsunit/compiler/regress-645851.js b/deps/v8/test/mjsunit/compiler/regress-645851.js new file mode 100644 index 0000000000..0ea70bd71e --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-645851.js @@ -0,0 +1,19 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function f() { + var sum = 0; + while (1) { + for (var j = 0; j < 200; j -= j) { + sum = sum + 1; + %OptimizeOsr(); + if (sum == 2) return; + } + } + return sum; +} + +f(); diff --git a/deps/v8/test/message/syntactic-tail-call-in-for-in.js b/deps/v8/test/mjsunit/compiler/regress-650215.js index 8ad7aca54a..95ae6cfed1 100644 --- a/deps/v8/test/message/syntactic-tail-call-in-for-in.js +++ b/deps/v8/test/mjsunit/compiler/regress-650215.js @@ -2,15 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls -"use strict"; +// Flags: --allow-natives-syntax function f() { - return 1; -} - -function g() { - for (var v in {a:0}) { - return continue f() ; + var x = 0; + for (var i = 0; i < 10; i++) { + x = (2 % x) | 0; + if (i === 5) %OptimizeOsr(); } + return x; } + +assertEquals(0, f()); diff --git a/deps/v8/test/mjsunit/compiler/regress-compare-negate.js b/deps/v8/test/mjsunit/compiler/regress-compare-negate.js new file mode 100644 index 0000000000..72b210b1e4 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-compare-negate.js @@ -0,0 +1,18 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --turbo + +function CompareNegate(a,b) { + a = a|0; + b = b|0; + var sub = 0 - b; + return a < (sub|0); +} + +var x = CompareNegate(1,0x80000000); +%OptimizeFunctionOnNextCall(CompareNegate); +CompareNegate(1,0x80000000); +assertOptimized(CompareNegate); +assertEquals(x, CompareNegate(1,0x80000000)); diff --git a/deps/v8/test/mjsunit/compiler/regress-escape-analysis-indirect.js b/deps/v8/test/mjsunit/compiler/regress-escape-analysis-indirect.js new file mode 100644 index 0000000000..6d79a93133 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-escape-analysis-indirect.js @@ -0,0 +1,17 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --turbo --turbo-escape + +function f(apply) { + var value = 23; + apply(function bogeyman() { value = 42 }); + return value; +} +function apply(fun) { fun() } +assertEquals(42, f(apply)); +assertEquals(42, f(apply)); +%NeverOptimizeFunction(apply); +%OptimizeFunctionOnNextCall(f); +assertEquals(42, f(apply)); diff --git a/deps/v8/test/message/syntactic-tail-call-in-comma.js b/deps/v8/test/mjsunit/compiler/regress-math-sign-nan-type.js index 402a4a8f7d..e16eba8c5a 100644 --- a/deps/v8/test/message/syntactic-tail-call-in-comma.js +++ b/deps/v8/test/mjsunit/compiler/regress-math-sign-nan-type.js @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls -"use strict"; +// Flags: --allow-natives-syntax -function f() { - return 1; +function f(a) { + return Math.sign(+a) < 2; } -function g() { - return 1, 2, 3, continue f() , 4 ; -} +f(NaN); +f(NaN); +%OptimizeFunctionOnNextCall(f); +assertFalse(f(NaN)); diff --git a/deps/v8/test/mjsunit/compiler/regress-strict-equals-mixed-feedback.js b/deps/v8/test/mjsunit/compiler/regress-strict-equals-mixed-feedback.js new file mode 100644 index 0000000000..cf41617096 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/regress-strict-equals-mixed-feedback.js @@ -0,0 +1,23 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function bar(x, y) { + return x === y; +} + +function foo(x) { + bar("0", x); +} + +foo("0"); +foo("0"); +%BaselineFunctionOnNextCall(bar); +foo("0"); +foo("0"); +bar(1, 1); +%OptimizeFunctionOnNextCall(foo); +foo("0"); +assertOptimized(foo); diff --git a/deps/v8/test/mjsunit/compiler/string-add-try-catch.js b/deps/v8/test/mjsunit/compiler/string-add-try-catch.js new file mode 100644 index 0000000000..e34332682c --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/string-add-try-catch.js @@ -0,0 +1,39 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +var a = "a".repeat(268435440); + +(function() { + function foo(a, b) { + try { + return a + "0123456789012"; + } catch (e) { + return e; + } + } + + foo("a"); + foo("a"); + %OptimizeFunctionOnNextCall(foo); + foo("a"); + assertInstanceof(foo(a), RangeError); +})(); + +(function() { + function foo(a, b) { + try { + return "0123456789012" + a; + } catch (e) { + return e; + } + } + + foo("a"); + foo("a"); + %OptimizeFunctionOnNextCall(foo); + foo("a"); + assertInstanceof(foo(a), RangeError); +})(); diff --git a/deps/v8/test/mjsunit/compiler/unsigned-min-max.js b/deps/v8/test/mjsunit/compiler/unsigned-min-max.js new file mode 100644 index 0000000000..db91188628 --- /dev/null +++ b/deps/v8/test/mjsunit/compiler/unsigned-min-max.js @@ -0,0 +1,37 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function umin(a, b) { + a = a >>> 0; + b = b >>> 0; + return Math.min(a, b); +} + +umin(1, 1); +umin(2, 2); +%OptimizeFunctionOnNextCall(umin); +assertEquals(1, umin(1, 2)); +assertEquals(1, umin(2, 1)); +assertEquals(0, umin(0, 4294967295)); +assertEquals(0, umin(4294967295, 0)); +assertEquals(4294967294, umin(-1, -2)); +assertEquals(1234, umin(-2, 1234)); + +function umax(a, b) { + a = a >>> 0; + b = b >>> 0; + return Math.max(a, b); +} + +umax(1, 1); +umax(2, 2); +%OptimizeFunctionOnNextCall(umax); +assertEquals(2, umax(1, 2)); +assertEquals(2, umax(2, 1)); +assertEquals(4294967295, umax(0, 4294967295)); +assertEquals(4294967295, umax(4294967295, 0)); +assertEquals(4294967295, umax(-1, -2)); +assertEquals(4294967294, umax(-2, 1234)); diff --git a/deps/v8/test/mjsunit/debug-function-scopes.js b/deps/v8/test/mjsunit/debug-function-scopes.js index ae95f9b97d..4a0809ab33 100644 --- a/deps/v8/test/mjsunit/debug-function-scopes.js +++ b/deps/v8/test/mjsunit/debug-function-scopes.js @@ -87,7 +87,6 @@ var f3 = (function F1(invisible_parameter) { var invisible2 = 2; return (function F3() { var visible2 = 20; - var invisible2 = 3; return (function () {return visible1 + visible2 + visible1a;}); })(); })(); diff --git a/deps/v8/test/mjsunit/debug-print.js b/deps/v8/test/mjsunit/debug-print.js new file mode 100644 index 0000000000..b0e141d709 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-print.js @@ -0,0 +1,47 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +// Make sure printing different element kinds doesn't crash. + +var array; +var obj = {}; + +array = []; +%DebugPrint(array); + +// FAST_SMI_ELEMENTS +array = [1, 2, 3]; +%DebugPrint(array); + +// FAST_HOLEY_SMI_ELEMENTS +array[10] = 100; +array[11] = 100; +%DebugPrint(array); + +// FAST_ELEMENTS +array = [1, obj, obj]; +%DebugPrint(array); + +// FAST_HOLEY_ELEMENTS +array[100] = obj; +array[101] = obj; +%DebugPrint(array); + +// FAST_DOUBLE_ELEMENTS +array = [1.1, 2.2, 3.3, 3.3, 3.3, NaN]; +%DebugPrint(array); +array.push(NaN); +array.push(NaN); +%DebugPrint(array); + +// FAST_HOLEY_DOUBLE_ELEMENTS +array[100] = 1.2; +array[101] = 1.2; +%DebugPrint(array); + +// DICTIONARY_ELEMENTS +%NormalizeElements(array); +%DebugPrint(array); diff --git a/deps/v8/test/mjsunit/debug-scopes.js b/deps/v8/test/mjsunit/debug-scopes.js index 935de9cc98..0e822fce1c 100644 --- a/deps/v8/test/mjsunit/debug-scopes.js +++ b/deps/v8/test/mjsunit/debug-scopes.js @@ -157,20 +157,20 @@ function CheckScopeChainNames(names, exec_state) { } -// Check that the content of the scope is as expected. For functions just check -// that there is a function. -function CheckScopeContent(content, number, exec_state) { +// Check that the scope contains at least minimum_content. For functions just +// check that there is a function. +function CheckScopeContent(minimum_content, number, exec_state) { var scope = exec_state.frame().scope(number); - var count = 0; - for (var p in content) { + var minimum_count = 0; + for (var p in minimum_content) { var property_mirror = scope.scopeObject().property(p); assertFalse(property_mirror.isUndefined(), 'property ' + p + ' not found in scope'); - if (typeof(content[p]) === 'function') { + if (typeof(minimum_content[p]) === 'function') { assertTrue(property_mirror.value().isFunction()); } else { - assertEquals(content[p], property_mirror.value().value(), 'property ' + p + ' has unexpected value'); + assertEquals(minimum_content[p], property_mirror.value().value(), 'property ' + p + ' has unexpected value'); } - count++; + minimum_count++; } // 'arguments' and might be exposed in the local and closure scope. Just @@ -186,14 +186,14 @@ function CheckScopeContent(content, number, exec_state) { // Temporary variables introduced by the parser have not been materialized. assertTrue(scope.scopeObject().property('').isUndefined()); - if (count != scope_size) { + if (scope_size < minimum_count) { print('Names found in scope:'); var names = scope.scopeObject().propertyNames(); for (var i = 0; i < names.length; i++) { print(names[i]); } } - assertEquals(count, scope_size); + assertTrue(scope_size >= minimum_count); // Get the debug command processor. var dcp = exec_state.debugCommandProcessor("unspecified_running_state"); @@ -1185,6 +1185,102 @@ listener_delegate = function(exec_state) { eval(code3); EndTest(); +BeginTest("Scope positions in for statement with lexical block"); +var code4 = "function for_statement() { \n" + + " for (let i = 0; i < 1; i++) { \n" + + " let j; \n" + + " debugger; \n" + + " } \n" + + "} \n" + + "for_statement(); \n"; + +listener_delegate = function(exec_state) { + CheckScopeChain([debug.ScopeType.Block, + debug.ScopeType.Block, + debug.ScopeType.Local, + debug.ScopeType.Script, + debug.ScopeType.Global], exec_state); + CheckScopeChainPositions([{start: 66, end: 147}, {start: 52, end: 147}, {start: 22, end: 181}, {}, {}], exec_state); +} +eval(code4); +EndTest(); + +BeginTest("Scope positions in lexical for each statement"); +var code5 = "function for_each_statement() { \n" + + " for (let i of [0]) { \n" + + " debugger; \n" + + " } \n" + + "} \n" + + "for_each_statement(); \n"; + +listener_delegate = function(exec_state) { + CheckScopeChain([debug.ScopeType.Block, + debug.ScopeType.Local, + debug.ScopeType.Script, + debug.ScopeType.Global], exec_state); + CheckScopeChainPositions([{start: 55, end: 111}, {start: 27, end: 145}, {}, {}], exec_state); +} +eval(code5); +EndTest(); + +BeginTest("Scope positions in lexical for each statement with lexical block"); +var code6 = "function for_each_statement() { \n" + + " for (let i of [0]) { \n" + + " let j; \n" + + " debugger; \n" + + " } \n" + + "} \n" + + "for_each_statement(); \n"; + +listener_delegate = function(exec_state) { + CheckScopeChain([debug.ScopeType.Block, + debug.ScopeType.Block, + debug.ScopeType.Local, + debug.ScopeType.Script, + debug.ScopeType.Global], exec_state); + CheckScopeChainPositions([{start: 57, end: 147}, {start: 55, end: 147}, {start: 27, end: 181}, {}, {}], exec_state); +} +eval(code6); +EndTest(); + +BeginTest("Scope positions in non-lexical for each statement"); +var code7 = "function for_each_statement() { \n" + + " var i; \n" + + " for (i of [0]) { \n" + + " debugger; \n" + + " } \n" + + "} \n" + + "for_each_statement(); \n"; + +listener_delegate = function(exec_state) { + CheckScopeChain([debug.ScopeType.Local, + debug.ScopeType.Script, + debug.ScopeType.Global], exec_state); + CheckScopeChainPositions([{start: 27, end: 181}, {}, {}], exec_state); +} +eval(code7); +EndTest(); + +BeginTest("Scope positions in non-lexical for each statement with lexical block"); +var code8 = "function for_each_statement() { \n" + + " var i; \n" + + " for (i of [0]) { \n" + + " let j; \n" + + " debugger; \n" + + " } \n" + + "} \n" + + "for_each_statement(); \n"; + +listener_delegate = function(exec_state) { + CheckScopeChain([debug.ScopeType.Block, + debug.ScopeType.Local, + debug.ScopeType.Script, + debug.ScopeType.Global], exec_state); + CheckScopeChainPositions([{start: 89, end: 183}, {start: 27, end: 217}, {}, {}], exec_state); +} +eval(code8); +EndTest(); + assertEquals(begin_test_count, break_count, 'one or more tests did not enter the debugger'); assertEquals(begin_test_count, end_test_count, diff --git a/deps/v8/test/mjsunit/element-accessor.js b/deps/v8/test/mjsunit/element-accessor.js index 452afc8d16..5fba359c2a 100644 --- a/deps/v8/test/mjsunit/element-accessor.js +++ b/deps/v8/test/mjsunit/element-accessor.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 + (function () { var o = []; o.__proto__ = {}; @@ -31,3 +33,18 @@ Object.defineProperty(o, "0", {get: function(){}}); assertEquals(undefined, Object.getOwnPropertyDescriptor(o, "0")); })(); + +(function() { + function f() { + var a = new Array(); + a[1] = 1.5; + return a; + } + + f(); + f(); + %OptimizeFunctionOnNextCall(f); + var a = f(); + a[2] = 2; + assertEquals(3, a.length); +})(); diff --git a/deps/v8/test/mjsunit/es6/block-sloppy-function.js b/deps/v8/test/mjsunit/es6/block-sloppy-function.js index 8cb9a4deda..2cdcbce3d6 100644 --- a/deps/v8/test/mjsunit/es6/block-sloppy-function.js +++ b/deps/v8/test/mjsunit/es6/block-sloppy-function.js @@ -67,6 +67,24 @@ assertEquals(1, f); })(); +(function shadowingLetDoesntBindGenerator() { + let f = function *f() { + while(true) { + yield 1; + } + }; + assertEquals(1, f().next().value); + { + function *f() { + while(true) { + yield 2; + } + } + assertEquals(2, f().next().value); + } + assertEquals(1, f().next().value); +})(); + (function shadowingClassDoesntBind() { class f { } assertEquals('class f { }', f.toString()); diff --git a/deps/v8/test/mjsunit/es6/debug-promises/promise-all-uncaught.js b/deps/v8/test/mjsunit/es6/debug-promises/promise-all-uncaught.js index d183c5cf2d..c201d13e05 100644 --- a/deps/v8/test/mjsunit/es6/debug-promises/promise-all-uncaught.js +++ b/deps/v8/test/mjsunit/es6/debug-promises/promise-all-uncaught.js @@ -6,28 +6,16 @@ // Test debug events when we only listen to uncaught exceptions and a // Promise p3 created by Promise.all has no catch handler, and is rejected -// because one of the Promises p2 passed to Promise.all is rejected. We -// expect two Exception debug events to be triggered, for p2 and p3 each, -// because neither has an user-defined catch handler. +// because one of the Promises p2 passed to Promise.all is rejected. +// We expect one event for p2; the system recognizes the rejection of p3 +// to be redundant and based on the rejection of p2 and does not trigger +// an additional rejection. var Debug = debug.Debug; -var expected_events = 2; +var expected_events = 1; var log = []; -var p1 = Promise.resolve(); -p1.name = "p1"; - -var p2 = p1.then(function() { - log.push("throw"); - throw new Error("uncaught"); // event -}); - -p2.name = "p2"; - -var p3 = Promise.all([p2]); -p3.name = "p3"; - function listener(event, exec_state, event_data, data) { if (event != Debug.DebugEvent.Exception) return; try { @@ -35,13 +23,9 @@ function listener(event, exec_state, event_data, data) { assertTrue(expected_events >= 0); assertEquals("uncaught", event_data.exception().message); assertTrue(event_data.promise() instanceof Promise); - if (expected_events === 1) { - // Assert that the debug event is triggered at the throw site. - assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0); - assertEquals("p2", event_data.promise().name); - } else { - assertEquals("p3", event_data.promise().name); - } + // Assert that the debug event is triggered at the throw site. + assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0); + assertEquals("p2", event_data.promise().name); assertTrue(event_data.uncaught()); } catch (e) { %AbortJS(e + "\n" + e.stack); @@ -51,6 +35,19 @@ function listener(event, exec_state, event_data, data) { Debug.setBreakOnUncaughtException(); Debug.setListener(listener); +var p1 = Promise.resolve(); +p1.name = "p1"; + +var p2 = p1.then(function() { + log.push("throw"); + throw new Error("uncaught"); // event +}); + +p2.name = "p2"; + +var p3 = Promise.all([p2]); +p3.name = "p3"; + log.push("end main"); function testDone(iteration) { diff --git a/deps/v8/test/mjsunit/es6/debug-promises/promise-race-uncaught.js b/deps/v8/test/mjsunit/es6/debug-promises/promise-race-uncaught.js index 57955c01ef..ed6233bc30 100644 --- a/deps/v8/test/mjsunit/es6/debug-promises/promise-race-uncaught.js +++ b/deps/v8/test/mjsunit/es6/debug-promises/promise-race-uncaught.js @@ -6,28 +6,16 @@ // Test debug events when we only listen to uncaught exceptions and a // Promise p3 created by Promise.race has no catch handler, and is rejected -// because one of the Promises p2 passed to Promise.all is rejected. We -// expect two Exception debug events to be triggered, for p2 and p3 each, -// because neither has an user-defined catch handler. +// because one of the Promises p2 passed to Promise.race is rejected. +// We expect one event for p2; the system recognizes the rejection of p3 +// to be redundant and based on the rejection of p2 and does not trigger +// an additional rejection. var Debug = debug.Debug; -var expected_events = 2; +var expected_events = 1; var log = []; -var p1 = Promise.resolve(); -p1.name = "p1"; - -var p2 = p1.then(function() { - log.push("throw"); - throw new Error("uncaught"); // event -}); - -p2.name = "p2"; - -var p3 = Promise.race([p2]); -p3.name = "p3"; - function listener(event, exec_state, event_data, data) { if (event != Debug.DebugEvent.Exception) return; try { @@ -35,13 +23,9 @@ function listener(event, exec_state, event_data, data) { assertTrue(expected_events >= 0); assertEquals("uncaught", event_data.exception().message); assertTrue(event_data.promise() instanceof Promise); - if (expected_events === 1) { - // Assert that the debug event is triggered at the throw site. - assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0); - assertEquals("p2", event_data.promise().name); - } else { - assertEquals("p3", event_data.promise().name); - } + // Assert that the debug event is triggered at the throw site. + assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0); + assertEquals("p2", event_data.promise().name); assertTrue(event_data.uncaught()); } catch (e) { %AbortJS(e + "\n" + e.stack); @@ -51,6 +35,19 @@ function listener(event, exec_state, event_data, data) { Debug.setBreakOnUncaughtException(); Debug.setListener(listener); +var p1 = Promise.resolve(); +p1.name = "p1"; + +var p2 = p1.then(function() { + log.push("throw"); + throw new Error("uncaught"); // event +}); + +p2.name = "p2"; + +var p3 = Promise.race([p2]); +p3.name = "p3"; + log.push("end main"); function testDone(iteration) { diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js index b7c5861c1f..6cd28259e1 100644 --- a/deps/v8/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js +++ b/deps/v8/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js @@ -6,13 +6,13 @@ // Test debug events when we only listen to uncaught exceptions and // there is only a default reject handler for the to-be-rejected Promise. -// We expect two Exception debug events: -// - when the first Promise is rejected and only has default reject handlers. -// - when the default reject handler passes the rejection on. +// We expect only one debug event: when the first Promise is rejected +// and only has default reject handlers. No event is triggered when +// simply forwarding the rejection with .then's default handler. Debug = debug.Debug; -var expected_events = 2; +var expected_events = 1; var log = []; var resolve, reject; @@ -43,15 +43,9 @@ function listener(event, exec_state, event_data, data) { assertTrue(expected_events >= 0); assertTrue(event_data.uncaught()); assertTrue(event_data.promise() instanceof Promise); - if (expected_events == 1) { - // p1 is rejected, uncaught except for its default reject handler. - assertEquals(0, exec_state.frameCount()); - assertSame(p1, event_data.promise()); - } else { - // p2 is rejected by p1's default reject handler. - assertEquals(0, exec_state.frameCount()); - assertSame(p2, event_data.promise()); - } + // p1 is rejected, uncaught, with the error from the Promise.reject line + assertNotNull(event_data.sourceLineText().match("Promise.reject")); + assertSame(p1, event_data.promise()); } } catch (e) { %AbortJS(e + "\n" + e.stack); diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-all.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-all.js index 0c5ecc5f3a..d4f02cddf7 100644 --- a/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-all.js +++ b/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-all.js @@ -33,8 +33,8 @@ function listener(event, exec_state, event_data, data) { assertTrue(event_data.promise() instanceof Promise); assertSame(q, event_data.promise()); assertTrue(event_data.uncaught()); - // All of the frames on the stack are from native Javascript. - assertEquals(0, exec_state.frameCount()); + // The frame comes from the Promise.reject call + assertNotNull(/Promise\.reject/.exec(event_data.sourceLineText())); } } catch (e) { %AbortJS(e + "\n" + e.stack); diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js index e5e560b3db..0a5279fbed 100644 --- a/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js +++ b/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js @@ -33,8 +33,8 @@ function listener(event, exec_state, event_data, data) { assertTrue(event_data.promise() instanceof Promise); assertSame(q, event_data.promise()); assertTrue(event_data.uncaught()); - // All of the frames on the stack are from native Javascript. - assertEquals(0, exec_state.frameCount()); + // The JavaScript frame is from the Promise rejection + assertTrue(/Promise\.reject/.test(event_data.sourceLineText())); } } catch (e) { %AbortJS(e + "\n" + e.stack); diff --git a/deps/v8/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js b/deps/v8/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js index 3c30ad3f7c..8b798f7af9 100644 --- a/deps/v8/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js +++ b/deps/v8/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js @@ -6,13 +6,13 @@ // Test debug events when we only listen to uncaught exceptions and // there is only a default reject handler for the to-be-rejected Promise. -// We expect two Exception debug events: -// - when the first Promise is rejected and only has default reject handlers. -// - when the default reject handler passes the rejection on. +// We expect only one debug event: when the first Promise is rejected +// and only has default reject handlers. No event is triggered when +// simply forwarding the rejection with .then's default handler. Debug = debug.Debug; -var expected_events = 2; +var expected_events = 1; var log = []; var resolve, reject; @@ -43,16 +43,10 @@ function listener(event, exec_state, event_data, data) { assertTrue(expected_events >= 0); assertTrue(event_data.uncaught()); assertTrue(event_data.promise() instanceof Promise); - if (expected_events == 1) { - // p1 is rejected, uncaught except for its default reject handler. - assertTrue( - exec_state.frame(0).sourceLineText().indexOf("// event") > 0); - assertSame(p1, event_data.promise()); - } else { - // p2 is rejected by p1's default reject handler. - assertEquals(0, exec_state.frameCount()); - assertSame(p2, event_data.promise()); - } + // p1 is rejected, uncaught except for its default reject handler. + assertTrue( + exec_state.frame(0).sourceLineText().indexOf("// event") > 0); + assertSame(p1, event_data.promise()); } } catch (e) { %AbortJS(e + "\n" + e.stack); diff --git a/deps/v8/test/mjsunit/es6/function-name.js b/deps/v8/test/mjsunit/es6/function-name.js index 0fcab441ed..3b0a6fcacb 100644 --- a/deps/v8/test/mjsunit/es6/function-name.js +++ b/deps/v8/test/mjsunit/es6/function-name.js @@ -73,6 +73,8 @@ static 43() { } get 44() { } set 44(val) { } + static get constructor() { } + static set constructor(val) { } }; assertEquals('a', C.prototype.a.name); @@ -85,6 +87,9 @@ var descriptor = Object.getOwnPropertyDescriptor(C.prototype, '44'); assertEquals('get 44', descriptor.get.name); assertEquals('set 44', descriptor.set.name); + var descriptor = Object.getOwnPropertyDescriptor(C, 'constructor'); + assertEquals('get constructor', descriptor.get.name); + assertEquals('set constructor', descriptor.set.name); })(); (function testComputedProperties() { diff --git a/deps/v8/test/mjsunit/es6/promise-thenable-proxy.js b/deps/v8/test/mjsunit/es6/promise-thenable-proxy.js new file mode 100644 index 0000000000..4849639a5b --- /dev/null +++ b/deps/v8/test/mjsunit/es6/promise-thenable-proxy.js @@ -0,0 +1,23 @@ +// 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 + +function assertAsync(b, s) { + if (!b) { + %AbortJS(" FAILED!") + } +} + +var handler = { + get: function(target, name) { + if (name === 'then') { + return (val) => Promise.prototype.then.call(target, val); + } + } +}; + +var target = new Promise(r => r(42)); +var p = new Proxy(target, handler); +Promise.resolve(p).then((val) => assertAsync(val === 42)); diff --git a/deps/v8/test/mjsunit/es6/regress/regress-5337.js b/deps/v8/test/mjsunit/es6/regress/regress-5337.js new file mode 100644 index 0000000000..256b3cb554 --- /dev/null +++ b/deps/v8/test/mjsunit/es6/regress/regress-5337.js @@ -0,0 +1,39 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +(function testNestedSpreadsInPatterns() { + (function () { + var [...[...x]] = [42, 17]; + assertArrayEquals([42, 17], x); + })(); + (function () { + let [...[...x]] = [42, 17]; + assertArrayEquals([42, 17], x); + })(); + (function () { + const [...[...x]] = [42, 17]; + assertArrayEquals([42, 17], x); + })(); + (function () { + var x; [...[...x]] = [42, 17]; + assertArrayEquals([42, 17], x); + })(); + + function f1([...[...x]] = [42, 17]) { return x; } + assertArrayEquals([42, 17], f1()); + assertArrayEquals([1, 2, 3], f1([1, 2, 3])); + + var f2 = function ([...[...x]] = [42, 17]) { return x; } + assertArrayEquals([42, 17], f2()); + assertArrayEquals([1, 2, 3], f2([1, 2, 3])); + + // The following two were failing in debug mode, until v8:5337 was fixed. + var f3 = ([...[...x]] = [42, 17]) => { return x; }; + assertArrayEquals([42, 17], f3()); + assertArrayEquals([1, 2, 3], f3([1, 2, 3])); + + var f4 = ([...[...x]] = [42, 17]) => x; + assertArrayEquals([42, 17], f4()); + assertArrayEquals([1, 2, 3], f4([1, 2, 3])); +})(); diff --git a/deps/v8/test/message/syntactic-tail-call-of-eval.js b/deps/v8/test/mjsunit/es6/regress/regress-650172.js index e69aa9c351..d6b534424c 100644 --- a/deps/v8/test/message/syntactic-tail-call-of-eval.js +++ b/deps/v8/test/mjsunit/es6/regress/regress-650172.js @@ -2,8 +2,5 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls - -function g() { - return continue eval ("f()") ; -} +var iterator = [].entries().__proto__.__proto__[Symbol.iterator]; +print(1/iterator(-1E-300)); diff --git a/deps/v8/test/mjsunit/es6/string-iterator.js b/deps/v8/test/mjsunit/es6/string-iterator.js index 8eb27b199a..b63de36fc5 100644 --- a/deps/v8/test/mjsunit/es6/string-iterator.js +++ b/deps/v8/test/mjsunit/es6/string-iterator.js @@ -92,3 +92,11 @@ function TestNonOwnSlots() { assertThrows(function() { object.next(); }, TypeError); } TestNonOwnSlots(); + + +function TestSlicedStringRegression() { + var long_string = "abcdefhijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; + var sliced_string = long_string.substring(1); + var iterator = sliced_string[Symbol.iterator](); +} +TestSlicedStringRegression(); diff --git a/deps/v8/test/mjsunit/es6/super.js b/deps/v8/test/mjsunit/es6/super.js index 4c80ce7711..a101ea896b 100644 --- a/deps/v8/test/mjsunit/es6/super.js +++ b/deps/v8/test/mjsunit/es6/super.js @@ -2213,3 +2213,35 @@ TestKeyedSetterCreatingOwnPropertiesNonConfigurable(42, 43, 44); let d = new Derived(42); assertSame(42, d.x); })(); + +(function TestNullSuperPropertyLoad() { + var obj = { + __proto__: null, + named() { return super.x }, + keyed() { return super[5] } + }; + assertThrows(obj.named, TypeError); + assertThrows(obj.keyed, TypeError); + class C extends null { + named() { return super.x } + keyed() { return super[5] } + } + assertThrows(C.prototype.named, TypeError); + assertThrows(C.prototype.keyed, TypeError); +})(); + +(function TestNullSuperPropertyStore() { + var obj = { + __proto__: null, + named() { super.x = 42 }, + keyed() { super[5] = 42 } + }; + assertThrows(obj.named, TypeError); + assertThrows(obj.keyed, TypeError); + class C extends null { + named() { super.x = 42 } + keyed() { super[5] = 42 } + } + assertThrows(C.prototype.named, TypeError); + assertThrows(C.prototype.keyed, TypeError); +})(); diff --git a/deps/v8/test/mjsunit/es6/tail-call-megatest.js b/deps/v8/test/mjsunit/es6/tail-call-megatest.js index 3d2ecb8daa..a3b5cecbe0 100644 --- a/deps/v8/test/mjsunit/es6/tail-call-megatest.js +++ b/deps/v8/test/mjsunit/es6/tail-call-megatest.js @@ -25,10 +25,11 @@ function checkStackTrace(expected) { var CAN_INLINE_COMMENT = "// Let it be inlined."; var DONT_INLINE_COMMENT = (function() { - var line = "// Don't inline. Don't inline. Don't inline. Don't inline."; - for (var i = 0; i < 4; i++) { - line += "\n " + line; + var line = "1"; + for (var i = 0; i < 200; ++i) { + line += "," + i; } + line += ";\n"; return line; })(); diff --git a/deps/v8/test/mjsunit/es6/tail-call.js b/deps/v8/test/mjsunit/es6/tail-call.js index 6ecf04f3d9..4df4836021 100644 --- a/deps/v8/test/mjsunit/es6/tail-call.js +++ b/deps/v8/test/mjsunit/es6/tail-call.js @@ -295,7 +295,7 @@ function f_153(expected_call_stack, a) { function test() { var o = new A(); - %DebugPrint(o); + //%DebugPrint(o); assertEquals(153, o.x); } @@ -387,18 +387,57 @@ function f_153(expected_call_stack, a) { } } + function g1let() { + for (let v in {a:0}) { + return f_153([f_153, g1let, test]); + } + } + + function g1nodecl() { + var v; + for (v in {a:0}) { + return f_153([f_153, g1nodecl, test]); + } + } + function g2() { for (var v of [1, 2, 3]) { return f_153([f_153, g2, test]); } } + function g2let() { + for (let v of [1, 2, 3]) { + return f_153([f_153, g2let, test]); + } + } + + function g2nodecl() { + var v; + for (v of [1, 2, 3]) { + return f_153([f_153, g2nodecl, test]); + } + } + function g3() { for (var i = 0; i < 10; i++) { return f_153([f_153, test]); } } + function g3let() { + for (let i = 0; i < 10; i++) { + return f_153([f_153, test]); + } + } + + function g3nodecl() { + var i; + for (i = 0; i < 10; i++) { + return f_153([f_153, test]); + } + } + function g4() { while (true) { return f_153([f_153, test]); @@ -413,8 +452,14 @@ function f_153(expected_call_stack, a) { function test() { assertEquals(153, g1()); + assertEquals(153, g1let()); + assertEquals(153, g1nodecl()); assertEquals(153, g2()); + assertEquals(153, g2let()); + assertEquals(153, g2nodecl()); assertEquals(153, g3()); + assertEquals(153, g3let()); + assertEquals(153, g3nodecl()); assertEquals(153, g4()); assertEquals(153, g5()); } diff --git a/deps/v8/test/mjsunit/es8/syntactic-tail-call-parsing-sloppy.js b/deps/v8/test/mjsunit/es8/syntactic-tail-call-parsing-sloppy.js deleted file mode 100644 index d02608606d..0000000000 --- a/deps/v8/test/mjsunit/es8/syntactic-tail-call-parsing-sloppy.js +++ /dev/null @@ -1,410 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax --harmony-explicit-tailcalls -// Flags: --harmony-do-expressions - -var SyntaxErrorTests = [ - { msg: "Unexpected expression inside tail call", - tests: [ - { src: `()=>{ return continue foo ; }`, - err: ` ^^^`, - }, - { src: `()=>{ return continue 42 ; }`, - err: ` ^^`, - }, - { src: `()=>{ return continue new foo () ; }`, - err: ` ^^^^^^^^^^`, - }, - { src: `()=>{ loop: return continue loop ; }`, - err: ` ^^^^`, - }, - { src: `class A { foo() { return continue super.x ; } }`, - err: ` ^^^^^^^`, - }, - { src: `()=>{ return continue this ; }`, - err: ` ^^^^`, - }, - { src: `()=>{ return continue class A {} ; }`, - err: ` ^^^^^^^^^^`, - }, - { src: `()=>{ return continue class A extends B {} ; }`, - err: ` ^^^^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue function A() { } ; }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue { a: b, c: d} ; }`, - err: ` ^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue function* Gen() { yield 1; } ; }`, - err: ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^`, - }, - { src: `function A() { return continue new.target ; }`, - err: ` ^^^^^^^^^^`, - }, - { src: `()=>{ return continue () ; }`, - err: ` ^^`, - }, - { src: `()=>{ return continue ( 42 ) ; }`, - err: ` ^^^^^^`, - }, - { src: "()=>{ return continue `123 ${foo} 34lk` ; }", - err: ` ^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue do { x ? foo() : bar() ; } }`, - err: ` ^^^^^^^^^^^^^^^^^^^^^^^^^^`, - }, - ], - }, - { msg: "Tail call expression is not allowed here", - tests: [ - { src: `class A {}; class B extends A { constructor() { return continue foo () ; } }`, - err: ` ^^^^^^^^^^^^^^^`, - }, - { src: `class A extends continue f () {}; }`, - err: ` ^^^^^^^^^^^^^`, - }, - ], - }, - { msg: "Tail call expressions are not allowed in non-strict mode", - tests: [ - { src: `()=>{ return continue continue continue b() ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue ( continue b() ) ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f() - a ; }`, - err: ` ^^^^^^^^^^^^^`, - }, - { src: `()=>{ return b + continue f() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return 1, 2, 3, continue f() , 4 ; }`, - err: ` ^^^^^^^^^^^^^`, - }, - { src: `()=>{ var x = continue f ( ) ; }`, - err: ` ^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f () ? 1 : 2 ; }`, - err: ` ^^^^^^^^^^^^^`, - }, - { src: `()=>{ return (1, 2, 3, continue f()), 4; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return [1, 2, continue f() ] ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return [1, 2, ... continue f() ] ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return [1, 2, continue f(), 3 ] ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: "()=>{ return `123 ${a} ${ continue foo ( ) } 34lk` ; }", - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return g( 1, 2, continue f() ); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f() || a; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a || b || c || continue f() || d; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a && b && c && continue f() && d; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a && b || c && continue f() ? d : e; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a ? b : c && continue f() && d || e; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue foo() instanceof bar ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return bar instanceof continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue foo() in bar ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return bar in continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ function* G() { yield continue foo(); } }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ (1, 2, 3, continue f() ) => {} }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ (... continue f()) => {} }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ (a, b, c, ... continue f() ) => {} }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a <= continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return b > continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a << continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return b >> continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return c >>> continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f() = a ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a = continue f() ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a += continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a ** continue f() ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return delete continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ typeof continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return ~ continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return void continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return !continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return -continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return +continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return ++ continue f( ) ; }`, - err: ` ^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f() ++; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f() --; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return (continue foo()) () ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ for (var i = continue foo(); i < 10; i++) bar(); }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ for (var i = 0; i < continue foo(); i++) bar(); }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ for (var i = 0; i < 10; continue foo()) bar(); }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ if (continue foo()) bar(); }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ while (continue foo()) bar(); }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ do { smth; } while (continue foo()) ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ throw continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ switch (continue foo()) { case 1: break; } ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ with (continue foo()) { smth; } }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ let x = continue foo() }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ const c = continue foo() }`, - err: ` ^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ try { return continue f ( ) ; } catch(e) {} }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ try { try { smth; } catch(e) { return continue f( ) ; } }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ try { try { smth; } catch(e) { return continue f( ) ; } } finally { bla; } }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ try { smth; } catch(e) { return continue f ( ) ; } finally { blah; } }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ try { smth; } catch(e) { try { smth; } catch (e) { return continue f ( ) ; } } finally { blah; } }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ for (var v in {a:0}) { return continue foo () ; } }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ for (var v of [1, 2, 3]) { return continue foo () ; } }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue a.b.c.foo () ; }`, - err: ` ^^^^^^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue a().b.c().d.foo () ; }`, - err: ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue foo (1)(2)(3, 4) ; }`, - err: ` ^^^^^^^^^^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return ( continue b() ) ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: "()=>{ return continue bar`ab cd ef` ; }", - err: ` ^^^^^^^^^^^^^^^^^^^^^^`, - }, - { src: "()=>{ return continue bar`ab ${cd} ef` ; }", - err: ` ^^^^^^^^^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return a || continue f() ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a && continue f() ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a , continue f() ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ function* G() { return continue foo(); } }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ function B() { return continue new.target() ; } }`, - err: ` ^^^^^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue do { x ? foo() : bar() ; }() }`, - err: ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue (do { x ? foo() : bar() ; })() }`, - err: ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return do { 1, continue foo() } }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return do { x ? continue foo() : y } }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return a || (b && continue c()); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a && (b || continue c()); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a || (b ? c : continue d()); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return 1, 2, 3, a || (b ? c : continue d()); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=> continue (foo ()) ;`, - err: ` ^^^^^^^^^^^^^^^^^^`, - }, - { src: `()=> a || continue foo () ;`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=> a && continue foo () ;`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=> a ? continue foo () : b;`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - ], - }, - { msg: "Undefined label 'foo'", - tests: [ - { src: `()=>{ continue foo () ; }`, - err: ` ^^^`, - }, - ], - }, -]; - - -// Should parse successfully. -var NoErrorTests = [ - `()=>{ class A { foo() { return continue super.f() ; } } }`, - `()=>{ class A { foo() { return continue f() ; } } }`, - `()=>{ class A { foo() { return a || continue f() ; } } }`, - `()=>{ class A { foo() { return b && continue f() ; } } }`, -]; - - -(function() { - for (var test_set of SyntaxErrorTests) { - var expected_message = "SyntaxError: " + test_set.msg; - for (var test of test_set.tests) { - var passed = true; - var e = null; - try { - Realm.eval(0, test.src); - } catch (ee) { - e = ee; - } - print("======================================="); - print("Expected | " + expected_message); - print("Source | " + test.src); - print(" | " + test.err); - - if (e === null) { - print("FAILED"); - throw new Error("SyntaxError was not thrown"); - } - - var details = %GetExceptionDetails(e); - if (details.start_pos == undefined || - details.end_pos == undefined) { - throw new Error("Bad message object returned"); - } - var underline = " ".repeat(details.start_pos) + - "^".repeat(details.end_pos - details.start_pos); - var passed = expected_message === e.toString() && - test.err === underline; - - if (passed) { - print("PASSED"); - print(); - } else { - print("---------------------------------------"); - print("Actual | " + e); - print("Source | " + test.src); - print(" | " + underline); - print("FAILED"); - throw new Error("Test failed"); - } - } - } -})(); - - -(function() { - for (var src of NoErrorTests) { - print("======================================="); - print("Source | " + src); - Realm.eval(0, src); - print("PASSED"); - print(); - } -})(); diff --git a/deps/v8/test/mjsunit/es8/syntactic-tail-call-parsing.js b/deps/v8/test/mjsunit/es8/syntactic-tail-call-parsing.js deleted file mode 100644 index 486c3e1da6..0000000000 --- a/deps/v8/test/mjsunit/es8/syntactic-tail-call-parsing.js +++ /dev/null @@ -1,393 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax --harmony-explicit-tailcalls -// Flags: --harmony-do-expressions --harmony-async-await -"use strict"; - -var SyntaxErrorTests = [ - { msg: "Unexpected expression inside tail call", - tests: [ - { src: `()=>{ return continue foo ; }`, - err: ` ^^^`, - }, - { src: `()=>{ return continue 42 ; }`, - err: ` ^^`, - }, - { src: `()=>{ return continue new foo () ; }`, - err: ` ^^^^^^^^^^`, - }, - { src: `()=>{ loop: return continue loop ; }`, - err: ` ^^^^`, - }, - { src: `class A { foo() { return continue super.x ; } }`, - err: ` ^^^^^^^`, - }, - { src: `()=>{ return continue this ; }`, - err: ` ^^^^`, - }, - { src: `()=>{ return continue class A {} ; }`, - err: ` ^^^^^^^^^^`, - }, - { src: `()=>{ return continue class A extends B {} ; }`, - err: ` ^^^^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue function A() { } ; }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue { a: b, c: d} ; }`, - err: ` ^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue function* Gen() { yield 1; } ; }`, - err: ` ^^^^^^^^^^^^^^^^^^^^^^^^^^^^`, - }, - { src: `function A() { return continue new.target ; }`, - err: ` ^^^^^^^^^^`, - }, - { src: `()=>{ return continue () ; }`, - err: ` ^^`, - }, - { src: `()=>{ return continue ( 42 ) ; }`, - err: ` ^^^^^^`, - }, - { src: "()=>{ return continue `123 ${foo} 34lk` ; }", - err: ` ^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue do { x ? foo() : bar() ; } }`, - err: ` ^^^^^^^^^^^^^^^^^^^^^^^^^^`, - }, - ], - }, - { msg: "Tail call expression is not allowed here", - tests: [ - { src: `()=>{ return continue continue continue b() ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue ( continue b() ) ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f() - a ; }`, - err: ` ^^^^^^^^^^^^^`, - }, - { src: `()=>{ return b + continue f() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return 1, 2, 3, continue f() , 4 ; }`, - err: ` ^^^^^^^^^^^^^`, - }, - { src: `()=>{ var x = continue f ( ) ; }`, - err: ` ^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f () ? 1 : 2 ; }`, - err: ` ^^^^^^^^^^^^^`, - }, - { src: `()=>{ return (1, 2, 3, continue f()), 4; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return [1, 2, continue f() ] ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return [1, 2, ... continue f() ] ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return [1, 2, continue f(), 3 ] ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: "()=>{ return `123 ${a} ${ continue foo ( ) } 34lk` ; }", - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return g( 1, 2, continue f() ); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f() || a; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a || b || c || continue f() || d; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a && b && c && continue f() && d; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a && b || c && continue f() ? d : e; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a ? b : c && continue f() && d || e; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue foo() instanceof bar ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return bar instanceof continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue foo() in bar ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return bar in continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ function* G() { yield continue foo(); } }`, - err: ` ^^^^^`, - }, - { src: `()=>{ function* G() { return continue foo(); } }`, - err: ` ^^^^^`, - }, - { src: `()=>{ (1, 2, 3, continue f() ) => {} }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ (... continue f()) => {} }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ (a, b, c, ... continue f() ) => {} }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a <= continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return b > continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a << continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return b >> continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return c >>> continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f() = a ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a = continue f() ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a += continue f(); }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return a ** continue f() ; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return delete continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ typeof continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return ~ continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return void continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return !continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return -continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return +continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return ++ continue f( ) ; }`, - err: ` ^^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f() ++; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return continue f() --; }`, - err: ` ^^^^^^^^^^^^`, - }, - { src: `()=>{ return (continue foo()) () ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ for (var i = continue foo(); i < 10; i++) bar(); }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ for (var i = 0; i < continue foo(); i++) bar(); }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ for (var i = 0; i < 10; continue foo()) bar(); }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ if (continue foo()) bar(); }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ while (continue foo()) bar(); }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ do { smth; } while (continue foo()) ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ throw continue foo() ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ switch (continue foo()) { case 1: break; } ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ let x = continue foo() }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ const c = continue foo() }`, - err: ` ^^^^^^^^^^^^^^^`, - }, - { src: `class A {}; class B extends A { constructor() { return continue foo () ; } }`, - err: ` ^^^^^^^^^^^^^^^`, - }, - { src: `class A extends continue f () {}; }`, - err: ` ^^^^^^^^^^^^^`, - }, - { src: `async() => continue foo()`, - err: ` ^^^^^`, - }, - ], - }, - { msg: "Tail call expression in try block", - tests: [ - { src: `()=>{ try { return continue f ( ) ; } catch(e) {} }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ try { try { smth; } catch(e) { return continue f( ) ; } }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ try { try { smth; } catch(e) { return continue f( ) ; } } finally { bla; } }`, - err: ` ^^^^^^^^^^^^^^`, - }, - ], - }, - { msg: "Tail call expression in catch block when finally block is also present", - tests: [ - { src: `()=>{ try { smth; } catch(e) { return continue f ( ) ; } finally { blah; } }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ try { smth; } catch(e) { try { smth; } catch (e) { return continue f ( ) ; } } finally { blah; } }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - ], - }, - { msg: "Tail call expression in for-in/of body", - tests: [ - { src: `()=>{ for (var v in {a:0}) { return continue foo () ; } }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ for (var v of [1, 2, 3]) { return continue foo () ; } }`, - err: ` ^^^^^^^^^^^^^^^^`, - }, - ], - }, - { msg: "Tail call of a direct eval is not allowed", - tests: [ - { src: `()=>{ return continue eval(" foo () " ) ; }`, - err: ` ^^^^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return a || continue eval("", 1, 2) ; }`, - err: ` ^^^^^^^^^^^^^^`, - }, - { src: `()=>{ return a, continue eval ( ) ; }`, - err: ` ^^^^^^^^^`, - }, - { src: `()=> a, continue eval ( ) ; `, - err: ` ^^^^^^^^^`, - }, - { src: `()=> a || continue eval (' ' ) ; `, - err: ` ^^^^^^^^^^^^`, - }, - ], - }, - { msg: "Undefined label 'foo'", - tests: [ - { src: `()=>{ continue foo () ; }`, - err: ` ^^^`, - }, - ], - }, -]; - - -// Should parse successfully. -var NoErrorTests = [ - `()=>{ return continue a.b.c.foo () ; }`, - `()=>{ return continue a().b.c().d.foo () ; }`, - `()=>{ return continue foo (1)(2)(3, 4) ; }`, - `()=>{ return continue (0, eval)(); }`, - `()=>{ return ( continue b() ) ; }`, - "()=>{ return continue bar`ab cd ef` ; }", - "()=>{ return continue bar`ab ${cd} ef` ; }", - `()=>{ return a || continue f() ; }`, - `()=>{ return a && continue f() ; }`, - `()=>{ return a , continue f() ; }`, - `()=>{ class A { foo() { return continue super.f() ; } } }`, - `()=>{ function B() { return continue new.target() ; } }`, - `()=>{ return continue do { x ? foo() : bar() ; }() }`, - `()=>{ return continue (do { x ? foo() : bar() ; })() }`, - `()=>{ return do { 1, continue foo() } }`, - `()=>{ return do { x ? continue foo() : y } }`, - `()=>{ return a || (b && continue c()); }`, - `()=>{ return a && (b || continue c()); }`, - `()=>{ return a || (b ? c : continue d()); }`, - `()=>{ return 1, 2, 3, a || (b ? c : continue d()); }`, - `()=> continue (foo ()) ;`, - `()=> a || continue foo () ;`, - `()=> a && continue foo () ;`, - `()=> a ? continue foo () : b;`, -]; - - -(function() { - for (var test_set of SyntaxErrorTests) { - var expected_message = "SyntaxError: " + test_set.msg; - for (var test of test_set.tests) { - var passed = true; - var e = null; - try { - eval(test.src); - } catch (ee) { - e = ee; - } - print("======================================="); - print("Expected | " + expected_message); - print("Source | " + test.src); - print(" | " + test.err); - - if (e === null) { - print("FAILED"); - throw new Error("SyntaxError was not thrown"); - } - - var details = %GetExceptionDetails(e); - if (details.start_pos == undefined || - details.end_pos == undefined) { - throw new Error("Bad message object returned"); - } - var underline = " ".repeat(details.start_pos) + - "^".repeat(details.end_pos - details.start_pos); - var passed = expected_message === e.toString() && - test.err === underline; - - if (passed) { - print("PASSED"); - print(); - } else { - print("---------------------------------------"); - print("Actual | " + e); - print("Source | " + test.src); - print(" | " + underline); - print("FAILED"); - throw new Error("Test failed"); - } - } - } -})(); - - -(function() { - for (var src of NoErrorTests) { - print("======================================="); - print("Source | " + src); - src = `"use strict"; ` + src; - Realm.eval(0, src); - print("PASSED"); - print(); - } -})(); diff --git a/deps/v8/test/mjsunit/es8/syntactic-tail-call-simple.js b/deps/v8/test/mjsunit/es8/syntactic-tail-call-simple.js deleted file mode 100644 index ec7ade6673..0000000000 --- a/deps/v8/test/mjsunit/es8/syntactic-tail-call-simple.js +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax --harmony-explicit-tailcalls --stack-size=100 - -// -// Tail calls work only in strict mode. -// -(function() { - function f(n) { - if (n <= 0) { - return "foo"; - } - return f(n - 1); - } - assertThrows(()=>{ f(1e5) }); - %OptimizeFunctionOnNextCall(f); - assertThrows(()=>{ f(1e5) }); -})(); - - -// -// Tail call normal functions. -// -(function() { - "use strict"; - function f(n) { - if (n <= 0) { - return "foo"; - } - return continue f(n - 1); - } - assertEquals("foo", f(1e5)); - %OptimizeFunctionOnNextCall(f); - assertEquals("foo", f(1e5)); -})(); - - -(function() { - "use strict"; - function f(n) { - if (n <= 0) { - return "foo"; - } - return continue f(n - 1, 42); // Call with arguments adaptor. - } - assertEquals("foo", f(1e5)); - %OptimizeFunctionOnNextCall(f); - assertEquals("foo", f(1e5)); -})(); - - -(function() { - "use strict"; - function f(n){ - if (n <= 0) { - return "foo"; - } - return continue g(n - 1); - } - function g(n){ - if (n <= 0) { - return "bar"; - } - return continue f(n - 1); - } - assertEquals("foo", f(1e5)); - assertEquals("bar", f(1e5 + 1)); - %OptimizeFunctionOnNextCall(f); - assertEquals("foo", f(1e5)); - assertEquals("bar", f(1e5 + 1)); -})(); - - -(function() { - "use strict"; - function f(n){ - if (n <= 0) { - return "foo"; - } - return continue g(n - 1, 42); // Call with arguments adaptor. - } - function g(n){ - if (n <= 0) { - return "bar"; - } - return continue f(n - 1, 42); // Call with arguments adaptor. - } - assertEquals("foo", f(1e5)); - assertEquals("bar", f(1e5 + 1)); - %OptimizeFunctionOnNextCall(f); - assertEquals("foo", f(1e5)); - assertEquals("bar", f(1e5 + 1)); -})(); - - -// -// Tail call bound functions. -// -(function() { - "use strict"; - function f0(n) { - if (n <= 0) { - return "foo"; - } - return continue f_bound(n - 1); - } - var f_bound = f0.bind({}); - function f(n) { - return continue f_bound(n); - } - assertEquals("foo", f(1e5)); - %OptimizeFunctionOnNextCall(f); - assertEquals("foo", f(1e5)); -})(); - - -(function() { - "use strict"; - function f0(n){ - if (n <= 0) { - return "foo"; - } - return continue g_bound(n - 1); - } - function g0(n){ - if (n <= 0) { - return "bar"; - } - return continue f_bound(n - 1); - } - var f_bound = f0.bind({}); - var g_bound = g0.bind({}); - function f(n) { - return continue f_bound(n); - } - assertEquals("foo", f(1e5)); - assertEquals("bar", f(1e5 + 1)); - %OptimizeFunctionOnNextCall(f); - assertEquals("foo", f(1e5)); - assertEquals("bar", f(1e5 + 1)); -})(); diff --git a/deps/v8/test/mjsunit/es8/syntactic-tail-call.js b/deps/v8/test/mjsunit/es8/syntactic-tail-call.js deleted file mode 100644 index 44936a4b22..0000000000 --- a/deps/v8/test/mjsunit/es8/syntactic-tail-call.js +++ /dev/null @@ -1,604 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --allow-natives-syntax --harmony-explicit-tailcalls -// Flags: --harmony-do-expressions - -"use strict"; - -Error.prepareStackTrace = (error,stack) => { - error.strace = stack; - return error.message + "\n at " + stack.join("\n at "); -} - - -function CheckStackTrace(expected) { - var e = new Error(); - e.stack; // prepare stack trace - var stack = e.strace; - assertEquals("CheckStackTrace", stack[0].getFunctionName()); - for (var i = 0; i < expected.length; i++) { - assertEquals(expected[i].name, stack[i + 1].getFunctionName()); - } -} -%NeverOptimizeFunction(CheckStackTrace); - - -function f(expected_call_stack, a, b) { - CheckStackTrace(expected_call_stack); - return a; -} - -function f_153(expected_call_stack, a) { - CheckStackTrace(expected_call_stack); - return 153; -} - - -// Tail call when caller does not have an arguments adaptor frame. -(function() { - // Caller and callee have same number of arguments. - function f1(a) { - CheckStackTrace([f1, test]); - return 10 + a; - } - function g1(a) { return continue f1(2); } - - // Caller has more arguments than callee. - function f2(a) { - CheckStackTrace([f2, test]); - return 10 + a; - } - function g2(a, b, c) { return continue f2(2); } - - // Caller has less arguments than callee. - function f3(a, b, c) { - CheckStackTrace([f3, test]); - return 10 + a + b + c; - } - function g3(a) { return continue f3(2, 3, 4); } - - // Callee has arguments adaptor frame. - function f4(a, b, c) { - CheckStackTrace([f4, test]); - return 10 + a; - } - function g4(a) { return continue f4(2); } - - function test() { - assertEquals(12, g1(1)); - assertEquals(12, g2(1, 2, 3)); - assertEquals(19, g3(1)); - assertEquals(12, g4(1)); - } - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Tail call when caller has an arguments adaptor frame. -(function() { - // Caller and callee have same number of arguments. - function f1(a) { - CheckStackTrace([f1, test]); - return 10 + a; - } - function g1(a) { return continue f1(2); } - - // Caller has more arguments than callee. - function f2(a) { - CheckStackTrace([f2, test]); - return 10 + a; - } - function g2(a, b, c) { return continue f2(2); } - - // Caller has less arguments than callee. - function f3(a, b, c) { - CheckStackTrace([f3, test]); - return 10 + a + b + c; - } - function g3(a) { return continue f3(2, 3, 4); } - - // Callee has arguments adaptor frame. - function f4(a, b, c) { - CheckStackTrace([f4, test]); - return 10 + a; - } - function g4(a) { return continue f4(2); } - - function test() { - assertEquals(12, g1()); - assertEquals(12, g2()); - assertEquals(19, g3()); - assertEquals(12, g4()); - } - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Tail call bound function when caller does not have an arguments -// adaptor frame. -(function() { - // Caller and callee have same number of arguments. - function f1(a) { - assertEquals(153, this.a); - CheckStackTrace([f1, test]); - return 10 + a; - } - var b1 = f1.bind({a: 153}); - function g1(a) { return continue b1(2); } - - // Caller has more arguments than callee. - function f2(a) { - assertEquals(153, this.a); - CheckStackTrace([f2, test]); - return 10 + a; - } - var b2 = f2.bind({a: 153}); - function g2(a, b, c) { return continue b2(2); } - - // Caller has less arguments than callee. - function f3(a, b, c) { - assertEquals(153, this.a); - CheckStackTrace([f3, test]); - return 10 + a + b + c; - } - var b3 = f3.bind({a: 153}); - function g3(a) { return continue b3(2, 3, 4); } - - // Callee has arguments adaptor frame. - function f4(a, b, c) { - assertEquals(153, this.a); - CheckStackTrace([f4, test]); - return 10 + a; - } - var b4 = f4.bind({a: 153}); - function g4(a) { return continue b4(2); } - - function test() { - assertEquals(12, g1(1)); - assertEquals(12, g2(1, 2, 3)); - assertEquals(19, g3(1)); - assertEquals(12, g4(1)); - } - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Tail call bound function when caller has an arguments adaptor frame. -(function() { - // Caller and callee have same number of arguments. - function f1(a) { - assertEquals(153, this.a); - CheckStackTrace([f1, test]); - return 10 + a; - } - var b1 = f1.bind({a: 153}); - function g1(a) { return continue b1(2); } - - // Caller has more arguments than callee. - function f2(a) { - assertEquals(153, this.a); - CheckStackTrace([f2, test]); - return 10 + a; - } - var b2 = f2.bind({a: 153}); - function g2(a, b, c) { return continue b2(2); } - - // Caller has less arguments than callee. - function f3(a, b, c) { - assertEquals(153, this.a); - CheckStackTrace([f3, test]); - return 10 + a + b + c; - } - var b3 = f3.bind({a: 153}); - function g3(a) { return continue b3(2, 3, 4); } - - // Callee has arguments adaptor frame. - function f4(a, b, c) { - assertEquals(153, this.a); - CheckStackTrace([f4, test]); - return 10 + a; - } - var b4 = f4.bind({a: 153}); - function g4(a) { return continue b4(2); } - - function test() { - assertEquals(12, g1()); - assertEquals(12, g2()); - assertEquals(19, g3()); - assertEquals(12, g4()); - } - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Tail calling from getter. -(function() { - function g(v) { - CheckStackTrace([g, test]); - %DeoptimizeFunction(test); - return 153; - } - %NeverOptimizeFunction(g); - - function f(v) { - return continue g(); - } - %SetForceInlineFlag(f); - - function test() { - var o = {}; - o.__defineGetter__('p', f); - assertEquals(153, o.p); - } - - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Tail calling from setter. -(function() { - function g() { - CheckStackTrace([g, test]); - %DeoptimizeFunction(test); - return 153; - } - %NeverOptimizeFunction(g); - - function f(v) { - return continue g(); - } - %SetForceInlineFlag(f); - - function test() { - var o = {}; - o.__defineSetter__('q', f); - assertEquals(1, o.q = 1); - } - - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Tail calling from constructor. -(function() { - function g(context) { - CheckStackTrace([g, test]); - %DeoptimizeFunction(test); - return {x: 153}; - } - %NeverOptimizeFunction(g); - - function A() { - this.x = 42; - return continue g(); - } - - function test() { - var o = new A(); - %DebugPrint(o); - assertEquals(153, o.x); - } - - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Tail calling via various expressions. -(function() { - function g1(a) { - return f([f, g1, test], false) || continue f([f, test], true); - } - - function g2(a) { - return f([f, g2, test], true) && continue f([f, test], true); - } - - function g3(a) { - return f([f, g3, test], 13), continue f([f, test], 153); - } - - function g4(a) { - return f([f, g4, test], false) || - (f([f, g4, test], true) && continue f([f, test], true)); - } - - function g5(a) { - return f([f, g5, test], true) && - (f([f, g5, test], false) || continue f([f, test], true)); - } - - function g6(a) { - return f([f, g6, test], 13), f([f, g6, test], 42), - continue f([f, test], 153); - } - - function g7(a) { - return f([f, g7, test], false) || - (f([f, g7, test], false) ? continue f([f, test], true) - : continue f([f, test], true)); - } - - function g8(a) { - return f([f, g8, test], false) || f([f, g8, test], true) && - continue f([f, test], true); - } - - function g9(a) { - return f([f, g9, test], true) && f([f, g9, test], false) || - continue f([f, test], true); - } - - function g10(a) { - return f([f, g10, test], true) && f([f, g10, test], false) || - f([f, g10, test], true) ? - f([f, g10, test], true) && f([f, g10, test], false) || - continue f([f, test], true) : - f([f, g10, test], true) && f([f, g10, test], false) || - continue f([f, test], true); - } - - function test() { - assertEquals(true, g1()); - assertEquals(true, g2()); - assertEquals(153, g3()); - assertEquals(true, g4()); - assertEquals(true, g5()); - assertEquals(153, g6()); - assertEquals(true, g7()); - assertEquals(true, g8()); - assertEquals(true, g9()); - assertEquals(true, g10()); - } - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Tail calling from various statements. -(function() { - function g3() { - for (var i = 0; i < 10; i++) { - return continue f_153([f_153, test]); - } - } - - function g4() { - while (true) { - return continue f_153([f_153, test]); - } - } - - function g5() { - do { - return continue f_153([f_153, test]); - } while (true); - } - - function test() { - assertEquals(153, g3()); - assertEquals(153, g4()); - assertEquals(153, g5()); - } - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Test tail calls from try-catch constructs. -(function() { - function tc1(a) { - try { - f_153([f_153, tc1, test]); - return f_153([f_153, tc1, test]); - } catch(e) { - f_153([f_153, tc1, test]); - } - } - - function tc2(a) { - try { - f_153([f_153, tc2, test]); - throw new Error("boom"); - } catch(e) { - f_153([f_153, tc2, test]); - return continue f_153([f_153, test]); - } - } - - function tc3(a) { - try { - f_153([f_153, tc3, test]); - throw new Error("boom"); - } catch(e) { - f_153([f_153, tc3, test]); - } - f_153([f_153, tc3, test]); - return continue f_153([f_153, test]); - } - - function test() { - assertEquals(153, tc1()); - assertEquals(153, tc2()); - assertEquals(153, tc3()); - } - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Test tail calls from try-finally constructs. -(function() { - function tf1(a) { - try { - f_153([f_153, tf1, test]); - return f_153([f_153, tf1, test]); - } finally { - f_153([f_153, tf1, test]); - } - } - - function tf2(a) { - try { - f_153([f_153, tf2, test]); - throw new Error("boom"); - } finally { - f_153([f_153, tf2, test]); - return continue f_153([f_153, test]); - } - } - - function tf3(a) { - try { - f_153([f_153, tf3, test]); - } finally { - f_153([f_153, tf3, test]); - } - return continue f_153([f_153, test]); - } - - function test() { - assertEquals(153, tf1()); - assertEquals(153, tf2()); - assertEquals(153, tf3()); - } - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Test tail calls from try-catch-finally constructs. -(function() { - function tcf1(a) { - try { - f_153([f_153, tcf1, test]); - return f_153([f_153, tcf1, test]); - } catch(e) { - } finally { - f_153([f_153, tcf1, test]); - } - } - - function tcf2(a) { - try { - f_153([f_153, tcf2, test]); - throw new Error("boom"); - } catch(e) { - f_153([f_153, tcf2, test]); - return f_153([f_153, tcf2, test]); - } finally { - f_153([f_153, tcf2, test]); - } - } - - function tcf3(a) { - try { - f_153([f_153, tcf3, test]); - throw new Error("boom"); - } catch(e) { - f_153([f_153, tcf3, test]); - } finally { - f_153([f_153, tcf3, test]); - return continue f_153([f_153, test]); - } - } - - function tcf4(a) { - try { - f_153([f_153, tcf4, test]); - throw new Error("boom"); - } catch(e) { - f_153([f_153, tcf4, test]); - } finally { - f_153([f_153, tcf4, test]); - } - return continue f_153([f_153, test]); - } - - function test() { - assertEquals(153, tcf1()); - assertEquals(153, tcf2()); - assertEquals(153, tcf3()); - assertEquals(153, tcf4()); - } - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Test tail calls from arrow functions. -(function () { - function g1(a) { - return continue (() => { return continue f_153([f_153, test]); })(); - } - - function g2(a) { - return continue (() => continue f_153([f_153, test]))(); - } - - function g3(a) { - var closure = () => f([f, closure, test], true) - ? continue f_153([f_153, test]) - : continue f_153([f_153, test]); - return continue closure(); - } - - function test() { - assertEquals(153, g1()); - assertEquals(153, g2()); - assertEquals(153, g3()); - } - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); - - -// Test tail calls from do expressions. -(function () { - function g1(a) { - var a = do { return continue f_153([f_153, test]); 42; }; - return a; - } - - function test() { - assertEquals(153, g1()); - } - test(); - test(); - %OptimizeFunctionOnNextCall(test); - test(); -})(); diff --git a/deps/v8/test/mjsunit/fixed-context-shapes-when-recompiling.js b/deps/v8/test/mjsunit/fixed-context-shapes-when-recompiling.js new file mode 100644 index 0000000000..bd64e3d168 --- /dev/null +++ b/deps/v8/test/mjsunit/fixed-context-shapes-when-recompiling.js @@ -0,0 +1,362 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --min-preparse-length 1 --allow-natives-syntax + +// Test that the information on which variables to allocate in context doesn't +// change when recompiling. + +(function TestVarInInnerFunction() { + // Introduce variables which would potentially be context allocated, depending + // on whether an inner function refers to them or not. + var a = 1; + var b = 2; + var c = 3; + function inner() { + var a; // This will make "a" actually not be context allocated. + a; b; c; + } + // Force recompilation. + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + + +// Other tests are the same, except that the shadowing variable "a" in inner +// functions is declared differently. + +(function TestLetInInnerFunction() { + var a = 1; + var b = 2; + var c = 3; + function inner() { + let a; + a; b; c; + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +(function TestInnerFunctionParameter() { + var a = 1; + var b = 2; + var c = 3; + function inner(a) { + a; b; c; + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +(function TestInnerInnerFunctionParameter() { + var a = 1; + var b = 2; + var c = 3; + function inner() { + function innerinner(a) { a; b; c; } + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +(function TestInnerArrowFunctionParameter() { + var a = 1; + var b = 2; + var c = 3; + function inner() { + var f = a => a + b + c; + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +(function TestInnerFunctionInnerFunction() { + var a = 1; + var b = 2; + var c = 3; + function inner() { + function a() { } + a; b; c; + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +(function TestInnerFunctionSloppyBlockFunction() { + var a = 1; + var b = 2; + var c = 3; + function inner() { + if (true) { function a() { } } + a; b; c; + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +(function TestInnerFunctionCatchVariable() { + var a = 1; + var b = 2; + var c = 3; + function inner() { + try { + } + catch(a) { + a; b; c; + } + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +(function TestInnerFunctionLoopVariable1() { + var a = 1; + var b = 2; + var c = 3; + function inner() { + for (var a in {}) { + a; b; c; + } + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +(function TestInnerFunctionLoopVariable2() { + var a = 1; + var b = 2; + var c = 3; + function inner() { + for (let a in {}) { + a; b; c; + } + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +(function TestInnerFunctionLoopVariable3() { + var a = 1; + var b = 2; + var c = 3; + function inner() { + for (var a of []) { + a; b; c; + } + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +(function TestInnerFunctionLoopVariable4() { + var a = 1; + var b = 2; + var c = 3; + function inner() { + for (let a of []) { + a; b; c; + } + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +(function TestInnerFunctionClass() { + var a = 1; + var b = 2; + var c = 3; + function inner() { + class a {} + a; b; c; + } + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + assertEquals(1, a); + assertEquals(2, b); + assertEquals(3, c); + } +})(); + +// A cluster of similar tests where the inner function only declares a variable +// whose name clashes with an outer function variable name, but doesn't use it. +(function TestRegress650969_1() { + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + var a; + function inner() { + var a; + } + } +})(); + +(function TestRegress650969_2() { + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + var a; + function inner() { + var a = 6; + } + } +})(); + +(function TestRegress650969_3() { + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + var a; + function inner() { + var a, b; + } + } +})(); + +(function TestRegress650969_4() { + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + var a; + function inner() { + var a = 6, b; + } + } +})(); + +(function TestRegress650969_5() { + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + var a; + function inner() { + let a; + } + } +})(); + +(function TestRegress650969_6() { + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + var a; + function inner() { + let a = 6; + } + } +})(); + +(function TestRegress650969_7() { + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + var a; + function inner() { + let a, b; + } + } +})(); + +(function TestRegress650969_8() { + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + var a; + function inner() { + let a = 6, b; + } + } +})(); + +(function TestRegress650969_9() { + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + } + var a; + function inner(a) { + } + } +})(); diff --git a/deps/v8/test/mjsunit/function-var.js b/deps/v8/test/mjsunit/function-var.js new file mode 100644 index 0000000000..607cbe730e --- /dev/null +++ b/deps/v8/test/mjsunit/function-var.js @@ -0,0 +1,23 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +(function() { + function f() { + { + function f() { return 42 } + } + function g() { return f } + return g; + } + + var g = f(); + var inner_f = g(); + assertEquals(42, inner_f()); +})(); + +(function() { + var y = 100; + var z = (function y() { return y; }); + assertEquals(z, z()); +})(); diff --git a/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases.js b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases.js new file mode 100644 index 0000000000..76296ef7f1 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases.js @@ -0,0 +1,216 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --harmony-async-await --expose-debug-as debug + +Debug = debug.Debug + +let events = 0; + +function listener(event, exec_state, event_data, data) { + if (event != Debug.DebugEvent.Exception) return; + events++; +} + +async function thrower() { + throw "a"; // Exception a +} + +var reject = () => Promise.reject("b"); // Exception b + +async function awaitReturn() { await 1; return; } + +async function scalar() { return 1; } + +function nothing() { return 1; } + +function rejectConstructor() { + return new Promise((resolve, reject) => reject("c")); // Exception c +} + +async function argThrower(x = (() => { throw "d"; })()) { } // Exception d + +async function awaitThrow() { + await undefined; + throw "e"; // Exception e +} + +function constructorThrow() { + return new Promise((resolve, reject) => + Promise.resolve().then(() => + reject("f") // Exception f + ) + ); +} + +function suppressThrow() { + return thrower(); +} + +async function caught(producer) { + try { + await producer(); + } catch (e) { + } +} + +async function uncaught(producer) { + await producer(); +} + +async function indirectUncaught(producer) { + await uncaught(producer); +} + +async function indirectCaught(producer) { + try { + await uncaught(producer); + } catch (e) { + } +} + +function dotCatch(producer) { + Promise.resolve(producer()).catch(() => {}); +} + +function indirectReturnDotCatch(producer) { + (async() => producer())().catch(() => {}); +} + +function indirectAwaitDotCatch(producer) { + (async() => await producer())().catch(() => {}); +} + +function nestedDotCatch(producer) { + Promise.resolve(producer()).then().catch(() => {}); +} + +async function indirectAwaitCatch(producer) { + try { + await (() => producer())(); + } catch (e) { + } +} + +function switchCatch(producer) { + let resolve; + let promise = new Promise(r => resolve = r); + async function localCaught() { + try { + await promise; // force switching to localUncaught and back + await producer(); + } catch (e) { } + } + async function localUncaught() { + await undefined; + resolve(); + } + localCaught(); + localUncaught(); +} + +function switchDotCatch(producer) { + let resolve; + let promise = new Promise(r => resolve = r); + async function localCaught() { + await promise; // force switching to localUncaught and back + await producer(); + } + async function localUncaught() { + await undefined; + resolve(); + } + localCaught().catch(() => {}); + localUncaught(); +} + +let catches = [caught, + indirectCaught, + indirectAwaitCatch, + switchCatch, + switchDotCatch]; +let noncatches = [uncaught, indirectUncaught]; +let lateCatches = [dotCatch, + indirectReturnDotCatch, + indirectAwaitDotCatch, + nestedDotCatch]; + +let throws = [thrower, reject, argThrower, suppressThrow]; +let nonthrows = [awaitReturn, scalar, nothing]; +let lateThrows = [awaitThrow, constructorThrow]; +let uncatchable = [rejectConstructor]; + +let cases = []; + +for (let producer of throws.concat(lateThrows)) { + for (let consumer of catches) { + cases.push({ producer, consumer, expectedEvents: 1, caught: true }); + cases.push({ producer, consumer, expectedEvents: 0, caught: false }); + } +} + +for (let producer of throws.concat(lateThrows)) { + for (let consumer of noncatches) { + cases.push({ producer, consumer, expectedEvents: 1, caught: true }); + cases.push({ producer, consumer, expectedEvents: 1, caught: false }); + } +} + +for (let producer of nonthrows) { + for (let consumer of catches.concat(noncatches, lateCatches)) { + cases.push({ producer, consumer, expectedEvents: 0, caught: true }); + cases.push({ producer, consumer, expectedEvents: 0, caught: false }); + } +} + +for (let producer of uncatchable) { + for (let consumer of catches.concat(noncatches, lateCatches)) { + cases.push({ producer, consumer, expectedEvents: 1, caught: true }); + cases.push({ producer, consumer, expectedEvents: 1, caught: false }); + } +} + +for (let producer of lateThrows) { + for (let consumer of lateCatches) { + cases.push({ producer, consumer, expectedEvents: 1, caught: true }); + cases.push({ producer, consumer, expectedEvents: 0, caught: false }); + } +} + +for (let producer of throws) { + for (let consumer of lateCatches) { + cases.push({ producer, consumer, expectedEvents: 1, caught: true }); + cases.push({ producer, consumer, expectedEvents: 1, caught: false }); + } +} + + +function runPart(n) { + let subcases = cases.slice(n * cases.length / 4, + ((n + 1) * cases.length) / 4); + for (let {producer, consumer, expectedEvents, caught} of subcases) { + Debug.setListener(listener); + if (caught) { + Debug.setBreakOnException(); + } else { + Debug.setBreakOnUncaughtException(); + } + + events = 0; + consumer(producer); + %RunMicrotasks(); + + Debug.setListener(null); + if (caught) { + Debug.clearBreakOnException(); + } else { + Debug.clearBreakOnUncaughtException(); + } + if (expectedEvents != events) { + print(`producer ${producer} consumer ${consumer} expectedEvents ` + + `${expectedEvents} caught ${caught} events ${events}`); + quit(1); + } + } +} diff --git a/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases0.js b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases0.js new file mode 100644 index 0000000000..7a422c542b --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases0.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --harmony-async-await --expose-debug-as debug +// Files: test/mjsunit/harmony/async-debug-caught-exception-cases.js + +runPart(0); diff --git a/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases1.js b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases1.js new file mode 100644 index 0000000000..dfafa5af26 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases1.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --harmony-async-await --expose-debug-as debug +// Files: test/mjsunit/harmony/async-debug-caught-exception-cases.js + +runPart(1); diff --git a/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases2.js b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases2.js new file mode 100644 index 0000000000..0bfefae4b8 --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases2.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --harmony-async-await --expose-debug-as debug +// Files: test/mjsunit/harmony/async-debug-caught-exception-cases.js + +runPart(2); diff --git a/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases3.js b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases3.js new file mode 100644 index 0000000000..6fc7eab0cf --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception-cases3.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --harmony-async-await --expose-debug-as debug +// Files: test/mjsunit/harmony/async-debug-caught-exception-cases.js + +runPart(3); diff --git a/deps/v8/test/mjsunit/harmony/async-debug-caught-exception.js b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception.js index b2ae18437d..047b421d3d 100644 --- a/deps/v8/test/mjsunit/harmony/async-debug-caught-exception.js +++ b/deps/v8/test/mjsunit/harmony/async-debug-caught-exception.js @@ -87,3 +87,58 @@ Debug.setListener(null); Debug.clearBreakOnUncaughtException(); assertEquals([], log); assertNull(exception); + +log = []; +Debug.setListener(listener); +Debug.setBreakOnException(); + +// "rethrown" uncaught exceptions in return don't cause another event +async function propagate_inner() { return thrower(); } +async function propagate_outer() { return propagate_inner(); } + +propagate_outer(); +%RunMicrotasks(); +assertEquals(["a"], log); +assertNull(exception); + +// Also don't propagate if an await interceded +log = []; +async function propagate_await() { await 1; return thrower(); } +async function propagate_await_outer() { return propagate_await(); } +propagate_await_outer(); +%RunMicrotasks(); +assertEquals(["a"], log); +assertNull(exception); + +Debug.clearBreakOnException(); +Debug.setBreakOnUncaughtException(); + +log = []; +Promise.resolve().then(() => Promise.reject()).catch(() => log.push("d")); // Exception c +%RunMicrotasks(); +assertEquals(["d"], log); +assertNull(exception); + +Debug.clearBreakOnUncaughtException(); +Debug.setListener(null); + +// If devtools is turned on in the middle, then catch prediction +// could be wrong (here, it mispredicts the exception as caught), +// but shouldn't crash. + +log = []; + +var resolve; +var turnOnListenerPromise = new Promise(r => resolve = r); +async function confused() { + await turnOnListenerPromise; + throw foo +} +confused(); +Promise.resolve().then(() => { + Debug.setListener(listener); + Debug.setBreakOnUncaughtException(); + resolve(); +}); + +assertEquals([], log); diff --git a/deps/v8/test/mjsunit/harmony/debug-async-function-async-task-event.js b/deps/v8/test/mjsunit/harmony/debug-async-function-async-task-event.js index 249f02fc8f..90e13d8659 100644 --- a/deps/v8/test/mjsunit/harmony/debug-async-function-async-task-event.js +++ b/deps/v8/test/mjsunit/harmony/debug-async-function-async-task-event.js @@ -4,25 +4,31 @@ // Flags: --harmony-async-await --expose-debug-as debug --allow-natives-syntax +// The test observes the callbacks that async/await makes to the inspector +// to make accurate stack traces. The pattern is based on saving a stack once +// with enqueueRecurring and restoring it multiple times. + +// Additionally, the limited number of events is an indirect indication that +// we are not doing extra Promise processing that could be associated with memory +// leaks (v8:5380). In particular, no stacks are saved and restored for extra +// Promise handling on throwaway Promises. + +// TODO(littledan): Write a test that demonstrates that the memory leak in +// the exception case is fixed. + Debug = debug.Debug; var base_id = -1; var exception = null; var expected = [ - "enqueue #1", - "willHandle #1", - "then #1", - "enqueue #2", - "enqueue #3", - "didHandle #1", - "willHandle #2", - "then #2", - "didHandle #2", - "willHandle #3", - "enqueue #4", - "didHandle #3", - "willHandle #4", - "didHandle #4", + 'enqueueRecurring #1', + 'willHandle #1', + 'then #1', + 'didHandle #1', + 'willHandle #1', + 'then #2', + 'cancel #1', + 'didHandle #1', ]; function assertLog(msg) { @@ -40,8 +46,7 @@ function listener(event, exec_state, event_data, data) { if (base_id < 0) base_id = event_data.id(); var id = event_data.id() - base_id + 1; - assertTrue("Promise.resolve" == event_data.name() || - "PromiseResolveThenableJob" == event_data.name()); + assertTrue("async function" == event_data.name()); assertLog(event_data.type() + " #" + id); } catch (e) { print(e + e.stack) diff --git a/deps/v8/test/mjsunit/harmony/default-parameter-do-expression.js b/deps/v8/test/mjsunit/harmony/default-parameter-do-expression.js new file mode 100644 index 0000000000..cb80d246bc --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/default-parameter-do-expression.js @@ -0,0 +1,21 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-do-expressions --nolazy + +function hoist_unique_do_var() { + var f = (y = do { var unique = 3 }) => unique; + assertEquals(3, f()); + assertThrows(() => unique, ReferenceError); +} +hoist_unique_do_var(); + +function hoist_duplicate_do_var() { + var duplicate = 100; + var f = (y = do { var duplicate = 3 }) => duplicate; + assertEquals(3, f()); + // TODO(verwaest): The {duplicate} declarations were invalidly merged. + assertEquals(3, duplicate); +} +hoist_duplicate_do_var(); diff --git a/deps/v8/test/mjsunit/keyed-load-generic.js b/deps/v8/test/mjsunit/keyed-load-generic.js new file mode 100644 index 0000000000..a65577d635 --- /dev/null +++ b/deps/v8/test/mjsunit/keyed-load-generic.js @@ -0,0 +1,20 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +(function NegativeIndexAndDictionaryElements() { + function f(o, idx) { + return o[idx]; + } + + f({}, 0); + f({}, 0); // Make the IC megamorphic/generic. + + var o = {}; + o[1000000] = "dictionary"; + var c = -21; + o[c] = "foo"; + assertEquals("foo", f(o, c)); +})(); diff --git a/deps/v8/test/mjsunit/lazy-inner-functions.js b/deps/v8/test/mjsunit/lazy-inner-functions.js new file mode 100644 index 0000000000..127d349b1b --- /dev/null +++ b/deps/v8/test/mjsunit/lazy-inner-functions.js @@ -0,0 +1,16 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --min-preparse-length 1 + +(function TestLazyInnerFunctionCallsEval() { + var i = (function eager_outer() { + var a = 41; // Should be context-allocated + function lazy_inner() { + return eval("a"); + } + return lazy_inner; + })(); + assertEquals(41, i()); +})(); diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status index d610fce430..68cfcbe799 100644 --- a/deps/v8/test/mjsunit/mjsunit.status +++ b/deps/v8/test/mjsunit/mjsunit.status @@ -227,6 +227,14 @@ 'unicode-test': [SKIP], 'whitespaces': [SKIP], + # Async function tests taking too long + # https://bugs.chromium.org/p/v8/issues/detail?id=5411 + 'harmony/async-function-debug-scopes': [SKIP], + 'harmony/async-debug-caught-exception-cases0': [SKIP], + 'harmony/async-debug-caught-exception-cases1': [SKIP], + 'harmony/async-debug-caught-exception-cases2': [SKIP], + 'harmony/async-debug-caught-exception-cases3': [SKIP], + # TODO(mstarzinger): Takes too long with TF. 'array-sort': [PASS, NO_VARIANTS], 'regress/regress-91008': [PASS, NO_VARIANTS], @@ -531,6 +539,12 @@ }], # 'system == windows' ############################################################################## +['system == macos', { + # BUG(v8:5333) + 'big-object-literal': [SKIP], +}], # 'system == macos' + +############################################################################## ['arch == s390 or arch == s390x', { # Stack manipulations in LiveEdit is not implemented for this arch. @@ -561,6 +575,13 @@ # Too slow. 'es6/tail-call-megatest*': [SKIP], + + # Ongoing implementation of modules. + # https://bugs.chromium.org/p/v8/issues/detail?id=1569 + # The deopt fuzzer currently does not respect the 'variant != ignition' rule + # further down in this file, so we have to duplicate this here. + # https://bugs.chromium.org/p/v8/issues/detail?id=5374 + 'modules-*': [SKIP], }], # 'deopt_fuzzer == True' ############################################################################## @@ -632,47 +653,17 @@ # Might trigger stack overflow. 'unicode-test': [SKIP], - # TODO(mythria, 4780): Related to type feedback for calls in interpreter. - 'array-literal-feedback': [FAIL], - 'regress/regress-4121': [FAIL], - # TODO(4680): Test doesn't know about three tier compiler pipeline. 'assert-opt-and-deopt': [SKIP], - # BUG(rmcilroy,4989): Function is optimized without type feedback and so immediately deopts again, causing check failure in the test. - 'compiler/deopt-inlined-from-call': [FAIL], - 'compiler/increment-typefeedback': [FAIL], + # Fails because concurrent compilation is not triggered on bytecode. + # Check in Runtime_OptimizeFunctionOnNextCall. 'compiler/manual-concurrent-recompile': [FAIL], - 'constant-folding-2': [FAIL], - 'debug-is-active': [FAIL], - 'deopt-with-fp-regs': [FAIL], - 'deserialize-optimize-inner': [FAIL], - 'div-mul-minus-one': [FAIL], - 'double-intrinsics': [FAIL], - 'elements-transition-hoisting': [FAIL], - 'es6/block-let-crankshaft': [FAIL], - 'es6/block-let-crankshaft-sloppy': [FAIL], - 'getters-on-elements': [FAIL], - 'harmony/do-expressions': [FAIL], - 'math-floor-of-div-minus-zero': [FAIL], - 'regress/regress-2132': [FAIL], - 'regress/regress-2339': [FAIL], - 'regress/regress-3176': [FAIL], - 'regress/regress-3709': [FAIL], - 'regress/regress-385565': [FAIL], - 'regress/regress-crbug-594183': [FAIL], 'regress/regress-embedded-cons-string': [FAIL], - 'regress/regress-map-invalidation-2': [FAIL], - 'regress/regress-param-local-type': [FAIL], 'regress/regress-prepare-break-while-recompile': [FAIL], - 'shift-for-integer-div': [FAIL], - 'sin-cos': [FAIL], - 'smi-mul-const': [FAIL], - 'smi-mul': [FAIL], - 'unary-minus-deopt': [FAIL], - 'array-constructor-feedback': [FAIL], - 'array-feedback': [FAIL], - 'allocation-site-info': [FAIL], + + # BUG(v8:5451): Flaky crashes. + 'wasm/asm-wasm': [PASS, ['gc_stress', SKIP]], }], # variant == ignition ['variant == ignition and arch == arm64', { @@ -706,43 +697,15 @@ ############################################################################## ['variant == ignition_staging', { - 'allocation-site-info': [FAIL], - 'array-constructor-feedback': [FAIL], - 'array-feedback': [FAIL], - 'array-literal-feedback': [FAIL], 'assert-opt-and-deopt': [SKIP], - 'compiler/deopt-inlined-from-call': [FAIL], - 'compiler/increment-typefeedback': [FAIL], - 'compiler/manual-concurrent-recompile': [FAIL], - 'constant-folding-2': [FAIL], - 'debug-is-active': [FAIL], 'debug-liveedit-double-call': [FAIL], - 'deopt-with-fp-regs': [FAIL], - 'deserialize-optimize-inner': [FAIL], - 'div-mul-minus-one': [FAIL], - 'elements-transition-hoisting': [FAIL], - 'es6/block-let-crankshaft': [FAIL], - 'es6/block-let-crankshaft-sloppy': [FAIL], - 'getters-on-elements': [FAIL], - 'harmony/do-expressions': [FAIL], - 'math-floor-of-div-minus-zero': [FAIL], - 'regress/regress-2132': [FAIL], - 'regress/regress-2339': [FAIL], - 'regress/regress-3176': [FAIL], - 'regress/regress-3709': [FAIL], - 'regress/regress-385565': [FAIL], - 'regress/regress-4121': [FAIL], - 'regress/regress-crbug-594183': [FAIL], + 'regress-sync-optimized-lists': [FAIL], + + # Fails because concurrent compilation is not triggered on bytecode. + # Check in Runtime_OptimizeFunctionOnNextCall. + 'compiler/manual-concurrent-recompile': [FAIL], 'regress/regress-embedded-cons-string': [FAIL], - 'regress/regress-map-invalidation-2': [FAIL], - 'regress/regress-param-local-type': [FAIL], 'regress/regress-prepare-break-while-recompile': [FAIL], - 'regress-sync-optimized-lists': [FAIL], - 'shift-for-integer-div': [FAIL], - 'sin-cos': [FAIL], - 'smi-mul-const': [FAIL], - 'smi-mul': [FAIL], - 'unary-minus-deopt': [FAIL], # Flaky. 'asm/int32div': [SKIP], @@ -753,6 +716,8 @@ # Might trigger stack overflow. 'unicode-test': [SKIP], + # BUG(v8:5451): Flaky crashes. + 'wasm/asm-wasm': [PASS, ['gc_stress', SKIP]], }], # variant == ignition_staging ############################################################################## @@ -762,13 +727,6 @@ # Might trigger stack overflow. 'unicode-test': [SKIP], - # TODO(mythria, 4780): Related to type feedback for calls in interpreter. - 'array-literal-feedback': [FAIL], - 'regress/regress-4121': [FAIL], - 'array-constructor-feedback': [FAIL], - 'array-feedback': [FAIL], - 'allocation-site-info': [FAIL], - 'wasm/asm-wasm-f32': [PASS, ['arch in [arm64]', SKIP]], 'wasm/asm-wasm-f64': [PASS, ['arch in [arm64]', SKIP]], @@ -818,6 +776,24 @@ }], # variant == ignition_turbofan and msan ############################################################################## +['variant == ignition or variant == ignition_staging or variant == ignition_turbofan', { + # Modules for which execution must fail (e.g. because of unresolved imports). + # Eventually we should test for the precise error message, but for now we only + # ensure that there is an error. + 'modules-fail*': [FAIL], + + # Modules which are only meant to be imported from by other tests, not to be + # tested standalone. + 'modules-skip*': [SKIP], +}], # variant == ignition or variant == ignition_staging or variant == ignition_turbofan + +['variant != ignition and variant != ignition_staging and variant != ignition_turbofan', { + # Ongoing implementation of modules. + # https://bugs.chromium.org/p/v8/issues/detail?id=1569 + 'modules-*': [SKIP], +}], # variant != ignition and variant != ignition_staging and variant != ignition_turbofan + +############################################################################## ['gcov_coverage', { # Tests taking too long. 'array-functions-prototype-misc': [SKIP], @@ -827,12 +803,22 @@ }], # 'gcov_coverage' ############################################################################## -# This test allocates a 2G block of memory and if there are multiple -# varients this leads kills by the OOM killer, crashes or messages -# indicating the OS cannot allocate memory, exclude for Node.js runs -# re-evalute when we move up to v8 5.1 -[ALWAYS, { -'regress/regress-crbug-514081': [PASS, NO_VARIANTS], -}], # ALWAYS +['variant == asm_wasm', { + # Skip stuff uninteresting for asm.js + 'bugs/*': [SKIP], + 'compiler/*': [SKIP], + 'es6/*': [SKIP], + 'es7/*': [SKIP], + 'es8/*': [SKIP], + 'harmony/*': [SKIP], + 'ignition/*': [SKIP], + 'lithium/*': [SKIP], + 'third_party/*': [SKIP], + 'tools/*': [SKIP], + 'apply': [SKIP], + 'math-*': [SKIP], + 'unicode-test': [SKIP], + 'whitespaces': [SKIP], +}], # variant == asm_wasm ] diff --git a/deps/v8/test/mjsunit/modules-circular-valid.js b/deps/v8/test/mjsunit/modules-circular-valid.js new file mode 100644 index 0000000000..e381eefdbc --- /dev/null +++ b/deps/v8/test/mjsunit/modules-circular-valid.js @@ -0,0 +1,7 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +export {a as b} from "modules-skip-circular-valid.js"; diff --git a/deps/v8/test/mjsunit/modules-default-name1.js b/deps/v8/test/mjsunit/modules-default-name1.js new file mode 100644 index 0000000000..54c3afeec5 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-default-name1.js @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {default as goo} from "modules-skip-default-name1.js"; +assertEquals( + {value: "gaga", configurable: true, writable: false, enumerable: false}, + Reflect.getOwnPropertyDescriptor(goo, 'name')); diff --git a/deps/v8/test/mjsunit/modules-default-name2.js b/deps/v8/test/mjsunit/modules-default-name2.js new file mode 100644 index 0000000000..51e64139ca --- /dev/null +++ b/deps/v8/test/mjsunit/modules-default-name2.js @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {default as goo} from "modules-skip-default-name2.js"; +assertEquals( + {value: "gaga", configurable: true, writable: false, enumerable: false}, + Reflect.getOwnPropertyDescriptor(goo, 'name')); diff --git a/deps/v8/test/mjsunit/modules-default-name3.js b/deps/v8/test/mjsunit/modules-default-name3.js new file mode 100644 index 0000000000..caab3eb32a --- /dev/null +++ b/deps/v8/test/mjsunit/modules-default-name3.js @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {default as goo} from "modules-skip-default-name3.js"; +assertEquals( + {value: "default", configurable: true, writable: false, enumerable: false}, + Reflect.getOwnPropertyDescriptor(goo, 'name')); diff --git a/deps/v8/test/mjsunit/modules-default-name4.js b/deps/v8/test/mjsunit/modules-default-name4.js new file mode 100644 index 0000000000..c69da9d02b --- /dev/null +++ b/deps/v8/test/mjsunit/modules-default-name4.js @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {default as goo} from "modules-skip-default-name4.js"; +assertEquals( + {value: "Gaga", configurable: true, writable: false, enumerable: false}, + Reflect.getOwnPropertyDescriptor(goo, 'name')); diff --git a/deps/v8/test/mjsunit/modules-default-name5.js b/deps/v8/test/mjsunit/modules-default-name5.js new file mode 100644 index 0000000000..d6e0e5c049 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-default-name5.js @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {default as goo} from "modules-skip-default-name5.js"; +assertEquals( + {value: "Gaga", configurable: true, writable: false, enumerable: false}, + Reflect.getOwnPropertyDescriptor(goo, 'name')); diff --git a/deps/v8/test/mjsunit/modules-default-name6.js b/deps/v8/test/mjsunit/modules-default-name6.js new file mode 100644 index 0000000000..1ac1bcb0c9 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-default-name6.js @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {default as goo} from "modules-skip-default-name6.js"; +assertEquals( + {value: "default", configurable: true, writable: false, enumerable: false}, + Reflect.getOwnPropertyDescriptor(goo, 'name')); diff --git a/deps/v8/test/mjsunit/modules-default-name7.js b/deps/v8/test/mjsunit/modules-default-name7.js new file mode 100644 index 0000000000..82904d4212 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-default-name7.js @@ -0,0 +1,11 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {default as goo} from "modules-skip-default-name7.js"; +let descr = Reflect.getOwnPropertyDescriptor(goo, 'name'); +assertEquals(descr, + {value: descr.value, configurable: true, writable: true, enumerable: false}); +assertEquals("yo", descr.value()); diff --git a/deps/v8/test/mjsunit/modules-default-name8.js b/deps/v8/test/mjsunit/modules-default-name8.js new file mode 100644 index 0000000000..b192a2544a --- /dev/null +++ b/deps/v8/test/mjsunit/modules-default-name8.js @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {default as goo} from "modules-skip-default-name8.js"; +assertEquals( + {value: "default", configurable: true, writable: false, enumerable: false}, + Reflect.getOwnPropertyDescriptor(goo, 'name')); diff --git a/deps/v8/test/mjsunit/modules-default-name9.js b/deps/v8/test/mjsunit/modules-default-name9.js new file mode 100644 index 0000000000..3ba711f47e --- /dev/null +++ b/deps/v8/test/mjsunit/modules-default-name9.js @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {default as goo} from "modules-skip-default-name9.js"; +assertEquals( + {value: "default", configurable: true, writable: false, enumerable: false}, + Reflect.getOwnPropertyDescriptor(goo, 'name')); diff --git a/deps/v8/test/mjsunit/modules-default.js b/deps/v8/test/mjsunit/modules-default.js new file mode 100644 index 0000000000..304703b246 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-default.js @@ -0,0 +1,11 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import foo from "modules-skip-1.js"; +assertEquals(42, foo); + +import {default as gaga} from "modules-skip-1.js"; +assertEquals(42, gaga); diff --git a/deps/v8/test/mjsunit/modules-empty-import1.js b/deps/v8/test/mjsunit/modules-empty-import1.js new file mode 100644 index 0000000000..60498f187a --- /dev/null +++ b/deps/v8/test/mjsunit/modules-empty-import1.js @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import "modules-skip-empty-import.js"; +import {counter} from "modules-skip-empty-import-aux.js"; +assertEquals(1, counter); diff --git a/deps/v8/test/mjsunit/modules-empty-import2.js b/deps/v8/test/mjsunit/modules-empty-import2.js new file mode 100644 index 0000000000..8862c94c92 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-empty-import2.js @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {} from "modules-skip-empty-import.js"; +import {counter} from "modules-skip-empty-import-aux.js"; +assertEquals(1, counter); diff --git a/deps/v8/test/mjsunit/modules-empty-import3.js b/deps/v8/test/mjsunit/modules-empty-import3.js new file mode 100644 index 0000000000..0503891fce --- /dev/null +++ b/deps/v8/test/mjsunit/modules-empty-import3.js @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +export {} from "modules-skip-empty-import.js"; +import {counter} from "modules-skip-empty-import-aux.js"; +assertEquals(1, counter); diff --git a/deps/v8/test/mjsunit/modules-empty-import4.js b/deps/v8/test/mjsunit/modules-empty-import4.js new file mode 100644 index 0000000000..0cea643414 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-empty-import4.js @@ -0,0 +1,11 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import "modules-skip-empty-import.js"; +import {} from "modules-skip-empty-import.js"; +export {} from "modules-skip-empty-import.js"; +import {counter} from "modules-skip-empty-import-aux.js"; +assertEquals(1, counter); diff --git a/deps/v8/test/mjsunit/modules-error-trace.js b/deps/v8/test/mjsunit/modules-error-trace.js new file mode 100644 index 0000000000..bbf83c510d --- /dev/null +++ b/deps/v8/test/mjsunit/modules-error-trace.js @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +// Make sure the generator resume function doesn't show up in the stack trace. +const stack = (new Error).stack; +assertEquals(2, stack.split(/\r\n|\r|\n/).length); diff --git a/deps/v8/test/mjsunit/modules-exports1.js b/deps/v8/test/mjsunit/modules-exports1.js new file mode 100644 index 0000000000..260f545225 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-exports1.js @@ -0,0 +1,55 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// MODULE + +export var myvar = "VAR"; +assertEquals("VAR", myvar); +assertEquals("VAR", eval("myvar")); +(() => assertEquals("VAR", myvar))(); + +export let mylet = "LET"; +assertEquals("LET", mylet); +assertEquals("LET", eval("mylet")); +(() => assertEquals("LET", mylet))(); + +export const myconst = "CONST"; +assertEquals("CONST", myconst); +assertEquals("CONST", eval("myconst")); +(() => assertEquals("CONST", myconst))(); + + +myvar = 1; +assertEquals(1, myvar); +assertEquals(1, eval("myvar")); +(() => assertEquals(1, myvar))(); +(() => myvar = 2)(); +assertEquals(2, myvar); +(() => assertEquals(2, myvar))(); +{ + let f = () => assertEquals(2, myvar); + f(); +} + +mylet = 1; +assertEquals(1, mylet); +assertEquals(1, eval("mylet")); +(() => assertEquals(1, mylet))(); +(() => mylet = 2)(); +assertEquals(2, mylet); +assertEquals(2, eval("mylet")); +(() => assertEquals(2, mylet))(); +{ + let f = () => assertEquals(2, mylet); + f(); +} + +assertThrows(() => myconst = 1, TypeError); +assertEquals("CONST", myconst); +assertEquals("CONST", eval("myconst")); +(() => assertEquals("CONST", myconst))(); +{ + let f = () => assertEquals("CONST", myconst); + f(); +} diff --git a/deps/v8/test/mjsunit/modules-exports2.js b/deps/v8/test/mjsunit/modules-exports2.js new file mode 100644 index 0000000000..77f6bb6ccc --- /dev/null +++ b/deps/v8/test/mjsunit/modules-exports2.js @@ -0,0 +1,31 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// MODULE + +export function foo() { return 42 } +assertEquals(42, foo()); +foo = 1; +assertEquals(1, foo); + +let gaga = 43; +export {gaga as gugu}; +assertEquals(43, gaga); + +export default (function bar() { return 43 }) +assertThrows(() => bar(), ReferenceError); +assertThrows("default", SyntaxError); +assertThrows("*default*", SyntaxError); + + +var bla = 44; +var blu = 45; +export {bla}; +export {bla as blu}; +export {bla as bli}; +assertEquals(44, bla); +assertEquals(45, blu); +bla = 46; +assertEquals(46, bla); +assertEquals(45, blu); diff --git a/deps/v8/test/mjsunit/modules-exports3.js b/deps/v8/test/mjsunit/modules-exports3.js new file mode 100644 index 0000000000..a792852ad9 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-exports3.js @@ -0,0 +1,48 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// MODULE + +export { myvar, mylet, myconst }; + +var myvar = "VAR"; +assertEquals("VAR", myvar); +let mylet = "LET"; +assertEquals("LET", mylet); +const myconst = "CONST"; +assertEquals("CONST", myconst); + +function* gaga() { yield 1 } +assertEquals(1, gaga().next().value); +export {gaga}; +export default gaga; +export {gaga as gigi}; +assertEquals(1, gaga().next().value); + + +export let gugu = 42; + +{ + assertEquals(42, gugu); +} + +try { + assertEquals(42, gugu); +} catch(_) { + assertUnreachable(); +} + +try { + throw {}; +} catch(_) { + assertEquals(42, gugu); +} + +try { + throw {}; +} catch({x=gugu}) { + assertEquals(42, x); +} + +assertEquals(5, eval("var x = 5; x")); diff --git a/deps/v8/test/mjsunit/modules-fail-1.js b/deps/v8/test/mjsunit/modules-fail-1.js new file mode 100644 index 0000000000..3e28647514 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-1.js @@ -0,0 +1,7 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {a} from "modules-fail-1.js"; diff --git a/deps/v8/test/mjsunit/modules-fail-2.js b/deps/v8/test/mjsunit/modules-fail-2.js new file mode 100644 index 0000000000..e7dd683ced --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-2.js @@ -0,0 +1,7 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {a as b} from "modules-fail-2.js"; diff --git a/deps/v8/test/mjsunit/modules-fail-3.js b/deps/v8/test/mjsunit/modules-fail-3.js new file mode 100644 index 0000000000..d29d44476d --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-3.js @@ -0,0 +1,7 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import foo from "modules-fail-3.js"; diff --git a/deps/v8/test/mjsunit/modules-fail-4.js b/deps/v8/test/mjsunit/modules-fail-4.js new file mode 100644 index 0000000000..ec9edda909 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-4.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {a as b} from "modules-fail-4.js"; +export {c as a} from "modules-fail-4.js"; diff --git a/deps/v8/test/mjsunit/modules-fail-5.js b/deps/v8/test/mjsunit/modules-fail-5.js new file mode 100644 index 0000000000..046275b2d3 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-5.js @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {a as b} from "modules-fail-5.js"; +export {c as a} from "modules-fail-5.js"; +import {c} from "modules-fail-5.js"; diff --git a/deps/v8/test/mjsunit/modules-fail-6.js b/deps/v8/test/mjsunit/modules-fail-6.js new file mode 100644 index 0000000000..766cf43852 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-6.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +// Star exports do not propagate a default export. +import a from "modules-skip-4.js"; diff --git a/deps/v8/test/mjsunit/modules-fail-7.js b/deps/v8/test/mjsunit/modules-fail-7.js new file mode 100644 index 0000000000..766cf43852 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-7.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +// Star exports do not propagate a default export. +import a from "modules-skip-4.js"; diff --git a/deps/v8/test/mjsunit/modules-fail-8.js b/deps/v8/test/mjsunit/modules-fail-8.js new file mode 100644 index 0000000000..bc9c101301 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-8.js @@ -0,0 +1,7 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {a} from "modules-skip-7.js"; diff --git a/deps/v8/test/mjsunit/modules-fail-cyclic-1.js b/deps/v8/test/mjsunit/modules-fail-cyclic-1.js new file mode 100644 index 0000000000..5156a57cd9 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-cyclic-1.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {a} from "modules-fail-cyclic-1.js"; +export {a}; diff --git a/deps/v8/test/mjsunit/modules-fail-cyclic-2.js b/deps/v8/test/mjsunit/modules-fail-cyclic-2.js new file mode 100644 index 0000000000..f6a7cecec1 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-cyclic-2.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {a} from "modules-skip-cyclic.js"; +export {a as b}; diff --git a/deps/v8/test/mjsunit/modules-fail-cyclic-3.js b/deps/v8/test/mjsunit/modules-fail-cyclic-3.js new file mode 100644 index 0000000000..a216569fff --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-cyclic-3.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +export {a as x} from "modules-skip-cyclic-3.js"; +export {b as y} from "modules-skip-cyclic-3.js"; diff --git a/deps/v8/test/mjsunit/modules-fail-star-exports-conflict.js b/deps/v8/test/mjsunit/modules-fail-star-exports-conflict.js new file mode 100644 index 0000000000..6e2b219342 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-fail-star-exports-conflict.js @@ -0,0 +1,10 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +export * from "modules-skip-star-exports-conflict.js"; +export * from "modules-skip-6.js"; + +import {a} from "modules-fail-star-exports-conflict.js"; diff --git a/deps/v8/test/mjsunit/modules-imports1.js b/deps/v8/test/mjsunit/modules-imports1.js new file mode 100644 index 0000000000..f2e33f0f6a --- /dev/null +++ b/deps/v8/test/mjsunit/modules-imports1.js @@ -0,0 +1,26 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {a as x, set_a as set_x} from "modules-skip-1.js" + +let get_x = () => x; + +assertEquals(1, x); +assertEquals(1, (() => x)()); +assertEquals(1, eval('x')); +assertEquals(1, get_x()); + +assertThrows(() => x = 666, TypeError); +assertEquals(1, x); +assertEquals(1, (() => x)()); +assertEquals(1, eval('x')); +assertEquals(1, get_x()); + +set_x("foo"); +assertEquals("foo", x); +assertEquals("foo", (() => x)()); +assertEquals("foo", eval('x')); +assertEquals("foo", get_x()); diff --git a/deps/v8/test/mjsunit/modules-imports2.js b/deps/v8/test/mjsunit/modules-imports2.js new file mode 100644 index 0000000000..35a7f76691 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-imports2.js @@ -0,0 +1,26 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +let get_x = () => x; + +assertEquals(1, x); +assertEquals(1, (() => x)()); +assertEquals(1, eval('x')); +assertEquals(1, get_x()); + +assertThrows(() => x = 666, TypeError); +assertEquals(1, x); +assertEquals(1, (() => x)()); +assertEquals(1, eval('x')); +assertEquals(1, get_x()); + +set_x("foo"); +assertEquals("foo", x); +assertEquals("foo", (() => x)()); +assertEquals("foo", eval('x')); +assertEquals("foo", get_x()); + +import {a as x, set_a as set_x} from "modules-skip-1.js" diff --git a/deps/v8/test/mjsunit/modules-imports3.js b/deps/v8/test/mjsunit/modules-imports3.js new file mode 100644 index 0000000000..42fcdcecb7 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-imports3.js @@ -0,0 +1,38 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {a as x, a as y} from "modules-skip-1.js"; +import {b as z, get_a, set_a} from "modules-skip-1.js"; + +assertEquals(1, get_a()); +assertEquals(1, x); +assertEquals(1, y); +assertEquals(1, z); + +set_a(2); +assertEquals(2, get_a()); +assertEquals(2, x); +assertEquals(2, y); +assertEquals(2, z); + +assertThrows(() => x = 3, TypeError); +assertThrows(() => y = 3, TypeError); +assertThrows(() => z = 3, TypeError); + +assertEquals(2, get_a()); +assertEquals(2, x); +assertEquals(2, y); +assertEquals(2, z); + +assertEquals(2, eval('get_a()')); +assertEquals(2, eval('x')); +assertEquals(2, eval('y')); +assertEquals(2, eval('z')); + +assertEquals(2, (() => get_a())()); +assertEquals(2, (() => x)()); +assertEquals(2, (() => y)()); +assertEquals(2, (() => z)()); diff --git a/deps/v8/test/mjsunit/modules-imports4.js b/deps/v8/test/mjsunit/modules-imports4.js new file mode 100644 index 0000000000..4d734878aa --- /dev/null +++ b/deps/v8/test/mjsunit/modules-imports4.js @@ -0,0 +1,31 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {b, c} from "modules-skip-2.js"; +import {a, set_a} from "modules-skip-1.js"; +import x from "modules-skip-2.js"; + +assertEquals(42, x); + +assertEquals(1, a); +assertEquals(1, b); +assertEquals(1, c); + +set_a(2); +assertEquals(2, a); +assertEquals(2, b); +assertEquals(2, c); + +assertThrows(() => a = 3, TypeError); +assertThrows(() => b = 3, TypeError); +assertThrows(() => c = 3, TypeError); + +assertEquals(2, a); +assertEquals(2, b); +assertEquals(2, c); + +assertThrows(() => x = 43, TypeError); +assertEquals(42, x); diff --git a/deps/v8/test/mjsunit/modules-imports5.js b/deps/v8/test/mjsunit/modules-imports5.js new file mode 100644 index 0000000000..b494c7e1a7 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-imports5.js @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {a} from "modules-skip-3.js"; +export var b = 20; +assertEquals(42, a+b); diff --git a/deps/v8/test/mjsunit/modules-imports6.js b/deps/v8/test/mjsunit/modules-imports6.js new file mode 100644 index 0000000000..4cb117a98d --- /dev/null +++ b/deps/v8/test/mjsunit/modules-imports6.js @@ -0,0 +1,25 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {b, c} from "modules-skip-4.js"; +import {a, set_a} from "modules-skip-4.js"; + +assertEquals(1, a); +assertEquals(1, b); +assertEquals(1, c); + +set_a(2); +assertEquals(2, a); +assertEquals(2, b); +assertEquals(2, c); + +assertThrows(() => a = 3, TypeError); +assertThrows(() => b = 3, TypeError); +assertThrows(() => c = 3, TypeError); + +assertEquals(2, a); +assertEquals(2, b); +assertEquals(2, c); diff --git a/deps/v8/test/mjsunit/modules-imports7.js b/deps/v8/test/mjsunit/modules-imports7.js new file mode 100644 index 0000000000..2501481797 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-imports7.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {a} from "modules-skip-6.js"; +assertEquals(10, a); diff --git a/deps/v8/test/mjsunit/modules-init1.js b/deps/v8/test/mjsunit/modules-init1.js new file mode 100644 index 0000000000..fbc8df2cd1 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-init1.js @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import "modules-skip-init1.js"; +export function bar() { return 42 }; +bar = 5; diff --git a/deps/v8/test/mjsunit/modules-init2.js b/deps/v8/test/mjsunit/modules-init2.js new file mode 100644 index 0000000000..866cb2742a --- /dev/null +++ b/deps/v8/test/mjsunit/modules-init2.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {bar} from "modules-init1.js"; +assertEquals(5, bar); diff --git a/deps/v8/test/mjsunit/modules-init3.js b/deps/v8/test/mjsunit/modules-init3.js new file mode 100644 index 0000000000..36ff1e8ffa --- /dev/null +++ b/deps/v8/test/mjsunit/modules-init3.js @@ -0,0 +1,20 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE + +import {check} from "modules-skip-init3.js"; + +assertSame(undefined, w); +assertThrows(() => x, ReferenceError); +assertThrows(() => y, ReferenceError); +assertThrows(() => z, ReferenceError); + +export function* v() { return 40 } +export var w = 41; +export let x = 42; +export class y {}; +export const z = "hello world"; + +assertTrue(check()); diff --git a/deps/v8/test/mjsunit/modules-preparse.js b/deps/v8/test/mjsunit/modules-preparse.js new file mode 100644 index 0000000000..6006ab2306 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-preparse.js @@ -0,0 +1,12 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// MODULE +// Flags: --min-preparse-length=0 + +let foo = 42; +function testFoo(x) { assertEquals(x, foo); } +testFoo(42); +foo++; +testFoo(43); diff --git a/deps/v8/test/mjsunit/modules-skip-1.js b/deps/v8/test/mjsunit/modules-skip-1.js new file mode 100644 index 0000000000..35731806bb --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-1.js @@ -0,0 +1,9 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export default 42; +export let a = 1; +export {a as b}; +export function set_a(x) { a = x }; +export function get_a() { return a }; diff --git a/deps/v8/test/mjsunit/modules-skip-2.js b/deps/v8/test/mjsunit/modules-skip-2.js new file mode 100644 index 0000000000..fdd576a988 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-2.js @@ -0,0 +1,7 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export {a as b, default} from "modules-skip-1.js"; +import {a as tmp} from "modules-skip-1.js"; +export {tmp as c}; diff --git a/deps/v8/test/mjsunit/modules-skip-3.js b/deps/v8/test/mjsunit/modules-skip-3.js new file mode 100644 index 0000000000..38ead4923a --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-3.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {b} from "modules-imports5.js"; +export let a = 22; +assertSame(undefined, b); +assertEquals(22, a); diff --git a/deps/v8/test/mjsunit/modules-skip-4.js b/deps/v8/test/mjsunit/modules-skip-4.js new file mode 100644 index 0000000000..092e27b5fd --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-4.js @@ -0,0 +1,6 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export * from "modules-skip-1.js"; +export * from "modules-skip-2.js"; diff --git a/deps/v8/test/mjsunit/modules-skip-5.js b/deps/v8/test/mjsunit/modules-skip-5.js new file mode 100644 index 0000000000..6a1ef495e6 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-5.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export function a() { return "ooo" } diff --git a/deps/v8/test/mjsunit/modules-skip-6.js b/deps/v8/test/mjsunit/modules-skip-6.js new file mode 100644 index 0000000000..4a0ef8da64 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-6.js @@ -0,0 +1,7 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export * from "modules-skip-1.js"; +export * from "modules-skip-5.js"; +export const a = 10; diff --git a/deps/v8/test/mjsunit/modules-skip-7.js b/deps/v8/test/mjsunit/modules-skip-7.js new file mode 100644 index 0000000000..9f46990373 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-7.js @@ -0,0 +1,6 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export * from "modules-skip-1.js" +export * from "modules-skip-5.js" diff --git a/deps/v8/test/mjsunit/modules-skip-circular-valid.js b/deps/v8/test/mjsunit/modules-skip-circular-valid.js new file mode 100644 index 0000000000..c22544aed0 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-circular-valid.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export let a = {key: 'value'}; +import {b} from "modules-circular-valid.js"; +assertSame(a, b); +assertEquals('value', a.key); diff --git a/deps/v8/test/mjsunit/modules-skip-cyclic-3.js b/deps/v8/test/mjsunit/modules-skip-cyclic-3.js new file mode 100644 index 0000000000..ced96270b1 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-cyclic-3.js @@ -0,0 +1,6 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export {y as a} from "modules-fail-cyclic-3.js"; +export {x as b} from "modules-fail-cyclic-3.js"; diff --git a/deps/v8/test/mjsunit/modules-skip-cyclic.js b/deps/v8/test/mjsunit/modules-skip-cyclic.js new file mode 100644 index 0000000000..ad5d80608e --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-cyclic.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export {b as a} from "modules-fail-cyclic-2.js"; diff --git a/deps/v8/test/mjsunit/modules-skip-default-name1.js b/deps/v8/test/mjsunit/modules-skip-default-name1.js new file mode 100644 index 0000000000..30a95cd691 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-default-name1.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export default function gaga() {} diff --git a/deps/v8/test/mjsunit/modules-skip-default-name2.js b/deps/v8/test/mjsunit/modules-skip-default-name2.js new file mode 100644 index 0000000000..a064b0526d --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-default-name2.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export default (function gaga() {}) diff --git a/deps/v8/test/mjsunit/modules-skip-default-name3.js b/deps/v8/test/mjsunit/modules-skip-default-name3.js new file mode 100644 index 0000000000..ed26e463bb --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-default-name3.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export default (function () {}) diff --git a/deps/v8/test/mjsunit/modules-skip-default-name4.js b/deps/v8/test/mjsunit/modules-skip-default-name4.js new file mode 100644 index 0000000000..1c569bed56 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-default-name4.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export default class Gaga { } diff --git a/deps/v8/test/mjsunit/modules-skip-default-name5.js b/deps/v8/test/mjsunit/modules-skip-default-name5.js new file mode 100644 index 0000000000..df72336718 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-default-name5.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export default (class Gaga { }) diff --git a/deps/v8/test/mjsunit/modules-skip-default-name6.js b/deps/v8/test/mjsunit/modules-skip-default-name6.js new file mode 100644 index 0000000000..02f562998d --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-default-name6.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export default (class { }) diff --git a/deps/v8/test/mjsunit/modules-skip-default-name7.js b/deps/v8/test/mjsunit/modules-skip-default-name7.js new file mode 100644 index 0000000000..e4400ca409 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-default-name7.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export default (class { static name() {return "yo"} }) diff --git a/deps/v8/test/mjsunit/modules-skip-default-name8.js b/deps/v8/test/mjsunit/modules-skip-default-name8.js new file mode 100644 index 0000000000..83e1ae43ff --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-default-name8.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export default function() { } diff --git a/deps/v8/test/mjsunit/modules-skip-default-name9.js b/deps/v8/test/mjsunit/modules-skip-default-name9.js new file mode 100644 index 0000000000..ac166f39f9 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-default-name9.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export default class { } diff --git a/deps/v8/test/mjsunit/modules-skip-empty-import-aux.js b/deps/v8/test/mjsunit/modules-skip-empty-import-aux.js new file mode 100644 index 0000000000..1eb5b15159 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-empty-import-aux.js @@ -0,0 +1,6 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export let counter = 0; +export function incr() { counter++ }; diff --git a/deps/v8/test/mjsunit/modules-skip-empty-import.js b/deps/v8/test/mjsunit/modules-skip-empty-import.js new file mode 100644 index 0000000000..74d4d3ab48 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-empty-import.js @@ -0,0 +1,6 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {incr} from "modules-skip-empty-import-aux.js"; +incr(); diff --git a/deps/v8/test/mjsunit/modules-skip-init1.js b/deps/v8/test/mjsunit/modules-skip-init1.js new file mode 100644 index 0000000000..4eb4a0a865 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-init1.js @@ -0,0 +1,6 @@ +// Copyright 2012 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. + +import {bar} from "modules-init1.js"; +assertEquals(42, bar()); diff --git a/deps/v8/test/mjsunit/modules-skip-init3.js b/deps/v8/test/mjsunit/modules-skip-init3.js new file mode 100644 index 0000000000..eac1ae172b --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-init3.js @@ -0,0 +1,20 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +import {v, w, x, y, z} from "modules-init3.js"; + +assertEquals({value: 40, done: true}, v().next()); +assertSame(undefined, w); +assertThrows(() => x, ReferenceError); +assertThrows(() => y, ReferenceError); +assertThrows(() => z, ReferenceError); + +export function check() { + assertEquals({value: 40, done: true}, v().next()); + assertEquals(41, w); + assertEquals(42, x); + assertEquals("y", y.name); + assertEquals("hello world", z); + return true; +} diff --git a/deps/v8/test/mjsunit/modules-skip-star-exports-conflict.js b/deps/v8/test/mjsunit/modules-skip-star-exports-conflict.js new file mode 100644 index 0000000000..5cbcd85a33 --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-star-exports-conflict.js @@ -0,0 +1,6 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export * from "modules-skip-1.js"; +export * from "modules-skip-5.js"; diff --git a/deps/v8/test/mjsunit/modules-skip-star-exports-cycle.js b/deps/v8/test/mjsunit/modules-skip-star-exports-cycle.js new file mode 100644 index 0000000000..ab67ca803d --- /dev/null +++ b/deps/v8/test/mjsunit/modules-skip-star-exports-cycle.js @@ -0,0 +1,6 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +export * from "modules-skip-star-exports-cycle.js"; +export * from "modules-star-exports-cycle.js"; diff --git a/deps/v8/test/message/syntactic-tail-call-in-binop-rhs.js b/deps/v8/test/mjsunit/modules-star-exports-cycle.js index a586cc84ee..6af3139af0 100644 --- a/deps/v8/test/message/syntactic-tail-call-in-binop-rhs.js +++ b/deps/v8/test/mjsunit/modules-star-exports-cycle.js @@ -1,14 +1,11 @@ // Copyright 2016 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +// +// MODULE -// Flags: --harmony-explicit-tailcalls -"use strict"; +const bar = 42; +export {bar as foo}; -function f() { - return 1; -} - -function g() { - return b + continue f() ; -} +import {foo} from "modules-skip-star-exports-cycle.js"; +assertEquals(42, foo); diff --git a/deps/v8/test/message/syntactic-tail-call-sloppy.js b/deps/v8/test/mjsunit/modules-this.js index 3973fc6d18..2c8fc74fe7 100644 --- a/deps/v8/test/message/syntactic-tail-call-sloppy.js +++ b/deps/v8/test/mjsunit/modules-this.js @@ -2,8 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls +// MODULE -function g() { - return continue f() ; -} +assertEquals(undefined, this); diff --git a/deps/v8/test/mjsunit/regexp-lastIndex.js b/deps/v8/test/mjsunit/regexp-lastIndex.js new file mode 100644 index 0000000000..16b9f86d9b --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-lastIndex.js @@ -0,0 +1,22 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// lastIndex is set only for global or sticky RegExps. On failure to find +// a match, it is set to 0. If a set fails, then it acts as if in strict mode +// and throws. + +var re = /x/g; +Object.defineProperty(re, 'lastIndex', {writable: false}); +assertThrows(() => re.exec(""), TypeError); +assertThrows(() => re.exec("x"), TypeError); + +var re = /x/y; +Object.defineProperty(re, 'lastIndex', {writable: false}); +assertThrows(() => re.exec(""), TypeError); +assertThrows(() => re.exec("x"), TypeError); + +var re = /x/; +Object.defineProperty(re, 'lastIndex', {writable: false}); +assertEquals(null, re.exec("")); +assertEquals(["x"], re.exec("x")); diff --git a/deps/v8/test/mjsunit/regexp.js b/deps/v8/test/mjsunit/regexp.js index 1a5de2addf..ddaf022d19 100644 --- a/deps/v8/test/mjsunit/regexp.js +++ b/deps/v8/test/mjsunit/regexp.js @@ -564,21 +564,21 @@ log = []; re.lastIndex = fakeLastIndex; var result = re.exec(fakeString); assertEquals(["str"], result); -assertEquals(["ts", "li"], log); +assertEquals(["ts"], log); // Again, to check if caching interferes. log = []; re.lastIndex = fakeLastIndex; result = re.exec(fakeString); assertEquals(["str"], result); -assertEquals(["ts", "li"], log); +assertEquals(["ts"], log); // And one more time, just to be certain. log = []; re.lastIndex = fakeLastIndex; result = re.exec(fakeString); assertEquals(["str"], result); -assertEquals(["ts", "li"], log); +assertEquals(["ts"], log); // Now with a global regexp, where lastIndex is actually used. re = /str/g; @@ -726,3 +726,8 @@ assertEquals(["a", "", ""], /(\2).(\1)/.exec("aba")); assertEquals(["aba", "a", "a"], /(.\2).(\1)/.exec("aba")); assertEquals(["acbc", "c", "c"], /a(.\2)b(\1)$/.exec("acbc")); assertEquals(["acbc", "c", "c"], /a(.\2)b(\1)/.exec("aabcacbc")); + +// Test surrogate pair detection in split. +// \u{daff}\u{e000} is not a surrogate pair, while \u{daff}\u{dfff} is. +assertEquals(["\u{daff}", "\u{e000}"], "\u{daff}\u{e000}".split(/[a-z]{0,1}/u)); +assertEquals(["\u{daff}\u{dfff}"], "\u{daff}\u{dfff}".split(/[a-z]{0,1}/u)); diff --git a/deps/v8/test/mjsunit/regress/regress-2437.js b/deps/v8/test/mjsunit/regress/regress-2437.js index c82293ae32..66f0abfef5 100644 --- a/deps/v8/test/mjsunit/regress/regress-2437.js +++ b/deps/v8/test/mjsunit/regress/regress-2437.js @@ -26,7 +26,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Summary of the spec: lastIndex is reset to 0 if -// - a regexp fails to match, regardless of global or non-global. +// - a global or sticky regexp fails to match. // - a global regexp is used in a function that returns multiple results, // such as String.prototype.replace or String.prototype.match, since it // repeats the regexp until it fails to match. @@ -37,19 +37,19 @@ r = /a/; r.lastIndex = 1; r.exec("zzzz"); -assertEquals(0, r.lastIndex); +assertEquals(1, r.lastIndex); // Test Regexp.prototype.test r = /a/; r.lastIndex = 1; r.test("zzzz"); -assertEquals(0, r.lastIndex); +assertEquals(1, r.lastIndex); // Test String.prototype.match r = /a/; r.lastIndex = 1; "zzzz".match(r); -assertEquals(0, r.lastIndex); +assertEquals(1, r.lastIndex); // Test String.prototype.replace with atomic regexp and empty string. r = /a/; @@ -116,7 +116,7 @@ assertEquals(-1, r.lastIndex); r.lastIndex = -1; "01234567".match(r); -assertEquals(0, r.lastIndex); +assertEquals(-1, r.lastIndex); // Also test RegExp.prototype.exec and RegExp.prototype.test r = /a/g; @@ -131,7 +131,7 @@ assertEquals(5, r.lastIndex); r = /a/; r.lastIndex = 1; r.exec("01234567"); -assertEquals(0, r.lastIndex); +assertEquals(1, r.lastIndex); r.lastIndex = 1; r.exec("0123abcd"); @@ -149,7 +149,7 @@ assertEquals(5, r.lastIndex); r = /a/; r.lastIndex = 1; r.test("01234567"); -assertEquals(0, r.lastIndex); +assertEquals(1, r.lastIndex); r.lastIndex = 1; r.test("0123abcd"); diff --git a/deps/v8/test/mjsunit/regress/regress-2438.js b/deps/v8/test/mjsunit/regress/regress-2438.js index f694ff8e19..51092788ac 100644 --- a/deps/v8/test/mjsunit/regress/regress-2438.js +++ b/deps/v8/test/mjsunit/regress/regress-2438.js @@ -27,14 +27,20 @@ function testSideEffects(subject, re) { var counter = 0; + var expected_counter = 0; + const accesses_lastindex = (re.global || re.sticky); var side_effect_object = { valueOf: function() { return counter++; } }; re.lastIndex = side_effect_object; re.exec(subject); - assertEquals(1, counter); + + if (accesses_lastindex) expected_counter++; + assertEquals(expected_counter, counter); re.lastIndex = side_effect_object; re.test(subject); - assertEquals(2, counter); + + if (accesses_lastindex) expected_counter++; + assertEquals(expected_counter, counter); } testSideEffects("zzzz", /a/); diff --git a/deps/v8/test/mjsunit/regress/regress-353551.js b/deps/v8/test/mjsunit/regress/regress-353551.js index ea5a234658..8897448e9c 100644 --- a/deps/v8/test/mjsunit/regress/regress-353551.js +++ b/deps/v8/test/mjsunit/regress/regress-353551.js @@ -30,7 +30,7 @@ function __f_3(x) { var __v_1 = arguments; __v_1[1000] = 123; depth++; - if (depth > 2500) return; + if (depth > 2400) return; function __f_4() { ++__v_1[0]; __f_3(0.5); diff --git a/deps/v8/test/mjsunit/bugs/bug-4577.js b/deps/v8/test/mjsunit/regress/regress-4577.js index de2f843965..ea46fdd2b0 100644 --- a/deps/v8/test/mjsunit/bugs/bug-4577.js +++ b/deps/v8/test/mjsunit/regress/regress-4577.js @@ -11,3 +11,11 @@ function g({arguments}) { return arguments === 42; } assertTrue(g({arguments: 42})); + +function foo() { + let arguments = 2; + return arguments; +} +assertEquals(2, foo()); + +assertThrows(function(x = arguments, arguments) {}, ReferenceError); diff --git a/deps/v8/test/mjsunit/regress/regress-5332.js b/deps/v8/test/mjsunit/regress/regress-5332.js new file mode 100644 index 0000000000..f0a0ef9ac8 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-5332.js @@ -0,0 +1,31 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +(function() { + function foo() { + var a = new Array(2); + a[1] = 1.5; + return a; + } + + assertEquals(undefined, foo()[0]); + assertEquals(undefined, foo()[0]); + %OptimizeFunctionOnNextCall(foo); + assertEquals(undefined, foo()[0]); +})(); + +(function() { + function foo() { + var a = Array(2); + a[1] = 1.5; + return a; + } + + assertEquals(undefined, foo()[0]); + assertEquals(undefined, foo()[0]); + %OptimizeFunctionOnNextCall(foo); + assertEquals(undefined, foo()[0]); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-5351.js b/deps/v8/test/mjsunit/regress/regress-5351.js new file mode 100644 index 0000000000..c9e6d3153a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-5351.js @@ -0,0 +1,12 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var re = /[bc]/; +var str = "baba"; + +assertEquals(["", "a", "a"], str.split(re)); + +// Force slow path. +re.exec = (string) => RegExp.prototype.exec.call(re, string); +assertEquals(["", "a", "a"], str.split(re)); diff --git a/deps/v8/test/mjsunit/compiler/regress-645179.js b/deps/v8/test/mjsunit/regress/regress-5357.js index 47a7d9bb21..11ada60708 100644 --- a/deps/v8/test/mjsunit/compiler/regress-645179.js +++ b/deps/v8/test/mjsunit/regress/regress-5357.js @@ -5,18 +5,13 @@ // Flags: --allow-natives-syntax function foo(a) { - return a.x === a.y; + a++; + a = Math.max(0, a); + a++; + return a; } -function A() { } - -var o = new A; - -var a = {x: o} -o.x = 0; -a.y = o; - -assertTrue(foo(a)); -assertTrue(foo(a)); +foo(0); +foo(0); %OptimizeFunctionOnNextCall(foo); -assertTrue(foo(a)); +assertEquals(2147483648, foo(2147483646)); diff --git a/deps/v8/test/mjsunit/regress/regress-5380.js b/deps/v8/test/mjsunit/regress/regress-5380.js new file mode 100644 index 0000000000..9881108379 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-5380.js @@ -0,0 +1,17 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --ignition-staging --turbo + +function f(do_osr) { + for (var i = 0; i < 3; ++i) { + if (i == 1 && do_osr) %OptimizeOsr(); + } +} + +f(false); +f(false); +%BaselineFunctionOnNextCall(f); +f(false); +f(true); diff --git a/deps/v8/test/mjsunit/regress/regress-5404.js b/deps/v8/test/mjsunit/regress/regress-5404.js new file mode 100644 index 0000000000..652db4bdb5 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-5404.js @@ -0,0 +1,21 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function foo(a, b) { + return a + "0123456789012"; +} + +foo("a"); +foo("a"); +%OptimizeFunctionOnNextCall(foo); +foo("a"); + +var a = "a".repeat(268435440); +assertThrows(function() { foo(a); }); + +%OptimizeFunctionOnNextCall(foo); +assertThrows(function() { foo(a); }); +assertOptimized(foo); diff --git a/deps/v8/test/mjsunit/regress/regress-5405.js b/deps/v8/test/mjsunit/regress/regress-5405.js new file mode 100644 index 0000000000..dd5c3c0674 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-5405.js @@ -0,0 +1,28 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-async-await --allow-natives-syntax + +let log = []; + +(async function() { + with ({get ['.promise']() { log.push('async') }}) { + return 10; + } +})(); +%RunMicrotasks(); + +(function() { + with ({get ['.new.target']() { log.push('new.target') }}) { + return new.target; + } +})(); + +(function() { + with ({get ['this']() { log.push('this') }}) { + return this; + } +})(); + +assertArrayEquals([], log); diff --git a/deps/v8/test/mjsunit/regress/regress-5440.js b/deps/v8/test/mjsunit/regress/regress-5440.js new file mode 100644 index 0000000000..4182146b1a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-5440.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --turbo --always-opt + +// The rightmost cons string is created first, resulting in an empty left part. +eval(" " + ("" + "try {;} catch (_) {}")); diff --git a/deps/v8/test/mjsunit/regress/regress-5559.js b/deps/v8/test/mjsunit/regress/regress-5559.js new file mode 100644 index 0000000000..c6f32575f5 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-5559.js @@ -0,0 +1,38 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-debug-as debug + +Debug = debug.Debug + +var exception = null; +var break_count = 0; + +function listener(event, exec_state, event_data, data) { + if (event != Debug.DebugEvent.Break) return; + try { + print(event_data.sourceLineText()); + assertTrue( + event_data.sourceLineText().indexOf(`Break ${break_count++}.`) > 0); + exec_state.prepareStep(Debug.StepAction.StepOut); + } catch (e) { + exception = e; + } +}; + +function thrower() { + try { + debugger; // Break 0. + throw 'error'; + } catch (err) { + } +} + + +Debug.setListener(listener); +thrower(); +Debug.setListener(null); // Break 1. + +assertNull(exception); +assertEquals(2, break_count); diff --git a/deps/v8/test/mjsunit/regress/regress-5648.js b/deps/v8/test/mjsunit/regress/regress-5648.js new file mode 100644 index 0000000000..3e9ea07456 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-5648.js @@ -0,0 +1,35 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +var iter = {} +iter[Symbol.iterator] = () => ({ + next: () => ({}), + return: () => {throw 666} +}); + + +function* foo() { + for (let x of iter) {throw 42} +} +assertThrowsEquals(() => foo().next(), 42); + + +function* bar() { + let x; + { let gaga = () => {x}; + [[x]] = iter; + } +} +assertThrows(() => bar().next(), TypeError); + + +function baz() { + let x; + { let gaga = () => {x}; + let gugu = () => {gaga}; + [[x]] = iter; + } +} +assertThrows(baz, TypeError); diff --git a/deps/v8/test/mjsunit/regress/regress-642409.js b/deps/v8/test/mjsunit/regress/regress-642409.js new file mode 100644 index 0000000000..eceb070a7f --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-642409.js @@ -0,0 +1,22 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +class SuperClass { +} + +class SubClass extends SuperClass { + constructor() { + super(); + this.doSomething(); + } + doSomething() { + } +} + +new SubClass(); +new SubClass(); +%OptimizeFunctionOnNextCall(SubClass); +new SubClass(); diff --git a/deps/v8/test/mjsunit/regress/regress-645680.js b/deps/v8/test/mjsunit/regress/regress-645680.js new file mode 100644 index 0000000000..b244d9c047 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-645680.js @@ -0,0 +1,20 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-gc +// +function getRandomProperty(v, rand) { + var properties = Object.getOwnPropertyNames(v); + if ("constructor" && v.constructor.hasOwnProperty()) {; } + if (properties.length == 0) { return "0"; } + return properties[rand % properties.length]; +} + +var __v_18 = (function( b) { return arguments; })("foo", NaN, "bar"); +__v_18.__p_293850326 = "foo"; +__v_18.__defineGetter__(getRandomProperty( 990787501), function() { + gc(); + return __v_18.__p_293850326; +}); +Array.prototype.indexOf.call(__v_18) diff --git a/deps/v8/test/mjsunit/regress/regress-648373-sloppy-arguments-includesValues.js b/deps/v8/test/mjsunit/regress/regress-648373-sloppy-arguments-includesValues.js new file mode 100644 index 0000000000..d586b80495 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-648373-sloppy-arguments-includesValues.js @@ -0,0 +1,33 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --expose-gc + +function getRandomProperty(v, rand) { var properties = Object.getOwnPropertyNames(v); var proto = Object.getPrototypeOf(v); if (proto) {; } if ("constructor" && v.constructor.hasOwnProperty()) {; } if (properties.length == 0) { return "0"; } return properties[rand % properties.length]; } +var __v_4 = {}; + +__v_2 = { + FAST_ELEMENTS() { + return { + get 0() { + } }; + } , + Arguments: { + FAST_SLOPPY_ARGUMENTS_ELEMENTS() { + var __v_11 = (function( b) { return arguments; })("foo", NaN, "bar"); + __v_11.__p_2006760047 = __v_11[getRandomProperty( 2006760047)]; + __v_11.__defineGetter__(getRandomProperty( 1698457573), function() { gc(); __v_4[ 1486458228] = __v_2[ 1286067691]; return __v_11.__p_2006760047; }); +; +Array.prototype.includes.call(__v_11); + }, + Detached_Float64Array() { + } } +}; +function __f_3(suites) { + Object.keys(suites).forEach(suite => __f_4(suites[suite])); + function __f_4(suite) { + Object.keys(suite).forEach(test => suite[test]()); + } +} +__f_3(__v_2); diff --git a/deps/v8/test/mjsunit/regress/regress-649067.js b/deps/v8/test/mjsunit/regress/regress-649067.js new file mode 100644 index 0000000000..cd75004230 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-649067.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertEquals(1, (function arguments() { return eval("arguments"); })(1)[0]); diff --git a/deps/v8/test/message/syntactic-tail-call-in-logical-and.js b/deps/v8/test/mjsunit/regress/regress-649078.js index 2c62ddcb21..f4f6e1b136 100644 --- a/deps/v8/test/message/syntactic-tail-call-in-logical-and.js +++ b/deps/v8/test/mjsunit/regress/regress-649078.js @@ -2,13 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls -"use strict"; +let p = Promise.resolve(); +Object.defineProperty(p, 'then', { + get: () => new Proxy(function() {}, p) +}); -function f() { - return 1; -} - -function g() { - return continue f() && a ; -} +new Promise((r) => r(p)); diff --git a/deps/v8/test/mjsunit/regress/regress-651327.js b/deps/v8/test/mjsunit/regress/regress-651327.js new file mode 100644 index 0000000000..f7ac24f95a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-651327.js @@ -0,0 +1,217 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-gc + +function __f_1(a) { + __v_1 = a; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + gc(); + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = -1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + gc(); + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 0; + gc(); + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + gc(); + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + __f_3(); + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = -1073741825; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = -7; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + __f_3(); + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 17; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + gc(); + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 0; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + gc(); + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 65535; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = -13; + x = 1; + x = 1; + this.mapHeight * Math.round(); +} +__f_1(); +function __f_2(initialX, initialY) { +} +function __f_3() { +} +gc(); +__f_1(); diff --git a/deps/v8/test/mjsunit/regress/regress-655573.js b/deps/v8/test/mjsunit/regress/regress-655573.js new file mode 100644 index 0000000000..31f8ffe32d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-655573.js @@ -0,0 +1,16 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Generate a function with a very large closure. +source = "(function() {\n" +for (var i = 0; i < 65000; i++) { + source += " var a_" + i + " = 0;\n"; +} +source += " return function() {\n" +for (var i = 0; i < 65000; i++) { + source += "a_" + i + "++;\n"; +} +source += "}})();\n" + +eval(source); diff --git a/deps/v8/test/mjsunit/regress/regress-662935.js b/deps/v8/test/mjsunit/regress/regress-662935.js new file mode 100644 index 0000000000..b15f83a1e9 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-662935.js @@ -0,0 +1,16 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-debug-as debug + +Debug = debug.Debug +function overflow() { + return new Promise(function foo() { foo() }); +} + +function listener(event, exec_state, event_data, data) { } + +Debug.setListener(listener); + +assertEquals(Promise, overflow().constructor); diff --git a/deps/v8/test/mjsunit/regress/regress-666046.js b/deps/v8/test/mjsunit/regress/regress-666046.js new file mode 100644 index 0000000000..b4615383e0 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-666046.js @@ -0,0 +1,57 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --expose-gc + +function P() { + this.a0 = {}; + this.a1 = {}; + this.a2 = {}; + this.a3 = {}; + this.a4 = {}; +} + +function A() { +} + +var proto = new P(); +A.prototype = proto; + +function foo(o) { + return o.a0; +} + +// Ensure |proto| is in old space. +gc(); +gc(); +gc(); + +// Ensure |proto| is marked as "should be fast". +var o = new A(); +foo(o); +foo(o); +foo(o); +assertTrue(%HasFastProperties(proto)); + +// Contruct a double value that looks like a tagged pointer. +var buffer = new ArrayBuffer(8); +var int32view = new Int32Array(buffer); +var float64view = new Float64Array(buffer); +int32view[0] = int32view[1] = 0x40000001; +var boom = float64view[0]; + + +// Write new space object. +proto.a4 = {a: 0}; +// Immediately delete the field. +delete proto.a4; + +// |proto| must sill be fast. +assertTrue(%HasFastProperties(proto)); + +// Add a double field instead of deleted a4 that looks like a tagged pointer. +proto.boom = boom; + +// Boom! +gc(); diff --git a/deps/v8/test/mjsunit/regress/regress-abort-context-allocate-params.js b/deps/v8/test/mjsunit/regress/regress-abort-context-allocate-params.js new file mode 100644 index 0000000000..3089f7817a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-abort-context-allocate-params.js @@ -0,0 +1,941 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +function f(getter) { + arguments = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; +} diff --git a/deps/v8/test/mjsunit/regress/regress-abort-preparsing-params.js b/deps/v8/test/mjsunit/regress/regress-abort-preparsing-params.js new file mode 100644 index 0000000000..d2bdc5084d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-abort-preparsing-params.js @@ -0,0 +1,946 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var outer_a; + +function f(a) { + outer_a = a; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; + x = 1; +} +f(1); +assertEquals(1, outer_a); diff --git a/deps/v8/test/mjsunit/regress/regress-arguments-liveness-analysis.js b/deps/v8/test/mjsunit/regress/regress-arguments-liveness-analysis.js new file mode 100644 index 0000000000..95c2c00262 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-arguments-liveness-analysis.js @@ -0,0 +1,20 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function r(v) { return v.f } +function h() { } +function y(v) { + var x = arguments; + h.apply(r(v), x); +}; + +y({f:3}); +y({f:3}); +y({f:3}); + +%OptimizeFunctionOnNextCall(y); + +y({ f : 3, u : 4 }); diff --git a/deps/v8/test/mjsunit/regress/regress-cr-658267.js b/deps/v8/test/mjsunit/regress/regress-cr-658267.js new file mode 100644 index 0000000000..9caada7954 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-cr-658267.js @@ -0,0 +1,5 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +assertThrows("class D extends async() =>", SyntaxError); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-631027.js b/deps/v8/test/mjsunit/regress/regress-crbug-631027.js new file mode 100644 index 0000000000..f3d04b8efd --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-631027.js @@ -0,0 +1,12 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --turbo-escape + +function f() { + with ({ value:"foo" }) { return value; } +} +assertEquals("foo", f()); +%OptimizeFunctionOnNextCall(f); +assertEquals("foo", f()); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-635798.js b/deps/v8/test/mjsunit/regress/regress-crbug-635798.js index 5456682ddc..0a89aa19f7 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-635798.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-635798.js @@ -8,7 +8,7 @@ function foo() { var x = []; var y = []; x.__proto__ = y; - for (var i = 0; i < 200000; ++i) { + for (var i = 0; i < 10000; ++i) { y[i] = 1; } } diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-635923.js b/deps/v8/test/mjsunit/regress/regress-crbug-635923.js new file mode 100644 index 0000000000..aea5e3a97c --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-635923.js @@ -0,0 +1,21 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --ignition --turbo-from-bytecode --turbo-filter=f + +function f(x) { return x + 23 } +function g(x) { return f(x) + 42 } + +assertEquals(23, f(0)); +assertEquals(24, f(1)); +assertEquals(67, g(2)); +assertEquals(68, g(3)); + +// Optimize {g} with Crankshaft, causing {f} to be inlined. +%OptimizeFunctionOnNextCall(g); +assertEquals(65, g(0)); + +// Optimize {f} with Turbofan, after it has been inlined. +%OptimizeFunctionOnNextCall(f); +assertEquals(23, f(0)); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-640497.js b/deps/v8/test/mjsunit/regress/regress-crbug-640497.js new file mode 100644 index 0000000000..c637badb66 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-640497.js @@ -0,0 +1,19 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --turbo --turbo-escape + +// Warm up {g} with arrays and strings. +function g(v) { return v.length; } +assertEquals(1, g("x")); +assertEquals(2, g("xy")); +assertEquals(1, g([1])); +assertEquals(2, g([1,2])); + +// Inline into {f}, where we see only an array. +function f() { assertEquals(0, g([])); } +f(); +f(); +%OptimizeFunctionOnNextCall(f); +f(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-643073.js b/deps/v8/test/mjsunit/regress/regress-crbug-643073.js new file mode 100644 index 0000000000..1301ddd184 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-643073.js @@ -0,0 +1,13 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +for (i in [0,0]) {} +function foo() { + i = 0; + return i < 0; +} +%OptimizeFunctionOnNextCall(foo); +foo(); diff --git a/deps/v8/test/message/syntactic-tail-call-without-return.js b/deps/v8/test/mjsunit/regress/regress-crbug-644111.js index 130f67dafc..2f77590850 100644 --- a/deps/v8/test/message/syntactic-tail-call-without-return.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-644111.js @@ -2,13 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls -"use strict"; +// Flags: --ignition-staging --turbo --validate-asm --always-opt -function f() { - return 1; -} - -function g() { - var x = continue f() ; +function Module() { + "use asm"; + return {}; } +var m = Module(); diff --git a/deps/v8/test/message/syntactic-tail-call-in-try-catch-finally.js b/deps/v8/test/mjsunit/regress/regress-crbug-644245.js index 3aa35a12b4..7f4e00599e 100644 --- a/deps/v8/test/message/syntactic-tail-call-in-try-catch-finally.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-644245.js @@ -2,19 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls -"use strict"; +// Flags: --allow-natives-syntax --turbo --turbo-escape function f() { - return 1; -} - -function g() { try { - f(); + throw "boom"; } catch(e) { - return continue f() ; - } finally { - f(); + %_DeoptimizeNow(); } } + +f(); +f(); +%OptimizeFunctionOnNextCall(f); +f(); diff --git a/deps/v8/test/message/syntactic-tail-call-in-binop-lhs.js b/deps/v8/test/mjsunit/regress/regress-crbug-644631.js index 58d4c957ac..5e649a4946 100644 --- a/deps/v8/test/message/syntactic-tail-call-in-binop-lhs.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-644631.js @@ -2,13 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls -"use strict"; +// Flags: --turbo --always-opt function f() { - return 1; + new Int8Array(new ArrayBuffer(2147483648)); } -function g() { - return continue f() - a ; -} +// Should not crash +assertThrows(f, RangeError); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-645103.js b/deps/v8/test/mjsunit/regress/regress-crbug-645103.js new file mode 100644 index 0000000000..4f5f662901 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-645103.js @@ -0,0 +1,17 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --ignition-staging --turbo + +class Base {} +class Subclass extends Base { + constructor() { + %DeoptimizeNow(); + super(); + } +} +new Subclass(); +new Subclass(); +%OptimizeFunctionOnNextCall(Subclass); +new Subclass(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-645888.js b/deps/v8/test/mjsunit/regress/regress-crbug-645888.js new file mode 100644 index 0000000000..267fc2fefc --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-645888.js @@ -0,0 +1,18 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --ignition-staging + +function f() { + for (var i = 0; i < 3; ++i) { + if (i == 1) { + %OptimizeOsr(); + break; // Trigger next loop. + } + } + while (true) { + throw "no loop, thank you"; + } +} +assertThrows(f); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-647217.js b/deps/v8/test/mjsunit/regress/regress-crbug-647217.js new file mode 100644 index 0000000000..390eccee67 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-647217.js @@ -0,0 +1,13 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --stack-size=100 --ignition-staging --turbo + +var source = "return 1" + new Array(2048).join(' + a') + ""; +eval("function g(a) {" + source + "}"); +%SetForceInlineFlag(g); + +function f(a) { return g(a) } +%OptimizeFunctionOnNextCall(f); +try { f(0) } catch(e) {} diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-648737.js b/deps/v8/test/mjsunit/regress/regress-crbug-648737.js new file mode 100644 index 0000000000..22f8551543 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-648737.js @@ -0,0 +1,24 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax --turbo --turbo-escape + +function f(str) { + var s = "We turn {" + str + "} into a ConsString now"; + return s.length; +} +assertEquals(33, f("a")); +assertEquals(33, f("b")); +%OptimizeFunctionOnNextCall(f); +assertEquals(33, f("c")); + +function g(str) { + var s = "We also try to materalize {" + str + "} when deopting"; + %DeoptimizeNow(); + return s.length; +} +assertEquals(43, g("a")); +assertEquals(43, g("b")); +%OptimizeFunctionOnNextCall(g); +assertEquals(43, g("c")); diff --git a/deps/v8/test/message/syntactic-tail-call-in-extends.js b/deps/v8/test/mjsunit/regress/regress-crbug-648740.js index 86bf77ebbe..e52d899852 100644 --- a/deps/v8/test/message/syntactic-tail-call-in-extends.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-648740.js @@ -2,9 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls -"use strict"; +// Flags: --min-preparse-length=0 -function g() { - return class A extends continue f() {}; -} +(function () { + function foo() { + const arguments = 42; + } +})() diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-650404.js b/deps/v8/test/mjsunit/regress/regress-crbug-650404.js new file mode 100644 index 0000000000..ebf14e69b3 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-650404.js @@ -0,0 +1,36 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function c4(w, h) { + var size = w * h; + if (size < 0) size = 0; + return new Uint32Array(size); +} + +for (var i = 0; i < 3; i++) { + // Computing -0 as the result makes the "size = w * h" multiplication IC + // go into double mode. + c4(0, -1); +} +// Optimize Uint32ConstructFromLength. +for (var i = 0; i < 1000; i++) c4(2, 2); + +// This array will have a HeapNumber as its length: +var bomb = c4(2, 2); + +function reader(o, i) { + // Dummy try-catch, so that TurboFan is used to optimize this. + try {} catch(e) {} + return o[i]; +} +// Optimize reader! +for (var i = 0; i < 3; i++) reader(bomb, 0); +%OptimizeFunctionOnNextCall(reader); +reader(bomb, 0); + +for (var i = bomb.length; i < 100; i++) { + assertEquals(undefined, reader(bomb, i)); +} diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-650933.js b/deps/v8/test/mjsunit/regress/regress-crbug-650933.js new file mode 100644 index 0000000000..e579f0d0ab --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-650933.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var a = [0, 1, 2, 3, 4, 5, 6, 7, 8]; +var o = {length: 1e40}; +try { new Uint8Array(o); } catch (e) { } +new Float64Array(a); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-650973.js b/deps/v8/test/mjsunit/regress/regress-crbug-650973.js new file mode 100644 index 0000000000..9c2d8c6747 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-650973.js @@ -0,0 +1,18 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +var v = {p:0}; +// Turn the object into dictionary mode. +v.__defineGetter__("p", function() { return 13; }); + +function f() { + var boom = (v.foo = v); + assertEquals(v, boom.foo); +} + +f(); +f(); +f(); diff --git a/deps/v8/test/message/syntactic-tail-call-in-try-try-catch-finally.js b/deps/v8/test/mjsunit/regress/regress-crbug-651403-global.js index 5b000f1181..776bdcfc87 100644 --- a/deps/v8/test/message/syntactic-tail-call-in-try-try-catch-finally.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-651403-global.js @@ -2,21 +2,19 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls -"use strict"; +// Flags: --ignition-staging --turbo --always-opt -function f() { - return 1; -} +x = ""; -function g() { - try { +function f () { + function g() { try { - f(); + eval(''); + return x; } catch(e) { - return continue f() ; } - } finally { - f(); } + return g(); } + +f(); diff --git a/deps/v8/test/message/syntactic-tail-call-in-subclass.js b/deps/v8/test/mjsunit/regress/regress-crbug-651403.js index ab788406d2..b549c56baf 100644 --- a/deps/v8/test/message/syntactic-tail-call-in-subclass.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-651403.js @@ -2,14 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -// Flags: --harmony-explicit-tailcalls -"use strict"; +// Flags: --ignition-staging --turbo --always-opt -function g() { - class A {}; - class B extends A { - constructor() { - return continue f() ; +function f () { + var x = ""; + function g() { + try { + eval(''); + return x; + } catch(e) { } } + return g(); } + +f(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-652186-global.js b/deps/v8/test/mjsunit/regress/regress-crbug-652186-global.js new file mode 100644 index 0000000000..0e869e2ff0 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-652186-global.js @@ -0,0 +1,8 @@ +// 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: --always-opt + +x = 1; +print(eval("eval('var x = 2'); x;")); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-652186-local.js b/deps/v8/test/mjsunit/regress/regress-crbug-652186-local.js new file mode 100644 index 0000000000..39f283432d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-652186-local.js @@ -0,0 +1,11 @@ +// 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: --always-opt + +function f() { + var x = 1; + return eval("eval('var x = 2'); x;"); +} +f(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-654723.js b/deps/v8/test/mjsunit/regress/regress-crbug-654723.js new file mode 100644 index 0000000000..fa81233522 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-654723.js @@ -0,0 +1,16 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +var k = "0101010101010101" + "01010101"; + +function foo(s) { + return k + s; +} + +foo("a"); +foo("a"); +%OptimizeFunctionOnNextCall(foo); +var x = foo(""); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-657478.js b/deps/v8/test/mjsunit/regress/regress-crbug-657478.js new file mode 100644 index 0000000000..0827a7a1c7 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-657478.js @@ -0,0 +1,13 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function foo(o) { return %_ToLength(o.length); } + +foo(new Array(4)); +foo(new Array(Math.pow(2, 32) - 1)); +foo({length: 10}); +%OptimizeFunctionOnNextCall(foo); +foo({length: 10}); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-663402.js b/deps/v8/test/mjsunit/regress/regress-crbug-663402.js new file mode 100644 index 0000000000..5368bd6e80 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-663402.js @@ -0,0 +1,40 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +var g_eval = eval; +function emit_f(size) { + var body = "function f(x) {" + + " if (x < 0) return x;" + + " var a = [1];" + + " if (x > 0) return ["; + for (var i = 0; i < size; i++) { + body += "0.1, "; + } + body += " ];" + + " return a;" + + "}"; + g_eval(body); +} + +// Length must be big enough to make the backing store's size not fit into +// a single instruction's immediate field (2^12). +var kLength = 701; +emit_f(kLength); +f(1); +f(1); +%OptimizeFunctionOnNextCall(f); +var a = f(1); + +// Allocating something else should not disturb |a|. +var b = new Object(); +for (var i = 0; i < kLength; i++) { + assertEquals(0.1, a[i]); +} + +// Allocating more should not crash. +for (var i = 0; i < 300; i++) { + f(1); +} diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-667689.js b/deps/v8/test/mjsunit/regress/regress-crbug-667689.js new file mode 100644 index 0000000000..e83c40eeda --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-667689.js @@ -0,0 +1,16 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +function foo() {} +foo.__defineGetter__(undefined, function() {}) + +function bar() {} +function baz(x) { return x instanceof bar }; +%OptimizeFunctionOnNextCall(baz); +baz(); +Object.setPrototypeOf(bar, null); +bar[Symbol.hasInstance] = function() { return true }; +assertTrue(baz()); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-673008.js b/deps/v8/test/mjsunit/regress/regress-crbug-673008.js new file mode 100644 index 0000000000..4e232fa99c --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-673008.js @@ -0,0 +1,23 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +var a = { + "33": true, + "-1": true +}; + +var strkeys = Object.keys(a).map(function(k) { return "" + k }); +var numkeys = Object.keys(a).map(function(k) { return +k }); +var keys = strkeys.concat(numkeys); + +keys.forEach(function(k) { + assertTrue(a.hasOwnProperty(k), + "property not found: " + k + "(" + (typeof k) + ")"); +}); + +var b = {}; +b.__proto__ = a; +keys.forEach(function(k) { + assertTrue(k in b, "property not found: " + k + "(" + (typeof k) + ")"); +}); diff --git a/deps/v8/test/mjsunit/regress/wasm/regression-02256.js b/deps/v8/test/mjsunit/regress/wasm/regression-02256.js new file mode 100644 index 0000000000..27764a22ce --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regression-02256.js @@ -0,0 +1,967 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// +// Flags: --random-seed=891196975 --expose-gc --allow-natives-syntax +// Flags: --gc-interval=207 --stress-compaction --validate-asm +// +// /v8/test/mjsunit/wasm/grow-memory.js +// /v8/test/mjsunit/regress/regress-540.js +// /v8/test/mjsunit/regress/wasm/regression-02862.js +// /v8/test/mjsunit/regress/regress-2813.js +// /v8/test/mjsunit/regress/regress-323845.js +// Begin stripped down and modified version of mjsunit.js for easy minimization in CF. + +function MjsUnitAssertionError(message) {} +MjsUnitAssertionError.prototype.toString = function() { + return this.message; +}; +var assertSame; +var assertEquals; +var assertEqualsDelta; +var assertArrayEquals; +var assertPropertiesEqual; +var assertToStringEquals; +var assertTrue; +var assertFalse; +var triggerAssertFalse; +var assertNull; +var assertNotNull; +var assertThrows; +var assertDoesNotThrow; +var assertInstanceof; +var assertUnreachable; +var assertOptimized; +var assertUnoptimized; + +function classOf(object) { + var string = Object.prototype.toString.call(object); + return string.substring(8, string.length - 1); +} + +function PrettyPrint(value) { + return ""; +} + +function PrettyPrintArrayElement(value, index, array) { + return ""; +} + +function fail(expectedText, found, name_opt) {} + +function deepObjectEquals(a, b) { + var aProps = Object.keys(a); + aProps.sort(); + var bProps = Object.keys(b); + bProps.sort(); + if (!deepEquals(aProps, bProps)) { + return false; + } + for (var i = 0; i < aProps.length; i++) { + if (!deepEquals(a[aProps[i]], b[aProps[i]])) { + return false; + } + } + return true; +} + +function deepEquals(a, b) { + if (a === b) { + if (a === 0) return (1 / a) === (1 / b); + return true; + } + if (typeof a != typeof b) return false; + if (typeof a == "number") return isNaN(a) && isNaN(b); + if (typeof a !== "object" && typeof a !== "function") return false; + var objectClass = classOf(a); + if (objectClass !== classOf(b)) return false; + if (objectClass === "RegExp") { + return (a.toString() === b.toString()); + } + if (objectClass === "Function") return false; + if (objectClass === "Array") { + var elementCount = 0; + if (a.length != b.length) { + return false; + } + for (var i = 0; i < a.length; i++) { + if (!deepEquals(a[i], b[i])) return false; + } + return true; + } + if (objectClass == "String" || objectClass == "Number" || objectClass == "Boolean" || objectClass == "Date") { + if (a.valueOf() !== b.valueOf()) return false; + } + return deepObjectEquals(a, b); +} +assertSame = function assertSame(expected, found, name_opt) { + if (found === expected) { + if (expected !== 0 || (1 / expected) == (1 / found)) return; + } else if ((expected !== expected) && (found !== found)) { + return; + } + fail(PrettyPrint(expected), found, name_opt); +}; +assertEquals = function assertEquals(expected, found, name_opt) { + if (!deepEquals(found, expected)) { + fail(PrettyPrint(expected), found, name_opt); + } +}; +assertEqualsDelta = function assertEqualsDelta(expected, found, delta, name_opt) { + assertTrue(Math.abs(expected - found) <= delta, name_opt); +}; +assertArrayEquals = function assertArrayEquals(expected, found, name_opt) { + var start = ""; + if (name_opt) { + start = name_opt + " - "; + } + assertEquals(expected.length, found.length, start + "array length"); + if (expected.length == found.length) { + for (var i = 0; i < expected.length; ++i) { + assertEquals(expected[i], found[i], start + "array element at index " + i); + } + } +}; +assertPropertiesEqual = function assertPropertiesEqual(expected, found, name_opt) { + if (!deepObjectEquals(expected, found)) { + fail(expected, found, name_opt); + } +}; +assertToStringEquals = function assertToStringEquals(expected, found, name_opt) { + if (expected != String(found)) { + fail(expected, found, name_opt); + } +}; +assertTrue = function assertTrue(value, name_opt) { + assertEquals(true, value, name_opt); +}; +assertFalse = function assertFalse(value, name_opt) { + assertEquals(false, value, name_opt); +}; +assertNull = function assertNull(value, name_opt) { + if (value !== null) { + fail("null", value, name_opt); + } +}; +assertNotNull = function assertNotNull(value, name_opt) { + if (value === null) { + fail("not null", value, name_opt); + } +}; +assertThrows = function assertThrows(code, type_opt, cause_opt) { + var threwException = true; + try { + if (typeof code == 'function') { + code(); + } else { + eval(code); + } + threwException = false; + } catch (e) { + if (typeof type_opt == 'function') { + assertInstanceof(e, type_opt); + } + if (arguments.length >= 3) { + assertEquals(e.type, cause_opt); + } + return; + } +}; +assertInstanceof = function assertInstanceof(obj, type) { + if (!(obj instanceof type)) { + var actualTypeName = null; + var actualConstructor = Object.getPrototypeOf(obj).constructor; + if (typeof actualConstructor == "function") { + actualTypeName = actualConstructor.name || String(actualConstructor); + } + fail("Object <" + PrettyPrint(obj) + "> is not an instance of <" + (type.name || type) + ">" + (actualTypeName ? " but of < " + actualTypeName + ">" : "")); + } +}; +assertDoesNotThrow = function assertDoesNotThrow(code, name_opt) { + try { + if (typeof code == 'function') { + code(); + } else { + eval(code); + } + } catch (e) { + fail("threw an exception: ", e.message || e, name_opt); + } +}; +assertUnreachable = function assertUnreachable(name_opt) { + var message = "Fail" + "ure: unreachable"; + if (name_opt) { + message += " - " + name_opt; + } +}; +var OptimizationStatus = function() {} +assertUnoptimized = function assertUnoptimized(fun, sync_opt, name_opt) { + if (sync_opt === undefined) sync_opt = ""; + assertTrue(OptimizationStatus(fun, sync_opt) != 1, name_opt); +} +assertOptimized = function assertOptimized(fun, sync_opt, name_opt) { + if (sync_opt === undefined) sync_opt = ""; + assertTrue(OptimizationStatus(fun, sync_opt) != 2, name_opt); +} +triggerAssertFalse = function() {} +try { + console.log; + print = console.log; + alert = console.log; +} catch (e) {} + +function runNearStackLimit(f) { + function t() { + try { + t(); + } catch (e) { + f(); + } + }; + try { + t(); + } catch (e) {} +} + +function quit() {} + +function nop() {} +try { + gc; +} catch (e) { + gc = nop; +} + +function getRandomProperty(v, rand) { + var properties = Object.getOwnPropertyNames(v); + var proto = Object.getPrototypeOf(v); + if (proto) { + properties = properties.concat(Object.getOwnPropertyNames(proto)); + } + if (properties.includes("constructor") && v.constructor.hasOwnProperty("__proto__")) { + properties = properties.concat(Object.getOwnPropertyNames(v.constructor.__proto__)); + } + if (properties.length == 0) { + return "0"; + } + return properties[rand % properties.length]; +} +// End stripped down and modified version of mjsunit.js. + +var __v_0 = {}; +var __v_1 = {}; +var __v_2 = {}; +var __v_3 = {}; +var __v_4 = -1073741824; +var __v_5 = {}; +var __v_6 = 1; +var __v_7 = 1073741823; +var __v_8 = {}; +var __v_9 = {}; +var __v_10 = 4294967295; +var __v_11 = this; +var __v_12 = {}; +var __v_13 = {}; +try { + load("test/mjsunit/wasm/wasm-constants.js"); + load("test/mjsunit/wasm/wasm-module-__v_1.js"); + __v_2 = 0x10000; +} catch (e) { + print("Caught: " + e); +} + +function __f_16() { + var __v_1 = new WasmModuleBuilder(); + __v_1.addFunction("grow_memory", kSig_i_i) + .addBody([kExprGetLocal, 0, kExprGrowMemory]) + .exportFunc(); + __v_1.addFunction("load", kSig_i_i) + .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) + .exportFunc(); + __v_1.addFunction("store", kSig_i_ii) + .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, kExprGetLocal, 1]) + .exportFunc(); + __v_1.addFunction("load16", kSig_i_i) + .addBody([kExprGetLocal, 0, kExprI32LoadMem16U, 0, 0]) + .exportFunc(); + __v_1.addFunction("store16", kSig_i_ii) + .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem16, 0, 0, kExprGetLocal, 1]) + .exportFunc(); + __v_1.__p_1551105852 = __v_1[getRandomProperty(__v_1, 1551105852)]; + __v_1.__defineGetter__(getRandomProperty(__v_1, 348910887), function() { + gc(); + __v_9[getRandomProperty(__v_9, 1894652048)] = __v_13[getRandomProperty(__v_13, 1352929371)]; + return __v_1.__p_1551105852; + }); + __v_1.addFunction("load8", kSig_i_i) + .addBody([kExprGetLocal, 0, kExprI32LoadMem8U, 0, 0]) + .exportFunc(); + __v_1.addFunction("store8", kSig_i_ii) + .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem8, 0, 0, kExprGetLocal, 1]) + .exportFunc(); + return __v_1; +} + +function __f_14() { + var __v_4 = __f_16(); + __v_1.addMemory(1, 1, false); + var module = __v_1.instantiate(); + var __v_3; + + function __f_1() { + return module.exports.load(__v_3); + } + + function __f_2(value) { + return module.exports.store(__v_3, value); + } + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + for (__v_3 = 0; __v_3 <= (__v_2 - 4); __v_3 += 4) { + __f_2(20); + assertEquals(20, __f_1()); + } + for (__v_3 = __v_2 - 3; __v_3 < __v_2 + 4; __v_3++) { + assertTraps(kTrapMemOutOfBounds, __f_2); + assertTraps(kTrapMemOutOfBounds, __f_1); + } + assertEquals(1, __f_8(3)); + for (__v_3 = __v_2; __v_3 <= 4 * __v_2 - 4; __v_3 += 4) { + __f_2(20); + assertEquals(20, __f_1()); + } + for (__v_3 = 4 * __v_2 - 3; __v_3 < 4 * __v_2 + 4; __v_3++) { + assertTraps(kTrapMemOutOfBounds, __f_2); + assertTraps(kTrapMemOutOfBounds, __f_1); + } + assertEquals(4, __f_8(15)); + for (__v_3 = 4 * __v_2 - 3; __v_3 <= 4 * __v_2 + 4; __v_3 += 4) { + __f_2(20); + assertEquals(20, __f_1()); + } + for (__v_3 = 19 * __v_2 - 10; __v_3 <= 19 * __v_2 - 4; __v_3 += 4) { + __f_2(20); + gc(); + assertEquals(12, __f_1()); + } + for (__v_3 = 19 * __v_2 - 3; __v_3 < 19 * __v_2 + 5; __v_3++) { + assertTraps(kTrapMemOutOfBounds, __f_2); + assertTraps(kTrapMemOutOfBounds, __f_1); + } +} +try { + __f_14(); +} catch (e) { + print("Caught: " + e); +} + +function __f_13() { + var __v_1 = __f_16(); + __v_1.__defineGetter__(getRandomProperty(__v_1, 1322348896), function() { + gc(); + return __f_28(__v_1); + }); + __v_1.addMemory(1, 1, false); + var module = __v_1.instantiate(); + assertEquals(0, __f_30(0)); + var __v_3; + + function __f_1() { + return module.exports.load16(__v_3); + } + + function __f_2(value) { + return module.exports.store16(__v_3, value); + } + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + for (__v_3 = 0; __v_3 <= (__v_2 - 2); __v_3 += 2) { + __f_2(20); + assertEquals(20, __f_1()); + __f_19(); + } + for (__v_3 = __v_2 - 1; __v_3 < __v_2 + 4; __v_3++) { + assertTraps(kTrapMemOutOfBounds, __f_2); + assertTraps(kTrapMemOutOfBounds, __f_1); + } + assertEquals(65535, __f_8(0)); + for (__v_3 = __v_2; __v_3 <= 4 * __v_2 - 2; __v_3 += 2) { + __f_2(20); + assertEquals(20, __f_1()); + } + for (__v_3 = 4 * __v_2 - 1; __v_3 < 4 * __v_2 + 4; __v_3++) { + assertTraps(kTrapMemOutOfBounds, __f_2); + assertTraps(kTrapMemOutOfBounds, __f_1); + } + assertEquals(4, __f_8(15)); + for (__v_3 = 4 * __v_2 - 2; __v_3 <= 4 * __v_2 + 4; __v_3 += 2) { + __f_2(20); + assertEquals(20, __f_1()); + } + for (__v_1 = 19 * __v_11 - 10; __v_13 <= 19 * __v_2 - 2; __v_9 += 2) { + __f_2(20); + assertEquals(20, __f_1()); + } + for (__v_3 = 19 * __v_2 - 1; __v_3 < 19 * __v_2 + 5; __v_3++) { + assertTraps(kTrapMemOutOfBounds, __f_2); + assertTraps(kTrapMemOutOfBounds, __f_1); + } +} +try { + __f_13(); +} catch (e) { + print("Caught: " + e); +} + +function __f_10() { + var __v_1 = __f_16(); + __v_1.addMemory(1, 1, false); + var module = __v_1.instantiate(); + var __v_3; + + function __f_1() { + return module.exports.load8(__v_3); + } + + function __f_2(value) { + return module.exports.store8(__v_3, value); + } + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + for (__v_3 = 0; __v_3 <= __v_2 - 1; __v_3++) { + __f_2(20); + assertEquals(20, __f_1()); + } + for (__v_3 = __v_2; __v_3 < __v_2 + 4; __v_3++) { + assertTraps(kTrapMemOutOfBounds, __f_2); + assertTraps(kTrapMemOutOfBounds, __f_1); + } + assertEquals(1, __f_8(3)); + for (__v_3 = __v_2; __v_3 <= 4 * __v_2 - 1; __v_3++) { + __f_2(20); + assertEquals(20, __f_1()); + } + for (__v_3 = 4 * __v_2; __v_3 < 4 * __v_2 + 4; __v_3++) { + assertTraps(kTrapMemOutOfBounds, __f_2); + assertTraps(kTrapMemOutOfBounds, __f_1); + } + assertEquals(4, __f_8(15)); + for (__v_3 = 4 * __v_2; __v_3 <= 4 * __v_2 + 4; __v_3++) { + __f_2(20); + assertEquals(20, __f_1()); + } + for (__v_3 = 19 * __v_2 - 10; __v_3 <= 19 * __v_2 - 1; __v_3++) { + __f_2(20); + assertEquals(20, __f_1()); + } + for (__v_3 = 19 * __v_2; __v_3 < 19 * __v_2 + 5; __v_3++) { + assertTraps(kTrapMemOutOfBounds, __f_2); + assertTraps(kTrapMemOutOfBounds, __f_1); + } +} +try { + __f_10(); +} catch (e) { + print("Caught: " + e); +} + +function __f_5() { + var __v_1 = __f_16(); + var module = __v_1.instantiate(); + var __v_3; + + function __f_1() { + return module.exports.load(__v_3); + } + + function __f_2(value) { + return module.exports.store(__v_3, value); + } + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + assertTraps(kTrapMemOutOfBounds, __f_1); + assertTraps(kTrapMemOutOfBounds, __f_2); + assertEquals(0, __f_8(1)); + for (__v_3 = 0; __v_3 <= __v_2 - 4; __v_3++) { + __f_2(20); + assertEquals(20, __f_1()); + } + for (__v_3 = __v_2; __v_3 <= __v_2 + 5; __v_3++) { + assertTraps(kTrapMemOutOfBounds, __f_1); + } +} +try { + __f_5(); +} catch (e) { + print("Caught: " + e); +} + +function __f_9() { + var __v_1 = __f_16(); + var module = __v_1.instantiate(); + var __v_4 = 16385; + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + assertEquals(-1, __f_8(__v_13)); +} +try { + __f_9(); +} catch (e) { + print("Caught: " + e); +} + +function __f_12() { + var __v_1 = __f_16(); + __v_1.addMemory(1, 1, false); + var module = __v_9.instantiate(); + __v_4.__p_1905062277 = __v_4[getRandomProperty(__v_4, 1905062277)]; + __v_4.__defineGetter__(getRandomProperty(__v_4, 1764398743), function() { + gc(); + __v_0[getRandomProperty(__v_0, 1011363961)] = __v_8[getRandomProperty(__v_8, 1946768258)]; + return __v_4.__p_1905062277; + }); + var __v_4 = 16384; + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + assertEquals(-1, __f_8(__v_4)); +} +try { + __f_12(); +} catch (e) { + print("Caught: " + e); +} + +function __f_0() { + var __v_1 = __f_16(); + var module = __v_1.instantiate(); + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + assertEquals(-1, __f_8(-1)); +}; +try { + __f_0(); +} catch (e) { + print("Caught: " + e); +} + +function __f_4() { + var __v_1 = __f_16(); + __v_1.addMemory(1, 1, false); + __v_1.addFunction("memory_size", kSig_i_v) + .addBody([kExprMemorySize]) + .exportFunc(); + var module = __v_1.instantiate(); + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + + function __f_7() { + return module.exports.memory_size(); + } + assertEquals(1, __f_7()); + assertEquals(1, __f_8(1)); + assertEquals(2, __f_7()); +} +try { + __f_4(); + gc(); +} catch (e) { + print("Caught: " + e); +} + +function __f_6() { + var __v_1 = __f_16(); + __v_1.addMemory(1, 1, false); + var module = __v_1.instantiate(); + var __v_3, __v_0; + gc(); + + function __f_1() { + return module.exports.load(__v_3); + } + + function __f_2(value) { + return module.exports.store(__v_3, value); + } + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + gc(); + for (__v_3 = 0; __v_3 <= (__v_2 - 4); __v_3 += 4) { + __f_2(100000 - __v_3); + __v_3.__defineGetter__(getRandomProperty(__v_3, 764734523), function() { + gc(); + return __f_16(__v_3); + }); + assertEquals(100000 - __v_3, __f_1()); + } + assertEquals(1, __f_8(3)); + for (__v_3 = 0; __v_3 <= (__v_2 - 4); __v_3 += 4) { + assertEquals(100000 - __v_3, __f_1()); + } +} +try { + __f_6(); + gc(); +} catch (e) { + print("Caught: " + e); +} + +function __f_11() { + var __v_1 = __f_16(); + __v_1.addMemory(1, 1, false); + var module = __v_2.instantiate(); + var __v_3, __v_0; + + function __f_1() { + return module.exports.load16(__v_3); + } + + function __f_2(value) { + return module.exports.store16(__v_3, value); + } + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + for (__v_3 = 0; __v_3 <= (__v_2 - 2); __v_3 += 2) { + __f_2(65535 - __v_3); + assertEquals(65535 - __v_3, __f_1()); + } + assertEquals(1, __f_8(3)); + for (__v_3 = 0; __v_3 <= (__v_2 - 2); __v_3 += 2) { + assertEquals(65535 - __v_3, __f_1()); + } +} +try { + __f_11(); +} catch (e) { + print("Caught: " + e); +} + +function __f_15() { + var __v_1 = __f_16(); + __v_1.addMemory(1, 1, false); + var module = __v_1.instantiate(); + var __v_3, __v_0 = 0; + + function __f_1() { + return module.exports.load8(__v_10); + } + + function __f_2(value) { + return module.exports.store8(__v_3, value); + } + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + for (__v_3 = 0; __v_3 <= (__v_2 - 1); __v_3++, __v_0++) { + __f_2(__v_0); + assertEquals(__v_0, __f_1()); + if (__v_0 == 255) __v_0 = 0; + } + assertEquals(1, __f_8(3)); + __v_0 = 0; + for (__v_10 = 0; __v_4 <= (__v_0 - 1); __v_11++, __v_5++) { + assertEquals(__v_0, __f_1()); + if (__v_10 == 255) __v_5 = 0; + } +} +try { + __f_15(); +} catch (e) { + print("Caught: " + e); +} + +function __f_3() { + var __v_1 = __f_16(); + __v_1.addMemory(1, 1, false); + var module = __v_1.instantiate(); + var __v_3, __v_0; + + function __f_1() { + return module.exports.load(__v_3); + } + + function __f_2(value) { + return module.exports.store(__v_3, value); + } + + function __f_8(pages) { + return module.exports.grow_memory(pages); + } + gc(); + __v_3 = 3 * __v_2 + 4; + assertTraps(kTrapMemOutOfBounds, __f_2); + assertEquals(1, __f_8(1)); + assertTraps(kTrapMemOutOfBounds, __f_2); + assertEquals(2, __f_8(1)); + assertTraps(kTrapMemOutOfBounds, __f_2); + assertEquals(3, __f_8(1)); + for (__v_3 = 3 * __v_2; __v_3 <= 4 * __v_2 - 4; __v_3++) { + __f_2(0xaced); + assertEquals(0xaced, __f_1()); + } + for (__v_3 = 4 * __v_2 - 3; __v_3 <= 4 * __v_2 + 4; __v_3++) { + assertTraps(kTrapMemOutOfBounds, __f_2); + } +} +try { + __f_3(); +} catch (e) { + print("Caught: " + e); +} + +function __f_18(__f_17, y) { + eval(__f_17); + return y(); +} +try { + var __v_17 = __f_18("function y() { return 1; }", function() { + return 0; + }) + assertEquals(1, __v_17); + gc(); + __v_17 = + (function(__f_17) { + function __f_17() { + return 3; + } + return __f_17(); + })(function() { + return 2; + }); + assertEquals(3, __v_17); + __v_17 = + (function(__f_17) { + function __f_17() { + return 5; + } + return arguments[0](); + })(function() { + return -1073741825; + }); + assertEquals(5, __v_17); +} catch (e) { + print("Caught: " + e); +} + +function __f_27() {} +try { + var __v_24 = {}; + var __v_21 = {}; + var __v_22 = {}; + var __v_20 = {}; + __v_58 = { + instantiateModuleFromAsm: function(text, ffi, heap) { + var __v_21 = eval('(' + text + ')'); + if (__f_27()) { + throw "validate failure"; + } + var __v_20 = __v_21(); + if (__f_27()) { + throw "bad module args"; + } + } + }; + __f_21 = function __f_21() { + if (found === expected) { + if (1 / expected) return; + } else if ((expected !== expected) && (found !== found)) { + return; + }; + }; + __f_28 = function __f_28() { + if (!__f_23()) { + __f_125(__f_69(), found, name_opt); + } + }; + __f_24 = function __f_24(code, type_opt, cause_opt) { + var __v_24 = true; + try { + if (typeof code == 'function') { + code(); + } else { + eval(); + } + __v_24 = false; + } catch (e) { + if (typeof type_opt == 'function') { + __f_22(); + } + if (arguments.length >= 3) { + __f_28(); + } + return; + } + }; + __f_22 = function __f_22() { + if (obj instanceof type) { + obj.constructor; + if (typeof __v_57 == "function") {; + }; + } + }; + try { + __f_28(); + __v_82.__p_750895751 = __v_82[getRandomProperty()]; + } catch (e) { + "Caught: " + e; + } + __f_19(); + gc(); + __f_19(19, __f_24); + __f_19(); + __f_19(); + __f_24(function() { + __v_58.instantiateModuleFromAsm(__f_28.toString()).__f_20(); + }); +} catch (e) { + print("Caught: " + e); +} + +function __f_19() { + "use asm"; + + function __f_20() {} + return { + __f_20: __f_20 + }; +} +try { + __f_19(); + __f_19(); + __f_19(); +} catch (e) { + print("Caught: " + e); +} + +function __f_29() {} +try { + __f_19(); + try { + __f_19(); + gc(); + __f_25(); + } catch (e) { + "Caught: " + e; + } + __f_19(); + __f_19(); + __f_19(); +} catch (e) { + print("Caught: " + e); +} + +function __f_23() { + "use asm"; + + function __f_20() {} + return { + __f_20: __f_20 + }; +} +try { + __f_19(); + __f_19(); + __f_19(); + __f_19(); + gc(); + __f_19(); + __f_19(); + __f_19(); +} catch (e) { + print("Caught: " + e); +} + +function __f_26(stdlib) { + "use asm"; + var __v_2 = new stdlib.Int32Array(); + __v_22[4294967295] | 14 + 1 | 14; + return { + __f_20: __f_20 + }; +} + +function __f_25() { + var __v_19 = new ArrayBuffer(); + var __v_23 = new Int32Array(__v_19); + var module = __v_58.instantiateModuleFromAsm(__f_26.toString()); + __f_28(); + gc(); +} +try { + (function() {})(); + (function() {})(); + try { + (function() { + __v_23.__defineGetter__(getRandomProperty(__v_23, 580179357), function() { + gc(); + return __f_25(__v_23); + }); + var __v_23 = 0x87654321; + __v_19.__f_89(); + })(); + } catch (e) {; + } +} catch (e) { + print("Caught: " + e); +} + +function __f_30(x) { + var __v_30 = x + 1; + var __v_31 = x + 2; + if (x != 0) { + if (x > 0 & x < 100) { + return __v_30; + } + } + return 0; +} +try { + assertEquals(0, __f_30(0)); + assertEquals(0, __f_30(0)); + %OptimizeFunctionOnNextCall(__f_30); + assertEquals(3, __f_30(2)); +} catch (e) { + print("Caught: " + e); +} + +function __f_31() { + __f_32.arguments; +} + +function __f_32(x) { + __f_31(); +} + +function __f_33() { + __f_32({}); +} +try { + __f_33(); + __f_33(); + __f_33(); + %OptimizeFunctionOnNextCall(__f_33); + __f_33(); + gc(); +} catch (e) { + print("Caught: " + e); +} diff --git a/deps/v8/test/mjsunit/regress/wasm/regression-02862.js b/deps/v8/test/mjsunit/regress/wasm/regression-02862.js new file mode 100644 index 0000000000..92ed1cd6c9 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regression-02862.js @@ -0,0 +1,107 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --random-seed=1557792826 --expose-gc --invoke-weak-callbacks --omit-quit --gc-interval=469 --validate-asm + +function nop() {} +var __v_42 = {}; +var __v_49 = {}; +var __v_70 = {}; +var __v_79 = {}; +__v_58 = { + instantiateModuleFromAsm: function(text, ffi, heap) { + var __v_49 = eval('(' + text + ')'); + if (nop()) { + throw "validate failure"; + } + var __v_79 = __v_49(); + if (nop()) { + throw "bad module args"; + } + }}; +__f_140 = function __f_140() { + if (found === expected) { + if (1 / expected) return; + } else if ((expected !== expected) && (found !== found)) { return; }; +}; +__f_128 = function __f_128() { if (!__f_105()) { __f_125(__f_69(), found, name_opt); } }; +__f_136 = function __f_136(code, type_opt, cause_opt) { + var __v_42 = true; + try { + if (typeof code == 'function') { code(); } + else { eval(); } + __v_42 = false; + } catch (e) { + if (typeof type_opt == 'function') { __f_101(); } + if (arguments.length >= 3) { __f_128(); } + return; + } +}; +__f_101 = function __f_101() { if (obj instanceof type) {obj.constructor; if (typeof __v_57 == "function") {; }; } }; +try { +__f_128(); +__v_82.__p_750895751 = __v_82[getRandomProperty()]; +} catch(e) {"Caught: " + e; } +__f_119(); +gc(); +__f_119(19, __f_136); +__f_119(); +__f_119(); +__f_136(function() { + __v_58.instantiateModuleFromAsm(__f_128.toString()).__f_108(); +}); +function __f_119() { + "use asm"; + function __f_108() { + } + return {__f_108: __f_108}; +} +__f_119(); +__f_119(); +__f_119(); +function __f_95() { +} +__f_119(); +try { +__f_119(); +__f_135(); +} catch(e) {"Caught: " + e; } +__f_119(); +__f_119(); +__f_119(); +function __f_105() { + "use asm"; + function __f_108() { + } + return {__f_108: __f_108}; +} +__f_119(); +__f_119(); +__f_119(); +__f_119(); +__f_119(); +__f_119(); +__f_119(); +function __f_93(stdlib) { + "use asm"; + var __v_70 = new stdlib.Int32Array(); +__v_70[4294967295]|14 + 1 | 14; + return {__f_108: __f_108}; +} +function __f_135() { + var __v_66 = new ArrayBuffer(); + var __v_54 = new Int32Array(__v_66); + var module = __v_58.instantiateModuleFromAsm( __f_93.toString()); + __f_128(); +} +(function () { +})(); +(function () { +})(); +try { +(function() { + var __v_54 = 0x87654321; + __v_66.__f_89(); +})(); +} catch(e) {; } diff --git a/deps/v8/test/mjsunit/regress/wasm/regression-644682.js b/deps/v8/test/mjsunit/regress/wasm/regression-644682.js new file mode 100644 index 0000000000..b58c0d9b10 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regression-644682.js @@ -0,0 +1,26 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { +var builder = new WasmModuleBuilder(); +builder.addFunction("regression_644682", kSig_i_v) + .addBody([ + kExprBlock, // @1 + kExprI32Const, 0x3b, + kExprI32LoadMem, 0x00, 0x00, + kExprI32Const, 0x10, + kExprBrIf, 0x01, 0x00, // arity=1 depth0 + kExprI32Const, 0x45, + kExprI32Const, 0x3b, + kExprI64LoadMem16S, 0x00, 0x3b, + kExprBrIf, 0x01, 0x00 // arity=1 depth0 + ]) + .exportFunc(); +assertThrows(function() { builder.instantiate(); }); +})(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regression-647649.js b/deps/v8/test/mjsunit/regress/wasm/regression-647649.js new file mode 100644 index 0000000000..fc228d4b10 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regression-647649.js @@ -0,0 +1,43 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --nostress-opt --expose-gc --invoke-weak-callbacks --validate-asm +// Flags: --noalways-opt --invoke-weak-callbacks + +// This test was generated by the fuzzer. + +function getRandomProperty(v, rand) { + var properties = Object.getOwnPropertyNames(v); + var proto = Object.getPrototypeOf(v); + if (proto) {; } + if ("constructor" && v.constructor.hasOwnProperty()) {; } + if (properties.length == 0) { return "0"; } + return properties[rand % properties.length]; +} + +var __v_11 = {}; + +function __f_1(stdlib, foreign, buffer) { + "use asm"; + var __v_3 = new stdlib.Float64Array(buffer); + function __f_0() { + var __v_1 = 6.0; + __v_3[2] = __v_1 + 1.0; + } + return {__f_0: __f_0}; +} +try { + var __v_0 = new ArrayBuffer(207222809); + var module = __f_1(this, null, __v_0); +( { +})(); +} catch(e) {; } +__v_13 = '@3' +Array.prototype.__proto__ = {3: __v_13}; +Array.prototype.__proto__.__proto__ = {7: __v_11}; +__v_9 = [0, 1, , , 4, 5, , , , 9] +__v_12 = __v_9.splice(4, 1) +__v_9.__defineGetter__(getRandomProperty(__v_9, 1689439720), function() {; return __f_1(); }); + __v_9[8] +gc(); diff --git a/deps/v8/test/mjsunit/regress/wasm/regression-651961.js b/deps/v8/test/mjsunit/regress/wasm/regression-651961.js new file mode 100644 index 0000000000..abdec98358 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/wasm/regression-651961.js @@ -0,0 +1,24 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function() { + var builder = new WasmModuleBuilder(); + builder.addMemory(1, 1, false); + builder.addFunction("foo", kSig_i_v) + .addBody([ + kExprMemorySize, + kExprI32Const, 0x10, + kExprGrowMemory, + kExprI32Mul, + ]) + .exportFunc(); + var module = builder.instantiate(); + var result = module.exports.foo(); + assertEquals(1, result); +})(); diff --git a/deps/v8/test/webkit/fast/js/stack-overflow-arrity-catch.js b/deps/v8/test/mjsunit/stack-overflow-arity-catch-noinline.js index f36512adbb..a1f5d4e869 100644 --- a/deps/v8/test/webkit/fast/js/stack-overflow-arrity-catch.js +++ b/deps/v8/test/mjsunit/stack-overflow-arity-catch-noinline.js @@ -21,63 +21,67 @@ // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -description('Test that if an arrity check causes a stack overflow, the exception goes to the right catch'); +// Flags: --allow-natives-syntax + +var stackOverflowIn20ArgFn = false, gotRegexCatch = false, gotDateCatch = false; function funcWith20Args(arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11, arg12, arg13, arg14, arg15, arg16, arg17, arg18, arg19, arg20) { - debug("ERROR: Shouldn't arrive in 20 arg function!"); + assertUnreachable("shouldn't arrive in non-inlined 20 arg function after stack overflow"); } -var gotRightCatch = false, gotWrongCatch1 = false, gotWrongCatch2 = false; +// If we should run with --turbo, then make sure {funcWith20Args} does +// not get inlined. +%NeverOptimizeFunction(funcWith20Args); -function test1() +function mutual_recursion_1() { try { - test2(); + mutual_recursion_2(); } catch (err) { // Should get here because of stack overflow, - // now cause a stack overflow exception due to arrity processing + // now cause a stack overflow exception due to arity processing try { var dummy = new RegExp('a|b|c'); } catch(err) { - // (1) It is dendent on the stack size if we arrive here, in (2) or + // (1) It is dependent on the stack size if we arrive here, in (2) or // both. - gotWrongCatch1 = true; + gotRegexCatch = true; } try { funcWith20Args(1, 2, 3); } catch (err2) { - gotRightCatch = true; + stackOverflowIn20ArgFn = true; } } } -function test2() +function mutual_recursion_2() { try { var dummy = new Date(); } catch(err) { - // (2) It is dendent on the stack size if we arrive here, in (1) or + // (2) It is dependent on the stack size if we arrive here, in (1) or // both. - gotWrongCatch2 = true; + gotDateCatch = true; } try { - test1(); + mutual_recursion_1(); } catch (err) { // Should get here because of stack overflow, - // now cause a stack overflow exception due to arrity processing + // now cause a stack overflow exception due to arity processing try { funcWith20Args(1, 2, 3, 4, 5, 6); } catch (err2) { - gotRightCatch = true; + stackOverflowIn20ArgFn = true; } } } -test1(); +mutual_recursion_1(); -shouldBeTrue("gotRightCatch"); +assertTrue(stackOverflowIn20ArgFn); diff --git a/deps/v8/test/mjsunit/stack-traces-overflow.js b/deps/v8/test/mjsunit/stack-traces-overflow.js index 706f8fcef9..61153b3858 100644 --- a/deps/v8/test/mjsunit/stack-traces-overflow.js +++ b/deps/v8/test/mjsunit/stack-traces-overflow.js @@ -40,7 +40,12 @@ try { overflow(); } catch (e) { var first_frame = e.stack.split("\n")[1] - assertTrue(first_frame.indexOf("stack-traces-overflow.js:30:18") > 0); + // The overflow can happen when pushing the arguments (in interpreter) or when + // the new function execution is starting. So the stack trace could either + // point to start of the function (stack-traces-overflow.js30:18) or to the + // location of call (stack-traces-overflow.js32:3). + assertTrue((first_frame.indexOf("stack-traces-overflow.js:30:18") > 0) || + (first_frame.indexOf("stack-traces-overflow.js:32:3") > 0) ); } // Test stack trace getter and setter. diff --git a/deps/v8/test/mjsunit/substr.js b/deps/v8/test/mjsunit/substr.js index 83929362a0..ff9d777dbb 100644 --- a/deps/v8/test/mjsunit/substr.js +++ b/deps/v8/test/mjsunit/substr.js @@ -171,3 +171,57 @@ for (var i = 63; i >= 0; i--) { assertEquals("", String.prototype.substr.call(string, start, length)); assertEquals(["this", "start", "length"], log); } + +// Bounds edge cases. +{ + const str = "abc"; + const negativeHeapNumber = -1 * 2**32; + const positiveHeapNumber = 2**32; + + assertEquals("abc", str.substr(negativeHeapNumber)); + assertEquals("abc", str.substr(negativeHeapNumber, str.length)); + assertEquals("abc", str.substr(-str.length, str.length)); + assertEquals("abc", str.substr(0, str.length)); + assertEquals("bc", str.substr(-2, str.length)); + assertEquals("c", str.substr(-1, str.length)); + + assertEquals("", str.substr(str.length)); + assertEquals("", str.substr(4)); + assertEquals("", str.substr(positiveHeapNumber)); + + assertEquals("abc", str.substr(negativeHeapNumber, positiveHeapNumber)); + assertEquals("abc", str.substr(negativeHeapNumber, positiveHeapNumber)); + assertEquals("abc", str.substr(-str.length, positiveHeapNumber)); + assertEquals("abc", str.substr(0, positiveHeapNumber)); + assertEquals("bc", str.substr(-2, positiveHeapNumber)); + assertEquals("c", str.substr(-1, positiveHeapNumber)); + + assertEquals("", str.substr(str.length, positiveHeapNumber)); + assertEquals("", str.substr(4, positiveHeapNumber)); + assertEquals("", str.substr(positiveHeapNumber, positiveHeapNumber)); + + assertEquals("", str.substr(negativeHeapNumber, negativeHeapNumber)); + assertEquals("", str.substr(negativeHeapNumber, negativeHeapNumber)); + assertEquals("", str.substr(-str.length, negativeHeapNumber)); + assertEquals("", str.substr(0, negativeHeapNumber)); + assertEquals("", str.substr(-2, negativeHeapNumber)); + assertEquals("", str.substr(-1, negativeHeapNumber)); + + assertEquals("", str.substr(str.length, negativeHeapNumber)); + assertEquals("", str.substr(4, negativeHeapNumber)); + assertEquals("", str.substr(positiveHeapNumber, negativeHeapNumber)); + + assertEquals("", str.substr(negativeHeapNumber, -1)); + assertEquals("", str.substr(negativeHeapNumber, -1)); + assertEquals("", str.substr(-str.length, -1)); + assertEquals("", str.substr(0, -1)); + assertEquals("", str.substr(-2, -1)); + assertEquals("", str.substr(-1, -1)); + + assertEquals("", str.substr(str.length, -1)); + assertEquals("", str.substr(4, -1)); + assertEquals("", str.substr(positiveHeapNumber, -1)); + + assertEquals("abc", str.substr(undefined)); + assertEquals("abc", str.substr(undefined, undefined)); +} diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm-expr.js b/deps/v8/test/mjsunit/wasm/asm-wasm-expr.js new file mode 100644 index 0000000000..3b20826fe7 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/asm-wasm-expr.js @@ -0,0 +1,151 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --validate-asm --allow-natives-syntax + +var selectedTest = undefined; +//selectedTest = 16; + +function skip(a) { + return selectedTest != undefined ? a != selectedTest : false; +} + +const assign_in_stmt = [ + "if (E) =", + "if (=) E", + "if (E) E; else =", + "for (=; E; S) S", + "for (E; =; S) S", + "for (E; E; =) E", + "for (E; E; E) =", + "do { = } while(E)", + "do { S } while (=)", +]; +const assign_in_expr = [ + "i32_func(=)", + "(=) ? E : E", + "E ? (=) : E", + "E ? E : (=)", + "(=) + E", + "E + (=)", + "imul(=, E)", + "imul(E, =)", + "~(=)", + "(=) | 0", + "(=), E", + "E, (=)", + "E, E, (=)", + "E, (=), E", + "(=), E, E", +]; + +const stdlib = { + Math: Math, + Int8Array: Int8Array, + Int16Array: Int16Array, + Int32Array: Int32Array, + Uint8Array: Uint8Array, + Uint16Array: Uint16Array, + Uint32Array: Uint32Array, + Float32Array: Float32Array, + Float64Array: Float64Array, +}; + +const buffer = new ArrayBuffer(65536); + +// Template for a module. +function MODULE_TEMPLATE(stdlib, foreign, buffer) { + "use asm"; + var imul = stdlib.Math.imul; + var fround = stdlib.Math.fround; + var M = new stdlib.Int32Array(buffer); + var G = 0; + + function void_func() {} + function i32_func(a) { + a = a | 0; + return a | 0; + } + + FUNC_DECL + return {main: main}; +} + +// Template for main function. +{ + function main(i32, f32, f64) { + i32 = i32 | 0; + f32 = fround(f32); + f64 = +f64; + FUNC_BODY + } +} + +function RunAsmJsTest(asmfunc, expect) { + var asm_source = asmfunc.toString(); + var nonasm_source = asm_source.replace(new RegExp("use asm"), ""); + + print("Testing " + asmfunc.name + " (js)..."); + var js_module = eval("(" + nonasm_source + ")")(stdlib, {}, buffer); + expect(js_module); + + print("Testing " + asmfunc.name + " (asm.js)..."); + var asm_module = asmfunc(stdlib, {}, buffer); + assertTrue(%IsAsmWasmCode(asmfunc)); + expect(asm_module); +} + +var test = 0; + +function DoTheTests(expr, assign, stmt) { + // ==== Expression assignment tests ======================================== + for (let e of assign_in_expr) { + if (skip(++test)) continue; + var orig = e; + e = e.replace(/=/g, assign); + e = e.replace(/E/g, expr); + e = e.replace(/S/g, stmt); + var str = main.toString().replace("FUNC_BODY", "return (" + e + ") | 0;"); + var asm_source = MODULE_TEMPLATE.toString().replace("FUNC_DECL", str); + // TODO(titzer): a verbosity API for these kinds of tests? + // print(asm_source); + + doTest(asm_source, "(" + test + ") " + e); + } + + // ==== Statement assignment tests ========================================= + for (let e of assign_in_stmt) { + if (skip(++test)) continue; + var orig = e; + e = e.replace(/=/g, assign); + e = e.replace(/E/g, expr); + e = e.replace(/S/g, stmt); + var str = main.toString().replace("FUNC_BODY", e + "; return 0;"); + var asm_source = MODULE_TEMPLATE.toString().replace("FUNC_DECL", str); +// print(asm_source); + + doTest(asm_source, "(" + test + ") " + e); + } + + function doTest(asm_source, orig) { + var nonasm_source = asm_source.replace(new RegExp("use asm"), ""); + print("Testing JS: " + orig); + var js_module = eval("(" + nonasm_source + ")")(stdlib, {}, buffer); + expect(js_module); + + var asmfunc = eval("(" + asm_source + ")"); + + print("Testing ASMJS: " + orig); + var asm_module = asmfunc(stdlib, {}, buffer); + assertTrue(%IsAsmWasmCode(asmfunc)); + expect(asm_module); + } + + function expect(module) { module.main(0, 0, 0); print(" ok"); return true; } +} + +DoTheTests("(i32 | 0)", "i32 = 0", "void_func()"); +DoTheTests("G", "G = 0", "void_func()"); +DoTheTests("G", "G = 0", "G"); +DoTheTests("(M[0] | 0)", "M[0] = 0", "void_func()"); diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm-f32.js b/deps/v8/test/mjsunit/wasm/asm-wasm-f32.js index a5d5a6c2cc..66ef274796 100644 --- a/deps/v8/test/mjsunit/wasm/asm-wasm-f32.js +++ b/deps/v8/test/mjsunit/wasm/asm-wasm-f32.js @@ -159,6 +159,11 @@ function f32_gteq(a, b) { return 0; } +function f32_neg(a) { + a = fround(a); + return fround(-a); +} + var inputs = [ 0, 1, 2, 3, 4, @@ -211,6 +216,7 @@ var funcs = [ f32_lteq, f32_gt, f32_gteq, + f32_neg, ]; (function () { diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm-f64.js b/deps/v8/test/mjsunit/wasm/asm-wasm-f64.js index 1fd51ff9d5..c7b439fede 100644 --- a/deps/v8/test/mjsunit/wasm/asm-wasm-f64.js +++ b/deps/v8/test/mjsunit/wasm/asm-wasm-f64.js @@ -205,21 +205,25 @@ function f64_tan(a) { return +Math_tan(+a); } -function f64_exp(a, b) { +function f64_exp(a) { a = +a; - b = +b; - return +Math_exp(+a, +b); + return +Math_exp(+a); +} + +function f64_log(a) { + a = +a; + return +Math_log(+a); } -function f64_log(a, b) { +function f64_atan2(a, b) { a = +a; b = +b; - return +Math_log(+a, +b); + return +Math_atan2(+a, +b); } -function f64_atan2(a) { +function f64_neg(a) { a = +a; - return +Math_atan2(+a); + return +(-a); } @@ -272,17 +276,18 @@ var funcs = [ f64_floor, // TODO(bradnelson) f64_sqrt, f64_abs, + f64_neg, // TODO(bradnelson) f64_min is wrong for -0 // TODO(bradnelson) f64_max is wrong for -0 -// TODO(bradnelson) f64_acos, -// TODO(bradnelson) f64_asin, -// TODO(bradnelson) f64_atan, -// TODO(bradnelson) f64_cos, -// TODO(bradnelson) f64_sin, -// TODO(bradnelson) f64_tan, -// TODO(bradnelson) f64_exp, -// TODO(bradnelson) f64_log, -// TODO(bradnelson) f64_atan2, + f64_acos, + f64_asin, + f64_atan, + f64_cos, + f64_sin, + f64_tan, + f64_exp, + f64_log, + f64_atan2, ]; (function () { diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js b/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js index 29f071c84c..9d8b14afec 100644 --- a/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js +++ b/deps/v8/test/mjsunit/wasm/asm-wasm-i32.js @@ -180,6 +180,16 @@ function i32_abs(a) { return Math_abs(a | 0) | 0; } +function i32_neg(a) { + a = a | 0; + return (-a) | 0; +} + +function i32_invert(a) { + a = a | 0; + return (~a) | 0; +} + var inputs = [ 0, 1, 2, 3, 4, 10, 20, 30, 31, 32, 33, 100, 2000, @@ -226,7 +236,9 @@ var funcs = [ i32_gteq, i32_min, i32_max, - i32_abs + i32_abs, + i32_neg, + i32_invert, ]; (function () { diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js b/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js index 8276015214..0809bca6ab 100644 --- a/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js +++ b/deps/v8/test/mjsunit/wasm/asm-wasm-u32.js @@ -157,6 +157,16 @@ function u32_gteq(a, b) { return 0; } +function u32_neg(a) { + a = a | 0; + return (-a) | 0; +} + +function u32_invert(a) { + a = a | 0; + return (~a) | 0; +} + var inputs = [ 0, 1, 2, 3, 4, @@ -202,6 +212,8 @@ var funcs = [ u32_lteq, u32_gt, u32_gteq, + u32_neg, + u32_invert, // TODO(titzer): u32_min // TODO(titzer): u32_max // TODO(titzer): u32_abs diff --git a/deps/v8/test/mjsunit/wasm/asm-wasm.js b/deps/v8/test/mjsunit/wasm/asm-wasm.js index a580c5c7e9..dc8ecff7a0 100644 --- a/deps/v8/test/mjsunit/wasm/asm-wasm.js +++ b/deps/v8/test/mjsunit/wasm/asm-wasm.js @@ -988,6 +988,7 @@ function TestFunctionTable(stdlib, foreign, buffer) { return {caller:caller}; } +print("TestFunctionTable..."); var module = TestFunctionTable(stdlib); assertEquals(55, module.caller(0, 0, 33, 22)); assertEquals(11, module.caller(0, 1, 33, 22)); @@ -1040,6 +1041,7 @@ function TestForeignFunctions() { assertEquals(103, module.caller(23, 103)); } +print("TestForeignFunctions..."); TestForeignFunctions(); @@ -1581,3 +1583,89 @@ function TestLoopsWithUnsigned() { } assertWasm(323, TestLoopsWithUnsigned); + + +function TestSingleFunctionModule() { + "use asm"; + function add(a, b) { + a = a | 0; + b = b | 0; + return (a + b) | 0; + } + return add; +} + +assertEquals(7, TestSingleFunctionModule()(3, 4)); + + +function TestNotZero() { + "use asm"; + function caller() { + if (!0) { + return 44; + } else { + return 55; + } + return 0; + } + return {caller: caller}; +} + +assertWasm(44, TestNotZero); + + +function TestNotOne() { + "use asm"; + function caller() { + if (!1) { + return 44; + } else { + return 55; + } + return 0; + } + return {caller: caller}; +} + +assertWasm(55, TestNotOne); + + +function TestDotfulFloat(stdlib) { + "use asm"; + var fround = stdlib.Math.fround; + var foo = fround(55.0); + function caller() { + return +foo; + } + return {caller: caller}; +} + +assertWasm(55, TestDotfulFloat); + + +function TestDotlessFloat(stdlib) { + "use asm"; + var fround = stdlib.Math.fround; + var foo = fround(55); + function caller() { + return +foo; + } + return {caller: caller}; +} + +assertWasm(55, TestDotlessFloat); + + +function TestFloatGlobals(stdlib) { + "use asm"; + var fround = stdlib.Math.fround; + var foo = fround(1.25); + function caller() { + foo = fround(foo + fround(1.0)); + foo = fround(foo + fround(1.0)); + return +foo; + } + return {caller: caller}; +} + +assertWasm(3.25, TestFloatGlobals); diff --git a/deps/v8/test/mjsunit/wasm/calls.js b/deps/v8/test/mjsunit/wasm/calls.js index 4da0501cf2..b0feda8c80 100644 --- a/deps/v8/test/mjsunit/wasm/calls.js +++ b/deps/v8/test/mjsunit/wasm/calls.js @@ -20,13 +20,16 @@ function assertModule(module, memsize) { assertFalse(mem === null); assertFalse(mem === 0); assertEquals("object", typeof mem); - assertTrue(mem instanceof ArrayBuffer); + assertTrue(mem instanceof WebAssembly.Memory); + var buf = mem.buffer; + assertTrue(buf instanceof ArrayBuffer); + assertEquals(memsize, buf.byteLength); for (var i = 0; i < 4; i++) { module.exports.memory = 0; // should be ignored - assertEquals(mem, module.exports.memory); + mem.buffer = 0; // should be ignored + assertSame(mem, module.exports.memory); + assertSame(buf, mem.buffer); } - - assertEquals(memsize, module.exports.memory.byteLength); } function assertFunction(module, func) { diff --git a/deps/v8/test/mjsunit/wasm/compiled-module-management.js b/deps/v8/test/mjsunit/wasm/compiled-module-management.js new file mode 100644 index 0000000000..a1bd2ce3c8 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/compiled-module-management.js @@ -0,0 +1,50 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// TODO (mtrofin): re-enable ignition (v8:5345) +// Flags: --no-ignition --no-ignition-staging +// Flags: --expose-wasm --expose-gc --allow-natives-syntax + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + + +(function CompiledModuleInstancesAreGCed() { + var builder = new WasmModuleBuilder(); + + builder.addMemory(1,1, true); + builder.addImport("getValue", kSig_i); + builder.addFunction("f", kSig_i) + .addBody([ + kExprCallFunction, 0 + ]).exportFunc(); + + var module = new WebAssembly.Module(builder.toBuffer()); + %ValidateWasmModuleState(module); + %ValidateWasmInstancesChain(module, 0); + var i1 = new WebAssembly.Instance(module, {getValue: () => 1}); + %ValidateWasmInstancesChain(module, 1); + var i2 = new WebAssembly.Instance(module, {getValue: () => 2}); + %ValidateWasmInstancesChain(module, 2); + var i3 = new WebAssembly.Instance(module, {getValue: () => 3}); + %ValidateWasmInstancesChain(module, 3); + + assertEquals(1, i1.exports.f()); + i1 = null; + gc(); + %ValidateWasmInstancesChain(module, 2); + assertEquals(3, i3.exports.f()); + i3 = null; + gc(); + %ValidateWasmInstancesChain(module, 1); + assertEquals(2, i2.exports.f()); + i2 = null; + gc(); + %ValidateWasmModuleState(module); + var i4 = new WebAssembly.Instance(module, {getValue: () => 4}); + assertEquals(4, i4.exports.f()); + module = null; + gc(); + %ValidateWasmOrphanedInstance(i4); +})(); diff --git a/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js b/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js index 94cc894275..aa36b71882 100644 --- a/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js +++ b/deps/v8/test/mjsunit/wasm/compiled-module-serialization.js @@ -17,13 +17,13 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("main", kSig_i_i) .addBody([ - kExprI32Const, 1, kExprGetLocal, 0, kExprI32LoadMem, 0, 0, - kExprCallIndirect, kArity1, signature, + kExprI32Const, 1, + kExprCallIndirect, signature, kExprGetLocal,0, kExprI32LoadMem,0, 0, - kExprCallImport, kArity0, 0, + kExprCallFunction, 0, kExprI32Add ]).exportFunc(); @@ -32,8 +32,8 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); builder.addFunction("_wrap_writer", signature) .addBody([ kExprGetLocal, 0, - kExprCallImport, kArity1, 1]); - builder.appendToTable([0, 1]); + kExprCallFunction, 1]); + builder.appendToTable([2, 3]); var module = new WebAssembly.Module(builder.toBuffer()); @@ -77,4 +77,24 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); assertFalse(clone == undefined); assertFalse(clone == compiled_module); assertEquals(clone.constructor, compiled_module.constructor); -})() +})(); + +(function SerializeAfterInstantiation() { + let builder = new WasmModuleBuilder(); + builder.addFunction("main", kSig_i) + .addBody([kExprI8Const, 42]) + .exportFunc(); + + var compiled_module = new WebAssembly.Module(builder.toBuffer()); + var instance1 = new WebAssembly.Instance(compiled_module); + var instance2 = new WebAssembly.Instance(compiled_module); + var serialized = %SerializeWasmModule(compiled_module); + var clone = %DeserializeWasmModule(serialized); + + assertNotNull(clone); + assertFalse(clone == undefined); + assertFalse(clone == compiled_module); + assertEquals(clone.constructor, compiled_module.constructor); + var instance3 = new WebAssembly.Instance(clone); + assertFalse(instance3 == undefined); +})(); diff --git a/deps/v8/test/mjsunit/wasm/debug-disassembly.js b/deps/v8/test/mjsunit/wasm/debug-disassembly.js index 976098a853..ac09d4af96 100644 --- a/deps/v8/test/mjsunit/wasm/debug-disassembly.js +++ b/deps/v8/test/mjsunit/wasm/debug-disassembly.js @@ -45,10 +45,10 @@ function listener(event, exec_state, event_data, data) { assertTrue(!!line, "line number must occur in disassembly"); assertTrue(line.length > columnNr, "column number must be valid"); var expected_string; - if (name.endsWith("/0")) { + if (name.endsWith("/1")) { // Function 0 calls the imported function. - expected_string = "kExprCallImport,"; - } else if (name.endsWith("/1")) { + expected_string = "kExprCallFunction,"; + } else if (name.endsWith("/2")) { // Function 1 calls function 0. expected_string = "kExprCallFunction,"; } else { @@ -76,7 +76,7 @@ var builder = new WasmModuleBuilder(); builder.addImport("func", kSig_v_v); builder.addFunction("call_import", kSig_v_v) - .addBody([kExprCallImport, kArity0, 0]) + .addBody([kExprCallFunction, 0]) .exportFunc(); // Add a bit of unneccessary code to increase the byte offset. @@ -87,8 +87,8 @@ builder.addFunction("call_call_import", kSig_v_v) kExprI32Const, (-7 & 0x7f), kExprSetLocal, 1, kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add, kExprI64UConvertI32, kExprI64Const, 0, - kExprI64Ne, kExprIf, - kExprCallFunction, kArity0, 0, + kExprI64Ne, kExprIf, kAstStmt, + kExprCallFunction, 1, kExprEnd ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js b/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js index 3fab8c65b1..26bdf8ece8 100644 --- a/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js +++ b/deps/v8/test/mjsunit/wasm/ensure-wasm-binaries-up-to-date.js @@ -7,6 +7,27 @@ // Ensure checked in wasm binaries used by integration tests from v8 hosts // (such as chromium) are up to date. +(function print_incrementer() { + if (true) return; // remove to regenerate the module + + load('test/mjsunit/wasm/wasm-constants.js'); + load('test/mjsunit/wasm/wasm-module-builder.js'); + + var module = new WasmModuleBuilder(); + module.addFunction(undefined, kSig_i_i) + .addBody([kExprGetLocal, 0, kExprI32Const, 1, kExprI32Add]) + .exportAs("increment"); + + var buffer = module.toBuffer(true); + var view = new Uint8Array(buffer); + + print("const unsigned char module[] = {"); + for (var i = 0; i < buffer.byteLength; i++) { + print(" " + view[i] + ","); + } + print("};"); +})(); + (function ensure_incrementer() { var buff = readbuffer("test/mjsunit/wasm/incrementer.wasm"); var mod = new WebAssembly.Module(buff); diff --git a/deps/v8/test/mjsunit/wasm/exceptions.js b/deps/v8/test/mjsunit/wasm/exceptions.js new file mode 100644 index 0000000000..71bd5f18ed --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/exceptions.js @@ -0,0 +1,383 @@ +// Copyright 2015 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm --wasm-eh-prototype + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +// The following methods do not attempt to catch the exception they raise. +var test_throw = (function () { + var builder = new WasmModuleBuilder(); + + builder.addFunction("throw_param_if_not_zero", kSig_i_i) + .addBody([ + kExprGetLocal, 0, + kExprI32Const, 0, + kExprI32Ne, + kExprIf, kAstStmt, + kExprGetLocal, 0, + kExprThrow, + kExprEnd, + kExprI32Const, 1 + ]) + .exportFunc() + + builder.addFunction("throw_20", kSig_v_v) + .addBody([ + kExprI32Const, 20, + kExprThrow, + ]) + .exportFunc() + + builder.addFunction("throw_expr_with_params", kSig_v_ddi) + .addBody([ + // p2 * (p0 + min(p0, p1))|0 - 20 + kExprGetLocal, 2, + kExprGetLocal, 0, + kExprGetLocal, 0, + kExprGetLocal, 1, + kExprF64Min, + kExprF64Add, + kExprI32SConvertF64, + kExprI32Mul, + kExprI32Const, 20, + kExprI32Sub, + kExprThrow, + ]) + .exportFunc() + + return builder.instantiate(); +})(); + +// Check the test_throw exists. +assertFalse(test_throw === undefined); +assertFalse(test_throw === null); +assertFalse(test_throw === 0); +assertEquals("object", typeof test_throw.exports); +assertEquals("function", typeof test_throw.exports.throw_param_if_not_zero); +assertEquals("function", typeof test_throw.exports.throw_20); +assertEquals("function", typeof test_throw.exports.throw_expr_with_params); + +assertEquals(1, test_throw.exports.throw_param_if_not_zero(0)); +assertWasmThrows(10, function() { test_throw.exports.throw_param_if_not_zero(10) }); +assertWasmThrows(-1, function() { test_throw.exports.throw_param_if_not_zero(-1) }); +assertWasmThrows(20, test_throw.exports.throw_20); +assertWasmThrows( + -8, function() { test_throw.exports.throw_expr_with_params(1.5, 2.5, 4); }); +assertWasmThrows( + 12, function() { test_throw.exports.throw_expr_with_params(5.7, 2.5, 4); }); + +// Now that we know throwing works, we test catching the exceptions we raise. +var test_catch = (function () { + var builder = new WasmModuleBuilder(); + + // Helper function for throwing from js. It is imported by the Wasm module + // as throw_i. + function throw_value(value) { + throw value; + } + var sig_index = builder.addType(kSig_v_i); + var kJSThrowI = builder.addImport("throw_i", sig_index); + + // Helper function that throws a string. Wasm should not catch it. + function throw_string() { + throw "use wasm;"; + } + sig_index = builder.addType(kSig_v_v); + var kJSThrowString = builder.addImport("throw_string", sig_index); + + // Helper function that throws undefined. Wasm should not catch it. + function throw_undefined() { + throw undefined; + } + var kJSThrowUndefined = builder.addImport("throw_undefined", sig_index); + + // Helper function that throws an fp. Wasm should not catch it. + function throw_fp() { + throw 10.5; + } + var kJSThrowFP = builder.addImport("throw_fp", sig_index); + + // Helper function that throws a large number. Wasm should not catch it. + function throw_large() { + throw 1e+28; + } + var kJSThrowLarge = builder.addImport("throw_large", sig_index); + + // Helper function for throwing from Wasm. + var kWasmThrowFunction = + builder.addFunction("throw", kSig_v_i) + .addBody([ + kExprGetLocal, 0, + kExprThrow + ]) + .index; + + // Scenario 1: Throw and catch appear on the same function. This should + // happen in case of inlining, for example. + builder.addFunction("same_scope", kSig_i_i) + .addBody([ + kExprTry, kAstI32, + kExprGetLocal, 0, + kExprI32Const, 0, + kExprI32Ne, + kExprIf, kAstStmt, + kExprGetLocal, 0, + kExprThrow, + kExprUnreachable, + kExprEnd, + kExprI32Const, 63, + kExprCatch, 1, + kExprGetLocal, 1, + kExprEnd + ]) + .addLocals({i32_count: 1}) + .exportFunc() + .index; + + builder.addFunction("same_scope_ignore", kSig_i_i) + .addBody([ + kExprTry, kAstI32, + kExprGetLocal, 0, + kExprThrow, + kExprUnreachable, + kExprCatch, 1, + kExprGetLocal, 0, + kExprEnd, + ]) + .addLocals({i32_count: 1}) + .exportFunc(); + + builder.addFunction("same_scope_multiple", kSig_i_i) + // path = 0; + // + // try { + // try { + // try { + // if (p == 1) + // throw 1; + // path |= 2 + // } catch (v) { + // path |= v | 4; + // throw path; + // } + // if (p == 2) + // throw path|8; + // path |= 16; + // } catch (v) { + // path |= v | 32; + // throw path; + // } + // if (p == 3) + // throw path|64; + // path |= 128 + // } catch (v) { + // path |= v | 256; + // } + // + // return path; + // + // p == 1 -> path == 293 + // p == 2 -> path == 298 + // p == 3 -> path == 338 + // else -> path == 146 + .addBody([ + kExprTry, kAstI32, + kExprTry, kAstI32, + kExprTry, kAstI32, + kExprGetLocal, 0, + kExprI32Const, 1, + kExprI32Eq, + kExprIf, kAstStmt, + kExprI32Const, 1, + kExprThrow, + kExprUnreachable, + kExprEnd, + kExprI32Const, 2, + kExprCatch, 1, + kExprGetLocal, 1, + kExprI32Const, 4, + kExprI32Ior, + kExprThrow, + kExprUnreachable, + kExprEnd, + kExprTeeLocal, 2, + kExprGetLocal, 0, + kExprI32Const, 2, + kExprI32Eq, + kExprIf, kAstStmt, + kExprGetLocal, 2, + kExprI32Const, 8, + kExprI32Ior, + kExprThrow, + kExprUnreachable, + kExprEnd, + kExprI32Const, 16, + kExprI32Ior, + kExprCatch, 1, + kExprGetLocal, 1, + kExprI32Const, 32, + kExprI32Ior, + kExprThrow, + kExprUnreachable, + kExprEnd, + kExprTeeLocal, 2, + kExprGetLocal, 0, + kExprI32Const, 3, + kExprI32Eq, + kExprIf, kAstStmt, + kExprGetLocal, 2, + kExprI32Const, /*64=*/ 192, 0, + kExprI32Ior, + kExprThrow, + kExprUnreachable, + kExprEnd, + kExprI32Const, /*128=*/ 128, 1, + kExprI32Ior, + kExprCatch, 1, + kExprGetLocal, 1, + kExprI32Const, /*256=*/ 128, 2, + kExprI32Ior, + kExprEnd, + ]) + .addLocals({i32_count: 2}) + .exportFunc(); + + // Scenario 2: Catches an exception raised from the direct callee. + var kFromDirectCallee = + builder.addFunction("from_direct_callee", kSig_i_i) + .addBody([ + kExprTry, kAstI32, + kExprGetLocal, 0, + kExprCallFunction, kWasmThrowFunction, + kExprI32Const, /*-1=*/ 127, + kExprCatch, 1, + kExprGetLocal, 1, + kExprEnd + ]) + .addLocals({i32_count: 1}) + .exportFunc() + .index; + + // Scenario 3: Catches an exception raised from an indirect callee. + var kFromIndirectCalleeHelper = kFromDirectCallee + 1; + builder.addFunction("from_indirect_callee_helper", kSig_v_ii) + .addBody([ + kExprGetLocal, 0, + kExprI32Const, 0, + kExprI32GtS, + kExprIf, kAstStmt, + kExprGetLocal, 0, + kExprI32Const, 1, + kExprI32Sub, + kExprGetLocal, 1, + kExprI32Const, 1, + kExprI32Sub, + kExprCallFunction, kFromIndirectCalleeHelper, + kExprEnd, + kExprGetLocal, 1, + kExprCallFunction, kWasmThrowFunction, + ]); + + builder.addFunction("from_indirect_callee", kSig_i_i) + .addBody([ + kExprTry, kAstI32, + kExprGetLocal, 0, + kExprI32Const, 0, + kExprCallFunction, kFromIndirectCalleeHelper, + kExprI32Const, /*-1=*/ 127, + kExprCatch, 1, + kExprGetLocal, 1, + kExprEnd + ]) + .addLocals({i32_count: 1}) + .exportFunc(); + + // Scenario 4: Catches an exception raised in JS. + builder.addFunction("from_js", kSig_i_i) + .addBody([ + kExprTry, kAstI32, + kExprGetLocal, 0, + kExprCallFunction, kJSThrowI, + kExprI32Const, /*-1=*/ 127, + kExprCatch, 1, + kExprGetLocal, 1, + kExprEnd, + ]) + .addLocals({i32_count: 1}) + .exportFunc(); + + // Scenario 5: Does not catch an exception raised in JS if it is not a + // number. + builder.addFunction("string_from_js", kSig_v_v) + .addBody([ + kExprCallFunction, kJSThrowString + ]) + .exportFunc(); + + builder.addFunction("fp_from_js", kSig_v_v) + .addBody([ + kExprCallFunction, kJSThrowFP + ]) + .exportFunc(); + + builder.addFunction("large_from_js", kSig_v_v) + .addBody([ + kExprCallFunction, kJSThrowLarge + ]) + .exportFunc(); + + builder.addFunction("undefined_from_js", kSig_v_v) + .addBody([ + kExprCallFunction, kJSThrowUndefined + ]) + .exportFunc(); + + return builder.instantiate({ + throw_i: throw_value, + throw_string: throw_string, + throw_fp: throw_fp, + throw_large, throw_large, + throw_undefined: throw_undefined + }); +})(); + +// Check the test_catch exists. +assertFalse(test_catch === undefined); +assertFalse(test_catch === null); +assertFalse(test_catch === 0); +assertEquals("object", typeof test_catch.exports); +assertEquals("function", typeof test_catch.exports.same_scope); +assertEquals("function", typeof test_catch.exports.same_scope_ignore); +assertEquals("function", typeof test_catch.exports.same_scope_multiple); +assertEquals("function", typeof test_catch.exports.from_direct_callee); +assertEquals("function", typeof test_catch.exports.from_indirect_callee); +assertEquals("function", typeof test_catch.exports.from_js); +assertEquals("function", typeof test_catch.exports.string_from_js); + +assertEquals(63, test_catch.exports.same_scope(0)); +assertEquals(1024, test_catch.exports.same_scope(1024)); +assertEquals(-3, test_catch.exports.same_scope(-3)); +assertEquals(-1, test_catch.exports.same_scope_ignore(-1)); +assertEquals(1, test_catch.exports.same_scope_ignore(1)); +assertEquals(0x7FFFFFFF, test_catch.exports.same_scope_ignore(0x7FFFFFFF)); +assertEquals(1024, test_catch.exports.same_scope_ignore(1024)); +assertEquals(-1, test_catch.exports.same_scope_ignore(-1)); +assertEquals(293, test_catch.exports.same_scope_multiple(1)); +assertEquals(298, test_catch.exports.same_scope_multiple(2)); +assertEquals(338, test_catch.exports.same_scope_multiple(3)); +assertEquals(146, test_catch.exports.same_scope_multiple(0)); +assertEquals(-10024, test_catch.exports.from_direct_callee(-10024)); +assertEquals(3334333, test_catch.exports.from_direct_callee(3334333)); +assertEquals(-1, test_catch.exports.from_direct_callee(0xFFFFFFFF)); +assertEquals(0x7FFFFFFF, test_catch.exports.from_direct_callee(0x7FFFFFFF)); +assertEquals(-10, test_catch.exports.from_indirect_callee(10)); +assertEquals(-77, test_catch.exports.from_indirect_callee(77)); +assertEquals(10, test_catch.exports.from_js(10)); +assertEquals(-10, test_catch.exports.from_js(-10)); + +assertThrowsEquals(test_catch.exports.string_from_js, "use wasm;"); +assertThrowsEquals(test_catch.exports.large_from_js, 1e+28); +assertThrowsEquals(test_catch.exports.undefined_from_js, undefined); diff --git a/deps/v8/test/mjsunit/wasm/export-table.js b/deps/v8/test/mjsunit/wasm/export-table.js index 2084ddfc0a..6d21cf5790 100644 --- a/deps/v8/test/mjsunit/wasm/export-table.js +++ b/deps/v8/test/mjsunit/wasm/export-table.js @@ -15,7 +15,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .addBody([ kExprI8Const, kReturnValue, - kExprReturn, kArity1 + kExprReturn ]) .exportFunc(); @@ -36,7 +36,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .addBody([ kExprI8Const, kReturnValue, - kExprReturn, kArity1 + kExprReturn ]) .exportAs("blah") .exportAs("foo"); @@ -61,7 +61,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js"); .addBody([ kExprI8Const, kReturnValue, - kExprReturn, kArity1 + kExprReturn ]) .exportAs("0"); diff --git a/deps/v8/test/mjsunit/wasm/ffi-error.js b/deps/v8/test/mjsunit/wasm/ffi-error.js index 81dc47806e..6d4787e70a 100644 --- a/deps/v8/test/mjsunit/wasm/ffi-error.js +++ b/deps/v8/test/mjsunit/wasm/ffi-error.js @@ -16,7 +16,7 @@ function testCallFFI(ffi) { .addBody([ kExprGetLocal, 0, // -- kExprGetLocal, 1, // -- - kExprCallFunction, kArity2, 0, // -- + kExprCallFunction, 0, // -- ]) // -- .exportFunc(); @@ -78,3 +78,40 @@ assertThrows(function() { module.exports.function_with_invalid_signature(33, 88); }, TypeError); })(); + +(function I64ParamsInSignatureThrows() { + var builder = new WasmModuleBuilder(); + + builder.addMemory(1, 1, true); + builder.addFunction("function_with_invalid_signature", kSig_i_l) + .addBody([ + kExprGetLocal, 0, + kExprI32ConvertI64 + ]) + .exportFunc() + + var module = builder.instantiate(); + + 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); +})(); diff --git a/deps/v8/test/mjsunit/wasm/ffi.js b/deps/v8/test/mjsunit/wasm/ffi.js index e84f038e68..5966ec8c5e 100644 --- a/deps/v8/test/mjsunit/wasm/ffi.js +++ b/deps/v8/test/mjsunit/wasm/ffi.js @@ -16,7 +16,7 @@ function testCallFFI(func, check) { .addBody([ kExprGetLocal, 0, // -- kExprGetLocal, 1, // -- - kExprCallImport, kArity2, 0 // -- + kExprCallFunction, 0 // -- ]) // -- .exportFunc(); @@ -80,7 +80,7 @@ print("Constructor"); .addBody([ kExprGetLocal, 0, // -- kExprGetLocal, 1, // -- - kExprCallImport, kArity2, 0 // -- + kExprCallFunction, 0 // -- ]) // -- .exportFunc(); @@ -98,7 +98,7 @@ print("Native function"); builder.addImport("func", sig_index); builder.addFunction("main", sig_index) .addBody([ - kExprCallImport, kArity0, 0 // -- + kExprCallFunction, 0 // -- ]) // -- .exportFunc(); @@ -247,7 +247,7 @@ function testCallBinopVoid(type, func, check) { .addBody([ kExprGetLocal, 0, // -- kExprGetLocal, 1, // -- - kExprCallImport, kArity2, 0, // -- + kExprCallFunction, 0, // -- kExprI8Const, 99 // -- ]) // -- .exportFunc() @@ -302,11 +302,11 @@ function testCallPrint() { builder.addImport("print", makeSig_v_x(kAstF64)); builder.addFunction("main", makeSig_v_x(kAstF64)) .addBody([ - kExprI8Const, 97, // -- - kExprCallImport, kArity1, 0, // -- - kExprGetLocal, 0, // -- - kExprCallImport, kArity1, 1 // -- - ]) // -- + kExprI8Const, 97, // -- + kExprCallFunction, 0, // -- + kExprGetLocal, 0, // -- + kExprCallFunction, 1 // -- + ]) // -- .exportFunc() var main = builder.instantiate({print: print}).exports.main; diff --git a/deps/v8/test/mjsunit/wasm/frame-inspection.js b/deps/v8/test/mjsunit/wasm/frame-inspection.js index 4d342e6cae..9d45239e4a 100644 --- a/deps/v8/test/mjsunit/wasm/frame-inspection.js +++ b/deps/v8/test/mjsunit/wasm/frame-inspection.js @@ -52,11 +52,11 @@ var builder = new WasmModuleBuilder(); builder.addImport("func", kSig_v_v); builder.addFunction("wasm_1", kSig_v_v) - .addBody([kExprNop, kExprCallFunction, kArity0, 1]) + .addBody([kExprNop, kExprCallFunction, 2]) .exportAs("main"); builder.addFunction("wasm_2", kSig_v_v) - .addBody([kExprCallImport, kArity0, 0]); + .addBody([kExprCallFunction, 0]); function call_debugger() { debugger; diff --git a/deps/v8/test/mjsunit/wasm/function-names.js b/deps/v8/test/mjsunit/wasm/function-names.js index 15771d8470..94919b5e6c 100644 --- a/deps/v8/test/mjsunit/wasm/function-names.js +++ b/deps/v8/test/mjsunit/wasm/function-names.js @@ -19,11 +19,11 @@ var expected_names = ["exec_unreachable", "☠", null, for (var func_name of func_names) { last_func_index = builder.addFunction(func_name, kSig_v_v) - .addBody([kExprCallFunction, kArity0, last_func_index]).index; + .addBody([kExprCallFunction, last_func_index]).index; } builder.addFunction("main", kSig_v_v) - .addBody([kExprCallFunction, kArity0, last_func_index]) + .addBody([kExprCallFunction, last_func_index]) .exportFunc(); var module = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/wasm/gc-frame.js b/deps/v8/test/mjsunit/wasm/gc-frame.js index 9c37fe485f..9e9aa98999 100644 --- a/deps/v8/test/mjsunit/wasm/gc-frame.js +++ b/deps/v8/test/mjsunit/wasm/gc-frame.js @@ -27,7 +27,8 @@ function makeFFI(func, t) { kExprGetLocal, 7, // -- kExprGetLocal, 8, // -- kExprGetLocal, 9, // -- - kExprCallImport, 10, 0, // -- + kExprCallFunction, 0, // -- + kExprDrop, // -- kExprGetLocal, 0, // -- kExprGetLocal, 1, // -- kExprGetLocal, 2, // -- @@ -38,7 +39,7 @@ function makeFFI(func, t) { kExprGetLocal, 7, // -- kExprGetLocal, 8, // -- kExprGetLocal, 9, // -- - kExprCallImport, 10, 0 // -- + kExprCallFunction, 0, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/grow-memory.js b/deps/v8/test/mjsunit/wasm/grow-memory.js index 27aca22d1a..ecc105ee0d 100644 --- a/deps/v8/test/mjsunit/wasm/grow-memory.js +++ b/deps/v8/test/mjsunit/wasm/grow-memory.js @@ -18,12 +18,27 @@ function genGrowMemoryBuilder() { .addBody([kExprGetLocal, 0, kExprI32LoadMem, 0, 0]) .exportFunc(); builder.addFunction("store", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0]) + .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem, 0, 0, + kExprGetLocal, 1]) + .exportFunc(); + builder.addFunction("load16", kSig_i_i) + .addBody([kExprGetLocal, 0, kExprI32LoadMem16U, 0, 0]) + .exportFunc(); + builder.addFunction("store16", kSig_i_ii) + .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem16, 0, 0, + kExprGetLocal, 1]) + .exportFunc(); + builder.addFunction("load8", kSig_i_i) + .addBody([kExprGetLocal, 0, kExprI32LoadMem8U, 0, 0]) + .exportFunc(); + builder.addFunction("store8", kSig_i_ii) + .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32StoreMem8, 0, 0, + kExprGetLocal, 1]) .exportFunc(); return builder; } -function testGrowMemoryReadWrite() { +function testGrowMemoryReadWrite32() { var builder = genGrowMemoryBuilder(); builder.addMemory(1, 1, false); var module = builder.instantiate(); @@ -32,7 +47,7 @@ function testGrowMemoryReadWrite() { function poke(value) { return module.exports.store(offset, value); } function growMem(pages) { return module.exports.grow_memory(pages); } - for(offset = 0; offset <= (kPageSize - 4); offset++) { + for(offset = 0; offset <= (kPageSize - 4); offset+=4) { poke(20); assertEquals(20, peek()); } @@ -43,7 +58,7 @@ function testGrowMemoryReadWrite() { assertEquals(1, growMem(3)); - for (offset = kPageSize; offset <= 4*kPageSize -4; offset++) { + for (offset = kPageSize; offset <= 4*kPageSize -4; offset+=4) { poke(20); assertEquals(20, peek()); } @@ -54,11 +69,11 @@ function testGrowMemoryReadWrite() { assertEquals(4, growMem(15)); - for (offset = 4*kPageSize - 3; offset <= 4*kPageSize + 4; offset++) { + for (offset = 4*kPageSize - 3; offset <= 4*kPageSize + 4; offset+=4) { poke(20); assertEquals(20, peek()); } - for (offset = 19*kPageSize - 10; offset <= 19*kPageSize - 4; offset++) { + for (offset = 19*kPageSize - 10; offset <= 19*kPageSize - 4; offset+=4) { poke(20); assertEquals(20, peek()); } @@ -68,7 +83,101 @@ function testGrowMemoryReadWrite() { } } -testGrowMemoryReadWrite(); +testGrowMemoryReadWrite32(); + +function testGrowMemoryReadWrite16() { + var builder = genGrowMemoryBuilder(); + builder.addMemory(1, 1, false); + var module = builder.instantiate(); + var offset; + function peek() { return module.exports.load16(offset); } + function poke(value) { return module.exports.store16(offset, value); } + function growMem(pages) { return module.exports.grow_memory(pages); } + + for(offset = 0; offset <= (kPageSize - 2); offset+=2) { + poke(20); + assertEquals(20, peek()); + } + for (offset = kPageSize - 1; offset < kPageSize + 4; offset++) { + assertTraps(kTrapMemOutOfBounds, poke); + assertTraps(kTrapMemOutOfBounds, peek); + } + + assertEquals(1, growMem(3)); + + for (offset = kPageSize; offset <= 4*kPageSize -2; offset+=2) { + poke(20); + assertEquals(20, peek()); + } + for (offset = 4*kPageSize - 1; offset < 4*kPageSize + 4; offset++) { + assertTraps(kTrapMemOutOfBounds, poke); + assertTraps(kTrapMemOutOfBounds, peek); + } + + assertEquals(4, growMem(15)); + + for (offset = 4*kPageSize - 2; offset <= 4*kPageSize + 4; offset+=2) { + poke(20); + assertEquals(20, peek()); + } + for (offset = 19*kPageSize - 10; offset <= 19*kPageSize - 2; offset+=2) { + poke(20); + assertEquals(20, peek()); + } + for (offset = 19*kPageSize - 1; offset < 19*kPageSize + 5; offset++) { + assertTraps(kTrapMemOutOfBounds, poke); + assertTraps(kTrapMemOutOfBounds, peek); + } +} + +testGrowMemoryReadWrite16(); + +function testGrowMemoryReadWrite8() { + var builder = genGrowMemoryBuilder(); + builder.addMemory(1, 1, false); + var module = builder.instantiate(); + var offset; + function peek() { return module.exports.load8(offset); } + function poke(value) { return module.exports.store8(offset, value); } + function growMem(pages) { return module.exports.grow_memory(pages); } + + for(offset = 0; offset <= kPageSize - 1; offset++) { + poke(20); + assertEquals(20, peek()); + } + for (offset = kPageSize; offset < kPageSize + 4; offset++) { + assertTraps(kTrapMemOutOfBounds, poke); + assertTraps(kTrapMemOutOfBounds, peek); + } + + assertEquals(1, growMem(3)); + + for (offset = kPageSize; offset <= 4*kPageSize -1; offset++) { + poke(20); + assertEquals(20, peek()); + } + for (offset = 4*kPageSize; offset < 4*kPageSize + 4; offset++) { + assertTraps(kTrapMemOutOfBounds, poke); + assertTraps(kTrapMemOutOfBounds, peek); + } + + assertEquals(4, growMem(15)); + + for (offset = 4*kPageSize; offset <= 4*kPageSize + 4; offset++) { + poke(20); + assertEquals(20, peek()); + } + for (offset = 19*kPageSize - 10; offset <= 19*kPageSize - 1; offset++) { + poke(20); + assertEquals(20, peek()); + } + for (offset = 19*kPageSize; offset < 19*kPageSize + 5; offset++) { + assertTraps(kTrapMemOutOfBounds, poke); + assertTraps(kTrapMemOutOfBounds, peek); + } +} + +testGrowMemoryReadWrite8(); function testGrowMemoryZeroInitialSize() { var builder = genGrowMemoryBuilder(); @@ -117,3 +226,135 @@ function testGrowMemoryTrapMaxPages() { } testGrowMemoryTrapMaxPages(); + +function testGrowMemoryTrapsWithNonSmiInput() { + var builder = genGrowMemoryBuilder(); + var module = builder.instantiate(); + function growMem(pages) { return module.exports.grow_memory(pages); } + // The parameter of grow_memory is unsigned. Therefore -1 stands for + // UINT32_MIN, which cannot be represented as SMI. + assertEquals(-1, growMem(-1)); +}; + +testGrowMemoryTrapsWithNonSmiInput(); + +function testGrowMemoryCurrentMemory() { + var builder = genGrowMemoryBuilder(); + builder.addMemory(1, 1, false); + builder.addFunction("memory_size", kSig_i_v) + .addBody([kExprMemorySize]) + .exportFunc(); + var module = builder.instantiate(); + function growMem(pages) { return module.exports.grow_memory(pages); } + function MemSize() { return module.exports.memory_size(); } + assertEquals(1, MemSize()); + assertEquals(1, growMem(1)); + assertEquals(2, MemSize()); +} + +testGrowMemoryCurrentMemory(); + +function testGrowMemoryPreservesDataMemOp32() { + var builder = genGrowMemoryBuilder(); + builder.addMemory(1, 1, false); + var module = builder.instantiate(); + var offset, val; + function peek() { return module.exports.load(offset); } + function poke(value) { return module.exports.store(offset, value); } + function growMem(pages) { return module.exports.grow_memory(pages); } + + for(offset = 0; offset <= (kPageSize - 4); offset+=4) { + poke(100000 - offset); + assertEquals(100000 - offset, peek()); + } + + assertEquals(1, growMem(3)); + + for(offset = 0; offset <= (kPageSize - 4); offset+=4) { + assertEquals(100000 - offset, peek()); + } +} + +testGrowMemoryPreservesDataMemOp32(); + +function testGrowMemoryPreservesDataMemOp16() { + var builder = genGrowMemoryBuilder(); + builder.addMemory(1, 1, false); + var module = builder.instantiate(); + var offset, val; + function peek() { return module.exports.load16(offset); } + function poke(value) { return module.exports.store16(offset, value); } + function growMem(pages) { return module.exports.grow_memory(pages); } + + for(offset = 0; offset <= (kPageSize - 2); offset+=2) { + poke(65535 - offset); + assertEquals(65535 - offset, peek()); + } + + assertEquals(1, growMem(3)); + + for(offset = 0; offset <= (kPageSize - 2); offset+=2) { + assertEquals(65535 - offset, peek()); + } +} + +testGrowMemoryPreservesDataMemOp16(); + +function testGrowMemoryPreservesDataMemOp8() { + var builder = genGrowMemoryBuilder(); + builder.addMemory(1, 1, false); + var module = builder.instantiate(); + var offset, val = 0; + function peek() { return module.exports.load8(offset); } + function poke(value) { return module.exports.store8(offset, value); } + function growMem(pages) { return module.exports.grow_memory(pages); } + + for(offset = 0; offset <= (kPageSize - 1); offset++, val++) { + poke(val); + assertEquals(val, peek()); + if (val == 255) val = 0; + } + + assertEquals(1, growMem(3)); + + val = 0; + + for(offset = 0; offset <= (kPageSize - 1); offset++, val++) { + assertEquals(val, peek()); + if (val == 255) val = 0; + } +} + +testGrowMemoryPreservesDataMemOp8(); + +function testGrowMemoryOutOfBoundsOffset() { + var builder = genGrowMemoryBuilder(); + builder.addMemory(1, 1, false); + var module = builder.instantiate(); + var offset, val; + function peek() { return module.exports.load(offset); } + function poke(value) { return module.exports.store(offset, value); } + function growMem(pages) { return module.exports.grow_memory(pages); } + + offset = 3*kPageSize + 4; + assertTraps(kTrapMemOutOfBounds, poke); + + assertEquals(1, growMem(1)); + assertTraps(kTrapMemOutOfBounds, poke); + + assertEquals(2, growMem(1)); + assertTraps(kTrapMemOutOfBounds, poke); + + assertEquals(3, growMem(1)); + + for (offset = 3*kPageSize; offset <= 4*kPageSize - 4; offset++) { + poke(0xaced); + assertEquals(0xaced, peek()); + } + + for (offset = 4*kPageSize - 3; offset <= 4*kPageSize + 4; offset++) { + assertTraps(kTrapMemOutOfBounds, poke); + } +} + +testGrowMemoryOutOfBoundsOffset(); diff --git a/deps/v8/test/mjsunit/wasm/import-table.js b/deps/v8/test/mjsunit/wasm/import-table.js index 8680addf61..aa836d6eac 100644 --- a/deps/v8/test/mjsunit/wasm/import-table.js +++ b/deps/v8/test/mjsunit/wasm/import-table.js @@ -16,7 +16,7 @@ function testCallImport(func, check) { .addBody([ kExprGetLocal, 0, // -- kExprGetLocal, 1, // -- - kExprCallImport, 2, 0]) // -- + kExprCallFunction, 0]) // -- .exportAs("main"); var main = builder.instantiate({func: func}).exports.main; @@ -191,7 +191,7 @@ function testCallBinopVoid(type, func, check) { .addBody([ kExprGetLocal, 0, // -- kExprGetLocal, 1, // -- - kExprCallImport, 2, 0, // -- + kExprCallFunction, 0, // -- kExprI8Const, 99, // -- ]) .exportFunc("main"); @@ -246,9 +246,9 @@ function testCallPrint() { builder.addFunction("main", makeSig_r_x(kAstF64, kAstF64)) .addBody([ kExprI8Const, 97, // -- - kExprCallImport, kArity1, 0, // -- + kExprCallFunction, 0, // -- kExprGetLocal, 0, // -- - kExprCallImport, kArity1, 1 // -- + kExprCallFunction, 1 // -- ]) .exportFunc(); @@ -270,8 +270,8 @@ function testCallImport2(foo, bar, expected) { builder.addImport("bar", kSig_i); builder.addFunction("main", kSig_i) .addBody([ - kExprCallImport, kArity0, 0, // -- - kExprCallImport, kArity0, 1, // -- + kExprCallFunction, 0, // -- + kExprCallFunction, 1, // -- kExprI32Add, // -- ]) // -- .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/incrementer.wasm b/deps/v8/test/mjsunit/wasm/incrementer.wasm Binary files differindex f80f7ad597..30b51c2e1b 100644 --- a/deps/v8/test/mjsunit/wasm/incrementer.wasm +++ b/deps/v8/test/mjsunit/wasm/incrementer.wasm diff --git a/deps/v8/test/mjsunit/wasm/indirect-calls.js b/deps/v8/test/mjsunit/wasm/indirect-calls.js index 1e87c6f823..26021bb74d 100644 --- a/deps/v8/test/mjsunit/wasm/indirect-calls.js +++ b/deps/v8/test/mjsunit/wasm/indirect-calls.js @@ -14,7 +14,7 @@ var module = (function () { builder.addImport("add", sig_index); builder.addFunction("add", sig_index) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprCallImport, kArity2, 0 + kExprGetLocal, 0, kExprGetLocal, 1, kExprCallFunction, 0 ]); builder.addFunction("sub", sig_index) .addBody([ @@ -24,13 +24,13 @@ var module = (function () { ]); builder.addFunction("main", kSig_i_iii) .addBody([ - kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, - kExprCallIndirect, kArity2, sig_index + kExprGetLocal, 0, + kExprCallIndirect, sig_index ]) .exportFunc() - builder.appendToTable([0, 1, 2]); + builder.appendToTable([1, 2, 3]); return builder.instantiate({add: function(a, b) { return a + b | 0; }}); })(); @@ -47,3 +47,40 @@ assertEquals(19, module.exports.main(0, 12, 7)); assertTraps(kTrapFuncSigMismatch, "module.exports.main(2, 12, 33)"); assertTraps(kTrapFuncInvalid, "module.exports.main(3, 12, 33)"); + + +module = (function () { + var builder = new WasmModuleBuilder(); + + var sig_i_ii = builder.addType(kSig_i_ii); + var sig_i_i = builder.addType(kSig_i_i); + builder.addImport("mul", sig_i_ii); + builder.addFunction("add", sig_i_ii) + .addBody([ + kExprGetLocal, 0, // -- + kExprGetLocal, 1, // -- + kExprI32Add // -- + ]); + builder.addFunction("popcnt", sig_i_i) + .addBody([ + kExprGetLocal, 0, // -- + kExprI32Popcnt // -- + ]); + builder.addFunction("main", kSig_i_iii) + .addBody([ + kExprGetLocal, 1, + kExprGetLocal, 2, + kExprGetLocal, 0, + kExprCallIndirect, sig_i_ii + ]) + .exportFunc() + builder.appendToTable([0, 1, 2, 3]); + + return builder.instantiate({mul: function(a, b) { return a * b | 0; }}); +})(); + +assertEquals(-6, module.exports.main(0, -2, 3)); +assertEquals(99, module.exports.main(1, 22, 77)); +assertTraps(kTrapFuncSigMismatch, "module.exports.main(2, 12, 33)"); +assertTraps(kTrapFuncSigMismatch, "module.exports.main(3, 12, 33)"); +assertTraps(kTrapFuncInvalid, "module.exports.main(4, 12, 33)"); diff --git a/deps/v8/test/mjsunit/wasm/instance-gc.js b/deps/v8/test/mjsunit/wasm/instance-gc.js new file mode 100644 index 0000000000..1713f27b99 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/instance-gc.js @@ -0,0 +1,122 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm --expose-gc + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +let nogc = () => {}; + +function newModule() { + let builder = new WasmModuleBuilder(); + builder.addMemory(1, 1, true); + builder.addFunction("main", kSig_i) + .addBody([kExprI32Const, 0, kExprI32LoadMem, 0, 0]) + .exportFunc(); + + return new WebAssembly.Module(builder.toBuffer()); +} + +function newInstance(module, val) { + var instance = new WebAssembly.Instance(module); + var view = new Int32Array(instance.exports.memory.buffer); + view[0] = val; + return instance; +} + +function TestSingleLiveInstance(gc) { + let module = newModule(); + + print("TestSingleLiveInstance..."); + for (var i = 0; i < 5; i++) { + (() => { // don't leak references between iterations. + print(" [" + i + "]..."); + gc(); + var instance = newInstance(module, i + 99); + assertEquals(i + 99, instance.exports.main()); + })(); + } +} + +TestSingleLiveInstance(nogc); +TestSingleLiveInstance(gc); + +function TestMultiInstance(gc) { + let module = newModule(); + + print("TestMultiInstance..."); + // Note: compute the root instances in another function to be + // sure that {roots} really is the only set of roots to the instances. + let roots = (() => { return [ + newInstance(module, 33), + newInstance(module, 4444), + newInstance(module, 555555) + ];})(); + + (() => { // don't leak references! + print(" [0]..."); + gc(); + assertEquals(33, roots[0].exports.main()); + roots[0] = null; + })(); + + (() => { // don't leak references! + print(" [1]..."); + gc(); + assertEquals(4444, roots[1].exports.main()); + roots[1] = null; + })(); + + (() => { // don't leak references! + print(" [2]..."); + gc(); + assertEquals(555555, roots[2].exports.main()); + roots[2] = null; + })(); +} + +TestMultiInstance(nogc); +TestMultiInstance(gc); + +function TestReclaimingCompiledModule() { + let module = newModule(); + + print("TestReclaimingCompiledModule..."); + let roots = (() => { return [ + newInstance(module, 7777), + newInstance(module, 8888), + ];})(); + + (() => { // don't leak references! + print(" [0]..."); + assertEquals(7777, roots[0].exports.main()); + assertEquals(8888, roots[1].exports.main()); + roots[1] = null; + })(); + + (() => { // don't leak references! + print(" [1]..."); + gc(); + roots[1] = newInstance(module, 9999); + assertEquals(7777, roots[0].exports.main()); + assertEquals(9999, roots[1].exports.main()); + roots[0] = null; + roots[1] = null; + })(); + + (() => { // don't leak references! + print(" [2]..."); + gc(); + roots[0] = newInstance(module, 11111); + roots[1] = newInstance(module, 22222); + assertEquals(11111, roots[0].exports.main()); + assertEquals(22222, roots[1].exports.main()); + roots[0] = null; + roots[1] = null; + })(); +} + +TestReclaimingCompiledModule(nogc); +TestReclaimingCompiledModule(gc); diff --git a/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js b/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js index 92cdc14ff9..a0c11bdadd 100644 --- a/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js +++ b/deps/v8/test/mjsunit/wasm/instantiate-module-basic.js @@ -31,14 +31,17 @@ function CheckInstance(instance) { assertFalse(mem === null); assertFalse(mem === 0); assertEquals("object", typeof mem); - assertTrue(mem instanceof ArrayBuffer); - for (let i = 0; i < 4; i++) { + assertTrue(mem instanceof WebAssembly.Memory); + var buf = mem.buffer; + assertTrue(buf instanceof ArrayBuffer); + assertEquals(65536, buf.byteLength); + for (var i = 0; i < 4; i++) { instance.exports.memory = 0; // should be ignored + mem.buffer = 0; // should be ignored assertSame(mem, instance.exports.memory); + assertSame(buf, mem.buffer); } - assertEquals(65536, instance.exports.memory.byteLength); - // Check the properties of the main function. let main = instance.exports.main; assertFalse(main === undefined); @@ -59,13 +62,18 @@ CheckInstance(new WebAssembly.Instance(module)); let promise = WebAssembly.compile(buffer); promise.then(module => CheckInstance(new WebAssembly.Instance(module))); +// Check that validate works correctly for a module. +assertTrue(WebAssembly.validate(buffer)); +assertFalse(WebAssembly.validate(bytes(88, 88, 88, 88, 88, 88, 88, 88))); + // Negative tests. (function InvalidModules() { + print("InvalidModules..."); let invalid_cases = [undefined, 1, "", "a", {some:1, obj: "b"}]; let len = invalid_cases.length; for (var i = 0; i < len; ++i) { try { - let instance = new WebAssembly.Instance(1); + let instance = new WebAssembly.Instance(invalid_cases[i]); assertUnreachable("should not be able to instantiate invalid modules."); } catch (e) { assertContains("Argument 0", e.toString()); @@ -75,9 +83,10 @@ promise.then(module => CheckInstance(new WebAssembly.Instance(module))); // Compile async an invalid blob. (function InvalidBinaryAsyncCompilation() { + print("InvalidBinaryAsyncCompilation..."); let builder = new WasmModuleBuilder(); builder.addFunction("f", kSig_i_i) - .addBody([kExprCallImport, kArity0, 0]); + .addBody([kExprCallFunction, 0]); let promise = WebAssembly.compile(builder.toBuffer()); promise .then(compiled => @@ -87,6 +96,7 @@ promise.then(module => CheckInstance(new WebAssembly.Instance(module))); // Multiple instances tests. (function ManyInstances() { + print("ManyInstances..."); let compiled_module = new WebAssembly.Module(buffer); let instance_1 = new WebAssembly.Instance(compiled_module); let instance_2 = new WebAssembly.Instance(compiled_module); @@ -94,6 +104,7 @@ promise.then(module => CheckInstance(new WebAssembly.Instance(module))); })(); (function ManyInstancesAsync() { + print("ManyInstancesAsync..."); let promise = WebAssembly.compile(buffer); promise.then(compiled_module => { let instance_1 = new WebAssembly.Instance(compiled_module); @@ -103,6 +114,7 @@ promise.then(module => CheckInstance(new WebAssembly.Instance(module))); })(); (function InstancesAreIsolatedFromEachother() { + print("InstancesAreIsolatedFromEachother..."); var builder = new WasmModuleBuilder(); builder.addMemory(1,1, true); var kSig_v_i = makeSig([kAstI32], []); @@ -112,13 +124,13 @@ promise.then(module => CheckInstance(new WebAssembly.Instance(module))); builder.addFunction("main", kSig_i_i) .addBody([ - kExprI32Const, 1, kExprGetLocal, 0, kExprI32LoadMem, 0, 0, - kExprCallIndirect, kArity1, signature, + kExprI32Const, 1, + kExprCallIndirect, signature, kExprGetLocal,0, kExprI32LoadMem,0, 0, - kExprCallImport, kArity0, 0, + kExprCallFunction, 0, kExprI32Add ]).exportFunc(); @@ -127,8 +139,8 @@ promise.then(module => CheckInstance(new WebAssembly.Instance(module))); builder.addFunction("_wrap_writer", signature) .addBody([ kExprGetLocal, 0, - kExprCallImport, kArity1, 1]); - builder.appendToTable([0, 1]); + kExprCallFunction, 1]); + builder.appendToTable([2, 3]); var module = new WebAssembly.Module(builder.toBuffer()); @@ -153,3 +165,54 @@ promise.then(module => CheckInstance(new WebAssembly.Instance(module))); assertEquals(42, outval_1); assertEquals(1000, outval_2); })(); + +(function GlobalsArePrivateToTheInstance() { + print("GlobalsArePrivateToTheInstance..."); + var builder = new WasmModuleBuilder(); + builder.addGlobal(kAstI32); + builder.addFunction("read", kSig_i_v) + .addBody([ + kExprGetGlobal, 0]) + .exportFunc(); + + builder.addFunction("write", kSig_v_i) + .addBody([ + kExprGetLocal, 0, + kExprSetGlobal, 0]) + .exportFunc(); + + var module = new WebAssembly.Module(builder.toBuffer()); + var i1 = new WebAssembly.Instance(module); + var i2 = new WebAssembly.Instance(module); + i1.exports.write(1); + i2.exports.write(2); + assertEquals(1, i1.exports.read()); + assertEquals(2, i2.exports.read()); +})(); + + +(function InstanceMemoryIsIsolated() { + print("InstanceMemoryIsIsolated..."); + var builder = new WasmModuleBuilder(); + builder.addMemory(1,1, true); + + builder.addFunction("f", kSig_i) + .addBody([ + kExprI32Const, 0, + kExprI32LoadMem, 0, 0 + ]).exportFunc(); + + var mem_1 = new ArrayBuffer(65536); + var mem_2 = new ArrayBuffer(65536); + var view_1 = new Int32Array(mem_1); + var view_2 = new Int32Array(mem_2); + view_1[0] = 1; + view_2[0] = 1000; + + var module = new WebAssembly.Module(builder.toBuffer()); + var i1 = new WebAssembly.Instance(module, null, mem_1); + var i2 = new WebAssembly.Instance(module, null, mem_2); + + assertEquals(1, i1.exports.f()); + assertEquals(1000, i2.exports.f()); +})(); diff --git a/deps/v8/test/mjsunit/wasm/memory-size.js b/deps/v8/test/mjsunit/wasm/memory-size.js new file mode 100644 index 0000000000..197059eb49 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/memory-size.js @@ -0,0 +1,30 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +load("test/mjsunit/wasm/wasm-constants.js"); +load("test/mjsunit/wasm/wasm-module-builder.js"); + +(function testMemorySizeZero() { + print("testMemorySizeZero()"); + var builder = new WasmModuleBuilder(); + builder.addFunction("memory_size", kSig_i_v) + .addBody([kExprMemorySize]) + .exportFunc(); + var module = builder.instantiate(); + assertEquals(0, module.exports.memory_size()); +})(); + +(function testMemorySizeNonZero() { + print("testMemorySizeNonZero()"); + var builder = new WasmModuleBuilder(); + var size = 11; + builder.addMemory(size, size, false); + builder.addFunction("memory_size", kSig_i_v) + .addBody([kExprMemorySize]) + .exportFunc(); + var module = builder.instantiate(); + assertEquals(size, module.exports.memory_size()); +})(); diff --git a/deps/v8/test/mjsunit/wasm/memory.js b/deps/v8/test/mjsunit/wasm/memory.js new file mode 100644 index 0000000000..e86825bd27 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/memory.js @@ -0,0 +1,93 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +// Basic tests. + +var outOfUint32RangeValue = 1e12; + +function assertMemoryIsValid(memory) { + assertSame(WebAssembly.Memory.prototype, memory.__proto__); + assertSame(WebAssembly.Memory, memory.constructor); + assertTrue(memory instanceof Object); + assertTrue(memory instanceof WebAssembly.Memory); +} + +(function TestConstructor() { + assertTrue(WebAssembly.Memory instanceof Function); + assertSame(WebAssembly.Memory, WebAssembly.Memory.prototype.constructor); + assertTrue(WebAssembly.Memory.prototype.grow instanceof Function); + let desc = Object.getOwnPropertyDescriptor(WebAssembly.Memory.prototype, 'buffer'); + assertTrue(desc.get instanceof Function); + assertSame(undefined, desc.set); + + assertThrows(() => new WebAssembly.Memory(), TypeError); + assertThrows(() => new WebAssembly.Memory(1), TypeError); + assertThrows(() => new WebAssembly.Memory(""), TypeError); + + assertThrows(() => new WebAssembly.Memory({initial: -1}), RangeError); + assertThrows(() => new WebAssembly.Memory({initial: outOfUint32RangeValue}), RangeError); + + assertThrows(() => new WebAssembly.Memory({initial: 10, maximum: -1}), RangeError); + assertThrows(() => new WebAssembly.Memory({initial: 10, maximum: outOfUint32RangeValue}), RangeError); + assertThrows(() => new WebAssembly.Memory({initial: 10, maximum: 9}), RangeError); + + let memory = new WebAssembly.Memory({initial: 1}); + assertMemoryIsValid(memory); +})(); + +(function TestConstructorWithMaximum() { + let memory = new WebAssembly.Memory({initial: 1, maximum: 10}); + assertMemoryIsValid(memory); +})(); + +(function TestInitialIsUndefined() { + // New memory with initial = undefined, which means initial = 0. + let memory = new WebAssembly.Memory({initial: undefined}); + assertMemoryIsValid(memory); +})(); + +(function TestMaximumIsUndefined() { + // New memory with maximum = undefined, which means maximum = 0. + let memory = new WebAssembly.Memory({initial: 0, maximum: undefined}); + assertMemoryIsValid(memory); +})(); + +(function TestMaximumIsReadOnce() { + var a = true; + var desc = {initial: 10}; + Object.defineProperty(desc, 'maximum', {get: function() { + if (a) { + a = false; + return 16; + } + else { + // Change the return value on the second call so it throws. + return -1; + } + }}); + let memory = new WebAssembly.Memory(desc); + assertMemoryIsValid(memory); +})(); + +(function TestMaximumDoesHasProperty() { + var hasPropertyWasCalled = false; + var desc = {initial: 10}; + var proxy = new Proxy({maximum: 16}, { + has: function(target, name) { hasPropertyWasCalled = true; } + }); + Object.setPrototypeOf(desc, proxy); + let memory = new WebAssembly.Memory(desc); + assertMemoryIsValid(memory); + assertTrue(hasPropertyWasCalled); +})(); + +(function TestBuffer() { + let memory = new WebAssembly.Memory({initial: 1}); + assertTrue(memory.buffer instanceof Object); + assertTrue(memory.buffer instanceof ArrayBuffer); + assertThrows(() => {'use strict'; memory.buffer = memory.buffer}, TypeError) + assertThrows(() => ({__proto__: memory}).buffer, TypeError) +})(); diff --git a/deps/v8/test/mjsunit/wasm/module-memory.js b/deps/v8/test/mjsunit/wasm/module-memory.js index a5e5f42488..6707f08164 100644 --- a/deps/v8/test/mjsunit/wasm/module-memory.js +++ b/deps/v8/test/mjsunit/wasm/module-memory.js @@ -15,33 +15,36 @@ function genModule(memory) { builder.addMemory(1, 1, true); builder.addFunction("main", kSig_i_i) .addBody([ - // main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0; - kExprLoop, - kExprGetLocal,0, - kExprIf, - kExprGetLocal,0, - kExprI32LoadMem,0,0, - kExprIf, - kExprI8Const,255, - kExprReturn, kArity1, - kExprEnd, - kExprGetLocal,0, - kExprI8Const,4, - kExprI32Sub, - kExprSetLocal,0, - kExprBr, kArity1, 1, - kExprEnd, - kExprEnd, - kExprI8Const,0 + // main body: while(i) { if(mem[i]) return -1; i -= 4; } return 0; + // TODO(titzer): this manual bytecode has a copy of test-run-wasm.cc + /**/ kExprLoop, kAstStmt, // -- + /* */ kExprGetLocal, 0, // -- + /* */ kExprIf, kAstStmt, // -- + /* */ kExprGetLocal, 0, // -- + /* */ kExprI32LoadMem, 0, 0, // -- + /* */ kExprIf, kAstStmt, // -- + /* */ kExprI8Const, 255, // -- + /* */ kExprReturn, // -- + /* */ kExprEnd, // -- + /* */ kExprGetLocal, 0, // -- + /* */ kExprI8Const, 4, // -- + /* */ kExprI32Sub, // -- + /* */ kExprSetLocal, 0, // -- + /* */ kExprBr, 1, // -- + /* */ kExprEnd, // -- + /* */ kExprEnd, // -- + /**/ kExprI8Const, 0 // -- ]) .exportFunc(); - - return builder.instantiate(null, memory); + var module = builder.instantiate(null, memory); + assertTrue(module.exports.memory instanceof WebAssembly.Memory); + if (memory != null) assertEquals(memory, module.exports.memory.buffer); + return module; } function testPokeMemory() { var module = genModule(null); - var buffer = module.exports.memory; + var buffer = module.exports.memory.buffer; var main = module.exports.main; assertEquals(kMemSize, buffer.byteLength); @@ -66,9 +69,13 @@ function testPokeMemory() { testPokeMemory(); +function genAndGetMain(buffer) { + return genModule(buffer).exports.main; // to prevent intermediates living +} + function testSurvivalAcrossGc() { - var checker = genModule(null).exports.main; - for (var i = 0; i < 5; i++) { + var checker = genAndGetMain(null); + for (var i = 0; i < 3; i++) { print("gc run ", i); assertEquals(0, checker(kMemSize - 4)); gc(); @@ -110,8 +117,8 @@ testPokeOuterMemory(); function testOuterMemorySurvivalAcrossGc() { var buffer = new ArrayBuffer(kMemSize); - var checker = genModule(buffer).exports.main; - for (var i = 0; i < 5; i++) { + var checker = genAndGetMain(buffer); + for (var i = 0; i < 3; i++) { print("gc run ", i); assertEquals(0, checker(kMemSize - 4)); gc(); @@ -133,7 +140,9 @@ function testOOBThrows() { kExprGetLocal, 0, kExprGetLocal, 1, kExprI32LoadMem, 0, 0, - kExprI32StoreMem, 0, 0 + kExprI32StoreMem, 0, 0, + kExprGetLocal, 1, + kExprI32LoadMem, 0, 0, ]) .exportFunc(); diff --git a/deps/v8/test/mjsunit/wasm/parallel_compilation.js b/deps/v8/test/mjsunit/wasm/parallel_compilation.js index 23c5658dcd..208232cfd4 100644 --- a/deps/v8/test/mjsunit/wasm/parallel_compilation.js +++ b/deps/v8/test/mjsunit/wasm/parallel_compilation.js @@ -20,13 +20,16 @@ function assertModule(module, memsize) { assertFalse(mem === null); assertFalse(mem === 0); assertEquals("object", typeof mem); - assertTrue(mem instanceof ArrayBuffer); + assertTrue(mem instanceof WebAssembly.Memory); + var buf = mem.buffer; + assertTrue(buf instanceof ArrayBuffer); + assertEquals(memsize, buf.byteLength); for (var i = 0; i < 4; i++) { module.exports.memory = 0; // should be ignored - assertEquals(mem, module.exports.memory); + mem.buffer = 0; // should be ignored + assertSame(mem, module.exports.memory); + assertSame(buf, mem.buffer); } - - assertEquals(memsize, module.exports.memory.byteLength); } function assertFunction(module, func) { @@ -84,7 +87,7 @@ function assertFunction(module, func) { .addBody([ // -- kExprGetLocal, 0, // -- kExprGetLocal, 1, // -- - kExprCallFunction, kArity2, f[i >>> 1].index]) // -- + kExprCallFunction, f[i >>> 1].index]) // -- .exportFunc() } var module = builder.instantiate(); diff --git a/deps/v8/test/mjsunit/wasm/receiver.js b/deps/v8/test/mjsunit/wasm/receiver.js index c0070f8b91..97a6d94c9b 100644 --- a/deps/v8/test/mjsunit/wasm/receiver.js +++ b/deps/v8/test/mjsunit/wasm/receiver.js @@ -16,7 +16,7 @@ function testCallImport(func, expected, a, b) { .addBody([ kExprGetLocal, 0, // -- kExprGetLocal, 1, // -- - kExprCallImport, 2, 0]) // -- + kExprCallFunction, 0]) // -- .exportAs("main"); var main = builder.instantiate({func: func}).exports.main; diff --git a/deps/v8/test/mjsunit/wasm/stack.js b/deps/v8/test/mjsunit/wasm/stack.js index 0197b77caf..71038507db 100644 --- a/deps/v8/test/mjsunit/wasm/stack.js +++ b/deps/v8/test/mjsunit/wasm/stack.js @@ -45,7 +45,7 @@ var builder = new WasmModuleBuilder(); builder.addImport("func", kSig_v_v); builder.addFunction("main", kSig_v_v) - .addBody([kExprCallImport, kArity0, 0]) + .addBody([kExprCallFunction, 0]) .exportAs("main"); builder.addFunction("exec_unreachable", kSig_v_v) @@ -53,14 +53,14 @@ builder.addFunction("exec_unreachable", kSig_v_v) .exportAs("exec_unreachable"); // Make this function unnamed, just to test also this case. -var mem_oob_func = builder.addFunction(undefined, kSig_v_v) +var mem_oob_func = builder.addFunction(undefined, kSig_i_v) // Access the memory at offset -1, to provoke a trap. .addBody([kExprI32Const, 0x7f, kExprI32LoadMem8S, 0, 0]) .exportAs("mem_out_of_bounds"); // Call the mem_out_of_bounds function, in order to have two WASM stack frames. -builder.addFunction("call_mem_out_of_bounds", kSig_v_v) - .addBody([kExprCallFunction, kArity0, mem_oob_func.index]) +builder.addFunction("call_mem_out_of_bounds", kSig_i_v) + .addBody([kExprCallFunction, mem_oob_func.index]) .exportAs("call_mem_out_of_bounds"); var module = builder.instantiate({func: STACK}); @@ -69,7 +69,7 @@ var module = builder.instantiate({func: STACK}); var expected_string = "Error\n" + // The line numbers below will change as this test gains / loses lines.. " at STACK (stack.js:39:11)\n" + // -- - " at main (<WASM>[0]+1)\n" + // -- + " at main (<WASM>[1]+1)\n" + // -- " at testSimpleStack (stack.js:76:18)\n" + // -- " at stack.js:78:3"; // -- @@ -89,7 +89,7 @@ Error.prepareStackTrace = function(error, frames) { verifyStack(stack, [ // isWasm function line pos file [ false, "STACK", 39, 0, "stack.js"], - [ true, "main", 0, 1, null], + [ true, "main", 1, 1, null], [ false, "testStackFrames", 87, 0, "stack.js"], [ false, null, 96, 0, "stack.js"] ]); @@ -103,7 +103,7 @@ Error.prepareStackTrace = function(error, frames) { assertContains("unreachable", e.message); verifyStack(e.stack, [ // isWasm function line pos file - [ true, "exec_unreachable", 1, 1, null], + [ true, "exec_unreachable", 2, 1, null], [ false, "testWasmUnreachable", 100, 0, "stack.js"], [ false, null, 111, 0, "stack.js"] ]); @@ -118,8 +118,8 @@ Error.prepareStackTrace = function(error, frames) { assertContains("out of bounds", e.message); verifyStack(e.stack, [ // isWasm function line pos file - [ true, "", 2, 3, null], - [ true, "call_mem_out_of_bounds", 3, 1, null], + [ true, "", 3, 3, null], + [ true, "call_mem_out_of_bounds", 4, 1, null], [ false, "testWasmMemOutOfBounds", 115, 0, "stack.js"], [ false, null, 127, 0, "stack.js"] ]); @@ -135,7 +135,7 @@ Error.prepareStackTrace = function(error, frames) { builder.addFunction("recursion", sig_index) .addBody([ kExprI32Const, 0, - kExprCallIndirect, kArity0, sig_index + kExprCallIndirect, sig_index ]) .exportFunc() builder.appendToTable([0]); diff --git a/deps/v8/test/mjsunit/wasm/stackwalk.js b/deps/v8/test/mjsunit/wasm/stackwalk.js index 913269fdf4..cd560ec62b 100644 --- a/deps/v8/test/mjsunit/wasm/stackwalk.js +++ b/deps/v8/test/mjsunit/wasm/stackwalk.js @@ -16,7 +16,7 @@ function makeFFI(func) { .addBody([ kExprGetLocal, 0, // -- kExprGetLocal, 1, // -- - kExprCallImport, kArity2, 0, // -- + kExprCallFunction, 0, // -- ]) .exportFunc() diff --git a/deps/v8/test/mjsunit/wasm/start-function.js b/deps/v8/test/mjsunit/wasm/start-function.js index c4d299e871..f0fbd081ac 100644 --- a/deps/v8/test/mjsunit/wasm/start-function.js +++ b/deps/v8/test/mjsunit/wasm/start-function.js @@ -65,8 +65,8 @@ assertFails(kSig_i_dd, [kExprGetLocal, 0]); var func = builder.addFunction("", kSig_v_v) .addBody([kExprNop]); - builder.addExplicitSection([kDeclStart, 0]); - builder.addExplicitSection([kDeclStart, 0]); + builder.addExplicitSection([kStartSectionCode, 0]); + builder.addExplicitSection([kStartSectionCode, 0]); assertThrows(builder.instantiate); })(); @@ -84,7 +84,7 @@ assertFails(kSig_i_dd, [kExprGetLocal, 0]); builder.addStart(func.index); var module = builder.instantiate(); - var memory = module.exports.memory; + var memory = module.exports.memory.buffer; var view = new Int8Array(memory); assertEquals(77, view[0]); })(); @@ -102,7 +102,7 @@ assertFails(kSig_i_dd, [kExprGetLocal, 0]); builder.addImport("foo", sig_index); var func = builder.addFunction("", sig_index) - .addBody([kExprCallImport, kArity0, 0]); + .addBody([kExprCallFunction, 0]); builder.addStart(func.index); diff --git a/deps/v8/test/mjsunit/wasm/table.js b/deps/v8/test/mjsunit/wasm/table.js new file mode 100644 index 0000000000..0275bc0522 --- /dev/null +++ b/deps/v8/test/mjsunit/wasm/table.js @@ -0,0 +1,95 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --expose-wasm + +// Basic tests. + +var outOfUint32RangeValue = 1e12; +var int32ButOob = 1073741824; + +function assertTableIsValid(table) { + assertSame(WebAssembly.Table.prototype, table.__proto__); + assertSame(WebAssembly.Table, table.constructor); + assertTrue(table instanceof Object); + assertTrue(table instanceof WebAssembly.Table); +} + +(function TestConstructor() { + assertTrue(WebAssembly.Table instanceof Function); + assertSame(WebAssembly.Table, WebAssembly.Table.prototype.constructor); + assertTrue(WebAssembly.Table.prototype.grow instanceof Function); + assertTrue(WebAssembly.Table.prototype.get instanceof Function); + assertTrue(WebAssembly.Table.prototype.set instanceof Function); + let desc = Object.getOwnPropertyDescriptor(WebAssembly.Table.prototype, 'length'); + assertTrue(desc.get instanceof Function); + assertSame(undefined, desc.set); + + assertThrows(() => new WebAssembly.Table(), TypeError); + assertThrows(() => new WebAssembly.Table(1), TypeError); + assertThrows(() => new WebAssembly.Table(""), TypeError); + + assertThrows(() => new WebAssembly.Table({}), TypeError); + assertThrows(() => new WebAssembly.Table({initial: 10}), TypeError); + + assertThrows(() => new WebAssembly.Table({element: 0, initial: 10}), TypeError); + assertThrows(() => new WebAssembly.Table({element: "any", initial: 10}), TypeError); + + assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: -1}), RangeError); + assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: outOfUint32RangeValue}), RangeError); + + assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: 10, maximum: -1}), RangeError); + assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: 10, maximum: outOfUint32RangeValue}), RangeError); + assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: 10, maximum: 9}), RangeError); + + assertThrows(() => new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: int32ButOob})); + + let table = new WebAssembly.Table({element: "anyfunc", initial: 1}); + assertTableIsValid(table); +})(); + +(function TestConstructorWithMaximum() { + let table = new WebAssembly.Table({element: "anyfunc", maximum: 10}); + assertTableIsValid(table); +})(); + +(function TestInitialIsUndefined() { + // New memory with initial = undefined, which means initial = 0. + let table = new WebAssembly.Table({element: "anyfunc", initial: undefined}); + assertTableIsValid(table); +})(); + +(function TestMaximumIsUndefined() { + // New memory with maximum = undefined, which means maximum = 0. + let table = new WebAssembly.Table({element: "anyfunc", initial: 0, maximum: undefined}); + assertTableIsValid(table); +})(); + +(function TestMaximumIsReadOnce() { + var a = true; + var desc = {element: "anyfunc", initial: 10}; + Object.defineProperty(desc, 'maximum', {get: function() { + if (a) { + a = false; + return 16; + } + else { + // Change the return value on the second call so it throws. + return -1; + } + }}); + let table = new WebAssembly.Table(desc); + assertTableIsValid(table); +})(); + +(function TestMaximumDoesHasProperty() { + var hasPropertyWasCalled = false; + var desc = {element: "anyfunc", initial: 10}; + var proxy = new Proxy({maximum: 16}, { + has: function(target, name) { hasPropertyWasCalled = true; } + }); + Object.setPrototypeOf(desc, proxy); + let table = new WebAssembly.Table(desc); + assertTableIsValid(table); +})(); diff --git a/deps/v8/test/mjsunit/wasm/test-import-export-wrapper.js b/deps/v8/test/mjsunit/wasm/test-import-export-wrapper.js index e180611818..df03aec9f5 100644 --- a/deps/v8/test/mjsunit/wasm/test-import-export-wrapper.js +++ b/deps/v8/test/mjsunit/wasm/test-import-export-wrapper.js @@ -26,8 +26,8 @@ var expect_no_elison = 1; .addFunction("second_export", sig_index) .addBody([ kExprGetLocal, 0, - kExprCallImport, kArity1, 0, - kExprReturn, kArity1 + kExprCallFunction, 0, + kExprReturn ]) .exportFunc(); @@ -39,8 +39,8 @@ var expect_no_elison = 1; .addFunction("first_export", sig_index) .addBody([ kExprGetLocal, 0, - kExprCallFunction, kArity1, 1, - kExprReturn, kArity1 + kExprCallFunction, 2, + kExprReturn ]) .exportFunc(); first_module @@ -49,8 +49,8 @@ var expect_no_elison = 1; kExprI32Const, 1, kExprGetLocal, 0, kExprI32Add, - kExprCallImport, kArity1, 0, - kExprReturn, kArity1 + kExprCallFunction, 0, + kExprReturn ]); var f = second_module @@ -83,8 +83,8 @@ var expect_no_elison = 1; .addFunction("second_export", sig_index_1) .addBody([ kExprGetLocal, 0, - kExprCallImport, kArity1, 0, - kExprReturn, kArity1 + kExprCallFunction, 0, + kExprReturn ]) .exportFunc(); @@ -97,8 +97,8 @@ var expect_no_elison = 1; .addBody([ kExprGetLocal, 0, kExprGetLocal, 1, - kExprCallFunction, kArity2, 1, - kExprReturn, kArity1 + kExprCallFunction, 2, + kExprReturn ]) .exportFunc(); first_module @@ -106,8 +106,8 @@ var expect_no_elison = 1; .addBody([ kExprGetLocal, 0, kExprGetLocal, 1, - kExprCallImport, kArity2, 0, - kExprReturn, kArity1 + kExprCallFunction, 0, + kExprReturn ]); var f = second_module @@ -142,8 +142,8 @@ var expect_no_elison = 1; kExprGetLocal, 0, kExprGetLocal, 1, kExprGetLocal, 2, - kExprCallImport, kArity3, 0, - kExprReturn, kArity1 + kExprCallFunction, 0, + kExprReturn ]) .exportFunc(); @@ -156,8 +156,8 @@ var expect_no_elison = 1; .addBody([ kExprGetLocal, 0, kExprGetLocal, 1, - kExprCallFunction, kArity2, 1, - kExprReturn, kArity1 + kExprCallFunction, 2, + kExprReturn ]) .exportFunc(); first_module @@ -165,8 +165,8 @@ var expect_no_elison = 1; .addBody([ kExprGetLocal, 0, kExprGetLocal, 1, - kExprCallImport, kArity2, 0, - kExprReturn, kArity1 + kExprCallFunction, 0, + kExprReturn ]); var f = second_module @@ -200,8 +200,8 @@ var expect_no_elison = 1; .addBody([ kExprGetLocal, 0, kExprGetLocal, 1, - kExprCallImport, kArity2, 0, - kExprReturn, kArity1 + kExprCallFunction, 0, + kExprReturn ]) .exportFunc(); @@ -214,8 +214,8 @@ var expect_no_elison = 1; .addBody([ kExprGetLocal, 0, kExprGetLocal, 1, - kExprCallFunction, kArity2, 1, - kExprReturn, kArity1 + kExprCallFunction, 2, + kExprReturn ]) .exportFunc(); first_module @@ -223,8 +223,8 @@ var expect_no_elison = 1; .addBody([ kExprGetLocal, 0, kExprGetLocal, 1, - kExprCallImport, kArity2, 0, - kExprReturn, kArity1 + kExprCallFunction, 0, + kExprReturn ]); var f = second_module diff --git a/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js b/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js index 72d5a7aaa4..b1a2309770 100644 --- a/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js +++ b/deps/v8/test/mjsunit/wasm/test-wasm-module-builder.js @@ -7,7 +7,7 @@ load('test/mjsunit/wasm/wasm-constants.js'); load('test/mjsunit/wasm/wasm-module-builder.js'); -var debug = false; +var debug = true; (function BasicTest() { var module = new WasmModuleBuilder(); @@ -25,7 +25,7 @@ var debug = false; var module = new WasmModuleBuilder(); var index = module.addImport("print", makeSig_v_x(kAstI32)); module.addFunction("foo", kSig_v_v) - .addBody([kExprI8Const, 13, kExprCallImport, kArity1, index]) + .addBody([kExprI8Const, 13, kExprCallFunction, index]) .exportAs("main"); var buffer = module.toBuffer(debug); @@ -38,7 +38,7 @@ var debug = false; var module = new WasmModuleBuilder(); module.addFunction(undefined, kSig_i_i) .addLocals({i32_count: 1}) - .addBody([kExprGetLocal, 0, kExprSetLocal, 1]) + .addBody([kExprGetLocal, 0, kExprSetLocal, 1, kExprGetLocal, 1]) .exportAs("main"); var buffer = module.toBuffer(debug); @@ -60,7 +60,7 @@ var debug = false; var module = new WasmModuleBuilder(); module.addFunction(undefined, makeSig_r_x(p.type, p.type)) .addLocals(p.locals) - .addBody([kExprGetLocal, 0, kExprSetLocal, 1]) + .addBody([kExprGetLocal, 0, kExprSetLocal, 1, kExprGetLocal, 1]) .exportAs("main"); var buffer = module.toBuffer(debug); @@ -75,7 +75,7 @@ var debug = false; module.addFunction("add", kSig_i_ii) .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]); module.addFunction("main", kSig_i_ii) - .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprCallFunction, kArity2, 0]) + .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprCallFunction, 0]) .exportAs("main"); var instance = module.instantiate(); @@ -89,7 +89,7 @@ var debug = false; .addBody([kExprGetLocal, 0, kExprGetLocal, 1, kExprI32Add]); module.addFunction("main", kSig_i_iii) .addBody([kExprGetLocal, - 0, kExprGetLocal, 1, kExprGetLocal, 2, kExprCallIndirect, kArity2, 0]) + 1, kExprGetLocal, 2, kExprGetLocal, 0, kExprCallIndirect, 0]) .exportAs("main"); module.appendToTable([0]); @@ -143,7 +143,7 @@ var debug = false; var module = new WasmModuleBuilder(); var index = module.addImportWithModule("mod", "print", makeSig_v_x(kAstI32)); module.addFunction("foo", kSig_v_v) - .addBody([kExprI8Const, 19, kExprCallImport, kArity1, index]) + .addBody([kExprI8Const, 19, kExprCallFunction, index]) .exportAs("main"); var buffer = module.toBuffer(debug); diff --git a/deps/v8/test/mjsunit/wasm/trap-location.js b/deps/v8/test/mjsunit/wasm/trap-location.js index 0440af9ccc..bc8214f9b2 100644 --- a/deps/v8/test/mjsunit/wasm/trap-location.js +++ b/deps/v8/test/mjsunit/wasm/trap-location.js @@ -30,29 +30,29 @@ var sig_index = builder.addType(kSig_i_v) builder.addFunction("main", kSig_i_i) .addBody([ // offset 1 - kExprBlock, + kExprBlock, kAstI32, kExprGetLocal, 0, kExprI32Const, 2, kExprI32LtU, - kExprIf, - // offset 8 + kExprIf, kAstStmt, + // offset 9 kExprI32Const, 0x7e /* -2 */, kExprGetLocal, 0, kExprI32DivU, - // offset 13 + // offset 15 kExprI32LoadMem, 0, 0, - kExprBr, 1, 1, + kExprBr, 1, kExprEnd, - // offset 20 + // offset 21 kExprGetLocal, 0, kExprI32Const, 2, kExprI32Eq, - kExprIf, + kExprIf, kAstStmt, kExprUnreachable, kExprEnd, - // offset 28 - kExprGetLocal, 0, - kExprCallIndirect, kArity0, sig_index, + // offset 30 + kExprGetLocal, 0, + kExprCallIndirect, sig_index, kExprEnd, ]) .exportAs("main"); @@ -72,7 +72,7 @@ function testWasmTrap(value, reason, position) { } // The actual tests: -testWasmTrap(0, kTrapDivByZero, 12); -testWasmTrap(1, kTrapMemOutOfBounds, 13); -testWasmTrap(2, kTrapUnreachable, 26); -testWasmTrap(3, kTrapFuncInvalid, 30); +testWasmTrap(0, kTrapDivByZero, 14); +testWasmTrap(1, kTrapMemOutOfBounds, 15); +testWasmTrap(2, kTrapUnreachable, 28); +testWasmTrap(3, kTrapFuncInvalid, 32); diff --git a/deps/v8/test/mjsunit/wasm/unicode-validation.js b/deps/v8/test/mjsunit/wasm/unicode-validation.js index b2e4603087..29d1f73d94 100644 --- a/deps/v8/test/mjsunit/wasm/unicode-validation.js +++ b/deps/v8/test/mjsunit/wasm/unicode-validation.js @@ -49,7 +49,7 @@ function checkImportsAndExports(imported_module_name, imported_function_name, kSig_v_v); builder.addFunction(internal_function_name, kSig_v_v) - .addBody([kExprCallImport, kArity0, 0]) + .addBody([kExprCallFunction, 0]) .exportAs(exported_function_name); // sanity check: does javascript agree with out shouldThrow annotation? @@ -79,6 +79,7 @@ function checkImportsAndExports(imported_module_name, imported_function_name, } catch (err) { if (!shouldThrow) print(err); assertTrue(shouldThrow, "Should not throw error on valid names"); + assertTrue(err instanceof Error, "exception should be an Error"); assertContains("UTF-8", err.toString()); } assertEquals(shouldThrow, hasThrown, diff --git a/deps/v8/test/mjsunit/wasm/verify-function-simple.js b/deps/v8/test/mjsunit/wasm/verify-function-simple.js index 31c23a6b69..1ac25143d7 100644 --- a/deps/v8/test/mjsunit/wasm/verify-function-simple.js +++ b/deps/v8/test/mjsunit/wasm/verify-function-simple.js @@ -25,7 +25,7 @@ try { var data = bytes( kWasmFunctionTypeForm, 0, 1, kAstI32, // signature kDeclNoLocals, // -- - kExprBlock, kExprNop, kExprNop, kExprEnd // body + kExprBlock, kAstStmt, kExprNop, kExprNop, kExprEnd // body ); Wasm.verifyFunction(data); diff --git a/deps/v8/test/mjsunit/wasm/wasm-constants.js b/deps/v8/test/mjsunit/wasm/wasm-constants.js index 04ac0c9592..388e5f5015 100644 --- a/deps/v8/test/mjsunit/wasm/wasm-constants.js +++ b/deps/v8/test/mjsunit/wasm/wasm-constants.js @@ -21,7 +21,7 @@ var kWasmH1 = 0x61; var kWasmH2 = 0x73; var kWasmH3 = 0x6d; -var kWasmV0 = 11; +var kWasmV0 = 0xC; var kWasmV1 = 0; var kWasmV2 = 0; var kWasmV3 = 0; @@ -51,30 +51,24 @@ function bytesWithHeader() { var kDeclNoLocals = 0; // Section declaration constants -var kDeclMemory = 0x00; -var kDeclTypes = 0x01; -var kDeclFunctions = 0x02; -var kDeclGlobals = 0x03; -var kDeclData = 0x04; -var kDeclTable = 0x05; -var kDeclEnd = 0x06; -var kDeclStart = 0x07; -var kDeclImports = 0x08; -var kDeclExports = 0x09; -var kDeclFunctions = 0x0a; -var kDeclCode = 0x0b; -var kDeclNames = 0x0c; +var kUnknownSectionCode = 0; +var kTypeSectionCode = 1; // Function signature declarations +var kImportSectionCode = 2; // Import declarations +var kFunctionSectionCode = 3; // Function declarations +var kTableSectionCode = 4; // Indirect function table and other tables +var kMemorySectionCode = 5; // Memory attributes +var kGlobalSectionCode = 6; // Global declarations +var kExportSectionCode = 7; // Exports +var kStartSectionCode = 8; // Start function declaration +var kElementSectionCode = 9; // Elements section +var kCodeSectionCode = 10; // Function code +var kDataSectionCode = 11; // Data segments +var kNameSectionCode = 12; // Name section (encoded as string) -var kArity0 = 0; -var kArity1 = 1; -var kArity2 = 2; -var kArity3 = 3; var kWasmFunctionTypeForm = 0x40; +var kWasmAnyFunctionTypeForm = 0x20; -var section_names = [ - "memory", "type", "old_function", "global", "data", - "table", "end", "start", "import", "export", - "function", "code", "name"]; +var kResizableMaximumFlag = 1; // Function declaration flags var kDeclFunctionName = 0x01; @@ -89,10 +83,16 @@ var kAstI64 = 2; var kAstF32 = 3; var kAstF64 = 4; +var kExternalFunction = 0; +var kExternalTable = 1; +var kExternalMemory = 2; +var kExternalGlobal = 3; + // Useful signatures var kSig_i = makeSig([], [kAstI32]); var kSig_d = makeSig([], [kAstF64]); var kSig_i_i = makeSig([kAstI32], [kAstI32]); +var kSig_i_l = makeSig([kAstI64], [kAstI32]); var kSig_i_ii = makeSig([kAstI32, kAstI32], [kAstI32]); var kSig_i_iii = makeSig([kAstI32, kAstI32, kAstI32], [kAstI32]); var kSig_d_dd = makeSig([kAstF64, kAstF64], [kAstF64]); @@ -105,6 +105,7 @@ var kSig_v_ii = makeSig([kAstI32, kAstI32], []); var kSig_v_iii = makeSig([kAstI32, kAstI32, kAstI32], []); var kSig_v_d = makeSig([kAstF64], []); var kSig_v_dd = makeSig([kAstF64, kAstF64], []); +var kSig_v_ddi = makeSig([kAstF64, kAstF64, kAstI32], []); function makeSig(params, results) { return {params: params, results: results}; @@ -131,7 +132,8 @@ function makeSig_r_xx(r, x) { } // Opcodes -var kExprNop = 0x00; +var kExprUnreachable = 0x00; +var kExprNop = 0x0a; var kExprBlock = 0x01; var kExprLoop = 0x02; var kExprIf = 0x03; @@ -141,8 +143,12 @@ var kExprBr = 0x06; var kExprBrIf = 0x07; var kExprBrTable = 0x08; var kExprReturn = 0x09; -var kExprUnreachable = 0x0a; +var kExprThrow = 0xfa; +var kExprTry = 0xfb; +var kExprCatch = 0xfe; var kExprEnd = 0x0f; +var kExprTeeLocal = 0x19; +var kExprDrop = 0x0b; var kExprI32Const = 0x10; var kExprI64Const = 0x11; @@ -152,7 +158,6 @@ var kExprGetLocal = 0x14; var kExprSetLocal = 0x15; var kExprCallFunction = 0x16; var kExprCallIndirect = 0x17; -var kExprCallImport = 0x18; var kExprI8Const = 0xcb; var kExprGetGlobal = 0xbb; var kExprSetGlobal = 0xbc; @@ -347,3 +352,20 @@ function assertTraps(trap, code) { } throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]); } + +function assertWasmThrows(value, code) { + assertEquals("number", typeof(value)); + try { + if (typeof code === 'function') { + code(); + } else { + eval(code); + } + } catch (e) { + assertEquals("number", typeof e); + assertEquals(value, e); + // Success. + return; + } + throw new MjsUnitAssertionError("Did not throw at all, expected: " + value); +} diff --git a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js index fecd164b56..7b77a8c9b1 100644 --- a/deps/v8/test/mjsunit/wasm/wasm-module-builder.js +++ b/deps/v8/test/mjsunit/wasm/wasm-module-builder.js @@ -61,7 +61,7 @@ class Binary extends Array { emit_section(section_code, content_generator) { // Emit section name. - this.emit_string(section_names[section_code]); + this.emit_u8(section_code); // Emit the section to a temporary buffer: its full length isn't know yet. let section = new Binary; content_generator(section); @@ -104,6 +104,7 @@ class WasmModuleBuilder { constructor() { this.types = []; this.imports = []; + this.globals = []; this.functions = []; this.exports = []; this.table = []; @@ -138,10 +139,15 @@ class WasmModuleBuilder { return this.types.length - 1; } + addGlobal(local_type) { + this.globals.push(local_type); + return this.globals.length - 1; + } + addFunction(name, type) { let type_index = (typeof type) == "number" ? type : this.addType(type); let func = new WasmFunctionBuilder(name, type_index); - func.index = this.functions.length; + func.index = this.functions.length + this.imports.length; this.functions.push(func); return func; } @@ -176,7 +182,7 @@ class WasmModuleBuilder { // Add type section if (wasm.types.length > 0) { if (debug) print("emitting types @ " + binary.length); - binary.emit_section(kDeclTypes, section => { + binary.emit_section(kTypeSectionCode, section => { section.emit_varint(wasm.types.length); for (let type of wasm.types) { section.emit_u8(kWasmFunctionTypeForm); @@ -195,12 +201,13 @@ class WasmModuleBuilder { // Add imports section if (wasm.imports.length > 0) { if (debug) print("emitting imports @ " + binary.length); - binary.emit_section(kDeclImports, section => { + binary.emit_section(kImportSectionCode, section => { section.emit_varint(wasm.imports.length); for (let imp of wasm.imports) { - section.emit_varint(imp.type); section.emit_string(imp.module); section.emit_string(imp.name || ''); + section.emit_u8(kExternalFunction); + section.emit_varint(imp.type); } }); } @@ -211,7 +218,7 @@ class WasmModuleBuilder { let exports = 0; if (wasm.functions.length > 0) { if (debug) print("emitting function decls @ " + binary.length); - binary.emit_section(kDeclFunctions, section => { + binary.emit_section(kFunctionSectionCode, section => { section.emit_varint(wasm.functions.length); for (let func of wasm.functions) { has_names = has_names || (func.name != undefined && @@ -225,56 +232,108 @@ class WasmModuleBuilder { // Add table. if (wasm.table.length > 0) { if (debug) print("emitting table @ " + binary.length); - binary.emit_section(kDeclTable, section => { + binary.emit_section(kTableSectionCode, section => { + section.emit_u8(1); // one table entry + section.emit_u8(kWasmAnyFunctionTypeForm); + section.emit_u8(1); + section.emit_varint(wasm.table.length); section.emit_varint(wasm.table.length); - if (wasm.pad !== null) { - if (debug) print("emitting table padding @ " + binary.length); - section.emit_varint(wasm.pad); - } - for (let index of wasm.table) { - section.emit_varint(index); - } }); } // Add memory section if (wasm.memory != undefined) { if (debug) print("emitting memory @ " + binary.length); - binary.emit_section(kDeclMemory, section => { + binary.emit_section(kMemorySectionCode, section => { + section.emit_u8(1); // one memory entry + section.emit_varint(kResizableMaximumFlag); section.emit_varint(wasm.memory.min); section.emit_varint(wasm.memory.max); - section.emit_u8(wasm.memory.exp ? 1 : 0); }); } + // Add global section. + if (wasm.globals.length > 0) { + if (debug) print ("emitting globals @ " + binary.length); + binary.emit_section(kGlobalSectionCode, section => { + section.emit_varint(wasm.globals.length); + for (let global_type of wasm.globals) { + section.emit_u8(global_type); + section.emit_u8(true); // mutable + switch (global_type) { + case kAstI32: + section.emit_u8(kExprI32Const); + section.emit_u8(0); + break; + case kAstI64: + section.emit_u8(kExprI64Const); + section.emit_u8(0); + break; + case kAstF32: + section.emit_u8(kExprF32Const); + section.emit_u32(0); + break; + case kAstF64: + section.emit_u8(kExprI32Const); + section.emit_u32(0); + section.emit_u32(0); + break; + } + section.emit_u8(kExprEnd); // end of init expression + } + }); + } // Add export table. - if (exports > 0) { + var mem_export = (wasm.memory != undefined && wasm.memory.exp); + if (exports > 0 || mem_export) { if (debug) print("emitting exports @ " + binary.length); - binary.emit_section(kDeclExports, section => { - section.emit_varint(exports); + binary.emit_section(kExportSectionCode, section => { + section.emit_varint(exports + (mem_export ? 1 : 0)); for (let func of wasm.functions) { for (let exp of func.exports) { - section.emit_varint(func.index); section.emit_string(exp); + section.emit_u8(kExternalFunction); + section.emit_varint(func.index); } } + if (mem_export) { + section.emit_string("memory"); + section.emit_u8(kExternalMemory); + section.emit_u8(0); + } }); } // Add start function section. if (wasm.start_index != undefined) { if (debug) print("emitting start function @ " + binary.length); - binary.emit_section(kDeclStart, section => { + binary.emit_section(kStartSectionCode, section => { section.emit_varint(wasm.start_index); }); } + // Add table elements. + if (wasm.table.length > 0) { + if (debug) print("emitting table @ " + binary.length); + binary.emit_section(kElementSectionCode, section => { + section.emit_u8(1); + section.emit_u8(0); // table index + section.emit_u8(kExprI32Const); + section.emit_u8(0); + section.emit_u8(kExprEnd); + section.emit_varint(wasm.table.length); + for (let index of wasm.table) { + section.emit_varint(index); + } + }); + } + // Add function bodies. if (wasm.functions.length > 0) { // emit function bodies if (debug) print("emitting code @ " + binary.length); - binary.emit_section(kDeclCode, section => { + binary.emit_section(kCodeSectionCode, section => { section.emit_varint(wasm.functions.length); for (let func of wasm.functions) { // Function body length will be patched later. @@ -313,10 +372,13 @@ class WasmModuleBuilder { // Add data segments. if (wasm.segments.length > 0) { if (debug) print("emitting data segments @ " + binary.length); - binary.emit_section(kDeclData, section => { + binary.emit_section(kDataSectionCode, section => { section.emit_varint(wasm.segments.length); for (let seg of wasm.segments) { + section.emit_u8(0); // linear memory index 0 + section.emit_u8(kExprI32Const); section.emit_varint(seg.addr); + section.emit_u8(kExprEnd); section.emit_varint(seg.data.length); section.emit_bytes(seg.data); } @@ -332,7 +394,8 @@ class WasmModuleBuilder { // Add function names. if (has_names) { if (debug) print("emitting names @ " + binary.length); - binary.emit_section(kDeclNames, section => { + binary.emit_section(kUnknownSectionCode, section => { + section.emit_string("name"); section.emit_varint(wasm.functions.length); for (let func of wasm.functions) { var name = func.name == undefined ? "" : func.name; diff --git a/deps/v8/test/mjsunit/wasm/wasm-object-api.js b/deps/v8/test/mjsunit/wasm/wasm-object-api.js index 4e1df8cf14..b8663b3b29 100644 --- a/deps/v8/test/mjsunit/wasm/wasm-object-api.js +++ b/deps/v8/test/mjsunit/wasm/wasm-object-api.js @@ -15,3 +15,4 @@ assertEquals('object', typeof WebAssembly); assertEquals('function', typeof WebAssembly.Module); assertEquals('function', typeof WebAssembly.Instance); assertEquals('function', typeof WebAssembly.compile); +assertEquals('function', typeof WebAssembly.validate); diff --git a/deps/v8/test/mozilla/mozilla.status b/deps/v8/test/mozilla/mozilla.status index d4eebeec54..26503bfa6e 100644 --- a/deps/v8/test/mozilla/mozilla.status +++ b/deps/v8/test/mozilla/mozilla.status @@ -191,6 +191,9 @@ 'js1_5/GC/regress-278725': [PASS, ['mode == debug', FAIL]], # http://b/issue?id=1206983 'js1_5/Regress/regress-367561-03': [PASS, ['mode == debug', FAIL], NO_VARIANTS], + 'ecma/FunctionObjects/15.3.1.1-3': [PASS, FAIL, ['mode == debug', TIMEOUT, NO_VARIANTS]], + 'ecma/FunctionObjects/15.3.2.1-3': [PASS, FAIL, ['mode == debug', TIMEOUT, NO_VARIANTS]], + 'ecma/FunctionObjects/15.3.5-1': [PASS, FAIL, ['mode == debug', TIMEOUT, NO_VARIANTS]], 'ecma/Date/15.9.5.10-2': [PASS, FAIL, ['mode == debug', TIMEOUT, NO_VARIANTS]], # These tests create two Date objects just after each other and @@ -979,4 +982,9 @@ #BUG(3152): Avoid C stack overflow. 'js1_5/extensions/regress-355497': [FAIL_OK, 'Flags: --sim-stack-size=512'], }], # 'arch == arm64 and simulator_run == True' + +['variant == asm_wasm', { + '*': [SKIP], +}], # variant == asm_wasm + ] diff --git a/deps/v8/test/test262/detachArrayBuffer.js b/deps/v8/test/test262/detachArrayBuffer.js index adfece7edb..c34aa67a47 100644 --- a/deps/v8/test/test262/detachArrayBuffer.js +++ b/deps/v8/test/test262/detachArrayBuffer.js @@ -5,3 +5,5 @@ function $DETACHBUFFER(buffer) { %ArrayBufferNeuter(buffer); } + +$.detachArrayBuffer = $DETACHBUFFER; diff --git a/deps/v8/test/test262/harness-adapt.js b/deps/v8/test/test262/harness-adapt.js index 60c0858f02..d93d7e1610 100644 --- a/deps/v8/test/test262/harness-adapt.js +++ b/deps/v8/test/test262/harness-adapt.js @@ -89,3 +89,7 @@ function $DONE(arg){ quit(0); }; + +var $ = { + evalScript(script) { return Realm.eval(Realm.current(), script); } +}; diff --git a/deps/v8/test/test262/test262.status b/deps/v8/test/test262/test262.status index 80bb9d109e..479e2cb198 100644 --- a/deps/v8/test/test262/test262.status +++ b/deps/v8/test/test262/test262.status @@ -26,6 +26,7 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. [ + [ALWAYS, { ###################### NEEDS INVESTIGATION ####################### @@ -34,6 +35,11 @@ # https://code.google.com/p/v8/issues/detail?id=705 'language/statements/for-in/12.6.4-2': [PASS, FAIL_OK], + # Date tests that fail in CE(S)T timezone. + # https://bugs.chromium.org/p/v8/issues/detail?id=5449 + 'built-ins/Date/prototype/setFullYear/new-value-time-clip': [PASS, FAIL], + 'built-ins/Date/prototype/setMonth/new-value-time-clip': [PASS, FAIL], + ###################### MISSING ES6 FEATURES ####################### # The order of adding the name property is wrong @@ -94,37 +100,19 @@ 'language/expressions/postfix-decrement/S11.3.2_A5_*': [FAIL], 'language/expressions/prefix-decrement/S11.4.5_A5_*': [FAIL], 'language/expressions/prefix-increment/S11.4.4_A5_*': [FAIL], + 'language/statements/variable/binding-resolution': [FAIL], # https://code.google.com/p/v8/issues/detail?id=4253 'language/asi/S7.9_A5.7_T1': [PASS, FAIL_OK], ###### BEGIN REGEXP SUBCLASSING SECTION ###### - # Times out - 'built-ins/RegExp/prototype/Symbol.match/coerce-global': [SKIP], - - # Sticky support busted + # https://bugs.chromium.org/p/v8/issues/detail?id=5361 'built-ins/RegExp/prototype/Symbol.replace/y-init-lastindex': [FAIL], 'built-ins/RegExp/prototype/Symbol.replace/y-set-lastindex': [FAIL], - # https://code.google.com/p/v8/issues/detail?id=4504 - # https://bugs.chromium.org/p/chromium/issues/detail?id=624318 - 'built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex-err': [PASS, FAIL], - 'built-ins/RegExp/prototype/Symbol.match/builtin-failure-y-set-lastindex-err': [PASS, FAIL], - 'built-ins/RegExp/prototype/Symbol.match/builtin-success-g-set-lastindex-err': [SKIP], - 'built-ins/RegExp/prototype/Symbol.match/builtin-success-y-set-lastindex-err': [PASS, FAIL], - 'built-ins/RegExp/prototype/Symbol.match/g-init-lastindex-err': [PASS, FAIL], - 'built-ins/RegExp/prototype/Symbol.match/g-match-empty-set-lastindex-err': [PASS, FAIL], - 'built-ins/RegExp/prototype/Symbol.match/y-fail-lastindex-no-write': [PASS, FAIL], - 'built-ins/RegExp/prototype/Symbol.replace/g-init-lastindex-err': [PASS, FAIL], - 'built-ins/RegExp/prototype/Symbol.replace/y-fail-lastindex-no-write': [PASS, FAIL], - 'built-ins/RegExp/prototype/Symbol.search/set-lastindex-init-err': [PASS, FAIL], - 'built-ins/RegExp/prototype/Symbol.search/set-lastindex-restore-err': [PASS, FAIL], - 'built-ins/RegExp/prototype/exec/y-fail-lastindex-no-write': [PASS, FAIL], - 'built-ins/RegExp/prototype/test/y-fail-lastindex-no-write': [PASS, FAIL], - - # SKIP rather than FAIL, as the test checks for an exception which - # happens to be thrown for some other reason. - 'built-ins/RegExp/prototype/Symbol.split/str-result-get-length-err': [SKIP], + # https://bugs.chromium.org/p/v8/issues/detail?id=5360 + 'built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex-err': [FAIL], + 'built-ins/RegExp/prototype/Symbol.search/set-lastindex-restore-err': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=5123 'built-ins/RegExp/prototype/Symbol.replace/coerce-global': [FAIL], @@ -132,26 +120,16 @@ ###### END REGEXP SUBCLASSING SECTION ###### + # https://bugs.chromium.org/p/v8/issues/detail?id=5360 + 'built-ins/RegExp/prototype/Symbol.match/builtin-coerce-lastindex-err': [FAIL], + 'built-ins/RegExp/prototype/Symbol.match/builtin-failure-set-lastindex': [FAIL], + 'built-ins/RegExp/prototype/Symbol.search/set-lastindex-restore': [FAIL], + # https://code.google.com/p/v8/issues/detail?id=4360 'intl402/Collator/10.1.1_1': [FAIL], 'intl402/DateTimeFormat/12.1.1_1': [FAIL], 'intl402/NumberFormat/11.1.1_1': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=4784 - 'built-ins/TypedArray/prototype/set/typedarray-arg-negative-integer-offset-throws': [FAIL], - 'built-ins/TypedArray/prototype/set/array-arg-negative-integer-offset-throws': [FAIL], - - # https://bugs.chromium.org/p/v8/issues/detail?id=4901 - 'built-ins/TypedArrays/internals/DefineOwnProperty/key-is-greater-than-last-index': [FAIL], - 'built-ins/TypedArrays/internals/DefineOwnProperty/key-is-lower-than-zero': [FAIL], - 'built-ins/TypedArrays/internals/DefineOwnProperty/key-is-minus-zero': [FAIL], - 'built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-integer': [FAIL], - 'built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-writable': [FAIL], - 'built-ins/TypedArrays/internals/Set/key-is-minus-zero': [FAIL], - 'built-ins/TypedArrays/internals/Set/key-is-not-integer': [FAIL], - 'built-ins/TypedArrays/internals/Set/key-is-out-of-bounds': [FAIL], - 'built-ins/TypedArrays/internals/Set/tonumber-value-throws': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=4895 'built-ins/TypedArrays/internals/HasProperty/detached-buffer': [FAIL], 'built-ins/TypedArrays/internals/Set/detached-buffer': [FAIL], @@ -215,6 +193,8 @@ 'built-ins/DataView/prototype/byteOffset/detached-buffer': [FAIL], 'built-ins/DataView/detached-buffer': [FAIL], 'built-ins/ArrayBuffer/prototype/byteLength/detached-buffer': [FAIL], + 'built-ins/DataView/prototype/setFloat64/detached-buffer-after-toindex-byteoffset': [FAIL], + 'built-ins/DataView/prototype/setInt16/detached-buffer-after-toindex-byteoffset': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=4648 'built-ins/TypedArray/prototype/copyWithin/detached-buffer': [FAIL], @@ -298,11 +278,17 @@ 'language/eval-code/direct/non-definable-function-with-variable': [FAIL], 'language/eval-code/indirect/non-definable-function-with-function': [FAIL], 'language/eval-code/indirect/non-definable-function-with-variable': [FAIL], + 'language/global-code/script-decl-func-err-non-configurable': [FAIL], + 'language/global-code/script-decl-var-collision': [FAIL], # https://bugs.chromium.org/p/v8/issues/detail?id=4124 'built-ins/Simd/*': [SKIP], # https://bugs.chromium.org/p/v8/issues/detail?id=4958 + 'built-ins/Function/prototype/toString/AsyncFunction': [FAIL], + 'built-ins/Function/prototype/toString/async-function-declaration': [FAIL], + 'built-ins/Function/prototype/toString/async-function-expression': [FAIL], + 'built-ins/Function/prototype/toString/async-method': [FAIL], 'built-ins/Function/prototype/toString/Function': [FAIL], 'built-ins/Function/prototype/toString/GeneratorFunction': [FAIL], 'built-ins/Function/prototype/toString/function-declaration': [FAIL], @@ -326,13 +312,6 @@ 'built-ins/Function/prototype/toString/setter-object': [FAIL], 'built-ins/Function/prototype/toString/unicode': [FAIL], - # https://bugs.chromium.org/p/v8/issues/detail?id=1569 - 'language/eval-code/direct/export': [SKIP], - 'language/eval-code/direct/import': [SKIP], - 'language/eval-code/indirect/export': [SKIP], - 'language/eval-code/indirect/import': [SKIP], - 'language/module-code/*': [SKIP], - # https://bugs.chromium.org/p/v8/issues/detail?id=5012 # http://bugs.icu-project.org/trac/ticket/12671 'intl402/Intl/getCanonicalLocales/weird-cases': [FAIL], @@ -420,8 +399,89 @@ 'annexB/built-ins/Date/prototype/setYear/time-clip': [FAIL], 'annexB/built-ins/Date/prototype/setYear/year-number-relative': [FAIL], - # Fixed by https://github.com/tc39/test262/pull/662. - 'built-ins/Object/getOwnPropertyDescriptors/duplicate-keys': [FAIL], + # https://bugs.chromium.org/p/v8/issues/detail?id=5155 + 'language/white-space/mongolian-vowel-separator': [FAIL], + 'language/white-space/mongolian-vowel-separator-eval': [FAIL], + 'built-ins/RegExp/S15.10.2.12_A2_T1': [FAIL], + 'built-ins/RegExp/S15.10.2.12_A1_T1': [FAIL], + 'built-ins/parseFloat/S15.1.2.3_A2_T10_U180E': [FAIL], + 'built-ins/parseInt/S15.1.2.2_A2_T10_U180E': [FAIL], + 'built-ins/String/prototype/trim/u180e': [FAIL], + 'built-ins/Number/S9.3.1_A3_T2_U180E': [FAIL], + 'built-ins/Number/S9.3.1_A3_T1_U180E': [FAIL], + 'built-ins/Number/S9.3.1_A2_U180E': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5051 + 'language/expressions/arrow-function/params-trailing-comma': [FAIL], + 'language/expressions/arrow-function/params-trailing-comma-length': [FAIL], + 'language/expressions/function/params-trailing-comma': [FAIL], + 'language/expressions/function/params-trailing-comma-arguments': [FAIL], + 'language/expressions/function/params-trailing-comma-length': [FAIL], + 'language/expressions/generators/params-trailing-comma': [FAIL], + 'language/expressions/generators/params-trailing-comma-arguments': [FAIL], + 'language/expressions/generators/params-trailing-comma-length': [FAIL], + 'language/expressions/object/method-definition/params-trailing-comma': [FAIL], + 'language/expressions/object/method-definition/params-trailing-comma-arguments': [FAIL], + 'language/expressions/object/method-definition/params-trailing-comma-length': [FAIL], + 'language/statements/class/definition/params-trailing-comma': [FAIL], + 'language/statements/class/definition/params-trailing-comma-arguments': [FAIL], + 'language/statements/class/definition/params-trailing-comma-length': [FAIL], + 'language/statements/function/params-trailing-comma': [FAIL], + 'language/statements/function/params-trailing-comma-arguments': [FAIL], + 'language/statements/function/params-trailing-comma-length': [FAIL], + 'language/statements/generators/params-trailing-comma': [FAIL], + 'language/statements/generators/params-trailing-comma-arguments': [FAIL], + 'language/statements/generators/params-trailing-comma-length': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5326 + 'language/expressions/super/call-new-target-undef': [FAIL], + 'language/eval-code/direct/super-call-fn': [FAIL], + 'language/expressions/super/prop-dot-fn-no-super-bndng': [FAIL], + 'language/expressions/super/prop-expr-fn-no-super-bndng': [FAIL], + 'language/expressions/super/prop-expr-fn-eval-before-has-super': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5064 + 'language/expressions/arrow-function/params-dflt-duplicates': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5244 + 'intl402/NumberFormat/prototype/formatToParts/*': [SKIP], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5327 + 'built-ins/TypedArray/prototype/set/array-arg-negative-integer-offset-throws': [FAIL], + 'built-ins/TypedArray/prototype/set/typedarray-arg-negative-integer-offset-throws': [FAIL], + 'built-ins/TypedArrays/internals/Set/key-is-minus-zero': [FAIL], + 'built-ins/TypedArrays/internals/Set/key-is-not-integer': [FAIL], + 'built-ins/TypedArrays/internals/Set/key-is-out-of-bounds': [FAIL], + 'built-ins/TypedArrays/internals/Set/tonumber-value-throws': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5328 + 'built-ins/TypedArrays/internals/DefineOwnProperty/key-is-numericindex-desc-not-writable': [FAIL], + 'built-ins/TypedArrays/internals/DefineOwnProperty/key-is-not-integer': [FAIL], + 'built-ins/TypedArrays/internals/DefineOwnProperty/key-is-minus-zero': [FAIL], + 'built-ins/TypedArrays/internals/DefineOwnProperty/key-is-lower-than-zero': [FAIL], + 'built-ins/TypedArrays/internals/DefineOwnProperty/key-is-greater-than-last-index': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5329 + 'built-ins/RegExp/prototype/source/value-line-terminator': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5112 + 'annexB/language/eval-code/direct/func-block-decl-eval-func-no-skip-try': [FAIL], + 'annexB/language/eval-code/direct/func-if-decl-else-decl-a-eval-func-no-skip-try': [FAIL], + 'annexB/language/eval-code/direct/func-if-decl-else-decl-b-eval-func-no-skip-try': [FAIL], + 'annexB/language/eval-code/direct/func-if-decl-else-stmt-eval-func-no-skip-try': [FAIL], + 'annexB/language/eval-code/direct/func-if-decl-no-else-eval-func-no-skip-try': [FAIL], + 'annexB/language/eval-code/direct/func-if-stmt-else-decl-eval-func-no-skip-try': [FAIL], + 'annexB/language/eval-code/direct/func-switch-case-eval-func-no-skip-try': [FAIL], + 'annexB/language/eval-code/direct/func-switch-dflt-eval-func-no-skip-try': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5334 + 'built-ins/Proxy/setPrototypeOf/internals-call-order': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5336 + 'language/expressions/super/call-proto-not-ctor': [FAIL], + + # https://bugs.chromium.org/p/v8/issues/detail?id=5337 + 'language/expressions/arrow-function/dstr-dflt-ary-ptrn-rest-ary-rest': [SKIP], ######################## NEEDS INVESTIGATION ########################### @@ -483,32 +543,6 @@ # Test262 Bug: https://bugs.ecmascript.org/show_bug.cgi?id=596 'built-ins/Array/prototype/sort/bug_596_1': [PASS, FAIL_OK], - # https://github.com/tc39/test262/issues/677 - 'built-ins/RegExp/prototype/source/15.10.7.1-1': [FAIL], - 'built-ins/RegExp/prototype/global/15.10.7.2-1': [FAIL], - 'built-ins/RegExp/prototype/ignoreCase/15.10.7.3-1': [FAIL], - 'built-ins/RegExp/prototype/multiline/15.10.7.4-1': [FAIL], - - # https://github.com/tc39/test262/issues/694 - 'built-ins/TypedArrays/length-arg-toindex-length': [FAIL], - - # https://github.com/tc39/test262/issues/696 - 'language/statements/class/subclass/builtin-objects/ArrayBuffer/regular-subclassing': [FAIL], - - # https://github.com/tc39/test262/issues/685 - 'built-ins/DataView/prototype/setUint8/range-check-after-value-conversion': [FAIL], - 'built-ins/DataView/prototype/setUint16/range-check-after-value-conversion': [FAIL], - 'built-ins/DataView/prototype/setUint32/range-check-after-value-conversion': [FAIL], - 'built-ins/DataView/prototype/setInt8/range-check-after-value-conversion': [FAIL], - 'built-ins/DataView/prototype/setInt16/range-check-after-value-conversion': [FAIL], - 'built-ins/DataView/prototype/setInt32/range-check-after-value-conversion': [FAIL], - 'built-ins/DataView/prototype/setFloat32/range-check-after-value-conversion': [FAIL], - 'built-ins/DataView/prototype/setFloat64/range-check-after-value-conversion': [FAIL], - - # https://github.com/tc39/test262/issues/686 - 'built-ins/DataView/prototype/setFloat32/toindex-byteoffset': [FAIL], - 'built-ins/DataView/prototype/setFloat64/toindex-byteoffset': [FAIL], - ############################ SKIPPED TESTS ############################# # These tests take a looong time to run. @@ -544,8 +578,10 @@ 'built-ins/String/prototype/normalize/return-normalized-string-using-default-parameter': [SKIP], # Case-conversion is not fully compliant to the Unicode spec with i18n off. + 'built-ins/String/prototype/toLocaleLowerCase/Final_Sigma_U180E': [FAIL], 'built-ins/String/prototype/toLocaleLowerCase/special_casing_conditional': [FAIL], 'built-ins/String/prototype/toLocaleLowerCase/supplementary_plane': [FAIL], + 'built-ins/String/prototype/toLowerCase/Final_Sigma_U180E': [FAIL], 'built-ins/String/prototype/toLowerCase/special_casing_conditional': [FAIL], 'built-ins/String/prototype/toLowerCase/supplementary_plane': [FAIL], 'built-ins/String/prototype/toLocaleUpperCase/supplementary_plane': [FAIL], @@ -588,4 +624,24 @@ 'built-ins/ArrayBuffer/length-is-too-large-throws': [SKIP], }], # asan == True or msan == True or tsan == True +['variant == asm_wasm', { + '*': [SKIP], +}], # variant == asm_wasm + +# Module-related tests +# https://bugs.chromium.org/p/v8/issues/detail?id=1569 +['variant != ignition and variant != ignition_staging and variant != ignition_turbofan', { + 'language/eval-code/direct/export': [SKIP], + 'language/eval-code/direct/import': [SKIP], + 'language/eval-code/indirect/export': [SKIP], + 'language/eval-code/indirect/import': [SKIP], + 'language/module-code/*': [SKIP], +}], # variant != ignition and variant != ignition_staging and variant != ignition_turbofan +['variant == ignition or variant == ignition_staging or variant == ignition_turbofan', { + 'language/module-code/comment-*': [SKIP], + 'language/module-code/eval-*': [SKIP], + 'language/module-code/instn-*': [SKIP], + 'language/module-code/namespace/*': [SKIP], +}], # variant == ignition or variant == ignition_staging or variant == ignition_turbofan + ] diff --git a/deps/v8/test/unittests/BUILD.gn b/deps/v8/test/unittests/BUILD.gn index 7193afb966..ebee73db75 100644 --- a/deps/v8/test/unittests/BUILD.gn +++ b/deps/v8/test/unittests/BUILD.gn @@ -2,36 +2,151 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -# The sources are kept automatically in sync with unittests.gyp. - import("../../gni/v8.gni") -gypi_values = exec_script("//build/gypi_to_gn.py", - [ rebase_path("unittests.gyp") ], - "scope", - [ "unittests.gyp" ]) - v8_executable("unittests") { testonly = true - sources = gypi_values.unittests_sources + sources = [ + "../../testing/gmock-support.h", + "../../testing/gtest-support.h", + "base/atomic-utils-unittest.cc", + "base/bits-unittest.cc", + "base/cpu-unittest.cc", + "base/division-by-constant-unittest.cc", + "base/flags-unittest.cc", + "base/functional-unittest.cc", + "base/ieee754-unittest.cc", + "base/iterator-unittest.cc", + "base/logging-unittest.cc", + "base/platform/condition-variable-unittest.cc", + "base/platform/mutex-unittest.cc", + "base/platform/platform-unittest.cc", + "base/platform/semaphore-unittest.cc", + "base/platform/time-unittest.cc", + "base/sys-info-unittest.cc", + "base/utils/random-number-generator-unittest.cc", + "cancelable-tasks-unittest.cc", + "char-predicates-unittest.cc", + "compiler-dispatcher/compiler-dispatcher-job-unittest.cc", + "compiler/branch-elimination-unittest.cc", + "compiler/checkpoint-elimination-unittest.cc", + "compiler/common-operator-reducer-unittest.cc", + "compiler/common-operator-unittest.cc", + "compiler/compiler-test-utils.h", + "compiler/control-equivalence-unittest.cc", + "compiler/control-flow-optimizer-unittest.cc", + "compiler/dead-code-elimination-unittest.cc", + "compiler/diamond-unittest.cc", + "compiler/effect-control-linearizer-unittest.cc", + "compiler/escape-analysis-unittest.cc", + "compiler/graph-reducer-unittest.cc", + "compiler/graph-reducer-unittest.h", + "compiler/graph-trimmer-unittest.cc", + "compiler/graph-unittest.cc", + "compiler/graph-unittest.h", + "compiler/instruction-selector-unittest.cc", + "compiler/instruction-selector-unittest.h", + "compiler/instruction-sequence-unittest.cc", + "compiler/instruction-sequence-unittest.h", + "compiler/int64-lowering-unittest.cc", + "compiler/js-builtin-reducer-unittest.cc", + "compiler/js-create-lowering-unittest.cc", + "compiler/js-intrinsic-lowering-unittest.cc", + "compiler/js-operator-unittest.cc", + "compiler/js-typed-lowering-unittest.cc", + "compiler/linkage-tail-call-unittest.cc", + "compiler/live-range-builder.h", + "compiler/live-range-unittest.cc", + "compiler/liveness-analyzer-unittest.cc", + "compiler/load-elimination-unittest.cc", + "compiler/loop-peeling-unittest.cc", + "compiler/machine-operator-reducer-unittest.cc", + "compiler/machine-operator-unittest.cc", + "compiler/move-optimizer-unittest.cc", + "compiler/node-cache-unittest.cc", + "compiler/node-matchers-unittest.cc", + "compiler/node-properties-unittest.cc", + "compiler/node-test-utils.cc", + "compiler/node-test-utils.h", + "compiler/node-unittest.cc", + "compiler/opcodes-unittest.cc", + "compiler/register-allocator-unittest.cc", + "compiler/schedule-unittest.cc", + "compiler/scheduler-rpo-unittest.cc", + "compiler/scheduler-unittest.cc", + "compiler/simplified-operator-reducer-unittest.cc", + "compiler/simplified-operator-unittest.cc", + "compiler/state-values-utils-unittest.cc", + "compiler/tail-call-optimization-unittest.cc", + "compiler/typed-optimization-unittest.cc", + "compiler/typer-unittest.cc", + "compiler/value-numbering-reducer-unittest.cc", + "compiler/zone-pool-unittest.cc", + "counters-unittest.cc", + "eh-frame-iterator-unittest.cc", + "eh-frame-writer-unittest.cc", + "heap/bitmap-unittest.cc", + "heap/gc-idle-time-handler-unittest.cc", + "heap/gc-tracer-unittest.cc", + "heap/heap-unittest.cc", + "heap/marking-unittest.cc", + "heap/memory-reducer-unittest.cc", + "heap/scavenge-job-unittest.cc", + "heap/slot-set-unittest.cc", + "interpreter/bytecode-array-builder-unittest.cc", + "interpreter/bytecode-array-iterator-unittest.cc", + "interpreter/bytecode-array-writer-unittest.cc", + "interpreter/bytecode-dead-code-optimizer-unittest.cc", + "interpreter/bytecode-decoder-unittest.cc", + "interpreter/bytecode-peephole-optimizer-unittest.cc", + "interpreter/bytecode-pipeline-unittest.cc", + "interpreter/bytecode-register-allocator-unittest.cc", + "interpreter/bytecode-register-optimizer-unittest.cc", + "interpreter/bytecode-utils.h", + "interpreter/bytecodes-unittest.cc", + "interpreter/constant-array-builder-unittest.cc", + "interpreter/interpreter-assembler-unittest.cc", + "interpreter/interpreter-assembler-unittest.h", + "libplatform/default-platform-unittest.cc", + "libplatform/task-queue-unittest.cc", + "libplatform/worker-thread-unittest.cc", + "locked-queue-unittest.cc", + "register-configuration-unittest.cc", + "run-all-unittests.cc", + "source-position-table-unittest.cc", + "test-utils.cc", + "test-utils.h", + "unicode-unittest.cc", + "value-serializer-unittest.cc", + "wasm/asm-types-unittest.cc", + "wasm/ast-decoder-unittest.cc", + "wasm/control-transfer-unittest.cc", + "wasm/decoder-unittest.cc", + "wasm/leb-helper-unittest.cc", + "wasm/loop-assignment-analysis-unittest.cc", + "wasm/module-decoder-unittest.cc", + "wasm/switch-logic-unittest.cc", + "wasm/wasm-macro-gen-unittest.cc", + "wasm/wasm-module-builder-unittest.cc", + ] if (v8_current_cpu == "arm") { - sources += gypi_values.unittests_sources_arm + sources += [ "compiler/arm/instruction-selector-arm-unittest.cc" ] } else if (v8_current_cpu == "arm64") { - sources += gypi_values.unittests_sources_arm64 + sources += [ "compiler/arm64/instruction-selector-arm64-unittest.cc" ] } else if (v8_current_cpu == "x86") { - sources += gypi_values.unittests_sources_ia32 + sources += [ "compiler/ia32/instruction-selector-ia32-unittest.cc" ] } else if (v8_current_cpu == "mips" || v8_current_cpu == "mipsel") { - sources += gypi_values.unittests_sources_mips + sources += [ "compiler/mips/instruction-selector-mips-unittest.cc" ] } else if (v8_current_cpu == "mips64" || v8_current_cpu == "mips64el") { - sources += gypi_values.unittests_sources_mips64 + sources += [ "compiler/mips64/instruction-selector-mips64-unittest.cc" ] } else if (v8_current_cpu == "x64") { - sources += gypi_values.unittests_sources_x64 + sources += [ "compiler/x64/instruction-selector-x64-unittest.cc" ] } else if (v8_current_cpu == "ppc" || v8_current_cpu == "ppc64") { - sources += gypi_values.unittests_sources_ppc + sources += [ "compiler/ppc/instruction-selector-ppc-unittest.cc" ] } else if (v8_current_cpu == "s390" || v8_current_cpu == "s390x") { - sources += gypi_values.unittests_sources_s390 + sources += [ "compiler/s390/instruction-selector-s390-unittest.cc" ] } configs = [ diff --git a/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc b/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc index 922ed2f44e..d4c54247e2 100644 --- a/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc +++ b/deps/v8/test/unittests/compiler-dispatcher/compiler-dispatcher-job-unittest.cc @@ -6,11 +6,14 @@ #include "include/v8.h" #include "src/api.h" +#include "src/ast/ast.h" #include "src/ast/scopes.h" +#include "src/base/platform/semaphore.h" #include "src/compiler-dispatcher/compiler-dispatcher-job.h" #include "src/flags.h" #include "src/isolate-inl.h" #include "src/parsing/parse-info.h" +#include "src/v8.h" #include "test/unittests/test-utils.h" #include "testing/gtest/include/gtest/gtest.h" @@ -19,6 +22,30 @@ namespace internal { typedef TestWithContext CompilerDispatcherJobTest; +class IgnitionCompilerDispatcherJobTest : public TestWithContext { + public: + IgnitionCompilerDispatcherJobTest() {} + ~IgnitionCompilerDispatcherJobTest() override {} + + static void SetUpTestCase() { + old_flag_ = i::FLAG_ignition; + i::FLAG_ignition = true; + i::FLAG_never_compact = true; + TestWithContext::SetUpTestCase(); + } + + static void TearDownTestCase() { + TestWithContext::TearDownTestCase(); + i::FLAG_ignition = old_flag_; + } + + private: + static bool old_flag_; + DISALLOW_COPY_AND_ASSIGN(IgnitionCompilerDispatcherJobTest); +}; + +bool IgnitionCompilerDispatcherJobTest::old_flag_; + namespace { const char test_script[] = "(x) { x*x; }"; @@ -39,7 +66,7 @@ class ScriptResource : public v8::String::ExternalOneByteStringResource { DISALLOW_COPY_AND_ASSIGN(ScriptResource); }; -Handle<JSFunction> CreateFunction( +Handle<SharedFunctionInfo> CreateSharedFunctionInfo( Isolate* isolate, ExternalOneByteString::Resource* maybe_resource) { HandleScope scope(isolate); Handle<String> source; @@ -52,40 +79,53 @@ Handle<JSFunction> CreateFunction( } Handle<Script> script = isolate->factory()->NewScript(source); Handle<SharedFunctionInfo> shared = isolate->factory()->NewSharedFunctionInfo( - isolate->factory()->NewStringFromAsciiChecked("f"), MaybeHandle<Code>(), - false); + isolate->factory()->NewStringFromAsciiChecked("f"), + isolate->builtins()->CompileLazy(), false); SharedFunctionInfo::SetScript(shared, script); shared->set_end_position(source->length()); - Handle<JSFunction> function = - isolate->factory()->NewFunctionFromSharedFunctionInfo( - shared, handle(isolate->context(), isolate)); - return scope.CloseAndEscape(function); + shared->set_outer_scope_info(ScopeInfo::Empty(isolate)); + return scope.CloseAndEscape(shared); +} + +Handle<Object> RunJS(v8::Isolate* isolate, const char* script) { + return Utils::OpenHandle( + *v8::Script::Compile( + isolate->GetCurrentContext(), + v8::String::NewFromUtf8(isolate, script, v8::NewStringType::kNormal) + .ToLocalChecked()) + .ToLocalChecked() + ->Run(isolate->GetCurrentContext()) + .ToLocalChecked()); } } // namespace TEST_F(CompilerDispatcherJobTest, Construct) { std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( - i_isolate(), CreateFunction(i_isolate(), nullptr), FLAG_stack_size)); + i_isolate(), CreateSharedFunctionInfo(i_isolate(), nullptr), + FLAG_stack_size)); } TEST_F(CompilerDispatcherJobTest, CanParseOnBackgroundThread) { { std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( - i_isolate(), CreateFunction(i_isolate(), nullptr), FLAG_stack_size)); + i_isolate(), CreateSharedFunctionInfo(i_isolate(), nullptr), + FLAG_stack_size)); ASSERT_FALSE(job->can_parse_on_background_thread()); } { ScriptResource script(test_script, strlen(test_script)); std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( - i_isolate(), CreateFunction(i_isolate(), &script), FLAG_stack_size)); + i_isolate(), CreateSharedFunctionInfo(i_isolate(), &script), + FLAG_stack_size)); ASSERT_TRUE(job->can_parse_on_background_thread()); } } TEST_F(CompilerDispatcherJobTest, StateTransitions) { std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( - i_isolate(), CreateFunction(i_isolate(), nullptr), FLAG_stack_size)); + i_isolate(), CreateSharedFunctionInfo(i_isolate(), nullptr), + FLAG_stack_size)); ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); job->PrepareToParseOnMainThread(); @@ -93,7 +133,13 @@ TEST_F(CompilerDispatcherJobTest, StateTransitions) { job->Parse(); ASSERT_TRUE(job->status() == CompileJobStatus::kParsed); ASSERT_TRUE(job->FinalizeParsingOnMainThread()); + ASSERT_TRUE(job->status() == CompileJobStatus::kReadyToAnalyse); + ASSERT_TRUE(job->PrepareToCompileOnMainThread()); ASSERT_TRUE(job->status() == CompileJobStatus::kReadyToCompile); + job->Compile(); + ASSERT_TRUE(job->status() == CompileJobStatus::kCompiled); + ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); + ASSERT_TRUE(job->status() == CompileJobStatus::kDone); job->ResetOnMainThread(); ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); } @@ -101,7 +147,8 @@ TEST_F(CompilerDispatcherJobTest, StateTransitions) { TEST_F(CompilerDispatcherJobTest, SyntaxError) { ScriptResource script("^^^", strlen("^^^")); std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( - i_isolate(), CreateFunction(i_isolate(), &script), FLAG_stack_size)); + i_isolate(), CreateSharedFunctionInfo(i_isolate(), &script), + FLAG_stack_size)); job->PrepareToParseOnMainThread(); job->Parse(); @@ -117,34 +164,28 @@ TEST_F(CompilerDispatcherJobTest, SyntaxError) { TEST_F(CompilerDispatcherJobTest, ScopeChain) { const char script[] = - "function g() { var g = 1; function f(x) { return x * g }; return f; } " + "function g() { var y = 1; function f(x) { return x * y }; return f; } " "g();"; - Handle<JSFunction> f = Handle<JSFunction>::cast(Utils::OpenHandle( - *v8::Script::Compile(isolate()->GetCurrentContext(), - v8::String::NewFromUtf8(isolate(), script, - v8::NewStringType::kNormal) - .ToLocalChecked()) - .ToLocalChecked() - ->Run(isolate()->GetCurrentContext()) - .ToLocalChecked())); + Handle<JSFunction> f = Handle<JSFunction>::cast(RunJS(isolate(), script)); - std::unique_ptr<CompilerDispatcherJob> job( - new CompilerDispatcherJob(i_isolate(), f, FLAG_stack_size)); + std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( + i_isolate(), handle(f->shared()), FLAG_stack_size)); job->PrepareToParseOnMainThread(); job->Parse(); ASSERT_TRUE(job->FinalizeParsingOnMainThread()); + ASSERT_TRUE(job->PrepareToCompileOnMainThread()); ASSERT_TRUE(job->status() == CompileJobStatus::kReadyToCompile); const AstRawString* var_x = job->parse_info_->ast_value_factory()->GetOneByteString("x"); Variable* var = job->parse_info_->literal()->scope()->Lookup(var_x); ASSERT_TRUE(var); - ASSERT_TRUE(var->IsUnallocated()); + ASSERT_TRUE(var->IsParameter()); - const AstRawString* var_g = - job->parse_info_->ast_value_factory()->GetOneByteString("g"); - var = job->parse_info_->literal()->scope()->Lookup(var_g); + const AstRawString* var_y = + job->parse_info_->ast_value_factory()->GetOneByteString("y"); + var = job->parse_info_->literal()->scope()->Lookup(var_y); ASSERT_TRUE(var); ASSERT_TRUE(var->IsContextSlot()); @@ -152,5 +193,127 @@ TEST_F(CompilerDispatcherJobTest, ScopeChain) { ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); } +TEST_F(CompilerDispatcherJobTest, CompileAndRun) { + const char script[] = + "function g() {\n" + " f = function(a) {\n" + " for (var i = 0; i < 3; i++) { a += 20; }\n" + " return a;\n" + " }\n" + " return f;\n" + "}\n" + "g();"; + Handle<JSFunction> f = Handle<JSFunction>::cast(RunJS(isolate(), script)); + std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( + i_isolate(), handle(f->shared()), FLAG_stack_size)); + + job->PrepareToParseOnMainThread(); + job->Parse(); + job->FinalizeParsingOnMainThread(); + job->PrepareToCompileOnMainThread(); + job->Compile(); + ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); + ASSERT_TRUE(job->status() == CompileJobStatus::kDone); + + Smi* value = Smi::cast(*RunJS(isolate(), "f(100);")); + ASSERT_TRUE(value == Smi::FromInt(160)); + + job->ResetOnMainThread(); + ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); +} + +TEST_F(CompilerDispatcherJobTest, CompileFailureToPrepare) { + std::string raw_script("() { var a = "); + for (int i = 0; i < 100000; i++) { + raw_script += "'x' + "; + } + raw_script += " 'x'; }"; + ScriptResource script(raw_script.c_str(), strlen(raw_script.c_str())); + std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( + i_isolate(), CreateSharedFunctionInfo(i_isolate(), &script), 100)); + + job->PrepareToParseOnMainThread(); + job->Parse(); + job->FinalizeParsingOnMainThread(); + ASSERT_FALSE(job->PrepareToCompileOnMainThread()); + ASSERT_TRUE(job->status() == CompileJobStatus::kFailed); + ASSERT_TRUE(i_isolate()->has_pending_exception()); + + i_isolate()->clear_pending_exception(); + job->ResetOnMainThread(); + ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); +} + +TEST_F(CompilerDispatcherJobTest, CompileFailureToFinalize) { + std::string raw_script("() { var a = "); + for (int i = 0; i < 1000; i++) { + raw_script += "'x' + "; + } + raw_script += " 'x'; }"; + ScriptResource script(raw_script.c_str(), strlen(raw_script.c_str())); + std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( + i_isolate(), CreateSharedFunctionInfo(i_isolate(), &script), 50)); + + job->PrepareToParseOnMainThread(); + job->Parse(); + job->FinalizeParsingOnMainThread(); + job->PrepareToCompileOnMainThread(); + job->Compile(); + ASSERT_FALSE(job->FinalizeCompilingOnMainThread()); + ASSERT_TRUE(job->status() == CompileJobStatus::kFailed); + ASSERT_TRUE(i_isolate()->has_pending_exception()); + + i_isolate()->clear_pending_exception(); + job->ResetOnMainThread(); + ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); +} + +class CompileTask : public Task { + public: + CompileTask(CompilerDispatcherJob* job, base::Semaphore* semaphore) + : job_(job), semaphore_(semaphore) {} + ~CompileTask() override {} + + void Run() override { + job_->Compile(); + semaphore_->Signal(); + } + + private: + CompilerDispatcherJob* job_; + base::Semaphore* semaphore_; + DISALLOW_COPY_AND_ASSIGN(CompileTask); +}; + +TEST_F(IgnitionCompilerDispatcherJobTest, CompileOnBackgroundThread) { + const char* raw_script = + "(a, b) {\n" + " var c = a + b;\n" + " function bar() { return b }\n" + " var d = { foo: 100, bar : bar() }\n" + " return bar;" + "}"; + ScriptResource script(raw_script, strlen(raw_script)); + std::unique_ptr<CompilerDispatcherJob> job(new CompilerDispatcherJob( + i_isolate(), CreateSharedFunctionInfo(i_isolate(), &script), 100)); + + job->PrepareToParseOnMainThread(); + job->Parse(); + job->FinalizeParsingOnMainThread(); + job->PrepareToCompileOnMainThread(); + ASSERT_TRUE(job->can_compile_on_background_thread()); + + base::Semaphore semaphore(0); + CompileTask* background_task = new CompileTask(job.get(), &semaphore); + V8::GetCurrentPlatform()->CallOnBackgroundThread(background_task, + Platform::kShortRunningTask); + semaphore.Wait(); + ASSERT_TRUE(job->FinalizeCompilingOnMainThread()); + ASSERT_TRUE(job->status() == CompileJobStatus::kDone); + + job->ResetOnMainThread(); + ASSERT_TRUE(job->status() == CompileJobStatus::kInitial); +} + } // namespace internal } // namespace v8 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 6317d91fa9..746624a691 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 @@ -2079,10 +2079,6 @@ TEST_P(InstructionSelectorFlagSettingTest, CmpZeroOnlyUserInBasicBlock) { const FlagSettingInst inst = GetParam(); // Binop with additional users, but in a different basic block. TRACED_FOREACH(Comparison, cmp, kBinopCmpZeroRightInstructions) { - // We don't optimise this case at the moment. - if (cmp.flags_condition == kEqual || cmp.flags_condition == kNotEqual) { - continue; - } StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), MachineType::Int32()); RawMachineLabel a, b; @@ -2108,10 +2104,6 @@ TEST_P(InstructionSelectorFlagSettingTest, ShiftedOperand) { const FlagSettingInst inst = GetParam(); // Like the test above, but with a shifted input to the binary operator. TRACED_FOREACH(Comparison, cmp, kBinopCmpZeroRightInstructions) { - // We don't optimise this case at the moment. - if (cmp.flags_condition == kEqual || cmp.flags_condition == kNotEqual) { - continue; - } StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), MachineType::Int32()); RawMachineLabel a, b; @@ -2158,8 +2150,7 @@ TEST_P(InstructionSelectorFlagSettingTest, UsersInSameBasicBlock) { EXPECT_EQ(inst.arch_opcode, s[0]->arch_opcode()); EXPECT_NE(kFlags_branch, s[0]->flags_mode()); EXPECT_EQ(kArmMul, s[1]->arch_opcode()); - EXPECT_EQ(cmp.flags_condition == kEqual ? kArmTst : kArmCmp, - s[2]->arch_opcode()); + EXPECT_EQ(kArmCmp, s[2]->arch_opcode()); EXPECT_EQ(kFlags_branch, s[2]->flags_mode()); EXPECT_EQ(cmp.flags_condition, s[2]->flags_condition()); } @@ -3059,10 +3050,11 @@ TEST_F(InstructionSelectorTest, Word32EqualWithZero) { m.Return(m.Word32Equal(m.Parameter(0), m.Int32Constant(0))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); - EXPECT_EQ(kArmTst, s[0]->arch_opcode()); - EXPECT_EQ(kMode_Operand2_R, s[0]->addressing_mode()); + EXPECT_EQ(kArmCmp, s[0]->arch_opcode()); + EXPECT_EQ(kMode_Operand2_I, s[0]->addressing_mode()); ASSERT_EQ(2U, s[0]->InputCount()); - EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(1))); EXPECT_EQ(1U, s[0]->OutputCount()); EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(kEqual, s[0]->flags_condition()); @@ -3072,10 +3064,11 @@ TEST_F(InstructionSelectorTest, Word32EqualWithZero) { m.Return(m.Word32Equal(m.Int32Constant(0), m.Parameter(0))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); - EXPECT_EQ(kArmTst, s[0]->arch_opcode()); - EXPECT_EQ(kMode_Operand2_R, s[0]->addressing_mode()); + EXPECT_EQ(kArmCmp, s[0]->arch_opcode()); + EXPECT_EQ(kMode_Operand2_I, s[0]->addressing_mode()); ASSERT_EQ(2U, s[0]->InputCount()); - EXPECT_EQ(s.ToVreg(s[0]->InputAt(0)), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(1))); EXPECT_EQ(1U, s[0]->OutputCount()); EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(kEqual, s[0]->flags_condition()); 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 6ca5e5e684..7892c4bbb9 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 @@ -402,7 +402,6 @@ TEST_P(InstructionSelectorLogicalTest, Parameter) { TEST_P(InstructionSelectorLogicalTest, Immediate) { const MachInst2 dpi = GetParam(); const MachineType type = dpi.machine_type; - // TODO(all): Add support for testing 64-bit immediates. if (type == MachineType::Int32()) { // Immediate on the right. TRACED_FOREACH(int32_t, imm, kLogical32Immediates) { @@ -429,6 +428,32 @@ TEST_P(InstructionSelectorLogicalTest, Immediate) { EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1))); EXPECT_EQ(1U, s[0]->OutputCount()); } + } else if (type == MachineType::Int64()) { + // Immediate on the right. + TRACED_FOREACH(int64_t, imm, kLogical64Immediates) { + StreamBuilder m(this, type, type); + m.Return((m.*dpi.constructor)(m.Parameter(0), m.Int64Constant(imm))); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); + ASSERT_EQ(2U, s[0]->InputCount()); + EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate()); + EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(1))); + EXPECT_EQ(1U, s[0]->OutputCount()); + } + + // Immediate on the left; all logical ops should commute. + TRACED_FOREACH(int64_t, imm, kLogical64Immediates) { + StreamBuilder m(this, type, type); + m.Return((m.*dpi.constructor)(m.Int64Constant(imm), m.Parameter(0))); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + EXPECT_EQ(dpi.arch_opcode, s[0]->arch_opcode()); + ASSERT_EQ(2U, s[0]->InputCount()); + EXPECT_TRUE(s[0]->InputAt(1)->IsImmediate()); + EXPECT_EQ(imm, s.ToInt64(s[0]->InputAt(1))); + EXPECT_EQ(1U, s[0]->OutputCount()); + } } } @@ -1067,7 +1092,8 @@ TEST_F(InstructionSelectorTest, SubBranchWithImmediateOnRight) { m.Return(m.Int32Constant(0)); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); - EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode()); + EXPECT_EQ((imm == 0) ? kArm64CompareAndBranch32 : kArm64Cmp32, + s[0]->arch_opcode()); EXPECT_EQ(kFlags_branch, s[0]->flags_mode()); EXPECT_EQ(kNotEqual, s[0]->flags_condition()); } @@ -3142,11 +3168,20 @@ const IntegerCmp kIntegerCmpInstructions[] = { kUnsignedLessThanOrEqual, kUnsignedGreaterThanOrEqual}}; +const IntegerCmp kIntegerCmpEqualityInstructions[] = { + {{&RawMachineAssembler::Word32Equal, "Word32Equal", kArm64Cmp32, + MachineType::Int32()}, + kEqual, + kEqual}, + {{&RawMachineAssembler::Word32NotEqual, "Word32NotEqual", kArm64Cmp32, + MachineType::Int32()}, + kNotEqual, + kNotEqual}}; } // namespace TEST_F(InstructionSelectorTest, Word32CompareNegateWithWord32Shift) { - TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpInstructions) { + TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpEqualityInstructions) { TRACED_FOREACH(Shift, shift, kShiftInstructions) { // Test 32-bit operations. Ignore ROR shifts, as compare-negate does not // support them. @@ -3183,19 +3218,16 @@ TEST_F(InstructionSelectorTest, CmpWithImmediateOnLeft) { // kEqual and kNotEqual trigger the cbz/cbnz optimization, which // is tested elsewhere. if (cmp.cond == kEqual || cmp.cond == kNotEqual) continue; + // For signed less than or equal to zero, we generate TBNZ. + if (cmp.cond == kSignedLessThanOrEqual && imm == 0) continue; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* const p0 = m.Parameter(0); - RawMachineLabel a, b; - m.Branch((m.*cmp.mi.constructor)(m.Int32Constant(imm), p0), &a, &b); - m.Bind(&a); - m.Return(m.Int32Constant(1)); - m.Bind(&b); - m.Return(m.Int32Constant(0)); + m.Return((m.*cmp.mi.constructor)(m.Int32Constant(imm), p0)); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); EXPECT_EQ(kArm64Cmp32, s[0]->arch_opcode()); ASSERT_LE(2U, s[0]->InputCount()); - EXPECT_EQ(kFlags_branch, s[0]->flags_mode()); + EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(cmp.commuted_cond, s[0]->flags_condition()); EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1))); } @@ -3203,24 +3235,19 @@ TEST_F(InstructionSelectorTest, CmpWithImmediateOnLeft) { } TEST_F(InstructionSelectorTest, CmnWithImmediateOnLeft) { - TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpInstructions) { + TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpEqualityInstructions) { TRACED_FOREACH(int32_t, imm, kAddSubImmediates) { // kEqual and kNotEqual trigger the cbz/cbnz optimization, which // is tested elsewhere. if (cmp.cond == kEqual || cmp.cond == kNotEqual) continue; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); Node* sub = m.Int32Sub(m.Int32Constant(0), m.Parameter(0)); - RawMachineLabel a, b; - m.Branch((m.*cmp.mi.constructor)(m.Int32Constant(imm), sub), &a, &b); - m.Bind(&a); - m.Return(m.Int32Constant(1)); - m.Bind(&b); - m.Return(m.Int32Constant(0)); + m.Return((m.*cmp.mi.constructor)(m.Int32Constant(imm), sub)); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); EXPECT_EQ(kArm64Cmn32, s[0]->arch_opcode()); ASSERT_LE(2U, s[0]->InputCount()); - EXPECT_EQ(kFlags_branch, s[0]->flags_mode()); + EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(cmp.cond, s[0]->flags_condition()); EXPECT_EQ(imm, s.ToInt32(s[0]->InputAt(1))); } @@ -3244,7 +3271,7 @@ TEST_F(InstructionSelectorTest, CmpSignedExtendByteOnLeft) { } TEST_F(InstructionSelectorTest, CmnSignedExtendByteOnLeft) { - TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpInstructions) { + TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpEqualityInstructions) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), MachineType::Int32()); Node* sub = m.Int32Sub(m.Int32Constant(0), m.Parameter(0)); @@ -3294,7 +3321,7 @@ TEST_F(InstructionSelectorTest, CmpShiftByImmediateOnLeft) { } TEST_F(InstructionSelectorTest, CmnShiftByImmediateOnLeft) { - TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpInstructions) { + TRACED_FOREACH(IntegerCmp, cmp, kIntegerCmpEqualityInstructions) { TRACED_FOREACH(Shift, shift, kShiftInstructions) { // Only test relevant shifted operands. if (shift.mi.machine_type != MachineType::Int32()) continue; @@ -3408,21 +3435,15 @@ TEST_P(InstructionSelectorFlagSettingTest, CmpZeroRight) { TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), MachineType::Int32()); - RawMachineLabel a, b; Node* binop = (m.*inst.mi.constructor)(m.Parameter(0), m.Parameter(1)); - Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0)); - m.Branch(comp, &a, &b); - m.Bind(&a); - m.Return(m.Int32Constant(1)); - m.Bind(&b); - m.Return(m.Int32Constant(0)); + m.Return((m.*cmp.mi.constructor)(binop, m.Int32Constant(0))); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); - ASSERT_EQ(4U, s[0]->InputCount()); // The labels are also inputs. + ASSERT_EQ(2U, s[0]->InputCount()); EXPECT_EQ(inst.no_output_opcode, s[0]->arch_opcode()); EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0))); EXPECT_EQ(s.ToVreg(m.Parameter(1)), s.ToVreg(s[0]->InputAt(1))); - EXPECT_EQ(kFlags_branch, s[0]->flags_mode()); + EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(cmp.cond, s[0]->flags_condition()); } } @@ -3433,21 +3454,15 @@ TEST_P(InstructionSelectorFlagSettingTest, CmpZeroLeft) { TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroLeftInstructions) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), MachineType::Int32()); - RawMachineLabel a, b; Node* binop = (m.*inst.mi.constructor)(m.Parameter(0), m.Parameter(1)); - Node* comp = (m.*cmp.mi.constructor)(m.Int32Constant(0), binop); - m.Branch(comp, &a, &b); - m.Bind(&a); - m.Return(m.Int32Constant(1)); - m.Bind(&b); - m.Return(m.Int32Constant(0)); + m.Return((m.*cmp.mi.constructor)(m.Int32Constant(0), binop)); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); - ASSERT_EQ(4U, s[0]->InputCount()); // The labels are also inputs. + ASSERT_EQ(2U, s[0]->InputCount()); EXPECT_EQ(inst.no_output_opcode, s[0]->arch_opcode()); EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0))); EXPECT_EQ(s.ToVreg(m.Parameter(1)), s.ToVreg(s[0]->InputAt(1))); - EXPECT_EQ(kFlags_branch, s[0]->flags_mode()); + EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(cmp.cond, s[0]->flags_condition()); } } @@ -3456,25 +3471,23 @@ TEST_P(InstructionSelectorFlagSettingTest, CmpZeroOnlyUserInBasicBlock) { const FlagSettingInst inst = GetParam(); // Binop with additional users, but in a different basic block. TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) { - // For kEqual and kNotEqual, we generate a cbz or cbnz. - if (cmp.cond == kEqual || cmp.cond == kNotEqual) continue; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), MachineType::Int32()); RawMachineLabel a, b; Node* binop = (m.*inst.mi.constructor)(m.Parameter(0), m.Parameter(1)); Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0)); - m.Branch(comp, &a, &b); + m.Branch(m.Parameter(0), &a, &b); m.Bind(&a); m.Return(binop); m.Bind(&b); - m.Return(m.Int32Constant(0)); + m.Return(comp); Stream s = m.Build(); - ASSERT_EQ(1U, s.size()); - ASSERT_EQ(4U, s[0]->InputCount()); // The labels are also inputs. + ASSERT_EQ(2U, s.size()); // Flag-setting instruction and branch. + ASSERT_EQ(2U, s[0]->InputCount()); EXPECT_EQ(inst.mi.arch_opcode, s[0]->arch_opcode()); EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0))); EXPECT_EQ(s.ToVreg(m.Parameter(1)), s.ToVreg(s[0]->InputAt(1))); - EXPECT_EQ(kFlags_branch, s[0]->flags_mode()); + EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(cmp.cond, s[0]->flags_condition()); } } @@ -3483,8 +3496,6 @@ TEST_P(InstructionSelectorFlagSettingTest, ShiftedOperand) { const FlagSettingInst inst = GetParam(); // Like the test above, but with a shifted input to the binary operator. TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) { - // For kEqual and kNotEqual, we generate a cbz or cbnz. - if (cmp.cond == kEqual || cmp.cond == kNotEqual) continue; StreamBuilder m(this, MachineType::Int32(), MachineType::Int32(), MachineType::Int32()); RawMachineLabel a, b; @@ -3492,20 +3503,20 @@ TEST_P(InstructionSelectorFlagSettingTest, ShiftedOperand) { Node* shift = m.Word32Shl(m.Parameter(1), imm); Node* binop = (m.*inst.mi.constructor)(m.Parameter(0), shift); Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0)); - m.Branch(comp, &a, &b); + m.Branch(m.Parameter(0), &a, &b); m.Bind(&a); m.Return(binop); m.Bind(&b); - m.Return(m.Int32Constant(0)); + m.Return(comp); Stream s = m.Build(); - ASSERT_EQ(1U, s.size()); - ASSERT_EQ(5U, s[0]->InputCount()); // The labels are also inputs. + ASSERT_EQ(2U, s.size()); // Flag-setting instruction and branch. + ASSERT_EQ(3U, s[0]->InputCount()); EXPECT_EQ(inst.mi.arch_opcode, s[0]->arch_opcode()); EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0))); EXPECT_EQ(s.ToVreg(m.Parameter(1)), s.ToVreg(s[0]->InputAt(1))); EXPECT_EQ(5, s.ToInt32(s[0]->InputAt(2))); EXPECT_EQ(kMode_Operand2_R_LSL_I, s[0]->addressing_mode()); - EXPECT_EQ(kFlags_branch, s[0]->flags_mode()); + EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(cmp.cond, s[0]->flags_condition()); } } @@ -3521,19 +3532,18 @@ TEST_P(InstructionSelectorFlagSettingTest, UsersInSameBasicBlock) { Node* binop = (m.*inst.mi.constructor)(m.Parameter(0), m.Parameter(1)); Node* mul = m.Int32Mul(m.Parameter(0), binop); Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0)); - m.Branch(comp, &a, &b); + m.Branch(m.Parameter(0), &a, &b); m.Bind(&a); m.Return(mul); m.Bind(&b); - m.Return(m.Int32Constant(0)); + m.Return(comp); Stream s = m.Build(); - ASSERT_EQ(3U, s.size()); + ASSERT_EQ(4U, s.size()); // Includes the compare and branch instruction. EXPECT_EQ(inst.mi.arch_opcode, s[0]->arch_opcode()); - EXPECT_NE(kFlags_branch, s[0]->flags_mode()); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); EXPECT_EQ(kArm64Mul32, s[1]->arch_opcode()); - EXPECT_EQ(cmp.cond == kEqual ? kArm64CompareAndBranch32 : kArm64Cmp32, - s[2]->arch_opcode()); - EXPECT_EQ(kFlags_branch, s[2]->flags_mode()); + EXPECT_EQ(kArm64Cmp32, s[2]->arch_opcode()); + EXPECT_EQ(kFlags_set, s[2]->flags_mode()); EXPECT_EQ(cmp.cond, s[2]->flags_condition()); } } @@ -3543,23 +3553,18 @@ TEST_P(InstructionSelectorFlagSettingTest, CommuteImmediate) { // Immediate on left hand side of the binary operator. TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); - RawMachineLabel a, b; // 3 can be an immediate on both arithmetic and logical instructions. Node* imm = m.Int32Constant(3); Node* binop = (m.*inst.mi.constructor)(imm, m.Parameter(0)); Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0)); - m.Branch(comp, &a, &b); - m.Bind(&a); - m.Return(m.Int32Constant(1)); - m.Bind(&b); - m.Return(m.Int32Constant(0)); + m.Return(comp); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); - ASSERT_EQ(4U, s[0]->InputCount()); // The labels are also inputs. + ASSERT_EQ(2U, s[0]->InputCount()); EXPECT_EQ(inst.no_output_opcode, s[0]->arch_opcode()); EXPECT_EQ(s.ToVreg(m.Parameter(0)), s.ToVreg(s[0]->InputAt(0))); EXPECT_EQ(3, s.ToInt32(s[0]->InputAt(1))); - EXPECT_EQ(kFlags_branch, s[0]->flags_mode()); + EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(cmp.cond, s[0]->flags_condition()); } } @@ -3606,23 +3611,18 @@ TEST_F(InstructionSelectorTest, TstInvalidImmediate) { // Make sure we do not generate an invalid immediate for TST. TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) { StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); - RawMachineLabel a, b; // 5 is not a valid constant for TST. Node* imm = m.Int32Constant(5); Node* binop = m.Word32And(imm, m.Parameter(0)); Node* comp = (m.*cmp.mi.constructor)(binop, m.Int32Constant(0)); - m.Branch(comp, &a, &b); - m.Bind(&a); - m.Return(m.Int32Constant(1)); - m.Bind(&b); - m.Return(m.Int32Constant(0)); + m.Return(comp); Stream s = m.Build(); ASSERT_EQ(1U, s.size()); - ASSERT_EQ(4U, s[0]->InputCount()); // The labels are also inputs. + ASSERT_EQ(2U, s[0]->InputCount()); EXPECT_EQ(kArm64Tst32, s[0]->arch_opcode()); EXPECT_NE(InstructionOperand::IMMEDIATE, s[0]->InputAt(0)->kind()); EXPECT_NE(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); - EXPECT_EQ(kFlags_branch, s[0]->flags_mode()); + EXPECT_EQ(kFlags_set, s[0]->flags_mode()); EXPECT_EQ(cmp.cond, s[0]->flags_condition()); } } @@ -4311,6 +4311,74 @@ TEST_F(InstructionSelectorTest, LoadAndShiftRight) { } } +TEST_F(InstructionSelectorTest, CompareAgainstZero32) { + TRACED_FOREACH(IntegerCmp, cmp, kBinopCmpZeroRightInstructions) { + StreamBuilder m(this, MachineType::Int32(), MachineType::Int32()); + Node* const param = m.Parameter(0); + RawMachineLabel a, b; + m.Branch((m.*cmp.mi.constructor)(param, m.Int32Constant(0)), &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(s.ToVreg(param), s.ToVreg(s[0]->InputAt(0))); + if (cmp.cond == kNegative || cmp.cond == kPositiveOrZero) { + EXPECT_EQ(kArm64TestAndBranch32, s[0]->arch_opcode()); + EXPECT_EQ(4U, s[0]->InputCount()); // The labels are also inputs. + EXPECT_EQ((cmp.cond == kNegative) ? kNotEqual : kEqual, + s[0]->flags_condition()); + EXPECT_EQ(InstructionOperand::IMMEDIATE, s[0]->InputAt(1)->kind()); + EXPECT_EQ(31, s.ToInt32(s[0]->InputAt(1))); + } else { + EXPECT_EQ(kArm64CompareAndBranch32, s[0]->arch_opcode()); + EXPECT_EQ(3U, s[0]->InputCount()); // The labels are also inputs. + EXPECT_EQ(cmp.cond, s[0]->flags_condition()); + } + } +} + +TEST_F(InstructionSelectorTest, CompareFloat64HighLessThanZero64) { + StreamBuilder m(this, MachineType::Int32(), MachineType::Float64()); + Node* const param = m.Parameter(0); + Node* const high = m.Float64ExtractHighWord32(param); + RawMachineLabel a, b; + m.Branch(m.Int32LessThan(high, m.Int32Constant(0)), &a, &b); + m.Bind(&a); + m.Return(m.Int32Constant(1)); + m.Bind(&b); + m.Return(m.Int32Constant(0)); + Stream s = m.Build(); + ASSERT_EQ(2U, s.size()); + EXPECT_EQ(kArm64U64MoveFloat64, s[0]->arch_opcode()); + EXPECT_EQ(kArm64TestAndBranch, s[1]->arch_opcode()); + EXPECT_EQ(kNotEqual, s[1]->flags_condition()); + EXPECT_EQ(4U, s[1]->InputCount()); + EXPECT_EQ(InstructionOperand::IMMEDIATE, s[1]->InputAt(1)->kind()); + EXPECT_EQ(63, s.ToInt32(s[1]->InputAt(1))); +} + +TEST_F(InstructionSelectorTest, CompareFloat64HighGreaterThanOrEqualZero64) { + StreamBuilder m(this, MachineType::Int32(), MachineType::Float64()); + Node* const param = m.Parameter(0); + Node* const high = m.Float64ExtractHighWord32(param); + RawMachineLabel a, b; + m.Branch(m.Int32GreaterThanOrEqual(high, m.Int32Constant(0)), &a, &b); + m.Bind(&a); + m.Return(m.Int32Constant(1)); + m.Bind(&b); + m.Return(m.Int32Constant(0)); + Stream s = m.Build(); + ASSERT_EQ(2U, s.size()); + EXPECT_EQ(kArm64U64MoveFloat64, s[0]->arch_opcode()); + EXPECT_EQ(kArm64TestAndBranch, s[1]->arch_opcode()); + EXPECT_EQ(kEqual, s[1]->flags_condition()); + EXPECT_EQ(4U, s[1]->InputCount()); + EXPECT_EQ(InstructionOperand::IMMEDIATE, s[1]->InputAt(1)->kind()); + EXPECT_EQ(63, s.ToInt32(s[1]->InputAt(1))); +} + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/compiler/branch-elimination-unittest.cc b/deps/v8/test/unittests/compiler/branch-elimination-unittest.cc index fcd702c428..9486d1fe6e 100644 --- a/deps/v8/test/unittests/compiler/branch-elimination-unittest.cc +++ b/deps/v8/test/unittests/compiler/branch-elimination-unittest.cc @@ -15,7 +15,7 @@ namespace v8 { namespace internal { namespace compiler { -class BranchEliminationTest : public TypedGraphTest { +class BranchEliminationTest : public GraphTest { public: BranchEliminationTest() : machine_(zone(), MachineType::PointerRepresentation(), 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 f51a54d074..d284772395 100644 --- a/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/common-operator-reducer-unittest.cc @@ -158,6 +158,26 @@ TEST_F(CommonOperatorReducerTest, BranchWithBooleanNot) { } } +TEST_F(CommonOperatorReducerTest, BranchWithSelect) { + Node* const value = Parameter(0); + TRACED_FOREACH(BranchHint, hint, kBranchHints) { + Node* const control = graph()->start(); + Node* const branch = graph()->NewNode( + common()->Branch(hint), + graph()->NewNode(common()->Select(MachineRepresentation::kTagged), + value, FalseConstant(), TrueConstant()), + control); + Node* const if_true = graph()->NewNode(common()->IfTrue(), branch); + Node* const if_false = graph()->NewNode(common()->IfFalse(), branch); + Reduction const r = Reduce(branch); + ASSERT_TRUE(r.Changed()); + EXPECT_EQ(branch, r.replacement()); + EXPECT_THAT(branch, IsBranch(value, control)); + EXPECT_THAT(if_false, IsIfTrue(branch)); + EXPECT_THAT(if_true, IsIfFalse(branch)); + EXPECT_EQ(NegateBranchHint(hint), BranchHintOf(branch->op())); + } +} // ----------------------------------------------------------------------------- // Merge diff --git a/deps/v8/test/unittests/compiler/control-equivalence-unittest.cc b/deps/v8/test/unittests/compiler/control-equivalence-unittest.cc index a87f760c82..6534e90ccc 100644 --- a/deps/v8/test/unittests/compiler/control-equivalence-unittest.cc +++ b/deps/v8/test/unittests/compiler/control-equivalence-unittest.cc @@ -2,12 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "src/bit-vector.h" #include "src/compiler/control-equivalence.h" +#include "src/bit-vector.h" #include "src/compiler/graph-visualizer.h" #include "src/compiler/node-properties.h" #include "src/compiler/source-position.h" -#include "src/zone-containers.h" +#include "src/zone/zone-containers.h" #include "test/unittests/compiler/graph-unittest.h" namespace v8 { diff --git a/deps/v8/test/unittests/compiler/effect-control-linearizer-unittest.cc b/deps/v8/test/unittests/compiler/effect-control-linearizer-unittest.cc index 71a8696d09..0a12ea371a 100644 --- a/deps/v8/test/unittests/compiler/effect-control-linearizer-unittest.cc +++ b/deps/v8/test/unittests/compiler/effect-control-linearizer-unittest.cc @@ -21,10 +21,10 @@ namespace compiler { using testing::Capture; -class EffectControlLinearizerTest : public TypedGraphTest { +class EffectControlLinearizerTest : public GraphTest { public: EffectControlLinearizerTest() - : TypedGraphTest(3), + : GraphTest(3), machine_(zone()), javascript_(zone()), simplified_(zone()), diff --git a/deps/v8/test/unittests/compiler/escape-analysis-unittest.cc b/deps/v8/test/unittests/compiler/escape-analysis-unittest.cc index 990b813947..3a233d6872 100644 --- a/deps/v8/test/unittests/compiler/escape-analysis-unittest.cc +++ b/deps/v8/test/unittests/compiler/escape-analysis-unittest.cc @@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "src/bit-vector.h" #include "src/compiler/escape-analysis.h" +#include "src/bit-vector.h" #include "src/compiler/escape-analysis-reducer.h" #include "src/compiler/graph-visualizer.h" #include "src/compiler/js-graph.h" #include "src/compiler/node-properties.h" #include "src/compiler/simplified-operator.h" -#include "src/types.h" -#include "src/zone-containers.h" +#include "src/compiler/types.h" +#include "src/zone/zone-containers.h" #include "test/unittests/compiler/graph-unittest.h" namespace v8 { namespace internal { namespace compiler { -class EscapeAnalysisTest : public GraphTest { +class EscapeAnalysisTest : public TypedGraphTest { public: EscapeAnalysisTest() : simplified_(zone()), @@ -468,8 +468,7 @@ TEST_F(EscapeAnalysisTest, DeoptReplacement) { ASSERT_EQ(object1, NodeProperties::GetValueInput(object_state, 0)); } - -TEST_F(EscapeAnalysisTest, DeoptReplacementIdentity) { +TEST_F(EscapeAnalysisTest, DISABLED_DeoptReplacementIdentity) { Node* object1 = Constant(1); BeginRegion(); Node* allocation = Allocate(Constant(kPointerSize * 2)); diff --git a/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc b/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc index d2953159fc..18ccaaaea5 100644 --- a/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc +++ b/deps/v8/test/unittests/compiler/instruction-selector-unittest.cc @@ -41,7 +41,8 @@ InstructionSelectorTest::Stream InstructionSelectorTest::StreamBuilder::Build( SourcePositionTable source_position_table(graph()); InstructionSelector selector(test_->zone(), node_count, &linkage, &sequence, schedule, &source_position_table, nullptr, - source_position_mode, features); + source_position_mode, features, + InstructionSelector::kDisableScheduling); selector.SelectInstructions(); if (FLAG_trace_turbo) { OFStream out(stdout); @@ -244,19 +245,13 @@ TARGET_TEST_F(InstructionSelectorTest, FinishRegion) { m.AddNode(m.common()->FinishRegion(), param, m.graph()->start()); m.Return(finish); Stream s = m.Build(kAllInstructions); - ASSERT_EQ(4U, s.size()); + ASSERT_EQ(3U, s.size()); EXPECT_EQ(kArchNop, s[0]->arch_opcode()); ASSERT_EQ(1U, s[0]->OutputCount()); ASSERT_TRUE(s[0]->Output()->IsUnallocated()); + EXPECT_EQ(kArchRet, s[1]->arch_opcode()); EXPECT_EQ(s.ToVreg(param), s.ToVreg(s[0]->Output())); - EXPECT_EQ(kArchNop, s[1]->arch_opcode()); - ASSERT_EQ(1U, s[1]->InputCount()); - ASSERT_TRUE(s[1]->InputAt(0)->IsUnallocated()); EXPECT_EQ(s.ToVreg(param), s.ToVreg(s[1]->InputAt(0))); - ASSERT_EQ(1U, s[1]->OutputCount()); - ASSERT_TRUE(s[1]->Output()->IsUnallocated()); - EXPECT_TRUE(UnallocatedOperand::cast(s[1]->Output())->HasSameAsInputPolicy()); - EXPECT_EQ(s.ToVreg(finish), s.ToVreg(s[1]->Output())); EXPECT_TRUE(s.IsReference(finish)); } diff --git a/deps/v8/test/unittests/compiler/js-builtin-reducer-unittest.cc b/deps/v8/test/unittests/compiler/js-builtin-reducer-unittest.cc index ed20e64194..48debc368c 100644 --- a/deps/v8/test/unittests/compiler/js-builtin-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-builtin-reducer-unittest.cc @@ -38,6 +38,15 @@ class JSBuiltinReducerTest : public TypedGraphTest { return reducer.Reduce(node); } + Node* GlobalFunction(const char* name) { + Handle<JSFunction> f = Handle<JSFunction>::cast( + Object::GetProperty( + isolate()->global_object(), + isolate()->factory()->NewStringFromAsciiChecked(name)) + .ToHandleChecked()); + return HeapConstant(f); + } + Node* MathFunction(const char* name) { Handle<Object> m = JSObject::GetProperty(isolate()->global_object(), @@ -101,6 +110,91 @@ Type* const kNumberTypes[] = { // ----------------------------------------------------------------------------- +// isFinite + +TEST_F(JSBuiltinReducerTest, GlobalIsFiniteWithNumber) { + Node* function = GlobalFunction("isFinite"); + + Node* effect = graph()->start(); + Node* control = graph()->start(); + Node* context = UndefinedConstant(); + Node* frame_state = graph()->start(); + TRACED_FOREACH(Type*, t0, kNumberTypes) { + Node* p0 = Parameter(t0, 0); + Node* call = graph()->NewNode(javascript()->CallFunction(3), function, + UndefinedConstant(), p0, context, frame_state, + effect, control); + Reduction r = Reduce(call); + + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsNumberEqual(IsNumberSubtract(p0, p0), + IsNumberSubtract(p0, p0))); + } +} + +TEST_F(JSBuiltinReducerTest, GlobalIsFiniteWithPlainPrimitive) { + Node* function = GlobalFunction("isFinite"); + + Node* effect = graph()->start(); + Node* control = graph()->start(); + Node* context = UndefinedConstant(); + Node* frame_state = graph()->start(); + Node* p0 = Parameter(Type::PlainPrimitive(), 0); + Node* call = graph()->NewNode(javascript()->CallFunction(3), function, + UndefinedConstant(), p0, context, frame_state, + effect, control); + Reduction r = Reduce(call); + + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), + IsNumberEqual(IsNumberSubtract(IsPlainPrimitiveToNumber(p0), + IsPlainPrimitiveToNumber(p0)), + IsNumberSubtract(IsPlainPrimitiveToNumber(p0), + IsPlainPrimitiveToNumber(p0)))); +} + +// ----------------------------------------------------------------------------- +// isNaN + +TEST_F(JSBuiltinReducerTest, GlobalIsNaNWithNumber) { + Node* function = GlobalFunction("isNaN"); + + Node* effect = graph()->start(); + Node* control = graph()->start(); + Node* context = UndefinedConstant(); + Node* frame_state = graph()->start(); + TRACED_FOREACH(Type*, t0, kNumberTypes) { + Node* p0 = Parameter(t0, 0); + Node* call = graph()->NewNode(javascript()->CallFunction(3), function, + UndefinedConstant(), p0, context, frame_state, + effect, control); + Reduction r = Reduce(call); + + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsBooleanNot(IsNumberEqual(p0, p0))); + } +} + +TEST_F(JSBuiltinReducerTest, GlobalIsNaNWithPlainPrimitive) { + Node* function = GlobalFunction("isNaN"); + + Node* effect = graph()->start(); + Node* control = graph()->start(); + Node* context = UndefinedConstant(); + Node* frame_state = graph()->start(); + Node* p0 = Parameter(Type::PlainPrimitive(), 0); + Node* call = graph()->NewNode(javascript()->CallFunction(3), function, + UndefinedConstant(), p0, context, frame_state, + effect, control); + Reduction r = Reduce(call); + + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), + IsBooleanNot(IsNumberEqual(IsPlainPrimitiveToNumber(p0), + IsPlainPrimitiveToNumber(p0)))); +} + +// ----------------------------------------------------------------------------- // Math.abs TEST_F(JSBuiltinReducerTest, MathAbsWithNumber) { @@ -1315,6 +1409,97 @@ TEST_F(JSBuiltinReducerTest, MathTruncWithPlainPrimitive) { } // ----------------------------------------------------------------------------- +// Number.isFinite + +TEST_F(JSBuiltinReducerTest, NumberIsFiniteWithNumber) { + Node* function = NumberFunction("isFinite"); + + Node* effect = graph()->start(); + Node* control = graph()->start(); + Node* context = UndefinedConstant(); + Node* frame_state = graph()->start(); + TRACED_FOREACH(Type*, t0, kNumberTypes) { + Node* p0 = Parameter(t0, 0); + Node* call = graph()->NewNode(javascript()->CallFunction(3), function, + UndefinedConstant(), p0, context, frame_state, + effect, control); + Reduction r = Reduce(call); + + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsNumberEqual(IsNumberSubtract(p0, p0), + IsNumberSubtract(p0, p0))); + } +} + +// ----------------------------------------------------------------------------- +// Number.isInteger + +TEST_F(JSBuiltinReducerTest, NumberIsIntegerWithNumber) { + Node* function = NumberFunction("isInteger"); + + Node* effect = graph()->start(); + Node* control = graph()->start(); + Node* context = UndefinedConstant(); + Node* frame_state = graph()->start(); + TRACED_FOREACH(Type*, t0, kNumberTypes) { + Node* p0 = Parameter(t0, 0); + Node* call = graph()->NewNode(javascript()->CallFunction(3), function, + UndefinedConstant(), p0, context, frame_state, + effect, control); + Reduction r = Reduce(call); + + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), + IsNumberEqual(IsNumberSubtract(p0, IsNumberTrunc(p0)), + IsNumberConstant(0.0))); + } +} + +// ----------------------------------------------------------------------------- +// Number.isNaN + +TEST_F(JSBuiltinReducerTest, NumberIsNaNWithNumber) { + Node* function = NumberFunction("isNaN"); + + Node* effect = graph()->start(); + Node* control = graph()->start(); + Node* context = UndefinedConstant(); + Node* frame_state = graph()->start(); + TRACED_FOREACH(Type*, t0, kNumberTypes) { + Node* p0 = Parameter(t0, 0); + Node* call = graph()->NewNode(javascript()->CallFunction(3), function, + UndefinedConstant(), p0, context, frame_state, + effect, control); + Reduction r = Reduce(call); + + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsBooleanNot(IsNumberEqual(p0, p0))); + } +} + +// ----------------------------------------------------------------------------- +// Number.isSafeInteger + +TEST_F(JSBuiltinReducerTest, NumberIsSafeIntegerWithIntegral32) { + Node* function = NumberFunction("isSafeInteger"); + + Node* effect = graph()->start(); + Node* control = graph()->start(); + Node* context = UndefinedConstant(); + Node* frame_state = graph()->start(); + TRACED_FOREACH(Type*, t0, kIntegral32Types) { + Node* p0 = Parameter(t0, 0); + Node* call = graph()->NewNode(javascript()->CallFunction(3), function, + UndefinedConstant(), p0, context, frame_state, + effect, control); + Reduction r = Reduce(call); + + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsTrueConstant()); + } +} + +// ----------------------------------------------------------------------------- // Number.parseInt TEST_F(JSBuiltinReducerTest, NumberParseIntWithIntegral32) { diff --git a/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc b/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc index 9c001e9eb2..ebb1633401 100644 --- a/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-create-lowering-unittest.cc @@ -40,7 +40,8 @@ class JSCreateLoweringTest : public TypedGraphTest { // TODO(titzer): mock the GraphReducer here for better unit testing. GraphReducer graph_reducer(zone(), graph()); JSCreateLowering reducer(&graph_reducer, &deps_, &jsgraph, - MaybeHandle<LiteralsArray>(), zone()); + MaybeHandle<LiteralsArray>(), + MaybeHandle<Context>(), zone()); return reducer.Reduce(node); } @@ -174,14 +175,15 @@ TEST_F(JSCreateLoweringTest, JSCreateFunctionContextViaInlinedAllocation) { // JSCreateWithContext TEST_F(JSCreateLoweringTest, JSCreateWithContext) { + Handle<ScopeInfo> scope_info(factory()->NewScopeInfo(1)); Node* const object = Parameter(Type::Receiver()); Node* const closure = Parameter(Type::Function()); Node* const context = Parameter(Type::Any()); Node* const effect = graph()->start(); Node* const control = graph()->start(); Reduction r = - Reduce(graph()->NewNode(javascript()->CreateWithContext(), object, - closure, context, effect, control)); + Reduce(graph()->NewNode(javascript()->CreateWithContext(scope_info), + object, closure, context, effect, control)); ASSERT_TRUE(r.Changed()); EXPECT_THAT(r.replacement(), IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( @@ -195,14 +197,15 @@ TEST_F(JSCreateLoweringTest, JSCreateWithContext) { TEST_F(JSCreateLoweringTest, JSCreateCatchContext) { Handle<String> name = factory()->length_string(); + Handle<ScopeInfo> scope_info(factory()->NewScopeInfo(1)); Node* const exception = Parameter(Type::Receiver()); Node* const closure = Parameter(Type::Function()); Node* const context = Parameter(Type::Any()); Node* const effect = graph()->start(); Node* const control = graph()->start(); - Reduction r = - Reduce(graph()->NewNode(javascript()->CreateCatchContext(name), exception, - closure, context, effect, control)); + Reduction r = Reduce( + graph()->NewNode(javascript()->CreateCatchContext(name, scope_info), + exception, closure, context, effect, control)); ASSERT_TRUE(r.Changed()); EXPECT_THAT(r.replacement(), IsFinishRegion(IsAllocate(IsNumberConstant(Context::SizeFor( diff --git a/deps/v8/test/unittests/compiler/js-operator-unittest.cc b/deps/v8/test/unittests/compiler/js-operator-unittest.cc index 3b83d691f1..853249785e 100644 --- a/deps/v8/test/unittests/compiler/js-operator-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-operator-unittest.cc @@ -46,7 +46,6 @@ const SharedOperator kSharedOperators[] = { SHARED(ToObject, Operator::kFoldable, 1, 1, 1, 1, 1, 1, 2), SHARED(Create, Operator::kEliminatable, 2, 1, 1, 0, 1, 1, 0), SHARED(TypeOf, Operator::kPure, 1, 0, 0, 0, 1, 0, 0), - SHARED(CreateWithContext, Operator::kNoProperties, 2, 0, 1, 1, 1, 1, 2), #undef SHARED }; diff --git a/deps/v8/test/unittests/compiler/js-type-feedback-unittest.cc b/deps/v8/test/unittests/compiler/js-type-feedback-unittest.cc deleted file mode 100644 index dece25def1..0000000000 --- a/deps/v8/test/unittests/compiler/js-type-feedback-unittest.cc +++ /dev/null @@ -1,336 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "src/compiler.h" - -#include "src/compiler/access-builder.h" -#include "src/compiler/js-graph.h" -#include "src/compiler/js-operator.h" -#include "src/compiler/js-type-feedback.h" -#include "src/compiler/machine-operator.h" -#include "src/compiler/node-matchers.h" -#include "src/compiler/node-properties.h" -#include "src/compiler/operator-properties.h" - -#include "test/unittests/compiler/compiler-test-utils.h" -#include "test/unittests/compiler/graph-unittest.h" -#include "test/unittests/compiler/node-test-utils.h" -#include "testing/gmock-support.h" - -using testing::Capture; - - -namespace v8 { -namespace internal { -namespace compiler { - -class JSTypeFeedbackTest : public TypedGraphTest { - public: - JSTypeFeedbackTest() - : TypedGraphTest(3), - javascript_(zone()), - dependencies_(isolate(), zone()) {} - ~JSTypeFeedbackTest() override { dependencies_.Rollback(); } - - protected: - Reduction Reduce(Node* node, - JSTypeFeedbackSpecializer::DeoptimizationMode mode) { - Handle<GlobalObject> global_object( - isolate()->native_context()->global_object(), isolate()); - - MachineOperatorBuilder machine(zone()); - SimplifiedOperatorBuilder simplified(zone()); - JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified, - &machine); - JSTypeFeedbackTable table(zone()); - // TODO(titzer): mock the GraphReducer here for better unit testing. - GraphReducer graph_reducer(zone(), graph()); - JSTypeFeedbackSpecializer reducer(&graph_reducer, &jsgraph, &table, nullptr, - global_object, mode, &dependencies_); - return reducer.Reduce(node); - } - - Node* EmptyFrameState() { - MachineOperatorBuilder machine(zone()); - JSGraph jsgraph(isolate(), graph(), common(), javascript(), nullptr, - &machine); - return jsgraph.EmptyFrameState(); - } - - JSOperatorBuilder* javascript() { return &javascript_; } - - void SetGlobalProperty(const char* string, int value) { - SetGlobalProperty(string, Handle<Smi>(Smi::FromInt(value), isolate())); - } - - void SetGlobalProperty(const char* string, double value) { - SetGlobalProperty(string, isolate()->factory()->NewNumber(value)); - } - - void SetGlobalProperty(const char* string, Handle<Object> value) { - Handle<JSObject> global(isolate()->context()->global_object(), isolate()); - Handle<String> name = - isolate()->factory()->NewStringFromAsciiChecked(string); - MaybeHandle<Object> result = - JSReceiver::SetProperty(global, name, value, SLOPPY); - result.Assert(); - } - - Node* ReturnLoadNamedFromGlobal( - const char* string, Node* effect, Node* control, - JSTypeFeedbackSpecializer::DeoptimizationMode mode) { - VectorSlotPair feedback; - Node* vector = UndefinedConstant(); - Node* context = UndefinedConstant(); - - Handle<Name> name = isolate()->factory()->InternalizeUtf8String(string); - const Operator* op = javascript()->LoadGlobal(name, feedback); - Node* load = graph()->NewNode(op, vector, context, EmptyFrameState(), - EmptyFrameState(), effect, control); - Node* if_success = graph()->NewNode(common()->IfSuccess(), load); - return graph()->NewNode(common()->Return(), load, load, if_success); - } - - CompilationDependencies* dependencies() { return &dependencies_; } - - private: - JSOperatorBuilder javascript_; - CompilationDependencies dependencies_; -}; - - -TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstSmi) { - const int kValue = 111; - const char* kName = "banana"; - SetGlobalProperty(kName, kValue); - - Node* ret = ReturnLoadNamedFromGlobal( - kName, graph()->start(), graph()->start(), - JSTypeFeedbackSpecializer::kDeoptimizationDisabled); - graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); - - Reduction r = Reduce(ret->InputAt(0), - JSTypeFeedbackSpecializer::kDeoptimizationDisabled); - EXPECT_FALSE(r.Changed()); - EXPECT_TRUE(dependencies()->IsEmpty()); -} - - -TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstSmiWithDeoptimization) { - const int kValue = 111; - const char* kName = "banana"; - SetGlobalProperty(kName, kValue); - - Node* ret = ReturnLoadNamedFromGlobal( - kName, graph()->start(), graph()->start(), - JSTypeFeedbackSpecializer::kDeoptimizationEnabled); - graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); - - Reduction r = Reduce(ret->InputAt(0), - JSTypeFeedbackSpecializer::kDeoptimizationEnabled); - - // Check LoadNamed(global) => HeapConstant[kValue] - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsNumberConstant(kValue)); - - EXPECT_THAT(ret, IsReturn(IsNumberConstant(kValue), graph()->start(), - graph()->start())); - EXPECT_THAT(graph()->end(), IsEnd(ret)); - - EXPECT_FALSE(dependencies()->IsEmpty()); - dependencies()->Rollback(); -} - - -TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstNumber) { - const double kValue = -11.25; - const char* kName = "kiwi"; - SetGlobalProperty(kName, kValue); - - Node* ret = ReturnLoadNamedFromGlobal( - kName, graph()->start(), graph()->start(), - JSTypeFeedbackSpecializer::kDeoptimizationDisabled); - graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); - - Reduction r = Reduce(ret->InputAt(0), - JSTypeFeedbackSpecializer::kDeoptimizationDisabled); - - EXPECT_FALSE(r.Changed()); - EXPECT_TRUE(dependencies()->IsEmpty()); -} - - -TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstNumberWithDeoptimization) { - const double kValue = -11.25; - const char* kName = "kiwi"; - SetGlobalProperty(kName, kValue); - - Node* ret = ReturnLoadNamedFromGlobal( - kName, graph()->start(), graph()->start(), - JSTypeFeedbackSpecializer::kDeoptimizationEnabled); - graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); - - Reduction r = Reduce(ret->InputAt(0), - JSTypeFeedbackSpecializer::kDeoptimizationEnabled); - - // Check LoadNamed(global) => HeapConstant[kValue] - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsNumberConstant(kValue)); - - EXPECT_THAT(ret, IsReturn(IsNumberConstant(kValue), graph()->start(), - graph()->start())); - EXPECT_THAT(graph()->end(), IsEnd(ret)); - - EXPECT_FALSE(dependencies()->IsEmpty()); -} - - -TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstString) { - Handle<HeapObject> kValue = isolate()->factory()->undefined_string(); - const char* kName = "mango"; - SetGlobalProperty(kName, kValue); - - Node* ret = ReturnLoadNamedFromGlobal( - kName, graph()->start(), graph()->start(), - JSTypeFeedbackSpecializer::kDeoptimizationDisabled); - graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); - - Reduction r = Reduce(ret->InputAt(0), - JSTypeFeedbackSpecializer::kDeoptimizationDisabled); - ASSERT_FALSE(r.Changed()); - EXPECT_TRUE(dependencies()->IsEmpty()); -} - - -TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalConstStringWithDeoptimization) { - Handle<HeapObject> kValue = isolate()->factory()->undefined_string(); - const char* kName = "mango"; - SetGlobalProperty(kName, kValue); - - Node* ret = ReturnLoadNamedFromGlobal( - kName, graph()->start(), graph()->start(), - JSTypeFeedbackSpecializer::kDeoptimizationEnabled); - graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); - - Reduction r = Reduce(ret->InputAt(0), - JSTypeFeedbackSpecializer::kDeoptimizationEnabled); - - // Check LoadNamed(global) => HeapConstant[kValue] - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsHeapConstant(kValue)); - - EXPECT_THAT(ret, IsReturn(IsHeapConstant(kValue), graph()->start(), - graph()->start())); - EXPECT_THAT(graph()->end(), IsEnd(ret)); - - EXPECT_FALSE(dependencies()->IsEmpty()); - dependencies()->Rollback(); -} - - -TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalPropertyCellSmi) { - const char* kName = "melon"; - SetGlobalProperty(kName, 123); - SetGlobalProperty(kName, 124); - - Node* ret = ReturnLoadNamedFromGlobal( - kName, graph()->start(), graph()->start(), - JSTypeFeedbackSpecializer::kDeoptimizationDisabled); - graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); - - Reduction r = Reduce(ret->InputAt(0), - JSTypeFeedbackSpecializer::kDeoptimizationDisabled); - ASSERT_FALSE(r.Changed()); - EXPECT_TRUE(dependencies()->IsEmpty()); -} - - -TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalPropertyCellSmiWithDeoptimization) { - const char* kName = "melon"; - SetGlobalProperty(kName, 123); - SetGlobalProperty(kName, 124); - - Node* ret = ReturnLoadNamedFromGlobal( - kName, graph()->start(), graph()->start(), - JSTypeFeedbackSpecializer::kDeoptimizationEnabled); - graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); - - Reduction r = Reduce(ret->InputAt(0), - JSTypeFeedbackSpecializer::kDeoptimizationEnabled); - - // Check LoadNamed(global) => LoadField[PropertyCell::value](cell) - ASSERT_TRUE(r.Changed()); - FieldAccess access = AccessBuilder::ForPropertyCellValue(); - Capture<Node*> cell_capture; - Matcher<Node*> load_field_match = IsLoadField( - access, CaptureEq(&cell_capture), graph()->start(), graph()->start()); - EXPECT_THAT(r.replacement(), load_field_match); - - HeapObjectMatcher cell(cell_capture.value()); - EXPECT_TRUE(cell.HasValue()); - EXPECT_TRUE(cell.Value()->IsPropertyCell()); - - EXPECT_THAT(ret, - IsReturn(load_field_match, load_field_match, graph()->start())); - EXPECT_THAT(graph()->end(), IsEnd(ret)); - - EXPECT_FALSE(dependencies()->IsEmpty()); - dependencies()->Rollback(); -} - - -TEST_F(JSTypeFeedbackTest, JSLoadNamedGlobalPropertyCellString) { - const char* kName = "pineapple"; - SetGlobalProperty(kName, isolate()->factory()->undefined_string()); - SetGlobalProperty(kName, isolate()->factory()->undefined_value()); - - Node* ret = ReturnLoadNamedFromGlobal( - kName, graph()->start(), graph()->start(), - JSTypeFeedbackSpecializer::kDeoptimizationDisabled); - graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); - - Reduction r = Reduce(ret->InputAt(0), - JSTypeFeedbackSpecializer::kDeoptimizationDisabled); - ASSERT_FALSE(r.Changed()); - EXPECT_TRUE(dependencies()->IsEmpty()); -} - - -TEST_F(JSTypeFeedbackTest, - JSLoadNamedGlobalPropertyCellStringWithDeoptimization) { - const char* kName = "pineapple"; - SetGlobalProperty(kName, isolate()->factory()->undefined_string()); - SetGlobalProperty(kName, isolate()->factory()->undefined_value()); - - Node* ret = ReturnLoadNamedFromGlobal( - kName, graph()->start(), graph()->start(), - JSTypeFeedbackSpecializer::kDeoptimizationEnabled); - graph()->SetEnd(graph()->NewNode(common()->End(1), ret)); - - Reduction r = Reduce(ret->InputAt(0), - JSTypeFeedbackSpecializer::kDeoptimizationEnabled); - - // Check LoadNamed(global) => LoadField[PropertyCell::value](cell) - ASSERT_TRUE(r.Changed()); - FieldAccess access = AccessBuilder::ForPropertyCellValue(); - Capture<Node*> cell_capture; - Matcher<Node*> load_field_match = IsLoadField( - access, CaptureEq(&cell_capture), graph()->start(), graph()->start()); - EXPECT_THAT(r.replacement(), load_field_match); - - HeapObjectMatcher cell(cell_capture.value()); - EXPECT_TRUE(cell.HasValue()); - EXPECT_TRUE(cell.Value()->IsPropertyCell()); - - EXPECT_THAT(ret, - IsReturn(load_field_match, load_field_match, graph()->start())); - EXPECT_THAT(graph()->end(), IsEnd(ret)); - - EXPECT_FALSE(dependencies()->IsEmpty()); - dependencies()->Rollback(); -} - -} // namespace compiler -} // namespace internal -} // namespace v8 diff --git a/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc b/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc index 72c582525e..ec1ff19880 100644 --- a/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc +++ b/deps/v8/test/unittests/compiler/js-typed-lowering-unittest.cc @@ -33,36 +33,8 @@ const ExternalArrayType kExternalArrayTypes[] = { kExternalInt16Array, kExternalUint32Array, kExternalInt32Array, kExternalFloat32Array, kExternalFloat64Array}; - -const double kFloat64Values[] = { - -V8_INFINITY, -4.23878e+275, -5.82632e+265, -6.60355e+220, -6.26172e+212, - -2.56222e+211, -4.82408e+201, -1.84106e+157, -1.63662e+127, -1.55772e+100, - -1.67813e+72, -2.3382e+55, -3.179e+30, -1.441e+09, -1.0647e+09, - -7.99361e+08, -5.77375e+08, -2.20984e+08, -32757, -13171, -9970, -3984, - -107, -105, -92, -77, -61, -0.000208163, -1.86685e-06, -1.17296e-10, - -9.26358e-11, -5.08004e-60, -1.74753e-65, -1.06561e-71, -5.67879e-79, - -5.78459e-130, -2.90989e-171, -7.15489e-243, -3.76242e-252, -1.05639e-263, - -4.40497e-267, -2.19666e-273, -4.9998e-276, -5.59821e-278, -2.03855e-282, - -5.99335e-283, -7.17554e-284, -3.11744e-309, -0.0, 0.0, 2.22507e-308, - 1.30127e-270, 7.62898e-260, 4.00313e-249, 3.16829e-233, 1.85244e-228, - 2.03544e-129, 1.35126e-110, 1.01182e-106, 5.26333e-94, 1.35292e-90, - 2.85394e-83, 1.78323e-77, 5.4967e-57, 1.03207e-25, 4.57401e-25, 1.58738e-05, - 2, 125, 2310, 9636, 14802, 17168, 28945, 29305, 4.81336e+07, 1.41207e+08, - 4.65962e+08, 1.40499e+09, 2.12648e+09, 8.80006e+30, 1.4446e+45, 1.12164e+54, - 2.48188e+89, 6.71121e+102, 3.074e+112, 4.9699e+152, 5.58383e+166, - 4.30654e+172, 7.08824e+185, 9.6586e+214, 2.028e+223, 6.63277e+243, - 1.56192e+261, 1.23202e+269, 5.72883e+289, 8.5798e+290, 1.40256e+294, - 1.79769e+308, V8_INFINITY}; - - const size_t kIndices[] = {0, 1, 42, 100, 1024}; - -const double kIntegerValues[] = {-V8_INFINITY, INT_MIN, -1000.0, -42.0, - -1.0, 0.0, 1.0, 42.0, - 1000.0, INT_MAX, UINT_MAX, V8_INFINITY}; - - Type* const kJSTypes[] = {Type::Undefined(), Type::Null(), Type::Boolean(), Type::Number(), Type::String(), Type::Object()}; @@ -112,100 +84,6 @@ class JSTypedLoweringTest : public TypedGraphTest { // ----------------------------------------------------------------------------- -// Constant propagation - - -TEST_F(JSTypedLoweringTest, ParameterWithMinusZero) { - { - Reduction r = Reduce( - Parameter(Type::Constant(factory()->minus_zero_value(), zone()))); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsNumberConstant(-0.0)); - } - { - Reduction r = Reduce(Parameter(Type::MinusZero())); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsNumberConstant(-0.0)); - } - { - Reduction r = Reduce(Parameter( - Type::Union(Type::MinusZero(), - Type::Constant(factory()->NewNumber(0), zone()), zone()))); - EXPECT_FALSE(r.Changed()); - } -} - - -TEST_F(JSTypedLoweringTest, ParameterWithNull) { - Handle<HeapObject> null = factory()->null_value(); - { - Reduction r = Reduce(Parameter(Type::Constant(null, zone()))); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsHeapConstant(null)); - } - { - Reduction r = Reduce(Parameter(Type::Null())); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsHeapConstant(null)); - } -} - - -TEST_F(JSTypedLoweringTest, ParameterWithNaN) { - const double kNaNs[] = {-std::numeric_limits<double>::quiet_NaN(), - std::numeric_limits<double>::quiet_NaN(), - std::numeric_limits<double>::signaling_NaN()}; - TRACED_FOREACH(double, nan, kNaNs) { - Handle<Object> constant = factory()->NewNumber(nan); - Reduction r = Reduce(Parameter(Type::Constant(constant, zone()))); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsNumberConstant(IsNaN())); - } - { - Reduction r = - Reduce(Parameter(Type::Constant(factory()->nan_value(), zone()))); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsNumberConstant(IsNaN())); - } - { - Reduction r = Reduce(Parameter(Type::NaN())); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsNumberConstant(IsNaN())); - } -} - - -TEST_F(JSTypedLoweringTest, ParameterWithPlainNumber) { - TRACED_FOREACH(double, value, kFloat64Values) { - Handle<Object> constant = factory()->NewNumber(value); - Reduction r = Reduce(Parameter(Type::Constant(constant, zone()))); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsNumberConstant(value)); - } - TRACED_FOREACH(double, value, kIntegerValues) { - Reduction r = Reduce(Parameter(Type::Range(value, value, zone()))); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsNumberConstant(value)); - } -} - - -TEST_F(JSTypedLoweringTest, ParameterWithUndefined) { - Handle<HeapObject> undefined = factory()->undefined_value(); - { - Reduction r = Reduce(Parameter(Type::Undefined())); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsHeapConstant(undefined)); - } - { - Reduction r = Reduce(Parameter(Type::Constant(undefined, zone()))); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsHeapConstant(undefined)); - } -} - - -// ----------------------------------------------------------------------------- // JSToBoolean @@ -219,60 +97,6 @@ TEST_F(JSTypedLoweringTest, JSToBooleanWithBoolean) { } -TEST_F(JSTypedLoweringTest, JSToBooleanWithFalsish) { - Node* input = Parameter( - Type::Union( - Type::MinusZero(), - Type::Union( - Type::NaN(), - Type::Union( - Type::Null(), - Type::Union( - Type::Undefined(), - Type::Union( - Type::Undetectable(), - Type::Union( - Type::Constant(factory()->false_value(), zone()), - Type::Range(0.0, 0.0, zone()), zone()), - zone()), - zone()), - zone()), - zone()), - zone()), - 0); - Node* context = Parameter(Type::Any(), 1); - Reduction r = Reduce(graph()->NewNode( - javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsFalseConstant()); -} - - -TEST_F(JSTypedLoweringTest, JSToBooleanWithTruish) { - Node* input = Parameter( - Type::Union( - Type::Constant(factory()->true_value(), zone()), - Type::Union(Type::DetectableReceiver(), Type::Symbol(), zone()), - zone()), - 0); - Node* context = Parameter(Type::Any(), 1); - Reduction r = Reduce(graph()->NewNode( - javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsTrueConstant()); -} - - -TEST_F(JSTypedLoweringTest, JSToBooleanWithNonZeroPlainNumber) { - Node* input = Parameter(Type::Range(1, V8_INFINITY, zone()), 0); - Node* context = Parameter(Type::Any(), 1); - Reduction r = Reduce(graph()->NewNode( - javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), IsTrueConstant()); -} - - TEST_F(JSTypedLoweringTest, JSToBooleanWithOrderedNumber) { Node* input = Parameter(Type::OrderedNumber(), 0); Node* context = Parameter(Type::Any(), 1); @@ -289,24 +113,9 @@ TEST_F(JSTypedLoweringTest, JSToBooleanWithNumber) { Reduction r = Reduce(graph()->NewNode( javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); ASSERT_TRUE(r.Changed()); - EXPECT_THAT(r.replacement(), - IsNumberLessThan(IsNumberConstant(0.0), IsNumberAbs(input))); + EXPECT_THAT(r.replacement(), IsNumberToBoolean(input)); } -TEST_F(JSTypedLoweringTest, JSToBooleanWithString) { - Node* input = Parameter(Type::String(), 0); - Node* context = Parameter(Type::Any(), 1); - Reduction r = Reduce(graph()->NewNode( - javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); - ASSERT_TRUE(r.Changed()); - EXPECT_THAT( - r.replacement(), - IsNumberLessThan(IsNumberConstant(0.0), - IsLoadField(AccessBuilder::ForStringLength(), input, - graph()->start(), graph()->start()))); -} - - TEST_F(JSTypedLoweringTest, JSToBooleanWithAny) { Node* input = Parameter(Type::Any(), 0); Node* context = Parameter(Type::Any(), 1); @@ -1022,68 +831,6 @@ TEST_F(JSTypedLoweringTest, JSSubtractSmis) { } // ----------------------------------------------------------------------------- -// JSInstanceOf -// Test that instanceOf is reduced if and only if the right-hand side is a -// function constant. Functional correctness is ensured elsewhere. - -TEST_F(JSTypedLoweringTest, JSInstanceOfSpecializationWithoutSmiCheck) { - Node* const context = Parameter(Type::Any()); - Node* const frame_state = EmptyFrameState(); - Node* const effect = graph()->start(); - Node* const control = graph()->start(); - - // Reduce if left-hand side is known to be an object. - Node* instanceOf = - graph()->NewNode(javascript()->InstanceOf(), Parameter(Type::Object(), 0), - HeapConstant(isolate()->object_function()), context, - frame_state, effect, control); - Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, - frame_state, effect, control); - Reduction r = Reduce(instanceOf); - ASSERT_TRUE(r.Changed()); - ASSERT_EQ(r.replacement(), dummy->InputAt(0)); - ASSERT_NE(instanceOf, dummy->InputAt(0)); -} - - -TEST_F(JSTypedLoweringTest, JSInstanceOfSpecializationWithSmiCheck) { - Node* const context = Parameter(Type::Any()); - Node* const frame_state = EmptyFrameState(); - Node* const effect = graph()->start(); - Node* const control = graph()->start(); - - // Reduce if left-hand side could be a Smi. - Node* instanceOf = - graph()->NewNode(javascript()->InstanceOf(), Parameter(Type::Any(), 0), - HeapConstant(isolate()->object_function()), context, - frame_state, effect, control); - Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, - frame_state, effect, control); - Reduction r = Reduce(instanceOf); - ASSERT_TRUE(r.Changed()); - ASSERT_EQ(r.replacement(), dummy->InputAt(0)); - ASSERT_NE(instanceOf, dummy->InputAt(0)); -} - - -TEST_F(JSTypedLoweringTest, JSInstanceOfNoSpecialization) { - Node* const context = Parameter(Type::Any()); - Node* const frame_state = EmptyFrameState(); - Node* const effect = graph()->start(); - Node* const control = graph()->start(); - - // Do not reduce if right-hand side is not a function constant. - Node* instanceOf = graph()->NewNode( - javascript()->InstanceOf(), Parameter(Type::Any(), 0), - Parameter(Type::Any()), context, frame_state, effect, control); - Node* dummy = graph()->NewNode(javascript()->ToObject(), instanceOf, context, - frame_state, effect, control); - Reduction r = Reduce(instanceOf); - ASSERT_FALSE(r.Changed()); - ASSERT_EQ(instanceOf, dummy->InputAt(0)); -} - -// ----------------------------------------------------------------------------- // JSBitwiseAnd TEST_F(JSTypedLoweringTest, JSBitwiseAndWithSignedSmallHint) { diff --git a/deps/v8/test/unittests/compiler/load-elimination-unittest.cc b/deps/v8/test/unittests/compiler/load-elimination-unittest.cc index ada99b5a7f..81393941bb 100644 --- a/deps/v8/test/unittests/compiler/load-elimination-unittest.cc +++ b/deps/v8/test/unittests/compiler/load-elimination-unittest.cc @@ -213,6 +213,269 @@ TEST_F(LoadEliminationTest, StoreFieldAndStoreElementAndLoadField) { EXPECT_EQ(value, r.replacement()); } +TEST_F(LoadEliminationTest, LoadElementOnTrueBranchOfDiamond) { + Node* object = Parameter(Type::Any(), 0); + Node* index = Parameter(Type::UnsignedSmall(), 1); + Node* check = Parameter(Type::Boolean(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + ElementAccess const access = {kTaggedBase, kPointerSize, Type::Any(), + MachineType::AnyTagged(), kNoWriteBarrier}; + + StrictMock<MockAdvancedReducerEditor> editor; + LoadElimination load_elimination(&editor, jsgraph(), zone()); + + load_elimination.Reduce(graph()->start()); + + Node* branch = graph()->NewNode(common()->Branch(), check, control); + + Node* if_true = graph()->NewNode(common()->IfTrue(), branch); + Node* etrue = graph()->NewNode(simplified()->LoadElement(access), object, + index, effect, if_true); + load_elimination.Reduce(etrue); + + Node* if_false = graph()->NewNode(common()->IfFalse(), branch); + Node* efalse = effect; + + control = graph()->NewNode(common()->Merge(2), if_true, if_false); + effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); + load_elimination.Reduce(effect); + + Node* load = graph()->NewNode(simplified()->LoadElement(access), object, + index, effect, control); + Reduction r = load_elimination.Reduce(load); + ASSERT_TRUE(r.Changed()); + EXPECT_EQ(load, r.replacement()); +} + +TEST_F(LoadEliminationTest, LoadElementOnFalseBranchOfDiamond) { + Node* object = Parameter(Type::Any(), 0); + Node* index = Parameter(Type::UnsignedSmall(), 1); + Node* check = Parameter(Type::Boolean(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + ElementAccess const access = {kTaggedBase, kPointerSize, Type::Any(), + MachineType::AnyTagged(), kNoWriteBarrier}; + + StrictMock<MockAdvancedReducerEditor> editor; + LoadElimination load_elimination(&editor, jsgraph(), zone()); + + load_elimination.Reduce(graph()->start()); + + Node* branch = graph()->NewNode(common()->Branch(), check, control); + + Node* if_true = graph()->NewNode(common()->IfTrue(), branch); + Node* etrue = effect; + + Node* if_false = graph()->NewNode(common()->IfFalse(), branch); + Node* efalse = graph()->NewNode(simplified()->LoadElement(access), object, + index, effect, if_false); + load_elimination.Reduce(efalse); + + control = graph()->NewNode(common()->Merge(2), if_true, if_false); + effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); + load_elimination.Reduce(effect); + + Node* load = graph()->NewNode(simplified()->LoadElement(access), object, + index, effect, control); + Reduction r = load_elimination.Reduce(load); + ASSERT_TRUE(r.Changed()); + EXPECT_EQ(load, r.replacement()); +} + +TEST_F(LoadEliminationTest, LoadFieldOnFalseBranchOfDiamond) { + Node* object = Parameter(Type::Any(), 0); + Node* check = Parameter(Type::Boolean(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + FieldAccess const access = {kTaggedBase, + kPointerSize, + MaybeHandle<Name>(), + Type::Any(), + MachineType::AnyTagged(), + kNoWriteBarrier}; + + StrictMock<MockAdvancedReducerEditor> editor; + LoadElimination load_elimination(&editor, jsgraph(), zone()); + + load_elimination.Reduce(graph()->start()); + + Node* branch = graph()->NewNode(common()->Branch(), check, control); + + Node* if_true = graph()->NewNode(common()->IfTrue(), branch); + Node* etrue = effect; + + Node* if_false = graph()->NewNode(common()->IfFalse(), branch); + Node* efalse = graph()->NewNode(simplified()->LoadField(access), object, + effect, if_false); + load_elimination.Reduce(efalse); + + control = graph()->NewNode(common()->Merge(2), if_true, if_false); + effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); + load_elimination.Reduce(effect); + + Node* load = graph()->NewNode(simplified()->LoadField(access), object, effect, + control); + Reduction r = load_elimination.Reduce(load); + ASSERT_TRUE(r.Changed()); + EXPECT_EQ(load, r.replacement()); +} + +TEST_F(LoadEliminationTest, LoadFieldOnTrueBranchOfDiamond) { + Node* object = Parameter(Type::Any(), 0); + Node* check = Parameter(Type::Boolean(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + FieldAccess const access = {kTaggedBase, + kPointerSize, + MaybeHandle<Name>(), + Type::Any(), + MachineType::AnyTagged(), + kNoWriteBarrier}; + + StrictMock<MockAdvancedReducerEditor> editor; + LoadElimination load_elimination(&editor, jsgraph(), zone()); + + load_elimination.Reduce(graph()->start()); + + Node* branch = graph()->NewNode(common()->Branch(), check, control); + + Node* if_true = graph()->NewNode(common()->IfTrue(), branch); + Node* etrue = graph()->NewNode(simplified()->LoadField(access), object, + effect, if_true); + load_elimination.Reduce(etrue); + + Node* if_false = graph()->NewNode(common()->IfFalse(), branch); + Node* efalse = effect; + + control = graph()->NewNode(common()->Merge(2), if_true, if_false); + effect = graph()->NewNode(common()->EffectPhi(2), etrue, efalse, control); + load_elimination.Reduce(effect); + + Node* load = graph()->NewNode(simplified()->LoadField(access), object, effect, + control); + Reduction r = load_elimination.Reduce(load); + ASSERT_TRUE(r.Changed()); + EXPECT_EQ(load, r.replacement()); +} + +TEST_F(LoadEliminationTest, LoadFieldWithTypeMismatch) { + Node* object = Parameter(Type::Any(), 0); + Node* value = Parameter(Type::Signed32(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + FieldAccess const access = {kTaggedBase, + kPointerSize, + MaybeHandle<Name>(), + Type::Unsigned31(), + MachineType::AnyTagged(), + kNoWriteBarrier}; + + StrictMock<MockAdvancedReducerEditor> editor; + LoadElimination load_elimination(&editor, jsgraph(), zone()); + + load_elimination.Reduce(graph()->start()); + + Node* store = effect = graph()->NewNode(simplified()->StoreField(access), + object, value, effect, control); + load_elimination.Reduce(effect); + + Node* load = graph()->NewNode(simplified()->LoadField(access), object, effect, + control); + EXPECT_CALL(editor, + ReplaceWithValue(load, IsTypeGuard(value, control), store, _)); + Reduction r = load_elimination.Reduce(load); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsTypeGuard(value, control)); +} + +TEST_F(LoadEliminationTest, LoadElementWithTypeMismatch) { + Node* object = Parameter(Type::Any(), 0); + Node* index = Parameter(Type::UnsignedSmall(), 1); + Node* value = Parameter(Type::Signed32(), 2); + Node* effect = graph()->start(); + Node* control = graph()->start(); + ElementAccess const access = {kTaggedBase, kPointerSize, Type::Unsigned31(), + MachineType::AnyTagged(), kNoWriteBarrier}; + + StrictMock<MockAdvancedReducerEditor> editor; + LoadElimination load_elimination(&editor, jsgraph(), zone()); + + load_elimination.Reduce(graph()->start()); + + Node* store = effect = + graph()->NewNode(simplified()->StoreElement(access), object, index, value, + effect, control); + load_elimination.Reduce(effect); + + Node* load = graph()->NewNode(simplified()->LoadElement(access), object, + index, effect, control); + EXPECT_CALL(editor, + ReplaceWithValue(load, IsTypeGuard(value, control), store, _)); + Reduction r = load_elimination.Reduce(load); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsTypeGuard(value, control)); +} + +TEST_F(LoadEliminationTest, AliasAnalysisForFinishRegion) { + Node* value0 = Parameter(Type::Signed32(), 0); + Node* value1 = Parameter(Type::Signed32(), 1); + Node* effect = graph()->start(); + Node* control = graph()->start(); + FieldAccess const access = {kTaggedBase, + kPointerSize, + MaybeHandle<Name>(), + Type::Signed32(), + MachineType::AnyTagged(), + kNoWriteBarrier}; + + StrictMock<MockAdvancedReducerEditor> editor; + LoadElimination load_elimination(&editor, jsgraph(), zone()); + + load_elimination.Reduce(effect); + + effect = graph()->NewNode( + common()->BeginRegion(RegionObservability::kNotObservable), effect); + load_elimination.Reduce(effect); + + Node* object0 = effect = + graph()->NewNode(simplified()->Allocate(NOT_TENURED), + jsgraph()->Constant(16), effect, control); + load_elimination.Reduce(effect); + + Node* region0 = effect = + graph()->NewNode(common()->FinishRegion(), object0, effect); + load_elimination.Reduce(effect); + + effect = graph()->NewNode( + common()->BeginRegion(RegionObservability::kNotObservable), effect); + load_elimination.Reduce(effect); + + Node* object1 = effect = + graph()->NewNode(simplified()->Allocate(NOT_TENURED), + jsgraph()->Constant(16), effect, control); + load_elimination.Reduce(effect); + + Node* region1 = effect = + graph()->NewNode(common()->FinishRegion(), object1, effect); + load_elimination.Reduce(effect); + + effect = graph()->NewNode(simplified()->StoreField(access), region0, value0, + effect, control); + load_elimination.Reduce(effect); + + effect = graph()->NewNode(simplified()->StoreField(access), region1, value1, + effect, control); + load_elimination.Reduce(effect); + + Node* load = graph()->NewNode(simplified()->LoadField(access), region0, + effect, control); + EXPECT_CALL(editor, ReplaceWithValue(load, value0, effect, _)); + Reduction r = load_elimination.Reduce(load); + ASSERT_TRUE(r.Changed()); + EXPECT_EQ(value0, r.replacement()); +} + } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc b/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc index ed426be5d8..1d29d9733f 100644 --- a/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/machine-operator-reducer-unittest.cc @@ -23,10 +23,10 @@ namespace v8 { namespace internal { namespace compiler { -class MachineOperatorReducerTest : public TypedGraphTest { +class MachineOperatorReducerTest : public GraphTest { public: explicit MachineOperatorReducerTest(int num_parameters = 2) - : TypedGraphTest(num_parameters), machine_(zone()) {} + : GraphTest(num_parameters), machine_(zone()) {} protected: Reduction Reduce(Node* node) { @@ -729,25 +729,52 @@ TEST_F(MachineOperatorReducerTest, ReduceToWord32RorWithParameters) { EXPECT_EQ(reduction2.replacement(), node2); EXPECT_THAT(reduction2.replacement(), IsWord32Ror(value, sub)); - // Testing rotate right. - Node* shl_r = graph()->NewNode(machine()->Word32Shl(), value, sub); - Node* shr_r = graph()->NewNode(machine()->Word32Shr(), value, shift); - - // (x << (32 - y)) | (x >>> y) => x ror y - Node* node3 = graph()->NewNode(machine()->Word32Or(), shl_r, shr_r); + // (x << y) ^ (x >>> (32 - y)) => x ror (32 - y) + Node* node3 = graph()->NewNode(machine()->Word32Xor(), shl_l, shr_l); Reduction reduction3 = Reduce(node3); EXPECT_TRUE(reduction3.Changed()); EXPECT_EQ(reduction3.replacement(), node3); - EXPECT_THAT(reduction3.replacement(), IsWord32Ror(value, shift)); + EXPECT_THAT(reduction3.replacement(), IsWord32Ror(value, sub)); - // (x >>> y) | (x << (32 - y)) => x ror y - Node* node4 = graph()->NewNode(machine()->Word32Or(), shr_r, shl_r); + // (x >>> (32 - y)) ^ (x << y) => x ror (32 - y) + Node* node4 = graph()->NewNode(machine()->Word32Xor(), shr_l, shl_l); Reduction reduction4 = Reduce(node4); EXPECT_TRUE(reduction4.Changed()); EXPECT_EQ(reduction4.replacement(), node4); - EXPECT_THAT(reduction4.replacement(), IsWord32Ror(value, shift)); -} + EXPECT_THAT(reduction4.replacement(), IsWord32Ror(value, sub)); + + // Testing rotate right. + Node* shl_r = graph()->NewNode(machine()->Word32Shl(), value, sub); + Node* shr_r = graph()->NewNode(machine()->Word32Shr(), value, shift); + + // (x << (32 - y)) | (x >>> y) => x ror y + Node* node5 = graph()->NewNode(machine()->Word32Or(), shl_r, shr_r); + Reduction reduction5 = Reduce(node5); + EXPECT_TRUE(reduction5.Changed()); + EXPECT_EQ(reduction5.replacement(), node5); + EXPECT_THAT(reduction5.replacement(), IsWord32Ror(value, shift)); + // (x >>> y) | (x << (32 - y)) => x ror y + Node* node6 = graph()->NewNode(machine()->Word32Or(), shr_r, shl_r); + Reduction reduction6 = Reduce(node6); + EXPECT_TRUE(reduction6.Changed()); + EXPECT_EQ(reduction6.replacement(), node6); + EXPECT_THAT(reduction6.replacement(), IsWord32Ror(value, shift)); + + // (x << (32 - y)) ^ (x >>> y) => x ror y + Node* node7 = graph()->NewNode(machine()->Word32Xor(), shl_r, shr_r); + Reduction reduction7 = Reduce(node7); + EXPECT_TRUE(reduction7.Changed()); + EXPECT_EQ(reduction7.replacement(), node7); + EXPECT_THAT(reduction7.replacement(), IsWord32Ror(value, shift)); + + // (x >>> y) ^ (x << (32 - y)) => x ror y + Node* node8 = graph()->NewNode(machine()->Word32Xor(), shr_r, shl_r); + Reduction reduction8 = Reduce(node8); + EXPECT_TRUE(reduction8.Changed()); + EXPECT_EQ(reduction8.replacement(), node8); + EXPECT_THAT(reduction8.replacement(), IsWord32Ror(value, shift)); +} TEST_F(MachineOperatorReducerTest, ReduceToWord32RorWithConstant) { Node* value = Parameter(0); @@ -1587,6 +1614,48 @@ TEST_F(MachineOperatorReducerTest, Float32SubMinusZeroMinusX) { } } +TEST_F(MachineOperatorReducerTest, Float64MulWithTwo) { + Node* const p0 = Parameter(0); + { + Reduction r = Reduce( + graph()->NewNode(machine()->Float64Mul(), Float64Constant(2.0), p0)); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsFloat64Add(p0, p0)); + } + { + Reduction r = Reduce( + graph()->NewNode(machine()->Float64Mul(), p0, Float64Constant(2.0))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsFloat64Add(p0, p0)); + } +} + +// ----------------------------------------------------------------------------- +// Float64Div + +TEST_F(MachineOperatorReducerTest, Float64DivWithMinusOne) { + Node* const p0 = Parameter(0); + { + Reduction r = Reduce( + graph()->NewNode(machine()->Float64Div(), p0, Float64Constant(-1.0))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsFloat64Neg(p0)); + } +} + +TEST_F(MachineOperatorReducerTest, Float64DivWithPowerOfTwo) { + Node* const p0 = Parameter(0); + TRACED_FORRANGE(uint64_t, exponent, 1, 0x7fe) { + Double divisor = Double(exponent << Double::kPhysicalSignificandSize); + if (divisor.value() == 1.0) continue; // Skip x / 1.0 => x. + Reduction r = Reduce(graph()->NewNode(machine()->Float64Div(), p0, + Float64Constant(divisor.value()))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), + IsFloat64Mul(p0, IsFloat64Constant(1.0 / divisor.value()))); + } +} + // ----------------------------------------------------------------------------- // Float64Acos @@ -1772,6 +1841,37 @@ TEST_F(MachineOperatorReducerTest, Float64Log1pWithConstant) { } // ----------------------------------------------------------------------------- +// Float64Pow + +TEST_F(MachineOperatorReducerTest, Float64PowWithConstant) { + TRACED_FOREACH(double, x, kFloat64Values) { + TRACED_FOREACH(double, y, kFloat64Values) { + Reduction const r = Reduce(graph()->NewNode( + machine()->Float64Pow(), Float64Constant(x), Float64Constant(y))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), + IsFloat64Constant(NanSensitiveDoubleEq(Pow(x, y)))); + } + } +} + +TEST_F(MachineOperatorReducerTest, Float64PowWithZeroExponent) { + Node* const p0 = Parameter(0); + { + Reduction const r = Reduce( + graph()->NewNode(machine()->Float64Pow(), p0, Float64Constant(-0.0))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsFloat64Constant(1.0)); + } + { + Reduction const r = Reduce( + graph()->NewNode(machine()->Float64Pow(), p0, Float64Constant(0.0))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsFloat64Constant(1.0)); + } +} + +// ----------------------------------------------------------------------------- // Float64Sin TEST_F(MachineOperatorReducerTest, Float64SinWithConstant) { 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 7b5c667261..dc14b85361 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 @@ -408,6 +408,36 @@ 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())); + } +} // ---------------------------------------------------------------------------- // Logical instructions. @@ -1149,6 +1179,219 @@ TEST_F(InstructionSelectorTest, Float64Abs) { EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); } +TEST_F(InstructionSelectorTest, Float32AddWithFloat32Mul) { + if (!IsMipsArchVariant(kMips32r2) && !IsMipsArchVariant(kMips32r6)) { + return; + } + { + StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(), + MachineType::Float32(), MachineType::Float32()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* const n = m.Float32Add(m.Float32Mul(p0, p1), p2); + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_EQ(kMipsMaddS, s[0]->arch_opcode()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_EQ(kMipsMaddfS, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); + } + { + StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(), + MachineType::Float32(), MachineType::Float32()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* const n = m.Float32Add(p0, m.Float32Mul(p1, p2)); + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_EQ(kMipsMaddS, s[0]->arch_opcode()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_EQ(kMipsMaddfS, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); + } +} + +TEST_F(InstructionSelectorTest, Float64AddWithFloat64Mul) { + if (!IsMipsArchVariant(kMips32r2) && !IsMipsArchVariant(kMips32r6)) { + return; + } + { + StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), + MachineType::Float64(), MachineType::Float64()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* const n = m.Float64Add(m.Float64Mul(p0, p1), p2); + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_EQ(kMipsMaddD, s[0]->arch_opcode()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_EQ(kMipsMaddfD, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); + } + { + StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), + MachineType::Float64(), MachineType::Float64()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* const n = m.Float64Add(p0, m.Float64Mul(p1, p2)); + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_EQ(kMipsMaddD, s[0]->arch_opcode()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_EQ(kMipsMaddfD, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); + } +} + +TEST_F(InstructionSelectorTest, Float32SubWithFloat32Mul) { + StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(), + MachineType::Float32(), MachineType::Float32()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* n = nullptr; + + if (!IsMipsArchVariant(kMips32r2) && !IsMipsArchVariant(kMips32r6)) { + return; + } + + if (IsMipsArchVariant(kMips32r2)) { + n = m.Float32Sub(m.Float32Mul(p1, p2), p0); + } else if (IsMipsArchVariant(kMips32r6)) { + n = m.Float32Sub(p0, m.Float32Mul(p1, p2)); + } + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_EQ(kMipsMsubS, s[0]->arch_opcode()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_EQ(kMipsMsubfS, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); +} + +TEST_F(InstructionSelectorTest, Float64SubWithFloat64Mul) { + StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), + MachineType::Float64(), MachineType::Float64()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* n = nullptr; + + if (!IsMipsArchVariant(kMips32r2) && !IsMipsArchVariant(kMips32r6)) { + return; + } + + if (IsMipsArchVariant(kMips32r2)) { + n = m.Float64Sub(m.Float64Mul(p1, p2), p0); + } else if (IsMipsArchVariant(kMips32r6)) { + n = m.Float64Sub(p0, m.Float64Mul(p1, p2)); + } + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_EQ(kMipsMsubD, s[0]->arch_opcode()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_EQ(kMipsMsubfD, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (IsMipsArchVariant(kMips32r2)) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (IsMipsArchVariant(kMips32r6)) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); +} TEST_F(InstructionSelectorTest, Float64Max) { StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), diff --git a/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc b/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc index c82cb9fe4f..be77126688 100644 --- a/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc +++ b/deps/v8/test/unittests/compiler/mips64/instruction-selector-mips64-unittest.cc @@ -719,6 +719,51 @@ TEST_F(InstructionSelectorTest, Word64ShlWithWord64And) { } } +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(kMips64Seb, 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(kMips64Seh, 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(32)), m.Int32Constant(32)); + m.Return(r); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + EXPECT_EQ(kMips64Shl, s[0]->arch_opcode()); + ASSERT_EQ(2U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(0, s.ToInt32(s[0]->InputAt(1))); + ASSERT_EQ(1U, s[0]->OutputCount()); + EXPECT_EQ(s.ToVreg(r), s.ToVreg(s[0]->Output())); + } +} // ---------------------------------------------------------------------------- // MUL/DIV instructions. @@ -1491,6 +1536,203 @@ TEST_F(InstructionSelectorTest, Float64Abs) { EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); } +TEST_F(InstructionSelectorTest, Float32AddWithFloat32Mul) { + { + StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(), + MachineType::Float32(), MachineType::Float32()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* const n = m.Float32Add(m.Float32Mul(p0, p1), p2); + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (kArchVariant == kMips64r2) { + EXPECT_EQ(kMips64MaddS, s[0]->arch_opcode()); + } else if (kArchVariant == kMips64r6) { + EXPECT_EQ(kMips64MaddfS, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (kArchVariant == kMips64r2) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (kArchVariant == kMips64r6) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); + } + { + StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(), + MachineType::Float32(), MachineType::Float32()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* const n = m.Float32Add(p0, m.Float32Mul(p1, p2)); + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (kArchVariant == kMips64r2) { + EXPECT_EQ(kMips64MaddS, s[0]->arch_opcode()); + } else if (kArchVariant == kMips64r6) { + EXPECT_EQ(kMips64MaddfS, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (kArchVariant == kMips64r2) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (kArchVariant == kMips64r6) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); + } +} + +TEST_F(InstructionSelectorTest, Float64AddWithFloat64Mul) { + { + StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), + MachineType::Float64(), MachineType::Float64()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* const n = m.Float64Add(m.Float64Mul(p0, p1), p2); + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (kArchVariant == kMips64r2) { + EXPECT_EQ(kMips64MaddD, s[0]->arch_opcode()); + } else if (kArchVariant == kMips64r6) { + EXPECT_EQ(kMips64MaddfD, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (kArchVariant == kMips64r2) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (kArchVariant == kMips64r6) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); + } + { + StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), + MachineType::Float64(), MachineType::Float64()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* const n = m.Float64Add(p0, m.Float64Mul(p1, p2)); + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (kArchVariant == kMips64r2) { + EXPECT_EQ(kMips64MaddD, s[0]->arch_opcode()); + } else if (kArchVariant == kMips64r6) { + EXPECT_EQ(kMips64MaddfD, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (kArchVariant == kMips64r2) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (kArchVariant == kMips64r6) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); + } +} + +TEST_F(InstructionSelectorTest, Float32SubWithFloat32Mul) { + StreamBuilder m(this, MachineType::Float32(), MachineType::Float32(), + MachineType::Float32(), MachineType::Float32()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* n; + if (kArchVariant == kMips64r2) { + n = m.Float32Sub(m.Float32Mul(p1, p2), p0); + } else if (kArchVariant == kMips64r6) { + n = m.Float32Sub(p0, m.Float32Mul(p1, p2)); + } + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (kArchVariant == kMips64r2) { + EXPECT_EQ(kMips64MsubS, s[0]->arch_opcode()); + } else if (kArchVariant == kMips64r6) { + EXPECT_EQ(kMips64MsubfS, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (kArchVariant == kMips64r2) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (kArchVariant == kMips64r6) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); +} + +TEST_F(InstructionSelectorTest, Float64SubWithFloat64Mul) { + StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), + MachineType::Float64(), MachineType::Float64()); + Node* const p0 = m.Parameter(0); + Node* const p1 = m.Parameter(1); + Node* const p2 = m.Parameter(2); + Node* n; + if (kArchVariant == kMips64r2) { + n = m.Float64Sub(m.Float64Mul(p1, p2), p0); + } else if (kArchVariant == kMips64r6) { + n = m.Float64Sub(p0, m.Float64Mul(p1, p2)); + } + m.Return(n); + Stream s = m.Build(); + ASSERT_EQ(1U, s.size()); + if (kArchVariant == kMips64r2) { + EXPECT_EQ(kMips64MsubD, s[0]->arch_opcode()); + } else if (kArchVariant == kMips64r6) { + EXPECT_EQ(kMips64MsubfD, s[0]->arch_opcode()); + } + ASSERT_EQ(3U, s[0]->InputCount()); + EXPECT_EQ(s.ToVreg(p0), s.ToVreg(s[0]->InputAt(0))); + EXPECT_EQ(s.ToVreg(p1), s.ToVreg(s[0]->InputAt(1))); + EXPECT_EQ(s.ToVreg(p2), s.ToVreg(s[0]->InputAt(2))); + ASSERT_EQ(1U, s[0]->OutputCount()); + if (kArchVariant == kMips64r2) { + EXPECT_FALSE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } else if (kArchVariant == kMips64r6) { + EXPECT_TRUE( + UnallocatedOperand::cast(s[0]->Output())->HasSameAsInputPolicy()); + } + EXPECT_EQ(s.ToVreg(n), s.ToVreg(s[0]->Output())); + EXPECT_EQ(kFlags_none, s[0]->flags_mode()); +} TEST_F(InstructionSelectorTest, Float64Max) { StreamBuilder m(this, MachineType::Float64(), MachineType::Float64(), diff --git a/deps/v8/test/unittests/compiler/node-test-utils.cc b/deps/v8/test/unittests/compiler/node-test-utils.cc index 5620b8bec1..3a5b2c3aeb 100644 --- a/deps/v8/test/unittests/compiler/node-test-utils.cc +++ b/deps/v8/test/unittests/compiler/node-test-utils.cc @@ -406,6 +406,35 @@ class IsTerminateMatcher final : public NodeMatcher { const Matcher<Node*> control_matcher_; }; +class IsTypeGuardMatcher final : public NodeMatcher { + public: + IsTypeGuardMatcher(const Matcher<Node*>& value_matcher, + const Matcher<Node*>& control_matcher) + : NodeMatcher(IrOpcode::kTypeGuard), + value_matcher_(value_matcher), + control_matcher_(control_matcher) {} + + void DescribeTo(std::ostream* os) const final { + NodeMatcher::DescribeTo(os); + *os << " whose value ("; + value_matcher_.DescribeTo(os); + *os << ") and control ("; + control_matcher_.DescribeTo(os); + *os << ")"; + } + + bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { + return (NodeMatcher::MatchAndExplain(node, listener) && + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), + "value", value_matcher_, listener) && + PrintMatchAndExplain(NodeProperties::GetControlInput(node), + "control", control_matcher_, listener)); + } + + private: + const Matcher<Node*> value_matcher_; + const Matcher<Node*> control_matcher_; +}; template <typename T> class IsConstantMatcher final : public NodeMatcher { @@ -1714,6 +1743,10 @@ Matcher<Node*> IsTerminate(const Matcher<Node*>& effect_matcher, return MakeMatcher(new IsTerminateMatcher(effect_matcher, control_matcher)); } +Matcher<Node*> IsTypeGuard(const Matcher<Node*>& value_matcher, + const Matcher<Node*>& control_matcher) { + return MakeMatcher(new IsTypeGuardMatcher(value_matcher, control_matcher)); +} Matcher<Node*> IsExternalConstant( const Matcher<ExternalReference>& value_matcher) { @@ -2274,7 +2307,9 @@ IS_BINOP_MATCHER(Float32LessThan) IS_BINOP_MATCHER(Float32LessThanOrEqual) IS_BINOP_MATCHER(Float64Max) IS_BINOP_MATCHER(Float64Min) +IS_BINOP_MATCHER(Float64Add) IS_BINOP_MATCHER(Float64Sub) +IS_BINOP_MATCHER(Float64Mul) IS_BINOP_MATCHER(Float64InsertLowWord32) IS_BINOP_MATCHER(Float64InsertHighWord32) #undef IS_BINOP_MATCHER @@ -2285,6 +2320,9 @@ IS_BINOP_MATCHER(Float64InsertHighWord32) return MakeMatcher(new IsUnopMatcher(IrOpcode::k##Name, input_matcher)); \ } IS_UNOP_MATCHER(BooleanNot) +IS_UNOP_MATCHER(BitcastTaggedToWord) +IS_UNOP_MATCHER(BitcastWordToTagged) +IS_UNOP_MATCHER(BitcastWordToTaggedSigned) IS_UNOP_MATCHER(TruncateFloat64ToWord32) IS_UNOP_MATCHER(ChangeFloat64ToInt32) IS_UNOP_MATCHER(ChangeFloat64ToUint32) @@ -2332,6 +2370,7 @@ IS_UNOP_MATCHER(NumberSqrt) IS_UNOP_MATCHER(NumberTan) IS_UNOP_MATCHER(NumberTanh) IS_UNOP_MATCHER(NumberTrunc) +IS_UNOP_MATCHER(NumberToBoolean) IS_UNOP_MATCHER(NumberToInt32) IS_UNOP_MATCHER(NumberToUint32) IS_UNOP_MATCHER(PlainPrimitiveToNumber) diff --git a/deps/v8/test/unittests/compiler/node-test-utils.h b/deps/v8/test/unittests/compiler/node-test-utils.h index 2a24803380..3afe2adf14 100644 --- a/deps/v8/test/unittests/compiler/node-test-utils.h +++ b/deps/v8/test/unittests/compiler/node-test-utils.h @@ -83,6 +83,8 @@ Matcher<Node*> IsReturn2(const Matcher<Node*>& value_matcher, const Matcher<Node*>& control_matcher); Matcher<Node*> IsTerminate(const Matcher<Node*>& effect_matcher, const Matcher<Node*>& control_matcher); +Matcher<Node*> IsTypeGuard(const Matcher<Node*>& value_matcher, + const Matcher<Node*>& control_matcher); Matcher<Node*> IsExternalConstant( const Matcher<ExternalReference>& value_matcher); Matcher<Node*> IsHeapConstant(Handle<HeapObject> value); @@ -384,6 +386,9 @@ Matcher<Node*> IsInt64Sub(const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher); Matcher<Node*> IsJSAdd(const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher); +Matcher<Node*> IsBitcastTaggedToWord(const Matcher<Node*>& input_matcher); +Matcher<Node*> IsBitcastWordToTagged(const Matcher<Node*>& input_matcher); +Matcher<Node*> IsBitcastWordToTaggedSigned(const Matcher<Node*>& input_matcher); Matcher<Node*> IsTruncateFloat64ToWord32(const Matcher<Node*>& input_matcher); Matcher<Node*> IsChangeFloat64ToInt32(const Matcher<Node*>& input_matcher); Matcher<Node*> IsChangeFloat64ToUint32(const Matcher<Node*>& input_matcher); @@ -405,8 +410,12 @@ Matcher<Node*> IsFloat64Max(const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher); Matcher<Node*> IsFloat64Min(const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher); +Matcher<Node*> IsFloat64Add(const Matcher<Node*>& lhs_matcher, + const Matcher<Node*>& rhs_matcher); Matcher<Node*> IsFloat64Sub(const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher); +Matcher<Node*> IsFloat64Mul(const Matcher<Node*>& lhs_matcher, + const Matcher<Node*>& rhs_matcher); Matcher<Node*> IsFloat64Abs(const Matcher<Node*>& input_matcher); Matcher<Node*> IsFloat64Neg(const Matcher<Node*>& input_matcher); Matcher<Node*> IsFloat64Sqrt(const Matcher<Node*>& input_matcher); @@ -425,6 +434,7 @@ Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher, const Matcher<Node*>& control_matcher); Matcher<Node*> IsLoadContext(const Matcher<ContextAccess>& access_matcher, const Matcher<Node*>& context_matcher); +Matcher<Node*> IsNumberToBoolean(const Matcher<Node*>& input_matcher); Matcher<Node*> IsNumberToInt32(const Matcher<Node*>& input_matcher); Matcher<Node*> IsNumberToUint32(const Matcher<Node*>& input_matcher); Matcher<Node*> IsParameter(const Matcher<int> index_matcher); diff --git a/deps/v8/test/unittests/compiler/opcodes-unittest.cc b/deps/v8/test/unittests/compiler/opcodes-unittest.cc index 3bb65c2e13..a0e67ecb27 100644 --- a/deps/v8/test/unittests/compiler/opcodes-unittest.cc +++ b/deps/v8/test/unittests/compiler/opcodes-unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include "src/compiler/opcodes.h" -#include "testing/gtest/include/gtest/gtest.h" +#include "testing/gtest-support.h" namespace v8 { namespace internal { @@ -81,65 +81,60 @@ bool IsComparisonOpcode(IrOpcode::Value opcode) { const IrOpcode::Value kInvalidOpcode = static_cast<IrOpcode::Value>(123456789); -} // namespace +char const* const kMnemonics[] = { +#define OPCODE(Opcode) #Opcode, + ALL_OP_LIST(OPCODE) +#undef OPCODE +}; + +const IrOpcode::Value kOpcodes[] = { +#define OPCODE(Opcode) IrOpcode::k##Opcode, + ALL_OP_LIST(OPCODE) +#undef OPCODE +}; +} // namespace TEST(IrOpcodeTest, IsCommonOpcode) { EXPECT_FALSE(IrOpcode::IsCommonOpcode(kInvalidOpcode)); -#define OPCODE(Opcode) \ - EXPECT_EQ(IsCommonOpcode(IrOpcode::k##Opcode), \ - IrOpcode::IsCommonOpcode(IrOpcode::k##Opcode)); - ALL_OP_LIST(OPCODE) -#undef OPCODE + TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) { + EXPECT_EQ(IsCommonOpcode(opcode), IrOpcode::IsCommonOpcode(opcode)); + } } - TEST(IrOpcodeTest, IsControlOpcode) { EXPECT_FALSE(IrOpcode::IsControlOpcode(kInvalidOpcode)); -#define OPCODE(Opcode) \ - EXPECT_EQ(IsControlOpcode(IrOpcode::k##Opcode), \ - IrOpcode::IsControlOpcode(IrOpcode::k##Opcode)); - ALL_OP_LIST(OPCODE) -#undef OPCODE + TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) { + EXPECT_EQ(IsControlOpcode(opcode), IrOpcode::IsControlOpcode(opcode)); + } } - TEST(IrOpcodeTest, IsJsOpcode) { EXPECT_FALSE(IrOpcode::IsJsOpcode(kInvalidOpcode)); -#define OPCODE(Opcode) \ - EXPECT_EQ(IsJsOpcode(IrOpcode::k##Opcode), \ - IrOpcode::IsJsOpcode(IrOpcode::k##Opcode)); - ALL_OP_LIST(OPCODE) -#undef OPCODE + TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) { + EXPECT_EQ(IsJsOpcode(opcode), IrOpcode::IsJsOpcode(opcode)); + } } - TEST(IrOpcodeTest, IsConstantOpcode) { EXPECT_FALSE(IrOpcode::IsConstantOpcode(kInvalidOpcode)); -#define OPCODE(Opcode) \ - EXPECT_EQ(IsConstantOpcode(IrOpcode::k##Opcode), \ - IrOpcode::IsConstantOpcode(IrOpcode::k##Opcode)); - ALL_OP_LIST(OPCODE) -#undef OPCODE + TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) { + EXPECT_EQ(IsConstantOpcode(opcode), IrOpcode::IsConstantOpcode(opcode)); + } } - TEST(IrOpcodeTest, IsComparisonOpcode) { EXPECT_FALSE(IrOpcode::IsComparisonOpcode(kInvalidOpcode)); -#define OPCODE(Opcode) \ - EXPECT_EQ(IsComparisonOpcode(IrOpcode::k##Opcode), \ - IrOpcode::IsComparisonOpcode(IrOpcode::k##Opcode)); - ALL_OP_LIST(OPCODE) -#undef OPCODE + TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) { + EXPECT_EQ(IsComparisonOpcode(opcode), IrOpcode::IsComparisonOpcode(opcode)); + } } - TEST(IrOpcodeTest, Mnemonic) { EXPECT_STREQ("UnknownOpcode", IrOpcode::Mnemonic(kInvalidOpcode)); -#define OPCODE(Opcode) \ - EXPECT_STREQ(#Opcode, IrOpcode::Mnemonic(IrOpcode::k##Opcode)); - ALL_OP_LIST(OPCODE) -#undef OPCODE + TRACED_FOREACH(IrOpcode::Value, opcode, kOpcodes) { + EXPECT_STREQ(kMnemonics[opcode], IrOpcode::Mnemonic(opcode)); + } } } // namespace compiler 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 b21a148718..6f37609f3a 100644 --- a/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc +++ b/deps/v8/test/unittests/compiler/simplified-operator-reducer-unittest.cc @@ -2,13 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/compiler/simplified-operator.h" #include "src/compiler/access-builder.h" #include "src/compiler/js-graph.h" #include "src/compiler/node-properties.h" -#include "src/compiler/simplified-operator.h" #include "src/compiler/simplified-operator-reducer.h" +#include "src/compiler/types.h" #include "src/conversions-inl.h" -#include "src/types.h" #include "test/unittests/compiler/graph-unittest.h" #include "test/unittests/compiler/node-test-utils.h" #include "testing/gmock-support.h" @@ -97,10 +97,6 @@ const double kNaNs[] = {-std::numeric_limits<double>::quiet_NaN(), bit_cast<double>(V8_UINT64_C(0x7FFFFFFFFFFFFFFF)), bit_cast<double>(V8_UINT64_C(0xFFFFFFFFFFFFFFFF))}; -const CheckForMinusZeroMode kCheckForMinusZeroModes[] = { - CheckForMinusZeroMode::kDontCheckForMinusZero, - CheckForMinusZeroMode::kCheckForMinusZero}; - } // namespace @@ -191,13 +187,11 @@ TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToBitWithChangeBitToTagged) { // ChangeFloat64ToTagged TEST_F(SimplifiedOperatorReducerTest, ChangeFloat64ToTaggedWithConstant) { - TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { - TRACED_FOREACH(double, n, kFloat64Values) { - Reduction reduction = Reduce(graph()->NewNode( - simplified()->ChangeFloat64ToTagged(mode), Float64Constant(n))); - ASSERT_TRUE(reduction.Changed()); - EXPECT_THAT(reduction.replacement(), IsNumberConstant(BitEq(n))); - } + TRACED_FOREACH(double, n, kFloat64Values) { + Reduction reduction = Reduce(graph()->NewNode( + simplified()->ChangeFloat64ToTagged(), Float64Constant(n))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_THAT(reduction.replacement(), IsNumberConstant(BitEq(n))); } } @@ -222,13 +216,11 @@ TEST_F(SimplifiedOperatorReducerTest, ChangeInt32ToTaggedWithConstant) { TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToFloat64WithChangeFloat64ToTagged) { Node* param0 = Parameter(0); - TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { - Reduction reduction = Reduce(graph()->NewNode( - simplified()->ChangeTaggedToFloat64(), - graph()->NewNode(simplified()->ChangeFloat64ToTagged(mode), param0))); - ASSERT_TRUE(reduction.Changed()); - EXPECT_EQ(param0, reduction.replacement()); - } + Reduction reduction = Reduce(graph()->NewNode( + simplified()->ChangeTaggedToFloat64(), + graph()->NewNode(simplified()->ChangeFloat64ToTagged(), param0))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_EQ(param0, reduction.replacement()); } TEST_F(SimplifiedOperatorReducerTest, @@ -279,13 +271,11 @@ TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToFloat64WithNaNConstant) { TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToInt32WithChangeFloat64ToTagged) { Node* param0 = Parameter(0); - TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { - Reduction reduction = Reduce(graph()->NewNode( - simplified()->ChangeTaggedToInt32(), - graph()->NewNode(simplified()->ChangeFloat64ToTagged(mode), param0))); - ASSERT_TRUE(reduction.Changed()); - EXPECT_THAT(reduction.replacement(), IsChangeFloat64ToInt32(param0)); - } + Reduction reduction = Reduce(graph()->NewNode( + simplified()->ChangeTaggedToInt32(), + graph()->NewNode(simplified()->ChangeFloat64ToTagged(), param0))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_THAT(reduction.replacement(), IsChangeFloat64ToInt32(param0)); } TEST_F(SimplifiedOperatorReducerTest, @@ -305,13 +295,11 @@ TEST_F(SimplifiedOperatorReducerTest, TEST_F(SimplifiedOperatorReducerTest, ChangeTaggedToUint32WithChangeFloat64ToTagged) { Node* param0 = Parameter(0); - TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { - Reduction reduction = Reduce(graph()->NewNode( - simplified()->ChangeTaggedToUint32(), - graph()->NewNode(simplified()->ChangeFloat64ToTagged(mode), param0))); - ASSERT_TRUE(reduction.Changed()); - EXPECT_THAT(reduction.replacement(), IsChangeFloat64ToUint32(param0)); - } + Reduction reduction = Reduce(graph()->NewNode( + simplified()->ChangeTaggedToUint32(), + graph()->NewNode(simplified()->ChangeFloat64ToTagged(), param0))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_THAT(reduction.replacement(), IsChangeFloat64ToUint32(param0)); } TEST_F(SimplifiedOperatorReducerTest, @@ -331,13 +319,11 @@ TEST_F(SimplifiedOperatorReducerTest, TEST_F(SimplifiedOperatorReducerTest, TruncateTaggedToWord3WithChangeFloat64ToTagged) { Node* param0 = Parameter(0); - TRACED_FOREACH(CheckForMinusZeroMode, mode, kCheckForMinusZeroModes) { - Reduction reduction = Reduce(graph()->NewNode( - simplified()->TruncateTaggedToWord32(), - graph()->NewNode(simplified()->ChangeFloat64ToTagged(mode), param0))); - ASSERT_TRUE(reduction.Changed()); - EXPECT_THAT(reduction.replacement(), IsTruncateFloat64ToWord32(param0)); - } + Reduction reduction = Reduce(graph()->NewNode( + simplified()->TruncateTaggedToWord32(), + graph()->NewNode(simplified()->ChangeFloat64ToTagged(), param0))); + ASSERT_TRUE(reduction.Changed()); + EXPECT_THAT(reduction.replacement(), IsTruncateFloat64ToWord32(param0)); } TEST_F(SimplifiedOperatorReducerTest, TruncateTaggedToWord32WithConstant) { @@ -350,20 +336,20 @@ TEST_F(SimplifiedOperatorReducerTest, TruncateTaggedToWord32WithConstant) { } // ----------------------------------------------------------------------------- -// CheckTaggedPointer +// CheckHeapObject -TEST_F(SimplifiedOperatorReducerTest, CheckTaggedPointerWithChangeBitToTagged) { +TEST_F(SimplifiedOperatorReducerTest, CheckHeapObjectWithChangeBitToTagged) { Node* param0 = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); Node* value = graph()->NewNode(simplified()->ChangeBitToTagged(), param0); - Reduction reduction = Reduce(graph()->NewNode( - simplified()->CheckTaggedPointer(), value, effect, control)); + Reduction reduction = Reduce(graph()->NewNode(simplified()->CheckHeapObject(), + value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } -TEST_F(SimplifiedOperatorReducerTest, CheckTaggedPointerWithHeapConstant) { +TEST_F(SimplifiedOperatorReducerTest, CheckHeapObjectWithHeapConstant) { Node* effect = graph()->start(); Node* control = graph()->start(); Handle<HeapObject> kHeapObjects[] = { @@ -372,34 +358,57 @@ TEST_F(SimplifiedOperatorReducerTest, CheckTaggedPointerWithHeapConstant) { TRACED_FOREACH(Handle<HeapObject>, object, kHeapObjects) { Node* value = HeapConstant(object); Reduction reduction = Reduce(graph()->NewNode( - simplified()->CheckTaggedPointer(), value, effect, control)); + simplified()->CheckHeapObject(), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } } +TEST_F(SimplifiedOperatorReducerTest, CheckHeapObjectWithCheckHeapObject) { + Node* param0 = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + Node* value = effect = graph()->NewNode(simplified()->CheckHeapObject(), + param0, effect, control); + Reduction reduction = Reduce(graph()->NewNode(simplified()->CheckHeapObject(), + value, effect, control)); + ASSERT_TRUE(reduction.Changed()); + EXPECT_EQ(value, reduction.replacement()); +} + // ----------------------------------------------------------------------------- -// CheckTaggedSigned +// CheckSmi -TEST_F(SimplifiedOperatorReducerTest, - CheckTaggedSignedWithChangeInt31ToTaggedSigned) { +TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithChangeInt31ToTaggedSigned) { Node* param0 = Parameter(0); Node* effect = graph()->start(); Node* control = graph()->start(); Node* value = graph()->NewNode(simplified()->ChangeInt31ToTaggedSigned(), param0); - Reduction reduction = Reduce(graph()->NewNode( - simplified()->CheckTaggedSigned(), value, effect, control)); + Reduction reduction = Reduce( + graph()->NewNode(simplified()->CheckSmi(), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } -TEST_F(SimplifiedOperatorReducerTest, CheckTaggedSignedWithNumberConstant) { +TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithNumberConstant) { Node* effect = graph()->start(); Node* control = graph()->start(); Node* value = NumberConstant(1.0); - Reduction reduction = Reduce(graph()->NewNode( - simplified()->CheckTaggedSigned(), value, effect, control)); + Reduction reduction = Reduce( + graph()->NewNode(simplified()->CheckSmi(), value, effect, control)); + ASSERT_TRUE(reduction.Changed()); + EXPECT_EQ(value, reduction.replacement()); +} + +TEST_F(SimplifiedOperatorReducerTest, CheckSmiWithCheckSmi) { + Node* param0 = Parameter(0); + Node* effect = graph()->start(); + Node* control = graph()->start(); + Node* value = effect = + graph()->NewNode(simplified()->CheckSmi(), param0, effect, control); + Reduction reduction = Reduce( + graph()->NewNode(simplified()->CheckSmi(), value, effect, control)); ASSERT_TRUE(reduction.Changed()); EXPECT_EQ(value, reduction.replacement()); } diff --git a/deps/v8/test/unittests/compiler/simplified-operator-unittest.cc b/deps/v8/test/unittests/compiler/simplified-operator-unittest.cc index febd76a528..d32dcaec12 100644 --- a/deps/v8/test/unittests/compiler/simplified-operator-unittest.cc +++ b/deps/v8/test/unittests/compiler/simplified-operator-unittest.cc @@ -2,11 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "src/compiler/simplified-operator.h" #include "src/compiler/opcodes.h" -#include "src/compiler/operator.h" #include "src/compiler/operator-properties.h" -#include "src/compiler/simplified-operator.h" -#include "src/types.h" +#include "src/compiler/operator.h" +#include "src/compiler/types.h" #include "test/unittests/test-utils.h" namespace v8 { @@ -63,6 +63,8 @@ const PureOperator kPureOperators[] = { PURE(ChangeTaggedToBit, Operator::kNoProperties, 1), PURE(ChangeBitToTagged, Operator::kNoProperties, 1), PURE(TruncateTaggedToWord32, Operator::kNoProperties, 1), + PURE(TruncateTaggedToFloat64, Operator::kNoProperties, 1), + PURE(TruncateTaggedToBit, Operator::kNoProperties, 1), PURE(ObjectIsNumber, Operator::kNoProperties, 1), PURE(ObjectIsReceiver, Operator::kNoProperties, 1), PURE(ObjectIsSmi, Operator::kNoProperties, 1) diff --git a/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc b/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc new file mode 100644 index 0000000000..d73c72d4e0 --- /dev/null +++ b/deps/v8/test/unittests/compiler/typed-optimization-unittest.cc @@ -0,0 +1,226 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "src/compiler/typed-optimization.h" +#include "src/code-factory.h" +#include "src/compilation-dependencies.h" +#include "src/compiler/access-builder.h" +#include "src/compiler/js-graph.h" +#include "src/compiler/js-operator.h" +#include "src/compiler/machine-operator.h" +#include "src/compiler/node-properties.h" +#include "src/compiler/operator-properties.h" +#include "src/isolate-inl.h" +#include "test/unittests/compiler/compiler-test-utils.h" +#include "test/unittests/compiler/graph-unittest.h" +#include "test/unittests/compiler/node-test-utils.h" +#include "testing/gmock-support.h" + +using testing::IsNaN; + +namespace v8 { +namespace internal { +namespace compiler { + +namespace { + +const double kFloat64Values[] = { + -V8_INFINITY, -4.23878e+275, -5.82632e+265, -6.60355e+220, + -6.26172e+212, -2.56222e+211, -4.82408e+201, -1.84106e+157, + -1.63662e+127, -1.55772e+100, -1.67813e+72, -2.3382e+55, + -3.179e+30, -1.441e+09, -1.0647e+09, -7.99361e+08, + -5.77375e+08, -2.20984e+08, -32757, -13171, + -9970, -3984, -107, -105, + -92, -77, -61, -0.000208163, + -1.86685e-06, -1.17296e-10, -9.26358e-11, -5.08004e-60, + -1.74753e-65, -1.06561e-71, -5.67879e-79, -5.78459e-130, + -2.90989e-171, -7.15489e-243, -3.76242e-252, -1.05639e-263, + -4.40497e-267, -2.19666e-273, -4.9998e-276, -5.59821e-278, + -2.03855e-282, -5.99335e-283, -7.17554e-284, -3.11744e-309, + -0.0, 0.0, 2.22507e-308, 1.30127e-270, + 7.62898e-260, 4.00313e-249, 3.16829e-233, 1.85244e-228, + 2.03544e-129, 1.35126e-110, 1.01182e-106, 5.26333e-94, + 1.35292e-90, 2.85394e-83, 1.78323e-77, 5.4967e-57, + 1.03207e-25, 4.57401e-25, 1.58738e-05, 2, + 125, 2310, 9636, 14802, + 17168, 28945, 29305, 4.81336e+07, + 1.41207e+08, 4.65962e+08, 1.40499e+09, 2.12648e+09, + 8.80006e+30, 1.4446e+45, 1.12164e+54, 2.48188e+89, + 6.71121e+102, 3.074e+112, 4.9699e+152, 5.58383e+166, + 4.30654e+172, 7.08824e+185, 9.6586e+214, 2.028e+223, + 6.63277e+243, 1.56192e+261, 1.23202e+269, 5.72883e+289, + 8.5798e+290, 1.40256e+294, 1.79769e+308, V8_INFINITY}; + +const double kIntegerValues[] = {-V8_INFINITY, INT_MIN, -1000.0, -42.0, + -1.0, 0.0, 1.0, 42.0, + 1000.0, INT_MAX, UINT_MAX, V8_INFINITY}; + +} // namespace + +class TypedOptimizationTest : public TypedGraphTest { + public: + TypedOptimizationTest() + : TypedGraphTest(3), javascript_(zone()), deps_(isolate(), zone()) {} + ~TypedOptimizationTest() override {} + + protected: + Reduction Reduce(Node* node) { + MachineOperatorBuilder machine(zone()); + SimplifiedOperatorBuilder simplified(zone()); + JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified, + &machine); + // TODO(titzer): mock the GraphReducer here for better unit testing. + GraphReducer graph_reducer(zone(), graph()); + TypedOptimization reducer(&graph_reducer, &deps_, + TypedOptimization::kDeoptimizationEnabled, + &jsgraph); + return reducer.Reduce(node); + } + + JSOperatorBuilder* javascript() { return &javascript_; } + + private: + JSOperatorBuilder javascript_; + CompilationDependencies deps_; +}; + +TEST_F(TypedOptimizationTest, ParameterWithMinusZero) { + { + Reduction r = Reduce( + Parameter(Type::Constant(factory()->minus_zero_value(), zone()))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsNumberConstant(-0.0)); + } + { + Reduction r = Reduce(Parameter(Type::MinusZero())); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsNumberConstant(-0.0)); + } + { + Reduction r = Reduce(Parameter( + Type::Union(Type::MinusZero(), + Type::Constant(factory()->NewNumber(0), zone()), zone()))); + EXPECT_FALSE(r.Changed()); + } +} + +TEST_F(TypedOptimizationTest, ParameterWithNull) { + Handle<HeapObject> null = factory()->null_value(); + { + Reduction r = Reduce(Parameter(Type::Constant(null, zone()))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsHeapConstant(null)); + } + { + Reduction r = Reduce(Parameter(Type::Null())); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsHeapConstant(null)); + } +} + +TEST_F(TypedOptimizationTest, ParameterWithNaN) { + const double kNaNs[] = {-std::numeric_limits<double>::quiet_NaN(), + std::numeric_limits<double>::quiet_NaN(), + std::numeric_limits<double>::signaling_NaN()}; + TRACED_FOREACH(double, nan, kNaNs) { + Handle<Object> constant = factory()->NewNumber(nan); + Reduction r = Reduce(Parameter(Type::Constant(constant, zone()))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsNumberConstant(IsNaN())); + } + { + Reduction r = + Reduce(Parameter(Type::Constant(factory()->nan_value(), zone()))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsNumberConstant(IsNaN())); + } + { + Reduction r = Reduce(Parameter(Type::NaN())); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsNumberConstant(IsNaN())); + } +} + +TEST_F(TypedOptimizationTest, ParameterWithPlainNumber) { + TRACED_FOREACH(double, value, kFloat64Values) { + Handle<Object> constant = factory()->NewNumber(value); + Reduction r = Reduce(Parameter(Type::Constant(constant, zone()))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsNumberConstant(value)); + } + TRACED_FOREACH(double, value, kIntegerValues) { + Reduction r = Reduce(Parameter(Type::Range(value, value, zone()))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsNumberConstant(value)); + } +} + +TEST_F(TypedOptimizationTest, ParameterWithUndefined) { + Handle<HeapObject> undefined = factory()->undefined_value(); + { + Reduction r = Reduce(Parameter(Type::Undefined())); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsHeapConstant(undefined)); + } + { + Reduction r = Reduce(Parameter(Type::Constant(undefined, zone()))); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsHeapConstant(undefined)); + } +} + +TEST_F(TypedOptimizationTest, JSToBooleanWithFalsish) { + Node* input = Parameter( + Type::Union( + Type::MinusZero(), + Type::Union( + Type::NaN(), + Type::Union( + Type::Null(), + Type::Union( + Type::Undefined(), + Type::Union( + Type::Undetectable(), + Type::Union( + Type::Constant(factory()->false_value(), zone()), + Type::Range(0.0, 0.0, zone()), zone()), + zone()), + zone()), + zone()), + zone()), + zone()), + 0); + Node* context = Parameter(Type::Any(), 1); + Reduction r = Reduce(graph()->NewNode( + javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsFalseConstant()); +} + +TEST_F(TypedOptimizationTest, JSToBooleanWithTruish) { + Node* input = Parameter( + Type::Union( + Type::Constant(factory()->true_value(), zone()), + Type::Union(Type::DetectableReceiver(), Type::Symbol(), zone()), + zone()), + 0); + Node* context = Parameter(Type::Any(), 1); + Reduction r = Reduce(graph()->NewNode( + javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsTrueConstant()); +} + +TEST_F(TypedOptimizationTest, JSToBooleanWithNonZeroPlainNumber) { + Node* input = Parameter(Type::Range(1, V8_INFINITY, zone()), 0); + Node* context = Parameter(Type::Any(), 1); + Reduction r = Reduce(graph()->NewNode( + javascript()->ToBoolean(ToBooleanHint::kAny), input, context)); + ASSERT_TRUE(r.Changed()); + EXPECT_THAT(r.replacement(), IsTrueConstant()); +} + +} // namespace compiler +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/unittests/compiler/zone-pool-unittest.cc b/deps/v8/test/unittests/compiler/zone-pool-unittest.cc index 47f1cc5c75..5bbdbfd45d 100644 --- a/deps/v8/test/unittests/compiler/zone-pool-unittest.cc +++ b/deps/v8/test/unittests/compiler/zone-pool-unittest.cc @@ -38,7 +38,7 @@ class ZonePoolTest : public TestWithIsolate { } private: - base::AccountingAllocator allocator_; + v8::internal::AccountingAllocator allocator_; ZonePool zone_pool_; base::RandomNumberGenerator rng; }; diff --git a/deps/v8/test/unittests/heap/gc-tracer-unittest.cc b/deps/v8/test/unittests/heap/gc-tracer-unittest.cc index 84e4d973e2..677da0eb0b 100644 --- a/deps/v8/test/unittests/heap/gc-tracer-unittest.cc +++ b/deps/v8/test/unittests/heap/gc-tracer-unittest.cc @@ -160,7 +160,8 @@ TEST_F(GCTracerTest, RegularScope) { EXPECT_DOUBLE_EQ(0.0, tracer->current_.scopes[GCTracer::Scope::MC_MARK]); // Sample not added because it's not within a started tracer. tracer->AddScopeSample(GCTracer::Scope::MC_MARK, 100); - tracer->Start(MARK_COMPACTOR, "gc unittest", "collector unittest"); + tracer->Start(MARK_COMPACTOR, GarbageCollectionReason::kTesting, + "collector unittest"); tracer->AddScopeSample(GCTracer::Scope::MC_MARK, 100); tracer->Stop(MARK_COMPACTOR); EXPECT_DOUBLE_EQ(100.0, tracer->current_.scopes[GCTracer::Scope::MC_MARK]); @@ -174,7 +175,8 @@ TEST_F(GCTracerTest, IncrementalScope) { 0.0, tracer->current_.scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE]); // Sample is added because its ScopeId is listed as incremental sample. tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 100); - tracer->Start(MARK_COMPACTOR, "gc unittest", "collector unittest"); + tracer->Start(MARK_COMPACTOR, GarbageCollectionReason::kTesting, + "collector unittest"); // Switch to incremental MC to enable writing back incremental scopes. tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 100); @@ -189,7 +191,12 @@ TEST_F(GCTracerTest, IncrementalMarkingDetails) { // Round 1. tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 50); - tracer->Start(MARK_COMPACTOR, "gc unittest", "collector unittest"); + // Scavenger has no impact on incremental marking details. + tracer->Start(SCAVENGER, GarbageCollectionReason::kTesting, + "collector unittest"); + tracer->Stop(SCAVENGER); + tracer->Start(MARK_COMPACTOR, GarbageCollectionReason::kTesting, + "collector unittest"); // Switch to incremental MC to enable writing back incremental scopes. tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 100); @@ -208,12 +215,13 @@ TEST_F(GCTracerTest, IncrementalMarkingDetails) { 150, tracer->current_ .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE] - .cumulative_duration); + .duration); - // Round 2. Cumulative numbers should add up, others should be reset. + // Round 2. Numbers should be reset. tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 13); tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 15); - tracer->Start(MARK_COMPACTOR, "gc unittest", "collector unittest"); + tracer->Start(MARK_COMPACTOR, GarbageCollectionReason::kTesting, + "collector unittest"); // Switch to incremental MC to enable writing back incremental scopes. tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; tracer->AddScopeSample(GCTracer::Scope::MC_INCREMENTAL_FINALIZE, 122); @@ -229,10 +237,61 @@ TEST_F(GCTracerTest, IncrementalMarkingDetails) { .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE] .steps); EXPECT_DOUBLE_EQ( - 300, + 150, tracer->current_ .incremental_marking_scopes[GCTracer::Scope::MC_INCREMENTAL_FINALIZE] - .cumulative_duration); + .duration); +} + +TEST_F(GCTracerTest, IncrementalMarkingSpeed) { + GCTracer* tracer = i_isolate()->heap()->tracer(); + tracer->ResetForTesting(); + + // Round 1. + // 1000000 bytes in 100ms. + tracer->AddIncrementalMarkingStep(100, 1000000); + EXPECT_EQ(1000000 / 100, + tracer->IncrementalMarkingSpeedInBytesPerMillisecond()); + // 1000000 bytes in 100ms. + tracer->AddIncrementalMarkingStep(100, 1000000); + EXPECT_EQ(1000000 / 100, + tracer->IncrementalMarkingSpeedInBytesPerMillisecond()); + // Scavenger has no impact on incremental marking details. + tracer->Start(SCAVENGER, GarbageCollectionReason::kTesting, + "collector unittest"); + tracer->Stop(SCAVENGER); + // 1000000 bytes in 100ms. + tracer->AddIncrementalMarkingStep(100, 1000000); + EXPECT_EQ(300, tracer->incremental_marking_duration_); + EXPECT_EQ(3000000, tracer->incremental_marking_bytes_); + EXPECT_EQ(1000000 / 100, + tracer->IncrementalMarkingSpeedInBytesPerMillisecond()); + tracer->Start(MARK_COMPACTOR, GarbageCollectionReason::kTesting, + "collector unittest"); + // Switch to incremental MC. + tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; + // 1000000 bytes in 100ms. + tracer->AddIncrementalMarkingStep(100, 1000000); + EXPECT_EQ(400, tracer->incremental_marking_duration_); + EXPECT_EQ(4000000, tracer->incremental_marking_bytes_); + tracer->Stop(MARK_COMPACTOR); + EXPECT_EQ(400, tracer->current_.incremental_marking_duration); + EXPECT_EQ(4000000, tracer->current_.incremental_marking_bytes); + EXPECT_EQ(0, tracer->incremental_marking_duration_); + EXPECT_EQ(0, tracer->incremental_marking_bytes_); + EXPECT_EQ(1000000 / 100, + tracer->IncrementalMarkingSpeedInBytesPerMillisecond()); + + // Round 2. + tracer->AddIncrementalMarkingStep(2000, 1000); + tracer->Start(MARK_COMPACTOR, GarbageCollectionReason::kTesting, + "collector unittest"); + // Switch to incremental MC. + tracer->current_.type = GCTracer::Event::INCREMENTAL_MARK_COMPACTOR; + tracer->Stop(MARK_COMPACTOR); + EXPECT_DOUBLE_EQ((4000000.0 / 400 + 1000.0 / 2000) / 2, + static_cast<double>( + tracer->IncrementalMarkingSpeedInBytesPerMillisecond())); } } // namespace internal diff --git a/deps/v8/test/unittests/heap/slot-set-unittest.cc b/deps/v8/test/unittests/heap/slot-set-unittest.cc index cfb1f1f9d2..65b7925310 100644 --- a/deps/v8/test/unittests/heap/slot-set-unittest.cc +++ b/deps/v8/test/unittests/heap/slot-set-unittest.cc @@ -52,14 +52,16 @@ TEST(SlotSet, Iterate) { } } - set.Iterate([](Address slot_address) { - uintptr_t intaddr = reinterpret_cast<uintptr_t>(slot_address); - if (intaddr % 3 == 0) { - return KEEP_SLOT; - } else { - return REMOVE_SLOT; - } - }); + set.Iterate( + [](Address slot_address) { + uintptr_t intaddr = reinterpret_cast<uintptr_t>(slot_address); + if (intaddr % 3 == 0) { + return KEEP_SLOT; + } else { + return REMOVE_SLOT; + } + }, + SlotSet::KEEP_EMPTY_BUCKETS); for (int i = 0; i < Page::kPageSize; i += kPointerSize) { if (i % 21 == 0) { @@ -147,29 +149,34 @@ TEST(TypedSlotSet, Iterate) { uint32_t j = 0; for (uint32_t i = 0; i < TypedSlotSet::kMaxOffset; i += kDelta, j += kHostDelta) { - SlotType type = static_cast<SlotType>(i % NUMBER_OF_SLOT_TYPES); + SlotType type = static_cast<SlotType>(i % CLEARED_SLOT); set.Insert(type, j, i); ++added; } int iterated = 0; - set.Iterate([&iterated, kDelta, kHostDelta](SlotType type, Address host_addr, - Address addr) { - uint32_t i = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)); - uint32_t j = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(host_addr)); - EXPECT_EQ(i % NUMBER_OF_SLOT_TYPES, static_cast<uint32_t>(type)); - EXPECT_EQ(0, i % kDelta); - EXPECT_EQ(0, j % kHostDelta); - ++iterated; - return i % 2 == 0 ? KEEP_SLOT : REMOVE_SLOT; - }); + set.Iterate( + [&iterated, kDelta, kHostDelta](SlotType type, Address host_addr, + Address addr) { + uint32_t i = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)); + uint32_t j = + static_cast<uint32_t>(reinterpret_cast<uintptr_t>(host_addr)); + EXPECT_EQ(i % CLEARED_SLOT, static_cast<uint32_t>(type)); + EXPECT_EQ(0, i % kDelta); + EXPECT_EQ(0, j % kHostDelta); + ++iterated; + return i % 2 == 0 ? KEEP_SLOT : REMOVE_SLOT; + }, + TypedSlotSet::KEEP_EMPTY_CHUNKS); EXPECT_EQ(added, iterated); iterated = 0; - set.Iterate([&iterated](SlotType type, Address host_addr, Address addr) { - uint32_t i = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)); - EXPECT_EQ(0, i % 2); - ++iterated; - return KEEP_SLOT; - }); + set.Iterate( + [&iterated](SlotType type, Address host_addr, Address addr) { + uint32_t i = static_cast<uint32_t>(reinterpret_cast<uintptr_t>(addr)); + EXPECT_EQ(0, i % 2); + ++iterated; + return KEEP_SLOT; + }, + TypedSlotSet::KEEP_EMPTY_CHUNKS); EXPECT_EQ(added / 2, iterated); } 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 fffc97f54d..4507d63eb1 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-array-builder-unittest.cc @@ -33,6 +33,8 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { Register reg(0); Register other(reg.index() + 1); Register wide(128); + RegisterList reg_list; + RegisterList pair(0, 2), triple(0, 3); // Emit argument creation operations. builder.CreateArguments(CreateArgumentsType::kMappedArguments) @@ -43,8 +45,9 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { builder.LoadLiteral(Smi::FromInt(0)) .StoreAccumulatorInRegister(reg) .LoadLiteral(Smi::FromInt(8)) - .CompareOperation(Token::Value::NE, reg) // Prevent peephole optimization - // LdaSmi, Star -> LdrSmi. + .CompareOperation(Token::Value::NE, reg, + 1) // Prevent peephole optimization + // LdaSmi, Star -> LdrSmi. .StoreAccumulatorInRegister(reg) .LoadLiteral(Smi::FromInt(10000000)) .StoreAccumulatorInRegister(reg) @@ -82,8 +85,8 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { // Emit context operations. builder.PushContext(reg) .PopContext(reg) - .LoadContextSlot(reg, 1) - .StoreContextSlot(reg, 1); + .LoadContextSlot(reg, 1, 0) + .StoreContextSlot(reg, 1, 0); // Emit load / store property operations. builder.LoadNamedProperty(reg, name, 0) @@ -99,14 +102,22 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { .StoreLookupSlot(name, LanguageMode::SLOPPY) .StoreLookupSlot(name, LanguageMode::STRICT); + // Emit load / store lookup slots with context fast paths. + builder.LoadLookupContextSlot(name, TypeofMode::NOT_INSIDE_TYPEOF, 1, 0) + .LoadLookupContextSlot(name, TypeofMode::INSIDE_TYPEOF, 1, 0); + + // Emit load / store lookup slots with global fast paths. + builder.LoadLookupGlobalSlot(name, TypeofMode::NOT_INSIDE_TYPEOF, 1, 0) + .LoadLookupGlobalSlot(name, TypeofMode::INSIDE_TYPEOF, 1, 0); + // Emit closure operations. builder.CreateClosure(0, NOT_TENURED); // Emit create context operation. builder.CreateBlockContext(factory->NewScopeInfo(1)); - builder.CreateCatchContext(reg, name); + builder.CreateCatchContext(reg, name, factory->NewScopeInfo(1)); builder.CreateFunctionContext(1); - builder.CreateWithContext(reg); + builder.CreateWithContext(reg, factory->NewScopeInfo(1)); // Emit literal creation operations. builder.CreateRegExpLiteral(factory->NewStringFromStaticChars("a"), 0, 0) @@ -114,16 +125,11 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { .CreateObjectLiteral(factory->NewFixedArray(1), 0, 0, reg); // Call operations. - builder.Call(reg, other, 0, 1) - .Call(reg, wide, 0, 1) - .TailCall(reg, other, 0, 1) - .TailCall(reg, wide, 0, 1) - .CallRuntime(Runtime::kIsArray, reg, 1) - .CallRuntime(Runtime::kIsArray, wide, 1) - .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, reg, 1, other) - .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, wide, 1, other) - .CallJSRuntime(Context::SPREAD_ITERABLE_INDEX, reg, 1) - .CallJSRuntime(Context::SPREAD_ITERABLE_INDEX, wide, 1); + builder.Call(reg, reg_list, 1) + .Call(reg, reg_list, 1, TailCallMode::kAllow) + .CallRuntime(Runtime::kIsArray, reg) + .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, reg_list, pair) + .CallJSRuntime(Context::SPREAD_ITERABLE_INDEX, reg_list); // Emit binary operator invocations. builder.BinaryOperation(Token::Value::ADD, reg, 1) @@ -170,36 +176,37 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { builder.Delete(reg, LanguageMode::SLOPPY).Delete(reg, LanguageMode::STRICT); // Emit new. - builder.New(reg, reg, 0); - builder.New(wide, wide, 0); + builder.New(reg, reg_list, 1); // Emit test operator invocations. - builder.CompareOperation(Token::Value::EQ, reg) - .CompareOperation(Token::Value::NE, reg) - .CompareOperation(Token::Value::EQ_STRICT, reg) - .CompareOperation(Token::Value::LT, reg) - .CompareOperation(Token::Value::GT, reg) - .CompareOperation(Token::Value::LTE, reg) - .CompareOperation(Token::Value::GTE, reg) - .CompareOperation(Token::Value::INSTANCEOF, reg) - .CompareOperation(Token::Value::IN, reg); - - // Emit cast operator invocations. - builder.CastAccumulatorToNumber(reg) - .CastAccumulatorToJSObject(reg) - .CastAccumulatorToName(reg); - - // Emit control flow. Return must be the last instruction. - BytecodeLabel start; - builder.Bind(&start); + builder.CompareOperation(Token::Value::EQ, reg, 1) + .CompareOperation(Token::Value::NE, reg, 2) + .CompareOperation(Token::Value::EQ_STRICT, reg, 3) + .CompareOperation(Token::Value::LT, reg, 4) + .CompareOperation(Token::Value::GT, reg, 5) + .CompareOperation(Token::Value::LTE, reg, 6) + .CompareOperation(Token::Value::GTE, reg, 7) + .CompareOperation(Token::Value::INSTANCEOF, reg, 8) + .CompareOperation(Token::Value::IN, reg, 9); + + // Emit conversion operator invocations. + builder.ConvertAccumulatorToNumber(reg) + .ConvertAccumulatorToObject(reg) + .ConvertAccumulatorToName(reg); + + // Short jumps with Imm8 operands { - // Short jumps with Imm8 operands - BytecodeLabel after_jump; - builder.Jump(&start) - .Bind(&after_jump) - .JumpIfNull(&start) - .JumpIfUndefined(&start) - .JumpIfNotHole(&start); + BytecodeLabel start, after_jump1, after_jump2, after_jump3, after_jump4; + builder.Bind(&start) + .Jump(&after_jump1) + .Bind(&after_jump1) + .JumpIfNull(&after_jump2) + .Bind(&after_jump2) + .JumpIfUndefined(&after_jump3) + .Bind(&after_jump3) + .JumpIfNotHole(&after_jump4) + .Bind(&after_jump4) + .JumpLoop(&start, 0); } // Longer jumps with constant operands @@ -223,48 +230,31 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { // Perform an operation that returns boolean value to // generate JumpIfTrue/False - builder.CompareOperation(Token::Value::EQ, reg) - .JumpIfTrue(&start) - .CompareOperation(Token::Value::EQ, reg) - .JumpIfFalse(&start); + { + BytecodeLabel after_jump1, after_jump2; + builder.CompareOperation(Token::Value::EQ, reg, 1) + .JumpIfTrue(&after_jump1) + .Bind(&after_jump1) + .CompareOperation(Token::Value::EQ, reg, 2) + .JumpIfFalse(&after_jump2) + .Bind(&after_jump2); + } + // Perform an operation that returns a non-boolean operation to // generate JumpIfToBooleanTrue/False. - builder.BinaryOperation(Token::Value::ADD, reg, 1) - .JumpIfTrue(&start) - .BinaryOperation(Token::Value::ADD, reg, 2) - .JumpIfFalse(&start); - // Insert dummy ops to force longer jumps - for (int i = 0; i < 128; i++) { - builder.LoadTrue(); - } - // Longer jumps requiring Constant operand { - BytecodeLabel after_jump; - builder.Jump(&start) - .Bind(&after_jump) - .JumpIfNull(&start) - .JumpIfUndefined(&start) - .JumpIfNotHole(&start); - // Perform an operation that returns boolean value to - // generate JumpIfTrue/False - builder.CompareOperation(Token::Value::EQ, reg) - .JumpIfTrue(&start) - .CompareOperation(Token::Value::EQ, reg) - .JumpIfFalse(&start); - // Perform an operation that returns a non-boolean operation to - // generate JumpIfToBooleanTrue/False. + BytecodeLabel after_jump1, after_jump2; builder.BinaryOperation(Token::Value::ADD, reg, 1) - .JumpIfTrue(&start) + .JumpIfTrue(&after_jump1) + .Bind(&after_jump1) .BinaryOperation(Token::Value::ADD, reg, 2) - .JumpIfFalse(&start); + .JumpIfFalse(&after_jump2) + .Bind(&after_jump2); } // Emit stack check bytecode. builder.StackCheck(0); - // Emit an OSR poll bytecode. - builder.OsrPoll(1); - // Emit throw and re-throw in it's own basic block so that the rest of the // code isn't omitted due to being dead. BytecodeLabel after_throw; @@ -272,13 +262,9 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { BytecodeLabel after_rethrow; builder.ReThrow().Bind(&after_rethrow); - builder.ForInPrepare(reg, reg) - .ForInDone(reg, reg) - .ForInNext(reg, reg, reg, 1) - .ForInStep(reg); - builder.ForInPrepare(reg, wide) - .ForInDone(reg, other) - .ForInNext(wide, wide, wide, 1024) + builder.ForInPrepare(reg, triple) + .ForInContinue(reg, reg) + .ForInNext(reg, reg, pair, 1) .ForInStep(reg); // Wide constant pool loads @@ -308,7 +294,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { .StoreKeyedProperty(reg, reg, 2056, LanguageMode::STRICT); // Emit wide context operations. - builder.LoadContextSlot(reg, 1024).StoreContextSlot(reg, 1024); + builder.LoadContextSlot(reg, 1024, 0).StoreContextSlot(reg, 1024, 0); // Emit wide load / store lookup slots. builder.LoadLookupSlot(wide_name, TypeofMode::NOT_INSIDE_TYPEOF) @@ -322,7 +308,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { .StoreAccumulatorInRegister(reg) .LoadKeyedProperty(reg, 0) .StoreAccumulatorInRegister(reg) - .LoadContextSlot(reg, 1) + .LoadContextSlot(reg, 1, 0) .StoreAccumulatorInRegister(reg) .LoadGlobal(0, TypeofMode::NOT_INSIDE_TYPEOF) .StoreAccumulatorInRegister(reg) @@ -338,48 +324,33 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { .CreateArrayLiteral(factory->NewFixedArray(2), 0, 0) .CreateObjectLiteral(factory->NewFixedArray(2), 0, 0, reg); - // Longer jumps requiring ConstantWide operand - { - BytecodeLabel after_jump; - builder.Jump(&start) - .Bind(&after_jump) - .JumpIfNull(&start) - .JumpIfUndefined(&start) - .JumpIfNotHole(&start); - } - - // Perform an operation that returns boolean value to - // generate JumpIfTrue/False - builder.CompareOperation(Token::Value::EQ, reg) - .JumpIfTrue(&start) - .CompareOperation(Token::Value::EQ, reg) - .JumpIfFalse(&start); - - // Perform an operation that returns a non-boolean operation to - // generate JumpIfToBooleanTrue/False. - builder.BinaryOperation(Token::Value::ADD, reg, 1) - .JumpIfTrue(&start) - .BinaryOperation(Token::Value::ADD, reg, 2) - .JumpIfFalse(&start); - // Emit generator operations builder.SuspendGenerator(reg) .ResumeGenerator(reg); // Intrinsics handled by the interpreter. - builder.CallRuntime(Runtime::kInlineIsArray, reg, 1) - .CallRuntime(Runtime::kInlineIsArray, wide, 1); + builder.CallRuntime(Runtime::kInlineIsArray, reg_list); + // Emit debugger bytecode. builder.Debugger(); + + // Insert dummy ops to force longer jumps. + for (int i = 0; i < 128; i++) { + builder.LoadTrue(); + } + + // Bind labels for long jumps at the very end. for (size_t i = 0; i < arraysize(end); i++) { builder.Bind(&end[i]); } + + // Return must be the last instruction. builder.Return(); // Generate BytecodeArray. Handle<BytecodeArray> the_array = builder.ToBytecodeArray(isolate()); CHECK_EQ(the_array->frame_size(), - builder.fixed_and_temporary_register_count() * kPointerSize); + builder.total_register_count() * kPointerSize); // Build scorecard of bytecodes encountered in the BytecodeArray. std::vector<int> scorecard(Bytecodes::ToByte(Bytecode::kLast) + 1); @@ -448,21 +419,18 @@ TEST_F(BytecodeArrayBuilderTest, FrameSizesLookGood) { for (int contexts = 0; contexts < 4; contexts++) { for (int temps = 0; temps < 3; temps++) { BytecodeArrayBuilder builder(isolate(), zone(), 0, contexts, locals); - BytecodeRegisterAllocator temporaries( - zone(), builder.temporary_register_allocator()); + BytecodeRegisterAllocator* allocator(builder.register_allocator()); for (int i = 0; i < locals + contexts; i++) { builder.LoadLiteral(Smi::FromInt(0)); builder.StoreAccumulatorInRegister(Register(i)); } for (int i = 0; i < temps; i++) { + Register temp = allocator->NewRegister(); builder.LoadLiteral(Smi::FromInt(0)); - builder.StoreAccumulatorInRegister(temporaries.NewRegister()); - } - if (temps > 0) { + builder.StoreAccumulatorInRegister(temp); // Ensure temporaries are used so not optimized away by the // register optimizer. - builder.New(Register(locals + contexts), Register(locals + contexts), - static_cast<size_t>(temps)); + builder.ConvertAccumulatorToName(temp); } builder.Return(); @@ -498,30 +466,6 @@ TEST_F(BytecodeArrayBuilderTest, Parameters) { } -TEST_F(BytecodeArrayBuilderTest, RegisterType) { - CanonicalHandleScope canonical(isolate()); - BytecodeArrayBuilder builder(isolate(), zone(), 10, 0, 3); - BytecodeRegisterAllocator register_allocator( - zone(), builder.temporary_register_allocator()); - Register temp0 = register_allocator.NewRegister(); - Register param0(builder.Parameter(0)); - Register param9(builder.Parameter(9)); - Register temp1 = register_allocator.NewRegister(); - Register reg0(0); - Register reg1(1); - Register reg2(2); - Register temp2 = register_allocator.NewRegister(); - CHECK_EQ(builder.RegisterIsParameterOrLocal(temp0), false); - CHECK_EQ(builder.RegisterIsParameterOrLocal(temp1), false); - CHECK_EQ(builder.RegisterIsParameterOrLocal(temp2), false); - CHECK_EQ(builder.RegisterIsParameterOrLocal(param0), true); - CHECK_EQ(builder.RegisterIsParameterOrLocal(param9), true); - CHECK_EQ(builder.RegisterIsParameterOrLocal(reg0), true); - CHECK_EQ(builder.RegisterIsParameterOrLocal(reg1), true); - CHECK_EQ(builder.RegisterIsParameterOrLocal(reg2), true); -} - - TEST_F(BytecodeArrayBuilderTest, Constants) { CanonicalHandleScope canonical(isolate()); BytecodeArrayBuilder builder(isolate(), zone(), 0, 0, 0); @@ -563,9 +507,9 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) { builder.Jump(&near0) .Bind(&after_jump0) - .CompareOperation(Token::Value::EQ, reg) + .CompareOperation(Token::Value::EQ, reg, 1) .JumpIfTrue(&near1) - .CompareOperation(Token::Value::EQ, reg) + .CompareOperation(Token::Value::EQ, reg, 2) .JumpIfFalse(&near2) .BinaryOperation(Token::Value::ADD, reg, 1) .JumpIfTrue(&near3) @@ -578,26 +522,26 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) { .Bind(&near4) .Jump(&far0) .Bind(&after_jump1) - .CompareOperation(Token::Value::EQ, reg) + .CompareOperation(Token::Value::EQ, reg, 3) .JumpIfTrue(&far1) - .CompareOperation(Token::Value::EQ, reg) + .CompareOperation(Token::Value::EQ, reg, 4) .JumpIfFalse(&far2) .BinaryOperation(Token::Value::ADD, reg, 3) .JumpIfTrue(&far3) .BinaryOperation(Token::Value::ADD, reg, 4) .JumpIfFalse(&far4); - for (int i = 0; i < kFarJumpDistance - 20; i++) { + for (int i = 0; i < kFarJumpDistance - 22; i++) { builder.Debugger(); } builder.Bind(&far0).Bind(&far1).Bind(&far2).Bind(&far3).Bind(&far4); builder.Return(); Handle<BytecodeArray> array = builder.ToBytecodeArray(isolate()); - DCHECK_EQ(array->length(), 40 + kFarJumpDistance - 20 + 1); + DCHECK_EQ(array->length(), 44 + kFarJumpDistance - 22 + 1); BytecodeArrayIterator iterator(array); CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); - CHECK_EQ(iterator.GetImmediateOperand(0), 20); + CHECK_EQ(iterator.GetImmediateOperand(0), 22); iterator.Advance(); // Ignore compare operation. @@ -605,7 +549,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) { CHECK_EQ(iterator.current_bytecode(), PeepholeToBoolean(Bytecode::kJumpIfToBooleanTrue)); - CHECK_EQ(iterator.GetImmediateOperand(0), 16); + CHECK_EQ(iterator.GetImmediateOperand(0), 17); iterator.Advance(); // Ignore compare operation. @@ -641,7 +585,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) { CHECK_EQ(iterator.current_bytecode(), PeepholeToBoolean(Bytecode::kJumpIfToBooleanTrueConstant)); CHECK_EQ(*iterator.GetConstantForIndexOperand(0), - Smi::FromInt(kFarJumpDistance - 4)); + Smi::FromInt(kFarJumpDistance - 5)); iterator.Advance(); // Ignore compare operation. @@ -650,7 +594,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) { CHECK_EQ(iterator.current_bytecode(), PeepholeToBoolean(Bytecode::kJumpIfToBooleanFalseConstant)); CHECK_EQ(*iterator.GetConstantForIndexOperand(0), - Smi::FromInt(kFarJumpDistance - 8)); + Smi::FromInt(kFarJumpDistance - 10)); iterator.Advance(); // Ignore add operation. @@ -658,7 +602,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) { CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanTrueConstant); CHECK_EQ(*iterator.GetConstantForIndexOperand(0), - Smi::FromInt(kFarJumpDistance - 13)); + Smi::FromInt(kFarJumpDistance - 15)); iterator.Advance(); // Ignore add operation. @@ -667,7 +611,7 @@ TEST_F(BytecodeArrayBuilderTest, ForwardJumps) { CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanFalseConstant); CHECK_EQ(*iterator.GetConstantForIndexOperand(0), - Smi::FromInt(kFarJumpDistance - 18)); + Smi::FromInt(kFarJumpDistance - 20)); iterator.Advance(); } @@ -678,24 +622,11 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) { Register reg(0); - BytecodeLabel label0, label1, label2, label3, label4; - builder.Bind(&label0) - .Jump(&label0) - .Bind(&label1) - .CompareOperation(Token::Value::EQ, reg) - .JumpIfTrue(&label1) - .Bind(&label2) - .CompareOperation(Token::Value::EQ, reg) - .JumpIfFalse(&label2) - .Bind(&label3) - .BinaryOperation(Token::Value::ADD, reg, 1) - .JumpIfTrue(&label3) - .Bind(&label4) - .BinaryOperation(Token::Value::ADD, reg, 2) - .JumpIfFalse(&label4); - for (int i = 0; i < 62; i++) { + BytecodeLabel label0; + builder.Bind(&label0).JumpLoop(&label0, 0); + for (int i = 0; i < 42; i++) { BytecodeLabel after_jump; - builder.Jump(&label4).Bind(&after_jump); + builder.JumpLoop(&label0, 0).Bind(&after_jump); } // Add padding to force wide backwards jumps. @@ -703,51 +634,21 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) { builder.Debugger(); } - builder.BinaryOperation(Token::Value::ADD, reg, 1).JumpIfFalse(&label4); - builder.BinaryOperation(Token::Value::ADD, reg, 2).JumpIfTrue(&label3); - builder.CompareOperation(Token::Value::EQ, reg).JumpIfFalse(&label2); - builder.CompareOperation(Token::Value::EQ, reg).JumpIfTrue(&label1); - builder.Jump(&label0); + builder.JumpLoop(&label0, 0); BytecodeLabel end; builder.Bind(&end); builder.Return(); Handle<BytecodeArray> array = builder.ToBytecodeArray(isolate()); BytecodeArrayIterator iterator(array); - CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); + CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop); CHECK_EQ(iterator.GetImmediateOperand(0), 0); iterator.Advance(); - // Ignore compare operation. - iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), - PeepholeToBoolean(Bytecode::kJumpIfToBooleanTrue)); - CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); - CHECK_EQ(iterator.GetImmediateOperand(0), -2); - iterator.Advance(); - // Ignore compare operation. - iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), - PeepholeToBoolean(Bytecode::kJumpIfToBooleanFalse)); - CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); - CHECK_EQ(iterator.GetImmediateOperand(0), -2); - iterator.Advance(); - // Ignore binary operation. - iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanTrue); - CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); - CHECK_EQ(iterator.GetImmediateOperand(0), -3); - iterator.Advance(); - // Ignore binary operation. - iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanFalse); - CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); - CHECK_EQ(iterator.GetImmediateOperand(0), -3); - iterator.Advance(); - for (int i = 0; i < 62; i++) { - CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); + for (int i = 0; i < 42; i++) { + CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop); CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); - // offset of 5 (3 for binary operation and 2 for jump) - CHECK_EQ(iterator.GetImmediateOperand(0), -i * 2 - 5); + // offset of 3 (because kJumpLoop takes two immediate operands) + CHECK_EQ(iterator.GetImmediateOperand(0), -i * 3 - 3); iterator.Advance(); } // Check padding to force wide backwards jumps. @@ -755,35 +656,9 @@ TEST_F(BytecodeArrayBuilderTest, BackwardJumps) { CHECK_EQ(iterator.current_bytecode(), Bytecode::kDebugger); iterator.Advance(); } - // Ignore binary operation. - iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanFalse); + CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop); CHECK_EQ(iterator.current_operand_scale(), OperandScale::kDouble); - CHECK_EQ(iterator.GetImmediateOperand(0), -389); - iterator.Advance(); - // Ignore binary operation. - iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpIfToBooleanTrue); - CHECK_EQ(iterator.current_operand_scale(), OperandScale::kDouble); - CHECK_EQ(iterator.GetImmediateOperand(0), -401); - iterator.Advance(); - // Ignore compare operation. - iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), - PeepholeToBoolean(Bytecode::kJumpIfToBooleanFalse)); - CHECK_EQ(iterator.current_operand_scale(), OperandScale::kDouble); - CHECK_EQ(iterator.GetImmediateOperand(0), -411); - iterator.Advance(); - // Ignore compare operation. - iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), - PeepholeToBoolean(Bytecode::kJumpIfToBooleanTrue)); - CHECK_EQ(iterator.current_operand_scale(), OperandScale::kDouble); - CHECK_EQ(iterator.GetImmediateOperand(0), -421); - iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); - CHECK_EQ(iterator.current_operand_scale(), OperandScale::kDouble); - CHECK_EQ(iterator.GetImmediateOperand(0), -427); + CHECK_EQ(iterator.GetImmediateOperand(0), -386); iterator.Advance(); CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); iterator.Advance(); @@ -801,9 +676,9 @@ TEST_F(BytecodeArrayBuilderTest, LabelReuse) { builder.Jump(&label) .Bind(&label) - .Jump(&label) + .JumpLoop(&label, 0) .Bind(&after_jump0) - .Jump(&label) + .JumpLoop(&label, 0) .Bind(&after_jump1) .Return(); @@ -812,11 +687,11 @@ TEST_F(BytecodeArrayBuilderTest, LabelReuse) { CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); CHECK_EQ(iterator.GetImmediateOperand(0), 2); iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); + CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop); CHECK_EQ(iterator.GetImmediateOperand(0), 0); iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); - CHECK_EQ(iterator.GetImmediateOperand(0), -2); + CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop); + CHECK_EQ(iterator.GetImmediateOperand(0), -3); iterator.Advance(); CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); iterator.Advance(); @@ -833,9 +708,9 @@ TEST_F(BytecodeArrayBuilderTest, LabelAddressReuse) { BytecodeLabel label, after_jump0, after_jump1; builder.Jump(&label) .Bind(&label) - .Jump(&label) + .JumpLoop(&label, 0) .Bind(&after_jump0) - .Jump(&label) + .JumpLoop(&label, 0) .Bind(&after_jump1); } builder.Return(); @@ -846,11 +721,11 @@ TEST_F(BytecodeArrayBuilderTest, LabelAddressReuse) { CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); CHECK_EQ(iterator.GetImmediateOperand(0), 2); iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); + CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop); CHECK_EQ(iterator.GetImmediateOperand(0), 0); iterator.Advance(); - CHECK_EQ(iterator.current_bytecode(), Bytecode::kJump); - CHECK_EQ(iterator.GetImmediateOperand(0), -2); + CHECK_EQ(iterator.current_bytecode(), Bytecode::kJumpLoop); + CHECK_EQ(iterator.GetImmediateOperand(0), -3); iterator.Advance(); } CHECK_EQ(iterator.current_bytecode(), Bytecode::kReturn); diff --git a/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc index b844180dc0..07ecefb529 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-array-iterator-unittest.cc @@ -31,6 +31,8 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) { Smi* smi_1 = Smi::FromInt(-65536); Register reg_0(0); Register reg_1(1); + RegisterList pair(0, 2); + RegisterList triple(0, 3); Register param = Register::FromParameterIndex(2, builder.parameter_count()); Handle<String> name = factory->NewStringFromStaticChars("abc"); int name_index = 2; @@ -54,9 +56,9 @@ TEST_F(BytecodeArrayIteratorTest, IteratesBytecodeArray) { .LoadNamedProperty(reg_1, name, feedback_slot) .BinaryOperation(Token::Value::ADD, reg_0, 3) .StoreAccumulatorInRegister(param) - .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) - .ForInPrepare(reg_0, reg_0) - .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) + .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, pair) + .ForInPrepare(reg_0, triple) + .CallRuntime(Runtime::kLoadIC_Miss, reg_0) .Debugger() .LoadGlobal(0x10000000, TypeofMode::NOT_INSIDE_TYPEOF) .Return(); diff --git a/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc index 9681612ac4..0bb0f9757a 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-array-writer-unittest.cc @@ -28,86 +28,78 @@ class BytecodeArrayWriterUnittest : public TestWithIsolateAndZone { SourcePositionTableBuilder::RECORD_SOURCE_POSITIONS) {} ~BytecodeArrayWriterUnittest() override {} - void Write(BytecodeNode* node, const BytecodeSourceInfo& info); - void Write(Bytecode bytecode, - const BytecodeSourceInfo& info = BytecodeSourceInfo()); + void Write(Bytecode bytecode, BytecodeSourceInfo info = BytecodeSourceInfo()); void Write(Bytecode bytecode, uint32_t operand0, - const BytecodeSourceInfo& info = BytecodeSourceInfo()); + BytecodeSourceInfo info = BytecodeSourceInfo()); void Write(Bytecode bytecode, uint32_t operand0, uint32_t operand1, - - const BytecodeSourceInfo& info = BytecodeSourceInfo()); + BytecodeSourceInfo info = BytecodeSourceInfo()); void Write(Bytecode bytecode, uint32_t operand0, uint32_t operand1, - uint32_t operand2, - const BytecodeSourceInfo& info = BytecodeSourceInfo()); + uint32_t operand2, BytecodeSourceInfo info = BytecodeSourceInfo()); void Write(Bytecode bytecode, uint32_t operand0, uint32_t operand1, uint32_t operand2, uint32_t operand3, - const BytecodeSourceInfo& info = BytecodeSourceInfo()); + BytecodeSourceInfo info = BytecodeSourceInfo()); void WriteJump(Bytecode bytecode, BytecodeLabel* label, - - const BytecodeSourceInfo& info = BytecodeSourceInfo()); + BytecodeSourceInfo info = BytecodeSourceInfo()); + void WriteJumpLoop(Bytecode bytecode, BytecodeLabel* label, int depth, + BytecodeSourceInfo info = BytecodeSourceInfo()); BytecodeArrayWriter* writer() { return &bytecode_array_writer_; } ZoneVector<unsigned char>* bytecodes() { return writer()->bytecodes(); } SourcePositionTableBuilder* source_position_table_builder() { return writer()->source_position_table_builder(); } - int max_register_count() { return writer()->max_register_count(); } private: ConstantArrayBuilder constant_array_builder_; BytecodeArrayWriter bytecode_array_writer_; }; -void BytecodeArrayWriterUnittest::Write(BytecodeNode* node, - const BytecodeSourceInfo& info) { - if (info.is_valid()) { - node->source_info().Clone(info); - } - writer()->Write(node); -} - void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, - const BytecodeSourceInfo& info) { - BytecodeNode node(bytecode); - Write(&node, info); + BytecodeSourceInfo info) { + BytecodeNode node(bytecode, &info); + writer()->Write(&node); } void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0, - const BytecodeSourceInfo& info) { - BytecodeNode node(bytecode, operand0); - Write(&node, info); + BytecodeSourceInfo info) { + BytecodeNode node(bytecode, operand0, &info); + writer()->Write(&node); } void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0, uint32_t operand1, - const BytecodeSourceInfo& info) { - BytecodeNode node(bytecode, operand0, operand1); - Write(&node, info); + BytecodeSourceInfo info) { + BytecodeNode node(bytecode, operand0, operand1, &info); + writer()->Write(&node); } void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0, uint32_t operand1, uint32_t operand2, - const BytecodeSourceInfo& info) { - BytecodeNode node(bytecode, operand0, operand1, operand2); - Write(&node, info); + BytecodeSourceInfo info) { + BytecodeNode node(bytecode, operand0, operand1, operand2, &info); + writer()->Write(&node); } void BytecodeArrayWriterUnittest::Write(Bytecode bytecode, uint32_t operand0, uint32_t operand1, uint32_t operand2, uint32_t operand3, - const BytecodeSourceInfo& info) { - BytecodeNode node(bytecode, operand0, operand1, operand2, operand3); - Write(&node, info); + BytecodeSourceInfo info) { + BytecodeNode node(bytecode, operand0, operand1, operand2, operand3, &info); + writer()->Write(&node); } void BytecodeArrayWriterUnittest::WriteJump(Bytecode bytecode, BytecodeLabel* label, - const BytecodeSourceInfo& info) { - BytecodeNode node(bytecode, 0); - if (info.is_valid()) { - node.source_info().Clone(info); - } + BytecodeSourceInfo info) { + BytecodeNode node(bytecode, 0, &info); + writer()->WriteJump(&node, label); +} + +void BytecodeArrayWriterUnittest::WriteJumpLoop(Bytecode bytecode, + BytecodeLabel* label, int depth, + BytecodeSourceInfo info) { + BytecodeNode node(bytecode, 0, depth, &info); writer()->WriteJump(&node, label); } @@ -116,19 +108,15 @@ TEST_F(BytecodeArrayWriterUnittest, SimpleExample) { Write(Bytecode::kStackCheck, {10, false}); CHECK_EQ(bytecodes()->size(), 1); - CHECK_EQ(max_register_count(), 0); Write(Bytecode::kLdaSmi, 127, {55, true}); CHECK_EQ(bytecodes()->size(), 3); - CHECK_EQ(max_register_count(), 0); Write(Bytecode::kLdar, Register(200).ToOperand()); CHECK_EQ(bytecodes()->size(), 7); - CHECK_EQ(max_register_count(), 201); Write(Bytecode::kReturn, {70, true}); CHECK_EQ(bytecodes()->size(), 8); - CHECK_EQ(max_register_count(), 201); static const uint8_t bytes[] = {B(StackCheck), B(LdaSmi), U8(127), B(Wide), B(Ldar), R16(200), B(Return)}; @@ -160,15 +148,15 @@ TEST_F(BytecodeArrayWriterUnittest, ComplexExample) { // clang-format off /* 0 30 E> */ B(StackCheck), /* 1 42 S> */ B(LdaConstant), U8(0), - /* 3 42 E> */ B(Star), R8(1), - /* 5 68 S> */ B(JumpIfUndefined), U8(38), - /* 7 */ B(JumpIfNull), U8(36), + /* 3 42 E> */ B(Add), R8(1), U8(1), + /* 5 68 S> */ B(JumpIfUndefined), U8(39), + /* 7 */ B(JumpIfNull), U8(37), /* 9 */ B(ToObject), R8(3), /* 11 */ B(ForInPrepare), R8(3), R8(4), /* 14 */ B(LdaZero), /* 15 */ B(Star), R8(7), - /* 17 63 S> */ B(ForInDone), R8(7), R8(6), - /* 20 */ B(JumpIfTrue), U8(23), + /* 17 63 S> */ B(ForInContinue), R8(7), R8(6), + /* 20 */ B(JumpIfFalse), U8(24), /* 22 */ B(ForInNext), R8(3), R8(7), R8(4), U8(1), /* 27 */ B(JumpIfUndefined), U8(10), /* 29 */ B(Star), R8(0), @@ -178,38 +166,31 @@ TEST_F(BytecodeArrayWriterUnittest, ComplexExample) { /* 36 85 S> */ B(Return), /* 37 */ B(ForInStep), R8(7), /* 39 */ B(Star), R8(7), - /* 41 */ B(Jump), U8(-24), - /* 43 */ B(LdaUndefined), - /* 44 85 S> */ B(Return), + /* 41 */ B(JumpLoop), U8(-24), U8(0), + /* 44 */ B(LdaUndefined), + /* 45 85 S> */ B(Return), // clang-format on }; static const PositionTableEntry expected_positions[] = { - {0, 30, false}, {1, 42, true}, {3, 42, false}, {5, 68, true}, - {17, 63, true}, {31, 54, false}, {36, 85, true}, {44, 85, true}}; + {0, 30, false}, {1, 42, true}, {3, 42, false}, {6, 68, true}, + {18, 63, true}, {32, 54, false}, {37, 85, true}, {46, 85, true}}; BytecodeLabel back_jump, jump_for_in, jump_end_1, jump_end_2, jump_end_3; #define R(i) static_cast<uint32_t>(Register(i).ToOperand()) Write(Bytecode::kStackCheck, {30, false}); Write(Bytecode::kLdaConstant, U8(0), {42, true}); - CHECK_EQ(max_register_count(), 0); - Write(Bytecode::kStar, R(1), {42, false}); - CHECK_EQ(max_register_count(), 2); + Write(Bytecode::kAdd, R(1), U8(1), {42, false}); WriteJump(Bytecode::kJumpIfUndefined, &jump_end_1, {68, true}); WriteJump(Bytecode::kJumpIfNull, &jump_end_2); Write(Bytecode::kToObject, R(3)); - CHECK_EQ(max_register_count(), 4); Write(Bytecode::kForInPrepare, R(3), R(4)); - CHECK_EQ(max_register_count(), 7); Write(Bytecode::kLdaZero); - CHECK_EQ(max_register_count(), 7); Write(Bytecode::kStar, R(7)); - CHECK_EQ(max_register_count(), 8); writer()->BindLabel(&back_jump); - Write(Bytecode::kForInDone, R(7), R(6), {63, true}); - CHECK_EQ(max_register_count(), 8); - WriteJump(Bytecode::kJumpIfTrue, &jump_end_3); + Write(Bytecode::kForInContinue, R(7), R(6), {63, true}); + WriteJump(Bytecode::kJumpIfFalse, &jump_end_3); Write(Bytecode::kForInNext, R(3), R(7), R(4), U8(1)); WriteJump(Bytecode::kJumpIfUndefined, &jump_for_in); Write(Bytecode::kStar, R(0)); @@ -220,13 +201,12 @@ TEST_F(BytecodeArrayWriterUnittest, ComplexExample) { writer()->BindLabel(&jump_for_in); Write(Bytecode::kForInStep, R(7)); Write(Bytecode::kStar, R(7)); - WriteJump(Bytecode::kJump, &back_jump); + WriteJumpLoop(Bytecode::kJumpLoop, &back_jump, 0); writer()->BindLabel(&jump_end_1); writer()->BindLabel(&jump_end_2); writer()->BindLabel(&jump_end_3); Write(Bytecode::kLdaUndefined); Write(Bytecode::kReturn, {85, true}); - CHECK_EQ(max_register_count(), 8); #undef R CHECK_EQ(bytecodes()->size(), arraysize(expected_bytes)); diff --git a/deps/v8/test/unittests/interpreter/bytecode-dead-code-optimizer-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-dead-code-optimizer-unittest.cc index 2b2171bc78..4cb5e69f4e 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-dead-code-optimizer-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-dead-code-optimizer-unittest.cc @@ -16,7 +16,8 @@ namespace interpreter { class BytecodeDeadCodeOptimizerTest : public BytecodePipelineStage, public TestWithIsolateAndZone { public: - BytecodeDeadCodeOptimizerTest() : dead_code_optimizer_(this) {} + BytecodeDeadCodeOptimizerTest() + : dead_code_optimizer_(this), last_written_(Bytecode::kIllegal) {} ~BytecodeDeadCodeOptimizerTest() override {} void Write(BytecodeNode* node) override { @@ -56,7 +57,7 @@ TEST_F(BytecodeDeadCodeOptimizerTest, LiveCodeKept) { CHECK_EQ(add, last_written()); BytecodeLabel target; - BytecodeNode jump(Bytecode::kJump, 0); + BytecodeNode jump(Bytecode::kJump, 0, nullptr); optimizer()->WriteJump(&jump, &target); CHECK_EQ(write_count(), 2); CHECK_EQ(jump, last_written()); @@ -100,7 +101,7 @@ TEST_F(BytecodeDeadCodeOptimizerTest, DeadCodeAfterReThrowEliminated) { TEST_F(BytecodeDeadCodeOptimizerTest, DeadCodeAfterJumpEliminated) { BytecodeLabel target; - BytecodeNode jump(Bytecode::kJump, 0); + BytecodeNode jump(Bytecode::kJump, 0, nullptr); optimizer()->WriteJump(&jump, &target); CHECK_EQ(write_count(), 1); CHECK_EQ(jump, last_written()); @@ -118,7 +119,7 @@ TEST_F(BytecodeDeadCodeOptimizerTest, DeadCodeStillDeadAfterConditinalJump) { CHECK_EQ(ret, last_written()); BytecodeLabel target; - BytecodeNode jump(Bytecode::kJumpIfTrue, 0); + BytecodeNode jump(Bytecode::kJumpIfTrue, 0, nullptr); optimizer()->WriteJump(&jump, &target); CHECK_EQ(write_count(), 1); CHECK_EQ(ret, last_written()); diff --git a/deps/v8/test/unittests/interpreter/bytecode-decoder-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-decoder-unittest.cc index 7d61f6a1b3..1b0af73e05 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-decoder-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-decoder-unittest.cc @@ -37,10 +37,18 @@ TEST(BytecodeDecoder, DecodeBytecodeAndOperands) { "LdaSmi.ExtraWide [-100000]"}, {{B(Star), R8(5)}, 2, 0, " Star r5"}, {{B(Wide), B(Star), R16(136)}, 4, 0, " Star.Wide r136"}, - {{B(Wide), B(Call), R16(134), R16(135), U16(2), U16(177)}, + {{B(Wide), B(Call), R16(134), R16(135), U16(10), U16(177)}, 10, 0, - "Call.Wide r134, r135, #2, [177]"}, + "Call.Wide r134, r135-r144, [177]"}, + {{B(ForInPrepare), R8(10), R8(11)}, + 3, + 0, + " ForInPrepare r10, r11-r13"}, + {{B(CallRuntime), U16(134), R8(0), U8(0)}, + 5, + 0, + " CallRuntime [134], r0-r0"}, {{B(Ldar), static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())}, 2, diff --git a/deps/v8/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc index c23c89b433..d7beb47a01 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-peephole-optimizer-unittest.cc @@ -18,7 +18,8 @@ namespace interpreter { class BytecodePeepholeOptimizerTest : public BytecodePipelineStage, public TestWithIsolateAndZone { public: - BytecodePeepholeOptimizerTest() : peephole_optimizer_(this) {} + BytecodePeepholeOptimizerTest() + : peephole_optimizer_(this), last_written_(Bytecode::kIllegal) {} ~BytecodePeepholeOptimizerTest() override {} void Reset() { @@ -71,7 +72,7 @@ TEST_F(BytecodePeepholeOptimizerTest, FlushOnJump) { CHECK_EQ(write_count(), 0); BytecodeLabel target; - BytecodeNode jump(Bytecode::kJump, 0); + BytecodeNode jump(Bytecode::kJump, 0, nullptr); optimizer()->WriteJump(&jump, &target); CHECK_EQ(write_count(), 2); CHECK_EQ(jump, last_written()); @@ -103,8 +104,8 @@ TEST_F(BytecodePeepholeOptimizerTest, ElideEmptyNop) { } TEST_F(BytecodePeepholeOptimizerTest, ElideExpressionNop) { - BytecodeNode nop(Bytecode::kNop); - nop.source_info().MakeExpressionPosition(3); + BytecodeSourceInfo source_info(3, false); + BytecodeNode nop(Bytecode::kNop, &source_info); optimizer()->Write(&nop); BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1); optimizer()->Write(&add); @@ -114,11 +115,11 @@ TEST_F(BytecodePeepholeOptimizerTest, ElideExpressionNop) { } TEST_F(BytecodePeepholeOptimizerTest, KeepStatementNop) { - BytecodeNode nop(Bytecode::kNop); - nop.source_info().MakeStatementPosition(3); + BytecodeSourceInfo source_info(3, true); + BytecodeNode nop(Bytecode::kNop, &source_info); optimizer()->Write(&nop); - BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1); - add.source_info().MakeExpressionPosition(3); + source_info.MakeExpressionPosition(3); + BytecodeNode add(Bytecode::kAdd, Register(0).ToOperand(), 1, &source_info); optimizer()->Write(&add); Flush(); CHECK_EQ(write_count(), 2); @@ -204,8 +205,8 @@ TEST_F(BytecodePeepholeOptimizerTest, StarRxLdarRx) { TEST_F(BytecodePeepholeOptimizerTest, StarRxLdarRxStatement) { BytecodeNode first(Bytecode::kStar, Register(0).ToOperand()); - BytecodeNode second(Bytecode::kLdar, Register(0).ToOperand()); - second.source_info().MakeStatementPosition(0); + BytecodeSourceInfo source_info(3, true); + BytecodeNode second(Bytecode::kLdar, Register(0).ToOperand(), &source_info); optimizer()->Write(&first); CHECK_EQ(write_count(), 0); optimizer()->Write(&second); @@ -220,9 +221,9 @@ TEST_F(BytecodePeepholeOptimizerTest, StarRxLdarRxStatement) { TEST_F(BytecodePeepholeOptimizerTest, StarRxLdarRxStatementStarRy) { BytecodeLabel label; BytecodeNode first(Bytecode::kStar, Register(0).ToOperand()); - BytecodeNode second(Bytecode::kLdar, Register(0).ToOperand()); + BytecodeSourceInfo source_info(0, true); + BytecodeNode second(Bytecode::kLdar, Register(0).ToOperand(), &source_info); BytecodeNode third(Bytecode::kStar, Register(3).ToOperand()); - second.source_info().MakeStatementPosition(0); optimizer()->Write(&first); CHECK_EQ(write_count(), 0); optimizer()->Write(&second); @@ -277,8 +278,8 @@ TEST_F(BytecodePeepholeOptimizerTest, LdaTrueLdaFalse) { } TEST_F(BytecodePeepholeOptimizerTest, LdaTrueStatementLdaFalse) { - BytecodeNode first(Bytecode::kLdaTrue); - first.source_info().MakeExpressionPosition(3); + BytecodeSourceInfo source_info(3, true); + BytecodeNode first(Bytecode::kLdaTrue, &source_info); BytecodeNode second(Bytecode::kLdaFalse); optimizer()->Write(&first); CHECK_EQ(write_count(), 0); @@ -287,13 +288,13 @@ TEST_F(BytecodePeepholeOptimizerTest, LdaTrueStatementLdaFalse) { Flush(); CHECK_EQ(write_count(), 1); CHECK_EQ(last_written(), second); - CHECK(second.source_info().is_expression()); + CHECK(second.source_info().is_statement()); CHECK_EQ(second.source_info().source_position(), 3); } TEST_F(BytecodePeepholeOptimizerTest, NopStackCheck) { BytecodeNode first(Bytecode::kNop); - BytecodeNode second(Bytecode::kStackCheck); + BytecodeNode second(Bytecode::kStackCheck, nullptr); optimizer()->Write(&first); CHECK_EQ(write_count(), 0); optimizer()->Write(&second); @@ -304,8 +305,8 @@ TEST_F(BytecodePeepholeOptimizerTest, NopStackCheck) { } TEST_F(BytecodePeepholeOptimizerTest, NopStatementStackCheck) { - BytecodeNode first(Bytecode::kNop); - first.source_info().MakeExpressionPosition(3); + BytecodeSourceInfo source_info(3, true); + BytecodeNode first(Bytecode::kNop, &source_info); BytecodeNode second(Bytecode::kStackCheck); optimizer()->Write(&first); CHECK_EQ(write_count(), 0); @@ -313,9 +314,9 @@ TEST_F(BytecodePeepholeOptimizerTest, NopStatementStackCheck) { CHECK_EQ(write_count(), 0); Flush(); CHECK_EQ(write_count(), 1); - second.source_info().MakeExpressionPosition( - first.source_info().source_position()); - CHECK_EQ(last_written(), second); + BytecodeSourceInfo expected_source_info(3, true); + BytecodeNode expected(Bytecode::kStackCheck, &expected_source_info); + CHECK_EQ(last_written(), expected); } // Tests covering BytecodePeepholeOptimizer::UpdateLastAndCurrentBytecodes(). @@ -352,7 +353,8 @@ TEST_F(BytecodePeepholeOptimizerTest, MergeLdaKeyedPropertyStar) { static_cast<uint32_t>(Register(1).ToOperand())}; const int expected_operand_count = static_cast<int>(arraysize(operands)); - BytecodeNode first(Bytecode::kLdaKeyedProperty, operands[0], operands[1]); + BytecodeNode first(Bytecode::kLdaKeyedProperty, operands[0], operands[1], + nullptr); BytecodeNode second(Bytecode::kStar, operands[2]); BytecodeNode third(Bytecode::kReturn); optimizer()->Write(&first); @@ -398,11 +400,13 @@ TEST_F(BytecodePeepholeOptimizerTest, MergeLdaGlobalStar) { TEST_F(BytecodePeepholeOptimizerTest, MergeLdaContextSlotStar) { const uint32_t operands[] = { static_cast<uint32_t>(Register(200000).ToOperand()), 55005500, + static_cast<uint32_t>(Register(0).ToOperand()), static_cast<uint32_t>(Register(1).ToOperand())}; const int expected_operand_count = static_cast<int>(arraysize(operands)); - BytecodeNode first(Bytecode::kLdaContextSlot, operands[0], operands[1]); - BytecodeNode second(Bytecode::kStar, operands[2]); + BytecodeNode first(Bytecode::kLdaContextSlot, operands[0], operands[1], + operands[2]); + BytecodeNode second(Bytecode::kStar, operands[3]); BytecodeNode third(Bytecode::kReturn); optimizer()->Write(&first); optimizer()->Write(&second); @@ -455,8 +459,8 @@ TEST_F(BytecodePeepholeOptimizerTest, MergeLdaSmiWithBinaryOp) { for (auto operator_replacement : operator_replacement_pairs) { uint32_t imm_operand = 17; - BytecodeNode first(Bytecode::kLdaSmi, imm_operand); - first.source_info().Clone({3, true}); + BytecodeSourceInfo source_info(3, true); + BytecodeNode first(Bytecode::kLdaSmi, imm_operand, &source_info); uint32_t reg_operand = Register(0).ToOperand(); uint32_t idx_operand = 1; BytecodeNode second(operator_replacement[0], reg_operand, idx_operand); @@ -485,11 +489,11 @@ TEST_F(BytecodePeepholeOptimizerTest, NotMergingLdaSmiWithBinaryOp) { for (auto operator_replacement : operator_replacement_pairs) { uint32_t imm_operand = 17; - BytecodeNode first(Bytecode::kLdaSmi, imm_operand); - first.source_info().Clone({3, true}); + BytecodeSourceInfo source_info(3, true); + BytecodeNode first(Bytecode::kLdaSmi, imm_operand, &source_info); uint32_t reg_operand = Register(0).ToOperand(); - BytecodeNode second(operator_replacement[0], reg_operand, 1); - second.source_info().Clone({4, true}); + source_info.MakeStatementPosition(4); + BytecodeNode second(operator_replacement[0], reg_operand, 1, &source_info); optimizer()->Write(&first); optimizer()->Write(&second); CHECK_EQ(last_written(), first); diff --git a/deps/v8/test/unittests/interpreter/bytecode-pipeline-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-pipeline-unittest.cc index 663b7e54e5..4399dce6f9 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-pipeline-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-pipeline-unittest.cc @@ -51,12 +51,6 @@ TEST(BytecodeSourceInfo, Operations) { CHECK_EQ(y.is_statement(), true); } -TEST_F(BytecodeNodeTest, Constructor0) { - BytecodeNode node; - CHECK_EQ(node.bytecode(), Bytecode::kIllegal); - CHECK(!node.source_info().is_valid()); -} - TEST_F(BytecodeNodeTest, Constructor1) { BytecodeNode node(Bytecode::kLdaZero); CHECK_EQ(node.bytecode(), Bytecode::kLdaZero); @@ -119,21 +113,21 @@ TEST_F(BytecodeNodeTest, Equality) { TEST_F(BytecodeNodeTest, EqualityWithSourceInfo) { uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; + BytecodeSourceInfo first_source_info(3, true); BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], - operands[3]); - node.source_info().MakeStatementPosition(3); + operands[3], &first_source_info); CHECK_EQ(node, node); + BytecodeSourceInfo second_source_info(3, true); BytecodeNode other(Bytecode::kForInNext, operands[0], operands[1], - operands[2], operands[3]); - other.source_info().MakeStatementPosition(3); + operands[2], operands[3], &second_source_info); CHECK_EQ(node, other); } TEST_F(BytecodeNodeTest, NoEqualityWithDifferentSourceInfo) { uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; + BytecodeSourceInfo source_info(77, true); BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], - operands[3]); - node.source_info().MakeStatementPosition(3); + operands[3], &source_info); BytecodeNode other(Bytecode::kForInNext, operands[0], operands[1], operands[2], operands[3]); CHECK_NE(node, other); @@ -143,41 +137,39 @@ TEST_F(BytecodeNodeTest, Clone) { uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], operands[3]); - BytecodeNode clone; + BytecodeNode clone(Bytecode::kIllegal); clone.Clone(&node); CHECK_EQ(clone, node); } TEST_F(BytecodeNodeTest, SetBytecode0) { uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; - BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], - operands[3]); BytecodeSourceInfo source_info(77, false); - node.source_info().Clone(source_info); - CHECK_EQ(node.source_info(), source_info); + BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], + operands[3], &source_info); + CHECK_EQ(node.source_info(), BytecodeSourceInfo(77, false)); - BytecodeNode clone; + BytecodeNode clone(Bytecode::kIllegal); clone.Clone(&node); clone.set_bytecode(Bytecode::kNop); CHECK_EQ(clone.bytecode(), Bytecode::kNop); CHECK_EQ(clone.operand_count(), 0); - CHECK_EQ(clone.source_info(), source_info); + CHECK_EQ(clone.source_info(), BytecodeSourceInfo(77, false)); } TEST_F(BytecodeNodeTest, SetBytecode1) { uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; - BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], - operands[3]); BytecodeSourceInfo source_info(77, false); - node.source_info().Clone(source_info); + BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], + operands[3], &source_info); - BytecodeNode clone; + BytecodeNode clone(Bytecode::kIllegal); clone.Clone(&node); clone.set_bytecode(Bytecode::kJump, 0x01aabbcc); CHECK_EQ(clone.bytecode(), Bytecode::kJump); CHECK_EQ(clone.operand_count(), 1); CHECK_EQ(clone.operand(0), 0x01aabbcc); - CHECK_EQ(clone.source_info(), source_info); + CHECK_EQ(clone.source_info(), BytecodeSourceInfo(77, false)); } } // namespace interpreter diff --git a/deps/v8/test/unittests/interpreter/bytecode-register-allocator-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-register-allocator-unittest.cc index d4dc111d69..f06e454cc9 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-register-allocator-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-register-allocator-unittest.cc @@ -12,199 +12,83 @@ namespace v8 { namespace internal { namespace interpreter { -class TemporaryRegisterAllocatorTest : public TestWithIsolateAndZone { - public: - TemporaryRegisterAllocatorTest() : allocator_(zone(), 0) {} - ~TemporaryRegisterAllocatorTest() override {} - TemporaryRegisterAllocator* allocator() { return &allocator_; } - - private: - TemporaryRegisterAllocator allocator_; -}; - -TEST_F(TemporaryRegisterAllocatorTest, FirstAllocation) { - CHECK_EQ(allocator()->allocation_count(), 0); - int reg0_index = allocator()->BorrowTemporaryRegister(); - CHECK_EQ(reg0_index, 0); - CHECK_EQ(allocator()->allocation_count(), 1); - CHECK(allocator()->RegisterIsLive(Register(reg0_index))); - allocator()->ReturnTemporaryRegister(reg0_index); - CHECK(!allocator()->RegisterIsLive(Register(reg0_index))); - CHECK_EQ(allocator()->allocation_count(), 1); - CHECK(allocator()->first_temporary_register() == Register(0)); - CHECK(allocator()->last_temporary_register() == Register(0)); -} - -TEST_F(TemporaryRegisterAllocatorTest, SimpleAllocations) { - for (int i = 0; i < 13; i++) { - int reg_index = allocator()->BorrowTemporaryRegister(); - CHECK_EQ(reg_index, i); - CHECK_EQ(allocator()->allocation_count(), i + 1); - } - for (int i = 0; i < 13; i++) { - CHECK(allocator()->RegisterIsLive(Register(i))); - allocator()->ReturnTemporaryRegister(i); - CHECK(!allocator()->RegisterIsLive(Register(i))); - int reg_index = allocator()->BorrowTemporaryRegister(); - CHECK_EQ(reg_index, i); - CHECK_EQ(allocator()->allocation_count(), 13); - } - for (int i = 0; i < 13; i++) { - CHECK(allocator()->RegisterIsLive(Register(i))); - allocator()->ReturnTemporaryRegister(i); - CHECK(!allocator()->RegisterIsLive(Register(i))); - } -} - -TEST_F(TemporaryRegisterAllocatorTest, SimpleRangeAllocation) { - static const int kRunLength = 7; - int start = allocator()->PrepareForConsecutiveTemporaryRegisters(kRunLength); - CHECK(!allocator()->RegisterIsLive(Register(start))); - for (int i = 0; i < kRunLength; i++) { - CHECK(!allocator()->RegisterIsLive(Register(start + i))); - allocator()->BorrowConsecutiveTemporaryRegister(start + i); - CHECK(allocator()->RegisterIsLive(Register(start + i))); - } -} - -TEST_F(TemporaryRegisterAllocatorTest, RangeAllocationAbuttingFree) { - static const int kFreeCount = 3; - static const int kRunLength = 6; - - for (int i = 0; i < kFreeCount; i++) { - int to_free = allocator()->BorrowTemporaryRegister(); - CHECK_EQ(to_free, i); - } - for (int i = 0; i < kFreeCount; i++) { - allocator()->ReturnTemporaryRegister(i); - } - - int start = allocator()->PrepareForConsecutiveTemporaryRegisters(kRunLength); - CHECK(!allocator()->RegisterIsLive(Register(start))); - for (int i = 0; i < kRunLength; i++) { - CHECK(!allocator()->RegisterIsLive(Register(start + i))); - allocator()->BorrowConsecutiveTemporaryRegister(start + i); - CHECK(allocator()->RegisterIsLive(Register(start + i))); - } -} - -TEST_F(TemporaryRegisterAllocatorTest, RangeAllocationAbuttingHole) { - static const int kPreAllocatedCount = 7; - static const int kPreAllocatedFreeCount = 6; - static const int kRunLength = 8; - - for (int i = 0; i < kPreAllocatedCount; i++) { - int to_free = allocator()->BorrowTemporaryRegister(); - CHECK_EQ(to_free, i); - } - for (int i = 0; i < kPreAllocatedFreeCount; i++) { - allocator()->ReturnTemporaryRegister(i); - } - int start = allocator()->PrepareForConsecutiveTemporaryRegisters(kRunLength); - CHECK(!allocator()->RegisterIsLive(Register(start))); - CHECK_EQ(start, kPreAllocatedCount); - for (int i = 0; i < kRunLength; i++) { - CHECK(!allocator()->RegisterIsLive(Register(start + i))); - allocator()->BorrowConsecutiveTemporaryRegister(start + i); - CHECK(allocator()->RegisterIsLive(Register(start + i))); - } -} - -TEST_F(TemporaryRegisterAllocatorTest, RangeAllocationAvailableInTemporaries) { - static const int kNotRunLength = 13; - static const int kRunLength = 8; - - // Allocate big batch - for (int i = 0; i < kNotRunLength * 2 + kRunLength; i++) { - int allocated = allocator()->BorrowTemporaryRegister(); - CHECK_EQ(allocated, i); - } - // Free every other register either side of target. - for (int i = 0; i < kNotRunLength; i++) { - if ((i & 2) == 1) { - allocator()->ReturnTemporaryRegister(i); - allocator()->ReturnTemporaryRegister(kNotRunLength + kRunLength + i); - } - } - // Free all registers for target. - for (int i = kNotRunLength; i < kNotRunLength + kRunLength; i++) { - allocator()->ReturnTemporaryRegister(i); - } - - int start = allocator()->PrepareForConsecutiveTemporaryRegisters(kRunLength); - CHECK_EQ(start, kNotRunLength); - for (int i = 0; i < kRunLength; i++) { - CHECK(!allocator()->RegisterIsLive(Register(start + i))); - allocator()->BorrowConsecutiveTemporaryRegister(start + i); - CHECK(allocator()->RegisterIsLive(Register(start + i))); - } -} - -TEST_F(TemporaryRegisterAllocatorTest, NotInRange) { - for (int i = 0; i < 10; i++) { - int reg = allocator()->BorrowTemporaryRegisterNotInRange(2, 5); - CHECK(reg == i || (reg > 2 && reg == i + 4)); - } - for (int i = 0; i < 10; i++) { - if (i < 2) { - allocator()->ReturnTemporaryRegister(i); - } else { - allocator()->ReturnTemporaryRegister(i + 4); - } - } - int reg0 = allocator()->BorrowTemporaryRegisterNotInRange(0, 3); - CHECK_EQ(reg0, 4); - int reg1 = allocator()->BorrowTemporaryRegisterNotInRange(3, 10); - CHECK_EQ(reg1, 2); - int reg2 = allocator()->BorrowTemporaryRegisterNotInRange(2, 6); - CHECK_EQ(reg2, 1); - allocator()->ReturnTemporaryRegister(reg0); - allocator()->ReturnTemporaryRegister(reg1); - allocator()->ReturnTemporaryRegister(reg2); -} - class BytecodeRegisterAllocatorTest : public TestWithIsolateAndZone { public: - BytecodeRegisterAllocatorTest() {} + BytecodeRegisterAllocatorTest() : allocator_(0) {} ~BytecodeRegisterAllocatorTest() override {} -}; - -TEST_F(BytecodeRegisterAllocatorTest, TemporariesRecycled) { - BytecodeArrayBuilder builder(isolate(), zone(), 0, 0, 0); - int first; - { - BytecodeRegisterAllocator allocator(zone(), - builder.temporary_register_allocator()); - first = allocator.NewRegister().index(); - allocator.NewRegister(); - allocator.NewRegister(); - allocator.NewRegister(); - } + BytecodeRegisterAllocator* allocator() { return &allocator_; } - int second; - { - BytecodeRegisterAllocator allocator(zone(), - builder.temporary_register_allocator()); - second = allocator.NewRegister().index(); - } + private: + BytecodeRegisterAllocator allocator_; +}; - CHECK_EQ(first, second); +TEST_F(BytecodeRegisterAllocatorTest, SimpleAllocations) { + CHECK_EQ(allocator()->maximum_register_count(), 0); + Register reg0 = allocator()->NewRegister(); + CHECK_EQ(reg0.index(), 0); + CHECK_EQ(allocator()->maximum_register_count(), 1); + CHECK_EQ(allocator()->next_register_index(), 1); + CHECK(allocator()->RegisterIsLive(reg0)); + + allocator()->ReleaseRegisters(0); + CHECK(!allocator()->RegisterIsLive(reg0)); + CHECK_EQ(allocator()->maximum_register_count(), 1); + CHECK_EQ(allocator()->next_register_index(), 0); + + reg0 = allocator()->NewRegister(); + Register reg1 = allocator()->NewRegister(); + CHECK_EQ(reg0.index(), 0); + CHECK_EQ(reg1.index(), 1); + CHECK(allocator()->RegisterIsLive(reg0)); + CHECK(allocator()->RegisterIsLive(reg1)); + CHECK_EQ(allocator()->maximum_register_count(), 2); + CHECK_EQ(allocator()->next_register_index(), 2); + + allocator()->ReleaseRegisters(1); + CHECK(allocator()->RegisterIsLive(reg0)); + CHECK(!allocator()->RegisterIsLive(reg1)); + CHECK_EQ(allocator()->maximum_register_count(), 2); + CHECK_EQ(allocator()->next_register_index(), 1); } -TEST_F(BytecodeRegisterAllocatorTest, ConsecutiveRegisters) { - BytecodeArrayBuilder builder(isolate(), zone(), 0, 0, 0); - BytecodeRegisterAllocator allocator(zone(), - builder.temporary_register_allocator()); - allocator.PrepareForConsecutiveAllocations(4); - Register reg0 = allocator.NextConsecutiveRegister(); - Register other = allocator.NewRegister(); - Register reg1 = allocator.NextConsecutiveRegister(); - Register reg2 = allocator.NextConsecutiveRegister(); - Register reg3 = allocator.NextConsecutiveRegister(); - USE(other); - - CHECK(Register::AreContiguous(reg0, reg1, reg2, reg3)); +TEST_F(BytecodeRegisterAllocatorTest, RegisterListAllocations) { + CHECK_EQ(allocator()->maximum_register_count(), 0); + RegisterList reg_list = allocator()->NewRegisterList(3); + CHECK_EQ(reg_list.first_register().index(), 0); + CHECK_EQ(reg_list.register_count(), 3); + CHECK_EQ(reg_list[0].index(), 0); + CHECK_EQ(reg_list[1].index(), 1); + CHECK_EQ(reg_list[2].index(), 2); + CHECK_EQ(allocator()->maximum_register_count(), 3); + CHECK_EQ(allocator()->next_register_index(), 3); + CHECK(allocator()->RegisterIsLive(reg_list[2])); + + Register reg = allocator()->NewRegister(); + RegisterList reg_list_2 = allocator()->NewRegisterList(2); + CHECK_EQ(reg.index(), 3); + CHECK_EQ(reg_list_2.first_register().index(), 4); + CHECK_EQ(reg_list_2.register_count(), 2); + CHECK_EQ(reg_list_2[0].index(), 4); + CHECK_EQ(reg_list_2[1].index(), 5); + CHECK_EQ(allocator()->maximum_register_count(), 6); + CHECK_EQ(allocator()->next_register_index(), 6); + CHECK(allocator()->RegisterIsLive(reg)); + CHECK(allocator()->RegisterIsLive(reg_list_2[1])); + + allocator()->ReleaseRegisters(reg.index()); + CHECK(!allocator()->RegisterIsLive(reg)); + CHECK(!allocator()->RegisterIsLive(reg_list_2[0])); + CHECK(!allocator()->RegisterIsLive(reg_list_2[1])); + CHECK(allocator()->RegisterIsLive(reg_list[2])); + CHECK_EQ(allocator()->maximum_register_count(), 6); + CHECK_EQ(allocator()->next_register_index(), 3); + + RegisterList empty_reg_list = allocator()->NewRegisterList(0); + CHECK_EQ(empty_reg_list.first_register().index(), 0); + CHECK_EQ(empty_reg_list.register_count(), 0); + CHECK_EQ(allocator()->maximum_register_count(), 6); + CHECK_EQ(allocator()->next_register_index(), 3); } } // namespace interpreter diff --git a/deps/v8/test/unittests/interpreter/bytecode-register-optimizer-unittest.cc b/deps/v8/test/unittests/interpreter/bytecode-register-optimizer-unittest.cc index ca69026fda..ae7c159563 100644 --- a/deps/v8/test/unittests/interpreter/bytecode-register-optimizer-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecode-register-optimizer-unittest.cc @@ -22,10 +22,10 @@ class BytecodeRegisterOptimizerTest : public BytecodePipelineStage, ~BytecodeRegisterOptimizerTest() override { delete register_allocator_; } void Initialize(int number_of_parameters, int number_of_locals) { - register_allocator_ = - new TemporaryRegisterAllocator(zone(), number_of_locals); - register_optimizer_ = new (zone()) BytecodeRegisterOptimizer( - zone(), register_allocator_, number_of_parameters, this); + register_allocator_ = new BytecodeRegisterAllocator(number_of_locals); + register_optimizer_ = new (zone()) + BytecodeRegisterOptimizer(zone(), register_allocator_, number_of_locals, + number_of_parameters, this); } void Write(BytecodeNode* node) override { output_.push_back(*node); } @@ -40,15 +40,13 @@ class BytecodeRegisterOptimizerTest : public BytecodePipelineStage, return Handle<BytecodeArray>(); } - TemporaryRegisterAllocator* allocator() { return register_allocator_; } + BytecodeRegisterAllocator* allocator() { return register_allocator_; } BytecodeRegisterOptimizer* optimizer() { return register_optimizer_; } - Register NewTemporary() { - return Register(allocator()->BorrowTemporaryRegister()); - } + Register NewTemporary() { return allocator()->NewRegister(); } - void KillTemporary(Register reg) { - allocator()->ReturnTemporaryRegister(reg.index()); + void ReleaseTemporaries(Register reg) { + allocator()->ReleaseRegisters(reg.index()); } size_t write_count() const { return output_.size(); } @@ -56,7 +54,7 @@ class BytecodeRegisterOptimizerTest : public BytecodePipelineStage, const std::vector<BytecodeNode>* output() { return &output_; } private: - TemporaryRegisterAllocator* register_allocator_; + BytecodeRegisterAllocator* register_allocator_; BytecodeRegisterOptimizer* register_optimizer_; std::vector<BytecodeNode> output_; @@ -74,8 +72,8 @@ TEST_F(BytecodeRegisterOptimizerTest, WriteNop) { TEST_F(BytecodeRegisterOptimizerTest, WriteNopExpression) { Initialize(1, 1); - BytecodeNode node(Bytecode::kNop); - node.source_info().MakeExpressionPosition(3); + BytecodeSourceInfo source_info(3, false); + BytecodeNode node(Bytecode::kNop, &source_info); optimizer()->Write(&node); CHECK_EQ(write_count(), 1); CHECK_EQ(node, last_written()); @@ -83,8 +81,8 @@ TEST_F(BytecodeRegisterOptimizerTest, WriteNopExpression) { TEST_F(BytecodeRegisterOptimizerTest, WriteNopStatement) { Initialize(1, 1); + BytecodeSourceInfo source_info(3, true); BytecodeNode node(Bytecode::kNop); - node.source_info().MakeStatementPosition(3); optimizer()->Write(&node); CHECK_EQ(write_count(), 1); CHECK_EQ(node, last_written()); @@ -97,7 +95,7 @@ TEST_F(BytecodeRegisterOptimizerTest, TemporaryMaterializedForJump) { optimizer()->Write(&node); CHECK_EQ(write_count(), 0); BytecodeLabel label; - BytecodeNode jump(Bytecode::kJump, 0); + BytecodeNode jump(Bytecode::kJump, 0, nullptr); optimizer()->WriteJump(&jump, &label); CHECK_EQ(write_count(), 2); CHECK_EQ(output()->at(0).bytecode(), Bytecode::kStar); @@ -130,7 +128,7 @@ TEST_F(BytecodeRegisterOptimizerTest, TemporaryNotEmitted) { BytecodeNode node1(Bytecode::kStar, NewTemporary().ToOperand()); optimizer()->Write(&node1); CHECK_EQ(write_count(), 0); - KillTemporary(temp); + ReleaseTemporaries(temp); CHECK_EQ(write_count(), 0); BytecodeNode node2(Bytecode::kReturn); optimizer()->Write(&node2); @@ -140,6 +138,61 @@ TEST_F(BytecodeRegisterOptimizerTest, TemporaryNotEmitted) { CHECK_EQ(output()->at(1).bytecode(), Bytecode::kReturn); } +TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterUsed) { + Initialize(3, 1); + BytecodeNode node0(Bytecode::kLdaSmi, 3); + optimizer()->Write(&node0); + CHECK_EQ(write_count(), 1); + Register temp0 = NewTemporary(); + Register temp1 = NewTemporary(); + BytecodeNode node1(Bytecode::kStar, temp1.ToOperand()); + optimizer()->Write(&node1); + CHECK_EQ(write_count(), 1); + BytecodeNode node2(Bytecode::kLdaSmi, 1); + optimizer()->Write(&node2); + CHECK_EQ(write_count(), 3); + BytecodeNode node3(Bytecode::kMov, temp1.ToOperand(), temp0.ToOperand()); + optimizer()->Write(&node3); + CHECK_EQ(write_count(), 3); + ReleaseTemporaries(temp1); + CHECK_EQ(write_count(), 3); + BytecodeNode node4(Bytecode::kLdar, temp0.ToOperand()); + optimizer()->Write(&node4); + CHECK_EQ(write_count(), 3); + BytecodeNode node5(Bytecode::kReturn); + optimizer()->Write(&node5); + CHECK_EQ(write_count(), 5); + CHECK_EQ(output()->at(3).bytecode(), Bytecode::kLdar); + CHECK_EQ(output()->at(3).operand(0), temp1.ToOperand()); + CHECK_EQ(output()->at(4).bytecode(), Bytecode::kReturn); +} + +TEST_F(BytecodeRegisterOptimizerTest, ReleasedRegisterNotFlushed) { + Initialize(3, 1); + BytecodeNode node0(Bytecode::kLdaSmi, 3); + optimizer()->Write(&node0); + CHECK_EQ(write_count(), 1); + Register temp0 = NewTemporary(); + Register temp1 = NewTemporary(); + BytecodeNode node1(Bytecode::kStar, temp0.ToOperand()); + optimizer()->Write(&node1); + CHECK_EQ(write_count(), 1); + BytecodeNode node2(Bytecode::kStar, temp1.ToOperand()); + optimizer()->Write(&node2); + CHECK_EQ(write_count(), 1); + ReleaseTemporaries(temp1); + BytecodeLabel label; + BytecodeNode jump(Bytecode::kJump, 0, nullptr); + optimizer()->WriteJump(&jump, &label); + BytecodeNode node3(Bytecode::kReturn); + optimizer()->Write(&node3); + CHECK_EQ(write_count(), 4); + CHECK_EQ(output()->at(1).bytecode(), Bytecode::kStar); + CHECK_EQ(output()->at(1).operand(0), temp0.ToOperand()); + CHECK_EQ(output()->at(2).bytecode(), Bytecode::kJump); + CHECK_EQ(output()->at(3).bytecode(), Bytecode::kReturn); +} + TEST_F(BytecodeRegisterOptimizerTest, StoresToLocalsImmediate) { Initialize(3, 1); Register parameter = Register::FromParameterIndex(1, 3); diff --git a/deps/v8/test/unittests/interpreter/bytecodes-unittest.cc b/deps/v8/test/unittests/interpreter/bytecodes-unittest.cc index 0e68e188c7..47c7abb772 100644 --- a/deps/v8/test/unittests/interpreter/bytecodes-unittest.cc +++ b/deps/v8/test/unittests/interpreter/bytecodes-unittest.cc @@ -161,18 +161,47 @@ TEST(Bytecodes, PrefixMappings) { } } -TEST(Bytecodes, SizesForSignedOperands) { - CHECK(Bytecodes::SizeForSignedOperand(0) == OperandSize::kByte); - CHECK(Bytecodes::SizeForSignedOperand(kMaxInt8) == OperandSize::kByte); - CHECK(Bytecodes::SizeForSignedOperand(kMinInt8) == OperandSize::kByte); - CHECK(Bytecodes::SizeForSignedOperand(kMaxInt8 + 1) == OperandSize::kShort); - CHECK(Bytecodes::SizeForSignedOperand(kMinInt8 - 1) == OperandSize::kShort); - CHECK(Bytecodes::SizeForSignedOperand(kMaxInt16) == OperandSize::kShort); - CHECK(Bytecodes::SizeForSignedOperand(kMinInt16) == OperandSize::kShort); - CHECK(Bytecodes::SizeForSignedOperand(kMaxInt16 + 1) == OperandSize::kQuad); - CHECK(Bytecodes::SizeForSignedOperand(kMinInt16 - 1) == OperandSize::kQuad); - CHECK(Bytecodes::SizeForSignedOperand(kMaxInt) == OperandSize::kQuad); - CHECK(Bytecodes::SizeForSignedOperand(kMinInt) == OperandSize::kQuad); +TEST(Bytecodes, ScaleForSignedOperand) { + CHECK(Bytecodes::ScaleForSignedOperand(0) == OperandScale::kSingle); + CHECK(Bytecodes::ScaleForSignedOperand(kMaxInt8) == OperandScale::kSingle); + CHECK(Bytecodes::ScaleForSignedOperand(kMinInt8) == OperandScale::kSingle); + CHECK(Bytecodes::ScaleForSignedOperand(kMaxInt8 + 1) == + OperandScale::kDouble); + CHECK(Bytecodes::ScaleForSignedOperand(kMinInt8 - 1) == + OperandScale::kDouble); + CHECK(Bytecodes::ScaleForSignedOperand(kMaxInt16) == OperandScale::kDouble); + CHECK(Bytecodes::ScaleForSignedOperand(kMinInt16) == OperandScale::kDouble); + CHECK(Bytecodes::ScaleForSignedOperand(kMaxInt16 + 1) == + OperandScale::kQuadruple); + CHECK(Bytecodes::ScaleForSignedOperand(kMinInt16 - 1) == + OperandScale::kQuadruple); + CHECK(Bytecodes::ScaleForSignedOperand(kMaxInt) == OperandScale::kQuadruple); + CHECK(Bytecodes::ScaleForSignedOperand(kMinInt) == OperandScale::kQuadruple); +} + +TEST(Bytecodes, ScaleForUnsignedOperands) { + // int overloads + CHECK(Bytecodes::ScaleForUnsignedOperand(0) == OperandScale::kSingle); + CHECK(Bytecodes::ScaleForUnsignedOperand(kMaxUInt8) == OperandScale::kSingle); + CHECK(Bytecodes::ScaleForUnsignedOperand(kMaxUInt8 + 1) == + OperandScale::kDouble); + CHECK(Bytecodes::ScaleForUnsignedOperand(kMaxUInt16) == + OperandScale::kDouble); + CHECK(Bytecodes::ScaleForUnsignedOperand(kMaxUInt16 + 1) == + OperandScale::kQuadruple); + // size_t overloads + CHECK(Bytecodes::ScaleForUnsignedOperand(static_cast<size_t>(0)) == + OperandScale::kSingle); + CHECK(Bytecodes::ScaleForUnsignedOperand(static_cast<size_t>(kMaxUInt8)) == + OperandScale::kSingle); + CHECK(Bytecodes::ScaleForUnsignedOperand( + static_cast<size_t>(kMaxUInt8 + 1)) == OperandScale::kDouble); + CHECK(Bytecodes::ScaleForUnsignedOperand(static_cast<size_t>(kMaxUInt16)) == + OperandScale::kDouble); + CHECK(Bytecodes::ScaleForUnsignedOperand( + static_cast<size_t>(kMaxUInt16 + 1)) == OperandScale::kQuadruple); + CHECK(Bytecodes::ScaleForUnsignedOperand(static_cast<size_t>(kMaxUInt32)) == + OperandScale::kQuadruple); } TEST(Bytecodes, SizesForUnsignedOperands) { @@ -236,14 +265,6 @@ TEST(AccumulatorUse, SampleBytecodes) { AccumulatorUse::kReadWrite); } -TEST(AccumulatorUse, AccumulatorUseToString) { - std::set<std::string> names; - names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kNone)); - names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kRead)); - names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kWrite)); - names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kReadWrite)); - CHECK_EQ(names.size(), 4); -} } // namespace interpreter } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc b/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc index ff6f14df21..53afb35a12 100644 --- a/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc +++ b/deps/v8/test/unittests/interpreter/interpreter-assembler-unittest.cc @@ -421,12 +421,16 @@ TARGET_TEST_F(InterpreterAssemblerTest, BytecodeOperand) { EXPECT_THAT(m.BytecodeOperandIdx(i), m.IsUnsignedOperand(offset, operand_size)); break; + case interpreter::OperandType::kUImm: + EXPECT_THAT(m.BytecodeOperandUImm(i), + m.IsUnsignedOperand(offset, operand_size)); + break; case interpreter::OperandType::kImm: { EXPECT_THAT(m.BytecodeOperandImm(i), m.IsSignedOperand(offset, operand_size)); break; } - case interpreter::OperandType::kMaybeReg: + case interpreter::OperandType::kRegList: case interpreter::OperandType::kReg: case interpreter::OperandType::kRegOut: case interpreter::OperandType::kRegOutPair: @@ -537,9 +541,9 @@ TARGET_TEST_F(InterpreterAssemblerTest, SmiTag) { EXPECT_THAT(m.SmiTag(value), IsIntPtrConstant(static_cast<intptr_t>(44) << (kSmiShiftSize + kSmiTagSize))); - EXPECT_THAT( - m.SmiUntag(value), - IsWordSar(value, IsIntPtrConstant(kSmiShiftSize + kSmiTagSize))); + EXPECT_THAT(m.SmiUntag(value), + IsWordSar(IsBitcastTaggedToWord(value), + IsIntPtrConstant(kSmiShiftSize + kSmiTagSize))); } } diff --git a/deps/v8/test/unittests/test-utils.h b/deps/v8/test/unittests/test-utils.h index c5788e2478..984d63ce2a 100644 --- a/deps/v8/test/unittests/test-utils.h +++ b/deps/v8/test/unittests/test-utils.h @@ -8,7 +8,8 @@ #include "include/v8.h" #include "src/base/macros.h" #include "src/base/utils/random-number-generator.h" -#include "src/zone.h" +#include "src/zone/accounting-allocator.h" +#include "src/zone/zone.h" #include "testing/gtest-support.h" namespace v8 { @@ -103,7 +104,7 @@ class TestWithZone : public virtual ::testing::Test { Zone* zone() { return &zone_; } private: - base::AccountingAllocator allocator_; + v8::internal::AccountingAllocator allocator_; Zone zone_; DISALLOW_COPY_AND_ASSIGN(TestWithZone); @@ -118,7 +119,7 @@ class TestWithIsolateAndZone : public virtual TestWithIsolate { Zone* zone() { return &zone_; } private: - base::AccountingAllocator allocator_; + v8::internal::AccountingAllocator allocator_; Zone zone_; DISALLOW_COPY_AND_ASSIGN(TestWithIsolateAndZone); diff --git a/deps/v8/test/unittests/unicode-unittest.cc b/deps/v8/test/unittests/unicode-unittest.cc new file mode 100644 index 0000000000..67edfb7331 --- /dev/null +++ b/deps/v8/test/unittests/unicode-unittest.cc @@ -0,0 +1,39 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include <memory> +#include <string> + +#include "src/unicode-decoder.h" +#include "testing/gtest/include/gtest/gtest.h" + +namespace v8 { +namespace internal { + +namespace { + +using Utf8Decoder = unibrow::Utf8Decoder<512>; + +void Decode(Utf8Decoder* decoder, const std::string& str) { + // Put the string in its own buffer on the heap to make sure that + // AddressSanitizer's heap-buffer-overflow logic can see what's going on. + std::unique_ptr<char[]> buffer(new char[str.length()]); + memcpy(buffer.get(), str.data(), str.length()); + decoder->Reset(buffer.get(), str.length()); +} + +} // namespace + +TEST(UnicodeTest, ReadOffEndOfUtf8String) { + Utf8Decoder decoder; + + // Not enough continuation bytes before string ends. + Decode(&decoder, "\xE0"); + Decode(&decoder, "\xED"); + Decode(&decoder, "\xF0"); + Decode(&decoder, "\xF4"); +} + +} // namespace internal +} // namespace v8 diff --git a/deps/v8/test/unittests/unittests.gyp b/deps/v8/test/unittests/unittests.gyp index 0ea8b9a43d..e2b9f26347 100644 --- a/deps/v8/test/unittests/unittests.gyp +++ b/deps/v8/test/unittests/unittests.gyp @@ -54,6 +54,7 @@ 'compiler/js-typed-lowering-unittest.cc', 'compiler/linkage-tail-call-unittest.cc', 'compiler/liveness-analyzer-unittest.cc', + 'compiler/live-range-builder.h', 'compiler/live-range-unittest.cc', 'compiler/load-elimination-unittest.cc', 'compiler/loop-peeling-unittest.cc', @@ -75,6 +76,7 @@ 'compiler/simplified-operator-unittest.cc', 'compiler/state-values-utils-unittest.cc', 'compiler/tail-call-optimization-unittest.cc', + 'compiler/typed-optimization-unittest.cc', 'compiler/typer-unittest.cc', 'compiler/value-numbering-reducer-unittest.cc', 'compiler/zone-pool-unittest.cc', @@ -92,6 +94,7 @@ 'interpreter/bytecode-pipeline-unittest.cc', 'interpreter/bytecode-register-allocator-unittest.cc', 'interpreter/bytecode-register-optimizer-unittest.cc', + 'interpreter/bytecode-utils.h', 'interpreter/constant-array-builder-unittest.cc', 'interpreter/interpreter-assembler-unittest.cc', 'interpreter/interpreter-assembler-unittest.h', @@ -112,17 +115,18 @@ 'source-position-table-unittest.cc', 'test-utils.h', 'test-utils.cc', + 'unicode-unittest.cc', 'value-serializer-unittest.cc', 'wasm/asm-types-unittest.cc', 'wasm/ast-decoder-unittest.cc', 'wasm/control-transfer-unittest.cc', 'wasm/decoder-unittest.cc', - 'wasm/encoder-unittest.cc', 'wasm/leb-helper-unittest.cc', 'wasm/loop-assignment-analysis-unittest.cc', 'wasm/module-decoder-unittest.cc', 'wasm/switch-logic-unittest.cc', 'wasm/wasm-macro-gen-unittest.cc', + 'wasm/wasm-module-builder-unittest.cc', ], 'unittests_sources_arm': [ ### gcmole(arch:arm) ### 'compiler/arm/instruction-selector-arm-unittest.cc', diff --git a/deps/v8/test/unittests/unittests.status b/deps/v8/test/unittests/unittests.status index ee135ba5e8..71c17f6b6b 100644 --- a/deps/v8/test/unittests/unittests.status +++ b/deps/v8/test/unittests/unittests.status @@ -3,15 +3,6 @@ # found in the LICENSE file. [ -['byteorder == big', { - # TODO(mips-team): Fix Wasm for big-endian. - 'WasmModuleVerifyTest*': [SKIP], - 'WasmFunctionVerifyTest*': [SKIP], - 'WasmDecoderTest.TableSwitch*': [SKIP], - 'WasmDecoderTest.AllLoadMemCombinations': [SKIP], - 'AstDecoderTest.AllLoadMemCombinations': [SKIP], - 'AstDecoderTest.AllStoreMemCombinations': [SKIP], -}], # 'byteorder == big' ['arch == x87', { 'Ieee754.Expm1': [SKIP], 'Ieee754.Cos': [SKIP], @@ -19,4 +10,9 @@ 'Ieee754.Acosh': [SKIP], 'Ieee754.Asinh': [SKIP], }], # 'arch == x87' + +['variant == asm_wasm', { + '*': [SKIP], +}], # variant == asm_wasm + ] diff --git a/deps/v8/test/unittests/value-serializer-unittest.cc b/deps/v8/test/unittests/value-serializer-unittest.cc index f4ed15b644..d88d60a3e6 100644 --- a/deps/v8/test/unittests/value-serializer-unittest.cc +++ b/deps/v8/test/unittests/value-serializer-unittest.cc @@ -11,16 +11,48 @@ #include "src/api.h" #include "src/base/build_config.h" #include "test/unittests/test-utils.h" +#include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" namespace v8 { namespace { +using ::testing::_; +using ::testing::Invoke; + class ValueSerializerTest : public TestWithIsolate { protected: ValueSerializerTest() : serialization_context_(Context::New(isolate())), - deserialization_context_(Context::New(isolate())) {} + deserialization_context_(Context::New(isolate())) { + // Create a host object type that can be tested through + // serialization/deserialization delegates below. + Local<FunctionTemplate> function_template = v8::FunctionTemplate::New( + isolate(), [](const FunctionCallbackInfo<Value>& args) { + args.Holder()->SetInternalField(0, args[0]); + args.Holder()->SetInternalField(1, args[1]); + }); + function_template->InstanceTemplate()->SetInternalFieldCount(2); + function_template->InstanceTemplate()->SetAccessor( + StringFromUtf8("value"), + [](Local<String> property, const PropertyCallbackInfo<Value>& args) { + args.GetReturnValue().Set(args.Holder()->GetInternalField(0)); + }); + function_template->InstanceTemplate()->SetAccessor( + StringFromUtf8("value2"), + [](Local<String> property, const PropertyCallbackInfo<Value>& args) { + args.GetReturnValue().Set(args.Holder()->GetInternalField(1)); + }); + for (Local<Context> context : + {serialization_context_, deserialization_context_}) { + context->Global() + ->CreateDataProperty( + context, StringFromUtf8("ExampleHostObject"), + function_template->GetFunction(context).ToLocalChecked()) + .ToChecked(); + } + host_object_constructor_template_ = function_template; + } const Local<Context>& serialization_context() { return serialization_context_; @@ -29,6 +61,14 @@ class ValueSerializerTest : public TestWithIsolate { return deserialization_context_; } + // Overridden in more specific fixtures. + virtual ValueSerializer::Delegate* GetSerializerDelegate() { return nullptr; } + virtual void BeforeEncode(ValueSerializer*) {} + virtual ValueDeserializer::Delegate* GetDeserializerDelegate() { + return nullptr; + } + virtual void BeforeDecode(ValueDeserializer*) {} + template <typename InputFunctor, typename OutputFunctor> void RoundTripTest(const InputFunctor& input_functor, const OutputFunctor& output_functor) { @@ -46,20 +86,30 @@ class ValueSerializerTest : public TestWithIsolate { output_functor); } + // Variant which uses JSON.parse/stringify to check the result. + void RoundTripJSON(const char* source) { + RoundTripTest( + [this, source]() { + return JSON::Parse(serialization_context_, StringFromUtf8(source)) + .ToLocalChecked(); + }, + [this, source](Local<Value> value) { + ASSERT_TRUE(value->IsObject()); + EXPECT_EQ(source, Utf8Value(JSON::Stringify(deserialization_context_, + value.As<Object>()) + .ToLocalChecked())); + }); + } + Maybe<std::vector<uint8_t>> DoEncode(Local<Value> value) { - // This approximates what the API implementation would do. - // TODO(jbroman): Use the public API once it exists. - i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate()); - i::HandleScope handle_scope(internal_isolate); - i::ValueSerializer serializer(internal_isolate); + Local<Context> context = serialization_context(); + ValueSerializer serializer(isolate(), GetSerializerDelegate()); + BeforeEncode(&serializer); serializer.WriteHeader(); - if (serializer.WriteObject(Utils::OpenHandle(*value)).FromMaybe(false)) { - return Just(serializer.ReleaseBuffer()); - } - if (internal_isolate->has_pending_exception()) { - internal_isolate->OptionalRescheduleException(true); + if (!serializer.WriteValue(context, value).FromMaybe(false)) { + return Nothing<std::vector<uint8_t>>(); } - return Nothing<std::vector<uint8_t>>(); + return Just(serializer.ReleaseBuffer()); } template <typename InputFunctor, typename EncodedDataFunctor> @@ -90,24 +140,23 @@ class ValueSerializerTest : public TestWithIsolate { template <typename OutputFunctor> void DecodeTest(const std::vector<uint8_t>& data, const OutputFunctor& output_functor) { - Context::Scope scope(deserialization_context()); + Local<Context> context = deserialization_context(); + Context::Scope scope(context); TryCatch try_catch(isolate()); - // TODO(jbroman): Use the public API once it exists. - i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate()); - i::HandleScope handle_scope(internal_isolate); - i::ValueDeserializer deserializer( - internal_isolate, - i::Vector<const uint8_t>(&data[0], static_cast<int>(data.size()))); - ASSERT_TRUE(deserializer.ReadHeader().FromMaybe(false)); + ValueDeserializer deserializer(isolate(), &data[0], + static_cast<int>(data.size()), + GetDeserializerDelegate()); + deserializer.SetSupportsLegacyWireFormat(true); + BeforeDecode(&deserializer); + ASSERT_TRUE(deserializer.ReadHeader(context).FromMaybe(false)); Local<Value> result; - ASSERT_TRUE(ToLocal<Value>(deserializer.ReadObject(), &result)); + ASSERT_TRUE(deserializer.ReadValue(context).ToLocal(&result)); ASSERT_FALSE(result.IsEmpty()); ASSERT_FALSE(try_catch.HasCaught()); - ASSERT_TRUE(deserialization_context() - ->Global() - ->CreateDataProperty(deserialization_context_, - StringFromUtf8("result"), result) - .FromMaybe(false)); + ASSERT_TRUE( + context->Global() + ->CreateDataProperty(context, StringFromUtf8("result"), result) + .FromMaybe(false)); output_functor(result); ASSERT_FALSE(try_catch.HasCaught()); } @@ -115,43 +164,45 @@ class ValueSerializerTest : public TestWithIsolate { template <typename OutputFunctor> void DecodeTestForVersion0(const std::vector<uint8_t>& data, const OutputFunctor& output_functor) { - Context::Scope scope(deserialization_context()); + Local<Context> context = deserialization_context(); + Context::Scope scope(context); TryCatch try_catch(isolate()); - // TODO(jbroman): Use the public API once it exists. - i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate()); - i::HandleScope handle_scope(internal_isolate); - i::ValueDeserializer deserializer( - internal_isolate, - i::Vector<const uint8_t>(&data[0], static_cast<int>(data.size()))); - // TODO(jbroman): Enable legacy support. - ASSERT_TRUE(deserializer.ReadHeader().FromMaybe(false)); - // TODO(jbroman): Check version 0. + ValueDeserializer deserializer(isolate(), &data[0], + static_cast<int>(data.size()), + GetDeserializerDelegate()); + deserializer.SetSupportsLegacyWireFormat(true); + BeforeDecode(&deserializer); + ASSERT_TRUE(deserializer.ReadHeader(context).FromMaybe(false)); + ASSERT_EQ(0, deserializer.GetWireFormatVersion()); Local<Value> result; - ASSERT_TRUE(ToLocal<Value>( - deserializer.ReadObjectUsingEntireBufferForLegacyFormat(), &result)); + ASSERT_TRUE(deserializer.ReadValue(context).ToLocal(&result)); ASSERT_FALSE(result.IsEmpty()); ASSERT_FALSE(try_catch.HasCaught()); - ASSERT_TRUE(deserialization_context() - ->Global() - ->CreateDataProperty(deserialization_context_, - StringFromUtf8("result"), result) - .FromMaybe(false)); + ASSERT_TRUE( + context->Global() + ->CreateDataProperty(context, StringFromUtf8("result"), result) + .FromMaybe(false)); output_functor(result); ASSERT_FALSE(try_catch.HasCaught()); } void InvalidDecodeTest(const std::vector<uint8_t>& data) { - Context::Scope scope(deserialization_context()); + Local<Context> context = deserialization_context(); + Context::Scope scope(context); TryCatch try_catch(isolate()); - i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(isolate()); - i::HandleScope handle_scope(internal_isolate); - i::ValueDeserializer deserializer( - internal_isolate, - i::Vector<const uint8_t>(&data[0], static_cast<int>(data.size()))); - Maybe<bool> header_result = deserializer.ReadHeader(); - if (header_result.IsNothing()) return; + ValueDeserializer deserializer(isolate(), &data[0], + static_cast<int>(data.size()), + GetDeserializerDelegate()); + deserializer.SetSupportsLegacyWireFormat(true); + BeforeDecode(&deserializer); + Maybe<bool> header_result = deserializer.ReadHeader(context); + if (header_result.IsNothing()) { + EXPECT_TRUE(try_catch.HasCaught()); + return; + } ASSERT_TRUE(header_result.ToChecked()); - ASSERT_TRUE(deserializer.ReadObject().is_null()); + ASSERT_TRUE(deserializer.ReadValue(context).IsEmpty()); + EXPECT_TRUE(try_catch.HasCaught()); } Local<Value> EvaluateScriptForInput(const char* utf8_source) { @@ -179,9 +230,18 @@ class ValueSerializerTest : public TestWithIsolate { return std::string(*utf8, utf8.length()); } + Local<Object> NewHostObject(Local<Context> context, int argc, + Local<Value> argv[]) { + return host_object_constructor_template_->GetFunction(context) + .ToLocalChecked() + ->NewInstance(context, argc, argv) + .ToLocalChecked(); + } + private: Local<Context> serialization_context_; Local<Context> deserialization_context_; + Local<FunctionTemplate> host_object_constructor_template_; DISALLOW_COPY_AND_ASSIGN(ValueSerializerTest); }; @@ -659,6 +719,31 @@ TEST_F(ValueSerializerTest, RoundTripTrickyGetters) { }); } +TEST_F(ValueSerializerTest, RoundTripDictionaryObjectForTransitions) { + // A case which should run on the fast path, and should reach all of the + // different cases: + // 1. no known transition (first time creating this kind of object) + // 2. expected transitions match to end + // 3. transition partially matches, but falls back due to new property 'w' + // 4. transition to 'z' is now a full transition (needs to be looked up) + // 5. same for 'w' + // 6. new property after complex transition succeeded + // 7. new property after complex transition failed (due to new property) + RoundTripJSON( + "[{\"x\":1,\"y\":2,\"z\":3}" + ",{\"x\":4,\"y\":5,\"z\":6}" + ",{\"x\":5,\"y\":6,\"w\":7}" + ",{\"x\":6,\"y\":7,\"z\":8}" + ",{\"x\":0,\"y\":0,\"w\":0}" + ",{\"x\":3,\"y\":1,\"w\":4,\"z\":1}" + ",{\"x\":5,\"y\":9,\"k\":2,\"z\":6}]"); + // A simpler case that uses two-byte strings. + RoundTripJSON( + "[{\"\xF0\x9F\x91\x8A\":1,\"\xF0\x9F\x91\x8B\":2}" + ",{\"\xF0\x9F\x91\x8A\":3,\"\xF0\x9F\x91\x8C\":4}" + ",{\"\xF0\x9F\x91\x8A\":5,\"\xF0\x9F\x91\x9B\":6}]"); +} + TEST_F(ValueSerializerTest, DecodeDictionaryObjectVersion0) { // Empty object. DecodeTestForVersion0( @@ -950,6 +1035,19 @@ TEST_F(ValueSerializerTest, RoundTripArrayWithTrickyGetters) { EXPECT_TRUE(EvaluateScriptForResultBool("result[0] === 1")); EXPECT_TRUE(EvaluateScriptForResultBool("!result.hasOwnProperty(2)")); }); + // The same is true if the length is shortened, but there are still items + // remaining. + RoundTripTest( + "(() => {" + " var x = [1, { get a() { x.length = 3; }}, 3, 4];" + " return x;" + "})()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsArray()); + ASSERT_EQ(4, Array::Cast(*value)->Length()); + EXPECT_TRUE(EvaluateScriptForResultBool("result[2] === 3")); + EXPECT_TRUE(EvaluateScriptForResultBool("!result.hasOwnProperty(3)")); + }); // Same for sparse arrays. RoundTripTest( "(() => {" @@ -963,6 +1061,18 @@ TEST_F(ValueSerializerTest, RoundTripArrayWithTrickyGetters) { EXPECT_TRUE(EvaluateScriptForResultBool("result[0] === 1")); EXPECT_TRUE(EvaluateScriptForResultBool("!result.hasOwnProperty(2)")); }); + RoundTripTest( + "(() => {" + " var x = [1, { get a() { x.length = 3; }}, 3, 4];" + " x.length = 1000;" + " return x;" + "})()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsArray()); + ASSERT_EQ(1000, Array::Cast(*value)->Length()); + EXPECT_TRUE(EvaluateScriptForResultBool("result[2] === 3")); + EXPECT_TRUE(EvaluateScriptForResultBool("!result.hasOwnProperty(3)")); + }); // If a getter makes a property non-enumerable, it should still be enumerated // as enumeration happens once before getters are invoked. RoundTripTest( @@ -1364,5 +1474,889 @@ TEST_F(ValueSerializerTest, DecodeRegExp) { }); } +TEST_F(ValueSerializerTest, RoundTripMap) { + RoundTripTest( + "(() => { var m = new Map(); m.set(42, 'foo'); return m; })()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsMap()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Map.prototype")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.size === 1")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.get(42) === 'foo'")); + }); + RoundTripTest("(() => { var m = new Map(); m.set(m, m); return m; })()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsMap()); + EXPECT_TRUE(EvaluateScriptForResultBool("result.size === 1")); + EXPECT_TRUE(EvaluateScriptForResultBool( + "result.get(result) === result")); + }); + // Iteration order must be preserved. + RoundTripTest( + "(() => {" + " var m = new Map();" + " m.set(1, 0); m.set('a', 0); m.set(3, 0); m.set(2, 0);" + " return m;" + "})()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsMap()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Array.from(result.keys()).toString() === '1,a,3,2'")); + }); +} + +TEST_F(ValueSerializerTest, DecodeMap) { + DecodeTest( + {0xff, 0x09, 0x3f, 0x00, 0x3b, 0x3f, 0x01, 0x49, 0x54, 0x3f, 0x01, 0x53, + 0x03, 0x66, 0x6f, 0x6f, 0x3a, 0x02}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsMap()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Map.prototype")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.size === 1")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.get(42) === 'foo'")); + }); + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3b, 0x3f, 0x01, 0x5e, 0x00, 0x3f, 0x01, + 0x5e, 0x00, 0x3a, 0x02, 0x00}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsMap()); + EXPECT_TRUE(EvaluateScriptForResultBool("result.size === 1")); + EXPECT_TRUE(EvaluateScriptForResultBool( + "result.get(result) === result")); + }); + // Iteration order must be preserved. + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3b, 0x3f, 0x01, 0x49, 0x02, 0x3f, + 0x01, 0x49, 0x00, 0x3f, 0x01, 0x53, 0x01, 0x61, 0x3f, 0x01, + 0x49, 0x00, 0x3f, 0x01, 0x49, 0x06, 0x3f, 0x01, 0x49, 0x00, + 0x3f, 0x01, 0x49, 0x04, 0x3f, 0x01, 0x49, 0x00, 0x3a, 0x08}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsMap()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Array.from(result.keys()).toString() === '1,a,3,2'")); + }); +} + +TEST_F(ValueSerializerTest, RoundTripMapWithTrickyGetters) { + // Even if an entry is removed or reassigned, the original key/value pair is + // used. + RoundTripTest( + "(() => {" + " var m = new Map();" + " m.set(0, { get a() {" + " m.delete(1); m.set(2, 'baz'); m.set(3, 'quux');" + " }});" + " m.set(1, 'foo');" + " m.set(2, 'bar');" + " return m;" + "})()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsMap()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Array.from(result.keys()).toString() === '0,1,2'")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.get(1) === 'foo'")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.get(2) === 'bar'")); + }); + // However, deeper modifications of objects yet to be serialized still apply. + RoundTripTest( + "(() => {" + " var m = new Map();" + " var key = { get a() { value.foo = 'bar'; } };" + " var value = { get a() { key.baz = 'quux'; } };" + " m.set(key, value);" + " return m;" + "})()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsMap()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "!('baz' in Array.from(result.keys())[0])")); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Array.from(result.values())[0].foo === 'bar'")); + }); +} + +TEST_F(ValueSerializerTest, RoundTripSet) { + RoundTripTest( + "(() => { var s = new Set(); s.add(42); s.add('foo'); return s; })()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsSet()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Set.prototype")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.size === 2")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.has(42)")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.has('foo')")); + }); + RoundTripTest( + "(() => { var s = new Set(); s.add(s); return s; })()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsSet()); + EXPECT_TRUE(EvaluateScriptForResultBool("result.size === 1")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.has(result)")); + }); + // Iteration order must be preserved. + RoundTripTest( + "(() => {" + " var s = new Set();" + " s.add(1); s.add('a'); s.add(3); s.add(2);" + " return s;" + "})()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsSet()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Array.from(result.keys()).toString() === '1,a,3,2'")); + }); +} + +TEST_F(ValueSerializerTest, DecodeSet) { + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x27, 0x3f, 0x01, 0x49, 0x54, 0x3f, 0x01, + 0x53, 0x03, 0x66, 0x6f, 0x6f, 0x2c, 0x02}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsSet()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Set.prototype")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.size === 2")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.has(42)")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.has('foo')")); + }); + DecodeTest( + {0xff, 0x09, 0x3f, 0x00, 0x27, 0x3f, 0x01, 0x5e, 0x00, 0x2c, 0x01, 0x00}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsSet()); + EXPECT_TRUE(EvaluateScriptForResultBool("result.size === 1")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.has(result)")); + }); + // Iteration order must be preserved. + DecodeTest( + {0xff, 0x09, 0x3f, 0x00, 0x27, 0x3f, 0x01, 0x49, 0x02, 0x3f, 0x01, 0x53, + 0x01, 0x61, 0x3f, 0x01, 0x49, 0x06, 0x3f, 0x01, 0x49, 0x04, 0x2c, 0x04}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsSet()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Array.from(result.keys()).toString() === '1,a,3,2'")); + }); +} + +TEST_F(ValueSerializerTest, RoundTripSetWithTrickyGetters) { + // Even if an element is added or removed during serialization, the original + // set of elements is used. + RoundTripTest( + "(() => {" + " var s = new Set();" + " s.add({ get a() { s.delete(1); s.add(2); } });" + " s.add(1);" + " return s;" + "})()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsSet()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Array.from(result.keys()).toString() === '[object Object],1'")); + }); + // However, deeper modifications of objects yet to be serialized still apply. + RoundTripTest( + "(() => {" + " var s = new Set();" + " var first = { get a() { second.foo = 'bar'; } };" + " var second = { get a() { first.baz = 'quux'; } };" + " s.add(first);" + " s.add(second);" + " return s;" + "})()", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsSet()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "!('baz' in Array.from(result.keys())[0])")); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Array.from(result.keys())[1].foo === 'bar'")); + }); +} + +TEST_F(ValueSerializerTest, RoundTripArrayBuffer) { + RoundTripTest("new ArrayBuffer()", [this](Local<Value> value) { + ASSERT_TRUE(value->IsArrayBuffer()); + EXPECT_EQ(0u, ArrayBuffer::Cast(*value)->ByteLength()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === ArrayBuffer.prototype")); + }); + RoundTripTest("new Uint8Array([0, 128, 255]).buffer", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsArrayBuffer()); + EXPECT_EQ(3u, ArrayBuffer::Cast(*value)->ByteLength()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "new Uint8Array(result).toString() === '0,128,255'")); + }); + RoundTripTest( + "({ a: new ArrayBuffer(), get b() { return this.a; }})", + [this](Local<Value> value) { + EXPECT_TRUE( + EvaluateScriptForResultBool("result.a instanceof ArrayBuffer")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b")); + }); +} + +TEST_F(ValueSerializerTest, DecodeArrayBuffer) { + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x42, 0x00}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsArrayBuffer()); + EXPECT_EQ(0u, ArrayBuffer::Cast(*value)->ByteLength()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === ArrayBuffer.prototype")); + }); + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x42, 0x03, 0x00, 0x80, 0xff, 0x00}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsArrayBuffer()); + EXPECT_EQ(3u, ArrayBuffer::Cast(*value)->ByteLength()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "new Uint8Array(result).toString() === '0,128,255'")); + }); + DecodeTest( + {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x01, + 0x61, 0x3f, 0x01, 0x42, 0x00, 0x3f, 0x02, 0x53, 0x01, + 0x62, 0x3f, 0x02, 0x5e, 0x01, 0x7b, 0x02, 0x00}, + [this](Local<Value> value) { + EXPECT_TRUE( + EvaluateScriptForResultBool("result.a instanceof ArrayBuffer")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b")); + }); +} + +TEST_F(ValueSerializerTest, DecodeInvalidArrayBuffer) { + InvalidDecodeTest({0xff, 0x09, 0x42, 0xff, 0xff, 0x00}); +} + +// Includes an ArrayBuffer wrapper marked for transfer from the serialization +// context to the deserialization context. +class ValueSerializerTestWithArrayBufferTransfer : public ValueSerializerTest { + protected: + static const size_t kTestByteLength = 4; + + ValueSerializerTestWithArrayBufferTransfer() { + { + Context::Scope scope(serialization_context()); + input_buffer_ = ArrayBuffer::New(isolate(), nullptr, 0); + input_buffer_->Neuter(); + } + { + Context::Scope scope(deserialization_context()); + output_buffer_ = ArrayBuffer::New(isolate(), kTestByteLength); + const uint8_t data[kTestByteLength] = {0x00, 0x01, 0x80, 0xff}; + memcpy(output_buffer_->GetContents().Data(), data, kTestByteLength); + } + } + + const Local<ArrayBuffer>& input_buffer() { return input_buffer_; } + const Local<ArrayBuffer>& output_buffer() { return output_buffer_; } + + void BeforeEncode(ValueSerializer* serializer) override { + serializer->TransferArrayBuffer(0, input_buffer_); + } + + void BeforeDecode(ValueDeserializer* deserializer) override { + deserializer->TransferArrayBuffer(0, output_buffer_); + } + + private: + Local<ArrayBuffer> input_buffer_; + Local<ArrayBuffer> output_buffer_; +}; + +TEST_F(ValueSerializerTestWithArrayBufferTransfer, + RoundTripArrayBufferTransfer) { + RoundTripTest([this]() { return input_buffer(); }, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsArrayBuffer()); + EXPECT_EQ(output_buffer(), value); + EXPECT_TRUE(EvaluateScriptForResultBool( + "new Uint8Array(result).toString() === '0,1,128,255'")); + }); + RoundTripTest( + [this]() { + Local<Object> object = Object::New(isolate()); + EXPECT_TRUE(object + ->CreateDataProperty(serialization_context(), + StringFromUtf8("a"), + input_buffer()) + .FromMaybe(false)); + EXPECT_TRUE(object + ->CreateDataProperty(serialization_context(), + StringFromUtf8("b"), + input_buffer()) + .FromMaybe(false)); + return object; + }, + [this](Local<Value> value) { + EXPECT_TRUE( + EvaluateScriptForResultBool("result.a instanceof ArrayBuffer")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b")); + EXPECT_TRUE(EvaluateScriptForResultBool( + "new Uint8Array(result.a).toString() === '0,1,128,255'")); + }); +} + +TEST_F(ValueSerializerTest, RoundTripTypedArray) { +// Check that the right type comes out the other side for every kind of typed +// array. +#define TYPED_ARRAY_ROUND_TRIP_TEST(Type, type, TYPE, ctype, size) \ + RoundTripTest("new " #Type "Array(2)", [this](Local<Value> value) { \ + ASSERT_TRUE(value->Is##Type##Array()); \ + EXPECT_EQ(2 * size, TypedArray::Cast(*value)->ByteLength()); \ + EXPECT_EQ(2, TypedArray::Cast(*value)->Length()); \ + EXPECT_TRUE(EvaluateScriptForResultBool( \ + "Object.getPrototypeOf(result) === " #Type "Array.prototype")); \ + }); + TYPED_ARRAYS(TYPED_ARRAY_ROUND_TRIP_TEST) +#undef TYPED_ARRAY_CASE + + // Check that values of various kinds are suitably preserved. + RoundTripTest("new Uint8Array([1, 128, 255])", [this](Local<Value> value) { + EXPECT_TRUE( + EvaluateScriptForResultBool("result.toString() === '1,128,255'")); + }); + RoundTripTest("new Int16Array([0, 256, -32768])", [this](Local<Value> value) { + EXPECT_TRUE( + EvaluateScriptForResultBool("result.toString() === '0,256,-32768'")); + }); + RoundTripTest("new Float32Array([0, -0.5, NaN, Infinity])", + [this](Local<Value> value) { + EXPECT_TRUE(EvaluateScriptForResultBool( + "result.toString() === '0,-0.5,NaN,Infinity'")); + }); + + // Array buffer views sharing a buffer should do so on the other side. + // Similarly, multiple references to the same typed array should be resolved. + RoundTripTest( + "(() => {" + " var buffer = new ArrayBuffer(32);" + " return {" + " u8: new Uint8Array(buffer)," + " get u8_2() { return this.u8; }," + " f32: new Float32Array(buffer, 4, 5)," + " b: buffer," + " };" + "})()", + [this](Local<Value> value) { + EXPECT_TRUE( + EvaluateScriptForResultBool("result.u8 instanceof Uint8Array")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.u8 === result.u8_2")); + EXPECT_TRUE( + EvaluateScriptForResultBool("result.f32 instanceof Float32Array")); + EXPECT_TRUE(EvaluateScriptForResultBool( + "result.u8.buffer === result.f32.buffer")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.f32.byteOffset === 4")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.f32.length === 5")); + }); +} + +TEST_F(ValueSerializerTest, DecodeTypedArray) { + // Check that the right type comes out the other side for every kind of typed + // array. + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x02, 0x00, 0x00, 0x56, + 0x42, 0x00, 0x02}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsUint8Array()); + EXPECT_EQ(2, TypedArray::Cast(*value)->ByteLength()); + EXPECT_EQ(2, TypedArray::Cast(*value)->Length()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Uint8Array.prototype")); + }); + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x02, 0x00, 0x00, 0x56, + 0x62, 0x00, 0x02}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsInt8Array()); + EXPECT_EQ(2, TypedArray::Cast(*value)->ByteLength()); + EXPECT_EQ(2, TypedArray::Cast(*value)->Length()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Int8Array.prototype")); + }); +#if defined(V8_TARGET_LITTLE_ENDIAN) + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x56, 0x57, 0x00, 0x04}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsUint16Array()); + EXPECT_EQ(4, TypedArray::Cast(*value)->ByteLength()); + EXPECT_EQ(2, TypedArray::Cast(*value)->Length()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Uint16Array.prototype")); + }); + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x56, 0x77, 0x00, 0x04}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsInt16Array()); + EXPECT_EQ(4, TypedArray::Cast(*value)->ByteLength()); + EXPECT_EQ(2, TypedArray::Cast(*value)->Length()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Int16Array.prototype")); + }); + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x44, 0x00, 0x08}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsUint32Array()); + EXPECT_EQ(8, TypedArray::Cast(*value)->ByteLength()); + EXPECT_EQ(2, TypedArray::Cast(*value)->Length()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Uint32Array.prototype")); + }); + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x64, 0x00, 0x08}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsInt32Array()); + EXPECT_EQ(8, TypedArray::Cast(*value)->ByteLength()); + EXPECT_EQ(2, TypedArray::Cast(*value)->Length()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Int32Array.prototype")); + }); + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x08, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x56, 0x66, 0x00, 0x08}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsFloat32Array()); + EXPECT_EQ(8, TypedArray::Cast(*value)->ByteLength()); + EXPECT_EQ(2, TypedArray::Cast(*value)->Length()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Float32Array.prototype")); + }); + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x56, 0x46, 0x00, 0x10}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsFloat64Array()); + EXPECT_EQ(16, TypedArray::Cast(*value)->ByteLength()); + EXPECT_EQ(2, TypedArray::Cast(*value)->Length()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === Float64Array.prototype")); + }); +#endif // V8_TARGET_LITTLE_ENDIAN + + // Check that values of various kinds are suitably preserved. + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x03, 0x01, 0x80, 0xff, + 0x56, 0x42, 0x00, 0x03, 0x00}, + [this](Local<Value> value) { + EXPECT_TRUE(EvaluateScriptForResultBool( + "result.toString() === '1,128,255'")); + }); +#if defined(V8_TARGET_LITTLE_ENDIAN) + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x06, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x80, 0x56, 0x77, 0x00, 0x06}, + [this](Local<Value> value) { + EXPECT_TRUE(EvaluateScriptForResultBool( + "result.toString() === '0,256,-32768'")); + }); + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, 0x00, 0x00, 0xc0, 0x7f, + 0x00, 0x00, 0x80, 0x7f, 0x56, 0x66, 0x00, 0x10}, + [this](Local<Value> value) { + EXPECT_TRUE(EvaluateScriptForResultBool( + "result.toString() === '0,-0.5,NaN,Infinity'")); + }); +#endif // V8_TARGET_LITTLE_ENDIAN + + // Array buffer views sharing a buffer should do so on the other side. + // Similarly, multiple references to the same typed array should be resolved. + DecodeTest( + {0xff, 0x09, 0x3f, 0x00, 0x6f, 0x3f, 0x01, 0x53, 0x02, 0x75, 0x38, 0x3f, + 0x01, 0x3f, 0x01, 0x42, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x56, 0x42, 0x00, 0x20, 0x3f, 0x03, 0x53, 0x04, 0x75, 0x38, 0x5f, + 0x32, 0x3f, 0x03, 0x5e, 0x02, 0x3f, 0x03, 0x53, 0x03, 0x66, 0x33, 0x32, + 0x3f, 0x03, 0x3f, 0x03, 0x5e, 0x01, 0x56, 0x66, 0x04, 0x14, 0x3f, 0x04, + 0x53, 0x01, 0x62, 0x3f, 0x04, 0x5e, 0x01, 0x7b, 0x04, 0x00}, + [this](Local<Value> value) { + EXPECT_TRUE( + EvaluateScriptForResultBool("result.u8 instanceof Uint8Array")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.u8 === result.u8_2")); + EXPECT_TRUE( + EvaluateScriptForResultBool("result.f32 instanceof Float32Array")); + EXPECT_TRUE(EvaluateScriptForResultBool( + "result.u8.buffer === result.f32.buffer")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.f32.byteOffset === 4")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.f32.length === 5")); + }); +} + +TEST_F(ValueSerializerTest, DecodeInvalidTypedArray) { + // Byte offset out of range. + InvalidDecodeTest( + {0xff, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x42, 0x03, 0x01}); + // Byte offset in range, offset + length out of range. + InvalidDecodeTest( + {0xff, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x42, 0x01, 0x03}); + // Byte offset not divisible by element size. + InvalidDecodeTest( + {0xff, 0x09, 0x42, 0x04, 0x00, 0x00, 0x00, 0x00, 0x56, 0x77, 0x01, 0x02}); + // Byte length not divisible by element size. + InvalidDecodeTest( + {0xff, 0x09, 0x42, 0x04, 0x00, 0x00, 0x00, 0x00, 0x56, 0x77, 0x02, 0x01}); +} + +TEST_F(ValueSerializerTest, RoundTripDataView) { + RoundTripTest("new DataView(new ArrayBuffer(4), 1, 2)", + [this](Local<Value> value) { + ASSERT_TRUE(value->IsDataView()); + EXPECT_EQ(1, DataView::Cast(*value)->ByteOffset()); + EXPECT_EQ(2, DataView::Cast(*value)->ByteLength()); + EXPECT_EQ(4, DataView::Cast(*value)->Buffer()->ByteLength()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === DataView.prototype")); + }); +} + +TEST_F(ValueSerializerTest, DecodeDataView) { + DecodeTest({0xff, 0x09, 0x3f, 0x00, 0x3f, 0x00, 0x42, 0x04, 0x00, 0x00, 0x00, + 0x00, 0x56, 0x3f, 0x01, 0x02}, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsDataView()); + EXPECT_EQ(1, DataView::Cast(*value)->ByteOffset()); + EXPECT_EQ(2, DataView::Cast(*value)->ByteLength()); + EXPECT_EQ(4, DataView::Cast(*value)->Buffer()->ByteLength()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === DataView.prototype")); + }); +} + +TEST_F(ValueSerializerTest, DecodeInvalidDataView) { + // Byte offset out of range. + InvalidDecodeTest( + {0xff, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x3f, 0x03, 0x01}); + // Byte offset in range, offset + length out of range. + InvalidDecodeTest( + {0xff, 0x09, 0x42, 0x02, 0x00, 0x00, 0x56, 0x3f, 0x01, 0x03}); +} + +class ValueSerializerTestWithSharedArrayBufferTransfer + : public ValueSerializerTest { + protected: + static const size_t kTestByteLength = 4; + + ValueSerializerTestWithSharedArrayBufferTransfer() { + const uint8_t data[kTestByteLength] = {0x00, 0x01, 0x80, 0xff}; + memcpy(data_, data, kTestByteLength); + { + Context::Scope scope(serialization_context()); + input_buffer_ = + SharedArrayBuffer::New(isolate(), &data_, kTestByteLength); + } + { + Context::Scope scope(deserialization_context()); + output_buffer_ = + SharedArrayBuffer::New(isolate(), &data_, kTestByteLength); + } + } + + const Local<SharedArrayBuffer>& input_buffer() { return input_buffer_; } + const Local<SharedArrayBuffer>& output_buffer() { return output_buffer_; } + + void BeforeEncode(ValueSerializer* serializer) override { + serializer->TransferSharedArrayBuffer(0, input_buffer_); + } + + void BeforeDecode(ValueDeserializer* deserializer) override { + deserializer->TransferSharedArrayBuffer(0, output_buffer_); + } + + static void SetUpTestCase() { + flag_was_enabled_ = i::FLAG_harmony_sharedarraybuffer; + i::FLAG_harmony_sharedarraybuffer = true; + ValueSerializerTest::SetUpTestCase(); + } + + static void TearDownTestCase() { + ValueSerializerTest::TearDownTestCase(); + i::FLAG_harmony_sharedarraybuffer = flag_was_enabled_; + flag_was_enabled_ = false; + } + + private: + static bool flag_was_enabled_; + uint8_t data_[kTestByteLength]; + Local<SharedArrayBuffer> input_buffer_; + Local<SharedArrayBuffer> output_buffer_; +}; + +bool ValueSerializerTestWithSharedArrayBufferTransfer::flag_was_enabled_ = + false; + +TEST_F(ValueSerializerTestWithSharedArrayBufferTransfer, + RoundTripSharedArrayBufferTransfer) { + RoundTripTest([this]() { return input_buffer(); }, + [this](Local<Value> value) { + ASSERT_TRUE(value->IsSharedArrayBuffer()); + EXPECT_EQ(output_buffer(), value); + EXPECT_TRUE(EvaluateScriptForResultBool( + "new Uint8Array(result).toString() === '0,1,128,255'")); + }); + RoundTripTest( + [this]() { + Local<Object> object = Object::New(isolate()); + EXPECT_TRUE(object + ->CreateDataProperty(serialization_context(), + StringFromUtf8("a"), + input_buffer()) + .FromMaybe(false)); + EXPECT_TRUE(object + ->CreateDataProperty(serialization_context(), + StringFromUtf8("b"), + input_buffer()) + .FromMaybe(false)); + return object; + }, + [this](Local<Value> value) { + EXPECT_TRUE(EvaluateScriptForResultBool( + "result.a instanceof SharedArrayBuffer")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b")); + EXPECT_TRUE(EvaluateScriptForResultBool( + "new Uint8Array(result.a).toString() === '0,1,128,255'")); + }); +} + +TEST_F(ValueSerializerTestWithSharedArrayBufferTransfer, + SharedArrayBufferMustBeTransferred) { + // A SharedArrayBuffer which was not marked for transfer should fail encoding. + InvalidEncodeTest("new SharedArrayBuffer(32)"); +} + +TEST_F(ValueSerializerTest, UnsupportedHostObject) { + InvalidEncodeTest("new ExampleHostObject()"); + InvalidEncodeTest("({ a: new ExampleHostObject() })"); +} + +class ValueSerializerTestWithHostObject : public ValueSerializerTest { + protected: + ValueSerializerTestWithHostObject() : serializer_delegate_(this) {} + + static const uint8_t kExampleHostObjectTag; + + void WriteExampleHostObjectTag() { + serializer_->WriteRawBytes(&kExampleHostObjectTag, 1); + } + + bool ReadExampleHostObjectTag() { + const void* tag; + return deserializer_->ReadRawBytes(1, &tag) && + *reinterpret_cast<const uint8_t*>(tag) == kExampleHostObjectTag; + } + +// GMock doesn't use the "override" keyword. +#if __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Winconsistent-missing-override" +#endif + + class SerializerDelegate : public ValueSerializer::Delegate { + public: + explicit SerializerDelegate(ValueSerializerTestWithHostObject* test) + : test_(test) {} + MOCK_METHOD2(WriteHostObject, + Maybe<bool>(Isolate* isolate, Local<Object> object)); + void ThrowDataCloneError(Local<String> message) override { + test_->isolate()->ThrowException(Exception::Error(message)); + } + + private: + ValueSerializerTestWithHostObject* test_; + }; + + class DeserializerDelegate : public ValueDeserializer::Delegate { + public: + MOCK_METHOD1(ReadHostObject, MaybeLocal<Object>(Isolate* isolate)); + }; + +#if __clang__ +#pragma clang diagnostic pop +#endif + + ValueSerializer::Delegate* GetSerializerDelegate() override { + return &serializer_delegate_; + } + void BeforeEncode(ValueSerializer* serializer) override { + serializer_ = serializer; + } + ValueDeserializer::Delegate* GetDeserializerDelegate() override { + return &deserializer_delegate_; + } + void BeforeDecode(ValueDeserializer* deserializer) override { + deserializer_ = deserializer; + } + + SerializerDelegate serializer_delegate_; + DeserializerDelegate deserializer_delegate_; + ValueSerializer* serializer_; + ValueDeserializer* deserializer_; + + friend class SerializerDelegate; + friend class DeserializerDelegate; +}; + +// This is a tag that's not used in V8. +const uint8_t ValueSerializerTestWithHostObject::kExampleHostObjectTag = '+'; + +TEST_F(ValueSerializerTestWithHostObject, RoundTripUint32) { + // The host can serialize data as uint32_t. + EXPECT_CALL(serializer_delegate_, WriteHostObject(isolate(), _)) + .WillRepeatedly(Invoke([this](Isolate*, Local<Object> object) { + uint32_t value = 0; + EXPECT_TRUE(object->GetInternalField(0) + ->Uint32Value(serialization_context()) + .To(&value)); + WriteExampleHostObjectTag(); + serializer_->WriteUint32(value); + return Just(true); + })); + EXPECT_CALL(deserializer_delegate_, ReadHostObject(isolate())) + .WillRepeatedly(Invoke([this](Isolate*) { + EXPECT_TRUE(ReadExampleHostObjectTag()); + uint32_t value = 0; + EXPECT_TRUE(deserializer_->ReadUint32(&value)); + Local<Value> argv[] = {Integer::NewFromUnsigned(isolate(), value)}; + return NewHostObject(deserialization_context(), arraysize(argv), argv); + })); + RoundTripTest("new ExampleHostObject(42)", [this](Local<Value> value) { + ASSERT_TRUE(value->IsObject()); + ASSERT_TRUE(Object::Cast(*value)->InternalFieldCount()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === ExampleHostObject.prototype")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.value === 42")); + }); + RoundTripTest( + "new ExampleHostObject(0xCAFECAFE)", [this](Local<Value> value) { + EXPECT_TRUE(EvaluateScriptForResultBool("result.value === 0xCAFECAFE")); + }); +} + +TEST_F(ValueSerializerTestWithHostObject, RoundTripUint64) { + // The host can serialize data as uint64_t. + EXPECT_CALL(serializer_delegate_, WriteHostObject(isolate(), _)) + .WillRepeatedly(Invoke([this](Isolate*, Local<Object> object) { + uint32_t value = 0, value2 = 0; + EXPECT_TRUE(object->GetInternalField(0) + ->Uint32Value(serialization_context()) + .To(&value)); + EXPECT_TRUE(object->GetInternalField(1) + ->Uint32Value(serialization_context()) + .To(&value2)); + WriteExampleHostObjectTag(); + serializer_->WriteUint64((static_cast<uint64_t>(value) << 32) | value2); + return Just(true); + })); + EXPECT_CALL(deserializer_delegate_, ReadHostObject(isolate())) + .WillRepeatedly(Invoke([this](Isolate*) { + EXPECT_TRUE(ReadExampleHostObjectTag()); + uint64_t value_packed; + EXPECT_TRUE(deserializer_->ReadUint64(&value_packed)); + Local<Value> argv[] = { + Integer::NewFromUnsigned(isolate(), + static_cast<uint32_t>(value_packed >> 32)), + Integer::NewFromUnsigned(isolate(), + static_cast<uint32_t>(value_packed))}; + return NewHostObject(deserialization_context(), arraysize(argv), argv); + })); + RoundTripTest("new ExampleHostObject(42, 0)", [this](Local<Value> value) { + ASSERT_TRUE(value->IsObject()); + ASSERT_TRUE(Object::Cast(*value)->InternalFieldCount()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === ExampleHostObject.prototype")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.value === 42")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.value2 === 0")); + }); + RoundTripTest( + "new ExampleHostObject(0xFFFFFFFF, 0x12345678)", + [this](Local<Value> value) { + EXPECT_TRUE(EvaluateScriptForResultBool("result.value === 0xFFFFFFFF")); + EXPECT_TRUE( + EvaluateScriptForResultBool("result.value2 === 0x12345678")); + }); +} + +TEST_F(ValueSerializerTestWithHostObject, RoundTripDouble) { + // The host can serialize data as double. + EXPECT_CALL(serializer_delegate_, WriteHostObject(isolate(), _)) + .WillRepeatedly(Invoke([this](Isolate*, Local<Object> object) { + double value = 0; + EXPECT_TRUE(object->GetInternalField(0) + ->NumberValue(serialization_context()) + .To(&value)); + WriteExampleHostObjectTag(); + serializer_->WriteDouble(value); + return Just(true); + })); + EXPECT_CALL(deserializer_delegate_, ReadHostObject(isolate())) + .WillRepeatedly(Invoke([this](Isolate*) { + EXPECT_TRUE(ReadExampleHostObjectTag()); + double value = 0; + EXPECT_TRUE(deserializer_->ReadDouble(&value)); + Local<Value> argv[] = {Number::New(isolate(), value)}; + return NewHostObject(deserialization_context(), arraysize(argv), argv); + })); + RoundTripTest("new ExampleHostObject(-3.5)", [this](Local<Value> value) { + ASSERT_TRUE(value->IsObject()); + ASSERT_TRUE(Object::Cast(*value)->InternalFieldCount()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === ExampleHostObject.prototype")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.value === -3.5")); + }); + RoundTripTest("new ExampleHostObject(NaN)", [this](Local<Value> value) { + EXPECT_TRUE(EvaluateScriptForResultBool("Number.isNaN(result.value)")); + }); + RoundTripTest("new ExampleHostObject(Infinity)", [this](Local<Value> value) { + EXPECT_TRUE(EvaluateScriptForResultBool("result.value === Infinity")); + }); + RoundTripTest("new ExampleHostObject(-0)", [this](Local<Value> value) { + EXPECT_TRUE(EvaluateScriptForResultBool("1/result.value === -Infinity")); + }); +} + +TEST_F(ValueSerializerTestWithHostObject, RoundTripRawBytes) { + // The host can serialize arbitrary raw bytes. + const struct { + uint64_t u64; + uint32_t u32; + char str[12]; + } sample_data = {0x1234567812345678, 0x87654321, "Hello world"}; + EXPECT_CALL(serializer_delegate_, WriteHostObject(isolate(), _)) + .WillRepeatedly( + Invoke([this, &sample_data](Isolate*, Local<Object> object) { + WriteExampleHostObjectTag(); + serializer_->WriteRawBytes(&sample_data, sizeof(sample_data)); + return Just(true); + })); + EXPECT_CALL(deserializer_delegate_, ReadHostObject(isolate())) + .WillRepeatedly(Invoke([this, &sample_data](Isolate*) { + EXPECT_TRUE(ReadExampleHostObjectTag()); + const void* copied_data = nullptr; + EXPECT_TRUE( + deserializer_->ReadRawBytes(sizeof(sample_data), &copied_data)); + if (copied_data) { + EXPECT_EQ(0, memcmp(&sample_data, copied_data, sizeof(sample_data))); + } + return NewHostObject(deserialization_context(), 0, nullptr); + })); + RoundTripTest("new ExampleHostObject()", [this](Local<Value> value) { + ASSERT_TRUE(value->IsObject()); + ASSERT_TRUE(Object::Cast(*value)->InternalFieldCount()); + EXPECT_TRUE(EvaluateScriptForResultBool( + "Object.getPrototypeOf(result) === ExampleHostObject.prototype")); + }); +} + +TEST_F(ValueSerializerTestWithHostObject, RoundTripSameObject) { + // If the same object exists in two places, the delegate should be invoked + // only once, and the objects should be the same (by reference equality) on + // the other side. + EXPECT_CALL(serializer_delegate_, WriteHostObject(isolate(), _)) + .WillOnce(Invoke([this](Isolate*, Local<Object> object) { + WriteExampleHostObjectTag(); + return Just(true); + })); + EXPECT_CALL(deserializer_delegate_, ReadHostObject(isolate())) + .WillOnce(Invoke([this](Isolate*) { + EXPECT_TRUE(ReadExampleHostObjectTag()); + return NewHostObject(deserialization_context(), 0, nullptr); + })); + RoundTripTest( + "({ a: new ExampleHostObject(), get b() { return this.a; }})", + [this](Local<Value> value) { + EXPECT_TRUE(EvaluateScriptForResultBool( + "result.a instanceof ExampleHostObject")); + EXPECT_TRUE(EvaluateScriptForResultBool("result.a === result.b")); + }); +} + } // namespace } // namespace v8 diff --git a/deps/v8/test/unittests/wasm/ast-decoder-unittest.cc b/deps/v8/test/unittests/wasm/ast-decoder-unittest.cc index 7311f063a0..cbaf6201c6 100644 --- a/deps/v8/test/unittests/wasm/ast-decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/ast-decoder-unittest.cc @@ -6,25 +6,30 @@ #include "src/v8.h" -#include "test/cctest/wasm/test-signatures.h" +#include "test/common/wasm/test-signatures.h" #include "src/objects.h" #include "src/wasm/ast-decoder.h" #include "src/wasm/wasm-macro-gen.h" #include "src/wasm/wasm-module.h" +#include "src/wasm/wasm-opcodes.h" namespace v8 { namespace internal { namespace wasm { -#define B1(a) kExprBlock, a, kExprEnd -#define B2(a, b) kExprBlock, a, b, kExprEnd -#define B3(a, b, c) kExprBlock, a, b, c, kExprEnd +#define B1(a) WASM_BLOCK(a) +#define B2(a, b) WASM_BLOCK(a, b) +#define B3(a, b, c) WASM_BLOCK(a, b, c) + +#define WASM_IF_OP kExprIf, kLocalVoid +#define WASM_LOOP_OP kExprLoop, kLocalVoid static const byte kCodeGetLocal0[] = {kExprGetLocal, 0}; static const byte kCodeGetLocal1[] = {kExprGetLocal, 1}; static const byte kCodeSetLocal0[] = {WASM_SET_LOCAL(0, WASM_ZERO)}; +static const byte kCodeTeeLocal0[] = {WASM_TEE_LOCAL(0, WASM_ZERO)}; static const LocalType kLocalTypes[] = {kAstI32, kAstI64, kAstF32, kAstF64}; static const MachineType machineTypes[] = { @@ -40,36 +45,56 @@ static const WasmOpcode kInt32BinopOpcodes[] = { kExprI32LeS, kExprI32LtU, kExprI32LeU}; #define WASM_BRV_IF_ZERO(depth, val) \ - val, WASM_ZERO, kExprBrIf, ARITY_1, static_cast<byte>(depth) + val, WASM_ZERO, kExprBrIf, static_cast<byte>(depth) + +#define EXPECT_VERIFIES_C(sig, x) \ + Verify(kSuccess, sigs.sig(), x, x + arraysize(x)) -#define EXPECT_VERIFIES(env, x) Verify(kSuccess, env, x, x + arraysize(x)) +#define EXPECT_FAILURE_C(sig, x) Verify(kError, sigs.sig(), x, x + arraysize(x)) -#define EXPECT_FAILURE(env, x) Verify(kError, env, x, x + arraysize(x)) +#define EXPECT_VERIFIES_SC(sig, x) Verify(kSuccess, sig, x, x + arraysize(x)) -#define EXPECT_VERIFIES_INLINE(env, ...) \ +#define EXPECT_FAILURE_SC(sig, x) Verify(kError, sig, x, x + arraysize(x)) + +#define EXPECT_VERIFIES_S(env, ...) \ do { \ static byte code[] = {__VA_ARGS__}; \ Verify(kSuccess, env, code, code + arraysize(code)); \ } while (false) -#define EXPECT_FAILURE_INLINE(env, ...) \ +#define EXPECT_FAILURE_S(env, ...) \ do { \ static byte code[] = {__VA_ARGS__}; \ Verify(kError, env, code, code + arraysize(code)); \ } while (false) -#define VERIFY(...) \ +#define EXPECT_VERIFIES(sig, ...) \ do { \ static const byte code[] = {__VA_ARGS__}; \ - Verify(kSuccess, sigs.v_i(), code, code + sizeof(code)); \ + Verify(kSuccess, sigs.sig(), code, code + sizeof(code)); \ } while (false) +#define EXPECT_FAILURE(sig, ...) \ + do { \ + static const byte code[] = {__VA_ARGS__}; \ + Verify(kError, sigs.sig(), code, code + sizeof(code)); \ + } while (false) + +static bool old_eh_flag; + class AstDecoderTest : public TestWithZone { public: typedef std::pair<uint32_t, LocalType> LocalsDecl; AstDecoderTest() : module(nullptr), local_decls(zone()) {} + static void SetUpTestCase() { old_eh_flag = FLAG_wasm_eh_prototype; } + + static void TearDownTestCase() { + // Reset the wasm_eh_prototype flag + FLAG_wasm_eh_prototype = old_eh_flag; + } + TestSignatures sigs; ModuleEnv* module; LocalDeclEncoder local_decls; @@ -103,14 +128,14 @@ class AstDecoderTest : public TestWithZone { if (result.error_pt) str << ", pt = +" << pt; } } - FATAL(str.str().c_str()); + EXPECT_TRUE(false) << str.str().c_str(); } } void TestBinop(WasmOpcode opcode, FunctionSig* success) { // op(local[0], local[1]) byte code[] = {WASM_BINOP(opcode, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; - EXPECT_VERIFIES(success, code); + EXPECT_VERIFIES_SC(success, code); // Try all combinations of return and parameter types. for (size_t i = 0; i < arraysize(kLocalTypes); i++) { @@ -122,7 +147,7 @@ class AstDecoderTest : public TestWithZone { types[2] != success->GetParam(1)) { // Test signature mismatch. FunctionSig sig(1, 2, types); - EXPECT_FAILURE(&sig, code); + EXPECT_FAILURE_SC(&sig, code); } } } @@ -139,7 +164,7 @@ class AstDecoderTest : public TestWithZone { { LocalType types[] = {ret_type, param_type}; FunctionSig sig(1, 1, types); - EXPECT_VERIFIES(&sig, code); + EXPECT_VERIFIES_SC(&sig, code); } // Try all combinations of return and parameter types. @@ -149,7 +174,7 @@ class AstDecoderTest : public TestWithZone { if (types[0] != ret_type || types[1] != param_type) { // Test signature mismatch. FunctionSig sig(1, 1, types); - EXPECT_FAILURE(&sig, code); + EXPECT_FAILURE_SC(&sig, code); } } } @@ -160,7 +185,7 @@ TEST_F(AstDecoderTest, Int8Const) { byte code[] = {kExprI8Const, 0}; for (int i = -128; i < 128; i++) { code[1] = static_cast<byte>(i); - EXPECT_VERIFIES(sigs.i_i(), code); + EXPECT_VERIFIES_C(i_i, code); } } @@ -172,13 +197,16 @@ TEST_F(AstDecoderTest, EmptyFunction) { TEST_F(AstDecoderTest, IncompleteIf1) { byte code[] = {kExprIf}; - EXPECT_FAILURE(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); + EXPECT_FAILURE_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, Int8Const_fallthru) { - byte code[] = {kExprI8Const, 0, kExprI8Const, 1}; - EXPECT_VERIFIES(sigs.i_i(), code); + EXPECT_VERIFIES(i_i, WASM_I32V_1(0)); +} + +TEST_F(AstDecoderTest, Int8Const_fallthru2) { + EXPECT_FAILURE(i_i, WASM_I32V_1(0), WASM_I32V_1(1)); } TEST_F(AstDecoderTest, Int32Const) { @@ -186,20 +214,15 @@ TEST_F(AstDecoderTest, Int32Const) { for (int32_t i = kMinInt; i < kMaxInt - kInc; i = i + kInc) { // TODO(binji): expand test for other sized int32s; 1 through 5 bytes. byte code[] = {WASM_I32V(i)}; - EXPECT_VERIFIES(sigs.i_i(), code); + EXPECT_VERIFIES_C(i_i, code); } } -TEST_F(AstDecoderTest, Int8Const_fallthru2) { - byte code[] = {WASM_I8(0), WASM_I32V_4(0x1122334)}; - EXPECT_VERIFIES(sigs.i_i(), code); -} - TEST_F(AstDecoderTest, Int64Const) { const int kInc = 4498211; for (int32_t i = kMinInt; i < kMaxInt - kInc; i = i + kInc) { byte code[] = {WASM_I64V((static_cast<int64_t>(i) << 32) | i)}; - EXPECT_VERIFIES(sigs.l_l(), code); + EXPECT_VERIFIES_C(l_l, code); } } @@ -207,8 +230,8 @@ TEST_F(AstDecoderTest, Float32Const) { byte code[] = {kExprF32Const, 0, 0, 0, 0}; float* ptr = reinterpret_cast<float*>(code + 1); for (int i = 0; i < 30; i++) { - *ptr = i * -7.75f; - EXPECT_VERIFIES(sigs.f_ff(), code); + WriteLittleEndianValue<float>(ptr, i * -7.75f); + EXPECT_VERIFIES_C(f_ff, code); } } @@ -216,8 +239,8 @@ TEST_F(AstDecoderTest, Float64Const) { byte code[] = {kExprF64Const, 0, 0, 0, 0, 0, 0, 0, 0}; double* ptr = reinterpret_cast<double*>(code + 1); for (int i = 0; i < 30; i++) { - *ptr = i * 33.45; - EXPECT_VERIFIES(sigs.d_dd(), code); + WriteLittleEndianValue<double>(ptr, i * 33.45); + EXPECT_VERIFIES_C(d_dd, code); } } @@ -230,19 +253,24 @@ TEST_F(AstDecoderTest, Int32Const_off_end) { } TEST_F(AstDecoderTest, GetLocal0_param) { - EXPECT_VERIFIES(sigs.i_i(), kCodeGetLocal0); + EXPECT_VERIFIES_C(i_i, kCodeGetLocal0); } TEST_F(AstDecoderTest, GetLocal0_local) { AddLocals(kAstI32, 1); - EXPECT_VERIFIES(sigs.i_v(), kCodeGetLocal0); + EXPECT_VERIFIES_C(i_v, kCodeGetLocal0); +} + +TEST_F(AstDecoderTest, TooManyLocals) { + AddLocals(kAstI32, 4034986500); + EXPECT_FAILURE_C(i_v, kCodeGetLocal0); } TEST_F(AstDecoderTest, GetLocal0_param_n) { FunctionSig* array[] = {sigs.i_i(), sigs.i_ii(), sigs.i_iii()}; for (size_t i = 0; i < arraysize(array); i++) { - EXPECT_VERIFIES(array[i], kCodeGetLocal0); + EXPECT_VERIFIES_SC(array[i], kCodeGetLocal0); } } @@ -251,540 +279,618 @@ TEST_F(AstDecoderTest, GetLocalN_local) { AddLocals(kAstI32, 1); for (byte j = 0; j < i; j++) { byte code[] = {kExprGetLocal, j}; - EXPECT_VERIFIES(sigs.i_v(), code); + EXPECT_VERIFIES_C(i_v, code); } } } TEST_F(AstDecoderTest, GetLocal0_fail_no_params) { - EXPECT_FAILURE(sigs.i_v(), kCodeGetLocal0); + EXPECT_FAILURE_C(i_v, kCodeGetLocal0); } TEST_F(AstDecoderTest, GetLocal1_fail_no_locals) { - EXPECT_FAILURE(sigs.i_i(), kCodeGetLocal1); + EXPECT_FAILURE_C(i_i, kCodeGetLocal1); } TEST_F(AstDecoderTest, GetLocal_off_end) { static const byte code[] = {kExprGetLocal}; - EXPECT_FAILURE(sigs.i_i(), code); + EXPECT_FAILURE_C(i_i, code); +} + +TEST_F(AstDecoderTest, NumLocalBelowLimit) { + AddLocals(kAstI32, kMaxNumWasmLocals - 1); + EXPECT_VERIFIES(v_v, WASM_NOP); +} + +TEST_F(AstDecoderTest, NumLocalAtLimit) { + AddLocals(kAstI32, kMaxNumWasmLocals); + EXPECT_VERIFIES(v_v, WASM_NOP); +} + +TEST_F(AstDecoderTest, NumLocalAboveLimit) { + AddLocals(kAstI32, kMaxNumWasmLocals + 1); + EXPECT_FAILURE(v_v, WASM_NOP); } TEST_F(AstDecoderTest, GetLocal_varint) { - const int kMaxLocals = 8000000; + const int kMaxLocals = kMaxNumWasmLocals; AddLocals(kAstI32, kMaxLocals); - for (int index = 0; index < kMaxLocals; index = index * 11 + 5) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), kExprGetLocal, U32V_1(index)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), kExprGetLocal, U32V_2(index)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), kExprGetLocal, U32V_3(index)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), kExprGetLocal, U32V_4(index)); - } + EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_1(66)); + EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_2(7777)); + EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_3(888888)); + EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_4(3999999)); + + EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_5(kMaxLocals - 1)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), kExprGetLocal, U32V_5(kMaxLocals - 1)); + EXPECT_FAILURE(i_i, kExprGetLocal, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); - EXPECT_VERIFIES_INLINE(sigs.i_i(), kExprGetLocal, U32V_4(kMaxLocals - 1)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), kExprGetLocal, U32V_4(kMaxLocals)); - EXPECT_FAILURE_INLINE(sigs.i_i(), kExprGetLocal, U32V_4(kMaxLocals + 1)); + EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_4(kMaxLocals - 1)); + EXPECT_VERIFIES(i_i, kExprGetLocal, U32V_4(kMaxLocals)); + EXPECT_FAILURE(i_i, kExprGetLocal, U32V_4(kMaxLocals + 1)); - EXPECT_FAILURE_INLINE(sigs.i_v(), kExprGetLocal, U32V_4(kMaxLocals)); - EXPECT_FAILURE_INLINE(sigs.i_v(), kExprGetLocal, U32V_4(kMaxLocals + 1)); + EXPECT_FAILURE(i_v, kExprGetLocal, U32V_4(kMaxLocals)); + EXPECT_FAILURE(i_v, kExprGetLocal, U32V_4(kMaxLocals + 1)); } TEST_F(AstDecoderTest, Binops_off_end) { byte code1[] = {0}; // [opcode] for (size_t i = 0; i < arraysize(kInt32BinopOpcodes); i++) { code1[0] = kInt32BinopOpcodes[i]; - EXPECT_FAILURE(sigs.i_i(), code1); + EXPECT_FAILURE_C(i_i, code1); } byte code3[] = {kExprGetLocal, 0, 0}; // [expr] [opcode] for (size_t i = 0; i < arraysize(kInt32BinopOpcodes); i++) { code3[2] = kInt32BinopOpcodes[i]; - EXPECT_FAILURE(sigs.i_i(), code3); + EXPECT_FAILURE_C(i_i, code3); } byte code4[] = {kExprGetLocal, 0, 0, 0}; // [expr] [opcode] [opcode] for (size_t i = 0; i < arraysize(kInt32BinopOpcodes); i++) { code4[2] = kInt32BinopOpcodes[i]; code4[3] = kInt32BinopOpcodes[i]; - EXPECT_FAILURE(sigs.i_i(), code4); + EXPECT_FAILURE_C(i_i, code4); } } TEST_F(AstDecoderTest, BinopsAcrossBlock1) { static const byte code[] = {WASM_ZERO, kExprBlock, WASM_ZERO, kExprI32Add, kExprEnd}; - EXPECT_FAILURE(sigs.i_i(), code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, BinopsAcrossBlock2) { static const byte code[] = {WASM_ZERO, WASM_ZERO, kExprBlock, kExprI32Add, kExprEnd}; - EXPECT_FAILURE(sigs.i_i(), code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, BinopsAcrossBlock3) { static const byte code[] = {WASM_ZERO, WASM_ZERO, kExprIf, kExprI32Add, kExprElse, kExprI32Add, kExprEnd}; - EXPECT_FAILURE(sigs.i_i(), code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, Nop) { static const byte code[] = {kExprNop}; - EXPECT_VERIFIES(sigs.v_v(), code); + EXPECT_VERIFIES_C(v_v, code); +} + +TEST_F(AstDecoderTest, SetLocal0_void) { + EXPECT_FAILURE(i_i, WASM_SET_LOCAL(0, WASM_ZERO)); } TEST_F(AstDecoderTest, SetLocal0_param) { - EXPECT_VERIFIES(sigs.i_i(), kCodeSetLocal0); - EXPECT_FAILURE(sigs.f_ff(), kCodeSetLocal0); - EXPECT_FAILURE(sigs.d_dd(), kCodeSetLocal0); + EXPECT_FAILURE_C(i_i, kCodeSetLocal0); + EXPECT_FAILURE_C(f_ff, kCodeSetLocal0); + EXPECT_FAILURE_C(d_dd, kCodeSetLocal0); +} + +TEST_F(AstDecoderTest, TeeLocal0_param) { + EXPECT_VERIFIES_C(i_i, kCodeTeeLocal0); + EXPECT_FAILURE_C(f_ff, kCodeTeeLocal0); + EXPECT_FAILURE_C(d_dd, kCodeTeeLocal0); } TEST_F(AstDecoderTest, SetLocal0_local) { - EXPECT_FAILURE(sigs.i_v(), kCodeSetLocal0); + EXPECT_FAILURE_C(i_v, kCodeSetLocal0); + EXPECT_FAILURE_C(v_v, kCodeSetLocal0); + AddLocals(kAstI32, 1); + EXPECT_FAILURE_C(i_v, kCodeSetLocal0); + EXPECT_VERIFIES_C(v_v, kCodeSetLocal0); +} + +TEST_F(AstDecoderTest, TeeLocal0_local) { + EXPECT_FAILURE_C(i_v, kCodeTeeLocal0); AddLocals(kAstI32, 1); - EXPECT_VERIFIES(sigs.i_v(), kCodeSetLocal0); + EXPECT_VERIFIES_C(i_v, kCodeTeeLocal0); } -TEST_F(AstDecoderTest, SetLocalN_local) { +TEST_F(AstDecoderTest, TeeLocalN_local) { for (byte i = 1; i < 8; i++) { AddLocals(kAstI32, 1); for (byte j = 0; j < i; j++) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_SET_LOCAL(j, WASM_I8(i))); + EXPECT_FAILURE(v_v, WASM_TEE_LOCAL(j, WASM_I8(i))); + EXPECT_VERIFIES(i_i, WASM_TEE_LOCAL(j, WASM_I8(i))); } } } TEST_F(AstDecoderTest, BlockN) { const int kMaxSize = 200; - byte buffer[kMaxSize + 2]; + byte buffer[kMaxSize + 3]; for (int i = 0; i <= kMaxSize; i++) { memset(buffer, kExprNop, sizeof(buffer)); buffer[0] = kExprBlock; - buffer[i + 1] = kExprEnd; - Verify(kSuccess, sigs.v_i(), buffer, buffer + i + 2); + buffer[1] = kLocalVoid; + buffer[i + 2] = kExprEnd; + Verify(kSuccess, sigs.v_i(), buffer, buffer + i + 3); } } +#define WASM_EMPTY_BLOCK kExprBlock, kLocalVoid, kExprEnd + TEST_F(AstDecoderTest, Block0) { - static const byte code[] = {kExprBlock, kExprEnd}; - EXPECT_VERIFIES(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); + static const byte code[] = {WASM_EMPTY_BLOCK}; + EXPECT_VERIFIES_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, Block0_fallthru1) { - static const byte code[] = {kExprBlock, kExprBlock, kExprEnd, kExprEnd}; - EXPECT_VERIFIES(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); + static const byte code[] = {WASM_BLOCK(WASM_EMPTY_BLOCK)}; + EXPECT_VERIFIES_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, Block0Block0) { - static const byte code[] = {kExprBlock, kExprEnd, kExprBlock, kExprEnd}; - EXPECT_VERIFIES(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); + static const byte code[] = {WASM_EMPTY_BLOCK, WASM_EMPTY_BLOCK}; + EXPECT_VERIFIES_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); +} + +TEST_F(AstDecoderTest, Block0_end) { + EXPECT_VERIFIES(v_v, WASM_EMPTY_BLOCK, kExprEnd); } TEST_F(AstDecoderTest, Block0_end_end) { - static const byte code[] = {kExprBlock, kExprEnd, kExprEnd}; - EXPECT_FAILURE(sigs.v_v(), code); + EXPECT_FAILURE(v_v, WASM_EMPTY_BLOCK, kExprEnd, kExprEnd); } TEST_F(AstDecoderTest, Block1) { - byte code[] = {B1(WASM_SET_LOCAL(0, WASM_ZERO))}; - EXPECT_VERIFIES(sigs.i_i(), code); - EXPECT_VERIFIES(sigs.v_i(), code); - EXPECT_FAILURE(sigs.d_dd(), code); + byte code[] = {WASM_BLOCK_I(WASM_GET_LOCAL(0))}; + EXPECT_VERIFIES_C(i_i, code); + EXPECT_FAILURE_C(v_i, code); + EXPECT_FAILURE_C(d_dd, code); + EXPECT_FAILURE_C(i_f, code); + EXPECT_FAILURE_C(i_d, code); } TEST_F(AstDecoderTest, Block1_i) { - byte code[] = {B1(WASM_ZERO)}; - EXPECT_VERIFIES(sigs.i_i(), code); - EXPECT_FAILURE(sigs.f_ff(), code); - EXPECT_FAILURE(sigs.d_dd(), code); - EXPECT_FAILURE(sigs.l_ll(), code); + byte code[] = {WASM_BLOCK_I(WASM_ZERO)}; + EXPECT_VERIFIES_C(i_i, code); + EXPECT_FAILURE_C(f_ff, code); + EXPECT_FAILURE_C(d_dd, code); + EXPECT_FAILURE_C(l_ll, code); } TEST_F(AstDecoderTest, Block1_f) { - byte code[] = {B1(WASM_F32(0))}; - EXPECT_FAILURE(sigs.i_i(), code); - EXPECT_VERIFIES(sigs.f_ff(), code); - EXPECT_FAILURE(sigs.d_dd(), code); - EXPECT_FAILURE(sigs.l_ll(), code); + byte code[] = {WASM_BLOCK_F(WASM_F32(0))}; + EXPECT_FAILURE_C(i_i, code); + EXPECT_VERIFIES_C(f_ff, code); + EXPECT_FAILURE_C(d_dd, code); + EXPECT_FAILURE_C(l_ll, code); } TEST_F(AstDecoderTest, Block1_continue) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), B1(WASM_BR(0))); - EXPECT_FAILURE_INLINE(sigs.v_v(), B1(WASM_BR(1))); - EXPECT_FAILURE_INLINE(sigs.v_v(), B1(WASM_BR(2))); - EXPECT_FAILURE_INLINE(sigs.v_v(), B1(WASM_BR(3))); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_BR(0))); } TEST_F(AstDecoderTest, Block1_br) { - EXPECT_FAILURE_INLINE(sigs.v_v(), kExprBlock, kExprBr, ARITY_1, DEPTH_0, - kExprEnd); - EXPECT_VERIFIES_INLINE(sigs.v_v(), kExprBlock, kExprBr, ARITY_0, DEPTH_0, - kExprEnd); + EXPECT_VERIFIES(v_v, B1(WASM_BR(0))); + EXPECT_VERIFIES(v_v, B1(WASM_BR(1))); + EXPECT_FAILURE(v_v, B1(WASM_BR(2))); } TEST_F(AstDecoderTest, Block2_br) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), B2(WASM_NOP, WASM_BR(0))); - EXPECT_VERIFIES_INLINE(sigs.v_v(), B2(WASM_BR(0), WASM_NOP)); - EXPECT_VERIFIES_INLINE(sigs.v_v(), B2(WASM_BR(0), WASM_BR(0))); + EXPECT_VERIFIES(v_v, B2(WASM_NOP, WASM_BR(0))); + EXPECT_VERIFIES(v_v, B2(WASM_BR(0), WASM_NOP)); + EXPECT_VERIFIES(v_v, B2(WASM_BR(0), WASM_BR(0))); } TEST_F(AstDecoderTest, Block2) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), - B2(WASM_NOP, WASM_SET_LOCAL(0, WASM_ZERO))); - EXPECT_FAILURE_INLINE(sigs.i_i(), B2(WASM_SET_LOCAL(0, WASM_ZERO), WASM_NOP)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), B2(WASM_SET_LOCAL(0, WASM_ZERO), - WASM_SET_LOCAL(0, WASM_ZERO))); + EXPECT_FAILURE(i_i, WASM_BLOCK(WASM_NOP, WASM_NOP)); + EXPECT_FAILURE(i_i, WASM_BLOCK_I(WASM_NOP, WASM_NOP)); + EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_NOP, WASM_ZERO)); + EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_ZERO, WASM_NOP)); + EXPECT_FAILURE(i_i, WASM_BLOCK_I(WASM_ZERO, WASM_ZERO)); } TEST_F(AstDecoderTest, Block2b) { - byte code[] = {B2(WASM_SET_LOCAL(0, WASM_ZERO), WASM_ZERO)}; - EXPECT_VERIFIES(sigs.i_i(), code); - EXPECT_FAILURE(sigs.v_v(), code); - EXPECT_FAILURE(sigs.f_ff(), code); + byte code[] = {WASM_BLOCK_I(WASM_SET_LOCAL(0, WASM_ZERO), WASM_ZERO)}; + EXPECT_VERIFIES_C(i_i, code); + EXPECT_FAILURE_C(v_v, code); + EXPECT_FAILURE_C(f_ff, code); } TEST_F(AstDecoderTest, Block2_fallthru) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), B2(WASM_SET_LOCAL(0, WASM_ZERO), - WASM_SET_LOCAL(0, WASM_ZERO)), - WASM_I8(23)); + EXPECT_VERIFIES( + i_i, B2(WASM_SET_LOCAL(0, WASM_ZERO), WASM_SET_LOCAL(0, WASM_ZERO)), + WASM_I8(23)); } TEST_F(AstDecoderTest, Block3) { - EXPECT_VERIFIES_INLINE( - sigs.i_i(), B3(WASM_SET_LOCAL(0, WASM_ZERO), WASM_SET_LOCAL(0, WASM_ZERO), - WASM_I8(11))); + EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_SET_LOCAL(0, WASM_ZERO), + WASM_SET_LOCAL(0, WASM_ZERO), WASM_I8(11))); } TEST_F(AstDecoderTest, Block5) { - EXPECT_VERIFIES_INLINE(sigs.v_i(), B1(WASM_GET_LOCAL(0))); + EXPECT_FAILURE(v_i, WASM_BLOCK(WASM_ZERO)); + + EXPECT_FAILURE(v_i, WASM_BLOCK(WASM_ZERO, WASM_ZERO)); + + EXPECT_FAILURE(v_i, WASM_BLOCK(WASM_ZERO, WASM_ZERO, WASM_ZERO)); + + EXPECT_FAILURE(v_i, WASM_BLOCK(WASM_ZERO, WASM_ZERO, WASM_ZERO, WASM_ZERO)); + + EXPECT_FAILURE( + v_i, WASM_BLOCK(WASM_ZERO, WASM_ZERO, WASM_ZERO, WASM_ZERO, WASM_ZERO)); +} + +TEST_F(AstDecoderTest, BlockType) { + EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_GET_LOCAL(0))); + EXPECT_VERIFIES(l_l, WASM_BLOCK_L(WASM_GET_LOCAL(0))); + EXPECT_VERIFIES(f_f, WASM_BLOCK_F(WASM_GET_LOCAL(0))); + EXPECT_VERIFIES(d_d, WASM_BLOCK_D(WASM_GET_LOCAL(0))); +} - EXPECT_VERIFIES_INLINE(sigs.v_i(), B2(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); +TEST_F(AstDecoderTest, BlockType_fail) { + EXPECT_FAILURE(i_i, WASM_BLOCK_L(WASM_I64V_1(0))); + EXPECT_FAILURE(i_i, WASM_BLOCK_F(WASM_F32(0.0))); + EXPECT_FAILURE(i_i, WASM_BLOCK_D(WASM_F64(1.1))); - EXPECT_VERIFIES_INLINE( - sigs.v_i(), B3(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); + EXPECT_FAILURE(l_l, WASM_BLOCK_I(WASM_ZERO)); + EXPECT_FAILURE(l_l, WASM_BLOCK_F(WASM_F32(0.0))); + EXPECT_FAILURE(l_l, WASM_BLOCK_D(WASM_F64(1.1))); - EXPECT_VERIFIES_INLINE(sigs.v_i(), - WASM_BLOCK(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), - WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); + EXPECT_FAILURE(f_ff, WASM_BLOCK_I(WASM_ZERO)); + EXPECT_FAILURE(f_ff, WASM_BLOCK_L(WASM_I64V_1(0))); + EXPECT_FAILURE(f_ff, WASM_BLOCK_D(WASM_F64(1.1))); - EXPECT_VERIFIES_INLINE( - sigs.v_i(), - WASM_BLOCK(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), - WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); + EXPECT_FAILURE(d_dd, WASM_BLOCK_I(WASM_ZERO)); + EXPECT_FAILURE(d_dd, WASM_BLOCK_L(WASM_I64V_1(0))); + EXPECT_FAILURE(d_dd, WASM_BLOCK_F(WASM_F32(0.0))); } TEST_F(AstDecoderTest, BlockF32) { - static const byte code[] = {kExprBlock, kExprF32Const, 0, 0, 0, 0, kExprEnd}; - EXPECT_VERIFIES(sigs.f_ff(), code); - EXPECT_FAILURE(sigs.i_i(), code); - EXPECT_FAILURE(sigs.d_dd(), code); + static const byte code[] = {WASM_BLOCK_F(kExprF32Const, 0, 0, 0, 0)}; + EXPECT_VERIFIES_C(f_ff, code); + EXPECT_FAILURE_C(i_i, code); + EXPECT_FAILURE_C(d_dd, code); } TEST_F(AstDecoderTest, BlockN_off_end) { - byte code[] = {kExprBlock, kExprNop, kExprNop, kExprNop, kExprNop, kExprEnd}; - EXPECT_VERIFIES(sigs.v_v(), code); + byte code[] = {WASM_BLOCK(kExprNop, kExprNop, kExprNop, kExprNop)}; + EXPECT_VERIFIES_C(v_v, code); for (size_t i = 1; i < arraysize(code); i++) { Verify(kError, sigs.v_v(), code, code + i); } } TEST_F(AstDecoderTest, Block2_continue) { - static const byte code[] = {kExprBlock, kExprBr, ARITY_0, - DEPTH_1, kExprNop, kExprEnd}; - EXPECT_FAILURE(sigs.v_v(), code); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_NOP, WASM_BR(0))); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_NOP, WASM_BR(1))); + EXPECT_FAILURE(v_v, WASM_LOOP(WASM_NOP, WASM_BR(2))); } -TEST_F(AstDecoderTest, NestedBlock_return) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), B1(B1(WASM_RETURN1(WASM_ZERO)))); +TEST_F(AstDecoderTest, Block3_continue) { + EXPECT_VERIFIES(v_v, B1(WASM_LOOP(WASM_NOP, WASM_BR(0)))); + EXPECT_VERIFIES(v_v, B1(WASM_LOOP(WASM_NOP, WASM_BR(1)))); + EXPECT_VERIFIES(v_v, B1(WASM_LOOP(WASM_NOP, WASM_BR(2)))); + EXPECT_FAILURE(v_v, B1(WASM_LOOP(WASM_NOP, WASM_BR(3)))); } -TEST_F(AstDecoderTest, BlockBinop) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_I32_AND(B1(WASM_I8(1)), WASM_I8(2))); +TEST_F(AstDecoderTest, NestedBlock_return) { + EXPECT_VERIFIES(i_i, B1(B1(WASM_RETURN1(WASM_ZERO)))); } TEST_F(AstDecoderTest, BlockBrBinop) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), - WASM_I32_AND(B1(WASM_BRV(0, WASM_I8(1))), WASM_I8(2))); + EXPECT_VERIFIES( + i_i, WASM_I32_AND(WASM_BLOCK_I(WASM_BRV(0, WASM_I8(1))), WASM_I8(2))); } TEST_F(AstDecoderTest, If_empty1) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_ZERO, kExprIf, kExprEnd); + EXPECT_VERIFIES(v_v, WASM_ZERO, WASM_IF_OP, kExprEnd); } TEST_F(AstDecoderTest, If_empty2) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_ZERO, kExprIf, kExprElse, kExprEnd); + EXPECT_VERIFIES(v_v, WASM_ZERO, WASM_IF_OP, kExprElse, kExprEnd); } TEST_F(AstDecoderTest, If_empty3) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_ZERO, kExprIf, WASM_ZERO, kExprElse, - kExprEnd); + EXPECT_VERIFIES(v_v, WASM_ZERO, WASM_IF_OP, WASM_NOP, kExprElse, kExprEnd); + EXPECT_FAILURE(v_v, WASM_ZERO, WASM_IF_OP, WASM_ZERO, kExprElse, kExprEnd); } TEST_F(AstDecoderTest, If_empty4) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_ZERO, kExprIf, kExprElse, WASM_ZERO, - kExprEnd); + EXPECT_VERIFIES(v_v, WASM_ZERO, WASM_IF_OP, kExprElse, WASM_NOP, kExprEnd); + EXPECT_FAILURE(v_v, WASM_ZERO, WASM_IF_OP, kExprElse, WASM_ZERO, kExprEnd); } TEST_F(AstDecoderTest, If_empty_stack) { byte code[] = {kExprIf}; - EXPECT_FAILURE(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); + EXPECT_FAILURE_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, If_incomplete1) { byte code[] = {kExprI8Const, 0, kExprIf}; - EXPECT_FAILURE(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); + EXPECT_FAILURE_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, If_incomplete2) { byte code[] = {kExprI8Const, 0, kExprIf, kExprNop}; - EXPECT_FAILURE(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); + EXPECT_FAILURE_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, If_else_else) { - byte code[] = {kExprI8Const, 0, kExprIf, kExprElse, kExprElse, kExprEnd}; - EXPECT_FAILURE(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); + byte code[] = {kExprI8Const, 0, WASM_IF_OP, kExprElse, kExprElse, kExprEnd}; + EXPECT_FAILURE_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, IfEmpty) { - EXPECT_VERIFIES_INLINE(sigs.v_i(), kExprGetLocal, 0, kExprIf, kExprEnd); + EXPECT_VERIFIES(v_i, kExprGetLocal, 0, WASM_IF_OP, kExprEnd); } TEST_F(AstDecoderTest, IfSet) { - EXPECT_VERIFIES_INLINE( - sigs.v_i(), WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO))); - EXPECT_VERIFIES_INLINE( - sigs.v_i(), - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO), WASM_NOP)); + EXPECT_VERIFIES(v_i, + WASM_IF(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO))); + EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), + WASM_SET_LOCAL(0, WASM_ZERO), WASM_NOP)); } TEST_F(AstDecoderTest, IfElseEmpty) { - EXPECT_VERIFIES_INLINE(sigs.v_i(), WASM_GET_LOCAL(0), kExprIf, kExprElse, - kExprEnd); - EXPECT_VERIFIES_INLINE(sigs.v_i(), - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP)); + EXPECT_VERIFIES(v_i, WASM_GET_LOCAL(0), WASM_IF_OP, kExprElse, kExprEnd); + EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP)); } TEST_F(AstDecoderTest, IfElseUnreachable1) { - EXPECT_VERIFIES_INLINE( - sigs.i_i(), - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_UNREACHABLE, WASM_GET_LOCAL(0))); - EXPECT_VERIFIES_INLINE( - sigs.i_i(), - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_UNREACHABLE)); + EXPECT_VERIFIES(i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_UNREACHABLE, + WASM_GET_LOCAL(0))); + EXPECT_VERIFIES(i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), + WASM_UNREACHABLE)); } TEST_F(AstDecoderTest, IfElseUnreachable2) { static const byte code[] = { - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_UNREACHABLE, WASM_GET_LOCAL(0))}; + WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_UNREACHABLE, WASM_GET_LOCAL(0))}; for (size_t i = 0; i < arraysize(kLocalTypes); i++) { LocalType types[] = {kAstI32, kLocalTypes[i]}; FunctionSig sig(1, 1, types); if (kLocalTypes[i] == kAstI32) { - EXPECT_VERIFIES(&sig, code); + EXPECT_VERIFIES_SC(&sig, code); } else { - EXPECT_FAILURE(&sig, code); + EXPECT_FAILURE_SC(&sig, code); } } } TEST_F(AstDecoderTest, IfBreak) { - EXPECT_VERIFIES_INLINE(sigs.v_i(), WASM_IF(WASM_GET_LOCAL(0), WASM_BR(0))); - EXPECT_FAILURE_INLINE(sigs.v_i(), WASM_IF(WASM_GET_LOCAL(0), WASM_BR(1))); + EXPECT_VERIFIES(v_i, WASM_IF(WASM_GET_LOCAL(0), WASM_BR(0))); + EXPECT_VERIFIES(v_i, WASM_IF(WASM_GET_LOCAL(0), WASM_BR(1))); + EXPECT_FAILURE(v_i, WASM_IF(WASM_GET_LOCAL(0), WASM_BR(2))); } TEST_F(AstDecoderTest, IfElseBreak) { - EXPECT_VERIFIES_INLINE(sigs.v_i(), - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_BR(0))); - EXPECT_FAILURE_INLINE(sigs.v_i(), - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_BR(1))); + EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_BR(0))); + EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_BR(1))); + EXPECT_FAILURE(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_BR(2))); } TEST_F(AstDecoderTest, Block_else) { byte code[] = {kExprI8Const, 0, kExprBlock, kExprElse, kExprEnd}; - EXPECT_FAILURE(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); + EXPECT_FAILURE_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, IfNop) { - EXPECT_VERIFIES_INLINE(sigs.v_i(), WASM_IF(WASM_GET_LOCAL(0), WASM_NOP)); + EXPECT_VERIFIES(v_i, WASM_IF(WASM_GET_LOCAL(0), WASM_NOP)); } TEST_F(AstDecoderTest, IfNopElseNop) { - EXPECT_VERIFIES_INLINE(sigs.v_i(), - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP)); + EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP)); } TEST_F(AstDecoderTest, If_end_end) { - static const byte code[] = {kExprGetLocal, 0, kExprIf, kExprEnd, kExprEnd}; - EXPECT_FAILURE(sigs.v_i(), code); + static const byte code[] = {kExprGetLocal, 0, WASM_IF_OP, kExprEnd, kExprEnd}; + EXPECT_VERIFIES_C(v_i, code); } -TEST_F(AstDecoderTest, If_falloff) { +TEST_F(AstDecoderTest, If_end_end_end) { + static const byte code[] = {kExprGetLocal, 0, WASM_IF_OP, + kExprEnd, kExprEnd, kExprEnd}; + EXPECT_FAILURE_C(v_i, code); +} + +TEST_F(AstDecoderTest, If_falloff1) { static const byte code[] = {kExprGetLocal, 0, kExprIf}; - EXPECT_FAILURE(sigs.v_i(), code); + EXPECT_FAILURE_C(v_i, code); +} + +TEST_F(AstDecoderTest, If_falloff2) { + static const byte code[] = {kExprGetLocal, 0, WASM_IF_OP}; + EXPECT_FAILURE_C(v_i, code); } TEST_F(AstDecoderTest, IfElse_falloff) { - static const byte code[] = {kExprGetLocal, 0, kExprIf, kExprNop, kExprElse}; - EXPECT_FAILURE(sigs.v_i(), code); + static const byte code[] = {kExprGetLocal, 0, WASM_IF_OP, kExprNop, + kExprElse}; + EXPECT_FAILURE_C(v_i, code); } TEST_F(AstDecoderTest, IfElseNop) { - EXPECT_VERIFIES_INLINE( - sigs.v_i(), - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO), WASM_NOP)); + EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), + WASM_SET_LOCAL(0, WASM_ZERO), WASM_NOP)); } TEST_F(AstDecoderTest, IfBlock1) { - EXPECT_VERIFIES_INLINE( - sigs.v_i(), WASM_IF_ELSE(WASM_GET_LOCAL(0), - B1(WASM_SET_LOCAL(0, WASM_ZERO)), WASM_NOP)); + EXPECT_VERIFIES( + v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), B1(WASM_SET_LOCAL(0, WASM_ZERO)), + WASM_NOP)); } TEST_F(AstDecoderTest, IfBlock1b) { - EXPECT_VERIFIES_INLINE( - sigs.v_i(), WASM_IF(WASM_GET_LOCAL(0), B1(WASM_SET_LOCAL(0, WASM_ZERO)))); + EXPECT_VERIFIES(v_i, + WASM_IF(WASM_GET_LOCAL(0), B1(WASM_SET_LOCAL(0, WASM_ZERO)))); } TEST_F(AstDecoderTest, IfBlock2a) { - EXPECT_VERIFIES_INLINE( - sigs.v_i(), WASM_IF(WASM_GET_LOCAL(0), B2(WASM_SET_LOCAL(0, WASM_ZERO), + EXPECT_VERIFIES(v_i, + WASM_IF(WASM_GET_LOCAL(0), B2(WASM_SET_LOCAL(0, WASM_ZERO), WASM_SET_LOCAL(0, WASM_ZERO)))); } TEST_F(AstDecoderTest, IfBlock2b) { - EXPECT_VERIFIES_INLINE( - sigs.v_i(), - WASM_IF_ELSE(WASM_GET_LOCAL(0), B2(WASM_SET_LOCAL(0, WASM_ZERO), - WASM_SET_LOCAL(0, WASM_ZERO)), - WASM_NOP)); + EXPECT_VERIFIES( + v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), B2(WASM_SET_LOCAL(0, WASM_ZERO), + WASM_SET_LOCAL(0, WASM_ZERO)), + WASM_NOP)); } TEST_F(AstDecoderTest, IfElseSet) { - EXPECT_VERIFIES_INLINE( - sigs.v_i(), WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO), + EXPECT_VERIFIES(v_i, + WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_SET_LOCAL(0, WASM_ZERO), WASM_SET_LOCAL(0, WASM_I8(1)))); } -TEST_F(AstDecoderTest, Loop0) { - static const byte code[] = {kExprLoop, kExprEnd}; - EXPECT_VERIFIES(sigs.v_v(), code); -} +TEST_F(AstDecoderTest, Loop0) { EXPECT_VERIFIES(v_v, WASM_LOOP_OP, kExprEnd); } TEST_F(AstDecoderTest, Loop1) { static const byte code[] = {WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO))}; - EXPECT_VERIFIES(sigs.v_i(), code); - EXPECT_FAILURE(sigs.v_v(), code); - EXPECT_FAILURE(sigs.f_ff(), code); + EXPECT_VERIFIES_C(v_i, code); + EXPECT_FAILURE_C(v_v, code); + EXPECT_FAILURE_C(f_ff, code); } TEST_F(AstDecoderTest, Loop2) { - EXPECT_VERIFIES_INLINE(sigs.v_i(), WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), - WASM_SET_LOCAL(0, WASM_ZERO))); + EXPECT_VERIFIES(v_i, WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), + WASM_SET_LOCAL(0, WASM_ZERO))); } TEST_F(AstDecoderTest, Loop1_continue) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR(0))); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_BR(0))); } TEST_F(AstDecoderTest, Loop1_break) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR(1))); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_BR(1))); } TEST_F(AstDecoderTest, Loop2_continue) { - EXPECT_VERIFIES_INLINE(sigs.v_i(), - WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(0))); + EXPECT_VERIFIES(v_i, WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(0))); } TEST_F(AstDecoderTest, Loop2_break) { - EXPECT_VERIFIES_INLINE(sigs.v_i(), - WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(1))); + EXPECT_VERIFIES(v_i, WASM_LOOP(WASM_SET_LOCAL(0, WASM_ZERO), WASM_BR(1))); +} + +TEST_F(AstDecoderTest, InfiniteLoop) { + EXPECT_VERIFIES(i_i, WASM_LOOP(WASM_BR(0))); + EXPECT_VERIFIES(i_i, WASM_LOOP(WASM_BRV(1, WASM_ZERO))); } -TEST_F(AstDecoderTest, ExprLoop0) { - static const byte code[] = {kExprLoop, kExprEnd}; - EXPECT_VERIFIES(sigs.v_v(), code); +TEST_F(AstDecoderTest, Loop2_unreachable) { + EXPECT_VERIFIES(i_i, WASM_LOOP(WASM_BR(0), WASM_NOP)); } -TEST_F(AstDecoderTest, ExprLoop1a) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(WASM_BRV(0, WASM_ZERO))); +TEST_F(AstDecoderTest, LoopType) { + EXPECT_VERIFIES(i_i, WASM_LOOP_I(WASM_GET_LOCAL(0))); + EXPECT_VERIFIES(l_l, WASM_LOOP_L(WASM_GET_LOCAL(0))); + EXPECT_VERIFIES(f_f, WASM_LOOP_F(WASM_GET_LOCAL(0))); + EXPECT_VERIFIES(d_d, WASM_LOOP_D(WASM_GET_LOCAL(0))); } -TEST_F(AstDecoderTest, ExprLoop1b) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(WASM_BRV(1, WASM_ZERO))); - EXPECT_FAILURE_INLINE(sigs.f_ff(), WASM_LOOP(WASM_BRV(1, WASM_ZERO))); +TEST_F(AstDecoderTest, LoopType_void) { + EXPECT_FAILURE(v_v, WASM_LOOP_I(WASM_ZERO)); + EXPECT_FAILURE(v_v, WASM_LOOP_L(WASM_I64V_1(0))); + EXPECT_FAILURE(v_v, WASM_LOOP_F(WASM_F32(0.0))); + EXPECT_FAILURE(v_v, WASM_LOOP_D(WASM_F64(1.1))); } -TEST_F(AstDecoderTest, ExprLoop2_unreachable) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(WASM_BR(0), WASM_NOP)); +TEST_F(AstDecoderTest, LoopType_fail) { + EXPECT_FAILURE(i_i, WASM_LOOP_L(WASM_I64V_1(0))); + EXPECT_FAILURE(i_i, WASM_LOOP_F(WASM_F32(0.0))); + EXPECT_FAILURE(i_i, WASM_LOOP_D(WASM_F64(1.1))); + + EXPECT_FAILURE(l_l, WASM_LOOP_I(WASM_ZERO)); + EXPECT_FAILURE(l_l, WASM_LOOP_F(WASM_F32(0.0))); + EXPECT_FAILURE(l_l, WASM_LOOP_D(WASM_F64(1.1))); + + EXPECT_FAILURE(f_ff, WASM_LOOP_I(WASM_ZERO)); + EXPECT_FAILURE(f_ff, WASM_LOOP_L(WASM_I64V_1(0))); + EXPECT_FAILURE(f_ff, WASM_LOOP_D(WASM_F64(1.1))); + + EXPECT_FAILURE(d_dd, WASM_LOOP_I(WASM_ZERO)); + EXPECT_FAILURE(d_dd, WASM_LOOP_L(WASM_I64V_1(0))); + EXPECT_FAILURE(d_dd, WASM_LOOP_F(WASM_F32(0.0))); } TEST_F(AstDecoderTest, ReturnVoid1) { static const byte code[] = {kExprNop}; - EXPECT_VERIFIES(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); - EXPECT_FAILURE(sigs.i_f(), code); + EXPECT_VERIFIES_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); + EXPECT_FAILURE_C(i_f, code); } TEST_F(AstDecoderTest, ReturnVoid2) { - static const byte code[] = {kExprBlock, kExprBr, ARITY_0, DEPTH_0, kExprEnd}; - EXPECT_VERIFIES(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); - EXPECT_FAILURE(sigs.i_f(), code); + static const byte code[] = {WASM_BLOCK(WASM_BR(0))}; + EXPECT_VERIFIES_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); + EXPECT_FAILURE_C(i_f, code); } TEST_F(AstDecoderTest, ReturnVoid3) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), kExprI8Const, 0); - EXPECT_VERIFIES_INLINE(sigs.v_v(), kExprI32Const, 0, 0, 0, 0); - EXPECT_VERIFIES_INLINE(sigs.v_v(), kExprI64Const, 0, 0, 0, 0, 0, 0, 0, 0); - EXPECT_VERIFIES_INLINE(sigs.v_v(), kExprF32Const, 0, 0, 0, 0); - EXPECT_VERIFIES_INLINE(sigs.v_v(), kExprF64Const, 0, 0, 0, 0, 0, 0, 0, 0); + EXPECT_FAILURE(v_v, kExprI8Const, 0); + EXPECT_FAILURE(v_v, kExprI32Const, 0); + EXPECT_FAILURE(v_v, kExprI64Const, 0); + EXPECT_FAILURE(v_v, kExprF32Const, 0, 0, 0, 0); + EXPECT_FAILURE(v_v, kExprF64Const, 0, 0, 0, 0, 0, 0, 0, 0); - EXPECT_VERIFIES_INLINE(sigs.v_i(), kExprGetLocal, 0); + EXPECT_FAILURE(v_i, kExprGetLocal, 0); } TEST_F(AstDecoderTest, Unreachable1) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), kExprUnreachable); - EXPECT_VERIFIES_INLINE(sigs.v_v(), kExprUnreachable, kExprUnreachable); - EXPECT_VERIFIES_INLINE(sigs.v_v(), B2(WASM_UNREACHABLE, WASM_ZERO)); - EXPECT_VERIFIES_INLINE(sigs.v_v(), B2(WASM_BR(0), WASM_ZERO)); - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_UNREACHABLE, WASM_ZERO)); - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR(0), WASM_ZERO)); + EXPECT_VERIFIES(v_v, kExprUnreachable); + EXPECT_VERIFIES(v_v, kExprUnreachable, kExprUnreachable); + EXPECT_VERIFIES(v_v, B2(WASM_UNREACHABLE, WASM_ZERO)); + EXPECT_VERIFIES(v_v, B2(WASM_BR(0), WASM_ZERO)); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_UNREACHABLE, WASM_ZERO)); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_BR(0), WASM_ZERO)); } TEST_F(AstDecoderTest, Unreachable_binop) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_I32_AND(WASM_ZERO, WASM_UNREACHABLE)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_I32_AND(WASM_UNREACHABLE, WASM_ZERO)); + EXPECT_VERIFIES(i_i, WASM_I32_AND(WASM_ZERO, WASM_UNREACHABLE)); + EXPECT_VERIFIES(i_i, WASM_I32_AND(WASM_UNREACHABLE, WASM_ZERO)); } TEST_F(AstDecoderTest, Unreachable_select) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), - WASM_SELECT(WASM_UNREACHABLE, WASM_ZERO, WASM_ZERO)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), - WASM_SELECT(WASM_ZERO, WASM_UNREACHABLE, WASM_ZERO)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), - WASM_SELECT(WASM_ZERO, WASM_ZERO, WASM_UNREACHABLE)); + EXPECT_VERIFIES(i_i, WASM_SELECT(WASM_UNREACHABLE, WASM_ZERO, WASM_ZERO)); + EXPECT_VERIFIES(i_i, WASM_SELECT(WASM_ZERO, WASM_UNREACHABLE, WASM_ZERO)); + EXPECT_VERIFIES(i_i, WASM_SELECT(WASM_ZERO, WASM_ZERO, WASM_UNREACHABLE)); } TEST_F(AstDecoderTest, If1) { - EXPECT_VERIFIES_INLINE( - sigs.i_i(), WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_I8(9), WASM_I8(8))); - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_I8(9), - WASM_GET_LOCAL(0))); - EXPECT_VERIFIES_INLINE( - sigs.i_i(), - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_I8(8))); + EXPECT_VERIFIES(i_i, + WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I8(9), WASM_I8(8))); + EXPECT_VERIFIES( + i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I8(9), WASM_GET_LOCAL(0))); + EXPECT_VERIFIES( + i_i, WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_I8(8))); } TEST_F(AstDecoderTest, If_off_end) { @@ -798,55 +904,56 @@ TEST_F(AstDecoderTest, If_off_end) { TEST_F(AstDecoderTest, If_type1) { // float|double ? 1 : 2 static const byte kCode[] = { - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_I8(0), WASM_I8(2))}; - EXPECT_VERIFIES(sigs.i_i(), kCode); - EXPECT_FAILURE(sigs.i_f(), kCode); - EXPECT_FAILURE(sigs.i_d(), kCode); + WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_I8(0), WASM_I8(2))}; + EXPECT_VERIFIES_C(i_i, kCode); + EXPECT_FAILURE_C(i_f, kCode); + EXPECT_FAILURE_C(i_d, kCode); } TEST_F(AstDecoderTest, If_type2) { // 1 ? float|double : 2 static const byte kCode[] = { - WASM_IF_ELSE(WASM_I8(1), WASM_GET_LOCAL(0), WASM_I8(1))}; - EXPECT_VERIFIES(sigs.i_i(), kCode); - EXPECT_FAILURE(sigs.i_f(), kCode); - EXPECT_FAILURE(sigs.i_d(), kCode); + WASM_IF_ELSE_I(WASM_I8(1), WASM_GET_LOCAL(0), WASM_I8(1))}; + EXPECT_VERIFIES_C(i_i, kCode); + EXPECT_FAILURE_C(i_f, kCode); + EXPECT_FAILURE_C(i_d, kCode); } TEST_F(AstDecoderTest, If_type3) { // stmt ? 0 : 1 - static const byte kCode[] = {WASM_IF_ELSE(WASM_NOP, WASM_I8(0), WASM_I8(1))}; - EXPECT_FAILURE(sigs.i_i(), kCode); - EXPECT_FAILURE(sigs.i_f(), kCode); - EXPECT_FAILURE(sigs.i_d(), kCode); + static const byte kCode[] = { + WASM_IF_ELSE_I(WASM_NOP, WASM_I8(0), WASM_I8(1))}; + EXPECT_FAILURE_C(i_i, kCode); + EXPECT_FAILURE_C(i_f, kCode); + EXPECT_FAILURE_C(i_d, kCode); } TEST_F(AstDecoderTest, If_type4) { // 0 ? stmt : 1 static const byte kCode[] = { - WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_I8(1))}; - EXPECT_FAILURE(sigs.i_i(), kCode); - EXPECT_FAILURE(sigs.i_f(), kCode); - EXPECT_FAILURE(sigs.i_d(), kCode); + WASM_IF_ELSE_I(WASM_GET_LOCAL(0), WASM_NOP, WASM_I8(1))}; + EXPECT_FAILURE_C(i_i, kCode); + EXPECT_FAILURE_C(i_f, kCode); + EXPECT_FAILURE_C(i_d, kCode); } TEST_F(AstDecoderTest, If_type5) { // 0 ? 1 : stmt - static const byte kCode[] = {WASM_IF_ELSE(WASM_ZERO, WASM_I8(1), WASM_NOP)}; - EXPECT_FAILURE(sigs.i_i(), kCode); - EXPECT_FAILURE(sigs.i_f(), kCode); - EXPECT_FAILURE(sigs.i_d(), kCode); + static const byte kCode[] = {WASM_IF_ELSE_I(WASM_ZERO, WASM_I8(1), WASM_NOP)}; + EXPECT_FAILURE_C(i_i, kCode); + EXPECT_FAILURE_C(i_f, kCode); + EXPECT_FAILURE_C(i_d, kCode); } TEST_F(AstDecoderTest, Int64Local_param) { - EXPECT_VERIFIES(sigs.l_l(), kCodeGetLocal0); + EXPECT_VERIFIES_C(l_l, kCodeGetLocal0); } TEST_F(AstDecoderTest, Int64Locals) { for (byte i = 1; i < 8; i++) { AddLocals(kAstI64, 1); for (byte j = 0; j < i; j++) { - EXPECT_VERIFIES_INLINE(sigs.l_v(), WASM_GET_LOCAL(j)); + EXPECT_VERIFIES(l_v, WASM_GET_LOCAL(j)); } } } @@ -908,132 +1015,120 @@ TEST_F(AstDecoderTest, TypeConversions) { } TEST_F(AstDecoderTest, MacrosStmt) { - VERIFY(WASM_SET_LOCAL(0, WASM_I32V_3(87348))); - VERIFY(WASM_STORE_MEM(MachineType::Int32(), WASM_I8(24), WASM_I8(40))); - VERIFY(WASM_IF(WASM_GET_LOCAL(0), WASM_NOP)); - VERIFY(WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP)); - VERIFY(WASM_NOP); - VERIFY(B1(WASM_NOP)); - VERIFY(WASM_LOOP(WASM_NOP)); - VERIFY(WASM_LOOP(WASM_BREAK(0))); - VERIFY(WASM_LOOP(WASM_CONTINUE(0))); -} - -TEST_F(AstDecoderTest, MacrosBreak) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BREAK(0))); - - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_LOOP(WASM_BREAKV(0, WASM_ZERO))); - EXPECT_VERIFIES_INLINE(sigs.l_l(), WASM_LOOP(WASM_BREAKV(0, WASM_I64V_1(0)))); - EXPECT_VERIFIES_INLINE(sigs.f_ff(), WASM_LOOP(WASM_BREAKV(0, WASM_F32(0.0)))); - EXPECT_VERIFIES_INLINE(sigs.d_dd(), WASM_LOOP(WASM_BREAKV(0, WASM_F64(0.0)))); + EXPECT_VERIFIES(v_i, WASM_SET_LOCAL(0, WASM_I32V_3(87348))); + EXPECT_VERIFIES( + v_i, WASM_STORE_MEM(MachineType::Int32(), WASM_I8(24), WASM_I8(40))); + EXPECT_VERIFIES(v_i, WASM_IF(WASM_GET_LOCAL(0), WASM_NOP)); + EXPECT_VERIFIES(v_i, WASM_IF_ELSE(WASM_GET_LOCAL(0), WASM_NOP, WASM_NOP)); + EXPECT_VERIFIES(v_v, WASM_NOP); + EXPECT_VERIFIES(v_v, B1(WASM_NOP)); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_NOP)); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_BR(0))); } TEST_F(AstDecoderTest, MacrosContinue) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_CONTINUE(0))); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_CONTINUE(0))); } TEST_F(AstDecoderTest, MacrosVariadic) { - VERIFY(B2(WASM_NOP, WASM_NOP)); - VERIFY(B3(WASM_NOP, WASM_NOP, WASM_NOP)); - VERIFY(WASM_LOOP(WASM_NOP, WASM_NOP)); - VERIFY(WASM_LOOP(WASM_NOP, WASM_NOP, WASM_NOP)); + EXPECT_VERIFIES(v_v, B2(WASM_NOP, WASM_NOP)); + EXPECT_VERIFIES(v_v, B3(WASM_NOP, WASM_NOP, WASM_NOP)); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_NOP, WASM_NOP)); + EXPECT_VERIFIES(v_v, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_NOP)); } TEST_F(AstDecoderTest, MacrosNestedBlocks) { - VERIFY(B2(WASM_NOP, B2(WASM_NOP, WASM_NOP))); - VERIFY(B3(WASM_NOP, // -- - B2(WASM_NOP, WASM_NOP), // -- - B2(WASM_NOP, WASM_NOP))); // -- - VERIFY(B1(B1(B2(WASM_NOP, WASM_NOP)))); + EXPECT_VERIFIES(v_v, B2(WASM_NOP, B2(WASM_NOP, WASM_NOP))); + EXPECT_VERIFIES(v_v, B3(WASM_NOP, // -- + B2(WASM_NOP, WASM_NOP), // -- + B2(WASM_NOP, WASM_NOP))); // -- + EXPECT_VERIFIES(v_v, B1(B1(B2(WASM_NOP, WASM_NOP)))); } TEST_F(AstDecoderTest, MultipleReturn) { static LocalType kIntTypes5[] = {kAstI32, kAstI32, kAstI32, kAstI32, kAstI32}; FunctionSig sig_ii_v(2, 0, kIntTypes5); - EXPECT_VERIFIES_INLINE(&sig_ii_v, WASM_RETURNN(2, WASM_ZERO, WASM_ONE)); - EXPECT_FAILURE_INLINE(&sig_ii_v, WASM_RETURNN(1, WASM_ZERO)); + EXPECT_VERIFIES_S(&sig_ii_v, WASM_RETURNN(2, WASM_ZERO, WASM_ONE)); + EXPECT_FAILURE_S(&sig_ii_v, WASM_RETURNN(1, WASM_ZERO)); FunctionSig sig_iii_v(3, 0, kIntTypes5); - EXPECT_VERIFIES_INLINE(&sig_iii_v, - WASM_RETURNN(3, WASM_ZERO, WASM_ONE, WASM_I8(44))); - EXPECT_FAILURE_INLINE(&sig_iii_v, WASM_RETURNN(2, WASM_ZERO, WASM_ONE)); + EXPECT_VERIFIES_S(&sig_iii_v, + WASM_RETURNN(3, WASM_ZERO, WASM_ONE, WASM_I8(44))); + EXPECT_FAILURE_S(&sig_iii_v, WASM_RETURNN(2, WASM_ZERO, WASM_ONE)); } TEST_F(AstDecoderTest, MultipleReturn_fallthru) { static LocalType kIntTypes5[] = {kAstI32, kAstI32, kAstI32, kAstI32, kAstI32}; FunctionSig sig_ii_v(2, 0, kIntTypes5); - EXPECT_VERIFIES_INLINE(&sig_ii_v, WASM_ZERO, WASM_ONE); - EXPECT_FAILURE_INLINE(&sig_ii_v, WASM_ZERO); + EXPECT_VERIFIES_S(&sig_ii_v, WASM_ZERO, WASM_ONE); + EXPECT_FAILURE_S(&sig_ii_v, WASM_ZERO); FunctionSig sig_iii_v(3, 0, kIntTypes5); - EXPECT_VERIFIES_INLINE(&sig_iii_v, WASM_ZERO, WASM_ONE, WASM_I8(44)); - EXPECT_FAILURE_INLINE(&sig_iii_v, WASM_ZERO, WASM_ONE); + EXPECT_VERIFIES_S(&sig_iii_v, WASM_ZERO, WASM_ONE, WASM_I8(44)); + EXPECT_FAILURE_S(&sig_iii_v, WASM_ZERO, WASM_ONE); } TEST_F(AstDecoderTest, MacrosInt32) { - VERIFY(WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_I8(12))); - VERIFY(WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(13))); - VERIFY(WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_I8(14))); - VERIFY(WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I8(15))); - VERIFY(WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I8(16))); - VERIFY(WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_I8(17))); - VERIFY(WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_I8(18))); - VERIFY(WASM_I32_AND(WASM_GET_LOCAL(0), WASM_I8(19))); - VERIFY(WASM_I32_IOR(WASM_GET_LOCAL(0), WASM_I8(20))); - VERIFY(WASM_I32_XOR(WASM_GET_LOCAL(0), WASM_I8(21))); - VERIFY(WASM_I32_SHL(WASM_GET_LOCAL(0), WASM_I8(22))); - VERIFY(WASM_I32_SHR(WASM_GET_LOCAL(0), WASM_I8(23))); - VERIFY(WASM_I32_SAR(WASM_GET_LOCAL(0), WASM_I8(24))); - VERIFY(WASM_I32_ROR(WASM_GET_LOCAL(0), WASM_I8(24))); - VERIFY(WASM_I32_ROL(WASM_GET_LOCAL(0), WASM_I8(24))); - VERIFY(WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(25))); - VERIFY(WASM_I32_NE(WASM_GET_LOCAL(0), WASM_I8(25))); - - VERIFY(WASM_I32_LTS(WASM_GET_LOCAL(0), WASM_I8(26))); - VERIFY(WASM_I32_LES(WASM_GET_LOCAL(0), WASM_I8(27))); - VERIFY(WASM_I32_LTU(WASM_GET_LOCAL(0), WASM_I8(28))); - VERIFY(WASM_I32_LEU(WASM_GET_LOCAL(0), WASM_I8(29))); - - VERIFY(WASM_I32_GTS(WASM_GET_LOCAL(0), WASM_I8(26))); - VERIFY(WASM_I32_GES(WASM_GET_LOCAL(0), WASM_I8(27))); - VERIFY(WASM_I32_GTU(WASM_GET_LOCAL(0), WASM_I8(28))); - VERIFY(WASM_I32_GEU(WASM_GET_LOCAL(0), WASM_I8(29))); + EXPECT_VERIFIES(i_i, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_I8(12))); + EXPECT_VERIFIES(i_i, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_I8(13))); + EXPECT_VERIFIES(i_i, WASM_I32_MUL(WASM_GET_LOCAL(0), WASM_I8(14))); + EXPECT_VERIFIES(i_i, WASM_I32_DIVS(WASM_GET_LOCAL(0), WASM_I8(15))); + EXPECT_VERIFIES(i_i, WASM_I32_DIVU(WASM_GET_LOCAL(0), WASM_I8(16))); + EXPECT_VERIFIES(i_i, WASM_I32_REMS(WASM_GET_LOCAL(0), WASM_I8(17))); + EXPECT_VERIFIES(i_i, WASM_I32_REMU(WASM_GET_LOCAL(0), WASM_I8(18))); + EXPECT_VERIFIES(i_i, WASM_I32_AND(WASM_GET_LOCAL(0), WASM_I8(19))); + EXPECT_VERIFIES(i_i, WASM_I32_IOR(WASM_GET_LOCAL(0), WASM_I8(20))); + EXPECT_VERIFIES(i_i, WASM_I32_XOR(WASM_GET_LOCAL(0), WASM_I8(21))); + EXPECT_VERIFIES(i_i, WASM_I32_SHL(WASM_GET_LOCAL(0), WASM_I8(22))); + EXPECT_VERIFIES(i_i, WASM_I32_SHR(WASM_GET_LOCAL(0), WASM_I8(23))); + EXPECT_VERIFIES(i_i, WASM_I32_SAR(WASM_GET_LOCAL(0), WASM_I8(24))); + EXPECT_VERIFIES(i_i, WASM_I32_ROR(WASM_GET_LOCAL(0), WASM_I8(24))); + EXPECT_VERIFIES(i_i, WASM_I32_ROL(WASM_GET_LOCAL(0), WASM_I8(24))); + EXPECT_VERIFIES(i_i, WASM_I32_EQ(WASM_GET_LOCAL(0), WASM_I8(25))); + EXPECT_VERIFIES(i_i, WASM_I32_NE(WASM_GET_LOCAL(0), WASM_I8(25))); + + EXPECT_VERIFIES(i_i, WASM_I32_LTS(WASM_GET_LOCAL(0), WASM_I8(26))); + EXPECT_VERIFIES(i_i, WASM_I32_LES(WASM_GET_LOCAL(0), WASM_I8(27))); + EXPECT_VERIFIES(i_i, WASM_I32_LTU(WASM_GET_LOCAL(0), WASM_I8(28))); + EXPECT_VERIFIES(i_i, WASM_I32_LEU(WASM_GET_LOCAL(0), WASM_I8(29))); + + EXPECT_VERIFIES(i_i, WASM_I32_GTS(WASM_GET_LOCAL(0), WASM_I8(26))); + EXPECT_VERIFIES(i_i, WASM_I32_GES(WASM_GET_LOCAL(0), WASM_I8(27))); + EXPECT_VERIFIES(i_i, WASM_I32_GTU(WASM_GET_LOCAL(0), WASM_I8(28))); + EXPECT_VERIFIES(i_i, WASM_I32_GEU(WASM_GET_LOCAL(0), WASM_I8(29))); } TEST_F(AstDecoderTest, MacrosInt64) { -#define VERIFY_L_LL(...) EXPECT_VERIFIES_INLINE(sigs.l_ll(), __VA_ARGS__) -#define VERIFY_I_LL(...) EXPECT_VERIFIES_INLINE(sigs.i_ll(), __VA_ARGS__) - - VERIFY_L_LL(WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_I64V_1(12))); - VERIFY_L_LL(WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_I64V_1(13))); - VERIFY_L_LL(WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_I64V_1(14))); - VERIFY_L_LL(WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_I64V_1(15))); - VERIFY_L_LL(WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_I64V_1(16))); - VERIFY_L_LL(WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_I64V_1(17))); - VERIFY_L_LL(WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_I64V_1(18))); - VERIFY_L_LL(WASM_I64_AND(WASM_GET_LOCAL(0), WASM_I64V_1(19))); - VERIFY_L_LL(WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); - VERIFY_L_LL(WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_I64V_1(21))); - - VERIFY_L_LL(WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(22))); - VERIFY_L_LL(WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(23))); - VERIFY_L_LL(WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(24))); - VERIFY_L_LL(WASM_I64_ROR(WASM_GET_LOCAL(0), WASM_I64V_1(24))); - VERIFY_L_LL(WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_I64V_1(24))); - - VERIFY_I_LL(WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_I64V_1(26))); - VERIFY_I_LL(WASM_I64_LES(WASM_GET_LOCAL(0), WASM_I64V_1(27))); - VERIFY_I_LL(WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_I64V_1(28))); - VERIFY_I_LL(WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_I64V_1(29))); - - VERIFY_I_LL(WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_I64V_1(26))); - VERIFY_I_LL(WASM_I64_GES(WASM_GET_LOCAL(0), WASM_I64V_1(27))); - VERIFY_I_LL(WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_I64V_1(28))); - VERIFY_I_LL(WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_I64V_1(29))); - - VERIFY_I_LL(WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_I64V_1(25))); - VERIFY_I_LL(WASM_I64_NE(WASM_GET_LOCAL(0), WASM_I64V_1(25))); + EXPECT_VERIFIES(l_ll, WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_I64V_1(12))); + EXPECT_VERIFIES(l_ll, WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_I64V_1(13))); + EXPECT_VERIFIES(l_ll, WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_I64V_1(14))); + EXPECT_VERIFIES(l_ll, WASM_I64_DIVS(WASM_GET_LOCAL(0), WASM_I64V_1(15))); + EXPECT_VERIFIES(l_ll, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_I64V_1(16))); + EXPECT_VERIFIES(l_ll, WASM_I64_REMS(WASM_GET_LOCAL(0), WASM_I64V_1(17))); + EXPECT_VERIFIES(l_ll, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_I64V_1(18))); + EXPECT_VERIFIES(l_ll, WASM_I64_AND(WASM_GET_LOCAL(0), WASM_I64V_1(19))); + EXPECT_VERIFIES(l_ll, WASM_I64_IOR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); + EXPECT_VERIFIES(l_ll, WASM_I64_XOR(WASM_GET_LOCAL(0), WASM_I64V_1(21))); + + EXPECT_VERIFIES(l_ll, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(22))); + EXPECT_VERIFIES(l_ll, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(23))); + EXPECT_VERIFIES(l_ll, WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_I64V_1(24))); + EXPECT_VERIFIES(l_ll, WASM_I64_ROR(WASM_GET_LOCAL(0), WASM_I64V_1(24))); + EXPECT_VERIFIES(l_ll, WASM_I64_ROL(WASM_GET_LOCAL(0), WASM_I64V_1(24))); + + EXPECT_VERIFIES(i_ll, WASM_I64_LTS(WASM_GET_LOCAL(0), WASM_I64V_1(26))); + EXPECT_VERIFIES(i_ll, WASM_I64_LES(WASM_GET_LOCAL(0), WASM_I64V_1(27))); + EXPECT_VERIFIES(i_ll, WASM_I64_LTU(WASM_GET_LOCAL(0), WASM_I64V_1(28))); + EXPECT_VERIFIES(i_ll, WASM_I64_LEU(WASM_GET_LOCAL(0), WASM_I64V_1(29))); + + EXPECT_VERIFIES(i_ll, WASM_I64_GTS(WASM_GET_LOCAL(0), WASM_I64V_1(26))); + EXPECT_VERIFIES(i_ll, WASM_I64_GES(WASM_GET_LOCAL(0), WASM_I64V_1(27))); + EXPECT_VERIFIES(i_ll, WASM_I64_GTU(WASM_GET_LOCAL(0), WASM_I64V_1(28))); + EXPECT_VERIFIES(i_ll, WASM_I64_GEU(WASM_GET_LOCAL(0), WASM_I64V_1(29))); + + EXPECT_VERIFIES(i_ll, WASM_I64_EQ(WASM_GET_LOCAL(0), WASM_I64V_1(25))); + EXPECT_VERIFIES(i_ll, WASM_I64_NE(WASM_GET_LOCAL(0), WASM_I64V_1(25))); } TEST_F(AstDecoderTest, AllSimpleExpressions) { @@ -1055,21 +1150,49 @@ TEST_F(AstDecoderTest, AllSimpleExpressions) { TEST_F(AstDecoderTest, MemorySize) { byte code[] = {kExprMemorySize}; - EXPECT_VERIFIES(sigs.i_i(), code); - EXPECT_FAILURE(sigs.f_ff(), code); -} - -TEST_F(AstDecoderTest, GrowMemory) { - byte code[] = {WASM_UNOP(kExprGrowMemory, WASM_GET_LOCAL(0))}; - EXPECT_VERIFIES(sigs.i_i(), code); - EXPECT_FAILURE(sigs.i_d(), code); + EXPECT_VERIFIES_C(i_i, code); + EXPECT_FAILURE_C(f_ff, code); } TEST_F(AstDecoderTest, LoadMemOffset) { for (int offset = 0; offset < 128; offset += 7) { byte code[] = {kExprI8Const, 0, kExprI32LoadMem, ZERO_ALIGNMENT, static_cast<byte>(offset)}; - EXPECT_VERIFIES(sigs.i_i(), code); + EXPECT_VERIFIES_C(i_i, code); + } +} + +TEST_F(AstDecoderTest, LoadMemAlignment) { + struct { + WasmOpcode instruction; + uint32_t maximum_aligment; + } values[] = { + {kExprI32LoadMem8U, 0}, // -- + {kExprI32LoadMem8S, 0}, // -- + {kExprI32LoadMem16U, 1}, // -- + {kExprI32LoadMem16S, 1}, // -- + {kExprI64LoadMem8U, 0}, // -- + {kExprI64LoadMem8S, 0}, // -- + {kExprI64LoadMem16U, 1}, // -- + {kExprI64LoadMem16S, 1}, // -- + {kExprI64LoadMem32U, 2}, // -- + {kExprI64LoadMem32S, 2}, // -- + {kExprI32LoadMem, 2}, // -- + {kExprI64LoadMem, 3}, // -- + {kExprF32LoadMem, 2}, // -- + {kExprF64LoadMem, 3}, // -- + }; + + for (int i = 0; i < arraysize(values); i++) { + for (byte alignment = 0; alignment <= 4; alignment++) { + byte code[] = {WASM_ZERO, static_cast<byte>(values[i].instruction), + alignment, ZERO_OFFSET, WASM_DROP}; + if (static_cast<uint32_t>(alignment) <= values[i].maximum_aligment) { + EXPECT_VERIFIES_C(v_i, code); + } else { + EXPECT_FAILURE_C(v_i, code); + } + } } } @@ -1077,10 +1200,15 @@ TEST_F(AstDecoderTest, StoreMemOffset) { for (int offset = 0; offset < 128; offset += 7) { byte code[] = {WASM_STORE_MEM_OFFSET(MachineType::Int32(), offset, WASM_ZERO, WASM_ZERO)}; - EXPECT_VERIFIES(sigs.i_i(), code); + EXPECT_VERIFIES_C(v_i, code); } } +TEST_F(AstDecoderTest, StoreMemOffset_void) { + EXPECT_FAILURE(i_i, WASM_STORE_MEM_OFFSET(MachineType::Int32(), 0, WASM_ZERO, + WASM_ZERO)); +} + #define BYTE0(x) ((x)&0x7F) #define BYTE1(x) ((x >> 7) & 0x7F) #define BYTE2(x) ((x >> 14) & 0x7F) @@ -1092,25 +1220,25 @@ TEST_F(AstDecoderTest, StoreMemOffset) { #define VARINT4(x) BYTE0(x) | 0x80, BYTE1(x) | 0x80, BYTE2(x) | 0x80, BYTE3(x) TEST_F(AstDecoderTest, LoadMemOffset_varint) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT, - VARINT1(0x45)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT, - VARINT2(0x3999)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT, - VARINT3(0x344445)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT, - VARINT4(0x36666667)); + EXPECT_VERIFIES(i_i, WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT, + VARINT1(0x45)); + EXPECT_VERIFIES(i_i, WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT, + VARINT2(0x3999)); + EXPECT_VERIFIES(i_i, WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT, + VARINT3(0x344445)); + EXPECT_VERIFIES(i_i, WASM_ZERO, kExprI32LoadMem, ZERO_ALIGNMENT, + VARINT4(0x36666667)); } TEST_F(AstDecoderTest, StoreMemOffset_varint) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_ZERO, WASM_ZERO, kExprI32StoreMem, - ZERO_ALIGNMENT, VARINT1(0x33)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_ZERO, WASM_ZERO, kExprI32StoreMem, - ZERO_ALIGNMENT, VARINT2(0x1111)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_ZERO, WASM_ZERO, kExprI32StoreMem, - ZERO_ALIGNMENT, VARINT3(0x222222)); - EXPECT_VERIFIES_INLINE(sigs.i_i(), WASM_ZERO, WASM_ZERO, kExprI32StoreMem, - ZERO_ALIGNMENT, VARINT4(0x44444444)); + EXPECT_VERIFIES(v_i, WASM_ZERO, WASM_ZERO, kExprI32StoreMem, ZERO_ALIGNMENT, + VARINT1(0x33)); + EXPECT_VERIFIES(v_i, WASM_ZERO, WASM_ZERO, kExprI32StoreMem, ZERO_ALIGNMENT, + VARINT2(0x1111)); + EXPECT_VERIFIES(v_i, WASM_ZERO, WASM_ZERO, kExprI32StoreMem, ZERO_ALIGNMENT, + VARINT3(0x222222)); + EXPECT_VERIFIES(v_i, WASM_ZERO, WASM_ZERO, kExprI32StoreMem, ZERO_ALIGNMENT, + VARINT4(0x44444444)); } TEST_F(AstDecoderTest, AllLoadMemCombinations) { @@ -1121,9 +1249,9 @@ TEST_F(AstDecoderTest, AllLoadMemCombinations) { byte code[] = {WASM_LOAD_MEM(mem_type, WASM_ZERO)}; FunctionSig sig(1, 0, &local_type); if (local_type == WasmOpcodes::LocalTypeFor(mem_type)) { - EXPECT_VERIFIES(&sig, code); + EXPECT_VERIFIES_SC(&sig, code); } else { - EXPECT_FAILURE(&sig, code); + EXPECT_FAILURE_SC(&sig, code); } } } @@ -1137,9 +1265,9 @@ TEST_F(AstDecoderTest, AllStoreMemCombinations) { byte code[] = {WASM_STORE_MEM(mem_type, WASM_ZERO, WASM_GET_LOCAL(0))}; FunctionSig sig(0, 1, &local_type); if (local_type == WasmOpcodes::LocalTypeFor(mem_type)) { - EXPECT_VERIFIES(&sig, code); + EXPECT_VERIFIES_SC(&sig, code); } else { - EXPECT_FAILURE(&sig, code); + EXPECT_FAILURE_SC(&sig, code); } } } @@ -1154,8 +1282,8 @@ class TestModuleEnv : public ModuleEnv { instance = nullptr; module = &mod; } - byte AddGlobal(LocalType type) { - mod.globals.push_back({0, 0, type, 0, false}); + byte AddGlobal(LocalType type, bool mutability = true) { + mod.globals.push_back({type, mutability, NO_INIT, 0, false, false}); CHECK(mod.globals.size() <= 127); return static_cast<byte>(mod.globals.size() - 1); } @@ -1165,25 +1293,22 @@ class TestModuleEnv : public ModuleEnv { return static_cast<byte>(mod.signatures.size() - 1); } byte AddFunction(FunctionSig* sig) { - mod.functions.push_back({sig, // sig - 0, // func_index - 0, // sig_index - 0, // name_offset - 0, // name_length - 0, // code_start_offset - 0}); // code_end_offset + mod.functions.push_back({sig, // sig + 0, // func_index + 0, // sig_index + 0, // name_offset + 0, // name_length + 0, // code_start_offset + 0, // code_end_offset + false, // import + false}); // export CHECK(mod.functions.size() <= 127); return static_cast<byte>(mod.functions.size() - 1); } byte AddImport(FunctionSig* sig) { - mod.import_table.push_back({sig, // sig - 0, // sig_index - 0, // module_name_offset - 0, // module_name_length - 0, // function_name_offset - 0}); // function_name_length - CHECK(mod.import_table.size() <= 127); - return static_cast<byte>(mod.import_table.size() - 1); + byte result = AddFunction(sig); + mod.functions[result].imported = true; + return result; } private: @@ -1200,9 +1325,9 @@ TEST_F(AstDecoderTest, SimpleCalls) { module_env.AddFunction(sigs.i_i()); module_env.AddFunction(sigs.i_ii()); - EXPECT_VERIFIES_INLINE(sig, WASM_CALL_FUNCTION0(0)); - EXPECT_VERIFIES_INLINE(sig, WASM_CALL_FUNCTION1(1, WASM_I8(27))); - EXPECT_VERIFIES_INLINE(sig, WASM_CALL_FUNCTION2(2, WASM_I8(37), WASM_I8(77))); + EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION0(0)); + EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(1, WASM_I8(27))); + EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(2, WASM_I8(37), WASM_I8(77))); } TEST_F(AstDecoderTest, CallsWithTooFewArguments) { @@ -1214,9 +1339,9 @@ TEST_F(AstDecoderTest, CallsWithTooFewArguments) { module_env.AddFunction(sigs.i_ii()); module_env.AddFunction(sigs.f_ff()); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION0(0)); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION1(1, WASM_ZERO)); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION1(2, WASM_GET_LOCAL(0))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION0(0)); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_ZERO)); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(2, WASM_GET_LOCAL(0))); } TEST_F(AstDecoderTest, CallsWithMismatchedSigs2) { @@ -1226,9 +1351,9 @@ TEST_F(AstDecoderTest, CallsWithMismatchedSigs2) { module_env.AddFunction(sigs.i_i()); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION1(0, WASM_I64V_1(17))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION1(0, WASM_F32(17.1))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION1(0, WASM_F64(17.1))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_I64V_1(17))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_F32(17.1))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_F64(17.1))); } TEST_F(AstDecoderTest, CallsWithMismatchedSigs3) { @@ -1238,15 +1363,59 @@ TEST_F(AstDecoderTest, CallsWithMismatchedSigs3) { module_env.AddFunction(sigs.i_f()); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION1(0, WASM_I8(17))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION1(0, WASM_I64V_1(27))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION1(0, WASM_F64(37.2))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_I8(17))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_I64V_1(27))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(0, WASM_F64(37.2))); module_env.AddFunction(sigs.i_d()); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION1(1, WASM_I8(16))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION1(1, WASM_I64V_1(16))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_FUNCTION1(1, WASM_F32(17.6))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_I8(16))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_I64V_1(16))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(1, WASM_F32(17.6))); +} + +TEST_F(AstDecoderTest, MultiReturn) { + FLAG_wasm_mv_prototype = true; + LocalType storage[] = {kAstI32, kAstI32}; + FunctionSig sig_ii_v(2, 0, storage); + FunctionSig sig_v_ii(0, 2, storage); + TestModuleEnv module_env; + module = &module_env; + + module_env.AddFunction(&sig_v_ii); + module_env.AddFunction(&sig_ii_v); + + EXPECT_VERIFIES_S(&sig_ii_v, WASM_CALL_FUNCTION0(1)); + EXPECT_VERIFIES(v_v, WASM_CALL_FUNCTION0(1), WASM_DROP, WASM_DROP); + EXPECT_VERIFIES(v_v, WASM_CALL_FUNCTION0(1), kExprCallFunction, 0); +} + +TEST_F(AstDecoderTest, MultiReturnType) { + FLAG_wasm_mv_prototype = true; + for (size_t a = 0; a < arraysize(kLocalTypes); a++) { + for (size_t b = 0; b < arraysize(kLocalTypes); b++) { + for (size_t c = 0; c < arraysize(kLocalTypes); c++) { + for (size_t d = 0; d < arraysize(kLocalTypes); d++) { + LocalType storage_ab[] = {kLocalTypes[a], kLocalTypes[b]}; + FunctionSig sig_ab_v(2, 0, storage_ab); + LocalType storage_cd[] = {kLocalTypes[c], kLocalTypes[d]}; + FunctionSig sig_cd_v(2, 0, storage_cd); + + TestModuleEnv module_env; + module = &module_env; + module_env.AddFunction(&sig_cd_v); + + EXPECT_VERIFIES_S(&sig_cd_v, WASM_CALL_FUNCTION0(0)); + + if (a == c && b == d) { + EXPECT_VERIFIES_S(&sig_ab_v, WASM_CALL_FUNCTION0(0)); + } else { + EXPECT_FAILURE_S(&sig_ab_v, WASM_CALL_FUNCTION0(0)); + } + } + } + } + } } TEST_F(AstDecoderTest, SimpleIndirectCalls) { @@ -1258,9 +1427,9 @@ TEST_F(AstDecoderTest, SimpleIndirectCalls) { byte f1 = module_env.AddSignature(sigs.i_i()); byte f2 = module_env.AddSignature(sigs.i_ii()); - EXPECT_VERIFIES_INLINE(sig, WASM_CALL_INDIRECT0(f0, WASM_ZERO)); - EXPECT_VERIFIES_INLINE(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I8(22))); - EXPECT_VERIFIES_INLINE( + EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT0(f0, WASM_ZERO)); + EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I8(22))); + EXPECT_VERIFIES_S( sig, WASM_CALL_INDIRECT2(f2, WASM_ZERO, WASM_I8(32), WASM_I8(72))); } @@ -1269,15 +1438,15 @@ TEST_F(AstDecoderTest, IndirectCallsOutOfBounds) { TestModuleEnv module_env; module = &module_env; - EXPECT_FAILURE_INLINE(sig, WASM_CALL_INDIRECT0(0, WASM_ZERO)); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(0, WASM_ZERO)); module_env.AddSignature(sigs.i_v()); - EXPECT_VERIFIES_INLINE(sig, WASM_CALL_INDIRECT0(0, WASM_ZERO)); + EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT0(0, WASM_ZERO)); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I8(22))); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I8(22))); module_env.AddSignature(sigs.i_i()); - EXPECT_VERIFIES_INLINE(sig, WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I8(27))); + EXPECT_VERIFIES_S(sig, WASM_CALL_INDIRECT1(1, WASM_ZERO, WASM_I8(27))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_INDIRECT1(2, WASM_ZERO, WASM_I8(27))); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(2, WASM_ZERO, WASM_I8(27))); } TEST_F(AstDecoderTest, IndirectCallsWithMismatchedSigs3) { @@ -1287,23 +1456,19 @@ TEST_F(AstDecoderTest, IndirectCallsWithMismatchedSigs3) { byte f0 = module_env.AddFunction(sigs.i_f()); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_I8(17))); - EXPECT_FAILURE_INLINE(sig, - WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_I64V_1(27))); - EXPECT_FAILURE_INLINE(sig, - WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_F64(37.2))); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_I8(17))); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_I64V_1(27))); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f0, WASM_ZERO, WASM_F64(37.2))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_INDIRECT0(f0, WASM_I8(17))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_INDIRECT0(f0, WASM_I64V_1(27))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_INDIRECT0(f0, WASM_F64(37.2))); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_I8(17))); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_I64V_1(27))); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT0(f0, WASM_F64(37.2))); byte f1 = module_env.AddFunction(sigs.i_d()); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I8(16))); - EXPECT_FAILURE_INLINE(sig, - WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I64V_1(16))); - EXPECT_FAILURE_INLINE(sig, - WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_F32(17.6))); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I8(16))); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_I64V_1(16))); + EXPECT_FAILURE_S(sig, WASM_CALL_INDIRECT1(f1, WASM_ZERO, WASM_F32(17.6))); } TEST_F(AstDecoderTest, SimpleImportCalls) { @@ -1315,9 +1480,9 @@ TEST_F(AstDecoderTest, SimpleImportCalls) { byte f1 = module_env.AddImport(sigs.i_i()); byte f2 = module_env.AddImport(sigs.i_ii()); - EXPECT_VERIFIES_INLINE(sig, WASM_CALL_IMPORT0(f0)); - EXPECT_VERIFIES_INLINE(sig, WASM_CALL_IMPORT1(f1, WASM_I8(22))); - EXPECT_VERIFIES_INLINE(sig, WASM_CALL_IMPORT2(f2, WASM_I8(32), WASM_I8(72))); + EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION0(f0)); + EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(f1, WASM_I8(22))); + EXPECT_VERIFIES_S(sig, WASM_CALL_FUNCTION(f2, WASM_I8(32), WASM_I8(72))); } TEST_F(AstDecoderTest, ImportCallsWithMismatchedSigs3) { @@ -1327,17 +1492,17 @@ TEST_F(AstDecoderTest, ImportCallsWithMismatchedSigs3) { byte f0 = module_env.AddImport(sigs.i_f()); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_IMPORT0(f0)); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_IMPORT1(f0, WASM_I8(17))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_IMPORT1(f0, WASM_I64V_1(27))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_IMPORT1(f0, WASM_F64(37.2))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION0(f0)); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f0, WASM_I8(17))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f0, WASM_I64V_1(27))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f0, WASM_F64(37.2))); byte f1 = module_env.AddImport(sigs.i_d()); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_IMPORT0(f1)); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_IMPORT1(f1, WASM_I8(16))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_IMPORT1(f1, WASM_I64V_1(16))); - EXPECT_FAILURE_INLINE(sig, WASM_CALL_IMPORT1(f1, WASM_F32(17.6))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION0(f1)); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f1, WASM_I8(16))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f1, WASM_I64V_1(16))); + EXPECT_FAILURE_S(sig, WASM_CALL_FUNCTION(f1, WASM_F32(17.6))); } TEST_F(AstDecoderTest, Int32Globals) { @@ -1347,8 +1512,21 @@ TEST_F(AstDecoderTest, Int32Globals) { module_env.AddGlobal(kAstI32); - EXPECT_VERIFIES_INLINE(sig, WASM_GET_GLOBAL(0)); - EXPECT_VERIFIES_INLINE(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))); + EXPECT_VERIFIES_S(sig, WASM_GET_GLOBAL(0)); + EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))); + EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), WASM_ZERO); +} + +TEST_F(AstDecoderTest, ImmutableGlobal) { + FunctionSig* sig = sigs.v_v(); + TestModuleEnv module_env; + module = &module_env; + + uint32_t g0 = module_env.AddGlobal(kAstI32, true); + uint32_t g1 = module_env.AddGlobal(kAstI32, false); + + EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(g0, WASM_ZERO)); + EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(g1, WASM_ZERO)); } TEST_F(AstDecoderTest, Int32Globals_fail) { @@ -1361,15 +1539,15 @@ TEST_F(AstDecoderTest, Int32Globals_fail) { module_env.AddGlobal(kAstF32); module_env.AddGlobal(kAstF64); - EXPECT_FAILURE_INLINE(sig, WASM_GET_GLOBAL(0)); - EXPECT_FAILURE_INLINE(sig, WASM_GET_GLOBAL(1)); - EXPECT_FAILURE_INLINE(sig, WASM_GET_GLOBAL(2)); - EXPECT_FAILURE_INLINE(sig, WASM_GET_GLOBAL(3)); + EXPECT_FAILURE_S(sig, WASM_GET_GLOBAL(0)); + EXPECT_FAILURE_S(sig, WASM_GET_GLOBAL(1)); + EXPECT_FAILURE_S(sig, WASM_GET_GLOBAL(2)); + EXPECT_FAILURE_S(sig, WASM_GET_GLOBAL(3)); - EXPECT_FAILURE_INLINE(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))); - EXPECT_FAILURE_INLINE(sig, WASM_SET_GLOBAL(1, WASM_GET_LOCAL(0))); - EXPECT_FAILURE_INLINE(sig, WASM_SET_GLOBAL(2, WASM_GET_LOCAL(0))); - EXPECT_FAILURE_INLINE(sig, WASM_SET_GLOBAL(3, WASM_GET_LOCAL(0))); + EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), WASM_ZERO); + EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(1, WASM_GET_LOCAL(0)), WASM_ZERO); + EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(2, WASM_GET_LOCAL(0)), WASM_ZERO); + EXPECT_FAILURE_S(sig, WASM_SET_GLOBAL(3, WASM_GET_LOCAL(0)), WASM_ZERO); } TEST_F(AstDecoderTest, Int64Globals) { @@ -1380,11 +1558,13 @@ TEST_F(AstDecoderTest, Int64Globals) { module_env.AddGlobal(kAstI64); module_env.AddGlobal(kAstI64); - EXPECT_VERIFIES_INLINE(sig, WASM_GET_GLOBAL(0)); - EXPECT_VERIFIES_INLINE(sig, WASM_GET_GLOBAL(1)); + EXPECT_VERIFIES_S(sig, WASM_GET_GLOBAL(0)); + EXPECT_VERIFIES_S(sig, WASM_GET_GLOBAL(1)); - EXPECT_VERIFIES_INLINE(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))); - EXPECT_VERIFIES_INLINE(sig, WASM_SET_GLOBAL(1, WASM_GET_LOCAL(0))); + EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), + WASM_GET_LOCAL(0)); + EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(1, WASM_GET_LOCAL(0)), + WASM_GET_LOCAL(0)); } TEST_F(AstDecoderTest, Float32Globals) { @@ -1394,8 +1574,9 @@ TEST_F(AstDecoderTest, Float32Globals) { module_env.AddGlobal(kAstF32); - EXPECT_VERIFIES_INLINE(sig, WASM_GET_GLOBAL(0)); - EXPECT_VERIFIES_INLINE(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))); + EXPECT_VERIFIES_S(sig, WASM_GET_GLOBAL(0)); + EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), + WASM_GET_LOCAL(0)); } TEST_F(AstDecoderTest, Float64Globals) { @@ -1405,8 +1586,9 @@ TEST_F(AstDecoderTest, Float64Globals) { module_env.AddGlobal(kAstF64); - EXPECT_VERIFIES_INLINE(sig, WASM_GET_GLOBAL(0)); - EXPECT_VERIFIES_INLINE(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))); + EXPECT_VERIFIES_S(sig, WASM_GET_GLOBAL(0)); + EXPECT_VERIFIES_S(sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0)), + WASM_GET_LOCAL(0)); } TEST_F(AstDecoderTest, AllGetGlobalCombinations) { @@ -1419,9 +1601,9 @@ TEST_F(AstDecoderTest, AllGetGlobalCombinations) { module = &module_env; module_env.AddGlobal(global_type); if (local_type == global_type) { - EXPECT_VERIFIES_INLINE(&sig, WASM_GET_GLOBAL(0)); + EXPECT_VERIFIES_S(&sig, WASM_GET_GLOBAL(0)); } else { - EXPECT_FAILURE_INLINE(&sig, WASM_GET_GLOBAL(0)); + EXPECT_FAILURE_S(&sig, WASM_GET_GLOBAL(0)); } } } @@ -1437,287 +1619,417 @@ TEST_F(AstDecoderTest, AllSetGlobalCombinations) { module = &module_env; module_env.AddGlobal(global_type); if (local_type == global_type) { - EXPECT_VERIFIES_INLINE(&sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))); + EXPECT_VERIFIES_S(&sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))); } else { - EXPECT_FAILURE_INLINE(&sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))); + EXPECT_FAILURE_S(&sig, WASM_SET_GLOBAL(0, WASM_GET_LOCAL(0))); } } } } +TEST_F(AstDecoderTest, WasmGrowMemory) { + TestModuleEnv module_env; + module = &module_env; + module->origin = kWasmOrigin; + + byte code[] = {WASM_UNOP(kExprGrowMemory, WASM_GET_LOCAL(0))}; + EXPECT_VERIFIES_C(i_i, code); + EXPECT_FAILURE_C(i_d, code); +} + +TEST_F(AstDecoderTest, AsmJsGrowMemory) { + TestModuleEnv module_env; + module = &module_env; + module->origin = kAsmJsOrigin; + + byte code[] = {WASM_UNOP(kExprGrowMemory, WASM_GET_LOCAL(0))}; + EXPECT_FAILURE_C(i_i, code); +} + +TEST_F(AstDecoderTest, AsmJsBinOpsCheckOrigin) { + LocalType float32int32float32[] = {kAstF32, kAstI32, kAstF32}; + FunctionSig sig_f_if(1, 2, float32int32float32); + LocalType float64int32float64[] = {kAstF64, kAstI32, kAstF64}; + FunctionSig sig_d_id(1, 2, float64int32float64); + struct { + WasmOpcode op; + FunctionSig* sig; + } AsmJsBinOps[] = { + {kExprF64Atan2, sigs.d_dd()}, + {kExprF64Pow, sigs.d_dd()}, + {kExprF64Mod, sigs.d_dd()}, + {kExprI32AsmjsDivS, sigs.i_ii()}, + {kExprI32AsmjsDivU, sigs.i_ii()}, + {kExprI32AsmjsRemS, sigs.i_ii()}, + {kExprI32AsmjsRemU, sigs.i_ii()}, + {kExprI32AsmjsStoreMem8, sigs.i_ii()}, + {kExprI32AsmjsStoreMem16, sigs.i_ii()}, + {kExprI32AsmjsStoreMem, sigs.i_ii()}, + {kExprF32AsmjsStoreMem, &sig_f_if}, + {kExprF64AsmjsStoreMem, &sig_d_id}, + }; + + { + TestModuleEnv module_env; + module = &module_env; + module->origin = kAsmJsOrigin; + for (int i = 0; i < arraysize(AsmJsBinOps); i++) { + TestBinop(AsmJsBinOps[i].op, AsmJsBinOps[i].sig); + } + } + + { + TestModuleEnv module_env; + module = &module_env; + module->origin = kWasmOrigin; + for (int i = 0; i < arraysize(AsmJsBinOps); i++) { + byte code[] = { + WASM_BINOP(AsmJsBinOps[i].op, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))}; + EXPECT_FAILURE_SC(AsmJsBinOps[i].sig, code); + } + } +} + +TEST_F(AstDecoderTest, AsmJsUnOpsCheckOrigin) { + LocalType float32int32[] = {kAstF32, kAstI32}; + FunctionSig sig_f_i(1, 1, float32int32); + LocalType float64int32[] = {kAstF64, kAstI32}; + FunctionSig sig_d_i(1, 1, float64int32); + struct { + WasmOpcode op; + FunctionSig* sig; + } AsmJsUnOps[] = {{kExprF64Acos, sigs.d_d()}, + {kExprF64Asin, sigs.d_d()}, + {kExprF64Atan, sigs.d_d()}, + {kExprF64Cos, sigs.d_d()}, + {kExprF64Sin, sigs.d_d()}, + {kExprF64Tan, sigs.d_d()}, + {kExprF64Exp, sigs.d_d()}, + {kExprF64Log, sigs.d_d()}, + {kExprI32AsmjsLoadMem8S, sigs.i_i()}, + {kExprI32AsmjsLoadMem8U, sigs.i_i()}, + {kExprI32AsmjsLoadMem16S, sigs.i_i()}, + {kExprI32AsmjsLoadMem16U, sigs.i_i()}, + {kExprI32AsmjsLoadMem, sigs.i_i()}, + {kExprF32AsmjsLoadMem, &sig_f_i}, + {kExprF64AsmjsLoadMem, &sig_d_i}, + {kExprI32AsmjsSConvertF32, sigs.i_f()}, + {kExprI32AsmjsUConvertF32, sigs.i_f()}, + {kExprI32AsmjsSConvertF64, sigs.i_d()}, + {kExprI32AsmjsUConvertF64, sigs.i_d()}}; + { + TestModuleEnv module_env; + module = &module_env; + module->origin = kAsmJsOrigin; + for (int i = 0; i < arraysize(AsmJsUnOps); i++) { + TestUnop(AsmJsUnOps[i].op, AsmJsUnOps[i].sig); + } + } + + { + TestModuleEnv module_env; + module = &module_env; + module->origin = kWasmOrigin; + for (int i = 0; i < arraysize(AsmJsUnOps); i++) { + byte code[] = {WASM_UNOP(AsmJsUnOps[i].op, WASM_GET_LOCAL(0))}; + EXPECT_FAILURE_SC(AsmJsUnOps[i].sig, code); + } + } +} + TEST_F(AstDecoderTest, BreakEnd) { - EXPECT_VERIFIES_INLINE(sigs.i_i(), - B1(WASM_I32_ADD(WASM_BRV(0, WASM_ZERO), WASM_ZERO))); - EXPECT_VERIFIES_INLINE(sigs.i_i(), - B1(WASM_I32_ADD(WASM_ZERO, WASM_BRV(0, WASM_ZERO)))); + EXPECT_VERIFIES( + i_i, WASM_BLOCK_I(WASM_I32_ADD(WASM_BRV(0, WASM_ZERO), WASM_ZERO))); + EXPECT_VERIFIES( + i_i, WASM_BLOCK_I(WASM_I32_ADD(WASM_ZERO, WASM_BRV(0, WASM_ZERO)))); } TEST_F(AstDecoderTest, BreakIfBinop) { - EXPECT_FAILURE_INLINE( - sigs.i_i(), WASM_BLOCK(WASM_I32_ADD(WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO), - WASM_ZERO))); - EXPECT_FAILURE_INLINE(sigs.i_i(), - WASM_BLOCK(WASM_I32_ADD( - WASM_ZERO, WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO)))); + EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_I32_ADD( + WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO), WASM_ZERO))); + EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_I32_ADD( + WASM_ZERO, WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO)))); + EXPECT_VERIFIES_S( + sigs.f_ff(), + WASM_BLOCK_F(WASM_F32_ABS(WASM_BRV_IF(0, WASM_F32(0.0f), WASM_ZERO)))); +} + +TEST_F(AstDecoderTest, BreakIfBinop_fail) { + EXPECT_FAILURE_S( + sigs.f_ff(), + WASM_BLOCK_F(WASM_F32_ABS(WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO)))); + EXPECT_FAILURE_S( + sigs.i_i(), + WASM_BLOCK_I(WASM_F32_ABS(WASM_BRV_IF(0, WASM_F32(0.0f), WASM_ZERO)))); } TEST_F(AstDecoderTest, BreakNesting1) { for (int i = 0; i < 5; i++) { // (block[2] (loop[2] (if (get p) break[N]) (set p 1)) p) - byte code[] = {WASM_BLOCK( + byte code[] = {WASM_BLOCK_I( WASM_LOOP(WASM_IF(WASM_GET_LOCAL(0), WASM_BRV(i + 1, WASM_ZERO)), WASM_SET_LOCAL(0, WASM_I8(1))), - WASM_GET_LOCAL(0))}; + WASM_ZERO)}; if (i < 3) { - EXPECT_VERIFIES(sigs.i_i(), code); + EXPECT_VERIFIES_C(i_i, code); } else { - EXPECT_FAILURE(sigs.i_i(), code); + EXPECT_FAILURE_C(i_i, code); } } } TEST_F(AstDecoderTest, BreakNesting2) { - AddLocals(kAstI32, 1); - for (int i = 0; i < 5; i++) { - // (block[2] (loop[2] (if 0 break[N]) (set p 1)) (return p)) (11) - byte code[] = {B1(WASM_LOOP(WASM_IF(WASM_ZERO, WASM_BREAK(i + 1)), - WASM_SET_LOCAL(0, WASM_I8(1)))), - WASM_I8(11)}; - if (i < 2) { - EXPECT_VERIFIES(sigs.v_v(), code); + for (int i = 0; i < 7; i++) { + byte code[] = {B1(WASM_LOOP(WASM_IF(WASM_ZERO, WASM_BR(i)), WASM_NOP))}; + if (i <= 3) { + EXPECT_VERIFIES_C(v_v, code); } else { - EXPECT_FAILURE(sigs.v_v(), code); + EXPECT_FAILURE_C(v_v, code); } } } TEST_F(AstDecoderTest, BreakNesting3) { - for (int i = 0; i < 5; i++) { + for (int i = 0; i < 7; i++) { // (block[1] (loop[1] (block[1] (if 0 break[N]) byte code[] = { - WASM_BLOCK(WASM_LOOP(B1(WASM_IF(WASM_ZERO, WASM_BREAK(i + 1)))))}; - if (i < 3) { - EXPECT_VERIFIES(sigs.v_v(), code); + WASM_BLOCK(WASM_LOOP(B1(WASM_IF(WASM_ZERO, WASM_BR(i + 1)))))}; + if (i < 4) { + EXPECT_VERIFIES_C(v_v, code); } else { - EXPECT_FAILURE(sigs.v_v(), code); + EXPECT_FAILURE_C(v_v, code); } } } TEST_F(AstDecoderTest, BreaksWithMultipleTypes) { - EXPECT_FAILURE_INLINE(sigs.i_i(), - B2(WASM_BRV_IF_ZERO(0, WASM_I8(7)), WASM_F32(7.7))); + EXPECT_FAILURE(i_i, B2(WASM_BRV_IF_ZERO(0, WASM_I8(7)), WASM_F32(7.7))); - EXPECT_FAILURE_INLINE(sigs.i_i(), B2(WASM_BRV_IF_ZERO(0, WASM_I8(7)), - WASM_BRV_IF_ZERO(0, WASM_F32(7.7)))); - EXPECT_FAILURE_INLINE(sigs.i_i(), B3(WASM_BRV_IF_ZERO(0, WASM_I8(8)), - WASM_BRV_IF_ZERO(0, WASM_I8(0)), - WASM_BRV_IF_ZERO(0, WASM_F32(7.7)))); - EXPECT_FAILURE_INLINE(sigs.i_i(), B3(WASM_BRV_IF_ZERO(0, WASM_I8(9)), - WASM_BRV_IF_ZERO(0, WASM_F32(7.7)), - WASM_BRV_IF_ZERO(0, WASM_I8(11)))); + EXPECT_FAILURE(i_i, B2(WASM_BRV_IF_ZERO(0, WASM_I8(7)), + WASM_BRV_IF_ZERO(0, WASM_F32(7.7)))); + EXPECT_FAILURE( + i_i, B3(WASM_BRV_IF_ZERO(0, WASM_I8(8)), WASM_BRV_IF_ZERO(0, WASM_I8(0)), + WASM_BRV_IF_ZERO(0, WASM_F32(7.7)))); + EXPECT_FAILURE(i_i, B3(WASM_BRV_IF_ZERO(0, WASM_I8(9)), + WASM_BRV_IF_ZERO(0, WASM_F32(7.7)), + WASM_BRV_IF_ZERO(0, WASM_I8(11)))); } TEST_F(AstDecoderTest, BreakNesting_6_levels) { for (int mask = 0; mask < 64; mask++) { for (int i = 0; i < 14; i++) { - byte code[] = { - kExprBlock, // -- - kExprBlock, // -- - kExprBlock, // -- - kExprBlock, // -- - kExprBlock, // -- - kExprBlock, // -- - kExprBr, ARITY_0, static_cast<byte>(i), // -- - kExprEnd, // -- - kExprEnd, // -- - kExprEnd, // -- - kExprEnd, // -- - kExprEnd, // -- - kExprEnd // -- - }; + byte code[] = {WASM_BLOCK(WASM_BLOCK( + WASM_BLOCK(WASM_BLOCK(WASM_BLOCK(WASM_BLOCK(WASM_BR(i)))))))}; int depth = 6; - for (int l = 0; l < 6; l++) { - if (mask & (1 << l)) { - code[l] = kExprLoop; - depth++; + int m = mask; + for (size_t pos = 0; pos < sizeof(code) - 1; pos++) { + if (code[pos] != kExprBlock) continue; + if (m & 1) { + code[pos] = kExprLoop; + code[pos + 1] = kLocalVoid; } + m >>= 1; } - if (i < depth) { - EXPECT_VERIFIES(sigs.v_v(), code); + if (i <= depth) { + EXPECT_VERIFIES_C(v_v, code); } else { - EXPECT_FAILURE(sigs.v_v(), code); + EXPECT_FAILURE_C(v_v, code); } } } } -TEST_F(AstDecoderTest, ExprBreak_TypeCheck) { +TEST_F(AstDecoderTest, Break_TypeCheck) { FunctionSig* sigarray[] = {sigs.i_i(), sigs.l_l(), sigs.f_ff(), sigs.d_dd()}; for (size_t i = 0; i < arraysize(sigarray); i++) { FunctionSig* sig = sigarray[i]; // unify X and X => OK - EXPECT_VERIFIES_INLINE( - sig, B2(WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))), - WASM_GET_LOCAL(0))); + byte code[] = {WASM_BLOCK_T( + sig->GetReturn(), WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))), + WASM_GET_LOCAL(0))}; + EXPECT_VERIFIES_SC(sig, code); } // unify i32 and f32 => fail - EXPECT_FAILURE_INLINE( - sigs.i_i(), - B2(WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_ZERO)), WASM_F32(1.2))); + EXPECT_FAILURE(i_i, WASM_BLOCK_I(WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_ZERO)), + WASM_F32(1.2))); // unify f64 and f64 => OK - EXPECT_VERIFIES_INLINE( - sigs.d_dd(), - B2(WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))), WASM_F64(1.2))); + EXPECT_VERIFIES( + d_dd, WASM_BLOCK_D(WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))), + WASM_F64(1.2))); +} + +TEST_F(AstDecoderTest, Break_TypeCheckAll1) { + for (size_t i = 0; i < arraysize(kLocalTypes); i++) { + for (size_t j = 0; j < arraysize(kLocalTypes); j++) { + LocalType storage[] = {kLocalTypes[i], kLocalTypes[i], kLocalTypes[j]}; + FunctionSig sig(1, 2, storage); + byte code[] = {WASM_BLOCK_T( + sig.GetReturn(), WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))), + WASM_GET_LOCAL(1))}; + + if (i == j) { + EXPECT_VERIFIES_SC(&sig, code); + } else { + EXPECT_FAILURE_SC(&sig, code); + } + } + } } -TEST_F(AstDecoderTest, ExprBreak_TypeCheckAll) { - byte code1[] = {WASM_BLOCK(WASM_IF(WASM_ZERO, WASM_BRV(0, WASM_GET_LOCAL(0))), - WASM_GET_LOCAL(1))}; - byte code2[] = {B2(WASM_IF(WASM_ZERO, WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0))), - WASM_GET_LOCAL(1))}; +TEST_F(AstDecoderTest, Break_TypeCheckAll2) { + for (size_t i = 0; i < arraysize(kLocalTypes); i++) { + for (size_t j = 0; j < arraysize(kLocalTypes); j++) { + LocalType storage[] = {kLocalTypes[i], kLocalTypes[i], kLocalTypes[j]}; + FunctionSig sig(1, 2, storage); + byte code[] = {WASM_IF_ELSE_T(sig.GetReturn(0), WASM_ZERO, + WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)), + WASM_GET_LOCAL(1))}; + + if (i == j) { + EXPECT_VERIFIES_SC(&sig, code); + } else { + EXPECT_FAILURE_SC(&sig, code); + } + } + } +} +TEST_F(AstDecoderTest, Break_TypeCheckAll3) { for (size_t i = 0; i < arraysize(kLocalTypes); i++) { for (size_t j = 0; j < arraysize(kLocalTypes); j++) { LocalType storage[] = {kLocalTypes[i], kLocalTypes[i], kLocalTypes[j]}; FunctionSig sig(1, 2, storage); + byte code[] = {WASM_IF_ELSE_T(sig.GetReturn(), WASM_ZERO, + WASM_GET_LOCAL(1), + WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))}; if (i == j) { - EXPECT_VERIFIES(&sig, code1); - EXPECT_VERIFIES(&sig, code2); + EXPECT_VERIFIES_SC(&sig, code); } else { - EXPECT_FAILURE(&sig, code1); - EXPECT_FAILURE(&sig, code2); + EXPECT_FAILURE_SC(&sig, code); } } } } -TEST_F(AstDecoderTest, ExprBr_Unify) { +TEST_F(AstDecoderTest, Break_Unify) { for (int which = 0; which < 2; which++) { for (size_t i = 0; i < arraysize(kLocalTypes); i++) { LocalType type = kLocalTypes[i]; LocalType storage[] = {kAstI32, kAstI32, type}; FunctionSig sig(1, 2, storage); - byte code1[] = {B2(WASM_IF(WASM_ZERO, WASM_BRV(1, WASM_GET_LOCAL(which))), - WASM_GET_LOCAL(which ^ 1))}; - byte code2[] = { - WASM_LOOP(WASM_IF(WASM_ZERO, WASM_BRV(2, WASM_GET_LOCAL(which))), - WASM_GET_LOCAL(which ^ 1))}; + byte code1[] = {WASM_BLOCK_T( + type, WASM_IF(WASM_ZERO, WASM_BRV(1, WASM_GET_LOCAL(which))), + WASM_GET_LOCAL(which ^ 1))}; if (type == kAstI32) { - EXPECT_VERIFIES(&sig, code1); - EXPECT_VERIFIES(&sig, code2); + EXPECT_VERIFIES_SC(&sig, code1); } else { - EXPECT_FAILURE(&sig, code1); - EXPECT_FAILURE(&sig, code2); + EXPECT_FAILURE_SC(&sig, code1); } } } } -TEST_F(AstDecoderTest, ExprBrIf_cond_type) { - byte code[] = {B1(WASM_BRV_IF(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))}; +TEST_F(AstDecoderTest, BreakIf_cond_type) { for (size_t i = 0; i < arraysize(kLocalTypes); i++) { for (size_t j = 0; j < arraysize(kLocalTypes); j++) { - LocalType types[] = {kLocalTypes[i], kLocalTypes[j]}; - FunctionSig sig(0, 2, types); + LocalType types[] = {kLocalTypes[i], kLocalTypes[i], kLocalTypes[j]}; + FunctionSig sig(1, 2, types); + byte code[] = {WASM_BLOCK_T( + types[0], WASM_BRV_IF(0, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))}; - if (types[1] == kAstI32) { - EXPECT_VERIFIES(&sig, code); + if (types[2] == kAstI32) { + EXPECT_VERIFIES_SC(&sig, code); } else { - EXPECT_FAILURE(&sig, code); + EXPECT_FAILURE_SC(&sig, code); } } } } -TEST_F(AstDecoderTest, ExprBrIf_val_type) { - byte code[] = {B2(WASM_BRV_IF(0, WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), - WASM_GET_LOCAL(0))}; +TEST_F(AstDecoderTest, BreakIf_val_type) { for (size_t i = 0; i < arraysize(kLocalTypes); i++) { for (size_t j = 0; j < arraysize(kLocalTypes); j++) { LocalType types[] = {kLocalTypes[i], kLocalTypes[i], kLocalTypes[j], kAstI32}; FunctionSig sig(1, 3, types); + byte code[] = {WASM_BLOCK_T( + types[1], WASM_BRV_IF(0, WASM_GET_LOCAL(1), WASM_GET_LOCAL(2)), + WASM_DROP, WASM_GET_LOCAL(0))}; if (i == j) { - EXPECT_VERIFIES(&sig, code); + EXPECT_VERIFIES_SC(&sig, code); } else { - EXPECT_FAILURE(&sig, code); + EXPECT_FAILURE_SC(&sig, code); } } } } -TEST_F(AstDecoderTest, ExprBrIf_Unify) { +TEST_F(AstDecoderTest, BreakIf_Unify) { for (int which = 0; which < 2; which++) { for (size_t i = 0; i < arraysize(kLocalTypes); i++) { LocalType type = kLocalTypes[i]; LocalType storage[] = {kAstI32, kAstI32, type}; FunctionSig sig(1, 2, storage); - - byte code1[] = {B2(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(which)), - WASM_GET_LOCAL(which ^ 1))}; - byte code2[] = {WASM_LOOP(WASM_BRV_IF_ZERO(1, WASM_GET_LOCAL(which)), - WASM_GET_LOCAL(which ^ 1))}; + byte code[] = {WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(which)), + WASM_DROP, WASM_GET_LOCAL(which ^ 1))}; if (type == kAstI32) { - EXPECT_VERIFIES(&sig, code1); - EXPECT_VERIFIES(&sig, code2); + EXPECT_VERIFIES_SC(&sig, code); } else { - EXPECT_FAILURE(&sig, code1); - EXPECT_FAILURE(&sig, code2); + EXPECT_FAILURE_SC(&sig, code); } } } } TEST_F(AstDecoderTest, BrTable0) { - static byte code[] = {kExprNop, kExprBrTable, 0, 0}; - EXPECT_FAILURE(sigs.v_v(), code); + static byte code[] = {kExprBrTable, 0, BR_TARGET(0)}; + EXPECT_FAILURE_C(v_v, code); } TEST_F(AstDecoderTest, BrTable0b) { - static byte code[] = {kExprNop, kExprI32Const, 11, kExprBrTable, 0, 0}; - EXPECT_FAILURE(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); + static byte code[] = {kExprI32Const, 11, kExprBrTable, 0, BR_TARGET(0)}; + EXPECT_VERIFIES_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, BrTable0c) { - static byte code[] = {kExprNop, kExprI32Const, 11, kExprBrTable, 0, 1, 0, 0}; - EXPECT_FAILURE(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); + static byte code[] = {kExprI32Const, 11, kExprBrTable, 0, BR_TARGET(1)}; + EXPECT_FAILURE_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); } TEST_F(AstDecoderTest, BrTable1a) { static byte code[] = {B1(WASM_BR_TABLE(WASM_I8(67), 0, BR_TARGET(0)))}; - EXPECT_VERIFIES(sigs.v_v(), code); + EXPECT_VERIFIES_C(v_v, code); } TEST_F(AstDecoderTest, BrTable1b) { static byte code[] = {B1(WASM_BR_TABLE(WASM_ZERO, 0, BR_TARGET(0)))}; - EXPECT_VERIFIES(sigs.v_v(), code); - EXPECT_FAILURE(sigs.i_i(), code); - EXPECT_FAILURE(sigs.f_ff(), code); - EXPECT_FAILURE(sigs.d_dd(), code); + EXPECT_VERIFIES_C(v_v, code); + EXPECT_FAILURE_C(i_i, code); + EXPECT_FAILURE_C(f_ff, code); + EXPECT_FAILURE_C(d_dd, code); } TEST_F(AstDecoderTest, BrTable2a) { static byte code[] = { B1(WASM_BR_TABLE(WASM_I8(67), 1, BR_TARGET(0), BR_TARGET(0)))}; - EXPECT_VERIFIES(sigs.v_v(), code); + EXPECT_VERIFIES_C(v_v, code); } TEST_F(AstDecoderTest, BrTable2b) { static byte code[] = {WASM_BLOCK( WASM_BLOCK(WASM_BR_TABLE(WASM_I8(67), 1, BR_TARGET(0), BR_TARGET(1))))}; - EXPECT_VERIFIES(sigs.v_v(), code); + EXPECT_VERIFIES_C(v_v, code); } TEST_F(AstDecoderTest, BrTable_off_end) { @@ -1730,63 +2042,74 @@ TEST_F(AstDecoderTest, BrTable_off_end) { TEST_F(AstDecoderTest, BrTable_invalid_br1) { for (int depth = 0; depth < 4; depth++) { byte code[] = {B1(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(depth)))}; - if (depth == 0) { - EXPECT_VERIFIES(sigs.v_i(), code); + if (depth <= 1) { + EXPECT_VERIFIES_C(v_i, code); } else { - EXPECT_FAILURE(sigs.v_i(), code); + EXPECT_FAILURE_C(v_i, code); } } } TEST_F(AstDecoderTest, BrTable_invalid_br2) { - for (int depth = 0; depth < 4; depth++) { + for (int depth = 0; depth < 7; depth++) { byte code[] = { WASM_LOOP(WASM_BR_TABLE(WASM_GET_LOCAL(0), 0, BR_TARGET(depth)))}; - if (depth <= 1) { - EXPECT_VERIFIES(sigs.v_i(), code); + if (depth < 2) { + EXPECT_VERIFIES_C(v_i, code); } else { - EXPECT_FAILURE(sigs.v_i(), code); + EXPECT_FAILURE_C(v_i, code); } } } -TEST_F(AstDecoderTest, ExprBreakNesting1) { - EXPECT_VERIFIES_INLINE(sigs.v_v(), B1(WASM_BRV(0, WASM_ZERO))); - EXPECT_VERIFIES_INLINE(sigs.v_v(), B1(WASM_BR(0))); - EXPECT_VERIFIES_INLINE(sigs.v_v(), B1(WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO))); - EXPECT_VERIFIES_INLINE(sigs.v_v(), B1(WASM_BR_IF(0, WASM_ZERO))); +TEST_F(AstDecoderTest, Brv1) { + EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_BRV(0, WASM_ZERO))); + EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_LOOP(WASM_BRV(2, WASM_ZERO)))); +} + +TEST_F(AstDecoderTest, Brv1_type) { + EXPECT_VERIFIES(i_ii, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)))); + EXPECT_VERIFIES(l_ll, WASM_BLOCK_L(WASM_BRV(0, WASM_GET_LOCAL(0)))); + EXPECT_VERIFIES(f_ff, WASM_BLOCK_F(WASM_BRV(0, WASM_GET_LOCAL(0)))); + EXPECT_VERIFIES(d_dd, WASM_BLOCK_D(WASM_BRV(0, WASM_GET_LOCAL(0)))); +} + +TEST_F(AstDecoderTest, Brv1_type_n) { + EXPECT_FAILURE(i_f, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)))); + EXPECT_FAILURE(i_d, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)))); +} - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BRV(0, WASM_ZERO))); - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR(0))); - EXPECT_VERIFIES_INLINE(sigs.v_v(), - WASM_LOOP(WASM_BRV_IF(0, WASM_ZERO, WASM_ZERO))); - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR_IF(0, WASM_ZERO))); +TEST_F(AstDecoderTest, BrvIf1) { + EXPECT_VERIFIES(i_v, WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_ZERO))); +} + +TEST_F(AstDecoderTest, BrvIf1_type) { + EXPECT_VERIFIES(i_i, WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))); + EXPECT_VERIFIES(l_l, WASM_BLOCK_L(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))); + EXPECT_VERIFIES(f_ff, WASM_BLOCK_F(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))); + EXPECT_VERIFIES(d_dd, WASM_BLOCK_D(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))); +} - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BRV(1, WASM_ZERO))); - EXPECT_VERIFIES_INLINE(sigs.v_v(), WASM_LOOP(WASM_BR(1))); +TEST_F(AstDecoderTest, BrvIf1_type_n) { + EXPECT_FAILURE(i_f, WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))); + EXPECT_FAILURE(i_d, WASM_BLOCK_I(WASM_BRV_IF_ZERO(0, WASM_GET_LOCAL(0)))); } TEST_F(AstDecoderTest, Select) { - EXPECT_VERIFIES_INLINE( - sigs.i_i(), WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_ZERO)); - EXPECT_VERIFIES_INLINE(sigs.f_ff(), - WASM_SELECT(WASM_F32(0.0), WASM_F32(0.0), WASM_ZERO)); - EXPECT_VERIFIES_INLINE(sigs.d_dd(), - WASM_SELECT(WASM_F64(0.0), WASM_F64(0.0), WASM_ZERO)); - EXPECT_VERIFIES_INLINE( - sigs.l_l(), WASM_SELECT(WASM_I64V_1(0), WASM_I64V_1(0), WASM_ZERO)); + EXPECT_VERIFIES(i_i, + WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_ZERO)); + EXPECT_VERIFIES(f_ff, WASM_SELECT(WASM_F32(0.0), WASM_F32(0.0), WASM_ZERO)); + EXPECT_VERIFIES(d_dd, WASM_SELECT(WASM_F64(0.0), WASM_F64(0.0), WASM_ZERO)); + EXPECT_VERIFIES(l_l, WASM_SELECT(WASM_I64V_1(0), WASM_I64V_1(0), WASM_ZERO)); } TEST_F(AstDecoderTest, Select_fail1) { - EXPECT_FAILURE_INLINE( - sigs.i_i(), - WASM_SELECT(WASM_F32(0.0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); - EXPECT_FAILURE_INLINE( - sigs.i_i(), - WASM_SELECT(WASM_GET_LOCAL(0), WASM_F32(0.0), WASM_GET_LOCAL(0))); - EXPECT_FAILURE_INLINE( - sigs.i_i(), - WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_F32(0.0))); + EXPECT_FAILURE( + i_i, WASM_SELECT(WASM_F32(0.0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); + EXPECT_FAILURE( + i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_F32(0.0), WASM_GET_LOCAL(0))); + EXPECT_FAILURE( + i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_F32(0.0))); } TEST_F(AstDecoderTest, Select_fail2) { @@ -1797,120 +2120,159 @@ TEST_F(AstDecoderTest, Select_fail2) { LocalType types[] = {type, kAstI32, type}; FunctionSig sig(1, 2, types); - EXPECT_VERIFIES_INLINE( - &sig, - WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))); + EXPECT_VERIFIES_S(&sig, WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(1), + WASM_GET_LOCAL(0))); - EXPECT_FAILURE_INLINE( - &sig, - WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); + EXPECT_FAILURE_S(&sig, WASM_SELECT(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0), + WASM_GET_LOCAL(0))); - EXPECT_FAILURE_INLINE( - &sig, - WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))); + EXPECT_FAILURE_S(&sig, WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), + WASM_GET_LOCAL(0))); - EXPECT_FAILURE_INLINE( - &sig, - WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + EXPECT_FAILURE_S(&sig, WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(0), + WASM_GET_LOCAL(1))); } } TEST_F(AstDecoderTest, Select_TypeCheck) { - EXPECT_FAILURE_INLINE( - sigs.i_i(), - WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); + EXPECT_FAILURE( + i_i, WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0), WASM_GET_LOCAL(0))); - EXPECT_FAILURE_INLINE( - sigs.i_i(), - WASM_SELECT(WASM_GET_LOCAL(0), WASM_F64(0.25), WASM_GET_LOCAL(0))); + EXPECT_FAILURE( + i_i, WASM_SELECT(WASM_GET_LOCAL(0), WASM_F64(0.25), WASM_GET_LOCAL(0))); - EXPECT_FAILURE_INLINE( - sigs.i_i(), - WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0), WASM_I64V_1(0))); + EXPECT_FAILURE(i_i, + WASM_SELECT(WASM_F32(9.9), WASM_GET_LOCAL(0), WASM_I64V_1(0))); } TEST_F(AstDecoderTest, Throw) { FLAG_wasm_eh_prototype = true; - EXPECT_VERIFIES_INLINE(sigs.v_i(), WASM_GET_LOCAL(0), kExprThrow); + EXPECT_VERIFIES(v_i, WASM_GET_LOCAL(0), kExprThrow); - EXPECT_FAILURE_INLINE(sigs.i_d(), WASM_GET_LOCAL(0), kExprThrow, - WASM_I32V(0)); - EXPECT_FAILURE_INLINE(sigs.i_f(), WASM_GET_LOCAL(0), kExprThrow, - WASM_I32V(0)); - EXPECT_FAILURE_INLINE(sigs.l_l(), WASM_GET_LOCAL(0), kExprThrow, - WASM_I64V(0)); + EXPECT_FAILURE(i_d, WASM_GET_LOCAL(0), kExprThrow, WASM_I32V(0)); + EXPECT_FAILURE(i_f, WASM_GET_LOCAL(0), kExprThrow, WASM_I32V(0)); + EXPECT_FAILURE(l_l, WASM_GET_LOCAL(0), kExprThrow, WASM_I64V(0)); } +#define WASM_TRY_OP kExprTry, kLocalVoid + #define WASM_CATCH(local) kExprCatch, static_cast<byte>(local) + TEST_F(AstDecoderTest, TryCatch) { FLAG_wasm_eh_prototype = true; - EXPECT_VERIFIES_INLINE(sigs.v_i(), kExprTryCatch, WASM_CATCH(0), kExprEnd); + EXPECT_VERIFIES(v_i, WASM_TRY_OP, WASM_CATCH(0), kExprEnd); // Missing catch. - EXPECT_FAILURE_INLINE(sigs.v_v(), kExprTryCatch, kExprEnd); + EXPECT_FAILURE(v_v, WASM_TRY_OP, kExprEnd); // Missing end. - EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatch, WASM_CATCH(0)); + EXPECT_FAILURE(v_i, WASM_TRY_OP, WASM_CATCH(0)); // Double catch. - EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatch, WASM_CATCH(0), WASM_CATCH(0), - kExprEnd); - - // Unexpected finally. - EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatch, WASM_CATCH(0), kExprFinally, - kExprEnd); -} - -TEST_F(AstDecoderTest, TryFinally) { - FLAG_wasm_eh_prototype = true; - EXPECT_VERIFIES_INLINE(sigs.v_v(), kExprTryFinally, kExprFinally, kExprEnd); + EXPECT_FAILURE(v_i, WASM_TRY_OP, WASM_CATCH(0), WASM_CATCH(0), kExprEnd); +} + +TEST_F(AstDecoderTest, MultiValBlock1) { + FLAG_wasm_mv_prototype = true; + EXPECT_VERIFIES(i_ii, WASM_BLOCK_TT(kAstI32, kAstI32, WASM_GET_LOCAL(0), + WASM_GET_LOCAL(1)), + kExprI32Add); +} + +TEST_F(AstDecoderTest, MultiValBlock2) { + FLAG_wasm_mv_prototype = true; + EXPECT_VERIFIES(i_ii, WASM_BLOCK_TT(kAstI32, kAstI32, WASM_GET_LOCAL(0), + WASM_GET_LOCAL(1)), + WASM_I32_ADD(WASM_NOP, WASM_NOP)); +} + +TEST_F(AstDecoderTest, MultiValBlockBr1) { + FLAG_wasm_mv_prototype = true; + EXPECT_FAILURE(i_ii, + WASM_BLOCK_TT(kAstI32, kAstI32, WASM_GET_LOCAL(0), WASM_BR(0)), + kExprI32Add); + EXPECT_VERIFIES(i_ii, WASM_BLOCK_TT(kAstI32, kAstI32, WASM_GET_LOCAL(0), + WASM_GET_LOCAL(1), WASM_BR(0)), + kExprI32Add); +} + +TEST_F(AstDecoderTest, MultiValIf1) { + FLAG_wasm_mv_prototype = true; + EXPECT_FAILURE( + i_ii, WASM_IF_ELSE_TT(kAstI32, kAstI32, WASM_GET_LOCAL(0), + WASM_SEQ(WASM_GET_LOCAL(0)), + WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))), + kExprI32Add); + EXPECT_FAILURE(i_ii, + WASM_IF_ELSE_TT(kAstI32, kAstI32, WASM_GET_LOCAL(0), + WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), + WASM_SEQ(WASM_GET_LOCAL(1))), + kExprI32Add); + EXPECT_VERIFIES( + i_ii, WASM_IF_ELSE_TT(kAstI32, kAstI32, WASM_GET_LOCAL(0), + WASM_SEQ(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)), + WASM_SEQ(WASM_GET_LOCAL(1), WASM_GET_LOCAL(0))), + kExprI32Add); +} + +class BranchTableIteratorTest : public TestWithZone { + public: + BranchTableIteratorTest() : TestWithZone() {} + void CheckBrTableSize(const byte* start, const byte* end) { + Decoder decoder(start, end); + BranchTableOperand operand(&decoder, start); + BranchTableIterator iterator(&decoder, operand); + EXPECT_EQ(end - start - 1, iterator.length()); + EXPECT_TRUE(decoder.ok()); + } + void CheckBrTableError(const byte* start, const byte* end) { + Decoder decoder(start, end); + BranchTableOperand operand(&decoder, start); + BranchTableIterator iterator(&decoder, operand); + iterator.length(); + EXPECT_FALSE(decoder.ok()); + } +}; - // Mising finally. - EXPECT_FAILURE_INLINE(sigs.v_v(), kExprTryFinally, kExprEnd); +#define CHECK_BR_TABLE_LENGTH(...) \ + { \ + static byte code[] = {kExprBrTable, __VA_ARGS__}; \ + CheckBrTableSize(code, code + sizeof(code)); \ + } - // Missing end. - EXPECT_FAILURE_INLINE(sigs.v_v(), kExprTryFinally, kExprFinally); +#define CHECK_BR_TABLE_ERROR(...) \ + { \ + static byte code[] = {kExprBrTable, __VA_ARGS__}; \ + CheckBrTableError(code, code + sizeof(code)); \ + } - // Double finally. - EXPECT_FAILURE_INLINE(sigs.v_v(), kExprTryFinally, kExprFinally, kExprFinally, - kExprEnd); +TEST_F(BranchTableIteratorTest, count0) { + CHECK_BR_TABLE_LENGTH(0, U32V_1(1)); + CHECK_BR_TABLE_LENGTH(0, U32V_2(200)); + CHECK_BR_TABLE_LENGTH(0, U32V_3(30000)); + CHECK_BR_TABLE_LENGTH(0, U32V_4(400000)); - // Unexpected catch. - EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatch, WASM_CATCH(0), kExprFinally, - kExprEnd); + CHECK_BR_TABLE_LENGTH(0, U32V_1(2)); + CHECK_BR_TABLE_LENGTH(0, U32V_2(300)); + CHECK_BR_TABLE_LENGTH(0, U32V_3(40000)); + CHECK_BR_TABLE_LENGTH(0, U32V_4(500000)); } -TEST_F(AstDecoderTest, TryCatchFinally) { - FLAG_wasm_eh_prototype = true; - EXPECT_VERIFIES_INLINE(sigs.v_i(), kExprTryCatchFinally, WASM_CATCH(0), - kExprFinally, kExprEnd); - - // Missing catch. - EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, kExprFinally, - kExprEnd); - - // Double catch. - EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, WASM_CATCH(0), - WASM_CATCH(0), kExprFinally, kExprEnd); - - // Missing finally. - EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, WASM_CATCH(0), - kExprEnd); +TEST_F(BranchTableIteratorTest, count1) { + CHECK_BR_TABLE_LENGTH(1, U32V_1(1), U32V_1(6)); + CHECK_BR_TABLE_LENGTH(1, U32V_2(200), U32V_1(8)); + CHECK_BR_TABLE_LENGTH(1, U32V_3(30000), U32V_1(9)); + CHECK_BR_TABLE_LENGTH(1, U32V_4(400000), U32V_1(11)); - // Double finally. - EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, WASM_CATCH(0), - kExprFinally, kExprFinally, kExprEnd); - - // Finally before catch. - EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, kExprFinally, - WASM_CATCH(0), kExprEnd); - - // Missing both try and finally. - EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, kExprEnd); + CHECK_BR_TABLE_LENGTH(1, U32V_1(2), U32V_2(6)); + CHECK_BR_TABLE_LENGTH(1, U32V_2(300), U32V_2(7)); + CHECK_BR_TABLE_LENGTH(1, U32V_3(40000), U32V_2(8)); + CHECK_BR_TABLE_LENGTH(1, U32V_4(500000), U32V_2(9)); +} - // Missing end. - EXPECT_FAILURE_INLINE(sigs.v_i(), kExprTryCatchFinally, WASM_CATCH(0), - kExprFinally); +TEST_F(BranchTableIteratorTest, error0) { + CHECK_BR_TABLE_ERROR(0); + CHECK_BR_TABLE_ERROR(1, U32V_1(33)); } class WasmOpcodeLengthTest : public TestWithZone { @@ -1932,20 +2294,17 @@ class WasmOpcodeLengthTest : public TestWithZone { TEST_F(WasmOpcodeLengthTest, Statements) { EXPECT_LENGTH(1, kExprNop); - EXPECT_LENGTH(1, kExprBlock); - EXPECT_LENGTH(1, kExprLoop); - EXPECT_LENGTH(1, kExprIf); + EXPECT_LENGTH(2, kExprBlock); + EXPECT_LENGTH(2, kExprLoop); + EXPECT_LENGTH(2, kExprIf); EXPECT_LENGTH(1, kExprElse); EXPECT_LENGTH(1, kExprEnd); EXPECT_LENGTH(1, kExprSelect); - EXPECT_LENGTH(3, kExprBr); - EXPECT_LENGTH(3, kExprBrIf); + EXPECT_LENGTH(2, kExprBr); + EXPECT_LENGTH(2, kExprBrIf); EXPECT_LENGTH(1, kExprThrow); - EXPECT_LENGTH(1, kExprTryCatch); - EXPECT_LENGTH(1, kExprTryFinally); - EXPECT_LENGTH(1, kExprTryCatchFinally); + EXPECT_LENGTH(2, kExprTry); EXPECT_LENGTH(2, kExprCatch); - EXPECT_LENGTH(1, kExprFinally); } TEST_F(WasmOpcodeLengthTest, MiscExpressions) { @@ -1956,14 +2315,8 @@ TEST_F(WasmOpcodeLengthTest, MiscExpressions) { EXPECT_LENGTH(2, kExprSetLocal); EXPECT_LENGTH(2, kExprGetGlobal); EXPECT_LENGTH(2, kExprSetGlobal); - EXPECT_LENGTH(3, kExprCallFunction); - EXPECT_LENGTH(3, kExprCallImport); - EXPECT_LENGTH(3, kExprCallIndirect); - EXPECT_LENGTH(1, kExprIf); - EXPECT_LENGTH(1, kExprBlock); - EXPECT_LENGTH(1, kExprLoop); - EXPECT_LENGTH(3, kExprBr); - EXPECT_LENGTH(3, kExprBrIf); + EXPECT_LENGTH(2, kExprCallFunction); + EXPECT_LENGTH(2, kExprCallIndirect); } TEST_F(WasmOpcodeLengthTest, I32Const) { @@ -2147,256 +2500,11 @@ TEST_F(WasmOpcodeLengthTest, SimpleExpressions) { EXPECT_LENGTH(1, kExprI64ReinterpretF64); } -class WasmOpcodeArityTest : public TestWithZone { - public: - WasmOpcodeArityTest() : TestWithZone() {} -}; - -#define EXPECT_ARITY(expected, ...) \ - { \ - static const byte code[] = {__VA_ARGS__}; \ - EXPECT_EQ(expected, OpcodeArity(code, code + sizeof(code))); \ - } - -TEST_F(WasmOpcodeArityTest, Control) { - EXPECT_ARITY(0, kExprNop); - - EXPECT_ARITY(0, kExprBlock, 0); - EXPECT_ARITY(0, kExprBlock, 1); - EXPECT_ARITY(0, kExprBlock, 2); - EXPECT_ARITY(0, kExprBlock, 5); - EXPECT_ARITY(0, kExprBlock, 10); - - EXPECT_ARITY(0, kExprLoop, 0); - EXPECT_ARITY(0, kExprLoop, 1); - EXPECT_ARITY(0, kExprLoop, 2); - EXPECT_ARITY(0, kExprLoop, 7); - EXPECT_ARITY(0, kExprLoop, 11); - - EXPECT_ARITY(3, kExprSelect); - - EXPECT_ARITY(0, kExprBr); - EXPECT_ARITY(1, kExprBrIf); - EXPECT_ARITY(1, kExprBrTable); - - EXPECT_ARITY(1, kExprBr, ARITY_1); - EXPECT_ARITY(2, kExprBrIf, ARITY_1); - EXPECT_ARITY(2, kExprBrTable, ARITY_1); - - { - EXPECT_ARITY(0, kExprReturn, ARITY_0); - EXPECT_ARITY(1, kExprReturn, ARITY_1); - } - - EXPECT_ARITY(0, kExprThrow); - EXPECT_ARITY(0, kExprTryCatch); - EXPECT_ARITY(0, kExprTryFinally); - EXPECT_ARITY(0, kExprTryCatchFinally); - EXPECT_ARITY(1, kExprCatch, 2); - EXPECT_ARITY(0, kExprFinally); -} - -TEST_F(WasmOpcodeArityTest, Misc) { - EXPECT_ARITY(0, kExprI8Const); - EXPECT_ARITY(0, kExprI32Const); - EXPECT_ARITY(0, kExprF32Const); - EXPECT_ARITY(0, kExprI64Const); - EXPECT_ARITY(0, kExprF64Const); - EXPECT_ARITY(0, kExprGetLocal); - EXPECT_ARITY(1, kExprSetLocal); - EXPECT_ARITY(0, kExprGetGlobal); - EXPECT_ARITY(1, kExprSetGlobal); -} - -TEST_F(WasmOpcodeArityTest, Calls) { - { - EXPECT_ARITY(2, kExprCallFunction, 2, 0); - EXPECT_ARITY(2, kExprCallImport, 2, 0); - EXPECT_ARITY(3, kExprCallIndirect, 2, 0); - - EXPECT_ARITY(1, kExprBr, ARITY_1); - EXPECT_ARITY(2, kExprBrIf, ARITY_1); - EXPECT_ARITY(2, kExprBrTable, ARITY_1); - - EXPECT_ARITY(0, kExprBr, ARITY_0); - EXPECT_ARITY(1, kExprBrIf, ARITY_0); - EXPECT_ARITY(1, kExprBrTable, ARITY_0); - } - - { - EXPECT_ARITY(1, kExprCallFunction, ARITY_1, 1); - EXPECT_ARITY(1, kExprCallImport, ARITY_1, 1); - EXPECT_ARITY(2, kExprCallIndirect, ARITY_1, 1); - - EXPECT_ARITY(1, kExprBr, ARITY_1); - EXPECT_ARITY(2, kExprBrIf, ARITY_1); - EXPECT_ARITY(2, kExprBrTable, ARITY_1); - - EXPECT_ARITY(0, kExprBr, ARITY_0); - EXPECT_ARITY(1, kExprBrIf, ARITY_0); - EXPECT_ARITY(1, kExprBrTable, ARITY_0); - } -} - -TEST_F(WasmOpcodeArityTest, LoadsAndStores) { - EXPECT_ARITY(1, kExprI32LoadMem8S); - EXPECT_ARITY(1, kExprI32LoadMem8U); - EXPECT_ARITY(1, kExprI32LoadMem16S); - EXPECT_ARITY(1, kExprI32LoadMem16U); - EXPECT_ARITY(1, kExprI32LoadMem); - - EXPECT_ARITY(1, kExprI64LoadMem8S); - EXPECT_ARITY(1, kExprI64LoadMem8U); - EXPECT_ARITY(1, kExprI64LoadMem16S); - EXPECT_ARITY(1, kExprI64LoadMem16U); - EXPECT_ARITY(1, kExprI64LoadMem32S); - EXPECT_ARITY(1, kExprI64LoadMem32U); - EXPECT_ARITY(1, kExprI64LoadMem); - EXPECT_ARITY(1, kExprF32LoadMem); - EXPECT_ARITY(1, kExprF64LoadMem); - - EXPECT_ARITY(2, kExprI32StoreMem8); - EXPECT_ARITY(2, kExprI32StoreMem16); - EXPECT_ARITY(2, kExprI32StoreMem); - EXPECT_ARITY(2, kExprI64StoreMem8); - EXPECT_ARITY(2, kExprI64StoreMem16); - EXPECT_ARITY(2, kExprI64StoreMem32); - EXPECT_ARITY(2, kExprI64StoreMem); - EXPECT_ARITY(2, kExprF32StoreMem); - EXPECT_ARITY(2, kExprF64StoreMem); -} - -TEST_F(WasmOpcodeArityTest, MiscMemExpressions) { - EXPECT_ARITY(0, kExprMemorySize); - EXPECT_ARITY(1, kExprGrowMemory); -} - -TEST_F(WasmOpcodeArityTest, SimpleExpressions) { - EXPECT_ARITY(2, kExprI32Add); - EXPECT_ARITY(2, kExprI32Sub); - EXPECT_ARITY(2, kExprI32Mul); - EXPECT_ARITY(2, kExprI32DivS); - EXPECT_ARITY(2, kExprI32DivU); - EXPECT_ARITY(2, kExprI32RemS); - EXPECT_ARITY(2, kExprI32RemU); - EXPECT_ARITY(2, kExprI32And); - EXPECT_ARITY(2, kExprI32Ior); - EXPECT_ARITY(2, kExprI32Xor); - EXPECT_ARITY(2, kExprI32Shl); - EXPECT_ARITY(2, kExprI32ShrU); - EXPECT_ARITY(2, kExprI32ShrS); - EXPECT_ARITY(2, kExprI32Eq); - EXPECT_ARITY(2, kExprI32Ne); - EXPECT_ARITY(2, kExprI32LtS); - EXPECT_ARITY(2, kExprI32LeS); - EXPECT_ARITY(2, kExprI32LtU); - EXPECT_ARITY(2, kExprI32LeU); - EXPECT_ARITY(2, kExprI32GtS); - EXPECT_ARITY(2, kExprI32GeS); - EXPECT_ARITY(2, kExprI32GtU); - EXPECT_ARITY(2, kExprI32GeU); - EXPECT_ARITY(1, kExprI32Clz); - EXPECT_ARITY(1, kExprI32Ctz); - EXPECT_ARITY(1, kExprI32Popcnt); - EXPECT_ARITY(1, kExprI32Eqz); - EXPECT_ARITY(2, kExprI64Add); - EXPECT_ARITY(2, kExprI64Sub); - EXPECT_ARITY(2, kExprI64Mul); - EXPECT_ARITY(2, kExprI64DivS); - EXPECT_ARITY(2, kExprI64DivU); - EXPECT_ARITY(2, kExprI64RemS); - EXPECT_ARITY(2, kExprI64RemU); - EXPECT_ARITY(2, kExprI64And); - EXPECT_ARITY(2, kExprI64Ior); - EXPECT_ARITY(2, kExprI64Xor); - EXPECT_ARITY(2, kExprI64Shl); - EXPECT_ARITY(2, kExprI64ShrU); - EXPECT_ARITY(2, kExprI64ShrS); - EXPECT_ARITY(2, kExprI64Eq); - EXPECT_ARITY(2, kExprI64Ne); - EXPECT_ARITY(2, kExprI64LtS); - EXPECT_ARITY(2, kExprI64LeS); - EXPECT_ARITY(2, kExprI64LtU); - EXPECT_ARITY(2, kExprI64LeU); - EXPECT_ARITY(2, kExprI64GtS); - EXPECT_ARITY(2, kExprI64GeS); - EXPECT_ARITY(2, kExprI64GtU); - EXPECT_ARITY(2, kExprI64GeU); - EXPECT_ARITY(1, kExprI64Clz); - EXPECT_ARITY(1, kExprI64Ctz); - EXPECT_ARITY(1, kExprI64Popcnt); - EXPECT_ARITY(2, kExprF32Add); - EXPECT_ARITY(2, kExprF32Sub); - EXPECT_ARITY(2, kExprF32Mul); - EXPECT_ARITY(2, kExprF32Div); - EXPECT_ARITY(2, kExprF32Min); - EXPECT_ARITY(2, kExprF32Max); - EXPECT_ARITY(1, kExprF32Abs); - EXPECT_ARITY(1, kExprF32Neg); - EXPECT_ARITY(2, kExprF32CopySign); - EXPECT_ARITY(1, kExprF32Ceil); - EXPECT_ARITY(1, kExprF32Floor); - EXPECT_ARITY(1, kExprF32Trunc); - EXPECT_ARITY(1, kExprF32NearestInt); - EXPECT_ARITY(1, kExprF32Sqrt); - EXPECT_ARITY(2, kExprF32Eq); - EXPECT_ARITY(2, kExprF32Ne); - EXPECT_ARITY(2, kExprF32Lt); - EXPECT_ARITY(2, kExprF32Le); - EXPECT_ARITY(2, kExprF32Gt); - EXPECT_ARITY(2, kExprF32Ge); - EXPECT_ARITY(2, kExprF64Add); - EXPECT_ARITY(2, kExprF64Sub); - EXPECT_ARITY(2, kExprF64Mul); - EXPECT_ARITY(2, kExprF64Div); - EXPECT_ARITY(2, kExprF64Min); - EXPECT_ARITY(2, kExprF64Max); - EXPECT_ARITY(1, kExprF64Abs); - EXPECT_ARITY(1, kExprF64Neg); - EXPECT_ARITY(2, kExprF64CopySign); - EXPECT_ARITY(1, kExprF64Ceil); - EXPECT_ARITY(1, kExprF64Floor); - EXPECT_ARITY(1, kExprF64Trunc); - EXPECT_ARITY(1, kExprF64NearestInt); - EXPECT_ARITY(1, kExprF64Sqrt); - EXPECT_ARITY(2, kExprF64Eq); - EXPECT_ARITY(2, kExprF64Ne); - EXPECT_ARITY(2, kExprF64Lt); - EXPECT_ARITY(2, kExprF64Le); - EXPECT_ARITY(2, kExprF64Gt); - EXPECT_ARITY(2, kExprF64Ge); - EXPECT_ARITY(1, kExprI32SConvertF32); - EXPECT_ARITY(1, kExprI32SConvertF64); - EXPECT_ARITY(1, kExprI32UConvertF32); - EXPECT_ARITY(1, kExprI32UConvertF64); - EXPECT_ARITY(1, kExprI32ConvertI64); - EXPECT_ARITY(1, kExprI64SConvertF32); - EXPECT_ARITY(1, kExprI64SConvertF64); - EXPECT_ARITY(1, kExprI64UConvertF32); - EXPECT_ARITY(1, kExprI64UConvertF64); - EXPECT_ARITY(1, kExprI64SConvertI32); - EXPECT_ARITY(1, kExprI64UConvertI32); - EXPECT_ARITY(1, kExprF32SConvertI32); - EXPECT_ARITY(1, kExprF32UConvertI32); - EXPECT_ARITY(1, kExprF32SConvertI64); - EXPECT_ARITY(1, kExprF32UConvertI64); - EXPECT_ARITY(1, kExprF32ConvertF64); - EXPECT_ARITY(1, kExprF32ReinterpretI32); - EXPECT_ARITY(1, kExprF64SConvertI32); - EXPECT_ARITY(1, kExprF64UConvertI32); - EXPECT_ARITY(1, kExprF64SConvertI64); - EXPECT_ARITY(1, kExprF64UConvertI64); - EXPECT_ARITY(1, kExprF64ConvertF32); - EXPECT_ARITY(1, kExprF64ReinterpretI64); - EXPECT_ARITY(1, kExprI32ReinterpretF32); - EXPECT_ARITY(1, kExprI64ReinterpretF64); -} - typedef ZoneVector<LocalType> LocalTypeMap; class LocalDeclDecoderTest : public TestWithZone { public: - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; size_t ExpectRun(LocalTypeMap map, size_t pos, LocalType expected, size_t count) { diff --git a/deps/v8/test/unittests/wasm/control-transfer-unittest.cc b/deps/v8/test/unittests/wasm/control-transfer-unittest.cc index 2b67f12ef5..ab2d937758 100644 --- a/deps/v8/test/unittests/wasm/control-transfer-unittest.cc +++ b/deps/v8/test/unittests/wasm/control-transfer-unittest.cc @@ -24,30 +24,28 @@ namespace wasm { #define B2(a, b) kExprBlock, a, b, kExprEnd #define B3(a, b, c) kExprBlock, a, b, c, kExprEnd -struct ExpectedTarget { +#define TRANSFER_VOID 0 +#define TRANSFER_ONE 1 + +struct ExpectedPcDelta { pc_t pc; - ControlTransfer expected; + pcdiff_t expected; }; // For nicer error messages. -class ControlTransferMatcher : public MatcherInterface<const ControlTransfer&> { +class ControlTransferMatcher : public MatcherInterface<const pcdiff_t&> { public: - explicit ControlTransferMatcher(pc_t pc, const ControlTransfer& expected) + explicit ControlTransferMatcher(pc_t pc, const pcdiff_t& expected) : pc_(pc), expected_(expected) {} void DescribeTo(std::ostream* os) const override { - *os << "@" << pc_ << " {pcdiff = " << expected_.pcdiff - << ", spdiff = " << expected_.spdiff - << ", action = " << expected_.action << "}"; + *os << "@" << pc_ << " pcdiff = " << expected_; } - bool MatchAndExplain(const ControlTransfer& input, + bool MatchAndExplain(const pcdiff_t& input, MatchResultListener* listener) const override { - if (input.pcdiff != expected_.pcdiff || input.spdiff != expected_.spdiff || - input.action != expected_.action) { - *listener << "@" << pc_ << " {pcdiff = " << input.pcdiff - << ", spdiff = " << input.spdiff - << ", action = " << input.action << "}"; + if (input != expected_) { + *listener << "@" << pc_ << " pcdiff = " << input; return false; } return true; @@ -55,36 +53,43 @@ class ControlTransferMatcher : public MatcherInterface<const ControlTransfer&> { private: pc_t pc_; - const ControlTransfer& expected_; + const pcdiff_t& expected_; }; class ControlTransferTest : public TestWithZone { public: - void CheckControlTransfers(const byte* start, const byte* end, - ExpectedTarget* expected_targets, - size_t num_targets) { + void CheckPcDeltas(const byte* start, const byte* end, + ExpectedPcDelta* expected_deltas, size_t num_targets) { ControlTransferMap map = WasmInterpreter::ComputeControlTransfersForTesting(zone(), start, end); // Check all control targets in the map. for (size_t i = 0; i < num_targets; i++) { - pc_t pc = expected_targets[i].pc; + pc_t pc = expected_deltas[i].pc; auto it = map.find(pc); if (it == map.end()) { - printf("expected control target @ +%zu\n", pc); - EXPECT_TRUE(false); + EXPECT_TRUE(false) << "expected control target @ " << pc; } else { - ControlTransfer& expected = expected_targets[i].expected; - ControlTransfer& target = it->second; + pcdiff_t expected = expected_deltas[i].expected; + pcdiff_t& target = it->second; EXPECT_THAT(target, MakeMatcher(new ControlTransferMatcher(pc, expected))); } } // Check there are no other control targets. + CheckNoOtherTargets<ExpectedPcDelta>(start, end, map, expected_deltas, + num_targets); + } + + template <typename T> + void CheckNoOtherTargets(const byte* start, const byte* end, + ControlTransferMap& map, T* targets, + size_t num_targets) { + // Check there are no other control targets. for (pc_t pc = 0; start + pc < end; pc++) { bool found = false; for (size_t i = 0; i < num_targets; i++) { - if (expected_targets[i].pc == pc) { + if (targets[i].pc == pc) { found = true; break; } @@ -98,125 +103,128 @@ class ControlTransferTest : public TestWithZone { } }; -// Macro for simplifying tests below. -#define EXPECT_TARGETS(...) \ - do { \ - ExpectedTarget pairs[] = {__VA_ARGS__}; \ - CheckControlTransfers(code, code + sizeof(code), pairs, arraysize(pairs)); \ +#define EXPECT_PC_DELTAS(...) \ + do { \ + ExpectedPcDelta pairs[] = {__VA_ARGS__}; \ + CheckPcDeltas(code, code + sizeof(code), pairs, arraysize(pairs)); \ } while (false) TEST_F(ControlTransferTest, SimpleIf) { byte code[] = { kExprI32Const, // @0 - 0, // +1 + 0, // @1 kExprIf, // @2 - kExprEnd // @3 + kLocalVoid, // @3 + kExprEnd // @4 }; - EXPECT_TARGETS({2, {2, 0, ControlTransfer::kPushVoid}}, // -- - {3, {1, 0, ControlTransfer::kPushVoid}}); + EXPECT_PC_DELTAS({2, 2}); } TEST_F(ControlTransferTest, SimpleIf1) { byte code[] = { kExprI32Const, // @0 - 0, // +1 + 0, // @1 kExprIf, // @2 - kExprNop, // @3 - kExprEnd // @4 + kLocalVoid, // @3 + kExprNop, // @4 + kExprEnd // @5 }; - EXPECT_TARGETS({2, {3, 0, ControlTransfer::kPushVoid}}, // -- - {4, {1, 1, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({2, 3}); } TEST_F(ControlTransferTest, SimpleIf2) { byte code[] = { kExprI32Const, // @0 - 0, // +1 + 0, // @1 kExprIf, // @2 - kExprNop, // @3 + kLocalVoid, // @3 kExprNop, // @4 - kExprEnd // @5 + kExprNop, // @5 + kExprEnd // @6 }; - EXPECT_TARGETS({2, {4, 0, ControlTransfer::kPushVoid}}, // -- - {5, {1, 2, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({2, 4}); } TEST_F(ControlTransferTest, SimpleIfElse) { byte code[] = { kExprI32Const, // @0 - 0, // +1 + 0, // @1 kExprIf, // @2 - kExprElse, // @3 - kExprEnd // @4 + kLocalVoid, // @3 + kExprElse, // @4 + kExprEnd // @5 }; - EXPECT_TARGETS({2, {2, 0, ControlTransfer::kNoAction}}, // -- - {3, {2, 0, ControlTransfer::kPushVoid}}, // -- - {4, {1, 0, ControlTransfer::kPushVoid}}); + EXPECT_PC_DELTAS({2, 3}, {4, 2}); +} + +TEST_F(ControlTransferTest, SimpleIfElse_v1) { + byte code[] = { + kExprI32Const, // @0 + 0, // @1 + kExprIf, // @2 + kLocalVoid, // @3 + kExprI8Const, // @4 + 0, // @5 + kExprElse, // @6 + kExprI8Const, // @7 + 0, // @8 + kExprEnd // @9 + }; + EXPECT_PC_DELTAS({2, 5}, {6, 4}); } TEST_F(ControlTransferTest, SimpleIfElse1) { byte code[] = { kExprI32Const, // @0 - 0, // +1 + 0, // @1 kExprIf, // @2 - kExprNop, // @3 + kLocalVoid, // @3 kExprElse, // @4 kExprNop, // @5 kExprEnd // @6 }; - EXPECT_TARGETS({2, {3, 0, ControlTransfer::kNoAction}}, // -- - {4, {3, 1, ControlTransfer::kPopAndRepush}}, // -- - {6, {1, 1, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({2, 3}, {4, 3}); } TEST_F(ControlTransferTest, IfBr) { byte code[] = { kExprI32Const, // @0 - 0, // +1 + 0, // @1 kExprIf, // @2 - kExprBr, // @3 - ARITY_0, // +1 - 0, // +1 + kLocalVoid, // @3 + kExprBr, // @4 + 0, // @5 kExprEnd // @6 }; - EXPECT_TARGETS({2, {5, 0, ControlTransfer::kPushVoid}}, // -- - {3, {4, 0, ControlTransfer::kPushVoid}}, // -- - {6, {1, 1, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({2, 4}, {4, 3}); } TEST_F(ControlTransferTest, IfBrElse) { byte code[] = { kExprI32Const, // @0 - 0, // +1 + 0, // @1 kExprIf, // @2 - kExprBr, // @3 - ARITY_0, // +1 - 0, // +1 + kLocalVoid, // @3 + kExprBr, // @4 + 0, // @5 kExprElse, // @6 kExprEnd // @7 }; - EXPECT_TARGETS({2, {5, 0, ControlTransfer::kNoAction}}, // -- - {3, {5, 0, ControlTransfer::kPushVoid}}, // -- - {6, {2, 1, ControlTransfer::kPopAndRepush}}, // -- - {7, {1, 0, ControlTransfer::kPushVoid}}); + EXPECT_PC_DELTAS({2, 5}, {4, 4}, {6, 2}); } TEST_F(ControlTransferTest, IfElseBr) { byte code[] = { kExprI32Const, // @0 - 0, // +1 + 0, // @1 kExprIf, // @2 - kExprNop, // @3 + kLocalVoid, // @3 kExprElse, // @4 kExprBr, // @5 - ARITY_0, // +1 - 0, // +1 - kExprEnd // @8 + 0, // @6 + kExprEnd // @7 }; - EXPECT_TARGETS({2, {3, 0, ControlTransfer::kNoAction}}, // -- - {4, {5, 1, ControlTransfer::kPopAndRepush}}, // -- - {5, {4, 0, ControlTransfer::kPushVoid}}, // -- - {8, {1, 1, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({2, 3}, {4, 4}, {5, 3}); } TEST_F(ControlTransferTest, BlockEmpty) { @@ -224,177 +232,233 @@ TEST_F(ControlTransferTest, BlockEmpty) { kExprBlock, // @0 kExprEnd // @1 }; - EXPECT_TARGETS({1, {1, 0, ControlTransfer::kPushVoid}}); + CheckPcDeltas(code, code + sizeof(code), nullptr, 0); } TEST_F(ControlTransferTest, Br0) { byte code[] = { kExprBlock, // @0 - kExprBr, // @1 - ARITY_0, // +1 - 0, // +1 + kLocalVoid, // @1 + kExprBr, // @2 + 0, // @3 kExprEnd // @4 }; - EXPECT_TARGETS({1, {4, 0, ControlTransfer::kPushVoid}}, - {4, {1, 1, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({2, 3}); } TEST_F(ControlTransferTest, Br1) { byte code[] = { kExprBlock, // @0 - kExprNop, // @1 - kExprBr, // @2 - ARITY_0, // +1 - 0, // +1 + kLocalVoid, // @1 + kExprNop, // @2 + kExprBr, // @3 + 0, // @4 kExprEnd // @5 }; - EXPECT_TARGETS({2, {4, 1, ControlTransfer::kPopAndRepush}}, // -- - {5, {1, 2, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({3, 3}); +} + +TEST_F(ControlTransferTest, Br_v1a) { + byte code[] = { + kExprBlock, // @0 + kLocalVoid, // @1 + kExprI8Const, // @2 + 0, // @3 + kExprBr, // @4 + 0, // @5 + kExprEnd // @6 + }; + EXPECT_PC_DELTAS({4, 3}); +} + +TEST_F(ControlTransferTest, Br_v1b) { + byte code[] = { + kExprBlock, // @0 + kLocalVoid, // @1 + kExprI8Const, // @2 + 0, // @3 + kExprBr, // @4 + 0, // @5 + kExprEnd // @6 + }; + EXPECT_PC_DELTAS({4, 3}); +} + +TEST_F(ControlTransferTest, Br_v1c) { + byte code[] = { + kExprI8Const, // @0 + 0, // @1 + kExprBlock, // @2 + kLocalVoid, // @3 + kExprBr, // @4 + 0, // @5 + kExprEnd // @6 + }; + EXPECT_PC_DELTAS({4, 3}); } TEST_F(ControlTransferTest, Br2) { byte code[] = { kExprBlock, // @0 - kExprNop, // @1 + kLocalVoid, // @1 kExprNop, // @2 - kExprBr, // @3 - ARITY_0, // +1 - 0, // +1 + kExprNop, // @3 + kExprBr, // @4 + 0, // @5 kExprEnd // @6 }; - EXPECT_TARGETS({3, {4, 2, ControlTransfer::kPopAndRepush}}, // -- - {6, {1, 3, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({4, 3}); } TEST_F(ControlTransferTest, Br0b) { byte code[] = { kExprBlock, // @0 - kExprBr, // @1 - ARITY_0, // +1 - 0, // +1 + kLocalVoid, // @1 + kExprBr, // @2 + 0, // @3 kExprNop, // @4 kExprEnd // @5 }; - EXPECT_TARGETS({1, {5, 0, ControlTransfer::kPushVoid}}, // -- - {5, {1, 2, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({2, 4}); } TEST_F(ControlTransferTest, Br0c) { byte code[] = { kExprBlock, // @0 - kExprBr, // @1 - ARITY_0, // +1 - 0, // +1 + kLocalVoid, // @1 + kExprBr, // @2 + 0, // @3 kExprNop, // @4 kExprNop, // @5 kExprEnd // @6 }; - EXPECT_TARGETS({1, {6, 0, ControlTransfer::kPushVoid}}, // -- - {6, {1, 3, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({2, 5}); } TEST_F(ControlTransferTest, SimpleLoop1) { byte code[] = { - kExprLoop, // @0 - kExprBr, // @1 - ARITY_0, // +1 - 0, // +1 - kExprEnd // @4 + kExprLoop, // @0 + kLocalVoid, // @1 + kExprBr, // @2 + 0, // @3 + kExprEnd // @4 }; - EXPECT_TARGETS({1, {-1, 0, ControlTransfer::kNoAction}}, // -- - {4, {1, 1, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({2, -2}); } TEST_F(ControlTransferTest, SimpleLoop2) { byte code[] = { - kExprLoop, // @0 - kExprNop, // @1 - kExprBr, // @2 - ARITY_0, // +1 - 0, // +1 - kExprEnd // @5 + kExprLoop, // @0 + kLocalVoid, // @1 + kExprNop, // @2 + kExprBr, // @3 + 0, // @4 + kExprEnd // @5 }; - EXPECT_TARGETS({2, {-2, 1, ControlTransfer::kNoAction}}, // -- - {5, {1, 2, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({3, -3}); } TEST_F(ControlTransferTest, SimpleLoopExit1) { byte code[] = { - kExprLoop, // @0 - kExprBr, // @1 - ARITY_0, // +1 - 1, // +1 - kExprEnd // @4 + kExprLoop, // @0 + kLocalVoid, // @1 + kExprBr, // @2 + 1, // @3 + kExprEnd // @4 }; - EXPECT_TARGETS({1, {4, 0, ControlTransfer::kPushVoid}}, // -- - {4, {1, 1, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({2, 3}); } TEST_F(ControlTransferTest, SimpleLoopExit2) { byte code[] = { - kExprLoop, // @0 - kExprNop, // @1 - kExprBr, // @2 - ARITY_0, // +1 - 1, // +1 - kExprEnd // @5 + kExprLoop, // @0 + kLocalVoid, // @1 + kExprNop, // @2 + kExprBr, // @3 + 1, // @4 + kExprEnd // @5 }; - EXPECT_TARGETS({2, {4, 1, ControlTransfer::kPopAndRepush}}, // -- - {5, {1, 2, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({3, 3}); } TEST_F(ControlTransferTest, BrTable0) { byte code[] = { kExprBlock, // @0 - kExprI8Const, // @1 - 0, // +1 - kExprBrTable, // @3 - ARITY_0, // +1 - 0, // +1 - U32_LE(0), // +4 - kExprEnd // @10 + kLocalVoid, // @1 + kExprI8Const, // @2 + 0, // @3 + kExprBrTable, // @4 + 0, // @5 + U32V_1(0), // @6 + kExprEnd // @7 }; - EXPECT_TARGETS({3, {8, 0, ControlTransfer::kPushVoid}}, // -- - {10, {1, 1, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({4, 4}); } -TEST_F(ControlTransferTest, BrTable1) { +TEST_F(ControlTransferTest, BrTable0_v1a) { byte code[] = { kExprBlock, // @0 - kExprI8Const, // @1 - 0, // +1 - kExprBrTable, // @3 - ARITY_0, // +1 - 1, // +1 - U32_LE(0), // +4 - U32_LE(0), // +4 - kExprEnd // @14 + kLocalVoid, // @1 + kExprI8Const, // @2 + 0, // @3 + kExprI8Const, // @4 + 0, // @5 + kExprBrTable, // @6 + 0, // @7 + U32V_1(0), // @8 + kExprEnd // @9 }; - EXPECT_TARGETS({3, {12, 0, ControlTransfer::kPushVoid}}, // -- - {4, {11, 0, ControlTransfer::kPushVoid}}, // -- - {14, {1, 1, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({6, 4}); } -TEST_F(ControlTransferTest, BrTable2) { +TEST_F(ControlTransferTest, BrTable0_v1b) { + byte code[] = { + kExprBlock, // @0 + kLocalVoid, // @1 + kExprI8Const, // @2 + 0, // @3 + kExprI8Const, // @4 + 0, // @5 + kExprBrTable, // @6 + 0, // @7 + U32V_1(0), // @8 + kExprEnd // @9 + }; + EXPECT_PC_DELTAS({6, 4}); +} + +TEST_F(ControlTransferTest, BrTable1) { byte code[] = { kExprBlock, // @0 - kExprBlock, // @1 + kLocalVoid, // @1 kExprI8Const, // @2 - 0, // +1 + 0, // @3 kExprBrTable, // @4 - ARITY_0, // +1 - 2, // +1 - U32_LE(0), // +4 - U32_LE(0), // +4 - U32_LE(1), // +4 - kExprEnd, // @19 - kExprEnd // @19 + 1, // @5 + U32V_1(0), // @6 + U32V_1(0), // @7 + kExprEnd // @8 + }; + EXPECT_PC_DELTAS({4, 5}, {5, 4}); +} + +TEST_F(ControlTransferTest, BrTable2) { + byte code[] = { + kExprBlock, // @0 + kLocalVoid, // @1 + kExprBlock, // @2 + kLocalVoid, // @3 + kExprI8Const, // @4 + 0, // @5 + kExprBrTable, // @6 + 2, // @7 + U32V_1(0), // @8 + U32V_1(0), // @9 + U32V_1(1), // @10 + kExprEnd, // @11 + kExprEnd // @12 }; - EXPECT_TARGETS({4, {16, 0, ControlTransfer::kPushVoid}}, // -- - {5, {15, 0, ControlTransfer::kPushVoid}}, // -- - {6, {15, 0, ControlTransfer::kPushVoid}}, // -- - {19, {1, 1, ControlTransfer::kPopAndRepush}}, // -- - {20, {1, 1, ControlTransfer::kPopAndRepush}}); + EXPECT_PC_DELTAS({6, 6}, {7, 5}, {8, 5}); } } // namespace wasm diff --git a/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc b/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc index 919ce8e234..cb452445bf 100644 --- a/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc +++ b/deps/v8/test/unittests/wasm/loop-assignment-analysis-unittest.cc @@ -6,7 +6,7 @@ #include "src/v8.h" -#include "test/cctest/wasm/test-signatures.h" +#include "test/common/wasm/test-signatures.h" #include "src/bit-vector.h" #include "src/objects.h" @@ -39,7 +39,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Empty0) { } TEST_F(WasmLoopAssignmentAnalyzerTest, Empty1) { - byte code[] = {kExprLoop, 0}; + byte code[] = {kExprLoop, kLocalVoid, 0}; for (int i = 0; i < 5; i++) { BitVector* assigned = Analyze(code, code + arraysize(code)); for (int j = 0; j < assigned->length(); j++) { @@ -60,6 +60,17 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, One) { } } +TEST_F(WasmLoopAssignmentAnalyzerTest, TeeOne) { + num_locals = 5; + for (int i = 0; i < 5; i++) { + byte code[] = {WASM_LOOP(WASM_TEE_LOCAL(i, WASM_ZERO))}; + BitVector* assigned = Analyze(code, code + arraysize(code)); + for (int j = 0; j < assigned->length(); j++) { + CHECK_EQ(j == i, assigned->Contains(j)); + } + } +} + TEST_F(WasmLoopAssignmentAnalyzerTest, OneBeyond) { num_locals = 5; for (int i = 0; i < 5; i++) { @@ -98,24 +109,10 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, NestedIf) { } } -static byte LEBByte(uint32_t val, byte which) { - byte b = (val >> (which * 7)) & 0x7F; - if (val >> ((which + 1) * 7)) b |= 0x80; - return b; -} - TEST_F(WasmLoopAssignmentAnalyzerTest, BigLocal) { num_locals = 65000; for (int i = 13; i < 65000; i = static_cast<int>(i * 1.5)) { - byte code[] = {kExprLoop, - 1, - kExprSetLocal, - LEBByte(i, 0), - LEBByte(i, 1), - LEBByte(i, 2), - 11, - 12, - 13}; + byte code[] = {WASM_LOOP(WASM_I8(11), kExprSetLocal, U32V_3(i))}; BitVector* assigned = Analyze(code, code + arraysize(code)); for (int j = 0; j < assigned->length(); j++) { @@ -172,7 +169,7 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) { WASM_STORE_MEM(MachineType::Float32(), WASM_ZERO, WASM_GET_LOCAL(kSum)), WASM_GET_LOCAL(kIter))}; - BitVector* assigned = Analyze(code + 1, code + arraysize(code)); + BitVector* assigned = Analyze(code + 2, code + arraysize(code)); for (int j = 0; j < assigned->length(); j++) { bool expected = j == kIter || j == kSum; CHECK_EQ(expected, assigned->Contains(j)); @@ -180,13 +177,21 @@ TEST_F(WasmLoopAssignmentAnalyzerTest, Loop2) { } TEST_F(WasmLoopAssignmentAnalyzerTest, Malformed) { - byte code[] = {kExprLoop, kExprF32Neg, kExprBrTable, 0x0e, 'h', 'e', - 'l', 'l', 'o', ',', ' ', 'w', - 'o', 'r', 'l', 'd', '!'}; + byte code[] = {kExprLoop, kLocalVoid, kExprF32Neg, kExprBrTable, 0x0e, 'h', + 'e', 'l', 'l', 'o', ',', ' ', + 'w', 'o', 'r', 'l', 'd', '!'}; BitVector* assigned = Analyze(code, code + arraysize(code)); CHECK_NULL(assigned); } +TEST_F(WasmLoopAssignmentAnalyzerTest, regress_642867) { + static const byte code[] = { + WASM_LOOP(WASM_ZERO, kExprSetLocal, 0xfa, 0xff, 0xff, 0xff, + 0x0f)}; // local index LEB128 0xfffffffa + // Just make sure that the analysis does not crash. + Analyze(code, code + arraysize(code)); +} + } // namespace wasm } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc index 5c9c47ba00..42798ca81b 100644 --- a/deps/v8/test/unittests/wasm/module-decoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/module-decoder-unittest.cc @@ -14,7 +14,16 @@ namespace v8 { namespace internal { namespace wasm { -#define EMPTY_FUNCTION(sig_index) 0, SIG_INDEX(sig_index), U16_LE(0) +#define WASM_INIT_EXPR_I32V_1(val) WASM_I32V_1(val), kExprEnd +#define WASM_INIT_EXPR_I32V_2(val) WASM_I32V_2(val), kExprEnd +#define WASM_INIT_EXPR_I32V_3(val) WASM_I32V_3(val), kExprEnd +#define WASM_INIT_EXPR_I32V_4(val) WASM_I32V_4(val), kExprEnd +#define WASM_INIT_EXPR_I32V_5(val) WASM_I32V_5(val), kExprEnd +#define WASM_INIT_EXPR_F32(val) WASM_F32(val), kExprEnd +#define WASM_INIT_EXPR_I64(val) WASM_I64(val), kExprEnd +#define WASM_INIT_EXPR_F64(val) WASM_F64(val), kExprEnd +#define WASM_INIT_EXPR_GLOBAL(index) WASM_GET_GLOBAL(index), kExprEnd + #define SIZEOF_EMPTY_FUNCTION ((size_t)5) #define EMPTY_BODY 0 #define SIZEOF_EMPTY_BODY ((size_t)1) @@ -23,64 +32,64 @@ namespace wasm { #define SIG_ENTRY_i_i SIG_ENTRY_x_x(kLocalI32, kLocalI32) -#define UNKNOWN_EMPTY_SECTION_NAME 1, '\0' -#define UNKNOWN_SECTION_NAME 4, 'l', 'u', 'l', 'z' +#define UNKNOWN_SECTION(size) 0, U32V_1(size + 5), 4, 'l', 'u', 'l', 'z' -#define SECTION(NAME, EXTRA_SIZE) WASM_SECTION_##NAME, U32V_1(EXTRA_SIZE) +#define SECTION(name, size) k##name##SectionCode, U32V_1(size) #define SIGNATURES_SECTION(count, ...) \ - SECTION(SIGNATURES, 1 + 3 * (count)), U32V_1(count), __VA_ARGS__ + SECTION(Type, 1 + 3 * (count)), U32V_1(count), __VA_ARGS__ #define FUNCTION_SIGNATURES_SECTION(count, ...) \ - SECTION(FUNCTION_SIGNATURES, 1 + (count)), U32V_1(count), __VA_ARGS__ + SECTION(Function, 1 + (count)), U32V_1(count), __VA_ARGS__ #define FOO_STRING 3, 'f', 'o', 'o' #define NO_LOCAL_NAMES 0 -#define EMPTY_SIGNATURES_SECTION SECTION(SIGNATURES, 1), 0 -#define EMPTY_FUNCTION_SIGNATURES_SECTION SECTION(FUNCTION_SIGNATURES, 1), 0 -#define EMPTY_FUNCTION_BODIES_SECTION SECTION(FUNCTION_BODIES, 1), 0 -#define EMPTY_NAMES_SECTION SECTION(NAMES, 1), 0 +#define EMPTY_SIGNATURES_SECTION SECTION(Type, 1), 0 +#define EMPTY_FUNCTION_SIGNATURES_SECTION SECTION(Function, 1), 0 +#define EMPTY_FUNCTION_BODIES_SECTION SECTION(Code, 1), 0 +#define SECTION_NAMES(size) \ + kUnknownSectionCode, U32V_1(size + 5), 4, 'n', 'a', 'm', 'e' +#define EMPTY_NAMES_SECTION SECTION_NAMES(1), 0 #define X1(...) __VA_ARGS__ #define X2(...) __VA_ARGS__, __VA_ARGS__ #define X3(...) __VA_ARGS__, __VA_ARGS__, __VA_ARGS__ #define X4(...) __VA_ARGS__, __VA_ARGS__, __VA_ARGS__, __VA_ARGS__ -#define ONE_EMPTY_FUNCTION WASM_SECTION_FUNCTION_SIGNATURES, 1 + 1 * 1, 1, X1(0) +#define ONE_EMPTY_FUNCTION SECTION(Function, 1 + 1 * 1), 1, X1(0) -#define TWO_EMPTY_FUNCTIONS \ - WASM_SECTION_FUNCTION_SIGNATURES, 1 + 2 * 1, 2, X2(0) +#define TWO_EMPTY_FUNCTIONS SECTION(Function, 1 + 2 * 1), 2, X2(0) -#define THREE_EMPTY_FUNCTIONS \ - WASM_SECTION_FUNCTION_SIGNATURES, 1 + 3 * 1, 3, X3(0) +#define THREE_EMPTY_FUNCTIONS SECTION(Function, 1 + 3 * 1), 3, X3(0) -#define FOUR_EMPTY_FUNCTIONS \ - WASM_SECTION_FUNCTION_SIGNATURES, 1 + 4 * 1, 4, X4(0) +#define FOUR_EMPTY_FUNCTIONS SECTION(Function, 1 + 4 * 1), 4, X4(0) -#define ONE_EMPTY_BODY \ - WASM_SECTION_FUNCTION_BODIES, 1 + 1 * (1 + SIZEOF_EMPTY_BODY), 1, \ - X1(SIZEOF_EMPTY_BODY, EMPTY_BODY) +#define ONE_EMPTY_BODY \ + SECTION(Code, 1 + 1 * (1 + SIZEOF_EMPTY_BODY)) \ + , 1, X1(SIZEOF_EMPTY_BODY, EMPTY_BODY) -#define TWO_EMPTY_BODIES \ - WASM_SECTION_FUNCTION_BODIES, 1 + 2 * (1 + SIZEOF_EMPTY_BODY), 2, \ - X2(SIZEOF_EMPTY_BODY, EMPTY_BODY) +#define TWO_EMPTY_BODIES \ + SECTION(Code, 1 + 2 * (1 + SIZEOF_EMPTY_BODY)) \ + , 2, X2(SIZEOF_EMPTY_BODY, EMPTY_BODY) -#define THREE_EMPTY_BODIES \ - WASM_SECTION_FUNCTION_BODIES, 1 + 3 * (1 + SIZEOF_EMPTY_BODY), 3, \ - X3(SIZEOF_EMPTY_BODY, EMPTY_BODY) +#define THREE_EMPTY_BODIES \ + SECTION(Code, 1 + 3 * (1 + SIZEOF_EMPTY_BODY)) \ + , 3, X3(SIZEOF_EMPTY_BODY, EMPTY_BODY) -#define FOUR_EMPTY_BODIES \ - WASM_SECTION_FUNCTION_BODIES, 1 + 4 * (1 + SIZEOF_EMPTY_BODY), 4, \ - X4(SIZEOF_EMPTY_BODY, EMPTY_BODY) +#define FOUR_EMPTY_BODIES \ + SECTION(Code, 1 + 4 * (1 + SIZEOF_EMPTY_BODY)) \ + , 4, X4(SIZEOF_EMPTY_BODY, EMPTY_BODY) #define SIGNATURES_SECTION_VOID_VOID \ - SECTION(SIGNATURES, 1 + SIZEOF_SIG_ENTRY_v_v), 1, SIG_ENTRY_v_v + SECTION(Type, 1 + SIZEOF_SIG_ENTRY_v_v), 1, SIG_ENTRY_v_v + +#define LINEAR_MEMORY_INDEX_0 0 -#define EXPECT_VERIFIES(data) \ - do { \ - ModuleResult result = DecodeModule(data, data + arraysize(data)); \ - EXPECT_TRUE(result.ok()); \ - if (result.val) delete result.val; \ +#define EXPECT_VERIFIES(data) \ + do { \ + ModuleResult result = DecodeModule(data, data + sizeof(data)); \ + EXPECT_TRUE(result.ok()); \ + if (result.val) delete result.val; \ } while (false) #define EXPECT_FAILURE_LEN(data, length) \ @@ -149,8 +158,7 @@ class WasmModuleVerifyTest : public TestWithIsolateAndZone { TEST_F(WasmModuleVerifyTest, WrongMagic) { for (uint32_t x = 1; x; x <<= 1) { - const byte data[] = {U32_LE(kWasmMagic ^ x), U32_LE(kWasmVersion), - SECTION(END, 0)}; + const byte data[] = {U32_LE(kWasmMagic ^ x), U32_LE(kWasmVersion)}; ModuleResult result = DecodeModuleNoHeader(data, data + sizeof(data)); EXPECT_FALSE(result.ok()); if (result.val) delete result.val; @@ -159,8 +167,7 @@ TEST_F(WasmModuleVerifyTest, WrongMagic) { TEST_F(WasmModuleVerifyTest, WrongVersion) { for (uint32_t x = 1; x; x <<= 1) { - const byte data[] = {U32_LE(kWasmMagic), U32_LE(kWasmVersion ^ x), - SECTION(END, 0)}; + const byte data[] = {U32_LE(kWasmMagic), U32_LE(kWasmVersion ^ x)}; ModuleResult result = DecodeModuleNoHeader(data, data + sizeof(data)); EXPECT_FALSE(result.ok()); if (result.val) delete result.val; @@ -168,23 +175,23 @@ TEST_F(WasmModuleVerifyTest, WrongVersion) { } TEST_F(WasmModuleVerifyTest, DecodeEmpty) { - static const byte data[] = {SECTION(END, 0)}; - EXPECT_VERIFIES(data); + ModuleResult result = DecodeModule(nullptr, 0); + EXPECT_TRUE(result.ok()); + if (result.val) delete result.val; } TEST_F(WasmModuleVerifyTest, OneGlobal) { static const byte data[] = { - SECTION(GLOBALS, 5), // -- + SECTION(Global, 6), // -- 1, - NAME_LENGTH(1), - 'g', // name - kLocalI32, // local type - 0, // exported + kLocalI32, // local type + 0, // immutable + WASM_INIT_EXPR_I32V_1(13) // init }; { // Should decode to exactly one global. - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); EXPECT_EQ(1, result.val->globals.size()); EXPECT_EQ(0, result.val->functions.size()); @@ -192,10 +199,11 @@ TEST_F(WasmModuleVerifyTest, OneGlobal) { const WasmGlobal* global = &result.val->globals.back(); - EXPECT_EQ(1, global->name_length); EXPECT_EQ(kAstI32, global->type); EXPECT_EQ(0, global->offset); - EXPECT_FALSE(global->exported); + EXPECT_FALSE(global->mutability); + EXPECT_EQ(WasmInitExpr::kI32Const, global->init.kind); + EXPECT_EQ(13, global->init.val.i32_const); if (result.val) delete result.val; } @@ -205,25 +213,38 @@ TEST_F(WasmModuleVerifyTest, OneGlobal) { TEST_F(WasmModuleVerifyTest, Global_invalid_type) { static const byte data[] = { - SECTION(GLOBALS, 5), // -- + SECTION(Global, 6), // -- 1, - NAME_LENGTH(1), - 'g', // name - 64, // invalid memory type - 0, // exported + 64, // invalid memory type + 1, // mutable + WASM_INIT_EXPR_I32V_1(33), // init + }; + + ModuleResult result = DecodeModule(data, data + sizeof(data)); + EXPECT_FALSE(result.ok()); + if (result.val) delete result.val; +} + +TEST_F(WasmModuleVerifyTest, Global_invalid_type2) { + static const byte data[] = { + SECTION(Global, 6), // -- + 1, + kLocalVoid, // invalid memory type + 1, // mutable + WASM_INIT_EXPR_I32V_1(33), // init }; - ModuleResult result = DecodeModuleNoHeader(data, data + sizeof(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_FALSE(result.ok()); if (result.val) delete result.val; } TEST_F(WasmModuleVerifyTest, ZeroGlobals) { static const byte data[] = { - SECTION(GLOBALS, 1), // -- - 0, // declare 0 globals + SECTION(Global, 1), // -- + 0, // declare 0 globals }; - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); if (result.val) delete result.val; } @@ -244,15 +265,15 @@ static void AppendUint32v(std::vector<byte>& buffer, uint32_t val) { TEST_F(WasmModuleVerifyTest, NGlobals) { static const byte data[] = { - NO_NAME, // name length - kLocalF32, // memory type - 0, // exported + kLocalF32, // memory type + 0, // immutable + WASM_INIT_EXPR_F32(7.7), // init }; for (uint32_t i = 0; i < 1000000; i = i * 13 + 1) { std::vector<byte> buffer; size_t size = SizeOfVarInt(i) + i * sizeof(data); - const byte globals[] = {WASM_SECTION_GLOBALS, U32V_5(size)}; + const byte globals[] = {kGlobalSectionCode, U32V_5(size)}; for (size_t g = 0; g != sizeof(globals); ++g) { buffer.push_back(globals[g]); } @@ -267,62 +288,48 @@ TEST_F(WasmModuleVerifyTest, NGlobals) { } } -TEST_F(WasmModuleVerifyTest, GlobalWithInvalidNameOffset) { - static const byte data[] = { - SECTION(GLOBALS, 7), - 1, // declare one global - NO_NAME, // name offset - 33, // memory type - 0, // exported - }; - - EXPECT_FAILURE(data); -} - TEST_F(WasmModuleVerifyTest, GlobalWithInvalidMemoryType) { - static const byte data[] = { - SECTION(GLOBALS, 7), - 1, // declare one global - NO_NAME, // name offset - 33, // memory type - 0, // exported - }; + static const byte data[] = {SECTION(Global, 7), + 33, // memory type + 0, // exported + WASM_INIT_EXPR_I32V_1(1)}; EXPECT_FAILURE(data); } TEST_F(WasmModuleVerifyTest, TwoGlobals) { static const byte data[] = { - SECTION(GLOBALS, 7), + SECTION(Global, 21), 2, - NO_NAME, // #0: name length kLocalF32, // type - 0, // exported - NO_NAME, // #1: name length + 0, // immutable + WASM_INIT_EXPR_F32(22.0), kLocalF64, // type - 1, // exported + 1, // mutable + WASM_INIT_EXPR_F64(23.0), }; { // Should decode to exactly two globals. - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); EXPECT_EQ(2, result.val->globals.size()); EXPECT_EQ(0, result.val->functions.size()); EXPECT_EQ(0, result.val->data_segments.size()); const WasmGlobal* g0 = &result.val->globals[0]; - const WasmGlobal* g1 = &result.val->globals[1]; - EXPECT_EQ(0, g0->name_length); EXPECT_EQ(kAstF32, g0->type); EXPECT_EQ(0, g0->offset); - EXPECT_FALSE(g0->exported); + EXPECT_FALSE(g0->mutability); + EXPECT_EQ(WasmInitExpr::kF32Const, g0->init.kind); + + const WasmGlobal* g1 = &result.val->globals[1]; - EXPECT_EQ(0, g1->name_length); EXPECT_EQ(kAstF64, g1->type); EXPECT_EQ(8, g1->offset); - EXPECT_TRUE(g1->exported); + EXPECT_TRUE(g1->mutability); + EXPECT_EQ(WasmInitExpr::kF64Const, g1->init.kind); if (result.val) delete result.val; } @@ -337,23 +344,23 @@ TEST_F(WasmModuleVerifyTest, OneSignature) { } { - static const byte data[] = {SECTION(SIGNATURES, 1 + SIZEOF_SIG_ENTRY_x_x), - 1, SIG_ENTRY_i_i}; + static const byte data[] = {SECTION(Type, 1 + SIZEOF_SIG_ENTRY_x_x), 1, + SIG_ENTRY_i_i}; EXPECT_VERIFIES(data); } } TEST_F(WasmModuleVerifyTest, MultipleSignatures) { static const byte data[] = { - SECTION(SIGNATURES, 1 + SIZEOF_SIG_ENTRY_v_v + SIZEOF_SIG_ENTRY_x_x + - SIZEOF_SIG_ENTRY_x_xx), // -- + SECTION(Type, 1 + SIZEOF_SIG_ENTRY_v_v + SIZEOF_SIG_ENTRY_x_x + + SIZEOF_SIG_ENTRY_x_xx), // -- 3, // -- SIG_ENTRY_v_v, // void -> void SIG_ENTRY_x_x(kLocalI32, kLocalF32), // f32 -> i32 SIG_ENTRY_x_xx(kLocalI32, kLocalF64, kLocalF64), // f64,f64 -> i32 }; - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); EXPECT_EQ(3, result.val->signatures.size()); if (result.val->signatures.size() == 3) { @@ -371,16 +378,18 @@ TEST_F(WasmModuleVerifyTest, MultipleSignatures) { } TEST_F(WasmModuleVerifyTest, OneDataSegment) { - const byte kDataSegmentSourceOffset = 30; + const byte kDataSegmentSourceOffset = 24; const byte data[] = { - SECTION(MEMORY, 3), + SECTION(Memory, 4), + ENTRY_COUNT(1), + kResizableMaximumFlag, 28, 28, - 1, - SECTION(DATA_SEGMENTS, 8), - 1, - U32V_3(0x9bbaa), // dest addr - U32V_1(3), // source size + SECTION(Data, 11), + ENTRY_COUNT(1), + LINEAR_MEMORY_INDEX_0, + WASM_INIT_EXPR_I32V_3(0x9bbaa), // dest addr + U32V_1(3), // source size 'a', 'b', 'c' // data bytes @@ -388,7 +397,7 @@ TEST_F(WasmModuleVerifyTest, OneDataSegment) { { EXPECT_VERIFIES(data); - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); EXPECT_EQ(0, result.val->globals.size()); EXPECT_EQ(0, result.val->functions.size()); @@ -396,36 +405,39 @@ TEST_F(WasmModuleVerifyTest, OneDataSegment) { const WasmDataSegment* segment = &result.val->data_segments.back(); - EXPECT_EQ(0x9bbaa, segment->dest_addr); + EXPECT_EQ(WasmInitExpr::kI32Const, segment->dest_addr.kind); + EXPECT_EQ(0x9bbaa, segment->dest_addr.val.i32_const); EXPECT_EQ(kDataSegmentSourceOffset, segment->source_offset); EXPECT_EQ(3, segment->source_size); - EXPECT_TRUE(segment->init); if (result.val) delete result.val; } - EXPECT_OFF_END_FAILURE(data, 13, sizeof(data)); + EXPECT_OFF_END_FAILURE(data, 14, sizeof(data)); } TEST_F(WasmModuleVerifyTest, TwoDataSegments) { - const byte kDataSegment0SourceOffset = 30; - const byte kDataSegment1SourceOffset = 30 + 8; + const byte kDataSegment0SourceOffset = 24; + const byte kDataSegment1SourceOffset = kDataSegment0SourceOffset + 11; const byte data[] = { - SECTION(MEMORY, 3), + SECTION(Memory, 4), + ENTRY_COUNT(1), + kResizableMaximumFlag, 28, 28, - 1, - SECTION(DATA_SEGMENTS, 23), - 2, // segment count - U32V_3(0x7ffee), // #0: dest addr - U32V_1(4), // source size + SECTION(Data, 29), + ENTRY_COUNT(2), // segment count + LINEAR_MEMORY_INDEX_0, + WASM_INIT_EXPR_I32V_3(0x7ffee), // #0: dest addr + U32V_1(4), // source size 1, 2, 3, - 4, // data bytes - U32V_3(0x6ddcc), // #1: dest addr - U32V_1(10), // source size + 4, // data bytes + LINEAR_MEMORY_INDEX_0, + WASM_INIT_EXPR_I32V_3(0x6ddcc), // #1: dest addr + U32V_1(10), // source size 1, 2, 3, @@ -439,7 +451,7 @@ TEST_F(WasmModuleVerifyTest, TwoDataSegments) { }; { - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); EXPECT_EQ(0, result.val->globals.size()); EXPECT_EQ(0, result.val->functions.size()); @@ -448,61 +460,79 @@ TEST_F(WasmModuleVerifyTest, TwoDataSegments) { const WasmDataSegment* s0 = &result.val->data_segments[0]; const WasmDataSegment* s1 = &result.val->data_segments[1]; - EXPECT_EQ(0x7ffee, s0->dest_addr); + EXPECT_EQ(WasmInitExpr::kI32Const, s0->dest_addr.kind); + EXPECT_EQ(0x7ffee, s0->dest_addr.val.i32_const); EXPECT_EQ(kDataSegment0SourceOffset, s0->source_offset); EXPECT_EQ(4, s0->source_size); - EXPECT_TRUE(s0->init); - EXPECT_EQ(0x6ddcc, s1->dest_addr); + EXPECT_EQ(WasmInitExpr::kI32Const, s1->dest_addr.kind); + EXPECT_EQ(0x6ddcc, s1->dest_addr.val.i32_const); EXPECT_EQ(kDataSegment1SourceOffset, s1->source_offset); EXPECT_EQ(10, s1->source_size); - EXPECT_TRUE(s1->init); if (result.val) delete result.val; } - EXPECT_OFF_END_FAILURE(data, 13, sizeof(data)); -} - -TEST_F(WasmModuleVerifyTest, DataSegmentWithInvalidDest) { - const int source_size = 3; - - for (byte mem_pages = 1; mem_pages < 16; mem_pages++) { - int mem_size = mem_pages * 0x10000; // 64k pages. - - for (int dest_addr = mem_size - source_size; - dest_addr < mem_size + source_size; dest_addr++) { - byte data[] = {SECTION(MEMORY, 3), - mem_pages, - mem_pages, - 1, - SECTION(DATA_SEGMENTS, 8), - 1, - U32V_3(dest_addr), - U32V_1(source_size), - 'a', - 'b', - 'c'}; - - if (dest_addr <= (mem_size - source_size)) { - EXPECT_VERIFIES(data); - } else { - EXPECT_FAILURE(data); - } - } - } + EXPECT_OFF_END_FAILURE(data, 14, sizeof(data)); +} + +TEST_F(WasmModuleVerifyTest, DataSegment_wrong_init_type) { + const byte data[] = { + SECTION(Memory, 4), + ENTRY_COUNT(1), + kResizableMaximumFlag, + 28, + 28, + SECTION(Data, 11), + ENTRY_COUNT(1), + LINEAR_MEMORY_INDEX_0, + WASM_INIT_EXPR_F64(9.9), // dest addr + U32V_1(3), // source size + 'a', + 'b', + 'c' // data bytes + }; + + EXPECT_FAILURE(data); } TEST_F(WasmModuleVerifyTest, OneIndirectFunction) { static const byte data[] = { - // sig#0 ------------------------------------------------------- + // sig#0 --------------------------------------------------------------- SIGNATURES_SECTION_VOID_VOID, - // funcs ------------------------------------------------------ + // funcs --------------------------------------------------------------- ONE_EMPTY_FUNCTION, - // indirect table ---------------------------------------------- - SECTION(FUNCTION_TABLE, 2), 1, U32V_1(0)}; + // table declaration --------------------------------------------------- + SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeForm, 0, 1}; - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); + EXPECT_OK(result); + if (result.ok()) { + EXPECT_EQ(1, result.val->signatures.size()); + EXPECT_EQ(1, result.val->functions.size()); + EXPECT_EQ(1, result.val->function_tables.size()); + EXPECT_EQ(1, result.val->function_tables[0].values.size()); + EXPECT_EQ(-1, result.val->function_tables[0].values[0]); + } + if (result.val) delete result.val; +} + +TEST_F(WasmModuleVerifyTest, OneIndirectFunction_one_entry) { + static const byte data[] = { + // sig#0 --------------------------------------------------------------- + SIGNATURES_SECTION_VOID_VOID, + // funcs --------------------------------------------------------------- + ONE_EMPTY_FUNCTION, + // table declaration --------------------------------------------------- + SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeForm, 0, 1, + // elements ------------------------------------------------------------ + SECTION(Element, 7), + 1, // entry count + TABLE_INDEX(0), WASM_INIT_EXPR_I32V_1(0), + 1, // elements count + FUNC_INDEX(0)}; + + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); if (result.ok()) { EXPECT_EQ(1, result.val->signatures.size()); @@ -517,25 +547,30 @@ TEST_F(WasmModuleVerifyTest, OneIndirectFunction) { TEST_F(WasmModuleVerifyTest, MultipleIndirectFunctions) { static const byte data[] = { // sig#0 ------------------------------------------------------- - SECTION(SIGNATURES, 1 + SIZEOF_SIG_ENTRY_v_v + SIZEOF_SIG_ENTRY_v_x), + SECTION(Type, 1 + SIZEOF_SIG_ENTRY_v_v + SIZEOF_SIG_ENTRY_v_x), 2, // -- SIG_ENTRY_v_v, // void -> void SIG_ENTRY_v_x(kLocalI32), // void -> i32 // funcs ------------------------------------------------------ FOUR_EMPTY_FUNCTIONS, - // indirect table ---------------------------------------------- - SECTION(FUNCTION_TABLE, 9), 8, - U32V_1(0), // -- - U32V_1(1), // -- - U32V_1(2), // -- - U32V_1(3), // -- - U32V_1(0), // -- - U32V_1(1), // -- - U32V_1(2), // -- - U32V_1(3), // -- + // table declaration ------------------------------------------- + SECTION(Table, 4), ENTRY_COUNT(1), kWasmAnyFunctionTypeForm, 0, 8, + // table elements ---------------------------------------------- + SECTION(Element, 14), + 1, // entry count + TABLE_INDEX(0), WASM_INIT_EXPR_I32V_1(0), + 8, // elements count + FUNC_INDEX(0), // -- + FUNC_INDEX(1), // -- + FUNC_INDEX(2), // -- + FUNC_INDEX(3), // -- + FUNC_INDEX(0), // -- + FUNC_INDEX(1), // -- + FUNC_INDEX(2), // -- + FUNC_INDEX(3), // -- FOUR_EMPTY_BODIES}; - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); if (result.ok()) { EXPECT_EQ(2, result.val->signatures.size()); @@ -554,7 +589,7 @@ TEST_F(WasmModuleVerifyTest, IndirectFunctionNoFunctions) { // sig#0 ------------------------------------------------------- SIGNATURES_SECTION_VOID_VOID, // indirect table ---------------------------------------------- - SECTION(FUNCTION_TABLE, 3), 1, 0, 0, + SECTION(Table, 4), ENTRY_COUNT(1), 1, 0, 0, }; EXPECT_FAILURE(data); @@ -567,7 +602,7 @@ TEST_F(WasmModuleVerifyTest, IndirectFunctionInvalidIndex) { // functions --------------------------------------------------- ONE_EMPTY_FUNCTION, // indirect table ---------------------------------------------- - SECTION(FUNCTION_TABLE, 3), 1, 1, 0, + SECTION(Table, 4), ENTRY_COUNT(1), 1, 1, 0, }; EXPECT_FAILURE(data); @@ -577,10 +612,10 @@ class WasmSignatureDecodeTest : public TestWithZone {}; TEST_F(WasmSignatureDecodeTest, Ok_v_v) { static const byte data[] = {SIG_ENTRY_v_v}; - base::AccountingAllocator allocator; + v8::internal::AccountingAllocator allocator; Zone zone(&allocator); FunctionSig* sig = - DecodeWasmSignatureForTesting(&zone, data, data + arraysize(data)); + DecodeWasmSignatureForTesting(&zone, data, data + sizeof(data)); EXPECT_TRUE(sig != nullptr); EXPECT_EQ(0, sig->parameter_count()); @@ -592,7 +627,7 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_v) { LocalTypePair ret_type = kLocalTypes[i]; const byte data[] = {SIG_ENTRY_x(ret_type.code)}; FunctionSig* sig = - DecodeWasmSignatureForTesting(zone(), data, data + arraysize(data)); + DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data)); EXPECT_TRUE(sig != nullptr); EXPECT_EQ(0, sig->parameter_count()); @@ -606,7 +641,7 @@ TEST_F(WasmSignatureDecodeTest, Ok_v_t) { LocalTypePair param_type = kLocalTypes[i]; const byte data[] = {SIG_ENTRY_v_x(param_type.code)}; FunctionSig* sig = - DecodeWasmSignatureForTesting(zone(), data, data + arraysize(data)); + DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data)); EXPECT_TRUE(sig != nullptr); EXPECT_EQ(1, sig->parameter_count()); @@ -622,7 +657,7 @@ TEST_F(WasmSignatureDecodeTest, Ok_t_t) { LocalTypePair param_type = kLocalTypes[j]; const byte data[] = {SIG_ENTRY_x_x(ret_type.code, param_type.code)}; FunctionSig* sig = - DecodeWasmSignatureForTesting(zone(), data, data + arraysize(data)); + DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data)); EXPECT_TRUE(sig != nullptr); EXPECT_EQ(1, sig->parameter_count()); @@ -641,7 +676,7 @@ TEST_F(WasmSignatureDecodeTest, Ok_i_tt) { const byte data[] = { SIG_ENTRY_x_xx(kLocalI32, p0_type.code, p1_type.code)}; FunctionSig* sig = - DecodeWasmSignatureForTesting(zone(), data, data + arraysize(data)); + DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data)); EXPECT_TRUE(sig != nullptr); EXPECT_EQ(2, sig->parameter_count()); @@ -672,7 +707,7 @@ TEST_F(WasmSignatureDecodeTest, Fail_invalid_type) { byte data[] = {SIG_ENTRY_x_xx(kLocalI32, kLocalI32, kLocalI32)}; data[i] = kInvalidType; FunctionSig* sig = - DecodeWasmSignatureForTesting(zone(), data, data + arraysize(data)); + DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data)); EXPECT_EQ(nullptr, sig); } } @@ -680,21 +715,21 @@ TEST_F(WasmSignatureDecodeTest, Fail_invalid_type) { TEST_F(WasmSignatureDecodeTest, Fail_invalid_ret_type1) { static const byte data[] = {SIG_ENTRY_x_x(kLocalVoid, kLocalI32)}; FunctionSig* sig = - DecodeWasmSignatureForTesting(zone(), data, data + arraysize(data)); + DecodeWasmSignatureForTesting(zone(), 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 + arraysize(data)); + DecodeWasmSignatureForTesting(zone(), 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 + arraysize(data)); + DecodeWasmSignatureForTesting(zone(), data, data + sizeof(data)); EXPECT_EQ(nullptr, sig); } @@ -715,8 +750,8 @@ TEST_F(WasmFunctionVerifyTest, Ok_v_v_empty) { kExprNop // body }; - FunctionResult result = DecodeWasmFunction(isolate(), zone(), nullptr, data, - data + arraysize(data)); + FunctionResult result = + DecodeWasmFunction(isolate(), zone(), nullptr, data, data + sizeof(data)); EXPECT_OK(result); if (result.val && result.ok()) { @@ -725,7 +760,7 @@ TEST_F(WasmFunctionVerifyTest, Ok_v_v_empty) { EXPECT_EQ(0, function->sig->return_count()); EXPECT_EQ(0, function->name_offset); EXPECT_EQ(SIZEOF_SIG_ENTRY_v_v, function->code_start_offset); - EXPECT_EQ(arraysize(data), function->code_end_offset); + EXPECT_EQ(sizeof(data), function->code_end_offset); // TODO(titzer): verify encoding of local declarations } @@ -739,6 +774,7 @@ TEST_F(WasmModuleVerifyTest, SectionWithoutNameLength) { TEST_F(WasmModuleVerifyTest, TheLoneliestOfValidModulesTheTrulyEmptyOne) { const byte data[] = { + 0, // unknown section code. 0, // Empty section name. // No section name, no content, nothing but sadness. 0, // No section content. @@ -748,15 +784,14 @@ TEST_F(WasmModuleVerifyTest, TheLoneliestOfValidModulesTheTrulyEmptyOne) { TEST_F(WasmModuleVerifyTest, OnlyUnknownSectionEmpty) { const byte data[] = { - UNKNOWN_SECTION_NAME, 0, + UNKNOWN_SECTION(0), }; EXPECT_VERIFIES(data); } TEST_F(WasmModuleVerifyTest, OnlyUnknownSectionNonEmpty) { const byte data[] = { - UNKNOWN_SECTION_NAME, - 5, // section size + UNKNOWN_SECTION(5), 0xff, 0xff, 0xff, @@ -771,9 +806,7 @@ TEST_F(WasmModuleVerifyTest, SignatureFollowedByEmptyUnknownSection) { // signatures SIGNATURES_SECTION_VOID_VOID, // ----------------------------------------------------------- - UNKNOWN_SECTION_NAME, - 0 // empty section - }; + UNKNOWN_SECTION(0)}; EXPECT_VERIFIES(data); } @@ -782,29 +815,14 @@ TEST_F(WasmModuleVerifyTest, SignatureFollowedByUnknownSection) { // signatures SIGNATURES_SECTION_VOID_VOID, // ----------------------------------------------------------- - UNKNOWN_SECTION_NAME, - 5, // section size - 0xff, 0xff, 0xff, 0xff, 0xff, - }; - EXPECT_VERIFIES(data); -} - -TEST_F(WasmModuleVerifyTest, SignatureFollowedByUnknownSectionWithLongLEB) { - const byte data[] = { - // signatures - SIGNATURES_SECTION_VOID_VOID, - // ----------------------------------------------------------- - UNKNOWN_SECTION_NAME, 0x81, 0x80, 0x80, 0x80, - 0x00, // section size: 1 but in a 5-byte LEB - 0, + UNKNOWN_SECTION(5), 0xff, 0xff, 0xff, 0xff, 0xff, }; EXPECT_VERIFIES(data); } TEST_F(WasmModuleVerifyTest, UnknownSectionOverflow) { static const byte data[] = { - UNKNOWN_EMPTY_SECTION_NAME, - 9, // section size + UNKNOWN_SECTION(9), 1, 2, 3, @@ -821,49 +839,26 @@ TEST_F(WasmModuleVerifyTest, UnknownSectionOverflow) { TEST_F(WasmModuleVerifyTest, UnknownSectionUnderflow) { static const byte data[] = { - UNKNOWN_EMPTY_SECTION_NAME, - 0xff, - 0xff, - 0xff, - 0xff, - 0x0f, // Section size LEB128 0xffffffff - 1, - 2, - 3, - 4, // 4 byte section - }; - EXPECT_FAILURE(data); -} - -TEST_F(WasmModuleVerifyTest, UnknownSectionLoop) { - // Would infinite loop decoding if wrapping and allowed. - static const byte data[] = { - UNKNOWN_EMPTY_SECTION_NAME, + UNKNOWN_SECTION(333), 1, 2, 3, 4, // 4 byte section - 0xfa, - 0xff, - 0xff, - 0xff, - 0x0f, // Section size LEB128 0xfffffffa }; EXPECT_FAILURE(data); } TEST_F(WasmModuleVerifyTest, UnknownSectionSkipped) { static const byte data[] = { - UNKNOWN_EMPTY_SECTION_NAME, - 1, // section size + UNKNOWN_SECTION(1), 0, // one byte section - SECTION(GLOBALS, 4), + SECTION(Global, 6), 1, - 0, // name length - kLocalI32, // memory type - 0, // exported + kLocalI32, // memory type + 0, // exported + WASM_INIT_EXPR_I32V_1(33), // init }; - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); EXPECT_EQ(1, result.val->globals.size()); @@ -872,42 +867,41 @@ TEST_F(WasmModuleVerifyTest, UnknownSectionSkipped) { const WasmGlobal* global = &result.val->globals.back(); - EXPECT_EQ(0, global->name_length); EXPECT_EQ(kAstI32, global->type); EXPECT_EQ(0, global->offset); - EXPECT_FALSE(global->exported); if (result.val) delete result.val; } TEST_F(WasmModuleVerifyTest, ImportTable_empty) { - static const byte data[] = {SECTION(SIGNATURES, 1), 0, - SECTION(IMPORT_TABLE, 1), 0}; + static const byte data[] = {SECTION(Type, 1), 0, SECTION(Import, 1), 0}; EXPECT_VERIFIES(data); } TEST_F(WasmModuleVerifyTest, ImportTable_nosigs1) { - static const byte data[] = {SECTION(IMPORT_TABLE, 1), 0}; + static const byte data[] = {SECTION(Import, 1), 0}; EXPECT_VERIFIES(data); } TEST_F(WasmModuleVerifyTest, ImportTable_nosigs2) { static const byte data[] = { - SECTION(IMPORT_TABLE, 6), 1, // sig table - IMPORT_SIG_INDEX(0), // sig index - NAME_LENGTH(1), 'm', // module name - NAME_LENGTH(1), 'f', // function name + SECTION(Import, 6), 1, // sig table + NAME_LENGTH(1), 'm', // module name + NAME_LENGTH(1), 'f', // function name + kExternalFunction, // import kind + IMPORT_SIG_INDEX(0), // sig index }; EXPECT_FAILURE(data); } TEST_F(WasmModuleVerifyTest, ImportTable_invalid_sig) { static const byte data[] = { - SECTION(SIGNATURES, 1), 0, // -- - SECTION(IMPORT_TABLE, 6), 1, // -- - IMPORT_SIG_INDEX(0), // sig index - NAME_LENGTH(1), 'm', // module name - NAME_LENGTH(1), 'f', // function name + SECTION(Type, 1), 0, // -- + SECTION(Import, 6), 1, // -- + NAME_LENGTH(1), 'm', // module name + NAME_LENGTH(1), 'f', // function name + kExternalFunction, // import kind + IMPORT_SIG_INDEX(0), // sig index }; EXPECT_FAILURE(data); } @@ -916,13 +910,14 @@ TEST_F(WasmModuleVerifyTest, ImportTable_one_sig) { static const byte data[] = { // signatures SIGNATURES_SECTION_VOID_VOID, - SECTION(IMPORT_TABLE, 6), - 1, // -- - IMPORT_SIG_INDEX(0), // sig index + SECTION(Import, 7), + 1, // -- NAME_LENGTH(1), 'm', // module name NAME_LENGTH(1), - 'f', // function name + 'f', // function name + kExternalFunction, // import kind + IMPORT_SIG_INDEX(0), // sig index }; EXPECT_VERIFIES(data); } @@ -930,13 +925,14 @@ TEST_F(WasmModuleVerifyTest, ImportTable_one_sig) { TEST_F(WasmModuleVerifyTest, ImportTable_invalid_module) { static const byte data[] = { // signatures - SIGNATURES_SECTION_VOID_VOID, - SECTION(IMPORT_TABLE, 6), - 1, // -- - IMPORT_SIG_INDEX(0), // sig index - NO_NAME, // module name - NAME_LENGTH(1), - 'f' // function name + SIGNATURES_SECTION_VOID_VOID, // -- + SECTION(Import, 7), // -- + 1, // -- + NO_NAME, // module name + NAME_LENGTH(1), // -- + 'f', // function name + kExternalFunction, // import kind + IMPORT_SIG_INDEX(0), // sig index }; EXPECT_FAILURE(data); } @@ -945,26 +941,27 @@ TEST_F(WasmModuleVerifyTest, ImportTable_off_end) { static const byte data[] = { // signatures SIGNATURES_SECTION_VOID_VOID, - SECTION(IMPORT_TABLE, 6), + SECTION(Import, 6), 1, - IMPORT_SIG_INDEX(0), // sig index NAME_LENGTH(1), 'm', // module name NAME_LENGTH(1), - 'f', // function name + 'f', // function name + kExternalFunction, // import kind + IMPORT_SIG_INDEX(0), // sig index }; EXPECT_OFF_END_FAILURE(data, 16, sizeof(data)); } TEST_F(WasmModuleVerifyTest, ExportTable_empty1) { - static const byte data[] = {// signatures - SIGNATURES_SECTION_VOID_VOID, ONE_EMPTY_FUNCTION, - SECTION(EXPORT_TABLE, 1), - 0, // -- + static const byte data[] = { // signatures + SIGNATURES_SECTION_VOID_VOID, // -- + ONE_EMPTY_FUNCTION, SECTION(Export, 1), // -- + 0, // -- ONE_EMPTY_BODY}; - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); EXPECT_EQ(1, result.val->functions.size()); @@ -975,34 +972,27 @@ TEST_F(WasmModuleVerifyTest, ExportTable_empty1) { TEST_F(WasmModuleVerifyTest, ExportTable_empty2) { static const byte data[] = { - SECTION(SIGNATURES, 1), 0, SECTION(EXPORT_TABLE, 1), 0 // -- - }; - // TODO(titzer): current behavior treats empty functions section as missing. - EXPECT_FAILURE(data); -} - -TEST_F(WasmModuleVerifyTest, ExportTable_NoFunctions1) { - static const byte data[] = { - SECTION(SIGNATURES, 1), 0, SECTION(EXPORT_TABLE, 1), 0 // -- + SECTION(Type, 1), 0, SECTION(Export, 1), 0 // -- }; - EXPECT_FAILURE(data); + EXPECT_VERIFIES(data); } TEST_F(WasmModuleVerifyTest, ExportTable_NoFunctions2) { - static const byte data[] = {SECTION(EXPORT_TABLE, 1), 0}; - EXPECT_FAILURE(data); + static const byte data[] = {SECTION(Export, 1), 0}; + EXPECT_VERIFIES(data); } TEST_F(WasmModuleVerifyTest, ExportTableOne) { static const byte data[] = {// signatures SIGNATURES_SECTION_VOID_VOID, ONE_EMPTY_FUNCTION, - SECTION(EXPORT_TABLE, 3), - 1, // exports - FUNC_INDEX(0), // -- - NO_NAME, // -- + SECTION(Export, 4), + 1, // exports + NO_NAME, // -- + kExternalFunction, // -- + FUNC_INDEX(0), // -- ONE_EMPTY_BODY}; - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); EXPECT_EQ(1, result.val->functions.size()); @@ -1011,26 +1001,42 @@ TEST_F(WasmModuleVerifyTest, ExportTableOne) { if (result.val) delete result.val; } +TEST_F(WasmModuleVerifyTest, ExportNameWithInvalidStringLength) { + static const byte data[] = {// signatures + SIGNATURES_SECTION_VOID_VOID, + ONE_EMPTY_FUNCTION, + SECTION(Export, 12), + 1, // exports + NAME_LENGTH(84), // invalid string length + 'e', // -- + kExternalFunction, // -- + FUNC_INDEX(0)}; + + EXPECT_FAILURE(data); +} + TEST_F(WasmModuleVerifyTest, ExportTableTwo) { static const byte data[] = {// signatures SIGNATURES_SECTION_VOID_VOID, ONE_EMPTY_FUNCTION, - SECTION(EXPORT_TABLE, 12), - 2, // exports - FUNC_INDEX(0), // -- + SECTION(Export, 14), + 2, // exports NAME_LENGTH(4), 'n', 'a', 'm', - 'e', // -- + 'e', // -- + kExternalFunction, FUNC_INDEX(0), // -- NAME_LENGTH(3), 'n', 'o', - 'm', // -- + 'm', // -- + kExternalFunction, // -- + FUNC_INDEX(0), // -- ONE_EMPTY_BODY}; - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); EXPECT_EQ(1, result.val->functions.size()); @@ -1043,19 +1049,22 @@ TEST_F(WasmModuleVerifyTest, ExportTableThree) { static const byte data[] = {// signatures SIGNATURES_SECTION_VOID_VOID, THREE_EMPTY_FUNCTIONS, - SECTION(EXPORT_TABLE, 10), - 3, // exports + SECTION(Export, 13), + 3, // exports + NAME_LENGTH(1), + 'a', // -- + kExternalFunction, FUNC_INDEX(0), // -- NAME_LENGTH(1), - 'a', // -- + 'b', // -- + kExternalFunction, FUNC_INDEX(1), // -- NAME_LENGTH(1), - 'b', // -- - FUNC_INDEX(2), // -- - NAME_LENGTH(1), 'c', // -- + kExternalFunction, + FUNC_INDEX(2), // -- THREE_EMPTY_BODIES}; - ModuleResult result = DecodeModule(data, data + arraysize(data)); + ModuleResult result = DecodeModule(data, data + sizeof(data)); EXPECT_OK(result); EXPECT_EQ(3, result.val->functions.size()); @@ -1069,12 +1078,13 @@ TEST_F(WasmModuleVerifyTest, ExportTableThreeOne) { const byte data[] = {// signatures SIGNATURES_SECTION_VOID_VOID, THREE_EMPTY_FUNCTIONS, - SECTION(EXPORT_TABLE, 5), - 1, // exports - FUNC_INDEX(i), // -- + SECTION(Export, 6), + 1, // exports NAME_LENGTH(2), 'e', 'x', // -- + kExternalFunction, + FUNC_INDEX(i), // -- THREE_EMPTY_BODIES}; if (i < 3) { @@ -1090,10 +1100,11 @@ TEST_F(WasmModuleVerifyTest, ExportTableOne_off_end) { // signatures SIGNATURES_SECTION_VOID_VOID, ONE_EMPTY_FUNCTION, - SECTION(EXPORT_TABLE, 1 + 6), - 1, // exports + SECTION(Export, 1 + 6), + 1, // exports + NO_NAME, // -- + kExternalFunction, FUNC_INDEX(0), // -- - NO_NAME // -- }; for (int length = 33; length < sizeof(data); length++) { @@ -1105,9 +1116,9 @@ TEST_F(WasmModuleVerifyTest, ExportTableOne_off_end) { TEST_F(WasmModuleVerifyTest, FunctionSignatures_empty) { static const byte data[] = { - SECTION(SIGNATURES, 1), 0, // -- - SECTION(FUNCTION_SIGNATURES, 1), 0 // -- - }; // -- + SECTION(Type, 1), 0, // -- + SECTION(Function, 1), 0 // -- + }; // -- EXPECT_VERIFIES(data); } @@ -1119,6 +1130,15 @@ TEST_F(WasmModuleVerifyTest, FunctionSignatures_one) { EXPECT_VERIFIES(data); } +TEST_F(WasmModuleVerifyTest, Regression_648070) { + static const byte data[] = { + SECTION(Type, 1), 0, // -- + SECTION(Function, 5), // -- + U32V_5(3500228624) // function count = 3500228624 + }; // -- + EXPECT_FAILURE(data); +} + TEST_F(WasmModuleVerifyTest, FunctionBodies_empty) { static const byte data[] = { EMPTY_SIGNATURES_SECTION, // -- @@ -1130,40 +1150,40 @@ TEST_F(WasmModuleVerifyTest, FunctionBodies_empty) { TEST_F(WasmModuleVerifyTest, FunctionBodies_one_empty) { static const byte data[] = { - SIGNATURES_SECTION(1, SIG_ENTRY_v_v), // -- - FUNCTION_SIGNATURES_SECTION(1, 0), // -- - SECTION(FUNCTION_BODIES, 1 + SIZEOF_EMPTY_BODY), 1, EMPTY_BODY // -- + SIGNATURES_SECTION(1, SIG_ENTRY_v_v), // -- + FUNCTION_SIGNATURES_SECTION(1, 0), // -- + SECTION(Code, 1 + SIZEOF_EMPTY_BODY), 1, EMPTY_BODY // -- }; EXPECT_VERIFIES(data); } TEST_F(WasmModuleVerifyTest, FunctionBodies_one_nop) { static const byte data[] = { - SIGNATURES_SECTION(1, SIG_ENTRY_v_v), // -- - FUNCTION_SIGNATURES_SECTION(1, 0), // -- - SECTION(FUNCTION_BODIES, 1 + SIZEOF_NOP_BODY), 1, NOP_BODY // -- + SIGNATURES_SECTION(1, SIG_ENTRY_v_v), // -- + FUNCTION_SIGNATURES_SECTION(1, 0), // -- + SECTION(Code, 1 + SIZEOF_NOP_BODY), 1, NOP_BODY // -- }; EXPECT_VERIFIES(data); } TEST_F(WasmModuleVerifyTest, FunctionBodies_count_mismatch1) { static const byte data[] = { - SIGNATURES_SECTION(1, SIG_ENTRY_v_v), // -- - FUNCTION_SIGNATURES_SECTION(2, 0, 0), // -- - SECTION(FUNCTION_BODIES, 1 + SIZEOF_EMPTY_BODY), 1, // -- - EMPTY_BODY // -- + SIGNATURES_SECTION(1, SIG_ENTRY_v_v), // -- + FUNCTION_SIGNATURES_SECTION(2, 0, 0), // -- + SECTION(Code, 1 + SIZEOF_EMPTY_BODY), 1, // -- + EMPTY_BODY // -- }; EXPECT_FAILURE(data); } TEST_F(WasmModuleVerifyTest, FunctionBodies_count_mismatch2) { static const byte data[] = { - SIGNATURES_SECTION(1, SIG_ENTRY_v_v), // -- - FUNCTION_SIGNATURES_SECTION(1, 0), // -- - SECTION(FUNCTION_BODIES, 1 + 2 * SIZEOF_NOP_BODY), // -- - 2, // -- - NOP_BODY, // -- - NOP_BODY // -- + SIGNATURES_SECTION(1, SIG_ENTRY_v_v), // -- + FUNCTION_SIGNATURES_SECTION(1, 0), // -- + SECTION(Code, 1 + 2 * SIZEOF_NOP_BODY), // -- + ENTRY_COUNT(2), // -- + NOP_BODY, // -- + NOP_BODY // -- }; EXPECT_FAILURE(data); } @@ -1179,11 +1199,11 @@ TEST_F(WasmModuleVerifyTest, Names_one_empty) { static const byte data[] = { SIGNATURES_SECTION(1, SIG_ENTRY_v_v), // -- FUNCTION_SIGNATURES_SECTION(1, 0), // -- - SECTION(FUNCTION_BODIES, 1 + SIZEOF_EMPTY_BODY), - 1, + SECTION(Code, 1 + SIZEOF_EMPTY_BODY), + ENTRY_COUNT(1), EMPTY_BODY, // -- - SECTION(NAMES, 1 + 5), - 1, + SECTION_NAMES(1 + 5), + ENTRY_COUNT(1), FOO_STRING, NO_LOCAL_NAMES // -- }; @@ -1192,14 +1212,14 @@ TEST_F(WasmModuleVerifyTest, Names_one_empty) { TEST_F(WasmModuleVerifyTest, Names_two_empty) { static const byte data[] = { - SIGNATURES_SECTION(1, SIG_ENTRY_v_v), // -- - FUNCTION_SIGNATURES_SECTION(2, 0, 0), // -- - SECTION(FUNCTION_BODIES, 1 + 2 * SIZEOF_EMPTY_BODY), // -- - 2, + SIGNATURES_SECTION(1, SIG_ENTRY_v_v), // -- + FUNCTION_SIGNATURES_SECTION(2, 0, 0), // -- + SECTION(Code, 1 + 2 * SIZEOF_EMPTY_BODY), // -- + ENTRY_COUNT(2), EMPTY_BODY, EMPTY_BODY, // -- - SECTION(NAMES, 1 + 10), - 2, // -- + SECTION_NAMES(1 + 10), + ENTRY_COUNT(2), // -- FOO_STRING, NO_LOCAL_NAMES, // -- FOO_STRING, @@ -1208,6 +1228,66 @@ TEST_F(WasmModuleVerifyTest, Names_two_empty) { 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); \ + } + +TEST_F(WasmModuleVerifyTest, 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) { + 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) { + 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) { + 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)); +} + +#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) { + 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))); + EXPECT_INIT_EXPR_FAIL(WASM_I32_ADD(WASM_I32V_1(0), WASM_I32V_1(0))); + EXPECT_INIT_EXPR_FAIL(WASM_IF_ELSE(WASM_ZERO, WASM_ZERO, WASM_ZERO)); +} + +TEST_F(WasmModuleVerifyTest, InitExpr_global) { + static const byte data[] = {WASM_INIT_EXPR_GLOBAL(37)}; + WasmInitExpr expr = DecodeWasmInitExprForTesting(data, data + sizeof(data)); + EXPECT_EQ(WasmInitExpr::kGlobalIndex, expr.kind); + EXPECT_EQ(37, expr.val.global_index); +} + } // namespace wasm } // namespace internal } // namespace v8 diff --git a/deps/v8/test/unittests/wasm/wasm-macro-gen-unittest.cc b/deps/v8/test/unittests/wasm/wasm-macro-gen-unittest.cc index 2b782f5dc7..0399835d01 100644 --- a/deps/v8/test/unittests/wasm/wasm-macro-gen-unittest.cc +++ b/deps/v8/test/unittests/wasm/wasm-macro-gen-unittest.cc @@ -56,45 +56,44 @@ TEST_F(WasmMacroGenTest, Statements) { EXPECT_SIZE(7, WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, WASM_ZERO)); - EXPECT_SIZE(5, WASM_IF(WASM_ZERO, WASM_NOP)); + EXPECT_SIZE(6, WASM_IF(WASM_ZERO, WASM_NOP)); - EXPECT_SIZE(7, WASM_IF_ELSE(WASM_ZERO, WASM_NOP, WASM_NOP)); + EXPECT_SIZE(8, WASM_IF_ELSE(WASM_ZERO, WASM_NOP, WASM_NOP)); EXPECT_SIZE(5, WASM_SELECT(WASM_ZERO, WASM_NOP, WASM_NOP)); - EXPECT_SIZE(3, WASM_BR(0)); - EXPECT_SIZE(5, WASM_BR_IF(0, WASM_ZERO)); + EXPECT_SIZE(2, WASM_BR(0)); + EXPECT_SIZE(4, WASM_BR_IF(0, WASM_ZERO)); - EXPECT_SIZE(3, WASM_BLOCK(WASM_NOP)); - EXPECT_SIZE(4, WASM_BLOCK(WASM_NOP, WASM_NOP)); - EXPECT_SIZE(5, WASM_BLOCK(WASM_NOP, WASM_NOP, WASM_NOP)); + EXPECT_SIZE(4, WASM_BLOCK(WASM_NOP)); + EXPECT_SIZE(5, WASM_BLOCK(WASM_NOP, WASM_NOP)); + EXPECT_SIZE(6, WASM_BLOCK(WASM_NOP, WASM_NOP, WASM_NOP)); EXPECT_SIZE(5, WASM_INFINITE_LOOP); - EXPECT_SIZE(3, WASM_LOOP(WASM_NOP)); - EXPECT_SIZE(4, WASM_LOOP(WASM_NOP, WASM_NOP)); - EXPECT_SIZE(5, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_NOP)); + EXPECT_SIZE(4, WASM_LOOP(WASM_NOP)); + EXPECT_SIZE(5, WASM_LOOP(WASM_NOP, WASM_NOP)); + EXPECT_SIZE(6, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_NOP)); EXPECT_SIZE(5, WASM_LOOP(WASM_BR(0))); EXPECT_SIZE(7, WASM_LOOP(WASM_BR_IF(0, WASM_ZERO))); - EXPECT_SIZE(2, WASM_RETURN0); - EXPECT_SIZE(4, WASM_RETURN1(WASM_ZERO)); + EXPECT_SIZE(1, WASM_RETURN0); + EXPECT_SIZE(3, WASM_RETURN1(WASM_ZERO)); EXPECT_SIZE(1, WASM_UNREACHABLE); } TEST_F(WasmMacroGenTest, MacroStatements) { - EXPECT_SIZE(10, WASM_WHILE(WASM_I8(0), WASM_NOP)); + EXPECT_SIZE(11, WASM_WHILE(WASM_I8(0), WASM_NOP)); EXPECT_SIZE(7, WASM_INC_LOCAL(0)); EXPECT_SIZE(7, WASM_INC_LOCAL_BY(0, 3)); - EXPECT_SIZE(3, WASM_BREAK(0)); - EXPECT_SIZE(3, WASM_CONTINUE(0)); + EXPECT_SIZE(2, WASM_CONTINUE(0)); } TEST_F(WasmMacroGenTest, BrTable) { - EXPECT_SIZE(9, WASM_BR_TABLE(WASM_ZERO, 1, BR_TARGET(1))); - EXPECT_SIZE(11, WASM_BR_TABLEV(WASM_ZERO, WASM_ZERO, 1, BR_TARGET(1))); + EXPECT_SIZE(5, WASM_BR_TABLE(WASM_ZERO, 1, BR_TARGET(0))); + EXPECT_SIZE(6, WASM_BR_TABLE(WASM_ZERO, 2, BR_TARGET(0), BR_TARGET(0))); } TEST_F(WasmMacroGenTest, Expressions) { @@ -110,43 +109,34 @@ TEST_F(WasmMacroGenTest, Expressions) { EXPECT_SIZE(3, WASM_NOT(WASM_ZERO)); - EXPECT_SIZE(5, WASM_BRV(1, WASM_ZERO)); - EXPECT_SIZE(7, WASM_BRV_IF(1, WASM_ZERO, WASM_ZERO)); + EXPECT_SIZE(4, WASM_BRV(1, WASM_ZERO)); + EXPECT_SIZE(6, WASM_BRV_IF(1, WASM_ZERO, WASM_ZERO)); - EXPECT_SIZE(4, WASM_BLOCK(WASM_ZERO)); - EXPECT_SIZE(5, WASM_BLOCK(WASM_NOP, WASM_ZERO)); - EXPECT_SIZE(6, WASM_BLOCK(WASM_NOP, WASM_NOP, WASM_ZERO)); + EXPECT_SIZE(5, WASM_BLOCK(WASM_ZERO)); + EXPECT_SIZE(6, WASM_BLOCK(WASM_NOP, WASM_ZERO)); + EXPECT_SIZE(7, WASM_BLOCK(WASM_NOP, WASM_NOP, WASM_ZERO)); - EXPECT_SIZE(4, WASM_LOOP(WASM_ZERO)); - EXPECT_SIZE(5, WASM_LOOP(WASM_NOP, WASM_ZERO)); - EXPECT_SIZE(6, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_ZERO)); + EXPECT_SIZE(5, WASM_LOOP(WASM_ZERO)); + EXPECT_SIZE(6, WASM_LOOP(WASM_NOP, WASM_ZERO)); + EXPECT_SIZE(7, WASM_LOOP(WASM_NOP, WASM_NOP, WASM_ZERO)); } TEST_F(WasmMacroGenTest, CallFunction) { - EXPECT_SIZE(3, WASM_CALL_FUNCTION0(0)); - EXPECT_SIZE(3, WASM_CALL_FUNCTION0(1)); - EXPECT_SIZE(3, WASM_CALL_FUNCTION0(11)); + EXPECT_SIZE(2, WASM_CALL_FUNCTION0(0)); + EXPECT_SIZE(2, WASM_CALL_FUNCTION0(1)); + EXPECT_SIZE(2, WASM_CALL_FUNCTION0(11)); - EXPECT_SIZE(5, WASM_CALL_FUNCTION1(0, WASM_ZERO)); - EXPECT_SIZE(7, WASM_CALL_FUNCTION2(1, WASM_ZERO, WASM_ZERO)); -} - -TEST_F(WasmMacroGenTest, CallImport) { - EXPECT_SIZE(3, WASM_CALL_IMPORT0(0)); - EXPECT_SIZE(3, WASM_CALL_IMPORT0(1)); - EXPECT_SIZE(3, WASM_CALL_IMPORT0(11)); - - EXPECT_SIZE(5, WASM_CALL_IMPORT1(0, WASM_ZERO)); - EXPECT_SIZE(7, WASM_CALL_IMPORT2(1, WASM_ZERO, WASM_ZERO)); + EXPECT_SIZE(4, WASM_CALL_FUNCTION(0, WASM_ZERO)); + EXPECT_SIZE(6, WASM_CALL_FUNCTION(1, WASM_ZERO, WASM_ZERO)); } TEST_F(WasmMacroGenTest, CallIndirect) { - EXPECT_SIZE(5, WASM_CALL_INDIRECT0(0, WASM_ZERO)); - EXPECT_SIZE(5, WASM_CALL_INDIRECT0(1, WASM_ZERO)); - EXPECT_SIZE(5, WASM_CALL_INDIRECT0(11, WASM_ZERO)); + EXPECT_SIZE(4, WASM_CALL_INDIRECT0(0, WASM_ZERO)); + EXPECT_SIZE(4, WASM_CALL_INDIRECT0(1, WASM_ZERO)); + EXPECT_SIZE(4, WASM_CALL_INDIRECT0(11, WASM_ZERO)); - EXPECT_SIZE(7, WASM_CALL_INDIRECT1(0, WASM_ZERO, WASM_ZERO)); - EXPECT_SIZE(9, WASM_CALL_INDIRECT2(1, WASM_ZERO, WASM_ZERO, WASM_ZERO)); + EXPECT_SIZE(6, WASM_CALL_INDIRECT1(0, WASM_ZERO, WASM_ZERO)); + EXPECT_SIZE(8, WASM_CALL_INDIRECT2(1, WASM_ZERO, WASM_ZERO, WASM_ZERO)); } TEST_F(WasmMacroGenTest, Int32Ops) { diff --git a/deps/v8/test/unittests/wasm/encoder-unittest.cc b/deps/v8/test/unittests/wasm/wasm-module-builder-unittest.cc index 47885e697d..50049d557e 100644 --- a/deps/v8/test/unittests/wasm/encoder-unittest.cc +++ b/deps/v8/test/unittests/wasm/wasm-module-builder-unittest.cc @@ -7,15 +7,15 @@ #include "src/v8.h" #include "src/wasm/ast-decoder.h" -#include "src/wasm/encoder.h" +#include "src/wasm/wasm-module-builder.h" -#include "test/cctest/wasm/test-signatures.h" +#include "test/common/wasm/test-signatures.h" namespace v8 { namespace internal { namespace wasm { -class EncoderTest : public TestWithZone { +class WasmModuleBuilderTest : public TestWithZone { protected: void AddLocal(WasmFunctionBuilder* f, LocalType type) { uint16_t index = f->AddLocal(type); @@ -23,6 +23,14 @@ class EncoderTest : public TestWithZone { } }; +TEST_F(WasmModuleBuilderTest, Regression_647329) { + // Test crashed with asan. + ZoneBuffer buffer(zone()); + const size_t kSize = ZoneBuffer::kInitialSize * 3 + 4096 + 100; + byte data[kSize]; + buffer.write(data, kSize); +} + } // namespace wasm } // namespace internal } // namespace v8 diff --git a/deps/v8/test/webkit/fast/js/stack-overflow-arrity-catch-expected.txt b/deps/v8/test/webkit/fast/js/stack-overflow-arrity-catch-expected.txt deleted file mode 100644 index 80df97e671..0000000000 --- a/deps/v8/test/webkit/fast/js/stack-overflow-arrity-catch-expected.txt +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2013 the V8 project authors. All rights reserved. -# Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. 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. -# -# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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. - -Test that if an arrity check causes a stack overflow, the exception goes to the right catch - -On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". - - -PASS gotRightCatch is true -PASS successfullyParsed is true - -TEST COMPLETE - diff --git a/deps/v8/test/webkit/fast/regex/lastIndex-expected.txt b/deps/v8/test/webkit/fast/regex/lastIndex-expected.txt index 1e0959c3f9..acceee2dd6 100644 --- a/deps/v8/test/webkit/fast/regex/lastIndex-expected.txt +++ b/deps/v8/test/webkit/fast/regex/lastIndex-expected.txt @@ -44,8 +44,8 @@ PASS Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writable:fal PASS Object.defineProperty(Object.defineProperty(/x/, 'lastIndex', {writable:false}), 'lastIndex', {value:0}); true is true PASS Object.defineProperty(/x/, 'lastIndex', {writable:false}).exec('') is null PASS Object.defineProperty(/x/, 'lastIndex', {writable:false}).exec('x') is ["x"] -FAIL Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('') should throw an exception. Was null. -FAIL Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('x') should throw an exception. Was x. +PASS Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('') threw exception TypeError: Cannot assign to read only property 'lastIndex' of object '[object RegExp]'. +PASS Object.defineProperty(/x/g, 'lastIndex', {writable:false}).exec('x') threw exception TypeError: Cannot assign to read only property 'lastIndex' of object '[object RegExp]'. PASS var re = /x/; Object.freeze(re); Object.isFrozen(re); is true PASS successfullyParsed is true diff --git a/deps/v8/test/webkit/webkit.status b/deps/v8/test/webkit/webkit.status index 9e336a2f97..0437a858c6 100644 --- a/deps/v8/test/webkit/webkit.status +++ b/deps/v8/test/webkit/webkit.status @@ -130,4 +130,9 @@ }], # 'gcov_coverage' ############################################################################## +['variant == asm_wasm', { + '*': [SKIP], +}], # variant == asm_wasm + +############################################################################## ] |