diff options
author | Michaël Zasso <targos@protonmail.com> | 2017-02-14 11:27:26 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2017-02-22 15:55:42 +0100 |
commit | 7a77daf24344db7942e34c962b0f1ee729ab7af5 (patch) | |
tree | e7cbe7bf4e2f4b802a8f5bc18336c546cd6a0d7f /deps/v8/test/cctest | |
parent | 5f08871ee93ea739148cc49e0f7679e33c70295a (diff) | |
download | node-new-7a77daf24344db7942e34c962b0f1ee729ab7af5.tar.gz |
deps: update V8 to 5.6.326.55
PR-URL: https://github.com/nodejs/node/pull/10992
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'deps/v8/test/cctest')
138 files changed, 5914 insertions, 4711 deletions
diff --git a/deps/v8/test/cctest/BUILD.gn b/deps/v8/test/cctest/BUILD.gn index d2918d90ae..f926707915 100644 --- a/deps/v8/test/cctest/BUILD.gn +++ b/deps/v8/test/cctest/BUILD.gn @@ -40,7 +40,6 @@ v8_executable("cctest") { "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", @@ -167,6 +166,7 @@ v8_executable("cctest") { "test-thread-termination.cc", "test-threads.cc", "test-trace-event.cc", + "test-traced-value.cc", "test-transitions.cc", "test-typedarrays.cc", "test-types.cc", @@ -182,6 +182,7 @@ v8_executable("cctest") { "trace-extension.cc", "trace-extension.h", "types-fuzz.h", + "wasm/test-managed.cc", "wasm/test-run-wasm-64.cc", "wasm/test-run-wasm-asmjs.cc", "wasm/test-run-wasm-interpreter.cc", @@ -189,7 +190,6 @@ v8_executable("cctest") { "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", @@ -276,6 +276,7 @@ v8_executable("cctest") { "test-log-stack-tracer.cc", "test-macro-assembler-x64.cc", "test-run-wasm-relocation-x64.cc", + "wasm/test-run-wasm-simd-lowering.cc", "wasm/test-run-wasm-simd.cc", ] } else if (v8_current_cpu == "x87") { @@ -324,6 +325,7 @@ v8_executable("cctest") { deps = [ ":resources", + "../..:v8_libbase", "../..:v8_libplatform", "../..:wasm_module_runner", "../..:wasm_test_signatures", @@ -331,10 +333,13 @@ v8_executable("cctest") { "//build/win:default_exe_manifest", ] + defines = [] + if (is_component_build) { # cctest 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" ] + defines += [ "BUILDING_V8_SHARED" ] } else { deps += [ "../..:v8" ] } @@ -358,14 +363,6 @@ v8_executable("cctest") { # MSVS wants this for gay-{precision,shortest}.cc. cflags += [ "/bigobj" ] - - # Suppress warnings about importing locally defined symbols. - if (is_component_build) { - ldflags += [ - "/ignore:4049", - "/ignore:4217", - ] - } } } @@ -416,25 +413,10 @@ v8_executable("generate-bytecode-expectations") { ] deps = [ + "../..:v8", + "../..:v8_libbase", "../..:v8_libplatform", "//build/config/sanitizers:deps", "//build/win:default_exe_manifest", ] - - if (is_component_build) { - # Same as cctest, we need to depend on the underlying static target. - deps += [ "../..:v8_maybe_snapshot" ] - } else { - deps += [ "../..:v8" ] - } - - if (is_win) { - # Suppress warnings about importing locally defined symbols. - if (is_component_build) { - ldflags = [ - "/ignore:4049", - "/ignore:4217", - ] - } - } } diff --git a/deps/v8/test/cctest/asmjs/test-asm-typer.cc b/deps/v8/test/cctest/asmjs/test-asm-typer.cc index a44ecf9283..d345774dbf 100644 --- a/deps/v8/test/cctest/asmjs/test-asm-typer.cc +++ b/deps/v8/test/cctest/asmjs/test-asm-typer.cc @@ -52,8 +52,6 @@ class AsmTyperHarnessBuilder { factory_->NewStringFromUtf8(CStrVector(source)).ToHandleChecked()), script_(factory_->NewScript(source_code_)) { ParseInfo info(zone_, script_); - info.set_global(); - info.set_lazy(false); info.set_allow_lazy_parsing(false); info.set_toplevel(true); info.set_ast_value_factory(&ast_value_factory_); @@ -66,17 +64,18 @@ class AsmTyperHarnessBuilder { } outer_scope_ = info.script_scope(); - module_ = - info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); + module_ = info.scope() + ->declarations() + ->AtForTest(0) + ->AsFunctionDeclaration() + ->fun(); typer_.reset(new AsmTyper(isolate_, zone_, *script_, module_)); if (validation_type_ == ValidateStatement || validation_type_ == ValidateExpression) { fun_scope_.reset(new AsmTyper::FunctionScope(typer_.get())); - auto* decls = module_->scope()->declarations(); - for (int ii = 0; ii < decls->length(); ++ii) { - Declaration* decl = decls->at(ii); + for (Declaration* decl : *module_->scope()->declarations()) { if (FunctionDeclaration* fun_decl = decl->AsFunctionDeclaration()) { fun_decl_ = fun_decl; break; @@ -507,14 +506,15 @@ TEST(ErrorsInGlobalVariableDefinition) { const char* error_message; } kTests[] = { {"var v;", "Global variable missing initializer"}, - {"var v = uninitialized;", "Invalid global variable initializer"}, + {"var v = uninitialized;", "Undeclared identifier in global"}, {"var v = 'use asm';", "type annotation - forbidden literal"}, {"var v = 4294967296;", " - forbidden literal"}, - {"var v = not_fround;", "Invalid global variable initializer"}, + {"var v = not_fround;", "initialize a global must be a const"}, {"var v = not_fround(1);", "expected call fround(literal)"}, {"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 = i?0:1;", "Invalid global variable initializer"}, {"var v = stdlib.nan", "Invalid import"}, {"var v = stdlib.Math.nan", "Invalid import"}, {"var v = stdlib.Mathh.E", "Invalid import"}, @@ -790,6 +790,19 @@ TEST(ErrorsInFunction) { " var c = 0;\n" "}\n", "Local variable missing initializer in asm.js module"}, + {"function f(a) {\n" + " a = a|0;\n" + " var x = a;\n" + "}\n", + "variable declaration initializer must be const"}, + {"function f() {\n" + " var x = 1+i;\n" + "}\n", + "should be a literal, const, or fround(literal"}, + {"function f() {\n" + " var x = a;\n" + "}\n", + "Undeclared identifier in variable declaration initializer"}, {"function f() {\n" " function ff() {}\n" "}\n", @@ -814,6 +827,19 @@ TEST(ErrorsInFunction) { " return 2147483648;\n" "}\n", "Invalid literal in return statement"}, + {"function f(a) {\n" + " a = a|0;\n" + " return a;\n" + "}\n", + "in return statement is not const"}, + {"function f() {\n" + " return a;\n" + "}\n", + "Undeclared identifier in return statement"}, + {"function f() {\n" + " return i?0:1;\n" + "}\n", + "Invalid return type expression"}, {"function f() {\n" " return stdlib.Math.E;" "}\n", @@ -1097,7 +1123,8 @@ TEST(ValidateCallExpression) { for (size_t ii = 0; ii < arraysize(kTests); ++ii) { const auto* test = kTests + ii; CHECK(v8::base::OS::SNPrintF(full_test, kFullTestSize, "fround(%s)", - test->expression) < kFullTestSize); + test->expression) < + static_cast<int>(kFullTestSize)); if (!ValidationOf(Expression(full_test)) ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) ->WithGlobal(DynamicGlobal("a_float_function"), v2f) @@ -1128,7 +1155,8 @@ TEST(ValidateCallExpression) { for (size_t ii = 0; ii < arraysize(kFailureTests); ++ii) { const auto* test = kFailureTests + ii; CHECK(v8::base::OS::SNPrintF(full_test, kFullTestSize, "fround(%s)", - test->expression) < kFullTestSize); + test->expression) < + static_cast<int>(kFullTestSize)); if (!ValidationOf(Expression(full_test)) ->WithImport(DynamicGlobal("fround"), iw::AsmTyper::kMathFround) ->WithLocal(DynamicGlobal("ilocal"), iw::AsmType::Int()) @@ -2000,4 +2028,31 @@ TEST(B640194) { } } +TEST(B660813) { + const char* kTests[] = { + "function asm() {\n" + " 'use asm';\n" + " const i = 0xffffffff;\n" + " function f() {\n" + " return i;\n" + " }\n" + "}", + "function asm() {\n" + " 'use asm';\n" + " const i = -(-2147483648);\n" + " function f() {\n" + " return i;\n" + " }\n" + "}", + }; + for (size_t ii = 0; ii < arraysize(kTests); ++ii) { + if (!ValidationOf(Module(kTests[ii])) + ->FailsWithMessage( + "Constant in return must be signed, float, or double.")) { + std::cerr << "Test:\n" << kTests[ii]; + CHECK(false); + } + } +} + } // namespace diff --git a/deps/v8/test/cctest/cctest.cc b/deps/v8/test/cctest/cctest.cc index 17127ed9ec..c987d8d375 100644 --- a/deps/v8/test/cctest/cctest.cc +++ b/deps/v8/test/cctest/cctest.cc @@ -197,7 +197,7 @@ InitializedHandleScope::InitializedHandleScope() InitializedHandleScope::~InitializedHandleScope() {} HandleAndZoneScope::HandleAndZoneScope() - : main_zone_(new i::Zone(&allocator_)) {} + : main_zone_(new i::Zone(&allocator_, ZONE_NAME)) {} HandleAndZoneScope::~HandleAndZoneScope() {} diff --git a/deps/v8/test/cctest/cctest.gyp b/deps/v8/test/cctest/cctest.gyp index c95a0b1749..6b5dba6472 100644 --- a/deps/v8/test/cctest/cctest.gyp +++ b/deps/v8/test/cctest/cctest.gyp @@ -60,7 +60,6 @@ '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', @@ -187,6 +186,7 @@ 'test-thread-termination.cc', 'test-threads.cc', 'test-trace-event.cc', + 'test-traced-value.cc', 'test-transitions.cc', 'test-typedarrays.cc', 'test-ast-types.cc', @@ -203,6 +203,7 @@ 'trace-extension.cc', 'trace-extension.h', 'types-fuzz.h', + 'wasm/test-managed.cc', 'wasm/test-run-wasm.cc', 'wasm/test-run-wasm-64.cc', 'wasm/test-run-wasm-asmjs.cc', @@ -210,7 +211,6 @@ 'wasm/test-run-wasm-js.cc', 'wasm/test-run-wasm-module.cc', 'wasm/test-run-wasm-relocation.cc', - 'wasm/test-wasm-function-name-table.cc', 'wasm/test-wasm-stack.cc', 'wasm/test-wasm-trap-position.cc', 'wasm/wasm-run-utils.h', @@ -234,7 +234,8 @@ 'test-macro-assembler-x64.cc', 'test-log-stack-tracer.cc', 'test-run-wasm-relocation-x64.cc', - 'wasm/test-run-wasm-simd.cc' + 'wasm/test-run-wasm-simd.cc', + 'wasm/test-run-wasm-simd-lowering.cc', ], 'cctest_sources_arm': [ ### gcmole(arch:arm) ### 'test-assembler-arm.cc', @@ -320,6 +321,7 @@ 'type': 'executable', 'dependencies': [ 'resources', + '../../src/v8.gyp:v8_libbase', '../../src/v8.gyp:v8_libplatform', ], 'include_dirs': [ @@ -428,6 +430,7 @@ # cctest 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'], + 'defines': [ 'BUILDING_V8_SHARED', ] }, { 'dependencies': ['../../src/v8.gyp:v8'], }], @@ -472,16 +475,10 @@ 'target_name': 'generate-bytecode-expectations', 'type': 'executable', 'dependencies': [ + '../../src/v8.gyp:v8', + '../../src/v8.gyp:v8_libbase', '../../src/v8.gyp:v8_libplatform', ], - 'conditions': [ - ['component=="shared_library"', { - # Same as cctest, we need to depend on the underlying static target. - 'dependencies': ['../../src/v8.gyp:v8_maybe_snapshot'], - }, { - 'dependencies': ['../../src/v8.gyp:v8'], - }], - ], 'include_dirs+': [ '../..', ], diff --git a/deps/v8/test/cctest/cctest.h b/deps/v8/test/cctest/cctest.h index d8fa871484..690a8c14cd 100644 --- a/deps/v8/test/cctest/cctest.h +++ b/deps/v8/test/cctest/cctest.h @@ -189,11 +189,17 @@ class ApiTestFuzzer: public v8::base::Thread { // The ApiTestFuzzer is also a Thread, so it has a Run method. virtual void Run(); - enum PartOfTest { FIRST_PART, - SECOND_PART, - THIRD_PART, - FOURTH_PART, - LAST_PART = FOURTH_PART }; + enum PartOfTest { + FIRST_PART, + SECOND_PART, + THIRD_PART, + FOURTH_PART, + FIFTH_PART, + SIXTH_PART, + SEVENTH_PART, + EIGHTH_PART, + LAST_PART = EIGHTH_PART + }; static void SetUp(PartOfTest part); static void RunAllTests(); diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status index b7bcb6b5e3..059d099bf5 100644 --- a/deps/v8/test/cctest/cctest.status +++ b/deps/v8/test/cctest/cctest.status @@ -29,7 +29,6 @@ [ALWAYS, { # All tests prefixed with 'Bug' are expected to fail. 'test-api/Bug*': [FAIL], - 'test-serialize/Bug*': [FAIL], ############################################################################## @@ -69,7 +68,8 @@ 'test-ast-types/*': [PASS, NO_VARIANTS], # This tests API threading, no point in running several variants. - 'test-api/Threading*': [PASS, NO_VARIANTS], + # They are also slow in debug mode. + 'test-api/Threading*': [PASS, NO_VARIANTS, ['mode == debug', SLOW]], # BUG(2999). The cpu profiler tests are notoriously flaky. 'test-cpu-profiler/CpuProfileDeepStack': [SKIP], @@ -90,12 +90,11 @@ # BUG(3742). 'test-mark-compact/MarkCompactCollector': [PASS, ['arch==arm', NO_VARIANTS]], + # Test that serialization with unknown external reference fails. + 'test-serialize/SnapshotCreatorUnknownExternalReferences': [FAIL], + ############################################################################ # Slow tests. - 'test-api/Threading1': [PASS, ['mode == debug', SLOW]], - 'test-api/Threading2': [PASS, ['mode == debug', SLOW]], - 'test-api/Threading3': [PASS, ['mode == debug', SLOW]], - 'test-api/Threading4': [PASS, ['mode == debug', SLOW]], 'test-debug/CallFunctionInDebugger': [PASS, ['mode == debug', SLOW]], 'test-strings/StringOOM*': [PASS, ['mode == debug', SKIP]], 'test-serialize/CustomSnapshotDataBlobImmortalImmovableRoots': [PASS, ['mode == debug', SKIP]], @@ -132,8 +131,6 @@ # Pass but take too long with the simulator. 'test-api/ExternalArrays': [PASS, TIMEOUT], - 'test-api/Threading1': [SKIP], - 'test-api/Threading2': [SKIP], }], # 'arch == arm64 and simulator_run == True' ['arch == arm64 and mode == debug and simulator_run == True', { @@ -165,10 +162,7 @@ 'test-strings/CountBreakIterator': [SKIP], # Slow tests. - 'test-api/Threading1': [PASS, SLOW], - 'test-api/Threading2': [PASS, SLOW], - 'test-api/Threading3': [PASS, SLOW], - 'test-api/Threading4': [PASS, SLOW], + 'test-api/Threading*': [PASS, SLOW], }], # 'msan == True' ############################################################################## @@ -227,10 +221,7 @@ ############################################################################ # Slow tests. - 'test-api/Threading1': [PASS, SLOW], - 'test-api/Threading2': [PASS, SLOW], - 'test-api/Threading3': [PASS, SLOW], - 'test-api/Threading4': [PASS, SLOW], + 'test-api/Threading*': [PASS, SLOW], }], # 'arch == arm' ############################################################################## @@ -254,7 +245,8 @@ # TODO(mips-team): Currently fails on mips board. 'test-parsing/TooManyArguments': [SKIP], - 'test-api/Threading3': [SKIP], + 'test-api/Threading5': [SKIP], + 'test-api/Threading6': [SKIP], }], # 'arch == mips' ############################################################################## @@ -327,54 +319,43 @@ ['arch == ppc and simulator_run == True or arch == ppc64 and simulator_run == True', { # Pass but take too long with the simulator. - 'test-api/Threading1': [PASS, SLOW], - 'test-api/Threading2': [PASS, SLOW], + 'test-api/Threading*': [PASS, SLOW], 'test-api/ExternalArrays': [PASS, SLOW], }], # 'arch == ppc64 and simulator_run == True' ############################################################################## -['variant == turbofan', { - - # TurboFan cpu profiler result is different. - 'test-cpu-profiler/CollectDeoptEvents': [FAIL], - 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL], - 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL], - -}], # variant == turbofan - -############################################################################## ['variant == turbofan_opt', { - # BUG(5193): Flaky. - 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], + # TODO(mythria,4680): Lack of code-ageing and/or lack of compilation cache + # in interpreter. + 'test-heap/CompilationCacheCachingBehavior': [FAIL], + + # TODO(mstarzinger): Triggers Ignition+TurboFan on everything now and makes + # the stack traces within the profilers look different. Needs investigation. + 'test-api/SetFunctionEntryHook': [SKIP], + 'test-cpu-profiler/BoundFunctionCall': [FAIL], + 'test-cpu-profiler/CollectSampleAPI': [FAIL], + 'test-cpu-profiler/FunctionApplySample': [FAIL], + 'test-cpu-profiler/FunctionCallSample': [FAIL], + 'test-cpu-profiler/JsNativeJsRuntimeJsSample': [FAIL], + 'test-cpu-profiler/JsNativeJsSample': [FAIL], + 'test-cpu-profiler/JsNativeJsRuntimeJsSampleMultiple': [FAIL], + 'test-cpu-profiler/JsNative1JsNative2JsSample': [FAIL], + 'test-cpu-profiler/NativeMethodUninitializedIC': [FAIL], + 'test-cpu-profiler/NativeAccessorUninitializedIC': [FAIL], + 'test-profile-generator/LineNumber': [FAIL], + 'test-sampler-api/StackFramesConsistent': [FAIL], + + # BUG(v8:5457) + 'test-api/SetJitCodeEventHandler': [PASS, ['no_snap', SKIP]], }], # variant == turbofan_opt ############################################################################## ['variant == ignition', { - # TODO(rmcilroy,4680): Related to lack of code flushing. Check failed: !function->shared()->is_compiled() || function->IsOptimized(). - 'test-heap/TestCodeFlushingPreAged': [FAIL], - 'test-heap/TestCodeFlushingIncrementalScavenge': [FAIL], - 'test-heap/TestCodeFlushing': [FAIL], - 'test-heap/TestCodeFlushingIncremental': [FAIL], - 'test-heap/TestCodeFlushingIncrementalAbort': [PASS, ['mode == debug or dcheck_always_on == True', FAIL]], - - # TODO(mythria,4680): Lack of code-ageing in interpreter. - 'test-heap/Regress169209': [FAIL], - # TODO(mythria,4680): Lack of code-ageing and/or lack of compilation cache # in interpreter. 'test-heap/CompilationCacheCachingBehavior': [FAIL], - # BUG(4680): Missing type feedback makes optimistic optimizations fail. - 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP], - - # BUG(4751). Flaky with ignition. - 'test-cpu-profiler/JsNativeJsSample': [PASS, FAIL], - - # TODO(ignition): Fails due to missing type info when optimizing from bytecode - # with crankshaft. - 'test-cpu-profiler/TickLinesOptimized': [SKIP], - # BUG(5193): Flaky. 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], }], # variant == ignition @@ -384,32 +365,13 @@ 'test-cpu-profiler/DeoptUntrackedFunction': [SKIP], 'test-cpu-profiler/TickLinesOptimized': [SKIP], 'test-heap/CompilationCacheCachingBehavior': [FAIL], - 'test-heap/Regress169209': [FAIL], - 'test-heap/TestCodeFlushing': [FAIL], - 'test-heap/TestCodeFlushingIncremental': [FAIL], - 'test-heap/TestCodeFlushingIncrementalScavenge': [FAIL], - 'test-heap/TestCodeFlushingPreAged': [FAIL], # BUG(5193): Flaky. 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], }], # variant == ignition_staging ############################################################################## -['variant == ignition_turbofan', { - # TODO(rmcilroy,4766): Requires BytecodeGraphBuilder to track source position - # on nodes (behind --turbo_source_positions flag). - 'test-cpu-profiler/TickLinesOptimized': [FAIL], - - # TODO(rmcilroy,4680): Related to lack of code flushing. Check failed: !function->shared()->is_compiled() || function->IsOptimized(). - 'test-heap/TestCodeFlushingPreAged': [FAIL], - 'test-heap/TestCodeFlushingIncrementalScavenge': [FAIL], - 'test-heap/TestCodeFlushing': [FAIL], - 'test-heap/TestCodeFlushingIncremental': [FAIL], - 'test-heap/TestCodeFlushingIncrementalAbort': [PASS, ['mode == debug or dcheck_always_on == True', FAIL]], - - # TODO(mythria,4680): Lack of code-ageing in interpreter. - 'test-heap/Regress169209': [FAIL], - +['variant == turbofan or variant == ignition_turbofan', { # TODO(mythria,4680): Lack of code-ageing and/or lack of compilation cache # in interpreter. 'test-heap/CompilationCacheCachingBehavior': [FAIL], @@ -421,13 +383,12 @@ # BUG(4751). Flaky with Ignition. 'test-cpu-profiler/JsNativeJsSample': [SKIP], - # TurboFan cpu profiler result is different. - 'test-cpu-profiler/DeoptAtFirstLevelInlinedSource': [FAIL], - 'test-cpu-profiler/DeoptAtSecondLevelInlinedSource': [FAIL], + # TODO(vogelheim,5548): Turbofan does support cached accessors. + 'test-api-accessors/CachedAccessorCrankshaft': [FAIL], # BUG(5193): Flaky. 'test-cpu-profiler/FunctionApplySample': [PASS, ['system == windows', SKIP]], -}], # variant == ignition_turbofan +}], # variant == turbofan or variant == ignition_turbofan ############################################################################## ['variant != ignition and variant != ignition_staging and variant != ignition_turbofan', { diff --git a/deps/v8/test/cctest/compiler/code-assembler-tester.h b/deps/v8/test/cctest/compiler/code-assembler-tester.h index eb2d77a171..b0c84ec94a 100644 --- a/deps/v8/test/cctest/compiler/code-assembler-tester.h +++ b/deps/v8/test/cctest/compiler/code-assembler-tester.h @@ -13,11 +13,12 @@ namespace compiler { class ZoneHolder { public: - explicit ZoneHolder(Isolate* isolate) : zone_(isolate->allocator()) {} - Zone* zone() { return &zone_; } + explicit ZoneHolder(Isolate* isolate) + : held_zone_(isolate->allocator(), ZONE_NAME) {} + Zone* held_zone() { return &held_zone_; } private: - Zone zone_; + Zone held_zone_; }; // Inherit from ZoneHolder in order to create a zone that can be passed to @@ -29,22 +30,23 @@ class CodeAssemblerTesterImpl : private ZoneHolder, public CodeAssemblerT { CodeAssemblerTesterImpl(Isolate* isolate, const CallInterfaceDescriptor& descriptor) : ZoneHolder(isolate), - CodeAssemblerT(isolate, ZoneHolder::zone(), descriptor, + CodeAssemblerT(isolate, ZoneHolder::held_zone(), descriptor, Code::ComputeFlags(Code::STUB), "test"), scope_(isolate) {} // Test generating code for a JS function (e.g. builtins). - CodeAssemblerTesterImpl(Isolate* isolate, int parameter_count) + CodeAssemblerTesterImpl(Isolate* isolate, int parameter_count, + Code::Kind kind = Code::BUILTIN) : ZoneHolder(isolate), - CodeAssemblerT(isolate, ZoneHolder::zone(), parameter_count, - Code::ComputeFlags(Code::FUNCTION), "test"), + CodeAssemblerT(isolate, ZoneHolder::held_zone(), parameter_count, + Code::ComputeFlags(kind), "test"), scope_(isolate) {} // This constructor is intended to be used for creating code objects with // specific flags. CodeAssemblerTesterImpl(Isolate* isolate, Code::Flags flags) : ZoneHolder(isolate), - CodeAssemblerT(isolate, ZoneHolder::zone(), 0, flags, "test"), + CodeAssemblerT(isolate, ZoneHolder::held_zone(), 0, flags, "test"), scope_(isolate) {} Handle<Code> GenerateCodeCloseAndEscape() { diff --git a/deps/v8/test/cctest/compiler/function-tester.cc b/deps/v8/test/cctest/compiler/function-tester.cc index 2da2dc14aa..24a49b852c 100644 --- a/deps/v8/test/cctest/compiler/function-tester.cc +++ b/deps/v8/test/cctest/compiler/function-tester.cc @@ -26,8 +26,7 @@ FunctionTester::FunctionTester(const char* source, uint32_t flags) function((FLAG_allow_natives_syntax = true, NewFunction(source))), flags_(flags) { Compile(function); - const uint32_t supported_flags = CompilationInfo::kNativeContextSpecializing | - CompilationInfo::kInliningEnabled; + const uint32_t supported_flags = CompilationInfo::kInliningEnabled; CHECK_EQ(0u, flags_ & ~supported_flags); } @@ -158,26 +157,19 @@ Handle<JSFunction> FunctionTester::ForMachineGraph(Graph* graph, } Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> function) { - Zone zone(function->GetIsolate()->allocator()); - ParseInfo parse_info(&zone, function); + Zone zone(function->GetIsolate()->allocator(), ZONE_NAME); + ParseInfo parse_info(&zone, handle(function->shared())); 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(); - } + info.MarkAsDeoptimizationEnabled(); if (flags_ & CompilationInfo::kInliningEnabled) { info.MarkAsInliningEnabled(); } - if (FLAG_turbo_from_bytecode) { - CHECK(Compiler::EnsureBytecode(&info)); + if (Compiler::EnsureBytecode(&info)) { info.MarkAsOptimizeFromBytecode(); } else { - CHECK(Compiler::Analyze(info.parse_info())); + CHECK(Compiler::ParseAndAnalyze(info.parse_info())); CHECK(Compiler::EnsureDeoptimizationSupport(&info)); } JSFunction::EnsureLiterals(function); @@ -193,8 +185,8 @@ Handle<JSFunction> FunctionTester::Compile(Handle<JSFunction> 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); + Zone zone(function->GetIsolate()->allocator(), ZONE_NAME); + ParseInfo parse_info(&zone, handle(function->shared())); CompilationInfo info(&parse_info, function); CHECK(Parser::ParseStatic(info.parse_info())); diff --git a/deps/v8/test/cctest/compiler/graph-builder-tester.h b/deps/v8/test/cctest/compiler/graph-builder-tester.h index c257448b8a..a2436ad1d2 100644 --- a/deps/v8/test/cctest/compiler/graph-builder-tester.h +++ b/deps/v8/test/cctest/compiler/graph-builder-tester.h @@ -86,8 +86,9 @@ class GraphBuilderTester : public HandleAndZoneScope, } void Return(Node* value) { - return_ = - graph()->NewNode(common()->Return(), value, effect_, graph()->start()); + Node* zero = graph()->NewNode(common()->Int32Constant(0)); + return_ = graph()->NewNode(common()->Return(), zero, value, effect_, + graph()->start()); effect_ = NULL; } diff --git a/deps/v8/test/cctest/compiler/test-gap-resolver.cc b/deps/v8/test/cctest/compiler/test-gap-resolver.cc index 3b1cdb6d81..1cceb9cd59 100644 --- a/deps/v8/test/cctest/compiler/test-gap-resolver.cc +++ b/deps/v8/test/cctest/compiler/test-gap-resolver.cc @@ -13,15 +13,32 @@ namespace compiler { const auto GetRegConfig = RegisterConfiguration::Turbofan; -// Fragments the given operand into an equivalent set of operands to simplify -// ParallelMove equivalence testing. +// Fragments the given FP operand into an equivalent set of FP 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); + const LocationOperand& loc = LocationOperand::cast(op); + MachineRepresentation rep = loc.representation(); + int base = -1; + int aliases = GetRegConfig()->GetAliases( + rep, 0, MachineRepresentation::kFloat32, &base); + CHECK_LT(0, aliases); + CHECK_GE(4, aliases); + int index = -1; + int step = 1; + if (op.IsFPRegister()) { + index = loc.register_code() * aliases; + } else { + index = loc.index(); + step = -1; + } + for (int i = 0; i < aliases; i++) { + fragments->push_back(AllocatedOperand(loc.location_kind(), + MachineRepresentation::kFloat32, + index + i * step)); + } } // The state of our move interpreter is the mapping of operands to values. Note @@ -36,7 +53,9 @@ class InterpreterState { const InstructionOperand& dst = m->destination(); if (!kSimpleFPAliasing && src.IsFPLocationOperand() && dst.IsFPLocationOperand()) { - // Canonicalize FP location-location moves. + // Canonicalize FP location-location moves by fragmenting them into + // an equivalent sequence of float32 moves, to simplify state + // equivalence testing. std::vector<InstructionOperand> src_fragments; GetCanonicalOperands(src, &src_fragments); CHECK(!src_fragments.empty()); @@ -115,9 +134,11 @@ class InterpreterState { int index; if (!is_constant) { const LocationOperand& loc_op = LocationOperand::cast(op); - // Canonicalize FP location operand representations to kFloat64. + // Preserve FP representation when FP register aliasing is complex. + // Otherwise, canonicalize to kFloat64. if (IsFloatingPoint(loc_op.representation())) { - rep = MachineRepresentation::kFloat64; + rep = kSimpleFPAliasing ? MachineRepresentation::kFloat64 + : loc_op.representation(); } if (loc_op.IsAnyRegister()) { index = loc_op.register_code(); @@ -321,9 +342,11 @@ class ParallelMoveCreator : public HandleAndZoneScope { auto GetValidRegisterCode = [&conf](MachineRepresentation rep, int index) { switch (rep) { case MachineRepresentation::kFloat32: + return conf->RegisterConfiguration::GetAllocatableFloatCode(index); case MachineRepresentation::kFloat64: - case MachineRepresentation::kSimd128: return conf->RegisterConfiguration::GetAllocatableDoubleCode(index); + case MachineRepresentation::kSimd128: + return conf->RegisterConfiguration::GetAllocatableSimd128Code(index); default: return conf->RegisterConfiguration::GetAllocatableGeneralCode(index); } @@ -368,6 +391,118 @@ void RunTest(ParallelMove* pm, Zone* zone) { CHECK_EQ(mi1.state(), mi2.state()); } +TEST(Aliasing) { + // On platforms with simple aliasing, these parallel moves are ill-formed. + if (kSimpleFPAliasing) return; + + ParallelMoveCreator pmc; + Zone* zone = pmc.main_zone(); + + auto s0 = AllocatedOperand(LocationOperand::REGISTER, + MachineRepresentation::kFloat32, 0); + auto s1 = AllocatedOperand(LocationOperand::REGISTER, + MachineRepresentation::kFloat32, 1); + auto s2 = AllocatedOperand(LocationOperand::REGISTER, + MachineRepresentation::kFloat32, 2); + auto s3 = AllocatedOperand(LocationOperand::REGISTER, + MachineRepresentation::kFloat32, 3); + auto s4 = AllocatedOperand(LocationOperand::REGISTER, + MachineRepresentation::kFloat32, 4); + + auto d0 = AllocatedOperand(LocationOperand::REGISTER, + MachineRepresentation::kFloat64, 0); + auto d1 = AllocatedOperand(LocationOperand::REGISTER, + MachineRepresentation::kFloat64, 1); + auto d16 = AllocatedOperand(LocationOperand::REGISTER, + MachineRepresentation::kFloat64, 16); + + // Double slots must be odd to match frame allocation. + auto dSlot = AllocatedOperand(LocationOperand::STACK_SLOT, + MachineRepresentation::kFloat64, 3); + + // Cycles involving s- and d-registers. + { + std::vector<InstructionOperand> moves = { + s2, s0, // s2 <- s0 + d0, d1 // d0 <- d1 + }; + RunTest(pmc.Create(moves), zone); + } + { + std::vector<InstructionOperand> moves = { + d0, d1, // d0 <- d1 + s2, s0 // s2 <- s0 + }; + RunTest(pmc.Create(moves), zone); + } + { + std::vector<InstructionOperand> moves = { + s2, s1, // s2 <- s1 + d0, d1 // d0 <- d1 + }; + RunTest(pmc.Create(moves), zone); + } + { + std::vector<InstructionOperand> moves = { + d0, d1, // d0 <- d1 + s2, s1 // s2 <- s1 + }; + RunTest(pmc.Create(moves), zone); + } + // Two cycles involving a single d-register. + { + std::vector<InstructionOperand> moves = { + d0, d1, // d0 <- d1 + s2, s1, // s2 <- s1 + s3, s0 // s3 <- s0 + }; + RunTest(pmc.Create(moves), zone); + } + // Cycle with a float move that must be deferred until after swaps. + { + std::vector<InstructionOperand> moves = { + d0, d1, // d0 <- d1 + s2, s0, // s2 <- s0 + s3, s4 // s3 <- s4 must be deferred + }; + RunTest(pmc.Create(moves), zone); + } + // Cycles involving s-registers and a non-aliased d-register. + { + std::vector<InstructionOperand> moves = { + d16, d0, // d16 <- d0 + s1, s2, // s1 <- s2 + d1, d16 // d1 <- d16 + }; + RunTest(pmc.Create(moves), zone); + } + { + std::vector<InstructionOperand> moves = { + s2, s1, // s1 <- s2 + d0, d16, // d16 <- d0 + d16, d1 // d1 <- d16 + }; + RunTest(pmc.Create(moves), zone); + } + { + std::vector<InstructionOperand> moves = { + d0, d16, // d0 <- d16 + d16, d1, // s2 <- s0 + s3, s0 // d0 <- d1 + }; + RunTest(pmc.Create(moves), zone); + } + // Cycle involving aliasing registers and a slot. + { + std::vector<InstructionOperand> moves = { + dSlot, d0, // dSlot <- d0 + d1, dSlot, // d1 <- dSlot + s0, s3 // s0 <- s3 + }; + RunTest(pmc.Create(moves), zone); + } +} + TEST(FuzzResolver) { ParallelMoveCreator pmc; for (int size = 0; size < 80; ++size) { diff --git a/deps/v8/test/cctest/compiler/test-graph-visualizer.cc b/deps/v8/test/cctest/compiler/test-graph-visualizer.cc index 48be46ce5f..842a23bdbc 100644 --- a/deps/v8/test/cctest/compiler/test-graph-visualizer.cc +++ b/deps/v8/test/cctest/compiler/test-graph-visualizer.cc @@ -3,15 +3,15 @@ // found in the LICENSE file. #include "src/compiler/common-operator.h" -#include "src/compiler/graph.h" +#include "src/compiler/compiler-source-position-table.h" #include "src/compiler/graph-visualizer.h" +#include "src/compiler/graph.h" #include "src/compiler/js-operator.h" #include "src/compiler/machine-operator.h" #include "src/compiler/node.h" #include "src/compiler/operator.h" #include "src/compiler/schedule.h" #include "src/compiler/scheduler.h" -#include "src/compiler/source-position.h" #include "src/compiler/verifier.h" #include "test/cctest/cctest.h" diff --git a/deps/v8/test/cctest/compiler/test-instruction.cc b/deps/v8/test/cctest/compiler/test-instruction.cc index 5265e476aa..15749b8950 100644 --- a/deps/v8/test/cctest/compiler/test-instruction.cc +++ b/deps/v8/test/cctest/compiler/test-instruction.cc @@ -269,7 +269,7 @@ TEST(InstructionAddGapMove) { TEST(InstructionOperands) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); { TestInstr* i = TestInstr::New(&zone, 101); diff --git a/deps/v8/test/cctest/compiler/test-js-context-specialization.cc b/deps/v8/test/cctest/compiler/test-js-context-specialization.cc index e9bf064750..023ef483ea 100644 --- a/deps/v8/test/cctest/compiler/test-js-context-specialization.cc +++ b/deps/v8/test/cctest/compiler/test-js-context-specialization.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/compiler/compiler-source-position-table.h" #include "src/compiler/js-context-specialization.h" #include "src/compiler/js-graph.h" #include "src/compiler/js-operator.h" #include "src/compiler/node-matchers.h" #include "src/compiler/node-properties.h" -#include "src/compiler/source-position.h" #include "test/cctest/cctest.h" #include "test/cctest/compiler/function-tester.h" #include "test/cctest/compiler/graph-builder-tester.h" 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 604e696ab5..f504e549fd 100644 --- a/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc +++ b/deps/v8/test/cctest/compiler/test-js-typed-lowering.cc @@ -38,7 +38,7 @@ class JSTypedLoweringTester : public HandleAndZoneScope { common(main_zone()), deps(main_isolate(), main_zone()), graph(main_zone()), - typer(main_isolate(), &graph), + typer(main_isolate(), Typer::kNoFlags, &graph), context_node(NULL), flags(flags) { graph.SetStart(graph.NewNode(common.Start(num_parameters))); @@ -169,11 +169,6 @@ class JSTypedLoweringTester : public HandleAndZoneScope { CHECK_EQ(effect, NodeProperties::GetEffectInput(use)); } - void CheckInt32Constant(int32_t expected, Node* result) { - CHECK_EQ(IrOpcode::kInt32Constant, result->opcode()); - CHECK_EQ(expected, OpParameter<int32_t>(result)); - } - void CheckNumberConstant(double expected, Node* result) { CHECK_EQ(IrOpcode::kNumberConstant, result->opcode()); CHECK_EQ(expected, OpParameter<double>(result)); @@ -694,6 +689,7 @@ TEST(RemoveToNumberEffects) { JSTypedLoweringTester R; Node* effect_use = NULL; + Node* zero = R.graph.NewNode(R.common.NumberConstant(0)); for (int i = 0; i < 10; i++) { Node* p0 = R.Parameter(Type::Number()); Node* ton = R.Unop(R.javascript.ToNumber(), p0); @@ -724,10 +720,12 @@ TEST(RemoveToNumberEffects) { R.context(), frame_state, ton, R.start()); break; case 5: - effect_use = R.graph.NewNode(R.common.Return(), p0, ton, R.start()); + effect_use = + R.graph.NewNode(R.common.Return(), zero, p0, ton, R.start()); break; case 6: - effect_use = R.graph.NewNode(R.common.Return(), ton, ton, R.start()); + effect_use = + R.graph.NewNode(R.common.Return(), zero, ton, ton, R.start()); } R.CheckEffectInput(R.start(), ton); diff --git a/deps/v8/test/cctest/compiler/test-jump-threading.cc b/deps/v8/test/cctest/compiler/test-jump-threading.cc index e58de67afc..a756254d82 100644 --- a/deps/v8/test/cctest/compiler/test-jump-threading.cc +++ b/deps/v8/test/cctest/compiler/test-jump-threading.cc @@ -107,7 +107,7 @@ class TestCode : public HandleAndZoneScope { void VerifyForwarding(TestCode& code, int count, int* expected) { v8::internal::AccountingAllocator allocator; - Zone local_zone(&allocator); + Zone local_zone(&allocator, ZONE_NAME); 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 59ef5fdd25..fef3415984 100644 --- a/deps/v8/test/cctest/compiler/test-linkage.cc +++ b/deps/v8/test/cctest/compiler/test-linkage.cc @@ -43,7 +43,7 @@ static Handle<JSFunction> Compile(const char* source) { TEST(TestLinkageCreate) { HandleAndZoneScope handles; Handle<JSFunction> function = Compile("a + b"); - ParseInfo parse_info(handles.main_zone(), function); + ParseInfo parse_info(handles.main_zone(), handle(function->shared())); CompilationInfo info(&parse_info, function); CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); CHECK(descriptor); @@ -59,7 +59,7 @@ TEST(TestLinkageJSFunctionIncoming) { Handle<JSFunction> function = Handle<JSFunction>::cast(v8::Utils::OpenHandle( *v8::Local<v8::Function>::Cast(CompileRun(sources[i])))); - ParseInfo parse_info(handles.main_zone(), function); + ParseInfo parse_info(handles.main_zone(), handle(function->shared())); CompilationInfo info(&parse_info, function); CallDescriptor* descriptor = Linkage::ComputeIncoming(info.zone(), &info); CHECK(descriptor); @@ -75,7 +75,7 @@ TEST(TestLinkageJSFunctionIncoming) { TEST(TestLinkageJSCall) { HandleAndZoneScope handles; Handle<JSFunction> function = Compile("a + c"); - ParseInfo parse_info(handles.main_zone(), function); + ParseInfo parse_info(handles.main_zone(), handle(function->shared())); CompilationInfo info(&parse_info, function); for (int i = 0; i < 32; i++) { @@ -97,7 +97,7 @@ TEST(TestLinkageRuntimeCall) { TEST(TestLinkageStubCall) { Isolate* isolate = CcTest::InitIsolateOnce(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); Callable callable = CodeFactory::ToNumber(isolate); CompilationInfo info(ArrayVector("test"), isolate, &zone, Code::ComputeFlags(Code::STUB)); diff --git a/deps/v8/test/cctest/compiler/test-loop-analysis.cc b/deps/v8/test/cctest/compiler/test-loop-analysis.cc index fb61e20197..ffb0872269 100644 --- a/deps/v8/test/cctest/compiler/test-loop-analysis.cc +++ b/deps/v8/test/cctest/compiler/test-loop-analysis.cc @@ -116,7 +116,8 @@ class LoopFinderTester : HandleAndZoneScope { } Node* Return(Node* val, Node* effect, Node* control) { - Node* ret = graph.NewNode(common.Return(), val, effect, control); + Node* zero = graph.NewNode(common.Int32Constant(0)); + Node* ret = graph.NewNode(common.Return(), zero, val, effect, control); end->ReplaceInput(0, ret); return ret; } @@ -127,7 +128,7 @@ class LoopFinderTester : HandleAndZoneScope { OFStream os(stdout); os << AsRPO(graph); } - Zone zone(main_isolate()->allocator()); + Zone zone(main_isolate()->allocator(), ZONE_NAME); loop_tree = LoopFinder::BuildLoopTree(&graph, &zone); } return loop_tree; @@ -696,7 +697,8 @@ TEST(LaEdgeMatrix1) { Node* if_true = t.graph.NewNode(t.common.IfTrue(), branch); Node* exit = t.graph.NewNode(t.common.IfFalse(), branch); loop->ReplaceInput(1, if_true); - Node* ret = t.graph.NewNode(t.common.Return(), p3, t.start, exit); + Node* zero = t.graph.NewNode(t.common.Int32Constant(0)); + Node* ret = t.graph.NewNode(t.common.Return(), zero, p3, t.start, exit); t.graph.SetEnd(ret); Node* choices[] = {p1, phi, cond}; @@ -743,7 +745,9 @@ void RunEdgeMatrix2(int i) { loop2->ReplaceInput(1, if_true2); loop1->ReplaceInput(1, exit2); - Node* ret = t.graph.NewNode(t.common.Return(), phi1, t.start, exit1); + Node* zero = t.graph.NewNode(t.common.Int32Constant(0)); + Node* ret = + t.graph.NewNode(t.common.Return(), zero, phi1, t.start, exit1); t.graph.SetEnd(ret); Node* choices[] = {p1, phi1, cond1, phi2, cond2}; @@ -830,7 +834,8 @@ void RunEdgeMatrix3(int c1a, int c1b, int c1c, // line break loop2->ReplaceInput(1, exit3); loop1->ReplaceInput(1, exit2); - Node* ret = t.graph.NewNode(t.common.Return(), phi1, t.start, exit1); + Node* zero = t.graph.NewNode(t.common.Int32Constant(0)); + Node* ret = t.graph.NewNode(t.common.Return(), zero, phi1, t.start, exit1); t.graph.SetEnd(ret); // Mutate the graph according to the edge choices. @@ -943,7 +948,8 @@ static void RunManyChainedLoops_i(int count) { last = exit; } - Node* ret = t.graph.NewNode(t.common.Return(), t.p0, t.start, last); + Node* zero = t.graph.NewNode(t.common.Int32Constant(0)); + Node* ret = t.graph.NewNode(t.common.Return(), zero, t.p0, t.start, last); t.graph.SetEnd(ret); // Verify loops. @@ -962,6 +968,7 @@ static void RunManyNestedLoops_i(int count) { Node* entry = t.start; // Build loops. + Node* zero = t.graph.NewNode(t.common.Int32Constant(0)); for (int i = 0; i < count; i++) { Node* loop = t.graph.NewNode(t.common.Loop(2), entry, t.start); Node* phi = t.graph.NewNode(t.common.Phi(MachineRepresentation::kWord32, 2), @@ -981,7 +988,7 @@ static void RunManyNestedLoops_i(int count) { outer->ReplaceInput(1, exit); } else { // outer loop. - Node* ret = t.graph.NewNode(t.common.Return(), t.p0, t.start, exit); + Node* ret = t.graph.NewNode(t.common.Return(), zero, t.p0, t.start, exit); t.graph.SetEnd(ret); } outer = loop; 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 d97e038883..7ae14b54c8 100644 --- a/deps/v8/test/cctest/compiler/test-loop-assignment-analysis.cc +++ b/deps/v8/test/cctest/compiler/test-loop-assignment-analysis.cc @@ -32,7 +32,7 @@ struct TestHelper : public HandleAndZoneScope { void CheckLoopAssignedCount(int expected, const char* var_name) { // TODO(titzer): don't scope analyze every single time. - ParseInfo parse_info(main_zone(), function); + ParseInfo parse_info(main_zone(), handle(function->shared())); CompilationInfo info(&parse_info, function); CHECK(Parser::ParseStatic(&parse_info)); diff --git a/deps/v8/test/cctest/compiler/test-multiple-return.cc b/deps/v8/test/cctest/compiler/test-multiple-return.cc index 6cda32c792..39824b5155 100644 --- a/deps/v8/test/cctest/compiler/test-multiple-return.cc +++ b/deps/v8/test/cctest/compiler/test-multiple-return.cc @@ -65,7 +65,7 @@ CallDescriptor* GetCallDescriptor(Zone* zone, int return_count, TEST(ReturnThreeValues) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); CallDescriptor* desc = GetCallDescriptor(&zone, 3, 2); HandleAndZoneScope handles; RawMachineAssembler m(handles.main_isolate(), diff --git a/deps/v8/test/cctest/compiler/test-node.cc b/deps/v8/test/cctest/compiler/test-node.cc index c5fc5b3c50..5137db4a52 100644 --- a/deps/v8/test/cctest/compiler/test-node.cc +++ b/deps/v8/test/cctest/compiler/test-node.cc @@ -142,7 +142,7 @@ void CheckInputs(Node* node, Node** inputs, int input_count) { TEST(NodeUseIteratorReplaceUses) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); Node* n1 = graph.NewNode(&dummy_operator1, n0); @@ -168,7 +168,7 @@ TEST(NodeUseIteratorReplaceUses) { TEST(NodeUseIteratorReplaceUsesSelf) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); Node* n1 = graph.NewNode(&dummy_operator1, n0); @@ -193,7 +193,7 @@ TEST(NodeUseIteratorReplaceUsesSelf) { TEST(ReplaceInput) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); Node* n1 = graph.NewNode(&dummy_operator0); @@ -220,7 +220,7 @@ TEST(ReplaceInput) { TEST(OwnedBy) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); { @@ -271,7 +271,7 @@ TEST(OwnedBy) { TEST(Uses) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -294,7 +294,7 @@ TEST(Uses) { TEST(Inputs) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -322,7 +322,7 @@ TEST(Inputs) { TEST(InsertInputs) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -397,7 +397,7 @@ TEST(InsertInputs) { TEST(RemoveInput) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -428,7 +428,7 @@ TEST(RemoveInput) { TEST(AppendInputsAndIterator) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -451,7 +451,7 @@ TEST(AppendInputsAndIterator) { TEST(NullInputsSimple) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -479,7 +479,7 @@ TEST(NullInputsSimple) { TEST(NullInputsAppended) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -503,7 +503,7 @@ TEST(NullInputsAppended) { TEST(ReplaceUsesFromAppendedInputs) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -532,7 +532,7 @@ TEST(ReplaceUsesFromAppendedInputs) { TEST(ReplaceInputMultipleUses) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* n0 = graph.NewNode(&dummy_operator0); @@ -551,7 +551,7 @@ TEST(ReplaceInputMultipleUses) { TEST(TrimInputCountInline) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); { @@ -620,7 +620,7 @@ TEST(TrimInputCountInline) { TEST(TrimInputCountOutOfLine1) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); { @@ -715,7 +715,7 @@ TEST(TrimInputCountOutOfLine1) { TEST(TrimInputCountOutOfLine2) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); { @@ -785,7 +785,7 @@ TEST(TrimInputCountOutOfLine2) { TEST(NullAllInputs) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); for (int i = 0; i < 2; i++) { @@ -838,7 +838,7 @@ TEST(NullAllInputs) { TEST(AppendAndTrim) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); Node* nodes[] = { diff --git a/deps/v8/test/cctest/compiler/test-osr.cc b/deps/v8/test/cctest/compiler/test-osr.cc deleted file mode 100644 index 9e3445ac0b..0000000000 --- a/deps/v8/test/cctest/compiler/test-osr.cc +++ /dev/null @@ -1,575 +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/codegen.h" -#include "src/compiler/all-nodes.h" -#include "src/compiler/common-operator.h" -#include "src/compiler/diamond.h" -#include "src/compiler/graph.h" -#include "src/compiler/js-graph.h" -#include "src/compiler/js-operator.h" -#include "src/compiler/operator.h" -#include "src/compiler/osr.h" -#include "test/cctest/cctest.h" - -namespace v8 { -namespace internal { -namespace compiler { - -// TODO(titzer): move this method to a common testing place. - -static int CheckInputs(Node* node, Node* i0 = NULL, Node* i1 = NULL, - Node* i2 = NULL, Node* i3 = NULL) { - int count = 4; - if (i3 == NULL) count = 3; - if (i2 == NULL) count = 2; - if (i1 == NULL) count = 1; - if (i0 == NULL) count = 0; - CHECK_EQ(count, node->InputCount()); - if (i0 != NULL) CHECK_EQ(i0, node->InputAt(0)); - if (i1 != NULL) CHECK_EQ(i1, node->InputAt(1)); - if (i2 != NULL) CHECK_EQ(i2, node->InputAt(2)); - if (i3 != NULL) CHECK_EQ(i3, node->InputAt(3)); - return count; -} - - -static Operator kIntLt(IrOpcode::kInt32LessThan, Operator::kPure, - "Int32LessThan", 2, 0, 0, 1, 0, 0); -static Operator kIntAdd(IrOpcode::kInt32Add, Operator::kPure, "Int32Add", 2, 0, - 0, 1, 0, 0); - - -static const int kMaxOsrValues = 10; - -class OsrDeconstructorTester : public HandleAndZoneScope { - public: - explicit OsrDeconstructorTester(int num_values) - : isolate(main_isolate()), - common(main_zone()), - graph(main_zone()), - jsgraph(main_isolate(), &graph, &common, nullptr, nullptr, nullptr), - start(graph.NewNode(common.Start(1))), - p0(graph.NewNode(common.Parameter(0), start)), - end(graph.NewNode(common.End(1), start)), - osr_normal_entry(graph.NewNode(common.OsrNormalEntry(), start, start)), - osr_loop_entry(graph.NewNode(common.OsrLoopEntry(), start, start)), - self(graph.NewNode(common.Int32Constant(0xaabbccdd))) { - CHECK(num_values <= kMaxOsrValues); - graph.SetStart(start); - for (int i = 0; i < num_values; i++) { - osr_values[i] = graph.NewNode(common.OsrValue(i), osr_loop_entry); - } - } - - Isolate* isolate; - CommonOperatorBuilder common; - Graph graph; - JSGraph jsgraph; - Node* start; - Node* p0; - Node* end; - Node* osr_normal_entry; - Node* osr_loop_entry; - Node* self; - Node* osr_values[kMaxOsrValues]; - - Node* NewOsrPhi(Node* loop, Node* incoming, int osr_value, Node* back1 = NULL, - Node* back2 = NULL, Node* back3 = NULL) { - int count = 5; - if (back3 == NULL) count = 4; - if (back2 == NULL) count = 3; - if (back1 == NULL) count = 2; - CHECK_EQ(loop->InputCount(), count); - CHECK_EQ(osr_loop_entry, loop->InputAt(1)); - - Node* inputs[6]; - inputs[0] = incoming; - inputs[1] = osr_values[osr_value]; - if (count > 2) inputs[2] = back1; - if (count > 3) inputs[3] = back2; - if (count > 4) inputs[4] = back3; - inputs[count] = loop; - return graph.NewNode(common.Phi(MachineRepresentation::kTagged, count), - count + 1, inputs); - } - - Node* NewLoop(bool is_osr, int num_backedges, Node* entry = nullptr) { - if (entry == nullptr) entry = osr_normal_entry; - Node* loop = graph.NewNode(common.Loop(1), entry); - if (is_osr) { - loop->AppendInput(graph.zone(), osr_loop_entry); - } - for (int i = 0; i < num_backedges; i++) { - loop->AppendInput(graph.zone(), loop); - } - NodeProperties::ChangeOp(loop, common.Loop(loop->InputCount())); - return loop; - } - - Node* NewOsrLoop(int num_backedges, Node* entry = NULL) { - return NewLoop(true, num_backedges, entry); - } - - void DeconstructOsr() { - OsrHelper helper(0, 0); - helper.Deconstruct(&jsgraph, &common, main_zone()); - AllNodes nodes(main_zone(), &graph); - // Should be edited out. - CHECK(!nodes.IsLive(osr_normal_entry)); - CHECK(!nodes.IsLive(osr_loop_entry)); - // No dangling nodes should be left over. - for (Node* const node : nodes.reachable) { - for (Node* const use : node->uses()) { - CHECK(std::find(nodes.reachable.begin(), nodes.reachable.end(), use) != - nodes.reachable.end()); - } - } - } -}; - - -TEST(Deconstruct_osr0) { - OsrDeconstructorTester T(0); - - Node* loop = T.NewOsrLoop(1); - - T.graph.SetEnd(loop); - - T.DeconstructOsr(); - - CheckInputs(loop, T.start, loop); -} - - -TEST(Deconstruct_osr1) { - OsrDeconstructorTester T(1); - - Node* loop = T.NewOsrLoop(1); - Node* osr_phi = - T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); - - Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, loop); - T.graph.SetEnd(ret); - - T.DeconstructOsr(); - - CheckInputs(loop, T.start, loop); - CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); - CheckInputs(ret, osr_phi, T.start, loop); -} - - -TEST(Deconstruct_osr_remove_prologue) { - OsrDeconstructorTester T(1); - Diamond d(&T.graph, &T.common, T.p0); - d.Chain(T.osr_normal_entry); - - Node* loop = T.NewOsrLoop(1, d.merge); - Node* osr_phi = - T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); - - Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, loop); - T.graph.SetEnd(ret); - - T.DeconstructOsr(); - - CheckInputs(loop, T.start, loop); - CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); - CheckInputs(ret, osr_phi, T.start, loop); - - // The control before the loop should have been removed. - AllNodes nodes(T.main_zone(), &T.graph); - CHECK(!nodes.IsLive(d.branch)); - CHECK(!nodes.IsLive(d.if_true)); - CHECK(!nodes.IsLive(d.if_false)); - CHECK(!nodes.IsLive(d.merge)); -} - - -TEST(Deconstruct_osr_with_body1) { - OsrDeconstructorTester T(1); - - Node* loop = T.NewOsrLoop(1); - - Node* branch = T.graph.NewNode(T.common.Branch(), T.p0, loop); - Node* if_true = T.graph.NewNode(T.common.IfTrue(), branch); - Node* if_false = T.graph.NewNode(T.common.IfFalse(), branch); - loop->ReplaceInput(2, if_true); - - Node* osr_phi = - T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); - - Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, if_false); - T.graph.SetEnd(ret); - - T.DeconstructOsr(); - - CheckInputs(loop, T.start, if_true); - CheckInputs(branch, T.p0, loop); - CheckInputs(if_true, branch); - CheckInputs(if_false, branch); - CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); - CheckInputs(ret, osr_phi, T.start, if_false); -} - - -TEST(Deconstruct_osr_with_body2) { - OsrDeconstructorTester T(1); - - Node* loop = T.NewOsrLoop(1); - - // Two chained branches in the the body of the loop. - Node* branch1 = T.graph.NewNode(T.common.Branch(), T.p0, loop); - Node* if_true1 = T.graph.NewNode(T.common.IfTrue(), branch1); - Node* if_false1 = T.graph.NewNode(T.common.IfFalse(), branch1); - - Node* branch2 = T.graph.NewNode(T.common.Branch(), T.p0, if_true1); - Node* if_true2 = T.graph.NewNode(T.common.IfTrue(), branch2); - Node* if_false2 = T.graph.NewNode(T.common.IfFalse(), branch2); - loop->ReplaceInput(2, if_true2); - - Node* osr_phi = - T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant()); - - Node* merge = T.graph.NewNode(T.common.Merge(2), if_false1, if_false2); - Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, merge); - T.graph.SetEnd(ret); - - T.DeconstructOsr(); - - CheckInputs(loop, T.start, if_true2); - CheckInputs(branch1, T.p0, loop); - CheckInputs(branch2, T.p0, if_true1); - CheckInputs(if_true1, branch1); - CheckInputs(if_false1, branch1); - CheckInputs(if_true2, branch2); - CheckInputs(if_false2, branch2); - - CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), loop); - CheckInputs(ret, osr_phi, T.start, merge); - CheckInputs(merge, if_false1, if_false2); -} - - -TEST(Deconstruct_osr_with_body3) { - OsrDeconstructorTester T(1); - - Node* loop = T.NewOsrLoop(2); - - // Two branches that create two different backedges. - Node* branch1 = T.graph.NewNode(T.common.Branch(), T.p0, loop); - Node* if_true1 = T.graph.NewNode(T.common.IfTrue(), branch1); - Node* if_false1 = T.graph.NewNode(T.common.IfFalse(), branch1); - - Node* branch2 = T.graph.NewNode(T.common.Branch(), T.p0, if_true1); - Node* if_true2 = T.graph.NewNode(T.common.IfTrue(), branch2); - Node* if_false2 = T.graph.NewNode(T.common.IfFalse(), branch2); - loop->ReplaceInput(2, if_false1); - loop->ReplaceInput(3, if_true2); - - Node* osr_phi = - T.NewOsrPhi(loop, T.jsgraph.OneConstant(), 0, T.jsgraph.ZeroConstant(), - T.jsgraph.ZeroConstant()); - - Node* ret = T.graph.NewNode(T.common.Return(), osr_phi, T.start, if_false2); - T.graph.SetEnd(ret); - - T.DeconstructOsr(); - - CheckInputs(loop, T.start, if_false1, if_true2); - CheckInputs(branch1, T.p0, loop); - CheckInputs(branch2, T.p0, if_true1); - CheckInputs(if_true1, branch1); - CheckInputs(if_false1, branch1); - CheckInputs(if_true2, branch2); - CheckInputs(if_false2, branch2); - - CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.ZeroConstant(), - T.jsgraph.ZeroConstant(), loop); - CheckInputs(ret, osr_phi, T.start, if_false2); -} - - -struct While { - OsrDeconstructorTester& t; - Node* branch; - Node* if_true; - Node* exit; - Node* loop; - - While(OsrDeconstructorTester& R, Node* cond, bool is_osr, int backedges = 1) - : t(R) { - loop = t.NewLoop(is_osr, backedges); - branch = t.graph.NewNode(t.common.Branch(), cond, loop); - if_true = t.graph.NewNode(t.common.IfTrue(), branch); - exit = t.graph.NewNode(t.common.IfFalse(), branch); - loop->ReplaceInput(loop->InputCount() - 1, if_true); - } - - void Nest(While& that) { - that.loop->ReplaceInput(that.loop->InputCount() - 1, exit); - this->loop->ReplaceInput(0, that.if_true); - } - - Node* Phi(Node* i1, Node* i2, Node* i3) { - if (loop->InputCount() == 2) { - return t.graph.NewNode(t.common.Phi(MachineRepresentation::kTagged, 2), - i1, i2, loop); - } else { - return t.graph.NewNode(t.common.Phi(MachineRepresentation::kTagged, 3), - i1, i2, i3, loop); - } - } -}; - - -static Node* FindSuccessor(Node* node, IrOpcode::Value opcode) { - for (Node* use : node->uses()) { - if (use->opcode() == opcode) return use; - } - UNREACHABLE(); // should have been found. - return nullptr; -} - - -TEST(Deconstruct_osr_nested1) { - OsrDeconstructorTester T(1); - - While outer(T, T.p0, false); - While inner(T, T.p0, true); - inner.Nest(outer); - - Node* outer_phi = outer.Phi(T.p0, T.p0, nullptr); - outer.branch->ReplaceInput(0, outer_phi); - - Node* osr_phi = inner.Phi(T.jsgraph.TrueConstant(), T.osr_values[0], - T.jsgraph.FalseConstant()); - inner.branch->ReplaceInput(0, osr_phi); - outer_phi->ReplaceInput(1, osr_phi); - - Node* ret = - T.graph.NewNode(T.common.Return(), outer_phi, T.start, outer.exit); - Node* end = T.graph.NewNode(T.common.End(1), ret); - T.graph.SetEnd(end); - - T.DeconstructOsr(); - - // Check structure of deconstructed graph. - // Check inner OSR loop is directly connected to start. - CheckInputs(inner.loop, T.start, inner.if_true); - CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.FalseConstant(), inner.loop); - - // Check control transfer to copy of outer loop. - Node* new_outer_loop = FindSuccessor(inner.exit, IrOpcode::kLoop); - Node* new_outer_phi = FindSuccessor(new_outer_loop, IrOpcode::kPhi); - CHECK_NE(new_outer_loop, outer.loop); - CHECK_NE(new_outer_phi, outer_phi); - - CheckInputs(new_outer_loop, inner.exit, new_outer_loop->InputAt(1)); - - // Check structure of outer loop. - Node* new_outer_branch = FindSuccessor(new_outer_loop, IrOpcode::kBranch); - CHECK_NE(new_outer_branch, outer.branch); - CheckInputs(new_outer_branch, new_outer_phi, new_outer_loop); - Node* new_outer_exit = FindSuccessor(new_outer_branch, IrOpcode::kIfFalse); - Node* new_outer_if_true = FindSuccessor(new_outer_branch, IrOpcode::kIfTrue); - - // Check structure of return. - end = T.graph.end(); - Node* new_ret = end->InputAt(0); - CHECK_EQ(IrOpcode::kReturn, new_ret->opcode()); - CheckInputs(new_ret, new_outer_phi, T.start, new_outer_exit); - - // Check structure of inner loop. - Node* new_inner_loop = FindSuccessor(new_outer_if_true, IrOpcode::kLoop); - Node* new_inner_phi = FindSuccessor(new_inner_loop, IrOpcode::kPhi); - - CheckInputs(new_inner_phi, T.jsgraph.TrueConstant(), - T.jsgraph.FalseConstant(), new_inner_loop); - CheckInputs(new_outer_phi, osr_phi, new_inner_phi, new_outer_loop); -} - - -TEST(Deconstruct_osr_nested2) { - OsrDeconstructorTester T(1); - - // Test multiple backedge outer loop. - While outer(T, T.p0, false, 2); - While inner(T, T.p0, true); - inner.Nest(outer); - - Node* outer_phi = outer.Phi(T.p0, T.p0, T.p0); - outer.branch->ReplaceInput(0, outer_phi); - - Node* osr_phi = inner.Phi(T.jsgraph.TrueConstant(), T.osr_values[0], - T.jsgraph.FalseConstant()); - inner.branch->ReplaceInput(0, osr_phi); - outer_phi->ReplaceInput(1, osr_phi); - outer_phi->ReplaceInput(2, T.jsgraph.FalseConstant()); - - Node* x_branch = T.graph.NewNode(T.common.Branch(), osr_phi, inner.exit); - Node* x_true = T.graph.NewNode(T.common.IfTrue(), x_branch); - Node* x_false = T.graph.NewNode(T.common.IfFalse(), x_branch); - - outer.loop->ReplaceInput(1, x_true); - outer.loop->ReplaceInput(2, x_false); - - Node* ret = - T.graph.NewNode(T.common.Return(), outer_phi, T.start, outer.exit); - Node* end = T.graph.NewNode(T.common.End(1), ret); - T.graph.SetEnd(end); - - T.DeconstructOsr(); - - // Check structure of deconstructed graph. - // Check inner OSR loop is directly connected to start. - CheckInputs(inner.loop, T.start, inner.if_true); - CheckInputs(osr_phi, T.osr_values[0], T.jsgraph.FalseConstant(), inner.loop); - - // Check control transfer to copy of outer loop. - Node* new_merge = FindSuccessor(x_true, IrOpcode::kMerge); - CHECK_EQ(new_merge, FindSuccessor(x_false, IrOpcode::kMerge)); - CheckInputs(new_merge, x_true, x_false); - - Node* new_outer_loop = FindSuccessor(new_merge, IrOpcode::kLoop); - Node* new_outer_phi = FindSuccessor(new_outer_loop, IrOpcode::kPhi); - CHECK_NE(new_outer_loop, outer.loop); - CHECK_NE(new_outer_phi, outer_phi); - - Node* new_entry_phi = FindSuccessor(new_merge, IrOpcode::kPhi); - CheckInputs(new_entry_phi, osr_phi, T.jsgraph.FalseConstant(), new_merge); - - CHECK_EQ(new_merge, new_outer_loop->InputAt(0)); - - // Check structure of outer loop. - Node* new_outer_branch = FindSuccessor(new_outer_loop, IrOpcode::kBranch); - CHECK_NE(new_outer_branch, outer.branch); - CheckInputs(new_outer_branch, new_outer_phi, new_outer_loop); - Node* new_outer_exit = FindSuccessor(new_outer_branch, IrOpcode::kIfFalse); - Node* new_outer_if_true = FindSuccessor(new_outer_branch, IrOpcode::kIfTrue); - - // Check structure of return. - end = T.graph.end(); - Node* new_ret = end->InputAt(0); - CHECK_EQ(IrOpcode::kReturn, new_ret->opcode()); - CheckInputs(new_ret, new_outer_phi, T.start, new_outer_exit); - - // Check structure of inner loop. - Node* new_inner_loop = FindSuccessor(new_outer_if_true, IrOpcode::kLoop); - Node* new_inner_phi = FindSuccessor(new_inner_loop, IrOpcode::kPhi); - - CheckInputs(new_inner_phi, T.jsgraph.TrueConstant(), - T.jsgraph.FalseConstant(), new_inner_loop); - CheckInputs(new_outer_phi, new_entry_phi, new_inner_phi, - T.jsgraph.FalseConstant(), new_outer_loop); -} - - -Node* MakeCounter(JSGraph* jsgraph, Node* start, Node* loop) { - int count = loop->InputCount(); - NodeVector tmp_inputs(jsgraph->graph()->zone()); - for (int i = 0; i < count; i++) { - tmp_inputs.push_back(start); - } - tmp_inputs.push_back(loop); - - Node* phi = jsgraph->graph()->NewNode( - jsgraph->common()->Phi(MachineRepresentation::kWord32, count), count + 1, - &tmp_inputs[0]); - Node* inc = jsgraph->graph()->NewNode(&kIntAdd, phi, jsgraph->OneConstant()); - - for (int i = 1; i < count; i++) { - phi->ReplaceInput(i, inc); - } - return phi; -} - - -TEST(Deconstruct_osr_nested3) { - OsrDeconstructorTester T(1); - - // outermost loop. - While loop0(T, T.p0, false, 1); - Node* loop0_cntr = MakeCounter(&T.jsgraph, T.p0, loop0.loop); - loop0.branch->ReplaceInput(0, loop0_cntr); - - // middle loop. - Node* loop1 = T.graph.NewNode(T.common.Loop(1), loop0.if_true); - Node* loop1_phi = - T.graph.NewNode(T.common.Phi(MachineRepresentation::kTagged, 2), - loop0_cntr, loop0_cntr, loop1); - - // innermost (OSR) loop. - While loop2(T, T.p0, true, 1); - loop2.loop->ReplaceInput(0, loop1); - - Node* loop2_cntr = MakeCounter(&T.jsgraph, loop1_phi, loop2.loop); - loop2_cntr->ReplaceInput(1, T.osr_values[0]); - Node* osr_phi = loop2_cntr; - Node* loop2_inc = loop2_cntr->InputAt(2); - loop2.branch->ReplaceInput(0, loop2_cntr); - - loop1_phi->ReplaceInput(1, loop2_cntr); - loop0_cntr->ReplaceInput(1, loop2_cntr); - - // Branch to either the outer or middle loop. - Node* branch = T.graph.NewNode(T.common.Branch(), loop2_cntr, loop2.exit); - Node* if_true = T.graph.NewNode(T.common.IfTrue(), branch); - Node* if_false = T.graph.NewNode(T.common.IfFalse(), branch); - - loop0.loop->ReplaceInput(1, if_true); - loop1->AppendInput(T.graph.zone(), if_false); - NodeProperties::ChangeOp(loop1, T.common.Loop(2)); - - Node* ret = - T.graph.NewNode(T.common.Return(), loop0_cntr, T.start, loop0.exit); - Node* end = T.graph.NewNode(T.common.End(1), ret); - T.graph.SetEnd(end); - - T.DeconstructOsr(); - - // Check structure of deconstructed graph. - // Check loop2 (OSR loop) is directly connected to start. - CheckInputs(loop2.loop, T.start, loop2.if_true); - CheckInputs(osr_phi, T.osr_values[0], loop2_inc, loop2.loop); - CheckInputs(loop2.branch, osr_phi, loop2.loop); - CheckInputs(loop2.if_true, loop2.branch); - CheckInputs(loop2.exit, loop2.branch); - CheckInputs(branch, osr_phi, loop2.exit); - CheckInputs(if_true, branch); - CheckInputs(if_false, branch); - - // Check structure of new_loop1. - Node* new_loop1_loop = FindSuccessor(if_false, IrOpcode::kLoop); - // TODO(titzer): check the internal copy of loop2. - USE(new_loop1_loop); - - // Check structure of new_loop0. - Node* new_loop0_loop_entry = FindSuccessor(if_true, IrOpcode::kMerge); - Node* new_loop0_loop = FindSuccessor(new_loop0_loop_entry, IrOpcode::kLoop); - // TODO(titzer): check the internal copies of loop1 and loop2. - - Node* new_loop0_branch = FindSuccessor(new_loop0_loop, IrOpcode::kBranch); - Node* new_loop0_if_true = FindSuccessor(new_loop0_branch, IrOpcode::kIfTrue); - Node* new_loop0_exit = FindSuccessor(new_loop0_branch, IrOpcode::kIfFalse); - - USE(new_loop0_if_true); - - Node* new_ret = T.graph.end()->InputAt(0); - CHECK_EQ(IrOpcode::kReturn, new_ret->opcode()); - - Node* new_loop0_phi = new_ret->InputAt(0); - CHECK_EQ(IrOpcode::kPhi, new_loop0_phi->opcode()); - CHECK_EQ(new_loop0_loop, NodeProperties::GetControlInput(new_loop0_phi)); - CHECK_EQ(new_loop0_phi, FindSuccessor(new_loop0_loop, IrOpcode::kPhi)); - - // Check that the return returns the phi from the OSR loop and control - // depends on the copy of the outer loop0. - CheckInputs(new_ret, new_loop0_phi, T.graph.start(), new_loop0_exit); -} - -} // namespace compiler -} // namespace internal -} // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-representation-change.cc b/deps/v8/test/cctest/compiler/test-representation-change.cc index 242793340e..ab2a1f6dfe 100644 --- a/deps/v8/test/cctest/compiler/test-representation-change.cc +++ b/deps/v8/test/cctest/compiler/test-representation-change.cc @@ -84,8 +84,8 @@ class RepresentationChangerTester : public HandleAndZoneScope, } Node* Return(Node* input) { - Node* n = graph()->NewNode(common()->Return(), input, graph()->start(), - graph()->start()); + Node* n = graph()->NewNode(common()->Return(), jsgraph()->Int32Constant(0), + input, graph()->start(), graph()->start()); return n; } @@ -137,138 +137,65 @@ TEST(BoolToBit_constant) { r.CheckInt32Constant(false_bit, 0); } - -TEST(BitToBool_constant) { - RepresentationChangerTester r; - - for (int i = -5; i < 5; i++) { - Node* node = r.jsgraph()->Int32Constant(i); - Node* use = r.Return(node); - Node* val = r.changer()->GetRepresentationFor( - node, MachineRepresentation::kBit, Type::Boolean(), use, - UseInfo(MachineRepresentation::kTagged, Truncation::None())); - r.CheckHeapConstant(val, i == 0 ? r.isolate()->heap()->false_value() - : r.isolate()->heap()->true_value()); - } -} - - TEST(ToTagged_constant) { RepresentationChangerTester r; - { - FOR_FLOAT64_INPUTS(i) { - Node* n = r.jsgraph()->Float64Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::None(), use, - UseInfo(MachineRepresentation::kTagged, Truncation::None())); - r.CheckNumberConstant(c, *i); - } - } - - { - FOR_FLOAT64_INPUTS(i) { - Node* n = r.jsgraph()->Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::None(), use, - UseInfo(MachineRepresentation::kTagged, Truncation::None())); - r.CheckNumberConstant(c, *i); - } - } - - { - FOR_FLOAT32_INPUTS(i) { - Node* n = r.jsgraph()->Float32Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat32, Type::None(), use, - UseInfo(MachineRepresentation::kTagged, Truncation::None())); - r.CheckNumberConstant(c, *i); - } + for (double i : ValueHelper::float64_vector()) { + Node* n = r.jsgraph()->Constant(i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kFloat64, Type::None(), use, + UseInfo(MachineRepresentation::kTagged, Truncation::None())); + r.CheckNumberConstant(c, i); } - { - FOR_INT32_INPUTS(i) { - Node* n = r.jsgraph()->Int32Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Signed32(), use, - UseInfo(MachineRepresentation::kTagged, Truncation::None())); - r.CheckNumberConstant(c, *i); - } + for (int i : ValueHelper::int32_vector()) { + Node* n = r.jsgraph()->Constant(i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kWord32, Type::Signed32(), use, + UseInfo(MachineRepresentation::kTagged, Truncation::None())); + r.CheckNumberConstant(c, i); } - { - FOR_UINT32_INPUTS(i) { - Node* n = r.jsgraph()->Int32Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Unsigned32(), use, - UseInfo(MachineRepresentation::kTagged, Truncation::None())); - r.CheckNumberConstant(c, *i); - } + for (uint32_t i : ValueHelper::uint32_vector()) { + Node* n = r.jsgraph()->Constant(i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kWord32, Type::Unsigned32(), use, + UseInfo(MachineRepresentation::kTagged, Truncation::None())); + r.CheckNumberConstant(c, i); } } - TEST(ToFloat64_constant) { RepresentationChangerTester r; - { - FOR_FLOAT64_INPUTS(i) { - Node* n = r.jsgraph()->Float64Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::None(), use, - UseInfo(MachineRepresentation::kFloat64, Truncation::None())); - CHECK_EQ(n, c); - } - } - - { - FOR_FLOAT64_INPUTS(i) { - Node* n = r.jsgraph()->Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kTagged, Type::None(), use, - UseInfo(MachineRepresentation::kFloat64, Truncation::None())); - r.CheckFloat64Constant(c, *i); - } + for (double i : ValueHelper::float64_vector()) { + Node* n = r.jsgraph()->Constant(i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kTagged, Type::None(), use, + UseInfo(MachineRepresentation::kFloat64, Truncation::None())); + r.CheckFloat64Constant(c, i); } - { - FOR_FLOAT32_INPUTS(i) { - Node* n = r.jsgraph()->Float32Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat32, Type::None(), use, - UseInfo(MachineRepresentation::kFloat64, Truncation::None())); - r.CheckFloat64Constant(c, *i); - } + for (int i : ValueHelper::int32_vector()) { + Node* n = r.jsgraph()->Constant(i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kWord32, Type::Signed32(), use, + UseInfo(MachineRepresentation::kFloat64, Truncation::None())); + r.CheckFloat64Constant(c, i); } - { - FOR_INT32_INPUTS(i) { - Node* n = r.jsgraph()->Int32Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Signed32(), use, - UseInfo(MachineRepresentation::kFloat64, Truncation::None())); - r.CheckFloat64Constant(c, *i); - } - } - - { - FOR_UINT32_INPUTS(i) { - Node* n = r.jsgraph()->Int32Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Unsigned32(), use, - UseInfo(MachineRepresentation::kFloat64, Truncation::None())); - r.CheckFloat64Constant(c, *i); - } + for (uint32_t i : ValueHelper::uint32_vector()) { + Node* n = r.jsgraph()->Constant(i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kWord32, Type::Unsigned32(), use, + UseInfo(MachineRepresentation::kFloat64, Truncation::None())); + r.CheckFloat64Constant(c, i); } } @@ -284,102 +211,38 @@ static bool IsFloat32Uint32(uint32_t val) { return val <= (1 << 23); } TEST(ToFloat32_constant) { RepresentationChangerTester r; - { - FOR_FLOAT32_INPUTS(i) { - Node* n = r.jsgraph()->Float32Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat32, Type::None(), use, - UseInfo(MachineRepresentation::kFloat32, Truncation::None())); - CHECK_EQ(n, c); - } - } - - { - FOR_FLOAT32_INPUTS(i) { - Node* n = r.jsgraph()->Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kTagged, Type::None(), use, - UseInfo(MachineRepresentation::kFloat32, Truncation::None())); - r.CheckFloat32Constant(c, *i); - } - } - - { - FOR_FLOAT32_INPUTS(i) { - Node* n = r.jsgraph()->Float64Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::None(), use, - UseInfo(MachineRepresentation::kFloat32, Truncation::None())); - r.CheckFloat32Constant(c, *i); - } - } - - { - FOR_INT32_INPUTS(i) { - if (!IsFloat32Int32(*i)) continue; - Node* n = r.jsgraph()->Int32Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Signed32(), use, - UseInfo(MachineRepresentation::kFloat32, Truncation::None())); - r.CheckFloat32Constant(c, static_cast<float>(*i)); - } - } - - { - FOR_UINT32_INPUTS(i) { - if (!IsFloat32Uint32(*i)) continue; - Node* n = r.jsgraph()->Int32Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Unsigned32(), use, - UseInfo(MachineRepresentation::kFloat32, Truncation::None())); - r.CheckFloat32Constant(c, static_cast<float>(*i)); - } + for (double i : ValueHelper::float32_vector()) { + Node* n = r.jsgraph()->Constant(i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kTagged, Type::None(), use, + UseInfo(MachineRepresentation::kFloat32, Truncation::None())); + r.CheckFloat32Constant(c, i); + } + + for (int i : ValueHelper::int32_vector()) { + if (!IsFloat32Int32(i)) continue; + Node* n = r.jsgraph()->Constant(i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kWord32, Type::Signed32(), use, + UseInfo(MachineRepresentation::kFloat32, Truncation::None())); + r.CheckFloat32Constant(c, static_cast<float>(i)); + } + + for (uint32_t i : ValueHelper::uint32_vector()) { + if (!IsFloat32Uint32(i)) continue; + Node* n = r.jsgraph()->Constant(i); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kWord32, Type::Unsigned32(), use, + UseInfo(MachineRepresentation::kFloat32, Truncation::None())); + r.CheckFloat32Constant(c, static_cast<float>(i)); } } - TEST(ToInt32_constant) { RepresentationChangerTester r; - - { - FOR_INT32_INPUTS(i) { - Node* n = r.jsgraph()->Int32Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Signed32(), use, - UseInfo(MachineRepresentation::kWord32, Truncation::None())); - r.CheckInt32Constant(c, *i); - } - } - - { - FOR_INT32_INPUTS(i) { - if (!IsFloat32Int32(*i)) continue; - Node* n = r.jsgraph()->Float32Constant(static_cast<float>(*i)); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat32, Type::Signed32(), use, - UseInfo(MachineRepresentation::kWord32, Truncation::None())); - r.CheckInt32Constant(c, *i); - } - } - - { - FOR_INT32_INPUTS(i) { - Node* n = r.jsgraph()->Float64Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::Signed32(), use, - UseInfo(MachineRepresentation::kWord32, Truncation::None())); - r.CheckInt32Constant(c, *i); - } - } - { FOR_INT32_INPUTS(i) { Node* n = r.jsgraph()->Constant(*i); @@ -392,70 +255,44 @@ TEST(ToInt32_constant) { } } - TEST(ToUint32_constant) { RepresentationChangerTester r; - - { - FOR_UINT32_INPUTS(i) { - Node* n = r.jsgraph()->Int32Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kWord32, Type::Unsigned32(), use, - UseInfo(MachineRepresentation::kWord32, Truncation::None())); - r.CheckUint32Constant(c, *i); - } - } - - { - FOR_UINT32_INPUTS(i) { - if (!IsFloat32Uint32(*i)) continue; - Node* n = r.jsgraph()->Float32Constant(static_cast<float>(*i)); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat32, Type::Unsigned32(), use, - UseInfo(MachineRepresentation::kWord32, Truncation::None())); - r.CheckUint32Constant(c, *i); - } - } - - { - FOR_UINT32_INPUTS(i) { - Node* n = r.jsgraph()->Float64Constant(*i); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kFloat64, Type::Unsigned32(), use, - UseInfo(MachineRepresentation::kWord32, Truncation::None())); - r.CheckUint32Constant(c, *i); - } - } - - { - FOR_UINT32_INPUTS(i) { - Node* n = r.jsgraph()->Constant(static_cast<double>(*i)); - Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor( - n, MachineRepresentation::kTagged, Type::Unsigned32(), use, - UseInfo(MachineRepresentation::kWord32, Truncation::None())); - r.CheckUint32Constant(c, *i); - } + FOR_UINT32_INPUTS(i) { + Node* n = r.jsgraph()->Constant(static_cast<double>(*i)); + Node* use = r.Return(n); + Node* c = r.changer()->GetRepresentationFor( + n, MachineRepresentation::kTagged, Type::Unsigned32(), use, + UseInfo(MachineRepresentation::kWord32, Truncation::None())); + r.CheckUint32Constant(c, *i); } } static void CheckChange(IrOpcode::Value expected, MachineRepresentation from, - Type* from_type, MachineRepresentation to) { + Type* from_type, UseInfo use_info) { RepresentationChangerTester r; Node* n = r.Parameter(); Node* use = r.Return(n); - Node* c = r.changer()->GetRepresentationFor(n, from, from_type, use, - UseInfo(to, Truncation::None())); + Node* c = + r.changer()->GetRepresentationFor(n, from, from_type, use, use_info); CHECK_NE(c, n); CHECK_EQ(expected, c->opcode()); CHECK_EQ(n, c->InputAt(0)); + + if (expected == IrOpcode::kCheckedFloat64ToInt32) { + CheckForMinusZeroMode mode = + from_type->Maybe(Type::MinusZero()) + ? use_info.minus_zero_check() + : CheckForMinusZeroMode::kDontCheckForMinusZero; + CHECK_EQ(mode, CheckMinusZeroModeOf(c->op())); + } } +static void CheckChange(IrOpcode::Value expected, MachineRepresentation from, + Type* from_type, MachineRepresentation to) { + CheckChange(expected, from, from_type, UseInfo(to, Truncation::None())); +} static void CheckTwoChanges(IrOpcode::Value expected2, IrOpcode::Value expected1, @@ -604,6 +441,32 @@ TEST(SignednessInWord32) { MachineRepresentation::kWord32); } +static void TestMinusZeroCheck(IrOpcode::Value expected, Type* from_type) { + RepresentationChangerTester r; + + CheckChange(expected, MachineRepresentation::kFloat64, from_type, + UseInfo::CheckedSignedSmallAsWord32( + CheckForMinusZeroMode::kCheckForMinusZero)); + + CheckChange(expected, MachineRepresentation::kFloat64, from_type, + UseInfo::CheckedSignedSmallAsWord32( + CheckForMinusZeroMode::kDontCheckForMinusZero)); + + CheckChange(expected, MachineRepresentation::kFloat64, from_type, + UseInfo::CheckedSigned32AsWord32( + CheckForMinusZeroMode::kCheckForMinusZero)); + + CheckChange(expected, MachineRepresentation::kFloat64, from_type, + UseInfo::CheckedSigned32AsWord32( + CheckForMinusZeroMode::kDontCheckForMinusZero)); +} + +TEST(MinusZeroCheck) { + TestMinusZeroCheck(IrOpcode::kCheckedFloat64ToInt32, Type::NumberOrOddball()); + // PlainNumber cannot be minus zero so the minus zero check should be + // eliminated. + TestMinusZeroCheck(IrOpcode::kCheckedFloat64ToInt32, Type::PlainNumber()); +} TEST(Nops) { RepresentationChangerTester r; 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 9c2b05dd4b..74a51b915a 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 @@ -124,7 +124,7 @@ class BytecodeGraphTester { // TODO(mstarzinger): We should be able to prime CompilationInfo without // having to instantiate a ParseInfo first. Fix this! - ParseInfo parse_info(zone_, function); + ParseInfo parse_info(zone_, handle(function->shared())); CompilationInfo compilation_info(&parse_info, function); compilation_info.SetOptimizing(); diff --git a/deps/v8/test/cctest/compiler/test-run-inlining.cc b/deps/v8/test/cctest/compiler/test-run-inlining.cc index aab8b4e86b..22e791a5f8 100644 --- a/deps/v8/test/cctest/compiler/test-run-inlining.cc +++ b/deps/v8/test/cctest/compiler/test-run-inlining.cc @@ -48,11 +48,9 @@ void InstallAssertInlineCountHelper(v8::Isolate* isolate) { .FromJust()); } -const uint32_t kRestrictedInliningFlags = - CompilationInfo::kNativeContextSpecializing; +const uint32_t kRestrictedInliningFlags = 0; -const uint32_t kInlineFlags = CompilationInfo::kInliningEnabled | - CompilationInfo::kNativeContextSpecializing; +const uint32_t kInlineFlags = CompilationInfo::kInliningEnabled; } // namespace diff --git a/deps/v8/test/cctest/compiler/test-run-jscalls.cc b/deps/v8/test/cctest/compiler/test-run-jscalls.cc index 84d7f714ae..64bd67cc0a 100644 --- a/deps/v8/test/cctest/compiler/test-run-jscalls.cc +++ b/deps/v8/test/cctest/compiler/test-run-jscalls.cc @@ -205,56 +205,6 @@ TEST(CallEval) { T.CheckCall(T.Val(42), T.Val("x"), T.undefined()); } - -TEST(ContextLoadedFromActivation) { - const char* script = - "var x = 42;" - "(function() {" - " return function () { return x };" - "})()"; - - // Disable context specialization. - FunctionTester T(script); - v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); - v8::Context::Scope scope(context); - v8::Local<v8::Value> value = CompileRun(script); - i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value); - i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun); - jsfun->set_code(T.function->code()); - jsfun->set_shared(T.function->shared()); - jsfun->set_literals(T.function->literals()); - CHECK(context->Global() - ->Set(context, v8_str("foo"), v8::Utils::CallableToLocal(jsfun)) - .FromJust()); - CompileRun("var x = 24;"); - ExpectInt32("foo();", 24); -} - - -TEST(BuiltinLoadedFromActivation) { - const char* script = - "var x = 42;" - "(function() {" - " return function () { return this; };" - "})()"; - - // Disable context specialization. - FunctionTester T(script); - v8::Local<v8::Context> context = v8::Context::New(CcTest::isolate()); - v8::Context::Scope scope(context); - v8::Local<v8::Value> value = CompileRun(script); - i::Handle<i::Object> ofun = v8::Utils::OpenHandle(*value); - i::Handle<i::JSFunction> jsfun = Handle<JSFunction>::cast(ofun); - jsfun->set_code(T.function->code()); - jsfun->set_shared(T.function->shared()); - jsfun->set_literals(T.function->literals()); - CHECK(context->Global() - ->Set(context, v8_str("foo"), v8::Utils::CallableToLocal(jsfun)) - .FromJust()); - CompileRun("var x = 24;"); - ExpectObject("foo()", context->Global()); -} - } // namespace compiler } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/compiler/test-run-load-store.cc b/deps/v8/test/cctest/compiler/test-run-load-store.cc index 2461129384..559e6fd02a 100644 --- a/deps/v8/test/cctest/compiler/test-run-load-store.cc +++ b/deps/v8/test/cctest/compiler/test-run-load-store.cc @@ -278,7 +278,7 @@ void RunUnalignedLoadStoreUnalignedAccess(MachineType rep) { CType out_buffer[2]; byte* raw; - for (int x = 0; x < sizeof(CType); x++) { + for (int x = 0; x < static_cast<int>(sizeof(CType)); x++) { int y = sizeof(CType) - x; raw = reinterpret_cast<byte*>(&in); @@ -523,7 +523,7 @@ void RunLoadStoreSignExtend64(TestAlignment t) { void RunLoadStoreZeroExtend64(TestAlignment t) { if (kPointerSize < 8) return; uint64_t buffer[5]; - RawMachineAssemblerTester<int64_t> m; + RawMachineAssemblerTester<uint64_t> m; Node* load8 = m.LoadFromPointer(LSB(&buffer[0], 1), MachineType::Uint8()); if (t == TestAlignment::kAligned) { Node* load16 = m.LoadFromPointer(LSB(&buffer[0], 2), MachineType::Uint16()); @@ -988,12 +988,13 @@ void TestRunOobCheckedLoad_pseudo(uint64_t x, bool length_is_immediate) { for (uint32_t i = 0; i < kNumElems; i++) { uint32_t offset = static_cast<uint32_t>(i * sizeof(int32_t)); uint32_t expected = buffer[i]; - CHECK_EQ(expected, m.Call(offset + pseudo_base, kLength)); + CHECK_EQ(expected, + static_cast<uint32_t>(m.Call(offset + pseudo_base, kLength))); } // slightly out-of-bounds accesses. - for (int32_t i = kNumElems; i < kNumElems + 30; i++) { - uint32_t offset = static_cast<uint32_t>(i * sizeof(int32_t)); + for (uint32_t i = kNumElems; i < kNumElems + 30; i++) { + uint32_t offset = i * sizeof(int32_t); CheckOobValue(m.Call(offset + pseudo_base, kLength)); } @@ -1089,7 +1090,7 @@ void TestRunOobCheckedLoadT_pseudo(uint64_t x, bool length_is_immediate) { } // slightly out-of-bounds accesses. - for (int32_t i = kNumElems; i < kNumElems + 30; i++) { + for (uint32_t i = kNumElems; i < kNumElems + 30; i++) { uint32_t offset = static_cast<uint32_t>(i * sizeof(MemType)); CHECK_EQ(kReturn, m.Call(offset + pseudo_base, kLength)); CheckOobValue(result); diff --git a/deps/v8/test/cctest/compiler/test-run-machops.cc b/deps/v8/test/cctest/compiler/test-run-machops.cc index 50b46d7d0e..2794aec51e 100644 --- a/deps/v8/test/cctest/compiler/test-run-machops.cc +++ b/deps/v8/test/cctest/compiler/test-run-machops.cc @@ -4161,6 +4161,26 @@ TEST(RunInt32PairAdd) { } } +TEST(RunInt32PairAddUseOnlyHighWord) { + BufferedRawMachineAssemblerTester<int32_t> m( + MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(), + MachineType::Uint32()); + + m.Return(m.Projection(1, m.Int32PairAdd(m.Parameter(0), m.Parameter(1), + m.Parameter(2), m.Parameter(3)))); + + FOR_UINT64_INPUTS(i) { + FOR_UINT64_INPUTS(j) { + CHECK_EQ( + static_cast<uint32_t>((*i + *j) >> 32), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(*i >> 32), + static_cast<uint32_t>(*j & 0xffffffff), + static_cast<uint32_t>(*j >> 32)))); + } + } +} + void TestInt32PairAddWithSharedInput(int a, int b, int c, int d) { BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), MachineType::Uint32()); @@ -4224,6 +4244,26 @@ TEST(RunInt32PairSub) { } } +TEST(RunInt32PairSubUseOnlyHighWord) { + BufferedRawMachineAssemblerTester<int32_t> m( + MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(), + MachineType::Uint32()); + + m.Return(m.Projection(1, m.Int32PairSub(m.Parameter(0), m.Parameter(1), + m.Parameter(2), m.Parameter(3)))); + + FOR_UINT64_INPUTS(i) { + FOR_UINT64_INPUTS(j) { + CHECK_EQ( + static_cast<uint32_t>((*i - *j) >> 32), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(*i >> 32), + static_cast<uint32_t>(*j & 0xffffffff), + static_cast<uint32_t>(*j >> 32)))); + } + } +} + void TestInt32PairSubWithSharedInput(int a, int b, int c, int d) { BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), MachineType::Uint32()); @@ -4287,6 +4327,26 @@ TEST(RunInt32PairMul) { } } +TEST(RunInt32PairMulUseOnlyHighWord) { + BufferedRawMachineAssemblerTester<int32_t> m( + MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32(), + MachineType::Uint32()); + + m.Return(m.Projection(1, m.Int32PairMul(m.Parameter(0), m.Parameter(1), + m.Parameter(2), m.Parameter(3)))); + + FOR_UINT64_INPUTS(i) { + FOR_UINT64_INPUTS(j) { + CHECK_EQ( + static_cast<uint32_t>((*i * *j) >> 32), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(*i >> 32), + static_cast<uint32_t>(*j & 0xffffffff), + static_cast<uint32_t>(*j >> 32)))); + } + } +} + void TestInt32PairMulWithSharedInput(int a, int b, int c, int d) { BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), MachineType::Uint32()); @@ -4330,13 +4390,13 @@ TEST(RunWord32PairShl) { uint32_t high; uint32_t low; - Node* PairAdd = + Node* PairShl = m.Word32PairShl(m.Parameter(0), m.Parameter(1), m.Parameter(2)); m.StoreToPointer(&low, MachineRepresentation::kWord32, - m.Projection(0, PairAdd)); + m.Projection(0, PairShl)); m.StoreToPointer(&high, MachineRepresentation::kWord32, - m.Projection(1, PairAdd)); + m.Projection(1, PairShl)); m.Return(m.Int32Constant(74)); FOR_UINT64_INPUTS(i) { @@ -4348,6 +4408,23 @@ TEST(RunWord32PairShl) { } } +TEST(RunWord32PairShlUseOnlyHighWord) { + BufferedRawMachineAssemblerTester<int32_t> m( + MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); + + m.Return(m.Projection( + 1, m.Word32PairShl(m.Parameter(0), m.Parameter(1), m.Parameter(2)))); + + FOR_UINT64_INPUTS(i) { + for (uint32_t j = 0; j < 64; j++) { + CHECK_EQ( + static_cast<uint32_t>((*i << j) >> 32), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(*i >> 32), j))); + } + } +} + void TestWord32PairShlWithSharedInput(int a, int b) { BufferedRawMachineAssemblerTester<int32_t> m(MachineType::Uint32(), MachineType::Uint32()); @@ -4405,6 +4482,23 @@ TEST(RunWord32PairShr) { } } +TEST(RunWord32PairShrUseOnlyHighWord) { + BufferedRawMachineAssemblerTester<int32_t> m( + MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); + + m.Return(m.Projection( + 1, m.Word32PairShr(m.Parameter(0), m.Parameter(1), m.Parameter(2)))); + + FOR_UINT64_INPUTS(i) { + for (uint32_t j = 0; j < 64; j++) { + CHECK_EQ( + static_cast<uint32_t>((*i >> j) >> 32), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(*i >> 32), j))); + } + } +} + TEST(RunWord32PairSar) { BufferedRawMachineAssemblerTester<int32_t> m( MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); @@ -4425,11 +4519,27 @@ TEST(RunWord32PairSar) { for (uint32_t j = 0; j < 64; j++) { m.Call(static_cast<uint32_t>(*i & 0xffffffff), static_cast<uint32_t>(*i >> 32), j); - CHECK_EQ(*i >> j, ToInt64(low, high)); + CHECK_EQ(*i >> j, static_cast<int64_t>(ToInt64(low, high))); } } } +TEST(RunWord32PairSarUseOnlyHighWord) { + BufferedRawMachineAssemblerTester<int32_t> m( + MachineType::Uint32(), MachineType::Uint32(), MachineType::Uint32()); + + m.Return(m.Projection( + 1, m.Word32PairSar(m.Parameter(0), m.Parameter(1), m.Parameter(2)))); + + FOR_INT64_INPUTS(i) { + for (uint32_t j = 0; j < 64; j++) { + CHECK_EQ( + static_cast<uint32_t>((*i >> j) >> 32), + static_cast<uint32_t>(m.Call(static_cast<uint32_t>(*i & 0xffffffff), + static_cast<uint32_t>(*i >> 32), j))); + } + } +} #endif TEST(RunDeadChangeFloat64ToInt32) { @@ -6249,7 +6359,7 @@ TEST(RunTryTruncateFloat64ToUint64WithCheck) { FOR_FLOAT64_INPUTS(i) { if (*i < 18446744073709551616.0 && *i > -1) { // Conversions within this range should succeed. - CHECK_EQ(static_cast<uint64_t>(*i), m.Call(*i)); + CHECK_EQ(static_cast<uint64_t>(*i), static_cast<uint64_t>(m.Call(*i))); CHECK_NE(0, success); } else { m.Call(*i); 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 0f76b897c3..89629ec090 100644 --- a/deps/v8/test/cctest/compiler/test-run-native-calls.cc +++ b/deps/v8/test/cctest/compiler/test-run-native-calls.cc @@ -87,8 +87,16 @@ class RegisterPairs : public Pairs { class Float32RegisterPairs : public Pairs { public: Float32RegisterPairs() - : Pairs(100, GetRegConfig()->num_allocatable_aliased_double_registers(), - GetRegConfig()->allocatable_double_codes()) {} + : Pairs( + 100, +#if V8_TARGET_ARCH_ARM + // TODO(bbudge) Modify wasm linkage to allow use of all float regs. + GetRegConfig()->num_allocatable_double_registers() / 2 - 2, +#else + GetRegConfig()->num_allocatable_double_registers(), +#endif + GetRegConfig()->allocatable_double_codes()) { + } }; @@ -127,6 +135,10 @@ struct Allocator { // Allocate a floating point register/stack location. if (fp_offset < fp_count) { int code = fp_regs[fp_offset++]; +#if V8_TARGET_ARCH_ARM + // TODO(bbudge) Modify wasm linkage to allow use of all float regs. + if (type.representation() == MachineRepresentation::kFloat32) code *= 2; +#endif return LinkageLocation::ForRegister(code, type); } else { int offset = -1 - stack_offset; @@ -258,7 +270,7 @@ Handle<Code> CompileGraph(const char* name, CallDescriptor* desc, Graph* graph, Handle<Code> WrapWithCFunction(Handle<Code> inner, CallDescriptor* desc) { - Zone zone(inner->GetIsolate()->allocator()); + Zone zone(inner->GetIsolate()->allocator(), ZONE_NAME); int param_count = static_cast<int>(desc->ParameterCount()); GraphAndBuilders caller(&zone); { @@ -281,7 +293,9 @@ Handle<Code> WrapWithCFunction(Handle<Code> inner, CallDescriptor* desc) { // Build the call and return nodes. Node* call = b.graph()->NewNode(b.common()->Call(desc), param_count + 3, args); - Node* ret = b.graph()->NewNode(b.common()->Return(), call, call, start); + Node* zero = b.graph()->NewNode(b.common()->Int32Constant(0)); + Node* ret = + b.graph()->NewNode(b.common()->Return(), zero, call, call, start); b.graph()->SetEnd(ret); } @@ -424,7 +438,7 @@ class Computer { Handle<Code> inner = Handle<Code>::null(); { // Build the graph for the computation. - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); Graph graph(&zone); RawMachineAssembler raw(isolate, &graph, desc); build(desc, raw); @@ -439,7 +453,7 @@ class Computer { Handle<Code> wrapper = Handle<Code>::null(); { // Wrap the above code with a callable function that passes constants. - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); Graph graph(&zone); CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig); RawMachineAssembler raw(isolate, &graph, cdesc); @@ -471,7 +485,7 @@ class Computer { Handle<Code> wrapper = Handle<Code>::null(); { // Wrap the above code with a callable function that loads from {input}. - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); Graph graph(&zone); CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig); RawMachineAssembler raw(isolate, &graph, cdesc); @@ -509,7 +523,7 @@ class Computer { static void TestInt32Sub(CallDescriptor* desc) { Isolate* isolate = CcTest::InitIsolateOnce(); HandleScope scope(isolate); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); GraphAndBuilders inner(&zone); { // Build the add function. @@ -519,7 +533,9 @@ static void TestInt32Sub(CallDescriptor* desc) { Node* p0 = b.graph()->NewNode(b.common()->Parameter(0), start); Node* p1 = b.graph()->NewNode(b.common()->Parameter(1), start); Node* add = b.graph()->NewNode(b.machine()->Int32Sub(), p0, p1); - Node* ret = b.graph()->NewNode(b.common()->Return(), add, start, start); + Node* zero = b.graph()->NewNode(b.common()->Int32Constant(0)); + Node* ret = + b.graph()->NewNode(b.common()->Return(), zero, add, start, start); b.graph()->SetEnd(ret); } @@ -549,7 +565,7 @@ static void CopyTwentyInt32(CallDescriptor* desc) { Handle<Code> inner = Handle<Code>::null(); { // Writes all parameters into the output buffer. - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); Graph graph(&zone); RawMachineAssembler raw(isolate, &graph, desc); Node* base = raw.PointerConstant(output); @@ -566,7 +582,7 @@ static void CopyTwentyInt32(CallDescriptor* desc) { Handle<Code> wrapper = Handle<Code>::null(); { // Loads parameters from the input buffer and calls the above code. - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); Graph graph(&zone); CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig); RawMachineAssembler raw(isolate, &graph, cdesc); @@ -606,7 +622,7 @@ static void CopyTwentyInt32(CallDescriptor* desc) { static void Test_RunInt32SubWithRet(int retreg) { Int32Signature sig(2); v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); RegisterPairs pairs; while (pairs.More()) { int parray[2]; @@ -657,7 +673,7 @@ TEST(Run_Int32Sub_all_allocatable_single) { RegisterPairs pairs; while (pairs.More()) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); int parray[1]; int rarray[1]; pairs.Next(&rarray[0], &parray[0], true); @@ -675,7 +691,7 @@ TEST(Run_CopyTwentyInt32_all_allocatable_pairs) { RegisterPairs pairs; while (pairs.More()) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); int parray[2]; int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; pairs.Next(&parray[0], &parray[1], false); @@ -726,7 +742,7 @@ static void Test_Int32_WeightedSum_of_size(int count) { for (int p0 = 0; p0 < Register::kNumRegisters; p0++) { if (GetRegConfig()->IsAllocatableGeneralCode(p0)) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); int parray[] = {p0}; int rarray[] = {GetRegConfig()->GetAllocatableGeneralCode(0)}; @@ -789,7 +805,7 @@ void Test_Int32_Select() { RegisterConfig config(params, rets); v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); for (int i = which + 1; i <= 64; i++) { Int32Signature sig(i); @@ -828,7 +844,7 @@ TEST(Int64Select_registers) { RegisterPairs pairs; v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); while (pairs.More()) { int parray[2]; pairs.Next(&parray[0], &parray[1], false); @@ -853,7 +869,7 @@ TEST(Float32Select_registers) { Float32RegisterPairs pairs; v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); while (pairs.More()) { int parray[2]; pairs.Next(&parray[0], &parray[1], false); @@ -876,7 +892,7 @@ TEST(Float64Select_registers) { Float64RegisterPairs pairs; v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); while (pairs.More()) { int parray[2]; pairs.Next(&parray[0], &parray[1], false); @@ -898,7 +914,7 @@ TEST(Float32Select_stack_params_return_reg) { RegisterConfig config(params, rets); v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); for (int count = 1; count < 6; count++) { ArgsBuffer<float32>::Sig sig(count); CallDescriptor* desc = config.Create(&zone, &sig); @@ -919,7 +935,7 @@ TEST(Float64Select_stack_params_return_reg) { RegisterConfig config(params, rets); v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); for (int count = 1; count < 6; count++) { ArgsBuffer<float64>::Sig sig(count); CallDescriptor* desc = config.Create(&zone, &sig); @@ -942,7 +958,7 @@ static void Build_Select_With_Call(CallDescriptor* desc, { Isolate* isolate = CcTest::InitIsolateOnce(); // Build the actual select. - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); Graph graph(&zone); RawMachineAssembler raw(isolate, &graph, desc); raw.Return(raw.Parameter(which)); @@ -971,7 +987,7 @@ TEST(Float64StackParamsToStackParams) { Allocator rets(nullptr, 0, rarray, 1); v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); ArgsBuffer<float64>::Sig sig(2); RegisterConfig config(params, rets); CallDescriptor* desc = config.Create(&zone, &sig); @@ -1026,7 +1042,7 @@ void MixedParamTest(int start) { for (int which = 0; which < num_params; which++) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); HandleScope scope(isolate); MachineSignature::Builder builder(&zone, 1, num_params); builder.AddReturn(params[which]); @@ -1037,7 +1053,7 @@ void MixedParamTest(int start) { Handle<Code> select; { // build the select. - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); RawMachineAssembler raw(isolate, &graph, desc); raw.Return(raw.Parameter(which)); @@ -1054,7 +1070,7 @@ void MixedParamTest(int start) { CSignature0<int32_t> csig; { // Wrap the select code with a callable function that passes constants. - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); Graph graph(&zone); CallDescriptor* cdesc = Linkage::GetSimplifiedCDescriptor(&zone, &csig); RawMachineAssembler raw(isolate, &graph, cdesc); @@ -1135,7 +1151,7 @@ void TestStackSlot(MachineType slot_type, T expected) { Allocator ralloc(rarray_gp, 1, rarray_fp, 1); RegisterConfig config(palloc, ralloc); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); HandleScope scope(isolate); MachineSignature::Builder builder(&zone, 1, 12); builder.AddReturn(MachineType::Int32()); diff --git a/deps/v8/test/cctest/compiler/test-run-stubs.cc b/deps/v8/test/cctest/compiler/test-run-stubs.cc index b34e5d4a51..8b6519eac5 100644 --- a/deps/v8/test/cctest/compiler/test-run-stubs.cc +++ b/deps/v8/test/cctest/compiler/test-run-stubs.cc @@ -47,10 +47,11 @@ TEST(RunStringLengthStub) { Node* vectorParam = graph.NewNode(common.Parameter(4), start); Node* theCode = graph.NewNode(common.HeapConstant(code)); Node* dummyContext = graph.NewNode(common.NumberConstant(0.0)); + Node* zero = graph.NewNode(common.Int32Constant(0)); Node* call = graph.NewNode(common.Call(descriptor), theCode, receiverParam, nameParam, slotParam, vectorParam, dummyContext, start, start); - Node* ret = graph.NewNode(common.Return(), call, call, start); + Node* ret = graph.NewNode(common.Return(), zero, call, call, start); Node* end = graph.NewNode(common.End(1), ret); graph.SetStart(start); graph.SetEnd(end); diff --git a/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc b/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc index 0b23669cf7..c3f42388d4 100644 --- a/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc +++ b/deps/v8/test/cctest/compiler/test-run-wasm-machops.cc @@ -51,7 +51,7 @@ static void RunLoadStoreRelocation(MachineType rep) { raw[i] = static_cast<byte>((i + sizeof(CType)) ^ 0xAA); new_raw[i] = static_cast<byte>((i + sizeof(CType)) ^ 0xAA); } - int32_t OK = 0x29000; + uint32_t OK = 0x29000; RawMachineAssemblerTester<uint32_t> m; Node* base = m.RelocatableIntPtrConstant(reinterpret_cast<intptr_t>(raw), RelocInfo::WASM_MEMORY_REFERENCE); @@ -166,5 +166,5 @@ TEST(Uint32LessThanRelocation) { UpdateMemoryReferences(code, reinterpret_cast<Address>(1234), reinterpret_cast<Address>(1234), 0x200, 0x400); // Check that after limit is increased, index is within bounds. - CHECK_EQ(0xaced, m.Call()); + CHECK_EQ(0xacedu, m.Call()); } diff --git a/deps/v8/test/cctest/heap/heap-tester.h b/deps/v8/test/cctest/heap/heap-tester.h index a01de69291..99d39ca7ab 100644 --- a/deps/v8/test/cctest/heap/heap-tester.h +++ b/deps/v8/test/cctest/heap/heap-tester.h @@ -32,6 +32,8 @@ V(Regress587004) \ V(Regress538257) \ V(Regress589413) \ + V(Regress658718) \ + V(Regress670675) \ V(WriteBarriersInCopyJSObject) #define HEAP_TEST(Name) \ @@ -39,6 +41,11 @@ #Name, true, true); \ void v8::internal::HeapTester::Test##Name() +#define UNINITIALIZED_HEAP_TEST(Name) \ + CcTest register_test_##Name(v8::internal::HeapTester::Test##Name, __FILE__, \ + #Name, true, false); \ + void v8::internal::HeapTester::Test##Name() + #define THREADED_HEAP_TEST(Name) \ RegisterThreadedTest register_##Name(v8::internal::HeapTester::Test##Name, \ #Name); \ diff --git a/deps/v8/test/cctest/heap/heap-utils.cc b/deps/v8/test/cctest/heap/heap-utils.cc index 4f7d088a94..c44f82f1d9 100644 --- a/deps/v8/test/cctest/heap/heap-utils.cc +++ b/deps/v8/test/cctest/heap/heap-utils.cc @@ -38,8 +38,7 @@ std::vector<Handle<FixedArray>> FillOldSpacePageWithFixedArrays(Heap* heap, const int kArrayLen = heap::FixedArrayLenFromSize(kArraySize); CHECK_EQ(Page::kAllocatableMemory % kArraySize, 0); Handle<FixedArray> array; - for (size_t allocated = 0; - allocated != (Page::kAllocatableMemory - remainder); + for (int allocated = 0; allocated != (Page::kAllocatableMemory - remainder); allocated += array->Size()) { if (allocated == (Page::kAllocatableMemory - kArraySize)) { array = isolate->factory()->NewFixedArray( @@ -170,6 +169,10 @@ void SimulateIncrementalMarking(i::Heap* heap, bool force_completion) { } void SimulateFullSpace(v8::internal::PagedSpace* space) { + i::MarkCompactCollector* collector = space->heap()->mark_compact_collector(); + if (collector->sweeping_in_progress()) { + collector->EnsureSweepingCompleted(); + } space->EmptyAllocationInfo(); space->ResetFreeList(); space->ClearStats(); @@ -189,6 +192,21 @@ void GcAndSweep(Heap* heap, AllocationSpace space) { } } +void ForceEvacuationCandidate(Page* page) { + CHECK(FLAG_manual_evacuation_candidates_selection); + page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + PagedSpace* space = static_cast<PagedSpace*>(page->owner()); + Address top = space->top(); + Address limit = space->limit(); + if (top < limit && Page::FromAllocationAreaAddress(top) == page) { + // Create filler object to keep page iterable if it was iterable. + int remaining = static_cast<int>(limit - top); + space->heap()->CreateFillerObjectAt(top, remaining, + ClearRecordedSlots::kNo); + space->SetTopAndLimit(nullptr, nullptr); + } +} + } // namespace heap } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/heap/heap-utils.h b/deps/v8/test/cctest/heap/heap-utils.h index 2f704cb422..a494f54210 100644 --- a/deps/v8/test/cctest/heap/heap-utils.h +++ b/deps/v8/test/cctest/heap/heap-utils.h @@ -50,6 +50,8 @@ void AbandonCurrentlyFreeMemory(PagedSpace* space); void GcAndSweep(Heap* heap, AllocationSpace space); +void ForceEvacuationCandidate(Page* page); + } // namespace heap } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/heap/test-alloc.cc b/deps/v8/test/cctest/heap/test-alloc.cc index c01827eee1..d7031e876d 100644 --- a/deps/v8/test/cctest/heap/test-alloc.cc +++ b/deps/v8/test/cctest/heap/test-alloc.cc @@ -60,10 +60,12 @@ AllocationResult v8::internal::HeapTester::AllocateAfterFailures() { heap->AllocateFixedArray(10000, TENURED).ToObjectChecked(); // Large object space. - static const int kLargeObjectSpaceFillerLength = 3 * (Page::kPageSize / 10); - static const int kLargeObjectSpaceFillerSize = FixedArray::SizeFor( - kLargeObjectSpaceFillerLength); - CHECK(kLargeObjectSpaceFillerSize > heap->old_space()->AreaSize()); + static const size_t kLargeObjectSpaceFillerLength = + 3 * (Page::kPageSize / 10); + static const size_t kLargeObjectSpaceFillerSize = + FixedArray::SizeFor(kLargeObjectSpaceFillerLength); + CHECK_GT(kLargeObjectSpaceFillerSize, + static_cast<size_t>(heap->old_space()->AreaSize())); while (heap->OldGenerationSpaceAvailable() > kLargeObjectSpaceFillerSize) { heap->AllocateFixedArray( kLargeObjectSpaceFillerLength, TENURED).ToObjectChecked(); @@ -116,11 +118,8 @@ void TestGetter( v8::internal::HeapTester::TestAllocateAfterFailures())); } - -void TestSetter( - v8::Local<v8::Name> name, - v8::Local<v8::Value> value, - const v8::PropertyCallbackInfo<void>& info) { +void TestSetter(v8::Local<v8::Name> name, v8::Local<v8::Value> value, + const v8::PropertyCallbackInfo<v8::Boolean>& info) { UNREACHABLE(); } 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 173d1fa85f..0f3663041f 100644 --- a/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc +++ b/deps/v8/test/cctest/heap/test-array-buffer-tracker.cc @@ -127,7 +127,7 @@ TEST(ArrayBuffer_Compaction) { heap::GcAndSweep(heap, NEW_SPACE); Page* page_before_gc = Page::FromAddress(buf1->address()); - page_before_gc->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + heap::ForceEvacuationCandidate(page_before_gc); CHECK(IsTracked(*buf1)); CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); diff --git a/deps/v8/test/cctest/heap/test-heap.cc b/deps/v8/test/cctest/heap/test-heap.cc index c69d391f90..19474c3e95 100644 --- a/deps/v8/test/cctest/heap/test-heap.cc +++ b/deps/v8/test/cctest/heap/test-heap.cc @@ -749,46 +749,6 @@ TEST(DeleteWeakGlobalHandle) { CHECK(WeakPointerCleared); } -TEST(DoNotPromoteWhiteObjectsOnScavenge) { - CcTest::InitializeVM(); - Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); - Factory* factory = isolate->factory(); - - HandleScope scope(isolate); - Handle<Object> white = factory->NewStringFromStaticChars("white"); - - CHECK(Marking::IsWhite(ObjectMarking::MarkBitFrom(HeapObject::cast(*white)))); - - CcTest::CollectGarbage(NEW_SPACE); - - CHECK(heap->InNewSpace(*white)); -} - -TEST(PromoteGreyOrBlackObjectsOnScavenge) { - CcTest::InitializeVM(); - Isolate* isolate = CcTest::i_isolate(); - Heap* heap = isolate->heap(); - Factory* factory = isolate->factory(); - - HandleScope scope(isolate); - Handle<Object> marked = factory->NewStringFromStaticChars("marked"); - - IncrementalMarking* marking = heap->incremental_marking(); - marking->Stop(); - 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::DO_NOT_FORCE_COMPLETION, StepOrigin::kV8); - } - - CcTest::CollectGarbage(NEW_SPACE); - - CHECK(!heap->InNewSpace(*marked)); -} - TEST(BytecodeArray) { static const uint8_t kRawBytes[] = {0xc3, 0x7e, 0xa5, 0x5a}; static const int kRawBytesSize = sizeof(kRawBytes); @@ -831,7 +791,7 @@ TEST(BytecodeArray) { // Perform a full garbage collection and force the constant pool to be on an // evacuation candidate. Page* evac_page = Page::FromAddress(constant_pool->address()); - evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + heap::ForceEvacuationCandidate(evac_page); CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); // BytecodeArray should survive. @@ -1078,7 +1038,7 @@ TEST(JSArray) { // Set array length to 0. JSArray::SetLength(array, 0); - CHECK_EQ(Smi::FromInt(0), array->length()); + CHECK_EQ(Smi::kZero, array->length()); // Must be in fast mode. CHECK(array->HasFastSmiOrObjectElements()); @@ -1319,8 +1279,10 @@ UNINITIALIZED_TEST(TestCodeFlushing) { } // foo should no longer be in the compilation cache - CHECK(!function->shared()->is_compiled() || function->IsOptimized()); - CHECK(!function->is_compiled() || function->IsOptimized()); + CHECK(!function->shared()->is_compiled() || function->IsOptimized() || + function->IsInterpreted()); + CHECK(!function->is_compiled() || function->IsOptimized() || + function->IsInterpreted()); // Call foo to get it recompiled. CompileRun("foo()"); CHECK(function->shared()->is_compiled()); @@ -1367,7 +1329,8 @@ TEST(TestCodeFlushingPreAged) { // The code was only run once, so it should be pre-aged and collected on the // next GC. CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); - CHECK(!function->shared()->is_compiled() || function->IsOptimized()); + CHECK(!function->shared()->is_compiled() || function->IsOptimized() || + function->IsInterpreted()); // Execute the function again twice, and ensure it is reset to the young age. { v8::HandleScope scope(CcTest::isolate()); @@ -1387,8 +1350,10 @@ TEST(TestCodeFlushingPreAged) { } // foo should no longer be in the compilation cache - CHECK(!function->shared()->is_compiled() || function->IsOptimized()); - CHECK(!function->is_compiled() || function->IsOptimized()); + CHECK(!function->shared()->is_compiled() || function->IsOptimized() || + function->IsInterpreted()); + CHECK(!function->is_compiled() || function->IsOptimized() || + function->IsInterpreted()); // Call foo to get it recompiled. CompileRun("foo()"); CHECK(function->shared()->is_compiled()); @@ -1436,8 +1401,10 @@ TEST(TestCodeFlushingIncremental) { heap::SimulateIncrementalMarking(CcTest::heap()); CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); } - CHECK(!function->shared()->is_compiled() || function->IsOptimized()); - CHECK(!function->is_compiled() || function->IsOptimized()); + CHECK(!function->shared()->is_compiled() || function->IsOptimized() || + function->IsInterpreted()); + CHECK(!function->is_compiled() || function->IsOptimized() || + function->IsInterpreted()); // This compile will compile the function again. { v8::HandleScope scope(CcTest::isolate()); @@ -1530,8 +1497,10 @@ TEST(TestCodeFlushingIncrementalScavenge) { // Simulate one final GC to make sure the candidate queue is sane. CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); - CHECK(!function->shared()->is_compiled() || function->IsOptimized()); - CHECK(!function->is_compiled() || function->IsOptimized()); + CHECK(!function->shared()->is_compiled() || function->IsOptimized() || + function->IsInterpreted()); + CHECK(!function->is_compiled() || function->IsOptimized() || + function->IsInterpreted()); } @@ -1584,7 +1553,7 @@ TEST(TestCodeFlushingIncrementalAbort) { // is running so that incremental marking aborts and code flushing is // disabled. int position = function->shared()->start_position(); - Handle<Object> breakpoint_object(Smi::FromInt(0), isolate); + Handle<Object> breakpoint_object(Smi::kZero, isolate); EnableDebugger(CcTest::isolate()); isolate->debug()->SetBreakPoint(function, breakpoint_object, &position); isolate->debug()->ClearBreakPoint(breakpoint_object); @@ -1646,6 +1615,7 @@ TEST(TestUseOfIncrementalBarrierOnCompileLazy) { TEST(CompilationCacheCachingBehavior) { // If we do not flush code, or have the compilation cache turned off, this // test is invalid. + i::FLAG_allow_natives_syntax = true; if (!FLAG_flush_code || !FLAG_compilation_cache) { return; } @@ -1662,7 +1632,7 @@ TEST(CompilationCacheCachingBehavior) { " var y = 42;" " var z = x + y;" "};" - "foo()"; + "foo();"; Handle<String> source = factory->InternalizeUtf8String(raw_source); Handle<Context> native_context = isolate->native_context(); @@ -2369,7 +2339,7 @@ TEST(GrowAndShrinkNewSpace) { } // Explicitly growing should double the space capacity. - intptr_t old_capacity, new_capacity; + size_t old_capacity, new_capacity; old_capacity = new_space->TotalCapacity(); new_space->Grow(); new_capacity = new_space->TotalCapacity(); @@ -2417,7 +2387,7 @@ TEST(CollectingAllAvailableGarbageShrinksNewSpace) { v8::HandleScope scope(CcTest::isolate()); NewSpace* new_space = heap->new_space(); - intptr_t old_capacity, new_capacity; + size_t old_capacity, new_capacity; old_capacity = new_space->TotalCapacity(); new_space->Grow(); new_capacity = new_space->TotalCapacity(); @@ -2697,8 +2667,8 @@ TEST(InstanceOfStubWriteBarrier) { namespace { int GetProfilerTicks(SharedFunctionInfo* shared) { - return FLAG_ignition ? shared->profiler_ticks() - : shared->code()->profiler_ticks(); + return FLAG_ignition || FLAG_turbo ? shared->profiler_ticks() + : shared->code()->profiler_ticks(); } } // namespace @@ -4118,6 +4088,7 @@ TEST(Regress165495) { TEST(Regress169209) { + i::FLAG_always_opt = false; i::FLAG_stress_compaction = false; i::FLAG_allow_natives_syntax = true; @@ -4135,11 +4106,15 @@ TEST(Regress169209) { { HandleScope inner_scope(isolate); LocalContext env; - CompileRun("function f() { return 'foobar'; }" - "function g(x) { if (x) f(); }" - "f();" - "g(false);" - "g(false);"); + CompileRun( + "function f() { return 'foobar'; }" + "function g(x) { if (x) f(); }" + "f();" + "%BaselineFunctionOnNextCall(f);" + "f();" + "g(false);" + "%BaselineFunctionOnNextCall(g);" + "g(false);"); Handle<JSFunction> f = Handle<JSFunction>::cast( v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( @@ -4159,8 +4134,11 @@ TEST(Regress169209) { { HandleScope inner_scope(isolate); LocalContext env; - CompileRun("function flushMe() { return 0; }" - "flushMe(1);"); + CompileRun( + "function flushMe() { return 0; }" + "flushMe(1);" + "%BaselineFunctionOnNextCall(flushMe);" + "flushMe(1);"); Handle<JSFunction> f = Handle<JSFunction>::cast(v8::Utils::OpenHandle( *v8::Local<v8::Function>::Cast(CcTest::global() @@ -4398,7 +4376,7 @@ TEST(Regress514122) { // Heap is ready, force {lit_page} to become an evacuation candidate and // simulate incremental marking to enqueue optimized code map. FLAG_manual_evacuation_candidates_selection = true; - evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + heap::ForceEvacuationCandidate(evac_page); heap::SimulateIncrementalMarking(heap); // No matter whether reachable or not, {boomer} is doomed. @@ -4597,7 +4575,7 @@ TEST(LargeObjectSlotRecording) { heap::SimulateFullSpace(heap->old_space()); Handle<FixedArray> lit = isolate->factory()->NewFixedArray(4, TENURED); Page* evac_page = Page::FromAddress(lit->address()); - evac_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + heap::ForceEvacuationCandidate(evac_page); FixedArray* old_location = *lit; // Allocate a large object. @@ -5603,8 +5581,7 @@ HEAP_TEST(Regress538257) { heap->CanExpandOldGeneration(old_space->AreaSize()); i++) { objects[i] = i_isolate->factory()->NewFixedArray(kFixedArrayLen, TENURED); - Page::FromAddress(objects[i]->address()) - ->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + heap::ForceEvacuationCandidate(Page::FromAddress(objects[i]->address())); } heap::SimulateFullSpace(old_space); heap->CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask, @@ -5701,7 +5678,8 @@ UNINITIALIZED_TEST(PromotionQueue) { CHECK(new_space->IsAtMaximumCapacity()); - CHECK(i::FLAG_min_semi_space_size * MB == new_space->TotalCapacity()); + CHECK_EQ(static_cast<size_t>(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, i::GarbageCollectionReason::kTesting); @@ -5717,7 +5695,8 @@ UNINITIALIZED_TEST(PromotionQueue) { } heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting); - CHECK(i::FLAG_min_semi_space_size * MB == new_space->TotalCapacity()); + CHECK_EQ(static_cast<size_t>(i::FLAG_min_semi_space_size * MB), + new_space->TotalCapacity()); // Fill-up the first semi-space page. heap::FillUpOnePage(new_space); @@ -5755,13 +5734,13 @@ TEST(Regress388880) { Representation::Tagged(), OMIT_TRANSITION) .ToHandleChecked(); - int desired_offset = Page::kPageSize - map1->instance_size(); + size_t desired_offset = Page::kPageSize - map1->instance_size(); // Allocate padding objects in old pointer space so, that object allocated // afterwards would end at the end of the page. heap::SimulateFullSpace(heap->old_space()); - int padding_size = desired_offset - Page::kObjectStartOffset; - heap::CreatePadding(heap, padding_size, TENURED); + size_t padding_size = desired_offset - Page::kObjectStartOffset; + heap::CreatePadding(heap, static_cast<int>(padding_size), TENURED); Handle<JSObject> o = factory->NewJSObjectFromMap(map1, TENURED); o->set_properties(*factory->empty_fixed_array()); @@ -6449,30 +6428,6 @@ TEST(Regress519319) { } -HEAP_TEST(TestMemoryReducerSampleJsCalls) { - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - Heap* heap = CcTest::heap(); - Isolate* isolate = CcTest::i_isolate(); - MemoryReducer* memory_reducer = heap->memory_reducer_; - memory_reducer->SampleAndGetJsCallsPerMs(0); - isolate->IncrementJsCallsFromApiCounter(); - isolate->IncrementJsCallsFromApiCounter(); - isolate->IncrementJsCallsFromApiCounter(); - double calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(1); - CheckDoubleEquals(3, calls_per_ms); - - calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(2); - CheckDoubleEquals(0, calls_per_ms); - - isolate->IncrementJsCallsFromApiCounter(); - isolate->IncrementJsCallsFromApiCounter(); - isolate->IncrementJsCallsFromApiCounter(); - isolate->IncrementJsCallsFromApiCounter(); - calls_per_ms = memory_reducer->SampleAndGetJsCallsPerMs(4); - CheckDoubleEquals(2, calls_per_ms); -} - HEAP_TEST(Regress587004) { FLAG_concurrent_sweeping = false; #ifdef VERIFY_HEAP @@ -6566,7 +6521,7 @@ HEAP_TEST(Regress589413) { AlwaysAllocateScope always_allocate(isolate); Handle<HeapObject> ec_obj = factory->NewFixedArray(5000, TENURED); Page* ec_page = Page::FromAddress(ec_obj->address()); - ec_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + heap::ForceEvacuationCandidate(ec_page); // Make all arrays point to evacuation candidate so that // slots are recorded for them. for (size_t j = 0; j < arrays.size(); j++) { @@ -6773,8 +6728,7 @@ TEST(Regress631969) { heap::SimulateFullSpace(heap->old_space()); Handle<String> s1 = factory->NewStringFromStaticChars("123456789", TENURED); Handle<String> s2 = factory->NewStringFromStaticChars("01234", TENURED); - Page::FromAddress(s1->address()) - ->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + heap::ForceEvacuationCandidate(Page::FromAddress(s1->address())); heap::SimulateIncrementalMarking(heap, false); @@ -6963,49 +6917,6 @@ TEST(ContinuousRightTrimFixedArrayInBlackArea) { heap::GcAndSweep(heap, OLD_SPACE); } -TEST(SlotFilteringAfterBlackAreas) { - FLAG_black_allocation = true; - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - Heap* heap = CcTest::heap(); - Isolate* isolate = heap->isolate(); - MarkCompactCollector* mark_compact_collector = heap->mark_compact_collector(); - CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); - - i::MarkCompactCollector* collector = heap->mark_compact_collector(); - i::IncrementalMarking* marking = heap->incremental_marking(); - if (collector->sweeping_in_progress()) { - collector->EnsureSweepingCompleted(); - } - CHECK(marking->IsMarking() || marking->IsStopped()); - if (marking->IsStopped()) { - heap->StartIncrementalMarking(i::Heap::kNoGCFlags, - i::GarbageCollectionReason::kTesting); - } - CHECK(marking->IsMarking()); - marking->StartBlackAllocationForTesting(); - - // Ensure that we allocate a new page, set up a bump pointer area, and - // perform the allocation in a black area. - heap::SimulateFullSpace(heap->old_space()); - Handle<FixedArray> array = isolate->factory()->NewFixedArray(10, TENURED); - Page* page = Page::FromAddress(array->address()); - - // After allocation we empty the allocation info to limit the black area - // only on the allocated array. - heap->old_space()->EmptyAllocationInfo(); - - // Slots in the black area are part of the black object. - CHECK(mark_compact_collector->IsSlotInBlackObject(page, array->address())); - CHECK(mark_compact_collector->IsSlotInBlackObject( - page, array->address() + array->Size() - kPointerSize)); - - // Slots after the black area are not part of the black object and have to - // be filtered out. - CHECK(!mark_compact_collector->IsSlotInBlackObject( - page, array->address() + array->Size())); -} - TEST(Regress618958) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); @@ -7077,7 +6988,8 @@ TEST(RememberedSetRemoveRange) { return KEEP_SLOT; }); - RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, start, start + kPointerSize); + RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, start, start + kPointerSize, + SlotSet::FREE_EMPTY_BUCKETS); slots[start] = false; RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { CHECK(slots[addr]); @@ -7085,7 +6997,8 @@ TEST(RememberedSetRemoveRange) { }); RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, start + kPointerSize, - start + Page::kPageSize); + start + Page::kPageSize, + SlotSet::FREE_EMPTY_BUCKETS); slots[start + kPointerSize] = false; slots[start + Page::kPageSize - kPointerSize] = false; RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { @@ -7093,8 +7006,9 @@ TEST(RememberedSetRemoveRange) { return KEEP_SLOT; }); - RememberedSet<OLD_TO_NEW>::RemoveRange( - chunk, start, start + Page::kPageSize + kPointerSize); + RememberedSet<OLD_TO_NEW>::RemoveRange(chunk, start, + start + Page::kPageSize + kPointerSize, + SlotSet::FREE_EMPTY_BUCKETS); slots[start + Page::kPageSize] = false; RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { CHECK(slots[addr]); @@ -7102,7 +7016,8 @@ TEST(RememberedSetRemoveRange) { }); RememberedSet<OLD_TO_NEW>::RemoveRange( - chunk, chunk->area_end() - kPointerSize, chunk->area_end()); + chunk, chunk->area_end() - kPointerSize, chunk->area_end(), + SlotSet::FREE_EMPTY_BUCKETS); slots[chunk->area_end() - kPointerSize] = false; RememberedSet<OLD_TO_NEW>::Iterate(chunk, [&slots](Address addr) { CHECK(slots[addr]); @@ -7110,5 +7025,37 @@ TEST(RememberedSetRemoveRange) { }); } +HEAP_TEST(Regress670675) { + if (!FLAG_incremental_marking) return; + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Heap* heap = CcTest::heap(); + Isolate* isolate = heap->isolate(); + i::MarkCompactCollector* collector = heap->mark_compact_collector(); + CcTest::CollectAllGarbage(i::Heap::kFinalizeIncrementalMarkingMask); + + if (collector->sweeping_in_progress()) { + collector->EnsureSweepingCompleted(); + } + i::IncrementalMarking* marking = CcTest::heap()->incremental_marking(); + if (marking->IsStopped()) { + marking->Start(i::GarbageCollectionReason::kTesting); + } + size_t array_length = Page::kPageSize / kPointerSize + 100; + size_t n = heap->OldGenerationSpaceAvailable() / array_length; + for (size_t i = 0; i < n + 40; i++) { + { + HandleScope inner_scope(isolate); + isolate->factory()->NewFixedArray(static_cast<int>(array_length)); + } + if (marking->IsStopped()) break; + double deadline = heap->MonotonicallyIncreasingTimeInMs() + 1; + marking->AdvanceIncrementalMarking( + deadline, IncrementalMarking::GC_VIA_STACK_GUARD, + IncrementalMarking::FORCE_COMPLETION, StepOrigin::kV8); + } + DCHECK(marking->IsStopped()); +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/heap/test-mark-compact.cc b/deps/v8/test/cctest/heap/test-mark-compact.cc index d0f7f82741..0788e26108 100644 --- a/deps/v8/test/cctest/heap/test-mark-compact.cc +++ b/deps/v8/test/cctest/heap/test-mark-compact.cc @@ -51,13 +51,9 @@ using v8::Just; TEST(MarkingDeque) { CcTest::InitializeVM(); - int mem_size = 20 * kPointerSize; - byte* mem = NewArray<byte>(20*kPointerSize); - Address low = reinterpret_cast<Address>(mem); - Address high = low + mem_size; - MarkingDeque s; - s.Initialize(low, high); - + MarkingDeque s(CcTest::i_isolate()->heap()); + s.SetUp(); + s.StartUsing(); Address original_address = reinterpret_cast<Address>(&s); Address current_address = original_address; while (!s.IsFull()) { @@ -72,7 +68,9 @@ TEST(MarkingDeque) { } CHECK_EQ(original_address, current_address); - DeleteArray(mem); + s.StopUsing(); + CcTest::i_isolate()->cancelable_task_manager()->CancelAndWait(); + s.TearDown(); } TEST(Promotion) { @@ -415,7 +413,7 @@ static intptr_t MemoryInUse() { int fd = open("/proc/self/maps", O_RDONLY); if (fd < 0) return -1; - const int kBufSize = 10000; + const int kBufSize = 20000; char buffer[kBufSize]; ssize_t length = read(fd, buffer, kBufSize); intptr_t line_start = 0; diff --git a/deps/v8/test/cctest/heap/test-page-promotion.cc b/deps/v8/test/cctest/heap/test-page-promotion.cc index b3ac4960a5..4673f2edcf 100644 --- a/deps/v8/test/cctest/heap/test-page-promotion.cc +++ b/deps/v8/test/cctest/heap/test-page-promotion.cc @@ -14,20 +14,22 @@ // 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" namespace { -v8::Isolate* NewIsolateForPagePromotion() { +v8::Isolate* NewIsolateForPagePromotion(int min_semi_space_size = 8, + int max_semi_space_size = 8) { i::FLAG_page_promotion = true; i::FLAG_page_promotion_threshold = 0; // % - i::FLAG_min_semi_space_size = 8; + i::FLAG_min_semi_space_size = min_semi_space_size; // We cannot optimize for size as we require a new space with more than one // page. i::FLAG_optimize_for_size = false; // Set max_semi_space_size because it could've been initialized by an // implication of optimize_for_size. - i::FLAG_max_semi_space_size = i::FLAG_min_semi_space_size; + i::FLAG_max_semi_space_size = max_semi_space_size; v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); v8::Isolate* isolate = v8::Isolate::New(create_params); @@ -134,5 +136,38 @@ UNINITIALIZED_TEST(PagePromotion_NewToNewJSArrayBuffer) { } } +UNINITIALIZED_HEAP_TEST(Regress658718) { + v8::Isolate* isolate = NewIsolateForPagePromotion(4, 8); + Isolate* i_isolate = reinterpret_cast<Isolate*>(isolate); + { + v8::Isolate::Scope isolate_scope(isolate); + v8::HandleScope handle_scope(isolate); + v8::Context::New(isolate)->Enter(); + Heap* heap = i_isolate->heap(); + heap->delay_sweeper_tasks_for_testing_ = true; + heap->new_space()->Grow(); + { + v8::HandleScope inner_handle_scope(isolate); + std::vector<Handle<FixedArray>> handles; + heap::SimulateFullSpace(heap->new_space(), &handles); + CHECK_GT(handles.size(), 0u); + // Last object in handles should definitely be on the last page which does + // not contain the age mark. + Handle<FixedArray> last_object = handles.back(); + Page* to_be_promoted_page = Page::FromAddress(last_object->address()); + CHECK(to_be_promoted_page->Contains(last_object->address())); + CHECK(heap->new_space()->ToSpaceContainsSlow(last_object->address())); + heap->CollectGarbage(OLD_SPACE, i::GarbageCollectionReason::kTesting); + CHECK(heap->new_space()->ToSpaceContainsSlow(last_object->address())); + CHECK(to_be_promoted_page->Contains(last_object->address())); + } + heap->CollectGarbage(NEW_SPACE, i::GarbageCollectionReason::kTesting); + heap->new_space()->Shrink(); + heap->memory_allocator()->unmapper()->WaitUntilCompleted(); + heap->mark_compact_collector()->sweeper().StartSweeperTasks(); + heap->mark_compact_collector()->EnsureSweepingCompleted(); + } +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/heap/test-spaces.cc b/deps/v8/test/cctest/heap/test-spaces.cc index 262d0c5d58..fc692e331c 100644 --- a/deps/v8/test/cctest/heap/test-spaces.cc +++ b/deps/v8/test/cctest/heap/test-spaces.cc @@ -471,7 +471,7 @@ TEST(LargeObjectSpace) { CHECK(lo->Contains(ho)); while (true) { - intptr_t available = lo->Available(); + size_t available = lo->Available(); { AllocationResult allocation = lo->AllocateRaw(lo_size, NOT_EXECUTABLE); if (allocation.IsRetry()) break; } @@ -503,9 +503,15 @@ TEST(SizeOfInitialHeap) { // Initial size of LO_SPACE size_t initial_lo_space = isolate->heap()->lo_space()->Size(); - // The limit for each space for an empty isolate containing just the - // snapshot. +// The limit for each space for an empty isolate containing just the +// snapshot. +// In PPC the page size is 64K, causing more internal fragmentation +// hence requiring a larger limit. +#if V8_OS_LINUX && V8_HOST_ARCH_PPC + const size_t kMaxInitialSizePerSpace = 3 * MB; +#else const size_t kMaxInitialSizePerSpace = 2 * MB; +#endif // Freshly initialized VM gets by with the snapshot size (which is below // kMaxInitialSizePerSpace per space). @@ -530,7 +536,8 @@ TEST(SizeOfInitialHeap) { } // No large objects required to perform the above steps. - CHECK_EQ(initial_lo_space, isolate->heap()->lo_space()->Size()); + CHECK_EQ(initial_lo_space, + static_cast<size_t>(isolate->heap()->lo_space()->Size())); } static HeapObject* AllocateUnaligned(NewSpace* space, int size) { @@ -741,7 +748,7 @@ TEST(ShrinkPageToHighWaterMarkNoFiller) { CcTest::heap()->old_space()->EmptyAllocationInfo(); const size_t shrinked = page->ShrinkToHighWaterMark(); - CHECK_EQ(0, shrinked); + CHECK_EQ(0u, shrinked); } TEST(ShrinkPageToHighWaterMarkOneWordFiller) { @@ -767,7 +774,7 @@ TEST(ShrinkPageToHighWaterMarkOneWordFiller) { CHECK_EQ(filler->map(), CcTest::heap()->one_pointer_filler_map()); const size_t shrinked = page->ShrinkToHighWaterMark(); - CHECK_EQ(0, shrinked); + CHECK_EQ(0u, shrinked); } TEST(ShrinkPageToHighWaterMarkTwoWordFiller) { @@ -793,7 +800,7 @@ TEST(ShrinkPageToHighWaterMarkTwoWordFiller) { CHECK_EQ(filler->map(), CcTest::heap()->two_pointer_filler_map()); const size_t shrinked = page->ShrinkToHighWaterMark(); - CHECK_EQ(0, shrinked); + CHECK_EQ(0u, shrinked); } } // namespace internal diff --git a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc index 81be1c0028..f7a5bb9467 100644 --- a/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc +++ b/deps/v8/test/cctest/interpreter/bytecode-expectations-printer.cc @@ -83,7 +83,9 @@ 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()); + CHECK(!i_module->instantiated()); + return i::handle(SharedFunctionInfo::cast(i_module->code())->bytecode_array(), + i_isolate()); } i::Handle<i::BytecodeArray> @@ -217,7 +219,7 @@ void BytecodeExpectationsPrinter::PrintSourcePosition( if (!source_iterator.done() && source_iterator.code_offset() == bytecode_offset) { stream << "/* " << std::setw(kPositionWidth) - << source_iterator.source_position(); + << source_iterator.source_position().ScriptOffset(); if (source_iterator.is_statement()) { stream << " S> */ "; } else { diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden index 4d78aa6bfc..d36860174c 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/AssignmentsInBinaryExpression.golden @@ -242,7 +242,7 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 41 +bytecode array length: 43 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(17), @@ -254,6 +254,7 @@ bytecodes: [ B(Star), R(1), B(Ldar), R(0), B(ToNumber), R(2), + B(Ldar), R(2), B(Inc), U8(3), B(Star), R(0), B(Ldar), R(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden index 19d83661f0..1cbd05fcea 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BasicLoops.golden @@ -677,58 +677,42 @@ snippet: " } } " -frame size: 6 +frame size: 4 parameter count: 1 -bytecode array length: 104 +bytecode array length: 53 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaZero), B(Star), R(1), /* 52 S> */ B(Ldar), R(1), - B(JumpIfToBooleanFalse), U8(96), + B(JumpIfToBooleanFalse), U8(45), /* 45 E> */ B(StackCheck), B(Ldar), R(closure), B(CreateBlockContext), U8(0), B(PushContext), R(3), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateClosure), U8(1), U8(2), B(Star), R(0), /* 73 S> */ B(LdaSmi), U8(1), - /* 73 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 73 E> */ B(StaCurrentContextSlot), U8(4), B(Mov), R(0), R(2), - /* 106 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), + /* 106 S> */ B(LdaCurrentContextSlot), U8(4), B(JumpIfToBooleanFalse), U8(8), /* 113 S> */ B(PopContext), R(3), B(PopContext), R(3), - 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(Jump), U8(10), + /* 126 S> */ B(LdaCurrentContextSlot), U8(4), B(Inc), U8(2), - B(Star), R(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), U8(0), + /* 127 E> */ B(StaCurrentContextSlot), U8(4), B(PopContext), R(3), - B(JumpLoop), U8(-95), U8(0), + B(JumpLoop), U8(-44), U8(0), B(LdaUndefined), /* 137 S> */ B(Return), ] constant pool: [ 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 276c8daacb..9058fb8ad1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/BreakableBlocks.golden @@ -101,18 +101,18 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 34 +bytecode array length: 30 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), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateClosure), U8(1), U8(2), B(Star), R(0), /* 53 S> */ B(LdaSmi), U8(10), - /* 53 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 53 E> */ B(StaCurrentContextSlot), U8(4), B(Mov), R(0), R(1), B(Ldar), R(0), /* 88 S> */ B(Jump), U8(2), @@ -140,62 +140,42 @@ snippet: " } x = 4; " -frame size: 6 +frame size: 4 parameter count: 1 -bytecode array length: 116 +bytecode array length: 53 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(2), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), - /* 42 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 42 E> */ B(StaCurrentContextSlot), U8(4), B(Ldar), R(closure), B(CreateBlockContext), U8(0), B(PushContext), R(3), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateClosure), U8(1), U8(2), B(Star), R(0), /* 76 S> */ B(LdaSmi), U8(2), - /* 76 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 76 E> */ B(StaCurrentContextSlot), U8(4), B(Mov), R(0), R(1), - /* 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), + /* 118 S> */ B(LdaCurrentContextSlot), U8(4), B(JumpIfToBooleanFalse), U8(6), /* 125 S> */ B(PopContext), R(3), - B(Jump), U8(29), + B(Jump), U8(8), /* 142 S> */ B(LdaSmi), U8(3), - B(Star), R(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), U8(0), + /* 144 E> */ B(StaCurrentContextSlot), U8(4), B(PopContext), R(3), /* 155 S> */ B(LdaSmi), U8(4), - B(Star), R(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), U8(0), + /* 157 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 162 S> */ B(Return), ] constant pool: [ 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 49e6f71265..40be0533c1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden @@ -14,11 +14,13 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 12 +bytecode array length: 14 bytecodes: [ /* 27 E> */ B(StackCheck), - /* 32 S> */ B(LdrUndefined), R(1), - B(LdrGlobal), U8(4), R(0), + /* 32 S> */ B(LdaUndefined), + B(Star), R(1), + B(LdaGlobal), U8(4), + B(Star), R(0), /* 39 E> */ B(Call), R(0), R(1), U8(1), U8(2), /* 44 S> */ B(Return), ] @@ -35,11 +37,13 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 24 +bytecode array length: 26 bytecodes: [ /* 34 E> */ B(StackCheck), - /* 39 S> */ B(LdrUndefined), R(1), - B(LdrGlobal), U8(4), R(0), + /* 39 S> */ B(LdaUndefined), + B(Star), R(1), + B(LdaGlobal), U8(4), + B(Star), R(0), B(LdaSmi), U8(1), B(Star), R(2), B(LdaSmi), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden index b238d95954..e05419fbff 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden @@ -11,22 +11,23 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 89 +bytecode array length: 81 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(6), U8(0), + B(StaCurrentContextSlot), U8(6), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(5), U8(0), + B(StaCurrentContextSlot), U8(5), /* 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(4), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(4), U8(1), R(1), + /* 52 S> */ B(LdaUndefined), + B(Star), R(2), + /* 52 E> */ B(LdaLookupGlobalSlot), U8(2), U8(4), U8(1), + B(Star), R(1), B(LdaConstant), U8(3), B(Star), R(3), B(LdaZero), @@ -40,11 +41,12 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 52 E> */ B(Call), R(1), R(2), U8(2), U8(0), - /* 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(4), + /* 52 E> */ B(Call), R(1), R(2), U8(2), U8(2), + /* 62 S> */ B(LdaUndefined), + B(Star), R(2), + /* 69 E> */ B(LdaLookupGlobalSlot), U8(1), U8(8), U8(1), + B(Star), R(1), + /* 69 E> */ B(Call), R(1), R(2), U8(1), U8(6), /* 74 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden index 56f4f3ae59..eb5b0630f4 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallNew.golden @@ -14,11 +14,11 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 11 bytecodes: [ /* 45 E> */ B(StackCheck), - /* 50 S> */ B(LdrGlobal), U8(4), R(0), - B(Ldar), R(0), + /* 50 S> */ B(LdaGlobal), U8(4), + B(Star), R(0), /* 57 E> */ B(New), R(0), R(0), U8(0), U8(2), /* 68 S> */ B(Return), ] @@ -35,10 +35,11 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 16 +bytecode array length: 17 bytecodes: [ /* 58 E> */ B(StackCheck), - /* 63 S> */ B(LdrGlobal), U8(4), R(0), + /* 63 S> */ B(LdaGlobal), U8(4), + B(Star), R(0), B(LdaSmi), U8(3), B(Star), R(1), B(Ldar), R(0), @@ -63,10 +64,11 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 24 +bytecode array length: 25 bytecodes: [ /* 100 E> */ B(StackCheck), - /* 105 S> */ B(LdrGlobal), U8(4), R(0), + /* 105 S> */ B(LdaGlobal), U8(4), + B(Star), R(0), B(LdaSmi), U8(3), B(Star), R(1), B(LdaSmi), U8(4), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden index 3d4f5f7cc7..149e668291 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CallRuntime.golden @@ -72,13 +72,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 14 +bytecode array length: 15 bytecodes: [ /* 10 E> */ B(StackCheck), - /* 15 S> */ B(LdrUndefined), R(0), + /* 15 S> */ B(LdaUndefined), + B(Star), R(0), B(CreateArrayLiteral), U8(0), U8(0), U8(9), B(Star), R(1), - B(CallJSRuntime), U8(141), R(0), U8(2), + B(CallJSRuntime), U8(154), R(0), U8(2), /* 44 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden index 8a381f803f..174641bc74 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden @@ -22,12 +22,13 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 36 +bytecode array length: 37 bytecodes: [ B(Mov), R(closure), R(0), /* 99 E> */ B(StackCheck), /* 104 S> */ B(LdaConstant), U8(0), - /* 111 E> */ B(LdrKeyedProperty), R(closure), U8(4), R(4), + /* 111 E> */ B(LdaKeyedProperty), R(closure), U8(4), + B(Star), R(4), B(LdaConstant), U8(1), B(Star), R(5), B(Mov), R(this), R(3), @@ -62,12 +63,13 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 45 +bytecode array length: 47 bytecodes: [ B(Mov), R(closure), R(0), /* 125 E> */ B(StackCheck), /* 130 S> */ B(LdaConstant), U8(0), - /* 130 E> */ B(LdrKeyedProperty), R(closure), U8(2), R(2), + /* 130 E> */ B(LdaKeyedProperty), R(closure), U8(2), + B(Star), R(2), B(LdaConstant), U8(1), B(Star), R(3), B(LdaSmi), U8(2), @@ -75,7 +77,8 @@ 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(4), R(2), + /* 150 E> */ B(LdaKeyedProperty), R(closure), U8(4), + B(Star), R(2), B(LdaConstant), U8(1), B(Star), R(3), B(Mov), R(this), R(1), @@ -115,7 +118,7 @@ bytecodes: [ B(LdaSmi), U8(1), B(Star), R(3), B(Ldar), R(0), - /* 118 E> */ B(New), R(2), R(3), U8(1), U8(0), + /* 118 E> */ B(New), R(2), R(3), U8(1), U8(2), B(Star), R(2), B(Ldar), R(this), B(JumpIfNotHole), U8(4), @@ -131,7 +134,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(5), + /* 136 E> */ B(StaNamedPropertyStrict), R(2), U8(1), U8(4), B(Ldar), R(this), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(0), @@ -170,7 +173,7 @@ bytecodes: [ /* 117 S> */ B(CallRuntime), U16(Runtime::k_GetSuperConstructor), R(1), U8(1), B(Star), R(2), B(Ldar), R(0), - /* 117 E> */ B(New), R(2), R(0), U8(0), U8(0), + /* 117 E> */ B(New), R(2), R(0), U8(0), U8(2), B(Star), R(2), B(Ldar), R(this), B(JumpIfNotHole), U8(4), @@ -186,7 +189,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(5), + /* 134 E> */ B(StaNamedPropertyStrict), R(2), U8(1), U8(4), B(Ldar), R(this), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden index f1a15639a8..765ce65efd 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ClassDeclarations.golden @@ -14,7 +14,7 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 74 +bytecode array length: 75 bytecodes: [ B(LdaTheHole), B(Star), R(2), @@ -31,7 +31,8 @@ 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(2), R(4), + B(LdaNamedProperty), R(3), U8(1), U8(2), + B(Star), R(4), B(LdaConstant), U8(2), B(ToName), R(6), B(CreateClosure), U8(3), U8(2), @@ -67,7 +68,7 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 74 +bytecode array length: 75 bytecodes: [ B(LdaTheHole), B(Star), R(2), @@ -84,7 +85,8 @@ 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(2), R(4), + B(LdaNamedProperty), R(3), U8(1), U8(2), + B(Star), R(4), B(LdaConstant), U8(2), B(ToName), R(6), B(CreateClosure), U8(3), U8(2), @@ -122,7 +124,7 @@ snippet: " " frame size: 11 parameter count: 1 -bytecode array length: 128 +bytecode array length: 121 bytecodes: [ B(CreateFunctionContext), U8(2), B(PushContext), R(3), @@ -130,9 +132,9 @@ bytecodes: [ B(Star), R(2), /* 30 E> */ B(StackCheck), /* 43 S> */ B(LdaConstant), U8(0), - /* 43 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 43 E> */ B(StaCurrentContextSlot), U8(4), /* 57 S> */ B(LdaConstant), U8(1), - /* 57 E> */ B(StaContextSlot), R(context), U8(5), U8(0), + /* 57 E> */ B(StaCurrentContextSlot), U8(5), B(LdaTheHole), B(Star), R(0), /* 62 S> */ B(LdaTheHole), @@ -145,9 +147,10 @@ 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(2), R(5), - /* 75 E> */ B(LdaContextSlot), R(context), U8(4), U8(0), - B(ToName), R(7), + B(LdaNamedProperty), R(4), U8(3), U8(2), + B(Star), R(5), + B(LdaCurrentContextSlot), U8(4), + /* 75 E> */ B(ToName), R(7), B(CreateClosure), U8(4), U8(2), B(Star), R(8), B(LdaSmi), U8(2), @@ -156,8 +159,8 @@ 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), U8(0), - B(ToName), R(7), + B(LdaCurrentContextSlot), U8(5), + /* 106 E> */ B(ToName), R(7), B(LdaConstant), U8(3), B(TestEqualStrict), R(7), U8(0), B(Mov), R(4), R(6), @@ -194,7 +197,7 @@ snippet: " " frame size: 8 parameter count: 1 -bytecode array length: 74 +bytecode array length: 61 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(3), @@ -202,7 +205,7 @@ bytecodes: [ B(Star), R(2), /* 30 E> */ B(StackCheck), /* 46 S> */ B(LdaZero), - /* 46 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 46 E> */ B(StaCurrentContextSlot), U8(4), B(LdaTheHole), B(Star), R(0), /* 49 S> */ B(LdaTheHole), @@ -215,23 +218,19 @@ 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(2), R(5), + B(LdaNamedProperty), R(4), U8(1), U8(2), + B(Star), 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(4), - 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), + /* 87 S> */ B(Nop), + /* 94 E> */ B(New), R(2), R(0), U8(0), U8(4), /* 103 S> */ B(Return), ] constant pool: [ 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 053bce6e0f..c5ecec9abf 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CompoundExpressions.golden @@ -56,12 +56,13 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 25 +bytecode array length: 26 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(2), R(2), + /* 54 S> */ B(LdaNamedProperty), R(0), U8(1), U8(2), + B(Star), R(2), B(LdaSmi), U8(2), B(Mul), R(2), U8(4), /* 61 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(5), @@ -81,14 +82,15 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 28 +bytecode array length: 29 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(1), B(Mov), R(1), R(0), /* 52 S> */ B(LdaSmi), U8(1), B(Star), R(2), - B(LdrKeyedProperty), R(0), U8(2), R(3), + B(LdaKeyedProperty), R(0), U8(2), + B(Star), R(3), B(LdaSmi), U8(2), B(BitwiseXor), R(3), U8(4), /* 57 E> */ B(StaKeyedPropertySloppy), R(0), R(2), U8(5), @@ -107,17 +109,18 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 29 +bytecode array length: 24 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), U8(0), + /* 42 E> */ B(StaCurrentContextSlot), U8(4), /* 45 S> */ B(CreateClosure), U8(0), U8(2), - /* 75 S> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(1), + /* 75 S> */ B(LdaCurrentContextSlot), U8(4), + B(Star), R(1), B(BitwiseOrSmi), U8(24), R(1), U8(2), - /* 77 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 77 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 84 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden index 107844cf6a..f19879c9e2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariable.golden @@ -30,23 +30,19 @@ handlers: [ snippet: " const x = 10; return x; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 20 +bytecode array length: 10 bytecodes: [ B(LdaTheHole), B(Star), R(0), /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaSmi), U8(10), B(Star), R(0), - /* 48 S> */ B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(1), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(1), U8(1), + /* 48 S> */ B(Nop), /* 58 S> */ B(Return), ] constant pool: [ - ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -84,9 +80,9 @@ handlers: [ snippet: " const x = 10; x = 20; " -frame size: 3 +frame size: 1 parameter count: 1 -bytecode array length: 32 +bytecode array length: 17 bytecodes: [ B(LdaTheHole), B(Star), R(0), @@ -94,18 +90,11 @@ bytecodes: [ /* 44 S> */ B(LdaSmi), U8(10), B(Star), R(0), /* 48 S> */ B(LdaSmi), U8(20), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(2), - /* 50 E> */ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), + /* 50 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), B(LdaUndefined), /* 56 S> */ B(Return), ] constant pool: [ - 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 f1b696bdff..8ee13434af 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ConstVariableContextSlot.golden @@ -11,17 +11,17 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 23 +bytecode array length: 19 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), 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), U8(0), + /* 44 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 74 S> */ B(Return), ] @@ -35,29 +35,24 @@ handlers: [ snippet: " const x = 10; function f1() {return x;} return x; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 37 +bytecode array length: 20 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), 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), U8(0), - /* 74 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(1), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + /* 44 E> */ B(StaCurrentContextSlot), U8(4), + /* 74 S> */ B(LdaCurrentContextSlot), U8(4), /* 84 S> */ B(Return), ] constant pool: [ SHARED_FUNCTION_INFO_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -68,24 +63,24 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 45 +bytecode array length: 39 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), 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), U8(0), + B(LdaCurrentContextSlot), U8(4), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(1), B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), + /* 47 E> */ 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), U8(0), + /* 47 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 80 S> */ B(Return), ] @@ -100,33 +95,26 @@ handlers: [ snippet: " const x = 10; x = 20; function f1() {return x;} " -frame size: 4 +frame size: 2 parameter count: 1 -bytecode array length: 47 +bytecode array length: 26 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), 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), U8(0), + /* 44 E> */ B(StaCurrentContextSlot), U8(4), /* 48 S> */ B(LdaSmi), U8(20), - B(Star), R(2), - /* 50 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), + /* 50 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), B(LdaUndefined), /* 82 S> */ B(Return), ] constant pool: [ 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 4e65f63fa2..9a05916e14 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextParameters.golden @@ -13,12 +13,12 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 15 +bytecode array length: 13 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 10 E> */ B(StackCheck), /* 19 S> */ B(CreateClosure), U8(0), U8(2), /* 52 S> */ B(Return), @@ -36,16 +36,16 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 21 +bytecode array length: 17 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 10 E> */ B(StackCheck), /* 27 S> */ B(CreateClosure), U8(0), U8(2), B(Star), R(0), - /* 53 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), + /* 53 S> */ B(LdaCurrentContextSlot), U8(4), /* 66 S> */ B(Return), ] constant pool: [ @@ -61,14 +61,14 @@ snippet: " " frame size: 1 parameter count: 5 -bytecode array length: 21 +bytecode array length: 17 bytecodes: [ B(CreateFunctionContext), U8(2), B(PushContext), R(0), B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(5), U8(0), + B(StaCurrentContextSlot), U8(5), B(Ldar), R(arg2), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 10 E> */ B(StackCheck), /* 29 S> */ B(CreateClosure), U8(0), U8(2), /* 61 S> */ B(Return), @@ -86,13 +86,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 15 +bytecode array length: 13 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), U8(0), + /* 26 E> */ B(StaCurrentContextSlot), U8(4), /* 32 S> */ B(CreateClosure), U8(0), U8(2), /* 65 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden index 2eb52731bb..f4b7943740 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden @@ -31,13 +31,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 15 +bytecode array length: 13 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), U8(0), + /* 42 E> */ B(StaCurrentContextSlot), U8(4), /* 45 S> */ B(CreateClosure), U8(0), U8(2), /* 75 S> */ B(Return), ] @@ -53,15 +53,15 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 21 +bytecode array length: 17 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), U8(0), + /* 42 E> */ B(StaCurrentContextSlot), U8(4), /* 53 S> */ B(LdaSmi), U8(2), - /* 53 E> */ B(StaContextSlot), R(context), U8(5), U8(0), + /* 53 E> */ B(StaCurrentContextSlot), U8(5), /* 56 S> */ B(CreateClosure), U8(0), U8(2), /* 92 S> */ B(Return), ] @@ -77,16 +77,17 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 22 +bytecode array length: 21 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), /* 30 E> */ B(StackCheck), - /* 41 S> */ B(LdrUndefined), R(2), + /* 41 S> */ B(LdaUndefined), + B(Star), R(2), B(CreateClosure), U8(0), U8(2), B(Star), R(1), /* 64 E> */ B(Call), R(1), R(2), U8(1), U8(2), - /* 68 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), + /* 68 S> */ B(LdaCurrentContextSlot), U8(4), /* 78 S> */ B(Return), ] constant pool: [ @@ -103,22 +104,22 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 39 +bytecode array length: 31 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 30 E> */ B(StackCheck), /* 56 S> */ B(LdaSmi), U8(1), - /* 56 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 56 E> */ B(StaCurrentContextSlot), U8(4), B(Ldar), R(closure), B(CreateBlockContext), U8(0), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 69 S> */ B(LdaSmi), U8(2), - /* 69 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 69 E> */ B(StaCurrentContextSlot), U8(4), /* 72 S> */ B(CreateClosure), U8(1), U8(2), B(PopContext), R(0), /* 104 S> */ B(Return), @@ -389,523 +390,525 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 1305 +bytecode array length: 791 bytecodes: [ B(CreateFunctionContext), U8(254), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateUnmappedArguments), - B(Wide), B(StaContextSlot), R16(context), U16(257), U16(0), + B(Wide), B(StaCurrentContextSlot), U16(257), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(5), U8(0), + B(StaCurrentContextSlot), U8(5), /* 30 E> */ B(StackCheck), /* 57 S> */ B(LdaZero), - /* 57 E> */ B(StaContextSlot), R(context), U8(6), U8(0), + /* 57 E> */ B(StaCurrentContextSlot), U8(6), /* 69 S> */ B(LdaZero), - /* 69 E> */ B(StaContextSlot), R(context), U8(7), U8(0), + /* 69 E> */ B(StaCurrentContextSlot), U8(7), /* 81 S> */ B(LdaZero), - /* 81 E> */ B(StaContextSlot), R(context), U8(8), U8(0), + /* 81 E> */ B(StaCurrentContextSlot), U8(8), /* 93 S> */ B(LdaZero), - /* 93 E> */ B(StaContextSlot), R(context), U8(9), U8(0), + /* 93 E> */ B(StaCurrentContextSlot), U8(9), /* 105 S> */ B(LdaZero), - /* 105 E> */ B(StaContextSlot), R(context), U8(10), U8(0), + /* 105 E> */ B(StaCurrentContextSlot), U8(10), /* 117 S> */ B(LdaZero), - /* 117 E> */ B(StaContextSlot), R(context), U8(11), U8(0), + /* 117 E> */ B(StaCurrentContextSlot), U8(11), /* 129 S> */ B(LdaZero), - /* 129 E> */ B(StaContextSlot), R(context), U8(12), U8(0), + /* 129 E> */ B(StaCurrentContextSlot), U8(12), /* 141 S> */ B(LdaZero), - /* 141 E> */ B(StaContextSlot), R(context), U8(13), U8(0), + /* 141 E> */ B(StaCurrentContextSlot), U8(13), /* 153 S> */ B(LdaZero), - /* 153 E> */ B(StaContextSlot), R(context), U8(14), U8(0), + /* 153 E> */ B(StaCurrentContextSlot), U8(14), /* 165 S> */ B(LdaZero), - /* 165 E> */ B(StaContextSlot), R(context), U8(15), U8(0), + /* 165 E> */ B(StaCurrentContextSlot), U8(15), /* 178 S> */ B(LdaZero), - /* 178 E> */ B(StaContextSlot), R(context), U8(16), U8(0), + /* 178 E> */ B(StaCurrentContextSlot), U8(16), /* 191 S> */ B(LdaZero), - /* 191 E> */ B(StaContextSlot), R(context), U8(17), U8(0), + /* 191 E> */ B(StaCurrentContextSlot), U8(17), /* 204 S> */ B(LdaZero), - /* 204 E> */ B(StaContextSlot), R(context), U8(18), U8(0), + /* 204 E> */ B(StaCurrentContextSlot), U8(18), /* 217 S> */ B(LdaZero), - /* 217 E> */ B(StaContextSlot), R(context), U8(19), U8(0), + /* 217 E> */ B(StaCurrentContextSlot), U8(19), /* 230 S> */ B(LdaZero), - /* 230 E> */ B(StaContextSlot), R(context), U8(20), U8(0), + /* 230 E> */ B(StaCurrentContextSlot), U8(20), /* 243 S> */ B(LdaZero), - /* 243 E> */ B(StaContextSlot), R(context), U8(21), U8(0), + /* 243 E> */ B(StaCurrentContextSlot), U8(21), /* 256 S> */ B(LdaZero), - /* 256 E> */ B(StaContextSlot), R(context), U8(22), U8(0), + /* 256 E> */ B(StaCurrentContextSlot), U8(22), /* 269 S> */ B(LdaZero), - /* 269 E> */ B(StaContextSlot), R(context), U8(23), U8(0), + /* 269 E> */ B(StaCurrentContextSlot), U8(23), /* 282 S> */ B(LdaZero), - /* 282 E> */ B(StaContextSlot), R(context), U8(24), U8(0), + /* 282 E> */ B(StaCurrentContextSlot), U8(24), /* 295 S> */ B(LdaZero), - /* 295 E> */ B(StaContextSlot), R(context), U8(25), U8(0), + /* 295 E> */ B(StaCurrentContextSlot), U8(25), /* 308 S> */ B(LdaZero), - /* 308 E> */ B(StaContextSlot), R(context), U8(26), U8(0), + /* 308 E> */ B(StaCurrentContextSlot), U8(26), /* 321 S> */ B(LdaZero), - /* 321 E> */ B(StaContextSlot), R(context), U8(27), U8(0), + /* 321 E> */ B(StaCurrentContextSlot), U8(27), /* 334 S> */ B(LdaZero), - /* 334 E> */ B(StaContextSlot), R(context), U8(28), U8(0), + /* 334 E> */ B(StaCurrentContextSlot), U8(28), /* 347 S> */ B(LdaZero), - /* 347 E> */ B(StaContextSlot), R(context), U8(29), U8(0), + /* 347 E> */ B(StaCurrentContextSlot), U8(29), /* 360 S> */ B(LdaZero), - /* 360 E> */ B(StaContextSlot), R(context), U8(30), U8(0), + /* 360 E> */ B(StaCurrentContextSlot), U8(30), /* 373 S> */ B(LdaZero), - /* 373 E> */ B(StaContextSlot), R(context), U8(31), U8(0), + /* 373 E> */ B(StaCurrentContextSlot), U8(31), /* 386 S> */ B(LdaZero), - /* 386 E> */ B(StaContextSlot), R(context), U8(32), U8(0), + /* 386 E> */ B(StaCurrentContextSlot), U8(32), /* 399 S> */ B(LdaZero), - /* 399 E> */ B(StaContextSlot), R(context), U8(33), U8(0), + /* 399 E> */ B(StaCurrentContextSlot), U8(33), /* 412 S> */ B(LdaZero), - /* 412 E> */ B(StaContextSlot), R(context), U8(34), U8(0), + /* 412 E> */ B(StaCurrentContextSlot), U8(34), /* 425 S> */ B(LdaZero), - /* 425 E> */ B(StaContextSlot), R(context), U8(35), U8(0), + /* 425 E> */ B(StaCurrentContextSlot), U8(35), /* 438 S> */ B(LdaZero), - /* 438 E> */ B(StaContextSlot), R(context), U8(36), U8(0), + /* 438 E> */ B(StaCurrentContextSlot), U8(36), /* 451 S> */ B(LdaZero), - /* 451 E> */ B(StaContextSlot), R(context), U8(37), U8(0), + /* 451 E> */ B(StaCurrentContextSlot), U8(37), /* 464 S> */ B(LdaZero), - /* 464 E> */ B(StaContextSlot), R(context), U8(38), U8(0), + /* 464 E> */ B(StaCurrentContextSlot), U8(38), /* 477 S> */ B(LdaZero), - /* 477 E> */ B(StaContextSlot), R(context), U8(39), U8(0), + /* 477 E> */ B(StaCurrentContextSlot), U8(39), /* 490 S> */ B(LdaZero), - /* 490 E> */ B(StaContextSlot), R(context), U8(40), U8(0), + /* 490 E> */ B(StaCurrentContextSlot), U8(40), /* 503 S> */ B(LdaZero), - /* 503 E> */ B(StaContextSlot), R(context), U8(41), U8(0), + /* 503 E> */ B(StaCurrentContextSlot), U8(41), /* 516 S> */ B(LdaZero), - /* 516 E> */ B(StaContextSlot), R(context), U8(42), U8(0), + /* 516 E> */ B(StaCurrentContextSlot), U8(42), /* 529 S> */ B(LdaZero), - /* 529 E> */ B(StaContextSlot), R(context), U8(43), U8(0), + /* 529 E> */ B(StaCurrentContextSlot), U8(43), /* 542 S> */ B(LdaZero), - /* 542 E> */ B(StaContextSlot), R(context), U8(44), U8(0), + /* 542 E> */ B(StaCurrentContextSlot), U8(44), /* 555 S> */ B(LdaZero), - /* 555 E> */ B(StaContextSlot), R(context), U8(45), U8(0), + /* 555 E> */ B(StaCurrentContextSlot), U8(45), /* 568 S> */ B(LdaZero), - /* 568 E> */ B(StaContextSlot), R(context), U8(46), U8(0), + /* 568 E> */ B(StaCurrentContextSlot), U8(46), /* 581 S> */ B(LdaZero), - /* 581 E> */ B(StaContextSlot), R(context), U8(47), U8(0), + /* 581 E> */ B(StaCurrentContextSlot), U8(47), /* 594 S> */ B(LdaZero), - /* 594 E> */ B(StaContextSlot), R(context), U8(48), U8(0), + /* 594 E> */ B(StaCurrentContextSlot), U8(48), /* 607 S> */ B(LdaZero), - /* 607 E> */ B(StaContextSlot), R(context), U8(49), U8(0), + /* 607 E> */ B(StaCurrentContextSlot), U8(49), /* 620 S> */ B(LdaZero), - /* 620 E> */ B(StaContextSlot), R(context), U8(50), U8(0), + /* 620 E> */ B(StaCurrentContextSlot), U8(50), /* 633 S> */ B(LdaZero), - /* 633 E> */ B(StaContextSlot), R(context), U8(51), U8(0), + /* 633 E> */ B(StaCurrentContextSlot), U8(51), /* 646 S> */ B(LdaZero), - /* 646 E> */ B(StaContextSlot), R(context), U8(52), U8(0), + /* 646 E> */ B(StaCurrentContextSlot), U8(52), /* 659 S> */ B(LdaZero), - /* 659 E> */ B(StaContextSlot), R(context), U8(53), U8(0), + /* 659 E> */ B(StaCurrentContextSlot), U8(53), /* 672 S> */ B(LdaZero), - /* 672 E> */ B(StaContextSlot), R(context), U8(54), U8(0), + /* 672 E> */ B(StaCurrentContextSlot), U8(54), /* 685 S> */ B(LdaZero), - /* 685 E> */ B(StaContextSlot), R(context), U8(55), U8(0), + /* 685 E> */ B(StaCurrentContextSlot), U8(55), /* 698 S> */ B(LdaZero), - /* 698 E> */ B(StaContextSlot), R(context), U8(56), U8(0), + /* 698 E> */ B(StaCurrentContextSlot), U8(56), /* 711 S> */ B(LdaZero), - /* 711 E> */ B(StaContextSlot), R(context), U8(57), U8(0), + /* 711 E> */ B(StaCurrentContextSlot), U8(57), /* 724 S> */ B(LdaZero), - /* 724 E> */ B(StaContextSlot), R(context), U8(58), U8(0), + /* 724 E> */ B(StaCurrentContextSlot), U8(58), /* 737 S> */ B(LdaZero), - /* 737 E> */ B(StaContextSlot), R(context), U8(59), U8(0), + /* 737 E> */ B(StaCurrentContextSlot), U8(59), /* 750 S> */ B(LdaZero), - /* 750 E> */ B(StaContextSlot), R(context), U8(60), U8(0), + /* 750 E> */ B(StaCurrentContextSlot), U8(60), /* 763 S> */ B(LdaZero), - /* 763 E> */ B(StaContextSlot), R(context), U8(61), U8(0), + /* 763 E> */ B(StaCurrentContextSlot), U8(61), /* 776 S> */ B(LdaZero), - /* 776 E> */ B(StaContextSlot), R(context), U8(62), U8(0), + /* 776 E> */ B(StaCurrentContextSlot), U8(62), /* 789 S> */ B(LdaZero), - /* 789 E> */ B(StaContextSlot), R(context), U8(63), U8(0), + /* 789 E> */ B(StaCurrentContextSlot), U8(63), /* 802 S> */ B(LdaZero), - /* 802 E> */ B(StaContextSlot), R(context), U8(64), U8(0), + /* 802 E> */ B(StaCurrentContextSlot), U8(64), /* 815 S> */ B(LdaZero), - /* 815 E> */ B(StaContextSlot), R(context), U8(65), U8(0), + /* 815 E> */ B(StaCurrentContextSlot), U8(65), /* 828 S> */ B(LdaZero), - /* 828 E> */ B(StaContextSlot), R(context), U8(66), U8(0), + /* 828 E> */ B(StaCurrentContextSlot), U8(66), /* 841 S> */ B(LdaZero), - /* 841 E> */ B(StaContextSlot), R(context), U8(67), U8(0), + /* 841 E> */ B(StaCurrentContextSlot), U8(67), /* 854 S> */ B(LdaZero), - /* 854 E> */ B(StaContextSlot), R(context), U8(68), U8(0), + /* 854 E> */ B(StaCurrentContextSlot), U8(68), /* 867 S> */ B(LdaZero), - /* 867 E> */ B(StaContextSlot), R(context), U8(69), U8(0), + /* 867 E> */ B(StaCurrentContextSlot), U8(69), /* 880 S> */ B(LdaZero), - /* 880 E> */ B(StaContextSlot), R(context), U8(70), U8(0), + /* 880 E> */ B(StaCurrentContextSlot), U8(70), /* 893 S> */ B(LdaZero), - /* 893 E> */ B(StaContextSlot), R(context), U8(71), U8(0), + /* 893 E> */ B(StaCurrentContextSlot), U8(71), /* 906 S> */ B(LdaZero), - /* 906 E> */ B(StaContextSlot), R(context), U8(72), U8(0), + /* 906 E> */ B(StaCurrentContextSlot), U8(72), /* 919 S> */ B(LdaZero), - /* 919 E> */ B(StaContextSlot), R(context), U8(73), U8(0), + /* 919 E> */ B(StaCurrentContextSlot), U8(73), /* 932 S> */ B(LdaZero), - /* 932 E> */ B(StaContextSlot), R(context), U8(74), U8(0), + /* 932 E> */ B(StaCurrentContextSlot), U8(74), /* 945 S> */ B(LdaZero), - /* 945 E> */ B(StaContextSlot), R(context), U8(75), U8(0), + /* 945 E> */ B(StaCurrentContextSlot), U8(75), /* 958 S> */ B(LdaZero), - /* 958 E> */ B(StaContextSlot), R(context), U8(76), U8(0), + /* 958 E> */ B(StaCurrentContextSlot), U8(76), /* 971 S> */ B(LdaZero), - /* 971 E> */ B(StaContextSlot), R(context), U8(77), U8(0), + /* 971 E> */ B(StaCurrentContextSlot), U8(77), /* 984 S> */ B(LdaZero), - /* 984 E> */ B(StaContextSlot), R(context), U8(78), U8(0), + /* 984 E> */ B(StaCurrentContextSlot), U8(78), /* 997 S> */ B(LdaZero), - /* 997 E> */ B(StaContextSlot), R(context), U8(79), U8(0), + /* 997 E> */ B(StaCurrentContextSlot), U8(79), /* 1010 S> */ B(LdaZero), - /* 1010 E> */ B(StaContextSlot), R(context), U8(80), U8(0), + /* 1010 E> */ B(StaCurrentContextSlot), U8(80), /* 1023 S> */ B(LdaZero), - /* 1023 E> */ B(StaContextSlot), R(context), U8(81), U8(0), + /* 1023 E> */ B(StaCurrentContextSlot), U8(81), /* 1036 S> */ B(LdaZero), - /* 1036 E> */ B(StaContextSlot), R(context), U8(82), U8(0), + /* 1036 E> */ B(StaCurrentContextSlot), U8(82), /* 1049 S> */ B(LdaZero), - /* 1049 E> */ B(StaContextSlot), R(context), U8(83), U8(0), + /* 1049 E> */ B(StaCurrentContextSlot), U8(83), /* 1062 S> */ B(LdaZero), - /* 1062 E> */ B(StaContextSlot), R(context), U8(84), U8(0), + /* 1062 E> */ B(StaCurrentContextSlot), U8(84), /* 1075 S> */ B(LdaZero), - /* 1075 E> */ B(StaContextSlot), R(context), U8(85), U8(0), + /* 1075 E> */ B(StaCurrentContextSlot), U8(85), /* 1088 S> */ B(LdaZero), - /* 1088 E> */ B(StaContextSlot), R(context), U8(86), U8(0), + /* 1088 E> */ B(StaCurrentContextSlot), U8(86), /* 1101 S> */ B(LdaZero), - /* 1101 E> */ B(StaContextSlot), R(context), U8(87), U8(0), + /* 1101 E> */ B(StaCurrentContextSlot), U8(87), /* 1114 S> */ B(LdaZero), - /* 1114 E> */ B(StaContextSlot), R(context), U8(88), U8(0), + /* 1114 E> */ B(StaCurrentContextSlot), U8(88), /* 1127 S> */ B(LdaZero), - /* 1127 E> */ B(StaContextSlot), R(context), U8(89), U8(0), + /* 1127 E> */ B(StaCurrentContextSlot), U8(89), /* 1140 S> */ B(LdaZero), - /* 1140 E> */ B(StaContextSlot), R(context), U8(90), U8(0), + /* 1140 E> */ B(StaCurrentContextSlot), U8(90), /* 1153 S> */ B(LdaZero), - /* 1153 E> */ B(StaContextSlot), R(context), U8(91), U8(0), + /* 1153 E> */ B(StaCurrentContextSlot), U8(91), /* 1166 S> */ B(LdaZero), - /* 1166 E> */ B(StaContextSlot), R(context), U8(92), U8(0), + /* 1166 E> */ B(StaCurrentContextSlot), U8(92), /* 1179 S> */ B(LdaZero), - /* 1179 E> */ B(StaContextSlot), R(context), U8(93), U8(0), + /* 1179 E> */ B(StaCurrentContextSlot), U8(93), /* 1192 S> */ B(LdaZero), - /* 1192 E> */ B(StaContextSlot), R(context), U8(94), U8(0), + /* 1192 E> */ B(StaCurrentContextSlot), U8(94), /* 1205 S> */ B(LdaZero), - /* 1205 E> */ B(StaContextSlot), R(context), U8(95), U8(0), + /* 1205 E> */ B(StaCurrentContextSlot), U8(95), /* 1218 S> */ B(LdaZero), - /* 1218 E> */ B(StaContextSlot), R(context), U8(96), U8(0), + /* 1218 E> */ B(StaCurrentContextSlot), U8(96), /* 1231 S> */ B(LdaZero), - /* 1231 E> */ B(StaContextSlot), R(context), U8(97), U8(0), + /* 1231 E> */ B(StaCurrentContextSlot), U8(97), /* 1244 S> */ B(LdaZero), - /* 1244 E> */ B(StaContextSlot), R(context), U8(98), U8(0), + /* 1244 E> */ B(StaCurrentContextSlot), U8(98), /* 1257 S> */ B(LdaZero), - /* 1257 E> */ B(StaContextSlot), R(context), U8(99), U8(0), + /* 1257 E> */ B(StaCurrentContextSlot), U8(99), /* 1270 S> */ B(LdaZero), - /* 1270 E> */ B(StaContextSlot), R(context), U8(100), U8(0), + /* 1270 E> */ B(StaCurrentContextSlot), U8(100), /* 1283 S> */ B(LdaZero), - /* 1283 E> */ B(StaContextSlot), R(context), U8(101), U8(0), + /* 1283 E> */ B(StaCurrentContextSlot), U8(101), /* 1296 S> */ B(LdaZero), - /* 1296 E> */ B(StaContextSlot), R(context), U8(102), U8(0), + /* 1296 E> */ B(StaCurrentContextSlot), U8(102), /* 1309 S> */ B(LdaZero), - /* 1309 E> */ B(StaContextSlot), R(context), U8(103), U8(0), + /* 1309 E> */ B(StaCurrentContextSlot), U8(103), /* 1322 S> */ B(LdaZero), - /* 1322 E> */ B(StaContextSlot), R(context), U8(104), U8(0), + /* 1322 E> */ B(StaCurrentContextSlot), U8(104), /* 1335 S> */ B(LdaZero), - /* 1335 E> */ B(StaContextSlot), R(context), U8(105), U8(0), + /* 1335 E> */ B(StaCurrentContextSlot), U8(105), /* 1349 S> */ B(LdaZero), - /* 1349 E> */ B(StaContextSlot), R(context), U8(106), U8(0), + /* 1349 E> */ B(StaCurrentContextSlot), U8(106), /* 1363 S> */ B(LdaZero), - /* 1363 E> */ B(StaContextSlot), R(context), U8(107), U8(0), + /* 1363 E> */ B(StaCurrentContextSlot), U8(107), /* 1377 S> */ B(LdaZero), - /* 1377 E> */ B(StaContextSlot), R(context), U8(108), U8(0), + /* 1377 E> */ B(StaCurrentContextSlot), U8(108), /* 1391 S> */ B(LdaZero), - /* 1391 E> */ B(StaContextSlot), R(context), U8(109), U8(0), + /* 1391 E> */ B(StaCurrentContextSlot), U8(109), /* 1405 S> */ B(LdaZero), - /* 1405 E> */ B(StaContextSlot), R(context), U8(110), U8(0), + /* 1405 E> */ B(StaCurrentContextSlot), U8(110), /* 1419 S> */ B(LdaZero), - /* 1419 E> */ B(StaContextSlot), R(context), U8(111), U8(0), + /* 1419 E> */ B(StaCurrentContextSlot), U8(111), /* 1433 S> */ B(LdaZero), - /* 1433 E> */ B(StaContextSlot), R(context), U8(112), U8(0), + /* 1433 E> */ B(StaCurrentContextSlot), U8(112), /* 1447 S> */ B(LdaZero), - /* 1447 E> */ B(StaContextSlot), R(context), U8(113), U8(0), + /* 1447 E> */ B(StaCurrentContextSlot), U8(113), /* 1461 S> */ B(LdaZero), - /* 1461 E> */ B(StaContextSlot), R(context), U8(114), U8(0), + /* 1461 E> */ B(StaCurrentContextSlot), U8(114), /* 1475 S> */ B(LdaZero), - /* 1475 E> */ B(StaContextSlot), R(context), U8(115), U8(0), + /* 1475 E> */ B(StaCurrentContextSlot), U8(115), /* 1489 S> */ B(LdaZero), - /* 1489 E> */ B(StaContextSlot), R(context), U8(116), U8(0), + /* 1489 E> */ B(StaCurrentContextSlot), U8(116), /* 1503 S> */ B(LdaZero), - /* 1503 E> */ B(StaContextSlot), R(context), U8(117), U8(0), + /* 1503 E> */ B(StaCurrentContextSlot), U8(117), /* 1517 S> */ B(LdaZero), - /* 1517 E> */ B(StaContextSlot), R(context), U8(118), U8(0), + /* 1517 E> */ B(StaCurrentContextSlot), U8(118), /* 1531 S> */ B(LdaZero), - /* 1531 E> */ B(StaContextSlot), R(context), U8(119), U8(0), + /* 1531 E> */ B(StaCurrentContextSlot), U8(119), /* 1545 S> */ B(LdaZero), - /* 1545 E> */ B(StaContextSlot), R(context), U8(120), U8(0), + /* 1545 E> */ B(StaCurrentContextSlot), U8(120), /* 1559 S> */ B(LdaZero), - /* 1559 E> */ B(StaContextSlot), R(context), U8(121), U8(0), + /* 1559 E> */ B(StaCurrentContextSlot), U8(121), /* 1573 S> */ B(LdaZero), - /* 1573 E> */ B(StaContextSlot), R(context), U8(122), U8(0), + /* 1573 E> */ B(StaCurrentContextSlot), U8(122), /* 1587 S> */ B(LdaZero), - /* 1587 E> */ B(StaContextSlot), R(context), U8(123), U8(0), + /* 1587 E> */ B(StaCurrentContextSlot), U8(123), /* 1601 S> */ B(LdaZero), - /* 1601 E> */ B(StaContextSlot), R(context), U8(124), U8(0), + /* 1601 E> */ B(StaCurrentContextSlot), U8(124), /* 1615 S> */ B(LdaZero), - /* 1615 E> */ B(StaContextSlot), R(context), U8(125), U8(0), + /* 1615 E> */ B(StaCurrentContextSlot), U8(125), /* 1629 S> */ B(LdaZero), - /* 1629 E> */ B(StaContextSlot), R(context), U8(126), U8(0), + /* 1629 E> */ B(StaCurrentContextSlot), U8(126), /* 1643 S> */ B(LdaZero), - /* 1643 E> */ B(StaContextSlot), R(context), U8(127), U8(0), + /* 1643 E> */ B(StaCurrentContextSlot), U8(127), /* 1657 S> */ B(LdaZero), - /* 1657 E> */ B(StaContextSlot), R(context), U8(128), U8(0), + /* 1657 E> */ B(StaCurrentContextSlot), U8(128), /* 1671 S> */ B(LdaZero), - /* 1671 E> */ B(StaContextSlot), R(context), U8(129), U8(0), + /* 1671 E> */ B(StaCurrentContextSlot), U8(129), /* 1685 S> */ B(LdaZero), - /* 1685 E> */ B(StaContextSlot), R(context), U8(130), U8(0), + /* 1685 E> */ B(StaCurrentContextSlot), U8(130), /* 1699 S> */ B(LdaZero), - /* 1699 E> */ B(StaContextSlot), R(context), U8(131), U8(0), + /* 1699 E> */ B(StaCurrentContextSlot), U8(131), /* 1713 S> */ B(LdaZero), - /* 1713 E> */ B(StaContextSlot), R(context), U8(132), U8(0), + /* 1713 E> */ B(StaCurrentContextSlot), U8(132), /* 1727 S> */ B(LdaZero), - /* 1727 E> */ B(StaContextSlot), R(context), U8(133), U8(0), + /* 1727 E> */ B(StaCurrentContextSlot), U8(133), /* 1741 S> */ B(LdaZero), - /* 1741 E> */ B(StaContextSlot), R(context), U8(134), U8(0), + /* 1741 E> */ B(StaCurrentContextSlot), U8(134), /* 1755 S> */ B(LdaZero), - /* 1755 E> */ B(StaContextSlot), R(context), U8(135), U8(0), + /* 1755 E> */ B(StaCurrentContextSlot), U8(135), /* 1769 S> */ B(LdaZero), - /* 1769 E> */ B(StaContextSlot), R(context), U8(136), U8(0), + /* 1769 E> */ B(StaCurrentContextSlot), U8(136), /* 1783 S> */ B(LdaZero), - /* 1783 E> */ B(StaContextSlot), R(context), U8(137), U8(0), + /* 1783 E> */ B(StaCurrentContextSlot), U8(137), /* 1797 S> */ B(LdaZero), - /* 1797 E> */ B(StaContextSlot), R(context), U8(138), U8(0), + /* 1797 E> */ B(StaCurrentContextSlot), U8(138), /* 1811 S> */ B(LdaZero), - /* 1811 E> */ B(StaContextSlot), R(context), U8(139), U8(0), + /* 1811 E> */ B(StaCurrentContextSlot), U8(139), /* 1825 S> */ B(LdaZero), - /* 1825 E> */ B(StaContextSlot), R(context), U8(140), U8(0), + /* 1825 E> */ B(StaCurrentContextSlot), U8(140), /* 1839 S> */ B(LdaZero), - /* 1839 E> */ B(StaContextSlot), R(context), U8(141), U8(0), + /* 1839 E> */ B(StaCurrentContextSlot), U8(141), /* 1853 S> */ B(LdaZero), - /* 1853 E> */ B(StaContextSlot), R(context), U8(142), U8(0), + /* 1853 E> */ B(StaCurrentContextSlot), U8(142), /* 1867 S> */ B(LdaZero), - /* 1867 E> */ B(StaContextSlot), R(context), U8(143), U8(0), + /* 1867 E> */ B(StaCurrentContextSlot), U8(143), /* 1881 S> */ B(LdaZero), - /* 1881 E> */ B(StaContextSlot), R(context), U8(144), U8(0), + /* 1881 E> */ B(StaCurrentContextSlot), U8(144), /* 1895 S> */ B(LdaZero), - /* 1895 E> */ B(StaContextSlot), R(context), U8(145), U8(0), + /* 1895 E> */ B(StaCurrentContextSlot), U8(145), /* 1909 S> */ B(LdaZero), - /* 1909 E> */ B(StaContextSlot), R(context), U8(146), U8(0), + /* 1909 E> */ B(StaCurrentContextSlot), U8(146), /* 1923 S> */ B(LdaZero), - /* 1923 E> */ B(StaContextSlot), R(context), U8(147), U8(0), + /* 1923 E> */ B(StaCurrentContextSlot), U8(147), /* 1937 S> */ B(LdaZero), - /* 1937 E> */ B(StaContextSlot), R(context), U8(148), U8(0), + /* 1937 E> */ B(StaCurrentContextSlot), U8(148), /* 1951 S> */ B(LdaZero), - /* 1951 E> */ B(StaContextSlot), R(context), U8(149), U8(0), + /* 1951 E> */ B(StaCurrentContextSlot), U8(149), /* 1965 S> */ B(LdaZero), - /* 1965 E> */ B(StaContextSlot), R(context), U8(150), U8(0), + /* 1965 E> */ B(StaCurrentContextSlot), U8(150), /* 1979 S> */ B(LdaZero), - /* 1979 E> */ B(StaContextSlot), R(context), U8(151), U8(0), + /* 1979 E> */ B(StaCurrentContextSlot), U8(151), /* 1993 S> */ B(LdaZero), - /* 1993 E> */ B(StaContextSlot), R(context), U8(152), U8(0), + /* 1993 E> */ B(StaCurrentContextSlot), U8(152), /* 2007 S> */ B(LdaZero), - /* 2007 E> */ B(StaContextSlot), R(context), U8(153), U8(0), + /* 2007 E> */ B(StaCurrentContextSlot), U8(153), /* 2021 S> */ B(LdaZero), - /* 2021 E> */ B(StaContextSlot), R(context), U8(154), U8(0), + /* 2021 E> */ B(StaCurrentContextSlot), U8(154), /* 2035 S> */ B(LdaZero), - /* 2035 E> */ B(StaContextSlot), R(context), U8(155), U8(0), + /* 2035 E> */ B(StaCurrentContextSlot), U8(155), /* 2049 S> */ B(LdaZero), - /* 2049 E> */ B(StaContextSlot), R(context), U8(156), U8(0), + /* 2049 E> */ B(StaCurrentContextSlot), U8(156), /* 2063 S> */ B(LdaZero), - /* 2063 E> */ B(StaContextSlot), R(context), U8(157), U8(0), + /* 2063 E> */ B(StaCurrentContextSlot), U8(157), /* 2077 S> */ B(LdaZero), - /* 2077 E> */ B(StaContextSlot), R(context), U8(158), U8(0), + /* 2077 E> */ B(StaCurrentContextSlot), U8(158), /* 2091 S> */ B(LdaZero), - /* 2091 E> */ B(StaContextSlot), R(context), U8(159), U8(0), + /* 2091 E> */ B(StaCurrentContextSlot), U8(159), /* 2105 S> */ B(LdaZero), - /* 2105 E> */ B(StaContextSlot), R(context), U8(160), U8(0), + /* 2105 E> */ B(StaCurrentContextSlot), U8(160), /* 2119 S> */ B(LdaZero), - /* 2119 E> */ B(StaContextSlot), R(context), U8(161), U8(0), + /* 2119 E> */ B(StaCurrentContextSlot), U8(161), /* 2133 S> */ B(LdaZero), - /* 2133 E> */ B(StaContextSlot), R(context), U8(162), U8(0), + /* 2133 E> */ B(StaCurrentContextSlot), U8(162), /* 2147 S> */ B(LdaZero), - /* 2147 E> */ B(StaContextSlot), R(context), U8(163), U8(0), + /* 2147 E> */ B(StaCurrentContextSlot), U8(163), /* 2161 S> */ B(LdaZero), - /* 2161 E> */ B(StaContextSlot), R(context), U8(164), U8(0), + /* 2161 E> */ B(StaCurrentContextSlot), U8(164), /* 2175 S> */ B(LdaZero), - /* 2175 E> */ B(StaContextSlot), R(context), U8(165), U8(0), + /* 2175 E> */ B(StaCurrentContextSlot), U8(165), /* 2189 S> */ B(LdaZero), - /* 2189 E> */ B(StaContextSlot), R(context), U8(166), U8(0), + /* 2189 E> */ B(StaCurrentContextSlot), U8(166), /* 2203 S> */ B(LdaZero), - /* 2203 E> */ B(StaContextSlot), R(context), U8(167), U8(0), + /* 2203 E> */ B(StaCurrentContextSlot), U8(167), /* 2217 S> */ B(LdaZero), - /* 2217 E> */ B(StaContextSlot), R(context), U8(168), U8(0), + /* 2217 E> */ B(StaCurrentContextSlot), U8(168), /* 2231 S> */ B(LdaZero), - /* 2231 E> */ B(StaContextSlot), R(context), U8(169), U8(0), + /* 2231 E> */ B(StaCurrentContextSlot), U8(169), /* 2245 S> */ B(LdaZero), - /* 2245 E> */ B(StaContextSlot), R(context), U8(170), U8(0), + /* 2245 E> */ B(StaCurrentContextSlot), U8(170), /* 2259 S> */ B(LdaZero), - /* 2259 E> */ B(StaContextSlot), R(context), U8(171), U8(0), + /* 2259 E> */ B(StaCurrentContextSlot), U8(171), /* 2273 S> */ B(LdaZero), - /* 2273 E> */ B(StaContextSlot), R(context), U8(172), U8(0), + /* 2273 E> */ B(StaCurrentContextSlot), U8(172), /* 2287 S> */ B(LdaZero), - /* 2287 E> */ B(StaContextSlot), R(context), U8(173), U8(0), + /* 2287 E> */ B(StaCurrentContextSlot), U8(173), /* 2301 S> */ B(LdaZero), - /* 2301 E> */ B(StaContextSlot), R(context), U8(174), U8(0), + /* 2301 E> */ B(StaCurrentContextSlot), U8(174), /* 2315 S> */ B(LdaZero), - /* 2315 E> */ B(StaContextSlot), R(context), U8(175), U8(0), + /* 2315 E> */ B(StaCurrentContextSlot), U8(175), /* 2329 S> */ B(LdaZero), - /* 2329 E> */ B(StaContextSlot), R(context), U8(176), U8(0), + /* 2329 E> */ B(StaCurrentContextSlot), U8(176), /* 2343 S> */ B(LdaZero), - /* 2343 E> */ B(StaContextSlot), R(context), U8(177), U8(0), + /* 2343 E> */ B(StaCurrentContextSlot), U8(177), /* 2357 S> */ B(LdaZero), - /* 2357 E> */ B(StaContextSlot), R(context), U8(178), U8(0), + /* 2357 E> */ B(StaCurrentContextSlot), U8(178), /* 2371 S> */ B(LdaZero), - /* 2371 E> */ B(StaContextSlot), R(context), U8(179), U8(0), + /* 2371 E> */ B(StaCurrentContextSlot), U8(179), /* 2385 S> */ B(LdaZero), - /* 2385 E> */ B(StaContextSlot), R(context), U8(180), U8(0), + /* 2385 E> */ B(StaCurrentContextSlot), U8(180), /* 2399 S> */ B(LdaZero), - /* 2399 E> */ B(StaContextSlot), R(context), U8(181), U8(0), + /* 2399 E> */ B(StaCurrentContextSlot), U8(181), /* 2413 S> */ B(LdaZero), - /* 2413 E> */ B(StaContextSlot), R(context), U8(182), U8(0), + /* 2413 E> */ B(StaCurrentContextSlot), U8(182), /* 2427 S> */ B(LdaZero), - /* 2427 E> */ B(StaContextSlot), R(context), U8(183), U8(0), + /* 2427 E> */ B(StaCurrentContextSlot), U8(183), /* 2441 S> */ B(LdaZero), - /* 2441 E> */ B(StaContextSlot), R(context), U8(184), U8(0), + /* 2441 E> */ B(StaCurrentContextSlot), U8(184), /* 2455 S> */ B(LdaZero), - /* 2455 E> */ B(StaContextSlot), R(context), U8(185), U8(0), + /* 2455 E> */ B(StaCurrentContextSlot), U8(185), /* 2469 S> */ B(LdaZero), - /* 2469 E> */ B(StaContextSlot), R(context), U8(186), U8(0), + /* 2469 E> */ B(StaCurrentContextSlot), U8(186), /* 2483 S> */ B(LdaZero), - /* 2483 E> */ B(StaContextSlot), R(context), U8(187), U8(0), + /* 2483 E> */ B(StaCurrentContextSlot), U8(187), /* 2497 S> */ B(LdaZero), - /* 2497 E> */ B(StaContextSlot), R(context), U8(188), U8(0), + /* 2497 E> */ B(StaCurrentContextSlot), U8(188), /* 2511 S> */ B(LdaZero), - /* 2511 E> */ B(StaContextSlot), R(context), U8(189), U8(0), + /* 2511 E> */ B(StaCurrentContextSlot), U8(189), /* 2525 S> */ B(LdaZero), - /* 2525 E> */ B(StaContextSlot), R(context), U8(190), U8(0), + /* 2525 E> */ B(StaCurrentContextSlot), U8(190), /* 2539 S> */ B(LdaZero), - /* 2539 E> */ B(StaContextSlot), R(context), U8(191), U8(0), + /* 2539 E> */ B(StaCurrentContextSlot), U8(191), /* 2553 S> */ B(LdaZero), - /* 2553 E> */ B(StaContextSlot), R(context), U8(192), U8(0), + /* 2553 E> */ B(StaCurrentContextSlot), U8(192), /* 2567 S> */ B(LdaZero), - /* 2567 E> */ B(StaContextSlot), R(context), U8(193), U8(0), + /* 2567 E> */ B(StaCurrentContextSlot), U8(193), /* 2581 S> */ B(LdaZero), - /* 2581 E> */ B(StaContextSlot), R(context), U8(194), U8(0), + /* 2581 E> */ B(StaCurrentContextSlot), U8(194), /* 2595 S> */ B(LdaZero), - /* 2595 E> */ B(StaContextSlot), R(context), U8(195), U8(0), + /* 2595 E> */ B(StaCurrentContextSlot), U8(195), /* 2609 S> */ B(LdaZero), - /* 2609 E> */ B(StaContextSlot), R(context), U8(196), U8(0), + /* 2609 E> */ B(StaCurrentContextSlot), U8(196), /* 2623 S> */ B(LdaZero), - /* 2623 E> */ B(StaContextSlot), R(context), U8(197), U8(0), + /* 2623 E> */ B(StaCurrentContextSlot), U8(197), /* 2637 S> */ B(LdaZero), - /* 2637 E> */ B(StaContextSlot), R(context), U8(198), U8(0), + /* 2637 E> */ B(StaCurrentContextSlot), U8(198), /* 2651 S> */ B(LdaZero), - /* 2651 E> */ B(StaContextSlot), R(context), U8(199), U8(0), + /* 2651 E> */ B(StaCurrentContextSlot), U8(199), /* 2665 S> */ B(LdaZero), - /* 2665 E> */ B(StaContextSlot), R(context), U8(200), U8(0), + /* 2665 E> */ B(StaCurrentContextSlot), U8(200), /* 2679 S> */ B(LdaZero), - /* 2679 E> */ B(StaContextSlot), R(context), U8(201), U8(0), + /* 2679 E> */ B(StaCurrentContextSlot), U8(201), /* 2693 S> */ B(LdaZero), - /* 2693 E> */ B(StaContextSlot), R(context), U8(202), U8(0), + /* 2693 E> */ B(StaCurrentContextSlot), U8(202), /* 2707 S> */ B(LdaZero), - /* 2707 E> */ B(StaContextSlot), R(context), U8(203), U8(0), + /* 2707 E> */ B(StaCurrentContextSlot), U8(203), /* 2721 S> */ B(LdaZero), - /* 2721 E> */ B(StaContextSlot), R(context), U8(204), U8(0), + /* 2721 E> */ B(StaCurrentContextSlot), U8(204), /* 2735 S> */ B(LdaZero), - /* 2735 E> */ B(StaContextSlot), R(context), U8(205), U8(0), + /* 2735 E> */ B(StaCurrentContextSlot), U8(205), /* 2749 S> */ B(LdaZero), - /* 2749 E> */ B(StaContextSlot), R(context), U8(206), U8(0), + /* 2749 E> */ B(StaCurrentContextSlot), U8(206), /* 2763 S> */ B(LdaZero), - /* 2763 E> */ B(StaContextSlot), R(context), U8(207), U8(0), + /* 2763 E> */ B(StaCurrentContextSlot), U8(207), /* 2777 S> */ B(LdaZero), - /* 2777 E> */ B(StaContextSlot), R(context), U8(208), U8(0), + /* 2777 E> */ B(StaCurrentContextSlot), U8(208), /* 2791 S> */ B(LdaZero), - /* 2791 E> */ B(StaContextSlot), R(context), U8(209), U8(0), + /* 2791 E> */ B(StaCurrentContextSlot), U8(209), /* 2805 S> */ B(LdaZero), - /* 2805 E> */ B(StaContextSlot), R(context), U8(210), U8(0), + /* 2805 E> */ B(StaCurrentContextSlot), U8(210), /* 2819 S> */ B(LdaZero), - /* 2819 E> */ B(StaContextSlot), R(context), U8(211), U8(0), + /* 2819 E> */ B(StaCurrentContextSlot), U8(211), /* 2833 S> */ B(LdaZero), - /* 2833 E> */ B(StaContextSlot), R(context), U8(212), U8(0), + /* 2833 E> */ B(StaCurrentContextSlot), U8(212), /* 2847 S> */ B(LdaZero), - /* 2847 E> */ B(StaContextSlot), R(context), U8(213), U8(0), + /* 2847 E> */ B(StaCurrentContextSlot), U8(213), /* 2861 S> */ B(LdaZero), - /* 2861 E> */ B(StaContextSlot), R(context), U8(214), U8(0), + /* 2861 E> */ B(StaCurrentContextSlot), U8(214), /* 2875 S> */ B(LdaZero), - /* 2875 E> */ B(StaContextSlot), R(context), U8(215), U8(0), + /* 2875 E> */ B(StaCurrentContextSlot), U8(215), /* 2889 S> */ B(LdaZero), - /* 2889 E> */ B(StaContextSlot), R(context), U8(216), U8(0), + /* 2889 E> */ B(StaCurrentContextSlot), U8(216), /* 2903 S> */ B(LdaZero), - /* 2903 E> */ B(StaContextSlot), R(context), U8(217), U8(0), + /* 2903 E> */ B(StaCurrentContextSlot), U8(217), /* 2917 S> */ B(LdaZero), - /* 2917 E> */ B(StaContextSlot), R(context), U8(218), U8(0), + /* 2917 E> */ B(StaCurrentContextSlot), U8(218), /* 2931 S> */ B(LdaZero), - /* 2931 E> */ B(StaContextSlot), R(context), U8(219), U8(0), + /* 2931 E> */ B(StaCurrentContextSlot), U8(219), /* 2945 S> */ B(LdaZero), - /* 2945 E> */ B(StaContextSlot), R(context), U8(220), U8(0), + /* 2945 E> */ B(StaCurrentContextSlot), U8(220), /* 2959 S> */ B(LdaZero), - /* 2959 E> */ B(StaContextSlot), R(context), U8(221), U8(0), + /* 2959 E> */ B(StaCurrentContextSlot), U8(221), /* 2973 S> */ B(LdaZero), - /* 2973 E> */ B(StaContextSlot), R(context), U8(222), U8(0), + /* 2973 E> */ B(StaCurrentContextSlot), U8(222), /* 2987 S> */ B(LdaZero), - /* 2987 E> */ B(StaContextSlot), R(context), U8(223), U8(0), + /* 2987 E> */ B(StaCurrentContextSlot), U8(223), /* 3001 S> */ B(LdaZero), - /* 3001 E> */ B(StaContextSlot), R(context), U8(224), U8(0), + /* 3001 E> */ B(StaCurrentContextSlot), U8(224), /* 3015 S> */ B(LdaZero), - /* 3015 E> */ B(StaContextSlot), R(context), U8(225), U8(0), + /* 3015 E> */ B(StaCurrentContextSlot), U8(225), /* 3029 S> */ B(LdaZero), - /* 3029 E> */ B(StaContextSlot), R(context), U8(226), U8(0), + /* 3029 E> */ B(StaCurrentContextSlot), U8(226), /* 3043 S> */ B(LdaZero), - /* 3043 E> */ B(StaContextSlot), R(context), U8(227), U8(0), + /* 3043 E> */ B(StaCurrentContextSlot), U8(227), /* 3057 S> */ B(LdaZero), - /* 3057 E> */ B(StaContextSlot), R(context), U8(228), U8(0), + /* 3057 E> */ B(StaCurrentContextSlot), U8(228), /* 3071 S> */ B(LdaZero), - /* 3071 E> */ B(StaContextSlot), R(context), U8(229), U8(0), + /* 3071 E> */ B(StaCurrentContextSlot), U8(229), /* 3085 S> */ B(LdaZero), - /* 3085 E> */ B(StaContextSlot), R(context), U8(230), U8(0), + /* 3085 E> */ B(StaCurrentContextSlot), U8(230), /* 3099 S> */ B(LdaZero), - /* 3099 E> */ B(StaContextSlot), R(context), U8(231), U8(0), + /* 3099 E> */ B(StaCurrentContextSlot), U8(231), /* 3113 S> */ B(LdaZero), - /* 3113 E> */ B(StaContextSlot), R(context), U8(232), U8(0), + /* 3113 E> */ B(StaCurrentContextSlot), U8(232), /* 3127 S> */ B(LdaZero), - /* 3127 E> */ B(StaContextSlot), R(context), U8(233), U8(0), + /* 3127 E> */ B(StaCurrentContextSlot), U8(233), /* 3141 S> */ B(LdaZero), - /* 3141 E> */ B(StaContextSlot), R(context), U8(234), U8(0), + /* 3141 E> */ B(StaCurrentContextSlot), U8(234), /* 3155 S> */ B(LdaZero), - /* 3155 E> */ B(StaContextSlot), R(context), U8(235), U8(0), + /* 3155 E> */ B(StaCurrentContextSlot), U8(235), /* 3169 S> */ B(LdaZero), - /* 3169 E> */ B(StaContextSlot), R(context), U8(236), U8(0), + /* 3169 E> */ B(StaCurrentContextSlot), U8(236), /* 3183 S> */ B(LdaZero), - /* 3183 E> */ B(StaContextSlot), R(context), U8(237), U8(0), + /* 3183 E> */ B(StaCurrentContextSlot), U8(237), /* 3197 S> */ B(LdaZero), - /* 3197 E> */ B(StaContextSlot), R(context), U8(238), U8(0), + /* 3197 E> */ B(StaCurrentContextSlot), U8(238), /* 3211 S> */ B(LdaZero), - /* 3211 E> */ B(StaContextSlot), R(context), U8(239), U8(0), + /* 3211 E> */ B(StaCurrentContextSlot), U8(239), /* 3225 S> */ B(LdaZero), - /* 3225 E> */ B(StaContextSlot), R(context), U8(240), U8(0), + /* 3225 E> */ B(StaCurrentContextSlot), U8(240), /* 3239 S> */ B(LdaZero), - /* 3239 E> */ B(StaContextSlot), R(context), U8(241), U8(0), + /* 3239 E> */ B(StaCurrentContextSlot), U8(241), /* 3253 S> */ B(LdaZero), - /* 3253 E> */ B(StaContextSlot), R(context), U8(242), U8(0), + /* 3253 E> */ B(StaCurrentContextSlot), U8(242), /* 3267 S> */ B(LdaZero), - /* 3267 E> */ B(StaContextSlot), R(context), U8(243), U8(0), + /* 3267 E> */ B(StaCurrentContextSlot), U8(243), /* 3281 S> */ B(LdaZero), - /* 3281 E> */ B(StaContextSlot), R(context), U8(244), U8(0), + /* 3281 E> */ B(StaCurrentContextSlot), U8(244), /* 3295 S> */ B(LdaZero), - /* 3295 E> */ B(StaContextSlot), R(context), U8(245), U8(0), + /* 3295 E> */ B(StaCurrentContextSlot), U8(245), /* 3309 S> */ B(LdaZero), - /* 3309 E> */ B(StaContextSlot), R(context), U8(246), U8(0), + /* 3309 E> */ B(StaCurrentContextSlot), U8(246), /* 3323 S> */ B(LdaZero), - /* 3323 E> */ B(StaContextSlot), R(context), U8(247), U8(0), + /* 3323 E> */ B(StaCurrentContextSlot), U8(247), /* 3337 S> */ B(LdaZero), - /* 3337 E> */ B(StaContextSlot), R(context), U8(248), U8(0), + /* 3337 E> */ B(StaCurrentContextSlot), U8(248), /* 3351 S> */ B(LdaZero), - /* 3351 E> */ B(StaContextSlot), R(context), U8(249), U8(0), + /* 3351 E> */ B(StaCurrentContextSlot), U8(249), /* 3365 S> */ B(LdaZero), - /* 3365 E> */ B(StaContextSlot), R(context), U8(250), U8(0), + /* 3365 E> */ B(StaCurrentContextSlot), U8(250), /* 3379 S> */ B(LdaZero), - /* 3379 E> */ B(StaContextSlot), R(context), U8(251), U8(0), + /* 3379 E> */ B(StaCurrentContextSlot), U8(251), /* 3393 S> */ B(LdaZero), - /* 3393 E> */ B(StaContextSlot), R(context), U8(252), U8(0), + /* 3393 E> */ B(StaCurrentContextSlot), U8(252), /* 3407 S> */ B(LdaZero), - /* 3407 E> */ B(StaContextSlot), R(context), U8(253), U8(0), + /* 3407 E> */ B(StaCurrentContextSlot), U8(253), /* 3421 S> */ B(LdaZero), - /* 3421 E> */ B(StaContextSlot), R(context), U8(254), U8(0), + /* 3421 E> */ B(StaCurrentContextSlot), U8(254), /* 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), + /* 3435 E> */ B(StaCurrentContextSlot), U8(255), + /* 3438 S> */ B(LdaUndefined), + B(Star), R(2), + B(LdaGlobal), U8(4), + B(Star), R(1), + /* 3438 E> */ B(Call), R(1), R(2), U8(1), U8(2), /* 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), + /* 3454 E> */ B(Wide), B(StaCurrentContextSlot), U16(256), + /* 3459 S> */ B(Wide), B(LdaCurrentContextSlot), U16(256), /* 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 29e0ec3582..b17f3ecf20 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CountOperators.golden @@ -31,12 +31,13 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 14 +bytecode array length: 16 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 45 S> */ B(ToNumber), R(1), + B(Ldar), R(1), B(Inc), U8(2), B(Star), R(0), B(Ldar), R(1), @@ -73,12 +74,13 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 14 +bytecode array length: 16 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(1), B(Star), R(0), /* 45 S> */ B(ToNumber), R(1), + B(Ldar), R(1), B(Dec), U8(2), B(Star), R(0), B(Ldar), R(1), @@ -95,13 +97,14 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 24 +bytecode array length: 26 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(2), B(ToNumber), R(2), + B(Ldar), R(2), B(Inc), U8(6), /* 66 E> */ B(StaNamedPropertySloppy), R(0), U8(1), U8(4), B(Ldar), R(2), @@ -143,7 +146,7 @@ snippet: " " frame size: 5 parameter count: 1 -bytecode array length: 29 +bytecode array length: 31 bytecodes: [ /* 30 E> */ B(StackCheck), /* 45 S> */ B(LdaConstant), U8(0), @@ -153,6 +156,7 @@ bytecodes: [ /* 72 S> */ B(Ldar), R(0), /* 81 E> */ B(LdaKeyedProperty), R(1), U8(2), B(ToNumber), R(4), + B(Ldar), R(4), B(Dec), U8(6), /* 86 E> */ B(StaKeyedPropertySloppy), R(1), R(0), U8(4), B(Ldar), R(4), @@ -197,18 +201,18 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 27 +bytecode array length: 21 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), U8(0), + /* 42 E> */ B(StaCurrentContextSlot), U8(4), /* 53 S> */ B(CreateClosure), U8(0), U8(2), B(Star), R(0), - /* 78 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), + /* 78 S> */ B(LdaCurrentContextSlot), U8(4), B(Inc), U8(2), - /* 87 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 87 E> */ B(StaCurrentContextSlot), U8(4), /* 90 S> */ B(Return), ] constant pool: [ @@ -223,19 +227,20 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 31 +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), U8(0), + /* 42 E> */ B(StaCurrentContextSlot), U8(4), /* 53 S> */ B(CreateClosure), U8(0), U8(2), B(Star), R(0), - /* 78 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), + /* 78 S> */ B(LdaCurrentContextSlot), U8(4), B(ToNumber), R(2), + B(Ldar), R(2), B(Dec), U8(2), - /* 86 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + /* 86 E> */ B(StaCurrentContextSlot), U8(4), B(Ldar), R(2), /* 90 S> */ B(Return), ] @@ -251,7 +256,7 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 26 +bytecode array length: 28 bytecodes: [ /* 30 E> */ B(StackCheck), /* 44 S> */ B(LdaSmi), U8(1), @@ -260,6 +265,7 @@ bytecodes: [ B(Star), R(1), /* 63 S> */ B(Ldar), R(0), B(ToNumber), R(3), + B(Ldar), R(3), B(Inc), U8(2), B(Star), R(0), B(LdaSmi), U8(2), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden index 1c12767e09..cc073cfd66 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateArguments.golden @@ -74,12 +74,12 @@ snippet: " " frame size: 2 parameter count: 2 -bytecode array length: 19 +bytecode array length: 17 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateMappedArguments), B(Star), R(0), /* 10 E> */ B(StackCheck), @@ -99,16 +99,16 @@ snippet: " " frame size: 2 parameter count: 4 -bytecode array length: 28 +bytecode array length: 22 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(1), B(Ldar), R(arg0), - B(StaContextSlot), R(context), U8(6), U8(0), + B(StaCurrentContextSlot), U8(6), B(Ldar), R(arg1), - B(StaContextSlot), R(context), U8(5), U8(0), + B(StaCurrentContextSlot), U8(5), B(Ldar), R(arg2), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), 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 c960237f09..851b953309 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/CreateRestParameter.golden @@ -80,7 +80,7 @@ snippet: " " frame size: 4 parameter count: 2 -bytecode array length: 26 +bytecode array length: 27 bytecodes: [ B(CreateUnmappedArguments), B(Star), R(2), @@ -91,7 +91,8 @@ bytecodes: [ /* 10 E> */ B(StackCheck), B(Mov), R(arg0), R(1), /* 29 S> */ B(LdaZero), - /* 44 E> */ B(LdrKeyedProperty), R(0), U8(2), R(3), + /* 44 E> */ B(LdaKeyedProperty), R(0), U8(2), + B(Star), R(3), B(LdaZero), /* 59 E> */ B(LdaKeyedProperty), R(2), U8(4), B(Add), R(3), U8(6), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden index a61e993e52..00fa0180e6 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden @@ -104,7 +104,7 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 29 +bytecode array length: 31 bytecodes: [ B(LdaConstant), U8(0), B(Star), R(1), @@ -113,8 +113,10 @@ bytecodes: [ B(Mov), R(closure), R(3), B(CallRuntime), U16(Runtime::kDeclareGlobalsForInterpreter), R(1), U8(3), /* 0 E> */ B(StackCheck), - /* 16 S> */ B(LdrUndefined), R(2), - B(LdrGlobal), U8(2), R(1), + /* 16 S> */ B(LdaUndefined), + B(Star), R(2), + B(LdaGlobal), U8(2), + B(Star), R(1), /* 16 E> */ B(Call), R(1), R(2), U8(1), U8(4), B(Star), R(0), /* 20 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden index d7d60aa26f..12e421e883 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Delete.golden @@ -98,16 +98,17 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 29 +bytecode array length: 26 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), U8(0), + /* 56 E> */ B(StaCurrentContextSlot), U8(4), /* 64 S> */ B(CreateClosure), U8(1), U8(2), - /* 93 S> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(1), + /* 93 S> */ B(LdaCurrentContextSlot), U8(4), + B(Star), R(1), B(LdaSmi), U8(1), B(DeletePropertyStrict), R(1), /* 113 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden index 08a5aaa871..662ecf14d9 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/DoExpression.golden @@ -30,13 +30,13 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 13 +bytecode array length: 12 bytecodes: [ /* 30 E> */ B(StackCheck), /* 55 S> */ B(LdaSmi), U8(100), B(Star), R(0), - /* 42 S> */ B(LdrUndefined), R(1), - B(Ldar), R(1), + /* 42 S> */ B(LdaUndefined), + B(Star), R(1), B(Star), R(2), /* 63 S> */ B(Nop), /* 73 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 07bd99c1f0..a311aa9101 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Eval.golden @@ -11,20 +11,21 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 69 +bytecode array length: 62 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(6), U8(0), + B(StaCurrentContextSlot), U8(6), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(5), U8(0), + B(StaCurrentContextSlot), U8(5), /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdaConstant), U8(0), - B(Star), R(4), - B(CallRuntimeForPair), U16(Runtime::kLoadLookupSlotForCall), R(4), U8(1), R(1), + /* 34 S> */ B(LdaUndefined), + B(Star), R(2), + /* 41 E> */ B(LdaLookupGlobalSlot), U8(0), U8(4), U8(1), + B(Star), R(1), B(LdaConstant), U8(1), B(Star), R(3), B(LdaZero), @@ -38,7 +39,7 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 41 E> */ B(Call), R(1), R(2), U8(2), U8(0), + /* 41 E> */ B(Call), R(1), R(2), U8(2), U8(2), /* 53 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden index a23bb90226..c8cbc7a61d 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForIn.golden @@ -147,40 +147,42 @@ snippet: " " frame size: 7 parameter count: 1 -bytecode array length: 83 +bytecode array length: 85 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(9), - B(JumpIfUndefined), U8(68), - B(JumpIfNull), U8(66), + B(JumpIfUndefined), U8(70), + B(JumpIfNull), U8(68), B(ToObject), R(1), B(ForInPrepare), R(1), R(2), B(LdaZero), B(Star), R(5), /* 68 S> */ B(ForInContinue), R(5), R(4), - B(JumpIfFalse), U8(53), + B(JumpIfFalse), U8(55), B(ForInNext), R(1), R(5), R(2), U8(12), - B(JumpIfUndefined), U8(39), + B(JumpIfUndefined), U8(41), B(Star), R(6), /* 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(4), R(6), + /* 100 E> */ B(LdaNamedProperty), R(0), U8(2), U8(4), + B(Star), R(6), B(LdaSmi), U8(10), /* 106 E> */ B(TestEqual), R(6), U8(6), B(JumpIfFalse), U8(4), - /* 113 S> */ B(Jump), U8(17), + /* 113 S> */ B(Jump), U8(18), /* 125 S> */ B(Nop), - /* 130 E> */ B(LdrNamedProperty), R(0), U8(2), U8(7), R(6), + /* 130 E> */ B(LdaNamedProperty), R(0), U8(2), U8(7), + B(Star), R(6), B(LdaSmi), U8(20), /* 136 E> */ B(TestEqual), R(6), U8(9), B(JumpIfFalse), U8(4), /* 143 S> */ B(Jump), U8(9), B(ForInStep), R(5), B(Star), R(5), - B(JumpLoop), U8(-53), U8(0), + B(JumpLoop), U8(-55), U8(0), B(LdaUndefined), /* 152 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden index 3ede3ec597..96545a94d8 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/ForOf.golden @@ -11,7 +11,7 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 279 +bytecode array length: 282 bytecodes: [ /* 30 E> */ B(StackCheck), B(LdaZero), @@ -21,19 +21,22 @@ bytecodes: [ /* 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(4), R(13), - /* 48 E> */ B(Call), R(13), R(14), U8(1), U8(2), + /* 48 E> */ B(LdaKeyedProperty), R(14), U8(4), + B(Star), R(13), + /* 48 E> */ B(CallProperty), R(13), R(14), U8(1), U8(2), B(Star), R(2), - /* 45 S> */ B(LdrNamedProperty), R(2), U8(2), U8(8), R(14), - /* 45 E> */ B(Call), R(14), R(2), U8(1), U8(6), + /* 45 S> */ B(LdaNamedProperty), R(2), U8(2), U8(8), + B(Star), R(13), + /* 45 E> */ B(CallProperty), R(13), 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(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(JumpIfToBooleanTrue), U8(25), + B(LdaNamedProperty), R(3), U8(4), U8(12), + B(Star), R(5), B(LdaSmi), U8(2), B(Star), R(4), B(Mov), R(5), R(0), @@ -41,8 +44,8 @@ bytecodes: [ B(Mov), R(0), R(1), B(LdaZero), B(Star), R(4), - B(JumpLoop), U8(-49), U8(0), - B(Jump), U8(37), + B(JumpLoop), U8(-51), U8(0), + B(Jump), U8(36), B(Star), R(13), B(Ldar), R(closure), B(CreateCatchContext), R(13), U8(5), U8(6), @@ -53,7 +56,8 @@ bytecodes: [ B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), B(Star), R(4), - B(LdrContextSlot), R(context), U8(4), U8(0), R(13), + B(LdaCurrentContextSlot), U8(4), + B(Star), R(13), B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), B(PopContext), R(8), B(LdaSmi), U8(-1), @@ -66,11 +70,12 @@ bytecodes: [ B(Star), R(11), B(LdaZero), B(TestEqualStrict), R(4), U8(15), - B(JumpIfTrue), U8(121), + B(JumpIfTrue), U8(122), B(LdaUndefined), B(TestEqualStrict), R(2), U8(16), - B(JumpIfTrue), U8(115), - B(LdrNamedProperty), R(2), U8(7), U8(17), R(6), + B(JumpIfTrue), U8(116), + B(LdaNamedProperty), R(2), U8(7), U8(17), + B(Star), R(6), B(LdaNull), B(TestEqual), R(6), U8(19), B(JumpIfFalse), U8(4), @@ -137,9 +142,9 @@ constant pool: [ FIXED_ARRAY_TYPE, ] handlers: [ - [7, 118, 124], - [10, 81, 83], - [201, 211, 213], + [7, 120, 126], + [10, 84, 86], + [204, 214, 216], ] --- @@ -149,7 +154,7 @@ snippet: " " frame size: 16 parameter count: 1 -bytecode array length: 290 +bytecode array length: 293 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), @@ -159,19 +164,22 @@ bytecodes: [ B(Mov), R(context), R(12), B(Mov), R(context), R(13), /* 68 S> */ B(LdaConstant), U8(1), - /* 68 E> */ B(LdrKeyedProperty), R(0), U8(4), R(14), - /* 68 E> */ B(Call), R(14), R(0), U8(1), U8(2), + /* 68 E> */ B(LdaKeyedProperty), R(0), U8(4), + B(Star), R(14), + /* 68 E> */ B(CallProperty), 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), + /* 65 S> */ B(LdaNamedProperty), R(3), U8(2), U8(8), + B(Star), R(14), + /* 65 E> */ B(CallProperty), R(14), 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(4), U8(1), B(LdaNamedProperty), R(4), U8(3), U8(10), - B(JumpIfToBooleanTrue), U8(26), - B(LdrNamedProperty), R(4), U8(4), U8(12), R(6), + B(JumpIfToBooleanTrue), U8(27), + B(LdaNamedProperty), R(4), U8(4), U8(12), + B(Star), R(6), B(LdaSmi), U8(2), B(Star), R(5), B(Mov), R(6), R(1), @@ -180,8 +188,8 @@ bytecodes: [ /* 73 S> */ B(LdaZero), B(Star), R(10), B(Mov), R(1), R(11), - B(Jump), U8(51), - B(Jump), U8(37), + B(Jump), U8(50), + B(Jump), U8(36), B(Star), R(14), B(Ldar), R(closure), B(CreateCatchContext), R(14), U8(5), U8(6), @@ -192,7 +200,8 @@ bytecodes: [ B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), B(Star), R(5), - B(LdrContextSlot), R(context), U8(4), U8(0), R(14), + B(LdaCurrentContextSlot), U8(4), + B(Star), R(14), B(CallRuntime), U16(Runtime::kReThrow), R(14), U8(1), B(PopContext), R(9), B(LdaSmi), U8(-1), @@ -205,11 +214,12 @@ bytecodes: [ B(Star), R(12), B(LdaZero), B(TestEqualStrict), R(5), U8(15), - B(JumpIfTrue), U8(121), + B(JumpIfTrue), U8(122), B(LdaUndefined), B(TestEqualStrict), R(3), U8(16), - B(JumpIfTrue), U8(115), - B(LdrNamedProperty), R(3), U8(7), U8(17), R(7), + B(JumpIfTrue), U8(116), + B(LdaNamedProperty), R(3), U8(7), U8(17), + B(Star), R(7), B(LdaNull), B(TestEqual), R(7), U8(19), B(JumpIfFalse), U8(4), @@ -281,9 +291,9 @@ constant pool: [ FIXED_ARRAY_TYPE, ] handlers: [ - [11, 118, 124], - [14, 81, 83], - [202, 212, 214], + [11, 120, 126], + [14, 84, 86], + [205, 215, 217], ] --- @@ -295,7 +305,7 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 297 +bytecode array length: 300 bytecodes: [ /* 30 E> */ B(StackCheck), B(LdaZero), @@ -305,19 +315,22 @@ bytecodes: [ /* 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(4), R(13), - /* 48 E> */ B(Call), R(13), R(14), U8(1), U8(2), + /* 48 E> */ B(LdaKeyedProperty), R(14), U8(4), + B(Star), R(13), + /* 48 E> */ B(CallProperty), R(13), R(14), U8(1), U8(2), B(Star), R(2), - /* 45 S> */ B(LdrNamedProperty), R(2), U8(2), U8(8), R(14), - /* 45 E> */ B(Call), R(14), R(2), U8(1), U8(6), + /* 45 S> */ B(LdaNamedProperty), R(2), U8(2), U8(8), + B(Star), R(13), + /* 45 E> */ B(CallProperty), R(13), 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(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(JumpIfToBooleanTrue), U8(43), + B(LdaNamedProperty), R(3), U8(4), U8(12), + B(Star), R(5), B(LdaSmi), U8(2), B(Star), R(4), B(Mov), R(5), R(0), @@ -333,8 +346,8 @@ bytecodes: [ /* 104 S> */ B(Jump), U8(8), B(LdaZero), B(Star), R(4), - B(JumpLoop), U8(-67), U8(0), - B(Jump), U8(37), + B(JumpLoop), U8(-69), U8(0), + B(Jump), U8(36), B(Star), R(13), B(Ldar), R(closure), B(CreateCatchContext), R(13), U8(5), U8(6), @@ -345,7 +358,8 @@ bytecodes: [ B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), B(Star), R(4), - B(LdrContextSlot), R(context), U8(4), U8(0), R(13), + B(LdaCurrentContextSlot), U8(4), + B(Star), R(13), B(CallRuntime), U16(Runtime::kReThrow), R(13), U8(1), B(PopContext), R(8), B(LdaSmi), U8(-1), @@ -358,11 +372,12 @@ bytecodes: [ B(Star), R(11), B(LdaZero), B(TestEqualStrict), R(4), U8(17), - B(JumpIfTrue), U8(121), + B(JumpIfTrue), U8(122), B(LdaUndefined), B(TestEqualStrict), R(2), U8(18), - B(JumpIfTrue), U8(115), - B(LdrNamedProperty), R(2), U8(7), U8(19), R(6), + B(JumpIfTrue), U8(116), + B(LdaNamedProperty), R(2), U8(7), U8(19), + B(Star), R(6), B(LdaNull), B(TestEqual), R(6), U8(21), B(JumpIfFalse), U8(4), @@ -429,9 +444,9 @@ constant pool: [ FIXED_ARRAY_TYPE, ] handlers: [ - [7, 136, 142], - [10, 99, 101], - [219, 229, 231], + [7, 138, 144], + [10, 102, 104], + [222, 232, 234], ] --- @@ -441,7 +456,7 @@ snippet: " " frame size: 14 parameter count: 1 -bytecode array length: 303 +bytecode array length: 307 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(0), U8(1), R(8), @@ -453,30 +468,34 @@ bytecodes: [ /* 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(4), R(12), - /* 77 E> */ B(Call), R(12), R(13), U8(1), U8(2), + /* 77 E> */ B(LdaKeyedProperty), R(13), U8(4), + B(Star), R(12), + /* 77 E> */ B(CallProperty), R(12), R(13), U8(1), U8(2), B(Star), R(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), + /* 74 S> */ B(LdaNamedProperty), R(1), U8(3), U8(8), + B(Star), R(12), + /* 74 E> */ B(CallProperty), R(12), 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(2), U8(1), B(LdaNamedProperty), R(2), U8(4), U8(10), - B(JumpIfToBooleanTrue), U8(29), - /* 67 E> */ B(LdrNamedProperty), R(2), U8(5), U8(12), R(4), + B(JumpIfToBooleanTrue), U8(31), + /* 67 E> */ B(LdaNamedProperty), R(2), U8(5), U8(12), + B(Star), R(4), B(LdaSmi), U8(2), 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(0), U8(6), U8(16), R(9), + /* 96 E> */ B(LdaNamedProperty), R(0), U8(6), U8(16), + B(Star), R(9), B(LdaZero), B(Star), R(8), - B(Jump), U8(51), - B(Jump), U8(37), + B(Jump), U8(50), + B(Jump), U8(36), B(Star), R(12), B(Ldar), R(closure), B(CreateCatchContext), R(12), U8(7), U8(8), @@ -487,7 +506,8 @@ bytecodes: [ B(JumpIfFalse), U8(6), B(LdaSmi), U8(1), B(Star), R(3), - B(LdrContextSlot), R(context), U8(4), U8(0), R(12), + B(LdaCurrentContextSlot), U8(4), + B(Star), R(12), B(CallRuntime), U16(Runtime::kReThrow), R(12), U8(1), B(PopContext), R(7), B(LdaSmi), U8(-1), @@ -500,11 +520,12 @@ bytecodes: [ B(Star), R(10), B(LdaZero), B(TestEqualStrict), R(3), U8(19), - B(JumpIfTrue), U8(121), + B(JumpIfTrue), U8(122), B(LdaUndefined), B(TestEqualStrict), R(1), U8(20), - B(JumpIfTrue), U8(115), - B(LdrNamedProperty), R(1), U8(9), U8(21), R(5), + B(JumpIfTrue), U8(116), + B(LdaNamedProperty), R(1), U8(9), U8(21), + B(Star), R(5), B(LdaNull), B(TestEqual), R(5), U8(23), B(JumpIfFalse), U8(4), @@ -578,8 +599,8 @@ constant pool: [ FIXED_ARRAY_TYPE, ] handlers: [ - [15, 131, 137], - [18, 94, 96], - [215, 225, 227], + [15, 134, 140], + [18, 98, 100], + [219, 229, 231], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden index 9a81b88a03..19aa219ac1 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden @@ -29,10 +29,11 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 14 +bytecode array length: 15 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdrUndefined), R(1), + /* 34 S> */ B(LdaUndefined), + B(Star), R(1), B(CreateClosure), U8(0), U8(2), B(Star), R(0), /* 56 E> */ B(Call), R(0), R(1), U8(1), U8(2), @@ -50,10 +51,11 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 18 +bytecode array length: 19 bytecodes: [ /* 30 E> */ B(StackCheck), - /* 34 S> */ B(LdrUndefined), R(1), + /* 34 S> */ B(LdaUndefined), + B(Star), R(1), B(CreateClosure), U8(0), U8(2), B(Star), R(0), B(LdaSmi), U8(1), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden index 840aa9ae42..7ca3be2345 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Generators.golden @@ -13,7 +13,7 @@ snippet: " " frame size: 11 parameter count: 1 -bytecode array length: 212 +bytecode array length: 204 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(21), @@ -21,8 +21,8 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(TestEqualStrict), R(1), U8(0), - B(JumpIfTrue), U8(61), - B(LdaSmi), U8(76), + B(JumpIfTrue), U8(53), + B(LdaSmi), U8(77), B(Star), R(2), B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), B(LdaSmi), U8(-2), @@ -30,16 +30,17 @@ bytecodes: [ B(CreateFunctionContext), U8(2), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 11 E> */ B(StackCheck), B(Mov), R(context), R(4), - /* 11 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(6), - B(Ldar), R(6), + B(LdaCurrentContextSlot), U8(4), + B(Star), R(6), B(Mov), R(closure), R(5), - B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(5), U8(2), - B(StaContextSlot), R(context), U8(5), U8(0), + /* 11 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(5), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(5), - B(LdrContextSlot), R(context), U8(5), U8(0), R(6), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(6), B(LdaZero), B(SuspendGenerator), R(6), B(Ldar), R(5), @@ -64,10 +65,11 @@ bytecodes: [ B(Star), R(3), B(LdaZero), B(Star), R(2), - B(Jump), U8(35), + B(Jump), U8(36), B(Ldar), R(7), /* 11 E> */ B(Throw), - B(LdrUndefined), R(5), + B(LdaUndefined), + B(Star), R(5), B(LdaTrue), B(Star), R(6), B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(5), U8(2), @@ -83,7 +85,8 @@ bytecodes: [ B(Star), R(2), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(4), - B(LdrContextSlot), R(context), U8(5), U8(0), R(5), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(5), B(CallRuntime), U16(Runtime::k_GeneratorClose), R(5), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), B(LdaZero), @@ -108,7 +111,7 @@ bytecodes: [ constant pool: [ ] handlers: [ - [41, 145, 151], + [39, 138, 144], ] --- @@ -118,7 +121,7 @@ snippet: " " frame size: 11 parameter count: 1 -bytecode array length: 310 +bytecode array length: 301 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(28), @@ -126,11 +129,11 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(TestEqualStrict), R(1), U8(0), - B(JumpIfTrue), U8(68), + B(JumpIfTrue), U8(60), B(LdaSmi), U8(1), B(TestEqualStrict), R(1), U8(0), B(JumpIfTrueConstant), U8(0), - B(LdaSmi), U8(76), + B(LdaSmi), U8(77), B(Star), R(2), B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), B(LdaSmi), U8(-2), @@ -138,16 +141,17 @@ bytecodes: [ B(CreateFunctionContext), U8(2), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 11 E> */ B(StackCheck), B(Mov), R(context), R(4), - /* 11 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(6), - B(Ldar), R(6), + B(LdaCurrentContextSlot), U8(4), + B(Star), R(6), B(Mov), R(closure), R(5), - B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(5), U8(2), - B(StaContextSlot), R(context), U8(5), U8(0), + /* 11 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(5), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(5), - B(LdrContextSlot), R(context), U8(5), U8(0), R(6), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(6), B(LdaZero), B(SuspendGenerator), R(6), B(Ldar), R(5), @@ -181,7 +185,8 @@ bytecodes: [ B(Star), R(6), B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(5), U8(2), B(Star), R(5), - B(LdrContextSlot), R(context), U8(5), U8(0), R(6), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(6), B(LdaSmi), U8(1), B(SuspendGenerator), R(6), B(Ldar), R(5), @@ -206,10 +211,11 @@ bytecodes: [ B(Star), R(3), B(LdaSmi), U8(1), B(Star), R(2), - B(Jump), U8(35), + B(Jump), U8(36), B(Ldar), R(7), /* 16 E> */ B(Throw), - B(LdrUndefined), R(5), + B(LdaUndefined), + B(Star), R(5), B(LdaTrue), B(Star), R(6), B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(5), U8(2), @@ -225,7 +231,8 @@ bytecodes: [ B(Star), R(2), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(4), - B(LdrContextSlot), R(context), U8(5), U8(0), R(5), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(5), B(CallRuntime), U16(Runtime::k_GeneratorClose), R(5), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(4), U8(1), B(LdaZero), @@ -253,10 +260,10 @@ bytecodes: [ /* 25 S> */ B(Return), ] constant pool: [ - Smi [141], + Smi [132], ] handlers: [ - [48, 233, 239], + [46, 225, 231], ] --- @@ -266,7 +273,7 @@ snippet: " " frame size: 17 parameter count: 1 -bytecode array length: 805 +bytecode array length: 796 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(28), @@ -274,11 +281,11 @@ bytecodes: [ B(Star), R(3), B(LdaZero), B(TestEqualStrict), R(3), U8(0), - B(JumpIfTrue), U8(68), + B(JumpIfTrue), U8(60), B(LdaSmi), U8(1), B(TestEqualStrict), R(3), U8(0), B(JumpIfTrueConstant), U8(3), - B(LdaSmi), U8(76), + B(LdaSmi), U8(77), B(Star), R(4), B(CallRuntime), U16(Runtime::kAbort), R(4), U8(1), B(LdaSmi), U8(-2), @@ -286,16 +293,17 @@ bytecodes: [ B(CreateFunctionContext), U8(9), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 11 E> */ B(StackCheck), B(Mov), R(context), R(6), - /* 11 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(8), - B(Ldar), R(8), + B(LdaCurrentContextSlot), U8(4), + B(Star), 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), + /* 11 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(7), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(7), - B(LdrContextSlot), R(context), U8(5), U8(0), R(8), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(8), B(LdaZero), B(SuspendGenerator), R(8), B(Ldar), R(7), @@ -320,14 +328,14 @@ bytecodes: [ B(Star), R(5), B(LdaZero), B(Star), R(4), - B(JumpConstant), U8(20), + B(JumpConstant), U8(19), 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), U8(0), + B(StaCurrentContextSlot), U8(4), B(LdaZero), B(StaContextSlot), R(1), U8(9), U8(0), B(Mov), R(context), R(9), @@ -335,32 +343,38 @@ bytecodes: [ /* 30 S> */ B(CreateArrayLiteral), U8(1), U8(0), U8(9), B(Star), R(12), B(LdaConstant), U8(2), - /* 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(LdaKeyedProperty), R(12), U8(4), + B(Star), R(11), + /* 30 E> */ B(CallProperty), 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(3), U8(0), B(JumpIfTrue), U8(18), B(LdaSmi), U8(1), B(TestEqualStrict), R(3), U8(0), - B(JumpIfTrueConstant), U8(9), - B(LdaSmi), U8(76), + B(JumpIfTrueConstant), U8(8), + B(LdaSmi), U8(77), 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 S> */ B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(12), + B(LdaNamedProperty), R(12), U8(4), U8(8), + B(Star), R(11), + /* 27 E> */ B(CallProperty), R(11), R(12), 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(12), - B(LdrContextSlot), R(1), U8(8), U8(0), R(11), + B(JumpIfFalse), U8(13), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(11), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(11), U8(1), - B(LdrContextSlot), R(1), U8(8), U8(0), R(11), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(11), B(LdaNamedProperty), R(11), U8(5), U8(10), - B(JumpIfToBooleanTrueConstant), U8(10), - B(LdrContextSlot), R(1), U8(8), U8(0), R(11), + B(JumpIfToBooleanTrueConstant), U8(9), + B(LdaContextSlot), R(1), U8(8), U8(0), + B(Star), R(11), B(LdaNamedProperty), R(11), U8(6), U8(12), B(StaContextSlot), R(1), U8(10), U8(0), B(LdaSmi), U8(2), @@ -372,20 +386,17 @@ bytecodes: [ B(CreateBlockContext), U8(7), B(PushContext), R(2), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), 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(StaCurrentContextSlot), U8(4), + /* 36 S> */ B(LdaCurrentContextSlot), U8(4), B(Star), R(11), B(LdaFalse), 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(LdaContextSlot), R(1), U8(5), U8(0), + B(Star), R(12), B(LdaSmi), U8(1), B(SuspendGenerator), R(12), B(Ldar), R(11), @@ -422,20 +433,22 @@ bytecodes: [ B(PopContext), R(2), B(LdaZero), B(StaContextSlot), R(1), U8(9), U8(0), - B(Wide), B(JumpLoop), U16(-232), U16(0), + B(Wide), B(JumpLoop), U16(-221), U16(0), B(Jump), U8(44), B(Star), R(11), B(Ldar), R(closure), - B(CreateCatchContext), R(11), U8(11), U8(12), + B(CreateCatchContext), R(11), U8(10), U8(11), B(Star), R(10), B(PushContext), R(2), - B(LdrContextSlot), R(1), U8(9), U8(0), R(11), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(11), B(LdaSmi), U8(2), B(TestEqualStrict), R(11), U8(14), B(JumpIfFalse), U8(8), B(LdaSmi), U8(1), B(StaContextSlot), R(1), U8(9), U8(0), - B(LdrContextSlot), R(context), U8(4), U8(0), R(11), + B(LdaCurrentContextSlot), U8(4), + B(Star), R(11), B(CallRuntime), U16(Runtime::kReThrow), R(11), U8(1), B(PopContext), R(2), B(LdaSmi), U8(-1), @@ -446,62 +459,73 @@ bytecodes: [ B(Star), R(7), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(9), - B(LdrContextSlot), R(1), U8(9), U8(0), R(10), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(10), B(LdaZero), B(TestEqualStrict), R(10), U8(15), - B(JumpIfTrueConstant), U8(18), - B(LdrContextSlot), R(1), U8(7), U8(0), R(10), + B(JumpIfTrueConstant), U8(17), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(10), B(LdaUndefined), 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(JumpIfTrueConstant), U8(18), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), R(10), + B(LdaNamedProperty), R(10), U8(12), U8(17), B(StaContextSlot), R(1), U8(11), U8(0), - B(LdrContextSlot), R(1), U8(11), U8(0), R(10), + B(LdaContextSlot), R(1), U8(11), U8(0), + B(Star), R(10), B(LdaNull), B(TestEqual), R(10), U8(19), B(JumpIfFalse), U8(4), - B(JumpConstant), U8(17), - B(LdrContextSlot), R(1), U8(9), U8(0), R(10), + B(JumpConstant), U8(16), + B(LdaContextSlot), R(1), U8(9), U8(0), + B(Star), R(10), B(LdaSmi), U8(1), B(TestEqualStrict), R(10), U8(20), - B(JumpIfFalse), U8(76), + B(JumpIfFalse), U8(78), B(LdaContextSlot), R(1), U8(11), U8(0), B(TypeOf), B(Star), R(10), - B(LdaConstant), U8(14), + B(LdaConstant), U8(13), B(TestEqualStrict), R(10), U8(21), B(JumpIfFalse), U8(4), B(Jump), U8(18), B(Wide), B(LdaSmi), U16(130), B(Star), R(10), - B(LdaConstant), U8(15), + B(LdaConstant), U8(14), B(Star), R(11), B(CallRuntime), U16(Runtime::kNewTypeError), R(10), U8(2), B(Throw), 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(LdaContextSlot), R(1), U8(11), U8(0), + B(Star), R(11), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), 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(CreateCatchContext), R(11), U8(10), U8(15), B(Star), R(10), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Ldar), R(10), B(PushContext), R(2), B(PopContext), R(2), - 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(Jump), U8(47), + B(LdaContextSlot), R(1), U8(11), U8(0), + B(Star), R(10), + B(LdaContextSlot), R(1), U8(7), U8(0), + B(Star), 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(LdaContextSlot), R(1), U8(12), U8(0), + B(Star), R(10), B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(10), U8(1), B(JumpIfToBooleanFalse), U8(4), - B(Jump), U8(12), - B(LdrContextSlot), R(1), U8(12), U8(0), R(10), + B(Jump), U8(13), + B(LdaContextSlot), R(1), U8(12), U8(0), + B(Star), R(10), B(CallRuntime), U16(Runtime::kThrowIteratorResultNotAnObject), R(10), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(9), U8(1), B(LdaZero), @@ -516,15 +540,16 @@ bytecodes: [ B(LdaSmi), U8(1), B(Star), R(4), B(Mov), R(8), R(5), - B(Jump), U8(47), + B(Jump), U8(48), B(PopContext), R(1), B(PopContext), R(1), B(LdaSmi), U8(2), B(Star), R(4), B(Mov), R(8), R(5), - B(Jump), U8(34), + B(Jump), U8(35), B(PopContext), R(1), - B(LdrUndefined), R(7), + B(LdaUndefined), + B(Star), R(7), B(LdaTrue), B(Star), R(8), B(CallRuntime), U16(Runtime::k_CreateIterResultObject), R(7), U8(2), @@ -540,7 +565,8 @@ bytecodes: [ B(Star), R(4), B(CallRuntime), U16(Runtime::kInterpreterClearPendingMessage), R(0), U8(0), B(Star), R(6), - B(LdrContextSlot), R(context), U8(5), U8(0), R(7), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(7), B(CallRuntime), U16(Runtime::k_GeneratorClose), R(7), U8(1), B(CallRuntime), U16(Runtime::kInterpreterSetPendingMessage), R(6), U8(1), B(LdaZero), @@ -576,29 +602,28 @@ constant pool: [ FIXED_ARRAY_TYPE, FIXED_ARRAY_TYPE, SYMBOL_TYPE, - Smi [158], + Smi [149], 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], + Smi [135], + Smi [152], 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 [136], + Smi [176], + Smi [164], Smi [601], ] handlers: [ - [48, 718, 724], - [153, 458, 464], - [156, 414, 416], - [572, 586, 588], + [46, 710, 716], + [143, 438, 444], + [146, 394, 396], + [557, 573, 575], ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden index f222e9034b..f8bece5c39 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCompoundExpressions.golden @@ -14,10 +14,11 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 13 bytecodes: [ /* 26 E> */ B(StackCheck), - /* 31 S> */ B(LdrGlobal), U8(2), R(0), + /* 31 S> */ B(LdaGlobal), U8(2), + B(Star), R(0), B(BitwiseAndSmi), U8(1), R(0), U8(4), /* 45 E> */ B(StaGlobalSloppy), U8(0), U8(5), /* 51 S> */ B(Return), @@ -36,10 +37,11 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 12 +bytecode array length: 13 bytecodes: [ /* 27 E> */ B(StackCheck), - /* 32 S> */ B(LdrGlobal), U8(2), R(0), + /* 32 S> */ B(LdaGlobal), U8(2), + B(Star), R(0), B(AddSmi), U8(1), R(0), U8(4), /* 51 E> */ B(StaGlobalSloppy), U8(0), U8(5), /* 57 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden index 2c6616bb58..1e0d530af5 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalCountOperators.golden @@ -36,11 +36,12 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 15 bytecodes: [ /* 26 E> */ B(StackCheck), /* 31 S> */ B(LdaGlobal), U8(2), B(ToNumber), R(0), + B(Ldar), R(0), B(Dec), U8(6), /* 44 E> */ B(StaGlobalSloppy), U8(0), U8(4), B(Ldar), R(0), @@ -82,11 +83,12 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 13 +bytecode array length: 15 bytecodes: [ /* 27 E> */ B(StackCheck), /* 32 S> */ B(LdaGlobal), U8(2), B(ToNumber), R(0), + B(Ldar), R(0), B(Inc), U8(6), /* 50 E> */ B(StaGlobalSloppy), U8(0), U8(4), B(Ldar), R(0), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden index 66583f3389..e9540bb446 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/GlobalDelete.golden @@ -16,10 +16,11 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 10 bytecodes: [ /* 32 E> */ B(StackCheck), - /* 39 S> */ B(LdrGlobal), U8(2), R(0), + /* 39 S> */ B(LdaGlobal), U8(2), + B(Star), R(0), B(LdaConstant), U8(0), B(DeletePropertySloppy), R(0), /* 58 S> */ B(Return), @@ -41,10 +42,11 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 9 +bytecode array length: 10 bytecodes: [ /* 28 E> */ B(StackCheck), - /* 51 S> */ B(LdrGlobal), U8(2), R(0), + /* 51 S> */ B(LdaGlobal), U8(2), + B(Star), R(0), B(LdaSmi), U8(1), B(DeletePropertyStrict), R(0), /* 71 S> */ B(Return), @@ -67,8 +69,10 @@ parameter count: 1 bytecode array length: 16 bytecodes: [ /* 32 E> */ B(StackCheck), - /* 39 S> */ B(LdrContextSlot), R(context), U8(3), U8(0), R(0), - B(LdrContextSlot), R(0), U8(2), U8(0), R(1), + /* 39 S> */ B(LdaCurrentContextSlot), U8(3), + B(Star), R(0), + B(LdaContextSlot), R(0), U8(2), U8(0), + B(Star), R(1), B(LdaConstant), U8(0), B(DeletePropertySloppy), R(1), /* 56 S> */ B(Return), @@ -92,8 +96,10 @@ parameter count: 1 bytecode array length: 16 bytecodes: [ /* 18 E> */ B(StackCheck), - /* 25 S> */ B(LdrContextSlot), R(context), U8(3), U8(0), R(0), - B(LdrContextSlot), R(0), U8(2), U8(0), R(1), + /* 25 S> */ B(LdaCurrentContextSlot), U8(3), + B(Star), R(0), + B(LdaContextSlot), R(0), U8(2), U8(0), + B(Star), R(1), B(LdaConstant), U8(0), B(DeletePropertySloppy), R(1), /* 42 S> */ B(Return), diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden index d9d8f79e0a..74709fdab9 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariable.golden @@ -30,23 +30,19 @@ handlers: [ snippet: " let x = 10; return x; " -frame size: 2 +frame size: 1 parameter count: 1 -bytecode array length: 20 +bytecode array length: 10 bytecodes: [ B(LdaTheHole), B(Star), R(0), /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaSmi), U8(10), B(Star), R(0), - /* 46 S> */ B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(1), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(1), U8(1), + /* 46 S> */ B(Nop), /* 56 S> */ B(Return), ] constant pool: [ - ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -84,9 +80,9 @@ handlers: [ snippet: " let x = 10; x = 20; " -frame size: 3 +frame size: 1 parameter count: 1 -bytecode array length: 30 +bytecode array length: 14 bytecodes: [ B(LdaTheHole), B(Star), R(0), @@ -94,18 +90,11 @@ bytecodes: [ /* 42 S> */ B(LdaSmi), U8(10), B(Star), R(0), /* 46 S> */ B(LdaSmi), U8(20), - B(Star), R(1), - B(Ldar), R(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(0), - B(Star), R(2), - /* 48 E> */ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), - B(Mov), R(1), R(0), + B(Star), R(0), B(LdaUndefined), /* 54 S> */ B(Return), ] constant pool: [ - 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 eb2a5c6b47..d45386e58b 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LetVariableContextSlot.golden @@ -11,17 +11,17 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 23 +bytecode array length: 19 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), 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), U8(0), + /* 42 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 72 S> */ B(Return), ] @@ -35,29 +35,24 @@ handlers: [ snippet: " let x = 10; function f1() {return x;} return x; " -frame size: 3 +frame size: 2 parameter count: 1 -bytecode array length: 37 +bytecode array length: 20 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), 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), U8(0), - /* 72 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), - B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(1), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(2), U8(1), + /* 42 E> */ B(StaCurrentContextSlot), U8(4), + /* 72 S> */ B(LdaCurrentContextSlot), U8(4), /* 82 S> */ B(Return), ] constant pool: [ SHARED_FUNCTION_INFO_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] @@ -68,25 +63,25 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 46 +bytecode array length: 38 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), 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), U8(0), + B(LdaCurrentContextSlot), U8(4), B(JumpIfNotHole), U8(11), B(LdaConstant), U8(1), B(Star), R(3), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), + /* 45 E> */ B(CallRuntime), U16(Runtime::kThrowReferenceError), R(3), U8(1), B(Ldar), R(2), - B(StaContextSlot), R(context), U8(4), U8(0), - /* 45 E> */ B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), + /* 45 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 78 S> */ B(Return), ] @@ -101,34 +96,26 @@ handlers: [ snippet: " let x = 10; x = 20; function f1() {return x;} " -frame size: 4 +frame size: 2 parameter count: 1 -bytecode array length: 48 +bytecode array length: 23 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), 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), U8(0), + /* 42 E> */ B(StaCurrentContextSlot), U8(4), /* 46 S> */ B(LdaSmi), U8(20), - B(Star), R(2), - /* 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), U8(0), + /* 48 E> */ B(StaCurrentContextSlot), U8(4), B(LdaUndefined), /* 80 S> */ B(Return), ] constant pool: [ SHARED_FUNCTION_INFO_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], ] handlers: [ ] diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden index acef8f74ad..07dbbdfe19 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden @@ -12,20 +12,21 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 73 +bytecode array length: 66 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(6), U8(0), + B(StaCurrentContextSlot), U8(6), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(5), U8(0), + B(StaCurrentContextSlot), U8(5), /* 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), + /* 14 S> */ B(LdaUndefined), + B(Star), R(2), + /* 14 E> */ B(LdaLookupGlobalSlot), U8(0), U8(4), U8(1), + B(Star), R(1), B(LdaConstant), U8(1), B(Star), R(3), B(LdaZero), @@ -39,8 +40,8 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 14 E> */ B(Call), R(1), R(2), U8(2), U8(0), - /* 35 S> */ B(LdaLookupGlobalSlot), U8(2), U8(4), U8(1), + /* 14 E> */ B(Call), R(1), R(2), U8(2), U8(2), + /* 35 S> */ B(LdaLookupGlobalSlot), U8(2), U8(6), U8(1), /* 45 S> */ B(Return), ] constant pool: [ @@ -57,20 +58,21 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 74 +bytecode array length: 67 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(6), U8(0), + B(StaCurrentContextSlot), U8(6), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(5), U8(0), + B(StaCurrentContextSlot), U8(5), /* 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), + /* 14 S> */ B(LdaUndefined), + B(Star), R(2), + /* 14 E> */ B(LdaLookupGlobalSlot), U8(0), U8(4), U8(1), + B(Star), R(1), B(LdaConstant), U8(1), B(Star), R(3), B(LdaZero), @@ -84,8 +86,8 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 14 E> */ B(Call), R(1), R(2), U8(2), U8(0), - /* 35 S> */ B(LdaLookupGlobalSlotInsideTypeof), U8(2), U8(4), U8(1), + /* 14 E> */ B(Call), R(1), R(2), U8(2), U8(2), + /* 35 S> */ B(LdaLookupGlobalSlotInsideTypeof), U8(2), U8(6), U8(1), B(TypeOf), /* 52 S> */ B(Return), ] @@ -103,22 +105,23 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 73 +bytecode array length: 66 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(6), U8(0), + B(StaCurrentContextSlot), U8(6), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(5), U8(0), + B(StaCurrentContextSlot), U8(5), /* 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), + /* 22 S> */ B(LdaUndefined), + B(Star), R(2), + /* 29 E> */ B(LdaLookupGlobalSlot), U8(1), U8(4), U8(1), + B(Star), R(1), B(LdaConstant), U8(2), B(Star), R(3), B(LdaZero), @@ -132,7 +135,7 @@ bytecodes: [ 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), + /* 29 E> */ B(Call), R(1), R(2), U8(2), U8(2), /* 39 S> */ B(Return), ] constant pool: [ @@ -154,20 +157,21 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 73 +bytecode array length: 66 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(6), U8(0), + B(StaCurrentContextSlot), U8(6), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(5), U8(0), + B(StaCurrentContextSlot), U8(5), /* 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), + /* 44 S> */ B(LdaUndefined), + B(Star), R(2), + /* 44 E> */ B(LdaLookupGlobalSlot), U8(0), U8(4), U8(1), + B(Star), R(1), B(LdaConstant), U8(1), B(Star), R(3), B(LdaZero), @@ -181,7 +185,7 @@ bytecodes: [ 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), + /* 44 E> */ B(Call), R(1), R(2), U8(2), U8(2), /* 66 S> */ B(LdaLookupContextSlot), U8(2), U8(6), U8(1), /* 76 S> */ B(Return), ] @@ -204,20 +208,21 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 73 +bytecode array length: 66 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), B(Ldar), R(this), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), B(CreateMappedArguments), - B(StaContextSlot), R(context), U8(6), U8(0), + B(StaCurrentContextSlot), U8(6), B(Ldar), R(new_target), - B(StaContextSlot), R(context), U8(5), U8(0), + B(StaCurrentContextSlot), U8(5), /* 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), + /* 40 S> */ B(LdaUndefined), + B(Star), R(2), + /* 40 E> */ B(LdaLookupGlobalSlot), U8(0), U8(4), U8(1), + B(Star), R(1), B(LdaConstant), U8(1), B(Star), R(3), B(LdaZero), @@ -231,8 +236,8 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 40 E> */ B(Call), R(1), R(2), U8(2), U8(0), - /* 62 S> */ B(LdaLookupGlobalSlot), U8(2), U8(4), U8(1), + /* 40 E> */ B(Call), R(1), R(2), U8(2), U8(2), + /* 62 S> */ B(LdaLookupGlobalSlot), U8(2), U8(6), U8(1), /* 72 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden index 62dbeb7ada..7f13b4a3d5 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/Modules.golden @@ -13,7 +13,7 @@ snippet: " " frame size: 8 parameter count: 2 -bytecode array length: 133 +bytecode array length: 125 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(21), @@ -21,8 +21,8 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(TestEqualStrict), R(1), U8(0), - B(JumpIfTrue), U8(71), - B(LdaSmi), U8(76), + B(JumpIfTrue), U8(63), + B(LdaSmi), U8(77), B(Star), R(2), B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), B(LdaSmi), U8(-2), @@ -34,15 +34,16 @@ bytecodes: [ 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(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), - B(Ldar), R(3), + B(LdaCurrentContextSlot), U8(4), + B(Star), 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), + /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(2), - B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(3), B(LdaZero), B(SuspendGenerator), R(3), B(Ldar), R(2), @@ -82,7 +83,7 @@ snippet: " " frame size: 8 parameter count: 2 -bytecode array length: 133 +bytecode array length: 125 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(21), @@ -90,8 +91,8 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(TestEqualStrict), R(1), U8(0), - B(JumpIfTrue), U8(71), - B(LdaSmi), U8(76), + B(JumpIfTrue), U8(63), + B(LdaSmi), U8(77), B(Star), R(2), B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), B(LdaSmi), U8(-2), @@ -103,15 +104,16 @@ bytecodes: [ 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(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), - B(Ldar), R(3), + B(LdaCurrentContextSlot), U8(4), + B(Star), 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), + /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(2), - B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(3), B(LdaZero), B(SuspendGenerator), R(3), B(Ldar), R(2), @@ -153,7 +155,7 @@ snippet: " " frame size: 9 parameter count: 2 -bytecode array length: 223 +bytecode array length: 195 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(21), @@ -161,8 +163,8 @@ bytecodes: [ B(Star), R(2), B(LdaZero), B(TestEqualStrict), R(2), U8(0), - B(JumpIfTrue), U8(71), - B(LdaSmi), U8(76), + B(JumpIfTrue), U8(63), + B(LdaSmi), U8(77), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), B(LdaSmi), U8(-2), @@ -174,15 +176,16 @@ bytecodes: [ 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(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(4), - B(Ldar), R(4), + B(LdaCurrentContextSlot), U8(4), + B(Star), 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), + /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(3), - B(LdrContextSlot), R(context), U8(5), U8(0), R(4), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(4), B(LdaZero), B(SuspendGenerator), R(4), B(Ldar), R(3), @@ -207,37 +210,31 @@ bytecodes: [ /* 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), + /* 32 S> */ B(LdaUndefined), + B(Star), R(4), + /* 32 E> */ B(LdaModuleVariable), U8(-1), U8(0), B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(2), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(8), U8(1), + B(LdaConstant), U8(1), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), 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(CreateBlockContext), U8(2), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 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), + /* 47 E> */ B(StaCurrentContextSlot), U8(4), + /* 52 S> */ B(LdaUndefined), + B(Star), R(4), + /* 52 E> */ B(LdaModuleVariable), U8(-1), U8(1), B(JumpIfNotHole), U8(11), - B(LdaConstant), U8(2), - B(Star), R(8), - B(CallRuntime), U16(Runtime::kThrowReferenceError), R(8), U8(1), + B(LdaConstant), U8(1), + B(Star), R(5), + B(CallRuntime), U16(Runtime::kThrowReferenceError), R(5), U8(1), B(Star), R(3), B(LdaSmi), U8(42), B(Star), R(5), @@ -248,7 +245,6 @@ bytecodes: [ ] constant pool: [ FIXED_ARRAY_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["foo"], ONE_BYTE_INTERNALIZED_STRING_TYPE ["goo"], FIXED_ARRAY_TYPE, ] @@ -263,7 +259,7 @@ snippet: " " frame size: 9 parameter count: 2 -bytecode array length: 208 +bytecode array length: 160 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(21), @@ -271,8 +267,8 @@ bytecodes: [ B(Star), R(2), B(LdaZero), B(TestEqualStrict), R(2), U8(0), - B(JumpIfTrue), U8(71), - B(LdaSmi), U8(76), + B(JumpIfTrue), U8(63), + B(LdaSmi), U8(77), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), B(LdaSmi), U8(-2), @@ -284,15 +280,16 @@ bytecodes: [ 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(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(4), - B(Ldar), R(4), + B(LdaCurrentContextSlot), U8(4), + B(Star), 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), + /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(3), - B(LdrContextSlot), R(context), U8(5), U8(0), R(4), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(4), B(LdaZero), B(SuspendGenerator), R(4), B(Ldar), R(3), @@ -318,40 +315,26 @@ bytecodes: [ 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), + /* 17 E> */ B(StaModuleVariable), U8(1), U8(0), + /* 21 S> */ B(LdaModuleVariable), U8(1), U8(0), 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), + /* 24 E> */ B(StaModuleVariable), U8(1), U8(0), B(Ldar), R(closure), - B(CreateBlockContext), U8(2), + B(CreateBlockContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 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), + /* 34 E> */ B(StaCurrentContextSlot), U8(4), + /* 39 S> */ B(LdaModuleVariable), U8(1), 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), + /* 42 E> */ B(StaModuleVariable), U8(1), U8(1), 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: [ @@ -365,7 +348,7 @@ snippet: " " frame size: 9 parameter count: 2 -bytecode array length: 242 +bytecode array length: 164 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(21), @@ -373,8 +356,8 @@ bytecodes: [ B(Star), R(2), B(LdaZero), B(TestEqualStrict), R(2), U8(0), - B(JumpIfTrue), U8(83), - B(LdaSmi), U8(76), + B(JumpIfTrue), U8(67), + B(LdaSmi), U8(77), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), B(LdaSmi), U8(-2), @@ -386,20 +369,18 @@ bytecodes: [ 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(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(Star), R(4), - B(LdaConstant), U8(1), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kStoreModuleExport), R(3), U8(2), + B(StaModuleVariable), U8(1), U8(0), /* 0 E> */ B(StackCheck), - /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(4), - B(Ldar), R(4), + B(LdaCurrentContextSlot), U8(4), + B(Star), 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), + /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(3), - B(LdrContextSlot), R(context), U8(5), U8(0), R(4), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(4), B(LdaZero), B(SuspendGenerator), R(4), B(Ldar), R(3), @@ -425,48 +406,26 @@ bytecodes: [ 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), + /* 17 E> */ B(StaModuleVariable), U8(1), U8(0), + /* 21 S> */ B(LdaModuleVariable), U8(1), U8(0), 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), + /* 24 E> */ B(StaModuleVariable), U8(1), U8(0), B(Ldar), R(closure), - B(CreateBlockContext), U8(2), + B(CreateBlockContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 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), + /* 34 E> */ B(StaCurrentContextSlot), U8(4), + /* 39 S> */ B(LdaModuleVariable), U8(1), 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), + /* 42 E> */ B(StaModuleVariable), U8(1), U8(1), 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: [ @@ -480,7 +439,7 @@ snippet: " " frame size: 9 parameter count: 2 -bytecode array length: 230 +bytecode array length: 168 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(21), @@ -488,8 +447,8 @@ bytecodes: [ B(Star), R(2), B(LdaZero), B(TestEqualStrict), R(2), U8(0), - B(JumpIfTrue), U8(83), - B(LdaSmi), U8(76), + B(JumpIfTrue), U8(67), + B(LdaSmi), U8(77), B(Star), R(3), B(CallRuntime), U16(Runtime::kAbort), R(3), U8(1), B(LdaSmi), U8(-2), @@ -501,20 +460,18 @@ bytecodes: [ 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(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(Star), R(4), - B(LdaConstant), U8(1), - B(Star), R(3), - B(CallRuntime), U16(Runtime::kStoreModuleExport), R(3), U8(2), + B(StaModuleVariable), U8(1), U8(0), /* 0 E> */ B(StackCheck), - /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(4), - B(Ldar), R(4), + B(LdaCurrentContextSlot), U8(4), + B(Star), 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), + /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(3), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(3), - B(LdrContextSlot), R(context), U8(5), U8(0), R(4), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(4), B(LdaZero), B(SuspendGenerator), R(4), B(Ldar), R(3), @@ -540,33 +497,18 @@ bytecodes: [ 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), + /* 19 E> */ B(StaModuleVariable), U8(1), U8(0), + /* 23 S> */ B(LdaModuleVariable), U8(1), U8(0), B(Inc), U8(2), /* 26 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), B(Ldar), R(closure), - B(CreateBlockContext), U8(2), + B(CreateBlockContext), U8(1), B(PushContext), R(1), B(LdaTheHole), - B(StaContextSlot), R(context), U8(4), U8(0), + B(StaCurrentContextSlot), U8(4), /* 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), + /* 36 E> */ B(StaCurrentContextSlot), U8(4), + /* 41 S> */ B(LdaModuleVariable), U8(1), U8(1), B(Inc), U8(3), /* 44 E> */ B(CallRuntime), U16(Runtime::kThrowConstAssignError), R(0), U8(0), B(PopContext), R(1), @@ -575,7 +517,6 @@ bytecodes: [ ] constant pool: [ FIXED_ARRAY_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["foo"], FIXED_ARRAY_TYPE, ] handlers: [ @@ -587,7 +528,7 @@ snippet: " " frame size: 8 parameter count: 2 -bytecode array length: 159 +bytecode array length: 135 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(21), @@ -595,8 +536,8 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(TestEqualStrict), R(1), U8(0), - B(JumpIfTrue), U8(83), - B(LdaSmi), U8(76), + B(JumpIfTrue), U8(67), + B(LdaSmi), U8(77), B(Star), R(2), B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), B(LdaSmi), U8(-2), @@ -608,20 +549,18 @@ bytecodes: [ 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(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(Star), R(3), - B(LdaConstant), U8(1), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kStoreModuleExport), R(2), U8(2), + B(StaModuleVariable), U8(1), U8(0), /* 0 E> */ B(StackCheck), - /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), - B(Ldar), R(3), + B(LdaCurrentContextSlot), U8(4), + B(Star), 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), + /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(2), - B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(3), B(LdaZero), B(SuspendGenerator), R(3), B(Ldar), R(2), @@ -646,17 +585,13 @@ bytecodes: [ /* 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(CreateClosure), U8(1), U8(0), + B(StaModuleVariable), U8(1), U8(0), B(LdaUndefined), /* 32 S> */ B(Return), ] constant pool: [ FIXED_ARRAY_TYPE, - ONE_BYTE_INTERNALIZED_STRING_TYPE ["default"], SHARED_FUNCTION_INFO_TYPE, ] handlers: [ @@ -668,7 +603,7 @@ snippet: " " frame size: 8 parameter count: 2 -bytecode array length: 196 +bytecode array length: 170 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(21), @@ -676,8 +611,8 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(TestEqualStrict), R(1), U8(0), - B(JumpIfTrue), U8(83), - B(LdaSmi), U8(76), + B(JumpIfTrue), U8(67), + B(LdaSmi), U8(77), B(Star), R(2), B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), B(LdaSmi), U8(-2), @@ -689,20 +624,18 @@ bytecodes: [ 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(StaCurrentContextSlot), U8(4), B(LdaTheHole), - B(Star), R(3), - B(LdaConstant), U8(1), - B(Star), R(2), - B(CallRuntime), U16(Runtime::kStoreModuleExport), R(2), U8(2), + B(StaModuleVariable), U8(1), U8(0), /* 0 E> */ B(StackCheck), - /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), - B(Ldar), R(3), + B(LdaCurrentContextSlot), U8(4), + B(Star), 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), + /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(2), - B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(3), B(LdaZero), B(SuspendGenerator), R(3), B(Ldar), R(2), @@ -729,7 +662,7 @@ bytecodes: [ /* 0 E> */ B(Throw), /* 16 S> */ B(LdaTheHole), B(Star), R(2), - B(CreateClosure), U8(2), U8(0), + B(CreateClosure), U8(1), U8(0), B(Star), R(3), B(LdaSmi), U8(16), B(Star), R(4), @@ -737,19 +670,17 @@ bytecodes: [ 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(LdaNamedProperty), R(2), U8(2), U8(2), + B(Star), 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(StaCurrentContextSlot), U8(6), + B(LdaCurrentContextSlot), U8(6), + /* 16 E> */ B(StaModuleVariable), U8(1), U8(0), 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"], ] @@ -762,7 +693,7 @@ snippet: " " frame size: 8 parameter count: 2 -bytecode array length: 133 +bytecode array length: 125 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(21), @@ -770,8 +701,8 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(TestEqualStrict), R(1), U8(0), - B(JumpIfTrue), U8(71), - B(LdaSmi), U8(76), + B(JumpIfTrue), U8(63), + B(LdaSmi), U8(77), B(Star), R(2), B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), B(LdaSmi), U8(-2), @@ -783,15 +714,16 @@ bytecodes: [ 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(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), - B(Ldar), R(3), + B(LdaCurrentContextSlot), U8(4), + B(Star), 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), + /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(2), - B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(3), B(LdaZero), B(SuspendGenerator), R(3), B(Ldar), R(2), @@ -831,7 +763,7 @@ snippet: " " frame size: 8 parameter count: 2 -bytecode array length: 133 +bytecode array length: 125 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(21), @@ -839,8 +771,8 @@ bytecodes: [ B(Star), R(1), B(LdaZero), B(TestEqualStrict), R(1), U8(0), - B(JumpIfTrue), U8(71), - B(LdaSmi), U8(76), + B(JumpIfTrue), U8(63), + B(LdaSmi), U8(77), B(Star), R(2), B(CallRuntime), U16(Runtime::kAbort), R(2), U8(1), B(LdaSmi), U8(-2), @@ -852,15 +784,16 @@ bytecodes: [ 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(StaCurrentContextSlot), U8(4), /* 0 E> */ B(StackCheck), - /* 0 E> */ B(LdrContextSlot), R(context), U8(4), U8(0), R(3), - B(Ldar), R(3), + B(LdaCurrentContextSlot), U8(4), + B(Star), 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), + /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaCurrentContextSlot), U8(5), B(Star), R(2), - B(LdrContextSlot), R(context), U8(5), U8(0), R(3), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(3), B(LdaZero), B(SuspendGenerator), R(3), B(Ldar), R(2), @@ -894,3 +827,91 @@ constant pool: [ handlers: [ ] +--- +snippet: " + import * as foo from \"bar\" + foo.f(foo, foo.x); +" +frame size: 8 +parameter count: 2 +bytecode array length: 164 +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(73), + B(LdaSmi), U8(77), + 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(StaCurrentContextSlot), U8(4), + B(LdaZero), + B(Star), R(2), + B(CallRuntime), U16(Runtime::kGetModuleNamespace), R(2), U8(1), + B(StaCurrentContextSlot), U8(6), + /* 0 E> */ B(StackCheck), + B(LdaCurrentContextSlot), U8(4), + B(Star), R(3), + B(Mov), R(closure), R(2), + /* 0 E> */ B(CallRuntime), U16(Runtime::kCreateJSGeneratorObject), R(2), U8(2), + B(StaCurrentContextSlot), U8(5), + B(Star), R(2), + B(LdaCurrentContextSlot), U8(5), + B(Star), R(3), + B(LdaZero), + B(SuspendGenerator), R(3), + B(Ldar), R(2), + /* 45 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), + /* 45 S> */ B(Return), + B(Ldar), R(4), + /* 0 E> */ B(Throw), + /* 27 S> */ B(LdaCurrentContextSlot), U8(6), + B(Star), R(3), + /* 30 E> */ B(LdaNamedProperty), R(3), U8(1), U8(4), + B(Star), R(2), + B(LdaCurrentContextSlot), U8(6), + B(Star), R(4), + B(LdaCurrentContextSlot), U8(6), + B(Star), R(5), + /* 41 E> */ B(LdaNamedProperty), R(5), U8(2), U8(6), + B(Star), R(5), + /* 31 E> */ B(CallProperty), R(2), R(3), U8(3), U8(2), + B(LdaUndefined), + /* 45 S> */ B(Return), +] +constant pool: [ + FIXED_ARRAY_TYPE, + ONE_BYTE_INTERNALIZED_STRING_TYPE ["f"], + ONE_BYTE_INTERNALIZED_STRING_TYPE ["x"], +] +handlers: [ +] + diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden index 397b0de724..30b148b1d6 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/OuterContextVariables.golden @@ -20,12 +20,13 @@ snippet: " " frame size: 1 parameter count: 1 -bytecode array length: 14 +bytecode array length: 13 bytecodes: [ /* 97 E> */ B(StackCheck), - /* 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), + /* 102 S> */ B(LdaContextSlot), R(context), U8(4), U8(1), + B(Star), R(0), + B(LdaCurrentContextSlot), U8(4), + /* 120 E> */ B(Mul), R(0), U8(2), /* 130 S> */ B(Return), ] constant pool: [ @@ -47,10 +48,10 @@ snippet: " " frame size: 0 parameter count: 1 -bytecode array length: 11 +bytecode array length: 9 bytecodes: [ /* 97 E> */ B(StackCheck), - /* 102 S> */ B(LdaContextSlot), R(context), U8(4), U8(0), + /* 102 S> */ B(LdaCurrentContextSlot), U8(4), /* 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/PropertyCall.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden index 96c0428c6c..e401dbf88b 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden @@ -13,12 +13,13 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 13 +bytecode array length: 14 bytecodes: [ /* 10 E> */ B(StackCheck), /* 16 S> */ B(Nop), - /* 24 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(4), R(0), - /* 25 E> */ B(Call), R(0), R(arg0), U8(1), U8(2), + /* 24 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4), + B(Star), R(0), + /* 25 E> */ B(CallProperty), R(0), R(arg0), U8(1), U8(2), /* 33 S> */ B(Return), ] constant pool: [ @@ -34,16 +35,16 @@ snippet: " " frame size: 4 parameter count: 4 -bytecode array length: 24 +bytecode array length: 23 bytecodes: [ /* 10 E> */ B(StackCheck), /* 22 S> */ B(Nop), - /* 30 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(4), R(0), - B(Ldar), R(0), + /* 30 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4), + B(Star), 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(2), + /* 31 E> */ B(CallProperty), R(0), R(1), U8(3), U8(2), /* 43 S> */ B(Return), ] constant pool: [ @@ -59,17 +60,18 @@ snippet: " " frame size: 4 parameter count: 3 -bytecode array length: 26 +bytecode array length: 27 bytecodes: [ /* 10 E> */ B(StackCheck), /* 19 S> */ B(Nop), - /* 27 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(4), R(0), + /* 27 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4), + B(Star), R(0), B(Ldar), R(arg1), /* 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(2), + /* 28 E> */ B(CallProperty), R(0), R(1), U8(3), U8(2), /* 44 S> */ B(Return), ] constant pool: [ @@ -474,8 +476,9 @@ bytecodes: [ /* 1160 S> */ B(Nop), /* 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(260), R16(0), - /* 1178 E> */ B(Wide), B(Call), R16(0), R16(arg0), U16(1), U16(258), + /* 1177 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(260), + B(Star), R(0), + /* 1178 E> */ B(Wide), B(CallProperty), R16(0), R16(arg0), U16(1), U16(258), /* 1186 S> */ B(Return), ] constant pool: [ @@ -484,3 +487,40 @@ constant pool: [ handlers: [ ] +--- +snippet: " + function f(a) { return a.func(1).func(2).func(3); } + f(new (function Obj() { this.func = function(a) { return this; }})()) +" +frame size: 5 +parameter count: 2 +bytecode array length: 55 +bytecodes: [ + /* 10 E> */ B(StackCheck), + /* 16 S> */ B(Nop), + /* 24 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(8), + B(Star), R(2), + B(LdaSmi), U8(1), + B(Star), R(4), + B(Mov), R(arg0), R(3), + /* 25 E> */ B(CallProperty), R(2), R(3), U8(2), U8(6), + B(Star), R(2), + /* 32 E> */ B(LdaNamedProperty), R(2), U8(0), U8(10), + B(Star), R(1), + B(LdaSmi), U8(2), + B(Star), R(3), + /* 33 E> */ B(CallProperty), R(1), R(2), U8(2), U8(4), + B(Star), R(1), + /* 40 E> */ B(LdaNamedProperty), R(1), U8(0), U8(12), + B(Star), R(0), + B(LdaSmi), U8(3), + B(Star), R(2), + /* 41 E> */ B(CallProperty), R(0), R(1), U8(2), U8(2), + /* 50 S> */ B(Return), +] +constant pool: [ + 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 09f073e859..70e75645b2 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/PropertyLoads.golden @@ -91,12 +91,12 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 15 +bytecode array length: 14 bytecodes: [ /* 10 E> */ B(StackCheck), /* 25 S> */ B(Nop), - /* 25 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(2), R(0), - B(Ldar), R(0), + /* 25 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(2), + B(Star), R(0), /* 32 S> */ B(LdaSmi), U8(-124), /* 40 E> */ B(LdaKeyedProperty), R(arg0), U8(4), /* 48 S> */ B(Return), @@ -245,393 +245,393 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 1040 +bytecode array length: 911 bytecodes: [ /* 10 E> */ B(StackCheck), /* 27 S> */ B(Nop), - /* 32 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(2), R(0), - B(Ldar), R(0), + /* 32 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(2), + B(Star), R(0), /* 41 S> */ B(Nop), - /* 46 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(4), R(0), - B(Ldar), R(0), + /* 46 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4), + B(Star), R(0), /* 55 S> */ B(Nop), - /* 60 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(6), R(0), - B(Ldar), R(0), + /* 60 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(6), + B(Star), R(0), /* 69 S> */ B(Nop), - /* 74 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(8), R(0), - B(Ldar), R(0), + /* 74 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(8), + B(Star), R(0), /* 83 S> */ B(Nop), - /* 88 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(10), R(0), - B(Ldar), R(0), + /* 88 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(10), + B(Star), R(0), /* 97 S> */ B(Nop), - /* 102 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(12), R(0), - B(Ldar), R(0), + /* 102 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(12), + B(Star), R(0), /* 111 S> */ B(Nop), - /* 116 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(14), R(0), - B(Ldar), R(0), + /* 116 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(14), + B(Star), R(0), /* 125 S> */ B(Nop), - /* 130 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(16), R(0), - B(Ldar), R(0), + /* 130 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(16), + B(Star), R(0), /* 139 S> */ B(Nop), - /* 144 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(18), R(0), - B(Ldar), R(0), + /* 144 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(18), + B(Star), R(0), /* 153 S> */ B(Nop), - /* 158 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(20), R(0), - B(Ldar), R(0), + /* 158 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(20), + B(Star), R(0), /* 167 S> */ B(Nop), - /* 172 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(22), R(0), - B(Ldar), R(0), + /* 172 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(22), + B(Star), R(0), /* 181 S> */ B(Nop), - /* 186 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(24), R(0), - B(Ldar), R(0), + /* 186 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(24), + B(Star), R(0), /* 195 S> */ B(Nop), - /* 200 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(26), R(0), - B(Ldar), R(0), + /* 200 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(26), + B(Star), R(0), /* 209 S> */ B(Nop), - /* 214 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(28), R(0), - B(Ldar), R(0), + /* 214 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(28), + B(Star), R(0), /* 223 S> */ B(Nop), - /* 228 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(30), R(0), - B(Ldar), R(0), + /* 228 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(30), + B(Star), R(0), /* 237 S> */ B(Nop), - /* 242 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(32), R(0), - B(Ldar), R(0), + /* 242 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(32), + B(Star), R(0), /* 251 S> */ B(Nop), - /* 256 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(34), R(0), - B(Ldar), R(0), + /* 256 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(34), + B(Star), R(0), /* 265 S> */ B(Nop), - /* 270 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(36), R(0), - B(Ldar), R(0), + /* 270 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(36), + B(Star), R(0), /* 279 S> */ B(Nop), - /* 284 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(38), R(0), - B(Ldar), R(0), + /* 284 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(38), + B(Star), R(0), /* 293 S> */ B(Nop), - /* 298 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(40), R(0), - B(Ldar), R(0), + /* 298 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(40), + B(Star), R(0), /* 307 S> */ B(Nop), - /* 312 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(42), R(0), - B(Ldar), R(0), + /* 312 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(42), + B(Star), R(0), /* 321 S> */ B(Nop), - /* 326 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(44), R(0), - B(Ldar), R(0), + /* 326 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(44), + B(Star), R(0), /* 335 S> */ B(Nop), - /* 340 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(46), R(0), - B(Ldar), R(0), + /* 340 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(46), + B(Star), R(0), /* 349 S> */ B(Nop), - /* 354 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(48), R(0), - B(Ldar), R(0), + /* 354 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(48), + B(Star), R(0), /* 363 S> */ B(Nop), - /* 368 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(50), R(0), - B(Ldar), R(0), + /* 368 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(50), + B(Star), R(0), /* 377 S> */ B(Nop), - /* 382 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(52), R(0), - B(Ldar), R(0), + /* 382 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(52), + B(Star), R(0), /* 391 S> */ B(Nop), - /* 396 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(54), R(0), - B(Ldar), R(0), + /* 396 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(54), + B(Star), R(0), /* 405 S> */ B(Nop), - /* 410 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(56), R(0), - B(Ldar), R(0), + /* 410 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(56), + B(Star), R(0), /* 419 S> */ B(Nop), - /* 424 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(58), R(0), - B(Ldar), R(0), + /* 424 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(58), + B(Star), R(0), /* 433 S> */ B(Nop), - /* 438 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(60), R(0), - B(Ldar), R(0), + /* 438 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(60), + B(Star), R(0), /* 447 S> */ B(Nop), - /* 452 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(62), R(0), - B(Ldar), R(0), + /* 452 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(62), + B(Star), R(0), /* 461 S> */ B(Nop), - /* 466 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(64), R(0), - B(Ldar), R(0), + /* 466 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(64), + B(Star), R(0), /* 475 S> */ B(Nop), - /* 480 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(66), R(0), - B(Ldar), R(0), + /* 480 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(66), + B(Star), R(0), /* 489 S> */ B(Nop), - /* 494 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(68), R(0), - B(Ldar), R(0), + /* 494 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(68), + B(Star), R(0), /* 503 S> */ B(Nop), - /* 508 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(70), R(0), - B(Ldar), R(0), + /* 508 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(70), + B(Star), R(0), /* 517 S> */ B(Nop), - /* 522 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(72), R(0), - B(Ldar), R(0), + /* 522 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(72), + B(Star), R(0), /* 531 S> */ B(Nop), - /* 536 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(74), R(0), - B(Ldar), R(0), + /* 536 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(74), + B(Star), R(0), /* 545 S> */ B(Nop), - /* 550 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(76), R(0), - B(Ldar), R(0), + /* 550 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(76), + B(Star), R(0), /* 559 S> */ B(Nop), - /* 564 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(78), R(0), - B(Ldar), R(0), + /* 564 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(78), + B(Star), R(0), /* 573 S> */ B(Nop), - /* 578 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(80), R(0), - B(Ldar), R(0), + /* 578 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(80), + B(Star), R(0), /* 587 S> */ B(Nop), - /* 592 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(82), R(0), - B(Ldar), R(0), + /* 592 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(82), + B(Star), R(0), /* 601 S> */ B(Nop), - /* 606 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(84), R(0), - B(Ldar), R(0), + /* 606 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(84), + B(Star), R(0), /* 615 S> */ B(Nop), - /* 620 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(86), R(0), - B(Ldar), R(0), + /* 620 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(86), + B(Star), R(0), /* 629 S> */ B(Nop), - /* 634 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(88), R(0), - B(Ldar), R(0), + /* 634 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(88), + B(Star), R(0), /* 643 S> */ B(Nop), - /* 648 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(90), R(0), - B(Ldar), R(0), + /* 648 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(90), + B(Star), R(0), /* 657 S> */ B(Nop), - /* 662 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(92), R(0), - B(Ldar), R(0), + /* 662 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(92), + B(Star), R(0), /* 671 S> */ B(Nop), - /* 676 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(94), R(0), - B(Ldar), R(0), + /* 676 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(94), + B(Star), R(0), /* 685 S> */ B(Nop), - /* 690 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(96), R(0), - B(Ldar), R(0), + /* 690 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(96), + B(Star), R(0), /* 699 S> */ B(Nop), - /* 704 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(98), R(0), - B(Ldar), R(0), + /* 704 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(98), + B(Star), R(0), /* 713 S> */ B(Nop), - /* 718 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(100), R(0), - B(Ldar), R(0), + /* 718 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(100), + B(Star), R(0), /* 727 S> */ B(Nop), - /* 732 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(102), R(0), - B(Ldar), R(0), + /* 732 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(102), + B(Star), R(0), /* 741 S> */ B(Nop), - /* 746 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(104), R(0), - B(Ldar), R(0), + /* 746 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(104), + B(Star), R(0), /* 755 S> */ B(Nop), - /* 760 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(106), R(0), - B(Ldar), R(0), + /* 760 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(106), + B(Star), R(0), /* 769 S> */ B(Nop), - /* 774 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(108), R(0), - B(Ldar), R(0), + /* 774 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(108), + B(Star), R(0), /* 783 S> */ B(Nop), - /* 788 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(110), R(0), - B(Ldar), R(0), + /* 788 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(110), + B(Star), R(0), /* 797 S> */ B(Nop), - /* 802 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(112), R(0), - B(Ldar), R(0), + /* 802 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(112), + B(Star), R(0), /* 811 S> */ B(Nop), - /* 816 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(114), R(0), - B(Ldar), R(0), + /* 816 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(114), + B(Star), R(0), /* 825 S> */ B(Nop), - /* 830 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(116), R(0), - B(Ldar), R(0), + /* 830 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(116), + B(Star), R(0), /* 839 S> */ B(Nop), - /* 844 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(118), R(0), - B(Ldar), R(0), + /* 844 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(118), + B(Star), R(0), /* 853 S> */ B(Nop), - /* 858 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(120), R(0), - B(Ldar), R(0), + /* 858 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(120), + B(Star), R(0), /* 867 S> */ B(Nop), - /* 872 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(122), R(0), - B(Ldar), R(0), + /* 872 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(122), + B(Star), R(0), /* 881 S> */ B(Nop), - /* 886 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(124), R(0), - B(Ldar), R(0), + /* 886 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(124), + B(Star), R(0), /* 895 S> */ B(Nop), - /* 900 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(126), R(0), - B(Ldar), R(0), + /* 900 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(126), + B(Star), R(0), /* 909 S> */ B(Nop), - /* 914 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(128), R(0), - B(Ldar), R(0), + /* 914 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(128), + B(Star), R(0), /* 923 S> */ B(Nop), - /* 928 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(130), R(0), - B(Ldar), R(0), + /* 928 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(130), + B(Star), R(0), /* 937 S> */ B(Nop), - /* 942 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(132), R(0), - B(Ldar), R(0), + /* 942 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(132), + B(Star), R(0), /* 951 S> */ B(Nop), - /* 956 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(134), R(0), - B(Ldar), R(0), + /* 956 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(134), + B(Star), R(0), /* 965 S> */ B(Nop), - /* 970 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(136), R(0), - B(Ldar), R(0), + /* 970 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(136), + B(Star), R(0), /* 979 S> */ B(Nop), - /* 984 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(138), R(0), - B(Ldar), R(0), + /* 984 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(138), + B(Star), R(0), /* 993 S> */ B(Nop), - /* 998 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(140), R(0), - B(Ldar), R(0), + /* 998 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(140), + B(Star), R(0), /* 1007 S> */ B(Nop), - /* 1012 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(142), R(0), - B(Ldar), R(0), + /* 1012 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(142), + B(Star), R(0), /* 1021 S> */ B(Nop), - /* 1026 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(144), R(0), - B(Ldar), R(0), + /* 1026 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(144), + B(Star), R(0), /* 1035 S> */ B(Nop), - /* 1040 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(146), R(0), - B(Ldar), R(0), + /* 1040 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(146), + B(Star), R(0), /* 1049 S> */ B(Nop), - /* 1054 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(148), R(0), - B(Ldar), R(0), + /* 1054 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(148), + B(Star), R(0), /* 1063 S> */ B(Nop), - /* 1068 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(150), R(0), - B(Ldar), R(0), + /* 1068 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(150), + B(Star), R(0), /* 1077 S> */ B(Nop), - /* 1082 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(152), R(0), - B(Ldar), R(0), + /* 1082 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(152), + B(Star), R(0), /* 1091 S> */ B(Nop), - /* 1096 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(154), R(0), - B(Ldar), R(0), + /* 1096 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(154), + B(Star), R(0), /* 1105 S> */ B(Nop), - /* 1110 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(156), R(0), - B(Ldar), R(0), + /* 1110 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(156), + B(Star), R(0), /* 1119 S> */ B(Nop), - /* 1124 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(158), R(0), - B(Ldar), R(0), + /* 1124 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(158), + B(Star), R(0), /* 1133 S> */ B(Nop), - /* 1138 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(160), R(0), - B(Ldar), R(0), + /* 1138 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(160), + B(Star), R(0), /* 1147 S> */ B(Nop), - /* 1152 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(162), R(0), - B(Ldar), R(0), + /* 1152 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(162), + B(Star), R(0), /* 1161 S> */ B(Nop), - /* 1166 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(164), R(0), - B(Ldar), R(0), + /* 1166 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(164), + B(Star), R(0), /* 1175 S> */ B(Nop), - /* 1180 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(166), R(0), - B(Ldar), R(0), + /* 1180 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(166), + B(Star), R(0), /* 1189 S> */ B(Nop), - /* 1194 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(168), R(0), - B(Ldar), R(0), + /* 1194 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(168), + B(Star), R(0), /* 1203 S> */ B(Nop), - /* 1208 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(170), R(0), - B(Ldar), R(0), + /* 1208 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(170), + B(Star), R(0), /* 1217 S> */ B(Nop), - /* 1222 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(172), R(0), - B(Ldar), R(0), + /* 1222 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(172), + B(Star), R(0), /* 1231 S> */ B(Nop), - /* 1236 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(174), R(0), - B(Ldar), R(0), + /* 1236 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(174), + B(Star), R(0), /* 1245 S> */ B(Nop), - /* 1250 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(176), R(0), - B(Ldar), R(0), + /* 1250 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(176), + B(Star), R(0), /* 1259 S> */ B(Nop), - /* 1264 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(178), R(0), - B(Ldar), R(0), + /* 1264 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(178), + B(Star), R(0), /* 1273 S> */ B(Nop), - /* 1278 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(180), R(0), - B(Ldar), R(0), + /* 1278 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(180), + B(Star), R(0), /* 1287 S> */ B(Nop), - /* 1292 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(182), R(0), - B(Ldar), R(0), + /* 1292 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(182), + B(Star), R(0), /* 1301 S> */ B(Nop), - /* 1306 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(184), R(0), - B(Ldar), R(0), + /* 1306 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(184), + B(Star), R(0), /* 1315 S> */ B(Nop), - /* 1320 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(186), R(0), - B(Ldar), R(0), + /* 1320 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(186), + B(Star), R(0), /* 1329 S> */ B(Nop), - /* 1334 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(188), R(0), - B(Ldar), R(0), + /* 1334 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(188), + B(Star), R(0), /* 1343 S> */ B(Nop), - /* 1348 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(190), R(0), - B(Ldar), R(0), + /* 1348 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(190), + B(Star), R(0), /* 1357 S> */ B(Nop), - /* 1362 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(192), R(0), - B(Ldar), R(0), + /* 1362 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(192), + B(Star), R(0), /* 1371 S> */ B(Nop), - /* 1376 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(194), R(0), - B(Ldar), R(0), + /* 1376 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(194), + B(Star), R(0), /* 1385 S> */ B(Nop), - /* 1390 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(196), R(0), - B(Ldar), R(0), + /* 1390 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(196), + B(Star), R(0), /* 1399 S> */ B(Nop), - /* 1404 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(198), R(0), - B(Ldar), R(0), + /* 1404 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(198), + B(Star), R(0), /* 1413 S> */ B(Nop), - /* 1418 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(200), R(0), - B(Ldar), R(0), + /* 1418 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(200), + B(Star), R(0), /* 1427 S> */ B(Nop), - /* 1432 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(202), R(0), - B(Ldar), R(0), + /* 1432 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(202), + B(Star), R(0), /* 1441 S> */ B(Nop), - /* 1446 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(204), R(0), - B(Ldar), R(0), + /* 1446 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(204), + B(Star), R(0), /* 1455 S> */ B(Nop), - /* 1460 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(206), R(0), - B(Ldar), R(0), + /* 1460 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(206), + B(Star), R(0), /* 1469 S> */ B(Nop), - /* 1474 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(208), R(0), - B(Ldar), R(0), + /* 1474 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(208), + B(Star), R(0), /* 1483 S> */ B(Nop), - /* 1488 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(210), R(0), - B(Ldar), R(0), + /* 1488 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(210), + B(Star), R(0), /* 1497 S> */ B(Nop), - /* 1502 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(212), R(0), - B(Ldar), R(0), + /* 1502 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(212), + B(Star), R(0), /* 1511 S> */ B(Nop), - /* 1516 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(214), R(0), - B(Ldar), R(0), + /* 1516 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(214), + B(Star), R(0), /* 1525 S> */ B(Nop), - /* 1530 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(216), R(0), - B(Ldar), R(0), + /* 1530 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(216), + B(Star), R(0), /* 1539 S> */ B(Nop), - /* 1544 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(218), R(0), - B(Ldar), R(0), + /* 1544 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(218), + B(Star), R(0), /* 1553 S> */ B(Nop), - /* 1558 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(220), R(0), - B(Ldar), R(0), + /* 1558 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(220), + B(Star), R(0), /* 1567 S> */ B(Nop), - /* 1572 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(222), R(0), - B(Ldar), R(0), + /* 1572 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(222), + B(Star), R(0), /* 1581 S> */ B(Nop), - /* 1586 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(224), R(0), - B(Ldar), R(0), + /* 1586 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(224), + B(Star), R(0), /* 1595 S> */ B(Nop), - /* 1600 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(226), R(0), - B(Ldar), R(0), + /* 1600 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(226), + B(Star), R(0), /* 1609 S> */ B(Nop), - /* 1614 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(228), R(0), - B(Ldar), R(0), + /* 1614 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(228), + B(Star), R(0), /* 1623 S> */ B(Nop), - /* 1628 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(230), R(0), - B(Ldar), R(0), + /* 1628 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(230), + B(Star), R(0), /* 1637 S> */ B(Nop), - /* 1642 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(232), R(0), - B(Ldar), R(0), + /* 1642 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(232), + B(Star), R(0), /* 1651 S> */ B(Nop), - /* 1656 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(234), R(0), - B(Ldar), R(0), + /* 1656 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(234), + B(Star), R(0), /* 1665 S> */ B(Nop), - /* 1670 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(236), R(0), - B(Ldar), R(0), + /* 1670 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(236), + B(Star), R(0), /* 1679 S> */ B(Nop), - /* 1684 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(238), R(0), - B(Ldar), R(0), + /* 1684 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(238), + B(Star), R(0), /* 1693 S> */ B(Nop), - /* 1698 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(240), R(0), - B(Ldar), R(0), + /* 1698 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(240), + B(Star), R(0), /* 1707 S> */ B(Nop), - /* 1712 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(242), R(0), - B(Ldar), R(0), + /* 1712 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(242), + B(Star), R(0), /* 1721 S> */ B(Nop), - /* 1726 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(244), R(0), - B(Ldar), R(0), + /* 1726 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(244), + B(Star), R(0), /* 1735 S> */ B(Nop), - /* 1740 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(246), R(0), - B(Ldar), R(0), + /* 1740 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(246), + B(Star), R(0), /* 1749 S> */ B(Nop), - /* 1754 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(248), R(0), - B(Ldar), R(0), + /* 1754 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(248), + B(Star), R(0), /* 1763 S> */ B(Nop), - /* 1768 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(250), R(0), - B(Ldar), R(0), + /* 1768 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(250), + B(Star), R(0), /* 1777 S> */ B(Nop), - /* 1782 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(252), R(0), - B(Ldar), R(0), + /* 1782 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(252), + B(Star), R(0), /* 1791 S> */ B(Nop), - /* 1796 E> */ B(LdrNamedProperty), R(arg0), U8(0), U8(254), R(0), - B(Ldar), R(0), + /* 1796 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(254), + B(Star), R(0), /* 1805 S> */ B(Nop), - /* 1810 E> */ B(Wide), B(LdrNamedProperty), R16(arg0), U16(0), U16(256), R16(0), - B(Ldar), R(0), + /* 1810 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(256), + B(Star), R(0), /* 1819 S> */ B(Nop), /* 1827 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(258), /* 1834 S> */ B(Return), @@ -780,393 +780,393 @@ snippet: " " frame size: 1 parameter count: 3 -bytecode array length: 1038 +bytecode array length: 909 bytecodes: [ /* 10 E> */ B(StackCheck), /* 30 S> */ B(Ldar), R(arg1), - /* 36 E> */ B(LdrKeyedProperty), R(arg0), U8(2), R(0), - B(Ldar), R(0), + /* 36 E> */ B(LdaKeyedProperty), R(arg0), U8(2), + B(Star), R(0), /* 42 S> */ B(Ldar), R(arg1), - /* 48 E> */ B(LdrKeyedProperty), R(arg0), U8(4), R(0), - B(Ldar), R(0), + /* 48 E> */ B(LdaKeyedProperty), R(arg0), U8(4), + B(Star), R(0), /* 54 S> */ B(Ldar), R(arg1), - /* 60 E> */ B(LdrKeyedProperty), R(arg0), U8(6), R(0), - B(Ldar), R(0), + /* 60 E> */ B(LdaKeyedProperty), R(arg0), U8(6), + B(Star), R(0), /* 66 S> */ B(Ldar), R(arg1), - /* 72 E> */ B(LdrKeyedProperty), R(arg0), U8(8), R(0), - B(Ldar), R(0), + /* 72 E> */ B(LdaKeyedProperty), R(arg0), U8(8), + B(Star), R(0), /* 78 S> */ B(Ldar), R(arg1), - /* 84 E> */ B(LdrKeyedProperty), R(arg0), U8(10), R(0), - B(Ldar), R(0), + /* 84 E> */ B(LdaKeyedProperty), R(arg0), U8(10), + B(Star), R(0), /* 90 S> */ B(Ldar), R(arg1), - /* 96 E> */ B(LdrKeyedProperty), R(arg0), U8(12), R(0), - B(Ldar), R(0), + /* 96 E> */ B(LdaKeyedProperty), R(arg0), U8(12), + B(Star), R(0), /* 102 S> */ B(Ldar), R(arg1), - /* 108 E> */ B(LdrKeyedProperty), R(arg0), U8(14), R(0), - B(Ldar), R(0), + /* 108 E> */ B(LdaKeyedProperty), R(arg0), U8(14), + B(Star), R(0), /* 114 S> */ B(Ldar), R(arg1), - /* 120 E> */ B(LdrKeyedProperty), R(arg0), U8(16), R(0), - B(Ldar), R(0), + /* 120 E> */ B(LdaKeyedProperty), R(arg0), U8(16), + B(Star), R(0), /* 126 S> */ B(Ldar), R(arg1), - /* 132 E> */ B(LdrKeyedProperty), R(arg0), U8(18), R(0), - B(Ldar), R(0), + /* 132 E> */ B(LdaKeyedProperty), R(arg0), U8(18), + B(Star), R(0), /* 138 S> */ B(Ldar), R(arg1), - /* 144 E> */ B(LdrKeyedProperty), R(arg0), U8(20), R(0), - B(Ldar), R(0), + /* 144 E> */ B(LdaKeyedProperty), R(arg0), U8(20), + B(Star), R(0), /* 150 S> */ B(Ldar), R(arg1), - /* 156 E> */ B(LdrKeyedProperty), R(arg0), U8(22), R(0), - B(Ldar), R(0), + /* 156 E> */ B(LdaKeyedProperty), R(arg0), U8(22), + B(Star), R(0), /* 162 S> */ B(Ldar), R(arg1), - /* 168 E> */ B(LdrKeyedProperty), R(arg0), U8(24), R(0), - B(Ldar), R(0), + /* 168 E> */ B(LdaKeyedProperty), R(arg0), U8(24), + B(Star), R(0), /* 174 S> */ B(Ldar), R(arg1), - /* 180 E> */ B(LdrKeyedProperty), R(arg0), U8(26), R(0), - B(Ldar), R(0), + /* 180 E> */ B(LdaKeyedProperty), R(arg0), U8(26), + B(Star), R(0), /* 186 S> */ B(Ldar), R(arg1), - /* 192 E> */ B(LdrKeyedProperty), R(arg0), U8(28), R(0), - B(Ldar), R(0), + /* 192 E> */ B(LdaKeyedProperty), R(arg0), U8(28), + B(Star), R(0), /* 198 S> */ B(Ldar), R(arg1), - /* 204 E> */ B(LdrKeyedProperty), R(arg0), U8(30), R(0), - B(Ldar), R(0), + /* 204 E> */ B(LdaKeyedProperty), R(arg0), U8(30), + B(Star), R(0), /* 210 S> */ B(Ldar), R(arg1), - /* 216 E> */ B(LdrKeyedProperty), R(arg0), U8(32), R(0), - B(Ldar), R(0), + /* 216 E> */ B(LdaKeyedProperty), R(arg0), U8(32), + B(Star), R(0), /* 222 S> */ B(Ldar), R(arg1), - /* 228 E> */ B(LdrKeyedProperty), R(arg0), U8(34), R(0), - B(Ldar), R(0), + /* 228 E> */ B(LdaKeyedProperty), R(arg0), U8(34), + B(Star), R(0), /* 234 S> */ B(Ldar), R(arg1), - /* 240 E> */ B(LdrKeyedProperty), R(arg0), U8(36), R(0), - B(Ldar), R(0), + /* 240 E> */ B(LdaKeyedProperty), R(arg0), U8(36), + B(Star), R(0), /* 246 S> */ B(Ldar), R(arg1), - /* 252 E> */ B(LdrKeyedProperty), R(arg0), U8(38), R(0), - B(Ldar), R(0), + /* 252 E> */ B(LdaKeyedProperty), R(arg0), U8(38), + B(Star), R(0), /* 258 S> */ B(Ldar), R(arg1), - /* 264 E> */ B(LdrKeyedProperty), R(arg0), U8(40), R(0), - B(Ldar), R(0), + /* 264 E> */ B(LdaKeyedProperty), R(arg0), U8(40), + B(Star), R(0), /* 270 S> */ B(Ldar), R(arg1), - /* 276 E> */ B(LdrKeyedProperty), R(arg0), U8(42), R(0), - B(Ldar), R(0), + /* 276 E> */ B(LdaKeyedProperty), R(arg0), U8(42), + B(Star), R(0), /* 282 S> */ B(Ldar), R(arg1), - /* 288 E> */ B(LdrKeyedProperty), R(arg0), U8(44), R(0), - B(Ldar), R(0), + /* 288 E> */ B(LdaKeyedProperty), R(arg0), U8(44), + B(Star), R(0), /* 294 S> */ B(Ldar), R(arg1), - /* 300 E> */ B(LdrKeyedProperty), R(arg0), U8(46), R(0), - B(Ldar), R(0), + /* 300 E> */ B(LdaKeyedProperty), R(arg0), U8(46), + B(Star), R(0), /* 306 S> */ B(Ldar), R(arg1), - /* 312 E> */ B(LdrKeyedProperty), R(arg0), U8(48), R(0), - B(Ldar), R(0), + /* 312 E> */ B(LdaKeyedProperty), R(arg0), U8(48), + B(Star), R(0), /* 318 S> */ B(Ldar), R(arg1), - /* 324 E> */ B(LdrKeyedProperty), R(arg0), U8(50), R(0), - B(Ldar), R(0), + /* 324 E> */ B(LdaKeyedProperty), R(arg0), U8(50), + B(Star), R(0), /* 330 S> */ B(Ldar), R(arg1), - /* 336 E> */ B(LdrKeyedProperty), R(arg0), U8(52), R(0), - B(Ldar), R(0), + /* 336 E> */ B(LdaKeyedProperty), R(arg0), U8(52), + B(Star), R(0), /* 342 S> */ B(Ldar), R(arg1), - /* 348 E> */ B(LdrKeyedProperty), R(arg0), U8(54), R(0), - B(Ldar), R(0), + /* 348 E> */ B(LdaKeyedProperty), R(arg0), U8(54), + B(Star), R(0), /* 354 S> */ B(Ldar), R(arg1), - /* 360 E> */ B(LdrKeyedProperty), R(arg0), U8(56), R(0), - B(Ldar), R(0), + /* 360 E> */ B(LdaKeyedProperty), R(arg0), U8(56), + B(Star), R(0), /* 366 S> */ B(Ldar), R(arg1), - /* 372 E> */ B(LdrKeyedProperty), R(arg0), U8(58), R(0), - B(Ldar), R(0), + /* 372 E> */ B(LdaKeyedProperty), R(arg0), U8(58), + B(Star), R(0), /* 378 S> */ B(Ldar), R(arg1), - /* 384 E> */ B(LdrKeyedProperty), R(arg0), U8(60), R(0), - B(Ldar), R(0), + /* 384 E> */ B(LdaKeyedProperty), R(arg0), U8(60), + B(Star), R(0), /* 390 S> */ B(Ldar), R(arg1), - /* 396 E> */ B(LdrKeyedProperty), R(arg0), U8(62), R(0), - B(Ldar), R(0), + /* 396 E> */ B(LdaKeyedProperty), R(arg0), U8(62), + B(Star), R(0), /* 402 S> */ B(Ldar), R(arg1), - /* 408 E> */ B(LdrKeyedProperty), R(arg0), U8(64), R(0), - B(Ldar), R(0), + /* 408 E> */ B(LdaKeyedProperty), R(arg0), U8(64), + B(Star), R(0), /* 414 S> */ B(Ldar), R(arg1), - /* 420 E> */ B(LdrKeyedProperty), R(arg0), U8(66), R(0), - B(Ldar), R(0), + /* 420 E> */ B(LdaKeyedProperty), R(arg0), U8(66), + B(Star), R(0), /* 426 S> */ B(Ldar), R(arg1), - /* 432 E> */ B(LdrKeyedProperty), R(arg0), U8(68), R(0), - B(Ldar), R(0), + /* 432 E> */ B(LdaKeyedProperty), R(arg0), U8(68), + B(Star), R(0), /* 438 S> */ B(Ldar), R(arg1), - /* 444 E> */ B(LdrKeyedProperty), R(arg0), U8(70), R(0), - B(Ldar), R(0), + /* 444 E> */ B(LdaKeyedProperty), R(arg0), U8(70), + B(Star), R(0), /* 450 S> */ B(Ldar), R(arg1), - /* 456 E> */ B(LdrKeyedProperty), R(arg0), U8(72), R(0), - B(Ldar), R(0), + /* 456 E> */ B(LdaKeyedProperty), R(arg0), U8(72), + B(Star), R(0), /* 462 S> */ B(Ldar), R(arg1), - /* 468 E> */ B(LdrKeyedProperty), R(arg0), U8(74), R(0), - B(Ldar), R(0), + /* 468 E> */ B(LdaKeyedProperty), R(arg0), U8(74), + B(Star), R(0), /* 474 S> */ B(Ldar), R(arg1), - /* 480 E> */ B(LdrKeyedProperty), R(arg0), U8(76), R(0), - B(Ldar), R(0), + /* 480 E> */ B(LdaKeyedProperty), R(arg0), U8(76), + B(Star), R(0), /* 486 S> */ B(Ldar), R(arg1), - /* 492 E> */ B(LdrKeyedProperty), R(arg0), U8(78), R(0), - B(Ldar), R(0), + /* 492 E> */ B(LdaKeyedProperty), R(arg0), U8(78), + B(Star), R(0), /* 498 S> */ B(Ldar), R(arg1), - /* 504 E> */ B(LdrKeyedProperty), R(arg0), U8(80), R(0), - B(Ldar), R(0), + /* 504 E> */ B(LdaKeyedProperty), R(arg0), U8(80), + B(Star), R(0), /* 510 S> */ B(Ldar), R(arg1), - /* 516 E> */ B(LdrKeyedProperty), R(arg0), U8(82), R(0), - B(Ldar), R(0), + /* 516 E> */ B(LdaKeyedProperty), R(arg0), U8(82), + B(Star), R(0), /* 522 S> */ B(Ldar), R(arg1), - /* 528 E> */ B(LdrKeyedProperty), R(arg0), U8(84), R(0), - B(Ldar), R(0), + /* 528 E> */ B(LdaKeyedProperty), R(arg0), U8(84), + B(Star), R(0), /* 534 S> */ B(Ldar), R(arg1), - /* 540 E> */ B(LdrKeyedProperty), R(arg0), U8(86), R(0), - B(Ldar), R(0), + /* 540 E> */ B(LdaKeyedProperty), R(arg0), U8(86), + B(Star), R(0), /* 546 S> */ B(Ldar), R(arg1), - /* 552 E> */ B(LdrKeyedProperty), R(arg0), U8(88), R(0), - B(Ldar), R(0), + /* 552 E> */ B(LdaKeyedProperty), R(arg0), U8(88), + B(Star), R(0), /* 558 S> */ B(Ldar), R(arg1), - /* 564 E> */ B(LdrKeyedProperty), R(arg0), U8(90), R(0), - B(Ldar), R(0), + /* 564 E> */ B(LdaKeyedProperty), R(arg0), U8(90), + B(Star), R(0), /* 570 S> */ B(Ldar), R(arg1), - /* 576 E> */ B(LdrKeyedProperty), R(arg0), U8(92), R(0), - B(Ldar), R(0), + /* 576 E> */ B(LdaKeyedProperty), R(arg0), U8(92), + B(Star), R(0), /* 582 S> */ B(Ldar), R(arg1), - /* 588 E> */ B(LdrKeyedProperty), R(arg0), U8(94), R(0), - B(Ldar), R(0), + /* 588 E> */ B(LdaKeyedProperty), R(arg0), U8(94), + B(Star), R(0), /* 594 S> */ B(Ldar), R(arg1), - /* 600 E> */ B(LdrKeyedProperty), R(arg0), U8(96), R(0), - B(Ldar), R(0), + /* 600 E> */ B(LdaKeyedProperty), R(arg0), U8(96), + B(Star), R(0), /* 606 S> */ B(Ldar), R(arg1), - /* 612 E> */ B(LdrKeyedProperty), R(arg0), U8(98), R(0), - B(Ldar), R(0), + /* 612 E> */ B(LdaKeyedProperty), R(arg0), U8(98), + B(Star), R(0), /* 618 S> */ B(Ldar), R(arg1), - /* 624 E> */ B(LdrKeyedProperty), R(arg0), U8(100), R(0), - B(Ldar), R(0), + /* 624 E> */ B(LdaKeyedProperty), R(arg0), U8(100), + B(Star), R(0), /* 630 S> */ B(Ldar), R(arg1), - /* 636 E> */ B(LdrKeyedProperty), R(arg0), U8(102), R(0), - B(Ldar), R(0), + /* 636 E> */ B(LdaKeyedProperty), R(arg0), U8(102), + B(Star), R(0), /* 642 S> */ B(Ldar), R(arg1), - /* 648 E> */ B(LdrKeyedProperty), R(arg0), U8(104), R(0), - B(Ldar), R(0), + /* 648 E> */ B(LdaKeyedProperty), R(arg0), U8(104), + B(Star), R(0), /* 654 S> */ B(Ldar), R(arg1), - /* 660 E> */ B(LdrKeyedProperty), R(arg0), U8(106), R(0), - B(Ldar), R(0), + /* 660 E> */ B(LdaKeyedProperty), R(arg0), U8(106), + B(Star), R(0), /* 666 S> */ B(Ldar), R(arg1), - /* 672 E> */ B(LdrKeyedProperty), R(arg0), U8(108), R(0), - B(Ldar), R(0), + /* 672 E> */ B(LdaKeyedProperty), R(arg0), U8(108), + B(Star), R(0), /* 678 S> */ B(Ldar), R(arg1), - /* 684 E> */ B(LdrKeyedProperty), R(arg0), U8(110), R(0), - B(Ldar), R(0), + /* 684 E> */ B(LdaKeyedProperty), R(arg0), U8(110), + B(Star), R(0), /* 690 S> */ B(Ldar), R(arg1), - /* 696 E> */ B(LdrKeyedProperty), R(arg0), U8(112), R(0), - B(Ldar), R(0), + /* 696 E> */ B(LdaKeyedProperty), R(arg0), U8(112), + B(Star), R(0), /* 702 S> */ B(Ldar), R(arg1), - /* 708 E> */ B(LdrKeyedProperty), R(arg0), U8(114), R(0), - B(Ldar), R(0), + /* 708 E> */ B(LdaKeyedProperty), R(arg0), U8(114), + B(Star), R(0), /* 714 S> */ B(Ldar), R(arg1), - /* 720 E> */ B(LdrKeyedProperty), R(arg0), U8(116), R(0), - B(Ldar), R(0), + /* 720 E> */ B(LdaKeyedProperty), R(arg0), U8(116), + B(Star), R(0), /* 726 S> */ B(Ldar), R(arg1), - /* 732 E> */ B(LdrKeyedProperty), R(arg0), U8(118), R(0), - B(Ldar), R(0), + /* 732 E> */ B(LdaKeyedProperty), R(arg0), U8(118), + B(Star), R(0), /* 738 S> */ B(Ldar), R(arg1), - /* 744 E> */ B(LdrKeyedProperty), R(arg0), U8(120), R(0), - B(Ldar), R(0), + /* 744 E> */ B(LdaKeyedProperty), R(arg0), U8(120), + B(Star), R(0), /* 750 S> */ B(Ldar), R(arg1), - /* 756 E> */ B(LdrKeyedProperty), R(arg0), U8(122), R(0), - B(Ldar), R(0), + /* 756 E> */ B(LdaKeyedProperty), R(arg0), U8(122), + B(Star), R(0), /* 762 S> */ B(Ldar), R(arg1), - /* 768 E> */ B(LdrKeyedProperty), R(arg0), U8(124), R(0), - B(Ldar), R(0), + /* 768 E> */ B(LdaKeyedProperty), R(arg0), U8(124), + B(Star), R(0), /* 774 S> */ B(Ldar), R(arg1), - /* 780 E> */ B(LdrKeyedProperty), R(arg0), U8(126), R(0), - B(Ldar), R(0), + /* 780 E> */ B(LdaKeyedProperty), R(arg0), U8(126), + B(Star), R(0), /* 786 S> */ B(Ldar), R(arg1), - /* 792 E> */ B(LdrKeyedProperty), R(arg0), U8(128), R(0), - B(Ldar), R(0), + /* 792 E> */ B(LdaKeyedProperty), R(arg0), U8(128), + B(Star), R(0), /* 798 S> */ B(Ldar), R(arg1), - /* 804 E> */ B(LdrKeyedProperty), R(arg0), U8(130), R(0), - B(Ldar), R(0), + /* 804 E> */ B(LdaKeyedProperty), R(arg0), U8(130), + B(Star), R(0), /* 810 S> */ B(Ldar), R(arg1), - /* 816 E> */ B(LdrKeyedProperty), R(arg0), U8(132), R(0), - B(Ldar), R(0), + /* 816 E> */ B(LdaKeyedProperty), R(arg0), U8(132), + B(Star), R(0), /* 822 S> */ B(Ldar), R(arg1), - /* 828 E> */ B(LdrKeyedProperty), R(arg0), U8(134), R(0), - B(Ldar), R(0), + /* 828 E> */ B(LdaKeyedProperty), R(arg0), U8(134), + B(Star), R(0), /* 834 S> */ B(Ldar), R(arg1), - /* 840 E> */ B(LdrKeyedProperty), R(arg0), U8(136), R(0), - B(Ldar), R(0), + /* 840 E> */ B(LdaKeyedProperty), R(arg0), U8(136), + B(Star), R(0), /* 846 S> */ B(Ldar), R(arg1), - /* 852 E> */ B(LdrKeyedProperty), R(arg0), U8(138), R(0), - B(Ldar), R(0), + /* 852 E> */ B(LdaKeyedProperty), R(arg0), U8(138), + B(Star), R(0), /* 858 S> */ B(Ldar), R(arg1), - /* 864 E> */ B(LdrKeyedProperty), R(arg0), U8(140), R(0), - B(Ldar), R(0), + /* 864 E> */ B(LdaKeyedProperty), R(arg0), U8(140), + B(Star), R(0), /* 870 S> */ B(Ldar), R(arg1), - /* 876 E> */ B(LdrKeyedProperty), R(arg0), U8(142), R(0), - B(Ldar), R(0), + /* 876 E> */ B(LdaKeyedProperty), R(arg0), U8(142), + B(Star), R(0), /* 882 S> */ B(Ldar), R(arg1), - /* 888 E> */ B(LdrKeyedProperty), R(arg0), U8(144), R(0), - B(Ldar), R(0), + /* 888 E> */ B(LdaKeyedProperty), R(arg0), U8(144), + B(Star), R(0), /* 894 S> */ B(Ldar), R(arg1), - /* 900 E> */ B(LdrKeyedProperty), R(arg0), U8(146), R(0), - B(Ldar), R(0), + /* 900 E> */ B(LdaKeyedProperty), R(arg0), U8(146), + B(Star), R(0), /* 906 S> */ B(Ldar), R(arg1), - /* 912 E> */ B(LdrKeyedProperty), R(arg0), U8(148), R(0), - B(Ldar), R(0), + /* 912 E> */ B(LdaKeyedProperty), R(arg0), U8(148), + B(Star), R(0), /* 918 S> */ B(Ldar), R(arg1), - /* 924 E> */ B(LdrKeyedProperty), R(arg0), U8(150), R(0), - B(Ldar), R(0), + /* 924 E> */ B(LdaKeyedProperty), R(arg0), U8(150), + B(Star), R(0), /* 930 S> */ B(Ldar), R(arg1), - /* 936 E> */ B(LdrKeyedProperty), R(arg0), U8(152), R(0), - B(Ldar), R(0), + /* 936 E> */ B(LdaKeyedProperty), R(arg0), U8(152), + B(Star), R(0), /* 942 S> */ B(Ldar), R(arg1), - /* 948 E> */ B(LdrKeyedProperty), R(arg0), U8(154), R(0), - B(Ldar), R(0), + /* 948 E> */ B(LdaKeyedProperty), R(arg0), U8(154), + B(Star), R(0), /* 954 S> */ B(Ldar), R(arg1), - /* 960 E> */ B(LdrKeyedProperty), R(arg0), U8(156), R(0), - B(Ldar), R(0), + /* 960 E> */ B(LdaKeyedProperty), R(arg0), U8(156), + B(Star), R(0), /* 966 S> */ B(Ldar), R(arg1), - /* 972 E> */ B(LdrKeyedProperty), R(arg0), U8(158), R(0), - B(Ldar), R(0), + /* 972 E> */ B(LdaKeyedProperty), R(arg0), U8(158), + B(Star), R(0), /* 978 S> */ B(Ldar), R(arg1), - /* 984 E> */ B(LdrKeyedProperty), R(arg0), U8(160), R(0), - B(Ldar), R(0), + /* 984 E> */ B(LdaKeyedProperty), R(arg0), U8(160), + B(Star), R(0), /* 990 S> */ B(Ldar), R(arg1), - /* 996 E> */ B(LdrKeyedProperty), R(arg0), U8(162), R(0), - B(Ldar), R(0), + /* 996 E> */ B(LdaKeyedProperty), R(arg0), U8(162), + B(Star), R(0), /* 1002 S> */ B(Ldar), R(arg1), - /* 1008 E> */ B(LdrKeyedProperty), R(arg0), U8(164), R(0), - B(Ldar), R(0), + /* 1008 E> */ B(LdaKeyedProperty), R(arg0), U8(164), + B(Star), R(0), /* 1014 S> */ B(Ldar), R(arg1), - /* 1020 E> */ B(LdrKeyedProperty), R(arg0), U8(166), R(0), - B(Ldar), R(0), + /* 1020 E> */ B(LdaKeyedProperty), R(arg0), U8(166), + B(Star), R(0), /* 1026 S> */ B(Ldar), R(arg1), - /* 1032 E> */ B(LdrKeyedProperty), R(arg0), U8(168), R(0), - B(Ldar), R(0), + /* 1032 E> */ B(LdaKeyedProperty), R(arg0), U8(168), + B(Star), R(0), /* 1038 S> */ B(Ldar), R(arg1), - /* 1044 E> */ B(LdrKeyedProperty), R(arg0), U8(170), R(0), - B(Ldar), R(0), + /* 1044 E> */ B(LdaKeyedProperty), R(arg0), U8(170), + B(Star), R(0), /* 1050 S> */ B(Ldar), R(arg1), - /* 1056 E> */ B(LdrKeyedProperty), R(arg0), U8(172), R(0), - B(Ldar), R(0), + /* 1056 E> */ B(LdaKeyedProperty), R(arg0), U8(172), + B(Star), R(0), /* 1062 S> */ B(Ldar), R(arg1), - /* 1068 E> */ B(LdrKeyedProperty), R(arg0), U8(174), R(0), - B(Ldar), R(0), + /* 1068 E> */ B(LdaKeyedProperty), R(arg0), U8(174), + B(Star), R(0), /* 1074 S> */ B(Ldar), R(arg1), - /* 1080 E> */ B(LdrKeyedProperty), R(arg0), U8(176), R(0), - B(Ldar), R(0), + /* 1080 E> */ B(LdaKeyedProperty), R(arg0), U8(176), + B(Star), R(0), /* 1086 S> */ B(Ldar), R(arg1), - /* 1092 E> */ B(LdrKeyedProperty), R(arg0), U8(178), R(0), - B(Ldar), R(0), + /* 1092 E> */ B(LdaKeyedProperty), R(arg0), U8(178), + B(Star), R(0), /* 1098 S> */ B(Ldar), R(arg1), - /* 1104 E> */ B(LdrKeyedProperty), R(arg0), U8(180), R(0), - B(Ldar), R(0), + /* 1104 E> */ B(LdaKeyedProperty), R(arg0), U8(180), + B(Star), R(0), /* 1110 S> */ B(Ldar), R(arg1), - /* 1116 E> */ B(LdrKeyedProperty), R(arg0), U8(182), R(0), - B(Ldar), R(0), + /* 1116 E> */ B(LdaKeyedProperty), R(arg0), U8(182), + B(Star), R(0), /* 1122 S> */ B(Ldar), R(arg1), - /* 1128 E> */ B(LdrKeyedProperty), R(arg0), U8(184), R(0), - B(Ldar), R(0), + /* 1128 E> */ B(LdaKeyedProperty), R(arg0), U8(184), + B(Star), R(0), /* 1134 S> */ B(Ldar), R(arg1), - /* 1140 E> */ B(LdrKeyedProperty), R(arg0), U8(186), R(0), - B(Ldar), R(0), + /* 1140 E> */ B(LdaKeyedProperty), R(arg0), U8(186), + B(Star), R(0), /* 1146 S> */ B(Ldar), R(arg1), - /* 1152 E> */ B(LdrKeyedProperty), R(arg0), U8(188), R(0), - B(Ldar), R(0), + /* 1152 E> */ B(LdaKeyedProperty), R(arg0), U8(188), + B(Star), R(0), /* 1158 S> */ B(Ldar), R(arg1), - /* 1164 E> */ B(LdrKeyedProperty), R(arg0), U8(190), R(0), - B(Ldar), R(0), + /* 1164 E> */ B(LdaKeyedProperty), R(arg0), U8(190), + B(Star), R(0), /* 1170 S> */ B(Ldar), R(arg1), - /* 1176 E> */ B(LdrKeyedProperty), R(arg0), U8(192), R(0), - B(Ldar), R(0), + /* 1176 E> */ B(LdaKeyedProperty), R(arg0), U8(192), + B(Star), R(0), /* 1182 S> */ B(Ldar), R(arg1), - /* 1188 E> */ B(LdrKeyedProperty), R(arg0), U8(194), R(0), - B(Ldar), R(0), + /* 1188 E> */ B(LdaKeyedProperty), R(arg0), U8(194), + B(Star), R(0), /* 1194 S> */ B(Ldar), R(arg1), - /* 1200 E> */ B(LdrKeyedProperty), R(arg0), U8(196), R(0), - B(Ldar), R(0), + /* 1200 E> */ B(LdaKeyedProperty), R(arg0), U8(196), + B(Star), R(0), /* 1206 S> */ B(Ldar), R(arg1), - /* 1212 E> */ B(LdrKeyedProperty), R(arg0), U8(198), R(0), - B(Ldar), R(0), + /* 1212 E> */ B(LdaKeyedProperty), R(arg0), U8(198), + B(Star), R(0), /* 1218 S> */ B(Ldar), R(arg1), - /* 1224 E> */ B(LdrKeyedProperty), R(arg0), U8(200), R(0), - B(Ldar), R(0), + /* 1224 E> */ B(LdaKeyedProperty), R(arg0), U8(200), + B(Star), R(0), /* 1230 S> */ B(Ldar), R(arg1), - /* 1236 E> */ B(LdrKeyedProperty), R(arg0), U8(202), R(0), - B(Ldar), R(0), + /* 1236 E> */ B(LdaKeyedProperty), R(arg0), U8(202), + B(Star), R(0), /* 1242 S> */ B(Ldar), R(arg1), - /* 1248 E> */ B(LdrKeyedProperty), R(arg0), U8(204), R(0), - B(Ldar), R(0), + /* 1248 E> */ B(LdaKeyedProperty), R(arg0), U8(204), + B(Star), R(0), /* 1254 S> */ B(Ldar), R(arg1), - /* 1260 E> */ B(LdrKeyedProperty), R(arg0), U8(206), R(0), - B(Ldar), R(0), + /* 1260 E> */ B(LdaKeyedProperty), R(arg0), U8(206), + B(Star), R(0), /* 1266 S> */ B(Ldar), R(arg1), - /* 1272 E> */ B(LdrKeyedProperty), R(arg0), U8(208), R(0), - B(Ldar), R(0), + /* 1272 E> */ B(LdaKeyedProperty), R(arg0), U8(208), + B(Star), R(0), /* 1278 S> */ B(Ldar), R(arg1), - /* 1284 E> */ B(LdrKeyedProperty), R(arg0), U8(210), R(0), - B(Ldar), R(0), + /* 1284 E> */ B(LdaKeyedProperty), R(arg0), U8(210), + B(Star), R(0), /* 1290 S> */ B(Ldar), R(arg1), - /* 1296 E> */ B(LdrKeyedProperty), R(arg0), U8(212), R(0), - B(Ldar), R(0), + /* 1296 E> */ B(LdaKeyedProperty), R(arg0), U8(212), + B(Star), R(0), /* 1302 S> */ B(Ldar), R(arg1), - /* 1308 E> */ B(LdrKeyedProperty), R(arg0), U8(214), R(0), - B(Ldar), R(0), + /* 1308 E> */ B(LdaKeyedProperty), R(arg0), U8(214), + B(Star), R(0), /* 1314 S> */ B(Ldar), R(arg1), - /* 1320 E> */ B(LdrKeyedProperty), R(arg0), U8(216), R(0), - B(Ldar), R(0), + /* 1320 E> */ B(LdaKeyedProperty), R(arg0), U8(216), + B(Star), R(0), /* 1326 S> */ B(Ldar), R(arg1), - /* 1332 E> */ B(LdrKeyedProperty), R(arg0), U8(218), R(0), - B(Ldar), R(0), + /* 1332 E> */ B(LdaKeyedProperty), R(arg0), U8(218), + B(Star), R(0), /* 1338 S> */ B(Ldar), R(arg1), - /* 1344 E> */ B(LdrKeyedProperty), R(arg0), U8(220), R(0), - B(Ldar), R(0), + /* 1344 E> */ B(LdaKeyedProperty), R(arg0), U8(220), + B(Star), R(0), /* 1350 S> */ B(Ldar), R(arg1), - /* 1356 E> */ B(LdrKeyedProperty), R(arg0), U8(222), R(0), - B(Ldar), R(0), + /* 1356 E> */ B(LdaKeyedProperty), R(arg0), U8(222), + B(Star), R(0), /* 1362 S> */ B(Ldar), R(arg1), - /* 1368 E> */ B(LdrKeyedProperty), R(arg0), U8(224), R(0), - B(Ldar), R(0), + /* 1368 E> */ B(LdaKeyedProperty), R(arg0), U8(224), + B(Star), R(0), /* 1374 S> */ B(Ldar), R(arg1), - /* 1380 E> */ B(LdrKeyedProperty), R(arg0), U8(226), R(0), - B(Ldar), R(0), + /* 1380 E> */ B(LdaKeyedProperty), R(arg0), U8(226), + B(Star), R(0), /* 1386 S> */ B(Ldar), R(arg1), - /* 1392 E> */ B(LdrKeyedProperty), R(arg0), U8(228), R(0), - B(Ldar), R(0), + /* 1392 E> */ B(LdaKeyedProperty), R(arg0), U8(228), + B(Star), R(0), /* 1398 S> */ B(Ldar), R(arg1), - /* 1404 E> */ B(LdrKeyedProperty), R(arg0), U8(230), R(0), - B(Ldar), R(0), + /* 1404 E> */ B(LdaKeyedProperty), R(arg0), U8(230), + B(Star), R(0), /* 1410 S> */ B(Ldar), R(arg1), - /* 1416 E> */ B(LdrKeyedProperty), R(arg0), U8(232), R(0), - B(Ldar), R(0), + /* 1416 E> */ B(LdaKeyedProperty), R(arg0), U8(232), + B(Star), R(0), /* 1422 S> */ B(Ldar), R(arg1), - /* 1428 E> */ B(LdrKeyedProperty), R(arg0), U8(234), R(0), - B(Ldar), R(0), + /* 1428 E> */ B(LdaKeyedProperty), R(arg0), U8(234), + B(Star), R(0), /* 1434 S> */ B(Ldar), R(arg1), - /* 1440 E> */ B(LdrKeyedProperty), R(arg0), U8(236), R(0), - B(Ldar), R(0), + /* 1440 E> */ B(LdaKeyedProperty), R(arg0), U8(236), + B(Star), R(0), /* 1446 S> */ B(Ldar), R(arg1), - /* 1452 E> */ B(LdrKeyedProperty), R(arg0), U8(238), R(0), - B(Ldar), R(0), + /* 1452 E> */ B(LdaKeyedProperty), R(arg0), U8(238), + B(Star), R(0), /* 1458 S> */ B(Ldar), R(arg1), - /* 1464 E> */ B(LdrKeyedProperty), R(arg0), U8(240), R(0), - B(Ldar), R(0), + /* 1464 E> */ B(LdaKeyedProperty), R(arg0), U8(240), + B(Star), R(0), /* 1470 S> */ B(Ldar), R(arg1), - /* 1476 E> */ B(LdrKeyedProperty), R(arg0), U8(242), R(0), - B(Ldar), R(0), + /* 1476 E> */ B(LdaKeyedProperty), R(arg0), U8(242), + B(Star), R(0), /* 1482 S> */ B(Ldar), R(arg1), - /* 1488 E> */ B(LdrKeyedProperty), R(arg0), U8(244), R(0), - B(Ldar), R(0), + /* 1488 E> */ B(LdaKeyedProperty), R(arg0), U8(244), + B(Star), R(0), /* 1494 S> */ B(Ldar), R(arg1), - /* 1500 E> */ B(LdrKeyedProperty), R(arg0), U8(246), R(0), - B(Ldar), R(0), + /* 1500 E> */ B(LdaKeyedProperty), R(arg0), U8(246), + B(Star), R(0), /* 1506 S> */ B(Ldar), R(arg1), - /* 1512 E> */ B(LdrKeyedProperty), R(arg0), U8(248), R(0), - B(Ldar), R(0), + /* 1512 E> */ B(LdaKeyedProperty), R(arg0), U8(248), + B(Star), R(0), /* 1518 S> */ B(Ldar), R(arg1), - /* 1524 E> */ B(LdrKeyedProperty), R(arg0), U8(250), R(0), - B(Ldar), R(0), + /* 1524 E> */ B(LdaKeyedProperty), R(arg0), U8(250), + B(Star), R(0), /* 1530 S> */ B(Ldar), R(arg1), - /* 1536 E> */ B(LdrKeyedProperty), R(arg0), U8(252), R(0), - B(Ldar), R(0), + /* 1536 E> */ B(LdaKeyedProperty), R(arg0), U8(252), + B(Star), R(0), /* 1542 S> */ B(Ldar), R(arg1), - /* 1548 E> */ B(LdrKeyedProperty), R(arg0), U8(254), R(0), - B(Ldar), R(0), + /* 1548 E> */ B(LdaKeyedProperty), R(arg0), U8(254), + B(Star), R(0), /* 1554 S> */ B(Ldar), R(arg1), - /* 1560 E> */ B(Wide), B(LdrKeyedProperty), R16(arg0), U16(256), R16(0), - B(Ldar), R(0), + /* 1560 E> */ B(Wide), B(LdaKeyedProperty), R16(arg0), U16(256), + B(Star), R(0), /* 1566 S> */ B(Ldar), R(arg1), /* 1575 E> */ B(Wide), B(LdaKeyedProperty), R16(arg0), U16(258), /* 1579 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 03973619fd..cdb00db659 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden @@ -47,15 +47,16 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 22 +bytecode array length: 23 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(4), R(0), + /* 47 E> */ B(LdaNamedProperty), R(1), U8(1), U8(4), + B(Star), R(0), B(LdaConstant), U8(2), B(Star), R(2), - /* 48 E> */ B(Call), R(0), R(1), U8(2), U8(2), + /* 48 E> */ B(CallProperty), R(0), R(1), U8(2), U8(2), /* 62 S> */ B(Return), ] constant pool: [ diff --git a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden index 59052b85d8..d7b7917baf 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/TopLevelObjectLiterals.golden @@ -10,9 +10,9 @@ top level: yes snippet: " var a = { func: function() { } }; " -frame size: 5 +frame size: 4 parameter count: 1 -bytecode array length: 45 +bytecode array length: 42 bytecodes: [ B(LdaConstant), U8(0), B(Star), R(1), @@ -24,11 +24,10 @@ bytecodes: [ /* 8 S> */ B(LdaConstant), U8(1), B(Star), R(1), B(LdaZero), - B(CreateObjectLiteral), U8(2), U8(0), U8(1), R(4), + B(CreateObjectLiteral), U8(2), U8(0), U8(1), R(3), B(Star), R(2), B(CreateClosure), U8(3), U8(0), - B(StaNamedPropertySloppy), R(4), U8(4), U8(4), - B(Mov), R(4), R(3), + B(StaNamedPropertySloppy), R(3), U8(4), U8(4), B(CallRuntime), U16(Runtime::kInitializeVarGlobal), R(1), U8(3), B(LdaUndefined), /* 33 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 c9f8790384..660a01b242 100644 --- a/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden +++ b/deps/v8/test/cctest/interpreter/bytecode_expectations/UnaryOperators.golden @@ -96,7 +96,7 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 23 +bytecode array length: 22 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(Wide), B(LdaSmi), U16(1234), @@ -105,8 +105,8 @@ bytecodes: [ /* 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), + B(LdaUndefined), + B(Star), R(1), /* 74 S> */ B(Nop), /* 84 S> */ B(Return), ] diff --git a/deps/v8/test/cctest/interpreter/source-position-matcher.cc b/deps/v8/test/cctest/interpreter/source-position-matcher.cc index 30d545abc3..082ac01ef3 100644 --- a/deps/v8/test/cctest/interpreter/source-position-matcher.cc +++ b/deps/v8/test/cctest/interpreter/source-position-matcher.cc @@ -213,7 +213,8 @@ void SourcePositionMatcher::MoveToNextStatement( if (iterator->is_statement()) { break; } - positions->push_back({iterator->code_offset(), iterator->source_position(), + positions->push_back({iterator->code_offset(), + iterator->source_position().raw(), iterator->is_statement()}); iterator->Advance(); } diff --git a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc index fbcd297dd6..5a20d86297 100644 --- a/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc +++ b/deps/v8/test/cctest/interpreter/test-bytecode-generator.cc @@ -464,6 +464,9 @@ TEST(PropertyCall) { REPEAT_127(" a.func;\n") // " return a.func(); }\n" "f(" FUNC_ARG ")", + + "function f(a) { return a.func(1).func(2).func(3); }\n" + "f(new (function Obj() { this.func = function(a) { return this; }})())", }; CHECK(CompareTexts(BuildActual(printer, snippets), @@ -2238,6 +2241,9 @@ TEST(Modules) { "export {foo as goo} from \"bar\"\n", "export * from \"bar\"\n", + + "import * as foo from \"bar\"\n" + "foo.f(foo, foo.x);\n", }; CHECK(CompareTexts(BuildActual(printer, snippets), diff --git a/deps/v8/test/cctest/interpreter/test-interpreter.cc b/deps/v8/test/cctest/interpreter/test-interpreter.cc index 77c146edaf..f3f4021f88 100644 --- a/deps/v8/test/cctest/interpreter/test-interpreter.cc +++ b/deps/v8/test/cctest/interpreter/test-interpreter.cc @@ -265,7 +265,7 @@ TEST(InterpreterShiftOpsSmi) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); FeedbackVectorSpec feedback_spec(&zone); @@ -304,7 +304,7 @@ TEST(InterpreterBinaryOpsSmi) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); FeedbackVectorSpec feedback_spec(&zone); @@ -345,7 +345,7 @@ TEST(InterpreterBinaryOpsHeapNumber) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 1); FeedbackVectorSpec feedback_spec(&zone); @@ -380,7 +380,7 @@ TEST(InterpreterStringAdd) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); struct TestCase { Handle<Object> lhs; @@ -472,7 +472,7 @@ TEST(InterpreterParameter1) { TEST(InterpreterParameter8) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 8, 0, 0); FeedbackVectorSpec feedback_spec(&zone); @@ -527,7 +527,7 @@ TEST(InterpreterParameter8) { TEST(InterpreterBinaryOpTypeFeedback) { HandleAndZoneScope handles; i::Isolate* isolate = handles.main_isolate(); - i::Zone zone(isolate->allocator()); + i::Zone zone(isolate->allocator(), ZONE_NAME); struct BinaryOpExpectation { Token::Value op; @@ -673,7 +673,7 @@ TEST(InterpreterBinaryOpTypeFeedback) { TEST(InterpreterBinaryOpSmiTypeFeedback) { HandleAndZoneScope handles; i::Isolate* isolate = handles.main_isolate(); - i::Zone zone(isolate->allocator()); + i::Zone zone(isolate->allocator(), ZONE_NAME); struct BinaryOpExpectation { Token::Value op; @@ -708,7 +708,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { isolate->factory()->NewHeapNumber(3.1415 - 2.0), BinaryOperationFeedback::kNumber}, {Token::Value::SUB, isolate->factory()->NewStringFromAsciiChecked("2"), 2, - Handle<Smi>(Smi::FromInt(0), isolate), BinaryOperationFeedback::kAny}, + Handle<Smi>(Smi::kZero, isolate), BinaryOperationFeedback::kAny}, // BIT_OR {Token::Value::BIT_OR, Handle<Smi>(Smi::FromInt(4), isolate), 1, Handle<Smi>(Smi::FromInt(5), isolate), @@ -726,7 +726,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { Handle<Smi>(Smi::FromInt(2), isolate), BinaryOperationFeedback::kNumber}, {Token::Value::BIT_AND, isolate->factory()->NewStringFromAsciiChecked("2"), 1, - Handle<Smi>(Smi::FromInt(0), isolate), BinaryOperationFeedback::kAny}, + Handle<Smi>(Smi::kZero, isolate), BinaryOperationFeedback::kAny}, // SHL {Token::Value::SHL, Handle<Smi>(Smi::FromInt(3), isolate), 1, Handle<Smi>(Smi::FromInt(6), isolate), @@ -741,7 +741,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kSignedSmall}, {Token::Value::SAR, isolate->factory()->NewHeapNumber(3.1415), 2, - Handle<Smi>(Smi::FromInt(0), isolate), BinaryOperationFeedback::kNumber}, + Handle<Smi>(Smi::kZero, isolate), BinaryOperationFeedback::kNumber}, {Token::Value::SAR, isolate->factory()->NewStringFromAsciiChecked("2"), 1, Handle<Smi>(Smi::FromInt(1), isolate), BinaryOperationFeedback::kAny}}; @@ -777,7 +777,7 @@ TEST(InterpreterBinaryOpSmiTypeFeedback) { TEST(InterpreterUnaryOpFeedback) { HandleAndZoneScope handles; i::Isolate* isolate = handles.main_isolate(); - i::Zone zone(isolate->allocator()); + i::Zone zone(isolate->allocator(), ZONE_NAME); Handle<Smi> smi_one = Handle<Smi>(Smi::FromInt(1), isolate); Handle<Smi> smi_max = Handle<Smi>(Smi::FromInt(Smi::kMaxValue), isolate); @@ -854,7 +854,7 @@ TEST(InterpreterUnaryOpFeedback) { TEST(InterpreterBitwiseTypeFeedback) { HandleAndZoneScope handles; i::Isolate* isolate = handles.main_isolate(); - i::Zone zone(isolate->allocator()); + i::Zone zone(isolate->allocator(), ZONE_NAME); const Token::Value kBitwiseBinaryOperators[] = { Token::Value::BIT_OR, Token::Value::BIT_XOR, Token::Value::BIT_AND, Token::Value::SHL, Token::Value::SHR, Token::Value::SAR}; @@ -1030,7 +1030,7 @@ TEST(InterpreterLoadNamedProperty) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); FeedbackVectorSpec feedback_spec(&zone); FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); @@ -1083,7 +1083,7 @@ TEST(InterpreterLoadKeyedProperty) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); FeedbackVectorSpec feedback_spec(&zone); FeedbackVectorSlot slot = feedback_spec.AddKeyedLoadICSlot(); @@ -1125,7 +1125,7 @@ TEST(InterpreterStoreNamedProperty) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); FeedbackVectorSpec feedback_spec(&zone); FeedbackVectorSlot slot = feedback_spec.AddStoreICSlot(); @@ -1184,7 +1184,7 @@ TEST(InterpreterStoreKeyedProperty) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); FeedbackVectorSpec feedback_spec(&zone); FeedbackVectorSlot slot = feedback_spec.AddKeyedStoreICSlot(); @@ -1231,7 +1231,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); FeedbackVectorSpec feedback_spec(&zone); FeedbackVectorSlot slot = feedback_spec.AddLoadICSlot(); @@ -1255,7 +1255,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { .StoreAccumulatorInRegister(reg) .MoveRegister(builder.Parameter(0), args[0]); - builder.Call(reg, args, call_slot_index, tail_call_mode); + builder.Call(reg, args, call_slot_index, Call::GLOBAL_CALL, tail_call_mode); builder.Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -1277,7 +1277,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { builder.LoadNamedProperty(builder.Parameter(0), name, slot_index) .StoreAccumulatorInRegister(reg) .MoveRegister(builder.Parameter(0), args[0]); - builder.Call(reg, args, call_slot_index, tail_call_mode); + builder.Call(reg, args, call_slot_index, Call::GLOBAL_CALL, tail_call_mode); builder.Return(); Handle<BytecodeArray> bytecode_array = builder.ToBytecodeArray(isolate); @@ -1308,7 +1308,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { .LoadLiteral(Smi::FromInt(11)) .StoreAccumulatorInRegister(args[2]); - builder.Call(reg, args, call_slot_index, tail_call_mode); + builder.Call(reg, args, call_slot_index, Call::GLOBAL_CALL, tail_call_mode); builder.Return(); @@ -1356,7 +1356,7 @@ static void TestInterpreterCall(TailCallMode tail_call_mode) { .LoadLiteral(factory->NewStringFromAsciiChecked("j")) .StoreAccumulatorInRegister(args[10]); - builder.Call(reg, args, call_slot_index, tail_call_mode); + builder.Call(reg, args, call_slot_index, Call::GLOBAL_CALL, tail_call_mode); builder.Return(); @@ -1407,7 +1407,7 @@ static BytecodeArrayBuilder& IncrementRegister(BytecodeArrayBuilder& builder, TEST(InterpreterJumps) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); FeedbackVectorSpec feedback_spec(&zone); @@ -1421,7 +1421,7 @@ TEST(InterpreterJumps) { Register reg(0), scratch(1); BytecodeLabel label[3]; - builder.LoadLiteral(Smi::FromInt(0)) + builder.LoadLiteral(Smi::kZero) .StoreAccumulatorInRegister(reg) .Jump(&label[1]); SetRegister(builder, reg, 1024, scratch).Bind(&label[0]); @@ -1446,7 +1446,7 @@ TEST(InterpreterJumps) { TEST(InterpreterConditionalJumps) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); FeedbackVectorSpec feedback_spec(&zone); @@ -1463,7 +1463,7 @@ TEST(InterpreterConditionalJumps) { BytecodeLabel label[2]; BytecodeLabel done, done1; - builder.LoadLiteral(Smi::FromInt(0)) + builder.LoadLiteral(Smi::kZero) .StoreAccumulatorInRegister(reg) .LoadFalse() .JumpIfFalse(&label[0]); @@ -1496,7 +1496,7 @@ TEST(InterpreterConditionalJumps2) { // TODO(oth): Add tests for all conditional jumps near and far. HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 2); FeedbackVectorSpec feedback_spec(&zone); @@ -1513,7 +1513,7 @@ TEST(InterpreterConditionalJumps2) { BytecodeLabel label[2]; BytecodeLabel done, done1; - builder.LoadLiteral(Smi::FromInt(0)) + builder.LoadLiteral(Smi::kZero) .StoreAccumulatorInRegister(reg) .LoadFalse() .JumpIfFalse(&label[0]); @@ -1547,7 +1547,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { Isolate* isolate = handles.main_isolate(); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 1, 0, 257); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); FeedbackVectorSpec feedback_spec(&zone); FeedbackVectorSlot slot = feedback_spec.AddInterpreterBinaryOpICSlot(); @@ -1557,7 +1557,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { Register reg(0), scratch(256); BytecodeLabel done, fake; - builder.LoadLiteral(Smi::FromInt(0)); + builder.LoadLiteral(Smi::kZero); builder.StoreAccumulatorInRegister(reg); // Consume all 8-bit operands for (int i = 1; i <= 256; i++) { @@ -1570,7 +1570,7 @@ TEST(InterpreterJumpConstantWith16BitOperand) { // Emit more than 16-bit immediate operands worth of code to jump over. builder.Bind(&fake); for (int i = 0; i < 6600; i++) { - builder.LoadLiteral(Smi::FromInt(0)); // 1-byte + builder.LoadLiteral(Smi::kZero); // 1-byte builder.BinaryOperation(Token::Value::ADD, scratch, vector->GetIndex(slot)); // 6-bytes builder.StoreAccumulatorInRegister(scratch); // 4-bytes @@ -1607,14 +1607,14 @@ TEST(InterpreterJumpWith32BitOperand) { Register reg(0); BytecodeLabel done; - builder.LoadLiteral(Smi::FromInt(0)); + builder.LoadLiteral(Smi::kZero); builder.StoreAccumulatorInRegister(reg); // Consume all 16-bit constant pool entries for (int i = 1; i <= 65536; i++) { builder.LoadLiteral(isolate->factory()->NewNumber(i)); } builder.Jump(&done); - builder.LoadLiteral(Smi::FromInt(0)); + builder.LoadLiteral(Smi::kZero); builder.Bind(&done); builder.Return(); @@ -1692,7 +1692,7 @@ TEST(InterpreterSmiComparisons) { for (size_t j = 0; j < arraysize(inputs); j++) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); FeedbackVectorSpec feedback_spec(&zone); @@ -1739,7 +1739,7 @@ TEST(InterpreterHeapNumberComparisons) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); FeedbackVectorSpec feedback_spec(&zone); @@ -1775,7 +1775,7 @@ TEST(InterpreterStringComparisons) { HandleAndZoneScope handles; Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); std::string inputs[] = {"A", "abc", "z", "", "Foo!", "Foo"}; @@ -1841,7 +1841,7 @@ TEST(InterpreterMixedComparisons) { Isolate* isolate = handles.main_isolate(); Factory* factory = isolate->factory(); BytecodeArrayBuilder builder(isolate, handles.main_zone(), 0, 0, 1); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); FeedbackVectorSpec feedback_spec(&zone); FeedbackVectorSlot slot = feedback_spec.AddInterpreterCompareICSlot(); @@ -2315,7 +2315,7 @@ TEST(InterpreterConstruct) { auto callable = tester.GetCallable<>(); Handle<Object> return_val = callable().ToHandleChecked(); - CHECK_EQ(Smi::cast(*return_val), Smi::FromInt(0)); + CHECK_EQ(Smi::cast(*return_val), Smi::kZero); } @@ -2528,10 +2528,10 @@ TEST(InterpreterLogicalAnd) { std::make_pair("var a, b = 10; return a && b;\n", factory->undefined_value()), std::make_pair("var a = 0, b = 10; return a && b / a;\n", - handle(Smi::FromInt(0), isolate)), + handle(Smi::kZero, isolate)), std::make_pair("var a = '0', b = 10; return a && b;\n", handle(Smi::FromInt(10), isolate)), - std::make_pair("return 0.0 && 3.2;\n", handle(Smi::FromInt(0), isolate)), + std::make_pair("return 0.0 && 3.2;\n", handle(Smi::kZero, isolate)), std::make_pair("return 'a' && 'b';\n", factory->NewStringFromStaticChars("b")), std::make_pair("return 'a' && 0 || 'b', 'c';\n", @@ -2683,16 +2683,12 @@ TEST(InterpreterCountOperators) { handle(Smi::FromInt(4), isolate)), std::make_pair("var a = 5; return a--;", handle(Smi::FromInt(5), isolate)), - std::make_pair("var a = 5.2; return --a;", - factory->NewHeapNumber(4.2)), - std::make_pair("var a = 'string'; return ++a;", - factory->nan_value()), - std::make_pair("var a = 'string'; return a--;", - factory->nan_value()), + std::make_pair("var a = 5.2; return --a;", factory->NewHeapNumber(4.2)), + std::make_pair("var a = 'string'; return ++a;", factory->nan_value()), + std::make_pair("var a = 'string'; return a--;", factory->nan_value()), std::make_pair("var a = true; return ++a;", handle(Smi::FromInt(2), isolate)), - std::make_pair("var a = false; return a--;", - handle(Smi::FromInt(0), isolate)), + std::make_pair("var a = false; return a--;", handle(Smi::kZero, isolate)), std::make_pair("var a = { val: 11 }; return ++a.val;", handle(Smi::FromInt(12), isolate)), std::make_pair("var a = { val: 11 }; return a.val--;", @@ -2712,9 +2708,9 @@ TEST(InterpreterCountOperators) { std::make_pair("var i = 1; if(i--) { return 1; } else { return 2; };", handle(Smi::FromInt(1), isolate)), std::make_pair("var i = -2; do {} while(i++) {}; return i;", - handle(Smi::FromInt(1), isolate)), + handle(Smi::FromInt(1), isolate)), std::make_pair("var i = -1; for(; i++; ) {}; return i", - handle(Smi::FromInt(1), isolate)), + handle(Smi::FromInt(1), isolate)), std::make_pair("var i = 20; switch(i++) {\n" " case 20: return 1;\n" " default: return 2;\n" @@ -3895,19 +3891,19 @@ TEST(InterpreterLookupContextSlot) { 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)), + handle(Smi::kZero, 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)), + handle(Smi::kZero, isolate)), // Eval in outer context. std::make_tuple("var x = 0; eval('');", "return x;", - handle(Smi::FromInt(0), isolate)), + handle(Smi::kZero, 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)), + "return x;", handle(Smi::kZero, isolate)), }; for (size_t i = 0; i < arraysize(lookup_slot); i++) { @@ -3937,18 +3933,18 @@ TEST(InterpreterLookupGlobalSlot) { 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)), + handle(Smi::kZero, 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)), + handle(Smi::kZero, isolate)), // Eval in outer context. std::make_tuple("x = 0; eval('');", "return x;", - handle(Smi::FromInt(0), isolate)), + handle(Smi::kZero, 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)), + handle(Smi::kZero, isolate)), }; for (size_t i = 0; i < arraysize(lookup_slot); i++) { diff --git a/deps/v8/test/cctest/libplatform/test-tracing.cc b/deps/v8/test/cctest/libplatform/test-tracing.cc index 66fa0e05a5..6189ed2dfc 100644 --- a/deps/v8/test/cctest/libplatform/test-tracing.cc +++ b/deps/v8/test/cctest/libplatform/test-tracing.cc @@ -14,12 +14,9 @@ namespace tracing { TEST(TestTraceConfig) { LocalContext env; TraceConfig* trace_config = new TraceConfig(); - trace_config->EnableSampling(); trace_config->AddIncludedCategory("v8"); trace_config->AddIncludedCategory(TRACE_DISABLED_BY_DEFAULT("v8.runtime")); - trace_config->AddExcludedCategory("v8.cpu_profile"); - CHECK_EQ(trace_config->IsSamplingEnabled(), true); CHECK_EQ(trace_config->IsSystraceEnabled(), false); CHECK_EQ(trace_config->IsArgumentFilterEnabled(), false); CHECK_EQ(trace_config->IsCategoryGroupEnabled("v8"), true); @@ -41,8 +38,8 @@ TEST(TestTraceObject) { CHECK_EQ(category_enabled_flag, *trace_object.category_enabled_flag()); CHECK_EQ(std::string("Test.Trace"), std::string(trace_object.name())); CHECK_EQ(std::string("Test.Scope"), std::string(trace_object.scope())); - CHECK_EQ(0, trace_object.duration()); - CHECK_EQ(0, trace_object.cpu_duration()); + CHECK_EQ(0u, trace_object.duration()); + CHECK_EQ(0u, trace_object.cpu_duration()); } class ConvertableToTraceFormatMock : public v8::ConvertableToTraceFormat { @@ -189,7 +186,7 @@ TEST(TestTracingController) { TRACE_EVENT0("v8", "v8.Test3"); tracing_controller.StopTracing(); - CHECK_EQ(2, writer->events().size()); + CHECK_EQ(2u, writer->events().size()); CHECK_EQ(std::string("v8.Test"), writer->events()[0]); CHECK_EQ(std::string("v8.Test3"), writer->events()[1]); @@ -297,7 +294,7 @@ TEST(TestTracingControllerMultipleArgsAndCopy) { GetJSONStrings(all_names, trace_str, "\"name\"", "\"", "\""); GetJSONStrings(all_cats, trace_str, "\"cat\"", "\"", "\""); - CHECK_EQ(all_args.size(), 24); + CHECK_EQ(all_args.size(), 24u); CHECK_EQ(all_args[0], "\"aa\":11"); CHECK_EQ(all_args[1], "\"bb\":22"); CHECK_EQ(all_args[2], "\"cc\":33"); diff --git a/deps/v8/test/cctest/parsing/test-scanner-streams.cc b/deps/v8/test/cctest/parsing/test-scanner-streams.cc index fffd1200f2..3f5ae50d45 100644 --- a/deps/v8/test/cctest/parsing/test-scanner-streams.cc +++ b/deps/v8/test/cctest/parsing/test-scanner-streams.cc @@ -27,7 +27,7 @@ class ChunkSource : public v8::ScriptCompiler::ExternalSourceStream { // 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) { + for (size_t i = 0; i < len; i += chunk_size, chunk_size++) { chunks_.push_back({data + i, i::Min(chunk_size, len - i)}); } chunks_.push_back({nullptr, 0}); @@ -132,6 +132,13 @@ TEST(Utf8StreamBOM) { stream->Seek(5); CHECK_EQ(unicode_ucs2[5], stream->Advance()); + + // Try again, but make sure we have to seek 'backwards'. + while (v8::internal::Utf16CharacterStream::kEndOfInput != stream->Advance()) { + // Do nothing. We merely advance the stream to the end of its input. + } + stream->Seek(5); + CHECK_EQ(unicode_ucs2[5], stream->Advance()); } TEST(Utf8SplitBOM) { diff --git a/deps/v8/test/cctest/parsing/test-scanner.cc b/deps/v8/test/cctest/parsing/test-scanner.cc index 2577aa5868..12884ba106 100644 --- a/deps/v8/test/cctest/parsing/test-scanner.cc +++ b/deps/v8/test/cctest/parsing/test-scanner.cc @@ -17,8 +17,8 @@ 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())); +std::unique_ptr<Scanner> make_scanner(const char* src, UnicodeCache* cache) { + std::unique_ptr<Scanner> scanner(new Scanner(cache)); scanner->Initialize(ScannerStream::ForTesting(src).release()); return scanner; } @@ -30,11 +30,13 @@ std::unique_ptr<Scanner> make_scanner(const char* src) { #define DCHECK_TOK(a, b) DCHECK_EQ(Token::Name(a), Token::Name(b)) TEST(Bookmarks) { + UnicodeCache unicode_cache; + // 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); + auto scanner = make_scanner(src_simple, &unicode_cache); do { tokens.push_back(scanner->Next()); } while (scanner->current_token() != Token::EOS); @@ -48,7 +50,7 @@ TEST(Bookmarks) { // - 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); + auto scanner = make_scanner(src_simple, &unicode_cache); Scanner::BookmarkScope bookmark(scanner.get()); for (size_t i = 0; i < std::min(bookmark_pos + 10, tokens.size()); i++) { @@ -77,8 +79,9 @@ TEST(AllThePushbacks) { {"<!-- xx -->\nx", {Token::IDENTIFIER, Token::EOS}}, }; + UnicodeCache unicode_cache; for (const auto& test_case : test_cases) { - auto scanner = make_scanner(test_case.src); + auto scanner = make_scanner(test_case.src, &unicode_cache); for (size_t i = 0; test_case.tokens[i] != Token::EOS; i++) { DCHECK_TOK(test_case.tokens[i], scanner->Next()); } diff --git a/deps/v8/test/cctest/test-api-accessors.cc b/deps/v8/test/cctest/test-api-accessors.cc index cda16cdbcb..e9773e918d 100644 --- a/deps/v8/test/cctest/test-api-accessors.cc +++ b/deps/v8/test/cctest/test-api-accessors.cc @@ -4,9 +4,9 @@ #include "test/cctest/cctest.h" -#include "include/v8.h" #include "include/v8-experimental.h" - +#include "include/v8.h" +#include "src/api.h" namespace i = v8::internal; @@ -111,3 +111,139 @@ TEST(FastAccessors) { "}", 31415); } + +// The goal is to avoid the callback. +static void UnreachableCallback( + const v8::FunctionCallbackInfo<v8::Value>& info) { + UNREACHABLE(); +} + +TEST(CachedAccessor) { + // Crankshaft support for fast accessors is not implemented; crankshafted + // code uses the slow accessor which breaks this test's expectations. + v8::internal::FLAG_always_opt = false; + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + // Create 'foo' class, with a hidden property. + v8::Local<v8::ObjectTemplate> foo = v8::ObjectTemplate::New(isolate); + + v8::Local<v8::Private> priv = + v8::Private::ForApi(isolate, v8_str("Foo#draft")); + + foo->SetAccessorProperty(v8_str("draft"), v8::FunctionTemplate::NewWithCache( + isolate, UnreachableCallback, + priv, v8::Local<v8::Value>())); + + // Create 'obj', instance of 'foo'. + v8::Local<v8::Object> obj = foo->NewInstance(env.local()).ToLocalChecked(); + + // Install the private property on the instance. + CHECK(obj->SetPrivate(isolate->GetCurrentContext(), priv, + v8::Undefined(isolate)) + .FromJust()); + + CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); + + // Access cached accessor. + ExpectUndefined("obj.draft"); + + // Set hidden property. + CHECK(obj->SetPrivate(isolate->GetCurrentContext(), priv, + v8_str("Shhh, I'm private!")) + .FromJust()); + + ExpectString("obj.draft", "Shhh, I'm private!"); + + // Stress the accessor to use the IC. + ExpectString( + "var result = '';" + "for (var i = 0; i < 10; ++i) { " + " result = obj.draft; " + "} " + "result; ", + "Shhh, I'm private!"); +} + +TEST(CachedAccessorCrankshaft) { + i::FLAG_allow_natives_syntax = true; + // v8::internal::FLAG_always_opt = false; + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + + // Create 'foo' class, with a hidden property. + v8::Local<v8::ObjectTemplate> foo = v8::ObjectTemplate::New(isolate); + v8::Local<v8::Private> priv = + v8::Private::ForApi(isolate, v8_str("Foo#draft")); + + // Install the private property on the template. + // foo->SetPrivate(priv, v8::Undefined(isolate)); + + foo->SetAccessorProperty(v8_str("draft"), v8::FunctionTemplate::NewWithCache( + isolate, UnreachableCallback, + priv, v8::Local<v8::Value>())); + + // Create 'obj', instance of 'foo'. + v8::Local<v8::Object> obj = foo->NewInstance(env.local()).ToLocalChecked(); + + // Install the private property on the instance. + CHECK(obj->SetPrivate(isolate->GetCurrentContext(), priv, + v8::Undefined(isolate)) + .FromJust()); + + CHECK(env->Global()->Set(env.local(), v8_str("obj"), obj).FromJust()); + + // Access surrogate accessor. + ExpectUndefined("obj.draft"); + + // Set hidden property. + CHECK(obj->SetPrivate(env.local(), priv, v8::Integer::New(isolate, 123)) + .FromJust()); + + // Test ICs. + CompileRun( + "function f() {" + " var x;" + " for (var i = 0; i < 100; i++) {" + " x = obj.draft;" + " }" + " return x;" + "}"); + + ExpectInt32("f()", 123); + + // Reset hidden property. + CHECK(obj->SetPrivate(env.local(), priv, v8::Integer::New(isolate, 456)) + .FromJust()); + + // Test Crankshaft. + CompileRun("%OptimizeFunctionOnNextCall(f);"); + + ExpectInt32("f()", 456); + + CHECK(obj->SetPrivate(env.local(), priv, v8::Integer::New(isolate, 456)) + .FromJust()); + // Test non-global ICs. + CompileRun( + "function g() {" + " var x = obj;" + " var r = 0;" + " for (var i = 0; i < 100; i++) {" + " r = x.draft;" + " }" + " return r;" + "}"); + + ExpectInt32("g()", 456); + + // Reset hidden property. + CHECK(obj->SetPrivate(env.local(), priv, v8::Integer::New(isolate, 789)) + .FromJust()); + + // Test non-global access in Crankshaft. + CompileRun("%OptimizeFunctionOnNextCall(g);"); + + ExpectInt32("g()", 789); +} diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index 8317a06aa2..c578115888 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -151,6 +151,8 @@ UNINITIALIZED_TEST(InitializeAndDisposeMultiple) { for (int i = 0; i < 3; ++i) CHECK(v8::V8::Dispose()); } +// Tests that Smi::kZero is set up properly. +UNINITIALIZED_TEST(SmiZero) { CHECK_EQ(i::Smi::kZero, i::Smi::kZero); } THREADED_TEST(Handles) { v8::HandleScope scope(CcTest::isolate()); @@ -7768,7 +7770,7 @@ static void IndependentWeakHandle(bool global_gc, bool interlinked) { FlagAndPersistent object_a, object_b; - intptr_t big_heap_size; + size_t big_heap_size; { v8::HandleScope handle_scope(iso); @@ -9702,15 +9704,6 @@ TEST(DetachGlobal) { result = CompileRun("other.p"); CHECK(result->IsInt32()); CHECK_EQ(24, result->Int32Value(env3).FromJust()); - - // Change security token for env3 to something different from env1 and env2. - env3->SetSecurityToken(v8_str("bar")); - - // Check that we do not have access to other.p in env1. |other| is now - // the global object for env3 which has a different security token, - // so access should be blocked. - result = CompileRun("other.p"); - CHECK(result.IsEmpty()); } @@ -10562,7 +10555,7 @@ THREADED_TEST(ObjectGetOwnPropertyNames) { v8::PropertyFilter::ALL_PROPERTIES | v8::PropertyFilter::SKIP_SYMBOLS)) .ToLocal(&properties)); - CHECK_EQ(5, properties->Length()); + CHECK_EQ(5u, properties->Length()); v8::Local<v8::Value> property; CHECK(properties->Get(context.local(), 4).ToLocal(&property) && property->IsString()); @@ -10578,7 +10571,7 @@ THREADED_TEST(ObjectGetOwnPropertyNames) { CHECK(value->GetOwnPropertyNames(context.local(), v8::ONLY_ENUMERABLE) .ToLocal(&properties)); - CHECK_EQ(4, properties->Length()); + CHECK_EQ(4u, properties->Length()); for (int i = 0; i < 4; ++i) { v8::Local<v8::Value> property; CHECK(properties->Get(context.local(), i).ToLocal(&property) && @@ -13827,34 +13820,23 @@ void ApiTestFuzzer::CallTest() { test_number_); } -// Lets not be needlessly self-referential. -TEST(Threading1) { - ApiTestFuzzer::SetUp(ApiTestFuzzer::FIRST_PART); - ApiTestFuzzer::RunAllTests(); - ApiTestFuzzer::TearDown(); -} - - -TEST(Threading2) { - ApiTestFuzzer::SetUp(ApiTestFuzzer::SECOND_PART); - ApiTestFuzzer::RunAllTests(); - ApiTestFuzzer::TearDown(); -} - - -TEST(Threading3) { - ApiTestFuzzer::SetUp(ApiTestFuzzer::THIRD_PART); - ApiTestFuzzer::RunAllTests(); - ApiTestFuzzer::TearDown(); -} - +#define THREADING_TEST(INDEX, NAME) \ + TEST(Threading##INDEX) { \ + ApiTestFuzzer::SetUp(ApiTestFuzzer::NAME); \ + ApiTestFuzzer::RunAllTests(); \ + ApiTestFuzzer::TearDown(); \ + } -TEST(Threading4) { - ApiTestFuzzer::SetUp(ApiTestFuzzer::FOURTH_PART); - ApiTestFuzzer::RunAllTests(); - ApiTestFuzzer::TearDown(); -} +THREADING_TEST(1, FIRST_PART) +THREADING_TEST(2, SECOND_PART) +THREADING_TEST(3, THIRD_PART) +THREADING_TEST(4, FOURTH_PART) +THREADING_TEST(5, FIFTH_PART) +THREADING_TEST(6, SIXTH_PART) +THREADING_TEST(7, SEVENTH_PART) +THREADING_TEST(8, EIGHTH_PART) +#undef THREADING_TEST static void ThrowInJS(const v8::FunctionCallbackInfo<v8::Value>& args) { v8::Isolate* isolate = args.GetIsolate(); @@ -14579,7 +14561,7 @@ void SetFunctionEntryHookTest::RunTest() { RunLoopInNewEnv(isolate); // Check the expected invocation counts. - if (!i::FLAG_ignition) { + if (!i::FLAG_ignition && !i::FLAG_turbo) { CHECK_EQ(2, CountInvocations(NULL, "bar")); CHECK_EQ(200, CountInvocations("bar", "foo")); CHECK_EQ(200, CountInvocations(NULL, "foo")); @@ -14644,7 +14626,7 @@ static bool FunctionNameIs(const char* expected, // "LazyCompile:<type><function_name>" or Function:<type><function_name>, // where the type is one of "*", "~" or "". static const char* kPreamble; - if (!i::FLAG_lazy || (i::FLAG_ignition && i::FLAG_ignition_eager)) { + if (!i::FLAG_lazy) { kPreamble = "Function:"; } else { kPreamble = "LazyCompile:"; @@ -14820,8 +14802,9 @@ UNINITIALIZED_TEST(SetJitCodeEventHandler) { for (int i = 0; i < kIterations; ++i) { LocalContext env(isolate); i::AlwaysAllocateScope always_allocate(i_isolate); - i::heap::SimulateFullSpace(i::FLAG_ignition ? heap->old_space() - : heap->code_space()); + i::heap::SimulateFullSpace(i::FLAG_ignition || i::FLAG_turbo + ? heap->old_space() + : heap->code_space()); CompileRun(script); // Keep a strong reference to the code object in the handle scope. @@ -15374,7 +15357,7 @@ THREADED_TEST(AccessChecksReenabledCorrectly) { // Tests that ScriptData can be serialized and deserialized. TEST(PreCompileSerialization) { // Producing cached parser data while parsing eagerly is not supported. - if (!i::FLAG_lazy || (i::FLAG_ignition && i::FLAG_ignition_eager)) return; + if (!i::FLAG_lazy) return; v8::V8::Initialize(); LocalContext env; @@ -21753,10 +21736,6 @@ TEST(ScopedMicrotasks) { env->GetIsolate()->SetMicrotasksPolicy(v8::MicrotasksPolicy::kAuto); } -#ifdef ENABLE_DISASSEMBLER -// FLAG_test_primary_stub_cache and FLAG_test_secondary_stub_cache are read -// only when ENABLE_DISASSEMBLER is not defined. - namespace { int probes_counter = 0; @@ -21774,6 +21753,14 @@ int* LookupCounter(const char* name) { return NULL; } +} // namespace + +#ifdef ENABLE_DISASSEMBLER +// FLAG_test_primary_stub_cache and FLAG_test_secondary_stub_cache are read +// only when ENABLE_DISASSEMBLER is not defined. + +namespace { + const char* kMegamorphicTestProgram = "function CreateClass(name) {\n" " var src = \n" @@ -21802,7 +21789,7 @@ void TestStubCache(bool primary) { // The test does not work with interpreter because bytecode handlers taken // from the snapshot already refer to ICs with disabled counters and there // is no way to trigger bytecode handlers recompilation. - if (i::FLAG_ignition) return; + if (i::FLAG_ignition || i::FLAG_turbo) return; i::FLAG_native_code_counters = true; if (primary) { @@ -21826,12 +21813,10 @@ void TestStubCache(bool primary) { // Enforce recompilation of IC stubs that access megamorphic stub cache // to respect enabled native code counters and stub cache test flags. i::CodeStub::Major code_stub_keys[] = { - i::CodeStub::LoadIC, i::CodeStub::LoadICTrampoline, - 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::CodeStub::LoadIC, i::CodeStub::LoadICTrampoline, + i::CodeStub::KeyedLoadICTF, i::CodeStub::KeyedLoadICTrampolineTF, + i::CodeStub::StoreIC, i::CodeStub::StoreICTrampoline, + i::CodeStub::KeyedStoreIC, i::CodeStub::KeyedStoreICTrampoline, }; i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); i::Heap* heap = i_isolate->heap(); @@ -21870,22 +21855,10 @@ void TestStubCache(bool primary) { } // namespace UNINITIALIZED_TEST(PrimaryStubCache) { - i::FLAG_tf_load_ic_stub = false; TestStubCache(true); } UNINITIALIZED_TEST(SecondaryStubCache) { - i::FLAG_tf_load_ic_stub = false; - TestStubCache(false); -} - -UNINITIALIZED_TEST(PrimaryStubCacheTF) { - i::FLAG_tf_load_ic_stub = true; - TestStubCache(true); -} - -UNINITIALIZED_TEST(SecondaryStubCacheTF) { - i::FLAG_tf_load_ic_stub = true; TestStubCache(false); } @@ -22689,6 +22662,7 @@ TEST(AccessCheckThrows) { // Create a context and set an x property on it's global object. LocalContext context0(NULL, global_template); v8::Local<v8::Object> global0 = context0->Global(); + CHECK(global0->Set(context0.local(), v8_str("x"), global0).FromJust()); // Create a context with a different security token so that the // failed access check callback will be called on each access. @@ -22743,6 +22717,128 @@ TEST(AccessCheckThrows) { isolate->SetFailedAccessCheckCallbackFunction(NULL); } +TEST(AccessCheckInIC) { + // The test does not work with interpreter because bytecode handlers taken + // from the snapshot already refer to ICs with disabled counters and there + // is no way to trigger bytecode handlers recompilation. + if (i::FLAG_ignition || i::FLAG_turbo) return; + + i::FLAG_native_code_counters = true; + i::FLAG_crankshaft = false; + i::FLAG_turbo = false; + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); + create_params.counter_lookup_callback = LookupCounter; + v8::Isolate* isolate = v8::Isolate::New(create_params); + + { + v8::Isolate::Scope isolate_scope(isolate); + LocalContext env(isolate); + v8::HandleScope scope(isolate); + + { + // Enforce recompilation of IC stubs that access megamorphic stub cache + // to respect enabled native code counters and stub cache test flags. + i::CodeStub::Major code_stub_keys[] = { + i::CodeStub::LoadIC, i::CodeStub::LoadICTrampoline, + i::CodeStub::KeyedLoadICTF, i::CodeStub::KeyedLoadICTrampolineTF, + i::CodeStub::StoreIC, i::CodeStub::StoreICTrampoline, + i::CodeStub::KeyedStoreIC, i::CodeStub::KeyedStoreICTrampoline, + }; + i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate); + i::Heap* heap = i_isolate->heap(); + i::Handle<i::UnseededNumberDictionary> dict(heap->code_stubs()); + for (size_t i = 0; i < arraysize(code_stub_keys); i++) { + dict = i::UnseededNumberDictionary::DeleteKey(dict, code_stub_keys[i]); + } + heap->SetRootCodeStubs(*dict); + } + + // Create an ObjectTemplate for global objects and install access + // check callbacks that will block access. + v8::Local<v8::ObjectTemplate> global_template = + v8::ObjectTemplate::New(isolate); + global_template->SetAccessCheckCallback(AccessCounter); + + // Create a context and set an x property on its global object. + LocalContext context0(isolate, NULL, global_template); + v8::Local<v8::Object> global0 = context0->Global(); + CHECK(global0->Set(context0.local(), v8_str("x"), global0).FromJust()); + + // Create a context with a different security token so that the + // failed access check callback will be called on each access. + LocalContext context1(isolate, NULL, global_template); + CHECK(context1->Global() + ->Set(context1.local(), v8_str("other"), global0) + .FromJust()); + + // Set different security tokens. + Local<Value> token0 = v8_str("token0"); + context0.local()->SetSecurityToken(token0); + context1.local()->SetSecurityToken(v8_str("token1")); + + int initial_probes = probes_counter; + int initial_misses = misses_counter; + int initial_updates = updates_counter; + access_count = 0; + + // Create megamorphic load ic with a handler for "global0.x" compiled for + // context0. + CompileRun(context0.local(), + "Number(1).__proto__.x = null;\n" + "String(1).__proto__.x = null;\n" + "function get0(o) { return o.x; };\n" + "get0({x:1});\n" // premonomorphic + "get0({x:1,a:0});\n" // monomorphic + "get0({x:1,b:0});\n" // polymorphic + "get0('str');\n" + "get0(1.1);\n" + "get0(this);\n" // megamorphic + ""); + CHECK_EQ(0, probes_counter - initial_probes); + CHECK_EQ(0, misses_counter - initial_misses); + CHECK_EQ(5, updates_counter - initial_updates); + + // Create megamorphic load ic in context1. + CompileRun(context1.local(), + "function get1(o) { return o.x; };\n" + "get1({x:1});\n" // premonomorphic + "get1({x:1,a:0});\n" // monomorphic + "get1({x:1,b:0});\n" // polymorphic + "get1({x:1,c:0});\n" + "get1({x:1,d:0});\n" + "get1({x:1,e:0});\n" // megamorphic + ""); + CHECK_EQ(0, access_count); + CHECK_EQ(0, probes_counter - initial_probes); + CHECK_EQ(0, misses_counter - initial_misses); + CHECK_EQ(10, updates_counter - initial_updates); + + // Feed the |other| to the load ic and ensure that it doesn't pick the + // handler for "global0.x" compiled for context0 from the megamorphic + // cache but create another handler for "global0.x" compiled for context1 + // and ensure the access check callback is triggered. + CompileRun(context1.local(), "get1(other)"); + CHECK_EQ(1, access_count); // Access check callback must be triggered. + + // Feed the primitive objects to the load ic and ensure that it doesn't + // pick handlers for primitive maps from the megamorphic stub cache even + // if the security token matches. + context1.local()->SetSecurityToken(token0); + CHECK(CompileRun(context1.local(), "get1(1.1)") + .ToLocalChecked() + ->IsUndefined()); + CHECK(CompileRun(context1.local(), "get1('str')") + .ToLocalChecked() + ->IsUndefined()); + + CHECK_EQ(1, access_count); // Access check callback must be triggered. + CHECK_EQ(3, probes_counter - initial_probes); + CHECK_EQ(0, misses_counter - initial_misses); + CHECK_EQ(13, updates_counter - initial_updates); + } + isolate->Dispose(); +} class RequestInterruptTestBase { public: @@ -24027,65 +24123,69 @@ TEST(ScriptPositionInfo) { v8::internal::Script::PositionInfo info; - // With offset. - - // Behave as if 0 was passed if position is negative. - CHECK(script1->GetPositionInfo(-1, &info, script1->WITH_OFFSET)); - CHECK_EQ(13, info.line); - CHECK_EQ(0, info.column); - CHECK_EQ(0, info.line_start); - CHECK_EQ(8, info.line_end); - - CHECK(script1->GetPositionInfo(0, &info, script1->WITH_OFFSET)); - CHECK_EQ(13, info.line); - CHECK_EQ(0, info.column); - CHECK_EQ(0, info.line_start); - CHECK_EQ(8, info.line_end); - - CHECK(script1->GetPositionInfo(8, &info, script1->WITH_OFFSET)); - CHECK_EQ(13, info.line); - CHECK_EQ(8, info.column); - CHECK_EQ(0, info.line_start); - CHECK_EQ(8, info.line_end); - - CHECK(script1->GetPositionInfo(9, &info, script1->WITH_OFFSET)); - CHECK_EQ(14, info.line); - CHECK_EQ(0, info.column); - CHECK_EQ(9, info.line_start); - CHECK_EQ(17, info.line_end); - - // Fail when position is larger than script size. - CHECK(!script1->GetPositionInfo(220384, &info, script1->WITH_OFFSET)); - - // Without offset. - - // Behave as if 0 was passed if position is negative. - CHECK(script1->GetPositionInfo(-1, &info, script1->NO_OFFSET)); - CHECK_EQ(0, info.line); - CHECK_EQ(0, info.column); - CHECK_EQ(0, info.line_start); - CHECK_EQ(8, info.line_end); - - CHECK(script1->GetPositionInfo(0, &info, script1->NO_OFFSET)); - CHECK_EQ(0, info.line); - CHECK_EQ(0, info.column); - CHECK_EQ(0, info.line_start); - CHECK_EQ(8, info.line_end); - - CHECK(script1->GetPositionInfo(8, &info, script1->NO_OFFSET)); - CHECK_EQ(0, info.line); - CHECK_EQ(8, info.column); - CHECK_EQ(0, info.line_start); - CHECK_EQ(8, info.line_end); - - CHECK(script1->GetPositionInfo(9, &info, script1->NO_OFFSET)); - CHECK_EQ(1, info.line); - CHECK_EQ(0, info.column); - CHECK_EQ(9, info.line_start); - CHECK_EQ(17, info.line_end); - - // Fail when position is larger than script size. - CHECK(!script1->GetPositionInfo(220384, &info, script1->NO_OFFSET)); + for (int i = 0; i < 2; ++i) { + // With offset. + + // Behave as if 0 was passed if position is negative. + CHECK(script1->GetPositionInfo(-1, &info, script1->WITH_OFFSET)); + CHECK_EQ(13, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(0, &info, script1->WITH_OFFSET)); + CHECK_EQ(13, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(8, &info, script1->WITH_OFFSET)); + CHECK_EQ(13, info.line); + CHECK_EQ(8, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(9, &info, script1->WITH_OFFSET)); + CHECK_EQ(14, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(9, info.line_start); + CHECK_EQ(17, info.line_end); + + // Fail when position is larger than script size. + CHECK(!script1->GetPositionInfo(220384, &info, script1->WITH_OFFSET)); + + // Without offset. + + // Behave as if 0 was passed if position is negative. + CHECK(script1->GetPositionInfo(-1, &info, script1->NO_OFFSET)); + CHECK_EQ(0, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(0, &info, script1->NO_OFFSET)); + CHECK_EQ(0, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(8, &info, script1->NO_OFFSET)); + CHECK_EQ(0, info.line); + CHECK_EQ(8, info.column); + CHECK_EQ(0, info.line_start); + CHECK_EQ(8, info.line_end); + + CHECK(script1->GetPositionInfo(9, &info, script1->NO_OFFSET)); + CHECK_EQ(1, info.line); + CHECK_EQ(0, info.column); + CHECK_EQ(9, info.line_start); + CHECK_EQ(17, info.line_end); + + // Fail when position is larger than script size. + CHECK(!script1->GetPositionInfo(220384, &info, script1->NO_OFFSET)); + + i::Script::InitLineEnds(script1); + } } void CheckMagicComments(Local<Script> script, const char* expected_source_url, @@ -24853,7 +24953,7 @@ TEST(InvalidParserCacheData) { v8::V8::Initialize(); v8::HandleScope scope(CcTest::isolate()); LocalContext context; - if (i::FLAG_lazy && !(i::FLAG_ignition && i::FLAG_ignition_eager)) { + if (i::FLAG_lazy) { // Cached parser data is not consumed while parsing eagerly. TestInvalidCacheData(v8::ScriptCompiler::kConsumeParserCache); } @@ -24869,7 +24969,7 @@ TEST(InvalidCodeCacheData) { TEST(ParserCacheRejectedGracefully) { // Producing cached parser data while parsing eagerly is not supported. - if (!i::FLAG_lazy || (i::FLAG_ignition && i::FLAG_ignition_eager)) return; + if (!i::FLAG_lazy) return; i::FLAG_min_preparse_length = 0; v8::V8::Initialize(); @@ -25296,6 +25396,12 @@ TEST(ExtrasUtilsObject) { rejected_promise->Catch(env.local(), store).ToLocalChecked(); isolate->RunMicrotasks(); CHECK_EQ(3, CompileRun("result")->Int32Value(env.local()).FromJust()); + + auto rejected_but_handled_promise = + result->Get(env.local(), v8_str("rejectedButHandledPromise")) + .ToLocalChecked() + .As<v8::Promise>(); + CHECK_EQ(true, rejected_but_handled_promise->HasHandler()); } @@ -25959,3 +26065,122 @@ TEST(EvalInAccessCheckedContext) { CHECK_EQ(42, x_value->Int32Value(context1).FromJust()); context1->Exit(); } + +THREADED_TEST(ImmutableProtoWithParent) { + LocalContext context; + v8::Isolate* isolate = context->GetIsolate(); + v8::HandleScope handle_scope(isolate); + + Local<v8::FunctionTemplate> parent = v8::FunctionTemplate::New(isolate); + + Local<v8::FunctionTemplate> templ = v8::FunctionTemplate::New(isolate); + templ->Inherit(parent); + templ->PrototypeTemplate()->SetImmutableProto(); + + Local<v8::Function> function = + templ->GetFunction(context.local()).ToLocalChecked(); + Local<v8::Object> instance = + function->NewInstance(context.local()).ToLocalChecked(); + Local<v8::Object> prototype = + instance->Get(context.local(), v8_str("__proto__")) + .ToLocalChecked() + ->ToObject(context.local()) + .ToLocalChecked(); + + // Look up the prototype + Local<v8::Value> original_proto = + prototype->Get(context.local(), v8_str("__proto__")).ToLocalChecked(); + + // Setting the prototype (e.g., to null) throws + CHECK( + prototype->SetPrototype(context.local(), v8::Null(isolate)).IsNothing()); + + // The original prototype is still there + Local<Value> new_proto = + prototype->Get(context.local(), v8_str("__proto__")).ToLocalChecked(); + CHECK(new_proto->IsObject()); + CHECK(new_proto.As<v8::Object>() + ->Equals(context.local(), original_proto) + .FromJust()); +} + +TEST(InternalFieldsOnGlobalProxy) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope scope(isolate); + + v8::Local<v8::ObjectTemplate> obj_template = v8::ObjectTemplate::New(isolate); + obj_template->SetInternalFieldCount(1); + + v8::Local<v8::Context> context = Context::New(isolate, nullptr, obj_template); + v8::Local<v8::Object> global = context->Global(); + CHECK_EQ(1, global->InternalFieldCount()); +} + +THREADED_TEST(ImmutableProtoGlobal) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope handle_scope(isolate); + Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate); + global_template->SetImmutableProto(); + v8::Local<Context> context = Context::New(isolate, 0, global_template); + Context::Scope context_scope(context); + v8::Local<Value> result = CompileRun( + "global = this;" + "(function() {" + " try {" + " global.__proto__ = {};" + " return 0;" + " } catch (e) {" + " return 1;" + " }" + "})()"); + CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 1)) + .FromJust()); +} + +THREADED_TEST(MutableProtoGlobal) { + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope handle_scope(isolate); + Local<ObjectTemplate> global_template = ObjectTemplate::New(isolate); + v8::Local<Context> context = Context::New(isolate, 0, global_template); + Context::Scope context_scope(context); + v8::Local<Value> result = CompileRun( + "global = this;" + "(function() {" + " try {" + " global.__proto__ = {};" + " return 0;" + " } catch (e) {" + " return 1;" + " }" + "})()"); + CHECK(result->Equals(context, v8::Integer::New(CcTest::isolate(), 0)) + .FromJust()); +} + +TEST(InternalFieldsOnTypedArray) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + v8::Local<v8::Context> context = env.local(); + Context::Scope context_scope(context); + v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New(isolate, 1); + v8::Local<v8::Uint8Array> array = v8::Uint8Array::New(buffer, 0, 1); + for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) { + CHECK_EQ(static_cast<void*>(nullptr), + array->GetAlignedPointerFromInternalField(i)); + } +} + +TEST(InternalFieldsOnDataView) { + LocalContext env; + v8::Isolate* isolate = env->GetIsolate(); + v8::HandleScope scope(isolate); + v8::Local<v8::Context> context = env.local(); + Context::Scope context_scope(context); + v8::Local<v8::ArrayBuffer> buffer = v8::ArrayBuffer::New(isolate, 1); + v8::Local<v8::DataView> array = v8::DataView::New(buffer, 0, 1); + for (int i = 0; i < v8::ArrayBufferView::kInternalFieldCount; i++) { + CHECK_EQ(static_cast<void*>(nullptr), + array->GetAlignedPointerFromInternalField(i)); + } +} diff --git a/deps/v8/test/cctest/test-assembler-arm.cc b/deps/v8/test/cctest/test-assembler-arm.cc index de024f8869..08f1f5a9f3 100644 --- a/deps/v8/test/cctest/test-assembler-arm.cc +++ b/deps/v8/test/cctest/test-assembler-arm.cc @@ -1818,13 +1818,11 @@ TEST(uxtah) { } } - #define TEST_RBIT(expected_, input_) \ t.input = input_; \ t.result = 0; \ dummy = CALL_GENERATED_CODE(isolate, f, &t, 0, 0, 0, 0); \ - CHECK_EQ(expected_, t.result); - + CHECK_EQ(static_cast<uint32_t>(expected_), t.result); TEST(rbit) { CcTest::InitializeVM(); @@ -2808,21 +2806,21 @@ TEST(unaligned_loads) { #endif uint64_t data = UINT64_C(0x84838281807f7e7d); dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 0, 0, 0); - CHECK_EQ(0x00007e7d, t.ldrh); - CHECK_EQ(0x00007e7d, t.ldrsh); - CHECK_EQ(0x807f7e7d, t.ldr); + CHECK_EQ(0x00007e7du, t.ldrh); + CHECK_EQ(0x00007e7du, t.ldrsh); + CHECK_EQ(0x807f7e7du, t.ldr); dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 1, 0, 0); - CHECK_EQ(0x00007f7e, t.ldrh); - CHECK_EQ(0x00007f7e, t.ldrsh); - CHECK_EQ(0x81807f7e, t.ldr); + CHECK_EQ(0x00007f7eu, t.ldrh); + CHECK_EQ(0x00007f7eu, t.ldrsh); + CHECK_EQ(0x81807f7eu, t.ldr); dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 2, 0, 0); - CHECK_EQ(0x0000807f, t.ldrh); - CHECK_EQ(0xffff807f, t.ldrsh); - CHECK_EQ(0x8281807f, t.ldr); + CHECK_EQ(0x0000807fu, t.ldrh); + CHECK_EQ(0xffff807fu, t.ldrsh); + CHECK_EQ(0x8281807fu, t.ldr); dummy = CALL_GENERATED_CODE(isolate, f, &t, &data, 3, 0, 0); - CHECK_EQ(0x00008180, t.ldrh); - CHECK_EQ(0xffff8180, t.ldrsh); - CHECK_EQ(0x83828180, t.ldr); + CHECK_EQ(0x00008180u, t.ldrh); + CHECK_EQ(0xffff8180u, t.ldrsh); + CHECK_EQ(0x83828180u, t.ldr); } TEST(unaligned_stores) { diff --git a/deps/v8/test/cctest/test-ast-types.cc b/deps/v8/test/cctest/test-ast-types.cc index 39d2d70eb0..942989d63a 100644 --- a/deps/v8/test/cctest/test-ast-types.cc +++ b/deps/v8/test/cctest/test-ast-types.cc @@ -48,7 +48,7 @@ struct Tests { Tests() : isolate(CcTest::InitIsolateOnce()), scope(isolate), - zone(isolate->allocator()), + zone(isolate->allocator(), ZONE_NAME), T(&zone, isolate, isolate->random_number_generator()) {} bool IsBitset(AstType* type) { return type->IsBitsetForTesting(); } diff --git a/deps/v8/test/cctest/test-ast.cc b/deps/v8/test/cctest/test-ast.cc index 5512bfce96..dfb4d11236 100644 --- a/deps/v8/test/cctest/test-ast.cc +++ b/deps/v8/test/cctest/test-ast.cc @@ -40,7 +40,7 @@ TEST(List) { CHECK_EQ(0, list->length()); v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); AstValueFactory value_factory(&zone, 0); AstNodeFactory factory(&value_factory); AstNode* node = factory.NewEmptyStatement(kNoSourcePosition); @@ -62,7 +62,7 @@ TEST(List) { TEST(ConcatStrings) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); AstValueFactory value_factory(&zone, 0); const AstRawString* one_byte = value_factory.GetOneByteString("a"); diff --git a/deps/v8/test/cctest/test-atomicops.cc b/deps/v8/test/cctest/test-atomicops.cc index 4a59ba68e3..5ac4d5e473 100644 --- a/deps/v8/test/cctest/test-atomicops.cc +++ b/deps/v8/test/cctest/test-atomicops.cc @@ -193,11 +193,6 @@ static void TestStore() { NoBarrier_Store(&value, kVal2); CHECK_EQU(kVal2, value); - Acquire_Store(&value, kVal1); - CHECK_EQU(kVal1, value); - Acquire_Store(&value, kVal2); - CHECK_EQU(kVal2, value); - Release_Store(&value, kVal1); CHECK_EQU(kVal1, value); Release_Store(&value, kVal2); @@ -238,11 +233,6 @@ static void TestLoad() { CHECK_EQU(kVal1, Acquire_Load(&value)); value = kVal2; CHECK_EQU(kVal2, Acquire_Load(&value)); - - value = kVal1; - CHECK_EQU(kVal1, Release_Load(&value)); - value = kVal2; - CHECK_EQU(kVal2, Release_Load(&value)); } diff --git a/deps/v8/test/cctest/test-bit-vector.cc b/deps/v8/test/cctest/test-bit-vector.cc index 99c5a68d45..a6a1e4001a 100644 --- a/deps/v8/test/cctest/test-bit-vector.cc +++ b/deps/v8/test/cctest/test-bit-vector.cc @@ -36,7 +36,7 @@ using namespace v8::internal; TEST(BitVector) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); { BitVector v(15, &zone); v.Add(1); diff --git a/deps/v8/test/cctest/test-code-stub-assembler.cc b/deps/v8/test/cctest/test-code-stub-assembler.cc index 588f430131..da2773fdca 100644 --- a/deps/v8/test/cctest/test-code-stub-assembler.cc +++ b/deps/v8/test/cctest/test-code-stub-assembler.cc @@ -61,13 +61,14 @@ TEST(LoadInstanceType) { Handle<Smi>::cast(result.ToHandleChecked())->value()); } -TEST(BitFieldDecode) { +TEST(DecodeWordFromWord32) { Isolate* isolate(CcTest::InitIsolateOnce()); VoidDescriptor descriptor(isolate); CodeStubAssemblerTester m(isolate, descriptor); class TestBitField : public BitField<unsigned, 3, 3> {}; - m.Return(m.SmiTag(m.BitFieldDecode<TestBitField>(m.Int32Constant(0x2f)))); + m.Return( + m.SmiTag(m.DecodeWordFromWord32<TestBitField>(m.Int32Constant(0x2f)))); Handle<Code> code = m.GenerateCode(); FunctionTester ft(descriptor, code); MaybeHandle<Object> result = ft.Call(); @@ -119,6 +120,102 @@ TEST(ComputeIntegerHash) { } } +TEST(ToString) { + Isolate* isolate(CcTest::InitIsolateOnce()); + const int kNumParams = 1; + CodeStubAssemblerTester m(isolate, kNumParams); + m.Return(m.ToString(m.Parameter(kNumParams + 2), m.Parameter(0))); + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<FixedArray> test_cases = isolate->factory()->NewFixedArray(5); + Handle<FixedArray> smi_test = isolate->factory()->NewFixedArray(2); + smi_test->set(0, Smi::FromInt(42)); + Handle<String> str(isolate->factory()->InternalizeUtf8String("42")); + smi_test->set(1, *str); + test_cases->set(0, *smi_test); + + Handle<FixedArray> number_test = isolate->factory()->NewFixedArray(2); + Handle<HeapNumber> num(isolate->factory()->NewHeapNumber(3.14)); + number_test->set(0, *num); + str = isolate->factory()->InternalizeUtf8String("3.14"); + number_test->set(1, *str); + test_cases->set(1, *number_test); + + Handle<FixedArray> string_test = isolate->factory()->NewFixedArray(2); + str = isolate->factory()->InternalizeUtf8String("test"); + string_test->set(0, *str); + string_test->set(1, *str); + test_cases->set(2, *string_test); + + Handle<FixedArray> oddball_test = isolate->factory()->NewFixedArray(2); + oddball_test->set(0, isolate->heap()->undefined_value()); + str = isolate->factory()->InternalizeUtf8String("undefined"); + oddball_test->set(1, *str); + test_cases->set(3, *oddball_test); + + Handle<FixedArray> tostring_test = isolate->factory()->NewFixedArray(2); + Handle<FixedArray> js_array_storage = isolate->factory()->NewFixedArray(2); + js_array_storage->set(0, Smi::FromInt(1)); + js_array_storage->set(1, Smi::FromInt(2)); + Handle<JSArray> js_array = isolate->factory()->NewJSArray(2); + JSArray::SetContent(js_array, js_array_storage); + tostring_test->set(0, *js_array); + str = isolate->factory()->InternalizeUtf8String("1,2"); + tostring_test->set(1, *str); + test_cases->set(4, *tostring_test); + + for (int i = 0; i < 5; ++i) { + Handle<FixedArray> test = handle(FixedArray::cast(test_cases->get(i))); + Handle<Object> obj = handle(test->get(0), isolate); + Handle<String> expected = handle(String::cast(test->get(1))); + Handle<Object> result = ft.Call(obj).ToHandleChecked(); + CHECK(result->IsString()); + CHECK(String::Equals(Handle<String>::cast(result), expected)); + } +} + +TEST(FlattenString) { + Isolate* isolate(CcTest::InitIsolateOnce()); + const int kNumParams = 1; + CodeStubAssemblerTester m(isolate, kNumParams); + m.Return(m.FlattenString(m.Parameter(0))); + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<FixedArray> test_cases(isolate->factory()->NewFixedArray(4)); + Handle<String> expected( + isolate->factory()->InternalizeUtf8String("hello, world!")); + test_cases->set(0, *expected); + + Handle<String> string( + isolate->factory()->InternalizeUtf8String("filler hello, world! filler")); + Handle<String> sub_string( + isolate->factory()->NewProperSubString(string, 7, 20)); + test_cases->set(1, *sub_string); + + Handle<String> hello(isolate->factory()->InternalizeUtf8String("hello,")); + Handle<String> world(isolate->factory()->InternalizeUtf8String(" world!")); + Handle<String> cons_str( + isolate->factory()->NewConsString(hello, world).ToHandleChecked()); + test_cases->set(2, *cons_str); + + Handle<String> empty(isolate->factory()->InternalizeUtf8String("")); + Handle<String> fake_cons_str( + isolate->factory()->NewConsString(expected, empty).ToHandleChecked()); + test_cases->set(3, *fake_cons_str); + + for (int i = 0; i < 4; ++i) { + Handle<String> test = handle(String::cast(test_cases->get(i))); + Handle<Object> result = ft.Call(test).ToHandleChecked(); + CHECK(result->IsString()); + CHECK(Handle<String>::cast(result)->IsFlat()); + CHECK(String::Equals(Handle<String>::cast(result), expected)); + } +} + TEST(TryToName) { typedef CodeStubAssembler::Label Label; typedef CodeStubAssembler::Variable Variable; @@ -173,7 +270,7 @@ TEST(TryToName) { { // TryToName(<zero smi>) => if_keyisindex: smi value. - Handle<Object> key(Smi::FromInt(0), isolate); + Handle<Object> key(Smi::kZero, isolate); ft.CheckTrue(key, expect_index, key); } @@ -251,6 +348,37 @@ TEST(TryToName) { namespace { template <typename Dictionary> +void TestEntryToIndex() { + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 1; + CodeStubAssemblerTester m(isolate, kNumParams); + { + Node* entry = m.SmiUntag(m.Parameter(0)); + Node* result = m.EntryToIndex<Dictionary>(entry); + m.Return(m.SmiTag(result)); + } + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + // Test a wide range of entries but staying linear in the first 100 entries. + for (int entry = 0; entry < Dictionary::kMaxCapacity; + entry = entry * 1.01 + 1) { + Handle<Object> result = + ft.Call(handle(Smi::FromInt(entry), isolate)).ToHandleChecked(); + CHECK_EQ(Dictionary::EntryToIndex(entry), Smi::cast(*result)->value()); + } +} + +TEST(NameDictionaryEntryToIndex) { TestEntryToIndex<NameDictionary>(); } +TEST(GlobalDictionaryEntryToIndex) { TestEntryToIndex<GlobalDictionary>(); } + +} // namespace + +namespace { + +template <typename Dictionary> void TestNameDictionaryLookup() { typedef CodeStubAssembler::Label Label; typedef CodeStubAssembler::Variable Variable; @@ -944,7 +1072,7 @@ TEST(TryLookupElement) { FunctionTester ft(code, kNumParams); Factory* factory = isolate->factory(); - Handle<Object> smi0(Smi::FromInt(0), isolate); + Handle<Object> smi0(Smi::kZero, isolate); Handle<Object> smi1(Smi::FromInt(1), isolate); Handle<Object> smi7(Smi::FromInt(7), isolate); Handle<Object> smi13(Smi::FromInt(13), isolate); @@ -1189,9 +1317,9 @@ void TestStubCacheOffsetCalculation(StubCache::Table table) { factory->sloppy_arguments_elements_map(), }; - for (int name_index = 0; name_index < arraysize(names); name_index++) { + for (size_t name_index = 0; name_index < arraysize(names); name_index++) { Handle<Name> name = names[name_index]; - for (int map_index = 0; map_index < arraysize(maps); map_index++) { + for (size_t map_index = 0; map_index < arraysize(maps); map_index++) { Handle<Map> map = maps[map_index]; int expected_result; @@ -1257,12 +1385,12 @@ TEST(TryProbeStubCache) { m.TryProbeStubCache(&stub_cache, receiver, name, &if_handler, &var_handler, &if_miss); m.Bind(&if_handler); - m.BranchIfWordEqual(expected_handler, var_handler.value(), &passed, - &failed); + m.Branch(m.WordEqual(expected_handler, var_handler.value()), &passed, + &failed); m.Bind(&if_miss); - m.BranchIfWordEqual(expected_handler, m.IntPtrConstant(0), &passed, - &failed); + m.Branch(m.WordEqual(expected_handler, m.IntPtrConstant(0)), &passed, + &failed); m.Bind(&passed); m.Return(m.BooleanConstant(true)); @@ -1346,14 +1474,14 @@ TEST(TryProbeStubCache) { int index = rand_gen.NextInt(); Handle<Name> name = names[index % names.size()]; Handle<JSObject> receiver = receivers[index % receivers.size()]; - Code* handler = stub_cache.Get(*name, receiver->map()); + Object* handler = stub_cache.Get(*name, receiver->map()); if (handler == nullptr) { queried_non_existing = true; } else { queried_existing = true; } - Handle<Code> expected_handler(handler, isolate); + Handle<Object> expected_handler(handler, isolate); ft.CheckTrue(receiver, name, expected_handler); } @@ -1362,14 +1490,14 @@ TEST(TryProbeStubCache) { int index2 = rand_gen.NextInt(); Handle<Name> name = names[index1 % names.size()]; Handle<JSObject> receiver = receivers[index2 % receivers.size()]; - Code* handler = stub_cache.Get(*name, receiver->map()); + Object* handler = stub_cache.Get(*name, receiver->map()); if (handler == nullptr) { queried_non_existing = true; } else { queried_existing = true; } - Handle<Code> expected_handler(handler, isolate); + Handle<Object> expected_handler(handler, isolate); ft.CheckTrue(receiver, name, expected_handler); } // Ensure we performed both kind of queries. @@ -1382,7 +1510,8 @@ TEST(GotoIfException) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 1; - CodeStubAssemblerTester m(isolate, kNumParams); + // Emulate TFJ builtin + CodeStubAssemblerTester m(isolate, kNumParams, Code::BUILTIN); Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); Node* to_string_tag = @@ -1401,9 +1530,6 @@ TEST(GotoIfException) { Handle<Code> code = m.GenerateCode(); CHECK(!code.is_null()); - // Emulate TFJ builtin - code->set_flags(Code::ComputeFlags(Code::BUILTIN)); - FunctionTester ft(code, kNumParams); Handle<Object> result = ft.Call().ToHandleChecked(); @@ -1423,7 +1549,8 @@ TEST(GotoIfExceptionMultiple) { Isolate* isolate(CcTest::InitIsolateOnce()); const int kNumParams = 4; // receiver, first, second, third - CodeStubAssemblerTester m(isolate, kNumParams); + // Emulate TFJ builtin + CodeStubAssemblerTester m(isolate, kNumParams, Code::BUILTIN); Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); Node* first_value = m.Parameter(0); @@ -1468,9 +1595,6 @@ TEST(GotoIfExceptionMultiple) { Handle<Code> code = m.GenerateCode(); CHECK(!code.is_null()); - // Emulate TFJ builtin - code->set_flags(Code::ComputeFlags(Code::BUILTIN)); - FunctionTester ft(code, kNumParams); Handle<Object> result; @@ -1509,5 +1633,350 @@ TEST(GotoIfExceptionMultiple) { CHECK(constructor->SameValue(*isolate->type_error_function())); } +TEST(AllocateJSObjectFromMap) { + Isolate* isolate(CcTest::InitIsolateOnce()); + Factory* factory = isolate->factory(); + + const int kNumParams = 3; + CodeStubAssemblerTester m(isolate, kNumParams); + + { + Node* map = m.Parameter(0); + Node* properties = m.Parameter(1); + Node* elements = m.Parameter(2); + + Node* result = m.AllocateJSObjectFromMap(map, properties, elements); + + m.Return(result); + } + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + Handle<Map> maps[] = { + handle(isolate->object_function()->initial_map(), isolate), + handle(isolate->array_function()->initial_map(), isolate), + }; + +#define VERIFY(result, map_value, properties_value, elements_value) \ + CHECK_EQ(result->map(), map_value); \ + CHECK_EQ(result->properties(), properties_value); \ + CHECK_EQ(result->elements(), elements_value); + + { + Handle<Object> empty_fixed_array = factory->empty_fixed_array(); + for (size_t i = 0; i < arraysize(maps); i++) { + Handle<Map> map = maps[i]; + Handle<JSObject> result = Handle<JSObject>::cast( + ft.Call(map, empty_fixed_array, empty_fixed_array).ToHandleChecked()); + VERIFY(result, *map, *empty_fixed_array, *empty_fixed_array); + CHECK(result->HasFastProperties()); +#ifdef VERIFY_HEAP + isolate->heap()->Verify(); +#endif + } + } + + { + // TODO(cbruni): handle in-object properties + Handle<JSObject> object = Handle<JSObject>::cast( + v8::Utils::OpenHandle(*CompileRun("var object = {a:1,b:2, 1:1, 2:2}; " + "object"))); + JSObject::NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, 0, + "Normalize"); + Handle<JSObject> result = Handle<JSObject>::cast( + ft.Call(handle(object->map()), handle(object->properties()), + handle(object->elements())) + .ToHandleChecked()); + VERIFY(result, object->map(), object->properties(), object->elements()); + CHECK(!result->HasFastProperties()); +#ifdef VERIFY_HEAP + isolate->heap()->Verify(); +#endif + } +#undef VERIFY +} + +TEST(AllocateNameDictionary) { + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 1; + CodeStubAssemblerTester m(isolate, kNumParams); + + { + Node* capacity = m.Parameter(0); + Node* result = m.AllocateNameDictionary(m.SmiUntag(capacity)); + m.Return(result); + } + + Handle<Code> code = m.GenerateCode(); + FunctionTester ft(code, kNumParams); + + { + for (int i = 0; i < 256; i = i * 1.1 + 1) { + Handle<Object> result = + ft.Call(handle(Smi::FromInt(i), isolate)).ToHandleChecked(); + Handle<NameDictionary> dict = NameDictionary::New(isolate, i); + // Both dictionaries should be memory equal. + int size = + FixedArrayBase::kHeaderSize + (dict->length() - 1) * kPointerSize; + CHECK_EQ(0, memcmp(*dict, *result, size)); + } + } +} + +TEST(PopAndReturnConstant) { + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 4; + const int kNumProgramaticParams = 2; + CodeStubAssemblerTester m(isolate, kNumParams - kNumProgramaticParams); + + // Call a function that return |kNumProgramaticParams| parameters in addition + // to those specified by the static descriptor. |kNumProgramaticParams| is + // specified as a constant. + m.PopAndReturn(m.Int32Constant(kNumProgramaticParams), + m.SmiConstant(Smi::FromInt(1234))); + + Handle<Code> code = m.GenerateCode(); + CHECK(!code.is_null()); + + FunctionTester ft(code, kNumParams); + Handle<Object> result; + for (int test_count = 0; test_count < 100; ++test_count) { + result = ft.Call(isolate->factory()->undefined_value(), + Handle<Smi>(Smi::FromInt(1234), isolate), + isolate->factory()->undefined_value(), + isolate->factory()->undefined_value()) + .ToHandleChecked(); + CHECK_EQ(1234, Handle<Smi>::cast(result)->value()); + } +} + +TEST(PopAndReturnVariable) { + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 4; + const int kNumProgramaticParams = 2; + CodeStubAssemblerTester m(isolate, kNumParams - kNumProgramaticParams); + + // Call a function that return |kNumProgramaticParams| parameters in addition + // to those specified by the static descriptor. |kNumProgramaticParams| is + // passed in as a parameter to the function so that it can't be recongized as + // a constant. + m.PopAndReturn(m.SmiUntag(m.Parameter(1)), m.SmiConstant(Smi::FromInt(1234))); + + Handle<Code> code = m.GenerateCode(); + CHECK(!code.is_null()); + + FunctionTester ft(code, kNumParams); + Handle<Object> result; + for (int test_count = 0; test_count < 100; ++test_count) { + result = ft.Call(isolate->factory()->undefined_value(), + Handle<Smi>(Smi::FromInt(1234), isolate), + isolate->factory()->undefined_value(), + Handle<Smi>(Smi::FromInt(kNumProgramaticParams), isolate)) + .ToHandleChecked(); + CHECK_EQ(1234, Handle<Smi>::cast(result)->value()); + } +} + +TEST(OneToTwoByteStringCopy) { + Isolate* isolate(CcTest::InitIsolateOnce()); + + CodeStubAssemblerTester m(isolate, 2); + + m.CopyStringCharacters( + m.Parameter(0), m.Parameter(1), m.SmiConstant(Smi::FromInt(0)), + m.SmiConstant(Smi::FromInt(0)), m.SmiConstant(Smi::FromInt(5)), + String::ONE_BYTE_ENCODING, String::TWO_BYTE_ENCODING, + CodeStubAssembler::SMI_PARAMETERS); + m.Return(m.SmiConstant(Smi::FromInt(0))); + + Handle<Code> code = m.GenerateCode(); + CHECK(!code.is_null()); + + Handle<String> string1 = isolate->factory()->InternalizeUtf8String("abcde"); + uc16 array[] = {1000, 1001, 1002, 1003, 1004}; + Vector<const uc16> str(array); + Handle<String> string2 = + isolate->factory()->NewStringFromTwoByte(str).ToHandleChecked(); + FunctionTester ft(code, 2); + ft.Call(string1, string2); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[0], + Handle<SeqTwoByteString>::cast(string2)->GetChars()[0]); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[1], + Handle<SeqTwoByteString>::cast(string2)->GetChars()[1]); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[2], + Handle<SeqTwoByteString>::cast(string2)->GetChars()[2]); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[3], + Handle<SeqTwoByteString>::cast(string2)->GetChars()[3]); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[4], + Handle<SeqTwoByteString>::cast(string2)->GetChars()[4]); +} + +TEST(OneToOneByteStringCopy) { + Isolate* isolate(CcTest::InitIsolateOnce()); + + CodeStubAssemblerTester m(isolate, 2); + + m.CopyStringCharacters( + m.Parameter(0), m.Parameter(1), m.SmiConstant(Smi::FromInt(0)), + m.SmiConstant(Smi::FromInt(0)), m.SmiConstant(Smi::FromInt(5)), + String::ONE_BYTE_ENCODING, String::ONE_BYTE_ENCODING, + CodeStubAssembler::SMI_PARAMETERS); + m.Return(m.SmiConstant(Smi::FromInt(0))); + + Handle<Code> code = m.GenerateCode(); + CHECK(!code.is_null()); + + Handle<String> string1 = isolate->factory()->InternalizeUtf8String("abcde"); + uint8_t array[] = {100, 101, 102, 103, 104}; + Vector<const uint8_t> str(array); + Handle<String> string2 = + isolate->factory()->NewStringFromOneByte(str).ToHandleChecked(); + FunctionTester ft(code, 2); + ft.Call(string1, string2); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[0], + Handle<SeqOneByteString>::cast(string2)->GetChars()[0]); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[1], + Handle<SeqOneByteString>::cast(string2)->GetChars()[1]); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[2], + Handle<SeqOneByteString>::cast(string2)->GetChars()[2]); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[3], + Handle<SeqOneByteString>::cast(string2)->GetChars()[3]); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[4], + Handle<SeqOneByteString>::cast(string2)->GetChars()[4]); +} + +TEST(OneToOneByteStringCopyNonZeroStart) { + Isolate* isolate(CcTest::InitIsolateOnce()); + + CodeStubAssemblerTester m(isolate, 2); + + m.CopyStringCharacters( + m.Parameter(0), m.Parameter(1), m.SmiConstant(Smi::FromInt(0)), + m.SmiConstant(Smi::FromInt(3)), m.SmiConstant(Smi::FromInt(2)), + String::ONE_BYTE_ENCODING, String::ONE_BYTE_ENCODING, + CodeStubAssembler::SMI_PARAMETERS); + m.Return(m.SmiConstant(Smi::FromInt(0))); + + Handle<Code> code = m.GenerateCode(); + CHECK(!code.is_null()); + + Handle<String> string1 = isolate->factory()->InternalizeUtf8String("abcde"); + uint8_t array[] = {100, 101, 102, 103, 104}; + Vector<const uint8_t> str(array); + Handle<String> string2 = + isolate->factory()->NewStringFromOneByte(str).ToHandleChecked(); + FunctionTester ft(code, 2); + ft.Call(string1, string2); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[0], + Handle<SeqOneByteString>::cast(string2)->GetChars()[3]); + CHECK_EQ(Handle<SeqOneByteString>::cast(string1)->GetChars()[1], + Handle<SeqOneByteString>::cast(string2)->GetChars()[4]); + CHECK_EQ(100, Handle<SeqOneByteString>::cast(string2)->GetChars()[0]); + CHECK_EQ(101, Handle<SeqOneByteString>::cast(string2)->GetChars()[1]); + CHECK_EQ(102, Handle<SeqOneByteString>::cast(string2)->GetChars()[2]); +} + +TEST(TwoToTwoByteStringCopy) { + Isolate* isolate(CcTest::InitIsolateOnce()); + + CodeStubAssemblerTester m(isolate, 2); + + m.CopyStringCharacters( + m.Parameter(0), m.Parameter(1), m.SmiConstant(Smi::FromInt(0)), + m.SmiConstant(Smi::FromInt(0)), m.SmiConstant(Smi::FromInt(5)), + String::TWO_BYTE_ENCODING, String::TWO_BYTE_ENCODING, + CodeStubAssembler::SMI_PARAMETERS); + m.Return(m.SmiConstant(Smi::FromInt(0))); + + Handle<Code> code = m.GenerateCode(); + CHECK(!code.is_null()); + + uc16 array1[] = {2000, 2001, 2002, 2003, 2004}; + Vector<const uc16> str1(array1); + Handle<String> string1 = + isolate->factory()->NewStringFromTwoByte(str1).ToHandleChecked(); + uc16 array2[] = {1000, 1001, 1002, 1003, 1004}; + Vector<const uc16> str2(array2); + Handle<String> string2 = + isolate->factory()->NewStringFromTwoByte(str2).ToHandleChecked(); + FunctionTester ft(code, 2); + ft.Call(string1, string2); + CHECK_EQ(Handle<SeqTwoByteString>::cast(string1)->GetChars()[0], + Handle<SeqTwoByteString>::cast(string2)->GetChars()[0]); + CHECK_EQ(Handle<SeqTwoByteString>::cast(string1)->GetChars()[1], + Handle<SeqTwoByteString>::cast(string2)->GetChars()[1]); + CHECK_EQ(Handle<SeqTwoByteString>::cast(string1)->GetChars()[2], + Handle<SeqTwoByteString>::cast(string2)->GetChars()[2]); + CHECK_EQ(Handle<SeqTwoByteString>::cast(string1)->GetChars()[3], + Handle<SeqTwoByteString>::cast(string2)->GetChars()[3]); + CHECK_EQ(Handle<SeqTwoByteString>::cast(string1)->GetChars()[4], + Handle<SeqTwoByteString>::cast(string2)->GetChars()[4]); +} + +TEST(Arguments) { + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 4; + CodeStubAssemblerTester m(isolate, kNumParams); + + CodeStubArguments arguments(&m, m.IntPtrConstant(3)); + + CSA_ASSERT( + &m, m.WordEqual(arguments.AtIndex(0), m.SmiConstant(Smi::FromInt(12)))); + CSA_ASSERT( + &m, m.WordEqual(arguments.AtIndex(1), m.SmiConstant(Smi::FromInt(13)))); + CSA_ASSERT( + &m, m.WordEqual(arguments.AtIndex(2), m.SmiConstant(Smi::FromInt(14)))); + + m.Return(arguments.GetReceiver()); + + Handle<Code> code = m.GenerateCode(); + CHECK(!code.is_null()); + + FunctionTester ft(code, kNumParams); + Handle<Object> result = ft.Call(isolate->factory()->undefined_value(), + Handle<Smi>(Smi::FromInt(12), isolate), + Handle<Smi>(Smi::FromInt(13), isolate), + Handle<Smi>(Smi::FromInt(14), isolate)) + .ToHandleChecked(); + CHECK_EQ(*isolate->factory()->undefined_value(), *result); +} + +TEST(ArgumentsForEach) { + Isolate* isolate(CcTest::InitIsolateOnce()); + + const int kNumParams = 4; + CodeStubAssemblerTester m(isolate, kNumParams); + + CodeStubArguments arguments(&m, m.IntPtrConstant(3)); + + CodeStubAssemblerTester::Variable sum(&m, + MachineType::PointerRepresentation()); + CodeStubAssemblerTester::VariableList list({&sum}, m.zone()); + + sum.Bind(m.IntPtrConstant(0)); + + arguments.ForEach(list, [&m, &sum](CodeStubAssembler* assembler, Node* arg) { + sum.Bind(assembler->IntPtrAdd(sum.value(), arg)); + }); + + m.Return(sum.value()); + + Handle<Code> code = m.GenerateCode(); + CHECK(!code.is_null()); + + FunctionTester ft(code, kNumParams); + Handle<Object> result = ft.Call(isolate->factory()->undefined_value(), + Handle<Smi>(Smi::FromInt(12), isolate), + Handle<Smi>(Smi::FromInt(13), isolate), + Handle<Smi>(Smi::FromInt(14), isolate)) + .ToHandleChecked(); + CHECK_EQ(Smi::FromInt(12 + 13 + 14), *result); +} + } // namespace internal } // namespace v8 diff --git a/deps/v8/test/cctest/test-compiler.cc b/deps/v8/test/cctest/test-compiler.cc index bce3fb2394..ef7506b58f 100644 --- a/deps/v8/test/cctest/test-compiler.cc +++ b/deps/v8/test/cctest/test-compiler.cc @@ -322,9 +322,10 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) { // of the full code. CHECK(f->IsOptimized()); // If the baseline code is bytecode, then it will not have deoptimization - // support. has_deoptimization_support() check is only required if the + // support. The has_deoptimization_support() check is only required if the // baseline code is from fullcodegen. - CHECK(f->shared()->has_deoptimization_support() || i::FLAG_ignition); + CHECK(f->shared()->has_deoptimization_support() || i::FLAG_ignition || + i::FLAG_turbo); object = f->feedback_vector()->Get(slot_for_a); CHECK(object->IsWeakCell() && WeakCell::cast(object)->value()->IsJSFunction()); @@ -332,8 +333,7 @@ TEST(FeedbackVectorPreservedAcrossRecompiles) { TEST(FeedbackVectorUnaffectedByScopeChanges) { - if (i::FLAG_always_opt || !i::FLAG_lazy || - (FLAG_ignition && FLAG_ignition_eager)) { + if (i::FLAG_always_opt || !i::FLAG_lazy) { return; } CcTest::InitializeVM(); @@ -406,150 +406,6 @@ TEST(OptimizedCodeSharing1) { } } -// Test that optimized code for different closures is actually shared. -TEST(OptimizedCodeSharing2) { - if (FLAG_stress_compaction) return; - FLAG_allow_natives_syntax = true; - FLAG_native_context_specialization = false; - FLAG_turbo_cache_shared_code = true; - const char* flag = "--turbo-filter=*"; - FlagList::SetFlagsFromString(flag, StrLength(flag)); - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - v8::Local<v8::Script> script = v8_compile( - "function MakeClosure() {" - " return function() { return x; };" - "}"); - Handle<Code> reference_code; - { - LocalContext env; - env->Global() - ->Set(env.local(), v8_str("x"), v8::Integer::New(CcTest::isolate(), 23)) - .FromJust(); - script->GetUnboundScript() - ->BindToCurrentContext() - ->Run(env.local()) - .ToLocalChecked(); - CompileRun( - "var closure0 = MakeClosure();" - "%DebugPrint(closure0());" - "%OptimizeFunctionOnNextCall(closure0);" - "%DebugPrint(closure0());"); - Handle<JSFunction> fun0 = Handle<JSFunction>::cast( - v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - env->Global() - ->Get(env.local(), v8_str("closure0")) - .ToLocalChecked()))); - CHECK(fun0->IsOptimized() || !CcTest::i_isolate()->use_crankshaft()); - reference_code = handle(fun0->code()); - } - for (int i = 0; i < 3; i++) { - LocalContext env; - env->Global() - ->Set(env.local(), v8_str("x"), v8::Integer::New(CcTest::isolate(), i)) - .FromJust(); - script->GetUnboundScript() - ->BindToCurrentContext() - ->Run(env.local()) - .ToLocalChecked(); - CompileRun( - "var closure0 = MakeClosure();" - "%DebugPrint(closure0());" - "%OptimizeFunctionOnNextCall(closure0);" - "%DebugPrint(closure0());" - "var closure1 = MakeClosure(); closure1();" - "var closure2 = MakeClosure(); closure2();"); - Handle<JSFunction> fun1 = Handle<JSFunction>::cast( - v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - env->Global() - ->Get(env.local(), v8_str("closure1")) - .ToLocalChecked()))); - Handle<JSFunction> fun2 = Handle<JSFunction>::cast( - v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - env->Global() - ->Get(env.local(), v8_str("closure2")) - .ToLocalChecked()))); - CHECK(fun1->IsOptimized() || !CcTest::i_isolate()->use_crankshaft()); - CHECK(fun2->IsOptimized() || !CcTest::i_isolate()->use_crankshaft()); - CHECK_EQ(*reference_code, fun1->code()); - CHECK_EQ(*reference_code, fun2->code()); - } -} - -// Test that optimized code for different closures is actually shared. -TEST(OptimizedCodeSharing3) { - if (FLAG_stress_compaction) return; - FLAG_allow_natives_syntax = true; - FLAG_native_context_specialization = false; - FLAG_turbo_cache_shared_code = true; - const char* flag = "--turbo-filter=*"; - FlagList::SetFlagsFromString(flag, StrLength(flag)); - CcTest::InitializeVM(); - v8::HandleScope scope(CcTest::isolate()); - v8::Local<v8::Script> script = v8_compile( - "function MakeClosure() {" - " return function() { return x; };" - "}"); - Handle<Code> reference_code; - { - LocalContext env; - env->Global() - ->Set(env.local(), v8_str("x"), v8::Integer::New(CcTest::isolate(), 23)) - .FromJust(); - script->GetUnboundScript() - ->BindToCurrentContext() - ->Run(env.local()) - .ToLocalChecked(); - CompileRun( - "var closure0 = MakeClosure();" - "%DebugPrint(closure0());" - "%OptimizeFunctionOnNextCall(closure0);" - "%DebugPrint(closure0());"); - Handle<JSFunction> fun0 = Handle<JSFunction>::cast( - v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - env->Global() - ->Get(env.local(), v8_str("closure0")) - .ToLocalChecked()))); - CHECK(fun0->IsOptimized() || !CcTest::i_isolate()->use_crankshaft()); - reference_code = handle(fun0->code()); - // Evict only the context-dependent entry from the optimized code map. This - // leaves it in a state where only the context-independent entry exists. - fun0->shared()->TrimOptimizedCodeMap(SharedFunctionInfo::kEntryLength); - } - for (int i = 0; i < 3; i++) { - LocalContext env; - env->Global() - ->Set(env.local(), v8_str("x"), v8::Integer::New(CcTest::isolate(), i)) - .FromJust(); - script->GetUnboundScript() - ->BindToCurrentContext() - ->Run(env.local()) - .ToLocalChecked(); - CompileRun( - "var closure0 = MakeClosure();" - "%DebugPrint(closure0());" - "%OptimizeFunctionOnNextCall(closure0);" - "%DebugPrint(closure0());" - "var closure1 = MakeClosure(); closure1();" - "var closure2 = MakeClosure(); closure2();"); - Handle<JSFunction> fun1 = Handle<JSFunction>::cast( - v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - env->Global() - ->Get(env.local(), v8_str("closure1")) - .ToLocalChecked()))); - Handle<JSFunction> fun2 = Handle<JSFunction>::cast( - v8::Utils::OpenHandle(*v8::Local<v8::Function>::Cast( - env->Global() - ->Get(env.local(), v8_str("closure2")) - .ToLocalChecked()))); - CHECK(fun1->IsOptimized() || !CcTest::i_isolate()->use_crankshaft()); - CHECK(fun2->IsOptimized() || !CcTest::i_isolate()->use_crankshaft()); - CHECK_EQ(*reference_code, fun1->code()); - CHECK_EQ(*reference_code, fun2->code()); - } -} - - TEST(CompileFunctionInContext) { CcTest::InitializeVM(); v8::HandleScope scope(CcTest::isolate()); @@ -763,53 +619,6 @@ TEST(SplitConstantsInFullCompiler) { } #endif -static void IsBaselineCompiled( - const v8::FunctionCallbackInfo<v8::Value>& args) { - Handle<Object> object = v8::Utils::OpenHandle(*args[0]); - Handle<JSFunction> function = Handle<JSFunction>::cast(object); - bool is_baseline = function->shared()->code()->kind() == Code::FUNCTION; - return args.GetReturnValue().Set(is_baseline); -} - -static void InstallIsBaselineCompiledHelper(v8::Isolate* isolate) { - v8::Local<v8::Context> context = isolate->GetCurrentContext(); - v8::Local<v8::FunctionTemplate> t = - v8::FunctionTemplate::New(isolate, IsBaselineCompiled); - CHECK(context->Global() - ->Set(context, v8_str("IsBaselineCompiled"), - t->GetFunction(context).ToLocalChecked()) - .FromJust()); -} - -TEST(IgnitionBaselineOnReturn) { - // TODO(4280): Remove this entire test once --ignition-preserve-bytecode is - // the default and the flag is removed. This test doesn't provide benefit any - // longer once {InterpreterActivationsFinder} is gone. - if (FLAG_ignition_preserve_bytecode) return; - FLAG_allow_natives_syntax = true; - FLAG_always_opt = false; - CcTest::InitializeVM(); - FLAG_ignition = true; - Isolate* isolate = CcTest::i_isolate(); - isolate->interpreter()->Initialize(); - v8::HandleScope scope(CcTest::isolate()); - InstallIsBaselineCompiledHelper(CcTest::isolate()); - - CompileRun( - "var is_baseline_in_function, is_baseline_after_return;\n" - "var return_val;\n" - "function f() {\n" - " %CompileBaseline(f);\n" - " is_baseline_in_function = IsBaselineCompiled(f);\n" - " return 1234;\n" - "};\n" - "return_val = f();\n" - "is_baseline_after_return = IsBaselineCompiled(f);\n"); - CHECK_EQ(false, GetGlobalProperty("is_baseline_in_function")->BooleanValue()); - CHECK_EQ(true, GetGlobalProperty("is_baseline_after_return")->BooleanValue()); - CHECK_EQ(1234.0, GetGlobalProperty("return_val")->Number()); -} - TEST(IgnitionEntryTrampolineSelfHealing) { FLAG_allow_natives_syntax = true; FLAG_always_opt = false; diff --git a/deps/v8/test/cctest/test-conversions.cc b/deps/v8/test/cctest/test-conversions.cc index 87dc99c3f0..2fee58a46d 100644 --- a/deps/v8/test/cctest/test-conversions.cc +++ b/deps/v8/test/cctest/test-conversions.cc @@ -425,7 +425,7 @@ TEST(NoHandlesForTryNumberToSize) { SealHandleScope no_handles(isolate); Smi* smi = Smi::FromInt(1); CHECK(TryNumberToSize(smi, &result)); - CHECK_EQ(result, 1); + CHECK_EQ(result, 1u); } result = 0; { @@ -434,7 +434,7 @@ TEST(NoHandlesForTryNumberToSize) { { SealHandleScope no_handles(isolate); CHECK(TryNumberToSize(*heap_number1, &result)); - CHECK_EQ(result, 2); + CHECK_EQ(result, 2u); } Handle<HeapNumber> heap_number2 = isolate->factory()->NewHeapNumber( static_cast<double>(std::numeric_limits<size_t>::max()) + 10000.0); diff --git a/deps/v8/test/cctest/test-cpu-profiler.cc b/deps/v8/test/cctest/test-cpu-profiler.cc index 2f92f54d37..a69dd4cad4 100644 --- a/deps/v8/test/cctest/test-cpu-profiler.cc +++ b/deps/v8/test/cctest/test-cpu-profiler.cc @@ -38,6 +38,9 @@ #include "test/cctest/cctest.h" #include "test/cctest/profiler-extension.h" +#include "include/libplatform/v8-tracing.h" +#include "src/tracing/trace-event.h" + using i::CodeEntry; using i::CpuProfile; using i::CpuProfiler; @@ -63,15 +66,21 @@ static size_t offset(const char* src, const char* substring) { return static_cast<size_t>(it - src); } +template <typename A, typename B> +static int dist(A a, B b) { + return abs(static_cast<int>(a) - static_cast<int>(b)); +} + static const char* reason(const i::DeoptimizeReason reason) { return i::DeoptimizeReasonToString(reason); } TEST(StartStop) { - CpuProfilesCollection profiles(CcTest::i_isolate()); - ProfileGenerator generator(&profiles); + i::Isolate* isolate = CcTest::i_isolate(); + CpuProfilesCollection profiles(isolate); + ProfileGenerator generator(isolate, &profiles); std::unique_ptr<ProfilerEventsProcessor> processor( - new ProfilerEventsProcessor(CcTest::i_isolate(), &generator, + new ProfilerEventsProcessor(isolate, &generator, v8::base::TimeDelta::FromMicroseconds(100))); processor->Start(); processor->StopSynchronously(); @@ -154,10 +163,9 @@ TEST(CodeEvents) { i::AbstractCode* args4_code = CreateCode(&env); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); - ProfileGenerator* generator = new ProfileGenerator(profiles); - ProfilerEventsProcessor* processor = - new ProfilerEventsProcessor(CcTest::i_isolate(), generator, - v8::base::TimeDelta::FromMicroseconds(100)); + ProfileGenerator* generator = new ProfileGenerator(isolate, profiles); + ProfilerEventsProcessor* processor = new ProfilerEventsProcessor( + isolate, generator, v8::base::TimeDelta::FromMicroseconds(100)); CpuProfiler profiler(isolate, profiles, generator, processor); profiles->StartProfiling("", false); processor->Start(); @@ -223,7 +231,7 @@ TEST(TickEvents) { i::AbstractCode* frame3_code = CreateCode(&env); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); - ProfileGenerator* generator = new ProfileGenerator(profiles); + ProfileGenerator* generator = new ProfileGenerator(isolate, profiles); ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(CcTest::i_isolate(), generator, v8::base::TimeDelta::FromMicroseconds(100)); @@ -296,7 +304,7 @@ TEST(Issue1398) { i::AbstractCode* code = CreateCode(&env); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); - ProfileGenerator* generator = new ProfileGenerator(profiles); + ProfileGenerator* generator = new ProfileGenerator(isolate, profiles); ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(CcTest::i_isolate(), generator, v8::base::TimeDelta::FromMicroseconds(100)); @@ -1027,7 +1035,6 @@ static void TickLines(bool optimize) { CcTest::InitializeVM(); LocalContext env; i::FLAG_allow_natives_syntax = true; - i::FLAG_turbo_source_positions = true; i::Isolate* isolate = CcTest::i_isolate(); i::Factory* factory = isolate->factory(); i::HandleScope scope(isolate); @@ -1070,7 +1077,7 @@ static void TickLines(bool optimize) { CHECK(code_address); CpuProfilesCollection* profiles = new CpuProfilesCollection(isolate); - ProfileGenerator* generator = new ProfileGenerator(profiles); + ProfileGenerator* generator = new ProfileGenerator(isolate, profiles); ProfilerEventsProcessor* processor = new ProfilerEventsProcessor(CcTest::i_isolate(), generator, v8::base::TimeDelta::FromMicroseconds(100)); @@ -1903,10 +1910,9 @@ TEST(SourceLocation) { .ToLocalChecked(); } - static const char* inlined_source = - "function opt_function(left, right) { var k = left / 10; var r = 10 / " - "right; return k + r; }\n"; + "function opt_function(left, right) { var k = left*right; return k + 1; " + "}\n"; // 0.........1.........2.........3.........4....*....5.........6......*..7 @@ -1933,7 +1939,7 @@ TEST(DeoptAtFirstLevelInlinedSource) { "\n" "test(10, 10);\n" "\n" - "test(undefined, 10);\n" + "test(undefined, 1e9);\n" "\n" "stopProfiling();\n" "\n"; @@ -1968,10 +1974,11 @@ TEST(DeoptAtFirstLevelInlinedSource) { CHECK_EQ(1U, deopt_infos.size()); const v8::CpuProfileDeoptInfo& info = deopt_infos[0]; - CHECK_EQ(reason(i::DeoptimizeReason::kNotAHeapNumber), info.deopt_reason); + CHECK(reason(i::DeoptimizeReason::kNotASmi) == info.deopt_reason || + reason(i::DeoptimizeReason::kNotAHeapNumber) == info.deopt_reason); CHECK_EQ(2U, info.stack.size()); CHECK_EQ(inlined_script_id, info.stack[0].script_id); - CHECK_EQ(offset(inlined_source, "left /"), info.stack[0].position); + CHECK_LE(dist(offset(inlined_source, "*right"), info.stack[0].position), 1); CHECK_EQ(script_id, info.stack[1].script_id); CHECK_EQ(offset(source, "opt_function(left,"), info.stack[1].position); @@ -1993,7 +2000,7 @@ TEST(DeoptAtSecondLevelInlinedSource) { // 0.........1.........2.........3.........4.........5.........6.........7 const char* source = "function test2(left, right) { return opt_function(left, right); }\n" - "function test1(left, right) { return test2(left, right); }\n" + "function test1(left, right) { return test2(left, right); } \n" "\n" "startProfiling();\n" "\n" @@ -2003,7 +2010,7 @@ TEST(DeoptAtSecondLevelInlinedSource) { "\n" "test1(10, 10);\n" "\n" - "test1(undefined, 10);\n" + "test1(undefined, 1e9);\n" "\n" "stopProfiling();\n" "\n"; @@ -2041,10 +2048,11 @@ TEST(DeoptAtSecondLevelInlinedSource) { CHECK_EQ(1U, deopt_infos.size()); const v8::CpuProfileDeoptInfo info = deopt_infos[0]; - CHECK_EQ(reason(i::DeoptimizeReason::kNotAHeapNumber), info.deopt_reason); + CHECK(reason(i::DeoptimizeReason::kNotASmi) == info.deopt_reason || + reason(i::DeoptimizeReason::kNotAHeapNumber) == info.deopt_reason); CHECK_EQ(3U, info.stack.size()); CHECK_EQ(inlined_script_id, info.stack[0].script_id); - CHECK_EQ(offset(inlined_source, "left /"), info.stack[0].position); + CHECK_LE(dist(offset(inlined_source, "*right"), info.stack[0].position), 1); CHECK_EQ(script_id, info.stack[1].script_id); CHECK_EQ(offset(source, "opt_function(left,"), info.stack[1].position); CHECK_EQ(offset(source, "test2(left, right);"), info.stack[2].position); @@ -2098,3 +2106,79 @@ TEST(DeoptUntrackedFunction) { iprofiler->DeleteProfile(iprofile); } + +using v8::platform::tracing::TraceBuffer; +using v8::platform::tracing::TraceConfig; +using v8::platform::tracing::TraceObject; + +namespace { + +class CpuProfileEventChecker : public v8::platform::tracing::TraceWriter { + public: + void AppendTraceEvent(TraceObject* trace_event) override { + if (trace_event->name() != std::string("Profile") && + trace_event->name() != std::string("ProfileChunk")) + return; + CHECK(!profile_id_ || trace_event->id() == profile_id_); + CHECK_EQ(1, trace_event->num_args()); + CHECK_EQ(TRACE_VALUE_TYPE_CONVERTABLE, trace_event->arg_types()[0]); + profile_id_ = trace_event->id(); + v8::ConvertableToTraceFormat* arg = + trace_event->arg_convertables()[0].get(); + arg->AppendAsTraceFormat(&result_json_); + } + void Flush() override {} + + std::string result_json() const { return result_json_; } + + private: + std::string result_json_; + uint64_t profile_id_ = 0; +}; + +} // namespace + +TEST(TracingCpuProfiler) { + 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); + + CpuProfileEventChecker* event_checker = new CpuProfileEventChecker(); + TraceBuffer* ring_buffer = + TraceBuffer::CreateTraceBufferRingBuffer(1, event_checker); + tracing_controller.Initialize(ring_buffer); + TraceConfig* trace_config = new TraceConfig(); + trace_config->AddIncludedCategory( + TRACE_DISABLED_BY_DEFAULT("v8.cpu_profiler")); + + LocalContext env; + v8::HandleScope scope(env->GetIsolate()); + { + tracing_controller.StartTracing(trace_config); + auto profiler = v8::TracingCpuProfiler::Create(env->GetIsolate()); + CompileRun("function foo() { } foo();"); + tracing_controller.StopTracing(); + CompileRun("function bar() { } bar();"); + } + + const char* profile_checker = + "function checkProfile(profile) {\n" + " if (typeof profile['startTime'] !== 'number') return 'startTime';\n" + " return '';\n" + "}\n" + "checkProfile("; + std::string profile_json = event_checker->result_json(); + CHECK_LT(0u, profile_json.length()); + printf("Profile JSON: %s\n", profile_json.c_str()); + std::string code = profile_checker + profile_json + ")"; + v8::Local<v8::Value> result = + CompileRunChecked(CcTest::isolate(), code.c_str()); + v8::String::Utf8Value value(result); + printf("Check result: %*s\n", value.length(), *value); + CHECK_EQ(0, value.length()); + + i::V8::SetPlatformForTesting(old_platform); +} diff --git a/deps/v8/test/cctest/test-debug.cc b/deps/v8/test/cctest/test-debug.cc index 9d63e7b3a6..3b43d9d11f 100644 --- a/deps/v8/test/cctest/test-debug.cc +++ b/deps/v8/test/cctest/test-debug.cc @@ -33,13 +33,13 @@ #include "src/base/platform/condition-variable.h" #include "src/base/platform/platform.h" #include "src/compilation-cache.h" +#include "src/debug/debug-interface.h" #include "src/debug/debug.h" #include "src/deoptimizer.h" #include "src/frames.h" #include "src/utils.h" #include "test/cctest/cctest.h" - using ::v8::base::Mutex; using ::v8::base::LockGuard; using ::v8::base::ConditionVariable; @@ -319,6 +319,11 @@ static void ChangeBreakOnExceptionFromJS(v8::Isolate* isolate, bool caught, } } +// Change break on exception using the native API call. +static void ChangeBreakOnExceptionFromAPI( + v8::Isolate* isolate, v8::DebugInterface::ExceptionBreakState state) { + v8::DebugInterface::ChangeBreakOnException(isolate, state); +} // Prepare to step to next break location. static void PrepareStep(StepAction step_action) { @@ -3986,6 +3991,48 @@ TEST(BreakOnException) { edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked(); DebugEventCounterCheck(4, 3, 2); + // No break on exception using native API + DebugEventCounterClear(); + MessageCallbackCountClear(); + ChangeBreakOnExceptionFromAPI(env->GetIsolate(), + v8::DebugInterface::NoBreakOnException); + caught->Call(context, env->Global(), 0, NULL).ToLocalChecked(); + DebugEventCounterCheck(0, 0, 0); + CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty()); + DebugEventCounterCheck(0, 0, 1); + CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty()); + DebugEventCounterCheck(0, 0, 2); + edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked(); + DebugEventCounterCheck(0, 0, 2); + + // // Break on uncaught exception using native API + DebugEventCounterClear(); + MessageCallbackCountClear(); + ChangeBreakOnExceptionFromAPI(env->GetIsolate(), + v8::DebugInterface::BreakOnUncaughtException); + caught->Call(context, env->Global(), 0, NULL).ToLocalChecked(); + DebugEventCounterCheck(0, 0, 0); + CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty()); + DebugEventCounterCheck(1, 1, 1); + CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty()); + DebugEventCounterCheck(2, 2, 2); + edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked(); + DebugEventCounterCheck(3, 3, 2); + + // // Break on exception and uncaught exception using native API + DebugEventCounterClear(); + MessageCallbackCountClear(); + ChangeBreakOnExceptionFromAPI(env->GetIsolate(), + v8::DebugInterface::BreakOnAnyException); + caught->Call(context, env->Global(), 0, NULL).ToLocalChecked(); + DebugEventCounterCheck(1, 0, 0); + CHECK(notCaught->Call(context, env->Global(), 0, NULL).IsEmpty()); + DebugEventCounterCheck(2, 1, 1); + CHECK(notCaughtFinally->Call(context, env->Global(), 0, NULL).IsEmpty()); + DebugEventCounterCheck(3, 2, 2); + edgeCaseFinally->Call(context, env->Global(), 0, NULL).ToLocalChecked(); + DebugEventCounterCheck(4, 3, 2); + v8::Debug::SetDebugEventListener(env->GetIsolate(), nullptr); CheckDebuggerUnloaded(env->GetIsolate()); env->GetIsolate()->RemoveMessageListeners(MessageCallbackCount); diff --git a/deps/v8/test/cctest/test-dictionary.cc b/deps/v8/test/cctest/test-dictionary.cc index c1184fa2b4..d7344a142f 100644 --- a/deps/v8/test/cctest/test-dictionary.cc +++ b/deps/v8/test/cctest/test-dictionary.cc @@ -212,7 +212,7 @@ TEST(HashTableRehash) { for (int i = 0; i < capacity - 1; i++) { t->insert(i, i * i, i); } - t->Rehash(handle(Smi::FromInt(0), isolate)); + t->Rehash(handle(Smi::kZero, isolate)); for (int i = 0; i < capacity - 1; i++) { CHECK_EQ(i, t->lookup(i * i)); } @@ -225,7 +225,7 @@ TEST(HashTableRehash) { for (int i = 0; i < capacity / 2; i++) { t->insert(i, i * i, i); } - t->Rehash(handle(Smi::FromInt(0), isolate)); + t->Rehash(handle(Smi::kZero, isolate)); for (int i = 0; i < capacity / 2; i++) { CHECK_EQ(i, t->lookup(i * i)); } @@ -304,7 +304,7 @@ TEST(SetRequiresCopyOnCapacityChange) { dict->SetRequiresCopyOnCapacityChange(); Handle<Name> key = isolate->factory()->InternalizeString( v8::Utils::OpenHandle(*v8_str("key"))); - Handle<Object> value = handle(Smi::FromInt(0), isolate); + Handle<Object> value = handle(Smi::kZero, isolate); Handle<NameDictionary> new_dict = NameDictionary::Add(dict, key, value, PropertyDetails::Empty()); CHECK_NE(*dict, *new_dict); diff --git a/deps/v8/test/cctest/test-extra.js b/deps/v8/test/cctest/test-extra.js index b3752d97b2..0cc4df4cc4 100644 --- a/deps/v8/test/cctest/test-extra.js +++ b/deps/v8/test/cctest/test-extra.js @@ -65,11 +65,16 @@ return (arg1 === arg2 && arg2 === 'x') ? 3 : -1; }, null, new v8.InternalPackedArray('x', 'x'))); + const rejectedButHandledPromise = v8.createPromise(); + v8.rejectPromise(rejectedButHandledPromise, 4); + v8.markPromiseAsHandled(rejectedButHandledPromise); + return { privateSymbol: v8.createPrivateSymbol('sym'), fulfilledPromise, // should be fulfilled with 1 fulfilledPromise2, // should be fulfilled with 2 - rejectedPromise // should be rejected with 3 + rejectedPromise, // should be rejected with 3 + rejectedButHandledPromise // should be rejected but have a handler }; }; }) diff --git a/deps/v8/test/cctest/test-feedback-vector.cc b/deps/v8/test/cctest/test-feedback-vector.cc index af9c6feef0..1f9ddc6f55 100644 --- a/deps/v8/test/cctest/test-feedback-vector.cc +++ b/deps/v8/test/cctest/test-feedback-vector.cc @@ -36,7 +36,7 @@ TEST(VectorStructure) { v8::HandleScope scope(context->GetIsolate()); Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); // Empty vectors are the empty fixed array. StaticFeedbackVectorSpec empty; @@ -103,7 +103,7 @@ TEST(VectorICMetadata) { LocalContext context; v8::HandleScope scope(context->GetIsolate()); Isolate* isolate = CcTest::i_isolate(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); FeedbackVectorSpec spec(&zone); // Set metadata. @@ -158,7 +158,7 @@ TEST(VectorSlotClearing) { v8::HandleScope scope(context->GetIsolate()); Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); // We only test clearing FeedbackVectorSlots, not FeedbackVectorSlots. // The reason is that FeedbackVectorSlots need a full code environment diff --git a/deps/v8/test/cctest/test-field-type-tracking.cc b/deps/v8/test/cctest/test-field-type-tracking.cc index 771d3f116d..df6a06bfc7 100644 --- a/deps/v8/test/cctest/test-field-type-tracking.cc +++ b/deps/v8/test/cctest/test-field-type-tracking.cc @@ -473,7 +473,7 @@ TEST(ReconfigureAccessorToNonExistingDataField) { map, 0, kData, NONE, Representation::None(), none_type, FORCE_FIELD); CHECK_EQ(*new_map, *new_map2); - Handle<Object> value(Smi::FromInt(0), isolate); + Handle<Object> value(Smi::kZero, isolate); Handle<Map> prepared_map = Map::PrepareForDataProperty(new_map, 0, value); // None to Smi generalization is trivial, map does not change. CHECK_EQ(*new_map, *prepared_map); @@ -589,7 +589,7 @@ static void TestGeneralizeRepresentation( CHECK(map->is_stable()); CHECK(expectations.Check(*map)); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); if (is_detached_map) { detach_point_map = Map::ReconfigureProperty( @@ -607,7 +607,7 @@ static void TestGeneralizeRepresentation( CompilationDependencies dependencies(isolate, &zone); CHECK(!dependencies.HasAborted()); - dependencies.AssumeFieldType(field_owner); + dependencies.AssumeFieldOwner(field_owner); Handle<Map> new_map = Map::ReconfigureProperty(map, property_index, kData, NONE, @@ -981,11 +981,11 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentation( CHECK(map2->is_stable()); CHECK(expectations2.Check(*map2)); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); CompilationDependencies dependencies(isolate, &zone); CHECK(!dependencies.HasAborted()); - dependencies.AssumeFieldType(field_owner); + dependencies.AssumeFieldOwner(field_owner); // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which // should generalize representations in |map1|. @@ -1066,11 +1066,11 @@ static void TestReconfigureDataFieldAttribute_GeneralizeRepresentationTrivial( CHECK(map2->is_stable()); CHECK(expectations2.Check(*map2)); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); Handle<Map> field_owner(map->FindFieldOwner(kSplitProp), isolate); CompilationDependencies dependencies(isolate, &zone); CHECK(!dependencies.HasAborted()); - dependencies.AssumeFieldType(field_owner); + dependencies.AssumeFieldOwner(field_owner); // Reconfigure attributes of property |kSplitProp| of |map2| to NONE, which // should generalize representations in |map1|. @@ -1597,11 +1597,11 @@ static void TestReconfigureElementsKind_GeneralizeRepresentation( CHECK(map2->is_stable()); CHECK(expectations2.Check(*map2)); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); CompilationDependencies dependencies(isolate, &zone); CHECK(!dependencies.HasAborted()); - dependencies.AssumeFieldType(field_owner); + dependencies.AssumeFieldOwner(field_owner); // Reconfigure elements kinds of |map2|, which should generalize // representations in |map|. @@ -1690,11 +1690,11 @@ static void TestReconfigureElementsKind_GeneralizeRepresentationTrivial( CHECK(map2->is_stable()); CHECK(expectations2.Check(*map2)); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); Handle<Map> field_owner(map->FindFieldOwner(kDiffProp), isolate); CompilationDependencies dependencies(isolate, &zone); CHECK(!dependencies.HasAborted()); - dependencies.AssumeFieldType(field_owner); + dependencies.AssumeFieldOwner(field_owner); // Reconfigure elements kinds of |map2|, which should generalize // representations in |map|. @@ -2332,7 +2332,7 @@ TEST(TransitionDataFieldToDataField) { Isolate* isolate = CcTest::i_isolate(); Handle<FieldType> any_type = FieldType::Any(isolate); - Handle<Object> value1 = handle(Smi::FromInt(0), isolate); + Handle<Object> value1 = handle(Smi::kZero, isolate); TransitionToDataFieldOperator transition_op1(Representation::Smi(), any_type, value1); @@ -2416,7 +2416,7 @@ TEST(FieldTypeConvertSimple) { v8::HandleScope scope(CcTest::isolate()); Isolate* isolate = CcTest::i_isolate(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); CHECK_EQ(FieldType::Any()->Convert(&zone), AstType::NonInternal()); CHECK_EQ(FieldType::None()->Convert(&zone), AstType::None()); diff --git a/deps/v8/test/cctest/test-func-name-inference.cc b/deps/v8/test/cctest/test-func-name-inference.cc index 4b16c031d9..8c43bbfa54 100644 --- a/deps/v8/test/cctest/test-func-name-inference.cc +++ b/deps/v8/test/cctest/test-func-name-inference.cc @@ -141,6 +141,19 @@ TEST(LocalVar) { CheckFunctionName(script, "return 2", "fun2"); } +TEST(ObjectProperty) { + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + + v8::Local<v8::Script> script = + Compile(CcTest::isolate(), + "var obj = {\n" + " fun1: function() { return 1; },\n" + " fun2: class { constructor() { return 2; } }\n" + "}"); + CheckFunctionName(script, "return 1", "obj.fun1"); + CheckFunctionName(script, "return 2", "obj.fun2"); +} TEST(InConstructor) { CcTest::InitializeVM(); diff --git a/deps/v8/test/cctest/test-global-handles.cc b/deps/v8/test/cctest/test-global-handles.cc index d777432f2f..256b74c616 100644 --- a/deps/v8/test/cctest/test-global-handles.cc +++ b/deps/v8/test/cctest/test-global-handles.cc @@ -467,8 +467,8 @@ TEST(PhatomHandlesWithoutCallbacks) { g2.SetWeak(); } - CHECK_EQ(0, isolate->NumberOfPhantomHandleResetsSinceLastCall()); + CHECK_EQ(0u, isolate->NumberOfPhantomHandleResetsSinceLastCall()); CcTest::CollectAllAvailableGarbage(); - CHECK_EQ(2, isolate->NumberOfPhantomHandleResetsSinceLastCall()); - CHECK_EQ(0, isolate->NumberOfPhantomHandleResetsSinceLastCall()); + CHECK_EQ(2u, isolate->NumberOfPhantomHandleResetsSinceLastCall()); + CHECK_EQ(0u, isolate->NumberOfPhantomHandleResetsSinceLastCall()); } diff --git a/deps/v8/test/cctest/test-heap-profiler.cc b/deps/v8/test/cctest/test-heap-profiler.cc index 17893b3b48..9721477b28 100644 --- a/deps/v8/test/cctest/test-heap-profiler.cc +++ b/deps/v8/test/cctest/test-heap-profiler.cc @@ -360,7 +360,7 @@ TEST(HeapSnapshotCodeObjects) { } } CHECK(compiled_references_x); - if (i::FLAG_lazy && !(i::FLAG_ignition && i::FLAG_ignition_eager)) { + if (i::FLAG_lazy) { CHECK(!lazy_references_x); } } @@ -2443,7 +2443,7 @@ TEST(CheckCodeNames) { CHECK(node); const char* builtin_path1[] = {"::(GC roots)", "::(Builtins)", - "::(KeyedLoadIC_Megamorphic builtin)"}; + "::(KeyedLoadIC_Slow builtin)"}; node = GetNodeByPath(snapshot, builtin_path1, arraysize(builtin_path1)); CHECK(node); diff --git a/deps/v8/test/cctest/test-liveedit.cc b/deps/v8/test/cctest/test-liveedit.cc index 6cc6c70214..7525676b84 100644 --- a/deps/v8/test/cctest/test-liveedit.cc +++ b/deps/v8/test/cctest/test-liveedit.cc @@ -96,7 +96,7 @@ void CompareStringsOneWay(const char* s1, const char* s2, StringCompareInput input(s1, s2); v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); DiffChunkStruct* first_chunk; ListDiffOutputWriter writer(&first_chunk, &zone); diff --git a/deps/v8/test/cctest/test-log-stack-tracer.cc b/deps/v8/test/cctest/test-log-stack-tracer.cc index a4bd2ed0dd..09257bcda2 100644 --- a/deps/v8/test/cctest/test-log-stack-tracer.cc +++ b/deps/v8/test/cctest/test-log-stack-tracer.cc @@ -81,9 +81,8 @@ static void construct_call(const v8::FunctionCallbackInfo<v8::Value>& args) { frame_iterator.Advance(); CHECK(frame_iterator.frame()->is_construct()); frame_iterator.Advance(); - if (i::FLAG_ignition) { + if (frame_iterator.frame()->type() == i::StackFrame::STUB) { // Skip over bytecode handler frame. - CHECK(frame_iterator.frame()->type() == i::StackFrame::STUB); frame_iterator.Advance(); } i::StackFrame* calling_frame = frame_iterator.frame(); diff --git a/deps/v8/test/cctest/test-macro-assembler-arm.cc b/deps/v8/test/cctest/test-macro-assembler-arm.cc index 24ab60e972..06efc58cfa 100644 --- a/deps/v8/test/cctest/test-macro-assembler-arm.cc +++ b/deps/v8/test/cctest/test-macro-assembler-arm.cc @@ -42,98 +42,6 @@ typedef void* (*F)(int x, int y, int p2, int p3, int p4); #define __ masm-> - -static byte to_non_zero(int n) { - return static_cast<unsigned>(n) % 255 + 1; -} - - -static bool all_zeroes(const byte* beg, const byte* end) { - CHECK(beg); - CHECK(beg <= end); - while (beg < end) { - if (*beg++ != 0) - return false; - } - return true; -} - - -TEST(CopyBytes) { - CcTest::InitializeVM(); - Isolate* isolate = CcTest::i_isolate(); - HandleScope handles(isolate); - - const int data_size = 1 * KB; - size_t act_size; - - // Allocate two blocks to copy data between. - byte* src_buffer = - static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); - CHECK(src_buffer); - CHECK(act_size >= static_cast<size_t>(data_size)); - byte* dest_buffer = - static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); - CHECK(dest_buffer); - CHECK(act_size >= static_cast<size_t>(data_size)); - - // Storage for R0 and R1. - byte* r0_; - byte* r1_; - - MacroAssembler assembler(isolate, NULL, 0, - v8::internal::CodeObjectRequired::kYes); - MacroAssembler* masm = &assembler; - - // Code to be generated: The stuff in CopyBytes followed by a store of R0 and - // R1, respectively. - __ CopyBytes(r0, r1, r2, r3); - __ mov(r2, Operand(reinterpret_cast<int>(&r0_))); - __ mov(r3, Operand(reinterpret_cast<int>(&r1_))); - __ str(r0, MemOperand(r2)); - __ str(r1, MemOperand(r3)); - __ bx(lr); - - CodeDesc desc; - masm->GetCode(&desc); - Handle<Code> code = isolate->factory()->NewCode( - desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); - - F f = FUNCTION_CAST<F>(code->entry()); - - // Initialise source data with non-zero bytes. - for (int i = 0; i < data_size; i++) { - src_buffer[i] = to_non_zero(i); - } - - const int fuzz = 11; - - for (int size = 0; size < 600; size++) { - for (const byte* src = src_buffer; src < src_buffer + fuzz; src++) { - for (byte* dest = dest_buffer; dest < dest_buffer + fuzz; dest++) { - memset(dest_buffer, 0, data_size); - CHECK(dest + size < dest_buffer + data_size); - (void)CALL_GENERATED_CODE(isolate, f, reinterpret_cast<int>(src), - reinterpret_cast<int>(dest), size, 0, 0); - // R0 and R1 should point at the first byte after the copied data. - CHECK_EQ(src + size, r0_); - CHECK_EQ(dest + size, r1_); - // Check that we haven't written outside the target area. - CHECK(all_zeroes(dest_buffer, dest)); - CHECK(all_zeroes(dest + size, dest_buffer + data_size)); - // Check the target area. - CHECK_EQ(0, memcmp(src, dest, size)); - } - } - } - - // Check that the source data hasn't been clobbered. - for (int i = 0; i < data_size; i++) { - CHECK(src_buffer[i] == to_non_zero(i)); - } -} - - typedef int (*F5)(void*, void*, void*, void*, void*); diff --git a/deps/v8/test/cctest/test-macro-assembler-mips.cc b/deps/v8/test/cctest/test-macro-assembler-mips.cc index 9561db691e..2f3edee7da 100644 --- a/deps/v8/test/cctest/test-macro-assembler-mips.cc +++ b/deps/v8/test/cctest/test-macro-assembler-mips.cc @@ -44,22 +44,6 @@ typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); #define __ masm-> - -static byte to_non_zero(int n) { - return static_cast<unsigned>(n) % 255 + 1; -} - - -static bool all_zeroes(const byte* beg, const byte* end) { - CHECK(beg); - CHECK(beg <= end); - while (beg < end) { - if (*beg++ != 0) - return false; - } - return true; -} - TEST(BYTESWAP) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); @@ -126,81 +110,6 @@ TEST(BYTESWAP) { CHECK_EQ(static_cast<int32_t>(0xDE2C0000), t.r5); } -TEST(CopyBytes) { - CcTest::InitializeVM(); - Isolate* isolate = CcTest::i_isolate(); - HandleScope handles(isolate); - - const int data_size = 1 * KB; - size_t act_size; - - // Allocate two blocks to copy data between. - byte* src_buffer = - static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); - CHECK(src_buffer); - CHECK(act_size >= static_cast<size_t>(data_size)); - byte* dest_buffer = - static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); - CHECK(dest_buffer); - CHECK(act_size >= static_cast<size_t>(data_size)); - - // Storage for a0 and a1. - byte* a0_; - byte* a1_; - - MacroAssembler assembler(isolate, NULL, 0, - v8::internal::CodeObjectRequired::kYes); - MacroAssembler* masm = &assembler; - - // Code to be generated: The stuff in CopyBytes followed by a store of a0 and - // a1, respectively. - __ CopyBytes(a0, a1, a2, a3); - __ li(a2, Operand(reinterpret_cast<int>(&a0_))); - __ li(a3, Operand(reinterpret_cast<int>(&a1_))); - __ sw(a0, MemOperand(a2)); - __ jr(ra); - __ sw(a1, MemOperand(a3)); - - CodeDesc desc; - masm->GetCode(&desc); - Handle<Code> code = isolate->factory()->NewCode( - desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); - - ::F f = FUNCTION_CAST< ::F>(code->entry()); - - // Initialise source data with non-zero bytes. - for (int i = 0; i < data_size; i++) { - src_buffer[i] = to_non_zero(i); - } - - const int fuzz = 11; - - for (int size = 0; size < 600; size++) { - for (const byte* src = src_buffer; src < src_buffer + fuzz; src++) { - for (byte* dest = dest_buffer; dest < dest_buffer + fuzz; dest++) { - memset(dest_buffer, 0, data_size); - CHECK(dest + size < dest_buffer + data_size); - (void)CALL_GENERATED_CODE(isolate, f, reinterpret_cast<int>(src), - reinterpret_cast<int>(dest), size, 0, 0); - // a0 and a1 should point at the first byte after the copied data. - CHECK_EQ(src + size, a0_); - CHECK_EQ(dest + size, a1_); - // Check that we haven't written outside the target area. - CHECK(all_zeroes(dest_buffer, dest)); - CHECK(all_zeroes(dest + size, dest_buffer + data_size)); - // Check the target area. - CHECK_EQ(0, memcmp(src, dest, size)); - } - } - } - - // Check that the source data hasn't been clobbered. - for (int i = 0; i < data_size; i++) { - CHECK(src_buffer[i] == to_non_zero(i)); - } -} - - static void TestNaN(const char *code) { // NaN value is different on MIPS and x86 architectures, and TEST(NaNx) // tests checks the case where a x86 NaN value is serialized into the diff --git a/deps/v8/test/cctest/test-macro-assembler-mips64.cc b/deps/v8/test/cctest/test-macro-assembler-mips64.cc index 1dc260ff01..04811f6af5 100644 --- a/deps/v8/test/cctest/test-macro-assembler-mips64.cc +++ b/deps/v8/test/cctest/test-macro-assembler-mips64.cc @@ -45,22 +45,6 @@ typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); #define __ masm-> - -static byte to_non_zero(int n) { - return static_cast<unsigned>(n) % 255 + 1; -} - - -static bool all_zeroes(const byte* beg, const byte* end) { - CHECK(beg); - CHECK(beg <= end); - while (beg < end) { - if (*beg++ != 0) - return false; - } - return true; -} - TEST(BYTESWAP) { DCHECK(kArchVariant == kMips64r6 || kArchVariant == kMips64r2); CcTest::InitializeVM(); @@ -145,81 +129,6 @@ TEST(BYTESWAP) { CHECK_EQ(static_cast<int64_t>(0xC3151AC800000000), t.r7); } -TEST(CopyBytes) { - CcTest::InitializeVM(); - Isolate* isolate = CcTest::i_isolate(); - HandleScope handles(isolate); - - const int data_size = 1 * KB; - size_t act_size; - - // Allocate two blocks to copy data between. - byte* src_buffer = - static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); - CHECK(src_buffer); - CHECK(act_size >= static_cast<size_t>(data_size)); - byte* dest_buffer = - static_cast<byte*>(v8::base::OS::Allocate(data_size, &act_size, 0)); - CHECK(dest_buffer); - CHECK(act_size >= static_cast<size_t>(data_size)); - - // Storage for a0 and a1. - byte* a0_; - byte* a1_; - - MacroAssembler assembler(isolate, NULL, 0, - v8::internal::CodeObjectRequired::kYes); - MacroAssembler* masm = &assembler; - - // Code to be generated: The stuff in CopyBytes followed by a store of a0 and - // a1, respectively. - __ CopyBytes(a0, a1, a2, a3); - __ li(a2, Operand(reinterpret_cast<int64_t>(&a0_))); - __ li(a3, Operand(reinterpret_cast<int64_t>(&a1_))); - __ sd(a0, MemOperand(a2)); - __ jr(ra); - __ sd(a1, MemOperand(a3)); - - CodeDesc desc; - masm->GetCode(&desc); - Handle<Code> code = isolate->factory()->NewCode( - desc, Code::ComputeFlags(Code::STUB), Handle<Code>()); - - ::F f = FUNCTION_CAST< ::F>(code->entry()); - - // Initialise source data with non-zero bytes. - for (int i = 0; i < data_size; i++) { - src_buffer[i] = to_non_zero(i); - } - - const int fuzz = 11; - - for (int size = 0; size < 600; size++) { - for (const byte* src = src_buffer; src < src_buffer + fuzz; src++) { - for (byte* dest = dest_buffer; dest < dest_buffer + fuzz; dest++) { - memset(dest_buffer, 0, data_size); - CHECK(dest + size < dest_buffer + data_size); - (void)CALL_GENERATED_CODE(isolate, f, reinterpret_cast<int64_t>(src), - reinterpret_cast<int64_t>(dest), size, 0, 0); - // a0 and a1 should point at the first byte after the copied data. - CHECK_EQ(src + size, a0_); - CHECK_EQ(dest + size, a1_); - // Check that we haven't written outside the target area. - CHECK(all_zeroes(dest_buffer, dest)); - CHECK(all_zeroes(dest + size, dest_buffer + data_size)); - // Check the target area. - CHECK_EQ(0, memcmp(src, dest, size)); - } - } - } - - // Check that the source data hasn't been clobbered. - for (int i = 0; i < data_size; i++) { - CHECK(src_buffer[i] == to_non_zero(i)); - } -} - - TEST(LoadConstants) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); diff --git a/deps/v8/test/cctest/test-macro-assembler-x64.cc b/deps/v8/test/cctest/test-macro-assembler-x64.cc index cfdb75d1e8..1f6c247288 100644 --- a/deps/v8/test/cctest/test-macro-assembler-x64.cc +++ b/deps/v8/test/cctest/test-macro-assembler-x64.cc @@ -176,7 +176,7 @@ TEST(SmiMove) { EntryCode(masm); Label exit; - TestMoveSmi(masm, &exit, 1, Smi::FromInt(0)); + TestMoveSmi(masm, &exit, 1, Smi::kZero); TestMoveSmi(masm, &exit, 2, Smi::FromInt(127)); TestMoveSmi(masm, &exit, 3, Smi::FromInt(128)); TestMoveSmi(masm, &exit, 4, Smi::FromInt(255)); @@ -315,7 +315,7 @@ TEST(Integer32ToSmi) { __ movq(rax, Immediate(1)); // Test number. __ movl(rcx, Immediate(0)); __ Integer32ToSmi(rcx, rcx); - __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); + __ Set(rdx, reinterpret_cast<intptr_t>(Smi::kZero)); __ cmpq(rcx, rdx); __ j(not_equal, &exit); @@ -352,7 +352,7 @@ TEST(Integer32ToSmi) { __ movq(rax, Immediate(6)); // Test number. __ movl(rcx, Immediate(0)); __ Integer32ToSmi(r8, rcx); - __ Set(rdx, reinterpret_cast<intptr_t>(Smi::FromInt(0))); + __ Set(rdx, reinterpret_cast<intptr_t>(Smi::kZero)); __ cmpq(r8, rdx); __ j(not_equal, &exit); diff --git a/deps/v8/test/cctest/test-modules.cc b/deps/v8/test/cctest/test-modules.cc index c33a5a124b..e086a407f9 100644 --- a/deps/v8/test/cctest/test-modules.cc +++ b/deps/v8/test/cctest/test-modules.cc @@ -21,16 +21,14 @@ using v8::Value; MaybeLocal<Module> AlwaysEmptyResolveCallback(Local<Context> context, Local<String> specifier, - Local<Module> referrer, - Local<Value> data) { + Local<Module> referrer) { return MaybeLocal<Module>(); } static int g_count = 0; MaybeLocal<Module> FailOnSecondCallResolveCallback(Local<Context> context, Local<String> specifier, - Local<Module> referrer, - Local<Value> data) { + Local<Module> referrer) { if (g_count++ > 0) return MaybeLocal<Module>(); Local<String> source_text = v8_str(""); ScriptOrigin origin(v8_str("module.js")); @@ -67,8 +65,7 @@ TEST(ModuleInstantiationFailures) { } static MaybeLocal<Module> CompileSpecifierAsModuleResolveCallback( - Local<Context> context, Local<String> specifier, Local<Module> referrer, - Local<Value> data) { + Local<Context> context, Local<String> specifier, Local<Module> referrer) { ScriptOrigin origin(v8_str("module.js")); ScriptCompiler::Source source(specifier, origin); return ScriptCompiler::CompileModule(CcTest::isolate(), &source) @@ -93,19 +90,4 @@ TEST(ModuleEvaluation) { 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-parsing.cc b/deps/v8/test/cctest/test-parsing.cc index 921cebcad6..5a5a734236 100644 --- a/deps/v8/test/cctest/test-parsing.cc +++ b/deps/v8/test/cctest/test-parsing.cc @@ -168,36 +168,38 @@ TEST(ScanHTMLEndComments) { for (int i = 0; tests[i]; i++) { const char* source = tests[i]; auto stream = i::ScannerStream::ForTesting(source); - i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(stream.get()); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::AstValueFactory ast_value_factory( &zone, CcTest::i_isolate()->heap()->HashSeed()); - i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, - stack_limit); + i::PendingCompilationErrorHandler pending_error_handler; + i::PreParser preparser( + &zone, &scanner, &ast_value_factory, &pending_error_handler, + CcTest::i_isolate()->counters()->runtime_call_stats(), stack_limit); preparser.set_allow_lazy(true); i::PreParser::PreParseResult result = preparser.PreParseProgram(); CHECK_EQ(i::PreParser::kPreParseSuccess, result); - CHECK(!log.HasError()); + CHECK(!pending_error_handler.has_pending_error()); } for (int i = 0; fail_tests[i]; i++) { const char* source = fail_tests[i]; auto stream = i::ScannerStream::ForTesting(source); - i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(stream.get()); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::AstValueFactory ast_value_factory( &zone, CcTest::i_isolate()->heap()->HashSeed()); - i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, - stack_limit); + i::PendingCompilationErrorHandler pending_error_handler; + i::PreParser preparser( + &zone, &scanner, &ast_value_factory, &pending_error_handler, + CcTest::i_isolate()->counters()->runtime_call_stats(), stack_limit); preparser.set_allow_lazy(true); i::PreParser::PreParseResult result = preparser.PreParseProgram(); // Even in the case of a syntax error, kPreParseSuccess is returned. CHECK_EQ(i::PreParser::kPreParseSuccess, result); - CHECK(log.HasError()); + CHECK(pending_error_handler.has_pending_error()); } } @@ -218,7 +220,7 @@ class ScriptResource : public v8::String::ExternalOneByteStringResource { TEST(UsingCachedData) { // Producing cached parser data while parsing eagerly is not supported. - if (!i::FLAG_lazy || (i::FLAG_ignition && i::FLAG_ignition_eager)) return; + if (!i::FLAG_lazy) return; v8::Isolate* isolate = CcTest::isolate(); v8::HandleScope handles(isolate); @@ -271,7 +273,7 @@ TEST(UsingCachedData) { TEST(PreparseFunctionDataIsUsed) { // Producing cached parser data while parsing eagerly is not supported. - if (!i::FLAG_lazy || (i::FLAG_ignition && i::FLAG_ignition_eager)) return; + if (!i::FLAG_lazy) return; // This tests that we actually do use the function data generated by the // preparser. @@ -287,14 +289,30 @@ TEST(PreparseFunctionDataIsUsed) { i::GetCurrentStackPosition() - 128 * 1024); const char* good_code[] = { - "function this_is_lazy() { var a; } function foo() { return 25; } foo();", - "var this_is_lazy = () => { var a; }; var foo = () => 25; foo();", + "function z() { var a; } function f() { return 25; } f();", + "var z = function () { var a; }; function f() { return 25; } f();", + "function *z() { var a; } function f() { return 25; } f();", + "var z = function *() { var a; }; function f() { return 25; } f();", + "function z(p1, p2) { var a; } function f() { return 25; } f();", + "var z = function (p1, p2) { var a; }; function f() { return 25; } f();", + "function *z(p1, p2) { var a; } function f() { return 25; } f();", + "var z = function *(p1, p2) { var a; }; function f() { return 25; } f();", + "var z = () => { var a; }; function f() { return 25; } f();", + "var z = (p1, p2) => { var a; }; function f() { return 25; } f();", }; // Insert a syntax error inside the lazy function. const char* bad_code[] = { - "function this_is_lazy() { if ( } function foo() { return 25; } foo();", - "var this_is_lazy = () => { if ( }; var foo = () => 25; foo();", + "function z() { if ( } function f() { return 25; } f();", + "var z = function () { if ( }; function f() { return 25; } f();", + "function *z() { if ( } function f() { return 25; } f();", + "var z = function *() { if ( }; function f() { return 25; } f();", + "function z(p1, p2) { if ( } function f() { return 25; } f();", + "var z = function (p1, p2) { if ( }; function f() { return 25; } f();", + "function *z(p1, p2) { if ( } function f() { return 25; } f();", + "var z = function *(p1, p2) { if ( }; function f() { return 25; } f();", + "var z = () => { if ( }; function f() { return 25; } f();", + "var z = (p1, p2) => { if ( }; function f() { return 25; } f();", }; for (unsigned i = 0; i < arraysize(good_code); i++) { @@ -342,20 +360,21 @@ TEST(StandAlonePreParser) { uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); for (int i = 0; programs[i]; i++) { auto stream = i::ScannerStream::ForTesting(programs[i]); - i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(stream.get()); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::AstValueFactory ast_value_factory( &zone, CcTest::i_isolate()->heap()->HashSeed()); - i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, - stack_limit); + i::PendingCompilationErrorHandler pending_error_handler; + i::PreParser preparser( + &zone, &scanner, &ast_value_factory, &pending_error_handler, + CcTest::i_isolate()->counters()->runtime_call_stats(), stack_limit); preparser.set_allow_lazy(true); preparser.set_allow_natives(true); i::PreParser::PreParseResult result = preparser.PreParseProgram(); CHECK_EQ(i::PreParser::kPreParseSuccess, result); - CHECK(!log.HasError()); + CHECK(!pending_error_handler.has_pending_error()); } } @@ -363,6 +382,7 @@ TEST(StandAlonePreParser) { TEST(StandAlonePreParserNoNatives) { v8::V8::Initialize(); + i::Isolate* isolate = CcTest::i_isolate(); CcTest::i_isolate()->stack_guard()->SetStackLimit( i::GetCurrentStackPosition() - 128 * 1024); @@ -372,23 +392,24 @@ TEST(StandAlonePreParserNoNatives) { NULL }; - uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); + uintptr_t stack_limit = isolate->stack_guard()->real_climit(); for (int i = 0; programs[i]; i++) { auto stream = i::ScannerStream::ForTesting(programs[i]); - i::CompleteParserRecorder log; - i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); + i::Scanner scanner(isolate->unicode_cache()); scanner.Initialize(stream.get()); // Preparser defaults to disallowing natives syntax. - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::AstValueFactory ast_value_factory( &zone, CcTest::i_isolate()->heap()->HashSeed()); - i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, - stack_limit); + i::PendingCompilationErrorHandler pending_error_handler; + i::PreParser preparser( + &zone, &scanner, &ast_value_factory, &pending_error_handler, + isolate->counters()->runtime_call_stats(), stack_limit); preparser.set_allow_lazy(true); i::PreParser::PreParseResult result = preparser.PreParseProgram(); CHECK_EQ(i::PreParser::kPreParseSuccess, result); - CHECK(log.HasError()); + CHECK(pending_error_handler.has_pending_error()); } } @@ -444,97 +465,92 @@ TEST(RegressChromium62639) { // failed in debug mode, and sometimes crashed in release mode. auto stream = i::ScannerStream::ForTesting(program); - i::CompleteParserRecorder log; i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); scanner.Initialize(stream.get()); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::AstValueFactory ast_value_factory(&zone, CcTest::i_isolate()->heap()->HashSeed()); - i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, + i::PendingCompilationErrorHandler pending_error_handler; + i::PreParser preparser(&zone, &scanner, &ast_value_factory, + &pending_error_handler, + isolate->counters()->runtime_call_stats(), CcTest::i_isolate()->stack_guard()->real_climit()); preparser.set_allow_lazy(true); i::PreParser::PreParseResult result = preparser.PreParseProgram(); // Even in the case of a syntax error, kPreParseSuccess is returned. CHECK_EQ(i::PreParser::kPreParseSuccess, result); - CHECK(log.HasError()); + CHECK(pending_error_handler.has_pending_error()); } TEST(Regress928) { - v8::V8::Initialize(); - i::Isolate* isolate = CcTest::i_isolate(); - - // Preparsing didn't consider the catch clause of a try statement - // as with-content, which made it assume that a function inside - // the block could be lazily compiled, and an extra, unexpected, - // entry was added to the data. - isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - - 128 * 1024); + // Test only applies when lazy parsing. + if (!i::FLAG_lazy) return; + i::FLAG_min_preparse_length = 0; + // Tests that the first non-toplevel function is not included in the preparse + // data. const char* program = "try { } catch (e) { var foo = function () { /* first */ } }" "var bar = function () { /* second */ }"; - v8::HandleScope handles(CcTest::isolate()); - auto stream = i::ScannerStream::ForTesting(program); - i::CompleteParserRecorder log; - i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); - scanner.Initialize(stream.get()); - 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, - CcTest::i_isolate()->stack_guard()->real_climit()); - preparser.set_allow_lazy(true); - i::PreParser::PreParseResult result = preparser.PreParseProgram(); - CHECK_EQ(i::PreParser::kPreParseSuccess, result); - i::ScriptData* sd = log.GetScriptData(); - i::ParseData* pd = i::ParseData::FromCachedData(sd); + v8::Isolate* isolate = CcTest::isolate(); + v8::HandleScope handles(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + v8::ScriptCompiler::Source script_source(v8_str(program)); + v8::ScriptCompiler::Compile(context, &script_source, + v8::ScriptCompiler::kProduceParserCache) + .ToLocalChecked(); + + const v8::ScriptCompiler::CachedData* cached_data = + script_source.GetCachedData(); + i::ScriptData script_data(cached_data->data, cached_data->length); + std::unique_ptr<i::ParseData> pd(i::ParseData::FromCachedData(&script_data)); pd->Initialize(); int first_function = static_cast<int>(strstr(program, "function") - program); - int first_lbrace = first_function + i::StrLength("function () "); - CHECK_EQ('{', program[first_lbrace]); - i::FunctionEntry entry1 = pd->GetFunctionEntry(first_lbrace); + int first_lparen = first_function + i::StrLength("function "); + CHECK_EQ('(', program[first_lparen]); + i::FunctionEntry entry1 = pd->GetFunctionEntry(first_lparen); CHECK(!entry1.is_valid()); int second_function = - static_cast<int>(strstr(program + first_lbrace, "function") - program); - int second_lbrace = - second_function + i::StrLength("function () "); - CHECK_EQ('{', program[second_lbrace]); - i::FunctionEntry entry2 = pd->GetFunctionEntry(second_lbrace); + static_cast<int>(strstr(program + first_lparen, "function") - program); + int second_lparen = second_function + i::StrLength("function "); + CHECK_EQ('(', program[second_lparen]); + i::FunctionEntry entry2 = pd->GetFunctionEntry(second_lparen); CHECK(entry2.is_valid()); CHECK_EQ('}', program[entry2.end_pos() - 1]); - delete sd; - delete pd; } TEST(PreParseOverflow) { v8::V8::Initialize(); + i::Isolate* isolate = CcTest::i_isolate(); - CcTest::i_isolate()->stack_guard()->SetStackLimit( - i::GetCurrentStackPosition() - 128 * 1024); + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - + 128 * 1024); size_t kProgramSize = 1024 * 1024; std::unique_ptr<char[]> program(i::NewArray<char>(kProgramSize + 1)); memset(program.get(), '(', kProgramSize); program[kProgramSize] = '\0'; - uintptr_t stack_limit = CcTest::i_isolate()->stack_guard()->real_climit(); + uintptr_t stack_limit = isolate->stack_guard()->real_climit(); auto stream = i::ScannerStream::ForTesting(program.get(), kProgramSize); - i::CompleteParserRecorder log; - i::Scanner scanner(CcTest::i_isolate()->unicode_cache()); + i::Scanner scanner(isolate->unicode_cache()); scanner.Initialize(stream.get()); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::AstValueFactory ast_value_factory(&zone, CcTest::i_isolate()->heap()->HashSeed()); - i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, - stack_limit); + i::PendingCompilationErrorHandler pending_error_handler; + i::PreParser preparser( + &zone, &scanner, &ast_value_factory, &pending_error_handler, + isolate->counters()->runtime_call_stats(), stack_limit); preparser.set_allow_lazy(true); i::PreParser::PreParseResult result = preparser.PreParseProgram(); CHECK_EQ(i::PreParser::kPreParseStackOverflow, result); @@ -630,7 +646,7 @@ void TestScanRegExp(const char* re_source, const char* expected) { CHECK(start == i::Token::DIV || start == i::Token::ASSIGN_DIV); CHECK(scanner.ScanRegExpPattern()); scanner.Next(); // Current token is now the regexp literal. - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::AstValueFactory ast_value_factory(&zone, CcTest::i_isolate()->heap()->HashSeed()); const i::AstRawString* current_symbol = @@ -807,10 +823,9 @@ TEST(ScopeUsesArgumentsSuperThis) { factory->NewStringFromUtf8(i::CStrVector(program.start())) .ToHandleChecked(); i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::ParseInfo info(&zone, script); i::Parser parser(&info); - info.set_global(); CHECK(parser.Parse(&info)); CHECK(i::Rewriter::Rewrite(&info)); i::DeclarationScope::Analyze(&info, i::AnalyzeMode::kRegular); @@ -866,16 +881,14 @@ static void CheckParsesToNumber(const char* source, bool with_dot) { i::ParseInfo info(handles.main_zone(), script); i::Parser parser(&info); - info.set_global(); - info.set_lazy(false); info.set_allow_lazy_parsing(false); info.set_toplevel(true); CHECK(i::Compiler::ParseAndAnalyze(&info)); - CHECK(info.scope()->declarations()->length() == 1); - i::FunctionLiteral* fun = - info.scope()->declarations()->at(0)->AsFunctionDeclaration()->fun(); + CHECK_EQ(1, info.scope()->declarations()->LengthForTest()); + i::Declaration* decl = info.scope()->declarations()->AtForTest(0); + i::FunctionLiteral* fun = decl->AsFunctionDeclaration()->fun(); CHECK(fun->body()->length() == 1); CHECK(fun->body()->at(0)->IsReturnStatement()); i::ReturnStatement* ret = fun->body()->at(0)->AsReturnStatement(); @@ -1164,11 +1177,10 @@ TEST(ScopePositions) { i::CStrVector(program.start())).ToHandleChecked(); CHECK_EQ(source->length(), kProgramSize); i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::ParseInfo info(&zone, script); i::Parser parser(&info); parser.set_allow_lazy(true); - info.set_global(); info.set_language_mode(source_data[i].language_mode); parser.Parse(&info); CHECK(info.literal() != NULL); @@ -1214,7 +1226,7 @@ TEST(DiscardFunctionBody) { i::Handle<i::String> source_code = factory->NewStringFromUtf8(i::CStrVector(source)).ToHandleChecked(); i::Handle<i::Script> script = factory->NewScript(source_code); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::ParseInfo info(&zone, script); info.set_allow_lazy_parsing(); i::Parser parser(&info); @@ -1228,8 +1240,11 @@ TEST(DiscardFunctionBody) { AsCall()->expression()->AsFunctionLiteral(); i::Scope* inner_scope = inner->scope(); i::FunctionLiteral* fun = nullptr; - if (inner_scope->declarations()->length() > 0) { - fun = inner_scope->declarations()->at(0)->AsFunctionDeclaration()->fun(); + if (!inner_scope->declarations()->is_empty()) { + fun = inner_scope->declarations() + ->AtForTest(0) + ->AsFunctionDeclaration() + ->fun(); } else { // TODO(conradw): This path won't be hit until the other test cases can be // uncommented. @@ -1264,33 +1279,10 @@ const char* ReadString(unsigned* start) { } -i::Handle<i::String> FormatMessage(i::Vector<unsigned> data) { - i::Isolate* isolate = CcTest::i_isolate(); - int message = data[i::PreparseDataConstants::kMessageTemplatePos]; - int arg_count = data[i::PreparseDataConstants::kMessageArgCountPos]; - i::Handle<i::Object> arg_object; - if (arg_count == 1) { - // Position after text found by skipping past length field and - // length field content words. - const char* arg = - ReadString(&data[i::PreparseDataConstants::kMessageArgPos]); - arg_object = v8::Utils::OpenHandle(*v8_str(arg)); - i::DeleteArray(arg); - } else { - CHECK_EQ(0, arg_count); - arg_object = isolate->factory()->undefined_value(); - } - - data.Dispose(); - return i::MessageTemplate::FormatMessage(isolate, message, arg_object); -} - enum ParserFlag { kAllowLazy, kAllowNatives, kAllowHarmonyFunctionSent, - kAllowHarmonyRestrictiveDeclarations, - kAllowHarmonyForIn, kAllowHarmonyAsyncAwait, kAllowHarmonyRestrictiveGenerators, kAllowHarmonyTrailingCommas, @@ -1310,9 +1302,6 @@ void SetParserFlags(i::ParserBase<Traits>* parser, parser->set_allow_natives(flags.Contains(kAllowNatives)); parser->set_allow_harmony_function_sent( flags.Contains(kAllowHarmonyFunctionSent)); - parser->set_allow_harmony_restrictive_declarations( - flags.Contains(kAllowHarmonyRestrictiveDeclarations)); - parser->set_allow_harmony_for_in(flags.Contains(kAllowHarmonyForIn)); parser->set_allow_harmony_async_await( flags.Contains(kAllowHarmonyAsyncAwait)); parser->set_allow_harmony_restrictive_generators( @@ -1337,37 +1326,33 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, int parser_materialized_literals = -2; // Preparse the data. - i::CompleteParserRecorder log; + i::PendingCompilationErrorHandler pending_error_handler; if (test_preparser) { i::Scanner scanner(isolate->unicode_cache()); std::unique_ptr<i::Utf16CharacterStream> stream( i::ScannerStream::For(source)); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::AstValueFactory ast_value_factory( &zone, CcTest::i_isolate()->heap()->HashSeed()); - i::PreParser preparser(&zone, &scanner, &ast_value_factory, &log, - stack_limit); + i::PreParser preparser( + &zone, &scanner, &ast_value_factory, &pending_error_handler, + isolate->counters()->runtime_call_stats(), stack_limit); SetParserFlags(&preparser, flags); scanner.Initialize(stream.get()); i::PreParser::PreParseResult result = preparser.PreParseProgram(&preparser_materialized_literals, is_module); CHECK_EQ(i::PreParser::kPreParseSuccess, result); } - bool preparse_error = log.HasError(); // Parse the data i::FunctionLiteral* function; { i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::ParseInfo info(&zone, script); i::Parser parser(&info); SetParserFlags(&parser, flags); - if (is_module) { - info.set_module(); - } else { - info.set_global(); - } + if (is_module) info.set_module(); parser.Parse(&info); function = info.literal(); if (function) { @@ -1397,7 +1382,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, CHECK(false); } - if (test_preparser && !preparse_error) { + if (test_preparser && !pending_error_handler.has_pending_error()) { v8::base::OS::Print( "Parser failed on:\n" "\t%s\n" @@ -1410,7 +1395,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, // Check that preparser and parser produce the same error. if (test_preparser) { i::Handle<i::String> preparser_message = - FormatMessage(log.ErrorMessageData()); + pending_error_handler.FormatMessage(CcTest::i_isolate()); if (!i::String::Equals(message_string, preparser_message)) { v8::base::OS::Print( "Expected parser and preparser to produce the same error on:\n" @@ -1423,7 +1408,7 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, CHECK(false); } } - } else if (test_preparser && preparse_error) { + } else if (test_preparser && pending_error_handler.has_pending_error()) { v8::base::OS::Print( "Preparser failed on:\n" "\t%s\n" @@ -1431,7 +1416,9 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, "\t%s\n" "However, the parser succeeded", source->ToCString().get(), - FormatMessage(log.ErrorMessageData())->ToCString().get()); + pending_error_handler.FormatMessage(CcTest::i_isolate()) + ->ToCString() + .get()); CHECK(false); } else if (result == kError) { v8::base::OS::Print( @@ -2493,7 +2480,7 @@ TEST(DontRegressPreParserDataSizes) { i::Handle<i::String> source = factory->NewStringFromUtf8(i::CStrVector(program)).ToHandleChecked(); i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::ParseInfo info(&zone, script); i::ScriptData* sd = NULL; info.set_cached_data(&sd); @@ -3154,7 +3141,7 @@ TEST(FuncNameInferrerEscaped) { TEST(RegressionLazyFunctionWithErrorWithArg) { // Test only applies when lazy parsing. - if (!i::FLAG_lazy || (i::FLAG_ignition && i::FLAG_ignition_eager)) return; + if (!i::FLAG_lazy) return; // The bug occurred when a lazy function had an error which requires a // parameter (such as "unknown label" here). The error message was processed @@ -3199,7 +3186,7 @@ TEST(SerializationOfMaybeAssignmentFlag) { i::Handle<i::String> source = factory->InternalizeUtf8String(program.start()); source->PrintOn(stdout); printf("\n"); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); v8::Local<v8::Value> v = CompileRun(src); i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); @@ -3249,7 +3236,7 @@ TEST(IfArgumentsArrayAccessedThenParametersMaybeAssigned) { i::Handle<i::String> source = factory->InternalizeUtf8String(program.start()); source->PrintOn(stdout); printf("\n"); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); v8::Local<v8::Value> v = CompileRun(src); i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); @@ -3280,7 +3267,7 @@ TEST(InnerAssignment) { const char* prefix = "function f() {"; const char* midfix = " function g() {"; - const char* suffix = "}}"; + const char* suffix = "}}; f"; struct { const char* source; bool assigned; bool strict; } outers[] = { // Actual assignments. { "var x; var x = 5;", true, false }, @@ -3360,10 +3347,6 @@ TEST(InnerAssignment) { { "(function(x) { eval(''); })", true, false }, }; - // 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); int prefix_len = Utf8LengthHelper(prefix); int midfix_len = Utf8LengthHelper(midfix); int suffix_len = Utf8LengthHelper(suffix); @@ -3376,33 +3359,44 @@ TEST(InnerAssignment) { 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; + int len = prefix_len + 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()); + i::SNPrintF(program, "%s%s%s%s%s", prefix, outer, midfix, inner, + suffix); + + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); + std::unique_ptr<i::ParseInfo> info; + if (lazy) { + printf("%s\n", program.start()); + v8::Local<v8::Value> v = CompileRun(program.start()); + i::Handle<i::Object> o = v8::Utils::OpenHandle(*v); + i::Handle<i::JSFunction> f = i::Handle<i::JSFunction>::cast(o); + i::Handle<i::SharedFunctionInfo> shared = i::handle(f->shared()); + info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, shared)); + } else { + i::Handle<i::String> source = + factory->InternalizeUtf8String(program.start()); + source->PrintOn(stdout); + printf("\n"); + i::Handle<i::Script> script = factory->NewScript(source); + info = std::unique_ptr<i::ParseInfo>(new i::ParseInfo(&zone, script)); + } + i::Parser parser(info.get()); + CHECK(parser.Parse(info.get())); + CHECK(i::Compiler::Analyze(info.get())); + CHECK(info->literal() != NULL); + + i::Scope* scope = info->literal()->scope(); + if (!lazy) { + scope = scope->inner_scope(); + } + DCHECK_NOT_NULL(scope); + DCHECK_NULL(scope->sibling()); + DCHECK(scope->is_function_scope()); const i::AstRawString* var_name = - info.ast_value_factory()->GetOneByteString("x"); - i::Variable* var = inner_scope->Lookup(var_name); + info->ast_value_factory()->GetOneByteString("x"); + i::Variable* var = scope->Lookup(var_name); bool expected = outers[i].assigned || inners[j].assigned; CHECK(var != NULL); CHECK(var->is_used() || !expected); @@ -5650,7 +5644,7 @@ TEST(BasicImportExportParsing) { // Show that parsing as a module works { i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::ParseInfo info(&zone, script); i::Parser parser(&info); info.set_module(); @@ -5676,10 +5670,9 @@ TEST(BasicImportExportParsing) { // And that parsing a script does not. { i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::ParseInfo info(&zone, script); i::Parser parser(&info); - info.set_global(); CHECK(!parser.Parse(&info)); isolate->clear_pending_exception(); } @@ -5769,7 +5762,7 @@ TEST(ImportExportParsingErrors) { factory->NewStringFromAsciiChecked(kErrorSources[i]); i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::ParseInfo info(&zone, script); i::Parser parser(&info); info.set_module(); @@ -5807,7 +5800,7 @@ TEST(ModuleTopLevelFunctionDecl) { factory->NewStringFromAsciiChecked(kErrorSources[i]); i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::ParseInfo info(&zone, script); i::Parser parser(&info); info.set_module(); @@ -6006,7 +5999,7 @@ TEST(ModuleParsingInternals) { "export {foob};"; i::Handle<i::String> source = factory->NewStringFromAsciiChecked(kSource); i::Handle<i::Script> script = factory->NewScript(source); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::ParseInfo info(&zone, script); i::Parser parser(&info); info.set_module(); @@ -6019,92 +6012,100 @@ TEST(ModuleParsingInternals) { 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()); + i::Declaration::List* declarations = module_scope->declarations(); + CHECK_EQ(13, declarations->LengthForTest()); - CHECK(declarations->at(0)->proxy()->raw_name()->IsOneByteEqualTo("x")); - CHECK(declarations->at(0)->proxy()->var()->mode() == i::LET); - CHECK(declarations->at(0)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(0)->proxy()->var()->location() == + CHECK(declarations->AtForTest(0)->proxy()->raw_name()->IsOneByteEqualTo("x")); + CHECK(declarations->AtForTest(0)->proxy()->var()->mode() == i::LET); + CHECK(declarations->AtForTest(0)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(0)->proxy()->var()->location() == i::VariableLocation::MODULE); - CHECK(declarations->at(1)->proxy()->raw_name()->IsOneByteEqualTo("z")); - CHECK(declarations->at(1)->proxy()->var()->mode() == i::CONST); - CHECK(declarations->at(1)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(1)->proxy()->var()->location() == + CHECK(declarations->AtForTest(1)->proxy()->raw_name()->IsOneByteEqualTo("z")); + CHECK(declarations->AtForTest(1)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->AtForTest(1)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(1)->proxy()->var()->location() == i::VariableLocation::MODULE); - CHECK(declarations->at(2)->proxy()->raw_name()->IsOneByteEqualTo("n")); - CHECK(declarations->at(2)->proxy()->var()->mode() == i::CONST); - CHECK(declarations->at(2)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(2)->proxy()->var()->location() == + CHECK(declarations->AtForTest(2)->proxy()->raw_name()->IsOneByteEqualTo("n")); + CHECK(declarations->AtForTest(2)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->AtForTest(2)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(2)->proxy()->var()->location() == i::VariableLocation::MODULE); - CHECK(declarations->at(3)->proxy()->raw_name()->IsOneByteEqualTo("foo")); - CHECK(declarations->at(3)->proxy()->var()->mode() == i::VAR); - CHECK(!declarations->at(3)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(3)->proxy()->var()->location() == + CHECK( + declarations->AtForTest(3)->proxy()->raw_name()->IsOneByteEqualTo("foo")); + CHECK(declarations->AtForTest(3)->proxy()->var()->mode() == i::VAR); + CHECK(!declarations->AtForTest(3)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(3)->proxy()->var()->location() == i::VariableLocation::MODULE); - CHECK(declarations->at(4)->proxy()->raw_name()->IsOneByteEqualTo("goo")); - CHECK(declarations->at(4)->proxy()->var()->mode() == i::LET); - CHECK(!declarations->at(4)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(4)->proxy()->var()->location() == + CHECK( + declarations->AtForTest(4)->proxy()->raw_name()->IsOneByteEqualTo("goo")); + CHECK(declarations->AtForTest(4)->proxy()->var()->mode() == i::LET); + CHECK(!declarations->AtForTest(4)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(4)->proxy()->var()->location() == i::VariableLocation::MODULE); - CHECK(declarations->at(5)->proxy()->raw_name()->IsOneByteEqualTo("hoo")); - CHECK(declarations->at(5)->proxy()->var()->mode() == i::LET); - CHECK(declarations->at(5)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(5)->proxy()->var()->location() == + CHECK( + declarations->AtForTest(5)->proxy()->raw_name()->IsOneByteEqualTo("hoo")); + CHECK(declarations->AtForTest(5)->proxy()->var()->mode() == i::LET); + CHECK(declarations->AtForTest(5)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(5)->proxy()->var()->location() == i::VariableLocation::MODULE); - CHECK(declarations->at(6)->proxy()->raw_name()->IsOneByteEqualTo("joo")); - CHECK(declarations->at(6)->proxy()->var()->mode() == i::CONST); - CHECK(declarations->at(6)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(6)->proxy()->var()->location() == + CHECK( + declarations->AtForTest(6)->proxy()->raw_name()->IsOneByteEqualTo("joo")); + CHECK(declarations->AtForTest(6)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->AtForTest(6)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(6)->proxy()->var()->location() == i::VariableLocation::MODULE); - CHECK( - declarations->at(7)->proxy()->raw_name()->IsOneByteEqualTo("*default*")); - CHECK(declarations->at(7)->proxy()->var()->mode() == i::CONST); - CHECK(declarations->at(7)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(7)->proxy()->var()->location() == + CHECK(declarations->AtForTest(7)->proxy()->raw_name()->IsOneByteEqualTo( + "*default*")); + CHECK(declarations->AtForTest(7)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->AtForTest(7)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(7)->proxy()->var()->location() == i::VariableLocation::MODULE); - CHECK( - declarations->at(8)->proxy()->raw_name()->IsOneByteEqualTo("nonexport")); - CHECK(declarations->at(8)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(8)->proxy()->var()->location() != + CHECK(declarations->AtForTest(8)->proxy()->raw_name()->IsOneByteEqualTo( + "nonexport")); + CHECK(declarations->AtForTest(8)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(8)->proxy()->var()->location() != i::VariableLocation::MODULE); - CHECK(declarations->at(9)->proxy()->raw_name()->IsOneByteEqualTo("mm")); - CHECK(declarations->at(9)->proxy()->var()->mode() == i::CONST); - CHECK(declarations->at(9)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(9)->proxy()->var()->location() == + CHECK( + declarations->AtForTest(9)->proxy()->raw_name()->IsOneByteEqualTo("mm")); + CHECK(declarations->AtForTest(9)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->AtForTest(9)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(9)->proxy()->var()->location() == i::VariableLocation::MODULE); - CHECK(declarations->at(10)->proxy()->raw_name()->IsOneByteEqualTo("aa")); - CHECK(declarations->at(10)->proxy()->var()->mode() == i::CONST); - CHECK(declarations->at(10)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(10)->proxy()->var()->location() == + CHECK( + declarations->AtForTest(10)->proxy()->raw_name()->IsOneByteEqualTo("aa")); + CHECK(declarations->AtForTest(10)->proxy()->var()->mode() == i::CONST); + CHECK(declarations->AtForTest(10)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(10)->proxy()->var()->location() == i::VariableLocation::MODULE); - CHECK(declarations->at(11)->proxy()->raw_name()->IsOneByteEqualTo("loo")); - CHECK(declarations->at(11)->proxy()->var()->mode() == i::CONST); - CHECK(!declarations->at(11)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(11)->proxy()->var()->location() != + CHECK(declarations->AtForTest(11)->proxy()->raw_name()->IsOneByteEqualTo( + "loo")); + CHECK(declarations->AtForTest(11)->proxy()->var()->mode() == i::CONST); + CHECK(!declarations->AtForTest(11)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(11)->proxy()->var()->location() != i::VariableLocation::MODULE); - CHECK(declarations->at(12)->proxy()->raw_name()->IsOneByteEqualTo("foob")); - CHECK(declarations->at(12)->proxy()->var()->mode() == i::CONST); - CHECK(!declarations->at(12)->proxy()->var()->binding_needs_init()); - CHECK(declarations->at(12)->proxy()->var()->location() == + CHECK(declarations->AtForTest(12)->proxy()->raw_name()->IsOneByteEqualTo( + "foob")); + CHECK(declarations->AtForTest(12)->proxy()->var()->mode() == i::CONST); + CHECK(!declarations->AtForTest(12)->proxy()->var()->binding_needs_init()); + CHECK(declarations->AtForTest(12)->proxy()->var()->location() == i::VariableLocation::MODULE); i::ModuleDescriptor* descriptor = module_scope->module(); CHECK_NOT_NULL(descriptor); - CHECK_EQ(5, descriptor->module_requests().size()); + CHECK_EQ(5u, descriptor->module_requests().size()); for (const auto& elem : descriptor->module_requests()) { if (elem.first->IsOneByteEqualTo("m.js")) CHECK_EQ(elem.second, 0); @@ -6126,34 +6127,34 @@ TEST(ModuleParsingInternals) { CheckEntry(descriptor->special_exports().at(2), "bb", nullptr, "aa", 0); // !!! - CHECK_EQ(8, descriptor->regular_exports().size()); + CHECK_EQ(8u, descriptor->regular_exports().size()); entry = descriptor->regular_exports() - .find(declarations->at(3)->proxy()->raw_name()) + .find(declarations->AtForTest(3)->proxy()->raw_name()) ->second; CheckEntry(entry, "foo", "foo", nullptr, -1); entry = descriptor->regular_exports() - .find(declarations->at(4)->proxy()->raw_name()) + .find(declarations->AtForTest(4)->proxy()->raw_name()) ->second; CheckEntry(entry, "goo", "goo", nullptr, -1); entry = descriptor->regular_exports() - .find(declarations->at(5)->proxy()->raw_name()) + .find(declarations->AtForTest(5)->proxy()->raw_name()) ->second; CheckEntry(entry, "hoo", "hoo", nullptr, -1); entry = descriptor->regular_exports() - .find(declarations->at(6)->proxy()->raw_name()) + .find(declarations->AtForTest(6)->proxy()->raw_name()) ->second; CheckEntry(entry, "joo", "joo", nullptr, -1); entry = descriptor->regular_exports() - .find(declarations->at(7)->proxy()->raw_name()) + .find(declarations->AtForTest(7)->proxy()->raw_name()) ->second; CheckEntry(entry, "default", "*default*", nullptr, -1); entry = descriptor->regular_exports() - .find(declarations->at(12)->proxy()->raw_name()) + .find(declarations->AtForTest(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 name_x = declarations->AtForTest(0)->proxy()->raw_name(); + CHECK_EQ(2u, 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")) { @@ -6171,18 +6172,22 @@ TEST(ModuleParsingInternals) { CheckEntry(descriptor->namespace_imports().at(1), nullptr, "foob", nullptr, 4); - CHECK_EQ(4, descriptor->regular_imports().size()); - entry = descriptor->regular_imports().find( - declarations->at(1)->proxy()->raw_name())->second; + CHECK_EQ(4u, descriptor->regular_imports().size()); + entry = descriptor->regular_imports() + .find(declarations->AtForTest(1)->proxy()->raw_name()) + ->second; CheckEntry(entry, nullptr, "z", "q", 0); - entry = descriptor->regular_imports().find( - declarations->at(2)->proxy()->raw_name())->second; + entry = descriptor->regular_imports() + .find(declarations->AtForTest(2)->proxy()->raw_name()) + ->second; CheckEntry(entry, nullptr, "n", "default", 1); - entry = descriptor->regular_imports().find( - declarations->at(9)->proxy()->raw_name())->second; + entry = descriptor->regular_imports() + .find(declarations->AtForTest(9)->proxy()->raw_name()) + ->second; CheckEntry(entry, nullptr, "mm", "m", 0); - entry = descriptor->regular_imports().find( - declarations->at(10)->proxy()->raw_name())->second; + entry = descriptor->regular_imports() + .find(declarations->AtForTest(10)->proxy()->raw_name()) + ->second; CheckEntry(entry, nullptr, "aa", "aa", 0); } @@ -6255,10 +6260,9 @@ void TestLanguageMode(const char* source, i::Handle<i::Script> script = factory->NewScript(factory->NewStringFromAsciiChecked(source)); - i::Zone zone(CcTest::i_isolate()->allocator()); + i::Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); i::ParseInfo info(&zone, script); i::Parser parser(&info); - info.set_global(); parser.Parse(&info); CHECK(info.literal() != NULL); CHECK_EQ(expected_language_mode, info.literal()->language_mode()); @@ -7632,11 +7636,6 @@ TEST(FunctionDeclarationError) { // Invalid in all contexts const char* error_data[] = { "try function foo() {} catch (e) {}", - NULL - }; - // Valid in sloppy mode only, and only when the - // --harmony-restrictive-declarations flag is off - const char* unrestricted_data[] = { "do function foo() {} while (0);", "for (;false;) function foo() {}", "for (var i = 0; i < 1; i++) function f() { };", @@ -7668,8 +7667,7 @@ TEST(FunctionDeclarationError) { // "{ function* f() {} function f() {} }", NULL }; - // Valid only in sloppy mode, with or without - // --harmony-restrictive-declarations + // Valid only in sloppy mode. const char* sloppy_data[] = { "if (true) function foo() {}", "if (false) {} else function f() { };", @@ -7680,30 +7678,13 @@ TEST(FunctionDeclarationError) { }; // clang-format on - static const ParserFlag restrictive_flags[] = { - kAllowHarmonyRestrictiveDeclarations}; - // Nothing parses in strict mode without a SyntaxError RunParserSyncTest(strict_context, error_data, kError); - RunParserSyncTest(strict_context, error_data, kError, NULL, 0, - restrictive_flags, arraysize(restrictive_flags)); - RunParserSyncTest(strict_context, unrestricted_data, kError); - RunParserSyncTest(strict_context, unrestricted_data, kError, NULL, 0, - restrictive_flags, arraysize(restrictive_flags)); RunParserSyncTest(strict_context, sloppy_data, kError); - RunParserSyncTest(strict_context, sloppy_data, kError, NULL, 0, - restrictive_flags, arraysize(restrictive_flags)); - // In sloppy mode, some things are successful, depending on the flag + // In sloppy mode, sloppy_data is successful RunParserSyncTest(sloppy_context, error_data, kError); - RunParserSyncTest(sloppy_context, error_data, kError, NULL, 0, - restrictive_flags, arraysize(restrictive_flags)); - RunParserSyncTest(sloppy_context, unrestricted_data, kSuccess); - RunParserSyncTest(sloppy_context, unrestricted_data, kError, NULL, 0, - restrictive_flags, arraysize(restrictive_flags)); RunParserSyncTest(sloppy_context, sloppy_data, kSuccess); - RunParserSyncTest(sloppy_context, sloppy_data, kSuccess, restrictive_flags, - arraysize(restrictive_flags)); } TEST(ExponentiationOperator) { @@ -8114,22 +8095,29 @@ TEST(AsyncAwaitModuleErrors) { TEST(RestrictiveForInErrors) { // clang-format off - const char* context_data[][2] = { + const char* strict_context_data[][2] = { { "'use strict'", "" }, + { NULL, NULL } + }; + const char* sloppy_context_data[][2] = { { "", "" }, { NULL, NULL } }; const char* error_data[] = { - "for (var x = 0 in {});", "for (const x = 0 in {});", "for (let x = 0 in {});", NULL }; + const char* sloppy_data[] = { + "for (var x = 0 in {});", + NULL + }; // clang-format on - static const ParserFlag always_flags[] = {kAllowHarmonyForIn}; - RunParserSyncTest(context_data, error_data, kError, nullptr, 0, always_flags, - arraysize(always_flags)); + RunParserSyncTest(strict_context_data, error_data, kError); + RunParserSyncTest(strict_context_data, sloppy_data, kError); + RunParserSyncTest(sloppy_context_data, error_data, kError); + RunParserSyncTest(sloppy_context_data, sloppy_data, kSuccess); } TEST(NoDuplicateGeneratorsInBlock) { diff --git a/deps/v8/test/cctest/test-profile-generator.cc b/deps/v8/test/cctest/test-profile-generator.cc index 272dec39b4..b7aba6e9da 100644 --- a/deps/v8/test/cctest/test-profile-generator.cc +++ b/deps/v8/test/cctest/test-profile-generator.cc @@ -344,11 +344,12 @@ class TestSetup { TEST(RecordTickSample) { TestSetup test_setup; - CpuProfilesCollection profiles(CcTest::i_isolate()); - CpuProfiler profiler(CcTest::i_isolate()); + i::Isolate* isolate = CcTest::i_isolate(); + CpuProfilesCollection profiles(isolate); + CpuProfiler profiler(isolate); profiles.set_cpu_profiler(&profiler); profiles.StartProfiling("", false); - ProfileGenerator generator(&profiles); + ProfileGenerator generator(isolate, &profiles); CodeEntry* entry1 = new CodeEntry(i::Logger::FUNCTION_TAG, "aaa"); CodeEntry* entry2 = new CodeEntry(i::Logger::FUNCTION_TAG, "bbb"); CodeEntry* entry3 = new CodeEntry(i::Logger::FUNCTION_TAG, "ccc"); @@ -416,11 +417,12 @@ static void CheckNodeIds(ProfileNode* node, unsigned* expectedId) { TEST(SampleIds) { TestSetup test_setup; - CpuProfilesCollection profiles(CcTest::i_isolate()); - CpuProfiler profiler(CcTest::i_isolate()); + i::Isolate* isolate = CcTest::i_isolate(); + CpuProfilesCollection profiles(isolate); + CpuProfiler profiler(isolate); profiles.set_cpu_profiler(&profiler); profiles.StartProfiling("", true); - ProfileGenerator generator(&profiles); + ProfileGenerator generator(isolate, &profiles); CodeEntry* entry1 = new CodeEntry(i::Logger::FUNCTION_TAG, "aaa"); CodeEntry* entry2 = new CodeEntry(i::Logger::FUNCTION_TAG, "bbb"); CodeEntry* entry3 = new CodeEntry(i::Logger::FUNCTION_TAG, "ccc"); @@ -473,11 +475,12 @@ TEST(SampleIds) { TEST(NoSamples) { TestSetup test_setup; - CpuProfilesCollection profiles(CcTest::i_isolate()); - CpuProfiler profiler(CcTest::i_isolate()); + i::Isolate* isolate = CcTest::i_isolate(); + CpuProfilesCollection profiles(isolate); + CpuProfiler profiler(isolate); profiles.set_cpu_profiler(&profiler); profiles.StartProfiling("", false); - ProfileGenerator generator(&profiles); + ProfileGenerator generator(isolate, &profiles); CodeEntry* entry1 = new CodeEntry(i::Logger::FUNCTION_TAG, "aaa"); generator.code_map()->AddCode(ToAddress(0x1500), entry1, 0x200); @@ -681,7 +684,7 @@ TEST(LineNumber) { profiler.processor()->StopSynchronously(); - bool is_lazy = i::FLAG_lazy && !(i::FLAG_ignition && i::FLAG_ignition_eager); + bool is_lazy = i::FLAG_lazy; CHECK_EQ(1, GetFunctionLineNumber(profiler, env, "foo_at_the_first_line")); CHECK_EQ(is_lazy ? 0 : 4, GetFunctionLineNumber(profiler, env, "lazy_func_at_forth_line")); diff --git a/deps/v8/test/cctest/test-regexp.cc b/deps/v8/test/cctest/test-regexp.cc index 504a52bc28..a9d941d998 100644 --- a/deps/v8/test/cctest/test-regexp.cc +++ b/deps/v8/test/cctest/test-regexp.cc @@ -98,7 +98,7 @@ using namespace v8::internal; static bool CheckParse(const char* input) { v8::HandleScope scope(CcTest::isolate()); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); RegExpCompileData result; return v8::internal::RegExpParser::ParseRegExp( @@ -109,7 +109,7 @@ static bool CheckParse(const char* input) { static void CheckParseEq(const char* input, const char* expected, bool unicode = false) { v8::HandleScope scope(CcTest::isolate()); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); RegExpCompileData result; JSRegExp::Flags flags = JSRegExp::kNone; @@ -129,7 +129,7 @@ static void CheckParseEq(const char* input, const char* expected, static bool CheckSimple(const char* input) { v8::HandleScope scope(CcTest::isolate()); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); RegExpCompileData result; CHECK(v8::internal::RegExpParser::ParseRegExp( @@ -147,7 +147,7 @@ struct MinMaxPair { static MinMaxPair CheckMinMaxMatch(const char* input) { v8::HandleScope scope(CcTest::isolate()); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); RegExpCompileData result; CHECK(v8::internal::RegExpParser::ParseRegExp( @@ -477,7 +477,7 @@ TEST(ParserRegression) { static void ExpectError(const char* input, const char* expected, bool unicode = false) { v8::HandleScope scope(CcTest::isolate()); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); FlatStringReader reader(CcTest::i_isolate(), CStrVector(input)); RegExpCompileData result; JSRegExp::Flags flags = JSRegExp::kNone; @@ -565,7 +565,7 @@ static bool NotWord(uc16 c) { static void TestCharacterClassEscapes(uc16 c, bool (pred)(uc16 c)) { - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ZoneList<CharacterRange>* ranges = new(&zone) ZoneList<CharacterRange>(2, &zone); CharacterRange::AddClassEscape(c, ranges, &zone); @@ -616,7 +616,7 @@ static RegExpNode* Compile(const char* input, bool multiline, bool unicode, static void Execute(const char* input, bool multiline, bool unicode, bool is_one_byte, bool dot_output = false) { v8::HandleScope scope(CcTest::isolate()); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); RegExpNode* node = Compile(input, multiline, unicode, is_one_byte, &zone); USE(node); #ifdef DEBUG @@ -654,7 +654,7 @@ static unsigned PseudoRandom(int i, int j) { TEST(SplayTreeSimple) { static const unsigned kLimit = 1000; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ZoneSplayTree<TestConfig> tree(&zone); bool seen[kLimit]; for (unsigned i = 0; i < kLimit; i++) seen[i] = false; @@ -721,7 +721,7 @@ TEST(DispatchTableConstruction) { } } // Enter test data into dispatch table. - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); DispatchTable table(&zone); for (int i = 0; i < kRangeCount; i++) { uc16* range = ranges[i]; @@ -835,7 +835,7 @@ TEST(MacroAssemblerNativeSuccess) { ContextInitializer initializer; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, 4); @@ -873,7 +873,7 @@ TEST(MacroAssemblerNativeSimple) { ContextInitializer initializer; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, 4); @@ -940,7 +940,7 @@ TEST(MacroAssemblerNativeSimpleUC16) { ContextInitializer initializer; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::UC16, 4); @@ -1013,7 +1013,7 @@ TEST(MacroAssemblerNativeBacktrack) { ContextInitializer initializer; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, 0); @@ -1054,7 +1054,7 @@ TEST(MacroAssemblerNativeBackReferenceLATIN1) { ContextInitializer initializer; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, 4); @@ -1104,7 +1104,7 @@ TEST(MacroAssemblerNativeBackReferenceUC16) { ContextInitializer initializer; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::UC16, 4); @@ -1157,7 +1157,7 @@ TEST(MacroAssemblernativeAtStart) { ContextInitializer initializer; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, 0); @@ -1217,7 +1217,7 @@ TEST(MacroAssemblerNativeBackRefNoCase) { ContextInitializer initializer; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, 4); @@ -1276,7 +1276,7 @@ TEST(MacroAssemblerNativeRegisters) { ContextInitializer initializer; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, 6); @@ -1378,7 +1378,7 @@ TEST(MacroAssemblerStackOverflow) { ContextInitializer initializer; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, 0); @@ -1417,7 +1417,7 @@ TEST(MacroAssemblerNativeLotsOfRegisters) { ContextInitializer initializer; Isolate* isolate = CcTest::i_isolate(); Factory* factory = isolate->factory(); - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ArchRegExpMacroAssembler m(isolate, &zone, NativeRegExpMacroAssembler::LATIN1, 2); @@ -1465,7 +1465,7 @@ TEST(MacroAssemblerNativeLotsOfRegisters) { TEST(MacroAssembler) { byte codes[1024]; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); RegExpMacroAssemblerIrregexp m(CcTest::i_isolate(), Vector<byte>(codes, 1024), &zone); // ^f(o)o. @@ -1533,7 +1533,7 @@ TEST(AddInverseToTable) { static const int kLimit = 1000; static const int kRangeCount = 16; for (int t = 0; t < 10; t++) { - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ZoneList<CharacterRange>* ranges = new(&zone) ZoneList<CharacterRange>(kRangeCount, &zone); for (int i = 0; i < kRangeCount; i++) { @@ -1554,7 +1554,7 @@ TEST(AddInverseToTable) { CHECK_EQ(is_on, set->Get(0) == false); } } - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ZoneList<CharacterRange>* ranges = new(&zone) ZoneList<CharacterRange>(1, &zone); ranges->Add(CharacterRange::Range(0xFFF0, 0xFFFE), &zone); @@ -1667,7 +1667,7 @@ TEST(UncanonicalizeEquivalence) { static void TestRangeCaseIndependence(Isolate* isolate, CharacterRange input, Vector<CharacterRange> expected) { - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); int count = expected.length(); ZoneList<CharacterRange>* list = new(&zone) ZoneList<CharacterRange>(count, &zone); @@ -1736,7 +1736,7 @@ static bool InClass(uc32 c, ZoneList<CharacterRange>* ranges) { TEST(UnicodeRangeSplitter) { - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ZoneList<CharacterRange>* base = new(&zone) ZoneList<CharacterRange>(1, &zone); base->Add(CharacterRange::Everything(), &zone); @@ -1780,7 +1780,7 @@ TEST(UnicodeRangeSplitter) { TEST(CanonicalizeCharacterSets) { - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ZoneList<CharacterRange>* list = new(&zone) ZoneList<CharacterRange>(4, &zone); CharacterSet set(list); @@ -1841,7 +1841,7 @@ TEST(CanonicalizeCharacterSets) { TEST(CharacterRangeMerge) { - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); ZoneList<CharacterRange> l1(4, &zone); ZoneList<CharacterRange> l2(4, &zone); // Create all combinations of intersections of ranges, both singletons and diff --git a/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc b/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc index b2e6ec3a3b..4fd186e565 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-arm.cc @@ -50,7 +50,7 @@ TEST(WasmRelocationArmMemoryReference) { code->Print(os); ::printf("f() = %d\n\n", ret_value); #endif - size_t offset = 1234; + int offset = 1234; // Relocating references by offset int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); @@ -103,7 +103,7 @@ TEST(WasmRelocationArmMemorySizeReference) { CSignature0<int32_t> csig; CodeRunner<int32_t> runnable(isolate, code, &csig); int32_t ret_value = runnable.Call(); - CHECK_NE(ret_value, 0xdeadbeef); + CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); #ifdef DEBUG OFStream os(stdout); @@ -124,7 +124,7 @@ TEST(WasmRelocationArmMemorySizeReference) { } ret_value = runnable.Call(); - CHECK_NE(ret_value, 0xdeadbeef); + CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); #ifdef DEBUG code->Print(os); diff --git a/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc b/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc index 3b49f00afc..c59a01aaed 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-arm64.cc @@ -52,7 +52,7 @@ TEST(WasmRelocationArm64MemoryReference) { code->Print(os); ::printf("f() = %" PRIx64 "\n\n", ret_value); #endif - size_t offset = 1234; + int offset = 1234; // Relocating reference by offset int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); diff --git a/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc b/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc index 305d0089c3..f2241d5f92 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-ia32.cc @@ -25,7 +25,7 @@ static int32_t DummyStaticFunction(Object* result) { return 1; } TEST(WasmRelocationIa32MemoryReference) { Isolate* isolate = CcTest::i_isolate(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); HandleScope scope(isolate); v8::internal::byte buffer[4096]; Assembler assm(isolate, buffer, sizeof buffer); @@ -56,7 +56,7 @@ TEST(WasmRelocationIa32MemoryReference) { disasm::Disassembler::Disassemble(stdout, begin, end); #endif - size_t offset = 1234; + int offset = 1234; // Relocating references by offset int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); @@ -87,7 +87,7 @@ TEST(WasmRelocationIa32MemoryReference) { TEST(WasmRelocationIa32MemorySizeReference) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); HandleScope scope(isolate); v8::internal::byte buffer[4096]; Assembler assm(isolate, buffer, sizeof buffer); @@ -114,7 +114,7 @@ TEST(WasmRelocationIa32MemorySizeReference) { CodeRunner<int32_t> runnable(isolate, code, &csig); int32_t ret_value = runnable.Call(); - CHECK_NE(ret_value, 0xdeadbeef); + CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); #ifdef OBJECT_PRINT OFStream os(stdout); @@ -138,7 +138,7 @@ TEST(WasmRelocationIa32MemorySizeReference) { } ret_value = runnable.Call(); - CHECK_NE(ret_value, 0xdeadbeef); + CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); #ifdef OBJECT_PRINT code->Print(os); diff --git a/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc b/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc index 11fa45164e..a5df703410 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-x64.cc @@ -52,7 +52,7 @@ TEST(WasmRelocationX64MemoryReference) { byte* end = begin + code->instruction_size(); disasm::Disassembler::Disassemble(stdout, begin, end); #endif - size_t offset = 1234; + int offset = 1234; // Relocating references by offset int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); @@ -107,7 +107,7 @@ TEST(WasmRelocationX64WasmMemorySizeReference) { CSignature0<int64_t> csig; CodeRunner<int64_t> runnable(isolate, code, &csig); int64_t ret_value = runnable.Call(); - CHECK_NE(ret_value, 0xdeadbeef); + CHECK_NE(ret_value, bit_cast<uint32_t>(0xdeadbeef)); #ifdef OBJECT_PRINT OFStream os(stdout); @@ -130,7 +130,7 @@ TEST(WasmRelocationX64WasmMemorySizeReference) { } ret_value = runnable.Call(); - CHECK_NE(ret_value, 0xdeadbeef); + CHECK_NE(ret_value, bit_cast<uint32_t>(0xdeadbeef)); #ifdef OBJECT_PRINT code->Print(os); diff --git a/deps/v8/test/cctest/test-run-wasm-relocation-x87.cc b/deps/v8/test/cctest/test-run-wasm-relocation-x87.cc index 2156e96ecb..17b340ac9e 100644 --- a/deps/v8/test/cctest/test-run-wasm-relocation-x87.cc +++ b/deps/v8/test/cctest/test-run-wasm-relocation-x87.cc @@ -25,7 +25,7 @@ static int32_t DummyStaticFunction(Object* result) { return 1; } TEST(WasmRelocationX87MemoryReference) { Isolate* isolate = CcTest::i_isolate(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); HandleScope scope(isolate); v8::internal::byte buffer[4096]; Assembler assm(isolate, buffer, sizeof buffer); @@ -56,7 +56,7 @@ TEST(WasmRelocationX87MemoryReference) { disasm::Disassembler::Disassemble(stdout, begin, end); #endif - size_t offset = 1234; + int offset = 1234; // Relocating references by offset int mode_mask = (1 << RelocInfo::WASM_MEMORY_REFERENCE); @@ -87,7 +87,7 @@ TEST(WasmRelocationX87MemoryReference) { TEST(WasmRelocationX87MemorySizeReference) { CcTest::InitializeVM(); Isolate* isolate = CcTest::i_isolate(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); HandleScope scope(isolate); v8::internal::byte buffer[4096]; Assembler assm(isolate, buffer, sizeof buffer); @@ -114,7 +114,7 @@ TEST(WasmRelocationX87MemorySizeReference) { CodeRunner<int32_t> runnable(isolate, code, &csig); int32_t ret_value = runnable.Call(); - CHECK_NE(ret_value, 0xdeadbeef); + CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); #ifdef OBJECT_PRINT OFStream os(stdout); @@ -138,7 +138,7 @@ TEST(WasmRelocationX87MemorySizeReference) { } ret_value = runnable.Call(); - CHECK_NE(ret_value, 0xdeadbeef); + CHECK_NE(ret_value, bit_cast<int32_t>(0xdeadbeef)); #ifdef OBJECT_PRINT code->Print(os); diff --git a/deps/v8/test/cctest/test-serialize.cc b/deps/v8/test/cctest/test-serialize.cc index 37992fa7e7..1b5497f772 100644 --- a/deps/v8/test/cctest/test-serialize.cc +++ b/deps/v8/test/cctest/test-serialize.cc @@ -50,9 +50,10 @@ using namespace v8::internal; -void DisableTurbofan() { - const char* flag = "--turbo-filter=\"\""; - FlagList::SetFlagsFromString(flag, StrLength(flag)); +void DisableAlwaysOpt() { + // Isolates prepared for serialization do not optimize. The only exception is + // with the flag --always-opt. + FLAG_always_opt = false; } @@ -150,10 +151,7 @@ static void SanityCheck(v8::Isolate* v8_isolate) { } UNINITIALIZED_TEST(StartupSerializerOnce) { - // The serialize-deserialize tests only work if the VM is built without - // serialization. That doesn't matter. We don't need to be able to - // serialize a snapshot in a VM that is booted from a snapshot. - DisableTurbofan(); + DisableAlwaysOpt(); v8::Isolate* isolate = TestIsolate::NewInitialized(true); Vector<const byte> blob = Serialize(isolate); isolate = Deserialize(blob); @@ -171,7 +169,7 @@ UNINITIALIZED_TEST(StartupSerializerOnce) { } UNINITIALIZED_TEST(StartupSerializerTwice) { - DisableTurbofan(); + DisableAlwaysOpt(); v8::Isolate* isolate = TestIsolate::NewInitialized(true); Vector<const byte> blob1 = Serialize(isolate); Vector<const byte> blob2 = Serialize(isolate); @@ -191,7 +189,7 @@ UNINITIALIZED_TEST(StartupSerializerTwice) { } UNINITIALIZED_TEST(StartupSerializerOnceRunScript) { - DisableTurbofan(); + DisableAlwaysOpt(); v8::Isolate* isolate = TestIsolate::NewInitialized(true); Vector<const byte> blob = Serialize(isolate); isolate = Deserialize(blob); @@ -215,7 +213,7 @@ UNINITIALIZED_TEST(StartupSerializerOnceRunScript) { } UNINITIALIZED_TEST(StartupSerializerTwiceRunScript) { - DisableTurbofan(); + DisableAlwaysOpt(); v8::Isolate* isolate = TestIsolate::NewInitialized(true); Vector<const byte> blob1 = Serialize(isolate); Vector<const byte> blob2 = Serialize(isolate); @@ -287,7 +285,7 @@ static void PartiallySerializeObject(Vector<const byte>* startup_blob_out, isolate, v8::SnapshotCreator::FunctionCodeHandling::kClear); startup_serializer.SerializeStrongReferences(); - PartialSerializer partial_serializer(isolate, &startup_serializer); + PartialSerializer partial_serializer(isolate, &startup_serializer, nullptr); partial_serializer.Serialize(&raw_foo); startup_serializer.SerializeWeakReferencesAndDeferred(); @@ -303,7 +301,7 @@ static void PartiallySerializeObject(Vector<const byte>* startup_blob_out, } UNINITIALIZED_TEST(PartialSerializerObject) { - DisableTurbofan(); + DisableAlwaysOpt(); Vector<const byte> startup_blob; Vector<const byte> partial_blob; PartiallySerializeObject(&startup_blob, &partial_blob); @@ -387,7 +385,7 @@ static void PartiallySerializeContext(Vector<const byte>* startup_blob_out, startup_serializer.SerializeStrongReferences(); SnapshotByteSink partial_sink; - PartialSerializer partial_serializer(isolate, &startup_serializer); + PartialSerializer partial_serializer(isolate, &startup_serializer, nullptr); partial_serializer.Serialize(&raw_context); startup_serializer.SerializeWeakReferencesAndDeferred(); @@ -401,7 +399,7 @@ static void PartiallySerializeContext(Vector<const byte>* startup_blob_out, } UNINITIALIZED_TEST(PartialSerializerContext) { - DisableTurbofan(); + DisableAlwaysOpt(); Vector<const byte> startup_blob; Vector<const byte> partial_blob; PartiallySerializeContext(&startup_blob, &partial_blob); @@ -416,7 +414,8 @@ UNINITIALIZED_TEST(PartialSerializerContext) { HandleScope handle_scope(isolate); Handle<Object> root; Handle<JSGlobalProxy> global_proxy = - isolate->factory()->NewUninitializedJSGlobalProxy(); + isolate->factory()->NewUninitializedJSGlobalProxy( + JSGlobalProxy::SizeWithInternalFields(0)); { SnapshotData snapshot_data(partial_blob); Deserializer deserializer(&snapshot_data); @@ -506,7 +505,7 @@ static void PartiallySerializeCustomContext( startup_serializer.SerializeStrongReferences(); SnapshotByteSink partial_sink; - PartialSerializer partial_serializer(isolate, &startup_serializer); + PartialSerializer partial_serializer(isolate, &startup_serializer, nullptr); partial_serializer.Serialize(&raw_context); startup_serializer.SerializeWeakReferencesAndDeferred(); @@ -520,7 +519,7 @@ static void PartiallySerializeCustomContext( } UNINITIALIZED_TEST(PartialSerializerCustomContext) { - DisableTurbofan(); + DisableAlwaysOpt(); Vector<const byte> startup_blob; Vector<const byte> partial_blob; PartiallySerializeCustomContext(&startup_blob, &partial_blob); @@ -535,7 +534,8 @@ UNINITIALIZED_TEST(PartialSerializerCustomContext) { HandleScope handle_scope(isolate); Handle<Object> root; Handle<JSGlobalProxy> global_proxy = - isolate->factory()->NewUninitializedJSGlobalProxy(); + isolate->factory()->NewUninitializedJSGlobalProxy( + JSGlobalProxy::SizeWithInternalFields(0)); { SnapshotData snapshot_data(partial_blob); Deserializer deserializer(&snapshot_data); @@ -609,16 +609,11 @@ UNINITIALIZED_TEST(PartialSerializerCustomContext) { v8_isolate->Dispose(); } -TEST(CustomSnapshotDataBlob) { - DisableTurbofan(); +TEST(CustomSnapshotDataBlob1) { + DisableAlwaysOpt(); const char* source1 = "function f() { return 42; }"; - const char* source2 = - "function f() { return g() * 2; }" - "function g() { return 43; }" - "/./.test('a')"; v8::StartupData data1 = v8::V8::CreateSnapshotDataBlob(source1); - v8::StartupData data2 = v8::V8::CreateSnapshotDataBlob(source2); v8::Isolate::CreateParams params1; params1.snapshot_blob = &data1; @@ -637,6 +632,16 @@ TEST(CustomSnapshotDataBlob) { CHECK(CompileRun("this.g")->IsUndefined()); } isolate1->Dispose(); +} + +TEST(CustomSnapshotDataBlob2) { + DisableAlwaysOpt(); + const char* source2 = + "function f() { return g() * 2; }" + "function g() { return 43; }" + "/./.test('a')"; + + v8::StartupData data2 = v8::V8::CreateSnapshotDataBlob(source2); v8::Isolate::CreateParams params2; params2.snapshot_blob = &data2; @@ -657,15 +662,13 @@ TEST(CustomSnapshotDataBlob) { isolate2->Dispose(); } - static void SerializationFunctionTemplate( const v8::FunctionCallbackInfo<v8::Value>& args) { args.GetReturnValue().Set(args[0]); } TEST(CustomSnapshotDataBlobOutdatedContextWithOverflow) { - DisableTurbofan(); - + DisableAlwaysOpt(); const char* source1 = "var o = {};" "(function() {" @@ -710,7 +713,7 @@ TEST(CustomSnapshotDataBlobOutdatedContextWithOverflow) { } TEST(CustomSnapshotDataBlobWithLocker) { - DisableTurbofan(); + DisableAlwaysOpt(); v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = CcTest::array_buffer_allocator(); v8::Isolate* isolate0 = v8::Isolate::New(create_params); @@ -748,7 +751,7 @@ TEST(CustomSnapshotDataBlobWithLocker) { } TEST(CustomSnapshotDataBlobStackOverflow) { - DisableTurbofan(); + DisableAlwaysOpt(); const char* source = "var a = [0];" "var b = a;" @@ -794,7 +797,7 @@ bool IsCompiled(const char* name) { } TEST(SnapshotDataBlobWithWarmup) { - DisableTurbofan(); + DisableAlwaysOpt(); const char* warmup = "Math.abs(1); Math.random = 1;"; v8::StartupData cold = v8::V8::CreateSnapshotDataBlob(); @@ -815,18 +818,18 @@ 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.parseInt")); + CHECK(!IsCompiled("String.raw")); CHECK(CompileRun("Math.random")->IsFunction()); } isolate->Dispose(); } TEST(CustomSnapshotDataBlobWithWarmup) { - DisableTurbofan(); + DisableAlwaysOpt(); const char* source = "function f() { return Math.abs(1); }\n" - "function g() { return Number.parseInt(1); }\n" - "Number.parseFloat(1);" + "function g() { return String.raw(1); }\n" + "Object.valueOf(1);" "var a = 5"; const char* warmup = "a = f()"; @@ -850,15 +853,15 @@ TEST(CustomSnapshotDataBlobWithWarmup) { CHECK(IsCompiled("f")); CHECK(IsCompiled("Math.abs")); CHECK(!IsCompiled("g")); - CHECK(!IsCompiled("Number.parseInt")); - CHECK(!IsCompiled("Number.parseFloat")); + CHECK(!IsCompiled("String.raw")); + CHECK(!IsCompiled("Object.valueOf")); CHECK_EQ(5, CompileRun("a")->Int32Value(context).FromJust()); } isolate->Dispose(); } TEST(CustomSnapshotDataBlobImmortalImmovableRoots) { - DisableTurbofan(); + DisableAlwaysOpt(); // Flood the startup snapshot with shared function infos. If they are // serialized before the immortal immovable root, the root will no longer end // up on the first page. @@ -1070,9 +1073,9 @@ TEST(CodeSerializerLargeCodeObject) { FLAG_always_opt = false; Vector<const uint8_t> source = - ConstructSource(STATIC_CHAR_VECTOR("var j=1; if (!j) {"), + ConstructSource(STATIC_CHAR_VECTOR("var j=1; if (j == 0) {"), STATIC_CHAR_VECTOR("for (let i of Object.prototype);"), - STATIC_CHAR_VECTOR("} j=7; j"), 2000); + STATIC_CHAR_VECTOR("} j=7; j"), 1000); Handle<String> source_str = isolate->factory()->NewStringFromOneByte(source).ToHandleChecked(); @@ -1678,7 +1681,7 @@ TEST(CodeSerializerInternalReference) { // In ignition there are only relative jumps, so the following code // would not have any internal references. This test is not relevant // for ignition. - if (FLAG_ignition) { + if (FLAG_ignition || FLAG_turbo) { return; } // Disable experimental natives that are loaded after deserialization. @@ -1762,7 +1765,7 @@ TEST(CodeSerializerInternalReference) { } TEST(CodeSerializerEagerCompilationAndPreAge) { - if (FLAG_ignition) return; + if (FLAG_ignition || FLAG_turbo) return; FLAG_lazy = true; FLAG_serialize_toplevel = true; @@ -1949,7 +1952,7 @@ TEST(CodeSerializerEmbeddedObject) { } TEST(SnapshotCreatorMultipleContexts) { - DisableTurbofan(); + DisableAlwaysOpt(); v8::StartupData blob; { v8::SnapshotCreator creator; @@ -1959,19 +1962,19 @@ TEST(SnapshotCreatorMultipleContexts) { v8::Local<v8::Context> context = v8::Context::New(isolate); v8::Context::Scope context_scope(context); CompileRun("var f = function() { return 1; }"); - CHECK_EQ(0, creator.AddContext(context)); + CHECK_EQ(0u, creator.AddContext(context)); } { v8::HandleScope handle_scope(isolate); v8::Local<v8::Context> context = v8::Context::New(isolate); v8::Context::Scope context_scope(context); CompileRun("var f = function() { return 2; }"); - CHECK_EQ(1, creator.AddContext(context)); + CHECK_EQ(1u, creator.AddContext(context)); } { v8::HandleScope handle_scope(isolate); v8::Local<v8::Context> context = v8::Context::New(isolate); - CHECK_EQ(2, creator.AddContext(context)); + CHECK_EQ(2u, creator.AddContext(context)); } blob = creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); @@ -2010,24 +2013,27 @@ TEST(SnapshotCreatorMultipleContexts) { delete[] blob.data; } -static void SerializedCallback( - const v8::FunctionCallbackInfo<v8::Value>& args) { +void SerializedCallback(const v8::FunctionCallbackInfo<v8::Value>& args) { args.GetReturnValue().Set(v8_num(42)); } -static void SerializedCallbackReplacement( +void SerializedCallbackReplacement( const v8::FunctionCallbackInfo<v8::Value>& args) { args.GetReturnValue().Set(v8_num(1337)); } +static int serialized_static_field = 314; + intptr_t original_external_references[] = { - reinterpret_cast<intptr_t>(SerializedCallback), 0}; + reinterpret_cast<intptr_t>(SerializedCallback), + reinterpret_cast<intptr_t>(&serialized_static_field), 0}; intptr_t replaced_external_references[] = { - reinterpret_cast<intptr_t>(SerializedCallbackReplacement), 0}; + reinterpret_cast<intptr_t>(SerializedCallbackReplacement), + reinterpret_cast<intptr_t>(&serialized_static_field), 0}; TEST(SnapshotCreatorExternalReferences) { - DisableTurbofan(); + DisableAlwaysOpt(); v8::StartupData blob; { v8::SnapshotCreator creator(original_external_references); @@ -2042,7 +2048,7 @@ TEST(SnapshotCreatorExternalReferences) { callback->GetFunction(context).ToLocalChecked(); CHECK(context->Global()->Set(context, v8_str("f"), function).FromJust()); ExpectInt32("f()", 42); - CHECK_EQ(0, creator.AddContext(context)); + CHECK_EQ(0u, creator.AddContext(context)); } blob = creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); @@ -2086,10 +2092,61 @@ TEST(SnapshotCreatorExternalReferences) { delete[] blob.data; } +TEST(SnapshotCreatorUnknownExternalReferences) { + DisableAlwaysOpt(); + v8::SnapshotCreator creator; + v8::Isolate* isolate = creator.GetIsolate(); + { + v8::HandleScope handle_scope(isolate); + v8::Local<v8::Context> context = v8::Context::New(isolate); + v8::Context::Scope context_scope(context); + + v8::Local<v8::FunctionTemplate> callback = + v8::FunctionTemplate::New(isolate, SerializedCallback); + v8::Local<v8::Value> function = + callback->GetFunction(context).ToLocalChecked(); + CHECK(context->Global()->Set(context, v8_str("f"), function).FromJust()); + ExpectInt32("f()", 42); + + CHECK_EQ(0u, creator.AddContext(context)); + } + v8::StartupData blob = + creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); + + delete[] blob.data; +} + +struct InternalFieldData { + uint32_t data; +}; + +v8::StartupData SerializeInternalFields(v8::Local<v8::Object> holder, + int index) { + InternalFieldData* data = static_cast<InternalFieldData*>( + holder->GetAlignedPointerFromInternalField(index)); + int size = sizeof(*data); + char* payload = new char[size]; + // We simply use memcpy to serialize the content. + memcpy(payload, data, size); + return {payload, size}; +} + +void DeserializeInternalFields(v8::Local<v8::Object> holder, int index, + v8::StartupData payload) { + InternalFieldData* data = new InternalFieldData{0}; + memcpy(data, payload.data, payload.raw_size); + holder->SetAlignedPointerInInternalField(index, data); +} + TEST(SnapshotCreatorTemplates) { - DisableTurbofan(); + DisableAlwaysOpt(); v8::StartupData blob; + { + InternalFieldData* a1 = new InternalFieldData{11}; + InternalFieldData* b0 = new InternalFieldData{20}; + InternalFieldData* c0 = new InternalFieldData{30}; + v8::SnapshotCreator creator(original_external_references); v8::Isolate* isolate = creator.GetIsolate(); { @@ -2102,14 +2159,42 @@ TEST(SnapshotCreatorTemplates) { global_template->Set(v8_str("f"), callback); v8::Local<v8::Context> context = v8::Context::New(isolate, no_extension, global_template); + v8::Local<v8::ObjectTemplate> object_template = + v8::ObjectTemplate::New(isolate); + object_template->SetInternalFieldCount(3); + v8::Context::Scope context_scope(context); ExpectInt32("f()", 42); - CHECK_EQ(0, creator.AddContext(context)); - CHECK_EQ(0, creator.AddTemplate(callback)); - CHECK_EQ(1, creator.AddTemplate(global_template)); + + v8::Local<v8::Object> a = + object_template->NewInstance(context).ToLocalChecked(); + v8::Local<v8::Object> b = + object_template->NewInstance(context).ToLocalChecked(); + v8::Local<v8::Object> c = + object_template->NewInstance(context).ToLocalChecked(); + v8::Local<v8::External> null_external = + v8::External::New(isolate, nullptr); + v8::Local<v8::External> field_external = + v8::External::New(isolate, &serialized_static_field); + a->SetInternalField(0, b); + a->SetAlignedPointerInInternalField(1, a1); + b->SetAlignedPointerInInternalField(0, b0); + b->SetInternalField(1, c); + c->SetAlignedPointerInInternalField(0, c0); + c->SetInternalField(1, null_external); + c->SetInternalField(2, field_external); + CHECK(context->Global()->Set(context, v8_str("a"), a).FromJust()); + + CHECK_EQ(0u, creator.AddContext(context)); + CHECK_EQ(0u, creator.AddTemplate(callback)); + CHECK_EQ(1u, creator.AddTemplate(global_template)); } - blob = - creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear); + blob = creator.CreateBlob(v8::SnapshotCreator::FunctionCodeHandling::kClear, + SerializeInternalFields); + + delete a1; + delete b0; + delete c0; } { @@ -2117,6 +2202,7 @@ TEST(SnapshotCreatorTemplates) { params.snapshot_blob = &blob; params.array_buffer_allocator = CcTest::array_buffer_allocator(); params.external_references = original_external_references; + params.deserialize_internal_fields_callback = DeserializeInternalFields; v8::Isolate* isolate = v8::Isolate::New(params); { v8::Isolate::Scope isolate_scope(isolate); @@ -2150,10 +2236,47 @@ TEST(SnapshotCreatorTemplates) { // Check that it instantiates to the same prototype. ExpectTrue("g.prototype === f.prototype"); + // Retrieve internal fields. + v8::Local<v8::Object> a = context->Global() + ->Get(context, v8_str("a")) + .ToLocalChecked() + ->ToObject(context) + .ToLocalChecked(); + v8::Local<v8::Object> b = + a->GetInternalField(0)->ToObject(context).ToLocalChecked(); + InternalFieldData* a1 = reinterpret_cast<InternalFieldData*>( + a->GetAlignedPointerFromInternalField(1)); + v8::Local<v8::Value> a2 = a->GetInternalField(2); + + InternalFieldData* b0 = reinterpret_cast<InternalFieldData*>( + b->GetAlignedPointerFromInternalField(0)); + v8::Local<v8::Object> c = + b->GetInternalField(1)->ToObject(context).ToLocalChecked(); + v8::Local<v8::Value> b2 = b->GetInternalField(2); + + InternalFieldData* c0 = reinterpret_cast<InternalFieldData*>( + c->GetAlignedPointerFromInternalField(0)); + v8::Local<v8::Value> c1 = c->GetInternalField(1); + v8::Local<v8::Value> c2 = c->GetInternalField(2); + + CHECK_EQ(11u, a1->data); + CHECK(a2->IsUndefined()); + CHECK_EQ(20u, b0->data); + CHECK(b2->IsUndefined()); + CHECK_EQ(30u, c0->data); + CHECK(c1->IsExternal()); + CHECK_NULL(v8::Local<v8::External>::Cast(c1)->Value()); + CHECK_EQ(static_cast<void*>(&serialized_static_field), + v8::Local<v8::External>::Cast(c2)->Value()); + // Accessing out of bound returns empty MaybeHandle. CHECK(v8::ObjectTemplate::FromSnapshot(isolate, 2).IsEmpty()); CHECK(v8::FunctionTemplate::FromSnapshot(isolate, 2).IsEmpty()); CHECK(v8::Context::FromSnapshot(isolate, 2).IsEmpty()); + + delete a1; + delete b0; + delete c0; } { diff --git a/deps/v8/test/cctest/test-strings.cc b/deps/v8/test/cctest/test-strings.cc index 9793ae7f18..80c8f92ac4 100644 --- a/deps/v8/test/cctest/test-strings.cc +++ b/deps/v8/test/cctest/test-strings.cc @@ -600,6 +600,42 @@ TEST(Traverse) { printf("18\n"); } +TEST(ConsStringWithEmptyFirstFlatten) { + printf("ConsStringWithEmptyFirstFlatten\n"); + CcTest::InitializeVM(); + v8::HandleScope scope(CcTest::isolate()); + Isolate* isolate = CcTest::i_isolate(); + + i::Handle<i::String> initial_fst = + isolate->factory()->NewStringFromAsciiChecked("fst012345"); + i::Handle<i::String> initial_snd = + isolate->factory()->NewStringFromAsciiChecked("snd012345"); + i::Handle<i::String> str = isolate->factory() + ->NewConsString(initial_fst, initial_snd) + .ToHandleChecked(); + CHECK(str->IsConsString()); + auto cons = i::Handle<i::ConsString>::cast(str); + + const int initial_length = cons->length(); + + // set_first / set_second does not update the length (which the heap verifier + // checks), so we need to ensure the length stays the same. + + i::Handle<i::String> new_fst = isolate->factory()->empty_string(); + i::Handle<i::String> new_snd = + isolate->factory()->NewStringFromAsciiChecked("snd012345012345678"); + cons->set_first(*new_fst); + cons->set_second(*new_snd); + CHECK(!cons->IsFlat()); + CHECK_EQ(initial_length, new_fst->length() + new_snd->length()); + CHECK_EQ(initial_length, cons->length()); + + // Make sure Flatten doesn't alloc a new string. + DisallowHeapAllocation no_alloc; + i::Handle<i::String> flat = i::String::Flatten(cons); + CHECK(flat->IsFlat()); + CHECK_EQ(initial_length, flat->length()); +} static void VerifyCharacterStream( String* flat_string, String* cons_string) { diff --git a/deps/v8/test/cctest/test-traced-value.cc b/deps/v8/test/cctest/test-traced-value.cc new file mode 100644 index 0000000000..1c3e7ac252 --- /dev/null +++ b/deps/v8/test/cctest/test-traced-value.cc @@ -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. + +#include "src/tracing/traced-value.h" +#include "test/cctest/cctest.h" + +using v8::tracing::TracedValue; + +TEST(FlatDictionary) { + auto value = TracedValue::Create(); + value->SetInteger("int", 2014); + value->SetDouble("double", 0.0); + value->SetBoolean("bool", true); + value->SetString("string", "string"); + std::string json = "PREFIX"; + value->AppendAsTraceFormat(&json); + CHECK_EQ( + "PREFIX{\"int\":2014,\"double\":0,\"bool\":true,\"string\":" + "\"string\"}", + json); +} + +TEST(NoDotPathExpansion) { + auto value = TracedValue::Create(); + value->SetInteger("in.t", 2014); + value->SetDouble("doub.le", -20.25); + value->SetBoolean("bo.ol", true); + value->SetString("str.ing", "str.ing"); + std::string json; + value->AppendAsTraceFormat(&json); + CHECK_EQ( + "{\"in.t\":2014,\"doub.le\":-20.25,\"bo.ol\":true,\"str.ing\":\"str." + "ing\"}", + json); +} + +TEST(Hierarchy) { + auto value = TracedValue::Create(); + value->SetInteger("i0", 2014); + value->BeginDictionary("dict1"); + value->SetInteger("i1", 2014); + value->BeginDictionary("dict2"); + value->SetBoolean("b2", false); + value->EndDictionary(); + value->SetString("s1", "foo"); + value->EndDictionary(); + value->SetDouble("d0", 0.0); + value->SetDouble("d1", 10.5); + value->SetBoolean("b0", true); + value->BeginArray("a1"); + value->AppendInteger(1); + value->AppendBoolean(true); + value->BeginDictionary(); + value->SetInteger("i2", 3); + value->EndDictionary(); + value->EndArray(); + value->SetString("s0", "foo"); + + value->BeginArray("arr1"); + value->BeginDictionary(); + value->EndDictionary(); + value->BeginArray(); + value->EndArray(); + value->BeginDictionary(); + value->EndDictionary(); + value->EndArray(); + + std::string json; + value->AppendAsTraceFormat(&json); + CHECK_EQ( + "{\"i0\":2014,\"dict1\":{\"i1\":2014,\"dict2\":{\"b2\":false}," + "\"s1\":\"foo\"},\"d0\":0,\"d1\":10.5,\"b0\":true,\"a1\":[1,true,{\"i2\":" + "3}],\"s0\":\"foo\",\"arr1\":[{},[],{}]}", + json); +} + +TEST(LongStrings) { + std::string long_string = "supercalifragilisticexpialidocious"; + std::string long_string2 = "0123456789012345678901234567890123456789"; + char long_string3[4096]; + for (size_t i = 0; i < sizeof(long_string3); ++i) + long_string3[i] = static_cast<char>('a' + (i % 26)); + long_string3[sizeof(long_string3) - 1] = '\0'; + + auto value = TracedValue::Create(); + value->SetString("a", "short"); + value->SetString("b", long_string); + value->BeginArray("c"); + value->AppendString(long_string2); + value->AppendString(""); + value->BeginDictionary(); + value->SetString("a", long_string3); + value->EndDictionary(); + value->EndArray(); + + std::string json; + value->AppendAsTraceFormat(&json); + CHECK_EQ("{\"a\":\"short\",\"b\":\"" + long_string + "\",\"c\":[\"" + + long_string2 + "\",\"\",{\"a\":\"" + long_string3 + "\"}]}", + json); +} + +TEST(Escaping) { + const char* string1 = "abc\"\'\\\\x\"y\'z\n\x09\x17"; + std::string chars127; + for (int i = 1; i <= 127; ++i) { + chars127 += static_cast<char>(i); + } + auto value = TracedValue::Create(); + value->SetString("a", string1); + value->SetString("b", chars127); + + std::string json; + value->AppendAsTraceFormat(&json); + // Cannot use the expected value literal directly in CHECK_EQ + // as it fails to process # character on Windows. + const char* expected = + "{\"a\":\"abc\\\"\'\\\\\\\\x\\\"y\'z\\n\\t\\u0017\",\"b\":" + "\"\\u0001\\u0002\\u0003\\u0004\\u0005\\u0006\\u0007\\u0008\\t\\n\\u000B" + "\\u000C\\u000D\\u000E\\u000F\\u0010\\u0011\\u0012\\u0013\\u0014\\u0015\\" + "u0016\\u0017\\u0018\\u0019\\u001A\\u001B\\u001C\\u001D\\u001E\\u001F " + "!\\\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\\\]^_`" + "abcdefghijklmnopqrstuvwxyz{|}~\177\"}"; + CHECK_EQ(expected, json); +} diff --git a/deps/v8/test/cctest/test-types.cc b/deps/v8/test/cctest/test-types.cc index dd1b3e3703..71bd3dbf29 100644 --- a/deps/v8/test/cctest/test-types.cc +++ b/deps/v8/test/cctest/test-types.cc @@ -31,12 +31,6 @@ 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 { @@ -51,7 +45,7 @@ struct Tests { Tests() : isolate(CcTest::InitIsolateOnce()), scope(isolate), - zone(isolate->allocator()), + zone(isolate->allocator(), ZONE_NAME), T(&zone, isolate, isolate->random_number_generator()) {} bool IsBitset(Type* type) { return type->IsBitsetForTesting(); } @@ -113,8 +107,8 @@ struct Tests { for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { Type* t = *it; CHECK(1 == - this->IsBitset(t) + t->IsConstant() + t->IsRange() + - this->IsUnion(t)); + this->IsBitset(t) + t->IsHeapConstant() + t->IsRange() + + t->IsOtherNumberConstant() + this->IsUnion(t)); } } @@ -191,15 +185,25 @@ struct Tests { // Constructor for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { Handle<i::Object> value = *vt; - Type* type = T.Constant(value); - CHECK(type->IsConstant()); + Type* type = T.NewConstant(value); + CHECK(type->IsHeapConstant() || type->IsOtherNumberConstant() || + type->IsRange()); } // Value attribute for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { Handle<i::Object> value = *vt; - Type* type = T.Constant(value); - CHECK(*value == *type->AsConstant()->Value()); + Type* type = T.NewConstant(value); + if (type->IsHeapConstant()) { + CHECK(value.address() == type->AsHeapConstant()->Value().address()); + } else if (type->IsOtherNumberConstant()) { + CHECK(value->IsHeapNumber()); + CHECK(value->Number() == type->AsOtherNumberConstant()->Value()); + } else { + CHECK(type->IsRange()); + double v = value->Number(); + CHECK(v == type->AsRange()->Min() && v == type->AsRange()->Max()); + } } // Functionality & Injectivity: Constant(V1) = Constant(V2) iff V1 = V2 @@ -207,61 +211,72 @@ struct Tests { for (ValueIterator vt2 = T.values.begin(); vt2 != T.values.end(); ++vt2) { Handle<i::Object> value1 = *vt1; Handle<i::Object> value2 = *vt2; - Type* type1 = T.Constant(value1); - Type* type2 = T.Constant(value2); - CHECK(Equal(type1, type2) == (*value1 == *value2)); + Type* type1 = T.NewConstant(value1); + Type* type2 = T.NewConstant(value2); + if (type1->IsOtherNumberConstant() && type2->IsOtherNumberConstant()) { + CHECK(Equal(type1, type2) == + (type1->AsOtherNumberConstant()->Value() == + type2->AsOtherNumberConstant()->Value())); + } else if (type1->IsRange() && type2->IsRange()) { + CHECK(Equal(type1, type2) == + ((type1->AsRange()->Min() == type2->AsRange()->Min()) && + (type1->AsRange()->Max() == type2->AsRange()->Max()))); + } else { + 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)); + CHECK(T.NewConstant(fac->NewNumber(0))->Is(T.UnsignedSmall)); + CHECK(T.NewConstant(fac->NewNumber(1))->Is(T.UnsignedSmall)); + CHECK(T.NewConstant(fac->NewNumber(0x3fffffff))->Is(T.UnsignedSmall)); + CHECK(T.NewConstant(fac->NewNumber(-1))->Is(T.Negative31)); + CHECK(T.NewConstant(fac->NewNumber(-0x3fffffff))->Is(T.Negative31)); + CHECK(T.NewConstant(fac->NewNumber(-0x40000000))->Is(T.Negative31)); + CHECK(T.NewConstant(fac->NewNumber(0x40000000))->Is(T.Unsigned31)); + CHECK(!T.NewConstant(fac->NewNumber(0x40000000))->Is(T.Unsigned30)); + CHECK(T.NewConstant(fac->NewNumber(0x7fffffff))->Is(T.Unsigned31)); + CHECK(!T.NewConstant(fac->NewNumber(0x7fffffff))->Is(T.Unsigned30)); + CHECK(T.NewConstant(fac->NewNumber(-0x40000001))->Is(T.Negative32)); + CHECK(!T.NewConstant(fac->NewNumber(-0x40000001))->Is(T.Negative31)); + CHECK(T.NewConstant(fac->NewNumber(-0x7fffffff))->Is(T.Negative32)); + CHECK(!T.NewConstant(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)); + CHECK(!T.NewConstant(fac->NewNumber(0x40000000))->Is(T.UnsignedSmall)); + CHECK(!T.NewConstant(fac->NewNumber(0x7fffffff))->Is(T.UnsignedSmall)); + CHECK(!T.NewConstant(fac->NewNumber(-0x40000001))->Is(T.SignedSmall)); + CHECK(!T.NewConstant(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)); + CHECK(T.NewConstant(fac->NewNumber(0x40000000))->Is(T.UnsignedSmall)); + CHECK(T.NewConstant(fac->NewNumber(0x7fffffff))->Is(T.UnsignedSmall)); + CHECK(T.NewConstant(fac->NewNumber(-0x40000001))->Is(T.SignedSmall)); + CHECK(T.NewConstant(fac->NewNumber(-0x7fffffff - 1))->Is(T.SignedSmall)); + } + CHECK(T.NewConstant(fac->NewNumber(0x80000000u))->Is(T.Unsigned32)); + CHECK(!T.NewConstant(fac->NewNumber(0x80000000u))->Is(T.Unsigned31)); + CHECK(T.NewConstant(fac->NewNumber(0xffffffffu))->Is(T.Unsigned32)); + CHECK(!T.NewConstant(fac->NewNumber(0xffffffffu))->Is(T.Unsigned31)); + CHECK(T.NewConstant(fac->NewNumber(0xffffffffu + 1.0))->Is(T.PlainNumber)); + CHECK(!T.NewConstant(fac->NewNumber(0xffffffffu + 1.0))->Is(T.Integral32)); + CHECK(T.NewConstant(fac->NewNumber(-0x7fffffff - 2.0))->Is(T.PlainNumber)); + CHECK(!T.NewConstant(fac->NewNumber(-0x7fffffff - 2.0))->Is(T.Integral32)); + CHECK(T.NewConstant(fac->NewNumber(0.1))->Is(T.PlainNumber)); + CHECK(!T.NewConstant(fac->NewNumber(0.1))->Is(T.Integral32)); + CHECK(T.NewConstant(fac->NewNumber(-10.1))->Is(T.PlainNumber)); + CHECK(!T.NewConstant(fac->NewNumber(-10.1))->Is(T.Integral32)); + CHECK(T.NewConstant(fac->NewNumber(10e60))->Is(T.PlainNumber)); + CHECK(!T.NewConstant(fac->NewNumber(10e60))->Is(T.Integral32)); + CHECK(T.NewConstant(fac->NewNumber(-1.0 * 0.0))->Is(T.MinusZero)); + CHECK( + T.NewConstant(fac->NewNumber(std::numeric_limits<double>::quiet_NaN())) + ->Is(T.NaN)); + CHECK(T.NewConstant(fac->NewNumber(V8_INFINITY))->Is(T.PlainNumber)); + CHECK(!T.NewConstant(fac->NewNumber(V8_INFINITY))->Is(T.Integral32)); + CHECK(T.NewConstant(fac->NewNumber(-V8_INFINITY))->Is(T.PlainNumber)); + CHECK(!T.NewConstant(fac->NewNumber(-V8_INFINITY))->Is(T.Integral32)); } void Range() { @@ -317,7 +332,7 @@ struct Tests { // Constant(V)->Is(Of(V)) for (ValueIterator vt = T.values.begin(); vt != T.values.end(); ++vt) { Handle<i::Object> value = *vt; - Type* const_type = T.Constant(value); + Type* const_type = T.NewConstant(value); Type* of_type = T.Of(value); CHECK(const_type->Is(of_type)); } @@ -327,7 +342,7 @@ struct Tests { 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* const_type = T.NewConstant(value); Type* of_type = T.Of(value); CHECK(!of_type->Is(type) || const_type->Is(type)); } @@ -338,7 +353,7 @@ struct Tests { 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* const_type = T.NewConstant(value); Type* of_type = T.Of(value); CHECK(!const_type->Is(type) || of_type->Is(type) || type->Maybe(const_type)); @@ -521,10 +536,11 @@ struct Tests { Type* type2 = *j; CHECK(!type1->Is(type2) || this->IsBitset(type2) || this->IsUnion(type2) || this->IsUnion(type1) || - (type1->IsConstant() && type2->IsConstant()) || - (type1->IsConstant() && type2->IsRange()) || + (type1->IsHeapConstant() && type2->IsHeapConstant()) || (this->IsBitset(type1) && type2->IsRange()) || (type1->IsRange() && type2->IsRange()) || + (type1->IsOtherNumberConstant() && + type2->IsOtherNumberConstant()) || !type1->IsInhabited()); } } @@ -559,37 +575,27 @@ struct Tests { 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->Is(const_type2) == (*value1 == *value2)); + Type* const_type1 = T.NewConstant(value1); + Type* const_type2 = T.NewConstant(value2); + if (const_type1->IsOtherNumberConstant() && + const_type2->IsOtherNumberConstant()) { + CHECK(const_type1->Is(const_type2) == + (const_type1->AsOtherNumberConstant()->Value() == + const_type2->AsOtherNumberConstant()->Value())); + } else if (const_type1->IsRange() && const_type2->IsRange()) { + CHECK(Equal(const_type1, const_type2) == + ((const_type1->AsRange()->Min() == + const_type2->AsRange()->Min()) && + (const_type1->AsRange()->Max() == + const_type2->AsRange()->Max()))); + } else { + CHECK(const_type1->Is(const_type2) == (*value1 == *value2)); + } } } // Range-specific subtyping - // If IsInteger(v) then Constant(v)->Is(Range(v, v)). - for (TypeIterator it = T.types.begin(); it != T.types.end(); ++it) { - Type* 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) { - Type* type1 = *it1; - Type* 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) { Type* type = *it; @@ -712,9 +718,22 @@ struct Tests { 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->Maybe(const_type2) == (*value1 == *value2)); + Type* const_type1 = T.NewConstant(value1); + Type* const_type2 = T.NewConstant(value2); + if (const_type1->IsOtherNumberConstant() && + const_type2->IsOtherNumberConstant()) { + CHECK(const_type1->Maybe(const_type2) == + (const_type1->AsOtherNumberConstant()->Value() == + const_type2->AsOtherNumberConstant()->Value())); + } else if (const_type1->IsRange() && const_type2->IsRange()) { + CHECK(Equal(const_type1, const_type2) == + ((const_type1->AsRange()->Min() == + const_type2->AsRange()->Min()) && + (const_type1->AsRange()->Max() == + const_type2->AsRange()->Max()))); + } else { + CHECK(const_type1->Maybe(const_type2) == (*value1 == *value2)); + } } } @@ -1054,20 +1073,6 @@ struct Tests { 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) { - Type* type1 = *it1; - Type* type2 = *it2; - if (type1->IsConstant() && type2->IsRange()) { - Type* u = T.Union(type1, type2); - - CHECK(type2->Min() == u->GetRange()->Min()); - CHECK(type2->Max() == u->GetRange()->Max()); - } - } - } } }; diff --git a/deps/v8/test/cctest/test-unboxed-doubles.cc b/deps/v8/test/cctest/test-unboxed-doubles.cc index dde26d2676..abaa058f85 100644 --- a/deps/v8/test/cctest/test-unboxed-doubles.cc +++ b/deps/v8/test/cctest/test-unboxed-doubles.cc @@ -1141,7 +1141,7 @@ TEST(DoScavengeWithIncrementalWriteBarrier) { // simulate incremental marking. FLAG_stress_compaction = true; FLAG_manual_evacuation_candidates_selection = true; - ec_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + heap::ForceEvacuationCandidate(ec_page); heap::SimulateIncrementalMarking(heap); // Disable stress compaction mode in order to let GC do scavenge. FLAG_stress_compaction = false; @@ -1459,7 +1459,7 @@ static void TestIncrementalWriteBarrier(Handle<Map> map, Handle<Map> new_map, // Heap is ready, force |ec_page| to become an evacuation candidate and // simulate incremental marking. - ec_page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); + heap::ForceEvacuationCandidate(ec_page); heap::SimulateIncrementalMarking(heap); // Check that everything is ready for triggering incremental write barrier diff --git a/deps/v8/test/cctest/test-unique.cc b/deps/v8/test/cctest/test-unique.cc index 980f0b6538..21eae27ca0 100644 --- a/deps/v8/test/cctest/test-unique.cc +++ b/deps/v8/test/cctest/test-unique.cc @@ -150,7 +150,7 @@ TEST(UniqueSet_Add) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); UniqueSet<String>* set = new(&zone) UniqueSet<String>(); @@ -177,7 +177,7 @@ TEST(UniqueSet_Remove) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); UniqueSet<String>* set = new(&zone) UniqueSet<String>(); @@ -217,7 +217,7 @@ TEST(UniqueSet_Contains) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); UniqueSet<String>* set = new(&zone) UniqueSet<String>(); @@ -248,7 +248,7 @@ TEST(UniqueSet_At) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); UniqueSet<String>* set = new(&zone) UniqueSet<String>(); @@ -285,7 +285,7 @@ TEST(UniqueSet_Equals) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); UniqueSet<String>* set1 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set2 = new(&zone) UniqueSet<String>(); @@ -323,7 +323,7 @@ TEST(UniqueSet_IsSubset1) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); UniqueSet<String>* set1 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set2 = new(&zone) UniqueSet<String>(); @@ -358,7 +358,7 @@ TEST(UniqueSet_IsSubset2) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C_D_E_F_G; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); UniqueSet<String>* set1 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set2 = new(&zone) UniqueSet<String>(); @@ -401,7 +401,7 @@ TEST(UniqueSet_IsSubsetExhaustive) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C_D_E_F_G; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); Unique<String> elements[] = { A, B, C, D, E, F, G @@ -424,7 +424,7 @@ TEST(UniqueSet_Intersect1) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); UniqueSet<String>* set1 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set2 = new(&zone) UniqueSet<String>(); @@ -465,7 +465,7 @@ TEST(UniqueSet_IntersectExhaustive) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C_D_E_F_G; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); Unique<String> elements[] = { A, B, C, D, E, F, G @@ -492,7 +492,7 @@ TEST(UniqueSet_Union1) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); UniqueSet<String>* set1 = new(&zone) UniqueSet<String>(); UniqueSet<String>* set2 = new(&zone) UniqueSet<String>(); @@ -533,7 +533,7 @@ TEST(UniqueSet_UnionExhaustive) { MAKE_HANDLES_AND_DISALLOW_ALLOCATION; MAKE_UNIQUES_A_B_C_D_E_F_G; - Zone zone(CcTest::i_isolate()->allocator()); + Zone zone(CcTest::i_isolate()->allocator(), ZONE_NAME); Unique<String> elements[] = { A, B, C, D, E, F, G diff --git a/deps/v8/test/cctest/types-fuzz.h b/deps/v8/test/cctest/types-fuzz.h index 16bfd737ea..90cdc8e989 100644 --- a/deps/v8/test/cctest/types-fuzz.h +++ b/deps/v8/test/cctest/types-fuzz.h @@ -54,27 +54,37 @@ class Types { JS_OBJECT_TYPE, JSObject::kHeaderSize); smi = handle(Smi::FromInt(666), isolate); + boxed_smi = isolate->factory()->NewHeapNumber(666); signed32 = isolate->factory()->NewHeapNumber(0x40000000); + float1 = isolate->factory()->NewHeapNumber(1.53); + float2 = isolate->factory()->NewHeapNumber(0.53); + // float3 is identical to float1 in order to test that OtherNumberConstant + // types are equal by double value and not by handle pointer value. + float3 = isolate->factory()->NewHeapNumber(1.53); object1 = isolate->factory()->NewJSObjectFromMap(object_map); object2 = isolate->factory()->NewJSObjectFromMap(object_map); array = isolate->factory()->NewJSArray(20); uninitialized = isolate->factory()->uninitialized_value(); - SmiConstant = Type::Constant(smi, zone); - Signed32Constant = Type::Constant(signed32, zone); + SmiConstant = Type::NewConstant(smi, zone); + Signed32Constant = Type::NewConstant(signed32, zone); - ObjectConstant1 = Type::Constant(object1, zone); - ObjectConstant2 = Type::Constant(object2, zone); - ArrayConstant = Type::Constant(array, zone); - UninitializedConstant = Type::Constant(uninitialized, zone); + ObjectConstant1 = Type::HeapConstant(object1, zone); + ObjectConstant2 = Type::HeapConstant(object2, zone); + ArrayConstant = Type::HeapConstant(array, zone); + UninitializedConstant = Type::HeapConstant(uninitialized, zone); values.push_back(smi); + values.push_back(boxed_smi); values.push_back(signed32); values.push_back(object1); values.push_back(object2); values.push_back(array); values.push_back(uninitialized); + values.push_back(float1); + values.push_back(float2); + values.push_back(float3); for (ValueVector::iterator it = values.begin(); it != values.end(); ++it) { - types.push_back(Type::Constant(*it, zone)); + types.push_back(Type::NewConstant(*it, zone)); } integers.push_back(isolate->factory()->NewNumber(-V8_INFINITY)); @@ -98,7 +108,11 @@ class Types { Handle<i::Map> object_map; Handle<i::Smi> smi; + Handle<i::HeapNumber> boxed_smi; Handle<i::HeapNumber> signed32; + Handle<i::HeapNumber> float1; + Handle<i::HeapNumber> float2; + Handle<i::HeapNumber> float3; Handle<i::JSObject> object1; Handle<i::JSObject> object2; Handle<i::JSArray> array; @@ -129,8 +143,12 @@ class Types { Type* Of(Handle<i::Object> value) { return Type::Of(value, zone_); } - Type* Constant(Handle<i::Object> value) { - return Type::Constant(value, zone_); + Type* NewConstant(Handle<i::Object> value) { + return Type::NewConstant(value, zone_); + } + + Type* HeapConstant(Handle<i::HeapObject> value) { + return Type::HeapConstant(value, zone_); } Type* Range(double min, double max) { return Type::Range(min, max, zone_); } @@ -170,7 +188,7 @@ class Types { } case 1: { // constant int i = rng_->NextInt(static_cast<int>(values.size())); - return Type::Constant(values[i], zone_); + return Type::NewConstant(values[i], zone_); } case 2: { // range int i = rng_->NextInt(static_cast<int>(integers.size())); diff --git a/deps/v8/test/cctest/wasm/test-managed.cc b/deps/v8/test/cctest/wasm/test-managed.cc new file mode 100644 index 0000000000..00b1c9bb57 --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-managed.cc @@ -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. + +#include <stdint.h> +#include <stdlib.h> +#include <string.h> + +#include "src/wasm/managed.h" + +#include "test/cctest/cctest.h" +#include "test/common/wasm/test-signatures.h" + +using namespace v8::base; +using namespace v8::internal; + +class DeleteRecorder { + public: + explicit DeleteRecorder(bool* deleted) : deleted_(deleted) { + *deleted_ = false; + } + ~DeleteRecorder() { *deleted_ = true; } + + private: + bool* deleted_; +}; + +TEST(ManagedCollect) { + Isolate* isolate = CcTest::InitIsolateOnce(); + bool deleted = false; + DeleteRecorder* d = new DeleteRecorder(&deleted); + + { + HandleScope scope(isolate); + auto handle = Managed<DeleteRecorder>::New(isolate, d); + USE(handle); + } + + CcTest::CollectAllAvailableGarbage(); + + CHECK(deleted); +} + +TEST(ManagedCollectNoDelete) { + Isolate* isolate = CcTest::InitIsolateOnce(); + bool deleted = false; + DeleteRecorder* d = new DeleteRecorder(&deleted); + + { + HandleScope scope(isolate); + auto handle = Managed<DeleteRecorder>::New(isolate, d, false); + USE(handle); + } + + CcTest::CollectAllAvailableGarbage(); + + CHECK(!deleted); + delete d; +} 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 3d8d484295..e9a2d2da47 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-64.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-64.cc @@ -147,6 +147,93 @@ WASM_EXEC_TEST(I64Sub) { } } +WASM_EXEC_TEST(I64AddUseOnlyLowWord) { + REQUIRE(I64Add); + REQUIRE(I32ConvertI64); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); + BUILD(r, WASM_I32_CONVERT_I64( + WASM_I64_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); + FOR_INT64_INPUTS(i) { + FOR_INT64_INPUTS(j) { + CHECK_EQ(static_cast<int32_t>(*i + *j), r.Call(*i, *j)); + } + } +} + +WASM_EXEC_TEST(I64SubUseOnlyLowWord) { + REQUIRE(I64Sub); + REQUIRE(I32ConvertI64); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); + BUILD(r, WASM_I32_CONVERT_I64( + WASM_I64_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); + FOR_INT64_INPUTS(i) { + FOR_INT64_INPUTS(j) { + CHECK_EQ(static_cast<int32_t>(*i - *j), r.Call(*i, *j)); + } + } +} + +WASM_EXEC_TEST(I64MulUseOnlyLowWord) { + REQUIRE(I64Mul); + REQUIRE(I32ConvertI64); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); + BUILD(r, WASM_I32_CONVERT_I64( + WASM_I64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); + FOR_INT64_INPUTS(i) { + FOR_INT64_INPUTS(j) { + CHECK_EQ(static_cast<int32_t>(*i * *j), r.Call(*i, *j)); + } + } +} + +WASM_EXEC_TEST(I64ShlUseOnlyLowWord) { + REQUIRE(I64Shl); + REQUIRE(I32ConvertI64); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); + BUILD(r, WASM_I32_CONVERT_I64( + WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); + FOR_INT64_INPUTS(i) { + FOR_INT64_INPUTS(j) { + int32_t expected = static_cast<int32_t>((*i) << (*j & 0x3f)); + CHECK_EQ(expected, r.Call(*i, *j)); + } + } +} + +WASM_EXEC_TEST(I64ShrUseOnlyLowWord) { + REQUIRE(I64ShrU); + REQUIRE(I32ConvertI64); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); + BUILD(r, WASM_I32_CONVERT_I64( + WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); + FOR_UINT64_INPUTS(i) { + FOR_UINT64_INPUTS(j) { + int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f)); + CHECK_EQ(expected, r.Call(*i, *j)); + } + } +} + +WASM_EXEC_TEST(I64SarUseOnlyLowWord) { + REQUIRE(I64ShrS); + REQUIRE(I32ConvertI64); + WasmRunner<int32_t> r(execution_mode, MachineType::Int64(), + MachineType::Int64()); + BUILD(r, WASM_I32_CONVERT_I64( + WASM_I64_SAR(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1)))); + FOR_INT64_INPUTS(i) { + FOR_INT64_INPUTS(j) { + int32_t expected = static_cast<int32_t>((*i) >> (*j & 0x3f)); + CHECK_EQ(expected, r.Call(*i, *j)); + } + } +} + WASM_EXEC_TEST(I64DivS) { REQUIRE(I64DivS); WasmRunner<int64_t> r(execution_mode, MachineType::Int64(), @@ -213,7 +300,7 @@ WASM_EXEC_TEST(I64DivU_Trap) { WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), MachineType::Uint64()); BUILD(r, WASM_I64_DIVU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - CHECK_EQ(0, r.Call(asu64(0), asu64(100))); + CHECK_EQ(0u, r.Call(asu64(0), asu64(100))); CHECK_TRAP64(r.Call(asu64(100), asu64(0))); CHECK_TRAP64(r.Call(asu64(1001), asu64(0))); CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); @@ -284,7 +371,7 @@ WASM_EXEC_TEST(I64RemU_Trap) { WasmRunner<uint64_t> r(execution_mode, MachineType::Uint64(), MachineType::Uint64()); BUILD(r, WASM_I64_REMU(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - CHECK_EQ(17, r.Call(asu64(217), asu64(100))); + CHECK_EQ(17u, r.Call(asu64(217), asu64(100))); CHECK_TRAP64(r.Call(asu64(100), asu64(0))); CHECK_TRAP64(r.Call(asu64(1001), asu64(0))); CHECK_TRAP64(r.Call(std::numeric_limits<uint64_t>::max(), asu64(0))); @@ -335,22 +422,22 @@ WASM_EXEC_TEST(I64Shl) { } } { - WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(0))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 0, r.Call(*i)); } } { - WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(32))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 32, r.Call(*i)); } } { - WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(20))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 20, r.Call(*i)); } } { - WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHL(WASM_GET_LOCAL(0), WASM_I64V_1(40))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i << 40, r.Call(*i)); } } @@ -371,22 +458,22 @@ WASM_EXEC_TEST(I64ShrU) { } } { - WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(0))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 0, r.Call(*i)); } } { - WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(32))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 32, r.Call(*i)); } } { - WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(20))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 20, r.Call(*i)); } } { - WasmRunner<int64_t> r(execution_mode, MachineType::Int64()); + WasmRunner<uint64_t> r(execution_mode, MachineType::Int64()); BUILD(r, WASM_I64_SHR(WASM_GET_LOCAL(0), WASM_I64V_1(40))); FOR_UINT64_INPUTS(i) { CHECK_EQ(*i >> 40, r.Call(*i)); } } @@ -548,7 +635,7 @@ WASM_EXEC_TEST(I64UConvertI32) { REQUIRE(I64UConvertI32); WasmRunner<int64_t> r(execution_mode, MachineType::Uint32()); BUILD(r, WASM_I64_UCONVERT_I32(WASM_GET_LOCAL(0))); - FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<uint64_t>(*i), r.Call(*i)); } + FOR_UINT32_INPUTS(i) { CHECK_EQ(static_cast<int64_t>(*i), r.Call(*i)); } } WASM_EXEC_TEST(I64Popcnt) { @@ -1279,8 +1366,8 @@ WASM_EXEC_TEST(LoadMemI64) { BUILD(r, WASM_LOAD_MEM(MachineType::Int64(), WASM_I8(0))); - module.WriteMemory<int64_t>(&memory[0], 0xaabbccdd00112233LL); - CHECK_EQ(0xaabbccdd00112233LL, r.Call()); + module.WriteMemory<int64_t>(&memory[0], 0x1abbccdd00112233LL); + CHECK_EQ(0x1abbccdd00112233LL, r.Call()); module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL); CHECK_EQ(0x33aabbccdd001122LL, r.Call()); @@ -1300,8 +1387,8 @@ WASM_EXEC_TEST(LoadMemI64_alignment) { BUILD(r, WASM_LOAD_MEM_ALIGNMENT(MachineType::Int64(), WASM_I8(0), alignment)); - module.WriteMemory<int64_t>(&memory[0], 0xaabbccdd00112233LL); - CHECK_EQ(0xaabbccdd00112233LL, r.Call()); + module.WriteMemory<int64_t>(&memory[0], 0x1abbccdd00112233LL); + CHECK_EQ(0x1abbccdd00112233LL, r.Call()); module.WriteMemory<int64_t>(&memory[0], 0x33aabbccdd001122LL); CHECK_EQ(0x33aabbccdd001122LL, r.Call()); @@ -1467,7 +1554,7 @@ static void CompileCallIndirectMany(LocalType param) { TestSignatures sigs; for (byte num_params = 0; num_params < 40; num_params++) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); HandleScope scope(CcTest::InitIsolateOnce()); TestingModule module(kExecuteCompiled); FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); @@ -1483,7 +1570,7 @@ static void CompileCallIndirectMany(LocalType param) { ADD_CODE(code, kExprGetLocal, p); } ADD_CODE(code, kExprI8Const, 0); - ADD_CODE(code, kExprCallIndirect, 1); + ADD_CODE(code, kExprCallIndirect, 1, TABLE_ZERO); t.Build(&code[0], &code[0] + code.size()); t.Compile(); @@ -1507,7 +1594,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::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); TestingModule module(execution_mode); module.AddMemory(1024); MachineType* memtypes = &mixed[start]; 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 007fc7a864..bd80e28f9f 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-asmjs.cc @@ -237,33 +237,33 @@ WASM_EXEC_TEST(StoreMemI32_oob_asm) { TEST_BODY(kExprI32AsmjsStoreMem16) \ TEST_BODY(kExprI32AsmjsStoreMem) -#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], \ - RelocInfo::WASM_MEMORY_REFERENCE)); \ - CHECK_NE( \ - 0, GetMatchingRelocInfoCount(module.instance->function_code[0], \ - RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ +#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(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ + RelocInfo::WASM_MEMORY_REFERENCE)); \ + CHECK_NE( \ + 0u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ } 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))); \ - CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], \ - RelocInfo::WASM_MEMORY_REFERENCE)); \ - CHECK_NE( \ - 0, GetMatchingRelocInfoCount(module.instance->function_code[0], \ - RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ +#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))); \ + CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ + RelocInfo::WASM_MEMORY_REFERENCE)); \ + CHECK_NE( \ + 0u, GetMatchingRelocInfoCount(module.instance->function_code[0], \ + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); \ } FOREACH_INT_CHECKED_STORE_OP(INT_STORE_TEST) @@ -274,10 +274,11 @@ TEST(RunWasm_AsmCheckedLoadFloat32RelocInfo) { WasmRunner<float> r(&module, MachineType::Uint32()); BUILD(r, WASM_UNOP(kExprF32AsmjsLoadMem, WASM_GET_LOCAL(0))); - CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], - RelocInfo::WASM_MEMORY_REFERENCE)); - CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], - RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_REFERENCE)); + CHECK_NE(0u, + GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); } TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) { @@ -287,10 +288,11 @@ TEST(RunWasm_AsmCheckedStoreFloat32RelocInfo) { BUILD(r, WASM_BINOP(kExprF32AsmjsStoreMem, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], - RelocInfo::WASM_MEMORY_REFERENCE)); - CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], - RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_REFERENCE)); + CHECK_NE(0u, + GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); } TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) { @@ -299,10 +301,11 @@ TEST(RunWasm_AsmCheckedLoadFloat64RelocInfo) { WasmRunner<double> r(&module, MachineType::Uint32()); BUILD(r, WASM_UNOP(kExprF64AsmjsLoadMem, WASM_GET_LOCAL(0))); - CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], - RelocInfo::WASM_MEMORY_REFERENCE)); - CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], - RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_REFERENCE)); + CHECK_NE(0u, + GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); } TEST(RunWasm_AsmCheckedStoreFloat64RelocInfo) { @@ -312,8 +315,9 @@ TEST(RunWasm_AsmCheckedStoreFloat64RelocInfo) { BUILD(r, WASM_BINOP(kExprF64AsmjsStoreMem, WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); - CHECK_EQ(1, GetMatchingRelocInfoCount(module.instance->function_code[0], - RelocInfo::WASM_MEMORY_REFERENCE)); - CHECK_NE(0, GetMatchingRelocInfoCount(module.instance->function_code[0], - RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); + CHECK_EQ(1u, GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_REFERENCE)); + CHECK_NE(0u, + GetMatchingRelocInfoCount(module.instance->function_code[0], + RelocInfo::WASM_MEMORY_SIZE_REFERENCE)); } 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 0489d016d7..47d97f4e48 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-interpreter.cc @@ -202,7 +202,8 @@ TEST(Breakpoint_I32Add) { thread->Run(); // run to next breakpoint // Check the thread stopped at the right pc. CHECK_EQ(WasmInterpreter::PAUSED, thread->state()); - CHECK_EQ(kLocalsDeclSize + offsets[i], thread->GetBreakpointPc()); + CHECK_EQ(static_cast<size_t>(kLocalsDeclSize + offsets[i]), + thread->GetBreakpointPc()); } thread->Run(); // run to completion @@ -280,7 +281,8 @@ TEST(Breakpoint_I32And_disable) { thread->Run(); // run to next breakpoint // Check the thread stopped at the right pc. CHECK_EQ(WasmInterpreter::PAUSED, thread->state()); - CHECK_EQ(kLocalsDeclSize + offsets[0], thread->GetBreakpointPc()); + CHECK_EQ(static_cast<size_t>(kLocalsDeclSize + offsets[0]), + thread->GetBreakpointPc()); } thread->Run(); // run to completion @@ -333,6 +335,72 @@ TEST(GrowMemoryInvalidSize) { } } +TEST(TestPossibleNondeterminism) { + { + // F32Div may produced NaN + TestingModule module(kExecuteInterpreted); + WasmRunner<float> r(&module, MachineType::Float32(), + MachineType::Float32()); + BUILD(r, WASM_F32_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + r.Call(1048575.5f, 2.5f); + CHECK(!r.possible_nondeterminism()); + r.Call(0.0f, 0.0f); + CHECK(r.possible_nondeterminism()); + } + { + // F32Sqrt may produced NaN + TestingModule module(kExecuteInterpreted); + WasmRunner<float> r(&module, MachineType::Float32()); + BUILD(r, WASM_F32_SQRT(WASM_GET_LOCAL(0))); + r.Call(16.0f); + CHECK(!r.possible_nondeterminism()); + r.Call(-1048575.5f); + CHECK(r.possible_nondeterminism()); + } + { + // F32Mul may produced NaN + TestingModule module(kExecuteInterpreted); + WasmRunner<float> r(&module, MachineType::Float32(), + MachineType::Float32()); + BUILD(r, WASM_F32_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + r.Call(1048575.5f, 2.5f); + CHECK(!r.possible_nondeterminism()); + r.Call(std::numeric_limits<float>::infinity(), 0.0f); + CHECK(r.possible_nondeterminism()); + } + { + // F64Div may produced NaN + TestingModule module(kExecuteInterpreted); + WasmRunner<double> r(&module, MachineType::Float64(), + MachineType::Float64()); + BUILD(r, WASM_F64_DIV(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + r.Call(1048575.5, 2.5); + CHECK(!r.possible_nondeterminism()); + r.Call(0.0, 0.0); + CHECK(r.possible_nondeterminism()); + } + { + // F64Sqrt may produced NaN + TestingModule module(kExecuteInterpreted); + WasmRunner<double> r(&module, MachineType::Float64()); + BUILD(r, WASM_F64_SQRT(WASM_GET_LOCAL(0))); + r.Call(1048575.5); + CHECK(!r.possible_nondeterminism()); + r.Call(-1048575.5); + CHECK(r.possible_nondeterminism()); + } + { + // F64Mul may produced NaN + TestingModule module(kExecuteInterpreted); + WasmRunner<double> r(&module, MachineType::Float64(), + MachineType::Float64()); + BUILD(r, WASM_F64_MUL(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + r.Call(1048575.5, 2.5); + CHECK(!r.possible_nondeterminism()); + r.Call(std::numeric_limits<double>::infinity(), 0.0); + CHECK(r.possible_nondeterminism()); + } +} } // 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 c0307e0511..4a74128f50 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-js.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-js.cc @@ -429,7 +429,7 @@ void RunJSSelectAlignTest(int num_args, int num_params) { HandleScope scope(isolate); TestingModule module; uint32_t js_index = AddJSSelector(&module, &sig, which); - CHECK_EQ(0, js_index); + CHECK_EQ(0u, js_index); WasmFunctionCompiler t(&sig, &module); t.Build(&code[0], &code[end]); 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 b358208bc3..94054bd388 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-module.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-module.cc @@ -5,10 +5,13 @@ #include <stdlib.h> #include <string.h> +#include "src/snapshot/code-serializer.h" +#include "src/version.h" #include "src/wasm/module-decoder.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-objects.h" #include "src/wasm/wasm-opcodes.h" #include "test/cctest/cctest.h" @@ -21,6 +24,16 @@ using namespace v8::internal::compiler; using namespace v8::internal::wasm; namespace { +void Cleanup(Isolate* isolate = nullptr) { + // By sending a low memory notifications, we will try hard to collect all + // garbage and will therefore also invoke all weak callbacks of actually + // unreachable persistent handles. + if (!isolate) { + isolate = CcTest::InitIsolateOnce(); + } + reinterpret_cast<v8::Isolate*>(isolate)->LowMemoryNotification(); +} + void TestModule(Zone* zone, WasmModuleBuilder* builder, int32_t expected_result) { ZoneBuffer buffer(zone); @@ -48,369 +61,856 @@ void TestModuleException(Zone* zone, WasmModuleBuilder* builder) { isolate->clear_pending_exception(); } -void ExportAs(WasmFunctionBuilder* f, const char* name) { - f->SetExported(); - f->SetName(name, static_cast<int>(strlen(name))); -} - -void ExportAsMain(WasmFunctionBuilder* f) { - static const char kMainName[] = "main"; - ExportAs(f, kMainName); -} +void ExportAsMain(WasmFunctionBuilder* f) { f->ExportAs(CStrVector("main")); } } // namespace TEST(Run_WasmModule_Return114) { - static const int32_t kReturnValue = 114; - 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_I8(kReturnValue)}; - f->EmitCode(code, sizeof(code)); - TestModule(&zone, builder, kReturnValue); + { + static const int32_t kReturnValue = 114; + TestSignatures sigs; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); + ExportAsMain(f); + byte code[] = {WASM_I8(kReturnValue)}; + f->EmitCode(code, sizeof(code)); + TestModule(&zone, builder, kReturnValue); + } + Cleanup(); } TEST(Run_WasmModule_CallAdd) { - v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); - TestSignatures sigs; - - WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - - 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))}; - f1->EmitCode(code1, sizeof(code1)); - - WasmFunctionBuilder* f2 = builder->AddFunction(sigs.i_v()); - - 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); + { + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + TestSignatures sigs; + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + + 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))}; + f1->EmitCode(code1, sizeof(code1)); + + WasmFunctionBuilder* f2 = builder->AddFunction(sigs.i_v()); + + 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); + } + Cleanup(); } TEST(Run_WasmModule_ReadLoadedDataSegment) { - static const byte kDataSegmentDest0 = 12; - v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); - TestSignatures sigs; - - WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - 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(data, sizeof(data), kDataSegmentDest0); - TestModule(&zone, builder, 0xddccbbaa); + { + static const byte kDataSegmentDest0 = 12; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + TestSignatures sigs; + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + 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(data, sizeof(data), kDataSegmentDest0); + TestModule(&zone, builder, 0xddccbbaa); + } + Cleanup(); } TEST(Run_WasmModule_CheckMemoryIsZero) { - static const int kCheckSize = 16 * 1024; - v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); - TestSignatures sigs; - - WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); - - uint16_t localIndex = f->AddLocal(kAstI32); - ExportAsMain(f); - 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(3, WASM_I8(-1)), WASM_INC_LOCAL_BY(localIndex, 4))), - WASM_I8(11))}; - f->EmitCode(code, sizeof(code)); - TestModule(&zone, builder, 11); + { + static const int kCheckSize = 16 * 1024; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + TestSignatures sigs; + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); + + uint16_t localIndex = f->AddLocal(kAstI32); + ExportAsMain(f); + 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(3, WASM_I8(-1)), WASM_INC_LOCAL_BY(localIndex, 4))), + WASM_I8(11))}; + f->EmitCode(code, sizeof(code)); + TestModule(&zone, builder, 11); + } + Cleanup(); } TEST(Run_WasmModule_CallMain_recursive) { - v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); - TestSignatures sigs; - - WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); - - uint16_t localIndex = f->AddLocal(kAstI32); - ExportAsMain(f); - byte code[] = { - WASM_SET_LOCAL(localIndex, - WASM_LOAD_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_CALL_FUNCTION0(0)), - WASM_I8(55))}; - f->EmitCode(code, sizeof(code)); - TestModule(&zone, builder, 55); + { + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + TestSignatures sigs; + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); + + uint16_t localIndex = f->AddLocal(kAstI32); + ExportAsMain(f); + byte code[] = { + WASM_SET_LOCAL(localIndex, + WASM_LOAD_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_CALL_FUNCTION0(0)), + WASM_I8(55))}; + f->EmitCode(code, sizeof(code)); + TestModule(&zone, builder, 55); + } + Cleanup(); } TEST(Run_WasmModule_Global) { - 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); - WasmFunctionBuilder* f1 = builder->AddFunction(sigs.i_v()); - byte code1[] = { - WASM_I32_ADD(WASM_GET_GLOBAL(global1), WASM_GET_GLOBAL(global2))}; - 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->func_index()))}; - f2->EmitCode(code2, sizeof(code2)); - TestModule(&zone, builder, 97); -} - -TEST(Run_WasmModule_Serialization) { - static const char* kFunctionName = "increment"; - v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); - - WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); - TestSignatures sigs; - - WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i()); - byte code[] = {WASM_GET_LOCAL(0), kExprI32Const, 1, kExprI32Add}; - f->EmitCode(code, sizeof(code)); - ExportAs(f, kFunctionName); - - ZoneBuffer buffer(&zone); - builder->WriteTo(buffer); - - 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); - std::unique_ptr<const WasmModule> module(decoding_result.val); - CHECK(!decoding_result.failed()); + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + TestSignatures sigs; + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + uint32_t global1 = builder->AddGlobal(kAstI32, 0); + uint32_t global2 = builder->AddGlobal(kAstI32, 0); + WasmFunctionBuilder* f1 = builder->AddFunction(sigs.i_v()); + byte code1[] = { + WASM_I32_ADD(WASM_GET_GLOBAL(global1), WASM_GET_GLOBAL(global2))}; + 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->func_index()))}; + f2->EmitCode(code2, sizeof(code2)); + TestModule(&zone, builder, 97); + } + Cleanup(); +} - MaybeHandle<FixedArray> compiled_module = - module->CompileFunctions(isolate, &thrower); - CHECK(!compiled_module.is_null()); - 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()); +// Approximate gtest TEST_F style, in case we adopt gtest. +class WasmSerializationTest { + public: + WasmSerializationTest() : zone_(&allocator_, ZONE_NAME) { + // Don't call here if we move to gtest. + SetUp(); + } - v8::Local<v8::WasmCompiledModule> v8_compiled_module = - v8_module_obj.As<v8::WasmCompiledModule>(); - data = v8_compiled_module->Serialize(); + void ClearSerializedData() { + serialized_bytes_.first = nullptr; + serialized_bytes_.second = 0; } - v8::Isolate::CreateParams create_params; - create_params.array_buffer_allocator = - CcTest::InitIsolateOnce()->array_buffer_allocator(); + void InvalidateVersion() { + uint32_t* buffer = reinterpret_cast<uint32_t*>( + const_cast<uint8_t*>(serialized_bytes_.first)); + buffer[SerializedCodeData::kVersionHashOffset] = Version::Hash() + 1; + } - v8::Isolate* v8_isolate = v8::Isolate::New(create_params); - { - 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); + void InvalidateWireBytes() { + memset(const_cast<uint8_t*>(wire_bytes_.first), '\0', + wire_bytes_.second / 2); + } + v8::MaybeLocal<v8::WasmCompiledModule> Deserialize() { + ErrorThrower thrower(current_isolate(), ""); v8::MaybeLocal<v8::WasmCompiledModule> deserialized = - v8::WasmCompiledModule::Deserialize(v8_isolate, data); - v8::Local<v8::WasmCompiledModule> compiled_module; - CHECK(deserialized.ToLocal(&compiled_module)); + v8::WasmCompiledModule::DeserializeOrCompile( + current_isolate_v8(), serialized_bytes(), wire_bytes()); + return deserialized; + } + + void DeserializeAndRun() { + ErrorThrower thrower(current_isolate(), ""); + v8::Local<v8::WasmCompiledModule> deserialized_module; + CHECK(Deserialize().ToLocal(&deserialized_module)); Handle<JSObject> module_object = - Handle<JSObject>::cast(v8::Utils::OpenHandle(*compiled_module)); + Handle<JSObject>::cast(v8::Utils::OpenHandle(*deserialized_module)); + { + DisallowHeapAllocation assume_no_gc; + Handle<WasmCompiledModule> compiled_part( + WasmCompiledModule::cast(module_object->GetInternalField(0)), + current_isolate()); + CHECK_EQ(memcmp(compiled_part->module_bytes()->GetCharsAddress(), + wire_bytes().first, wire_bytes().second), + 0); + } Handle<JSObject> instance = - WasmModule::Instantiate(isolate, &thrower, module_object, + WasmModule::Instantiate(current_isolate(), &thrower, module_object, Handle<JSReceiver>::null(), Handle<JSArrayBuffer>::null()) .ToHandleChecked(); - Handle<Object> params[1] = {Handle<Object>(Smi::FromInt(41), isolate)}; + Handle<Object> params[1] = { + Handle<Object>(Smi::FromInt(41), current_isolate())}; int32_t result = testing::CallWasmFunctionForTesting( - isolate, instance, &thrower, kFunctionName, 1, params, + current_isolate(), instance, &thrower, kFunctionName, 1, params, ModuleOrigin::kWasmOrigin); CHECK(result == 42); - new_ctx->Exit(); } + + Isolate* current_isolate() { + return reinterpret_cast<Isolate*>(current_isolate_v8_); + } + + ~WasmSerializationTest() { + // Don't call from here if we move to gtest + TearDown(); + } + + private: + static const char* kFunctionName; + + Zone* zone() { return &zone_; } + const v8::WasmCompiledModule::CallerOwnedBuffer& wire_bytes() const { + return wire_bytes_; + } + + const v8::WasmCompiledModule::CallerOwnedBuffer& serialized_bytes() const { + return serialized_bytes_; + } + + v8::Isolate* current_isolate_v8() { return current_isolate_v8_; } + + void SetUp() { + WasmModuleBuilder* builder = new (zone()) WasmModuleBuilder(zone()); + TestSignatures sigs; + + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_i()); + byte code[] = {WASM_GET_LOCAL(0), kExprI32Const, 1, kExprI32Add}; + f->EmitCode(code, sizeof(code)); + f->ExportAs(CStrVector(kFunctionName)); + + ZoneBuffer buffer(&zone_); + builder->WriteTo(buffer); + + Isolate* serialization_isolate = CcTest::InitIsolateOnce(); + ErrorThrower thrower(serialization_isolate, ""); + uint8_t* bytes = nullptr; + size_t bytes_size = 0; + { + HandleScope scope(serialization_isolate); + testing::SetupIsolateForWasmModule(serialization_isolate); + + ModuleResult decoding_result = + DecodeWasmModule(serialization_isolate, buffer.begin(), buffer.end(), + false, kWasmOrigin); + CHECK(!decoding_result.failed()); + + Handle<WasmModuleWrapper> module_wrapper = WasmModuleWrapper::New( + serialization_isolate, const_cast<WasmModule*>(decoding_result.val)); + + MaybeHandle<WasmCompiledModule> compiled_module = + decoding_result.val->CompileFunctions(serialization_isolate, + module_wrapper, &thrower); + CHECK(!compiled_module.is_null()); + Handle<JSObject> module_obj = WasmModuleObject::New( + serialization_isolate, compiled_module.ToHandleChecked()); + v8::Local<v8::Object> v8_module_obj = v8::Utils::ToLocal(module_obj); + CHECK(v8_module_obj->IsWebAssemblyCompiledModule()); + + v8::Local<v8::WasmCompiledModule> v8_compiled_module = + v8_module_obj.As<v8::WasmCompiledModule>(); + v8::Local<v8::String> uncompiled_bytes = + v8_compiled_module->GetWasmWireBytes(); + bytes_size = static_cast<size_t>(uncompiled_bytes->Length()); + bytes = zone()->NewArray<uint8_t>(bytes_size); + uncompiled_bytes->WriteOneByte(bytes, 0, uncompiled_bytes->Length(), + v8::String::NO_NULL_TERMINATION); + // keep alive data_ until the end + data_ = v8_compiled_module->Serialize(); + } + + wire_bytes_ = {const_cast<const uint8_t*>(bytes), bytes_size}; + + serialized_bytes_ = {data_.first.get(), data_.second}; + + v8::Isolate::CreateParams create_params; + create_params.array_buffer_allocator = + serialization_isolate->array_buffer_allocator(); + + current_isolate_v8_ = v8::Isolate::New(create_params); + v8::HandleScope new_scope(current_isolate_v8()); + v8::Local<v8::Context> deserialization_context = + v8::Context::New(current_isolate_v8()); + deserialization_context->Enter(); + testing::SetupIsolateForWasmModule(current_isolate()); + } + + void TearDown() { + current_isolate_v8()->Dispose(); + current_isolate_v8_ = nullptr; + } + + v8::internal::AccountingAllocator allocator_; + Zone zone_; + v8::WasmCompiledModule::SerializedModule data_; + v8::WasmCompiledModule::CallerOwnedBuffer wire_bytes_; + v8::WasmCompiledModule::CallerOwnedBuffer serialized_bytes_; + v8::Isolate* current_isolate_v8_; +}; + +const char* WasmSerializationTest::kFunctionName = "increment"; + +TEST(DeserializeValidModule) { + WasmSerializationTest test; + { + HandleScope scope(test.current_isolate()); + test.DeserializeAndRun(); + } + Cleanup(test.current_isolate()); + Cleanup(); +} + +TEST(DeserializeMismatchingVersion) { + WasmSerializationTest test; + { + HandleScope scope(test.current_isolate()); + test.InvalidateVersion(); + test.DeserializeAndRun(); + } + Cleanup(test.current_isolate()); + Cleanup(); +} + +TEST(DeserializeNoSerializedData) { + WasmSerializationTest test; + { + HandleScope scope(test.current_isolate()); + test.ClearSerializedData(); + test.DeserializeAndRun(); + } + Cleanup(test.current_isolate()); + Cleanup(); +} + +TEST(DeserializeWireBytesAndSerializedDataInvalid) { + WasmSerializationTest test; + { + HandleScope scope(test.current_isolate()); + test.InvalidateVersion(); + test.InvalidateWireBytes(); + test.Deserialize(); + } + Cleanup(test.current_isolate()); + Cleanup(); } 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); + { + // Initial memory size is 16, see wasm-module-builder.cc + static const int kExpectedValue = 16; + TestSignatures sigs; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + + 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); + } + Cleanup(); } 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); + { + // Initial memory size = 16 + GrowMemory(10) + static const int kExpectedValue = 26; + TestSignatures sigs; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + + 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); + } + Cleanup(); +} + +TEST(GrowMemoryZero) { + { + // Initial memory size is 16, see wasm-module-builder.cc + static const int kExpectedValue = 16; + TestSignatures sigs; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); + ExportAsMain(f); + byte code[] = {WASM_GROW_MEMORY(WASM_I32V(0))}; + f->EmitCode(code, sizeof(code)); + TestModule(&zone, builder, kExpectedValue); + } + Cleanup(); +} + +class InterruptThread : public v8::base::Thread { + public: + explicit InterruptThread(Isolate* isolate, int32_t* memory) + : Thread(Options("TestInterruptLoop")), + isolate_(isolate), + memory_(memory) {} + + static void OnInterrupt(v8::Isolate* isolate, void* data) { + int32_t* m = reinterpret_cast<int32_t*>(data); + // Set the interrupt location to 0 to break the loop in {TestInterruptLoop}. + int32_t* ptr = &m[interrupt_location_]; + WriteLittleEndianValue<int32_t>(ptr, interrupt_value_); + } + + virtual void Run() { + // Wait for the main thread to write the signal value. + int32_t val = 0; + do { + val = memory_[0]; + val = ReadLittleEndianValue<int32_t>(&val); + } while (val != signal_value_); + isolate_->RequestInterrupt(&OnInterrupt, const_cast<int32_t*>(memory_)); + } + + Isolate* isolate_; + volatile int32_t* memory_; + static const int32_t interrupt_location_ = 10; + static const int32_t interrupt_value_ = 154; + static const int32_t signal_value_ = 1221; +}; + +TEST(TestInterruptLoop) { + { + // Do not dump the module of this test because it contains an infinite loop. + if (FLAG_dump_wasm_module) return; + + // This test tests that WebAssembly loops can be interrupted, i.e. that if + // an + // InterruptCallback is registered by {Isolate::RequestInterrupt}, then the + // InterruptCallback is eventually called even if a loop in WebAssembly code + // is executed. + // Test setup: + // The main thread executes a WebAssembly function with a loop. In the loop + // {signal_value_} is written to memory to signal a helper thread that the + // main thread reached the loop in the WebAssembly program. When the helper + // thread reads {signal_value_} from memory, it registers the + // InterruptCallback. Upon exeution, the InterruptCallback write into the + // WebAssemblyMemory to end the loop in the WebAssembly program. + TestSignatures sigs; + Isolate* isolate = CcTest::InitIsolateOnce(); + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + WasmFunctionBuilder* f = builder->AddFunction(sigs.i_v()); + ExportAsMain(f); + byte code[] = { + WASM_LOOP( + WASM_IFB(WASM_NOT(WASM_LOAD_MEM( + MachineType::Int32(), + WASM_I32V(InterruptThread::interrupt_location_ * 4))), + WASM_STORE_MEM(MachineType::Int32(), WASM_ZERO, + WASM_I32V(InterruptThread::signal_value_)), + WASM_BR(1))), + WASM_I32V(121)}; + f->EmitCode(code, sizeof(code)); + ZoneBuffer buffer(&zone); + builder->WriteTo(buffer); + + HandleScope scope(isolate); + testing::SetupIsolateForWasmModule(isolate); + ErrorThrower thrower(isolate, "Test"); + const Handle<JSObject> instance = + testing::CompileInstantiateWasmModuleForTesting( + isolate, &thrower, buffer.begin(), buffer.end(), + ModuleOrigin::kWasmOrigin); + CHECK(!instance.is_null()); + + MaybeHandle<JSArrayBuffer> maybe_memory = + GetInstanceMemory(isolate, instance); + Handle<JSArrayBuffer> memory = maybe_memory.ToHandleChecked(); + int32_t* memory_array = reinterpret_cast<int32_t*>(memory->backing_store()); + + InterruptThread thread(isolate, memory_array); + thread.Start(); + testing::RunWasmModuleForTesting(isolate, instance, 0, nullptr, + ModuleOrigin::kWasmOrigin); + int32_t val = memory_array[InterruptThread::interrupt_location_]; + CHECK_EQ(InterruptThread::interrupt_value_, + ReadLittleEndianValue<int32_t>(&val)); + } + Cleanup(); } 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); + { + TestSignatures sigs; + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + 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); + } + Cleanup(); } 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); + { + 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, ZONE_NAME); + + 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); + } + Cleanup(); } 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()); + { + 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(), ZONE_NAME); + + 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)); - 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); - HandleScope scope(isolate); - ZoneBuffer buffer(&zone); - builder->WriteTo(buffer); - testing::SetupIsolateForWasmModule(isolate); + ErrorThrower thrower(isolate, "Test"); + Handle<JSObject> instance = testing::CompileInstantiateWasmModuleForTesting( + isolate, &thrower, 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); + } + Cleanup(); +} - Handle<JSObject> instance = testing::CompileInstantiateWasmModuleForTesting( - isolate, &zone, buffer.begin(), buffer.end(), ModuleOrigin::kWasmOrigin); - CHECK(!instance.is_null()); +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, ZONE_NAME); + + 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); + + ErrorThrower thrower(isolate, "Test"); + Handle<JSObject> instance = testing::CompileInstantiateWasmModuleForTesting( + isolate, &thrower, 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); + } - // 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)); + 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(); } + Cleanup(); +} - 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_Global_init) { + { + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + TestSignatures sigs; + + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + uint32_t global1 = + builder->AddGlobal(kAstI32, false, false, WasmInitExpr(777777)); + uint32_t global2 = + builder->AddGlobal(kAstI32, false, false, WasmInitExpr(222222)); + WasmFunctionBuilder* f1 = builder->AddFunction(sigs.i_v()); + byte code[] = { + WASM_I32_ADD(WASM_GET_GLOBAL(global1), WASM_GET_GLOBAL(global2))}; + f1->EmitCode(code, sizeof(code)); + ExportAsMain(f1); + TestModule(&zone, builder, 999999); + } + Cleanup(); } -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)); +template <typename CType> +static void RunWasmModuleGlobalInitTest(LocalType type, CType expected) { + { + v8::internal::AccountingAllocator allocator; + Zone zone(&allocator, ZONE_NAME); + TestSignatures sigs; + + LocalType types[] = {type}; + FunctionSig sig(1, 0, types); + + for (int padding = 0; padding < 5; padding++) { + // Test with a simple initializer + WasmModuleBuilder* builder = new (&zone) WasmModuleBuilder(&zone); + + for (int i = 0; i < padding; i++) { // pad global before + builder->AddGlobal(kAstI32, false, false, WasmInitExpr(i + 20000)); + } + uint32_t global = + builder->AddGlobal(type, false, false, WasmInitExpr(expected)); + for (int i = 0; i < padding; i++) { // pad global after + builder->AddGlobal(kAstI32, false, false, WasmInitExpr(i + 30000)); + } + + WasmFunctionBuilder* f1 = builder->AddFunction(&sig); + byte code[] = {WASM_GET_GLOBAL(global)}; + f1->EmitCode(code, sizeof(code)); + ExportAsMain(f1); + TestModule(&zone, builder, expected); + } + } + Cleanup(); +} - HandleScope scope(isolate); - ZoneBuffer buffer(&zone); - builder->WriteTo(buffer); - testing::SetupIsolateForWasmModule(isolate); +TEST(Run_WasmModule_Global_i32) { + RunWasmModuleGlobalInitTest<int32_t>(kAstI32, -983489); + RunWasmModuleGlobalInitTest<int32_t>(kAstI32, 11223344); +} - Handle<JSObject> instance = testing::CompileInstantiateWasmModuleForTesting( - isolate, &zone, buffer.begin(), buffer.end(), ModuleOrigin::kWasmOrigin); +TEST(Run_WasmModule_Global_f32) { + RunWasmModuleGlobalInitTest<float>(kAstF32, -983.9f); + RunWasmModuleGlobalInitTest<float>(kAstF32, 1122.99f); +} - CHECK(!instance.is_null()); +TEST(Run_WasmModule_Global_f64) { + RunWasmModuleGlobalInitTest<double>(kAstF64, -833.9); + RunWasmModuleGlobalInitTest<double>(kAstF64, 86374.25); +} - // 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(); +TEST(InitDataAtTheUpperLimit) { + { + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + testing::SetupIsolateForWasmModule(isolate); + + ErrorThrower thrower(isolate, "Run_WasmModule_InitDataAtTheUpperLimit"); + + const byte data[] = { + WASM_MODULE_HEADER, // -- + kMemorySectionCode, // -- + U32V_1(4), // section size + ENTRY_COUNT(1), // -- + kResizableMaximumFlag, // -- + 1, // initial size + 2, // maximum size + kDataSectionCode, // -- + U32V_1(9), // section size + ENTRY_COUNT(1), // -- + 0, // linear memory index + WASM_I32V_3(0xffff), // destination offset + kExprEnd, + U32V_1(1), // source size + 'c' // data bytes + }; + + testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, + data + arraysize(data), + ModuleOrigin::kWasmOrigin); + if (thrower.error()) { + thrower.Reify()->Print(); + CHECK(false); + } } + Cleanup(); +} - 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); +TEST(EmptyMemoryNonEmptyDataSegment) { + { + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + testing::SetupIsolateForWasmModule(isolate); + + ErrorThrower thrower(isolate, "Run_WasmModule_InitDataAtTheUpperLimit"); + + const byte data[] = { + WASM_MODULE_HEADER, // -- + kMemorySectionCode, // -- + U32V_1(4), // section size + ENTRY_COUNT(1), // -- + kResizableMaximumFlag, // -- + 0, // initial size + 0, // maximum size + kDataSectionCode, // -- + U32V_1(7), // section size + ENTRY_COUNT(1), // -- + 0, // linear memory index + WASM_I32V_1(8), // destination offset + kExprEnd, + U32V_1(1), // source size + 'c' // data bytes + }; + + testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, + data + arraysize(data), + ModuleOrigin::kWasmOrigin); + // It should not be possible to instantiate this module. + CHECK(thrower.error()); } + Cleanup(); +} - 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(); +TEST(EmptyMemoryEmptyDataSegment) { + { + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + testing::SetupIsolateForWasmModule(isolate); + + ErrorThrower thrower(isolate, "Run_WasmModule_InitDataAtTheUpperLimit"); + + const byte data[] = { + WASM_MODULE_HEADER, // -- + kMemorySectionCode, // -- + U32V_1(4), // section size + ENTRY_COUNT(1), // -- + kResizableMaximumFlag, // -- + 0, // initial size + 0, // maximum size + kDataSectionCode, // -- + U32V_1(6), // section size + ENTRY_COUNT(1), // -- + 0, // linear memory index + WASM_I32V_1(24), // destination offset + kExprEnd, + U32V_1(0), // source size + }; + + testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, + data + arraysize(data), + ModuleOrigin::kWasmOrigin); + // It should be possible to instantiate this module. + CHECK(!thrower.error()); + } + Cleanup(); +} + +TEST(MemoryWithOOBEmptyDataSegment) { + { + Isolate* isolate = CcTest::InitIsolateOnce(); + HandleScope scope(isolate); + testing::SetupIsolateForWasmModule(isolate); + + ErrorThrower thrower(isolate, "Run_WasmModule_InitDataAtTheUpperLimit"); + + const byte data[] = { + WASM_MODULE_HEADER, // -- + kMemorySectionCode, // -- + U32V_1(4), // section size + ENTRY_COUNT(1), // -- + kResizableMaximumFlag, // -- + 1, // initial size + 1, // maximum size + kDataSectionCode, // -- + U32V_1(9), // section size + ENTRY_COUNT(1), // -- + 0, // linear memory index + WASM_I32V_4(0x2468ace), // destination offset + kExprEnd, + U32V_1(0), // source size + }; + + testing::CompileInstantiateWasmModuleForTesting(isolate, &thrower, data, + data + arraysize(data), + ModuleOrigin::kWasmOrigin); + // It should be possible to instantiate this module. + CHECK(!thrower.error()); + } + Cleanup(); } 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 e3a28f611b..614e9a4ba5 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm-relocation.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm-relocation.cc @@ -31,7 +31,7 @@ using namespace v8::internal::compiler; /* 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()); \ + CHECK_EQ(1u, module.instance->function_code.size()); \ \ int filter = 1 << RelocInfo::WASM_GLOBAL_REFERENCE; \ \ diff --git a/deps/v8/test/cctest/wasm/test-run-wasm-simd-lowering.cc b/deps/v8/test/cctest/wasm/test-run-wasm-simd-lowering.cc new file mode 100644 index 0000000000..69e770b9b8 --- /dev/null +++ b/deps/v8/test/cctest/wasm/test-run-wasm-simd-lowering.cc @@ -0,0 +1,96 @@ +// 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 "src/wasm/wasm-module.h" + +#include "test/cctest/cctest.h" +#include "test/cctest/compiler/value-helper.h" +#include "test/cctest/wasm/wasm-run-utils.h" +#include "test/common/wasm/test-signatures.h" + +using namespace v8::base; +using namespace v8::internal; +using namespace v8::internal::compiler; +using namespace v8::internal::wasm; + +WASM_EXEC_TEST(Simd_I32x4_Splat) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); + BUILD(r, + WASM_SIMD_I32x4_EXTRACT_LANE(0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(5)))); + FOR_INT32_INPUTS(i) { CHECK_EQ(5, r.Call()); } +} + +WASM_EXEC_TEST(Simd_I32x4_Add) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); + BUILD(r, WASM_SIMD_I32x4_EXTRACT_LANE( + 0, WASM_SIMD_I32x4_ADD(WASM_SIMD_I32x4_SPLAT(WASM_I32V(5)), + WASM_SIMD_I32x4_SPLAT(WASM_I32V(6))))); + FOR_INT32_INPUTS(i) { CHECK_EQ(11, r.Call()); } +} + +WASM_EXEC_TEST(Simd_F32x4_Splat) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); + BUILD(r, + WASM_IF_ELSE(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE( + 0, WASM_SIMD_F32x4_SPLAT(WASM_F32(9.5))), + WASM_F32(9.5)), + WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); + FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } +} + +WASM_EXEC_TEST(Simd_I32x4_Extract_With_F32x4) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); + BUILD(r, + WASM_IF_ELSE(WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE( + 0, WASM_SIMD_F32x4_SPLAT(WASM_F32(30.5))), + WASM_I32_REINTERPRET_F32(WASM_F32(30.5))), + WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); + FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } +} + +WASM_EXEC_TEST(Simd_F32x4_Extract_With_I32x4) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); + BUILD(r, + WASM_IF_ELSE(WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE( + 0, WASM_SIMD_I32x4_SPLAT(WASM_I32V(15))), + WASM_F32_REINTERPRET_I32(WASM_I32V(15))), + WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); + FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } +} + +WASM_EXEC_TEST(Simd_F32x4_Add_With_I32x4) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); + BUILD(r, + WASM_IF_ELSE( + WASM_F32_EQ(WASM_SIMD_F32x4_EXTRACT_LANE( + 0, WASM_SIMD_F32x4_ADD( + WASM_SIMD_I32x4_SPLAT(WASM_I32V(32)), + WASM_SIMD_I32x4_SPLAT(WASM_I32V(19)))), + WASM_F32_ADD(WASM_F32_REINTERPRET_I32(WASM_I32V(32)), + WASM_F32_REINTERPRET_I32(WASM_I32V(19)))), + WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); + FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } +} + +WASM_EXEC_TEST(Simd_I32x4_Add_With_F32x4) { + FLAG_wasm_simd_prototype = true; + WasmRunner<int32_t> r(kExecuteCompiled, MachineType::Int32()); + BUILD(r, + WASM_IF_ELSE( + WASM_I32_EQ(WASM_SIMD_I32x4_EXTRACT_LANE( + 0, WASM_SIMD_I32x4_ADD( + WASM_SIMD_F32x4_SPLAT(WASM_F32(21.25)), + WASM_SIMD_F32x4_SPLAT(WASM_F32(31.5)))), + WASM_I32_ADD(WASM_I32_REINTERPRET_F32(WASM_F32(21.25)), + WASM_I32_REINTERPRET_F32(WASM_F32(31.5)))), + WASM_RETURN1(WASM_I32V(1)), WASM_RETURN1(WASM_I32V(0)))); + FOR_INT32_INPUTS(i) { CHECK_EQ(1, r.Call()); } +} diff --git a/deps/v8/test/cctest/wasm/test-run-wasm.cc b/deps/v8/test/cctest/wasm/test-run-wasm.cc index d9d9db80e1..a42a81ba27 100644 --- a/deps/v8/test/cctest/wasm/test-run-wasm.cc +++ b/deps/v8/test/cctest/wasm/test-run-wasm.cc @@ -79,6 +79,14 @@ WASM_EXEC_TEST(Int32Const_many) { } } +WASM_EXEC_TEST(GraphTrimming) { + // This WebAssembly code requires graph trimming in the TurboFan compiler. + WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); + BUILD(r, kExprGetLocal, 0, kExprGetLocal, 0, kExprGetLocal, 0, kExprI32RemS, + kExprI32Eq, kExprGetLocal, 0, kExprI32DivS, kExprUnreachable); + r.Call(1); +} + WASM_EXEC_TEST(Int32Param0) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // return(local[0]) @@ -440,6 +448,42 @@ WASM_EXEC_TEST(Int32DivS_byzero_const) { } } +WASM_EXEC_TEST(Int32AsmjsDivS_byzero_const) { + for (int8_t denom = -2; denom < 8; ++denom) { + TestingModule module(execution_mode); + module.ChangeOriginToAsmjs(); + WasmRunner<int32_t> r(&module, MachineType::Int32()); + BUILD(r, WASM_I32_ASMJS_DIVS(WASM_GET_LOCAL(0), WASM_I8(denom))); + FOR_INT32_INPUTS(i) { + if (denom == 0) { + CHECK_EQ(0, r.Call(*i)); + } else if (denom == -1 && *i == std::numeric_limits<int32_t>::min()) { + CHECK_EQ(std::numeric_limits<int32_t>::min(), r.Call(*i)); + } else { + CHECK_EQ(*i / denom, r.Call(*i)); + } + } + } +} + +WASM_EXEC_TEST(Int32AsmjsRemS_byzero_const) { + for (int8_t denom = -2; denom < 8; ++denom) { + TestingModule module(execution_mode); + module.ChangeOriginToAsmjs(); + WasmRunner<int32_t> r(&module, MachineType::Int32()); + BUILD(r, WASM_I32_ASMJS_REMS(WASM_GET_LOCAL(0), WASM_I8(denom))); + FOR_INT32_INPUTS(i) { + if (denom == 0) { + CHECK_EQ(0, r.Call(*i)); + } else if (denom == -1 && *i == std::numeric_limits<int32_t>::min()) { + CHECK_EQ(0, r.Call(*i)); + } else { + CHECK_EQ(*i % denom, r.Call(*i)); + } + } + } +} + WASM_EXEC_TEST(Int32DivU_byzero_const) { for (uint32_t denom = 0xfffffffe; denom < 8; ++denom) { WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32()); @@ -783,6 +827,15 @@ WASM_EXEC_TEST(Return_F64) { } } +WASM_EXEC_TEST(Select_float_parameters) { + WasmRunner<float> r(execution_mode, MachineType::Float32(), + MachineType::Float32(), MachineType::Int32()); + // return select(11, 22, a); + BUILD(r, + WASM_SELECT(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1), WASM_GET_LOCAL(2))); + CHECK_FLOAT_EQ(2.0f, r.Call(2.0f, 1.0f, 1)); +} + WASM_EXEC_TEST(Select) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); // return select(11, 22, a); @@ -852,6 +905,15 @@ WASM_EXEC_TEST(Br_height) { } } +WASM_EXEC_TEST(Regression_660262) { + TestingModule module(execution_mode); + module.AddMemoryElems<int32_t>(8); + WasmRunner<int32_t> r(&module); + BUILD(r, kExprI8Const, 0x00, kExprI8Const, 0x00, kExprI32LoadMem, 0x00, 0x0f, + kExprBrTable, 0x00, 0x80, 0x00); // entries=0 + r.Call(); +} + 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)))), @@ -1047,6 +1109,20 @@ WASM_EXEC_TEST(I32ReinterpretF32) { } } +WASM_EXEC_TEST(LoadMaxUint32Offset) { + TestingModule module(execution_mode); + module.AddMemoryElems<int32_t>(8); + WasmRunner<int32_t> r(&module); + + BUILD(r, kExprI8Const, 0, // index + static_cast<byte>(v8::internal::wasm::WasmOpcodes::LoadStoreOpcodeOf( + MachineType::Int32(), false)), // -- + 0, // alignment + U32V_5(0xffffffff)); // offset + + CHECK_TRAP32(r.Call()); +} + WASM_EXEC_TEST(LoadStoreLoad) { TestingModule module(execution_mode); int32_t* memory = module.AddMemoryElems<int32_t>(8); @@ -1134,7 +1210,7 @@ WASM_EXEC_TEST(Block_empty_brif2) { WasmRunner<uint32_t> r(execution_mode, MachineType::Uint32(), MachineType::Uint32()); 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)); } + FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i, *i + 1)); } } WASM_EXEC_TEST(Block_i) { @@ -1158,7 +1234,7 @@ WASM_EXEC_TEST(Block_d) { WASM_EXEC_TEST(Block_br2) { WasmRunner<int32_t> r(execution_mode, MachineType::Int32()); BUILD(r, WASM_BLOCK_I(WASM_BRV(0, WASM_GET_LOCAL(0)))); - FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, r.Call(*i)); } + FOR_UINT32_INPUTS(i) { CHECK_EQ(*i, static_cast<uint32_t>(r.Call(*i))); } } WASM_EXEC_TEST(Block_If_P) { @@ -1520,7 +1596,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob_misaligned) { BUILD(r, WASM_LOAD_MEM_OFFSET(MachineType::Int32(), offset, WASM_I8(index))); - if ((offset + index) <= (kMemSize - sizeof(int32_t))) { + if ((offset + index) <= static_cast<int>((kMemSize - sizeof(int32_t)))) { CHECK_EQ(module.raw_val_at<int32_t>(offset + index), r.Call()); } else { CHECK_TRAP(r.Call()); @@ -1542,7 +1618,7 @@ WASM_EXEC_TEST(LoadMemI32_const_oob) { BUILD(r, WASM_LOAD_MEM_OFFSET(MachineType::Int32(), offset, WASM_I8(index))); - if ((offset + index) <= (kMemSize - sizeof(int32_t))) { + if ((offset + index) <= static_cast<int>((kMemSize - sizeof(int32_t)))) { CHECK_EQ(module.raw_val_at<int32_t>(offset + index), r.Call()); } else { CHECK_TRAP(r.Call()); @@ -1693,7 +1769,7 @@ WASM_EXEC_TEST(CheckMachIntsZero) { /**/ kExprI8Const, 0); // -- module.BlankMemory(); - CHECK_EQ(0, r.Call((kNumElems - 1) * 4)); + CHECK_EQ(0u, r.Call((kNumElems - 1) * 4)); } WASM_EXEC_TEST(MemF32_Sum) { @@ -1853,7 +1929,7 @@ WASM_EXEC_TEST(Infinite_Loop_not_taken2_brif) { static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { Isolate* isolate = CcTest::InitIsolateOnce(); - Zone zone(isolate->allocator()); + Zone zone(isolate->allocator(), ZONE_NAME); HandleScope scope(isolate); // Enable all optional operators. CommonOperatorBuilder common(&zone); @@ -1868,7 +1944,7 @@ static void TestBuildGraphForSimpleExpression(WasmOpcode opcode) { TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code, code + arraysize(code)); } else { - CHECK_EQ(2, sig->parameter_count()); + CHECK_EQ(2u, sig->parameter_count()); byte code[] = {WASM_NO_LOCALS, kExprGetLocal, 0, kExprGetLocal, 1, static_cast<byte>(opcode)}; TestBuildingGraph(&zone, &jsgraph, nullptr, sig, nullptr, code, @@ -2240,7 +2316,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::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); TestingModule module(execution_mode); module.AddMemory(1024); MachineType* memtypes = &mixed[start]; @@ -2610,7 +2686,7 @@ WASM_EXEC_TEST(MultipleCallIndirect) { CHECK_TRAP(r.Call(2, 1, 0)); } -WASM_EXEC_TEST(CallIndirect_NoTable) { +WASM_EXEC_TEST(CallIndirect_EmptyTable) { TestSignatures sigs; TestingModule module(execution_mode); @@ -2622,6 +2698,7 @@ WASM_EXEC_TEST(CallIndirect_NoTable) { // Signature table. module.AddSignature(sigs.f_ff()); module.AddSignature(sigs.i_ii()); + module.AddIndirectFunctionTable(nullptr, 0); // Builder the caller function. WasmRunner<int32_t> r(&module, MachineType::Int32()); @@ -2632,6 +2709,49 @@ WASM_EXEC_TEST(CallIndirect_NoTable) { CHECK_TRAP(r.Call(2)); } +WASM_EXEC_TEST(CallIndirect_canonical) { + TestSignatures sigs; + TestingModule module(execution_mode); + + WasmFunctionCompiler t1(sigs.i_ii(), &module); + BUILD(t1, WASM_I32_ADD(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + t1.CompileAndAdd(/*sig_index*/ 0); + + WasmFunctionCompiler t2(sigs.i_ii(), &module); + BUILD(t2, WASM_I32_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + t2.CompileAndAdd(/*sig_index*/ 1); + + WasmFunctionCompiler t3(sigs.f_ff(), &module); + BUILD(t3, WASM_F32_SUB(WASM_GET_LOCAL(0), WASM_GET_LOCAL(1))); + t3.CompileAndAdd(/*sig_index*/ 2); + + // Signature table. + module.AddSignature(sigs.i_ii()); + module.AddSignature(sigs.i_ii()); + module.AddSignature(sigs.f_ff()); + + // Function table. + uint16_t i1 = static_cast<uint16_t>(t1.function_index()); + uint16_t i2 = static_cast<uint16_t>(t2.function_index()); + uint16_t i3 = static_cast<uint16_t>(t3.function_index()); + uint16_t indirect_function_table[] = {i1, i2, i3, i1, i2}; + + module.AddIndirectFunctionTable(indirect_function_table, + arraysize(indirect_function_table)); + module.PopulateIndirectFunctionTable(); + + // Builder the caller function. + WasmRunner<int32_t> r(&module, MachineType::Int32()); + BUILD(r, WASM_CALL_INDIRECT2(1, WASM_GET_LOCAL(0), WASM_I8(77), WASM_I8(11))); + + CHECK_EQ(88, r.Call(0)); + CHECK_EQ(66, r.Call(1)); + CHECK_TRAP(r.Call(2)); + CHECK_EQ(88, r.Call(3)); + CHECK_EQ(66, r.Call(4)); + CHECK_TRAP(r.Call(5)); +} + WASM_EXEC_TEST(F32Floor) { WasmRunner<float> r(execution_mode, MachineType::Float32()); BUILD(r, WASM_F32_FLOOR(WASM_GET_LOCAL(0))); @@ -2830,7 +2950,7 @@ static void CompileCallIndirectMany(LocalType param) { TestSignatures sigs; for (byte num_params = 0; num_params < 40; ++num_params) { v8::internal::AccountingAllocator allocator; - Zone zone(&allocator); + Zone zone(&allocator, ZONE_NAME); HandleScope scope(CcTest::InitIsolateOnce()); TestingModule module(kExecuteCompiled); FunctionSig* sig = sigs.many(&zone, kAstStmt, param, num_params); @@ -2846,7 +2966,7 @@ static void CompileCallIndirectMany(LocalType param) { ADD_CODE(code, kExprGetLocal, p); } ADD_CODE(code, kExprI8Const, 0); - ADD_CODE(code, kExprCallIndirect, 1); + ADD_CODE(code, kExprCallIndirect, 1, TABLE_ZERO); t.Build(&code[0], &code[0] + code.size()); t.Compile(); 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 deleted file mode 100644 index 9a4394204b..0000000000 --- a/deps/v8/test/cctest/wasm/test-wasm-function-name-table.cc +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "src/wasm/wasm-function-name-table.h" -#include "src/wasm/wasm-module.h" - -#include "test/cctest/cctest.h" - -using namespace v8::internal; -using namespace v8::internal::wasm; - -namespace { - -#define CHECK_STREQ(exp, found) \ - do { \ - Vector<const char> exp_ = (exp); \ - Vector<const char> found_ = (found); \ - if (V8_UNLIKELY(exp_.length() != found_.length() || \ - memcmp(exp_.start(), found_.start(), exp_.length()))) { \ - V8_Fatal(__FILE__, __LINE__, \ - "Check failed: (%s) != (%s) ('%.*s' vs '%.*s').", #exp, #found, \ - exp_.length(), exp_.start(), found_.length(), found_.start()); \ - } \ - } while (0) - -void testFunctionNameTable(Vector<Vector<const char>> names) { - Isolate *isolate = CcTest::InitIsolateOnce(); - HandleAndZoneScope scope; - - WasmModule module; - std::vector<char> all_names; - // No name should have offset 0, because that encodes unnamed functions. - // In real wasm binary, offset 0 is impossible anyway. - all_names.push_back('\0'); - - uint32_t func_index = 0; - for (Vector<const char> name : names) { - size_t name_offset = name.start() ? all_names.size() : 0; - all_names.insert(all_names.end(), name.start(), - 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, false, false}); - ++func_index; - } - - module.module_start = reinterpret_cast<byte *>(all_names.data()); - module.module_end = module.module_start + all_names.size(); - - Handle<Object> wasm_function_name_table = - BuildFunctionNamesTable(isolate, &module); - CHECK(wasm_function_name_table->IsByteArray()); - - func_index = 0; - for (Vector<const char> name : names) { - MaybeHandle<String> string = GetWasmFunctionNameFromTable( - Handle<ByteArray>::cast(wasm_function_name_table), func_index); - if (name.start()) { - CHECK(string.ToHandleChecked()->IsUtf8EqualTo(name)); - } else { - CHECK(string.is_null()); - } - ++func_index; - } -} - -void testFunctionNameTable(Vector<const char *> names) { - std::vector<Vector<const char>> names_vec; - for (const char *name : names) - names_vec.push_back(name ? CStrVector(name) : Vector<const char>()); - testFunctionNameTable(Vector<Vector<const char>>( - names_vec.data(), static_cast<int>(names_vec.size()))); -} - -} // namespace - -TEST(NoFunctions) { testFunctionNameTable(Vector<Vector<const char>>()); } - -TEST(OneFunctions) { - const char *names[] = {"foo"}; - testFunctionNameTable(ArrayVector(names)); -} - -TEST(ThreeFunctions) { - const char *names[] = {"foo", "bar", "baz"}; - testFunctionNameTable(ArrayVector(names)); -} - -TEST(OneUnnamedFunction) { - const char *names[] = {""}; - testFunctionNameTable(ArrayVector(names)); -} - -TEST(UnnamedFirstFunction) { - const char *names[] = {"", "bar", "baz"}; - testFunctionNameTable(ArrayVector(names)); -} - -TEST(UnnamedLastFunction) { - const char *names[] = {"bar", "baz", ""}; - testFunctionNameTable(ArrayVector(names)); -} - -TEST(ThreeUnnamedFunctions) { - const char *names[] = {"", "", ""}; - testFunctionNameTable(ArrayVector(names)); -} - -TEST(UTF8Names) { - const char *names[] = {"↱fun↰", "↺", "alpha:α beta:β"}; - testFunctionNameTable(ArrayVector(names)); -} - -TEST(UnnamedVsEmptyNames) { - const char *names[] = {"", nullptr, nullptr, ""}; - testFunctionNameTable(ArrayVector(names)); -} diff --git a/deps/v8/test/cctest/wasm/test-wasm-stack.cc b/deps/v8/test/cctest/wasm/test-wasm-stack.cc index 2b51287e87..a0c2e73f9d 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-stack.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-stack.cc @@ -110,13 +110,13 @@ TEST(CollectDetailedWasmStack_ExplicitThrowFromJs) { Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); CHECK(returnObjMaybe.is_null()); - // The column is 1-based, so add 1 to the actual byte offset. + // Line and column are 1-based, so add 1 for the expected wasm output. ExceptionInfo expected_exceptions[] = { - {"a", 3, 8}, // - - {"js", 4, 2}, // - - {"<WASM UNNAMED>", static_cast<int>(wasm_index), 3}, // - - {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 2}, // - - {"callFn", 1, 24} // - + {"a", 3, 8}, // - + {"js", 4, 2}, // - + {"<WASM UNNAMED>", static_cast<int>(wasm_index) + 1, 3}, // - + {"<WASM UNNAMED>", static_cast<int>(wasm_index_2) + 1, 2}, // - + {"callFn", 1, 24} // - }; CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); } @@ -154,11 +154,11 @@ TEST(CollectDetailedWasmStack_WasmError) { Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); CHECK(maybe_return_obj.is_null()); - // The column is 1-based, so add 1 to the actual byte offset. + // Line and column are 1-based, so add 1 for the expected wasm output. ExceptionInfo expected_exceptions[] = { - {"<WASM UNNAMED>", static_cast<int>(wasm_index), 2}, // - - {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 2}, // - - {"callFn", 1, 24} //- + {"<WASM UNNAMED>", static_cast<int>(wasm_index) + 1, 2}, // - + {"<WASM UNNAMED>", static_cast<int>(wasm_index_2) + 1, 2}, // - + {"callFn", 1, 24} //- }; CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); } 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 d4a2b4fe0b..bd4e82dc4c 100644 --- a/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc +++ b/deps/v8/test/cctest/wasm/test-wasm-trap-position.cc @@ -88,10 +88,10 @@ TEST(Unreachable) { Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); CHECK(returnObjMaybe.is_null()); - // The column is 1-based, so add 1 to the actual byte offset. + // Line and column are 1-based, so add 1 for the expected wasm output. ExceptionInfo expected_exceptions[] = { - {"<WASM UNNAMED>", static_cast<int>(wasm_index), 2}, // -- - {"callFn", 1, 24} // -- + {"<WASM UNNAMED>", static_cast<int>(wasm_index) + 1, 2}, // -- + {"callFn", 1, 24} // -- }; CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); } @@ -130,11 +130,11 @@ TEST(IllegalLoad) { Execution::TryCall(isolate, js_trampoline, global, 1, args, &maybe_exc); CHECK(returnObjMaybe.is_null()); - // The column is 1-based, so add 1 to the actual byte offset. + // Line and column are 1-based, so add 1 for the expected wasm output. ExceptionInfo expected_exceptions[] = { - {"<WASM UNNAMED>", static_cast<int>(wasm_index), 8}, // -- - {"<WASM UNNAMED>", static_cast<int>(wasm_index_2), 3}, // -- - {"callFn", 1, 24} // -- + {"<WASM UNNAMED>", static_cast<int>(wasm_index) + 1, 8}, // -- + {"<WASM UNNAMED>", static_cast<int>(wasm_index_2) + 1, 3}, // -- + {"callFn", 1, 24} // -- }; CheckExceptionInfos(maybe_exc.ToHandleChecked(), expected_exceptions); } diff --git a/deps/v8/test/cctest/wasm/wasm-run-utils.h b/deps/v8/test/cctest/wasm/wasm-run-utils.h index 93fcb89dba..284b21c7c4 100644 --- a/deps/v8/test/cctest/wasm/wasm-run-utils.h +++ b/deps/v8/test/cctest/wasm/wasm-run-utils.h @@ -8,25 +8,25 @@ #include <stdint.h> #include <stdlib.h> #include <string.h> - #include <memory> #include "src/base/utils/random-number-generator.h" #include "src/zone/accounting-allocator.h" +#include "src/compiler/compiler-source-position-table.h" #include "src/compiler/graph-visualizer.h" #include "src/compiler/int64-lowering.h" #include "src/compiler/js-graph.h" #include "src/compiler/node.h" #include "src/compiler/pipeline.h" #include "src/compiler/wasm-compiler.h" -#include "src/compiler/zone-pool.h" - +#include "src/compiler/zone-stats.h" #include "src/wasm/ast-decoder.h" #include "src/wasm/wasm-interpreter.h" #include "src/wasm/wasm-js.h" #include "src/wasm/wasm-macro-gen.h" #include "src/wasm/wasm-module.h" +#include "src/wasm/wasm-objects.h" #include "src/wasm/wasm-opcodes.h" #include "src/zone/zone.h" @@ -68,7 +68,7 @@ const uint32_t kMaxGlobalsSize = 128; // A helper for module environments that adds the ability to allocate memory // and global variables. Contains a built-in {WasmModule} and -// {WasmModuleInstance}. +// {WasmInstance}. class TestingModule : public ModuleEnv { public: explicit TestingModule(WasmExecutionMode mode = kExecuteCompiled) @@ -97,9 +97,11 @@ class TestingModule : public ModuleEnv { if (interpreter_) delete interpreter_; } + void ChangeOriginToAsmjs() { origin = kAsmJsOrigin; } + byte* AddMemory(uint32_t size) { CHECK_NULL(instance->mem_start); - CHECK_EQ(0, instance->mem_size); + CHECK_EQ(0u, instance->mem_size); instance->mem_start = reinterpret_cast<byte*>(malloc(size)); CHECK(instance->mem_start); memset(instance->mem_start, 0, size); @@ -206,21 +208,15 @@ class TestingModule : public ModuleEnv { Handle<JSFunction> WrapCode(uint32_t index) { // Wrap the code so it can be called as a JS function. Handle<String> name = isolate_->factory()->NewStringFromStaticChars("main"); - Handle<JSObject> module_object = Handle<JSObject>(0, isolate_); + Handle<WasmInstanceObject> instance_obj(0, isolate_); Handle<Code> code = instance->function_code[index]; WasmJs::InstallWasmMapsIfNeeded(isolate_, isolate_->native_context()); Handle<Code> ret_code = compiler::CompileJSToWasmWrapper(isolate_, this, code, index); - FunctionSig* funcSig = this->module->functions[index].sig; - Handle<ByteArray> exportedSig = isolate_->factory()->NewByteArray( - static_cast<int>(funcSig->parameter_count() + funcSig->return_count()), - TENURED); - exportedSig->copy_in(0, reinterpret_cast<const byte*>(funcSig->raw_data()), - exportedSig->length()); - Handle<JSFunction> ret = WrapExportCodeAsJSFunction( - isolate_, ret_code, name, + Handle<JSFunction> ret = WasmExportedFunction::New( + isolate_, instance_obj, name, ret_code, static_cast<int>(this->module->functions[index].sig->parameter_count()), - exportedSig, module_object); + static_cast<int>(index)); return ret; } @@ -228,24 +224,35 @@ class TestingModule : public ModuleEnv { instance->function_code[index] = code; } - void AddIndirectFunctionTable(uint16_t* functions, uint32_t table_size) { - module_.function_tables.push_back( - {table_size, table_size, std::vector<int32_t>(), false, false}); + void AddIndirectFunctionTable(uint16_t* function_indexes, + uint32_t table_size) { + module_.function_tables.push_back({table_size, table_size, true, + std::vector<int32_t>(), false, false, + SignatureMap()}); + WasmIndirectFunctionTable& table = module_.function_tables.back(); + table.min_size = table_size; + table.max_size = table_size; for (uint32_t i = 0; i < table_size; ++i) { - module_.function_tables.back().values.push_back(functions[i]); + table.values.push_back(function_indexes[i]); + table.map.FindOrInsert(module_.functions[function_indexes[i]].sig); } - Handle<FixedArray> values = BuildFunctionTable( - isolate_, static_cast<int>(module_.function_tables.size() - 1), - &module_); - instance->function_tables.push_back(values); + instance->function_tables.push_back( + isolate_->factory()->NewFixedArray(table_size * 2)); } void PopulateIndirectFunctionTable() { + // Initialize the fixed arrays in instance->function_tables. for (uint32_t i = 0; i < instance->function_tables.size(); i++) { - PopulateFunctionTable(instance->function_tables[i], - module_.function_tables[i].size, - &instance->function_code); + WasmIndirectFunctionTable& table = module_.function_tables[i]; + Handle<FixedArray> array = instance->function_tables[i]; + int table_size = static_cast<int>(table.values.size()); + for (int j = 0; j < table_size; j++) { + WasmFunction& function = module_.functions[table.values[j]]; + array->set(j, Smi::FromInt(table.map.Find(function.sig))); + array->set(j + table_size, + *instance->function_code[function.func_index]); + } } } @@ -257,7 +264,7 @@ class TestingModule : public ModuleEnv { private: WasmExecutionMode execution_mode_; WasmModule module_; - WasmModuleInstance instance_; + WasmInstance instance_; Isolate* isolate_; v8::internal::AccountingAllocator allocator_; uint32_t global_offset; @@ -268,7 +275,7 @@ class TestingModule : public ModuleEnv { byte size = WasmOpcodes::MemSize(WasmOpcodes::MachineTypeFor(type)); global_offset = (global_offset + size - 1) & ~(size - 1); // align module_.globals.push_back( - {type, true, NO_INIT, global_offset, false, false}); + {type, true, WasmInitExpr(), global_offset, false, false}); global_offset += size; // limit number of globals. CHECK_LT(global_offset, kMaxGlobalsSize); @@ -300,10 +307,7 @@ inline void TestBuildingGraph(Zone* zone, JSGraph* jsgraph, ModuleEnv* module, FATAL(str.str().c_str()); } builder.Int64LoweringForTesting(); - if (FLAG_trace_turbo_graph) { - OFStream os(stdout); - os << AsRPO(*jsgraph->graph()); - } + builder.SimdScalarLoweringForTesting(); } template <typename ReturnType> @@ -354,7 +358,7 @@ class WasmFunctionWrapper : public HandleAndZoneScope, } if (p1 != MachineType::None()) { parameters[parameter_count] = graph()->NewNode( - machine()->Load(p0), + machine()->Load(p1), graph()->NewNode(common()->Parameter(1), graph()->start()), graph()->NewNode(common()->Int32Constant(0)), effect, graph()->start()); @@ -362,7 +366,7 @@ class WasmFunctionWrapper : public HandleAndZoneScope, } if (p2 != MachineType::None()) { parameters[parameter_count] = graph()->NewNode( - machine()->Load(p0), + machine()->Load(p2), graph()->NewNode(common()->Parameter(2), graph()->start()), graph()->NewNode(common()->Int32Constant(0)), effect, graph()->start()); @@ -370,7 +374,7 @@ class WasmFunctionWrapper : public HandleAndZoneScope, } if (p3 != MachineType::None()) { parameters[parameter_count] = graph()->NewNode( - machine()->Load(p0), + machine()->Load(p3), graph()->NewNode(common()->Parameter(3), graph()->start()), graph()->NewNode(common()->Int32Constant(0)), effect, graph()->start()); @@ -390,8 +394,9 @@ class WasmFunctionWrapper : public HandleAndZoneScope, graph()->start()), graph()->NewNode(common()->Int32Constant(0)), call, effect, graph()->start()); + Node* zero = graph()->NewNode(common()->Int32Constant(0)); Node* r = graph()->NewNode( - common()->Return(), + common()->Return(), zero, graph()->NewNode(common()->Int32Constant(WASM_WRAPPER_RETURN_VALUE)), effect, graph()->start()); graph()->SetEnd(graph()->NewNode(common()->End(2), r, graph()->start())); @@ -613,7 +618,7 @@ class WasmRunner { MachineType p1 = MachineType::None(), MachineType p2 = MachineType::None(), MachineType p3 = MachineType::None()) - : zone(&allocator_), + : zone(&allocator_, ZONE_NAME), compiled_(false), signature_(MachineTypeForC<ReturnType>() == MachineType::None() ? 0 : 1, GetParameterCount(p0, p1, p2, p3), storage_), @@ -625,11 +630,12 @@ class WasmRunner { MachineType p1 = MachineType::None(), MachineType p2 = MachineType::None(), MachineType p3 = MachineType::None()) - : zone(&allocator_), + : zone(&allocator_, ZONE_NAME), compiled_(false), signature_(MachineTypeForC<ReturnType>() == MachineType::None() ? 0 : 1, GetParameterCount(p0, p1, p2, p3), storage_), - compiler_(&signature_, module) { + compiler_(&signature_, module), + possible_nondeterminism_(false) { DCHECK(module); InitSigStorage(p0, p1, p2, p3); } @@ -739,6 +745,7 @@ class WasmRunner { thread->PushFrame(compiler_.function_, args.start()); if (thread->Run() == WasmInterpreter::FINISHED) { WasmVal val = thread->GetReturnValue(); + possible_nondeterminism_ |= thread->PossibleNondeterminism(); return val.to<ReturnType>(); } else if (thread->state() == WasmInterpreter::TRAPPED) { // TODO(titzer): return the correct trap code @@ -755,6 +762,7 @@ class WasmRunner { WasmFunction* function() { return compiler_.function_; } WasmInterpreter* interpreter() { return compiler_.interpreter_; } + bool possible_nondeterminism() { return possible_nondeterminism_; } protected: v8::internal::AccountingAllocator allocator_; @@ -764,6 +772,7 @@ class WasmRunner { FunctionSig signature_; WasmFunctionCompiler compiler_; WasmFunctionWrapper<ReturnType> wrapper_; + bool possible_nondeterminism_; bool interpret() { return compiler_.execution_mode_ == kExecuteInterpreted; } |